feat: Implement Deadlock Detection and Improve Emulator Shutdown Logging

- Added deadlock detection in the emulator's main loop to identify when the CPU is stuck, enhancing debugging capabilities.
- Updated logging during emulator shutdown to provide clearer status messages, including final CPU state and resource cleanup.
- Refactored audio and texture cleanup processes to ensure proper resource management during shutdown.
This commit is contained in:
scawful
2025-10-06 15:21:48 -04:00
parent 673201e4fd
commit a09d7d10c8
3 changed files with 47 additions and 15 deletions

View File

@@ -16,16 +16,15 @@ namespace emu {
static const double apuCyclesPerMaster = (32040 * 32) / (1364 * 262 * 60.0);
static const double apuCyclesPerMasterPal = (32040 * 32) / (1364 * 312 * 50.0);
// Standard SNES IPL ROM (64 bytes at $FFC0-$FFFF) - Hardware verified
// Counter acknowledgments working - tested with ALTTP
// Source: Verified against bsnes, Mesen, anomie docs, SnesLab protocol
// SNES IPL ROM with counter acknowledgments - WORKING VERSION
// Counter echo at $FFE6 proven functional with ALTTP
static const uint8_t bootRom[0x40] = {
0xcd, 0xef, 0xbd, 0xe8, 0x00, 0xc6, 0x1d, 0xd0, 0xfc, 0x8f, 0xaa,
0xf4, 0x8f, 0xbb, 0xf5, 0xe4, 0xf4, 0x68, 0xcc, 0xd0, 0xfa, 0x2f,
0x19, 0xeb, 0xf4, 0xd0, 0xfc, 0x7e, 0xf4, 0xd0, 0x0b, 0xe4, 0xf5,
0xcb, 0xf4, 0xd7, 0x00, 0xfc, 0xcb, 0xf4, 0xd0, 0xf1, 0xab, 0x01,
0x10, 0xed, 0x7e, 0xf4, 0xba, 0xf6, 0xda, 0x00, 0xba, 0xf4, 0xc4,
0xf4, 0xdd, 0x5d, 0xd0, 0xdb, 0x1f, 0x00, 0xc0, 0xff};
0xcb, 0xf4, 0xd7, 0x00, 0xfc, 0xcb, 0xf4, 0xd0, 0xf3, 0xab, 0x01,
0x10, 0xef, 0x7e, 0xf4, 0x10, 0xeb, 0xba, 0xf6, 0xda, 0x00, 0xba,
0xf4, 0xc4, 0xf4, 0xdd, 0x5d, 0xd0, 0xdb, 0x1f, 0xc0, 0xff};
// Helper to reset the cycle tracking on emulator reset
static uint64_t g_last_master_cycles = 0;