fix(handlers): fix softlock on forge purchases and N-points

MSG_CA_EXCHANGE_ITEM and MSG_MHF_USE_UD_SHOP_COIN had Parse() returning
"NOT IMPLEMENTED". The dispatch loop in handlePacketGroup treats any
Parse error as a silent drop — no ACK is sent, causing the client to
wait indefinitely (softlock). Reported on 9.3.0-rc1 for forge item
purchases and Hunting Road N-point interactions.

Fix follows the pattern from d27da5e: parse only the AckHandle, return
nil from Parse, and respond with doAckBufFail so the client's error
branch exits cleanly without reading response fields.
This commit is contained in:
Houmgaor
2026-03-23 22:20:32 +01:00
parent 72088db4ff
commit abab6dc3a1
11 changed files with 33 additions and 27 deletions

View File

@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed playtime regression across sessions: `updateSaveDataWithStruct` now writes the accumulated playtime back into the binary save blob, preventing each reconnect from loading a stale in-game counter and rolling back progress. - Fixed playtime regression across sessions: `updateSaveDataWithStruct` now writes the accumulated playtime back into the binary save blob, preventing each reconnect from loading a stale in-game counter and rolling back progress.
- Fixed player softlock when buying items at the forge: `MSG_CA_EXCHANGE_ITEM` `Parse()` was returning `NOT IMPLEMENTED`, causing the dispatch loop to drop the packet without sending an ACK. Now parses the `AckHandle` and responds with `doAckBufFail` so the client's error branch exits cleanly.
- Fixed player softlock on N-points (Hunting Road) interactions: same root cause for `MSG_MHF_USE_UD_SHOP_COIN``Parse()` now reads the `AckHandle` and responds with `doAckBufFail`.
## [9.3.1] - 2026-03-23 ## [9.3.1] - 2026-03-23

View File

