Load Rom - actually pass in the deterministic emulation flag, and change the logic so that the client derives determinstic emulation (currently just if a movie is active), but can be passed in an override if calling code wanted to.

This commit is contained in:
adelikat 2014-05-24 22:06:08 +00:00
parent 5ebc0f5428
commit 4086eee72d
4 changed files with 34 additions and 30 deletions

View File

@ -55,7 +55,7 @@ namespace BizHawk.Client.Common
public RomLoader()
{
Deterministic = true;
}
// TODO: reconsider the need for exposing these;
@ -64,7 +64,7 @@ namespace BizHawk.Client.Common
public RomGame Rom { get; private set; }
public string CanonicalFullPath { get; private set; }
public bool Deterministic { get; private set; }
public bool Deterministic { get; set; }
public class RomErrorArgs : EventArgs
{

View File

@ -60,7 +60,13 @@ namespace BizHawk.Client.EmuHawk
{
_syncSettingsHack = ConfigService.LoadWithType(s);
}
LoadRom(GlobalWin.MainForm.CurrentlyOpenRom, true, !record);
if (record) // This is a hack really, the movie isn't active yet unless I do this, and LoadRom wants to know if it is
{
Global.MovieSession.Movie.SwitchToRecord();
}
LoadRom(GlobalWin.MainForm.CurrentlyOpenRom);
}
finally
{
@ -156,7 +162,7 @@ namespace BizHawk.Client.EmuHawk
{
if (Global.MovieSession.Movie.IsActive)
{
LoadRom(CurrentlyOpenRom, true, true);
LoadRom(CurrentlyOpenRom);
if (Global.MovieSession.Movie.Header.StartsFromSavestate)
{
byte[] state = Convert.FromBase64String(Global.MovieSession.Movie.Header.SavestateBinaryBase64Blob);

View File

@ -2955,8 +2955,13 @@ namespace BizHawk.Client.EmuHawk
}
// Still needs a good bit of refactoring
public bool LoadRom(string path, bool deterministicemulation = false, bool hasmovie = false)
public bool LoadRom(string path, bool? deterministicemulation = null)
{
// If deterministic emulation is passed in, respect that value regardless, else determine a good value (currently that simply means movies require detemrinistic emulaton)
bool deterministic = deterministicemulation.HasValue ?
deterministicemulation.Value :
Global.MovieSession.Movie.IsActive;
if (!GlobalWin.Tools.AskSave())
{
return false;
@ -2965,7 +2970,8 @@ namespace BizHawk.Client.EmuHawk
var loader = new RomLoader
{
ChooseArchive = LoadArhiveChooser,
ChoosePlatform = ChoosePlatformForRom
ChoosePlatform = ChoosePlatformForRom,
Deterministic = deterministic
};
loader.OnLoadError += ShowLoadError;

View File

@ -53,34 +53,26 @@ namespace BizHawk.Client.EmuHawk
{
text = string.Empty;
try
switch (column)
{
switch (column)
{
case 0:
text = FilteredList[index].ReturnType;
break;
case 1:
text = FilteredList[index].Library;
break;
case 2:
text = FilteredList[index].Name;
break;
case 3:
text = FilteredList[index].ParameterList;
break;
case 4:
text = FilteredList[index].Description;
break;
}
}
catch(Exception ex)
{
case 0:
text = FilteredList[index].ReturnType;
break;
case 1:
text = FilteredList[index].Library;
break;
case 2:
text = FilteredList[index].Name;
break;
case 3:
text = FilteredList[index].ParameterList;
break;
case 4:
text = FilteredList[index].Description;
break;
}
}
private void OrderColumn(int column)
{
_columnSort.Column = column;