configuration: swap to per-game config memory for properties dialog

Does not set memory going in-game. Swaps to game values when opening the
properties dialog, then swaps back when closing it. Uses a `memcpy` to swap.
Also implements saving config files, limited to certain groups of configurations
so as to not risk setting unsafe configurations.
This commit is contained in:
lat9nq
2020-06-17 15:22:56 -04:00
parent d96eb90144
commit 1dedbbdaaa
6 changed files with 40 additions and 18 deletions

View File

@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <cstring>
#include "common/file_util.h"
#include "core/core.h"
#include "core/gdbstub/gdbstub.h"
@@ -65,6 +67,16 @@ Values global_values;
Values game_values;
Values *values = &global_values;
void SwapValues(bool global) {
if (global) {
values = &global_values;
}
else {
std::memcpy(&game_values, &global_values, sizeof(global_values));
values = &game_values;
}
}
std::string GetTimeZoneString() {
static constexpr std::array<const char*, 46> timezones{{
"auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire",

View File

@@ -499,6 +499,7 @@ extern Values game_values;
extern Values *values;
float Volume();
void SwapValues(bool global);
bool IsGPULevelExtreme();
bool IsGPULevelHigh();