Use string interpolation
This commit is contained in:
parent
d54146791e
commit
9d0ee22885
|
@ -260,7 +260,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (abort)
|
if (abort)
|
||||||
{
|
{
|
||||||
throw new Exception("Essential zip section not found: " + lump.ReadName);
|
throw new Exception($"Essential zip section not found: {lump.ReadName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (required)
|
if (required)
|
||||||
{
|
{
|
||||||
var fullmsg = $"Couldn't find required firmware \"{sysID}:{firmwareID}\". This is fatal{(msg != null ? ": " + msg : ".")}";
|
var fullmsg = $"Couldn't find required firmware \"{sysID}:{firmwareID}\". This is fatal{(msg != null ? $": {msg}" : ".")}";
|
||||||
throw new MissingFirmwareException(fullmsg);
|
throw new MissingFirmwareException(fullmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace BizHawk.Client.Common
|
||||||
public Token token = new Token();
|
public Token token = new Token();
|
||||||
|
|
||||||
public string TypeName { get { return "Libretro"; } }
|
public string TypeName { get { return "Libretro"; } }
|
||||||
public string DisplayName { get { return string.Format("{0}:{1}", Path.GetFileNameWithoutExtension(token.CorePath), token.Path); } }
|
public string DisplayName { get { return $"{Path.GetFileNameWithoutExtension(token.CorePath)}:{token.Path}"; } }
|
||||||
public string SimplePath { get { return token.Path; } }
|
public string SimplePath { get { return token.Path; } }
|
||||||
|
|
||||||
public void Deserialize(string str)
|
public void Deserialize(string str)
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string MakeProgramRelativePath(string path)
|
public static string MakeProgramRelativePath(string path)
|
||||||
{
|
{
|
||||||
return MakeAbsolutePath("%exe%/" + path, null);
|
return MakeAbsolutePath($"%exe%/{path}", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetDllDirectory()
|
public static string GetDllDirectory()
|
||||||
|
@ -262,13 +262,13 @@ namespace BizHawk.Client.Common
|
||||||
var name = FilesystemSafeName(game);
|
var name = FilesystemSafeName(game);
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive)
|
||||||
{
|
{
|
||||||
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
|
name += $".{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
var pathEntry = Global.Config.PathEntries[game.System, "Save RAM"] ??
|
var pathEntry = Global.Config.PathEntries[game.System, "Save RAM"] ??
|
||||||
Global.Config.PathEntries[game.System, "Base"];
|
Global.Config.PathEntries[game.System, "Base"];
|
||||||
|
|
||||||
return Path.Combine(MakeAbsolutePath(pathEntry.Path, game.System), name) + ".SaveRAM";
|
return $"{Path.Combine(MakeAbsolutePath(pathEntry.Path, game.System), name)}.SaveRAM";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string AutoSaveRamPath(GameInfo game)
|
public static string AutoSaveRamPath(GameInfo game)
|
||||||
|
@ -289,7 +289,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive)
|
||||||
{
|
{
|
||||||
name = Path.Combine(name, "movie-" + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename));
|
name = Path.Combine(name, $"movie-{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var pathEntry = Global.Config.PathEntries[game.System, "Save RAM"] ??
|
var pathEntry = Global.Config.PathEntries[game.System, "Save RAM"] ??
|
||||||
|
@ -337,34 +337,34 @@ namespace BizHawk.Client.Common
|
||||||
// Neshawk and Quicknes have incompatible savestates, store the name to keep them separate
|
// Neshawk and Quicknes have incompatible savestates, store the name to keep them separate
|
||||||
if (Global.Emulator.SystemId == "NES")
|
if (Global.Emulator.SystemId == "NES")
|
||||||
{
|
{
|
||||||
name += "." + Global.Emulator.Attributes().CoreName;
|
name += $".{Global.Emulator.Attributes().CoreName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gambatte and GBHawk have incompatible savestates, store the name to keep them separate
|
// Gambatte and GBHawk have incompatible savestates, store the name to keep them separate
|
||||||
if (Global.Emulator.SystemId == "GB")
|
if (Global.Emulator.SystemId == "GB")
|
||||||
{
|
{
|
||||||
name += "." + Global.Emulator.Attributes().CoreName;
|
name += $".{Global.Emulator.Attributes().CoreName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.Emulator is Snes9x) // Keep snes9x savestate away from libsnes, we want to not be too tedious so bsnes names will just have the profile name not the core name
|
if (Global.Emulator is Snes9x) // Keep snes9x savestate away from libsnes, we want to not be too tedious so bsnes names will just have the profile name not the core name
|
||||||
{
|
{
|
||||||
name += "." + Global.Emulator.Attributes().CoreName;
|
name += $".{Global.Emulator.Attributes().CoreName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bsnes profiles have incompatible savestates so save the profile name
|
// Bsnes profiles have incompatible savestates so save the profile name
|
||||||
if (Global.Emulator is LibsnesCore)
|
if (Global.Emulator is LibsnesCore)
|
||||||
{
|
{
|
||||||
name += "." + (Global.Emulator as LibsnesCore).CurrentProfile;
|
name += $".{((LibsnesCore)Global.Emulator).CurrentProfile}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.Emulator.SystemId == "GBA")
|
if (Global.Emulator.SystemId == "GBA")
|
||||||
{
|
{
|
||||||
name += "." + Global.Emulator.Attributes().CoreName;
|
name += $".{Global.Emulator.Attributes().CoreName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive)
|
||||||
{
|
{
|
||||||
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
|
name += $".{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
var pathEntry = Global.Config.PathEntries[game.System, "Savestates"] ??
|
var pathEntry = Global.Config.PathEntries[game.System, "Savestates"] ??
|
||||||
|
|
|
@ -219,7 +219,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
else if (discMountJob.OUT_ErrorLevel)
|
else if (discMountJob.OUT_ErrorLevel)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
|
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (disc == null)
|
else if (disc == null)
|
||||||
|
@ -428,7 +428,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (discMountJob.OUT_ErrorLevel)
|
if (discMountJob.OUT_ErrorLevel)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
|
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disc == null)
|
if (disc == null)
|
||||||
|
@ -496,7 +496,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (discMountJob.OUT_ErrorLevel)
|
if (discMountJob.OUT_ErrorLevel)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
|
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var disc = discMountJob.OUT_Disc;
|
var disc = discMountJob.OUT_Disc;
|
||||||
|
@ -729,7 +729,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (discMountJob.OUT_ErrorLevel)
|
if (discMountJob.OUT_ErrorLevel)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
|
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disc == null)
|
if (disc == null)
|
||||||
|
@ -1171,12 +1171,12 @@ namespace BizHawk.Client.Common
|
||||||
// handle exceptions thrown by the new detected systems that bizhawk does not have cores for
|
// handle exceptions thrown by the new detected systems that bizhawk does not have cores for
|
||||||
else if (ex is NoAvailableCoreException)
|
else if (ex is NoAvailableCoreException)
|
||||||
{
|
{
|
||||||
DoLoadErrorCallback(ex.Message + "\n\n" + ex, system);
|
DoLoadErrorCallback($"{ex.Message}\n\n{ex}", system);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DoLoadErrorCallback("A core accepted the rom, but threw an exception while loading it:\n\n" + ex, system);
|
DoLoadErrorCallback($"A core accepted the rom, but threw an exception while loading it:\n\n{ex}", system);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -29,8 +29,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
var file = new FileInfo(
|
var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{i}.State");
|
||||||
PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave" + i + ".State");
|
|
||||||
if (file.Directory != null && file.Directory.Exists == false)
|
if (file.Directory != null && file.Directory.Exists == false)
|
||||||
{
|
{
|
||||||
file.Directory.Create();
|
file.Directory.Create();
|
||||||
|
@ -108,8 +107,8 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
// Takes the .state and .bak files and swaps them
|
// Takes the .state and .bak files and swaps them
|
||||||
var state = new FileInfo(path);
|
var state = new FileInfo(path);
|
||||||
var backup = new FileInfo(path + ".bak");
|
var backup = new FileInfo($"{path}.bak");
|
||||||
var temp = new FileInfo(path + ".bak.tmp");
|
var temp = new FileInfo($"{path}.bak.tmp");
|
||||||
|
|
||||||
if (!state.Exists || !backup.Exists)
|
if (!state.Exists || !backup.Exists)
|
||||||
{
|
{
|
||||||
|
@ -121,9 +120,9 @@ namespace BizHawk.Client.Common
|
||||||
temp.Delete();
|
temp.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
backup.CopyTo(path + ".bak.tmp");
|
backup.CopyTo($"{path}.bak.tmp");
|
||||||
backup.Delete();
|
backup.Delete();
|
||||||
state.CopyTo(path + ".bak");
|
state.CopyTo($"{path}.bak");
|
||||||
state.Delete();
|
state.Delete();
|
||||||
temp.CopyTo(path);
|
temp.CopyTo(path);
|
||||||
temp.Delete();
|
temp.Delete();
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("Couldn't load XMLGame Asset \"" + filename + "\"");
|
throw new Exception($"Couldn't load XMLGame Asset \"{filename}\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -98,7 +98,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
throw new Exception("Couldn't load XMLGame LoadAsset \"" + filename + "\"");
|
throw new Exception($"Couldn't load XMLGame LoadAsset \"{filename}\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't have anything for the system in question. add a set of stock paths
|
// we don't have anything for the system in question. add a set of stock paths
|
||||||
var systempath = PathManager.RemoveInvalidFileSystemChars(system) + "_INTERIM";
|
var systempath = $"{PathManager.RemoveInvalidFileSystemChars(system)}_INTERIM";
|
||||||
var systemdisp = system + " (INTERIM)";
|
var systemdisp = $"{system} (INTERIM)";
|
||||||
|
|
||||||
Paths.AddRange(new[]
|
Paths.AddRange(new[]
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix = button.GetPrecedingString("Down");
|
prefix = button.GetPrecedingString("Down");
|
||||||
string other = prefix + "Up";
|
string other = $"{prefix}Up";
|
||||||
if (Source.IsPressed(other))
|
if (Source.IsPressed(other))
|
||||||
{
|
{
|
||||||
if (_unpresses.Contains(button))
|
if (_unpresses.Contains(button))
|
||||||
|
@ -61,7 +61,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix = button.GetPrecedingString("Up");
|
prefix = button.GetPrecedingString("Up");
|
||||||
string other = prefix + "Down";
|
string other = $"{prefix}Down";
|
||||||
if (Source.IsPressed(other))
|
if (Source.IsPressed(other))
|
||||||
{
|
{
|
||||||
if (_unpresses.Contains(button))
|
if (_unpresses.Contains(button))
|
||||||
|
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix = button.GetPrecedingString("Right");
|
prefix = button.GetPrecedingString("Right");
|
||||||
string other = prefix + "Left";
|
string other = $"{prefix}Left";
|
||||||
if (Source.IsPressed(other))
|
if (Source.IsPressed(other))
|
||||||
{
|
{
|
||||||
if (_unpresses.Contains(button))
|
if (_unpresses.Contains(button))
|
||||||
|
@ -119,7 +119,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix = button.GetPrecedingString("Left");
|
prefix = button.GetPrecedingString("Left");
|
||||||
string other = prefix + "Right";
|
string other = $"{prefix}Right";
|
||||||
if (Source.IsPressed(other))
|
if (Source.IsPressed(other))
|
||||||
{
|
{
|
||||||
if (_unpresses.Contains(button))
|
if (_unpresses.Contains(button))
|
||||||
|
|
|
@ -62,10 +62,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log(
|
Log($"error running function attached by lua function event.onsavestate\nError message: {e.Message}");
|
||||||
"error running function attached by lua function event.onsavestate" +
|
|
||||||
"\nError message: " +
|
|
||||||
e.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,10 +81,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log(
|
Log($"error running function attached by lua function event.onloadstate\nError message: {e.Message}");
|
||||||
"error running function attached by lua function event.onloadstate" +
|
|
||||||
"\nError message: " +
|
|
||||||
e.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,10 +100,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log(
|
Log($"error running function attached by lua function event.onframestart\nError message: {e.Message}");
|
||||||
"error running function attached by lua function event.onframestart" +
|
|
||||||
"\nError message: " +
|
|
||||||
e.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,10 +119,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log(
|
Log($"error running function attached by lua function event.onframeend\nError message: {e.Message}");
|
||||||
"error running function attached by lua function event.onframeend" +
|
|
||||||
"\nError message: " +
|
|
||||||
e.Message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,9 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
buttons[button] = adaptor.IsPressed(button);
|
buttons[button] = adaptor.IsPressed(button);
|
||||||
}
|
}
|
||||||
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller)
|
else if (button.Length >= 3 && button.Substring(0, 2) == $"P{controller}")
|
||||||
{
|
{
|
||||||
buttons[button.Substring(3)] = adaptor.IsPressed("P" + controller + " " + button.Substring(3));
|
buttons[button.Substring(3)] = adaptor.IsPressed($"P{controller} {button.Substring(3)}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
buttons[button] = adaptor.GetFloat(button);
|
buttons[button] = adaptor.GetFloat(button);
|
||||||
}
|
}
|
||||||
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller)
|
else if (button.Length >= 3 && button.Substring(0, 2) == $"P{controller}")
|
||||||
{
|
{
|
||||||
buttons[button.Substring(3)] = adaptor.GetFloat("P" + controller + " " + button.Substring(3));
|
buttons[button.Substring(3)] = adaptor.GetFloat($"P{controller} {button.Substring(3)}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Log("invalid mnemonic string: " + inputLogEntry);
|
Log($"invalid mnemonic string: {inputLogEntry}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ namespace BizHawk.Client.Common
|
||||||
var toPress = button.ToString();
|
var toPress = button.ToString();
|
||||||
if (controller.HasValue)
|
if (controller.HasValue)
|
||||||
{
|
{
|
||||||
toPress = "P" + controller + " " + button;
|
toPress = $"P{controller} {button}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!invert)
|
if (!invert)
|
||||||
|
@ -180,7 +180,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Global.StickyXORAdapter.SetFloat("P" + controller + " " + name, theValue);
|
Global.StickyXORAdapter.SetFloat($"P{controller} {name}", theValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(filename))
|
if (!string.IsNullOrEmpty(filename))
|
||||||
{
|
{
|
||||||
filename += "." + Global.MovieSession.Movie.PreferredExtension;
|
filename += $".{Global.MovieSession.Movie.PreferredExtension}";
|
||||||
var test = new FileInfo(filename);
|
var test = new FileInfo(filename);
|
||||||
if (test.Exists)
|
if (test.Exists)
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
var table = Lua.NewTable();
|
var table = Lua.NewTable();
|
||||||
m_dbConnection.Open();
|
m_dbConnection.Open();
|
||||||
string sql = "PRAGMA read_uncommitted =1;" + query;
|
string sql = $"PRAGMA read_uncommitted =1;{query}";
|
||||||
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
|
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
|
||||||
SQLiteDataReader reader = command.ExecuteReader();
|
SQLiteDataReader reader = command.ExecuteReader();
|
||||||
bool rows = reader.HasRows;
|
bool rows = reader.HasRows;
|
||||||
|
@ -119,7 +119,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
for (int i = 0; i < reader.FieldCount; ++i)
|
for (int i = 0; i < reader.FieldCount; ++i)
|
||||||
{
|
{
|
||||||
table[columns[i] + " " + rowCount.ToString()] = reader.GetValue(i);
|
table[$"{columns[i]} {rowCount}"] = reader.GetValue(i);
|
||||||
}
|
}
|
||||||
rowCount += 1;
|
rowCount += 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace BizHawk.Client.Common
|
||||||
var hex = $"{num:X}";
|
var hex = $"{num:X}";
|
||||||
if (hex.Length == 1)
|
if (hex.Length == 1)
|
||||||
{
|
{
|
||||||
hex = "0" + hex;
|
hex = $"0{hex}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return hex;
|
return hex;
|
||||||
|
@ -46,7 +46,7 @@ namespace BizHawk.Client.Common
|
||||||
var octal = Convert.ToString(num, 8);
|
var octal = Convert.ToString(num, 8);
|
||||||
if (octal.Length == 1)
|
if (octal.Length == 1)
|
||||||
{
|
{
|
||||||
octal = "0" + octal;
|
octal = $"0{octal}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return octal;
|
return octal;
|
||||||
|
|
|
@ -102,7 +102,7 @@ __Types and notation__
|
||||||
{
|
{
|
||||||
var completion = new SublimeCompletions.Completion
|
var completion = new SublimeCompletions.Completion
|
||||||
{
|
{
|
||||||
Trigger = f.Library + "." + f.Name
|
Trigger = $"{f.Library}.{f.Name}"
|
||||||
};
|
};
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace BizHawk.Client.Common
|
||||||
foreach (var method in methods)
|
foreach (var method in methods)
|
||||||
{
|
{
|
||||||
var luaMethodAttr = (LuaMethodAttribute)method.GetCustomAttributes(luaAttr, false).First();
|
var luaMethodAttr = (LuaMethodAttribute)method.GetCustomAttributes(luaAttr, false).First();
|
||||||
var luaName = Name + "." + luaMethodAttr.Name;
|
var luaName = $"{Name}.{luaMethodAttr.Name}";
|
||||||
Lua.RegisterFunction(luaName, this, method);
|
Lua.RegisterFunction(luaName, this, method);
|
||||||
|
|
||||||
docs?.Add(new LibraryFunction(Name, callingLibrary.Description(), method));
|
docs?.Add(new LibraryFunction(Name, callingLibrary.Description(), method));
|
||||||
|
|
|
@ -67,8 +67,7 @@ namespace BizHawk.Client.Common
|
||||||
return d.PeekByte(addr);
|
return d.PeekByte(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log("Warning: attempted read of " + addr +
|
Log($"Warning: attempted read of {addr} outside the memory size of {d.Size}");
|
||||||
" outside the memory size of " + d.Size);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +82,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log("Warning: attempted write to " + addr +
|
Log($"Warning: attempted write to {addr} outside the memory size of {d.Size}");
|
||||||
" outside the memory size of " + d.Size);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -188,8 +186,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log("Warning: Attempted read " + lastAddr + " outside memory domain size of " +
|
Log($"Warning: Attempted read {lastAddr} outside memory domain size of {d.Size} in readbyterange()");
|
||||||
d.Size + " in readbyterange()");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return table;
|
return table;
|
||||||
|
@ -209,8 +206,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log("Warning: Attempted write " + addr + " outside memory domain size of " +
|
Log($"Warning: Attempted write {addr} outside memory domain size of {d.Size} in writebyterange()");
|
||||||
d.Size + " in writebyterange()");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,8 +226,7 @@ namespace BizHawk.Client.Common
|
||||||
return BitConverter.ToSingle(bytes, 0);
|
return BitConverter.ToSingle(bytes, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log("Warning: Attempted read " + addr +
|
Log($"Warning: Attempted read {addr} outside memory size of {d.Size}");
|
||||||
" outside memory size of " + d.Size);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -250,8 +245,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log("Warning: Attempted write " + addr +
|
Log($"Warning: Attempted write {addr} outside memory size of {d.Size}");
|
||||||
" outside memory size of " + d.Size);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
private bool CoolSetCurrentDirectory(string path, string currDirSpeedHack = null)
|
private bool CoolSetCurrentDirectory(string path, string currDirSpeedHack = null)
|
||||||
{
|
{
|
||||||
string target = _currentDirectory + "\\";
|
string target = $"{_currentDirectory}\\";
|
||||||
|
|
||||||
// first we'll bypass it with a general hack: dont do any setting if the value's already there (even at the OS level, setting the directory can be slow)
|
// first we'll bypass it with a general hack: dont do any setting if the value's already there (even at the OS level, setting the directory can be slow)
|
||||||
// yeah I know, not the smoothest move to compare strings here, in case path normalization is happening at some point
|
// yeah I know, not the smoothest move to compare strings here, in case path normalization is happening at some point
|
||||||
|
@ -45,7 +45,7 @@ namespace BizHawk.Client.Common
|
||||||
// WARNING: setting the current directory is SLOW!!! security checks for some reason.
|
// WARNING: setting the current directory is SLOW!!! security checks for some reason.
|
||||||
// so we're bypassing it with windows hacks
|
// so we're bypassing it with windows hacks
|
||||||
#if WINDOWS
|
#if WINDOWS
|
||||||
fixed (byte* pstr = &System.Text.Encoding.Unicode.GetBytes(target + "\0")[0])
|
fixed (byte* pstr = &System.Text.Encoding.Unicode.GetBytes($"{target}\0")[0])
|
||||||
return SetCurrentDirectoryW(pstr);
|
return SetCurrentDirectoryW(pstr);
|
||||||
#else
|
#else
|
||||||
if (System.IO.Directory.Exists(CurrentDirectory)) // race condition for great justice
|
if (System.IO.Directory.Exists(CurrentDirectory)) // race condition for great justice
|
||||||
|
|
|
@ -23,11 +23,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logCallback(
|
logCallback($"error running function attached by the event {Event}\nError message: {ex.Message}");
|
||||||
"error running function attached by the event " +
|
|
||||||
Event +
|
|
||||||
"\nError message: " +
|
|
||||||
ex.Message);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ namespace BizHawk.Client.Common
|
||||||
var result = Movie.Stop(saveChanges);
|
var result = Movie.Stop(saveChanges);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Output(Path.GetFileName(Movie.Filename) + " written to disk.");
|
Output($"{Path.GetFileName(Movie.Filename)} written to disk.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Output(message);
|
Output(message);
|
||||||
|
@ -225,7 +225,7 @@ namespace BizHawk.Client.Common
|
||||||
if (Movie.IsPlaying)
|
if (Movie.IsPlaying)
|
||||||
{
|
{
|
||||||
Movie.ClearFrame(Global.Emulator.Frame);
|
Movie.ClearFrame(Global.Emulator.Frame);
|
||||||
Output("Scrubbed input at frame " + Global.Emulator.Frame);
|
Output($"Scrubbed input at frame {Global.Emulator.Frame}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
|
||||||
return "Recording None";
|
return "Recording None";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Recording Player " + CurrentPlayer;
|
return $"Recording Player {CurrentPlayer}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,19 +59,9 @@ namespace BizHawk.Client.Common
|
||||||
int startTime = (int)(start * 1000 / fps);
|
int startTime = (int)(start * 1000 / fps);
|
||||||
int endTime = (int)(end * 1000 / fps);
|
int endTime = (int)(end * 1000 / fps);
|
||||||
|
|
||||||
var startString = string.Format(
|
var startString = $"{startTime / 3600000:d2}:{(startTime / 60000) % 60:d2}:{(startTime / 1000) % 60:d2},{startTime % 1000:d3}";
|
||||||
"{0:d2}:{1:d2}:{2:d2},{3:d3}",
|
|
||||||
startTime / 3600000,
|
|
||||||
(startTime / 60000) % 60,
|
|
||||||
(startTime / 1000) % 60,
|
|
||||||
startTime % 1000);
|
|
||||||
|
|
||||||
var endString = string.Format(
|
var endString = $"{endTime / 3600000:d2}:{(endTime / 60000) % 60:d2}:{(endTime / 1000) % 60:d2},{endTime % 1000:d3}";
|
||||||
"{0:d2}:{1:d2}:{2:d2},{3:d3}",
|
|
||||||
endTime / 3600000,
|
|
||||||
(endTime / 60000) % 60,
|
|
||||||
(endTime / 1000) % 60,
|
|
||||||
endTime % 1000);
|
|
||||||
|
|
||||||
sb.Append(startString);
|
sb.Append(startString);
|
||||||
sb.Append(" --> ");
|
sb.Append(" --> ");
|
||||||
|
|
|
@ -103,7 +103,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (i > 0 && lastframe == subs[i].Frame)
|
if (i > 0 && lastframe == subs[i].Frame)
|
||||||
{
|
{
|
||||||
subs[i].Message = subs[i - 1].Message + " " + subs[i].Message;
|
subs[i].Message = $"{subs[i - 1].Message} {subs[i].Message}";
|
||||||
subs.Remove(subs[i - 1]);
|
subs.Remove(subs[i - 1]);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,10 +250,7 @@ namespace BizHawk.Client.Common
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
errorMessage = "The savestate is from frame "
|
errorMessage = $"The savestate is from frame {newLog.Count} which is greater than the current movie length of {Log.Count}";
|
||||||
+ newLog.Count
|
|
||||||
+ " which is greater than the current movie length of "
|
|
||||||
+ Log.Count;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -262,9 +259,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (Log[i] != newLog[i])
|
if (Log[i] != newLog[i])
|
||||||
{
|
{
|
||||||
errorMessage = "The savestate input does not match the movie input at frame "
|
errorMessage = $"The savestate input does not match the movie input at frame {(i + 1)}.";
|
||||||
+ (i + 1)
|
|
||||||
+ ".";
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ namespace BizHawk.Client.Common
|
||||||
string prefix = "";
|
string prefix = "";
|
||||||
if (ControlType != "Gameboy Controller" && ControlType != "TI83 Controller")
|
if (ControlType != "Gameboy Controller" && ControlType != "TI83 Controller")
|
||||||
{
|
{
|
||||||
prefix = "P" + player + " ";
|
prefix = $"P{player} ";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
||||||
|
@ -352,7 +352,7 @@ namespace BizHawk.Client.Common
|
||||||
int start = 3;
|
int start = 3;
|
||||||
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + player + " " + button, c[srcindex + start++]);
|
Force($"P{player} {button}", c[srcindex + start++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ namespace BizHawk.Client.Common
|
||||||
int start = 3;
|
int start = 3;
|
||||||
foreach (string button in BkmMnemonicConstants.Buttons["GPGX 3-Button Controller"].Keys)
|
foreach (string button in BkmMnemonicConstants.Buttons["GPGX 3-Button Controller"].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + player + " " + button, c[srcindex + start++]);
|
Force($"P{player} {button}", c[srcindex + start++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,7 +429,7 @@ namespace BizHawk.Client.Common
|
||||||
int start = 3;
|
int start = 3;
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + player + " " + button, c[srcindex + start++]);
|
Force($"P{player} {button}", c[srcindex + start++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,12 +497,12 @@ namespace BizHawk.Client.Common
|
||||||
int start = 3;
|
int start = 3;
|
||||||
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + player + " " + button, c[srcindex + start++]);
|
Force($"P{player} {button}", c[srcindex + start++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string name in BkmMnemonicConstants.Analogs[ControlType].Keys)
|
foreach (string name in BkmMnemonicConstants.Analogs[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + player + " " + name, int.Parse(mnemonic.Substring(srcindex + start, 4)));
|
Force($"P{player} {name}", int.Parse(mnemonic.Substring(srcindex + start, 4)));
|
||||||
start += 5;
|
start += 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -539,7 +539,7 @@ namespace BizHawk.Client.Common
|
||||||
int start = 3;
|
int start = 3;
|
||||||
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + player + " " + button, c[srcindex + start++]);
|
Force($"P{player} {button}", c[srcindex + start++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + player + " " + button, c[srcindex + start++]);
|
Force($"P{player} {button}", c[srcindex + start++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ namespace BizHawk.Client.Common
|
||||||
int start = 1;
|
int start = 1;
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[ControlType].Keys)
|
||||||
{
|
{
|
||||||
Force("P" + player + " " + button, c[srcindex + start++]);
|
Force($"P{player} {button}", c[srcindex + start++]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace BizHawk.Client.Common
|
||||||
var prefix = "";
|
var prefix = "";
|
||||||
if (_controlType != "Gameboy Controller" && _controlType != "TI83 Controller")
|
if (_controlType != "Gameboy Controller" && _controlType != "TI83 Controller")
|
||||||
{
|
{
|
||||||
prefix = "P" + player + " ";
|
prefix = $"P{player} ";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
||||||
|
@ -313,7 +313,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
input.Append("|");
|
input.Append("|");
|
||||||
|
@ -330,7 +330,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
input.Append('|');
|
input.Append('|');
|
||||||
|
@ -398,7 +398,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
input.Append('|');
|
input.Append('|');
|
||||||
|
@ -448,7 +448,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BkmMnemonicConstants.Analogs[_controlType].Keys.Count > 0)
|
if (BkmMnemonicConstants.Analogs[_controlType].Keys.Count > 0)
|
||||||
|
@ -460,37 +460,37 @@ namespace BizHawk.Client.Common
|
||||||
// Nasty hackery
|
// Nasty hackery
|
||||||
if (name == "Y Axis")
|
if (name == "Y Axis")
|
||||||
{
|
{
|
||||||
if (IsBasePressed("P" + player + " A Up"))
|
if (IsBasePressed($"P{player} A Up"))
|
||||||
{
|
{
|
||||||
val = 127;
|
val = 127;
|
||||||
}
|
}
|
||||||
else if (IsBasePressed("P" + player + " A Down"))
|
else if (IsBasePressed($"P{player} A Down"))
|
||||||
{
|
{
|
||||||
val = -127;
|
val = -127;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = (int)GetBaseFloat("P" + player + " " + name);
|
val = (int)GetBaseFloat($"P{player} {name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (name == "X Axis")
|
else if (name == "X Axis")
|
||||||
{
|
{
|
||||||
if (IsBasePressed("P" + player + " A Left"))
|
if (IsBasePressed($"P{player} A Left"))
|
||||||
{
|
{
|
||||||
val = -127;
|
val = -127;
|
||||||
}
|
}
|
||||||
else if (IsBasePressed("P" + player + " A Right"))
|
else if (IsBasePressed($"P{player} A Right"))
|
||||||
{
|
{
|
||||||
val = 127;
|
val = 127;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = (int)GetBaseFloat("P" + player + " " + name);
|
val = (int)GetBaseFloat($"P{player} {name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = (int)GetBaseFloat("P" + player + " " + name);
|
val = (int)GetBaseFloat($"P{player} {name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val >= 0)
|
if (val >= 0)
|
||||||
|
@ -532,7 +532,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
input.Append('|');
|
input.Append('|');
|
||||||
|
@ -563,7 +563,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
input.Append("|");
|
input.Append("|");
|
||||||
|
@ -595,7 +595,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
|
||||||
{
|
{
|
||||||
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
input.Append("|");
|
input.Append("|");
|
||||||
|
|
|
@ -265,7 +265,7 @@ namespace BizHawk.Client.Common
|
||||||
// TODO: clean this up
|
// TODO: clean this up
|
||||||
if (_loopOffset.HasValue)
|
if (_loopOffset.HasValue)
|
||||||
{
|
{
|
||||||
sw.WriteLine("LoopOffset " + _loopOffset);
|
sw.WriteLine($"LoopOffset {_loopOffset}");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var input in _log)
|
foreach (var input in _log)
|
||||||
|
|
|
@ -254,10 +254,7 @@ namespace BizHawk.Client.Common
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
errorMessage = "The savestate is from frame "
|
errorMessage = $"The savestate is from frame {log.Count} which is greater than the current movie length of {_log.Count}";
|
||||||
+ log.Count
|
|
||||||
+ " which is greater than the current movie length of "
|
|
||||||
+ _log.Count;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -266,9 +263,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (_log[i] != log[i])
|
if (_log[i] != log[i])
|
||||||
{
|
{
|
||||||
errorMessage = "The savestate input does not match the movie input at frame "
|
errorMessage = $"The savestate input does not match the movie input at frame {(i + 1)}.";
|
||||||
+ (i + 1)
|
|
||||||
+ ".";
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
{
|
{
|
||||||
public static TasMovie ToTasMovie(this IMovie old, bool copy = false)
|
public static TasMovie ToTasMovie(this IMovie old, bool copy = false)
|
||||||
{
|
{
|
||||||
string newFilename = old.Filename + "." + TasMovie.Extension;
|
string newFilename = $"{old.Filename}.{TasMovie.Extension}";
|
||||||
|
|
||||||
if (File.Exists(newFilename))
|
if (File.Exists(newFilename))
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
{
|
{
|
||||||
if (File.Exists(newFilename))
|
if (File.Exists(newFilename))
|
||||||
{
|
{
|
||||||
newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension;
|
newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}";
|
||||||
fileNum++;
|
fileNum++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -131,11 +131,11 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
if (old.Filename.Contains("tasproj"))
|
if (old.Filename.Contains("tasproj"))
|
||||||
{
|
{
|
||||||
newFilename = newFilename.Remove(newFilename.Length - 7, 7);
|
newFilename = newFilename.Remove(newFilename.Length - 7, 7);
|
||||||
newFilename = newFilename + "nfn." + TasMovie.Extension;
|
newFilename = $"{newFilename}nfn.{TasMovie.Extension}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newFilename = old.Filename + "." + TasMovie.Extension;
|
newFilename = $"{old.Filename}.{TasMovie.Extension}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (File.Exists(newFilename))
|
if (File.Exists(newFilename))
|
||||||
|
@ -146,7 +146,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
{
|
{
|
||||||
if (File.Exists(newFilename))
|
if (File.Exists(newFilename))
|
||||||
{
|
{
|
||||||
newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension;
|
newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}";
|
||||||
fileNum++;
|
fileNum++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -216,11 +216,11 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
if (old.Filename.Contains("tasproj"))
|
if (old.Filename.Contains("tasproj"))
|
||||||
{
|
{
|
||||||
newFilename = newFilename.Remove(newFilename.Length - 7, 7);
|
newFilename = newFilename.Remove(newFilename.Length - 7, 7);
|
||||||
newFilename = newFilename + "nfsr." + TasMovie.Extension;
|
newFilename = $"{newFilename}nfsr.{TasMovie.Extension}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newFilename = old.Filename + "." + TasMovie.Extension;
|
newFilename = $"{old.Filename}.{TasMovie.Extension}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (File.Exists(newFilename))
|
if (File.Exists(newFilename))
|
||||||
|
@ -231,7 +231,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
{
|
{
|
||||||
if (File.Exists(newFilename))
|
if (File.Exists(newFilename))
|
||||||
{
|
{
|
||||||
newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension;
|
newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}";
|
||||||
fileNum++;
|
fileNum++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -323,7 +323,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
||||||
{
|
{
|
||||||
foreach (var firmware in Global.FirmwareManager.RecentlyServed)
|
foreach (var firmware in Global.FirmwareManager.RecentlyServed)
|
||||||
{
|
{
|
||||||
var key = firmware.SystemId + "_Firmware_" + firmware.FirmwareId;
|
var key = $"{firmware.SystemId}_Firmware_{firmware.FirmwareId}";
|
||||||
|
|
||||||
if (!movie.HeaderEntries.ContainsKey(key))
|
if (!movie.HeaderEntries.ContainsKey(key))
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Result.Movie.Comments.Add(Movieorigin + " .fm2 version 3");
|
Result.Movie.Comments.Add($"{Movieorigin} .fm2 version 3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (line.ToLower().StartsWith("romfilename"))
|
else if (line.ToLower().StartsWith("romfilename"))
|
||||||
|
@ -139,7 +139,7 @@ namespace BizHawk.Client.Common
|
||||||
string length = line.Substring(first + 1, second - first - 1);
|
string length = line.Substring(first + 1, second - first - 1);
|
||||||
string message = line.Substring(second + 1).Trim();
|
string message = line.Substring(second + 1).Trim();
|
||||||
|
|
||||||
return "subtitle " + frame + " 0 0 " + length + " FFFFFFFF " + message;
|
return $"subtitle {frame} 0 0 {length} FFFFFFFF {message}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace BizHawk.Client.Common
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newFileName = SourceFile.FullName + "." + Bk2Movie.Extension;
|
var newFileName = $"{SourceFile.FullName}.{Bk2Movie.Extension}";
|
||||||
Result.Movie = new Bk2Movie(newFileName);
|
Result.Movie = new Bk2Movie(newFileName);
|
||||||
|
|
||||||
RunImport();
|
RunImport();
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
messageCallback(Path.GetFileName(fn) + " imported as " + m.Filename);
|
messageCallback($"{Path.GetFileName(fn)} imported as {m.Filename}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Directory.Exists(d))
|
if (!Directory.Exists(d))
|
||||||
|
@ -83,7 +83,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (importerType == default(Type))
|
if (importerType == default(Type))
|
||||||
{
|
{
|
||||||
errorMsg = "No importer found for file type " + ext;
|
errorMsg = $"No importer found for file type {ext}";
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (m != null)
|
if (m != null)
|
||||||
{
|
{
|
||||||
m.Filename += "." + BkmMovie.Extension;
|
m.Filename += $".{BkmMovie.Extension}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -230,7 +230,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
"BKM", "FCM", "FM2", "FMV", "GMV", "MCM", "MC2", "MMV", "NMV", "LSMV", "SMV", "VBM", "VMV", "YMV", "ZMV"
|
"BKM", "FCM", "FM2", "FMV", "GMV", "MCM", "MC2", "MMV", "NMV", "LSMV", "SMV", "VBM", "VMV", "YMV", "ZMV"
|
||||||
};
|
};
|
||||||
return extensions.Any(ext => extension.ToUpper() == "." + ext);
|
return extensions.Any(ext => extension.ToUpper() == $".{ext}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reduce all whitespace to single spaces.
|
// Reduce all whitespace to single spaces.
|
||||||
|
@ -261,7 +261,7 @@ namespace BizHawk.Client.Common
|
||||||
for (int section = 2; section < sections.Length - 1; section++)
|
for (int section = 2; section < sections.Length - 1; section++)
|
||||||
{
|
{
|
||||||
int player = section - 1; // We start with 1
|
int player = section - 1; // We start with 1
|
||||||
string prefix = "P" + player + " "; // "P1"
|
string prefix = $"P{player} "; // "P1"
|
||||||
|
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +344,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (warningMsg != "")
|
if (warningMsg != "")
|
||||||
{
|
{
|
||||||
warningMsg = "Unable to import " + warningMsg + " command on line " + lineNum + ".";
|
warningMsg = $"Unable to import {warningMsg} command on line {lineNum}.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
// The player number is one less than the section number for the reasons explained above.
|
// The player number is one less than the section number for the reasons explained above.
|
||||||
int player = section + playerOffset;
|
int player = section + playerOffset;
|
||||||
string prefix = "P" + player + " ";
|
string prefix = $"P{player} ";
|
||||||
|
|
||||||
// Gameboy doesn't currently have a prefix saying which player the input is for.
|
// Gameboy doesn't currently have a prefix saying which player the input is for.
|
||||||
if (controllers.Definition.Name == "Gameboy Controller")
|
if (controllers.Definition.Name == "Gameboy Controller")
|
||||||
|
@ -450,7 +450,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
string message = line.Substring(second + 1).Trim();
|
string message = line.Substring(second + 1).Trim();
|
||||||
m.Subtitles.AddFromString("subtitle " + frame + " 0 0 " + length + " FFFFFFFF " + message);
|
m.Subtitles.AddFromString($"subtitle {frame} 0 0 {length} FFFFFFFF {message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
|
@ -507,14 +507,12 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else if (line.ToLower().StartsWith("emuversion"))
|
else if (line.ToLower().StartsWith("emuversion"))
|
||||||
{
|
{
|
||||||
m.Comments.Add(
|
m.Comments.Add($"{EMULATIONORIGIN} {emulator} version {ParseHeader(line, "emuVersion")}");
|
||||||
EMULATIONORIGIN + " " + emulator + " version " + ParseHeader(line, "emuVersion"));
|
|
||||||
}
|
}
|
||||||
else if (line.ToLower().StartsWith("version"))
|
else if (line.ToLower().StartsWith("version"))
|
||||||
{
|
{
|
||||||
string version = ParseHeader(line, "version");
|
string version = ParseHeader(line, "version");
|
||||||
m.Comments.Add(
|
m.Comments.Add($"{MOVIEORIGIN} {Path.GetExtension(path)} version {version}");
|
||||||
MOVIEORIGIN + " " + Path.GetExtension(path) + " version " + version);
|
|
||||||
if (Path.GetExtension(path).ToUpper() == ".FM2" && version != "3")
|
if (Path.GetExtension(path).ToUpper() == ".FM2" && version != "3")
|
||||||
{
|
{
|
||||||
errorMsg = ".FM2 movie version must always be 3.";
|
errorMsg = ".FM2 movie version must always be 3.";
|
||||||
|
@ -683,7 +681,7 @@ namespace BizHawk.Client.Common
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Comments.Add(MOVIEORIGIN + " .FCM version " + version);
|
m.Comments.Add($"{MOVIEORIGIN} .FCM version {version}");
|
||||||
|
|
||||||
// 008 1-byte flags
|
// 008 1-byte flags
|
||||||
byte flags = r.ReadByte();
|
byte flags = r.ReadByte();
|
||||||
|
@ -715,7 +713,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// other: reserved, set to 0
|
// other: reserved, set to 0
|
||||||
bool syncHack = ((flags >> 4) & 0x1) != 0;
|
bool syncHack = ((flags >> 4) & 0x1) != 0;
|
||||||
m.Comments.Add(SYNCHACK + " " + syncHack);
|
m.Comments.Add($"{SYNCHACK} {syncHack}");
|
||||||
|
|
||||||
// 009 1-byte flags: reserved, set to 0
|
// 009 1-byte flags: reserved, set to 0
|
||||||
r.ReadByte();
|
r.ReadByte();
|
||||||
|
@ -749,7 +747,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 030 4-byte little-endian unsigned int: version of the emulator used
|
// 030 4-byte little-endian unsigned int: version of the emulator used
|
||||||
uint emuVersion = r.ReadUInt32();
|
uint emuVersion = r.ReadUInt32();
|
||||||
m.Comments.Add(EMULATIONORIGIN + " FCEU " + emuVersion);
|
m.Comments.Add($"{EMULATIONORIGIN} FCEU {emuVersion}");
|
||||||
|
|
||||||
// 034 name of the ROM used - UTF8 encoded nul-terminated string.
|
// 034 name of the ROM used - UTF8 encoded nul-terminated string.
|
||||||
List<byte> gameBytes = new List<byte>();
|
List<byte> gameBytes = new List<byte>();
|
||||||
|
@ -870,7 +868,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (warningMsg != "")
|
if (warningMsg != "")
|
||||||
{
|
{
|
||||||
warningMsg = "Unable to import " + warningMsg + " command at frame " + frame + ".";
|
warningMsg = $"Unable to import {warningMsg} command at frame {frame}.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,7 +915,7 @@ namespace BizHawk.Client.Common
|
||||||
The controller update toggles the affected input. Controller update data is emitted to the movie file
|
The controller update toggles the affected input. Controller update data is emitted to the movie file
|
||||||
only when the state of the controller changes.
|
only when the state of the controller changes.
|
||||||
*/
|
*/
|
||||||
controllers["P" + player + " " + buttons[button]] = !controllers["P" + player + " " + buttons[button]];
|
controllers[$"P{player} {buttons[button]}"] = !controllers[$"P{player} {buttons[button]}"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,12 +1010,12 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 010 64-byte zero-terminated emulator identifier string
|
// 010 64-byte zero-terminated emulator identifier string
|
||||||
string emuVersion = NullTerminated(r.ReadStringFixedAscii(64));
|
string emuVersion = NullTerminated(r.ReadStringFixedAscii(64));
|
||||||
m.Comments.Add(EMULATIONORIGIN + " Famtasia version " + emuVersion);
|
m.Comments.Add($"{EMULATIONORIGIN} Famtasia version {emuVersion}");
|
||||||
m.Comments.Add(MOVIEORIGIN + " .FMV");
|
m.Comments.Add($"{MOVIEORIGIN} .FMV");
|
||||||
|
|
||||||
// 050 64-byte zero-terminated movie title string
|
// 050 64-byte zero-terminated movie title string
|
||||||
string description = NullTerminated(r.ReadStringFixedAscii(64));
|
string description = NullTerminated(r.ReadStringFixedAscii(64));
|
||||||
m.Comments.Add(COMMENT + " " + description);
|
m.Comments.Add($"{COMMENT} {description}");
|
||||||
if (!controller1 && !controller2 && !fds)
|
if (!controller1 && !controller2 && !fds)
|
||||||
{
|
{
|
||||||
warningMsg = "No input recorded.";
|
warningMsg = "No input recorded.";
|
||||||
|
@ -1080,7 +1078,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
|
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1119,8 +1117,8 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 00F ASCII-encoded GMV file format version. The most recent is 'A'. (?)
|
// 00F ASCII-encoded GMV file format version. The most recent is 'A'. (?)
|
||||||
string version = r.ReadStringFixedAscii(1);
|
string version = r.ReadStringFixedAscii(1);
|
||||||
m.Comments.Add(MOVIEORIGIN + " .GMV version " + version);
|
m.Comments.Add($"{MOVIEORIGIN} .GMV version {version}");
|
||||||
m.Comments.Add(EMULATIONORIGIN + " Gens");
|
m.Comments.Add($"{EMULATIONORIGIN} Gens");
|
||||||
|
|
||||||
// 010 4-byte little-endian unsigned int: rerecord count
|
// 010 4-byte little-endian unsigned int: rerecord count
|
||||||
uint rerecordCount = r.ReadUInt32();
|
uint rerecordCount = r.ReadUInt32();
|
||||||
|
@ -1169,7 +1167,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 018 40-byte zero-terminated ASCII movie name string
|
// 018 40-byte zero-terminated ASCII movie name string
|
||||||
string description = NullTerminated(r.ReadStringFixedAscii(40));
|
string description = NullTerminated(r.ReadStringFixedAscii(40));
|
||||||
m.Comments.Add(COMMENT + " " + description);
|
m.Comments.Add($"{COMMENT} {description}");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
040 frame data
|
040 frame data
|
||||||
|
@ -1213,7 +1211,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) == 0;
|
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1222,12 +1220,12 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (player1Config == "6")
|
if (player1Config == "6")
|
||||||
{
|
{
|
||||||
controllers["P1 " + other[button]] = ((controllerState >> button) & 0x1) == 0;
|
controllers[$"P1 {other[button]}"] = ((controllerState >> button) & 0x1) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player2Config == "6")
|
if (player2Config == "6")
|
||||||
{
|
{
|
||||||
controllers["P2 " + other[button]] = ((controllerState >> (button + 4)) & 0x1) == 0;
|
controllers[$"P2 {other[button]}"] = ((controllerState >> (button + 4)) & 0x1) == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1275,7 +1273,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (authorLast != "")
|
if (authorLast != "")
|
||||||
{
|
{
|
||||||
authorList += authorLast + ", ";
|
authorList += $"{authorLast}, ";
|
||||||
}
|
}
|
||||||
|
|
||||||
authorLast = author;
|
authorLast = author;
|
||||||
|
@ -1301,7 +1299,7 @@ namespace BizHawk.Client.Common
|
||||||
hf.BindArchiveMember(item.Index);
|
hf.BindArchiveMember(item.Index);
|
||||||
var stream = hf.GetStream();
|
var stream = hf.GetStream();
|
||||||
string coreversion = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
|
string coreversion = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
|
||||||
m.Comments.Add(COREORIGIN + " " + coreversion);
|
m.Comments.Add($"{COREORIGIN} {coreversion}");
|
||||||
hf.Unbind();
|
hf.Unbind();
|
||||||
}
|
}
|
||||||
else if (item.Name == "gamename")
|
else if (item.Name == "gamename")
|
||||||
|
@ -1446,7 +1444,7 @@ namespace BizHawk.Client.Common
|
||||||
string rom = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
|
string rom = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
|
||||||
int pos = item.Name.LastIndexOf(".sha256");
|
int pos = item.Name.LastIndexOf(".sha256");
|
||||||
string name = item.Name.Substring(0, pos);
|
string name = item.Name.Substring(0, pos);
|
||||||
m.Header[SHA256 + "_" + name] = rom;
|
m.Header[$"{SHA256}_{name}"] = rom;
|
||||||
hf.Unbind();
|
hf.Unbind();
|
||||||
}
|
}
|
||||||
else if (item.Name == "savestate")
|
else if (item.Name == "savestate")
|
||||||
|
@ -1491,7 +1489,7 @@ namespace BizHawk.Client.Common
|
||||||
hf.BindArchiveMember(item.Index);
|
hf.BindArchiveMember(item.Index);
|
||||||
var stream = hf.GetStream();
|
var stream = hf.GetStream();
|
||||||
string systemid = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
|
string systemid = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
|
||||||
m.Comments.Add(EMULATIONORIGIN + " " + systemid);
|
m.Comments.Add($"{EMULATIONORIGIN} {systemid}");
|
||||||
hf.Unbind();
|
hf.Unbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1528,11 +1526,11 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 008 uint32 Mednafen Version (Current is 0A 08)
|
// 008 uint32 Mednafen Version (Current is 0A 08)
|
||||||
uint emuVersion = r.ReadUInt32();
|
uint emuVersion = r.ReadUInt32();
|
||||||
m.Comments.Add(EMULATIONORIGIN + " Mednafen " + emuVersion);
|
m.Comments.Add($"{EMULATIONORIGIN} Mednafen {emuVersion}");
|
||||||
|
|
||||||
// 00C uint32 Movie Format Version (Current is 01)
|
// 00C uint32 Movie Format Version (Current is 01)
|
||||||
uint version = r.ReadUInt32();
|
uint version = r.ReadUInt32();
|
||||||
m.Comments.Add(MOVIEORIGIN + " .MCM version " + version);
|
m.Comments.Add($"{MOVIEORIGIN} .MCM version {version}");
|
||||||
|
|
||||||
// 010 32-byte MD5 of the ROM used
|
// 010 32-byte MD5 of the ROM used
|
||||||
byte[] md5 = r.ReadBytes(16);
|
byte[] md5 = r.ReadBytes(16);
|
||||||
|
@ -1580,7 +1578,7 @@ namespace BizHawk.Client.Common
|
||||||
};
|
};
|
||||||
if (!platforms.ContainsKey(platform))
|
if (!platforms.ContainsKey(platform))
|
||||||
{
|
{
|
||||||
errorMsg = "Platform " + platform + " not supported.";
|
errorMsg = $"Platform {platform} not supported.";
|
||||||
r.Close();
|
r.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
return null;
|
return null;
|
||||||
|
@ -1601,7 +1599,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// TODO: Verify if NTSC/"PAL" mode used for the movie can be detected or not.
|
// TODO: Verify if NTSC/"PAL" mode used for the movie can be detected or not.
|
||||||
// 100 variable Input data
|
// 100 variable Input data
|
||||||
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = name + " Controller" } };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = $"{name} Controller" } };
|
||||||
int bytes = 256;
|
int bytes = 256;
|
||||||
|
|
||||||
// The input stream consists of 1 byte for power-on and reset, and then X bytes per each input port per frame.
|
// The input stream consists of 1 byte for power-on and reset, and then X bytes per each input port per frame.
|
||||||
|
@ -1632,7 +1630,7 @@ namespace BizHawk.Client.Common
|
||||||
ushort controllerState = r.ReadByte();
|
ushort controllerState = r.ReadByte();
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
string prefix = platform == "lynx" ? "" : "P" + player + " "; // hack
|
string prefix = platform == "lynx" ? "" : $"P{player} "; // hack
|
||||||
controllers[prefix + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
|
controllers[prefix + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1677,8 +1675,8 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 0004: 4-byte little endian unsigned int: dega version
|
// 0004: 4-byte little endian unsigned int: dega version
|
||||||
uint emuVersion = r.ReadUInt32();
|
uint emuVersion = r.ReadUInt32();
|
||||||
m.Comments.Add(EMULATIONORIGIN + " Dega version " + emuVersion);
|
m.Comments.Add($"{EMULATIONORIGIN} Dega version {emuVersion}");
|
||||||
m.Comments.Add(MOVIEORIGIN + " .MMV");
|
m.Comments.Add($"{MOVIEORIGIN} .MMV");
|
||||||
|
|
||||||
// 0008: 4-byte little endian unsigned int: frame count
|
// 0008: 4-byte little endian unsigned int: frame count
|
||||||
uint frameCount = r.ReadUInt32();
|
uint frameCount = r.ReadUInt32();
|
||||||
|
@ -1771,7 +1769,7 @@ namespace BizHawk.Client.Common
|
||||||
byte controllerState = r.ReadByte();
|
byte controllerState = r.ReadByte();
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
|
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player == 1)
|
if (player == 1)
|
||||||
|
@ -1810,8 +1808,8 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 004 4-byte version string (example "0960")
|
// 004 4-byte version string (example "0960")
|
||||||
string emuVersion = r.ReadStringFixedAscii(4);
|
string emuVersion = r.ReadStringFixedAscii(4);
|
||||||
m.Comments.Add(EMULATIONORIGIN + " Nintendulator version " + emuVersion);
|
m.Comments.Add($"{EMULATIONORIGIN} Nintendulator version {emuVersion}");
|
||||||
m.Comments.Add(MOVIEORIGIN + " .NMV");
|
m.Comments.Add($"{MOVIEORIGIN} .NMV");
|
||||||
|
|
||||||
// 008 4-byte file size, not including the 16-byte header
|
// 008 4-byte file size, not including the 16-byte header
|
||||||
r.ReadUInt32();
|
r.ReadUInt32();
|
||||||
|
@ -1918,7 +1916,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (warningMsg != "")
|
if (warningMsg != "")
|
||||||
{
|
{
|
||||||
warningMsg = warningMsg + " is not properly supported.";
|
warningMsg = $"{warningMsg} is not properly supported.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1945,7 +1943,7 @@ namespace BizHawk.Client.Common
|
||||||
};
|
};
|
||||||
if (expansion != 0 && warningMsg == "")
|
if (expansion != 0 && warningMsg == "")
|
||||||
{
|
{
|
||||||
warningMsg = "Expansion port is not properly supported. This movie uses " + expansions[expansion] + ".";
|
warningMsg = $"Expansion port is not properly supported. This movie uses {expansions[expansion]}.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 003 1-byte number of bytes per frame, plus flags
|
// 003 1-byte number of bytes per frame, plus flags
|
||||||
|
@ -1989,7 +1987,7 @@ namespace BizHawk.Client.Common
|
||||||
00C (variable) null-terminated UTF-8 text, movie description (currently not implemented)
|
00C (variable) null-terminated UTF-8 text, movie description (currently not implemented)
|
||||||
*/
|
*/
|
||||||
string movieDescription = NullTerminated(r.ReadStringFixedAscii((int)r.ReadUInt32()));
|
string movieDescription = NullTerminated(r.ReadStringFixedAscii((int)r.ReadUInt32()));
|
||||||
m.Comments.Add(COMMENT + " " + movieDescription);
|
m.Comments.Add($"{COMMENT} {movieDescription}");
|
||||||
|
|
||||||
// ... 4-byte little-endian unsigned int: length of controller data in bytes
|
// ... 4-byte little-endian unsigned int: length of controller data in bytes
|
||||||
uint length = r.ReadUInt32();
|
uint length = r.ReadUInt32();
|
||||||
|
@ -2027,7 +2025,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
|
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (warningMsg == "")
|
else if (warningMsg == "")
|
||||||
|
@ -2084,8 +2082,8 @@ namespace BizHawk.Client.Common
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Comments.Add(EMULATIONORIGIN + " Snes9x version " + version);
|
m.Comments.Add($"{EMULATIONORIGIN} Snes9x version {version}");
|
||||||
m.Comments.Add(MOVIEORIGIN + " .SMV");
|
m.Comments.Add($"{MOVIEORIGIN} .SMV");
|
||||||
/*
|
/*
|
||||||
008 4-byte little-endian integer: movie "uid" - identifies the movie-savestate relationship, also used as the
|
008 4-byte little-endian integer: movie "uid" - identifies the movie-savestate relationship, also used as the
|
||||||
recording time in Unix epoch format
|
recording time in Unix epoch format
|
||||||
|
@ -2302,7 +2300,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (peripheral != "" && warningMsg == "")
|
if (peripheral != "" && warningMsg == "")
|
||||||
{
|
{
|
||||||
warningMsg = "Unable to import " + peripheral + ".";
|
warningMsg = $"Unable to import {peripheral}.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2311,13 +2309,13 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + player + " " + buttons[button]] =
|
controllers[$"P{player} {buttons[button]}"] =
|
||||||
((controllerState >> button) & 0x1) != 0;
|
((controllerState >> button) & 0x1) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (warningMsg == "")
|
else if (warningMsg == "")
|
||||||
{
|
{
|
||||||
warningMsg = "Controller " + player + " not supported.";
|
warningMsg = $"Controller {player} not supported.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2475,7 +2473,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (isSGB)
|
if (isSGB)
|
||||||
{
|
{
|
||||||
m.Comments.Add(SUPERGAMEBOYMODE + " True");
|
m.Comments.Add($"{SUPERGAMEBOYMODE} True");
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Header[HeaderKeys.PLATFORM] = platform;
|
m.Header[HeaderKeys.PLATFORM] = platform;
|
||||||
|
@ -2521,8 +2519,8 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 030 1-byte unsigned char: minor version/revision number of current VBM version, the latest is "1"
|
// 030 1-byte unsigned char: minor version/revision number of current VBM version, the latest is "1"
|
||||||
byte minorVersion = r.ReadByte();
|
byte minorVersion = r.ReadByte();
|
||||||
m.Comments.Add(MOVIEORIGIN + " .VBM version " + majorVersion + "." + minorVersion);
|
m.Comments.Add($"{MOVIEORIGIN} .VBM version {majorVersion}.{minorVersion}");
|
||||||
m.Comments.Add(EMULATIONORIGIN + " Visual Boy Advance");
|
m.Comments.Add($"{EMULATIONORIGIN} Visual Boy Advance");
|
||||||
|
|
||||||
// 031 1-byte unsigned char: the internal CRC of the ROM used while recording
|
// 031 1-byte unsigned char: the internal CRC of the ROM used while recording
|
||||||
r.ReadByte();
|
r.ReadByte();
|
||||||
|
@ -2559,7 +2557,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// The following 128 bytes are for a description of the movie. Both parts must be null-terminated.
|
// The following 128 bytes are for a description of the movie. Both parts must be null-terminated.
|
||||||
string movieDescription = NullTerminated(r.ReadStringFixedAscii(128));
|
string movieDescription = NullTerminated(r.ReadStringFixedAscii(128));
|
||||||
m.Comments.Add(COMMENT + " " + movieDescription);
|
m.Comments.Add($"{COMMENT} {movieDescription}");
|
||||||
r.BaseStream.Position = firstFrameOffset;
|
r.BaseStream.Position = firstFrameOffset;
|
||||||
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition() };
|
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition() };
|
||||||
controllers.Definition.Name = platform != "GBA"
|
controllers.Definition.Name = platform != "GBA"
|
||||||
|
@ -2615,7 +2613,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (((controllerState >> (button + 10)) & 0x1) != 0)
|
if (((controllerState >> (button + 10)) & 0x1) != 0)
|
||||||
{
|
{
|
||||||
warningMsg = "Unable to import " + other[button] + " at frame " + frame + ".";
|
warningMsg = $"Unable to import {other[button]} at frame {frame}.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2660,12 +2658,12 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 00C 2-byte little-endian integer: movie version 0x0400
|
// 00C 2-byte little-endian integer: movie version 0x0400
|
||||||
ushort version = r.ReadUInt16();
|
ushort version = r.ReadUInt16();
|
||||||
m.Comments.Add(MOVIEORIGIN + " .VMV version " + version);
|
m.Comments.Add($"{MOVIEORIGIN} .VMV version {version}");
|
||||||
m.Comments.Add(EMULATIONORIGIN + " VirtuaNES");
|
m.Comments.Add($"{EMULATIONORIGIN} VirtuaNES");
|
||||||
|
|
||||||
// 00E 2-byte little-endian integer: record version
|
// 00E 2-byte little-endian integer: record version
|
||||||
ushort recordVersion = r.ReadUInt16();
|
ushort recordVersion = r.ReadUInt16();
|
||||||
m.Comments.Add(COMMENT + " Record version " + recordVersion);
|
m.Comments.Add($"{COMMENT} Record version {recordVersion}");
|
||||||
|
|
||||||
// 010 4-byte flags (control byte)
|
// 010 4-byte flags (control byte)
|
||||||
uint flags = r.ReadUInt32();
|
uint flags = r.ReadUInt32();
|
||||||
|
@ -2837,12 +2835,12 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
commandName = "NESCMD_EXCONTROLLER, " + (command & 0xFF00);
|
commandName = $"NESCMD_EXCONTROLLER, {(command & 0xFF00)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandName != "" && warningMsg == "")
|
if (commandName != "" && warningMsg == "")
|
||||||
{
|
{
|
||||||
warningMsg = "Unable to run command \"" + commandName + "\".";
|
warningMsg = $"Unable to run command \"{commandName}\".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (controllerState == 0xF3)
|
else if (controllerState == 0xF3)
|
||||||
|
@ -2852,7 +2850,7 @@ namespace BizHawk.Client.Common
|
||||||
// TODO: Make a clearer warning message.
|
// TODO: Make a clearer warning message.
|
||||||
if (warningMsg == "")
|
if (warningMsg == "")
|
||||||
{
|
{
|
||||||
warningMsg = "Unable to run SetSyncExData(" + dwdata + ").";
|
warningMsg = $"Unable to run SetSyncExData({dwdata}).";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2861,7 +2859,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
|
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2901,8 +2899,8 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// 003 2-byte little-endian unsigned int: zsnes version number
|
// 003 2-byte little-endian unsigned int: zsnes version number
|
||||||
short version = r.ReadInt16();
|
short version = r.ReadInt16();
|
||||||
m.Comments.Add(EMULATIONORIGIN + " ZSNES version " + version);
|
m.Comments.Add($"{EMULATIONORIGIN} ZSNES version {version}");
|
||||||
m.Comments.Add(MOVIEORIGIN + " .ZMV");
|
m.Comments.Add($"{MOVIEORIGIN} .ZMV");
|
||||||
|
|
||||||
// 005 4-byte little-endian integer: CRC32 of the ROM
|
// 005 4-byte little-endian integer: CRC32 of the ROM
|
||||||
int crc32 = r.ReadInt32();
|
int crc32 = r.ReadInt32();
|
||||||
|
@ -2973,7 +2971,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (peripheral != "")
|
if (peripheral != "")
|
||||||
{
|
{
|
||||||
warningMsg = "Unable to import " + peripheral + ".";
|
warningMsg = $"Unable to import {peripheral}.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 027 1-byte flags:
|
// 027 1-byte flags:
|
||||||
|
@ -3182,14 +3180,14 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P" + player + " " + buttons[button]] =
|
controllers[$"P{player} {buttons[button]}"] =
|
||||||
((controllerState >> button) & 0x1) != 0;
|
((controllerState >> button) & 0x1) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (warningMsg == "")
|
else if (warningMsg == "")
|
||||||
{
|
{
|
||||||
warningMsg = "Controller " + player + " not supported.";
|
warningMsg = $"Controller {player} not supported.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace BizHawk.Client.Common
|
||||||
string magic = new string(br.ReadChars(4));
|
string magic = new string(br.ReadChars(4));
|
||||||
if (magic != expectedMagic)
|
if (magic != expectedMagic)
|
||||||
{
|
{
|
||||||
Result.Errors.Add("Not a " + expectedMagic + "file: invalid magic number in file header.");
|
Result.Errors.Add($"Not a {expectedMagic}file: invalid magic number in file header.");
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
for (int button = 3; button < buttons.Length; button++)
|
for (int button = 3; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P1 " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
|
controllers[$"P1 {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
|
||||||
if (((controllerState >> button) & 0x1) != 0 && button > 15)
|
if (((controllerState >> button) & 0x1) != 0 && button > 15)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -246,7 +246,7 @@ namespace BizHawk.Client.Common
|
||||||
ushort controllerState = br.ReadUInt16();
|
ushort controllerState = br.ReadUInt16();
|
||||||
for (int button = 0; button < buttons.Length; button++)
|
for (int button = 0; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P2 " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
|
controllers[$"P2 {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
|
||||||
if (((controllerState >> button) & 0x1) != 0 && button > 15)
|
if (((controllerState >> button) & 0x1) != 0 && button > 15)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -291,7 +291,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if ((controlState & 0xFC) != 0)
|
if ((controlState & 0xFC) != 0)
|
||||||
{
|
{
|
||||||
Result.Warnings.Add("Ignored toggle hack flag on frame " + frame);
|
Result.Warnings.Add($"Ignored toggle hack flag on frame {frame}");
|
||||||
}
|
}
|
||||||
|
|
||||||
movie.AppendFrame(controllers);
|
movie.AppendFrame(controllers);
|
||||||
|
@ -336,7 +336,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
for (int button = 3; button < buttons.Length; button++)
|
for (int button = 3; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P1 " + buttons[button]] = br.ReadChar() != '.';
|
controllers[$"P1 {buttons[button]}"] = br.ReadChar() != '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.Player1Type == OctoshockDll.ePeripheralType.DualShock)
|
if (info.Player1Type == OctoshockDll.ePeripheralType.DualShock)
|
||||||
|
@ -373,7 +373,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
for (int button = 3; button < buttons.Length; button++)
|
for (int button = 3; button < buttons.Length; button++)
|
||||||
{
|
{
|
||||||
controllers["P2 " + buttons[button]] = br.ReadChar() != '.';
|
controllers[$"P2 {buttons[button]}"] = br.ReadChar() != '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.Player2Type == OctoshockDll.ePeripheralType.DualShock)
|
if (info.Player2Type == OctoshockDll.ePeripheralType.DualShock)
|
||||||
|
@ -423,7 +423,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if ((controlState & 0xFC) != 0)
|
if ((controlState & 0xFC) != 0)
|
||||||
{
|
{
|
||||||
Result.Warnings.Add("Ignored toggle hack flag on frame " + frame);
|
Result.Warnings.Add($"Ignored toggle hack flag on frame {frame}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Each controller is terminated with a pipeline.
|
// Each controller is terminated with a pipeline.
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (frame > _lagLog.Count)
|
if (frame > _lagLog.Count)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.Print("Lag Log error. f" + frame + ", log: " + _lagLog.Count);
|
System.Diagnostics.Debug.Print($"Lag Log error. f{frame}, log: {_lagLog.Count}");
|
||||||
return; // Can this break anything?
|
return; // Can this break anything?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (frame != 0)
|
if (frame != 0)
|
||||||
{
|
{
|
||||||
ChangeLog.AddGeneralUndo(frame - 1, frame - 1, "Record Frame: " + frame);
|
ChangeLog.AddGeneralUndo(frame - 1, frame - 1, $"Record Frame: {frame}");
|
||||||
}
|
}
|
||||||
|
|
||||||
base.RecordFrame(frame, source);
|
base.RecordFrame(frame, source);
|
||||||
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public override void Truncate(int frame)
|
public override void Truncate(int frame)
|
||||||
{
|
{
|
||||||
bool endBatch = ChangeLog.BeginNewBatch("Truncate Movie: " + frame, true);
|
bool endBatch = ChangeLog.BeginNewBatch($"Truncate Movie: {frame}", true);
|
||||||
ChangeLog.AddGeneralUndo(frame, InputLogLength - 1);
|
ChangeLog.AddGeneralUndo(frame, InputLogLength - 1);
|
||||||
|
|
||||||
if (frame < Log.Count - 1)
|
if (frame < Log.Count - 1)
|
||||||
|
@ -58,7 +58,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public override void PokeFrame(int frame, IController source)
|
public override void PokeFrame(int frame, IController source)
|
||||||
{
|
{
|
||||||
ChangeLog.AddGeneralUndo(frame, frame, "Set Frame At: " + frame);
|
ChangeLog.AddGeneralUndo(frame, frame, $"Set Frame At: {frame}");
|
||||||
|
|
||||||
base.PokeFrame(frame, source);
|
base.PokeFrame(frame, source);
|
||||||
InvalidateAfter(frame);
|
InvalidateAfter(frame);
|
||||||
|
@ -68,7 +68,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void SetFrame(int frame, string source)
|
public void SetFrame(int frame, string source)
|
||||||
{
|
{
|
||||||
ChangeLog.AddGeneralUndo(frame, frame, "Set Frame At: " + frame);
|
ChangeLog.AddGeneralUndo(frame, frame, $"Set Frame At: {frame}");
|
||||||
|
|
||||||
SetFrameAt(frame, source);
|
SetFrameAt(frame, source);
|
||||||
InvalidateAfter(frame);
|
InvalidateAfter(frame);
|
||||||
|
@ -78,7 +78,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public override void ClearFrame(int frame)
|
public override void ClearFrame(int frame)
|
||||||
{
|
{
|
||||||
ChangeLog.AddGeneralUndo(frame, frame, "Clear Frame: " + frame);
|
ChangeLog.AddGeneralUndo(frame, frame, $"Clear Frame: {frame}");
|
||||||
|
|
||||||
base.ClearFrame(frame);
|
base.ClearFrame(frame);
|
||||||
InvalidateAfter(frame);
|
InvalidateAfter(frame);
|
||||||
|
@ -88,7 +88,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void RemoveFrame(int frame)
|
public void RemoveFrame(int frame)
|
||||||
{
|
{
|
||||||
bool endBatch = ChangeLog.BeginNewBatch("Remove Frame: " + frame, true);
|
bool endBatch = ChangeLog.BeginNewBatch($"Remove Frame: {frame}", true);
|
||||||
ChangeLog.AddGeneralUndo(frame, InputLogLength - 1);
|
ChangeLog.AddGeneralUndo(frame, InputLogLength - 1);
|
||||||
|
|
||||||
Log.RemoveAt(frame);
|
Log.RemoveAt(frame);
|
||||||
|
@ -181,7 +181,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void RemoveFrames(int removeStart, int removeUpTo, bool fromHistory = false)
|
public void RemoveFrames(int removeStart, int removeUpTo, bool fromHistory = false)
|
||||||
{
|
{
|
||||||
bool endBatch = ChangeLog.BeginNewBatch("Remove Frames: " + removeStart + "-" + removeUpTo, true);
|
bool endBatch = ChangeLog.BeginNewBatch($"Remove Frames: {removeStart}-{removeUpTo}", true);
|
||||||
ChangeLog.AddGeneralUndo(removeStart, InputLogLength - 1);
|
ChangeLog.AddGeneralUndo(removeStart, InputLogLength - 1);
|
||||||
|
|
||||||
for (int i = removeUpTo - 1; i >= removeStart; i--)
|
for (int i = removeUpTo - 1; i >= removeStart; i--)
|
||||||
|
@ -225,7 +225,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void InsertInput(int frame, string inputState)
|
public void InsertInput(int frame, string inputState)
|
||||||
{
|
{
|
||||||
bool endBatch = ChangeLog.BeginNewBatch("Insert Frame: " + frame, true);
|
bool endBatch = ChangeLog.BeginNewBatch($"Insert Frame: {frame}", true);
|
||||||
ChangeLog.AddGeneralUndo(frame, InputLogLength);
|
ChangeLog.AddGeneralUndo(frame, InputLogLength);
|
||||||
|
|
||||||
Log.Insert(frame, inputState);
|
Log.Insert(frame, inputState);
|
||||||
|
@ -258,7 +258,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void InsertInput(int frame, IEnumerable<string> inputLog)
|
public void InsertInput(int frame, IEnumerable<string> inputLog)
|
||||||
{
|
{
|
||||||
bool endBatch = ChangeLog.BeginNewBatch("Insert Frame: " + frame, true);
|
bool endBatch = ChangeLog.BeginNewBatch($"Insert Frame: {frame}", true);
|
||||||
ChangeLog.AddGeneralUndo(frame, InputLogLength + inputLog.Count() - 1);
|
ChangeLog.AddGeneralUndo(frame, InputLogLength + inputLog.Count() - 1);
|
||||||
|
|
||||||
Log.InsertRange(frame, inputLog);
|
Log.InsertRange(frame, inputLog);
|
||||||
|
@ -307,7 +307,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void CopyOverInput(int frame, IEnumerable<IController> inputStates)
|
public void CopyOverInput(int frame, IEnumerable<IController> inputStates)
|
||||||
{
|
{
|
||||||
ChangeLog.BeginNewBatch("Copy Over Input: " + frame);
|
ChangeLog.BeginNewBatch($"Copy Over Input: {frame}");
|
||||||
var lg = LogGeneratorInstance();
|
var lg = LogGeneratorInstance();
|
||||||
var states = inputStates.ToList();
|
var states = inputStates.ToList();
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ namespace BizHawk.Client.Common
|
||||||
ExtendMovieForEdit(states.Count + frame - Log.Count);
|
ExtendMovieForEdit(states.Count + frame - Log.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1, "Copy Over Input: " + frame);
|
ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1, $"Copy Over Input: {frame}");
|
||||||
|
|
||||||
for (int i = 0; i < states.Count; i++)
|
for (int i = 0; i < states.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -338,7 +338,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public void InsertEmptyFrame(int frame, int count = 1, bool fromHistory = false)
|
public void InsertEmptyFrame(int frame, int count = 1, bool fromHistory = false)
|
||||||
{
|
{
|
||||||
bool endBatch = ChangeLog.BeginNewBatch("Insert Empty Frame: " + frame, true);
|
bool endBatch = ChangeLog.BeginNewBatch($"Insert Empty Frame: {frame}", true);
|
||||||
ChangeLog.AddGeneralUndo(frame, InputLogLength + count - 1);
|
ChangeLog.AddGeneralUndo(frame, InputLogLength + count - 1);
|
||||||
|
|
||||||
var lg = LogGeneratorInstance();
|
var lg = LogGeneratorInstance();
|
||||||
|
@ -422,7 +422,7 @@ namespace BizHawk.Client.Common
|
||||||
Changes = true;
|
Changes = true;
|
||||||
InvalidateAfter(frame);
|
InvalidateAfter(frame);
|
||||||
|
|
||||||
ChangeLog.AddBoolToggle(frame, buttonName, !adapter.IsPressed(buttonName), "Toggle " + buttonName + ": " + frame);
|
ChangeLog.AddBoolToggle(frame, buttonName, !adapter.IsPressed(buttonName), $"Toggle {buttonName}: {frame}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBoolState(int frame, string buttonName, bool val)
|
public void SetBoolState(int frame, string buttonName, bool val)
|
||||||
|
@ -444,7 +444,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
InvalidateAfter(frame);
|
InvalidateAfter(frame);
|
||||||
Changes = true;
|
Changes = true;
|
||||||
ChangeLog.AddBoolToggle(frame, buttonName, old, "Set " + buttonName + "(" + (val ? "On" : "Off") + "): " + frame);
|
ChangeLog.AddBoolToggle(frame, buttonName, old, $"Set {buttonName}({(val ? "On" : "Off")}): {frame}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ namespace BizHawk.Client.Common
|
||||||
ExtendMovieForEdit(frame + count - Log.Count);
|
ExtendMovieForEdit(frame + count - Log.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeLog.AddGeneralUndo(frame, frame + count - 1, "Set " + buttonName + "(" + (val ? "On" : "Off") + "): " + frame + "-" + (frame + count - 1));
|
ChangeLog.AddGeneralUndo(frame, frame + count - 1, $"Set {buttonName}({(val ? "On" : "Off")}): {frame}-{(frame + count - 1)}");
|
||||||
|
|
||||||
int changed = -1;
|
int changed = -1;
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
|
@ -502,7 +502,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
InvalidateAfter(frame);
|
InvalidateAfter(frame);
|
||||||
Changes = true;
|
Changes = true;
|
||||||
ChangeLog.AddFloatChange(frame, buttonName, old, val, "Set " + buttonName + "(" + val + "): " + frame);
|
ChangeLog.AddFloatChange(frame, buttonName, old, val, $"Set {buttonName}({val}): {frame}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ namespace BizHawk.Client.Common
|
||||||
ExtendMovieForEdit(frame - Log.Count + 1);
|
ExtendMovieForEdit(frame - Log.Count + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeLog.AddGeneralUndo(frame, frame + count - 1, "Set " + buttonName + "(" + val + "): " + frame + "-" + (frame + count - 1));
|
ChangeLog.AddGeneralUndo(frame, frame + count - 1, $"Set {buttonName}({val}): {frame}-{(frame + count - 1)}");
|
||||||
|
|
||||||
int changed = -1;
|
int changed = -1;
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
|
|
|
@ -273,7 +273,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
if (name == "")
|
if (name == "")
|
||||||
{
|
{
|
||||||
name = "Undo step " + _totalSteps;
|
name = $"Undo step {_totalSteps}";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
@ -349,11 +349,11 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (oldPosition == -1)
|
if (oldPosition == -1)
|
||||||
{
|
{
|
||||||
name = "Set Marker at frame " + newMarker.Frame;
|
name = $"Set Marker at frame {newMarker.Frame}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = "Remove Marker at frame " + oldPosition;
|
name = $"Remove Marker at frame {oldPosition}";
|
||||||
}
|
}
|
||||||
|
|
||||||
AddMovieAction(name);
|
AddMovieAction(name);
|
||||||
|
|
|
@ -573,7 +573,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (_domain != null)
|
if (_domain != null)
|
||||||
{
|
{
|
||||||
return "X" + (_domain.Size - 1).NumHexDigits();
|
return $"X{(_domain.Size - 1).NumHexDigits()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Reference in New Issue