Implement multiple packet parsers

This commit is contained in:
Andrew Gutekanst
2020-02-22 22:17:10 -05:00
parent ecc0e49497
commit 172b5decf4
7 changed files with 68 additions and 20 deletions

View File

@@ -6,7 +6,14 @@ import (
)
// MsgMhfGetSeibattle represents the MSG_MHF_GET_SEIBATTLE
type MsgMhfGetSeibattle struct{}
type MsgMhfGetSeibattle struct {
AckHandle uint32
Unk0 uint8
Unk1 uint8
Unk2 uint32 // Some shared ID with MSG_SYS_RECORD_LOG, world ID?
Unk3 uint8
Unk4 uint16
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfGetSeibattle) Opcode() network.PacketID {
@@ -15,7 +22,13 @@ func (m *MsgMhfGetSeibattle) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfGetSeibattle) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
m.Unk2 = bf.ReadUint32()
m.Unk3 = bf.ReadUint8()
m.Unk4 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -6,7 +6,9 @@ import (
)
// MsgMhfGetUdBonusQuestInfo represents the MSG_MHF_GET_UD_BONUS_QUEST_INFO
type MsgMhfGetUdBonusQuestInfo struct{}
type MsgMhfGetUdBonusQuestInfo struct {
AckHandle uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfGetUdBonusQuestInfo) Opcode() network.PacketID {
@@ -15,7 +17,8 @@ func (m *MsgMhfGetUdBonusQuestInfo) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfGetUdBonusQuestInfo) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -6,7 +6,10 @@ import (
)
// MsgMhfPostBoostTime represents the MSG_MHF_POST_BOOST_TIME
type MsgMhfPostBoostTime struct{}
type MsgMhfPostBoostTime struct{
AckHandle uint32
BoostTime uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfPostBoostTime) Opcode() network.PacketID {
@@ -15,7 +18,9 @@ func (m *MsgMhfPostBoostTime) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfPostBoostTime) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
m.BoostTime = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -6,7 +6,9 @@ import (
)
// MsgMhfPostBoostTimeQuestReturn represents the MSG_MHF_POST_BOOST_TIME_QUEST_RETURN
type MsgMhfPostBoostTimeQuestReturn struct{}
type MsgMhfPostBoostTimeQuestReturn struct {
AckHandle uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfPostBoostTimeQuestReturn) Opcode() network.PacketID {
@@ -15,7 +17,8 @@ func (m *MsgMhfPostBoostTimeQuestReturn) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfPostBoostTimeQuestReturn) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -6,7 +6,11 @@ import (
)
// MsgMhfUpdateUseTrendWeaponLog represents the MSG_MHF_UPDATE_USE_TREND_WEAPON_LOG
type MsgMhfUpdateUseTrendWeaponLog struct{}
type MsgMhfUpdateUseTrendWeaponLog struct {
AckHandle uint32
Unk0 uint8
Unk1 uint16 // Weapon/item ID probably?
}
// Opcode returns the ID associated with this packet type.
func (m *MsgMhfUpdateUseTrendWeaponLog) Opcode() network.PacketID {
@@ -15,7 +19,10 @@ func (m *MsgMhfUpdateUseTrendWeaponLog) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfUpdateUseTrendWeaponLog) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -6,7 +6,9 @@ import (
)
// MsgSysBackStage represents the MSG_SYS_BACK_STAGE
type MsgSysBackStage struct{}
type MsgSysBackStage struct {
AckHandle uint32
}
// Opcode returns the ID associated with this packet type.
func (m *MsgSysBackStage) Opcode() network.PacketID {
@@ -15,7 +17,8 @@ func (m *MsgSysBackStage) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgSysBackStage) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
return nil
}
// Build builds a binary packet from the current data.

View File

@@ -6,7 +6,14 @@ import (
)
// MsgSysRecordLog represents the MSG_SYS_RECORD_LOG
type MsgSysRecordLog struct{}
type MsgSysRecordLog struct {
AckHandle uint32
Unk0 uint32
Unk1 uint16 // Hardcoded 0
HardcodedDataSize uint16 // Hardcoded 0x4AC
Unk3 uint32 // Some shared ID with MSG_MHF_GET_SEIBATTLE. World ID??
DataBuf []byte
}
// Opcode returns the ID associated with this packet type.
func (m *MsgSysRecordLog) Opcode() network.PacketID {
@@ -15,7 +22,14 @@ func (m *MsgSysRecordLog) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgSysRecordLog) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint32()
m.Unk1 = bf.ReadUint16()
m.HardcodedDataSize = bf.ReadUint16()
m.Unk3 = bf.ReadUint32()
m.DataBuf = bf.ReadBytes(uint(m.HardcodedDataSize))
return nil
}
// Build builds a binary packet from the current data.