configuration: change config interfaces to use config-specific pointers
When a game is booted, we need to be able to open the configuration dialogs without changing the settings pointer in the game's emualtion. A new pointer specific to just the configuration dialogs can be used to separate changes to just those config dialogs without affecting the emulation.
This commit is contained in:
@@ -66,6 +66,7 @@ const std::array<const char*, NumMouseButtons> mapping = {{
|
||||
Values global_values;
|
||||
Values game_values;
|
||||
Values *values = &global_values;
|
||||
Values *config_values = &global_values;
|
||||
|
||||
void CopyValues(Values& dst, const Values& src) {
|
||||
dst.udp_input_address = src.udp_input_address;
|
||||
@@ -115,6 +116,16 @@ void SwapValues(ValuesSwapTarget target) {
|
||||
}
|
||||
}
|
||||
|
||||
void SwapConfigValues(ValuesSwapTarget target) {
|
||||
if (target == ValuesSwapTarget::ToGlobal) {
|
||||
config_values = &global_values;
|
||||
}
|
||||
else {
|
||||
CopyValues(game_values, global_values);
|
||||
config_values = &game_values;
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetTimeZoneString() {
|
||||
static constexpr std::array<const char*, 46> timezones{{
|
||||
"auto", "default", "CET", "CST6CDT", "Cuba", "EET", "Egypt", "Eire",
|
||||
|
||||
@@ -497,16 +497,18 @@ struct Values {
|
||||
extern Values global_values;
|
||||
extern Values game_values;
|
||||
extern Values *values;
|
||||
extern Values *config_values;
|
||||
|
||||
float Volume();
|
||||
void CopyValues(Values& dst, const Values& src);
|
||||
|
||||
enum class ValuesSwapTarget {
|
||||
ToGlobal,
|
||||
ToGame,
|
||||
};
|
||||
|
||||
void CopyValues(Values& dst, const Values& src);
|
||||
void SwapValues(ValuesSwapTarget target);
|
||||
void SwapConfigValues(ValuesSwapTarget target);
|
||||
|
||||
bool IsGPULevelExtreme();
|
||||
bool IsGPULevelHigh();
|
||||
|
||||
Reference in New Issue
Block a user