Repository navigation
Touch controls for every console when touch is the only input; Jedi Knight gets move / look sticks with per-game sensitivity - #46
Merged
Conversation
… the PC's 256 A metadata entry that points at a jkmots.cd (or *.jkm) marker is now a Jedi Knight game whose install is a Mysteries of the Sith one: the cart passes Config.mots, and jk_esp_engine_args() adds -motsCompat to the engine's command line, so OpenJKDF2 runs in its MotS mode (.goo resources, MotS's COG verbs, Force powers, HUD and saves). The engine side is esp-cpp/OpenJKDF2#8 (this bumps components/jk/OpenJKDF2 to 28d67c2e): the command line's flags reset at each launch, SMUSH (.san) cutscenes, and three crashes the campaign found. JK_SITHAI_MAX_ACTORS defaults to 256, the PC engine's size, up from 128: MotS's Hutt palace (s2l1_palace) has 164 AI things. 672 bytes an entry, allocated only while JK runs (445 KB of session arrays, was 361 KB). README: the jkmots/ install (from the CD's GAMEDATA, JKMSNDLO.GOO from its MININSTALL), its marker, and the games table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
…night gets move / look sticks with per-game sensitivity
With no USB gamepad or keyboard connected, every game now draws its touch
controls on the screen. They sit in the side bars when those are wide enough,
and over the picture otherwise, including with the Fill video setting.
- Each console's own pad (main/touch_gamepads.hpp, a VirtualGamepad):
- B / A on the NES and Game Boy, plus L / R on the GBA;
- A / B / X / Y and L / R on the SNES;
- 1 / 2 on the Master System and Game Gear, and A / B / C on the Genesis;
- the PlayStation shapes and L1 / R1 / L2 / R2 in MGS and TPM;
- FIRE / RUN / USE / WPN in Doom, and the MSX and PICO-8 keys.
The pause button replaces the hot corner, and a finger can slide between
face buttons.
- Jedi Knight's own layout (TouchControls, CUSTOM mode):
- floating move and look sticks;
- FIRE / ALT / JUMP / DUCK / ACT / ITEM;
- weapon and Force power buttons;
- a pause button.
The move stick reaches the engine as joystick axes (jk_esp_input_t.stick_x
/ stick_y), so it walks or runs by how far it is pushed.
- Per-game touch sensitivity: JK's pause menu has Move / Look sensitivity
rows (25-300 %). They are stored per ROM in settings V2 (Settings::touch_move
/ touch_look), which migrates a V1 file.
- Touch is the pointer where a game needs one: ScummVM always, Dark Forces in
its menus, and JK in its menus and cutscenes (TouchControls::Mode::POINTER).
- Drawing without flicker on the single-buffered panel: each panel pixel is
written once a frame.
- Side bars are drawn straight into the frame buffer, only when what they
show changes.
- Over the picture, with a scale below 2 (JK at 1.5x), the controls are
blended into the staging tiles before the PPA scales them.
- Otherwise they are drawn at full resolution, in cells in the tile
buffer's internal RAM: PPA scale, CPU blend, PPA copy to the frame buffer.
- Measured in Fit: GBA 59.6 fps and Genesis 59.5 fps with no dropped frames.
- A layout whose full-resolution overlay drops frames (GBA in Fill) falls
back to blending before the scaling.
- Layout::box_x0 / box_y0 come from the PPA's placement. An odd-width
picture (GBA Fill, 1275 px) otherwise put the box one row off, past the
cell buffer.
- main.cpp: volume and brightness are saved rounded. The brightness is read
back from the backlight's PWM duty, a hair under what was set, and
truncating it lost 1 % each time a game quit.
- tools/overlay_image.py skips fmt's dragonbox tables (64 / 128-bit powers of
ten, half of which can equal an overlay function's address).
- Submodules:
- OpenJKDF2 feat/esp32-touch-sticks: the stick's axes and binds;
- TheForceEngine feat/touch-gamepad-in-missions: Dark Forces' POINTER /
GAMEPAD switch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With no USB gamepad or keyboard connected, every game now draws its touch controls on the screen. They sit in the side bars when those are wide enough, and over the picture otherwise, including with the Fill video setting.
Each console's own pad, named as on the console (
main/touch_gamepads.hpp):A pause button replaces the invisible hot corner, and a finger can slide between face buttons.
Jedi Knight's own layout: floating move and look sticks; FIRE / ALT / JUMP / DUCK / ACT / ITEM; weapon and Force power buttons; a pause button. The move stick reaches the engine as joystick axes, so a light push walks and a full push runs.
Per-game touch sensitivity: JK's pause menu has Move sensitivity and Look sensitivity rows (25–300 %, 100 by default). They are stored per ROM in settings V2, which migrates the V1 file.
Touch stays a pointer where a game needs one: ScummVM always, Dark Forces in its menus, and JK in its menus and cutscenes.
Drawing without flicker on the single-buffered panel, where each pixel is written once a frame:
Also:
tools/overlay_image.pyskips fmt's dragonbox tables: their 64 / 128-bit constants can equal an overlay function's address.Submodule PRs, both merged: esp-cpp/OpenJKDF2#9 (the stick's axes) and esp-cpp/TheForceEngine#4 (Dark Forces' menus vs missions). It was stacked on #44, which is merged; main is merged in.
Settings note: older firmware can't read the V2 settings file. Flashing an older build resets settings to defaults on its next save.
Testing (Tab5, touch only, muted)
Video task time a frame, with presented fps:
🤖 Generated with Claude Code
https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY