lots of changes

This commit is contained in:
Maple 2026-02-01 20:59:23 +01:00
commit 3b6de6968d
24 changed files with 879 additions and 258 deletions

View file

@ -1,4 +1,4 @@
use crate::rmc::structures::connection_data::ConnectionData;
use crate::rmc::structures::connection_data::{ConnectionData, ConnectionDataOld};
use macros::{method_id, rmc_proto};
use rnex_core::rmc::response::ErrorCode;
use rnex_core::rmc::structures::any::Any;
@ -14,7 +14,7 @@ pub trait Auth {
async fn login(
&self,
name: String,
) -> Result<(QResult, u32, Vec<u8>, ConnectionData, String), ErrorCode>;
) -> Result<(QResult, u32, Vec<u8>, ConnectionDataOld, String), ErrorCode>;
/// representation of the `LoginEx` method(for details see the
/// [kinnay wiki entry](https://github.com/kinnay/NintendoClients/wiki/Authentication-Protocol))

View file

@ -0,0 +1,146 @@
use macros::{RmcSerialize, method_id, rmc_proto};
use rnex_core::{kerberos::KerberosDateTime, rmc::response::ErrorCode};
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct MiiV2 {
pub name: String,
pub unk: u8,
pub unk2: u8,
pub mii_data: Vec<u8>,
pub date_time: KerberosDateTime,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct PrincipalBasicInfo {
pub pid: u32,
pub nnid: String,
pub mii: MiiV2,
pub unk: u8,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct NNAInfo {
pub principal_basic_info: PrincipalBasicInfo,
pub unk: u8,
pub unk2: u8,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct GameKey {
pub tid: u64,
pub version: u16,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct NintendoPresenceV2 {
pub changed_flags: u32,
pub is_online: bool,
pub game_key: GameKey,
pub unk: u8,
pub message: String,
pub unk2: u32,
pub unk3: u8,
pub game_server_id: u32,
pub unk4: u32,
pub pid: u32,
pub gid: u32,
pub app_data: Vec<u8>,
pub unk5: u8,
pub unk6: u8,
pub unk7: u8,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct PrincipalPreference {
pub show_online: bool,
pub show_playing_title: bool,
pub block_friend_request: bool,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct Comment {
pub unk: u8,
pub message: String,
pub last_changed: KerberosDateTime,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct FriendInfo {
pub nna_info: NNAInfo,
pub presence: NintendoPresenceV2,
pub comment: Comment,
pub became_friends: KerberosDateTime,
pub last_online: KerberosDateTime,
pub unk: u64,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct FriendRequestMessage {
pub friend_request_id: u64,
pub is_recieved: u8,
pub unk: u8,
pub message: String,
pub unk2: u8,
pub unk3: String,
pub game_key: GameKey,
pub unk4: KerberosDateTime,
pub expires_on: KerberosDateTime,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct FriendRequest {
pub basic_info: PrincipalBasicInfo,
pub request_message: FriendRequestMessage,
pub sent_on: KerberosDateTime,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct BlacklistedPrincipal {
pub basic_info: PrincipalBasicInfo,
pub game_key: GameKey,
pub since: KerberosDateTime,
}
#[derive(RmcSerialize)]
#[rmc_struct(0)]
pub struct PersistentNotification {
pub unk1: u64,
pub unk2: u32,
pub unk3: u32,
pub unk4: u32,
pub unk5: String,
}
#[rmc_proto(102)]
pub trait Friends {
#[method_id(1)]
async fn update_and_get_all_information(
&self,
info: NNAInfo,
presence: NintendoPresenceV2,
date_time: KerberosDateTime,
) -> Result<
(
PrincipalPreference,
Comment,
Vec<FriendInfo>,
Vec<FriendRequest>,
Vec<FriendRequest>,
Vec<BlacklistedPrincipal>,
bool,
Vec<PersistentNotification>,
bool,
),
ErrorCode,
>;
}

View file

@ -1,6 +1,7 @@
#![allow(async_fn_in_trait)]
pub mod auth;
pub mod friends;
pub mod matchmake;
pub mod matchmake_ext;
pub mod matchmake_extension;
@ -294,8 +295,8 @@ async fn handle_incoming<T: RmcCallable + Send + Sync + 'static>(
} = message;
info!(
"RMC REQUEST: Proto: {}; Method: {};",
protocol_id, method_id
"RMC REQUEST: Proto: {}; Method: {}; cid: {}",
protocol_id, method_id, call_id
);
remote

View file

@ -3,10 +3,21 @@ use rnex_core::prudp::station_url::StationUrl;
use rnex_core::rmc::response::ErrorCode;
use rnex_core::rmc::structures::qresult::QResult;
use crate::rmc::structures::any::Any;
#[rmc_proto(11)]
pub trait Secure {
#[method_id(1)]
async fn register(&self, station_urls: Vec<StationUrl>) -> Result<(QResult, u32, StationUrl), ErrorCode>;
async fn register(
&self,
station_urls: Vec<StationUrl>,
) -> Result<(QResult, u32, StationUrl), ErrorCode>;
#[method_id(4)]
async fn register_ex(
&self,
station_urls: Vec<StationUrl>,
data: Any,
) -> Result<(QResult, u32, StationUrl), ErrorCode>;
#[method_id(7)]
async fn replace_url(&self, target: StationUrl, dest: StationUrl) -> Result<(), ErrorCode>;
}