SNES: connect to new settings system.. everything should work?

This commit is contained in:
goyuken 2013-12-27 17:59:19 +00:00
parent 5e0db12638
commit 75d39ac60f
11 changed files with 287 additions and 268 deletions

View File

@ -33,6 +33,11 @@ namespace BizHawk.Client.Common
return Path.Combine(Path.GetDirectoryName(SubfileDirectory) ?? String.Empty, fname); return Path.Combine(Path.GetDirectoryName(SubfileDirectory) ?? String.Empty, fname);
} }
public string DllPath()
{
return Path.Combine(PathManager.GetExeDirectoryAbsolute(), "dll");
}
#region EmuLoadHelper api #region EmuLoadHelper api
void FirmwareWarn(string sysID, string firmwareID, bool required, string msg = null) void FirmwareWarn(string sysID, string firmwareID, bool required, string msg = null)
{ {
@ -95,45 +100,6 @@ namespace BizHawk.Client.Common
var cfp = new CoreFileProvider(target.ShowMessage); var cfp = new CoreFileProvider(target.ShowMessage);
target.CoreFileProvider = cfp; target.CoreFileProvider = cfp;
cfp.FirmwareManager = Global.FirmwareManager; cfp.FirmwareManager = Global.FirmwareManager;
//target.NES_BackdropColor = Global.Config.NESBackgroundColor;
//target.NES_UnlimitedSprites = Global.Config.NESAllowMoreThanEightSprites;
//target.NES_ShowBG = Global.Config.NESDispBackground;
//target.NES_ShowOBJ = Global.Config.NESDispSprites;
//target.PCE_ShowBG1 = Global.Config.PCEDispBG1;
//target.PCE_ShowOBJ1 = Global.Config.PCEDispOBJ1;
//target.PCE_ShowBG2 = Global.Config.PCEDispBG2;
//target.PCE_ShowOBJ2 = Global.Config.PCEDispOBJ2;
//target.SMS_ShowBG = Global.Config.SMSDispBG;
//target.SMS_ShowOBJ = Global.Config.SMSDispOBJ;
target.SNES_ShowBG1_0 = Global.Config.SNES_ShowBG1_0;
target.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_1;
target.SNES_ShowBG2_0 = Global.Config.SNES_ShowBG2_0;
target.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_1;
target.SNES_ShowBG3_0 = Global.Config.SNES_ShowBG3_0;
target.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_1;
target.SNES_ShowBG4_0 = Global.Config.SNES_ShowBG4_0;
target.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_1;
target.SNES_ShowOBJ_0 = Global.Config.SNES_ShowOBJ1;
target.SNES_ShowOBJ_1 = Global.Config.SNES_ShowOBJ2;
target.SNES_ShowOBJ_2 = Global.Config.SNES_ShowOBJ3;
target.SNES_ShowOBJ_3 = Global.Config.SNES_ShowOBJ4;
target.SNES_Profile = Global.Config.SNESProfile;
target.SNES_UseRingBuffer = Global.Config.SNESUseRingBuffer;
target.SNES_AlwaysDoubleSize = Global.Config.SNESAlwaysDoubleSize;
//target.GG_HighlightActiveDisplayRegion = Global.Config.GGHighlightActiveDisplayRegion;
//target.GG_ShowClippedRegions = Global.Config.GGShowClippedRegions;
//target.Atari2600_ShowBG = Global.Config.Atari2600_ShowBG;
//target.Atari2600_ShowPlayer1 = Global.Config.Atari2600_ShowPlayer1;
//target.Atari2600_ShowPlayer2 = Global.Config.Atari2600_ShowPlayer2;
//target.Atari2600_ShowMissle1 = Global.Config.Atari2600_ShowMissle1;
//target.Atari2600_ShowMissle2 = Global.Config.Atari2600_ShowMissle2;
//target.Atari2600_ShowBall = Global.Config.Atari2600_ShowBall;
//target.Atari2600_ShowPF = Global.Config.Atari2600_ShowPlayfield;
} }
} }
} }

View File

