Skip to content

libretro: Fix Boktai 1 solar sensor 8-bar mapping, add External Solar Sensor device for chord-based solar input#316

Draft
TideGear wants to merge 6 commits intolibretro:masterfrom
TideGear:mGBA-Solar-Enhancements
Draft

libretro: Fix Boktai 1 solar sensor 8-bar mapping, add External Solar Sensor device for chord-based solar input#316
TideGear wants to merge 6 commits intolibretro:masterfrom
TideGear:mGBA-Solar-Enhancements

Conversation

@TideGear
Copy link

Detect Boktai 1 by ROM code (U3IJ/U3IE/U3IP) and remap manual solar input to match its 8‑bar gauge. L3/R3 stepping now increments/decrements 0–8 bars (mapped onto the internal 0–10 lux steps), and the mgba_solar_sensor_level core option is clamped to 0–8 for Boktai 1 while leaving other games unchanged.

…pping

Add L3 + stick chord input mode for solar sensor control, designed for use
with the Ojo del Sol ESP32 UV sensor device. This allows setting absolute
solar levels via controller stick directions combined with L3.

Chord mapping:
- L3 only: 0 bars
- Left stick up/right/down/left + L3: 1-4 bars
- Right stick up/right/down/left + L3: 5-8 bars
- Both sticks up + L3: 9 bars (Boktai 2/3 only)
- Both sticks right + L3: 10 bars (Boktai 2/3 only)

Also fixes the longstanding bug where Boktai 1 was incorrectly treated as
having 10 solar steps when the game only has 8 bars. The core now detects
Boktai 1 by ROM code (U3IJ/U3IE/U3IP) and remaps input accordingly.

Changes:
- Merge Solar Sensor Level and Solar Sensor Input into a single unified option
- Add "Disabled" option to completely disable solar sensor input
- Add "Use Device Sensor If Available" option (moved from level setting)
- Add "L3/R3 Increment" mode (existing behavior)
- Add "L3 + Stick Chords" mode (new, now default)
- Add "Static: 0" through "Static: 10" for fixed solar levels
- Hide Brighten/Darken input labels when chord mode is active
- Add note about setting Analog to Digital Type to None in RetroArch
- Update all localized option definitions in intl header
Tighten solar sensor handling and clean up libretro plumbing: chord input now requires L3 for non-zero levels, solar button labels are only exposed in L3/R3 Increment mode, and joypad bitmask reads are treated as unsigned. Also removes redundant option polling/state and silences descriptor constness warnings.
Sync core options across locales by updating mgba_solar_sensor_input strings (Disabled, Use Device Sensor If Available) and dropping stale MGBA_SOLAR_SENSOR_LEVEL_* intl macros. Fix Android ndk-build by correcting LOCAL_SRC_FILES path handling, and update .gitignore for libretro-build outputs.
Detect Boktai 1 by ROM code (U3IJ/U3IE/U3IP) and remap manual solar input to match its 8‑bar gauge. L3/R3 stepping now increments/decrements 0–8 bars (mapped onto the internal 0–10 lux steps), and the mgba_solar_sensor_level core option is clamped to 0–8 for Boktai 1 while leaving other games unchanged.
@TideGear TideGear marked this pull request as ready for review January 30, 2026 07:58
@TideGear
Copy link
Author

I tested this thoroughly in both Boktai 1 and 2. The bar increases and decreases by 1 all the way up and down the meter, whether there are 8 segments or 10.

Adds an analog stick combo input mode for the Boktai solar sensor and scans all ports for valid input when active. Updates the solar sensor option text to document the stick mapping and temporary disabling of Analog to Digital caveat.

This works seamlessly with any standard connected gamepad (tested with DualSense) and/or my Ojo del Sol sensor that detects real UV/sunlight. (https://github.com/TideGear/BoktaiSensor)

The existing alternative (the Brighten Solar Sensor and Darken Solar Sensor binds) requires a lot of presses to go from one end of the meter to the other, and the in-game meter can lose sync with my Ojo del Sol device (if inputs get dropped), since the device is one way. The Analog Stick Control method is fast and stays synced with my device. Note that my specific device is NOT required to use this functionality. It will still work if someone makes a better solar sensor (which I would love), and as I mentioned before, it works with just a regular controller (as long as it has analog sticks).

Current mapping:
Solar Meter Group (0-3) - Left Analog Up
Solar Meter Group (4-7) - Left Analog Down
Solar Meter Group (8-10 & 0) - Left Analog Left
Solar Meter Select (0/4/8) - Right Analog Up
Solar Meter Select (1/5/9) - Right Analog Down
Solar Meter Select (2/6/10) - Right Analog Left
Solar Meter Select (3/7/0) - Right Analog Right (Extra slot here so we'll just circle back to 0.)

The player chooses one of the three groups, plus one of the four selections at the same time.

Example: If a player wanted solar meter 6, that would be Left Analog Down + Right Analog Left (at the same time).
@TideGear TideGear changed the title libretro: Fix Boktai 1 solar sensor 8-bar mapping libretro: Fix Boktai 1 solar sensor 8-bar mapping, add External Solar Sensor device for chord-based solar input Jan 31, 2026
@TideGear
Copy link
Author

TideGear commented Jan 31, 2026

I added Analog Stick Control for the Solar Sensor Level. See the commit for details.

I spoke with the devs on the mGBA Discord, and I came to the conclusion that this method of supporting jumping directly to a solar meter position is the best and least obtrusive without significant changes to the libretro core, frontends, etc.

@TideGear TideGear marked this pull request as draft February 12, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant