From e11c0b2c22194b18210e90e60b9fd48fe86d93c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Nov 2015 22:26:59 -0500 Subject: [PATCH] [Plugin Specs] reverted contr 1.1 for backward-compatibility No plugins for Windows (that can run on Project64) currently use the 1.1 controller plugin specifications, and the ones that do use it (for Linux) use the publicly released spec which did not have the pointer version in the late-modified spec. We don't want to let plugin wars roam between the emulators' implementations. --- .../Project64/Plugins/Controller Plugin.cpp | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Source/Project64/Plugins/Controller Plugin.cpp b/Source/Project64/Plugins/Controller Plugin.cpp index 3db3ae50d..a0a908ebe 100644 --- a/Source/Project64/Plugins/Controller Plugin.cpp +++ b/Source/Project64/Plugins/Controller Plugin.cpp @@ -60,6 +60,9 @@ bool CControl_Plugin::LoadFunctions(void) bool CControl_Plugin::Initiate(CN64System * System, CMainGui * RenderWindow) { + CONTROL_INFO ControlInfo; + uint8_t Buffer[100]; + for (int32_t i = 0; i < 4; i++) { m_PluginControllers[i].Present = FALSE; @@ -67,6 +70,15 @@ bool CControl_Plugin::Initiate(CN64System * System, CMainGui * RenderWindow) m_PluginControllers[i].Plugin = PLUGIN_NONE; } + if (m_PluginInfo.Version >= 0x0101) + { + ControlInfo.Controls = m_PluginControllers; + ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress()); + ControlInfo.hinst = GetModuleHandle(NULL); + ControlInfo.hMainWindow = (HWND)RenderWindow->m_hMainWindow; + ControlInfo.MemoryBswaped = TRUE; + } + // Test Plugin version if (m_PluginInfo.Version == 0x0100) { @@ -74,26 +86,28 @@ bool CControl_Plugin::Initiate(CN64System * System, CMainGui * RenderWindow) void(__cdecl *InitiateControllers_1_0)(HWND hMainWindow, CONTROL Controls[4]); InitiateControllers_1_0 = (void(__cdecl *)(HWND, CONTROL *))GetProcAddress((HMODULE)m_hDll, "InitiateControllers"); if (InitiateControllers_1_0 == NULL) { return false; } - InitiateControllers_1_0((HWND)RenderWindow->m_hMainWindow,m_PluginControllers); + + InitiateControllers_1_0((HWND)RenderWindow->m_hMainWindow, m_PluginControllers); m_Initialized = true; } - else if (m_PluginInfo.Version >= 0x0101) + else if (m_PluginInfo.Version == 0x0101) { //Get Function from DLL - void(__cdecl *InitiateControllers_1_1)(CONTROL_INFO * ControlInfo); - InitiateControllers_1_1 = (void(__cdecl *)(CONTROL_INFO *))GetProcAddress((HMODULE)m_hDll, "InitiateControllers"); + void(__cdecl *InitiateControllers_1_1)(CONTROL_INFO ControlInfo); + InitiateControllers_1_1 = (void(__cdecl *)(CONTROL_INFO))GetProcAddress((HMODULE)m_hDll, "InitiateControllers"); if (InitiateControllers_1_1 == NULL) { return false; } - CONTROL_INFO ControlInfo; - uint8_t Buffer[100]; + InitiateControllers_1_1(ControlInfo); + m_Initialized = true; + } + else if (m_PluginInfo.Version >= 0x0102) + { + //Get Function from DLL + void(__cdecl *InitiateControllers_1_2)(CONTROL_INFO * ControlInfo); + InitiateControllers_1_2 = (void(__cdecl *)(CONTROL_INFO *))GetProcAddress((HMODULE)m_hDll, "InitiateControllers"); + if (InitiateControllers_1_2 == NULL) { return false; } - ControlInfo.Controls = m_PluginControllers; - ControlInfo.HEADER = (System == NULL ? Buffer : g_Rom->GetRomAddress()); - ControlInfo.hinst = GetModuleHandle(NULL); - ControlInfo.hMainWindow = (HWND)RenderWindow->m_hMainWindow; - ControlInfo.MemoryBswaped = TRUE; - - InitiateControllers_1_1(&ControlInfo); + InitiateControllers_1_2(&ControlInfo); m_Initialized = true; }