Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
36bf354
Use checked kernel synchronization for network clock availability
RobiiAragon Nov 2, 2026
b16c01c
The geometry hazard fixture releases its program and checks readback …
RobiiAragon Nov 2, 2026
4866c59
Add opt-in native LAN sockets and an LDN IP bridge
RobiiAragon Nov 1, 2026
a17f642
Run notification handoff regression with normal thread ownership
RobiiAragon Nov 1, 2026
86f108b
Declare local network privacy usage for iOS peers
RobiiAragon Nov 1, 2026
f127b25
Make local discovery route fixtures independent of queue coalescing
RobiiAragon Nov 1, 2026
d5bb6b3
The geometry hazard fixture releases its program and checks readback …
RobiiAragon Nov 2, 2026
68e649c
Socket receives prepare the remaining tracked destination before ever…
RobiiAragon Nov 2, 2026
c2b1792
Socket option results prepare their validated guest destination befor…
RobiiAragon Nov 2, 2026
e70f1c8
Implement bounded cancellable IPv4 resolver operations
RobiiAragon Nov 2, 2026
d20190d
Implement bounded cancellable IPv4 resolver operations
RobiiAragon Nov 2, 2026
418429e
Implement strict native Apple client TLS and scoped private PKI
RobiiAragon Nov 2, 2026
c8d26e6
Apply explicit online service policy and NSD to both resolver paths
RobiiAragon Nov 2, 2026
bcdc88f
Expose an explicit credential provider with native account and social…
RobiiAragon Nov 2, 2026
2f5cb73
Refresh optional BCAT calendars before the first guest read
RobiiAragon Nov 2, 2026
fa94ece
Use checked kernel synchronization for network clock availability
RobiiAragon Nov 2, 2026
8df143a
Keep synthetic service fixtures defined on allocation and file failures
RobiiAragon Nov 2, 2026
f67f405
Clarify historical connection evidence and preserve the executable bu…
RobiiAragon Nov 2, 2026
da1e698
Synthetic service fixtures link the tracked-write dispatcher delibera…
RobiiAragon Nov 2, 2026
00ce750
Merge current nxnative main and retain geometry fixture lifetime checks
RobiiAragon Nov 3, 2026
d04db60
Merge current nxnative while preserving local-network transports
RobiiAragon Nov 4, 2026
22f5c6f
Merge refreshed LAN and LDN dependency into cancellable resolver
RobiiAragon Nov 4, 2026
7831908
Merge current nxnative and retain geometry fixture cleanup
RobiiAragon Nov 4, 2026
0e97369
Merge commit '22f5c6f4c9459eb104deb72ae22465b327c01150' into codex/up…
RobiiAragon Nov 4, 2026
6410984
Merge commit '78319086bf7baf331c7bbbc73342a63250b01dee' into codex/up…
RobiiAragon Nov 4, 2026
1c13cb2
Merge commit '36bf354344bb8ed0f06afe78ebccd0b56be4712e' into codex/up…
RobiiAragon Nov 4, 2026
52aa059
Merge commit '75e5ddd8046dc70f740780a14d336dc2f2cf1d7b' into codex/up…
RobiiAragon Nov 4, 2026
bed8796
Refresh local-network contribution onto current nxnative
RobiiAragon Nov 4, 2026
5ee105f
Merge commit 'eae1d0a0290c5cff5f99ec5d177495baede8f031' into codex/up…
RobiiAragon Nov 4, 2026
8da036e
Refresh cancellable resolver on corrected LAN dependency
RobiiAragon Nov 4, 2026
e216f19
Refresh optional online backend from corrected LAN dependency
RobiiAragon Nov 4, 2026
5f9cf0f
Record refreshed cancellable resolver dependency
RobiiAragon Nov 4, 2026
2a32db0
Record refreshed standalone network-clock dependency
RobiiAragon Nov 4, 2026
acaa673
Clarify inherited Python type contracts for pinned CI
RobiiAragon Nov 4, 2026
63fffb9
Port the inherited RED_ONCE key-capacity correction
RobiiAragon Nov 4, 2026
2cf9c00
Merge commit '63fffb940cdb752c7895cd8e3d1548be15b8f85b' into codex/up…
RobiiAragon Nov 4, 2026
8f03fe1
Merge commit '2cf9c007684ef555c10471ba1fc3d3a3700e2022' into codex/up…
RobiiAragon Nov 4, 2026
4c7e43f
Merge current upstream main to resolve inherited typing conflicts
RobiiAragon Nov 4, 2026
b8e2595
Serve gRPC's name lookup and RecvMsg/SendMsg in a network mode
eyasbzour Nov 12, 2026
aa03bca
Set the game's own errno on a failed socket call; RecvMsg/SendMsg edg…
eyasbzour Nov 13, 2026
8aace78
Merge seedds/main into socket-grpc-resolver-msg
eyasbzour Nov 13, 2026
51c46ec
docs/agents/symptoms.md: regenerated for the stale-errno entry (dm/to…
eyasbzour Nov 13, 2026
f1afbb8
host(net): EventFd in a network mode is a slot of the transport's soc…
eyasbzour Nov 10, 2026
8a36c15
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 13, 2026
e3fa880
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 13, 2026
e6d91b7
The merged branch builds its checks: BCAT titles from the build, test…
eyasbzour Nov 13, 2026
ae3a5f0
iOS online: tell the game the adapter the internet route uses, not th…
eyasbzour Nov 13, 2026
7a22856
t_oe_handoff links again: stubs for what main's hle_oe.c now calls
eyasbzour Nov 13, 2026
64bd483
t_nextendo_account: the SDK builds the AsyncContext, as the merged hl…
eyasbzour Nov 13, 2026
23da95d
t_save_sync: the cloud's device is this machine's model, a virtual Ma…
eyasbzour Nov 13, 2026
9b0ae7b
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 13, 2026
67e62a1
Nextendo online: sign-in, signed game patches, service profile and la…
eyasbzour Nov 13, 2026
7f9e873
Nextendo mode: keep a closed UDP port briefly; ICMP reports on UDP re…
eyasbzour Nov 13, 2026
7ab7b40
services.md: the sign-in is MIT with a build-time client ID; Wonder o…
eyasbzour Nov 13, 2026
fc73a5a
Nextendo mode UDP: a bind to a parked port binds the game's new socke…
eyasbzour Nov 13, 2026
72fe137
Nextendo sign-in and account: review fixes
eyasbzour Nov 13, 2026
cd11b50
t_pollwait: a 60 s hang guard, and each PASS line unbuffered
eyasbzour Nov 14, 2026
c1f67b5
Nextendo profile: pin the NEX server's self-signed certificate
eyasbzour Nov 14, 2026
17ad015
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 14, 2026
931bc84
t_mii_sysdata: define the BCAT provider hle_fs.c weak-imports, as t_f…
eyasbzour Nov 14, 2026
de960fd
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 14, 2026
3798ea9
env_switches: DM_EXFAT_DIR, the exFAT folder test_shader_cache.py rea…
eyasbzour Nov 14, 2026
3c7b6af
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 14, 2026
c5188fc
nextendo: ask Nextendo why it refuses online play, and call the accou…
eyasbzour Nov 14, 2026
22bfea8
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 14, 2026
407d44c
nextendo: the account's play time, Mii and activity
eyasbzour Nov 14, 2026
7a51a14
symptoms.md: regenerated with dm/tools/docs_symptoms.py
eyasbzour Nov 14, 2026
eb3bdbf
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 14, 2026
6f7ff68
nextendo: judge and stamp token times by Nextendo's clock
eyasbzour Nov 14, 2026
3df926e
hle_thread: a host thread's native wait before the guest threads exis…
eyasbzour Nov 14, 2026
1dd8f85
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 14, 2026
89034fa
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 14, 2026
e1bb015
t_oe_handoff: stub dm_gfx_quit_begin, which hle_oe.c calls since seed…
eyasbzour Nov 14, 2026
c829a30
Merge seedds main: the offline local UDP socket service beside the ne…
eyasbzour Nov 14, 2026
6b1c401
Merge follow-up: the PR's offline ENETDOWN and endless idle wait, whi…
eyasbzour Nov 14, 2026
3537bfd
hle_net.c: sk_idle's EINVAL is a literal, as it comes before the serv…
eyasbzour Nov 14, 2026
8f4aebb
Merge seedds main: one object per host source, with the pinned libcry…
eyasbzour Nov 14, 2026
4fb1604
Nextendo presence: publish returns once queued; one HTTPS session for…
eyasbzour Nov 14, 2026
6d4b371
net: watch UDP sockets for a peer that goes quiet, and log each host …
eyasbzour Nov 14, 2026
4e7a2c8
Nextendo play time starts with the first credential too, and logs eve…
eyasbzour Nov 14, 2026
1d3da23
Nextendo account API: each route gets the token Nextendo takes there
eyasbzour Nov 14, 2026
93ab527
Nextendo account API: the tokens nextendo.network takes per route, as…
eyasbzour Nov 14, 2026
8cf0713
Nextendo patches: a patch in another format for another game no longe…
eyasbzour Nov 14, 2026
562541f
Nextendo: no play time is sent; Nextendo closed history writes to thi…
eyasbzour Nov 15, 2026
de88256
Nextendo: /api/profile needs the profil scope, which the sign-in does…
eyasbzour Nov 15, 2026
474e288
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 15, 2026
40b286e
Merge fix: takeover entries fill seedds's new alias field
eyasbzour Nov 15, 2026
a3a25c9
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 15, 2026
b6d5748
Merge fix: the prepo Send entry fills the alias field; DM_OBSOLETE ge…
eyasbzour Nov 15, 2026
0a12c85
Merge fix: CI no longer lists the removed t_rt_depth_ro; t_condvar pa…
eyasbzour Nov 15, 2026
6cd1634
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 15, 2026
a5a4c9c
nextendo: the sign-in asks for the profil scope, so /api/profile can …
eyasbzour Nov 15, 2026
47b5e33
Merge fix: t_dlss_scaler passes no bias mask, the argument seedds's 2…
eyasbzour Nov 15, 2026
830a660
Merge seedds main: multi-user local accounts, offline friends presenc…
eyasbzour Nov 19, 2026
ca05f6f
account: the Nextendo account is the active user's, the first user th…
eyasbzour Nov 19, 2026
18fc76d
clang-tidy: check the fixed endpoint URLs, copy a checked birthday, n…
eyasbzour Nov 19, 2026
c3f3039
Merge remote-tracking branch 'seedds/main' into socket-grpc-resolver-msg
eyasbzour Nov 19, 2026
a98c36e
tests: t_server_environment links t_net_off.c, the network transport …
eyasbzour Nov 20, 2026
dd92d4a
t_friends: the wait gate's entry stub links, and the Uid key check ca…
eyasbzour Nov 20, 2026
b6461b1
tests: t_bcat_fs links hle_account_users.c, which hle_fs.c asks wheth…
eyasbzour Nov 20, 2026
c0f8669
Merge seedds/main into socket-grpc-resolver-msg
eyasbzour Nov 21, 2026
12ccf49
Merge seedds/main into socket-grpc-resolver-msg
eyasbzour Nov 23, 2026
e07f78c
packing/nextendo: fetch the pinned CA through the raw API
sofianbll Nov 23, 2026
fbdf44d
packing/nextendo: use the shared ZBIC module loader
sofianbll Nov 23, 2026
206e093
nextendo/sign-in: bound request time and reply size
sofianbll Nov 23, 2026
8a73bad
host/ssl: identify scoped CA verification failures
sofianbll Nov 23, 2026
a51a270
Merge pull request #6 from sofianbll/patch2589/ca-source
eyasbzour Nov 24, 2026
3fe7d89
Merge pull request #7 from sofianbll/patch2589/zbic
eyasbzour Nov 24, 2026
994ec29
Merge pull request #8 from sofianbll/patch2589/signin-deadline
eyasbzour Nov 24, 2026
844cc04
Merge pull request #9 from sofianbll/patch2589/tls-trace
eyasbzour Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Prepare pinned Apple cryptography for offline service fixtures
run: echo "DM_OPENSSL_ROOT=$(python3 dm/tools/apple_crypto.py macos)" >> "$GITHUB_ENV"
- name: Host unit tests (dm/host/tests)
run: |
mkdir -p logs
make -C dm/host/tests GAME="$GAME" -j3 run 2>&1 | tee logs/host-tests.log
- name: Calendar policy, archive, SDK and startup fixtures
run: make -C dm/host/tests GAME="$GAME" bcat 2>&1 | tee logs/bcat.log
- name: Native TLS with bounded numeric tracing
run: DM_SSL_TRACE=1 make -C dm/host/tests GAME="$GAME" ssl 2>&1 | tee logs/tls-trace.log
- name: ThreadSanitizer (audio, HID and guest memory)
run: |
make -C dm/host/tests GAME="$GAME" -j3 tsan memory-tsan 2>&1 | tee logs/tsan.log
Expand Down Expand Up @@ -92,6 +98,8 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Prepare pinned Apple cryptography for offline service fixtures
run: echo "DM_OPENSSL_ROOT=$(python3 dm/tools/apple_crypto.py macos)" >> "$GITHUB_ENV"
- name: Registration sections (all producers, ASan and UBSan, no global ignorelist)
run: |
mkdir -p logs
Expand All @@ -100,6 +108,11 @@ jobs:
run: |
mkdir -p logs
make -C dm/host/tests GAME="$GAME" -j3 asan 2>&1 | tee logs/host-asan.log
- name: ASan and UBSan, calendar startup and native service fixtures
run: |
make -C dm/host/tests GAME="$GAME" B=build/bcat-asan SAN="-fsanitize=address,undefined -fno-omit-frame-pointer" bcat 2>&1 | tee logs/bcat-asan.log
make -C dm/host/tests GAME="$GAME" ssl-sanitize nextendo-routes-sanitize nextendo-x509-sanitize nsd-sanitize nextendo-account-sanitize nextendo-api-sanitize nextendo-social-sanitize online-policy-sanitize 2>&1 | tee logs/services-asan.log
DM_SSL_TRACE=1 make -C dm/host/tests GAME="$GAME" ssl-sanitize 2>&1 | tee logs/tls-trace-asan.log
- name: ASan and UBSan, CPU texture layout and deswizzle test (dm/gfx/tex/tests)
run: make -C dm/gfx/tex/tests asan 2>&1 | tee logs/texture-asan.log
- name: ThreadSanitizer, the host tests that start threads (dm/host/tests)
Expand Down
1 change: 1 addition & 0 deletions dm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
host/dmhost
host/nextendo_login
host/dmhost_*
host/*.dSYM/
*.bin
Expand Down
8 changes: 8 additions & 0 deletions dm/games/010015100B514000/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ Game-specific findings; the general host changes they led to are listed under [F
- Focus handling mode 2 (focus notifications are sent). Mario never throws C++ exceptions.
- Ghidra: `main` (28 MB) took about 35 minutes to analyse, 138k functions.

### Online play (Nextendo), 1.2.1

- Online calls go through `nn::npln` over gRPC (a 1.3x build with xDS, linked into `main` with its own OpenSSL, `nnsdk_LoadBuiltinCerts.cpp`). gRPC does its own TLS over the C socket interface (`RecvMsg` / `SendMsg`); the `nn::ssl` connection calls `main` imports are libcurl's (`main+0xf79a98`..`0xf7a1e4`), so the host's `nn::ssl` peer policy never sees gRPC's connections.
- gRPC takes its roots from the firmware's certificate store: `ComputePemRootCerts` (`main+0xafa5b4`) reads `GRPC_DEFAULT_SSL_ROOTS_FILE_PATH`, then the store one ID at a time (`main+0xafaf50`: 1, 2, 0x3e8, 0x3f3, 0x3f4, 0x3f5, 0x409, stopping at the first failure), then `/usr/share/grpc/roots.pem`. With no root it builds no TLS factory (`main+0xaf6ca8`, `main+0xaf9010`), so no subchannel and no socket: the call fails as UNAVAILABLE, error 2321-4992. In Nextendo mode the player needs nothing for it: with no store on the device, the host answers each ID with Nextendo's own CA, the one the build's service profile carries and checks by SHA-256 (`hle_nextendo_routes.c` `provider_ca`, `hle_ssl_apple.m` `select_builtin`). A store from the player's own firmware (`ssl_TrustedCerts.bdf` in `<DM_SYSTEM_DIR>/sysdata/0100000000000800/` or `<DM_SYSTEM_DATA_DIR>/0100000000000800/files/`) is used instead when present. The host logs which it used and every built-in request.
- Nextendo's signed patch (`wonder-npln-ff773e90`, three instructions) makes gRPC install its accept-any verify callback (`main+0xb03528`) and skips two peer-name checks (`main+0xb02aa4`, `main+0xb02bbc`), so gRPC does not check Nextendo's server certificate; the roots are still required to build the factory.
- gRPC's logging is compiled out (`GRPC_TRACE` and `GRPC_VERBOSITY` print nothing). `patches.py` puts an observation gate on `grpc_error_create` (`main+0xb57b40`), and the host logs each internal error's source file, line and text once (`hle_grpc.c`).
- Proxy: gRPC's mapper (`main+0xb31760`) and libcurl's (`main+0xf7aa40`) both take a failed `nifm::GetCurrentProxySetting` as no proxy.

## Mac routes

- `DM_KEYS="12:A,14:A,20:A,26:A,32:A"` reaches the opening course.
Expand Down
16 changes: 16 additions & 0 deletions dm/games/010015100B514000/patches.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Super Mario Bros. Wonder (010015100B514000): the rewriter's patches of this game's own builds. dm/tools/patch_nso.py loads every profile's patches.py and applies those of a module's
# NSO build ID; CUTS, OBS and FRAME_STEP as described there ("Registered patches"). Patches of Nintendo SDK module builds are in dm/tools/sdk_patches.py
# The gate number is dm/host/dm.h's OBS_GRPC_ERROR (27), written as a number as patch_nso.py writes its own (a table name is the only upper-case name a patches.py may have)
OBS = {
# 1.2.1 (v327680) main, also Nextendo's signed patch of it (an IPS of three instructions in gRPC's TLS code that keeps the build ID): gRPC's grpc_error_create
# (const char *file, int line, const grpc_slice &desc, ...), called from 509 sites. Nintendo's gRPC has its logging compiled out, so an online call that fails before
# its first socket (2321-4992, UNAVAILABLE) leaves no line; the host logs each error's source file, line and text once (dm/host/hle_grpc.c). The entry instruction is
# sub sp, sp, #0x60
'ff773e90972d544eb79406eaa65396d5': [(0xb57b40, 27, 'd10183ff', "gRPC's grpc_error_create entry: the source file, line and text of each internal error (hle_grpc.c)")],
}
BINDING = [
{'what': "gRPC's internal errors logged (grpc_error_create observation gate)", 'now': 'build', 'goal': 'engine', 'purpose': 'runtime',
'kept': 'a read-only diagnostic for bringing up online play on one build; a gRPC-wide locator (a fingerprint of grpc_error_create) is worth it only when another game needs it',
'why': "gRPC is middleware: its grpc_error_create could be found by a fingerprint in any game that links the same gRPC; it is placed by offset in the one build "
"brought up online so far"},
]
4 changes: 4 additions & 0 deletions dm/games/0100152000022000/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ General host changes first needed here; each applies to every game:
## Open

- Mii heads draw nothing unless the player supplies their console's MiiModel archive (`0100000000000802`) under `DM_SYSTEM_DIR` ([A console's own Mii database and system data](../../../docs/reference/services.md#a-consoles-own-mii-database-and-system-data)); not run with one, as no console files are on hand.

### Native local-network contribution

I tested LAN and LDN play across native Mac/iOS ports and a physical Switch on 2026-10-31, using 3.0.5 in my originating fork. My modified console used a compatible LDN module; this does not establish stock radio LDN. The rebased backend and local identity/resource requirements are documented under [native LAN and LDN](../../../docs/reference/services.md#opt-in-native-lan-sockets-and-ldn-over-ip). Automated fixtures are separate from a fresh hardware game qualification of this upstream branch.
1 change: 1 addition & 0 deletions dm/games/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def shown(cond, n):
if cond.startswith('fixups:'): return cond[7:] in keys
if cond.startswith('gfxapi:'): return os.environ.get('GFXAPI', '') == cond[7:]
if cond.startswith('platform:'): return platform == cond[9:]
if cond.startswith('build:'): return os.environ.get(cond[6:], '') not in ('', '0', 'NO') # an IPA build's switch (build_ipa.sh DM_NEXTENDO)
m = re.fullmatch(r'(DM_GAME_\w+)(!=|==)(.*)', cond)
if m: return (macro(m[1], n) == m[3]) == (m[2] == '==')
sys.exit(f'settings.tsv:{n}: unknown condition {cond}')
Expand Down
3 changes: 2 additions & 1 deletion dm/games/settings.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# <ios>|<mac> selects the platform's default before resolving a profile macro or build variable
# shown always; DM_GAME_<NAME>!=<value> or ==<value>; fixups:<KEY>: main's rewriter table has that key (a stub in the game's build, patch_nso.py); languages>1 (more than one to pick, so also when the control data lists none); gfxapi:<API>: the packer's GFXAPI;
# mac-mic: a Mac app whose modules import the supported polling InputStream API;
# platform:<ios | mac>: the app's platform (SETTINGS_PLATFORM, ios when unset), for a switch only that platform's front end reads
# platform:<ios | mac>: the app's platform (SETTINGS_PLATFORM, ios when unset), for a switch only that platform's front end reads; build:<VAR>: the IPA build's switch <VAR> is on (set, not 0 or NO)
# section Game, Controls or Performance: a heading on the single settings screen. Rows appear in table order within each section
# Reset to tested defaults clears all launcher choices; values fixed by an env file stay
# label, note the setting's name and the line under it (may be empty; only for a setting with a cost: latency, memory, heat)
Expand All @@ -26,6 +26,7 @@ DM_FULLSCREEN choice 0=Window,1=Fullscreen 0 platform:mac Game Display mode lev
DM_PICTURE_FIT choice fit=Fit,fill=Fill fit platform:ios Game Picture Fill crops the game's 16:9 picture to cover the screen. Health bars, subtitles or maps near the edges can be cut off. A full-screen picture without cropping needs a patch for each game.
DM_ROTATION choice auto=Automatic,landscape=Landscape,portrait=Portrait auto platform:ios Game Rotation
DM_SHOW_FPS toggle - build:DM_SHOW_FPS platform:ios Game Frame-rate counter
DM_NETWORK choice offline=Offline,lan=LAN,ldn=Local wireless,nextendo=Nextendo (online)?build:DM_NEXTENDO build:DM_NETWORK always Game Network LAN and Local wireless play with devices on the same Wi-Fi network. Nextendo plays online through Nextendo, a community service, once you sign in under Online.
DM_TOUCH_HAPTICS toggle - 1 platform:ios Controls Touch feedback
DM_RUMBLE toggle - 1 always Controls Game rumble level=basic
DM_RUMBLE_GAIN range 0:3:0.1 1.0 always Controls Rumble strength needs=DM_RUMBLE=1
Expand Down
26 changes: 18 additions & 8 deletions dm/host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ include ../mac/min_os.mk
# -O2 as the other native code here (libvpx, dav1d, the launcher; the iOS host builds at Xcode Release's -Os). Not -O3 (no measured gain over -O2) and not -flto, which moves
# hle_bigstack.c's inline-assembly entry apart from its return path (SIGBUS in dm_bigstack_enter on Breath of the Wild, PR #556)
CFLAGS=-O2 -g -Wall -Wno-unused-function -mmacosx-version-min=$(MACOS_MIN)
# Static, source-hash-pinned libcrypto for explicit private-PKI verification.
# Metadata targets do not build it; Apple targets select their own SDK archive.
DM_OPENSSL_ROOT ?= $(shell python3 ../tools/apple_crypto.py $(if $(filter iphoneos,$(MSL_SDK)),ios,macos))
PRIVATE_PKI_FLAGS = -DDM_OPENSSL_X509 "-I$(DM_OPENSSL_ROOT)/include"
PRIVATE_PKI_LIB = "$(DM_OPENSSL_ROOT)/lib/libcrypto.a"
# One job per core unless the command line sets -j: the host and the libraries below build one object per source (GNU make 3.81, the system's, takes -j from MAKEFLAGS set here)
ifeq ($(filter -j%,$(MAKEFLAGS)),)
MAKEFLAGS += -j$(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 4)
endif
# Service-layer takeover hle_*.c files are included by wildcard: adding a file does not touch this line (avoids merge conflicts)
SRC=main.c loader.c hle.c crash.c probe.c thread.c save_sync.c memstat.m haptics_apple.m audio_input.c audio_input_mac.m audio_input_dualsense_mac.m dualsense_mic_mac.c pad_switch2_apple.m $(sort $(wildcard hle_*.c)) front_mac.m web_apple.m entry.S
# Service-layer takeover hle_*.c/hle_*.m files are included by wildcard: adding a file does not touch this line (avoids merge conflicts)
SRC=main.c loader.c hle.c crash.c probe.c thread.c save_sync.c memstat.m haptics_apple.m audio_input.c audio_input_mac.m audio_input_dualsense_mac.m dualsense_mic_mac.c pad_switch2_apple.m $(sort $(wildcard hle_*.c hle_*.m)) front_mac.m web_apple.m entry.S
# NVN null device + nn::vi + the Vulkan layer (dm/gfx/)
# Sources under dm/gfx, dm/gfx/nvn, dm/gfx/tex, dm/gfx/vk and dm/gfx/gl are included by wildcard (tests/ and metal/ do not go into the host): adding a file does not touch this line
GFX=$(sort $(wildcard ../gfx/*.c ../gfx/nvn/*.c ../gfx/nvn/*.m ../gfx/nvn/*.S ../gfx/tex/*.c ../gfx/tex/*.m ../gfx/vk/*.m ../gfx/gl/*.m))
Expand Down Expand Up @@ -70,30 +75,35 @@ game_profile: $(GAME_H)
$(GAME_H): $(GAME_DIR)/game.tsv ../games/game.py FORCE
@"$(PYTHON)" ../games/game.py header $(GAME) $@
.PHONY: FORCE
# The Mac Nextendo sign-in tool: make -C dm/host nextendo_login, then dm/host/nextendo_login sign-in (status, sign-out). dmhost reads the sign-in it keeps
# (hle_nextendo_login_apple.m, nextendo_login_apple.inc)
nextendo_login: ../tools/nextendo_login.m nextendo_login_apple.inc
clang -O1 -g -fobjc-arc -Wall -Wextra -mmacosx-version-min=$(MACOS_MIN) -o $@ ../tools/nextendo_login.m -framework Foundation -framework Security -framework AppKit
FORCE:
# The host: one object per source in gen/<id>/obj (dm.h includes the profile header, so every game has its own), compiled on every core, then linked into gen/<id>/dmhost with
# the same flags (as clang's one-step compile and link gives each of its jobs the whole line) and its dSYM made from the objects, as clang does after its own link. Each object
# lists the headers its source read (-MMD; -MP: a removed header is no error), so an edit rebuilds the objects that include it and the link; the Makefile (CFLAGS, these lines)
# rebuilds them all. The generated headers come first (order-only: the dependency files name them for the sources that read them). The NSP script builds gen/<id>/dmhost and takes it
HOST_CFLAGS = $(CFLAGS) -I../gfx/nvn/include -I$(dir $(MSL_H)) -I../third_party/vulkan-headers/include -I$(dir $(GAME_H)) -I$(VPX) -I$(DAV1D)/include -I../third_party/stb_vorbis -fobjc-arc
HOST_FRAMEWORKS = -framework Cocoa -framework WebKit -framework UserNotifications -framework QuartzCore -framework Metal -framework MetalFX -framework GameController -framework CoreBluetooth -framework IOBluetooth -framework CoreHaptics -framework IOKit -framework IOUSBHost -framework AudioToolbox -framework CoreAudio -framework AVFAudio -framework CoreFoundation -framework CoreGraphics -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework ImageIO -framework UniformTypeIdentifiers
HOST_CFLAGS = $(CFLAGS) $(PRIVATE_PKI_FLAGS) -I../gfx/nvn/include -I$(dir $(MSL_H)) -I../third_party/vulkan-headers/include -I$(dir $(GAME_H)) -I$(VPX) -I$(DAV1D)/include -I../third_party/stb_vorbis -fobjc-arc
HOST_FRAMEWORKS = -framework Security -framework Cocoa -framework WebKit -framework UserNotifications -framework QuartzCore -framework Metal -framework MetalFX -framework GameController -framework CoreBluetooth -framework IOBluetooth -framework CoreHaptics -framework IOKit -framework IOUSBHost -framework AudioToolbox -framework CoreAudio -framework AVFAudio -framework CoreFoundation -framework CoreGraphics -framework VideoToolbox -framework CoreMedia -framework CoreVideo -framework ImageIO -framework UniformTypeIdentifiers
HOST_SRC = $(SRC) $(GFX)
ifneq ($(filter ../%,$(filter-out ../gfx/%,$(HOST_SRC))),)
$(error host sources outside dm/host and dm/gfx need an object rule: $(filter ../%,$(filter-out ../gfx/%,$(HOST_SRC))))
endif
OBJ_DIR = gen/$(GAME)/obj
HOST_OBJ = $(foreach s,$(HOST_SRC),$(if $(filter ../gfx/%,$(s)),$(OBJ_DIR)/gfx/$(s:../gfx/%=%).o,$(OBJ_DIR)/host/$(s).o)) # the line's order: the link lays code out in it
HOST_BIN = gen/$(GAME)/dmhost
$(OBJ_DIR)/host/%.o: % Makefile ../mac/min_os.mk | $(GAME_H) $(MSL_H)
$(OBJ_DIR)/host/%.o: % Makefile ../mac/min_os.mk ../tools/apple_crypto.py | $(GAME_H) $(MSL_H)
@mkdir -p $(dir $@)
clang $(HOST_CFLAGS) -MMD -MP -c $< -o $@
$(OBJ_DIR)/gfx/%.o: ../gfx/% Makefile ../mac/min_os.mk | $(GAME_H) $(MSL_H)
$(OBJ_DIR)/gfx/%.o: ../gfx/% Makefile ../mac/min_os.mk ../tools/apple_crypto.py | $(GAME_H) $(MSL_H)
@mkdir -p $(dir $@)
clang $(HOST_CFLAGS) -MMD -MP -c $< -o $@
$(HOST_BIN): $(HOST_OBJ) $(VPX_LIB) $(DAV1D_LIB) Makefile ../mac/min_os.mk
clang $(HOST_CFLAGS) -o $@ $(HOST_OBJ) $(VPX_LIB) $(DAV1D_LIB) $(HOST_FRAMEWORKS)
$(HOST_BIN): $(HOST_OBJ) $(VPX_LIB) $(DAV1D_LIB) Makefile ../mac/min_os.mk ../tools/apple_crypto.py
clang $(HOST_CFLAGS) -o $@ $(HOST_OBJ) $(VPX_LIB) $(DAV1D_LIB) $(PRIVATE_PKI_LIB) -lz $(HOST_FRAMEWORKS)
./$@ --check-tables || { rm -f $@; exit 1; }
dsymutil $@
./$@ --validate-hle
ifneq ($(strip $(GAME)),)
-include $(HOST_OBJ:.o=.d)
endif
Expand Down
4 changes: 4 additions & 0 deletions dm/host/account_local.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once
int dm_account_uid_exists(const void *uid);
// Copy the actual local UID; this grants no provider identity.
int dm_account_copy_uid(void *output);
23 changes: 23 additions & 0 deletions dm/host/discovery_protocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Original framing recognizer for verified discovery queries, never game data.
// PiaLan facts were checked in the SDK's serializer; LDN uses the public wire.
#pragma once
#include <stdint.h>
#include <stddef.h>
#include <string.h>
enum { DM_DISCOVERY_PIA=1, DM_DISCOVERY_LDN=2 };
static inline unsigned dm_discovery_query_protocol(unsigned port,const void *bytes,size_t size) {
if(!bytes)return 0;
const uint8_t *p=bytes;
if(port==30000) {
if(size<0x12f||size>1364||p[0])return 0;
uint32_t payload=(uint32_t)p[1]<<24|(uint32_t)p[2]<<16|(uint32_t)p[3]<<8|p[4];
if(payload>1364-0x12f||size!=payload+0x12f||p[payload+5]!=1||p[payload+6]>1)return 0;
unsigned nonce=0;for(unsigned i=0;i<8;++i)nonce|=p[payload+7+i];
return nonce?DM_DISCOVERY_PIA:0;
}
if(port==11452) {
static const uint8_t query[12]={0,0x14,0x45,0x11};
return size==sizeof query&&!memcmp(p,query,sizeof query)?DM_DISCOVERY_LDN:0;
}
return 0;
}
3 changes: 2 additions & 1 deletion dm/host/dm.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ enum { OBS_UE_MALLOC = 21, // Unreal's FMa
OBS_REGION_ASK = 22, OBS_REGION_GOT = 23, OBS_REGION_FREE = 24, // the SDK's address regions, gates the rewriter places by symbol in every sdk (patch_nso.py "Address regions", hle_svc.c)
OBS_STDALLOC_INIT = 25, // StandardAllocator::Initialize's entry, the same way: its callback writes the size (hle_svc.c)
OBS_UE_REGION = 26, // the store of Unreal's engine region size before nninitStartup reserves it: the register its upper bits name (dm/tools/ue_region.py, hle_svc.c)
OBS_MAX = 27 };
OBS_GRPC_ERROR = 27, // gRPC's grpc_error_create entry (a profile's patches.py, Super Mario Bros. Wonder): source file, line and text of each internal error (hle_grpc.c)
OBS_MAX = 28 };
// A gate number's bits from 8 up are a parameter for its callback (OBS_REGION_GOT: the register that holds the address). Callbacks read the registers; a write to x0–x29 takes
// effect when the gate returns (entry.S restores them from the frame), which OBS_STDALLOC_INIT and OBS_UE_REGION do
void gate_obs_set(int id, void (*fn)(uint64_t *regs, int param));
Expand Down
Loading