partially decode TerminalLog

This commit is contained in:
wish
2022-10-06 02:23:01 +11:00
parent d9541a6d1a
commit 4f2a94cc50
2 changed files with 21 additions and 17 deletions

View File

@@ -1,17 +1,19 @@
package mhfpacket package mhfpacket
import ( import (
"errors" "errors"
"erupe-ce/network/clientctx"
"erupe-ce/network"
"erupe-ce/common/byteframe" "erupe-ce/common/byteframe"
"erupe-ce/network"
"erupe-ce/network/clientctx"
) )
// TerminalLogEntry represents an entry in the MSG_SYS_TERMINAL_LOG packet. // TerminalLogEntry represents an entry in the MSG_SYS_TERMINAL_LOG packet.
type TerminalLogEntry struct { type TerminalLogEntry struct {
// Unknown fields Index uint32
U0, U1, U2, U3, U4, U5, U6, U7, U8 uint32 Type1 uint8
Type2 uint8
Data []int16
} }
// MsgSysTerminalLog represents the MSG_SYS_TERMINAL_LOG // MsgSysTerminalLog represents the MSG_SYS_TERMINAL_LOG
@@ -37,15 +39,12 @@ func (m *MsgSysTerminalLog) Parse(bf *byteframe.ByteFrame, ctx *clientctx.Client
for i := 0; i < int(m.EntryCount); i++ { for i := 0; i < int(m.EntryCount); i++ {
e := &TerminalLogEntry{} e := &TerminalLogEntry{}
e.U0 = bf.ReadUint32() e.Index = bf.ReadUint32()
e.U1 = bf.ReadUint32() e.Type1 = bf.ReadUint8()
e.U2 = bf.ReadUint32() e.Type2 = bf.ReadUint8()
e.U3 = bf.ReadUint32() for j := 0; j < 15; j++ {
e.U4 = bf.ReadUint32() e.Data = append(e.Data, bf.ReadInt16())
e.U5 = bf.ReadUint32() }
e.U6 = bf.ReadUint32()
e.U7 = bf.ReadUint32()
e.U8 = bf.ReadUint32()
m.Entries = append(m.Entries, e) m.Entries = append(m.Entries, e)
} }

View File

@@ -118,9 +118,14 @@ func handleMsgSysAck(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgSysTerminalLog(s *Session, p mhfpacket.MHFPacket) { func handleMsgSysTerminalLog(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgSysTerminalLog) pkt := p.(*mhfpacket.MsgSysTerminalLog)
for i := range pkt.Entries {
s.server.logger.Info("SysTerminalLog",
zap.Uint8("Type1", pkt.Entries[i].Type1),
zap.Uint8("Type2", pkt.Entries[i].Type2),
zap.Int16s("Data", pkt.Entries[i].Data))
}
resp := byteframe.NewByteFrame() resp := byteframe.NewByteFrame()
resp.WriteUint32(pkt.LogID + 1) // LogID to use for requests after this.
resp.WriteUint32(0x98bd51a9) // LogID to use for requests after this.
doAckSimpleSucceed(s, pkt.AckHandle, resp.Data()) doAckSimpleSucceed(s, pkt.AckHandle, resp.Data())
} }