Skip to content

Commit 67deadf

Browse files
committed
Minor code cleanup/ axis fixes
1 parent 89bd9f0 commit 67deadf

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

mc_mitm/source/controllers/emulated_switch_controller.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ namespace ams::controller {
158158
if (switch_report->input0x30.buttons.dpad_left)
159159
temp_lstick_x -= (UINT12_MAX / 2);
160160

161-
switch_report->input0x30.buttons.dpad_down = switch_report->input0x30.left_stick.GetX() < DPAD_THRESHOLD_BEGIN ? 1 : 0;
162-
switch_report->input0x30.buttons.dpad_up = switch_report->input0x30.left_stick.GetX() > DPAD_THRESHOLD_END ? 1 : 0;
163-
switch_report->input0x30.buttons.dpad_left = switch_report->input0x30.left_stick.GetY() < DPAD_THRESHOLD_BEGIN ? 1 : 0;
164-
switch_report->input0x30.buttons.dpad_right = switch_report->input0x30.left_stick.GetY() > DPAD_THRESHOLD_END ? 1 : 0;
161+
switch_report->input0x30.buttons.dpad_left = switch_report->input0x30.left_stick.GetX() < DPAD_THRESHOLD_BEGIN ? 1 : 0;
162+
switch_report->input0x30.buttons.dpad_right = switch_report->input0x30.left_stick.GetX() > DPAD_THRESHOLD_END ? 1 : 0;
163+
switch_report->input0x30.buttons.dpad_down = switch_report->input0x30.left_stick.GetY() < DPAD_THRESHOLD_BEGIN ? 1 : 0;
164+
switch_report->input0x30.buttons.dpad_up = switch_report->input0x30.left_stick.GetY() > DPAD_THRESHOLD_END ? 1 : 0;
165165

166166
switch_report->input0x30.left_stick.SetData(temp_lstick_x, temp_lstick_y);
167167
}

mc_mitm/source/mcmitm_config.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ namespace ams::mitm {
6868
*out = atoi(value);
6969
}
7070

71-
void ParsePollingRate(const char *value, int32_t *out){
71+
void ParsePollingRate(const char *value, uint32_t *out){
7272
int32_t temp=8;
7373
ParseInt(value, &temp);
7474
if(temp >= 0 && temp <= 16)
7575
*out = temp;
7676
else *out = 8;
7777
}
7878

79-
void ParseBrightness(const char *value, int32_t *out){
79+
void ParseBrightness(const char *value, uint32_t *out) {
8080
int32_t temp=8;
8181
ParseInt(value, &temp);
8282
if(temp >= 0 && temp <= 63)
@@ -117,7 +117,7 @@ namespace ams::mitm {
117117
else *out = 0.0f;
118118
}
119119

120-
void ParseRGBstring(const char* value, controller::RGBColour *out){
120+
void ParseRGBstring(const char* value, controller::RGBColour *out) {
121121
uint8_t temp[3];
122122
if (std::strncmp(value, "rgb(", 4) == 0) {
123123
value+=4;
@@ -126,28 +126,28 @@ namespace ams::mitm {
126126
temp[0] = 0;
127127
temp[1] = 0;
128128
temp[2] = 0;
129-
while(i<str_len && value[i] !=')' && k <= 2){
130-
if(value[i] >= '0' && value[i] <= '9') {
129+
while (i < str_len && value[i] !=')' && k <= 2){
130+
if (value[i] >= '0' && value[i] <= '9') {
131131
temp[k] *= 10;
132132
temp[k] += value[i] - '0';
133133

134134
}
135-
else if(value[i] == ','){
135+
else if (value[i] == ','){
136136
k++;
137137
}
138-
else if(value[i] != ' ') //Ignore spaces if found
138+
else if (value[i] != ' ') //Ignore spaces if found
139139
return;
140140
i++;
141141
}
142-
if(k==2){
142+
if (k == 2){
143143
out->r = temp[0];
144144
out->g = temp[1];
145145
out->b = temp[2];
146146
}
147147
}
148148
else if (value[0] == '#') {
149149
char buf[2 + 1];
150-
if(strlen(value)>=7){
150+
if (strlen(value) >= 7) {
151151
std::memcpy(buf, value + 1, 2);
152152
temp[0] = static_cast<uint8_t>(std::strtoul(buf, nullptr, 16));
153153
std::memcpy(buf, value + 3, 2);
@@ -164,7 +164,7 @@ namespace ams::mitm {
164164
}
165165

166166
Result StringifyBluetoothAddress(const bluetooth::Address *address, char *out, size_t out_size) {
167-
if(out_size < 2*sizeof(bluetooth::Address) + 1)
167+
if (out_size < 2*sizeof(bluetooth::Address) + 1)
168168
return -1;
169169

170170
char ch;

mc_mitm/source/mcmitm_config.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ namespace ams::mitm {
4444

4545
struct {
4646
bool use_western_layout;
47-
int32_t sony_led_brightness;
48-
int32_t dualshock_pollingrate_divisor;
47+
uint32_t sony_led_brightness;
48+
uint32_t dualshock_pollingrate_divisor;
4949
bool swap_dpad_lstick;
5050
bool invert_lstick_xaxis;
5151
bool invert_lstick_yaxis;

0 commit comments

Comments
 (0)