mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-06 01:46:25 +00:00
Use C++ style comments consistently in SDL source code
Implemented using this script: find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \; git checkout \ core/linux/SDL_evdev_kbd_default_keymap.h \ events/imKStoUCS.* \ hidapi \ joystick/controller_type.c \ joystick/controller_type.h \ joystick/hidapi/steam/controller_constants.h \ joystick/hidapi/steam/controller_structs.h \ joystick/SDL_gamepad_db.h \ libm \ render/*/*Shader*.h \ render/vitagxm/SDL_render_vita_gxm_shaders.h \ render/metal/SDL_shaders_metal_*.h \ stdlib/SDL_malloc.c \ stdlib/SDL_qsort.c \ stdlib/SDL_strtokr.c \ test/ \ video/directx/SDL_d3d12_xbox_cmacros.h \ video/directx/d3d12.h \ video/directx/d3d12sdklayers.h \ video/khronos \ video/x11/edid-parse.c \ video/x11/xsettings-client.* \ video/yuv2rgb sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
This commit is contained in:
@@ -33,18 +33,18 @@
|
||||
|
||||
#ifdef SDL_JOYSTICK_HIDAPI_SWITCH
|
||||
|
||||
/* Define this if you want to log all packets from the controller */
|
||||
/*#define DEBUG_SWITCH_PROTOCOL*/
|
||||
// Define this if you want to log all packets from the controller
|
||||
// #define DEBUG_SWITCH_PROTOCOL
|
||||
|
||||
/* Define this to get log output for rumble logic */
|
||||
/*#define DEBUG_RUMBLE*/
|
||||
// Define this to get log output for rumble logic
|
||||
// #define DEBUG_RUMBLE
|
||||
|
||||
/* The initialization sequence doesn't appear to work correctly on Windows unless
|
||||
the reads and writes are on the same thread.
|
||||
|
||||
... and now I can't reproduce this, so I'm leaving it in, but disabled for now.
|
||||
*/
|
||||
/*#define SWITCH_SYNCHRONOUS_WRITES*/
|
||||
// #define SWITCH_SYNCHRONOUS_WRITES
|
||||
|
||||
/* How often you can write rumble commands to the controller.
|
||||
If you send commands more frequently than this, you can turn off the controller
|
||||
@@ -52,7 +52,7 @@
|
||||
*/
|
||||
#define RUMBLE_WRITE_FREQUENCY_MS 30
|
||||
|
||||
/* How often you have to refresh a long duration rumble to keep the motors running */
|
||||
// How often you have to refresh a long duration rumble to keep the motors running
|
||||
#define RUMBLE_REFRESH_FREQUENCY_MS 50
|
||||
|
||||
#define SWITCH_GYRO_SCALE 14.2842f
|
||||
@@ -339,14 +339,14 @@ static int ReadInput(SDL_DriverSwitch_Context *ctx)
|
||||
{
|
||||
int result;
|
||||
|
||||
/* Make sure we don't try to read at the same time a write is happening */
|
||||
// Make sure we don't try to read at the same time a write is happening
|
||||
if (SDL_AtomicGet(&ctx->device->rumble_pending) > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = SDL_hid_read_timeout(ctx->device->dev, ctx->m_rgucReadBuffer, sizeof(ctx->m_rgucReadBuffer), 0);
|
||||
|
||||
/* See if we can guess the initial input mode */
|
||||
// See if we can guess the initial input mode
|
||||
if (result > 0 && !ctx->m_bInputOnly && !ctx->m_nInitialInputMode) {
|
||||
switch (ctx->m_rgucReadBuffer[0]) {
|
||||
case k_eSwitchInputReportIDs_FullControllerState:
|
||||
@@ -366,17 +366,17 @@ static int WriteOutput(SDL_DriverSwitch_Context *ctx, const Uint8 *data, int siz
|
||||
#ifdef SWITCH_SYNCHRONOUS_WRITES
|
||||
return SDL_hid_write(ctx->device->dev, data, size);
|
||||
#else
|
||||
/* Use the rumble thread for general asynchronous writes */
|
||||
// Use the rumble thread for general asynchronous writes
|
||||
if (SDL_HIDAPI_LockRumble() != 0) {
|
||||
return -1;
|
||||
}
|
||||
return SDL_HIDAPI_SendRumbleAndUnlock(ctx->device, data, size);
|
||||
#endif /* SWITCH_SYNCHRONOUS_WRITES */
|
||||
#endif // SWITCH_SYNCHRONOUS_WRITES
|
||||
}
|
||||
|
||||
static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs expectedID)
|
||||
{
|
||||
/* Average response time for messages is ~30ms */
|
||||
// Average response time for messages is ~30ms
|
||||
Uint64 endTicks = SDL_GetTicks() + 100;
|
||||
|
||||
int nRead = 0;
|
||||
@@ -401,7 +401,7 @@ static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Conte
|
||||
|
||||
static SDL_bool ReadProprietaryReply(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCommandIDs expectedID)
|
||||
{
|
||||
/* Average response time for messages is ~30ms */
|
||||
// Average response time for messages is ~30ms
|
||||
Uint64 endTicks = SDL_GetTicks() + 100;
|
||||
|
||||
int nRead = 0;
|
||||
@@ -581,7 +581,7 @@ static SDL_bool WriteRumble(SDL_DriverSwitch_Context *ctx)
|
||||
ctx->m_RumblePacket.ucPacketNumber = ctx->m_nCommandNumber;
|
||||
ctx->m_nCommandNumber = (ctx->m_nCommandNumber + 1) & 0xF;
|
||||
|
||||
/* Refresh the rumble state periodically */
|
||||
// Refresh the rumble state periodically
|
||||
ctx->m_ulRumbleSent = SDL_GetTicks();
|
||||
|
||||
return WritePacket(ctx, (Uint8 *)&ctx->m_RumblePacket, sizeof(ctx->m_RumblePacket));
|
||||
@@ -591,14 +591,14 @@ static ESwitchDeviceInfoControllerType CalculateControllerType(SDL_DriverSwitch_
|
||||
{
|
||||
SDL_HIDAPI_Device *device = ctx->device;
|
||||
|
||||
/* The N64 controller reports as a Pro controller over USB */
|
||||
// The N64 controller reports as a Pro controller over USB
|
||||
if (eControllerType == k_eSwitchDeviceInfoControllerType_ProController &&
|
||||
device->product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER) {
|
||||
eControllerType = k_eSwitchDeviceInfoControllerType_N64;
|
||||
}
|
||||
|
||||
if (eControllerType == k_eSwitchDeviceInfoControllerType_Unknown) {
|
||||
/* This might be a Joy-Con that's missing from a charging grip slot */
|
||||
// This might be a Joy-Con that's missing from a charging grip slot
|
||||
if (device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) {
|
||||
if (device->interface_number == 1) {
|
||||
eControllerType = k_eSwitchDeviceInfoControllerType_JoyConLeft;
|
||||
@@ -652,12 +652,12 @@ static SDL_bool BTrySetupUSB(SDL_DriverSwitch_Context *ctx)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_HighSpeed, NULL, 0, SDL_TRUE)) {
|
||||
/* The 8BitDo M30 and SF30 Pro don't respond to this command, but otherwise work correctly */
|
||||
/*return SDL_FALSE;*/
|
||||
// The 8BitDo M30 and SF30 Pro don't respond to this command, but otherwise work correctly
|
||||
// return SDL_FALSE;
|
||||
}
|
||||
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_Handshake, NULL, 0, SDL_TRUE)) {
|
||||
/* This fails on the right Joy-Con when plugged into the charging grip */
|
||||
/*return SDL_FALSE;*/
|
||||
// This fails on the right Joy-Con when plugged into the charging grip
|
||||
// return SDL_FALSE;
|
||||
}
|
||||
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_ForceUSB, NULL, 0, SDL_FALSE)) {
|
||||
return SDL_FALSE;
|
||||
@@ -700,10 +700,10 @@ static SDL_bool SetHomeLED(SDL_DriverSwitch_Context *ctx, Uint8 brightness)
|
||||
}
|
||||
}
|
||||
|
||||
rgucBuffer[0] = (0x0 << 4) | 0x1; /* 0 mini cycles (besides first), cycle duration 8ms */
|
||||
rgucBuffer[1] = ((ucLedIntensity & 0xF) << 4) | 0x0; /* LED start intensity (0x0-0xF), 0 cycles (LED stays on at start intensity after first cycle) */
|
||||
rgucBuffer[2] = ((ucLedIntensity & 0xF) << 4) | 0x0; /* First cycle LED intensity, 0x0 intensity for second cycle */
|
||||
rgucBuffer[3] = (0x0 << 4) | 0x0; /* 8ms fade transition to first cycle, 8ms first cycle LED duration */
|
||||
rgucBuffer[0] = (0x0 << 4) | 0x1; // 0 mini cycles (besides first), cycle duration 8ms
|
||||
rgucBuffer[1] = ((ucLedIntensity & 0xF) << 4) | 0x0; // LED start intensity (0x0-0xF), 0 cycles (LED stays on at start intensity after first cycle)
|
||||
rgucBuffer[2] = ((ucLedIntensity & 0xF) << 4) | 0x0; // First cycle LED intensity, 0x0 intensity for second cycle
|
||||
rgucBuffer[3] = (0x0 << 4) | 0x0; // 8ms fade transition to first cycle, 8ms first cycle LED duration
|
||||
|
||||
return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetHomeLight, rgucBuffer, sizeof(rgucBuffer), NULL);
|
||||
}
|
||||
@@ -757,7 +757,7 @@ static void SDLCALL SDL_PlayerLEDHintChanged(void *userdata, const char *name, c
|
||||
static void GetInitialInputMode(SDL_DriverSwitch_Context *ctx)
|
||||
{
|
||||
if (!ctx->m_nInitialInputMode) {
|
||||
/* This will set the initial input mode if it can */
|
||||
// This will set the initial input mode if it can
|
||||
ReadInput(ctx);
|
||||
}
|
||||
}
|
||||
@@ -766,7 +766,7 @@ static Uint8 GetDefaultInputMode(SDL_DriverSwitch_Context *ctx)
|
||||
{
|
||||
Uint8 input_mode;
|
||||
|
||||
/* Determine the desired input mode */
|
||||
// Determine the desired input mode
|
||||
if (ctx->m_nInitialInputMode) {
|
||||
input_mode = ctx->m_nInitialInputMode;
|
||||
} else {
|
||||
@@ -783,7 +783,7 @@ static Uint8 GetDefaultInputMode(SDL_DriverSwitch_Context *ctx)
|
||||
* battery level over Bluetooth anyway.
|
||||
*/
|
||||
if (ctx->device->vendor_id == USB_VENDOR_NINTENDO) {
|
||||
/* However, switching to full controller state breaks DirectInput, so let's not do that */
|
||||
// However, switching to full controller state breaks DirectInput, so let's not do that
|
||||
#if 0
|
||||
input_mode = k_eSwitchInputReportIDs_FullControllerState;
|
||||
#endif
|
||||
@@ -803,7 +803,7 @@ static Uint8 GetSensorInputMode(SDL_DriverSwitch_Context *ctx)
|
||||
{
|
||||
Uint8 input_mode;
|
||||
|
||||
/* Determine the desired input mode */
|
||||
// Determine the desired input mode
|
||||
if (!ctx->m_nInitialInputMode ||
|
||||
ctx->m_nInitialInputMode == k_eSwitchInputReportIDs_SimpleControllerState) {
|
||||
input_mode = k_eSwitchInputReportIDs_FullControllerState;
|
||||
@@ -829,14 +829,14 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
SwitchSPIOpData_t readUserParams;
|
||||
SwitchSPIOpData_t readFactoryParams;
|
||||
|
||||
/* Read User Calibration Info */
|
||||
// Read User Calibration Info
|
||||
readUserParams.unAddress = k_unSPIStickUserCalibrationStartOffset;
|
||||
readUserParams.ucLength = k_unSPIStickUserCalibrationLength;
|
||||
|
||||
/* This isn't readable on all controllers, so ignore failure */
|
||||
// This isn't readable on all controllers, so ignore failure
|
||||
WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readUserParams, sizeof(readUserParams), &user_reply);
|
||||
|
||||
/* Read Factory Calibration Info */
|
||||
// Read Factory Calibration Info
|
||||
readFactoryParams.unAddress = k_unSPIStickFactoryCalibrationStartOffset;
|
||||
readFactoryParams.ucLength = k_unSPIStickFactoryCalibrationLength;
|
||||
|
||||
@@ -844,7 +844,7 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* Automatically select the user calibration if magic bytes are set */
|
||||
// Automatically select the user calibration if magic bytes are set
|
||||
if (user_reply && user_reply->stickUserCalibration.rgucLeftMagic[0] == 0xB2 && user_reply->stickUserCalibration.rgucLeftMagic[1] == 0xA1) {
|
||||
pLeftStickCal = user_reply->stickUserCalibration.rgucLeftCalibration;
|
||||
} else {
|
||||
@@ -863,23 +863,23 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
* Right: X-Center, Y-Center, X-Min, Y-Min, X-Max, Y-Max
|
||||
*/
|
||||
|
||||
/* Left stick */
|
||||
ctx->m_StickCalData[0].axis[0].sMax = ((pLeftStickCal[1] << 8) & 0xF00) | pLeftStickCal[0]; /* X Axis max above center */
|
||||
ctx->m_StickCalData[0].axis[1].sMax = (pLeftStickCal[2] << 4) | (pLeftStickCal[1] >> 4); /* Y Axis max above center */
|
||||
ctx->m_StickCalData[0].axis[0].sCenter = ((pLeftStickCal[4] << 8) & 0xF00) | pLeftStickCal[3]; /* X Axis center */
|
||||
ctx->m_StickCalData[0].axis[1].sCenter = (pLeftStickCal[5] << 4) | (pLeftStickCal[4] >> 4); /* Y Axis center */
|
||||
ctx->m_StickCalData[0].axis[0].sMin = ((pLeftStickCal[7] << 8) & 0xF00) | pLeftStickCal[6]; /* X Axis min below center */
|
||||
ctx->m_StickCalData[0].axis[1].sMin = (pLeftStickCal[8] << 4) | (pLeftStickCal[7] >> 4); /* Y Axis min below center */
|
||||
// Left stick
|
||||
ctx->m_StickCalData[0].axis[0].sMax = ((pLeftStickCal[1] << 8) & 0xF00) | pLeftStickCal[0]; // X Axis max above center
|
||||
ctx->m_StickCalData[0].axis[1].sMax = (pLeftStickCal[2] << 4) | (pLeftStickCal[1] >> 4); // Y Axis max above center
|
||||
ctx->m_StickCalData[0].axis[0].sCenter = ((pLeftStickCal[4] << 8) & 0xF00) | pLeftStickCal[3]; // X Axis center
|
||||
ctx->m_StickCalData[0].axis[1].sCenter = (pLeftStickCal[5] << 4) | (pLeftStickCal[4] >> 4); // Y Axis center
|
||||
ctx->m_StickCalData[0].axis[0].sMin = ((pLeftStickCal[7] << 8) & 0xF00) | pLeftStickCal[6]; // X Axis min below center
|
||||
ctx->m_StickCalData[0].axis[1].sMin = (pLeftStickCal[8] << 4) | (pLeftStickCal[7] >> 4); // Y Axis min below center
|
||||
|
||||
/* Right stick */
|
||||
ctx->m_StickCalData[1].axis[0].sCenter = ((pRightStickCal[1] << 8) & 0xF00) | pRightStickCal[0]; /* X Axis center */
|
||||
ctx->m_StickCalData[1].axis[1].sCenter = (pRightStickCal[2] << 4) | (pRightStickCal[1] >> 4); /* Y Axis center */
|
||||
ctx->m_StickCalData[1].axis[0].sMin = ((pRightStickCal[4] << 8) & 0xF00) | pRightStickCal[3]; /* X Axis min below center */
|
||||
ctx->m_StickCalData[1].axis[1].sMin = (pRightStickCal[5] << 4) | (pRightStickCal[4] >> 4); /* Y Axis min below center */
|
||||
ctx->m_StickCalData[1].axis[0].sMax = ((pRightStickCal[7] << 8) & 0xF00) | pRightStickCal[6]; /* X Axis max above center */
|
||||
ctx->m_StickCalData[1].axis[1].sMax = (pRightStickCal[8] << 4) | (pRightStickCal[7] >> 4); /* Y Axis max above center */
|
||||
// Right stick
|
||||
ctx->m_StickCalData[1].axis[0].sCenter = ((pRightStickCal[1] << 8) & 0xF00) | pRightStickCal[0]; // X Axis center
|
||||
ctx->m_StickCalData[1].axis[1].sCenter = (pRightStickCal[2] << 4) | (pRightStickCal[1] >> 4); // Y Axis center
|
||||
ctx->m_StickCalData[1].axis[0].sMin = ((pRightStickCal[4] << 8) & 0xF00) | pRightStickCal[3]; // X Axis min below center
|
||||
ctx->m_StickCalData[1].axis[1].sMin = (pRightStickCal[5] << 4) | (pRightStickCal[4] >> 4); // Y Axis min below center
|
||||
ctx->m_StickCalData[1].axis[0].sMax = ((pRightStickCal[7] << 8) & 0xF00) | pRightStickCal[6]; // X Axis max above center
|
||||
ctx->m_StickCalData[1].axis[1].sMax = (pRightStickCal[8] << 4) | (pRightStickCal[7] >> 4); // Y Axis max above center
|
||||
|
||||
/* Filter out any values that were uninitialized (0xFFF) in the SPI read */
|
||||
// Filter out any values that were uninitialized (0xFFF) in the SPI read
|
||||
for (stick = 0; stick < 2; ++stick) {
|
||||
for (axis = 0; axis < 2; ++axis) {
|
||||
if (ctx->m_StickCalData[stick].axis[axis].sCenter == 0xFFF) {
|
||||
@@ -915,7 +915,7 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
{
|
||||
SwitchSubcommandInputPacket_t *reply = NULL;
|
||||
|
||||
/* Read Calibration Info */
|
||||
// Read Calibration Info
|
||||
SwitchSPIOpData_t readParams;
|
||||
readParams.unAddress = k_unSPIIMUScaleStartOffset;
|
||||
readParams.ucLength = k_unSPIIMUScaleLength;
|
||||
@@ -924,7 +924,7 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
Uint8 *pIMUScale;
|
||||
Sint16 sAccelRawX, sAccelRawY, sAccelRawZ, sGyroRawX, sGyroRawY, sGyroRawZ;
|
||||
|
||||
/* IMU scale gives us multipliers for converting raw values to real world values */
|
||||
// IMU scale gives us multipliers for converting raw values to real world values
|
||||
pIMUScale = reply->spiReadData.rgucReadData;
|
||||
|
||||
sAccelRawX = (pIMUScale[1] << 8) | pIMUScale[0];
|
||||
@@ -935,7 +935,7 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
sGyroRawY = (pIMUScale[15] << 8) | pIMUScale[14];
|
||||
sGyroRawZ = (pIMUScale[17] << 8) | pIMUScale[16];
|
||||
|
||||
/* Check for user calibration data. If it's present and set, it'll override the factory settings */
|
||||
// Check for user calibration data. If it's present and set, it'll override the factory settings
|
||||
readParams.unAddress = k_unSPIIMUUserScaleStartOffset;
|
||||
readParams.ucLength = k_unSPIIMUUserScaleLength;
|
||||
if (WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readParams, sizeof(readParams), &reply) && (pIMUScale[0] | pIMUScale[1] << 8) == 0xA1B2) {
|
||||
@@ -950,18 +950,18 @@ static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
sGyroRawZ = (pIMUScale[19] << 8) | pIMUScale[18];
|
||||
}
|
||||
|
||||
/* Accelerometer scale */
|
||||
// Accelerometer scale
|
||||
ctx->m_IMUScaleData.fAccelScaleX = SWITCH_ACCEL_SCALE_MULT / (SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawX) * SDL_STANDARD_GRAVITY;
|
||||
ctx->m_IMUScaleData.fAccelScaleY = SWITCH_ACCEL_SCALE_MULT / (SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawY) * SDL_STANDARD_GRAVITY;
|
||||
ctx->m_IMUScaleData.fAccelScaleZ = SWITCH_ACCEL_SCALE_MULT / (SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawZ) * SDL_STANDARD_GRAVITY;
|
||||
|
||||
/* Gyro scale */
|
||||
// Gyro scale
|
||||
ctx->m_IMUScaleData.fGyroScaleX = SWITCH_GYRO_SCALE_MULT / (SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawX) * SDL_PI_F / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleY = SWITCH_GYRO_SCALE_MULT / (SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawY) * SDL_PI_F / 180.0f;
|
||||
ctx->m_IMUScaleData.fGyroScaleZ = SWITCH_GYRO_SCALE_MULT / (SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawZ) * SDL_PI_F / 180.0f;
|
||||
|
||||
} else {
|
||||
/* Use default values */
|
||||
// Use default values
|
||||
const float accelScale = SDL_STANDARD_GRAVITY / SWITCH_ACCEL_SCALE;
|
||||
const float gyroScale = SDL_PI_F / 180.0f / SWITCH_GYRO_SCALE;
|
||||
|
||||
@@ -992,7 +992,7 @@ static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, i
|
||||
|
||||
static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue)
|
||||
{
|
||||
/* 0x8000 is the neutral value for all joystick axes */
|
||||
// 0x8000 is the neutral value for all joystick axes
|
||||
const Uint16 usJoystickCenter = 0x8000;
|
||||
|
||||
sRawValue -= usJoystickCenter;
|
||||
@@ -1010,7 +1010,7 @@ static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nSt
|
||||
static Uint8 RemapButton(SDL_DriverSwitch_Context *ctx, Uint8 button)
|
||||
{
|
||||
if (ctx->m_bUseButtonLabels) {
|
||||
/* Use button labels instead of positions, e.g. Nintendo Online Classic controllers */
|
||||
// Use button labels instead of positions, e.g. Nintendo Online Classic controllers
|
||||
switch (button) {
|
||||
case SDL_GAMEPAD_BUTTON_SOUTH:
|
||||
return SDL_GAMEPAD_BUTTON_EAST;
|
||||
@@ -1031,7 +1031,7 @@ static int GetMaxWriteAttempts(SDL_HIDAPI_Device *device)
|
||||
{
|
||||
if (device->vendor_id == USB_VENDOR_NINTENDO &&
|
||||
device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) {
|
||||
/* This device is a little slow and we know we're always on USB */
|
||||
// This device is a little slow and we know we're always on USB
|
||||
return 20;
|
||||
} else {
|
||||
return 5;
|
||||
@@ -1041,10 +1041,10 @@ static int GetMaxWriteAttempts(SDL_HIDAPI_Device *device)
|
||||
static ESwitchDeviceInfoControllerType ReadJoyConControllerType(SDL_HIDAPI_Device *device)
|
||||
{
|
||||
ESwitchDeviceInfoControllerType eControllerType = k_eSwitchDeviceInfoControllerType_Unknown;
|
||||
const int MAX_ATTEMPTS = 1; /* Don't try too long, in case this is a zombie Bluetooth controller */
|
||||
const int MAX_ATTEMPTS = 1; // Don't try too long, in case this is a zombie Bluetooth controller
|
||||
int attempts = 0;
|
||||
|
||||
/* Create enough of a context to read the controller type from the device */
|
||||
// Create enough of a context to read the controller type from the device
|
||||
SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)SDL_calloc(1, sizeof(*ctx));
|
||||
if (ctx) {
|
||||
ctx->device = device;
|
||||
@@ -1067,7 +1067,7 @@ static ESwitchDeviceInfoControllerType ReadJoyConControllerType(SDL_HIDAPI_Devic
|
||||
}
|
||||
}
|
||||
if (eControllerType == k_eSwitchDeviceInfoControllerType_Unknown && attempts < MAX_ATTEMPTS) {
|
||||
/* Wait a bit and try again */
|
||||
// Wait a bit and try again
|
||||
SDL_Delay(100);
|
||||
continue;
|
||||
}
|
||||
@@ -1083,23 +1083,23 @@ static SDL_bool HasHomeLED(SDL_DriverSwitch_Context *ctx)
|
||||
Uint16 vendor_id = ctx->device->vendor_id;
|
||||
Uint16 product_id = ctx->device->product_id;
|
||||
|
||||
/* The Power A Nintendo Switch Pro controllers don't have a Home LED */
|
||||
// The Power A Nintendo Switch Pro controllers don't have a Home LED
|
||||
if (vendor_id == 0 && product_id == 0) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* HORI Wireless Switch Pad */
|
||||
// HORI Wireless Switch Pad
|
||||
if (vendor_id == 0x0f0d && product_id == 0x00f6) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* Third party controllers don't have a home LED and will shut off if we try to set it */
|
||||
// Third party controllers don't have a home LED and will shut off if we try to set it
|
||||
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_Unknown ||
|
||||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_LicProController) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* The Nintendo Online classic controllers don't have a Home LED */
|
||||
// The Nintendo Online classic controllers don't have a Home LED
|
||||
if (vendor_id == USB_VENDOR_NINTENDO &&
|
||||
ctx->m_eControllerType > k_eSwitchDeviceInfoControllerType_ProController) {
|
||||
return SDL_FALSE;
|
||||
@@ -1110,7 +1110,7 @@ static SDL_bool HasHomeLED(SDL_DriverSwitch_Context *ctx)
|
||||
|
||||
static SDL_bool AlwaysUsesLabels(Uint16 vendor_id, Uint16 product_id, ESwitchDeviceInfoControllerType eControllerType)
|
||||
{
|
||||
/* Some controllers don't have a diamond button configuration, so should always use labels */
|
||||
// Some controllers don't have a diamond button configuration, so should always use labels
|
||||
if (SDL_IsJoystickGameCube(vendor_id, product_id)) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
@@ -1187,7 +1187,7 @@ static SDL_bool HIDAPI_DriverJoyCons_IsSupportedDevice(SDL_HIDAPI_Device *device
|
||||
{
|
||||
if (vendor_id == USB_VENDOR_NINTENDO) {
|
||||
if (product_id == USB_PRODUCT_NINTENDO_SWITCH_PRO && device && device->dev) {
|
||||
/* This might be a Kinvoca Joy-Con that reports VID/PID as a Switch Pro controller */
|
||||
// This might be a Kinvoca Joy-Con that reports VID/PID as a Switch Pro controller
|
||||
ESwitchDeviceInfoControllerType eControllerType = ReadJoyConControllerType(device);
|
||||
if (eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft ||
|
||||
eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
@@ -1231,7 +1231,7 @@ static SDL_bool HIDAPI_DriverSwitch_IsSupportedDevice(SDL_HIDAPI_Device *device,
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* If it's handled by another driver, it's not handled here */
|
||||
// If it's handled by another driver, it's not handled here
|
||||
if (HIDAPI_DriverNintendoClassic_IsSupportedDevice(device, name, type, vendor_id, product_id, version, interface_number, interface_class, interface_subclass, interface_protocol) ||
|
||||
HIDAPI_DriverJoyCons_IsSupportedDevice(device, name, type, vendor_id, product_id, version, interface_number, interface_class, interface_subclass, interface_protocol)) {
|
||||
return SDL_FALSE;
|
||||
@@ -1300,7 +1300,7 @@ static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device)
|
||||
device->type = SDL_GAMEPAD_TYPE_STANDARD;
|
||||
break;
|
||||
case k_eSwitchDeviceInfoControllerType_Unknown:
|
||||
/* We couldn't read the device info for this controller, might not be fully compliant */
|
||||
// We couldn't read the device info for this controller, might not be fully compliant
|
||||
if (device->vendor_id == USB_VENDOR_NINTENDO) {
|
||||
switch (device->product_id) {
|
||||
case USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT:
|
||||
@@ -1354,10 +1354,10 @@ static SDL_bool HIDAPI_DriverSwitch_InitDevice(SDL_HIDAPI_Device *device)
|
||||
ctx->m_nMaxWriteAttempts = GetMaxWriteAttempts(device);
|
||||
ctx->m_bSyncWrite = SDL_TRUE;
|
||||
|
||||
/* Find out whether or not we can send output reports */
|
||||
// Find out whether or not we can send output reports
|
||||
ctx->m_bInputOnly = SDL_IsJoystickNintendoSwitchProInputOnly(device->vendor_id, device->product_id);
|
||||
if (!ctx->m_bInputOnly) {
|
||||
/* Initialize rumble data, important for reading device info on the MOBAPAD M073 */
|
||||
// Initialize rumble data, important for reading device info on the MOBAPAD M073
|
||||
SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[0]);
|
||||
SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[1]);
|
||||
|
||||
@@ -1365,7 +1365,7 @@ static SDL_bool HIDAPI_DriverSwitch_InitDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
UpdateDeviceIdentity(device);
|
||||
|
||||
/* Prefer the USB device over the Bluetooth device */
|
||||
// Prefer the USB device over the Bluetooth device
|
||||
if (device->is_bluetooth) {
|
||||
if (HIDAPI_HasConnectedUSBDevice(device->serial)) {
|
||||
return SDL_TRUE;
|
||||
@@ -1408,7 +1408,7 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
GetInitialInputMode(ctx);
|
||||
ctx->m_nCurrentInputMode = ctx->m_nInitialInputMode;
|
||||
|
||||
/* Initialize rumble data */
|
||||
// Initialize rumble data
|
||||
SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[0]);
|
||||
SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[1]);
|
||||
|
||||
@@ -1432,7 +1432,7 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
ctx->m_eControllerType != k_eSwitchDeviceInfoControllerType_N64 &&
|
||||
ctx->m_eControllerType != k_eSwitchDeviceInfoControllerType_SEGA_Genesis) {
|
||||
if (LoadIMUCalibration(ctx)) {
|
||||
/* Use the right sensor in the combined Joy-Con pair */
|
||||
// Use the right sensor in the combined Joy-Con pair
|
||||
if (!device->parent ||
|
||||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 200.0f);
|
||||
@@ -1456,22 +1456,22 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* Set desired input mode */
|
||||
// Set desired input mode
|
||||
if (!SetInputMode(ctx, GetDefaultInputMode(ctx))) {
|
||||
SDL_SetError("Couldn't set input mode");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* Start sending USB reports */
|
||||
// Start sending USB reports
|
||||
if (!device->is_bluetooth) {
|
||||
/* ForceUSB doesn't generate an ACK, so don't wait for a reply */
|
||||
// ForceUSB doesn't generate an ACK, so don't wait for a reply
|
||||
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_ForceUSB, NULL, 0, SDL_FALSE)) {
|
||||
SDL_SetError("Couldn't start USB reports");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the LED state */
|
||||
// Set the LED state
|
||||
if (HasHomeLED(ctx)) {
|
||||
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft ||
|
||||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
@@ -1488,7 +1488,7 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
ctx->m_bUseButtonLabels = SDL_TRUE;
|
||||
}
|
||||
|
||||
/* Initialize player index (needed for setting LEDs) */
|
||||
// Initialize player index (needed for setting LEDs)
|
||||
ctx->m_nPlayerIndex = SDL_GetJoystickPlayerIndex(joystick);
|
||||
ctx->m_bPlayerLights = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED, SDL_TRUE);
|
||||
UpdateSlotLED(ctx);
|
||||
@@ -1496,17 +1496,17 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_
|
||||
SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED,
|
||||
SDL_PlayerLEDHintChanged, ctx);
|
||||
|
||||
/* Initialize the joystick capabilities */
|
||||
// Initialize the joystick capabilities
|
||||
joystick->nbuttons = SDL_GAMEPAD_NUM_SWITCH_BUTTONS;
|
||||
joystick->naxes = SDL_GAMEPAD_AXIS_MAX;
|
||||
joystick->nhats = 1;
|
||||
|
||||
/* Set up for input */
|
||||
// Set up for input
|
||||
ctx->m_bSyncWrite = SDL_FALSE;
|
||||
ctx->m_ulLastIMUReset = ctx->m_ulLastInput = SDL_GetTicks();
|
||||
ctx->m_ulIMUUpdateIntervalNS = SDL_MS_TO_NS(5); /* Start off at 5 ms update rate */
|
||||
ctx->m_ulIMUUpdateIntervalNS = SDL_MS_TO_NS(5); // Start off at 5 ms update rate
|
||||
|
||||
/* Set up for vertical mode */
|
||||
// Set up for vertical mode
|
||||
ctx->m_bVerticalMode = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, SDL_FALSE);
|
||||
|
||||
return SDL_TRUE;
|
||||
@@ -1582,10 +1582,10 @@ static int HIDAPI_DriverSwitch_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
|
||||
if (device->parent) {
|
||||
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft) {
|
||||
/* Just handle low frequency rumble */
|
||||
// Just handle low frequency rumble
|
||||
high_frequency_rumble = 0;
|
||||
} else if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
/* Just handle high frequency rumble */
|
||||
// Just handle high frequency rumble
|
||||
low_frequency_rumble = 0;
|
||||
}
|
||||
}
|
||||
@@ -1600,14 +1600,14 @@ static int HIDAPI_DriverSwitch_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
if (low_frequency_rumble || high_frequency_rumble) {
|
||||
Uint32 unRumblePending = ((Uint32)low_frequency_rumble << 16) | high_frequency_rumble;
|
||||
|
||||
/* Keep the highest rumble intensity in the given interval */
|
||||
// Keep the highest rumble intensity in the given interval
|
||||
if (unRumblePending > ctx->m_unRumblePending) {
|
||||
ctx->m_unRumblePending = unRumblePending;
|
||||
}
|
||||
ctx->m_bRumblePending = SDL_TRUE;
|
||||
ctx->m_bRumbleZeroPending = SDL_FALSE;
|
||||
} else {
|
||||
/* When rumble is complete, turn it off */
|
||||
// When rumble is complete, turn it off
|
||||
ctx->m_bRumbleZeroPending = SDL_TRUE;
|
||||
}
|
||||
return 0;
|
||||
@@ -1635,7 +1635,7 @@ static Uint32 HIDAPI_DriverSwitch_GetJoystickCapabilities(SDL_HIDAPI_Device *dev
|
||||
}
|
||||
|
||||
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_ProController && !ctx->m_bInputOnly) {
|
||||
/* Doesn't have an RGB LED, so don't return SDL_JOYSTICK_CAP_RGB_LED here */
|
||||
// Doesn't have an RGB LED, so don't return SDL_JOYSTICK_CAP_RGB_LED here
|
||||
result |= SDL_JOYSTICK_CAP_RUMBLE;
|
||||
} else if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft ||
|
||||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
@@ -1666,7 +1666,7 @@ static int HIDAPI_DriverSwitch_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This overwrites any internal rumble */
|
||||
// This overwrites any internal rumble
|
||||
ctx->m_bRumblePending = SDL_FALSE;
|
||||
ctx->m_bRumbleZeroPending = SDL_FALSE;
|
||||
return 0;
|
||||
@@ -1675,11 +1675,11 @@ static int HIDAPI_DriverSwitch_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL
|
||||
ESwitchSubcommandIDs cmd = (ESwitchSubcommandIDs)payload[0];
|
||||
|
||||
if (cmd == k_eSwitchSubcommandIDs_SetInputReportMode && !device->is_bluetooth) {
|
||||
/* Going into simple mode over USB disables input reports, so don't do that */
|
||||
// Going into simple mode over USB disables input reports, so don't do that
|
||||
return 0;
|
||||
}
|
||||
if (cmd == k_eSwitchSubcommandIDs_SetHomeLight && !HasHomeLED(ctx)) {
|
||||
/* Setting the home LED when it's not supported can cause the controller to reset */
|
||||
// Setting the home LED when it's not supported can cause the controller to reset
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2183,7 +2183,7 @@ static void SendSensorUpdate(Uint64 timestamp, SDL_Joystick *joystick, SDL_Drive
|
||||
data[2] = -(ctx->m_IMUScaleData.fAccelScaleX * (float)values[0]);
|
||||
}
|
||||
|
||||
/* Right Joy-Con flips some axes, so let's flip them back for consistency */
|
||||
// Right Joy-Con flips some axes, so let's flip them back for consistency
|
||||
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
data[0] = -data[0];
|
||||
data[1] = -data[1];
|
||||
@@ -2191,7 +2191,7 @@ static void SendSensorUpdate(Uint64 timestamp, SDL_Joystick *joystick, SDL_Drive
|
||||
|
||||
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft &&
|
||||
!ctx->device->parent && !ctx->m_bVerticalMode) {
|
||||
/* Mini-gamepad mode, swap some axes around */
|
||||
// Mini-gamepad mode, swap some axes around
|
||||
float tmp = data[2];
|
||||
data[2] = -data[0];
|
||||
data[0] = tmp;
|
||||
@@ -2199,7 +2199,7 @@ static void SendSensorUpdate(Uint64 timestamp, SDL_Joystick *joystick, SDL_Drive
|
||||
|
||||
if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight &&
|
||||
!ctx->device->parent && !ctx->m_bVerticalMode) {
|
||||
/* Mini-gamepad mode, swap some axes around */
|
||||
// Mini-gamepad mode, swap some axes around
|
||||
float tmp = data[2];
|
||||
data[2] = data[0];
|
||||
data[0] = -tmp;
|
||||
@@ -2350,7 +2350,7 @@ static void HandleMiniControllerStateR(Uint64 timestamp, SDL_Joystick *joystick,
|
||||
SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX, axis);
|
||||
}
|
||||
|
||||
static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) SDL_NO_THREAD_SAFETY_ANALYSIS /* We unlock and lock the device lock to be able to change IMU state */
|
||||
static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchStatePacket_t *packet) SDL_NO_THREAD_SAFETY_ANALYSIS // We unlock and lock the device lock to be able to change IMU state
|
||||
{
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
|
||||
@@ -2470,7 +2470,7 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
|
||||
|
||||
ctx->m_bHasSensorData = SDL_TRUE;
|
||||
|
||||
/* We got three IMU samples, calculate the IMU update rate and timestamps */
|
||||
// We got three IMU samples, calculate the IMU update rate and timestamps
|
||||
ctx->m_unIMUSamples += 3;
|
||||
if (ctx->m_unIMUSamples >= IMU_UPDATE_RATE_SAMPLE_FREQUENCY) {
|
||||
Uint64 now = SDL_GetTicksNS();
|
||||
@@ -2526,7 +2526,7 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
|
||||
}
|
||||
|
||||
} else if (ctx->m_bHasSensorData) {
|
||||
/* Uh oh, someone turned off the IMU? */
|
||||
// Uh oh, someone turned off the IMU?
|
||||
const int IMU_RESET_DELAY_MS = 3000;
|
||||
Uint64 now = SDL_GetTicks();
|
||||
|
||||
@@ -2546,7 +2546,7 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
|
||||
}
|
||||
|
||||
} else {
|
||||
/* We have never gotten IMU data, probably not supported on this device */
|
||||
// We have never gotten IMU data, probably not supported on this device
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2605,7 +2605,7 @@ static SDL_bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
|
||||
ctx->device->product_id != USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) {
|
||||
const int INPUT_WAIT_TIMEOUT_MS = 100;
|
||||
if (now >= (ctx->m_ulLastInput + INPUT_WAIT_TIMEOUT_MS)) {
|
||||
/* Steam may have put the controller back into non-reporting mode */
|
||||
// Steam may have put the controller back into non-reporting mode
|
||||
SDL_bool wasSyncWrite = ctx->m_bSyncWrite;
|
||||
|
||||
ctx->m_bSyncWrite = SDL_TRUE;
|
||||
@@ -2616,7 +2616,7 @@ static SDL_bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
|
||||
ctx->m_nCurrentInputMode != k_eSwitchInputReportIDs_SimpleControllerState) {
|
||||
const int INPUT_WAIT_TIMEOUT_MS = 3000;
|
||||
if (now >= (ctx->m_ulLastInput + INPUT_WAIT_TIMEOUT_MS)) {
|
||||
/* Bluetooth may have disconnected, try reopening the controller */
|
||||
// Bluetooth may have disconnected, try reopening the controller
|
||||
size = -1;
|
||||
}
|
||||
}
|
||||
@@ -2633,14 +2633,14 @@ static SDL_bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
}
|
||||
|
||||
/* Reconnect the Bluetooth device once the USB device is gone */
|
||||
// Reconnect the Bluetooth device once the USB device is gone
|
||||
if (device->num_joysticks == 0 && device->is_bluetooth && packet_count > 0 &&
|
||||
!HIDAPI_HasConnectedUSBDevice(device->serial)) {
|
||||
HIDAPI_JoystickConnected(device, NULL);
|
||||
}
|
||||
|
||||
if (size < 0 && device->num_joysticks > 0) {
|
||||
/* Read error, device is disconnected */
|
||||
// Read error, device is disconnected
|
||||
HIDAPI_JoystickDisconnected(device, device->joysticks[0]);
|
||||
}
|
||||
return size >= 0;
|
||||
@@ -2651,7 +2651,7 @@ static void HIDAPI_DriverSwitch_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joy
|
||||
SDL_DriverSwitch_Context *ctx = (SDL_DriverSwitch_Context *)device->context;
|
||||
|
||||
if (!ctx->m_bInputOnly) {
|
||||
/* Restore simple input mode for other applications */
|
||||
// Restore simple input mode for other applications
|
||||
if (!ctx->m_nInitialInputMode ||
|
||||
ctx->m_nInitialInputMode == k_eSwitchInputReportIDs_SimpleControllerState) {
|
||||
SetInputMode(ctx, k_eSwitchInputReportIDs_SimpleControllerState);
|
||||
@@ -2743,6 +2743,6 @@ SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSwitch = {
|
||||
HIDAPI_DriverSwitch_FreeDevice,
|
||||
};
|
||||
|
||||
#endif /* SDL_JOYSTICK_HIDAPI_SWITCH */
|
||||
#endif // SDL_JOYSTICK_HIDAPI_SWITCH
|
||||
|
||||
#endif /* SDL_JOYSTICK_HIDAPI */
|
||||
#endif // SDL_JOYSTICK_HIDAPI
|
||||
|
Reference in New Issue
Block a user