guildcard structs and repr(c) cus the compiler hates me
This commit is contained in:
		
							parent
							
								
									892d2ed220
								
							
						
					
					
						commit
						74d2feccb2
					
				@ -1,53 +1,22 @@
 | 
				
			|||||||
 | 
					use crate::packet::ship::{GuildcardAccept};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[derive(Copy, Clone, Debug)]
 | 
				
			||||||
/*
 | 
					#[repr(C)]
 | 
				
			||||||
typedef struct bb_guildcard_data {
 | 
					pub struct BlockedGuildCard {   // 264
 | 
				
			||||||
    uint8_t unk1[0x0114];
 | 
					    pub id: u32,                // 4
 | 
				
			||||||
    struct {
 | 
					    pub name: [u16; 0x18],      // 48
 | 
				
			||||||
        uint32_t guildcard;
 | 
					    pub team: [u16; 0x10],      // 32
 | 
				
			||||||
        uint16_t name[0x18];
 | 
					    pub desc: [u16; 0x58],      // 176
 | 
				
			||||||
        uint16_t team[0x10];
 | 
					    pub reserved1: u8,          // 1
 | 
				
			||||||
        uint16_t desc[0x58];
 | 
					    pub language: u8,           // 1
 | 
				
			||||||
        uint8_t reserved1;
 | 
					    pub section_id: u8,         // 1
 | 
				
			||||||
        uint8_t language;
 | 
					    pub class: u8,              // 1
 | 
				
			||||||
        uint8_t section;
 | 
					 | 
				
			||||||
        uint8_t ch_class;
 | 
					 | 
				
			||||||
    } blocked[29];
 | 
					 | 
				
			||||||
    uint8_t unk2[0x78];
 | 
					 | 
				
			||||||
    struct {
 | 
					 | 
				
			||||||
        uint32_t guildcard;
 | 
					 | 
				
			||||||
        uint16_t name[0x18];
 | 
					 | 
				
			||||||
        uint16_t team[0x10];
 | 
					 | 
				
			||||||
        uint16_t desc[0x58];
 | 
					 | 
				
			||||||
        uint8_t reserved1;
 | 
					 | 
				
			||||||
        uint8_t language;
 | 
					 | 
				
			||||||
        uint8_t section;
 | 
					 | 
				
			||||||
        uint8_t ch_class;
 | 
					 | 
				
			||||||
        uint32_t padding;
 | 
					 | 
				
			||||||
        uint16_t comment[0x58];
 | 
					 | 
				
			||||||
    } entries[104];
 | 
					 | 
				
			||||||
    uint8_t unk3[0x01BC];
 | 
					 | 
				
			||||||
} bb_gc_data_t;
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[derive(Copy, Clone)]
 | 
					 | 
				
			||||||
pub struct BlockedGuildCard {
 | 
					 | 
				
			||||||
    pub guildcard: u32,
 | 
					 | 
				
			||||||
    pub name: [u16; 0x18],
 | 
					 | 
				
			||||||
    pub team: [u16; 0x10],
 | 
					 | 
				
			||||||
    pub desc: [u16; 0x58],
 | 
					 | 
				
			||||||
    pub reserved1: u8,
 | 
					 | 
				
			||||||
    pub language: u8,
 | 
					 | 
				
			||||||
    pub section_id: u8,
 | 
					 | 
				
			||||||
    pub class: u8,
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl Default for BlockedGuildCard {
 | 
					impl Default for BlockedGuildCard {
 | 
				
			||||||
    fn default() -> BlockedGuildCard {
 | 
					    fn default() -> BlockedGuildCard {
 | 
				
			||||||
        BlockedGuildCard {
 | 
					        BlockedGuildCard {
 | 
				
			||||||
            guildcard: 0,
 | 
					            id: 0,
 | 
				
			||||||
            name: [0; 0x18],
 | 
					            name: [0; 0x18],
 | 
				
			||||||
            team: [0; 0x10],
 | 
					            team: [0; 0x10],
 | 
				
			||||||
            desc: [0; 0x58],
 | 
					            desc: [0; 0x58],
 | 
				
			||||||
@ -59,25 +28,41 @@ impl Default for BlockedGuildCard {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Copy, Clone)]
 | 
					impl From<GuildCard> for BlockedGuildCard {
 | 
				
			||||||
pub struct GuildCard {
 | 
					    fn from(g: GuildCard) -> BlockedGuildCard {
 | 
				
			||||||
    pub guildcard: u32,
 | 
					        BlockedGuildCard {
 | 
				
			||||||
    pub name: [u16; 0x18],
 | 
					            id: g.id,
 | 
				
			||||||
    pub team: [u16; 0x10],
 | 
					            name: g.name,
 | 
				
			||||||
    pub desc: [u16; 0x58],
 | 
					            team: g.team,
 | 
				
			||||||
    pub reserved1: u8,
 | 
					            desc: g.desc,
 | 
				
			||||||
    pub language: u8,
 | 
					            reserved1: g.reserved1,
 | 
				
			||||||
    pub section_id: u8,
 | 
					            language: g.language,
 | 
				
			||||||
    pub class: u8,
 | 
					            section_id: g.section_id,
 | 
				
			||||||
    pub padding: u32,
 | 
					            class: g.class,
 | 
				
			||||||
    pub comment: [u16; 0x58],
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[derive(Copy, Clone, Debug)]
 | 
				
			||||||
 | 
					#[repr(C)]
 | 
				
			||||||
 | 
					pub struct GuildCard {          // 444
 | 
				
			||||||
 | 
					    pub id: u32,                // 4
 | 
				
			||||||
 | 
					    pub name: [u16; 0x18],      // 48
 | 
				
			||||||
 | 
					    pub team: [u16; 0x10],      // 32
 | 
				
			||||||
 | 
					    pub desc: [u16; 0x58],      // 176
 | 
				
			||||||
 | 
					    pub reserved1: u8,          // 1
 | 
				
			||||||
 | 
					    pub language: u8,           // 1
 | 
				
			||||||
 | 
					    pub section_id: u8,         // 1
 | 
				
			||||||
 | 
					    pub class: u8,              // 1
 | 
				
			||||||
 | 
					    pub padding: u32,           // 4
 | 
				
			||||||
 | 
					    pub comment: [u16; 0x58],   // 176
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl Default for GuildCard {
 | 
					impl Default for GuildCard {
 | 
				
			||||||
    fn default() -> GuildCard {
 | 
					    fn default() -> GuildCard {
 | 
				
			||||||
        GuildCard {
 | 
					        GuildCard {
 | 
				
			||||||
            guildcard: 0,
 | 
					            id: 0,
 | 
				
			||||||
            name: [0; 0x18],
 | 
					            name: [0; 0x18],
 | 
				
			||||||
            team: [0; 0x10],
 | 
					            team: [0; 0x10],
 | 
				
			||||||
            desc: [0; 0x58],
 | 
					            desc: [0; 0x58],
 | 
				
			||||||
@ -91,13 +76,30 @@ impl Default for GuildCard {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Copy, Clone)]
 | 
					impl From<&GuildcardAccept> for GuildCard {
 | 
				
			||||||
pub struct GuildCardData {
 | 
					    fn from(g: &GuildcardAccept) -> GuildCard {
 | 
				
			||||||
    pub _unknown1: [u8; 0x114],
 | 
					        GuildCard {
 | 
				
			||||||
    pub blocked: [BlockedGuildCard; 29],
 | 
					            id: g.id,
 | 
				
			||||||
    pub _unknown2: [u8; 0x78],
 | 
					            name: g.name,
 | 
				
			||||||
    pub friends: [GuildCard; 104],
 | 
					            team: g.team,
 | 
				
			||||||
    pub _unknown3: [u8; 0x1BC],
 | 
					            desc: g.desc,
 | 
				
			||||||
 | 
					            reserved1: g.one,
 | 
				
			||||||
 | 
					            language: g.language,
 | 
				
			||||||
 | 
					            section_id: g.section_id,
 | 
				
			||||||
 | 
					            class: g.class,
 | 
				
			||||||
 | 
					            padding: 0,
 | 
				
			||||||
 | 
					            comment: [0; 0x58],
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[derive(Copy, Clone, Debug)]
 | 
				
			||||||
 | 
					#[repr(C)]
 | 
				
			||||||
 | 
					pub struct GuildCardData {                  // 54672 0xd590
 | 
				
			||||||
 | 
					    pub _unknown1: [u8; 0x114],             // 276
 | 
				
			||||||
 | 
					    pub blocked: [BlockedGuildCard; 29],    // 264 * 29 = 7656
 | 
				
			||||||
 | 
					    pub _unknown2: [u8; 0x78],              // 120
 | 
				
			||||||
 | 
					    pub friends: [GuildCard; 105],          // 444 * 105 = 46620
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl Default for GuildCardData {
 | 
					impl Default for GuildCardData {
 | 
				
			||||||
@ -106,8 +108,7 @@ impl Default for GuildCardData {
 | 
				
			|||||||
            _unknown1: [0; 0x114],
 | 
					            _unknown1: [0; 0x114],
 | 
				
			||||||
            blocked: [BlockedGuildCard::default(); 29],
 | 
					            blocked: [BlockedGuildCard::default(); 29],
 | 
				
			||||||
            _unknown2: [0; 0x78],
 | 
					            _unknown2: [0; 0x78],
 | 
				
			||||||
            friends: [GuildCard::default(); 104],
 | 
					            friends: [GuildCard::default(); 105],
 | 
				
			||||||
            _unknown3: [0; 0x1BC],
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user