GBHawk: more bug fixes

This commit is contained in:
alyosha-tas 2019-10-01 18:36:39 -04:00
parent 5cfda44cbf
commit 9bfe61a9d4
5 changed files with 44 additions and 32 deletions

View File

@ -211,6 +211,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
SQ1_vol_state &= 0xF;
if ((value & 0xF8) == 0) { SQ1_enable = SQ1_swp_enable = false; SQ1_output = 0; }
if (!SQ1_enable && (SQ1_st_vol == 15)) { SQ1_output = 2; }
Audio_Regs[NR12] = value;
break;
case 0xFF13: // NR13 (freq low)
@ -301,6 +302,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
SQ2_vol_state &= 0xF;
if ((value & 0xF8) == 0) { SQ2_enable = false; SQ2_output = 0; }
if (!SQ2_enable && (SQ2_st_vol == 15)) { SQ2_output = 2; }
Audio_Regs[NR22] = value;
break;
case 0xFF18: // NR23 (freq low)
@ -429,6 +431,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
NOISE_vol_state &= 0xF;
if ((value & 0xF8) == 0) { NOISE_enable = false; NOISE_output = 0; }
if (!NOISE_enable && (NOISE_st_vol == 15)) { NOISE_output = 2; }
Audio_Regs[NR42] = value;
break;
case 0xFF22: // NR43 (shift)

View File

@ -19,8 +19,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public void StoreSaveRam(byte[] data)
{
Buffer.BlockCopy(data, 0, cart_RAM, 0, data.Length);
Console.WriteLine("loading SRAM here");
if (_syncSettings.Use_SRAM)
{
Buffer.BlockCopy(data, 0, cart_RAM, 0, data.Length);
Console.WriteLine("loading SRAM here");
}
}
public bool SaveRamModified

View File

@ -163,7 +163,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
Buffer.BlockCopy(rom, 0x100, header, 0, 0x50);
if (is_GBC && (header[0x43] == 0))
if (is_GBC && ((header[0x43] != 0x80) && (header[0x43] != 0xC0)))
{
ppu = new GBC_PPU_GB();
}

View File

@ -53,21 +53,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
public void StoreSaveRam(byte[] data)
{
if ((L.cart_RAM != null) && (R.cart_RAM == null))
if (linkSyncSettings.Use_SRAM)
{
Buffer.BlockCopy(data, 0, L.cart_RAM, 0, L.cart_RAM.Length);
}
else if ((R.cart_RAM != null) && (L.cart_RAM == null))
{
Buffer.BlockCopy(data, 0, R.cart_RAM, 0, R.cart_RAM.Length);
}
else if ((R.cart_RAM != null) && (L.cart_RAM != null))
{
Buffer.BlockCopy(data, 0, L.cart_RAM, 0, L.cart_RAM.Length);
Buffer.BlockCopy(data, L.cart_RAM.Length, R.cart_RAM, 0, R.cart_RAM.Length);
}
if ((L.cart_RAM != null) && (R.cart_RAM == null))
{
Buffer.BlockCopy(data, 0, L.cart_RAM, 0, L.cart_RAM.Length);
}
else if ((R.cart_RAM != null) && (L.cart_RAM == null))
{
Buffer.BlockCopy(data, 0, R.cart_RAM, 0, R.cart_RAM.Length);
}
else if ((R.cart_RAM != null) && (L.cart_RAM != null))
{
Buffer.BlockCopy(data, 0, L.cart_RAM, 0, L.cart_RAM.Length);
Buffer.BlockCopy(data, L.cart_RAM.Length, R.cart_RAM, 0, R.cart_RAM.Length);
}
Console.WriteLine("loading SRAM here");
Console.WriteLine("loading SRAM here");
}
}
public bool SaveRamModified

View File

@ -68,26 +68,29 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
public void StoreSaveRam(byte[] data)
{
int temp = 0;
if (L.cart_RAM != null)
if (Link3xSyncSettings.Use_SRAM)
{
Buffer.BlockCopy(data, temp, L.cart_RAM, 0, L.cart_RAM.Length);
temp += L.cart_RAM.Length;
}
int temp = 0;
if (C.cart_RAM != null)
{
Buffer.BlockCopy(data, temp, C.cart_RAM, 0, C.cart_RAM.Length);
temp += C.cart_RAM.Length;
}
if (L.cart_RAM != null)
{
Buffer.BlockCopy(data, temp, L.cart_RAM, 0, L.cart_RAM.Length);
temp += L.cart_RAM.Length;
}
if (R.cart_RAM != null)
{
Buffer.BlockCopy(data, temp, R.cart_RAM, 0, R.cart_RAM.Length);
}
if (C.cart_RAM != null)
{
Buffer.BlockCopy(data, temp, C.cart_RAM, 0, C.cart_RAM.Length);
temp += C.cart_RAM.Length;
}
Console.WriteLine("loading SRAM here");
if (R.cart_RAM != null)
{
Buffer.BlockCopy(data, temp, R.cart_RAM, 0, R.cart_RAM.Length);
}
Console.WriteLine("loading SRAM here");
}
}
public bool SaveRamModified