Change wheel type to device subtype

This commit is contained in:
Florin9doi 2020-11-11 21:13:37 +02:00 committed by jackun
parent f6e12f82de
commit b2b8bfc433
16 changed files with 174 additions and 83 deletions

View File

@ -80,7 +80,6 @@ Window g_GSwin;
Config::Config()
: Log(0)
{
memset(&WheelType, 0, sizeof(WheelType));
}
//Simpler to reset and reattach after USBclose/USBopen

View File

@ -63,6 +63,18 @@ void SelChangedAPI(HWND hW, int port)
changedAPIs[std::make_pair(port, devName)] = *it;
}
void SelChangedSubtype(HWND hW, int port)
{
int sel = SendDlgItemMessage(hW, port ? IDC_COMBO_WHEEL_TYPE1_USB : IDC_COMBO_WHEEL_TYPE2_USB, CB_GETCURSEL, 0, 0);
int devtype = SendDlgItemMessage(hW, port ? IDC_COMBO1_USB : IDC_COMBO2_USB, CB_GETCURSEL, 0, 0);
if (devtype == 0)
return;
devtype--;
auto& rd = RegisterDevice::instance();
auto devName = rd.Name(devtype);
changedSubtype[std::make_pair(port, devName)] = sel;
}
void PopulateAPIs(HWND hW, int port)
{
SendDlgItemMessage(hW, port ? IDC_COMBO_API1_USB : IDC_COMBO_API2_USB, CB_RESETCONTENT, 0, 0);
@ -103,6 +115,30 @@ void PopulateAPIs(HWND hW, int port)
SendDlgItemMessage(hW, port ? IDC_COMBO_API1_USB : IDC_COMBO_API2_USB, CB_SETCURSEL, sel, 0);
}
void PopulateSubType(HWND hW, int port)
{
SendDlgItemMessage(hW, port ? IDC_COMBO_WHEEL_TYPE1_USB : IDC_COMBO_WHEEL_TYPE2_USB, CB_RESETCONTENT, 0, 0);
int devtype = SendDlgItemMessage(hW, port ? IDC_COMBO1_USB : IDC_COMBO2_USB, CB_GETCURSEL, 0, 0);
if (devtype == 0)
return;
devtype--;
auto& rd = RegisterDevice::instance();
auto dev = rd.Device(devtype);
auto devName = rd.Name(devtype);
int sel = 0;
if (!LoadSetting(nullptr, port, dev->TypeName(), N_DEV_SUBTYPE, sel))
{
changedSubtype[std::make_pair(port, devName)] = sel;
}
for (auto subtype : dev->SubTypes())
{
SendDlgItemMessageA(hW, port ? IDC_COMBO_WHEEL_TYPE1_USB : IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM)subtype.c_str());
}
SendDlgItemMessage(hW, port ? IDC_COMBO_WHEEL_TYPE1_USB : IDC_COMBO_WHEEL_TYPE2_USB, CB_SETCURSEL, sel, 0);
}
BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@ -137,20 +173,10 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
SendDlgItemMessage(hW, IDC_COMBO2_USB, CB_SETCURSEL, p2, 0);
PopulateAPIs(hW, 0);
PopulateAPIs(hW, 1);
PopulateSubType(hW, 0);
PopulateSubType(hW, 1);
}
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro (rev11.02)");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_ADDSTRING, 0, (LPARAM) "GT Force");
SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_SETCURSEL, conf.WheelType[PLAYER_ONE_PORT], 0);
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM) "Driving Force Pro (rev11.02)");
SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_ADDSTRING, 0, (LPARAM) "GT Force");
SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_SETCURSEL, conf.WheelType[PLAYER_TWO_PORT], 0);
return TRUE;
break;
case WM_COMMAND:
@ -168,6 +194,12 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
case IDC_COMBO2_USB:
port = (LOWORD(wParam) == IDC_COMBO1_USB) ? 1 : 0;
PopulateAPIs(hW, port);
PopulateSubType(hW, port);
break;
case IDC_COMBO_WHEEL_TYPE1_USB:
case IDC_COMBO_WHEEL_TYPE2_USB:
port = (LOWORD(wParam) == IDC_COMBO_WHEEL_TYPE1_USB) ? 1 : 0;
SelChangedSubtype(hW, port);
break;
}
break;
@ -215,9 +247,6 @@ BOOL CALLBACK ConfigureDlgProcUSB(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar
i = SendDlgItemMessage(hW, IDC_COMBO2_USB, CB_GETCURSEL, 0, 0);
conf.Port[0] = regInst.Name(i - 1);
}
//wheel type
conf.WheelType[PLAYER_ONE_PORT] = SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE1_USB, CB_GETCURSEL, 0, 0);
conf.WheelType[PLAYER_TWO_PORT] = SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE2_USB, CB_GETCURSEL, 0, 0);
SaveConfig();
CreateDevices();

