Snes - use the compatibility profile override option in the game db, note that it will be a temporary override for the game if detected, the user setting will not be permanently changed. This touched a bunch of things, and many other things had to be considered, there's a reasonable chance that this broke something

This commit is contained in:
adelikat 2014-11-19 00:32:51 +00:00
parent 5a5c7715a3
commit 17c6a2c1f6
4 changed files with 28 additions and 11 deletions

View File

@ -306,7 +306,7 @@ namespace BizHawk.Client.Common
// Bsnes profiles have incompatible savestates so save the profile name
if (Global.Emulator is LibsnesCore)
{
name += "." + (Global.Emulator as LibsnesCore).GetSyncSettings().Profile;
name += "." + (Global.Emulator as LibsnesCore).CurrentProfile;
}
if (Global.MovieSession.Movie.IsActive)

View File

@ -79,7 +79,7 @@ namespace BizHawk.Client.EmuHawk.CoreExtensions
if (Global.Emulator is LibsnesCore)
{
str += " (" + (((LibsnesCore)Global.Emulator).GetSyncSettings()).Profile + ")";
str += " (" + ((LibsnesCore)Global.Emulator).CurrentProfile + ")";
}
return str;

View File

@ -413,8 +413,7 @@ namespace BizHawk.Client.EmuHawk
else if (Global.Emulator is LibsnesCore)
{
var snes = (LibsnesCore)Global.Emulator;
var ss = snes.GetSyncSettings();
if (ss.Profile == "Performance")
if (snes.CurrentProfile == "Performance")
{
var box = new MsgBox(
"While the performance core is faster, it is not stable enough for movie recording\n\nSwitch to Compatibility?",
@ -431,6 +430,7 @@ namespace BizHawk.Client.EmuHawk
if (result == DialogResult.Yes)
{
var ss = snes.GetSyncSettings();
ss.Profile = "Compatibility";
snes.PutSyncSettings(ss);
}

View File

@ -34,6 +34,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
{
public LibsnesCore(GameInfo game, byte[] romData, bool deterministicEmulation, byte[] xmlData, CoreComm comm, object Settings, object SyncSettings)
{
_game = game;
CoreComm = comm;
byte[] sgbRomData = null;
if (game["SGB"])
@ -164,6 +165,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
}
}
private GameInfo _game;
public string CurrentProfile
{
get
{
// TODO: This logic will only work until Accuracy is ready, would we really want to override the user's choice of Accuracy with Compatibility?
if (_game.OptionValue("profile") == "Compatibility")
{
return "Compatibility";
}
return SyncSettings.Profile;
}
}
public bool IsSGB { get; private set; }
/// <summary>disable all external callbacks. the front end should not even know the core is frame advancing</summary>
@ -345,12 +362,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
// if (Win32.Is64BitOperatingSystem)
// bits = "64";
var exename = "libsneshawk-" + bits + "-" + SyncSettings.Profile.ToLower() + ".exe";
var exename = "libsneshawk-" + bits + "-" + CurrentProfile.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.");
throw new InvalidOperationException("Couldn't locate the executable for SNES emulation for profile: " + CurrentProfile + ". Please make sure you're using a fresh dearchive of a BizHawk distribution.");
return exePath;
}
@ -687,7 +704,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
// Perormance will NEVER be in deterministic mode (and the client side logic will prohibit movie recording on it)
public bool DeterministicEmulation
{
get { return SyncSettings.Profile == "Compatibility" || SyncSettings.Profile == "Accuracy"; }
get { return CurrentProfile == "Compatibility" || CurrentProfile == "Accuracy"; }
private set { /* Do nothing */ }
}
@ -847,7 +864,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
var temp = SaveStateBinary();
temp.SaveAsHexFast(writer);
writer.WriteLine("Frame {0}", Frame); // we don't parse this, it's only for the client to use
writer.WriteLine("Profile {0}", SyncSettings.Profile);
writer.WriteLine("Profile {0}", CurrentProfile);
}
public void LoadStateText(TextReader reader)
{
@ -871,7 +888,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
writer.Write(IsLagFrame);
writer.Write(LagCount);
writer.Write(Frame);
writer.Write(SyncSettings.Profile);
writer.Write(CurrentProfile);
writer.Flush();
}
@ -919,9 +936,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
void ValidateLoadstateProfile(string profile)
{
if (profile != SyncSettings.Profile)
if (profile != CurrentProfile)
{
throw new InvalidOperationException(string.Format("You've attempted to load a savestate made using a different SNES profile ({0}) than your current configuration ({1}). 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.", profile, SyncSettings.Profile));
throw new InvalidOperationException(string.Format("You've attempted to load a savestate made using a different SNES profile ({0}) than your current configuration ({1}). 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.", profile, CurrentProfile));
}
}