upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/gameinput.cpp
diff options
context:
space:
mode:
authorLeonida local test <local-test@localhost>2026-11-22 18:37:28 +0100
committerLeonida local test <local-test@localhost>2026-11-22 18:37:28 +0100
commitaf330fcce33843c94c2f446986b82f66cef00538 (patch)
treeec00b14386f89ca3d6c00a53ebde3c117556cf99 /runtime/shims/gameinput.cpp
parenta3b1719c61b4b916964368bf9968e5f822cd50ca (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.cpp12
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
103void* sdl_open_haptic(void* js) { return SDL_OpenHapticFromJoystick(static_cast<SDL_Joystick*>(js)); } 103void* sdl_open_haptic(void* js) { return SDL_OpenHapticFromJoystick(static_cast<SDL_Joystick*>(js)); }
104void sdl_close_haptic(void* h) { SDL_CloseHaptic(static_cast<SDL_Haptic*>(h)); } 104void sdl_close_haptic(void* h) { SDL_CloseHaptic(static_cast<SDL_Haptic*>(h)); }
105uint32_t sdl_haptic_features(void* h) { return SDL_GetHapticFeatures(static_cast<SDL_Haptic*>(h)); } 105uint32_t sdl_haptic_features(void* h) { return SDL_GetHapticFeatures(static_cast<SDL_Haptic*>(h)); }
106int sdl_haptic_axes(void* h) { return SDL_GetNumHapticAxes(static_cast<SDL_Haptic*>(h)); }
107int sdl_haptic_max_effects(void* h) { return SDL_GetMaxHapticEffects(static_cast<SDL_Haptic*>(h)); } 106int sdl_haptic_max_effects(void* h) { return SDL_GetMaxHapticEffects(static_cast<SDL_Haptic*>(h)); }
108bool sdl_haptic_supported(void* h, const void* e) {
109 return SDL_HapticEffectSupported(static_cast<SDL_Haptic*>(h), static_cast<const SDL_HapticEffect*>(e));
110}
111int sdl_haptic_create(void* h, const void* e) { 107int 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<
121void sdl_haptic_destroy(void* h, int id) { SDL_DestroyHapticEffect(static_cast<SDL_Haptic*>(h), id); } 117void sdl_haptic_destroy(void* h, int id) { SDL_DestroyHapticEffect(static_cast<SDL_Haptic*>(h), id); }
122bool sdl_haptic_gain(void* h, int gain) { return SDL_SetHapticGain(static_cast<SDL_Haptic*>(h), gain); } 118bool sdl_haptic_gain(void* h, int gain) { return SDL_SetHapticGain(static_cast<SDL_Haptic*>(h), gain); }
123 119
124const rt::gameinput::HapticApi kSdlHaptic{sdl_open_haptic, sdl_close_haptic, sdl_haptic_features, sdl_haptic_axes, 120const 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};
128std::atomic<const rt::gameinput::HapticApi*> g_haptic_api{&kSdlHaptic}; 124std::atomic<const rt::gameinput::HapticApi*> g_haptic_api{&kSdlHaptic};
129const rt::gameinput::HapticApi& haptics() { return *g_haptic_api.load(); } 125const rt::gameinput::HapticApi& haptics() { return *g_haptic_api.load(); }
130 126