|
|
@ -1,5 +1,6 @@ |
|
|
|
use psopacket::pso_packet;
|
|
|
|
use crate::{PSOPacket, PacketParseError};
|
|
|
|
//use psopacket::pso_packet;
|
|
|
|
use psopacket::pso_packet2 as pso_packet;
|
|
|
|
use crate::{PSOPacket, PacketParseError, PSOPacketData};
|
|
|
|
|
|
|
|
use std::io::Read;
|
|
|
|
|
|
|
@ -8,10 +9,9 @@ pub const PATCH_FILE_CHUNK_SIZE: u16 = 0x8000; // 32kb |
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
type u8_str = u8;
|
|
|
|
|
|
|
|
// outgoing packets
|
|
|
|
#[pso_packet(0x02)]
|
|
|
|
#[pso_packet(0x02, no_flag)]
|
|
|
|
pub struct PatchWelcome {
|
|
|
|
copyright: [u8_str; 44],
|
|
|
|
copyright: [u8; 44],
|
|
|
|
padding: [u8; 20],
|
|
|
|
server_key: u32,
|
|
|
|
client_key: u32,
|
|
|
@ -29,16 +29,15 @@ impl PatchWelcome { |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// incoming packets
|
|
|
|
#[pso_packet(0x02)]
|
|
|
|
#[pso_packet(0x02, no_flag)]
|
|
|
|
pub struct PatchWelcomeReply {
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x04)]
|
|
|
|
#[pso_packet(0x04, no_flag)]
|
|
|
|
pub struct RequestLogin {
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x04)]
|
|
|
|
#[pso_packet(0x04, no_flag)]
|
|
|
|
pub struct LoginReply {
|
|
|
|
unused: [u8; 12],
|
|
|
|
username: [u8_str; 16],
|
|
|
@ -46,7 +45,7 @@ pub struct LoginReply { |
|
|
|
unused2: [u8; 64],
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x06)]
|
|
|
|
#[pso_packet(0x06, no_flag)]
|
|
|
|
pub struct StartFileSend {
|
|
|
|
id: u32,
|
|
|
|
size: u32,
|
|
|
@ -118,7 +117,7 @@ impl std::fmt::Debug for FileSend { |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[pso_packet(0x08)]
|
|
|
|
#[pso_packet(0x08, no_flag)]
|
|
|
|
pub struct EndFileSend {
|
|
|
|
padding: u32,
|
|
|
|
}
|
|
|
@ -133,11 +132,11 @@ impl EndFileSend { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[pso_packet(0x0B)]
|
|
|
|
#[pso_packet(0x0B, no_flag)]
|
|
|
|
pub struct PatchStartList {
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x09)]
|
|
|
|
#[pso_packet(0x09, no_flag)]
|
|
|
|
pub struct ChangeDirectory {
|
|
|
|
dirname: [u8_str; 64]
|
|
|
|
}
|
|
|
@ -154,11 +153,11 @@ impl ChangeDirectory { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x0A)]
|
|
|
|
#[pso_packet(0x0A, no_flag)]
|
|
|
|
pub struct UpOneDirectory {
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x0C)]
|
|
|
|
#[pso_packet(0x0C, no_flag)]
|
|
|
|
pub struct FileInfo {
|
|
|
|
id: u32,
|
|
|
|
filename: [u8_str; 32],
|
|
|
@ -178,22 +177,22 @@ impl FileInfo { |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[pso_packet(0x0D)]
|
|
|
|
#[pso_packet(0x0D, no_flag)]
|
|
|
|
pub struct PatchEndList {
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x0F)]
|
|
|
|
#[pso_packet(0x0F, no_flag)]
|
|
|
|
pub struct FileInfoReply {
|
|
|
|
pub id: u32,
|
|
|
|
pub checksum: u32,
|
|
|
|
pub size: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x10)]
|
|
|
|
#[pso_packet(0x10, no_flag)]
|
|
|
|
pub struct FileInfoListEnd {
|
|
|
|
}
|
|
|
|
|
|
|
|
#[pso_packet(0x11)]
|
|
|
|
#[pso_packet(0x11, no_flag)]
|
|
|
|
pub struct FilesToPatchMetadata {
|
|
|
|
data_size: u32,
|
|
|
|
file_count: u32,
|
|
|
@ -209,12 +208,12 @@ impl FilesToPatchMetadata { |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[pso_packet(0x12)]
|
|
|
|
#[pso_packet(0x12, no_flag)]
|
|
|
|
pub struct FinalizePatching {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[pso_packet(0x13)]
|
|
|
|
#[pso_packet(0x13, no_flag)]
|
|
|
|
pub struct Message {
|
|
|
|
msg: String,
|
|
|
|
}
|
|
|
@ -229,7 +228,7 @@ impl Message { |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[pso_packet(0x14)]
|
|
|
|
#[pso_packet(0x14, no_flag)]
|
|
|
|
pub struct RedirectClient {
|
|
|
|
ip: u32,
|
|
|
|
port: u16,
|
|
|
|