Commit Graph

12535 Commits

Author SHA1 Message Date
Zurdi
b72a7619bb Merge pull request #4617 from rommapp/claude/dev-build-git-branch
feat(about): show current git branch instead of "development"
2026-09-18 13:34:13 +02:00
zurdi
5f02a99fd3 fix: trust the repo root as a safe directory for git branch lookup
Addresses Copilot review feedback on PR #4617.

The Docker dev image's bind-mounted .git is host-owned while the
romm-dev container runs as root; git 2.35.2+ refuses that mismatch
as "dubious ownership" and rev-parse fails, so GIT_BRANCH silently
stayed null and the UI kept showing "development" in the very
workflow the mount was added for. Pass safe.directory scoped to
this one read-only invocation instead of touching global git config.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
2026-09-18 13:29:38 +02:00
Zurdi
723e70b699 Merge pull request #4616 from rommapp/claude/search-cover-dialog-polish
fix(covers): rework the search cover dialog layout
2026-09-18 13:23:47 +02:00
zurdi
2f2230924d fix(ci): suppress bandit B404/B607 on get_git_branch's subprocess call
Trunk Check failed on the PR: bandit flags importing subprocess
(B404) and invoking "git" by name instead of an absolute path
(B607), on top of the B603 shell=False call already suppressed.
Both are accepted here for the same reason B603 was: git is
resolved from PATH by design so this works across dev setups
(Docker and bare-metal alike), and the arguments are hardcoded.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
2026-09-18 13:22:15 +02:00
zurdi
4818531501 fix(dialogs): address Greptile and Copilot review of the cover dialog rework
- RMenu closes when it is disabled while open, so the cover dialog's sort
  menu no longer stays interactive once its results go away (Copilot).
- Both search dialogs also drop late responses once their scope is
  disposed, through useIsAlive (Greptile).
- One-line invariant comments for the search sequence and the result
  filter reset (Greptile).
- Object-form stub props and Partial-based fixture factories in the
  dialog tests (Greptile).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 13:20:24 +02:00
Zurdi
84d36061ae Merge pull request #4615 from rommapp/claude/player-save-buttons
feat(player): load saves and states from one in-game picker
2026-09-18 13:19:59 +02:00
zurdi
31527a1cdf fix(player): address Greptile and Copilot review on the save picker
- Switching saves first uploads (or holds) SRAM progress the auto-sync
  tick has not taken yet, so the save being left keeps it (Greptile).
- A save download only applies while it is still the latest pick and
  the player is alive; a stale or orphaned one no longer writes the SRAM
  or restarts the core (Copilot).
- LoadSaveStateDialog forwards $attrs to RDialog and gains a component
  test for the confirm, the save/state routing and the States reset
  (Copilot).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
2026-09-18 13:16:16 +02:00
zurdi
883ae57fff simplify: dedupe test cache-clear boilerplate and href fallback
- test_git_branch.py: replace the repeated cache_clear()/try/finally
  ritual in every test with one autouse fixture.
- useVersionDisplay: href's no-branch fallback now reads version.value
  instead of re-deriving the same "branch ?? VERSION" expression from
  the raw store a second time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
2026-09-18 13:10:29 +02:00
zurdi
fb05427c78 style(gallery): center the platform and collection settings tabs
Both settings tabs held their column to a readable width but pinned it
to the left edge of the page; it now sits centered on desktop and keeps
filling the width on phones.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 13:07:09 +02:00
zurdi
a878004afd fix(docker): mount .git so the dev container can report its branch
get_git_branch() resolves the repo root from backend/'s parent, but
docker-compose.yml only bind-mounts ./backend, ./frontend, and
./romm_mock, so the primary documented dev workflow never had a .git
to read and GIT_BRANCH always came back None. Mount it read-only.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
2026-09-18 13:06:33 +02:00
zurdi
b21d4e2693 review(code-review xhigh --fix): keep About reactive, fix branch URL encoding
- AboutDialog's links list was a static array read once at setup, so it
  never picked up a later heartbeat update; made it a computed.
- useVersionDisplay's GitHub tree link blanket-encoded the branch name,
  breaking "/" as a path separator (e.g. "feature/foo"); now encodes
  each segment. Deduped the dev-build/branch check into one computed.
- Trimmed two over-long comments/docstrings per house style.
- Added coverage: a CalledProcessError case for get_git_branch, and a
  full test file for useVersionDisplay.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
