HLE: resolve ordinals on pseudo-module handles #512

Open
github-bot wants to merge 1 commit from github-bot/gh-512 into main AGit
Owner

@⁠Quat3rnion on GitHub · 2026-11-24 04:21 UTC · original
Quat3rnion:victory-module-ordinals → main · +31 −8 · 1 files · 1 commits · open

What

GetProcAddress refused every ordinal on one of our pseudo modules. Some
console APIs are exported only by ordinal — gameinput.dll registers
GameInputCreate as #1 — so a title that loaded the module and asked for
that ordinal got null even though the static import resolved. The registry
already stores ordinal exports under the name #n; the lookup now uses that
form. Unexported ordinals still return null.

An AI tool wrote part of this change.

Tested

  • Linux: cargo test --workspace: 165 passed, 0 failed, 3 ignored. A new regression loads the gameinput.dll pseudo module, resolves ordinal 1 to the registered address, and checks that ordinal 2 fails.
  • Windows cross-build: cargo check --target x86_64-pc-windows-gnu --workspace --tests passes. No Windows host here.
  • cargo xtask policy passes (150 files ok). No game files or data from them were added.

Checklist

  • Workspace tests and Windows cross-check pass.
  • cargo xtask policy passes. No game files or data from them were added.
  • AI authorship is disclosed above.
**@⁠Quat3rnion** on GitHub · 2026-11-24 04:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/512) `Quat3rnion:victory-module-ordinals` → `main` · +31 −8 · 1 files · 1 commits · open ## What `GetProcAddress` refused every ordinal on one of our pseudo modules. Some console APIs are exported only by ordinal — `gameinput.dll` registers `GameInputCreate` as `#1` — so a title that loaded the module and asked for that ordinal got null even though the static import resolved. The registry already stores ordinal exports under the name `#n`; the lookup now uses that form. Unexported ordinals still return null. An AI tool wrote part of this change. ## Tested - Linux: `cargo test --workspace`: 165 passed, 0 failed, 3 ignored. A new regression loads the `gameinput.dll` pseudo module, resolves ordinal 1 to the registered address, and checks that ordinal 2 fails. - Windows cross-build: `cargo check --target x86_64-pc-windows-gnu --workspace --tests` passes. No Windows host here. - `cargo xtask policy` passes (150 files ok). No game files or data from them were added. ## Checklist - [x] Workspace tests and Windows cross-check pass. - [x] `cargo xtask policy` passes. No game files or data from them were added. - [x] AI authorship is disclosed above.
GetProcAddress rejected every ordinal below 0x10000 for our pseudo modules, but some APIs (GameInputCreate) are exported only as ordinal 1. Look up the registry's #n export name so a title that loads the module and asks for its ordinal gets the implementation. Add a regression for gameinput.dll #1 and an unexported ordinal.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:06:40 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 17:35 UTC · original

Verification ran against PR head 829f774722a6b8feab7a88cffd1d635c03b9c81b; the PR was open at refresh.

  • Command: cargo test -p victory-hle pseudo_module_ordinals_resolve
  • Result: 1 passed: modules::kernel::tests::pseudo_module_ordinals_resolve. It confirms ordinal 1 on the pseudo gameinput.dll handle resolves to registry export #1, while unexported ordinal 2 returns null.
  • Scope: this was the targeted HLE unit test, not a full-workspace run.

This verification was AI-assisted.

**@⁠jeremygold02** on GitHub · 2026-11-24 17:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/512#issuecomment-7139431922) Verification ran against PR head `829f774722a6b8feab7a88cffd1d635c03b9c81b`; the PR was open at refresh. - Command: `cargo test -p victory-hle pseudo_module_ordinals_resolve` - Result: 1 passed: `modules::kernel::tests::pseudo_module_ordinals_resolve`. It confirms ordinal 1 on the pseudo `gameinput.dll` handle resolves to registry export `#1`, while unexported ordinal 2 returns null. - Scope: this was the targeted HLE unit test, not a full-workspace run. This verification was AI-assisted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:22 UTC · original

Automated triage for the maintainers.

Needs work. The fix itself is right: GetProcAddress in crates/victory-hle/src/modules/kernel.rs refused every ordinal on a pseudo-module handle. The registry already names ordinal exports #n (gameinput.rs registers #1, net.rs its ws2_32 ordinals), and host_override already looks ordinals up the same way. Resolving #n here makes the dynamic lookup agree with the static import binding. For ws2_32 this hands out our guarded net functions, so the offline guards still apply.

What blocks it: CI fails at Clippy (-D warnings). In the new test pseudo_module_ordinals_resolve, GetProcAddress(module, 1 as *const u8) trips clippy::manual_dangling_ptr. Use std::ptr::without_provenance::<u8>(1) (and (2) for the second call), or build the pointer through a usize variable. Once CI is green, this would be a merge candidate.

Minor: the change to title_dlls_and_pseudo_modules_are_found_by_name (non-Windows path) is unrelated to the fix. Please drop it or mention it in the description.

CI: failing (Clippy, see above).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/512#issuecomment-7149481104) <!-- victory-triage v1 head=829f774722a6b8feab7a88cffd1d635c03b9c81b verdict=needs-work at=2026-11-25T01:22:33Z --> Automated triage for the maintainers. **Needs work.** The fix itself is right: `GetProcAddress` in `crates/victory-hle/src/modules/kernel.rs` refused every ordinal on a pseudo-module handle. The registry already names ordinal exports `#n` (`gameinput.rs` registers `#1`, `net.rs` its `ws2_32` ordinals), and `host_override` already looks ordinals up the same way. Resolving `#n` here makes the dynamic lookup agree with the static import binding. For `ws2_32` this hands out our guarded `net` functions, so the offline guards still apply. What blocks it: CI fails at Clippy (`-D warnings`). In the new test `pseudo_module_ordinals_resolve`, `GetProcAddress(module, 1 as *const u8)` trips `clippy::manual_dangling_ptr`. Use `std::ptr::without_provenance::<u8>(1)` (and `(2)` for the second call), or build the pointer through a `usize` variable. Once CI is green, this would be a merge candidate. Minor: the change to `title_dlls_and_pseudo_modules_are_found_by_name` (non-Windows path) is unrelated to the fix. Please drop it or mention it in the description. CI: failing (Clippy, see above). --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/512/head:github-bot/gh-512'
git switch 'github-bot/gh-512'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-512'
git switch 'github-bot/gh-512'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-512'
git switch 'github-bot/gh-512'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-512'
git switch 'main'
git merge --squash 'github-bot/gh-512'
git switch 'main'
git merge --ff-only 'github-bot/gh-512'
git switch 'main'
git merge 'github-bot/gh-512'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!512
No description provided.