mirror of https://github.com/encounter/SDL.git
Fixed non-Apple builds
This commit is contained in:
parent
637bcd0b72
commit
86bc65a741
|
@ -2675,4 +2675,26 @@ SDL_GameControllerHandleDelayedGuideButton(SDL_Joystick *joystick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
|
||||||
|
{
|
||||||
|
#if defined(SDL_JOYSTICK_MFI)
|
||||||
|
const char *IOS_SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button);
|
||||||
|
return IOS_SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller, button);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
|
||||||
|
{
|
||||||
|
#if defined(SDL_JOYSTICK_MFI)
|
||||||
|
const char *IOS_SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
|
||||||
|
return IOS_SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller, axis);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -1006,11 +1006,27 @@ HIDAPI_DriverSwitch_ActuallyRumbleJoystick(SDL_DriverSwitch_Context *ctx, Uint16
|
||||||
*
|
*
|
||||||
* More information about these values can be found here:
|
* More information about these values can be found here:
|
||||||
* https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md
|
* https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md
|
||||||
|
*
|
||||||
|
* The switch's rumble doesn't act like a traditional controller with two separate motors attached to
|
||||||
|
* different sized weights. Instead, the two values are like two sine waves that get added together.
|
||||||
|
* You can play around with different combinations here https://www.desmos.com/calculator/0lqas9aq89
|
||||||
|
* There's a fairly narrow frequency range around 100-250Hz that really shakes the controller,
|
||||||
|
* everything else is quite weak. To get a low frequency rumble, you can offset two frequencies
|
||||||
|
* by a target low rumble frequency, which gets you a very noticeable variation in amplitude.
|
||||||
|
* (It'll be much clearer if you click that link and play around a bit)
|
||||||
|
* I picked 0xA4 and 0x3E based on a sweep of values ~40hz apart, because they produced the least rattle
|
||||||
|
* in my controller. This may not extend to other Switch controllers, however.
|
||||||
*/
|
*/
|
||||||
const Uint16 k_usHighFreq = 0x0074;
|
|
||||||
const Uint8 k_ucHighFreqAmp = EncodeRumbleHighAmplitude(high_frequency_rumble);
|
/* Maximum low frequency is reached when both values are the same */
|
||||||
const Uint8 k_ucLowFreq = 0x3D;
|
/* Maximum high frequency is reached with one value at zero */
|
||||||
const Uint16 k_usLowFreqAmp = EncodeRumbleLowAmplitude(low_frequency_rumble);
|
const Uint32 lowOutput = low_frequency_rumble + high_frequency_rumble;
|
||||||
|
const Uint16 highOutput = low_frequency_rumble;
|
||||||
|
|
||||||
|
const Uint16 k_usHighFreq = 0xA4; /* ~194.4Hz */
|
||||||
|
const Uint8 k_ucHighFreqAmp = EncodeRumbleHighAmplitude(highOutput);
|
||||||
|
const Uint8 k_ucLowFreq = 0x3E; /* ~153.2Hz */
|
||||||
|
const Uint16 k_usLowFreqAmp = EncodeRumbleLowAmplitude(SDL_min(lowOutput, SDL_MAX_UINT16));
|
||||||
|
|
||||||
if (low_frequency_rumble || high_frequency_rumble) {
|
if (low_frequency_rumble || high_frequency_rumble) {
|
||||||
EncodeRumble(&ctx->m_RumblePacket.rumbleData[0], k_usHighFreq, k_ucHighFreqAmp, k_ucLowFreq, k_usLowFreqAmp);
|
EncodeRumble(&ctx->m_RumblePacket.rumbleData[0], k_usHighFreq, k_ucHighFreqAmp, k_ucLowFreq, k_usLowFreqAmp);
|
||||||
|
|
|
@ -1585,7 +1585,7 @@ GetDirectionalPadForController(GCController *controller)
|
||||||
static char elementName[256];
|
static char elementName[256];
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
|
IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button)
|
||||||
{
|
{
|
||||||
elementName[0] = '\0';
|
elementName[0] = '\0';
|
||||||
#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
|
#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
|
||||||
|
@ -1697,9 +1697,8 @@ SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontrol
|
||||||
return elementName;
|
return elementName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
|
IOS_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis)
|
||||||
{
|
{
|
||||||
elementName[0] = '\0';
|
elementName[0] = '\0';
|
||||||
#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
|
#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
|
||||||
|
@ -1739,7 +1738,6 @@ SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontrolle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SDL_JoystickDriver SDL_IOS_JoystickDriver =
|
SDL_JoystickDriver SDL_IOS_JoystickDriver =
|
||||||
{
|
{
|
||||||
IOS_JoystickInit,
|
IOS_JoystickInit,
|
||||||
|
|
Loading…
Reference in New Issue