Mapper stuff
This commit is contained in:
parent
826ebba22f
commit
b18d50791e
|
@ -46,6 +46,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
//mixes the board's custom audio into the supplied sample buffer
|
||||
void ApplyCustomAudio(short[] samples);
|
||||
|
||||
MapperProperties InitialRegisterValues { get; set; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -72,6 +74,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
}
|
||||
|
||||
private MapperProperties _initialRegisterValues = new MapperProperties();
|
||||
public MapperProperties InitialRegisterValues { get { return _initialRegisterValues; } set { _initialRegisterValues = value; } }
|
||||
|
||||
public abstract bool Configure(NES.EDetectionOrigin origin);
|
||||
public virtual void ClockPPU() { }
|
||||
public virtual void ClockCPU() { }
|
||||
|
@ -343,6 +348,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
newboard = CreateBoardInstance(board.GetType());
|
||||
}
|
||||
newboard.Create(this);
|
||||
newboard.InitialRegisterValues = InitialMapperRegisterValues;
|
||||
newboard.Configure(origin);
|
||||
newboard.ROM = board.ROM;
|
||||
newboard.VROM = board.VROM;
|
||||
|
@ -432,7 +438,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
/// <summary>
|
||||
/// finds a board class which can handle the provided cart
|
||||
/// </summary>
|
||||
static Type FindBoard(CartInfo cart, EDetectionOrigin origin)
|
||||
static Type FindBoard(CartInfo cart, EDetectionOrigin origin, MapperProperties properties)
|
||||
{
|
||||
NES nes = new NES();
|
||||
nes.cart = cart;
|
||||
|
@ -448,6 +454,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
board.DisableConfigAsserts = true;
|
||||
|
||||
board.Create(nes);
|
||||
board.InitialRegisterValues = properties;
|
||||
if (board.Configure(origin))
|
||||
{
|
||||
return type;
|
||||
|
|
|
@ -102,7 +102,9 @@
|
|||
cheetahmen = true;
|
||||
}
|
||||
|
||||
prg_mode = false;
|
||||
prg_mode = bool.Parse(InitialRegisterValues["prg_mode"] ?? "false");
|
||||
prg_reg = int.Parse(InitialRegisterValues["prg_reg"] ?? "0");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Nintendo
|
||||
{
|
||||
|
|
|
@ -13,8 +13,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
static readonly bool USE_DATABASE = true;
|
||||
public RomStatus RomStatus;
|
||||
|
||||
public NES(CoreComm comm, GameInfo game, byte[] rom, byte[] fdsbios = null)
|
||||
public NES(CoreComm comm, GameInfo game, byte[] rom, byte[] fdsbios = null, Dictionary<string, string> boardProperties = null)
|
||||
{
|
||||
if (boardProperties != null)
|
||||
{
|
||||
InitialMapperRegisterValues.Set(boardProperties);
|
||||
}
|
||||
|
||||
CoreComm = comm;
|
||||
CoreComm.CpuTraceAvailable = true;
|
||||
BootGodDB.Initialize();
|
||||
|
@ -61,6 +66,39 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
return null;
|
||||
}
|
||||
|
||||
MapperProperties InitialMapperRegisterValues = new MapperProperties();
|
||||
|
||||
public class MapperProperties
|
||||
{
|
||||
private List<KeyValuePair<string, string>> _properties = new List<KeyValuePair<string, string>>();
|
||||
|
||||
public string this[string key]
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_properties.Any(x => x.Key == key))
|
||||
{
|
||||
return _properties.FirstOrDefault(x => x.Key == key).Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Set(Dictionary<string, string> values)
|
||||
{
|
||||
_properties.Clear();
|
||||
_properties.AddRange(values);
|
||||
}
|
||||
|
||||
public void Add(string key, string value)
|
||||
{
|
||||
_properties.Add(new KeyValuePair<string, string>(key, value));
|
||||
}
|
||||
}
|
||||
|
||||
class NESWatch
|
||||
{
|
||||
public enum EDomain
|
||||
|
@ -654,7 +692,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
//try spinning up a board with 8K wram and with 0K wram to see if one answers
|
||||
try
|
||||
{
|
||||
boardType = FindBoard(choice, origin);
|
||||
boardType = FindBoard(choice, origin, InitialMapperRegisterValues);
|
||||
}
|
||||
catch { }
|
||||
if (boardType == null)
|
||||
|
@ -663,7 +701,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
else if (choice.wram_size == 0) choice.wram_size = 8;
|
||||
try
|
||||
{
|
||||
boardType = FindBoard(choice, origin);
|
||||
boardType = FindBoard(choice, origin, InitialMapperRegisterValues);
|
||||
}
|
||||
catch { }
|
||||
if (boardType != null)
|
||||
|
@ -709,7 +747,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
game_name = choice.game.name;
|
||||
|
||||
//find a INESBoard to handle this
|
||||
boardType = FindBoard(choice, origin);
|
||||
boardType = FindBoard(choice, origin, InitialMapperRegisterValues);
|
||||
if (boardType == null)
|
||||
throw new Exception("No class implements the necessary board type: " + choice.board_type);
|
||||
|
||||
|
@ -733,6 +771,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
cart = choice;
|
||||
board.Create(this);
|
||||
board.InitialRegisterValues = InitialMapperRegisterValues;
|
||||
board.Configure(origin);
|
||||
|
||||
if (origin == EDetectionOrigin.BootGodDB)
|
||||
|
|
|
@ -572,7 +572,9 @@
|
|||
<Compile Include="tools\VirtualPads\VirtualPadA78Control.Designer.cs">
|
||||
<DependentUpon>VirtualPadA78Control.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\VirtualPadButton.cs" />
|
||||
<Compile Include="tools\VirtualPads\VirtualPadButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\VirtualPadC64Keyboard.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -1285,7 +1285,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
NES nes = new NES(nextComm, game, rom.FileData, bios)
|
||||
NES nes = new NES(nextComm, game, rom.FileData, bios, Global.MovieSession.Movie.Header.BoardProperties)
|
||||
{
|
||||
SoundOn = Global.Config.SoundEnabled,
|
||||
NTSC_FirstDrawLine = Global.Config.NTSC_NESTopLine,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
|
@ -15,6 +16,8 @@ namespace BizHawk.MultiClient
|
|||
public Dictionary<string, string> HeaderParams = new Dictionary<string, string>(); //Platform specific options go here
|
||||
public List<string> Comments = new List<string>();
|
||||
|
||||
public Dictionary<string, string> BoardProperties = new Dictionary<string, string>();
|
||||
|
||||
public const string EMULATIONVERSION = "emuVersion";
|
||||
public const string MOVIEVERSION = "MovieVersion";
|
||||
public const string PLATFORM = "Platform";
|
||||
|
@ -40,6 +43,9 @@ namespace BizHawk.MultiClient
|
|||
//Plugin Settings
|
||||
public const string VIDEOPLUGIN = "VideoPlugin";
|
||||
|
||||
//Board properties
|
||||
public const string BOARDPROPERTIES = "BoardProperty";
|
||||
|
||||
public static string MovieVersion = "BizHawk v0.0.1";
|
||||
|
||||
public static string MakeGUID()
|
||||
|
@ -112,6 +118,11 @@ namespace BizHawk.MultiClient
|
|||
sw.WriteLine(kvp.Key + " " + kvp.Value);
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in BoardProperties)
|
||||
{
|
||||
sw.WriteLine(BOARDPROPERTIES + " " + kvp.Key + " " + kvp.Value);
|
||||
}
|
||||
|
||||
foreach (string t in Comments)
|
||||
{
|
||||
sw.WriteLine(t);
|
||||
|
@ -209,6 +220,12 @@ namespace BizHawk.MultiClient
|
|||
line = ParseHeader(line, VIDEOPLUGIN);
|
||||
AddHeaderLine(VIDEOPLUGIN, line);
|
||||
}
|
||||
else if (line.Contains(BOARDPROPERTIES))
|
||||
{
|
||||
line = ParseHeader(line, BOARDPROPERTIES);
|
||||
string[] vals = line.Split(' ');
|
||||
BoardProperties.Add(vals[0], vals[1]);
|
||||
}
|
||||
else if (line.StartsWith("subtitle") || line.StartsWith("sub"))
|
||||
{
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue