Handy tweaks (squashed PR #3140)

resolves #2425. commits:
- build handy-linux with fvisibility=internal, make export have default visiblity
- use bizinvoker for handy
- move this to the right spot
- correct name here
This commit is contained in:
CasualPokePlayer 2022-02-13 20:38:31 -08:00 committed by GitHub
parent 1330fdeaa1
commit 7db8472092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 31 deletions

BIN
Assets/dll/libbizlynx.dll.so Normal file → Executable file

Binary file not shown.

View File

@ -17,8 +17,8 @@ void operator delete(void *p)
#ifdef _WIN32
#define EXPORT extern "C" __declspec(dllexport)
#elif __linux__
#define EXPORT extern "C"
#else
#define EXPORT extern "C" __attribute__((visibility("default")))
#endif
EXPORT CSystem *Create(const uint8 *game, uint32 gamesize, const uint8 *bios, uint32 biossize, int pagesize0, int pagesize1, int lowpass)

View File

@ -11,7 +11,7 @@ else
$(error Unknown arch)
endif
CXXFLAGS = -Wall -Wno-parentheses -I.. -O3 -std=gnu++11 -fomit-frame-pointer -fno-exceptions -flto -fPIC
CXXFLAGS = -Wall -Wno-parentheses -I.. -O3 -std=gnu++11 -fomit-frame-pointer -fno-exceptions -flto -fPIC -fvisibility=internal
TARGET = bizlynx.dll
LDFLAGS_32 = -static -static-libgcc -static-libstdc++

View File

@ -1,50 +1,50 @@
using System;
using System.Runtime.InteropServices;
using BizHawk.BizInvoke;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Atari.Lynx
{
public static class LibLynx
public abstract class LibLynx
{
private const string dllname = "bizlynx.dll";
private const CallingConvention cc = CallingConvention.Cdecl;
[DllImport(dllname, CallingConvention = cc)]
public static extern IntPtr Create(byte[] game, int gamesize, byte[] bios, int biossize, int pagesize0, int pagesize1, bool lowpass);
[BizImport(cc)]
public abstract IntPtr Create(byte[] game, int gamesize, byte[] bios, int biossize, int pagesize0, int pagesize1, bool lowpass);
[DllImport(dllname, CallingConvention = cc)]
public static extern void Destroy(IntPtr s);
[BizImport(cc)]
public abstract void Destroy(IntPtr s);
[DllImport(dllname, CallingConvention = cc)]
public static extern void Reset(IntPtr s);
[BizImport(cc)]
public abstract void Reset(IntPtr s);
[DllImport(dllname, CallingConvention = cc)]
public static extern bool Advance(IntPtr s, Buttons buttons, int[] vbuff, short[] sbuff, ref int sbuffsize);
[BizImport(cc)]
public abstract bool Advance(IntPtr s, Buttons buttons, int[] vbuff, short[] sbuff, ref int sbuffsize);
[DllImport(dllname, CallingConvention = cc)]
public static extern void SetRotation(IntPtr s, int value);
[BizImport(cc)]
public abstract void SetRotation(IntPtr s, int value);
[DllImport(dllname, CallingConvention = cc)]
public static extern bool GetSaveRamPtr(IntPtr s, out int size, out IntPtr data);
[BizImport(cc)]
public abstract bool GetSaveRamPtr(IntPtr s, out int size, out IntPtr data);
[DllImport(dllname, CallingConvention = cc)]
public static extern void GetReadOnlyCartPtrs(IntPtr s, out int s0, out IntPtr p0, out int s1, out IntPtr p1);
[BizImport(cc)]
public abstract void GetReadOnlyCartPtrs(IntPtr s, out int s0, out IntPtr p0, out int s1, out IntPtr p1);
[DllImport(dllname, CallingConvention = cc)]
public static extern int BinStateSize(IntPtr s);
[DllImport(dllname, CallingConvention = cc)]
public static extern bool BinStateSave(IntPtr s, byte[] data, int length);
[DllImport(dllname, CallingConvention = cc)]
public static extern bool BinStateLoad(IntPtr s, byte[] data, int length);
[DllImport(dllname, CallingConvention = cc)]
public static extern void TxtStateSave(IntPtr s, [In]ref TextStateFPtrs ff);
[DllImport(dllname, CallingConvention = cc)]
public static extern void TxtStateLoad(IntPtr s, [In]ref TextStateFPtrs ff);
[BizImport(cc)]
public abstract int BinStateSize(IntPtr s);
[BizImport(cc)]
public abstract bool BinStateSave(IntPtr s, byte[] data, int length);
[BizImport(cc)]
public abstract bool BinStateLoad(IntPtr s, byte[] data, int length);
[BizImport(cc)]
public abstract void TxtStateSave(IntPtr s, [In]ref TextStateFPtrs ff);
[BizImport(cc)]
public abstract void TxtStateLoad(IntPtr s, [In]ref TextStateFPtrs ff);
[DllImport(dllname, CallingConvention = cc)]
public static extern IntPtr GetRamPointer(IntPtr s);
[BizImport(cc)]
public abstract IntPtr GetRamPointer(IntPtr s);
[Flags]
public enum Buttons : ushort

View File

@ -2,6 +2,8 @@
using System.Text;
using System.IO;
using BizHawk.BizInvoke;
using BizHawk.Common;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
@ -11,6 +13,15 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
[ServiceNotApplicable(new[] { typeof(IDriveLight), typeof(IRegionable), typeof(ISettable<,>) })]
public partial class Lynx : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IInputPollable
{
private static readonly LibLynx LibLynx;
static Lynx()
{
var resolver = new DynamicLibraryImportResolver(
OSTailoredCode.IsUnixHost ? "libbizlynx.dll.so" : "bizlynx.dll", hasLimitedLifetime: false);
LibLynx = BizInvoker.GetInvoker<LibLynx>(resolver, CallingConventionAdapters.Native);
}
[CoreConstructor(VSystemID.Raw.Lynx)]
public Lynx(byte[] file, GameInfo game, CoreComm comm)
{