Skip to content

Mac: Atmosphère cheats in the host and the settings window - #736

Closed
joaquinsandoval2307 wants to merge 1 commit into
seedds:mainfrom
joaquinsandoval2307:mac-cheats
Closed

joaquinsandoval2307 wants to merge 1 commit into
seedds:mainfrom
joaquinsandoval2307:mac-cheats

Conversation

@joaquinsandoval2307

Copy link
Copy Markdown
Contributor

What and why

Atmosphère cheats for Mac apps, as on a console running Atmosphère.

  • hle_cheat.c (new): a cheat VM.
    • It runs dmnt's opcodes, the format the switch-cheats-db collections use, for the file DM_CHEATS names.
    • {Name} master codes always run. The [Name] cheats that DM_CHEATS_ON picks run about 60 times a second on a host thread.
    • It reads and writes through vm_read_overwrite / vm_write, so a stale pointer in a chain skips that tick instead of faulting.
    • Key conditions read player 1's held buttons.
  • Regions are numbered as dmnt's MemoryAccessType (hle_svc.c dm_guest_region_base).
    • There is also the host's own region 4, the newest NRO the game loaded (loader.c nro_newest_loaded).
    • It is for games whose code lives in an NRO, such as Super Mario 3D All-Stars' Super Mario Sunshine.
  • The Mac app:
    • The NSP script's --cheats / CHEATS picks the cheat file for the packed main build: a file, or a folder laid out as switch-cheats-db or holding <build ID>.txt.
    • pack_app.py --cheats puts it in the app.
    • The settings window gets a Cheats section with one toggle per cheat, kept as cheats.on. launcher.c hands the choice to the host.
  • Docs: docs/settings.md (Cheats), docs/development.md (packing example), docs/env_switches.tsv (DM_CHEATS, DM_CHEATS_ON, DM_CHEATS_DEBUG).

This came up in #733 as a separate proposal. If cheats do not belong in this repository, closing this PR is fine.

Checked

  • Tests:
    • make -C dm/host/tests GAME=010015100B514000 run passes.
    • All of dm/tools/tests passes, including test_env_switches.
    • The Mac launcher builds with the new section (pack_app.build_launcher).
  • Games run, with cheats from switch-cheats-db-style files for each main build:
    • Hollow Knight 1.5.12620: infinite health, and Geo 999999 shown in the HUD.
    • Super Mario 3D All-Stars' Super Mario Sunshine 1.1.4: 99 lives and 99 coins, through region 4.
    • Super Mario 64 1.1.4: 99 lives.
    • These runs were on the combined branch before it was split into separate PRs. This PR has the same cheat code.
  • Devices: Apple M2, macOS 26.6.2.
  • Not checked: iOS, which has no cheats UI. clang-tidy is not installed here.

Docs

  • Documented in docs/settings.md and docs/env_switches.tsv
  • No game files, keys, cheat files or data extracted from a game in the change or the attachments

🤖 Generated with Claude Code

…he settings window

- hle_cheat.c: an Atmosphère cheat VM (dmnt's opcodes, the format the switch-cheats-db collections use) for the file DM_CHEATS names. {Name} master codes
  always run, the [Name] cheats DM_CHEATS_ON picks (their positions among the entries with code) about 60 times a second on a host thread. Guest pointers
  are host pointers, read and written through vm_read_overwrite / vm_write so a stale pointer in a chain skips the tick instead of faulting. Key
  conditions read player 1's held buttons (hle_hid.c dm_input_buttons).
- Regions as dmnt's MemoryAccessType (hle_svc.c dm_guest_region_base: main, heap, alias, address space), plus the host's own region 4: the newest NRO the
  game loaded (loader.c nro_newest_loaded), for games whose code lives in an NRO (Super Mario 3D All-Stars' Super Mario Sunshine).
- The Mac app: the NSP script's --cheats / CHEATS picks the cheat file for the packed main build (a file, or a folder laid out as switch-cheats-db or
  holding <build ID>.txt), pack_app.py --cheats puts it in the app, the settings window lists one toggle per cheat (Cheats section, kept as cheats.on),
  and launcher.c hands the choice to the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joaquinsandoval2307

Copy link
Copy Markdown
Contributor Author

Closing in favour of the cheat engine merged in ef9f9bb (#406), which covers everything this PR did and more. Thanks!

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