From 3e843b2b0fe479860a49668f597e484a9c7bf79e Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 10 May 2014 16:05:56 +0000 Subject: [PATCH] N64 - Expose the setting of core type (pure interpreter, interpreter, dynarec) through sync settings. Still todo: UI for setting this value --- .../Consoles/Nintendo/N64/N64.cs | 3 ++- .../Consoles/Nintendo/N64/N64SyncSettings.cs | 14 ++++++++++++++ .../Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs index 98fefc2484..1da96d1394 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.cs @@ -420,12 +420,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 StartThreadLoop(); var videosettings = this.SyncSettings.GetVPS(game); + var coreType = this.SyncSettings.CoreType; //zero 19-apr-2014 - added this to solve problem with SDL initialization corrupting the main thread (I think) and breaking subsequent emulators (for example, NES) //not sure why this works... if we put the plugin initializations in here, we get deadlocks in some SDL initialization. doesnt make sense to me... RunThreadAction(() => { - api = new mupen64plusApi(this, rom, videosettings, SaveType); + api = new mupen64plusApi(this, rom, videosettings, SaveType, (int)coreType); }); // Order is important because the register with the mupen core diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.cs index d1d2fc96f7..dfe879f07e 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64SyncSettings.cs @@ -8,6 +8,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 { public class N64SyncSettings { + public CORETYPE CoreType = CORETYPE.Dynarec; + + public enum CORETYPE + { + [Description("Pure Interpreter")] + Pure_Interpret = 0, + + [Description("Interpreter")] + Interpret = 1, + + [Description("DynaRec")] + Dynarec = 2, + } + public PLUGINTYPE VidPlugin = PLUGINTYPE.RICE; public int VideoSizeX = 320; public int VideoSizeY = 240; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs index e405645457..819b01cacc 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/NativeAPI/mupen64plusCoreApi.cs @@ -337,7 +337,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi // DLL handles public IntPtr CoreDll { get; private set; } - public mupen64plusApi(N64 bizhawkCore, byte[] rom, VideoPluginSettings video_settings, int SaveType) + public mupen64plusApi(N64 bizhawkCore, byte[] rom, VideoPluginSettings video_settings, int SaveType, int CoreType) { // There can only be one core (otherwise breaks mupen64plus) if (AttachedCore != null) @@ -365,6 +365,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi m64pConfigSetParameter(core_section, "SaveType", m64p_type.M64TYPE_INT, ref SaveType); } + IntPtr coreSection = IntPtr.Zero; + m64pConfigOpenSection("Core", ref coreSection); + m64pConfigSetParameter(coreSection, "R4300Emulator", m64p_type.M64TYPE_INT, ref CoreType); + // Pass the rom to the core result = m64pCoreDoCommandByteArray(m64p_command.M64CMD_ROM_OPEN, rom.Length, rom);