mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-12 23:14:36 +01:00
correctly parse some ravi packets & ignore zeroes
This commit is contained in:
@@ -28,7 +28,8 @@ func (m *MsgMhfAnnounce) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientCon
|
||||
m.IPAddress = bf.ReadUint32()
|
||||
m.Port = bf.ReadUint16()
|
||||
_ = bf.ReadUint8()
|
||||
_ = bf.ReadUint16()
|
||||
_ = bf.ReadUint8()
|
||||
_ = bf.ReadUint8()
|
||||
m.StageID = bf.ReadBytes(32)
|
||||
_ = bf.ReadUint32()
|
||||
m.Type = bf.ReadUint8()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
@@ -25,22 +24,12 @@ func (m *MsgSysLoadRegister) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Clien
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.RegisterID = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint8()
|
||||
fixedZero0 := bf.ReadUint16()
|
||||
fixedZero1 := bf.ReadUint8()
|
||||
|
||||
if fixedZero0 != 0 || fixedZero1 != 0 {
|
||||
return fmt.Errorf("expected fixed-0 values, got %d %d", fixedZero0, fixedZero1)
|
||||
}
|
||||
_ = bf.ReadUint8()
|
||||
_ = bf.ReadUint16()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgSysLoadRegister) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
bf.WriteUint32(m.AckHandle)
|
||||
bf.WriteUint32(m.RegisterID)
|
||||
bf.WriteUint8(m.Unk1)
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint8(0)
|
||||
|
||||
return nil
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"errors"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
@@ -12,7 +11,6 @@ import (
|
||||
type MsgSysOperateRegister struct {
|
||||
AckHandle uint32
|
||||
SemaphoreID uint32
|
||||
fixedZero uint16
|
||||
RawDataPayload []byte
|
||||
}
|
||||
|
||||
@@ -25,12 +23,7 @@ func (m *MsgSysOperateRegister) Opcode() network.PacketID {
|
||||
func (m *MsgSysOperateRegister) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.SemaphoreID = bf.ReadUint32()
|
||||
m.fixedZero = bf.ReadUint16()
|
||||
|
||||
if m.fixedZero != 0 {
|
||||
return fmt.Errorf("expected fixed-0 values, got %d", m.fixedZero)
|
||||
}
|
||||
|
||||
_ = bf.ReadUint16()
|
||||
dataSize := bf.ReadUint16()
|
||||
m.RawDataPayload = bf.ReadBytes(uint(dataSize))
|
||||
return nil
|
||||
@@ -38,11 +31,5 @@ func (m *MsgSysOperateRegister) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Cl
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgSysOperateRegister) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
bf.WriteUint32(m.AckHandle)
|
||||
bf.WriteUint32(m.SemaphoreID)
|
||||
bf.WriteUint16(0)
|
||||
bf.WriteUint16(uint16(len(m.RawDataPayload)))
|
||||
bf.WriteBytes(m.RawDataPayload)
|
||||
|
||||
return nil
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user