2026-09-18 13:06:25 +02:00
zurdi
ce0ede486d fix(dialogs): steady cover toolbar, stale match search guard, flush dialog body
- The cover dialog keeps every toolbar control mounted and disables what
  does not apply, so a search no longer collapses and regrows the
  toolbar, matching the match dialog.
- MatchRomDialog drops a search left running when it closes, so the
  previous ROM's results can no longer fill the next session and be
  matched to the wrong game. Covered by a new test.
- RDialog's compactBody becomes bodyPadding ("default" | "compact" |
  "flush"); ManageCollectionsDialog uses "flush" instead of its unscoped
  body override.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 13:00:36 +02:00
zurdi
dcd0f12651 feat(player): offer Sync save when auto-sync is off
With EmulatorJS auto-sync disabled, SRAM progress only reached the
server on Save & Quit. The ribbon now shows a "Sync save" button in that
configuration. It uploads the current SRAM with a screenshot of that
moment, as the auto-sync tick does, and answers with the same synced,
held-back or "no save data yet" notices. With auto-sync on, the button
stays hidden.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
2026-09-18 12:52:32 +02:00
zurdi
5440c9f03b feat(about): show current git branch instead of "development"
Local checkouts have no release tag, so heartbeat.SYSTEM.VERSION always
falls back to the literal string "development". Add a GIT_BRANCH field
(backend-resolved via git, display-only, not used in the version string
that also feeds outbound User-Agent headers) and use it in the About
dialog and the auth-screen VersionTag so a dev build shows the branch
being worked on instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
2026-09-18 12:51:00 +02:00
zurdi
9c3107b89a docs(player): trim the forced-write comment to two lines (review-polish)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
2026-09-18 12:36:11 +02:00
zurdi
bee249b7ea refactor(player): simplify save/state loading (simplify)
- The shell passes the Load button's label as a prop, so the shared
  Player no longer reads the UI version to guess which picker answers.
- The file-picker fallback after a save or state download is gone:
  an arraybuffer response is always an ArrayBuffer, so it never ran.
- The picker keeps its saves and states lists in one place for the tabs
  and the lists.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
2026-09-18 12:31:46 +02:00
zurdi
4478c8df74 refactor(covers): fix the body inset at its root and tidy the cover dialog (simplify)
- The results block keeps the body's bottom padding by not shrinking in
  the scrolling flex body, so the padding copy on the results stack is
  gone.
- The sort options live in useCoverFilters with the other option lists.
- Opening and closing share one reset helper, which also collapses the
  filter panel on close.
- A gridThumbs test helper and a corrected RDialog inset comment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 12:31:41 +02:00
zurdi
0ed149ba85 fix(player): harden in-game save loading (code-review)
- The save load only points writes at the picked save once its bytes
  are in the core, so a failed download leaves the running save alone.
  A failed switch logs, shows an error toast and skips the restart.
- The picker opens on States every time, as documented.
- v1's Load button keeps its "Load state" label, since its picker still
  lists states only.
- useSaveStateTabs returns stateCount, so the launch view drops its copy.
- The EJS_Buttons comment also holds with auto-sync off.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
2026-09-18 12:27:10 +02:00
zurdi
7a3969a707 fix(covers): drop a cover search left running when the dialog closes (code-review)
Closing the dialog mid-search left `searching` set, so reopening it
for another game skipped the new search and the stale response later
filled the dialog, letting the user pick the previous game's art. Each
search now carries a sequence number that closing bumps.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 12:26:29 +02:00
zurdi
4fe38cb0b3 refactor(covers): move the filter panel back into the dialog toolbar
The panel starts collapsed, so it no longer needs the scrolling body;
it sits under the Filters and sort row again, without the scroll-into-view
step and the card surface.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 12:14:37 +02:00
zurdi
0293c7d2f2 feat(player): confirm save/state loads and translate the EmulatorJS ribbon
Loading a save or a state from the in-game picker now asks first, since
either one replaces the running game and loses unsaved progress. That
replaces the note on the Saves tab.

The ribbon labels came partly from EmulatorJS's own language files,
which miss several of RomM's locales and strings such as "Disks", and
partly from hard-coded English on RomM's buttons (Load Latest State,
Quit, Save & Quit). Every ribbon button now takes its label from
RomM's locales: built-ins through EJS_Buttons displayName, the context
menu button (which EJS_Buttons cannot relabel) through its bottom-bar
handle, and RomM's buttons through a label argument.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
2026-09-18 12:10:32 +02:00
zurdi
66a09d0f1f refactor(covers): filters panel in the body, match dialog sizing, shared dialog inset
- The filter panel sits at the top of the scrolling body, on the same
  surface as the cover blocks, so a short screen no longer loses the
  cover list to a tall toolbar. Opening it scrolls it into view.
