clean up core constructors - consistent parameter casing, and put them at the top of the class
This commit is contained in:
parent
c81a2fcc23
commit
1dae91e6a8
|
@ -16,11 +16,11 @@ namespace BizHawk.Emulation.Cores.Calculators
|
|||
public partial class TI83 : IEmulator, IVideoProvider, IStatable, IDebuggable, IInputPollable, ISettable<TI83.TI83Settings, object>
|
||||
{
|
||||
[CoreConstructor("TI83")]
|
||||
public TI83(CoreComm comm, GameInfo game, byte[] rom, object Settings)
|
||||
public TI83(CoreComm comm, GameInfo game, byte[] rom, object settings)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ServiceProvider = ser;
|
||||
PutSettings((TI83Settings)Settings ?? new TI83Settings());
|
||||
PutSettings((TI83Settings)settings ?? new TI83Settings());
|
||||
|
||||
CoreComm = comm;
|
||||
_cpu.ReadMemory = ReadMemory;
|
||||
|
|
|
@ -11,46 +11,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
"C64Hawk",
|
||||
"SaxxonPike",
|
||||
isPorted: false,
|
||||
isReleased: false
|
||||
)]
|
||||
isReleased: false)]
|
||||
[ServiceNotApplicable(typeof(ISettable<,>))]
|
||||
public sealed partial class C64 : IEmulator, IRegionable
|
||||
{
|
||||
#region Internals
|
||||
|
||||
[SaveState.DoNotSave]
|
||||
private readonly int _cyclesPerFrame;
|
||||
|
||||
[SaveState.DoNotSave]
|
||||
public GameInfo Game;
|
||||
|
||||
[SaveState.DoNotSave]
|
||||
public IEnumerable<byte[]> Roms { get; private set; }
|
||||
|
||||
[SaveState.DoNotSave]
|
||||
private static readonly ControllerDefinition C64ControllerDefinition = new ControllerDefinition
|
||||
{
|
||||
Name = "Commodore 64 Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button",
|
||||
"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button",
|
||||
"Key Left Arrow", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", "Key 0", "Key Plus", "Key Minus", "Key Pound", "Key Clear/Home", "Key Insert/Delete",
|
||||
"Key Control", "Key Q", "Key W", "Key E", "Key R", "Key T", "Key Y", "Key U", "Key I", "Key O", "Key P", "Key At", "Key Asterisk", "Key Up Arrow", "Key Restore",
|
||||
"Key Run/Stop", "Key Lck", "Key A", "Key S", "Key D", "Key F", "Key G", "Key H", "Key J", "Key K", "Key L", "Key Colon", "Key Semicolon", "Key Equal", "Key Return",
|
||||
"Key Commodore", "Key Left Shift", "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", "Key Comma", "Key Period", "Key Slash", "Key Right Shift", "Key Cursor Up/Down", "Key Cursor Left/Right",
|
||||
"Key Space",
|
||||
"Key F1", "Key F3", "Key F5", "Key F7"
|
||||
}
|
||||
};
|
||||
|
||||
[SaveState.SaveWithName("Board")]
|
||||
private Motherboard _board;
|
||||
|
||||
private int _frameCycles;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ctor
|
||||
|
||||
public C64(CoreComm comm, IEnumerable<byte[]> roms, object settings, object syncSettings)
|
||||
|
@ -95,6 +59,41 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
|
||||
#endregion
|
||||
|
||||
#region Internals
|
||||
|
||||
[SaveState.DoNotSave]
|
||||
private readonly int _cyclesPerFrame;
|
||||
|
||||
[SaveState.DoNotSave]
|
||||
public GameInfo Game;
|
||||
|
||||
[SaveState.DoNotSave]
|
||||
public IEnumerable<byte[]> Roms { get; private set; }
|
||||
|
||||
[SaveState.DoNotSave]
|
||||
private static readonly ControllerDefinition C64ControllerDefinition = new ControllerDefinition
|
||||
{
|
||||
Name = "Commodore 64 Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button",
|
||||
"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button",
|
||||
"Key Left Arrow", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", "Key 0", "Key Plus", "Key Minus", "Key Pound", "Key Clear/Home", "Key Insert/Delete",
|
||||
"Key Control", "Key Q", "Key W", "Key E", "Key R", "Key T", "Key Y", "Key U", "Key I", "Key O", "Key P", "Key At", "Key Asterisk", "Key Up Arrow", "Key Restore",
|
||||
"Key Run/Stop", "Key Lck", "Key A", "Key S", "Key D", "Key F", "Key G", "Key H", "Key J", "Key K", "Key L", "Key Colon", "Key Semicolon", "Key Equal", "Key Return",
|
||||
"Key Commodore", "Key Left Shift", "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", "Key Comma", "Key Period", "Key Slash", "Key Right Shift", "Key Cursor Up/Down", "Key Cursor Left/Right",
|
||||
"Key Space",
|
||||
"Key F1", "Key F3", "Key F5", "Key F7"
|
||||
}
|
||||
};
|
||||
|
||||
[SaveState.SaveWithName("Board")]
|
||||
private Motherboard _board;
|
||||
|
||||
private int _frameCycles;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
|
|||
}
|
||||
}
|
||||
|
||||
public Atari7800(CoreComm comm, GameInfo game, byte[] rom, string GameDBfn)
|
||||
public Atari7800(CoreComm comm, GameInfo game, byte[] rom, string gameDbFn)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ser.Register<IVideoProvider>(_avProvider);
|
||||
|
@ -57,7 +57,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
|
|||
|
||||
if (GameProgramLibrary.EMU7800DB == null)
|
||||
{
|
||||
GameProgramLibrary.EMU7800DB = new GameProgramLibrary(new StreamReader(GameDBfn));
|
||||
GameProgramLibrary.EMU7800DB = new GameProgramLibrary(new StreamReader(gameDbFn));
|
||||
}
|
||||
|
||||
if (rom.Length % 1024 == 128)
|
||||
|
|
|
@ -10,8 +10,6 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
[ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight), typeof(IRegionable))]
|
||||
public partial class Lynx : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IInputPollable
|
||||
{
|
||||
private IntPtr Core;
|
||||
|
||||
[CoreConstructor("Lynx")]
|
||||
public Lynx(byte[] file, GameInfo game, CoreComm comm)
|
||||
{
|
||||
|
@ -118,6 +116,8 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
}
|
||||
}
|
||||
|
||||
private IntPtr Core;
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
public void FrameAdvance(IController controller, bool render, bool rendersound = true)
|
||||
|
|
|
@ -13,24 +13,13 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
[ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))]
|
||||
public sealed partial class ColecoVision : IEmulator, IDebuggable, IInputPollable, IStatable, ISettable<ColecoVision.ColecoSettings, ColecoVision.ColecoSyncSettings>
|
||||
{
|
||||
// ROM
|
||||
private byte[] RomData;
|
||||
private byte[] BiosRom;
|
||||
|
||||
// Machine
|
||||
private Z80A Cpu;
|
||||
private TMS9918A VDP;
|
||||
|
||||
private byte[] Ram = new byte[1024];
|
||||
private readonly TraceBuffer Tracer = new TraceBuffer();
|
||||
|
||||
[CoreConstructor("Coleco")]
|
||||
public ColecoVision(CoreComm comm, GameInfo game, byte[] rom, object SyncSettings)
|
||||
public ColecoVision(CoreComm comm, GameInfo game, byte[] rom, object syncSettings)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
MemoryCallbacks = new MemoryCallbackSystem();
|
||||
CoreComm = comm;
|
||||
_syncSettings = (ColecoSyncSettings)SyncSettings ?? new ColecoSyncSettings();
|
||||
_syncSettings = (ColecoSyncSettings)syncSettings ?? new ColecoSyncSettings();
|
||||
bool skipbios = _syncSettings.SkipBiosIntro;
|
||||
|
||||
Cpu = new Z80A
|
||||
|
@ -70,6 +59,17 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
serviceProvider.Register<ITraceable>(Tracer);
|
||||
}
|
||||
|
||||
// ROM
|
||||
private byte[] RomData;
|
||||
private byte[] BiosRom;
|
||||
|
||||
// Machine
|
||||
private Z80A Cpu;
|
||||
private TMS9918A VDP;
|
||||
|
||||
private byte[] Ram = new byte[1024];
|
||||
private readonly TraceBuffer Tracer = new TraceBuffer();
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
public ControllerDefinition ControllerDefinition => ControllerDeck.Definition;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
IBoardInfo, IDebuggable, ISettable<Intellivision.IntvSettings, Intellivision.IntvSyncSettings>
|
||||
{
|
||||
[CoreConstructor("INTV")]
|
||||
public Intellivision(CoreComm comm, GameInfo game, byte[] rom, object Settings, object SyncSettings)
|
||||
public Intellivision(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ServiceProvider = ser;
|
||||
|
@ -24,8 +24,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
|
||||
_rom = rom;
|
||||
|
||||
_settings = (IntvSettings)Settings ?? new IntvSettings();
|
||||
_syncSettings = (IntvSyncSettings)SyncSettings ?? new IntvSyncSettings();
|
||||
_settings = (IntvSettings)settings ?? new IntvSettings();
|
||||
_syncSettings = (IntvSyncSettings)syncSettings ?? new IntvSyncSettings();
|
||||
|
||||
_controllerDeck = new IntellivisionControllerDeck(_syncSettings.Port1, _syncSettings.Port2);
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
public partial class VBANext : IEmulator, IVideoProvider, ISoundProvider, IInputPollable,
|
||||
IGBAGPUViewable, ISaveRam, IStatable, IDebuggable, ISettable<object, VBANext.SyncSettings>
|
||||
{
|
||||
IntPtr Core;
|
||||
|
||||
[CoreConstructor("GBA")]
|
||||
public VBANext(byte[] file, CoreComm comm, GameInfo game, bool deterministic, object syncsettings)
|
||||
{
|
||||
|
@ -93,6 +91,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
}
|
||||
}
|
||||
|
||||
IntPtr Core;
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
public void FrameAdvance(IController controller, bool render, bool rendersound = true)
|
||||
|
|
|
@ -19,6 +19,104 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
public partial class Gameboy : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IInputPollable, ICodeDataLogger,
|
||||
IBoardInfo, IDebuggable, ISettable<Gameboy.GambatteSettings, Gameboy.GambatteSyncSettings>
|
||||
{
|
||||
[CoreConstructor("GB", "GBC")]
|
||||
public Gameboy(CoreComm comm, GameInfo game, byte[] file, object settings, object syncSettings, bool deterministic)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ser.Register<IDisassemblable>(new GBDisassembler());
|
||||
ServiceProvider = ser;
|
||||
Tracer = new TraceBuffer
|
||||
{
|
||||
Header = "Z80: PC, opcode, registers (A, B, C, D, E, F, H, L, LY, SP, CY)"
|
||||
};
|
||||
ser.Register<ITraceable>(Tracer);
|
||||
InitMemoryCallbacks();
|
||||
CoreComm = comm;
|
||||
|
||||
comm.RomStatusAnnotation = null;
|
||||
comm.RomStatusDetails = null;
|
||||
comm.NominalWidth = 160;
|
||||
comm.NominalHeight = 144;
|
||||
|
||||
ThrowExceptionForBadRom(file);
|
||||
BoardName = MapperName(file);
|
||||
|
||||
DeterministicEmulation = deterministic;
|
||||
|
||||
GambatteState = LibGambatte.gambatte_create();
|
||||
|
||||
if (GambatteState == IntPtr.Zero)
|
||||
{
|
||||
throw new InvalidOperationException("gambatte_create() returned null???");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_syncSettings = (GambatteSyncSettings)syncSettings ?? new GambatteSyncSettings();
|
||||
|
||||
// copy over non-loadflag syncsettings now; they won't take effect if changed later
|
||||
zerotime = (uint)_syncSettings.RTCInitialTime;
|
||||
|
||||
real_rtc_time = !DeterministicEmulation && _syncSettings.RealTimeRTC;
|
||||
|
||||
LibGambatte.LoadFlags flags = 0;
|
||||
|
||||
if (_syncSettings.ForceDMG)
|
||||
{
|
||||
flags |= LibGambatte.LoadFlags.FORCE_DMG;
|
||||
}
|
||||
|
||||
if (_syncSettings.GBACGB)
|
||||
{
|
||||
flags |= LibGambatte.LoadFlags.GBA_CGB;
|
||||
}
|
||||
|
||||
if (_syncSettings.MulticartCompat)
|
||||
{
|
||||
flags |= LibGambatte.LoadFlags.MULTICART_COMPAT;
|
||||
}
|
||||
|
||||
if (LibGambatte.gambatte_load(GambatteState, file, (uint)file.Length, GetCurrentTime(), flags) != 0)
|
||||
{
|
||||
throw new InvalidOperationException("gambatte_load() returned non-zero (is this not a gb or gbc rom?)");
|
||||
}
|
||||
|
||||
// set real default colors (before anyone mucks with them at all)
|
||||
PutSettings((GambatteSettings)settings ?? new GambatteSettings());
|
||||
|
||||
InitSound();
|
||||
|
||||
Frame = 0;
|
||||
LagCount = 0;
|
||||
IsLagFrame = false;
|
||||
|
||||
InputCallback = new LibGambatte.InputGetter(ControllerCallback);
|
||||
|
||||
LibGambatte.gambatte_setinputgetter(GambatteState, InputCallback);
|
||||
|
||||
InitMemoryDomains();
|
||||
|
||||
CoreComm.RomStatusDetails = $"{game.Name}\r\nSHA1:{file.HashSHA1()}\r\nMD5:{file.HashMD5()}\r\n";
|
||||
|
||||
byte[] buff = new byte[32];
|
||||
LibGambatte.gambatte_romtitle(GambatteState, buff);
|
||||
string romname = System.Text.Encoding.ASCII.GetString(buff);
|
||||
Console.WriteLine("Core reported rom name: {0}", romname);
|
||||
|
||||
TimeCallback = new LibGambatte.RTCCallback(GetCurrentTime);
|
||||
LibGambatte.gambatte_setrtccallback(GambatteState, TimeCallback);
|
||||
|
||||
_cdCallback = new LibGambatte.CDCallback(CDCallbackProc);
|
||||
|
||||
NewSaveCoreSetBuff();
|
||||
}
|
||||
catch
|
||||
{
|
||||
Dispose();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the nominal length of one frame
|
||||
/// </summary>
|
||||
|
@ -90,104 +188,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
#endregion
|
||||
|
||||
[CoreConstructor("GB", "GBC")]
|
||||
public Gameboy(CoreComm comm, GameInfo game, byte[] file, object Settings, object SyncSettings, bool deterministic)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ser.Register<IDisassemblable>(new GBDisassembler());
|
||||
ServiceProvider = ser;
|
||||
Tracer = new TraceBuffer
|
||||
{
|
||||
Header = "Z80: PC, opcode, registers (A, B, C, D, E, F, H, L, LY, SP, CY)"
|
||||
};
|
||||
ser.Register<ITraceable>(Tracer);
|
||||
InitMemoryCallbacks();
|
||||
CoreComm = comm;
|
||||
|
||||
comm.RomStatusAnnotation = null;
|
||||
comm.RomStatusDetails = null;
|
||||
comm.NominalWidth = 160;
|
||||
comm.NominalHeight = 144;
|
||||
|
||||
ThrowExceptionForBadRom(file);
|
||||
BoardName = MapperName(file);
|
||||
|
||||
DeterministicEmulation = deterministic;
|
||||
|
||||
GambatteState = LibGambatte.gambatte_create();
|
||||
|
||||
if (GambatteState == IntPtr.Zero)
|
||||
{
|
||||
throw new InvalidOperationException("gambatte_create() returned null???");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_syncSettings = (GambatteSyncSettings)SyncSettings ?? new GambatteSyncSettings();
|
||||
|
||||
// copy over non-loadflag syncsettings now; they won't take effect if changed later
|
||||
zerotime = (uint)_syncSettings.RTCInitialTime;
|
||||
|
||||
real_rtc_time = !DeterministicEmulation && _syncSettings.RealTimeRTC;
|
||||
|
||||
LibGambatte.LoadFlags flags = 0;
|
||||
|
||||
if (_syncSettings.ForceDMG)
|
||||
{
|
||||
flags |= LibGambatte.LoadFlags.FORCE_DMG;
|
||||
}
|
||||
|
||||
if (_syncSettings.GBACGB)
|
||||
{
|
||||
flags |= LibGambatte.LoadFlags.GBA_CGB;
|
||||
}
|
||||
|
||||
if (_syncSettings.MulticartCompat)
|
||||
{
|
||||
flags |= LibGambatte.LoadFlags.MULTICART_COMPAT;
|
||||
}
|
||||
|
||||
if (LibGambatte.gambatte_load(GambatteState, file, (uint)file.Length, GetCurrentTime(), flags) != 0)
|
||||
{
|
||||
throw new InvalidOperationException("gambatte_load() returned non-zero (is this not a gb or gbc rom?)");
|
||||
}
|
||||
|
||||
// set real default colors (before anyone mucks with them at all)
|
||||
PutSettings((GambatteSettings)Settings ?? new GambatteSettings());
|
||||
|
||||
InitSound();
|
||||
|
||||
Frame = 0;
|
||||
LagCount = 0;
|
||||
IsLagFrame = false;
|
||||
|
||||
InputCallback = new LibGambatte.InputGetter(ControllerCallback);
|
||||
|
||||
LibGambatte.gambatte_setinputgetter(GambatteState, InputCallback);
|
||||
|
||||
InitMemoryDomains();
|
||||
|
||||
CoreComm.RomStatusDetails = $"{game.Name}\r\nSHA1:{file.HashSHA1()}\r\nMD5:{file.HashMD5()}\r\n";
|
||||
|
||||
byte[] buff = new byte[32];
|
||||
LibGambatte.gambatte_romtitle(GambatteState, buff);
|
||||
string romname = System.Text.Encoding.ASCII.GetString(buff);
|
||||
Console.WriteLine("Core reported rom name: {0}", romname);
|
||||
|
||||
TimeCallback = new LibGambatte.RTCCallback(GetCurrentTime);
|
||||
LibGambatte.gambatte_setrtccallback(GambatteState, TimeCallback);
|
||||
|
||||
_cdCallback = new LibGambatte.CDCallback(CDCallbackProc);
|
||||
|
||||
NewSaveCoreSetBuff();
|
||||
}
|
||||
catch
|
||||
{
|
||||
Dispose();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#region ALL SAVESTATEABLE STATE GOES HERE
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
||||
{
|
||||
|
@ -12,15 +11,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
public partial class GambatteLink : IEmulator, IVideoProvider, ISoundProvider, IInputPollable, ISaveRam, IStatable, ILinkable,
|
||||
IBoardInfo, IDebuggable, ISettable<GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings>, ICodeDataLogger
|
||||
{
|
||||
public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object Settings, object SyncSettings, bool deterministic)
|
||||
public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object settings, object syncSettings, bool deterministic)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
GambatteLinkSettings settings = (GambatteLinkSettings)Settings ?? new GambatteLinkSettings();
|
||||
GambatteLinkSyncSettings syncSettings = (GambatteLinkSyncSettings)SyncSettings ?? new GambatteLinkSyncSettings();
|
||||
GambatteLinkSettings linkSettings = (GambatteLinkSettings)settings ?? new GambatteLinkSettings();
|
||||
GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)syncSettings ?? new GambatteLinkSyncSettings();
|
||||
|
||||
CoreComm = comm;
|
||||
L = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), leftinfo, leftrom, settings.L, syncSettings.L, deterministic);
|
||||
R = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), rightinfo, rightrom, settings.R, syncSettings.R, deterministic);
|
||||
L = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), leftinfo, leftrom, linkSettings.L, linkSyncSettings.L, deterministic);
|
||||
R = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), rightinfo, rightrom, linkSettings.R, linkSyncSettings.R, deterministic);
|
||||
|
||||
// connect link cable
|
||||
LibGambatte.gambatte_linkstatus(L.GambatteState, 259);
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
using BizHawk.Emulation.Cores.Nintendo.N64.NativeApi;
|
||||
|
@ -17,32 +14,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
isReleased: true,
|
||||
portedVersion: "2.0",
|
||||
portedUrl: "https://code.google.com/p/mupen64plus/",
|
||||
singleInstance: true
|
||||
)]
|
||||
singleInstance: true)]
|
||||
[ServiceNotApplicable(typeof(IDriveLight))]
|
||||
public partial class N64 : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IDisassemblable, IRegionable,
|
||||
ISettable<N64Settings, N64SyncSettings>
|
||||
{
|
||||
private readonly N64Input _inputProvider;
|
||||
private readonly N64VideoProvider _videoProvider;
|
||||
private readonly N64Audio _audioProvider;
|
||||
|
||||
private readonly EventWaitHandle _pendingThreadEvent = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||
private readonly EventWaitHandle _completeThreadEvent = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||
|
||||
private mupen64plusApi api; // mupen64plus DLL Api
|
||||
|
||||
private N64SyncSettings _syncSettings;
|
||||
private N64Settings _settings;
|
||||
|
||||
private bool _pendingThreadTerminate;
|
||||
|
||||
private DisplayType _display_type = DisplayType.NTSC;
|
||||
|
||||
private Action _pendingThreadAction;
|
||||
|
||||
private bool _disableExpansionSlot = true;
|
||||
|
||||
/// <summary>
|
||||
/// Create mupen64plus Emulator
|
||||
/// </summary>
|
||||
|
@ -171,6 +147,26 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
SetControllerButtons();
|
||||
}
|
||||
|
||||
private readonly N64Input _inputProvider;
|
||||
private readonly N64VideoProvider _videoProvider;
|
||||
private readonly N64Audio _audioProvider;
|
||||
|
||||
private readonly EventWaitHandle _pendingThreadEvent = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||
private readonly EventWaitHandle _completeThreadEvent = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||
|
||||
private mupen64plusApi api; // mupen64plus DLL Api
|
||||
|
||||
private N64SyncSettings _syncSettings;
|
||||
private N64Settings _settings;
|
||||
|
||||
private bool _pendingThreadTerminate;
|
||||
|
||||
private DisplayType _display_type = DisplayType.NTSC;
|
||||
|
||||
private Action _pendingThreadAction;
|
||||
|
||||
private bool _disableExpansionSlot = true;
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
public bool UsingExpansionSlot
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
//TODO - redo all timekeeping in terms of master clock
|
||||
|
@ -16,16 +13,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
"NesHawk",
|
||||
"zeromus, natt, alyosha, adelikat",
|
||||
isPorted: false,
|
||||
isReleased: true
|
||||
)]
|
||||
isReleased: true)]
|
||||
public partial class NES : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable,
|
||||
IBoardInfo, ISettable<NES.NESSettings, NES.NESSyncSettings>
|
||||
{
|
||||
static readonly bool USE_DATABASE = true;
|
||||
public RomStatus RomStatus;
|
||||
|
||||
[CoreConstructor("NES")]
|
||||
public NES(CoreComm comm, GameInfo game, byte[] rom, object Settings, object SyncSettings)
|
||||
public NES(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ServiceProvider = ser;
|
||||
|
@ -39,8 +32,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
fdsbios = tmp;
|
||||
}
|
||||
|
||||
this.SyncSettings = (NESSyncSettings)SyncSettings ?? new NESSyncSettings();
|
||||
this.ControllerSettings = this.SyncSettings.Controls;
|
||||
SyncSettings = (NESSyncSettings)syncSettings ?? new NESSyncSettings();
|
||||
ControllerSettings = SyncSettings.Controls;
|
||||
CoreComm = comm;
|
||||
|
||||
MemoryCallbacks = new MemoryCallbackSystem();
|
||||
|
@ -55,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
// expects this to be set.
|
||||
RomStatus = game.Status;
|
||||
}
|
||||
PutSettings((NESSettings)Settings ?? new NESSettings());
|
||||
PutSettings((NESSettings)settings ?? new NESSettings());
|
||||
|
||||
// we need to put this here because the line directly above will overwrite palette intialization anywhere else
|
||||
// TODO: What if settings are later loaded?
|
||||
|
@ -81,6 +74,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
}
|
||||
}
|
||||
|
||||
static readonly bool USE_DATABASE = true;
|
||||
public RomStatus RomStatus;
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
private NES()
|
||||
|
|
|
@ -14,16 +14,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
isPorted: true,
|
||||
isReleased: true,
|
||||
portedVersion: "0.7.0",
|
||||
portedUrl: "https://github.com/kode54/QuickNES"
|
||||
)]
|
||||
portedUrl: "https://github.com/kode54/QuickNES")]
|
||||
[ServiceNotApplicable(typeof(IDriveLight))]
|
||||
public partial class QuickNES : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IInputPollable, IBoardInfo,
|
||||
IStatable, IDebuggable, ISettable<QuickNES.QuickNESSettings, QuickNES.QuickNESSyncSettings>, Cores.Nintendo.NES.INESPPUViewable
|
||||
{
|
||||
static readonly LibQuickNES QN;
|
||||
static readonly DynamicLibraryImportResolver Resolver;
|
||||
|
||||
|
||||
static QuickNES()
|
||||
{
|
||||
Resolver = new DynamicLibraryImportResolver(LibQuickNES.dllname);
|
||||
|
@ -31,7 +26,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
}
|
||||
|
||||
[CoreConstructor("NES")]
|
||||
public QuickNES(CoreComm comm, byte[] file, object Settings, object SyncSettings)
|
||||
public QuickNES(CoreComm comm, byte[] file, object settings, object syncSettings)
|
||||
{
|
||||
using (FP.Save())
|
||||
{
|
||||
|
@ -40,7 +35,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
|
||||
Context = QN.qn_new();
|
||||
if (Context == IntPtr.Zero)
|
||||
{
|
||||
throw new InvalidOperationException("qn_new() returned NULL");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -56,9 +54,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
string mappername = Marshal.PtrToStringAnsi(QN.qn_get_mapper(Context, ref mapper));
|
||||
Console.WriteLine("QuickNES: Booted with Mapper #{0} \"{1}\"", mapper, mappername);
|
||||
BoardName = mappername;
|
||||
PutSettings((QuickNESSettings)Settings ?? new QuickNESSettings());
|
||||
PutSettings((QuickNESSettings)settings ?? new QuickNESSettings());
|
||||
|
||||
_syncSettings = (QuickNESSyncSettings)SyncSettings ?? new QuickNESSyncSettings();
|
||||
_syncSettings = (QuickNESSyncSettings)syncSettings ?? new QuickNESSyncSettings();
|
||||
_syncSettingsNext = _syncSettings.Clone();
|
||||
|
||||
SetControllerDefinition();
|
||||
|
@ -74,6 +72,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
}
|
||||
}
|
||||
|
||||
static readonly LibQuickNES QN;
|
||||
static readonly DynamicLibraryImportResolver Resolver;
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
#region FPU precision
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
public unsafe partial class LibsnesCore : IEmulator, IVideoProvider, ISaveRam, IStatable, IInputPollable, IRegionable, ICodeDataLogger,
|
||||
IDebuggable, ISettable<LibsnesCore.SnesSettings, LibsnesCore.SnesSyncSettings>
|
||||
{
|
||||
public LibsnesCore(GameInfo game, byte[] romData, bool deterministicEmulation, byte[] xmlData, CoreComm comm, object Settings, object SyncSettings)
|
||||
public LibsnesCore(GameInfo game, byte[] romData, bool deterministicEmulation, byte[] xmlData, CoreComm comm, object settings, object syncSettings)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ServiceProvider = ser;
|
||||
|
@ -56,8 +56,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
game.FirmwareHash = sgbRomData.HashSHA1();
|
||||
}
|
||||
|
||||
_settings = (SnesSettings)Settings ?? new SnesSettings();
|
||||
_syncSettings = (SnesSyncSettings)SyncSettings ?? new SnesSyncSettings();
|
||||
_settings = (SnesSettings)settings ?? new SnesSettings();
|
||||
_syncSettings = (SnesSyncSettings)syncSettings ?? new SnesSyncSettings();
|
||||
|
||||
Api = new LibsnesApi(GetDllPath())
|
||||
{
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
||||
|
@ -12,6 +7,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
|||
[ServiceNotApplicable(typeof(IDriveLight))]
|
||||
public class Snes9x : IEmulator, IVideoProvider, ISoundProvider
|
||||
{
|
||||
[CoreConstructor("SNES")]
|
||||
public Snes9x(CoreComm comm, byte[] rom)
|
||||
{
|
||||
if (!LibSnes9x.debug_init(rom, rom.Length))
|
||||
throw new Exception();
|
||||
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
CoreComm = comm;
|
||||
}
|
||||
|
||||
#region controller
|
||||
|
||||
public ControllerDefinition ControllerDefinition
|
||||
|
@ -25,16 +30,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
|||
{
|
||||
}
|
||||
|
||||
[CoreConstructor("SNES")]
|
||||
public Snes9x(CoreComm comm, byte[] rom)
|
||||
{
|
||||
if (!LibSnes9x.debug_init(rom, rom.Length))
|
||||
throw new Exception();
|
||||
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
CoreComm = comm;
|
||||
}
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
public void FrameAdvance(IController controller, bool render, bool rendersound = true)
|
||||
|
|
|
@ -20,9 +20,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
IDebuggable, ISettable<PCEngine.PCESettings, PCEngine.PCESyncSettings>, IDriveLight, ICodeDataLogger
|
||||
{
|
||||
[CoreConstructor("PCE", "SGX")]
|
||||
public PCEngine(CoreComm comm, GameInfo game, byte[] rom, object Settings, object syncSettings)
|
||||
public PCEngine(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
|
||||
{
|
||||
|
||||
MemoryCallbacks = new MemoryCallbackSystem();
|
||||
CoreComm = comm;
|
||||
|
||||
|
@ -39,7 +38,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
break;
|
||||
}
|
||||
|
||||
this.Settings = (PCESettings)Settings ?? new PCESettings();
|
||||
Settings = (PCESettings)settings ?? new PCESettings();
|
||||
_syncSettings = (PCESyncSettings)syncSettings ?? new PCESyncSettings();
|
||||
Init(game, rom);
|
||||
SetControllerButtons();
|
||||
|
|
|
@ -21,47 +21,11 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
"SMSHawk",
|
||||
"Vecna",
|
||||
isPorted: false,
|
||||
isReleased: true
|
||||
)]
|
||||
isReleased: true)]
|
||||
[ServiceNotApplicable(typeof(IDriveLight))]
|
||||
public sealed partial class SMS : IEmulator, ISaveRam, IStatable, IInputPollable, IRegionable,
|
||||
IDebuggable, ISettable<SMS.SMSSettings, SMS.SMSSyncSettings>, ICodeDataLogger
|
||||
{
|
||||
// Constants
|
||||
private const int BankSize = 16384;
|
||||
|
||||
// ROM
|
||||
private byte[] RomData;
|
||||
private byte RomBank0, RomBank1, RomBank2, RomBank3;
|
||||
private byte RomBanks;
|
||||
private byte[] BiosRom;
|
||||
|
||||
// Machine resources
|
||||
private Z80A Cpu;
|
||||
private byte[] SystemRam;
|
||||
public VDP Vdp;
|
||||
private SN76489 PSG;
|
||||
private YM2413 YM2413;
|
||||
public bool IsGameGear { get; set; }
|
||||
public bool IsSG1000 { get; set; }
|
||||
|
||||
private bool HasYM2413 = false;
|
||||
private IController _controller;
|
||||
|
||||
private int frame = 0;
|
||||
|
||||
public int Frame { get { return frame; } set { frame = value; } }
|
||||
|
||||
private byte Port01 = 0xFF;
|
||||
private byte Port02 = 0xFF;
|
||||
private byte Port3E = 0xAF;
|
||||
private byte Port3F = 0xFF;
|
||||
|
||||
private byte ForceStereoByte = 0xAD;
|
||||
private bool IsGame3D = false;
|
||||
|
||||
public DisplayType Region { get; set; }
|
||||
|
||||
[CoreConstructor("SMS", "SG", "GG")]
|
||||
public SMS(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
|
||||
{
|
||||
|
@ -208,6 +172,42 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
Vdp.ProcessOverscan();
|
||||
}
|
||||
|
||||
// Constants
|
||||
private const int BankSize = 16384;
|
||||
|
||||
// ROM
|
||||
private byte[] RomData;
|
||||
private byte RomBank0, RomBank1, RomBank2, RomBank3;
|
||||
private byte RomBanks;
|
||||
private byte[] BiosRom;
|
||||
|
||||
// Machine resources
|
||||
private Z80A Cpu;
|
||||
private byte[] SystemRam;
|
||||
public VDP Vdp;
|
||||
private SN76489 PSG;
|
||||
private YM2413 YM2413;
|
||||
public bool IsGameGear { get; set; }
|
||||
public bool IsSG1000 { get; set; }
|
||||
|
||||
private bool HasYM2413 = false;
|
||||
private IController _controller;
|
||||
|
||||
private int frame = 0;
|
||||
|
||||
public int Frame { get { return frame; } set { frame = value; } }
|
||||
|
||||
private byte Port01 = 0xFF;
|
||||
private byte Port02 = 0xFF;
|
||||
private byte Port3E = 0xAF;
|
||||
private byte Port3F = 0xFF;
|
||||
|
||||
private byte ForceStereoByte = 0xAD;
|
||||
private bool IsGame3D = false;
|
||||
|
||||
public DisplayType Region { get; set; }
|
||||
|
||||
|
||||
private ITraceable Tracer { get; set; }
|
||||
|
||||
string DetermineRegion(string gameRegion)
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.DiscSystem;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Sega.Saturn
|
||||
{
|
||||
[CoreAttributes(
|
||||
|
@ -22,16 +13,44 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
isReleased: true,
|
||||
portedVersion: "9.12",
|
||||
portedUrl: "http://yabause.org",
|
||||
singleInstance: true
|
||||
)]
|
||||
singleInstance: true)]
|
||||
public partial class Yabause : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IInputPollable,
|
||||
ISettable<object, Yabause.SaturnSyncSettings>, IDriveLight
|
||||
{
|
||||
public Yabause(CoreComm coreComm, Disc cd, object syncSettings)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
byte[] bios = coreComm.CoreFileProvider.GetFirmware("SAT", "J", true, "Saturn BIOS is required.");
|
||||
coreComm.RomStatusDetails = string.Format("Disk partial hash:{0}", new DiscHasher(cd).OldHash());
|
||||
CoreComm = coreComm;
|
||||
CD = cd;
|
||||
DiscSectorReader = new DiscSectorReader(cd);
|
||||
|
||||
SyncSettings = (SaturnSyncSettings)syncSettings ?? new SaturnSyncSettings();
|
||||
|
||||
if (SyncSettings.UseGL && glContext == null)
|
||||
{
|
||||
glContext = coreComm.RequestGLContext(2,0,false);
|
||||
}
|
||||
|
||||
ResetCounters();
|
||||
|
||||
ActivateGL();
|
||||
Init(bios);
|
||||
|
||||
InputCallbackH = new LibYabause.InputCallback(() => InputCallbacks.Call());
|
||||
LibYabause.libyabause_setinputcallback(InputCallbackH);
|
||||
ConnectTracer();
|
||||
DriveLightEnabled = true;
|
||||
|
||||
DeactivateGL();
|
||||
}
|
||||
|
||||
public static ControllerDefinition SaturnController = new ControllerDefinition
|
||||
{
|
||||
Name = "Saturn Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
{
|
||||
"Power", "Reset",
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Start", "P1 A", "P1 B", "P1 C", "P1 X", "P1 Y", "P1 Z", "P1 L", "P1 R",
|
||||
"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Start", "P2 A", "P2 B", "P2 C", "P2 X", "P2 Y", "P2 Z", "P2 L", "P2 R",
|
||||
|
@ -56,35 +75,6 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
|
||||
LibYabause.InputCallback InputCallbackH;
|
||||
|
||||
public Yabause(CoreComm CoreComm, DiscSystem.Disc CD, object syncSettings)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
byte[] bios = CoreComm.CoreFileProvider.GetFirmware("SAT", "J", true, "Saturn BIOS is required.");
|
||||
CoreComm.RomStatusDetails = string.Format("Disk partial hash:{0}", new DiscSystem.DiscHasher(CD).OldHash());
|
||||
this.CoreComm = CoreComm;
|
||||
this.CD = CD;
|
||||
DiscSectorReader = new DiscSystem.DiscSectorReader(CD);
|
||||
|
||||
SyncSettings = (SaturnSyncSettings)syncSettings ?? new SaturnSyncSettings();
|
||||
|
||||
if (this.SyncSettings.UseGL && glContext == null)
|
||||
{
|
||||
glContext = CoreComm.RequestGLContext(2,0,false);
|
||||
}
|
||||
|
||||
ResetCounters();
|
||||
|
||||
ActivateGL();
|
||||
Init(bios);
|
||||
|
||||
InputCallbackH = new LibYabause.InputCallback(() => InputCallbacks.Call());
|
||||
LibYabause.libyabause_setinputcallback(InputCallbackH);
|
||||
ConnectTracer();
|
||||
DriveLightEnabled = true;
|
||||
|
||||
DeactivateGL();
|
||||
}
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
object glContext;
|
||||
|
|
|
@ -12,42 +12,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
isReleased: true,
|
||||
portedVersion: "r874",
|
||||
portedUrl: "https://code.google.com/p/genplus-gx/",
|
||||
singleInstance: true
|
||||
)]
|
||||
singleInstance: true)]
|
||||
public partial class GPGX : IEmulator, IVideoProvider, ISaveRam, IStatable, IRegionable,
|
||||
IInputPollable, IDebuggable, IDriveLight, ICodeDataLogger, IDisassemblable
|
||||
{
|
||||
static GPGX AttachedCore = null;
|
||||
|
||||
DiscSystem.Disc CD;
|
||||
DiscSystem.DiscSectorReader DiscSectorReader;
|
||||
byte[] romfile;
|
||||
|
||||
bool disposed = false;
|
||||
|
||||
LibGPGX.load_archive_cb LoadCallback = null;
|
||||
|
||||
LibGPGX.InputData input = new LibGPGX.InputData();
|
||||
|
||||
public enum ControlType
|
||||
{
|
||||
None,
|
||||
OnePlayer,
|
||||
Normal,
|
||||
Xea1p,
|
||||
Activator,
|
||||
Teamplayer,
|
||||
Wayplay,
|
||||
Mouse
|
||||
};
|
||||
|
||||
[CoreConstructor("GEN")]
|
||||
public GPGX(CoreComm comm, byte[] file, object Settings, object SyncSettings)
|
||||
: this(comm, file, null, Settings, SyncSettings)
|
||||
public GPGX(CoreComm comm, byte[] file, object settings, object syncSettings)
|
||||
: this(comm, file, null, settings, syncSettings)
|
||||
{
|
||||
}
|
||||
|
||||
public GPGX(CoreComm comm, byte[] rom, DiscSystem.Disc CD, object Settings, object SyncSettings)
|
||||
public GPGX(CoreComm comm, byte[] rom, DiscSystem.Disc CD, object settings, object syncSettings)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
// this can influence some things internally
|
||||
|
@ -64,8 +39,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
try
|
||||
{
|
||||
_syncSettings = (GPGXSyncSettings)SyncSettings ?? new GPGXSyncSettings();
|
||||
_settings = (GPGXSettings)Settings ?? new GPGXSettings();
|
||||
_syncSettings = (GPGXSyncSettings)syncSettings ?? new GPGXSyncSettings();
|
||||
_settings = (GPGXSettings)settings ?? new GPGXSettings();
|
||||
|
||||
CoreComm = comm;
|
||||
if (AttachedCore != null)
|
||||
|
@ -173,6 +148,31 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
}
|
||||
}
|
||||
|
||||
static GPGX AttachedCore = null;
|
||||
|
||||
DiscSystem.Disc CD;
|
||||
DiscSystem.DiscSectorReader DiscSectorReader;
|
||||
byte[] romfile;
|
||||
|
||||
bool disposed = false;
|
||||
|
||||
LibGPGX.load_archive_cb LoadCallback = null;
|
||||
|
||||
LibGPGX.InputData input = new LibGPGX.InputData();
|
||||
|
||||
public enum ControlType
|
||||
{
|
||||
None,
|
||||
OnePlayer,
|
||||
Normal,
|
||||
Xea1p,
|
||||
Activator,
|
||||
Teamplayer,
|
||||
Wayplay,
|
||||
Mouse
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// core callback for file loading
|
||||
/// </summary>
|
||||
|
|
|
@ -14,43 +14,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
|
|||
isReleased: true,
|
||||
portedVersion: "r874",
|
||||
portedUrl: "https://code.google.com/p/genplus-gx/",
|
||||
singleInstance: false
|
||||
)]
|
||||
singleInstance: false)]
|
||||
public partial class GPGX : IEmulator, IVideoProvider, ISaveRam, IStatable, IRegionable,
|
||||
IInputPollable, IDebuggable, IDriveLight, ICodeDataLogger, IDisassemblable
|
||||
{
|
||||
LibGPGX Core;
|
||||
ElfRunner Elf;
|
||||
|
||||
DiscSystem.Disc CD;
|
||||
DiscSystem.DiscSectorReader DiscSectorReader;
|
||||
byte[] romfile;
|
||||
|
||||
bool disposed = false;
|
||||
|
||||
LibGPGX.load_archive_cb LoadCallback = null;
|
||||
|
||||
LibGPGX.InputData input = new LibGPGX.InputData();
|
||||
|
||||
public enum ControlType
|
||||
{
|
||||
None,
|
||||
OnePlayer,
|
||||
Normal,
|
||||
Xea1p,
|
||||
Activator,
|
||||
Teamplayer,
|
||||
Wayplay,
|
||||
Mouse
|
||||
};
|
||||
|
||||
[CoreConstructor("GEN")]
|
||||
public GPGX(CoreComm comm, byte[] file, object Settings, object SyncSettings)
|
||||
: this(comm, file, null, Settings, SyncSettings)
|
||||
public GPGX(CoreComm comm, byte[] file, object settings, object syncSettings)
|
||||
: this(comm, file, null, settings, syncSettings)
|
||||
{
|
||||
}
|
||||
|
||||
public GPGX(CoreComm comm, byte[] rom, DiscSystem.Disc CD, object Settings, object SyncSettings)
|
||||
public GPGX(CoreComm comm, byte[] rom, DiscSystem.Disc CD, object settings, object syncSettings)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
// this can influence some things internally (autodetect romtype, etc)
|
||||
|
@ -73,8 +47,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
|
|||
else
|
||||
Core = BizInvoker.GetInvoker<LibGPGX>(Elf);
|
||||
|
||||
_syncSettings = (GPGXSyncSettings)SyncSettings ?? new GPGXSyncSettings();
|
||||
_settings = (GPGXSettings)Settings ?? new GPGXSettings();
|
||||
_syncSettings = (GPGXSyncSettings)syncSettings ?? new GPGXSyncSettings();
|
||||
_settings = (GPGXSettings)settings ?? new GPGXSettings();
|
||||
|
||||
CoreComm = comm;
|
||||
|
||||
|
@ -176,6 +150,32 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
|
|||
}
|
||||
}
|
||||
|
||||
LibGPGX Core;
|
||||
ElfRunner Elf;
|
||||
|
||||
DiscSystem.Disc CD;
|
||||
DiscSystem.DiscSectorReader DiscSectorReader;
|
||||
byte[] romfile;
|
||||
|
||||
bool disposed = false;
|
||||
|
||||
LibGPGX.load_archive_cb LoadCallback = null;
|
||||
|
||||
LibGPGX.InputData input = new LibGPGX.InputData();
|
||||
|
||||
public enum ControlType
|
||||
{
|
||||
None,
|
||||
OnePlayer,
|
||||
Normal,
|
||||
Xea1p,
|
||||
Activator,
|
||||
Teamplayer,
|
||||
Wayplay,
|
||||
Mouse
|
||||
};
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// core callback for file loading
|
||||
/// </summary>
|
||||
|
|
|
@ -10,16 +10,40 @@ namespace BizHawk.Emulation.Cores.Sony.PSP
|
|||
"hrydgard",
|
||||
isPorted: true,
|
||||
isReleased: false,
|
||||
singleInstance: true
|
||||
)]
|
||||
singleInstance: true)]
|
||||
public class PSP : IEmulator, IVideoProvider, ISoundProvider
|
||||
{
|
||||
public PSP(CoreComm comm, string isopath)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
if (attachedcore != null)
|
||||
{
|
||||
attachedcore.Dispose();
|
||||
attachedcore = null;
|
||||
}
|
||||
CoreComm = comm;
|
||||
|
||||
glcontext = CoreComm.RequestGLContext(3, 0, true);
|
||||
CoreComm.ActivateGLContext(glcontext);
|
||||
|
||||
logcallback = new PPSSPPDll.LogCB(LogCallbackFunc);
|
||||
|
||||
bool good = PPSSPPDll.BizInit(isopath, logcallback);
|
||||
LogFlush();
|
||||
if (!good)
|
||||
throw new Exception("PPSSPP Init failed!");
|
||||
|
||||
CoreComm.RomStatusDetails = "It puts the scythe in the chicken or it gets the abyss again!";
|
||||
|
||||
attachedcore = this;
|
||||
}
|
||||
|
||||
public static readonly ControllerDefinition PSPController = new ControllerDefinition
|
||||
{
|
||||
Name = "PSP Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"Up", "Down", "Left", "Right", "Select", "Start", "L", "R", "Square", "Triangle", "Circle", "Cross",
|
||||
{
|
||||
"Up", "Down", "Left", "Right", "Select", "Start", "L", "R", "Square", "Triangle", "Circle", "Cross",
|
||||
"Menu", "Back",
|
||||
"Power"
|
||||
},
|
||||
|
@ -63,31 +87,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSP
|
|||
static PSP attachedcore = null;
|
||||
object glcontext;
|
||||
|
||||
public PSP(CoreComm comm, string isopath)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
if (attachedcore != null)
|
||||
{
|
||||
attachedcore.Dispose();
|
||||
attachedcore = null;
|
||||
}
|
||||
CoreComm = comm;
|
||||
|
||||
glcontext = CoreComm.RequestGLContext(3, 0, true);
|
||||
CoreComm.ActivateGLContext(glcontext);
|
||||
|
||||
logcallback = new PPSSPPDll.LogCB(LogCallbackFunc);
|
||||
|
||||
bool good = PPSSPPDll.BizInit(isopath, logcallback);
|
||||
LogFlush();
|
||||
if (!good)
|
||||
throw new Exception("PPSSPP Init failed!");
|
||||
|
||||
CoreComm.RomStatusDetails = "It puts the scythe in the chicken or it gets the abyss again!";
|
||||
|
||||
attachedcore = this;
|
||||
}
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -29,10 +29,190 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
"Octoshock",
|
||||
"Ryphecha",
|
||||
isPorted: true,
|
||||
isReleased: true
|
||||
)]
|
||||
isReleased: true)]
|
||||
public unsafe partial class Octoshock : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IDriveLight, ISettable<Octoshock.Settings, Octoshock.SyncSettings>, IRegionable, IInputPollable
|
||||
{
|
||||
public Octoshock(CoreComm comm, PSF psf, object settings, object syncSettings)
|
||||
{
|
||||
Load(comm, null, null, null, settings, syncSettings, psf);
|
||||
OctoshockDll.shock_PowerOn(psx);
|
||||
}
|
||||
|
||||
//note: its annoying that we have to have a disc before constructing this.
|
||||
//might want to change that later. HOWEVER - we need to definitely have a region, at least
|
||||
public Octoshock(CoreComm comm, List<DiscSystem.Disc> discs, List<string> discNames, byte[] exe, object settings, object syncSettings)
|
||||
{
|
||||
Load(comm, discs, discNames, exe, settings, syncSettings, null);
|
||||
OctoshockDll.shock_PowerOn(psx);
|
||||
}
|
||||
|
||||
void Load(CoreComm comm, List<DiscSystem.Disc> discs, List<string> discNames, byte[] exe, object settings, object syncSettings, PSF psf)
|
||||
{
|
||||
ConnectTracer();
|
||||
CoreComm = comm;
|
||||
DriveLightEnabled = true;
|
||||
|
||||
_Settings = (Settings)settings ?? new Settings();
|
||||
_SyncSettings = (SyncSettings)syncSettings ?? new SyncSettings();
|
||||
|
||||
Discs = discs;
|
||||
|
||||
Attach();
|
||||
|
||||
//assume this region for EXE and PSF, maybe not correct though
|
||||
string firmwareRegion = "U";
|
||||
SystemRegion = OctoshockDll.eRegion.NA;
|
||||
|
||||
if (discs != null)
|
||||
{
|
||||
HackyDiscButtons.AddRange(discNames);
|
||||
|
||||
foreach (var disc in discs)
|
||||
{
|
||||
var discInterface = new DiscInterface(disc,
|
||||
(di) =>
|
||||
{
|
||||
//if current disc this delegate disc, activity is happening
|
||||
if (di == currentDiscInterface)
|
||||
DriveLightOn = true;
|
||||
});
|
||||
|
||||
discInterfaces.Add(discInterface);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//assume its NA region for test programs, for now. could it be read out of the ps-exe header?
|
||||
}
|
||||
|
||||
if (discInterfaces.Count != 0)
|
||||
{
|
||||
//determine region of one of the discs
|
||||
OctoshockDll.ShockDiscInfo discInfo;
|
||||
OctoshockDll.shock_AnalyzeDisc(discInterfaces[0].OctoshockHandle, out discInfo);
|
||||
|
||||
//try to acquire the appropriate firmware
|
||||
if (discInfo.region == OctoshockDll.eRegion.EU) firmwareRegion = "E";
|
||||
if (discInfo.region == OctoshockDll.eRegion.JP) firmwareRegion = "J";
|
||||
SystemRegion = discInfo.region;
|
||||
}
|
||||
|
||||
//see http://problemkaputt.de/psx-spx.htm
|
||||
int CpuClock_n = 44100 * 768;
|
||||
int CpuClock_d = 1;
|
||||
int VidClock_n = CpuClock_n * 11;
|
||||
int VidClock_d = CpuClock_d * 7;
|
||||
if (SystemRegion == OctoshockDll.eRegion.EU)
|
||||
{
|
||||
VsyncNumerator = VidClock_n;
|
||||
VsyncDenominator = VidClock_d * 314 * 3406;
|
||||
SystemVidStandard = OctoshockDll.eVidStandard.PAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
VsyncNumerator = VidClock_n;
|
||||
VsyncDenominator = VidClock_d * 263 * 3413;
|
||||
SystemVidStandard = OctoshockDll.eVidStandard.NTSC;
|
||||
}
|
||||
|
||||
//TODO - known bad firmwares are a no-go. we should refuse to boot them. (thats the mednafen policy)
|
||||
byte[] firmware = comm.CoreFileProvider.GetFirmware("PSX", firmwareRegion, true, "A PSX `" + firmwareRegion + "` region bios file is required");
|
||||
|
||||
//create the instance
|
||||
fixed (byte* pFirmware = firmware)
|
||||
OctoshockDll.shock_Create(out psx, SystemRegion, pFirmware);
|
||||
|
||||
SetMemoryDomains();
|
||||
InitMemCallbacks();
|
||||
|
||||
//set a default framebuffer based on the first frame of emulation, to cut down on flickering or whatever
|
||||
//this is probably quixotic, but we have to pick something
|
||||
{
|
||||
BufferWidth = 280;
|
||||
BufferHeight = 240;
|
||||
if (SystemVidStandard == OctoshockDll.eVidStandard.PAL)
|
||||
{
|
||||
BufferWidth = 280;
|
||||
BufferHeight = 288;
|
||||
}
|
||||
CurrentVideoSize = new System.Drawing.Size(BufferWidth, BufferHeight);
|
||||
var ri = Octoshock.CalculateResolution(SystemVidStandard, _Settings, BufferWidth, BufferHeight);
|
||||
BufferWidth = VirtualWidth = ri.Resolution.Width;
|
||||
BufferHeight = VirtualHeight = ri.Resolution.Height;
|
||||
//VideoProvider_Padding = new System.Drawing.Size(50,50);
|
||||
frameBuffer = new int[BufferWidth * BufferHeight];
|
||||
}
|
||||
|
||||
if (discInterfaces.Count != 0)
|
||||
{
|
||||
//start with first disc inserted and tray closed. it's a sensible default.
|
||||
//it will be possible for the user to specify a different initial configuration, but this will inform the UI
|
||||
CurrentTrayOpen = false;
|
||||
CurrentDiscIndexMounted = 1;
|
||||
}
|
||||
else if (psf == null)
|
||||
{
|
||||
//must be an exe
|
||||
fixed (byte* pExeBuffer = exe)
|
||||
OctoshockDll.shock_MountEXE(psx, pExeBuffer, exe.Length, false);
|
||||
|
||||
//start with no disc inserted and tray closed
|
||||
CurrentTrayOpen = false;
|
||||
CurrentDiscIndexMounted = 0;
|
||||
OctoshockDll.shock_CloseTray(psx);
|
||||
}
|
||||
else
|
||||
{
|
||||
//must be a psf
|
||||
if (psf.LibData != null)
|
||||
fixed (byte* pBuf = psf.LibData)
|
||||
OctoshockDll.shock_MountEXE(psx, pBuf, psf.LibData.Length, true);
|
||||
fixed (byte* pBuf = psf.Data)
|
||||
OctoshockDll.shock_MountEXE(psx, pBuf, psf.Data.Length, false);
|
||||
|
||||
//start with no disc inserted and tray closed
|
||||
CurrentTrayOpen = false;
|
||||
CurrentDiscIndexMounted = 0;
|
||||
OctoshockDll.shock_CloseTray(psx);
|
||||
}
|
||||
|
||||
//setup the controller based on sync settings
|
||||
SetControllerButtons();
|
||||
|
||||
var fioCfg = _SyncSettings.FIOConfig;
|
||||
if (fioCfg.Multitaps[0])
|
||||
{
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x01, OctoshockDll.ePeripheralType.Multitap);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x11, fioCfg.Devices8[0]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x21, fioCfg.Devices8[1]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x31, fioCfg.Devices8[2]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x41, fioCfg.Devices8[3]);
|
||||
}
|
||||
else
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x01, fioCfg.Devices8[0]);
|
||||
|
||||
if (fioCfg.Multitaps[1])
|
||||
{
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x02, OctoshockDll.ePeripheralType.Multitap);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x12, fioCfg.Devices8[4]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x22, fioCfg.Devices8[5]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x32, fioCfg.Devices8[6]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x42, fioCfg.Devices8[7]);
|
||||
}
|
||||
else
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x02, fioCfg.Devices8[4]);
|
||||
|
||||
var memcardTransaction = new OctoshockDll.ShockMemcardTransaction()
|
||||
{
|
||||
transaction = OctoshockDll.eShockMemcardTransaction.Connect
|
||||
};
|
||||
if (fioCfg.Memcards[0]) OctoshockDll.shock_Peripheral_MemcardTransact(psx, 0x01, ref memcardTransaction);
|
||||
if (fioCfg.Memcards[1]) OctoshockDll.shock_Peripheral_MemcardTransact(psx, 0x02, ref memcardTransaction);
|
||||
|
||||
//do this after framebuffers and peripherals and whatever crap are setup. kind of lame, but thats how it is for now
|
||||
StudySaveBufferSize();
|
||||
}
|
||||
|
||||
public string SystemId { get { return "PSX"; } }
|
||||
|
||||
public static ControllerDefinition CreateControllerDefinition(SyncSettings syncSettings)
|
||||
|
@ -70,10 +250,10 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
"P" + pnum + " L"
|
||||
});
|
||||
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -259,187 +439,6 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
|
||||
public List<string> HackyDiscButtons = new List<string>();
|
||||
|
||||
public Octoshock(CoreComm comm, PSF psf, object settings, object syncSettings)
|
||||
{
|
||||
Load(comm, null, null, null, settings, syncSettings, psf);
|
||||
OctoshockDll.shock_PowerOn(psx);
|
||||
}
|
||||
|
||||
//note: its annoying that we have to have a disc before constructing this.
|
||||
//might want to change that later. HOWEVER - we need to definitely have a region, at least
|
||||
public Octoshock(CoreComm comm, List<DiscSystem.Disc> discs, List<string> discNames, byte[] exe, object settings, object syncSettings)
|
||||
{
|
||||
Load(comm, discs, discNames, exe, settings, syncSettings, null);
|
||||
OctoshockDll.shock_PowerOn(psx);
|
||||
}
|
||||
|
||||
void Load(CoreComm comm, List<DiscSystem.Disc> discs, List<string> discNames, byte[] exe, object settings, object syncSettings, PSF psf)
|
||||
{
|
||||
ConnectTracer();
|
||||
CoreComm = comm;
|
||||
DriveLightEnabled = true;
|
||||
|
||||
_Settings = (Settings)settings ?? new Settings();
|
||||
_SyncSettings = (SyncSettings)syncSettings ?? new SyncSettings();
|
||||
|
||||
Discs = discs;
|
||||
|
||||
Attach();
|
||||
|
||||
//assume this region for EXE and PSF, maybe not correct though
|
||||
string firmwareRegion = "U";
|
||||
SystemRegion = OctoshockDll.eRegion.NA;
|
||||
|
||||
if (discs != null)
|
||||
{
|
||||
HackyDiscButtons.AddRange(discNames);
|
||||
|
||||
foreach (var disc in discs)
|
||||
{
|
||||
var discInterface = new DiscInterface(disc,
|
||||
(di) =>
|
||||
{
|
||||
//if current disc this delegate disc, activity is happening
|
||||
if (di == currentDiscInterface)
|
||||
DriveLightOn = true;
|
||||
});
|
||||
|
||||
discInterfaces.Add(discInterface);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//assume its NA region for test programs, for now. could it be read out of the ps-exe header?
|
||||
}
|
||||
|
||||
if (discInterfaces.Count != 0)
|
||||
{
|
||||
//determine region of one of the discs
|
||||
OctoshockDll.ShockDiscInfo discInfo;
|
||||
OctoshockDll.shock_AnalyzeDisc(discInterfaces[0].OctoshockHandle, out discInfo);
|
||||
|
||||
//try to acquire the appropriate firmware
|
||||
if (discInfo.region == OctoshockDll.eRegion.EU) firmwareRegion = "E";
|
||||
if (discInfo.region == OctoshockDll.eRegion.JP) firmwareRegion = "J";
|
||||
SystemRegion = discInfo.region;
|
||||
}
|
||||
|
||||
//see http://problemkaputt.de/psx-spx.htm
|
||||
int CpuClock_n = 44100 * 768;
|
||||
int CpuClock_d = 1;
|
||||
int VidClock_n = CpuClock_n * 11;
|
||||
int VidClock_d = CpuClock_d * 7;
|
||||
if (SystemRegion == OctoshockDll.eRegion.EU)
|
||||
{
|
||||
VsyncNumerator = VidClock_n;
|
||||
VsyncDenominator = VidClock_d * 314 * 3406;
|
||||
SystemVidStandard = OctoshockDll.eVidStandard.PAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
VsyncNumerator = VidClock_n;
|
||||
VsyncDenominator = VidClock_d * 263 * 3413;
|
||||
SystemVidStandard = OctoshockDll.eVidStandard.NTSC;
|
||||
}
|
||||
|
||||
//TODO - known bad firmwares are a no-go. we should refuse to boot them. (thats the mednafen policy)
|
||||
byte[] firmware = comm.CoreFileProvider.GetFirmware("PSX", firmwareRegion, true, "A PSX `" + firmwareRegion + "` region bios file is required");
|
||||
|
||||
//create the instance
|
||||
fixed (byte* pFirmware = firmware)
|
||||
OctoshockDll.shock_Create(out psx, SystemRegion, pFirmware);
|
||||
|
||||
SetMemoryDomains();
|
||||
InitMemCallbacks();
|
||||
|
||||
//set a default framebuffer based on the first frame of emulation, to cut down on flickering or whatever
|
||||
//this is probably quixotic, but we have to pick something
|
||||
{
|
||||
BufferWidth = 280;
|
||||
BufferHeight = 240;
|
||||
if (SystemVidStandard == OctoshockDll.eVidStandard.PAL)
|
||||
{
|
||||
BufferWidth = 280;
|
||||
BufferHeight = 288;
|
||||
}
|
||||
CurrentVideoSize = new System.Drawing.Size(BufferWidth, BufferHeight);
|
||||
var ri = Octoshock.CalculateResolution(SystemVidStandard, _Settings, BufferWidth, BufferHeight);
|
||||
BufferWidth = VirtualWidth = ri.Resolution.Width;
|
||||
BufferHeight = VirtualHeight = ri.Resolution.Height;
|
||||
//VideoProvider_Padding = new System.Drawing.Size(50,50);
|
||||
frameBuffer = new int[BufferWidth * BufferHeight];
|
||||
}
|
||||
|
||||
if (discInterfaces.Count != 0)
|
||||
{
|
||||
//start with first disc inserted and tray closed. it's a sensible default.
|
||||
//it will be possible for the user to specify a different initial configuration, but this will inform the UI
|
||||
CurrentTrayOpen = false;
|
||||
CurrentDiscIndexMounted = 1;
|
||||
}
|
||||
else if (psf == null)
|
||||
{
|
||||
//must be an exe
|
||||
fixed (byte* pExeBuffer = exe)
|
||||
OctoshockDll.shock_MountEXE(psx, pExeBuffer, exe.Length, false);
|
||||
|
||||
//start with no disc inserted and tray closed
|
||||
CurrentTrayOpen = false;
|
||||
CurrentDiscIndexMounted = 0;
|
||||
OctoshockDll.shock_CloseTray(psx);
|
||||
}
|
||||
else
|
||||
{
|
||||
//must be a psf
|
||||
if (psf.LibData != null)
|
||||
fixed (byte* pBuf = psf.LibData)
|
||||
OctoshockDll.shock_MountEXE(psx, pBuf, psf.LibData.Length, true);
|
||||
fixed (byte* pBuf = psf.Data)
|
||||
OctoshockDll.shock_MountEXE(psx, pBuf, psf.Data.Length, false);
|
||||
|
||||
//start with no disc inserted and tray closed
|
||||
CurrentTrayOpen = false;
|
||||
CurrentDiscIndexMounted = 0;
|
||||
OctoshockDll.shock_CloseTray(psx);
|
||||
}
|
||||
|
||||
//setup the controller based on sync settings
|
||||
SetControllerButtons();
|
||||
|
||||
var fioCfg = _SyncSettings.FIOConfig;
|
||||
if (fioCfg.Multitaps[0])
|
||||
{
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x01, OctoshockDll.ePeripheralType.Multitap);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x11, fioCfg.Devices8[0]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x21, fioCfg.Devices8[1]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x31, fioCfg.Devices8[2]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x41, fioCfg.Devices8[3]);
|
||||
}
|
||||
else
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x01, fioCfg.Devices8[0]);
|
||||
|
||||
if (fioCfg.Multitaps[1])
|
||||
{
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x02, OctoshockDll.ePeripheralType.Multitap);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x12, fioCfg.Devices8[4]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x22, fioCfg.Devices8[5]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x32, fioCfg.Devices8[6]);
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x42, fioCfg.Devices8[7]);
|
||||
}
|
||||
else
|
||||
OctoshockDll.shock_Peripheral_Connect(psx, 0x02, fioCfg.Devices8[4]);
|
||||
|
||||
var memcardTransaction = new OctoshockDll.ShockMemcardTransaction()
|
||||
{
|
||||
transaction = OctoshockDll.eShockMemcardTransaction.Connect
|
||||
};
|
||||
if (fioCfg.Memcards[0]) OctoshockDll.shock_Peripheral_MemcardTransact(psx, 0x01, ref memcardTransaction);
|
||||
if (fioCfg.Memcards[1]) OctoshockDll.shock_Peripheral_MemcardTransact(psx, 0x02, ref memcardTransaction);
|
||||
|
||||
//do this after framebuffers and peripherals and whatever crap are setup. kind of lame, but thats how it is for now
|
||||
StudySaveBufferSize();
|
||||
}
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
public bool DriveLightEnabled { get; private set; }
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.WonderSwan
|
||||
{
|
||||
|
@ -16,12 +12,12 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
IInputPollable, IDebuggable
|
||||
{
|
||||
[CoreConstructor("WSWAN")]
|
||||
public WonderSwan(CoreComm comm, byte[] file, bool deterministic, object Settings, object SyncSettings)
|
||||
public WonderSwan(CoreComm comm, byte[] file, bool deterministic, object settings, object syncSettings)
|
||||
{
|
||||
ServiceProvider = new BasicServiceProvider(this);
|
||||
CoreComm = comm;
|
||||
_Settings = (Settings)Settings ?? new Settings();
|
||||
_SyncSettings = (SyncSettings)SyncSettings ?? new SyncSettings();
|
||||
_Settings = (Settings)settings ?? new Settings();
|
||||
_SyncSettings = (SyncSettings)syncSettings ?? new SyncSettings();
|
||||
|
||||
DeterministicEmulation = deterministic; // when true, remember to force the RTC flag!
|
||||
Core = BizSwan.bizswan_new();
|
||||
|
|
Loading…
Reference in New Issue