Fix crash on input display for dual gameboy
This commit is contained in:
parent
af27877460
commit
de53d1d810
|
@ -221,29 +221,28 @@ namespace BizHawk.Client.Common
|
|||
|
||||
class MnemonicChecker
|
||||
{
|
||||
private readonly string m;
|
||||
private readonly string _mnemonic;
|
||||
|
||||
public MnemonicChecker(string _m)
|
||||
public MnemonicChecker(string mnemonic)
|
||||
{
|
||||
m = _m;
|
||||
_mnemonic = mnemonic;
|
||||
}
|
||||
|
||||
public bool this[int c]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m[c] == '.')
|
||||
if (_mnemonic[c] == '.')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (m[c] == '?')
|
||||
|
||||
if (_mnemonic[c] == '?')
|
||||
{
|
||||
return new Random((int)DateTime.Now.Ticks).Next(0, 10) > 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -503,13 +502,15 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private void SetDualGameBoyControllerAsMnemonic(string mnemonic)
|
||||
{
|
||||
MnemonicChecker c = new MnemonicChecker(mnemonic);
|
||||
var checker = new MnemonicChecker(mnemonic);
|
||||
MyBoolButtons.Clear();
|
||||
for (int i = 0; i < MnemonicConstants.DGBMnemonic.Length; i++)
|
||||
{
|
||||
var t = MnemonicConstants.DGBMnemonic[i];
|
||||
if (t.Item1 != null)
|
||||
Force(t.Item1, c[i]);
|
||||
{
|
||||
Force(t.Item1, checker[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -291,22 +291,28 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public string MakeIntersectImmediatePrevious()
|
||||
{
|
||||
var m = new MovieControllerAdapter { Type = Global.MovieSession.MovieControllerAdapter.Type };
|
||||
m.SetControllersAsMnemonic(
|
||||
Global.MovieSession.Movie.GetInput(Global.Emulator.Frame - 1));
|
||||
|
||||
var andAdaptor = new AndAdapter
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Source = Global.AutofireStickyXORAdapter,
|
||||
SourceAnd = m
|
||||
};
|
||||
var m = new MovieControllerAdapter { Type = Global.MovieSession.MovieControllerAdapter.Type };
|
||||
m.SetControllersAsMnemonic(
|
||||
Global.MovieSession.Movie.GetInput(Global.Emulator.Frame - 1));
|
||||
|
||||
var mg = new MnemonicsGenerator();
|
||||
mg.SetSource(andAdaptor);
|
||||
var andAdaptor = new AndAdapter
|
||||
{
|
||||
Source = Global.AutofireStickyXORAdapter,
|
||||
SourceAnd = m
|
||||
};
|
||||
|
||||
var sb = new StringBuilder(mg.GetControllersAsMnemonic());
|
||||
sb.Replace(".", " ").Replace("|", "").Replace(" 000, 000", " ");
|
||||
return sb.ToString();
|
||||
var mg = new MnemonicsGenerator();
|
||||
mg.SetSource(andAdaptor);
|
||||
|
||||
var sb = new StringBuilder(mg.GetControllersAsMnemonic());
|
||||
sb.Replace(".", " ").Replace("|", "").Replace(" 000, 000", " ");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
// TODO: track previous input even when not movie recording
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string MakeRerecordCount()
|
||||
|
|
Loading…
Reference in New Issue