diff options
Diffstat (limited to 'context.h')
-rw-r--r-- | context.h | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -510,6 +510,17 @@ TMenuListEntry(QuestListEntry, char short_description[112]; ); +// pso/TProtocol.h +// NOTE: This is only here because of the ordering of this. +// In Reality, the definition of `_packet` is above `flex_packet`. +struct _packet; + +template<size_t n = 0> +union flex_packet { + struct _packet pkt; + u8 bytes[(n) ? n : sizeof(packet_header)]; +}; + // TMainTask.cpp // Const defs. static const int tl_object_count = 20; @@ -775,20 +786,17 @@ struct extended_game_command { }; // pso/TProtocol.h -struct packet { - union { - struct { - packet_header header; - u8 data[0x7c00-sizeof(packet_header)]; - } pkt; - u8 bytes[0x7c00]; - }; - +struct _packet { void bswap() { - pkt.header.bswap(); + header.bswap(); }; + + packet_header header; + u8 data[]; }; +struct packet : public flex_packet<0x7c00> {}; + struct recv_packet_handlers { #define o(name, ...) recv_packet_handler(name) name; RECV_PACKET_HANDLERS; |