nes: vrc7: support ines without crc. in case someone ever makes a vrc7 homebrew. which they won't.
This commit is contained in:
parent
03f5b3ae96
commit
3a9fa9abb1
|
@ -33,7 +33,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
public override void SyncState(Serializer ser)
|
public override void SyncState(Serializer ser)
|
||||||
{
|
{
|
||||||
base.SyncState(ser);
|
base.SyncState(ser);
|
||||||
fm.SyncState(ser);
|
if (fm != null)
|
||||||
|
fm.SyncState(ser);
|
||||||
ser.Sync("prg_banks_8k", ref prg_banks_8k);
|
ser.Sync("prg_banks_8k", ref prg_banks_8k);
|
||||||
ser.Sync("chr_banks_1k", ref chr_banks_1k);
|
ser.Sync("chr_banks_1k", ref chr_banks_1k);
|
||||||
ser.Sync("irq_mode", ref irq_mode);
|
ser.Sync("irq_mode", ref irq_mode);
|
||||||
|
@ -56,22 +57,33 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
switch (Cart.board_type)
|
switch (Cart.board_type)
|
||||||
{
|
{
|
||||||
case "MAPPER085":
|
case "MAPPER085":
|
||||||
|
// presumably the only reason a homebrew would use mapper085 is for the sound?
|
||||||
|
// so initialize like lagrange point
|
||||||
|
remap = (addr) => ((addr & 0xF000) | ((addr & 0x30) >> 4));
|
||||||
|
fm = new Sound.YM2413(Sound.YM2413.ChipType.VRC7);
|
||||||
break;
|
break;
|
||||||
case "KONAMI-VRC-7":
|
case "KONAMI-VRC-7":
|
||||||
AssertPrg(128,512); AssertChr(0,128); AssertVram(0,8); AssertWram(0,8);
|
AssertPrg(128, 512); AssertChr(0, 128); AssertVram(0, 8); AssertWram(0, 8);
|
||||||
|
if (Cart.pcb == "353429")
|
||||||
|
{
|
||||||
|
//tiny toons 2
|
||||||
|
remap = (addr) => ((addr & 0xF000) | ((addr & 0x8) >> 3));
|
||||||
|
// there is no resonator or crystal on the board for the fm chip
|
||||||
|
fm = null;
|
||||||
|
}
|
||||||
|
else if (Cart.pcb == "352402")
|
||||||
|
{
|
||||||
|
//lagrange point
|
||||||
|
remap = (addr) => ((addr & 0xF000) | ((addr & 0x30) >> 4));
|
||||||
|
fm = new Sound.YM2413(Sound.YM2413.ChipType.VRC7);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new Exception("Unknown PCB type for VRC7");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cart.pcb == "353429")
|
|
||||||
//tiny toons 2
|
|
||||||
remap = (addr) => ((addr & 0xF000) | ((addr & 0x8) >> 3));
|
|
||||||
else if(Cart.pcb == "352402")
|
|
||||||
//lagrange point
|
|
||||||
remap = (addr) => ((addr & 0xF000) | ((addr & 0x30) >> 4));
|
|
||||||
else throw new Exception("Unknown PCB type for VRC7");
|
|
||||||
|
|
||||||
prg_bank_mask_8k = Cart.prg_size / 8 - 1;
|
prg_bank_mask_8k = Cart.prg_size / 8 - 1;
|
||||||
chr_bank_mask_1k = Cart.chr_size - 1;
|
chr_bank_mask_1k = Cart.chr_size - 1;
|
||||||
|
|
||||||
|
@ -79,8 +91,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
|
|
||||||
prg_banks_8k[3] = (byte)(0xFF & prg_bank_mask_8k);
|
prg_banks_8k[3] = (byte)(0xFF & prg_bank_mask_8k);
|
||||||
|
|
||||||
fm = new Sound.YM2413(Sound.YM2413.ChipType.VRC7);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public override byte ReadPRG(int addr)
|
public override byte ReadPRG(int addr)
|
||||||
|
@ -124,14 +134,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
|
|
||||||
public override void ApplyCustomAudio(short[] samples)
|
public override void ApplyCustomAudio(short[] samples)
|
||||||
{
|
{
|
||||||
short[] fmsamples = new short[samples.Length];
|
if (fm != null)
|
||||||
fm.GetSamples(fmsamples);
|
|
||||||
//naive mixing. need to study more
|
|
||||||
int len = samples.Length;
|
|
||||||
for (int i = 0; i < len; i++)
|
|
||||||
{
|
{
|
||||||
short fmsamp = fmsamples[i];
|
short[] fmsamples = new short[samples.Length];
|
||||||
samples[i] = (short)(samples[i] + fmsamp);
|
fm.GetSamples(fmsamples);
|
||||||
|
//naive mixing. need to study more
|
||||||
|
int len = samples.Length;
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
short fmsamp = fmsamples[i];
|
||||||
|
samples[i] = (short)(samples[i] + fmsamp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,11 +161,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
|
|
||||||
case 0x1001:
|
case 0x1001:
|
||||||
//sound address port
|
//sound address port
|
||||||
fm.RegisterLatch = value;
|
if (fm != null)
|
||||||
|
fm.RegisterLatch = value;
|
||||||
break;
|
break;
|
||||||
case 0x1003:
|
case 0x1003:
|
||||||
//sound data port
|
//sound data port
|
||||||
fm.Write(value);
|
if (fm != null)
|
||||||
|
fm.Write(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//a bit creepy to mask this for lagrange point which has no VROM, but the mask will be 0xFFFFFFFF so its OK
|
//a bit creepy to mask this for lagrange point which has no VROM, but the mask will be 0xFFFFFFFF so its OK
|
||||||
|
|
Loading…
Reference in New Issue