From 736f0910b66d2a8957dccd8a2a691073e03ba845 Mon Sep 17 00:00:00 2001 From: core Date: Sun, 16 Nov 2025 15:31:31 -0500 Subject: [PATCH] UNFINISHED: feat: hotpatching? --- Cargo.lock | 209 ++++++++++++++++++++++++++++++- README.md | 7 +- crates/unified/Cargo.toml | 2 + crates/unified/src/server/mod.rs | 2 +- crates/xtask/src/main.rs | 26 +++- 5 files changed, 242 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7ed5e90d6e5c2a26c0bafbf90f7f184a31e8bab..78286f0ed227ab6682216142220620509501626c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -774,6 +774,7 @@ version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "342f7e9335416dc98642d5747c4ed8a6ad9f7244a36d5b2b7a1b7910e4d8f524" dependencies = [ + "bevy_dylib", "bevy_internal", ] @@ -836,7 +837,9 @@ dependencies = [ "bevy_utils", "cfg-if", "console_error_panic_hook", + "crossbeam-channel", "ctrlc", + "dioxus-devtools", "downcast-rs 2.0.2", "log", "thiserror 2.0.17", @@ -1037,6 +1040,15 @@ dependencies = [ "serde", ] +[[package]] +name = "bevy_dylib" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b7834bd6b49e3459b94fe2ee2f532de820fd8b91183976e375bf88098e48fe2" +dependencies = [ + "bevy_internal", +] + [[package]] name = "bevy_ecs" version = "0.17.2" @@ -1061,6 +1073,7 @@ dependencies = [ "serde", "slotmap", "smallvec", + "subsecond", "thiserror 2.0.17", "variadics_please", ] @@ -2471,6 +2484,26 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b13ea120a812beba79e34316b3942a857c86ec1593cb34f27bb28272ce2cca" +[[package]] +name = "const_format" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7faa7469a93a566e9ccc1c73fe783b4a65c274c5ace346038dca9c39fe0030ad" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "const_panic" version = "0.2.15" @@ -2854,6 +2887,87 @@ dependencies = [ "subtle", ] +[[package]] +name = "dioxus-cli-config" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "babc8eaf90379352bc4820830749fd231feb9312433d4094b4e7b79d912b3d96" + +[[package]] +name = "dioxus-core" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75468d08468919f783b0f7ee826802f4e8e66c5b5a0451245d861c211ca18216" +dependencies = [ + "anyhow", + "const_format", + "dioxus-core-types", + "futures-channel", + "futures-util", + "generational-box", + "longest-increasing-subsequence", + "rustc-hash 2.1.1", + "rustversion", + "serde", + "slab", + "slotmap", + "subsecond", + "tracing", + "warnings", +] + +[[package]] +name = "dioxus-core-types" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f5ecf5a51de06d78aded3b5f7516a258f53117cba718bc5706317a3c04c844" + +[[package]] +name = "dioxus-devtools" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb2c5019b7fa72e8e6b21ba99e9263bd390c9a30bbf09793b72f4b57ed7c3d7" +dependencies = [ + "dioxus-cli-config", + "dioxus-core", + "dioxus-devtools-types", + "dioxus-signals", + "serde", + "serde_json", + "subsecond", + "thiserror 2.0.17", + "tracing", + "tungstenite 0.27.0", + "warnings", +] + +[[package]] +name = "dioxus-devtools-types" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b007cec5b8548281921c4e4678926a3936e9d6757e951380685cc6121a6f974" +dependencies = [ + "dioxus-core", + "serde", + "subsecond-types", +] + +[[package]] +name = "dioxus-signals" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3895cc17ff5b43ada07743111be586e7a927ed7ec511457020e4235e13e63fe6" +dependencies = [ + "dioxus-core", + "futures-channel", + "futures-util", + "generational-box", + "parking_lot", + "rustc-hash 2.1.1", + "tracing", + "warnings", +] + [[package]] name = "dirs-next" version = "2.0.0" @@ -3692,6 +3806,16 @@ dependencies = [ "slab", ] +[[package]] +name = "generational-box" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3c1ae09dfd2d455484a54b56129b9821241c4b0e412227806b6c3730cd18a29" +dependencies = [ + "parking_lot", + "tracing", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -4656,6 +4780,12 @@ version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +[[package]] +name = "longest-increasing-subsequence" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86" + [[package]] name = "lzma-rs" version = "0.3.0" @@ -4711,6 +4841,15 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "memfd" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad38eb12aea514a0466ea40a80fd8cc83637065948eb4a426e4aa46261175227" +dependencies = [ + "rustix 1.1.2", +] + [[package]] name = "memmap2" version = "0.9.9" @@ -6862,6 +7001,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" dependencies = [ + "serde", "version_check", ] @@ -7085,6 +7225,34 @@ dependencies = [ "syn", ] +[[package]] +name = "subsecond" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "834e8caec50249083ee6972a2f7645c4baadcb39d49ea801da1dc1d5e1c2ccb9" +dependencies = [ + "js-sys", + "libc", + "libloading", + "memfd", + "memmap2", + "serde", + "subsecond-types", + "thiserror 2.0.17", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "subsecond-types" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6beffea67e72a7a530990b270fd0277971eae564fdc10c1e0080e928b477fab" +dependencies = [ + "serde", +] + [[package]] name = "subtle" version = "2.6.1" @@ -7398,7 +7566,7 @@ dependencies = [ "rustls-pki-types", "tokio", "tokio-rustls", - "tungstenite", + "tungstenite 0.26.2", ] [[package]] @@ -7642,6 +7810,23 @@ dependencies = [ "utf-8", ] +[[package]] +name = "tungstenite" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadc29d668c91fcc564941132e17b28a7ceb2f3ebf0b9dae3e03fd7a6748eb0d" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.2", + "sha1", + "thiserror 2.0.17", + "utf-8", +] + [[package]] name = "twox-hash" version = "2.1.2" @@ -7923,6 +8108,28 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "warnings" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f68998838dab65727c9b30465595c6f7c953313559371ca8bf31759b3680ad" +dependencies = [ + "pin-project", + "tracing", + "warnings-macro", +] + +[[package]] +name = "warnings-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59195a1db0e95b920366d949ba5e0d3fc0e70b67c09be15ce5abb790106b0571" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" diff --git a/README.md b/README.md index 10b76f2737de53f3c60f174e91100d34d016bea2..4afb794257d6907ea68190f43a1bf63824311e3e 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,9 @@ a game about floating through space ## building don't -documentation: https://man.srht.e3t.cc/~starkingdoms/starkingdoms \ No newline at end of file +documentation: https://man.srht.e3t.cc/~starkingdoms/starkingdoms + +HOW TO GET HOTRELOADING WORKING: +``` +cargo install dioxus-cli@0.7.0-rc.0 --locked +``` \ No newline at end of file diff --git a/crates/unified/Cargo.toml b/crates/unified/Cargo.toml index c6fcc3e97b6ae59d3d3fee6809c9778ebecdf25b..5d5c3beec403dc99374b196d55e19b0354c8d588 100644 --- a/crates/unified/Cargo.toml +++ b/crates/unified/Cargo.toml @@ -9,6 +9,8 @@ crate-type = ["cdylib", "rlib"] [dependencies] bevy = { version = "0.17", default-features = false, features = [ + "hotpatching", + "dynamic_linking", "serialize", "tonemapping_luts", "bevy_window", diff --git a/crates/unified/src/server/mod.rs b/crates/unified/src/server/mod.rs index 2b65f0c0ad95c3ec0c318b02967b2df0c6c404bb..f2be2d35c484d26b03c63a4c8484522a14dc8990 100644 --- a/crates/unified/src/server/mod.rs +++ b/crates/unified/src/server/mod.rs @@ -33,7 +33,7 @@ impl Plugin for ServerPlugin { app.add_systems(Startup, move |mut commands: Commands| { let server = commands - .spawn(Name::new("ws-server")) + .spawn(Name::new("ws-server-stk")) .insert(AeronetRepliconServer) .insert(Transform::from_xyz(0.0, 0.0, 0.0)) .queue(WebSocketServer::open(config.clone())) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 9ebbceef51c959c677489da72bf4a0640e62d482..2798e573917e32cafe384132635a814d7f05eea6 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -133,6 +133,31 @@ fn main() { let subcommand = args.nth(1).unwrap(); match subcommand.as_str() { + "hp:unified:native" => { + let asset_dir = workspace_dir().join("crates/unified/"); + + Command::new("dx") + .args([ + "serve", + "--package", + "starkingdoms", + "--hot-patch", + "--features", + "bevy/hotpatching", + "--features", + "native", + "--features", + "bevy/dynamic_linking", + "--args", + &args.collect::>().join(" ") + ]) + .env("BEVY_ASSET_ROOT", asset_dir.to_string_lossy().to_string()) + .env("RUST_LOG", "info,starkingdoms=trace") + .spawn() + .unwrap() + .wait() + .unwrap(); + }, "client" => { if !try_build_client() { exit(1); @@ -191,7 +216,6 @@ fn main() { match res { Ok(event) => { if let EventKind::Modify(_) = event.kind { - let has_non_generated_update = false; for path in &event.paths { if !path.to_str().unwrap().contains("client/pkg") && !path.to_str().unwrap().ends_with("~")