mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-27 10:38:46 -04:00
cdrom: cancel stale INT2 on new command (PSX-CD-007)
Cancel the previous command's outstanding second-response interrupt when a new CD command is accepted (psx-spx command flow; DuckStation BeginCommand semantics). Without this, a Pause(0x09) INT2 survives into the guest's next Setmode/Setloc/ReadN sequence and fires mid-read as a stale COMPLETE — LIBDS drivers treat it as a read failure, corrupting the streamed resource chain. Cross-validated: C-12 Final Resistance mission 1 PC=0 null-callback termination disappeared after absorbing this fix (DEVLOG 2026-08-05). MOHU Mission 1 freeze in a DsRead FATAL/retry loop on single-sector marker reads. Also guard beetle SIGSTOP trap behind #ifndef _WIN32 (Windows has no SIGSTOP). (cherry picked from commit 2c43fc69c66242a86183156a6f1e60b2f81b1e47) (cherry picked from commit c03fe5ba3d49241dfaedb344db6ad9c977070722)
This commit is contained in:
@@ -75,7 +75,9 @@ static void cdcmd_trace_callback(uint8_t cmd, uint8_t nargs,
|
||||
uint32_t pc) {
|
||||
/* Symmetric self-stop trap (mirror of the runtime's PSX_CD_TRAP_CMD):
|
||||
* SIGSTOP on the Nth matching CD command so a debugger can freeze the
|
||||
* oracle at the exact boot point and diff its state against ours. */
|
||||
* oracle at the exact boot point and diff its state against ours.
|
||||
* POSIX-only, same guard as debug_server.c — Windows has no SIGSTOP. */
|
||||
#ifndef _WIN32
|
||||
{
|
||||
static long trap_cmd = -2, trap_nth = 1, hits = 0;
|
||||
if (trap_cmd == -2) {
|
||||
@@ -86,6 +88,7 @@ static void cdcmd_trace_callback(uint8_t cmd, uint8_t nargs,
|
||||
}
|
||||
if ((long)cmd == trap_cmd && ++hits == trap_nth) raise(SIGSTOP);
|
||||
}
|
||||
#endif
|
||||
BeetleCdcmdEntry *e = &s_cdcmd_trace[s_cdcmd_idx];
|
||||
e->seq = s_cdcmd_seq++; e->pc = pc; e->cmd = cmd; e->nargs = nargs;
|
||||
e->a0 = a0; e->a1 = a1; e->a2 = a2;
|
||||
|
||||
Reference in New Issue
Block a user