Add LibretroBridge binary for Linux and wire it up

build scripts to come, see PR #2895
This commit is contained in:
YoshiRulz 2021-09-09 03:44:12 +10:00
parent 38f3cdb687
commit 2d81c820b4
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 7 additions and 5 deletions

Binary file not shown.

View File

@ -20,6 +20,9 @@ namespace BizHawk.Emulation.Cores.Libretro
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr DllInit(IntPtr dllModule);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr DllInitUnix(string dllModule);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void MessageApi(eMessage msg);
@ -49,13 +52,14 @@ namespace BizHawk.Emulation.Cores.Libretro
instanceDll = new InstanceDll(dllPath);
instanceDllCore = new InstanceDll(corePath);
var dllinit = GetTypedDelegate<DllInit>("DllInit");
Message = GetTypedDelegate<MessageApi>("Message");
_copyBuffer = GetTypedDelegate<BufferApi>("CopyBuffer");
_setBuffer = GetTypedDelegate<BufferApi>("SetBuffer");
SetVariable = GetTypedDelegate<SetVariableApi>("SetVariable");
comm = (CommStruct*)dllinit(instanceDllCore.HModule).ToPointer();
comm = (CommStruct*) (OSTailoredCode.IsUnixHost
? GetTypedDelegate<DllInitUnix>("DllInit")(corePath)
: GetTypedDelegate<DllInit>("DllInit")(instanceDllCore.HModule)).ToPointer();
//TODO: (stash function pointers locally and thunk to IntPtr)
//ALSO: this should be done by the core, I think, not the API. No smarts should be in here

View File

@ -23,13 +23,11 @@ namespace BizHawk.Emulation.Cores.Libretro
// TODO: codepath just for introspection (lighter weight; no speex, no controls, etc.)
public LibretroCore(CoreComm nextComm, IGameInfo game, string corePath)
{
if (OSTailoredCode.IsUnixHost) throw new NotImplementedException("required library LibretroBridge is not yet available for Linux");
ServiceProvider = new BasicServiceProvider(this);
_SyncSettings = new SyncSettings();
CoreComm = nextComm;
string dllPath = Path.Combine(CoreComm.CoreFileProvider.DllPath(), "LibretroBridge.dll");
var dllPath = Path.Combine(CoreComm.CoreFileProvider.DllPath(), OSTailoredCode.IsUnixHost ? "LibretroBridge.so" : "LibretroBridge.dll");
api = new LibretroApi(dllPath, corePath);
if (api.comm->env.retro_api_version != 1)