mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
Hotfix
This commit is contained in:
parent
a19ef372ae
commit
9e4b211b17
6 changed files with 73 additions and 59 deletions
3
Justfile
3
Justfile
|
@ -7,6 +7,9 @@ run-rel:
|
||||||
run-rel-n:
|
run-rel-n:
|
||||||
cd noita-proxy && NP_SKIP_MOD_CHECK=1 cargo run --release
|
cd noita-proxy && NP_SKIP_MOD_CHECK=1 cargo run --release
|
||||||
|
|
||||||
|
run-rel-n-2:
|
||||||
|
cd noita-proxy && NP_NOITA_ADDR=127.0.0.1:21252 NP_SKIP_MOD_CHECK=1 cargo run --release
|
||||||
|
|
||||||
run2:
|
run2:
|
||||||
cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 NP_NOITA_ADDR=127.0.0.1:21252 cargo run
|
cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 NP_NOITA_ADDR=127.0.0.1:21252 cargo run
|
||||||
|
|
||||||
|
|
2
noita-proxy/Cargo.lock
generated
2
noita-proxy/Cargo.lock
generated
|
@ -1931,7 +1931,7 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "noita-proxy"
|
name = "noita-proxy"
|
||||||
version = "0.13.3"
|
version = "0.13.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"bitcode",
|
"bitcode",
|
||||||
|
|
|
@ -4,7 +4,7 @@ members = ["tangled"]
|
||||||
[package]
|
[package]
|
||||||
name = "noita-proxy"
|
name = "noita-proxy"
|
||||||
description = "Noita Entangled Worlds companion app."
|
description = "Noita Entangled Worlds companion app."
|
||||||
version = "0.13.3"
|
version = "0.13.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
|
@ -14,7 +14,7 @@ use eframe::egui::{
|
||||||
use egui_plot::{Plot, PlotPoint, PlotUi, Text};
|
use egui_plot::{Plot, PlotPoint, PlotUi, Text};
|
||||||
use lang::{set_current_locale, tr, LANGS};
|
use lang::{set_current_locale, tr, LANGS};
|
||||||
use mod_manager::{Modmanager, ModmanagerSettings};
|
use mod_manager::{Modmanager, ModmanagerSettings};
|
||||||
use net::{omni::PeerVariant, NetManagerInit};
|
use net::{omni::PeerVariant, steam_networking::ExtraPeerState, NetManagerInit};
|
||||||
use self_update::SelfUpdateManager;
|
use self_update::SelfUpdateManager;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use steamworks::{LobbyId, SteamAPIInitError};
|
use steamworks::{LobbyId, SteamAPIInitError};
|
||||||
|
@ -213,16 +213,10 @@ impl App {
|
||||||
id,
|
id,
|
||||||
self.steam_state.as_ref().unwrap().client.clone(),
|
self.steam_state.as_ref().unwrap().client.clone(),
|
||||||
);
|
);
|
||||||
match peer {
|
|
||||||
Ok(peer) => {
|
let netman = net::NetManager::new(PeerVariant::Steam(peer), self.get_netman_init());
|
||||||
let netman = net::NetManager::new(PeerVariant::Steam(peer), self.get_netman_init());
|
netman.clone().start();
|
||||||
netman.clone().start();
|
self.state = AppState::Netman { netman };
|
||||||
self.state = AppState::Netman { netman };
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
self.notify_error(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn connect_screen(&mut self, ctx: &egui::Context) {
|
fn connect_screen(&mut self, ctx: &egui::Context) {
|
||||||
|
@ -425,6 +419,10 @@ impl eframe::App for App {
|
||||||
self.connect_screen(ctx);
|
self.connect_screen(ctx);
|
||||||
}
|
}
|
||||||
AppState::Netman { netman } => {
|
AppState::Netman { netman } => {
|
||||||
|
if let ExtraPeerState::CouldNotConnect(err) = netman.peer.state() {
|
||||||
|
self.notify_error(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let stopped = netman.stopped.load(Ordering::Relaxed);
|
let stopped = netman.stopped.load(Ordering::Relaxed);
|
||||||
let accept_local = netman.accept_local.load(Ordering::Relaxed);
|
let accept_local = netman.accept_local.load(Ordering::Relaxed);
|
||||||
let local_connected = netman.local_connected.load(Ordering::Relaxed);
|
let local_connected = netman.local_connected.load(Ordering::Relaxed);
|
||||||
|
@ -487,7 +485,7 @@ impl eframe::App for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui.label(format!("Peer state: {}", netman.peer.state()));
|
ui.label(format!("Peer state: {:?}", netman.peer.state()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.show_map_plot {
|
if self.show_map_plot {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use super::steam_networking;
|
use super::steam_networking::{self, ExtraPeerState};
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use steamworks::{LobbyId, SteamId};
|
use steamworks::{LobbyId, SteamId};
|
||||||
use tangled::{PeerId, PeerState, Reliability};
|
use tangled::{PeerId, Reliability};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct OmniPeerId(pub u64);
|
pub struct OmniPeerId(pub u64);
|
||||||
|
@ -127,9 +127,9 @@ impl PeerVariant {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn state(&self) -> PeerState {
|
pub fn state(&self) -> ExtraPeerState {
|
||||||
match self {
|
match self {
|
||||||
PeerVariant::Tangled(p) => p.state(),
|
PeerVariant::Tangled(p) => ExtraPeerState::Tangled(p.state()),
|
||||||
PeerVariant::Steam(p) => p.state(),
|
PeerVariant::Steam(p) => p.state(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ use crate::{
|
||||||
|
|
||||||
use super::omni::{self, OmniNetworkEvent};
|
use super::omni::{self, OmniNetworkEvent};
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum ConnectError {
|
pub enum ConnectError {
|
||||||
VersionMismatch { remote_version: Version },
|
VersionMismatch { remote_version: Version },
|
||||||
VersionMissing,
|
VersionMissing,
|
||||||
|
@ -50,17 +51,23 @@ impl Display for ConnectError {
|
||||||
enum SteamEvent {
|
enum SteamEvent {
|
||||||
LobbyCreated(LobbyId),
|
LobbyCreated(LobbyId),
|
||||||
LobbyError(SteamError),
|
LobbyError(SteamError),
|
||||||
LobbyJoinError,
|
LobbyJoinError(ConnectError),
|
||||||
PeerConnected(SteamId),
|
PeerConnected(SteamId),
|
||||||
PeerDisconnected(SteamId),
|
PeerDisconnected(SteamId),
|
||||||
PeerStateChanged,
|
PeerStateChanged,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub enum ExtraPeerState {
|
||||||
|
Tangled(PeerState),
|
||||||
|
CouldNotConnect(ConnectError),
|
||||||
|
}
|
||||||
|
|
||||||
pub struct InnerState {
|
pub struct InnerState {
|
||||||
lobby_id: Option<LobbyId>,
|
lobby_id: Option<LobbyId>,
|
||||||
host_id: SteamId,
|
host_id: SteamId,
|
||||||
remote_peers: Vec<SteamId>,
|
remote_peers: Vec<SteamId>,
|
||||||
state: PeerState,
|
state: ExtraPeerState,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SteamPeer {
|
pub struct SteamPeer {
|
||||||
|
@ -112,54 +119,58 @@ impl SteamPeer {
|
||||||
lobby_id: None,
|
lobby_id: None,
|
||||||
host_id: my_id,
|
host_id: my_id,
|
||||||
remote_peers: Vec::new(),
|
remote_peers: Vec::new(),
|
||||||
state: PeerState::PendingConnection,
|
state: ExtraPeerState::Tangled(PeerState::PendingConnection),
|
||||||
}),
|
}),
|
||||||
_cbs,
|
_cbs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_connect(lobby: LobbyId, client: steamworks::Client) -> Result<Self, ConnectError> {
|
pub fn new_connect(lobby: LobbyId, client: steamworks::Client) -> Self {
|
||||||
let (sender, events) = channel::unbounded();
|
let (sender, events) = channel::unbounded();
|
||||||
let matchmaking = client.matchmaking();
|
let matchmaking = client.matchmaking();
|
||||||
{
|
{
|
||||||
let sender = sender.clone();
|
let sender = sender.clone();
|
||||||
// Empty lobbies don't exist because lobbies are deleted when they become empty,
|
|
||||||
// thus, it's likely that it doesn't exist.
|
|
||||||
if matchmaking.lobby_member_count(lobby) == 0 {
|
|
||||||
return Err(ConnectError::LobbyDoesNotExist);
|
|
||||||
}
|
|
||||||
|
|
||||||
match matchmaking
|
matchmaking.join_lobby(lobby, {
|
||||||
.lobby_data(lobby, "ew_version")
|
let client = client.clone();
|
||||||
.and_then(Version::parse_from_diplay)
|
move |lobby| {
|
||||||
{
|
let matchmaking = client.matchmaking();
|
||||||
Some(remote_version) => {
|
|
||||||
if remote_version != Version::current() {
|
let event = match lobby {
|
||||||
warn!(
|
Ok(id) => {
|
||||||
"Could not connect: version mismatch, remote: {}, current: {}",
|
match matchmaking
|
||||||
remote_version,
|
.lobby_data(id, "ew_version")
|
||||||
Version::current()
|
.and_then(Version::parse_from_diplay)
|
||||||
);
|
{
|
||||||
return Err(ConnectError::VersionMismatch { remote_version });
|
Some(remote_version) => {
|
||||||
}
|
if remote_version != Version::current() {
|
||||||
|
warn!(
|
||||||
|
"Could not connect: version mismatch, remote: {}, current: {}",
|
||||||
|
remote_version,
|
||||||
|
Version::current()
|
||||||
|
);
|
||||||
|
SteamEvent::LobbyJoinError(ConnectError::VersionMismatch { remote_version })
|
||||||
|
} else {
|
||||||
|
SteamEvent::LobbyCreated(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
warn!("Could not connect: version data missing/could not be parsed");
|
||||||
|
SteamEvent::LobbyJoinError(ConnectError::VersionMissing)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_) => SteamEvent::LobbyJoinError(ConnectError::LobbyDoesNotExist),
|
||||||
|
};
|
||||||
|
|
||||||
|
sender.send(event).ok();
|
||||||
}
|
}
|
||||||
None => {
|
|
||||||
warn!("Could not connect: version data missing/could not be parsed");
|
|
||||||
return Err(ConnectError::VersionMissing);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
matchmaking.join_lobby(lobby, move |lobby| {
|
|
||||||
let event = match lobby {
|
|
||||||
Ok(id) => SteamEvent::LobbyCreated(id),
|
|
||||||
Err(_) => SteamEvent::LobbyJoinError,
|
|
||||||
};
|
|
||||||
sender.send(event).ok();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let my_id = client.user().steam_id();
|
let my_id = client.user().steam_id();
|
||||||
let _cbs = make_callbacks(&sender, &client);
|
let _cbs = make_callbacks(&sender, &client);
|
||||||
Ok(Self {
|
Self {
|
||||||
my_id,
|
my_id,
|
||||||
client,
|
client,
|
||||||
|
|
||||||
|
@ -170,10 +181,10 @@ impl SteamPeer {
|
||||||
lobby_id: None,
|
lobby_id: None,
|
||||||
remote_peers: Vec::new(),
|
remote_peers: Vec::new(),
|
||||||
host_id: my_id,
|
host_id: my_id,
|
||||||
state: PeerState::PendingConnection,
|
state: ExtraPeerState::Tangled(PeerState::PendingConnection),
|
||||||
}),
|
}),
|
||||||
_cbs,
|
_cbs,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_message(&self, peer: SteamId, msg: &[u8], reliability: Reliability) -> bool {
|
pub fn send_message(&self, peer: SteamId, msg: &[u8], reliability: Reliability) -> bool {
|
||||||
|
@ -214,15 +225,17 @@ impl SteamPeer {
|
||||||
info!("Got host id: {:?}", host_id)
|
info!("Got host id: {:?}", host_id)
|
||||||
}
|
}
|
||||||
self.update_remote_peers();
|
self.update_remote_peers();
|
||||||
self.inner.lock().unwrap().state = PeerState::Connected;
|
self.inner.lock().unwrap().state =
|
||||||
|
ExtraPeerState::Tangled(PeerState::Connected);
|
||||||
}
|
}
|
||||||
SteamEvent::LobbyError(err) => {
|
SteamEvent::LobbyError(err) => {
|
||||||
warn!("Could not create lobby: {}", err);
|
warn!("Could not create lobby: {}", err);
|
||||||
self.inner.lock().unwrap().state = PeerState::Disconnected;
|
self.inner.lock().unwrap().state =
|
||||||
|
ExtraPeerState::Tangled(PeerState::Disconnected);
|
||||||
}
|
}
|
||||||
SteamEvent::LobbyJoinError => {
|
SteamEvent::LobbyJoinError(err) => {
|
||||||
warn!("Could not join lobby");
|
warn!("Could not join lobby");
|
||||||
self.inner.lock().unwrap().state = PeerState::Disconnected;
|
self.inner.lock().unwrap().state = ExtraPeerState::CouldNotConnect(err);
|
||||||
}
|
}
|
||||||
SteamEvent::PeerConnected(id) => {
|
SteamEvent::PeerConnected(id) => {
|
||||||
returned_events.push(omni::OmniNetworkEvent::PeerConnected(id.into()))
|
returned_events.push(omni::OmniNetworkEvent::PeerConnected(id.into()))
|
||||||
|
@ -302,7 +315,7 @@ impl SteamPeer {
|
||||||
self.inner.lock().unwrap().lobby_id
|
self.inner.lock().unwrap().lobby_id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn state(&self) -> PeerState {
|
pub fn state(&self) -> ExtraPeerState {
|
||||||
self.inner.lock().unwrap().state
|
self.inner.lock().unwrap().state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue