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