summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--data/pcsxr.ui97
-rwxr-xr-xgui/ConfDlg.c26
-rwxr-xr-xgui/Config.c2
-rwxr-xr-xgui/Linux.h2
-rwxr-xr-xgui/LnxMain.c8
-rwxr-xr-xgui/Plugin.c9
-rwxr-xr-xlibpcsxcore/misc.c12
-rwxr-xr-xlibpcsxcore/psxcommon.c5
-rwxr-xr-xlibpcsxcore/psxcommon.h2
10 files changed, 140 insertions, 25 deletions
diff --git a/configure.ac b/configure.ac
index 4bbabf66..dff161b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,7 +57,7 @@ AC_CHECK_LIB(dl, dlsym, [LIBS="$LIBS -ldl"], [])
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"], [])
AC_CHECK_LIB(nsl, gethostbyname, [LIBS="$LIBS -lnsl"], [])
AC_CHECK_LIB(umem, umem_alloc, [LIBS="$LIBS -lumem"], [])
-AC_CHECK_LIB(shm, shm_open, [LIBS="$LIBS -lrt"], [AC_DEFINE([NO_RT_SHM], [1], [rt_shm])])
+AC_CHECK_LIB(rt, shm_open, [LIBS="$LIBS -lrt"], [AC_DEFINE([NO_RT_SHM], [1], [rt_shm])])
AM_CONDITIONAL(SOUND_OSS, false)
AM_CONDITIONAL(SOUND_SDL, false)
diff --git a/data/pcsxr.ui b/data/pcsxr.ui
index 439c5302..1c9a5c3f 100644
--- a/data/pcsxr.ui
+++ b/data/pcsxr.ui
@@ -1942,6 +1942,103 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="frame20">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox50">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkLabel" id="label70">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Every</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="GtkEntry_RewindInterval">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="max-length">5</property>
+ <property name="width-chars">5 </property>
+ <property name="input-purpose">GTK_INPUT_PURPOSE_DIGITS</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label71">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">vblanks, max.</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="GtkEntry_RewindCount">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="max-length">5</property>
+ <property name="width-chars">5</property>
+ <property name="input-purpose">GTK_INPUT_PURPOSE_DIGITS</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label72">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">rewinds</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label69">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">&lt;b&gt;Rewind interval&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/gui/ConfDlg.c b/gui/ConfDlg.c
index a4b1f019..2967081b 100755
--- a/gui/ConfDlg.c
+++ b/gui/ConfDlg.c
@@ -843,7 +843,6 @@ static void FindNetPlugin() {
}
GtkWidget *CpuDlg;
-GtkWidget *PsxCombo;
GList *psxglist;
char *psxtypes[] = {
"NTSC",
@@ -874,7 +873,7 @@ static void OnCpu_CpuClicked(GtkWidget *widget, gpointer user_data) {
void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
GtkWidget *widget;
- int tmp;
+ s64 tmp;
long t;
widget = GTK_WIDGET(gtk_builder_get_object(builder, "GtkCombo_PsxType"));
@@ -889,6 +888,12 @@ void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
else
Config.PsxType = PSX_TYPE_PAL;
+ sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_RewindCount"))), "%lu", &tmp);
+ Config.RewindCount = tmp;
+
+ sscanf(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "GtkEntry_RewindInterval"))), "%lu", &tmp);
+ Config.RewindInterval = tmp;
+
Config.Xa = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Xa")));
Config.SioIrq = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SioIrq")));
Config.Mdec = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Mdec")));
@@ -936,7 +941,8 @@ void OnCpu_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) {
}
void OnConf_Cpu() {
-
+ GtkWidget *widget;
+ char buf[25];
builder = gtk_builder_new();
@@ -949,9 +955,17 @@ void OnConf_Cpu() {
gtk_widget_show (CpuDlg);
- PsxCombo = GTK_WIDGET(gtk_builder_get_object(builder, "GtkCombo_PsxType"));
- gtk_combo_box_set_active(GTK_COMBO_BOX (PsxCombo), Config.PsxType);
- gtk_widget_set_sensitive(GTK_WIDGET (PsxCombo), !Config.PsxAuto);
+ widget = GTK_WIDGET(gtk_builder_get_object(builder, "GtkCombo_PsxType"));
+ gtk_combo_box_set_active(GTK_COMBO_BOX (widget), Config.PsxType);
+ gtk_widget_set_sensitive(GTK_WIDGET (widget), !Config.PsxAuto);
+
+ snprintf(buf, sizeof(buf), "%lu", Config.RewindCount);
+ widget = GTK_WIDGET(gtk_builder_get_object(builder, "GtkEntry_RewindCount"));
+ gtk_entry_set_text(GTK_ENTRY(widget), buf);
+
+ snprintf(buf, sizeof(buf), "%lu", Config.RewindInterval);
+ widget = GTK_WIDGET(gtk_builder_get_object(builder, "GtkEntry_RewindInterval"));
+ gtk_entry_set_text(GTK_ENTRY(widget), buf);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_Xa")), Config.Xa);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "GtkCheckButton_SioIrq")), Config.SioIrq);
diff --git a/gui/Config.c b/gui/Config.c
index f6300db9..5f9a0c99 100755
--- a/gui/Config.c
+++ b/gui/Config.c
@@ -143,6 +143,7 @@ int LoadConfig(PcsxConfig *Conf) {
Config.Cpu = GetValuel(data, "Cpu");
Config.PsxType = GetValuel(data, "PsxType");
Config.RewindCount = GetValuel(data, "RewindCount");
+ Config.RewindInterval = GetValuel(data, "RewindInterval");
free(data);
@@ -191,6 +192,7 @@ void SaveConfig() {
SetValuel("Cpu", Config.Cpu);
SetValuel("PsxType", Config.PsxType);
SetValuel("RewindCount", Config.RewindCount);
+ SetValuel("RewindInterval", Config.RewindInterval);
fclose(f);
}
diff --git a/gui/Linux.h b/gui/Linux.h
index 0d2d1493..791f103b 100755
--- a/gui/Linux.h
+++ b/gui/Linux.h
@@ -68,6 +68,4 @@ void UpdatePluginsBIOS();
void SysErrorMessage(gchar *primary, gchar *secondary);
void SysInfoMessage(gchar *primary, gchar *secondary);
-extern u8 rew_timer;
-
#endif /* __LINUX_H__ */
diff --git a/gui/LnxMain.c b/gui/LnxMain.c
index 67cb75ac..aeed5cf2 100755
--- a/gui/LnxMain.c
+++ b/gui/LnxMain.c
@@ -575,17 +575,11 @@ static void SysDisableScreenSaver() {
}
}
-u8 rew_timer = 0u; // TODO: change to scaled ms based or psxcycle based
void SysUpdate() {
PADhandleKey(PAD1_keypressed() );
PADhandleKey(PAD2_keypressed() );
- if (Config.RewindCount > 0 && rew_timer++ > 35) {
- CreateRewindState();
- rew_timer = 0;
- }
-
- //SysDisableScreenSaver();
+ SysDisableScreenSaver();
}
/* ADB TODO Replace RunGui() with StartGui ()*/
diff --git a/gui/Plugin.c b/gui/Plugin.c
index 05b10c58..a1c666dc 100755
--- a/gui/Plugin.c
+++ b/gui/Plugin.c
@@ -111,6 +111,7 @@ time_t tslastpressed = 0;
void PADhandleKey(int key) {
char Text[MAXPATHLEN];
gchar *state_filename;
+ time_t now;
short rel = 0; //released key flag
@@ -287,10 +288,10 @@ void PADhandleKey(int key) {
psxReset();
break;
case XK_BackSpace:
- rew_timer = 0;
- time_t now = clock();
- u32 millis = (((now - tslastpressed) * 1000) / CLOCKS_PER_SEC);
- if (millis <= 130) break;
+ now = clock();
+ //printf("Rewind %u %u %u\n", tslastpressed, now, rewind_counter);
+ rewind_counter = 0;
+ if ((((now - tslastpressed) * 1000) / CLOCKS_PER_SEC) <= 130) break;
tslastpressed = now;
RewindState();
break;
diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c
index 92bb12c5..26e456cc 100755
--- a/libpcsxcore/misc.c
+++ b/libpcsxcore/misc.c
@@ -528,11 +528,13 @@ u32 mem_cur_save_count=0, mem_last_save;
boolean mem_wrapped=FALSE; // Whether we went past max count and restarted counting
void CreateRewindState() {
- SaveStateMem(mem_last_save=mem_cur_save_count++);
-
- if (mem_cur_save_count > Config.RewindCount) {
- mem_cur_save_count = 0;
- mem_wrapped=TRUE;
+ if (Config.RewindCount > 0) {
+ SaveStateMem(mem_last_save=mem_cur_save_count++);
+
+ if (mem_cur_save_count > Config.RewindCount) {
+ mem_cur_save_count = 0;
+ mem_wrapped=TRUE;
+ }
}
}
diff --git a/libpcsxcore/psxcommon.c b/libpcsxcore/psxcommon.c
index 959b9a7d..98525e51 100755
--- a/libpcsxcore/psxcommon.c
+++ b/libpcsxcore/psxcommon.c
@@ -29,6 +29,7 @@ boolean NetOpened = FALSE;
int Log = 0;
FILE *emuLog = NULL;
+u32 rewind_counter=0; // It is safe if this overflows
int EmuInit() {
return psxInit();
@@ -57,6 +58,10 @@ void EmuUpdate() {
SysUpdate();
ApplyCheats();
+
+ if (Config.RewindInterval > 0 && !(++rewind_counter%Config.RewindInterval)) {
+ CreateRewindState();
+ }
}
void __Log(char *fmt, ...) {
diff --git a/libpcsxcore/psxcommon.h b/libpcsxcore/psxcommon.h
index 16428115..b6f83e74 100755
--- a/libpcsxcore/psxcommon.h
+++ b/libpcsxcore/psxcommon.h
@@ -158,6 +158,7 @@ typedef struct {
u8 Cpu; // CPU_DYNAREC or CPU_INTERPRETER
u8 PsxType; // PSX_TYPE_NTSC or PSX_TYPE_PAL
u32 RewindCount;
+ u32 RewindInterval;
#ifdef _WIN32
char Lang[256];
#endif
@@ -165,6 +166,7 @@ typedef struct {
extern PcsxConfig Config;
extern boolean NetOpened;
+extern u32 rewind_counter; // It is safe if this overflows
#define gzfreeze(ptr, size) { \
if (Mode == 1) gzwrite(f, ptr, size); \