- Provider chips, the search field icon and the other controls use the
  match dialog's sizes; the chip density prop is gone.
- RDialog exposes its toolbar/footer inset as --r-dialog-inset and a
  compactBody prop that pads the body with it, replacing the unscoped
  body override.
- useCoverFilters no longer returns the unused hasGridResults.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 12:03:31 +02:00
zurdi
1ab27e1a2b feat(player): load saves and states from one in-game picker
EmulatorJS's "Export save file" and "Import save file" buttons were
intercepted and did not do what their labels said. Export uploaded the
SRAM, which auto-sync already does as the game writes it. Import only
listed server saves and wrote the SRAM without restarting the game, so
the save never took effect.

Both buttons are now hidden through EJS_Buttons. The Load State button
reads "Load save or state" and opens a picker with the launch screen's
Saves / States tabs. A state applies on the fly as before. A save is
written and the game restarts so it boots from it, and the Saves tab
says so.

The two v2 select dialogs merge into LoadSaveStateDialog. The tab
badges and core compatibility move into useSaveStateTabs, shared with
the launch view.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
2026-09-18 11:55:40 +02:00
zurdi
24821cfd02 refactor(covers): reuse RTag and the chevron toggle in the cover dialog (simplify)
- The Filters count uses RTag, as the gallery filter drawer does, instead
  of a hand-built pill.
- The Filters and sort chevrons use the shared .r-chevron-toggle flip
  driven by aria-expanded.
- The content switch defaults live in one object read by the refs,
  resetFilters and the active count.
- Tighter comments and a plainer sort test fixture.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 11:47:19 +02:00
zurdi
791116908f fix(covers): reset result-bound cover filters on new results (code-review)
- Resolution, style and uploader picks come from the loaded results, so
  they reset when a new result set arrives instead of hiding covers once
  their select disappears.
- The Filters count only includes the content switches while they are
  rendered.
- The provider chip row no longer scrolls, which clipped the chips'
  focus ring.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 11:42:35 +02:00
zurdi
a4d6a90adb fix(covers): rework the search cover dialog layout
- Controls live in the dialog toolbar like the match dialog: provider
  chips on top, then the search field and button, with the same 10px/8px
  row rhythm.
- Filters (type, resolution, style, uploader and content switches) sit
  in a panel that starts collapsed, behind a Filters button that counts
  the active filters.
- Sorting is a Relevance / Most votes menu button beside Filters.
- The Search button only disables while loading, provider chips match
  its height, the selects share the row evenly and the metadata
  providers block opens by default.
- Phones get a full-width Search button, split action buttons and
  centered switches; the body inset matches the toolbar's 14px.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
2026-09-18 11:31:51 +02:00
Zurdi
b46172b222 Merge pull request #4614 from rommapp/claude/state-core-group-header
fix(states): fold core groups from the whole header, center card actions
2026-09-18 11:29:28 +02:00
Zurdi
ff21788ae5 Fix test description for AssetStrip component
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-18 11:29:06 +02:00
zurdi
34a5997404 docs(saves): trim the AssetGroupHead header comment to two lines
Addresses Greptile's review of #4614.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 11:27:27 +02:00
Zurdi
9ad37eb7b4 Merge pull request #4613 from rommapp/claude/animated-covers
fix(covers): keep animated covers animated after they are applied
2026-09-18 11:25:04 +02:00
zurdi
aeef54d044 fix(covers): derive cover sizes off the event loop (Greptile review)
Addresses Greptile's review of #4613:
- Write the small cover and the WebP copies in a worker thread, since
  Pillow's work now scales with an animation's frames.
