diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj
index 86c81c48da..63fb5728b3 100644
--- a/BizHawk.Emulation/BizHawk.Emulation.csproj
+++ b/BizHawk.Emulation/BizHawk.Emulation.csproj
@@ -146,6 +146,7 @@
+
diff --git a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt
index e4ad033789..5ec85418b9 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt
+++ b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt
@@ -69,7 +69,7 @@ Open bus and bus conflict emulation is not considered complete or thorough in an
079 NINA-06 Complete
080 Misc (J) Good
082 Misc (J) Complete
-085 VRC7 Decent (no OPL sound)
+085 VRC7 Decent (includes sound)
086 Misc (J) Decent (no sound)
087 Misc (J) Complete
088 Misc (J) Nothing
diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs
index c30e082cfe..18879e79f3 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/NES/APU.cs
@@ -1026,6 +1026,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
}
else
MyGetSamples(samples);
+
+ //mix in the cart's extra sound circuit
+ nes.board.ApplyCustomAudio(samples);
}
//static BinaryWriter bw = new BinaryWriter(new FileStream("d:\\out.raw",FileMode.Create,FileAccess.Write,FileShare.Read));
diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs
index b415591fb8..a058b7152e 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs
@@ -39,6 +39,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
byte[] ROM { get; set; }
byte[] VROM { get; set; }
void SyncState(Serializer ser);
+
+ //mixes the board's custom audio into the supplied sample buffer
+ void ApplyCustomAudio(short[] samples);
};
@@ -245,6 +248,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
}
protected void AssertBattery(bool has_bat) { Assert(Cart.wram_battery == has_bat); }
+ public virtual void ApplyCustomAudio(short[] samples) { }
}
//this will be used to track classes that implement boards
@@ -372,6 +376,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
cart.bad = true;
if (dict.ContainsKey("MMC3"))
cart.chips.Add(dict["MMC3"]);
+ if (dict.ContainsKey("PCB"))
+ cart.pcb = dict["PCB"];
return cart;
}
diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/VRC7.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/VRC7.cs
index 71ba87b944..82ccc15dc7 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/VRC7.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/VRC7.cs
@@ -13,6 +13,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
Func remap;
//state
+ BizHawk.Emulation.Sound.YM2413 fm = new Sound.YM2413();
+
ByteBuffer prg_banks_8k = new ByteBuffer(4);
ByteBuffer chr_banks_1k = new ByteBuffer(8);
bool irq_mode;
@@ -31,6 +33,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
+ fm.SyncState(ser);
ser.Sync("prg_banks_8k", ref prg_banks_8k);
ser.Sync("chr_banks_1k", ref chr_banks_1k);
ser.Sync("irq_mode", ref irq_mode);
@@ -65,7 +68,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
remap = (addr) => ((addr & 0xF000) | ((addr & 0x8) >> 3));
else if(Cart.pcb == "352402")
//lagrange point
- remap = (addr) => ((addr & 0xF000) | ((addr & 0x10) >> 4));
+ 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;
@@ -116,6 +119,18 @@ namespace BizHawk.Emulation.Consoles.Nintendo
else base.WritePPU(addr, value);
}
+ public override void ApplyCustomAudio(short[] samples)
+ {
+ short[] fmsamples = new short[samples.Length];
+ fm.GetSamples(fmsamples);
+ //naive mixing. need to study more
+ int len = samples.Length;
+ for (int i = 0; i < len; i++)
+ {
+ samples[i] = (short)((samples[i] >> 1) + (fmsamples[i] >> 1));
+ }
+ }
+
public override void WritePRG(int addr, byte value)
{
//Console.WriteLine(" mapping {0:X4} = {1:X2}", addr, value);
@@ -129,10 +144,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
case 0x1001:
//sound address port
+ fm.RegisterLatch = value;
break;
case 0x1003:
//sound data port
- //TODO - remap will break this
+ fm.Write(value);
break;
//a bit creepy to mask this for lagrange point which has no VROM, but the mask will be 0xFFFFFFFF so its OK
diff --git a/BizHawk.Emulation/Sound/YM2413.cs b/BizHawk.Emulation/Sound/YM2413.cs
index e37cef87b5..2856ccd02f 100644
--- a/BizHawk.Emulation/Sound/YM2413.cs
+++ b/BizHawk.Emulation/Sound/YM2413.cs
@@ -22,6 +22,12 @@ namespace BizHawk.Emulation.Sound
opll = OPLL_new(3579545, 44100);
}
+ public void SyncState(Serializer ser)
+ {
+ //TODO !! MUCH BETTER-NESS!
+ ser.Sync("RegisterLatch", ref RegisterLatch);
+ }
+
public void Reset()
{
OPLL_reset(opll);
diff --git a/BizHawk.MultiClient/output/gamedb.txt b/BizHawk.MultiClient/output/gamedb.txt
index d14506cf86..9c9edf52a0 100644
--- a/BizHawk.MultiClient/output/gamedb.txt
+++ b/BizHawk.MultiClient/output/gamedb.txt
@@ -73,6 +73,9 @@ sha1:8A5FD1061ADACDEABF422A2D2E555FF70749AE7C U Mississippi Satsujin Jiken (Alt)
;when they appear in bootgod's db then we can re-evaluate this category.
sha1:91CECCFCAC90E417E9AEE80E8F7B560A20EB33CC Ai Sensei No Oshiete - Watashi No Hoshi (J) NES board=IREM-G101;PRG=256;CHR=128;WRAM=8
+;games which might be thought to be good according to goodnes, but arent really
+sha1:C87E7E6A68DD9C7E24652CD2C7D390A14E8ADF04 B Lagrange Point NES board=KONAMI-VRC-7;PCB=352402
+
;;;;;;;;;;;;;;;;;;;-----------------------------------------------------------------------
;this is every game from goodNES which is clearly labeled as bad.
;well, it isnt very game yet. but we should make it every game, if we can! it would be a lot of games though