From d7d3e7c61f354c065b73e653324d3030b2abdd79 Mon Sep 17 00:00:00 2001 From: wish Date: Sun, 19 Nov 2023 23:12:58 +1100 Subject: [PATCH] update parsing of CastBinary & EnterStage --- network/mhfpacket/msg_sys_cast_binary.go | 14 ++++++-------- network/mhfpacket/msg_sys_enter_stage.go | 5 ++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/network/mhfpacket/msg_sys_cast_binary.go b/network/mhfpacket/msg_sys_cast_binary.go index 07935f2aa..f0b0c2bd3 100644 --- a/network/mhfpacket/msg_sys_cast_binary.go +++ b/network/mhfpacket/msg_sys_cast_binary.go @@ -1,17 +1,16 @@ package mhfpacket -import ( - "errors" +import ( + "errors" - "erupe-ce/network/clientctx" - "erupe-ce/network" "erupe-ce/common/byteframe" + "erupe-ce/network" + "erupe-ce/network/clientctx" ) // MsgSysCastBinary represents the MSG_SYS_CAST_BINARY type MsgSysCastBinary struct { - Unk0 uint16 - Unk1 uint16 + Unk uint32 BroadcastType uint8 MessageType uint8 RawDataPayload []byte @@ -24,8 +23,7 @@ func (m *MsgSysCastBinary) Opcode() network.PacketID { // Parse parses the packet from binary func (m *MsgSysCastBinary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { - m.Unk0 = bf.ReadUint16() - m.Unk1 = bf.ReadUint16() + m.Unk = bf.ReadUint32() m.BroadcastType = bf.ReadUint8() m.MessageType = bf.ReadUint8() dataSize := bf.ReadUint16() diff --git a/network/mhfpacket/msg_sys_enter_stage.go b/network/mhfpacket/msg_sys_enter_stage.go index 977ff486f..5a1ccb8ab 100644 --- a/network/mhfpacket/msg_sys_enter_stage.go +++ b/network/mhfpacket/msg_sys_enter_stage.go @@ -4,7 +4,6 @@ import ( "errors" "erupe-ce/common/byteframe" - "erupe-ce/common/bfutil" "erupe-ce/network" "erupe-ce/network/clientctx" ) @@ -25,8 +24,8 @@ func (m *MsgSysEnterStage) Opcode() network.PacketID { func (m *MsgSysEnterStage) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { m.AckHandle = bf.ReadUint32() m.UnkBool = bf.ReadUint8() - stageIDLength := bf.ReadUint8() - m.StageID = string(bfutil.UpToNull(bf.ReadBytes(uint(stageIDLength)))) + bf.ReadUint8() + m.StageID = string(bf.ReadNullTerminatedBytes()) return nil }