diff --git a/Core/BandaiHyperShot.h b/Core/BandaiHyperShot.h index e367b570..4bdbf041 100644 --- a/Core/BandaiHyperShot.h +++ b/Core/BandaiHyperShot.h @@ -62,9 +62,9 @@ public: uint8_t ReadRAM(uint16_t addr) override { if(addr == 0x4016) { + StrobeProcessRead(); uint8_t output = (_stateBuffer & 0x01) << 1; _stateBuffer >>= 1; - StrobeProcessRead(); return output; } else { return (IsLightFound() ? 0 : 0x08) | (IsPressed(BandaiHyperShot::ZapperButtons::Fire) ? 0x10 : 0x00); diff --git a/Core/FourScore.h b/Core/FourScore.h index e7f8781a..c87ae25f 100644 --- a/Core/FourScore.h +++ b/Core/FourScore.h @@ -29,6 +29,7 @@ public: uint8_t ReadRAM(uint16_t addr) override { + StrobeProcessRead(); uint8_t output = 0; if(addr == 0x4016) { output = _signature4016 & 0x01; @@ -37,7 +38,6 @@ public: output = _signature4017 & 0x01; _signature4017 >>= 1; } - StrobeProcessRead(); return output; } diff --git a/Core/HoriTrack.h b/Core/HoriTrack.h index 73ec52ad..5ad59d71 100644 --- a/Core/HoriTrack.h +++ b/Core/HoriTrack.h @@ -25,9 +25,9 @@ public: { uint8_t output = 0; if(addr == 0x4016) { + StrobeProcessRead(); output = (_stateBuffer & 0x01) << 1; _stateBuffer >>= 1; - StrobeProcessRead(); } return output; } diff --git a/Core/JissenMahjongController.h b/Core/JissenMahjongController.h index 87b94d5f..b24af8ae 100644 --- a/Core/JissenMahjongController.h +++ b/Core/JissenMahjongController.h @@ -39,9 +39,9 @@ public: uint8_t ReadRAM(uint16_t addr) override { if(addr == 0x4017) { + StrobeProcessRead(); uint8_t value = (_stateBuffer & 0x01) << 1; _stateBuffer >>= 1; - StrobeProcessRead(); return value; } return 0; diff --git a/Core/PachinkoController.h b/Core/PachinkoController.h index 88b40b45..01d30e92 100644 --- a/Core/PachinkoController.h +++ b/Core/PachinkoController.h @@ -29,9 +29,9 @@ public: { uint8_t output = 0; if(addr == 0x4016) { + StrobeProcessRead(); output = (_stateBuffer & 0x01) << 1; _stateBuffer >>= 1; - StrobeProcessRead(); } return output; } diff --git a/Core/PartyTap.h b/Core/PartyTap.h index a812dcfd..29d70a7c 100644 --- a/Core/PartyTap.h +++ b/Core/PartyTap.h @@ -40,10 +40,10 @@ public: uint8_t ReadRAM(uint16_t addr) override { if(addr == 0x4017) { + StrobeProcessRead(); if(_readCount < 2) { uint8_t value = (_stateBuffer & 0x7) << 2; _stateBuffer >>= 3; - StrobeProcessRead(); _readCount++; return value; } else { diff --git a/Core/PowerPad.h b/Core/PowerPad.h index 2b6e6a5e..eacbfd04 100644 --- a/Core/PowerPad.h +++ b/Core/PowerPad.h @@ -61,14 +61,14 @@ public: { uint8_t output = 0; if(IsCurrentPort(addr)) { + StrobeProcessRead(); + output = ((_stateBufferH & 0x01) << 4) | ((_stateBufferL & 0x01) << 3); _stateBufferL >>= 1; _stateBufferH >>= 1; _stateBufferL |= 0x80; _stateBufferH |= 0x80; - - StrobeProcessRead(); } return output; } diff --git a/Core/SnesController.h b/Core/SnesController.h index b00a109c..549f1d28 100644 --- a/Core/SnesController.h +++ b/Core/SnesController.h @@ -85,13 +85,13 @@ public: uint8_t output = 0; if(IsCurrentPort(addr)) { + StrobeProcessRead(); + output = _stateBuffer & 0x01; _stateBuffer >>= 1; //"All subsequent reads will return D=1 on an authentic controller but may return D=0 on third party controllers." _stateBuffer |= 0x8000; - - StrobeProcessRead(); } return output; diff --git a/Core/SnesMouse.h b/Core/SnesMouse.h index d2a3c48b..185c4b2f 100644 --- a/Core/SnesMouse.h +++ b/Core/SnesMouse.h @@ -49,6 +49,8 @@ public: { uint8_t output = 0; if((addr == 0x4016 && (_port & 0x01) == 0) || (addr == 0x4017 && (_port & 0x01) == 1)) { + StrobeProcessRead(); + if(_strobe) { _sensitivity = (_sensitivity + 1) % 3; } @@ -58,7 +60,6 @@ public: output <<= 1; } _stateBuffer <<= 1; - StrobeProcessRead(); } return output; } diff --git a/Core/StandardController.h b/Core/StandardController.h index 2d06ba88..f5615d5a 100644 --- a/Core/StandardController.h +++ b/Core/StandardController.h @@ -111,6 +111,8 @@ public: uint8_t output = 0; if((addr == 0x4016 && (_port & 0x01) == 0) || (addr == 0x4017 && (_port & 0x01) == 1)) { + StrobeProcessRead(); + output = _stateBuffer & 0x01; if(_port >= 2 && _console->GetSettings()->GetConsoleType() == ConsoleType::Famicom) { //Famicom outputs P3 & P4 on bit 1 @@ -120,8 +122,6 @@ public: //"All subsequent reads will return D=1 on an authentic controller but may return D=0 on third party controllers." _stateBuffer |= 0x80000000; - - StrobeProcessRead(); } if(addr == 0x4016 && IsPressed(StandardController::Buttons::Microphone)) { diff --git a/Core/SuborMouse.h b/Core/SuborMouse.h index 7983a8b6..217c98d1 100644 --- a/Core/SuborMouse.h +++ b/Core/SuborMouse.h @@ -44,12 +44,12 @@ public: { uint8_t output = 0; if((addr == 0x4016 && (_port & 0x01) == 0) || (addr == 0x4017 && (_port & 0x01) == 1)) { + StrobeProcessRead(); output = (_stateBuffer & 0x80) >> 7; if(_port >= 2) { output <<= 1; } _stateBuffer <<= 1; - StrobeProcessRead(); } return output; } diff --git a/Core/VsZapper.h b/Core/VsZapper.h index 6427a4ad..348c734f 100644 --- a/Core/VsZapper.h +++ b/Core/VsZapper.h @@ -27,9 +27,9 @@ public: uint8_t ReadRAM(uint16_t addr) override { if(IsCurrentPort(addr)) { + StrobeProcessRead(); uint8_t returnValue = _stateBuffer & 0x01; _stateBuffer >>= 1; - StrobeProcessRead(); return returnValue; }