View File

@ -56,7 +56,7 @@ BEGIN
COMBOBOX IDC_COMBO_API2_USB,48,83,144,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Configure",IDC_CONFIGURE2_USB,198,83,49,14
CONTROL "Enable Logging (for developer use only)",IDC_LOGGING_USB, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,105,144,12
GROUPBOX "Emulated wheel",IDC_STATIC_USB,6,131,246,48
GROUPBOX "Emulated device",IDC_STATIC_USB,6,131,246,48
LTEXT "Port 1:",IDC_STATIC_USB,19,144,23,8
COMBOBOX IDC_COMBO_WHEEL_TYPE1_USB,48,142,198,51,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Port 2:",IDC_STATIC_USB,19,162,23,8

View File

@ -23,6 +23,7 @@
#include <vector>
std::map<std::pair<int, std::string>, std::string> changedAPIs;
std::map<std::pair<int, std::string>, int> changedSubtype;
wxString iniFileUSB(L"USB.ini");
static TSTDSTRING usb_path;
TSTDSTRING IniPath; // default path, just in case
@ -61,6 +62,14 @@ std::string GetSelectedAPI(const std::pair<int, std::string>& pair)
return std::string();
}
int GetSelectedSubtype(const std::pair<int, std::string>& pair)
{
auto it = changedSubtype.find(pair);
if (it != changedSubtype.end())
return it->second;
return 0;
}
bool LoadSettingValue(const TSTDSTRING& ini, const TSTDSTRING& section, const TCHAR* param, TSTDSTRING& value)
{
USBsetSettingsDir();
@ -153,9 +162,6 @@ void SaveConfig()
SaveSetting(nullptr, 1, N_DEVICE_PORT, N_DEVICE, conf.Port[1]);
#endif
SaveSetting(nullptr, 0, N_DEVICE_PORT, N_WHEEL_TYPE, conf.WheelType[0]);
SaveSetting(nullptr, 1, N_DEVICE_PORT, N_WHEEL_TYPE, conf.WheelType[1]);
for (auto& k : changedAPIs)
{
#ifdef _WIN32
@ -165,6 +171,11 @@ void SaveConfig()
#endif
}
for (auto& k : changedSubtype)
{
SaveSetting(nullptr, k.first.first, k.first.second, N_DEV_SUBTYPE, k.second);
}
#ifdef _WIN32
bool ret = ciniFile.Save(IniPath);
#else
@ -200,9 +211,6 @@ void LoadConfig()
LoadSetting(nullptr, 1, N_DEVICE_PORT, N_DEVICE, conf.Port[1]);
#endif
LoadSetting(nullptr, 0, N_DEVICE_PORT, N_WHEEL_TYPE, conf.WheelType[0]);
LoadSetting(nullptr, 1, N_DEVICE_PORT, N_WHEEL_TYPE, conf.WheelType[1]);
auto& instance = RegisterDevice::instance();
for (int i = 0; i < 2; i++)
@ -230,6 +238,10 @@ void LoadConfig()
if (api.size())
changedAPIs[std::make_pair(i, conf.Port[i])] = api;
int subtype = 0;
LoadSetting(nullptr, i, conf.Port[i], N_DEV_SUBTYPE, subtype);
changedSubtype[std::make_pair(i, conf.Port[i])] = subtype;
}
}

