From c0244a9d6f657934313e03f67a4b9fa9d93d34b7 Mon Sep 17 00:00:00 2001 From: "1992414357@qq.com" <1992414357@qq.com> Date: Wed, 28 May 2025 09:11:31 +0800 Subject: . --- core/src/lib.rs | 3 +-- core/src/pad_data/game_profile.rs | 1 + core/src/pad_data/pad_player_info.rs | 1 + core/src/pad_service/client.rs | 2 +- core/src/pad_service/server.rs | 9 +++++---- 5 files changed, 9 insertions(+), 7 deletions(-) (limited to 'core/src') diff --git a/core/src/lib.rs b/core/src/lib.rs index 1abb191..0c8cf83 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -6,5 +6,4 @@ pub mod pad_data; pub const DEFAULT_PORT : u16 = 5989; pub const BINCODE_CONVERT_FAILED : Vec = Vec::new(); -pub const BINCODE_CONFIG : Configuration = config::standard(); - +pub const BINCODE_CONFIG : Configuration = config::standard(); \ No newline at end of file diff --git a/core/src/pad_data/game_profile.rs b/core/src/pad_data/game_profile.rs index 8d6e279..cd2a175 100644 --- a/core/src/pad_data/game_profile.rs +++ b/core/src/pad_data/game_profile.rs @@ -3,6 +3,7 @@ pub mod game_profile { use bincode::{Decode, Encode}; use serde::{Deserialize, Serialize}; + #[repr(C)] #[derive(Encode, Decode, Serialize, Deserialize, PartialEq, Debug)] pub struct GameProfile { diff --git a/core/src/pad_data/pad_player_info.rs b/core/src/pad_data/pad_player_info.rs index ab0f6fd..1c8b7e0 100644 --- a/core/src/pad_data/pad_player_info.rs +++ b/core/src/pad_data/pad_player_info.rs @@ -7,6 +7,7 @@ pub mod nogamepads_player_info { pub const ACCOUNT_HASH_SALT : &str = "Mr.Weicao"; + #[repr(C)] #[derive(Encode, Decode, Serialize, Deserialize, PartialEq, Debug)] diff --git a/core/src/pad_service/client.rs b/core/src/pad_service/client.rs index 3114330..be7784d 100644 --- a/core/src/pad_service/client.rs +++ b/core/src/pad_service/client.rs @@ -25,6 +25,7 @@ pub mod nogamepads_client { type WriteList = Arc>>; type ReadList = Arc>>; + #[repr(C)] pub struct PadClient { // --- 主要参数 --- @@ -108,7 +109,6 @@ pub mod nogamepads_client { // 客户端消息管理 impl PadClient { - pub fn put_msg(&self, msg: ControlMessage) { let mut guard = self.write_list.lock().unwrap(); guard.push_back(msg); diff --git a/core/src/pad_service/server.rs b/core/src/pad_service/server.rs index 3c60864..66ab56d 100644 --- a/core/src/pad_service/server.rs +++ b/core/src/pad_service/server.rs @@ -30,6 +30,7 @@ pub mod nogamepads_server { type WriteList = Arc>>>; type ReadList = Arc>>>; + #[repr(C)] pub struct PadServer { // --- 主要参数 --- @@ -237,7 +238,7 @@ pub mod nogamepads_server { guard.contains_key(&player.account.player_hash) } - pub fn set_player_online (&self, player: &PlayerInfo, online: bool) { + fn set_player_online (&self, player: &PlayerInfo, online: bool) { let online_current = self.is_player_online(player); if online_current && !online { let mut guard = self.online_players.lock().unwrap(); @@ -374,15 +375,15 @@ pub mod nogamepads_server { } } - fn lock_game(&self) { + pub fn lock_game(&self) { self.game_locked.store(true, SeqCst); } - fn unlock_game(&self) { + pub fn unlock_game(&self) { self.game_locked.store(false, SeqCst); } - fn is_game_locked(&self) -> bool { + pub fn is_game_locked(&self) -> bool { self.game_locked.load(SeqCst) } -- cgit