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,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);