redo macros
All checks were successful
Build and Test / splatoon-testfire (push) Successful in 4m29s
Build and Test / puyopuyo (push) Successful in 5m3s
Build and Test / splatoon (push) Successful in 5m40s
Build and Test / wii-sports-club (push) Successful in 5m46s
Build and Test / fast-racing-neo (push) Successful in 6m30s
Build and Test / wii-u-chat (push) Successful in 7m18s
Build and Test / friends (push) Successful in 8m19s
Build and Test / super-mario-maker (push) Successful in 13m10s
Build and Test / mario-tennis (push) Successful in 13m34s
Build and Test / minecraft-wiiu (push) Successful in 14m8s

This commit is contained in:
Maple Nebel 2026-05-04 16:06:25 +02:00
commit de20212d1e
15 changed files with 1189 additions and 966 deletions

View file

@ -40,9 +40,7 @@ use cfg_if::cfg_if;
use log::{error, info};
use macros::rmc_struct;
use rnex_core::prudp::socket_addr::PRUDPSockAddr;
use rnex_core::rmc::protocols::notifications::{
self, Notification, NotificationEvent, RemoteNotification,
};
use rnex_core::rmc::protocols::notifications::{NotificationEvent, RemoteNotification};
use rnex_core::rmc::protocols::ranking::{
CompetitionRankingGetParam, CompetitionRankingScoreData, CompetitionRankingScoreInfo,
};
@ -53,7 +51,6 @@ use rnex_core::rmc::structures::ranking::UploadCompetitionData;
use std::sync::{Arc, Weak};
use tokio::sync::{Mutex, RwLock};
use crate::rmc::structures::Error;
use crate::rmc::structures::matchmake::MatchmakeSessionSearchCriteria;
cfg_if! {
@ -185,15 +182,13 @@ impl MatchmakeExtension for User {
Ok(Vec::new())
}
#[cfg(feature = "v3-5-0")]
async fn update_progress_score(&self, gid: u32, progress: u8) -> Result<(), ErrorCode> {
#[cfg(feature = "v3-5-0")]
{
let session = self.matchmake_manager.get_session(gid).await?;
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(())
}
@ -442,7 +437,7 @@ impl MatchmakeExtension for User {
async fn get_friend_notification_data(
&self,
ty: i32,
_ty: i32,
) -> Result<Vec<NotificationEvent>, ErrorCode> {
Ok(vec![])
}
@ -503,7 +498,7 @@ impl MatchmakeExtension for User {
&self,
gid: u32,
message: String,
dont_care_block_list: bool,
_dont_care_block_list: bool,
//participation_count: u16,
) -> Result<Vec<u8>, ErrorCode> {
let sess = self.matchmake_manager.get_session(gid).await?;

View file

@ -66,6 +66,7 @@ pub trait MatchmakeExtension {
async fn get_playing_session(&self, pids: Vec<u32>) -> Result<Vec<()>, ErrorCode>;
#[method_id(34)]
#[cfg(feature = "v3-5-0")]
async fn update_progress_score(&self, gid: u32, progress: u8) -> Result<(), ErrorCode>;
#[method_id(38)]
async fn create_matchmake_session_with_param(

View file

@ -21,7 +21,6 @@ use crate::rmc::response::{ErrorCode, RMCResponse, RMCResponseResult};
use crate::rmc::structures;
use crate::rmc::structures::RmcSerialize;
use crate::util::{SendingBufferConnection, SplittableBufferConnection};
use futures::FutureExt;
use log::{error, info};
use std::collections::HashMap;
use std::future::Future;

View file

@ -1,11 +1,6 @@
use macros::{RmcSerialize, method_id, rmc_proto};
use macros::{method_id, rmc_proto};
use rnex_core::{
PID,
rmc::{response::ErrorCode, structures::any::Any},
};
use crate::{kerberos::KerberosDateTime, rmc::protocols::friends::NNAInfo};
use rnex_core::rmc::response::ErrorCode;
#[rmc_proto(110)]
pub trait Utility {

View file

@ -20,6 +20,8 @@ pub enum Error {
StationUrlInvalid,
#[error("error formatting text: {0}")]
FormatError(#[from] fmt::Error),
#[error("uncategorized rmc error occurred: {0}")]
Other(Box<dyn std::error::Error + Send + Sync>),
}
pub type Result<T> = std::result::Result<T, Error>;
@ -36,10 +38,11 @@ pub mod primitives;
pub mod qbuffer;
pub mod qresult;
pub mod ranking;
pub mod resultsrange;
pub mod rmc_struct;
pub mod string;
pub mod string_set;
pub mod variant;
pub mod resultsrange;
pub trait RmcSerialize {
fn serialize(&self, writer: &mut impl Write) -> Result<()>;
@ -67,6 +70,9 @@ pub trait RmcSerialize {
fn name() -> &'static str {
"NoNameSpecified"
}
fn version() -> Option<u8> {
None
}
}
impl RmcSerialize for () {

View file

@ -0,0 +1,86 @@
use std::{collections::HashSet, hash::Hash, str::FromStr, string::ToString};
use rnex_core::rmc::structures::RmcSerialize;
#[derive(Debug)]
struct StringSet<T: FromStr + ToString + Eq>(HashSet<T>)
where
<T as FromStr>::Err: std::error::Error + Send + Sync + 'static;
impl<T: FromStr + ToString + Eq + Hash> PartialEq for StringSet<T>
where
<T as FromStr>::Err: std::error::Error + Send + Sync + 'static,
{
fn eq(&self, other: &Self) -> bool {
self.0.iter().eq(&other.0)
}
}
impl<T: FromStr + ToString + Eq + Hash> ToString for StringSet<T>
where
<T as FromStr>::Err: std::error::Error + Send + Sync + 'static,
{
fn to_string(&self) -> String {
self.0
.iter()
.map(ToString::to_string)
.reduce(|a, b| format!("{}|{}", a, b))
.unwrap_or(String::new())
}
}
impl<T: FromStr + ToString + Eq + Hash> FromStr for StringSet<T>
where
<T as FromStr>::Err: std::error::Error + Send + Sync + 'static,
{
type Err = Box<dyn std::error::Error + Send + Sync>;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self(s.split("|").map(T::from_str).try_fold(
HashSet::new(),
|mut a, b| -> Result<HashSet<T>, Self::Err> {
a.insert(b.map_err(Box::new)?);
Ok(a)
},
)?))
}
}
impl<T: FromStr + ToString + Eq + Hash> RmcSerialize for StringSet<T>
where
<T as FromStr>::Err: std::error::Error + Send + Sync + 'static,
{
fn deserialize(reader: &mut impl std::io::prelude::Read) -> super::Result<Self>
where
Self: Sized,
{
Self::from_str(&String::deserialize(reader)?).map_err(super::Error::Other)
}
fn serialize(&self, writer: &mut impl std::io::prelude::Write) -> super::Result<()> {
self.to_string().serialize(writer)
}
fn serialize_write_size(&self) -> super::Result<u32> {
self.to_string().serialize_write_size()
}
}
#[cfg(test)]
mod test {
use std::str::FromStr;
use crate::rmc::structures::string_set::StringSet;
#[test]
fn test() {
let str_val = "0|100|200|10|110|210|20|120|220|30|130|230";
let set: StringSet<u32> = StringSet::from_str(str_val).unwrap();
let string_2 = set.to_string();
let reset: StringSet<u32> = StringSet::from_str(&string_2).unwrap();
for val in &set.0 {
if !reset.0.contains(&val) {
panic!("sets arent equivalent");
}
}
}
}

View file

@ -12,7 +12,7 @@ pub struct ConnectionInitData {
mod test {
use std::{
io::Cursor,
net::{IpAddr, Ipv4Addr, SocketAddr, SocketAddrV4},
net::{Ipv4Addr, SocketAddr, SocketAddrV4},
};
use crate::{