Due to the EverDrive check requiring that a register is written to (which is by design and unlikely to change), it can lead to emulators crashing. A check for whether the ROM is running on an emulator should therefore be added to the start of usb_initialize() to prevent further issues.
This can be done in multiple ways:
- On emulators, the RDP clock register is always zero (
IO_READ(DPC_CLOCK_REG)) unless written to specifically by a game.
- You can check how often the counter register increments, but that fails on MUPEN.
- You can purposefully trigger an icache miss and measure the counter to see if the CPU stalled, but that requires very specific address alignment
- Overwrite the start of a function right before it executes without any cache invalidation. This is the method used by Marshall on his MGC 2011 demo.
It would be probably best to attempt method 1, and then fall back on a second method just in case.
Due to the EverDrive check requiring that a register is written to (which is by design and unlikely to change), it can lead to emulators crashing. A check for whether the ROM is running on an emulator should therefore be added to the start of
usb_initialize()to prevent further issues.This can be done in multiple ways:
IO_READ(DPC_CLOCK_REG)) unless written to specifically by a game.It would be probably best to attempt method 1, and then fall back on a second method just in case.