use globals for event handler
now I just need to set it somewhere... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1830 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e94ba056b6
commit
f705cfc49f
|
@ -72,7 +72,8 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
|
||||||
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
|
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
|
||||||
wxDefaultPosition, wxDefaultSize), 0,
|
wxDefaultPosition, wxDefaultSize), 0,
|
||||||
wxALIGN_CENTER_VERTICAL|wxALL);
|
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),
|
*button = new wxButton(pan, ctl, wxString::FromAscii(keyStr),
|
||||||
wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
|
wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
|
||||||
|
@ -189,11 +190,11 @@ void ConfigDialog::OnClose(wxCloseEvent& event) {
|
||||||
void ConfigDialog::OnKeyDown(wxKeyEvent& event) {
|
void ConfigDialog::OnKeyDown(wxKeyEvent& event) {
|
||||||
if(clickedButton != NULL) {
|
if(clickedButton != NULL) {
|
||||||
int page = m_Notebook->GetSelection();
|
int page = m_Notebook->GetSelection();
|
||||||
|
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
|
||||||
fprintf(stderr, "Got key code %d\n",event.GetKeyCode());
|
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];
|
char sfstr[100];
|
||||||
EventHandler::SFKeyToString(sfcode, sfstr);
|
eventHandler->SFKeyToString(sfcode, sfstr);
|
||||||
|
|
||||||
// pad[page].keyForControl[clickedButton->GetId()] = sfcode;
|
// pad[page].keyForControl[clickedButton->GetId()] = sfcode;
|
||||||
if (registerKey(page, clickedButton->GetId(), sfcode))
|
if (registerKey(page, clickedButton->GetId(), sfcode))
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "pluginspecs_pad.h"
|
|
||||||
#include "PadSimple.h"
|
#include "PadSimple.h"
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ static const char* controlNames[] =
|
||||||
"Mic-button",
|
"Mic-button",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PLUGIN_GLOBALS* globals;
|
||||||
|
|
||||||
SPads pad[4];
|
SPads pad[4];
|
||||||
bool KeyStatus[NUMCONTROLS];
|
bool KeyStatus[NUMCONTROLS];
|
||||||
|
|
||||||
|
@ -64,6 +66,11 @@ SPADInitialize g_PADInitialize;
|
||||||
SPADStatus recordBuffer[RECORD_SIZE];
|
SPADStatus recordBuffer[RECORD_SIZE];
|
||||||
int count = 0;
|
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)
|
void RecordInput(const SPADStatus& _rPADStatus)
|
||||||
{
|
{
|
||||||
if (count >= RECORD_SIZE)
|
if (count >= RECORD_SIZE)
|
||||||
|
@ -82,14 +89,10 @@ const SPADStatus& PlayRecord()
|
||||||
return(recordBuffer[count++]);
|
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) {
|
bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
|
||||||
|
|
||||||
Keys key, oldKey;
|
Keys key, oldKey;
|
||||||
static EventHandler *eventHandler = EventHandler::GetInstance();
|
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
|
||||||
|
|
||||||
key.inputType = KeyboardInput;
|
key.inputType = KeyboardInput;
|
||||||
key.keyCode = code;
|
key.keyCode = code;
|
||||||
|
@ -102,7 +105,7 @@ bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
|
||||||
|
|
||||||
if (!eventHandler->RegisterEventListener(ParseKeyEvent, key)) {
|
if (!eventHandler->RegisterEventListener(ParseKeyEvent, key)) {
|
||||||
char codestr[100];
|
char codestr[100];
|
||||||
EventHandler::SFKeyToString(code, codestr);
|
eventHandler->SFKeyToString(code, codestr);
|
||||||
PanicAlert("Failed to register %s, might be already in use", codestr);
|
PanicAlert("Failed to register %s, might be already in use", codestr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -165,27 +168,27 @@ IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||||
|
|
||||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||||
DWORD dwReason, // reason called
|
DWORD dwReason, // reason called
|
||||||
LPVOID lpvReserved) // reserved
|
LPVOID lpvReserved) // reserved
|
||||||
{
|
{
|
||||||
switch (dwReason)
|
switch (dwReason)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
{ //use wxInitialize() if you don't want GUI instead of the following 12 lines
|
{ //use wxInitialize() if you don't want GUI instead of the following 12 lines
|
||||||
wxSetInstance((HINSTANCE)hinstDLL);
|
wxSetInstance((HINSTANCE)hinstDLL);
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
char **argv = NULL;
|
char **argv = NULL;
|
||||||
wxEntryStart(argc, argv);
|
wxEntryStart(argc, argv);
|
||||||
if ( !wxTheApp || !wxTheApp->CallOnInit() )
|
if ( !wxTheApp || !wxTheApp->CallOnInit() )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
|
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hInstance = hinstDLL;
|
g_hInstance = hinstDLL;
|
||||||
|
@ -211,6 +214,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||||
|
globals = _pPluginGlobals;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DllConfig(HWND _hParent)
|
void DllConfig(HWND _hParent)
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#define __PADSIMPLE_H__
|
#define __PADSIMPLE_H__
|
||||||
|
|
||||||
#include "InputCommon.h"
|
#include "InputCommon.h"
|
||||||
|
#include "pluginspecs_pad.h"
|
||||||
|
|
||||||
#define EPAD_CONFIG_FILE "epad.ini"
|
#define EPAD_CONFIG_FILE "epad.ini"
|
||||||
// Controls
|
// Controls
|
||||||
enum
|
enum
|
||||||
|
@ -56,6 +58,7 @@ struct SPads {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SPads pad[];
|
extern SPads pad[];
|
||||||
|
extern PLUGIN_GLOBALS* globals;
|
||||||
|
|
||||||
void LoadConfig();
|
void LoadConfig();
|
||||||
void SaveConfig();
|
void SaveConfig();
|
||||||
|
|
|
@ -20,11 +20,13 @@
|
||||||
#ifndef _GLOBALS_H
|
#ifndef _GLOBALS_H
|
||||||
#define _GLOBALS_H
|
#define _GLOBALS_H
|
||||||
|
|
||||||
// #define LOGGING
|
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#include "VideoCommon.h"
|
#include "VideoCommon.h"
|
||||||
|
#include "pluginspecs_video.h"
|
||||||
|
|
||||||
|
extern PLUGIN_GLOBALS* globals;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "X11Window.h"
|
#include "X11Window.h"
|
||||||
|
|
||||||
static EventHandler *eventHandler = EventHandler::GetInstance();
|
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
|
||||||
|
|
||||||
X11Window::X11Window() : GLWindow() {
|
X11Window::X11Window() : GLWindow() {
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#include "VideoState.h"
|
#include "VideoState.h"
|
||||||
|
|
||||||
SVideoInitialize g_VideoInitialize;
|
SVideoInitialize g_VideoInitialize;
|
||||||
|
PLUGIN_GLOBALS* globals;
|
||||||
|
|
||||||
/* Create debugging window. There's currently a strange crash that occurs whe a game is loaded
|
/* 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
|
if the OpenGL plugin was loaded before. I'll try to fix that. Currently you may have to
|
||||||
|
|
|
@ -22,11 +22,6 @@
|
||||||
#include "Debugger/Debugger.h" // for the CDebugger class
|
#include "Debugger/Debugger.h" // for the CDebugger class
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
|
||||||
#include "GUI/ConfigDlg.h"
|
|
||||||
#include "Debugger/Debugger.h" // for the CDebugger class
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "LookUpTables.h"
|
#include "LookUpTables.h"
|
||||||
#include "ImageWrite.h"
|
#include "ImageWrite.h"
|
||||||
|
@ -50,7 +45,7 @@
|
||||||
#include "VideoState.h"
|
#include "VideoState.h"
|
||||||
|
|
||||||
SVideoInitialize g_VideoInitialize;
|
SVideoInitialize g_VideoInitialize;
|
||||||
|
PLUGIN_GLOBALS* globals;
|
||||||
|
|
||||||
/* Create debugging window. There's currently a strange crash that occurs whe a game is loaded
|
/* 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
|
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) {
|
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||||
|
globals = _pPluginGlobals;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DllConfig(HWND _hParent)
|
void DllConfig(HWND _hParent)
|
||||||
|
|
Loading…
Reference in New Issue