Emulation.Comon - misc cleanups
This commit is contained in:
parent
57b63aaed4
commit
8eb9d68fa6
File diff suppressed because one or more lines are too long
|
@ -12,11 +12,10 @@ using BizHawk.Common;
|
|||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
// fields are serialized/deserialized in their memory order as reported by Marshal.OffsetOf
|
||||
// to do anything useful, passed targets should be [StructLayout.Sequential] or [StructLayout.Explicit]
|
||||
public class BinaryQuickSerializer
|
||||
{
|
||||
// fields are serialized/deserialized in their memory order as reported by Marshal.OffsetOf
|
||||
// to do anything useful, passed targets should be [StructLayout.Sequential] or [StructLayout.Explicit]
|
||||
|
||||
#region methodinfo from a lambda expression. cool.
|
||||
|
||||
private static MethodInfo FromExpression(Expression e)
|
||||
|
@ -44,8 +43,8 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
#region read and write handlers for individual fields
|
||||
|
||||
private static readonly Dictionary<Type, MethodInfo> readhandlers = new Dictionary<Type, MethodInfo>();
|
||||
private static readonly Dictionary<Type, MethodInfo> writehandlers = new Dictionary<Type, MethodInfo>();
|
||||
private static readonly Dictionary<Type, MethodInfo> Readhandlers = new Dictionary<Type, MethodInfo>();
|
||||
private static readonly Dictionary<Type, MethodInfo> Writehandlers = new Dictionary<Type, MethodInfo>();
|
||||
|
||||
private static void AddR<T>(Expression<Action<BinaryReader>> f)
|
||||
{
|
||||
|
@ -55,7 +54,7 @@ namespace BizHawk.Emulation.Common
|
|||
throw new InvalidOperationException("Type mismatch");
|
||||
}
|
||||
|
||||
readhandlers.Add(typeof(T), method);
|
||||
Readhandlers.Add(typeof(T), method);
|
||||
}
|
||||
|
||||
private static void AddW<T>(Expression<Action<BinaryWriter>> f)
|
||||
|
@ -66,7 +65,7 @@ namespace BizHawk.Emulation.Common
|
|||
throw new InvalidOperationException("Type mismatch");
|
||||
}
|
||||
|
||||
writehandlers.Add(typeof(T), Method(f));
|
||||
Writehandlers.Add(typeof(T), Method(f));
|
||||
}
|
||||
|
||||
static BinaryQuickSerializer()
|
||||
|
@ -135,7 +134,7 @@ namespace BizHawk.Emulation.Common
|
|||
il.Emit(OpCodes.Ldloc, target);
|
||||
il.Emit(OpCodes.Ldarg_1);
|
||||
MethodInfo m;
|
||||
if (!readhandlers.TryGetValue(field.FieldType, out m))
|
||||
if (!Readhandlers.TryGetValue(field.FieldType, out m))
|
||||
{
|
||||
throw new InvalidOperationException("(R) Can't handle nested type " + field.FieldType);
|
||||
}
|
||||
|
@ -160,7 +159,7 @@ namespace BizHawk.Emulation.Common
|
|||
il.Emit(OpCodes.Ldloc, target);
|
||||
il.Emit(OpCodes.Ldfld, field);
|
||||
MethodInfo m;
|
||||
if (!writehandlers.TryGetValue(field.FieldType, out m))
|
||||
if (!Writehandlers.TryGetValue(field.FieldType, out m))
|
||||
{
|
||||
throw new InvalidOperationException("(W) Can't handle nested type " + field.FieldType);
|
||||
}
|
||||
|
@ -181,16 +180,16 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
#endregion
|
||||
|
||||
private static readonly IDictionary<Type, SerializationFactory> serializers =
|
||||
private static readonly IDictionary<Type, SerializationFactory> Serializers =
|
||||
new ConcurrentDictionary<Type, SerializationFactory>();
|
||||
|
||||
private static SerializationFactory GetFactory(Type t)
|
||||
{
|
||||
SerializationFactory f;
|
||||
if (!serializers.TryGetValue(t, out f))
|
||||
if (!Serializers.TryGetValue(t, out f))
|
||||
{
|
||||
f = CreateFactory(t);
|
||||
serializers[t] = f;
|
||||
Serializers[t] = f;
|
||||
}
|
||||
|
||||
return f;
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Common.BizInvoke
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// dictionary of all generated proxy implementations and their basetypes
|
||||
/// dictionary of all generated proxy implementations and their base types
|
||||
/// </summary>
|
||||
private static readonly IDictionary<Type, InvokerImpl> Impls = new Dictionary<Type, InvokerImpl>();
|
||||
|
||||
|
@ -543,12 +543,12 @@ namespace BizHawk.Emulation.Common.BizInvoke
|
|||
public CallingConvention CallingConvention { get; }
|
||||
|
||||
/// <summary>
|
||||
/// name of entry point; if not given, the method's name is used
|
||||
/// Gets or sets the name of entry point; if not given, the method's name is used
|
||||
/// </summary>
|
||||
public string EntryPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Use a slower interop that supports more argument types
|
||||
/// Gets or sets a value indicating whether or not to use a slower interop that supports more argument types
|
||||
/// </summary>
|
||||
public bool Compatibility { get; set; }
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace BizHawk.Emulation.Common
|
|||
public SavestateSizeMismatchException(string message)
|
||||
: base(message)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// DisplayType, used in IEmulator
|
||||
/// DisplayType, used in <seealso cref="IEmulator"/>
|
||||
/// </summary>
|
||||
public enum DisplayType
|
||||
{
|
||||
|
|
|
@ -30,32 +30,29 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
string GetGameBasePath();
|
||||
|
||||
|
||||
#region EmuLoadHelper api
|
||||
|
||||
/// <summary>
|
||||
/// get path to a firmware
|
||||
/// </summary>
|
||||
/// <param name="sysID"></param>
|
||||
/// <param name="firmwareID"></param>
|
||||
/// <param name="required">if true, result is guaranteed to be valid; else null is possible if not foun</param>
|
||||
/// <param name="sysId">The system id</param>
|
||||
/// <param name="firmwareId">The firmware id</param>
|
||||
/// <param name="required">if true, result is guaranteed to be valid; else null is possible if not found</param>
|
||||
/// <param name="msg">message to show if fail to get</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete]
|
||||
string GetFirmwarePath(string sysID, string firmwareID, bool required, string msg = null);
|
||||
string GetFirmwarePath(string sysId, string firmwareId, bool required, string msg = null);
|
||||
|
||||
/// <summary>
|
||||
/// Get a firmware as a byte array
|
||||
/// </summary>
|
||||
/// <param name="sysID">the core systemID</param>
|
||||
/// <param name="firmwareID">the firmware id</param>
|
||||
/// <param name="sysId">the core systemID</param>
|
||||
/// <param name="firmwareId">the firmware id</param>
|
||||
/// <param name="required">if true, result is guaranteed to be valid; else null is possible if not found</param>
|
||||
/// <param name="msg">message to show if fail to get</param>
|
||||
byte[] GetFirmware(string sysID, string firmwareID, bool required, string msg = null);
|
||||
byte[] GetFirmware(string sysId, string firmwareId, bool required, string msg = null);
|
||||
|
||||
byte[] GetFirmwareWithGameInfo(string sysID, string firmwareID, bool required, out GameInfo gi, string msg = null);
|
||||
byte[] GetFirmwareWithGameInfo(string sysId, string firmwareId, bool required, out GameInfo gi, string msg = null);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a property of IDebuggable, and defines the means by which a client
|
||||
/// This is a property of <seealso cref="IDebuggable"/>, and defines the means by which a client
|
||||
/// gets and sets memory callbacks in the core. A memory callback should fire any time memory is
|
||||
/// read/written/executed by the core, and depends on the type specified by the callback
|
||||
/// </summary>
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace BizHawk.Emulation.Common
|
|||
{
|
||||
return _cpu;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (!AvailableCpus.Contains(value))
|
||||
|
|
|
@ -2,6 +2,24 @@
|
|||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public static class Metaspu
|
||||
{
|
||||
public static ISynchronizingAudioBuffer MetaspuConstruct(ESynchMethod method)
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
case ESynchMethod.ESynchMethod_Z:
|
||||
return new ZeromusSynchronizer();
|
||||
case ESynchMethod.ESynchMethod_N:
|
||||
return new NitsujaSynchronizer();
|
||||
case ESynchMethod.ESynchMethod_V:
|
||||
return new VecnaSynchronizer();
|
||||
default:
|
||||
return new NitsujaSynchronizer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// uses Metaspu to provide async sound to an ISoundProvider that does not provide its own async implementation
|
||||
/// </summary>
|
||||
|
@ -58,22 +76,4 @@ namespace BizHawk.Emulation.Common
|
|||
////ESynchMethod_P, //PCSX2 spu2-x //ohno! not available yet in c#
|
||||
ESynchMethod_V // vecna
|
||||
}
|
||||
|
||||
public static class Metaspu
|
||||
{
|
||||
public static ISynchronizingAudioBuffer MetaspuConstruct(ESynchMethod method)
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
case ESynchMethod.ESynchMethod_Z:
|
||||
return new ZeromusSynchronizer();
|
||||
case ESynchMethod.ESynchMethod_N:
|
||||
return new NitsujaSynchronizer();
|
||||
case ESynchMethod.ESynchMethod_V:
|
||||
return new VecnaSynchronizer();
|
||||
default:
|
||||
return new NitsujaSynchronizer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@ namespace BizHawk.Emulation.Common
|
|||
/// <param name="in_rate">Input sampling rate (integer number of Hz).</param>
|
||||
/// <param name="out_rate">Output sampling rate (integer number of Hz).</param>
|
||||
/// <param name="quality">Resampling quality between 0 and 10, where 0 has poor quality and 10 has very high quality.</param>
|
||||
/// <param name="err"></param>
|
||||
/// <param name="err">The error state</param>
|
||||
/// <returns>Newly created resampler state</returns>
|
||||
[DllImport("libspeexdsp.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern IntPtr speex_resampler_init(uint nb_channels, uint in_rate, uint out_rate, int quality, ref RESAMPLER_ERR err);
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PCECD/@EntryIndexedValue">PCECD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PSP/@EntryIndexedValue">PSP</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PSX/@EntryIndexedValue">PSX</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RAM/@EntryIndexedValue">RAM</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RTC/@EntryIndexedValue">RTC</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SG/@EntryIndexedValue">SG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SGB/@EntryIndexedValue">SGB</s:String>
|
||||
|
|
Loading…
Reference in New Issue