mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-17 15:09:03 +02:00
[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>
This commit is contained in:
parent
f40025fd9b
commit
027085e5ba
3 changed files with 93 additions and 68 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue