[DRAFT] Add In-Game Reset (IGR) feature support - #341
Draft
mrj1m0thy wants to merge 2 commits into
Draft
Conversation
Adds IGR payload installation alongside cheats, controlled by new igr_enabled setting. IGR is only enabled for SummerCart64 with expansion pak. Includes new igr.c module, boot parameter, settings UI option, and integration across ROM/disk/emulator loading paths.
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Author
|
Testing required. going to do tests soon when i get time and do some debugging if necessary. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds IGR payload installation alongside cheats, controlled by new igr_enabled setting. IGR is only enabled for SummerCart64 with expansion pak. Includes new igr.c module, boot parameter, settings UI option, and integration across ROM/disk/emulator loading paths.
Add In-Game Reset (IGR) support for SummerCart64
Description
This PR implements an In-Game Reset (IGR) feature that allows users to soft-reboot back to the flashcart menu from a running N64 game by pressing a specific controller button combination.
Core implementation:
src/boot/igr.hand src/boot/igr.c: A MIPS payload generator that injects code into the cheat engine's exception handler. On every vertical interrupt (VI), it polls controller 1 buttons from PIF RAM and triggers an SC64 soft reboot via the AUX register (0xBFFF0018) when the combo is detected.I_SLLmacro tosrc/boot/vr4300_asm.hfor shift-left-logical instruction generation used in the payload.cheats_install()signature in src/boot/cheats.h and src/boot/cheats.c with a newbool igr_enabledparameter. The cheat engine now installs the IGR payload even when no cheat list is present, provided IGR is enabled and the Expansion Pak is present.igr_enabledtoboot_params_t(src/boot/boot.h) and wired it through src/boot/boot.c.igr_enabledto the settings system (src/menu/settings.h, src/menu/settings.c) with load/save support inconfig.iniunder the[menu]section.igr_enabledinto all boot paths: load_rom.c, load_disk.c, and load_emulator.c. IGR is gated to SummerCart64 only (cart_type == CART_SC) and requires an Expansion Pak.boot_paramsin src/main.c to prevent stale struct fields.SRCS.Button combination:
L + R + Z + A + B + Start(mask0xF030) — chosen to minimize accidental activation.Current limitations:
sc64) because it relies on the SC64 AUX register soft-reboot primitive (0xFF000002).Motivation and Context
Currently, once a ROM is launched from the menu, the only way to return is to physically press the console's reset button or power cycle. This is inconvenient for users who want to quickly switch games or return to the menu without leaving their seat. IGR solves this by allowing a controller-based soft reboot back to the flashcart menu.
This implementation leverages the existing cheat engine infrastructure (IPL3 patching, exception vector hooking at
0x80000180, and engine code placement at0x80700000+) to inject the IGR payload, avoiding the need for a separate patching mechanism.How Has This Been Tested?
make sc64after settingN64_INST.sc64menu.n64output includes the new igr.c object.$k0,$k1) to ensure they are safe within the exception handler context.cheats_install()correctly falls back toDEFAULT_ENGINE_ADDRESSwhencheat_listis NULL but IGR is enabled (via the upstream fix applied to cheats.c).0xBFC007C4/0xBFC007C5) are based on standard libultraOSContPadlayout and may require adjustment after hardware validation.Testing environment:
Screenshots
N/A — no visual UI changes beyond the settings toggle.
Types of changes
Checklist:
You agree with the license terms and that other license types may be granted with permission of the original
N64FlashcartMenuproject license holders.Signed-off-by: mrj1m0thy mrj1m0thy4@gmail.com