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),
|
||||
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))
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <math.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
@ -211,6 +214,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
|||
}
|
||||
|
||||
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
|
||||
globals = _pPluginGlobals;
|
||||
}
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "X11Window.h"
|
||||
|
||||
static EventHandler *eventHandler = EventHandler::GetInstance();
|
||||
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
|
||||
|
||||
X11Window::X11Window() : GLWindow() {
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue