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