mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merged PadSimple with nJoy
(Linux build could be broken, X360Pad support could be broken) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4924 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -27,10 +27,6 @@
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Include
|
||||
// -------------------
|
||||
#if defined HAVE_WX && HAVE_WX
|
||||
@@ -45,12 +41,9 @@
|
||||
#include "SDL.h" // Local
|
||||
|
||||
|
||||
|
||||
namespace InputCommon
|
||||
{
|
||||
|
||||
|
||||
|
||||
// Degree to radian and back
|
||||
// -------------
|
||||
float Deg2Rad(float Deg)
|
||||
@@ -83,9 +76,6 @@ bool IsDeadZone(float DeadZone, int x, int y)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Scale down stick values from 0x8000 to 0x80
|
||||
/* ----------------
|
||||
The value returned by SDL_JoystickGetAxis is a signed integer s16
|
||||
@@ -112,33 +102,19 @@ int Pad_Convert(int _val)
|
||||
return _val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Adjust the radius
|
||||
// ----------------
|
||||
void RadiusAdjustment(int &_x, int &_y, int _pad, std::string SRadius)
|
||||
void RadiusAdjustment(s8 &_x, s8 &_y, int _Radius)
|
||||
{
|
||||
// Get the radius setting
|
||||
int Tmp = atoi (SRadius.substr(0, SRadius.length() - 1).c_str());
|
||||
float RadiusSetting = Tmp / 100.0f;
|
||||
|
||||
// Get current angle
|
||||
float Deg = Rad2Deg(atan2((float)_y, (float)_x));
|
||||
// Get the current radius
|
||||
float Radius = sqrt((float)(_x*_x + _y*_y));
|
||||
// Adjust radius
|
||||
Radius = Radius * RadiusSetting;
|
||||
// Produce new coordinates
|
||||
float x = Radius * cos(Deg2Rad(Deg));
|
||||
float y = Radius * sin(Deg2Rad(Deg));
|
||||
float RadiusSetting = (float)_Radius / 100.0f;
|
||||
float x = (float)_x * RadiusSetting;
|
||||
float y = (float)_y * RadiusSetting;
|
||||
// Update values
|
||||
_x = (int)x, _y = (int)y;
|
||||
_x = (s8)x;
|
||||
_y = (s8)y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Convert the stick raidus from a square or rounded box to a circular radius. I don't know what
|
||||
input values the actual GC controller produce for the GC, it may be a square, a circle or
|
||||
something in between. But one thing that is certain is that PC pads differ in their output
|
||||
@@ -173,8 +149,9 @@ float Square2CircleDistance(float deg)
|
||||
|
||||
return Distance;
|
||||
}
|
||||
|
||||
// Produce a perfect circle from an original square or rounded box
|
||||
void Square2Circle(int &_x, int &_y, int _pad, std::string SDiagonal, bool Circle2Square)
|
||||
void Square2Circle(int &_x, int &_y, int _Diagonal, bool Circle2Square)
|
||||
{
|
||||
// Do we need to do this check?
|
||||
if(_x > 32767) _x = 32767; if(_y > 32767) _y = 32767; // upper limit
|
||||
@@ -184,8 +161,7 @@ void Square2Circle(int &_x, int &_y, int _pad, std::string SDiagonal, bool Circl
|
||||
// Convert to circle
|
||||
// -----------
|
||||
// Get the manually configured diagonal distance
|
||||
int Tmp = atoi (SDiagonal.substr(0, SDiagonal.length() - 1).c_str());
|
||||
float Diagonal = Tmp / 100.0f;
|
||||
float Diagonal = (float)_Diagonal / 100.0f;
|
||||
|
||||
// First make a perfect square in case we don't have one already
|
||||
float OrigDist = sqrt( pow((float)_y, 2) + pow((float)_x, 2) ); // Get current distance
|
||||
@@ -226,9 +202,6 @@ void Square2Circle(int &_x, int &_y, int _pad, std::string SDiagonal, bool Circl
|
||||
//Console::Print("%f %f %i", corner_circle_dist, Diagonal, Tmp));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Windows Virtual Key Codes Names
|
||||
// ---------------------
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -28,34 +28,14 @@
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
// Include
|
||||
// -------------------
|
||||
#define _SDL_MAIN_ // Avoid certain declarations in SDL.h
|
||||
#include "SDL.h" // Local
|
||||
#include "XInput.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// Definitions
|
||||
// -------------------
|
||||
int g_LastPad = 0;
|
||||
|
||||
|
||||
|
||||
namespace InputCommon
|
||||
{
|
||||
|
||||
|
||||
// Definitions
|
||||
// -------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Search attached devices. Populate joyinfo for all attached physical devices.
|
||||
// -----------------------
|
||||
bool SearchDevices(std::vector<CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads)
|
||||
@@ -112,140 +92,6 @@ bool SearchDevices(std::vector<CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Supporting functions
|
||||
// ----------------
|
||||
|
||||
// Read current joystick status
|
||||
/* ----------------
|
||||
The value PadMapping[].buttons[] is the number of the assigned joypad button,
|
||||
PadState[].buttons[] is the status of the button, it becomes 0 (no pressed) or 1 (pressed) */
|
||||
|
||||
|
||||
// Read buttons status. Called from GetJoyState().
|
||||
// ----------------------
|
||||
void ReadButton(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, int button, int NumButtons)
|
||||
{
|
||||
int ctl_button = _PadMapping.buttons[button];
|
||||
if (ctl_button < NumButtons)
|
||||
{
|
||||
_PadState.buttons[button] = SDL_JoystickGetButton(_PadState.joy, ctl_button);
|
||||
}
|
||||
}
|
||||
|
||||
// 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(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _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[CTL_MAIN_X] = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.axis[CTL_MAIN_X]);
|
||||
_PadState.axis[CTL_MAIN_Y] = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.axis[CTL_MAIN_Y]);
|
||||
_PadState.axis[CTL_SUB_X] = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.axis[CTL_SUB_X]);
|
||||
_PadState.axis[CTL_SUB_Y] = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.axis[CTL_SUB_Y]);
|
||||
|
||||
// Update the analog trigger axis values
|
||||
#ifdef _WIN32
|
||||
if (_PadMapping.triggertype == 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
|
||||
if(_PadMapping.buttons[CTL_L_SHOULDER] >= 1000) _PadState.axis[CTL_L_SHOULDER] = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.buttons[CTL_L_SHOULDER] - 1000); else _PadState.axis[CTL_L_SHOULDER] = 0;
|
||||
if(_PadMapping.buttons[CTL_R_SHOULDER] >= 1000) _PadState.axis[CTL_R_SHOULDER] = SDL_JoystickGetAxis(_PadState.joy, _PadMapping.buttons[CTL_R_SHOULDER] - 1000); else _PadState.axis[CTL_R_SHOULDER] = 0;
|
||||
#ifdef _WIN32
|
||||
}
|
||||
else
|
||||
{
|
||||
// XInput triggers for Xbox360 pads
|
||||
_PadState.axis[CTL_L_SHOULDER] = XInput::GetXI(Controller, _PadMapping.buttons[CTL_L_SHOULDER] - 1000);
|
||||
_PadState.axis[CTL_R_SHOULDER] = XInput::GetXI(Controller, _PadMapping.buttons[CTL_R_SHOULDER] - 1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Update button states to on or off
|
||||
ReadButton(_PadState, _PadMapping, CTL_L_SHOULDER, NumButtons);
|
||||
ReadButton(_PadState, _PadMapping, CTL_R_SHOULDER, NumButtons);
|
||||
ReadButton(_PadState, _PadMapping, CTL_A_BUTTON, NumButtons);
|
||||
ReadButton(_PadState, _PadMapping, CTL_B_BUTTON, NumButtons);
|
||||
ReadButton(_PadState, _PadMapping, CTL_X_BUTTON, NumButtons);
|
||||
ReadButton(_PadState, _PadMapping, CTL_Y_BUTTON, NumButtons);
|
||||
ReadButton(_PadState, _PadMapping, CTL_Z_TRIGGER, NumButtons);
|
||||
ReadButton(_PadState, _PadMapping, CTL_START, NumButtons);
|
||||
|
||||
// Update Halfpress state, this one is not in the standard _PadState.buttons array
|
||||
if (_PadMapping.halfpress < NumButtons && _PadMapping.halfpress >= 0)
|
||||
_PadState.halfpress = SDL_JoystickGetButton(_PadState.joy, _PadMapping.halfpress);
|
||||
else
|
||||
_PadState.halfpress = 0;
|
||||
|
||||
|
||||
// Check if we have an analog or digital joypad
|
||||
if (_PadMapping.controllertype == CTL_DPAD_HAT)
|
||||
{
|
||||
_PadState.dpad = SDL_JoystickGetHat(_PadState.joy, _PadMapping.dpad);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only do this if the assigned button is in range (to allow for the current way of saving keyboard
|
||||
// keys in the same array)
|
||||
if(_PadMapping.dpad2[CTL_D_PAD_UP] <= NumButtons)
|
||||
_PadState.dpad2[CTL_D_PAD_UP] = SDL_JoystickGetButton(_PadState.joy, _PadMapping.dpad2[CTL_D_PAD_UP]);
|
||||
if(_PadMapping.dpad2[CTL_D_PAD_DOWN] <= NumButtons)
|
||||
_PadState.dpad2[CTL_D_PAD_DOWN] = SDL_JoystickGetButton(_PadState.joy, _PadMapping.dpad2[CTL_D_PAD_DOWN]);
|
||||
if(_PadMapping.dpad2[CTL_D_PAD_LEFT] <= NumButtons)
|
||||
_PadState.dpad2[CTL_D_PAD_LEFT] = SDL_JoystickGetButton(_PadState.joy, _PadMapping.dpad2[CTL_D_PAD_LEFT]);
|
||||
if(_PadMapping.dpad2[CTL_D_PAD_RIGHT] <= NumButtons)
|
||||
_PadState.dpad2[CTL_D_PAD_RIGHT] = SDL_JoystickGetButton(_PadState.joy, _PadMapping.dpad2[CTL_D_PAD_RIGHT]);
|
||||
}
|
||||
|
||||
#ifdef SHOW_PAD_STATUS
|
||||
// Show the status of all connected pads
|
||||
//ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
//if ((g_LastPad == 0 && Controller == 0) || Controller < g_LastPad) Console->ClearScreen();
|
||||
g_LastPad = Controller;
|
||||
NOTICE_LOG(CONSOLE,
|
||||
"Pad | Number:%i Enabled:%i Handle:%i\n"
|
||||
"Main Stick | X:%03i Y:%03i\n"
|
||||
"C Stick | X:%03i Y:%03i\n"
|
||||
"Trigger | Type:%s DigitalL:%i DigitalR:%i AnalogL:%03i AnalogR:%03i HalfPress:%i\n"
|
||||
"Buttons | A:%i X:%i\n"
|
||||
"D-Pad | Type:%s Hat:%i U:%i D:%i\n"
|
||||
"======================================================\n",
|
||||
|
||||
Controller, _PadMapping.enabled, _PadState.joy,
|
||||
|
||||
_PadState.axis[InputCommon::CTL_MAIN_X], _PadState.axis[InputCommon::CTL_MAIN_Y],
|
||||
_PadState.axis[InputCommon::CTL_SUB_X], _PadState.axis[InputCommon::CTL_SUB_Y],
|
||||
|
||||
(_PadMapping.triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"),
|
||||
_PadState.buttons[InputCommon::CTL_L_SHOULDER], _PadState.buttons[InputCommon::CTL_R_SHOULDER],
|
||||
_PadState.axis[InputCommon::CTL_L_SHOULDER], _PadState.axis[InputCommon::CTL_R_SHOULDER],
|
||||
_PadState.halfpress,
|
||||
|
||||
_PadState.buttons[InputCommon::CTL_A_BUTTON], _PadState.buttons[InputCommon::CTL_X_BUTTON],
|
||||
|
||||
(_PadMapping.controllertype ? "CTL_DPAD_CUSTOM" : "CTL_DPAD_HAT"),
|
||||
_PadState.dpad,
|
||||
_PadState.dpad2[InputCommon::CTL_D_PAD_UP], _PadState.dpad2[InputCommon::CTL_D_PAD_DOWN]
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Configure button mapping
|
||||
// ----------
|
||||
|
||||
// Avoid extreme axis values
|
||||
// ---------------------
|
||||
/* Function: We have to avoid very big values to becuse some triggers are -0x8000 in the
|
||||
@@ -367,8 +213,6 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////// Configure button mapping
|
||||
|
||||
|
||||
|
||||
} // InputCommon
|
||||
|
||||
@@ -1,39 +1,24 @@
|
||||
|
||||
// Project description
|
||||
// -------------------
|
||||
// Name: SDL Input
|
||||
// Description: Common SDL Input Functions
|
||||
//
|
||||
// Author: Falcon4ever (nJoy@falcon4ever.com, www.multigesture.net), JPeterson etc
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
//
|
||||
|
||||
//
|
||||
// Licensetype: GNU General Public License (GPL)
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
|
||||
|
||||
#ifndef _SDL_h
|
||||
#define _SDL_h
|
||||
|
||||
|
||||
// Include
|
||||
// -------------------
|
||||
#include <iostream> // System
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
@@ -55,52 +40,27 @@
|
||||
#include "Common.h" // Common
|
||||
|
||||
|
||||
|
||||
namespace InputCommon
|
||||
{
|
||||
|
||||
// Settings
|
||||
// ----------
|
||||
// Show a status window with the detected axes, buttons and so on
|
||||
//#define SHOW_PAD_STATUS
|
||||
|
||||
|
||||
|
||||
// Structures
|
||||
/* -------------------
|
||||
CONTROLLER_STATE buttons (PadState) = 0 or 1
|
||||
CONTROLLER_MAPPING buttons (joystick) = 0 or 1, 2, 3, 4, a certain joypad button
|
||||
|
||||
Please remember: The axis limit is hardcoded here, if you allow more axises (for
|
||||
example for analog A and B buttons) you must first incrase the size of the axis array
|
||||
size here
|
||||
*/
|
||||
struct CONTROLLER_STATE // GC PAD INFO/STATE
|
||||
enum EButtonType
|
||||
{
|
||||
int buttons[8]; // Amount of buttons (A B X Y Z, L-Trigger R-Trigger Start) might need to change the triggers buttons
|
||||
int dpad; // Automatic SDL D-Pad (8 directions + neutral)
|
||||
int dpad2[4]; // D-pad using buttons
|
||||
int axis[6]; // 2 x 2 Axes (Main & Sub)
|
||||
int halfpress; // Halfpress... you know, like not fully pressed ;)...
|
||||
SDL_Joystick *joy; // SDL joystick device
|
||||
CTL_AXIS = 0,
|
||||
CTL_HAT,
|
||||
CTL_BUTTON,
|
||||
CTL_KEY,
|
||||
};
|
||||
|
||||
struct CONTROLLER_MAPPING // GC PAD MAPPING
|
||||
enum ETriggerType
|
||||
{
|
||||
bool enable;
|
||||
int buttons[8]; // (See above)
|
||||
int dpad; // (See above)
|
||||
int dpad2[4]; // (See above)
|
||||
int axis[6]; // (See above)
|
||||
int halfpress; // (See above)
|
||||
int deadzone; // Deadzone... what else?
|
||||
int ID; // SDL joystick device ID
|
||||
int controllertype; // Hat: Hat or custom buttons
|
||||
int triggertype; // Triggers range
|
||||
std::string SRadius, SDiagonal, SRadiusC, SDiagonalC;
|
||||
bool bRadiusOnOff, bSquareToCircle, bRadiusOnOffC, bSquareToCircleC;
|
||||
bool rumble;
|
||||
int eventnum; // Linux Event Number, Can't be found dynamically yet
|
||||
CTL_TRIGGER_SDL = 0,
|
||||
CTL_TRIGGER_XINPUT,
|
||||
};
|
||||
|
||||
enum EXInputTrigger
|
||||
{
|
||||
XI_TRIGGER_L = 0,
|
||||
XI_TRIGGER_R,
|
||||
};
|
||||
|
||||
struct CONTROLLER_INFO // CONNECTED WINDOWS DEVICES INFO
|
||||
@@ -114,66 +74,10 @@ struct CONTROLLER_INFO // CONNECTED WINDOWS DEVICES INFO
|
||||
bool Good; // Pad is good (it has at least one button or axis)
|
||||
SDL_Joystick *joy; // SDL joystick device
|
||||
};
|
||||
enum
|
||||
{
|
||||
// CTL_L_SHOULDER and CTL_R_SHOULDER = 0 and 1
|
||||
CTL_MAIN_X = 2,
|
||||
CTL_MAIN_Y,
|
||||
CTL_SUB_X,
|
||||
CTL_SUB_Y
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CTL_L_SHOULDER = 0,
|
||||
CTL_R_SHOULDER,
|
||||
CTL_A_BUTTON,
|
||||
CTL_B_BUTTON,
|
||||
CTL_X_BUTTON,
|
||||
CTL_Y_BUTTON,
|
||||
CTL_Z_TRIGGER,
|
||||
CTL_START
|
||||
};
|
||||
// DPad Type
|
||||
enum
|
||||
{
|
||||
CTL_DPAD_HAT = 0, // Automatically use the first hat that SDL finds
|
||||
CTL_DPAD_CUSTOM // Custom directional pad settings
|
||||
};
|
||||
// Trigger Type
|
||||
enum
|
||||
{
|
||||
CTL_TRIGGER_SDL = 0, //
|
||||
CTL_TRIGGER_XINPUT // The XBox 360 pad
|
||||
};
|
||||
enum
|
||||
{
|
||||
CTL_D_PAD_UP = 0,
|
||||
CTL_D_PAD_DOWN,
|
||||
CTL_D_PAD_LEFT,
|
||||
CTL_D_PAD_RIGHT
|
||||
};
|
||||
// Button type for the configuration
|
||||
enum
|
||||
{
|
||||
CTL_AXIS = 0,
|
||||
CTL_HAT,
|
||||
CTL_BUTTON,
|
||||
CTL_KEY
|
||||
};
|
||||
// XInput buttons
|
||||
enum
|
||||
{
|
||||
XI_TRIGGER_L = 0,
|
||||
XI_TRIGGER_R
|
||||
};
|
||||
|
||||
// Declarations
|
||||
// ---------
|
||||
|
||||
// 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,bool);
|
||||
|
||||
// Value conversion
|
||||
@@ -182,17 +86,11 @@ float Rad2Deg(float Rad);
|
||||
int Pad_Convert(int _val);
|
||||
float SquareDistance(float deg);
|
||||
bool IsDeadZone(float DeadZone, int x, int y);
|
||||
void Square2Circle(int &_x, int &_y, int _pad, std::string SDiagonal, bool Circle2Square = false);
|
||||
void RadiusAdjustment(int &_x, int &_y, int _pad, std::string SRadius);
|
||||
|
||||
void Square2Circle(int &_x, int &_y, int _Diagonal, bool Circle2Square = false);
|
||||
void RadiusAdjustment(s8 &_x, s8 &_y, int _Radius);
|
||||
// Input configuration
|
||||
std::string VKToString(int keycode);
|
||||
|
||||
#ifndef _SDL_MAIN_
|
||||
extern int g_LastPad;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
} // InputCommon
|
||||
|
||||
|
||||
+24
-28
@@ -1,5 +1,5 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core\Core.vcproj", "{F0B874CB-4476-4199-9315-8343D05AE684}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}
|
||||
@@ -69,12 +69,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\D
|
||||
{823DDC98-42D5-4A38-88CF-9DC06C788AE4} = {823DDC98-42D5-4A38-88CF-9DC06C788AE4}
|
||||
{3D8156A9-64D1-4C8E-ADBE-1B319030E4A4} = {3D8156A9-64D1-4C8E-ADBE-1B319030E4A4}
|
||||
{0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E} = {0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E}
|
||||
{521498BE-6089-4780-8223-E67C22F4E068} = {521498BE-6089-4780-8223-E67C22F4E068}
|
||||
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA} = {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}
|
||||
{29C2ABC1-ADA5-42CD-A5FC-96022D52A510} = {29C2ABC1-ADA5-42CD-A5FC-96022D52A510}
|
||||
{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77} = {4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}
|
||||
{F0B874CB-4476-4199-9315-8343D05AE684} = {F0B874CB-4476-4199-9315-8343D05AE684}
|
||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16} = {9FF603F8-B3BB-4144-9688-B2B802FA0F16}
|
||||
{B7F1A9FB-BEA8-416E-9460-AE35A6A5165C} = {B7F1A9FB-BEA8-416E-9460-AE35A6A5165C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
@@ -92,13 +92,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoCommon", "Core\VideoCo
|
||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_nJoy_SDL", "Plugins\Plugin_nJoy_SDL\Plugin_nJoy_SDL.vcproj", "{521498BE-6089-4780-8223-E67C22F4E068}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}
|
||||
{11F55366-12EC-4C44-A8CB-1D4E315D61ED} = {11F55366-12EC-4C44-A8CB-1D4E315D61ED}
|
||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_DSP_HLE", "Plugins\Plugin_DSP_HLE\Plugin_DSP_HLE.vcproj", "{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{05C75041-D67D-4903-A362-8395A7B35C75} = {05C75041-D67D-4903-A362-8395A7B35C75}
|
||||
@@ -200,6 +193,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VideoSoftware", "Plu
|
||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_GCPad", "Plugins\Plugin_GCpad\Plugin_GCpad.vcproj", "{9FF603F8-B3BB-4144-9688-B2B802FA0F16}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}
|
||||
{05C75041-D67D-4903-A362-8395A7B35C75} = {05C75041-D67D-4903-A362-8395A7B35C75}
|
||||
{11F55366-12EC-4C44-A8CB-1D4E315D61ED} = {11F55366-12EC-4C44-A8CB-1D4E315D61ED}
|
||||
{0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E} = {0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E}
|
||||
{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} = {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}
|
||||
{C573CAF7-EE6A-458E-8049-16C0BF34C2E9} = {C573CAF7-EE6A-458E-8049-16C0BF34C2E9}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -236,16 +239,13 @@ Global
|
||||
{636FAD5F-02D1-4E9A-BE67-FB8EA99B9A18}.Release|x64.Build.0 = Release|x64
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Debug|x64.Build.0 = Debug|x64
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.DebugFast|Win32.Build.0 = DebugFast|Win32
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.DebugFast|x64.ActiveCfg = DebugFast|x64
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.DebugFast|x64.Build.0 = DebugFast|x64
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.DebugFast|x64.ActiveCfg = DebugFast|Win32
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Release|Win32.Build.0 = Release|Win32
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Release|x64.ActiveCfg = Release|x64
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Release|x64.Build.0 = Release|x64
|
||||
{9A183B48-ECC2-4121-876A-9B3793686073}.Release|x64.ActiveCfg = Release|Win32
|
||||
{29C2ABC1-ADA5-42CD-A5FC-96022D52A510}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{29C2ABC1-ADA5-42CD-A5FC-96022D52A510}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{29C2ABC1-ADA5-42CD-A5FC-96022D52A510}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -342,18 +342,6 @@ Global
|
||||
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Release|Win32.Build.0 = Release|Win32
|
||||
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Release|x64.ActiveCfg = Release|x64
|
||||
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Release|x64.Build.0 = Release|x64
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.Debug|x64.Build.0 = Debug|x64
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|Win32.Build.0 = DebugFast|Win32
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|x64.ActiveCfg = DebugFast|x64
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|x64.Build.0 = DebugFast|x64
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.Release|Win32.Build.0 = Release|Win32
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.Release|x64.ActiveCfg = Release|x64
|
||||
{521498BE-6089-4780-8223-E67C22F4E068}.Release|x64.Build.0 = Release|x64
|
||||
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@@ -486,7 +474,6 @@ Global
|
||||
{40C636FA-B5BF-4D67-ABC8-376B524A7551}.DebugFast|x64.ActiveCfg = Release|x64
|
||||
{40C636FA-B5BF-4D67-ABC8-376B524A7551}.DebugFast|x64.Build.0 = Release|x64
|
||||
{40C636FA-B5BF-4D67-ABC8-376B524A7551}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{40C636FA-B5BF-4D67-ABC8-376B524A7551}.Release|Win32.Build.0 = Release|Win32
|
||||
{40C636FA-B5BF-4D67-ABC8-376B524A7551}.Release|x64.ActiveCfg = Release|x64
|
||||
{40C636FA-B5BF-4D67-ABC8-376B524A7551}.Release|x64.Build.0 = Release|x64
|
||||
{F81AE75C-3D17-4D8C-A201-82FA5351C123}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
@@ -573,6 +560,15 @@ Global
|
||||
{66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|Win32.Build.0 = Release|Win32
|
||||
{66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|x64.ActiveCfg = Release|x64
|
||||
{66A4E7BD-E2E8-4373-9B75-8750EB5AE683}.Release|x64.Build.0 = Release|x64
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.DebugFast|Win32.Build.0 = DebugFast|Win32
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.DebugFast|x64.ActiveCfg = DebugFast|Win32
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.Release|Win32.Build.0 = Release|Win32
|
||||
{9FF603F8-B3BB-4144-9688-B2B802FA0F16}.Release|x64.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
// Copyright (C) 2003 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/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "Config.h"
|
||||
#include "GCpad.h"
|
||||
|
||||
static const char* gcControlNames[] =
|
||||
{
|
||||
"Button_A",
|
||||
"Button_B",
|
||||
"Button_X",
|
||||
"Button_Y",
|
||||
"Button_Z",
|
||||
"Button_Start",
|
||||
|
||||
"DPad_Up",
|
||||
"DPad_Down",
|
||||
"DPad_Left",
|
||||
"DPad_Right",
|
||||
|
||||
"Stick_Up",
|
||||
"Stick_Down",
|
||||
"Stick_Left",
|
||||
"Stick_Right",
|
||||
|
||||
"CStick_Up",
|
||||
"CStick_Down",
|
||||
"CStick_Left",
|
||||
"CStick_Right",
|
||||
|
||||
"Shoulder_L",
|
||||
"Shoulder_R",
|
||||
"Shoulder_Semi_L",
|
||||
"Shoulder_Semi_R",
|
||||
};
|
||||
|
||||
static const int gcDefaultControls[] =
|
||||
#ifdef _WIN32
|
||||
{
|
||||
'X',
|
||||
'Z',
|
||||
'C',
|
||||
'S',
|
||||
'D',
|
||||
VK_RETURN,
|
||||
'T',
|
||||
'G',
|
||||
'F',
|
||||
'H',
|
||||
VK_UP,
|
||||
VK_DOWN,
|
||||
VK_LEFT,
|
||||
VK_RIGHT,
|
||||
'I',
|
||||
'K',
|
||||
'J',
|
||||
'L',
|
||||
'Q',
|
||||
'W',
|
||||
0x00,
|
||||
0x00,
|
||||
};
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
{
|
||||
XK_x, // A
|
||||
XK_z, // B
|
||||
XK_c, // X
|
||||
XK_s, // Y
|
||||
XK_d, // Z
|
||||
XK_Return, // Start
|
||||
XK_t, // D-pad up
|
||||
XK_g, // D-pad down
|
||||
XK_f, // D-pad left
|
||||
XK_h, // D-pad right
|
||||
XK_Up, // Main stick up
|
||||
XK_Down, // Main stick down
|
||||
XK_Left, // Main stick left
|
||||
XK_Right, // Main stick right
|
||||
XK_i, // C-stick up
|
||||
XK_k, // C-stick down
|
||||
XK_j, // C-stick left
|
||||
XK_l, // C-stick right
|
||||
XK_q, // L
|
||||
XK_w, // R
|
||||
0x00, // L semi-press
|
||||
0x00, // R semi-press
|
||||
};
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
// Reference for Cocoa key codes:
|
||||
// http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
|
||||
{
|
||||
7, // A (x)
|
||||
6, // B (z)
|
||||
8, // X (c)
|
||||
1, // Y (s)
|
||||
2, // Z (d)
|
||||
36, // Start (return)
|
||||
17, // D-pad up (t)
|
||||
5, // D-pad down (g)
|
||||
3, // D-pad left (f)
|
||||
4, // D-pad right (h)
|
||||
126, // Main stick up (up)
|
||||
125, // Main stick down (down)
|
||||
123, // Main stick left (left)
|
||||
124, // Main stick right (right)
|
||||
34, // C-stick up (i)
|
||||
40, // C-stick down (k)
|
||||
38, // C-stick left (j)
|
||||
37, // C-stick right (l)
|
||||
12, // L (q)
|
||||
13, // R (w)
|
||||
-1, // L semi-press (none)
|
||||
-1, // R semi-press (none)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Config g_Config;
|
||||
|
||||
// Run when created
|
||||
// -----------------
|
||||
Config::Config()
|
||||
{
|
||||
}
|
||||
|
||||
// Save settings to file
|
||||
// ---------------------
|
||||
void Config::Save()
|
||||
{
|
||||
// Load ini file
|
||||
IniFile file;
|
||||
file.Load(FULL_CONFIG_DIR "GCPad.ini");
|
||||
|
||||
// ==================================================================
|
||||
// Global settings
|
||||
file.Set("General", "NoTriggerFilter", g_Config.bNoTriggerFilter);
|
||||
#ifdef RERECORDING
|
||||
file.Set("General", "Recording", g_Config.bRecording);
|
||||
file.Set("General", "Playback", g_Config.bPlayback);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
// ==================================================================
|
||||
// Slot specific settings only
|
||||
std::string SectionName = StringFromFormat("GCPad%i", i+1);
|
||||
file.Set(SectionName.c_str(), "DeviceID", GCMapping[i].ID);
|
||||
file.Set(SectionName.c_str(), "Axis_Lx", GCMapping[i].AxisMapping.Lx);
|
||||
file.Set(SectionName.c_str(), "Axis_Ly", GCMapping[i].AxisMapping.Ly);
|
||||
file.Set(SectionName.c_str(), "Axis_Rx", GCMapping[i].AxisMapping.Rx);
|
||||
file.Set(SectionName.c_str(), "Axis_Ry", GCMapping[i].AxisMapping.Ry);
|
||||
file.Set(SectionName.c_str(), "Trigger_L", GCMapping[i].AxisMapping.Tl);
|
||||
file.Set(SectionName.c_str(), "Trigger_R", GCMapping[i].AxisMapping.Tr);
|
||||
file.Set(SectionName.c_str(), "DeadZoneL", GCMapping[i].DeadZoneL);
|
||||
file.Set(SectionName.c_str(), "DeadZoneR", GCMapping[i].DeadZoneR);
|
||||
file.Set(SectionName.c_str(), "Diagonal", GCMapping[i].Diagonal);
|
||||
file.Set(SectionName.c_str(), "Square2Circle", GCMapping[i].bSquare2Circle);
|
||||
file.Set(SectionName.c_str(), "Rumble", GCMapping[i].Rumble);
|
||||
file.Set(SectionName.c_str(), "RumbleStrength", GCMapping[i].RumbleStrength);
|
||||
file.Set(SectionName.c_str(), "TriggerType", GCMapping[i].TriggerType);
|
||||
|
||||
file.Set(SectionName.c_str(), "Source_Stick", GCMapping[i].Stick.Main);
|
||||
file.Set(SectionName.c_str(), "Source_CStick", GCMapping[i].Stick.Sub);
|
||||
file.Set(SectionName.c_str(), "Source_Shoulder", GCMapping[i].Stick.Shoulder);
|
||||
|
||||
// ButtonMapping
|
||||
for (int x = 0; x < LAST_CONSTANT; x++)
|
||||
file.Set(SectionName.c_str(), gcControlNames[x], GCMapping[i].Button[x]);
|
||||
}
|
||||
|
||||
file.Save(FULL_CONFIG_DIR "GCPad.ini");
|
||||
}
|
||||
|
||||
// Load settings from file
|
||||
// -----------------------
|
||||
void Config::Load()
|
||||
{
|
||||
// Load file
|
||||
IniFile file;
|
||||
file.Load(FULL_CONFIG_DIR "GCPad.ini");
|
||||
|
||||
// ==================================================================
|
||||
// Global settings
|
||||
file.Get("General", "NoTriggerFilter", &g_Config.bNoTriggerFilter, false);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
std::string SectionName = StringFromFormat("GCPad%i", i+1);
|
||||
|
||||
file.Get(SectionName.c_str(), "DeviceID", &GCMapping[i].ID, 0);
|
||||
file.Get(SectionName.c_str(), "Axis_Lx", &GCMapping[i].AxisMapping.Lx, 0);
|
||||
file.Get(SectionName.c_str(), "Axis_Ly", &GCMapping[i].AxisMapping.Ly, 1);
|
||||
file.Get(SectionName.c_str(), "Axis_Rx", &GCMapping[i].AxisMapping.Rx, 2);
|
||||
file.Get(SectionName.c_str(), "Axis_Ry", &GCMapping[i].AxisMapping.Ry, 3);
|
||||
file.Get(SectionName.c_str(), "Trigger_L", &GCMapping[i].AxisMapping.Tl, 1004);
|
||||
file.Get(SectionName.c_str(), "Trigger_R", &GCMapping[i].AxisMapping.Tr, 1005);
|
||||
file.Get(SectionName.c_str(), "DeadZoneL", &GCMapping[i].DeadZoneL, 0);
|
||||
file.Get(SectionName.c_str(), "DeadZoneR", &GCMapping[i].DeadZoneR, 0);
|
||||
file.Get(SectionName.c_str(), "Diagonal", &GCMapping[i].Diagonal, 100);
|
||||
file.Get(SectionName.c_str(), "Square2Circle", &GCMapping[i].bSquare2Circle, false);
|
||||
file.Get(SectionName.c_str(), "Rumble", &GCMapping[i].Rumble, false);
|
||||
file.Get(SectionName.c_str(), "RumbleStrength", &GCMapping[i].RumbleStrength, 8); // x10
|
||||
file.Get(SectionName.c_str(), "TriggerType", &GCMapping[i].TriggerType, 0);
|
||||
|
||||
file.Get(SectionName.c_str(), "Source_Stick", &GCMapping[i].Stick.Main, 0);
|
||||
file.Get(SectionName.c_str(), "Source_CStick", &GCMapping[i].Stick.Sub, 0);
|
||||
file.Get(SectionName.c_str(), "Source_Shoulder", &GCMapping[i].Stick.Shoulder, 0);
|
||||
|
||||
// ButtonMapping
|
||||
for (int x = 0; x < LAST_CONSTANT; x++)
|
||||
file.Get(SectionName.c_str(), gcControlNames[x], &GCMapping[i].Button[x], gcDefaultControls[x]);
|
||||
}
|
||||
}
|
||||
|
||||
+38
-42
@@ -1,42 +1,38 @@
|
||||
// Copyright (C) 2003 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/
|
||||
|
||||
#ifndef _PLUGIN_NJOY_SDL_CONFIG_H
|
||||
#define _PLUGIN_NJOY_SDL_CONFIG_H
|
||||
|
||||
struct Config
|
||||
{
|
||||
Config();
|
||||
void Load(bool ChangePad = false, bool ChangeSaveByID = false);
|
||||
void Save(int Slot = -1);
|
||||
int CheckForDuplicateJoypads(bool OK);
|
||||
|
||||
// General
|
||||
bool bShowAdvanced; // Only allow one of these
|
||||
bool bSaveByID;
|
||||
bool bCheckFocus;
|
||||
bool bNoTriggerFilter;
|
||||
int RumbleStrength;
|
||||
#ifdef RERECORDING
|
||||
bool bRecording;
|
||||
bool bPlayback;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern Config g_Config;
|
||||
|
||||
#endif // _PLUGIN_NJOY_SDL_CONFIG_H
|
||||
// Copyright (C) 2003 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/
|
||||
|
||||
|
||||
#ifndef _PLUGIN_GCPAD_CONFIG_H
|
||||
#define _PLUGIN_GCPAD_CONFIG_H
|
||||
|
||||
struct Config
|
||||
{
|
||||
Config();
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
// General
|
||||
bool bNoTriggerFilter;
|
||||
#ifdef RERECORDING
|
||||
bool bRecording;
|
||||
bool bPlayback;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern Config g_Config;
|
||||
|
||||
#endif // _PLUGIN_GCPAD_CONFIG_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,226 @@
|
||||
// Copyright (C) 2003 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/
|
||||
|
||||
|
||||
#ifndef __GCPAD_CONFIGBOX_h__
|
||||
#define __GCPAD_CONFIGBOX_h__
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/gbsizer.h>
|
||||
|
||||
#include "GCpad.h"
|
||||
|
||||
class GCPadConfigDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
GCPadConfigDialog(wxWindow *parent, wxWindowID id = 1,
|
||||
const wxString &title = wxT("Gamecube Pad Plugin Configuration"),
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE);
|
||||
virtual ~GCPadConfigDialog();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
enum
|
||||
{
|
||||
// it's important that they are kept in this order
|
||||
IDB_BTN_A = 0,
|
||||
IDB_BTN_B,
|
||||
IDB_BTN_X,
|
||||
IDB_BTN_Y,
|
||||
IDB_BTN_Z,
|
||||
IDB_BTN_START,
|
||||
|
||||
IDB_DPAD_UP,
|
||||
IDB_DPAD_DOWN,
|
||||
IDB_DPAD_LEFT,
|
||||
IDB_DPAD_RIGHT,
|
||||
|
||||
IDB_MAIN_UP,
|
||||
IDB_MAIN_DOWN,
|
||||
IDB_MAIN_LEFT,
|
||||
IDB_MAIN_RIGHT,
|
||||
|
||||
IDB_SUB_UP,
|
||||
IDB_SUB_DOWN,
|
||||
IDB_SUB_LEFT,
|
||||
IDB_SUB_RIGHT,
|
||||
|
||||
IDB_SHDR_L,
|
||||
IDB_SHDR_R,
|
||||
IDB_SHDR_SEMI_L,
|
||||
IDB_SHDR_SEMI_R,
|
||||
|
||||
// Joypad
|
||||
IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y,
|
||||
IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y,
|
||||
IDB_TRIGGER_L, IDB_TRIGGER_R,
|
||||
|
||||
// Dialog controls
|
||||
ID_OK = 1000,
|
||||
ID_CANCEL,
|
||||
ID_NOTEBOOK,
|
||||
ID_CONTROLLERPAGE1,
|
||||
ID_CONTROLLERPAGE2,
|
||||
ID_CONTROLLERPAGE3,
|
||||
ID_CONTROLLERPAGE4,
|
||||
|
||||
// Timers
|
||||
IDTM_BUTTON, IDTM_UPDATE_PAD,
|
||||
|
||||
// Gamepad settings
|
||||
IDC_JOYNAME,
|
||||
IDC_DEAD_ZONE_LEFT, IDC_DEAD_ZONE_RIGHT,
|
||||
IDC_STICK_DIAGONAL, IDC_STICK_S2C,
|
||||
IDC_RUMBLE, IDC_RUMBLE_STRENGTH,
|
||||
IDC_TRIGGER_TYPE,
|
||||
IDC_STICK_SOURCE, IDC_CSTICK_SOURCE, IDC_TRIGGER_SOURCE,
|
||||
};
|
||||
|
||||
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_CheckS2C[4],
|
||||
*m_CheckRumble[4];
|
||||
|
||||
wxButton *m_OK, *m_Cancel, *ClickedButton,
|
||||
*m_Button_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][4],
|
||||
*m_Button_GC[IDB_SHDR_SEMI_R - IDB_BTN_A + 1][4];
|
||||
|
||||
wxComboBox *m_Joyname[4],
|
||||
*m_ComboDeadZoneLeft[4],
|
||||
*m_ComboDeadZoneRight[4],
|
||||
*m_ComboDiagonal[4],
|
||||
*m_RumbleStrength[4],
|
||||
*m_TriggerType[4],
|
||||
*m_Combo_StickSrc[4],
|
||||
*m_Combo_CStickSrc[4],
|
||||
*m_Combo_TriggerSrc[4];
|
||||
|
||||
wxGridBagSizer *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_sSquare2Circle[4],
|
||||
*m_sS2CDeadZone[4],
|
||||
*m_sRumbleStrength[4],
|
||||
*m_sRumble[4],
|
||||
*m_sHorizJoypad[4],
|
||||
*m_sHorizStatus[4],
|
||||
*m_Sizer_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][4],
|
||||
*m_sAnalogLeft[4],
|
||||
*m_sAnalogMiddle[4],
|
||||
*m_sAnalogRight[4],
|
||||
*m_sHorizAnalog[4],
|
||||
*m_sStickSrc[4],
|
||||
*m_sCStickSrc[4],
|
||||
*m_sTriggerSrc[4],
|
||||
*m_Sizer_Pad[IDB_SHDR_SEMI_R - IDB_BTN_A + 1][4],
|
||||
*m_sHorizMapping[4];
|
||||
|
||||
wxStaticBoxSizer *m_gJoyPad[4],
|
||||
*m_gStickLeft[4],
|
||||
*m_gStickRight[4],
|
||||
*m_gTriggers[4],
|
||||
*m_gAnalog[4],
|
||||
*m_gButton[4],
|
||||
*m_gDPad[4],
|
||||
*m_gStick[4],
|
||||
*m_gCStick[4],
|
||||
*m_gTrigger[4];
|
||||
|
||||
wxStaticText *m_ComboDeadZoneLabel[4],
|
||||
*m_DiagonalLabel[4],
|
||||
*m_RumbleStrengthLabel[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_Text_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][4],
|
||||
*m_Text_Pad[IDB_SHDR_SEMI_R - IDB_BTN_A + 1][4],
|
||||
*m_Text_StickSrc[5],
|
||||
*m_Text_CStickSrc[5],
|
||||
*m_Text_TriggerSrc[5];
|
||||
|
||||
wxStaticBitmap *m_bmpDotLeftIn[4],
|
||||
*m_bmpDotLeftOut[4],
|
||||
*m_bmpDotRightIn[4],
|
||||
*m_bmpDotRightOut[4],
|
||||
*m_bmpDeadZoneLeftIn[4],
|
||||
*m_bmpDeadZoneRightIn[4];
|
||||
|
||||
bool m_ControlsCreated;
|
||||
int m_Page, BoxW, BoxH;
|
||||
int GetButtonWaitingID, GetButtonWaitingTimer, g_Pressed;
|
||||
wxString OldLabel;
|
||||
|
||||
#if wxUSE_TIMER
|
||||
wxTimer *m_UpdatePadTimer, *m_ButtonMappingTimer;
|
||||
void UpdatePadInfo(wxTimerEvent& WXUNUSED(event));
|
||||
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
|
||||
#endif
|
||||
|
||||
wxBitmap CreateBitmap();
|
||||
wxBitmap CreateBitmapDot();
|
||||
wxBitmap CreateBitmapDeadZone(int Radius);
|
||||
wxBitmap CreateBitmapClear();
|
||||
|
||||
void NotebookPageChanged(wxNotebookEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnCloseClick(wxCommandEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnButtonClick(wxCommandEvent& event);
|
||||
void OnAxisClick(wxCommandEvent& event);
|
||||
void ChangeSettings(wxCommandEvent& event);
|
||||
void SaveButtonMapping(int Id, int Key);
|
||||
void UpdateGUI();
|
||||
void CreateGUIControls();
|
||||
|
||||
void Convert2Box(int &x);
|
||||
void DoChangeDeadZone();
|
||||
void ToBlank(bool ToBlank, int Id);
|
||||
|
||||
void DoGetButtons(int _GetId);
|
||||
void SetButtonText(int id, const wxString &str);
|
||||
wxString GetButtonText(int id);
|
||||
};
|
||||
|
||||
#endif // __GCPAD_CONFIGBOX_h__
|
||||
@@ -0,0 +1,310 @@
|
||||
// Copyright (C) 2003 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/
|
||||
|
||||
#include "Config.h"
|
||||
#include "ConfigBox.h"
|
||||
#include "GCpad.h"
|
||||
|
||||
|
||||
// Replace the harder to understand -1 with "" for the sake of user friendliness
|
||||
void GCPadConfigDialog::ToBlank(bool ToBlank, int Id)
|
||||
{
|
||||
if (!m_ControlsCreated)
|
||||
return;
|
||||
|
||||
if(ToBlank)
|
||||
{
|
||||
if (GetButtonText(Id) == wxString(wxT("-1")))
|
||||
SetButtonText(Id, wxString());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetButtonText(Id).IsEmpty())
|
||||
SetButtonText(Id, wxString(wxT("-1")));
|
||||
}
|
||||
}
|
||||
|
||||
void GCPadConfigDialog::DoChangeDeadZone()
|
||||
{
|
||||
float Rad;
|
||||
|
||||
Rad = (float)GCMapping[m_Page].DeadZoneL * ((float)BoxW / 100.0) * 0.5;
|
||||
m_bmpDeadZoneLeftIn[m_Page]->SetBitmap(CreateBitmapClear());
|
||||
m_bmpDeadZoneLeftIn[m_Page]->SetSize(0, 0);
|
||||
m_bmpDeadZoneLeftIn[m_Page]->SetBitmap(CreateBitmapDeadZone((int)Rad));
|
||||
m_bmpDeadZoneLeftIn[m_Page]->SetPosition(wxPoint(BoxW / 2 - (int)Rad, BoxH / 2 - (int)Rad));
|
||||
m_bmpDeadZoneLeftIn[m_Page]->Refresh();
|
||||
|
||||
Rad = (float)GCMapping[m_Page].DeadZoneR * ((float)BoxW / 100.0) * 0.5;
|
||||
m_bmpDeadZoneRightIn[m_Page]->SetBitmap(CreateBitmapClear());
|
||||
m_bmpDeadZoneRightIn[m_Page]->SetSize(0, 0);
|
||||
m_bmpDeadZoneRightIn[m_Page]->SetBitmap(CreateBitmapDeadZone((int)Rad));
|
||||
m_bmpDeadZoneRightIn[m_Page]->SetPosition(wxPoint(BoxW / 2 - (int)Rad, BoxH / 2 - (int)Rad));
|
||||
m_bmpDeadZoneRightIn[m_Page]->Refresh();
|
||||
}
|
||||
|
||||
// Update the textbox for the buttons
|
||||
void GCPadConfigDialog::SetButtonText(int id, const wxString &str)
|
||||
{
|
||||
if (IDB_ANALOG_LEFT_X <= id && id <= IDB_TRIGGER_R)
|
||||
m_Button_Analog[id - IDB_ANALOG_LEFT_X][m_Page]->SetLabel(str);
|
||||
else if (IDB_BTN_A <= id && id <= IDB_SHDR_SEMI_R)
|
||||
m_Button_GC[id - IDB_BTN_A][m_Page]->SetLabel(str);
|
||||
}
|
||||
|
||||
// Get the text in the textbox for the buttons
|
||||
wxString GCPadConfigDialog::GetButtonText(int id)
|
||||
{
|
||||
if (IDB_ANALOG_LEFT_X <= id && id <= IDB_TRIGGER_R)
|
||||
return m_Button_Analog[id - IDB_ANALOG_LEFT_X][m_Page]->GetLabel();
|
||||
else if (IDB_BTN_A <= id && id <= IDB_SHDR_SEMI_R)
|
||||
return m_Button_GC[id - IDB_BTN_A][m_Page]->GetLabel();
|
||||
|
||||
return wxString();
|
||||
}
|
||||
|
||||
void GCPadConfigDialog::DoGetButtons(int _GetId)
|
||||
{
|
||||
// Collect the starting values
|
||||
// Get the current controller
|
||||
int PadID = GCMapping[m_Page].ID;
|
||||
|
||||
// Get the controller and trigger type
|
||||
int TriggerType = GCMapping[m_Page].TriggerType;
|
||||
|
||||
// Collect the accepted buttons for this slot
|
||||
bool LeftRight = (_GetId == IDB_TRIGGER_L || _GetId == IDB_TRIGGER_R);
|
||||
|
||||
bool Axis = (_GetId >= IDB_ANALOG_LEFT_X && _GetId <= IDB_TRIGGER_R)
|
||||
// Don't allow SDL axis input for the shoulder buttons if XInput is selected
|
||||
&& !(TriggerType == InputCommon::CTL_TRIGGER_XINPUT && (_GetId == IDB_TRIGGER_L || _GetId == IDB_TRIGGER_R) );
|
||||
|
||||
bool XInput = (TriggerType == InputCommon::CTL_TRIGGER_XINPUT);
|
||||
|
||||
bool Button = (_GetId >= IDB_BTN_A && _GetId <= IDB_SHDR_SEMI_R);
|
||||
|
||||
bool Hat = (_GetId >= IDB_BTN_A && _GetId <= IDB_SHDR_SEMI_R);
|
||||
|
||||
bool NoTriggerFilter = g_Config.bNoTriggerFilter;
|
||||
|
||||
// Values used in this function
|
||||
int Seconds = 4; // Seconds to wait for
|
||||
int TimesPerSecond = 40; // How often to run the check
|
||||
|
||||
// Values returned from InputCommon::GetButton()
|
||||
int value; // Axis value or Hat value
|
||||
int type; // Button type
|
||||
|
||||
int KeyPressed = 0;
|
||||
int pressed = 0;
|
||||
bool Succeed = false;
|
||||
bool Stop = false; // Stop the timer
|
||||
|
||||
// If the Id has changed or the timer is not running we should start one
|
||||
if( GetButtonWaitingID != _GetId || !m_ButtonMappingTimer->IsRunning() )
|
||||
{
|
||||
if(m_ButtonMappingTimer->IsRunning())
|
||||
m_ButtonMappingTimer->Stop();
|
||||
|
||||
// Save the button Id
|
||||
GetButtonWaitingID = _GetId;
|
||||
GetButtonWaitingTimer = 0;
|
||||
|
||||
// Start the timer
|
||||
#if wxUSE_TIMER
|
||||
m_ButtonMappingTimer->Start(1000 / TimesPerSecond);
|
||||
#endif
|
||||
DEBUG_LOG(PAD, "Timer Started: Pad:%i _GetId:%i "
|
||||
"Allowed input is Axis:%i LeftRight:%i XInput:%i Button:%i Hat:%i",
|
||||
GCMapping[m_Page].ID, _GetId,
|
||||
Axis, LeftRight, XInput, Button, Hat);
|
||||
}
|
||||
|
||||
// Check for buttons
|
||||
// If there is a timer we should not create a new one
|
||||
else if (NumGoodPads > 0)
|
||||
{
|
||||
InputCommon::GetButton(
|
||||
GCMapping[m_Page].joy, PadID, joyinfo[PadID].NumButtons, joyinfo[PadID].NumAxes, joyinfo[PadID].NumHats,
|
||||
KeyPressed, value, type, pressed, Succeed, Stop,
|
||||
LeftRight, Axis, XInput, Button, Hat, NoTriggerFilter);
|
||||
}
|
||||
|
||||
// Process results
|
||||
// Count each time
|
||||
GetButtonWaitingTimer++;
|
||||
|
||||
// This is run every second
|
||||
if (GetButtonWaitingTimer % TimesPerSecond == 0)
|
||||
{
|
||||
// Current time
|
||||
int TmpTime = Seconds - (GetButtonWaitingTimer / TimesPerSecond);
|
||||
// Update text
|
||||
SetButtonText(_GetId, wxString::Format(wxT("[ %d ]"), TmpTime));
|
||||
}
|
||||
|
||||
// Time's up
|
||||
if (GetButtonWaitingTimer / TimesPerSecond >= Seconds)
|
||||
{
|
||||
Stop = true;
|
||||
// Revert back to old label
|
||||
SetButtonText(_GetId, OldLabel);
|
||||
}
|
||||
|
||||
// If we got a button
|
||||
if(Succeed)
|
||||
{
|
||||
Stop = true;
|
||||
// We need to assign hat special code
|
||||
if (type == InputCommon::CTL_HAT)
|
||||
{
|
||||
// Index of pressed starts from 0
|
||||
if (value & SDL_HAT_UP) pressed = 0x0100 + 0x0010 * pressed + SDL_HAT_UP;
|
||||
else if (value & SDL_HAT_DOWN) pressed = 0x0100 + 0x0010 * pressed + SDL_HAT_DOWN;
|
||||
else if (value & SDL_HAT_LEFT) pressed = 0x0100 + 0x0010 * pressed + SDL_HAT_LEFT;
|
||||
else if (value & SDL_HAT_RIGHT) pressed = 0x0100 + 0x0010 * pressed + SDL_HAT_RIGHT;
|
||||
else pressed = -1;
|
||||
}
|
||||
if (IDB_BTN_A <= _GetId && _GetId <= IDB_SHDR_SEMI_R)
|
||||
{
|
||||
// Better make the pad button code far from virtual key code
|
||||
SaveButtonMapping(_GetId, 0x1000 + pressed);
|
||||
SetButtonText(_GetId, wxString::Format(wxT("PAD: %d"), pressed));
|
||||
}
|
||||
else if (IDB_ANALOG_LEFT_X <= _GetId && _GetId <= IDB_TRIGGER_R)
|
||||
{
|
||||
SaveButtonMapping(_GetId, pressed);
|
||||
SetButtonText(_GetId, wxString::Format(wxT("%d"), pressed));
|
||||
}
|
||||
}
|
||||
|
||||
// Stop the timer
|
||||
if(Stop)
|
||||
{
|
||||
DEBUG_LOG(PAD, "Timer Stopped for Pad:%i _GetId:%i", GCMapping[m_Page].ID, _GetId);
|
||||
|
||||
m_ButtonMappingTimer->Stop();
|
||||
GetButtonWaitingTimer = 0;
|
||||
GetButtonWaitingID = 0;
|
||||
ClickedButton = NULL;
|
||||
}
|
||||
|
||||
// If we got a bad button
|
||||
if(KeyPressed == -1)
|
||||
{
|
||||
// Update text
|
||||
SetButtonText(_GetId, wxString(wxT("PAD: -1")));
|
||||
// Notify the user
|
||||
wxMessageBox(wxString::Format(
|
||||
wxT("You selected a key with a to low key code (%i), please")
|
||||
wxT(" select another key with a higher key code."), pressed)
|
||||
, wxT("Notice"), wxICON_INFORMATION);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the 0x8000 range values to BoxW and BoxH for the plot
|
||||
void GCPadConfigDialog::Convert2Box(int &x)
|
||||
{
|
||||
// Border adjustment
|
||||
int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2;
|
||||
// Convert values
|
||||
x = (BoxW_ / 2) + (x * BoxW_ / (32767 * 2));
|
||||
}
|
||||
|
||||
// Update the input status boxes
|
||||
void GCPadConfigDialog::UpdatePadInfo(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
if (GCMapping[m_Page].ID < 0 || GCMapping[m_Page].ID >= NumPads)
|
||||
{
|
||||
m_tStatusLeftIn[m_Page]->SetLabel(wxT("Not connected"));
|
||||
m_tStatusLeftOut[m_Page]->SetLabel(wxT("Not connected"));
|
||||
m_tStatusRightIn[m_Page]->SetLabel(wxT("Not connected"));
|
||||
m_tStatusRightOut[m_Page]->SetLabel(wxT("Not connected"));
|
||||
m_TriggerStatusL[m_Page]->SetLabel(wxT("000"));
|
||||
m_TriggerStatusR[m_Page]->SetLabel(wxT("000"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that Dolphin is in focus, otherwise don't update the pad status
|
||||
//if (IsFocus())
|
||||
GetAxisState(GCMapping[m_Page]);
|
||||
|
||||
// Analog stick
|
||||
// Get original values
|
||||
int main_x = GCMapping[m_Page].AxisState.Lx;
|
||||
int main_y = GCMapping[m_Page].AxisState.Ly;
|
||||
int right_x = GCMapping[m_Page].AxisState.Rx;
|
||||
int right_y = GCMapping[m_Page].AxisState.Ry;
|
||||
|
||||
// Get adjusted values
|
||||
int main_x_after = main_x, main_y_after = main_y;
|
||||
int right_x_after = right_x, right_y_after = right_y;
|
||||
|
||||
// Produce square
|
||||
if(GCMapping[m_Page].bSquare2Circle)
|
||||
InputCommon::Square2Circle(main_x_after, main_y_after, GCMapping[m_Page].Diagonal, false);
|
||||
|
||||
// Check dead zone
|
||||
float DeadZoneLeft = (float)GCMapping[m_Page].DeadZoneL / 100.0;
|
||||
float DeadZoneRight = (float)GCMapping[m_Page].DeadZoneR / 100.0;
|
||||
if (InputCommon::IsDeadZone(DeadZoneLeft, main_x_after, main_y_after))
|
||||
{
|
||||
main_x_after = 0;
|
||||
main_y_after = 0;
|
||||
}
|
||||
if (InputCommon::IsDeadZone(DeadZoneRight, right_x_after, right_y_after))
|
||||
{
|
||||
right_x_after = 0;
|
||||
right_y_after = 0;
|
||||
}
|
||||
|
||||
int Lx = InputCommon::Pad_Convert(main_x); int Ly = InputCommon::Pad_Convert(main_y);
|
||||
int Rx = InputCommon::Pad_Convert(right_x); int Ry = InputCommon::Pad_Convert(right_y);
|
||||
int Lx_after = InputCommon::Pad_Convert(main_x_after); int Ly_after = InputCommon::Pad_Convert(main_y_after);
|
||||
int Rx_after = InputCommon::Pad_Convert(right_x_after); int Ry_after = InputCommon::Pad_Convert(right_y_after);
|
||||
|
||||
m_tStatusLeftIn[m_Page]->SetLabel(wxString::Format(wxT("X:%03i Y:%03i"), Lx, Ly));
|
||||
m_tStatusLeftOut[m_Page]->SetLabel(wxString::Format(wxT("X:%03i Y:%03i"), Lx_after, Ly_after));
|
||||
m_tStatusRightIn[m_Page]->SetLabel(wxString::Format(wxT("X:%03i Y:%03i"), Rx, Ry));
|
||||
m_tStatusRightOut[m_Page]->SetLabel(wxString::Format(wxT("X:%03i Y:%03i"), Rx_after, Ry_after));
|
||||
|
||||
// Adjust the values for the plot
|
||||
Convert2Box(main_x); Convert2Box(main_y);
|
||||
Convert2Box(right_x); Convert2Box(right_y);
|
||||
Convert2Box(main_x_after); Convert2Box(main_y_after);
|
||||
Convert2Box(right_x_after); Convert2Box(right_y_after);
|
||||
|
||||
// Adjust the dot
|
||||
m_bmpDotLeftIn[m_Page]->SetPosition(wxPoint(main_x, main_y));
|
||||
m_bmpDotLeftOut[m_Page]->SetPosition(wxPoint(main_x_after, main_y_after));
|
||||
m_bmpDotRightIn[m_Page]->SetPosition(wxPoint(right_x, right_y));
|
||||
m_bmpDotRightOut[m_Page]->SetPosition(wxPoint(right_x_after, right_y_after));
|
||||
|
||||
// Get the trigger values
|
||||
int TriggerLeft = GCMapping[m_Page].AxisState.Tl;
|
||||
int TriggerRight = GCMapping[m_Page].AxisState.Tr;
|
||||
|
||||
// Convert the triggers values
|
||||
if (GCMapping[m_Page].TriggerType == InputCommon::CTL_TRIGGER_SDL)
|
||||
{
|
||||
TriggerLeft = InputCommon::Pad_Convert(TriggerLeft);
|
||||
TriggerRight = InputCommon::Pad_Convert(TriggerRight);
|
||||
}
|
||||
|
||||
m_TriggerStatusL[m_Page]->SetLabel(wxString::Format(wxT("%03i"), TriggerLeft));
|
||||
m_TriggerStatusR[m_Page]->SetLabel(wxString::Format(wxT("%03i"), TriggerRight));
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,155 @@
|
||||
// Copyright (C) 2003 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/
|
||||
|
||||
|
||||
#ifndef _PLUGIN_GCPAD_H
|
||||
#define _PLUGIN_GCPAD_H
|
||||
|
||||
|
||||
#include <vector> // System
|
||||
#include <cstdio>
|
||||
#include "../../Core/InputCommon/Src/SDL.h" // Core
|
||||
#include "../../Core/InputCommon/Src/XInput.h"
|
||||
#include "pluginspecs_pad.h"
|
||||
|
||||
|
||||
// SDL Haptic fails on windows, it just doesn't work (even the sample doesn't work)
|
||||
// So until i can make it work, this is all disabled >:(
|
||||
#if SDL_VERSION_ATLEAST(1, 3, 0) && !defined(_WIN32)
|
||||
#define SDL_RUMBLE
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#define RUMBLE_HACK
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#pragma comment(lib, "dxguid.lib")
|
||||
#pragma comment(lib, "dinput8.lib")
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
#include <dinput.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DEF_BUTTON_FULL 255
|
||||
#define DEF_STICK_FULL 100
|
||||
#define DEF_TRIGGER_FULL 255
|
||||
#define DEF_TRIGGER_THRESHOLD 230
|
||||
|
||||
// GC Pad Buttons
|
||||
enum EGCPad
|
||||
{
|
||||
EGC_A = 0,
|
||||
EGC_B,
|
||||
EGC_X,
|
||||
EGC_Y,
|
||||
EGC_Z,
|
||||
EGC_START,
|
||||
|
||||
EGC_DPAD_UP,
|
||||
EGC_DPAD_DOWN,
|
||||
EGC_DPAD_LEFT,
|
||||
EGC_DPAD_RIGHT,
|
||||
|
||||
EGC_STICK_UP,
|
||||
EGC_STICK_DOWN,
|
||||
EGC_STICK_LEFT,
|
||||
EGC_STICK_RIGHT,
|
||||
|
||||
EGC_CSTICK_UP,
|
||||
EGC_CSTICK_DOWN,
|
||||
EGC_CSTICK_LEFT,
|
||||
EGC_CSTICK_RIGHT,
|
||||
|
||||
EGC_TGR_L,
|
||||
EGC_TGR_R,
|
||||
EGC_TGR_SEMI_L,
|
||||
EGC_TGR_SEMI_R,
|
||||
|
||||
LAST_CONSTANT,
|
||||
};
|
||||
|
||||
enum EInputType
|
||||
{
|
||||
FROM_KEYBOARD,
|
||||
FROM_ANALOG1,
|
||||
FROM_ANALOG2,
|
||||
FROM_TRIGGER,
|
||||
};
|
||||
|
||||
union UAxis
|
||||
{
|
||||
int Code[6];
|
||||
struct
|
||||
{
|
||||
int Lx;
|
||||
int Ly;
|
||||
int Rx;
|
||||
int Ry;
|
||||
int Tl; // Trigger
|
||||
int Tr; // Trigger
|
||||
};
|
||||
};
|
||||
|
||||
struct SStickMapping
|
||||
{
|
||||
int Main;
|
||||
int Sub;
|
||||
int Shoulder; //Trigger
|
||||
};
|
||||
|
||||
struct CONTROLLER_MAPPING_GC // PAD MAPPING GC
|
||||
{
|
||||
int ID; // SDL joystick device ID
|
||||
SDL_Joystick *joy; // SDL joystick device
|
||||
UAxis AxisState;
|
||||
UAxis AxisMapping; // 6 Axes (Main, Sub, Triggers)
|
||||
int TriggerType; // SDL or XInput trigger
|
||||
bool Rumble;
|
||||
int RumbleStrength;
|
||||
int DeadZoneL; // Analog 1 Deadzone
|
||||
int DeadZoneR; // Analog 2 Deadzone
|
||||
bool bSquare2Circle;
|
||||
int Diagonal;
|
||||
|
||||
SStickMapping Stick;
|
||||
int Button[LAST_CONSTANT];
|
||||
};
|
||||
|
||||
extern CONTROLLER_MAPPING_GC GCMapping[4];
|
||||
extern int NumPads, NumGoodPads, g_ID;
|
||||
|
||||
extern SPADInitialize *g_PADInitialize;
|
||||
extern std::vector<InputCommon::CONTROLLER_INFO> joyinfo;
|
||||
#ifdef _WIN32
|
||||
extern HWND m_hWnd; // Handle to window
|
||||
#endif
|
||||
|
||||
|
||||
// Custom Functions
|
||||
// ----------------
|
||||
void EmulateAnalogStick(unsigned char &stickX, unsigned char &stickY, bool buttonUp, bool buttonDown, bool buttonLeft, bool buttonRight, int magnitude);
|
||||
void Close_Devices();
|
||||
bool Search_Devices(std::vector<InputCommon::CONTROLLER_INFO> &_joyinfo, int &_NumPads, int &_NumGoodPads);
|
||||
void GetAxisState(CONTROLLER_MAPPING_GC &_GCMapping);
|
||||
void UpdatePadState(CONTROLLER_MAPPING_GC &_GCMapping);
|
||||
bool IsKey(int Key);
|
||||
void ReadLinuxKeyboard();
|
||||
bool IsFocus();
|
||||
bool ReloadDLL();
|
||||
void PAD_RumbleClose();
|
||||
|
||||
#endif // _PLUGIN_GCPAD_H
|
||||
+185
-207
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="Plugin_nJoy_SDL"
|
||||
ProjectGUID="{521498BE-6089-4780-8223-E67C22F4E068}"
|
||||
Version="9.00"
|
||||
Name="Plugin_GCPad"
|
||||
ProjectGUID="{9FF603F8-B3BB-4144-9688-B2B802FA0F16}"
|
||||
RootNamespace="Plugin_nJoy_SDL"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
@@ -100,6 +100,168 @@
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\SDL\include;..\..\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="SDL.lib comctl32.lib xinput.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugFast|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\SDL\include;..\..\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;DEBUGFAST;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="SDL.lib comctl32.lib rpcrt4.lib xinput.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName)DF.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
@@ -181,87 +343,6 @@
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\SDL\include;..\..\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="SDL.lib comctl32.lib xinput.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
@@ -343,87 +424,6 @@
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugFast|Win32"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\SDL\include;..\..\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;DEBUGFAST;_WINDOWS;_USRDLL;PLUGIN_NJOY_SDL_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="SDL.lib comctl32.lib rpcrt4.lib xinput.lib winmm.lib wxbase28u.lib wxmsw28u_core.lib"
|
||||
OutputFile="..\..\..\Binary\Win32\Plugins\$(ProjectName)DF.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\Externals\SDL\win32;..\..\..\Externals\wxWidgets\lib\vc_lib\Win32"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="DebugFast|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
@@ -510,69 +510,47 @@
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
Name="Config"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\Config.cpp"
|
||||
RelativePath=".\Config.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Config.h"
|
||||
RelativePath=".\Config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\nJoy.cpp"
|
||||
RelativePath=".\ConfigBox.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\nJoy.h"
|
||||
RelativePath=".\ConfigBox.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ReRecording.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Rumble.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="GUI"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\GUI\AboutBox.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\GUI\AboutBox.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\GUI\ConfigAdvanced.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\GUI\ConfigBox.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\GUI\ConfigBox.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\GUI\ConfigJoypad.cpp"
|
||||
RelativePath=".\ConfigJoypad.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\readme.txt"
|
||||
RelativePath=".\GCPad.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SConscript"
|
||||
RelativePath=".\GCPad.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\PluginSpecs\pluginspecs_pad.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ReRecording.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Rumble.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
+169
-195
@@ -1,196 +1,170 @@
|
||||
|
||||
// Project description
|
||||
// -------------------
|
||||
// Name: nJoy
|
||||
// Description: A Dolphin Compatible Input Plugin
|
||||
//
|
||||
// Author: Falcon4ever (nJoy@falcon4ever.com)
|
||||
// Site: www.multigesture.net
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
//
|
||||
|
||||
//
|
||||
// Licensetype: GNU General Public License (GPL)
|
||||
//
|
||||
// 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/
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
// File description
|
||||
/* ---------
|
||||
|
||||
Rerecording options
|
||||
|
||||
////////////////////////*/
|
||||
|
||||
|
||||
|
||||
// Include
|
||||
// ---------
|
||||
#include "nJoy.h"
|
||||
#include "FileUtil.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
// TODO :
|
||||
// This is pretty much useless now with the TAS features right ?
|
||||
|
||||
#ifdef RERECORDING
|
||||
|
||||
|
||||
namespace Recording
|
||||
{
|
||||
|
||||
|
||||
|
||||
// Definitions
|
||||
// -------------
|
||||
// Pre defined maxium storage limit
|
||||
#define RECORD_SIZE (1024 * 128)
|
||||
SPADStatus RecordBuffer[RECORD_SIZE];
|
||||
int count = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Recording functions
|
||||
// -------------
|
||||
void RecordInput(const SPADStatus& _rPADStatus)
|
||||
{
|
||||
if (count >= RECORD_SIZE) return;
|
||||
RecordBuffer[count++] = _rPADStatus;
|
||||
|
||||
// Logging
|
||||
//u8 TmpData[sizeof(SPADStatus)];
|
||||
//memcpy(TmpData, &RecordBuffer[count - 1], sizeof(SPADStatus));
|
||||
//Console::Print("RecordInput(%i): %s\n", count, ArrayToString(TmpData, sizeof(SPADStatus), 0, 30).c_str());
|
||||
|
||||
// Auto save every ten seconds
|
||||
if (count % (60 * 10) == 0) Save();
|
||||
}
|
||||
|
||||
const SPADStatus& Play()
|
||||
{
|
||||
// Logging
|
||||
//Console::Print("PlayRecord(%i)\n", count);
|
||||
if (count >= RECORD_SIZE)
|
||||
{
|
||||
// Todo: Make the recording size unlimited?
|
||||
//PanicAlert("The recording reached its end");
|
||||
return(RecordBuffer[0]);
|
||||
}
|
||||
return(RecordBuffer[count++]);
|
||||
}
|
||||
|
||||
void Load()
|
||||
{
|
||||
FILE* pStream = fopen("pad-record.bin", "rb");
|
||||
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fread(RecordBuffer, 1, RECORD_SIZE * sizeof(SPADStatus), pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("SimplePad: Could not open pad-record.bin");
|
||||
}
|
||||
|
||||
//Console::Print("LoadRecord()");
|
||||
}
|
||||
|
||||
void Save()
|
||||
{
|
||||
// Open the file in a way that clears all old data
|
||||
FILE* pStream = fopen("pad-record.bin", "wb");
|
||||
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fwrite(RecordBuffer, 1, RECORD_SIZE * sizeof(SPADStatus), pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("NJoy: Could not save pad-record.bin");
|
||||
}
|
||||
//PanicAlert("SaveRecord()");
|
||||
//Console::Print("SaveRecord()");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
// -------------------------------------------
|
||||
// Rerecording
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
/* Check if we are starting the pad to record the input, and an old file exists. In that case ask
|
||||
if we really want to start the recording and eventually overwrite the file */
|
||||
if (g_Config.bRecording && File::Exists("pad-record.bin"))
|
||||
{
|
||||
if (!AskYesNo("An old version of '%s' aleady exists in your Dolphin directory. You can"
|
||||
" now make a copy of it before you start a new recording and overwrite the file."
|
||||
" Select Yes to continue and overwrite the file. Select No to turn off the input"
|
||||
" recording and continue without recording anything.",
|
||||
"pad-record.bin"))
|
||||
{
|
||||
// Turn off recording and continue
|
||||
g_Config.bRecording = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Load recorded input if we are to play it back, otherwise begin with a blank recording
|
||||
if (g_Config.bPlayback) Recording::Load();
|
||||
#endif
|
||||
// ----------------------
|
||||
}
|
||||
|
||||
|
||||
void ShutDown()
|
||||
{
|
||||
// Save recording
|
||||
if (g_Config.bRecording) Recording::Save();
|
||||
// Reset the counter
|
||||
count = 0;
|
||||
}
|
||||
|
||||
void DoState(unsigned char **ptr, int mode)
|
||||
{
|
||||
// Load or save the counter
|
||||
PointerWrap p(ptr, mode);
|
||||
p.Do(count);
|
||||
|
||||
//Console::Print("count: %i\n", count);
|
||||
|
||||
// Update the frame counter for the sake of the status bar
|
||||
if (mode == PointerWrap::MODE_READ)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// This only works when rendering to the main window, I think
|
||||
PostMessage(GetParent(g_PADInitialize->hWnd), WM_USER, INPUT_FRAME_COUNTER, count);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // Recording
|
||||
|
||||
|
||||
// Copyright (C) 2003 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/
|
||||
|
||||
|
||||
#include "GCpad.h"
|
||||
#include "FileUtil.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
// TODO :
|
||||
// This is pretty much useless now with the TAS features right ?
|
||||
|
||||
#ifdef RERECORDING
|
||||
|
||||
|
||||
namespace Recording
|
||||
{
|
||||
|
||||
|
||||
|
||||
// Definitions
|
||||
// -------------
|
||||
// Pre defined maxium storage limit
|
||||
#define RECORD_SIZE (1024 * 128)
|
||||
SPADStatus RecordBuffer[RECORD_SIZE];
|
||||
int count = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Recording functions
|
||||
// -------------
|
||||
void RecordInput(const SPADStatus& _rPADStatus)
|
||||
{
|
||||
if (count >= RECORD_SIZE) return;
|
||||
RecordBuffer[count++] = _rPADStatus;
|
||||
|
||||
// Logging
|
||||
//u8 TmpData[sizeof(SPADStatus)];
|
||||
//memcpy(TmpData, &RecordBuffer[count - 1], sizeof(SPADStatus));
|
||||
//Console::Print("RecordInput(%i): %s\n", count, ArrayToString(TmpData, sizeof(SPADStatus), 0, 30).c_str());
|
||||
|
||||
// Auto save every ten seconds
|
||||
if (count % (60 * 10) == 0) Save();
|
||||
}
|
||||
|
||||
const SPADStatus& Play()
|
||||
{
|
||||
// Logging
|
||||
//Console::Print("PlayRecord(%i)\n", count);
|
||||
if (count >= RECORD_SIZE)
|
||||
{
|
||||
// Todo: Make the recording size unlimited?
|
||||
//PanicAlert("The recording reached its end");
|
||||
return(RecordBuffer[0]);
|
||||
}
|
||||
return(RecordBuffer[count++]);
|
||||
}
|
||||
|
||||
void Load()
|
||||
{
|
||||
FILE* pStream = fopen("pad-record.bin", "rb");
|
||||
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fread(RecordBuffer, 1, RECORD_SIZE * sizeof(SPADStatus), pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("SimplePad: Could not open pad-record.bin");
|
||||
}
|
||||
|
||||
//Console::Print("LoadRecord()");
|
||||
}
|
||||
|
||||
void Save()
|
||||
{
|
||||
// Open the file in a way that clears all old data
|
||||
FILE* pStream = fopen("pad-record.bin", "wb");
|
||||
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fwrite(RecordBuffer, 1, RECORD_SIZE * sizeof(SPADStatus), pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("NJoy: Could not save pad-record.bin");
|
||||
}
|
||||
//PanicAlert("SaveRecord()");
|
||||
//Console::Print("SaveRecord()");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
// -------------------------------------------
|
||||
// Rerecording
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
/* Check if we are starting the pad to record the input, and an old file exists. In that case ask
|
||||
if we really want to start the recording and eventually overwrite the file */
|
||||
if (g_Config.bRecording && File::Exists("pad-record.bin"))
|
||||
{
|
||||
if (!AskYesNo("An old version of '%s' aleady exists in your Dolphin directory. You can"
|
||||
" now make a copy of it before you start a new recording and overwrite the file."
|
||||
" Select Yes to continue and overwrite the file. Select No to turn off the input"
|
||||
" recording and continue without recording anything.",
|
||||
"pad-record.bin"))
|
||||
{
|
||||
// Turn off recording and continue
|
||||
g_Config.bRecording = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Load recorded input if we are to play it back, otherwise begin with a blank recording
|
||||
if (g_Config.bPlayback) Recording::Load();
|
||||
#endif
|
||||
// ----------------------
|
||||
}
|
||||
|
||||
|
||||
void ShutDown()
|
||||
{
|
||||
// Save recording
|
||||
if (g_Config.bRecording) Recording::Save();
|
||||
// Reset the counter
|
||||
count = 0;
|
||||
}
|
||||
|
||||
void DoState(unsigned char **ptr, int mode)
|
||||
{
|
||||
// Load or save the counter
|
||||
PointerWrap p(ptr, mode);
|
||||
p.Do(count);
|
||||
|
||||
//Console::Print("count: %i\n", count);
|
||||
|
||||
// Update the frame counter for the sake of the status bar
|
||||
if (mode == PointerWrap::MODE_READ)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// This only works when rendering to the main window, I think
|
||||
PostMessage(GetParent(g_PADInitialize->hWnd), WM_USER, INPUT_FRAME_COUNTER, count);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // Recording
|
||||
|
||||
|
||||
#endif // RERECORDING
|
||||
+360
-380
File diff suppressed because it is too large
Load Diff
+29
-31
@@ -1,31 +1,29 @@
|
||||
# -*- python -*-
|
||||
|
||||
Import('env')
|
||||
import sys
|
||||
|
||||
name = "Plugin_nJoy_SDL"
|
||||
padenv = env.Clone()
|
||||
|
||||
if not env['HAVE_SDL']:
|
||||
print name + " must have SDL to be build"
|
||||
Return()
|
||||
|
||||
files = [
|
||||
'Config.cpp',
|
||||
'nJoy.cpp',
|
||||
'Rumble.cpp',
|
||||
]
|
||||
if padenv['HAVE_WX']:
|
||||
files += [
|
||||
'GUI/AboutBox.cpp',
|
||||
'GUI/ConfigAdvanced.cpp',
|
||||
'GUI/ConfigJoypad.cpp',
|
||||
'GUI/ConfigBox.cpp',
|
||||
]
|
||||
|
||||
padenv.Append(
|
||||
CXXFLAGS = [ '-fPIC' ],
|
||||
LIBS = [ 'common', 'inputcommon' ],
|
||||
)
|
||||
|
||||
padenv.SharedLibrary(env['plugin_dir']+name, files)
|
||||
# -*- python -*-
|
||||
|
||||
Import('env')
|
||||
import sys
|
||||
|
||||
name = "Plugin_GCPad"
|
||||
padenv = env.Clone()
|
||||
|
||||
if not env['HAVE_SDL']:
|
||||
print name + " must have SDL to be build"
|
||||
Return()
|
||||
|
||||
files = [
|
||||
'Config.cpp',
|
||||
'GCPad.cpp',
|
||||
'Rumble.cpp',
|
||||
]
|
||||
if padenv['HAVE_WX']:
|
||||
files += [
|
||||
'ConfigJoypad.cpp',
|
||||
'ConfigBox.cpp',
|
||||
]
|
||||
|
||||
padenv.Append(
|
||||
CXXFLAGS = [ '-fPIC' ],
|
||||
LIBS = [ 'common', 'inputcommon' ],
|
||||
)
|
||||
|
||||
padenv.SharedLibrary(env['plugin_dir']+name, files)
|
||||
@@ -318,7 +318,7 @@ void Config::Load()
|
||||
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, "Diagonal", &WiiMoteEmu::WiiMapping[i].Diagonal, 100);
|
||||
iniFile.Get(SectionName, "Circle2Square", &WiiMoteEmu::WiiMapping[i].bCircle2Square, false);
|
||||
iniFile.Get(SectionName, "Rumble", &WiiMoteEmu::WiiMapping[i].Rumble, false);
|
||||
iniFile.Get(SectionName, "RumbleStrength", &WiiMoteEmu::WiiMapping[i].RumbleStrength, 8); // x10
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
// Replace the harder to understand -1 with "" for the sake of user friendliness
|
||||
void WiimotePadConfigDialog::ToBlank(bool ToBlank, int Id)
|
||||
{
|
||||
if (!ControlsCreated)
|
||||
if (!m_ControlsCreated)
|
||||
return;
|
||||
|
||||
if(ToBlank)
|
||||
@@ -98,30 +98,6 @@ wxString WiimotePadConfigDialog::GetButtonText(int id)
|
||||
return wxString();
|
||||
}
|
||||
|
||||
// Configure button mapping
|
||||
// Wait for button press
|
||||
/* Loop or timer: There are basically two ways to do this. With a while() or
|
||||
for() loop, or with a timer. The downside with the while() or for() loop is
|
||||
that there is no way to stop it if the user should select to configure
|
||||
another button while we are still in an old loop. What will happen then is
|
||||
that we start another parallel loop (at least in Windows) that blocks the
|
||||
old loop. And our only option to wait for the old loop to finish is with a
|
||||
new loop, and that will block the old loop for as long as it's going
|
||||
on. Therefore a timer is easier to control. */
|
||||
void WiimotePadConfigDialog::GetButtons(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetEventType() != wxEVT_COMMAND_BUTTON_CLICKED)
|
||||
return;
|
||||
|
||||
if (m_ButtonMappingTimer->IsRunning())
|
||||
return;
|
||||
|
||||
wxButton* pButton = (wxButton *)event.GetEventObject();
|
||||
OldLabel = pButton->GetLabel();
|
||||
pButton->SetLabel(wxT("<Move Axis>"));
|
||||
DoGetButtons(pButton->GetId());
|
||||
}
|
||||
|
||||
void WiimotePadConfigDialog::DoGetButtons(int _GetId)
|
||||
{
|
||||
// Collect the starting values
|
||||
@@ -309,7 +285,7 @@ void WiimotePadConfigDialog::UpdatePadInfo(wxTimerEvent& WXUNUSED(event))
|
||||
|
||||
// Produce square
|
||||
if(WiiMoteEmu::WiiMapping[m_Page].bCircle2Square)
|
||||
InputCommon::Square2Circle(main_x_after, main_y_after, 0, WiiMoteEmu::WiiMapping[m_Page].Diagonal, true);
|
||||
InputCommon::Square2Circle(main_x_after, main_y_after, WiiMoteEmu::WiiMapping[m_Page].Diagonal, true);
|
||||
|
||||
// Check dead zone
|
||||
float DeadZoneLeft = (float)WiiMoteEmu::WiiMapping[m_Page].DeadZoneL / 100.0;
|
||||
@@ -325,38 +301,15 @@ void WiimotePadConfigDialog::UpdatePadInfo(wxTimerEvent& WXUNUSED(event))
|
||||
right_y_after = 0;
|
||||
}
|
||||
|
||||
// Show the adjusted angles in the status box
|
||||
// Change 0x8000 to 180
|
||||
/*
|
||||
float x8000 = 0x8000;
|
||||
main_x_after = main_x_after * (180 / x8000);
|
||||
main_y_after = main_y_after * (180 / x8000);
|
||||
float f_main_x_after = (float)main_x_after;
|
||||
float f_main_y_after = (float)main_y_after;
|
||||
WiiMoteEmu::AdjustAngles(f_main_x_after, f_main_y_after);
|
||||
//WiiMoteEmu::AdjustAngles(f_main_x_after, f_main_y_after, true);
|
||||
main_x_after = (int)f_main_x_after;
|
||||
main_y_after = (int)f_main_y_after;
|
||||
// Change back 180 to 0x8000
|
||||
main_x_after = main_x_after * (x8000 / 180);
|
||||
main_y_after = main_y_after * (x8000 / 180);
|
||||
*/
|
||||
int Lx = InputCommon::Pad_Convert(main_x); int Ly = InputCommon::Pad_Convert(main_y);
|
||||
int Rx = InputCommon::Pad_Convert(right_x); int Ry = InputCommon::Pad_Convert(right_y);
|
||||
int Lx_after = InputCommon::Pad_Convert(main_x_after); int Ly_after = InputCommon::Pad_Convert(main_y_after);
|
||||
int Rx_after = InputCommon::Pad_Convert(right_x_after); int Ry_after = InputCommon::Pad_Convert(right_y_after);
|
||||
|
||||
// Convert the values to fractions
|
||||
float f_x = main_x / 32767.0;
|
||||
float f_y = main_y / 32767.0;
|
||||
float f_x_aft = main_x_after / 32767.0;
|
||||
float f_y_aft = main_y_after / 32767.0;
|
||||
|
||||
float f_Rx = right_x / 32767.0;
|
||||
float f_Ry = right_y / 32767.0;
|
||||
float f_Rx_aft = right_x_after / 32767.0;
|
||||
float f_Ry_aft = right_y_after / 32767.0;
|
||||
|
||||
m_tStatusLeftIn[m_Page]->SetLabel(wxString::Format(wxT("x:%1.2f y:%1.2f"), f_x, f_y ));
|
||||
m_tStatusLeftOut[m_Page]->SetLabel(wxString::Format(wxT("x:%1.2f y:%1.2f"), f_x_aft, f_y_aft));
|
||||
m_tStatusRightIn[m_Page]->SetLabel(wxString::Format(wxT("x:%1.2f y:%1.2f"), f_Rx, f_Ry));
|
||||
m_tStatusRightOut[m_Page]->SetLabel(wxString::Format(wxT("x:%1.2f y:%1.2f"), f_Rx_aft, f_Ry_aft));
|
||||
m_tStatusLeftIn[m_Page]->SetLabel(wxString::Format(wxT("X:%03i Y:%03i"), Lx, Ly));
|
||||
m_tStatusLeftOut[m_Page]->SetLabel(wxString::Format(wxT("X:%03i Y:%03i"), Lx_after, Ly_after));
|
||||
m_tStatusRightIn[m_Page]->SetLabel(wxString::Format(wxT("X:%03i Y:%03i"), Rx, Ry));
|
||||
m_tStatusRightOut[m_Page]->SetLabel(wxString::Format(wxT("X:%03i Y:%03i"), Rx_after, Ry_after));
|
||||
|
||||
// Adjust the values for the plot
|
||||
Convert2Box(main_x); Convert2Box(main_y);
|
||||
|
||||
@@ -62,9 +62,9 @@ BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog)
|
||||
EVT_COMBOBOX(IDC_GH3_ANALOG, WiimotePadConfigDialog::GeneralSettingsChanged)
|
||||
|
||||
// Analog
|
||||
EVT_BUTTON(IDB_ANALOG_LEFT_X, WiimotePadConfigDialog::GetButtons) EVT_BUTTON(IDB_ANALOG_LEFT_Y, WiimotePadConfigDialog::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_RIGHT_X, WiimotePadConfigDialog::GetButtons) EVT_BUTTON(IDB_ANALOG_RIGHT_Y, WiimotePadConfigDialog::GetButtons)
|
||||
EVT_BUTTON(IDB_TRIGGER_L, WiimotePadConfigDialog::GetButtons) EVT_BUTTON(IDB_TRIGGER_R, WiimotePadConfigDialog::GetButtons)
|
||||
EVT_BUTTON(IDB_ANALOG_LEFT_X, WiimotePadConfigDialog::OnAxisClick) EVT_BUTTON(IDB_ANALOG_LEFT_Y, WiimotePadConfigDialog::OnAxisClick)
|
||||
EVT_BUTTON(IDB_ANALOG_RIGHT_X, WiimotePadConfigDialog::OnAxisClick) EVT_BUTTON(IDB_ANALOG_RIGHT_Y, WiimotePadConfigDialog::OnAxisClick)
|
||||
EVT_BUTTON(IDB_TRIGGER_L, WiimotePadConfigDialog::OnAxisClick) EVT_BUTTON(IDB_TRIGGER_R, WiimotePadConfigDialog::OnAxisClick)
|
||||
|
||||
// Wiimote
|
||||
EVT_BUTTON(IDB_WM_A, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_B, WiimotePadConfigDialog::OnButtonClick)
|
||||
@@ -116,6 +116,11 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
m_ControlsCreated = false;;
|
||||
m_Page = g_Config.CurrentPage;
|
||||
CreatePadGUIControls();
|
||||
m_Notebook->ChangeSelection(m_Page);
|
||||
|
||||
#if wxUSE_TIMER
|
||||
m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON);
|
||||
m_UpdatePadTimer = new wxTimer(this, IDTM_UPDATE_PAD);
|
||||
@@ -134,14 +139,6 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id,
|
||||
}
|
||||
#endif
|
||||
|
||||
ControlsCreated = false;
|
||||
|
||||
//g_Config.Load();
|
||||
CreatePadGUIControls();
|
||||
|
||||
m_Page = g_Config.CurrentPage;
|
||||
m_Notebook->ChangeSelection(m_Page);
|
||||
|
||||
// Set control values
|
||||
UpdateGUI();
|
||||
|
||||
@@ -164,6 +161,41 @@ WiimotePadConfigDialog::~WiimotePadConfigDialog()
|
||||
}
|
||||
}
|
||||
|
||||
// Notebook page changed
|
||||
void WiimotePadConfigDialog::NotebookPageChanged(wxNotebookEvent& event)
|
||||
{
|
||||
// Update the global variable
|
||||
m_Page = event.GetSelection();
|
||||
|
||||
// Update GUI
|
||||
if (m_ControlsCreated)
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
void WiimotePadConfigDialog::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
if (m_UpdatePadTimer)
|
||||
m_UpdatePadTimer->Stop();
|
||||
if (m_ButtonMappingTimer)
|
||||
m_ButtonMappingTimer->Stop();
|
||||
|
||||
g_Config.CurrentPage = m_Page;
|
||||
|
||||
EndModal(wxID_CLOSE);
|
||||
}
|
||||
|
||||
void WiimotePadConfigDialog::CloseClick(wxCommandEvent& event)
|
||||
{
|
||||
switch(event.GetId())
|
||||
{
|
||||
case ID_CLOSE:
|
||||
Close();
|
||||
break;
|
||||
case ID_APPLY:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Save keyboard key mapping
|
||||
void WiimotePadConfigDialog::SaveButtonMapping(int Id, int Key)
|
||||
{
|
||||
@@ -247,28 +279,18 @@ void WiimotePadConfigDialog::OnButtonClick(wxCommandEvent& event)
|
||||
DoGetButtons(ClickedButton->GetId());
|
||||
}
|
||||
|
||||
void WiimotePadConfigDialog::OnClose(wxCloseEvent& event)
|
||||
void WiimotePadConfigDialog::OnAxisClick(wxCommandEvent& event)
|
||||
{
|
||||
if (m_UpdatePadTimer)
|
||||
m_UpdatePadTimer->Stop();
|
||||
if (m_ButtonMappingTimer)
|
||||
m_ButtonMappingTimer->Stop();
|
||||
event.Skip();
|
||||
|
||||
g_Config.CurrentPage = m_Page;
|
||||
if (m_ButtonMappingTimer->IsRunning()) return;
|
||||
|
||||
EndModal(wxID_CLOSE);
|
||||
}
|
||||
|
||||
void WiimotePadConfigDialog::CloseClick(wxCommandEvent& event)
|
||||
{
|
||||
switch(event.GetId())
|
||||
{
|
||||
case ID_CLOSE:
|
||||
Close();
|
||||
break;
|
||||
case ID_APPLY:
|
||||
break;
|
||||
}
|
||||
ClickedButton = NULL;
|
||||
wxButton* pButton = (wxButton *)event.GetEventObject();
|
||||
OldLabel = pButton->GetLabel();
|
||||
pButton->SetWindowStyle(wxWANTS_CHARS);
|
||||
pButton->SetLabel(wxT("<Move Axis>"));
|
||||
DoGetButtons(pButton->GetId());
|
||||
}
|
||||
|
||||
// Bitmap box and dot
|
||||
@@ -354,11 +376,8 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
|
||||
TextDeadZone.Add(wxString::Format(wxT("%i%%"), i));
|
||||
|
||||
wxArrayString StrDiagonal;
|
||||
StrDiagonal.Add(wxT("100%"));
|
||||
StrDiagonal.Add(wxT("95%"));
|
||||
StrDiagonal.Add(wxT("90%"));
|
||||
StrDiagonal.Add(wxT("85%"));
|
||||
StrDiagonal.Add(wxT("80%"));
|
||||
for (int i = 0; i <= 10; i++)
|
||||
StrDiagonal.Add(wxString::Format(wxT("%i%%"), 100 - i * 5));
|
||||
|
||||
wxArrayString StrRumble;
|
||||
for (int i = 0; i <= 10; i++)
|
||||
@@ -929,18 +948,7 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
|
||||
Center();
|
||||
#endif
|
||||
|
||||
ControlsCreated = true;
|
||||
}
|
||||
|
||||
// Notebook page changed
|
||||
void WiimotePadConfigDialog::NotebookPageChanged(wxNotebookEvent& event)
|
||||
{
|
||||
// Update the global variable
|
||||
m_Page = event.GetSelection();
|
||||
|
||||
// Update GUI
|
||||
if (ControlsCreated)
|
||||
UpdateGUI();
|
||||
m_ControlsCreated = true;
|
||||
}
|
||||
|
||||
void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
@@ -961,7 +969,7 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
WiiMoteEmu::WiiMapping[m_Page].DeadZoneR = m_ComboDeadZoneRight[m_Page]->GetSelection();
|
||||
break;
|
||||
case IDC_STICK_DIAGONAL:
|
||||
WiiMoteEmu::WiiMapping[m_Page].Diagonal = m_ComboDiagonal[m_Page]->GetLabel().mb_str();
|
||||
WiiMoteEmu::WiiMapping[m_Page].Diagonal = 100 - m_ComboDiagonal[m_Page]->GetSelection() * 5;
|
||||
break;
|
||||
case IDC_STICK_C2S:
|
||||
WiiMoteEmu::WiiMapping[m_Page].bCircle2Square = m_CheckC2S[m_Page]->IsChecked();
|
||||
@@ -1022,7 +1030,7 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
|
||||
void WiimotePadConfigDialog::UpdateGUI()
|
||||
{
|
||||
if(!ControlsCreated)
|
||||
if(!m_ControlsCreated)
|
||||
return;
|
||||
|
||||
// Disable all pad items if no pads are detected
|
||||
@@ -1044,7 +1052,7 @@ void WiimotePadConfigDialog::UpdateGUI()
|
||||
m_Joyname[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].ID);
|
||||
m_ComboDeadZoneLeft[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].DeadZoneL);
|
||||
m_ComboDeadZoneRight[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].DeadZoneR);
|
||||
m_ComboDiagonal[m_Page]->SetValue(wxString::FromAscii(WiiMoteEmu::WiiMapping[m_Page].Diagonal.c_str()));
|
||||
m_ComboDiagonal[m_Page]->SetSelection((100 - WiiMoteEmu::WiiMapping[m_Page].Diagonal) / 5);
|
||||
m_CheckC2S[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bCircle2Square);
|
||||
m_CheckRumble[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].Rumble);
|
||||
m_RumbleStrength[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].RumbleStrength);
|
||||
|
||||
@@ -146,7 +146,7 @@ class WiimotePadConfigDialog : public wxDialog
|
||||
IDC_GH3_ANALOG,
|
||||
};
|
||||
|
||||
bool ControlsCreated;
|
||||
bool m_ControlsCreated;
|
||||
int m_Page, BoxW, BoxH;
|
||||
|
||||
wxString OldLabel;
|
||||
@@ -281,13 +281,14 @@ class WiimotePadConfigDialog : public wxDialog
|
||||
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnButtonClick(wxCommandEvent& event);
|
||||
void OnAxisClick(wxCommandEvent& event);
|
||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||
void SaveButtonMapping(int Id, int Key);
|
||||
|
||||
// Gamepad configuration
|
||||
void SetButtonText(int id,const wxString &str);
|
||||
wxString GetButtonText(int id);
|
||||
void GetButtons(wxCommandEvent& btn_event);
|
||||
|
||||
void DoGetButtons(int id);
|
||||
void UpdatePadInfo(wxTimerEvent& WXUNUSED(event));
|
||||
void ToBlank(bool ToBlank, int Id);
|
||||
|
||||
@@ -282,7 +282,7 @@ struct CONTROLLER_MAPPING_WII // WII PAD MAPPING
|
||||
int DeadZoneL; // Analog 1 Deadzone
|
||||
int DeadZoneR; // Analog 2 Deadzone
|
||||
bool bCircle2Square;
|
||||
std::string Diagonal;
|
||||
int Diagonal;
|
||||
|
||||
int Source; // 0: inactive, 1: emu, 2: real
|
||||
bool bSideways;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user