View File

@ -34,8 +34,6 @@
// Device-level config related defines
#define S_DEVICE_API TEXT("Device API")
#define S_WHEEL_TYPE TEXT("Wheel type")
#define S_DEVICE_PORT0 TEXT("Port 0")
#define S_DEVICE_PORT1 TEXT("Port 1")
#define S_CONFIG_PATH TEXT("Path")
#define N_DEVICE_API TEXT("device_api")
@ -45,9 +43,7 @@
#define N_DEVICE_PORT0 TEXT("port_0")
#define N_DEVICE_PORT1 TEXT("port_1")
#define N_DEVICE_PORT "port"
#define N_WHEEL_TYPE0 TEXT("wheel_type_0")
#define N_WHEEL_TYPE1 TEXT("wheel_type_1")
#define N_WHEEL_TYPE TEXT("wheel_type")
#define N_DEV_SUBTYPE TEXT("subtype")
#define N_CONFIG_PATH TEXT("path")
#define PLAYER_TWO_PORT 0
@ -58,7 +54,6 @@ struct Config
{
int Log;
std::string Port[2];
int WheelType[2];
Config();
};
@ -72,7 +67,9 @@ void RemoveSection(const char* dev_type, int port, const std::string& key);
extern TSTDSTRING IniPath;
extern TSTDSTRING LogDir;
extern std::map<std::pair<int /*port*/, std::string /*devname*/>, std::string> changedAPIs;
extern std::map<std::pair<int /*port*/, std::string /*devname*/>, int> changedSubtype;
std::string GetSelectedAPI(const std::pair<int /*port*/, std::string /*devname*/>& pair);
int GetSelectedSubtype(const std::pair<int, std::string>& pair);
bool LoadSettingValue(const TSTDSTRING& ini, const TSTDSTRING& section, const TCHAR* param, TSTDSTRING& value);
bool LoadSettingValue(const TSTDSTRING& ini, const TSTDSTRING& section, const TCHAR* param, int32_t& value);

View File

@ -79,6 +79,7 @@ public:
virtual std::list<std::string> ListAPIs() = 0;
virtual const TCHAR* LongAPIName(const std::string& name) = 0;
virtual int Freeze(int mode, USBDevice* dev, void* data) = 0;
virtual std::vector<std::string> SubTypes() = 0;
virtual bool IsValidAPI(const std::string& api)
{
@ -126,6 +127,10 @@ public:
{
return T::Freeze(mode, dev, data);
}
virtual std::vector<std::string> SubTypes()
{
return T::SubTypes();
}
};
template <class T>

View File

