Autosave settings immediately after closing settings
This commit is contained in:
parent
7a1e20e9db
commit
2498bad58d
4 changed files with 17 additions and 1 deletions
|
@ -41,6 +41,7 @@ void signal_resize_needed();
|
|||
void _runuifun_async(void (*fn)(void*), void* arg);
|
||||
void show_projectwindow(wxWindow* modwin);
|
||||
void signal_core_change();
|
||||
void do_save_configuration();
|
||||
|
||||
std::vector<interface_action_paramval> prompt_action_params(wxWindow* parent, const std::string& label,
|
||||
const std::list<interface_action_param>& params);
|
||||
|
|
|
@ -157,6 +157,7 @@ void show_conflictwindow(wxWindow* parent)
|
|||
return;
|
||||
}
|
||||
editor->Destroy();
|
||||
do_save_configuration();
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> core_selections;
|
||||
|
|
|
@ -222,7 +222,8 @@ end:
|
|||
void save_configuration()
|
||||
{
|
||||
std::string cfg = get_config_path() + "/lsneswxw.cfg";
|
||||
std::ofstream cfgfile(cfg.c_str());
|
||||
std::string cfgtmp = cfg + ".tmp";
|
||||
std::ofstream cfgfile(cfgtmp.c_str());
|
||||
//Settings.
|
||||
for(auto i : lsnes_vsetc.get_all())
|
||||
cfgfile << "SET " << i.first << " " << i.second << std::endl;
|
||||
|
@ -257,6 +258,13 @@ end:
|
|||
for(auto i : core_selections)
|
||||
if(i.second != "")
|
||||
cfgfile << "PREFER " << i.first << " " << i.second << std::endl;
|
||||
if(!cfgfile) {
|
||||
show_message_ok(NULL, "Error Saving configuration", "Error saving configuration",
|
||||
wxICON_EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
cfgfile.close();
|
||||
zip::rename_overwrite(cfgtmp.c_str(), cfg.c_str());
|
||||
//Last save.
|
||||
std::ofstream lsave(get_config_path() + "/" + our_rom_name + ".ls");
|
||||
lsave << last_save;
|
||||
|
@ -535,6 +543,11 @@ int lsnes_app::OnExit()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void do_save_configuration()
|
||||
{
|
||||
save_configuration();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct _graphics_driver drv = {
|
||||
|
|
|
@ -213,6 +213,7 @@ void display_settings_dialog(wxWindow* parent, settings_tab_factory* singletab)
|
|||
}
|
||||
dlg = NULL;
|
||||
editor->Destroy();
|
||||
do_save_configuration();
|
||||
}
|
||||
|
||||
void settings_activate_keygrab(std::function<void(std::string key)> callback)
|
||||
|
|
Loading…
Add table
Reference in a new issue