GBHawk: Link Cable work
This commit is contained in:
parent
42764f0019
commit
12ad2d5b36
|
@ -351,7 +351,9 @@
|
|||
this.SaturnPreferencesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DGBSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DGBsettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GenesisSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DGBHawkSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DGBHawksettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GenesisSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.vDPViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GenesisGameGenieECDC = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator26 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -503,7 +505,8 @@
|
|||
this.N64SubMenu,
|
||||
this.SaturnSubMenu,
|
||||
this.DGBSubMenu,
|
||||
this.GenesisSubMenu,
|
||||
this.DGBHawkSubMenu,
|
||||
this.GenesisSubMenu,
|
||||
this.wonderSwanToolStripMenuItem,
|
||||
this.AppleSubMenu,
|
||||
this.C64SubMenu,
|
||||
|
@ -3177,10 +3180,25 @@
|
|||
this.DGBsettingsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.DGBsettingsToolStripMenuItem.Text = "Settings...";
|
||||
this.DGBsettingsToolStripMenuItem.Click += new System.EventHandler(this.DgbSettingsMenuItem_Click);
|
||||
//
|
||||
// GenesisSubMenu
|
||||
//
|
||||
this.GenesisSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
//
|
||||
// DGBHawkSubMenu
|
||||
//
|
||||
this.DGBHawkSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.DGBHawksettingsToolStripMenuItem});
|
||||
this.DGBHawkSubMenu.Name = "DGBHawkSubMenu";
|
||||
this.DGBHawkSubMenu.Size = new System.Drawing.Size(59, 19);
|
||||
this.DGBHawkSubMenu.Text = "&GB Link";
|
||||
//
|
||||
// DGBHawksettingsToolStripMenuItem
|
||||
//
|
||||
this.DGBHawksettingsToolStripMenuItem.Name = "DGBHawksettingsToolStripMenuItem";
|
||||
this.DGBHawksettingsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.DGBHawksettingsToolStripMenuItem.Text = "Settings...";
|
||||
this.DGBHawksettingsToolStripMenuItem.Click += new System.EventHandler(this.DgbHawkSettingsMenuItem_Click);
|
||||
//
|
||||
// GenesisSubMenu
|
||||
//
|
||||
this.GenesisSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.vDPViewerToolStripMenuItem,
|
||||
this.GenesisGameGenieECDC,
|
||||
this.toolStripSeparator26,
|
||||
|
@ -4504,6 +4522,8 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem FdsEjectDiskMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem DGBSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem DGBsettingsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem DGBHawkSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem DGBHawksettingsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem GenesisSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem GenesisSettingsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem AtariSettingsToolStripMenuItem;
|
||||
|
|
|
@ -2350,6 +2350,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
DGBPrefs.DoDGBPrefsDialog(this);
|
||||
}
|
||||
|
||||
private void DgbHawkSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
GenericCoreConfig.DoDialog(this, "Gameboy Settings");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GEN
|
||||
|
|
|
@ -24,6 +24,7 @@ using BizHawk.Emulation.Cores.Nintendo.GBA;
|
|||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SNES;
|
||||
using BizHawk.Emulation.Cores.Nintendo.N64;
|
||||
using BizHawk.Emulation.Cores.Nintendo.GBHawkLink;
|
||||
|
||||
using BizHawk.Client.EmuHawk.WinFormExtensions;
|
||||
using BizHawk.Client.EmuHawk.ToolExtensions;
|
||||
|
@ -1720,6 +1721,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
N64SubMenu.Visible = false;
|
||||
SaturnSubMenu.Visible = false;
|
||||
DGBSubMenu.Visible = false;
|
||||
DGBHawkSubMenu.Visible = false;
|
||||
GenesisSubMenu.Visible = false;
|
||||
wonderSwanToolStripMenuItem.Visible = false;
|
||||
AppleSubMenu.Visible = false;
|
||||
|
@ -1802,7 +1804,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
SaturnSubMenu.Visible = true;
|
||||
break;
|
||||
case "DGB":
|
||||
DGBSubMenu.Visible = true;
|
||||
if (Emulator is GBHawkLink)
|
||||
{
|
||||
DGBHawkSubMenu.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DGBSubMenu.Visible = true;
|
||||
}
|
||||
break;
|
||||
case "WSWAN":
|
||||
wonderSwanToolStripMenuItem.Visible = true;
|
||||
|
|
|
@ -168,6 +168,89 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
vblank_rise = false;
|
||||
}
|
||||
|
||||
public void do_single_step()
|
||||
{
|
||||
// These things do not change speed in GBC double spped mode
|
||||
audio.tick();
|
||||
ppu.tick();
|
||||
if (Use_MT) { mapper.Mapper_Tick(); }
|
||||
|
||||
if (!HDMA_transfer)
|
||||
{
|
||||
// These things all tick twice as fast in GBC double speed mode
|
||||
ppu.DMA_tick();
|
||||
timer.tick_1();
|
||||
serialport.serial_transfer_tick();
|
||||
cpu.ExecuteOne(ref REG_FF0F, REG_FFFF);
|
||||
timer.tick_2();
|
||||
|
||||
if (double_speed)
|
||||
{
|
||||
ppu.DMA_tick();
|
||||
timer.tick_1();
|
||||
serialport.serial_transfer_tick();
|
||||
cpu.ExecuteOne(ref REG_FF0F, REG_FFFF);
|
||||
timer.tick_2();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
timer.tick_1();
|
||||
timer.tick_2();
|
||||
cpu.TotalExecutedCycles++;
|
||||
if (double_speed)
|
||||
{
|
||||
timer.tick_1();
|
||||
timer.tick_2();
|
||||
cpu.TotalExecutedCycles++;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_vblank && !in_vblank_old)
|
||||
{
|
||||
vblank_rise = true;
|
||||
}
|
||||
|
||||
in_vblank_old = in_vblank;
|
||||
REG_FF0F_OLD = REG_FF0F;
|
||||
}
|
||||
|
||||
public void do_controller_check()
|
||||
{
|
||||
// check if new input changed the input register and triggered IRQ
|
||||
byte contr_prev = input_register;
|
||||
|
||||
input_register &= 0xF0;
|
||||
if ((input_register & 0x30) == 0x20)
|
||||
{
|
||||
input_register |= (byte)(controller_state & 0xF);
|
||||
}
|
||||
else if ((input_register & 0x30) == 0x10)
|
||||
{
|
||||
input_register |= (byte)((controller_state & 0xF0) >> 4);
|
||||
}
|
||||
else if ((input_register & 0x30) == 0x00)
|
||||
{
|
||||
// if both polls are set, then a bit is zero if either or both pins are zero
|
||||
byte temp = (byte)((controller_state & 0xF) & ((controller_state & 0xF0) >> 4));
|
||||
input_register |= temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
input_register |= 0xF;
|
||||
}
|
||||
|
||||
// check for interrupts
|
||||
if (((contr_prev & 8) > 0) && ((input_register & 8) == 0) ||
|
||||
((contr_prev & 4) > 0) && ((input_register & 4) == 0) ||
|
||||
((contr_prev & 2) > 0) && ((input_register & 2) == 0) ||
|
||||
((contr_prev & 1) > 0) && ((input_register & 1) == 0))
|
||||
{
|
||||
if (REG_FFFF.Bit(4)) { cpu.FlagI = true; }
|
||||
REG_FF0F |= 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
// Switch Speed (GBC only)
|
||||
public int SpeedFunc(int temp)
|
||||
{
|
||||
|
|
|
@ -4,9 +4,11 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using BizHawk.Emulation.Cores.Nintendo.GBHawk;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
||||
{
|
||||
public partial class GBHawkLink : IEmulator, IVideoProvider
|
||||
public partial class GBHawkLink : IEmulator, IVideoProvider, ISoundProvider
|
||||
{
|
||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||
|
||||
|
@ -20,6 +22,37 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
public void FrameAdvance(IController controller, bool render, bool rendersound)
|
||||
{
|
||||
//Console.WriteLine("-----------------------FRAME-----------------------");
|
||||
//Update the color palette if a setting changed
|
||||
if (linkSettings.Palette_L == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||
{
|
||||
L.color_palette[0] = color_palette_BW[0];
|
||||
L.color_palette[1] = color_palette_BW[1];
|
||||
L.color_palette[2] = color_palette_BW[2];
|
||||
L.color_palette[3] = color_palette_BW[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
L.color_palette[0] = color_palette_Gr[0];
|
||||
L.color_palette[1] = color_palette_Gr[1];
|
||||
L.color_palette[2] = color_palette_Gr[2];
|
||||
L.color_palette[3] = color_palette_Gr[3];
|
||||
}
|
||||
|
||||
if (linkSettings.Palette_R == GBHawk.GBHawk.GBSettings.PaletteType.BW)
|
||||
{
|
||||
R.color_palette[0] = color_palette_BW[0];
|
||||
R.color_palette[1] = color_palette_BW[1];
|
||||
R.color_palette[2] = color_palette_BW[2];
|
||||
R.color_palette[3] = color_palette_BW[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
R.color_palette[0] = color_palette_Gr[0];
|
||||
R.color_palette[1] = color_palette_Gr[1];
|
||||
R.color_palette[2] = color_palette_Gr[2];
|
||||
R.color_palette[3] = color_palette_Gr[3];
|
||||
}
|
||||
|
||||
if (_tracer.Enabled)
|
||||
{
|
||||
L.cpu.TraceCallback = s => _tracer.Put(s);
|
||||
|
@ -36,6 +69,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
HardReset();
|
||||
}
|
||||
|
||||
bool cablediscosignalNew = controller.IsPressed("Toggle Cable");
|
||||
if (cablediscosignalNew && !_cablediscosignal)
|
||||
{
|
||||
_cableconnected ^= true;
|
||||
Console.WriteLine("Cable connect status to {0}", _cableconnected);
|
||||
LinkConnected = _cableconnected;
|
||||
}
|
||||
|
||||
_cablediscosignal = cablediscosignalNew;
|
||||
|
||||
_islag = true;
|
||||
|
||||
GetControllerState(controller);
|
||||
|
@ -52,8 +95,27 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
|
||||
public void do_frame()
|
||||
{
|
||||
L.do_frame();
|
||||
R.do_frame();
|
||||
L.do_controller_check();
|
||||
R.do_controller_check();
|
||||
|
||||
// advance one full frame
|
||||
for (int i = 0; i < 70224; i++)
|
||||
{
|
||||
L.do_single_step();
|
||||
R.do_single_step();
|
||||
|
||||
// if we hit a frame boundary, update video
|
||||
if (L.vblank_rise)
|
||||
{
|
||||
buff_L = L.GetVideoBuffer();
|
||||
L.vblank_rise = false;
|
||||
}
|
||||
if (R.vblank_rise)
|
||||
{
|
||||
buff_R = R.GetVideoBuffer();
|
||||
R.vblank_rise = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetControllerState(IController controller)
|
||||
|
@ -65,7 +127,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
|
||||
public int Frame => _frame;
|
||||
|
||||
public string SystemId => "GB";
|
||||
public string SystemId => "DGB";
|
||||
|
||||
public bool DeterministicEmulation { get; set; }
|
||||
|
||||
|
@ -89,15 +151,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
public int _frameHz = 60;
|
||||
|
||||
public int[] _vidbuffer = new int[160 * 2 * 144];
|
||||
public int[] buff_L;
|
||||
public int[] buff_R;
|
||||
public int[] buff_L = new int[160 * 144];
|
||||
public int[] buff_R = new int[160 * 144];
|
||||
|
||||
public int[] GetVideoBuffer()
|
||||
{
|
||||
// combine the 2 video buffers from the instances
|
||||
buff_L = L.GetVideoBuffer();
|
||||
buff_R = R.GetVideoBuffer();
|
||||
|
||||
for (int i = 0; i < 144; i++)
|
||||
{
|
||||
for (int j = 0; j < 160; j++)
|
||||
|
@ -124,5 +183,71 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
public uint[] color_palette = new uint[4];
|
||||
|
||||
#endregion
|
||||
|
||||
#region audio
|
||||
|
||||
public bool CanProvideAsync => false;
|
||||
|
||||
public void SetSyncMode(SyncSoundMode mode)
|
||||
{
|
||||
if (mode != SyncSoundMode.Sync)
|
||||
{
|
||||
throw new InvalidOperationException("Only Sync mode is supported_");
|
||||
}
|
||||
}
|
||||
|
||||
public SyncSoundMode SyncMode => SyncSoundMode.Sync;
|
||||
|
||||
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);
|
||||
|
||||
if (linkSettings.AudioSet == GBLinkSettings.AudioSrc.Left)
|
||||
{
|
||||
samples = temp_samp_L;
|
||||
nsamp = nsamp_L;
|
||||
}
|
||||
else if (linkSettings.AudioSet == GBLinkSettings.AudioSrc.Right)
|
||||
{
|
||||
samples = temp_samp_R;
|
||||
nsamp = nsamp_R;
|
||||
}
|
||||
else
|
||||
{
|
||||
samples = new short[0];
|
||||
nsamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void GetSamplesAsync(short[] samples)
|
||||
{
|
||||
throw new NotSupportedException("Async is not available");
|
||||
}
|
||||
|
||||
public void DiscardSamples()
|
||||
{
|
||||
L.audio.DiscardSamples();
|
||||
R.audio.DiscardSamples();
|
||||
}
|
||||
|
||||
private void GetSamples(short[] samples)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DisposeSound()
|
||||
{
|
||||
L.audio.DisposeSound();
|
||||
R.audio.DisposeSound();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,43 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
{
|
||||
public byte[] CloneSaveRam()
|
||||
{
|
||||
if (L.cart_RAM != null)
|
||||
if ((L.cart_RAM != null) || (R.cart_RAM != null))
|
||||
{
|
||||
return (byte[])L.cart_RAM.Clone();
|
||||
int Len1 = 0;
|
||||
int Len2 = 0;
|
||||
int index = 0;
|
||||
|
||||
if (L.cart_RAM != null)
|
||||
{
|
||||
Len1 = L.cart_RAM.Length;
|
||||
}
|
||||
|
||||
if (R.cart_RAM != null)
|
||||
{
|
||||
Len2 = R.cart_RAM.Length;
|
||||
}
|
||||
|
||||
byte[] temp = new byte[Len1 + Len2];
|
||||
|
||||
if (L.cart_RAM != null)
|
||||
{
|
||||
for (int i = 0; i < L.cart_RAM.Length; i++)
|
||||
{
|
||||
temp[index] = L.cart_RAM[i];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
if (R.cart_RAM != null)
|
||||
{
|
||||
for (int i = 0; i < L.cart_RAM.Length; i++)
|
||||
{
|
||||
temp[index] = R.cart_RAM[i];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -19,7 +53,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
|
||||
public void StoreSaveRam(byte[] data)
|
||||
{
|
||||
Buffer.BlockCopy(data, 0, L.cart_RAM, 0, data.Length);
|
||||
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))
|
||||
{
|
||||
Buffer.BlockCopy(data, 0, R.cart_RAM, 0, R.cart_RAM.Length);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
Console.WriteLine("loading SRAM here");
|
||||
}
|
||||
|
||||
|
@ -27,7 +74,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
{
|
||||
get
|
||||
{
|
||||
return L.has_bat & _syncSettings.L.Use_SRAM;
|
||||
return (L.has_bat || R.has_bat) & linkSyncSettings.Use_SRAM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,78 +13,133 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
{
|
||||
public GBLinkSettings GetSettings()
|
||||
{
|
||||
return new GBLinkSettings
|
||||
(
|
||||
L.GetSettings(),
|
||||
R.GetSettings()
|
||||
);
|
||||
return linkSettings.Clone();
|
||||
}
|
||||
|
||||
public GBLinkSyncSettings GetSyncSettings()
|
||||
{
|
||||
return new GBLinkSyncSettings
|
||||
(
|
||||
L.GetSyncSettings(),
|
||||
R.GetSyncSettings()
|
||||
);
|
||||
return linkSyncSettings.Clone();
|
||||
}
|
||||
|
||||
public bool PutSettings(GBLinkSettings o)
|
||||
{
|
||||
return L.PutSettings(o.L) || R.PutSettings(o.R);
|
||||
linkSettings = o;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool PutSyncSettings(GBLinkSyncSettings o)
|
||||
{
|
||||
return L.PutSyncSettings(o.L) || R.PutSyncSettings(o.R);
|
||||
bool ret = GBLinkSyncSettings.NeedsReboot(linkSyncSettings, o);
|
||||
linkSyncSettings = o;
|
||||
return ret;
|
||||
}
|
||||
|
||||
private GBLinkSettings _settings = new GBLinkSettings();
|
||||
public GBLinkSyncSettings _syncSettings = new GBLinkSyncSettings();
|
||||
private GBLinkSettings linkSettings = new GBLinkSettings();
|
||||
public GBLinkSyncSettings linkSyncSettings = new GBLinkSyncSettings();
|
||||
|
||||
public class GBLinkSettings
|
||||
{
|
||||
public GBHawk.GBHawk.GBSettings L;
|
||||
public GBHawk.GBHawk.GBSettings R;
|
||||
[DisplayName("Color Mode")]
|
||||
[Description("Pick Between Green scale and Grey scale colors")]
|
||||
[DefaultValue(GBHawk.GBHawk.GBSettings.PaletteType.BW)]
|
||||
public GBHawk.GBHawk.GBSettings.PaletteType Palette_L { get; set; }
|
||||
|
||||
public GBLinkSettings()
|
||||
[DisplayName("Color Mode")]
|
||||
[Description("Pick Between Green scale and Grey scale colors")]
|
||||
[DefaultValue(GBHawk.GBHawk.GBSettings.PaletteType.BW)]
|
||||
public GBHawk.GBHawk.GBSettings.PaletteType Palette_R { get; set; }
|
||||
|
||||
public enum AudioSrc
|
||||
{
|
||||
L = new GBHawk.GBHawk.GBSettings();
|
||||
R = new GBHawk.GBHawk.GBSettings();
|
||||
Left,
|
||||
Right,
|
||||
Both
|
||||
}
|
||||
|
||||
public GBLinkSettings(GBHawk.GBHawk.GBSettings L, GBHawk.GBHawk.GBSettings R)
|
||||
{
|
||||
this.L = L;
|
||||
this.R = R;
|
||||
}
|
||||
[DisplayName("Audio Selection")]
|
||||
[Description("Choose Audio Source. Both will produce Stereo sound.")]
|
||||
[DefaultValue(AudioSrc.Left)]
|
||||
public AudioSrc AudioSet { get; set; }
|
||||
|
||||
public GBLinkSettings Clone()
|
||||
{
|
||||
return new GBLinkSettings(L.Clone(), R.Clone());
|
||||
return (GBLinkSettings)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public class GBLinkSyncSettings
|
||||
{
|
||||
public GBHawk.GBHawk.GBSyncSettings L;
|
||||
public GBHawk.GBHawk.GBSyncSettings R;
|
||||
[DisplayName("Console Mode L")]
|
||||
[Description("Pick which console to run, 'Auto' chooses from ROM extension, 'GB' and 'GBC' chooses the respective system")]
|
||||
[DefaultValue(GBHawk.GBHawk.GBSyncSettings.ConsoleModeType.Auto)]
|
||||
public GBHawk.GBHawk.GBSyncSettings.ConsoleModeType ConsoleMode_L { get; set; }
|
||||
|
||||
public GBLinkSyncSettings()
|
||||
[DisplayName("Console Mode R")]
|
||||
[Description("Pick which console to run, 'Auto' chooses from ROM extension, 'GB' and 'GBC' chooses the respective system")]
|
||||
[DefaultValue(GBHawk.GBHawk.GBSyncSettings.ConsoleModeType.Auto)]
|
||||
public GBHawk.GBHawk.GBSyncSettings.ConsoleModeType ConsoleMode_R { get; set; }
|
||||
|
||||
[DisplayName("CGB in GBA")]
|
||||
[Description("Emulate GBA hardware running a CGB game, instead of CGB hardware. Relevant only for titles that detect the presense of a GBA, such as Shantae.")]
|
||||
[DefaultValue(false)]
|
||||
public bool GBACGB { get; set; }
|
||||
|
||||
[DisplayName("RTC Initial Time L")]
|
||||
[Description("Set the initial RTC time in terms of elapsed seconds.")]
|
||||
[DefaultValue(0)]
|
||||
public int RTCInitialTime_L
|
||||
{
|
||||
L = new GBHawk.GBHawk.GBSyncSettings();
|
||||
R = new GBHawk.GBHawk.GBSyncSettings();
|
||||
get { return _RTCInitialTime_L; }
|
||||
set { _RTCInitialTime_L = Math.Max(0, Math.Min(1024 * 24 * 60 * 60, value)); }
|
||||
}
|
||||
|
||||
public GBLinkSyncSettings(GBHawk.GBHawk.GBSyncSettings L, GBHawk.GBHawk.GBSyncSettings R)
|
||||
[DisplayName("RTC Initial Time R")]
|
||||
[Description("Set the initial RTC time in terms of elapsed seconds.")]
|
||||
[DefaultValue(0)]
|
||||
public int RTCInitialTime_R
|
||||
{
|
||||
this.L = L;
|
||||
this.R = R;
|
||||
get { return _RTCInitialTime_R; }
|
||||
set { _RTCInitialTime_R = Math.Max(0, Math.Min(1024 * 24 * 60 * 60, value)); }
|
||||
}
|
||||
|
||||
[DisplayName("Timer Div Initial Time L")]
|
||||
[Description("Don't change from 0 unless it's hardware accurate. GBA GBC mode is known to be 8.")]
|
||||
[DefaultValue(8)]
|
||||
public int DivInitialTime_L
|
||||
{
|
||||
get { return _DivInitialTime_L; }
|
||||
set { _DivInitialTime_L = Math.Min((ushort)65535, (ushort)value); }
|
||||
}
|
||||
|
||||
[DisplayName("Timer Div Initial Time R")]
|
||||
[Description("Don't change from 0 unless it's hardware accurate. GBA GBC mode is known to be 8.")]
|
||||
[DefaultValue(8)]
|
||||
public int DivInitialTime_R
|
||||
{
|
||||
get { return _DivInitialTime_R; }
|
||||
set { _DivInitialTime_R = Math.Min((ushort)65535, (ushort)value); }
|
||||
}
|
||||
|
||||
[DisplayName("Use Existing SaveRAM")]
|
||||
[Description("When true, existing SaveRAM will be loaded at boot up")]
|
||||
[DefaultValue(false)]
|
||||
public bool Use_SRAM { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
private int _RTCInitialTime_L;
|
||||
private int _RTCInitialTime_R;
|
||||
[JsonIgnore]
|
||||
public ushort _DivInitialTime_L;
|
||||
public ushort _DivInitialTime_R;
|
||||
|
||||
public GBLinkSyncSettings Clone()
|
||||
{
|
||||
return new GBLinkSyncSettings(L.Clone(), R.Clone());
|
||||
return (GBLinkSyncSettings)MemberwiseClone();
|
||||
}
|
||||
|
||||
public static bool NeedsReboot(GBLinkSyncSettings x, GBLinkSyncSettings y)
|
||||
{
|
||||
return !DeepEquality.DeepEquals(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
"GBHawkLink",
|
||||
"",
|
||||
isPorted: false,
|
||||
isReleased: true)]
|
||||
isReleased: false)]
|
||||
[ServiceNotApplicable(typeof(IDriveLight))]
|
||||
public partial class GBHawkLink : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable, ILinkable,
|
||||
ISettable<GBHawkLink.GBLinkSettings, GBHawkLink.GBLinkSyncSettings>
|
||||
|
@ -24,25 +24,45 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
public GBHawk.GBHawk L;
|
||||
public GBHawk.GBHawk R;
|
||||
|
||||
// if true, the link cable is currently connected
|
||||
private bool _cableconnected = true;
|
||||
|
||||
// if true, the link cable toggle signal is currently asserted
|
||||
private bool _cablediscosignal = false;
|
||||
|
||||
//[CoreConstructor("GB", "GBC")]
|
||||
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);
|
||||
|
||||
GBLinkSettings linkSettings = (GBLinkSettings)settings ?? new GBLinkSettings();
|
||||
GBLinkSyncSettings linkSyncSettings = (GBLinkSyncSettings)syncSettings ?? new GBLinkSyncSettings();
|
||||
linkSettings = (GBLinkSettings)settings ?? new GBLinkSettings();
|
||||
linkSyncSettings = (GBLinkSyncSettings)syncSettings ?? new GBLinkSyncSettings();
|
||||
_controllerDeck = new GBHawkLinkControllerDeck(GBHawkControllerDeck.DefaultControllerName, GBHawkControllerDeck.DefaultControllerName);
|
||||
|
||||
CoreComm = comm;
|
||||
|
||||
var temp_set_L = new GBHawk.GBHawk.GBSettings();
|
||||
var temp_set_R = new GBHawk.GBHawk.GBSettings();
|
||||
|
||||
var temp_sync_L = new GBHawk.GBHawk.GBSyncSettings();
|
||||
var temp_sync_R = new GBHawk.GBHawk.GBSyncSettings();
|
||||
|
||||
temp_sync_L.ConsoleMode = linkSyncSettings.ConsoleMode_L;
|
||||
temp_sync_R.ConsoleMode = linkSyncSettings.ConsoleMode_R;
|
||||
|
||||
temp_sync_L.DivInitialTime = linkSyncSettings.DivInitialTime_L;
|
||||
temp_sync_R.DivInitialTime = linkSyncSettings.DivInitialTime_R;
|
||||
temp_sync_L.RTCInitialTime = linkSyncSettings.RTCInitialTime_L;
|
||||
temp_sync_R.RTCInitialTime = linkSyncSettings.RTCInitialTime_R;
|
||||
|
||||
L = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify) { CoreFileProvider = comm.CoreFileProvider },
|
||||
game_L, rom_L, linkSettings.L, linkSyncSettings.L);
|
||||
game_L, rom_L, temp_set_L, temp_sync_L);
|
||||
|
||||
R = new GBHawk.GBHawk(new CoreComm(comm.ShowMessage, comm.Notify) { CoreFileProvider = comm.CoreFileProvider },
|
||||
game_R, rom_R, linkSettings.R, linkSyncSettings.R);
|
||||
game_R, rom_R, temp_set_R, temp_sync_R);
|
||||
|
||||
ser.Register<IVideoProvider>(this);
|
||||
ser.Register<ISoundProvider>(L.audio);
|
||||
ser.Register<ISoundProvider>(this);
|
||||
|
||||
_tracer = new TraceBuffer { Header = L.cpu.TraceHeader };
|
||||
ser.Register<ITraceable>(_tracer);
|
||||
|
@ -52,16 +72,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
SetupMemoryDomains();
|
||||
|
||||
HardReset();
|
||||
|
||||
L.color_palette[0] = color_palette_BW[0];
|
||||
L.color_palette[1] = color_palette_BW[1];
|
||||
L.color_palette[2] = color_palette_BW[2];
|
||||
L.color_palette[3] = color_palette_BW[3];
|
||||
|
||||
R.color_palette[0] = color_palette_BW[0];
|
||||
R.color_palette[1] = color_palette_BW[1];
|
||||
R.color_palette[2] = color_palette_BW[2];
|
||||
R.color_palette[3] = color_palette_BW[3];
|
||||
}
|
||||
|
||||
public void HardReset()
|
||||
|
@ -78,7 +88,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
|
||||
private readonly ITraceable _tracer;
|
||||
|
||||
bool ILinkable.LinkConnected { get; }
|
||||
public bool LinkConnected { get; private set; }
|
||||
|
||||
private void ExecFetch(ushort addr)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[] { "Toggle Cable" } )
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue