diff --git a/src/entity/character.rs b/src/entity/character.rs index 3bff770..599e01b 100644 --- a/src/entity/character.rs +++ b/src/entity/character.rs @@ -295,7 +295,7 @@ impl CharacterKeyboardConfig { _ => { CharacterKeyboardConfig { keyboard_config: DEFAULT_KEYBOARD_CONFIG1, - } + } }, } } @@ -311,13 +311,13 @@ impl CharacterKeyboardConfig { #[derive(Clone)] pub struct CharacterGamepadConfig { - pub gamepad_config: [u8; 56], + pub gamepad_config: [u8; 0x38], } impl Default for CharacterGamepadConfig { fn default() -> CharacterGamepadConfig { CharacterGamepadConfig { - gamepad_config: [0; 56], + gamepad_config: DEFAULT_GAMEPAD_CONFIG, } } } @@ -327,7 +327,7 @@ impl CharacterGamepadConfig { self.gamepad_config = new_config.gamepad_config; } - pub fn as_bytes(&self) -> [u8; 56] { + pub fn as_bytes(&self) -> [u8; 0x38] { self.gamepad_config } } diff --git a/src/entity/gateway/postgres/postgres.rs b/src/entity/gateway/postgres/postgres.rs index f52da90..39be9ac 100644 --- a/src/entity/gateway/postgres/postgres.rs +++ b/src/entity/gateway/postgres/postgres.rs @@ -144,7 +144,7 @@ impl EntityGateway for PostgresGateway { } async fn create_user_settings(&mut self, settings: NewUserSettingsEntity) -> Result { - let new_settings = sqlx::query_as::<_, PgUserSettings>("insert into user_settings (user_account, blocked_users, key_config, gamepad_config, option_flags, shortcuts, symbol_chats, team_name) + let new_settings = sqlx::query_as::<_, PgUserSettings>("insert into user_settings (user_account, blocked_users, keyboard_config, gamepad_config, option_flags, shortcuts, symbol_chats, team_name) values ($1, $2, $3, $4, $5, $6, $7, $8) returning *;") .bind(settings.user_id.0) .bind(settings.settings.blocked_users.iter().copied().flat_map(|i| i.to_le_bytes().to_vec()).collect::>()) @@ -166,7 +166,7 @@ impl EntityGateway for PostgresGateway { } async fn save_user_settings(&mut self, settings: &UserSettingsEntity) -> Result<(), GatewayError> { - sqlx::query("update user_settings set blocked_users=$1, key_config=$2, gamepad_config=$3, option_flags=$4, shortcuts=$5, symbol_chats=$6, team_name=$7 where id=$8") + sqlx::query("update user_settings set blocked_users=$1, keyboard_config=$2, gamepad_config=$3, option_flags=$4, shortcuts=$5, symbol_chats=$6, team_name=$7 where id=$8") .bind(settings.settings.blocked_users.iter().copied().flat_map(|i| i.to_le_bytes().to_vec()).collect::>()) .bind(&settings.settings.keyboard_config.to_vec()) .bind(&settings.settings.gamepad_config.to_vec()) diff --git a/src/ship/character.rs b/src/ship/character.rs index 0760b42..d4676c9 100644 --- a/src/ship/character.rs +++ b/src/ship/character.rs @@ -174,7 +174,7 @@ impl<'a> FullCharacterBytesBuilder<'a> { } #[must_use] - pub fn joystick_config(self, gamepad_config: &'a [u8; 0x38]) -> FullCharacterBytesBuilder<'a> { + pub fn gamepad_config(self, gamepad_config: &'a [u8; 0x38]) -> FullCharacterBytesBuilder<'a> { FullCharacterBytesBuilder { gamepad_config: Some(gamepad_config), ..self diff --git a/src/ship/packet/handler/lobby.rs b/src/ship/packet/handler/lobby.rs index 48973fc..37f18da 100644 --- a/src/ship/packet/handler/lobby.rs +++ b/src/ship/packet/handler/lobby.rs @@ -32,10 +32,8 @@ pub fn block_selected(id: ClientId, .meseta(*meseta) .inventory(inventory) .bank(bank) - // .keyboard_config(&client.settings.settings.keyboard_config) - // .joystick_config(&client.settings.settings.joystick_config) .keyboard_config(&client.character.keyboard_config.as_bytes()) - .joystick_config(&client.character.gamepad_config.as_bytes()) + .gamepad_config(&client.character.gamepad_config.as_bytes()) .symbol_chat(&client.settings.settings.symbol_chats) .tech_menu(&client.character.tech_menu.as_bytes()) .option_flags(client.character.option_flags)