Skip to content

Easy Frame Advance Setting#2588

Open
mracsys wants to merge 3 commits into
OoTRandomizer:Devfrom
mracsys:easy_pause_buffering_mmr
Open

Easy Frame Advance Setting#2588
mracsys wants to merge 3 commits into
OoTRandomizer:Devfrom
mracsys:easy_pause_buffering_mmr

Conversation

@mracsys

@mracsys mracsys commented May 30, 2026

Copy link
Copy Markdown

Port of the MMR "Easy Frame by Frame" pause buffer setting by ZoeyZolotova.

With the setting enable, holding the start button to unpause will advance one frame before pausing again. This makes pause buffering much easier to manage on emulators where frame timing can be inconsistent.

Normal pause buffering by timing a start button press is untouched, as well as re-pausing on the same frame.

Functionally, this replaces the else branch check in z_kaleido_setup.c for a new start button press with a new function that checks the following:

  1. Check for a new start button press. Return true if found (old behavior)
  2. Check for a held start button. If found, set a global toggle to true, but return false.
  3. On the next frame when this function runs again, repeat checks 1 and 2, but return true if the toggle variable is active/true.

The game tracks player inputs for the current frame (raw.pad, or cur.button in decomp), previous frame (raw_prev.pad, or prev.button in decomp), new positive inputs between frames (pad_pressed, or press.button in decomp), and new negative inputs between frames (pad_released, or rel.button in decomp). This makes it easy to track held inputs in addition to the already checked new inputs.

Testing

Tested on N64, Wii VC, Project64 3.0.1, RetroArch (mupen64plus-next core), and ares v147. Video below shows it in action on all platforms.

pause_buffer.mp4

@fenhl fenhl added Type: Enhancement New feature or request Component: ASM/C Changes some internals of the ASM/C libraries Status: Needs Review Someone should be looking at it Component: Setting specific to setting(s) Status: Under Consideration Developers are considering whether to accept or decline the feature described labels May 30, 2026
@djevangelia

Copy link
Copy Markdown
Hack:
8005b994:   li      at,4096               ; input                  -> jal
8005b998:   lui     a0,0x8012             ; load new upper a0      -> nop
8005b99c:   andi    t0,t9,0x1000          ; input                  -> nop
8005b9a0:   bne     t0,at,8005ba74        ; input                  -> beqzl
8005b9a4:   addiu   a0,a0,-17920          ; add into a0
--> a0 = 0x8011BA00
  1. KaleidoSetup_Update_HasPressedStart_Hook has lui a0,0x8012 + addiu a0,0xBA00 --> a0 = 0x8012BA00 so not matching. 0x8011ba00 is reg address it seems.
  2. addiu will run if v0 is zero, is that ok? Haven't checked that deep down the function

With the comments it was easy to find the hooked function 👍 I haven't tested it but the code seems ok otherwise.

@flagrama

flagrama commented May 30, 2026

Copy link
Copy Markdown

Pretty sure code in the PR is relying on sign extension. -17920 == 0xBA00 sign extended. After all, a negative value isn't unsigned so isn't an accurate representation of the real value the processor is working with.

image

@mracsys

mracsys commented May 30, 2026

Copy link
Copy Markdown
Author
Hack:
8005b994:   li      at,4096               ; input                  -> jal
8005b998:   lui     a0,0x8012             ; load new upper a0      -> nop
8005b99c:   andi    t0,t9,0x1000          ; input                  -> nop
8005b9a0:   bne     t0,at,8005ba74        ; input                  -> beqzl
8005b9a4:   addiu   a0,a0,-17920          ; add into a0
--> a0 = 0x8011BA00
1. `KaleidoSetup_Update_HasPressedStart_Hook` has `lui a0,0x8012  + addiu a0,0xBA00` --> `a0 = 0x8012BA00` so not matching. `0x8011ba00` is reg address it seems.

2. `addiu` will run if `v0` is zero, is that ok? Haven't checked that deep down the function

With the comments it was easy to find the hooked function 👍 I haven't tested it but the code seems ok otherwise.

Good catch, I jumped to building both halves of a0 in the hack instead of just the upper half.

The 0xBA00 value is identical to the disassembly. It turns negative due to two's complement like flag said.

Thanks for the reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: ASM/C Changes some internals of the ASM/C libraries Component: Setting specific to setting(s) Status: Needs Review Someone should be looking at it Status: Under Consideration Developers are considering whether to accept or decline the feature described Type: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants