Implement stage binaries, stack locking, and logkeys

This commit is contained in:
Andrew Gutekanst
2020-02-03 22:56:54 -05:00
parent 5924db9b42
commit 4e1cef9bf3
8 changed files with 136 additions and 23 deletions

View File

@@ -6,7 +6,14 @@ import (
)
// MsgSysGetStageBinary represents the MSG_SYS_GET_STAGE_BINARY
type MsgSysGetStageBinary struct{}
type MsgSysGetStageBinary 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 *MsgSysGetStageBinary) Opcode() network.PacketID {
@@ -15,10 +22,16 @@ func (m *MsgSysGetStageBinary) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgSysGetStageBinary) 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.
func (m *MsgSysGetStageBinary) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
}
}

View File

@@ -6,7 +6,11 @@ import (
)
// MsgSysIssueLogkey represents the MSG_SYS_ISSUE_LOGKEY
type MsgSysIssueLogkey struct{}
type MsgSysIssueLogkey struct {
AckHandle uint32
Unk0 uint16 // Hardcoded 00 01 in binary
Unk1 uint16 // Hardcoded 0 in binary.
}
// Opcode returns the ID associated with this packet type.
func (m *MsgSysIssueLogkey) Opcode() network.PacketID {
@@ -15,10 +19,13 @@ func (m *MsgSysIssueLogkey) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgSysIssueLogkey) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint16()
m.Unk1 = bf.ReadUint16()
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgSysIssueLogkey) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
}
}

View File

@@ -6,7 +6,13 @@ import (
)
// MsgSysLockStage represents the MSG_SYS_LOCK_STAGE
type MsgSysLockStage struct{}
type MsgSysLockStage struct {
AckHandle uint32
Unk0 uint8 // Hardcoded 1 in the binary
Unk1 uint8 // Hardcoded 1 in the binary
StageIDLength uint8
StageID string
}
// Opcode returns the ID associated with this packet type.
func (m *MsgSysLockStage) Opcode() network.PacketID {
@@ -15,10 +21,15 @@ func (m *MsgSysLockStage) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgSysLockStage) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
m.AckHandle = bf.ReadUint32()
m.Unk0 = bf.ReadUint8()
m.Unk1 = bf.ReadUint8()
m.StageIDLength = bf.ReadUint8()
m.StageID = string(bf.ReadBytes(uint(m.StageIDLength)))
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgSysLockStage) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
}
}

View File

@@ -7,8 +7,8 @@ import (
// MsgSysSetStageBinary represents the MSG_SYS_SET_STAGE_BINARY
type MsgSysSetStageBinary struct {
Unk0 uint8
BinaryType uint8 // Index
BinaryType0 uint8
BinaryType1 uint8 // Index
StageIDLength uint8 // <= 0x20
DataSize uint16 // <= 0x400
StageID string
@@ -22,8 +22,8 @@ func (m *MsgSysSetStageBinary) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgSysSetStageBinary) Parse(bf *byteframe.ByteFrame) error {
m.Unk0 = bf.ReadUint8()
m.BinaryType = bf.ReadUint8()
m.BinaryType0 = bf.ReadUint8()
m.BinaryType1 = bf.ReadUint8()
m.StageIDLength = bf.ReadUint8()
m.DataSize = bf.ReadUint16()
m.StageID = string(bf.ReadBytes(uint(m.StageIDLength)))

View File

@@ -15,10 +15,11 @@ func (m *MsgSysUnlockStage) Opcode() network.PacketID {
// Parse parses the packet from binary
func (m *MsgSysUnlockStage) Parse(bf *byteframe.ByteFrame) error {
panic("Not implemented")
// No data
return nil
}
// Build builds a binary packet from the current data.
func (m *MsgSysUnlockStage) Build(bf *byteframe.ByteFrame) error {
panic("Not implemented")
}
}