core settings stuff etc
This commit is contained in:
parent
7acc64c37e
commit
0347fc5eef
|
@ -1,4 +1,5 @@
|
|||
using System.Drawing;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||
|
@ -307,10 +308,60 @@ namespace BizHawk.Client.Common
|
|||
public int GifWriterFrameskip = 3;
|
||||
public int GifWriterDelay = -1;
|
||||
|
||||
// emulation core settings
|
||||
#region emulation core settings
|
||||
|
||||
public Dictionary<string, object> CoreSettings = new Dictionary<string, object>();
|
||||
public Dictionary<string, object> CoreSyncSettings = new Dictionary<string, object>();
|
||||
|
||||
public object GetCoreSettings<T>()
|
||||
where T : IEmulator
|
||||
{
|
||||
return GetCoreSettings(typeof(T));
|
||||
}
|
||||
public object GetCoreSettings(Type t)
|
||||
{
|
||||
object ret;
|
||||
CoreSettings.TryGetValue(t.ToString(), out ret);
|
||||
return ret;
|
||||
}
|
||||
public void PutCoreSettings<T>(object o)
|
||||
where T : IEmulator
|
||||
{
|
||||
PutCoreSettings(o, typeof(T));
|
||||
}
|
||||
public void PutCoreSettings(object o, Type t)
|
||||
{
|
||||
if (o != null)
|
||||
CoreSettings[t.ToString()] = o;
|
||||
else
|
||||
CoreSettings.Remove(t.ToString());
|
||||
}
|
||||
public object GetCoreSyncSettings<T>()
|
||||
where T : IEmulator
|
||||
{
|
||||
return GetCoreSyncSettings(typeof(T));
|
||||
}
|
||||
public object GetCoreSyncSettings(Type t)
|
||||
{
|
||||
object ret;
|
||||
CoreSyncSettings.TryGetValue(t.ToString(), out ret);
|
||||
return ret;
|
||||
}
|
||||
public void PutCoreSyncSettings<T>(object o)
|
||||
where T : IEmulator
|
||||
{
|
||||
PutCoreSyncSettings(o, typeof(T));
|
||||
}
|
||||
public void PutCoreSyncSettings(object o, Type t)
|
||||
{
|
||||
if (o != null)
|
||||
CoreSyncSettings[t.ToString()] = o;
|
||||
else
|
||||
CoreSyncSettings.Remove(t.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// NESPPU Settings
|
||||
public bool AutoLoadNESPPU = false;
|
||||
public bool NESPPUSaveWindowPosition = true;
|
||||
|
@ -591,9 +642,9 @@ namespace BizHawk.Client.Common
|
|||
public bool GGHighlightActiveDisplayRegion = false;
|
||||
|
||||
// PCEngine Settings
|
||||
public bool PceSpriteLimit = false;
|
||||
public bool PceEqualizeVolume = false;
|
||||
public bool PceArcadeCardRewindHack = true;
|
||||
//public bool PceSpriteLimit = false;
|
||||
//public bool PceEqualizeVolume = false;
|
||||
//public bool PceArcadeCardRewindHack = true;
|
||||
|
||||
// Genesis Settings
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ using BizHawk.Emulation.Cores.Calculators;
|
|||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SNES;
|
||||
using BizHawk.Emulation.Cores.PCEngine;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -1235,9 +1236,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void PCESubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
PCEAlwaysPerformSpriteLimitMenuItem.Checked = Global.Config.PceSpriteLimit;
|
||||
PCEAlwaysEqualizeVolumesMenuItem.Checked = Global.Config.PceEqualizeVolume;
|
||||
PCEArcadeCardRewindEnableMenuItem.Checked = Global.Config.PceArcadeCardRewindHack;
|
||||
var s = (PCEngine.PCESettings)Global.Emulator.GetSettings();
|
||||
|
||||
PCEAlwaysPerformSpriteLimitMenuItem.Checked = s.SpriteLimit;
|
||||
PCEAlwaysEqualizeVolumesMenuItem.Checked = s.EqualizeVolume;
|
||||
PCEArcadeCardRewindEnableMenuItem.Checked = s.ArcadeCardRewindHack;
|
||||
}
|
||||
|
||||
private void PCEBGViewerMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1247,26 +1250,28 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void PCEAlwaysPerformSpriteLimitMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.PceSpriteLimit ^= true;
|
||||
FlagNeedsReboot();
|
||||
var s = (PCEngine.PCESettings)Global.Emulator.GetSettings();
|
||||
s.SpriteLimit ^= true;
|
||||
PutCoreSettings(s);
|
||||
}
|
||||
|
||||
private void PCEAlwaysEqualizeVolumesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.PceEqualizeVolume ^= true;
|
||||
FlagNeedsReboot();
|
||||
var s = (PCEngine.PCESettings)Global.Emulator.GetSettings();
|
||||
s.EqualizeVolume ^= true;
|
||||
PutCoreSettings(s);
|
||||
}
|
||||
|
||||
private void PCEArcadeCardRewindEnableMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.PceArcadeCardRewindHack ^= true;
|
||||
FlagNeedsReboot();
|
||||
var s = (PCEngine.PCESettings)Global.Emulator.GetSettings();
|
||||
s.ArcadeCardRewindHack ^= true;
|
||||
PutCoreSettings(s);
|
||||
}
|
||||
|
||||
private void PCEGraphicsSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
new PCEGraphicsConfig().ShowDialog();
|
||||
CoreFileProvider.SyncCoreCommInputSignals();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -2152,6 +2152,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
LoadRom(file.FullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// send core settings to emu, setting reboot flag if needed
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
private void PutCoreSettings(object o)
|
||||
{
|
||||
if (Global.Emulator.PutSettings(o))
|
||||
FlagNeedsReboot();
|
||||
}
|
||||
|
||||
private void SaveConfig()
|
||||
{
|
||||
if (Global.Config.SaveWindowPosition)
|
||||
|
@ -3253,23 +3263,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
"This game requires a version 3.0 System card and won't run with the system card you've selected. Try selecting a 3.0 System Card in Config->Paths->PC Engine.");
|
||||
}
|
||||
|
||||
if (Global.Config.PceSpriteLimit)
|
||||
{
|
||||
game.AddOption("ForceSpriteLimit");
|
||||
}
|
||||
|
||||
if (Global.Config.PceEqualizeVolume)
|
||||
{
|
||||
game.AddOption("EqualizeVolumes");
|
||||
}
|
||||
|
||||
if (Global.Config.PceArcadeCardRewindHack)
|
||||
{
|
||||
game.AddOption("ArcadeRewindHack");
|
||||
}
|
||||
|
||||
game.FirmwareHash = Util.BytesToHexString(System.Security.Cryptography.SHA1.Create().ComputeHash(rom.RomData));
|
||||
nextEmulator = new PCEngine(nextComm, game, disc, rom.RomData);
|
||||
nextEmulator = new PCEngine(nextComm, game, disc, rom.RomData, Global.Config.GetCoreSettings<PCEngine>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3410,12 +3405,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
case "PCE":
|
||||
case "PCECD":
|
||||
case "SGX":
|
||||
if (Global.Config.PceSpriteLimit)
|
||||
{
|
||||
game.AddOption("ForceSpriteLimit");
|
||||
}
|
||||
|
||||
nextEmulator = new PCEngine(nextComm, game, rom.RomData);
|
||||
nextEmulator = new PCEngine(nextComm, game, rom.RomData, Global.Config.GetCoreSettings<PCEngine>());
|
||||
break;
|
||||
case "GEN":
|
||||
{
|
||||
|
@ -3431,10 +3421,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
break;
|
||||
case "NES":
|
||||
{
|
||||
var nes = new NES(nextComm, game, rom.FileData, Global.MovieSession.Movie.Header.BoardProperties);
|
||||
nextEmulator = nes;
|
||||
}
|
||||
nextEmulator = new NES(nextComm, game, rom.FileData,
|
||||
Global.Config.GetCoreSettings<NES>(),
|
||||
Global.MovieSession.Movie.Header.BoardProperties);
|
||||
break;
|
||||
case "GB":
|
||||
case "GBC":
|
||||
|
@ -3559,15 +3548,6 @@ 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;
|
||||
|
@ -3774,13 +3754,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
{
|
||||
// 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;
|
||||
Type t = Global.Emulator.GetType();
|
||||
Global.Config.PutCoreSettings(Global.Emulator.GetSettings(), t);
|
||||
Global.Config.PutCoreSyncSettings(Global.Emulator.GetSyncSettings(), t);
|
||||
}
|
||||
|
||||
Global.Emulator.Dispose();
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
static readonly bool USE_DATABASE = true;
|
||||
public RomStatus RomStatus;
|
||||
|
||||
public NES(CoreComm comm, GameInfo game, byte[] rom, Dictionary<string, string> boardProperties = null)
|
||||
public NES(CoreComm comm, GameInfo game, byte[] rom, object Settings, Dictionary<string, string> boardProperties = null)
|
||||
{
|
||||
byte[] fdsbios = comm.CoreFileProvider.GetFirmware("NES", "Bios_FDS", false);
|
||||
if (fdsbios != null && fdsbios.Length == 40976)
|
||||
|
@ -48,6 +48,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
CoreComm.UsesDriveLed = true;
|
||||
b.SetDriveLightCallback((val) => CoreComm.DriveLED = val);
|
||||
}
|
||||
PutSettings(Settings);
|
||||
}
|
||||
|
||||
private NES()
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
// 21,477,270 Machine clocks / sec
|
||||
// 7,159,090 Cpu cycles / sec
|
||||
|
||||
public PCEngine(CoreComm comm, GameInfo game, byte[] rom)
|
||||
public PCEngine(CoreComm comm, GameInfo game, byte[] rom, object Settings)
|
||||
{
|
||||
CoreComm = comm;
|
||||
CoreComm.CpuTraceAvailable = true;
|
||||
|
@ -70,12 +70,12 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
Type = NecSystemType.SuperGrafx;
|
||||
break;
|
||||
}
|
||||
Init(game, rom);
|
||||
Init(game, rom, (PCESettings)Settings);
|
||||
}
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public PCEngine(CoreComm comm, GameInfo game, Disc disc, byte[] rom)
|
||||
public PCEngine(CoreComm comm, GameInfo game, Disc disc, byte[] rom, object Settings)
|
||||
{
|
||||
CoreComm = comm;
|
||||
CoreComm.CpuTraceAvailable = true;
|
||||
|
@ -83,12 +83,12 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
systemid = "PCECD";
|
||||
Type = NecSystemType.TurboCD;
|
||||
this.disc = disc;
|
||||
Init(game, rom);
|
||||
Init(game, rom, (PCESettings)Settings);
|
||||
// the default RomStatusDetails don't do anything with Disc
|
||||
CoreComm.RomStatusDetails = string.Format("{0}\r\nDisk partial hash:{1}", game.Name, disc.GetHash());
|
||||
}
|
||||
|
||||
void Init(GameInfo game, byte[] rom)
|
||||
void Init(GameInfo game, byte[] rom, PCESettings Settings)
|
||||
{
|
||||
Controller = NullController.GetNullController();
|
||||
Cpu = new HuC6280();
|
||||
|
@ -99,6 +99,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
|
||||
Cpu.Logger = (s) => CoreComm.Tracer.Put(s);
|
||||
|
||||
this.Settings = Settings;
|
||||
|
||||
if (TurboGrafx)
|
||||
{
|
||||
Ram = new byte[0x2000];
|
||||
|
@ -182,7 +184,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
{
|
||||
ArcadeRam = new byte[0x200000];
|
||||
ArcadeCard = true;
|
||||
ArcadeCardRewindHack = game["ArcadeRewindHack"];
|
||||
ArcadeCardRewindHack = Settings.ArcadeCardRewindHack;
|
||||
for (int i = 0; i < 4; i++)
|
||||
ArcadePage[i] = new ArcadeCardPage();
|
||||
}
|
||||
|
@ -194,7 +196,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
Cpu.WriteMemory21 = WriteMemoryPopulous;
|
||||
}
|
||||
|
||||
if (game["ForceSpriteLimit"] || game.NotInDatabase)
|
||||
if (Settings.SpriteLimit || game.NotInDatabase)
|
||||
{
|
||||
VDC1.PerformSpriteLimit = true;
|
||||
if (VDC2 != null)
|
||||
|
@ -207,7 +209,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
PSG.MaxVolume = int.Parse(game.OptionValue("PsgVol"));
|
||||
if (game["AdpcmVol"])
|
||||
ADPCM.MaxVolume = int.Parse(game.OptionValue("AdpcmVol"));
|
||||
if (game["EqualizeVolumes"] || (game.NotInDatabase && TurboCD))
|
||||
if (Settings.EqualizeVolume || (game.NotInDatabase && TurboCD))
|
||||
SoundMixer.EqualizeVolumes();
|
||||
|
||||
// Ok, yes, HBlankPeriod's only purpose is game-specific hax.
|
||||
|
@ -630,8 +632,17 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
public object GetSyncSettings() { return null; }
|
||||
public bool PutSettings(object o)
|
||||
{
|
||||
Settings = (PCESettings)o;
|
||||
return false;
|
||||
PCESettings n = (PCESettings)o;
|
||||
bool ret;
|
||||
if (n.ArcadeCardRewindHack != Settings.ArcadeCardRewindHack ||
|
||||
n.SpriteLimit != Settings.SpriteLimit ||
|
||||
n.EqualizeVolume != Settings.EqualizeVolume)
|
||||
ret = true;
|
||||
else
|
||||
ret = false;
|
||||
|
||||
Settings = n;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public class PCESettings
|
||||
|
@ -641,6 +652,11 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
public bool ShowBG2 = true;
|
||||
public bool ShowOBJ2 = true;
|
||||
|
||||
// these three require core reboot to use
|
||||
public bool SpriteLimit = false;
|
||||
public bool EqualizeVolume = false;
|
||||
public bool ArcadeCardRewindHack = true;
|
||||
|
||||
public PCESettings Clone()
|
||||
{
|
||||
return (PCESettings)MemberwiseClone();
|
||||
|
|
Loading…
Reference in New Issue