quicknes: add PRGROM and CHRROM domains (from the cart), and set corecomm and board information correctly

This commit is contained in:
goyuken 2014-01-07 01:52:00 +00:00
parent 983346af38
commit 2c568d9bef
5 changed files with 57 additions and 1 deletions

View File

@ -188,6 +188,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case "Famicom":
apu = new APU(this, apu, false);
ppu.region = PPU.Region.NTSC;
CoreComm.VsyncNum = 39375000;
CoreComm.VsyncDen = 655171;
cpuclockrate = 1789773;
cpu_sequence = cpu_sequence_NTSC;
break;

View File

@ -208,6 +208,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
/// <param name="val"></param>
[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
public static extern void qn_poke_prgbus(IntPtr e, int addr, byte val);
/// <summary>
/// get the mapper that's loaded
/// </summary>
/// <param name="e">Context</param>
/// <param name="number">recieves mapper number</param>
/// <returns>mapper name</returns>
[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr qn_get_mapper(IntPtr e, ref int number);
/// <summary>
/// handle "string error" as returned by some quicknes functions

View File

@ -64,6 +64,13 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
InitVideo();
InitAudio();
InitMemoryDomains();
int mapper = 0;
string mappername = Marshal.PtrToStringAnsi(LibQuickNES.qn_get_mapper(Context, ref mapper));
Console.WriteLine("QuickNES: Booted with Mapper #{0} \"{1}\"", mapper, mappername);
BoardName = mappername;
CoreComm.VsyncNum = 39375000;
CoreComm.VsyncDen = 655171;
}
catch
{
@ -153,7 +160,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
public string SystemId { get { return "NES"; } }
public bool DeterministicEmulation { get { return true; } }
public string BoardName { get { return null; } } // TODO
public string BoardName { get; private set; }
#region saveram

Binary file not shown.

View File

@ -226,6 +226,18 @@ EXPORT int qn_get_memory_area(Nes_Emu *e, int which, const void **data, int *siz
*writable = 0;
*name = "CIRAM (nametables)";
return 1;
case 4:
*data = e->cart()->prg();
*size = e->cart()->prg_size();
*writable = 0;
*name = "PRG ROM";
return 1;
case 5:
*data = e->cart()->chr();
*size = e->cart()->chr_size();
*writable = 0;
*name = "CHR VROM";
return 1;
}
}
@ -238,3 +250,30 @@ EXPORT void qn_poke_prgbus(Nes_Emu *e, int addr, unsigned char val)
{
e->poke_prg(addr & 0xffff, val);
}
EXPORT const char *qn_get_mapper(Nes_Emu *e, int *number)
{
int m = e->cart()->mapper_code();
if (number)
*number = m;
switch (m)
{
default: return "unknown";
case 0: return "nrom";
case 1: return "mmc1";
case 2: return "unrom";
case 3: return "cnrom";
case 4: return "mmc3";
case 7: return "aorom";
case 69: return "fme7";
case 5: return "mmc5";
case 19: return "namco106";
case 24: return "vrc6a";
case 26: return "vrc6b";
case 11: return "color_dreams";
case 34: return "nina1";
case 66: return "gnrom";
case 87: return "mapper_87";
case 232: return "quattro";
}
}