aboutsummaryrefslogtreecommitdiff
path: root/src/common/settings_setting.h
diff options
context:
space:
mode:
authorcrueter <crueter@eden-emu.dev>2025-11-25 00:20:16 +0100
committercrueter <crueter@eden-emu.dev>2025-11-25 00:20:16 +0100
commit027085e5ba1c86c10805cd74fa728243da759cbf (patch)
tree1b5fa5a083d84372dac60a274e8c639f15aa2ebd /src/common/settings_setting.h
parentf40025fd9bd29325452535f98705bd3442381fb5 (diff)
[desktop] fix audio output engine not saving (#3083)
This issue has like 15 different causes, and I'm surprised it took this long to pop up. 1. LoadString had a hack *specific* to the AudioEngine enum. Why? Solving this was easy, just use the explicit type ctor. -_- 2. The LoadString hack was abused in configure_audio.cpp to get around the canonicalization infrastructure that was explicitly put in to make this exact operation easier. Why? 3. ToString was also broken because of LoadString's garbage output. Technically it might work now, but it's better to just use the canonicalization infrastructure that was made specifically for this purpose. Also did a few tiny optimizations in config/settings cuz wynaut. Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3083 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/common/settings_setting.h')
-rw-r--r--src/common/settings_setting.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h
index a7e6bb6168..9af2cebde0 100644
--- a/src/common/settings_setting.h
+++ b/src/common/settings_setting.h
@@ -129,7 +129,7 @@ protected:
} else if constexpr (std::is_floating_point_v<Type>) {
return fmt::format("{:f}", value_);
} else if constexpr (std::is_enum_v<Type>) {
- return std::to_string(static_cast<u32>(value_));
+ return std::to_string(u32(value_));
} else {
return std::to_string(value_);
}
@@ -192,15 +192,13 @@ public:
if constexpr (std::is_same_v<Type, std::string>) {
this->SetValue(input);
} else if constexpr (std::is_same_v<Type, std::optional<u32>>) {
- this->SetValue(static_cast<u32>(std::stoul(input)));
+ this->SetValue(u32(std::stoul(input)));
} else if constexpr (std::is_same_v<Type, bool>) {
this->SetValue(input == "true");
} else if constexpr (std::is_same_v<Type, float>) {
this->SetValue(std::stof(input));
- } else if constexpr (std::is_same_v<Type, AudioEngine>) {
- this->SetValue(ToEnum<AudioEngine>(input));
} else {
- this->SetValue(static_cast<Type>(std::stoll(input)));
+ this->SetValue(Type(std::stoll(input)));
}
} catch (std::invalid_argument&) {
this->SetValue(this->GetDefault());