Get the 63 in 1 version with another property

I'm not sure if this is faithful to the hardware, but by adding another mapper property I am able to get all 4 sets of games working.

One property sets the mode (1x[63 in 1] --or-- 3x[~20 in 1])

The other property picks between the 20 in 1 sets if the first property is in that mode.

This is the only consistent way I could find to get all 4 ROMs working. But they do all work as expected so I am confident enough in the result. It is possible the game expects something else to pick between the 20 in 1 sets, but I have no idea what it could be.
This commit is contained in:
alyosha-tas 2016-09-14 14:09:15 -04:00 committed by GitHub
parent a9675d4a8f
commit 50aa73272c
1 changed files with 25 additions and 9 deletions

View File

@ -1,17 +1,20 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
using System;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// Adapted from FCEUX src
public sealed class UNIF_BMC_Ghostbusters63in1 : NES.NESBoardBase
{
private ByteBuffer reg = new ByteBuffer(2);
private readonly int[] banks = new [] { 0, 0, 524288, 1048576 };
private readonly int[] banks = new [] { 0, 0, 524288, 1048576};
private int bank;
[MapperProp]
public int Ghostbusters63in1_chip;
public bool Ghostbusters63in1_63set=true;
[MapperProp]
public int Ghostbusters63in1_chip_22_select;
public override bool Configure(NES.EDetectionOrigin origin)
{
@ -32,7 +35,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
ser.Sync("reg", ref reg);
ser.Sync("bank", ref bank);
ser.Sync("bank", ref Ghostbusters63in1_chip);
ser.Sync("bank", ref Ghostbusters63in1_63set);
ser.Sync("bank", ref Ghostbusters63in1_chip_22_select);
base.SyncState(ser);
}
@ -40,9 +44,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
reg[addr & 1] = value;
//bank = ((reg[0] & 0x80) >> 7) | ((reg[1] & 1) << 1);
bank = ((reg[0] & 0x80) >> 7) | ((reg[1] & 1) << 1);
SetMirrorType(reg[0].Bit(6) ? EMirrorType.Vertical : EMirrorType.Horizontal);
Console.WriteLine(reg[0]);
Console.WriteLine(reg[1]);
}
public override byte ReadPRG(int addr)
@ -53,14 +59,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//}
if (reg[0].Bit(5))
{
var offset = (Ghostbusters63in1_chip % 3) * (1024 * 512);
{
var offset=0;
if (Ghostbusters63in1_63set)
offset = banks[bank];
else
offset = banks[Ghostbusters63in1_chip_22_select];
int b = (reg[0] & 0x1F);
return ROM[offset + (b << 14) + (addr & 0x3FFF)];
}
else
{
var offset = (Ghostbusters63in1_chip % 3) * (1024 * 512);
{
var offset = 0;
if (Ghostbusters63in1_63set)
offset = banks[bank];
else
offset = banks[Ghostbusters63in1_chip_22_select];
int b = ((reg[0] >> 1) & 0x0F);
return ROM[offset + (b << 15) + addr];
}