mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 16:34:51 +01:00
Fix client crash and implement quest loading
Fixed client crashes caused by handleMsgMhfEnumeratePrice and handleMsgMhfEnumerateRanking wherein the server's response didn't contain enough data, causing the client to read uninitalized memory. Implemented quest loading handlers GetFile, WaitStageBinary, and UnlockStage, as well as correcting the IssueLogkey handler.
This commit is contained in:
@@ -5,8 +5,21 @@ import (
|
||||
"github.com/Andoryuuta/byteframe"
|
||||
)
|
||||
|
||||
type scenarioFileIdentifer struct {
|
||||
Unk0 uint8
|
||||
Unk1 uint32
|
||||
Unk2 uint8
|
||||
Unk3 uint8
|
||||
}
|
||||
|
||||
// MsgSysGetFile represents the MSG_SYS_GET_FILE
|
||||
type MsgSysGetFile struct{}
|
||||
type MsgSysGetFile struct {
|
||||
AckHandle uint32
|
||||
IsScenario bool
|
||||
FilenameLength uint8
|
||||
Filename string
|
||||
ScenarioIdentifer scenarioFileIdentifer
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
func (m *MsgSysGetFile) Opcode() network.PacketID {
|
||||
@@ -15,10 +28,23 @@ func (m *MsgSysGetFile) Opcode() network.PacketID {
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgSysGetFile) Parse(bf *byteframe.ByteFrame) error {
|
||||
panic("Not implemented")
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.IsScenario = bf.ReadBool()
|
||||
if m.IsScenario {
|
||||
m.ScenarioIdentifer = scenarioFileIdentifer{
|
||||
bf.ReadUint8(),
|
||||
bf.ReadUint32(),
|
||||
bf.ReadUint8(),
|
||||
bf.ReadUint8(),
|
||||
}
|
||||
} else {
|
||||
m.FilenameLength = bf.ReadUint8()
|
||||
m.Filename = string(bf.ReadBytes(uint(m.FilenameLength)))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgSysGetFile) Build(bf *byteframe.ByteFrame) error {
|
||||
panic("Not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import (
|
||||
)
|
||||
|
||||
// MsgSysUnlockStage represents the MSG_SYS_UNLOCK_STAGE
|
||||
type MsgSysUnlockStage struct{}
|
||||
type MsgSysUnlockStage struct {
|
||||
Unk0 uint16 // Hardcoded 0 in the binary.
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
func (m *MsgSysUnlockStage) Opcode() network.PacketID {
|
||||
@@ -15,7 +17,7 @@ func (m *MsgSysUnlockStage) Opcode() network.PacketID {
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgSysUnlockStage) Parse(bf *byteframe.ByteFrame) error {
|
||||
// No data
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,14 @@ import (
|
||||
)
|
||||
|
||||
// MsgSysWaitStageBinary represents the MSG_SYS_WAIT_STAGE_BINARY
|
||||
type MsgSysWaitStageBinary struct{}
|
||||
type MsgSysWaitStageBinary struct{
|
||||
AckHandle uint32
|
||||
BinaryType0 uint8
|
||||
BinaryType1 uint8
|
||||
Unk0 uint32 // Hardcoded 0
|
||||
StageIDLength uint8
|
||||
StageID string
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
func (m *MsgSysWaitStageBinary) Opcode() network.PacketID {
|
||||
@@ -15,7 +22,13 @@ func (m *MsgSysWaitStageBinary) Opcode() network.PacketID {
|
||||
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgSysWaitStageBinary) Parse(bf *byteframe.ByteFrame) error {
|
||||
panic("Not implemented")
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.BinaryType0 = bf.ReadUint8()
|
||||
m.BinaryType1 = bf.ReadUint8()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.StageIDLength = bf.ReadUint8()
|
||||
m.StageID = string(bf.ReadBytes(uint(m.StageIDLength)))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
|
||||
Reference in New Issue
Block a user