cleanup GBHawkLink3x
This commit is contained in:
parent
176b846f3b
commit
9418a57b54
|
@ -6,11 +6,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
{
|
||||
public partial class GBHawkLink3x : IEmulator, IVideoProvider, ISoundProvider
|
||||
{
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
public IEmulatorServiceProvider ServiceProvider { get; } = new BasicServiceProvider();
|
||||
|
||||
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
|
||||
|
@ -380,7 +380,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
R.vblank_rise = false;
|
||||
do_frame_fill = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetControllerState(IController controller)
|
||||
|
@ -417,10 +417,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
|
||||
public int[] _vidbuffer = new int[160 * 2 * 144 * 2];
|
||||
|
||||
public int[] GetVideoBuffer()
|
||||
{
|
||||
return _vidbuffer;
|
||||
}
|
||||
public int[] GetVideoBuffer() => _vidbuffer;
|
||||
|
||||
public void FillVideoBuffer()
|
||||
{
|
||||
|
@ -447,8 +444,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
public static readonly uint[] color_palette_BW = { 0xFFFFFFFF , 0xFFAAAAAA, 0xFF555555, 0xFF000000 };
|
||||
public static readonly uint[] color_palette_Gr = { 0xFFA4C505, 0xFF88A905, 0xFF1D551D, 0xFF052505 };
|
||||
|
||||
public uint[] color_palette = new uint[4];
|
||||
|
||||
#endregion
|
||||
|
||||
#region audio
|
||||
|
@ -467,32 +462,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
|
||||
public void GetSamplesSync(out short[] samples, out int nsamp)
|
||||
{
|
||||
short[] temp_samp_L;
|
||||
short[] temp_samp_C;
|
||||
short[] temp_samp_R;
|
||||
|
||||
int nsamp_L;
|
||||
int nsamp_C;
|
||||
int nsamp_R;
|
||||
|
||||
L.audio.GetSamplesSync(out temp_samp_L, out nsamp_L);
|
||||
C.audio.GetSamplesSync(out temp_samp_C, out nsamp_C);
|
||||
R.audio.GetSamplesSync(out temp_samp_R, out nsamp_R);
|
||||
L.audio.GetSamplesSync(out var tempSampL, out var nsampL);
|
||||
C.audio.GetSamplesSync(out var tempSampC, out var nsampC);
|
||||
R.audio.GetSamplesSync(out var tempSampR, out var nsampR);
|
||||
|
||||
if (Link3xSettings.AudioSet == GBLink3xSettings.AudioSrc.Left)
|
||||
{
|
||||
samples = temp_samp_L;
|
||||
nsamp = nsamp_L;
|
||||
samples = tempSampL;
|
||||
nsamp = nsampL;
|
||||
}
|
||||
else if (Link3xSettings.AudioSet == GBLink3xSettings.AudioSrc.Center)
|
||||
{
|
||||
samples = temp_samp_C;
|
||||
nsamp = nsamp_C;
|
||||
samples = tempSampC;
|
||||
nsamp = nsampC;
|
||||
}
|
||||
else if (Link3xSettings.AudioSet == GBLink3xSettings.AudioSrc.Right)
|
||||
{
|
||||
samples = temp_samp_R;
|
||||
nsamp = nsamp_R;
|
||||
samples = tempSampR;
|
||||
nsamp = nsampR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -513,11 +500,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
R.audio.DiscardSamples();
|
||||
}
|
||||
|
||||
private void GetSamples(short[] samples)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DisposeSound()
|
||||
{
|
||||
L.audio.DisposeSound();
|
||||
|
|
|
@ -58,22 +58,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
"System Bus L",
|
||||
0X10000,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => PeekSystemBusL(addr),
|
||||
(addr, value) => PokeSystemBusL(addr, value),
|
||||
PeekSystemBusL,
|
||||
PokeSystemBusL,
|
||||
1),
|
||||
new MemoryDomainDelegate(
|
||||
"System Bus C",
|
||||
0X10000,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => PeekSystemBusC(addr),
|
||||
(addr, value) => PokeSystemBusC(addr, value),
|
||||
PeekSystemBusC,
|
||||
PokeSystemBusC,
|
||||
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",
|
||||
|
@ -121,20 +121,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
|
||||
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 (C.cart_RAM != null)
|
||||
{
|
||||
var CartRamC = new MemoryDomainByteArray("Cart RAM C", MemoryDomain.Endian.Little, C.cart_RAM, true, 1);
|
||||
domains.Add(CartRamC);
|
||||
var cartRamC = new MemoryDomainByteArray("Cart RAM C", MemoryDomain.Endian.Little, C.cart_RAM, true, 1);
|
||||
domains.Add(cartRamC);
|
||||
}
|
||||
|
||||
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,29 +7,29 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
{
|
||||
public byte[] CloneSaveRam()
|
||||
{
|
||||
if ((L.cart_RAM != null) || (C.cart_RAM != null) || (R.cart_RAM != null))
|
||||
if (L.cart_RAM != null || C.cart_RAM != null || R.cart_RAM != null)
|
||||
{
|
||||
int Len1 = 0;
|
||||
int Len2 = 0;
|
||||
int Len3 = 0;
|
||||
int len1 = 0;
|
||||
int len2 = 0;
|
||||
int len3 = 0;
|
||||
int index = 0;
|
||||
|
||||
if (L.cart_RAM != null)
|
||||
{
|
||||
Len1 = L.cart_RAM.Length;
|
||||
len1 = L.cart_RAM.Length;
|
||||
}
|
||||
|
||||
if (C.cart_RAM != null)
|
||||
{
|
||||
Len2 = C.cart_RAM.Length;
|
||||
len2 = C.cart_RAM.Length;
|
||||
}
|
||||
|
||||
if (R.cart_RAM != null)
|
||||
{
|
||||
Len3 = R.cart_RAM.Length;
|
||||
len3 = R.cart_RAM.Length;
|
||||
}
|
||||
|
||||
byte[] temp = new byte[Len1 + Len2 + Len3];
|
||||
byte[] temp = new byte[len1 + len2 + len3];
|
||||
|
||||
if (L.cart_RAM != null)
|
||||
{
|
||||
|
|
|
@ -10,15 +10,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
{
|
||||
public partial class GBHawkLink3x : IEmulator, IStatable, ISettable<GBHawkLink3x.GBLink3xSettings, GBHawkLink3x.GBLink3xSyncSettings>
|
||||
{
|
||||
public GBLink3xSettings GetSettings()
|
||||
{
|
||||
return Link3xSettings.Clone();
|
||||
}
|
||||
public GBLink3xSettings GetSettings() => Link3xSettings.Clone();
|
||||
|
||||
public GBLink3xSyncSettings GetSyncSettings()
|
||||
{
|
||||
return Link3xSyncSettings.Clone();
|
||||
}
|
||||
public GBLink3xSyncSettings GetSyncSettings() => Link3xSyncSettings.Clone();
|
||||
|
||||
public bool PutSettings(GBLink3xSettings o)
|
||||
{
|
||||
|
@ -34,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
}
|
||||
|
||||
private GBLink3xSettings Link3xSettings = new GBLink3xSettings();
|
||||
public GBLink3xSyncSettings Link3xSyncSettings = new GBLink3xSyncSettings();
|
||||
private GBLink3xSyncSettings Link3xSyncSettings = new GBLink3xSyncSettings();
|
||||
|
||||
public class GBLink3xSettings
|
||||
{
|
||||
|
@ -66,15 +60,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
[DefaultValue(AudioSrc.Left)]
|
||||
public AudioSrc AudioSet { get; set; }
|
||||
|
||||
public GBLink3xSettings Clone()
|
||||
{
|
||||
return (GBLink3xSettings)MemberwiseClone();
|
||||
}
|
||||
public GBLink3xSettings Clone() => (GBLink3xSettings)MemberwiseClone();
|
||||
|
||||
public GBLink3xSettings()
|
||||
{
|
||||
SettingsUtil.SetDefaultValues(this);
|
||||
}
|
||||
public GBLink3xSettings() => SettingsUtil.SetDefaultValues(this);
|
||||
}
|
||||
|
||||
public class GBLink3xSyncSettings
|
||||
|
@ -177,15 +165,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
[JsonIgnore]
|
||||
public ushort _DivInitialTime_R = 8;
|
||||
|
||||
public GBLink3xSyncSettings Clone()
|
||||
{
|
||||
return (GBLink3xSyncSettings)MemberwiseClone();
|
||||
}
|
||||
public GBLink3xSyncSettings Clone() => (GBLink3xSyncSettings)MemberwiseClone();
|
||||
|
||||
public GBLink3xSyncSettings()
|
||||
{
|
||||
SettingsUtil.SetDefaultValues(this);
|
||||
}
|
||||
public GBLink3xSyncSettings() => SettingsUtil.SetDefaultValues(this);
|
||||
|
||||
public static bool NeedsReboot(GBLink3xSyncSettings x, GBLink3xSyncSettings y)
|
||||
{
|
||||
|
|
|
@ -39,50 +39,49 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
|
||||
CoreComm = comm;
|
||||
|
||||
var temp_set_L = new GBHawk.GBHawk.GBSettings();
|
||||
var temp_set_C = new GBHawk.GBHawk.GBSettings();
|
||||
var temp_set_R = new GBHawk.GBHawk.GBSettings();
|
||||
var tempSetL = new GBHawk.GBHawk.GBSettings();
|
||||
var tempSetC = new GBHawk.GBHawk.GBSettings();
|
||||
var tempSetR = new GBHawk.GBHawk.GBSettings();
|
||||
|
||||
var temp_sync_L = new GBHawk.GBHawk.GBSyncSettings();
|
||||
var temp_sync_C = new GBHawk.GBHawk.GBSyncSettings();
|
||||
var temp_sync_R = new GBHawk.GBHawk.GBSyncSettings();
|
||||
var tempSyncL = new GBHawk.GBHawk.GBSyncSettings();
|
||||
var tempSyncC = new GBHawk.GBHawk.GBSyncSettings();
|
||||
var tempSyncR = new GBHawk.GBHawk.GBSyncSettings();
|
||||
|
||||
temp_sync_L.ConsoleMode = Link3xSyncSettings.ConsoleMode_L;
|
||||
temp_sync_C.ConsoleMode = Link3xSyncSettings.ConsoleMode_C;
|
||||
temp_sync_R.ConsoleMode = Link3xSyncSettings.ConsoleMode_R;
|
||||
tempSyncL.ConsoleMode = Link3xSyncSettings.ConsoleMode_L;
|
||||
tempSyncC.ConsoleMode = Link3xSyncSettings.ConsoleMode_C;
|
||||
tempSyncR.ConsoleMode = Link3xSyncSettings.ConsoleMode_R;
|
||||
|
||||
temp_sync_L.GBACGB = Link3xSyncSettings.GBACGB;
|
||||
temp_sync_C.GBACGB = Link3xSyncSettings.GBACGB;
|
||||
temp_sync_R.GBACGB = Link3xSyncSettings.GBACGB;
|
||||
tempSyncL.GBACGB = Link3xSyncSettings.GBACGB;
|
||||
tempSyncC.GBACGB = Link3xSyncSettings.GBACGB;
|
||||
tempSyncR.GBACGB = Link3xSyncSettings.GBACGB;
|
||||
|
||||
temp_sync_L.RTCInitialTime = Link3xSyncSettings.RTCInitialTime_L;
|
||||
temp_sync_C.RTCInitialTime = Link3xSyncSettings.RTCInitialTime_C;
|
||||
temp_sync_R.RTCInitialTime = Link3xSyncSettings.RTCInitialTime_R;
|
||||
temp_sync_L.RTCOffset = Link3xSyncSettings.RTCOffset_L;
|
||||
temp_sync_C.RTCOffset = Link3xSyncSettings.RTCOffset_C;
|
||||
temp_sync_R.RTCOffset = Link3xSyncSettings.RTCOffset_R;
|
||||
tempSyncL.RTCInitialTime = Link3xSyncSettings.RTCInitialTime_L;
|
||||
tempSyncC.RTCInitialTime = Link3xSyncSettings.RTCInitialTime_C;
|
||||
tempSyncR.RTCInitialTime = Link3xSyncSettings.RTCInitialTime_R;
|
||||
tempSyncL.RTCOffset = Link3xSyncSettings.RTCOffset_L;
|
||||
tempSyncC.RTCOffset = Link3xSyncSettings.RTCOffset_C;
|
||||
tempSyncR.RTCOffset = Link3xSyncSettings.RTCOffset_R;
|
||||
|
||||
L = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify) { CoreFileProvider = comm.CoreFileProvider },
|
||||
game_L, rom_L, temp_set_L, temp_sync_L);
|
||||
game_L, rom_L, tempSetL, tempSyncL);
|
||||
|
||||
C = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify) { CoreFileProvider = comm.CoreFileProvider },
|
||||
game_C, rom_C, temp_set_C, temp_sync_C);
|
||||
game_C, rom_C, tempSetC, tempSyncC);
|
||||
|
||||
R = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify) { CoreFileProvider = comm.CoreFileProvider },
|
||||
game_R, rom_R, temp_set_R, temp_sync_R);
|
||||
game_R, rom_R, tempSetR, tempSyncR);
|
||||
|
||||
ser.Register<IVideoProvider>(this);
|
||||
ser.Register<ISoundProvider>(this);
|
||||
|
||||
_tracer = new TraceBuffer { Header = L.cpu.TraceHeader };
|
||||
ser.Register<ITraceable>(_tracer);
|
||||
ser.Register(_tracer);
|
||||
|
||||
_lStates = L.ServiceProvider.GetService<IStatable>();
|
||||
_cStates = C.ServiceProvider.GetService<IStatable>();
|
||||
_rStates = R.ServiceProvider.GetService<IStatable>();
|
||||
|
||||
SetupMemoryDomains();
|
||||
|
||||
HardReset();
|
||||
}
|
||||
|
||||
|
@ -100,11 +99,5 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
private readonly GBHawkLink3xControllerDeck _controllerDeck;
|
||||
|
||||
private readonly ITraceable _tracer;
|
||||
|
||||
private void ExecFetch(ushort addr)
|
||||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessExecute);
|
||||
MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue