gtk-glade: Fix wrong savestate slot, bug #3305716
satelight reports the menu item position for savestates does not match the slots they are saved. As zeromus explains the pattern should be: F1 saves to ds1 F2 saves to ds2 F10 saves to ds0 recent savestates list looks like: 1 myfile.ds1 F1 2 myfile.ds2 F2 ... 0 myfile.ds0 F10 Based on a patch from satelight.
This commit is contained in:
parent
b140005236
commit
93304143f9
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "callbacks.h"
|
#include "callbacks.h"
|
||||||
|
|
||||||
|
#define SAVESTATE_SLOT(x) ((x) < 10 ? (x) : 0)
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
int Frameskip = 0;
|
int Frameskip = 0;
|
||||||
gboolean ScreenRightForce=FALSE;
|
gboolean ScreenRightForce=FALSE;
|
||||||
|
@ -62,7 +64,7 @@ static void update_savestate_menu(const char * cb_name, u8 num)
|
||||||
|
|
||||||
snprintf( cb, 39, "%s%d", cb_name, num);
|
snprintf( cb, 39, "%s%d", cb_name, num);
|
||||||
w = glade_xml_get_widget(xml, cb);
|
w = glade_xml_get_widget(xml, cb);
|
||||||
set_menuitem_label( w, savestates[num-1].date );
|
set_menuitem_label( w, savestates[SAVESTATE_SLOT(num)].date );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_savestates_menu()
|
static void update_savestates_menu()
|
||||||
|
@ -71,7 +73,7 @@ static void update_savestates_menu()
|
||||||
|
|
||||||
for( i = 1; i <= NB_STATES; i++ )
|
for( i = 1; i <= NB_STATES; i++ )
|
||||||
{
|
{
|
||||||
if( savestates[i-1].exists == TRUE )
|
if( savestates[SAVESTATE_SLOT(i)].exists == TRUE )
|
||||||
{
|
{
|
||||||
update_savestate_menu("loadstate", i);
|
update_savestate_menu("loadstate", i);
|
||||||
update_savestate_menu("savestate", i);
|
update_savestate_menu("savestate", i);
|
||||||
|
@ -87,7 +89,7 @@ static void update_savestates_menu()
|
||||||
static void update_savestate(u8 num)
|
static void update_savestate(u8 num)
|
||||||
{
|
{
|
||||||
desmume_pause();
|
desmume_pause();
|
||||||
savestate_slot(num);
|
savestate_slot(SAVESTATE_SLOT(num));
|
||||||
update_savestate_menu("savestate", num);
|
update_savestate_menu("savestate", num);
|
||||||
update_savestate_menu("loadstate", num);
|
update_savestate_menu("loadstate", num);
|
||||||
desmume_resume();
|
desmume_resume();
|
||||||
|
@ -256,7 +258,7 @@ void on_menu_pscreen_activate (GtkMenuItem *menuitem, gpointer user_data) { Pri
|
||||||
/* MENU SAVES ***** ***** ***** ***** */
|
/* MENU SAVES ***** ***** ***** ***** */
|
||||||
void on_loadstateXX_activate (GtkMenuItem *m, gpointer d) {
|
void on_loadstateXX_activate (GtkMenuItem *m, gpointer d) {
|
||||||
int slot = dyn_CAST(int,d);
|
int slot = dyn_CAST(int,d);
|
||||||
loadstate_slot(slot);
|
loadstate_slot(SAVESTATE_SLOT(slot));
|
||||||
}
|
}
|
||||||
void on_savestateXX_activate (GtkMenuItem *m, gpointer d) {
|
void on_savestateXX_activate (GtkMenuItem *m, gpointer d) {
|
||||||
int slot = dyn_CAST(int,d);
|
int slot = dyn_CAST(int,d);
|
||||||
|
|
Loading…
Reference in New Issue