update our newtonsoft json.net to version 5.0 release 8. this fixes up abstract class handling so that the CoreSettings can work correctly.
tweak Binding, RecentFiles, and PathEntry to work with the new serializer. on updating to this revision, you should be able to keep all config.ini settings except for hotkey bindings, path layouts, and recent files list. start implementation of new CoreSettings and CoreSyncSettings. at the moment, it's only partially done for NES.
This commit is contained in:
parent
720a19c2ad
commit
bd205f47dc
|
@ -42,7 +42,8 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\output\dll\LuaInterface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<Reference Include="Newtonsoft.Json, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -96,10 +96,10 @@ namespace BizHawk.Client.Common
|
|||
target.CoreFileProvider = cfp;
|
||||
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.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;
|
||||
|
|
|
@ -4,10 +4,11 @@ using System.Linq;
|
|||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
[Newtonsoft.Json.JsonObject]
|
||||
public class RecentFiles : IEnumerable
|
||||
{
|
||||
private readonly int MAX_RECENT_FILES; //Maximum number of files
|
||||
private readonly List<string> recentlist; //List of recent files
|
||||
public int MAX_RECENT_FILES { get; private set; } //Maximum number of files
|
||||
public List<string> recentlist { get; private set; } //List of recent files
|
||||
|
||||
public bool AutoLoad = false;
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace BizHawk.Client.Common
|
|||
public int Ordinal = 0;
|
||||
}
|
||||
|
||||
[Newtonsoft.Json.JsonObject]
|
||||
public class BindingCollection : IEnumerable<Binding>
|
||||
{
|
||||
public List<Binding> Bindings { get; private set; }
|
||||
|
|
|
@ -308,6 +308,10 @@ namespace BizHawk.Client.Common
|
|||
public int GifWriterFrameskip = 3;
|
||||
public int GifWriterDelay = -1;
|
||||
|
||||
// emulation core settings
|
||||
public Dictionary<string, object> CoreSettings = new Dictionary<string, object>();
|
||||
public Dictionary<string, object> CoreSyncSettings = new Dictionary<string, object>();
|
||||
|
||||
// NESPPU Settings
|
||||
public bool AutoLoadNESPPU = false;
|
||||
public bool NESPPUSaveWindowPosition = true;
|
||||
|
@ -331,17 +335,17 @@ namespace BizHawk.Client.Common
|
|||
public int NESNameTableRefreshRate = 4;
|
||||
|
||||
// NES Graphics settings
|
||||
public bool NESAllowMoreThanEightSprites = false;
|
||||
public bool NESClipLeftAndRight = false;
|
||||
//public bool NESAllowMoreThanEightSprites = false;
|
||||
//public bool NESClipLeftAndRight = false;
|
||||
public bool NESAutoLoadPalette = true;
|
||||
public bool NESDispBackground = true;
|
||||
public bool NESDispSprites = true;
|
||||
public int NESBackgroundColor = 0;
|
||||
//public bool NESDispBackground = true;
|
||||
//public bool NESDispSprites = true;
|
||||
//public int NESBackgroundColor = 0;
|
||||
public string NESPaletteFile = "";
|
||||
public int NTSC_NESTopLine = 8;
|
||||
public int NTSC_NESBottomLine = 231;
|
||||
public int PAL_NESTopLine = 8;
|
||||
public int PAL_NESBottomLine = 231;
|
||||
//public int NTSC_NESTopLine = 8;
|
||||
//public int NTSC_NESBottomLine = 231;
|
||||
//public int PAL_NESTopLine = 8;
|
||||
//public int PAL_NESBottomLine = 231;
|
||||
|
||||
// gb gpu view settings
|
||||
public bool AutoLoadGBGPUView = false;
|
||||
|
|
|
@ -17,8 +17,13 @@ namespace BizHawk.Client.Common
|
|||
if (file.Exists)
|
||||
using (var reader = file.OpenText())
|
||||
{
|
||||
var s = new JsonSerializer {SuppressMissingMemberException = true, SuppressDuplicateMemberException = true};
|
||||
var r = new JsonReader(reader);
|
||||
var s = new JsonSerializer
|
||||
{
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore,
|
||||
TypeNameHandling = TypeNameHandling.Auto
|
||||
//SuppressDuplicateMemberException = true
|
||||
};
|
||||
var r = new JsonTextReader(reader);
|
||||
config = (T)s.Deserialize(r, typeof(T));
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +35,7 @@ namespace BizHawk.Client.Common
|
|||
//if (config == null) return new T();
|
||||
|
||||
//patch up arrays in the config with the minimum number of things
|
||||
// TODO: do we still need this with the new json.net version?
|
||||
foreach(var fi in typeof(T).GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public))
|
||||
if (fi.FieldType.IsArray)
|
||||
{
|
||||
|
@ -56,8 +62,12 @@ namespace BizHawk.Client.Common
|
|||
var file = new FileInfo(filepath);
|
||||
using (var writer = file.CreateText())
|
||||
{
|
||||
var s = new JsonSerializer();
|
||||
var w = new JsonWriter(writer) { Formatting = Formatting.Indented };
|
||||
var s = new JsonSerializer
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.Auto
|
||||
};
|
||||
|
||||
var w = new JsonTextWriter(writer) { Formatting = Formatting.Indented };
|
||||
s.Serialize(w, config);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[Newtonsoft.Json.JsonObject]
|
||||
public class PathEntryCollection : IEnumerable<PathEntry>
|
||||
{
|
||||
public List<PathEntry> Paths { get; private set; }
|
||||
|
@ -259,6 +260,13 @@ namespace BizHawk.Client.Common
|
|||
new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
|
||||
new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
|
||||
new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
|
||||
|
||||
new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Base", Path= Path.Combine(".", "Saturn"), Ordinal = 0 },
|
||||
new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "ROM", Path = ".", Ordinal = 1 },
|
||||
new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 },
|
||||
new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
|
||||
new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
|
||||
new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,12 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
Global.CoreComm.NES_ShowOBJ = Global.Config.NESDispSprites = (bool)lua_p[0];
|
||||
Global.CoreComm.NES_ShowBG = Global.Config.NESDispBackground = (bool)lua_p[1];
|
||||
// in the future, we could do something more arbitrary here.
|
||||
// but this isn't any worse than the old system
|
||||
NES.NESSettings s = (NES.NESSettings)Global.Emulator.GetSettings();
|
||||
s.DispSprites = (bool)lua_p[0];
|
||||
s.DispBackground = (bool)lua_p[1];
|
||||
Global.Emulator.PutSettings(s);
|
||||
}
|
||||
else if (Global.Emulator is PCEngine)
|
||||
{
|
||||
|
|
|
@ -51,47 +51,51 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
// these methods are awkward. perhaps with the new core config system, one could
|
||||
// automatically bring out all of the settings to a lua table, with names. that
|
||||
// would be completely arbitrary and would remove the whole requirement for this mess
|
||||
|
||||
public static bool nes_getallowmorethaneightsprites()
|
||||
{
|
||||
return Global.Config.NESAllowMoreThanEightSprites;
|
||||
return ((NES.NESSettings)Global.Emulator.GetSettings()).AllowMoreThanEightSprites;
|
||||
}
|
||||
|
||||
public static int nes_getbottomscanline(bool pal = false)
|
||||
{
|
||||
if (pal)
|
||||
{
|
||||
return Global.Config.PAL_NESBottomLine;
|
||||
return ((NES.NESSettings)Global.Emulator.GetSettings()).PAL_BottomLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Global.Config.NTSC_NESBottomLine;
|
||||
return ((NES.NESSettings)Global.Emulator.GetSettings()).NTSC_BottomLine;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool nes_getclipleftandright()
|
||||
{
|
||||
return Global.Config.NESClipLeftAndRight;
|
||||
return ((NES.NESSettings)Global.Emulator.GetSettings()).ClipLeftAndRight;
|
||||
}
|
||||
|
||||
public static bool nes_getdispbackground()
|
||||
{
|
||||
return Global.Config.NESDispBackground;
|
||||
return ((NES.NESSettings)Global.Emulator.GetSettings()).DispBackground;
|
||||
}
|
||||
|
||||
public static bool nes_getdispsprites()
|
||||
{
|
||||
return Global.Config.NESDispSprites;
|
||||
return ((NES.NESSettings)Global.Emulator.GetSettings()).DispSprites;
|
||||
}
|
||||
|
||||
public static int nes_gettopscanline(bool pal = false)
|
||||
{
|
||||
if (pal)
|
||||
{
|
||||
return Global.Config.PAL_NESTopLine;
|
||||
return ((NES.NESSettings)Global.Emulator.GetSettings()).PAL_TopLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Global.Config.NTSC_NESTopLine;
|
||||
return ((NES.NESSettings)Global.Emulator.GetSettings()).NTSC_TopLine;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,80 +112,83 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public static void nes_setallowmorethaneightsprites(bool allow)
|
||||
{
|
||||
Global.Config.NESAllowMoreThanEightSprites = allow;
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
(Global.Emulator as NES).CoreComm.NES_UnlimitedSprites = allow;
|
||||
var s = (NES.NESSettings)Global.Emulator.GetSettings();
|
||||
s.AllowMoreThanEightSprites = allow;
|
||||
Global.Emulator.PutSettings(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static void nes_setclipleftandright(bool leftandright)
|
||||
{
|
||||
Global.Config.NESClipLeftAndRight = leftandright;
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
(Global.Emulator as NES).SetClipLeftAndRight(leftandright);
|
||||
var s = (NES.NESSettings)Global.Emulator.GetSettings();
|
||||
s.ClipLeftAndRight = leftandright;
|
||||
Global.Emulator.PutSettings(s);
|
||||
}
|
||||
}
|
||||
|
||||
// these seem to duplicate emu.setrenderplanes???
|
||||
public static void nes_setdispbackground(bool show)
|
||||
{
|
||||
Global.Config.NESDispBackground = show;
|
||||
CoreFileProvider.SyncCoreCommInputSignals();
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
var s = (NES.NESSettings)Global.Emulator.GetSettings();
|
||||
s.DispBackground = show;
|
||||
Global.Emulator.PutSettings(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static void nes_setdispsprites(bool show)
|
||||
{
|
||||
Global.Config.NESDispSprites = show;
|
||||
CoreFileProvider.SyncCoreCommInputSignals();
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
var s = (NES.NESSettings)Global.Emulator.GetSettings();
|
||||
s.DispSprites = show;
|
||||
Global.Emulator.PutSettings(s);
|
||||
}
|
||||
}
|
||||
|
||||
public static void nes_setscanlines(object top, object bottom, bool pal = false)
|
||||
{
|
||||
|
||||
int first = LuaInt(top);
|
||||
int last = LuaInt(bottom);
|
||||
if (first > 127)
|
||||
{
|
||||
first = 127;
|
||||
}
|
||||
else if (first < 0)
|
||||
{
|
||||
first = 0;
|
||||
}
|
||||
|
||||
if (last > 239)
|
||||
{
|
||||
last = 239;
|
||||
}
|
||||
else if (last < 128)
|
||||
{
|
||||
last = 128;
|
||||
}
|
||||
|
||||
if (pal)
|
||||
{
|
||||
Global.Config.PAL_NESTopLine = first;
|
||||
Global.Config.PAL_NESBottomLine = last;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.NTSC_NESTopLine = first;
|
||||
Global.Config.NTSC_NESBottomLine = last;
|
||||
}
|
||||
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
int first = LuaInt(top);
|
||||
int last = LuaInt(bottom);
|
||||
if (first > 127)
|
||||
{
|
||||
first = 127;
|
||||
}
|
||||
else if (first < 0)
|
||||
{
|
||||
first = 0;
|
||||
}
|
||||
|
||||
if (last > 239)
|
||||
{
|
||||
last = 239;
|
||||
}
|
||||
else if (last < 128)
|
||||
{
|
||||
last = 128;
|
||||
}
|
||||
|
||||
var s = (NES.NESSettings)Global.Emulator.GetSettings();
|
||||
|
||||
if (pal)
|
||||
{
|
||||
(Global.Emulator as NES).PAL_FirstDrawLine = first;
|
||||
(Global.Emulator as NES).PAL_LastDrawLine = last;
|
||||
s.PAL_TopLine = first;
|
||||
s.PAL_BottomLine = last;
|
||||
}
|
||||
else
|
||||
{
|
||||
(Global.Emulator as NES).NTSC_FirstDrawLine = first;
|
||||
(Global.Emulator as NES).NTSC_LastDrawLine = last;
|
||||
s.NTSC_TopLine = first;
|
||||
s.NTSC_BottomLine = last;
|
||||
}
|
||||
|
||||
Global.Emulator.PutSettings(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3176,8 +3176,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
case DiscType.UnknownCDFS:
|
||||
case DiscType.UnknownFormat:
|
||||
default: // PCECD was bizhawk's first CD core,
|
||||
// and during that time, all CDs were blindly sent to it
|
||||
// so this prevents regressions
|
||||
// and during that time, all CDs were blindly sent to it
|
||||
// so this prevents regressions
|
||||
game.System = "PCECD";
|
||||
break;
|
||||
}
|
||||
|
@ -3432,14 +3432,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
break;
|
||||
case "NES":
|
||||
{
|
||||
var nes = new NES(nextComm, game, rom.FileData, Global.MovieSession.Movie.Header.BoardProperties)
|
||||
{
|
||||
NTSC_FirstDrawLine = Global.Config.NTSC_NESTopLine,
|
||||
NTSC_LastDrawLine = Global.Config.NTSC_NESBottomLine,
|
||||
PAL_FirstDrawLine = Global.Config.PAL_NESTopLine
|
||||
};
|
||||
nes.NTSC_LastDrawLine = Global.Config.PAL_NESBottomLine;
|
||||
nes.SetClipLeftAndRight(Global.Config.NESClipLeftAndRight);
|
||||
var nes = new NES(nextComm, game, rom.FileData, Global.MovieSession.Movie.Header.BoardProperties);
|
||||
|
||||
nextEmulator = nes;
|
||||
if (Global.Config.NESAutoLoadPalette && Global.Config.NESPaletteFile.Length > 0 &&
|
||||
HawkFile.ExistsAt(Global.Config.NESPaletteFile))
|
||||
|
@ -3572,6 +3566,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
return false;
|
||||
}
|
||||
|
||||
// load core settings
|
||||
{
|
||||
string typename = nextEmulator.GetType().ToString();
|
||||
object settings = null;
|
||||
Global.Config.CoreSettings.TryGetValue(typename, out settings);
|
||||
if (settings != null)
|
||||
nextEmulator.PutSettings(settings);
|
||||
}
|
||||
|
||||
CloseGame();
|
||||
Global.Emulator.Dispose();
|
||||
Global.Emulator = nextEmulator;
|
||||
|
@ -3775,6 +3778,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
StopAVI();
|
||||
|
||||
{
|
||||
// save settings object
|
||||
string typename = Global.Emulator.GetType().ToString();
|
||||
object settings = Global.Emulator.GetSettings();
|
||||
if (settings != null)
|
||||
Global.Config.CoreSettings[typename] = settings;
|
||||
object syncsettings = Global.Emulator.GetSyncSettings();
|
||||
if (syncsettings != null)
|
||||
Global.Config.CoreSyncSettings[typename] = syncsettings;
|
||||
}
|
||||
|
||||
Global.Emulator.Dispose();
|
||||
Global.CoreComm = new CoreComm(ShowMessageCoreComm);
|
||||
CoreFileProvider.SyncCoreCommInputSignals();
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private HawkFile palette;
|
||||
private NES nes;
|
||||
private NES.NESSettings settings;
|
||||
|
||||
public NESGraphicsConfig()
|
||||
{
|
||||
|
@ -26,23 +27,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void NESGraphicsConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
nes = Global.Emulator as NES;
|
||||
settings = (NES.NESSettings)nes.GetSettings();
|
||||
LoadStuff();
|
||||
}
|
||||
|
||||
private void LoadStuff()
|
||||
{
|
||||
NTSC_FirstLineNumeric.Value = Global.Config.NTSC_NESTopLine;
|
||||
NTSC_LastLineNumeric.Value = Global.Config.NTSC_NESBottomLine;
|
||||
PAL_FirstLineNumeric.Value = Global.Config.PAL_NESTopLine;
|
||||
PAL_LastLineNumeric.Value = Global.Config.PAL_NESBottomLine;
|
||||
AllowMoreSprites.Checked = Global.Config.NESAllowMoreThanEightSprites;
|
||||
ClipLeftAndRightCheckBox.Checked = Global.Config.NESClipLeftAndRight;
|
||||
AutoLoadPalette.Checked = Global.Config.NESAutoLoadPalette;
|
||||
NTSC_FirstLineNumeric.Value = settings.NTSC_TopLine;
|
||||
NTSC_LastLineNumeric.Value = settings.NTSC_BottomLine;
|
||||
PAL_FirstLineNumeric.Value = settings.PAL_TopLine;
|
||||
PAL_LastLineNumeric.Value = settings.PAL_BottomLine;
|
||||
AllowMoreSprites.Checked = settings.AllowMoreThanEightSprites;
|
||||
ClipLeftAndRightCheckBox.Checked = settings.ClipLeftAndRight;
|
||||
AutoLoadPalette.Checked = settings.AutoLoadPalette;
|
||||
PalettePath.Text = Global.Config.NESPaletteFile;
|
||||
DispSprites.Checked = Global.Config.NESDispSprites;
|
||||
DispBackground.Checked = Global.Config.NESDispBackground;
|
||||
BGColorDialog.Color = Color.FromArgb(unchecked(Global.Config.NESBackgroundColor | (int)0xFF000000));
|
||||
checkUseBackdropColor.Checked = (Global.Config.NESBackgroundColor & 0xFF000000) != 0;
|
||||
DispSprites.Checked = settings.DispSprites;
|
||||
DispBackground.Checked = settings.DispBackground;
|
||||
BGColorDialog.Color = Color.FromArgb(unchecked(settings.BackgroundColor | (int)0xFF000000));
|
||||
checkUseBackdropColor.Checked = (settings.BackgroundColor & 0xFF000000) != 0;
|
||||
SetColorBox();
|
||||
}
|
||||
|
||||
|
@ -87,29 +89,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.OSD.AddMessage("Standard Palette set");
|
||||
}
|
||||
|
||||
Global.Config.NTSC_NESTopLine = (int)NTSC_FirstLineNumeric.Value;
|
||||
nes.NTSC_FirstDrawLine = (int)NTSC_FirstLineNumeric.Value;
|
||||
|
||||
Global.Config.NTSC_NESBottomLine = (int)NTSC_LastLineNumeric.Value;
|
||||
nes.NTSC_LastDrawLine = (int)NTSC_LastLineNumeric.Value;
|
||||
|
||||
Global.Config.PAL_NESTopLine = (int)PAL_FirstLineNumeric.Value;
|
||||
nes.PAL_FirstDrawLine = (int)PAL_FirstLineNumeric.Value;
|
||||
|
||||
Global.Config.PAL_NESBottomLine = (int)PAL_LastLineNumeric.Value;
|
||||
nes.PAL_LastDrawLine = (int)PAL_LastLineNumeric.Value;
|
||||
|
||||
Global.Config.NESAllowMoreThanEightSprites = AllowMoreSprites.Checked;
|
||||
Global.Config.NESClipLeftAndRight = ClipLeftAndRightCheckBox.Checked;
|
||||
nes.SetClipLeftAndRight(ClipLeftAndRightCheckBox.Checked);
|
||||
Global.Config.NESAutoLoadPalette = AutoLoadPalette.Checked;
|
||||
Global.Config.NESDispSprites = DispSprites.Checked;
|
||||
Global.Config.NESDispBackground = DispBackground.Checked;
|
||||
Global.Config.NESBackgroundColor = BGColorDialog.Color.ToArgb();
|
||||
settings.NTSC_TopLine = (int)NTSC_FirstLineNumeric.Value;
|
||||
settings.NTSC_BottomLine = (int)NTSC_LastLineNumeric.Value;
|
||||
settings.PAL_TopLine = (int)PAL_FirstLineNumeric.Value;
|
||||
settings.PAL_BottomLine = (int)PAL_LastLineNumeric.Value;
|
||||
settings.AllowMoreThanEightSprites = AllowMoreSprites.Checked;
|
||||
settings.ClipLeftAndRight = ClipLeftAndRightCheckBox.Checked;
|
||||
settings.AutoLoadPalette = AutoLoadPalette.Checked;
|
||||
settings.DispSprites = DispSprites.Checked;
|
||||
settings.DispBackground = DispBackground.Checked;
|
||||
settings.BackgroundColor = BGColorDialog.Color.ToArgb();
|
||||
if (!checkUseBackdropColor.Checked)
|
||||
{
|
||||
Global.Config.NESBackgroundColor &= 0x00FFFFFF;
|
||||
}
|
||||
settings.BackgroundColor &= 0x00FFFFFF;
|
||||
|
||||
nes.PutSettings(settings);
|
||||
Close();
|
||||
}
|
||||
|
||||
|
@ -152,19 +145,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void RestoreDefaultsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
NTSC_FirstLineNumeric.Value = 8;
|
||||
NTSC_LastLineNumeric.Value = 231;
|
||||
PAL_FirstLineNumeric.Value = 0;
|
||||
PAL_LastLineNumeric.Value = 239;
|
||||
AllowMoreSprites.Checked = false;
|
||||
ClipLeftAndRightCheckBox.Checked = false;
|
||||
AutoLoadPalette.Checked = true;
|
||||
PalettePath.Text = "";
|
||||
DispSprites.Checked = true;
|
||||
DispBackground.Checked = true;
|
||||
BGColorDialog.Color = Color.FromArgb(unchecked(0 | (int)0xFF000000));
|
||||
checkUseBackdropColor.Checked = false;
|
||||
SetColorBox();
|
||||
settings = new NES.NESSettings();
|
||||
LoadStuff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,10 @@ namespace BizHawk.Emulation.Common
|
|||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
|
||||
public class NullSound : ISoundProvider
|
||||
|
|
|
@ -7,9 +7,9 @@ namespace BizHawk.Emulation.Common
|
|||
{
|
||||
public class CoreComm
|
||||
{
|
||||
public int NES_BackdropColor;
|
||||
public bool NES_UnlimitedSprites = false;
|
||||
public bool NES_ShowBG = true, NES_ShowOBJ = true;
|
||||
//public int NES_BackdropColor;
|
||||
//public bool NES_UnlimitedSprites = false;
|
||||
//public bool NES_ShowBG = true, NES_ShowOBJ = true;
|
||||
public bool PCE_ShowBG1 = true, PCE_ShowOBJ1 = true, PCE_ShowBG2 = true, PCE_ShowOBJ2 = true;
|
||||
public bool SMS_ShowBG = true, SMS_ShowOBJ = true;
|
||||
public bool GG_ShowClippedRegions;
|
||||
|
|
|
@ -123,10 +123,6 @@ namespace BizHawk.Emulation.Common
|
|||
/// </summary>
|
||||
CoreComm CoreComm { get; }
|
||||
|
||||
|
||||
// this MUST BE the same as MemoryDomains[0], else DRAGONS
|
||||
/// <summary>
|
||||
|
||||
///The list of all avaialble memory domains
|
||||
/// A memory domain is a byte array that respresents a distinct part of the emulated system.
|
||||
/// By convention the Main Memory is the 1st domain in the list
|
||||
|
@ -144,6 +140,31 @@ namespace BizHawk.Emulation.Common
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<KeyValuePair<string, int>> GetCpuFlagsAndRegisters();
|
||||
|
||||
// ====settings interface====
|
||||
|
||||
// in addition to these methods, it's expected that the constructor or Load() method
|
||||
// will take a SyncSettings object to set the initial state of the core (and possibly a settings object?)
|
||||
|
||||
/// <summary>
|
||||
/// get the current core settings, excepting movie settings
|
||||
/// </summary>
|
||||
/// <returns>a json-serializable object</returns>
|
||||
object GetSettings();
|
||||
|
||||
/// <summary>
|
||||
/// get the current core settings that affect movie sync
|
||||
/// </summary>
|
||||
/// <returns>a json-serializable object</returns>
|
||||
object GetSyncSettings();
|
||||
|
||||
/// <summary>
|
||||
/// change the core settings, excepting movie settings
|
||||
/// </summary>
|
||||
/// <param name="o">an object of the same type as the return for GetSettings</param>
|
||||
/// <returns>true if a core reboot will be required to implement these</returns>
|
||||
bool PutSettings(object o);
|
||||
|
||||
}
|
||||
|
||||
public enum DisplayType { NTSC, PAL, DENDY }
|
||||
|
|
|
@ -548,5 +548,9 @@ namespace BizHawk.Emulation.Common
|
|||
public int BackgroundColor { get { return unchecked((int)0xff000000); } }
|
||||
|
||||
#endregion
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1036,5 +1036,10 @@ namespace BizHawk.Emulation.Cores.Calculators
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
|
||||
}
|
||||
}
|
|
@ -171,5 +171,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
//domains.Add(new MemoryDomain("1541 RAM", 0x1000, MemoryDomain.Endian.Little, new Func<int, byte>(disk.PeekRam), new Action<int, byte>(disk.PokeRam)));
|
||||
memoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,6 +130,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
private readonly MemoryDomainList memoryDomains;
|
||||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
public void Dispose() { }
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -425,5 +425,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
|
|||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,5 +289,9 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
public ISyncSoundProvider SyncSoundProvider { get { return null; } }
|
||||
public bool StartAsyncSound() { return true; }
|
||||
public void EndAsyncSound() { }
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
|
@ -203,5 +203,9 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
|
@ -553,5 +553,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -891,5 +891,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
}
|
||||
#endregion
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -417,5 +417,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -434,5 +434,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
|
||||
InitMemoryDomains();
|
||||
}
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,10 +195,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
class MyVideoProvider : IVideoProvider
|
||||
{
|
||||
public int ntsc_top = 8;
|
||||
public int ntsc_bottom = 231;
|
||||
public int pal_top = 0;
|
||||
public int pal_bottom = 239;
|
||||
//public int ntsc_top = 8;
|
||||
//public int ntsc_bottom = 231;
|
||||
//public int pal_top = 0;
|
||||
//public int pal_bottom = 239;
|
||||
public int left = 0;
|
||||
public int right = 255;
|
||||
|
||||
|
@ -220,18 +220,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
int the_bottom;
|
||||
if (emu.DisplayType == DisplayType.NTSC)
|
||||
{
|
||||
the_top = ntsc_top;
|
||||
the_bottom = ntsc_bottom;
|
||||
the_top = emu.Settings.NTSC_TopLine;
|
||||
the_bottom = emu.Settings.NTSC_BottomLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
the_top = pal_top;
|
||||
the_bottom = pal_bottom;
|
||||
the_top = emu.Settings.PAL_TopLine;
|
||||
the_bottom = emu.Settings.PAL_BottomLine;
|
||||
}
|
||||
|
||||
int backdrop = 0;
|
||||
if (emu.CoreComm != null)
|
||||
backdrop = emu.CoreComm.NES_BackdropColor;
|
||||
backdrop = emu.Settings.BackgroundColor;
|
||||
bool useBackdrop = (backdrop & 0xFF000000) != 0;
|
||||
|
||||
//TODO - we could recalculate this on the fly (and invalidate/recalculate it when the palette is changed)
|
||||
|
@ -258,58 +257,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
{
|
||||
if (emu.DisplayType == DisplayType.NTSC)
|
||||
{
|
||||
return ntsc_bottom - ntsc_top + 1;
|
||||
return emu.Settings.NTSC_BottomLine - emu.Settings.NTSC_TopLine + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pal_bottom - pal_top + 1;
|
||||
return emu.Settings.PAL_BottomLine - emu.Settings.PAL_TopLine + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int NTSC_FirstDrawLine
|
||||
{
|
||||
get { return videoProvider.ntsc_top; }
|
||||
set { videoProvider.ntsc_top = value; CoreComm.ScreenLogicalOffsetY = videoProvider.ntsc_top; }
|
||||
}
|
||||
|
||||
public int NTSC_LastDrawLine
|
||||
{
|
||||
get { return videoProvider.ntsc_bottom; }
|
||||
set { videoProvider.ntsc_bottom = value; }
|
||||
}
|
||||
|
||||
public int PAL_FirstDrawLine
|
||||
{
|
||||
get { return videoProvider.pal_top; }
|
||||
set { videoProvider.pal_top = value; CoreComm.ScreenLogicalOffsetY = videoProvider.pal_top; }
|
||||
}
|
||||
|
||||
public int PAL_LastDrawLine
|
||||
{
|
||||
get { return videoProvider.pal_bottom; }
|
||||
set { videoProvider.pal_bottom = value; }
|
||||
}
|
||||
|
||||
public void SetClipLeftAndRight(bool clip)
|
||||
{
|
||||
if (clip)
|
||||
{
|
||||
videoProvider.left = 8;
|
||||
videoProvider.right = 248;
|
||||
}
|
||||
else
|
||||
{
|
||||
videoProvider.left = 0;
|
||||
videoProvider.right = 255;
|
||||
}
|
||||
|
||||
CoreComm.ScreenLogicalOffsetX = videoProvider.left;
|
||||
videoProvider.FillFrameBuffer();
|
||||
}
|
||||
|
||||
MyVideoProvider videoProvider;
|
||||
public IVideoProvider VideoProvider { get { return videoProvider; } }
|
||||
public ISoundProvider SoundProvider { get { return magicSoundProvider; } }
|
||||
|
@ -912,6 +870,48 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
};
|
||||
}
|
||||
|
||||
NESSettings Settings = new NESSettings();
|
||||
|
||||
public object GetSettings() { return Settings.Clone(); }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o)
|
||||
{
|
||||
Settings = (NESSettings)o;
|
||||
if (Settings.ClipLeftAndRight)
|
||||
{
|
||||
videoProvider.left = 8;
|
||||
videoProvider.right = 248;
|
||||
}
|
||||
else
|
||||
{
|
||||
videoProvider.left = 0;
|
||||
videoProvider.right = 255;
|
||||
}
|
||||
CoreComm.ScreenLogicalOffsetX = videoProvider.left;
|
||||
CoreComm.ScreenLogicalOffsetY = DisplayType == DisplayType.NTSC ? Settings.NTSC_TopLine : Settings.PAL_TopLine;
|
||||
return false;
|
||||
}
|
||||
|
||||
public class NESSettings
|
||||
{
|
||||
public bool AllowMoreThanEightSprites = false;
|
||||
public bool ClipLeftAndRight = false;
|
||||
public bool AutoLoadPalette = true;
|
||||
public bool DispBackground = true;
|
||||
public bool DispSprites = true;
|
||||
public int BackgroundColor = 0;
|
||||
|
||||
public int NTSC_TopLine = 8;
|
||||
public int NTSC_BottomLine = 231;
|
||||
public int PAL_TopLine = 0;
|
||||
public int PAL_BottomLine = 239;
|
||||
|
||||
public NESSettings Clone()
|
||||
{
|
||||
return (NESSettings)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
pixelcolor |= 0x8000; //whats this? i think its a flag to indicate a hidden background to be used by the canvas filling logic later
|
||||
}
|
||||
|
||||
if (!nes.CoreComm.NES_ShowBG)
|
||||
if (!nes.Settings.DispBackground)
|
||||
pixelcolor = 0x8000; //whats this? i think its a flag to indicate a hidden background to be used by the canvas filling logic later
|
||||
|
||||
//look for a sprite to be drawn
|
||||
|
@ -255,7 +255,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
Reg2002_objhit |= (oam->index == 0 && pixel != 0 && rasterpos < 255);
|
||||
//priority handling, if in front of BG:
|
||||
bool drawsprite = !(((oam->oam[2] & 0x20) != 0) && ((pixel & 3) != 0));
|
||||
if (drawsprite && nes.CoreComm.NES_ShowOBJ)
|
||||
if (drawsprite && nes.Settings.DispSprites)
|
||||
{
|
||||
//bring in the palette bits and palettize
|
||||
spixel |= (oam->oam[2] & 3) << 2;
|
||||
|
@ -296,7 +296,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
if (oamcount >= 8 && reg_2001.PPUON)
|
||||
{
|
||||
Reg2002_objoverflow = true;
|
||||
if(!nes.CoreComm.NES_UnlimitedSprites)
|
||||
if(!nes.Settings.AllowMoreThanEightSprites)
|
||||
break;
|
||||
}
|
||||
//just copy some bytes into the internal sprite buffer
|
||||
|
|
|
@ -1045,5 +1045,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
public void EndAsyncSound() { }
|
||||
|
||||
#endregion audio stuff
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -623,5 +623,9 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
if (disc != null)
|
||||
disc.Dispose();
|
||||
}
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -479,5 +479,9 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis
|
|||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
|
@ -462,5 +462,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
public MemoryDomainList MemoryDomains { get { return memoryDomains; } }
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,8 +139,8 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
if (factor == 0)
|
||||
LibYabause.libyabause_glresize(width, height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void FrameAdvance(bool render, bool rendersound = true)
|
||||
{
|
||||
|
@ -424,7 +424,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -631,5 +631,9 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -624,5 +624,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,5 +211,9 @@ namespace BizHawk.Emulation.Cores.Sony.PSP
|
|||
public void DiscardSamples()
|
||||
{
|
||||
}
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,6 +281,10 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
public int MaxVolume { get; set; }
|
||||
private List<MemoryDomain> memoryDomains = new List<MemoryDomain>();
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
public object GetSettings() { return null; }
|
||||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o) { return false; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue