From 0c7aa8c92df0e317576a6f702e9abba8eacd4eb0 Mon Sep 17 00:00:00 2001 From: Spacebot Date: Tue, 28 Apr 2026 13:03:57 +0000 Subject: [PATCH 1/6] Update Rust crate async-trait to v0.1.89 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2b542a..1b47baa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,9 +37,9 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "async-trait" -version = "0.1.88" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", From 48ace5124b418cf1a0832be37431192669466499 Mon Sep 17 00:00:00 2001 From: Spacebot Date: Tue, 28 Apr 2026 13:04:07 +0000 Subject: [PATCH 2/6] Update Rust crate chrono to v0.4.44 --- Cargo.lock | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2b542a..e666c9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,12 +14,6 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -644,16 +638,15 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.41" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-link 0.1.3", + "windows-link 0.2.1", ] [[package]] From 747e37409facc1f5cb8ddb47383a1ea5928acdbe Mon Sep 17 00:00:00 2001 From: Maple Nebel Date: Tue, 28 Apr 2026 15:07:33 +0200 Subject: [PATCH 3/6] fix issues --- rnex-core/src/nex/user.rs | 9 ++-- rnex-core/src/rmc/structures/any.rs | 54 +++++++++++------------ rnex-core/src/rmc/structures/matchmake.rs | 1 - 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/rnex-core/src/nex/user.rs b/rnex-core/src/nex/user.rs index eba80f4..7b56fdf 100644 --- a/rnex-core/src/nex/user.rs +++ b/rnex-core/src/nex/user.rs @@ -180,11 +180,14 @@ impl MatchmakeExtension for User { } async fn update_progress_score(&self, gid: u32, progress: u8) -> Result<(), ErrorCode> { - let session = self.matchmake_manager.get_session(gid).await?; + #[cfg(feature = "v3-5-0")] + { + let session = self.matchmake_manager.get_session(gid).await?; - let mut session = session.lock().await; + let mut session = session.lock().await; - session.session.progress_score = progress; + session.session.progress_score = progress; + } Ok(()) } diff --git a/rnex-core/src/rmc/structures/any.rs b/rnex-core/src/rmc/structures/any.rs index 8f4b569..98feb86 100644 --- a/rnex-core/src/rmc/structures/any.rs +++ b/rnex-core/src/rmc/structures/any.rs @@ -1,4 +1,3 @@ -use log::{info, warn}; use rnex_core::rmc::structures::{Result, RmcSerialize}; use std::io::{Cursor, Read, Write}; use v_byte_helpers::{IS_BIG_ENDIAN, ReadExtensions}; @@ -12,32 +11,21 @@ pub struct Any { impl RmcSerialize for Any { fn serialize(&self, writer: &mut impl Write) -> Result<()> { self.name.serialize(writer)?; - let u32_len = self.data.len() as u32 - 1; + + let u32_len = self.data.len() as u32; (u32_len + 4).serialize(writer)?; - u32_len.serialize(writer)?; - writer.write_all(&self.data)?; + self.data.serialize(writer)?; Ok(()) } fn deserialize(reader: &mut impl Read) -> Result { let name = String::deserialize(reader)?; - let size = u32::deserialize(reader)? as usize + 1; - let mut buf = vec![0; size]; - reader.read_exact(&mut buf[..])?; - let mut cursor = Cursor::new(&buf); - let len2: u32 = cursor.read_struct(IS_BIG_ENDIAN)?; + // also length ? + let _len2: u32 = reader.read_struct(IS_BIG_ENDIAN)?; + let data = Vec::deserialize(reader)?; - if len2 as usize + 3 != size { - warn!("mismatched sizes on any: {} vs {}", size, len2 + 1); - } - - info!("any data: {}", hex::encode(&buf)); - - Ok(Any { - name, - data: (&buf[4..]).to_owned(), - }) + Ok(Any { name, data }) } } @@ -58,8 +46,6 @@ impl Any { #[cfg(test)] mod test { - use std::io::Cursor; - use crate::rmc::structures::{ RmcSerialize, any::Any, @@ -68,6 +54,21 @@ mod test { #[test] fn test() { + let any = Any { + name: "MatchmakeSession".into(), + data: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 98, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, + 0, 0, 0, 0, 0, 20, 0, 68, 111, 111, 114, 115, 32, 70, 114, 105, 101, 110, 100, 32, + 73, 110, 118, 105, 116, 101, 0, 0, 0, 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 1, 2, 3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + ] + .into(), + }; + + println!("{}", hex::encode(&any.data)); + + let _: MatchmakeSession = any.try_get().unwrap().unwrap(); let sess = MatchmakeSession { gathering: Gathering { self_gid: 0, @@ -87,18 +88,15 @@ mod test { matchmake_system_type: 2, application_buffer: [1, 2, 3].into(), participation_count: 0, + #[cfg(feature = "v3-5-0")] progress_score: 0, session_key: [].into(), }; - let any = Any::new(&sess).unwrap().to_data().unwrap(); + let any = Any::new(&sess).unwrap(); - let sess2: MatchmakeSession = Any::deserialize(&mut Cursor::new(any)) - .unwrap() - .try_get() - .unwrap() - .unwrap(); + let sess2: MatchmakeSession = any.try_get().unwrap().unwrap(); - assert_eq!(sess, sess2); + assert_eq!(sess, sess2) } } diff --git a/rnex-core/src/rmc/structures/matchmake.rs b/rnex-core/src/rmc/structures/matchmake.rs index 52af790..2e8a2ef 100644 --- a/rnex-core/src/rmc/structures/matchmake.rs +++ b/rnex-core/src/rmc/structures/matchmake.rs @@ -67,7 +67,6 @@ cfg_if! { pub matchmake_system_type: u32, pub application_buffer: Vec, pub participation_count: u32, - pub progress_score: u8, pub session_key: Vec, } } From b9bfac8c70ff43485a4593d19300591987558754 Mon Sep 17 00:00:00 2001 From: Maple Nebel Date: Tue, 28 Apr 2026 15:22:42 +0200 Subject: [PATCH 4/6] implement find by single id --- rnex-core/src/nex/user.rs | 11 +++++++++++ rnex-core/src/rmc/protocols/matchmake.rs | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/rnex-core/src/nex/user.rs b/rnex-core/src/nex/user.rs index 7b56fdf..7f0bf41 100644 --- a/rnex-core/src/nex/user.rs +++ b/rnex-core/src/nex/user.rs @@ -52,6 +52,8 @@ use rnex_core::rmc::structures::ranking::UploadCompetitionData; use std::sync::{Arc, Weak}; use tokio::sync::{Mutex, RwLock}; +use crate::rmc::structures::Error; + cfg_if! { if #[cfg(feature = "datastore")] { use rnex_core::rmc::protocols::datastore::{DataStore, RawDataStore, RawDataStoreInfo, RemoteDataStore}; @@ -509,6 +511,15 @@ impl MatchmakeExtension for User { } impl Matchmake for User { + async fn find_by_single_id(&self, gid: u32) -> Result<(bool, Any), ErrorCode> { + let s = self.matchmake_manager.get_session(gid).await?; + let s = s.lock().await; + Ok(( + true, + Any::new(&s.session).map_err(|_| ErrorCode::Custom_Unknown)?, + )) + } + async fn unregister_gathering(&self, _gid: u32) -> Result { Ok(true) } diff --git a/rnex-core/src/rmc/protocols/matchmake.rs b/rnex-core/src/rmc/protocols/matchmake.rs index 94edce3..d1c43b9 100644 --- a/rnex-core/src/rmc/protocols/matchmake.rs +++ b/rnex-core/src/rmc/protocols/matchmake.rs @@ -4,10 +4,14 @@ use rnex_core::rmc::response::ErrorCode; use rnex_core::PID; +use crate::rmc::structures::any::Any; + #[rmc_proto(21)] pub trait Matchmake { #[method_id(2)] async fn unregister_gathering(&self, gid: u32) -> Result; + #[method_id(21)] + async fn find_by_single_id(&self, gid: u32) -> Result<(bool, Any), ErrorCode>; #[method_id(41)] async fn get_session_urls(&self, gid: u32) -> Result, ErrorCode>; #[method_id(42)] From 6daf271cbdc6ee19ac3c5d282c839b49d7532bc9 Mon Sep 17 00:00:00 2001 From: Maple Nebel Date: Tue, 28 Apr 2026 15:30:42 +0200 Subject: [PATCH 5/6] add more 3.3.0 support --- rnex-core/src/nex/user.rs | 2 +- rnex-core/src/rmc/protocols/matchmake_extension.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rnex-core/src/nex/user.rs b/rnex-core/src/nex/user.rs index 7f0bf41..dbbac7b 100644 --- a/rnex-core/src/nex/user.rs +++ b/rnex-core/src/nex/user.rs @@ -500,7 +500,7 @@ impl MatchmakeExtension for User { gid: u32, message: String, dont_care_block_list: bool, - participation_count: u16, + //participation_count: u16, ) -> Result, ErrorCode> { let sess = self.matchmake_manager.get_session(gid).await?; let mut sess = sess.lock().await; diff --git a/rnex-core/src/rmc/protocols/matchmake_extension.rs b/rnex-core/src/rmc/protocols/matchmake_extension.rs index 7591a48..6bc8ac5 100644 --- a/rnex-core/src/rmc/protocols/matchmake_extension.rs +++ b/rnex-core/src/rmc/protocols/matchmake_extension.rs @@ -42,7 +42,8 @@ pub trait MatchmakeExtension { gid: u32, message: String, dont_care_block_list: bool, - participation_count: u16, + // this is to cheat support for v3-3-0 + //participation_count: u16, ) -> Result, ErrorCode>; #[method_id(8)] From e027da24c6e69a051c775a67037b671cad456bcd Mon Sep 17 00:00:00 2001 From: Spacebot Date: Tue, 28 Apr 2026 14:20:23 +0000 Subject: [PATCH 6/6] Update Rust crate async-trait to v0.1.89 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e666c9d..ac34ab7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,9 +31,9 @@ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "async-trait" -version = "0.1.88" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote",