N64 - change the expansion slot override notion. If a game in the gamdb has the expansion slot override, override the user's choice, but don't change the sync setting (otherwise all games they load will be set to this). In the N64 menu item, show the checked status based on if the core is actively using the expansion slot, not whether the sync setting is set. If the gamedb is overriding the user's choice make it clear by disabling the menu item. This commit message is longer than the changeset itself.

This commit is contained in:
adelikat 2014-09-27 12:56:55 +00:00
parent e23c5ead86
commit 25c2507013
2 changed files with 20 additions and 5 deletions

View File

@ -1797,8 +1797,11 @@ namespace BizHawk.Client.EmuHawk
var s = (N64Settings)Global.Emulator.GetSettings();
MupenStyleLagMenuItem.Checked = s.UseMupenStyleLag;
var ss = (N64SyncSettings)Global.Emulator.GetSyncSettings();
N64ExpansionSlotMenuItem.Checked = !ss.DisableExpansionSlot;
//var ss = (N64SyncSettings)Global.Emulator.GetSyncSettings();
//N64ExpansionSlotMenuItem.Checked = !ss.DisableExpansionSlot;
N64ExpansionSlotMenuItem.Checked = (Global.Emulator as N64).UsingExpansionSlot;
N64ExpansionSlotMenuItem.Enabled = !(Global.Emulator as N64).IsOverridingUserExpansionSlotSetting;
}
private void N64PluginSettingsMenuItem_Click(object sender, EventArgs e)

View File

@ -37,6 +37,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
private Action _pendingThreadAction;
private bool _disableExpansionSlot = true;
/// <summary>
/// Create mupen64plus Emulator
/// </summary>
@ -58,10 +60,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
_syncSettings = (N64SyncSettings)syncSettings ?? new N64SyncSettings();
_settings = (N64Settings)settings ?? new N64Settings();
_disableExpansionSlot = _syncSettings.DisableExpansionSlot;
// Override the user's expansion slot setting if it is mentioned in the gamedb (it is mentioned but the game MUST have this setting or else not work
if (game.OptionValue("expansionpak") != null && game.OptionValue("expansionpak") == "1")
{
_syncSettings.DisableExpansionSlot = false;
_disableExpansionSlot = false;
IsOverridingUserExpansionSlotSetting = true;
}
byte country_code = file[0x3E];
@ -109,7 +114,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
//not sure why this works... if we put the plugin initializations in here, we get deadlocks in some SDL initialization. doesnt make sense to me...
RunThreadAction(() =>
{
api = new mupen64plusApi(this, file, videosettings, SaveType, (int)coreType, _syncSettings.DisableExpansionSlot);
api = new mupen64plusApi(this, file, videosettings, SaveType, (int)coreType, _disableExpansionSlot);
});
// Order is important because the register with the mupen core
@ -131,6 +136,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
SetControllerButtons();
}
public bool UsingExpansionSlot
{
get { return !_disableExpansionSlot; }
}
public bool IsOverridingUserExpansionSlotSetting { get; set; }
public void Dispose()
{
RunThreadAction(() =>
@ -341,7 +353,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
public void LoadStateBinary(BinaryReader reader)
{
int length = reader.ReadInt32();
if ((_syncSettings.DisableExpansionSlot && length >= 16788288) || (!_syncSettings.DisableExpansionSlot && length < 16788288))
if ((_disableExpansionSlot && length >= 16788288) || (!_disableExpansionSlot && length < 16788288))
{
throw new SavestateSizeMismatchException("Wrong N64 savestate size");
}