From 86470e378c710e4d70fcaf25147bca102b0ef388 Mon Sep 17 00:00:00 2001 From: Sergio Martin Date: Sun, 21 Jan 2024 19:22:28 +0100 Subject: [PATCH] Optimizations to control reading --- source/quickerNES/core.hpp | 8 ++++---- tests/rcProAmII.race1.test | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/quickerNES/core.hpp b/source/quickerNES/core.hpp index ccc7b28..3f5faf6 100644 --- a/source/quickerNES/core.hpp +++ b/source/quickerNES/core.hpp @@ -871,10 +871,10 @@ size_t serializeLiteState(uint8_t *buffer) const // to do: to aid with recording, doesn't emulate transparent latch, // so a game that held strobe at 1 and read $4016 or $4017 would not get // the current A status as occurs on a NES - unsigned long result = joypad.joypad_latches[addr & 1]; - if (!(joypad.w4016 & 1)) - joypad.joypad_latches[addr & 1] = (result >> 1) | 0x80000000; - return result & 1; + if (joypad.w4016 & 1) return 0; + const uint8_t result = joypad.joypad_latches[addr & 1] & 1; + joypad.joypad_latches[addr & 1] >>= 1; + return result; } if (addr == Apu::status_addr) diff --git a/tests/rcProAmII.race1.test b/tests/rcProAmII.race1.test index d882250..7ac856e 100644 --- a/tests/rcProAmII.race1.test +++ b/tests/rcProAmII.race1.test @@ -3,7 +3,7 @@ "Expected ROM SHA1": "8C68582BDAA32FBC8C7CD858991D4E00D3B1569C", "Initial State File": "", "Sequence File": "rcProAmII.race1.sol", - "Disable State Blocks": [ ], + "Disable State Blocks": [ "SRAM", "NTAB", "SPRT", "CTRL", "APUR" ], "Controller 1 Type": "FourScore1", "Controller 2 Type": "FourScore2" }