From 8c0e68b6e3c85fbc9721ce11b4752d43399e2077 Mon Sep 17 00:00:00 2001 From: SergioMartin86 Date: Tue, 28 May 2024 20:07:29 +0200 Subject: [PATCH] Fixes --- emulators/quickerNES/quickerNES.hpp | 15 ++------------- emulators/quickerSnes9x/quickerSnes9x.hpp | 12 ++---------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/emulators/quickerNES/quickerNES.hpp b/emulators/quickerNES/quickerNES.hpp index fde2a7ab..b398c553 100644 --- a/emulators/quickerNES/quickerNES.hpp +++ b/emulators/quickerNES/quickerNES.hpp @@ -33,19 +33,7 @@ class QuickerNES final : public Emulator _initialStateFilePath = jaffarCommon::json::getString(config, "Initial State File Path"); // For testing purposes, the initial state file can be overriden by environment variables - if (auto *value = std::getenv("JAFFAR_QUICKERNES_OVERRIDE_INITIAL_STATE_FILE_PATH")) - { - // Even if we override, we'd like to test whether the originally specified rom still exists to ensure consistency in Github - if (_initialStateFilePath != "") - { - std::string initialStateString; - bool status = jaffarCommon::file::loadStringFromFile(initialStateString, _initialStateFilePath.c_str()); - if (status == false) JAFFAR_THROW_LOGIC("Could not find/read from ROM file: %s\n", _initialStateFilePath.c_str()); - } - - // Now do the proper override - _initialStateFilePath = std::string(value); - } + if (auto *value = std::getenv("JAFFAR_QUICKERNES_OVERRIDE_INITIAL_STATE_FILE_PATH")) _initialStateFilePath = std::string(value); // Parsing controller configuration _controller1Type = jaffarCommon::json::getString(config, "Controller 1 Type"); @@ -95,6 +83,7 @@ class QuickerNES final : public Emulator if (success == false) JAFFAR_THROW_LOGIC("[ERROR] Could not find or read from initial state file: %s\n", _initialStateFilePath.c_str()); // Deserializing initial state into the emulator + enableStateProperties(); jaffarCommon::deserializer::Contiguous d(initialState.data(), initialState.size()); deserializeState(d); } diff --git a/emulators/quickerSnes9x/quickerSnes9x.hpp b/emulators/quickerSnes9x/quickerSnes9x.hpp index a4e21058..7242e167 100644 --- a/emulators/quickerSnes9x/quickerSnes9x.hpp +++ b/emulators/quickerSnes9x/quickerSnes9x.hpp @@ -29,16 +29,7 @@ class QuickerSnes9x final : public Emulator _initialStateFilePath = jaffarCommon::json::getString(config, "Initial State File Path"); // For testing purposes, the initial state file can be overriden by environment variables - if (auto *value = std::getenv("JAFFAR_QUICKERSNES9X_OVERRIDE_INITIAL_STATE_FILE_PATH")) - { - // Even if we override, we'd like to test whether the originally specified rom still exists to ensure consistency in Github - std::string initialStateString; - bool status = jaffarCommon::file::loadStringFromFile(initialStateString, _initialStateFilePath.c_str()); - if (status == false) JAFFAR_THROW_LOGIC("Could not find/read from ROM file: %s\n", _initialStateFilePath.c_str()); - - // Now do the proper override - _initialStateFilePath = std::string(value); - } + if (auto *value = std::getenv("JAFFAR_QUICKERSNES9X_OVERRIDE_INITIAL_STATE_FILE_PATH")) _initialStateFilePath = std::string(value); // Parsing controller configuration _controller1Type = jaffarCommon::json::getString(config, "Controller 1 Type"); @@ -85,6 +76,7 @@ class QuickerSnes9x final : public Emulator if (success == false) JAFFAR_THROW_LOGIC("[ERROR] Could not find or read from initial state file: %s\n", _initialStateFilePath.c_str()); // Deserializing initial state into the emulator + enableStateProperties(); jaffarCommon::deserializer::Contiguous d(initialState.data(), initialState.size()); deserializeState(d); }