@ -48,53 +48,6 @@ namespace BizHawk.Client.Common
return e.Settings; return e.Settings;
} }
#region SNES specific stuff - clean up or move elsewhere
private readonly Dictionary<string, string> _snesPrepared = new Dictionary<string, string>();
// Contains a mapping: profilename->exepath ; or null if the exe wasnt available
private string SNES_Prepare(string profile)
{
SNES_Check(profile);
if (_snesPrepared[profile] == null)
{
throw new InvalidOperationException("Couldn't locate the executable for SNES emulation for profile: " + profile + ". Please make sure you're using a fresh dearchive of a BizHawk distribution.");
}
return _snesPrepared[profile];
}
private void SNES_Check(string profile)
{
if (_snesPrepared.ContainsKey(profile))
{
return;
}
const string bits = "32";
// disabled til it works
// if (Win32.Is64BitOperatingSystem)
// bits = "64";
var exename = "libsneshawk-" + bits + "-" + profile.ToLower() + ".exe";
var thisDir = PathManager.GetExeDirectoryAbsolute();
var exePath = Path.Combine(thisDir, exename);
if (!File.Exists(exePath))
{
exePath = Path.Combine(Path.Combine(thisDir, "dll"), exename);
}
if (!File.Exists(exePath))
{
exePath = null;
}
_snesPrepared[profile] = exePath;
}
#endregion
public RomLoader() public RomLoader()
{ {
Deterministic = true; Deterministic = true;
@ -396,13 +349,10 @@ namespace BizHawk.Client.Common
{ {
case "SNES": case "SNES":
{ {
game.System = "SNES";
nextComm.SNES_ExePath = SNES_Prepare(Global.Config.SNESProfile);
// need to get rid of this hack at some point // need to get rid of this hack at some point
((CoreFileProvider)nextComm.CoreFileProvider).SubfileDirectory = Path.GetDirectoryName(path.Replace("|", string.Empty)); //Dirty hack to get around archive filenames (since we are just getting the directory path, it is safe to mangle the filename ((CoreFileProvider)nextComm.CoreFileProvider).SubfileDirectory = Path.GetDirectoryName(path.Replace("|", string.Empty)); //Dirty hack to get around archive filenames (since we are just getting the directory path, it is safe to mangle the filename
var snes = new LibsnesCore(nextComm); var snes = new LibsnesCore(nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
nextEmulator = snes; nextEmulator = snes;
byte[] romData = isXml ? null : rom.FileData; byte[] romData = isXml ? null : rom.FileData;
byte[] xmlData = isXml ? rom.FileData : null; byte[] xmlData = isXml ? rom.FileData : null;
@ -453,8 +403,7 @@ namespace BizHawk.Client.Common
{ {
game.System = "SNES"; game.System = "SNES";
game.AddOption("SGB"); game.AddOption("SGB");
nextComm.SNES_ExePath = SNES_Prepare(Global.Config.SNESProfile); var snes = new LibsnesCore(nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
var snes = new LibsnesCore(nextComm);
nextEmulator = snes; nextEmulator = snes;
snes.Load(game, rom.FileData, Deterministic, null); snes.Load(game, rom.FileData, Deterministic, null);
} }

View File

@ -390,24 +390,24 @@ namespace BizHawk.Client.Common
public int SNESGraphicsDebuggerRefreshRate = 4; public int SNESGraphicsDebuggerRefreshRate = 4;
public bool SNESGraphicsUseUserBackdropColor = false; public bool SNESGraphicsUseUserBackdropColor = false;
public int SNESGraphicsUserBackdropColor = -1; public int SNESGraphicsUserBackdropColor = -1;
public string SNESPalette = "BizHawk"; //public string SNESPalette = "BizHawk";
// SNES Graphics settings // SNES Graphics settings
//bsnes allows the layers to be enabled for each priority level. //bsnes allows the layers to be enabled for each priority level.
//this may not be important for the bg (there are two priority levels) //this may not be important for the bg (there are two priority levels)
//but it may be useful for OBJ, so we might want to control them separately //but it may be useful for OBJ, so we might want to control them separately
public bool SNES_ShowBG1_0 = true; //public bool SNES_ShowBG1_0 = true;
public bool SNES_ShowBG2_0 = true; //public bool SNES_ShowBG2_0 = true;
public bool SNES_ShowBG3_0 = true; //public bool SNES_ShowBG3_0 = true;
public bool SNES_ShowBG4_0 = true; //public bool SNES_ShowBG4_0 = true;
public bool SNES_ShowBG1_1 = true; //public bool SNES_ShowBG1_1 = true;
public bool SNES_ShowBG2_1 = true; //public bool SNES_ShowBG2_1 = true;
public bool SNES_ShowBG3_1 = true; //public bool SNES_ShowBG3_1 = true;
public bool SNES_ShowBG4_1 = true; //public bool SNES_ShowBG4_1 = true;
public bool SNES_ShowOBJ1 = true; //public bool SNES_ShowOBJ1 = true;
public bool SNES_ShowOBJ2 = true; //public bool SNES_ShowOBJ2 = true;
public bool SNES_ShowOBJ3 = true; //public bool SNES_ShowOBJ3 = true;
public bool SNES_ShowOBJ4 = true; //public bool SNES_ShowOBJ4 = true;
// PCE BG Viewer settings // PCE BG Viewer settings
public bool PCEBGViewerSaveWIndowPosition = true; public bool PCEBGViewerSaveWIndowPosition = true;
@ -577,9 +577,9 @@ namespace BizHawk.Client.Common
public Dictionary<string, Dictionary<string, AnalogBind>> AllTrollersAnalog = new Dictionary<string, Dictionary<string, AnalogBind>>(); public Dictionary<string, Dictionary<string, AnalogBind>> AllTrollersAnalog = new Dictionary<string, Dictionary<string, AnalogBind>>();
//SNES settings //SNES settings
public string SNESProfile = "Compatibility"; //public string SNESProfile = "Compatibility";
public bool SNESUseRingBuffer = true; //public bool SNESUseRingBuffer = true;
public bool SNESAlwaysDoubleSize = false; //public bool SNESAlwaysDoubleSize = false;
//GB settings //GB settings
// as this setting spans multiple cores and doesn't actually affect the behavior of any core, // as this setting spans multiple cores and doesn't actually affect the behavior of any core,

View File

@ -33,50 +33,51 @@ namespace BizHawk.Client.Common
public static bool snes_getlayer_bg_1() public static bool snes_getlayer_bg_1()
{ {
return Global.Config.SNES_ShowBG1_1; return ((LibsnesCore.SnesSettings)Global.Emulator.GetSettings()).ShowBG1_1;
} }
public static bool snes_getlayer_bg_2() public static bool snes_getlayer_bg_2()
{ {
return Global.Config.SNES_ShowBG2_1; return ((LibsnesCore.SnesSettings)Global.Emulator.GetSettings()).ShowBG2_1;
} }
public static bool snes_getlayer_bg_3() public static bool snes_getlayer_bg_3()
{ {
return Global.Config.SNES_ShowBG3_1; return ((LibsnesCore.SnesSettings)Global.Emulator.GetSettings()).ShowBG3_1;
} }
public static bool snes_getlayer_bg_4() public static bool snes_getlayer_bg_4()
{ {
return Global.Config.SNES_ShowBG4_1; return ((LibsnesCore.SnesSettings)Global.Emulator.GetSettings()).ShowBG4_1;
} }
public static bool snes_getlayer_obj_1() public static bool snes_getlayer_obj_1()
{ {
return Global.Config.SNES_ShowOBJ1; return ((LibsnesCore.SnesSettings)Global.Emulator.GetSettings()).ShowOBJ_0;
} }
public static bool snes_getlayer_obj_2() public static bool snes_getlayer_obj_2()
{ {
return Global.Config.SNES_ShowOBJ2; return ((LibsnesCore.SnesSettings)Global.Emulator.GetSettings()).ShowOBJ_1;
} }
public static bool snes_getlayer_obj_3() public static bool snes_getlayer_obj_3()
{ {
return Global.Config.SNES_ShowOBJ3; return ((LibsnesCore.SnesSettings)Global.Emulator.GetSettings()).ShowOBJ_2;
} }
public static bool snes_getlayer_obj_4() public static bool snes_getlayer_obj_4()
{ {
return Global.Config.SNES_ShowOBJ4; return ((LibsnesCore.SnesSettings)Global.Emulator.GetSettings()).ShowOBJ_3;
} }
public static void snes_setlayer_bg_1(bool value) public static void snes_setlayer_bg_1(bool value)
{ {
if (Global.Emulator is LibsnesCore) if (Global.Emulator is LibsnesCore)
{ {
Global.Config.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_0 = value; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
CoreFileProvider.SyncCoreCommInputSignals(); s.ShowBG1_1 = s.ShowBG1_0 = value;
Global.Emulator.PutSettings(s);
} }
} }
@ -84,8 +85,9 @@ namespace BizHawk.Client.Common
{ {
if (Global.Emulator is LibsnesCore) if (Global.Emulator is LibsnesCore)
{ {
Global.Config.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_0 = value; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
CoreFileProvider.SyncCoreCommInputSignals(); s.ShowBG2_1 = s.ShowBG2_0 = value;
Global.Emulator.PutSettings(s);
} }
} }
@ -93,8 +95,9 @@ namespace BizHawk.Client.Common
{ {
if (Global.Emulator is LibsnesCore) if (Global.Emulator is LibsnesCore)
{ {
Global.Config.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_0 = value; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
CoreFileProvider.SyncCoreCommInputSignals(); s.ShowBG3_1 = s.ShowBG3_0 = value;
Global.Emulator.PutSettings(s);
} }
} }
@ -102,8 +105,9 @@ namespace BizHawk.Client.Common
{ {
if (Global.Emulator is LibsnesCore) if (Global.Emulator is LibsnesCore)
{ {
Global.Config.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_0 = value; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
CoreFileProvider.SyncCoreCommInputSignals(); s.ShowBG4_1 = s.ShowBG4_0 = value;
Global.Emulator.PutSettings(s);
} }
} }
@ -111,8 +115,9 @@ namespace BizHawk.Client.Common
{ {
if (Global.Emulator is LibsnesCore) if (Global.Emulator is LibsnesCore)
{ {
Global.Config.SNES_ShowOBJ1 = value; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
CoreFileProvider.SyncCoreCommInputSignals(); s.ShowOBJ_0 = value;
Global.Emulator.PutSettings(s);
} }
} }
@ -120,8 +125,9 @@ namespace BizHawk.Client.Common
{ {
if (Global.Emulator is LibsnesCore) if (Global.Emulator is LibsnesCore)
{ {
Global.Config.SNES_ShowOBJ2 = value; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
CoreFileProvider.SyncCoreCommInputSignals(); s.ShowOBJ_1 = value;
Global.Emulator.PutSettings(s);
} }
} }
@ -129,8 +135,9 @@ namespace BizHawk.Client.Common
{ {
if (Global.Emulator is LibsnesCore) if (Global.Emulator is LibsnesCore)
{ {
Global.Config.SNES_ShowOBJ3 = value; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
CoreFileProvider.SyncCoreCommInputSignals(); s.ShowOBJ_2 = value;
Global.Emulator.PutSettings(s);
} }
} }
@ -138,8 +145,9 @@ namespace BizHawk.Client.Common
{ {
if (Global.Emulator is LibsnesCore) if (Global.Emulator is LibsnesCore)
{ {
Global.Config.SNES_ShowOBJ4 = value; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
CoreFileProvider.SyncCoreCommInputSignals(); s.ShowOBJ_3 = value;
Global.Emulator.PutSettings(s);
} }
} }
} }

View File

@ -1497,15 +1497,17 @@ namespace BizHawk.Client.EmuHawk
private void SNESDisplayMenuItem_DropDownOpened(object sender, EventArgs e) private void SNESDisplayMenuItem_DropDownOpened(object sender, EventArgs e)
{ {
SnesBg1MenuItem.Checked = Global.Config.SNES_ShowBG1_1; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
SnesBg2MenuItem.Checked = Global.Config.SNES_ShowBG2_1;
SnesBg3MenuItem.Checked = Global.Config.SNES_ShowBG3_1;
SnesBg4MenuItem.Checked = Global.Config.SNES_ShowBG4_1;
SnesObj1MenuItem.Checked = Global.Config.SNES_ShowOBJ1; SnesBg1MenuItem.Checked = s.ShowBG1_1;
SnesObj2MenuItem.Checked = Global.Config.SNES_ShowOBJ2; SnesBg2MenuItem.Checked = s.ShowBG2_1;
SnesObj3MenuItem.Checked = Global.Config.SNES_ShowOBJ3; SnesBg3MenuItem.Checked = s.ShowBG3_1;
SnesObj4MenuItem.Checked = Global.Config.SNES_ShowOBJ4; SnesBg4MenuItem.Checked = s.ShowBG4_1;
SnesObj1MenuItem.Checked = s.ShowOBJ_0;
SnesObj2MenuItem.Checked = s.ShowOBJ_1;
SnesObj3MenuItem.Checked = s.ShowOBJ_2;
SnesObj4MenuItem.Checked = s.ShowOBJ_3;
SnesBg1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 1"].Bindings; SnesBg1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 1"].Bindings;
SnesBg2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 2"].Bindings; SnesBg2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 2"].Bindings;
@ -1576,23 +1578,7 @@ namespace BizHawk.Client.EmuHawk
private void SnesOptionsMenuItem_Click(object sender, EventArgs e) private void SnesOptionsMenuItem_Click(object sender, EventArgs e)
{ {
var so = new SNESOptions SNESOptions.DoSettingsDialog(this);
{
UseRingBuffer = Global.Config.SNESUseRingBuffer,
AlwaysDoubleSize = Global.Config.SNESAlwaysDoubleSize,
Profile = Global.Config.SNESProfile
};
if (so.ShowDialog() == DialogResult.OK)
{
Global.Config.SNESProfile = so.Profile;
Global.Config.SNESUseRingBuffer = so.UseRingBuffer;
Global.Config.SNESAlwaysDoubleSize = so.AlwaysDoubleSize;
if (Global.Config.SNESProfile != so.Profile)
{
FlagNeedsReboot();
}
CoreFileProvider.SyncCoreCommInputSignals();
}
} }
#endregion #endregion

View File

@ -796,121 +796,129 @@ namespace BizHawk.Client.EmuHawk
public void SNES_ToggleBG1(bool? setto = null) public void SNES_ToggleBG1(bool? setto = null)
{ {
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (setto.HasValue) if (setto.HasValue)
{ {
Global.Config.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_0 = setto.Value; s.ShowBG1_1 = s.ShowBG1_0 = setto.Value;
} }
else else
{ {
Global.Config.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_0 ^= true; s.ShowBG1_1 = s.ShowBG1_0 ^= true;
} }
CoreFileProvider.SyncCoreCommInputSignals(); Global.Emulator.PutSettings(s);
GlobalWin.OSD.AddMessage(Global.Config.SNES_ShowBG1_1 ? "BG 1 Layer On" : "BG 1 Layer Off"); GlobalWin.OSD.AddMessage(s.ShowBG1_1 ? "BG 1 Layer On" : "BG 1 Layer Off");
} }
public void SNES_ToggleBG2(bool? setto = null) public void SNES_ToggleBG2(bool? setto = null)
{ {
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (setto.HasValue) if (setto.HasValue)
{ {
Global.Config.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_0 = setto.Value; s.ShowBG2_1 = s.ShowBG2_0 = setto.Value;
} }
else else
{ {
Global.Config.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_0 ^= true; s.ShowBG2_1 = s.ShowBG2_0 ^= true;
} }
CoreFileProvider.SyncCoreCommInputSignals(); Global.Emulator.PutSettings(s);
GlobalWin.OSD.AddMessage(Global.Config.SNES_ShowBG2_1 ? "BG 2 Layer On" : "BG 2 Layer Off"); GlobalWin.OSD.AddMessage(s.ShowBG2_1 ? "BG 2 Layer On" : "BG 2 Layer Off");
} }
public void SNES_ToggleBG3(bool? setto = null) public void SNES_ToggleBG3(bool? setto = null)
{ {
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (setto.HasValue) if (setto.HasValue)
{ {
Global.Config.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_0 = setto.Value; s.ShowBG3_1 = s.ShowBG3_0 = setto.Value;
} }
else else
{ {
Global.Config.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_0 ^= true; s.ShowBG3_1 = s.ShowBG3_0 ^= true;
} }
CoreFileProvider.SyncCoreCommInputSignals(); Global.Emulator.PutSettings(s);
GlobalWin.OSD.AddMessage(Global.Config.SNES_ShowBG3_1 ? "BG 3 Layer On" : "BG 3 Layer Off"); GlobalWin.OSD.AddMessage(s.ShowBG3_1 ? "BG 3 Layer On" : "BG 3 Layer Off");
} }
public void SNES_ToggleBG4(bool? setto = null) public void SNES_ToggleBG4(bool? setto = null)
{ {
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (setto.HasValue) if (setto.HasValue)
{ {
Global.Config.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_0 = setto.Value; s.ShowBG4_1 = s.ShowBG4_0 = setto.Value;
} }
else else
{ {
Global.Config.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_0 ^= true; s.ShowBG4_1 = s.ShowBG4_0 ^= true;
} }
CoreFileProvider.SyncCoreCommInputSignals(); Global.Emulator.PutSettings(s);
GlobalWin.OSD.AddMessage(Global.Config.SNES_ShowBG4_1 ? "BG 4 Layer On" : "BG 4 Layer Off"); GlobalWin.OSD.AddMessage(s.ShowBG4_1 ? "BG 4 Layer On" : "BG 4 Layer Off");
} }
public void SNES_ToggleOBJ1(bool? setto = null) public void SNES_ToggleOBJ1(bool? setto = null)
{ {
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (setto.HasValue) if (setto.HasValue)
{ {
Global.Config.SNES_ShowOBJ1 = setto.Value; s.ShowOBJ_0 = setto.Value;
} }
else else
{ {
Global.Config.SNES_ShowOBJ1 ^= true; s.ShowOBJ_0 ^= true;
} }
CoreFileProvider.SyncCoreCommInputSignals(); Global.Emulator.PutSettings(s);
GlobalWin.OSD.AddMessage(Global.Config.SNES_ShowOBJ1 ? "OBJ 1 Layer On" : "OBJ 1 Layer Off"); GlobalWin.OSD.AddMessage(s.ShowOBJ_0 ? "OBJ 1 Layer On" : "OBJ 1 Layer Off");
} }
public void SNES_ToggleOBJ2(bool? setto = null) public void SNES_ToggleOBJ2(bool? setto = null)
{ {
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (setto.HasValue) if (setto.HasValue)
{ {
Global.Config.SNES_ShowOBJ2 = setto.Value; s.ShowOBJ_1 = setto.Value;
} }
else else
{ {
Global.Config.SNES_ShowOBJ2 ^= true; s.ShowOBJ_1 ^= true;
} }
CoreFileProvider.SyncCoreCommInputSignals(); Global.Emulator.PutSettings(s);
GlobalWin.OSD.AddMessage(Global.Config.SNES_ShowOBJ2 ? "OBJ 2 Layer On" : "OBJ 2 Layer Off"); GlobalWin.OSD.AddMessage(s.ShowOBJ_1 ? "OBJ 2 Layer On" : "OBJ 2 Layer Off");
} }
public void SNES_ToggleOBJ3(bool? setto = null) public void SNES_ToggleOBJ3(bool? setto = null)
{ {
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (setto.HasValue) if (setto.HasValue)
{ {
Global.Config.SNES_ShowOBJ3 = setto.Value; s.ShowOBJ_2 = setto.Value;
} }
else else
{ {
Global.Config.SNES_ShowOBJ3 ^= true; s.ShowOBJ_2 ^= true;
} }
CoreFileProvider.SyncCoreCommInputSignals(); Global.Emulator.PutSettings(s);
GlobalWin.OSD.AddMessage(Global.Config.SNES_ShowOBJ3 ? "OBJ 3 Layer On" : "OBJ 3 Layer Off"); GlobalWin.OSD.AddMessage(s.ShowOBJ_2 ? "OBJ 3 Layer On" : "OBJ 3 Layer Off");
} }
public void SNES_ToggleOBJ4(bool? setto = null) public void SNES_ToggleOBJ4(bool? setto = null)
{ {
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (setto.HasValue) if (setto.HasValue)
{ {
Global.Config.SNES_ShowOBJ4 = setto.Value; s.ShowOBJ_3 = setto.Value;
} }
else else
{ {
Global.Config.SNES_ShowOBJ4 ^= true; s.ShowOBJ_3 ^= true;
} }
CoreFileProvider.SyncCoreCommInputSignals(); Global.Emulator.PutSettings(s);
GlobalWin.OSD.AddMessage(Global.Config.SNES_ShowOBJ4 ? "OBJ 4 Layer On" : "OBJ 4 Layer Off"); GlobalWin.OSD.AddMessage(s.ShowOBJ_3 ? "OBJ 4 Layer On" : "OBJ 4 Layer Off");
} }
#endregion #endregion
@ -2831,12 +2839,6 @@ namespace BizHawk.Client.EmuHawk
CoreFileProvider.SyncCoreCommInputSignals(); CoreFileProvider.SyncCoreCommInputSignals();
InputManager.SyncControls(); InputManager.SyncControls();
if (loader.LoadedEmulator is LibsnesCore)
{
(loader.LoadedEmulator as LibsnesCore)
.SetPalette((SnesColors.ColorType)Enum.Parse(typeof(SnesColors.ColorType), Global.Config.SNESPalette, false));
}
if (loader.Game.System == "NES") if (loader.Game.System == "NES")
{ {
var nes = Global.Emulator as NES; var nes = Global.Emulator as NES;

View File

@ -6,6 +6,8 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -49,5 +51,27 @@ namespace BizHawk.Client.EmuHawk
DialogResult = System.Windows.Forms.DialogResult.Cancel; DialogResult = System.Windows.Forms.DialogResult.Cancel;
Close(); Close();
} }
public static void DoSettingsDialog(IWin32Window owner)
{
var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
var ss = (LibsnesCore.SnesSyncSettings)Global.Emulator.GetSyncSettings();
var dlg = new SNESOptions
{
UseRingBuffer = s.UseRingBuffer,
AlwaysDoubleSize = s.AlwaysDoubleSize,
Profile = ss.Profile
};
var result = dlg.ShowDialog(owner);
if (result == DialogResult.OK)
{
s.UseRingBuffer = dlg.UseRingBuffer;
s.AlwaysDoubleSize = dlg.AlwaysDoubleSize;
ss.Profile = dlg.Profile;
GlobalWin.MainForm.PutCoreSettings(s);
GlobalWin.MainForm.PutCoreSyncSettings(ss);
}
}
} }
} }

View File

@ -1348,10 +1348,11 @@ namespace BizHawk.Client.EmuHawk
if (suppression) return; if (suppression) return;
var pal = (SnesColors.ColorType)comboPalette.SelectedValue; var pal = (SnesColors.ColorType)comboPalette.SelectedValue;
Console.WriteLine("set {0}", pal); Console.WriteLine("set {0}", pal);
Global.Config.SNESPalette = pal.ToString(); var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
s.Palette = pal.ToString();
if (currentSnesCore != null) if (currentSnesCore != null)
{ {
currentSnesCore.SetPalette(pal); currentSnesCore.PutSettings(s);
} }
RegenerateData(); RegenerateData();
RenderView(); RenderView();
@ -1361,56 +1362,57 @@ namespace BizHawk.Client.EmuHawk
void RefreshBGENCheckStatesFromConfig() void RefreshBGENCheckStatesFromConfig()
{ {
checkEN0_BG1.Checked = Global.Config.SNES_ShowBG1_0; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
checkEN0_BG2.Checked = Global.Config.SNES_ShowBG2_0; checkEN0_BG1.Checked = s.ShowBG1_0;
checkEN0_BG3.Checked = Global.Config.SNES_ShowBG3_0; checkEN0_BG2.Checked = s.ShowBG2_0;
checkEN0_BG4.Checked = Global.Config.SNES_ShowBG4_0; checkEN0_BG3.Checked = s.ShowBG3_0;
checkEN1_BG1.Checked = Global.Config.SNES_ShowBG1_1; checkEN0_BG4.Checked = s.ShowBG4_0;
checkEN1_BG2.Checked = Global.Config.SNES_ShowBG2_1; checkEN1_BG1.Checked = s.ShowBG1_1;
checkEN1_BG3.Checked = Global.Config.SNES_ShowBG3_1; checkEN1_BG2.Checked = s.ShowBG2_1;
checkEN1_BG4.Checked = Global.Config.SNES_ShowBG4_1; checkEN1_BG3.Checked = s.ShowBG3_1;
checkEN0_OBJ.Checked = Global.Config.SNES_ShowOBJ1; checkEN1_BG4.Checked = s.ShowBG4_1;
checkEN1_OBJ.Checked = Global.Config.SNES_ShowOBJ2; checkEN0_OBJ.Checked = s.ShowOBJ_0;
checkEN2_OBJ.Checked = Global.Config.SNES_ShowOBJ3; checkEN1_OBJ.Checked = s.ShowOBJ_1;
checkEN3_OBJ.Checked = Global.Config.SNES_ShowOBJ4; checkEN2_OBJ.Checked = s.ShowOBJ_2;
checkEN3_OBJ.Checked = s.ShowOBJ_3;
} }
private void checkEN_CheckedChanged(object sender, EventArgs e) private void checkEN_CheckedChanged(object sender, EventArgs e)
{ {
if(suppression) return; if(suppression) return;
if (sender == checkEN0_BG1) Global.Config.SNES_ShowBG1_0 = checkEN0_BG1.Checked; var s = (LibsnesCore.SnesSettings)Global.Emulator.GetSettings();
if (sender == checkEN0_BG2) Global.Config.SNES_ShowBG2_0 = checkEN0_BG2.Checked; if (sender == checkEN0_BG1) s.ShowBG1_0 = checkEN0_BG1.Checked;
if (sender == checkEN0_BG3) Global.Config.SNES_ShowBG3_0 = checkEN0_BG3.Checked; if (sender == checkEN0_BG2) s.ShowBG2_0 = checkEN0_BG2.Checked;
if (sender == checkEN0_BG4) Global.Config.SNES_ShowBG4_0 = checkEN0_BG4.Checked; if (sender == checkEN0_BG3) s.ShowBG3_0 = checkEN0_BG3.Checked;
if (sender == checkEN1_BG1) Global.Config.SNES_ShowBG1_1 = checkEN1_BG1.Checked; if (sender == checkEN0_BG4) s.ShowBG4_0 = checkEN0_BG4.Checked;
if (sender == checkEN1_BG2) Global.Config.SNES_ShowBG2_1 = checkEN1_BG2.Checked; if (sender == checkEN1_BG1) s.ShowBG1_1 = checkEN1_BG1.Checked;
if (sender == checkEN1_BG3) Global.Config.SNES_ShowBG3_1 = checkEN1_BG3.Checked; if (sender == checkEN1_BG2) s.ShowBG2_1 = checkEN1_BG2.Checked;
if (sender == checkEN1_BG4) Global.Config.SNES_ShowBG4_1 = checkEN1_BG4.Checked; if (sender == checkEN1_BG3) s.ShowBG3_1 = checkEN1_BG3.Checked;
if (sender == checkEN0_OBJ) Global.Config.SNES_ShowOBJ1 = checkEN0_OBJ.Checked; if (sender == checkEN1_BG4) s.ShowBG4_1 = checkEN1_BG4.Checked;
if (sender == checkEN1_OBJ) Global.Config.SNES_ShowOBJ2 = checkEN1_OBJ.Checked; if (sender == checkEN0_OBJ) s.ShowOBJ_0 = checkEN0_OBJ.Checked;
if (sender == checkEN2_OBJ) Global.Config.SNES_ShowOBJ3 = checkEN2_OBJ.Checked; if (sender == checkEN1_OBJ) s.ShowOBJ_1 = checkEN1_OBJ.Checked;
if (sender == checkEN3_OBJ) Global.Config.SNES_ShowOBJ4 = checkEN3_OBJ.Checked; if (sender == checkEN2_OBJ) s.ShowOBJ_2 = checkEN2_OBJ.Checked;
if (sender == checkEN3_OBJ) s.ShowOBJ_3 = checkEN3_OBJ.Checked;
if ((Control.ModifierKeys & Keys.Shift) != 0) if ((Control.ModifierKeys & Keys.Shift) != 0)
{ {
if (sender == checkEN0_BG1) Global.Config.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_0; if (sender == checkEN0_BG1) s.ShowBG1_1 = s.ShowBG1_0;
if (sender == checkEN1_BG1) Global.Config.SNES_ShowBG1_0 = Global.Config.SNES_ShowBG1_1; if (sender == checkEN1_BG1) s.ShowBG1_0 = s.ShowBG1_1;
if (sender == checkEN0_BG2) Global.Config.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_0; if (sender == checkEN0_BG2) s.ShowBG2_1 = s.ShowBG2_0;
if (sender == checkEN1_BG2) Global.Config.SNES_ShowBG2_0 = Global.Config.SNES_ShowBG2_1; if (sender == checkEN1_BG2) s.ShowBG2_0 = s.ShowBG2_1;
if (sender == checkEN0_BG3) Global.Config.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_0; if (sender == checkEN0_BG3) s.ShowBG3_1 = s.ShowBG3_0;
if (sender == checkEN1_BG3) Global.Config.SNES_ShowBG3_0 = Global.Config.SNES_ShowBG3_1; if (sender == checkEN1_BG3) s.ShowBG3_0 = s.ShowBG3_1;
if (sender == checkEN0_BG4) Global.Config.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_0; if (sender == checkEN0_BG4) s.ShowBG4_1 = s.ShowBG4_0;
if (sender == checkEN1_BG4) Global.Config.SNES_ShowBG4_0 = Global.Config.SNES_ShowBG4_1; if (sender == checkEN1_BG4) s.ShowBG4_0 = s.ShowBG4_1;
if (sender == checkEN0_OBJ) Global.Config.SNES_ShowOBJ2 = Global.Config.SNES_ShowOBJ3 = Global.Config.SNES_ShowOBJ4 = Global.Config.SNES_ShowOBJ1; if (sender == checkEN0_OBJ) s.ShowOBJ_1 = s.ShowOBJ_2 = s.ShowOBJ_3 = s.ShowOBJ_0;
if (sender == checkEN1_OBJ) Global.Config.SNES_ShowOBJ1 = Global.Config.SNES_ShowOBJ3 = Global.Config.SNES_ShowOBJ4 = Global.Config.SNES_ShowOBJ2; if (sender == checkEN1_OBJ) s.ShowOBJ_0 = s.ShowOBJ_2 = s.ShowOBJ_3 = s.ShowOBJ_1;
if (sender == checkEN2_OBJ) Global.Config.SNES_ShowOBJ1 = Global.Config.SNES_ShowOBJ2 = Global.Config.SNES_ShowOBJ4 = Global.Config.SNES_ShowOBJ3; if (sender == checkEN2_OBJ) s.ShowOBJ_0 = s.ShowOBJ_1 = s.ShowOBJ_3 = s.ShowOBJ_2;
if (sender == checkEN3_OBJ) Global.Config.SNES_ShowOBJ1 = Global.Config.SNES_ShowOBJ2 = Global.Config.SNES_ShowOBJ3 = Global.Config.SNES_ShowOBJ4; if (sender == checkEN3_OBJ) s.ShowOBJ_0 = s.ShowOBJ_1 = s.ShowOBJ_2 = s.ShowOBJ_3;
suppression = true; suppression = true;
RefreshBGENCheckStatesFromConfig(); RefreshBGENCheckStatesFromConfig();
suppression = false; suppression = false;
} }
Global.Emulator.PutSettings(s);
CoreFileProvider.SyncCoreCommInputSignals();
} }
private void lblEnPrio0_Click(object sender, EventArgs e) private void lblEnPrio0_Click(object sender, EventArgs e)

View File

@ -17,14 +17,14 @@ namespace BizHawk.Emulation.Common
public ICoreFileProvider CoreFileProvider; public ICoreFileProvider CoreFileProvider;
public string SNES_ExePath; //public string SNES_ExePath;
public string SNES_Profile; //public string SNES_Profile;
public bool SNES_UseRingBuffer; //public bool SNES_UseRingBuffer;
public bool SNES_AlwaysDoubleSize; //public bool SNES_AlwaysDoubleSize;
public bool SNES_ShowBG1_0, SNES_ShowBG2_0, SNES_ShowBG3_0, SNES_ShowBG4_0; //public bool SNES_ShowBG1_0, SNES_ShowBG2_0, SNES_ShowBG3_0, SNES_ShowBG4_0;
public bool SNES_ShowBG1_1, SNES_ShowBG2_1, SNES_ShowBG3_1, SNES_ShowBG4_1; //public bool SNES_ShowBG1_1, SNES_ShowBG2_1, SNES_ShowBG3_1, SNES_ShowBG4_1;
public bool SNES_ShowOBJ_0, SNES_ShowOBJ_1, SNES_ShowOBJ_2, SNES_ShowOBJ_3; //public bool SNES_ShowOBJ_0, SNES_ShowOBJ_1, SNES_ShowOBJ_2, SNES_ShowOBJ_3;
//public bool Atari2600_ShowBG = true, Atari2600_ShowPlayer1 = true, Atari2600_ShowPlayer2 = true, Atari2600_ShowMissle1 = true, Atari2600_ShowMissle2 = true, Atari2600_ShowBall = true, Atari2600_ShowPF = true; //public bool Atari2600_ShowBG = true, Atari2600_ShowPlayer1 = true, Atari2600_ShowPlayer2 = true, Atari2600_ShowMissle1 = true, Atari2600_ShowMissle2 = true, Atari2600_ShowBall = true, Atari2600_ShowPF = true;

View File

@ -19,6 +19,12 @@ namespace BizHawk.Emulation.Common
/// </summary> /// </summary>
string PathSubfile(string fname); string PathSubfile(string fname);
/// <summary>
/// produces a path that contains emulation related dll and exe files
/// </summary>
/// <returns></returns>
string DllPath();
#region EmuLoadHelper api #region EmuLoadHelper api
/// <summary> /// <summary>

View File

@ -228,10 +228,30 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public LibsnesApi api; public LibsnesApi api;
System.Xml.XmlDocument romxml; System.Xml.XmlDocument romxml;
public LibsnesCore(CoreComm comm) string GetExePath()
{ {
const string bits = "32";
// disabled til it works
// if (Win32.Is64BitOperatingSystem)
// bits = "64";
var exename = "libsneshawk-" + bits + "-" + SyncSettings.Profile.ToLower() + ".exe";
string exePath = Path.Combine(CoreComm.CoreFileProvider.DllPath(), exename);
if (!File.Exists(exePath))
throw new InvalidOperationException("Couldn't locate the executable for SNES emulation for profile: " + SyncSettings.Profile + ". Please make sure you're using a fresh dearchive of a BizHawk distribution.");
return exePath;
}
public LibsnesCore(CoreComm comm, object Settings, object SyncSettings)
{
this.Settings = (SnesSettings)Settings ?? new SnesSettings();
this.SyncSettings = (SnesSyncSettings)SyncSettings ?? new SnesSyncSettings();
CoreComm = comm; CoreComm = comm;
api = new LibsnesApi(CoreComm.SNES_ExePath);
api = new LibsnesApi(GetExePath());
api.CMD_init(); api.CMD_init();
api.ReadHook = ReadHook; api.ReadHook = ReadHook;
api.ExecHook = ExecHook; api.ExecHook = ExecHook;
@ -292,9 +312,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
soundcb = new LibsnesApi.snes_audio_sample_t(snes_audio_sample); soundcb = new LibsnesApi.snes_audio_sample_t(snes_audio_sample);
api.QUERY_set_audio_sample(soundcb); api.QUERY_set_audio_sample(soundcb);
// set default palette. Should be overridden by frontend probably RefreshPalette();
SetPalette(SnesColors.ColorType.BizHawk);
// start up audio resampler // start up audio resampler
InitAudio(); InitAudio();
@ -425,7 +443,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
int field = 0; int field = 0;
void snes_video_refresh(int* data, int width, int height) void snes_video_refresh(int* data, int width, int height)
{ {
bool doubleSize = CoreComm.SNES_AlwaysDoubleSize; bool doubleSize = Settings.AlwaysDoubleSize;
bool lineDouble = doubleSize, dotDouble = doubleSize; bool lineDouble = doubleSize, dotDouble = doubleSize;
vidWidth = width; vidWidth = width;
@ -503,7 +521,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
{ {
api.MessageCounter = 0; api.MessageCounter = 0;
if(CoreComm.SNES_UseRingBuffer) if(Settings.UseRingBuffer)
api.BeginBufferIO(); api.BeginBufferIO();
/* if the input poll callback is called, it will set this to false /* if the input poll callback is called, it will set this to false
@ -547,18 +565,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
if (powerSignal) api.CMD_power(); if (powerSignal) api.CMD_power();
//too many messages //too many messages
api.QUERY_set_layer_enable(0, 0, CoreComm.SNES_ShowBG1_0); api.QUERY_set_layer_enable(0, 0, Settings.ShowBG1_0);
api.QUERY_set_layer_enable(0, 1, CoreComm.SNES_ShowBG1_1); api.QUERY_set_layer_enable(0, 1, Settings.ShowBG1_1);
api.QUERY_set_layer_enable(1, 0, CoreComm.SNES_ShowBG2_0); api.QUERY_set_layer_enable(1, 0, Settings.ShowBG2_0);
api.QUERY_set_layer_enable(1, 1, CoreComm.SNES_ShowBG2_1); api.QUERY_set_layer_enable(1, 1, Settings.ShowBG2_1);
api.QUERY_set_layer_enable(2, 0, CoreComm.SNES_ShowBG3_0); api.QUERY_set_layer_enable(2, 0, Settings.ShowBG3_0);
api.QUERY_set_layer_enable(2, 1, CoreComm.SNES_ShowBG3_1); api.QUERY_set_layer_enable(2, 1, Settings.ShowBG3_1);
api.QUERY_set_layer_enable(3, 0, CoreComm.SNES_ShowBG4_0); api.QUERY_set_layer_enable(3, 0, Settings.ShowBG4_0);
api.QUERY_set_layer_enable(3, 1, CoreComm.SNES_ShowBG4_1); api.QUERY_set_layer_enable(3, 1, Settings.ShowBG4_1);
api.QUERY_set_layer_enable(4, 0, CoreComm.SNES_ShowOBJ_0); api.QUERY_set_layer_enable(4, 0, Settings.ShowOBJ_0);
api.QUERY_set_layer_enable(4, 1, CoreComm.SNES_ShowOBJ_1); api.QUERY_set_layer_enable(4, 1, Settings.ShowOBJ_1);
api.QUERY_set_layer_enable(4, 2, CoreComm.SNES_ShowOBJ_2); api.QUERY_set_layer_enable(4, 2, Settings.ShowOBJ_2);
api.QUERY_set_layer_enable(4, 3, CoreComm.SNES_ShowOBJ_3); api.QUERY_set_layer_enable(4, 3, Settings.ShowOBJ_3);
RefreshMemoryCallbacks(); RefreshMemoryCallbacks();
@ -800,7 +818,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
var temp = SaveStateBinary(); var temp = SaveStateBinary();
temp.SaveAsHexFast(writer); temp.SaveAsHexFast(writer);
writer.WriteLine("Frame {0}", Frame); // we don't parse this, it's only for the client to use writer.WriteLine("Frame {0}", Frame); // we don't parse this, it's only for the client to use
writer.WriteLine("Profile {0}", CoreComm.SNES_Profile); writer.WriteLine("Profile {0}", SyncSettings.Profile);
} }
public void LoadStateText(TextReader reader) public void LoadStateText(TextReader reader)
{ {
@ -832,7 +850,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
writer.Write(IsLagFrame); writer.Write(IsLagFrame);
writer.Write(LagCount); writer.Write(LagCount);
writer.Write(Frame); writer.Write(Frame);
writer.Write(CoreComm.SNES_Profile); writer.Write(SyncSettings.Profile);
writer.Flush(); writer.Flush();
} }
@ -880,7 +898,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
void ValidateLoadstateProfile(string profile) void ValidateLoadstateProfile(string profile)
{ {
if (profile != CoreComm.SNES_Profile) if (profile != SyncSettings.Profile)
{ {
throw new InvalidOperationException("You've attempted to load a savestate made using a different SNES profile than your current configuration. We COULD automatically switch for you, but we havent done that yet. This error is to make sure you know that this isnt going to work right now."); throw new InvalidOperationException("You've attempted to load a savestate made using a different SNES profile than your current configuration. We COULD automatically switch for you, but we havent done that yet. This error is to make sure you know that this isnt going to work right now.");
} }
@ -1046,9 +1064,67 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
#endregion audio stuff #endregion audio stuff
public object GetSettings() { return null; } void RefreshPalette()
public object GetSyncSettings() { return null; } {
public bool PutSettings(object o) { return false; } SetPalette((SnesColors.ColorType)Enum.Parse(typeof(SnesColors.ColorType), Settings.Palette, false));
public bool PutSyncSettings(object o) { return false; }
}
SnesSettings Settings;
SnesSyncSettings SyncSettings;
public object GetSettings() { return Settings.Clone(); }
public object GetSyncSettings() { return SyncSettings.Clone(); }
public bool PutSettings(object o)
{
SnesSettings n = (SnesSettings)o;
bool refreshneeded = n.Palette != Settings.Palette;
Settings = n;
if (refreshneeded)
RefreshPalette();
return false;
}
public bool PutSyncSettings(object o)
{
SnesSyncSettings n = (SnesSyncSettings)o;
bool ret = n.Profile != SyncSettings.Profile;
SyncSettings = n;
return ret;
}
public class SnesSettings
{
public bool ShowBG1_0 = true;
public bool ShowBG2_0 = true;
public bool ShowBG3_0 = true;
public bool ShowBG4_0 = true;
public bool ShowBG1_1 = true;
public bool ShowBG2_1 = true;
public bool ShowBG3_1 = true;
public bool ShowBG4_1 = true;
public bool ShowOBJ_0 = true;
public bool ShowOBJ_1 = true;
public bool ShowOBJ_2 = true;
public bool ShowOBJ_3 = true;
public bool UseRingBuffer = true;
public bool AlwaysDoubleSize = false;
public string Palette = "BizHawk";
public SnesSettings Clone()
{
return (SnesSettings)MemberwiseClone();
}
}
public class SnesSyncSettings
{
public string Profile = "Compatibility";
public SnesSyncSettings Clone()
{
return (SnesSyncSettings)MemberwiseClone();
}
}
} }
} }