Skip to content

Commit cc8751f

Browse files
committed
rg_gui: removed unused arg to rg_gui_savestate_menu
1 parent 7b3c537 commit cc8751f

File tree

3 files changed

+13
-24
lines changed

3 files changed

+13
-24
lines changed

components/retro-go/rg_gui.c

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,9 +1757,9 @@ void rg_gui_debug_menu(const rg_gui_option_t *extra_options)
17571757

17581758
static rg_gui_event_t slot_select_cb(rg_gui_option_t *option, rg_gui_event_t event)
17591759
{
1760+
rg_emu_slot_t *slot = (rg_emu_slot_t *)option->arg;
17601761
if (event == RG_DIALOG_FOCUS_GAINED)
17611762
{
1762-
rg_emu_slot_t *slot = (rg_emu_slot_t *)option->arg;
17631763
rg_image_t *preview = NULL;
17641764
rg_color_t color = C_BLUE;
17651765
size_t margin = 0; // TEXT_RECT("ABC", 0).height;
@@ -1792,37 +1792,26 @@ static rg_gui_event_t slot_select_cb(rg_gui_option_t *option, rg_gui_event_t eve
17921792
#undef draw_status
17931793
}
17941794

1795-
int rg_gui_savestate_menu(const char *title, const char *rom_path, bool quick_return)
1795+
int rg_gui_savestate_menu(const char *title, const char *rom_path)
17961796
{
1797-
const rg_app_t *app = rg_system_get_app();
1798-
rg_emu_states_t *savestates = rg_emu_get_states(rom_path ?: app->romPath, 4);
1797+
rg_emu_states_t *savestates = rg_emu_get_states(rom_path, 4);
17991798
const rg_gui_option_t choices[] = {
18001799
{(intptr_t)&savestates->slots[0], _("Slot 0"), NULL, RG_DIALOG_FLAG_NORMAL, &slot_select_cb},
18011800
{(intptr_t)&savestates->slots[1], _("Slot 1"), NULL, RG_DIALOG_FLAG_NORMAL, &slot_select_cb},
18021801
{(intptr_t)&savestates->slots[2], _("Slot 2"), NULL, RG_DIALOG_FLAG_NORMAL, &slot_select_cb},
18031802
{(intptr_t)&savestates->slots[3], _("Slot 3"), NULL, RG_DIALOG_FLAG_NORMAL, &slot_select_cb},
18041803
RG_DIALOG_END
18051804
};
1806-
int sel = 0;
1807-
1808-
if (!rom_path)
1809-
sel = app->saveSlot;
1810-
else if (savestates->lastused)
1811-
sel = savestates->lastused->id;
1812-
1813-
intptr_t ret = rg_gui_dialog(title, choices, sel);
1814-
if (ret && ret != RG_DIALOG_CANCELLED)
1815-
sel = ((rg_emu_slot_t *)ret)->id;
1816-
else
1817-
sel = -1;
18181805

1806+
intptr_t ret = rg_gui_dialog(title, choices, savestates->lastused ? savestates->lastused->id : 0);
1807+
int slot = (ret == RG_DIALOG_CANCELLED) ? -1 : ((rg_emu_slot_t *)ret)->id;
18191808
free(savestates);
1820-
1821-
return sel;
1809+
return slot;
18221810
}
18231811

18241812
void rg_gui_game_menu(void)
18251813
{
1814+
const char *rom_path = rg_system_get_app()->romPath;
18261815
bool have_option_btn = rg_input_get_key_mapping(RG_KEY_OPTION);
18271816
const rg_gui_option_t choices[] = {
18281817
{1000, _("Save & Continue"), NULL, RG_DIALOG_FLAG_NORMAL, NULL},
@@ -1857,9 +1846,9 @@ void rg_gui_game_menu(void)
18571846

18581847
switch (sel)
18591848
{
1860-
case 1000: if ((slot = rg_gui_savestate_menu("Save", 0, 0)) >= 0) rg_emu_save_state(slot); break;
1861-
case 2000: if ((slot = rg_gui_savestate_menu("Save", 0, 0)) >= 0 && rg_emu_save_state(slot)) rg_system_exit(); break;
1862-
case 3001: if ((slot = rg_gui_savestate_menu("Load", 0, 0)) >= 0) rg_emu_load_state(slot); break;
1849+
case 1000: if ((slot = rg_gui_savestate_menu(_("Save"), rom_path)) >= 0) rg_emu_save_state(slot); break;
1850+
case 2000: if ((slot = rg_gui_savestate_menu(_("Save"), rom_path)) >= 0 && rg_emu_save_state(slot)) rg_system_exit(); break;
1851+
case 3001: if ((slot = rg_gui_savestate_menu(_("Load"), rom_path)) >= 0) rg_emu_load_state(slot); break;
18631852
case 3002: rg_emu_reset(false); break;
18641853
case 3003: rg_emu_reset(true); break;
18651854
#ifdef RG_ENABLE_NETPLAY

components/retro-go/rg_gui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void rg_gui_alert(const char *title, const char *message);
121121
char *rg_gui_file_picker(const char *title, const char *path, bool (*validator)(const char *path), bool none_option);
122122
char *rg_gui_prompt(const char *title, const char *message, const char *default_value);
123123

124-
int rg_gui_savestate_menu(const char *title, const char *rom_path, bool quick_return);
124+
int rg_gui_savestate_menu(const char *title, const char *rom_path);
125125
void rg_gui_options_menu(void);
126126
void rg_gui_game_menu(void);
127127
void rg_gui_about_menu(const rg_gui_option_t *extra_options);

launcher/main/applications.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ void application_show_file_menu(retro_file_t *file, bool advanced)
609609
switch (sel)
610610
{
611611
case 0:
612-
if ((slot = rg_gui_savestate_menu(_("Resume"), rom_path, 1)) == -1)
612+
if ((slot = rg_gui_savestate_menu(_("Resume"), rom_path)) == -1)
613613
break;
614614
/* fallthrough */
615615
case 1:
@@ -619,7 +619,7 @@ void application_show_file_menu(retro_file_t *file, bool advanced)
619619
break;
620620

621621
case 2:
622-
while ((slot = rg_gui_savestate_menu(_("Delete save?"), rom_path, 0)) != -1)
622+
while ((slot = rg_gui_savestate_menu(_("Delete save?"), rom_path)) != -1)
623623
{
624624
remove(savestates->slots[slot].preview);
625625
remove(savestates->slots[slot].file);

0 commit comments

Comments
 (0)