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