Skip to content

Commit

Permalink
Fix #if-#endif declaration for WII mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Loc15 committed May 31, 2024
1 parent c4a6a31 commit 4e40c86
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/convert_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include "SwitchDescriptors.h"
#include "PS3_Descriptors.h"
#include "controller_simulator.h"
#include "wiimote.h"
#if PICO_W
#include "wiimote.h"
#endif
//Host
#include "xinput_definitions.h"
#include "hid_definitions.h"
Expand All @@ -23,9 +25,11 @@

#define KEYBOARD_MASK_REVERSE(a,b) ((a >> b)&1)

#define XINPUT_TO_WIIMOTE(a) ((a>>8))
#define XINPUT_TO_CLASSIC_X(a) ((a>>10) + 32)
#define XINPUT_TO_CLASSIC_Y(a) ((a>>11) + 32)
#if PICO_W
#define XINPUT_TO_WIIMOTE(a) ((a>>8))
#define XINPUT_TO_CLASSIC_X(a) ((a>>10) + 32)
#define XINPUT_TO_CLASSIC_Y(a) ((a>>11) + 32)
#endif

/*XINPUT TO SWITCH*/
const uint8_t SWITCH_DEVICE_HAT[] = {SWITCH_HAT_NOTHING, SWITCH_HAT_UP, SWITCH_HAT_DOWN, SWITCH_HAT_NOTHING, SWITCH_HAT_LEFT,
Expand Down Expand Up @@ -300,6 +304,7 @@ void new_report_fun(void *report, MODE mode_host, void *new_report, MODE mode_de
}
break;
case WII: {
#if PICO_W
WiimoteReport *device_report = new_report;

// No guide button for some controllers then using right thumbstick
Expand Down Expand Up @@ -449,6 +454,7 @@ void new_report_fun(void *report, MODE mode_host, void *new_report, MODE mode_de
}
}
}
#endif
}
break;
default:
Expand Down
6 changes: 5 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static PSXInputState psxReport = {
.r2 = 0x00
};

#if PICO_W
static WiimoteReport wiimote_report = {
.wiimote = {0},
.nunchuk = {0},
Expand All @@ -125,6 +126,7 @@ static WiimoteReport wiimote_report = {
.fake_motion = 0,
.center_accel = 0
};
#endif

/*------------- MAIN -------------*/

Expand Down Expand Up @@ -236,8 +238,8 @@ int main(void) {
btstack_hid(&switchReport);
#endif
break;
#if PICO_W
case WII:
#if PICO_W
// Set led functions
wiimote_emulator_set_led(led_on, led_off);
// Wiimote emulator
Expand Down Expand Up @@ -369,7 +371,9 @@ static void sendReportData(void *original_data) {
new_report_fun(original_data, HOST, &psxReport, PSX);
break;
case WII:
#if PICO_W
new_report_fun(original_data, HOST, &wiimote_report, WII);
#endif
break;
default:
break;
Expand Down

0 comments on commit 4e40c86

Please sign in to comment.