add spacewars option

This commit is contained in:
bgkillas 2024-11-02 10:34:51 -04:00
parent 1e3871c574
commit d138bb43e3
4 changed files with 19 additions and 13 deletions

16
noita-proxy/Cargo.lock generated
View file

@ -380,9 +380,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.1.31" version = "1.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" checksum = "e3788d6ac30243803df38a3e9991cf37e41210232916d41a8222ae378f912624"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@ -3228,9 +3228,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.85" version = "2.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" checksum = "e89275301d38033efb81a6e60e3497e734dfcc62571f2854bf4b16690398824c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3311,18 +3311,18 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.65" version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" checksum = "5d171f59dbaa811dbbb1aee1e73db92ec2b122911a48e1390dfe327a821ddede"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.65" version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" checksum = "b08be0f17bd307950653ce45db00cd31200d82b624b36e181337d9c7d92765b5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View file

@ -185,6 +185,7 @@ struct AppSavedState {
show_extra_debug_stuff: bool, show_extra_debug_stuff: bool,
#[serde(default)] #[serde(default)]
record_all: bool, record_all: bool,
spacewars: bool,
} }
impl Default for AppSavedState { impl Default for AppSavedState {
@ -198,6 +199,7 @@ impl Default for AppSavedState {
start_game_automatically: false, start_game_automatically: false,
show_extra_debug_stuff: false, show_extra_debug_stuff: false,
record_all: false, record_all: false,
spacewars: false
} }
} }
} }
@ -347,7 +349,7 @@ impl App {
egui_extras::install_image_loaders(&cc.egui_ctx); egui_extras::install_image_loaders(&cc.egui_ctx);
info!("Initializing steam state..."); info!("Initializing steam state...");
let steam_state = steam_helper::SteamState::new(); let steam_state = steam_helper::SteamState::new(saved_state.spacewars);
info!("Checking if running on steam deck..."); info!("Checking if running on steam deck...");
let running_on_steamdeck = steam_state let running_on_steamdeck = steam_state
@ -791,6 +793,10 @@ impl App {
&mut self.app_saved_state.start_game_automatically, &mut self.app_saved_state.start_game_automatically,
tr("connect_settings_autostart"), tr("connect_settings_autostart"),
); );
ui.checkbox(
&mut self.app_saved_state.spacewars,
"make steam work with non steam noita versions, all players need this ticked to work, restart proxy to take effect",
);
ui.add_space(20.0); ui.add_space(20.0);
if self.player_image.width() == 1 { if self.player_image.width() == 1 {
self.player_image = image::open(player_path(self.modmanager_settings.mod_path())) self.player_image = image::open(player_path(self.modmanager_settings.mod_path()))
@ -1343,7 +1349,7 @@ fn peer_role(peer: net::omni::OmniPeerId, netman: &Arc<net::NetManager>) -> Stri
} }
fn cli_setup() -> (steam_helper::SteamState, NetManagerInit) { fn cli_setup() -> (steam_helper::SteamState, NetManagerInit) {
let mut state = steam_helper::SteamState::new().unwrap(); let mut state = steam_helper::SteamState::new(false).unwrap();
let my_nickname = Some(state.get_user_name(state.get_my_id())); let my_nickname = Some(state.get_user_name(state.get_my_id()));
let mut mod_manager = ModmanagerSettings { let mut mod_manager = ModmanagerSettings {
game_exe_path: PathBuf::new(), game_exe_path: PathBuf::new(),

View file

@ -194,7 +194,7 @@ fn replay_loop(recording_dir: PathBuf) {
pub fn replay_file(path: PathBuf) { pub fn replay_file(path: PathBuf) {
info!("Will replay {}", path.display()); info!("Will replay {}", path.display());
let mut steam_state = steam_helper::SteamState::new().expect("Can init steam state"); let mut steam_state = steam_helper::SteamState::new(false).expect("Can init steam state");
let apps = steam_state.client.apps(); let apps = steam_state.client.apps();
let app_id = AppId::from(881100); let app_id = AppId::from(881100);

View file

@ -31,7 +31,7 @@ pub struct SteamState {
} }
impl SteamState { impl SteamState {
pub(crate) fn new() -> Result<Self, SteamAPIInitError> { pub(crate) fn new(spacewars: bool) -> Result<Self, SteamAPIInitError> {
if env::var_os("NP_DISABLE_STEAM").is_some() { if env::var_os("NP_DISABLE_STEAM").is_some() {
return Err(SteamAPIInitError::FailedGeneric( return Err(SteamAPIInitError::FailedGeneric(
"Disabled by env variable".to_string(), "Disabled by env variable".to_string(),
@ -39,7 +39,7 @@ impl SteamState {
} }
let app_id = env::var("NP_APPID").ok().and_then(|x| x.parse().ok()); let app_id = env::var("NP_APPID").ok().and_then(|x| x.parse().ok());
info!("Initializing steam client..."); info!("Initializing steam client...");
let (client, single) = steamworks::Client::init_app(app_id.unwrap_or(881100))?; let (client, single) = steamworks::Client::init_app(app_id.unwrap_or(if spacewars {480} else {881100}))?;
info!("Initializing relay network accesss..."); info!("Initializing relay network accesss...");
client.networking_utils().init_relay_network_access(); client.networking_utils().init_relay_network_access();
if let Err(err) = client.networking_sockets().init_authentication() { if let Err(err) = client.networking_sockets().init_authentication() {