chore(merge): merge main into develop

Backports two softlock fixes and playtime regression fix from main.
Also removes handleMsgMhfEnterTournamentQuest from the nil-stub test
list — it's a real DB-backed handler and has its own dedicated test.
This commit is contained in:
Houmgaor
2026-03-23 22:50:27 +01:00
12 changed files with 40 additions and 27 deletions

View File

@@ -243,7 +243,13 @@ func handleMsgMhfGetUdShopCoin(s *Session, p mhfpacket.MHFPacket) {
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) {
pkt := p.(*mhfpacket.MsgMhfGetEnhancedMinidata)

View File

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

View File

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

View File

@@ -281,7 +281,6 @@ func TestEmptyHandlers_NoDb(t *testing.T) {
{"handleMsgSysUpdateRight", handleMsgSysUpdateRight},
{"handleMsgSysAuthQuery", handleMsgSysAuthQuery},
{"handleMsgSysAuthTerminal", handleMsgSysAuthTerminal},
{"handleMsgCaExchangeItem", handleMsgCaExchangeItem},
{"handleMsgMhfServerCommand", handleMsgMhfServerCommand},
{"handleMsgMhfSetLoginwindow", handleMsgMhfSetLoginwindow},
{"handleMsgSysTransBinary", handleMsgSysTransBinary},
@@ -296,7 +295,6 @@ func TestEmptyHandlers_NoDb(t *testing.T) {
{"handleMsgMhfKickExportForce", handleMsgMhfKickExportForce},
{"handleMsgSysSetStatus", handleMsgSysSetStatus},
{"handleMsgSysEcho", handleMsgSysEcho},
{"handleMsgMhfUseUdShopCoin", handleMsgMhfUseUdShopCoin},
}
for _, tt := range tests {

View File

@@ -148,6 +148,11 @@ func (save *CharacterSaveData) updateSaveDataWithStruct() {
if save.Mode >= cfg.F4 {
copy(save.decompSave[save.Pointers[pRP]:save.Pointers[pRP]+saveFieldRP], rpBytes)
}
if save.Mode >= cfg.S6 {
playtimeBytes := make([]byte, 4)
binary.LittleEndian.PutUint32(playtimeBytes, save.Playtime)
copy(save.decompSave[save.Pointers[pPlaytime]:save.Pointers[pPlaytime]+saveFieldPlaytime], playtimeBytes)
}
if save.Mode >= cfg.G10 {
copy(save.decompSave[save.Pointers[pKQF]:save.Pointers[pKQF]+saveFieldKQF], save.KQF)
}