mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 07:59:42 +00:00
UWP: Save config on exit
This commit is contained in:
parent
b6d01ce448
commit
f2a64aa8e7
@ -25,6 +25,9 @@
|
||||
<None Include="cores\$(Platform)\cores\*.dll" />
|
||||
<None Include="ANGLE\$(Platform)\*.dll" />
|
||||
<None Include="ANGLE\$(Platform)\*.dll" />
|
||||
<None Include="cores\$(Platform)\cores\*.dll" />
|
||||
<None Include="ANGLE\$(Platform)\*.dll" />
|
||||
<None Include="ANGLE\$(Platform)\*.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\uwp\uwp_func.h">
|
||||
|
@ -18,10 +18,14 @@
|
||||
#include <windows.devices.enumeration.h>
|
||||
|
||||
#include <encodings/utf.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <queues/task_queue.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include "configuration.h"
|
||||
#include "paths.h"
|
||||
|
||||
#include "uwp_main.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../frontend/frontend.h"
|
||||
@ -372,10 +376,32 @@ void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
|
||||
// aware that a deferral may not be held indefinitely. After about five seconds,
|
||||
// the app will be forced to exit.
|
||||
SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral();
|
||||
auto app = this;
|
||||
|
||||
create_task([this, deferral]()
|
||||
create_task([app, deferral]()
|
||||
{
|
||||
// TODO: Maybe creating a save state here would be a good idea?
|
||||
settings_t* settings = config_get_ptr();
|
||||
if (settings->bools.config_save_on_exit) {
|
||||
if (!path_is_empty(RARCH_PATH_CONFIG))
|
||||
{
|
||||
const char* config_path = path_get(RARCH_PATH_CONFIG);
|
||||
bool path_exists = !string_is_empty(config_path);
|
||||
|
||||
if (path_exists && config_save_file(config_path))
|
||||
{
|
||||
RARCH_LOG("[config] %s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO),
|
||||
config_path);
|
||||
}
|
||||
else if (path_exists)
|
||||
{
|
||||
RARCH_ERR("[config] %s \"%s\".\n",
|
||||
msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO),
|
||||
config_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deferral->Complete();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user