mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Windows: add Force Input Device option;
This commit is contained in:
parent
eb371c4650
commit
e864569d0c
7 changed files with 34 additions and 5 deletions
|
@ -113,6 +113,7 @@ void Config::Load(const char *iniFileName)
|
|||
control->Get("LargeControls", &bLargeControls, false);
|
||||
control->Get("KeyMapping",iMappingMap);
|
||||
control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false);
|
||||
control->Get("ForceInputDevice", &iForceInputDevice, -1);
|
||||
|
||||
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
||||
pspConfig->Get("Language", &ilanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
|
||||
|
@ -179,6 +180,8 @@ void Config::Save()
|
|||
control->Set("LargeControls", bLargeControls);
|
||||
control->Set("KeyMapping",iMappingMap);
|
||||
control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
|
||||
control->Set("ForceInputDevice", iForceInputDevice);
|
||||
|
||||
|
||||
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
|
||||
pspConfig->Set("Language", ilanguage);
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
|
||||
// Control
|
||||
std::map<int,int> iMappingMap; // Can be used differently depending on systems
|
||||
int iForceInputDevice;
|
||||
|
||||
// SystemParam
|
||||
int ilanguage;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <limits.h>
|
||||
#include "DinputDevice.h"
|
||||
#include "Core/Config.h"
|
||||
#include "input/input_state.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Xinput.h"
|
||||
|
@ -114,6 +115,7 @@ DinputDevice::~DinputDevice()
|
|||
|
||||
int DinputDevice::UpdateState(InputState &input_state)
|
||||
{
|
||||
if (g_Config.iForceInputDevice == 0) return -1;
|
||||
if (!pJoystick) return -1;
|
||||
|
||||
DIJOYSTATE2 js;
|
||||
|
|
|
@ -776,7 +776,7 @@ namespace MainWindow
|
|||
"Rapid Fire\tShift",
|
||||
};
|
||||
|
||||
// Message handler for about box.
|
||||
// Message handler for controls box.
|
||||
LRESULT CALLBACK Controls(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
|
@ -791,14 +791,32 @@ namespace MainWindow
|
|||
for (int i = 0; i < sizeof(controllist)/sizeof(controllist[0]); i++) {
|
||||
SendMessage(list, LB_INSERTSTRING, -1, (LPARAM)controllist[i]);
|
||||
}
|
||||
|
||||
ComboBox_AddString(GetDlgItem(hDlg, IDC_FORCE_INPUT_DEVICE), "None");
|
||||
ComboBox_AddString(GetDlgItem(hDlg, IDC_FORCE_INPUT_DEVICE), "XInput");
|
||||
ComboBox_AddString(GetDlgItem(hDlg, IDC_FORCE_INPUT_DEVICE), "DirectInput");
|
||||
if ((g_Config.iForceInputDevice < 0) || (g_Config.iForceInputDevice > 1))
|
||||
{
|
||||
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_FORCE_INPUT_DEVICE), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_FORCE_INPUT_DEVICE), (g_Config.iForceInputDevice + 1));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
case IDOK:
|
||||
g_Config.iForceInputDevice = (ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_FORCE_INPUT_DEVICE)) - 1);
|
||||
EndDialog(hDlg, IDOK);
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, IDCANCEL);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <limits.h>
|
||||
#include "XinputDevice.h"
|
||||
#include "Core/Config.h"
|
||||
#include "input/input_state.h"
|
||||
|
||||
#ifndef XUSER_MAX_COUNT
|
||||
|
@ -19,6 +20,7 @@ struct Stick {
|
|||
static Stick NormalizedDeadzoneFilter(short x, short y);
|
||||
|
||||
int XinputDevice::UpdateState(InputState &input_state) {
|
||||
if (g_Config.iForceInputDevice > 0) return -1;
|
||||
if (this->check_delay-- > 0) return -1;
|
||||
XINPUT_STATE state;
|
||||
ZeroMemory( &state, sizeof(XINPUT_STATE) );
|
||||
|
|
|
@ -171,7 +171,9 @@ BEGIN
|
|||
DEFPUSHBUTTON "OK",IDOK,176,217,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,230,217,50,14
|
||||
LTEXT "NOTE: Currently controls are NOT configurable.\nHowever: Xbox 360 controllers are supported! Just plug one in and use it!",IDC_STATIC,7,7,188,30
|
||||
LISTBOX IDC_LISTCONTROLS,7,39,273,164,LBS_SORT | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
LISTBOX IDC_LISTCONTROLS,7,39,273,176,LBS_SORT | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Force device:",IDC_STATIC,10,220,45,11
|
||||
COMBOBOX IDC_FORCE_INPUT_DEVICE,59,219,84,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
#define IDC_BROWSE 1159
|
||||
#define IDC_SHOWVFPU 1161
|
||||
#define IDC_LISTCONTROLS 1162
|
||||
#define IDC_FORCE_INPUT_DEVICE 1163
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_CONFIG_SELECT_PLUGINS 40003
|
||||
#define ID_BUTTON40013 40013
|
||||
|
|
Loading…
Add table
Reference in a new issue