Skip to content

Commit

Permalink
Match getMesgHeader on JPN
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Dec 29, 2024
1 parent 2e6e40f commit 4a0a895
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
6 changes: 3 additions & 3 deletions include/f_op/f_op_msg_mng.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef F_F_OP_MSG_MNG_H_
#define F_F_OP_MSG_MNG_H_
#ifndef F_OP_MSG_MNG_H
#define F_OP_MSG_MNG_H

#include "SSystem/SComponent/c_xyz.h"
#include "f_pc/f_pc_leaf.h"
Expand Down Expand Up @@ -250,4 +250,4 @@ bool fopMsgM_demoMsgFlagCheck();

void fopMsgM_blendInit(fopMsgM_pane_class* i_this, const char* data);

#endif
#endif /* F_OP_MSG_MNG_H */
45 changes: 33 additions & 12 deletions src/f_op/f_op_msg_mng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include "f_op/f_op_msg_mng.h"
#include "JSystem/JKernel/JKRArchive.h"
#include "JSystem/JUtility/JUTDataHeader.h"
#if VERSION == VERSION_JPN
#include "d/d_s_play.h"
#endif
#include "f_op/f_op_scene_mng.h"
#include "f_pc/f_pc_manager.h"
#include "f_pc/f_pc_layer_iter.h"
Expand Down Expand Up @@ -288,6 +291,8 @@ u32 fopMsgM_tactMessageSet() {
/* 8002BB78-8002BDBC .text fopMsgM_messageGet__FPcUl */
char* fopMsgM_messageGet(char*, u32) {
/* Nonmatching */
OSReport("head_p");
OSReport("");
}

/* 8002BE04-8002C02C .text fopMsgM_passwordGet__FPcUl */
Expand Down Expand Up @@ -532,20 +537,27 @@ fpc_ProcID fopMsgM_Create(s16, fopMsgCreateFunc, void*) {

/* 8002E254-8002E2D8 .text getMesgHeader__16fopMsgM_msgGet_cFUl */
mesg_header* fopMsgM_msgGet_c::getMesgHeader(u32 msg) {
mGroupID = (msg >> 16) & 0xFFFF;
mMsgID = msg & 0xFFFF;
mGroupID = (msg >> 16);
mMsgID = msg;

#if VERSION == VERSION_JPN
char path[12];
if (g_msgDHIO.field_0x08 == 0) {
sprintf(path, "zel_%02d.bmg", mGroupID);
} else {
sprintf(path, "zel_e%02d.bmg", mGroupID);
}
JKRArchive* arc = dComIfGp_getMsgDtArchive();
return (mesg_header*)JKRArchive::getGlbResource('ROOT', path, arc);
#else
if (fopMsgM_hyrule_language_check(msg)) {
#if VERSION != VERSION_JPN
JKRArchive* arc = dComIfGp_getMsgDt2Archive();
#else
JKRArchive* arc = dComIfGp_getMsgDtArchive();
#endif
return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_01.bmg", arc);
} else {
JKRArchive* arc = dComIfGp_getMsgDtArchive();
return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_00.bmg", arc);
}
#endif
}

/* 8002E2D8-8002E2E0 .text getMesgInfo__16fopMsgM_msgGet_cFP11mesg_header */
Expand Down Expand Up @@ -588,20 +600,29 @@ const char* fopMsgM_msgGet_c::getMessage(mesg_header* msg) {

/* 8002E430-8002E4AC .text getMesgHeader__20fopMsgM_itemMsgGet_cFUl */
mesg_header* fopMsgM_itemMsgGet_c::getMesgHeader(u32 msg) {
/* Nonmatching */
mMsgID = msg & 0xFFFF;
#if VERSION == VERSION_JPN
u16 groupID = msg >> 16;
#endif
mMsgID = msg;

#if VERSION == VERSION_JPN
char path[12];
if (g_msgDHIO.field_0x08 == 0) {
sprintf(path, "zel_%02d.bmg", groupID);
} else {
sprintf(path, "zel_e%02d.bmg", groupID);
}
JKRArchive* arc = dComIfGp_getMsgDtArchive();
return (mesg_header*)JKRArchive::getGlbResource('ROOT', path, arc);
#else
if (fopMsgM_hyrule_language_check(msg)) {
#if VERSION != VERSION_JPN
JKRArchive* arc = dComIfGp_getMsgDt2Archive();
#else
JKRArchive* arc = dComIfGp_getMsgDtArchive();
#endif
return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_01.bmg", arc);
} else {
JKRArchive* arc = dComIfGp_getMsgDtArchive();
return (mesg_header*)JKRArchive::getGlbResource('ROOT', "zel_00.bmg", arc);
}
#endif
}

/* 8002E4AC-8002E4B4 .text getMesgInfo__20fopMsgM_itemMsgGet_cFP11mesg_header */
Expand Down

0 comments on commit 4a0a895

Please sign in to comment.