fix real-time volume adjustment with game-specific configs (#4259)

This commit is contained in:
rainmakerv2 2026-04-14 20:57:08 +08:00 committed by GitHub
parent cead66d3c6
commit b12ca606c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View File

@ -73,8 +73,13 @@ struct Setting {
/// Write v to the base layer.
/// Game-specific overrides are applied exclusively via Load(serial)
void set(const T& v) {
value = v;
/// Set proper value as base or game_specific
void set(const T& v, bool game_specific = false) {
if (game_specific) {
game_specific_value = v;
} else {
value = v;
}
}
/// Discard the game-specific override; subsequent get(Default) will
@ -526,15 +531,15 @@ public:
auto Get##Name() const { \
return (group).field.get(m_configMode); \
} \
void Set##Name(const decltype((group).field.value)& v) { \
(group).field.value = v; \
void Set##Name(const decltype((group).field.value)& v, bool specific = false) { \
(group).field.set(v, specific); \
}
#define SETTING_FORWARD_BOOL(group, Name, field) \
bool Is##Name() const { \
return (group).field.get(m_configMode); \
} \
void Set##Name(bool v) { \
(group).field.value = v; \
void Set##Name(bool v, bool specific = false) { \
(group).field.set(v, specific); \
}
#define SETTING_FORWARD_BOOL_READONLY(group, Name, field) \
bool Is##Name() const { \

View File

@ -153,7 +153,7 @@ void IPC::InputLoop() {
} else if (cmd == "ADJUST_VOLUME") {
int value = static_cast<int>(next_u64());
bool is_game_specific = next_u64() != 0;
EmulatorSettings.SetVolumeSlider(value);
EmulatorSettings.SetVolumeSlider(value, is_game_specific);
Libraries::AudioOut::AdjustVol();
} else if (cmd == "SET_FSR") {
bool use_fsr = next_u64() != 0;