From 9d92d65046a619cc401ad31f6d0c1630e15d1c7c Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 30 May 2021 19:21:28 +0000 Subject: [PATCH 1/6] keyboard config blob --- src/packet/ship.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/packet/ship.rs b/src/packet/ship.rs index 210dba6..16d8dd5 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -635,3 +635,8 @@ impl std::default::Default for TradeSuccessful { } } } + +#[pso_packet(0x4ED)] +pub struct KeyboardConfig { + pub keyboard_config: [u8; 372], +} -- 2.36.0 From 4ee5f38d7effa22aa46499c5edc297d09ab29e0f Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 28 Dec 2021 03:40:41 +0000 Subject: [PATCH 2/6] add controller config blob --- src/packet/ship.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/packet/ship.rs b/src/packet/ship.rs index 16d8dd5..d2d3293 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -640,3 +640,8 @@ impl std::default::Default for TradeSuccessful { pub struct KeyboardConfig { pub keyboard_config: [u8; 372], } + +#[pso_packet(0x7ED)] +pub struct ControllerConfig { + pub controller_config: [u8; 64], +} \ No newline at end of file -- 2.36.0 From f8f5e8bdb59fb4f33ea00e86f5f3a7b04957e101 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 31 Dec 2021 21:20:43 +0000 Subject: [PATCH 3/6] move defaults from character.rs to settings.rs. rename key_config -> keyboard_config. rename joystick_config -> controller_config. fix packet sizes --- src/character/character.rs | 89 +---------- src/character/settings.rs | 302 ++++++++++++++++++++++++++++++++++++- src/packet/ship.rs | 6 +- 3 files changed, 305 insertions(+), 92 deletions(-) diff --git a/src/character/character.rs b/src/character/character.rs index 137f90a..80e416c 100644 --- a/src/character/character.rs +++ b/src/character/character.rs @@ -3,91 +3,6 @@ // TODO: techniques to enum use psopacket::PSOPacketData; use crate::{PSOPacketData, PacketParseError}; -//use crate::PSOPacketData; - -pub const DEFAULT_PALETTE_CONFIG: [u8; 0xE8] = [ - 0, 0, 0, 0, - 1, 0, 0, 0, - 2, 0, 1, 0, - 2, 1, 1, 0, - 4, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 0, 0, 1, 0, - 1, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0 -]; - -pub const DEFAULT_TECH_MENU: [u8; 40] = [ - 0x00, 0x00, - 0x06, 0x00, - 0x03, 0x00, - 0x01, 0x00, - 0x07, 0x00, - 0x04, 0x00, - 0x02, 0x00, - 0x08, 0x00, - 0x05, 0x00, - 0x09, 0x00, - 0x12, 0x00, - 0x0f, 0x00, - 0x10, 0x00, - 0x11, 0x00, - 0x0d, 0x00, - 0x0a, 0x00, - 0x0b, 0x00, - 0x0c, 0x00, - 0x0e, 0x00, - 0x00, 0x00, -]; #[repr(u32)] #[derive(Copy, Clone, Hash, PartialEq, Eq)] @@ -357,7 +272,7 @@ impl std::default::Default for Bank { #[derive(PSOPacketData, Copy, Clone)] pub struct KeyTeamConfig { pub _unknown: [u8; 0x114], - pub key_config: [u8; 0x16C], + pub keyboard_config: [u8; 0x16C], pub joystick_config: [u8; 0x38], pub guildcard: u32, pub team_id: u32, @@ -438,7 +353,7 @@ pub struct DBChar { #[derive(PSOPacketData, Copy, Clone)] pub struct DBOpts { pub blocked: [u32; 30], - pub key_config: [u8; 0x16C], + pub keyboard_config: [u8; 0x16C], pub joystick_config: [u8; 0x38], pub option_flags: u32, pub shortcuts: [u8; 0xA40], diff --git a/src/character/settings.rs b/src/character/settings.rs index 33b9abd..1693d03 100644 --- a/src/character/settings.rs +++ b/src/character/settings.rs @@ -176,11 +176,309 @@ const DEFAULT_SYMBOLCHATS: [u8; 0x4E0] = [ 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00 ]; +pub const DEFAULT_PALETTE_CONFIG: [u8; 0xE8] = [ + 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x01, 0x00, + 0x02, 0x01, 0x01, 0x00, + 0x04, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +]; + +pub const DEFAULT_TECH_MENU: [u8; 40] = [ + 0x00, 0x00, + 0x06, 0x00, + 0x03, 0x00, + 0x01, 0x00, + 0x07, 0x00, + 0x04, 0x00, + 0x02, 0x00, + 0x08, 0x00, + 0x05, 0x00, + 0x09, 0x00, + 0x12, 0x00, + 0x0f, 0x00, + 0x10, 0x00, + 0x11, 0x00, + 0x0d, 0x00, + 0x0a, 0x00, + 0x0b, 0x00, + 0x0c, 0x00, + 0x0e, 0x00, + 0x00, 0x00, +]; + +pub const DEFAULT_KEYBOARD_CONFIG1: [u8; 364] = [ +0x00,0x00,0x00,0x00,0x26,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x22,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x61,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x59,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5e,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5d,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5c,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5d,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5c,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x56,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5e,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x41,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x43,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x45,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x47,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x49,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x4a,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x4b,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2b,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2e,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2f,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x31,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00, +0x01,0x00,0x00,0x00, +]; + +pub const DEFAULT_KEYBOARD_CONFIG2: [u8; 364] = [ +0x00,0x00,0x00,0x00,0x26,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x22,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x61,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x59,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5e,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5d,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5c,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x56,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x41,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x43,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x45,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x47,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x49,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x4a,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x4b,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2b,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2e,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x2f,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x31,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00, +0x01,0x00,0x00,0x00, +]; + +pub const DEFAULT_KEYBOARD_CONFIG3: [u8; 364] = [ + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, +]; + +pub const DEFAULT_KEYBOARD_CONFIG4: [u8; 364] = [ + 0x00, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, + ]; + +pub const DEFAULT_CONTROLLER_CONFIG: [u8; 56] = [ + 0x00, 0x01, 0xff, 0xff, + 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, + 0x80, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, + ]; + + #[derive(Copy, Clone)] #[repr(C)] pub struct UserSettings { pub blocked_users: [u32; 0x1E], - pub key_config: [u8; 0x16C], + pub keyboard_config: [u8; 0x16C], pub joystick_config: [u8; 0x38], pub option_flags: u32, pub shortcuts: [u8; 0xA40], @@ -193,7 +491,7 @@ impl Default for UserSettings { fn default() -> UserSettings { UserSettings { blocked_users: [0; 0x1E], - key_config: DEFAULT_KEY_CONFIG, + keyboard_config: DEFAULT_KEY_CONFIG, joystick_config: DEFAULT_JOYSTICK_CONFIG, option_flags: 0, shortcuts: [0; 0xA40], diff --git a/src/packet/ship.rs b/src/packet/ship.rs index d2d3293..19da1e7 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -638,10 +638,10 @@ impl std::default::Default for TradeSuccessful { #[pso_packet(0x4ED)] pub struct KeyboardConfig { - pub keyboard_config: [u8; 372], + pub keyboard_config: [u8; 364], } -#[pso_packet(0x7ED)] +#[pso_packet(0x5ED)] pub struct ControllerConfig { - pub controller_config: [u8; 64], + pub controller_config: [u8; 56], } \ No newline at end of file -- 2.36.0 From a417b08e4ebcab0af15955b52bf120bbf6540503 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 31 Dec 2021 21:22:54 +0000 Subject: [PATCH 4/6] joystick_config -> controller_config for consistency --- src/character/character.rs | 4 ++-- src/character/settings.rs | 4 ++-- src/packet/login.rs | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/character/character.rs b/src/character/character.rs index 80e416c..7dc6751 100644 --- a/src/character/character.rs +++ b/src/character/character.rs @@ -273,7 +273,7 @@ impl std::default::Default for Bank { pub struct KeyTeamConfig { pub _unknown: [u8; 0x114], pub keyboard_config: [u8; 0x16C], - pub joystick_config: [u8; 0x38], + pub controller_config: [u8; 0x38], pub guildcard: u32, pub team_id: u32, pub team_info: [u32; 2], @@ -354,7 +354,7 @@ pub struct DBChar { pub struct DBOpts { pub blocked: [u32; 30], pub keyboard_config: [u8; 0x16C], - pub joystick_config: [u8; 0x38], + pub controller_config: [u8; 0x38], pub option_flags: u32, pub shortcuts: [u8; 0xA40], pub symbol_chats: [u8; 0x4E0], diff --git a/src/character/settings.rs b/src/character/settings.rs index 1693d03..881425c 100644 --- a/src/character/settings.rs +++ b/src/character/settings.rs @@ -479,7 +479,7 @@ pub const DEFAULT_CONTROLLER_CONFIG: [u8; 56] = [ pub struct UserSettings { pub blocked_users: [u32; 0x1E], pub keyboard_config: [u8; 0x16C], - pub joystick_config: [u8; 0x38], + pub controller_config: [u8; 0x38], pub option_flags: u32, pub shortcuts: [u8; 0xA40], pub symbol_chats: [u8; 0x4E0], @@ -492,7 +492,7 @@ impl Default for UserSettings { UserSettings { blocked_users: [0; 0x1E], keyboard_config: DEFAULT_KEY_CONFIG, - joystick_config: DEFAULT_JOYSTICK_CONFIG, + controller_config: DEFAULT_JOYSTICK_CONFIG, option_flags: 0, shortcuts: [0; 0xA40], symbol_chats: DEFAULT_SYMBOLCHATS, diff --git a/src/packet/login.rs b/src/packet/login.rs index 7a506fd..933e2db 100644 --- a/src/packet/login.rs +++ b/src/packet/login.rs @@ -211,7 +211,7 @@ pub struct RequestSettings { pub struct SendKeyAndTeamSettings { unknown: [u8; 0x114], key_config: [u8; 0x16C], - joystick_config: [u8; 0x38], + controller_config: [u8; 0x38], guildcard: u32, team_id: u32, //team_info: [u32; 2], @@ -226,11 +226,11 @@ pub struct SendKeyAndTeamSettings { } impl SendKeyAndTeamSettings { - pub fn new(key_config: [u8; 0x16C], joystick_config: [u8; 0x38], guildcard: u32, team_id: u32) -> SendKeyAndTeamSettings { + pub fn new(key_config: [u8; 0x16C], controller_config: [u8; 0x38], guildcard: u32, team_id: u32) -> SendKeyAndTeamSettings { SendKeyAndTeamSettings { unknown: [0; 0x114], key_config: key_config, - joystick_config: joystick_config, + controller_config: controller_config, guildcard: guildcard, team_id: team_id, //team_info: [0; 2], @@ -551,16 +551,16 @@ mod tests { let mut rng = rand::thread_rng(); let mut key_config = [0u8; 0x16C]; - let mut joystick_config = [0u8; 0x38]; + let mut controller_config = [0u8; 0x38]; rng.fill(&mut key_config[..]); - rng.fill(&mut joystick_config[..]); - let pkt = super::SendKeyAndTeamSettings::new(key_config, joystick_config, 123, 456); + rng.fill(&mut controller_config[..]); + let pkt = super::SendKeyAndTeamSettings::new(key_config, controller_config, 123, 456); let bytes = pkt.as_bytes(); assert!(bytes[2] == 0xe2); assert!(bytes[8 + 0x114] == key_config[0]); - assert!(bytes[8 + 0x114 + 0x16C] == joystick_config[0]); + assert!(bytes[8 + 0x114 + 0x16C] == controller_config[0]); } #[test] -- 2.36.0 From 8a9c4ceca48476452f97d0df4a85b8246f375083 Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 1 Jan 2022 17:29:39 +0000 Subject: [PATCH 5/6] controller -> gamepad for consistency with in-game --- src/character/character.rs | 4 +- src/character/settings.rs | 345 ++++++++++++++----------------------- src/packet/login.rs | 14 +- src/packet/ship.rs | 4 +- 4 files changed, 137 insertions(+), 230 deletions(-) diff --git a/src/character/character.rs b/src/character/character.rs index 7dc6751..1b0f88b 100644 --- a/src/character/character.rs +++ b/src/character/character.rs @@ -273,7 +273,7 @@ impl std::default::Default for Bank { pub struct KeyTeamConfig { pub _unknown: [u8; 0x114], pub keyboard_config: [u8; 0x16C], - pub controller_config: [u8; 0x38], + pub gamepad_config: [u8; 0x38], pub guildcard: u32, pub team_id: u32, pub team_info: [u32; 2], @@ -354,7 +354,7 @@ pub struct DBChar { pub struct DBOpts { pub blocked: [u32; 30], pub keyboard_config: [u8; 0x16C], - pub controller_config: [u8; 0x38], + pub gamepad_config: [u8; 0x38], pub option_flags: u32, pub shortcuts: [u8; 0xA40], pub symbol_chats: [u8; 0x4E0], diff --git a/src/character/settings.rs b/src/character/settings.rs index 881425c..130638f 100644 --- a/src/character/settings.rs +++ b/src/character/settings.rs @@ -1,6 +1,6 @@ // TODO: deblobify all of this -const DEFAULT_KEY_CONFIG: [u8; 0x16C] = [ +pub const DEFAULT_KEYBOARD_CONFIG1: [u8; 0x16C] = [ 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, @@ -39,7 +39,128 @@ const DEFAULT_KEY_CONFIG: [u8; 0x16C] = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 ]; -const DEFAULT_JOYSTICK_CONFIG: [u8; 0x38] = [ + +pub const DEFAULT_KEYBOARD_CONFIG2: [u8; 364] = [ + 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00 +]; + +pub const DEFAULT_KEYBOARD_CONFIG3: [u8; 364] = [ + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00 +]; + +pub const DEFAULT_KEYBOARD_CONFIG4: [u8; 364] = [ + 0x00, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00 +]; + +pub const DEFAULT_GAMEPAD_CONFIG: [u8; 0x38] = [ 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, @@ -260,226 +381,12 @@ pub const DEFAULT_TECH_MENU: [u8; 40] = [ 0x00, 0x00, ]; -pub const DEFAULT_KEYBOARD_CONFIG1: [u8; 364] = [ -0x00,0x00,0x00,0x00,0x26,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x22,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x61,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x59,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5e,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5d,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5c,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5d,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5c,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x56,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5e,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x41,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x43,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x45,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x47,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x49,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x4a,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x4b,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2b,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2e,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2f,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x31,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00, -0x01,0x00,0x00,0x00, -]; - -pub const DEFAULT_KEYBOARD_CONFIG2: [u8; 364] = [ -0x00,0x00,0x00,0x00,0x26,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x22,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x13,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x61,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x59,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5e,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5d,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5c,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x1a,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x19,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x1b,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x56,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x41,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x43,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x44,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x45,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x47,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x49,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x4a,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x4b,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2a,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2b,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2d,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2e,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x2f,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x31,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x32,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00, -0x01,0x00,0x00,0x00, -]; - -pub const DEFAULT_KEYBOARD_CONFIG3: [u8; 364] = [ - 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, -0x01, 0x00, 0x00, 0x00, -]; - -pub const DEFAULT_KEYBOARD_CONFIG4: [u8; 364] = [ - 0x00, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - ]; - -pub const DEFAULT_CONTROLLER_CONFIG: [u8; 56] = [ - 0x00, 0x01, 0xff, 0xff, - 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x02, 0x00, - 0x00, 0x00, 0x04, 0x00, - 0x00, 0x00, 0x08, 0x00, - 0x01, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, - ]; - - #[derive(Copy, Clone)] #[repr(C)] pub struct UserSettings { pub blocked_users: [u32; 0x1E], pub keyboard_config: [u8; 0x16C], - pub controller_config: [u8; 0x38], + pub gamepad_config: [u8; 0x38], pub option_flags: u32, pub shortcuts: [u8; 0xA40], pub symbol_chats: [u8; 0x4E0], @@ -491,8 +398,8 @@ impl Default for UserSettings { fn default() -> UserSettings { UserSettings { blocked_users: [0; 0x1E], - keyboard_config: DEFAULT_KEY_CONFIG, - controller_config: DEFAULT_JOYSTICK_CONFIG, + keyboard_config: DEFAULT_KEYBOARD_CONFIG1, + gamepad_config: DEFAULT_GAMEPAD_CONFIG, option_flags: 0, shortcuts: [0; 0xA40], symbol_chats: DEFAULT_SYMBOLCHATS, diff --git a/src/packet/login.rs b/src/packet/login.rs index 933e2db..fbaf565 100644 --- a/src/packet/login.rs +++ b/src/packet/login.rs @@ -211,7 +211,7 @@ pub struct RequestSettings { pub struct SendKeyAndTeamSettings { unknown: [u8; 0x114], key_config: [u8; 0x16C], - controller_config: [u8; 0x38], + gamepad_config: [u8; 0x38], guildcard: u32, team_id: u32, //team_info: [u32; 2], @@ -226,11 +226,11 @@ pub struct SendKeyAndTeamSettings { } impl SendKeyAndTeamSettings { - pub fn new(key_config: [u8; 0x16C], controller_config: [u8; 0x38], guildcard: u32, team_id: u32) -> SendKeyAndTeamSettings { + pub fn new(key_config: [u8; 0x16C], gamepad_config: [u8; 0x38], guildcard: u32, team_id: u32) -> SendKeyAndTeamSettings { SendKeyAndTeamSettings { unknown: [0; 0x114], key_config: key_config, - controller_config: controller_config, + gamepad_config: gamepad_config, guildcard: guildcard, team_id: team_id, //team_info: [0; 2], @@ -551,16 +551,16 @@ mod tests { let mut rng = rand::thread_rng(); let mut key_config = [0u8; 0x16C]; - let mut controller_config = [0u8; 0x38]; + let mut gamepad_config = [0u8; 0x38]; rng.fill(&mut key_config[..]); - rng.fill(&mut controller_config[..]); - let pkt = super::SendKeyAndTeamSettings::new(key_config, controller_config, 123, 456); + rng.fill(&mut gamepad_config[..]); + let pkt = super::SendKeyAndTeamSettings::new(key_config, gamepad_config, 123, 456); let bytes = pkt.as_bytes(); assert!(bytes[2] == 0xe2); assert!(bytes[8 + 0x114] == key_config[0]); - assert!(bytes[8 + 0x114 + 0x16C] == controller_config[0]); + assert!(bytes[8 + 0x114 + 0x16C] == gamepad_config[0]); } #[test] diff --git a/src/packet/ship.rs b/src/packet/ship.rs index 19da1e7..d65153f 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -642,6 +642,6 @@ pub struct KeyboardConfig { } #[pso_packet(0x5ED)] -pub struct ControllerConfig { - pub controller_config: [u8; 56], +pub struct GamepadConfig { + pub gamepad_config: [u8; 56], } \ No newline at end of file -- 2.36.0 From 0a6f8ac95e30c47799918a04798b9b1aaa51e777 Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 2 Jan 2022 16:31:47 +0000 Subject: [PATCH 6/6] key_config -> keyboard_config --- src/packet/login.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/packet/login.rs b/src/packet/login.rs index fbaf565..40a47ad 100644 --- a/src/packet/login.rs +++ b/src/packet/login.rs @@ -210,7 +210,7 @@ pub struct RequestSettings { #[pso_packet(0xE2)] pub struct SendKeyAndTeamSettings { unknown: [u8; 0x114], - key_config: [u8; 0x16C], + keyboard_config: [u8; 0x16C], gamepad_config: [u8; 0x38], guildcard: u32, team_id: u32, @@ -226,10 +226,10 @@ pub struct SendKeyAndTeamSettings { } impl SendKeyAndTeamSettings { - pub fn new(key_config: [u8; 0x16C], gamepad_config: [u8; 0x38], guildcard: u32, team_id: u32) -> SendKeyAndTeamSettings { + pub fn new(keyboard_config: [u8; 0x16C], gamepad_config: [u8; 0x38], guildcard: u32, team_id: u32) -> SendKeyAndTeamSettings { SendKeyAndTeamSettings { unknown: [0; 0x114], - key_config: key_config, + keyboard_config: keyboard_config, gamepad_config: gamepad_config, guildcard: guildcard, team_id: team_id, @@ -550,16 +550,16 @@ mod tests { let mut rng = rand::thread_rng(); - let mut key_config = [0u8; 0x16C]; + let mut keyboard_config = [0u8; 0x16C]; let mut gamepad_config = [0u8; 0x38]; - rng.fill(&mut key_config[..]); + rng.fill(&mut keyboard_config[..]); rng.fill(&mut gamepad_config[..]); - let pkt = super::SendKeyAndTeamSettings::new(key_config, gamepad_config, 123, 456); + let pkt = super::SendKeyAndTeamSettings::new(keyboard_config, gamepad_config, 123, 456); let bytes = pkt.as_bytes(); assert!(bytes[2] == 0xe2); - assert!(bytes[8 + 0x114] == key_config[0]); + assert!(bytes[8 + 0x114] == keyboard_config[0]); assert!(bytes[8 + 0x114 + 0x16C] == gamepad_config[0]); } -- 2.36.0