refactor: Improve Emulator Initialization and Resource Management
- Refactored SDL initialization process to enhance clarity and error handling, ensuring proper setup of video, audio, and event subsystems. - Utilized RAII smart pointers for window and renderer management, improving resource cleanup during shutdown. - Updated audio buffer allocation to use unique_ptr for automatic memory management. - Enhanced logging for emulator state and initialization, providing better insights during execution. - Streamlined timing management and frame processing logic for improved performance and maintainability.
This commit is contained in:
@@ -306,7 +306,7 @@ uint8_t Snes::ReadBBus(uint8_t adr) {
|
||||
static int cpu_port_read_count = 0;
|
||||
static uint8_t last_f4 = 0xFF, last_f5 = 0xFF;
|
||||
bool value_changed = ((adr & 0x3) == 0 && val != last_f4) || ((adr & 0x3) == 1 && val != last_f5);
|
||||
if (value_changed || cpu_port_read_count++ < 50) {
|
||||
if (value_changed || cpu_port_read_count++ < 5) {
|
||||
LOG_INFO("SNES", "CPU read APU port $21%02X (F%d) = $%02X at PC=$%02X:%04X [AFTER CatchUp: APU_cycles=%llu CPU_cycles=%llu]",
|
||||
0x40 + (adr & 0x3), (adr & 0x3) + 4, val, cpu_.PB, cpu_.PC, apu_.GetCycles(), cycles_);
|
||||
if ((adr & 0x3) == 0) last_f4 = val;
|
||||
|
||||
Reference in New Issue
Block a user