[PR #5909] [CLOSED] Mods: one .hmod for content and native code (WIP, staging branch, #5865) #6554

Closed
opened 2026-11-03 06:22:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5909
Author: @Xmilon
Created: 11/1/2026
Status: ❌ Closed

Base: main ← Head: staging/unified-hmod


📝 Commits (10+)

  • e2d8520 Windows build: the windows-sys features boot_paint uses
  • 3888ac4 Native mods without mixins: API mods that never rebuild horizon-client
  • 0fb2575 boot_paint: AddFontMemResourceEx only reads the font count
  • af806fd Merge upstream/main into native/api-mods
  • 1e0fe9b Merge upstream/main; the game's unit tests keep their own process
  • 6085115 Merge main into #5446
  • 022306f refactor(client): keep the library split without the separate mod API
  • cd85269 docs: correct parity selection costs after the client split
  • a303d7d Merge upstream/main into the client library split
  • 2c78a5f Merge upstream/main before revising the client library layout

📊 Changes

118 files changed (+1143 additions, -386 deletions)

View changed files

📝 .github/workflows/game-build.yml (+1 -1)
📝 AGENTS.md (+15 -8)
📝 Cargo.lock (+57 -0)
📝 Cargo.toml (+1 -0)
➕ crates/horizon-client-lib/Cargo.toml (+221 -0)
📝 crates/horizon-client/Cargo.toml (+14 -7)
📝 crates/horizon-client/examples/chunk_load_bench.rs (+1 -0)
📝 crates/horizon-client/examples/gameplay_decode_profile.rs (+1 -0)
📝 crates/horizon-client/examples/json_load_bench.rs (+1 -0)
📝 crates/horizon-client/examples/mod_port_probe.rs (+1 -0)
📝 crates/horizon-client/examples/model_library_bench.rs (+1 -0)
📝 crates/horizon-client/examples/model_states_bench.rs (+1 -0)
📝 crates/horizon-client/examples/old_world_fixture.rs (+1 -0)
📝 crates/horizon-client/examples/portal_scan_bench.rs (+1 -0)
📝 crates/horizon-client/examples/probe/main.rs (+1 -0)
📝 crates/horizon-client/examples/random_tick_eligibility_bench.rs (+1 -0)
📝 crates/horizon-client/examples/resource_memory.rs (+1 -0)
📝 crates/horizon-client/examples/save_batch_bench.rs (+1 -0)
📝 crates/horizon-client/examples/shared_json_startup_profile.rs (+1 -0)
📝 crates/horizon-client/examples/sprite_cache_parity.rs (+1 -0)

...and 80 more files

📄 Description

🤖 Opened by Xmilon's AI agent (Claude Code, Claude Opus 5.5), not by Xmilon personally.

Note

Status: #5446 landed on main, so the shared staging branch is no longer needed. Ari has said this PR will be merged together with her typed-API PR (#5638), not squashed, so the commits keep their authors. Until then it stays a draft: the launcher and game support for a native .hmod is not done. The part already here (the reader, the spec in docs/api/mod-files.md, the WASM_GONE error) is safe for main as it is, since native mods still publish as .hnmod. A question to Ari about reading a native .hmod in the launcher step is on #5638.

What and why

Part of #5865: one .hmod file whose contents decide how it runs. .hnmod keeps loading unchanged, and an old WebAssembly mod gets a clear error.

Done in this PR:

  • horizon_mods::index::native::Bundle::read reads a .hmod that holds horizon-native.json + mixins/<id>/. It skips the file's content entries (horizon-mod.toml, assets/, data/), which Content checks instead and which stay out of the native build. If both manifests are present, they must name the same mod id. mod.wasm in a native file is refused with WASM_GONE. The 512-entry cap counts native files only.
  • native::holds, native::is_file and Package::has_manifest let callers tell what a file holds.
  • Index: inspect checks a native .hmod's content part as the game reads it, and refuses a mod upload that carries native code. Native mods still publish as .hnmod. They switch to .hmod in the same release as the launcher and game support below, so no launcher in use gets a file it can't read.
  • file_kind decides by contents: only a .hmod without native code, from a project that turned native, counts as a pre-native version.
  • Docs: docs/api/mod-files.md holds every rule of the file in one place (zip and path rules, top-level entries, the horizon-native.json schema, limits). docs/native-mods.md has a "One .hmod for content and code" section, and data-formats.md links to the spec.

Not done yet (why this is a draft):

  • Launcher: install a registry native .hmod as horizon-native-mods/<id>.hmod instead of <id>.hnmod, and read both extensions in native_mods::installed_mods, native_status (hnmods, is_native_file) and browser::horizon::mod_id.
  • Game: load the content part of native .hmods from horizon-native-mods/ (content_root, start_mods) and show "not built" on that row.
  • GitHub install (github_mods): accept a native .hmod release asset.
  • cargo-horizon-mod check: treat a .hmod with native code as a native mod.
  • Switch the registry to publish native versions as .hmod once the items above land.
  • Remaining docs: mods.md, mod-browser.md, api/mod-index.md, modpacks.md.
  • The catalog-hook linking path (item 2 of #5865) waits for the build-split discussion (#5446). This PR doesn't claim it.

Kind

  • feature: something new for players (listed under New in the release notes)

Vanilla reference

Horizon-only.

Other projects' code

none

Self-check

Not run yet (tools/pr_ready.py). Local runs: cargo test -p horizon-mods --features index 48 passed; cargo clippy -p horizon-mods --features index --all-targets -- -D warnings clean; cargo fmt clean; crates/horizon-mod-registry cargo test all passed (3 + 10). Launcher and client not built locally.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5909 **Author:** [@Xmilon](https://github.com/Xmilon) **Created:** 11/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `staging/unified-hmod` --- ### 📝 Commits (10+) - [`e2d8520`](https://github.com/horizon-rust/horizon/commit/e2d852088b4ce1a18a76827bc871419088b1fdb6) Windows build: the windows-sys features boot_paint uses - [`3888ac4`](https://github.com/horizon-rust/horizon/commit/3888ac4613b876ea093d8dccd2e3a1b03c8f3c2d) Native mods without mixins: API mods that never rebuild horizon-client - [`0fb2575`](https://github.com/horizon-rust/horizon/commit/0fb25759e1c39c3447c9b8d1b81d331ba44646cf) boot_paint: AddFontMemResourceEx only reads the font count - [`af806fd`](https://github.com/horizon-rust/horizon/commit/af806fd1c344c9b4a1a2a192a47f17344d2c230d) Merge upstream/main into native/api-mods - [`1e0fe9b`](https://github.com/horizon-rust/horizon/commit/1e0fe9bb79f18205ca27885288a9803a1a124253) Merge upstream/main; the game's unit tests keep their own process - [`6085115`](https://github.com/horizon-rust/horizon/commit/60851159b2cbaa3a52cb58848d83b118173e6211) Merge main into #5446 - [`022306f`](https://github.com/horizon-rust/horizon/commit/022306f5d8f9507f6d688bbe99bcc7865af3300f) refactor(client): keep the library split without the separate mod API - [`cd85269`](https://github.com/horizon-rust/horizon/commit/cd85269d5931bb8a39ad3635c9276fa21652561d) docs: correct parity selection costs after the client split - [`a303d7d`](https://github.com/horizon-rust/horizon/commit/a303d7d105d73c3367dbe52cc8246634a3c42b87) Merge upstream/main into the client library split - [`2c78a5f`](https://github.com/horizon-rust/horizon/commit/2c78a5f1b0050b252e9cedc423a8621164610ab3) Merge upstream/main before revising the client library layout ### 📊 Changes **118 files changed** (+1143 additions, -386 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/game-build.yml` (+1 -1) 📝 `AGENTS.md` (+15 -8) 📝 `Cargo.lock` (+57 -0) 📝 `Cargo.toml` (+1 -0) ➕ `crates/horizon-client-lib/Cargo.toml` (+221 -0) 📝 `crates/horizon-client/Cargo.toml` (+14 -7) 📝 `crates/horizon-client/examples/chunk_load_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/gameplay_decode_profile.rs` (+1 -0) 📝 `crates/horizon-client/examples/json_load_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/mod_port_probe.rs` (+1 -0) 📝 `crates/horizon-client/examples/model_library_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/model_states_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/old_world_fixture.rs` (+1 -0) 📝 `crates/horizon-client/examples/portal_scan_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/probe/main.rs` (+1 -0) 📝 `crates/horizon-client/examples/random_tick_eligibility_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/resource_memory.rs` (+1 -0) 📝 `crates/horizon-client/examples/save_batch_bench.rs` (+1 -0) 📝 `crates/horizon-client/examples/shared_json_startup_profile.rs` (+1 -0) 📝 `crates/horizon-client/examples/sprite_cache_parity.rs` (+1 -0) _...and 80 more files_ </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Claude Code, Claude Opus 5.5), not by Xmilon personally. > [!NOTE] > **Status:** #5446 landed on `main`, so the shared staging branch is no longer needed. Ari has said this PR will be merged together with her typed-API PR (#5638), not squashed, so the commits keep their authors. Until then it stays a draft: the launcher and game support for a native `.hmod` is not done. The part already here (the reader, the spec in `docs/api/mod-files.md`, the `WASM_GONE` error) is safe for `main` as it is, since native mods still publish as `.hnmod`. A question to Ari about reading a native `.hmod` in the launcher step is on #5638. ## What and why Part of #5865: one `.hmod` file whose contents decide how it runs. `.hnmod` keeps loading unchanged, and an old WebAssembly mod gets a clear error. Done in this PR: - `horizon_mods::index::native::Bundle::read` reads a `.hmod` that holds `horizon-native.json` + `mixins/<id>/`. It skips the file's content entries (`horizon-mod.toml`, `assets/`, `data/`), which `Content` checks instead and which stay out of the native build. If both manifests are present, they must name the same mod id. `mod.wasm` in a native file is refused with `WASM_GONE`. The 512-entry cap counts native files only. - `native::holds`, `native::is_file` and `Package::has_manifest` let callers tell what a file holds. - Index: `inspect` checks a native `.hmod`'s content part as the game reads it, and refuses a `mod` upload that carries native code. Native mods still **publish as `.hnmod`**. They switch to `.hmod` in the same release as the launcher and game support below, so no launcher in use gets a file it can't read. - `file_kind` decides by contents: only a `.hmod` without native code, from a project that turned native, counts as a pre-native version. - Docs: `docs/api/mod-files.md` holds every rule of the file in one place (zip and path rules, top-level entries, the `horizon-native.json` schema, limits). docs/native-mods.md has a "One `.hmod` for content and code" section, and data-formats.md links to the spec. Not done yet (why this is a draft): - Launcher: install a registry native `.hmod` as `horizon-native-mods/<id>.hmod` instead of `<id>.hnmod`, and read both extensions in `native_mods::installed_mods`, `native_status` (`hnmods`, `is_native_file`) and `browser::horizon::mod_id`. - Game: load the content part of native `.hmod`s from `horizon-native-mods/` (`content_root`, `start_mods`) and show "not built" on that row. - GitHub install (`github_mods`): accept a native `.hmod` release asset. - `cargo-horizon-mod check`: treat a `.hmod` with native code as a native mod. - Switch the registry to publish native versions as `.hmod` once the items above land. - Remaining docs: mods.md, mod-browser.md, api/mod-index.md, modpacks.md. - The catalog-hook linking path (item 2 of #5865) waits for the build-split discussion (#5446). This PR doesn't claim it. ## Kind - [x] feature: something new for players (listed under New in the release notes) ## Vanilla reference Horizon-only. ## Other projects' code none ## Self-check Not run yet (`tools/pr_ready.py`). Local runs: `cargo test -p horizon-mods --features index` 48 passed; `cargo clippy -p horizon-mods --features index --all-targets -- -D warnings` clean; `cargo fmt` clean; `crates/horizon-mod-registry` `cargo test` all passed (3 + 10). Launcher and client not built locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:22:53 +07:00
Sign in to join this conversation.
No milestone
No project
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
horizon-rust/horizon#6554
No description provided.