- Annotate the new converter fixture and the artwork test's tmp_path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 11:20:41 +02:00
zurdi
79de9c4e32 refactor(saves): move the band head geometry into AssetGroupHead (simplify)
The head owns its edge-to-edge padding, band radius and inset focus ring,
so the slot and core bands stop overriding it separately and line up by
construction. Drops dead padding on the centered state card actions.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 11:19:23 +02:00
zurdi
e639f64eee fix(states): paint the core head focus ring inside it (code-review)
The flush head put the key and pad outline ring past the band edge, where
a scrolling parent clips it. Adds a test that a core nothing can load
starts folded and opens from its head.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 11:12:43 +02:00
zurdi
cef2d3c79e fix(saves): align slot band rows with the state core bands
The slot head gets the same bottom padding as the core head, so the first
save row starts at the same depth as the first state tile.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 11:02:00 +02:00
zurdi
9424347708 style(covers): trim animated cover comments (review-polish)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 11:01:04 +02:00
zurdi
0318f078ae refactor(covers): simplify animated cover handling (simplify)
Simplify pass over the animated cover change:
- Encode animated small covers as WebP whatever the source, which drops
  the per-format GIF/APNG blending params and makes their WebP copy a
  plain file copy.
- Fold the is_animated gate into frame_durations and decode the small
  cover's frames in the same pass that reads their durations.
- Write uploaded animated artwork through the atomic write_file.
- Share test fixture constants and the animation encoder, and pin the
  per-frame pixel budget with a GIF whose canvas grows mid-animation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 11:00:14 +02:00
zurdi
cb4c4545a4 fix(states): fold core groups from the whole header, center card actions
The core group head sat inside the band's padding, so its hit area stopped
short of the band edges. It now spans the band edge to edge, with padding
that keeps the icon and title where they were, and the band inset moves to
a fold wrapper so collapsing animates the whole body.

The action buttons on managed state cards are centered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 10:55:04 +02:00
Zurdi
4006cce07b Merge pull request #4612 from rommapp/claude/fix-upload-add-button
fix(upload): style the pending-files Add button as a primary add action
2026-09-18 10:53:50 +02:00
zurdi
dce83363c8 fix(upload): style pending-files Add button as a primary add action
The "+ Add" button shown above a pending file list (Upload ROMs view,
firmware tab, and the shared PendingFilesDropzone used by the upload
dialogs) was a small text button. Match the other add buttons in v2:
flat, primary, default size.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LDN1KWrq9Cvjy1FT8vyNWm
2026-09-18 10:51:07 +02:00
zurdi
88a82a729f fix(covers): bound and harden animated cover processing (code-review)
Code-review pass over the animated cover change:
- Cap the pixels decoded across an animation (MAX_ANIMATION_PIXELS),
  counted per frame since a GIF canvas can grow mid-animation, so an
  oversized animation falls back to its first frame.
- Fall back to the first frame when a later frame fails to decode,
  instead of dropping the cover or escaping the error handlers.
- Store uploaded animated artwork as uploaded, like downloaded covers.
- Re-encode composited frames so each replaces the last (no GIF/APNG
  ghost trails), and keep GIF loop counts when converting to WebP.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 10:45:29 +02:00
zurdi
b326e66db9 fix(covers): keep animated covers animated after applying them
The small cover and the WebP copies were written through PIL, which keeps
only the first frame, so an animated SteamGridDB cover showed as a still
image everywhere once applied. Resize and convert every frame with its
timing, copy WebP sources instead of re-encoding them, and keep all
frames of uploaded animated artwork.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 10:22:02 +02:00
Zurdi
3cde4dd0af Merge pull request #4600 from rommapp/claude/save-sync-screenshot
feat(player): keep unsynced saves and states in the browser and retry them
2026-09-18 04:43:11 +02:00
zurdi
a03a29e758 fix(player): address Greptile and Copilot review of the save sync queue
- Save & Quit gives the save the frame it just captured, unless the server
  already holds those bytes with their own, and the exit flush captures one
  while the game still runs for a save the tick had not held yet. A game with
  no SRAM no longer breaks Save & Quit: its null save threw before the quit.
- A game's held captures upload oldest first, so the newest lands last and
  stays the slot's newest version.
- A pass stops as soon as the account that started it signs out, so the rest
  cannot land in the next account.
- A held save the slot refuses because another device left newer progress
  there is uploaded as a separate archived save instead of being dropped, and
  the player is told.
- A state is held without a request while the server is down, like a save.
- Passes in two tabs no longer upload the same rows: the drain takes a Web
  Lock where the browser offers one.
