refactor: Rust architecture plan and first ported component #211
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!211
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-211"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@LooperSalty on GitHub · 2026-11-25 15:19 UTC · original
LooperSalty:refactor/rust-architecture→main· +2276 −1 · 18 files · 8 commits · draftChange
First step of the move of AnyXboxX to 100 % Rust: no Python and no C++ in the end state. There are two reasons:
cargo), one test runner, one style.The Python CLI and the pytest suite stay only as parity oracles during the migration. Each is removed once Rust tests cover the same cases.
This PR adds the foundation and one ported component that sets the pattern:
docs/architecture-rust.mdanddocs/fr/architecture-rust.md(kept in sync) contain:Cargo.tomlworkspace with members incrates/. It excludesrust/,third_party/and.claude/, sorust/Cargo.toml, VIctory (its own workspace, toolchain pin and policy check) and TomBox build unchanged. VIctory's crates are used by path.crates/anyxboxx-peis a Rust port ofPrototypeScarlett/emu/loader.py(read_pe). It covers header checks, base choice (preferred, fallback, forced), relocation, imports (by name and ordinal), exports, forwarders, the TLS directory and callbacks, and page protections. Table parsing is reused fromvictory-pe, not rewritten. A small CLI (anyxboxx-pe <image> [--base 0x..] [--pages]) prints the result as JSON.Refs: plan in
docs/architecture-rust.md. Phases 1 to 6 follow in separate PRs.Verification
Windows 11, Rust 1.98.1 (MSVC), Python 3.12 venv, C++ runtime built (
ANYXBOXX_RUNTIMEset):Oracle and test data
tests/test_rust_pe_parity.pybuilds 13 images withtests/pe_builder.py, loads each one withemu.loader.read_pe(with a Unicorn CPU, to get page protections) and with the Rust binary, and requires identical JSON. Both loaders must also refuse the same images. The cases are imports by name and ordinal, exports and forwarders, a forced base, a fallback base, an unusable fixed base, TLS at the preferred and at a forced base, a DLL without an entry point, an EXE without an entry point, i386, delay-load imports, .NET, and not-a-PE.crates/anyxboxx-pe/tests) build their own PE32+ images from source.tests/commonis the Rust twin ofpe_builder.py. No game, console or SDK file is used.test_rust_pe_parity.pyfails in CI (ANYXBOXX_REQUIRE_RUNTIME=1: binary missing); locally it is skipped.test_root_workspace_leaves_the_other_workspaces_alonefails if the root workspace stops excludingrust/,third_party/or.claude/.SizeOfImage.Decisions for the maintainer (from the plan)
.defpassed throughrustc-link-arg) and TLS callbacks.victory-hlemodules. The other is a sharedanyxboxx-gdkcrate used byvictory-hleand the cdylibs.apps/victory, called byanyxboxx run) instead of keepinganyxboxx.exeas well.Checklist
E_NOTIMPL), never a fake success. Here, a refused image is always an explicit error.victory-peis reused by path (our code, GPL-3.0-or-later).Made with AI assistance (Claude Code).
🤖 Generated with Claude Code
@Exorion1er on GitHub · 2026-11-25 16:35 UTC · original
Hi! I'd like to help on the Rust move, and I'll take the part you can't test: Linux (Proton) + AMD on
rust/full(RX 9070 XT, RADV, GE-Proton, same box as #199). I'll stay out of the Windows-side ports so we don't step on each other.What I checked on
rust/fullatd0e0f68, before changing anything:cargo test --release --workspacefails invictory-gpu(list.rsandresource.rscallcrate::texture,crate::hostandhost_resource, which are#[cfg(windows)]). That is already onmain: VIctory only builds for Windows. The root workspace now pulls it in throughvictory-hle, so a Linux contributor can't build the root natively any more. This doesn't block anything, since CI runs on Windows. I'd just say it inrust-full-status.md("Linux: cross-build with--target x86_64-pc-windows-msvc").lld-link,--target x86_64-pc-windows-msvc --all-targets): everything builds (anyxboxx.exe,anyxboxx-launcher.exe,xcrdapi.dll, the tools) exceptkernelxandd3d12_xs.anyxboxx-forwarders::linkneeds MSVC'slib.exeto make the.exp, andllvm-lib /DEFonly writes the.lib, not the.exp. I'll look for a way that works with bothlink.exeandlld-link. Until then I can live with it: the game runs through VIctory, which doesn't load these DLLs.What I'd like to take, if that works for you:
anyxboxx runon a Linux host. As written it can't work there. It spawnscargoandvictory.exedirectly, so run from Linux it can't start an.exe, and run inside Proton there is nocargo. I see two ways to fix that, your call:anyxboxx.exe runstays a Windows binary and runs under Proton. It gets an option to skip the build and use an already-builtvictory.exe(cross-built from Linux). Little new code.anyxboxx runthat cross-builds VIctory and startsvictory.exethrough Proton'swine, with the paths turned intoZ:\…. For this one,anyxboxx'svictory-hledependency (onlyrapportuses it) has to go behindcfg(windows)or a feature, because todayanyxboxxdoesn't compile natively on Linux (windows_sys).Either way it replaces my local
run.sh. The Windows behaviour andtest_anyxboxx_run.pystay as they are, and I'd add Linux cases next to them.Run the
linux-amdprofile and the graphical launcher under Proton (host detection throughwine_get_version, the Setup and Files pages, Shaders with progress lines, Play). I'll report fps and frame times measured againstrun.shon the same scene. One thing to check while I'm at it: myrun.shalso setsVICTORY_DXC(DXC for our HLSL when Wine'sd3dcompilerrefuses it), and the profile doesn't.Two questions so I aim right:
rust/fulland open PRs intorust/full, or wait until #211 is merged and targetmain?anyxboxx runor the launcher? If so, I'll stick to testing and reporting.I'll wait for your OK before I push anything.
@LooperSalty on GitHub · 2026-11-25 19:01 UTC · original
Thanks @Exorion1er, yes please — the Linux (Proton) + AMD side of the Rust move is yours. Nobody else is on it: our agent stays on the Windows-side ports (xgameruntime, the native launcher, then the RDNA 2 reference interpreter).
Answers:
rust/fulland open PRs intorust/full(notmain). From now onrust/fullonly moves forward: no more rebase + force-push on our side, so your branches stay valid. We'll bringmaininto it once, at the end, before the PR tomain.anyxboxx runon Linux: start with (a) —anyxboxx.exe runstays a Windows binary running under Proton, with an option to skip the build and use an already-builtvictory.exe. Smallest change, and it keepstest_anyxboxx_run.pyas is (add your Linux cases next to it). We can look at (b) later if (a) is not enough.VICTORY_DXCtolinux-amdinprofiles.toml, with your fps / frame times againstrun.shon the same scene in the PR body.docs/rust-full-status.md(and the fr version): native Linux builds are not supported, cross-build with--target x86_64-pc-windows-msvc;kernelx/d3d12_xsneed MSVC'slib.exefor the.expuntil alld-link-friendly way is found (not blocking: the game runs through VIctory).Same rules as the rest of the repo: English commits, tests with every change, CI green.
@Exorion1er on GitHub · 2026-11-25 19:26 UTC · original
Option (a) is up as #228 (base
rust/full):anyxboxx.exe run --victory-exeruns a cross-built VIctory under Proton and skips the cargo build, plus the Linux section inrust-full-status.md(en + fr).Measured on my own copy (RX 9070 XT, RADV, GE-Proton): the real game reaches gameplay through it, at 3.7 fps (272 ms/frame) once the world settles. Characters are missing geometry and some textures are missing. That comes from VIctory under RADV, not from this change.
I didn't add
VICTORY_DXCtolinux-amd:third_party/victoryonrust/fulldoesn't read it (it only exists in my old fork'sdxc.rs), so it would be a no-op. Details are in the PR.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.