sdl: AutoResume functionality implemented via SDL.AutoResume config option

gtk: added checkbox for AutoResume (Options->Auto-Resume)
This commit is contained in:
punkrockguy318 2013-03-02 18:43:24 +00:00
parent 5acc146be8
commit c490369e67
3 changed files with 30 additions and 4 deletions

View File

@ -221,6 +221,8 @@ InitConfig()
// overwrite the config file?
config->addOption("no-config", "SDL.NoConfig", 0);
config->addOption("autoresume", "SDL.AutoResume", 0);
// video playback
config->addOption("playmov", "SDL.Movie", "");
config->addOption("subtitles", "SDL.SubtitleDisplay", 1);

View File

@ -1366,6 +1366,15 @@ void enableFullscreen ()
if(isloaded)
ToggleFS();
}
void toggleAutoResume (GtkToggleAction *action)
{
bool autoResume = gtk_toggle_action_get_active(action);
g_config->setOption("SDL.AutoResume", (int)autoResume);
AutoResumePlay = autoResume;
}
void recordMovie()
{
if(isloaded)
@ -2159,6 +2168,7 @@ static char* menuXml =
" <menuitem action='VideoConfigAction' />"
" <menuitem action='PaletteConfigAction' />"
" <menuitem action='NetworkConfigAction' />"
" <menuitem action='AutoResumeAction' />"
" <separator />"
" <menuitem action='FullscreenAction' />"
" </menu>"
@ -2219,7 +2229,6 @@ static GtkActionEntry normal_entries[] = {
{"PaletteConfigAction", GTK_STOCK_SELECT_COLOR, "_Palette Config", NULL, NULL, G_CALLBACK(openPaletteConfig)},
{"NetworkConfigAction", GTK_STOCK_NETWORK, "_Network Config", NULL, NULL, G_CALLBACK(openNetworkConfig)},
{"FullscreenAction", GTK_STOCK_FULLSCREEN, "_Fullscreen", "<alt>Return", NULL, G_CALLBACK(enableFullscreen)},
{"EmulationMenuAction", NULL, "_Emulation"},
{"PowerAction", NULL, "P_ower", NULL, NULL, G_CALLBACK(FCEUI_PowerNES)},
{"SoftResetAction", GTK_STOCK_REFRESH, "_Soft Reset", NULL, NULL, G_CALLBACK(emuReset)},
@ -2245,6 +2254,7 @@ static GtkActionEntry normal_entries[] = {
// Menu items with a check box that can be toggled on or off
static GtkToggleActionEntry toggle_entries[] = {
{"GameGenieToggleAction", NULL, "Enable Game _Genie", NULL, NULL, G_CALLBACK(toggleGameGenie), FALSE},
{"AutoResumeAction", NULL, "Auto-Resume", NULL, NULL, G_CALLBACK(toggleAutoResume), FALSE},
};
// Menu items for selecting a save state slot using radio buttons
@ -2296,6 +2306,10 @@ static GtkWidget* CreateMenubar( GtkWidget* window)
if (state && GTK_IS_RADIO_ACTION (state))
stateSlot = GTK_RADIO_ACTION (state);
/* Set the autoResume checkbox */
GtkCheckMenuItem* auto_resume_chk = (GtkCheckMenuItem*) gtk_ui_manager_get_widget ( ui_manager, "/Menubar/OptionsMenuAction/AutoResumeAction");
gtk_check_menu_item_set_active (auto_resume_chk, (bool)AutoResumePlay);
/* Finally, return the actual menu bar created by the UIManager. */
return gtk_ui_manager_get_widget (ui_manager, "/Menubar");
}
@ -2423,7 +2437,6 @@ int InitGTKSubsystem(int argc, char** argv)
// turn of game genie by default, since its off by default in the menu
enableGameGenie(0);
gtk_box_pack_start (GTK_BOX(vbox), Menubar, FALSE, TRUE, 0);
// PRG: this code here is the the windowID "hack" to render SDL

View File

@ -616,6 +616,17 @@ int main(int argc, char *argv[])
return 0;
}
int autoResume;
g_config->getOption("SDL.AutoResume", &autoResume);
if(autoResume)
{
AutoResumePlay = true;
}
else
{
AutoResumePlay = false;
}
// check to see if recording HUD to AVI is enabled
int rh;
g_config->getOption("SDL.RecordHUD", &rh);