Skip to content

Commit

Permalink
Added reset all button for KBM mapping dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksre authored and jackun committed Nov 19, 2020
1 parent a99f764 commit 16e1886
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
7 changes: 7 additions & 0 deletions src/usb-pad/dx/dinput-config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,13 @@ INT_PTR CALLBACK DxDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
TestForce(s->port);
}
break;
case IDC_DELALL:
{
for (int i = 0; i < CID_COUNT; i++) {
DeleteControl(s->port, (ControlID)i);
}
}
break;

case IDC_ASS0: { StartListen(CID_STEERING); break; }
case IDC_ASS1: { StartListen(CID_STEERING_R); break; }
Expand Down
1 change: 1 addition & 0 deletions src/usb-pad/dx/versionproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
#define IDC_ASS29 1157
#define IDC_LABEL30 1158
#define IDC_ASS30 1159
#define IDC_DELALL 1160

// Next default values for new objects
//
Expand Down
29 changes: 14 additions & 15 deletions src/usb-pad/dx/versionproxy.rc
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,14 @@ END

IDD_DLG_KEYBOARDMANIA DIALOGEX 0, 0, 580, 160
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Keyboardmania device"
CAPTION "Keyboardmania controller"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Buttons",IDC_STATIC,5,5,140,50
PUSHBUTTON "Start",IDC_ASS22,90,15,50,15
PUSHBUTTON "Select",IDC_ASS14,90,35,50,15
LTEXT "1/1/1/1",IDC_LABEL22,10,17,50,8
LTEXT "1/1/1/1",IDC_LABEL14,10,37,50,8

GROUPBOX "Wheel",IDC_STATIC,150,5,140,50
PUSHBUTTON "Up",IDC_ASS29,235,15,50,15
PUSHBUTTON "Down",IDC_ASS30,235,35,50,15
Expand All @@ -327,19 +326,6 @@ BEGIN
PUSHBUTTON "A 1",IDC_ASS10,210,95,40,15
PUSHBUTTON "A# 1",IDC_ASS11,230,80,40,15
PUSHBUTTON "B 1",IDC_ASS12,250,95,40,15
LTEXT "1/1/1/1",IDC_LABEL0,10,110,38,8
LTEXT "1/1/1/1",IDC_LABEL1,30,70,38,8
LTEXT "1/1/1/1",IDC_LABEL2,50,110,38,8
LTEXT "1/1/1/1",IDC_LABEL3,70,70,38,8
LTEXT "1/1/1/1",IDC_LABEL4,90,110,38,8
LTEXT "1/1/1/1",IDC_LABEL5,130,110,38,8
LTEXT "1/1/1/1",IDC_LABEL6,150,70,38,8
LTEXT "1/1/1/1",IDC_LABEL8,170,110,38,8
LTEXT "1/1/1/1",IDC_LABEL9,190,70,38,8
LTEXT "1/1/1/1",IDC_LABEL10,210,110,38,8
LTEXT "1/1/1/1",IDC_LABEL11,230,70,38,8
LTEXT "1/1/1/1",IDC_LABEL12,250,110,38,8

PUSHBUTTON "C 2",IDC_ASS13,290,95,40,15
PUSHBUTTON "C# 2",IDC_ASS16,310,80,40,15
PUSHBUTTON "D 2",IDC_ASS17,330,95,40,15
Expand All @@ -352,6 +338,18 @@ BEGIN
PUSHBUTTON "A 2",IDC_ASS26,490,95,40,15
PUSHBUTTON "A# 2",IDC_ASS27,510,80,40,15
PUSHBUTTON "B 2",IDC_ASS28,530,95,40,15
LTEXT "1/1/1/1",IDC_LABEL0,10,110,38,8
LTEXT "1/1/1/1",IDC_LABEL1,30,70,38,8
LTEXT "1/1/1/1",IDC_LABEL2,50,110,38,8
LTEXT "1/1/1/1",IDC_LABEL3,70,70,38,8
LTEXT "1/1/1/1",IDC_LABEL4,90,110,38,8
LTEXT "1/1/1/1",IDC_LABEL5,130,110,38,8
LTEXT "1/1/1/1",IDC_LABEL6,150,70,38,8
LTEXT "1/1/1/1",IDC_LABEL8,170,110,38,8
LTEXT "1/1/1/1",IDC_LABEL9,190,70,38,8
LTEXT "1/1/1/1",IDC_LABEL10,210,110,38,8
LTEXT "1/1/1/1",IDC_LABEL11,230,70,38,8
LTEXT "1/1/1/1",IDC_LABEL12,250,110,38,8
LTEXT "1/1/1/1",IDC_LABEL13,290,110,38,8
LTEXT "1/1/1/1",IDC_LABEL16,310,70,38,8
LTEXT "1/1/1/1",IDC_LABEL17,330,110,38,8
Expand All @@ -365,6 +363,7 @@ BEGIN
LTEXT "1/1/1/1",IDC_LABEL27,510,70,38,8
LTEXT "1/1/1/1",IDC_LABEL28,530,110,38,8

PUSHBUTTON "Reset all",IDC_DELALL,5,140,50,15
DEFPUSHBUTTON "OK",IDOK,470,140,50,15
PUSHBUTTON "Cancel",IDCANCEL,525,140,50,15
END
Expand Down
7 changes: 2 additions & 5 deletions src/usb-pad/usb-pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,11 @@ void pad_copy_data(PS2WheelTypes type, uint8_t *buf, wheel_data_t &data)
break;

case WT_KEYBOARDMANIA_CONTROLLER:
// I don't know what I'm doing
buf[0] = 0x3F;
buf[1] = data.buttons & 0xFF;
buf[2] = (data.buttons >> 8) & 0xFF;
buf[3] = (data.buttons >> 16) & 0xFF; // ?
buf[4] = (data.buttons >> 24) & 0xFF; // ?
buf[3] = (data.buttons >> 16) & 0xFF;
buf[4] = (data.buttons >> 24) & 0xFF;
break;

default:
Expand Down Expand Up @@ -809,8 +808,6 @@ USBDevice* KeyboardmaniaDevice::CreateDevice(int port)
s->desc.full = &s->desc_dev;
s->desc.str = kbm_desc_strings;

// Wtf?

if (usb_desc_parse_dev(kbm_dev_descriptor, sizeof(kbm_dev_descriptor), s->desc, s->desc_dev) < 0)
goto fail;
if (usb_desc_parse_config(kbm_config_descriptor, sizeof(kbm_config_descriptor), s->desc_dev) < 0)
Expand Down

0 comments on commit 16e1886

Please sign in to comment.