Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ jobs:
components: clippy, rustfmt

- name: Check API formatting
run: cargo fmt -p highfleet-mod-api -- --check
run: cargo fmt -p highfleet-mod-api -p highfleet-patchy-client -p patchy-test-mod -- --check

- name: Lint API
run: cargo clippy --locked -p highfleet-mod-api --all-targets -- -D warnings
run: cargo clippy --locked -p highfleet-mod-api -p highfleet-patchy-client -p patchy-test-mod --all-targets -- -D warnings

- name: Test workspace
run: cargo test --workspace --locked
Expand Down
12 changes: 11 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
# build = "build.rs"

[workspace]
members = ["crates/highfleet-mod-api", "tests/fixtures/patchy-mod"]
members = ["crates/highfleet-mod-api", "crates/highfleet-patchy-client", "tests/fixtures/patchy-mod"]
resolver = "2"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,20 @@ normally. Unknown builds and rejected version checks do not disable the service.

Sessions are referred to by loader-issued 64-bit IDs. Zero is never issued, IDs
are never reused, and an unknown, consumed, or another mod's ID is rejected
without affecting any session. The initial table supports named byte overwrites. Trampoline requests and the
mod-facing Rust `PatchSession` client are not yet available, and the ABI is not
stable. For a minimal end-to-end example, see the
[test mod](tests/fixtures/patchy-mod/src/lib.rs).
without affecting any session. The ABI is provisional and accepts either a
byte overwrite or a trampoline plan. It is separate from Patchy's standalone
C ABI; mods using the standalone library do not share the loader's registry.

Rust mods can alias the `highfleet-patchy-client` package as `patchy` in their
manifest and call `patchy::export_patchy!()` once at the crate root.
`PatchSession::new()` then returns a loader-owned session or an error if the
service was unavailable or incompatible. `overwrite`, `patch_call`, and
`install_permanently` use the usual Patchy call shape. `overwrite_named`
supplies a diagnostic name. `detour_trampoline_with` uses the shared Patchy
builder on the mod side, while the loader resolves placement, replay, and
resume. Replay is verbatim; it does not relocate displaced instructions.
There is no local Patchy fallback. See the
[test mod](tests/fixtures/patchy-mod/src/lib.rs) for examples.

#### `init() -> bool`
The modloader calls this function last.
Expand Down
13 changes: 13 additions & 0 deletions crates/highfleet-patchy-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "highfleet-patchy-client"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
highfleet-mod-api = { path = "../highfleet-mod-api" }
patchy-code = { git = "https://github.com/logdot/patchy-rs.git", rev = "64d2eac7b33f81c4a60f18ae834d9daba96b92cf" }
thiserror = "2"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = ["Win32_System_LibraryLoader"] }
Loading