cleanup GBHawkLink
This commit is contained in:
parent
9418a57b54
commit
721b150f78
BizHawk.Emulation.Cores/Consoles/Nintendo
|
@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
|
||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||
|
||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
||||
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||
{
|
||||
//Console.WriteLine("-----------------------FRAME-----------------------");
|
||||
//Update the color palette if a setting changed
|
||||
|
@ -164,7 +164,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
if ((R.IR_self & R.IR_receive) == 2) { R.IR_reg |= 2; }
|
||||
else { R.IR_reg &= 0xFD; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we hit a frame boundary, update video
|
||||
|
@ -197,7 +197,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
R.vblank_rise = false;
|
||||
do_frame_fill = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetControllerState(IController controller)
|
||||
|
@ -232,10 +232,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
|
||||
public int[] _vidbuffer = new int[160 * 2 * 144];
|
||||
|
||||
public int[] GetVideoBuffer()
|
||||
{
|
||||
return _vidbuffer;
|
||||
}
|
||||
public int[] GetVideoBuffer() => _vidbuffer;
|
||||
|
||||
public void FillVideoBuffer()
|
||||
{
|
||||
|
@ -307,24 +304,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
|
||||
public void GetSamplesSync(out short[] samples, out int nsamp)
|
||||
{
|
||||
short[] temp_samp_L;
|
||||
short[] temp_samp_R;
|
||||
|
||||
int nsamp_L;
|
||||
int nsamp_R;
|
||||
|
||||
L.audio.GetSamplesSync(out temp_samp_L, out nsamp_L);
|
||||
R.audio.GetSamplesSync(out temp_samp_R, out nsamp_R);
|
||||
L.audio.GetSamplesSync(out var tempSampL, out var nsampL);
|
||||
R.audio.GetSamplesSync(out var tempSampR, out var nsampR);
|
||||
|
||||
if (linkSettings.AudioSet == GBLinkSettings.AudioSrc.Left)
|
||||
{
|
||||
samples = temp_samp_L;
|
||||
nsamp = nsamp_L;
|
||||
samples = tempSampL;
|
||||
nsamp = nsampL;
|
||||
}
|
||||
else if (linkSettings.AudioSet == GBLinkSettings.AudioSrc.Right)
|
||||
{
|
||||
samples = temp_samp_R;
|
||||
nsamp = nsamp_R;
|
||||
samples = tempSampR;
|
||||
nsamp = nsampR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -344,11 +335,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
R.audio.DiscardSamples();
|
||||
}
|
||||
|
||||
private void GetSamples(short[] samples)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DisposeSound()
|
||||
{
|
||||
L.audio.DisposeSound();
|
||||
|
|
|
@ -44,15 +44,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
"System Bus L",
|
||||
0X10000,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => PeekSystemBusL(addr),
|
||||
(addr, value) => PokeSystemBusL(addr, value),
|
||||
PeekSystemBusL,
|
||||
PokeSystemBusL,
|
||||
1),
|
||||
new MemoryDomainDelegate(
|
||||
"System Bus R",
|
||||
0X10000,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => PeekSystemBusR(addr),
|
||||
(addr, value) => PokeSystemBusR(addr, value),
|
||||
PeekSystemBusR,
|
||||
PokeSystemBusR,
|
||||
1),
|
||||
new MemoryDomainDelegate(
|
||||
"ROM L",
|
||||
|
@ -86,14 +86,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
|
||||
if (L.cart_RAM != null)
|
||||
{
|
||||
var CartRamL = new MemoryDomainByteArray("Cart RAM L", MemoryDomain.Endian.Little, L.cart_RAM, true, 1);
|
||||
domains.Add(CartRamL);
|
||||
var cartRamL = new MemoryDomainByteArray("Cart RAM L", MemoryDomain.Endian.Little, L.cart_RAM, true, 1);
|
||||
domains.Add(cartRamL);
|
||||
}
|
||||
|
||||
if (R.cart_RAM != null)
|
||||
{
|
||||
var CartRamR = new MemoryDomainByteArray("Cart RAM R", MemoryDomain.Endian.Little, R.cart_RAM, true, 1);
|
||||
domains.Add(CartRamR);
|
||||
var cartRamR = new MemoryDomainByteArray("Cart RAM R", MemoryDomain.Endian.Little, R.cart_RAM, true, 1);
|
||||
domains.Add(cartRamR);
|
||||
}
|
||||
|
||||
MemoryDomains = new MemoryDomainList(domains);
|
||||
|
|
|
@ -7,23 +7,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
{
|
||||
public byte[] CloneSaveRam()
|
||||
{
|
||||
if ((L.cart_RAM != null) || (R.cart_RAM != null))
|
||||
if (L.cart_RAM != null || R.cart_RAM != null)
|
||||
{
|
||||
int Len1 = 0;
|
||||
int Len2 = 0;
|
||||
int len1 = 0;
|
||||
int len2 = 0;
|
||||
int index = 0;
|
||||
|
||||
if (L.cart_RAM != null)
|
||||
{
|
||||
Len1 = L.cart_RAM.Length;
|
||||
len1 = L.cart_RAM.Length;
|
||||
}
|
||||
|
||||
if (R.cart_RAM != null)
|
||||
{
|
||||
Len2 = R.cart_RAM.Length;
|
||||
len2 = R.cart_RAM.Length;
|
||||
}
|
||||
|
||||
byte[] temp = new byte[Len1 + Len2];
|
||||
byte[] temp = new byte[len1 + len2];
|
||||
|
||||
if (L.cart_RAM != null)
|
||||
{
|
||||
|
@ -53,15 +53,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
{
|
||||
if (linkSyncSettings.Use_SRAM)
|
||||
{
|
||||
if ((L.cart_RAM != null) && (R.cart_RAM == null))
|
||||
if (L.cart_RAM != null && R.cart_RAM == null)
|
||||
{
|
||||
Buffer.BlockCopy(data, 0, L.cart_RAM, 0, L.cart_RAM.Length);
|
||||
}
|
||||
else if ((R.cart_RAM != null) && (L.cart_RAM == null))
|
||||
else if (R.cart_RAM != null && L.cart_RAM == null)
|
||||
{
|
||||
Buffer.BlockCopy(data, 0, R.cart_RAM, 0, R.cart_RAM.Length);
|
||||
}
|
||||
else if ((R.cart_RAM != null) && (L.cart_RAM != null))
|
||||
else if (R.cart_RAM != null && L.cart_RAM != null)
|
||||
{
|
||||
Buffer.BlockCopy(data, 0, L.cart_RAM, 0, L.cart_RAM.Length);
|
||||
Buffer.BlockCopy(data, L.cart_RAM.Length, R.cart_RAM, 0, R.cart_RAM.Length);
|
||||
|
|
|
@ -10,15 +10,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
{
|
||||
public partial class GBHawkLink : IEmulator, IStatable, ISettable<GBHawkLink.GBLinkSettings, GBHawkLink.GBLinkSyncSettings>
|
||||
{
|
||||
public GBLinkSettings GetSettings()
|
||||
{
|
||||
return linkSettings.Clone();
|
||||
}
|
||||
public GBLinkSettings GetSettings() => linkSettings.Clone();
|
||||
|
||||
public GBLinkSyncSettings GetSyncSettings()
|
||||
{
|
||||
return linkSyncSettings.Clone();
|
||||
}
|
||||
public GBLinkSyncSettings GetSyncSettings() => linkSyncSettings.Clone();
|
||||
|
||||
public bool PutSettings(GBLinkSettings o)
|
||||
{
|
||||
|
@ -72,15 +66,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
[DefaultValue(VideoSrc.Both)]
|
||||
public VideoSrc VideoSet { get; set; }
|
||||
|
||||
public GBLinkSettings Clone()
|
||||
{
|
||||
return (GBLinkSettings)MemberwiseClone();
|
||||
}
|
||||
public GBLinkSettings Clone() => (GBLinkSettings)MemberwiseClone();
|
||||
|
||||
public GBLinkSettings()
|
||||
{
|
||||
SettingsUtil.SetDefaultValues(this);
|
||||
}
|
||||
public GBLinkSettings() => SettingsUtil.SetDefaultValues(this);
|
||||
}
|
||||
|
||||
public class GBLinkSyncSettings
|
||||
|
@ -154,15 +142,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
[JsonIgnore]
|
||||
public ushort _DivInitialTime_R = 8;
|
||||
|
||||
public GBLinkSyncSettings Clone()
|
||||
{
|
||||
return (GBLinkSyncSettings)MemberwiseClone();
|
||||
}
|
||||
public GBLinkSyncSettings Clone() => (GBLinkSyncSettings)MemberwiseClone();
|
||||
|
||||
public GBLinkSyncSettings()
|
||||
{
|
||||
SettingsUtil.SetDefaultValues(this);
|
||||
}
|
||||
public GBLinkSyncSettings() => SettingsUtil.SetDefaultValues(this);
|
||||
|
||||
public static bool NeedsReboot(GBLinkSyncSettings x, GBLinkSyncSettings y)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
public GBHawkLink(CoreComm comm, GameInfo game_L, byte[] rom_L, GameInfo game_R, byte[] rom_R, /*string gameDbFn,*/ object settings, object syncSettings)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ServiceProvider = ser;
|
||||
|
||||
linkSettings = (GBLinkSettings)settings ?? new GBLinkSettings();
|
||||
linkSyncSettings = (GBLinkSyncSettings)syncSettings ?? new GBLinkSyncSettings();
|
||||
|
@ -68,8 +69,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
_tracer = new TraceBuffer { Header = L.cpu.TraceHeader };
|
||||
ser.Register<ITraceable>(_tracer);
|
||||
|
||||
ServiceProvider = ser;
|
||||
|
||||
_lStates = L.ServiceProvider.GetService<IStatable>();
|
||||
_rStates = R.ServiceProvider.GetService<IStatable>();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
{
|
||||
public partial class GBHawkLink3x : IEmulator, IVideoProvider, ISoundProvider
|
||||
{
|
||||
public IEmulatorServiceProvider ServiceProvider { get; } = new BasicServiceProvider();
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
public GBHawkLink3x(CoreComm comm, GameInfo game_L, byte[] rom_L, GameInfo game_C, byte[] rom_C, GameInfo game_R, byte[] rom_R, /*string gameDbFn,*/ object settings, object syncSettings)
|
||||
{
|
||||
var ser = new BasicServiceProvider(this);
|
||||
ServiceProvider = ser;
|
||||
|
||||
Link3xSettings = (GBLink3xSettings)settings ?? new GBLink3xSettings();
|
||||
Link3xSyncSettings = (GBLink3xSyncSettings)syncSettings ?? new GBLink3xSyncSettings();
|
||||
|
|
Loading…
Reference in New Issue