mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Wiimote: Configure gamepad in Wiimote plugin
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2172 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -353,6 +353,8 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
PADInitialize.hWnd = g_pWindowHandle;
|
||||
PADInitialize.pLog = Callback_PADLog;
|
||||
PADInitialize.padNumber = i;
|
||||
// This is may be needed to avoid a SDL problem
|
||||
//Plugins.FreeWiimote();
|
||||
// Check if we should init the plugin
|
||||
if (Plugins.OkayToInitPlugin(i))
|
||||
{
|
||||
|
||||
@@ -457,11 +457,19 @@ void CPluginManager::FreeDSP()
|
||||
delete m_dsp;
|
||||
m_dsp = NULL;
|
||||
}
|
||||
void CPluginManager::FreePad(u32 pad)
|
||||
void CPluginManager::FreePad(u32 Pad)
|
||||
{
|
||||
if (pad < MAXPADS) {
|
||||
delete m_pad[pad];
|
||||
m_pad[pad] = NULL;
|
||||
if (Pad < MAXPADS) {
|
||||
delete m_pad[Pad];
|
||||
m_pad[Pad] = NULL;
|
||||
}
|
||||
}
|
||||
void CPluginManager::FreeWiimote(u32 Wiimote)
|
||||
{
|
||||
if (Wiimote < MAXWIIMOTES)
|
||||
{
|
||||
delete m_wiimote[Wiimote];
|
||||
m_wiimote[Wiimote] = NULL;
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////
|
||||
|
||||
@@ -54,7 +54,8 @@ public:
|
||||
|
||||
void FreeVideo();
|
||||
void FreeDSP();
|
||||
void FreePad(u32 pad);
|
||||
void FreePad(u32 Pad);
|
||||
void FreeWiimote(u32 Wiimote);
|
||||
|
||||
bool InitPlugins();
|
||||
void ShutdownPlugins();
|
||||
|
||||
@@ -231,4 +231,134 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Configure button mapping
|
||||
// ¯¯¯¯¯¯¯¯¯¯
|
||||
|
||||
// Avoid extreme axis values
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
/* Function: We have to avoid very big values to becuse some triggers are -0x8000 in the
|
||||
unpressed state (and then go from -0x8000 to 0x8000 as they are fully pressed) */
|
||||
bool AvoidValues(int value)
|
||||
{
|
||||
// Avoid detecting very small or very big (for triggers) values
|
||||
if( (value > -0x2000 && value < 0x2000) // Small values
|
||||
|| (value < -0x6000 || value > 0x6000)) // Big values
|
||||
return true; // Avoid
|
||||
else
|
||||
return false; // Keep
|
||||
}
|
||||
|
||||
|
||||
// Detect a pressed button
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int hats,
|
||||
int &KeyboardKey, int &value, int &type, int &pressed, bool &Succeed, bool &Stop,
|
||||
bool LeftRight, bool Axis, bool XInput, bool Button, bool Hat)
|
||||
{
|
||||
// It needs the wxWidgets excape keycode
|
||||
static const int WXK_ESCAPE = 27;
|
||||
|
||||
// Update the internal status
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
// For the triggers we accept both a digital or an analog button
|
||||
if(Axis)
|
||||
{
|
||||
for(int i = 0; i < axes; i++)
|
||||
{
|
||||
value = SDL_JoystickGetAxis(joy, i);
|
||||
|
||||
if(AvoidValues(value)) continue; // Avoid values
|
||||
|
||||
pressed = i + (LeftRight ? 1000 : 0); // Identify the analog triggers
|
||||
type = InputCommon::CTL_AXIS;
|
||||
Succeed = true;
|
||||
}
|
||||
Console::Print("Id: %i\n", joy);
|
||||
}
|
||||
|
||||
// Check for a hat
|
||||
if(Hat)
|
||||
{
|
||||
for(int i = 0; i < hats; i++)
|
||||
{
|
||||
if(SDL_JoystickGetHat(joy, i))
|
||||
{
|
||||
pressed = i;
|
||||
type = InputCommon::CTL_HAT;
|
||||
Succeed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for a button
|
||||
if(Button)
|
||||
{
|
||||
for(int i = 0; i < buttons; i++)
|
||||
{
|
||||
// Some kind of bug in SDL 1.3 would give button 9 and 10 (nonexistent) the value 48 on the 360 pad
|
||||
if (SDL_JoystickGetButton(joy, i) > 1) continue;
|
||||
|
||||
if(SDL_JoystickGetButton(joy, i))
|
||||
{
|
||||
pressed = i;
|
||||
type = InputCommon::CTL_BUTTON;
|
||||
Succeed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for a XInput trigger
|
||||
#ifdef _WIN32
|
||||
if(XInput)
|
||||
{
|
||||
for(int i = 0; i <= InputCommon::XI_TRIGGER_R; i++)
|
||||
{
|
||||
if(XInput::GetXI(0, i))
|
||||
{
|
||||
pressed = i + 1000;
|
||||
type = InputCommon::CTL_AXIS;
|
||||
Succeed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check for keyboard action
|
||||
if (KeyboardKey)
|
||||
{
|
||||
if(Button)
|
||||
{
|
||||
// Todo: Add a separate keyboard vector to remove this restriction
|
||||
if(KeyboardKey >= buttons)
|
||||
{
|
||||
pressed = KeyboardKey;
|
||||
type = InputCommon::CTL_BUTTON;
|
||||
Succeed = true;
|
||||
KeyboardKey = 0;
|
||||
if(pressed == WXK_ESCAPE) pressed = -1; // Check for the escape key
|
||||
}
|
||||
// Else show the error message
|
||||
else
|
||||
{
|
||||
pressed = KeyboardKey;
|
||||
KeyboardKey = -1;
|
||||
Stop = true;
|
||||
}
|
||||
}
|
||||
// Only accept the escape key
|
||||
else
|
||||
{
|
||||
Succeed = true;
|
||||
KeyboardKey = 0;
|
||||
pressed = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////// Configure button mapping
|
||||
|
||||
|
||||
|
||||
} // InputCommon
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <SDL.h> // Externals
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "ConsoleWindow.h"
|
||||
////////////////////////////
|
||||
|
||||
|
||||
@@ -148,6 +149,34 @@ enum
|
||||
XI_TRIGGER_L = 0,
|
||||
XI_TRIGGER_R
|
||||
};
|
||||
|
||||
|
||||
struct PadAxis
|
||||
{
|
||||
int Lx;
|
||||
int Ly;
|
||||
int Rx;
|
||||
int Ry;
|
||||
int Tl; // Triggers
|
||||
int Tr;
|
||||
};
|
||||
struct CONTROLLER_STATE_NEW // GC PAD INFO/STATE
|
||||
{
|
||||
PadAxis Axis; // 6 Axes (Main, Sub, Triggers)
|
||||
SDL_Joystick *joy; // SDL joystick device
|
||||
};
|
||||
|
||||
struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING
|
||||
{
|
||||
PadAxis Axis; // (See above)
|
||||
bool enabled; // Pad attached?
|
||||
int deadzone; // Deadzone... what else?
|
||||
int ID; // SDL joystick device ID
|
||||
int controllertype; // D-Pad type: Hat or custom buttons
|
||||
int triggertype; // SDL or XInput trigger
|
||||
std::string SDiagonal;
|
||||
bool bSquareToCircle;
|
||||
};
|
||||
////////////////////////////
|
||||
|
||||
|
||||
@@ -158,6 +187,7 @@ enum
|
||||
// General functions
|
||||
bool SearchDevices(std::vector<CONTROLLER_INFO> &_joyinfo, int &NumPads, int &NumGoodPads);
|
||||
void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int controller, int NumButtons);
|
||||
void GetButton(SDL_Joystick*, int,int,int,int, int&,int&,int&,int&,bool&,bool&, bool,bool,bool,bool,bool);
|
||||
|
||||
// Value conversion
|
||||
int Pad_Convert(int _val);
|
||||
|
||||
@@ -550,6 +550,10 @@
|
||||
RelativePath=".\Src\EmuMain.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\EmuPad.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\EmuSubroutines.cpp"
|
||||
>
|
||||
@@ -610,6 +614,10 @@
|
||||
RelativePath=".\Src\ConfigDlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ConfigGamepad.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ConfigRecording.cpp"
|
||||
>
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "EmuDefinitions.h" // for PadMapping
|
||||
|
||||
Config g_Config;
|
||||
|
||||
@@ -27,7 +29,7 @@ Config::Config()
|
||||
memset(this, 0, sizeof(Config));
|
||||
}
|
||||
|
||||
void Config::Load()
|
||||
void Config::Load(bool ChangePad)
|
||||
{
|
||||
std::string temp;
|
||||
IniFile iniFile;
|
||||
@@ -49,6 +51,49 @@ void Config::Load()
|
||||
iniFile.Get("Real", "AccNunNeutralX", &iAccNunNeutralX, 0);
|
||||
iniFile.Get("Real", "AccNunNeutralY", &iAccNunNeutralY, 0);
|
||||
iniFile.Get("Real", "AccNunNeutralZ", &iAccNunNeutralZ, 0);
|
||||
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
// ==================================================================
|
||||
// Slot specific settings
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
std::string SectionName = StringFromFormat("Wiimote%i", i + 1);
|
||||
|
||||
// Don't update this when we are loading settings from the ConfigBox
|
||||
if(!ChangePad)
|
||||
{
|
||||
iniFile.Get(SectionName.c_str(), "DeviceID", &WiiMoteEmu::PadMapping[i].ID, 0);
|
||||
iniFile.Get(SectionName.c_str(), "Enabled", &WiiMoteEmu::PadMapping[i].enabled, true);
|
||||
}
|
||||
// ===================
|
||||
|
||||
// ==================================================================
|
||||
// Joypad specific settings
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
// Current joypad device ID: PadMapping[i].ID
|
||||
// Current joypad name: joyinfo[PadMapping[i].ID].Name
|
||||
|
||||
/* Prevent a crash from illegal access to joyinfo that will only have values for
|
||||
the current amount of connected PadMapping */
|
||||
if(WiiMoteEmu::PadMapping[i].ID >= SDL_NumJoysticks()) continue;
|
||||
|
||||
// Create a section name
|
||||
SectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name;
|
||||
|
||||
iniFile.Get(SectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0);
|
||||
iniFile.Get(SectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1);
|
||||
iniFile.Get(SectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2);
|
||||
iniFile.Get(SectionName.c_str(), "right_y", &WiiMoteEmu::PadMapping[i].Axis.Ry, 3);
|
||||
iniFile.Get(SectionName.c_str(), "l_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tl, 4);
|
||||
iniFile.Get(SectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 5);
|
||||
iniFile.Get(SectionName.c_str(), "DeadZone", &WiiMoteEmu::PadMapping[i].deadzone, 0);
|
||||
iniFile.Get(SectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0);
|
||||
iniFile.Get(SectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%");
|
||||
iniFile.Get(SectionName.c_str(), "SquareToCircle", &WiiMoteEmu::PadMapping[i].bSquareToCircle, false);
|
||||
}
|
||||
// =============================
|
||||
Console::Print("Load()\n");
|
||||
}
|
||||
|
||||
void Config::Save()
|
||||
@@ -70,5 +115,47 @@ void Config::Save()
|
||||
iniFile.Set("Real", "AccNunNeutralY", iAccNunNeutralY);
|
||||
iniFile.Set("Real", "AccNunNeutralZ", iAccNunNeutralZ);
|
||||
|
||||
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
// ==================================================================
|
||||
// Slot specific settings
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
std::string SectionName = StringFromFormat("Wiimote%i", i + 1);
|
||||
iniFile.Set(SectionName.c_str(), "Enabled", WiiMoteEmu::PadMapping[i].enabled);
|
||||
|
||||
// Save the physical device ID number
|
||||
iniFile.Set(SectionName.c_str(), "DeviceID", WiiMoteEmu::PadMapping[i].ID);
|
||||
// ===================
|
||||
|
||||
// ==================================================================
|
||||
// Joypad specific settings
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
// Current joypad device ID: PadMapping[i].ID
|
||||
// Current joypad name: joyinfo[PadMapping[i].ID].Name
|
||||
|
||||
/* Save joypad specific settings. Check for "PadMapping[i].ID < SDL_NumJoysticks()" to
|
||||
avoid reading a joyinfo that does't exist */
|
||||
if(WiiMoteEmu::PadMapping[i].ID >= SDL_NumJoysticks()) continue;
|
||||
|
||||
// Create a new section name after the joypad name
|
||||
SectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name;
|
||||
|
||||
iniFile.Set(SectionName.c_str(), "left_x", WiiMoteEmu::PadMapping[i].Axis.Lx);
|
||||
iniFile.Set(SectionName.c_str(), "left_y", WiiMoteEmu::PadMapping[i].Axis.Ly);
|
||||
iniFile.Set(SectionName.c_str(), "right_x", WiiMoteEmu::PadMapping[i].Axis.Rx);
|
||||
iniFile.Set(SectionName.c_str(), "right_y", WiiMoteEmu::PadMapping[i].Axis.Ry);
|
||||
iniFile.Set(SectionName.c_str(), "l_trigger", WiiMoteEmu::PadMapping[i].Axis.Tl);
|
||||
iniFile.Set(SectionName.c_str(), "r_trigger", WiiMoteEmu::PadMapping[i].Axis.Tr);
|
||||
|
||||
//iniFile.Set(SectionName.c_str(), "deadzone", PadMapping[i].deadzone);
|
||||
//iniFile.Set(SectionName.c_str(), "controllertype", PadMapping[i].controllertype);
|
||||
iniFile.Set(SectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype);
|
||||
//iniFile.Set(SectionName.c_str(), "Diagonal", PadMapping[i].SDiagonal);
|
||||
//iniFile.Set(SectionName.c_str(), "SquareToCircle", PadMapping[i].bSquareToCircle);
|
||||
// ======================================
|
||||
}
|
||||
|
||||
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
Console::Print("Save()\n");
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
struct Config
|
||||
{
|
||||
Config();
|
||||
void Load();
|
||||
void Load(bool ChangePad = false);
|
||||
void Save();
|
||||
|
||||
// Emulated Wiimote
|
||||
|
||||
@@ -66,6 +66,7 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
EVT_CHECKBOX(ID_UPDATE_REAL, ConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_NEUTRAL_CHOICE, ConfigDialog::GeneralSettingsChanged)
|
||||
|
||||
// Recording
|
||||
EVT_CHOICE(IDC_RECORD + 1, ConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHOICE(IDC_RECORD + 2, ConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHOICE(IDC_RECORD + 3, ConfigDialog::GeneralSettingsChanged)
|
||||
@@ -98,9 +99,21 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
EVT_BUTTON(IDB_RECORD + 14, ConfigDialog::RecordMovement)
|
||||
EVT_BUTTON(IDB_RECORD + 15, ConfigDialog::RecordMovement)
|
||||
|
||||
// Gamepad
|
||||
EVT_COMBOBOX(ID_TRIGGER_TYPE, ConfigDialog::GeneralSettingsChanged)
|
||||
|
||||
EVT_BUTTON(IDB_ANALOG_LEFT_X, ConfigDialog::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_LEFT_Y, ConfigDialog::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_RIGHT_X, ConfigDialog::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_RIGHT_Y, ConfigDialog::GetButtons)
|
||||
EVT_BUTTON(IDB_TRIGGER_L, ConfigDialog::GetButtons)
|
||||
EVT_BUTTON(IDB_TRIGGER_R, ConfigDialog::GetButtons)
|
||||
|
||||
EVT_TIMER(IDTM_UPDATE, ConfigDialog::Update)
|
||||
EVT_TIMER(IDTM_UPDATE_ONCE, ConfigDialog::UpdateOnce)
|
||||
EVT_TIMER(IDTM_SHUTDOWN, ConfigDialog::ShutDown)
|
||||
EVT_TIMER(IDTM_BUTTON, ConfigDialog::OnButtonTimer)
|
||||
EVT_TIMER(IDTM_UPDATE_PAD, ConfigDialog::UpdatePad)
|
||||
END_EVENT_TABLE()
|
||||
//////////////////////////////////////
|
||||
|
||||
@@ -116,9 +129,17 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
|
||||
m_TimeoutTimer = new wxTimer(this, IDTM_UPDATE);
|
||||
m_ShutDownTimer = new wxTimer(this, IDTM_SHUTDOWN);
|
||||
m_TimeoutOnce = new wxTimer(this, IDTM_UPDATE_ONCE);
|
||||
m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON);
|
||||
m_UpdatePad = new wxTimer(this, IDTM_UPDATE_PAD);
|
||||
|
||||
// Reset values
|
||||
m_bWaitForRecording = false;
|
||||
m_bRecording = false;
|
||||
GetButtonWaitingID = 0; GetButtonWaitingTimer = 0;
|
||||
|
||||
// Start the permanent timer
|
||||
const int TimesPerSecond = 30;
|
||||
m_UpdatePad->Start( floor((double)(1000 / TimesPerSecond)) );
|
||||
#endif
|
||||
|
||||
ControlsCreated = false;
|
||||
@@ -134,6 +155,9 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
||||
wxKeyEventHandler(ConfigDialog::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_UP,
|
||||
wxKeyEventHandler(ConfigDialog::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
}
|
||||
|
||||
ConfigDialog::~ConfigDialog()
|
||||
@@ -144,6 +168,9 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
// Save the key
|
||||
g_Pressed = event.GetKeyCode();
|
||||
|
||||
// Escape a recording event
|
||||
if (event.GetKeyCode() == WXK_ESCAPE)
|
||||
{
|
||||
@@ -156,6 +183,7 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
|
||||
void ConfigDialog::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
g_FrameOpen = false;
|
||||
m_UpdatePad->Stop();
|
||||
SaveFile();
|
||||
g_Config.Save();
|
||||
//SuccessAlert("Saved\n");
|
||||
@@ -195,6 +223,8 @@ void ConfigDialog::CloseClick(wxCommandEvent& event)
|
||||
}
|
||||
break;
|
||||
case ID_APPLY:
|
||||
SaveButtonMappingAll(Page);
|
||||
g_Config.Save();
|
||||
SaveFile();
|
||||
WiiMoteEmu::LoadRecordedMovements();
|
||||
break;
|
||||
@@ -329,20 +359,23 @@ void ConfigDialog::CreateGUIControls()
|
||||
// General and basic Settings
|
||||
// ----------------
|
||||
|
||||
// Configuration controls
|
||||
static const int TxtW = 50, TxtH = 19, ChW = 245;
|
||||
|
||||
// Basic Settings
|
||||
m_WiimoteOnline[i] = new wxCheckBox(m_Controller[i], IDC_JOYATTACH, wxT("Wiimote On"), wxDefaultPosition, wxSize(263, -1));
|
||||
m_WiimoteOnline[i] = new wxCheckBox(m_Controller[i], IDC_JOYATTACH, wxT("Wiimote On"), wxDefaultPosition, wxSize(ChW, -1));
|
||||
// Emulated Wiimote
|
||||
m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways D-Pad"), wxDefaultPosition, wxSize(263, -1));
|
||||
m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways D-Pad"), wxDefaultPosition, wxSize(ChW, -1));
|
||||
m_WideScreen[i] = new wxCheckBox(m_Controller[i], ID_WIDESCREEN, wxT("WideScreen Mode (for correct aiming)"));
|
||||
// Extension
|
||||
m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Wii Motion Plus Connected"), wxDefaultPosition, wxSize(263, -1), 0, wxDefaultValidator);
|
||||
m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Wii Motion Plus Connected"), wxDefaultPosition, wxSize(ChW, -1), 0, wxDefaultValidator);
|
||||
m_NunchuckConnected[i] = new wxCheckBox(m_Controller[i], ID_NUNCHUCKCONNECTED, wxT("Nunchuck Connected"));
|
||||
m_ClassicControllerConnected[i] = new wxCheckBox(m_Controller[i], ID_CLASSICCONTROLLERCONNECTED, wxT("Classic Controller Connected"));
|
||||
m_BalanceBoardConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Balance Board Connected"));
|
||||
m_GuitarHeroGuitarConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Guitar Hero Guitar Connected"));
|
||||
m_GuitarHeroWorldTourDrumsConnected[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Guitar Hero World Tour Drums Connected"));
|
||||
// Real Wiimote
|
||||
m_ConnectRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_CONNECT_REAL, wxT("Connect Real Wiimote"), wxDefaultPosition, wxSize(263, -1));
|
||||
m_ConnectRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_CONNECT_REAL, wxT("Connect Real Wiimote"), wxDefaultPosition, wxSize(ChW, -1));
|
||||
m_UseRealWiimote[i] = new wxCheckBox(m_Controller[i], ID_USE_REAL, wxT("Use Real Wiimote"));
|
||||
|
||||
// Default values
|
||||
@@ -416,7 +449,7 @@ void ConfigDialog::CreateGUIControls()
|
||||
// -----------------------------
|
||||
/**/
|
||||
// Controls
|
||||
m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, StrJoyname[0], wxDefaultPosition, wxSize(445, -1), StrJoyname, wxCB_READONLY);
|
||||
m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, StrJoyname[0], wxDefaultPosition, wxSize(225, -1), StrJoyname, wxCB_READONLY);
|
||||
|
||||
m_gJoyname[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Gamepad"));
|
||||
m_gJoyname[i]->Add(m_Joyname[i], 0, wxALIGN_CENTER | (wxLEFT | wxRIGHT | wxDOWN), 5);
|
||||
@@ -440,48 +473,129 @@ void ConfigDialog::CreateGUIControls()
|
||||
|
||||
|
||||
m_gTilt[i] = new wxStaticBoxSizer (wxVERTICAL, m_Controller[i], wxT("Tilt Wiimote"));
|
||||
m_gTilt[i]->Add(m_TiltCombo[i], 0, (wxLEFT | wxRIGHT | wxDOWN), 5);
|
||||
m_gTilt[i]->Add(m_TiltHoriz[i], 0, (wxLEFT | wxRIGHT), 5);
|
||||
m_gTilt[i]->AddStretchSpacer();
|
||||
m_gTilt[i]->Add(m_TiltCombo[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
|
||||
m_gTilt[i]->Add(m_TiltHoriz[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
||||
m_gTilt[i]->AddStretchSpacer();
|
||||
|
||||
// Tooltips
|
||||
m_TiltCombo[i]->SetToolTip(wxT("Control tilting by an analog gamepad stick, an analog trigger or the keyboard."));
|
||||
|
||||
// Sizers for both the connected pads and tilt
|
||||
// --------------------------------------------------------------------
|
||||
// Analog triggers
|
||||
// -----------------------------
|
||||
/**/
|
||||
m_gTrigger[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Triggers"));
|
||||
|
||||
m_TriggerStatusL[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left: "));
|
||||
m_TriggerStatusR[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Right: "));
|
||||
m_TriggerStatusLx[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("000"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
|
||||
m_TriggerStatusRx[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("000"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
|
||||
|
||||
m_tAnalogTriggerInput[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Input"));
|
||||
m_tAnalogTriggerL[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left"));
|
||||
m_tAnalogTriggerR[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Right"));
|
||||
|
||||
m_AnalogTriggerL[i] = new wxTextCtrl(m_Controller[i], ID_TRIGGER_L, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_AnalogTriggerR[i] = new wxTextCtrl(m_Controller[i], ID_TRIGGER_R, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
|
||||
m_AnalogTriggerL[i]->Enable(false);
|
||||
m_AnalogTriggerR[i]->Enable(false);
|
||||
|
||||
m_bAnalogTriggerL[i] = new wxButton(m_Controller[i], IDB_TRIGGER_L, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogTriggerR[i] = new wxButton(m_Controller[i], IDB_TRIGGER_R, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
|
||||
m_TriggerType[i] = new wxComboBox(m_Controller[i], ID_TRIGGER_TYPE, StrTriggerType[0], wxDefaultPosition, wxDefaultSize, StrTriggerType, wxCB_READONLY);
|
||||
|
||||
m_SizeAnalogTriggerStatusBox[i] = new wxGridBagSizer(0, 0);
|
||||
m_SizeAnalogTriggerHorizConfig[i] = new wxGridBagSizer(0, 0);
|
||||
m_SizeAnalogTriggerVertLeft[i] = new wxBoxSizer(wxVERTICAL);
|
||||
m_SizeAnalogTriggerVertRight[i] = new wxBoxSizer(wxVERTICAL);
|
||||
m_SizeAnalogTriggerHorizInput[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// The status text boxes
|
||||
m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusL[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxUP), 0);
|
||||
m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusLx[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxUP), 0);
|
||||
m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusR[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxUP), 0);
|
||||
m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusRx[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxUP), 0);
|
||||
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_tAnalogTriggerL[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxUP), 2);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_AnalogTriggerL[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT | wxRIGHT), 2);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_bAnalogTriggerL[i], wxGBPosition(0, 2), wxGBSpan(1, 1), (wxUP), 2);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_tAnalogTriggerR[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxUP), 4);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_AnalogTriggerR[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxLEFT | wxUP | wxRIGHT), 2);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_bAnalogTriggerR[i], wxGBPosition(1, 2), wxGBSpan(1, 1), (wxUP), 5);
|
||||
|
||||
// The choice box and its name label
|
||||
m_SizeAnalogTriggerHorizInput[i]->Add(m_tAnalogTriggerInput[i], 0, (wxUP), 2);
|
||||
m_SizeAnalogTriggerHorizInput[i]->Add(m_TriggerType[i], 0, (wxLEFT), 2);
|
||||
|
||||
// The status text boxes
|
||||
m_SizeAnalogTriggerVertLeft[i]->AddStretchSpacer();
|
||||
m_SizeAnalogTriggerVertLeft[i]->Add(m_SizeAnalogTriggerStatusBox[i]);
|
||||
m_SizeAnalogTriggerVertLeft[i]->AddStretchSpacer();
|
||||
|
||||
// The config grid and the input type choice box
|
||||
m_SizeAnalogTriggerVertRight[i]->Add(m_SizeAnalogTriggerHorizConfig[i], 0, (wxUP), 0);
|
||||
m_SizeAnalogTriggerVertRight[i]->Add(m_SizeAnalogTriggerHorizInput[i], 0, (wxUP | wxDOWN), 4);
|
||||
|
||||
m_gTrigger[i]->Add(m_SizeAnalogTriggerVertLeft[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
||||
m_gTrigger[i]->Add(m_SizeAnalogTriggerVertRight[i], 0, (wxLEFT | wxRIGHT), 5);
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Row 2 Sizers: Connected pads, tilt, triggers
|
||||
// -----------------------------
|
||||
m_HorizControllerTilt[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_HorizControllerTilt[i]->Add(m_gJoyname[i], 0, wxALIGN_CENTER | wxEXPAND, 0);
|
||||
m_HorizControllerTilt[i]->Add(m_gTilt[i], 0, (wxLEFT), 5);
|
||||
m_HorizControllerTilt[i]->Add(m_gTilt[i], 0, wxEXPAND | (wxLEFT), 5);
|
||||
m_HorizControllerTilt[i]->Add(m_gTrigger[i], 0, (wxLEFT), 5);
|
||||
|
||||
m_HorizControllerTiltParent[i] = new wxBoxSizer(wxBOTH);
|
||||
m_HorizControllerTiltParent[i]->Add(m_HorizControllerTilt[i]);
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Analog sticks
|
||||
// -----------------------------
|
||||
/**/
|
||||
m_pInStatus[i] = new wxPanel(m_Controller[i], wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpSquare[i] = new wxStaticBitmap(m_pInStatus[i], wxID_ANY, CreateBitmap(), wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpDot[i] = new wxStaticBitmap(m_pInStatus[i], wxID_ANY, CreateBitmapDot(), wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
|
||||
|
||||
// Status panels
|
||||
m_TStatusLeftIn[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("In"));
|
||||
m_TStatusLeftOut[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Out"));
|
||||
m_TStatusRightIn[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("In"));
|
||||
m_TStatusRightOut[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Out"));
|
||||
|
||||
m_pRightStatus[i] = new wxPanel(m_Controller[i], wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpSquareRight[i] = new wxStaticBitmap(m_pRightStatus[i], wxID_ANY, CreateBitmap(), wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpDotRight[i] = new wxStaticBitmap(m_pRightStatus[i], wxID_ANY, CreateBitmapDot(), wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
|
||||
m_pLeftInStatus[i] = new wxPanel(m_Controller[i], wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpSquareLeftIn[i] = new wxStaticBitmap(m_pLeftInStatus[i], wxID_ANY, CreateBitmap(), wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpDotLeftIn[i] = new wxStaticBitmap(m_pLeftInStatus[i], wxID_ANY, CreateBitmapDot(), wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
|
||||
|
||||
static const int TxtW = 50; static const int TxtH = 19;
|
||||
m_pLeftOutStatus[i] = new wxPanel(m_Controller[i], wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpSquareLeftOut[i] = new wxStaticBitmap(m_pLeftOutStatus[i], wxID_ANY, CreateBitmap(), wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpDotLeftOut[i] = new wxStaticBitmap(m_pLeftOutStatus[i], wxID_ANY, CreateBitmapDot(), wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
|
||||
|
||||
m_AnalogLeftX[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_LEFT, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_AnalogLeftY[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_LEFT, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_AnalogRightX[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_RIGHT, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_AnalogRightY[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_RIGHT, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_pRightInStatus[i] = new wxPanel(m_Controller[i], wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpSquareRightIn[i] = new wxStaticBitmap(m_pRightInStatus[i], wxID_ANY, CreateBitmap(), wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpDotRightIn[i] = new wxStaticBitmap(m_pRightInStatus[i], wxID_ANY, CreateBitmapDot(), wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
|
||||
|
||||
m_pRightOutStatus[i] = new wxPanel(m_Controller[i], wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpSquareRightOut[i] = new wxStaticBitmap(m_pRightOutStatus[i], wxID_ANY, CreateBitmap(), wxDefaultPosition, wxDefaultSize);
|
||||
m_bmpDotRightOut[i] = new wxStaticBitmap(m_pRightOutStatus[i], wxID_ANY, CreateBitmapDot(), wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
|
||||
|
||||
m_AnalogLeftX[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_LEFT_X, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_AnalogLeftY[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_LEFT_Y, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_AnalogRightX[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_RIGHT_X, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_AnalogRightY[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_RIGHT_Y, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
|
||||
m_AnalogLeftX[i]->Enable(false);
|
||||
m_AnalogLeftY[i]->Enable(false);
|
||||
m_AnalogRightX[i]->Enable(false);
|
||||
m_AnalogRightY[i]->Enable(false);
|
||||
|
||||
m_bAnalogLeftX[i] = new wxButton(m_Controller[i], IDB_ANALOG_LEFT, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogLeftY[i] = new wxButton(m_Controller[i], IDB_ANALOG_LEFT, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogRightX[i] = new wxButton(m_Controller[i], IDB_ANALOG_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogRightY[i] = new wxButton(m_Controller[i], IDB_ANALOG_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogLeftX[i] = new wxButton(m_Controller[i], IDB_ANALOG_LEFT_X, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogLeftY[i] = new wxButton(m_Controller[i], IDB_ANALOG_LEFT_Y, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogRightX[i] = new wxButton(m_Controller[i], IDB_ANALOG_RIGHT_X, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogRightY[i] = new wxButton(m_Controller[i], IDB_ANALOG_RIGHT_Y, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
|
||||
m_SizeAnalogLeft[i] = new wxBoxSizer(wxVERTICAL); m_SizeAnalogLeftHorizX[i] = new wxBoxSizer(wxHORIZONTAL); m_SizeAnalogLeftHorizY[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizeAnalogRight[i] = new wxBoxSizer(wxVERTICAL); m_SizeAnalogRightHorizX[i] = new wxBoxSizer(wxHORIZONTAL); m_SizeAnalogRightHorizY[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
@@ -491,6 +605,7 @@ void ConfigDialog::CreateGUIControls()
|
||||
m_tAnalogY[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Y-Axis"));
|
||||
m_tAnalogY[i + 4] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Y-Axis"));
|
||||
|
||||
// Configuration sizers
|
||||
m_SizeAnalogLeftHorizX[i]->Add(m_tAnalogX[i], 0, (wxUP), 2);
|
||||
m_SizeAnalogLeftHorizX[i]->Add(m_AnalogLeftX[i], 0, (wxRIGHT), 2);
|
||||
m_SizeAnalogLeftHorizX[i]->Add(m_bAnalogLeftX[i], 0, (wxUP), 2);
|
||||
@@ -514,76 +629,34 @@ void ConfigDialog::CreateGUIControls()
|
||||
m_SizeAnalogRight[i]->Add(m_SizeAnalogRightHorizY[i], 0, (wxUP), 0);
|
||||
m_SizeAnalogRight[i]->AddStretchSpacer();
|
||||
|
||||
m_gAnalogLeft[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog 1"));
|
||||
m_gAnalogLeft[i]->Add(m_pInStatus[i], 0, (wxLEFT | wxRIGHT), 5);
|
||||
// Status sizers
|
||||
m_GridLeftStick[i] = new wxGridBagSizer(0, 0);
|
||||
m_GridLeftStick[i]->Add(m_pLeftInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0);
|
||||
m_GridLeftStick[i]->Add(m_pLeftOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 5);
|
||||
m_GridLeftStick[i]->Add(m_TStatusLeftIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0);
|
||||
m_GridLeftStick[i]->Add(m_TStatusLeftOut[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 5);
|
||||
|
||||
m_GridRightStick[i] = new wxGridBagSizer(0, 0);
|
||||
m_GridRightStick[i]->Add(m_pRightInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0);
|
||||
m_GridRightStick[i]->Add(m_pRightOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 5);
|
||||
m_GridRightStick[i]->Add(m_TStatusRightIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0);
|
||||
m_GridRightStick[i]->Add(m_TStatusRightOut[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 5);
|
||||
|
||||
m_gAnalogLeft[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog 1 (In) (Out)"));
|
||||
m_gAnalogLeft[i]->Add(m_GridLeftStick[i], 0, (wxLEFT | wxRIGHT), 5);
|
||||
m_gAnalogLeft[i]->Add(m_SizeAnalogLeft[i], 0, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0);
|
||||
|
||||
m_gAnalogRight[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog 2"));
|
||||
m_gAnalogRight[i]->Add(m_pRightStatus[i], 0, (wxLEFT | wxRIGHT), 5);
|
||||
m_gAnalogRight[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog 2 (In) (Out)"));
|
||||
m_gAnalogRight[i]->Add(m_GridRightStick[i], 0, (wxLEFT | wxRIGHT), 5);
|
||||
m_gAnalogRight[i]->Add(m_SizeAnalogRight[i], 0, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0);
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Analog triggers
|
||||
// -----------------------------
|
||||
/**/
|
||||
m_gTrigger[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Triggers"));
|
||||
|
||||
m_TriggerStatusL[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left: "));
|
||||
m_TriggerStatusR[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Right: "));
|
||||
m_TriggerStatusLx[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("000"));
|
||||
m_TriggerStatusRx[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("000"));
|
||||
|
||||
m_tAnalogTriggerInput[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Input"));
|
||||
m_tAnalogTriggerL[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left"));
|
||||
m_tAnalogTriggerR[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Right"));
|
||||
|
||||
m_AnalogTriggerL[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_LEFT, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
m_AnalogTriggerR[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_LEFT, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE);
|
||||
|
||||
m_AnalogTriggerL[i]->Enable(false);
|
||||
m_AnalogTriggerR[i]->Enable(false);
|
||||
|
||||
m_bAnalogTriggerL[i] = new wxButton(m_Controller[i], IDB_ANALOG_LEFT, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
m_bAnalogTriggerR[i] = new wxButton(m_Controller[i], IDB_ANALOG_LEFT, wxEmptyString, wxDefaultPosition, wxSize(21, 14));
|
||||
|
||||
m_TriggerType[i] = new wxComboBox(m_Controller[i], wxID_ANY, StrTriggerType[0], wxDefaultPosition, wxDefaultSize, StrTriggerType, wxCB_READONLY);
|
||||
|
||||
m_SizeAnalogTriggerStatusBox[i] = new wxGridBagSizer(0, 0);
|
||||
m_SizeAnalogTriggerHorizConfig[i] = new wxGridBagSizer(0, 0);
|
||||
m_SizeAnalogTriggerVertLeft[i] = new wxBoxSizer(wxVERTICAL);
|
||||
m_SizeAnalogTriggerVertRight[i] = new wxBoxSizer(wxVERTICAL);
|
||||
m_SizeAnalogTriggerHorizInput[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusL[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxUP), 0);
|
||||
m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusLx[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxUP), 0);
|
||||
m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusR[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxUP), 0);
|
||||
m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusRx[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxUP), 0);
|
||||
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_tAnalogTriggerL[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxUP), 2);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_AnalogTriggerL[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT | wxRIGHT), 2);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_bAnalogTriggerL[i], wxGBPosition(0, 2), wxGBSpan(1, 1), (wxUP), 2);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_tAnalogTriggerR[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxUP), 4);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_AnalogTriggerR[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxLEFT | wxUP | wxRIGHT), 2);
|
||||
m_SizeAnalogTriggerHorizConfig[i]->Add(m_bAnalogTriggerR[i], wxGBPosition(1, 2), wxGBSpan(1, 1), (wxUP), 5);
|
||||
|
||||
m_SizeAnalogTriggerHorizInput[i]->Add(m_tAnalogTriggerInput[i], 0, (wxUP), 2);
|
||||
m_SizeAnalogTriggerHorizInput[i]->Add(m_TriggerType[i], 0, (wxLEFT), 2);
|
||||
|
||||
m_SizeAnalogTriggerVertLeft[i]->AddStretchSpacer();
|
||||
m_SizeAnalogTriggerVertLeft[i]->Add(m_SizeAnalogTriggerStatusBox[i]);
|
||||
m_SizeAnalogTriggerVertLeft[i]->AddStretchSpacer();
|
||||
|
||||
m_SizeAnalogTriggerVertRight[i]->Add(m_SizeAnalogTriggerHorizConfig[i], 0, (wxUP), 1);
|
||||
m_SizeAnalogTriggerVertRight[i]->Add(m_SizeAnalogTriggerHorizInput[i], 0, (wxUP | wxDOWN), 4);
|
||||
|
||||
m_gTrigger[i]->Add(m_SizeAnalogTriggerVertLeft[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
|
||||
m_gTrigger[i]->Add(m_SizeAnalogTriggerVertRight[i], 0, (wxLEFT | wxRIGHT), 5);
|
||||
|
||||
// Sizers
|
||||
// --------------------------------------------------------------------
|
||||
// Row 3 Sizers
|
||||
// -----------------------------
|
||||
m_HorizControllers[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_HorizControllers[i]->Add(m_gAnalogLeft[i]);
|
||||
m_HorizControllers[i]->Add(m_gAnalogRight[i], 0, (wxLEFT), 5);
|
||||
m_HorizControllers[i]->Add(m_gTrigger[i], 0, (wxLEFT), 5);
|
||||
///////////////////////////
|
||||
|
||||
|
||||
@@ -927,6 +1000,12 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
DoExtensionConnectedDisconnected();
|
||||
break;
|
||||
|
||||
//////////////////////////
|
||||
// Gamepad
|
||||
// -----------
|
||||
case ID_TRIGGER_TYPE:
|
||||
WiiMoteEmu::PadMapping[Page].triggertype = m_TriggerType[Page]->GetSelection();
|
||||
break;
|
||||
|
||||
//////////////////////////
|
||||
// Recording
|
||||
@@ -983,6 +1062,9 @@ void ConfigDialog::UpdateGUI()
|
||||
{
|
||||
//Console::Print("UpdateGUI: \n");
|
||||
|
||||
// Update the gamepad settings
|
||||
UpdateGUIButtonMapping(Page);
|
||||
|
||||
/* We only allow a change of extension if we are not currently using the real Wiimote, if it's in use the status will be updated
|
||||
from the data scanning functions in main.cpp */
|
||||
bool AllowExtensionChange = !(g_RealWiiMotePresent && g_Config.bConnectRealWiimote && g_Config.bUseRealWiimote && g_EmulatorRunning);
|
||||
|
||||
@@ -44,10 +44,13 @@ class ConfigDialog : public wxDialog
|
||||
|
||||
// General open, close and event functions
|
||||
void CloseClick(wxCommandEvent& event);
|
||||
void UpdateGUI();
|
||||
void UpdateGUI(); void UpdateGUIButtonMapping(int controller);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void LoadFile(); void SaveFile();
|
||||
|
||||
// Timers
|
||||
wxTimer *m_TimeoutTimer, *m_ShutDownTimer, *m_TimeoutOnce, *m_ButtonMappingTimer, *m_UpdatePad;
|
||||
|
||||
// General status
|
||||
wxStaticText * m_TextUpdateRate;
|
||||
|
||||
@@ -60,15 +63,18 @@ class ConfigDialog : public wxDialog
|
||||
void DoRecordMovement(u8 _x, u8 _y, u8 _z, const u8 *_IR, int IRBytes);
|
||||
void DoRecordA(bool Pressed);
|
||||
void ConvertToString();
|
||||
wxTimer *m_TimeoutTimer, *m_ShutDownTimer, *m_TimeoutOnce;
|
||||
void Update(wxTimerEvent& WXUNUSED(event));
|
||||
void ShutDown(wxTimerEvent& WXUNUSED(event));
|
||||
void UpdateOnce(wxTimerEvent& event);
|
||||
|
||||
// Gamepad configuration
|
||||
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
|
||||
void UpdatePad(wxTimerEvent& WXUNUSED(event));
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
bool ControlsCreated, m_bEnableUseRealWiimote; int Page, BoxW, BoxH;
|
||||
bool ControlsCreated, m_bEnableUseRealWiimote; int Page, BoxW, BoxH, g_Pressed;
|
||||
|
||||
wxNotebook *m_Notebook;
|
||||
wxPanel *m_Controller[4], *m_PageRecording;
|
||||
@@ -81,13 +87,15 @@ class ConfigDialog : public wxDialog
|
||||
*m_HorizControllers[4], *m_HorizControllerTiltParent[4], *m_HorizControllerTilt[4], *m_TiltHoriz[4],
|
||||
*m_SizeAnalogLeft[4], *m_SizeAnalogLeftHorizX[4], *m_SizeAnalogLeftHorizY[4], *m_SizeAnalogRight[4], *m_SizeAnalogRightHorizX[4], *m_SizeAnalogRightHorizY[4],
|
||||
*m_SizeAnalogTriggerVertLeft[4], *m_SizeAnalogTriggerVertRight[4], *m_SizeAnalogTriggerHorizInput[4];
|
||||
wxGridBagSizer *m_SizeAnalogTriggerHorizConfig[4], *m_SizeAnalogTriggerStatusBox[4];
|
||||
wxGridBagSizer *m_SizeAnalogTriggerHorizConfig[4], *m_SizeAnalogTriggerStatusBox[4],
|
||||
*m_GridLeftStick[4], *m_GridRightStick[4];
|
||||
wxStaticBoxSizer *m_SizeBasic[4], *m_SizeEmu[4], *m_SizeReal[4], *m_SizeExtensions[4], *m_gTilt[4], *m_gJoyname[4];
|
||||
wxTextCtrl *m_AnalogLeftX[4], *m_AnalogLeftY[4], *m_AnalogRightX[4], *m_AnalogRightY[4],
|
||||
*m_AnalogTriggerL[4], *m_AnalogTriggerR[4];
|
||||
wxButton *m_bAnalogLeftX[4], *m_bAnalogLeftY[4], *m_bAnalogRightX[4], *m_bAnalogRightY[4],
|
||||
*m_bAnalogTriggerL[4], *m_bAnalogTriggerR[4];
|
||||
wxStaticText *m_tAnalogX[8], *m_tAnalogY[8], *m_TiltText[4],
|
||||
*m_TStatusLeftIn[4], *m_TStatusLeftOut[4], *m_TStatusRightIn[4], *m_TStatusRightOut[4],
|
||||
*m_TriggerStatusL[4], *m_TriggerStatusR[4], *m_TriggerStatusLx[4], *m_TriggerStatusRx[4],
|
||||
*m_tAnalogTriggerInput[4], *m_tAnalogTriggerL[4], *m_tAnalogTriggerR[4];
|
||||
|
||||
@@ -101,8 +109,9 @@ class ConfigDialog : public wxDialog
|
||||
wxCheckBox *m_ConnectRealWiimote[4], *m_UseRealWiimote[4], *m_UpdateMeters;
|
||||
wxChoice *m_AccNeutralChoice[3], *m_AccNunNeutralChoice[3];
|
||||
|
||||
wxPanel *m_pInStatus[4], *m_pRightStatus[4];
|
||||
wxStaticBitmap *m_bmpDot[4], *m_bmpSquare[4], *m_bmpDotRight[4], *m_bmpSquareRight[4];
|
||||
wxPanel *m_pLeftInStatus[4], *m_pLeftOutStatus[4], *m_pRightInStatus[4], *m_pRightOutStatus[4];
|
||||
wxStaticBitmap *m_bmpDotLeftIn[4], *m_bmpDotLeftOut[4], *m_bmpDotRightIn[4], *m_bmpDotRightOut[4],
|
||||
*m_bmpSquareLeftIn[4], *m_bmpSquareLeftOut[4], *m_bmpSquareRightIn[4], *m_bmpSquareRightOut[4];
|
||||
wxStaticBoxSizer *m_gAnalogLeft[4], *m_gAnalogRight[4], *m_gTrigger[4];
|
||||
wxBitmap CreateBitmapDot(), CreateBitmap();
|
||||
|
||||
@@ -131,7 +140,7 @@ class ConfigDialog : public wxDialog
|
||||
ID_CLOSE = 1000,
|
||||
ID_APPLY,
|
||||
ID_ABOUTOGL,
|
||||
IDTM_EXIT, IDTM_UPDATE, IDTM_SHUTDOWN, IDTM_UPDATE_ONCE, // Timer
|
||||
IDTM_EXIT, IDTM_UPDATE, IDTM_SHUTDOWN, IDTM_UPDATE_ONCE, IDTM_BUTTON, IDTM_UPDATE_PAD, // Timer
|
||||
|
||||
ID_NOTEBOOK, ID_CONTROLLERPAGE1, ID_CONTROLLERPAGE2, ID_CONTROLLERPAGE3, ID_CONTROLLERPAGE4, ID_PAGE_RECORDING,
|
||||
|
||||
@@ -140,8 +149,17 @@ class ConfigDialog : public wxDialog
|
||||
ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED,
|
||||
IDC_JOYNAME, IDC_JOYATTACH, ID_TILT_COMBO, ID_TILT_CHECK,
|
||||
|
||||
ID_ANALOG_LEFT, IDB_ANALOG_LEFT, ID_ANALOG_RIGHT, IDB_ANALOG_RIGHT,
|
||||
ID_TRIGGER, IDB_TRIGGER,
|
||||
// Gamepad <It's important that the internal ordering of these are unchanged>
|
||||
IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y,
|
||||
IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y,
|
||||
IDB_TRIGGER_L, IDB_TRIGGER_R,
|
||||
|
||||
ID_ANALOG_LEFT_X, ID_ANALOG_LEFT_Y,
|
||||
ID_ANALOG_RIGHT_X, ID_ANALOG_RIGHT_Y,
|
||||
ID_TRIGGER_L, ID_TRIGGER_R,
|
||||
|
||||
// Gamepad settings
|
||||
ID_TRIGGER_TYPE,
|
||||
|
||||
// Real
|
||||
ID_CONNECT_REAL, ID_USE_REAL, ID_UPDATE_REAL, IDT_STATUS, ID_NEUTRAL_CHOICE,
|
||||
@@ -154,13 +172,23 @@ class ConfigDialog : public wxDialog
|
||||
void CreateGUIControls();
|
||||
void CreateGUIControlsRecording();
|
||||
void AboutClick(wxCommandEvent& event);
|
||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||
|
||||
void DoConnectReal(); // Real
|
||||
void DoUseReal();
|
||||
|
||||
void DoExtensionConnectedDisconnected(int Extension = -1); // Emulated
|
||||
|
||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||
// Gamepad configuration
|
||||
void SetButtonText(int id, char text[128], int _Page = -1); void SetButtonTextAll(int id, char text[128]);
|
||||
wxString GetButtonText(int id, int Page = -1);
|
||||
void GetButtons(wxCommandEvent& event); void DoGetButtons(int);
|
||||
void SaveButtonMapping(int controller, bool DontChangeId = false, int FromSlot = -1); void SaveButtonMappingAll(int Slot);
|
||||
void ToBlank(bool ToBlank = true);
|
||||
void PadGetStatus();
|
||||
|
||||
// Configure buttons
|
||||
int GetButtonWaitingID, GetButtonWaitingTimer;
|
||||
};
|
||||
|
||||
extern ConfigDialog *frame;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,8 +63,8 @@ bool g_Encryption; // Encryption on or off
|
||||
// Gamepad input
|
||||
int NumPads = 0, NumGoodPads = 0; // Number of goods pads
|
||||
std::vector<InputCommon::CONTROLLER_INFO> joyinfo;
|
||||
InputCommon::CONTROLLER_STATE PadState[4];
|
||||
InputCommon::CONTROLLER_MAPPING PadMapping[4];
|
||||
InputCommon::CONTROLLER_STATE_NEW PadState[4];
|
||||
InputCommon::CONTROLLER_MAPPING_NEW PadMapping[4];
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -173,8 +173,8 @@ static const u8 partially_id[] =
|
||||
// Gamepad input
|
||||
extern int NumPads, NumGoodPads; // Number of goods pads
|
||||
extern std::vector<InputCommon::CONTROLLER_INFO> joyinfo;
|
||||
extern InputCommon::CONTROLLER_STATE PadState[4];
|
||||
extern InputCommon::CONTROLLER_MAPPING PadMapping[4];
|
||||
extern InputCommon::CONTROLLER_STATE_NEW PadState[4];
|
||||
extern InputCommon::CONTROLLER_MAPPING_NEW PadMapping[4];
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
#include "pluginspecs_wiimote.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
@@ -30,6 +28,7 @@
|
||||
#include "Common.h" // Common
|
||||
#include "StringUtil.h" // for ArrayToString()
|
||||
#include "IniFile.h"
|
||||
#include "pluginspecs_wiimote.h"
|
||||
|
||||
#include "EmuDefinitions.h" // Local
|
||||
#include "main.h"
|
||||
@@ -130,7 +129,7 @@ void LoadRecordedMovements()
|
||||
for(int i = 0; i < RECORDING_ROWS; i++)
|
||||
{
|
||||
// Logging
|
||||
Console::Print("Recording%i ", i + 1);
|
||||
//Console::Print("Recording%i ", i + 1);
|
||||
|
||||
// Get row name
|
||||
std::string SaveName = StringFromFormat("Recording%i", i + 1);
|
||||
@@ -216,10 +215,11 @@ void LoadRecordedMovements()
|
||||
else
|
||||
TmpIRLog = "";
|
||||
|
||||
/*
|
||||
Console::Print("Size:%i HotKey:%i Speed:%i IR: %s\n",
|
||||
VRecording.at(i).Recording.size(), VRecording.at(i).HotKey, VRecording.at(i).PlaybackSpeed,
|
||||
TmpIRLog.c_str()
|
||||
);
|
||||
);*/
|
||||
// ---------------------
|
||||
}
|
||||
}
|
||||
@@ -302,36 +302,6 @@ void SetDefaultExtensionRegistry()
|
||||
}
|
||||
|
||||
|
||||
// ===================================================
|
||||
// Fill joyinfo with the current connected devices
|
||||
// ----------------
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads)
|
||||
{
|
||||
bool Success = InputCommon::SearchDevices(_joyinfo, _NumPads, _NumGoodPads);
|
||||
|
||||
// Warn the user if no gamepads are detected
|
||||
if (_NumGoodPads == 0 && g_EmulatorRunning)
|
||||
{
|
||||
//PanicAlert("nJoy: No Gamepad Detected");
|
||||
//return false;
|
||||
}
|
||||
|
||||
// Load PadMapping[] etc
|
||||
g_Config.Load();
|
||||
|
||||
// Update the PadState[].joy handle
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID)
|
||||
if(joyinfo.at(PadMapping[i].ID).Good)
|
||||
PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID);
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
// ===========================
|
||||
|
||||
|
||||
// ===================================================
|
||||
/* Write initial values to Eeprom and registers. */
|
||||
// ----------------
|
||||
@@ -389,7 +359,29 @@ void DoState(void* ptr, int mode)
|
||||
these variables. */
|
||||
void Shutdown(void)
|
||||
{
|
||||
Console::Print("ShutDown\n");
|
||||
|
||||
ResetVariables();
|
||||
|
||||
/* Close all devices carefully. We must check that we are not accessing any undefined
|
||||
vector elements or any bad devices */
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID)
|
||||
if (joyinfo.at(PadMapping[i].ID).Good)
|
||||
{
|
||||
Console::Print("ShutDown: %i\n", PadState[i].joy);
|
||||
/* SDL_JoystickClose() crashes for some reason so I avoid this for now, SDL_Quit() should
|
||||
close the pads to I think */
|
||||
//if(SDL_JoystickOpened(PadMapping[i].ID)) SDL_JoystickClose(PadState[i].joy);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the physical device info
|
||||
joyinfo.clear();
|
||||
|
||||
// Finally close SDL
|
||||
if (SDL_WasInit(0)) SDL_Quit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,9 +18,14 @@
|
||||
#ifndef WIIMOTE_EMU_H
|
||||
#define WIIMOTE_EMU_H
|
||||
|
||||
#include "wiimote_hid.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../../../Core/InputCommon/Src/SDL.h" // Core
|
||||
|
||||
#include "wiimote_hid.h"
|
||||
#include "EmuDefinitions.h"
|
||||
|
||||
namespace WiiMoteEmu
|
||||
{
|
||||
|
||||
@@ -43,6 +48,9 @@ void LoadRecordedMovements();
|
||||
void UpdateEeprom();
|
||||
void SetDefaultExtensionRegistry();
|
||||
|
||||
// Gamepad
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads);
|
||||
void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONTROLLER_MAPPING_NEW _PadMapping, int controller, int NumButtons);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "../../../Core/InputCommon/Src/SDL.h" // Core
|
||||
#include "../../../Core/InputCommon/Src/XInput.h"
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "StringUtil.h" // for ArrayToString()
|
||||
#include "IniFile.h"
|
||||
#include "pluginspecs_wiimote.h"
|
||||
|
||||
#include "EmuDefinitions.h" // Local
|
||||
#include "main.h"
|
||||
#include "wiimote_hid.h"
|
||||
#include "EmuSubroutines.h"
|
||||
#include "EmuMain.h"
|
||||
#include "Encryption.h" // for extension encryption
|
||||
#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
|
||||
#include "Config.h" // for g_Config
|
||||
////////////////////////////////////
|
||||
|
||||
extern SWiimoteInitialize g_WiimoteInitialize;
|
||||
|
||||
namespace WiiMoteEmu
|
||||
{
|
||||
|
||||
// ===================================================
|
||||
// Fill joyinfo with the current connected devices
|
||||
// ----------------
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads)
|
||||
{
|
||||
bool Success = InputCommon::SearchDevices(_joyinfo, _NumPads, _NumGoodPads);
|
||||
|
||||
// Warn the user if no gamepads are detected
|
||||
if (_NumGoodPads == 0 && g_EmulatorRunning)
|
||||
{
|
||||
//PanicAlert("nJoy: No Gamepad Detected");
|
||||
//return false;
|
||||
}
|
||||
|
||||
// Load PadMapping[] etc
|
||||
g_Config.Load();
|
||||
|
||||
// Update the PadState[].joy handle
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
if (PadMapping[i].enabled && joyinfo.size() > PadMapping[i].ID)
|
||||
if(joyinfo.at(PadMapping[i].ID).Good)
|
||||
PadState[i].joy = SDL_JoystickOpen(PadMapping[i].ID);
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
// ===========================
|
||||
|
||||
|
||||
// Request joystick state.
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
/* Called from: PAD_GetStatus()
|
||||
Input: The virtual device 0, 1, 2 or 3
|
||||
Function: Updates the PadState struct with the current pad status. The input value "controller" is
|
||||
for a virtual controller 0 to 3. */
|
||||
|
||||
void GetJoyState(InputCommon::CONTROLLER_STATE_NEW &_PadState, InputCommon::CONTROLLER_MAPPING_NEW _PadMapping, int controller, int NumButtons)
|
||||
{
|
||||
// Update the gamepad status
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
// Update axis states. It doesn't hurt much if we happen to ask for nonexisting axises here.
|
||||
_PadState.Axis.Lx = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.Axis.Lx);
|
||||
_PadState.Axis.Ly = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.Axis.Ly);
|
||||
_PadState.Axis.Rx = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.Axis.Rx);
|
||||
_PadState.Axis.Ry = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.Axis.Ry);
|
||||
|
||||
// Update the analog trigger axis values
|
||||
#ifdef _WIN32
|
||||
if (_PadMapping.triggertype == InputCommon::CTL_TRIGGER_SDL)
|
||||
{
|
||||
#endif
|
||||
// If we are using SDL analog triggers the buttons have to be mapped as 1000 or up, otherwise they are not used
|
||||
_PadState.Axis.Tl = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.Axis.Tl - 1000);
|
||||
_PadState.Axis.Tr = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.Axis.Tr - 1000);
|
||||
#ifdef _WIN32
|
||||
}
|
||||
else
|
||||
{
|
||||
_PadState.Axis.Tl = XInput::GetXI(0, _PadMapping.Axis.Tl - 1000);
|
||||
_PadState.Axis.Tr = XInput::GetXI(0, _PadMapping.Axis.Tr - 1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Debugging */
|
||||
Console::ClearScreen();
|
||||
Console::Print(
|
||||
"Controller and handle: %i %i\n"
|
||||
|
||||
"Triggers:%i %i %i %i %i\n",
|
||||
|
||||
controller, (int)_PadState.joy,
|
||||
|
||||
_PadMapping.triggertype,
|
||||
_PadMapping.Axis.Tl, _PadMapping.Axis.Tr,
|
||||
_PadState.Axis.Tl, _PadState.Axis.Tr
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace WiiMoteEmu
|
||||
@@ -77,7 +77,7 @@ void handle_event(struct wiimote_t* wm)
|
||||
{
|
||||
//Console::Print("\n\n--- EVENT [id %i] ---\n", wm->unid);
|
||||
|
||||
/* if a button is pressed, report it */
|
||||
// if a button is pressed, report it
|
||||
if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) Console::Print("A pressed\n");
|
||||
if (IS_PRESSED(wm, WIIMOTE_BUTTON_B)) Console::Print("B pressed\n");
|
||||
if (IS_PRESSED(wm, WIIMOTE_BUTTON_UP)) Console::Print("UP pressed\n");
|
||||
@@ -91,10 +91,9 @@ void handle_event(struct wiimote_t* wm)
|
||||
if (IS_PRESSED(wm, WIIMOTE_BUTTON_TWO)) Console::Print("TWO pressed\n");
|
||||
if (IS_PRESSED(wm, WIIMOTE_BUTTON_HOME)) Console::Print("HOME pressed\n");
|
||||
|
||||
/*
|
||||
* Pressing minus will tell the wiimote we are no longer interested in movement.
|
||||
* This is useful because it saves battery power.
|
||||
*/
|
||||
|
||||
// Pressing minus will tell the wiimote we are no longer interested in movement.
|
||||
// This is useful because it saves battery power.
|
||||
if (IS_JUST_PRESSED(wm, WIIMOTE_BUTTON_MINUS))
|
||||
{
|
||||
wiiuse_motion_sensing(wm, 0);
|
||||
@@ -112,16 +111,16 @@ void handle_event(struct wiimote_t* wm)
|
||||
if (g_MotionSensing && !WIIUSE_USING_IR(wm))
|
||||
wiiuse_set_ir(wm, 1);
|
||||
|
||||
/* Print battery status */
|
||||
// Print battery status
|
||||
if(frame && g_Config.bUpdateRealWiimote)
|
||||
frame->m_GaugeBattery->SetValue((int)floor((wm->battery_level * 100) + 0.5));
|
||||
|
||||
/* Create shortcut to the nunchuck */
|
||||
// Create shortcut to the nunchuck
|
||||
struct nunchuk_t* nc = NULL;
|
||||
if (wm->exp.type == EXP_NUNCHUK)
|
||||
nc = (nunchuk_t*)&wm->exp.nunchuk;
|
||||
|
||||
/* If the accelerometer is turned on then print angles */
|
||||
// If the accelerometer is turned on then print angles
|
||||
if (WIIUSE_USING_ACC(wm) && WIIUSE_USING_IR(wm))
|
||||
{
|
||||
std::string Tmp;
|
||||
@@ -333,7 +332,7 @@ void ReadWiimote()
|
||||
break;
|
||||
|
||||
case WIIUSE_GUITAR_HERO_3_CTRL_INSERTED:
|
||||
/* some expansion was inserted */
|
||||
// some expansion was inserted
|
||||
//handle_ctrl_status(wiimotes[i]);
|
||||
Console::Print("Guitar Hero 3 controller inserted.\n");
|
||||
break;
|
||||
@@ -341,7 +340,7 @@ void ReadWiimote()
|
||||
case WIIUSE_NUNCHUK_REMOVED:
|
||||
case WIIUSE_CLASSIC_CTRL_REMOVED:
|
||||
case WIIUSE_GUITAR_HERO_3_CTRL_REMOVED:
|
||||
/* some expansion was removed */
|
||||
// some expansion was removed
|
||||
//handle_ctrl_status(wiimotes[i]);
|
||||
Console::Print("An expansion was removed.\n");
|
||||
break;
|
||||
|
||||
@@ -11,6 +11,7 @@ files = [
|
||||
"DataReports.cpp",
|
||||
"EmuDefinitions.cpp",
|
||||
"EmuMain.cpp",
|
||||
"EmuPad.cpp",
|
||||
"EmuSubroutines.cpp",
|
||||
"Encryption.cpp",
|
||||
"main.cpp",
|
||||
@@ -18,6 +19,7 @@ files = [
|
||||
if wmenv['HAVE_WX']:
|
||||
files += [
|
||||
"ConfigDlg.cpp",
|
||||
"ConfigGamepad.cpp",
|
||||
"ConfigRecording.cpp",
|
||||
"Logging.cpp",
|
||||
"FillReport.cpp",
|
||||
|
||||
@@ -382,10 +382,13 @@ extern "C" unsigned int Wiimote_GetAttachedControllers()
|
||||
bool IsFocus()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HWND Parent = GetParent(g_WiimoteInitialize.hWnd);
|
||||
HWND RenderingWindow = g_WiimoteInitialize.hWnd;
|
||||
HWND Parent = GetParent(RenderingWindow);
|
||||
HWND TopLevel = GetParent(Parent);
|
||||
// Allow updates when the config window is in focus to
|
||||
HWND Config = NULL; if (frame) Config = (HWND)frame->GetHWND();
|
||||
// Support both rendering to main window and not
|
||||
if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == g_WiimoteInitialize.hWnd)
|
||||
if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == RenderingWindow || GetForegroundWindow() == Config)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
// Includes
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
#include <iostream> // System
|
||||
#include "pluginspecs_wiimote.h"
|
||||
#include <queue>
|
||||
|
||||
#include "wiiuse.h"
|
||||
#include <queue>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Thread.h"
|
||||
#include "StringUtil.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include "Timer.h"
|
||||
#include "pluginspecs_wiimote.h"
|
||||
|
||||
#include "wiimote_hid.h"
|
||||
#include "main.h"
|
||||
@@ -148,7 +148,7 @@ void ReadData()
|
||||
{
|
||||
//Console::Print("Writing data to the Wiimote\n");
|
||||
SEvent& rEvent = m_EventWriteQueue.front();
|
||||
wiiuse_io_write(m_pWiiMote, (byte*)rEvent.m_PayLoad, MAX_PAYLOAD);
|
||||
wiiuse_io_write(m_pWiiMote, (byte*)rEvent.m_PayLoad, MAX_PAYLOAD);
|
||||
m_EventWriteQueue.pop();
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -346,7 +346,7 @@ int Initialize()
|
||||
|
||||
// Call Wiiuse.dll
|
||||
g_WiiMotesFromWiiUse = wiiuse_init(MAX_WIIMOTES);
|
||||
g_NumberOfWiiMotes = wiiuse_find(g_WiiMotesFromWiiUse, MAX_WIIMOTES, 5);
|
||||
g_NumberOfWiiMotes = wiiuse_find(g_WiiMotesFromWiiUse, MAX_WIIMOTES, 5);
|
||||
if (g_NumberOfWiiMotes > 0) g_RealWiiMotePresent = true;
|
||||
Console::Print("Found No of Wiimotes: %i\n", g_NumberOfWiiMotes);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user