nakee's work on dolphin events. Also get wxw out of logmanager. This commit wants your comments

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1875 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2009-01-15 06:48:15 +00:00
parent aced3c00fd
commit ba8c2aa7e4
83 changed files with 1293 additions and 1657 deletions

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
import sys

View File

@ -85,7 +85,7 @@ class wxDLLApp : public wxApp
}
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
///////////////////
#endif
@ -163,7 +163,7 @@ void DllDebugger(HWND _hParent, bool Show)
{
m_frame->DoShow();
}
else if(!m_frame && Show)
else if(!m_frame && Show)
{
m_frame = new CDebugger(NULL);
m_frame->Show();
@ -181,7 +181,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast) ");
#else
#ifndef _DEBUG
@ -203,18 +203,18 @@ void DllConfig(HWND _hParent)
#endif
}
void DSP_Initialize(DSPInitialize _dspInitialize)
void Initialize(void *init)
{
g_Config.LoadDefaults();
g_Config.Load();
g_dspInitialize = _dspInitialize;
g_dspInitialize = *(DSPInitialize*)init;
g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
#if defined(_DEBUG) || defined(DEBUGFAST)
gpName = g_dspInitialize.pName(); // save the game name globally
for (int i = 0; i < gpName.length(); ++i) // and fix it
for (u32 i = 0; i < gpName.length(); ++i) // and fix it
{
wprintf(L"%c", gpName[i]);
std::cout << gpName[i];
@ -242,7 +242,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
#endif
}
void DSP_Shutdown()
void Shutdown()
{
if (log_ai)
g_wave_writer.Stop();
@ -266,7 +266,7 @@ void DSP_Shutdown()
#endif
}
void DSP_DoState(unsigned char **ptr, int mode) {
void DoState(unsigned char **ptr, int mode) {
PointerWrap p(ptr, mode);
}

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
import sys

View File

@ -99,7 +99,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (DebugFast)");
#else
#ifndef _DEBUG
@ -121,7 +121,7 @@ void DllConfig(HWND _hParent)
{}
void DSP_DoState(unsigned char **ptr, int mode) {
void DoState(unsigned char **ptr, int mode) {
PointerWrap p(ptr, mode);
}
@ -196,7 +196,7 @@ void* dsp_thread_debug(void* lpParameter)
Sleep(100);
}
}
#endif
#endif
return NULL;
}
// ==============
@ -217,11 +217,10 @@ void dspi_req_dsp_irq()
g_dspInitialize.pGenerateDSPInterrupt();
}
void DSP_Initialize(DSPInitialize _dspInitialize)
void Initialize(void *init)
{
bCanWork = true;
g_dspInitialize = _dspInitialize;
g_dspInitialize = *(DSPInitialize*)init;
gdsp_init();
g_dsp.step_counter = 0;
@ -247,7 +246,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
return; // TODO: Don't let it work
// ---------------------------------------------------------------------------------------
// First create DSP_UCode.bin by setting "#define DUMP_DSP_IMEM 1" in Globals.h. Then
// First create DSP_UCode.bin by setting "#define DUMP_DSP_IMEM 1" in Globals.h. Then
// make the disassembled file here.
// --------------
// Dump UCode to file...
@ -289,7 +288,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
}
void DSP_Shutdown(void)
void Shutdown(void)
{
if (log_ai)
g_wave_writer.Stop();

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
import sys

View File

@ -79,7 +79,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin (DebugFast) ");
#else
#ifndef _DEBUG
@ -101,22 +101,22 @@ void DllConfig(HWND _hParent)
{
}
void DSP_Initialize(DSPInitialize _dspInitialize)
void Initialize(void *init)
{
g_dspInitialize = _dspInitialize;
g_dspInitialize = *(DSPInitialize*)init;
g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
CDSPHandler::CreateInstance();
}
void DSP_Shutdown()
void Shutdown()
{
CDSPHandler::Destroy();
}
void DSP_DoState(unsigned char **ptr, int mode) {
void DoState(unsigned char **ptr, int mode) {
PointerWrap p(ptr, mode);
}

View File

@ -131,10 +131,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
}
break;
break;
case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break;
default:
break;
@ -152,7 +152,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin KB/X360pad (DebugFast)");
#else
#ifndef _DEBUG
@ -189,25 +189,27 @@ void DllConfig(HWND _hParent)
void DllDebugger(HWND _hParent, bool Show) {
}
void PAD_Initialize(SPADInitialize _PADInitialize)
void Initialize(void *init)
{
#ifdef RECORD_REPLAY
LoadRecord();
#endif
g_PADInitialize = _PADInitialize;
g_PADInitialize = *(SPADInitialize*)init;
#ifdef _WIN32
dinput.Init((HWND)g_PADInitialize.hWnd);
#elif defined(HAVE_X11) && HAVE_X11
GXdsp = (Display*)g_PADInitialize.hWnd;
#elif defined(HAVE_COCOA) && HAVE_COCOA
#endif
LoadConfig();
}
void DoState(unsigned char **ptr, int mode) {
}
void PAD_Shutdown()
void Shutdown()
{
#ifdef RECORD_STORE
SaveRecord();
@ -267,7 +269,7 @@ void DInput_Read(int _numPAD, SPADStatus* _pPADStatus)
int stickvalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 40 : 100;
int triggervalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 100 : 255;
// get the new keys
if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= stickvalue;}
if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINRIGHT]] & 0xFF){_pPADStatus->stickX += stickvalue;}
@ -389,7 +391,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
key = XLookupKeysym((XKeyEvent*)&E, 0);
if((key >= XK_F1 && key <= XK_F9) ||
if((key >= XK_F1 && key <= XK_F9) ||
key == XK_Shift_L || key == XK_Shift_R ||
key == XK_Control_L || key == XK_Control_R) {
XPutBackEvent(GXdsp, &E);
@ -411,7 +413,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
key = XLookupKeysym((XKeyEvent*)&E, 0);
if((key >= XK_F1 && key <= XK_F9) ||
if((key >= XK_F1 && key <= XK_F9) ||
key == XK_Shift_L || key == XK_Shift_R ||
key == XK_Control_L || key == XK_Control_R) {
XPutBackEvent(GXdsp, &E);
@ -464,7 +466,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;}
if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;}
if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;}
if (KeyStatus[CTL_L]) {
_pPADStatus->button |= PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue;
@ -564,7 +566,7 @@ void cocoa_Read(int _numPAD, SPADStatus* _pPADStatus)
if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;}
if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;}
if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;}
if (KeyStatus[CTL_L]) {
_pPADStatus->button |= PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue;
@ -674,7 +676,7 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
unsigned int PAD_GetAttachedPads()
{
unsigned int connected = 0;
LoadConfig();
if(pad[0].bAttached)
@ -693,7 +695,7 @@ unsigned int PAD_GetAttachedPads()
void LoadConfig()
{
// Initialize first pad to standard controls
#ifdef _WIN32
#ifdef _WIN32
const int defaultKeyForControl[NUMCONTROLS] =
{
DIK_X, //A
@ -731,7 +733,7 @@ void LoadConfig()
XK_w,
XK_Up, //mainstick
XK_Down,
XK_Left,
XK_Left,
XK_Right,
XK_i, //substick
XK_K,
@ -785,12 +787,12 @@ void LoadConfig()
file.Get(SectionName, "Rumble", &pad[i].bRumble, true);
file.Get(SectionName, "XPad#", &pad[i].XPadPlayer);
for (int x = 0; x < NUMCONTROLS; x++)
for (int x = 0; x < NUMCONTROLS; x++)
{
file.Get(SectionName, controlNames[x], &pad[i].keyForControl[x],
file.Get(SectionName, controlNames[x], &pad[i].keyForControl[x],
(i==0)?defaultKeyForControl[x]:0);
#if defined(HAVE_X11) && HAVE_X11
// In linux we have a problem assigning the upper case of the
// In linux we have a problem assigning the upper case of the
// keys because they're not being recognized
pad[i].keyForControl[x] = tolower(pad[i].keyForControl[x]);
#endif

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
import sys
@ -10,10 +10,6 @@ if not env['HAVE_X11']:
print name + " must have X11 to be built"
Return()
if env['GLTEST']:
print name + " Doesn't work with testgl"
Return()
files = [
"PadSimple.cpp",
@ -28,12 +24,12 @@ if padenv['HAVE_COCOA']:
]
if padenv['HAVE_WX']:
files += [
files += [
"GUI/ConfigDlg.cpp",
]
if env['HAVE_X11']:
files += [
files += [
"XInputBase.cpp",
]

View File

@ -53,7 +53,7 @@
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../PluginSpecs;..\..\Core\InputCommon\Src;../../Core/Common/Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="0"
@ -155,7 +155,7 @@
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../PluginSpecs;..\..\Core\InputCommon\Src;../../Core/Common/Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
PreprocessorDefinitions="_SECURE_SCL=0;WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;__WXMSW__;NOPCH"
StringPooling="true"
RuntimeLibrary="0"
@ -254,7 +254,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../PluginSpecs;..\..\Core\InputCommon\Src;../../Core/Common/Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -352,7 +352,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../PluginSpecs;..\..\Core\InputCommon\Src;../../Core/Common/Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
PreprocessorDefinitions="_SECURE_SCL=0;WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -451,7 +451,7 @@
Name="VCCLCompilerTool"
Optimization="3"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../PluginSpecs;..\..\Core\InputCommon\Src;../../Core/Common/Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;DEBUGFAST;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="0"
@ -553,7 +553,7 @@
Optimization="3"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../PluginSpecs;..\..\Core\InputCommon\Src;../../Core/Common/Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc"
PreprocessorDefinitions="_SECURE_SCL=0;WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;DEBUGFAST"
StringPooling="true"
RuntimeLibrary="0"

View File

@ -24,7 +24,7 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE,ConfigDialog::OnCloseClick)
EVT_BUTTON(ID_PAD_ABOUT,ConfigDialog::DllAbout)
EVT_CHECKBOX(ID_ATTACHED,ConfigDialog::ControllerSettingsChanged)
EVT_CHECKBOX(ID_ATTACHED,ConfigDialog::ControllerSettingsChanged)
EVT_CHECKBOX(ID_X360PAD,ConfigDialog::ControllerSettingsChanged)
EVT_CHOICE(ID_X360PAD_CHOICE,ConfigDialog::ControllerSettingsChanged)
EVT_CHECKBOX(ID_RUMBLE,ConfigDialog::ControllerSettingsChanged)
@ -69,13 +69,13 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
wxBoxSizer *hButton = new wxBoxSizer(wxHORIZONTAL);
char keyStr[10] = {0};
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
wxDefaultPosition, wxDefaultSize), 0,
wxALIGN_CENTER_VERTICAL|wxALL);
((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);
hButton->Add(*button, 0, wxALIGN_RIGHT|wxALL);
@ -115,7 +115,7 @@ void ConfigDialog::CreateGUIControls() {
this->SetSizer(sMain);
this->Layout();
for(int i = 0; i < 4; i++) {
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
sDevice[i] = new wxBoxSizer(wxHORIZONTAL);
@ -123,51 +123,51 @@ void ConfigDialog::CreateGUIControls() {
m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Attached[i]->SetValue(pad[i].bAttached);
m_Disable[i]->SetValue(pad[i].bDisable);
sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
sDevice[i]->AddStretchSpacer();
sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
sButtons[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Buttons"));
AddControl(m_Controller[i], &(m_ButtonA[i]), sButtons[i], "A: ", CTL_A, i);
AddControl(m_Controller[i], &(m_ButtonB[i]), sButtons[i], "B: ", CTL_B, i);
AddControl(m_Controller[i], &(m_ButtonX[i]), sButtons[i], "X: ", CTL_X, i);
AddControl(m_Controller[i], &(m_ButtonY[i]), sButtons[i], "Y: ", CTL_Y, i);
AddControl(m_Controller[i], &(m_ButtonZ[i]), sButtons[i], "Z: ", CTL_Z, i);
AddControl(m_Controller[i], &(m_ButtonStart[i]), sButtons[i], "Start: ", CTL_START, i);
sTriggers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Triggers"));
AddControl(m_Controller[i], &(m_ButtonL[i]), sTriggers[i], " L: ", CTL_L, i);
AddControl(m_Controller[i], &(m_ButtonR[i]), sTriggers[i], " R: ", CTL_R, i);
sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers"));
AddControl(m_Controller[i], &(m_HalfPress[i]), sModifiers[i], "1/2 Press: ", CTL_HALFPRESS, i);
sStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Main Stick"));
AddControl(m_Controller[i], &(m_StickUp[i]), sStick[i], "Up: ", CTL_MAINUP, i);
AddControl(m_Controller[i], &(m_StickDown[i]), sStick[i], "Down: ", CTL_MAINDOWN, i);
AddControl(m_Controller[i], &(m_StickLeft[i]), sStick[i], "Left: ", CTL_MAINLEFT, i);
AddControl(m_Controller[i], &(m_StickRight[i]), sStick[i], "Right: ", CTL_MAINRIGHT, i);
sDPad[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("D-Pad"));
AddControl(m_Controller[i], &(m_DPadUp[i]), sDPad[i], "Up: ", CTL_DPADUP, i);
AddControl(m_Controller[i], &(m_DPadDown[i]), sDPad[i], "Down: ", CTL_DPADDOWN, i);
AddControl(m_Controller[i], &(m_DPadLeft[i]), sDPad[i], "Left: ", CTL_DPADLEFT, i);
AddControl(m_Controller[i], &(m_DPadRight[i]), sDPad[i], "Right: ", CTL_DPADRIGHT, i);
sCStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("C-Stick"));
AddControl(m_Controller[i], &(m_CStickUp[i]), sCStick[i], "Up: ", CTL_SUBUP, i);
AddControl(m_Controller[i], &(m_CStickDown[i]), sCStick[i], "Down: ", CTL_SUBDOWN, i);
AddControl(m_Controller[i], &(m_CStickLeft[i]), sCStick[i], "Left: ", CTL_SUBLEFT, i);
AddControl(m_Controller[i], &(m_CStickRight[i]), sCStick[i], "Right: ", CTL_SUBRIGHT, i);
sPage[i] = new wxGridBagSizer(0, 0);
sPage[i]->SetFlexibleDirection(wxBOTH);
sPage[i]->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
@ -190,13 +190,12 @@ 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());
EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
fprintf(stderr, "Got key code %d\n",event.GetKeyCode());
sf::Key::Code sfcode = eventHandler->wxCharCodeToSF(event.GetKeyCode());
char sfstr[100];
eventHandler->SFKeyToString(sfcode, sfstr);
// pad[page].keyForControl[clickedButton->GetId()] = sfcode;
if (registerKey(page, clickedButton->GetId(), sfcode))
clickedButton->SetLabel(wxString::FromAscii(sfstr));
clickedButton->Disconnect();

View File

@ -54,7 +54,7 @@ static const char* controlNames[] =
"Mic-button",
};
PLUGIN_GLOBALS* globals;
PLUGIN_GLOBALS* globals = NULL;
SPads pad[4];
bool KeyStatus[NUMCONTROLS];
@ -92,7 +92,7 @@ const SPADStatus& PlayRecord()
bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
Keys key, oldKey;
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
key.inputType = KeyboardInput;
key.keyCode = code;
@ -111,7 +111,7 @@ bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
}
// FIXME: unregister old event
// FIXME: unregister old event
// We need to handle mod change
// and double registers
if (pad[nPad].keyForControl[id] != 0) {
@ -120,9 +120,9 @@ bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
oldKey.keyCode = pad[nPad].keyForControl[id];
oldKey.mods = mods;
// Might be not be registered yet
// eventHandler->RemoveEventListener(oldKey);
// eventHandler->RemoveEventListener(oldKey);
}
pad[nPad].keyForControl[id] = code;
@ -182,10 +182,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
}
break;
break;
case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break;
default:
break;
@ -203,7 +203,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin event pad (DebugFast)");
#elif defined _DEBUG
sprintf(_PluginInfo->Name, "Dolphin event pad (Debug)");
@ -228,17 +228,20 @@ void DllConfig(HWND _hParent)
void DllDebugger(HWND _hParent, bool Show) {
}
void PAD_Initialize(SPADInitialize _PADInitialize)
void DoState(unsigned char **ptr, int mode) {
}
void Initialize(void *init)
{
#ifdef RECORD_REPLAY
LoadRecord();
#endif
g_PADInitialize = *(SPADInitialize*)init;
LoadConfig();
}
void PAD_Shutdown()
void Shutdown()
{
#ifdef RECORD_STORE
SaveRecord();
@ -318,7 +321,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;}
if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;}
if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;}
if (KeyStatus[CTL_L]) {
_pPADStatus->button |= PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue;
@ -348,7 +351,7 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength) {
unsigned int PAD_GetAttachedPads()
{
unsigned int connected = 0;
LoadConfig();
if(pad[0].bAttached)
@ -377,7 +380,7 @@ void LoadConfig()
sf::Key::W,
sf::Key::Up, //mainstick
sf::Key::Down,
sf::Key::Left,
sf::Key::Left,
sf::Key::Right,
sf::Key::I, //substick
sf::Key::K,

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
import sys
@ -15,7 +15,7 @@ files = [
padeenv = env.Clone()
if padeenv['HAVE_WX']:
files += [
files += [
"GUI/ConfigDlg.cpp",
]

View File

@ -143,11 +143,11 @@ void DeInit()
}
}
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 (DebugFast)");
#else
#ifndef _DEBUG
@ -161,7 +161,7 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
}
void DllAbout(HWND _hParent)
void DllAbout(HWND _hParent)
{
DialogBox(g_hInstance,(LPCSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc);
}
@ -175,11 +175,10 @@ void DllConfig(HWND _hParent)
}
}
void Video_Initialize(SVideoInitialize* _pVideoInitialize)
void Initialize(void *init)
{
if (_pVideoInitialize == NULL)
return;
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
frameCount = 0;
g_VideoInitialize = *_pVideoInitialize;
Init();
@ -191,7 +190,7 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
}
void Video_DoState(unsigned char **ptr, int mode) {
void DoState(unsigned char **ptr, int mode) {
// Clear all caches
TextureCache::Invalidate();
@ -219,7 +218,7 @@ void Video_Prepare(void)
OpcodeDecoder_Init();
}
void Video_Shutdown(void)
void Shutdown(void)
{
Fifo_Shutdown();
OpcodeDecoder_Shutdown();
@ -230,7 +229,7 @@ void Video_Shutdown(void)
DeInit();
}
void Video_Stop(void)
void Video_Stop(void)
{
}
@ -278,7 +277,7 @@ void __Log(int log, const char *format, ...)
}
HRESULT ScreenShot(TCHAR *File)
HRESULT ScreenShot(TCHAR *File)
{
if (D3D::dev == NULL)
return S_FALSE;
@ -293,13 +292,13 @@ HRESULT ScreenShot(TCHAR *File)
if (FAILED(D3D::dev->GetFrontBufferData(0, surf)))
{
surf->Release();
surf->Release();
return S_FALSE;
}
RECT rect;
::GetWindowRect(EmuWindow::GetWnd(), &rect);
if (FAILED(D3DXSaveSurfaceToFile(File, D3DXIFF_JPG, surf, NULL, &rect)))
if (FAILED(D3DXSaveSurfaceToFile(File, D3DXIFF_JPG, surf, NULL, &rect)))
{
surf->Release();
return S_FALSE;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="Plugin_VideoOGL"
ProjectGUID="{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}"
RootNamespace="Plugin_VideoOGL"
@ -165,7 +165,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="false"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../PluginSpecs;../../Core/Common/Src;../../Core/VideoCommon/Src;./Src;./Src/Windows;../../../Externals;..\..\..\Externals\libjpeg;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\Glew"
AdditionalIncludeDirectories="../../Core/InputCommon/Src;../../PluginSpecs;../../Core/Common/Src;../../Core/VideoCommon/Src;./Src;./Src/Windows;../../../Externals;..\..\..\Externals\libjpeg;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\Glew"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true"
ExceptionHandling="1"
@ -937,6 +937,10 @@
RelativePath=".\Src\GLUtil.h"
>
</File>
<File
RelativePath=".\Src\GLWindow.h"
>
</File>
<File
RelativePath=".\Src\main.cpp"
>

View File

@ -98,7 +98,7 @@ void OpenGL_SetSize(u32 width, u32 height) {
}
void OpenGL_SetWindowText(const char *text)
void OpenGL_SetWindowText(const char *text)
{
#if USE_SDL
SDL_WM_SetCaption(text, NULL);
@ -113,7 +113,7 @@ void OpenGL_SetWindowText(const char *text)
* Tell X to ask the window manager to set the window title. (X
* itself doesn't provide window title functionality.)
*/
XStoreName(GLWin.dpy, GLWin.win, text);
XStoreName(GLWin.dpy, GLWin.win, text);
#endif
}
@ -130,7 +130,7 @@ unsigned int Callback_PeekMessages()
DispatchMessage(&msg);
}
return TRUE;
#else
#else
return FALSE;
#endif
}
@ -147,7 +147,7 @@ void UpdateFPSDisplay(const char *text)
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
// ------------------
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
{
// --------------------------------------------
// Check for fullscreen mode
@ -238,12 +238,12 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
wxSize size(_iwidth, _iheight);
if (!g_Config.renderToMainframe ||
if (!g_Config.renderToMainframe ||
g_VideoInitialize.pWindowHandle == NULL) {
GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
-1, _("Dolphin"), wxPoint(0,0), size);
} else {
GLWin.frame = new wxFrame((wxWindow *)NULL,
GLWin.frame = new wxFrame((wxWindow *)NULL,
-1, _("Dolphin"), wxPoint(0,0), size);
}
GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, args,
@ -280,7 +280,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
g_VideoInitialize.pSysMessage("failed to create window");
return false;
}
GLuint PixelFormat; // Holds The Results After Searching For A Match
DWORD dwExStyle; // Window Extended Style
DWORD dwStyle; // Window Style
@ -387,18 +387,18 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
// attributes for a single buffered visual in RGBA format with at least
// 8 bits per color and a 24 bit depth buffer
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
None};
// attributes for a double buffered visual in RGBA format with at least
// attributes for a double buffered visual in RGBA format with at least
// 8 bits per color and a 24 bit depth buffer
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode, GLX_SAMPLES_ARB, 1, None };
GLWin.dpy = XOpenDisplay(0);
@ -563,7 +563,7 @@ bool OpenGL_MakeCurrent()
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
ERROR_LOG("GLWin Depth %d", GLWin.depth);
if (glXIsDirect(GLWin.dpy, GLWin.ctx))
if (glXIsDirect(GLWin.dpy, GLWin.ctx))
ERROR_LOG("you have Direct Rendering!");
else
ERROR_LOG("no Direct Rendering possible!");
@ -657,10 +657,10 @@ void OpenGL_Update()
break;
case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key >= XK_F1 && key <= XK_F9)
if(key >= XK_F1 && key <= XK_F9)
FKeyPressed = key - 0xff4e;
else {
if(key == XK_Shift_L || key == XK_Shift_R)
if(key == XK_Shift_L || key == XK_Shift_R)
ShiftPressed = true;
else if(key == XK_Control_L || key == XK_Control_R)
ControlPressed = true;
@ -685,8 +685,8 @@ void OpenGL_Update()
rcWindow.bottom = GLWin.height;
break;
case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though
Video_Shutdown(); // Calling from here since returning false does nothing
return;
Shutdown(); // Calling from here since returning false does nothing
return;
break;
default:
//TODO: Should we put the event back if we don't handle it?
@ -709,7 +709,7 @@ void OpenGL_Update()
// ------------------
/* MValueX and MValueY will be used in
TextureMngr and VertexShaderManager: Rescale textures on resolution changes
BPStructs.cpp: Control glScissor()
BPStructs.cpp: Control glScissor()
*/
// ------------------
float FactorW = 640.0f / (float)nBackbufferWidth;
@ -731,7 +731,7 @@ void OpenGL_Update()
nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
}
// tell the debugger
gleft = rcWindow.left; gright = rcWindow.right;
gtop = rcWindow.top; gbottom = rcWindow.bottom;

View File

@ -8,9 +8,9 @@
#include "Config.h"
#include "pluginspecs_video.h"
#include <GL/glew.h>
#include <GLew/glew.h>
#if defined(__APPLE__)
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
@ -38,16 +38,17 @@ class GLWindow {
protected:
res origRes, currFullRes, currWinRes;
EventHandler* eventHandler;
res origRes, currFullRes, currWinRes;
std::vector<res> fullResolutions;
std::vector<res> winResolutions;
virtual void SetRender(u32 x, u32 y) {
xRender = x;
yRender = y;
}
public:
virtual void SwapBuffers() {};
virtual void SetWindowText(const char *text) {};
virtual bool PeekMessages() {return false;};
@ -55,15 +56,15 @@ public:
virtual bool MakeCurrent() {return false;};
virtual void updateDim() {
if (GetProperty(OGL_FULLSCREEN))
if (GetProperty(OGL_FULLSCREEN))
SetWinSize(currFullRes.x, currFullRes.y);
else
SetWinSize(currWinRes.x, currWinRes.y);
float FactorX = 640.0f / (float)GetXwin();
float FactorY = 480.0f / (float)GetYwin();
float Max = (FactorX < FactorY) ? FactorX : FactorY;
if(GetProperty(OGL_STRETCHTOFIT)) {
SetMax(1.0f / FactorX, 1.0f / FactorY);
SetOffset(0,0);
@ -74,8 +75,9 @@ public:
}
}
bool GetProperty(OGL_Props prop) {return properties[prop];}
virtual bool SetProperty(OGL_Props prop, bool value)
void SetEventHandler(EventHandler *eh) { eventHandler = eh;}
bool GetProperty(OGL_Props prop) {return properties[prop];}
virtual bool SetProperty(OGL_Props prop, bool value)
{return properties[prop] = value;}
u32 GetXrender() {return xRender;}
@ -84,8 +86,8 @@ public:
u32 GetXwin() {return xWin;}
u32 GetYwin() {return yWin;}
void SetWinSize(u32 x, u32 y) {
xWin = x;
yWin = y;
xWin = x;
yWin = y;
}
int GetYoff() {return yOffset;}
@ -102,16 +104,16 @@ public:
float GetXmax() {return xMax;}
float GetYmax() {return yMax;}
static bool valid() { return false;}
GLWindow() {
// Load defaults
sscanf(g_Config.iFSResolution, "%dx%d",
sscanf(g_Config.iFSResolution, "%dx%d",
&currFullRes.x, &currFullRes.y);
sscanf(g_Config.iWindowedRes, "%dx%d",
sscanf(g_Config.iWindowedRes, "%dx%d",
&currWinRes.x, &currWinRes.y);
SetProperty(OGL_FULLSCREEN, g_Config.bFullscreen);

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
# can we import path in one place?
@ -47,7 +47,7 @@ else:
files += [
'main.cpp',
'GLUtil.cpp',
]
]
if gfxenv['HAVE_WX']:
files += [
'GUI/ConfigDlg.cpp',
@ -79,11 +79,11 @@ if sys.platform == 'darwin':
Return()
else:
if not (conf.CheckPKG('GL') and conf.CheckPKG('GLU')):
if not (conf.CheckPKG('GL') and conf.CheckPKG('GLU')):
print name + " must have opengl and glu to be build"
Return()
if not conf.CheckPKG('Cg') or not conf.CheckPKG('CgGL'):
if not conf.CheckPKG('Cg') or not conf.CheckPKG('CgGL'):
print name + " must have cg and cggl to be build"
Return()
@ -101,7 +101,7 @@ conf.Finish()
if gfxenv['GLTEST']:
if gfxenv['HAVE_XXF86VM']:
files += [
files += [
'X11Window.cpp',
]

View File

@ -1,7 +1,5 @@
#include "X11Window.h"
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
X11Window::X11Window() : GLWindow() {
XVisualInfo *vi;
@ -175,7 +173,6 @@ bool X11Window::PeekMessages() {
// Taken from sfml code
void X11Window::ProcessEvent(XEvent WinEvent) {
// static EventHandler *eventHandler = EventHandler::GetInstance();
switch (WinEvent.type) {
case KeyPress :

View File

@ -69,7 +69,7 @@ void DllDebugger(HWND _hParent, bool Show)
{
m_frame->DoShow();
}
else if(!m_frame && Show)
else if(!m_frame && Show)
{
m_frame = new CDebugger(NULL);
m_frame->Show();
@ -91,11 +91,11 @@ void DoDllDebugger() { }
#endif
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin OpenGL (DebugFast)");
#else
#ifndef _DEBUG
@ -125,9 +125,9 @@ void DllConfig(HWND _hParent)
dmi.dmSize = sizeof(dmi);
std::string resos[100];
int i = 0;
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
{
{
char szBuffer[100];
sprintf(szBuffer,"%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
std::string strBuffer(szBuffer);
@ -157,9 +157,9 @@ void DllConfig(HWND _hParent)
g_Config.Load();
frame.ShowModal();
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) &&\
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) &&\
HAVE_XXF86VM && defined(HAVE_WX) && HAVE_WX
ConfigDialog frame(NULL);
g_Config.Load();
int glxMajorVersion, glxMinorVersion;
@ -176,9 +176,9 @@ void DllConfig(HWND _hParent)
bestMode = 0;
XF86VidModeGetAllModeLines(GLWin.dpy, GLWin.screen, &modeNum, &modes);
int px = 0, py = 0;
if (modeNum > 0 && modes != NULL)
if (modeNum > 0 && modes != NULL)
{
for (int i = 0; i < modeNum; i++)
for (int i = 0; i < modeNum; i++)
{
if(px != modes[i]->hdisplay && py != modes[i]->vdisplay)
{
@ -200,11 +200,8 @@ void DllConfig(HWND _hParent)
//////////////////////////////////////////////////////////////////////////////////////////
// Initialize video
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Video_Initialize(SVideoInitialize* _pVideoInitialize)
void Initialize(void *init)
{
// When will this happen?
if (_pVideoInitialize == NULL) return;
// --------------------------------------------------
/* Dolphin currently crashes if the dll is loaded when a game is started so we close the
debugger and open it again after loading
@ -214,12 +211,13 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
if(m_frame)
{
m_frame->EndModal(0); wxEntryCleanup();
}//use wxUninitialize() if you don't want GUI
}//use wxUninitialize() if you don't want GUI
*/
// --------------------------------------------------
// --------------------------------------------------
frameCount = 0;
g_VideoInitialize = *_pVideoInitialize; // Create a shortcut to _pVideoInitialize that can also update it
SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init;
g_VideoInitialize = *(_pVideoInitialize); // Create a shortcut to _pVideoInitialize that can also update it
InitLUTs();
InitXFBConvTables();
g_Config.Load();
@ -238,7 +236,7 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
Renderer::AddMessage("Dolphin OpenGL Video Plugin" ,5000);
}
void Video_DoState(unsigned char **ptr, int mode) {
void DoState(unsigned char **ptr, int mode) {
//#ifdef _WIN32
// What is this code doing here?
// if (!wglMakeCurrent(hDC,hRC)) {
@ -249,7 +247,7 @@ void Video_DoState(unsigned char **ptr, int mode) {
// cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
//#elif defined(HAVE_X11) && HAVE_X11
// glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
//#endif
//#endif
#ifndef _WIN32
// WHY is this here??
OpenGL_MakeCurrent();
@ -293,7 +291,7 @@ void Video_Prepare(void)
TextureConverter::Init();
}
void Video_Shutdown(void)
void Shutdown(void)
{
TextureConverter::Shutdown();
VertexLoaderManager::Shutdown();
@ -309,7 +307,7 @@ void Video_Shutdown(void)
OpenGL_Shutdown();
}
void Video_Stop(void)
void Video_Stop(void)
{
Fifo_Stop();
}
@ -334,7 +332,7 @@ void DebugLog(const char* _fmt, ...)
#endif
}
bool ScreenShot(TCHAR *File)
bool ScreenShot(TCHAR *File)
{
char str[64];
int left = 200, top = 15;

View File

@ -67,6 +67,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize,
if (! glWin)
return false;
glWin->SetEventHandler((EventHandler *)globals->eventHandler);
return true;
}

View File

@ -57,7 +57,7 @@ class wxDLLApp : public wxApp
return true;
}
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif
@ -83,10 +83,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
}
break;
break;
case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break;
default:
break;
@ -102,11 +102,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
//******************************************************************************
// Exports
//******************************************************************************
extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo)
extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_WIIMOTE;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)");
#else
#ifndef _DEBUG
@ -138,8 +138,9 @@ void DllConfig(HWND _hParent)
#endif
}
extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize)
extern "C" void Initialize(void *init)
{
SWiimoteInitialize _WiimoteInitialize = *(SWiimoteInitialize *)init;
// ----------------------------------------
// Debugging window
// ----------
@ -153,11 +154,12 @@ extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize)
g_WiimoteInitialize = _WiimoteInitialize;
/* We will run WiiMoteReal::Initialize() even if we are not using a real wiimote,
we will initiate wiiuse.dll, but we will return before creating a new thread
for it if we find no real Wiimotes. Then g_UseRealWiiMote will also be false
This function call will be done instantly if there is no real Wiimote connected.
I'm not sure how long time it takes if a Wiimote is connected. */
/* We will run WiiMoteReal::Initialize() even if we are not using a
real wiimote, we will initiate wiiuse.dll, but we will return before
creating a new thread for it if we find no real Wiimotes. Then
g_UseRealWiiMote will also be false This function call will be done
instantly if there is no real Wiimote connected. I'm not sure how
long time it takes if a Wiimote is connected. */
#if HAVE_WIIUSE
g_UseRealWiiMote = WiiMoteReal::Initialize() > 0;
#endif
@ -165,11 +167,10 @@ extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize)
WiiMoteEmu::Initialize();
return g_UseRealWiiMote;
}
extern "C" void Wiimote_DoState(void* ptr, int mode)
extern "C" void DoState(unsigned char **ptr, int mode)
{
#if HAVE_WIIUSE
WiiMoteReal::DoState(ptr, mode);
@ -177,7 +178,7 @@ extern "C" void Wiimote_DoState(void* ptr, int mode)
WiiMoteEmu::DoState(ptr, mode);
}
extern "C" void Wiimote_Shutdown(void)
extern "C" void Shutdown(void)
{
#if HAVE_WIIUSE
WiiMoteReal::Shutdown();
@ -189,8 +190,8 @@ extern "C" void Wiimote_Shutdown(void)
/* This function produce Wiimote Input (reports from the Wiimote) in response
to Output from the Wii. It's called from WII_IPC_HLE_WiiMote.cpp. */
// ----------------
extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
{
extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
{
LOGV(WII_IPC_WIIMOTE, 3, "=============================================================");
const u8* data = (const u8*)_pData;
@ -213,7 +214,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32
LOGV(WII_IPC_WIIMOTE, 3, "=============================================================");
}
extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
{
LOGV(WII_IPC_WIIMOTE, 3, "=============================================================");
const u8* data = (const u8*)_pData;
@ -241,7 +242,7 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _
/* This sends a Data Report from the Wiimote. See SystemTimers.cpp for the documentation of this
update. */
// ----------------
extern "C" void Wiimote_Update()
extern "C" void Wiimote_Update()
{
if (! g_UseRealWiiMote)
WiiMoteEmu::Update();
@ -251,7 +252,7 @@ extern "C" void Wiimote_Update()
#endif
}
extern "C" unsigned int Wiimote_GetAttachedControllers()
extern "C" unsigned int Wiimote_GetAttachedControllers()
{
return 1;
}
@ -270,7 +271,7 @@ void __Log(int log, const char *_fmt, ...)
vsprintf( Msg, _fmt, ap );
va_end( ap );
g_WiimoteInitialize.pLog(Msg, 0);
g_WiimoteInitialize.pLog(Msg, 0);
}
@ -283,6 +284,6 @@ void __Logv(int log, int v, const char *_fmt, ...)
vsprintf( Msg, _fmt, ap );
va_end( ap );
g_WiimoteInitialize.pLog(Msg, v);
g_WiimoteInitialize.pLog(Msg, v);
}
// ================

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Name: nJoy
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE(ConfigBox,wxDialog)
EVT_CHECKBOX(IDC_SAVEBYID, ConfigBox::ChangeSettings) // Settings
EVT_CHECKBOX(IDC_SAVEBYIDNOTICE, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDC_SHOWADVANCED, ConfigBox::ChangeSettings)
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, ConfigBox::ChangeSettings)
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, ConfigBox::ChangeSettings)
EVT_BUTTON(IDB_SHOULDER_L, ConfigBox::GetButtons)
EVT_BUTTON(IDB_SHOULDER_R, ConfigBox::GetButtons)
@ -142,7 +142,7 @@ void ConfigBox::OnKeyDown(wxKeyEvent& event)
void ConfigBox::OnClose(wxCloseEvent& /*event*/)
{
EndModal(0);
if(!emulator_running) PAD_Shutdown(); // Close pads, unless we are running a game
if(!emulator_running) Shutdown(); // Close pads, unless we are running a game
}
// Call about dialog
@ -158,11 +158,11 @@ void ConfigBox::AboutClick(wxCommandEvent& event)
frame.ShowModal();
win.Enable(true);
win.SetHWND(0);
win.SetHWND(0);
#else
AboutBox frame(NULL);
frame.ShowModal();
#endif
#endif
}
// Click OK
@ -211,7 +211,7 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event )
g_Config.bSaveByIDNotice = m_CBSaveByIDNotice[notebookpage]->IsChecked();
break;
case IDC_SHOWADVANCED:
case IDC_SHOWADVANCED:
g_Config.bShowAdvanced = m_CBShowAdvanced[notebookpage]->IsChecked();
for(int i = 0; i < 4; i++)
{
@ -236,7 +236,7 @@ void ConfigBox::EnableDisable(wxCommandEvent& event)
{
// First save the settings as they are now, disabled controls will not be saved later
g_Config.Save();
// Update the enable / disable status
DoEnableDisable(notebookpage);
@ -276,7 +276,7 @@ void ConfigBox::DoEnableDisable(int _notebookpage)
// Notebook page changed
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void ConfigBox::NotebookPageChanged(wxNotebookEvent& event)
{
{
notebookpage = event.GetSelection();
}
@ -335,7 +335,7 @@ void ConfigBox::CreateGUIControls()
#else
SetTitle(wxT("Configure: nJoy v"INPUT_VERSION" (Debug) Input Plugin"));
#endif
SetIcon(wxNullIcon);
//WxStaticBitmap1_BITMAP(ConfigBox_WxStaticBitmap1_XPM);
@ -360,7 +360,7 @@ void ConfigBox::CreateGUIControls()
// Notebook
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
// Controller pages
m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_Controller[0], wxT("Controller 1"));
@ -381,7 +381,7 @@ void ConfigBox::CreateGUIControls()
WxStaticBitmap1_BITMAPGray = wxBitmap(WxImageGray);
// --------------------------------------------------------------------
// Search for devices and add them to the device list
// Search for devices and add them to the device list
// -----------------------------
wxArrayString arrayStringFor_Joyname; // The string array
if(SDL_NumJoysticks() > 0)
@ -405,7 +405,7 @@ void ConfigBox::CreateGUIControls()
// arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_JOYSTICK_XBOX360]));
// arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_KEYBOARD]));
// --------------------------------------------------------------------
// Populate the deadzone list
// -----------------------------
@ -420,7 +420,7 @@ void ConfigBox::CreateGUIControls()
// Populate all four pages
for(int i=0; i<4 ;i++)
{
{
// --------------------------------------------------------------------
// Populate keys sizer
// -----------------------------
@ -614,7 +614,7 @@ void ConfigBox::CreateGUIControls()
m_sSettings[i] = new wxBoxSizer ( wxHORIZONTAL );
m_sSettings[i]->Add(m_gExtrasettings[i], 0, wxEXPAND | wxALL, 0);
m_sSettings[i]->Add(m_gControllertype[i], 0, wxEXPAND | wxLEFT, 5);
m_sSettings[i]->Add(m_gGenSettings[i], 0, wxEXPAND | wxLEFT, 5);
m_sSettings[i]->Add(m_gGenSettings[i], 0, wxEXPAND | wxLEFT, 5);
//////////////////////////////////////
@ -714,7 +714,7 @@ void ConfigBox::CreateGUIControls()
DoEnableDisable(i);
} // end of loop
// --------------------------------------------------------------------
// Populate buttons sizer.
// -----------------------------
@ -736,8 +736,8 @@ void ConfigBox::CreateGUIControls()
// --------------------------------------------------------------------
// Debugging
// -----------------------------
//m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(100, 510), wxDefaultSize);
//m_pStatusBar2 = new wxStaticText(this, IDT_DEBUGGING2, wxT("Debugging2"), wxPoint(100, 530), wxDefaultSize);
//m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(100, 510), wxDefaultSize);
//m_pStatusBar2 = new wxStaticText(this, IDT_DEBUGGING2, wxT("Debugging2"), wxPoint(100, 530), wxDefaultSize);
//m_pStatusBar->SetLabel(wxString::Format("Debugging text"));
// --------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
import sys

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Name: nJoy
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
@ -29,7 +29,7 @@
//
//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
// Issues
@ -41,7 +41,7 @@
////////////////////////*/
////////////////////////////////////////////////////////////////////////////////////////
// Variables guide
@ -58,7 +58,7 @@
////////////////////////*/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
@ -71,7 +71,7 @@
#endif
/////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Variables
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -97,7 +97,7 @@ void __Logv(int log, int v, const char *format, ...) {}
extern int fd;
#endif
//////////////////////////////////////////////////////////////////////////////////////////
// wxWidgets
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -110,19 +110,19 @@ void __Logv(int log, int v, const char *format, ...) {}
}
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif
//////////////////////////////////////////////////////////////////////////////////////////
// DllMain
// DllMain
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#ifdef _WIN32
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
@ -136,17 +136,17 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
if (!wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
}
break;
break;
case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break;
default:
break;
}
nJoy_hInst = hinstDLL;
nJoy_hInst = hinstDLL;
return TRUE;
}
#endif
@ -162,7 +162,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (DebugFast) by Falcon4ever");
#else
#ifndef _DEBUG
@ -179,7 +179,7 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
// Call config dialog
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void DllConfig(HWND _hParent)
{
{
#ifdef _WIN32
if (SDL_Init(SDL_INIT_JOYSTICK ) < 0)
{
@ -193,7 +193,7 @@ void DllConfig(HWND _hParent)
SPADInitialize _PADInitialize;
_PADInitialize.hWnd = NULL;
_PADInitialize.pLog = NULL;
PAD_Initialize(_PADInitialize);
Initialize((void*)&_PADInitialize);
emulator_running = FALSE; // Set it back to false
}
@ -206,7 +206,7 @@ void DllConfig(HWND _hParent)
//win.SetHWND(0);
m_frame = new ConfigBox(NULL);
m_frame->ShowModal();
m_frame->ShowModal();
#else
if (SDL_Init(SDL_INIT_JOYSTICK ) < 0)
@ -222,34 +222,35 @@ void DllConfig(HWND _hParent)
frame.ShowModal();
#endif
#endif
#endif
}
void DllDebugger(HWND _hParent, bool Show) {
}
// Init PAD (start emulation)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void PAD_Initialize(SPADInitialize _PADInitialize)
{
void Initialize(void *init)
{
SPADInitialize _PADInitialize = *(SPADInitialize*)init;
emulator_running = TRUE;
#ifdef _DEBUG
DEBUG_INIT();
#endif
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
{
#ifdef _WIN32
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
#else
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
#else
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
#endif
return;
}
#ifdef _WIN32
m_hWnd = (HWND)_PADInitialize.hWnd;
m_hWnd = (HWND)_PADInitialize.hWnd;
#endif
Search_Devices(); // Populate joyinfo for all attached devices
@ -264,7 +265,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize)
joystate[3].joy = SDL_JoystickOpen(joysticks[3].ID);
}
// Search attached devices. Populate joyinfo for all attached physical devices.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int Search_Devices()
@ -291,8 +292,8 @@ int Search_Devices()
{
#ifdef _WIN32
//MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
#else
printf("No Joystick detected!\n");
#else
printf("No Joystick detected!\n");
#endif
return 0;
}
@ -301,7 +302,7 @@ int Search_Devices()
fprintf(pFile, "Scanning for devices\n");
fprintf(pFile, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
#endif
for(int i = 0; i < numjoy; i++ )
{
// Open the device to be able to read the values
@ -312,7 +313,7 @@ int Search_Devices()
joyinfo[i].NumBalls = SDL_JoystickNumBalls(joyinfo[i].joy);
joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy);
joyinfo[i].Name = SDL_JoystickName(i);
#ifdef _DEBUG
fprintf(pFile, "ID: %d\n", i);
fprintf(pFile, "Name: %s\n", joyinfo[i].Name);
@ -320,7 +321,7 @@ int Search_Devices()
fprintf(pFile, "Axes: %d\n", joyinfo[i].NumAxes);
fprintf(pFile, "Hats: %d\n", joyinfo[i].NumHats);
fprintf(pFile, "Balls: %d\n\n", joyinfo[i].NumBalls);
#endif
#endif
// We have now read the values we need so we close the device
if (SDL_JoystickOpened(i)) SDL_JoystickClose(joyinfo[i].joy);
@ -329,10 +330,10 @@ int Search_Devices()
return numjoy;
}
// Shutdown PAD (stop emulation)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void PAD_Shutdown()
void Shutdown()
{
if (joysticks[0].enabled)
SDL_JoystickClose(joystate[0].joy);
@ -344,15 +345,15 @@ void PAD_Shutdown()
SDL_JoystickClose(joystate[3].joy);
SDL_Quit();
#ifdef _DEBUG
DEBUG_QUIT();
#endif
delete [] joyinfo;
delete [] joyinfo;
emulator_running = FALSE;
#ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK
FreeDirectInput();
@ -362,6 +363,7 @@ void PAD_Shutdown()
#endif
}
// Set buttons status from wxWidgets in the main application
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -378,6 +380,8 @@ void PAD_Input(u8 _Key, u8 _UpDown)
}
}
void DoState(unsigned char **ptr, int mode) {
}
// Set PAD status. This is called from SerialInterface_Devices.cpp
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -385,14 +389,14 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{
if (!joysticks[_numPAD].enabled)
return;
// Clear pad status
memset(_pPADStatus, 0, sizeof(SPADStatus));
// Get pad status
GetJoyState(_numPAD);
///////////////////////////////////////////////////
// Set analog controllers
// -----------
@ -427,7 +431,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if ((sub_stick_x < deadzone2) || (sub_stick_x > deadzone)) _pPADStatus->substickX = sub_stick_x;
if ((sub_stick_y < deadzone2) || (sub_stick_y > deadzone)) _pPADStatus->substickY = sub_stick_y;
///////////////////////////////////////////////////
// Set buttons
// -----------
@ -444,7 +448,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
_pPADStatus->button|=PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue;
}
if (joystate[_numPAD].buttons[CTL_R_SHOULDER])
if (joystate[_numPAD].buttons[CTL_R_SHOULDER])
{
_pPADStatus->button|=PAD_TRIGGER_R;
_pPADStatus->triggerRight = triggervalue;
@ -484,7 +488,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if (joystate[_numPAD].dpad2[CTL_D_PAD_RIGHT])
_pPADStatus->button |= PAD_BUTTON_RIGHT;
}
//
_pPADStatus->err = PAD_ERR_NONE;
@ -492,7 +496,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
Pad_Use_Rumble(_numPAD, _pPADStatus);
}
//////////////////////////////////////////////////////////////////////////////////////////
// Convert stick values, for example from circle to square analog stick radius
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -500,7 +504,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
/* Convert stick values.
The value returned by SDL_JoystickGetAxis is a signed integer s16
(-32768 to 32767). The value used for the gamecube controller is an unsigned
(-32768 to 32767). The value used for the gamecube controller is an unsigned
char u8 (0 to 255) with neutral at 0x80 (128), so that it's equivalent to a signed
-128 to 127. */
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -520,7 +524,7 @@ u8 Pad_Convert(int _val)
return val;
}
/* Convert the stick raidus from a circular to a square. I don't know what input values
the actual GC controller produce for the GC, it may be a square, a circle or something
in between. But one thing that is certain is that PC pads differ in their output (as
@ -600,13 +604,13 @@ std::vector<int> Pad_Square_to_Circle(int _x, int _y)
}
//////////////////////////////////////////////////////////////////////////////////////////
// Set PAD attached pads
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned int PAD_GetAttachedPads()
{
unsigned int connected = 0;
g_Config.Load();
if (joysticks[0].enabled) connected |= 1;
@ -617,7 +621,7 @@ unsigned int PAD_GetAttachedPads()
return connected;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Read current joystick status
@ -646,7 +650,7 @@ void GetJoyState(int controller)
joystate[controller].axis[CTL_MAIN_Y] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_MAIN_Y]);
joystate[controller].axis[CTL_SUB_X] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_SUB_X]);
joystate[controller].axis[CTL_SUB_Y] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_SUB_Y]);
ReadButton(controller, CTL_L_SHOULDER);
ReadButton(controller, CTL_R_SHOULDER);
ReadButton(controller, CTL_A_BUTTON);
@ -655,7 +659,7 @@ void GetJoyState(int controller)
ReadButton(controller, CTL_Y_BUTTON);
ReadButton(controller, CTL_Z_TRIGGER);
ReadButton(controller, CTL_START);
//
if (joysticks[controller].halfpress < joyinfo[controller].NumButtons)
joystate[controller].halfpress = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].halfpress);

View File

@ -1,4 +1,4 @@
# -*- python -*-
# -*- python -*-
Import('env')
import sys
@ -12,7 +12,7 @@ if not env['HAVE_SDL']:
files = [
'nJoy.cpp',
]
if env['HAVE_WX']:
files +=[ 'GUI/AboutBox.cpp',
'GUI/ConfigBox.cpp',

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////////////////
// Project description
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Name: nJoy
// Name: nJoy
// Description: A Dolphin Compatible Input Plugin
//
// Author: Falcon4ever (nJoy@falcon4ever.com)
@ -92,18 +92,18 @@ class wxDLLApp : public wxApp
}
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif
//////////////////////////////////////////////////////////////////////////////////////////
// DllMain
// DllMain
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
@ -119,19 +119,19 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
return FALSE;
#endif
}
break;
break;
case DLL_PROCESS_DETACH:
#if defined(HAVE_WX) && HAVE_WX
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
#endif
break;
default:
break;
}
nJoy_hInst = hinstDLL;
nJoy_hInst = hinstDLL;
return TRUE;
}
#endif
@ -147,7 +147,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifdef DEBUGFAST
#ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (DebugFast) by Falcon4ever");
#else
#ifndef _DEBUG
@ -194,7 +194,7 @@ void DllConfig(HWND _hParent)
ConfigBox frame(NULL);
frame.ShowModal();
#endif
#endif
#endif
}
void DllDebugger(HWND _hParent, bool Show) {
@ -202,29 +202,30 @@ void DllDebugger(HWND _hParent, bool Show) {
// Init PAD (start emulation)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void PAD_Initialize(SPADInitialize _PADInitialize)
{
void Initialize(void *init)
{
SPADInitialize _PADInitialize = *(SPADInitialize*)init;
emulator_running = TRUE;
#ifdef _DEBUG
DEBUG_INIT();
#endif
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
{
#ifdef _WIN32
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
#else
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
#else
printf("Could not initialize SDL! (%s)\n", SDL_GetError());
#endif
return;
}
#ifdef _WIN32
m_hWnd = (HWND)_PADInitialize.hWnd;
m_hWnd = (HWND)_PADInitialize.hWnd;
#endif
LoadConfig(); // Load joystick mapping
if(joysticks[0].enabled)
joystate[0].joy = SDL_JoystickOpen(joysticks[0].ID);
if(joysticks[1].enabled)
@ -237,7 +238,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize)
// Shutdown PAD (stop emulation)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void PAD_Shutdown()
void Shutdown()
{
if(joysticks[0].enabled)
SDL_JoystickClose(joystate[0].joy);
@ -249,15 +250,15 @@ void PAD_Shutdown()
SDL_JoystickClose(joystate[3].joy);
SDL_Quit();
#ifdef _DEBUG
DEBUG_QUIT();
#endif
delete [] joyinfo;
delete [] joyinfo;
emulator_running = FALSE;
#ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK
FreeDirectInput();
@ -267,13 +268,14 @@ void PAD_Shutdown()
#endif
}
void DoState(unsigned char **ptr, int mode) {
}
// Set buttons status from wxWidgets in the main application
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void PAD_Input(u8 _Key, u8 _UpDown) {}
// Set PAD status
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -281,13 +283,13 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{
if(!joysticks[_numPAD].enabled)
return;
// clear pad status
memset(_pPADStatus, 0, sizeof(SPADStatus));
// get pad status
GetJoyState(_numPAD);
// Reset!
int base = 0x80;
_pPADStatus->stickY = base;
@ -326,8 +328,8 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{
//Do a panicAlert here?
}
// Quick fix
if(main_stick_x > 127)
main_stick_x = 127;
@ -398,7 +400,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if(Pressed == true)
{
int TriggerValue = 0;
if(joysticks[_numPAD].buttons[a].c_str()[1] == '+')
{
if(joystate[_numPAD].buttons[a] >= 0)
@ -416,7 +418,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
_pPADStatus->button |= ButtonArray[a];
_pPADStatus->triggerLeft = TriggerValue;
}
else if(a == CTL_R_SHOULDER)
else if(a == CTL_R_SHOULDER)
{
if(TriggerValue == 255)
_pPADStatus->button |= ButtonArray[a];
@ -445,7 +447,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
// Digital L and R
if(a == CTL_L_SHOULDER)
_pPADStatus->triggerLeft = 255; //TODO: Do half press with these
else if(a == CTL_R_SHOULDER)
else if(a == CTL_R_SHOULDER)
_pPADStatus->triggerRight = 255; //TODO: Half Press with these
else if(a == CTL_A_BUTTON)
_pPADStatus->analogA = 255;
@ -464,7 +466,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
_pPADStatus->button|=PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue;
}
if (joystate[_numPAD].buttons[CTL_R_SHOULDER])
if (joystate[_numPAD].buttons[CTL_R_SHOULDER])
{
_pPADStatus->button|=PAD_TRIGGER_R;
_pPADStatus->triggerRight = triggervalue;
@ -497,10 +499,10 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
else
{
}
_pPADStatus->err = PAD_ERR_NONE;
#ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK
if(joystate[_numPAD].halfpress)
@ -517,7 +519,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if (g_rumbleEnable)
{
g_pDevice->Acquire();
if(g_pEffect)
g_pEffect->Start(1, 0);
}
@ -625,7 +627,7 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
unsigned int PAD_GetAttachedPads()
{
unsigned int connected = 0;
LoadConfig();
if(joysticks[0].enabled)
@ -640,7 +642,7 @@ unsigned int PAD_GetAttachedPads()
return connected;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Custom Functions
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -698,8 +700,8 @@ int Search_Devices()
{
#ifdef _WIN32
MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
#else
printf("No Joystick detected!\n");
#else
printf("No Joystick detected!\n");
#endif
return 0;
}
@ -712,7 +714,7 @@ int Search_Devices()
fprintf(pFile, "Scanning for devices\n");
fprintf(pFile, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
#endif
for(int i = 0; i < numjoy; i++ )
{
joyinfo[i].joy = SDL_JoystickOpen(i);
@ -722,7 +724,7 @@ int Search_Devices()
joyinfo[i].NumBalls = SDL_JoystickNumBalls(joyinfo[i].joy);
joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy);
joyinfo[i].Name = SDL_JoystickName(i);
printf("ID: %d\n", i);
printf("Name: %s\n", joyinfo[i].Name);
printf("Buttons: %d\n", joyinfo[i].NumButtons);
@ -746,9 +748,9 @@ void DEBUG_INIT()
return;
#ifdef _WIN32
char dateStr [9];
char dateStr [9];
_strdate( dateStr);
char timeStr [9];
char timeStr [9];
_strtime( timeStr );
#endif
@ -768,7 +770,7 @@ void DEBUG_QUIT()
return;
#ifdef _WIN32
char timeStr [9];
char timeStr [9];
_strtime(timeStr);
fprintf(pFile, "_______________\n");
@ -797,7 +799,7 @@ void SaveConfig()
file.Set(SectionName, "y_button", joysticks[i].buttons[CTL_Y_BUTTON]);
file.Set(SectionName, "z_trigger", joysticks[i].buttons[CTL_Z_TRIGGER]);
file.Set(SectionName, "start_button", joysticks[i].buttons[CTL_START]);
file.Set(SectionName, "dpad", joysticks[i].dpad);
file.Set(SectionName, "dpad", joysticks[i].dpad);
file.Set(SectionName, "dpad_up", joysticks[i].buttons[CTL_D_PAD_UP]);
file.Set(SectionName, "dpad_down", joysticks[i].buttons[CTL_D_PAD_DOWN]);
file.Set(SectionName, "dpad_left", joysticks[i].buttons[CTL_D_PAD_LEFT]);
@ -840,23 +842,23 @@ void LoadConfig()
file.Get(SectionName, "l_shoulder", &joysticks[i].buttons[CTL_L_SHOULDER], "B4");
file.Get(SectionName, "r_shoulder", &joysticks[i].buttons[CTL_R_SHOULDER], "B5");
file.Get(SectionName, "a_button", &joysticks[i].buttons[CTL_A_BUTTON], "B0");
file.Get(SectionName, "b_button", &joysticks[i].buttons[CTL_B_BUTTON], "B1");
file.Get(SectionName, "b_button", &joysticks[i].buttons[CTL_B_BUTTON], "B1");
file.Get(SectionName, "x_button", &joysticks[i].buttons[CTL_X_BUTTON], "B3");
file.Get(SectionName, "y_button", &joysticks[i].buttons[CTL_Y_BUTTON], "B2");
file.Get(SectionName, "y_button", &joysticks[i].buttons[CTL_Y_BUTTON], "B2");
file.Get(SectionName, "z_trigger", &joysticks[i].buttons[CTL_Z_TRIGGER], "B7");
file.Get(SectionName, "start_button", &joysticks[i].buttons[CTL_START], "B9");
file.Get(SectionName, "dpad", &joysticks[i].dpad, 0);
file.Get(SectionName, "start_button", &joysticks[i].buttons[CTL_START], "B9");
file.Get(SectionName, "dpad", &joysticks[i].dpad, 0);
file.Get(SectionName, "dpad_up", &joysticks[i].buttons[CTL_D_PAD_UP], 0);
file.Get(SectionName, "dpad_down", &joysticks[i].buttons[CTL_D_PAD_DOWN], 0);
file.Get(SectionName, "dpad_left", &joysticks[i].buttons[CTL_D_PAD_LEFT], 0);
file.Get(SectionName, "dpad_right", &joysticks[i].buttons[CTL_D_PAD_RIGHT], 0);
file.Get(SectionName, "main_x", &joysticks[i].buttons[CTL_MAIN_X], "A0");
file.Get(SectionName, "main_y", &joysticks[i].buttons[CTL_MAIN_Y], "A1");
file.Get(SectionName, "sub_x", &joysticks[i].buttons[CTL_SUB_X], "A2");
file.Get(SectionName, "sub_y", &joysticks[i].buttons[CTL_SUB_Y], "A3");
file.Get(SectionName, "enabled", &joysticks[i].enabled, 1);
file.Get(SectionName, "deadzone", &joysticks[i].deadzone, 9);
file.Get(SectionName, "halfpress", &joysticks[i].halfpress, 6);
file.Get(SectionName, "main_x", &joysticks[i].buttons[CTL_MAIN_X], "A0");
file.Get(SectionName, "main_y", &joysticks[i].buttons[CTL_MAIN_Y], "A1");
file.Get(SectionName, "sub_x", &joysticks[i].buttons[CTL_SUB_X], "A2");
file.Get(SectionName, "sub_y", &joysticks[i].buttons[CTL_SUB_Y], "A3");
file.Get(SectionName, "enabled", &joysticks[i].enabled, 1);
file.Get(SectionName, "deadzone", &joysticks[i].deadzone, 9);
file.Get(SectionName, "halfpress", &joysticks[i].halfpress, 6);
file.Get(SectionName, "joy_id", &joysticks[i].ID, 0);
file.Get(SectionName, "controllertype", &joysticks[i].controllertype, 0);
file.Get(SectionName, "eventnum", &joysticks[i].eventnum, 0);
@ -875,7 +877,7 @@ void LoadConfig()
}
}
#ifdef _WIN32
//////////////////////////////////////////////////////////////////////////////////////////
// Rumble stuff :D!
@ -903,7 +905,7 @@ HRESULT InitDirectInput( HWND hDlg )
{
MessageBox(NULL, "Force feedback device not found. nJoy will now disable rumble." ,"FFConst" , MB_ICONERROR | MB_OK);
g_rumbleEnable = FALSE;
return S_OK;
}
@ -923,7 +925,7 @@ HRESULT InitDirectInput( HWND hDlg )
// Exclusive access is required in order to perform force feedback.
//if(FAILED(hr = g_pDevice->SetCooperativeLevel(hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND)))
if(FAILED(hr = g_pDevice->SetCooperativeLevel(hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND)))
if(FAILED(hr = g_pDevice->SetCooperativeLevel(hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND)))
{
return hr;
}
@ -939,7 +941,7 @@ HRESULT InitDirectInput( HWND hDlg )
if(FAILED(hr = g_pDevice->SetProperty(DIPROP_AUTOCENTER, &dipdw.diph)))
return hr;
// Enumerate and count the axes of the joystick
// Enumerate and count the axes of the joystick
if(FAILED(hr = g_pDevice->EnumObjects(EnumAxesCallback, (VOID*)&g_dwNumForceFeedbackAxis, DIDFT_AXIS)))
return hr;
@ -983,7 +985,7 @@ HRESULT InitDirectInput( HWND hDlg )
VOID FreeDirectInput()
{
// Unacquire the device one last time just in case
// Unacquire the device one last time just in case
// the app tried to exit while the device is still acquired.
if(g_pDevice)
g_pDevice->Unacquire();
@ -1037,7 +1039,7 @@ HRESULT SetDeviceForcesXY()
}
else
{
// If two force feedback axis, then apply magnitude from both directions
// If two force feedback axis, then apply magnitude from both directions
rglDirection[0] = g_nXForce;
rglDirection[1] = g_nYForce;
cf.lMagnitude = (DWORD)sqrt((double)g_nXForce * (double)g_nXForce + (double)g_nYForce * (double)g_nYForce );