@@ -1594,7 +1594,6 @@ func TestBatchParseNotImplemented(t *testing.T) {
&MsgSysDispObject{}, &MsgSysHideObject{}, &MsgSysDispObject{}, &MsgSysHideObject{},
&MsgMhfServerCommand{}, &MsgMhfSetLoginwindow{}, &MsgMhfShutClient{}, &MsgMhfServerCommand{}, &MsgMhfSetLoginwindow{}, &MsgMhfShutClient{},
&MsgMhfUpdateGuildcard{}, &MsgMhfUpdateGuildcard{},
&MsgCaExchangeItem{},
} }
for _, pkt := range packets { for _, pkt := range packets {

View File

@@ -9,7 +9,9 @@ import (
) )
// MsgCaExchangeItem represents the MSG_CA_EXCHANGE_ITEM // MsgCaExchangeItem represents the MSG_CA_EXCHANGE_ITEM
type MsgCaExchangeItem struct{} type MsgCaExchangeItem struct {
AckHandle uint32 // TODO: complete reverse-engineering of request fields
}
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
func (m *MsgCaExchangeItem) Opcode() network.PacketID { func (m *MsgCaExchangeItem) Opcode() network.PacketID {
@@ -18,7 +20,8 @@ func (m *MsgCaExchangeItem) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgCaExchangeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgCaExchangeItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED") m.AckHandle = bf.ReadUint32()
return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.

View File

@@ -497,6 +497,8 @@ func TestAckHandlePacketsParse(t *testing.T) {
{"MsgMhfGetKijuInfo", network.MSG_MHF_GET_KIJU_INFO}, {"MsgMhfGetKijuInfo", network.MSG_MHF_GET_KIJU_INFO},
{"MsgMhfGetExtraInfo", network.MSG_MHF_GET_EXTRA_INFO}, {"MsgMhfGetExtraInfo", network.MSG_MHF_GET_EXTRA_INFO},
{"MsgMhfGetCogInfo", network.MSG_MHF_GET_COG_INFO}, {"MsgMhfGetCogInfo", network.MSG_MHF_GET_COG_INFO},
{"MsgCaExchangeItem", network.MSG_CA_EXCHANGE_ITEM},
{"MsgMhfUseUdShopCoin", network.MSG_MHF_USE_UD_SHOP_COIN},
} }
ctx := &clientctx.ClientContext{RealClientMode: cfg.ZZ} ctx := &clientctx.ClientContext{RealClientMode: cfg.ZZ}

View File

@@ -9,7 +9,9 @@ import (
) )
// MsgMhfUseUdShopCoin represents the MSG_MHF_USE_UD_SHOP_COIN // MsgMhfUseUdShopCoin represents the MSG_MHF_USE_UD_SHOP_COIN
type MsgMhfUseUdShopCoin struct{} type MsgMhfUseUdShopCoin struct {
AckHandle uint32 // TODO: complete reverse-engineering of request fields
}
// Opcode returns the ID associated with this packet type. // Opcode returns the ID associated with this packet type.
func (m *MsgMhfUseUdShopCoin) Opcode() network.PacketID { func (m *MsgMhfUseUdShopCoin) Opcode() network.PacketID {
@@ -18,7 +20,8 @@ func (m *MsgMhfUseUdShopCoin) Opcode() network.PacketID {
// Parse parses the packet from binary // Parse parses the packet from binary
func (m *MsgMhfUseUdShopCoin) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error { func (m *MsgMhfUseUdShopCoin) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
return errors.New("NOT IMPLEMENTED") m.AckHandle = bf.ReadUint32()
return nil
} }
// Build builds a binary packet from the current data. // Build builds a binary packet from the current data.

View File

@@ -37,7 +37,7 @@ func TestParseSmallNotImplemented(t *testing.T) {
{"MsgMhfSetUdTacticsFollower", &MsgMhfSetUdTacticsFollower{}}, {"MsgMhfSetUdTacticsFollower", &MsgMhfSetUdTacticsFollower{}},
{"MsgMhfStampcardPrize", &MsgMhfStampcardPrize{}}, {"MsgMhfStampcardPrize", &MsgMhfStampcardPrize{}},
{"MsgMhfUpdateForceGuildRank", &MsgMhfUpdateForceGuildRank{}}, {"MsgMhfUpdateForceGuildRank", &MsgMhfUpdateForceGuildRank{}},
{"MsgMhfUseUdShopCoin", &MsgMhfUseUdShopCoin{}},
// SYS packets - NOT IMPLEMENTED // SYS packets - NOT IMPLEMENTED
{"MsgSysAuthData", &MsgSysAuthData{}}, {"MsgSysAuthData", &MsgSysAuthData{}},

View File

@@ -215,7 +215,13 @@ func handleMsgMhfGetUdShopCoin(s *Session, p mhfpacket.MHFPacket) {
doAckSimpleSucceed(s, pkt.AckHandle, bf.Data()) doAckSimpleSucceed(s, pkt.AckHandle, bf.Data())
} }
func handleMsgMhfUseUdShopCoin(s *Session, p mhfpacket.MHFPacket) {} // stub: unimplemented func handleMsgMhfUseUdShopCoin(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfUseUdShopCoin)
// TODO: full response format is not yet reverse-engineered.
// doAckBufFail sends a well-formed buf-type ACK with error code 1.
// The client's fail branch exits cleanly without reading response fields.
doAckBufFail(s, pkt.AckHandle, nil)
}
func handleMsgMhfGetEnhancedMinidata(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfGetEnhancedMinidata(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetEnhancedMinidata) pkt := p.(*mhfpacket.MsgMhfGetEnhancedMinidata)

View File

@@ -526,13 +526,8 @@ func TestHandleMsgMhfUseUdShopCoin(t *testing.T) {
server := createMockServer() server := createMockServer()
session := createMockSession(1, server) session := createMockSession(1, server)
defer func() { pkt := &mhfpacket.MsgMhfUseUdShopCoin{AckHandle: 1}
if r := recover(); r != nil { handleMsgMhfUseUdShopCoin(session, pkt)
t.Errorf("handleMsgMhfUseUdShopCoin panicked: %v", r)
}
}()
handleMsgMhfUseUdShopCoin(session, nil)
} }
func TestHandleMsgMhfGetLobbyCrowd(t *testing.T) { func TestHandleMsgMhfGetLobbyCrowd(t *testing.T) {
@@ -1028,7 +1023,6 @@ func TestEmptyHandlers_MiscFiles_Misc(t *testing.T) {
fn func() fn func()
}{ }{
{"handleMsgMhfUseUdShopCoin", func() { handleMsgMhfUseUdShopCoin(session, nil) }},
{"handleMsgMhfGetDailyMissionMaster", func() { handleMsgMhfGetDailyMissionMaster(session, nil) }}, {"handleMsgMhfGetDailyMissionMaster", func() { handleMsgMhfGetDailyMissionMaster(session, nil) }},
{"handleMsgMhfGetDailyMissionPersonal", func() { handleMsgMhfGetDailyMissionPersonal(session, nil) }}, {"handleMsgMhfGetDailyMissionPersonal", func() { handleMsgMhfGetDailyMissionPersonal(session, nil) }},
{"handleMsgMhfSetDailyMissionPersonal", func() { handleMsgMhfSetDailyMissionPersonal(session, nil) }}, {"handleMsgMhfSetDailyMissionPersonal", func() { handleMsgMhfSetDailyMissionPersonal(session, nil) }},

View File

@@ -752,7 +752,13 @@ func handleMsgMhfTransitMessage(s *Session, p mhfpacket.MHFPacket) {
doAckBufSucceed(s, pkt.AckHandle, resp.Data()) doAckBufSucceed(s, pkt.AckHandle, resp.Data())
} }
func handleMsgCaExchangeItem(s *Session, p mhfpacket.MHFPacket) {} // stub: unimplemented func handleMsgCaExchangeItem(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgCaExchangeItem)
// TODO: full response format is not yet reverse-engineered.
// doAckBufFail sends a well-formed buf-type ACK with error code 1.
// The client's fail branch exits cleanly without reading response fields.
doAckBufFail(s, pkt.AckHandle, nil)
}
func handleMsgMhfServerCommand(s *Session, p mhfpacket.MHFPacket) {} // stub: unimplemented func handleMsgMhfServerCommand(s *Session, p mhfpacket.MHFPacket) {} // stub: unimplemented

View File

@@ -559,13 +559,8 @@ func TestHandleMsgCaExchangeItem(t *testing.T) {
server := createMockServer() server := createMockServer()
session := createMockSession(1, server) session := createMockSession(1, server)
defer func() { pkt := &mhfpacket.MsgCaExchangeItem{AckHandle: 1}
if r := recover(); r != nil { handleMsgCaExchangeItem(session, pkt)
t.Errorf("handleMsgCaExchangeItem panicked: %v", r)
}
}()
handleMsgCaExchangeItem(session, nil)
} }
func TestHandleMsgMhfServerCommand(t *testing.T) { func TestHandleMsgMhfServerCommand(t *testing.T) {
@@ -1068,7 +1063,6 @@ func TestEmptyHandlers_HandlersGo(t *testing.T) {
{"handleMsgSysUpdateRight", func() { handleMsgSysUpdateRight(session, nil) }}, {"handleMsgSysUpdateRight", func() { handleMsgSysUpdateRight(session, nil) }},
{"handleMsgSysAuthQuery", func() { handleMsgSysAuthQuery(session, nil) }}, {"handleMsgSysAuthQuery", func() { handleMsgSysAuthQuery(session, nil) }},
{"handleMsgSysAuthTerminal", func() { handleMsgSysAuthTerminal(session, nil) }}, {"handleMsgSysAuthTerminal", func() { handleMsgSysAuthTerminal(session, nil) }},
{"handleMsgCaExchangeItem", func() { handleMsgCaExchangeItem(session, nil) }},
{"handleMsgMhfServerCommand", func() { handleMsgMhfServerCommand(session, nil) }}, {"handleMsgMhfServerCommand", func() { handleMsgMhfServerCommand(session, nil) }},
{"handleMsgMhfSetLoginwindow", func() { handleMsgMhfSetLoginwindow(session, nil) }}, {"handleMsgMhfSetLoginwindow", func() { handleMsgMhfSetLoginwindow(session, nil) }},
{"handleMsgSysTransBinary", func() { handleMsgSysTransBinary(session, nil) }}, {"handleMsgSysTransBinary", func() { handleMsgSysTransBinary(session, nil) }},
@@ -1106,7 +1100,6 @@ func TestEmptyHandlers_Concurrent(t *testing.T) {
handleMsgSysUpdateRight, handleMsgSysUpdateRight,
handleMsgSysAuthQuery, handleMsgSysAuthQuery,
handleMsgSysAuthTerminal, handleMsgSysAuthTerminal,
handleMsgCaExchangeItem,
handleMsgMhfServerCommand, handleMsgMhfServerCommand,
handleMsgMhfSetLoginwindow, handleMsgMhfSetLoginwindow,
handleMsgSysTransBinary, handleMsgSysTransBinary,

View File

@@ -279,7 +279,6 @@ func TestEmptyHandlers_NoDb(t *testing.T) {
{"handleMsgSysUpdateRight", handleMsgSysUpdateRight}, {"handleMsgSysUpdateRight", handleMsgSysUpdateRight},
{"handleMsgSysAuthQuery", handleMsgSysAuthQuery}, {"handleMsgSysAuthQuery", handleMsgSysAuthQuery},
{"handleMsgSysAuthTerminal", handleMsgSysAuthTerminal}, {"handleMsgSysAuthTerminal", handleMsgSysAuthTerminal},
{"handleMsgCaExchangeItem", handleMsgCaExchangeItem},
{"handleMsgMhfServerCommand", handleMsgMhfServerCommand}, {"handleMsgMhfServerCommand", handleMsgMhfServerCommand},
{"handleMsgMhfSetLoginwindow", handleMsgMhfSetLoginwindow}, {"handleMsgMhfSetLoginwindow", handleMsgMhfSetLoginwindow},
{"handleMsgSysTransBinary", handleMsgSysTransBinary}, {"handleMsgSysTransBinary", handleMsgSysTransBinary},
@@ -294,7 +293,6 @@ func TestEmptyHandlers_NoDb(t *testing.T) {
{"handleMsgMhfKickExportForce", handleMsgMhfKickExportForce}, {"handleMsgMhfKickExportForce", handleMsgMhfKickExportForce},
{"handleMsgSysSetStatus", handleMsgSysSetStatus}, {"handleMsgSysSetStatus", handleMsgSysSetStatus},
{"handleMsgSysEcho", handleMsgSysEcho}, {"handleMsgSysEcho", handleMsgSysEcho},
{"handleMsgMhfUseUdShopCoin", handleMsgMhfUseUdShopCoin},
{"handleMsgMhfEnterTournamentQuest", handleMsgMhfEnterTournamentQuest}, {"handleMsgMhfEnterTournamentQuest", handleMsgMhfEnterTournamentQuest},
} }