@ -37,6 +37,7 @@ struct SettingsCB
std::string device;
std::string api;
GtkComboBox* combo;
GtkComboBox* subtype;
};
gboolean run_msg_dialog(gpointer data)
@ -48,17 +49,6 @@ gboolean run_msg_dialog(gpointer data)
return FALSE;
}
static void wheeltypeChanged(GtkComboBox* widget, gpointer data)
{
gint idx = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
//if(data)
{
uint8_t port = MIN(reinterpret_cast<uintptr_t>(data), 1);
conf.WheelType[port] = idx;
}
}
static void populateApiWidget(SettingsCB* settingsCB, const std::string& device)
{
gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(settingsCB->combo)));
@ -95,6 +85,29 @@ static void populateApiWidget(SettingsCB* settingsCB, const std::string& device)
}
}
static void populateSubtypeWidget(SettingsCB* settingsCB, const std::string& device)
{
gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(settingsCB->subtype)));
auto dev = RegisterDevice::instance().Device(device);
int port = 1 - settingsCB->player;
GtkComboBox* widget = settingsCB->subtype;
if (dev)
{
int sel = 0;
if (!LoadSetting(nullptr, port, device, N_DEV_SUBTYPE, sel))
{
changedSubtype[std::make_pair(port, device)] = sel;
}
for (auto subtype : dev->SubTypes())
{
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), subtype.c_str());
}
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), sel);
}
}
static void deviceChanged(GtkComboBox* widget, gpointer data)
{
SettingsCB* settingsCB = (SettingsCB*)data;
@ -107,6 +120,7 @@ static void deviceChanged(GtkComboBox* widget, gpointer data)
settingsCB->device = s;
populateApiWidget(settingsCB, s);
populateSubtypeWidget(settingsCB, s);
if (player == 0)
conf.Port[1] = s;
@ -139,11 +153,25 @@ static void apiChanged(GtkComboBox* widget, gpointer data)
else
changedAPIs[pair] = *it;
settingsCB->api = *it;
}
}
}
static void subtypeChanged(GtkComboBox* widget, gpointer data)
{
SettingsCB* settingsCB = (SettingsCB*)data;
int player = settingsCB->player;
gint active = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
int port = 1 - player;
auto& name = settingsCB->device;
auto dev = RegisterDevice::instance().Device(name);
if (dev)
{
changedSubtype[std::make_pair(port, name)] = active;
}
}
static void configureApi(GtkWidget* widget, gpointer data)
{
SettingsCB* settingsCB = (SettingsCB*)data;
@ -204,7 +232,6 @@ void USBconfigure()
settingsCB[0].player = 0;
settingsCB[1].player = 1;
const char* wt[] = {"Driving Force", "Driving Force Pro", "Driving Force Pro (rev11.02)", "GT Force"};
const char* players[] = {"Player 1:", "Player 2:"};
GtkWidget *rs_cb, *vbox;
@ -275,24 +302,16 @@ void USBconfigure()
populateApiWidget(&settingsCB[ply], devs[ply]);
}
/** Wheel type **/
vbox = new_frame("Emulated wheel model:", main_vbox);
/** Emulated device / Wheel type **/
vbox = new_frame("Emulated device:", main_vbox);
for (int ply = 0; ply < 2; ply++)
{
int port = 1 - ply;
rs_cb = new_combobox(players[ply], vbox);
settingsCB[ply].subtype = GTK_COMBO_BOX(rs_cb);
g_signal_connect(G_OBJECT(rs_cb), "changed", G_CALLBACK(subtypeChanged), (gpointer)&settingsCB[ply]);
sel_idx = 0;
for (int i = 0; i < (int)countof(wt); i++)
{
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(rs_cb), wt[i]);
if (conf.WheelType[port] == i)
sel_idx = i;
}
gtk_combo_box_set_active(GTK_COMBO_BOX(rs_cb), sel_idx);
g_signal_connect(G_OBJECT(rs_cb), "changed", G_CALLBACK(wheeltypeChanged), reinterpret_cast<gpointer>(port));
populateSubtypeWidget(&settingsCB[ply], devs[ply]);
}
gtk_widget_show_all(dlg);

View File

@ -52,6 +52,10 @@ namespace usb_eyetoy
}
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
} // namespace usb_eyetoy

View File

@ -72,6 +72,10 @@ namespace usb_hid
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
class HIDMouseDevice
@ -91,6 +95,10 @@ namespace usb_hid
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
class BeatManiaDevice
@ -110,6 +118,10 @@ namespace usb_hid
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
} // namespace usb_hid

View File

@ -37,6 +37,10 @@ namespace usb_mic
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
} // namespace usb_mic

View File

@ -49,6 +49,10 @@ namespace usb_mic
}
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
class LogitechMicDevice : public SingstarDevice

View File

@ -42,6 +42,10 @@ namespace usb_msd
}
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
} // namespace usb_msd

View File