- The details view no longer warns about a game the route has moved away from.
- The v1 wrapper tears the emulator down through the same once-only guard.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
2026-09-18 04:40:19 +02:00
zurdi
c144d13811 Merge origin/master into claude/save-sync-screenshot
The simplify commit (417f00ff1) swept in another session's uncommitted work on
empty ROM uploads (backend/endpoints/roms/upload.py, its test, and
services/api/rom.ts with its test), which has since landed on master through
#4610 and #4611. Those four files take master's version here, so they leave
this PR's diff entirely.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
2026-09-18 04:18:23 +02:00
zurdi
dfa8eb8d61 fix(player): stop retrying the save every second while the server is down
The sync tick re-offers a failed upload on every pass, so an outage turned into
a failing request a second for as long as it lasted.

While the connection layer knows the server is down, a write now holds its
bytes and frame and makes no request at all; the next tick after the
connection comes back hands them over. A failure from a server that did answer
(a refusal, or a 5xx before the outage is noticed, or the v1 shell, which runs
no connection probe) spaces the retries out from 2s to 30s instead, and that
wait starts over once an upload lands or the connection returns.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
2026-09-18 04:12:58 +02:00
zurdi
0b868bca6a feat(player): translate in-game notices and never promise a copy not kept
The notices the player raises in game are translated in every locale. Quick
load also stops saying it came from the server: it reads the browser's own
quick slot.

A save or state the server did not take was announced as kept in this browser
whether or not IndexedDB took it, so a private window promised a later sync
that would never come. The store now reports whether a write stuck, and when
it did not the player hears that the asset could neither sync nor be kept.

Less work behind the queue:

- The questions only about what an account still owes (the details view and
  the shell's 30s pass) walk an owner index of keys and no longer deserialize
  every held save, state and frame to read two fields.
- A pass loads its rows one at a time rather than every blob at once.
- A row stores the rom's file stem and cover when it is captured, so a retry
  no longer fetches the full rom first; an older row without them still does.

Restoring the volume after a state no longer relies on the order in which
EmulatorJS persists its setting, which the nightly build used for netplay may
not share: the player's level and mute are written back explicitly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
2026-09-18 04:06:29 +02:00
zurdi
91b2197afb chore(player): trim comments to the fact the code cannot say
review-polish.

Comments over two lines of prose are cut to one or two, comparisons with the
alternative not taken are dropped, and so is a test comment citing #4610, an
unrelated upload PR. The helper that covers the screen, mutes and gates writes
while a state lands is renamed after all three, and a comment still naming the
store's old module reads the check it describes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
2026-09-18 03:50:31 +02:00
Zurdi
de2b87df7e Merge pull request #4611 from rommapp/claude/empty-upload-review-fixes
fix(upload): refuse an empty file that declares chunks
2026-09-18 03:46:11 +02:00
zurdi
417f00ff16 refactor(player): one restore window, one write path, one home per rule
simplify findings (reuse, simplification, efficiency, altitude).

Behaviour it fixes along the way:

- A state load held back the screen and the sound but not the writes, and
  dumping the SRAM for the new baseline fires a tick of its own: a tick that
  had already read the restored SRAM found it stable and changed, and uploaded
  the restore before the baseline landed. A state now closes the same write
  gate a save load does, and quick load goes through the same window.
- Save & Quit rewrote the held row without the frame the tick had stored. The
  write now owns which frame goes with the bytes it is given, so no caller can
  pass the wrong one, and it does not write out again bytes already held.
- A save whose first capture failed took a new screenshot on every retry.
- The shell kept polling the store every 30s while offline, and in game kept
  a timer armed for a save only the running session would hand over.
- A store upgrade wiped every row, which after release would drop users'
  unsynced progress. It now keeps them and only drops stores it stopped using.

Reuse and one home per rule:

- The save, state and screenshot files are built by the API modules for both
  the live uploads and the retries.
- The core compatibility rule is shared by the launch screen and the in-game
  picker.
- The banner uses useDelayedFlag, the toast host useEventListener, the retry
  refresh useRomSync().refetchRom, the refusal text errorMessage(), and the
  player's notices useSnackbar.
- The ledger of rows the server took is read in list() alone, and the retry
  judges a refused upload and a failed request in one place.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
2026-09-18 03:45:00 +02:00
zurdi
89a91d7e29 fix(upload): refuse an empty file that declares chunks
Addresses the Copilot review on #4610. /start accepted a zero-byte file
declaring chunks, which then took chunk uploads and failed at assembly
on the size check. Zero chunks and zero bytes now have to go together,
both ways, and a parametrized test covers each mismatch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018mKNYZbuF4aMns81Cptvxc
2026-09-18 03:41:45 +02:00