Fix panic when getting avatar in steamworks-rs

This commit is contained in:
IQuant 2024-09-26 20:59:00 +03:00
parent 59e71125d4
commit 3516ada5ef
3 changed files with 13 additions and 7 deletions

13
noita-proxy/Cargo.lock generated
View file

@ -2326,6 +2326,12 @@ dependencies = [
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]] [[package]]
name = "pbkdf2" name = "pbkdf2"
version = "0.12.2" version = "0.12.2"
@ -3205,11 +3211,11 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "steamworks" name = "steamworks"
version = "0.11.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/IntQuant/steamworks-rs#d05eaa60db328156aeee172b0b157f3f69c70b30"
checksum = "a79d6f059322f73a4586cc2d0ca595ce1583104b2b1574ae1bb87f2c05bf4c67"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"lazy_static", "lazy_static",
"paste",
"steamworks-sys", "steamworks-sys",
"thiserror", "thiserror",
] ]
@ -3217,8 +3223,7 @@ dependencies = [
[[package]] [[package]]
name = "steamworks-sys" name = "steamworks-sys"
version = "0.11.0" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/IntQuant/steamworks-rs#d05eaa60db328156aeee172b0b157f3f69c70b30"
checksum = "7ef6b00f8fe8eaaaff22cb9b70822a48c1a5d772bc682c202a57c0b438175845"
[[package]] [[package]]
name = "strict-num" name = "strict-num"

View file

@ -25,7 +25,7 @@ serde = { version = "1.0.207", features = ["serde_derive", "derive"] }
bitcode = "0.6.0" bitcode = "0.6.0"
lz4_flex = { version = "0.11.3", default-features = false, features = ["std"]} lz4_flex = { version = "0.11.3", default-features = false, features = ["std"]}
rand = "0.8.5" rand = "0.8.5"
steamworks = "0.11.0" steamworks = { git = "https://github.com/IntQuant/steamworks-rs" }
crossbeam = { version = "0.8.4", features = ["crossbeam-channel"] } crossbeam = { version = "0.8.4", features = ["crossbeam-channel"] }
clipboard = "0.5.0" clipboard = "0.5.0"
socket2 = { version = "0.5.7", features = ["all"] } socket2 = { version = "0.5.7", features = ["all"] }

View file

@ -37,15 +37,16 @@ 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());
let (client, single) = steamworks::Client::init_app(app_id.unwrap_or(881100))?; let client = steamworks::Client::init_app(app_id.unwrap_or(881100))?;
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() {
error!("Failed to init_authentication: {}", err) error!("Failed to init_authentication: {}", err)
} }
let client_c = client.clone();
thread::spawn(move || { thread::spawn(move || {
info!("Spawned steam callback thread"); info!("Spawned steam callback thread");
loop { loop {
single.run_callbacks(); client_c.run_callbacks();
thread::sleep(Duration::from_millis(3)); thread::sleep(Duration::from_millis(3));
} }
}); });