add core scanning system
This commit is contained in:
parent
64e38e83c8
commit
f356d5b354
|
@ -8,6 +8,7 @@ using BizHawk.Emulation.CPUs.M6502;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Consoles.Nintendo
|
namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
|
[CoreVersion("0.0.0.1",FriendlyName="NESHawk")]
|
||||||
public partial class NES : IEmulator
|
public partial class NES : IEmulator
|
||||||
{
|
{
|
||||||
//hardware/state
|
//hardware/state
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -8,41 +9,80 @@ using System.Text;
|
||||||
|
|
||||||
namespace BizHawk
|
namespace BizHawk
|
||||||
{
|
{
|
||||||
public struct Tuple<T1,T2> : IEquatable<Tuple<T1, T2>>
|
public struct Tuple<T1, T2> : IEquatable<Tuple<T1, T2>>
|
||||||
{
|
{
|
||||||
private readonly T1 first;
|
private readonly T1 first;
|
||||||
private readonly T2 second;
|
private readonly T2 second;
|
||||||
public T1 First { get { return first; } }
|
public T1 First { get { return first; } }
|
||||||
public T2 Second { get { return second; } }
|
public T2 Second { get { return second; } }
|
||||||
|
|
||||||
public Tuple(T1 o1, T2 o2)
|
public Tuple(T1 o1, T2 o2)
|
||||||
{
|
{
|
||||||
first = o1;
|
first = o1;
|
||||||
second = o2;
|
second = o2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(Tuple<T1, T2> other)
|
public bool Equals(Tuple<T1, T2> other)
|
||||||
{
|
{
|
||||||
return first.Equals(other.first) &&
|
return first.Equals(other.first) &&
|
||||||
second.Equals(other.second);
|
second.Equals(other.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
if (obj is Tuple<T1, T2>)
|
if (obj is Tuple<T1, T2>)
|
||||||
return this.Equals((Tuple<T1, T2>)obj);
|
return this.Equals((Tuple<T1, T2>)obj);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
return first.GetHashCode() ^ second.GetHashCode();
|
return first.GetHashCode() ^ second.GetHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Extensions
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
{
|
public class CoreVersion : Attribute
|
||||||
|
{
|
||||||
|
public CoreVersion(string version)
|
||||||
|
{
|
||||||
|
this.Version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Version { get; set; }
|
||||||
|
public string FriendlyName { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Introspection
|
||||||
|
{
|
||||||
|
public class CoreInfo
|
||||||
|
{
|
||||||
|
public string ClassName, Version, FriendlyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<CoreInfo> GetCoreInfo()
|
||||||
|
{
|
||||||
|
var ret = new List<CoreInfo>();
|
||||||
|
//scan types in this assembly to find ones that implement boards to add them to the list
|
||||||
|
foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
|
||||||
|
{
|
||||||
|
var attrs = type.GetCustomAttributes(typeof(CoreVersion), true);
|
||||||
|
if (attrs.Length == 0) continue;
|
||||||
|
var cv = (CoreVersion)attrs[0];
|
||||||
|
var ci = new CoreInfo();
|
||||||
|
ci.ClassName = type.Name;
|
||||||
|
ci.FriendlyName = cv.FriendlyName;
|
||||||
|
if (string.IsNullOrEmpty(ci.FriendlyName)) ci.FriendlyName = ci.ClassName;
|
||||||
|
ci.Version = cv.Version;
|
||||||
|
ret.Add(ci);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Extensions
|
||||||
|
{
|
||||||
public static void CopyTo(this Stream src, Stream dest)
|
public static void CopyTo(this Stream src, Stream dest)
|
||||||
{
|
{
|
||||||
int size = (src.CanSeek) ? Math.Min((int)(src.Length - src.Position), 0x2000) : 0x2000;
|
int size = (src.CanSeek) ? Math.Min((int)(src.Length - src.Position), 0x2000) : 0x2000;
|
||||||
|
@ -76,17 +116,17 @@ namespace BizHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool IsBinary(this string str)
|
public static bool IsBinary(this string str)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < str.Length; i++)
|
for (int i = 0; i < str.Length; i++)
|
||||||
{
|
{
|
||||||
char c = str[i];
|
char c = str[i];
|
||||||
if (c == '0' || c == '1')
|
if (c == '0' || c == '1')
|
||||||
continue;
|
continue;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Bit(this byte b, int index)
|
public static bool Bit(this byte b, int index)
|
||||||
{
|
{
|
||||||
|
@ -99,161 +139,161 @@ namespace BizHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string GetPrecedingString(this string str, string value)
|
public static string GetPrecedingString(this string str, string value)
|
||||||
{
|
{
|
||||||
int index = str.IndexOf(value);
|
int index = str.IndexOf(value);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return null;
|
return null;
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
return "";
|
return "";
|
||||||
return str.Substring(0, index);
|
return str.Substring(0, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool In(this string str, params string[] options)
|
public static bool In(this string str, params string[] options)
|
||||||
{
|
{
|
||||||
foreach (string opt in options)
|
foreach (string opt in options)
|
||||||
{
|
{
|
||||||
if (opt.Equals(str, StringComparison.CurrentCultureIgnoreCase)) return true;
|
if (opt.Equals(str, StringComparison.CurrentCultureIgnoreCase)) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool In(this string str, IEnumerable<string> options)
|
public static bool In(this string str, IEnumerable<string> options)
|
||||||
{
|
{
|
||||||
foreach (string opt in options)
|
foreach (string opt in options)
|
||||||
{
|
{
|
||||||
if (opt.Equals(str,StringComparison.CurrentCultureIgnoreCase)) return true;
|
if (opt.Equals(str, StringComparison.CurrentCultureIgnoreCase)) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool In<T>(this string str, IEnumerable<T> options, Func<T, string, bool> eval)
|
public static bool In<T>(this string str, IEnumerable<T> options, Func<T, string, bool> eval)
|
||||||
{
|
{
|
||||||
foreach (T opt in options)
|
foreach (T opt in options)
|
||||||
{
|
{
|
||||||
if (eval(opt, str) == true)
|
if (eval(opt, str) == true)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool NotIn(this string str, params string[] options)
|
public static bool NotIn(this string str, params string[] options)
|
||||||
{
|
{
|
||||||
foreach (string opt in options)
|
foreach (string opt in options)
|
||||||
{
|
{
|
||||||
if (opt.ToLower() == str.ToLower()) return false;
|
if (opt.ToLower() == str.ToLower()) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool NotIn(this string str, IEnumerable<string> options)
|
public static bool NotIn(this string str, IEnumerable<string> options)
|
||||||
{
|
{
|
||||||
foreach (string opt in options)
|
foreach (string opt in options)
|
||||||
{
|
{
|
||||||
if (opt.ToLower() == str.ToLower()) return false;
|
if (opt.ToLower() == str.ToLower()) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool In(this int i, params int[] options)
|
|
||||||
{
|
|
||||||
foreach (int j in options)
|
|
||||||
{
|
|
||||||
if (i == j) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool In(this int i, IEnumerable<int> options)
|
public static bool In(this int i, params int[] options)
|
||||||
{
|
{
|
||||||
foreach (int j in options)
|
foreach (int j in options)
|
||||||
{
|
{
|
||||||
if (i == j) return true;
|
if (i == j) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ContainsStartsWith(this IEnumerable<string> options, string str)
|
public static bool In(this int i, IEnumerable<int> options)
|
||||||
{
|
{
|
||||||
foreach (string opt in options)
|
foreach (int j in options)
|
||||||
{
|
{
|
||||||
if (opt.StartsWith(str)) return true;
|
if (i == j) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetOptionValue(this IEnumerable<string> options, string str)
|
public static bool ContainsStartsWith(this IEnumerable<string> options, string str)
|
||||||
{
|
{
|
||||||
try
|
foreach (string opt in options)
|
||||||
{
|
{
|
||||||
foreach (string opt in options)
|
if (opt.StartsWith(str)) return true;
|
||||||
{
|
}
|
||||||
if (opt.StartsWith(str))
|
return false;
|
||||||
{
|
}
|
||||||
return opt.Split('=')[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception) { }
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsValidRomExtentsion(this string str, params string[] romExtensions)
|
public static string GetOptionValue(this IEnumerable<string> options, string str)
|
||||||
{
|
{
|
||||||
string strUpper = str.ToUpper();
|
try
|
||||||
foreach (string ext in romExtensions)
|
{
|
||||||
{
|
foreach (string opt in options)
|
||||||
if (strUpper.EndsWith(ext.ToUpper())) return true;
|
{
|
||||||
}
|
if (opt.StartsWith(str))
|
||||||
return false;
|
{
|
||||||
}
|
return opt.Split('=')[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static string ToCommaSeparated(this List<string> list)
|
public static bool IsValidRomExtentsion(this string str, params string[] romExtensions)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
string strUpper = str.ToUpper();
|
||||||
for (int i = 0; i < list.Count; i++)
|
foreach (string ext in romExtensions)
|
||||||
{
|
{
|
||||||
if (i > 0) sb.Append(",");
|
if (strUpper.EndsWith(ext.ToUpper())) return true;
|
||||||
sb.Append(list[i]);
|
}
|
||||||
}
|
return false;
|
||||||
return sb.ToString();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void SaveAsHex(this byte[] buffer, TextWriter writer)
|
public static string ToCommaSeparated(this List<string> list)
|
||||||
{
|
{
|
||||||
for (int i=0; i<buffer.Length; i++)
|
var sb = new StringBuilder();
|
||||||
{
|
for (int i = 0; i < list.Count; i++)
|
||||||
writer.Write("{0:X2}", buffer[i]);
|
{
|
||||||
}
|
if (i > 0) sb.Append(",");
|
||||||
writer.WriteLine();
|
sb.Append(list[i]);
|
||||||
}
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public static void SaveAsHex(this byte[] buffer, TextWriter writer, int length)
|
public static void SaveAsHex(this byte[] buffer, TextWriter writer)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < buffer.Length; i++)
|
||||||
{
|
{
|
||||||
writer.Write("{0:X2}", buffer[i]);
|
writer.Write("{0:X2}", buffer[i]);
|
||||||
}
|
}
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveAsHex(this short[] buffer, TextWriter writer)
|
public static void SaveAsHex(this byte[] buffer, TextWriter writer, int length)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buffer.Length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
writer.Write("{0:X4}", buffer[i]);
|
writer.Write("{0:X2}", buffer[i]);
|
||||||
}
|
}
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveAsHex(this ushort[] buffer, TextWriter writer)
|
public static void SaveAsHex(this short[] buffer, TextWriter writer)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buffer.Length; i++)
|
for (int i = 0; i < buffer.Length; i++)
|
||||||
{
|
{
|
||||||
writer.Write("{0:X4}", buffer[i]);
|
writer.Write("{0:X4}", buffer[i]);
|
||||||
}
|
}
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SaveAsHex(this ushort[] buffer, TextWriter writer)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < buffer.Length; i++)
|
||||||
|
{
|
||||||
|
writer.Write("{0:X4}", buffer[i]);
|
||||||
|
}
|
||||||
|
writer.WriteLine();
|
||||||
|
}
|
||||||
|
|
||||||
public static void SaveAsHex(this int[] buffer, TextWriter writer)
|
public static void SaveAsHex(this int[] buffer, TextWriter writer)
|
||||||
{
|
{
|
||||||
|
@ -314,38 +354,38 @@ namespace BizHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void ReadFromHex(this byte[] buffer, string hex)
|
public static void ReadFromHex(this byte[] buffer, string hex)
|
||||||
{
|
{
|
||||||
if (hex.Length % 2 != 0)
|
if (hex.Length % 2 != 0)
|
||||||
throw new Exception("Hex value string does not appear to be properly formatted.");
|
throw new Exception("Hex value string does not appear to be properly formatted.");
|
||||||
for (int i=0; i<buffer.Length && i*2<hex.Length; i++)
|
for (int i = 0; i < buffer.Length && i * 2 < hex.Length; i++)
|
||||||
{
|
{
|
||||||
string bytehex = "" + hex[i*2] + hex[i*2 + 1];
|
string bytehex = "" + hex[i * 2] + hex[i * 2 + 1];
|
||||||
buffer[i] = byte.Parse(bytehex, NumberStyles.HexNumber);
|
buffer[i] = byte.Parse(bytehex, NumberStyles.HexNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadFromHex(this short[] buffer, string hex)
|
public static void ReadFromHex(this short[] buffer, string hex)
|
||||||
{
|
{
|
||||||
if (hex.Length % 4 != 0)
|
if (hex.Length % 4 != 0)
|
||||||
throw new Exception("Hex value string does not appear to be properly formatted.");
|
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++)
|
for (int i = 0; i < buffer.Length && i * 4 < hex.Length; i++)
|
||||||
{
|
{
|
||||||
string shorthex = "" + hex[i * 4] + hex[(i * 4) + 1] + hex[(i * 4) + 2] + hex[(i * 4) + 3];
|
string shorthex = "" + hex[i * 4] + hex[(i * 4) + 1] + hex[(i * 4) + 2] + hex[(i * 4) + 3];
|
||||||
buffer[i] = short.Parse(shorthex, NumberStyles.HexNumber);
|
buffer[i] = short.Parse(shorthex, NumberStyles.HexNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadFromHex(this ushort[] buffer, string hex)
|
public static void ReadFromHex(this ushort[] buffer, string hex)
|
||||||
{
|
{
|
||||||
if (hex.Length % 4 != 0)
|
if (hex.Length % 4 != 0)
|
||||||
throw new Exception("Hex value string does not appear to be properly formatted.");
|
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++)
|
for (int i = 0; i < buffer.Length && i * 4 < hex.Length; i++)
|
||||||
{
|
{
|
||||||
string ushorthex = "" + hex[i*4] + hex[(i*4)+1] + hex[(i*4)+2] + hex[(i*4)+3];
|
string ushorthex = "" + hex[i * 4] + hex[(i * 4) + 1] + hex[(i * 4) + 2] + hex[(i * 4) + 3];
|
||||||
buffer[i] = ushort.Parse(ushorthex, NumberStyles.HexNumber);
|
buffer[i] = ushort.Parse(ushorthex, NumberStyles.HexNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadFromHex(this int[] buffer, BinaryWriter bw)
|
public static void ReadFromHex(this int[] buffer, BinaryWriter bw)
|
||||||
{
|
{
|
||||||
|
@ -362,25 +402,25 @@ namespace BizHawk
|
||||||
//these don't work??? they dont get chosen by compiler
|
//these don't work??? they dont get chosen by compiler
|
||||||
public static void WriteBit(this BinaryWriter bw, Bit bit) { bw.Write((bool)bit); }
|
public static void WriteBit(this BinaryWriter bw, Bit bit) { bw.Write((bool)bit); }
|
||||||
public static Bit ReadBit(this BinaryReader br) { return br.ReadBoolean(); }
|
public static Bit ReadBit(this BinaryReader br) { return br.ReadBoolean(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Colors
|
public static class Colors
|
||||||
{
|
{
|
||||||
public static int ARGB(byte red, byte green, byte blue)
|
public static int ARGB(byte red, byte green, byte blue)
|
||||||
{
|
{
|
||||||
return (int) ((uint)((red << 0x10) | (green << 8) | blue | (0xFF << 0x18)));
|
return (int)((uint)((red << 0x10) | (green << 8) | blue | (0xFF << 0x18)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int ARGB(byte red, byte green, byte blue, byte alpha)
|
public static int ARGB(byte red, byte green, byte blue, byte alpha)
|
||||||
{
|
{
|
||||||
return (int) ((uint)((red << 0x10) | (green << 8) | blue | (alpha << 0x18)));
|
return (int)((uint)((red << 0x10) | (green << 8) | blue | (alpha << 0x18)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int Luminosity(byte lum)
|
public static int Luminosity(byte lum)
|
||||||
{
|
{
|
||||||
return (int)((uint)((lum << 0x10) | (lum << 8) | lum | (0xFF << 0x18)));
|
return (int)((uint)((lum << 0x10) | (lum << 8) | lum | (0xFF << 0x18)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -410,8 +450,8 @@ namespace BizHawk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static class Util
|
public static class Util
|
||||||
{
|
{
|
||||||
public static string Hash_MD5(byte[] data, int offset, int len)
|
public static string Hash_MD5(byte[] data, int offset, int len)
|
||||||
{
|
{
|
||||||
using (var md5 = System.Security.Cryptography.MD5.Create())
|
using (var md5 = System.Security.Cryptography.MD5.Create())
|
||||||
|
@ -437,13 +477,13 @@ namespace BizHawk
|
||||||
return (x & (x - 1)) == 0;
|
return (x & (x - 1)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int SaveRamBytesUsed(byte[] SaveRAM)
|
public static int SaveRamBytesUsed(byte[] SaveRAM)
|
||||||
{
|
{
|
||||||
for (int j = SaveRAM.Length - 1; j >= 0; j--)
|
for (int j = SaveRAM.Length - 1; j >= 0; j--)
|
||||||
if (SaveRAM[j] != 0)
|
if (SaveRAM[j] != 0)
|
||||||
return j + 1;
|
return j + 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// conerts bytes to an uppercase string of hex numbers in upper case without any spacing or anything
|
/// conerts bytes to an uppercase string of hex numbers in upper case without any spacing or anything
|
||||||
|
@ -462,7 +502,7 @@ namespace BizHawk
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream();
|
MemoryStream ms = new MemoryStream();
|
||||||
if (str.Length % 2 != 0) throw new ArgumentException();
|
if (str.Length % 2 != 0) throw new ArgumentException();
|
||||||
int len = str.Length/2;
|
int len = str.Length / 2;
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
int d = 0;
|
int d = 0;
|
||||||
|
@ -494,11 +534,11 @@ namespace BizHawk
|
||||||
|
|
||||||
public static short[] ByteBufferToShortBuffer(byte[] buf)
|
public static short[] ByteBufferToShortBuffer(byte[] buf)
|
||||||
{
|
{
|
||||||
int num = buf.Length/2;
|
int num = buf.Length / 2;
|
||||||
short[] ret = new short[num];
|
short[] ret = new short[num];
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
ret[i] =(short)(buf[i * 2] | (buf[i * 2 + 1] << 8));
|
ret[i] = (short)(buf[i * 2] | (buf[i * 2 + 1] << 8));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -510,7 +550,7 @@ namespace BizHawk
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
ret[i * 2 + 0] = (byte)(buf[i] & 0xFF);
|
ret[i * 2 + 0] = (byte)(buf[i] & 0xFF);
|
||||||
ret[i * 2 + 1] = (byte)((buf[i]>>8) & 0xFF);
|
ret[i * 2 + 1] = (byte)((buf[i] >> 8) & 0xFF);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -583,14 +623,14 @@ namespace BizHawk
|
||||||
Decimal OneGigaByte = OneMegaByte * 1024M;
|
Decimal OneGigaByte = OneMegaByte * 1024M;
|
||||||
|
|
||||||
string suffix;
|
string suffix;
|
||||||
if (size > 1024*1024*1024)
|
if (size > 1024 * 1024 * 1024)
|
||||||
{
|
{
|
||||||
size /= 1024*1024*1024;
|
size /= 1024 * 1024 * 1024;
|
||||||
suffix = "GB";
|
suffix = "GB";
|
||||||
}
|
}
|
||||||
else if (size > 1024*1024)
|
else if (size > 1024 * 1024)
|
||||||
{
|
{
|
||||||
size /= 1024*1024;
|
size /= 1024 * 1024;
|
||||||
suffix = "MB";
|
suffix = "MB";
|
||||||
}
|
}
|
||||||
else if (size > 1024)
|
else if (size > 1024)
|
||||||
|
@ -643,7 +683,7 @@ namespace BizHawk
|
||||||
{
|
{
|
||||||
sections.Push(name);
|
sections.Push(name);
|
||||||
if (IsText)
|
if (IsText)
|
||||||
if (IsWriter) { tw.WriteLine("[{0}]", name);}
|
if (IsWriter) { tw.WriteLine("[{0}]", name); }
|
||||||
else { tr.ReadLine(); }
|
else { tr.ReadLine(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +699,7 @@ namespace BizHawk
|
||||||
{
|
{
|
||||||
if (typeof(T).BaseType != typeof(System.Enum))
|
if (typeof(T).BaseType != typeof(System.Enum))
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
if(isText) SyncEnumText<T>(name, ref val);
|
if (isText) SyncEnumText<T>(name, ref val);
|
||||||
else if (IsReader) val = (T)Enum.ToObject(typeof(T), br.ReadInt32());
|
else if (IsReader) val = (T)Enum.ToObject(typeof(T), br.ReadInt32());
|
||||||
else bw.Write(Convert.ToInt32(val));
|
else bw.Write(Convert.ToInt32(val));
|
||||||
}
|
}
|
||||||
|
@ -907,7 +947,7 @@ namespace BizHawk
|
||||||
|
|
||||||
void Read(ref int val) { val = br.ReadInt32(); }
|
void Read(ref int val) { val = br.ReadInt32(); }
|
||||||
void Write(ref int val) { bw.Write(val); }
|
void Write(ref int val) { bw.Write(val); }
|
||||||
void ReadText(string name, ref int val) { val = int.Parse(tr.ReadLine().Split(' ')[1].Replace("0x",""), NumberStyles.HexNumber); }
|
void ReadText(string name, ref int val) { val = int.Parse(tr.ReadLine().Split(' ')[1].Replace("0x", ""), NumberStyles.HexNumber); }
|
||||||
void WriteText(string name, ref int val) { tw.WriteLine("{0} 0x{1:X8}", name, val); }
|
void WriteText(string name, ref int val) { tw.WriteLine("{0} 0x{1:X8}", name, val); }
|
||||||
|
|
||||||
void Read(ref bool val) { val = br.ReadBoolean(); }
|
void Read(ref bool val) { val = br.ReadBoolean(); }
|
||||||
|
|
|
@ -87,6 +87,12 @@ namespace BizHawk.MultiClient
|
||||||
Global.CoreInputComm = new CoreInputComm();
|
Global.CoreInputComm = new CoreInputComm();
|
||||||
SyncCoreInputComm();
|
SyncCoreInputComm();
|
||||||
|
|
||||||
|
Console.WriteLine("Scanning cores:");
|
||||||
|
foreach (var ci in Introspection.GetCoreInfo())
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0} - {1} ({2})", ci.FriendlyName, ci.Version, ci.ClassName);
|
||||||
|
}
|
||||||
|
|
||||||
Database.LoadDatabase(PathManager.GetExeDirectoryAbsolute() + "\\gamedb.txt");
|
Database.LoadDatabase(PathManager.GetExeDirectoryAbsolute() + "\\gamedb.txt");
|
||||||
|
|
||||||
SyncPresentationMode();
|
SyncPresentationMode();
|
||||||
|
|
Loading…
Reference in New Issue