Skip to content

Breath of the Wild: a Game memory slider on the Mac (Default, then 4 to 12 GB) - #2284

Open
dontpokethebear3893 wants to merge 3 commits into
seedds:mainfrom
dontpokethebear3893:upstream/botw-mac-memory-slider
Open

dontpokethebear3893 wants to merge 3 commits into
seedds:mainfrom
dontpokethebear3893:upstream/botw-mac-memory-slider

Conversation

@dontpokethebear3893

Copy link
Copy Markdown

What and why

Breath of the Wild's nninitStartup (main+0x710) asks for a fixed 3.05 GB heap, whatever the application pool. That is enough at the Switch's 1080p, but not for a larger picture: at 5K the game's own heap returned null for a 328 MB request.

This adds a Game memory slider to the Mac launcher (Performance). It starts at Default, the game's own size (3.2 GB), and goes up in steps of 2 GB to 12 GB. The build process is unchanged: no build option, no new profile key.

  • The game (patches.py): two stubs take the heap (main+0x71c) and the framework's root arena (main+0xc617c0) from the state page (+0x310 / +0x318), and keep the game's own sizes when the host writes 0. They declare the GAME_HEAP capability, which is what offers the slider.
  • The host:
    • hle_svc.c mem_sizes reads DM_MEMORY_GB when the game starts. A larger value replaces the profile's app_pool, and the address space reservation grows by the same amount, so the layout around the heap stays.
    • loader.c writes the heap (the pool less 512 MB for the modules) only when the player raised the pool.
    • The graphics layer's sparse-pool check reads the same pool.
    • At Default, on iOS, and for every other game, the sizes are the profile's as before.
  • The launcher:
    • settings.tsv has the row, shown with fixups:GAME_HEAP&platform:mac; settings.py now accepts & between conditions.
    • A range can carry unit (shown after the number instead of a percentage) and first (the label of its lowest value). The shared Swift model uses both, so the slider reads Default (3.2 GB), 4 GB … 12 GB.
  • Why 12 GB: at 16 GB the GPU locked up twice within 80 s and WindowServer, waiting on it, was restarted by the watchdog (below). 12 GB ran without errors.

Front ends

Front-ends: new: launcher.json ranges may carry unit and first (optional, schema 1; docs/frontends.md, docs/launcher.schema.json). A front end that does not know them shows the number as before.

Checked

  • Tests:

    • make -C dm/host/tests GAME=01007EF00011E000 run passes.
    • make -k -C dm/gfx/tests GAME=01007EF00011E000 run passes except check_t_dlss_scaler ("nothing else keeps them alive"), which fails the same way on main (01de04f).
    • dm/tools/tests test_launcher_settings (with a new check: the row on the Mac with the capability only, in GB, its first stop the game's own size) and test_nsp_mac_app pass.
  • The launcher's labels: the shared model (LauncherSettings.swift) compiled against the built app's launcher.json:

    • Game memory: Default (3.2 GB) | 4 GB | 6 GB | 8 GB | 10 GB | 12 GB.
    • Render scale: its percentages and pixel sizes, unchanged.
    • A saved 2.00 counts as the default, and a saved 16.00 is not accepted.
  • Games run: Breath of the Wild 1.9.0 (01007EF00011E000), from a save outdoors on the Great Plateau:

    • Default (fullscreen): the game's own heap, no [RED] lines.
    • 12 GB (in a window, about 90 s): the log reads application pool 12.00 GB and game heap 11.50 GB. The world loaded, 60 fps held, and there were no [RED] lines and no GPU errors.
    • 16 GB (fullscreen): a 15.50 GB heap. Then two failed Metal command buffers, and two gpuEvent reports (firmware-detected lockup, the game's process blamed) 80 s and 98 s in. WindowServer's main thread waited on the GPU for 40 s and the watchdog restarted it. The cause is not found, so the slider stops at 12.
  • Devices and OS: Apple M5 Max (48 GB), macOS 27.2.1.

  • Not checked: the 4–10 GB stops, a longer session at 12 GB, 12 GB in fullscreen, an output above 1080p with it (the Output resolution change is separate), Macs with less memory, and other games.

  • After the rebase on main (6a6a018):

    • make -C dm/host/tests GAME=01007EF00011E000 run, check_t_feedback and check_t_reorder_chain (dm/gfx/tests) pass.
    • dm/tools/tests passes: test_docs, test_patches, test_game_profile, test_env_switches, test_launcher_settings, test_settings, test_nsp_mac_app, test_fps_target, test_player_env, test_lint_c and test_gfx_tests_makefile. dm/ios/tests test_launcher_storage passes.
    • lint_python.py --against origin/main reports one new finding, dm/gfx/tools/dmsh_entry.py:7 (F401, an unused import). main itself reports the same one, and this change does not touch that file.
    • The measurements and game runs above were made before the rebase and were not repeated on it.

Docs

  • The finding is in its game note (dm/games/01007EF00011E000/README.md, Memory on the Mac), docs/settings.md (Game memory), the switch in docs/env_switches.tsv, and the new fields in docs/frontends.md and docs/launcher.schema.json; python3 dm/tools/docs_symptoms.py and docs_patches.py were run
  • A chain tool changed: n/a
  • No game files, keys or data extracted from a game in the change or the attachments

🤖 Generated with Claude Code

…fault then 4 to 12 GB)

The game's nninitStartup asks for a fixed 3.05 GB heap whatever the application pool. Two stubs (patches.py, main+0x71c and main+0xc617c0) take the heap and the root arena from the state page (+0x310 / +0x318) and declare the GAME_HEAP capability, which offers the Mac launcher's Game memory slider. The host reads DM_MEMORY_GB when the game starts (hle_svc.c mem_sizes): an application pool of that many GB in place of the profile's app_pool when larger, the reservation grown by as much; loader.c writes the heap (the pool less 512 MB) only when the player raised it. At Default, on iOS and for other games nothing changes. No build option or profile key.

The slider stops at 12 GB: at 16 GB on an M5 Max the GPU locked up twice within 80 s and WindowServer, waiting on it, was restarted by the watchdog; 12 GB ran without errors (one windowed run from a save outdoors, 11.5 GB heap).

Front-ends: new: launcher.json ranges may carry unit (shown after the number instead of a percentage) and first (the label of the lowest value); settings.tsv conditions may join conditions with &

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedkoniszewski and others added 2 commits November 12, 2026 15:30
Brings the branch up to date with main (fixes for the t_save_sync cloud
device check and the clang-tidy fixture findings, among others) and
resolves the conflicts with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 01007EF00011E000 The Legend of Zelda: Breath of the Wild host The Horizon host: SVCs, services, threads, memory (dm/host) ios The iPhone and iPad app (dm/ios) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) rewriter The NSO rewriter and per-build patches tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant