GBHawk: bug fix, initial ram change, and double speed mode input dumping
This commit is contained in:
parent
58cbec6dd6
commit
4447d5ddc7
|
@ -19,7 +19,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
[FeatureNotImplemented]
|
||||
public void Step(StepType type) => throw new NotImplementedException();
|
||||
|
||||
public long TotalExecutedCycles => (long)cpu.TotalExecutedCycles;
|
||||
//public long TotalExecutedCycles => CycleCount;
|
||||
public long TotalExecutedCycles => _settings.cycle_return_setting == GBSettings.Cycle_Return.CPU ? (long)cpu.TotalExecutedCycles : CycleCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
|
||||
if (delays_to_process) { process_delays(); }
|
||||
|
||||
//CycleCount++;
|
||||
CycleCount++;
|
||||
|
||||
if (in_vblank && !in_vblank_old)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
Gr
|
||||
}
|
||||
|
||||
public enum Cycle_Return
|
||||
{
|
||||
CPU,
|
||||
GBI
|
||||
}
|
||||
|
||||
[DisplayName("Color Mode")]
|
||||
[Description("Pick Between Green scale and Grey scale colors")]
|
||||
[DefaultValue(PaletteType.BW)]
|
||||
|
@ -54,6 +60,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
[DefaultValue(false)]
|
||||
public bool VBL_sync { get; set; }
|
||||
|
||||
[DisplayName("TotalExecutedCycles Return Value")]
|
||||
[Description("CPU returns the actual CPU cycles executed, GBI returns the values needed for console verification")]
|
||||
[DefaultValue(Cycle_Return.CPU)]
|
||||
public Cycle_Return cycle_return_setting { get; set; }
|
||||
|
||||
public GBSettings Clone()
|
||||
{
|
||||
return (GBSettings)MemberwiseClone();
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
ser.Sync(nameof(controller_delay_cd), ref controller_delay_cd);
|
||||
ser.Sync(nameof(cpu_state_hold), ref cpu_state_hold);
|
||||
ser.Sync(nameof(clear_counter), ref clear_counter);
|
||||
ser.Sync(nameof(CycleCount), ref CycleCount);
|
||||
|
||||
ser.Sync(nameof(REG_FFFF), ref REG_FFFF);
|
||||
ser.Sync(nameof(REG_FF0F), ref REG_FF0F);
|
||||
|
@ -47,6 +48,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
ser.Sync(nameof(_bios), ref _bios, false);
|
||||
|
||||
ser.Sync(nameof(RAM_Bank), ref RAM_Bank);
|
||||
ser.Sync(nameof(RAM_Bank_ret), ref RAM_Bank_ret);
|
||||
ser.Sync(nameof(VRAM_Bank), ref VRAM_Bank);
|
||||
ser.Sync(nameof(is_GBC), ref is_GBC);
|
||||
ser.Sync(nameof(GBC_compat), ref GBC_compat);
|
||||
|
|
|
@ -60,6 +60,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
public byte[] OAM_vbls = new byte[0xA0];
|
||||
|
||||
public int RAM_Bank;
|
||||
public int RAM_Bank_ret;
|
||||
public byte VRAM_Bank;
|
||||
internal bool is_GBC;
|
||||
public bool GBC_compat; // compatibility mode for GB games played on GBC
|
||||
|
@ -224,18 +225,55 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
iptr3 = Marshal.AllocHGlobal(ppu.color_palette.Length * 8 * 8 + 1);
|
||||
|
||||
_scanlineCallback = null;
|
||||
|
||||
/*
|
||||
|
||||
for (int i = 0; i < ZP_RAM.Length; i++)
|
||||
{
|
||||
ZP_RAM[i] = 0xFF;
|
||||
}
|
||||
|
||||
for (int i = 0; i < RAM.Length; i++)
|
||||
for (int i = 0; i < 0x800; i++)
|
||||
{
|
||||
RAM[i] = 0xFF;
|
||||
if ((i & 0xF) < 8)
|
||||
{
|
||||
RAM[i] = 0xFF;
|
||||
RAM[i + 0x1000] = 0xFF;
|
||||
RAM[i + 0x2000] = 0xFF;
|
||||
RAM[i + 0x3000] = 0xFF;
|
||||
RAM[i + 0x4000] = 0xFF;
|
||||
RAM[i + 0x5000] = 0xFF;
|
||||
RAM[i + 0x6000] = 0xFF;
|
||||
RAM[i + 0x7000] = 0xFF;
|
||||
|
||||
RAM[i + 0x800] = 0;
|
||||
RAM[i + 0x1800] = 0;
|
||||
RAM[i + 0x2800] = 0;
|
||||
RAM[i + 0x3800] = 0;
|
||||
RAM[i + 0x4800] = 0;
|
||||
RAM[i + 0x5800] = 0;
|
||||
RAM[i + 0x6800] = 0;
|
||||
RAM[i + 0x7800] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RAM[i] = 0;
|
||||
RAM[i + 0x1000] = 0;
|
||||
RAM[i + 0x2000] = 0;
|
||||
RAM[i + 0x3000] = 0;
|
||||
RAM[i + 0x4000] = 0;
|
||||
RAM[i + 0x5000] = 0;
|
||||
RAM[i + 0x6000] = 0;
|
||||
RAM[i + 0x7000] = 0;
|
||||
|
||||
RAM[i + 0x800] = 0xFF;
|
||||
RAM[i + 0x1800] = 0xFF;
|
||||
RAM[i + 0x2800] = 0xFF;
|
||||
RAM[i + 0x3800] = 0xFF;
|
||||
RAM[i + 0x4800] = 0xFF;
|
||||
RAM[i + 0x5800] = 0xFF;
|
||||
RAM[i + 0x6800] = 0xFF;
|
||||
RAM[i + 0x7800] = 0xFF;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public bool IsCGBMode() => is_GBC;
|
||||
|
@ -326,6 +364,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
double_speed = false;
|
||||
VRAM_Bank = 0;
|
||||
RAM_Bank = 1; // RAM bank always starts as 1 (even writing zero still sets 1)
|
||||
RAM_Bank_ret = 0; // return value can still be zero even though the bank itself cannot be
|
||||
delays_to_process = false;
|
||||
controller_delay_cd = 0;
|
||||
clear_counter = 0;
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
case 0xFF70:
|
||||
if (GBC_compat)
|
||||
{
|
||||
ret = (byte)RAM_Bank;
|
||||
ret = (byte)(0xF8 | RAM_Bank_ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
if (GB_bios_register == 0)
|
||||
{
|
||||
GB_bios_register = value;
|
||||
if (!GBC_compat) { ppu.pal_change_blocked = true; RAM_Bank = 1; }
|
||||
if (!GBC_compat) { ppu.pal_change_blocked = true; RAM_Bank = 1; RAM_Bank_ret = 0; }
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -453,6 +453,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
if (GBC_compat)
|
||||
{
|
||||
RAM_Bank = value & 7;
|
||||
RAM_Bank_ret = RAM_Bank;
|
||||
if (RAM_Bank == 0) { RAM_Bank = 1; }
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue