aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/lib.rs3
-rw-r--r--core/src/pad_data/game_profile.rs1
-rw-r--r--core/src/pad_data/pad_player_info.rs1
-rw-r--r--core/src/pad_service/client.rs2
-rw-r--r--core/src/pad_service/server.rs9
5 files changed, 9 insertions, 7 deletions
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<u8> = 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<Mutex<VecDeque<ControlMessage>>>;
type ReadList = Arc<Mutex<VecDeque<GameMessage>>>;
+ #[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<Mutex<HashMap<String, VecDeque<GameMessage>>>>;
type ReadList = Arc<Mutex<HashMap<String, VecDeque<ControlMessage>>>>;
+ #[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)
}