saturn to new settings system
This commit is contained in:
parent
f122105b42
commit
e3165459d8
|
@ -294,7 +294,7 @@ namespace BizHawk.Client.Common
|
|||
break;
|
||||
case "SAT":
|
||||
{
|
||||
var saturn = new Yabause(nextComm, disc, Global.Config.SaturnUseGL);
|
||||
var saturn = new Yabause(nextComm, disc, GetCoreSyncSettings<Yabause>());
|
||||
nextEmulator = saturn;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -409,13 +409,6 @@ namespace BizHawk.Client.Common
|
|||
public bool SNES_ShowOBJ3 = true;
|
||||
public bool SNES_ShowOBJ4 = true;
|
||||
|
||||
// SATURN GRAPHICS SETTINGS
|
||||
public bool SaturnUseGL = false;
|
||||
public int SaturnDispFactor = 1;
|
||||
public bool SaturnDispFree = false;
|
||||
public int SaturnGLW = 640;
|
||||
public int SaturnGLH = 480;
|
||||
|
||||
// PCE BG Viewer settings
|
||||
public bool PCEBGViewerSaveWIndowPosition = true;
|
||||
public bool PCEBGViewerAutoload = false;
|
||||
|
@ -423,14 +416,6 @@ namespace BizHawk.Client.Common
|
|||
public int PCEBGViewerWndy = -1;
|
||||
public int PCEBGViewerRefreshRate = 16;
|
||||
|
||||
// Coleco Settings
|
||||
//public bool ColecoSkipBiosIntro = false;
|
||||
|
||||
//GB Debugger settings
|
||||
public bool AutoloadGBDebugger = false;
|
||||
public bool GBDebuggerSaveWindowPosition = true;
|
||||
public bool GameBoySkipBIOS = true;
|
||||
|
||||
#region Cheats Dialog
|
||||
|
||||
public bool Cheats_ValuesAsHex = true;
|
||||
|
|
|
@ -1637,11 +1637,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
using (var dlg = new SaturnPrefs())
|
||||
{
|
||||
var result = dlg.ShowDialog(this);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
SaturnSetPrefs();
|
||||
}
|
||||
dlg.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1376,32 +1376,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void SaturnSetPrefs(Yabause e = null)
|
||||
{
|
||||
if (e == null)
|
||||
{
|
||||
e = Global.Emulator as Yabause;
|
||||
}
|
||||
|
||||
if (Global.Config.SaturnUseGL != e.GLMode)
|
||||
{
|
||||
// theoretically possible; not coded. meh.
|
||||
FlagNeedsReboot();
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.GLMode && Global.Config.SaturnUseGL)
|
||||
{
|
||||
if (Global.Config.SaturnDispFree)
|
||||
{
|
||||
e.SetGLRes(0, Global.Config.SaturnGLW, Global.Config.SaturnGLH);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.SetGLRes(Global.Config.SaturnDispFactor, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HandlePlatformMenus()
|
||||
{
|
||||
|
@ -2891,11 +2866,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (result)
|
||||
{
|
||||
if (loader.LoadedEmulator is Yabause)
|
||||
{
|
||||
SaturnSetPrefs(loader.LoadedEmulator as Yabause);
|
||||
}
|
||||
else if (loader.LoadedEmulator is TI83)
|
||||
if (loader.LoadedEmulator is TI83)
|
||||
{
|
||||
if (Global.Config.TI83autoloadKeyPad)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Text;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Sega.Saturn;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -18,13 +19,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
InitializeComponent();
|
||||
try
|
||||
{
|
||||
radioButtonGL.Checked = Global.Config.SaturnUseGL;
|
||||
radioButtonSoft.Checked = !Global.Config.SaturnUseGL;
|
||||
radioButtonFree.Checked = Global.Config.SaturnDispFree;
|
||||
radioButtonFactor.Checked = !Global.Config.SaturnDispFree;
|
||||
numericUpDownFactor.Value = Global.Config.SaturnDispFactor;
|
||||
numericUpDown1.Value = Global.Config.SaturnGLW;
|
||||
numericUpDown2.Value = Global.Config.SaturnGLH;
|
||||
var ss = (Yabause.SaturnSyncSettings)Global.Emulator.GetSyncSettings();
|
||||
|
||||
radioButtonGL.Checked = ss.UseGL;
|
||||
radioButtonSoft.Checked = !ss.UseGL;
|
||||
radioButtonFree.Checked = ss.DispFree;
|
||||
radioButtonFactor.Checked = !ss.DispFree;
|
||||
numericUpDownFactor.Value = ss.DispFactor;
|
||||
numericUpDown1.Value = ss.GLW;
|
||||
numericUpDown2.Value = ss.GLH;
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
|
@ -44,11 +47,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void buttonOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.SaturnUseGL = radioButtonGL.Checked;
|
||||
Global.Config.SaturnDispFree = radioButtonFree.Checked;
|
||||
Global.Config.SaturnDispFactor = (int)numericUpDownFactor.Value;
|
||||
Global.Config.SaturnGLW = (int)numericUpDown1.Value;
|
||||
Global.Config.SaturnGLH = (int)numericUpDown2.Value;
|
||||
var ss = (Yabause.SaturnSyncSettings)Global.Emulator.GetSyncSettings();
|
||||
ss.UseGL = radioButtonGL.Checked;
|
||||
ss.DispFree = radioButtonFree.Checked;
|
||||
ss.DispFactor = (int)numericUpDownFactor.Value;
|
||||
ss.GLW = (int)numericUpDown1.Value;
|
||||
ss.GLH = (int)numericUpDown2.Value;
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(ss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,21 +41,26 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
|
||||
LibYabause.InputCallback InputCallbackH;
|
||||
|
||||
public Yabause(CoreComm CoreComm, DiscSystem.Disc CD, bool GL)
|
||||
public Yabause(CoreComm CoreComm, DiscSystem.Disc CD, object SyncSettings)
|
||||
{
|
||||
byte[] bios = CoreComm.CoreFileProvider.GetFirmware("SAT", "J", true, "Saturn BIOS is required.");
|
||||
CoreComm.RomStatusDetails = string.Format("Disk partial hash:{0}", CD.GetHash());
|
||||
this.CoreComm = CoreComm;
|
||||
this.CD = CD;
|
||||
|
||||
this.SyncSettings = (SaturnSyncSettings)SyncSettings ?? new SaturnSyncSettings();
|
||||
|
||||
ResetCounters();
|
||||
Init(bios, GL);
|
||||
Init(bios);
|
||||
|
||||
InputCallbackH = new LibYabause.InputCallback(() => CoreComm.InputCallback.Call());
|
||||
LibYabause.libyabause_setinputcallback(InputCallbackH);
|
||||
}
|
||||
|
||||
void Init(byte[] bios, bool GL = false)
|
||||
void Init(byte[] bios)
|
||||
{
|
||||
bool GL = SyncSettings.UseGL;
|
||||
|
||||
if (AttachedCore != null)
|
||||
{
|
||||
AttachedCore.Dispose();
|
||||
|
@ -92,6 +97,8 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
InitMemoryDomains();
|
||||
|
||||
GLMode = GL;
|
||||
// if in GL mode, this will trigger the initial GL resize
|
||||
PutSyncSettings(this.SyncSettings);
|
||||
}
|
||||
|
||||
public ControllerDefinition ControllerDefinition
|
||||
|
@ -632,9 +639,42 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
|
||||
#endregion
|
||||
|
||||
SaturnSyncSettings SyncSettings;
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public object GetSyncSettings() { return SyncSettings.Clone(); }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
public bool PutSyncSettings(object o) { return false; }
|
||||
public bool PutSyncSettings(object o)
|
||||
{
|
||||
var n = (SaturnSyncSettings)o;
|
||||
bool ret = SaturnSyncSettings.NeedsReboot(SyncSettings, n);
|
||||
|
||||
SyncSettings = n;
|
||||
|
||||
if (GLMode && SyncSettings.UseGL)
|
||||
if (SyncSettings.DispFree)
|
||||
SetGLRes(0, SyncSettings.GLW, SyncSettings.GLH);
|
||||
else
|
||||
SetGLRes(SyncSettings.DispFactor, 0, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public class SaturnSyncSettings
|
||||
{
|
||||
public bool UseGL = false;
|
||||
public int DispFactor = 1;
|
||||
public bool DispFree = false;
|
||||
public int GLW = 640;
|
||||
public int GLH = 480;
|
||||
|
||||
public static bool NeedsReboot(SaturnSyncSettings x, SaturnSyncSettings y)
|
||||
{
|
||||
return x.UseGL != y.UseGL;
|
||||
}
|
||||
public SaturnSyncSettings Clone()
|
||||
{
|
||||
return (SaturnSyncSettings)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue