Skip to content

fix(cart): keep Action Replay chipmem hooks installed - #42

Merged
midwan merged 1 commit into
masterfrom
fix/action-replay-chipmem-hooks
Sep 15, 2026
Merged

midwan merged 1 commit into
masterfrom
fix/action-replay-chipmem-hooks

Conversation

@midwan

@midwan midwan commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #3

Root cause

Since the 5.x line, selecting an Action Replay MK I/II/III ROM cartridge loads the ROM but the freeze button does nothing (HRTMon keeps working).

action_replay_setbanks() installs chipmem_*put_actionreplay23 handlers that watch for the first Kickstart chipmem write to move the cart out of ACTION_REPLAY_WAITRESET (chipmem_lput_actionreplay23action_replay_chipwrite()DORESET). check_prefs_changed_custom() then ran right after startup and unconditionally restored the plain handlers:

chipmem_bank.lput = chipmem_lput;
chipmem_bank.wput = chipmem_wput;
chipmem_bank.bput = chipmem_bput;

With the hooks gone, the cart stayed in WAITRESET forever, so action_replay_freeze() returned 0 on every press.

The block is a leftover of the 2021 "Fast copper improvements" work (486db89): it originally swapped the _fc chipmem variants in and out; a later cleanup removed the variants but kept the reset. Upstream amiberry (and WinUAE) has no equivalent block — deleting it restores parity.

Verification

A500 + KS 1.3 + AR MK III v3.17, no disks:

  • Before: instrumented action_replay_freeze() shows ar_flag = -1 (WAITRESET) on every freeze press; no menu.
  • After: boot handshake completes (AR2/3: reset), freeze (F8) opens the Action Replay menu, exit/re-enter stable.
  • The AR1 hook path (chipmem_*put_actionreplay1) is equally affected and fixed by the same deletion.

check_prefs_changed_custom() unconditionally restored the plain chipmem
put handlers, wiping the chipmem_*put_actionreplay23 hooks that
action_replay_setbanks() installs. Without them the cart never advanced
past ACTION_REPLAY_WAITRESET, so the freeze button did nothing for
Action Replay 1/2/3 while HRTMon (no chipmem hooks) kept working.

The restore is a leftover from the 2021 fast-copper work: it originally
swapped the _fc handler variants in and out; a later cleanup removed
the variants but kept the reset. Full amiberry has no equivalent block.

Fixes #3
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-15T20:09:08.464640Z 8d5dc9f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@midwan midwan self-assigned this Sep 15, 2026
@midwan
midwan merged commit 2123b5d into master Sep 15, 2026
12 checks passed
@midwan
midwan deleted the fix/action-replay-chipmem-hooks branch September 15, 2026 20:17
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.

Action Replay MK III Roms not working

1 participant