diff options
author | neonloop | 2021-08-10 00:45:20 +0000 |
---|---|---|
committer | neonloop | 2021-08-10 00:45:20 +0000 |
commit | d9eea627fb916c099e908a9178acd5093e97bfef (patch) | |
tree | 40f78b0c95fa2ab45d1ea48d7a78a4269b7b7e2a | |
parent | ebcd69fef4208af05aea6b1f963db1a9613bc470 (diff) | |
download | picoarch-d9eea627fb916c099e908a9178acd5093e97bfef.tar.gz picoarch-d9eea627fb916c099e908a9178acd5093e97bfef.tar.bz2 picoarch-d9eea627fb916c099e908a9178acd5093e97bfef.zip |
Hides state menus if states are unsupported
-rw-r--r-- | core.c | 4 | ||||
-rw-r--r-- | core.h | 1 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | menu.c | 9 |
4 files changed, 14 insertions, 4 deletions
@@ -110,6 +110,10 @@ void sram_read(void) { fclose(sram_file); } +bool state_allowed(void) { + return current_core.retro_serialize_size() > 0; +} + void state_file_name(char *name, size_t size, int slot) { char extension[5] = {0}; @@ -41,6 +41,7 @@ void config_file_name(char *buf, size_t len, int is_game); void sram_read(void); void sram_write(void); +bool state_allowed(void); void state_file_name(char *name, size_t size, int slot); int state_read(void); int state_write(void); @@ -207,7 +207,7 @@ void handle_emu_action(emu_action action) if (mmenu) { ShowMenu_t ShowMenu = (ShowMenu_t)dlsym(mmenu, "ShowMenu"); SDL_Surface *screen = SDL_GetVideoSurface(); - MenuReturnStatus status = ShowMenu(content_path, save_template_path, screen, kMenuEventKeyDown); + MenuReturnStatus status = ShowMenu(content_path, state_allowed() ? save_template_path : NULL, screen, kMenuEventKeyDown); if (status==kStatusExitGame) { should_quit = 1; @@ -384,7 +384,7 @@ int main(int argc, char **argv) { if (ResumeSlot) resume_slot = ResumeSlot(); } - if (resume_slot!=-1) { + if (state_allowed() && resume_slot!=-1) { state_slot = resume_slot; state_read(); resume_slot = -1; @@ -392,9 +392,14 @@ void menu_loop(void) me_enable(e_menu_main, MA_MAIN_CORE_OPTS, core_options.visible_len > 0); + me_enable(e_menu_main, MA_MAIN_SAVE_STATE, state_allowed()); + me_enable(e_menu_main, MA_MAIN_LOAD_STATE, state_allowed()); + #ifdef MMENU - me_enable(e_menu_main, MA_MAIN_SAVE_STATE, mmenu == NULL); - me_enable(e_menu_main, MA_MAIN_LOAD_STATE, mmenu == NULL); + if (state_allowed()) { + me_enable(e_menu_main, MA_MAIN_SAVE_STATE, mmenu == NULL); + me_enable(e_menu_main, MA_MAIN_LOAD_STATE, mmenu == NULL); + } #endif memcpy(g_menubg_ptr, g_menuscreen_ptr, g_menuscreen_h * g_menuscreen_pp * sizeof(uint16_t)); |