mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-27 02:50:28 +00:00
Input: Reading the controller while the strobe signal is high should always return the state of button A
Fixed an edge case that occurred when setting strobe bit after reading $4016 once and then reading $4016 again
This commit is contained in:
parent
1d03eb7859
commit
c3b1b3effc
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ public:
|
||||
{
|
||||
uint8_t output = 0;
|
||||
if(addr == 0x4016) {
|
||||
StrobeProcessRead();
|
||||
output = (_stateBuffer & 0x01) << 1;
|
||||
_stateBuffer >>= 1;
|
||||
StrobeProcessRead();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -29,9 +29,9 @@ public:
|
||||
{
|
||||
uint8_t output = 0;
|
||||
if(addr == 0x4016) {
|
||||
StrobeProcessRead();
|
||||
output = (_stateBuffer & 0x01) << 1;
|
||||
_stateBuffer >>= 1;
|
||||
StrobeProcessRead();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user