[GambatteLink] changes in link API, misc cleanup
This commit is contained in:
parent
de8748d6d1
commit
f7936a34f8
Binary file not shown.
Binary file not shown.
|
@ -4,6 +4,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
{
|
||||
public partial class Gameboy : ILinkable
|
||||
{
|
||||
public bool LinkConnected { get; set; }
|
||||
private bool _linkConnected;
|
||||
|
||||
public bool LinkConnected
|
||||
{
|
||||
get => _linkConnected;
|
||||
set { return; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ using BizHawk.Emulation.Common;
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
||||
{
|
||||
public partial class Gameboy : ITextStatable
|
||||
public partial class Gameboy : IStatable, ITextStatable
|
||||
{
|
||||
public void SaveStateText(TextWriter writer)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
||||
{
|
||||
public partial class Gameboy
|
||||
public partial class Gameboy : IVideoProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// buffer of last frame produced
|
||||
|
|
|
@ -13,14 +13,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
/// </summary>
|
||||
[PortedCore(CoreNames.Gambatte, "", "Gambatte-Speedrun r717+", "https://github.com/pokemon-speedrunning/gambatte-speedrun")]
|
||||
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
|
||||
public partial class Gameboy : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IInputPollable, ICodeDataLogger,
|
||||
IBoardInfo, IRomInfo, IDebuggable, ISettable<Gameboy.GambatteSettings, Gameboy.GambatteSyncSettings>,
|
||||
IGameboyCommon, ICycleTiming, ILinkable
|
||||
public partial class Gameboy : IInputPollable, IRomInfo, IGameboyCommon, ICycleTiming, ILinkable
|
||||
{
|
||||
[CoreConstructor(VSystemID.Raw.GB)]
|
||||
[CoreConstructor(VSystemID.Raw.GBC)]
|
||||
[CoreConstructor(VSystemID.Raw.SGB)]
|
||||
public Gameboy(CoreComm comm, GameInfo game, byte[] file, Gameboy.GambatteSettings settings, Gameboy.GambatteSyncSettings syncSettings, bool deterministic)
|
||||
public Gameboy(CoreComm comm, GameInfo game, byte[] file, GambatteSettings settings, GambatteSyncSettings syncSettings, bool deterministic)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ser.Register<IDisassemblable>(_disassembler);
|
||||
|
@ -707,11 +705,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
if (callback != null)
|
||||
{
|
||||
printer = new GambattePrinter(this, callback);
|
||||
LinkConnected = true;
|
||||
_linkConnected = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkConnected = false;
|
||||
_linkConnected = false;
|
||||
if (printer != null) // have no idea how this is ever null???
|
||||
{
|
||||
printer.Disconnect();
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
bool linkDiscoSignalNew = controller.IsPressed("Toggle Link Connection");
|
||||
if (linkDiscoSignalNew && !_linkDiscoSignal)
|
||||
{
|
||||
_linkConnected ^= true;
|
||||
Console.WriteLine("Link connect status to {0}", _linkConnected);
|
||||
LinkConnected ^= true;
|
||||
Console.WriteLine("Link connect status to {0}", LinkConnected);
|
||||
}
|
||||
|
||||
_linkDiscoSignal = linkDiscoSignalNew;
|
||||
|
@ -229,29 +229,29 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
if (CanIR(one, two))
|
||||
{
|
||||
if (LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 260) != 0) // InfraredTrigger
|
||||
if (LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 259) != 0) // InfraredTrigger
|
||||
{
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 261); // ack
|
||||
if (LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 262) != 0) // GetOut
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 260); // ack
|
||||
if (LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 261) != 0) // GetOut
|
||||
{
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 263); // ShiftInOn
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 262); // ShiftInOn
|
||||
}
|
||||
else
|
||||
{
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 264); // ShiftInOff
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 263); // ShiftInOff
|
||||
}
|
||||
}
|
||||
|
||||
if (LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 260) != 0) // InfraredTrigger
|
||||
if (LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 259) != 0) // InfraredTrigger
|
||||
{
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 261); // ack
|
||||
if (LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 262) != 0) // GetOut
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 260); // ack
|
||||
if (LibGambatte.gambatte_linkstatus(_linkedCores[two].GambatteState, 261) != 0) // GetOut
|
||||
{
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 263); // ShiftInOn
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 262); // ShiftInOn
|
||||
}
|
||||
else
|
||||
{
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 264); // ShiftInOff
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[one].GambatteState, 263); // ShiftInOff
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
for (int i = 0; i < _numCores; i++)
|
||||
{
|
||||
_linkedCores[i] = new Gameboy(lp.Comm, lp.Roms[i].Game, lp.Roms[i].RomData, _settings._linkedSettings[i], _syncSettings._linkedSyncSettings[i], lp.DeterministicEmulationRequested);
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[i].GambatteState, 259); // connect link cable
|
||||
_linkedCores[i].ConnectInputCallbackSystem(_inputCallbacks);
|
||||
_linkedCores[i].ConnectMemoryCallbackSystem(_memoryCallbacks);
|
||||
_linkedConts[i] = new SaveController(Gameboy.CreateControllerDefinition(false, false));
|
||||
|
@ -76,7 +75,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
public bool LinkConnected
|
||||
{
|
||||
get => _linkConnected;
|
||||
set => _linkConnected = value;
|
||||
set
|
||||
{
|
||||
_linkConnected = value;
|
||||
for (int i = 0; i < _numCores; i++)
|
||||
{
|
||||
LibGambatte.gambatte_linkstatus(_linkedCores[i].GambatteState, _linkConnected ? 264 : 265);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _numCores = 0;
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
private readonly Gameboy gb;
|
||||
private readonly PrinterCallback callback;
|
||||
private LibGambatte.LinkCallback linkCallback;
|
||||
private readonly LibGambatte.LinkCallback linkCallback;
|
||||
|
||||
private CommandState command_state;
|
||||
private CommandID command_id;
|
||||
|
@ -68,13 +68,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
LibGambatte.gambatte_setlinkcallback(gb.GambatteState, linkCallback);
|
||||
|
||||
// connect the cable
|
||||
LibGambatte.gambatte_linkstatus(gb.GambatteState, 259);
|
||||
LibGambatte.gambatte_linkstatus(gb.GambatteState, 264);
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
if (gb.GambatteState != IntPtr.Zero)
|
||||
{
|
||||
LibGambatte.gambatte_setlinkcallback(gb.GambatteState, null);
|
||||
LibGambatte.gambatte_linkstatus(gb.GambatteState, 265);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSerial()
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 72630bfce765fc8e9fd60e78de3c3fe4aae571a1
|
||||
Subproject commit dc50297053a3e8fff285629d735a9618b9406245
|
Loading…
Reference in New Issue