From 10c80322afc753ff7aa80061eb18a91a5b9023d3 Mon Sep 17 00:00:00 2001 From: Andrew Gutekanst Date: Thu, 23 Jan 2020 16:49:00 -0500 Subject: [PATCH] Implement MsgSysSetStageBinary parser --- network/mhfpacket/msg_sys_set_stage_binary.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/network/mhfpacket/msg_sys_set_stage_binary.go b/network/mhfpacket/msg_sys_set_stage_binary.go index 5864cba6a..40d9e57bc 100644 --- a/network/mhfpacket/msg_sys_set_stage_binary.go +++ b/network/mhfpacket/msg_sys_set_stage_binary.go @@ -6,7 +6,14 @@ import ( ) // MsgSysSetStageBinary represents the MSG_SYS_SET_STAGE_BINARY -type MsgSysSetStageBinary struct{} +type MsgSysSetStageBinary struct { + Unk0 uint8 + BinaryType uint8 // Index + StageIDLength uint8 // <= 0x20 + DataSize uint16 // <= 0x400 + StageID string + RawDataPayload []byte +} // Opcode returns the ID associated with this packet type. func (m *MsgSysSetStageBinary) Opcode() network.PacketID { @@ -15,10 +22,16 @@ func (m *MsgSysSetStageBinary) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgSysSetStageBinary) Parse(bf *byteframe.ByteFrame) error { - panic("Not implemented") + m.Unk0 = bf.ReadUint8() + m.BinaryType = bf.ReadUint8() + m.StageIDLength = bf.ReadUint8() + m.DataSize = bf.ReadUint16() + m.StageID = string(bf.ReadBytes(uint(m.StageIDLength))) + m.RawDataPayload = bf.ReadBytes(uint(m.DataSize)) + return nil } // Build builds a binary packet from the current data. func (m *MsgSysSetStageBinary) Build(bf *byteframe.ByteFrame) error { panic("Not implemented") -} \ No newline at end of file +}