add a "BoardName" to IEmulator that an emulation core can use to return useful information about how the rom is being emulated. meant to be mostly for informative purposes; shouldn't rely on it for too much. implemented in GB and NES cores
This commit is contained in:
parent
228fa3869f
commit
0803adc32a
|
@ -21,6 +21,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
public GameInfo game;
|
||||
public string SystemId { get { return "C64"; } }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
// memory domains
|
||||
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
||||
private IList<MemoryDomain> memoryDomains;
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace BizHawk
|
|||
public string SystemId { get { return "A26"; } }
|
||||
public GameInfo game;
|
||||
|
||||
public string BoardName { get { return mapper.GetType().Name; } }
|
||||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
public IVideoProvider VideoProvider { get { return tia; } }
|
||||
public ISoundProvider SoundProvider { get { return dcfilter; } }
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace BizHawk.Emulation
|
|||
public string SystemId { get { return "A78"; } } // TODO 2600?
|
||||
public GameInfo game;
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
_frame++;
|
||||
|
|
|
@ -592,6 +592,8 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
|||
|
||||
public string SystemId { get { return "TI83"; } }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
private IList<MemoryDomain> memoryDomains;
|
||||
private const ushort RamSizeMask = 0x7FFF;
|
||||
|
||||
|
|
|
@ -244,6 +244,8 @@ namespace BizHawk.Emulation.Consoles.Coleco
|
|||
public IVideoProvider VideoProvider { get { return VDP; } }
|
||||
public ISoundProvider SoundProvider { get { return PSG; } }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public ISyncSoundProvider SyncSoundProvider { get { return null; } }
|
||||
public bool StartAsyncSound() { return true; }
|
||||
public void EndAsyncSound() { }
|
||||
|
|
|
@ -135,6 +135,8 @@ namespace BizHawk.Emulation.Consoles.Intellivision
|
|||
get { return "INTV"; }
|
||||
}
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
|
||||
|
||||
|
|
|
@ -67,6 +67,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
|
|||
public string SystemId { get { return "GBA"; } }
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
|
||||
// todo: information about the saveram type would be useful here.
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public void ResetFrameCounter()
|
||||
{
|
||||
Frame = 0;
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
comm.NominalHeight = 144;
|
||||
|
||||
ThrowExceptionForBadRom(romdata);
|
||||
BoardName = MapperName(romdata);
|
||||
|
||||
GambatteState = LibGambatte.gambatte_create();
|
||||
|
||||
|
@ -200,6 +201,34 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
FrameAdvancePost();
|
||||
}
|
||||
|
||||
static string MapperName(byte[] romdata)
|
||||
{
|
||||
switch (romdata[0x147])
|
||||
{
|
||||
case 0x00: return "Plain ROM"; // = PLAIN; break;
|
||||
case 0x01: return "MBC1 ROM"; // = MBC1; break;
|
||||
case 0x02: return "MBC1 ROM+RAM"; // = MBC1; break;
|
||||
case 0x03: return "MBC1 ROM+RAM+BATTERY"; // = MBC1; break;
|
||||
case 0x05: return "MBC2 ROM"; // = MBC2; break;
|
||||
case 0x06: return "MBC2 ROM+BATTERY"; // = MBC2; break;
|
||||
case 0x08: return "Plain ROM+RAM"; // = PLAIN; break;
|
||||
case 0x09: return "Plain ROM+RAM+BATTERY"; // = PLAIN; break;
|
||||
case 0x0F: return "MBC3 ROM+TIMER+BATTERY"; // = MBC3; break;
|
||||
case 0x10: return "MBC3 ROM+TIMER+RAM+BATTERY"; // = MBC3; break;
|
||||
case 0x11: return "MBC3 ROM"; // = MBC3; break;
|
||||
case 0x12: return "MBC3 ROM+RAM"; // = MBC3; break;
|
||||
case 0x13: return "MBC3 ROM+RAM+BATTERY"; // = MBC3; break;
|
||||
case 0x19: return "MBC5 ROM"; // = MBC5; break;
|
||||
case 0x1A: return "MBC5 ROM+RAM"; // = MBC5; break;
|
||||
case 0x1B: return "MBC5 ROM+RAM+BATTERY"; // = MBC5; break;
|
||||
case 0x1C: return "MBC5 ROM+RUMBLE"; // = MBC5; break;
|
||||
case 0x1D: return "MBC5 ROM+RUMBLE+RAM"; // = MBC5; break;
|
||||
case 0x1E: return "MBC5 ROM+RUMBLE+RAM+BATTERY"; // = MBC5; break;
|
||||
case 0xFF: return "HuC1 ROM+RAM+BATTERY"; // = HUC1; break;
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// throw exception with intelligible message on some kinds of bad rom
|
||||
/// </summary>
|
||||
|
@ -264,6 +293,8 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
get { return "GB"; }
|
||||
}
|
||||
|
||||
public string BoardName { get; private set; }
|
||||
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
|
||||
#region saveram
|
||||
|
|
|
@ -192,6 +192,8 @@ namespace BizHawk.Emulation.Consoles.GB
|
|||
public string SystemId { get { return "DGB"; } }
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
|
||||
public string BoardName { get { return L.BoardName + '|' + R.BoardName; } }
|
||||
|
||||
#region saveram
|
||||
|
||||
public byte[] ReadSaveRam()
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
|
|||
{
|
||||
public string SystemId { get { return "N64"; } }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
public byte[] rom;
|
||||
public GameInfo game;
|
||||
|
|
|
@ -324,6 +324,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
return board;
|
||||
}
|
||||
|
||||
public string BoardName { get { return board.GetType().Name; } }
|
||||
|
||||
void BoardSystemHardReset()
|
||||
{
|
||||
INESBoard newboard;
|
||||
|
|
|
@ -531,6 +531,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
public bool IsLagFrame { get; private set; }
|
||||
public string SystemId { get; private set; }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public bool DeterministicEmulation
|
||||
{
|
||||
get;
|
||||
|
|
|
@ -70,6 +70,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
Init(game, rom);
|
||||
}
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public PCEngine(CoreComm comm, GameInfo game, Disc disc, byte[] rom)
|
||||
{
|
||||
CoreComm = comm;
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace BizHawk.Emulation.Consoles.PSX
|
|||
public string SystemId { get { return "NULL"; } }
|
||||
public static readonly ControllerDefinition NullController = new ControllerDefinition { Name = "Null Controller" };
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
private int[] frameBuffer = new int[0];
|
||||
private Random rand = new Random();
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
|
|
@ -271,7 +271,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
public bool DeterministicEmulation { get { return true; } }
|
||||
public string SystemId { get { return "GEN"; } }
|
||||
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public void SaveStateText(TextWriter writer)
|
||||
{
|
||||
|
|
|
@ -374,6 +374,8 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
|
||||
public string SystemId { get { return "SMS"; } }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
string region = "Export";
|
||||
public string Region
|
||||
{
|
||||
|
|
|
@ -219,6 +219,8 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
public string SystemId { get { return "SAT"; } }
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
#region saveram
|
||||
|
||||
public byte[] ReadSaveRam()
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace BizHawk.Emulation.Consoles.Sony.PSP
|
|||
public bool BinarySaveStatesPreferred { get { return true; } }
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
PPSSPPDll.LogCB logcallback = null;
|
||||
Queue<string> debugmsgs = new Queue<string>();
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace BizHawk
|
|||
public string SystemId { get { return "NULL"; } }
|
||||
public static readonly ControllerDefinition NullController = new ControllerDefinition { Name = "Null Controller" };
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
private int[] frameBuffer = new int[256 * 192];
|
||||
private Random rand = new Random();
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
|
|
@ -37,6 +37,11 @@ namespace BizHawk
|
|||
/// <summary>if you want to set this, look in the emulator's constructor or Load() method</summary>
|
||||
bool DeterministicEmulation { get; }
|
||||
|
||||
/// <summary>
|
||||
/// identifying information about a "mapper" or similar capability. null if no such useful distinction can be drawn
|
||||
/// </summary>
|
||||
string BoardName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// return a copy of the saveram. editing it won't do you any good unless you later call StoreSaveRam()
|
||||
/// </summary>
|
||||
|
|
|
@ -1526,6 +1526,11 @@ namespace BizHawk.MultiClient
|
|||
Util.BytesToHexString(System.Security.Cryptography.MD5.Create().ComputeHash(rom.RomData)));
|
||||
}
|
||||
|
||||
if (Global.Emulator.BoardName != null)
|
||||
{
|
||||
Console.WriteLine("Core reported BoardID: \"{0}\"", Global.Emulator.BoardName);
|
||||
}
|
||||
|
||||
//restarts the lua console if a different rom is loaded.
|
||||
//im not really a fan of how this is done..
|
||||
if (Global.Config.RecentRoms.Empty || Global.Config.RecentRoms.GetRecentFileByPosition(0) != file.CanonicalFullPath)
|
||||
|
|
Loading…
Reference in New Issue