use Formatter::debug_struct for packet debug impl #23
@ -138,7 +138,7 @@ impl std::default::Default for Character {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Copy, Clone, Debug, PartialEq, Default)]
 | 
					#[derive(Copy, Clone, PSOPacketData, Default)]
 | 
				
			||||||
#[repr(C)]
 | 
					#[repr(C)]
 | 
				
			||||||
pub struct SelectScreenCharacter {
 | 
					pub struct SelectScreenCharacter {
 | 
				
			||||||
    pub exp: u32,
 | 
					    pub exp: u32,
 | 
				
			||||||
@ -169,20 +169,6 @@ pub struct SelectScreenCharacter {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl SelectScreenCharacter {
 | 
					impl SelectScreenCharacter {
 | 
				
			||||||
    pub const SIZE: usize = 0x7C;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pub fn from_le_bytes(bytes: [u8; 0x7C]) -> Result<SelectScreenCharacter, crate::PacketParseError> {
 | 
					 | 
				
			||||||
        unsafe {
 | 
					 | 
				
			||||||
            Ok(std::mem::transmute(bytes))
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pub fn to_le_bytes(&self) -> [u8; 0x7C] {
 | 
					 | 
				
			||||||
        unsafe {
 | 
					 | 
				
			||||||
            std::mem::transmute(*self)
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pub fn as_character(&self) -> Character {
 | 
					    pub fn as_character(&self) -> Character {
 | 
				
			||||||
        Character {
 | 
					        Character {
 | 
				
			||||||
            exp: self.exp,
 | 
					            exp: self.exp,
 | 
				
			||||||
 | 
				
			|||||||
@ -292,18 +292,6 @@ pub struct CharAck {
 | 
				
			|||||||
    pub code: u32, // TODO: enum?
 | 
					    pub code: u32, // TODO: enum?
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl PSOPacketData for SelectScreenCharacter {
 | 
					 | 
				
			||||||
    fn from_bytes<R: Read>(cursor: &mut R) -> Result<Self, PacketParseError> {
 | 
					 | 
				
			||||||
        let mut buf = [0u8; SelectScreenCharacter::SIZE];
 | 
					 | 
				
			||||||
        cursor.read(&mut buf).map_err(|_| PacketParseError::ReadError)?;
 | 
					 | 
				
			||||||
        SelectScreenCharacter::from_le_bytes(buf)
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    fn as_bytes(&self) -> Vec<u8> {
 | 
					 | 
				
			||||||
        self.to_le_bytes().to_vec()
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[pso_packet(0xE5)]
 | 
					#[pso_packet(0xE5)]
 | 
				
			||||||
pub struct CharacterPreview {
 | 
					pub struct CharacterPreview {
 | 
				
			||||||
    pub slot: u32,
 | 
					    pub slot: u32,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user