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

@@ -2,13 +2,13 @@
#include <fmt/core.h>
#include <nfd.hpp>
#include <log.hpp>
#include <JSONUtils.hpp>
#include <Options.hpp>
std::string savePath;
SettingsWindow::SettingsWindow() : settings{JSONOpenOrCreate("resources/settings.json")}, cpuSettings{settings}, audioSettings{settings} {
SettingsWindow::SettingsWindow() {
savesFolder.setName(fmt::format("Save path: {}",
JSONGetField<std::string>(settings, "general", "savePath")));
Options::GetInstance().GetValue<std::string>("general", "savePath")));
tabs.addTab({"General", [&]() {
if(savesFolder.render()) {
@@ -22,7 +22,7 @@ SettingsWindow::SettingsWindow() : settings{JSONOpenOrCreate("resources/settings
Util::panic("Error: {}", NFD::GetError());
savesFolder.setName(fmt::format("Save path: {}", outPath.get()));
JSONSetField(settings, "general", "savePath", outPath.get());
Options::GetInstance().SetValue<std::string>("general", "savePath", outPath.get());
apply.setEnabled(true);
}
}});
@@ -48,9 +48,7 @@ SettingsWindow::SettingsWindow() : settings{JSONOpenOrCreate("resources/settings
if(apply.render()) {
apply.setEnabled(false);
std::ofstream file("resources/settings.json");
file << settings;
file.close();
Options::GetInstance().Apply();
}
ImGui::SameLine();