Browse Source

joystick_config -> controller_config for consistency

andy 3 years ago
parent
commit
df18e28b76
  1. 4
      src/character/character.rs
  2. 4
      src/character/settings.rs
  3. 14
      src/packet/login.rs

4
src/character/character.rs

@ -273,7 +273,7 @@ impl std::default::Default for Bank {
pub struct KeyTeamConfig { pub struct KeyTeamConfig {
pub _unknown: [u8; 0x114], pub _unknown: [u8; 0x114],
pub keyboard_config: [u8; 0x16C], pub keyboard_config: [u8; 0x16C],
pub joystick_config: [u8; 0x38],
pub controller_config: [u8; 0x38],
pub guildcard: u32, pub guildcard: u32,
pub team_id: u32, pub team_id: u32,
pub team_info: [u32; 2], pub team_info: [u32; 2],
@ -354,7 +354,7 @@ pub struct DBChar {
pub struct DBOpts { pub struct DBOpts {
pub blocked: [u32; 30], pub blocked: [u32; 30],
pub keyboard_config: [u8; 0x16C], pub keyboard_config: [u8; 0x16C],
pub joystick_config: [u8; 0x38],
pub controller_config: [u8; 0x38],
pub option_flags: u32, pub option_flags: u32,
pub shortcuts: [u8; 0xA40], pub shortcuts: [u8; 0xA40],
pub symbol_chats: [u8; 0x4E0], pub symbol_chats: [u8; 0x4E0],

4
src/character/settings.rs

@ -479,7 +479,7 @@ pub const DEFAULT_CONTROLLER_CONFIG: [u8; 56] = [
pub struct UserSettings { pub struct UserSettings {
pub blocked_users: [u32; 0x1E], pub blocked_users: [u32; 0x1E],
pub keyboard_config: [u8; 0x16C], pub keyboard_config: [u8; 0x16C],
pub joystick_config: [u8; 0x38],
pub controller_config: [u8; 0x38],
pub option_flags: u32, pub option_flags: u32,
pub shortcuts: [u8; 0xA40], pub shortcuts: [u8; 0xA40],
pub symbol_chats: [u8; 0x4E0], pub symbol_chats: [u8; 0x4E0],
@ -492,7 +492,7 @@ impl Default for UserSettings {
UserSettings { UserSettings {
blocked_users: [0; 0x1E], blocked_users: [0; 0x1E],
keyboard_config: DEFAULT_KEY_CONFIG, keyboard_config: DEFAULT_KEY_CONFIG,
joystick_config: DEFAULT_JOYSTICK_CONFIG,
controller_config: DEFAULT_JOYSTICK_CONFIG,
option_flags: 0, option_flags: 0,
shortcuts: [0; 0xA40], shortcuts: [0; 0xA40],
symbol_chats: DEFAULT_SYMBOLCHATS, symbol_chats: DEFAULT_SYMBOLCHATS,

14
src/packet/login.rs

@ -211,7 +211,7 @@ pub struct RequestSettings {
pub struct SendKeyAndTeamSettings { pub struct SendKeyAndTeamSettings {
unknown: [u8; 0x114], unknown: [u8; 0x114],
key_config: [u8; 0x16C], key_config: [u8; 0x16C],
joystick_config: [u8; 0x38],
controller_config: [u8; 0x38],
guildcard: u32, guildcard: u32,
team_id: u32, team_id: u32,
//team_info: [u32; 2], //team_info: [u32; 2],
@ -226,11 +226,11 @@ pub struct SendKeyAndTeamSettings {
} }
impl 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 { SendKeyAndTeamSettings {
unknown: [0; 0x114], unknown: [0; 0x114],
key_config: key_config, key_config: key_config,
joystick_config: joystick_config,
controller_config: controller_config,
guildcard: guildcard, guildcard: guildcard,
team_id: team_id, team_id: team_id,
//team_info: [0; 2], //team_info: [0; 2],
@ -551,16 +551,16 @@ mod tests {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let mut key_config = [0u8; 0x16C]; 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 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(); let bytes = pkt.as_bytes();
assert!(bytes[2] == 0xe2); assert!(bytes[2] == 0xe2);
assert!(bytes[8 + 0x114] == key_config[0]); assert!(bytes[8 + 0x114] == key_config[0]);
assert!(bytes[8 + 0x114 + 0x16C] == joystick_config[0]);
assert!(bytes[8 + 0x114 + 0x16C] == controller_config[0]);
} }
#[test] #[test]

Loading…
Cancel
Save