Skip to content

Commit

Permalink
Fix Chou Aniki. Remove hack.
Browse files Browse the repository at this point in the history
  • Loading branch information
bearoso committed Mar 9, 2019
1 parent 28a62e9 commit e854a75
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
9 changes: 7 additions & 2 deletions cpuexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ void S9xMainLoop (void)
#define CHECK_FOR_IRQ_CHANGE() \
if (Timings.IRQFlagChanging) \
{ \
if (Timings.IRQFlagChanging == IRQ_CLEAR_FLAG) \
if (Timings.IRQFlagChanging & IRQ_TRIGGER_NMI) \
{ \
CPU.NMIPending = TRUE; \
Timings.NMITriggerPos = CPU.Cycles + 6; \
} \
if (Timings.IRQFlagChanging & IRQ_CLEAR_FLAG) \
ClearIRQ(); \
else if (Timings.IRQFlagChanging == IRQ_SET_FLAG) \
else if (Timings.IRQFlagChanging & IRQ_SET_FLAG) \
SetIRQ(); \
Timings.IRQFlagChanging = IRQ_NONE; \
}
Expand Down
4 changes: 2 additions & 2 deletions cpuops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ static void Op58 (void)
AddCycles(ONE_CYCLE);

#ifndef SA1_OPCODES
Timings.IRQFlagChanging = IRQ_CLEAR_FLAG;
Timings.IRQFlagChanging |= IRQ_CLEAR_FLAG;
#else
ClearIRQ();
#endif
Expand All @@ -1464,7 +1464,7 @@ static void Op78 (void)
AddCycles(ONE_CYCLE);

#ifndef SA1_OPCODES
Timings.IRQFlagChanging = IRQ_SET_FLAG;
Timings.IRQFlagChanging |= IRQ_SET_FLAG;
#else
SetIRQ();
#endif
Expand Down
2 changes: 0 additions & 2 deletions memmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3614,8 +3614,6 @@ void CMemory::ApplyROMFixes (void)
{
//if (match_id("AVCJ")) // Rendering Ranger R2
// Timings.APUSpeedup = 2;
if (match_id("AANJ")) // Chou Aniki
Timings.APUSpeedup = -3;
if (match_na("CIRCUIT USA"))
Timings.APUSpeedup = 3;

Expand Down
3 changes: 1 addition & 2 deletions ppu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1403,8 +1403,7 @@ void S9xSetCPU (uint8 Byte, uint16 Address)
{
// FIXME: triggered at HC+=6, checked just before the final CPU cycle,
// then, when to call S9xOpcode_NMI()?
CPU.NMIPending = TRUE;
Timings.NMITriggerPos = CPU.Cycles + 6 + 6;
Timings.IRQFlagChanging |= IRQ_TRIGGER_NMI;

#ifdef DEBUGGER
if (Settings.TraceHCEvent)
Expand Down
7 changes: 4 additions & 3 deletions snes9x.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ enum

enum
{
IRQ_NONE = 0,
IRQ_SET_FLAG = 1,
IRQ_CLEAR_FLAG = 2
IRQ_NONE = 0x0,
IRQ_SET_FLAG = 0x1,
IRQ_CLEAR_FLAG = 0x2,
IRQ_TRIGGER_NMI = 0x4
};

struct STimings
Expand Down

0 comments on commit e854a75

Please sign in to comment.