Skip to content

Commit

Permalink
update parsing of many packets
Browse files Browse the repository at this point in the history
  • Loading branch information
sekaiwish committed Nov 18, 2023
1 parent 734b60b commit fc57d63
Show file tree
Hide file tree
Showing 32 changed files with 146 additions and 171 deletions.
4 changes: 2 additions & 2 deletions network/mhfpacket/msg_mhf_acquire_guild_tresure.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
type MsgMhfAcquireGuildTresure struct {
AckHandle uint32
HuntID uint32
Unk uint8
Unk bool
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -24,7 +24,7 @@ func (m *MsgMhfAcquireGuildTresure) Opcode() network.PacketID {
func (m *MsgMhfAcquireGuildTresure) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.HuntID = bf.ReadUint32()
m.Unk = bf.ReadUint8()
m.Unk = bf.ReadBool()
return nil
}

Expand Down
12 changes: 6 additions & 6 deletions network/mhfpacket/msg_mhf_acquire_title.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import (
// MsgMhfAcquireTitle represents the MSG_MHF_ACQUIRE_TITLE
type MsgMhfAcquireTitle struct {
AckHandle uint32
Unk0 uint16
Unk1 uint16
TitleID uint16
TitleIDs []uint16
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -24,9 +22,11 @@ func (m *MsgMhfAcquireTitle) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfAcquireTitle) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
m.TitleID = bf.ReadUint16()
titles := int(bf.ReadUint16())
bf.ReadUint16() // Zeroed
for i := 0; i < titles; i++ {
m.TitleIDs = append(m.TitleIDs, bf.ReadUint16())
}
return nil
}

Expand Down
7 changes: 3 additions & 4 deletions network/mhfpacket/msg_mhf_check_daily_cafepoint.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package mhfpacket

import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
)

// MsgMhfCheckDailyCafepoint represents the MSG_MHF_CHECK_DAILY_CAFEPOINT
Expand All @@ -25,7 +26,5 @@ func (m *MsgMhfCheckDailyCafepoint) Parse(bf *byteframe.ByteFrame, ctx *clientct
}

func (m *MsgMhfCheckDailyCafepoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint32(m.Unk)
return nil
return errors.New("NOT IMPLEMENTED")
}
5 changes: 3 additions & 2 deletions network/mhfpacket/msg_mhf_check_monthly_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
type MsgMhfCheckMonthlyItem struct {
AckHandle uint32
Type uint8
Unk []byte
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -24,7 +23,9 @@ func (m *MsgMhfCheckMonthlyItem) Opcode() network.PacketID {
func (m *MsgMhfCheckMonthlyItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Type = bf.ReadUint8()
m.Unk = bf.ReadBytes(3)
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil
}

Expand Down
3 changes: 1 addition & 2 deletions network/mhfpacket/msg_mhf_check_weekly_stamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type MsgMhfCheckWeeklyStamp struct {
AckHandle uint32
StampType string
Unk1 bool
Unk2 uint16 // Hardcoded 0 in the binary
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -31,7 +30,7 @@ func (m *MsgMhfCheckWeeklyStamp) Parse(bf *byteframe.ByteFrame, ctx *clientctx.C
m.StampType = "ex"
}
m.Unk1 = bf.ReadBool()
m.Unk2 = bf.ReadUint16()
bf.ReadUint16() // Zeroed
return nil
}

Expand Down
7 changes: 2 additions & 5 deletions network/mhfpacket/msg_mhf_create_guild.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
// MsgMhfCreateGuild represents the MSG_MHF_CREATE_GUILD
type MsgMhfCreateGuild struct {
AckHandle uint32
Unk0 uint8
Unk1 uint8
Name string
}

Expand All @@ -25,9 +23,8 @@ func (m *MsgMhfCreateGuild) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfCreateGuild) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
_ = bf.ReadUint16() // len
bf.ReadUint16() // Zeroed
bf.ReadUint16() // Name length
m.Name = stringsupport.SJISToUTF8(bf.ReadNullTerminatedBytes())
return nil
}
Expand Down
12 changes: 5 additions & 7 deletions network/mhfpacket/msg_mhf_displayed_achievement.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package mhfpacket

import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
)

// MsgMhfDisplayedAchievement represents the MSG_MHF_DISPLAYED_ACHIEVEMENT
type MsgMhfDisplayedAchievement struct {
Unk0 uint8
}
type MsgMhfDisplayedAchievement struct{}

// Opcode returns the ID associated with this packet type.
func (m *MsgMhfDisplayedAchievement) Opcode() network.PacketID {
Expand All @@ -18,12 +17,11 @@ func (m *MsgMhfDisplayedAchievement) Opcode() network.PacketID {

// Parse parses the packet from binary
func (m *MsgMhfDisplayedAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.Unk0 = bf.ReadUint8()
bf.ReadUint8() // Zeroed
return nil
}

// Build builds a binary packet from the current data.
func (m *MsgMhfDisplayedAchievement) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint8(m.Unk0)
return nil
return errors.New("NOT IMPLEMENTED")
}
14 changes: 5 additions & 9 deletions network/mhfpacket/msg_mhf_enumerate_event.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package mhfpacket

import (
"errors"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
"erupe-ce/common/byteframe"
)

// MsgMhfEnumerateEvent represents the MSG_MHF_ENUMERATE_EVENT
type MsgMhfEnumerateEvent struct {
AckHandle uint32
Unk0 uint16 // Hardcoded 0 in the binary
Unk1 uint16 // Hardcoded 0 in the binary
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -21,15 +20,12 @@ func (m *MsgMhfEnumerateEvent) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfEnumerateEvent) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
bf.ReadUint16() // Zeroed
bf.ReadUint16() // Zeroed
return nil
}

