/// <summary> /// Look up function pointers in the dlls /// </summary> void connectFunctionPointers() { m64pCoreStartup = (CoreStartup)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreStartup"), typeof(CoreStartup)); m64pCoreShutdown = (CoreShutdown)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreShutdown"), typeof(CoreShutdown)); m64pCoreDoCommandByteArray = (CoreDoCommandByteArray)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandByteArray)); m64pCoreDoCommandPtr = (CoreDoCommandPtr)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandPtr)); m64pCoreDoCommandRefInt = (CoreDoCommandRefInt)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandRefInt)); m64pCoreDoCommandFrameCallback = (CoreDoCommandFrameCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandFrameCallback)); m64pCoreDoCommandVICallback = (CoreDoCommandVICallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandVICallback)); m64pCoreDoCommandRenderCallback = (CoreDoCommandRenderCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandRenderCallback)); m64pCoreAttachPlugin = (CoreAttachPlugin)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreAttachPlugin"), typeof(CoreAttachPlugin)); m64pCoreDetachPlugin = (CoreDetachPlugin)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDetachPlugin"), typeof(CoreDetachPlugin)); m64pConfigOpenSection = (ConfigOpenSection)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigOpenSection"), typeof(ConfigOpenSection)); m64pConfigSetParameter = (ConfigSetParameter)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigSetParameter"), typeof(ConfigSetParameter)); m64pConfigSetParameterStr = (ConfigSetParameterStr)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigSetParameter"), typeof(ConfigSetParameterStr)); m64pCoreSaveState = (savestates_save_bkm)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "savestates_save_bkm"), typeof(savestates_save_bkm)); m64pCoreLoadState = (savestates_load_bkm)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "savestates_load_bkm"), typeof(savestates_load_bkm)); m64pDebugMemGetPointer = (DebugMemGetPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "DebugMemGetPointer"), typeof(DebugMemGetPointer)); m64pMemGetSize = (MemGetSize)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "MemGetSize"), typeof(MemGetSize)); m64pinit_saveram = (init_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "init_saveram"), typeof(init_saveram)); m64psave_saveram = (save_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "save_saveram"), typeof(save_saveram)); m64pload_saveram = (load_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "load_saveram"), typeof(load_saveram)); m64pSetReadCallback = (SetReadCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "SetReadCallback"), typeof(SetReadCallback)); m64pSetWriteCallback = (SetWriteCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "SetWriteCallback"), typeof(SetWriteCallback)); m64pSetExecuteCallback = (SetExecuteCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "SetExecuteCallback"), typeof(SetExecuteCallback)); m64pSetTraceCallback = (SetTraceCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "SetTraceCallback"), typeof(SetTraceCallback)); m64pGetRegisters = (GetRegisters)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "GetRegisters"), typeof(GetRegisters)); m64p_read_memory_8 = (biz_read_memory)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_read_memory"), typeof(biz_read_memory)); m64p_write_memory_8 = (biz_write_memory)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_write_memory"), typeof(biz_write_memory)); m64p_decode_op = (biz_r4300_decode_op)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_r4300_decode_op"), typeof(biz_r4300_decode_op)); }
/// <summary> /// Look up function pointers in the dlls /// </summary> private void connectFunctionPointers() { T GetCoreDelegate <T>(string proc) where T : Delegate => (T)Marshal.GetDelegateForFunctionPointer(Library.GetProcAddrOrThrow(proc), typeof(T)); m64pCoreStartup = GetCoreDelegate <CoreStartup>("CoreStartup"); m64pCoreShutdown = GetCoreDelegate <CoreShutdown>("CoreShutdown"); m64pCoreDoCommandByteArray = GetCoreDelegate <CoreDoCommandByteArray>("CoreDoCommand"); m64pCoreDoCommandPtr = GetCoreDelegate <CoreDoCommandPtr>("CoreDoCommand"); m64pCoreDoCommandRefInt = GetCoreDelegate <CoreDoCommandRefInt>("CoreDoCommand"); m64pCoreDoCommandFrameCallback = GetCoreDelegate <CoreDoCommandFrameCallback>("CoreDoCommand"); m64pCoreDoCommandVICallback = GetCoreDelegate <CoreDoCommandVICallback>("CoreDoCommand"); m64pCoreDoCommandRenderCallback = GetCoreDelegate <CoreDoCommandRenderCallback>("CoreDoCommand"); m64pCoreAttachPlugin = GetCoreDelegate <CoreAttachPlugin>("CoreAttachPlugin"); m64pCoreDetachPlugin = GetCoreDelegate <CoreDetachPlugin>("CoreDetachPlugin"); m64pConfigOpenSection = GetCoreDelegate <ConfigOpenSection>("ConfigOpenSection"); m64pConfigSetParameter = GetCoreDelegate <ConfigSetParameter>("ConfigSetParameter"); m64pConfigSetParameterStr = GetCoreDelegate <ConfigSetParameterStr>("ConfigSetParameter"); m64pCoreSaveState = GetCoreDelegate <savestates_save_bkm>("savestates_save_bkm"); m64pCoreLoadState = GetCoreDelegate <savestates_load_bkm>("savestates_load_bkm"); m64pDebugMemGetPointer = GetCoreDelegate <DebugMemGetPointer>("DebugMemGetPointer"); m64pDebugSetCallbacks = GetCoreDelegate <DebugSetCallbacks>("DebugSetCallbacks"); m64pDebugBreakpointLookup = GetCoreDelegate <DebugBreakpointLookup>("DebugBreakpointLookup"); m64pDebugBreakpointCommand = GetCoreDelegate <DebugBreakpointCommand>("DebugBreakpointCommand"); m64pDebugGetState = GetCoreDelegate <DebugGetState>("DebugGetState"); m64pDebugSetRunState = GetCoreDelegate <DebugSetRunState>("DebugSetRunState"); m64pDebugStep = GetCoreDelegate <DebugStep>("DebugStep"); m64pMemGetSize = GetCoreDelegate <MemGetSize>("MemGetSize"); m64pinit_saveram = GetCoreDelegate <init_saveram>("init_saveram"); m64psave_saveram = GetCoreDelegate <save_saveram>("save_saveram"); m64pload_saveram = GetCoreDelegate <load_saveram>("load_saveram"); m64pSetTraceCallback = GetCoreDelegate <SetTraceCallback>("SetTraceCallback"); m64pGetRegisters = GetCoreDelegate <GetRegisters>("GetRegisters"); m64p_read_memory_8 = GetCoreDelegate <biz_read_memory>("biz_read_memory"); m64p_write_memory_8 = GetCoreDelegate <biz_write_memory>("biz_write_memory"); m64p_decode_op = GetCoreDelegate <biz_r4300_decode_op>("biz_r4300_decode_op"); }