From 6b2b52eae6f17dfeaf9ac3905221ef65e6d317bb Mon Sep 17 00:00:00 2001 From: Sergio Martin Date: Sun, 21 Jan 2024 16:35:02 +0100 Subject: [PATCH] Added support for FourScore and added test for rcProAmII --- .gitmodules | 4 ++-- source/controller.hpp | 12 ++++++++---- source/quickNES/QuickNES_Core | 2 +- tests/meson.build | 1 + ...{rcProAmII.anyPercent.sol => rcProAmII.race1.sol} | 1 - ...cProAmII.anyPercent.test => rcProAmII.race1.test} | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) rename tests/{rcProAmII.anyPercent.sol => rcProAmII.race1.sol} (99%) rename tests/{rcProAmII.anyPercent.test => rcProAmII.race1.test} (84%) diff --git a/.gitmodules b/.gitmodules index ab70aa3..4146a66 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "extern/QuickNES_Core"] +[submodule "source/quickNES/QuickNES_Core"] path = source/quickNES/QuickNES_Core - url = https://github.com/libretro/QuickNES_Core.git + url = git@github.com:SergioMartin86/QuickNES_Core.git diff --git a/source/controller.hpp b/source/controller.hpp index aa89fc9..3f0af91 100644 --- a/source/controller.hpp +++ b/source/controller.hpp @@ -29,7 +29,7 @@ public: bool isValid = true; // Converting input into a stream for parsing - std::stringstream ss(input); + std::istringstream ss(input); // Start separator if (ss.get() != '|') isValid = false; @@ -46,6 +46,10 @@ public: // End separator if (ss.get() != '|') isValid = false; + // If its not the end of the stream, then extra values remain and its invalid + ss.get(); + if (ss.eof() == false) isValid = false; + // Returning valid flag return isValid; }; @@ -60,7 +64,7 @@ public: private: - static bool parseJoyPadInput(uint8_t& code, std::stringstream& ss) + static bool parseJoyPadInput(uint8_t& code, std::istringstream& ss) { // Currently read character char c; @@ -111,7 +115,7 @@ public: return true; } - static bool parseControllerInputs(const controller_t type, port_t& port, std::stringstream& ss) + static bool parseControllerInputs(const controller_t type, port_t& port, std::istringstream& ss) { // Parse valid flag bool isValid = true; @@ -172,7 +176,7 @@ public: return isValid; } - static bool parseConsoleInputs(bool& reset, bool& power, std::stringstream& ss) + static bool parseConsoleInputs(bool& reset, bool& power, std::istringstream& ss) { // Parse valid flag bool isValid = true; diff --git a/source/quickNES/QuickNES_Core b/source/quickNES/QuickNES_Core index 058d665..cedf1f6 160000 --- a/source/quickNES/QuickNES_Core +++ b/source/quickNES/QuickNES_Core @@ -1 +1 @@ -Subproject commit 058d66516ed3f1260b69e5b71cd454eb7e9234a3 +Subproject commit cedf1f63cc904a2737d26cd1ed006915ecadac22 diff --git a/tests/meson.build b/tests/meson.build index bc4936e..b8d2df6 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -20,6 +20,7 @@ protectedTestSet = [ 'ninjaGaiden2.pacifist.test', 'novaTheSquirrel.anyPercent.test', 'princeOfPersia.anyPercent.test', + 'rcProAmII.race1.test', 'saintSeiyaKanketsuHen.anyPercent.test', 'saintSeiyaOugonDensetsu.anyPercent.test', 'saiyuukiWorld.anyPercent.test', diff --git a/tests/rcProAmII.anyPercent.sol b/tests/rcProAmII.race1.sol similarity index 99% rename from tests/rcProAmII.anyPercent.sol rename to tests/rcProAmII.race1.sol index 8d0f0e4..5318dde 100644 --- a/tests/rcProAmII.anyPercent.sol +++ b/tests/rcProAmII.race1.sol @@ -329,7 +329,6 @@ |..|........|........|........|........| |..|........|........|........|........| |..|........|........|........|........| -|..|........|........|........|........| |..|........|........|........|....S...| |..|........|........|........|........| |..|........|........|........|....S...| diff --git a/tests/rcProAmII.anyPercent.test b/tests/rcProAmII.race1.test similarity index 84% rename from tests/rcProAmII.anyPercent.test rename to tests/rcProAmII.race1.test index f264943..d882250 100644 --- a/tests/rcProAmII.anyPercent.test +++ b/tests/rcProAmII.race1.test @@ -2,7 +2,7 @@ "Rom File": "roms/R.C. Pro-Am II (U) [!].nes", "Expected ROM SHA1": "8C68582BDAA32FBC8C7CD858991D4E00D3B1569C", "Initial State File": "", - "Sequence File": "rcProAmII.anyPercent.sol", + "Sequence File": "rcProAmII.race1.sol", "Disable State Blocks": [ ], "Controller 1 Type": "FourScore1", "Controller 2 Type": "FourScore2"