@ -269,12 +269,6 @@ namespace usb_pad
tie.pszText = TEXT("Player 2");
SendDlgItemMessage(hW, IDC_TAB1, TCM_INSERTITEM, 1, (LPARAM)&tie);
//SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE, CB_ADDSTRING, 0, (LPARAM)"DF / Generic Logitech Wheel");
////SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE, CB_ADDSTRING, 0, (LPARAM)"Driving Force");
//SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE, CB_ADDSTRING, 0, (LPARAM)"Driving Force Pro");
//SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE, CB_SETCURSEL, conf.WheelType1, 0);
////SendDlgItemMessageA(hW, IDC_COMBO_WHEEL_TYPE, CB_ADDSTRING, 0, (LPARAM)"Driving Force GT");
//Selected FFB target device
SendDlgItemMessageA(hW, IDC_COMBO_FFB, CB_ADDSTRING, 0, (LPARAM) "None");
SendDlgItemMessage(hW, IDC_COMBO_FFB, CB_SETCURSEL, 0, 0);
@ -657,8 +651,6 @@ namespace usb_pad
SendDlgItemMessage(hW, IDC_COMBO_FFB, CB_SETCURSEL, selectedJoy[plyCapturing], 0);
SendDlgItemMessage(hW, IDC_STATIC_CAP, WM_SETTEXT, 0, (LPARAM)TEXT(""));
SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE, CB_SETCURSEL, conf.WheelType[1 - plyCapturing], 0);
btnCapturing = PAD_BUTTON_COUNT;
axisCapturing = PAD_AXIS_COUNT;
hatCapturing = PAD_HAT_COUNT;
@ -787,9 +779,6 @@ namespace usb_pad
case LBN_SELCHANGE:
switch (LOWORD(wParam))
{
case IDC_COMBO_WHEEL_TYPE:
conf.WheelType[1 - plyCapturing] = SendDlgItemMessage(hW, IDC_COMBO_WHEEL_TYPE, CB_GETCURSEL, 0, 0);
break;
case IDC_COMBO_FFB:
selectedJoy[plyCapturing] = SendDlgItemMessage(hW, IDC_COMBO_FFB, CB_GETCURSEL, 0, 0);
//player_joys[plyCapturing] = *(joysDev.begin() + selectedJoy[plyCapturing]);

View File

@ -175,7 +175,7 @@ namespace usb_pad
return len;
}
static void ParseRawInputHID(PRAWINPUT pRawInput)
static void ParseRawInputHID(PRAWINPUT pRawInput, int subtype)
{
PHIDP_PREPARSED_DATA pPreparsedData = NULL;
HIDP_CAPS Caps;
@ -253,7 +253,7 @@ namespace usb_pad
uint16_t btn = mapping->btnMap[usage[i] - pButtonCaps->Range.UsageMin];
for (int j = 0; j < 2; j++)
{
PS2WheelTypes wt = (PS2WheelTypes)conf.WheelType[1 - j];
PS2WheelTypes wt = (PS2WheelTypes)subtype;
if (PLY_IS_MAPPED(j, btn))
{
uint32_t wtbtn = 1 << convert_wt_btn(wt, PLY_GET_VALUE(j, btn));
@ -298,21 +298,18 @@ namespace usb_pad
break;
}
int type = 0;
for (int j = 0; j < 2; j++)
{
if (!PLY_IS_MAPPED(j, v))
continue;
type = conf.WheelType[1 - j];
switch (PLY_GET_VALUE(j, v))
{
case PAD_AXIS_X: // X-axis
//Console.Warning("X: %d\n", value);
// Need for logical min too?
//generic_data.axis_x = ((value - pValueCaps[i].LogicalMin) * 0x3FF) / (pValueCaps[i].LogicalMax - pValueCaps[i].LogicalMin);
if (type == WT_DRIVING_FORCE_PRO || type == WT_DRIVING_FORCE_PRO_1102)
if (subtype == WT_DRIVING_FORCE_PRO || subtype == WT_DRIVING_FORCE_PRO_1102)
mapping->data[j].steering = (value * 0x3FFF) / pValueCaps[i].LogicalMax;
else
//XXX Limit value range to 0..1023 if using 'generic' wheel descriptor
@ -355,7 +352,7 @@ namespace usb_pad
SAFE_FREE(pValueCaps);
}
static void ParseRawInputKB(PRAWINPUT pRawInput)
static void ParseRawInputKB(PRAWINPUT pRawInput, int subtype)
{
Mappings* mapping = nullptr;
@ -378,7 +375,7 @@ namespace usb_pad
{
if (PLY_IS_MAPPED(j, btn))
{
PS2WheelTypes wt = (PS2WheelTypes)conf.WheelType[1 - j];
PS2WheelTypes wt = (PS2WheelTypes) subtype;
if (PLY_GET_VALUE(j, mapping->btnMap[i]) == pRawInput->data.keyboard.VKey)
{
uint32_t wtbtn = convert_wt_btn(wt, i);
@ -411,9 +408,9 @@ namespace usb_pad
void RawInputPad::ParseRawInput(PRAWINPUT pRawInput)
{
if (pRawInput->header.dwType == RIM_TYPEKEYBOARD)
ParseRawInputKB(pRawInput);
ParseRawInputKB(pRawInput, Type());
else if (pRawInput->header.dwType == RIM_TYPEHID)
ParseRawInputHID(pRawInput);
ParseRawInputHID(pRawInput, Type());
}
int RawInputPad::Open()

View File

@ -117,7 +117,7 @@ namespace usb_pad
uint8_t port;
struct freeze
{
int wheel_type;
int dev_subtype;
} f;
} PADState;
@ -216,7 +216,7 @@ namespace usb_pad
PADState* s = (PADState*)dev;
int ret = 0;
int t = conf.WheelType[s->port];
int t = s->pad->Type();
switch (request)
{
@ -535,7 +535,7 @@ namespace usb_pad
if (!pad)
return NULL;
pad->Type((PS2WheelTypes)conf.WheelType[port]);
pad->Type((PS2WheelTypes)GetSelectedSubtype(std::make_pair(port, TypeName())));
PADState* s = new PADState();
s->desc.full = &s->desc_dev;
@ -583,7 +583,7 @@ namespace usb_pad
if (usb_desc_parse_config(config_desc, config_desc_len, s->desc_dev) < 0)
goto fail;
s->f.wheel_type = conf.WheelType[port];
s->f.dev_subtype = pad->Type();
s->pad = pad;
s->dev.speed = USB_SPEED_FULL;
s->dev.klass.handle_attach = usb_desc_attach;
@ -626,7 +626,7 @@ namespace usb_pad
{
case FREEZE_LOAD:
s->f = *(PADState::freeze*)data;
s->pad->Type((PS2WheelTypes)s->f.wheel_type);
s->pad->Type((PS2WheelTypes)s->f.dev_subtype);
return sizeof(PADState::freeze);
case FREEZE_SAVE:
*(PADState::freeze*)data = s->f;
@ -674,7 +674,7 @@ namespace usb_pad
if (usb_desc_parse_config(rb1_config_descriptor, sizeof(rb1_config_descriptor), s->desc_dev) < 0)
goto fail;
s->f.wheel_type = pad->Type();
s->f.dev_subtype = pad->Type();
s->pad = pad;
s->port = port;
s->dev.speed = USB_SPEED_FULL;
@ -747,7 +747,7 @@ namespace usb_pad
if (usb_desc_parse_config(buzz_config_descriptor, sizeof(buzz_config_descriptor), s->desc_dev) < 0)
goto fail;
s->f.wheel_type = pad->Type();
s->f.dev_subtype = pad->Type();
s->pad = pad;
s->port = port;
s->dev.speed = USB_SPEED_FULL;

View File

@ -59,6 +59,10 @@ namespace usb_pad
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {"Driving Force", "Driving Force Pro", "Driving Force Pro (rev11.02)", "GT Force"};
}
};
class RBDrumKitDevice
@ -78,6 +82,10 @@ namespace usb_pad
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
class BuzzDevice
@ -97,6 +105,10 @@ namespace usb_pad
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
static void Initialize();
};
@ -117,6 +129,10 @@ namespace usb_pad
static const TCHAR* LongAPIName(const std::string& name);
static int Configure(int port, const std::string& api, void* data);
static int Freeze(int mode, USBDevice* dev, void* data);
static std::vector<std::string> SubTypes()
{
return {};
}
};
// Most likely as seen on https://github.com/matlo/GIMX