From 8fb50a129f1e131d8338c0fdcc345ef3e15339ad Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Sat, 19 Jul 2025 15:29:29 -0500 Subject: [PATCH] add gamepad type grabbing --- source/qjs_sdl_input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/qjs_sdl_input.c b/source/qjs_sdl_input.c index 44af8ddc..5e9c6e61 100644 --- a/source/qjs_sdl_input.c +++ b/source/qjs_sdl_input.c @@ -733,6 +733,11 @@ JSC_CCALL(input_get_events, return events_array; ) +JSC_CCALL(input_gamepad_id_to_type, + int id = js2number(js, argv[0]); + return JS_NewString(js, SDL_GetGamepadStringForType(SDL_GetGamepadTypeForID(id))); +) + static const JSCFunctionListEntry js_input_funcs[] = { MIST_FUNC_DEF(input, mouse_show, 1), MIST_FUNC_DEF(input, mouse_lock, 1), @@ -740,6 +745,7 @@ static const JSCFunctionListEntry js_input_funcs[] = { MIST_FUNC_DEF(input, keymod, 0), MIST_FUNC_DEF(input, mousestate, 0), MIST_FUNC_DEF(input, get_events, 0), + MIST_FUNC_DEF(input, gamepad_id_to_type, 1), }; JSValue js_input_use(JSContext *js) {