diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk_new/GBHawkNew.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk_new/GBHawkNew.IEmulator.cs index 84081cdc31..e8bc94fa7d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk_new/GBHawkNew.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk_new/GBHawkNew.IEmulator.cs @@ -145,11 +145,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkNew #region Audio - public BlipBuffer blip_L = new BlipBuffer(9000); - public BlipBuffer blip_R = new BlipBuffer(9000); + public BlipBuffer blip_L = new BlipBuffer(25000); + public BlipBuffer blip_R = new BlipBuffer(25000); - public int[] Aud_L = new int[9000]; - public int[] Aud_R = new int[9000]; + public int[] Aud_L = new int[25000]; + public int[] Aud_R = new int[25000]; public uint num_samp_L; public uint num_samp_R; diff --git a/libHawk/GBHawk/GBHawk/Core.h b/libHawk/GBHawk/GBHawk/Core.h index 02f3967f16..1cf7a97dad 100644 --- a/libHawk/GBHawk/GBHawk/Core.h +++ b/libHawk/GBHawk/GBHawk/Core.h @@ -159,18 +159,18 @@ namespace GBHawk if (!MemMap.HDMA_transfer) { // These things all tick twice as fast in GBC double speed mode - ppu->DMA_tick(); + if (ppu->DMA_start && !cpu.halted) { ppu->DMA_tick(); } timer.tick_1(); serialport.serial_transfer_tick(); - cpu.ExecuteOne(&MemMap.REG_FF0F, MemMap.REG_FFFF); + cpu.ExecuteOne(&MemMap.REG_FF0F, &MemMap.REG_FFFF); timer.tick_2(); if (MemMap.double_speed) { - ppu->DMA_tick(); + if (ppu->DMA_start && !cpu.halted) { ppu->DMA_tick(); } timer.tick_1(); serialport.serial_transfer_tick(); - cpu.ExecuteOne(&MemMap.REG_FF0F, MemMap.REG_FFFF); + cpu.ExecuteOne(&MemMap.REG_FF0F, &MemMap.REG_FFFF); timer.tick_2(); } } @@ -236,18 +236,19 @@ namespace GBHawk if (!MemMap.HDMA_transfer) { // These things all tick twice as fast in GBC double speed mode - ppu->DMA_tick(); + // Note that DMA is halted when the CPU is halted + if (ppu->DMA_start && !cpu.halted) { ppu->DMA_tick(); } timer.tick_1(); serialport.serial_transfer_tick(); - cpu.ExecuteOne(&MemMap.REG_FF0F, MemMap.REG_FFFF); + cpu.ExecuteOne(&MemMap.REG_FF0F, &MemMap.REG_FFFF); timer.tick_2(); if (MemMap.double_speed) { - ppu->DMA_tick(); + if (ppu->DMA_start && !cpu.halted) { ppu->DMA_tick(); } timer.tick_1(); serialport.serial_transfer_tick(); - cpu.ExecuteOne(&MemMap.REG_FF0F, MemMap.REG_FFFF); + cpu.ExecuteOne(&MemMap.REG_FF0F, &MemMap.REG_FFFF); timer.tick_2(); } } diff --git a/libHawk/GBHawk/GBHawk/GBAudio.h b/libHawk/GBHawk/GBHawk/GBAudio.h index 3069d16ba4..7ed2b6d2e1 100644 --- a/libHawk/GBHawk/GBHawk/GBAudio.h +++ b/libHawk/GBHawk/GBHawk/GBAudio.h @@ -19,8 +19,8 @@ namespace GBHawk uint32_t* timer_div_reg = nullptr; uint32_t num_samples_L, num_samples_R; - int32_t samples_L[9000] = {}; - int32_t samples_R[9000] = {}; + int32_t samples_L[25000] = {}; + int32_t samples_R[25000] = {}; bool DUTY_CYCLES[32] = {false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, true, diff --git a/libHawk/GBHawk/GBHawk/LR35902.h b/libHawk/GBHawk/GBHawk/LR35902.h index f4347ea849..39178a0201 100644 --- a/libHawk/GBHawk/GBHawk/LR35902.h +++ b/libHawk/GBHawk/GBHawk/LR35902.h @@ -197,7 +197,7 @@ namespace GBHawk } // Execute instructions - void ExecuteOne(uint8_t* interrupt_src, uint8_t interrupt_enable) + void ExecuteOne(uint8_t* interrupt_src, uint8_t* interrupt_enable) { switch (instr_table[instr_pntr++]) { @@ -554,7 +554,7 @@ namespace GBHawk instr_pntr++; //Console.WriteLine(interrupt_src + " " + interrupt_enable + " " + TotalExecutedCycles); - if (((interrupt_src[0] & (1 << bit_check)) > 0) && ((interrupt_enable & (1 << bit_check)) > 0)) { int_src = bit_check; int_clear = (uint8_t)(1 << bit_check); } + if (((interrupt_src[0] & (1 << bit_check)) > 0) && ((interrupt_enable[0] & (1 << bit_check)) > 0)) { int_src = bit_check; int_clear = (uint8_t)(1 << bit_check); } /* if (interrupt_src.Bit(0) && interrupt_enable.Bit(0)) { int_src = 0; int_clear = 1; } else if (interrupt_src.Bit(1) && interrupt_enable.Bit(1)) { int_src = 1; int_clear = 2; } @@ -581,7 +581,7 @@ namespace GBHawk case IRQ_CLEAR: if ((interrupt_src[0] & (1 << int_src)) > 0) { interrupt_src[0] -= int_clear; } - if ((interrupt_src[0] & interrupt_enable) == 0) { FlagI = false; } + if ((interrupt_src[0] & interrupt_enable[0]) == 0) { FlagI = false; } // reset back to default state int_src = 5;