mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Now Dolphin officially supports Multi-WiiMote (up to 4)
* You can connect/disconnect one or more WiiMote from Menu->Tools any time (must pause game first) * Up to 4 Emulated Wiimotes can work together at the same timer (PS: "Wiimote_Real" needs to be rewritten to support Multi-WiiMote, and it could be broken already now) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4736 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Binary file not shown.
@@ -148,16 +148,6 @@ bool GetRealWiimote()
|
||||
return g_bRealWiimote;
|
||||
}
|
||||
|
||||
// This doesn't work yet, I don't understand how the connection work yet
|
||||
void ReconnectWiimote()
|
||||
{
|
||||
// This seems to be a hack that just sets some IPC registers to zero. Dubious.
|
||||
/* JP: Yes, it's basically nothing right now, I could not figure out how to reset the Wiimote
|
||||
for reconnection */
|
||||
HW::InitWiimote();
|
||||
INFO_LOG(CONSOLE, "ReconnectWiimote()\n");
|
||||
}
|
||||
|
||||
bool isRunning()
|
||||
{
|
||||
return (GetState() != CORE_UNINITIALIZED) || g_bHwInit;
|
||||
|
||||
@@ -61,7 +61,6 @@ namespace Core
|
||||
|
||||
void* GetWindowHandle();
|
||||
bool GetRealWiimote();
|
||||
void ReconnectWiimote();
|
||||
|
||||
extern bool bReadTrace;
|
||||
extern bool bWriteTrace;
|
||||
|
||||
@@ -44,9 +44,11 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
|
||||
, m_LastCmd(0)
|
||||
, m_FreqDividerSync(0)
|
||||
{
|
||||
// Activate the first one Wiimote by default
|
||||
// Activate only first Wiimote by default
|
||||
m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, 0, true));
|
||||
m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, 1));
|
||||
m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, 2));
|
||||
m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, 3));
|
||||
|
||||
// The BCM2045's btaddr:
|
||||
m_ControllerBD.b[0] = 0x11;
|
||||
@@ -89,6 +91,14 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
|
||||
p.Do(m_PacketCount[i]);
|
||||
p.Do(m_FreqDividerMote[i]);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
|
||||
m_WiiMotes[i].DoState(p);
|
||||
}
|
||||
|
||||
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::RemoteDisconnect(u16 _connectionHandle)
|
||||
{
|
||||
return SendEventDisconnect(_connectionHandle, 0x13);
|
||||
}
|
||||
|
||||
// ===================================================
|
||||
@@ -483,7 +493,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
|
||||
for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
|
||||
{
|
||||
m_FreqDividerMote[i]++;
|
||||
if (m_WiiMotes[i].IsLinked() && m_FreqDividerMote[i] >= 150)
|
||||
if (m_WiiMotes[i].IsConnected() == 3 && m_FreqDividerMote[i] >= 150)
|
||||
{
|
||||
m_FreqDividerMote[i] = 0;
|
||||
CPluginManager::GetInstance().GetWiimote(0)->Wiimote_Update(i);
|
||||
@@ -1390,13 +1400,13 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandDisconnect(u8* _Input)
|
||||
|
||||
SendEventDisconnect(pDiscon->con_handle, pDiscon->reason);
|
||||
|
||||
PanicAlert("Wiimote (%i) has been disconnected by system due to idle time out.\n"
|
||||
"Don't panic, this is quite a normal behavior for power saving.\n\n"
|
||||
"To reconnect, Pasue game and Click \"Menu -> Tools -> Connect Wiimote\"", (pDiscon->con_handle & 0xFF) + 1);
|
||||
|
||||
CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(pDiscon->con_handle);
|
||||
if (pWiimote)
|
||||
pWiimote->EventDisconnect();
|
||||
|
||||
// Send disconnect message to plugin
|
||||
u8 Message = WIIMOTE_RECONNECT;
|
||||
CPluginManager::GetInstance().GetWiimote(0)->Wiimote_ControlChannel(pDiscon->con_handle & 0xFF, 99, &Message, 0);
|
||||
pWiimote->EventDisconnect();
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input)
|
||||
@@ -1582,15 +1592,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandSniffMode(u8* _Input)
|
||||
DEBUG_LOG(WII_IPC_WIIMOTE, " timeout: 0x%04x", pSniffMode->timeout);
|
||||
|
||||
SendEventModeChange(pSniffMode->con_handle, 0x02, pSniffMode->max_interval); // 0x02 - sniff mode
|
||||
|
||||
// Now it is a good time to activate next wiimote
|
||||
u16 NextHandle = pSniffMode->con_handle + 1;
|
||||
if ((NextHandle & 0xFFu) < m_WiiMotes.size())
|
||||
{
|
||||
CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(NextHandle);
|
||||
if (pWiimote)
|
||||
pWiimote->Activate(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input)
|
||||
|
||||
@@ -83,6 +83,8 @@ public:
|
||||
void PurgeACLPool();
|
||||
void PurgeHCIPool();
|
||||
|
||||
bool RemoteDisconnect(u16 _connectionHandle);
|
||||
|
||||
//hack for wiimote plugin
|
||||
|
||||
public:
|
||||
|
||||
@@ -30,10 +30,13 @@
|
||||
|
||||
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb;
|
||||
|
||||
CWII_IPC_HLE_Device_usb_oh1_57e_305* GetUsbPointer()
|
||||
{
|
||||
return s_Usb;
|
||||
}
|
||||
|
||||
CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number, bool ready)
|
||||
: m_Linked(false)
|
||||
, m_HIDControlChannel_Connected(false)
|
||||
: m_HIDControlChannel_Connected(false)
|
||||
, m_HIDControlChannel_ConnectedWait(false)
|
||||
, m_HIDControlChannel_Config(false)
|
||||
, m_HIDControlChannel_ConfigWait(false)
|
||||
@@ -44,7 +47,6 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
|
||||
, m_Name("Nintendo RVL-CNT-01")
|
||||
, m_pHost(_pHost)
|
||||
|
||||
|
||||
{
|
||||
INFO_LOG(WII_IPC_WIIMOTE, "Wiimote: #%i Constructed", _Number);
|
||||
|
||||
@@ -78,6 +80,10 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
|
||||
lmp_subversion = 0x229;
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(m_Connected);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
@@ -92,7 +98,7 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
|
||||
|
||||
bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||
{
|
||||
if ((m_Connected <= 0) || (m_Linked == true))
|
||||
if (m_Connected != 2)
|
||||
return false;
|
||||
|
||||
// try to connect HID_CONTROL_CHANNEL
|
||||
@@ -139,7 +145,7 @@ bool CWII_IPC_HLE_WiiMote::LinkChannel()
|
||||
return true;
|
||||
}
|
||||
|
||||
m_Linked = true;
|
||||
m_Connected = 3;
|
||||
UpdateStatus();
|
||||
|
||||
return false;
|
||||
@@ -221,22 +227,29 @@ void CWII_IPC_HLE_WiiMote::UpdateStatus()
|
||||
//
|
||||
void CWII_IPC_HLE_WiiMote::Activate(bool ready)
|
||||
{
|
||||
if (ready)
|
||||
if (ready && m_Connected == -1)
|
||||
{
|
||||
m_Connected = 0;
|
||||
else
|
||||
m_Connected = -1;
|
||||
}
|
||||
else if (!ready)
|
||||
{
|
||||
m_pHost->RemoteDisconnect(m_ConnectionHandle);
|
||||
EventDisconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::EventConnectionAccepted()
|
||||
{
|
||||
m_Connected = 1;
|
||||
m_Linked = false;
|
||||
m_Connected = 2;
|
||||
}
|
||||
|
||||
void CWII_IPC_HLE_WiiMote::EventDisconnect()
|
||||
{
|
||||
// Send disconnect message to plugin
|
||||
u8 Message = WIIMOTE_DISCONNECT;
|
||||
CPluginManager::GetInstance().GetWiimote(0)->Wiimote_ControlChannel(m_ConnectionHandle & 0xFF, 99, &Message, 0);
|
||||
|
||||
m_Connected = -1;
|
||||
m_Linked = false;
|
||||
// Clear channel flags
|
||||
ResetChannels();
|
||||
}
|
||||
@@ -249,7 +262,7 @@ bool CWII_IPC_HLE_WiiMote::EventPagingChanged(u8 _pageMode)
|
||||
if ((_pageMode & 0x2) == 0)
|
||||
return false;
|
||||
|
||||
m_Connected = -1;
|
||||
m_Connected = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,14 @@
|
||||
#define _WII_IPC_HLE_WII_MOTE_
|
||||
|
||||
#include <map>
|
||||
#include "hci.h"
|
||||
#include <string>
|
||||
#include "hci.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305;
|
||||
|
||||
CWII_IPC_HLE_Device_usb_oh1_57e_305* GetUsbPointer();
|
||||
|
||||
enum
|
||||
{
|
||||
SDP_CHANNEL = 0x01,
|
||||
@@ -188,15 +191,15 @@ public:
|
||||
virtual ~CWII_IPC_HLE_WiiMote()
|
||||
{}
|
||||
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
// ugly Host handling....
|
||||
// we really have to clean all this code
|
||||
|
||||
int IsConnected() const { return m_Connected; }
|
||||
bool LinkChannel();
|
||||
void ResetChannels();
|
||||
void Activate(bool ready);
|
||||
bool IsConnected() const { return (m_Connected > 0) ? true : false; }
|
||||
bool IsLinked() const { return m_Linked; }
|
||||
void ShowStatus(const void* _pData); // Show status
|
||||
void UpdateStatus(); // Update status
|
||||
void ExecuteL2capCmd(u8* _pData, u32 _Size); // From CPU
|
||||
@@ -218,9 +221,9 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// state machine
|
||||
int m_Connected; // 0: ready, -1: inactive/connecting, 1: connected
|
||||
bool m_Linked;
|
||||
// -1: inactive, 0: ready, 1: connecting 2: linking 3: connected & linked
|
||||
int m_Connected;
|
||||
|
||||
bool m_HIDControlChannel_Connected;
|
||||
bool m_HIDControlChannel_ConnectedWait;
|
||||
bool m_HIDControlChannel_Config;
|
||||
|
||||
@@ -157,12 +157,6 @@ int abc = 0;
|
||||
else
|
||||
main_frame->bRenderToMain = true;
|
||||
return 0;
|
||||
|
||||
case WIIMOTE_RECONNECT:
|
||||
// The Wiimote plugin has been shut down, now reconnect the Wiimote
|
||||
//INFO_LOG(CONSOLE, "WIIMOTE_RECONNECT\n");
|
||||
Core::ReconnectWiimote();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -233,6 +227,10 @@ EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
|
||||
EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow)
|
||||
EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc)
|
||||
EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu)
|
||||
EVT_MENU(IDM_CONNECT_WIIMOTE1, CFrame::OnConnectWiimote)
|
||||
EVT_MENU(IDM_CONNECT_WIIMOTE2, CFrame::OnConnectWiimote)
|
||||
EVT_MENU(IDM_CONNECT_WIIMOTE3, CFrame::OnConnectWiimote)
|
||||
EVT_MENU(IDM_CONNECT_WIIMOTE4, CFrame::OnConnectWiimote)
|
||||
EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
|
||||
EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
|
||||
EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
|
||||
|
||||
@@ -311,6 +311,7 @@ class CFrame : public wxFrame
|
||||
|
||||
void OnShow_CheatsWindow(wxCommandEvent& event);
|
||||
void OnLoadWiiMenu(wxCommandEvent& event);
|
||||
void OnConnectWiimote(wxCommandEvent& event);
|
||||
void GameListChanged(wxCommandEvent& event);
|
||||
|
||||
void OnGameListCtrl_ItemActivated(wxListEvent& event);
|
||||
|
||||
@@ -62,6 +62,7 @@ Core::GetWindowHandle().
|
||||
#include "OnFrame.h"
|
||||
#include "HW/DVDInterface.h"
|
||||
#include "HW/ProcessorInterface.h"
|
||||
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
||||
#include "State.h"
|
||||
#include "VolumeHandler.h"
|
||||
#include "NANDContentLoader.h"
|
||||
@@ -90,6 +91,7 @@ extern "C" {
|
||||
#include "../resources/KDE.h"
|
||||
};
|
||||
|
||||
|
||||
// Other Windows
|
||||
wxCheatsWindow* CheatsWindow;
|
||||
|
||||
@@ -194,6 +196,11 @@ void CFrame::CreateMenu()
|
||||
{
|
||||
toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu"));
|
||||
}
|
||||
toolsMenu->AppendSeparator();
|
||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE1, _T("Connect Wiimote 1"));
|
||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE2, _T("Connect Wiimote 2"));
|
||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE3, _T("Connect Wiimote 3"));
|
||||
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, _T("Connect Wiimote 4"));
|
||||
|
||||
m_MenuBar->Append(toolsMenu, _T("&Tools"));
|
||||
|
||||
@@ -780,6 +787,12 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event))
|
||||
BootManager::BootCore(FULL_WII_MENU_DIR);
|
||||
}
|
||||
|
||||
void CFrame::OnConnectWiimote(wxCommandEvent& event)
|
||||
{
|
||||
int Id = event.GetId() - IDM_CONNECT_WIIMOTE1;
|
||||
GetUsbPointer()->AccessWiiMote(Id | 0x100)->Activate(event.IsChecked());
|
||||
}
|
||||
|
||||
// Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover
|
||||
// the entire screen (when we render to the main window).
|
||||
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
|
||||
@@ -918,6 +931,18 @@ void CFrame::UpdateGUI()
|
||||
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid())
|
||||
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
|
||||
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(Paused && Core::GetStartupParameter().bWii);
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Enable(Paused && Core::GetStartupParameter().bWii);
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(Paused && Core::GetStartupParameter().bWii);
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(Paused && Core::GetStartupParameter().bWii);
|
||||
if (Initialized && Core::GetStartupParameter().bWii)
|
||||
{
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->AccessWiiMote(0x0100)->IsConnected() == 3);
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(GetUsbPointer()->AccessWiiMote(0x0101)->IsConnected() == 3);
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(GetUsbPointer()->AccessWiiMote(0x0102)->IsConnected() == 3);
|
||||
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(GetUsbPointer()->AccessWiiMote(0x0103)->IsConnected() == 3);
|
||||
}
|
||||
|
||||
if (Running)
|
||||
{
|
||||
if (m_ToolBar)
|
||||
|
||||
@@ -95,6 +95,10 @@ enum
|
||||
IDM_PROPERTIES,
|
||||
IDM_LOAD_WII_MENU,
|
||||
IDM_LUA,
|
||||
IDM_CONNECT_WIIMOTE1,
|
||||
IDM_CONNECT_WIIMOTE2,
|
||||
IDM_CONNECT_WIIMOTE3,
|
||||
IDM_CONNECT_WIIMOTE4,
|
||||
|
||||
IDM_LISTWAD,
|
||||
IDM_LISTWII,
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
namespace InputCommon
|
||||
{
|
||||
|
||||
|
||||
// Settings
|
||||
// ----------
|
||||
// Show a status window with the detected axes, buttons and so on
|
||||
@@ -88,6 +87,7 @@ struct CONTROLLER_STATE // GC PAD INFO/STATE
|
||||
|
||||
struct CONTROLLER_MAPPING // GC PAD MAPPING
|
||||
{
|
||||
bool enable;
|
||||
int buttons[8]; // (See above)
|
||||
int dpad; // (See above)
|
||||
int dpad2[4]; // (See above)
|
||||
@@ -100,7 +100,6 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING
|
||||
std::string SRadius, SDiagonal, SRadiusC, SDiagonalC;
|
||||
bool bRadiusOnOff, bSquareToCircle, bRadiusOnOffC, bSquareToCircleC;
|
||||
bool rumble;
|
||||
bool enable;
|
||||
int eventnum; // Linux Event Number, Can't be found dynamically yet
|
||||
};
|
||||
|
||||
@@ -169,74 +168,6 @@ enum
|
||||
XI_TRIGGER_R
|
||||
};
|
||||
|
||||
|
||||
union PadAxis
|
||||
{
|
||||
int keyForControls[6];
|
||||
struct
|
||||
{
|
||||
int Lx;
|
||||
int Ly;
|
||||
int Rx;
|
||||
int Ry;
|
||||
int Tl; // Trigger
|
||||
int Tr; // Trigger
|
||||
};
|
||||
};
|
||||
struct PadWiimote
|
||||
{
|
||||
int keyForControls[16];
|
||||
// Order is A, B, 1, 2, +, -, Home
|
||||
// L, R, U, D, RollL, RollR, PitchU, PitchD, Shake
|
||||
};
|
||||
struct PadNunchuck
|
||||
{
|
||||
int keyForControls[11];
|
||||
// Order is Z, C, L, R, U, D, RollL, RollR, PitchU, PitchD, Shake
|
||||
};
|
||||
struct PadClassicController
|
||||
{
|
||||
int keyForControls[23];
|
||||
// Order is A, B, X, Y, +, -, Home
|
||||
// Tl, Zl, Zr, Tr, Dl, Dr, Du, Dd
|
||||
// Ll, Lr, Lu, Ld, Rl, Rr, Ru, Rd
|
||||
};
|
||||
struct PadGH3Controller
|
||||
{
|
||||
int keyForControls[14];
|
||||
// Order is Green, Red, Yellow, Blue, Orange,
|
||||
// +, -, Whammy,
|
||||
// Al, Ar, Au, Ad,
|
||||
// StrumUp, StrumDown
|
||||
};
|
||||
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)
|
||||
PadWiimote Wm;
|
||||
PadNunchuck Nc;
|
||||
PadClassicController Cc;
|
||||
PadGH3Controller GH3c;
|
||||
bool enabled; // Pad attached?
|
||||
bool Rumble;
|
||||
int RumbleStrength;
|
||||
int DeadZoneL; // Analog 1 Deadzone
|
||||
int DeadZoneR; // Analog 2 Deadzone
|
||||
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;
|
||||
bool bCircle2Square;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Declarations
|
||||
// ---------
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ enum PLUGIN_COMM
|
||||
TOGGLE_FULLSCREEN,
|
||||
VIDEO_DESTROY, // The video debugging window was destroyed
|
||||
AUDIO_DESTROY, // The audio debugging window was destroyed
|
||||
WIIMOTE_RECONNECT, // Reconnect the Wiimote if it has disconnected
|
||||
WIIMOTE_DISCONNECT, // Disconnect Wiimote
|
||||
INPUT_FRAME_COUNTER // Wind back the frame counter for rerecording
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Do not change the order unless you change the related arrays
|
||||
// Directionals are ordered as L, R, U, D
|
||||
|
||||
// Wiimote
|
||||
static const char* wmControlNames[] =
|
||||
{
|
||||
"WmA",
|
||||
@@ -49,51 +48,7 @@ static const char* wmControlNames[] =
|
||||
"WmPitchU",
|
||||
"WmPitchD",
|
||||
"WmShake",
|
||||
};
|
||||
static int wmDefaultControls[] =
|
||||
{
|
||||
#ifdef _WIN32
|
||||
'Z',
|
||||
'X',
|
||||
'C',
|
||||
'V',
|
||||
VK_OEM_PLUS,
|
||||
VK_OEM_MINUS,
|
||||
VK_BACK,
|
||||
VK_LEFT,
|
||||
VK_RIGHT,
|
||||
VK_UP,
|
||||
VK_DOWN,
|
||||
'N',
|
||||
'M',
|
||||
VK_OEM_COMMA,
|
||||
VK_OEM_PERIOD,
|
||||
VK_OEM_2 // /
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
'Z',
|
||||
'X',
|
||||
'C',
|
||||
'V',
|
||||
XK_equal,
|
||||
XK_minus,
|
||||
XK_BackSpace,
|
||||
XK_Left,
|
||||
XK_Right,
|
||||
XK_Up,
|
||||
XK_Down,
|
||||
'N',
|
||||
'M',
|
||||
XK_comma,
|
||||
XK_period,
|
||||
XK_slash
|
||||
#else
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
#endif
|
||||
};
|
||||
|
||||
// Nunchuk
|
||||
static const char* ncControlNames[] =
|
||||
{
|
||||
"NcZ",
|
||||
"NcC",
|
||||
"NcL",
|
||||
@@ -105,41 +60,7 @@ static const char* ncControlNames[] =
|
||||
"NcPitchU",
|
||||
"NcPitchD",
|
||||
"NcShake",
|
||||
};
|
||||
static int nCDefaultControls[] =
|
||||
{
|
||||
#ifdef _WIN32
|
||||
VK_NUMPAD0,
|
||||
VK_DECIMAL,
|
||||
VK_NUMPAD4,
|
||||
VK_NUMPAD6,
|
||||
VK_NUMPAD8,
|
||||
VK_NUMPAD5,
|
||||
VK_NUMPAD7,
|
||||
VK_NUMPAD9,
|
||||
VK_NUMPAD1,
|
||||
VK_NUMPAD3,
|
||||
VK_NUMPAD2
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
XK_KP_0,
|
||||
XK_KP_Decimal,
|
||||
XK_KP_4,
|
||||
XK_KP_6,
|
||||
XK_KP_8,
|
||||
XK_KP_5,
|
||||
XK_KP_7,
|
||||
XK_KP_9,
|
||||
XK_KP_1,
|
||||
XK_KP_3,
|
||||
XK_KP_2
|
||||
#else
|
||||
0,0,0,0,0,0,0,0,0,0,0
|
||||
#endif
|
||||
};
|
||||
|
||||
// Classic Controller
|
||||
static const char* ccControlNames[] =
|
||||
{
|
||||
"CcA",
|
||||
"CcB",
|
||||
"CcX",
|
||||
@@ -163,9 +84,94 @@ static const char* ccControlNames[] =
|
||||
"CcRr",
|
||||
"CcRu",
|
||||
"CcRd",
|
||||
|
||||
"GH3Green",
|
||||
"GH3Red",
|
||||
"GH3Yellow",
|
||||
"GH3Blue",
|
||||
"GH3Orange",
|
||||
"GH3Plus",
|
||||
"GH3Minus",
|
||||
"GH3Whammy",
|
||||
"GH3Al",
|
||||
"GH3Ar",
|
||||
"GH3Au",
|
||||
"GH3Ad",
|
||||
"GH3StrumUp",
|
||||
"GH3StrumDown",
|
||||
};
|
||||
static int ccDefaultControls[] =
|
||||
|
||||
static int wmDefaultControls[] =
|
||||
{
|
||||
// Wiimote
|
||||
#ifdef _WIN32
|
||||
'Z',
|
||||
'X',
|
||||
'C',
|
||||
'V',
|
||||
VK_OEM_PLUS,
|
||||
VK_OEM_MINUS,
|
||||
VK_BACK,
|
||||
VK_LEFT,
|
||||
VK_RIGHT,
|
||||
VK_UP,
|
||||
VK_DOWN,
|
||||
'N',
|
||||
'M',
|
||||
VK_OEM_COMMA,
|
||||
VK_OEM_PERIOD,
|
||||
VK_OEM_2, // /
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
'Z',
|
||||
'X',
|
||||
'C',
|
||||
'V',
|
||||
XK_equal,
|
||||
XK_minus,
|
||||
XK_BackSpace,
|
||||
XK_Left,
|
||||
XK_Right,
|
||||
XK_Up,
|
||||
XK_Down,
|
||||
'N',
|
||||
'M',
|
||||
XK_comma,
|
||||
XK_period,
|
||||
XK_slash,
|
||||
#else
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
#endif
|
||||
|
||||
// Nunchuck
|
||||
#ifdef _WIN32
|
||||
VK_NUMPAD0,
|
||||
VK_DECIMAL,
|
||||
VK_NUMPAD4,
|
||||
VK_NUMPAD6,
|
||||
VK_NUMPAD8,
|
||||
VK_NUMPAD5,
|
||||
VK_NUMPAD7,
|
||||
VK_NUMPAD9,
|
||||
VK_NUMPAD1,
|
||||
VK_NUMPAD3,
|
||||
VK_NUMPAD2,
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
XK_KP_0,
|
||||
XK_KP_Decimal,
|
||||
XK_KP_4,
|
||||
XK_KP_6,
|
||||
XK_KP_8,
|
||||
XK_KP_5,
|
||||
XK_KP_7,
|
||||
XK_KP_9,
|
||||
XK_KP_1,
|
||||
XK_KP_3,
|
||||
XK_KP_2,
|
||||
#else
|
||||
0,0,0,0,0,0,0,0,0,0,0,
|
||||
#endif
|
||||
|
||||
// Classic Controller
|
||||
// A, B, X, Y
|
||||
#ifdef _WIN32
|
||||
VK_OEM_4, // [
|
||||
@@ -212,29 +218,9 @@ static int ccDefaultControls[] =
|
||||
'J',
|
||||
'L',
|
||||
'I',
|
||||
'K'
|
||||
};
|
||||
'K',
|
||||
|
||||
// GH3 Default controls
|
||||
static const char* gh3ControlNames[] =
|
||||
{
|
||||
"GH3Green",
|
||||
"GH3Red",
|
||||
"GH3Yellow",
|
||||
"GH3Blue",
|
||||
"GH3Orange",
|
||||
"GH3Plus",
|
||||
"GH3Minus",
|
||||
"GH3Whammy",
|
||||
"GH3Al",
|
||||
"GH3Ar",
|
||||
"GH3Au",
|
||||
"GH3Ad",
|
||||
"GH3StrumUp",
|
||||
"GH3StrumDown",
|
||||
};
|
||||
static int GH3DefaultControls[] =
|
||||
{
|
||||
// Guttar Hero
|
||||
'A',
|
||||
'S',
|
||||
'D',
|
||||
@@ -269,22 +255,14 @@ Config::Config()
|
||||
memset(this, 0, sizeof(Config));
|
||||
}
|
||||
|
||||
void Config::Load(bool ChangePad)
|
||||
void Config::Load()
|
||||
{
|
||||
std::string temp;
|
||||
IniFile iniFile;
|
||||
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
|
||||
// General
|
||||
iniFile.Get("Settings", "InputActive", &bInputActive, true);
|
||||
iniFile.Get("Settings", "Sideways", &bSideways, false);
|
||||
iniFile.Get("Settings", "Upright", &bUpright, false);
|
||||
iniFile.Get("Settings", "ExtensionConnected", &iExtensionConnected, EXT_NONE);
|
||||
iniFile.Get("Settings", "MotionPlusConnected", &bMotionPlusConnected, false);
|
||||
|
||||
// Real Wiimote
|
||||
iniFile.Get("Real", "Connect", &bConnectRealWiimote, true);
|
||||
iniFile.Get("Real", "Use", &bUseRealWiimote, false);
|
||||
iniFile.Get("Real", "UpdateStatus", &bUpdateRealWiimote, true);
|
||||
iniFile.Get("Real", "AccNeutralX", &iAccNeutralX, 0);
|
||||
iniFile.Get("Real", "AccNeutralY", &iAccNeutralY, 0);
|
||||
@@ -298,72 +276,55 @@ void Config::Load(bool ChangePad)
|
||||
// Slot specific settings
|
||||
char SectionName[32];
|
||||
sprintf(SectionName, "Wiimote%i", i + 1);
|
||||
iniFile.Get(SectionName, "NoTriggerFilter", &bNoTriggerFilter, false);
|
||||
|
||||
iniFile.Get(SectionName, "TiltTypeWM", &Tilt.TypeWM, Tilt.KEYBOARD);
|
||||
iniFile.Get(SectionName, "TiltTypeNC", &Tilt.TypeNC, Tilt.KEYBOARD);
|
||||
iniFile.Get(SectionName, "TiltRollSwing", &Tilt.Range.RollSwing, false);
|
||||
iniFile.Get(SectionName, "TiltRollDegree", &Tilt.Range.RollDegree, 60);
|
||||
Tilt.Range.Roll = (Tilt.Range.RollSwing) ? 0 : Tilt.Range.RollDegree;
|
||||
iniFile.Get(SectionName, "TiltRollInvert", &Tilt.RollInvert, false);
|
||||
iniFile.Get(SectionName, "TiltPitchSwing", &Tilt.Range.PitchSwing, false);
|
||||
iniFile.Get(SectionName, "TiltPitchDegree", &Tilt.Range.PitchDegree, 60);
|
||||
Tilt.Range.Pitch = (Tilt.Range.PitchSwing) ? 0 : Tilt.Range.PitchDegree;
|
||||
iniFile.Get(SectionName, "TiltPitchInvert", &Tilt.PitchInvert, false);
|
||||
// General
|
||||
iniFile.Get(SectionName, "Source", &WiiMoteEmu::WiiMapping[i].Source, (i) ? 0 : 1);
|
||||
iniFile.Get(SectionName, "Sideways", &WiiMoteEmu::WiiMapping[i].bSideways, false);
|
||||
iniFile.Get(SectionName, "Upright", &WiiMoteEmu::WiiMapping[i].bUpright, false);
|
||||
iniFile.Get(SectionName, "ExtensionConnected", &WiiMoteEmu::WiiMapping[i].iExtensionConnected, WiiMoteEmu::EXT_NONE);
|
||||
iniFile.Get(SectionName, "MotionPlusConnected", &WiiMoteEmu::WiiMapping[i].bMotionPlusConnected, false);
|
||||
|
||||
// Wiimote
|
||||
for (int x = 0; x < WM_CONTROLS; x++)
|
||||
iniFile.Get(SectionName, wmControlNames[x], &WiiMoteEmu::PadMapping[i].Wm.keyForControls[x], wmDefaultControls[x]);
|
||||
// Nunchuck
|
||||
iniFile.Get(SectionName, "NunchuckStick", &Nunchuck.Type, Nunchuck.KEYBOARD);
|
||||
for (int x = 0; x < NC_CONTROLS; x++)
|
||||
iniFile.Get(SectionName, ncControlNames[x], &WiiMoteEmu::PadMapping[i].Nc.keyForControls[x], nCDefaultControls[x]);
|
||||
iniFile.Get(SectionName, "TiltInputWM", &WiiMoteEmu::WiiMapping[i].Tilt.InputWM, WiiMoteEmu::FROM_KEYBOARD);
|
||||
iniFile.Get(SectionName, "TiltInputNC", &WiiMoteEmu::WiiMapping[i].Tilt.InputNC, WiiMoteEmu::FROM_KEYBOARD);
|
||||
iniFile.Get(SectionName, "TiltRollDegree", &WiiMoteEmu::WiiMapping[i].Tilt.RollDegree, 60);
|
||||
iniFile.Get(SectionName, "TiltRollSwing", &WiiMoteEmu::WiiMapping[i].Tilt.RollSwing, false);
|
||||
iniFile.Get(SectionName, "TiltRollInvert", &WiiMoteEmu::WiiMapping[i].Tilt.RollInvert, false);
|
||||
WiiMoteEmu::WiiMapping[i].Tilt.RollRange = (WiiMoteEmu::WiiMapping[i].Tilt.RollSwing) ? 0 : WiiMoteEmu::WiiMapping[i].Tilt.RollDegree;
|
||||
iniFile.Get(SectionName, "TiltPitchDegree", &WiiMoteEmu::WiiMapping[i].Tilt.PitchDegree, 60);
|
||||
iniFile.Get(SectionName, "TiltPitchSwing", &WiiMoteEmu::WiiMapping[i].Tilt.PitchSwing, false);
|
||||
iniFile.Get(SectionName, "TiltPitchInvert", &WiiMoteEmu::WiiMapping[i].Tilt.PitchInvert, false);
|
||||
WiiMoteEmu::WiiMapping[i].Tilt.PitchRange = (WiiMoteEmu::WiiMapping[i].Tilt.PitchSwing) ? 0 : WiiMoteEmu::WiiMapping[i].Tilt.PitchDegree;
|
||||
|
||||
// Classic Controller
|
||||
iniFile.Get(SectionName, "CcLeftStick", &ClassicController.LType, ClassicController.KEYBOARD);
|
||||
iniFile.Get(SectionName, "CcRightStick", &ClassicController.RType, ClassicController.KEYBOARD);
|
||||
iniFile.Get(SectionName, "CcTriggers", &ClassicController.TType, ClassicController.KEYBOARD);
|
||||
for (int x = 0; x < CC_CONTROLS; x++)
|
||||
iniFile.Get(SectionName, ccControlNames[x], &WiiMoteEmu::PadMapping[i].Cc.keyForControls[x], ccDefaultControls[x]);
|
||||
// StickMapping
|
||||
iniFile.Get(SectionName, "NCStick", &WiiMoteEmu::WiiMapping[i].Stick.NC, WiiMoteEmu::FROM_KEYBOARD);
|
||||
iniFile.Get(SectionName, "CCStickLeft", &WiiMoteEmu::WiiMapping[i].Stick.CCL, WiiMoteEmu::FROM_KEYBOARD);
|
||||
iniFile.Get(SectionName, "CCStickRight", &WiiMoteEmu::WiiMapping[i].Stick.CCR, WiiMoteEmu::FROM_KEYBOARD);
|
||||
iniFile.Get(SectionName, "CCTriggers", &WiiMoteEmu::WiiMapping[i].Stick.CCT, WiiMoteEmu::FROM_KEYBOARD);
|
||||
iniFile.Get(SectionName, "GHStick", &WiiMoteEmu::WiiMapping[i].Stick.GH, WiiMoteEmu::FROM_KEYBOARD);
|
||||
|
||||
iniFile.Get(SectionName, "GH3Analog", &GH3Controller.AType, GH3Controller.ANALOG1);
|
||||
for (int x = 0; x < GH3_CONTROLS; x++)
|
||||
iniFile.Get(SectionName, gh3ControlNames[x], &WiiMoteEmu::PadMapping[i].GH3c.keyForControls[x], GH3DefaultControls[x]);
|
||||
// ButtonMapping
|
||||
for (int x = 0; x < WiiMoteEmu::LAST_CONSTANT; x++)
|
||||
iniFile.Get(SectionName, wmControlNames[x], &WiiMoteEmu::WiiMapping[i].Button[x], wmDefaultControls[x]);
|
||||
|
||||
// Don't update this when we are loading settings from the ConfigBox
|
||||
if(!ChangePad)
|
||||
{
|
||||
// This pad Id could possibly be higher than the number of pads that are connected,
|
||||
// but we check later, when needed, that that is not the case
|
||||
iniFile.Get(SectionName, "DeviceID", &WiiMoteEmu::PadMapping[i].ID, 0);
|
||||
iniFile.Get(SectionName, "Enabled", &WiiMoteEmu::PadMapping[i].enabled, true);
|
||||
}
|
||||
// This pad Id could possibly be higher than the number of pads that are connected,
|
||||
// but we check later, when needed, that that is not the case
|
||||
iniFile.Get(SectionName, "DeviceID", &WiiMoteEmu::WiiMapping[i].ID, 0);
|
||||
|
||||
// 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((u32)WiiMoteEmu::PadMapping[i].ID >= WiiMoteEmu::joyinfo.size()) continue;
|
||||
|
||||
// Create a section name
|
||||
std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name;
|
||||
|
||||
iniFile.Get(joySectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0);
|
||||
iniFile.Get(joySectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1);
|
||||
iniFile.Get(joySectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2);
|
||||
iniFile.Get(joySectionName.c_str(), "right_y", &WiiMoteEmu::PadMapping[i].Axis.Ry, 3);
|
||||
iniFile.Get(joySectionName.c_str(), "l_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tl, 1004);
|
||||
iniFile.Get(joySectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 1005);
|
||||
iniFile.Get(joySectionName.c_str(), "DeadZoneL", &WiiMoteEmu::PadMapping[i].DeadZoneL, 0);
|
||||
iniFile.Get(joySectionName.c_str(), "DeadZoneR", &WiiMoteEmu::PadMapping[i].DeadZoneR, 0);
|
||||
iniFile.Get(joySectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%");
|
||||
iniFile.Get(joySectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false);
|
||||
iniFile.Get(joySectionName.c_str(), "Rumble", &WiiMoteEmu::PadMapping[i].Rumble, true);
|
||||
iniFile.Get(joySectionName.c_str(), "RumbleStrength", &WiiMoteEmu::PadMapping[i].RumbleStrength, 9); // x10
|
||||
iniFile.Get(joySectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0);
|
||||
iniFile.Get(SectionName, "Axis_Lx", &WiiMoteEmu::WiiMapping[i].AxisMapping.Lx, 0);
|
||||
iniFile.Get(SectionName, "Axis_Ly", &WiiMoteEmu::WiiMapping[i].AxisMapping.Ly, 1);
|
||||
iniFile.Get(SectionName, "Axis_Rx", &WiiMoteEmu::WiiMapping[i].AxisMapping.Rx, 2);
|
||||
iniFile.Get(SectionName, "Axis_Ry", &WiiMoteEmu::WiiMapping[i].AxisMapping.Ry, 3);
|
||||
iniFile.Get(SectionName, "Trigger_L", &WiiMoteEmu::WiiMapping[i].AxisMapping.Tl, 1004);
|
||||
iniFile.Get(SectionName, "Trigger_R", &WiiMoteEmu::WiiMapping[i].AxisMapping.Tr, 1005);
|
||||
iniFile.Get(SectionName, "DeadZoneL", &WiiMoteEmu::WiiMapping[i].DeadZoneL, 0);
|
||||
iniFile.Get(SectionName, "DeadZoneR", &WiiMoteEmu::WiiMapping[i].DeadZoneR, 0);
|
||||
iniFile.Get(SectionName, "Diagonal", &WiiMoteEmu::WiiMapping[i].Diagonal, "100%");
|
||||
iniFile.Get(SectionName, "Circle2Square", &WiiMoteEmu::WiiMapping[i].bCircle2Square, false);
|
||||
iniFile.Get(SectionName, "Rumble", &WiiMoteEmu::WiiMapping[i].Rumble, true);
|
||||
iniFile.Get(SectionName, "RumbleStrength", &WiiMoteEmu::WiiMapping[i].RumbleStrength, 8); // x10
|
||||
iniFile.Get(SectionName, "TriggerType", &WiiMoteEmu::WiiMapping[i].TriggerType, 0);
|
||||
}
|
||||
|
||||
// Load the IR cursor settings if it's avaliable for the GameId, if not load the default settings
|
||||
iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini");
|
||||
char TmpSection[32];
|
||||
@@ -375,7 +336,6 @@ void Config::Load(bool ChangePad)
|
||||
|
||||
// Load a few screen settings to. If these are added to the DirectX plugin it's probably
|
||||
// better to place them in the main Dolphin.ini file
|
||||
|
||||
iniFile.Load(FULL_CONFIG_DIR "gfx_opengl.ini");
|
||||
iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false);
|
||||
iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false);
|
||||
@@ -384,18 +344,12 @@ void Config::Load(bool ChangePad)
|
||||
//DEBUG_LOG(WIIMOTE, "Load()");
|
||||
}
|
||||
|
||||
void Config::Save(int Slot)
|
||||
void Config::Save()
|
||||
{
|
||||
IniFile iniFile;
|
||||
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
iniFile.Set("Settings", "InputActive", bInputActive);
|
||||
iniFile.Set("Settings", "Sideways", bSideways);
|
||||
iniFile.Set("Settings", "Upright", bUpright);
|
||||
iniFile.Set("Settings", "MotionPlusConnected", bMotionPlusConnected);
|
||||
iniFile.Set("Settings", "ExtensionConnected", iExtensionConnected);
|
||||
|
||||
iniFile.Set("Real", "Connect", bConnectRealWiimote);
|
||||
iniFile.Set("Real", "Use", bUseRealWiimote);
|
||||
iniFile.Set("Real", "UpdateStatus", bUpdateRealWiimote);
|
||||
iniFile.Set("Real", "AccNeutralX", iAccNeutralX);
|
||||
iniFile.Set("Real", "AccNeutralY", iAccNeutralY);
|
||||
@@ -410,64 +364,48 @@ void Config::Save(int Slot)
|
||||
char SectionName[32];
|
||||
sprintf(SectionName, "Wiimote%i", i + 1);
|
||||
|
||||
iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter);
|
||||
iniFile.Set(SectionName, "TiltTypeWM", Tilt.TypeWM);
|
||||
iniFile.Set(SectionName, "TiltTypeNC", Tilt.TypeNC);
|
||||
iniFile.Set(SectionName, "TiltRollDegree", Tilt.Range.RollDegree);
|
||||
iniFile.Set(SectionName, "TiltRollSwing", Tilt.Range.RollSwing);
|
||||
iniFile.Set(SectionName, "TiltRollInvert", Tilt.RollInvert);
|
||||
iniFile.Set(SectionName, "TiltPitchDegree", Tilt.Range.PitchDegree);
|
||||
iniFile.Set(SectionName, "TiltPitchSwing", Tilt.Range.PitchSwing);
|
||||
iniFile.Set(SectionName, "TiltPitchInvert", Tilt.PitchInvert);
|
||||
// Wiimote
|
||||
for (int x = 0; x < WM_CONTROLS; x++)
|
||||
iniFile.Set(SectionName, wmControlNames[x], WiiMoteEmu::PadMapping[i].Wm.keyForControls[x]);
|
||||
iniFile.Set(SectionName, "Source", WiiMoteEmu::WiiMapping[i].Source);
|
||||
iniFile.Set(SectionName, "Sideways", WiiMoteEmu::WiiMapping[i].bSideways);
|
||||
iniFile.Set(SectionName, "Upright", WiiMoteEmu::WiiMapping[i].bUpright);
|
||||
iniFile.Set(SectionName, "ExtensionConnected", WiiMoteEmu::WiiMapping[i].iExtensionConnected);
|
||||
iniFile.Set(SectionName, "MotionPlusConnected", WiiMoteEmu::WiiMapping[i].bMotionPlusConnected);
|
||||
|
||||
// Nunchuck
|
||||
iniFile.Set(SectionName, "NunchuckStick", Nunchuck.Type);
|
||||
for (int x = 0; x < NC_CONTROLS; x++)
|
||||
iniFile.Set(SectionName, ncControlNames[x], WiiMoteEmu::PadMapping[i].Nc.keyForControls[x]);
|
||||
iniFile.Set(SectionName, "TiltInputWM", WiiMoteEmu::WiiMapping[i].Tilt.InputWM);
|
||||
iniFile.Set(SectionName, "TiltInputNC", WiiMoteEmu::WiiMapping[i].Tilt.InputNC);
|
||||
iniFile.Set(SectionName, "TiltRollDegree", WiiMoteEmu::WiiMapping[i].Tilt.RollDegree);
|
||||
iniFile.Set(SectionName, "TiltRollSwing", WiiMoteEmu::WiiMapping[i].Tilt.RollSwing);
|
||||
iniFile.Set(SectionName, "TiltRollInvert", WiiMoteEmu::WiiMapping[i].Tilt.RollInvert);
|
||||
iniFile.Set(SectionName, "TiltPitchDegree", WiiMoteEmu::WiiMapping[i].Tilt.PitchDegree);
|
||||
iniFile.Set(SectionName, "TiltPitchSwing", WiiMoteEmu::WiiMapping[i].Tilt.PitchSwing);
|
||||
iniFile.Set(SectionName, "TiltPitchInvert", WiiMoteEmu::WiiMapping[i].Tilt.PitchInvert);
|
||||
|
||||
// Classic Controller
|
||||
iniFile.Set(SectionName, "CcLeftStick", ClassicController.LType);
|
||||
iniFile.Set(SectionName, "CcRightStick", ClassicController.RType);
|
||||
iniFile.Set(SectionName, "CcTriggers", ClassicController.TType);
|
||||
for (int x = 0; x < CC_CONTROLS; x++)
|
||||
iniFile.Set(SectionName, ccControlNames[x], WiiMoteEmu::PadMapping[i].Cc.keyForControls[x]);
|
||||
// StickMapping
|
||||
iniFile.Set(SectionName, "NCStick", WiiMoteEmu::WiiMapping[i].Stick.NC);
|
||||
iniFile.Set(SectionName, "CCStickLeft", WiiMoteEmu::WiiMapping[i].Stick.CCL);
|
||||
iniFile.Set(SectionName, "CCStickRight", WiiMoteEmu::WiiMapping[i].Stick.CCR);
|
||||
iniFile.Set(SectionName, "CCTriggers", WiiMoteEmu::WiiMapping[i].Stick.CCT);
|
||||
iniFile.Set(SectionName, "GHStick", WiiMoteEmu::WiiMapping[i].Stick.GH);
|
||||
|
||||
// GH3
|
||||
iniFile.Set(SectionName, "GH3Analog", GH3Controller.AType);
|
||||
for (int x = 0; x < GH3_CONTROLS; x++)
|
||||
iniFile.Set(SectionName, gh3ControlNames[x], WiiMoteEmu::PadMapping[i].GH3c.keyForControls[x]);
|
||||
// ButtonMapping
|
||||
for (int x = 0; x < WiiMoteEmu::LAST_CONSTANT; x++)
|
||||
iniFile.Set(SectionName, wmControlNames[x], WiiMoteEmu::WiiMapping[i].Button[x]);
|
||||
|
||||
// Save the physical device ID number
|
||||
iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled);
|
||||
iniFile.Set(SectionName, "DeviceID", WiiMoteEmu::PadMapping[i].ID);
|
||||
iniFile.Set(SectionName, "DeviceID", WiiMoteEmu::WiiMapping[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((u32)WiiMoteEmu::PadMapping[i].ID >= WiiMoteEmu::joyinfo.size()) continue;
|
||||
|
||||
// Create a new section name after the joypad name
|
||||
std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name;
|
||||
|
||||
iniFile.Set(joySectionName.c_str(), "left_x", WiiMoteEmu::PadMapping[i].Axis.Lx);
|
||||
iniFile.Set(joySectionName.c_str(), "left_y", WiiMoteEmu::PadMapping[i].Axis.Ly);
|
||||
iniFile.Set(joySectionName.c_str(), "right_x", WiiMoteEmu::PadMapping[i].Axis.Rx);
|
||||
iniFile.Set(joySectionName.c_str(), "right_y", WiiMoteEmu::PadMapping[i].Axis.Ry);
|
||||
iniFile.Set(joySectionName.c_str(), "l_trigger", WiiMoteEmu::PadMapping[i].Axis.Tl);
|
||||
iniFile.Set(joySectionName.c_str(), "r_trigger", WiiMoteEmu::PadMapping[i].Axis.Tr);
|
||||
iniFile.Set(joySectionName.c_str(), "DeadZoneL", WiiMoteEmu::PadMapping[i].DeadZoneL);
|
||||
iniFile.Set(joySectionName.c_str(), "DeadZoneR", WiiMoteEmu::PadMapping[i].DeadZoneR);
|
||||
iniFile.Set(joySectionName.c_str(), "Diagonal", WiiMoteEmu::PadMapping[i].SDiagonal);
|
||||
iniFile.Set(joySectionName.c_str(), "Circle2Square", WiiMoteEmu::PadMapping[i].bCircle2Square);
|
||||
iniFile.Set(joySectionName.c_str(), "Rumble", WiiMoteEmu::PadMapping[i].Rumble);
|
||||
iniFile.Set(joySectionName.c_str(), "RumbleStrength", WiiMoteEmu::PadMapping[i].RumbleStrength);
|
||||
iniFile.Set(joySectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype);
|
||||
iniFile.Set(SectionName, "Axis_Lx", WiiMoteEmu::WiiMapping[i].AxisMapping.Lx);
|
||||
iniFile.Set(SectionName, "Axis_Ly", WiiMoteEmu::WiiMapping[i].AxisMapping.Ly);
|
||||
iniFile.Set(SectionName, "Axis_Rx", WiiMoteEmu::WiiMapping[i].AxisMapping.Rx);
|
||||
iniFile.Set(SectionName, "Axis_Ry", WiiMoteEmu::WiiMapping[i].AxisMapping.Ry);
|
||||
iniFile.Set(SectionName, "Trigger_L", WiiMoteEmu::WiiMapping[i].AxisMapping.Tl);
|
||||
iniFile.Set(SectionName, "Trigger_R", WiiMoteEmu::WiiMapping[i].AxisMapping.Tr);
|
||||
iniFile.Set(SectionName, "DeadZoneL", WiiMoteEmu::WiiMapping[i].DeadZoneL);
|
||||
iniFile.Set(SectionName, "DeadZoneR", WiiMoteEmu::WiiMapping[i].DeadZoneR);
|
||||
iniFile.Set(SectionName, "Diagonal", WiiMoteEmu::WiiMapping[i].Diagonal);
|
||||
iniFile.Set(SectionName, "Circle2Square", WiiMoteEmu::WiiMapping[i].bCircle2Square);
|
||||
iniFile.Set(SectionName, "Rumble", WiiMoteEmu::WiiMapping[i].Rumble);
|
||||
iniFile.Set(SectionName, "RumbleStrength", WiiMoteEmu::WiiMapping[i].RumbleStrength); // x10
|
||||
iniFile.Set(SectionName, "TriggerType", WiiMoteEmu::WiiMapping[i].TriggerType);
|
||||
}
|
||||
|
||||
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini");
|
||||
|
||||
@@ -22,94 +22,14 @@
|
||||
#include <X11/keysym.h>
|
||||
#endif
|
||||
|
||||
#define AN_CONTROLS 6
|
||||
#define WM_CONTROLS 16
|
||||
#define NC_CONTROLS 11
|
||||
#define CC_CONTROLS 23
|
||||
#define GH3_CONTROLS 14
|
||||
|
||||
enum
|
||||
{
|
||||
EXT_NONE = 0,
|
||||
EXT_NUNCHUCK,
|
||||
EXT_CLASSIC_CONTROLLER,
|
||||
EXT_GUITARHERO3_CONTROLLER,
|
||||
};
|
||||
|
||||
struct Config
|
||||
{
|
||||
Config();
|
||||
void Load(bool ChangePad = false);
|
||||
void Save(int Slot = -1);
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
struct TiltRange
|
||||
{
|
||||
int RollDegree;
|
||||
bool RollSwing;
|
||||
int Roll;
|
||||
int PitchDegree;
|
||||
bool PitchSwing;
|
||||
int Pitch;
|
||||
};
|
||||
struct PadTilt
|
||||
{
|
||||
enum ETiltType
|
||||
{
|
||||
OFF = 0,
|
||||
KEYBOARD,
|
||||
ANALOG1,
|
||||
ANALOG2,
|
||||
TRIGGER
|
||||
};
|
||||
int TypeWM;
|
||||
int TypeNC;
|
||||
bool RollInvert;
|
||||
bool PitchInvert;
|
||||
TiltRange Range;
|
||||
};
|
||||
struct PadNunchuck
|
||||
{
|
||||
enum ENunchuckStick
|
||||
{
|
||||
KEYBOARD,
|
||||
ANALOG1,
|
||||
ANALOG2
|
||||
};
|
||||
int Type;
|
||||
};
|
||||
struct PadClassicController
|
||||
{
|
||||
enum ECcStick
|
||||
{
|
||||
KEYBOARD,
|
||||
ANALOG1,
|
||||
ANALOG2,
|
||||
TRIGGER
|
||||
};
|
||||
int LType;
|
||||
int RType;
|
||||
int TType;
|
||||
};
|
||||
|
||||
struct PadGH3
|
||||
{
|
||||
enum EGH3Stick
|
||||
{
|
||||
// KEYBOARD,
|
||||
ANALOG1,
|
||||
ANALOG2
|
||||
};
|
||||
int AType; // Analog Stick
|
||||
int TType; // Whammy bar
|
||||
};
|
||||
|
||||
// Emulated Wiimote
|
||||
bool bInputActive;
|
||||
bool bSideways;
|
||||
bool bUpright;
|
||||
bool bWideScreen;
|
||||
bool bMotionPlusConnected;
|
||||
int iExtensionConnected;
|
||||
// For dialog sync
|
||||
int CurrentPage;
|
||||
|
||||
// Real Wiimote
|
||||
bool bConnectRealWiimote, bUseRealWiimote, bUpdateRealWiimote;
|
||||
@@ -117,12 +37,6 @@ struct Config
|
||||
int iAccNeutralX, iAccNeutralY, iAccNeutralZ;
|
||||
int iAccNunNeutralX, iAccNunNeutralY, iAccNunNeutralZ;
|
||||
|
||||
// Gamepad
|
||||
bool bNoTriggerFilter;
|
||||
PadTilt Tilt;
|
||||
PadNunchuck Nunchuck;
|
||||
PadClassicController ClassicController;
|
||||
PadGH3 GH3Controller;
|
||||
// Screen size settings
|
||||
bool bKeepAR43, bKeepAR169, bCrop;
|
||||
};
|
||||
|
||||
@@ -31,9 +31,9 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
|
||||
EVT_BUTTON(ID_CANCEL, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_BUTTON(ID_BUTTONMAPPING, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_BUTTON(ID_BUTTONRECORDING, WiimoteBasicConfigDialog::ButtonClick)
|
||||
EVT_CHECKBOX(IDC_INPUT_ACTIVE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, WiimoteBasicConfigDialog::NotebookPageChanged)
|
||||
EVT_CHOICE(IDC_INPUT_SOURCE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_SIDEWAYSWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
@@ -59,9 +59,10 @@ WiimoteBasicConfigDialog::WiimoteBasicConfigDialog(wxWindow *parent, wxWindowID
|
||||
#endif
|
||||
|
||||
ControlsCreated = false;
|
||||
m_Page = 0;
|
||||
|
||||
m_bEnableUseRealWiimote = true;
|
||||
Page = 0;
|
||||
//g_Config.Load();
|
||||
|
||||
CreateGUIControls();
|
||||
UpdateGUI();
|
||||
}
|
||||
@@ -112,10 +113,14 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
|
||||
Close();
|
||||
break;
|
||||
case ID_BUTTONMAPPING:
|
||||
g_Config.CurrentPage = m_Page;
|
||||
m_PadConfigFrame = new WiimotePadConfigDialog(this);
|
||||
m_PadConfigFrame->ShowModal();
|
||||
m_PadConfigFrame->Destroy();
|
||||
m_PadConfigFrame = NULL;
|
||||
m_Page = g_Config.CurrentPage;
|
||||
m_Notebook->ChangeSelection(g_Config.CurrentPage);
|
||||
UpdateGUI();
|
||||
break;
|
||||
case ID_BUTTONRECORDING:
|
||||
m_RecordingConfigFrame = new WiimoteRecordingConfigDialog(this);
|
||||
@@ -126,22 +131,19 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
// Execute a delayed function
|
||||
void WiimoteBasicConfigDialog::UpdateOnce(wxTimerEvent& event)
|
||||
{
|
||||
switch(event.GetId())
|
||||
{
|
||||
case IDTM_UPDATE_ONCE:
|
||||
// Reenable the checkbox
|
||||
m_bEnableUseRealWiimote = true;
|
||||
SetCursor(wxCursor(wxCURSOR_ARROW));
|
||||
UpdateGUI();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WiimoteBasicConfigDialog::CreateGUIControls()
|
||||
{
|
||||
wxArrayString arrayStringFor_source;
|
||||
arrayStringFor_source.Add(wxT("Inactive"));
|
||||
arrayStringFor_source.Add(wxT("Emulated Wiimote"));
|
||||
arrayStringFor_source.Add(wxT("Real Wiimote"));
|
||||
|
||||
wxArrayString arrayStringFor_extension;
|
||||
arrayStringFor_extension.Add(wxT("None"));
|
||||
arrayStringFor_extension.Add(wxT("Nunchuck"));
|
||||
arrayStringFor_extension.Add(wxT("Classic Controller"));
|
||||
arrayStringFor_extension.Add(wxT("Guitar Hero 3 Guitar"));
|
||||
|
||||
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
for (int i = 0; i < MAX_WIIMOTES; i++)
|
||||
@@ -149,45 +151,23 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
||||
m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize);
|
||||
m_Notebook->AddPage(m_Controller[i], wxString::Format(wxT("Wiimote %d"), i+1));
|
||||
|
||||
m_ConnectRealWiimote[i] = new wxCheckBox(m_Controller[i], IDC_CONNECT_REAL, wxT("Connect Real Wiimote"));
|
||||
m_UseRealWiimote[i] = new wxCheckBox(m_Controller[i], IDC_USE_REAL, wxT("Use Real Wiimote"));
|
||||
|
||||
m_ConnectRealWiimote[0]->SetValue(g_Config.bConnectRealWiimote);
|
||||
m_UseRealWiimote[0]->SetValue(g_Config.bUseRealWiimote);
|
||||
|
||||
m_ConnectRealWiimote[i]->SetToolTip(wxT("Connected to the real wiimote. This can not be changed during gameplay."));
|
||||
m_UseRealWiimote[i]->SetToolTip(wxT("Use the real Wiimote in the game. This can be changed during gameplay. This can not be selected")
|
||||
wxT(" when a recording is to be done. No status in this window will be updated when this is checked."));
|
||||
|
||||
m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], IDC_MOTIONPLUSCONNECTED, wxT("Wii Motion Plus Connected"));
|
||||
m_WiiMotionPlusConnected[i]->SetValue(g_Config.bMotionPlusConnected);
|
||||
m_WiiMotionPlusConnected[i]->Enable(false);
|
||||
|
||||
wxArrayString arrayStringFor_extension;
|
||||
arrayStringFor_extension.Add(wxT("None"));
|
||||
arrayStringFor_extension.Add(wxT("Nunchuck"));
|
||||
arrayStringFor_extension.Add(wxT("Classic Controller"));
|
||||
arrayStringFor_extension.Add(wxT("Guitar Hero 3 Guitar"));
|
||||
//arrayStringFor_extension.Add(wxT("Guitar Hero World Tour Drums Connected"));
|
||||
// Prolly needs to be a separate plugin
|
||||
//arrayStringFor_extension.Add(wxT("Balance Board"));
|
||||
|
||||
extensionChoice[i] = new wxChoice(m_Controller[i], IDC_EXTCONNECTED, wxDefaultPosition, wxDefaultSize, arrayStringFor_extension, 0, wxDefaultValidator);
|
||||
extensionChoice[i]->SetSelection(0);
|
||||
|
||||
// Basic Settings
|
||||
m_InputActive[i] = new wxCheckBox(m_Controller[i], IDC_INPUT_ACTIVE, wxT("Wiimote Input Active"));
|
||||
m_InputActive[i]->SetValue(g_Config.bInputActive);
|
||||
m_InputActive[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote button events shall be sent to game"), i));
|
||||
m_InputSource[i] = new wxChoice(m_Controller[i], IDC_INPUT_SOURCE, wxDefaultPosition, wxDefaultSize, arrayStringFor_source, 0, wxDefaultValidator);
|
||||
|
||||
// Emulated Wiimote
|
||||
m_SidewaysWiimote[i] = new wxCheckBox(m_Controller[i], IDC_SIDEWAYSWIIMOTE, wxT("Sideways Wiimote"));
|
||||
m_SidewaysWiimote[i]->SetValue(g_Config.bSideways);
|
||||
m_SidewaysWiimote[i]->SetToolTip(wxT("Treat the sideways position as neutral"));
|
||||
m_UprightWiimote[i] = new wxCheckBox(m_Controller[i], IDC_UPRIGHTWIIMOTE, wxT("Upright Wiimote"));
|
||||
m_UprightWiimote[i]->SetValue(g_Config.bUpright);
|
||||
m_UprightWiimote[i]->SetToolTip(wxT("Treat the upright position as neutral"));
|
||||
|
||||
m_WiiMotionPlusConnected[i] = new wxCheckBox(m_Controller[i], IDC_MOTIONPLUSCONNECTED, wxT("Wii Motion Plus Connected"));
|
||||
m_WiiMotionPlusConnected[i]->Enable(false);
|
||||
|
||||
m_Extension[i] = new wxChoice(m_Controller[i], IDC_EXTCONNECTED, wxDefaultPosition, wxDefaultSize, arrayStringFor_extension, 0, wxDefaultValidator);
|
||||
|
||||
m_ConnectRealWiimote[i] = new wxCheckBox(m_Controller[i], IDC_CONNECT_REAL, wxT("Connect Real Wiimote"));
|
||||
m_ConnectRealWiimote[i]->SetToolTip(wxT("Connected to the real wiimote. This can not be changed during gameplay."));
|
||||
|
||||
//IR Pointer
|
||||
m_TextScreenWidth[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Width: 000"));
|
||||
m_TextScreenHeight[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Height: 000"));
|
||||
@@ -199,26 +179,18 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
||||
m_SliderLeft[i] = new wxSlider(m_Controller[i], IDS_LEFT, 0, 100, 500, wxDefaultPosition, wxSize(75, -1));
|
||||
m_SliderTop[i] = new wxSlider(m_Controller[i], IDS_TOP, 0, 0, 500, wxDefaultPosition, wxSize(75, -1));
|
||||
|
||||
//m_ScreenSize = new wxCheckBox(m_Controller[i], IDC_SCREEN_SIZE, wxT("Adjust screen size and position"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
//m_ScreenSize[i]->SetToolTip(wxT("Use the adjusted screen size."));
|
||||
|
||||
// These are changed from the graphics plugin settings, so they are just here to show the loaded status
|
||||
m_TextAR[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Aspect Ratio"));
|
||||
m_CheckAR43[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("4:3"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
|
||||
m_CheckAR169[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("16:9"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
|
||||
m_Crop[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Crop"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
|
||||
|
||||
m_CheckAR43[i]->SetValue(g_Config.bKeepAR43);
|
||||
m_CheckAR169[i]->SetValue(g_Config.bKeepAR169);
|
||||
m_Crop[i]->SetValue(g_Config.bCrop);
|
||||
|
||||
m_CheckAR43[i]->Enable(false);
|
||||
m_CheckAR169[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("16:9"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
|
||||
m_CheckAR169[i]->Enable(false);
|
||||
m_Crop[i] = new wxCheckBox(m_Controller[i], wxID_ANY, wxT("Crop"), wxDefaultPosition, wxSize(-1, -1), 0, wxDefaultValidator);
|
||||
m_Crop[i]->Enable(false);
|
||||
|
||||
// Sizers
|
||||
m_SizeBasic[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote"));
|
||||
m_SizeBasic[i]->Add(m_InputActive[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeBasic[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Input Source"));
|
||||
m_SizeBasic[i]->Add(m_InputSource[i], 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Position"));
|
||||
m_SizeEmu[i]->Add(m_SidewaysWiimote[i], 0, wxEXPAND | wxALL, 5);
|
||||
@@ -226,17 +198,17 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
||||
|
||||
m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension"));
|
||||
m_SizeExtensions[i]->Add(m_WiiMotionPlusConnected[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeExtensions[i]->Add(extensionChoice[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeExtensions[i]->Add(m_Extension[i], 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
m_SizeReal[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Real Wiimote"));
|
||||
m_SizeReal[i]->Add(m_ConnectRealWiimote[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeReal[i]->Add(m_UseRealWiimote[i], 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
m_SizerIRPointerWidth[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizerIRPointerWidth[i]->Add(m_TextScreenLeft[i], 0, wxEXPAND | (wxTOP), 3);
|
||||
m_SizerIRPointerWidth[i]->Add(m_SliderLeft[i], 0, wxEXPAND | (wxRIGHT), 0);
|
||||
m_SizerIRPointerWidth[i]->Add(m_TextScreenWidth[i], 0, wxEXPAND | (wxTOP), 3);
|
||||
m_SizerIRPointerWidth[i]->Add(m_SliderWidth[i], 0, wxEXPAND | (wxLEFT), 0);
|
||||
|
||||
m_SizerIRPointerHeight[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizerIRPointerHeight[i]->Add(m_TextScreenTop[i], 0, wxEXPAND | (wxTOP), 3);
|
||||
m_SizerIRPointerHeight[i]->Add(m_SliderTop[i], 0, wxEXPAND | (wxRIGHT), 0);
|
||||
@@ -264,17 +236,11 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
||||
m_SizeBasicGeneralRight[i]->Add(m_SizerIRPointer[i], 0, wxEXPAND | (wxUP), 5);
|
||||
|
||||
m_SizeBasicGeneral[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralLeft[i], 0, wxEXPAND | (wxUP), 0);
|
||||
m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralRight[i], 0, wxEXPAND | (wxLEFT), 5);
|
||||
|
||||
m_SizeParent[i] = new wxBoxSizer(wxVERTICAL);
|
||||
m_SizeParent[i]->Add(m_SizeBasicGeneral[i], 0, wxBORDER_STATIC | wxEXPAND | (wxALL), 5);
|
||||
// The sizer m_sMain will be expanded inside m_Controller, m_SizeParent will not
|
||||
m_sMain[i] = new wxBoxSizer(wxVERTICAL);
|
||||
m_sMain[i]->Add(m_SizeParent[i]);
|
||||
m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralLeft[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
|
||||
m_SizeBasicGeneral[i]->Add(m_SizeBasicGeneralRight[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
|
||||
|
||||
// Set the main sizer
|
||||
m_Controller[i]->SetSizer(m_sMain[i]);
|
||||
m_Controller[i]->SetSizer(m_SizeBasicGeneral[i]);
|
||||
}
|
||||
|
||||
m_ButtonMapping = new wxButton(this, ID_BUTTONMAPPING, wxT("Button Mapping"));
|
||||
@@ -307,6 +273,20 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
||||
ControlsCreated = true;
|
||||
}
|
||||
|
||||
// Execute a delayed function
|
||||
void WiimoteBasicConfigDialog::UpdateOnce(wxTimerEvent& event)
|
||||
{
|
||||
switch(event.GetId())
|
||||
{
|
||||
case IDTM_UPDATE_ONCE:
|
||||
// Reenable the checkbox
|
||||
m_bEnableUseRealWiimote = true;
|
||||
SetCursor(wxCursor(wxCURSOR_ARROW));
|
||||
UpdateGUI();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WiimoteBasicConfigDialog::DoConnectReal()
|
||||
{
|
||||
if(g_Config.bConnectRealWiimote)
|
||||
@@ -325,7 +305,7 @@ void WiimoteBasicConfigDialog::DoConnectReal()
|
||||
|
||||
void WiimoteBasicConfigDialog::DoUseReal()
|
||||
{
|
||||
if (!g_Config.bUseRealWiimote)
|
||||
if (!g_RealWiiMotePresent || !g_Config.bConnectRealWiimote)
|
||||
return;
|
||||
|
||||
// Clear any eventual events in the Wiimote queue
|
||||
@@ -333,7 +313,7 @@ void WiimoteBasicConfigDialog::DoUseReal()
|
||||
|
||||
// Are we using an extension now? The report that it's removed, then reconnected.
|
||||
bool UsingExtension = false;
|
||||
if (g_Config.iExtensionConnected != EXT_NONE)
|
||||
if (WiiMoteEmu::WiiMapping[m_Page].iExtensionConnected != WiiMoteEmu::EXT_NONE)
|
||||
UsingExtension = true;
|
||||
|
||||
DEBUG_LOG(WIIMOTE, "DoUseReal() Connect extension: %i", !UsingExtension);
|
||||
@@ -362,56 +342,71 @@ void WiimoteBasicConfigDialog::DoUseReal()
|
||||
void WiimoteBasicConfigDialog::DoExtensionConnectedDisconnected(int Extension)
|
||||
{
|
||||
// There is no need for this if no game is running
|
||||
if(!g_EmulatorRunning) return;
|
||||
if(!g_EmulatorRunning || WiiMoteEmu::WiiMapping[m_Page].Source <= 0)
|
||||
return;
|
||||
|
||||
u8 DataFrame[8]; // make a blank report for it
|
||||
u8 DataFrame[8] = {0}; // make a blank report for it
|
||||
wm_request_status *rs = (wm_request_status*)DataFrame;
|
||||
|
||||
// Check if a game is running, in that case change the status
|
||||
if(WiiMoteEmu::g_ReportingChannel > 0)
|
||||
WiiMoteEmu::WmRequestStatus(WiiMoteEmu::g_ReportingChannel, rs, Extension);
|
||||
if(WiiMoteEmu::g_ReportingChannel[m_Page] > 0)
|
||||
{
|
||||
WiiMoteEmu::g_ID = m_Page;
|
||||
WiiMoteEmu::WmRequestStatus(WiiMoteEmu::g_ReportingChannel[m_Page], rs, Extension);
|
||||
}
|
||||
}
|
||||
|
||||
// Notebook page changed
|
||||
void WiimoteBasicConfigDialog::NotebookPageChanged(wxNotebookEvent& event)
|
||||
{
|
||||
// Update the global variable
|
||||
m_Page = event.GetSelection();
|
||||
|
||||
// Update GUI
|
||||
if (ControlsCreated)
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDC_CONNECT_REAL:
|
||||
g_Config.bConnectRealWiimote = m_ConnectRealWiimote[Page]->IsChecked();
|
||||
g_Config.bConnectRealWiimote = m_ConnectRealWiimote[m_Page]->IsChecked();
|
||||
DoConnectReal();
|
||||
break;
|
||||
case IDC_USE_REAL:
|
||||
// Enable the Wiimote thread
|
||||
g_Config.bUseRealWiimote = m_UseRealWiimote[Page]->IsChecked();
|
||||
DoUseReal();
|
||||
break;
|
||||
case IDC_INPUT_ACTIVE:
|
||||
g_Config.bInputActive = m_InputActive[Page]->IsChecked();
|
||||
case IDC_INPUT_SOURCE:
|
||||
if (m_InputSource[m_Page]->GetSelection() == 2)
|
||||
{
|
||||
g_Config.bUseRealWiimote = true;
|
||||
WiiMoteEmu::WiiMapping[m_Page].Source = -1;
|
||||
DoUseReal();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Config.bUseRealWiimote = false;
|
||||
WiiMoteEmu::WiiMapping[m_Page].Source = m_InputSource[m_Page]->GetSelection();
|
||||
}
|
||||
break;
|
||||
case IDC_SIDEWAYSWIIMOTE:
|
||||
g_Config.bSideways = m_SidewaysWiimote[Page]->IsChecked();
|
||||
WiiMoteEmu::WiiMapping[m_Page].bSideways = m_SidewaysWiimote[m_Page]->IsChecked();
|
||||
break;
|
||||
case IDC_UPRIGHTWIIMOTE:
|
||||
g_Config.bUpright = m_UprightWiimote[Page]->IsChecked();
|
||||
WiiMoteEmu::WiiMapping[m_Page].bUpright = m_UprightWiimote[m_Page]->IsChecked();
|
||||
break;
|
||||
case IDC_MOTIONPLUSCONNECTED:
|
||||
g_Config.bMotionPlusConnected = m_WiiMotionPlusConnected[Page]->IsChecked();
|
||||
WiiMoteEmu::WiiMapping[m_Page].bMotionPlusConnected = m_WiiMotionPlusConnected[m_Page]->IsChecked();
|
||||
break;
|
||||
case IDC_EXTCONNECTED:
|
||||
g_Config.iExtensionConnected = EXT_NONE;
|
||||
// Disconnect the extension so that the game recognize the change
|
||||
DoExtensionConnectedDisconnected();
|
||||
DoExtensionConnectedDisconnected(WiiMoteEmu::EXT_NONE);
|
||||
// It doesn't seem to be needed but shouldn't it at least take 25 ms to
|
||||
// reconnect an extension after we disconnected another?
|
||||
if(g_EmulatorRunning) SLEEP(25);
|
||||
|
||||
// Update status
|
||||
g_Config.iExtensionConnected = extensionChoice[Page]->GetSelection();
|
||||
|
||||
WiiMoteEmu::WiiMapping[m_Page].iExtensionConnected = m_Extension[m_Page]->GetSelection();
|
||||
// Copy the calibration data
|
||||
WiiMoteEmu::UpdateExtRegisterBlocks();
|
||||
|
||||
WiiMoteEmu::UpdateExtRegisterBlocks(m_Page);
|
||||
// Generate connect/disconnect status event
|
||||
DoExtensionConnectedDisconnected();
|
||||
break;
|
||||
@@ -424,62 +419,55 @@ void WiimoteBasicConfigDialog::IRCursorChanged(wxScrollEvent& event)
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDS_WIDTH:
|
||||
g_Config.iIRWidth = m_SliderWidth[Page]->GetValue();
|
||||
g_Config.iIRWidth = m_SliderWidth[m_Page]->GetValue();
|
||||
break;
|
||||
case IDS_HEIGHT:
|
||||
g_Config.iIRHeight = m_SliderHeight[Page]->GetValue();
|
||||
g_Config.iIRHeight = m_SliderHeight[m_Page]->GetValue();
|
||||
break;
|
||||
case IDS_LEFT:
|
||||
g_Config.iIRLeft = m_SliderLeft[Page]->GetValue();
|
||||
g_Config.iIRLeft = m_SliderLeft[m_Page]->GetValue();
|
||||
break;
|
||||
case IDS_TOP:
|
||||
g_Config.iIRTop = m_SliderTop[Page]->GetValue();
|
||||
g_Config.iIRTop = m_SliderTop[m_Page]->GetValue();
|
||||
break;
|
||||
}
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
void WiimoteBasicConfigDialog::UpdateIRCalibration()
|
||||
{
|
||||
// Update the slider position if a configuration has been loaded
|
||||
m_SliderWidth[Page]->SetValue(g_Config.iIRWidth);
|
||||
m_SliderHeight[Page]->SetValue(g_Config.iIRHeight);
|
||||
m_SliderLeft[Page]->SetValue(g_Config.iIRLeft);
|
||||
m_SliderTop[Page]->SetValue(g_Config.iIRTop);
|
||||
|
||||
// Update the labels
|
||||
m_TextScreenWidth[Page]->SetLabel(wxString::Format(wxT("Width: %i"), g_Config.iIRWidth));
|
||||
m_TextScreenHeight[Page]->SetLabel(wxString::Format(wxT("Height: %i"), g_Config.iIRHeight));
|
||||
m_TextScreenLeft[Page]->SetLabel(wxString::Format(wxT("Left: %i"), g_Config.iIRLeft));
|
||||
m_TextScreenTop[Page]->SetLabel(wxString::Format(wxT("Top: %i"), g_Config.iIRTop));
|
||||
}
|
||||
|
||||
void WiimoteBasicConfigDialog::UpdateGUI(int Slot)
|
||||
void WiimoteBasicConfigDialog::UpdateGUI()
|
||||
{
|
||||
/* I have disabled this option during a running game because it's enough to be able to switch
|
||||
between using and not using then. To also use the connect option during a running game would
|
||||
mean that the wiimote must be sent the current reporting mode and the channel ID after it
|
||||
has been initialized. Functions for that are basically already in place so these two options
|
||||
could possibly be simplified to one option. */
|
||||
m_ConnectRealWiimote[Page]->SetValue(g_Config.bConnectRealWiimote);
|
||||
m_ConnectRealWiimote[Page]->Enable(!g_EmulatorRunning);
|
||||
m_ConnectRealWiimote[m_Page]->SetValue(g_Config.bConnectRealWiimote);
|
||||
m_ConnectRealWiimote[m_Page]->Enable(!g_EmulatorRunning);
|
||||
|
||||
m_UseRealWiimote[Page]->SetValue(g_Config.bUseRealWiimote);
|
||||
m_UseRealWiimote[Page]->Enable((m_bEnableUseRealWiimote && g_RealWiiMotePresent && g_Config.bConnectRealWiimote) || (!g_EmulatorRunning && g_Config.bConnectRealWiimote));
|
||||
if (WiiMoteEmu::WiiMapping[m_Page].Source < 0)
|
||||
m_InputSource[m_Page]->SetSelection(2);
|
||||
else
|
||||
m_InputSource[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].Source);
|
||||
|
||||
m_InputActive[Page]->SetValue(g_Config.bInputActive);
|
||||
m_SidewaysWiimote[Page]->SetValue(g_Config.bSideways);
|
||||
m_UprightWiimote[Page]->SetValue(g_Config.bUpright);
|
||||
m_WiiMotionPlusConnected[Page]->SetValue(g_Config.bMotionPlusConnected);
|
||||
m_SidewaysWiimote[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bSideways);
|
||||
m_UprightWiimote[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bUpright);
|
||||
m_WiiMotionPlusConnected[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bMotionPlusConnected);
|
||||
|
||||
/* 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);
|
||||
|
||||
extensionChoice[Page]->SetSelection(g_Config.iExtensionConnected);
|
||||
extensionChoice[Page]->Enable(AllowExtensionChange);
|
||||
m_Extension[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].iExtensionConnected);
|
||||
|
||||
// Update the Wiimote IR pointer calibration
|
||||
UpdateIRCalibration();
|
||||
m_TextScreenWidth[m_Page]->SetLabel(wxString::Format(wxT("Width: %i"), g_Config.iIRWidth));
|
||||
m_TextScreenHeight[m_Page]->SetLabel(wxString::Format(wxT("Height: %i"), g_Config.iIRHeight));
|
||||
m_TextScreenLeft[m_Page]->SetLabel(wxString::Format(wxT("Left: %i"), g_Config.iIRLeft));
|
||||
m_TextScreenTop[m_Page]->SetLabel(wxString::Format(wxT("Top: %i"), g_Config.iIRTop));
|
||||
// Update the slider position if a configuration has been loaded
|
||||
m_SliderWidth[m_Page]->SetValue(g_Config.iIRWidth);
|
||||
m_SliderHeight[m_Page]->SetValue(g_Config.iIRHeight);
|
||||
m_SliderLeft[m_Page]->SetValue(g_Config.iIRLeft);
|
||||
m_SliderTop[m_Page]->SetValue(g_Config.iIRTop);
|
||||
|
||||
m_CheckAR43[m_Page]->SetValue(g_Config.bKeepAR43);
|
||||
m_CheckAR169[m_Page]->SetValue(g_Config.bKeepAR169);
|
||||
m_Crop[m_Page]->SetValue(g_Config.bCrop);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include "wiimote_hid.h"
|
||||
|
||||
class WiimoteBasicConfigDialog : public wxDialog
|
||||
{
|
||||
@@ -43,9 +44,8 @@ class WiimoteBasicConfigDialog : public wxDialog
|
||||
virtual ~WiimoteBasicConfigDialog(){;}
|
||||
|
||||
// General open, close and event functions
|
||||
void UpdateGUI();
|
||||
void ButtonClick(wxCommandEvent& event);
|
||||
void UpdateGUI(int Slot = 0);
|
||||
void UpdateIRCalibration();
|
||||
void ShutDown(wxTimerEvent& WXUNUSED(event));
|
||||
void UpdateOnce(wxTimerEvent& event);
|
||||
|
||||
@@ -53,58 +53,55 @@ class WiimoteBasicConfigDialog : public wxDialog
|
||||
wxTimer *m_TimeoutOnce,
|
||||
*m_ShutDownTimer;
|
||||
|
||||
wxCheckBox *m_UseRealWiimote[4];
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
bool ControlsCreated, m_bEnableUseRealWiimote;
|
||||
int Page;
|
||||
int m_Page;
|
||||
|
||||
wxNotebook *m_Notebook;
|
||||
wxPanel *m_Controller[4];
|
||||
wxPanel *m_Controller[MAX_WIIMOTES];
|
||||
|
||||
wxButton *m_OK,
|
||||
*m_Cancel,
|
||||
*m_ButtonMapping,
|
||||
*m_Recording;
|
||||
|
||||
wxChoice* extensionChoice[4];
|
||||
wxChoice *m_InputSource[MAX_WIIMOTES],
|
||||
*m_Extension[MAX_WIIMOTES];
|
||||
|
||||
wxSlider *m_SliderWidth[4],
|
||||
*m_SliderHeight[4],
|
||||
*m_SliderLeft[4],
|
||||
*m_SliderTop[4];
|
||||
wxSlider *m_SliderWidth[MAX_WIIMOTES],
|
||||
*m_SliderHeight[MAX_WIIMOTES],
|
||||
*m_SliderLeft[MAX_WIIMOTES],
|
||||
*m_SliderTop[MAX_WIIMOTES];
|
||||
|
||||
wxCheckBox *m_InputActive[4],
|
||||
*m_SidewaysWiimote[4],
|
||||
*m_UprightWiimote[4],
|
||||
*m_ConnectRealWiimote[4],
|
||||
*m_WiiMotionPlusConnected[4],
|
||||
*m_CheckAR43[4],
|
||||
*m_CheckAR169[4],
|
||||
*m_Crop[4];
|
||||
wxCheckBox *m_ConnectRealWiimote[MAX_WIIMOTES],
|
||||
*m_SidewaysWiimote[MAX_WIIMOTES],
|
||||
*m_UprightWiimote[MAX_WIIMOTES],
|
||||
*m_WiiMotionPlusConnected[MAX_WIIMOTES],
|
||||
*m_CheckAR43[MAX_WIIMOTES],
|
||||
*m_CheckAR169[MAX_WIIMOTES],
|
||||
*m_Crop[MAX_WIIMOTES];
|
||||
|
||||
wxStaticText *m_TextScreenWidth[4],
|
||||
*m_TextScreenHeight[4],
|
||||
*m_TextScreenLeft[4],
|
||||
*m_TextScreenTop[4],
|
||||
*m_TextAR[4];
|
||||
wxStaticText *m_TextScreenWidth[MAX_WIIMOTES],
|
||||
*m_TextScreenHeight[MAX_WIIMOTES],
|
||||
*m_TextScreenLeft[MAX_WIIMOTES],
|
||||
*m_TextScreenTop[MAX_WIIMOTES],
|
||||
*m_TextAR[MAX_WIIMOTES];
|
||||
|
||||
wxBoxSizer *m_MainSizer,
|
||||
*m_sMain[4],
|
||||
*m_SizeParent[4],
|
||||
*m_SizeBasicGeneral[4],
|
||||
*m_SizeBasicGeneralLeft[4],
|
||||
*m_SizeBasicGeneralRight[4],
|
||||
*m_SizerIRPointerWidth[4],
|
||||
*m_SizerIRPointerHeight[4],
|
||||
*m_SizerIRPointerScreen[4];
|
||||
*m_SizeBasicGeneral[MAX_WIIMOTES],
|
||||
*m_SizeBasicGeneralLeft[MAX_WIIMOTES],
|
||||
*m_SizeBasicGeneralRight[MAX_WIIMOTES],
|
||||
*m_SizerIRPointerWidth[MAX_WIIMOTES],
|
||||
*m_SizerIRPointerHeight[MAX_WIIMOTES],
|
||||
*m_SizerIRPointerScreen[MAX_WIIMOTES];
|
||||
|
||||
wxStaticBoxSizer *m_SizeBasic[4],
|
||||
*m_SizeEmu[4],
|
||||
*m_SizeReal[4],
|
||||
*m_SizeExtensions[4],
|
||||
*m_SizerIRPointer[4];
|
||||
wxStaticBoxSizer *m_SizeBasic[MAX_WIIMOTES],
|
||||
*m_SizeEmu[MAX_WIIMOTES],
|
||||
*m_SizeReal[MAX_WIIMOTES],
|
||||
*m_SizeExtensions[MAX_WIIMOTES],
|
||||
*m_SizerIRPointer[MAX_WIIMOTES];
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -123,7 +120,7 @@ class WiimoteBasicConfigDialog : public wxDialog
|
||||
ID_CONTROLLERPAGE4,
|
||||
|
||||
// Emulated Wiimote
|
||||
IDC_INPUT_ACTIVE,
|
||||
IDC_INPUT_SOURCE,
|
||||
IDC_SIDEWAYSWIIMOTE,
|
||||
IDC_UPRIGHTWIIMOTE,
|
||||
IDC_MOTIONPLUSCONNECTED,
|
||||
@@ -131,7 +128,6 @@ class WiimoteBasicConfigDialog : public wxDialog
|
||||
|
||||
// Real
|
||||
IDC_CONNECT_REAL,
|
||||
IDC_USE_REAL,
|
||||
|
||||
IDS_WIDTH,
|
||||
IDS_HEIGHT,
|
||||
@@ -139,8 +135,9 @@ class WiimoteBasicConfigDialog : public wxDialog
|
||||
IDS_TOP,
|
||||
};
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CreateGUIControls();
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void NotebookPageChanged(wxNotebookEvent& event);
|
||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||
void IRCursorChanged(wxScrollEvent& event);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -31,6 +31,7 @@
|
||||
#include <wx/panel.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include "Config.h"
|
||||
#include "wiimote_hid.h"
|
||||
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
#include <X11/Xlib.h>
|
||||
@@ -51,169 +52,24 @@ class WiimotePadConfigDialog : public wxDialog
|
||||
long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS);
|
||||
virtual ~WiimotePadConfigDialog();
|
||||
|
||||
void CloseClick(wxCommandEvent& event);
|
||||
void UpdateGUI(int Slot = 0);
|
||||
void UpdateGUIButtonMapping(int controller);
|
||||
void UpdateControls();
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void Convert2Box(int &x);
|
||||
void ConvertToString();
|
||||
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
|
||||
void UpdatePad(wxTimerEvent& WXUNUSED(event));
|
||||
|
||||
wxTimer *m_UpdatePadTimer,
|
||||
*m_ButtonMappingTimer;
|
||||
|
||||
wxStaticBitmap *m_bmpDotLeftIn[4],
|
||||
*m_bmpDotLeftOut[4],
|
||||
*m_bmpDotRightIn[4],
|
||||
*m_bmpDotRightOut[4],
|
||||
*m_bmpDeadZoneLeftIn[4],
|
||||
*m_bmpDeadZoneRightIn[4];
|
||||
wxStaticBitmap *m_bmpDotLeftIn[MAX_WIIMOTES],
|
||||
*m_bmpDotLeftOut[MAX_WIIMOTES],
|
||||
*m_bmpDotRightIn[MAX_WIIMOTES],
|
||||
*m_bmpDotRightOut[MAX_WIIMOTES],
|
||||
*m_bmpDeadZoneLeftIn[MAX_WIIMOTES],
|
||||
*m_bmpDeadZoneRightIn[MAX_WIIMOTES];
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
bool ControlsCreated;
|
||||
int Page, BoxW, BoxH;
|
||||
|
||||
wxString OldLabel;
|
||||
|
||||
wxNotebook *m_Notebook;
|
||||
|
||||
wxPanel *m_Controller[4],
|
||||
*m_pLeftInStatus[4],
|
||||
*m_pLeftOutStatus[4],
|
||||
*m_pRightInStatus[4],
|
||||
*m_pRightOutStatus[4];
|
||||
|
||||
wxStaticBitmap *m_bmpSquareLeftIn[4],
|
||||
*m_bmpSquareLeftOut[4],
|
||||
*m_bmpSquareRightIn[4],
|
||||
*m_bmpSquareRightOut[4];
|
||||
|
||||
|
||||
wxCheckBox *m_CheckC2S[4],
|
||||
*m_CheckRumble[4],
|
||||
*m_TiltRollSwing[4],
|
||||
*m_TiltPitchSwing[4],
|
||||
*m_TiltRollInvert[4],
|
||||
*m_TiltPitchInvert[4];
|
||||
|
||||
wxButton *m_Close, *m_Apply, *ClickedButton,
|
||||
*m_Button_Analog[AN_CONTROLS][4],
|
||||
*m_Button_Wiimote[WM_CONTROLS][4],
|
||||
*m_Button_NunChuck[NC_CONTROLS][4],
|
||||
*m_Button_Classic[CC_CONTROLS][4],
|
||||
*m_Button_GH3[GH3_CONTROLS][4];
|
||||
|
||||
wxComboBox *m_Joyname[4],
|
||||
*m_ComboDeadZoneLeft[4],
|
||||
*m_ComboDeadZoneRight[4],
|
||||
*m_ComboDiagonal[4],
|
||||
*m_RumbleStrength[4],
|
||||
*m_TiltTypeWM[4],
|
||||
*m_TiltTypeNC[4],
|
||||
*m_TiltComboRangeRoll[4],
|
||||
*m_TiltComboRangePitch[4],
|
||||
*m_TriggerType[4],
|
||||
*m_NunchuckComboStick[4],
|
||||
*m_CcComboLeftStick[4],
|
||||
*m_CcComboRightStick[4],
|
||||
*m_CcComboTriggers[4],
|
||||
*m_GH3ComboAnalog[4];
|
||||
|
||||
wxGridBagSizer *m_sGridTilt[4],
|
||||
*m_sGridStickLeft[4],
|
||||
*m_sGridStickRight[4],
|
||||
*m_sGridTrigger[4];
|
||||
|
||||
wxBoxSizer *m_MainSizer,
|
||||
*m_sMain[4],
|
||||
*m_sDeadZoneHoriz[4],
|
||||
*m_sDeadZone[4],
|
||||
*m_sDiagonal[4],
|
||||
*m_sCircle2Square[4],
|
||||
*m_sC2SDeadZone[4],
|
||||
*m_sJoyname[4],
|
||||
*m_sRumble[4],
|
||||
*m_sTiltType[4],
|
||||
*m_sHorizController[4],
|
||||
*m_sHorizStatus[4],
|
||||
*m_Sizer_Analog[AN_CONTROLS][4],
|
||||
*m_sAnalogLeft[4],
|
||||
*m_sAnalogMiddle[4],
|
||||
*m_sAnalogRight[4],
|
||||
*m_sHorizAnalogMapping[4],
|
||||
*m_Sizer_Wiimote[WM_CONTROLS][4],
|
||||
*m_sWmVertLeft[4],
|
||||
*m_sWmVertRight[4],
|
||||
*m_Sizer_NunChuck[NC_CONTROLS][4],
|
||||
*m_sNunchuckStick[4],
|
||||
*m_sNCVertLeft[4],
|
||||
*m_sNCVertRight[4],
|
||||
*m_Sizer_Classic[CC_CONTROLS][4],
|
||||
*m_sCcLeftStick[4],
|
||||
*m_sCcRightStick[4],
|
||||
*m_sCcTriggers[4],
|
||||
*m_sCcVertLeft[4],
|
||||
*m_sCcVertMiddle[4],
|
||||
*m_sCcVertRight[4],
|
||||
*m_Sizer_GH3[GH3_CONTROLS][4],
|
||||
*m_sGH3Analog[4],
|
||||
*m_sGH3VertLeft[4],
|
||||
*m_sGH3VertRight[4],
|
||||
*m_sHorizControllerMapping[4];
|
||||
|
||||
wxStaticBoxSizer *m_gJoyPad[4],
|
||||
*m_gTilt[4],
|
||||
*m_gStickLeft[4],
|
||||
*m_gStickRight[4],
|
||||
*m_gTriggers[4],
|
||||
*m_gAnalog[4],
|
||||
*m_gWiimote[4],
|
||||
*m_gNunchuck[4],
|
||||
*m_gClassicController[4],
|
||||
*m_gGuitarHero3Controller[4];
|
||||
|
||||
wxStaticText *m_ComboDeadZoneLabel[4],
|
||||
*m_DiagonalLabel[4],
|
||||
*m_RumbleStrengthLabel[4],
|
||||
*m_tTiltTypeWM[4], *m_tTiltTypeNC[4],
|
||||
*m_TiltTextRoll[4], *m_TiltTextPitch[4],
|
||||
*m_tStatusLeftIn[4], *m_tStatusLeftOut[4], *m_tStatusRightIn[4], *m_tStatusRightOut[4],
|
||||
*m_TriggerL[4], *m_TriggerR[4],
|
||||
*m_TriggerStatusL[4], *m_TriggerStatusR[4],
|
||||
*m_tTriggerSource[4],
|
||||
*m_statictext_Analog[AN_CONTROLS][4],
|
||||
*m_statictext_Wiimote[WM_CONTROLS][4],
|
||||
*m_statictext_NunChuck[NC_CONTROLS][4],
|
||||
*m_statictext_Classic[CC_CONTROLS][4],
|
||||
*m_statictext_GH3[GH3_CONTROLS][4],
|
||||
*m_NunchuckTextStick[5],
|
||||
*m_CcTextLeftStick[4],
|
||||
*m_CcTextRightStick[4],
|
||||
*m_CcTextTriggers[4],
|
||||
*m_tGH3Analog[4];
|
||||
|
||||
enum
|
||||
{
|
||||
ID_CLOSE = 1000,
|
||||
ID_APPLY,
|
||||
IDTM_BUTTON, // Timer
|
||||
IDTM_UPDATE_PAD, // Timer
|
||||
|
||||
ID_NOTEBOOK,
|
||||
ID_CONTROLLERPAGE1,
|
||||
ID_CONTROLLERPAGE2,
|
||||
ID_CONTROLLERPAGE3,
|
||||
ID_CONTROLLERPAGE4,
|
||||
|
||||
// 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,
|
||||
|
||||
// <It's important that the internal ordering of these are unchanged>
|
||||
// Wiimote
|
||||
IDB_WM_A, IDB_WM_B,
|
||||
IDB_WM_1, IDB_WM_2,
|
||||
@@ -259,6 +115,22 @@ class WiimotePadConfigDialog : public wxDialog
|
||||
IDB_GH3_STRUM_UP,
|
||||
IDB_GH3_STRUM_DOWN,
|
||||
|
||||
// Gamepad
|
||||
IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y,
|
||||
IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y,
|
||||
IDB_TRIGGER_L, IDB_TRIGGER_R,
|
||||
|
||||
ID_CLOSE = 1000,
|
||||
ID_APPLY,
|
||||
IDTM_BUTTON, // Timer
|
||||
IDTM_UPDATE_PAD, // Timer
|
||||
|
||||
ID_NOTEBOOK,
|
||||
ID_CONTROLLERPAGE1,
|
||||
ID_CONTROLLERPAGE2,
|
||||
ID_CONTROLLERPAGE3,
|
||||
ID_CONTROLLERPAGE4,
|
||||
|
||||
// Gamepad settings
|
||||
IDC_JOYNAME,
|
||||
IDC_RUMBLE, IDC_RUMBLE_STRENGTH,
|
||||
@@ -274,34 +146,155 @@ class WiimotePadConfigDialog : public wxDialog
|
||||
IDC_GH3_ANALOG,
|
||||
};
|
||||
|
||||
bool ControlsCreated;
|
||||
int m_Page, BoxW, BoxH;
|
||||
|
||||
wxString OldLabel;
|
||||
|
||||
wxNotebook *m_Notebook;
|
||||
|
||||
wxPanel *m_Controller[MAX_WIIMOTES],
|
||||
*m_pLeftInStatus[MAX_WIIMOTES],
|
||||
*m_pLeftOutStatus[MAX_WIIMOTES],
|
||||
*m_pRightInStatus[MAX_WIIMOTES],
|
||||
*m_pRightOutStatus[MAX_WIIMOTES];
|
||||
|
||||
wxStaticBitmap *m_bmpSquareLeftIn[MAX_WIIMOTES],
|
||||
*m_bmpSquareLeftOut[MAX_WIIMOTES],
|
||||
*m_bmpSquareRightIn[MAX_WIIMOTES],
|
||||
*m_bmpSquareRightOut[MAX_WIIMOTES];
|
||||
|
||||
wxCheckBox *m_CheckC2S[MAX_WIIMOTES],
|
||||
*m_CheckRumble[MAX_WIIMOTES],
|
||||
*m_TiltRollSwing[MAX_WIIMOTES],
|
||||
*m_TiltPitchSwing[MAX_WIIMOTES],
|
||||
*m_TiltRollInvert[MAX_WIIMOTES],
|
||||
*m_TiltPitchInvert[MAX_WIIMOTES];
|
||||
|
||||
wxButton *m_Close, *m_Apply, *ClickedButton,
|
||||
*m_Button_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][MAX_WIIMOTES],
|
||||
*m_Button_Wiimote[IDB_WM_SHAKE - IDB_WM_A + 1][MAX_WIIMOTES],
|
||||
*m_Button_NunChuck[IDB_NC_SHAKE - IDB_NC_Z + 1][MAX_WIIMOTES],
|
||||
*m_Button_Classic[IDB_CC_RD - IDB_CC_A + 1][MAX_WIIMOTES],
|
||||
*m_Button_GH3[IDB_GH3_STRUM_DOWN - IDB_GH3_GREEN + 1][MAX_WIIMOTES];
|
||||
|
||||
wxComboBox *m_Joyname[MAX_WIIMOTES],
|
||||
*m_ComboDeadZoneLeft[MAX_WIIMOTES],
|
||||
*m_ComboDeadZoneRight[MAX_WIIMOTES],
|
||||
*m_ComboDiagonal[MAX_WIIMOTES],
|
||||
*m_RumbleStrength[MAX_WIIMOTES],
|
||||
*m_TiltTypeWM[MAX_WIIMOTES],
|
||||
*m_TiltTypeNC[MAX_WIIMOTES],
|
||||
*m_TiltComboRangeRoll[MAX_WIIMOTES],
|
||||
*m_TiltComboRangePitch[MAX_WIIMOTES],
|
||||
*m_TriggerType[MAX_WIIMOTES],
|
||||
*m_NunchuckComboStick[MAX_WIIMOTES],
|
||||
*m_CcComboLeftStick[MAX_WIIMOTES],
|
||||
*m_CcComboRightStick[MAX_WIIMOTES],
|
||||
*m_CcComboTriggers[MAX_WIIMOTES],
|
||||
*m_GH3ComboAnalog[MAX_WIIMOTES];
|
||||
|
||||
wxGridBagSizer *m_sGridTilt[MAX_WIIMOTES],
|
||||
*m_sGridStickLeft[MAX_WIIMOTES],
|
||||
*m_sGridStickRight[MAX_WIIMOTES],
|
||||
*m_sGridTrigger[MAX_WIIMOTES];
|
||||
|
||||
wxBoxSizer *m_MainSizer,
|
||||
*m_sMain[MAX_WIIMOTES],
|
||||
*m_sDeadZoneHoriz[MAX_WIIMOTES],
|
||||
*m_sDeadZone[MAX_WIIMOTES],
|
||||
*m_sDiagonal[MAX_WIIMOTES],
|
||||
*m_sCircle2Square[MAX_WIIMOTES],
|
||||
*m_sC2SDeadZone[MAX_WIIMOTES],
|
||||
*m_sJoyname[MAX_WIIMOTES],
|
||||
*m_sRumble[MAX_WIIMOTES],
|
||||
*m_sTiltType[MAX_WIIMOTES],
|
||||
*m_sHorizController[MAX_WIIMOTES],
|
||||
*m_sHorizStatus[MAX_WIIMOTES],
|
||||
*m_Sizer_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][MAX_WIIMOTES],
|
||||
*m_sAnalogLeft[MAX_WIIMOTES],
|
||||
*m_sAnalogMiddle[MAX_WIIMOTES],
|
||||
*m_sAnalogRight[MAX_WIIMOTES],
|
||||
*m_sHorizAnalogMapping[MAX_WIIMOTES],
|
||||
*m_Sizer_Wiimote[IDB_WM_SHAKE - IDB_WM_A + 1][MAX_WIIMOTES],
|
||||
*m_sWmVertLeft[MAX_WIIMOTES],
|
||||
*m_sWmVertRight[MAX_WIIMOTES],
|
||||
*m_Sizer_NunChuck[IDB_NC_SHAKE - IDB_NC_Z + 1][MAX_WIIMOTES],
|
||||
*m_sNunchuckStick[MAX_WIIMOTES],
|
||||
*m_sNCVertLeft[MAX_WIIMOTES],
|
||||
*m_sNCVertRight[MAX_WIIMOTES],
|
||||
*m_Sizer_Classic[IDB_CC_RD - IDB_CC_A + 1][MAX_WIIMOTES],
|
||||
*m_sCcLeftStick[MAX_WIIMOTES],
|
||||
*m_sCcRightStick[MAX_WIIMOTES],
|
||||
*m_sCcTriggers[MAX_WIIMOTES],
|
||||
*m_sCcVertLeft[MAX_WIIMOTES],
|
||||
*m_sCcVertMiddle[MAX_WIIMOTES],
|
||||
*m_sCcVertRight[MAX_WIIMOTES],
|
||||
*m_Sizer_GH3[IDB_GH3_STRUM_DOWN - IDB_GH3_GREEN + 1][MAX_WIIMOTES],
|
||||
*m_sGH3Analog[MAX_WIIMOTES],
|
||||
*m_sGH3VertLeft[MAX_WIIMOTES],
|
||||
*m_sGH3VertRight[MAX_WIIMOTES],
|
||||
*m_sHorizControllerMapping[MAX_WIIMOTES];
|
||||
|
||||
wxStaticBoxSizer *m_gJoyPad[MAX_WIIMOTES],
|
||||
*m_gTilt[MAX_WIIMOTES],
|
||||
*m_gStickLeft[MAX_WIIMOTES],
|
||||
*m_gStickRight[MAX_WIIMOTES],
|
||||
*m_gTriggers[MAX_WIIMOTES],
|
||||
*m_gAnalog[MAX_WIIMOTES],
|
||||
*m_gWiimote[MAX_WIIMOTES],
|
||||
*m_gNunchuck[MAX_WIIMOTES],
|
||||
*m_gClassicController[MAX_WIIMOTES],
|
||||
*m_gGuitarHero3Controller[MAX_WIIMOTES];
|
||||
|
||||
wxStaticText *m_ComboDeadZoneLabel[MAX_WIIMOTES],
|
||||
*m_DiagonalLabel[MAX_WIIMOTES],
|
||||
*m_RumbleStrengthLabel[MAX_WIIMOTES],
|
||||
*m_tTiltTypeWM[MAX_WIIMOTES], *m_tTiltTypeNC[MAX_WIIMOTES],
|
||||
*m_TiltTextRoll[MAX_WIIMOTES], *m_TiltTextPitch[MAX_WIIMOTES],
|
||||
*m_tStatusLeftIn[MAX_WIIMOTES], *m_tStatusLeftOut[MAX_WIIMOTES],
|
||||
*m_tStatusRightIn[MAX_WIIMOTES], *m_tStatusRightOut[MAX_WIIMOTES],
|
||||
*m_TriggerL[MAX_WIIMOTES], *m_TriggerR[MAX_WIIMOTES],
|
||||
*m_TriggerStatusL[MAX_WIIMOTES], *m_TriggerStatusR[MAX_WIIMOTES],
|
||||
*m_tTriggerSource[MAX_WIIMOTES],
|
||||
*m_statictext_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][MAX_WIIMOTES],
|
||||
*m_statictext_Wiimote[IDB_WM_SHAKE - IDB_WM_A + 1][MAX_WIIMOTES],
|
||||
*m_statictext_NunChuck[IDB_NC_SHAKE - IDB_NC_Z + 1][MAX_WIIMOTES],
|
||||
*m_statictext_Classic[IDB_CC_RD - IDB_CC_A + 1][MAX_WIIMOTES],
|
||||
*m_statictext_GH3[IDB_GH3_STRUM_DOWN - IDB_GH3_GREEN + 1][MAX_WIIMOTES],
|
||||
*m_NunchuckTextStick[5],
|
||||
*m_CcTextLeftStick[MAX_WIIMOTES],
|
||||
*m_CcTextRightStick[MAX_WIIMOTES],
|
||||
*m_CcTextTriggers[MAX_WIIMOTES],
|
||||
*m_tGH3Analog[MAX_WIIMOTES];
|
||||
|
||||
wxBitmap CreateBitmap();
|
||||
wxBitmap CreateBitmapDot();
|
||||
wxBitmap CreateBitmapDeadZone(int Radius);
|
||||
wxBitmap CreateBitmapClear();
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CloseClick(wxCommandEvent& event);
|
||||
void CreatePadGUIControls();
|
||||
void UpdateGUI();
|
||||
void NotebookPageChanged(wxNotebookEvent& event);
|
||||
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnButtonClick(wxCommandEvent& event);
|
||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||
void SaveButtonMapping(int Id, int Key);
|
||||
|
||||
// Gamepad configuration
|
||||
void SetButtonText(int id, const char text[128], int _Page = -1);
|
||||
void SetButtonTextAll(int id, char text[128]);
|
||||
void SetButtonText(int id,const wxString &str);
|
||||
wxString GetButtonText(int id);
|
||||
void GetButtons(wxCommandEvent& btn_event);
|
||||
void DoGetButtons(int id);
|
||||
void SaveButtonMapping(int controller, bool DontChangeId = false, int FromSlot = -1);
|
||||
void SaveButtonMappingAll(int Slot);
|
||||
void SaveKeyboardMapping(int Controller, int Id, int Key);
|
||||
void ToBlank(bool ToBlank = true);
|
||||
void PadGetStatus();
|
||||
void DoSave(bool ChangePad = false, int Slot = -1);
|
||||
void DoChangeJoystick();
|
||||
void PadOpen(int Open); void PadClose(int Close);
|
||||
void DoChangeDeadZone(bool Left);
|
||||
void OnButtonClick(wxCommandEvent& event);
|
||||
void UpdatePadInfo(wxTimerEvent& WXUNUSED(event));
|
||||
void ToBlank(bool ToBlank, int Id);
|
||||
void DoChangeDeadZone();
|
||||
|
||||
// Configure buttons
|
||||
int GetButtonWaitingID, GetButtonWaitingTimer, g_Pressed;
|
||||
wxString GetButtonText(int id, int Page = -1);
|
||||
};
|
||||
extern WiimotePadConfigDialog *m_PadConfigFrame;
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user