switch to INI for settings (easier), make settings a singleton thingy, slightly simplify core pause/stop/reset. Drop support for remappable inputs for now

This commit is contained in:
irisz64
2025-06-27 00:50:47 +02:00
parent 38129d8d88
commit 7ca337ca48
18 changed files with 2279 additions and 137 deletions

View File

@@ -1,15 +1,15 @@
#include <AudioSettings.hpp>
AudioSettings::AudioSettings(nlohmann::json &settings) : settings(settings) {
lockChannels.setChecked(JSONGetField<bool>(settings, "audio", "lock"));
volumeL.setValue(JSONGetField<float>(settings, "audio", "volumeL") * 100);
volumeR.setValue(JSONGetField<float>(settings, "audio", "volumeR") * 100);
AudioSettings::AudioSettings() {
lockChannels.setChecked(Options::GetInstance().GetValue<bool>("audio", "lock"));
volumeL.setValue(Options::GetInstance().GetValue<float>("audio", "volumeL") * 100);
volumeR.setValue(Options::GetInstance().GetValue<float>("audio", "volumeR") * 100);
}
bool AudioSettings::render() {
if(lockChannels.render()) {
auto isChecked = lockChannels.isChecked();
JSONSetField(settings, "audio", "lock", isChecked);
Options::GetInstance().SetValue("audio", "lock", isChecked);
if (isChecked) {
volumeR.setValue(volumeL.getValue());
}
@@ -21,10 +21,10 @@ bool AudioSettings::render() {
if(volumeL.render()) {
float valueL = volumeL.getValue();
JSONSetField(settings, "audio", "volumeL", float(valueL) / 100.f);
Options::GetInstance().SetValue("audio", "volumeL", float(valueL) / 100.f);
if (lockChannels.isChecked()) {
volumeR.setValue(valueL);
JSONSetField(settings, "audio", "volumeR", float(valueL) / 100.f);
Options::GetInstance().SetValue("audio", "volumeR", float(valueL) / 100.f);
}
modified = true;
@@ -34,7 +34,7 @@ bool AudioSettings::render() {
if(volumeR.render()) {
if (!lockChannels.isChecked()) {
JSONSetField(settings, "audio", "volumeR", float(volumeR.getValue()) / 100.f);
Options::GetInstance().SetValue("audio", "volumeR", float(volumeR.getValue()) / 100.f);
}
modified = true;