test(victory-loader): pin seh::Context thread-state mapping and FXSAVE accessors #590

Open
AnastasisKon wants to merge 1 commit from upstream-pr/590 into main
AnastasisKon commented 2026-11-28 10:27:19 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T10:27:19Z.


What this changes

Pins seh::Context::set_from_thread_state and the FXSAVE accessors in crates/victory-loader/src/native/seh/context.rs with unit tests: gpr order (rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, r8-r15), rip, eflags truncation to u32, cs/fs/gs from the Mach state, ds/es/ss fixed to 0x2B, set_mxcsr writing mx_csr + LE bytes in flt[1][8..12], and xmm(i) = flt[10 + i]. No behaviour change. Refs #589

How it was tested

  • cargo test --target x86_64-apple-darwin -p victory-loader — 33 passed (4 new context tests), 0 failed, 8 consecutive clean runs under Rosetta (one unrelated one-off flake seen once in a native test, not reproducible)
  • cargo test -p victory-hle -p victory -p victory-gpu -p xtask (host arm64) — all ok
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — clean (RC=0)
  • cargo xtask policy — 404 files ok
  • Not needed (no game run; pure register mapping)

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — n/a, no behaviour change
  • New diagnostics are behind a VICTORY_* variable and documented — n/a, no new diagnostics
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5539180248 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/590). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T10:27:19Z. --- ## What this changes Pins `seh::Context::set_from_thread_state` and the FXSAVE accessors in `crates/victory-loader/src/native/seh/context.rs` with unit tests: gpr order (rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi, r8-r15), rip, eflags truncation to u32, cs/fs/gs from the Mach state, ds/es/ss fixed to 0x2B, `set_mxcsr` writing `mx_csr` + LE bytes in `flt[1][8..12]`, and `xmm(i)` = `flt[10 + i]`. No behaviour change. Refs #589 ## How it was tested - [x] `cargo test --target x86_64-apple-darwin -p victory-loader` — 33 passed (4 new context tests), 0 failed, 8 consecutive clean runs under Rosetta (one unrelated one-off flake seen once in a native test, not reproducible) - [x] `cargo test -p victory-hle -p victory -p victory-gpu -p xtask` (host arm64) — all ok - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — clean (RC=0) - [x] `cargo xtask policy` — 404 files ok - [x] Not needed (no game run; pure register mapping) ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — n/a, no behaviour change - [x] New diagnostics are behind a `VICTORY_*` variable and documented — n/a, no new diagnostics
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/590:upstream-pr/590'
git switch 'upstream-pr/590'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/590'
git switch 'upstream-pr/590'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/590'
git switch 'upstream-pr/590'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/590'
git switch 'main'
git merge --squash 'upstream-pr/590'
git switch 'main'
git merge --ff-only 'upstream-pr/590'
git switch 'main'
git merge 'upstream-pr/590'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS!590
No description provided.