Browse Source

dropped BB prefix. Have ChecksumAck::new take an argument to set ack. Added basic test to check le_bytes.

pull/3/head
Andy 5 years ago
parent
commit
0d80bb58aa
  1. 20
      src/packet/login.rs

20
src/packet/login.rs

@ -29,8 +29,6 @@ impl LoginWelcome {
}
}
#[pso_packet(0x93)]
pub struct Login {
pub flag: u32,
@ -194,21 +192,21 @@ impl RedirectClient {
}
#[pso_packet(0x1E8)]
pub struct BBChecksum {
pub struct Checksum {
pub flag: u32,
}
#[pso_packet(0x2E8)]
pub struct BBChecksumAck {
pub struct ChecksumAck {
pub flag: u32,
pub ack: u32,
}
impl BBChecksumAck {
pub fn new() -> BBChecksumAck {
BBChecksumAck {
impl ChecksumAck {
pub fn new(ack: u32) -> ChecksumAck {
ChecksumAck {
flag: 0,
ack: 1,
ack: ack,
}
}
}
@ -256,4 +254,10 @@ mod tests {
assert!(bytes[8 + 0x114] == key_config[0]);
assert!(bytes[8 + 0x114 + 0x16C] == joystick_config[0]);
}
#[test]
fn test_login_checksum_ack() {
let mut checksum_ack = super::ChecksumAck::new(1);
assert!(u32::to_le_bytes(checksum_ack.ack) == [0x01, 0x00, 0x00, 0x00]);
}
}
Loading…
Cancel
Save