diff options
author | jdgleaver | 2018-12-19 16:09:45 +0000 |
---|---|---|
committer | jdgleaver | 2018-12-19 16:09:45 +0000 |
commit | 461d2615ce39be7178dd2dca3b715edf86c3fc73 (patch) | |
tree | f9f5ee841c6183e001724883005cda515f899115 /src/ppu.c | |
parent | 30352c8da713c2f344b8c4f8979067b04369cb7e (diff) | |
download | snes9x2002-461d2615ce39be7178dd2dca3b715edf86c3fc73.tar.gz snes9x2002-461d2615ce39be7178dd2dca3b715edf86c3fc73.tar.bz2 snes9x2002-461d2615ce39be7178dd2dca3b715edf86c3fc73.zip |
Fix controller input for Super Mario All-Stars (backport
https://github.com/libretro/snes9x2005/commit/bc7474392a91fa9838e6ecb5b16ccebdd97ab9ec)
Diffstat (limited to 'src/ppu.c')
-rw-r--r-- | src/ppu.c | 33 |
1 files changed, 12 insertions, 21 deletions
@@ -172,7 +172,7 @@ void S9xSetCPU(uint8 byte, uint16 Address) } break; case 0x4017 : - break; + return; default : #ifdef DEBUGGER missing.unknowncpu_write = Address; @@ -648,6 +648,9 @@ uint8 S9xGetCPU(uint16 Address) if (Memory.FillRAM[0x4016] & 1) return (0); + if (PPU.Joypad1ButtonReadPos >= 16) // Joypad 1 is enabled + return 1; + byte = IPPU.Joypads[0] >> (PPU.Joypad1ButtonReadPos ^ 15); PPU.Joypad1ButtonReadPos++; return (byte & 1); @@ -663,8 +666,6 @@ uint8 S9xGetCPU(uint16 Address) return (2); case SNES_MOUSE : - if (++PPU.MouseSpeed[0] > 2) - PPU.MouseSpeed[0] = 0; break; } return (0x00); @@ -675,7 +676,7 @@ uint8 S9xGetCPU(uint16 Address) if (Memory.FillRAM[0x4201] & 0x80) { byte = - ((IPPU.Joypads[0] + ((IPPU.Joypads[1] >> (PPU.Joypad2ButtonReadPos ^ 15)) & 1) | (((IPPU.Joypads[2] @@ -699,10 +700,11 @@ uint8 S9xGetCPU(uint16 Address) return (byte); } } - return ( - (IPPU.Joypads[1] - >> (PPU.Joypad2ButtonReadPos++ ^ 15)) - & 1); + + if (PPU.Joypad2ButtonReadPos >= 16) // Joypad 2 is enabled + return 1; + + return (IPPU.Joypads[1] >> (PPU.Joypad2ButtonReadPos++ ^ 15)) & 1; } default : #ifdef DEBUGGER @@ -1158,9 +1160,7 @@ void S9xProcessMouse(int which1) int x, y; uint32 buttons; - if ((IPPU.Controller == SNES_MOUSE - || IPPU.Controller == SNES_MOUSE_SWAPPED) - && S9xReadMousePosition(which1, &x, &y, &buttons)) + if (IPPU.Controller == SNES_MOUSE && S9xReadMousePosition(which1, &x, &y, &buttons)) { int delta_x, delta_y; #define MOUSE_SIGNATURE 0x1 @@ -1215,10 +1215,7 @@ void S9xProcessMouse(int which1) else IPPU.Mouse[which1] |= delta_y << 24; - if (IPPU.Controller == SNES_MOUSE_SWAPPED) - IPPU.Joypads[0] = IPPU.Mouse[which1]; - else - IPPU.Joypads[1] = IPPU.Mouse[which1]; + IPPU.Joypads[1] = IPPU.Mouse [which1]; } } @@ -1266,12 +1263,6 @@ void S9xNextController() case SNES_JOYPAD : if (Settings.MouseMaster) { - IPPU.Controller = SNES_MOUSE_SWAPPED; - break; - } - case SNES_MOUSE_SWAPPED : - if (Settings.MouseMaster) - { IPPU.Controller = SNES_MOUSE; break; } |