diff --git a/BizHawk.Emulation/Consoles/Sega/Saturn/Yabause.cs b/BizHawk.Emulation/Consoles/Sega/Saturn/Yabause.cs index 019c951ecb..e79e63891e 100644 --- a/BizHawk.Emulation/Consoles/Sega/Saturn/Yabause.cs +++ b/BizHawk.Emulation/Consoles/Sega/Saturn/Yabause.cs @@ -333,7 +333,7 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn public void SaveStateText(TextWriter writer) { var temp = SaveStateBinary(); - temp.SaveAsHex(writer); + temp.SaveAsHexFast(writer); // write extra copy of stuff we don't use writer.WriteLine("Frame {0}", Frame); } diff --git a/BizHawk.Emulation/Util.cs b/BizHawk.Emulation/Util.cs index eb59bf9475..5b84f4433c 100644 --- a/BizHawk.Emulation/Util.cs +++ b/BizHawk.Emulation/Util.cs @@ -260,6 +260,18 @@ namespace BizHawk writer.WriteLine(); } + static readonly char[] HexConv = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + public static void SaveAsHexFast(this byte[] buffer, TextWriter writer) + { + for (int i = 0; i < buffer.Length; i++) + { + writer.Write(HexConv[buffer[i] >> 4]); + writer.Write(HexConv[buffer[i] & 15]); + } + writer.WriteLine(); + } + public static void SaveAsHex(this byte[] buffer, TextWriter writer, int length) { for (int i = 0; i < length; i++)