Commit Graph
26 Commits
Author SHA1 Message Date
LibretroAdmin cbcc8696ec overlay: LED images are the pack's to name; ledN_map reaches nul buttons only
A pack names the image that shows an LED with overlayN_descM_led = K
(1-based, as ledN_map counts): under led_driver = "overlay" that image
shows while the core has LED K lit, and a pack that names any LED image
is not mapped at all. For a pack that names none, ledN_map still picks
slots of the page, but only the image of a "nul" button answers to it:
a desc that does something when pressed is never an LED, so a config
made for an LED overlay leaves a gamepad pack's controls where they are.

The LED driver reports the core's LEDs (input_overlay_set_led) and
input/input_overlay_leds.c decides what they hide. The per-slot
visibility array, its enum and the parameter threaded through the
alpha and poll paths are gone.

overlay_visibility_bounds_test now builds input_overlay_leds.c with
the LED driver and pins the map/named/off cases and the page bound;
overlay_led_hidden_test runs a mapped pack and a named pack under Xvfb
with Up held.
2026-09-23 03:16:29 +02:00
LibretroAdmin bc0cf2adef led/win32: read the published modifier mask instead of GetKeyState
keyboard_led() runs on the main thread: led_driver_init from
retroarch.c and led_driver_set_led wired into the core LED interface in
runloop.c. Under video_threaded the main window and its message pump
belong to the video thread, so the main thread's synchronous key table
is never advanced and GetKeyState reports every lock as clear.

That made keyboard_init() record all three locks as off, and every
subsequent set saw status 0 and fired keybd_event to toggle a lock that
was already lit. keyboard_free() then "restored" all of them to off.

Take the lock state from the mask win32_update_keyboard_mods()
publishes from the owning thread, which is correct in both video
threading configurations.

The mask advances when the window procedure sees a key event, so a lock
changed while RetroArch is not focused is still not observed until the
next key reaches the window. That is a smaller window than before and
matches what the rest of the Win32 input path already assumes.
2026-09-01 05:11:39 +02:00
LibretroAdmin a872dc1135 led/win32: mask GetKeyState to the toggle bit
keyboard_led() tested the whole GetKeyState return for truth. A lock key
that is physically held reads as 0xFF80 or 0xFF81, which is truthy even
when the lock itself is off, so the initial state captured at
keyboard_init() could be recorded as lit for a key whose LED was dark -
and then "restored" to on at deinit. The same conflation misfires on
every subsequent set, since state and status are compared as booleans.

Mask to bit 0, which is the documented toggle bit.
2026-09-01 04:49:54 +02:00
LibretroAdmin b9be38fd55 strl: copy string literals without scanning them at runtime
strlcpy() begins with strlen() of its source. It lives in another
translation unit, so with no LTO that scan happens at runtime even when
the source is a literal whose length the compiler already measured, and
the call itself cannot be folded away either.

strlcpy_lit() passes the length over as sizeof(). When the destination
size is also a constant -- sizeof(buf), the usual case -- nothing is
left but the stores memcpy() compiles to:

  strlcpy      "core_options"  sizeof(buf)   7.01 ns
  strlcpy_lit  "core_options"  sizeof(buf)   0.42 ns
  strlcpy      41-char literal sizeof(buf)   7.74 ns
  strlcpy_lit  41-char literal sizeof(buf)   0.71 ns
  strlcpy      "core_options"  runtime len   7.11 ns
  strlcpy_lit  "core_options"  runtime len   0.70 ns

The destination bound is kept. When the literal does not fit it defers
to strlcpy(), so the copy truncates as before rather than overrunning;
a form that took only the literal would have turned every one of these
sites into an overflow waiting for a small buffer. The literal is
concatenated with "" so a non-literal source is a compile error rather
than a sizeof() that silently measures a pointer.

818 sites across 104 files were converted by parsing arguments rather
than by pattern-matching text: only a three-argument call whose second
argument is a bare string literal is rewritten, so a macro that happens
to expand to a literal is left alone. Line endings are preserved, so
the CRLF files carry only their own changed lines.

test/compat/test_strl.c compares the two against each other over every
destination size from 0 past the literal's length, for literals that
are empty, single-character, path-shaped, adjacently concatenated and
escape-bearing, checking the return, the terminator and the whole
buffer so an overrun past the terminator is caught. ASan+UBSan+LSan and
TSan both 4/4. The full menu_displaylist_build_list walk over every
displaylist type is byte-identical to before the change
(md5 a2a081bcac09cdc8d72d67efd14ac40e).
2026-08-30 02:10:20 +02:00
libretroadmin 7ebab640d7 Cleanups/style nits 2023-02-23 13:15:14 +01:00
zoltanvb f56cbd847d LED driver for Linux /sys/class/leds (#14981)
New driver for controlling system LEDs offered via /sys/class/leds.
Currently it handles led0, led1 etc. type of entries, which are
present on e.g. Raspberry Pi's.
2023-02-14 23:00:35 +01:00
libretroadmin 01c3684b10 Cleanups - try to remove stdio.h include where possible 2023-01-21 22:25:38 +01:00
libretroadmin 8a3686df58 Revert "Header cleanups - don't include retroarch.h everywhere"
This reverts commit 0e3b478f8c.
2023-01-08 09:05:46 +01:00
libretroadmin 0e3b478f8c Header cleanups - don't include retroarch.h everywhere 2023-01-08 08:56:57 +01:00
LibretroAdmin 0e5b2ff280 (LED drivers) Miscellaneous cleanups 2022-08-23 08:11:22 +02:00
LibretroAdmin 491cf7f2b4 Merge pull request #14010 from sonninnos/x11-led-keyboard
(X11) Add LED keyboard driver
2022-06-07 02:39:20 +01:00
Tony Jansson a8cff31420 (X11) Add LED keyboard driver 2022-06-05 08:27:41 +03:00
sonninnos 38f258c504 (WIN32) LED keyboard driver cleanup 2022-06-05 08:26:49 +03:00
sonninnos 054bf115ac LED win32 keyboard driver cleanup 2021-01-02 05:46:04 +02:00
twinaphex 4bdd0ac697 Uniquely name static globals 2020-09-22 03:05:58 +02:00
twinaphex 2e79940ec5 Rename led_keyboard.c to led_win32_keyboard.c - add it to Griffin
- only include it for Win32 (no Xbox or UWP)
2020-09-21 22:01:26 +02:00
Tony Jansson 82a0f647ff Keyboard LED driver 2020-09-21 17:25:11 +03:00
twinaphex 5166eebcaf for loop cleanups - use space after 'for' 2020-08-19 03:06:22 +02:00
twinaphex 2ecb6e654e Cleanups 2020-07-20 20:22:13 +02:00
twinaphex 641662d77c Remove led_null.c 2020-01-06 16:29:25 +01:00
twinaphex 2ad394148a Revert "Remove led_null.c"
This reverts commit bef72a19d0.
2020-01-06 16:22:11 +01:00
twinaphex bef72a19d0 Remove led_null.c 2020-01-06 16:01:05 +01:00
twinaphex ee3208ac39 Integrate video_driver.c into retroarch.c 2019-06-17 15:10:22 +02:00
orbea 28ff4b391a Clean up white space. 2019-02-03 16:00:50 -08:00
orbea 58fa3bc940 Attempt to fix xcode8 travis build failure. 2019-01-06 22:47:03 -08:00
meepingsnesroms 74c8506391 Add frontend, battery level and memory amount detection to 3ds port
Also fix white spaces in led drivers, make led drivers use standard driver format.
Begin work on translation driver.
Add salamander files to gitignore.
2018-01-10 16:52:32 -08:00