9 Commits
Author SHA1 Message Date
sgiannop 106c62ecb6 input: make KEY_* mappings work
No keyboard mapping has ever worked in this core. CInputSystem strips
the KEY_ prefix before calling GetKeyIndex(), so the core received
"D" while its table compared "KEY_D", and every KEY_* entry in
Supermodel.ini was ignored. The keyboard only worked through
RetroArch's keyboard-to-RetroPad binds.

GetKeyIndex() now covers every key name Supermodel accepts (as in the
SDL build, the generic SHIFT, CTRL and ALT have no single libretro key
and stay unmapped). It returns the key's position in the table rather
than a RETROK code, because CInputSystem uses the value to index its
key source arrays; IsKeyPressed() and GetKeyName() translate it back.

The default mappings keep the keys that cannot clash with RetroArch's
default binds: 1-8 (start, coin, service, test) and the arrow keys,
which only repeat what the D-pad already does. The letter keys and
Space are dropped. With RetroArch's default binds they would have fired
together with the pad buttons the same keys are bound to (in Virtua
Fighter 3, A would press Punch and Guard together), and F is
RetroArch's fullscreen hotkey. Players keep today's behaviour, and
KEY_* entries added to Supermodel.ini now work. The bundled
Supermodel.ini is regenerated to match.

Tested: Virtua Fighter 3 with RetroArch's default keyboard binds: 3
inserts a coin and 1 starts, arrows move, z/x/a/s each trigger one
action through the pad binds, d does nothing and f only toggles
fullscreen, 6 enters and leaves the test menu. Star Wars Trilogy, Scud
Race and The Lost World load and run.
2026-11-08 15:25:41 +02:00
Andrea af1fd64ff6 Add per-player gun cursors and a stable Star Wars yoke
(cherry picked from commit 5ed82d6baa, light-gun modes part only)

Gun and yoke axes were mapped to mixed sources such as
"MOUSE_XAXIS,JOY1_XAXIS". Supermodel answers such a mapping with the
first source that is not centred, and an accumulated relative mouse is
almost never exactly centred, so:

- in the analog-gun games (The Lost World, Ocean Hunter, L.A.
  Machineguns) the mouse shadowed the stick once it had moved;
- in Star Wars Trilogy the stick returned to wherever the mouse had
  been left instead of its centre (5DH/A0H instead of 80H/80H);
- player 2 had no gun at all (all P2 analog-gun inputs were NONE);
- a real light gun's position was never used: MOUSE_XAXIS read only
  the RetroMouse.

The input system now exposes separate devices: RetroMouse ports 1/2
(MOUSE, MOUSE2), RetroLightgun ports 1/2 (MOUSE3, MOUSE4), virtual
per-player gun cursors (MOUSE5, MOUSE6) and a virtual yoke (MOUSE7).
Two new options choose their sources and apply immediately:

- Gun Input Mode: Hybrid (default; light gun, mouse or left stick, the
  last one moved wins), Lightgun, Mouse, Analog Stick Cursor. The stick
  moves the cursor at a set speed and it stays where it is left.
- Star Wars Trilogy Input Mode: Hybrid (default; mouse or absolute
  stick, the last one moved wins), Mouse, Analog Stick.

Light gun Reload or AUX_A is the second trigger; IS_OFFSCREEN is no
longer read as a button, which left Shot 2 stuck. Mouse buttons and
wheel are read from all devices.

Adapted on dev: the original put the MOUSE5/6/7 mappings in its control
profiles. Here they are the defaults and, like the driving layout, are
re-applied after the Supermodel.ini merge so an older ini cannot bring
back the mixed sources; the bundled Supermodel.ini is updated to match.
Light gun Start/Select (mouse X1/X2) act as Start/Coin only in the
analog-gun games. KEY_F is not used for the yoke's Event 2, because F
is RetroArch's fullscreen hotkey. Many frontend drivers (RetroArch on
Wayland or X11) report one system pointer on every port, which made
player 2 mirror player 1's aim and shots; port 2's mouse and light gun
are now ignored until they report something port 1 did not, so udev
or raw-input setups with two real devices still work.

Tested: The Lost World gun test: mouse aims and fires as before and
right-click reloads; pad 1 and pad 2 sticks move the P1 and P2 cursors
and B fires; the mouse moves only P1 and a click no longer fires for
P2. Star Wars Trilogy input test: rest at 80H/80H, stick returns to
centre after the mouse was moved, mouse holds its position, fire and
event buttons respond to mouse and pad.
2026-11-08 09:13:13 +02:00
Andrea d7a151bc7c Restore optional Music.xml asset
Carry the custom DSB music mapping template forward from the previous Supermodel modernization branch. The wrapper, documentation, and CI artifact already expect this optional system asset.
2026-08-28 10:10:20 +03:00
Andrea 6e2cf973c4 Update MPC bridge handling from standalone Supermodel
Port upstream standalone commit fef2b38 so Step 1.x exposes only MPC105 and Step 2.x only MPC106. Keep bridge selection tied to hardware stepping even when the Libretro CPU-frequency override is active, and remove obsolete per-game PCI overrides.
2026-08-28 08:16:16 +03:00
sgiannop 6cd1b55709 feat: implement Widescreen Hack for New3D engine
- Adjusted frustum culling logic to prevent object clipping/popping at widened screen edges.
- Integrated core option 'supermodel_widescreen' to allow dynamic switching between 4:3 and widescreen.
- Updated Viewport handling in R3DFrameBuffers to maintain internal coordinate integrity.
2026-03-25 19:02:45 +02:00
sgiannop 599a7806eb feat: Add force feedback / rumble support for steering wheel games
Implement force feedback support via the libretro rumble interface,
enabling haptic feedback for Model 3 steering wheel games (Sega Rally 2,
Scud Race, Daytona USA 2, etc.).

Changes:
- CLibretroInputSystem: Add ProcessForceFeedbackCmd() override that maps
  Supermodel DriveBoard FF commands to libretro RETRO_RUMBLE_STRONG/WEAK
- CLibretroInputSystem: Add SetRumbleInterface() and SetFFBEnabled() for
  runtime control of the rumble interface
- CLibretroInputSystem: Override GetJoyDetails() to advertise FF capability
  on all axes, enabling the FF pipeline in the base InputSystem
- CLibretroOutputSystem: Add stub output system implementation
- retro_load_game: Initialize rumble interface via
  RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE and pass to input system
- retro_load_game: Re-apply FFB enabled state after SuperModelInit() to
  ensure DriveBoard is fully attached before activation
2026-02-23 13:10:11 +02:00
sgiannop 6a594d59c7 feat: Implement NVRAM save/load functionality.
Adds complete NVRAM persistence support for arcade machine settings
(difficulty, coin settings, volume, etc.) using RetroArch's save RAM
system.

Changes:
- Implement retro_get_memory_data/size() for NVRAM serialization
- Load NVRAM from .srm file on first frame (after RetroArch loads it)
- Add Service/Test menu button mappings (L/R/L2/R2 → buttons 21-24)
- Fix button mapping conflicts by moving Service/Test to unused slots
- Update Supermodel.ini with joystick mappings for Service/Test
- Add keyboard support (keys 5-8) for Service/Test menu access

NVRAM data is automatically saved to/loaded from RetroArch's saves
directory (e.g., ~/.config/retroarch/saves/Supermodel/[game].srm).

Combined with existing savestate support, this completes state
persistence implementation.

Tested with: Virtua Fighter 3 (settings persist across sessions)
2026-02-16 14:10:57 +02:00
sgiannop 34c1dff6d3 Added libretro control and joystick support. 2026-02-09 12:28:20 +02:00
twinaphex 196a16b031 commit remaining files 2019-03-01 02:33:56 +01:00