diff --git a/Justfile b/Justfile index 0d1d5f4f..9caf20d7 100644 --- a/Justfile +++ b/Justfile @@ -16,6 +16,9 @@ build: run-rel: add_dylib_release cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 cargo run --release +run-rel-alt: add_dylib_release + cd noita-proxy && NP_SKIP_MOD_CHECK=1 cargo run --release + flamegraph: add_dylib_debug cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 cargo flamegraph diff --git a/noita-proxy/Cargo.lock b/noita-proxy/Cargo.lock index 20048906..240d8823 100644 --- a/noita-proxy/Cargo.lock +++ b/noita-proxy/Cargo.lock @@ -1997,7 +1997,7 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "noita-proxy" -version = "0.16.0" +version = "0.16.1" dependencies = [ "argh", "bincode", diff --git a/noita-proxy/Cargo.toml b/noita-proxy/Cargo.toml index 6682e77a..3f198682 100644 --- a/noita-proxy/Cargo.toml +++ b/noita-proxy/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" [package] name = "noita-proxy" description = "Noita Entangled Worlds companion app." -version = "0.16.0" +version = "0.16.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/noita-proxy/src/net.rs b/noita-proxy/src/net.rs index 8412a387..29a43118 100644 --- a/noita-proxy/src/net.rs +++ b/noita-proxy/src/net.rs @@ -169,10 +169,12 @@ impl NetManager { thread::sleep(Duration::from_millis(100)); } + let is_host = self.is_host(); + info!("Is host: {is_host}"); let mut state = NetInnerState { ws: None, world: WorldManager::new( - self.is_host(), + is_host, self.peer.my_id().unwrap(), self.init_settings.save_state.clone(), ), @@ -416,7 +418,7 @@ impl NetManager { } fn is_host(&self) -> bool { - self.peer.my_id() == Some(self.peer.host_id()) + self.peer.is_host() } pub(crate) fn handle_message_to_proxy(&self, msg: &[u8], state: &mut NetInnerState) { diff --git a/noita-proxy/src/net/omni.rs b/noita-proxy/src/net/omni.rs index affee6d3..9674b2a6 100644 --- a/noita-proxy/src/net/omni.rs +++ b/noita-proxy/src/net/omni.rs @@ -154,6 +154,9 @@ impl PeerVariant { } pub fn is_host(&self) -> bool { - Some(self.host_id()) == self.my_id() + match self { + PeerVariant::Tangled(_) => Some(self.host_id()) == self.my_id(), + PeerVariant::Steam(p) => p.is_host(), + } } } diff --git a/noita-proxy/src/net/steam_networking.rs b/noita-proxy/src/net/steam_networking.rs index 32b05300..e9190d7b 100644 --- a/noita-proxy/src/net/steam_networking.rs +++ b/noita-proxy/src/net/steam_networking.rs @@ -532,6 +532,10 @@ impl SteamPeer { pub fn state(&self) -> ExtraPeerState { self.inner.lock().unwrap().state } + + pub fn is_host(&self) -> bool { + self.is_host + } } fn make_callbacks(