JASSeqCtrl OK + misc functions (#346)

* JASSeqCtrl OK + misc functions

* Work on JASAudioThread
This commit is contained in:
hatal175
2023-06-09 11:55:15 +03:00
committed by GitHub
parent 98582af6d2
commit f17cf7f6f1
41 changed files with 525 additions and 1248 deletions
+143 -75
View File
@@ -6,65 +6,56 @@
#include "d/d_bright_check.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "d/d_drawlist.h"
#include "d/com/d_com_inf_game.h"
#include "d/msg/d_msg_string.h"
#include "d/meter/d_meter2_info.h"
#include "m_Do/m_Do_controller_pad.h"
#include "JSystem/J2DGraph/J2DTextBox.h"
#include "JSystem/J2DGraph/J2DGrafContext.h"
#include "JSystem/J2DGraph/J2DScreen.h"
#include "JSystem/JKernel/JKRArchive.h"
//
// Types:
//
struct mDoCPd_c {
static u8 m_cpadInfo[256];
};
struct dMsgString_c {
/* 80249C20 */ dMsgString_c();
/* 80249D28 */ ~dMsgString_c();
};
struct dDlst_base_c {};
struct dDlst_list_c {
/* 80056794 */ void set(dDlst_base_c**&, dDlst_base_c**&, dDlst_base_c*);
};
struct dDlst_BrightCheck_c {
struct dDlst_BrightCheck_c
#ifdef NONMATCHING
: public dDlst_base_c
#endif
{
#ifdef NONMATCHING
/* 801935D0 */ virtual void draw();
/* 80193648 */ virtual ~dDlst_BrightCheck_c() {};
#else
/* 801935D0 */ void draw();
/* 80193648 */ ~dDlst_BrightCheck_c();
void* vtable;
#endif
J2DScreen* mScreen;
};
struct JKRArchive {};
struct dBrightCheck_c {
/* 80192F10 */ dBrightCheck_c(JKRArchive*);
#ifdef NONMATCHING
/* 80192F98 */ virtual ~dBrightCheck_c();
#else
void * vtable;
/* 80192F98 */ ~dBrightCheck_c();
#endif
/* 80193030 */ void screenSet();
/* 801934D0 */ void _move();
/* 80193508 */ void modeWait();
/* 8019350C */ void modeMove();
/* 80193594 */ void _draw();
};
struct JAISoundID {};
struct Vec {};
struct Z2SeMgr {
/* 802AB984 */ void seStart(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8);
};
struct Z2AudioMgr {
static u8 mAudioMgrPtr[4 + 4 /* padding */];
};
struct J2DTextBox {
/* 8030074C */ void setString(s16, char const*, ...);
};
struct J2DGrafContext {};
struct J2DScreen {
/* 802F8498 */ J2DScreen();
/* 802F8648 */ void setPriority(char const*, u32, JKRArchive*);
/* 802F8ED4 */ void draw(f32, f32, J2DGrafContext const*);
/* 0x04 */ JKRArchive* mArchive;
/* 0x08 */ dDlst_BrightCheck_c mDlstBrightCheck;
/* 0x10 */ u8 field_0x10[4];
/* 0x14 */ dMsgString_c* mMsgString;
/* 0x18 */ u8 field_0x18;
/* 0x19 */ u8 field_0x19;
};
//
@@ -104,7 +95,6 @@ extern "C" void _savegpr_22();
extern "C" void _restgpr_22();
extern "C" extern void* __vt__12dDlst_base_c[3];
extern "C" u8 m_cpadInfo__8mDoCPd_c[256];
extern "C" extern u8 g_dComIfG_gameInfo[122384];
extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */];
//
@@ -117,6 +107,13 @@ SECTION_DATA static u8 cNullVec__6Z2Calc[12] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
typedef void (dBrightCheck_c::*BrightCheckFunc)();
#ifdef NONMATCHING
SECTION_DATA static BrightCheckFunc brightChackProc[2] = {
&dBrightCheck_c::modeWait, &dBrightCheck_c::modeMove,
};
#else
/* 803BB5BC-803BB5C8 -00001 000C+00 0/1 0/0 0/0 .data @3797 */
#pragma push
#pragma force_active on
@@ -163,7 +160,19 @@ SECTION_DATA extern void* __vt__14dBrightCheck_c[3 + 4 /* padding */] = {
NULL,
};
#endif
/* 80192F10-80192F98 18D850 0088+00 0/0 1/1 0/0 .text __ct__14dBrightCheck_cFP10JKRArchive */
// Matches without vtables
#ifdef NONMATCHING
dBrightCheck_c::dBrightCheck_c(JKRArchive* param_0) {
mArchive = param_0;
mMsgString = new dMsgString_c();
screenSet();
field_0x19 = 0;
field_0x18 = 1;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -172,8 +181,15 @@ asm dBrightCheck_c::dBrightCheck_c(JKRArchive* param_0) {
#include "asm/d/d_bright_check/__ct__14dBrightCheck_cFP10JKRArchive.s"
}
#pragma pop
#endif
/* 80192F98-80193030 18D8D8 0098+00 1/0 0/0 0/0 .text __dt__14dBrightCheck_cFv */
#ifdef NONMATCHING
dBrightCheck_c::~dBrightCheck_c() {
delete mDlstBrightCheck.mScreen;
delete mMsgString;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -182,23 +198,20 @@ asm dBrightCheck_c::~dBrightCheck_c() {
#include "asm/d/d_bright_check/__dt__14dBrightCheck_cFv.s"
}
#pragma pop
#endif
/* ############################################################################################## */
/* 80394910-80394938 020F70 0028+00 1/1 0/0 0/0 .rodata tv_btnA$3744 */
SECTION_RODATA static u8 const tv_btnA[40] = {
0x63, 0x6F, 0x6E, 0x74, 0x5F, 0x61, 0x74, 0x31, 0x63, 0x6F, 0x6E, 0x74, 0x5F, 0x61,
0x74, 0x32, 0x63, 0x6F, 0x6E, 0x74, 0x5F, 0x61, 0x74, 0x33, 0x63, 0x6F, 0x6E, 0x74,
0x5F, 0x61, 0x74, 0x34, 0x00, 0x63, 0x6F, 0x6E, 0x74, 0x5F, 0x61, 0x74,
SECTION_RODATA static u64 const tv_btnA[5] = {
'cont_at1', 'cont_at2', 'cont_at3', 'cont_at4', 'cont_at',
};
COMPILER_STRIP_GATE(0x80394910, &tv_btnA);
/* 80394938-80394960 020F98 0028+00 0/1 0/0 0/0 .rodata ftv_btnA$3745 */
#pragma push
#pragma force_active on
SECTION_RODATA static u8 const ftv_btnA[40] = {
0x00, 0x66, 0x6F, 0x6E, 0x74, 0x5F, 0x61, 0x31, 0x66, 0x6F, 0x6E, 0x74, 0x5F, 0x61,
0x74, 0x32, 0x66, 0x6F, 0x6E, 0x74, 0x5F, 0x61, 0x74, 0x33, 0x66, 0x6F, 0x6E, 0x74,
0x5F, 0x61, 0x74, 0x34, 0x00, 0x66, 0x6F, 0x6E, 0x74, 0x5F, 0x61, 0x74,
SECTION_RODATA static u64 const ftv_btnA[5] = {
'font_a1', 'font_at2', 'font_at3' , 'font_at4', 'font_at',
};
COMPILER_STRIP_GATE(0x80394938, &ftv_btnA);
#pragma pop
@@ -206,12 +219,9 @@ COMPILER_STRIP_GATE(0x80394938, &ftv_btnA);
/* 80394960-803949B0 020FC0 0050+00 0/1 0/0 0/0 .rodata txTV$3751 */
#pragma push
#pragma force_active on
SECTION_RODATA static u8 const txTV[80] = {
0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x36, 0x31, 0x00, 0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x32,
0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x39, 0x31, 0x00, 0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x31,
0x6D, 0x65, 0x6E, 0x75, 0x74, 0x31, 0x30, 0x31, 0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x30, 0x31,
0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x37, 0x31, 0x00, 0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x33,
0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x38, 0x31, 0x00, 0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x74, 0x34,
SECTION_RODATA static u64 const txTV[10] = {
'menu_t61', 'menu_t2', 'menu_t91', 'menu_t1', 'menut101', 'menu_t01', 'menu_t71',
'menu_t3', 'menu_t81', 'menu_t4',
};
COMPILER_STRIP_GATE(0x80394960, &txTV);
#pragma pop
@@ -219,10 +229,8 @@ COMPILER_STRIP_GATE(0x80394960, &txTV);
/* 803949B0-803949D8 021010 0028+00 0/1 0/0 0/0 .rodata txTVhide$3752 */
#pragma push
#pragma force_active on
SECTION_RODATA static u8 const txTVhide[40] = {
0x00, 0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x36, 0x6E, 0x00, 0x6D, 0x65, 0x6E, 0x75, 0x5F,
0x39, 0x6E, 0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x31, 0x30, 0x6E, 0x00, 0x6D, 0x65, 0x6E,
0x75, 0x5F, 0x37, 0x6E, 0x00, 0x6D, 0x65, 0x6E, 0x75, 0x5F, 0x38, 0x6E,
SECTION_RODATA static u64 const txTVhide[5] = {
'menu_6n', 'menu_9n', 'menu_10n', 'menu_7n', 'menu_8n',
};
COMPILER_STRIP_GATE(0x803949B0, &txTVhide);
#pragma pop
@@ -243,6 +251,56 @@ SECTION_SDATA2 static u8 lit_3792[4] = {
};
/* 80193030-801934D0 18D970 04A0+00 1/1 0/0 0/0 .text screenSet__14dBrightCheck_cFv */
// matches with literals
#ifdef NONMATCHING
void dBrightCheck_c::screenSet() {
mDlstBrightCheck.mScreen = new J2DScreen();
mDlstBrightCheck.mScreen->setPriority("zelda_option_check.blo", 0x1100000, mArchive);
mDlstBrightCheck.mScreen->search('g_abtn_n')->hide();
J2DTextBox* textBox = (J2DTextBox*)mDlstBrightCheck.mScreen->search('f_t00');
mDlstBrightCheck.mScreen->search('f_t00')->show();
mDlstBrightCheck.mScreen->search('t_t00')->hide();
textBox->setFont(mDoExt_getRubyFont());
textBox->setString(0x40, "");
mMsgString->getString(0x55c, textBox, NULL, NULL, NULL, 0);
J2DTextBox* texts[5];
for (int i = 0; i < 5; i++) {
texts[i] = (J2DTextBox*)mDlstBrightCheck.mScreen->search(ftv_btnA[i]);
mDlstBrightCheck.mScreen->search(tv_btnA[i])->hide();
texts[i]->setFont(mDoExt_getMesgFont());
texts[i]->setString(0x40, "");
mMsgString->getString(0x564, texts[i], NULL, NULL, NULL, 0);
}
for (int i = 0; i < 5; i++) {
mDlstBrightCheck.mScreen->search(txTVhide[i])->hide();
}
for (int i = 0; i < 10; i++) {
textBox = (J2DTextBox*)mDlstBrightCheck.mScreen->search(txTV[i]);
textBox->setFont(mDoExt_getMesgFont());
textBox->setCharSpace(0.0f);
if (i < 2) {
textBox->setString(0x100, "");
mMsgString->getString(0x558, textBox, NULL, NULL, NULL, 0);
} else if (i < 4) {
textBox->setString(0x100, "");
mMsgString->getString(0x557, textBox, NULL, NULL, NULL, 0);
} else if (i < 6) {
textBox->setString(0x100, "");
mMsgString->getString(0x559, textBox, NULL, NULL, NULL, 0);
} else if (i < 8) {
textBox->setString(0x100, "");
mMsgString->getString(0x55a, textBox, NULL, NULL, NULL, 0);
} else {
textBox->setString(0x100, "");
mMsgString->getString(0x55b, textBox, NULL, NULL, NULL, 0);
}
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -251,16 +309,12 @@ asm void dBrightCheck_c::screenSet() {
#include "asm/d/d_bright_check/screenSet__14dBrightCheck_cFv.s"
}
#pragma pop
#endif
/* 801934D0-80193508 18DE10 0038+00 0/0 1/1 0/0 .text _move__14dBrightCheck_cFv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void dBrightCheck_c::_move() {
nofralloc
#include "asm/d/d_bright_check/_move__14dBrightCheck_cFv.s"
void dBrightCheck_c::_move() {
(this->*(((BrightCheckFunc*)brightChackProc)[field_0x18]))();
}
#pragma pop
/* 80193508-8019350C 18DE48 0004+00 1/0 0/0 0/0 .text modeWait__14dBrightCheck_cFv */
void dBrightCheck_c::modeWait() {
@@ -279,16 +333,21 @@ SECTION_SDATA2 static f32 lit_3822[1 + 1 /* padding */] = {
};
/* 8019350C-80193594 18DE4C 0088+00 1/0 0/0 0/0 .text modeMove__14dBrightCheck_cFv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void dBrightCheck_c::modeMove() {
nofralloc
#include "asm/d/d_bright_check/modeMove__14dBrightCheck_cFv.s"
void dBrightCheck_c::modeMove() {
if (mDoCPd_c::getTrigA(0) || mDoCPd_c::getTrigStart(0)) {
mDoAud_seStart(1, 0, 0, 0);
field_0x19 = 1;
field_0x18 = 0;
}
}
#pragma pop
/* 80193594-801935D0 18DED4 003C+00 0/0 1/1 0/0 .text _draw__14dBrightCheck_cFv */
// Matches with mDlstBrightCheck inheritance
#ifdef NONMATCHING
void dBrightCheck_c::_draw() {
dComIfGd_set2DOpa(&mDlstBrightCheck);
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -297,8 +356,16 @@ asm void dBrightCheck_c::_draw() {
#include "asm/d/d_bright_check/_draw__14dBrightCheck_cFv.s"
}
#pragma pop
#endif
/* 801935D0-80193608 18DF10 0038+00 1/0 0/0 0/0 .text draw__19dDlst_BrightCheck_cFv */
// Matches with literals
#ifdef NONMATCHING
void dDlst_BrightCheck_c::draw() {
J2DGrafContext* grafContext = dComIfGp_getCurrentGrafPort();
mScreen->draw(0.0f, 0.0f, grafContext);
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -307,6 +374,7 @@ asm void dDlst_BrightCheck_c::draw() {
#include "asm/d/d_bright_check/draw__19dDlst_BrightCheck_cFv.s"
}
#pragma pop
#endif
/* 80193608-80193648 18DF48 0040+00 0/0 1/0 0/0 .text __sinit_d_bright_check_cpp */
#pragma push
+2 -12
View File
@@ -1042,7 +1042,6 @@ int dEvent_manager_c::getMySubstanceNum(int index, char const* name) {
/* 8004817C-800481F4 042ABC 0078+00 1/1 78/78 182/182 .text cutEnd__16dEvent_manager_cFi
*/
#ifdef NONMATCHING
void dEvent_manager_c::cutEnd(int cutIndex) {
if (i_dComIfGp_getEvent().getMode() == EVT_MODE_NONE) {
return;
@@ -1052,19 +1051,10 @@ void dEvent_manager_c::cutEnd(int cutIndex) {
return;
} else {
// instruction swap
mFlags.flagSet(getBase().getCutStaffCurrentCutP(cutIndex)->getFlagId());
dEvDtCut_c* cut = getBase().getCutStaffCurrentCutP(cutIndex);
mFlags.flagSet(cut->getFlagId());
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void dEvent_manager_c::cutEnd(int param_0) {
nofralloc
#include "asm/d/event/d_event_manager/cutEnd__16dEvent_manager_cFi.s"
}
#pragma pop
#endif
/* 800481F4-800482CC 042B34 00D8+00 0/0 4/4 0/0 .text
* getEventPrio__16dEvent_manager_cFP10fopAc_ac_cs */
+49 -35
View File
@@ -301,23 +301,21 @@ Vec dMapInfo_n::getMapRestartPos() {
/* 8003F0F8-8003F19C 039A38 00A4+00 1/1 1/1 0/0 .text getMapRestartAngleY__10dMapInfo_nFv
*/
// small regalloc
#ifdef NONMATCHING
s16 dMapInfo_n::getMapRestartAngleY() {
int angle = dComIfGs_getRestartRoomAngleY();
const dTres_c::typeGroupData_c* icon_data = getConstRestartIconPointer();
if (icon_data != NULL) {
int icon_angle = icon_data->getAngleY();
bool tmp = icon_angle > 0;
angle = icon_data->getAngleY();
bool tmp = angle > 0;
if (tmp) {
icon_angle = -icon_angle;
angle = -angle;
}
angle = icon_angle * 0x0100;
angle = angle * 0x0100;
if (tmp) {
angle = icon_angle * -0x0100;
angle = -angle;
}
}
@@ -329,16 +327,6 @@ s16 dMapInfo_n::getMapRestartAngleY() {
return angle;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm s16 dMapInfo_n::getMapRestartAngleY() {
nofralloc
#include "asm/d/map/d_map_path_dmap/getMapRestartAngleY__10dMapInfo_nFv.s"
}
#pragma pop
#endif
/* 8003F19C-8003F1F4 039ADC 0058+00 0/0 1/1 0/0 .text getRoomCenter__10dMapInfo_nFiPfPf
*/
@@ -896,24 +884,49 @@ asm int renderingDAmap_c::getNextDrawRoomNo(int param_0) {
#endif
/* 80040134-800401E8 03AA74 00B4+00 3/0 3/0 0/0 .text getFirstRoomPointer__16renderingDAmap_cFv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm dDrawPath_c::room_class* renderingDAmap_c::getFirstRoomPointer() {
nofralloc
#include "asm/d/map/d_map_path_dmap/getFirstRoomPointer__16renderingDAmap_cFv.s"
dDrawPath_c::room_class* renderingDAmap_c::getFirstRoomPointer() {
dDrawPath_c::room_class* pRoomClass = NULL;
mRoomNo = getFirstDrawRoomNo();
if (mRoomNo >= 0) {
field_0x28 = getFirstDrawLayerNo();
pRoomClass = dMpath_c::getRoomPointer(field_0x28, mRoomNo);
if (pRoomClass == NULL) {
pRoomClass = getNextRoomPointer();
}
}
if(pRoomClass != NULL) {
setSingleRoomSetting();
}
return pRoomClass;
}
#pragma pop
/* 800401E8-800402C0 03AB28 00D8+00 3/0 3/0 0/0 .text getNextRoomPointer__16renderingDAmap_cFv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm dDrawPath_c::room_class* renderingDAmap_c::getNextRoomPointer() {
nofralloc
#include "asm/d/map/d_map_path_dmap/getNextRoomPointer__16renderingDAmap_cFv.s"
dDrawPath_c::room_class* renderingDAmap_c::getNextRoomPointer() {
dDrawPath_c::room_class* pRoomClass = NULL;
bool bVar1 = false;
do {
mRoomNo = getNextDrawRoomNo(mRoomNo);
if (mRoomNo < 0) {
field_0x28 = getNextDrawLayerNo(field_0x28);
if (field_0x28 < 0) {
bVar1 = true;
} else {
mRoomNo = getFirstDrawRoomNo();
}
}
if (!bVar1) {
pRoomClass = dMpath_c::getRoomPointer(field_0x28, mRoomNo);
}
} while(pRoomClass == NULL && !bVar1);
if (pRoomClass != NULL) {
setSingleRoomSetting();
}
return pRoomClass;
}
#pragma pop
/* 800402C0-800402E0 03AC00 0020+00 3/0 3/0 0/0 .text isDrawPath__16renderingDAmap_cFv */
bool renderingDAmap_c::isDrawPath() {
@@ -921,8 +934,8 @@ bool renderingDAmap_c::isDrawPath() {
}
/* 800402E0-800402E8 03AC20 0008+00 3/0 3/0 0/0 .text getFirstDrawLayerNo__16renderingDAmap_cFv */
bool renderingDAmap_c::getFirstDrawLayerNo() {
return false;
int renderingDAmap_c::getFirstDrawLayerNo() {
return 0;
}
/* 800402E8-800402FC 03AC28 0014+00 3/0 3/0 0/0 .text getNextDrawLayerNo__16renderingDAmap_cFi */
@@ -1232,8 +1245,9 @@ void renderingPlusDoorAndCursor_c::drawTreasure() {
setTevSettingIntensityTextureToCI();
for (int i = 0; i < 4; i++) {
dTres_c::typeGroupData_c* typeGroupData_p;
u8 tmp = l_treasureDispList_4524[i].field_0x0;
dTres_c::typeGroupData_c* typeGroupData_p = getFirstData(tmp);
typeGroupData_p = getFirstData(tmp);
int group_num = getIconGroupNumber(tmp);
if (group_num != 0) {
@@ -1256,7 +1270,7 @@ void renderingPlusDoorAndCursor_c::drawTreasure() {
GXSetTevColor(GX_TEVREG2, sp18);
for (int j = 0; j < group_num && typeGroupData_p != NULL; j++) {
Vec* icon_pos = getIconPosition(typeGroupData_p);
const Vec* icon_pos = getIconPosition(typeGroupData_p);
if (tmp == 0) {
if (mRoomNoSingle != typeGroupData_p->getRoomNo()) {