Skip to content

Add optional 'ips' patch parameter to romInsert and diskInsert - #20

Open
pvmm wants to merge 2 commits into
nataliapc:mainfrom
pvmm:ips-patch
Open

pvmm wants to merge 2 commits into
nataliapc:mainfrom
pvmm:ips-patch

Conversation

@pvmm

@pvmm pvmm commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Extends the openmsx_emu_media tool so an IPS patch can be applied to a ROM or disk image at insert time, mapping to openMSX's -ips option.

  • server_tools.ts: add optional ips param to romInsert/diskInsert; when set, build carta/diska insert "<media>" -ips "<patch>". The patch is applied in-memory only; the host media file is untouched.
  • utils.ts: add pure helpers buildIpsPatch() (original/patched bytes -> IPS buffer, with RLE records) and bytesToHexList() (Buffer -> space-separated hex bytes).
  • tests: add tests/utils/ips.test.ts (buildIpsPatch round-trips and edge cases) and extend tests/tools/emu-media.test.ts with TCL construction cases for the -ips option.
  • fixtures: add bootable e2e media pairs under tests/fixtures/ (sample.dsk + sample.patch.ips, sample16k.rom + sample16k.patch.ips) that print patch-visible strings on screen; ship them in the npm package via package.json files.
  • docs: AGENTS.md gains the manual e2e IPS-patching recipe with the verified reset semantics (patch applies at insert; no extra reset unless the machine already booted the media; DSK reload caveat: in-RAM programs stay stale after patching — reload from disk or reset) plus a screen-capture EACCES workaround. Skill references (media-management, emulator-control, screen-capture) updated to document the new ips parameter.

Verified on National_CF-3300: patched DSK shows
"PATCHED: DSK boot-sector msg!!!!!!!" and patched ROM shows "PATCHED 16KB ROM cart." on the emulated screen.

@pvmm
pvmm marked this pull request as draft September 2, 2026 19:24
pvmm added 2 commits September 2, 2026 16:30
Extends the openmsx_emu_media tool so an IPS patch can be applied to a
ROM or disk image at insert time, mapping to openMSX's `-ips` option.

- server_tools.ts: add optional `ips` param to romInsert/diskInsert;
  when set, build `carta/diska insert "<media>" -ips "<patch>"`. The
  patch is applied in-memory only; the host media file is untouched.
- utils.ts: add pure helpers `buildIpsPatch()` (original/patched bytes
  -> IPS buffer, with RLE records) and `bytesToHexList()` (Buffer ->
  space-separated hex bytes).
- tests: add `tests/utils/ips.test.ts` (buildIpsPatch round-trips and
  edge cases) and extend `tests/tools/emu-media.test.ts` with TCL
  construction cases for the `-ips` option.
- fixtures: add bootable e2e media pairs under `tests/fixtures/`
  (sample.dsk + sample.patch.ips, sample16k.rom + sample16k.patch.ips)
  that print patch-visible strings on screen; ship them in the npm
  package via package.json `files`.
- docs: AGENTS.md gains the manual e2e IPS-patching recipe with the
  verified reset semantics (patch applies at insert; no extra reset
  unless the machine already booted the media; DSK reload caveat:
  in-RAM programs stay stale after patching — reload from disk or
  reset) plus a screen-capture EACCES workaround. Skill references
  (media-management, emulator-control, screen-capture) updated to
  document the new `ips` parameter.

Verified on National_CF-3300: patched DSK shows
"PATCHED: DSK boot-sector msg!!!!!!!" and patched ROM shows
"PATCHED 16KB ROM cart." on the emulated screen.
@pvmm
pvmm marked this pull request as ready for review September 2, 2026 19:41
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