i removed the gamelist already so no need to set it in the settings
This commit is contained in:
@@ -47,10 +47,8 @@ Settings::Settings(n64::Core& core) {
|
|||||||
checkjsonentry(volumeR, float, "audio", "volumeR", 0.5);
|
checkjsonentry(volumeR, float, "audio", "volumeR", 0.5);
|
||||||
checkjsonentry(volumeL, float, "audio", "volumeL", 0.5);
|
checkjsonentry(volumeL, float, "audio", "volumeL", 0.5);
|
||||||
checkjsonentry(lockChannels, bool, "audio", "lockChannels", true);
|
checkjsonentry(lockChannels, bool, "audio", "lockChannels", true);
|
||||||
checkjsonentry(gamesDir, std::string, "general", "gamesDir", "");
|
|
||||||
} else {
|
} else {
|
||||||
settingsFile = std::fstream("resources/settings.json", std::fstream::trunc | std::fstream::in | std::fstream::out);
|
settingsFile = std::fstream("resources/settings.json", std::fstream::trunc | std::fstream::in | std::fstream::out);
|
||||||
settings["general"]["gamesDir"] = "";
|
|
||||||
settings["cpu"]["type"] = "interpreter";
|
settings["cpu"]["type"] = "interpreter";
|
||||||
settings["audio"]["volumeR"] = 0.5;
|
settings["audio"]["volumeR"] = 0.5;
|
||||||
settings["audio"]["volumeL"] = 0.5;
|
settings["audio"]["volumeL"] = 0.5;
|
||||||
@@ -60,7 +58,6 @@ Settings::Settings(n64::Core& core) {
|
|||||||
volumeR = 0.5;
|
volumeR = 0.5;
|
||||||
volumeL = 0.5;
|
volumeL = 0.5;
|
||||||
lockChannels = true;
|
lockChannels = true;
|
||||||
gamesDir = "";
|
|
||||||
|
|
||||||
settingsFile << settings;
|
settingsFile << settings;
|
||||||
}
|
}
|
||||||
@@ -84,7 +81,6 @@ Settings::~Settings() {
|
|||||||
if(fileExists) {
|
if(fileExists) {
|
||||||
settingsFile = std::fstream("resources/settings.json", std::fstream::trunc | std::fstream::out);
|
settingsFile = std::fstream("resources/settings.json", std::fstream::trunc | std::fstream::out);
|
||||||
|
|
||||||
settings["general"]["gamesDir"] = gamesDir;
|
|
||||||
settings["cpu"]["type"] = cpuType;
|
settings["cpu"]["type"] = cpuType;
|
||||||
settings["audio"]["volumeR"] = volumeR;
|
settings["audio"]["volumeR"] = volumeR;
|
||||||
settings["audio"]["volumeL"] = volumeL;
|
settings["audio"]["volumeL"] = volumeL;
|
||||||
@@ -93,7 +89,6 @@ Settings::~Settings() {
|
|||||||
} else {
|
} else {
|
||||||
settingsFile = std::fstream("resources/settings.json", std::fstream::out);
|
settingsFile = std::fstream("resources/settings.json", std::fstream::out);
|
||||||
|
|
||||||
settings["general"]["gamesDir"] = gamesDir;
|
|
||||||
settings["cpu"]["type"] = cpuType;
|
settings["cpu"]["type"] = cpuType;
|
||||||
settings["audio"]["volumeR"] = volumeR;
|
settings["audio"]["volumeR"] = volumeR;
|
||||||
settings["audio"]["volumeL"] = volumeL;
|
settings["audio"]["volumeL"] = volumeL;
|
||||||
@@ -115,16 +110,6 @@ void Settings::RenderWidget(bool& show) {
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case General:
|
case General:
|
||||||
ImGui::Text("Games directory: %s", gamesDir.c_str());
|
|
||||||
ImGui::SameLine();
|
|
||||||
if(ImGui::Button("Select...")) {
|
|
||||||
nfdchar_t *outpath;
|
|
||||||
nfdresult_t result = NFD_PickFolder(&outpath, nullptr);
|
|
||||||
if (result == NFD_OKAY) {
|
|
||||||
gamesDir = outpath;
|
|
||||||
NFD_FreePath(outpath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case CPU: {
|
case CPU: {
|
||||||
const char *cpuTypes[] = {"JIT", "Interpreter"};
|
const char *cpuTypes[] = {"JIT", "Interpreter"};
|
||||||
|
|||||||
@@ -12,11 +12,10 @@ struct Settings {
|
|||||||
float GetVolumeR() const { return volumeR; };
|
float GetVolumeR() const { return volumeR; };
|
||||||
bool GetLockChannels() const { return lockChannels; }
|
bool GetLockChannels() const { return lockChannels; }
|
||||||
std::string GetCpuType() const { return cpuType; }
|
std::string GetCpuType() const { return cpuType; }
|
||||||
std::string GetGamesDir() const { return gamesDir; }
|
|
||||||
|
|
||||||
void RenderWidget(bool& show);
|
void RenderWidget(bool& show);
|
||||||
private:
|
private:
|
||||||
std::string cpuType = "interpreter", gamesDir = "";
|
std::string cpuType = "interpreter";
|
||||||
float volumeL = 0.0, volumeR = 0.0;
|
float volumeL = 0.0, volumeR = 0.0;
|
||||||
bool lockChannels = true;
|
bool lockChannels = true;
|
||||||
json settings;
|
json settings;
|
||||||
|
|||||||
Reference in New Issue
Block a user