diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.cpp index 6d7f3e0765..20490f12c0 100644 --- a/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/GUI/ConfigDlg.cpp @@ -72,7 +72,8 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer, hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name), wxDefaultPosition, wxDefaultSize), 0, wxALIGN_CENTER_VERTICAL|wxALL); - EventHandler::SFKeyToString(pad[controller].keyForControl[ctl], keyStr); + ((EventHandler *)globals->eventHandler)->SFKeyToString + (pad[controller].keyForControl[ctl], keyStr); *button = new wxButton(pan, ctl, wxString::FromAscii(keyStr), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); @@ -189,11 +190,11 @@ void ConfigDialog::OnClose(wxCloseEvent& event) { void ConfigDialog::OnKeyDown(wxKeyEvent& event) { if(clickedButton != NULL) { int page = m_Notebook->GetSelection(); - + static EventHandler *eventHandler = (EventHandler *)globals->eventHandler; fprintf(stderr, "Got key code %d\n",event.GetKeyCode()); - sf::Key::Code sfcode = EventHandler::wxCharCodeToSF(event.GetKeyCode()); + sf::Key::Code sfcode = eventHandler->wxCharCodeToSF(event.GetKeyCode()); char sfstr[100]; - EventHandler::SFKeyToString(sfcode, sfstr); + eventHandler->SFKeyToString(sfcode, sfstr); // pad[page].keyForControl[clickedButton->GetId()] = sfcode; if (registerKey(page, clickedButton->GetId(), sfcode)) diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp index 5acdff1e8a..ddb3f552d1 100644 --- a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp +++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp @@ -19,7 +19,7 @@ #include #include "Common.h" -#include "pluginspecs_pad.h" + #include "PadSimple.h" #include "IniFile.h" @@ -54,6 +54,8 @@ static const char* controlNames[] = "Mic-button", }; +PLUGIN_GLOBALS* globals; + SPads pad[4]; bool KeyStatus[NUMCONTROLS]; @@ -64,6 +66,11 @@ SPADInitialize g_PADInitialize; SPADStatus recordBuffer[RECORD_SIZE]; int count = 0; +// TODO: fix this dirty hack to stop missing symbols +void __Log(int log, const char *format, ...) {} +void __Logv(int log, int v, const char *format, ...) {} + + void RecordInput(const SPADStatus& _rPADStatus) { if (count >= RECORD_SIZE) @@ -82,14 +89,10 @@ const SPADStatus& PlayRecord() return(recordBuffer[count++]); } -// TODO: fix this dirty hack to stop missing symbols -void __Log(int log, const char *format, ...) {} -void __Logv(int log, int v, const char *format, ...) {} - bool registerKey(int nPad, int id, sf::Key::Code code, int mods) { Keys key, oldKey; - static EventHandler *eventHandler = EventHandler::GetInstance(); + static EventHandler *eventHandler = (EventHandler *)globals->eventHandler; key.inputType = KeyboardInput; key.keyCode = code; @@ -102,7 +105,7 @@ bool registerKey(int nPad, int id, sf::Key::Code code, int mods) { if (!eventHandler->RegisterEventListener(ParseKeyEvent, key)) { char codestr[100]; - EventHandler::SFKeyToString(code, codestr); + eventHandler->SFKeyToString(code, codestr); PanicAlert("Failed to register %s, might be already in use", codestr); return false; } @@ -165,27 +168,27 @@ IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle - DWORD dwReason, // reason called - LPVOID lpvReserved) // reserved + DWORD dwReason, // reason called + LPVOID lpvReserved) // reserved { - switch (dwReason) + switch (dwReason) { case DLL_PROCESS_ATTACH: - { //use wxInitialize() if you don't want GUI instead of the following 12 lines - wxSetInstance((HINSTANCE)hinstDLL); - int argc = 0; - char **argv = NULL; - wxEntryStart(argc, argv); - if ( !wxTheApp || !wxTheApp->CallOnInit() ) - return FALSE; - } - break; - + { //use wxInitialize() if you don't want GUI instead of the following 12 lines + wxSetInstance((HINSTANCE)hinstDLL); + int argc = 0; + char **argv = NULL; + wxEntryStart(argc, argv); + if ( !wxTheApp || !wxTheApp->CallOnInit() ) + return FALSE; + } + break; + case DLL_PROCESS_DETACH: - wxEntryCleanup(); //use wxUninitialize() if you don't want GUI - break; + wxEntryCleanup(); //use wxUninitialize() if you don't want GUI + break; default: - break; + break; } g_hInstance = hinstDLL; @@ -211,6 +214,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) } void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { + globals = _pPluginGlobals; } void DllConfig(HWND _hParent) diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.h b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.h index a9d7cc22c1..1ba66ce5fb 100644 --- a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.h +++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.h @@ -19,6 +19,8 @@ #define __PADSIMPLE_H__ #include "InputCommon.h" +#include "pluginspecs_pad.h" + #define EPAD_CONFIG_FILE "epad.ini" // Controls enum @@ -56,6 +58,7 @@ struct SPads { }; extern SPads pad[]; +extern PLUGIN_GLOBALS* globals; void LoadConfig(); void SaveConfig(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h index e81905c407..9cbcbd7830 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h @@ -20,11 +20,13 @@ #ifndef _GLOBALS_H #define _GLOBALS_H -// #define LOGGING - #include "Common.h" #include "Config.h" #include "VideoCommon.h" +#include "pluginspecs_video.h" + +extern PLUGIN_GLOBALS* globals; + #endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp index ff7f8c97c5..3275c148d3 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp @@ -1,6 +1,6 @@ #include "X11Window.h" -static EventHandler *eventHandler = EventHandler::GetInstance(); +static EventHandler *eventHandler = (EventHandler *)globals->eventHandler; X11Window::X11Window() : GLWindow() { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 51f75974db..5ef319f80c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -49,7 +49,7 @@ #include "VideoState.h" SVideoInitialize g_VideoInitialize; - +PLUGIN_GLOBALS* globals; /* Create debugging window. There's currently a strange crash that occurs whe a game is loaded if the OpenGL plugin was loaded before. I'll try to fix that. Currently you may have to diff --git a/Source/Plugins/Plugin_VideoOGL/Src/nmain.cpp b/Source/Plugins/Plugin_VideoOGL/Src/nmain.cpp index 6994a86bf2..962edda0ad 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/nmain.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/nmain.cpp @@ -22,11 +22,6 @@ #include "Debugger/Debugger.h" // for the CDebugger class #endif -#if defined(HAVE_WX) && HAVE_WX -#include "GUI/ConfigDlg.h" -#include "Debugger/Debugger.h" // for the CDebugger class -#endif - #include "Config.h" #include "LookUpTables.h" #include "ImageWrite.h" @@ -50,7 +45,7 @@ #include "VideoState.h" SVideoInitialize g_VideoInitialize; - +PLUGIN_GLOBALS* globals; /* Create debugging window. There's currently a strange crash that occurs whe a game is loaded if the OpenGL plugin was loaded before. I'll try to fix that. Currently you may have to @@ -102,7 +97,7 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo) } void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { - + globals = _pPluginGlobals; } void DllConfig(HWND _hParent)