stuff
Some checks failed
Build and Test / super-mario-maker (push) Failing after 4m39s
Build and Test / wii-u-chat (push) Successful in 6m28s
Build and Test / puyopuyo (push) Successful in 6m28s
Build and Test / mario-tennis (push) Successful in 6m29s
Build and Test / fast-racing-neo (push) Successful in 6m28s
Build and Test / wii-sports-club (push) Successful in 6m28s
Build and Test / friends (push) Successful in 6m28s
Build and Test / splatoon (push) Successful in 6m29s
Build and Test / minecraft-wiiu (push) Successful in 6m30s
Build and Test / splatoon-testfire (push) Successful in 6m38s
Build and Test / sonic-transformed (push) Successful in 6m49s

This commit is contained in:
Maple Nebel 2026-06-10 21:34:18 +02:00
commit 0f94a33564
13 changed files with 39 additions and 27 deletions

View file

@ -3,9 +3,12 @@ use std::io::Write;
use hmac::Mac; use hmac::Mac;
use md5::{Digest, Md5}; use md5::{Digest, Md5};
use rc4::{KeyInit, Rc4, StreamCipher}; use rc4::{KeyInit, Rc4, StreamCipher};
use rnex_core::prudp::{ use rnex_core::{
encryption::{DEFAULT_KEY, EncryptionPair}, PID,
types_flags::{TypesFlags, types::DATA}, prudp::{
encryption::{DEFAULT_KEY, EncryptionPair},
types_flags::{TypesFlags, types::DATA},
},
}; };
use typenum::U5; use typenum::U5;
@ -29,7 +32,7 @@ impl CryptoInstance for InsecureInstance {
fn encrypt_outgoing(&mut self, data: &mut [u8]) { fn encrypt_outgoing(&mut self, data: &mut [u8]) {
self.pair.send.apply_keystream(data); self.pair.send.apply_keystream(data);
} }
fn get_user_id(&self) -> u32 { fn get_user_id(&self) -> PID {
0 0
} }
fn generate_signature(&self, types_flags: TypesFlags, data: &[u8]) -> [u8; 4] { fn generate_signature(&self, types_flags: TypesFlags, data: &[u8]) -> [u8; 4] {

View file

@ -2,6 +2,7 @@ use hmac::Mac;
use md5::{Digest, Md5}; use md5::{Digest, Md5};
use rc4::{KeyInit, Rc4, StreamCipher}; use rc4::{KeyInit, Rc4, StreamCipher};
use rnex_core::{ use rnex_core::{
PID,
executables::common::SECURE_SERVER_ACCOUNT, executables::common::SECURE_SERVER_ACCOUNT,
nex::account::Account, nex::account::Account,
prudp::{ prudp::{
@ -22,7 +23,7 @@ use crate::crypto::{
pub struct SecureInstance { pub struct SecureInstance {
pair: EncryptionPair<Rc4<U16>>, pair: EncryptionPair<Rc4<U16>>,
uid: u32, uid: PID,
self_signat: [u8; 4], self_signat: [u8; 4],
#[allow(dead_code)] #[allow(dead_code)]
remote_signat: [u8; 4], remote_signat: [u8; 4],
@ -35,7 +36,7 @@ impl CryptoInstance for SecureInstance {
fn encrypt_outgoing(&mut self, data: &mut [u8]) { fn encrypt_outgoing(&mut self, data: &mut [u8]) {
self.pair.send.apply_keystream(data); self.pair.send.apply_keystream(data);
} }
fn get_user_id(&self) -> u32 { fn get_user_id(&self) -> PID {
self.uid self.uid
} }
fn generate_signature(&self, types_flags: TypesFlags, data: &[u8]) -> [u8; 4] { fn generate_signature(&self, types_flags: TypesFlags, data: &[u8]) -> [u8; 4] {

View file

@ -1,5 +1,5 @@
use cfg_if::cfg_if; use cfg_if::cfg_if;
use rnex_core::prudp::types_flags::TypesFlags; use rnex_core::{PID, prudp::types_flags::TypesFlags};
mod common_crypto; mod common_crypto;
@ -7,7 +7,7 @@ pub trait CryptoInstance: Send + 'static {
fn decrypt_incoming(&mut self, data: &mut [u8]); fn decrypt_incoming(&mut self, data: &mut [u8]);
fn encrypt_outgoing(&mut self, data: &mut [u8]); fn encrypt_outgoing(&mut self, data: &mut [u8]);
fn generate_signature(&self, types_flags: TypesFlags, data: &[u8]) -> [u8; 4]; fn generate_signature(&self, types_flags: TypesFlags, data: &[u8]) -> [u8; 4];
fn get_user_id(&self) -> u32; fn get_user_id(&self) -> PID;
} }
pub trait Crypto: Send + Sync + 'static { pub trait Crypto: Send + Sync + 'static {

View file

@ -3,6 +3,7 @@ use crate::prudp::socket::{CryptoHandler, CryptoHandlerConnectionInstance};
use hmac::digest::consts::U32; use hmac::digest::consts::U32;
use rc4::cipher::StreamCipherCoreWrapper; use rc4::cipher::StreamCipherCoreWrapper;
use rc4::{KeyInit, Rc4, Rc4Core, StreamCipher}; use rc4::{KeyInit, Rc4, Rc4Core, StreamCipher};
use rnex_core::PID;
use rnex_core::nex::account::Account; use rnex_core::nex::account::Account;
use rnex_core::prudp::encryption::EncryptionPair; use rnex_core::prudp::encryption::EncryptionPair;
use rnex_core::prudp::ticket::read_secure_connection_data; use rnex_core::prudp::ticket::read_secure_connection_data;
@ -49,7 +50,7 @@ pub struct SecureInstance {
self_signature: [u8; 16], self_signature: [u8; 16],
#[allow(dead_code)] #[allow(dead_code)]
remote_signature: [u8; 16], remote_signature: [u8; 16],
pid: u32, pid: PID,
} }
impl CryptoHandler for Secure { impl CryptoHandler for Secure {
@ -108,7 +109,7 @@ impl CryptoHandlerConnectionInstance for SecureInstance {
} }
} }
fn get_user_id(&self) -> u32 { fn get_user_id(&self) -> i32 {
self.pid self.pid
} }

View file

@ -6,6 +6,7 @@ use async_trait::async_trait;
use log::error; use log::error;
use log::{info, warn}; use log::{info, warn};
use rc4::StreamCipher; use rc4::StreamCipher;
use rnex_core::PID;
use rnex_core::prudp::socket_addr::PRUDPSockAddr; use rnex_core::prudp::socket_addr::PRUDPSockAddr;
use rnex_core::prudp::types_flags::TypesFlags; use rnex_core::prudp::types_flags::TypesFlags;
use rnex_core::prudp::types_flags::flags::{ACK, HAS_SIZE, MULTI_ACK, NEED_ACK, RELIABLE}; use rnex_core::prudp::types_flags::flags::{ACK, HAS_SIZE, MULTI_ACK, NEED_ACK, RELIABLE};
@ -31,7 +32,7 @@ use tokio::time::{Instant, sleep};
/// PRUDP Socket for accepting connections to then send and recieve data from those clients /// PRUDP Socket for accepting connections to then send and recieve data from those clients
pub struct CommonConnection { pub struct CommonConnection {
pub user_id: u32, pub user_id: PID,
pub socket_addr: PRUDPSockAddr, pub socket_addr: PRUDPSockAddr,
pub server_port: VirtualPort, pub server_port: VirtualPort,
session_id: u8, session_id: u8,
@ -851,7 +852,7 @@ pub trait CryptoHandlerConnectionInstance: Send + Sync + 'static {
fn decrypt_incoming(&mut self, substream: u8, data: &mut [u8]); fn decrypt_incoming(&mut self, substream: u8, data: &mut [u8]);
fn encrypt_outgoing(&mut self, substream: u8, data: &mut [u8]); fn encrypt_outgoing(&mut self, substream: u8, data: &mut [u8]);
fn get_user_id(&self) -> u32; fn get_user_id(&self) -> i32;
fn sign_connect(&self, packet: &mut PRUDPV1Packet); fn sign_connect(&self, packet: &mut PRUDPV1Packet);
fn sign_packet(&self, packet: &mut PRUDPV1Packet); fn sign_packet(&self, packet: &mut PRUDPV1Packet);
fn verify_packet(&self, packet: &PRUDPV1Packet) -> bool; fn verify_packet(&self, packet: &PRUDPV1Packet) -> bool;

View file

@ -62,7 +62,7 @@ impl CryptoHandlerConnectionInstance for UnsecureInstance {
} }
} }
fn get_user_id(&self) -> u32 { fn get_user_id(&self) -> i32 {
0 0
} }

View file

@ -166,7 +166,7 @@ impl Client {
.find(|v| v.0 == "pid") .find(|v| v.0 == "pid")
.ok_or(SomethingHappened)? .ok_or(SomethingHappened)?
.1 .1
.as_u32() .as_i32()
else { else {
return Err(SomethingHappened); return Err(SomethingHappened);
}; };

View file

@ -5,9 +5,9 @@
//#![warn(missing_docs)] //#![warn(missing_docs)]
#[cfg(feature = "big_pid")] #[cfg(feature = "big_pid")]
pub type PID = u64; pub type PID = i64;
#[cfg(not(feature = "big_pid"))] #[cfg(not(feature = "big_pid"))]
pub type PID = u32; pub type PID = i32;
extern crate self as rnex_core; extern crate self as rnex_core;

View file

@ -32,6 +32,7 @@ use rnex_core::{
structures::{any::Any, qresult::QResult}, structures::{any::Any, qresult::QResult},
}, },
}; };
use sqlx::query;
use std::sync::atomic::Ordering::Relaxed; use std::sync::atomic::Ordering::Relaxed;
use tokio::spawn; use tokio::spawn;
use tokio::sync::RwLock; use tokio::sync::RwLock;
@ -46,6 +47,8 @@ use rnex_core::rmc::structures::RmcSerialize;
use rnex_core::rmc::structures::data::Data; use rnex_core::rmc::structures::data::Data;
use crate::executables::common::get_db;
define_rmc_proto!( define_rmc_proto!(
proto FriendsUser{ proto FriendsUser{
Secure, Secure,
@ -117,7 +120,8 @@ impl FriendsWiiU for FriendsUser {
), ),
ErrorCode, ErrorCode,
> { > {
todo!() // let query = query!("select ", self.pid).fetch_all(get_db()).await;
Err(ErrorCode::Core_NotImplemented)
} }
async fn add_friend(&self, friend: PID) -> Result<(FriendRequest, FriendInfo), ErrorCode> { async fn add_friend(&self, friend: PID) -> Result<(FriendRequest, FriendInfo), ErrorCode> {

View file

@ -26,7 +26,7 @@ pub struct MatchmakeManager {
pub sessions: RwLock<HashMap<u32, Arc<Mutex<ExtendedMatchmakeSession>>>>, pub sessions: RwLock<HashMap<u32, Arc<Mutex<ExtendedMatchmakeSession>>>>,
pub rv_cid_counter: AtomicU32, pub rv_cid_counter: AtomicU32,
pub users: RwLock<HashMap<u32, Weak<User>>>, pub users: RwLock<HashMap<u32, Weak<User>>>,
pub users_by_pid: RwLock<HashMap<u32, Weak<User>>>, pub users_by_pid: RwLock<HashMap<PID, Weak<User>>>,
} }
impl MatchmakeManager { impl MatchmakeManager {

View file

@ -455,7 +455,7 @@ impl MatchmakeExtension for User {
.users_by_pid .users_by_pid
.read() .read()
.await .await
.get(&recpipent) .get(&bytemuck::cast(recpipent))
.and_then(|v| v.upgrade()) .and_then(|v| v.upgrade())
else { else {
return Err(ErrorCode::Core_InvalidArgument); return Err(ErrorCode::Core_InvalidArgument);
@ -467,8 +467,8 @@ impl MatchmakeExtension for User {
.process_notification_event(NotificationEvent { .process_notification_event(NotificationEvent {
pid_source: self.pid, pid_source: self.pid,
notif_type: REQUEST_JOIN_GATHERING * 1000, notif_type: REQUEST_JOIN_GATHERING * 1000,
param_1, param_1: bytemuck::cast(param_1),
param_2, param_2: bytemuck::cast(param_2),
#[cfg(feature = "third-notif-param")] #[cfg(feature = "third-notif-param")]
param_3: 0, param_3: 0,
str_param, str_param,
@ -480,8 +480,8 @@ impl MatchmakeExtension for User {
.process_notification_event(NotificationEvent { .process_notification_event(NotificationEvent {
pid_source: self.pid, pid_source: self.pid,
notif_type: END_GATHERING * 1000, notif_type: END_GATHERING * 1000,
param_1, param_1: bytemuck::cast(param_1),
param_2, param_2: bytemuck::cast(param_2),
#[cfg(feature = "third-notif-param")] #[cfg(feature = "third-notif-param")]
param_3: 0, param_3: 0,
str_param, str_param,

View file

@ -23,7 +23,7 @@ pub struct MiiV2 {
pub struct PrincipalBasicInfo { pub struct PrincipalBasicInfo {
#[extends] #[extends]
pub data: Data, pub data: Data,
pub pid: u32, pub pid: PID,
pub nnid: String, pub nnid: String,
pub mii: MiiV2, pub mii: MiiV2,
pub unk: u8, pub unk: u8,

View file

@ -1,10 +1,12 @@
use macros::{RmcSerialize, method_id, rmc_proto}; use macros::{RmcSerialize, method_id, rmc_proto};
use rnex_core::kerberos::KerberosDateTime; use rnex_core::kerberos::KerberosDateTime;
use rnex_core::rmc::structures::qbuffer::QBuffer;
use rnex_core::rmc::structures::resultsrange::ResultsRange;
use rnex_core::rmc::response::ErrorCode; use rnex_core::rmc::response::ErrorCode;
use rnex_core::rmc::structures::qbuffer::QBuffer;
use rnex_core::rmc::structures::ranking::UploadCompetitionData; use rnex_core::rmc::structures::ranking::UploadCompetitionData;
use rnex_core::rmc::structures::resultsrange::ResultsRange;
use crate::PID;
#[derive(RmcSerialize, Debug, Default, Clone)] #[derive(RmcSerialize, Debug, Default, Clone)]
#[rmc_struct(1)] #[rmc_struct(1)]
@ -28,7 +30,7 @@ pub struct CompetitionRankingScoreInfo {
#[rmc_struct(0)] #[rmc_struct(0)]
pub struct CompetitionRankingScoreData { pub struct CompetitionRankingScoreData {
pub unk: u32, pub unk: u32,
pub pid: u32, pub pid: PID,
pub score: u32, pub score: u32,
pub modified: KerberosDateTime, pub modified: KerberosDateTime,
pub unk2: u8, pub unk2: u8,