Skip to content

Commit 4a256d3

Browse files
committed
Added a toggle for a western layout mapping option, indipendent from system remapping
1 parent 05b19ee commit 4a256d3

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

mc_mitm/default.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
;right_grip=#464646
1717

1818
[misc]
19+
; Remaps the controller buttons to behave similarly to how they do on western consoles (i.e A to confirm on Xbox controllers, X on Playstation ones)
20+
;use_western_layout=false
1921
; Disable the LED lightbar on Sony Dualshock 4 and Dualsense controllers [default false]
2022
;disable_sony_leds=false
2123
; Map the dpad of the controller to the left stick and viceversa [default false]

mc_mitm/source/controllers/emulated_switch_controller.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ namespace ams::controller {
101101
m_colours.left_grip = config.colours.left_grip;
102102
m_colours.right_grip = config.colours.right_grip;
103103

104+
m_use_western_layout = config.misc.use_western_layout;
104105
m_swap_dpad_lstick = config.misc.swap_dpad_lstick;
105106
m_invert_lstick_xaxis = config.misc.invert_lstick_xaxis;
106107
m_invert_lstick_yaxis = config.misc.invert_lstick_yaxis;
@@ -137,6 +138,15 @@ namespace ams::controller {
137138

138139
this->ApplyButtonCombos(&switch_report->input0x30.buttons);
139140

141+
if(m_use_western_layout) {
142+
uint8_t temp = switch_report->input0x30.buttons.A;
143+
switch_report->input0x30.buttons.A = switch_report->input0x30.buttons.B;
144+
switch_report->input0x30.buttons.B = temp;
145+
temp = switch_report->input0x30.buttons.X;
146+
switch_report->input0x30.buttons.X = switch_report->input0x30.buttons.Y;
147+
switch_report->input0x30.buttons.Y = temp;
148+
}
149+
140150
if (m_swap_dpad_lstick) {
141151
uint16_t temp_lstick_x = STICK_ZERO; //Start in a neutral position
142152
uint16_t temp_lstick_y = STICK_ZERO;

mc_mitm/source/controllers/emulated_switch_controller.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ namespace ams::controller {
7171
ProControllerColours m_colours;
7272
bool m_enable_rumble;
7373

74+
bool m_use_western_layout;
7475
bool m_swap_dpad_lstick;
7576
bool m_invert_lstick_xaxis;
7677
bool m_invert_lstick_yaxis;

mc_mitm/source/mcmitm_config.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace ams::mitm {
4343
.right_grip = {0x46, 0x46, 0x46}
4444
},
4545
.misc = {
46+
.use_western_layout=false,
4647
.disable_sony_leds = false,
4748
.dualshock_pollingrate_divisor = 8,
4849
.swap_dpad_lstick = false,
@@ -230,7 +231,9 @@ namespace ams::mitm {
230231
ParseRGBstring(value, &config->colours.right_grip);
231232
}
232233
else if (strcasecmp(section, "misc") == 0) {
233-
if (strcasecmp(name, "disable_sony_leds") == 0)
234+
if (strcasecmp(name, "use_western_layout") == 0)
235+
ParseBoolean(value, &config->misc.use_western_layout);
236+
else if (strcasecmp(name, "disable_sony_leds") == 0)
234237
ParseBoolean(value, &config->misc.disable_sony_leds);
235238
else if (strcasecmp(name, "dualshock_pollingrate_divisor") == 0)
236239
ParsePollingRate(value, &config->misc.dualshock_pollingrate_divisor);

mc_mitm/source/mcmitm_config.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace ams::mitm {
4343
} colours;
4444

4545
struct {
46+
bool use_western_layout;
4647
bool disable_sony_leds;
4748
int32_t dualshock_pollingrate_divisor;
4849
bool swap_dpad_lstick;

0 commit comments

Comments
 (0)