From 411a467ddcd9840d8bb0410f6b789af8224ef03d Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 14 Oct 2023 13:23:24 -0700 Subject: [PATCH] d_s_logo start, VERSION_SELECT --- include/JAZelAudio/JAIZelBasic.h | 2 +- include/JSystem/J2DGraph/J2DPicture.h | 40 + include/JSystem/J3DGraphBase/J3DDrawBuffer.h | 6 +- include/MSL_C/string.h | 1 + include/d/d_com_inf_game.h | 106 ++- include/d/d_drawlist.h | 17 +- include/d/d_particle.h | 1 + include/d/d_resorce.h | 5 +- include/d/d_s_play.h | 2 + include/dolphin/os/OSRtc.h | 2 + include/f_op/f_op_overlap_mng.h | 2 +- include/global.h | 8 + include/m_Do/m_Do_MemCard.h | 2 + include/m_Do/m_Do_dvd_thread.h | 3 +- include/m_Do/m_Do_ext.h | 8 + include/m_Do/m_Do_machine.h | 19 +- src/JAZelAudio/JAIZelBasic.cpp | 2 +- src/JSystem/J3DGraphBase/J3DDrawBuffer.cpp | 4 +- src/JSystem/JKernel/JKRAram.cpp | 24 +- src/JSystem/JKernel/JKRArchivePub.cpp | 54 +- src/JSystem/JKernel/JKRCompArchive.cpp | 12 +- src/JSystem/JKernel/JKRDvdRipper.cpp | 30 +- src/JSystem/JKernel/JKRHeap.cpp | 27 +- src/JSystem/JKernel/JKRSolidHeap.cpp | 15 +- src/d/actor/d_a_am.cpp | 194 ++--- src/d/d_s_logo.cpp | 815 ++++++++++++++++++- src/f_op/f_op_overlap_mng.cpp | 2 +- src/m_Do/m_Do_machine.cpp | 18 +- src/m_Do/m_Do_main.cpp | 6 +- 29 files changed, 1108 insertions(+), 319 deletions(-) create mode 100644 include/JSystem/J2DGraph/J2DPicture.h diff --git a/include/JAZelAudio/JAIZelBasic.h b/include/JAZelAudio/JAIZelBasic.h index e891140b9..64e93fa09 100644 --- a/include/JAZelAudio/JAIZelBasic.h +++ b/include/JAZelAudio/JAIZelBasic.h @@ -100,7 +100,7 @@ public: BOOL check1stDynamicWave(); void load2ndDynamicWave(); void loadStaticWaves(); - void checkFirstWaves(); + BOOL checkFirstWaves(); void setLinkHp(s32, s32); void setLinkSwordType(s32, s32); void setLinkShieldType(s32, s32); diff --git a/include/JSystem/J2DGraph/J2DPicture.h b/include/JSystem/J2DGraph/J2DPicture.h new file mode 100644 index 000000000..8bc9e7647 --- /dev/null +++ b/include/JSystem/J2DGraph/J2DPicture.h @@ -0,0 +1,40 @@ +#ifndef J2DPICTURE_H +#define J2DPICTURE_H + +#include "JSystem/J2DGraph/J2DPane.h" +#include "JSystem/JUtility/TColor.h" +#include "dolphin/gx/GX.h" + +class JKRArchive; +class JUTTexture; +class JUTPalette; + +class J2DPicture : public J2DPane { +public: + virtual ~J2DPicture(); + virtual u16 getTypeID() { return 0x12; } + virtual void drawSelf(f32 x, f32 y); + virtual void drawSelf(f32 x, f32 y, Mtx* mtx); + virtual void drawOut(f32, f32, f32, f32, f32, f32); + virtual void drawOut(f32, f32, f32, f32, f32, f32, f32, f32); + + void setWhite(JUtility::TColor white) { mColorWhite = white; } + void setBlack(JUtility::TColor black) { mColorBlack = black; } + +private: + /* 0x0CC */ JUTTexture * mpTexture[2]; + /* 0x0D4 */ u32 field_0xd4[2]; + /* 0x0DC */ u8 mNumTexture; + /* 0x0E0 */ f32 mBlendKonstColorF[4]; + /* 0x0F0 */ f32 mBlendKonstAlphaF[4]; + /* 0x100 */ JUTPalette * mpPalette; + /* 0x104 */ JUtility::TColor mColorWhite; + /* 0x108 */ JUtility::TColor mColorBlack; + /* 0x10C */ JUtility::TColor mNewColor[4]; + /* 0x11C */ JUtility::TColor mBlendKonstColor; + /* 0x120 */ JUtility::TColor mBlendKonstAlpha; +}; + +STATIC_ASSERT(sizeof(J2DPicture) == 0x124); + +#endif /* J2DPICTURE_H */ diff --git a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h index aae6e4ff3..c9db9a85c 100644 --- a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h +++ b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h @@ -11,11 +11,11 @@ class J3DMatPacket; class J3DShapePacket; class J3DCallBackPacket; -typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*); -typedef void (J3DDrawBuffer::*drawFunc)() const; - class J3DDrawBuffer { public: + typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*); + typedef void (J3DDrawBuffer::*drawFunc)() const; + enum EDrawType { DRAW_HEAD, DRAW_TAIL, diff --git a/include/MSL_C/string.h b/include/MSL_C/string.h index ea08c98fa..418cdc48f 100644 --- a/include/MSL_C/string.h +++ b/include/MSL_C/string.h @@ -4,5 +4,6 @@ #include "MSL_C/MSL_Common/Src/extras.h" #include "MSL_C/MSL_Common/Src/mem.h" #include "MSL_C/MSL_Common/Src/string.h" +#include "MSL_C/MSL_Common/Src/printf.h" #endif diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 8039e0e67..ea290ca75 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -379,6 +379,40 @@ public: void setCurrentWindow(dDlst_window_c* i_window) { mCurrentWindow = i_window; } void setCurrentView(view_class* i_view) { mCurrentView = i_view; } void setCurrentViewport(view_port_class* i_viewport) { mCurrentViewport = i_viewport; } + + void setMsgArchive(JKRArchive * pArc) { mpMsgArchive = pArc; } + void setDmsgArchive(JKRArchive * pArc) { mpDmsgArchive = pArc; } + void setTmsgArchive(JKRArchive * pArc) { mpTmsgArchive = pArc; } + void setMenuArchive(JKRArchive * pArc) { mpMenuArchive = pArc; } + void setFont0Archive(JKRArchive * pArc) { mpFont0Archive = pArc; } + void setFont1Archive(JKRArchive * pArc) { mpFont1Archive = pArc; } + void setAnmArchive(JKRArchive * pArc) { mpAnmArchive = pArc; } + void setLkDArc(JKRArchive * pArc) { mpLkDArc = pArc; } + void setFmapArchive(JKRArchive * pArc) { mpFmapArchive = pArc; } + void setItemResArchive(JKRArchive * pArc) { mpItemResArchive = pArc; } + void setClctResArchive(JKRArchive * pArc) { mpClctResArchive = pArc; } + void setFmapResArchive(JKRArchive * pArc) { mpFmapResArchive = pArc; } + void setDmapResArchive(JKRArchive * pArc) { mpDmapResArchive = pArc; } + void setOptResArchive(JKRArchive * pArc) { mpOptResArchive = pArc; } + void setClothResArchive(JKRArchive * pArc) { mpClothResArchive = pArc; } + void setSaveResArchive(JKRArchive * pArc) { mpSaveResArchive = pArc; } + void setItemIconArchive(JKRArchive * pArc) { mpItemIconArchive = pArc; } + void setNameResArchive(JKRArchive * pArc) { mpNameResArchive = pArc; } + void setErrorResArchive(JKRArchive * pArc) { mpErrorResArchive = pArc; } + void setActionIconArchive(JKRArchive * pArc) { mpActionIconArchive = pArc; } + void setScopeResArchive(JKRArchive * pArc) { mpScopeResArchive = pArc; } + void setCamResArchive(JKRArchive * pArc) { mpCamResArchive = pArc; } + void setSwimResArchive(JKRArchive * pArc) { mpSwimResArchive = pArc; } + void setWindResArchive(JKRArchive * pArc) { mpWindResArchive = pArc; } + void setFontArchive(JKRArchive * pArc) { mpFont0Archive = pArc; } + void setMsgDtArchive(JKRArchive * pArc) { mpEnglishTextArchive = pArc; } +#if VERSION != VERSION_JPN + void setMsgDt2Archive(JKRArchive * pArc) { mpHyruleTextArchive = pArc; } +#endif + + void setItemTable(void * pData) { mpItemTable = pData; } + void setFmapData(void * pData) { mpFmapData = pData; } + /* 0x0000 */ dBgS mBgS; /* 0x1404 */ dCcS mCcS; /* 0x3DF8 */ dADM mADM; @@ -401,11 +435,11 @@ public: /* 0x47AC */ JKRArchive* mpFont1Archive; /* 0x47B0 */ JKRArchive* mpAnmArchive; /* 0x47B4 */ JKRArchive* mpLkDArc; - /* 0x47B8 */ JKRArchive* mpFMapArchive; + /* 0x47B8 */ JKRArchive* mpFmapArchive; /* 0x47BC */ JKRArchive* mpItemResArchive; /* 0x47C0 */ JKRArchive* mpClctResArchive; - /* 0x47C4 */ JKRArchive* mpFMapResArchive; - /* 0x47C8 */ JKRArchive* mpDMapResArchive; + /* 0x47C4 */ JKRArchive* mpFmapResArchive; + /* 0x47C8 */ JKRArchive* mpDmapResArchive; /* 0x47CC */ JKRArchive* mpOptResArchive; /* 0x47D0 */ JKRArchive* mpClothResArchive; /* 0x47D4 */ JKRArchive* mpSaveResArchive; @@ -417,12 +451,19 @@ public: /* 0x47EC */ JKRArchive* mpCamResArchive; /* 0x47F0 */ JKRArchive* mpSwimResArchive; /* 0x47F4 */ JKRArchive* mpWindResArchive; -#if VERSION != VERSION_JPN /* 0x47F8 */ JKRArchive* mpEnglishTextArchive; +#if VERSION != VERSION_JPN /* 0x47FC */ JKRArchive* mpHyruleTextArchive; - /* 0x4800 */ u8 mCARDHeap0[0x04]; + /* 0x4800 */ void * mAramHeap0[3]; + /* 0x480C */ void * mAramHeap1[4]; + /* 0x481C */ void * field_0x481c; + /* 0x4820 */ void * field_0x4820; +#else + /* 0x47FC */ void * mAramHeap0[3]; + /* 0x480C */ void * mAramHeap1[4]; #endif - /* 0x4804 */ u8 mCARDHeap1[0x20]; + /* Offsets below are for USA/PAL */ + /* 0x4824 */ dPa_control_c* mParticle; /* 0x4828 */ dDemo_manager_c* mDemo; /* 0x482C */ dMagma_packet_c* mpMagmaPacket; @@ -545,8 +586,8 @@ public: /* 0x4A66 */ u8 mIkadaShipBeforeRoomId; /* 0x4A67 */ u8 mIkadaShipId; /* 0x4A68 */ cXyz mIkadaLinkPos; - /* 0x4A74 */ void* mpItemTableArchive; - /* 0x4A78 */ void* mpFmapDataArchive; + /* 0x4A74 */ void* mpItemTable; + /* 0x4A78 */ void* mpFmapData; }; class dComIfG_inf_c { @@ -1731,6 +1772,45 @@ inline void dComIfGd_setWindow(dDlst_window_c* pWindow) { g_dComIfG_gameInfo.dra inline void dComIfGd_setViewPort(view_port_class* pViewPort) { g_dComIfG_gameInfo.drawlist.setViewPort(pViewPort); } inline void dComIfGd_setView(view_class* pView) { g_dComIfG_gameInfo.drawlist.setView(pView); } +/** + * === ARCHIVE === + */ + + +inline void dComIfGp_setAnmArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setAnmArchive(pArc); } +inline void dComIfGp_setMsgArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setMsgArchive(pArc); } +inline void dComIfGp_setDmsgArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setDmsgArchive(pArc); } +inline void dComIfGp_setTmsgArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setTmsgArchive(pArc); } +inline void dComIfGp_setMenuArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setMenuArchive(pArc); } +inline void dComIfGp_setFont0Archive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setFont0Archive(pArc); } +inline void dComIfGp_setFont1Archive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setFont1Archive(pArc); } +inline void dComIfGp_setLkDArc(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setLkDArc(pArc); } +inline void dComIfGp_setFmapArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setFmapArchive(pArc); } +inline void dComIfGp_setItemResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setItemResArchive(pArc); } +inline void dComIfGp_setClctResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setClctResArchive(pArc); } +inline void dComIfGp_setFmapResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setFmapResArchive(pArc); } +inline void dComIfGp_setDmapResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setDmapResArchive(pArc); } +inline void dComIfGp_setOptResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setOptResArchive(pArc); } +inline void dComIfGp_setClothResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setClothResArchive(pArc); } +inline void dComIfGp_setSaveResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setSaveResArchive(pArc); } +inline void dComIfGp_setItemIconArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setItemIconArchive(pArc); } +inline void dComIfGp_setNameResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setNameResArchive(pArc); } +inline void dComIfGp_setErrorResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setErrorResArchive(pArc); } +inline void dComIfGp_setActionIconArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setActionIconArchive(pArc); } +inline void dComIfGp_setScopeResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setScopeResArchive(pArc); } +inline void dComIfGp_setCamResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setCamResArchive(pArc); } +inline void dComIfGp_setSwimResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setSwimResArchive(pArc); } +inline void dComIfGp_setWindResArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setWindResArchive(pArc); } +inline void dComIfGp_setFontArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setFontArchive(pArc); } +inline void dComIfGp_setMsgDtArchive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setMsgDtArchive(pArc); } +#if VERSION != VERSION_JPN +inline void dComIfGp_setMsgDt2Archive(JKRArchive * pArc) { g_dComIfG_gameInfo.play.setMsgDt2Archive(pArc); } +#endif + +inline void dComIfGp_setItemTable(void * pData) { g_dComIfG_gameInfo.play.setItemTable(pData); } +inline void dComIfGp_setActorData(void * pData) { g_dComIfG_gameInfo.play.mADM.SetData(pData); } +inline void dComIfGp_setFmapData(void * pData) { g_dComIfG_gameInfo.play.setFmapData(pData); } + /** * === RESOURCE === */ @@ -1756,11 +1836,15 @@ inline int dComIfG_syncObjectRes(const char* name) { return g_dComIfG_gameInfo.mResControl.syncObjectRes(name); } +inline int dComIfG_syncAllObjectRes() { + return g_dComIfG_gameInfo.mResControl.syncAllObjectRes(); +} + inline int dComIfG_syncStageRes(const char* name) { return g_dComIfG_gameInfo.mResControl.syncStageRes(name); } -inline int dComIfG_deleteObjectResMain(const char* res) { +inline int dComIfG_deleteObjectRes(const char* res) { return g_dComIfG_gameInfo.mResControl.deleteObjectRes(res); } @@ -1919,6 +2003,10 @@ inline void dComIfGp_particle_readScene(u8 particle_no, mDoDvdThd_toMainRam_c** g_dComIfG_gameInfo.play.getParticle()->readScene(particle_no, param_1); } +inline void dComIfGp_particle_createCommon(const void * pArc) { + g_dComIfG_gameInfo.play.getParticle()->createCommon(pArc); +} + /** * === ATTENTION === */ diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index c649a67d8..f8c386fd2 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -2,6 +2,7 @@ #define D_D_DRAWLIST_H #include "JSystem/J3DGraphBase/J3DDrawBuffer.h" +#include "JSystem/J2DGraph/J2DPicture.h" #include "f_op/f_op_view.h" #include "global.h" #include "m_Do/m_Do_ext.h" @@ -15,6 +16,20 @@ public: virtual void draw(); }; +class dDlst_2D_c : public dDlst_base_c { +public: + dDlst_2D_c(ResTIMG * pTIMG, s16 w, s16 h, u8 alpha); + J2DPicture * getPicture() { return &mPicture; } + void setAlpha(u8 alpha) { mAlpha = alpha; } + +protected: + /* 0x004 */ J2DPicture mPicture; + /* 0x128 */ s16 mWidth; + /* 0x12A */ s16 mHeight; + /* 0x12C */ u8 mAlpha; + /* 0x12D */ u8 field_0x12e[3]; +}; + class dDlst_window_c { public: dDlst_window_c() {} @@ -139,7 +154,7 @@ public: int setReal2(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*); bool addReal(u32, J3DModel*); int setSimple(cXyz*, f32, f32, cXyz*, s16, f32, GXTexObj*); - static void setSimpleTex(ResTIMG const*); + static void setSimpleTex(void *); static GXTexObj* getSimpleTex() { return &mSimpleTexObj; } diff --git a/include/d/d_particle.h b/include/d/d_particle.h index 31e1746f7..270bacd46 100644 --- a/include/d/d_particle.h +++ b/include/d/d_particle.h @@ -426,6 +426,7 @@ public: void drawModelParticle() { mModelCtrl->draw(); } + JKRHeap * getHeap() { return mpHeap; } /* 0x0000 */ JKRHeap* mpHeap; /* 0x0004 */ JPAResourceManager* mpCommonResMgr; diff --git a/include/d/d_resorce.h b/include/d/d_resorce.h index 49a5e724b..6e0bd4b2d 100644 --- a/include/d/d_resorce.h +++ b/include/d/d_resorce.h @@ -62,9 +62,8 @@ public: void dump(); int getObjectResName2Index(char const*, char const*); - int setObjectRes(const char* name, u8 param_1, JKRHeap* heap) { - return setRes(name, &mObjectInfo[0], ARRAY_SIZE(mObjectInfo), "/res/Object/", param_1, - heap); + int setObjectRes(const char* name, u8 direction, JKRHeap* heap) { + return setRes(name, &mObjectInfo[0], ARRAY_SIZE(mObjectInfo), "/res/Object/", direction, heap); } void* getObjectRes(const char* arcName, const char* resName) { diff --git a/include/d/d_s_play.h b/include/d/d_s_play.h index cc3783e20..8ba61ec58 100644 --- a/include/d/d_s_play.h +++ b/include/d/d_s_play.h @@ -113,6 +113,8 @@ public: /* 0x10 */ int field_0x10; }; +extern dScnPly_msg_HIO_c g_msgDHIO; + class dScnPly_preLoad_HIO_c : public mDoHIO_entry_c { public: virtual ~dScnPly_preLoad_HIO_c() {} diff --git a/include/dolphin/os/OSRtc.h b/include/dolphin/os/OSRtc.h index 0438667c4..8bbb89695 100644 --- a/include/dolphin/os/OSRtc.h +++ b/include/dolphin/os/OSRtc.h @@ -65,6 +65,8 @@ void OSSetSoundMode(OSSoundMode mode); u32 OSGetProgressiveMode(void); void OSSetProgressiveMode(u32 mode); u32 OSGetEuRgb60Mode(); +void OSSetEuRgb60Mode(u32 mode); +s32 OSGetLanguage(); u16 OSGetWirelessID(s32 channel); void OSSetWirelessID(s32 channel, u16 id); static u16 OSGetGbsMode(void); diff --git a/include/f_op/f_op_overlap_mng.h b/include/f_op/f_op_overlap_mng.h index 4423ce105..0fd3682f5 100644 --- a/include/f_op/f_op_overlap_mng.h +++ b/include/f_op/f_op_overlap_mng.h @@ -27,7 +27,7 @@ int fopOvlpM_SceneIsStart(); void fopOvlpM_Management(); int fopOvlpM_IsOutReq(overlap_task_class* i_this); void fopOvlpM_Done(overlap_task_class* i_this); -void fopOvlpM_ToldAboutID(u32 pid); +void fopOvlpM_ToldAboutID(unsigned int pid); int fopOvlpM_IsPeek(); int fopOvlpM_IsDone(); int fopOvlpM_IsDoingReq(); diff --git a/include/global.h b/include/global.h index 331f7ed49..3e5b06a42 100644 --- a/include/global.h +++ b/include/global.h @@ -44,4 +44,12 @@ inline BOOL checkEqual(s32 a, s32 b) { #define VERSION_USA 1 #define VERSION_PAL 2 +#if VERSION == VERSION_USA + #define VERSION_SELECT(JPN, USA, PAL) (USA) +#elif VERSION == VERSION_PAL + #define VERSION_SELECT(JPN, USA, PAL) (PAL) +#elif VERSION == VERSION_JPN + #define VERSION_SELECT(JPN, USA, PAL) (JPN) +#endif + #endif diff --git a/include/m_Do/m_Do_MemCard.h b/include/m_Do/m_Do_MemCard.h index 0cd615e14..a8e16980e 100644 --- a/include/m_Do/m_Do_MemCard.h +++ b/include/m_Do/m_Do_MemCard.h @@ -20,8 +20,10 @@ public: void main(); void update(); void load(); + void load2(); void restore(); s32 LoadSync(void*, u32, u32); + s32 LoadSync2(); void save(void*, u32, u32); void store(); s32 SaveSync(); diff --git a/include/m_Do/m_Do_dvd_thread.h b/include/m_Do/m_Do_dvd_thread.h index f4d4013f9..917017e99 100644 --- a/include/m_Do/m_Do_dvd_thread.h +++ b/include/m_Do/m_Do_dvd_thread.h @@ -62,8 +62,7 @@ class mDoDvdThd_mountXArchive_c : public mDoDvdThd_command_c { public: virtual ~mDoDvdThd_mountXArchive_c(); mDoDvdThd_mountXArchive_c(u8 mountDirection, JKRArchive::EMountMode mountMode); - static mDoDvdThd_mountXArchive_c* create(char const*, u8, JKRArchive::EMountMode, - JKRHeap*); + static mDoDvdThd_mountXArchive_c* create(char const*, u8, JKRArchive::EMountMode); virtual s32 execute(); JKRArchive* getArchive() const { return mArchive; } diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index dd154fa6d..0b20ce83d 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -549,6 +549,11 @@ s32 mDoExt_getSafeGameHeapSize(); s32 mDoExt_getSafeZeldaHeapSize(); s32 mDoExt_getSafeCommandHeapSize(); +void mDoExt_setSafeArchiveHeapSize(); +void mDoExt_setSafeGameHeapSize(); +void mDoExt_setSafeZeldaHeapSize(); +void mDoExt_setSafeCommandHeapSize(); + s32 mDoExt_resIDToIndex(JKRArchive*, u16); JKRSolidHeap * mDoExt_createSolidHeapFromGameToCurrent(u32 size, u32 align); @@ -558,6 +563,9 @@ s32 mDoExt_adjustSolidHeap(JKRSolidHeap * pHeap); void mDoExt_destroySolidHeap(JKRSolidHeap * pHeap); JKRHeap* mDoExt_setCurrentHeap(JKRHeap*); +JUTFont* mDoExt_getMesgFont(); +JUTFont* mDoExt_getRubyFont(); + extern JKRExpHeap* zeldaHeap; extern JKRExpHeap* gameHeap; extern JKRExpHeap* commandHeap; diff --git a/include/m_Do/m_Do_machine.h b/include/m_Do/m_Do_machine.h index 1a2fd1632..d6b942953 100644 --- a/include/m_Do/m_Do_machine.h +++ b/include/m_Do/m_Do_machine.h @@ -1,7 +1,24 @@ + #ifndef M_DO_M_DO_MACHINE_H #define M_DO_M_DO_MACHINE_H +#include "dolphin/gx/GX.h" + bool mDoMch_Create(); void mDoMch_HeapCheckAll(); -#endif /* M_DO_M_DO_MACHINE_H */ \ No newline at end of file +extern GXRenderModeObj g_ntscZeldaProg; + +class mDoMch_render_c { +public: + static void setRenderModeObj(GXRenderModeObj* obj) { mRenderModeObj = obj; } + static void setProgressiveMode() { setRenderModeObj(&g_ntscZeldaProg); } + static u16 getEfbHeight() { return mRenderModeObj->efb_height; } + static u16 getFbWidth() { return mRenderModeObj->fb_width; } + + static GXRenderModeObj* getRenderModeObj() { return mRenderModeObj; } + + static GXRenderModeObj* mRenderModeObj; +}; + +#endif /* M_DO_M_DO_MACHINE_H */ diff --git a/src/JAZelAudio/JAIZelBasic.cpp b/src/JAZelAudio/JAIZelBasic.cpp index 62313a4ef..82f99e612 100644 --- a/src/JAZelAudio/JAIZelBasic.cpp +++ b/src/JAZelAudio/JAIZelBasic.cpp @@ -462,7 +462,7 @@ void JAIZelBasic::loadStaticWaves() { } /* 802AB888-802AB8B0 .text checkFirstWaves__11JAIZelBasicFv */ -void JAIZelBasic::checkFirstWaves() { +BOOL JAIZelBasic::checkFirstWaves() { /* Nonmatching */ } diff --git a/src/JSystem/J3DGraphBase/J3DDrawBuffer.cpp b/src/JSystem/J3DGraphBase/J3DDrawBuffer.cpp index b136d2282..dff95bd6e 100644 --- a/src/JSystem/J3DGraphBase/J3DDrawBuffer.cpp +++ b/src/JSystem/J3DGraphBase/J3DDrawBuffer.cpp @@ -199,7 +199,7 @@ int J3DDrawBuffer::entryImm(J3DPacket* i_packet, u16 index) { return 1; } -sortFunc J3DDrawBuffer::sortFuncTable[] = { +J3DDrawBuffer::sortFunc J3DDrawBuffer::sortFuncTable[] = { &J3DDrawBuffer::entryMatSort, &J3DDrawBuffer::entryMatAnmSort, &J3DDrawBuffer::entryZSort, @@ -208,7 +208,7 @@ sortFunc J3DDrawBuffer::sortFuncTable[] = { &J3DDrawBuffer::entryNonSort, }; -drawFunc J3DDrawBuffer::drawFuncTable[] = { +J3DDrawBuffer::drawFunc J3DDrawBuffer::drawFuncTable[] = { &J3DDrawBuffer::drawHead, &J3DDrawBuffer::drawTail, }; diff --git a/src/JSystem/JKernel/JKRAram.cpp b/src/JSystem/JKernel/JKRAram.cpp index 1aad48247..5df365366 100644 --- a/src/JSystem/JKernel/JKRAram.cpp +++ b/src/JSystem/JKernel/JKRAram.cpp @@ -289,11 +289,7 @@ u8* JKRAram::aramToMainRam(JKRAramBlock* block, u8 *buf, u32 p3, u32 p4, JKRExpa } checkOkAddress(buf, 0, block, p4); if (!block) { -#if VERSION == VERSION_JPN - OSPanic(__FILE__, 690, ":::Bad Aram Block specified.\n"); -#else - OSPanic(__FILE__, 683, ":::Bad Aram Block specified.\n"); -#endif + OSPanic(__FILE__, VERSION_SELECT(690, 683, 683), ":::Bad Aram Block specified.\n"); } if (p4 >= block->mSize) { return NULL; @@ -337,20 +333,12 @@ static int JKRDecompressFromAramToMainRam(u32 src, void* dst, u32 srcLength, u32 u32 szsBufferSize = JKRAram::getSzpBufferSize(); szpBuf = (u8 *)JKRAllocFromSysHeap(szsBufferSize, 32); -#if VERSION == VERSION_JPN - JUT_ASSERT(1091, szpBuf != 0); -#else - JUT_ASSERT(1077, szpBuf != 0); -#endif + JUT_ASSERT(VERSION_SELECT(1091, 1077, 1077), szpBuf != 0); szpEnd = szpBuf + szsBufferSize; if (offset != 0) { refBuf = (u8 *)JKRAllocFromSysHeap(0x1120, 0); -#if VERSION == VERSION_JPN - JUT_ASSERT(1100, refBuf != 0); -#else - JUT_ASSERT(1086, refBuf != 0); -#endif + JUT_ASSERT(VERSION_SELECT(1100, 1086, 1086), refBuf != 0); refEnd = refBuf + 0x1120; refCurrent = refBuf; } @@ -538,11 +526,7 @@ static u8* nextSrcData(u8* current) { if (transSize > transLeft) { transSize = transLeft; } -#if VERSION == VERSION_JPN - JUT_ASSERT(1376, transSize > 0) -#else - JUT_ASSERT(1361, transSize > 0) -#endif + JUT_ASSERT(VERSION_SELECT(1376, 1361, 1361), transSize > 0); JKRAramPcs(1, (u32)(srcAddress + srcOffset), ((u32)dest + left), ALIGN_NEXT(transSize, 0x20), NULL); diff --git a/src/JSystem/JKernel/JKRArchivePub.cpp b/src/JSystem/JKernel/JKRArchivePub.cpp index c2a051fc0..a22a21984 100644 --- a/src/JSystem/JKernel/JKRArchivePub.cpp +++ b/src/JSystem/JKernel/JKRArchivePub.cpp @@ -134,11 +134,7 @@ void* JKRArchive::getGlbResource(u32 param_0, const char* path, JKRArchive* arch /* 802B8380-802B8450 .text getResource__10JKRArchiveFPCc */ void* JKRArchive::getResource(const char* path) { -#if VERSION == VERSION_JPN - JUT_ASSERT(337, isMounted()); -#else - JUT_ASSERT(285, isMounted()); -#endif + JUT_ASSERT(VERSION_SELECT(337, 285, 285), isMounted()); SDIFileEntry* fileEntry; if (*path == '/') { @@ -156,11 +152,7 @@ void* JKRArchive::getResource(const char* path) { /* 802B8450-802B8528 .text getResource__10JKRArchiveFUlPCc */ void* JKRArchive::getResource(u32 type, const char* path) { -#if VERSION == VERSION_JPN - JUT_ASSERT(384, isMounted()); -#else - JUT_ASSERT(332, isMounted()); -#endif + JUT_ASSERT(VERSION_SELECT(384, 332, 332), isMounted()); SDIFileEntry* fileEntry; if (type == 0 || type == '????') { @@ -198,11 +190,7 @@ u32 JKRArchive::readTypeResource(void* buffer, u32 bufferSize, u32 type, const c /* 802B85F0-802B86DC .text readResource__10JKRArchiveFPvUlUlPCc */ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, u32 type, const char* path) { -#if VERSION == VERSION_JPN - JUT_ASSERT(543, isMounted()); -#else - JUT_ASSERT(491, isMounted()); -#endif + JUT_ASSERT(VERSION_SELECT(543, 491, 491), isMounted()); SDIFileEntry* fileEntry; if (type == 0 || type == '????') { @@ -222,11 +210,7 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, u32 type, const char* /* 802B86DC-802B87C0 .text readResource__10JKRArchiveFPvUlPCc */ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, const char* path) { -#if VERSION == VERSION_JPN - JUT_ASSERT(589, isMounted()); -#else - JUT_ASSERT(537, isMounted()); -#endif + JUT_ASSERT(VERSION_SELECT(589, 537, 537), isMounted()); SDIFileEntry* fileEntry; if (*path == '/') { @@ -246,11 +230,7 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, const char* path) { /* 802B87C0-802B8878 .text readIdxResource__10JKRArchiveFPvUlUl */ u32 JKRArchive::readIdxResource(void* buffer, u32 bufferSize, u32 index) { -#if VERSION == VERSION_JPN - JUT_ASSERT(645, isMounted()); -#else - JUT_ASSERT(593, isMounted()); -#endif + JUT_ASSERT(VERSION_SELECT(645, 593, 593), isMounted()); SDIFileEntry* fileEntry = findIdxResource(index); if (fileEntry) { @@ -264,11 +244,7 @@ u32 JKRArchive::readIdxResource(void* buffer, u32 bufferSize, u32 index) { /* 802B8878-802B8930 .text readResource__10JKRArchiveFPvUlUs */ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, u16 id) { -#if VERSION == VERSION_JPN - JUT_ASSERT(679, isMounted()); -#else - JUT_ASSERT(627, isMounted()); -#endif + JUT_ASSERT(VERSION_SELECT(679, 627, 627), isMounted()); SDIFileEntry* fileEntry = findIdResource(id); if (fileEntry) { @@ -295,11 +271,7 @@ void JKRArchive::removeResourceAll() { /* 802B89B8-802B8A54 .text removeResource__10JKRArchiveFPv */ bool JKRArchive::removeResource(void* resource) { -#if VERSION == VERSION_JPN - JUT_ASSERT(755, resource != 0); -#else - JUT_ASSERT(687, resource != 0); -#endif + JUT_ASSERT(VERSION_SELECT(755, 687, 687), resource != 0); SDIFileEntry* fileEntry = findPtrResource(resource); if (fileEntry == NULL) @@ -312,11 +284,7 @@ bool JKRArchive::removeResource(void* resource) { /* 802B8A54-802B8AE4 .text detachResource__10JKRArchiveFPv */ bool JKRArchive::detachResource(void* resource) { -#if VERSION == VERSION_JPN - JUT_ASSERT(787, resource != 0); -#else - JUT_ASSERT(719, resource != 0); -#endif + JUT_ASSERT(VERSION_SELECT(787, 719, 719), resource != 0); SDIFileEntry* fileEntry = findPtrResource(resource); if (fileEntry == NULL) @@ -328,11 +296,7 @@ bool JKRArchive::detachResource(void* resource) { /* 802B8AE4-802B8B6C .text getResSize__10JKRArchiveCFPCv */ u32 JKRArchive::getResSize(const void* resource) const { -#if VERSION == VERSION_JPN - JUT_ASSERT(814, resource != 0); -#else - JUT_ASSERT(746, resource != 0); -#endif + JUT_ASSERT(VERSION_SELECT(814, 746, 746), resource != 0); SDIFileEntry* fileEntry = findPtrResource(resource); if (fileEntry == NULL) diff --git a/src/JSystem/JKernel/JKRCompArchive.cpp b/src/JSystem/JKernel/JKRCompArchive.cpp index a7a06f47a..83fd9cfe0 100644 --- a/src/JSystem/JKernel/JKRCompArchive.cpp +++ b/src/JSystem/JKernel/JKRCompArchive.cpp @@ -377,17 +377,11 @@ u32 JKRCompArchive::getExpandedResSize(const void* resource) const { u32 addr = mAramPart->mAddress; addr = fileEntry->data_offset + addr; JKRAramToMainRam(addr, bufPtr, sizeof(buf) / 2, EXPAND_SWITCH_UNKNOWN0, 0, NULL, -1, NULL); - } - else if ((flags & 0x40) != 0) { + } else if ((flags & 0x40) != 0) { JKRDvdToMainRam(mEntryNum, bufPtr, EXPAND_SWITCH_UNKNOWN2, sizeof(buf) / 2, NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, field_0x6c + fileEntry->data_offset, NULL); DCInvalidateRange(bufPtr, sizeof(buf) / 2); - } - else { -#if VERSION == VERSION_JPN - OSPanic(__FILE__, 948, "illegal resource."); -#else - OSPanic(__FILE__, 944, "illegal resource."); -#endif + } else { + OSPanic(__FILE__, VERSION_SELECT(948, 944, 944), "illegal resource."); } u32 expandSize = JKRDecompExpandSize(bufPtr); const_cast(this)->setExpandSize(fileEntry, expandSize); diff --git a/src/JSystem/JKernel/JKRDvdRipper.cpp b/src/JSystem/JKernel/JKRDvdRipper.cpp index 289feb668..da435697e 100644 --- a/src/JSystem/JKernel/JKRDvdRipper.cpp +++ b/src/JSystem/JKernel/JKRDvdRipper.cpp @@ -148,11 +148,7 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch else if (compression2 == COMPRESSION_YAZ0) { JKRDecompressFromDVD(dvdFile, dst, fileSizeAligned, dstLength, 0, offset); } else { -#if VERSION == VERSION_JPN - OSPanic(__FILE__, 337, "Sorry, not prepared for SZP resource\n"); -#else - OSPanic(__FILE__, 314, "Sorry, not prepared for SZP resource\n"); -#endif + OSPanic(__FILE__, VERSION_SELECT(337, 314, 314), "Sorry, not prepared for SZP resource\n"); } return dst; } @@ -161,11 +157,7 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch // SZP decompression // s32 readoffset = startOffset; if (offset != 0) { -#if VERSION == VERSION_JPN - OSPanic(__FILE__, 347, ":::Not support SZP with offset read"); -#else - OSPanic(__FILE__, 324, ":::Not support SZP with offset read"); -#endif + OSPanic(__FILE__, VERSION_SELECT(347, 324, 324), ":::Not support SZP with offset read"); } while (true) { int readBytes = DVDReadPrio(dvdFile->getFileInfo(), mem, fileSizeAligned, 0, 2); @@ -229,20 +221,12 @@ static int JKRDecompressFromDVD(JKRDvdFile* dvdFile, void* dst, u32 fileSize, u3 OSLockMutex(&decompMutex); int bufSize = JKRDvdRipper::getSzpBufferSize(); szpBuf = (u8 *)JKRAllocFromSysHeap(bufSize, -0x20); -#if VERSION == VERSION_JPN - JUT_ASSERT(913, szpBuf != 0); -#else - JUT_ASSERT(884, szpBuf != 0); -#endif + JUT_ASSERT(VERSION_SELECT(913, 884, 884), szpBuf != 0); szpEnd = szpBuf + bufSize; if (inFileOffset != 0) { refBuf = (u8 *)JKRAllocFromSysHeap(0x1120, -4); -#if VERSION == VERSION_JPN - JUT_ASSERT(922, refBuf != 0); -#else - JUT_ASSERT(893, refBuf != 0); -#endif + JUT_ASSERT(VERSION_SELECT(922, 893, 893), refBuf != 0); refEnd = refBuf + 0x1120; refCurrent = refBuf; } else { @@ -423,11 +407,7 @@ static u8* nextSrcData(u8* src) { if (transSize > transLeft) { transSize = transLeft; } -#if VERSION == VERSION_JPN - JUT_ASSERT(1228, transSize > 0); -#else - JUT_ASSERT(1176, transSize > 0); -#endif + JUT_ASSERT(VERSION_SELECT(1228, 1176, 1176), transSize > 0); while (true) { s32 result = DVDReadPrio(srcFile->getFileInfo(), (buf + limit), transSize, srcOffset, 2); diff --git a/src/JSystem/JKernel/JKRHeap.cpp b/src/JSystem/JKernel/JKRHeap.cpp index a071b05fa..f32de3634 100644 --- a/src/JSystem/JKernel/JKRHeap.cpp +++ b/src/JSystem/JKernel/JKRHeap.cpp @@ -420,22 +420,13 @@ static void dummy3() { /* 802B0D70-802B0E14 .text state_register__7JKRHeapCFPQ27JKRHeap6TStateUl */ void JKRHeap::state_register(JKRHeap::TState* p, u32 id) const { -#if VERSION == VERSION_JPN - JUT_ASSERT(1034, p != 0); - JUT_ASSERT(1035, p->getHeap() == this); -#else - JUT_ASSERT(1090, p != 0); - JUT_ASSERT(1091, p->getHeap() == this); -#endif + JUT_ASSERT(VERSION_SELECT(1034, 1090, 1090), p != 0); + JUT_ASSERT(VERSION_SELECT(1035, 1091, 1091), p->getHeap() == this); } /* 802B0E14-802B0E9C .text state_compare__7JKRHeapCFRCQ27JKRHeap6TStateRCQ27JKRHeap6TState */ bool JKRHeap::state_compare(const JKRHeap::TState& r1, const JKRHeap::TState& r2) const { -#if VERSION == VERSION_JPN - JUT_ASSERT(1043, r1.getHeap() == r2.getHeap()); -#else - JUT_ASSERT(1099, r1.getHeap() == r2.getHeap()); -#endif + JUT_ASSERT(VERSION_SELECT(1043, 1099, 1099), r1.getHeap() == r2.getHeap()); return r1.getCheckCode() == r2.getCheckCode(); } @@ -448,15 +439,9 @@ static void dummy4() { /* 802B0E9C-802B0F24 .text state_dump__7JKRHeapCFRCQ27JKRHeap6TState */ void JKRHeap::state_dump(const JKRHeap::TState& p) const { -#if VERSION == VERSION_JPN - JUT_LOG(1067, "check-code : 0x%08x", p.getCheckCode()); - JUT_LOG(1068, "id : 0x%08x", p.getId()); - JUT_LOG(1069, "used size : %u", p.getUsedSize()); -#else - JUT_LOG(1123, "check-code : 0x%08x", p.getCheckCode()); - JUT_LOG(1124, "id : 0x%08x", p.getId()); - JUT_LOG(1125, "used size : %u", p.getUsedSize()); -#endif + JUT_LOG(VERSION_SELECT(1067, 1123, 1123), "check-code : 0x%08x", p.getCheckCode()); + JUT_LOG(VERSION_SELECT(1068, 1124, 1124), "id : 0x%08x", p.getId()); + JUT_LOG(VERSION_SELECT(1069, 1125, 1125), "used size : %u", p.getUsedSize()); } /* 802B0F24-802B0F2C .text do_changeGroupID__7JKRHeapFUc */ diff --git a/src/JSystem/JKernel/JKRSolidHeap.cpp b/src/JSystem/JKernel/JKRSolidHeap.cpp index 428043dbe..4cd450b2f 100644 --- a/src/JSystem/JKernel/JKRSolidHeap.cpp +++ b/src/JSystem/JKernel/JKRSolidHeap.cpp @@ -235,13 +235,8 @@ bool JKRSolidHeap::dump() { /* 802B3A68-802B3B4C .text state_register__12JKRSolidHeapCFPQ27JKRHeap6TStateUl */ void JKRSolidHeap::state_register(JKRHeap::TState* p, u32 id) const { -#if VERSION == VERSION_JPN - JUT_ASSERT(610, p != 0); - JUT_ASSERT(611, p->getHeap() == this); -#else - JUT_ASSERT(607, p != 0); - JUT_ASSERT(608, p->getHeap() == this); -#endif + JUT_ASSERT(VERSION_SELECT(610, 607, 607), p != 0); + JUT_ASSERT(VERSION_SELECT(611, 608, 608), p->getHeap() == this); getState_(p); setState_u32ID_(p, id); @@ -253,11 +248,7 @@ void JKRSolidHeap::state_register(JKRHeap::TState* p, u32 id) const { /* 802B3B4C-802B3BF4 .text state_compare__12JKRSolidHeapCFRCQ27JKRHeap6TStateRCQ27JKRHeap6TState */ bool JKRSolidHeap::state_compare(const JKRHeap::TState& r1, const JKRHeap::TState& r2) const { -#if VERSION == VERSION_JPN - JUT_ASSERT(638, r1.getHeap() == r2.getHeap()); -#else - JUT_ASSERT(635, r1.getHeap() == r2.getHeap()); -#endif + JUT_ASSERT(VERSION_SELECT(638, 635, 635), r1.getHeap() == r2.getHeap()); bool result = true; if (r1.getCheckCode() != r2.getCheckCode()) { diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 0f2cad961..e7e085a06 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -97,7 +97,7 @@ enum AM_RES_FILE_ID { // IDs and indexes are synced AM_BAS_OPEN_LOOP=0xF, AM_BAS_SLEEP=0x10, AM_BAS_SLEEP_LOOP=0x11, - + /* BCK */ AM_BCK_BOM_NOMI=0x14, AM_BCK_CLOSE=0x15, @@ -111,7 +111,7 @@ enum AM_RES_FILE_ID { // IDs and indexes are synced AM_BCK_OPEN_LOOP=0x1D, AM_BCK_SLEEP=0x1E, AM_BCK_SLEEP_LOOP=0x1F, - + /* BDL */ AM_BDL_AM=0x22, }; @@ -127,7 +127,7 @@ static BOOL nodeCallBack(J3DNode* node, int param_1) { if (jntNo >= 1 && jntNo <= 4) { cMtx_copy(model->getAnmMtx(jntNo), *calc_mtx); } - + cXyz offset; switch (jntNo) { case 1: // kosi (waist) @@ -154,7 +154,7 @@ static BOOL nodeCallBack(J3DNode* node, int param_1) { cMtx_YrotM(*calc_mtx, i_this->mEyeRot.y); cMtx_XrotM(*calc_mtx, i_this->mEyeRot.x); } - + if (jntNo >= 1 && jntNo <= 4) { model->setAnmMtx(jntNo, *calc_mtx); cMtx_copy(*calc_mtx, J3DSys::mCurrentMtx); @@ -173,25 +173,25 @@ static void draw_SUB(am_class* i_this) { cMtx_XrotM(mDoMtx_stack_c::get(), i_this->shape_angle.x); cMtx_ZrotM(mDoMtx_stack_c::get(), i_this->shape_angle.z); model->setBaseTRMtx(mDoMtx_stack_c::get()); - + i_this->mpMorf->calc(); - + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->mTevStr); } /* 000002E4-00000378 .text daAM_Draw__FP8am_class */ static BOOL daAM_Draw(am_class* i_this) { g_env_light.setLightTevColorType(i_this->mpMorf->getModel(), &i_this->mTevStr); - + dSnap_RegistFig(0xB7, i_this, 1.0f, 1.0f, 1.0f); - + i_this->mpMorf->entryDL(); - + dComIfGd_setSimpleShadow2( &i_this->current.pos, i_this->mAcch.GetGroundH(), 90.0f, i_this->mAcch.m_gnd, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex() ); - + return TRUE; } @@ -211,20 +211,20 @@ static void anm_init(am_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f3 /* 000004A4-00000784 .text body_atari_check__FP8am_class */ static void body_atari_check(am_class* i_this) { daPy_py_c* player = daPy_getPlayerActorClass(); - + #if VERSION == VERSION_JPN if (i_this->mStartsInactive == 1 && i_this->mSwitch != 0xFF && !dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { return; } #endif - + i_this->mStts.Move(); - + if (i_this->mBodyCyl.ChkTgHit() || i_this->mNeedleCyl.ChkTgHit()) { if (i_this->mbIsBodyBeingHit) { return; } - + cCcD_Obj* hitObj; if (i_this->mBodyCyl.ChkTgHit()) { hitObj = i_this->mBodyCyl.GetTgHitObj(); @@ -235,7 +235,7 @@ static void body_atari_check(am_class* i_this) { return; } i_this->mbIsBodyBeingHit = true; - + switch (hitObj->GetAtType()) { case AT_TYPE_SWORD: case AT_TYPE_MACHETE: @@ -285,11 +285,11 @@ static BOOL medama_atari_check(am_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); cCcD_Obj* hitObj = i_this->mEyeSph.GetTgHitObj(); bool ret = false; - + if (i_this->mStartsInactive == 1 && i_this->mSwitch != 0xFF && !dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { return ret; } - + i_this->mStts.Move(); if (!i_this->mEyeSph.ChkTgHit()) { return ret; @@ -297,11 +297,11 @@ static BOOL medama_atari_check(am_class* i_this) { if (!hitObj) { return ret; } - + CcAtInfo atInfo; atInfo.pParticlePos = NULL; cXyz hitPos = *i_this->mEyeSph.GetTgHitPosP(); - + switch (hitObj->GetAtType()) { case AT_TYPE_GRAPPLING_HOOK: if (i_this->mCurrBckIdx != AM_BCK_SLEEP && i_this->mCurrBckIdx != AM_BCK_SLEEP_LOOP) { @@ -368,7 +368,7 @@ static BOOL medama_atari_check(am_class* i_this) { fopAcM_seStart(i_this, JA_SE_LK_MS_WEP_HIT, 0x42); break; } - + // return ret; // Doesn't match, too few instructions // return ret ? TRUE : FALSE; // Doesn't match, optimized into arithmetic instead of a branch return ret ? (ret ? TRUE : TRUE) : FALSE; // Matches, tricking the compiler into using a branch @@ -383,21 +383,21 @@ static void bomb_move_set(am_class* i_this, u8 alwaysMoveY) { if (!swallowedActor) { return; } - + cMtx_YrotS(*calc_mtx, i_this->shape_angle.y); - + cXyz mouthOffset(0.0f, 120.0f, 40.0f); cXyz mouthPos; MtxPosition(&mouthOffset, &mouthPos); mouthPos += i_this->current.pos; - + // Pull the bomb into the Armos Knight's mouth by 50 units per frame on each axis. cLib_addCalc2(&swallowedActor->current.pos.x, mouthPos.x, 1.0f, 50.0f); if (alwaysMoveY || mouthPos.y - 10.0f < swallowedActor->current.pos.y) { cLib_addCalc2(&swallowedActor->current.pos.y, mouthPos.y, 1.0f, 50.0f); } cLib_addCalc2(&swallowedActor->current.pos.z, mouthPos.z, 1.0f, 50.0f); - + swallowedActor->mGravity = 0.0f; swallowedActor->speedF = 0.0f; swallowedActor->speed.setAll(0.0f); @@ -405,7 +405,7 @@ static void bomb_move_set(am_class* i_this, u8 alwaysMoveY) { swallowedActor->shape_angle.setall(0); swallowedActor->current.angle.y = i_this->shape_angle.y; swallowedActor->shape_angle.y = i_this->shape_angle.y; - + if (fpcM_GetName(swallowedActor) == PROC_BOMB) { daBomb_c* bomb = (daBomb_c*)swallowedActor; if (i_this->mCountDownTimers[1] == 1) { @@ -431,19 +431,19 @@ static void bomb_move_set(am_class* i_this, u8 alwaysMoveY) { static BOOL bomb_nomi_check(am_class* i_this) { fopAc_ac_c* actor = i_this; i_this->mStts.Move(); - + if (i_this->mCurrBckIdx != AM_BCK_OPEN && i_this->mCurrBckIdx != AM_BCK_OPEN_LOOP && i_this->mCurrBckIdx != AM_BCK_DAMAGE && i_this->mCurrBckIdx != AM_BCK_DAMAGE_LOOP) { return FALSE; } - + s16 angleToPlayer = fopAcM_searchPlayerAngleY(actor); s16 angleDiff = cLib_distanceAngleS(actor->shape_angle.y, angleToPlayer); if (angleDiff > 0x2000) { return FALSE; } - + if (i_this->mMouthSph.ChkCoHit()) { cCcD_Obj* hitObj = i_this->mMouthSph.GetCoHitObj(); if (hitObj) { @@ -489,7 +489,7 @@ static BOOL bomb_nomi_check(am_class* i_this) { } } } - + return FALSE; } @@ -498,7 +498,7 @@ static void BG_check(am_class* i_this) { f32 halfHeight = g_regHIO.mChild[12].mFloatRegs[3] + 30.0f; f32 radius = g_regHIO.mChild[12].mFloatRegs[4] + 150.0f; i_this->mAcchCir.SetWall(halfHeight, radius); - + i_this->current.pos.y -= i_this->m02EC; i_this->next.pos.y -= i_this->m02EC; i_this->mAcch.CrrPos(*dComIfG_Bgsp()); @@ -527,25 +527,25 @@ static void medama_move(am_class* i_this) { i_this->mEyeRot.setall(0); return; } - + f32 diffX = i_this->current.pos.x - player->current.pos.x; f32 diffY = i_this->mEyePos.y - player->current.pos.y; f32 diffZ = i_this->current.pos.z - player->current.pos.z; - + i_this->mDesiredEyeRot.y = cM_atan2s(diffX, diffZ); if (i_this->mDesiredEyeRot.y < -0x71C) { i_this->mDesiredEyeRot.y = -0x71C; } else if (i_this->mDesiredEyeRot.y > 0x71C) { i_this->mDesiredEyeRot.y = 0x71C; } - + i_this->mDesiredEyeRot.x = cM_atan2s(diffY, sqrtf(diffX*diffX + diffZ*diffZ)); if (i_this->mDesiredEyeRot.x < -0x38E) { i_this->mDesiredEyeRot.x = -0x38E; } else if (i_this->mDesiredEyeRot.x > 0x38E) { i_this->mDesiredEyeRot.x = 0x38E; } - + cLib_addCalcAngleS2(&i_this->mEyeRot.x, i_this->mDesiredEyeRot.x, 1, 0x500); cLib_addCalcAngleS2(&i_this->mEyeRot.y, i_this->mDesiredEyeRot.y, 1, 0x500); } @@ -739,9 +739,9 @@ static void action_dousa(am_class* i_this) { } break; } - + medama_move(i_this); - + if (i_this->mState != 2 && medama_atari_check(i_this)) { i_this->mSmokeCbs[2].end(); } else if (bomb_nomi_check(i_this)) { @@ -760,7 +760,7 @@ static void action_modoru_move(am_class* i_this) { i_this->speed.y = 40.0f; i_this->speedF = 15.0f; fopAcM_monsSeStart(i_this, JA_SE_CV_AM_JUMP, 0x42); - + f32 xDistToSpawn = i_this->mSpawnPos.x - i_this->current.pos.x; f32 zDistToSpawn = i_this->mSpawnPos.z - i_this->current.pos.z; i_this->mDesiredRotY = cM_atan2s(xDistToSpawn, zDistToSpawn); @@ -775,18 +775,18 @@ static void action_modoru_move(am_class* i_this) { 0xA125, &i_this->mWaistPos, &i_this->shape_angle, NULL, 0xB9, &i_this->mSmokeCbs[0], fopAcM_GetRoomNo(i_this) ); - + dComIfGp_getVibration().StartShock(1, -0x21, cXyz(0.0f, 1.0f, 0.0f)); // The fopAcM_seStart inline makes the codegen not match. // fopAcM_seStart(i_this, JA_SE_CM_AM_JUMP, 0); mDoAud_seStart(JA_SE_CM_AM_JUMP, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); fopAcM_monsSeStart(i_this, JA_SE_CV_AM_JUMP, 0x42); - + i_this->speed.y = 40.0f; i_this->speedF = 15.0f; i_this->mDesiredRotY = cM_atan2s(xDistToSpawn, zDistToSpawn); } - + f32 xzDist = sqrtf(xDistToSpawn*xDistToSpawn + zDistToSpawn*zDistToSpawn); if (xzDist < 20.0f) { i_this->mDesiredRotY = i_this->mSpawnRotY; @@ -933,7 +933,7 @@ static void action_itai_move(am_class* i_this) { i_this->m033C = dComIfGp_particle_set(0x8157, &i_this->mJawPos); i_this->m0340 = dComIfGp_particle_set(0x8156, &i_this->mJawPos); } - + // Using the mDoExt_McaMorf::isStop inline causes regswap. // if (!i_this->mpMorf->isStop()) { morf = i_this->mpMorf; @@ -967,19 +967,19 @@ static void action_itai_move(am_class* i_this) { i_this->mGravity = -10.0f; i_this->speedF = 10.0f; } - + if (i_this->mCountDownTimers[0] != 0) { break; } anm_init(i_this, AM_BCK_DEAD, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); dComIfGp_particle_set(0x8127, &i_this->mWaistPos); dComIfGp_particle_set(0x8128, &i_this->mWaistPos); - + // The fopAcM_seStart inline makes the codegen not match. // fopAcM_seStart(i_this, JA_SE_CM_AM_BEF_EXPLODE, 0); mDoAud_seStart(JA_SE_CM_AM_BEF_EXPLODE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); i_this->mDesiredRotY = i_this->current.angle.y; - + if (i_this->m033C) { i_this->m033C->becomeInvalidEmitter(); i_this->m033C = NULL; @@ -1016,26 +1016,26 @@ static void action_itai_move(am_class* i_this) { } } } - + // Using the fopAcM_seStart inline multiple times in a single case makes the codegen not match. // fopAcM_seStart(i_this, JA_SE_CM_AM_EXPLODE, 0); // fopAcM_seStart(i_this, JA_SE_LK_LAST_HIT, 0); mDoAud_seStart(JA_SE_CM_AM_EXPLODE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); mDoAud_seStart(JA_SE_LK_LAST_HIT, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); - + fopAcM_createDisappear(i_this, ¢erPos, 5, 0, 0xFF); fopAcM_onActor(i_this); fopAcM_delete(i_this); break; } - + if (i_this->m033C) { i_this->m033C->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); } if (i_this->m0340) { i_this->m0340->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); } - + if (i_this->mState == 0x29 || i_this->mState == 0x2A) { bomb_nomi_check(i_this); } @@ -1044,19 +1044,19 @@ static void action_itai_move(am_class* i_this) { /* 000034F4-000039A4 .text daAM_Execute__FP8am_class */ static BOOL daAM_Execute(am_class* i_this) { fopAcM_setGbaName(i_this, BOW, 0xC, 0x2A); - + if (enemy_ice(&i_this->mEnemyIce)) { i_this->mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); i_this->mpMorf->calc(); return TRUE; } - + for (int i = 0; i < ARRAY_SIZE(i_this->mCountDownTimers); i++) { if (i_this->mCountDownTimers[i] != 0) { i_this->mCountDownTimers[i]--; } } - + switch (i_this->mAction) { case ACTION_DOUSA: action_dousa(i_this); @@ -1071,17 +1071,17 @@ static BOOL daAM_Execute(am_class* i_this) { action_itai_move(i_this); break; } - + if (i_this->mAction != ACTION_ITAI_MOVE && i_this->mSpawnPosY - 1500.0f > i_this->current.pos.y) { anm_init(i_this, AM_BCK_DEAD, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); - + dComIfGp_particle_set(0x8127, &i_this->mWaistPos); dComIfGp_particle_set(0x8128, &i_this->mWaistPos); - + fopAcM_seStart(i_this, JA_SE_CM_AM_BEF_EXPLODE, 0); - + i_this->mDesiredRotY = i_this->current.angle.y; - + if (i_this->m033C) { i_this->m033C->becomeInvalidEmitter(); i_this->m033C = NULL; @@ -1090,21 +1090,21 @@ static BOOL daAM_Execute(am_class* i_this) { i_this->m0340->becomeInvalidEmitter(); i_this->m0340 = NULL; } - + i_this->speedF = 0.0f; i_this->mAction = ACTION_ITAI_MOVE; i_this->mState = 0x2F; } - + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mDesiredRotY, 1, 0x500); if (i_this->mState != 0x2E && i_this->mState != 0x2F && i_this->mState != 0x1F) { cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 1, 0x500); } - + if (i_this->mCountDownTimers[1] == 0) { i_this->mpMorf->play(NULL, 0, 0); } - + cMtx_YrotS(*calc_mtx, i_this->current.angle.y); cMtx_XrotM(*calc_mtx, i_this->current.angle.x); cXyz offset; @@ -1119,39 +1119,39 @@ static BOOL daAM_Execute(am_class* i_this) { if (i_this->speed.y < -100.0f) { i_this->speed.y = -100.0f; } - + body_atari_check(i_this); - + i_this->mAttentionInfo.mPosition = i_this->current.pos; i_this->mAttentionInfo.mPosition.y += 330.0f; i_this->mEyePos = i_this->current.pos; i_this->mEyePos.y += 250.0f; - + cXyz needlePos = i_this->current.pos; - + i_this->mEyeSph.SetC(i_this->mEyeballPos); i_this->mEyeSph.SetR(60.0f); dComIfG_Ccsp()->Set(&i_this->mEyeSph); - + i_this->mMouthSph.SetC(i_this->mMouthPos); i_this->mMouthSph.SetR(100.0f); dComIfG_Ccsp()->Set(&i_this->mMouthSph); - + i_this->mBodyCyl.SetC(i_this->current.pos); i_this->mBodyCyl.SetH(300.0f); i_this->mBodyCyl.SetR(80.0f); dComIfG_Ccsp()->Set(&i_this->mBodyCyl); - + needlePos.y += 40.0f; i_this->mNeedleCyl.SetC(needlePos); i_this->mNeedleCyl.SetH(30.0f); i_this->mNeedleCyl.SetR(130.0f); dComIfG_Ccsp()->Set(&i_this->mNeedleCyl); - + fopAcM_posMove(i_this, i_this->mStts.GetCCMoveP()); BG_check(i_this); draw_SUB(i_this); - + return TRUE; } @@ -1163,12 +1163,12 @@ static BOOL daAM_IsDelete(am_class* i_this) { /* 000039AC-00003A84 .text daAM_Delete__FP8am_class */ static BOOL daAM_Delete(am_class* i_this) { dComIfG_resDelete(&i_this->mPhs, "AM"); - + for (int i = 0; i < 4; i++) { i_this->mSmokeCbs[i].end(); } i_this->mSmokeCbs[2].end(); - + if (i_this->m033C) { i_this->m033C->becomeInvalidEmitter(); i_this->m033C = NULL; @@ -1177,14 +1177,14 @@ static BOOL daAM_Delete(am_class* i_this) { i_this->m0340->becomeInvalidEmitter(); i_this->m0340 = NULL; } - + return TRUE; } /* 00003A84-00003C00 .text useHeapInit__FP10fopAc_ac_c */ static BOOL useHeapInit(fopAc_ac_c* i_actor) { am_class* i_this = (am_class*)i_actor; - + i_this->mpMorf = new mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes("AM", AM_BDL_AM), NULL, NULL, @@ -1197,12 +1197,12 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) { if (!i_this->mpMorf || !i_this->mpMorf->getModel()) { return FALSE; } - + i_this->mpMorf->getModel()->setUserArea((u32)i_this); for (u16 i = 0; i < i_this->mpMorf->getModel()->getModelData()->getJointNum(); i++) { i_this->mpMorf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - + static Vec cyl2_eye_offset[] = { {0.0f, 0.0f, 70.0f}, {0.0f, 0.0f, 80.0f}, @@ -1221,33 +1221,33 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) { } else { return FALSE; } - + return TRUE; } /* 00003C00-00003F5C .text daAM_Create__FP10fopAc_ac_c */ static s32 daAM_Create(fopAc_ac_c* i_actor) { fopAcM_SetupActor(i_actor, am_class); - + am_class* i_this = (am_class*)i_actor; - + s32 phase_state = dComIfG_resLoad(&i_this->mPhs, "AM"); if (phase_state == cPhs_COMPLEATE_e) { if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x1C80)) { return cPhs_ERROR_e; } - + i_this->mItemStealLeft = 3; - + i_this->mSmokeCbs[0].setRateOff(0); i_this->mSmokeCbs[1].setRateOff(0); i_this->mSmokeCbs[3].setRateOff(0); - + i_this->mType = (fopAcM_GetParam(i_this) >> 0x00) & 0xFF; i_this->mPrmAreaRadius = (fopAcM_GetParam(i_this) >> 0x08) & 0xFF; i_this->mStartsInactive = (fopAcM_GetParam(i_this) >> 0x10) & 0xFF; i_this->mSwitch = (fopAcM_GetParam(i_this) >> 0x18) & 0xFF; - + if (i_this->mType == 0xFF) { i_this->mType = 0; } @@ -1264,7 +1264,7 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { } i_this->mSpawnPosY = i_this->current.pos.y; i_this->mSwallowedActorProcID = -1; - + if (i_this->mStartsInactive == 0 && i_this->mSwitch != 0xFF && dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { // When mStartsInactive is 0, the Armos Knight starts active and attacking the player. // mSwitch being set disables it from spawning again in the future. @@ -1275,29 +1275,29 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { // mSwitch being set causes it to become active and attack the player. fopAcM_OffStatus(i_this, fopAcStts_SHOWMAP_e); } - + i_this->mItemTableIdx = dComIfGp_CharTbl()->GetNameIndex("amos", 0); i_this->mMaxHealth = 10; i_this->mHealth = 10; - + i_this->mCullMtx = i_this->mpMorf->mpModel->getBaseTRMtx(); fopAcM_setCullSizeBox(i_this, -100.0f, -10.0f, -80.0f, 120.0f, 400.0f, 100.0f); - + i_this->mAttentionInfo.mFlags = 0; - + i_this->mAcch.Set( &fopAcM_GetPosition_p(i_this), &fopAcM_GetOldPosition_p(i_this), i_this, 1, &i_this->mAcchCir, &fopAcM_GetSpeed_p(i_this), NULL, NULL ); i_this->mStts.Init(0xFE, 1, i_this); - + i_this->mGravity = -10.0f; - + i_this->mEnemyIce.mpActor = i_this; i_this->mEnemyIce.mWallRadius = 80.0f; i_this->mEnemyIce.mCylHeight = 300.0f; - + static dCcD_SrcSph eye_co_sph_src = { // dCcD_SrcGObjInf { @@ -1328,7 +1328,7 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { }; i_this->mEyeSph.Set(eye_co_sph_src); i_this->mEyeSph.SetStts(&i_this->mStts); - + static dCcD_SrcSph mouth_co_sph_src = { // dCcD_SrcGObjInf { @@ -1359,7 +1359,7 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { }; i_this->mMouthSph.Set(mouth_co_sph_src); i_this->mMouthSph.SetStts(&i_this->mStts); - + static dCcD_SrcCyl body_co_cyl_src = { // dCcD_SrcGObjInf { @@ -1391,7 +1391,7 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { }; i_this->mBodyCyl.Set(body_co_cyl_src); i_this->mBodyCyl.SetStts(&i_this->mStts); - + static dCcD_SrcCyl sword_co_cyl_src = { // dCcD_SrcGObjInf { @@ -1423,17 +1423,17 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { }; i_this->mNeedleCyl.Set(sword_co_cyl_src); i_this->mNeedleCyl.SetStts(&i_this->mStts); - + i_this->mNeedleCyl.OffAtSetBit(); i_this->mNeedleCyl.OffAtSetBit(); - + i_this->mDesiredRotY = i_this->current.angle.y; i_this->mSpawnPos = i_this->current.pos; i_this->mSpawnRotY = i_this->current.angle.y; - + draw_SUB(i_this); } - + return phase_state; } diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index 75347a24a..7dea0d441 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -3,116 +3,841 @@ // Translation Unit: d_s_logo.cpp // -#include "d_s_logo.h" -#include "dolphin/types.h" +#include "f_op/f_op_scene.h" +#include "f_op/f_op_scene_mng.h" +#include "c/c_dylink.h" +#include "d/d_com_inf_game.h" +#include "d/d_com_lib_game.h" +#include "d/d_procname.h" +#include "d/d_s_play.h" +#include "m_Do/m_Do_audio.h" +#include "m_Do/m_Do_controller_pad.h" +#include "m_Do/m_Do_ext.h" +#include "m_Do/m_Do_graphic.h" +#include "m_Do/m_Do_machine.h" +#include "m_Do/m_Do_MemCard.h" +#include "m_Do/m_Do_Reset.h" +#include "m_Do/m_Do_dvd_thread.h" +#include "JSystem/JKernel/JKRExpHeap.h" +#include "JSystem/JKernel/JKRAram.h" +#include "JSystem/JKernel/JKRAramHeap.h" +#include "dolphin/vi/vi.h" +#include "dolphin/os/OS.h" +#include "MSL_C/string.h" + +class dScnLogo_c : public scene_class { +public: + /* 0x1C4 */ request_of_phase_process_class mPhs; + /* 0x1CC */ dDlst_2D_c * nintendoImg; + /* 0x1D0 */ dDlst_2D_c * dolbyImg; + /* 0x1D4 */ dDlst_2D_c * progchoiceImg; + /* 0x1D8 */ dDlst_2D_c * progyesImg; + /* 0x1DC */ dDlst_2D_c * prognoImg; + /* 0x1E0 */ dDlst_2D_c * progImg; + /* 0x1E4 */ dDlst_2D_c * interImg; + /* 0x1E8 */ u8 mAction; + /* 0x1E9 */ u8 mInterFlag; + /* 0x1EA */ u8 field_0x1ea; + /* 0x1EB */ u8 field_0x1eb; + /* 0x1EC */ u16 mTimer; + /* 0x1EE */ u16 field_0x1ee; + /* 0x1F0 */ u16 field_0x1f0; + /* 0x1F2 */ u16 field_0x1f2; + /* 0x1F4 */ u32 field_0x1f4; + /* 0x1F8 */ void * field_0x1f8; + /* 0x1FC */ u32 field_0x1fc; +}; + +mDoDvdThd_mountXArchive_c * l_anmCommand; +mDoDvdThd_mountXArchive_c * l_fmapCommand; +mDoDvdThd_mountXArchive_c * l_itemResCommand; +mDoDvdThd_mountXArchive_c * l_fmapResCommand; +mDoDvdThd_mountXArchive_c * l_dmapResCommand; +mDoDvdThd_mountXArchive_c * l_clctResCommand; +mDoDvdThd_mountXArchive_c * l_optResCommand; +mDoDvdThd_mountXArchive_c * l_saveResCommand; +mDoDvdThd_mountXArchive_c * l_clothResCommand; +mDoDvdThd_mountXArchive_c * l_itemiconCommand; +mDoDvdThd_mountXArchive_c * l_actioniconCommand; +mDoDvdThd_mountXArchive_c * l_scopeResCommand; +mDoDvdThd_mountXArchive_c * l_camResCommand; +mDoDvdThd_mountXArchive_c * l_swimResCommand; +mDoDvdThd_mountXArchive_c * l_windResCommand; +mDoDvdThd_mountXArchive_c * l_nameResCommand; +mDoDvdThd_mountXArchive_c * l_tmsgCommand; +mDoDvdThd_mountXArchive_c * l_dmsgCommand; +mDoDvdThd_mountXArchive_c * l_errorResCommand; +mDoDvdThd_mountXArchive_c * l_msgDtCommand; +#if VERSION != VERSION_JPN +mDoDvdThd_mountXArchive_c * l_msgDtCommand2; +#endif +mDoDvdThd_mountXArchive_c * l_msgCommand; +mDoDvdThd_mountXArchive_c * l_menuCommand; +mDoDvdThd_mountXArchive_c * l_fontCommand; +mDoDvdThd_mountXArchive_c * l_rubyCommand; +mDoDvdThd_toMainRam_c * l_particleCommand; +mDoDvdThd_toMainRam_c * l_itemTableCommand; +mDoDvdThd_toMainRam_c * l_ActorDataCommand; +mDoDvdThd_toMainRam_c * l_FmapDataCommand; +mDoDvdThd_mountXArchive_c * l_lodCommand; + +enum { + ACT_nintendoInDraw = 0, + ACT_nintendoOutDraw = 1, + ACT_nintendoOut2Draw = 2, + ACT_dolbyInDraw = 3, + ACT_dolbyOutDraw = 4, + ACT_progInDraw = 5, + ACT_progSelDraw = 6, + ACT_progOutDraw = 7, + ACT_progSetDraw = 8, + ACT_progChangeDraw = 9, + ACT_dvdWaitDraw = 10, +}; /* 8022C0B4-8022C130 .text checkProgSelect__FP10dScnLogo_c */ -void checkProgSelect(dScnLogo_c*) { - /* Nonmatching */ +void checkProgSelect(dScnLogo_c* i_this) { +#if VERSION == VERSION_PAL + if (OSGetResetCode() == 0 || OSGetResetCode() == 1) { + if (OSGetEuRgb60Mode() == 1 || CPad_CHECK_HOLD_B(0)) { + i_this->field_0x1ea = 1; + i_this->mInterFlag = 0; + } + } else { + i_this->field_0x1ea = 0; + } +#else + if (OSGetResetCode() == 0) { + if (VIGetDTVStatus() != 0 && (OSGetProgressiveMode() == 1 || CPad_CHECK_HOLD_B(0))) { + i_this->field_0x1ea = 1; + i_this->mInterFlag = 0; + } + } else { + i_this->field_0x1ea = 0; + } +#endif } /* 8022C130-8022C1D8 .text nintendoInDraw__FP10dScnLogo_c */ -void nintendoInDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL nintendoInDraw(dScnLogo_c* i_this) { + dComIfGd_set2DOpa(i_this->nintendoImg); + if (i_this->mTimer == 0) { + if (i_this->field_0x1ea != 0) { + i_this->mAction = ACT_progInDraw; + i_this->mTimer = 30; + } else { + i_this->mAction = ACT_nintendoOutDraw; + i_this->mTimer = 30; + mDoGph_gInf_c::startFadeOut(30); + } + } + + return TRUE; } /* 8022C1D8-8022C2AC .text nintendoOutDraw__FP10dScnLogo_c */ -void nintendoOutDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL nintendoOutDraw(dScnLogo_c* i_this) { + dComIfGd_set2DOpa(i_this->nintendoImg); + + if (!i_this->mInterFlag) + dComIfGd_set2DOpa(i_this->progImg); + else + dComIfGd_set2DOpa(i_this->interImg); + + if (i_this->mTimer == 0) { + i_this->mAction = ACT_dolbyInDraw; + i_this->mTimer = 90; + mDoGph_gInf_c::startFadeIn(30); + } + + return TRUE; } /* 8022C2AC-8022C35C .text nintendoOut2Draw__FP10dScnLogo_c */ -void nintendoOut2Draw(dScnLogo_c*) { - /* Nonmatching */ +BOOL nintendoOut2Draw(dScnLogo_c* i_this) { + dComIfGd_set2DOpa(i_this->nintendoImg); + + if (!i_this->mInterFlag) + dComIfGd_set2DOpa(i_this->progImg); + else + dComIfGd_set2DOpa(i_this->interImg); + + if (i_this->mTimer == 0) { + i_this->mAction = ACT_progChangeDraw; + i_this->mTimer = 300; + } + + return TRUE; } /* 8022C35C-8022C484 .text progInDraw__FP10dScnLogo_c */ -void progInDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL progInDraw(dScnLogo_c* i_this) { + dComIfGd_set2DOpa(i_this->nintendoImg); + dComIfGd_set2DOpa(i_this->progchoiceImg); + dComIfGd_set2DOpa(i_this->progyesImg); + dComIfGd_set2DOpa(i_this->prognoImg); + + u8 alpha = (1.0f - (i_this->mTimer / 30.0f)) * 0xFF; + i_this->progchoiceImg->setAlpha(alpha); + i_this->progyesImg->setAlpha(alpha); + i_this->prognoImg->setAlpha(alpha); + + if (i_this->mTimer == 0) { + i_this->mAction = ACT_progSelDraw; +#if VERSION == VERSION_JPN + i_this->mTimer = 300; +#else + i_this->mTimer = 600; +#endif + i_this->field_0x1ee = 30; + i_this->field_0x1f0 = i_this->field_0x1ee; + i_this->field_0x1f2 = 0; + i_this->field_0x1eb = 0; + } + + return TRUE; } /* 8022C484-8022CAA8 .text progSelDraw__FP10dScnLogo_c */ -void progSelDraw(dScnLogo_c*) { +BOOL progSelDraw(dScnLogo_c* i_this) { /* Nonmatching */ + + dComIfGd_set2DOpa(i_this->nintendoImg); + dComIfGd_set2DOpa(i_this->progchoiceImg); + dComIfGd_set2DOpa(i_this->progyesImg); + dComIfGd_set2DOpa(i_this->prognoImg); + + return TRUE; } /* 8022CAA8-8022CC54 .text progOutDraw__FP10dScnLogo_c */ -void progOutDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL progOutDraw(dScnLogo_c* i_this) { + u8 alpha = (i_this->mTimer / 30.0f) * 0xFF; + i_this->progchoiceImg->setAlpha(alpha); + i_this->progyesImg->setAlpha(alpha); + i_this->prognoImg->setAlpha(alpha); + + dComIfGd_set2DOpa(i_this->nintendoImg); + dComIfGd_set2DOpa(i_this->progchoiceImg); + dComIfGd_set2DOpa(i_this->progyesImg); + dComIfGd_set2DOpa(i_this->prognoImg); + + if (i_this->mTimer == 0) { +#if VERSION == VERSION_PAL + if (OSGetEuRgb60Mode() == 1 && !i_this->mInterFlag) { +#else + if (OSGetProgressiveMode() && !i_this->mInterFlag) { +#endif + i_this->mAction = ACT_nintendoOut2Draw; + i_this->mTimer = 30; + mDoGph_gInf_c::startFadeOut(30); +#if VERSION == VERSION_PAL + } else if (OSGetEuRgb60Mode() == 0 && i_this->mInterFlag) { +#else + } else if (!OSGetProgressiveMode() && i_this->mInterFlag) { +#endif + i_this->mAction = ACT_nintendoOutDraw; + i_this->mTimer = 30; + mDoGph_gInf_c::startFadeOut(30); + } else { + i_this->mAction = ACT_progSetDraw; +#if VERSION != VERSION_USA + i_this->mTimer = 300; +#else + i_this->mTimer = 600; +#endif + i_this->field_0x1f0 = 30; + } + } + + return TRUE; } /* 8022CC54-8022CDC8 .text progSetDraw__FP10dScnLogo_c */ -void progSetDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL progSetDraw(dScnLogo_c* i_this) { + u8 alpha; + if (i_this->field_0x1f0 != 0) { + alpha = (1.0f - (i_this->field_0x1f0 / 30.0f)) * 0xFF; + i_this->field_0x1f0--; + } else { + alpha = 0xFF; + } + + i_this->progchoiceImg->setAlpha(alpha); + i_this->progyesImg->setAlpha(alpha); + i_this->prognoImg->setAlpha(alpha); + + dComIfGd_set2DOpa(i_this->nintendoImg); + + if (!i_this->mInterFlag) { + i_this->progImg->setAlpha(alpha); + dComIfGd_set2DOpa(i_this->progImg); + } else { + i_this->interImg->setAlpha(alpha); + dComIfGd_set2DOpa(i_this->interImg); + } + + if (i_this->mTimer == 0) { + if (!i_this->mInterFlag) { + i_this->mAction = ACT_nintendoOut2Draw; + } else { +#if VERSION == VERSION_PAL + OSSetEuRgb60Mode(0); +#else + OSSetProgressiveMode(0); +#endif + i_this->mAction = ACT_nintendoOutDraw; + } + + i_this->mTimer = 30; + mDoGph_gInf_c::startFadeOut(30); + } + + return TRUE; } /* 8022CDC8-8022CE60 .text progChangeDraw__FP10dScnLogo_c */ -void progChangeDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL progChangeDraw(dScnLogo_c* i_this) { + if (i_this->mTimer == 299 && !i_this->mInterFlag) { + mDoMch_render_c::setProgressiveMode(); +#if VERSION == VERSION_PAL + OSSetEuRgb60Mode(1); +#else + OSSetProgressiveMode(1); +#endif + } + + if (i_this->mTimer == 0) { + i_this->mAction = 3; + i_this->mTimer = 90; + mDoGph_gInf_c::startFadeIn(30); + } + + return TRUE; } /* 8022CE60-8022CEE8 .text dolbyInDraw__FP10dScnLogo_c */ -void dolbyInDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL dolbyInDraw(dScnLogo_c* i_this) { + dComIfGd_set2DOpa(i_this->dolbyImg); + + if (i_this->mTimer == 0) { + i_this->mAction = 4; + i_this->mTimer = 30; + mDoGph_gInf_c::startFadeOut(30); + } + + return TRUE; } /* 8022CEE8-8022CF44 .text dolbyOutDraw__FP10dScnLogo_c */ -void dolbyOutDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL dolbyOutDraw(dScnLogo_c* i_this) { + dComIfGd_set2DOpa(i_this->dolbyImg); + + if (i_this->mTimer == 0) { + i_this->mAction = 10; + } + + return TRUE; } /* 8022CF44-8022D18C .text dvdWaitDraw__FP10dScnLogo_c */ -void dvdWaitDraw(dScnLogo_c*) { - /* Nonmatching */ +BOOL dvdWaitDraw(dScnLogo_c* i_this) { + if (!dComIfG_syncAllObjectRes() + && l_anmCommand->sync() + && l_fmapCommand->sync() + && l_itemResCommand->sync() + && l_fmapResCommand->sync() + && l_dmapResCommand->sync() + && l_clctResCommand->sync() + && l_optResCommand->sync() + && l_saveResCommand->sync() + && l_clothResCommand->sync() + && l_itemiconCommand->sync() + && l_actioniconCommand->sync() + && l_scopeResCommand->sync() + && l_camResCommand->sync() + && l_swimResCommand->sync() + && l_windResCommand->sync() + && l_nameResCommand->sync() + && l_tmsgCommand->sync() + && l_dmsgCommand->sync() + && l_errorResCommand->sync() + && l_msgDtCommand->sync() +#if VERSION != VERSION_JPN + && l_msgDtCommand2->sync() +#endif + && l_msgCommand->sync() + && l_menuCommand->sync() + && l_fontCommand->sync() + && l_rubyCommand->sync() + && l_particleCommand->sync() + && l_itemTableCommand->sync() + && l_ActorDataCommand->sync() + && l_FmapDataCommand->sync() + && l_lodCommand->sync() && !mDoRst::isReset()) { + + dComIfG_changeOpeningScene(i_this, PROC_OPENING_SCENE); + } + return TRUE; } +typedef BOOL(*drawFunc)(dScnLogo_c* i_this); + /* 8022D18C-8022D1DC .text dScnLogo_Draw__FP10dScnLogo_c */ -void dScnLogo_Draw(dScnLogo_c*) { - /* Nonmatching */ +BOOL dScnLogo_Draw(dScnLogo_c* i_this) { + static drawFunc l_execFunc[] = { + nintendoInDraw, + nintendoOutDraw, + nintendoOut2Draw, + dolbyInDraw, + dolbyOutDraw, + progInDraw, + progSelDraw, + progOutDraw, + progSetDraw, + progChangeDraw, + dvdWaitDraw, + }; + + cLib_calcTimer(&i_this->mTimer); + return l_execFunc[i_this->mAction](i_this); } /* 8022D1DC-8022D21C .text dScnLogo_Execute__FP10dScnLogo_c */ -void dScnLogo_Execute(dScnLogo_c*) { - /* Nonmatching */ +BOOL dScnLogo_Execute(dScnLogo_c* i_this) { + if (mDoRst::isReset()) + fopScnM_ChangeReq(i_this, PROC_LOGO_SCENE, 0, 5); + return TRUE; } /* 8022D21C-8022D224 .text dScnLogo_IsDelete__FP10dScnLogo_c */ -void dScnLogo_IsDelete(dScnLogo_c*) { - /* Nonmatching */ +BOOL dScnLogo_IsDelete(dScnLogo_c* i_this) { + return TRUE; } /* 8022D224-8022D984 .text dScnLogo_Delete__FP10dScnLogo_c */ -void dScnLogo_Delete(dScnLogo_c*) { - /* Nonmatching */ +BOOL dScnLogo_Delete(dScnLogo_c* i_this) { + if (mDoRst::isReset()) + mDoRst_reset(0, 0x80000000, 0); + + delete i_this->nintendoImg; + delete i_this->dolbyImg; + delete i_this->progchoiceImg; + delete i_this->progyesImg; + delete i_this->prognoImg; + delete i_this->progImg; + delete i_this->interImg; + + dComIfGp_particle_createCommon(l_particleCommand->getMemAddress()); + + dComIfGp_setAnmArchive(l_anmCommand->getArchive()); + dComIfGp_setFmapArchive(l_fmapCommand->getArchive()); + dComIfGp_setItemResArchive(l_itemResCommand->getArchive()); + dComIfGp_setFmapResArchive(l_fmapResCommand->getArchive()); + dComIfGp_setDmapResArchive(l_dmapResCommand->getArchive()); + dComIfGp_setClctResArchive(l_clctResCommand->getArchive()); + dComIfGp_setOptResArchive(l_optResCommand->getArchive()); + dComIfGp_setSaveResArchive(l_saveResCommand->getArchive()); + dComIfGp_setClothResArchive(l_clothResCommand->getArchive()); + dComIfGp_setItemIconArchive(l_itemiconCommand->getArchive()); + dComIfGp_setActionIconArchive(l_actioniconCommand->getArchive()); + dComIfGp_setScopeResArchive(l_scopeResCommand->getArchive()); + dComIfGp_setCamResArchive(l_camResCommand->getArchive()); + dComIfGp_setSwimResArchive(l_swimResCommand->getArchive()); + dComIfGp_setWindResArchive(l_windResCommand->getArchive()); + dComIfGp_setNameResArchive(l_nameResCommand->getArchive()); + dComIfGp_setTmsgArchive(l_tmsgCommand->getArchive()); + dComIfGp_setDmsgArchive(l_dmsgCommand->getArchive()); + dComIfGp_setErrorResArchive(l_errorResCommand->getArchive()); + dComIfGp_setMsgDtArchive(l_msgDtCommand->getArchive()); +#if VERSION != VERSION_JPN + dComIfGp_setMsgDt2Archive(l_msgDtCommand2->getArchive()); +#endif + dComIfGp_setMsgArchive(l_msgCommand->getArchive()); + dComIfGp_setMenuArchive(l_menuCommand->getArchive()); + dComIfGp_setFontArchive(l_fontCommand->getArchive()); + // dComIfGp_setRubyArchive(l_rubyCommand->getArchive()); + + delete l_anmCommand; + delete l_fmapCommand; + delete l_itemResCommand; + delete l_fmapResCommand; + delete l_dmapResCommand; + delete l_clctResCommand; + delete l_optResCommand; + delete l_saveResCommand; + delete l_clothResCommand; + delete l_itemiconCommand; + delete l_actioniconCommand; + delete l_scopeResCommand; + delete l_camResCommand; + delete l_swimResCommand; + delete l_windResCommand; + delete l_nameResCommand; + delete l_tmsgCommand; + delete l_dmsgCommand; + delete l_errorResCommand; + delete l_msgDtCommand; +#if VERSION != VERSION_JPN + delete l_msgDtCommand2; +#endif + delete l_msgCommand; + delete l_menuCommand; + delete l_fontCommand; + delete l_rubyCommand; + delete l_particleCommand; + + mDoExt_getMesgFont(); + mDoExt_getRubyFont(); + +#if VERSION == VERSION_JPN + if (g_msgDHIO.field_0x08 == 0 && g_dComIfG_gameInfo.play.mpFont0Archive != NULL) { + g_dComIfG_gameInfo.play.mpFont0Archive->unmount(); + g_dComIfG_gameInfo.play.mpFont0Archive = NULL; + } +#endif + + dComIfGp_setItemTable(l_itemTableCommand->getMemAddress()); + delete l_itemTableCommand; + + dComIfGp_setActorData(l_ActorDataCommand->getMemAddress()); + dComIfGp_setFmapData(l_FmapDataCommand->getMemAddress()); + + delete l_ActorDataCommand; + delete l_FmapDataCommand; + delete l_lodCommand; + + ResTIMG * timg = (ResTIMG *)dComIfG_getObjectRes("Always", ALWAYS_I4_BALL128B); + g_dComIfG_gameInfo.drawlist.mShadowControl.setSimpleTex(timg); + dComIfG_deleteObjectRes("Logo"); + g_dComIfG_gameInfo.play.field_0x4841 = 0; + + for (s32 i = 0; i < 3; i++) { + g_dComIfG_gameInfo.play.mAramHeap0[i] = JKRAram::getAramHeap()->alloc(0x2000, JKRAramHeap::HEAD); + u8 mask = (1 << (u8)i); + g_dComIfG_gameInfo.play.field_0x495b &= ~mask; + } + + for (s32 i = 0; i < 4; i++) { + g_dComIfG_gameInfo.play.mAramHeap1[i] = JKRAram::getAramHeap()->alloc(0x70, JKRAramHeap::HEAD); + } + +#if VERSION == VERSION_PAL + g_dComIfG_gameInfo.play.field_0x4820 = JKRAram::getAramHeap()->alloc(0xB000, JKRAramHeap::HEAD); +#endif + + mDoExt_setSafeGameHeapSize(); + mDoExt_setSafeZeldaHeapSize(); + mDoExt_setSafeCommandHeapSize(); + mDoExt_setSafeArchiveHeapSize(); + + return TRUE; } /* 8022D984-8022DB20 .text phase_0__FP10dScnLogo_c */ -void phase_0(dScnLogo_c*) { - /* Nonmatching */ +s32 phase_0(dScnLogo_c* i_this) { +#if VERSION != VERSION_PAL + if (!OSGetResetCode()) { + if (!VIGetDTVStatus()) + OSSetProgressiveMode(0); + } else { + if (OSGetProgressiveMode() == 1) + mDoMch_render_c::setProgressiveMode(); + } +#endif + + if (!cDyl_InitAsyncIsDone()) + return cPhs_INIT_e; + + if (mDoAud_zelAudio_c::isInitFlag() && JAIZelBasic::getInterface()->checkFirstWaves()) + return cPhs_INIT_e; + +#if VERSION == VERSION_PAL + if (mDoDvdThd::SyncWidthSound == 0) + return cPhs_INIT_e; +#endif + + s32 rt; + + rt = dComIfG_setObjectRes("System", JKRArchive::UNKNOWN_MOUNT_DIRECTION, NULL); + + JUT_ASSERT(VERSION_SELECT(1169, 1350, 1378), rt == 1); + + rt = dComIfG_setObjectRes("Logo", (u8)2, NULL); + JUT_ASSERT(VERSION_SELECT(1173, 1354, 1382), rt == 1); + +#if VERSION == VERSION_PAL + g_mDoMemCd_control.load2(); +#endif + + i_this->field_0x1ea = 0; + archiveHeap->dump_sort(); + return cPhs_NEXT_e; } /* 8022DB20-8022DC58 .text phase_1__FP10dScnLogo_c */ -void phase_1(dScnLogo_c*) { - /* Nonmatching */ +s32 phase_1(dScnLogo_c* i_this) { + if (dComIfG_syncAllObjectRes() != 0) + return cPhs_INIT_e; + +#if VERSION == VERSION_PAL + // some PAL junk here + s32 rt = g_mDoMemCd_control.LoadSync2(); + if (rt == 0) { + return cPhs_INIT_e; + } else if (rt == 1) { + /* field_0x165b */ + if (g_mDoMemCd_control.field_0x165c >= 5) + return cPhs_INIT_e; + } else if (rt == 2) { + OSGetLanguage(); + } +#endif + + ResTIMG * toonImage; + + toonImage = (ResTIMG *)dComIfG_getObjectRes("System", 3); + + JUT_ASSERT(VERSION_SELECT(1208, 1426, 1466), toonImage != 0); + dDlst_list_c::mToonImage = toonImage; + + toonImage = (ResTIMG *)dComIfG_getObjectRes("System", 4); + JUT_ASSERT(VERSION_SELECT(1213, 1431, 1471), toonImage != 0); + dDlst_list_c::mToonExImage = toonImage; + + i_this->field_0x1f8 = mDoExt_getGameHeap()->alloc(0x3c8a0, 4); + return cPhs_NEXT_e; } /* 8022DC58-8022DC80 .text aramMount__FPCc */ -void aramMount(const char*) { - /* Nonmatching */ +mDoDvdThd_mountXArchive_c * aramMount(const char* pArc) { + return mDoDvdThd_mountXArchive_c::create(pArc, JKRArchive::UNKNOWN_MOUNT_DIRECTION, JKRArchive::MOUNT_ARAM); } /* 8022DC80-8022DCA8 .text onMemMount__FPCc */ -void onMemMount(const char*) { - /* Nonmatching */ +mDoDvdThd_mountXArchive_c * onMemMount(const char* pArc) { + return mDoDvdThd_mountXArchive_c::create(pArc, JKRArchive::UNKNOWN_MOUNT_DIRECTION, JKRArchive::MOUNT_MEM); } /* 8022DCA8-8022E9B4 .text phase_2__FP10dScnLogo_c */ -void phase_2(dScnLogo_c*) { - /* Nonmatching */ +s32 phase_2(dScnLogo_c* i_this) { + /* Nonmatching - color assignment. */ + s32 rt; + + rt = dComIfG_syncObjectRes("Logo"); + JUT_ASSERT(VERSION_SELECT(1251, 1469, 1509), rt >= 0); + + if (rt != 0) + return cPhs_INIT_e; + + g_dComIfG_gameInfo.play.createParticle(); + + ResTIMG * timg; + + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", 3); + JUT_ASSERT(VERSION_SELECT(1264, 1482, 1522), timg != 0); + i_this->nintendoImg = new dDlst_2D_c(timg, 133, 170, 0); + JUT_ASSERT(VERSION_SELECT(1267, 1485, 1525), i_this->nintendoImg != 0); + i_this->nintendoImg->getPicture()->setWhite(JUtility::TColor(0xDC, 0x00, 0x00, 0xFF)); + i_this->nintendoImg->setAlpha(0x00); + +#if VERSION == VERSION_PAL + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", 29); +#else + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", 9); +#endif + JUT_ASSERT(VERSION_SELECT(1276, 1498, 1538), timg != 0); + i_this->dolbyImg = new dDlst_2D_c(timg, 218, 166, 0); + JUT_ASSERT(VERSION_SELECT(1280, 1502, 1542), i_this->dolbyImg != 0); + i_this->dolbyImg->setAlpha(0xFF); + +#if VERSION == VERSION_PAL + static u8 choice[] = { + 1, 2, 3, 4, + }; + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", choice[g_dComIfG_gameInfo.play.mGameLanguage]); +#else + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", 4); +#endif + JUT_ASSERT(VERSION_SELECT(1286, 1565, 1605), timg != 0); + i_this->progchoiceImg = new dDlst_2D_c(timg, 113, 281, 0); + JUT_ASSERT(VERSION_SELECT(1288, 1567, 1607), i_this->progchoiceImg != 0); + i_this->progchoiceImg->setAlpha(0x00); + +#if VERSION == VERSION_PAL + static u8 yes[] = { + 1, 2, 3, 4, + }; + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", yes[g_dComIfG_gameInfo.play.mGameLanguage]); +#else + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", 8); +#endif + JUT_ASSERT(VERSION_SELECT(1295, 1579, 1619), timg != 0); + i_this->progyesImg = new dDlst_2D_c(timg, 211, 372, 0); + JUT_ASSERT(VERSION_SELECT(1297, 1581, 1621), i_this->progyesImg != 0); + i_this->progyesImg->getPicture()->setWhite(JUtility::TColor(0xFFC800FF)); + i_this->progyesImg->setAlpha(0x00); + +#if VERSION == VERSION_PAL + static u8 no[] = { + 1, 2, 3, 4, + }; + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", no[g_dComIfG_gameInfo.play.mGameLanguage]); +#else + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", 6); +#endif + JUT_ASSERT(VERSION_SELECT(1305, 1594, 1634), timg != 0); + i_this->prognoImg = new dDlst_2D_c(timg, 350, 372, 0); + JUT_ASSERT(VERSION_SELECT(1307, 1611, 1611), i_this->prognoImg != 0); + i_this->prognoImg->getPicture()->setWhite(JUtility::TColor(0xA0A0A0FF)); + i_this->prognoImg->setAlpha(0x00); + +#if VERSION == VERSION_PAL + static u8 prog[] = { + 1, 2, 3, 4, + }; + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", prog[g_dComIfG_gameInfo.play.mGameLanguage]); +#else + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", 7); +#endif + JUT_ASSERT(VERSION_SELECT(1315, 1609, 1649), timg != 0); + i_this->progImg = new dDlst_2D_c(timg, 153, 309, 0); + JUT_ASSERT(VERSION_SELECT(1317, 1611, 1651), i_this->progImg != 0); + i_this->progImg->setAlpha(0x00); + +#if VERSION == VERSION_PAL + static u8 intr[] = { + 1, 2, 3, 4, + }; + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", intr[g_dComIfG_gameInfo.play.mGameLanguage]); +#else + timg = (ResTIMG *)dComIfG_getObjectRes("Logo", 5); +#endif + JUT_ASSERT(VERSION_SELECT(1324, 1623, 1663), timg != 0); + i_this->interImg = new dDlst_2D_c(timg, 153, 309, 0); + JUT_ASSERT(VERSION_SELECT(1326, 1625, 1665), i_this->interImg != 0); + i_this->interImg->setAlpha(0x00); + + JKRHeap::free(i_this->field_0x1f8, NULL); + + l_lodCommand = aramMount("/res/Stage/sea/LODALL.arc"); + JUT_ASSERT(VERSION_SELECT(1346, 1645, 1685), l_lodCommand != 0); + + rt = dComIfG_setObjectRes("Always", JKRArchive::UNKNOWN_MOUNT_DIRECTION, NULL); + JUT_ASSERT(VERSION_SELECT(1351, 1650, 1690), rt == 1); + + archiveHeap->dump_sort(); + + rt = dComIfG_setObjectRes("Link", JKRArchive::UNKNOWN_MOUNT_DIRECTION, NULL); + JUT_ASSERT(VERSION_SELECT(1356, 1655, 1695), rt == 1); + + rt = dComIfG_setObjectRes("Agb", JKRArchive::UNKNOWN_MOUNT_DIRECTION, NULL); + JUT_ASSERT(VERSION_SELECT(1360, 1659, 1699), rt == 1); + + l_anmCommand = aramMount("/res/Object/LkAnm.arc"); + l_fmapCommand = aramMount("/res/Fmap/Fmap.arc"); + l_itemResCommand = aramMount("/res/Msg/itemres.arc"); + l_fmapResCommand = aramMount("/res/Msg/fmapres.arc"); + l_dmapResCommand = aramMount("/res/Msg/dmapres.arc"); + l_clctResCommand = aramMount("/res/Msg/clctres.arc"); + l_optResCommand = aramMount("/res/Msg/optres.arc"); + l_clothResCommand = aramMount("/res/Msg/clothres.arc"); + l_itemiconCommand = aramMount("/res/Msg/itemicon.arc"); + +#if VERSION == VERSION_PAL + if (g_dComIfG_gameInfo.play.field_0x4820 != NULL) { + (u32)g_dComIfG_gameInfo.play.field_0x4820; + } + char buf[256]; + sprintf(buf, "/res/Msg/data%d/acticon.arc", g_dComIfG_gameInfo.play.mGameLanguage); + l_actioniconCommand = aramMount(buf); +#else + l_actioniconCommand = aramMount("/res/Msg/acticon.arc"); +#endif + + l_scopeResCommand = aramMount("/res/Msg/scoperes.arc"); + l_camResCommand = aramMount("/res/Msg/camres.arc"); + l_swimResCommand = onMemMount("/res/Msg/swimres.arc"); + l_windResCommand = aramMount("/res/Msg/windres.arc"); + l_nameResCommand = aramMount("/res/Msg/nameres.arc"); + l_tmsgCommand = aramMount("/res/Msg/tmsgres.arc"); + l_dmsgCommand = aramMount("/res/Msg/dmsgres.arc"); + l_errorResCommand = aramMount("/res/Msg/errorres.arc"); + l_saveResCommand = aramMount("/res/Msg/saveres.arc"); + +#if VERSION == VERSION_PAL + sprintf(buf, "/res/Msg/data%d/bmgres.arc", g_dComIfG_gameInfo.play.mGameLanguage); + l_msgDtCommand = onMemMount(buf); +#else + l_msgDtCommand = onMemMount("/res/Msg/bmgres.arc"); +#endif + +#if VERSION != VERSION_JPN + l_msgDtCommand2 = onMemMount("/res/Msg/bmgresh.arc"); +#endif + l_msgCommand = aramMount("/res/Msg/msgres.arc"); + l_menuCommand = onMemMount("/res/Msg/menures.arc"); +#if VERSION == VERSION_JPN + l_fontCommand = mDoDvdThd_mountXArchive_c::create("/res/Msg/fontres.arc", JKRArchive::MOUNT_DIRECTION_HEAD, JKRArchive::MOUNT_MEM); +#else + l_fontCommand = onMemMount("/res/Msg/fontres.arc"); +#endif + l_rubyCommand = onMemMount("/res/Msg/rubyres.arc"); + l_particleCommand = mDoDvdThd_toMainRam_c::create("/res/Particle/common.jpc", JKRArchive::UNKNOWN_MOUNT_DIRECTION, g_dComIfG_gameInfo.play.getParticle()->getHeap()); + l_itemTableCommand = mDoDvdThd_toMainRam_c::create("/res/ItemTable/item_table.bin", JKRArchive::UNKNOWN_MOUNT_DIRECTION, NULL); + JUT_ASSERT(VERSION_SELECT(1418, 1743, 1783), l_itemTableCommand != 0); + l_ActorDataCommand = mDoDvdThd_toMainRam_c::create("/res/ActorDat/ActorDat.bin", JKRArchive::UNKNOWN_MOUNT_DIRECTION, NULL); + JUT_ASSERT(VERSION_SELECT(1422, 1747, 1787), l_ActorDataCommand != 0); + l_FmapDataCommand = mDoDvdThd_toMainRam_c::create("/res/FmapDat/FmapDat.bin", JKRArchive::UNKNOWN_MOUNT_DIRECTION, NULL); + JUT_ASSERT(VERSION_SELECT(1426, 1751, 1791), l_FmapDataCommand != 0); + + JAIZelBasic::getInterface()->loadStaticWaves(); + mDoGph_gInf_c::setTickRate((OS_BUS_CLOCK / 4) / 60); + mDoGph_gInf_c::waitBlanking(0); + mDoGph_gInf_c::startFadeIn(30); + i_this->mTimer = 90; + +#if VERSION != VERSION_JPN + mDoRst::offReset(); + mDoRst::offResetPrepare(); +#endif + + JUTGamePad::clearResetOccurred(); + JUTGamePad::setResetCallback(mDoRst_resetCallBack, NULL); + return cPhs_COMPLEATE_e; } /* 8022E9B4-8022E9F4 .text dScnLogo_Create__FP11scene_class */ -void dScnLogo_Create(scene_class*) { - /* Nonmatching */ +s32 dScnLogo_Create(scene_class* i_scn) { + static cPhs__Handler l_method[] = { + (cPhs__Handler)phase_0, + (cPhs__Handler)phase_1, + (cPhs__Handler)phase_2, + }; + + dScnLogo_c * i_this = (dScnLogo_c *)i_scn; + checkProgSelect(i_this); + return dComLbG_PhaseHandler(&i_this->mPhs, l_method, i_this); } +scene_method_class l_dScnLogo_Method = { + (process_method_func)dScnLogo_Create, + (process_method_func)dScnLogo_Delete, + (process_method_func)dScnLogo_Execute, + (process_method_func)dScnLogo_IsDelete, + (process_method_func)dScnLogo_Draw, +}; + +scene_process_profile_definition g_profile_Logo_SCENE = { + fpcLy_ROOT_e, + 1, + fpcPi_CURRENT_e, + PROC_LOGO_SCENE, + &g_fpcNd_Method.mBase, + sizeof(dScnLogo_c), + 0, + 0, + &g_fopScn_Method.mBase, + &l_dScnLogo_Method, + NULL, +}; diff --git a/src/f_op/f_op_overlap_mng.cpp b/src/f_op/f_op_overlap_mng.cpp index 56e57c735..10fba5a50 100644 --- a/src/f_op/f_op_overlap_mng.cpp +++ b/src/f_op/f_op_overlap_mng.cpp @@ -37,7 +37,7 @@ void fopOvlpM_Done(overlap_task_class* pTaskClass) { cReq_Done(&pTaskClass->mRq); } -void fopOvlpM_ToldAboutID(u32 pcId) { +void fopOvlpM_ToldAboutID(unsigned int pcId) { if (l_fopOvlpM_overlap[0] != NULL) l_fopOvlpM_overlap[0]->mpTask->mScenePId = pcId; } diff --git a/src/m_Do/m_Do_machine.cpp b/src/m_Do/m_Do_machine.cpp index fc2e7e542..0b81fb16a 100644 --- a/src/m_Do/m_Do_machine.cpp +++ b/src/m_Do/m_Do_machine.cpp @@ -418,14 +418,6 @@ GXRenderModeObj g_ntscZeldaProg = { }; #endif -namespace mDoMch_render_c { - GXRenderModeObj* mRenderModeObj = &g_ntscZeldaIntDf; - - inline GXRenderModeObj* getRenderModeObj() { return mRenderModeObj; } - inline void setRenderModeObj(GXRenderModeObj* obj) { mRenderModeObj = obj; } - inline void setProgressiveMode() { setRenderModeObj(&g_ntscZeldaProg); } -} - /* 8000C70C-8000CB48 .text mDoMch_Create__Fv */ bool mDoMch_Create() { if (mDoMain::developmentMode == 0 || !(OSGetConsoleType() & 0x10000000)) { @@ -502,13 +494,7 @@ bool mDoMch_Create() { JKRHeap* sysHeap = JKRHeap::getSystemHeap(); s32 size = sysHeap->getFreeSize() - 0x10000; -#if VERSION == VERSION_JPN - JUT_ASSERT(996, size > 0); -#elif VERSION == VERSION_USA - JUT_ASSERT(1104, size > 0); -#elif VERSION == VERSION_PAL - JUT_ASSERT(1143, size > 0); -#endif + JUT_ASSERT(VERSION_SELECT(996, 1104, 1143), size > 0); JKRHeap* zeldaHeap = mDoExt_createZeldaHeap(size, sysHeap); zeldaHeap->becomeCurrentHeap(); @@ -535,3 +521,5 @@ bool mDoMch_Create() { mDoMemCd_ThdInit(); return true; } + +GXRenderModeObj* mDoMch_render_c::mRenderModeObj = &g_ntscZeldaIntDf; diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index 090447896..ca4a12459 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -210,11 +210,7 @@ void debugDisplay() { return; } } else if (mHeapBriefType != 0) { -#if VERSION == VERSION_JPN - JUT_ASSERT(530, mHeapBriefType < HeapCheckTableNum); -#else - JUT_ASSERT(531, mHeapBriefType < HeapCheckTableNum); -#endif + JUT_ASSERT(VERSION_SELECT(530, 531, 531), mHeapBriefType < HeapCheckTableNum); JUTReport(500, 100, "%s", desc1[mHeapBriefType]); JUTReport(500, 114, "%s", desc2[mHeapBriefType]);