diff --git a/configure.py b/configure.py index d6e554599..587be79ed 100755 --- a/configure.py +++ b/configure.py @@ -384,7 +384,7 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_ap/f_ap_game.cpp"), # f_op - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_op/f_op_actor.cpp", extra_cflags=["-sym off"]), + Object(Matching, "f_op/f_op_actor.cpp", extra_cflags=["-sym off"]), Object(Matching, "f_op/f_op_actor_iter.cpp"), Object(Matching, "f_op/f_op_actor_tag.cpp"), Object(Equivalent, "f_op/f_op_actor_mng.cpp", extra_cflags=['-pragma "nosyminline on"']), # weak func order @@ -472,10 +472,10 @@ config.libs = [ Object(Matching, "d/d_a_race_item_static.cpp"), Object(Matching, "d/d_a_leaflift_static.cpp"), Object(NonMatching, "d/d_demo.cpp"), - Object(Equivalent, "d/d_door.cpp", extra_cflags=['-pragma "nosyminline on"']), # weak func order + Object(Matching, "d/d_door.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_resorce.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_material.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_event.cpp"), + Object(Matching, "d/d_event.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_event_data.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_event_manager.cpp"), Object(NonMatching, "d/d_magma.cpp", extra_cflags=['-sym off']), @@ -483,7 +483,7 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_grass.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(NonMatching, "d/d_tree.cpp"), Object(NonMatching, "d/d_particle.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_particle_name.cpp"), + Object(Matching, "d/d_particle_name.cpp"), Object(Matching, "d/d_path.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_drawlist.cpp", extra_cflags=['-sym off']), Object(Matching, "d/d_kankyo_data.cpp"), @@ -492,9 +492,9 @@ config.libs = [ Object(Matching, "d/d_kankyo_demo.cpp"), Object(NonMatching, "d/d_detect.cpp"), Object(Matching, "d/d_vibration.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_vib_pattern.cpp"), + Object(Matching, "d/d_vib_pattern.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_attention.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_att_dist.cpp"), + Object(Matching, "d/d_att_dist.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_bg_s.cpp"), Object(Matching, "d/d_bg_s_acch.cpp"), Object(Matching, "d/d_bg_s_func.cpp"), @@ -513,14 +513,14 @@ config.libs = [ Object(NonMatching, "d/d_cam_param.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cam_type.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cam_style.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cam_type2.cpp"), + Object(Matching, "d/d_cam_type2.cpp"), Object(NonMatching, "d/d_ev_camera.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_wood.cpp", extra_cflags=["-sym off"]), Object(NonMatching, "d/d_flower.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_item_data.cpp"), + Object(Matching, "d/d_item_data.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_seafightgame.cpp"), Object(Matching, "d/d_spline_path.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_s_actor_data_mng.cpp"), + Object(Matching, "d/d_s_actor_data_mng.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_item.cpp"), Object(NonMatching, "d/d_2dnumber.cpp"), Object(Matching, "d/d_a_npc_cb1_static.cpp"), @@ -667,7 +667,7 @@ config.libs = [ JSystemLib( "JFramework", [ - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JFramework/JFWDisplay.cpp"), + Object(Matching, "JSystem/JFramework/JFWDisplay.cpp"), Object(NonMatching, "JSystem/JFramework/JFWSystem.cpp"), ], ), @@ -747,7 +747,7 @@ config.libs = [ "JStudio_JAudio", [ Object(Matching, "JSystem/JStudio/JStudio_JAudio/control.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JStudio/JStudio_JAudio/object-sound.cpp"), + Object(Matching, "JSystem/JStudio/JStudio_JAudio/object-sound.cpp"), ], ), JSystemLib( @@ -776,7 +776,7 @@ config.libs = [ Object(Matching, "JSystem/JAudio/JASCalc.cpp"), Object(Matching, "JSystem/JAudio/JASAiCtrl.cpp"), Object(Matching, "JSystem/JAudio/JASDvdThread.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JAudio/JASCallback.cpp"), + Object(Matching, "JSystem/JAudio/JASCallback.cpp"), Object(Matching, "JSystem/JAudio/JASRate.cpp"), Object(Matching, "JSystem/JAudio/JASHardStream.cpp"), Object(Matching, "JSystem/JAudio/JASHeapCtrl.cpp"), @@ -888,13 +888,13 @@ config.libs = [ JSystemLib( "JKernel", [ - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRHeap.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRStdHeap.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRExpHeap.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRSolidHeap.cpp"), + Object(Matching, "JSystem/JKernel/JKRHeap.cpp"), + Object(Matching, "JSystem/JKernel/JKRStdHeap.cpp"), + Object(Matching, "JSystem/JKernel/JKRExpHeap.cpp"), + Object(Matching, "JSystem/JKernel/JKRSolidHeap.cpp"), Object(Matching, "JSystem/JKernel/JKRDisposer.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRThread.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRAram.cpp"), + Object(Matching, "JSystem/JKernel/JKRThread.cpp"), + Object(Matching, "JSystem/JKernel/JKRAram.cpp"), Object(Matching, "JSystem/JKernel/JKRAramHeap.cpp"), Object(Matching, "JSystem/JKernel/JKRAramBlock.cpp"), Object(Matching, "JSystem/JKernel/JKRAramPiece.cpp"), @@ -905,13 +905,13 @@ config.libs = [ Object(Matching, "JSystem/JKernel/JKRArchivePub.cpp"), Object(Matching, "JSystem/JKernel/JKRArchivePri.cpp"), Object(Matching, "JSystem/JKernel/JKRMemArchive.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRAramArchive.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRDvdArchive.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRCompArchive.cpp"), + Object(Matching, "JSystem/JKernel/JKRAramArchive.cpp"), + Object(Matching, "JSystem/JKernel/JKRDvdArchive.cpp"), + Object(Matching, "JSystem/JKernel/JKRCompArchive.cpp"), Object(Matching, "JSystem/JKernel/JKRFile.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRDvdFile.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRDvdRipper.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "JSystem/JKernel/JKRDvdAramRipper.cpp", extra_cflags=["-sym off"]), + Object(Matching, "JSystem/JKernel/JKRDvdFile.cpp"), + Object(Matching, "JSystem/JKernel/JKRDvdRipper.cpp"), + Object(Matching, "JSystem/JKernel/JKRDvdAramRipper.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(Matching, "JSystem/JKernel/JKRDecomp.cpp"), ], ), @@ -1227,7 +1227,7 @@ config.libs = [ Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c"), Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c"), Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c"), Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c"), Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtold.c"), # Demo-only @@ -1440,8 +1440,8 @@ config.libs = [ ActorRel(NonMatching, "d_a_stone2"), ActorRel(Matching, "d_a_swc00"), ActorRel(Equivalent, "d_a_swhit0", extra_cflags=['-pragma "nosyminline on"']), # weak func order - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_swtdoor"), - ActorRel(Equivalent, "d_a_tag_attention"), + ActorRel(Matching, "d_a_swtdoor"), + ActorRel(Equivalent, "d_a_tag_attention", extra_cflags=['-pragma "nosyminline on"']), # weak func order ActorRel(NonMatching, "d_a_tag_ba1"), ActorRel(Matching, "d_a_tag_event"), ActorRel(Matching, "d_a_tag_evsw", extra_cflags=['-pragma "nosyminline on"']), @@ -1450,9 +1450,9 @@ config.libs = [ ActorRel(Matching, "d_a_tag_kb_item"), ActorRel(Equivalent, "d_a_tag_kk1", extra_cflags=['-pragma "nosyminline on"']), # weak func order ActorRel(NonMatching, "d_a_tag_light"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_tag_msg"), + ActorRel(Matching, "d_a_tag_msg"), ActorRel(NonMatching, "d_a_tag_photo"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_tag_waterlevel"), + ActorRel(Matching, "d_a_tag_waterlevel"), ActorRel(Matching, "d_a_tama", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_tbox", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_tpota", extra_cflags=['-pragma "nosyminline on"']), @@ -1676,14 +1676,14 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_hcbh"), ActorRel(Equivalent, "d_a_obj_hha"), # weak func order ActorRel(NonMatching, "d_a_obj_hlift"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_homen", extra_cflags=["-sym off"]), + ActorRel(Matching, "d_a_obj_homen", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_homensmoke", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_hsehi1"), ActorRel(NonMatching, "d_a_obj_htetu1"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_iceisland", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_jump"), ActorRel(NonMatching, "d_a_obj_kanoke"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_ladder", extra_cflags=['-pragma "nosyminline on"']), + ActorRel(Matching, "d_a_obj_ladder", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_light"), ActorRel(NonMatching, "d_a_obj_mkie"), ActorRel(NonMatching, "d_a_obj_mkiek"), diff --git a/include/JSystem/JKernel/JKRExpHeap.h b/include/JSystem/JKernel/JKRExpHeap.h index 6a89271e9..a62c9ff46 100644 --- a/include/JSystem/JKernel/JKRExpHeap.h +++ b/include/JSystem/JKernel/JKRExpHeap.h @@ -77,7 +77,9 @@ public: /* vt[10] */ virtual void do_free(void* ptr); /* override */ /* vt[11] */ virtual void do_freeAll(); /* override */ /* vt[12] */ virtual void do_freeTail(); /* override */ +#if VERSION > VERSION_DEMO /* vt[13] */ virtual void do_freeFill(); /* override */ +#endif /* vt[14] */ virtual s32 do_resize(void* ptr, u32 size); /* override */ /* vt[15] */ virtual s32 do_getSize(void* ptr); /* override */ /* vt[16] */ virtual s32 do_getFreeSize(); /* override */ diff --git a/include/JSystem/JKernel/JKRHeap.h b/include/JSystem/JKernel/JKRHeap.h index d44c48469..aa9a25dab 100644 --- a/include/JSystem/JKernel/JKRHeap.h +++ b/include/JSystem/JKernel/JKRHeap.h @@ -67,7 +67,9 @@ public: /* vt[10] */ virtual void do_free(void* ptr) = 0; /* vt[11] */ virtual void do_freeAll() = 0; /* vt[12] */ virtual void do_freeTail() = 0; +#if VERSION > VERSION_DEMO /* vt[13] */ virtual void do_freeFill() = 0; +#endif /* vt[14] */ virtual s32 do_resize(void* ptr, u32 size) = 0; /* vt[15] */ virtual s32 do_getSize(void* ptr) = 0; /* vt[16] */ virtual s32 do_getFreeSize() = 0; diff --git a/include/JSystem/JKernel/JKRSolidHeap.h b/include/JSystem/JKernel/JKRSolidHeap.h index bd0625936..de3aecf8d 100644 --- a/include/JSystem/JKernel/JKRSolidHeap.h +++ b/include/JSystem/JKernel/JKRSolidHeap.h @@ -32,7 +32,9 @@ public: /* vt[10] */ virtual void do_free(void*); /* override */ /* vt[11] */ virtual void do_freeAll(void); /* override */ /* vt[12] */ virtual void do_freeTail(void); /* override */ +#if VERSION > VERSION_DEMO /* vt[13] */ virtual void do_freeFill(void); /* override */ +#endif /* vt[14] */ virtual s32 do_resize(void*, u32); /* override */ /* vt[15] */ virtual s32 do_getSize(void*); /* override */ /* vt[16] */ virtual s32 do_getFreeSize(void) { return mFreeSize;} /* override */ diff --git a/include/JSystem/JKernel/JKRStdHeap.h b/include/JSystem/JKernel/JKRStdHeap.h index 677e24c5e..4bc534eb3 100644 --- a/include/JSystem/JKernel/JKRStdHeap.h +++ b/include/JSystem/JKernel/JKRStdHeap.h @@ -19,7 +19,9 @@ public: void* do_getMaxFreeBlock(); void state_register(JKRHeap::TState*, u32) const; bool state_compare(const JKRHeap::TState&, const JKRHeap::TState&) const; +#if VERSION > VERSION_DEMO void do_freeFill(); +#endif u32 getHeapType() { return 'STDH'; } bool check() { return OSCheckHeap(mHeapHandle) != -1; } bool dump() { diff --git a/include/d/actor/d_a_ghostship.h b/include/d/actor/d_a_ghostship.h index 90690c33c..d032471bd 100644 --- a/include/d/actor/d_a_ghostship.h +++ b/include/d/actor/d_a_ghostship.h @@ -60,7 +60,9 @@ public: /* 0x300 */ dBgS_ObjAcch mAcch; /* 0x4C4 */ dBgS_AcchCir mCir; /* 0x504 */ dLib_wave_c mWave; +#if VERSION > VERSION_DEMO /* 0x510 */ bool mbEnteredShip; +#endif /* 0x514 */ dLib_circle_path_c mPaths[0xC]; /* 0x6C4 */ f32 field_0x6C4[0xC]; /* 0x6F4 */ cXyz mPathPos; diff --git a/include/d/actor/d_a_npc_km1.h b/include/d/actor/d_a_npc_km1.h index 81c7c50d2..e0d770024 100644 --- a/include/d/actor/d_a_npc_km1.h +++ b/include/d/actor/d_a_npc_km1.h @@ -9,25 +9,34 @@ class daNpc_Km1_c : public fopNpc_npc_c { public: - typedef int (daNpc_Km1_c::*ActionFunc)(void*); struct anm_prm_c { s8 field_0x0; s8 field_0x1; - float field_0x4; - float field_0x8; + f32 field_0x4; + f32 field_0x8; int field_0xC; }; - Vec* getAttPos() {return &field_0x780;} + enum Animation { + /* 0x0 */ ANM_WAIT, + /* 0x1 */ ANM_END, + }; + + enum TexPattern { + /* 0x0 */ TEXPATTERN_MABA, + /* 0x1 */ TEXPATTERN_END, + }; + + s8 getHeadJntNum() {return m_head_jnt_num;} s8 getBackboneJntNum() {return m_backbone_jnt_num;} s16 getBackbone_x() {return m_jnt.getBackbone_x();} s16 getBackbone_y() {return m_jnt.getBackbone_y();} - Vec* getEyePos() {return &field_0x78C;} - s8 getHeadJntNum() {return m_head_jnt_num;} s16 getHead_x() {return m_jnt.getHead_x();} s16 getHead_y() {return m_jnt.getHead_y();} + Vec* getAttPos() {return &mAttPos;} + Vec* getEyePos() {return &mEyePos;} bool createInit(); void setMtx(); @@ -87,8 +96,8 @@ public: /* 0x76C */ csXyz field_0x76C; /* 0x772 */ u8 field_0x772[0x774 - 0x772]; /* 0x774 */ cXyz field_0x774; - /* 0x780 */ cXyz field_0x780; - /* 0x78C */ cXyz field_0x78C; + /* 0x780 */ cXyz mAttPos; + /* 0x78C */ cXyz mEyePos; /* 0x798 */ cXyz field_0x798; /* 0x7A4 */ f32 field_0x7A4; /* 0x7A8 */ u8 field_0x7A8[0x7AC - 0x7A8]; diff --git a/include/d/actor/d_a_obj_homen.h b/include/d/actor/d_a_obj_homen.h index f823ddc3f..904d58e62 100644 --- a/include/d/actor/d_a_obj_homen.h +++ b/include/d/actor/d_a_obj_homen.h @@ -9,9 +9,15 @@ class dBgW; namespace daObjHomen { + class Act_c +#if VERSION == VERSION_DEMO + : public fopAc_ac_c +#else // Note: The fopEn_enemy_c base class isn't used in this actor and doesn't appear in this actor's debug map. // However, it seems necessary for the destructor to match. - class Act_c : public fopEn_enemy_c { + : public fopEn_enemy_c +#endif + { public: typedef BOOL (Act_c::*ProcInitFunc)(); typedef void (Act_c::*ProcMainFunc)(); diff --git a/include/d/actor/d_a_obj_homensmoke.h b/include/d/actor/d_a_obj_homensmoke.h index ed02c3cfe..afa7eb0cc 100644 --- a/include/d/actor/d_a_obj_homensmoke.h +++ b/include/d/actor/d_a_obj_homensmoke.h @@ -23,6 +23,9 @@ namespace daObjHomensmoke { /* 0x294 */ u8 m294[0x29C - 0x294]; /* 0x29C */ Mtx mMtx; /* 0x2CC */ int mType; +#if VERSION == VERSION_DEMO + /* 0x2D0 */ JPABaseEmitter* m2D0; +#endif /* 0x2D0 */ dPa_smokeEcallBack mSmokeCb; /* 0x2F0 */ BOOL mbInitialized; /* 0x2F4 */ cXyz mSmokePos; diff --git a/include/d/actor/d_a_ship.h b/include/d/actor/d_a_ship.h index 960163988..c9b8a71ed 100644 --- a/include/d/actor/d_a_ship.h +++ b/include/d/actor/d_a_ship.h @@ -108,7 +108,15 @@ public: void checkCraneMode() const {} void checkCraneUpEnd() const {} +#if VERSION == VERSION_DEMO + BOOL checkForceMove() { return getTornadoActor() || getWhirlActor(); } + daTornado_c* getTornadoActor() { return mTornadoActor; } + fopAc_ac_c* getWhirlActor() { return mWhirlActor; } +#else BOOL checkForceMove() const { return getTornadoActor() || getWhirlActor(); } + daTornado_c* getTornadoActor() const { return mTornadoActor; } + fopAc_ac_c* getWhirlActor() const { return mWhirlActor; } +#endif void checkRopeCntMax() const {} void checkRopeDownStart() const {} void checkSalvageDemo() const {} @@ -132,8 +140,6 @@ public: void getTactJntMtx() {} f32 getTillerAngleRate() { return mTillerAngleRate; } cXyz* getTillerTopPosP() { return &mTillerTopPos; } - daTornado_c* getTornadoActor() const { return mTornadoActor; } - fopAc_ac_c* getWhirlActor() const { return mWhirlActor; } void offCraneHookFlg() {} void offFantomGanonBattle() {} void offStateFlg(daSHIP_SFLG flag) { mStateFlag &= ~flag;} diff --git a/include/d/actor/d_a_tag_attention.h b/include/d/actor/d_a_tag_attention.h index 739583112..9b7ac0b20 100644 --- a/include/d/actor/d_a_tag_attention.h +++ b/include/d/actor/d_a_tag_attention.h @@ -27,13 +27,14 @@ namespace daTagAttention { // box collision check if (current.angle.y){ s16 yRotAngle = current.angle.y; - f32 temp = - plyrToObjVec.x * cM_ssin(yRotAngle) + - plyrToObjVec.z * cM_scos(yRotAngle); - plyrToObjVec.x = + f32 x = plyrToObjVec.x * cM_scos(yRotAngle) - plyrToObjVec.z * cM_ssin(yRotAngle); - plyrToObjVec.z = temp; + f32 z = + plyrToObjVec.x * cM_ssin(yRotAngle) + + plyrToObjVec.z * cM_scos(yRotAngle); + plyrToObjVec.x = x; + plyrToObjVec.z = z; } if ((plyrToObjVec.x < -scale.x * 100.0f) || (plyrToObjVec.x > scale.x * 100.0f)){ diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index be49a5276..992281d86 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -3369,10 +3369,10 @@ int dComIfGd_setShadow(u32 id, s8 param_2, J3DModel* pModel, cXyz* pPos, f32 par s16 rotY = 0, f32 param_12 = 1.0f, GXTexObj* pTexObj = dDlst_shadowControl_c::getSimpleTex()); -inline int dComIfGd_setSimpleShadow(cXyz* i_pos, f32 groundY, f32 param_2, cXyz* param_3, +inline int dComIfGd_setSimpleShadow(cXyz* i_pos, f32 groundY, f32 param_2, cXyz* floor_nrm, s16 i_angle = 0, f32 param_5 = 1.0f, GXTexObj* i_tex = dDlst_shadowControl_c::getSimpleTex()) { - return g_dComIfG_gameInfo.drawlist.setSimpleShadow(i_pos, groundY, param_2, param_3, i_angle, + return g_dComIfG_gameInfo.drawlist.setSimpleShadow(i_pos, groundY, param_2, floor_nrm, i_angle, param_5, i_tex); } diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index 967253aec..4d5e72115 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -580,9 +580,9 @@ public: void drawXluListInvisible() { drawXluDrawList(mpXluListInvisible); } void drawOpaList2D() { drawOpaDrawList(mpOpaList2D); } - int setSimpleShadow(cXyz* i_pos, f32 groundY, f32 param_2, cXyz* param_3, s16 i_angle, + int setSimpleShadow(cXyz* i_pos, f32 groundY, f32 param_2, cXyz* floor_nrm, s16 i_angle, f32 param_5, GXTexObj* i_tex) { - return mShadowControl.setSimple(i_pos, groundY, param_2, param_3, i_angle, param_5, + return mShadowControl.setSimple(i_pos, groundY, param_2, floor_nrm, i_angle, param_5, i_tex); } int setRealShadow(u32 id, s8 param_2, J3DModel* pModel, cXyz* pPos, f32 param_5, f32 param_6, diff --git a/include/d/d_event.h b/include/d/d_event.h index 4d7556e73..5edd1c431 100644 --- a/include/d/d_event.h +++ b/include/d/d_event.h @@ -131,13 +131,14 @@ public: void reset() { onEventFlag(8); } BOOL runCheck() { return mMode != dEvtMode_NONE_e; } - u32 getMode() { return mMode & 0xFF; } // &0xFF added to fix dEvt_control_c::moveApproval, probably fakematch + u8 getMode() const { return mMode; } - void checkHind(u16) {} - BOOL chkPhoto() { return mbInPhoto; } - void getMode() const {} - void offHindFlag(u16) {} void onHindFlag(u16) {} + void offHindFlag(u16) {} + void checkHind(u16) {} + + BOOL chkPhoto() { return mbInPhoto; } + void setDebugStb(u8) {} public: @@ -152,7 +153,7 @@ public: /* 0xD0 */ fpc_ProcID mPtItem; /* 0xD4 */ u8 mGetItemNo; /* 0xD5 */ u8 field_0xD5[0xD6 - 0xD5]; - /* 0xD6 */ s16 mHindFlag; + /* 0xD6 */ u16 mHindFlag; /* 0xD8 */ s16 mEventId; /* 0xDA */ u8 mEventEndSound; /* 0xDB */ u8 field_0xdb; diff --git a/include/d/d_item_data.h b/include/d/d_item_data.h index 0a477a432..67781e90c 100644 --- a/include/d/d_item_data.h +++ b/include/d/d_item_data.h @@ -278,7 +278,7 @@ struct dItem_data_item_resource { /* 0x18 */ u32 mUnused; // Always 0, doesn't seem to be read /* 0x1C */ u32 mUnknown; // Varies between items, but doesn't seem to be read. Resembles a differed dlist flag. /* 0x20 */ u16 mHeapSize; -}; +}; // Size: 0x24 STATIC_ASSERT(sizeof(dItem_data_item_resource) == 0x24); @@ -293,7 +293,7 @@ struct dItem_data_field_item_res { /* 0x10 */ s8 mTevFrm; // Unused, the equivalent in item_resource is used instead. /* 0x14 */ u32 mUnknown; /* 0x18 */ u16 mHeapSize; -}; +}; // Size: 0x1C STATIC_ASSERT(sizeof(dItem_data_field_item_res) == 0x1C); diff --git a/include/d/d_snap.h b/include/d/d_snap.h index 1f8f0835c..d14f03506 100644 --- a/include/d/d_snap.h +++ b/include/d/d_snap.h @@ -93,13 +93,13 @@ enum { /* 0x55 */ DSNAP_TYPE_KAMOME, /* 0x56 */ DSNAP_TYPE_UNK56, /* 0x57 */ DSNAP_TYPE_UNK57, - /* 0x58 */ DSNAP_TYPE_UNK58, + /* 0x58 */ DSNAP_TYPE_KM1, /* 0x59 */ DSNAP_TYPE_UNK59, /* 0x5A */ DSNAP_TYPE_UNK5A, /* 0x5B */ DSNAP_TYPE_UNK5B, /* 0x5C */ DSNAP_TYPE_UNK5C, /* 0x5D */ DSNAP_TYPE_UNK5D, - /* 0x5E */ DSNAP_TYPE_UNK5E, + /* 0x5E */ DSNAP_TYPE_NPC_PHOTO, /* 0x5F */ DSNAP_TYPE_UNK5F, /* 0x60 */ DSNAP_TYPE_UNK60, /* 0x61 */ DSNAP_TYPE_UNK61, diff --git a/include/dolphin/os/OSThread.h b/include/dolphin/os/OSThread.h index 4109ae184..3ad28fc34 100644 --- a/include/dolphin/os/OSThread.h +++ b/include/dolphin/os/OSThread.h @@ -104,8 +104,8 @@ s32 OSResumeThread(OSThread* thread); s32 OSSuspendThread(OSThread* thread); void OSSleepThread(OSThreadQueue* queue); void OSWakeupThread(OSThreadQueue* queue); -s32 OSSetThreadPriority(OSThread* thread, s32 priority); -s32 OSGetThreadPriority(OSThread* thread); +s32 OSSetThreadPriority(OSThread* thread, OSPriority priority); +OSPriority OSGetThreadPriority(OSThread* thread); static s32 CheckThreadQueue(OSThreadQueue* thread); s32 OSCheckActiveThreads(void); static void OSClearStack(u8 value); diff --git a/include/m_Do/m_Do_printf.h b/include/m_Do/m_Do_printf.h index 40587e282..8dd6ebabd 100644 --- a/include/m_Do/m_Do_printf.h +++ b/include/m_Do/m_Do_printf.h @@ -19,4 +19,6 @@ extern "C" { void OSReportInit(); +extern u32 print_errors; + #endif /* M_DO_M_DO_PRINTF_H */ diff --git a/src/JSystem/JAudio/JASCallback.cpp b/src/JSystem/JAudio/JASCallback.cpp index 6a3a3207f..fa70f4129 100644 --- a/src/JSystem/JAudio/JASCallback.cpp +++ b/src/JSystem/JAudio/JASCallback.cpp @@ -48,7 +48,9 @@ int JASystem::Kernel::registerDspCallback(s32 (*param_1)(void*), void* param_2) BOOL enable = OSDisableInterrupts(); int r30 = registerSubFrameCallback(param_1, param_2); if (r30 == -1) { +#if VERSION > VERSION_DEMO OSRestoreInterrupts(enable); +#endif return -1; }; callList[r30].field_0x8 = 1; diff --git a/src/JSystem/JFramework/JFWDisplay.cpp b/src/JSystem/JFramework/JFWDisplay.cpp index 3176465fb..b19cb1738 100644 --- a/src/JSystem/JFramework/JFWDisplay.cpp +++ b/src/JSystem/JFramework/JFWDisplay.cpp @@ -75,7 +75,7 @@ JFWDisplay::~JFWDisplay() { /* 80255354-802553EC .text createManager__10JFWDisplayFP7JKRHeapQ26JUTXfb10EXfbNumberb */ JFWDisplay* JFWDisplay::createManager(JKRHeap* p_heap, JUTXfb::EXfbNumber xfb_num, bool enableAlpha) { - JUT_CONFIRM(VERSION_SELECT(244, 244, 243, 243), sManager == NULL); + JUT_CONFIRM(VERSION_SELECT(242, 244, 243, 243), sManager == NULL); if(sManager == 0) { sManager = new JFWDisplay(0, p_heap, xfb_num, enableAlpha); } @@ -497,12 +497,12 @@ void JFWGXAbortAlarmHandler(OSAlarm*, OSContext*) { diagnoseGpHang(); if(JFWAutoAbortGfx != 1) { OSReport("自動復帰しません\n"); - JUT_WARN(VERSION_SELECT(1351, 1351, 1350, 1350), "GP FREEZE!"); - JUT_ASSERT(VERSION_SELECT(1352, 1352, 1351, 1351), 0); + JUT_WARN(VERSION_SELECT(1349, 1351, 1350, 1350), "GP FREEZE!"); + JUT_ASSERT(VERSION_SELECT(1350, 1352, 1351, 1351), 0); } else { OSReport("GXAbortFrame() を呼び出し、復帰します\n"); - JUT_WARN(VERSION_SELECT(1356, 1356, 1355, 1355), "GP FREEZE! AUTO RESUME"); + JUT_WARN(VERSION_SELECT(1354, 1356, 1355, 1355), "GP FREEZE! AUTO RESUME"); GXAbortFrame(); GXSetDrawDone(); } diff --git a/src/JSystem/JKernel/JKRAram.cpp b/src/JSystem/JKernel/JKRAram.cpp index b01aab218..8c60746d9 100644 --- a/src/JSystem/JKernel/JKRAram.cpp +++ b/src/JSystem/JKernel/JKRAram.cpp @@ -114,12 +114,19 @@ bool JKRAram::checkOkAddress(u8* addr, u32 size, JKRAramBlock* block, u32 param_ /* 802B4664-802B46C0 .text changeGroupIdIfNeed__7JKRAramFPUci */ void JKRAram::changeGroupIdIfNeed(u8* data, int groupId) { +#if VERSION > VERSION_DEMO if (groupId < 0) { return; } +#endif JKRHeap* currentHeap = JKRHeap::getCurrentHeap(); if (currentHeap->getHeapType() == 'EXPH') { JKRExpHeap::CMemBlock* block = JKRExpHeap::CMemBlock::getBlock(data); +#if VERSION == VERSION_DEMO + if (groupId < 0) { + return; + } +#endif block->newGroupId(groupId); } } @@ -286,7 +293,7 @@ u8* JKRAram::aramToMainRam(JKRAramBlock* block, u8 *buf, u32 p3, u32 p4, JKRExpa } checkOkAddress(buf, 0, block, p4); if (!block) { - OSPanic(__FILE__, VERSION_SELECT(690, 690, 683, 683), ":::Bad Aram Block specified.\n"); + OSPanic(__FILE__, VERSION_SELECT(668, 690, 683, 683), ":::Bad Aram Block specified.\n"); } if (p4 >= block->mSize) { return NULL; @@ -302,7 +309,6 @@ static void dummy() { OSReport("---------------- BAD SYNC. you'd set callback, but now call sync.\n"); } JSUList JKRAram::sAramCommandList; -static OSMutex decompMutex; u32 JKRAram::sSzpBufferSize = 0x00000400; static u8* szpBuf; static u8* szpEnd; @@ -316,10 +322,15 @@ static u32 srcAddress; static u32 fileOffset; static u32 readCount; static u32 maxDest; + +#if VERSION > VERSION_DEMO +static OSMutex decompMutex; static bool isInitMutex; +#endif /* 802B4D4C-802B4F20 .text JKRDecompressFromAramToMainRam__FUlPvUlUlUl */ static int JKRDecompressFromAramToMainRam(u32 src, void* dst, u32 srcLength, u32 dstLength, u32 offset) { +#if VERSION > VERSION_DEMO BOOL interrupts = OSDisableInterrupts(); if (isInitMutex == false) { OSInitMutex(&decompMutex); @@ -327,15 +338,16 @@ static int JKRDecompressFromAramToMainRam(u32 src, void* dst, u32 srcLength, u32 } OSRestoreInterrupts(interrupts); OSLockMutex(&decompMutex); +#endif u32 szsBufferSize = JKRAram::getSzpBufferSize(); szpBuf = (u8 *)JKRAllocFromSysHeap(szsBufferSize, 32); - JUT_ASSERT(VERSION_SELECT(1091, 1091, 1077, 1077), szpBuf != NULL); + JUT_ASSERT(VERSION_SELECT(1048, 1091, 1077, 1077), szpBuf != NULL); szpEnd = szpBuf + szsBufferSize; if (offset != 0) { refBuf = (u8 *)JKRAllocFromSysHeap(0x1120, 0); - JUT_ASSERT(VERSION_SELECT(1100, 1100, 1086, 1086), refBuf != NULL); + JUT_ASSERT(VERSION_SELECT(1057, 1100, 1086, 1086), refBuf != NULL); refEnd = refBuf + 0x1120; refCurrent = refBuf; } @@ -358,7 +370,10 @@ static int JKRDecompressFromAramToMainRam(u32 src, void* dst, u32 srcLength, u32 } DCStoreRangeNoSync(dst, decompressedSize); + +#if VERSION > VERSION_DEMO OSUnlockMutex(&decompMutex); +#endif return 0; } @@ -501,9 +516,11 @@ static u8* firstSrcData() { srcOffset += length; transLeft -= length; +#if VERSION > VERSION_DEMO if (!transLeft) { srcLimit = buffer + length; } +#endif return buffer; } @@ -523,7 +540,7 @@ static u8* nextSrcData(u8* current) { if (transSize > transLeft) { transSize = transLeft; } - JUT_ASSERT(VERSION_SELECT(1376, 1376, 1361, 1361), transSize > 0); + JUT_ASSERT(VERSION_SELECT(1321, 1376, 1361, 1361), transSize > 0); JKRAramPcs(1, (u32)(srcAddress + srcOffset), ((u32)dest + left), ALIGN_NEXT(transSize, 0x20), NULL); diff --git a/src/JSystem/JKernel/JKRAramArchive.cpp b/src/JSystem/JKernel/JKRAramArchive.cpp index 02a39153f..2f9f249fe 100644 --- a/src/JSystem/JKernel/JKRAramArchive.cpp +++ b/src/JSystem/JKernel/JKRAramArchive.cpp @@ -267,14 +267,14 @@ u32 JKRAramArchive::fetchResource_subroutine(u32 entryNum, u32 length, JKRHeap* JKRAramToMainRam(entryNum, alignHeader, sizeof(SArcHeader), EXPAND_SWITCH_UNKNOWN0, 0, NULL, -1, NULL); u32 decompressedLen = ALIGN_NEXT(JKRDecompExpandSize(alignHeader), sizeof(SArcHeader)); buffer = (u8*)(JKRAllocFromHeap(pHeap, decompressedLen, sizeof(SArcHeader))); - JUT_ASSERT(VERSION_SELECT(709, 709, 688, 688), buffer); + JUT_ASSERT(VERSION_SELECT(702, 709, 688, 688), buffer); u32 readLen; JKRAramToMainRam(entryNum, buffer, alignedLen, EXPAND_SWITCH_UNKNOWN1, decompressedLen, pHeap, -1, &readLen); *out = buffer; return readLen; } default: - OSPanic(__FILE__, VERSION_SELECT(719, 719, 698, 698), ":::??? bad sequence\n"); + OSPanic(__FILE__, VERSION_SELECT(712, 719, 698, 698), ":::??? bad sequence\n"); return 0; } } diff --git a/src/JSystem/JKernel/JKRCompArchive.cpp b/src/JSystem/JKernel/JKRCompArchive.cpp index f2ab63283..e6842c3a6 100644 --- a/src/JSystem/JKernel/JKRCompArchive.cpp +++ b/src/JSystem/JKernel/JKRCompArchive.cpp @@ -379,9 +379,11 @@ u32 JKRCompArchive::getExpandedResSize(const void* resource) const { JKRAramToMainRam(addr, bufPtr, sizeof(buf) / 2, EXPAND_SWITCH_UNKNOWN0, 0, NULL, -1, NULL); } 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); +#if VERSION > VERSION_DEMO DCInvalidateRange(bufPtr, sizeof(buf) / 2); +#endif } else { - OSPanic(__FILE__, VERSION_SELECT(948, 948, 944, 944), "illegal resource."); + OSPanic(__FILE__, VERSION_SELECT(940, 948, 944, 944), "illegal resource."); } u32 expandSize = JKRDecompExpandSize(bufPtr); const_cast(this)->setExpandSize(fileEntry, expandSize); diff --git a/src/JSystem/JKernel/JKRDvdAramRipper.cpp b/src/JSystem/JKernel/JKRDvdAramRipper.cpp index 39d257ed6..c83ce7a73 100644 --- a/src/JSystem/JKernel/JKRDvdAramRipper.cpp +++ b/src/JSystem/JKernel/JKRDvdAramRipper.cpp @@ -112,7 +112,9 @@ JKRADCommand* JKRDvdAramRipper::callCommand_Async(JKRADCommand* command) { VIWaitForRetrace(); } +#if VERSION > VERSION_DEMO DCInvalidateRange(bufPtr, 0x20); +#endif compression = JKRCheckCompressed(bufPtr); u32 expandSize = JKRDecompExpandSize(bufPtr); @@ -207,7 +209,9 @@ bool JKRDvdAramRipper::syncAram(JKRADCommand* command, int param_1) { /* 802BE078-802BE0B8 .text __ct__12JKRADCommandFv */ JKRADCommand::JKRADCommand() : mLink(this) { +#if VERSION > VERSION_DEMO field_0x44 = 0; +#endif field_0x48 = false; } @@ -218,7 +222,6 @@ JKRADCommand::~JKRADCommand() { } } -static OSMutex decompMutex; u32 JKRDvdAramRipper::sSzpBufferSize = 0x00000400; static u8* szpBuf; static u8* szpEnd; @@ -235,28 +238,34 @@ static JKRDvdFile* srcFile; static u32 fileOffset; static int readCount; static u32 maxDest; + +#if VERSION > VERSION_DEMO +static OSMutex decompMutex; static bool isInitMutex; +#endif /* 802BE144-802BE34C .text JKRDecompressFromDVDToAram__FP10JKRDvdFileUlUlUlUlUl */ static int JKRDecompressFromDVDToAram(JKRDvdFile* dvdFile, u32 param_1, u32 fileSize, u32 uncompressedSize, u32 param_4, u32 param_5) { +#if VERSION > VERSION_DEMO BOOL level = OSDisableInterrupts(); if (!isInitMutex) { OSInitMutex(&decompMutex); isInitMutex = true; } - OSRestoreInterrupts(level); OSLockMutex(&decompMutex); +#endif + u32 bufferSize = JKRDvdAramRipper::getSzpBufferSize(); szpBuf = (u8*)JKRAllocFromSysHeap(bufferSize, 0x20); - JUT_ASSERT(VERSION_SELECT(703, 703, 693, 693), szpBuf != NULL); + JUT_ASSERT(VERSION_SELECT(678, 703, 693, 693), szpBuf != NULL); szpEnd = szpBuf + bufferSize; refBuf = (u8*)JKRAllocFromSysHeap(0x1120, 0); - JUT_ASSERT(VERSION_SELECT(711, 711, 701, 701), refBuf != NULL); + JUT_ASSERT(VERSION_SELECT(686, 711, 701, 701), refBuf != NULL); refEnd = refBuf + 0x1120; refCurrent = refBuf; dmaBuf = (u8*)JKRAllocFromSysHeap(0x100, 0x20); - JUT_ASSERT(VERSION_SELECT(720, 720, 710, 710), dmaBuf != NULL); + JUT_ASSERT(VERSION_SELECT(695, 720, 710, 710), dmaBuf != NULL); dmaEnd = dmaBuf + 0x100; dmaCurrent = dmaBuf; srcFile = dvdFile; @@ -270,7 +279,11 @@ static int JKRDecompressFromDVDToAram(JKRDvdFile* dvdFile, u32 param_1, u32 file JKRHeap::free(szpBuf, 0); JKRHeap::free(refBuf, 0); JKRHeap::free(dmaBuf, 0); + +#if VERSION > VERSION_DEMO OSUnlockMutex(&decompMutex); +#endif + return result; } @@ -398,7 +411,7 @@ static u8* nextSrcData(u8* src) { if (transSize > transLeft) { transSize = transLeft; } - JUT_ASSERT(VERSION_SELECT(979, 979, 966, 966), transSize > 0); + JUT_ASSERT(VERSION_SELECT(950, 979, 966, 966), transSize > 0); while (true) { s32 result = DVDReadPrio(&srcFile->mFileInfo, dest + size, transSize, srcOffset, 2); if (result >= 0) { diff --git a/src/JSystem/JKernel/JKRDvdArchive.cpp b/src/JSystem/JKernel/JKRDvdArchive.cpp index 3d7d11773..261ac7099 100644 --- a/src/JSystem/JKernel/JKRDvdArchive.cpp +++ b/src/JSystem/JKernel/JKRDvdArchive.cpp @@ -239,7 +239,9 @@ u32 JKRDvdArchive::fetchResource_subroutine(s32 entryNum, u32 offset, u32 size, u8* arcHeader = (u8*)ALIGN_NEXT((u32)arcHeaderBuffer, 0x20); JKRDvdToMainRam(entryNum, arcHeader, EXPAND_SWITCH_UNKNOWN2, sizeof(SArcHeader), NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, offset, NULL); +#if VERSION > VERSION_DEMO DCInvalidateRange(arcHeader, sizeof(SArcHeader)); +#endif u32 decompressedSize = JKRDecompExpandSize(arcHeader); u32 alignedDecompressedSize = ALIGN_NEXT(decompressedSize, 0x20); @@ -264,12 +266,12 @@ u32 JKRDvdArchive::fetchResource_subroutine(s32 entryNum, u32 offset, u32 size, } case COMPRESSION_YAY0: { - OSPanic(__FILE__, VERSION_SELECT(610, 610, 603, 603), "Sorry, not prepared for SZP archive.\n"); + OSPanic(__FILE__, VERSION_SELECT(599, 610, 603, 603), "Sorry, not prepared for SZP archive.\n"); return 0; } default: { - OSPanic(__FILE__, VERSION_SELECT(616, 616, 609, 609), ":::??? bad sequence\n"); + OSPanic(__FILE__, VERSION_SELECT(605, 616, 609, 609), ":::??? bad sequence\n"); return 0; } } @@ -285,7 +287,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(s32 entryNum, u32 offset, u32 size, switch (fileCompression) { case COMPRESSION_NONE: buffer = (u8*)JKRAllocFromHeap(heap, alignedSize, sizeof(SArcHeader)); - JUT_ASSERT(VERSION_SELECT(638, 638, 631, 631), buffer != NULL); + JUT_ASSERT(VERSION_SELECT(627, 638, 631, 631), buffer != NULL); JKRDvdToMainRam(entryNum, buffer, EXPAND_SWITCH_UNKNOWN0, alignedSize, NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, offset, NULL); @@ -300,11 +302,13 @@ u32 JKRDvdArchive::fetchResource_subroutine(s32 entryNum, u32 offset, u32 size, u8* arcHeader = (u8*)ALIGN_NEXT((u32)arcHeaderBuffer, 0x20); JKRDvdToMainRam(entryNum, arcHeader, EXPAND_SWITCH_UNKNOWN2, sizeof(SArcHeader), NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, offset, NULL); +#if VERSION > VERSION_DEMO DCInvalidateRange(arcHeader, sizeof(SArcHeader)); +#endif alignedSize = JKRDecompExpandSize(arcHeader); buffer = (u8*)JKRAllocFromHeap(heap, alignedSize, sizeof(SArcHeader)); - JUT_ASSERT(VERSION_SELECT(674, 674, 660, 660), buffer); + JUT_ASSERT(VERSION_SELECT(652, 674, 660, 660), buffer); JKRDvdToMainRam(entryNum, buffer, EXPAND_SWITCH_UNKNOWN1, alignedSize, NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, offset, NULL); @@ -315,7 +319,7 @@ u32 JKRDvdArchive::fetchResource_subroutine(s32 entryNum, u32 offset, u32 size, case COMPRESSION_YAZ0: { buffer = (u8*)JKRAllocFromHeap(heap, alignedSize, sizeof(SArcHeader)); - JUT_ASSERT(VERSION_SELECT(686, 686, 672, 672), buffer); + JUT_ASSERT(VERSION_SELECT(664, 686, 672, 672), buffer); JKRDvdToMainRam(entryNum, buffer, EXPAND_SWITCH_UNKNOWN1, size, NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, offset, NULL); @@ -325,12 +329,12 @@ u32 JKRDvdArchive::fetchResource_subroutine(s32 entryNum, u32 offset, u32 size, } case COMPRESSION_YAY0: { - OSPanic(__FILE__, VERSION_SELECT(697, 697, 683, 683), "Sorry, not prepared for SZP archive.\n"); + OSPanic(__FILE__, VERSION_SELECT(675, 697, 683, 683), "Sorry, not prepared for SZP archive.\n"); return 0; } default: { - OSPanic(__FILE__, VERSION_SELECT(702, 702, 688, 688), ":::??? bad sequence\n"); + OSPanic(__FILE__, VERSION_SELECT(680, 702, 688, 688), ":::??? bad sequence\n"); return 0; } } @@ -364,7 +368,9 @@ u32 JKRDvdArchive::getExpandedResSize(const void* resource) const { JKRDvdToMainRam(mEntryNum, arcHeader, EXPAND_SWITCH_UNKNOWN2, sizeof(SArcHeader), NULL, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, this->mDataOffset + fileEntry->data_offset, NULL); +#if VERSION > VERSION_DEMO DCInvalidateRange(arcHeader, sizeof(SArcHeader)); +#endif resourceSize = JKRDecompExpandSize(arcHeader); // ??? diff --git a/src/JSystem/JKernel/JKRDvdFile.cpp b/src/JSystem/JKernel/JKRDvdFile.cpp index e37eb6532..4935763c1 100644 --- a/src/JSystem/JKernel/JKRDvdFile.cpp +++ b/src/JSystem/JKernel/JKRDvdFile.cpp @@ -124,7 +124,7 @@ s32 JKRDvdFile::readData(void* param_1, s32 length, s32 param_3) { /* 802BCBCC-802BCC24 .text writeData__10JKRDvdFileFPCvll */ s32 JKRDvdFile::writeData(const void* param_0, s32 length, s32 param_2) { /* clang-format off */ - JUT_ASSERT(340, ( length & 0x1f ) == 0); + JUT_ASSERT(VERSION_SELECT(364, 340, 340, 340), ( length & 0x1f ) == 0); /* clang-format on */ return -1; diff --git a/src/JSystem/JKernel/JKRDvdRipper.cpp b/src/JSystem/JKernel/JKRDvdRipper.cpp index aa1eb1ad6..4d3a52dd1 100644 --- a/src/JSystem/JKernel/JKRDvdRipper.cpp +++ b/src/JSystem/JKernel/JKRDvdRipper.cpp @@ -61,7 +61,9 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch VIWaitForRetrace(); } +#if VERSION > VERSION_DEMO DCInvalidateRange(bufPtr, 0x20); +#endif compression = JKRCheckCompressed(bufPtr); expandSize = JKRDecompExpandSize(bufPtr); @@ -120,7 +122,9 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch } VIWaitForRetrace(); } +#if VERSION > VERSION_DEMO DCInvalidateRange(bufPtr, 32); +#endif compression2 = JKRCheckCompressed(bufPtr); } @@ -148,7 +152,7 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch else if (compression2 == COMPRESSION_YAZ0) { JKRDecompressFromDVD(dvdFile, dst, fileSizeAligned, dstLength, 0, offset); } else { - OSPanic(__FILE__, VERSION_SELECT(337, 337, 314, 314), "Sorry, not prepared for SZP resource\n"); + OSPanic(__FILE__, VERSION_SELECT(315, 337, 314, 314), "Sorry, not prepared for SZP resource\n"); } return dst; } @@ -157,7 +161,7 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch // SZP decompression // s32 readoffset = startOffset; if (offset != 0) { - OSPanic(__FILE__, VERSION_SELECT(347, 347, 324, 324), ":::Not support SZP with offset read"); + OSPanic(__FILE__, VERSION_SELECT(325, 347, 324, 324), ":::Not support SZP with offset read"); } while (true) { int readBytes = DVDReadPrio(dvdFile->getFileInfo(), mem, fileSizeAligned, 0, 2); @@ -194,7 +198,6 @@ void* JKRDvdRipper::loadToMainRAM(JKRDvdFile* dvdFile, u8* dst, JKRExpandSwitch } JSUList JKRDvdRipper::sDvdAsyncList; -static OSMutex decompMutex; u32 JKRDvdRipper::sSzpBufferSize = 0x00000400; static u8* szpBuf; static u8* szpEnd; @@ -208,10 +211,15 @@ static JKRDvdFile* srcFile; static u32 fileOffset; static u32 readCount; static u32 maxDest; + +#if VERSION > VERSION_DEMO +static OSMutex decompMutex; static bool isInitMutex; +#endif /* 802BD324-802BD4F0 .text JKRDecompressFromDVD__FP10JKRDvdFilePvUlUlUlUl */ static int JKRDecompressFromDVD(JKRDvdFile* dvdFile, void* dst, u32 fileSize, u32 inMaxDest, u32 inFileOffset, u32 inSrcOffset) { +#if VERSION > VERSION_DEMO BOOL interrupts = OSDisableInterrupts(); if (isInitMutex == false) { OSInitMutex(&decompMutex); @@ -219,14 +227,16 @@ static int JKRDecompressFromDVD(JKRDvdFile* dvdFile, void* dst, u32 fileSize, u3 } OSRestoreInterrupts(interrupts); OSLockMutex(&decompMutex); +#endif + int bufSize = JKRDvdRipper::getSzpBufferSize(); szpBuf = (u8 *)JKRAllocFromSysHeap(bufSize, -0x20); - JUT_ASSERT(VERSION_SELECT(913, 913, 884, 884), szpBuf != NULL); + JUT_ASSERT(VERSION_SELECT(876, 913, 884, 884), szpBuf != NULL); szpEnd = szpBuf + bufSize; if (inFileOffset != 0) { refBuf = (u8 *)JKRAllocFromSysHeap(0x1120, -4); - JUT_ASSERT(VERSION_SELECT(922, 922, 893, 893), refBuf != NULL); + JUT_ASSERT(VERSION_SELECT(885, 922, 893, 893), refBuf != NULL); refEnd = refBuf + 0x1120; refCurrent = refBuf; } else { @@ -246,7 +256,11 @@ static int JKRDecompressFromDVD(JKRDvdFile* dvdFile, void* dst, u32 fileSize, u3 JKRFree(refBuf); } DCStoreRangeNoSync(dst, decompressedSize); + +#if VERSION > VERSION_DEMO OSUnlockMutex(&decompMutex); +#endif + return result; } @@ -407,7 +421,7 @@ static u8* nextSrcData(u8* src) { if (transSize > transLeft) { transSize = transLeft; } - JUT_ASSERT(VERSION_SELECT(1228, 1228, 1176, 1176), transSize > 0); + JUT_ASSERT(VERSION_SELECT(1186, 1228, 1176, 1176), transSize > 0); while (true) { s32 result = DVDReadPrio(srcFile->getFileInfo(), (buf + limit), transSize, srcOffset, 2); diff --git a/src/JSystem/JKernel/JKRExpHeap.cpp b/src/JSystem/JKernel/JKRExpHeap.cpp index 29467c419..a1eb5c7cc 100644 --- a/src/JSystem/JKernel/JKRExpHeap.cpp +++ b/src/JSystem/JKernel/JKRExpHeap.cpp @@ -361,7 +361,7 @@ void JKRExpHeap::do_free(void* ptr) { block->free(this); } } else { - JUT_WARN(888, "free: memblock %x not in heap %x", ptr, this); + JUT_WARN(VERSION_SELECT(885, 888, 888, 888), "free: memblock %x not in heap %x", ptr, this); } unlock(); } @@ -548,7 +548,7 @@ static void dummy1() { /* 802B24EC-802B2584 .text appendUsedList__10JKRExpHeapFPQ210JKRExpHeap9CMemBlock */ void JKRExpHeap::appendUsedList(CMemBlock* newblock) { if (!newblock) { - OSPanic(__FILE__, 1466, ":::ERROR! appendUsedList\n"); + OSPanic(__FILE__, VERSION_SELECT(1458, 1466, 1466, 1466), ":::ERROR! appendUsedList\n"); } CMemBlock* block = mTailUsedList; @@ -691,7 +691,7 @@ void JKRExpHeap::joinTwoBlocks(CMemBlock* block) { OSReport(":::: endAddr = %x\n", endAddr); OSReport(":::: nextAddr = %x\n", nextAddr); JKRGetCurrentHeap()->dump(); - OSPanic(__FILE__, 1718, ":::: Bad Block\n"); + OSPanic(__FILE__, VERSION_SELECT(1710, 1718, 1718, 1718), ":::: Bad Block\n"); } if (endAddr == nextAddr) { @@ -769,8 +769,10 @@ bool JKRExpHeap::check() { return ok; } +#if VERSION > VERSION_DEMO /* 802B2B44-802B2B48 .text do_freeFill__10JKRExpHeapFv */ void JKRExpHeap::do_freeFill() {} +#endif /* 802B2B48-802B2D5C .text dump__10JKRExpHeapFv */ bool JKRExpHeap::dump() { @@ -820,8 +822,69 @@ bool JKRExpHeap::dump() { return result; } +#if VERSION == VERSION_DEMO +bool JKRExpHeap::dump_sort() { + lock(); + bool result = check(); + u32 usedBytes = 0; + u32 usedCount = 0; + u32 freeCount = 0; + + JUTReportConsole(" attr address: size gid aln prev_ptr next_ptr\n"); + JUTReportConsole("(Used Blocks)\n"); + if (!mHeadUsedList) { + JUTReportConsole(" NONE\n"); + } else { + CMemBlock* block; + for (CMemBlock* nextBlock = NULL; ; nextBlock = block) { + block = (CMemBlock*)0xffffffff; + + for (CMemBlock* iterBlock = mHeadUsedList; iterBlock; iterBlock = iterBlock->getNextBlock()) { + if (nextBlock < iterBlock && iterBlock < block) { + block = iterBlock; + } + } + + if (block == (CMemBlock*)0xffffffff) { + break; + } + + if (!block->isValid()) { + JUTReportConsole_f("xxxxx %08x: -------- --- --- (-------- --------)\nabort\n", nextBlock); + break; + } + + JUTReportConsole_f("%s %08x: %08x %3d %3d (%08x %08x)\n", + block->_isTempMemBlock() ? " temp" : "alloc", block->getContent(), + block->size, block->mGroupId, block->getAlignment(), block->mPrev, + block->mNext); + usedBytes += sizeof(CMemBlock) + block->size + block->getAlignment(); + usedCount++; + } + } + + JUTReportConsole("(Free Blocks)\n"); + if (!mHeadFreeList) { + JUTReportConsole(" NONE\n"); + } + + for (CMemBlock* block = mHeadFreeList; block; block = block->mNext) { + JUTReportConsole_f("%s %08x: %08x %3d %3d (%08x %08x)\n", " free", block->getContent(), + block->size, block->mGroupId, block->getAlignment(), block->mPrev, + block->mNext); + freeCount++; + } + + float percent = ((float)usedBytes / (float)mSize) * 100.0f; + JUTReportConsole_f("%d / %d bytes (%6.2f%%) used (U:%d F:%d)\n", usedBytes, mSize, percent, + usedCount, freeCount); + unlock(); + return result; +} +#else /* 802B2D5C-802B2F5C .text dump_sort_by_address__10JKRExpHeapFv */ -bool JKRExpHeap::dump_sort_by_address() { +bool JKRExpHeap::dump_sort_by_address() +{ lock(); bool result = check(); u32 usedBytes = 0; @@ -878,6 +941,7 @@ bool JKRExpHeap::dump_sort_by_address() { bool JKRExpHeap::dump_sort() { return dump_sort_by_address(); } +#endif /* 802B2F7C-802B2F9C .text initiate__Q210JKRExpHeap9CMemBlockFPQ210JKRExpHeap9CMemBlockPQ210JKRExpHeap9CMemBlockUlUcUc */ void JKRExpHeap::CMemBlock::initiate(CMemBlock* prev, CMemBlock* next, u32 size, u8 groupId, u8 alignment) { @@ -955,8 +1019,8 @@ static void dummy2() { /* 802B30A4-802B31D4 .text state_register__10JKRExpHeapCFPQ27JKRHeap6TStateUl */ void JKRExpHeap::state_register(TState* p, u32 param_1) const { - JUT_ASSERT(VERSION_SELECT(2420, 2420, 2423, 2423), p != NULL); - JUT_ASSERT(VERSION_SELECT(2421, 2421, 2424, 2424), p->getHeap() == this); + JUT_ASSERT(VERSION_SELECT(2271, 2420, 2423, 2423), p != NULL); + JUT_ASSERT(VERSION_SELECT(2272, 2421, 2424, 2424), p->getHeap() == this); p->mId = param_1; if (param_1 <= 0xff) { p->mUsedSize = getUsedSize(param_1); @@ -981,7 +1045,7 @@ void JKRExpHeap::state_register(TState* p, u32 param_1) const { /* 802B31D4-802B327C .text state_compare__10JKRExpHeapCFRCQ27JKRHeap6TStateRCQ27JKRHeap6TState */ bool JKRExpHeap::state_compare(const JKRHeap::TState& r1, const JKRHeap::TState& r2) const { - JUT_ASSERT(VERSION_SELECT(2468, 2468, 2471, 2471), r1.getHeap() == r2.getHeap()); + JUT_ASSERT(VERSION_SELECT(2319, 2468, 2471, 2471), r1.getHeap() == r2.getHeap()); bool result = true; if (r1.mCheckCode != r2.mCheckCode) { result = false; diff --git a/src/JSystem/JKernel/JKRHeap.cpp b/src/JSystem/JKernel/JKRHeap.cpp index 4a6647efd..778e09421 100644 --- a/src/JSystem/JKernel/JKRHeap.cpp +++ b/src/JSystem/JKernel/JKRHeap.cpp @@ -240,8 +240,11 @@ u8 JKRHeap::getCurrentGroupId() { return do_getCurrentGroupId(); } -static void dummy2() { - OSReport("change heap ID into %x in heap %x"); +s32 JKRHeap::changeGroupID(u8 groupID) { + if (mInitFlag) { + JUT_WARN(545, "change heap ID into %x in heap %x", groupID, this); + } + return do_changeGroupID(groupID); } /* 802B0918-802B0978 .text getMaxAllocatableSize__7JKRHeapFi */ @@ -262,7 +265,12 @@ JKRHeap* JKRHeap::findFromRoot(void* ptr) { /* 802B09B0-802B0A58 .text find__7JKRHeapCFPv */ JKRHeap* JKRHeap::find(void* memory) const { - if (mStart <= memory && memory < mEnd) { +#if VERSION == VERSION_DEMO + if (mStart <= memory && memory <= mEnd) +#else + if (mStart <= memory && memory < mEnd) +#endif + { if (mChildTree.getNumChildren() != 0) { for (JSUTreeIterator iterator(mChildTree.getFirstChild()); iterator != mChildTree.getEndChild(); ++iterator) @@ -366,6 +374,28 @@ JKRErrorHandler JKRHeap::setErrorHandler(JKRErrorHandler errorHandler) { return prev; } +bool JKRHeap::isSubHeap(JKRHeap* heap) const { + if (!heap) + return false; + + if (mChildTree.getNumChildren() != 0) { + JSUTreeIterator iterator; + for (iterator = mChildTree.getFirstChild(); iterator != mChildTree.getEndChild(); + ++iterator) + { + if (iterator.getObject() == heap) { + return true; + } + + if (iterator.getObject()->isSubHeap(heap)) { + return true; + } + } + } + + return false; +} + /* 802B0C38-802B0C60 .text __nw__FUl */ void* operator new(size_t size) { return JKRHeap::alloc(size, 4, NULL); @@ -454,7 +484,7 @@ u8 JKRHeap::do_getCurrentGroupId() { return 0; } -#if VERSION <= VERSION_JPN +#if VERSION == VERSION_JPN static void dummy5() { OSReport("\x1B[41;37m:::addr %08x size %08x: Freeされた領域が浸食されている (%08x=%02x)\n\x1B[m"); } diff --git a/src/JSystem/JKernel/JKRSolidHeap.cpp b/src/JSystem/JKernel/JKRSolidHeap.cpp index 99eb967e1..e4365ef5e 100644 --- a/src/JSystem/JKernel/JKRSolidHeap.cpp +++ b/src/JSystem/JKernel/JKRSolidHeap.cpp @@ -212,8 +212,10 @@ bool JKRSolidHeap::check() { return result; } +#if VERSION > VERSION_DEMO /* 802B3964-802B3968 .text do_freeFill__12JKRSolidHeapFv */ void JKRSolidHeap::do_freeFill() {} +#endif /* 802B3968-802B3A68 .text dump__12JKRSolidHeapFv */ bool JKRSolidHeap::dump() { @@ -236,8 +238,8 @@ bool JKRSolidHeap::dump() { /* 802B3A68-802B3B4C .text state_register__12JKRSolidHeapCFPQ27JKRHeap6TStateUl */ void JKRSolidHeap::state_register(JKRHeap::TState* p, u32 id) const { - JUT_ASSERT(VERSION_SELECT(610, 610, 607, 607), p != NULL); - JUT_ASSERT(VERSION_SELECT(611, 611, 608, 608), p->getHeap() == this); + JUT_ASSERT(VERSION_SELECT(586, 610, 607, 607), p != NULL); + JUT_ASSERT(VERSION_SELECT(587, 611, 608, 608), p->getHeap() == this); getState_(p); setState_u32ID_(p, id); @@ -249,7 +251,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 { - JUT_ASSERT(VERSION_SELECT(638, 638, 635, 635), r1.getHeap() == r2.getHeap()); + JUT_ASSERT(VERSION_SELECT(614, 638, 635, 635), r1.getHeap() == r2.getHeap()); bool result = true; if (r1.getCheckCode() != r2.getCheckCode()) { diff --git a/src/JSystem/JKernel/JKRStdHeap.cpp b/src/JSystem/JKernel/JKRStdHeap.cpp index 89f2f8586..8b03c44b8 100644 --- a/src/JSystem/JKernel/JKRStdHeap.cpp +++ b/src/JSystem/JKernel/JKRStdHeap.cpp @@ -143,5 +143,7 @@ bool JKRStdHeap::state_compare(const JKRHeap::TState& r1, const JKRHeap::TState& return result; } +#if VERSION > VERSION_DEMO /* 802B1490-802B1494 .text do_freeFill__10JKRStdHeapFv */ void JKRStdHeap::do_freeFill() {} +#endif diff --git a/src/JSystem/JKernel/JKRThread.cpp b/src/JSystem/JKernel/JKRThread.cpp index 9b7d1dc07..0bc844b35 100644 --- a/src/JSystem/JKernel/JKRThread.cpp +++ b/src/JSystem/JKernel/JKRThread.cpp @@ -5,6 +5,7 @@ #include "JSystem/JKernel/JKRThread.h" #include "JSystem/JUtility/JUTAssert.h" +#include "JSystem/JUtility/JUTConsole.h" #include "dolphin/types.h" JSUList JKRThread::sThreadList; @@ -122,7 +123,29 @@ void JKRThreadSwitch::callback(OSThread* current, OSThread* next) { if (thread->getThreadRecord() == next) { if (sManager->mSetNextHeap) { - thread->getCurrentHeap()->becomeCurrentHeap(); + JKRHeap* next_heap = thread->getCurrentHeap(); +#if VERSION == VERSION_DEMO + if (!next_heap) { + next_heap = JKRHeap::getCurrentHeap(); + } else if (!JKRHeap::getRootHeap()->isSubHeap(next_heap)) { + switch (thread->getCurrentHeapError()) { + case 0: + JUT_ASSERT(272, FALSE &&"JKRThreadSwitch: currentHeap destroyed."); + break; + case 1: + JUTWarningConsole("JKRThreadSwitch: currentHeap destroyed.\n"); + next_heap = JKRHeap::getCurrentHeap(); + break; + case 2: + next_heap = JKRHeap::getCurrentHeap(); + break; + case 3: + next_heap = JKRHeap::getSystemHeap(); + break; + } + } +#endif + next_heap->becomeCurrentHeap(); } } } diff --git a/src/JSystem/JMessage/processor.cpp b/src/JSystem/JMessage/processor.cpp index 5f30258af..5655ca53c 100644 --- a/src/JSystem/JMessage/processor.cpp +++ b/src/JSystem/JMessage/processor.cpp @@ -142,8 +142,10 @@ void TProcessor::on_tag_() { size = current[1]; setCurrent_((const char*)current + size); - u32 tag = (current[2] << 16 | (u8)current[3] << 8); - tag |= current[4]; + u32 tag = 0; + tag |= 0xFF0000 & (current[2] << 16); + tag |= 0x00FF00 & (current[3] << 8); + tag |= 0x0000FF & (current[4] << 0); on_tag(tag, ¤t[5], size - 5); } diff --git a/src/JSystem/JMessage/resource.cpp b/src/JSystem/JMessage/resource.cpp index 17f892a4a..1428abb0b 100644 --- a/src/JSystem/JMessage/resource.cpp +++ b/src/JSystem/JMessage/resource.cpp @@ -60,7 +60,7 @@ namespace JMessage { void JMessage::TResourceContainer::SetEncoding_(u8 param_1) { mEncoding = param_1; u32 r4 = param_1; - mIsLeadByteFunc = 0; + mIsLeadByteFunc = NULL; if (r4 >= 4) { return; } diff --git a/src/JSystem/JStudio/JStudio_JAudio/object-sound.cpp b/src/JSystem/JStudio/JStudio_JAudio/object-sound.cpp index e69f30718..416b75627 100644 --- a/src/JSystem/JStudio/JStudio_JAudio/object-sound.cpp +++ b/src/JSystem/JStudio/JStudio_JAudio/object-sound.cpp @@ -111,13 +111,16 @@ void TAdaptor_sound::TVVOOn_BEGIN_FADE_IN_::operator()(f32 value, JStudio::TAdap JStudio_JAudio::TAdaptor_sound* adaptor_sound = (JStudio_JAudio::TAdaptor_sound*)adaptor; JAISound* sound = adaptor_sound->mpSound; u32 flags = adaptor_sound->mFlags; - if (flags & 0xc0000000) { + if (adaptor_sound->mFlags & 0xc0000000) { if (adaptor_sound->mpSound) { adaptor_sound->mpSound->start(value); } } else { if (adaptor_sound->mpSound) { - if (!adaptor_sound->mpBasic->checkEnablePrepare(adaptor_sound->mFlags)) { +#if VERSION > VERSION_DEMO + if (!adaptor_sound->mpBasic->checkEnablePrepare(adaptor_sound->mFlags)) +#endif + { adaptor_sound->mpSound->stop(0); } } diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h index 945748b13..828a326f5 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h @@ -7,6 +7,9 @@ extern "C" { #endif +static int is_utf8_complete(const char* s, size_t n); +int utf8_to_unicode(wchar_t* pwc, const char* s, size_t n); +int mbtowc(wchar_t* pwc, const char* s, size_t n); size_t wcstombs(char* dst, const wchar_t* src, size_t n); #ifdef __cplusplus diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c index 4ae0f7c1a..a3c2db4fa 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c @@ -1,5 +1,10 @@ #include "float.h" -unsigned long __float_nan[] = {0x7FFFFFFF}; - -unsigned long __float_huge[] = {0x7F800000}; +unsigned long __float_nan[] = { 0x7FFFFFFF }; +unsigned long __float_huge[] = { 0x7F800000 }; +#if VERSION == VERSION_DEMO +unsigned long __double_max[] = { 0x7FEFFFFF, 0xFFFFFFFF }; +unsigned long __double_huge[] = { 0x7FF00000, 0 }; +unsigned long __extended_min[] = { 0x00100000, 0 }; +unsigned long __extended_max[] = { 0x7FEFFFFF, 0xFFFFFFFF }; +#endif diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c index 4b7d2b965..22339cc53 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c @@ -1,6 +1,51 @@ #include "mbstring.h" #include "string.h" +static int is_utf8_complete(const char* s, size_t n) +{ + if (n == 0) { // must have more than zero characters + return -1; + } + + if (s[0] == 0x00) { // first char is 0 + return 0; + } + + if ((s[0] & 0x80) == 0x00) { + return (1); + } else if ((s[0] & 0xe0) == 0xc0) { + if (n >= 2) { + if ((*(s + 1) & 0x80) == 0x80) { + return 2; + } + return -1; + } + return -2; + } else if ((s[0] & 0xf0) == 0xe0) { + if (n >= 3) { + if ((s[1] & 0x80) == 0x80) { + if ((s[2] & 0x80) == 0x80) { + return 3; + } + } + return -1; + } else if ((n == 2 && ((s[1] & 0x80) == 0x80)) || n == 1) { + return -2; + } + return -1; + } else { + return (-1); + } +} + +int utf8_to_unicode(wchar_t* pwc, const char* s, size_t n) { + /* Nonmatching */ +} + +int mbtowc(wchar_t* pwc, const char* s, size_t n) { + return utf8_to_unicode(pwc, s, n); +} + static int unicode_to_UTF8(char* s, wchar_t wchar) { int number_of_bytes; wchar_t wide_char; diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c new file mode 100644 index 000000000..8455e6abc --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_pow.c @@ -0,0 +1,408 @@ +//======================================================================== +// +// e_pow.c +// +// Part of the standard mathematical function library +// +//======================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license/ +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: +// Date: 2001-07-20 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +// CONFIGURATION + +/* @(#)e_pow.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_pow(x,y) return x**y + * + * n + * Method: Let x = 2 * (1+f) + * 1. Compute and return log2(x) in two pieces: + * log2(x) = w1 + w2, + * where w1 has 53-24 = 29 bit trailing zeros. + * 2. Perform y*log2(x) = n+y' by simulating muti-precision + * arithmetic, where |y'|<=0.5. + * 3. Return x**y = 2**n*exp(y'*log2) + * + * Special cases: + * 1. (anything) ** 0 is 1 + * 2. (anything) ** 1 is itself + * 3. (anything) ** NAN is NAN + * 4. NAN ** (anything except 0) is NAN + * 5. +-(|x| > 1) ** +INF is +INF + * 6. +-(|x| > 1) ** -INF is +0 + * 7. +-(|x| < 1) ** +INF is +0 + * 8. +-(|x| < 1) ** -INF is +INF + * 9. +-1 ** +-INF is NAN + * 10. +0 ** (+anything except 0, NAN) is +0 + * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 + * 12. +0 ** (-anything except 0, NAN) is +INF + * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF + * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) + * 15. +INF ** (+anything except 0,NAN) is +INF + * 16. +INF ** (-anything except 0,NAN) is +0 + * 17. -INF ** (anything) = -0 ** (-anything) + * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) + * 19. (-anything except 0 and inf) ** (non-integer) is NAN + * + * Accuracy: + * pow(x,y) returns x**y nearly rounded. In particular + * pow(integer,integer) + * always returns the correct integer provided it is + * representable. + * + * Constants : + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "fdlibm.h" +#include "errno.h" +#include "dolphin/types.h" +#include "math.h" + +#ifndef _DOUBLE_IS_32BITS + +#ifdef __STDC__ +static const double +#else +static double +#endif +bp[] = {1.0, 1.5,}, +dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ +dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ +zero = 0.0, +one = 1.0, +two = 2.0, +two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ +huge = 1.0e300, +tiny = 1.0e-300, + /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ +L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ +L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ +L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ +L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ +L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ +L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ +P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ +P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ +P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ +P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ +P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ +lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ +lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ +lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ +ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ +cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ +cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ +cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/ +ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ +ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ +ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ + +#ifdef __STDC__ +double __ieee754_pow(double x, double y) +#else +double __ieee754_pow(x, y) double x, y; +#endif +{ + double z, ax, z_h, z_l, p_h, p_l; + double y1, t1, t2, r, s, t, u, v, w; + double qqq; // necessary temp + int i0, i1, i, j, k, yisint, n; + int hx, hy, ix, iy; + u32 lx, ly; + + i0 = ((*(int*)&one) >> 29) ^ 1; + i1 = 1 - i0; + hx = __HI(x); + lx = __LO(x); + hy = __HI(y); + ly = __LO(y); + ix = hx & 0x7fffffff; + iy = hy & 0x7fffffff; + + /* y==zero: x**0 = 1 */ + if ((iy | ly) == 0) + return one; + + /* +-NaN return x+y */ + if (ix > 0x7ff00000 || ((ix == 0x7ff00000) && (lx != 0)) || iy > 0x7ff00000 || ((iy == 0x7ff00000) && (ly != 0))) + return x + y; + + /* determine if y is an odd int when x < 0 + * yisint = 0 ... y is not an integer + * yisint = 1 ... y is an odd int + * yisint = 2 ... y is an even int + */ + yisint = 0; + if (hx < 0) { + if (iy >= 0x43400000) + yisint = 2; /* even integer y */ + else if (iy >= 0x3ff00000) { + k = (iy >> 20) - 0x3ff; /* exponent */ + if (k > 20) { + j = ly >> (52 - k); + if ((j << (52 - k)) == ly) + yisint = 2 - (j & 1); + } else if (ly == 0) { + j = iy >> (20 - k); + if ((j << (20 - k)) == iy) + yisint = 2 - (j & 1); + } + } + } + + /* special value of y */ + if (ly == 0) { + if (iy == 0x7ff00000) { /* y is +-inf */ + if (((ix - 0x3ff00000) | lx) == 0) + return y - y; /* inf**+-1 is NaN */ + else if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ + return (hy >= 0) ? y : zero; + else /* (|x|<1)**-,+inf = inf,0 */ + return (hy < 0) ? -y : zero; + } + if (iy == 0x3ff00000) { /* y is +-1 */ + if (hy < 0) + return one / x; + else + return x; + } + if (hy == 0x40000000) + return x * x; /* y is 2 */ + if (hy == 0x3fe00000) { /* y is 0.5 */ + if (hx >= 0) /* x >= +0 */ + return sqrt(x); + } + } + + ax = __fabs(x); + qqq = ax; /*x is +-0,+-inf,+-1*/ + /* special value of x */ + if (lx == 0) { + if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000) { + z = qqq; /*x is +-0,+-inf,+-1*/ + if (hy < 0) + z = one / z; /* z = (1/|x|) */ + if (hx < 0) { + if (((ix - 0x3ff00000) | yisint) == 0) { + z = (z - z) / (z - z); /* (-1)**non-int is NaN */ + } else if (yisint == 1) + z = -z; /* (x<0)**odd = -(|x|**odd) */ + } + return z; + } + } + + /* (x<0)**(non-int) is NaN */ + /* CYGNUS LOCAL: This used to be + if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x); + but ANSI C says a right shift of a signed negative quantity is + implementation defined. */ + + if (((((int)hx >> 31) + 1) | yisint) == 0) { + errno = 33; + return (double)NAN; + }; + + /* |y| is huge */ + if (iy > 0x41e00000) { /* if |y| > 2**31 */ + if (iy > 0x43f00000) { /* if |y| > 2**64, must o/uflow */ + if (ix <= 0x3fefffff) + return (hy < 0) ? huge * huge : tiny * tiny; + if (ix >= 0x3ff00000) + return (hy > 0) ? huge * huge : tiny * tiny; + } + /* over/underflow if x is not close to one */ + if (ix < 0x3fefffff) + return (hy < 0) ? huge * huge : tiny * tiny; + if (ix > 0x3ff00000) + return (hy > 0) ? huge * huge : tiny * tiny; + /* now |1-x| is tiny <= 2**-20, suffice to compute + log(x) by x-x^2/2+x^3/3-x^4/4 */ + t = x - 1; /* t has 20 trailing zeros */ + w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); + u = ivln2_h * t; /* ivln2_h has 21 sig. bits */ + v = t * ivln2_l - w * ivln2; + t1 = u + v; + __LO(t1) = 0; + t2 = v - (t1 - u); + } else { + double s2, s_h, s_l, t_h, t_l; + n = 0; + /* take care subnormal number */ + if (ix < 0x00100000) { + ax *= two53; + n -= 53; + ix = __HI(ax); + } + n += ((ix) >> 20) - 0x3ff; + j = ix & 0x000fffff; + /* determine interval */ + ix = j | 0x3ff00000; /* normalize ix */ + if (j <= 0x3988E) + k = 0; /* |x|> 1) | 0x20000000) + 0x00080000 + (k << 18); + t_l = ax - (t_h - bp[k]); + s_l = v * ((u - s_h * t_h) - s_h * t_l); + /* compute log(ax) */ + s2 = s * s; + r = s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); + r += s_l * (s_h + s); + s2 = s_h * s_h; + t_h = 3.0 + s2 + r; + __LO(t_h) = 0; + t_l = r - ((t_h - 3.0) - s2); + /* u+v = s*(1+...) */ + u = s_h * t_h; + v = s_l * t_h + t_l * s; + /* 2/(3log2)*(s+...) */ + p_h = u + v; + __LO(p_h) = 0; + p_l = v - (p_h - u); + z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */ + z_l = cp_l * p_h + p_l * cp + dp_l[k]; + /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ + t = (double)n; + t1 = (((z_h + z_l) + dp_h[k]) + t); + __LO(t1) = 0; + t2 = z_l - (((t1 - t) - dp_h[k]) - z_h); + } + + s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ + if (((((int)hx >> 31) + 1) | (yisint - 1)) == 0) + s = -one; /* (-ve)**(odd int) */ + + /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ + y1 = y; + __LO(y1) = 0; + p_l = (y - y1) * t1 + y * t2; + p_h = y1 * t1; + z = p_l + p_h; + j = __HI(z); + i = __LO(z); + if (j >= 0x40900000) { /* z >= 1024 */ + if (((j - 0x40900000) | i) != 0) /* if z > 1024 */ + return s * huge * huge; /* overflow */ + else { + if (p_l + ovt > z - p_h) + return s * huge * huge; /* overflow */ + } + } else if ((j & 0x7fffffff) >= 0x4090cc00) { /* z <= -1075 */ + if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */ + return s * tiny * tiny; /* underflow */ + else { + if (p_l <= z - p_h) + return s * tiny * tiny; /* underflow */ + } + } + /* + * compute 2**(p_h+p_l) + */ + i = j & 0x7fffffff; + k = (i >> 20) - 0x3ff; + n = 0; + if (i > 0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ + n = j + (0x00100000 >> (k + 1)); + k = ((n & 0x7fffffff) >> 20) - 0x3ff; /* new k for n */ + t = zero; + __HI(t) = (n & ~(0x000fffff >> k)); + n = ((n & 0x000fffff) | 0x00100000) >> (20 - k); + if (j < 0) + n = -n; + p_h -= t; + } + t = p_l + p_h; + __LO(t) = 0; + u = t * lg2_h; + v = (p_l - (t - p_h)) * lg2 + t * lg2_l; + z = u + v; + w = v - (z - u); + t = z * z; + t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); + r = (z * t1) / (t1 - two) - (w + z * w); + z = one - (r - z); + j = __HI(z); + j += (n << 20); + if ((j >> 20) <= 0) + z = ldexp(z, n); /* subnormal output */ + else + __HI(z) += (n << 20); + return s * z; +} + +#endif /* defined(_DOUBLE_IS_32BITS) */ + +// EOF e_pow.c diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 2e454da69..6a8376b6a 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -317,21 +317,6 @@ void daArrow_c::arrowUseMp() { dComIfGp_setItemMagicCount(use_mp[mArrowType]); } -// This is a fake inline (not present in debug maps) which is required for ShieldReflect to match. -// It's possible that an inline similar to this was added to the final game even though it didn't exist in the demo, -// as this section of code was missing from the demo's version of ShieldReflect. -inline void setSphereCoordsFromXYAngles(cXyz& xyz, f32 mag, s16 targetAngleX, s16 targetAngleY) { - f32 normZ; - f32 normY; - f32 normX; - normX = cM_ssin(targetAngleY) * cM_scos(targetAngleX); - normY = -cM_ssin(targetAngleX); - normZ = cM_scos(targetAngleY) * cM_scos(targetAngleX); - xyz.x = normX * mag; - xyz.y = normY * mag; - xyz.z = normZ * mag; -} - /* 800D4DC0-800D50A0 .text ShieldReflect__9daArrow_cFv */ void daArrow_c::ShieldReflect() { f32 vel = speed.abs(); @@ -341,28 +326,31 @@ void daArrow_c::ShieldReflect() { s16 targetAngleX = link->getBodyAngleX(); fopAc_ac_c* ganondorf; - if (fopAcM_SearchByName(PROC_GND, &ganondorf) && dComIfGp_getAttention().LockonTruth() && dComIfGp_getAttention().LockonTarget(0) == ganondorf) { - cXyz ganondorfChestPos = ganondorf->current.pos; - ganondorfChestPos.y = 130.0f + REG8_F(0); - targetAngleX = -cLib_targetAngleX(&link->current.pos, &ganondorfChestPos); - fopAcM_SetParam(ganondorf, 0x23); - mSparkleTimer = 15 + REG0_S(3); - mpSparkleEmitter = dComIfGp_particle_set(dPa_name::ID_COMMON_03EE, &link->current.pos); + if (fopAcM_SearchByName(PROC_GND, &ganondorf)) { + dAttention_c& attention = dComIfGp_getAttention(); + if (attention.LockonTruth() && attention.LockonTarget(0) == ganondorf) { + cXyz ganondorfChestPos = ganondorf->current.pos; +#if VERSION == VERSION_DEMO + ganondorfChestPos.y += 130.0f + REG8_F(0); +#else + ganondorfChestPos.y = 130.0f + REG8_F(0); +#endif + targetAngleX = -cLib_targetAngleX(&link->current.pos, &ganondorfChestPos); +#if VERSION > VERSION_DEMO + fopAcM_SetParam(ganondorf, 0x23); + mSparkleTimer = 15 + REG0_S(3); + mpSparkleEmitter = dComIfGp_particle_set(dPa_name::ID_COMMON_03EE, &link->current.pos); +#endif + } } - // // Regswaps without creating a fake inline. - // // f1 -> f3: normY - // // f3 -> f1: normZ - // f32 normZ; - // f32 normY; - // f32 normX; - // normX = cM_ssin(targetAngleY) * cM_scos(targetAngleX); - // normY = -cM_ssin(targetAngleX); - // normZ = cM_scos(targetAngleY) * cM_scos(targetAngleX); - // speed.x = normX * vel; - // speed.y = normY * vel; - // speed.z = normZ * vel; - setSphereCoordsFromXYAngles(speed, vel, targetAngleX, targetAngleY); + Vec norm; + norm.x = cM_ssin(targetAngleY) * cM_scos(targetAngleX); + norm.y = -cM_ssin(targetAngleX); + norm.z = cM_scos(targetAngleY) * cM_scos(targetAngleX); + speed.x = norm.x * vel; + speed.y = norm.y * vel; + speed.z = norm.z * vel; shape_angle.x = cM_atan2s(-speed.y, -speed.absXZ()); shape_angle.y = cM_atan2s(-speed.x, -speed.z); diff --git a/src/d/actor/d_a_bomb3.inc b/src/d/actor/d_a_bomb3.inc index 05f2b0184..02b73d12b 100644 --- a/src/d/actor/d_a_bomb3.inc +++ b/src/d/actor/d_a_bomb3.inc @@ -198,9 +198,10 @@ BOOL daBomb_c::draw() { } if(fopAcM_GetModel(this) == 0 && mAcch.GetGroundH() != -G_CM3D_F_INF) { - cM3dGPla* pNormal = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); - if(pNormal) { - dComIfGd_setSimpleShadow(¤t.pos, mAcch.GetGroundH(), 25.0f, pNormal->GetNP()); + cM3dGPla* triPla = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); + cXyz* norm = triPla->GetNP(); + if(norm) { + dComIfGd_setSimpleShadow(¤t.pos, mAcch.GetGroundH(), 25.0f, norm); } } diff --git a/src/d/actor/d_a_bwdg.cpp b/src/d/actor/d_a_bwdg.cpp index 9b17f9b50..349576691 100644 --- a/src/d/actor/d_a_bwdg.cpp +++ b/src/d/actor/d_a_bwdg.cpp @@ -59,8 +59,8 @@ void daBwdg_packet_c::draw() { dKy_setLight_mine(mpTevStr); GFSetVtxDescv(l_vtxDescList); GFSetVtxAttrFmtv(GX_VTXFMT0, l_vtxAttrFmtList); - GFSetArray(GX_VA_POS, getPos(), sizeof(cXyz)); - GFSetArray(GX_VA_NRM, getNrm(), sizeof(cXyz)); + GFSetArray(GX_VA_POS, &mPos[m00010 * 0x1081], sizeof(cXyz)); + GFSetArray(GX_VA_NRM, &mNrm[m00010 * 0x1081], sizeof(cXyz)); GFSetArray(GX_VA_TEX0, l_texCoord, sizeof(cXy)); GFSetTevColorS10(GX_TEVREG0, mpTevStr->mColorC0); GFSetTevColor(GX_TEVREG1, mpTevStr->mColorK0); @@ -206,7 +206,7 @@ static BOOL daBwdg_IsDelete(bwdg_class* i_this) { /* 00000854-000008B0 .text daBwdg_Delete__FP10bwdg_class */ static BOOL daBwdg_Delete(bwdg_class* i_this) { - dComIfG_resDelete(&i_this->mPhase, "Bwdg"); + dComIfG_resDeleteDemo(&i_this->mPhase, "Bwdg"); if (i_this->heap) { dComIfG_Bgsp()->Release(i_this->mpBgW); } diff --git a/src/d/actor/d_a_ghostship.cpp b/src/d/actor/d_a_ghostship.cpp index 4a65df303..8aad02c5e 100644 --- a/src/d/actor/d_a_ghostship.cpp +++ b/src/d/actor/d_a_ghostship.cpp @@ -35,7 +35,7 @@ static BOOL createHeap_CB(fopAc_ac_c* i_this) { /* 00000118-0000032C .text _createHeap__13daGhostship_cFv */ BOOL daGhostship_c::_createHeap() { J3DModelData* modelData = static_cast(dComIfG_getObjectRes(m_arc_name, AYUSH_BDL_AYUSH)); - JUT_ASSERT(88, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(80, 88, 88, 88), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if(!mpModel) { @@ -43,7 +43,7 @@ BOOL daGhostship_c::_createHeap() { } J3DAnmTextureSRTKey* btk = static_cast(dComIfG_getObjectRes(m_arc_name, AYUSH_BTK_AYUSH)); - JUT_ASSERT(95, btk != NULL); + JUT_ASSERT(VERSION_SELECT(87, 95, 95, 95), btk != NULL); if(!mBtk.init(modelData, btk, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, 0)) { return false; @@ -286,7 +286,13 @@ bool daGhostship_c::_execute() { f32 dist = fopAcM_searchActorDistanceXZ(this, dComIfGp_getPlayer(0)); mbCanEnterShip = false; - if(moonPhase != dKy_moon_type_chk() || (time > 90.0f && time < 285.0f)) { + if(moonPhase != dKy_moon_type_chk() || +#if VERSION == VERSION_DEMO + (time > 90.0f && time < 330.0f) +#else + (time > 90.0f && time < 285.0f) +#endif + ) { dKy_pship_existense_cut(); mAlpha = 0.0f; } @@ -350,16 +356,27 @@ bool daGhostship_c::_execute() { } } - if(mAlpha == l_HIO.shipAlpha && dist < l_HIO.shipEnterDist && dComIfGs_getEventReg(0x8803) < 3 && !mbEnteredShip) { - mDoAud_seStart(JA_SE_LK_WARP_TO_G_SHIP); - stage_scls_info_class* scls_data = dComIfGd_getMeshSceneList(current.pos); - JUT_ASSERT(463, scls_data != NULL) + if(mAlpha == l_HIO.shipAlpha && dist < l_HIO.shipEnterDist) { + u8 r29 = dComIfGs_getEventReg(0x8803); + if (r29 < 3 +#if VERSION > VERSION_DEMO + && !mbEnteredShip +#endif + ) { + mDoAud_seStart(JA_SE_LK_WARP_TO_G_SHIP); + stage_scls_info_class* scls_data = dComIfGd_getMeshSceneList(current.pos); + JUT_ASSERT(VERSION_SELECT(457, 463, 463, 463), scls_data != NULL) - u8 startCode = scls_data->mStart; - dComIfGs_setEventReg(0xC3FF, scls_data->mRoom); - dComIfGs_setEventReg(0x85FF, startCode); - dComIfGp_setNextStage("PShip", 0, 2); - mbEnteredShip = true; + u8 startCode = scls_data->mStart; + dComIfGs_setEventReg(0xC3FF, scls_data->mRoom); + dComIfGs_setEventReg(0x85FF, startCode); +#if VERSION == VERSION_DEMO + dComIfGp_setNextStage("PShip", 0, r29); +#else + dComIfGp_setNextStage("PShip", 0, 2); + mbEnteredShip = true; +#endif + } } modeProcCall(); @@ -377,12 +394,22 @@ bool daGhostship_c::_execute() { mDoMtx_stack_c::copy(mpModel->getBaseTRMtx()); mDoMtx_stack_c::push(); +#if VERSION == VERSION_DEMO + mDoMtx_stack_c::transM(0.0f + REG10_F(0), 3200.0f + REG10_F(1), 75.0f); + mDoMtx_stack_c::YrotM(REG10_S(0)); +#else mDoMtx_stack_c::transM(0.0f, 3200.0f, 75.0f); +#endif mpCloth->setMtx(mDoMtx_stack_c::get()); mDoMtx_stack_c::pop(); +#if VERSION == VERSION_DEMO + mDoMtx_stack_c::transM(-900.0f + REG10_F(3), 2080.0f + REG10_F(4), 85.0f + REG10_F(5)); + mDoMtx_stack_c::YrotM(0x4000 + REG10_S(1)); +#else mDoMtx_stack_c::transM(-900.0f, 2080.0f, 85.0f); mDoMtx_stack_c::YrotM(0x4000); +#endif mpCloth2->setMtx(mDoMtx_stack_c::get()); mpCloth->setParam(0.45f, -1.5f, 0.875f, 1.0f, 1.0f, 0x100, 0, 900, -800, 7.0f, 6.0f); diff --git a/src/d/actor/d_a_npc_km1.cpp b/src/d/actor/d_a_npc_km1.cpp index f062f47e4..eaa3ed81a 100644 --- a/src/d/actor/d_a_npc_km1.cpp +++ b/src/d/actor/d_a_npc_km1.cpp @@ -10,15 +10,11 @@ #include "d/d_procname.h" #include "d/d_priority.h" #include "d/res/res_km.h" -#include "weak_bss_936_to_1036.h" + +#include "weak_bss_936_to_1036.h" // IWYU pragma: keep + static daNpc_Km1_HIO_c l_HIO; -enum KM1_CONSTANTS{ - TEXPATTERN_END = 1, - ANM_END = 1, -}; - - /* 000000EC-00000144 .text __ct__15daNpc_Km1_HIO_cFv */ daNpc_Km1_HIO_c::daNpc_Km1_HIO_c() { @@ -43,15 +39,13 @@ daNpc_Km1_HIO_c::daNpc_Km1_HIO_c() { /* 00000144-000002F0 .text nodeCallBack_Km__FP7J3DNodei */ static BOOL nodeCallBack_Km(J3DNode* i_node, int i_calcTiming) { - if (i_calcTiming == J3DNodeCBCalcTiming_In) { J3DModel* model = j3dSys.getModel(); daNpc_Km1_c* km1Actor = (daNpc_Km1_c *)(model->getUserArea()); - u16 jointIdx; if (km1Actor) { static cXyz a_att_pos_offst(0.0f,0.0f,0.0f); static cXyz a_eye_pos_offst(20.0f,20.0f,0.0f); - jointIdx = ((J3DJoint*)(i_node))->getJntNo(); + u16 jointIdx = ((J3DJoint*)(i_node))->getJntNo(); mDoMtx_stack_c::copy(model->getAnmMtx(jointIdx)); if(jointIdx == km1Actor->getHeadJntNum()){ MTXMultVec(mDoMtx_stack_c::get(),&a_att_pos_offst,km1Actor->getAttPos()); @@ -62,9 +56,8 @@ static BOOL nodeCallBack_Km(J3DNode* i_node, int i_calcTiming) { mDoMtx_stack_c::XrotM(km1Actor->getBackbone_y()); mDoMtx_stack_c::ZrotM(km1Actor->getBackbone_x()); } - MtxP stack = mDoMtx_stack_c::get(); - cMtx_copy(stack,J3DSys::mCurrentMtx); - MTXCopy(stack,model->getAnmMtx(jointIdx)); + cMtx_copy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx); + model->setAnmMtx(jointIdx, mDoMtx_stack_c::get()); } } return TRUE; @@ -233,13 +226,13 @@ s32 daNpc_Km1_c::setAnm_anm(daNpc_Km1_c::anm_prm_c* i_anm_ptr) { /* 00000A24-00000A8C .text setAnm__11daNpc_Km1_cFv */ void daNpc_Km1_c::setAnm() { - static daNpc_Km1_c::anm_prm_c a_anm_prm_tbl2[3] = { + static daNpc_Km1_c::anm_prm_c a_anm_prm_tbl[3] = { {-1,-1,0.0f,0.0f,-1}, - {0,0,8.0f,1.0f,J3DFrameCtrl::EMode_LOOP}, + {ANM_WAIT,0,8.0f,1.0f,J3DFrameCtrl::EMode_LOOP}, {-1,-1,0.0f,0.0f,-1} }; - setAnm_tex(a_anm_prm_tbl2[field_0x7D0].field_0x1); - setAnm_anm(&a_anm_prm_tbl2[field_0x7D0]); + setAnm_tex(a_anm_prm_tbl[field_0x7D0].field_0x1); + setAnm_anm(&a_anm_prm_tbl[field_0x7D0]); } /* 00000A8C-00000A98 .text chngAnmTag__11daNpc_Km1_cFv */ @@ -275,13 +268,13 @@ void daNpc_Km1_c::ctrlAnmAtr() { /* 00000AE8-00000B50 .text setAnm_ATR__11daNpc_Km1_cFi */ void daNpc_Km1_c::setAnm_ATR(int param_1) { - static daNpc_Km1_c::anm_prm_c a_anm_prm_tbl3[1] = { - {0x00,0x00,8.0f,1.0f,J3DFrameCtrl::EMode_LOOP} + static daNpc_Km1_c::anm_prm_c a_anm_prm_tbl[1] = { + {ANM_WAIT,0x00,8.0f,1.0f,J3DFrameCtrl::EMode_LOOP} }; if(param_1 != 0){ - setAnm_tex(a_anm_prm_tbl3[field_0x7CB].field_0x1); + setAnm_tex(a_anm_prm_tbl[field_0x7CB].field_0x1); } - setAnm_anm((&a_anm_prm_tbl3[field_0x7CB])); + setAnm_anm((&a_anm_prm_tbl[field_0x7CB])); } @@ -408,15 +401,14 @@ void daNpc_Km1_c::lookBack() { /* 00000E94-00000F14 .text chkAttention__11daNpc_Km1_cFv */ bool daNpc_Km1_c::chkAttention() { - if(dComIfGp_getAttention().LockonTruth() != 0){ - return this == dComIfGp_getAttention().LockonTarget(0); + dAttention_c& attention = dComIfGp_getAttention(); + if(attention.LockonTruth() != 0){ + return this == attention.LockonTarget(0); }else{ - return this == dComIfGp_getAttention().ActionTarget(0); + return this == attention.ActionTarget(0); } } -const u32 fillerbytes[] = {0xFF000080,0x0000FF80}; - /* 00000F14-00000F78 .text setAttention__11daNpc_Km1_cFv */ void daNpc_Km1_c::setAttention() { @@ -462,9 +454,10 @@ bool daNpc_Km1_c::event_action() { } return true; } -static char* cut_name_tbl[] = {"ACTION"}; + /* 0000103C-00001144 .text privateCut__11daNpc_Km1_cFv */ void daNpc_Km1_c::privateCut() { + static char* cut_name_tbl[] = {"ACTION"}; int staffIdx = dComIfGp_evmng_getMyStaffId("Km1",NULL,0); if(staffIdx != -1){ @@ -614,20 +607,20 @@ u8 daNpc_Km1_c::demo() { }else{ field_0x7C7 = 1; dComIfGp_demo_getActor(demoActorID); -#if VERSION != VERSION_DEMO - dDemo_setDemoData(this,0x6A,mpMorf,"Km",0,0,0,0); -#endif + dDemo_setDemoData( + this, + dDemo_actor_c::ENABLE_TRANS_e | dDemo_actor_c::ENABLE_ROTATE_e | dDemo_actor_c::ENABLE_ANM_e | dDemo_actor_c::ENABLE_ANM_FRAME_e, + mpMorf, + "Km" + ); } return field_0x7C7; } /* 00001548-000016AC .text _draw__11daNpc_Km1_cFv */ bool daNpc_Km1_c::_draw() { - - J3DModelData *model_data; - J3DModel *model; - model = mpMorf->getModel(); - model_data = model->getModelData(); + J3DModel *model = mpMorf->getModel(); + J3DModelData *model_data = model->getModelData(); g_env_light.settingTevStruct(TEV_TYPE_ACTOR,¤t.pos,&tevStr); g_env_light.setLightTevColorType(model,&tevStr); mBtpAnm.entry(model_data,mBtpFrame); @@ -638,10 +631,19 @@ bool daNpc_Km1_c::_draw() { cXyz pos(current.pos.x,current.pos.y+150.0f,current.pos.z); mShadowId = dComIfGd_setRealShadow(mShadowId,1,field_0x6D4,&pos,800.0f,current.pos.y-mObjAcch.GetGroundH(),NULL); if(mShadowId == 0){ - cXyz* pFloorNrm = (cXyz*)dComIfG_Bgsp()->GetTriPla(mObjAcch.m_gnd.GetBgIndex(),mObjAcch.m_gnd.GetPolyIndex()); - dComIfGd_setSimpleShadow(¤t.pos,mObjAcch.GetGroundH(),40.0f,pFloorNrm); + dComIfGd_setSimpleShadow( + ¤t.pos, + mObjAcch.GetGroundH(), + 40.0f, + dComIfG_Bgsp()->GetTriPla(mObjAcch.m_gnd)->GetNP() + ); } - dSnap_RegistFig(0x58,this,1.0f,1.0f,1.0f); + dSnap_RegistFig(DSNAP_TYPE_KM1,this,1.0f,1.0f,1.0f); + + // Color literals for debug drawing. Unused in non-debug builds. + (GXColor){0xFF,0x00, 0x00, 0x80}; + (GXColor){0x00,0x00, 0xFF, 0x80}; + return true; } @@ -669,7 +671,7 @@ bool daNpc_Km1_c::_execute() { } eventOrder(); if(field_0x7C7 == 0){ - fopAcM_posMoveF(this,(cXyz*)&mStts); + fopAcM_posMoveF(this, mStts.GetCCMoveP()); } setMtx(); setCollision(60.0f,150.0f); @@ -680,7 +682,7 @@ bool daNpc_Km1_c::_execute() { bool daNpc_Km1_c::_delete() { fopAcM_GetID(this); - dComIfG_resDelete(&field_0x6C4,"Km"); + dComIfG_resDeleteDemo(&field_0x6C4,"Km"); if(mpMorf != NULL){ mpMorf->stopZelAnime(); @@ -697,15 +699,16 @@ bool daNpc_Km1_c::_delete() { /* 0000188C-000018AC .text CheckCreateHeap__FP10fopAc_ac_c */ static BOOL CheckCreateHeap(fopAc_ac_c* actor) { - return ((daNpc_Km1_c*)actor)->CreateHeap(); } /* 000018AC-00001A1C .text _create__11daNpc_Km1_cFv */ cPhs_State daNpc_Km1_c::_create() { - static int a_heap_size_tbl[1] = {0x000272E0}; - fopAcM_SetupActor(this,daNpc_Km1_c); + +#if VERSION > VERSION_DEMO + fopAcM_SetupActor(this, daNpc_Km1_c); +#endif if (!decideType(fopAcM_GetParam(this) & 0xFF )) { @@ -722,6 +725,11 @@ cPhs_State daNpc_Km1_c::_create() { l_HIO.mNo = mDoHIO_createChild("金持ちム−ル",&l_HIO); } l_HIO.field_0x8 += 1; + +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(this, daNpc_Km1_c); +#endif + if(fopAcM_entrySolidHeap(this,CheckCreateHeap,a_heap_size_tbl[field_0x7D3])){ fopAcM_SetMtx(this,mpMorf->mpModel->getBaseTRMtx()); fopAcM_setCullSizeBox(this,-60.0f,-20.0f,-80.0f,60.0f,160.0f,60.0f); @@ -738,12 +746,12 @@ cPhs_State daNpc_Km1_c::_create() { /* 00001E4C-00002158 .text CreateHeap__11daNpc_Km1_cFv */ BOOL daNpc_Km1_c::CreateHeap() { - static u8 a_tex_pattern_num_tbl[1] = {0}; + static u8 a_tex_pattern_num_tbl[1] = {TEXPATTERN_MABA}; J3DModelData *a_mdl_data; a_mdl_data = (J3DModelData*)dComIfG_getObjectIDRes("Km",KM_BDL_KM); - JUT_ASSERT(0x52D,a_mdl_data != NULL); + JUT_ASSERT(VERSION_SELECT(1316, 1325, 1325, 1325) ,a_mdl_data != NULL); mpMorf = new mDoExt_McaMorf( a_mdl_data, NULL, NULL, @@ -755,22 +763,21 @@ BOOL daNpc_Km1_c::CreateHeap() { if(mpMorf->getModel()) { m_head_jnt_num = a_mdl_data->getJointName()->getIndex("head"); - JUT_ASSERT(0x540,m_head_jnt_num >= 0); + JUT_ASSERT(VERSION_SELECT(1335, 1344, 1344, 1344), m_head_jnt_num >= 0); m_backbone_jnt_num = a_mdl_data->getJointName()->getIndex("backbone"); - JUT_ASSERT(0x542,m_backbone_jnt_num >= 0); + JUT_ASSERT(VERSION_SELECT(1337, 1346, 1346, 1346), m_backbone_jnt_num >= 0); field_0x7CD = a_tex_pattern_num_tbl[field_0x7D3]; if (initTexPatternAnm(false) != 0) { field_0x6D4 = mDoExt_J3DModel__create(a_mdl_data,0x20000,0x11020203); if (field_0x6D4 != 0) { for (u16 i = 0; i < a_mdl_data->getJointNum(); i += 1) { - if ((i == getHeadJntNum()) || (i == getBackboneJntNum())) { + if ((i == m_head_jnt_num) || (i == m_backbone_jnt_num)) { mpMorf->mpModel->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack_Km); } } mpMorf->getModel()->setUserArea((u32)this); mAcchCir.SetWall(30.0f,60.0f); - mObjAcch.Set(¤t.pos,&old.pos,(fopAc_ac_c *)this,1, - &mAcchCir,&speed,NULL,NULL); + mObjAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir, fopAcM_GetSpeed_p(this)); return TRUE; } } @@ -781,32 +788,27 @@ BOOL daNpc_Km1_c::CreateHeap() { } /* 00002158-00002178 .text daNpc_Km1_Create__FP10fopAc_ac_c */ static cPhs_State daNpc_Km1_Create(fopAc_ac_c* obj) { - (static_cast(obj))->_create(); } /* 00002178-00002198 .text daNpc_Km1_Delete__FP11daNpc_Km1_c */ static BOOL daNpc_Km1_Delete(daNpc_Km1_c* obj) { - (static_cast(obj))->_delete(); } /* 00002198-000021B8 .text daNpc_Km1_Execute__FP11daNpc_Km1_c */ static BOOL daNpc_Km1_Execute(daNpc_Km1_c* obj) { - (static_cast(obj))->_execute(); } /* 000021B8-000021D8 .text daNpc_Km1_Draw__FP11daNpc_Km1_c */ static BOOL daNpc_Km1_Draw(daNpc_Km1_c* obj) { - (static_cast(obj))->_draw(); } /* 000021D8-000021E0 .text daNpc_Km1_IsDelete__FP11daNpc_Km1_c */ static BOOL daNpc_Km1_IsDelete(daNpc_Km1_c*) { return TRUE; - } static actor_method_class l_daNpc_Km1_Method = { diff --git a/src/d/actor/d_a_npc_people.cpp b/src/d/actor/d_a_npc_people.cpp index 251ec3f94..4fd86e745 100644 --- a/src/d/actor/d_a_npc_people.cpp +++ b/src/d/actor/d_a_npc_people.cpp @@ -4711,15 +4711,16 @@ bool daNpcPeople_c::_execute() { if(getPrmArg0() == 0) { cXyz diff = current.pos - home.pos; f32 mag = diff.abs(); + f32 f3 = 20.0f; mag -= 180.0f; if(mag < 0.0f) { mag = 0.0f; } - if(mag > 20.0f) { - mag = 20.0f; + if(mag > f3) { + mag = f3; } - mStts.SetWeight(mag * 50.0f / 20.0f + 80.0f); + mStts.SetWeight(mag * 50.0f / f3 + 80.0f); } } diff --git a/src/d/actor/d_a_npc_photo.cpp b/src/d/actor/d_a_npc_photo.cpp index a60295d4b..1ddada406 100644 --- a/src/d/actor/d_a_npc_photo.cpp +++ b/src/d/actor/d_a_npc_photo.cpp @@ -831,7 +831,7 @@ bool daNpcPhoto_c::_draw() { obj.SetGeo(temp, l_pso_photo.field_0x0C, l_pso_photo.field_0x10, l_pso_photo.field_0x14 + current.angle.y); dSnap_RegistSnapObj(obj); } else { - dSnap_RegistFig(DSNAP_TYPE_UNK5E, this, 1.0f, 1.0f, 1.0f); + dSnap_RegistFig(DSNAP_TYPE_NPC_PHOTO, this, 1.0f, 1.0f, 1.0f); } return true; } diff --git a/src/d/actor/d_a_obj_barrel.cpp b/src/d/actor/d_a_obj_barrel.cpp index b859270e2..c5a84bcfb 100644 --- a/src/d/actor/d_a_obj_barrel.cpp +++ b/src/d/actor/d_a_obj_barrel.cpp @@ -727,7 +727,7 @@ bool daObjBarrel::Act_c::_draw() { float gndH = mAcch.GetGroundH(); cM3dGPla* gndPlane = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); cXyz *norm = gndPlane->GetNP(); - if (gndPlane && gndH != -G_CM3D_F_INF) { + if (norm && gndH != -G_CM3D_F_INF) { dComIfGd_setSimpleShadow(¤t.pos, gndH, attr().m02, norm); } } diff --git a/src/d/actor/d_a_obj_homen.cpp b/src/d/actor/d_a_obj_homen.cpp index b0d265fea..7e3e5e32f 100644 --- a/src/d/actor/d_a_obj_homen.cpp +++ b/src/d/actor/d_a_obj_homen.cpp @@ -3,7 +3,9 @@ * Object - Wind Temple - Face stone Hookshot target */ +#pragma sym off #include "d/actor/d_a_obj_homen.h" +#pragma sym on #include "d/actor/d_a_player.h" #include "d/d_com_inf_game.h" #include "d/d_procname.h" @@ -39,8 +41,10 @@ struct Attr_c { /* 0x30 */ f32 field_0x30; /* 0x34 */ f32 field_0x34; /* 0x38 */ f32 field_0x38; +#if VERSION > VERSION_DEMO /* 0x3C */ u8 field_0x3C[0x50 - 0x3C]; /* 0x50 */ f32 field_0x50; +#endif }; // Size: 0x54 const Attr_c L_attr = { @@ -63,8 +67,10 @@ const Attr_c L_attr = { 105.0f, 92.0f, 200.0f, +#if VERSION > VERSION_DEMO {}, 25.0f, +#endif }; #ifdef DEBUG @@ -218,23 +224,47 @@ bool Act_c::create_heap() { }; J3DModelData* mdl_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, bdl_idx[mType]); - JUT_ASSERT(615, mdl_data != NULL); - if (mdl_data != NULL) { + JUT_ASSERT(VERSION_SELECT(578, 615, 615, 615), mdl_data != NULL); +#if VERSION > VERSION_DEMO + if (mdl_data != NULL) +#endif + { mpModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11000002); } init_mtx(); +#if VERSION == VERSION_DEMO + int r28 = 0; +#endif + cBgD_t* bgw_data = (cBgD_t*)dComIfG_getObjectRes(M_arcname, dzb_idx[mType]); - JUT_ASSERT(628, bgw_data != NULL); - if (bgw_data != NULL) { + JUT_ASSERT(VERSION_SELECT(590, 628, 628, 628), bgw_data != NULL); +#if VERSION > VERSION_DEMO + if (bgw_data != NULL) +#endif + { mpBgW = new dBgW(); +#if VERSION == VERSION_DEMO + if (mpBgW != NULL && mpBgW->Set(bgw_data, cBgW::MOVE_BG_e, &mMtx)) { + r28 |= 1; + } +#else if (mpBgW != NULL && mpBgW->Set(bgw_data, cBgW::MOVE_BG_e, &mMtx) == true) { return false; } +#endif } +#if VERSION == VERSION_DEMO + bool ret = false; + if (mdl_data != NULL && r28 == 0) { + ret = true; + }; + return ret; +#else return mdl_data != NULL && mpModel != NULL && mpBgW != NULL; +#endif } /* 000002B4-000005B0 .text _create__Q210daObjHomen5Act_cFv */ @@ -315,7 +345,13 @@ cPhs_State Act_c::_create() { /* 000011A4-00001230 .text _delete__Q210daObjHomen5Act_cFv */ bool Act_c::_delete() { dComIfG_resDelete(&mPhase, M_arcname); - if (heap != NULL && mpBgW != NULL && mpBgW->ChkUsed()) { + if ( +#if VERSION > VERSION_DEMO + heap != NULL && +#endif + mpBgW != NULL && + mpBgW->ChkUsed() + ) { dComIfG_Bgsp()->Release(mpBgW); } return true; @@ -393,12 +429,19 @@ void Act_c::make_enemy() { int enemy_idx = param_get_enemy(); if (enemy_idx != 0xF && enemy_idx < ARRAY_SIZE(make_enemy_dat)) { - cXyz offset; - cXyz type_offsets[2] = { +#if VERSION == VERSION_DEMO + static cXyz y_offset[2] = { + cXyz(0.0f, 300.0f, 350.0f), + cXyz(0.0f, 0.0f, 0.0f), + }; +#else + cXyz y_offset[2] = { cXyz(0.0f, 300.0f, 350.0f), cXyz(0.0f, 0.0f, 25.0f), }; - cMtx_multVec(mMtx, &type_offsets[mType & 1], &offset); +#endif + cXyz offset; + cMtx_multVec(mMtx, &y_offset[mType & 1], &offset); fpc_ProcID enemy_id = fopAcM_create( make_enemy_dat[enemy_idx].proc_name, diff --git a/src/d/actor/d_a_obj_homensmoke.cpp b/src/d/actor/d_a_obj_homensmoke.cpp index ca3ab8de8..f2a97781d 100644 --- a/src/d/actor/d_a_obj_homensmoke.cpp +++ b/src/d/actor/d_a_obj_homensmoke.cpp @@ -76,7 +76,12 @@ namespace daObjHomensmoke { /* 000004C8-00000738 .text _execute__Q215daObjHomensmoke5Act_cFv */ bool Act_c::_execute() { - if (!mbInitialized) { +#if VERSION == VERSION_DEMO + if (m2D0 == NULL) +#else + if (!mbInitialized) +#endif + { static cXyz norse_offsetL(0.0f, 300.0f, 20.0f); static cXyz norse_offsetS(0.0f, 70.0f, 20.0f); if (mType == 0) { diff --git a/src/d/actor/d_a_obj_ladder.cpp b/src/d/actor/d_a_obj_ladder.cpp index 13b67f753..6b4aa89f7 100644 --- a/src/d/actor/d_a_obj_ladder.cpp +++ b/src/d/actor/d_a_obj_ladder.cpp @@ -111,7 +111,10 @@ cPhs_State daObjLadder::Act_c::Mthd_Create() { if (phase_state == cPhs_COMPLEATE_e) { mType = prm_get_type(); - phase_state = MoveBGCreate(M_arcname, attr_type(mType).dzbId, dBgS_MoveBGProc_Trans, 0x900); + phase_state = MoveBGCreate( + M_arcname, attr_type(mType).dzbId, dBgS_MoveBGProc_Trans, + VERSION_SELECT(0x1700, 0x900, 0x900, 0x900) + ); JUT_ASSERT(0x1DE, (phase_state == cPhs_COMPLEATE_e) || (phase_state == cPhs_ERROR_e)); } @@ -128,7 +131,7 @@ BOOL daObjLadder::Act_c::Delete() { BOOL daObjLadder::Act_c::Mthd_Delete() { BOOL res = MoveBGDelete(); - dComIfG_resDelete(&mPhs, M_arcname); + dComIfG_resDeleteDemo(&mPhs, M_arcname); return res; } @@ -237,7 +240,8 @@ void daObjLadder::Act_c::mode_drop() { if (unk2DE >= 0) { unk2DE--; - current.pos.y = mGndY - (current.pos.y - mGndY) * 0.5f; + f32 temp = current.pos.y - mGndY; + current.pos.y = mGndY - temp * 0.5f; speed.y *= -0.5f; } else { current.pos.y = mGndY; diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index 79b2b7a0b..d744d90cc 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -1870,8 +1870,9 @@ namespace daObjMovebox { int temp = mBgc.mMaxGroundIdx; f32 groundH = mBgc.mGroundY[temp]; cM3dGPla* triPla = dComIfG_Bgsp()->GetTriPla(Bgc_c::M_gnd_work[temp]); - if (triPla && groundH != -G_CM3D_F_INF) { - dComIfGd_setSimpleShadow(¤t.pos, groundH, i_attr()->m10, triPla->GetNP(), shape_angle.y, 1.0f, NULL); + cXyz* norm = triPla->GetNP(); + if (norm && groundH != -G_CM3D_F_INF) { + dComIfGd_setSimpleShadow(¤t.pos, groundH, i_attr()->m10, norm, shape_angle.y, 1.0f, NULL); } } diff --git a/src/d/actor/d_a_ship.cpp b/src/d/actor/d_a_ship.cpp index 138309697..d0a085115 100644 --- a/src/d/actor/d_a_ship.cpp +++ b/src/d/actor/d_a_ship.cpp @@ -341,9 +341,11 @@ void daShip_c::setInitMessage() { else if (checkForceMessage()) { return; } +#if VERSION > VERSION_DEMO else if (dComIfGs_isEventBit(0x2110) && !dComIfGs_checkGetItem(dItem_BOMB_BAG_e)) { mNextMessageNo = 0x623; } +#endif else if (checkStateFlg(daSFLG_UNK800000_e)) { mNextMessageNo = 0x636; } @@ -612,7 +614,9 @@ BOOL daShip_c::setNextMessage(msg_class* msg) { } else if (currMessageNo == 0x1682) { dComIfGs_onEventBit(0x3d04); +#if VERSION > VERSION_DEMO mNextMessageNo = 0; +#endif } else if (currMessageNo == 0x1688) { dComIfGs_onEventBit(0x3f80); @@ -826,7 +830,7 @@ void daShip_c::setWaveAngle(short* param1, short* param2) { /* 00002314-000023E0 .text getWaterY__8daShip_cFv */ f32 daShip_c::getWaterY() { - float waterY; + f32 waterY; BOOL waterHit = mAcch.ChkWaterHit(); if (waterHit) { m03F8 = mAcch.m_wtr.GetHeight(); @@ -844,6 +848,9 @@ f32 daShip_c::getWaterY() { waterY = m03F8; } else { +#if VERSION == VERSION_DEMO + waterY = m03F4; +#else daPy_lk_c* link = daPy_getPlayerLinkActorClass(); if (link && link->mDemo.getDemoMode() == daPy_demo_c::DEMO_UNK44_e ) { waterY = 0.0f; @@ -851,6 +858,7 @@ f32 daShip_c::getWaterY() { else { waterY = m03F4; } +#endif } return waterY; } @@ -1087,32 +1095,23 @@ s16 daShip_c::getAimControllAngle(short referenceAngle) { /* 00002D90-00002EE0 .text setMoveAngle__8daShip_cFs */ void daShip_c::setMoveAngle(short moveAngle) { - float turnRate; - float maxTurnRate; - float minTurnRate; - short initialAngle; - bool cannotMove = FALSE; - if (mTornadoActor || mWhirlActor != 0) { - cannotMove = TRUE; - } - if (!cannotMove) { - initialAngle = shape_angle.y; - turnRate = 4.0f - std::abs(speedF) / 55.0f * 3.0f; - maxTurnRate = 3.6f; - minTurnRate = 0.1f; - if (turnRate > maxTurnRate) { - turnRate = maxTurnRate; + if (!checkForceMove()) { + s16 initialAngle = shape_angle.y; + f32 turnRate = 4.0f - std::abs(speedF) / 55.0f * 3.0f; + if (turnRate > 3.6f) { + turnRate = 3.6f; } - else if (turnRate < minTurnRate) { - turnRate = minTurnRate; + else if (turnRate < 0.1f) { + turnRate = 0.1f; } if (m0388 >= 0xF) { - turnRate = maxTurnRate; + turnRate = 3.6f; } else { turnRate += ((3.6f - turnRate) * m0388) / 15.0f; } - shape_angle.y += (s32)(-turnRate * (moveAngle >> 6)); + s16 temp = -turnRate * (moveAngle >> 6); + shape_angle.y += temp; setControllAngle(getAimControllAngle(initialAngle)); current.angle.y = shape_angle.y; } @@ -1958,7 +1957,10 @@ BOOL daShip_c::procCraneUp_init() { dComIfGp_getVibration().StartShock(7, -0x31, cXyz(0.0f, 1.0f, 0.0f)); dComIfGp_getVibration().StartQuake(4, 1, cXyz(0.0f, 1.0f, 0.0f)); +#if VERSION > VERSION_DEMO speedF = 0.0f; +#endif + return TRUE; } @@ -2180,7 +2182,7 @@ BOOL daShip_c::procZevDemo() { fVar17 = local_70.absXZ(); if (!dComIfGp_evmng_getMyFloatP(mEvtStaffId, "rad")) { - JUT_ASSERT(0xE9D, 0); + JUT_ASSERT(VERSION_SELECT(3722, 3741, 3741, 3741), 0); } fVar3 = *dComIfGp_evmng_getMyFloatP(mEvtStaffId, "rad"); @@ -3449,7 +3451,10 @@ void daShip_c::setHeadAnm() { mCurMode == 9) { newFileIndex = SHIP_BCK_KYAKKAN1; } - else if ((!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && + else if ( +#if VERSION > VERSION_DEMO + (!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && +#endif (mSph.ChkTgHit() || mCyl[0].ChkTgHit() || mCyl[1].ChkTgHit() || mCyl[2].ChkTgHit())) { m03B4 = SHIP_BCK_FN_LOOK_L; @@ -3460,7 +3465,10 @@ void daShip_c::setHeadAnm() { } } else { - if ((!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && + if ( +#if VERSION > VERSION_DEMO + (!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && +#endif (mSph.ChkTgHit() || mCyl[0].ChkTgHit() || mCyl[1].ChkTgHit() || mCyl[2].ChkTgHit())) { m03B4 = SHIP_BCK_FN_LOOK_L; @@ -3474,7 +3482,9 @@ void daShip_c::setHeadAnm() { else if ((m03B4 == SHIP_BCK_FN_LOOK_L || m03B4 == SHIP_BCK_FN_LOOK_R) && std::fabsf(mpHeadAnm->getPlaySpeed()) < 0.01f && cM_rnd() < 0.4f && (g_Counter.mTimer & 0x1FF) == 0x1FF && +#if VERSION > VERSION_DEMO (!dComIfGs_isEventBit(0x3910) || dComIfGs_isEventBit(0x2D02)) && +#endif !checkStateFlg(daSFLG_UNK40000000_e)) { newFileIndex = SHIP_BCK_AKIBI1; } @@ -4373,7 +4383,7 @@ BOOL daShip_c::createHeap() { m0392 = SHIP_BCK_FN_MAST_OFF2; } modelData = (J3DModelData *)dComIfG_getObjectRes(l_arcName, SHIP_BDL_FN_BODY); - JUT_ASSERT(0x1B5C, modelData != 0); + JUT_ASSERT(VERSION_SELECT(6969, 7004, 7004, 7004), modelData != 0); mpBodyAnm = new mDoExt_McaMorf( modelData, NULL, NULL, @@ -4398,7 +4408,7 @@ BOOL daShip_c::createHeap() { } modelData = (J3DModelData *)dComIfG_getObjectRes(l_arcName, SHIP_BDL_VFNCN); - JUT_ASSERT(0x1B81, modelData != 0); + JUT_ASSERT(VERSION_SELECT(7006, 7041, 7041, 7041), modelData != 0); mpCannonModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000002); if (mpCannonModel == NULL) { @@ -4406,7 +4416,7 @@ BOOL daShip_c::createHeap() { } modelData = (J3DModelData *)dComIfG_getObjectRes(l_arcName, SHIP_BDL_VFNCR); - JUT_ASSERT(0x1B8E, modelData != 0); + JUT_ASSERT(VERSION_SELECT(7019, 7054, 7054, 7054), modelData != 0); mpSalvageArmModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000002); if (mpSalvageArmModel == NULL) { @@ -4414,7 +4424,7 @@ BOOL daShip_c::createHeap() { } modelData = (J3DModelData *)dComIfG_getObjectRes("Link", LINK_BDL_ROPEEND); - JUT_ASSERT(0x1B9B, modelData != 0); + JUT_ASSERT(VERSION_SELECT(7032, 7067, 7067, 7067), modelData != 0); mpLinkModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000002); if (mpLinkModel == NULL) { @@ -4422,7 +4432,7 @@ BOOL daShip_c::createHeap() { } modelData = (J3DModelData *)dComIfG_getObjectRes(l_arcName, SHIP_BDL_FN_HEAD_H); - JUT_ASSERT(0x1BA8, modelData != 0); + JUT_ASSERT(VERSION_SELECT(7045, 7080, 7080, 7080), modelData != 0); m03B4 = SHIP_BCK_FN_LOOK_L; @@ -4602,9 +4612,13 @@ cPhs_State daShip_c::create() { mWhirlID = fpcM_ERROR_PROCESS_ID_e; mWhirlActor = NULL; +#if VERSION == VERSION_DEMO + mTactWarpID = fpcM_ERROR_PROCESS_ID_e; +#else if (mNextMode != MODE_START_MODE_WARP_e) { mTactWarpID = fpcM_ERROR_PROCESS_ID_e; } +#endif if (checkStateFlg(daSFLG_SAIL_ON_e) != 0) { mPart = PART_STEER_e; @@ -4625,7 +4639,13 @@ cPhs_State daShip_c::create() { } } - if ((dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) == dStageType_SEA_e) || !strcmp(dComIfGp_getStartStageName(), "Hyrule") || !strcmp(dComIfGp_getStartStageName(), "Ocean")) { + if ( + (dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) == dStageType_SEA_e) + || !strcmp(dComIfGp_getStartStageName(), "Hyrule") +#if VERSION > VERSION_DEMO + || !strcmp(dComIfGp_getStartStageName(), "Ocean") +#endif + ) { m03CC = 4; } else { diff --git a/src/d/actor/d_a_swtdoor.cpp b/src/d/actor/d_a_swtdoor.cpp index 059ebdefb..316b0af0b 100644 --- a/src/d/actor/d_a_swtdoor.cpp +++ b/src/d/actor/d_a_swtdoor.cpp @@ -28,10 +28,11 @@ static BOOL daSwtdoor_Execute(swtdoor_class* i_this) { i_this->home.pos.y -= 10.0f; MtxTrans(i_this->current.pos.x, i_this->current.pos.y + i_this->home.pos.y, i_this->current.pos.z, false); - mDoMtx_YrotM(*calc_mtx, i_this->current.angle.y); - mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); - mDoMtx_ZrotM(*calc_mtx, i_this->current.angle.z); - i_this->model->setBaseTRMtx(*calc_mtx); + cMtx_YrotM(*calc_mtx, i_this->current.angle.y); + cMtx_XrotM(*calc_mtx, i_this->current.angle.x); + cMtx_ZrotM(*calc_mtx, i_this->current.angle.z); + J3DModel * model = i_this->model; + model->setBaseTRMtx(*calc_mtx); return TRUE; } @@ -42,7 +43,7 @@ static BOOL daSwtdoor_IsDelete(swtdoor_class* i_this) { /* 000001C4-000001F4 .text daSwtdoor_Delete__FP13swtdoor_class */ static BOOL daSwtdoor_Delete(swtdoor_class* i_this) { - dComIfG_resDelete(&i_this->mPhs, "Swtdoor"); + dComIfG_resDeleteDemo(&i_this->mPhs, "Swtdoor"); return TRUE; } diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index 376cd4327..ce2441e98 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -68,7 +68,7 @@ BOOL daTag_Msg_c::arrivalTerms() { u16 eventFlag; swBit = (int)(getSwbit2() & 0xFF); eventFlag = getEventFlag(); - if ((s32)swBit != 0xff && dComIfGs_isSwitch(swBit, current.roomNo) == 0) { + if ((s32)swBit != 0xff && dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(this)) == 0) { return FALSE; } else if (eventFlag != 0xffff && dComIfGs_isEventBit(eventFlag) == 0) { @@ -115,7 +115,9 @@ BOOL daTag_Msg_c::otherCheck() { return FALSE; } } - targetAngle = (s16)(targetAngle + 0x7FFF) - player->current.angle.y; + + s16 r3 = targetAngle + 0x7FFF; + targetAngle = r3 - player->current.angle.y; if (targetAngle < 0) { targetAngle = -targetAngle; } @@ -184,7 +186,7 @@ static BOOL daTag_Msg_actionHunt(daTag_Msg_c* a_this) { a_this->setActio(3); swBit = a_this->getSwbit(); if ((swBit & 0xff) != 0xff) { - dComIfGs_onSwitch(swBit,a_this->current.roomNo); + dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(a_this)); } l_msgId = fpcM_ERROR_PROCESS_ID_e; l_msg = 0; @@ -241,7 +243,7 @@ cPhs_State daTag_Msg_c::create() { swBit = (int)(getSwbit() & 0xFF); if ((getMessage() == 0x9c5) && dComIfGs_isEventBit(0x502)) { setActio(0); - } else if ((s32)swBit != 0xff && dComIfGs_isSwitch(swBit, current.roomNo) != 0) { + } else if ((s32)swBit != 0xff && dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(this)) != 0) { setActio(0); } else { setActio(1); diff --git a/src/d/actor/d_a_tag_waterlevel.cpp b/src/d/actor/d_a_tag_waterlevel.cpp index 4e7dfe1fb..06f0e94c4 100644 --- a/src/d/actor/d_a_tag_waterlevel.cpp +++ b/src/d/actor/d_a_tag_waterlevel.cpp @@ -69,7 +69,8 @@ namespace daTagWaterlevel { u8 sch_bit = dKy_get_schbit(); cLib_offBit(M_state, STATE_2); - if ((prm_sch & sch_bit & 0xFF)) { + bool temp = prm_sch & sch_bit & 0xFF; + if (temp) { target = 1.0f; if (!cLib_checkBit(get_state(), STATE_1)) { cLib_onBit(M_state, STATE_2); diff --git a/src/d/actor/d_a_windmill.cpp b/src/d/actor/d_a_windmill.cpp index 1740755d1..6ddad754f 100644 --- a/src/d/actor/d_a_windmill.cpp +++ b/src/d/actor/d_a_windmill.cpp @@ -120,9 +120,15 @@ const Vec daWindMill_c::m_cull_size[][2] = { /* 00000078-000000E8 .text _delete__12daWindMill_cFv */ bool daWindMill_c::_delete() { - if (heap != NULL && mpBgW != NULL) + if ( +#if VERSION > VERSION_DEMO + heap != NULL && +#endif + mpBgW != NULL + ) { dComIfG_Bgsp()->Release(mpBgW); - dComIfG_resDelete(&mPhs, m_arcname[mType]); + } + dComIfG_resDeleteDemo(&mPhs, m_arcname[mType]); return TRUE; } @@ -133,16 +139,14 @@ static BOOL CheckCreateHeap(fopAc_ac_c* i_ac) { /* 00000108-000002A0 .text CreateHeap__12daWindMill_cFv */ BOOL daWindMill_c::CreateHeap() { - J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes( -m_arcname[mType], m_bmdidx[mType]); - JUT_ASSERT(405, modelData != NULL); + J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes(m_arcname[mType], m_bmdidx[mType]); + JUT_ASSERT(VERSION_SELECT(399, 405, 405, 405), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0x80000,0x11000222); if (mpModel == NULL) { return FALSE; } - if (m_dzbidx[mType] != -1) { mpBgW = new dBgW(); if (mpBgW != NULL) { @@ -164,7 +168,6 @@ static BOOL nodeCallBack(J3DNode*, int); /* 000002A0-0000050C .text CreateInit__12daWindMill_cFv */ void daWindMill_c::CreateInit() { - /* Nonmatching */ fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); cXyz cullMin = m_cull_size[mType][0]; @@ -309,7 +312,6 @@ bool daWindMill_c::_execute() { /* 00000ECC-00001048 .text hane_move__12daWindMill_cFv */ void daWindMill_c::hane_move() { - /* Nonmatching */ f32 wind_float = 0.0f; search_wind(); @@ -320,8 +322,9 @@ void daWindMill_c::hane_move() { } } - f32 temp = 2500.0f; - cLib_addCalcAngleS(&mAngle[1], wind_float * temp, 0xF, 100, 10); + s16 target_angle = 2500; + target_angle = wind_float * target_angle; + cLib_addCalcAngleS(&mAngle[1], target_angle, 0xF, 100, 10); if (mAngle[2] <= mAngle[1] && mAngle[1] != 0) { if (mType == 0) { fopAcM_seStart(this, JA_SE_OBJ_WDUN_WMILL_L_RND, 0); @@ -354,9 +357,11 @@ void daWindMill_c::set_at() { }; int i; + s16 r0; switch (mType) { case 1: - if (mAngle[1] > 1000) { + r0 = 1000; + if (mAngle[1] > r0) { mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, mAngle[0] + mAngle[1]); mDoMtx_stack_c::multVec(&vec1, &vec1); @@ -379,7 +384,8 @@ void daWindMill_c::set_at() { } break; case 0: - if (mAngle[1] > 1000) { + r0 = 1000; + if (mAngle[1] > r0) { mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::ZXYrotM(current.angle.x, mAngle[0] + mAngle[1], current.angle.z); @@ -418,9 +424,11 @@ void daWindMill_c::set_co() { cXyz(0.0f, -350.0f, 70.0f), }; + s16 r0; switch (mType) { case 1: - if (mAngle[1] <= 1000) { + r0 = 1000; + if (mAngle[1] <= r0) { mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, mAngle[0] + mAngle[1]); diff --git a/src/d/d_door.cpp b/src/d/d_door.cpp index 9260d010d..459ecb6b0 100644 --- a/src/d/d_door.cpp +++ b/src/d/d_door.cpp @@ -9,7 +9,12 @@ #include "d/res/res_key.h" #include "d/res/res_hkyo.h" #include "d/actor/d_a_player.h" + +// Fakematch to fix weak function ordering of cSAngle::~cSAngle() and cSGlobe::~cSGlobe(). +#pragma sym off #include "SSystem/SComponent/c_angle.h" +#pragma sym on +#pragma nosyminline off /* 8006B39C-8006B3A8 .text getSwbit__12dDoor_info_cFv */ u8 dDoor_info_c::getSwbit() { @@ -111,7 +116,7 @@ s32 dDoor_info_c::frontCheck() { /* 8006B6F4-8006B824 .text drawCheck_local__12dDoor_info_cFv */ s32 dDoor_info_c::drawCheck_local() { - if (!adjoinPlayer() && !eventInfo.checkCommandDemoAccrpt() && !eventInfo.checkCommandDoor()) + if (!adjoinPlayer() && eventInfo.checkCommandDemoAccrpt() == FALSE && eventInfo.checkCommandDoor() == FALSE) return 0; if (getFRoomNo() == 0x3F || getBRoomNo() == 0x3F) @@ -174,7 +179,7 @@ void dDoor_info_c::startDemoProc() { fopAc_ac_c* player = dComIfGp_getPlayer(0); mStaffId = dComIfGp_evmng_getMyStaffId("SHUTTER_DOOR"); shape_angle.y = current.angle.y; - JUT_ASSERT(0x112, player); + JUT_ASSERT(VERSION_SELECT(271, 274, 274, 274), player); s16 delta = player->home.angle.y - home.angle.y; if (delta < 0) delta = -delta; @@ -310,13 +315,11 @@ void dDoor_info_c::closeEndCom() { cXyz pos(current.pos.x - rad * mAngleVec.x, current.pos.y, current.pos.z - rad * mAngleVec.z); s8 roomNo = fopAcM_GetRoomNo(player); - s16 angle; - if (dot > 0.0f) { - angle = current.angle.y; - } else { - angle = current.angle.y + 0x8000; - } - dComIfGs_setRestartRoom(pos, angle, roomNo); + dComIfGs_setRestartRoom( + pos, + dot > 0.0f ? current.angle.y : (s16)(current.angle.y + 0x8000), + roomNo + ); } /* 8006C0A4-8006C0EC .text getDemoAction__12dDoor_info_cFv */ @@ -466,7 +469,7 @@ BOOL dDoor_key2_c::keyProc() { /* 8006C650-8006C764 .text keyCreate_Nkey__12dDoor_key2_cFv */ BOOL dDoor_key2_c::keyCreate_Nkey() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Key", KEY_BDL_VLOCN); - JUT_ASSERT(0x2cc, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(713, 716, 716, 716), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (mpModel == NULL) @@ -482,7 +485,7 @@ BOOL dDoor_key2_c::keyCreate_Nkey() { /* 8006C764-8006C910 .text keyCreate_Bkey__12dDoor_key2_cFv */ BOOL dDoor_key2_c::keyCreate_Bkey() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Key", KEY_BDL_VLOCB); - JUT_ASSERT(0x2e4, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(737, 740, 740, 740), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if (mpModel == NULL) @@ -500,7 +503,7 @@ BOOL dDoor_key2_c::keyCreate_Bkey() { case J3DErrType_OutOfMemory: return FALSE; default: - JUT_ASSERT(0x306, FALSE); + JUT_ASSERT(VERSION_SELECT(771, 774, 774, 774), FALSE); case J3DErrType_Success: return TRUE; } @@ -647,7 +650,7 @@ BOOL dDoor_msg_c::proc(cXyz* pos) { mState++; break; case 2: - JUT_ASSERT(0x3ba, m_msg); + JUT_ASSERT(VERSION_SELECT(951, 954, 954, 954), m_msg); if (m_msg->mStatus == fopMsgStts_MSG_TYPING_e) { switch (mMsgId) { case 0x1BBD: @@ -659,7 +662,7 @@ BOOL dDoor_msg_c::proc(cXyz* pos) { } break; case 3: - JUT_ASSERT(0x3ca, m_msg); + JUT_ASSERT(VERSION_SELECT(967, 970, 970, 970), m_msg); if (m_msg->mStatus == fopMsgStts_MSG_DISPLAYED_e) { switch (mMsgId) { case 0x1BBD: @@ -709,7 +712,7 @@ BOOL dDoor_hkyo_c::create() { return TRUE; J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Hkyo", HKYO_BDL_HKYO1); - JUT_ASSERT(0x41c, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(1049, 1052, 1052, 1052), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000202); if (mpModel == NULL) diff --git a/src/d/d_event.cpp b/src/d/d_event.cpp index b8fcccb5b..a2357e95e 100644 --- a/src/d/d_event.cpp +++ b/src/d/d_event.cpp @@ -21,8 +21,16 @@ dEvt_order_c::dEvt_order_c() {} /* 8006FE58-8006FEE8 .text orderOld__14dEvt_control_cFUsUsUsUsPvPvPCv */ s32 dEvt_control_c::orderOld(u16 eventType, u16 priority, u16 flag, u16 hindFlag, void* ac1, void* ac2, const void* eventName) { - s32 eventIdx = dComIfGp_evmng_getEventIdx((const char*)eventName); - return order(eventType, priority, flag, hindFlag, ac1, ac2, eventIdx, 0xFF); + return order( + eventType, + priority, + flag, + hindFlag, + ac1, + ac2, + (s32)dComIfGp_evmng_getEventIdx((const char*)eventName), + 0xFF + ); } /* 8006FEE8-8007002C .text order__14dEvt_control_cFUsUsUsUsPvPvsUc */ @@ -41,21 +49,23 @@ s32 dEvt_control_c::order(u16 eventType, u16 priority, u16 flag, u16 hindFlag, v pNewOrder->mEventInfoIdx = eventInfoIdx; if (pNewOrder->mPriority == 0) - JUT_ASSERT(0x93, FALSE); + JUT_ASSERT(147, FALSE); if (mOrderCount == 0) { mFirstOrderIdx = 0; pNewOrder->mNextOrderIdx = -1; } else { + dEvt_order_c* pQueue; s32 queueIdx = mFirstOrderIdx; - dEvt_order_c* pQueue = &mOrder[queueIdx]; + pQueue = &mOrder[queueIdx]; if (pNewOrder->mPriority < pQueue->mPriority) { mFirstOrderIdx = mOrderCount; pNewOrder->mNextOrderIdx = queueIdx; } else { s8 nextQueueIdx; while ((nextQueueIdx = pQueue->mNextOrderIdx) >= 0) { - if (pNewOrder->mPriority < mOrder[pQueue->mNextOrderIdx].mPriority) + dEvt_order_c* r6 = &mOrder[pQueue->mNextOrderIdx]; + if (pNewOrder->mPriority < r6->mPriority) break; pQueue = &mOrder[nextQueueIdx]; } @@ -97,7 +107,7 @@ void dEvt_control_c::setParam(dEvt_order_c* order) { /* 8007015C-8007018C .text beforeFlagProc__14dEvt_control_cFP12dEvt_order_c */ BOOL dEvt_control_c::beforeFlagProc(dEvt_order_c* order) { fopAc_ac_c* actor2 = order->mActor2; - if ((order->mFlag & dEvtFlag_TALK_e) && !actor2->eventInfo.chkCondition(dEvtCnd_CANTALK_e)) + if ((order->mFlag & dEvtFlag_TALK_e) && actor2->eventInfo.chkCondition(dEvtCnd_CANTALK_e) == FALSE) return false; return true; } @@ -143,7 +153,7 @@ BOOL dEvt_control_c::talkCheck(dEvt_order_c* order) { } if (!dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x145, FALSE); + JUT_ASSERT(325, FALSE); return TRUE; } else { @@ -174,7 +184,7 @@ BOOL dEvt_control_c::talkXyCheck(dEvt_order_c* order) { return FALSE; } - if (actor2 == NULL || !actor2->eventInfo.chkCondition(dEvtCnd_CANTALKITEM_e)) { + if (actor2 == NULL || actor2->eventInfo.chkCondition(dEvtCnd_CANTALKITEM_e) == FALSE) { return FALSE; } @@ -219,7 +229,7 @@ BOOL dEvt_control_c::photoCheck(dEvt_order_c* order) { mbInPhoto = 0; if (dComIfGp_getPictureStatus() == 1) { - JUT_ASSERT(0x1a5, actor2); + JUT_ASSERT(421, actor2); if (!commonCheck(order, dEvtCnd_CANTALK_e, dEvtCmd_INTALK_e)) return FALSE; @@ -231,7 +241,7 @@ BOOL dEvt_control_c::photoCheck(dEvt_order_c* order) { } if (!dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x1b5, FALSE); + JUT_ASSERT(437, FALSE); mbInPhoto = 1; mMode = dEvtMode_TALK_e; @@ -248,7 +258,7 @@ BOOL dEvt_control_c::catchCheck(dEvt_order_c* order) { fopAc_ac_c* actor2 = order->mActor2; fopAc_ac_c* actor1 = order->mActor1; - if (actor1 == NULL || (actor2 != NULL && !actor2->eventInfo.chkCondition(dEvtCnd_CANCATCH_e))) + if (actor1 == NULL || (actor2 != NULL && actor2->eventInfo.chkCondition(dEvtCnd_CANCATCH_e) == FALSE)) return FALSE; actor1->eventInfo.setCommand(dEvtCmd_INCATCH_e); @@ -258,8 +268,10 @@ BOOL dEvt_control_c::catchCheck(dEvt_order_c* order) { mItemNo = dComIfGp_att_getCatchChgItem(); mMode = dEvtMode_DEMO_e; if (mEventId != -1 && !dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x1e3, FALSE); + JUT_ASSERT(483, FALSE); +#if VERSION > VERSION_DEMO onEventFlag(0x80); +#endif return TRUE; } @@ -288,7 +300,7 @@ BOOL dEvt_control_c::demoCheck(dEvt_order_c* order) { s16 eventId = order->mEventId; if (actor2 == NULL) { - JUT_ASSERT(0x21f, FALSE); + JUT_ASSERT(VERSION_SELECT(541, 543, 543, 543), FALSE); return FALSE; } @@ -336,7 +348,7 @@ BOOL dEvt_control_c::potentialCheck(dEvt_order_c* order) { fopAc_ac_c* actor1 = order->mActor1; fopAc_ac_c* actor2 = order->mActor2; if (actor1 == NULL || actor2 == NULL) - JUT_ASSERT(0x280, FALSE); + JUT_ASSERT(VERSION_SELECT(638, 640, 640, 640), FALSE); if (!beforeFlagProc(order)) return FALSE; @@ -357,7 +369,7 @@ BOOL dEvt_control_c::doorCheck(dEvt_order_c* order) { mEventId = actor2->eventInfo.getEventId(); if (mEventId != -1 && dComIfGp_getPEvtManager()->getEventData(mEventId) != NULL) { if (!dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x2c0, FALSE); + JUT_ASSERT(VERSION_SELECT(702, 704, 704, 704), FALSE); } else { mEventId = -1; reset(); @@ -379,7 +391,7 @@ BOOL dEvt_control_c::itemCheck(dEvt_order_c* order) { mMode = dEvtMode_DEMO_e; mEventId = dComIfGp_evmng_getEventIdx(defaultEventName); if (!dComIfGp_evmng_order(mEventId)) - JUT_ASSERT(0x2ea, FALSE); + JUT_ASSERT(VERSION_SELECT(744, 746, 746, 746), FALSE); return TRUE; } else { return FALSE; @@ -398,7 +410,7 @@ BOOL dEvt_control_c::endProc() { case dEvtMode_COMPULSORY_e: break; default: - JUT_ASSERT(0x315, FALSE); + JUT_ASSERT(VERSION_SELECT(787, 789, 789, 789), FALSE); } mMode = dEvtMode_NONE_e; @@ -506,7 +518,7 @@ BOOL dEvt_control_c::checkStart() { case dEvtType_CHANGE_e: break; default: - JUT_ASSERT(0x39c, FALSE); + JUT_ASSERT(VERSION_SELECT(922, 924, 924, 924), FALSE); break; } @@ -595,8 +607,8 @@ BOOL dEvt_control_c::photoCheck() { if (actor1 == NULL) { return FALSE; } - if (!actor1->eventInfo.chkCondition(dEvtCnd_CANTALK_e) || - !actor2->eventInfo.chkCondition(dEvtCnd_CANTALK_e) + if (actor1->eventInfo.chkCondition(dEvtCnd_CANTALK_e) == FALSE || + actor2->eventInfo.chkCondition(dEvtCnd_CANTALK_e) == FALSE ) { return FALSE; } @@ -612,7 +624,7 @@ BOOL dEvt_control_c::photoCheck() { /* 80071270-80071418 .text moveApproval__14dEvt_control_cFPv */ s32 dEvt_control_c::moveApproval(void* actor) { fopAc_ac_c* i_ac = (fopAc_ac_c*)actor; - if (getMode() == dEvtMode_NONE_e) + if (runCheck() == FALSE) return dEvtMove_MOVE_e; switch (getMode()) { @@ -641,13 +653,20 @@ s32 dEvt_control_c::moveApproval(void* actor) { return dEvtMove_MOVE_e; if (fopAcM_CheckStatus(i_ac, fopAcStts_UNK800_e)) return dEvtMove_MOVE_e; +#if VERSION == VERSION_DEMO + if (dComIfGp_event_getMode() == dEvtMode_COMPULSORY_e && fopAcM_CheckStatus(i_ac, fopAcStts_BOSS_e)) + return dEvtMove_NOMOVE_e; +#else if ((dComIfGp_event_getMode() == dEvtMode_COMPULSORY_e || dComIfGp_event_getMode() == dEvtMode_TALK_e) && fopAcM_CheckStatus(i_ac, fopAcStts_BOSS_e)) return dEvtMove_NOMOVE_e; if (chkEventFlag(0x80) && fopAcM_CheckStatus(i_ac, fopAcStts_BOSS_e)) return dEvtMove_NOMOVE_e; +#endif if (fopAcM_CheckStatus(i_ac, fopAcStts_UNK4000_e)) return dEvtMove_MOVE_e; - return fopAcM_CheckStatus(i_ac, fopAcStts_CARRY_e) ? dEvtMove_MOVE_e : dEvtMove_NOMOVE_e; + if (fopAcM_CheckStatus(i_ac, fopAcStts_CARRY_e)) + return dEvtMove_MOVE_e; + return dEvtMove_NOMOVE_e; } /* 80071418-80071468 .text compulsory__14dEvt_control_cFPvPCcUs */ diff --git a/src/d/d_item_data.cpp b/src/d/d_item_data.cpp index 8cb333796..ddf58504e 100644 --- a/src/d/d_item_data.cpp +++ b/src/d/d_item_data.cpp @@ -78,7 +78,7 @@ #include "d/res/res_vmapq.h" #include "d/res/res_varrl.h" #include "d/res/res_vbow.h" -#include "d/res/res_fa.h" +// #include "d/res/res_fa.h" #include "d/res/res_shinju_d.h" #include "d/res/res_shinju_f.h" #include "d/res/res_fwbin.h" @@ -959,7 +959,11 @@ dItem_data_item_resource dItem_data::item_resource[0x100] = { { // 0x17: noentry23 /* mArcname */ NULL, +#if VERSION == VERSION_DEMO + /* mTexture */ NULL, +#else /* mTexture */ item_texture_tbl[TEXTURE_IDX_HEART_UP_02], +#endif /* mBmdIdx */ -1, /* mSrtIdx */ -1, /* mSrtIdx2 */ -1, @@ -975,7 +979,11 @@ dItem_data_item_resource dItem_data::item_resource[0x100] = { { // 0x18: noentry24 /* mArcname */ NULL, +#if VERSION == VERSION_DEMO + /* mTexture */ NULL, +#else /* mTexture */ item_texture_tbl[TEXTURE_IDX_HEART_UP_02], +#endif /* mBmdIdx */ -1, /* mSrtIdx */ -1, /* mSrtIdx2 */ -1, @@ -991,7 +999,11 @@ dItem_data_item_resource dItem_data::item_resource[0x100] = { { // 0x19: noentry25 /* mArcname */ NULL, +#if VERSION == VERSION_DEMO + /* mTexture */ NULL, +#else /* mTexture */ item_texture_tbl[TEXTURE_IDX_HEART_UP_02], +#endif /* mBmdIdx */ -1, /* mSrtIdx */ -1, /* mSrtIdx2 */ -1, @@ -4699,7 +4711,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x0B80 +#else /* mHeapSize */ 0x0680 +#endif }, { // 0x01: dItem_GREEN_RUPEE_e @@ -4712,7 +4728,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x00, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x02: dItem_BLUE_RUPEE_e @@ -4725,7 +4745,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x01, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x03: dItem_YELLOW_RUPEE_e @@ -4738,7 +4762,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x02, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x04: dItem_RED_RUPEE_e @@ -4751,7 +4779,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x03, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x05: dItem_PURPLE_RUPEE_e @@ -4764,7 +4796,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x04, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x06: dItem_ORANGE_RUPEE_e @@ -4777,7 +4813,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x05, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x07: dItem_HEART_PIECE_e @@ -4790,7 +4830,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2420 +#else /* mHeapSize */ 0x0C40 +#endif }, { // 0x08: dItem_HEART_CONTAINER_e @@ -4803,7 +4847,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2500 +#else /* mHeapSize */ 0x0C60 +#endif }, { // 0x09: dItem_SMALL_MAGIC_e @@ -4816,7 +4864,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x0B80 +#else /* mHeapSize */ 0x0700 +#endif }, { // 0x0A: dItem_LARGE_MAGIC_e @@ -4829,7 +4881,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x0B80 +#else /* mHeapSize */ 0x0700 +#endif }, { // 0x0B: dItem_BOMB_5_e @@ -4842,7 +4898,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0CC0 +#endif }, { // 0x0C: dItem_BOMB_10_e @@ -4855,7 +4915,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0CC0 +#endif }, { // 0x0D: dItem_BOMB_20_e @@ -4868,7 +4932,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0CC0 +#endif }, { // 0x0E: dItem_BOMB_30_e @@ -4881,7 +4949,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0CC0 +#endif }, { // 0x0F: dItem_SILVER_RUPEE_e @@ -4894,7 +4966,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ 0x06, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x17C0 +#else /* mHeapSize */ 0x0CA0 +#endif }, { // 0x10: dItem_ARROW_10_e @@ -4907,7 +4983,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0700 +#endif }, { // 0x11: dItem_ARROW_20_e @@ -4920,7 +5000,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2000 +#else /* mHeapSize */ 0x0B40 +#endif }, { // 0x12: dItem_ARROW_30_e @@ -4933,7 +5017,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3000 +#else /* mHeapSize */ 0x1000 +#endif }, { // 0x13: noentry19 @@ -4972,7 +5060,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x3500 +#else /* mHeapSize */ 0x0780 +#endif }, { // 0x16: dItem_RECOVER_FAIRY_e @@ -5102,7 +5194,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VHAPL, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0FE0 +#endif }, { // 0x20: dItem_TELESCOPE_e @@ -5596,7 +5692,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VDOKL, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2000 +#else /* mHeapSize */ 0x08A0 +#endif }, { // 0x46: dItem_BOKOBABA_SEED_e @@ -5609,7 +5709,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VBOKL, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0720 +#endif }, { // 0x47: dItem_GOLDEN_FEATHER_e @@ -5622,7 +5726,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VHANL, /* mTevFrm */ -1, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2000 +#else /* mHeapSize */ 0x0EC0 +#endif }, { // 0x48: BOKO_BELT @@ -5635,7 +5743,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VBELL, /* mTevFrm */ -1, /* mUnknown */ 0x11000222, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x2000 +#else /* mHeapSize */ 0x0760 +#endif }, { // 0x49: dItem_RED_JELLY_e @@ -5648,7 +5760,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VCHUL, /* mTevFrm */ 0x01, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0800 +#endif }, { // 0x4A: dItem_GREEN_JELLY_e @@ -5661,7 +5777,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VCHUL, /* mTevFrm */ 0x00, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0800 +#endif }, { // 0x4B: dItem_BLUE_JELLY_e @@ -5674,7 +5794,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VCHUL, /* mTevFrm */ 0x02, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0800 +#endif }, { // 0x4C: dItem_MAP_e @@ -6389,7 +6513,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ ALWAYS_BCK_VESAL, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0740 +#endif }, { // 0x83: dItem_HYOI_PEAR_e @@ -6402,7 +6530,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0680 +#endif }, { // 0x84: ESA1 @@ -6519,7 +6651,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ FDAI_BCK_FOBJ00, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x08E0 +#endif }, { // 0x8D: FLOWER_2 @@ -6532,7 +6668,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ FDAI_BCK_FOBJ01, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0860 +#endif }, { // 0x8E: FLOWER_3 @@ -6545,7 +6685,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ FDAI_BCK_FOBJ02, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0880 +#endif }, { // 0x8F: HEROS_FLAG @@ -6558,7 +6702,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1200 +#else /* mHeapSize */ 0x1100 +#endif }, { // 0x90: TAIRYO_FLAG @@ -6571,7 +6719,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ -1, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1200 +#else /* mHeapSize */ 0x1100 +#endif }, { // 0x91: SALES_FLAG @@ -6597,7 +6749,11 @@ dItem_data_field_item_res dItem_data::field_item_res[0x100] = { /* mBckIdx */ FDAI_BCK_FOBJ06, /* mTevFrm */ -1, /* mUnknown */ 0x11000022, +#if VERSION == VERSION_DEMO + /* mHeapSize */ 0x1000 +#else /* mHeapSize */ 0x0760 +#endif }, { // 0x93: RED_FLAG diff --git a/src/d/d_magma.cpp b/src/d/d_magma.cpp index 837be2d6f..e24e8c052 100644 --- a/src/d/d_magma.cpp +++ b/src/d/d_magma.cpp @@ -173,7 +173,12 @@ void dMagma_floor_c::draw() { /* 80075CB8-80075DD8 .text calc__14dMagma_floor_cFi */ void dMagma_floor_c::calc(int i_roomNo) { mDoMtx_stack_c::scaleS(1.0f, 0.05f, 1.0f); - if (strcmp(dComIfGp_getStartStageName(), "M_DragB") == 0 || strcmp(dComIfGp_getStartStageName(), "Xboss0") == 0) + if ( + strcmp(dComIfGp_getStartStageName(), "M_DragB") == 0 +#if VERSION > VERSION_DEMO + || strcmp(dComIfGp_getStartStageName(), "Xboss0") == 0 +#endif + ) mDoMtx_stack_c::transM(0.0f, -(mPos.y + 20.0f), 0.0f); else mDoMtx_stack_c::transM(0.0f, -(mPos.y + 30.0f), 0.0f); diff --git a/src/d/d_s_actor_data_mng.cpp b/src/d/d_s_actor_data_mng.cpp index 8f3ac628e..74c999936 100644 --- a/src/d/d_s_actor_data_mng.cpp +++ b/src/d/d_s_actor_data_mng.cpp @@ -115,8 +115,20 @@ void dADM::SetData(void* pData) { pHeader += 3; } - if (FindTag('ACFN', &row, &rowOffs) && FindTag('ACNA', &name, &nameOffs) && FindTag('ACDS', &dat_size, &dataOffs)) { - JUT_ASSERT(202, row * name == dat_size); - mCharTbl.SetData((u32)pData, row, rowOffs, name, nameOffs, dat_size, dataOffs); + u32 tag; + tag = 'ACFN'; + if (!FindTag(tag, &row, &rowOffs)) { + return; } + tag = 'ACNA'; + if (!FindTag(tag, &name, &nameOffs)) { + return; + } + tag = 'ACDS'; + if (!FindTag(tag, &dat_size, &dataOffs)) { + return; + } + + JUT_ASSERT(202, row * name == dat_size); + mCharTbl.SetData((u32)pData, row, rowOffs, name, nameOffs, dat_size, dataOffs); } diff --git a/src/d/d_s_open.cpp b/src/d/d_s_open.cpp index 7cb6ef4bb..d030b42b6 100644 --- a/src/d/d_s_open.cpp +++ b/src/d/d_s_open.cpp @@ -72,11 +72,15 @@ BOOL dScnOpen_c::draw() { /* 80232D38-80232DD8 .text __dt__10dScnOpen_cFv */ dScnOpen_c::~dScnOpen_c() { +#if VERSION > VERSION_DEMO if (mpProc != NULL) +#endif delete mpProc; +#if VERSION > VERSION_DEMO if (solid_heap != NULL) +#endif mDoExt_destroySolidHeap(solid_heap); - dComIfG_resDelete(&mPhs, "Opening"); + dComIfG_resDeleteDemo(&mPhs, "Opening"); dComIfGp_setWindowNum(0); } diff --git a/src/dolphin/gx/GXInit.c b/src/dolphin/gx/GXInit.c index 0ee66d1bb..cec4e2d13 100644 --- a/src/dolphin/gx/GXInit.c +++ b/src/dolphin/gx/GXInit.c @@ -3,7 +3,7 @@ #include "dolphin/vi/vi.h" #include "dolphin/base/PPCArch.h" -char* __GXVersion = "<< Dolphin SDK - GX release build: Nov 10 2004 06:27:12 (0x2301) >>"; +char* __GXVersion = "<< Dolphin SDK - GX\trelease build: Sep 5 2002 05:33:28 (0x2301) >>"; static GXData gxData; diff --git a/src/dolphin/os/OSThread.c b/src/dolphin/os/OSThread.c index ad7faca62..40b495d1f 100644 --- a/src/dolphin/os/OSThread.c +++ b/src/dolphin/os/OSThread.c @@ -660,7 +660,7 @@ void OSWakeupThread(OSThreadQueue* queue) { OSRestoreInterrupts(enabled); } -s32 OSSetThreadPriority(OSThread* thread, s32 priority) { +s32 OSSetThreadPriority(OSThread* thread, OSPriority priority) { BOOL enabled; if (priority < 0 || priority > 31) { @@ -668,7 +668,7 @@ s32 OSSetThreadPriority(OSThread* thread, s32 priority) { } enabled = OSDisableInterrupts(); - if ((s32)thread->base_priority != priority) { + if ((OSPriority)thread->base_priority != priority) { thread->base_priority = priority; UpdatePriority(thread); diff --git a/src/f_op/f_op_actor.cpp b/src/f_op/f_op_actor.cpp index a3a9dae47..45a12ec2e 100644 --- a/src/f_op/f_op_actor.cpp +++ b/src/f_op/f_op_actor.cpp @@ -14,6 +14,93 @@ #include "d/d_com_inf_game.h" #include "d/d_s_play.h" +#if VERSION == VERSION_DEMO +#include "m_Do/m_Do_printf.h" + +class print_error_check_c { +public: + struct param_s { + const char* m00; + u32 m04; + }; + print_error_check_c(fopAc_ac_c* actor, const param_s& prm); + ~print_error_check_c(); + void start(); + void check(); + + static u8 mPriorityMaximum; + static bool mPrintDisable; + + static param_s sEXECUTE; + static param_s sCREATE; + static param_s sDELETE; + static param_s sIS_DELETE; + static param_s sDRAW; + +private: + fopAc_ac_c* mpActor; + param_s mParam; + u32 mNumErrors; + OSTick mTick; + OSPriority mPriority; + u32 mReportDisable; +}; + +u8 print_error_check_c::mPriorityMaximum = 0; +bool print_error_check_c::mPrintDisable = false; + +print_error_check_c::param_s print_error_check_c::sEXECUTE = { + "EXECUTE", 0xBB8, +}; +print_error_check_c::param_s print_error_check_c::sCREATE = { + "CREATE", 0xBB8, +}; +print_error_check_c::param_s print_error_check_c::sDELETE = { + "DELETE", 0xBB8, +}; +print_error_check_c::param_s print_error_check_c::sIS_DELETE = { + "IS_DELETE", 0x1E, +}; +print_error_check_c::param_s print_error_check_c::sDRAW = { + "DRAW", 0xBB8, +}; + +print_error_check_c::print_error_check_c(fopAc_ac_c* actor, const param_s& prm) { + mpActor = actor; + mParam = prm; + start(); +} + +print_error_check_c::~print_error_check_c() { + check(); +} + +void print_error_check_c::start() { + mNumErrors = print_errors; + + if (mPrintDisable) { + mReportDisable = __OSReport_disable; + OSReportDisable(); + } else { + mReportDisable = -1; + } + + if (mPriorityMaximum > 0) { + OSThread* currentThread = OSGetCurrentThread(); + mPriority = OSGetThreadPriority(currentThread); + OSSetThreadPriority(currentThread, 0); + } else { + mPriority = -1; + } + + mTick = OSGetTick(); +} + +void print_error_check_c::check() { + /* Empty in non-debug builds */ +} +#endif + /* 8002330C-800233C4 .text __ct__10fopAc_ac_cFv */ fopAc_ac_c::fopAc_ac_c() { } @@ -26,7 +113,8 @@ u32 fopAc_ac_c::stopStatus; /* 80023514-80023540 .text fopAc_IsActor__FPv */ s32 fopAc_IsActor(void* pProc) { - return fpcBs_Is_JustOfType(g_fopAc_type, ((fopAc_ac_c*)pProc)->actor_type); + int actor_type = ((fopAc_ac_c*)pProc)->actor_type; + return fpcBs_Is_JustOfType(g_fopAc_type, actor_type); } /* 80023540-8002362C .text fopAc_Draw__FPv */ @@ -50,6 +138,9 @@ s32 fopAc_Draw(void* pProc) { ) && !fopAcM_CheckStatus(actor, fopAcStts_NODRAW_e) ) { fopAcM_OffCondition(actor, fopAcCnd_NODRAW_e); +#if VERSION == VERSION_DEMO + print_error_check_c sp08(actor, print_error_check_c::sDRAW); +#endif ret = fpcLf_DrawMethod((leafdraw_method_class*)actor->sub_method, actor); } else { fopAcM_OnCondition(actor, fopAcCnd_NODRAW_e); @@ -57,7 +148,9 @@ s32 fopAc_Draw(void* pProc) { fopAcM_OffStatus(actor, fopAcStts_NODRAW_e); +#if VERSION > VERSION_DEMO if (dComIfGp_roomControl_getStayNo() >= 0 && fopAcM_CheckStatus(actor, fopAcStts_SHOWMAP_e)) +#endif dMap_drawActorPointMiniMap(actor); } @@ -72,10 +165,12 @@ BOOL fopAc_Execute(void* pProc) { fopAc_ac_c * actor = (fopAc_ac_c *)pProc; BOOL ret = TRUE; +#if VERSION > VERSION_DEMO CHECK_FLOAT_CLASS(0x27d, actor->current.pos.x); CHECK_FLOAT_CLASS(0x27e, actor->current.pos.y); CHECK_FLOAT_CLASS(0x27f, actor->current.pos.z); CHECK_VEC3_RANGE(0x286, actor->current.pos); +#endif if (fopAcM_CheckStatus(actor, fopAcStts_NOPAUSE_e) || (!dMenu_flag() && !dScnPly_ply_c::isPause())) { actor->eventInfo.beforeProc(); @@ -99,15 +194,20 @@ BOOL fopAc_Execute(void* pProc) { ) { fopAcM_OffCondition(actor, fopAcCnd_NOEXEC_e); actor->old = actor->current; +#if VERSION == VERSION_DEMO + print_error_check_c sp08(actor, print_error_check_c::sEXECUTE); +#endif ret = fpcMtd_Execute((process_method_class*)actor->sub_method, actor); } else { fopAcM_OnCondition(actor, fopAcCnd_NOEXEC_e); } +#if VERSION > VERSION_DEMO CHECK_FLOAT_CLASS(0x2b4, actor->current.pos.x); CHECK_FLOAT_CLASS(0x2b5, actor->current.pos.y); CHECK_FLOAT_CLASS(0x2b6, actor->current.pos.z); CHECK_VEC3_RANGE(0x2bd, actor->current.pos); +#endif } return ret; @@ -116,7 +216,13 @@ BOOL fopAc_Execute(void* pProc) { /* 80023BDC-80023C30 .text fopAc_IsDelete__FPv */ BOOL fopAc_IsDelete(void* pProc) { fopAc_ac_c * actor = (fopAc_ac_c *)pProc; - BOOL ret = fpcMtd_IsDelete((process_method_class*)actor->sub_method, actor); + BOOL ret; + { +#if VERSION == VERSION_DEMO + print_error_check_c sp08(actor, print_error_check_c::sIS_DELETE); +#endif + ret = fpcMtd_IsDelete((process_method_class*)actor->sub_method, actor); + } if (ret == TRUE) fopDwTg_DrawQTo(&actor->draw_tag); return ret; @@ -125,7 +231,13 @@ BOOL fopAc_IsDelete(void* pProc) { /* 80023C30-80023CD4 .text fopAc_Delete__FPv */ BOOL fopAc_Delete(void* pProc) { fopAc_ac_c * actor = (fopAc_ac_c *)pProc; - BOOL ret = fpcMtd_Delete((process_method_class*)actor->sub_method, actor); + BOOL ret; + { +#if VERSION == VERSION_DEMO + print_error_check_c sp08(actor, print_error_check_c::sDELETE); +#endif + ret = fpcMtd_Delete((process_method_class*)actor->sub_method, actor); + } if (ret == TRUE) { fopAcTg_ActorQTo(&actor->actor_tag); fopDwTg_DrawQTo(&actor->draw_tag); diff --git a/src/f_pc/f_pc_manager.cpp b/src/f_pc/f_pc_manager.cpp index 29f83c50c..a3c7fe721 100644 --- a/src/f_pc/f_pc_manager.cpp +++ b/src/f_pc/f_pc_manager.cpp @@ -86,14 +86,18 @@ void messageSet(u32 status) { #endif const char * msg = (const char*)((u8*)inf1->getNext() + sizeof(JUTDataBlockHeader) + inf1->entries[status]); - J2DTextBox * tpane = new J2DTextBox('TXT1', JGeometry::TBox2(0.0f, 0.0f, 660.0f, 200.0f), (ResFONT*)font_data, msg, HBIND_CENTER, VBIND_CENTER); - JUT_ASSERT(VERSION_SELECT(0x12b, 0x12b, 0x141, 0x141), tpane != NULL); + f32 f30 = 0.0f; + f32 f31 = 660.0f; + f32 f29 = 200.0f; - J2DTextBox * spane = new J2DTextBox('TXT2', JGeometry::TBox2(0.0f, 0.0f, 660.0f, 200.0f), (ResFONT*)font_data, msg, HBIND_CENTER, VBIND_CENTER); - JUT_ASSERT(VERSION_SELECT(0x133, 0x133, 0x149, 0x149), spane != NULL); + J2DTextBox * tpane = new J2DTextBox('TXT1', JGeometry::TBox2(f30, f30, f30 + f31, f30 + f29), (ResFONT*)font_data, msg, HBIND_CENTER, VBIND_CENTER); + JUT_ASSERT(VERSION_SELECT(299, 299, 321, 321), tpane != NULL); + + J2DTextBox * spane = new J2DTextBox('TXT2', JGeometry::TBox2(f30, f30, f30 + f31, f30 + f29), (ResFONT*)font_data, msg, HBIND_CENTER, VBIND_CENTER); + JUT_ASSERT(VERSION_SELECT(307, 307, 329, 329), spane != NULL); J2DPicture * ppane = new J2DPicture('PIC1', JGeometry::TBox2(0.0f, 0.0f, 665.0f, 530.0f), (ResTIMG*)black_tex, NULL); - JUT_ASSERT(VERSION_SELECT(0x138, 0x138, 0x14e, 0x14e), ppane != NULL); + JUT_ASSERT(VERSION_SELECT(312, 312, 334, 334), ppane != NULL); J2DTextBox::TFontSize size; size.mSizeX = 27.0f; @@ -149,7 +153,7 @@ void messageSet(u32 status) { #endif #if VERSION <= VERSION_JPN - f32 x = -9.5f; + f32 x = -9.0f + (659.0f - f31) / 2.0f; // -9.5f; #else f32 x = (659.0f - maxWidth) / 2.0f + -9.0f; #endif @@ -165,8 +169,8 @@ void messageSet(u32 status) { tpane->draw(-9.0f, y + 10.0f, 660.0f, HBIND_CENTER); } #else - spane->draw(x + 2.0f, y + 10.0f + 2.0f, 660.0f, VERSION_SELECT(HBIND_CENTER, HBIND_CENTER, HBIND_LEFT, HBIND_LEFT)); - tpane->draw(x, y + 10.0f, 660.0f, VERSION_SELECT(HBIND_CENTER, HBIND_CENTER, HBIND_LEFT, HBIND_LEFT)); + spane->draw(x + 2.0f, y + 10.0f + 2.0f, f31, VERSION_SELECT(HBIND_CENTER, HBIND_CENTER, HBIND_LEFT, HBIND_LEFT)); + tpane->draw(x, y + 10.0f, f31, VERSION_SELECT(HBIND_CENTER, HBIND_CENTER, HBIND_LEFT, HBIND_LEFT)); #endif #if VERSION > VERSION_JPN @@ -179,6 +183,7 @@ void messageSet(u32 status) { /* 8003E9F0-8003EBD4 .text drawDvdCondition__Fl */ void drawDvdCondition(long status) { +#if VERSION > VERSION_DEMO #if VERSION == VERSION_PAL JUtility::TColor backColor = g_clearColor; #else @@ -194,6 +199,7 @@ void drawDvdCondition(long status) { draw2D.setOrtho(-9.0f, -21.0f, 659.0f, 524.0f, -1.0f, 1.0f); draw2D.setPort(); dComIfGp_setCurrentGrafPort(&draw2D); +#endif if (status == 4) { messageSet(2); @@ -205,6 +211,11 @@ void drawDvdCondition(long status) { messageSet(4); } else if (status == 1) { messageSet(0); +#if VERSION == VERSION_DEMO + } else { + messageSet(5); + } +#else } else if (status == -1) { messageSet(5); #if VERSION > VERSION_JPN @@ -213,11 +224,14 @@ void drawDvdCondition(long status) { } else { JUT_WARN(VERSION_SELECT(423, 423, 481, 478), "Dvd Error !! <%d>\n", status); } +#endif +#if VERSION > VERSION_DEMO JFWDisplay::getManager()->endRender(); #if VERSION == VERSION_PAL JFWDisplay::getManager()->setFader(NULL); #endif +#endif } /* 8003EBD4-8003EC84 .text checkDvdCondition__Fv */ @@ -232,8 +246,13 @@ int checkDvdCondition() { if (status == 0) { l_dvdError = 0; } else if (mDoRst::isReset()) { +#if VERSION == VERSION_DEMO + mDoRst_reset(1, 0x80000000, 1); + mDoRst::offReset(); +#else mDoRst::offReset(); mDoRst_reset(1, 0x80000000, 0); +#endif } else { drawDvdCondition(status); } @@ -246,16 +265,22 @@ int checkDvdCondition() { void fpcM_Management(fpcM_ManagementFunc callBack1, fpcM_ManagementFunc callBack2) { MtxInit(); +#if VERSION == VERSION_DEMO + cAPIGph_Painter(); +#endif + if (checkDvdCondition()) return; +#if VERSION > VERSION_DEMO cAPIGph_Painter(); +#endif fpcDt_Handler(); if (!fpcPi_Handler()) - JUT_ASSERT(VERSION_SELECT(490, 490, 548, 547), 0); + JUT_ASSERT(VERSION_SELECT(460, 490, 548, 547), 0); if (!fpcCt_Handler()) - JUT_ASSERT(VERSION_SELECT(494, 494, 552, 551), 0); + JUT_ASSERT(VERSION_SELECT(464, 494, 552, 551), 0); if (callBack1 != NULL) callBack1(); diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 13b0e74ba..8672e839c 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -32,8 +32,9 @@ #include "JSystem/JUtility/JUTXfb.h" #include "dolphin/base/PPCArch.h" -#include "weak_bss_936_to_1036.h" // IWYU pragma: keep -#include "weak_data_1811.h" // IWYU pragma: keep +#if VERSION == VERSION_DEMO +#include "weak_data_2100_2080.h" // IWYU pragma: keep +#endif JUTFader * mDoGph_gInf_c::mFader; ResTIMG * mDoGph_gInf_c::mFrameBufferTimg; @@ -894,131 +895,331 @@ void blockenc(u8* block) { u8 colors[16*3]; // sp18 u32 color_mags[4]; // sp08 u32 pix_idx; - u32 color_num = 0; // r11 - u32 i = 0; // r8 - pix_idx = 0; // r10 - for (; i < 0x30; i += 3, pix_idx += 4) { - u32 r9 = 0; // r9 - u8* pix = &block[pix_idx]; - for (int j = 0; j < color_num; j++) { - u8* temp = &colors[r9*3]; - if (temp[0] == pix[0] && temp[1] == pix[1] && temp[2] == pix[2]) { - break; + u32 color_num; + u32 i; + + u32 color_0_idx; + u32 color_1_idx; + + u32 r23; + u32 r18; + + u32 r0; + u32 g0; + u32 b0; + u32 r1; + u32 g1; + u32 b1; + u32 r2; + u32 g2; + u32 b2; + u32 r3; + u32 g3; + u32 b3; + u32 r4; + u32 g4; + u32 b4; + + u32 r21; + u32 r20; + u32 r22; + + u32 r11; + u32 r4_; + + u32 r6; + u32 r8; + + u32 r5; + u32 r24; + u32 r25; + + u32 r0_2 = 0x40; + if (r0_2 == 0x40) { + color_num = 0; // r11 + i = 0; // r8 + pix_idx = 0; // r10 + for (; i < 0x30; i += 3, pix_idx += 4) { + u32 r9 = 0; // r9 + u8* pix = &block[pix_idx]; + for (int j = 0; j < color_num; j++) { + u8* temp = &colors[r9*3]; + if (temp[0] == pix[0] && temp[1] == pix[1] && temp[2] == pix[2]) { + break; + } + r9++; + } + if (r9 == color_num) { + colors[r9*3 + 0] = pix[0]; + colors[r9*3 + 1] = pix[1]; + colors[r9*3 + 2] = pix[2]; + color_num += 1; } - r9++; } - if (r9 == color_num) { - colors[r9*3 + 0] = pix[0]; - colors[r9*3 + 1] = pix[1]; - colors[r9*3 + 2] = pix[2]; - color_num += 1; + + color_0_idx = 0; // r17 + color_1_idx = 0; // r16 + if (color_num > 1) { + r23 = 0; + r18 = INT32_MAX; + for (; r23 < color_num*3 - 3; r23 += 3) { + r0 = colors[r23+0] * 30; + g0 = colors[r23+1] * 59; + b0 = colors[r23+2] * 11; + for (r21 = r23+3; r21 < color_num*3 - 3; r21 += 3) { + r1 = colors[r21+0] * 30; + g1 = colors[r21+1] * 59; + b1 = colors[r21+2] * 11; + // r3 = (r0 * 5 + r1 * 3) / 8; + // g3 = (g0 * 5 + g1 * 3) / 8; + // b3 = (b0 * 5 + b1 * 3) / 8; + // r4 = (r1 * 5 + r0 * 3) / 8; + // g4 = (g1 * 5 + g0 * 3) / 8; + // b4 = (b1 * 5 + b0 * 3) / 8; + r20 = 0; // r20 + pix_idx = r20; // r19 + r22 = pix_idx; // r22 + for (; r22 < 0x10; r22++, pix_idx += 4) { + // b2 = block[pix_idx + 2] * 11; + // r2 = block[pix_idx + 0] * 30; + // g2 = block[pix_idx + 1] * 59; + color_mags[0] = COLOR_SQUARE_MAG(r0, g0, b0, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + color_mags[1] = COLOR_SQUARE_MAG(r1, g1, b1, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + r3 = (r0 * 5 + r1 * 3) / 8; + g3 = (g0 * 5 + g1 * 3) / 8; + b3 = (b0 * 5 + b1 * 3) / 8; + color_mags[2] = COLOR_SQUARE_MAG(r3, g3, b3, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + r4 = (r1 * 5 + r0 * 3) / 8; + g4 = (g1 * 5 + g0 * 3) / 8; + b4 = (b1 * 5 + b0 * 3) / 8; + color_mags[3] = COLOR_SQUARE_MAG(r4, g4, b4, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + + u32 r5 = 0; + u32 r6 = INT32_MAX; + for (; r5 < ARRAY_SIZE(color_mags); r5++) { + if (color_mags[r5] < r6) { + r6 = color_mags[r5]; + } + } + + r20 += r6; + } + + if (r20 < r18) { + r18 = r20; + color_0_idx = r23; + color_1_idx = r21; + } + } + } } - } - u32 color_0_idx = 0; // r17 - u32 color_1_idx = 0; // r16 - if (color_num > 1) { - u32 r23 = 0; - u32 r18 = INT32_MAX; - for (; r23 < color_num*3 - 3; r23 += 3) { - u32 r0 = colors[r23+0] * 30; - u32 g0 = colors[r23+1] * 59; - u32 b0 = colors[r23+2] * 11; - for (u32 r21 = r23+3; r21 < color_num*3 - 3; r21 += 3) { - u32 r1 = colors[r21+0] * 30; - u32 g1 = colors[r21+1] * 59; - u32 b1 = colors[r21+2] * 11; - u32 r20 = 0; // r20 - u32 pix_idx = 0; // r19 - u32 r22 = 0; // r22 - for (; r22 < 0x10; r22++, pix_idx += 4) { - // u32 b2 = block[pix_idx + 2] * 11; - // u32 r2 = block[pix_idx + 0] * 30; - // u32 g2 = block[pix_idx + 1] * 59; - color_mags[0] = COLOR_SQUARE_MAG(r0, g0, b0, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); - color_mags[1] = COLOR_SQUARE_MAG(r1, g1, b1, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); - u32 r3 = (r0 * 5 + r1 * 3) / 8; - u32 g3 = (g0 * 5 + g1 * 3) / 8; - u32 b3 = (b0 * 5 + b1 * 3) / 8; - color_mags[2] = COLOR_SQUARE_MAG(r3, g3, b3, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); - u32 r4 = (r1 * 5 + r0 * 3) / 8; - u32 g4 = (g1 * 5 + g0 * 3) / 8; - u32 b4 = (b1 * 5 + b0 * 3) / 8; - color_mags[3] = COLOR_SQUARE_MAG(r4, g4, b4, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + r11 = (colors[color_0_idx + 0] & 0xF8) << 8 | + (colors[color_0_idx + 1] & 0xFC) << 3 | + (colors[color_0_idx + 2] & 0xF8) >> 3; + r4_ = (colors[color_1_idx + 0] & 0xF8) << 8 | + (colors[color_1_idx + 1] & 0xFC) << 3 | + (colors[color_1_idx + 2] & 0xF8) >> 3; + if (r11 < r4_) { + u32 temp = r11; + r11 = r4_; + r4_ = temp; + } else if (r11 == r4_) { + r4_ = 0; + } + block[0x40] = r11 >> 8; + block[0x41] = r11 & 0xFF; + block[0x42] = r4_ >> 8; + block[0x43] = r4_ & 0xFF; - u32 r5 = 0; - u32 r6 = INT32_MAX; - for (; r5 < ARRAY_SIZE(color_mags); r5++) { - if (color_mags[r5] < r6) { - r6 = color_mags[r5]; + r0 = ((r11 >> 8) & 0xF8) * 30; + g0 = ((r11 >> 3) & 0xFC) * 59; + b0 = ((r11 << 3) & 0xFC) * 11; + r1 = ((r4_ >> 8) & 0xF8) * 30; + g1 = ((r4_ >> 3) & 0xFC) * 59; + b1 = ((r4_ << 3) & 0xFC) * 11; + r3 = (r0 * 5 + r1 * 3) / 8; + g3 = (g0 * 5 + g1 * 3) / 8; + b3 = (b0 * 5 + b1 * 3) / 8; + r4 = (r1 * 5 + r0 * 3) / 8; + g4 = (g1 * 5 + g0 * 3) / 8; + b4 = (b1 * 5 + b0 * 3) / 8; + r6 = 30; // r6 (bit offset within r8) + r8 = 0; // r8 (bitfield of color indexes) + pix_idx = r8; + for (; pix_idx < 0x40; pix_idx += 4) { + // b2 = block[pix_idx + 2] * 11; + // r2 = block[pix_idx + 0] * 30; + // g2 = block[pix_idx + 1] * 59; + color_mags[0] = COLOR_SQUARE_MAG(r0, g0, b0, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + color_mags[1] = COLOR_SQUARE_MAG(r1, g1, b1, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + color_mags[2] = COLOR_SQUARE_MAG(r3, g3, b3, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + color_mags[3] = COLOR_SQUARE_MAG(r4, g4, b4, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + + r24 = 0; + r5 = 0; + r25 = INT32_MAX; + u32 n = ARRAY_SIZE(color_mags) - r5; + for (; r5 < n; r5++) { + if (color_mags[r5] < r25) { + r25 = color_mags[r5]; + r24 = r5; + } + } + + r8 |= (r24 & 0x03) << r6; + r6 -= 2; + } + } else { // VERSION_DEMO only block (optimized out in retail) + pix_idx = 0; // r10 + color_num = pix_idx; // r11 + i = color_num; // r8 + for (; i < 0x30; i += 3, pix_idx += 4) { + u8* pix = &block[pix_idx]; + if (pix[3] == 0xFF) { + u32 r9 = 0; // r9 + for (int j = 0; j < color_num; j++) { + u8* temp = &colors[r9*3]; + if (temp[0] == pix[0] && temp[1] == pix[1] && temp[2] == pix[2]) { + break; + } + r9++; + } + if (r9 == color_num) { + colors[r9*3 + 0] = pix[0]; + colors[r9*3 + 1] = pix[1]; + colors[r9*3 + 2] = pix[2]; + color_num += 1; + } + } + } + + r4_ = (colors[0] & 0xF8) << 8 | + (colors[1] & 0xFC) << 3 | + (colors[2] & 0xF8) >> 3; + r11 = r4_; + + color_0_idx = 0; // r17 + color_1_idx = 0; // r16 + if (color_num > 1) { + r23 = 0; + r18 = INT32_MAX; + for (; r23 < color_num*3 - 3; r23 += 3) { + u8* colors_r10 = &colors[r23]; + r0 = colors_r10[0] * 30; + g0 = colors_r10[1] * 59; + b0 = colors_r10[2] * 11; + for (r21 = r23+3; r21 < color_num*3 - 3; r21 += 3) { + u8* colors_r11 = &colors[r21]; + r1 = colors_r11[0] * 30; + g1 = colors_r11[1] * 59; + b1 = colors_r11[2] * 11; + r3 = (r0 + r1) / 2; + g3 = (g0 + g1) / 2; + b3 = (b0 + b1) / 2; + r20 = 0; // r20 + pix_idx = r20; // r19 + r22 = pix_idx; // r22 + for (; r22 < 0x10; r22++, pix_idx += 4) { + if (block[pix_idx + 3] == 0xFF) { + // b2 = block[pix_idx + 2] * 11; + // r2 = block[pix_idx + 0] * 30; + // g2 = block[pix_idx + 1] * 59; + color_mags[0] = COLOR_SQUARE_MAG(r0, g0, b0, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + color_mags[1] = COLOR_SQUARE_MAG(r1, g1, b1, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + color_mags[2] = COLOR_SQUARE_MAG(r3, g3, b3, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + // r4 = (r1 * 5 + r0 * 3) / 8; + // g4 = (g1 * 5 + g0 * 3) / 8; + // b4 = (b1 * 5 + b0 * 3) / 8; + // color_mags[3] = COLOR_SQUARE_MAG(r4, g4, b4, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + + u32 r5 = 0; + u32 r6 = INT32_MAX; + for (; r5 < ARRAY_SIZE(color_mags); r5++) { + if (color_mags[r5] < r6) { + r6 = color_mags[r5]; + } + } + + r20 += r6; } } - r20 += r6; - } - - if (r20 < r18) { - r18 = r20; - color_0_idx = r23; - color_1_idx = r21; + if (r20 < r18) { + r18 = r20; + // color_0_idx = r23; + // color_1_idx = r21; + r11 = (colors_r10[0] & 0xF8) << 8 | + (colors_r10[1] & 0xFC) << 3 | + (colors_r10[2] & 0xF8) >> 3; + r4_ = (colors_r11[0] & 0xF8) << 8 | + (colors_r11[1] & 0xFC) << 3 | + (colors_r11[2] & 0xF8) >> 3; + } } } } - } - u32 r11 = (colors[color_0_idx + 0] & 0xF8) << 8 | - (colors[color_0_idx + 1] & 0xFC) << 3 | - (colors[color_0_idx + 2] & 0xF8) >> 3; - u32 r4 = (colors[color_1_idx + 0] & 0xF8) << 8 | - (colors[color_1_idx + 1] & 0xFC) << 3 | - (colors[color_1_idx + 2] & 0xF8) >> 3; - if (r11 < r4) { - u32 temp = r11; - r11 = r4; - r4 = temp; - } else if (r11 == r4) { - r4 = 0; - } - block[0x40] = r11 >> 8; - block[0x41] = r11 & 0xFF; - block[0x42] = r4 >> 8; - block[0x43] = r4 & 0xFF; - - u32 r0 = ((r11 >> 8) & 0xF8) * 30; - u32 g0 = ((r11 >> 3) & 0xFC) * 59; - u32 b0 = ((r11 << 3) & 0xFC) * 11; - u32 r1 = ((r4 >> 8) & 0xF8) * 30; - u32 g1 = ((r4 >> 3) & 0xFC) * 59; - u32 b1 = ((r4 << 3) & 0xFC) * 11; - u32 r6 = 30; // r6 (bit offset within r8) - u32 r8 = 0; // r8 (bitfield of color indexes) - for (pix_idx = 0; pix_idx < 0x40; pix_idx += 4) { - // u32 b2 = block[pix_idx + 2] * 11; - // u32 r2 = block[pix_idx + 0] * 30; - // u32 g2 = block[pix_idx + 1] * 59; - color_mags[0] = COLOR_SQUARE_MAG(r0, g0, b0, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); - color_mags[1] = COLOR_SQUARE_MAG(r1, g1, b1, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); - u32 r3 = (r0 * 5 + r1 * 3) / 8; - u32 g3 = (g0 * 5 + g1 * 3) / 8; - u32 b3 = (b0 * 5 + b1 * 3) / 8; - color_mags[2] = COLOR_SQUARE_MAG(r3, g3, b3, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); - u32 r4 = (r1 * 5 + r0 * 3) / 8; - u32 g4 = (g1 * 5 + g0 * 3) / 8; - u32 b4 = (b1 * 5 + b0 * 3) / 8; - color_mags[3] = COLOR_SQUARE_MAG(r4, g4, b4, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); - - u32 r5 = 0; - u32 r24; - u32 r25 = INT32_MAX; - for (; r5 < ARRAY_SIZE(color_mags); r5++) { - if (color_mags[r5] < r25) { - r25 = color_mags[r5]; - r24 = r5; - } + if (r11 > r4_) { + u32 temp = r11; + r11 = r4_; + r4_ = temp; + } else if (r11 == r4_) { + r4_ = 0; } + block[0x40] = r11 >> 8; + block[0x41] = r11 & 0xFF; + block[0x42] = r4_ >> 8; + block[0x43] = r4_ & 0xFF; - r8 |= (r24 & 0x03) << r6; - r6 -= 2; + r0 = (r11 >> 8) & 0xF8; + g0 = (r11 >> 3) & 0xFC; + b0 = (r11 << 3) & 0xFC; + r1 = (r4_ >> 8) & 0xF8; + g1 = (r4_ >> 3) & 0xFC; + b1 = (r4_ << 3) & 0xFC; + r0 *= 30; + g0 *= 59; + b0 *= 11; + r1 *= 30; + g1 *= 59; + b1 *= 11; + r3 = (r0 + r1) / 2; + g3 = (g0 + g1) / 2; + b3 = (b0 + b1) / 2; + // r6 = 30; // r6 (bit offset within r8) + r8 = 0; // r8 (bitfield of color indexes) + i = r8; + pix_idx = i; + for (; i < 0x10; i++, pix_idx += 4) { + if (block[pix_idx+3] == 0xFF) { + // b2 = block[pix_idx + 2] * 11; + // r2 = block[pix_idx + 0] * 30; + // g2 = block[pix_idx + 1] * 59; + color_mags[0] = COLOR_SQUARE_MAG(r0, g0, b0, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + color_mags[1] = COLOR_SQUARE_MAG(r1, g1, b1, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + color_mags[2] = COLOR_SQUARE_MAG(r3, g3, b3, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + // r4 = (r1 * 5 + r0 * 3) / 8; + // g4 = (g1 * 5 + g0 * 3) / 8; + // b4 = (b1 * 5 + b0 * 3) / 8; + // color_mags[3] = COLOR_SQUARE_MAG(r4, g4, b4, block[pix_idx+0] * 30, block[pix_idx+1] * 59, block[pix_idx+2] * 11); + + r5 = 0; + r24 = 0; + r25 = INT32_MAX; + u32 n = 3 - r24; + for (; r24 < n; r24++) { + if (color_mags[r24] < r25) { + r25 = color_mags[r24]; + r5 = r24; + } + } + } else { + r5 = 3; + } + + r8 |= (r5 & 0x03) << ((15 - i) * 2); + } } block[0x44] = r8 >> 24; @@ -1044,14 +1245,13 @@ u32 encode_s3tc(u8* r25, u8* r26, int r27, int r28, GXTexFmt fmt) { for (; r21 < 8; r21 += 4) { u32 r5 = 0; int r3 = 0; - u32 r10 = r21 + r23; for (; r3 < 4; r3++) { - u32 r4 = r3*8 + r10; + u32 r10 = r21 + r23; u32 r9 = 219; u32 r8 = 255; // r8 (alpha) - u8* r7 = &r25[r4]; for (int i = 0; i < 4; r5++, i++) { - u32 r11 = r7[i]; + u32 r4 = r3*8 + r10; + u32 r11 = r25[r4 + i]; if (i8low > r11) { i8low = r11; } @@ -1072,7 +1272,7 @@ u32 encode_s3tc(u8* r25, u8* r26, int r27, int r28, GXTexFmt fmt) { } } } - JUT_ASSERT(0x8A7, 16 <= i8low && i8high <= 235); + JUT_ASSERT(VERSION_SELECT(2172, 2429, 2215, 2222), 16 <= i8low && i8high <= 235); } else if (fmt == GX_TF_RGB565) { for (int r24 = 0; r24 < r28; r24 += 8) { for (int r29 = 0; r29 < r27; r29 += 8) { @@ -1087,9 +1287,8 @@ u32 encode_s3tc(u8* r25, u8* r26, int r27, int r28, GXTexFmt fmt) { u32 r5 = 255; // r5 (alpha) for (; r9 < 4; r9++) {//, r3 += 8) { u32 r10 = r9*8 + r6; - u16* r4 = (u16*)&r25[r10]; - for (int i = 0; i < 4; i++, r8++, r10 += 2, r4++) { - u32 r11 = *r4; + for (int i = 0; i < 4; i++, r8++, r10 += 2) { + u32 r11 = *(u16*)(&r25[r10]); block[r8*4+0] = (r11 >> 8) & 0xF8; block[r8*4+1] = (r11 >> 3) & 0xFC; block[r8*4+2] = (r11 << 3) & 0xF8; @@ -1112,7 +1311,8 @@ u32 encode_s3tc(u8* r25, u8* r26, int r27, int r28, GXTexFmt fmt) { for (; r21 < 8; r21 += 4) { u32 r4 = 0; for (int r5 = 0; r5 < 4; r5++) { - u32 r6 = r5 * 8 + r22 + 16 * (r29 + r21); + u32 r10 = r22 + 16 * (r29 + r21); + u32 r6 = r5 * 8 + r10; u32 r7 = r6 + 0x20; u32 r9 = 255; // r9 (alpha) for (int i = 0; i < 4; i++, r4++, r6 += 2, r7 += 2) { diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index d616f43d0..0e21d6e31 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -307,6 +307,7 @@ bool Debug_console(JUTGamePad* i_pad) { JUTReport(30, 420, 1, "SCROLL:%3d %3d %3d Output=%1x", console->getLineOffset(), console->getPositionX(), console->getPositionY(), console->getOutput()); } else { +#if VERSION > VERSION_DEMO if (i_pad->getTrigger() & CButton::DPAD_DOWN) { g_HIO.mDisplayMeter ^= 1; } @@ -329,6 +330,7 @@ bool Debug_console(JUTGamePad* i_pad) { gameHeap->dump_sort(); archiveHeap->dump_sort(); } +#endif JUTReport(30, 440, 1, "Press L+R trigger to control console."); JUTReport(30, 450, 1, "Press [Z] trigger to close this window."); } diff --git a/src/m_Do/m_Do_printf.cpp b/src/m_Do/m_Do_printf.cpp index 5b4ba3516..5753ae059 100644 --- a/src/m_Do/m_Do_printf.cpp +++ b/src/m_Do/m_Do_printf.cpp @@ -107,7 +107,7 @@ static u8 print_threadID; static u8 print_callerPC; static u8 print_callerPCLevel = 3; static u32 print_counts; -static u32 print_errors; +u32 print_errors; static u32 print_warings; static bool print_initialized;