mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
fix(items): stop G-rank Workshop/Cog softlock on missing ACK
MSG_MHF_GET_EXTRA_INFO (0xA6) and MSG_MHF_GET_COG_INFO (0xC3) had Parse() returning NOT IMPLEMENTED. The dispatch loop treats any Parse error as a hard drop — no ACK is ever sent, so the client waits indefinitely and effectively soft-locks when entering the G-rank Workshop or Master Felyne (Cog) screens. Fix: parse AckHandle (the only field we can confirm from the protocol) and respond with doAckBufFail so the client receives a well-formed buf-type ACK with error code 1. The client's fail branch for these requests exits cleanly without reading response fields, avoiding the read-past-EOF crash that an empty success ACK would cause. The full response format for both packets is still unknown; a complete implementation requires further RE. The TODO comments mark the gap. Fixes #180.
This commit is contained in:
@@ -55,7 +55,11 @@ func handleMsgMhfEnumerateOrder(s *Session, p mhfpacket.MHFPacket) {
|
||||
stubEnumerateNoResults(s, pkt.AckHandle)
|
||||
}
|
||||
|
||||
func handleMsgMhfGetExtraInfo(s *Session, p mhfpacket.MHFPacket) {} // stub: unimplemented
|
||||
func handleMsgMhfGetExtraInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetExtraInfo)
|
||||
// TODO: response structure unknown; fail ACK prevents softlock without misleading client
|
||||
doAckBufFail(s, pkt.AckHandle, nil)
|
||||
}
|
||||
|
||||
func userGetItems(s *Session) []mhfitem.MHFItemStack {
|
||||
var items []mhfitem.MHFItemStack
|
||||
@@ -91,7 +95,11 @@ func handleMsgMhfUpdateUnionItem(s *Session, p mhfpacket.MHFPacket) {
|
||||
doAckSimpleSucceed(s, pkt.AckHandle, make([]byte, 4))
|
||||
}
|
||||
|
||||
func handleMsgMhfGetCogInfo(s *Session, p mhfpacket.MHFPacket) {} // stub: unimplemented
|
||||
func handleMsgMhfGetCogInfo(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfGetCogInfo)
|
||||
// TODO: response structure unknown; fail ACK prevents softlock without misleading client
|
||||
doAckBufFail(s, pkt.AckHandle, nil)
|
||||
}
|
||||
|
||||
func handleMsgMhfCheckWeeklyStamp(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfCheckWeeklyStamp)
|
||||
|
||||
@@ -494,13 +494,8 @@ func TestHandleMsgMhfGetExtraInfo(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("handleMsgMhfGetExtraInfo panicked: %v", r)
|
||||
}
|
||||
}()
|
||||
|
||||
handleMsgMhfGetExtraInfo(session, nil)
|
||||
pkt := &mhfpacket.MsgMhfGetExtraInfo{AckHandle: 1}
|
||||
handleMsgMhfGetExtraInfo(session, pkt)
|
||||
}
|
||||
|
||||
func TestHandleMsgMhfTransferItem(t *testing.T) {
|
||||
|
||||
@@ -336,13 +336,8 @@ func TestHandleMsgMhfGetCogInfo(t *testing.T) {
|
||||
server := createMockServer()
|
||||
session := createMockSession(1, server)
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
t.Errorf("handleMsgMhfGetCogInfo panicked: %v", r)
|
||||
}
|
||||
}()
|
||||
|
||||
handleMsgMhfGetCogInfo(session, nil)
|
||||
pkt := &mhfpacket.MsgMhfGetCogInfo{AckHandle: 1}
|
||||
handleMsgMhfGetCogInfo(session, pkt)
|
||||
}
|
||||
|
||||
// Additional handler tests for coverage
|
||||
@@ -1032,7 +1027,7 @@ func TestEmptyHandlers_MiscFiles_Misc(t *testing.T) {
|
||||
name string
|
||||
fn func()
|
||||
}{
|
||||
{"handleMsgMhfGetCogInfo", func() { handleMsgMhfGetCogInfo(session, nil) }},
|
||||
|
||||
{"handleMsgMhfUseUdShopCoin", func() { handleMsgMhfUseUdShopCoin(session, nil) }},
|
||||
{"handleMsgMhfGetDailyMissionMaster", func() { handleMsgMhfGetDailyMissionMaster(session, nil) }},
|
||||
{"handleMsgMhfGetDailyMissionPersonal", func() { handleMsgMhfGetDailyMissionPersonal(session, nil) }},
|
||||
|
||||
@@ -1079,7 +1079,6 @@ func TestEmptyHandlers_HandlersGo(t *testing.T) {
|
||||
{"handleMsgSysEnumuser", func() { handleMsgSysEnumuser(session, nil) }},
|
||||
{"handleMsgSysInfokyserver", func() { handleMsgSysInfokyserver(session, nil) }},
|
||||
{"handleMsgMhfGetCaUniqueID", func() { handleMsgMhfGetCaUniqueID(session, nil) }},
|
||||
{"handleMsgMhfGetExtraInfo", func() { handleMsgMhfGetExtraInfo(session, nil) }},
|
||||
{"handleMsgSysSetStatus", func() { handleMsgSysSetStatus(session, nil) }},
|
||||
{"handleMsgMhfStampcardPrize", func() { handleMsgMhfStampcardPrize(session, nil) }},
|
||||
{"handleMsgMhfKickExportForce", func() { handleMsgMhfKickExportForce(session, nil) }},
|
||||
@@ -1118,7 +1117,6 @@ func TestEmptyHandlers_Concurrent(t *testing.T) {
|
||||
handleMsgSysEnumuser,
|
||||
handleMsgSysInfokyserver,
|
||||
handleMsgMhfGetCaUniqueID,
|
||||
handleMsgMhfGetExtraInfo,
|
||||
handleMsgSysSetStatus,
|
||||
handleMsgSysDeleteObject,
|
||||
handleMsgSysRotateObject,
|
||||
|
||||
@@ -290,8 +290,6 @@ func TestEmptyHandlers_NoDb(t *testing.T) {
|
||||
{"handleMsgSysEnumuser", handleMsgSysEnumuser},
|
||||
{"handleMsgSysInfokyserver", handleMsgSysInfokyserver},
|
||||
{"handleMsgMhfGetCaUniqueID", handleMsgMhfGetCaUniqueID},
|
||||
{"handleMsgMhfGetExtraInfo", handleMsgMhfGetExtraInfo},
|
||||
{"handleMsgMhfGetCogInfo", handleMsgMhfGetCogInfo},
|
||||
{"handleMsgMhfStampcardPrize", handleMsgMhfStampcardPrize},
|
||||
{"handleMsgMhfKickExportForce", handleMsgMhfKickExportForce},
|
||||
{"handleMsgSysSetStatus", handleMsgSysSetStatus},
|
||||
|
||||
Reference in New Issue
Block a user