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:
@@ -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",
|
||||
|
||||
@@ -499,6 +499,7 @@ extern Values game_values;
|
||||
extern Values *values;
|
||||
|
||||
float Volume();
|
||||
void SwapValues(bool global);
|
||||
|
||||
bool IsGPULevelExtreme();
|
||||
bool IsGPULevelHigh();
|
||||
|
||||
Reference in New Issue
Block a user