From 9c5b498cc34e6f71ca33919eac26c608bfcaa1ce Mon Sep 17 00:00:00 2001 From: Sergio Martin Date: Tue, 6 Feb 2024 19:34:49 +0100 Subject: [PATCH] Fixed tests passing --- source/quickerNES/core/core.hpp | 30 +++++++++++-------- tests/arkanoid.warpless.test | 8 ++++- tests/arkanoid.warps.test | 8 ++++- tests/castlevania1.anyPercent.test | 8 ++++- tests/castlevania1.pacifist.test | 8 ++++- tests/galaga.anyPercent.test | 8 ++++- tests/metroid.playaround.test | 8 ++++- tests/nigelMansell.anyPercent.test | 8 ++++- tests/ninjaGaiden.anyPercent.test | 8 ++++- tests/ninjaGaiden.pacifist.test | 8 ++++- tests/ninjaGaiden2.anyPercent.test | 8 ++++- tests/ninjaGaiden2.pacifist.test | 8 ++++- tests/novaTheSquirrel.anyPercent.test | 8 ++++- tests/princeOfPersia.anyPercent.test | 8 ++++- tests/rcProAmII.race1.test | 8 ++++- tests/saintSeiyaKanketsuHen.anyPercent.test | 8 ++++- tests/saintSeiyaOugonDensetsu.anyPercent.test | 8 ++++- tests/saiyuukiWorld.anyPercent.test | 8 ++++- tests/saiyuukiWorld.lastHalf.test | 10 +++++-- tests/solarJetman.anyPercent.test | 8 ++++- tests/sprilo.anyPercent.test | 8 ++++- tests/superMarioBros.warpless.test | 8 ++++- tests/superMarioBros.warps.test | 8 ++++- tests/superMarioBros3.warps.test | 8 ++++- tests/superOffroad.anyPercent.test | 8 ++++- tests/tennis.anyPercent.test | 8 ++++- 26 files changed, 194 insertions(+), 38 deletions(-) diff --git a/source/quickerNES/core/core.hpp b/source/quickerNES/core/core.hpp index bbebdff..0bb09c2 100644 --- a/source/quickerNES/core/core.hpp +++ b/source/quickerNES/core/core.hpp @@ -232,6 +232,12 @@ class Core : private Cpu *outputDataPos += 4; *referenceDataPos += 4; } + static inline void deserializeBlockHead(size_t* inputDataPos, size_t* referenceDataPos) + { + *inputDataPos += 4; *referenceDataPos += 4; + *inputDataPos += 4; *referenceDataPos += 4; + } + static inline void serializeDifferentialData( const uint8_t* __restrict__ inputData, const size_t inputDataSize, @@ -362,8 +368,8 @@ class Core : private Cpu if (HEADBlockEnabled == true) serializeBlockHead(outputData, &outputDataPos, &referenceDataPos, "TIME", inputDataSize); - if (outputData != nullptr) memcpy(&outputData[outputDataPos], inputData, inputDataSize); - outputDataPos += inputDataSize; referenceDataPos += inputDataSize; + serializeContiguousData(inputData, inputDataSize, outputData, &outputDataPos); + if (useDifferentialCompression == true) referenceDataPos += inputDataSize; } // CPUR Block @@ -383,8 +389,8 @@ class Core : private Cpu if (HEADBlockEnabled == true) serializeBlockHead(outputData, &outputDataPos, &referenceDataPos, "CPUR", inputDataSize); - if (outputData != nullptr) memcpy(&outputData[outputDataPos], inputData, inputDataSize); - outputDataPos += inputDataSize; referenceDataPos += inputDataSize; + serializeContiguousData(inputData, inputDataSize, outputData, &outputDataPos); + if (useDifferentialCompression == true) referenceDataPos += inputDataSize; } if (PPURBlockEnabled == true) @@ -394,8 +400,8 @@ class Core : private Cpu if (HEADBlockEnabled == true) serializeBlockHead(outputData, &outputDataPos, &referenceDataPos, "PPUR", inputDataSize); - if (outputData != nullptr) memcpy(&outputData[outputDataPos], inputData, inputDataSize); - outputDataPos += inputDataSize; referenceDataPos += inputDataSize; + serializeContiguousData(inputData, inputDataSize, outputData, &outputDataPos); + if (useDifferentialCompression == true) referenceDataPos += inputDataSize; } // APUR Block @@ -409,8 +415,8 @@ class Core : private Cpu if (HEADBlockEnabled == true) serializeBlockHead(outputData, &outputDataPos, &referenceDataPos, "APUR", inputDataSize); - if (outputData != nullptr) memcpy(&outputData[outputDataPos], inputData, inputDataSize); - outputDataPos += inputDataSize; referenceDataPos += inputDataSize; + serializeContiguousData(inputData, inputDataSize, outputData, &outputDataPos); + if (useDifferentialCompression == true) referenceDataPos += inputDataSize; } // CTRL Block @@ -421,8 +427,8 @@ class Core : private Cpu if (HEADBlockEnabled == true) serializeBlockHead(outputData, &outputDataPos, &referenceDataPos, "CTRL", inputDataSize); - if (outputData != nullptr) memcpy(&outputData[outputDataPos], inputData, inputDataSize); - outputDataPos += inputDataSize; referenceDataPos += inputDataSize; + serializeContiguousData(inputData, inputDataSize, outputData, &outputDataPos); + if (useDifferentialCompression == true) referenceDataPos += inputDataSize; } // MAPR Block @@ -433,8 +439,8 @@ class Core : private Cpu if (HEADBlockEnabled == true) serializeBlockHead(outputData, &outputDataPos, &referenceDataPos, "MAPR", inputDataSize); - if (outputData != nullptr) memcpy(&outputData[outputDataPos], inputData, inputDataSize); - outputDataPos += inputDataSize; referenceDataPos += inputDataSize; + serializeContiguousData(inputData, inputDataSize, outputData, &outputDataPos); + if (useDifferentialCompression == true) referenceDataPos += inputDataSize; } // LRAM Block diff --git a/tests/arkanoid.warpless.test b/tests/arkanoid.warpless.test index ad14a9a..46ad719 100644 --- a/tests/arkanoid.warpless.test +++ b/tests/arkanoid.warpless.test @@ -5,5 +5,11 @@ "Sequence File": "arkanoid.warpless.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "MAPR", "CTRL", "APUR" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/arkanoid.warps.test b/tests/arkanoid.warps.test index a8c3976..98f9ab8 100644 --- a/tests/arkanoid.warps.test +++ b/tests/arkanoid.warps.test @@ -5,5 +5,11 @@ "Sequence File": "arkanoid.warps.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "MAPR", "CTRL", "APUR" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/castlevania1.anyPercent.test b/tests/castlevania1.anyPercent.test index 0e0e807..2fcc901 100644 --- a/tests/castlevania1.anyPercent.test +++ b/tests/castlevania1.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "castlevania1.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/castlevania1.pacifist.test b/tests/castlevania1.pacifist.test index 44b26b6..568bc3c 100644 --- a/tests/castlevania1.pacifist.test +++ b/tests/castlevania1.pacifist.test @@ -5,5 +5,11 @@ "Sequence File": "castlevania1.pacifist.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/galaga.anyPercent.test b/tests/galaga.anyPercent.test index 1f0c951..5f0aefb 100644 --- a/tests/galaga.anyPercent.test +++ b/tests/galaga.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "galaga.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/metroid.playaround.test b/tests/metroid.playaround.test index c1ac133..b4d53a9 100644 --- a/tests/metroid.playaround.test +++ b/tests/metroid.playaround.test @@ -5,5 +5,11 @@ "Sequence File": "metroid.playaround.sol", "Disable State Blocks": [ "HEAD", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/nigelMansell.anyPercent.test b/tests/nigelMansell.anyPercent.test index 3e5a787..e085cf5 100644 --- a/tests/nigelMansell.anyPercent.test +++ b/tests/nigelMansell.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "nigelMansell.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/ninjaGaiden.anyPercent.test b/tests/ninjaGaiden.anyPercent.test index b39ab9b..6a10196 100644 --- a/tests/ninjaGaiden.anyPercent.test +++ b/tests/ninjaGaiden.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "ninjaGaiden.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/ninjaGaiden.pacifist.test b/tests/ninjaGaiden.pacifist.test index 16c41d6..a5be4ee 100644 --- a/tests/ninjaGaiden.pacifist.test +++ b/tests/ninjaGaiden.pacifist.test @@ -5,5 +5,11 @@ "Sequence File": "ninjaGaiden.pacifist.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/ninjaGaiden2.anyPercent.test b/tests/ninjaGaiden2.anyPercent.test index cffced6..722a8a4 100644 --- a/tests/ninjaGaiden2.anyPercent.test +++ b/tests/ninjaGaiden2.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "ninjaGaiden2.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/ninjaGaiden2.pacifist.test b/tests/ninjaGaiden2.pacifist.test index 399674d..5d4e5f3 100644 --- a/tests/ninjaGaiden2.pacifist.test +++ b/tests/ninjaGaiden2.pacifist.test @@ -5,5 +5,11 @@ "Sequence File": "ninjaGaiden2.pacifist.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/novaTheSquirrel.anyPercent.test b/tests/novaTheSquirrel.anyPercent.test index b868602..6ade17f 100644 --- a/tests/novaTheSquirrel.anyPercent.test +++ b/tests/novaTheSquirrel.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "novaTheSquirrel.anyPercent.sol", "Disable State Blocks": [ "HEAD", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/princeOfPersia.anyPercent.test b/tests/princeOfPersia.anyPercent.test index 31cf3ee..a4ad4f2 100644 --- a/tests/princeOfPersia.anyPercent.test +++ b/tests/princeOfPersia.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "princeOfPersia.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/rcProAmII.race1.test b/tests/rcProAmII.race1.test index 8416256..5ef8511 100644 --- a/tests/rcProAmII.race1.test +++ b/tests/rcProAmII.race1.test @@ -5,5 +5,11 @@ "Sequence File": "rcProAmII.race1.sol", "Disable State Blocks": [ "HEAD", "SRAM", "NTAB", "SPRT", "CTRL", "APUR" ], "Controller 1 Type": "FourScore1", - "Controller 2 Type": "FourScore2" + "Controller 2 Type": "FourScore2", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/saintSeiyaKanketsuHen.anyPercent.test b/tests/saintSeiyaKanketsuHen.anyPercent.test index 595c6bc..59c7273 100644 --- a/tests/saintSeiyaKanketsuHen.anyPercent.test +++ b/tests/saintSeiyaKanketsuHen.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "saintSeiyaKanketsuHen.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/saintSeiyaOugonDensetsu.anyPercent.test b/tests/saintSeiyaOugonDensetsu.anyPercent.test index 88e4213..cd456cc 100644 --- a/tests/saintSeiyaOugonDensetsu.anyPercent.test +++ b/tests/saintSeiyaOugonDensetsu.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "saintSeiyaKanketsuHen.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/saiyuukiWorld.anyPercent.test b/tests/saiyuukiWorld.anyPercent.test index 5f5eb28..4a4251a 100644 --- a/tests/saiyuukiWorld.anyPercent.test +++ b/tests/saiyuukiWorld.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "saiyuukiWorld.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/saiyuukiWorld.lastHalf.test b/tests/saiyuukiWorld.lastHalf.test index 011ee44..c97f303 100644 --- a/tests/saiyuukiWorld.lastHalf.test +++ b/tests/saiyuukiWorld.lastHalf.test @@ -3,7 +3,13 @@ "Expected ROM SHA1": "C2F12D915A4D0B1FFDF8A64AE1092CE6A2D08770", "Initial State File": "saiyuukiWorld.lastHalf.state", "Sequence File": "saiyuukiWorld.lastHalf.sol", - "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], + "Disable State Blocks": [ ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/solarJetman.anyPercent.test b/tests/solarJetman.anyPercent.test index e0f5bb0..000e5fa 100644 --- a/tests/solarJetman.anyPercent.test +++ b/tests/solarJetman.anyPercent.test @@ -7,5 +7,11 @@ "Sequence File": "solarJetman.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/sprilo.anyPercent.test b/tests/sprilo.anyPercent.test index 3b18368..d838a45 100644 --- a/tests/sprilo.anyPercent.test +++ b/tests/sprilo.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "sprilo.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/superMarioBros.warpless.test b/tests/superMarioBros.warpless.test index 997a00a..cbaebf9 100644 --- a/tests/superMarioBros.warpless.test +++ b/tests/superMarioBros.warpless.test @@ -5,5 +5,11 @@ "Sequence File": "superMarioBros.warpless.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/superMarioBros.warps.test b/tests/superMarioBros.warps.test index 0cb5954..7696ce6 100644 --- a/tests/superMarioBros.warps.test +++ b/tests/superMarioBros.warps.test @@ -5,5 +5,11 @@ "Sequence File": "superMarioBros.warps.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/superMarioBros3.warps.test b/tests/superMarioBros3.warps.test index f419626..bbf865c 100644 --- a/tests/superMarioBros3.warps.test +++ b/tests/superMarioBros3.warps.test @@ -5,5 +5,11 @@ "Sequence File": "superMarioBros3.warps.sol", "Disable State Blocks": [ "HEAD", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/superOffroad.anyPercent.test b/tests/superOffroad.anyPercent.test index baa8d4d..3da3976 100644 --- a/tests/superOffroad.anyPercent.test +++ b/tests/superOffroad.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "superOffroad.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } } diff --git a/tests/tennis.anyPercent.test b/tests/tennis.anyPercent.test index 141c996..f590571 100644 --- a/tests/tennis.anyPercent.test +++ b/tests/tennis.anyPercent.test @@ -5,5 +5,11 @@ "Sequence File": "tennis.anyPercent.sol", "Disable State Blocks": [ "HEAD", "SRAM", "CHRR", "NTAB", "SPRT", "CTRL" ], "Controller 1 Type": "Joypad", - "Controller 2 Type": "None" + "Controller 2 Type": "None", + "Differential Compression": + { + "Enabled": false, + "Max Differences": 2200, + "Use Zlib": true + } }