diff options
| author | Leonida local test <local-test@localhost> | 2026-11-22 18:37:28 +0100 |
|---|---|---|
| committer | Leonida local test <local-test@localhost> | 2026-11-22 18:37:28 +0100 |
| commit | af330fcce33843c94c2f446986b82f66cef00538 (patch) | |
| tree | ec00b14386f89ca3d6c00a53ebde3c117556cf99 /runtime/shims/gameinput.cpp | |
| parent | a3b1719c61b4b916964368bf9968e5f822cd50ca (diff) | |
gameinput: keep only the haptic calls the shim makes in the test seam (RT-160)
HapticApi carried SDL_GetNumHapticAxes and SDL_HapticEffectSupported, which
nothing calls: the motor's axes are the shim's choice and the effect kinds are
gated on SDL_GetHapticFeatures. They are gone from the table, its SDL
implementation and the test's fake, so the seam is exactly the calls a pad's
force feedback makes.
AI-assisted.
Diffstat (limited to 'runtime/shims/gameinput.cpp')
| -rw-r--r-- | runtime/shims/gameinput.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/runtime/shims/gameinput.cpp b/runtime/shims/gameinput.cpp index 1b9a55db2..07ac20b26 100644 --- a/runtime/shims/gameinput.cpp +++ b/runtime/shims/gameinput.cpp | |||
| @@ -103,11 +103,7 @@ bool same_guid(const GUID& a, const GUID& b) { return std::memcmp(&a, &b, sizeof | |||
| 103 | void* sdl_open_haptic(void* js) { return SDL_OpenHapticFromJoystick(static_cast<SDL_Joystick*>(js)); } | 103 | void* sdl_open_haptic(void* js) { return SDL_OpenHapticFromJoystick(static_cast<SDL_Joystick*>(js)); } |
| 104 | void sdl_close_haptic(void* h) { SDL_CloseHaptic(static_cast<SDL_Haptic*>(h)); } | 104 | void sdl_close_haptic(void* h) { SDL_CloseHaptic(static_cast<SDL_Haptic*>(h)); } |
| 105 | uint32_t sdl_haptic_features(void* h) { return SDL_GetHapticFeatures(static_cast<SDL_Haptic*>(h)); } | 105 | uint32_t sdl_haptic_features(void* h) { return SDL_GetHapticFeatures(static_cast<SDL_Haptic*>(h)); } |
| 106 | int sdl_haptic_axes(void* h) { return SDL_GetNumHapticAxes(static_cast<SDL_Haptic*>(h)); } | ||
| 107 | int sdl_haptic_max_effects(void* h) { return SDL_GetMaxHapticEffects(static_cast<SDL_Haptic*>(h)); } | 106 | int sdl_haptic_max_effects(void* h) { return SDL_GetMaxHapticEffects(static_cast<SDL_Haptic*>(h)); } |
| 108 | bool sdl_haptic_supported(void* h, const void* e) { | ||
| 109 | return SDL_HapticEffectSupported(static_cast<SDL_Haptic*>(h), static_cast<const SDL_HapticEffect*>(e)); | ||
| 110 | } | ||
| 111 | int sdl_haptic_create(void* h, const void* e) { | 107 | int sdl_haptic_create(void* h, const void* e) { |
| 112 | return SDL_CreateHapticEffect(static_cast<SDL_Haptic*>(h), static_cast<const SDL_HapticEffect*>(e)); | 108 | return SDL_CreateHapticEffect(static_cast<SDL_Haptic*>(h), static_cast<const SDL_HapticEffect*>(e)); |
| 113 | } | 109 | } |
| @@ -121,10 +117,10 @@ bool sdl_haptic_stop(void* h, int id) { return SDL_StopHapticEffect(static_cast< | |||
| 121 | void sdl_haptic_destroy(void* h, int id) { SDL_DestroyHapticEffect(static_cast<SDL_Haptic*>(h), id); } | 117 | void sdl_haptic_destroy(void* h, int id) { SDL_DestroyHapticEffect(static_cast<SDL_Haptic*>(h), id); } |
| 122 | bool sdl_haptic_gain(void* h, int gain) { return SDL_SetHapticGain(static_cast<SDL_Haptic*>(h), gain); } | 118 | bool sdl_haptic_gain(void* h, int gain) { return SDL_SetHapticGain(static_cast<SDL_Haptic*>(h), gain); } |
| 123 | 119 | ||
| 124 | const rt::gameinput::HapticApi kSdlHaptic{sdl_open_haptic, sdl_close_haptic, sdl_haptic_features, sdl_haptic_axes, | 120 | const rt::gameinput::HapticApi kSdlHaptic{sdl_open_haptic, sdl_close_haptic, sdl_haptic_features, |
| 125 | sdl_haptic_max_effects, sdl_haptic_supported, sdl_haptic_create, | 121 | sdl_haptic_max_effects, sdl_haptic_create, sdl_haptic_update, |
| 126 | sdl_haptic_update, sdl_haptic_run, sdl_haptic_stop, | 122 | sdl_haptic_run, sdl_haptic_stop, sdl_haptic_destroy, |
| 127 | sdl_haptic_destroy, sdl_haptic_gain}; | 123 | sdl_haptic_gain}; |
| 128 | std::atomic<const rt::gameinput::HapticApi*> g_haptic_api{&kSdlHaptic}; | 124 | std::atomic<const rt::gameinput::HapticApi*> g_haptic_api{&kSdlHaptic}; |
| 129 | const rt::gameinput::HapticApi& haptics() { return *g_haptic_api.load(); } | 125 | const rt::gameinput::HapticApi& haptics() { return *g_haptic_api.load(); } |
| 130 | 126 | ||