// Build builds a binary packet from the current data.
func (m *MsgMhfEnumerateEvent) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
bf.WriteUint32(m.AckHandle)
bf.WriteUint16(m.Unk0)
bf.WriteUint16(m.Unk1)
return nil
return errors.New("NOT IMPLEMENTED")
}
14 changes: 6 additions & 8 deletions network/mhfpacket/msg_mhf_enumerate_price.go
Original file line number Diff line number Diff line change
@@ -1,18 +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"
)

// MsgMhfEnumeratePrice represents the MSG_MHF_ENUMERATE_PRICE
type MsgMhfEnumeratePrice struct {
AckHandle uint32
Unk0 uint16 // Hardcoded 0 in the binary
Unk1 uint16 // Hardcoded 0 in the binary
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -23,8 +21,8 @@ func (m *MsgMhfEnumeratePrice) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfEnumeratePrice) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
bf.ReadUint16() // Zeroed
bf.ReadUint16() // Zeroed
return nil
}

Expand Down
15 changes: 7 additions & 8 deletions network/mhfpacket/msg_mhf_enumerate_ranking.go
Original file line number Diff line number Diff line change
@@ -1,18 +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"
)

// MsgMhfEnumerateRanking represents the MSG_MHF_ENUMERATE_RANKING
type MsgMhfEnumerateRanking struct {
AckHandle uint32
Unk0 uint16 // Hardcoded 0 in the binary
Unk1 uint16 // Hardcoded 0 in the binary
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -23,8 +21,9 @@ func (m *MsgMhfEnumerateRanking) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfEnumerateRanking) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
bf.ReadUint16() // Zeroed
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil
}

Expand Down
5 changes: 2 additions & 3 deletions network/mhfpacket/msg_mhf_enumerate_union_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
// MsgMhfEnumerateUnionItem represents the MSG_MHF_ENUMERATE_UNION_ITEM
type MsgMhfEnumerateUnionItem struct {
AckHandle uint32
Unk0 uint16
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -22,8 +21,8 @@ func (m *MsgMhfEnumerateUnionItem) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfEnumerateUnionItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()

bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil
}

Expand Down
3 changes: 1 addition & 2 deletions network/mhfpacket/msg_mhf_get_achievement.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
type MsgMhfGetAchievement struct {
AckHandle uint32
CharID uint32
Unk1 uint32 // char?
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -24,7 +23,7 @@ func (m *MsgMhfGetAchievement) Opcode() network.PacketID {
func (m *MsgMhfGetAchievement) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.CharID = bf.ReadUint32()
m.Unk1 = bf.ReadUint32()
bf.ReadUint32() // Zeroed
return nil
}

Expand Down
11 changes: 5 additions & 6 deletions network/mhfpacket/msg_mhf_get_rengoku_binary.go
Original file line number Diff line number Diff line change
@@ -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"
)

// MsgMhfGetRengokuBinary represents the MSG_MHF_GET_RENGOKU_BINARY
type MsgMhfGetRengokuBinary struct {
AckHandle uint32
Unk0 uint8 // Hardcoded 0 in binary
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -22,7 +21,7 @@ func (m *MsgMhfGetRengokuBinary) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfGetRengokuBinary) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
bf.ReadUint8() // Zeroed
return nil
}

Expand Down
17 changes: 9 additions & 8 deletions network/mhfpacket/msg_mhf_info_festa.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package mhfpacket

import (
"errors"
import (
"errors"

"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)

// MsgMhfInfoFesta represents the MSG_MHF_INFO_FESTA
type MsgMhfInfoFesta struct {
AckHandle uint32
Unk0 uint16 // Hardcoded 0 in the binary
Unk1 uint16 // Hardcoded 0 in the binary
Unk0 uint8
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -23,8 +22,10 @@ func (m *MsgMhfInfoFesta) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfInfoFesta) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
m.Unk0 = bf.ReadUint8()
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
bf.ReadUint8() // Zeroed
return nil
}

Expand Down
13 changes: 7 additions & 6 deletions network/mhfpacket/msg_mhf_list_member.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package mhfpacket

import (
"errors"
import (
"errors"

"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
)

// MsgMhfListMember represents the MSG_MHF_LIST_MEMBER
type MsgMhfListMember struct {
AckHandle uint32
Unk0 uint16 // Hardcoded 01 00 in the JP client.
Unk0 uint8 // Hardcoded 01 in the JP client.
}

// Opcode returns the ID associated with this packet type.
Expand All @@ -22,7 +22,8 @@ func (m *MsgMhfListMember) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgMhfListMember) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk0 = bf.ReadUint8()
bf.ReadUint8() // Zeroed
return nil
}

Expand Down
Loading

0 comments on commit fc57d63

Please sign in to comment.