Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioMartin86 committed May 28, 2024
1 parent bbb0dc3 commit 8c0e68b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
15 changes: 2 additions & 13 deletions emulators/quickerNES/quickerNES.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}
Expand Down
12 changes: 2 additions & 10 deletions emulators/quickerSnes9x/quickerSnes9x.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 8c0e68b

Please sign in to comment.