waterbox has fun limitations
This commit is contained in:
parent
871c2bba8f
commit
0ad1f7feb2
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using BizHawk.BizInvoke;
|
||||
|
@ -44,25 +45,18 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct RenderSettings
|
||||
{
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool SoftThreaded;
|
||||
public int GLScaleFactor;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool GLBetterPolygons;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct InitConfig
|
||||
{
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool SkipFW;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool HasGBACart;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool DSi;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool ClearNAND;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool LoadDSiWare;
|
||||
public NDS.NDSSyncSettings.ThreeDeeRendererType ThreeDeeRenderer;
|
||||
public RenderSettings RenderSettings;
|
||||
|
@ -135,6 +129,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
public GetIntegerSettingCallback GetInteger;
|
||||
public GetStringSettingCallback GetString;
|
||||
public GetArraySettingCallback GetArray;
|
||||
|
||||
public IntPtr[] AllCallbacksInArray(ICallingConventionAdapter adapter)
|
||||
{
|
||||
return new Delegate[] { GetBoolean, GetInteger, GetString, GetArray }
|
||||
.Select(adapter.GetFunctionPointerForDelegate).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CC)]
|
||||
|
@ -148,6 +148,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
{
|
||||
public GetFileLengthCallback GetLength;
|
||||
public GetFileDataCallback GetData;
|
||||
|
||||
public IntPtr[] AllCallbacksInArray(ICallingConventionAdapter adapter)
|
||||
{
|
||||
return new Delegate[] { GetLength, GetData }
|
||||
.Select(adapter.GetFunctionPointerForDelegate).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CC)]
|
||||
|
@ -169,7 +175,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
public ReleaseGLContextCallback ReleaseGLContext;
|
||||
public ActivateGLContextCallback ActivateGLContext;
|
||||
public GetGLProcAddressCallback GetGLProcAddress;
|
||||
public bool IsWinApi;
|
||||
|
||||
public IntPtr[] AllCallbacksInArray(ICallingConventionAdapter adapter)
|
||||
{
|
||||
return new Delegate[] { RequestGLContext, ReleaseGLContext, ActivateGLContext, GetGLProcAddress }
|
||||
.Select(adapter.GetFunctionPointerForDelegate).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public enum LogLevel : int
|
||||
|
@ -183,12 +194,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
[UnmanagedFunctionPointer(CC)]
|
||||
public delegate void LogCallback(LogLevel level, string message);
|
||||
|
||||
[BizImport(CC, Compatibility = true)]
|
||||
[BizImport(CC)]
|
||||
public abstract IntPtr Init(
|
||||
ref InitConfig loadData,
|
||||
ref ConfigCallbackInterface configCallbackInterface,
|
||||
ref FileCallbackInterface fileCallbackInterface,
|
||||
//ref GLCallbackInterface glCallbackInterface, // TODO
|
||||
/* ref ConfigCallbackInterface */ IntPtr[] configCallbackInterface,
|
||||
/* ref FileCallbackInterface */ IntPtr[] fileCallbackInterface,
|
||||
// /* ref GLCallbackInterface */ IntPtr[] glCallbackInterface, // TODO
|
||||
LogCallback logCallback);
|
||||
|
||||
[BizImport(CC)]
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
}, new Delegate[]
|
||||
{
|
||||
_readcb, _writecb, _execcb, _tracecb, _threadstartcb,
|
||||
_configCallbackInterface.GetBoolean, _configCallbackInterface.GetArray,
|
||||
_configCallbackInterface.GetBoolean, _configCallbackInterface.GetInteger,
|
||||
_configCallbackInterface.GetString, _configCallbackInterface.GetArray,
|
||||
_fileCallbackInterface.GetLength, _fileCallbackInterface.GetData,
|
||||
_logCallback
|
||||
|
@ -191,7 +191,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
}
|
||||
}
|
||||
|
||||
var error = _core.Init(ref initConfig, ref _configCallbackInterface, ref _fileCallbackInterface, _logCallback);
|
||||
var error = _core.Init(
|
||||
ref initConfig,
|
||||
_configCallbackInterface.AllCallbacksInArray(_adapter),
|
||||
_fileCallbackInterface.AllCallbacksInArray(_adapter),
|
||||
_logCallback);
|
||||
if (error != IntPtr.Zero)
|
||||
{
|
||||
using (_exe.EnterExit())
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
{
|
||||
private LibWaterboxCore _core;
|
||||
protected WaterboxHost _exe;
|
||||
protected ICallingConventionAdapter _adapter;
|
||||
protected LibWaterboxCore.MemoryArea[] _memoryAreas;
|
||||
private readonly LibWaterboxCore.EmptyCallback _inputCallback;
|
||||
protected CoreComm CoreComm { get; }
|
||||
|
@ -53,7 +54,8 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
delegates = delegates.Concat(allExtraDelegates);
|
||||
using (_exe.EnterExit())
|
||||
{
|
||||
var ret = BizInvoker.GetInvoker<T>(_exe, _exe, CallingConventionAdapters.MakeWaterbox(delegates, _exe));
|
||||
_adapter = CallingConventionAdapters.MakeWaterbox(delegates, _exe);
|
||||
var ret = BizInvoker.GetInvoker<T>(_exe, _exe, _adapter);
|
||||
_core = ret;
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue