Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
page" section for the full disposition and `to-dos/ROADMAP.md`/the approved UI/UX-parity plan
for what fixing those three would actually require.

### Added

- **Live host-input capture for Mouse/Super Scope** (Phase A.2 of the UI/UX-parity ladder, new
`crate::peripherals`). `config.port2_peripheral`'s Settings selector already wired the emulated
hardware correctly since `v0.9.0`; now `egui::Context`'s pointer state actually drives it once
per frame — `EmuCore::set_mouse` from pointer delta + left/right buttons, `EmuCore::set_superscope`
from an absolute aim position mapped through the present path's own letterbox transform
(`Gfx::letterbox_scale`, exposed `pub(crate)` for this reuse rather than re-derived) into SNES
pixel space, with trigger/cursor/turbo on left/right/middle mouse buttons. Mirrors
`rustysnes-libretro`'s own already-verified `poll_port_input` translation. Portable to wasm on
purpose (no `target_arch` gate) — both the pointer API and the `EmuCore` calls are already
platform-agnostic, so the hosted demo gets this too. 5 real unit tests cover the pure
coordinate-mapping math directly (centered/corner/pillarboxed/off-window cases), not just
"compiles."

### Fixed

- **A real, separate finding surfaced while scoping the above**: `docs/frontend.md`'s own "Status"
line claimed controller port 1 had "keyboard + gilrs gamepad" input, but `gilrs::Gilrs` is never
actually instantiated anywhere in `rustysnes-frontend` — confirmed via `input::gamepad_button`
(the gilrs-button-name mapping function) having zero callers. Port 1 is keyboard-only today.
Corrected the doc; wiring real gamepad support is a genuinely separate, larger prerequisite
(a live `Gilrs` instance + per-frame event polling), not something silently expanded into this
fix — it's also what blocks Super Multitap sub-pad 1-3 host input specifically, tracked
separately in the UI/UX-parity plan's backlog.

## [1.19.0] "Afterburner" - 2026-07-15

Fifteenth release of the RustyNES-parity roadmap: an optional PGO/BOLT pipeline for the
Expand Down
25 changes: 20 additions & 5 deletions crates/rustysnes-frontend/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1013,12 +1013,17 @@ impl App {
// Controller port 2 peripheral selection (`v0.9.0`, Phase 7 niche
// peripherals) — same "just re-sync unconditionally, once per real frame"
// pattern as cheats/watchpoints above; cheap (one enum-tag write) when
// unchanged. Host-input capture for the non-Gamepad devices (a real mouse
// pointer driving Super Scope aim / Mouse deltas, extra gamepads for
// Multitap sub-pads) is a follow-up frontend task — this wires the CORE's
// protocol correctly but doesn't yet feed it live host input
// (`docs/frontend.md` §Peripherals).
// unchanged.
emu.set_port_device(1, config.port2_peripheral.to_core());
// Host-input capture for Mouse/Super Scope (`v1.20.0`, closing the gap the
// comment above used to describe) — Multitap sub-pads still have no host
// input source; see `crate::peripherals`'s own module doc for why.
crate::peripherals::sync(
&active.egui_ctx,
&active.gfx,
&mut emu,
config.port2_peripheral.into(),
);
// PC breakpoints (`v0.9.0`, T-81-001 PR B) — same re-sync pattern as above;
// a no-op branch in `EmuCore::run_frame` when the list is empty.
emu.set_breakpoints(&active.breakpoints);
Expand Down Expand Up @@ -1089,6 +1094,16 @@ impl App {
#[cfg(feature = "debug-hooks")]
crate::watchpoints::sync(&active.watchpoints, &mut emu.system_mut().bus);
emu.set_port_device(1, config.port2_peripheral.to_core());
// Host-input capture for Mouse/Super Scope (`v1.20.0`) — same "re-sync once per
// present" cadence the port-device selection above already uses in this threaded
// build; live pointer state is read as often as we redraw, matching how
// `active.pad1`'s own keyboard latch feeds the thread.
crate::peripherals::sync(
&active.egui_ctx,
&active.gfx,
&mut emu,
config.port2_peripheral.into(),
);
emu.set_breakpoints(&active.breakpoints);
emu.set_voice_mutes(config.audio.voice_mutes);

Expand Down
7 changes: 6 additions & 1 deletion crates/rustysnes-frontend/src/gfx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,13 @@ impl Gfx {
/// clip-space position so the 4:3 SNES display fits inside the current surface regardless of
/// window shape — shared by [`Self::blit`] and [`Self::present`]'s filter passes (`v1.2.0`;
/// extracted from `blit`'s own inline math, a pure behavior-preserving refactor).
///
/// `pub(crate)` since `v1.20.0`: `crate::peripherals` reuses this SAME clip-space fraction to
/// map host pointer coordinates into SNES pixel space for Mouse/Super Scope input, rather than
/// re-deriving the letterbox math a second time and risking the two implementations drifting
/// apart.
#[allow(clippy::cast_precision_loss)]
fn letterbox_scale(&self) -> (f32, f32) {
pub(crate) fn letterbox_scale(&self) -> (f32, f32) {
let win_w = self.config.width.max(1) as f32;
let win_h = self.config.height.max(1) as f32;
let win_aspect = win_w / win_h;
Expand Down
3 changes: 3 additions & 0 deletions crates/rustysnes-frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ pub mod input;
#[cfg(all(feature = "netplay", not(target_arch = "wasm32")))]
pub mod netplay;
pub(crate) mod pacing;
// Host-input capture for Mouse/Super Scope (`v1.20.0`) — no target_arch/feature gate, matching
// `set_port_device`'s own unconditional compilation; see the module's own doc for why.
pub mod peripherals;
pub mod rewind;
pub mod save_states;
pub mod ui_shell;
Expand Down
Loading
Loading