diff --git a/BizHawk.Common/Extensions/BufferExtensions.cs b/BizHawk.Common/Extensions/BufferExtensions.cs index c2534a3e39..5cbdbf009b 100644 --- a/BizHawk.Common/Extensions/BufferExtensions.cs +++ b/BizHawk.Common/Extensions/BufferExtensions.cs @@ -8,17 +8,6 @@ namespace BizHawk.Common.BufferExtensions { public static class BufferExtensions { - [Obsolete] // do we know of any situation where SaveAsHexFast doesn't work? - public static void SaveAsHex(this byte[] buffer, TextWriter writer) - { - foreach (var b in buffer) - { - writer.Write("{0:X2}", b); - } - - writer.WriteLine(); - } - private static readonly char[] HexConvArr = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static unsafe void SaveAsHexFast(this byte[] buffer, TextWriter writer) @@ -40,57 +29,6 @@ namespace BizHawk.Common.BufferExtensions writer.WriteLine(); } - [Obsolete] // do we know of any situation where SaveAsHexFast doesn't work? - public static void SaveAsHex(this byte[] buffer, TextWriter writer, int length) - { - for (int i = 0; i < length; i++) - { - writer.Write("{0:X2}", buffer[i]); - } - - writer.WriteLine(); - } - - public static void SaveAsHex(this short[] buffer, TextWriter writer) - { - foreach (var b in buffer) - { - writer.Write("{0:X4}", b); - } - - writer.WriteLine(); - } - - public static void SaveAsHex(this ushort[] buffer, TextWriter writer) - { - foreach (var b in buffer) - { - writer.Write("{0:X4}", b); - } - - writer.WriteLine(); - } - - public static void SaveAsHex(this int[] buffer, TextWriter writer) - { - foreach (int b in buffer) - { - writer.Write("{0:X8}", b); - } - - writer.WriteLine(); - } - - public static void SaveAsHex(this uint[] buffer, TextWriter writer) - { - foreach (var b in buffer) - { - writer.Write("{0:X8}", b); - } - - writer.WriteLine(); - } - public static void ReadFromHex(this byte[] buffer, string hex) { if (hex.Length % 2 != 0) @@ -127,48 +65,6 @@ namespace BizHawk.Common.BufferExtensions } } - public static void ReadFromHex(this short[] buffer, string hex) - { - if (hex.Length % 4 != 0) - { - throw new Exception("Hex value string does not appear to be properly formatted."); - } - - for (int i = 0; i < buffer.Length && i * 4 < hex.Length; i++) - { - var shorthex = string.Concat(hex[i * 4], hex[(i * 4) + 1], hex[(i * 4) + 2], hex[(i * 4) + 3]); - buffer[i] = short.Parse(shorthex, NumberStyles.HexNumber); - } - } - - public static void ReadFromHex(this ushort[] buffer, string hex) - { - if (hex.Length % 4 != 0) - { - throw new Exception("Hex value string does not appear to be properly formatted."); - } - - for (int i = 0; i < buffer.Length && i * 4 < hex.Length; i++) - { - var ushorthex = string.Concat(hex[i * 4], hex[(i * 4) + 1], hex[(i * 4) + 2], hex[(i * 4) + 3]); - buffer[i] = ushort.Parse(ushorthex, NumberStyles.HexNumber); - } - } - - public static void ReadFromHex(this int[] buffer, string hex) - { - if (hex.Length % 8 != 0) - { - throw new Exception("Hex value string does not appear to be properly formatted."); - } - - for (int i = 0; i < buffer.Length && i * 8 < hex.Length; i++) - { - var inthex = hex.Substring(i * 8, 8); - buffer[i] = int.Parse(inthex, NumberStyles.HexNumber); - } - } - /// /// Converts bytes to an uppercase string of hex numbers in upper case without any spacing or anything /// diff --git a/BizHawk.Emulation.Cores/Libretro/LibretroCore.cs b/BizHawk.Emulation.Cores/Libretro/LibretroCore.cs index 3d3fca7bb9..3d364b2107 100644 --- a/BizHawk.Emulation.Cores/Libretro/LibretroCore.cs +++ b/BizHawk.Emulation.Cores/Libretro/LibretroCore.cs @@ -363,7 +363,7 @@ namespace BizHawk.Emulation.Cores.Libretro public void SaveStateText(System.IO.TextWriter writer) { var temp = SaveStateBinary(); - temp.SaveAsHex(writer); + temp.SaveAsHexFast(writer); } public void LoadStateText(System.IO.TextReader reader)