Rewind: states are now made after n vblanks and platform independ way. Also GTK GUI to configure values. By default this feature is disabled (0 vblanks and 0 states)
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@88837 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
parent
b7cde34703
commit
10b7afe174
|
@ -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)
|
||||
|
|
|
@ -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"><b>Rewind interval</b></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>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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 ()*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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, ...) {
|
||||
|
|
|
@ -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); \
|
||||
|
|
Loading…
Reference in New Issue
Block a user