diff --git a/CMakeLists.txt b/CMakeLists.txt index 6041b48622..eab45515a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,18 @@ elseif (MSVC) endif () +include(FetchContent) + +message(STATUS "dusk: Fetching cxxopts") +FetchContent_Declare( + cxxopts + GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git + GIT_TAG v3.3.1 +) + +FetchContent_MakeAvailable(cxxopts) + + include(files.cmake) # TODO: version handling for res includes @@ -56,7 +68,7 @@ source_group("dusk" FILES ${DUSK_FILES}) # game_debug is for game code files that we know work when compiled with DEBUG=1 # Of course, if building a release build, this distinction is irrelevant add_library(game_debug STATIC ${JSYSTEM_DEBUG_FILES} ${SSYSTEM_FILES}) -target_compile_definitions(game_debug PRIVATE TARGET_PC VERSION=0 $<$:DEBUG=1>) +target_compile_definitions(game_debug PRIVATE TARGET_PC AVOID_UB=1 VERSION=0 $<$:DEBUG=1>) # Make these properties PUBLIC so that the regular game target also sees them. target_include_directories(game_debug PUBLIC @@ -65,12 +77,13 @@ target_include_directories(game_debug PUBLIC assets/${DUSK_TP_VERSION} libs/JSystem/include extern/aurora/include/dolphin + extern ${CMAKE_SOURCE_DIR}/build/${DUSK_TP_VERSION}/include build/${DUSK_TP_VERSION}/include) target_link_libraries(game_debug PUBLIC aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -add_library(game SHARED ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${SSYSTEM_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES}) +add_library(game SHARED ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${SSYSTEM_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES} ${DOLPHIN_FILES}) # Hide global operator new/delete overrides from the dynamic symbol table. # Without this, other dylibs (e.g. Apple's AGX GPU driver) resolve these symbols @@ -88,10 +101,10 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL Linux) ) endif () -target_link_libraries(game PRIVATE game_debug) -target_compile_definitions(game PRIVATE TARGET_PC VERSION=0 NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0) +target_link_libraries(game PRIVATE game_debug cxxopts::cxxopts) +target_compile_definitions(game PRIVATE TARGET_PC AVOID_UB=1 VERSION=0 NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0) add_executable(dusk src/dusk/main.cpp) -target_compile_definitions(dusk PRIVATE TARGET_PC VERSION=0) +target_compile_definitions(dusk PRIVATE TARGET_PC AVOID_UB=1 VERSION=0) target_include_directories(dusk PRIVATE include) target_link_libraries(dusk PRIVATE game aurora::main) diff --git a/extern/aurora b/extern/aurora index 4e84141b08..2b4bac1b9e 160000 --- a/extern/aurora +++ b/extern/aurora @@ -1 +1 @@ -Subproject commit 4e84141b08095c34c5f50d2badbc7406d8db6e84 +Subproject commit 2b4bac1b9e193627e1266ac991b8e9ea941b841d diff --git a/files.cmake b/files.cmake index 7534864a45..8ab894658e 100644 --- a/files.cmake +++ b/files.cmake @@ -1317,10 +1317,18 @@ set(REL_FILES src/d/actor/d_a_warp_bug.cpp ) +set(DOLPHIN_FILES + libs/dolphin/src/gf/GFGeometry.cpp + libs/dolphin/src/gf/GFLight.cpp + libs/dolphin/src/gf/GFPixel.cpp + libs/dolphin/src/gf/GFTev.cpp +) + set(DUSK_FILES include/dusk/endian_gx.hpp src/dusk/asserts.cpp src/dusk/imgui.cpp + src/dusk/logging.cpp src/dusk/stubs.cpp src/dusk/endian.cpp src/dusk/extras.c @@ -1330,8 +1338,10 @@ set(DUSK_FILES src/dusk/dvd_emu.cpp src/dusk/imgui/imgui.hpp src/dusk/imgui/processes.cpp + src/dusk/imgui/camera.cpp src/dusk/imgui/debug_overlay.cpp src/dusk/imgui/heaps.cpp + src/dusk/imgui/kb_pad.cpp src/dusk/offset_ptr.cpp src/dusk/OSContext.cpp src/dusk/OSThread.cpp diff --git a/include/d/actor/d_a_formation_mng.h b/include/d/actor/d_a_formation_mng.h index 6555baeaac..79163f9cec 100644 --- a/include/d/actor/d_a_formation_mng.h +++ b/include/d/actor/d_a_formation_mng.h @@ -146,8 +146,8 @@ struct daFmtMng_c : public fopAc_ac_c { for (int i = 0; i < mFormationLine * mFormationRow; i++, member++) { fopAcM_delete(member->mNpcId); } - delete [] mPos; - delete [] mMember; + JKR_DELETE_ARRAY(mPos); + JKR_DELETE_ARRAY(mMember); } int getTimeHour() { diff --git a/include/d/actor/d_a_npc.h b/include/d/actor/d_a_npc.h index b453b41527..f9ebfaaa47 100644 --- a/include/d/actor/d_a_npc.h +++ b/include/d/actor/d_a_npc.h @@ -815,7 +815,7 @@ STATIC_ASSERT(sizeof(daNpcT_c) == 0xE40); #define daNpcT_ct(ptr, ClassName, faceMotionAnmData, motionAnmData, faceMotionSequenceData, faceMotionStepNum, motionSequenceData, motionStepNum, evtData, arcNames) \ if (!fopAcM_CheckCondition(ptr, fopAcCnd_INIT_e)) { \ - new (ptr) ClassName(faceMotionAnmData, motionAnmData, faceMotionSequenceData, faceMotionStepNum, motionSequenceData, motionStepNum, evtData, arcNames); \ + JKR_NEW_ARGS (ptr) ClassName(faceMotionAnmData, motionAnmData, faceMotionSequenceData, faceMotionStepNum, motionSequenceData, motionStepNum, evtData, arcNames); \ fopAcM_OnCondition(ptr, fopAcCnd_INIT_e); \ } diff --git a/include/d/actor/d_a_npc_fairy.h b/include/d/actor/d_a_npc_fairy.h index 3ab5901281..139555950a 100644 --- a/include/d/actor/d_a_npc_fairy.h +++ b/include/d/actor/d_a_npc_fairy.h @@ -51,7 +51,7 @@ public: } ~_Fairy_Feather_c() { if (mpMorf != NULL) { - delete mpMorf; + JKR_DELETE(mpMorf); mpMorf = NULL; } } diff --git a/include/d/actor/d_a_passer_mng.h b/include/d/actor/d_a_passer_mng.h index aa2a55c00f..7a628ebead 100644 --- a/include/d/actor/d_a_passer_mng.h +++ b/include/d/actor/d_a_passer_mng.h @@ -22,7 +22,7 @@ public: int getLuggageParamHigh(u32); int create(); void create_init(); - ~daPasserMng_c() { delete [] childProcIds; } + ~daPasserMng_c() { JKR_DELETE_ARRAY(childProcIds); } u8 getDetailLevel() { return argument; } u8 getPathID() { return fopAcM_GetParam(this); } diff --git a/include/d/d_cam_param.h b/include/d/d_cam_param.h index c3da29d8bd..d6ff7b46d7 100644 --- a/include/d/d_cam_param.h +++ b/include/d/d_cam_param.h @@ -92,15 +92,15 @@ public: struct dCamStyleData { struct StyleData { - /* 0x0 */ s32 field_0x0; - /* 0x4 */ u16 field_0x4; - /* 0x6 */ u16 mFlags; - /* 0x8 */ f32 mParams[28]; + /* 0x0 */ BE(s32) field_0x0; + /* 0x4 */ BE(u16) field_0x4; + /* 0x6 */ BE(u16) mFlags; + /* 0x8 */ BE(f32) mParams[28]; }; // Size: 0x78 /* 0x0 */ u8 field_0x0[4]; - /* 0x4 */ int mStyleNum; - /* 0x8 */ StyleData* mStyleData; + /* 0x4 */ BE(int) mStyleNum; + /* 0x8 */ StyleData mStyleData[1]; }; class dCamParam_c diff --git a/include/d/d_camera.h b/include/d/d_camera.h index f7a7132538..e1dca21855 100644 --- a/include/d/d_camera.h +++ b/include/d/d_camera.h @@ -87,7 +87,7 @@ struct dCamera_event_param { struct dCamera_type_data { /* 0x00 */ char name[24]; - /* 0x18 */ s16 field_0x18[2][11]; + /* 0x18 */ BE(s16) field_0x18[2][11]; }; // Size: 0x44 struct camSphChkdata { @@ -1086,7 +1086,11 @@ public: bool CheckFlag(u32 i_flag) { return (mEventFlags & i_flag) != 0 ? true : false; } +#if TARGET_PC + void ResetView(); +#else void ResetView() { setView(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT); } +#endif void clearInfo(dCamInfo_c* i_info, s16 param_1) { i_info->field_0x1e = param_1; diff --git a/include/d/d_cursor_mng.h b/include/d/d_cursor_mng.h index d8a84eb381..df2fef5b94 100644 --- a/include/d/d_cursor_mng.h +++ b/include/d/d_cursor_mng.h @@ -59,7 +59,7 @@ class dCsr_mng_c { }; bloObj_c() { - m_panes = new paneObj_c[1]; + m_panes = JKR_NEW paneObj_c[1]; m_screen = 0; } diff --git a/include/d/d_event_manager.h b/include/d/d_event_manager.h index ca74722502..590d20f25c 100644 --- a/include/d/d_event_manager.h +++ b/include/d/d_event_manager.h @@ -79,6 +79,7 @@ public: int getIsAddvance(int staffId); int getMyActIdx(int staffId, const char* const* action, int n_action, BOOL param_3, BOOL param_4); char* getMyNowCutName(int staffId); + char* getMyNowCutNameStr(int staffId); dEvDtData_c* getMyDataP(int staffId, const char* dataname, BOOL isSeekStart); void* getMySubstanceP(int staffId, const char* dataname, int datatype); int getMySubstanceNum(int staffId, const char* dataname); diff --git a/include/d/d_file_select.h b/include/d/d_file_select.h index 8cf8aa7dbc..810831a830 100644 --- a/include/d/d_file_select.h +++ b/include/d/d_file_select.h @@ -15,8 +15,8 @@ class dDlst_FileSel_c : public dDlst_base_c { public: void draw(); virtual ~dDlst_FileSel_c() { - delete Scr; - delete mMessageString; + JKR_DELETE(Scr); + JKR_DELETE(mMessageString); } dDlst_FileSel_c() { @@ -26,7 +26,7 @@ public: font[1] = mDoExt_getSubFont(); JUT_ASSERT(107, font[1] != NULL); - mMessageString = new dMsgString_c(); + mMessageString = JKR_NEW dMsgString_c(); JUT_ASSERT(110, mMessageString != NULL); } @@ -78,7 +78,7 @@ public: class dDlst_FileSelYn_c : public dDlst_base_c { public: void draw(); - virtual ~dDlst_FileSelYn_c() { delete ScrYn; } + virtual ~dDlst_FileSelYn_c() { JKR_DELETE(ScrYn); } /* 0x04 */ J2DScreen* ScrYn; /* 0x08 */ u8 field_0x08[4]; @@ -87,7 +87,7 @@ public: class dDlst_FileSelDt_c : public dDlst_base_c { public: void draw(); - virtual ~dDlst_FileSelDt_c() { delete ScrDt; } + virtual ~dDlst_FileSelDt_c() { JKR_DELETE(ScrDt); } /* 0x04 */ J2DScreen* ScrDt; /* 0x08 */ J2DPane* mpPane; @@ -97,7 +97,7 @@ public: class dDlst_FileSelCp_c : public dDlst_base_c { public: void draw(); - virtual ~dDlst_FileSelCp_c() { delete Scr; } + virtual ~dDlst_FileSelCp_c() { JKR_DELETE(Scr); } /* 0x04 */ J2DScreen* Scr; /* 0x08 */ bool isShow; @@ -108,7 +108,7 @@ public: class dDlst_FileSel3m_c : public dDlst_base_c { public: void draw(); - virtual ~dDlst_FileSel3m_c() { delete Scr3m; } + virtual ~dDlst_FileSel3m_c() { JKR_DELETE(Scr3m); } /* 0x04 */ J2DScreen* Scr3m; }; diff --git a/include/d/d_map_path_fmap.h b/include/d/d_map_path_fmap.h index 8aab7b32d6..582e92dfcd 100644 --- a/include/d/d_map_path_fmap.h +++ b/include/d/d_map_path_fmap.h @@ -14,7 +14,7 @@ public: ~fmpTresTypeGroupData_c() { if (mpNext != NULL) { - delete mpNext; + JKR_DELETE(mpNext); } } @@ -34,7 +34,7 @@ public: void addTypeGroupData(u8, dTres_c::data_s const*); ~fmpTresTypeGroupDataList_c() { if (mpTypeGroupDataHead != NULL) { - delete mpTypeGroupDataHead; + JKR_DELETE(mpTypeGroupDataHead); } } fmpTresTypeGroupDataList_c() { @@ -106,7 +106,7 @@ public: ~dMenu_Fmap_room_data_c() { if (mp_fmpTresTypeGroupDataListAll != NULL) { - delete mp_fmpTresTypeGroupDataListAll; + JKR_DELETE(mp_fmpTresTypeGroupDataListAll); } } diff --git a/include/dusk/endian.h b/include/dusk/endian.h index 58e9bd31ab..582d69cf64 100644 --- a/include/dusk/endian.h +++ b/include/dusk/endian.h @@ -209,6 +209,23 @@ struct BE { } }; +template <> +struct BE { + BE contents[3][4]; + + auto& operator[](int x) const { + return contents[x]; + } + + void to_host(Mtx& mtx) const { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 4; j++) { + mtx[i][j] = contents[i][j]; + } + } + } +}; + template void be_swap(T& val) { val = BE::swap(val); @@ -222,6 +239,13 @@ void be_swap(T (& val)[N]) { val = BE::swap(val); } +template +void be_swap(T array[], const u32 size) { + for (u32 i = 0; i < size; i++) { + be_swap(array[i]); + } +} + template<> inline void be_swap(Mtx44& val) { for (auto & x : val) { @@ -231,6 +255,15 @@ inline void be_swap(Mtx44& val) { } } +template<> +inline void be_swap(Mtx& val) { + for (auto & x : val) { + for (float & y : x) { + be_swap(y); + } + } +} + #define BE(T) BE #define BE_HOST(T) (T.host()) #else diff --git a/include/dusk/logging.h b/include/dusk/logging.h new file mode 100644 index 0000000000..7b52a54c1d --- /dev/null +++ b/include/dusk/logging.h @@ -0,0 +1,13 @@ +#ifndef DUSK_LOGGING_H +#define DUSK_LOGGING_H + +#include +#include + +void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message, unsigned int len); + +extern aurora::Module DuskLog; + +#define STUB_LOG() DuskLog.debug("{} is a stub", __FUNCTION__) + +#endif diff --git a/include/f_ap/f_ap_game.h b/include/f_ap/f_ap_game.h index 83f5909a29..fca2e70705 100644 --- a/include/f_ap/f_ap_game.h +++ b/include/f_ap/f_ap_game.h @@ -8,6 +8,8 @@ #include "CaptureScreen.h" #include +#include "JSystem/JKernel/JKRHeap.h" + void fapGm_After(); void fapGm_Create(); void fapGm_Execute(); @@ -28,7 +30,7 @@ public: static void executeCaptureScreen() {} static void createCaptureScreen() { - mCaptureScreen = new CaptureScreen(JFWDisplay::getManager()); + mCaptureScreen = JKR_NEW CaptureScreen(JFWDisplay::getManager()); JUT_ASSERT(46, mCaptureScreen != NULL); } diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index d0538422b7..ac6afb8f42 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -15,16 +15,9 @@ #include "dusk/endian_ssystem.h" #if !__MWERKS__ -// Modern compilers will zero the parent struct in default constructors. -// So instead of adding default constructors to everything, -// we'll just save & restore that data. -#define fopAcM_ct_placement_copy_length offsetof(fopAc_ac_c, actor_last_base_field) - offsetof(fopAc_ac_c, type) - -#define fopAcM_ct_placement(ptr, ClassName) \ - fopAc_ac_c copy; \ - memcpy(©.type, &(ptr)->type, fopAcM_ct_placement_copy_length); \ - new (ptr) ClassName() ; \ - memcpy(&(ptr)->type, ©.type, fopAcM_ct_placement_copy_length); +// mwerks compiler makes value initialization act like default initialization so we need +// to be explicit about default initialization in modern compilers +#define fopAcM_ct_placement(ptr, ClassName) JKR_NEW_ARGS (ptr) ClassName #else #define fopAcM_ct_placement(ptr, ClassName) new (ptr) ClassName() #endif diff --git a/include/m_Do/m_Do_dvd_thread.h b/include/m_Do/m_Do_dvd_thread.h index b4d6b36e62..8af8c520b5 100644 --- a/include/m_Do/m_Do_dvd_thread.h +++ b/include/m_Do/m_Do_dvd_thread.h @@ -4,6 +4,7 @@ #include "JSystem/JKernel/JKRArchive.h" #include #include +#include "JSystem/JKernel/JKRHeap.h" #include "f_pc/f_pc_node.h" #define mDoDvd_MOUNT_DIRECTION_HEAD 0 @@ -23,7 +24,7 @@ public: virtual ~mDoDvdThd_command_c(); mDoDvdThd_command_c(); inline s32 sync() { return mIsDone; } - inline void destroy() { delete this; } + inline void destroy() { JKR_DELETE(this); } virtual s32 execute() = 0; }; // Size = 0x14 diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h index 298af48593..8a22484582 100644 --- a/include/m_Do/m_Do_graphic.h +++ b/include/m_Do/m_Do_graphic.h @@ -4,6 +4,10 @@ #include "JSystem/JFramework/JFWDisplay.h" #include "m_Do/m_Do_mtx.h" #include "global.h" +#include "dusk/logging.h" +#if TARGET_PC +#include +#endif #if WIDESCREEN_SUPPORT #define FB_WIDTH (640) @@ -97,8 +101,7 @@ public: static int startFadeOut(int param_0) { return JFWDisplay::getManager()->startFadeOut(param_0); } static int startFadeIn(int param_0) { - printf("[DIAG] mDoGph_gInf_c::startFadeIn START\n"); - fflush(stdout); + DuskLog.debug("mDoGph_gInf_c::startFadeIn START"); return JFWDisplay::getManager()->startFadeIn(param_0); } static void setFadeColor(JUtility::TColor& color) { mFader->setColor(color); } static void setClearColor(JUtility::TColor color) { JFWDisplay::getManager()->setClearColor(color); } @@ -137,8 +140,20 @@ public: #endif } - static f32 getWidth() { return FB_WIDTH; } - static f32 getHeight() { return FB_HEIGHT; } + static f32 getWidth() { + #if TARGET_PC + return JUTVideo::getManager()->getFbWidth(); + #else + return FB_WIDTH; + #endif + } + static f32 getHeight() { + #if TARGET_PC + return JUTVideo::getManager()->getEfbHeight(); + #else + return FB_HEIGHT; + #endif + } static f32 getMinYF() { #if WIDESCREEN_SUPPORT @@ -266,6 +281,10 @@ public: static void setWideZoomLightProjection(Mtx& m); #endif + #if TARGET_PC + static void setWindowSize(AuroraWindowSize const& size); + #endif + static GXTexObj mFrameBufferTexObj; static GXTexObj mZbufferTexObj; static bloom_c m_bloom; diff --git a/libs/JSystem/include/JSystem/J2DGraph/J2DAnimation.h b/libs/JSystem/include/JSystem/J2DGraph/J2DAnimation.h index 0493541afe..3f166337c6 100644 --- a/libs/JSystem/include/JSystem/J2DGraph/J2DAnimation.h +++ b/libs/JSystem/include/JSystem/J2DGraph/J2DAnimation.h @@ -1,9 +1,10 @@ #ifndef J2DANIMATION_H #define J2DANIMATION_H -#include "JSystem/JMath/JMath.h" #include "JSystem/J3DGraphAnimator/J3DAnimation.h" #include "JSystem/JUtility/JUTPalette.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JMath/JMath.h" class J2DScreen; struct ResTIMG; @@ -74,14 +75,14 @@ public: J3D_PANIC(345, param_2 < mAnmTableNum[param_1], "Error : range over."); return &mVtxColorIndexData[param_1][param_2]; } - u16* getVtxColorIndexPointer(u8 param_0) const { + BE(u16)* getVtxColorIndexPointer(u8 param_0) const { J3D_PANIC(351, param_0 < 2, "Error : range over."); return mVtxColorIndexPointer[param_0]; } /* 0x10 */ u16 mAnmTableNum[2]; /* 0x14 */ J3DAnmVtxColorIndexData* mVtxColorIndexData[2]; - /* 0x1C */ u16* mVtxColorIndexPointer[2]; + /* 0x1C */ BE(u16)* mVtxColorIndexPointer[2]; }; // Size: 0x24 struct J3DTransformInfo; @@ -102,10 +103,10 @@ public: virtual void getColor(u8, u16, GXColor*) const; /* 0x24 */ J3DAnmColorKeyTable* mInfoTable[2]; - /* 0x2C */ s16* mRValues; - /* 0x30 */ s16* mGValues; - /* 0x34 */ s16* mBValues; - /* 0x38 */ s16* mAValues; + /* 0x2C */ BE(s16)* mRValues; + /* 0x30 */ BE(s16)* mGValues; + /* 0x34 */ BE(s16)* mBValues; + /* 0x38 */ BE(s16)* mAValues; }; // Size: 0x3C /** @@ -157,7 +158,7 @@ public: */ class J2DAnmTransform : public J2DAnmBase { public: - J2DAnmTransform(s16 frameMax, f32* pScaleValues, s16* pRotationValues, f32* pTranslateValues) : J2DAnmBase(frameMax) { + J2DAnmTransform(s16 frameMax, BE(f32)* pScaleValues, BE(s16)* pRotationValues, BE(f32)* pTranslateValues) : J2DAnmBase(frameMax) { mScaleValues = pScaleValues; mRotationValues = pRotationValues; mTranslateValues = pTranslateValues; @@ -166,9 +167,9 @@ public: virtual ~J2DAnmTransform() {} virtual void getTransform(u16, J3DTransformInfo*) const {} - /* 0x10 */ f32* mScaleValues; - /* 0x14 */ s16* mRotationValues; - /* 0x18 */ f32* mTranslateValues; + /* 0x10 */ BE(f32)* mScaleValues; + /* 0x14 */ BE(s16)* mRotationValues; + /* 0x18 */ BE(f32)* mTranslateValues; }; // Size: 0x1C /** @@ -250,25 +251,25 @@ public: /* 0x1A */ u16 field_0x1a; /* 0x1C */ u16 field_0x1c; /* 0x1E */ u16 field_0x1e; - /* 0x20 */ f32* mScaleValues; - /* 0x24 */ s16* mRotationValues; - /* 0x28 */ f32* mTranslationValues; + /* 0x20 */ BE(f32)* mScaleValues; + /* 0x24 */ BE(s16)* mRotationValues; + /* 0x28 */ BE(f32)* mTranslationValues; /* 0x2C */ u8* mUpdateTexMtxID; - /* 0x30 */ u16* mUpdateMaterialID; + /* 0x30 */ BE(u16)* mUpdateMaterialID; /* 0x34 */ JUTNameTab field_0x34; - /* 0x44 */ Vec* field_0x44; + /* 0x44 */ BE(Vec)* field_0x44; /* 0x48 */ u16 field_0x48; /* 0x4A */ u16 field_0x4a; /* 0x4C */ u16 field_0x4c; /* 0x4E */ u16 field_0x4e; - /* 0x50 */ f32* field_0x50; - /* 0x54 */ s16* field_0x54; - /* 0x58 */ f32* field_0x58; + /* 0x50 */ BE(f32)* field_0x50; + /* 0x54 */ BE(s16)* field_0x54; + /* 0x58 */ BE(f32)* field_0x58; /* 0x5C */ J3DAnmTransformKeyTable* field_0x5c; /* 0x60 */ u8* field_0x60; - /* 0x64 */ u16* field_0x64; + /* 0x64 */ BE(u16)* field_0x64; /* 0x68 */ JUTNameTab field_0x68; - /* 0x78 */ Vec* field_0x78; + /* 0x78 */ BE(Vec)* field_0x78; /* 0x7C */ int field_0x7c; }; @@ -284,7 +285,7 @@ public: mPalette = NULL; } ~J2DAnmTexPatternTIMGPointer() { - delete mPalette; + JKR_DELETE(mPalette); } /* 0x0 */ ResTIMG* mRes; @@ -304,7 +305,7 @@ public: ResTIMG* getResTIMG(u16) const; JUTPalette* getPalette(u16) const; - virtual ~J2DAnmTexPattern() { delete[] mTIMGPtrArray; } + virtual ~J2DAnmTexPattern() { JKR_DELETE_ARRAY(mTIMGPtrArray); } virtual void searchUpdateMaterialID(J2DScreen*); u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; } u16 getUpdateMaterialID(u16 i) const { @@ -313,11 +314,11 @@ public: } J3DAnmTexPatternFullTable* getAnmTable() const { return mAnmTable; } - /* 0x10 */ u16* mValues; + /* 0x10 */ BE(u16)* mValues; /* 0x14 */ J3DAnmTexPatternFullTable* mAnmTable; /* 0x18 */ u16 field_0x18; /* 0x1A */ u16 mUpdateMaterialNum; - /* 0x1C */ u16* mUpdateMaterialID; + /* 0x1C */ BE(u16)* mUpdateMaterialID; /* 0x20 */ JUTNameTab field_0x20; /* 0x30 */ J2DAnmTexPatternTIMGPointer* mTIMGPtrArray; }; @@ -368,20 +369,20 @@ public: /* 0x1E */ u16 field_0x1e; /* 0x20 */ u16 field_0x20; /* 0x22 */ u16 field_0x22; - /* 0x24 */ u16* mCRegUpdateMaterialID; + /* 0x24 */ BE(u16)* mCRegUpdateMaterialID; /* 0x28 */ JUTNameTab mCRegNameTab; - /* 0x38 */ u16* mKRegUpdateMaterialID; + /* 0x38 */ BE(u16)* mKRegUpdateMaterialID; /* 0x3C */ JUTNameTab mKRegNameTab; /* 0x4C */ J3DAnmCRegKeyTable* mAnmCRegKeyTable; /* 0x50 */ J3DAnmKRegKeyTable* mAnmKRegKeyTable; - /* 0x54 */ s16* mCRValues; - /* 0x58 */ s16* mCGValues; - /* 0x5C */ s16* mCBValues; - /* 0x60 */ s16* mCAValues; - /* 0x64 */ s16* mKRValues; - /* 0x68 */ s16* mKGValues; - /* 0x6C */ s16* mKBValues; - /* 0x70 */ s16* mKAValues; + /* 0x54 */ BE(s16)* mCRValues; + /* 0x58 */ BE(s16)* mCGValues; + /* 0x5C */ BE(s16)* mCBValues; + /* 0x60 */ BE(s16)* mCAValues; + /* 0x64 */ BE(s16)* mKRValues; + /* 0x68 */ BE(s16)* mKGValues; + /* 0x6C */ BE(s16)* mKBValues; + /* 0x70 */ BE(s16)* mKAValues; }; /** @@ -410,7 +411,7 @@ public: /* 0x14 */ u16 field_0x14; /* 0x16 */ u16 field_0x16; /* 0x18 */ u16 mUpdateMaterialNum; - /* 0x1C */ u16* mUpdateMaterialID; + /* 0x1C */ BE(u16)* mUpdateMaterialID; /* 0x20 */ JUTNameTab field_0x20; }; // Size: 0x30 @@ -430,10 +431,10 @@ public: virtual ~J2DAnmColorKey() {} virtual void getColor(u16, GXColor*) const; - /* 0x30 */ s16* mRValues; - /* 0x34 */ s16* mGValues; - /* 0x38 */ s16* mBValues; - /* 0x3C */ s16* mAValues; + /* 0x30 */ BE(s16)* mRValues; + /* 0x34 */ BE(s16)* mGValues; + /* 0x38 */ BE(s16)* mBValues; + /* 0x3C */ BE(s16)* mAValues; /* 0x40 */ J3DAnmColorKeyTable* mInfoTable; }; @@ -475,14 +476,14 @@ public: /* 0x40 */ J3DAnmColorFullTable* mInfoTable; }; -inline f32 J2DHermiteInterpolation(f32 f1, const f32* f2, const f32* f3, const f32* f4, const f32* f5, const f32* f6, - const f32* f7) { +inline f32 J2DHermiteInterpolation(f32 f1, const BE(f32)* f2, const BE(f32)* f3, const BE(f32)* f4, + const BE(f32)* f5, const BE(f32)* f6, const BE(f32)* f7) { return JMAHermiteInterpolation(f1, *f2, *f3, *f4, *f5, *f6, *f7); } -inline f32 J2DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16* pp2, __REGISTER s16* pp3, - __REGISTER s16* pp4, __REGISTER s16* pp5, __REGISTER s16* pp6, - __REGISTER s16* pp7) { +inline f32 J2DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER BE(s16)* pp2, __REGISTER BE(s16)* pp3, + __REGISTER BE(s16)* pp4, __REGISTER BE(s16)* pp5, __REGISTER BE(s16)* pp6, + __REGISTER BE(s16)* pp7) { #ifdef __MWERKS__ __REGISTER f32 p1 = pp1; __REGISTER f32 ff8; diff --git a/libs/JSystem/include/JSystem/J2DGraph/J2DManage.h b/libs/JSystem/include/JSystem/J2DGraph/J2DManage.h index ebbf3cf46d..27218d0d0d 100644 --- a/libs/JSystem/include/JSystem/J2DGraph/J2DManage.h +++ b/libs/JSystem/include/JSystem/J2DGraph/J2DManage.h @@ -10,8 +10,8 @@ class JSUInputStream; * */ struct J2DResReference { - /* 0x00 */ u16 mCount; - /* 0x02 */ u16 mOffsets[1]; + /* 0x00 */ BE(u16) mCount; + /* 0x02 */ BE(u16) mOffsets[1]; char* getResReference(u16) const; char* getName(u16) const; diff --git a/libs/JSystem/include/JSystem/J2DGraph/J2DPicture.h b/libs/JSystem/include/JSystem/J2DGraph/J2DPicture.h index 70761e972d..b054c97fae 100644 --- a/libs/JSystem/include/JSystem/J2DGraph/J2DPicture.h +++ b/libs/JSystem/include/JSystem/J2DGraph/J2DPicture.h @@ -47,7 +47,7 @@ struct J2DScrnBlockPictureParameter { /* 0x06 */ BE(u16) field_0x6; /* 0x08 */ BE(u16) field_0x8[4]; /* 0x10 */ JGeometry::TVec2 field_0x10[4]; - /* 0x20 */ u32 mCornerColor[4]; + /* 0x20 */ BE(u32) mCornerColor[4]; }; // Size: 0x30 /** diff --git a/libs/JSystem/include/JSystem/J2DGraph/J2DScreen.h b/libs/JSystem/include/JSystem/J2DGraph/J2DScreen.h index 6f959f56fc..ef83eee36e 100644 --- a/libs/JSystem/include/JSystem/J2DGraph/J2DScreen.h +++ b/libs/JSystem/include/JSystem/J2DGraph/J2DScreen.h @@ -30,7 +30,7 @@ struct J2DScrnInfoHeader { /* 0x4 */ BE(u32) mSize; /* 0x8 */ BE(u16) mWidth; /* 0xA */ BE(u16) mHeight; - /* 0xC */ u32 mColor; + /* 0xC */ BE(u32) mColor; }; /** diff --git a/libs/JSystem/include/JSystem/J2DGraph/J2DTextBox.h b/libs/JSystem/include/JSystem/J2DGraph/J2DTextBox.h index ff4781297a..f4d5345507 100644 --- a/libs/JSystem/include/JSystem/J2DGraph/J2DTextBox.h +++ b/libs/JSystem/include/JSystem/J2DGraph/J2DTextBox.h @@ -47,8 +47,8 @@ struct J2DTextBoxInfo { /* 0x14 */ BE(u32) mGradColor; /* 0x18 */ u8 mConnected; /* 0x19 */ char field_0x19[3]; - /* 0x1C */ u16 field_0x1c; - /* 0x1E */ u16 field_0x1e; + /* 0x1C */ BE(u16) field_0x1c; + /* 0x1E */ BE(u16) field_0x1e; }; // Size: 0x20 /** diff --git a/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DAnimation.h index 84f8625a84..81c363988f 100644 --- a/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -611,7 +611,7 @@ public: } bool isValidUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx] != 0xffff; } u32 getTexMtxCalcType() { return mTexMtxCalcType; } - Vec* getSRTCenter(u16 idx) { + BE(Vec)* getSRTCenter(u16 idx) { J3D_ASSERT_RANGE(1047, idx < mTrackNum / 3); return &mSRTCenter[idx]; } @@ -622,13 +622,13 @@ public: /* 0x16 */ u16 mScaleNum; /* 0x18 */ u16 mRotNum; /* 0x1A */ u16 mTransNum; - /* 0x1C */ f32* mScaleData; - /* 0x20 */ s16* mRotData; - /* 0x24 */ f32* mTransData; + /* 0x1C */ BE(f32)* mScaleData; + /* 0x20 */ BE(s16)* mRotData; + /* 0x24 */ BE(f32)* mTransData; /* 0x28 */ u8* mUpdateTexMtxID; - /* 0x2C */ u16* mUpdateMaterialID; + /* 0x2C */ BE(u16)* mUpdateMaterialID; /* 0x30 */ JUTNameTab mUpdateMaterialName; - /* 0x40 */ Vec* mSRTCenter; + /* 0x40 */ BE(Vec)* mSRTCenter; /* 0x44 */ u16 field_0x44; /* 0x46 */ u16 field_0x46; /* 0x48 */ u16 field_0x48; @@ -638,9 +638,9 @@ public: /* 0x54 */ void* field_0x54; /* 0x58 */ void* field_0x58; /* 0x5C */ u8* mPostUpdateTexMtxID; - /* 0x60 */ u16* mPostUpdateMaterialID; + /* 0x60 */ BE(u16)* mPostUpdateMaterialID; /* 0x64 */ JUTNameTab mPostUpdateMaterialName; - /* 0x74 */ Vec* mPostSRTCenter; + /* 0x74 */ BE(Vec)* mPostSRTCenter; /* 0x78 */ u32 mTexMtxCalcType; }; // Size: 0x7C @@ -787,7 +787,7 @@ public: /* 0x10 */ u16 field_0x10; /* 0x12 */ u16 field_0x12; /* 0x14 */ u16 mUpdateMaterialNum; - /* 0x18 */ u16* mUpdateMaterialID; + /* 0x18 */ BE(u16)* mUpdateMaterialID; /* 0x1C */ JUTNameTab mUpdateMaterialName; }; // Size: 0x2C @@ -822,10 +822,10 @@ public: virtual s32 getKind() const { return 11; } virtual void getColor(u16, GXColor*) const; - /* 0x2C */ s16* mColorR; - /* 0x30 */ s16* mColorG; - /* 0x34 */ s16* mColorB; - /* 0x38 */ s16* mColorA; + /* 0x2C */ BE(s16)* mColorR; + /* 0x30 */ BE(s16)* mColorG; + /* 0x34 */ BE(s16)* mColorB; + /* 0x38 */ BE(s16)* mColorA; /* 0x3C */ J3DAnmColorKeyTable* mAnmTable; }; @@ -872,20 +872,20 @@ public: /* 0x1A */ u16 mKRegDataCountG; /* 0x1C */ u16 mKRegDataCountB; /* 0x1E */ u16 mKRegDataCountA; - /* 0x20 */ u16* mCRegUpdateMaterialID; + /* 0x20 */ BE(u16)* mCRegUpdateMaterialID; /* 0x24 */ JUTNameTab mCRegUpdateMaterialName; - /* 0x34 */ u16* mKRegUpdateMaterialID; + /* 0x34 */ BE(u16)* mKRegUpdateMaterialID; /* 0x38 */ JUTNameTab mKRegUpdateMaterialName; /* 0x48 */ J3DAnmCRegKeyTable* mAnmCRegKeyTable; /* 0x4C */ J3DAnmKRegKeyTable* mAnmKRegKeyTable; - /* 0x50 */ s16* mAnmCRegDataR; - /* 0x54 */ s16* mAnmCRegDataG; - /* 0x58 */ s16* mAnmCRegDataB; - /* 0x5C */ s16* mAnmCRegDataA; - /* 0x60 */ s16* mAnmKRegDataR; - /* 0x64 */ s16* mAnmKRegDataG; - /* 0x68 */ s16* mAnmKRegDataB; - /* 0x6C */ s16* mAnmKRegDataA; + /* 0x50 */ BE(s16)* mAnmCRegDataR; + /* 0x54 */ BE(s16)* mAnmCRegDataG; + /* 0x58 */ BE(s16)* mAnmCRegDataB; + /* 0x5C */ BE(s16)* mAnmCRegDataA; + /* 0x60 */ BE(s16)* mAnmKRegDataR; + /* 0x64 */ BE(s16)* mAnmKRegDataG; + /* 0x68 */ BE(s16)* mAnmKRegDataB; + /* 0x6C */ BE(s16)* mAnmKRegDataA; }; // Size: 0x70 /** @@ -910,11 +910,11 @@ public: bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; } J3DAnmTexPatternFullTable* getAnmTable() { return mAnmTable; } - /* 0x0C */ u16* mTextureIndex; + /* 0x0C */ BE(u16)* mTextureIndex; /* 0x10 */ J3DAnmTexPatternFullTable* mAnmTable; /* 0x14 */ u16 field_0x14; /* 0x16 */ u16 mUpdateMaterialNum; - /* 0x18 */ u16* mUpdateMaterialID; + /* 0x18 */ BE(u16)* mUpdateMaterialID; /* 0x1C */ JUTNameTab mUpdateMaterialName; }; // Size: 0x2C diff --git a/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DJointTree.h b/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DJointTree.h index 9d357b6613..92b252fb7a 100644 --- a/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DJointTree.h +++ b/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DJointTree.h @@ -32,7 +32,7 @@ struct J3DDrawMtxData { /* 0x0 */ u16 mEntryNum; /* 0x2 */ u16 mDrawFullWgtMtxNum; /* 0x4 */ u8* mDrawMtxFlag; - /* 0x8 */ u16* mDrawMtxIndex; + /* 0x8 */ BE(u16)* mDrawMtxIndex; }; // Size: 0xC class J3DShapeTable; @@ -55,10 +55,10 @@ public: void setHierarchy(J3DModelHierarchy* hierarchy) { mHierarchy = hierarchy; } void setBasicMtxCalc(J3DMtxCalc* calc) { mBasicMtxCalc = calc; } u16 getWEvlpMtxNum() const { return mWEvlpMtxNum; } - u16* getWEvlpMixIndex() const { return mWEvlpMixMtxIndex; } + BE(u16)* getWEvlpMixIndex() const { return mWEvlpMixMtxIndex; } u8 getWEvlpMixMtxNum(u16 idx) const { return mWEvlpMixMtxNum[idx]; } - u16 * getWEvlpMixMtxIndex() const { return mWEvlpMixMtxIndex; } - f32 * getWEvlpMixWeight() const { return mWEvlpMixWeight; } + BE(u16) * getWEvlpMixMtxIndex() const { return mWEvlpMixMtxIndex; } + BE(f32) * getWEvlpMixWeight() const { return mWEvlpMixWeight; } u16 * getWEvlpImportantMtxIndex() const { return mWEvlpImportantMtxIdx; } u16 getDrawFullWgtMtxNum() const { return mDrawMtxData.mDrawFullWgtMtxNum; } u16 getJointNum() const { return mJointNum; } @@ -73,7 +73,7 @@ public: return mJointNodePointer[idx]; } J3DMtxCalc* getBasicMtxCalc() { return mBasicMtxCalc; } - Mtx& getInvJointMtx(int idx) { return mInvJointMtx[idx]; } + BE(Mtx)& getInvJointMtx(int idx) { return mInvJointMtx[idx]; } u32 getModelDataType() const { return mModelDataType; } void setModelDataType(u32 type) { mModelDataType = type; } bool checkFlag(u32 flag) const { return mFlags & flag ? true : false; } @@ -91,9 +91,9 @@ private: /* 0x1C */ u16 mJointNum; /* 0x1E */ u16 mWEvlpMtxNum; /* 0x20 */ u8* mWEvlpMixMtxNum; - /* 0x24 */ u16* mWEvlpMixMtxIndex; - /* 0x28 */ f32* mWEvlpMixWeight; - /* 0x2C */ Mtx* mInvJointMtx; + /* 0x24 */ BE(u16)* mWEvlpMixMtxIndex; + /* 0x28 */ BE(f32)* mWEvlpMixWeight; + /* 0x2C */ BE(Mtx)* mInvJointMtx; /* 0x30 */ u16* mWEvlpImportantMtxIdx; /* 0x34 */ J3DDrawMtxData mDrawMtxData; /* 0x40 */ u32 field_0x40; diff --git a/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DModelData.h b/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DModelData.h index f34b524df0..6e3d54ff45 100644 --- a/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DModelData.h +++ b/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DModelData.h @@ -38,6 +38,9 @@ public: } u32 getVtxNum() const { return mVertexData.getVtxNum(); } u32 getNrmNum() const { return mVertexData.getNrmNum(); } +#if TARGET_PC + u32 getColNum() const { return mVertexData.getColNum(); } +#endif u8 getDrawMtxFlag(u16 idx) const { return mJointTree.getDrawMtxFlag(idx); } u16 getDrawMtxIndex(u16 idx) const { return mJointTree.getDrawMtxIndex(idx); } J3DDrawMtxData* getDrawMtxData() { return mJointTree.getDrawMtxData(); } @@ -49,12 +52,12 @@ public: void setHierarchy(J3DModelHierarchy* hierarchy) { mJointTree.setHierarchy(hierarchy); } void setBasicMtxCalc(J3DMtxCalc* calc) { mJointTree.setBasicMtxCalc(calc); } JUTNameTab* getJointName() const { return mJointTree.getJointName(); } - Mtx& getInvJointMtx(int idx) { return mJointTree.getInvJointMtx(idx); } + BE(Mtx)& getInvJointMtx(int idx) { return mJointTree.getInvJointMtx(idx); } J3DTexture* getTexture() const { return mMaterialTable.getTexture(); } JUTNameTab* getTextureName() const { return mMaterialTable.getTextureName(); } u16 getWEvlpMtxNum() const { return mJointTree.getWEvlpMtxNum(); } - u16* getWEvlpMixMtxIndex() const { return mJointTree.getWEvlpMixMtxIndex(); } - f32* getWEvlpMixWeight() const { return mJointTree.getWEvlpMixWeight(); } + BE(u16)* getWEvlpMixMtxIndex() const { return mJointTree.getWEvlpMixMtxIndex(); } + BE(f32)* getWEvlpMixWeight() const { return mJointTree.getWEvlpMixWeight(); } u8 getWEvlpMixMtxNum(u16 idx) const { return mJointTree.getWEvlpMixMtxNum(idx); } u16* getWEvlpImportantMtxIndex() const { return mJointTree.getWEvlpImportantMtxIndex(); } u32 getModelDataType() const { return mJointTree.getModelDataType(); } diff --git a/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h b/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h index 64923d761d..e68b3ab02c 100644 --- a/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h +++ b/libs/JSystem/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h @@ -59,8 +59,8 @@ public: virtual void deform(J3DVertexBuffer*, J3DMtxBuffer*); virtual ~J3DSkinDeform(); - static u16* sWorkArea_WEvlpMixMtx[1024]; - static f32* sWorkArea_WEvlpMixWeight[1024]; + static BE(u16)* sWorkArea_WEvlpMixMtx[1024]; + static BE(f32)* sWorkArea_WEvlpMixWeight[1024]; static u16 sWorkArea_MtxReg[1024]; private: diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DMatBlock.h b/libs/JSystem/include/JSystem/J3DGraphBase/J3DMatBlock.h index caf638fe4e..402c5040b8 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -587,6 +587,9 @@ public: virtual void patchTexNoAndTexCoordScale() {} virtual void ptrToIndex() = 0; virtual void indexToPtr() = 0; +#if TARGET_PC + virtual void loadTexture() = 0; +#endif virtual u32 getType() = 0; virtual s32 countDLSize() { return 0; } virtual void setTexNo(u32, u16 const*) {} @@ -644,6 +647,7 @@ public: virtual void reset(J3DTevBlock*) {} virtual void ptrToIndex() {} virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } + virtual void loadTexture() {} virtual u32 getType() { return 'TVNL'; } virtual ~J3DTevBlockNull() {} }; @@ -671,6 +675,9 @@ public: virtual void patchTevReg(); virtual void patchTexNoAndTexCoordScale(); virtual void ptrToIndex(); +#if TARGET_PC + virtual void loadTexture(); +#endif virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } virtual u32 getType() { return 'TVPT'; } virtual void setTevStageNum(u8 const* num) { @@ -814,6 +821,9 @@ public: virtual void patchTexNoAndTexCoordScale(); virtual void ptrToIndex() {} virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } +#if TARGET_PC + virtual void loadTexture(); +#endif virtual u32 getType() { return 'TVB1'; } virtual s32 countDLSize(); virtual void setTexNo(u32 idx, u16 const* no) { @@ -904,6 +914,9 @@ public: virtual void patchTexNoAndTexCoordScale(); virtual void ptrToIndex() {} virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } +#if TARGET_PC + virtual void loadTexture(); +#endif virtual u32 getType() { return 'TVB2'; } virtual s32 countDLSize(); virtual void setTexNo(u32 idx, u16 const* texNo) { @@ -1080,6 +1093,9 @@ public: virtual void patchTexNoAndTexCoordScale(); virtual void ptrToIndex() {} virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } +#if TARGET_PC + virtual void loadTexture(); +#endif virtual u32 getType() { return 'TVB4'; } virtual s32 countDLSize(); virtual void setTexNo(u32 idx, u16 const* texNo) { @@ -1256,6 +1272,9 @@ public: virtual void patchTexNoAndTexCoordScale(); virtual void ptrToIndex(); virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } +#if TARGET_PC + virtual void loadTexture(); +#endif virtual u32 getType() { return 'TV16'; } virtual s32 countDLSize(); virtual void setTexNo(u32 idx, u16 const* texNo) { diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DMaterial.h b/libs/JSystem/include/JSystem/J3DGraphBase/J3DMaterial.h index 8103a83087..e9c2be1465 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DMaterial.h +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DMaterial.h @@ -56,7 +56,11 @@ public: J3DIndBlock* getIndBlock() { return mIndBlock; } J3DJoint* getJoint() { return mJoint; } J3DMaterialAnm* getMaterialAnm() { +#if TARGET_PC + return mMaterialAnm; +#else return (uintptr_t)mMaterialAnm < 0xC0000000 ? mMaterialAnm : NULL; +#endif } u32 getMaterialMode() { return mMaterialMode; } J3DNBTScale* getNBTScale() { return mTexGenBlock->getNBTScale(); } diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DShape.h b/libs/JSystem/include/JSystem/J3DGraphBase/J3DShape.h index 2a1ba0322b..5477868596 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DShape.h +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DShape.h @@ -15,8 +15,8 @@ class J3DShapeMtx; */ class J3DCurrentMtxInfo { public: - u32 mMtxIdxRegA; - u32 mMtxIdxRegB; + BE(u32) mMtxIdxRegA; + BE(u32) mMtxIdxRegB; }; /** @@ -122,7 +122,11 @@ public: initialize(); } +#if TARGET_PC + static const int kVcdVatDLSize = 0x180; +#else static const int kVcdVatDLSize = 0xC0; +#endif void initialize(); void addTexMtxIndexInDL(GXAttr, u32); diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DSys.h b/libs/JSystem/include/JSystem/J3DGraphBase/J3DSys.h index 417bd68790..9c806c92ba 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DSys.h +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DSys.h @@ -65,6 +65,11 @@ struct J3DSys { /* 0x10C */ void* mVtxPos; /* 0x110 */ void* mVtxNrm; /* 0x114 */ GXColor* mVtxCol; +#if TARGET_PC + int mVtxPosNum = 0; + int mVtxNrmNum = 0; + int mVtxColNum = 0; +#endif /* 0x118 */ BE(Vec)* mNBTScale; J3DSys(); @@ -151,21 +156,34 @@ struct J3DSys { void setModelNrmMtx(Mtx33* pMtxArr) { J3D_ASSERT_NULLPTR(241, pMtxArr); mModelNrmMtx = pMtxArr; - GXSETARRAY(GX_POS_MTX_ARRAY, mModelNrmMtx, sizeof(*mModelNrmMtx), sizeof(*mModelNrmMtx)); + GXSETARRAY(GX_NRM_MTX_ARRAY, mModelNrmMtx, sizeof(*mModelNrmMtx), sizeof(*mModelNrmMtx)); } void* getVtxPos() { return mVtxPos; } - void setVtxPos(void* pVtxPos) { + void setVtxPos(void* pVtxPos, int num) { J3D_ASSERT_NULLPTR(252, pVtxPos != NULL); mVtxPos = pVtxPos; +#if TARGET_PC + mVtxPosNum = num; +#endif } void* getVtxNrm() { return mVtxNrm; } - void setVtxNrm(void* pVtxNrm) { mVtxNrm = pVtxNrm; } + void setVtxNrm(void* pVtxNrm, int num) { + mVtxNrm = pVtxNrm; +#if TARGET_PC + mVtxNrmNum = num; +#endif + } void* getVtxCol() { return mVtxCol; } - void setVtxCol(GXColor* pVtxCol) { mVtxCol = pVtxCol; } + void setVtxCol(GXColor* pVtxCol, int num) { + mVtxCol = pVtxCol; +#if TARGET_PC + mVtxColNum = num; +#endif + } Mtx& getModelDrawMtx(u16 no) { return mModelDrawMtx[no]; } J3DShapePacket* getShapePacket() { return mShapePacket; } diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DTevs.h b/libs/JSystem/include/JSystem/J3DGraphBase/J3DTevs.h index 36d2b467c2..b0e2abfaae 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DTevs.h +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DTevs.h @@ -112,8 +112,8 @@ struct J3DTevStage { void setTexSel(u8 tex_sel) { mTevSwapModeInfo = (mTevSwapModeInfo & ~0xc) | (tex_sel << 2); } void load(u32 param_1) const { - J3DGDWriteBPCmd(*(u32*)&field_0x0); - J3DGDWriteBPCmd(*(u32*)&field_0x4); + J3DGDWriteBPCmd(*(BE(u32)*)&field_0x0); + J3DGDWriteBPCmd(*(BE(u32)*)&field_0x4); } J3DTevStage& operator=(const J3DTevStage& other) { diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DTexture.h b/libs/JSystem/include/JSystem/J3DGraphBase/J3DTexture.h index f179764e9b..5d5f96b813 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DTexture.h +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DTexture.h @@ -17,15 +17,45 @@ private: /* 0x2 */ u16 unk_0x2; /* 0x4 */ ResTIMG* mpRes; +#if TARGET_PC + GXTlutObj* mpTlutObj; + GXTexObj* mpTexObj; + u8** mpImgDataPtr; + u8** mpTlutDataPtr; +#endif + public: J3DTexture(u16 num, ResTIMG* res) : mNum(num), unk_0x2(0), mpRes(res) { J3D_ASSERT_NULLPTR(52, res != NULL || num == 0); +#if TARGET_PC + mpTexObj = new GXTexObj[num]; + mpTlutObj = new GXTlutObj[num]; + mpImgDataPtr = new u8*[num]; + mpTlutDataPtr = new u8*[num]; + for (u16 i = 0; i < num; i++) { + mpImgDataPtr[i] = (u8*)(&mpRes[i]) + mpRes[i].imageOffset; + mpTlutDataPtr[i] = (u8*)(&mpRes[i]) + mpRes[i].paletteOffset; + loadGXTexObj(i); + } +#endif } void loadGX(u16, GXTexMapID) const; +#if TARGET_PC + void loadGXTexObj(u16); +#endif void entryNum(u16); void addResTIMG(u16, ResTIMG const*); - virtual ~J3DTexture() {} + virtual ~J3DTexture(){ +#if TARGET_PC + for (int i = 0; i < mNum; i++) + GXDestroyTexObj(&mpTexObj[i]); + delete[] mpTexObj; + delete[] mpTlutObj; + delete[] mpImgDataPtr; + delete[] mpTlutDataPtr; +#endif + } u16 getNum() const { return mNum; } @@ -34,11 +64,24 @@ public: return &mpRes[index]; } +#if TARGET_PC + u8* getImgDataPtr(u16 index) const { + return mpImgDataPtr[index]; + } +#endif + void setResTIMG(u16 index, const ResTIMG& timg) { J3D_ASSERT_RANGE(81, index < mNum); mpRes[index] = timg; + +#if TARGET_PC + mpImgDataPtr[index] = ((u8*)&timg) + timg.imageOffset; + mpTlutDataPtr[index] = ((u8*)&timg) + timg.paletteOffset; + loadGXTexObj(index); +#else mpRes[index].imageOffset = ((mpRes[index].imageOffset + (uintptr_t)&timg - (uintptr_t)(mpRes + index))); mpRes[index].paletteOffset = ((mpRes[index].paletteOffset + (uintptr_t)&timg - (uintptr_t)(mpRes + index))); +#endif } }; diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DVertex.h b/libs/JSystem/include/JSystem/J3DGraphBase/J3DVertex.h index 84eea5ad2a..1638e316e9 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DVertex.h +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DVertex.h @@ -52,6 +52,22 @@ public: void setVtxNrmFrac(u8 frac) { mVtxNrmFrac = frac; } void setVtxNrmType(GXCompType type) { mVtxNrmType = type; } +#if TARGET_PC + u32 getVtxArrNum(GXAttr attr) const { + JUT_ASSERT(1234, attr >= GX_VA_POS && attr <= GX_VA_TEX7); + return mVtxArrNum[attr - GX_VA_POS]; + } + + u32 getVtxArrStride(GXAttr attr) const { + JUT_ASSERT(1234, attr >= GX_VA_POS && attr <= GX_VA_TEX7); + return mVtxArrStride[attr - GX_VA_POS]; + } + + u32 getVtxArrByteSize(GXAttr attr) const { + return getVtxArrNum(attr) * getVtxArrStride(attr); + } +#endif + private: friend class J3DModelLoader; @@ -70,6 +86,12 @@ private: /* 0x50 */ GXCompType mVtxPosType; /* 0x54 */ u8 mVtxNrmFrac; /* 0x58 */ GXCompType mVtxNrmType; + +#if TARGET_PC + bool mHasReadInformation = false; + u32 mVtxArrStride[12]{}; + u32 mVtxArrNum[12]{}; +#endif }; /** diff --git a/libs/JSystem/include/JSystem/J3DGraphLoader/J3DMaterialFactory.h b/libs/JSystem/include/JSystem/J3DGraphLoader/J3DMaterialFactory.h index 9e5f9f14fe..9bdaba4655 100644 --- a/libs/JSystem/include/JSystem/J3DGraphLoader/J3DMaterialFactory.h +++ b/libs/JSystem/include/JSystem/J3DGraphLoader/J3DMaterialFactory.h @@ -67,12 +67,12 @@ struct J3DIndInitData { * */ struct J3DPatchingInfo { - /* 0x0 */ u16 mMatColorOffset; - /* 0x2 */ u16 mColorChanOffset; - /* 0x4 */ u16 mTexMtxOffset; - /* 0x6 */ u16 mTexNoOffset; - /* 0x8 */ u16 mTevRegOffset; - /* 0xA */ u16 mFogOffset; + /* 0x0 */ BE(u16) mMatColorOffset; + /* 0x2 */ BE(u16) mColorChanOffset; + /* 0x4 */ BE(u16) mTexMtxOffset; + /* 0x6 */ BE(u16) mTexNoOffset; + /* 0x8 */ BE(u16) mTevRegOffset; + /* 0xA */ BE(u16) mFogOffset; /* 0xC */ u8 field_0xc[4]; }; // size 0x10 @@ -81,8 +81,8 @@ struct J3DPatchingInfo { * */ struct J3DDisplayListInit { - /* 0x0 */ u32 mOffset; - /* 0x4 */ u32 field_0x4; + /* 0x0 */ BE(u32) mOffset; + /* 0x4 */ BE(u32) field_0x4; }; // size 8 struct J3DTexCoord2Info; diff --git a/libs/JSystem/include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h b/libs/JSystem/include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h index 381c27a1e7..6b70201532 100644 --- a/libs/JSystem/include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h +++ b/libs/JSystem/include/JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h @@ -22,26 +22,26 @@ struct J3DMaterialInitData_v21 { /* 0x005 */ u8 mZCompLocIdx; /* 0x006 */ u8 mZModeIdx; /* 0x007 */ u8 mDitherIdx; - /* 0x008 */ u16 mMatColorIdx[2]; - /* 0x00C */ u16 mColorChanIdx[4]; - /* 0x014 */ u16 mTexCoordIdx[8]; + /* 0x008 */ BE(u16) mMatColorIdx[2]; + /* 0x00C */ BE(u16) mColorChanIdx[4]; + /* 0x014 */ BE(u16) mTexCoordIdx[8]; /* 0x024 */ u8 field_0x038[0x10]; - /* 0x034 */ u16 mTexMtxIdx[8]; + /* 0x034 */ BE(u16) mTexMtxIdx[8]; /* 0x044 */ u8 field_0x058[0x2c]; - /* 0x070 */ u16 mTexNoIdx[8]; - /* 0x080 */ u16 mTevKColorIdx[4]; + /* 0x070 */ BE(u16) mTexNoIdx[8]; + /* 0x080 */ BE(u16) mTevKColorIdx[4]; /* 0x088 */ u8 mTevKColorSel[0x10]; /* 0x098 */ u8 mTevKAlphaSel[0x10]; - /* 0x0A8 */ u16 mTevOrderIdx[0x10]; - /* 0x0C8 */ u16 mTevColorIdx[4]; - /* 0x0D0 */ u16 mTevStageIdx[0x10]; - /* 0x0F0 */ u16 mTevSwapModeIdx[0x10]; - /* 0x110 */ u16 mTevSwapModeTableIdx[4]; + /* 0x0A8 */ BE(u16) mTevOrderIdx[0x10]; + /* 0x0C8 */ BE(u16) mTevColorIdx[4]; + /* 0x0D0 */ BE(u16) mTevStageIdx[0x10]; + /* 0x0F0 */ BE(u16) mTevSwapModeIdx[0x10]; + /* 0x110 */ BE(u16) mTevSwapModeTableIdx[4]; /* 0x118 */ u8 field_0x12c[0x18]; - /* 0x130 */ u16 mFogIdx; - /* 0x132 */ u16 mAlphaCompIdx; - /* 0x134 */ u16 mBlendIdx; - /* 0x136 */ u16 mNBTScaleIdx; + /* 0x130 */ BE(u16) mFogIdx; + /* 0x132 */ BE(u16) mAlphaCompIdx; + /* 0x134 */ BE(u16) mBlendIdx; + /* 0x136 */ BE(u16) mNBTScaleIdx; }; // size 0x138 /** diff --git a/libs/JSystem/include/JSystem/J3DGraphLoader/J3DModelLoader.h b/libs/JSystem/include/JSystem/J3DGraphLoader/J3DModelLoader.h index 1aa2bfb13c..6c856f1a3d 100644 --- a/libs/JSystem/include/JSystem/J3DGraphLoader/J3DModelLoader.h +++ b/libs/JSystem/include/JSystem/J3DGraphLoader/J3DModelLoader.h @@ -309,6 +309,11 @@ public: /* 0x18 */ u8 field_0x18; /* 0x19 */ u8 field_0x19; /* 0x1A */ u16 mEnvelopeSize; + +#if TARGET_PC +private: + static void readVertexData(const J3DVertexBlock& block, J3DVertexData& data); +#endif }; /** diff --git a/libs/JSystem/include/JSystem/JAHostIO/JAHPubDefine.h b/libs/JSystem/include/JSystem/JAHostIO/JAHPubDefine.h index b67d462bc5..d2b0e6924a 100644 --- a/libs/JSystem/include/JSystem/JAHostIO/JAHPubDefine.h +++ b/libs/JSystem/include/JSystem/JAHostIO/JAHPubDefine.h @@ -1,6 +1,7 @@ #ifndef JAHPUBDEFINE_H #define JAHPUBDEFINE_H +#include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTAssert.h" template @@ -12,7 +13,7 @@ public: static T* newInstance() { JUT_ASSERT(82, sInstance==NULL); if (!sInstance) { - sInstance = new T(); + sInstance = JKR_NEW T(); } JUT_ASSERT(85, sInstance!=NULL); return sInstance; diff --git a/libs/JSystem/include/JSystem/JAudio2/JASHeapCtrl.h b/libs/JSystem/include/JSystem/JAudio2/JASHeapCtrl.h index c3bc1a3702..70f63bc889 100644 --- a/libs/JSystem/include/JSystem/JAudio2/JASHeapCtrl.h +++ b/libs/JSystem/include/JSystem/JAudio2/JASHeapCtrl.h @@ -209,12 +209,12 @@ public: return true; } MemoryChunk* pMVar4 = field_0x18; - field_0x18 = new (JASKernel::getSystemHeap(), 0) MemoryChunk(pMVar4); + field_0x18 = JKR_NEW_ARGS (JASKernel::getSystemHeap(), 0) MemoryChunk(pMVar4); if (field_0x18 != NULL) { return true; } JUT_WARN(428, "%s", "Not enough JASSystemHeap"); - field_0x18 = new (JKRHeap::getSystemHeap(), 0) MemoryChunk(pMVar4); + field_0x18 = JKR_NEW_ARGS (JKRHeap::getSystemHeap(), 0) MemoryChunk(pMVar4); if (field_0x18 != NULL) { return true; } @@ -246,7 +246,7 @@ public: bool r26 = false; if (chunk != field_0x18 && chunk->isEmpty()) { MemoryChunk* nextChunk = chunk->getNextChunk(); - delete chunk; + JKR_DELETE(chunk); prevChunk->setNextChunk(nextChunk); } return; @@ -283,6 +283,12 @@ namespace JASKernel { template class JASPoolAllocObject { public: +#if TARGET_PC + static void* operator new(size_t n, JKRHeapToken) { + return operator new(n); + } +#endif + static void* operator new(size_t n) { #if PLATFORM_GCN JASMemPool& memPool_ = getMemPool_(); @@ -292,6 +298,13 @@ public: static void* operator new(size_t n, void* ptr) { return ptr; } + +#if TARGET_PC + static void operator delete(void* ptr, size_t n, JKRHeapToken) { + operator delete(ptr, n); + } +#endif + static void operator delete(void* ptr, size_t n) { #if PLATFORM_GCN JASMemPool& memPool_ = getMemPool_(); @@ -362,6 +375,12 @@ public: template class JASPoolAllocObject_MultiThreaded { public: +#if TARGET_PC + static void* operator new(size_t n, JKRHeapToken) { + return operator new(n); + } +#endif + static void* operator new(size_t n) { #if PLATFORM_GCN JASMemPool_MultiThreaded& memPool_ = getMemPool(); @@ -371,6 +390,13 @@ public: static void* operator new(size_t n, void* ptr) { return ptr; } + +#if TARGET_PC + static void operator delete(void* ptr, size_t n, JKRHeapToken) { + return operator delete(ptr, n); + } +#endif + static void operator delete(void* ptr, size_t n) { #if PLATFORM_GCN JASMemPool_MultiThreaded& memPool_ = getMemPool(); diff --git a/libs/JSystem/include/JSystem/JGadget/pointer.h b/libs/JSystem/include/JSystem/JGadget/pointer.h index 9ea7c3af7d..6ed4fd57c2 100644 --- a/libs/JSystem/include/JSystem/JGadget/pointer.h +++ b/libs/JSystem/include/JSystem/JGadget/pointer.h @@ -1,6 +1,8 @@ #ifndef POINTER_H #define POINTER_H +#include "JSystem/JKernel/JKRHeap.h" + namespace JGadget { template @@ -18,12 +20,12 @@ public: #ifdef __MWERKS__ TPointer_delete(T* ptr) : TPointer(ptr) {} ~TPointer_delete() { - delete mPtr; + JKR_DELETE(mPtr); } #else TPointer_delete(T* ptr) : TPointer(ptr) {} ~TPointer_delete() { - delete this->mPtr; + JKR_DELETE(this->mPtr); } #endif }; diff --git a/libs/JSystem/include/JSystem/JGadget/std-memory.h b/libs/JSystem/include/JSystem/JGadget/std-memory.h index f9cccd9c7b..540f96d5a5 100644 --- a/libs/JSystem/include/JSystem/JGadget/std-memory.h +++ b/libs/JSystem/include/JSystem/JGadget/std-memory.h @@ -2,6 +2,7 @@ #define STD_MEMORY_H #include "JSystem/JUtility/JUTAssert.h" +#include "JSystem/JKernel/JKRHeap.h" namespace JGadget { template @@ -19,12 +20,12 @@ struct TAllocator { } void DeallocateRaw(void* mem) { - delete mem; + JKR_DELETE(mem); } void construct(T* p, const T& other) { JUT_ASSERT(67, p!=NULL); - new(p) T(other); + JKR_NEW_ARGS(p) T(other); } void destroy(T* p) { diff --git a/libs/JSystem/include/JSystem/JHostIO/JOREntry.h b/libs/JSystem/include/JSystem/JHostIO/JOREntry.h index b4ab15a7bf..197b6f9998 100644 --- a/libs/JSystem/include/JSystem/JHostIO/JOREntry.h +++ b/libs/JSystem/include/JSystem/JHostIO/JOREntry.h @@ -4,7 +4,9 @@ #include "JSystem/JHostIO/JHIComm.h" #include -template +#include "JSystem/JKernel/JKRHeap.h" + +template class JHIpvector { public: JHIpvector() { m_size = 0; } @@ -89,7 +91,7 @@ public: static JHIComPortManager* create() { if (instance == NULL) { - instance = new JHIComPortManager(); + instance = JKR_NEW JHIComPortManager(); } return instance; diff --git a/libs/JSystem/include/JSystem/JKernel/JKRAramHeap.h b/libs/JSystem/include/JSystem/JKernel/JKRAramHeap.h index 87a6e819a8..0d7734f6f4 100644 --- a/libs/JSystem/include/JSystem/JKernel/JKRAramHeap.h +++ b/libs/JSystem/include/JSystem/JKernel/JKRAramHeap.h @@ -5,9 +5,11 @@ #include "JSystem/JKernel/JKRDisposer.h" #include +#include "JKRHeap.h" + /** * @ingroup jsystem-jkernel - * + * */ class JKRAramHeap : public JKRDisposer { public: @@ -30,7 +32,7 @@ public: u32 getUsedSize(u8); void dump(); void free(JKRAramBlock *block) { - delete block; + JKR_DELETE(block); } u8 getCurrentGroupID() const { return mGroupId; } diff --git a/libs/JSystem/include/JSystem/JKernel/JKRHeap.h b/libs/JSystem/include/JSystem/JKernel/JKRHeap.h index 763718a585..7eaff3f448 100644 --- a/libs/JSystem/include/JSystem/JKernel/JKRHeap.h +++ b/libs/JSystem/include/JSystem/JKernel/JKRHeap.h @@ -224,21 +224,63 @@ public: #endif }; -#ifndef TARGET_PC -void* operator new(size_t size); -#endif -void* operator new(size_t size, int alignment); -void* operator new(size_t size, JKRHeap* heap, int alignment); +#if TARGET_PC +enum class JKRHeapToken { + Dummy +}; -#ifndef TARGET_PC -void* operator new[](size_t size); -#endif -void* operator new[](size_t size, int alignment); -void* operator new[](size_t size, JKRHeap* heap, int alignment); +inline void* operator new(size_t, JKRHeapToken, void* where) { + return where; +} -#ifndef TARGET_PC -void operator delete(void* ptr); +inline void* operator new[](size_t, JKRHeapToken, void* where) { + return where; +} + +#define JKR_NEW new (JKRHeapToken::Dummy) +#define JKR_NEW_ARGS(...) new (JKRHeapToken::Dummy, __VA_ARGS__ ) +#define JKR_DELETE(expr) jkrDelete(expr) +#define JKR_DELETE_ARRAY(expr) delete[] (expr) +#define JKR_HEAP_TOKEN , JKRHeapToken::Dummy +#define JKR_HEAP_TOKEN_PARAM , JKRHeapToken +#else +#define JKR_NEW new +#define JKR_NEW_ARGS(...) new (__VA_ARGS__ ) +#define JKR_DELETE(expr) delete (expr) +#define JKR_DELETE_ARRAY(expr) delete[] (expr) +#define JKR_HEAP_TOKEN +#define JKR_HEAP_TOKEN_PARAM +#endif + +void* operator new(size_t size JKR_HEAP_TOKEN_PARAM); +void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment); +void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment); + +void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM); +void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, int alignment); +void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment); + +void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM); void operator delete[](void* ptr); + +#if TARGET_PC +template +void jkrDelete(T* ptr) { + if (ptr == nullptr) { + return; + } + ptr->~T(); + operator delete(ptr, JKRHeapToken::Dummy); +} + +template<> +inline void jkrDelete(void* ptr) { + if (ptr == nullptr) { + return; + } + + operator delete(ptr, JKRHeapToken::Dummy); +} #endif void JKRDefaultMemoryErrorRoutine(void* heap, u32 size, int alignment); diff --git a/libs/JSystem/include/JSystem/JMath/JMath.h b/libs/JSystem/include/JSystem/JMath/JMath.h index 8c7f2ffad1..04d3cd543a 100644 --- a/libs/JSystem/include/JSystem/JMath/JMath.h +++ b/libs/JSystem/include/JSystem/JMath/JMath.h @@ -105,14 +105,15 @@ inline f32 JMAHermiteInterpolation(__REGISTER f32 p1, __REGISTER f32 p2, __REGIS // clang-format on return ff25; #else - f32 t = (p1 - p2) / (p5 - p2); - f32 t2 = t * t; - f32 t3 = t2 * t; - f32 h1 = 2.0f * t3 - 3.0f * t2 + 1.0f; - f32 h2 = -2.0f * t3 + 3.0f * t2; - f32 h3 = t3 - 2.0f * t2 + t; - f32 h4 = t3 - t2; - return h1 * p4 + h2 * p7 + h3 * (p3 - p4) + h4 * (p6 - p3); + f32 a = p1 - p2; + f32 b = a * (1.0 / (p5 - p2)); + f32 c = b - 1.0; + f32 d = (3.0 + -2.0 * b) * (b * b); + f32 cab = (c * a * b); + f32 coeffx3 = cab * p7; + f32 cca = (c * c * a); + f32 coeffc2 = cca * p4; + return ((1.0 - d) * p3 + (d * p6)) + coeffc2 + coeffx3; #endif } diff --git a/libs/JSystem/include/JSystem/JMessage/data.h b/libs/JSystem/include/JSystem/JMessage/data.h index e04e5e9a0c..0f7e4fda95 100644 --- a/libs/JSystem/include/JSystem/JMessage/data.h +++ b/libs/JSystem/include/JSystem/JMessage/data.h @@ -18,8 +18,8 @@ struct data { char* get() const { return (char*)getRaw(); } u32* get_signature() const { return (u32*)(get() + 0x0); } - u32 get_type() const { return *(u32*)(get() + 0x4); } - u32 get_blockNumber() const { return *(u32*)(get() + 0xC); } + u32 get_type() const { return *(BE(u32)*)(get() + 0x4); } + u32 get_blockNumber() const { return *(BE(u32)*)(get() + 0xC); } u32 get_encoding() const { return *(u8*)(get() + 0x10); } }; @@ -28,9 +28,9 @@ struct data { TParse_TBlock(const void* pData) : TParseData_aligned(pData) {} const char* get() const { return (char*)getRaw(); } - u32 get_size() const { return *(u32*)(get() + 0x4); } + u32 get_size() const { return *(BE(u32)*)(get() + 0x4); } const void* getNext() const { return (char*)getRaw() + get_size(); } - u32 get_type() const { return *(u32*)(get() + 0x0); } + u32 get_type() const { return *(BE(u32)*)(get() + 0x0); } }; // TParse_TBlock_info handles parsing INF1 section data @@ -41,11 +41,11 @@ struct data { char* getContent() const { return (char*)getRaw() + 0x10; } - u32 get_messageEntrySize() const { return *(u16*)(get() + 0xA); } + u32 get_messageEntrySize() const { return *(BE(u16)*)(get() + 0xA); } - u32 get_messageEntryNumber() const { return *(u16*)(get() + 0x8); } + u32 get_messageEntryNumber() const { return *(BE(u16)*)(get() + 0x8); } - u16 get_groupID() const { return *(u16*)(get() + 0xC); } + u16 get_groupID() const { return *(BE(u16)*)(get() + 0xC); } }; // TParse_TBlock_messageID handles parsing MID1 section data @@ -54,7 +54,7 @@ struct data { char* get() const { return (char*)getRaw(); } u8 get_formSupplement() const { return *(u8*)(get() + 0xB); } - int get_number() const { return *(u16*)(get() + 0x8); } + int get_number() const { return *(BE(u16)*)(get() + 0x8); } u32* getContent() const { return (u32*)((uintptr_t)getRaw() + 0x10); } u32 get_form() const { return *(u8*)(get() + 0xA) & 0xF; } bool get_isOrdered() const { return *(u8*)(get() + 0xA) & 0xF0; } @@ -81,8 +81,8 @@ struct data { static unsigned int getTagCode(u32 tag) { return tag & 0xFFFF; } static u8 getTagGroup(u32 tag) { return tag >> 0x10; } - static const u32 ga4cSignature; - static const u32 ga4cSignature_color; + static const BE(u32) ga4cSignature; + static const BE(u32) ga4cSignature_color; static const int gcTagBegin = '\x1A'; // All text Control Tags will begin with this character diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio/ctb.h b/libs/JSystem/include/JSystem/JStudio/JStudio/ctb.h index 1d5b2f5751..108d6f60f1 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio/ctb.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio/ctb.h @@ -28,11 +28,11 @@ inline const int TObject::NodeOffset = -(int)offsetof(TObject, ocObject_); struct data { struct THeaderData { - u32 signature; - u16 byteOrder; - u16 version; + BE(u32) signature; + BE(u16) byteOrder; + BE(u16) version; u8 field_0x0[4]; - u32 blockNumber; + BE(u32) blockNumber; u8 content[0]; }; diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio/fvb-data.h b/libs/JSystem/include/JSystem/JStudio/JStudio/fvb-data.h index 3932d0edc1..8e82a0c031 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio/fvb-data.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio/fvb-data.h @@ -34,18 +34,18 @@ struct CompositeOperation { }; struct TBlock { - /* 0x0 */ u32 size; - /* 0x4 */ u16 type; - /* 0x6 */ u16 id_size; + /* 0x0 */ BE(u32) size; + /* 0x4 */ BE(u16) type; + /* 0x6 */ BE(u16) id_size; /* 0x8 */ u8 id[0]; }; struct THeader { /* 0x00 */ char signature[4]; - /* 0x04 */ u16 byte_order; // must be 0xFEFF - /* 0x06 */ u16 version; // 0-1 = obselete, 2-7 = OK - /* 0x08 */ u32 _8; - /* 0x0C */ u32 block_number; + /* 0x04 */ BE(u16) byte_order; // must be 0xFEFF + /* 0x06 */ BE(u16) version; // 0-1 = obselete, 2-7 = OK + /* 0x08 */ BE(u32) _8; + /* 0x0C */ BE(u32) block_number; /* 0x10 */ u8 content[0]; }; // Parses a THeader diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio/fvb.h b/libs/JSystem/include/JSystem/JStudio/JStudio/fvb.h index fad21e5021..b04b2cbf1c 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio/fvb.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio/fvb.h @@ -115,8 +115,8 @@ private: class TObject_list : public TObject { public: struct ListData { - /* 0x0 */ f32 _0; - /* 0x4 */ u32 _4; + /* 0x0 */ BE(f32) _0; + /* 0x4 */ BE(u32) _4; /* 0x8 */ f32 _8[0]; }; TObject_list(data::TParse_TBlock const&); @@ -131,7 +131,7 @@ private: class TObject_list_parameter : public TObject { public: struct ListData { - u32 _0; + BE(u32) _0; f32 _4[0]; }; TObject_list_parameter(data::TParse_TBlock const&); @@ -146,7 +146,7 @@ private: struct TObject_hermite : public TObject { public: struct ListData { - u32 _0; // u : 28, uSize : 4 + BE(u32) _0; // u : 28, uSize : 4 f32 _4[0]; }; TObject_hermite(data::TParse_TBlock const&); diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio/jstudio-control.h b/libs/JSystem/include/JSystem/JStudio/JStudio/jstudio-control.h index 37622dfd1e..fd73d485b9 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio/jstudio-control.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio/jstudio-control.h @@ -16,7 +16,7 @@ struct TCreateObject { template static typename AdaptorT::ObjectType* createFromAdaptor(JStudio::stb::data::TParse_TBlock_object const& param_1, AdaptorT* param_2) { - typename AdaptorT::ObjectType* rv = new typename AdaptorT::ObjectType(param_1, param_2); + typename AdaptorT::ObjectType* rv = JKR_NEW typename AdaptorT::ObjectType(param_1, param_2); if (rv == NULL) { return NULL; } diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio/jstudio-object.h b/libs/JSystem/include/JSystem/JStudio/JStudio/jstudio-object.h index 72e24770bb..2fe984853f 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio/jstudio-object.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio/jstudio-object.h @@ -131,7 +131,7 @@ public: template T* createFromAdaptor(const stb::data::TParse_TBlock_object& param_0, T* param_1) { - T* n = new T(param_0, param_1); + T* n = JKR_NEW T(param_0, param_1); if (n == NULL) { return NULL; diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio/stb-data-parse.h b/libs/JSystem/include/JSystem/JStudio/JStudio/stb-data-parse.h index 80c94eeebf..f64174b7fc 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio/stb-data-parse.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio/stb-data-parse.h @@ -49,7 +49,7 @@ public: void getData(TData*) const; const void* get() const { return getRaw(); } - u32 get_head() const { return *(u32*)get(); } + u32 get_head() const { return BSWAP32(*(u32*)get()); } }; class TParse_TParagraph : public TParseData_aligned<4> { diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio/stb-data.h b/libs/JSystem/include/JSystem/JStudio/JStudio/stb-data.h index f66cd5f6f6..b7e3cd0f7b 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio/stb-data.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio/stb-data.h @@ -21,7 +21,7 @@ const int BLOCK_NONE = -1; // Used to expand a signed 24 int to a signed 32 int const u32 gu32Mask_TSequence_value_signExpansion = 0xFF000000; -extern const u32 ga4cSignature; // 'STB/0' +extern const BE(u32) ga4cSignature; // 'STB/0' extern const s32 gauDataSize_TEParagraph_data[8]; inline void toString_block(char* a5c, u32 arg1) { @@ -31,34 +31,34 @@ inline void toString_block(char* a5c, u32 arg1) { struct THeader { struct Target { /* 0x00 */ char name[8]; // "jstudio" - /* 0x08 */ u16 _8[3]; - /* 0x0E */ u16 target_version; + /* 0x08 */ BE(u16) _8[3]; + /* 0x0E */ BE(u16) target_version; }; /* 0x00 */ char signature[4]; - /* 0x04 */ u16 byte_order; // must be 0xFEFF - /* 0x06 */ u16 version; // 0-1 = obselete, 2-7 = OK - /* 0x08 */ u32 _8; - /* 0x0C */ u32 block_number; + /* 0x04 */ BE(u16) byte_order; // must be 0xFEFF + /* 0x06 */ BE(u16) version; // 0-1 = obselete, 2-7 = OK + /* 0x08 */ BE(u32) _8; + /* 0x0C */ BE(u32) block_number; /* 0x10 */ Target target; /* 0x20 */ u8 content[0]; }; struct TBlock { - /* 0x0 */ u32 size; - /* 0x4 */ u32 type; // char[4] JMSG, JSND, JACT, ... + /* 0x0 */ BE(u32) size; + /* 0x4 */ BE(u32) type; // char[4] JMSG, JSND, JACT, ... }; struct TBlock_object : TBlock { - /* 0x8 */ u16 flag; - /* 0xA */ u16 id_size; + /* 0x8 */ BE(u16) flag; + /* 0xA */ BE(u16) id_size; /* 0xC */ u8 id[0]; // unique identifier ///* ??? */ u8 content[0]; }; struct TParagraph { - /* 0x0 */ u16 _0; - /* 0x2 */ u16 id_size; + /* 0x0 */ BE(u16) _0; + /* 0x2 */ BE(u16) id_size; /* 0x4 */ u8 id[0]; // unique identifier }; diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio_JStage/control.h b/libs/JSystem/include/JSystem/JStudio/JStudio_JStage/control.h index 40cbaaeefe..1e8331206b 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio_JStage/control.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio_JStage/control.h @@ -321,7 +321,7 @@ template JStudio::TObject* createObject_JSG_(const JStudio::stb::data::TParse_TBlock_object& param_1, JStage::TObject* param_2, const JStage::TSystem* param_3) { ObjectT* objt = (ObjectT*)param_2; - AdaptorT* pAdaptor = new AdaptorT(param_3, objt); + AdaptorT* pAdaptor = JKR_NEW AdaptorT(param_3, objt); if (pAdaptor == NULL) { return NULL; } diff --git a/libs/JSystem/include/JSystem/JUtility/JUTGraphFifo.h b/libs/JSystem/include/JSystem/JUtility/JUTGraphFifo.h index 1680d00178..3ea6d2ec97 100644 --- a/libs/JSystem/include/JSystem/JUtility/JUTGraphFifo.h +++ b/libs/JSystem/include/JSystem/JUtility/JUTGraphFifo.h @@ -3,10 +3,12 @@ #include +#include "JSystem/JKernel/JKRHeap.h" + /** -* @ingroup jsystem-jutility -* -*/ + * @ingroup jsystem-jutility + * + */ class JUTGraphFifo { public: JUTGraphFifo(u32); @@ -40,6 +42,6 @@ private: /* 0x10 */ u8 field_0x10[0xC]; }; -inline JUTGraphFifo* JUTCreateFifo(u32 bufSize) { return new JUTGraphFifo(bufSize); } +inline JUTGraphFifo* JUTCreateFifo(u32 bufSize) { return JKR_NEW JUTGraphFifo(bufSize); } #endif /* JUTGRAPHFIFO_H */ diff --git a/libs/JSystem/include/JSystem/JUtility/JUTTexture.h b/libs/JSystem/include/JSystem/JUtility/JUTTexture.h index fbda4296e5..311f92a6b7 100644 --- a/libs/JSystem/include/JSystem/JUtility/JUTTexture.h +++ b/libs/JSystem/include/JSystem/JUtility/JUTTexture.h @@ -26,7 +26,7 @@ struct ResTIMG { /* 0x08 */ u8 indexTexture; /* 0x09 */ u8 colorFormat; /* 0x0A */ BE(u16) numColors; - /* 0x0C */ BE(u32) paletteOffset; + /* 0x0C */ BE(s32) paletteOffset; /* 0x10 */ u8 mipmapEnabled; /* 0x11 */ u8 doEdgeLOD; /* 0x12 */ u8 biasClamp; @@ -38,7 +38,7 @@ struct ResTIMG { /* 0x18 */ u8 mipmapCount; /* 0x19 */ u8 unknown; /* 0x1A */ BE(s16) LODBias; - /* 0x1C */ BE(u32) imageOffset; + /* 0x1C */ BE(s32) imageOffset; }; // Size: 0x20 /** diff --git a/libs/JSystem/include/JSystem/JUtility/JUTVideo.h b/libs/JSystem/include/JSystem/JUtility/JUTVideo.h index 6a988b6337..9a23a4dc7e 100644 --- a/libs/JSystem/include/JSystem/JUtility/JUTVideo.h +++ b/libs/JSystem/include/JSystem/JUtility/JUTVideo.h @@ -4,6 +4,9 @@ #include #include #include +#if TARGET_PC +#include +#endif typedef u8 (*Pattern)[2]; @@ -30,8 +33,20 @@ public: static void postRetraceProc(u32); static void drawDoneCallback(); - u16 getFbWidth() const { return mRenderObj->fbWidth; } - u16 getEfbHeight() const { return mRenderObj->efbHeight; } + u16 getFbWidth() const { + #if TARGET_PC + return m_WindowSize.fb_width; + #else + return mRenderObj->fbWidth; + #endif + } + u16 getEfbHeight() const { + #if TARGET_PC + return m_WindowSize.fb_height; + #else + return mRenderObj->efbHeight; + #endif + } void getBounds(u16& width, u16& height) const { width = (u16)getFbWidth(); height = (u16)getEfbHeight(); @@ -47,6 +62,9 @@ public: static OSTick getVideoLastTick() { return sVideoLastTick; } GXRenderModeObj* getRenderMode() const { return mRenderObj; } +#if TARGET_PC + void setWindowSize(AuroraWindowSize const& size); +#endif private: static JUTVideo* sManager; @@ -68,6 +86,11 @@ private: /* 0x30 */ s32 mSetBlackFrameCount; /* 0x34 */ OSMessage mMessage; /* 0x38 */ OSMessageQueue mMessageQueue; + +#if TARGET_PC +public: + AuroraWindowSize m_WindowSize; +#endif }; inline JUTVideo* JUTGetVideoManager() { diff --git a/libs/JSystem/include/JSystem/JUtility/TColor.h b/libs/JSystem/include/JSystem/JUtility/TColor.h index fdeadec5d4..d4a615b5b4 100644 --- a/libs/JSystem/include/JSystem/JUtility/TColor.h +++ b/libs/JSystem/include/JSystem/JUtility/TColor.h @@ -2,6 +2,7 @@ #define TCOLOR_H #include +#include "dusk/endian.h" namespace JUtility { @@ -14,11 +15,15 @@ struct TColor : public GXColor { TColor() { set(0xffffffff); } TColor(u32 u32Color) { set(u32Color); } TColor(GXColor color) { set(color); } +#if TARGET_PC + TColor(BE(u32) u32Color) { set(u32Color); } +#endif + // TColor(const TColor& other) { set(other.toUInt32()); } operator u32() const { return toUInt32(); } - u32 toUInt32() const { return *(u32*)&r; } + u32 toUInt32() const { return *(BE(u32)*)&r; } void set(u8 cR, u8 cG, u8 cB, u8 cA) { r = cR; @@ -27,7 +32,7 @@ struct TColor : public GXColor { a = cA; } - void set(u32 u32Color) { *(u32*)&r = u32Color; } + void set(u32 u32Color) { *(BE(u32)*)&r = u32Color; } void set(GXColor gxColor) { GXColor* temp = this; *temp = gxColor; diff --git a/libs/JSystem/src/J2DGraph/J2DAnimation.cpp b/libs/JSystem/src/J2DGraph/J2DAnimation.cpp index 92233d7af1..21df41d00b 100644 --- a/libs/JSystem/src/J2DGraph/J2DAnimation.cpp +++ b/libs/JSystem/src/J2DGraph/J2DAnimation.cpp @@ -152,7 +152,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, transformInfo->mScale.x = mScaleValues[xInf->mScaleInfo.mOffset]; break; default: - transformInfo->mScale.x = J2DGetKeyFrameInterpolation( + transformInfo->mScale.x = J2DGetKeyFrameInterpolation( param_0, &xInf->mScaleInfo, &mScaleValues[xInf->mScaleInfo.mOffset]); } switch (yInf->mScaleInfo.mMaxFrame) { @@ -163,7 +163,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, transformInfo->mScale.y = mScaleValues[yInf->mScaleInfo.mOffset]; break; default: - transformInfo->mScale.y = J2DGetKeyFrameInterpolation( + transformInfo->mScale.y = J2DGetKeyFrameInterpolation( param_0, &yInf->mScaleInfo, &mScaleValues[yInf->mScaleInfo.mOffset]); } switch (zInf->mScaleInfo.mMaxFrame) { @@ -174,7 +174,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, transformInfo->mScale.z = mScaleValues[zInf->mScaleInfo.mOffset]; break; default: - transformInfo->mScale.z = J2DGetKeyFrameInterpolation( + transformInfo->mScale.z = J2DGetKeyFrameInterpolation( param_0, &zInf->mScaleInfo, &mScaleValues[zInf->mScaleInfo.mOffset]); } switch (xInf->mRotationInfo.mMaxFrame) { @@ -186,7 +186,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, break; default: transformInfo->mRotation.x = - static_cast(J2DGetKeyFrameInterpolation( + static_cast(J2DGetKeyFrameInterpolation( param_0, &xInf->mRotationInfo, &mRotationValues[xInf->mRotationInfo.mOffset])) << field_0x24; } @@ -199,7 +199,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, break; default: transformInfo->mRotation.y = - static_cast(J2DGetKeyFrameInterpolation( + static_cast(J2DGetKeyFrameInterpolation( param_0, &yInf->mRotationInfo, &mRotationValues[yInf->mRotationInfo.mOffset])) << field_0x24; } @@ -212,7 +212,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, break; default: transformInfo->mRotation.z = - static_cast(J2DGetKeyFrameInterpolation( + static_cast(J2DGetKeyFrameInterpolation( param_0, &zInf->mRotationInfo, &mRotationValues[zInf->mRotationInfo.mOffset])) << field_0x24; } @@ -224,7 +224,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, transformInfo->mTranslate.x = mTranslateValues[xInf->mTranslateInfo.mOffset]; break; default: - transformInfo->mTranslate.x = J2DGetKeyFrameInterpolation( + transformInfo->mTranslate.x = J2DGetKeyFrameInterpolation( param_0, &xInf->mTranslateInfo, &mTranslateValues[xInf->mTranslateInfo.mOffset]); } switch (yInf->mTranslateInfo.mMaxFrame) { @@ -235,7 +235,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, transformInfo->mTranslate.y = mTranslateValues[yInf->mTranslateInfo.mOffset]; break; default: - transformInfo->mTranslate.y = J2DGetKeyFrameInterpolation( + transformInfo->mTranslate.y = J2DGetKeyFrameInterpolation( param_0, &yInf->mTranslateInfo, &mTranslateValues[yInf->mTranslateInfo.mOffset]); } switch (zInf->mTranslateInfo.mMaxFrame) { @@ -246,7 +246,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, transformInfo->mTranslate.z = mTranslateValues[zInf->mTranslateInfo.mOffset]; break; default: - transformInfo->mTranslate.z = J2DGetKeyFrameInterpolation( + transformInfo->mTranslate.z = J2DGetKeyFrameInterpolation( param_0, &zInf->mTranslateInfo, &mTranslateValues[zInf->mTranslateInfo.mOffset]); } } @@ -315,7 +315,7 @@ void J2DAnmColorKey::getColor(u16 param_0, GXColor* pColor) const { pColor->r = mRValues[info->mRInfo.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mRInfo, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mRInfo, &mRValues[info->mRInfo.mOffset]); if (val < 0) { pColor->r = 0; @@ -333,7 +333,7 @@ void J2DAnmColorKey::getColor(u16 param_0, GXColor* pColor) const { pColor->g = mGValues[info->mGInfo.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mGInfo, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mGInfo, &mGValues[info->mGInfo.mOffset]); if (val < 0) { pColor->g = 0; @@ -351,7 +351,7 @@ void J2DAnmColorKey::getColor(u16 param_0, GXColor* pColor) const { pColor->b = mBValues[info->mBInfo.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mBInfo, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mBInfo, &mBValues[info->mBInfo.mOffset]); if (val < 0) { pColor->b = 0; @@ -369,7 +369,7 @@ void J2DAnmColorKey::getColor(u16 param_0, GXColor* pColor) const { pColor->a = mAValues[info->mAInfo.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mAInfo, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mAInfo, &mAValues[info->mAInfo.mOffset]); if (val < 0) { pColor->a = 0; @@ -430,7 +430,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, GXColor* pColor) const pColor->r = mRValues[info->mRInfo.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mRInfo, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mRInfo, &mRValues[info->mRInfo.mOffset]); if ((val <= 0)) { pColor->r = 0; @@ -448,7 +448,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, GXColor* pColor) const pColor->g = mGValues[info->mGInfo.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mGInfo, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mGInfo, &mGValues[info->mGInfo.mOffset]); if (val <= 0) { pColor->g = 0; @@ -466,7 +466,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, GXColor* pColor) const pColor->b = mBValues[info->mBInfo.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mBInfo, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mBInfo, &mBValues[info->mBInfo.mOffset]); if (val <= 0) { pColor->b = 0; @@ -484,7 +484,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, GXColor* pColor) const pColor->a = mAValues[info->mAInfo.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mAInfo, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mAInfo, &mAValues[info->mAInfo.mOffset]); if (val <= 0) { pColor->a = 0; @@ -511,7 +511,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI pInfo->mScaleX = mScaleValues[xInf->mScaleInfo.mOffset]; break; default: - pInfo->mScaleX = J2DGetKeyFrameInterpolation(param_0, &xInf->mScaleInfo, + pInfo->mScaleX = J2DGetKeyFrameInterpolation(param_0, &xInf->mScaleInfo, &mScaleValues[xInf->mScaleInfo.mOffset]); } switch (yInf->mScaleInfo.mMaxFrame) { @@ -522,7 +522,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI pInfo->mScaleY = mScaleValues[yInf->mScaleInfo.mOffset]; break; default: - pInfo->mScaleY = J2DGetKeyFrameInterpolation(param_0, &yInf->mScaleInfo, + pInfo->mScaleY = J2DGetKeyFrameInterpolation(param_0, &yInf->mScaleInfo, &mScaleValues[yInf->mScaleInfo.mOffset]); } switch (zInf->mRotationInfo.mMaxFrame) { @@ -534,7 +534,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI break; default: pInfo->mRotation = - static_cast(J2DGetKeyFrameInterpolation( + static_cast(J2DGetKeyFrameInterpolation( param_0, &zInf->mRotationInfo, &mRotationValues[zInf->mRotationInfo.mOffset])) << field_0x10; } @@ -546,7 +546,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI pInfo->mTranslationX = mTranslationValues[xInf->mTranslateInfo.mOffset]; break; default: - pInfo->mTranslationX = J2DGetKeyFrameInterpolation( + pInfo->mTranslationX = J2DGetKeyFrameInterpolation( param_0, &xInf->mTranslateInfo, &mTranslationValues[xInf->mTranslateInfo.mOffset]); } switch (yInf->mTranslateInfo.mMaxFrame) { @@ -557,7 +557,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI pInfo->mTranslationY = mTranslationValues[yInf->mTranslateInfo.mOffset]; break; default: - pInfo->mTranslationY = J2DGetKeyFrameInterpolation( + pInfo->mTranslationY = J2DGetKeyFrameInterpolation( param_0, &yInf->mTranslateInfo, &mTranslationValues[yInf->mTranslateInfo.mOffset]); } } @@ -585,8 +585,8 @@ void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* pScreen) { mUpdateMaterialID[entry] = 0xFFFF; } } - delete[] mTIMGPtrArray; - mTIMGPtrArray = new J2DAnmTexPatternTIMGPointer[pScreen->mTexRes->mCount]; + JKR_DELETE_ARRAY(mTIMGPtrArray); + mTIMGPtrArray = JKR_NEW J2DAnmTexPatternTIMGPointer[pScreen->mTexRes->mCount]; if (mTIMGPtrArray != NULL) { JUTResReference resRef; for (u16 i = 0; i < pScreen->mTexRes->mCount; i++) { @@ -601,7 +601,7 @@ void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* pScreen) { } mTIMGPtrArray[i].mRes = var2; if (var2 != NULL && var2->indexTexture) { - mTIMGPtrArray[i].mPalette = new JUTPalette( + mTIMGPtrArray[i].mPalette = JKR_NEW JUTPalette( GX_TLUT0, GXTlutFmt(var2->colorFormat), JUTTransparency(var2->alphaEnabled), @@ -676,7 +676,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const { pColor->r = mCRValues[info->mRTable.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mRTable, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mRTable, &mCRValues[info->mRTable.mOffset]); if (val < -0x400) { pColor->r = -0x400; @@ -694,7 +694,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const { pColor->g = mCGValues[info->mGTable.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mGTable, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mGTable, &mCGValues[info->mGTable.mOffset]); if (val < -0x400) { pColor->g = -0x400; @@ -712,7 +712,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const { pColor->b = mCBValues[info->mBTable.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mBTable, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mBTable, &mCBValues[info->mBTable.mOffset]); if (val < -0x400) { pColor->b = -0x400; @@ -730,7 +730,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const { pColor->a = mCAValues[info->mATable.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mATable, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mATable, &mCAValues[info->mATable.mOffset]); if (val < -0x400) { pColor->a = -0x400; @@ -755,7 +755,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const { pColor->r = mKRValues[info->mRTable.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mRTable, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mRTable, &mKRValues[info->mRTable.mOffset]); if (val < 0) { pColor->r = 0; @@ -773,7 +773,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const { pColor->g = mKGValues[info->mGTable.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mGTable, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mGTable, &mKGValues[info->mGTable.mOffset]); if (val < 0) { pColor->g = 0; @@ -791,7 +791,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const { pColor->b = mKBValues[info->mBTable.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mBTable, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mBTable, &mKBValues[info->mBTable.mOffset]); if (val < 0) { pColor->b = 0; @@ -809,7 +809,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const { pColor->a = mKAValues[info->mATable.mOffset]; break; default: - val = J2DGetKeyFrameInterpolation(mFrame, &info->mATable, + val = J2DGetKeyFrameInterpolation(mFrame, &info->mATable, &mKAValues[info->mATable.mOffset]); if (val < 0) { pColor->a = 0; diff --git a/libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp b/libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp index 176f4e24ec..360cb13952 100644 --- a/libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp +++ b/libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp @@ -18,13 +18,13 @@ J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) { switch (hdr->mType) { case 'bck1': { J2DAnmKeyLoader_v15 loader; - loader.mpResource = new J2DAnmTransformKey(); + loader.mpResource = JKR_NEW J2DAnmTransformKey(); return (J2DAnmBase*)loader.load(p_data); break; } case 'bpk1': { J2DAnmKeyLoader_v15 loader; - loader.mpResource = new J2DAnmColorKey(); + loader.mpResource = JKR_NEW J2DAnmColorKey(); return (J2DAnmBase*)loader.load(p_data); break; } @@ -33,42 +33,42 @@ J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) { return NULL; case 'btk1': { J2DAnmKeyLoader_v15 loader; - loader.mpResource = new J2DAnmTextureSRTKey(); + loader.mpResource = JKR_NEW J2DAnmTextureSRTKey(); return (J2DAnmBase*)loader.load(p_data); break; } case 'brk1': { J2DAnmKeyLoader_v15 loader; - loader.mpResource = new J2DAnmTevRegKey(); + loader.mpResource = JKR_NEW J2DAnmTevRegKey(); return (J2DAnmBase*)loader.load(p_data); break; } case 'bxk1': { J2DAnmKeyLoader_v15 loader; - loader.mpResource = new J2DAnmVtxColorKey(); + loader.mpResource = JKR_NEW J2DAnmVtxColorKey(); return (J2DAnmBase*)loader.load(p_data); break; } case 'bca1': { J2DAnmFullLoader_v15 loader; - loader.mpResource = new J2DAnmTransformFull(); + loader.mpResource = JKR_NEW J2DAnmTransformFull(); return (J2DAnmBase*)loader.load(p_data); break; } case 'bpa1': { J2DAnmFullLoader_v15 loader; - loader.mpResource = new J2DAnmColorFull(); + loader.mpResource = JKR_NEW J2DAnmColorFull(); return (J2DAnmBase*)loader.load(p_data); break; } case 'btp1': { J2DAnmFullLoader_v15 loader; - loader.mpResource = new J2DAnmTexPattern(); + loader.mpResource = JKR_NEW J2DAnmTexPattern(); return (J2DAnmBase*)loader.load(p_data); } case 'bva1': { J2DAnmFullLoader_v15 loader; - loader.mpResource = new J2DAnmVisibilityFull(); + loader.mpResource = JKR_NEW J2DAnmVisibilityFull(); return (J2DAnmBase*)loader.load(p_data); break; } @@ -77,7 +77,7 @@ J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) { return NULL; case 'bxa1': { J2DAnmFullLoader_v15 loader; - loader.mpResource = new J2DAnmVtxColorFull(); + loader.mpResource = JKR_NEW J2DAnmVtxColorFull(); return (J2DAnmBase*)loader.load(p_data); } default: @@ -175,25 +175,6 @@ void J2DAnmKeyLoader_v15::readAnmTransform(J3DAnmTransformKeyData const* p_data) setAnmTransform(p_anm, p_data); } -#if TARGET_LITTLE_ENDIAN -static void ByteSwapTransformKeyData( - J2DAnmTransformKey& target, - const J3DAnmTransformKeyData& source) { - - for (int i = 0; i < source.mSCount; i += 1) { - be_swap(target.mScaleValues[i]); - } - - for (int i = 0; i < source.mRCount; i += 1) { - be_swap(target.mRotationValues[i]); - } - - for (int i = 0; i < source.mTCount; i += 1) { - be_swap(target.mTranslateValues[i]); - } -} -#endif - void J2DAnmKeyLoader_v15::setAnmTransform(J2DAnmTransformKey* p_anm, J3DAnmTransformKeyData const* p_data) { J3D_PANIC(439, p_anm, "Error : null pointer."); @@ -205,14 +186,10 @@ void J2DAnmKeyLoader_v15::setAnmTransform(J2DAnmTransformKey* p_anm, p_anm->mFrame = 0; p_anm->mInfoTable = JSUConvertOffsetToPtr(p_data, p_data->mJointAnimationTableOffs); - p_anm->mScaleValues = JSUConvertOffsetToPtr(p_data, p_data->mSTableOffs); - p_anm->mRotationValues = JSUConvertOffsetToPtr(p_data, p_data->mRTableOffs); + p_anm->mScaleValues = JSUConvertOffsetToPtr(p_data, p_data->mSTableOffs); + p_anm->mRotationValues = JSUConvertOffsetToPtr(p_data, p_data->mRTableOffs); p_anm->mTranslateValues = - JSUConvertOffsetToPtr(p_data, p_data->mTTableOffs); - -#if TARGET_LITTLE_ENDIAN - ByteSwapTransformKeyData(*p_anm, *p_data); -#endif + JSUConvertOffsetToPtr(p_data, p_data->mTTableOffs); } void J2DAnmKeyLoader_v15::readAnmTextureSRT(J3DAnmTextureSRTKeyData const* p_data) { @@ -235,14 +212,14 @@ void J2DAnmKeyLoader_v15::setAnmTextureSRT(J2DAnmTextureSRTKey* p_anm, p_anm->field_0x1e = p_data->field_0x12; p_anm->mInfoTable = JSUConvertOffsetToPtr(p_data, p_data->mTableOffset); - p_anm->mUpdateMaterialID = JSUConvertOffsetToPtr(p_data, p_data->mUpdateMatIDOffset); + p_anm->mUpdateMaterialID = JSUConvertOffsetToPtr(p_data, p_data->mUpdateMatIDOffset); p_anm->field_0x34.setResource( JSUConvertOffsetToPtr(p_data, p_data->mNameTab1Offset)); p_anm->mUpdateTexMtxID = JSUConvertOffsetToPtr(p_data, p_data->mUpdateTexMtxIDOffset); - p_anm->field_0x44 = JSUConvertOffsetToPtr(p_data, p_data->unkOffset); - p_anm->mScaleValues = JSUConvertOffsetToPtr(p_data, p_data->mScaleValOffset); - p_anm->mRotationValues = JSUConvertOffsetToPtr(p_data, p_data->mRotValOffset); - p_anm->mTranslationValues = JSUConvertOffsetToPtr(p_data, p_data->mTransValOffset); + p_anm->field_0x44 = JSUConvertOffsetToPtr(p_data, p_data->unkOffset); + p_anm->mScaleValues = JSUConvertOffsetToPtr(p_data, p_data->mScaleValOffset); + p_anm->mRotationValues = JSUConvertOffsetToPtr(p_data, p_data->mRotValOffset); + p_anm->mTranslationValues = JSUConvertOffsetToPtr(p_data, p_data->mTransValOffset); if (p_data->mNameTab2Offset != 0) { p_anm->field_0x68.setResource( JSUConvertOffsetToPtr(p_data, p_data->mNameTab2Offset)); @@ -253,12 +230,12 @@ void J2DAnmKeyLoader_v15::setAnmTextureSRT(J2DAnmTextureSRTKey* p_anm, p_anm->field_0x4c = p_data->field_0x3a; p_anm->field_0x5c = JSUConvertOffsetToPtr(p_data, p_data->mInfoTable2Offset); - p_anm->field_0x64 = JSUConvertOffsetToPtr(p_data, p_data->field_0x40); + p_anm->field_0x64 = JSUConvertOffsetToPtr(p_data, p_data->field_0x40); p_anm->field_0x60 = JSUConvertOffsetToPtr(p_data, p_data->field_0x48); - p_anm->field_0x78 = JSUConvertOffsetToPtr(p_data, p_data->field_0x4c); - p_anm->field_0x50 = JSUConvertOffsetToPtr(p_data, p_data->field_0x50); - p_anm->field_0x54 = JSUConvertOffsetToPtr(p_data, p_data->field_0x54); - p_anm->field_0x58 = JSUConvertOffsetToPtr(p_data, p_data->field_0x58); + p_anm->field_0x78 = JSUConvertOffsetToPtr(p_data, p_data->field_0x4c); + p_anm->field_0x50 = JSUConvertOffsetToPtr(p_data, p_data->field_0x50); + p_anm->field_0x54 = JSUConvertOffsetToPtr(p_data, p_data->field_0x54); + p_anm->field_0x58 = JSUConvertOffsetToPtr(p_data, p_data->field_0x58); switch (p_data->field_0x5c) { case 0: p_anm->field_0x7c = 0; @@ -290,12 +267,12 @@ void J2DAnmKeyLoader_v15::setAnmColor(J2DAnmColorKey* p_anm, J3DAnmColorKeyData p_anm->field_0x16 = p_data->field_0x16; p_anm->mInfoTable = JSUConvertOffsetToPtr(p_data, p_data->mTableOffset); - p_anm->mRValues = JSUConvertOffsetToPtr(p_data, p_data->mRValOffset); - p_anm->mGValues = JSUConvertOffsetToPtr(p_data, p_data->mGValOffset); - p_anm->mBValues = JSUConvertOffsetToPtr(p_data, p_data->mBValOffset); - p_anm->mAValues = JSUConvertOffsetToPtr(p_data, p_data->mAValOffset); + p_anm->mRValues = JSUConvertOffsetToPtr(p_data, p_data->mRValOffset); + p_anm->mGValues = JSUConvertOffsetToPtr(p_data, p_data->mGValOffset); + p_anm->mBValues = JSUConvertOffsetToPtr(p_data, p_data->mBValOffset); + p_anm->mAValues = JSUConvertOffsetToPtr(p_data, p_data->mAValOffset); p_anm->mUpdateMaterialID = - JSUConvertOffsetToPtr(p_data, p_data->mUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(p_data, p_data->mUpdateMaterialIDOffset); p_anm->field_0x20.setResource( JSUConvertOffsetToPtr(p_data, p_data->mNameTabOffset)); } @@ -323,13 +300,13 @@ void J2DAnmKeyLoader_v15::setAnmVtxColor(J2DAnmVtxColorKey* p_anm, p_anm->mVtxColorIndexData[1] = JSUConvertOffsetToPtr( p_data, p_data->mVtxColoIndexDataOffset[1]); p_anm->mVtxColorIndexPointer[0] = - JSUConvertOffsetToPtr(p_data, p_data->mVtxColoIndexPointerOffset[0]); + JSUConvertOffsetToPtr(p_data, p_data->mVtxColoIndexPointerOffset[0]); p_anm->mVtxColorIndexPointer[1] = - JSUConvertOffsetToPtr(p_data, p_data->mVtxColoIndexPointerOffset[1]); - p_anm->mRValues = JSUConvertOffsetToPtr(p_data, p_data->mRValOffset); - p_anm->mGValues = JSUConvertOffsetToPtr(p_data, p_data->mGValOffset); - p_anm->mBValues = JSUConvertOffsetToPtr(p_data, p_data->mBValOffset); - p_anm->mAValues = JSUConvertOffsetToPtr(p_data, p_data->mAValOffset); + JSUConvertOffsetToPtr(p_data, p_data->mVtxColoIndexPointerOffset[1]); + p_anm->mRValues = JSUConvertOffsetToPtr(p_data, p_data->mRValOffset); + p_anm->mGValues = JSUConvertOffsetToPtr(p_data, p_data->mGValOffset); + p_anm->mBValues = JSUConvertOffsetToPtr(p_data, p_data->mBValOffset); + p_anm->mAValues = JSUConvertOffsetToPtr(p_data, p_data->mAValOffset); } void* J2DAnmFullLoader_v15::load(void const* p_data) { @@ -419,9 +396,9 @@ void J2DAnmFullLoader_v15::setAnmTransform(J2DAnmTransformFull* p_anm, p_anm->mFrame = 0; p_anm->mTableInfo = JSUConvertOffsetToPtr(p_data, p_data->mTableOffset); - p_anm->mScaleValues = JSUConvertOffsetToPtr(p_data, p_data->mScaleValOffset); - p_anm->mRotationValues = JSUConvertOffsetToPtr(p_data, p_data->mRotValOffset); - p_anm->mTranslateValues = JSUConvertOffsetToPtr(p_data, p_data->mTransValOffset); + p_anm->mScaleValues = JSUConvertOffsetToPtr(p_data, p_data->mScaleValOffset); + p_anm->mRotationValues = JSUConvertOffsetToPtr(p_data, p_data->mRotValOffset); + p_anm->mTranslateValues = JSUConvertOffsetToPtr(p_data, p_data->mTransValOffset); } void J2DAnmFullLoader_v15::readAnmColor(J3DAnmColorFullData const* p_data) { @@ -443,7 +420,7 @@ void J2DAnmFullLoader_v15::setAnmColor(J2DAnmColorFull* p_anm, J3DAnmColorFullDa p_anm->mBValues = JSUConvertOffsetToPtr(p_data, p_data->mBValuesOffset); p_anm->mAValues = JSUConvertOffsetToPtr(p_data, p_data->mAValuesOffset); p_anm->mUpdateMaterialID = - JSUConvertOffsetToPtr(p_data, p_data->mUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(p_data, p_data->mUpdateMaterialIDOffset); p_anm->field_0x20.setResource( JSUConvertOffsetToPtr(p_data, p_data->mNameTabOffset)); } @@ -464,9 +441,9 @@ void J2DAnmFullLoader_v15::setAnmTexPattern(J2DAnmTexPattern* p_anm, p_anm->field_0x18 = p_data->field_0xe; p_anm->mAnmTable = JSUConvertOffsetToPtr(p_data, p_data->mTableOffset); - p_anm->mValues = JSUConvertOffsetToPtr(p_data, p_data->mValuesOffset); + p_anm->mValues = JSUConvertOffsetToPtr(p_data, p_data->mValuesOffset); p_anm->mUpdateMaterialID = - JSUConvertOffsetToPtr(p_data, p_data->mUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(p_data, p_data->mUpdateMaterialIDOffset); p_anm->field_0x20.setResource( JSUConvertOffsetToPtr(p_data, p_data->mNameTabOffset)); } @@ -486,32 +463,32 @@ void J2DAnmKeyLoader_v15::setAnmTevReg(J2DAnmTevRegKey* p_anm, J3DAnmTevRegKeyDa p_anm->mAnmCRegKeyTable = JSUConvertOffsetToPtr(p_data, p_data->mCRegTableOffset); p_anm->mCRegUpdateMaterialID = - JSUConvertOffsetToPtr(p_data, p_data->mCRegUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(p_data, p_data->mCRegUpdateMaterialIDOffset); p_anm->mCRegNameTab.setResource( JSUConvertOffsetToPtr(p_data, p_data->mCRegNameTabOffset)); p_anm->mKRegUpdateMaterialNum = p_data->mKRegUpdateMaterialNum; p_anm->mAnmKRegKeyTable = JSUConvertOffsetToPtr(p_data, p_data->mKRegTableOffset); p_anm->mKRegUpdateMaterialID = - JSUConvertOffsetToPtr(p_data, p_data->mKRegUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(p_data, p_data->mKRegUpdateMaterialIDOffset); p_anm->mKRegNameTab.setResource( JSUConvertOffsetToPtr(p_data, p_data->mKRegNameTabOffset)); p_anm->field_0x14 = p_data->field_0x10; p_anm->field_0x16 = p_data->field_0x12; p_anm->field_0x18 = p_data->field_0x14; p_anm->field_0x1a = p_data->field_0x16; - p_anm->mCRValues = JSUConvertOffsetToPtr(p_data, p_data->mCRValuesOffset); - p_anm->mCGValues = JSUConvertOffsetToPtr(p_data, p_data->mCGValuesOffset); - p_anm->mCBValues = JSUConvertOffsetToPtr(p_data, p_data->mCBValuesOffset); - p_anm->mCAValues = JSUConvertOffsetToPtr(p_data, p_data->mCAValuesOffset); + p_anm->mCRValues = JSUConvertOffsetToPtr(p_data, p_data->mCRValuesOffset); + p_anm->mCGValues = JSUConvertOffsetToPtr(p_data, p_data->mCGValuesOffset); + p_anm->mCBValues = JSUConvertOffsetToPtr(p_data, p_data->mCBValuesOffset); + p_anm->mCAValues = JSUConvertOffsetToPtr(p_data, p_data->mCAValuesOffset); p_anm->field_0x1c = p_data->field_0x18; p_anm->field_0x1e = p_data->field_0x1a; p_anm->field_0x20 = p_data->field_0x1c; p_anm->field_0x22 = p_data->field_0x1e; - p_anm->mKRValues = JSUConvertOffsetToPtr(p_data, p_data->mKRValuesOffset); - p_anm->mKGValues = JSUConvertOffsetToPtr(p_data, p_data->mKGValuesOffset); - p_anm->mKBValues = JSUConvertOffsetToPtr(p_data, p_data->mKBValuesOffset); - p_anm->mKAValues = JSUConvertOffsetToPtr(p_data, p_data->mKAValuesOffset); + p_anm->mKRValues = JSUConvertOffsetToPtr(p_data, p_data->mKRValuesOffset); + p_anm->mKGValues = JSUConvertOffsetToPtr(p_data, p_data->mKGValuesOffset); + p_anm->mKBValues = JSUConvertOffsetToPtr(p_data, p_data->mKBValuesOffset); + p_anm->mKAValues = JSUConvertOffsetToPtr(p_data, p_data->mKAValuesOffset); } void J2DAnmFullLoader_v15::readAnmVisibility(J3DAnmVisibilityFullData const* p_data) { @@ -556,9 +533,9 @@ void J2DAnmFullLoader_v15::setAnmVtxColor(J2DAnmVtxColorFull* p_anm, p_anm->mVtxColorIndexData[1] = JSUConvertOffsetToPtr( p_data, p_data->mVtxColorIndexDataOffsets[1]); p_anm->mVtxColorIndexPointer[0] = - JSUConvertOffsetToPtr(p_data, p_data->mVtxColorIndexPointerOffsets[0]); + JSUConvertOffsetToPtr(p_data, p_data->mVtxColorIndexPointerOffsets[0]); p_anm->mVtxColorIndexPointer[1] = - JSUConvertOffsetToPtr(p_data, p_data->mVtxColorIndexPointerOffsets[1]); + JSUConvertOffsetToPtr(p_data, p_data->mVtxColorIndexPointerOffsets[1]); p_anm->mRValues = JSUConvertOffsetToPtr(p_data, p_data->mRValuesOffset); p_anm->mGValues = JSUConvertOffsetToPtr(p_data, p_data->mGValuesOffset); p_anm->mBValues = JSUConvertOffsetToPtr(p_data, p_data->mBValuesOffset); diff --git a/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp b/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp index 1bf28751ac..6fbf8444be 100644 --- a/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp +++ b/libs/JSystem/src/J2DGraph/J2DMatBlock.cpp @@ -7,6 +7,8 @@ #include "JSystem/JUtility/JUTTexture.h" #include +#include "JSystem/JKernel/JKRHeap.h" + void J2DColorBlock::initialize() { for (int i = 0; i < 2; i++) { mMatColor[i] = JUtility::TColor(j2dDefaultColInfo); @@ -56,7 +58,7 @@ void J2DTexGenBlock::setGX() { J2DTexGenBlock::~J2DTexGenBlock() { for (int i = 0; i < 8; i++) { - delete mTexMtx[i]; + JKR_DELETE(mTexMtx[i]); } } @@ -64,7 +66,7 @@ void J2DTexGenBlock::setTexMtx(u32 param_0, J2DTexMtx& param_1) { J3D_PANIC(103, param_0 < 8, "Error : range over."); if (!mTexMtx[param_0]) { - mTexMtx[param_0] = new J2DTexMtx(param_1.getTexMtxInfo()); + mTexMtx[param_0] = JKR_NEW J2DTexMtx(param_1.getTexMtxInfo()); if (!mTexMtx[param_0]) { return; } @@ -101,13 +103,13 @@ J2DTevBlock1::J2DTevBlock1() { J2DTevBlock1::~J2DTevBlock1() { if (mUndeleteFlag & 1) { - delete mTexture[0]; + JKR_DELETE(mTexture[0]); } - delete mPalette[0]; + JKR_DELETE(mPalette[0]); if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } } @@ -139,7 +141,7 @@ bool J2DTevBlock1::prepareTexture(u8 param_0) { } if (mTexture[0] == NULL) { - mTexture[0] = new JUTTexture(); + mTexture[0] = JKR_NEW JUTTexture(); if (mTexture[0] == NULL) { return false; @@ -166,7 +168,7 @@ bool J2DTevBlock1::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette* } if (mTexture[0] == NULL) { - mTexture[0] = new JUTTexture(p_timg, 0); + mTexture[0] = JKR_NEW JUTTexture(p_timg, 0); if (mTexture[0] == NULL) { return false; @@ -197,7 +199,7 @@ bool J2DTevBlock1::insertTexture(u32 param_0, JUTTexture* p_tex) { } if (mUndeleteFlag & 1) { - delete mTexture[0]; + JKR_DELETE(mTexture[0]); } mTexture[0] = p_tex; @@ -214,7 +216,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) { if (mTexture[0] == NULL) { if (p_timg != NULL) { - mTexture[0] = new JUTTexture(p_timg, 0); + mTexture[0] = JKR_NEW JUTTexture(p_timg, 0); if (mTexture[0] == NULL) { return false; @@ -228,7 +230,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) { if (p_timg != NULL) { mTexture[0]->storeTIMG(p_timg, (u8)0); } else { - delete mTexture[0]; + JKR_DELETE(mTexture[0]); mTexture[0] = NULL; mUndeleteFlag &= 0x80; } @@ -236,7 +238,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) { mTexture[0] = NULL; if (p_timg != NULL) { - mTexture[0] = new JUTTexture(p_timg, 0); + mTexture[0] = JKR_NEW JUTTexture(p_timg, 0); if (mTexture[0] == NULL) { return false; @@ -246,7 +248,7 @@ bool J2DTevBlock1::setTexture(u32 param_0, ResTIMG const* p_timg) { } } - delete mPalette[0]; + JKR_DELETE(mPalette[0]); mPalette[0] = NULL; mTexNo[0] = -1; return true; @@ -258,12 +260,12 @@ bool J2DTevBlock1::setTexture(u32 param_0, JUTTexture* p_tex) { } if (mUndeleteFlag & 1) { - delete mTexture[0]; + JKR_DELETE(mTexture[0]); } mTexture[0] = p_tex; mUndeleteFlag &= 0x80; - delete mPalette[0]; + JKR_DELETE(mPalette[0]); mPalette[0] = NULL; mTexNo[0] = -1; return true; @@ -275,12 +277,12 @@ bool J2DTevBlock1::removeTexture(u32 param_0) { } if (mUndeleteFlag & 1) { - delete mTexture[0]; + JKR_DELETE(mTexture[0]); } mTexture[0] = NULL; mUndeleteFlag &= 0x80; - delete mPalette[0]; + JKR_DELETE(mPalette[0]); mTexNo[0] = -1; return true; } @@ -290,13 +292,13 @@ bool J2DTevBlock1::setFont(ResFONT* p_font) { return false; } - JUTResFont* resFont = new JUTResFont(p_font, NULL); + JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL); if (resFont == NULL) { return false; } if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } mFont = resFont; @@ -310,7 +312,7 @@ bool J2DTevBlock1::setFont(JUTFont* p_font) { } if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } mFont = (JUTResFont*)p_font; @@ -325,7 +327,7 @@ bool J2DTevBlock1::setPalette(u32 param_0, ResTLUT const* p_tlut) { if (p_tlut != NULL) { if (mPalette[0] == NULL) { - mPalette[0] = new JUTPalette(GX_TLUT0, (ResTLUT*)p_tlut); + mPalette[0] = JKR_NEW JUTPalette(GX_TLUT0, (ResTLUT*)p_tlut); if (mPalette[0] == NULL) { return false; @@ -338,7 +340,7 @@ bool J2DTevBlock1::setPalette(u32 param_0, ResTLUT const* p_tlut) { mTexture[0]->attachPalette(mPalette[0]); } } else { - delete mPalette[0]; + JKR_DELETE(mPalette[0]); mPalette[0] = NULL; } @@ -403,18 +405,18 @@ J2DTevBlock2::J2DTevBlock2() { J2DTevBlock2::~J2DTevBlock2() { if (mUndeleteFlag & 1) { - delete mTexture[0]; + JKR_DELETE(mTexture[0]); } if (mUndeleteFlag & 2) { - delete mTexture[1]; + JKR_DELETE(mTexture[1]); } - delete mPalette[0]; - delete mPalette[1]; + JKR_DELETE(mPalette[0]); + JKR_DELETE(mPalette[1]); if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } } @@ -454,7 +456,7 @@ bool J2DTevBlock2::prepareTexture(u8 param_0) { } if (mTexture[i] == NULL) { - mTexture[i] = new JUTTexture(); + mTexture[i] = JKR_NEW JUTTexture(); if (mTexture[i] == NULL) { return false; @@ -499,7 +501,7 @@ bool J2DTevBlock2::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette* JUTTexture* tex; if (mTexture[texNo] == NULL) { - tex = new JUTTexture(p_timg, tlutid); + tex = JKR_NEW JUTTexture(p_timg, tlutid); if (tex == NULL) { return false; @@ -575,7 +577,7 @@ bool J2DTevBlock2::insertTexture(u32 param_0, JUTTexture* p_tex) { if (mTexture[1] != NULL && mTexture[1]->getTexInfo() == NULL) { if (mUndeleteFlag & 2) { - delete mTexture[1]; + JKR_DELETE(mTexture[1]); } mUndeleteFlag &= ~2; @@ -617,7 +619,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) { if (mTexture[param_0] == NULL) { if (p_timg != NULL) { - mTexture[param_0] = new JUTTexture(p_timg, tlutid); + mTexture[param_0] = JKR_NEW JUTTexture(p_timg, tlutid); if (mTexture[param_0] == NULL) { return false; @@ -631,7 +633,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) { if (p_timg != NULL) { mTexture[param_0]->storeTIMG(p_timg, tlutid); } else { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); mTexture[param_0] = NULL; mUndeleteFlag &= ~(1 << param_0); } @@ -639,7 +641,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) { mTexture[param_0] = NULL; if (p_timg != NULL) { - mTexture[param_0] = new JUTTexture(p_timg, 0); + mTexture[param_0] = JKR_NEW JUTTexture(p_timg, 0); if (mTexture[param_0] == NULL) { return false; @@ -649,7 +651,7 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) { } } - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; mTexNo[param_0] = -1; return true; @@ -661,12 +663,12 @@ bool J2DTevBlock2::setTexture(u32 param_0, JUTTexture* p_tex) { } if (mUndeleteFlag & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } mTexture[param_0] = p_tex; mUndeleteFlag &= ~(1 << param_0); - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; mTexNo[param_0] = -1; return true; @@ -678,9 +680,9 @@ bool J2DTevBlock2::removeTexture(u32 param_0) { } if (mUndeleteFlag & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); if (param_0 == 0) { mTexture[0] = mTexture[1]; @@ -700,13 +702,13 @@ bool J2DTevBlock2::setFont(ResFONT* p_font) { return false; } - JUTResFont* resFont = new JUTResFont(p_font, NULL); + JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL); if (resFont == NULL) { return false; } if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } mFont = resFont; @@ -720,7 +722,7 @@ bool J2DTevBlock2::setFont(JUTFont* p_font) { } if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } mFont = (JUTResFont*)p_font; @@ -735,7 +737,7 @@ bool J2DTevBlock2::setPalette(u32 param_0, ResTLUT const* p_tlut) { if (p_tlut != NULL) { if (mPalette[param_0] == NULL) { - mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); + mPalette[param_0] = JKR_NEW JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); if (mPalette[param_0] == NULL) { return false; @@ -748,7 +750,7 @@ bool J2DTevBlock2::setPalette(u32 param_0, ResTLUT const* p_tlut) { mTexture[param_0]->attachPalette(mPalette[param_0]); } } else { - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; } @@ -841,13 +843,13 @@ J2DTevBlock4::J2DTevBlock4() { J2DTevBlock4::~J2DTevBlock4() { for (int i = 0; i < 4; i++) { if (mUndeleteFlag & (1 << i)) { - delete mTexture[i]; + JKR_DELETE(mTexture[i]); } - delete mPalette[i]; + JKR_DELETE(mPalette[i]); } if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } } @@ -892,7 +894,7 @@ bool J2DTevBlock4::prepareTexture(u8 param_0) { } if (mTexture[i] == NULL) { - mTexture[i] = new JUTTexture(); + mTexture[i] = JKR_NEW JUTTexture(); if (mTexture[i] == NULL) { return false; @@ -949,7 +951,7 @@ bool J2DTevBlock4::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette* } JUTTexture* texture; if (!mTexture[idx]) { - texture = new JUTTexture(p_timg, local_43); + texture = JKR_NEW JUTTexture(p_timg, local_43); if (!texture) { return false; } @@ -1017,7 +1019,7 @@ bool J2DTevBlock4::insertTexture(u32 param_0, JUTTexture* p_tex) { if (mTexture[3] != NULL && mTexture[3]->getTexInfo() == NULL) { if (mUndeleteFlag & 8) { - delete mTexture[3]; + JKR_DELETE(mTexture[3]); } mUndeleteFlag &= ~8; @@ -1069,7 +1071,7 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) { if (mTexture[param_0] == NULL) { if (p_timg != NULL) { - mTexture[param_0] = new JUTTexture(p_timg, tlutid); + mTexture[param_0] = JKR_NEW JUTTexture(p_timg, tlutid); if (mTexture[param_0] == NULL) { return false; @@ -1083,7 +1085,7 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) { if (p_timg != NULL) { mTexture[param_0]->storeTIMG(p_timg, tlutid); } else { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); mTexture[param_0] = NULL; mUndeleteFlag &= ~(1 << param_0); } @@ -1091,7 +1093,7 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) { mTexture[param_0] = NULL; if (p_timg != NULL) { - mTexture[param_0] = new JUTTexture(p_timg, 0); + mTexture[param_0] = JKR_NEW JUTTexture(p_timg, 0); if (mTexture[param_0] == NULL) { return false; @@ -1101,7 +1103,7 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) { } } - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; mTexNo[param_0] = -1; return true; @@ -1113,12 +1115,12 @@ bool J2DTevBlock4::setTexture(u32 param_0, JUTTexture* p_tex) { } if (mUndeleteFlag & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } mTexture[param_0] = p_tex; mUndeleteFlag &= ~(1 << param_0); - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; mTexNo[param_0] = -1; return true; @@ -1130,9 +1132,9 @@ bool J2DTevBlock4::removeTexture(u32 param_0) { } if (mUndeleteFlag & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); for (u32 i = param_0; i < 3; i++) { mTexture[i] = mTexture[i + 1]; @@ -1152,13 +1154,13 @@ bool J2DTevBlock4::setFont(ResFONT* p_font) { return false; } - JUTResFont* resFont = new JUTResFont(p_font, NULL); + JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL); if (resFont == NULL) { return false; } if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } mFont = resFont; @@ -1172,7 +1174,7 @@ bool J2DTevBlock4::setFont(JUTFont* p_font) { } if (mUndeleteFlag & 0x80) { - delete mFont; + JKR_DELETE(mFont); } mFont = (JUTResFont*)p_font; @@ -1187,7 +1189,7 @@ bool J2DTevBlock4::setPalette(u32 param_0, ResTLUT const* p_tlut) { if (p_tlut != NULL) { if (mPalette[param_0] == NULL) { - mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); + mPalette[param_0] = JKR_NEW JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); if (mPalette[param_0] == NULL) { return false; @@ -1200,7 +1202,7 @@ bool J2DTevBlock4::setPalette(u32 param_0, ResTLUT const* p_tlut) { mTexture[param_0]->attachPalette(mPalette[param_0]); } } else { - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; } @@ -1285,13 +1287,13 @@ J2DTevBlock8::J2DTevBlock8() { J2DTevBlock8::~J2DTevBlock8() { for (int i = 0; i < 8; i++) { if (mUndeleteFlag & (1 << i)) { - delete mTexture[i]; + JKR_DELETE(mTexture[i]); } - delete mPalette[i]; + JKR_DELETE(mPalette[i]); } if (mFontUndeleteFlag) { - delete mFont; + JKR_DELETE(mFont); } } @@ -1337,7 +1339,7 @@ bool J2DTevBlock8::prepareTexture(u8 param_0) { } if (mTexture[i] == NULL) { - mTexture[i] = new JUTTexture(); + mTexture[i] = JKR_NEW JUTTexture(); if (mTexture[i] == NULL) { return false; @@ -1394,7 +1396,7 @@ bool J2DTevBlock8::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette* } JUTTexture* texture; if (!mTexture[idx]) { - texture = new JUTTexture(p_timg, local_43); + texture = JKR_NEW JUTTexture(p_timg, local_43); if (!texture) { return false; } @@ -1462,7 +1464,7 @@ bool J2DTevBlock8::insertTexture(u32 param_0, JUTTexture* p_tex) { if (mTexture[7] != NULL && mTexture[7]->getTexInfo() == NULL) { if (mUndeleteFlag & 0x80) { - delete mTexture[7]; + JKR_DELETE(mTexture[7]); } mUndeleteFlag &= ~0x80; @@ -1514,7 +1516,7 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) { if (mTexture[param_0] == NULL) { if (p_timg != NULL) { - mTexture[param_0] = new JUTTexture(p_timg, tlutid); + mTexture[param_0] = JKR_NEW JUTTexture(p_timg, tlutid); if (mTexture[param_0] == NULL) { return false; @@ -1528,7 +1530,7 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) { if (p_timg != NULL) { mTexture[param_0]->storeTIMG(p_timg, tlutid); } else { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); mTexture[param_0] = NULL; mUndeleteFlag &= ~(1 << param_0); } @@ -1536,7 +1538,7 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) { mTexture[param_0] = NULL; if (p_timg != NULL) { - mTexture[param_0] = new JUTTexture(p_timg, 0); + mTexture[param_0] = JKR_NEW JUTTexture(p_timg, 0); if (mTexture[param_0] == NULL) { return false; @@ -1546,7 +1548,7 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) { } } - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; mTexNo[param_0] = -1; return true; @@ -1558,12 +1560,12 @@ bool J2DTevBlock8::setTexture(u32 param_0, JUTTexture* p_tex) { } if (mUndeleteFlag & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } mTexture[param_0] = p_tex; mUndeleteFlag &= ~(1 << param_0); - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; mTexNo[param_0] = -1; return true; @@ -1575,9 +1577,9 @@ bool J2DTevBlock8::removeTexture(u32 param_0) { } if (mUndeleteFlag & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); for (u32 i = param_0; i < 7; i++) { mTexture[i] = mTexture[i + 1]; @@ -1597,13 +1599,13 @@ bool J2DTevBlock8::setFont(ResFONT* p_font) { return false; } - JUTResFont* resFont = new JUTResFont(p_font, NULL); + JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL); if (resFont == NULL) { return false; } if (mFontUndeleteFlag) { - delete mFont; + JKR_DELETE(mFont); } mFont = resFont; @@ -1617,7 +1619,7 @@ bool J2DTevBlock8::setFont(JUTFont* p_font) { } if (mFontUndeleteFlag) { - delete mFont; + JKR_DELETE(mFont); } mFont = (JUTResFont*)p_font; @@ -1632,7 +1634,7 @@ bool J2DTevBlock8::setPalette(u32 param_0, ResTLUT const* p_tlut) { if (p_tlut != NULL) { if (mPalette[param_0] == NULL) { - mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); + mPalette[param_0] = JKR_NEW JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); if (mPalette[param_0] == NULL) { return false; @@ -1645,7 +1647,7 @@ bool J2DTevBlock8::setPalette(u32 param_0, ResTLUT const* p_tlut) { mTexture[param_0]->attachPalette(mPalette[param_0]); } } else { - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; } @@ -1725,13 +1727,13 @@ J2DTevBlock16::J2DTevBlock16() { J2DTevBlock16::~J2DTevBlock16() { for (int i = 0; i < 8; i++) { if (mUndeleteFlag & (1 << i)) { - delete mTexture[i]; + JKR_DELETE(mTexture[i]); } - delete mPalette[i]; + JKR_DELETE(mPalette[i]); } if (mFontUndeleteFlag) { - delete mFont; + JKR_DELETE(mFont); } } @@ -1777,7 +1779,7 @@ bool J2DTevBlock16::prepareTexture(u8 param_0) { } if (mTexture[i] == NULL) { - mTexture[i] = new JUTTexture(); + mTexture[i] = JKR_NEW JUTTexture(); if (mTexture[i] == NULL) { return false; @@ -1834,7 +1836,7 @@ bool J2DTevBlock16::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette } JUTTexture* texture; if (!mTexture[idx]) { - texture = new JUTTexture(p_timg, local_43); + texture = JKR_NEW JUTTexture(p_timg, local_43); if (!texture) { return false; } @@ -1902,7 +1904,7 @@ bool J2DTevBlock16::insertTexture(u32 param_0, JUTTexture* p_tex) { if (mTexture[7] != NULL && mTexture[7]->getTexInfo() == NULL) { if (mUndeleteFlag & 0x80) { - delete mTexture[7]; + JKR_DELETE(mTexture[7]); } mUndeleteFlag &= ~0x80; @@ -1954,7 +1956,7 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) { if (mTexture[param_0] == NULL) { if (p_timg != NULL) { - mTexture[param_0] = new JUTTexture(p_timg, tlutid); + mTexture[param_0] = JKR_NEW JUTTexture(p_timg, tlutid); if (mTexture[param_0] == NULL) { return false; @@ -1968,7 +1970,7 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) { if (p_timg != NULL) { mTexture[param_0]->storeTIMG(p_timg, tlutid); } else { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); mTexture[param_0] = NULL; mUndeleteFlag &= ~(1 << param_0); } @@ -1976,7 +1978,7 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) { mTexture[param_0] = NULL; if (p_timg != NULL) { - mTexture[param_0] = new JUTTexture(p_timg, 0); + mTexture[param_0] = JKR_NEW JUTTexture(p_timg, 0); if (mTexture[param_0] == NULL) { return false; @@ -1986,7 +1988,7 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) { } } - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; mTexNo[param_0] = -1; return true; @@ -1998,12 +2000,12 @@ bool J2DTevBlock16::setTexture(u32 param_0, JUTTexture* p_tex) { } if (mUndeleteFlag & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } mTexture[param_0] = p_tex; mUndeleteFlag &= ~(1 << param_0); - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; mTexNo[param_0] = -1; return true; @@ -2015,9 +2017,9 @@ bool J2DTevBlock16::removeTexture(u32 param_0) { } if (mUndeleteFlag & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); for (u32 i = param_0; i < 7; i++) { mTexture[i] = mTexture[i + 1]; @@ -2037,13 +2039,13 @@ bool J2DTevBlock16::setFont(ResFONT* p_font) { return false; } - JUTResFont* resFont = new JUTResFont(p_font, NULL); + JUTResFont* resFont = JKR_NEW JUTResFont(p_font, NULL); if (resFont == NULL) { return false; } if (mFontUndeleteFlag) { - delete mFont; + JKR_DELETE(mFont); } mFont = resFont; @@ -2057,7 +2059,7 @@ bool J2DTevBlock16::setFont(JUTFont* p_font) { } if (mFontUndeleteFlag) { - delete mFont; + JKR_DELETE(mFont); } mFont = (JUTResFont*)p_font; @@ -2072,7 +2074,7 @@ bool J2DTevBlock16::setPalette(u32 param_0, ResTLUT const* p_tlut) { if (p_tlut != NULL) { if (mPalette[param_0] == NULL) { - mPalette[param_0] = new JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); + mPalette[param_0] = JKR_NEW JUTPalette((GXTlut)param_0, (ResTLUT*)p_tlut); if (mPalette[param_0] == NULL) { return false; @@ -2085,7 +2087,7 @@ bool J2DTevBlock16::setPalette(u32 param_0, ResTLUT const* p_tlut) { mTexture[param_0]->attachPalette(mPalette[param_0]); } } else { - delete mPalette[param_0]; + JKR_DELETE(mPalette[param_0]); mPalette[param_0] = NULL; } diff --git a/libs/JSystem/src/J2DGraph/J2DMaterial.cpp b/libs/JSystem/src/J2DGraph/J2DMaterial.cpp index 10381ade24..2994c60572 100644 --- a/libs/JSystem/src/J2DGraph/J2DMaterial.cpp +++ b/libs/JSystem/src/J2DGraph/J2DMaterial.cpp @@ -18,9 +18,9 @@ J2DMaterial::J2DMaterial() { } J2DMaterial::~J2DMaterial() { - delete mTevBlock; - delete mIndBlock; - delete mAnmPointer; + JKR_DELETE(mTevBlock); + JKR_DELETE(mIndBlock); + JKR_DELETE(mAnmPointer); } void J2DMaterial::setGX() { @@ -45,27 +45,27 @@ J2DTevBlock* J2DMaterial::createTevBlock(int block_type, bool noAlign) { if (noAlign) { if (block_type <= 1) { - block = new J2DTevBlock1(); + block = JKR_NEW J2DTevBlock1(); } else if (block_type == 2) { - block = new J2DTevBlock2(); + block = JKR_NEW J2DTevBlock2(); } else if (block_type <= 4) { - block = new J2DTevBlock4(); + block = JKR_NEW J2DTevBlock4(); } else if (block_type <= 8) { - block = new J2DTevBlock8(); + block = JKR_NEW J2DTevBlock8(); } else { - block = new J2DTevBlock16(); + block = JKR_NEW J2DTevBlock16(); } } else { if (block_type <= 1) { - block = new (-4) J2DTevBlock1(); + block = JKR_NEW_ARGS (-4) J2DTevBlock1(); } else if (block_type == 2) { - block = new (-4) J2DTevBlock2(); + block = JKR_NEW_ARGS (-4) J2DTevBlock2(); } else if (block_type <= 4) { - block = new (-4) J2DTevBlock4(); + block = JKR_NEW_ARGS (-4) J2DTevBlock4(); } else if (block_type <= 8) { - block = new (-4) J2DTevBlock8(); + block = JKR_NEW_ARGS (-4) J2DTevBlock8(); } else { - block = new (-4) J2DTevBlock16(); + block = JKR_NEW_ARGS (-4) J2DTevBlock16(); } } ASSERTMSGLINE(101, block, "Error : allocate memory."); @@ -78,15 +78,15 @@ J2DIndBlock* J2DMaterial::createIndBlock(int block_type, bool noAlign) { if (noAlign) { if (block_type != 0) { - block = new J2DIndBlockFull(); + block = JKR_NEW J2DIndBlockFull(); } else { - block = new J2DIndBlockNull(); + block = JKR_NEW J2DIndBlockNull(); } } else { if (block_type != 0) { - block = new (-4) J2DIndBlockFull(); + block = JKR_NEW_ARGS (-4) J2DIndBlockFull(); } else { - block = new (-4) J2DIndBlockNull(); + block = JKR_NEW_ARGS (-4) J2DIndBlockNull(); } } ASSERTMSGLINE(133, block, "Error : allocate memory."); @@ -122,7 +122,7 @@ void J2DMaterial::makeAnmPointer() { int r29; int r28; if (mAnmPointer == NULL) { - mAnmPointer = new J2DMaterialAnmPointer(); + mAnmPointer = JKR_NEW J2DMaterialAnmPointer(); r29 = 1; if (mAnmPointer == NULL) { OS_PANIC(171, "Error : allocate memory."); diff --git a/libs/JSystem/src/J2DGraph/J2DMaterialFactory.cpp b/libs/JSystem/src/J2DGraph/J2DMaterialFactory.cpp index f0aae92990..beb9e0075a 100644 --- a/libs/JSystem/src/J2DGraph/J2DMaterialFactory.cpp +++ b/libs/JSystem/src/J2DGraph/J2DMaterialFactory.cpp @@ -228,7 +228,7 @@ J2DTexMtx* J2DMaterialFactory::newTexMtx(int param_0, int param_1) const { J2DTexMtx* rv = NULL; J2DMaterialInitData* iVar2 = &mpMaterialInitData[mpMaterialID[param_0]]; if (iVar2->field_0x24[param_1] != 0xffff) { - rv = new J2DTexMtx(mpTexMtxInfo[iVar2->field_0x24[param_1]]); + rv = JKR_NEW J2DTexMtx(mpTexMtxInfo[iVar2->field_0x24[param_1]]); rv->calc(); } return rv; diff --git a/libs/JSystem/src/J2DGraph/J2DPane.cpp b/libs/JSystem/src/J2DGraph/J2DPane.cpp index c54530a98b..3ba9b6e85c 100644 --- a/libs/JSystem/src/J2DGraph/J2DPane.cpp +++ b/libs/JSystem/src/J2DGraph/J2DPane.cpp @@ -210,7 +210,7 @@ void J2DPane::changeUseTrans(J2DPane* p_pane) { J2DPane::~J2DPane() { JSUTreeIterator iterator = mPaneTree.getFirstChild(); for (; iterator != mPaneTree.getEndChild();) { - delete (iterator++).getObject(); + JKR_DELETE((iterator++).getObject()); } } diff --git a/libs/JSystem/src/J2DGraph/J2DPicture.cpp b/libs/JSystem/src/J2DGraph/J2DPicture.cpp index 530d6ad3f4..8072c32d41 100644 --- a/libs/JSystem/src/J2DGraph/J2DPicture.cpp +++ b/libs/JSystem/src/J2DGraph/J2DPicture.cpp @@ -208,12 +208,12 @@ void J2DPicture::private_readStream(J2DPane* parent, JSURandomInputStream* strea field_0x109 = 1; if (img != NULL) { - mTexture[0] = new JUTTexture(img, 0); + mTexture[0] = JKR_NEW JUTTexture(img, 0); mTextureNum++; } if (lut != NULL) { - mPalette = new JUTPalette(GX_TLUT0, lut); + mPalette = JKR_NEW JUTPalette(GX_TLUT0, lut); mTexture[0]->attachPalette(mPalette); } @@ -237,7 +237,7 @@ void J2DPicture::private_initiate(const ResTIMG* timg, const ResTLUT* tlut) { if (timg != NULL) { if (mTexture[0] == NULL) { - mTexture[0] = new JUTTexture(timg, 0); + mTexture[0] = JKR_NEW JUTTexture(timg, 0); if (mTexture[0] != NULL) { mTextureNum++; field_0x109 = (field_0x109 & 2) | 1; @@ -251,7 +251,7 @@ void J2DPicture::private_initiate(const ResTIMG* timg, const ResTLUT* tlut) { mPalette = NULL; if (tlut && mPalette == NULL) { - mPalette = new JUTPalette(GX_TLUT0, const_cast(tlut)); + mPalette = JKR_NEW JUTPalette(GX_TLUT0, const_cast(tlut)); if (mTexture[0] != NULL) { mTexture[0]->attachPalette(mPalette); } @@ -272,11 +272,11 @@ void J2DPicture::initinfo() { J2DPicture::~J2DPicture() { for (int i = 0; i < 2; i++) { if ((int)(field_0x109 & 1 << i) != 0) { - delete mTexture[i]; + JKR_DELETE(mTexture[i]); } } - delete mPalette; + JKR_DELETE(mPalette); } bool J2DPicture::prepareTexture(u8 param_0) { @@ -286,7 +286,7 @@ bool J2DPicture::prepareTexture(u8 param_0) { } if (mTexture[i] == NULL) { - mTexture[i] = new JUTTexture(); + mTexture[i] = JKR_NEW JUTTexture(); if (mTexture[i] == NULL) { return 0; @@ -309,7 +309,7 @@ bool J2DPicture::insert(ResTIMG const* img, JUTPalette* palette, u8 param_2, f32 JUTTexture* var_r31; if (mTexture[mTextureNum] == NULL) { - var_r31 = new JUTTexture(img, var_r26); + var_r31 = JKR_NEW JUTTexture(img, var_r26); if (palette != NULL) { var_r31->storeTIMG(img, palette); @@ -381,7 +381,7 @@ bool J2DPicture::insert(JUTTexture* texture, u8 param_1, f32 param_2) { } if (mTexture[1] != NULL && field_0x109 & 2) { - delete mTexture[1]; + JKR_DELETE(mTexture[1]); field_0x109 &= 1; } @@ -417,7 +417,7 @@ bool J2DPicture::remove(u8 param_0) { } if (field_0x109 & (1 << param_0)) { - delete mTexture[param_0]; + JKR_DELETE(mTexture[param_0]); } for (u8 i = param_0; i < mTextureNum - 1; i++) { diff --git a/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp b/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp index 64ef5298f7..6c4048ba31 100644 --- a/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp +++ b/libs/JSystem/src/J2DGraph/J2DPictureEx.cpp @@ -62,7 +62,7 @@ J2DPictureEx::J2DPictureEx(J2DPane* param_0, JSURandomInputStream* param_1, u32 J2DPictureEx::~J2DPictureEx() { if (field_0x190) { - delete mMaterial; + JKR_DELETE(mMaterial); } } @@ -1136,11 +1136,11 @@ void J2DPictureEx::setAnimation(J2DAnmVtxColor* anm) { for (u16 j = 0; j < anm_table_num; j++) { #if DEBUG J3DAnmVtxColorIndexData* data = anm->getAnmVtxColorIndexData(0, j); - u16* index2 = anm->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData; + BE(u16)* index2 = anm->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData; #else J3DAnmVtxColorIndexData* data = anm->getAnmVtxColorIndexData(0, j); - u16* index = anm->getVtxColorIndexPointer(0); - u16* index2 = index + (uintptr_t)data->mpData; + BE(u16)* index = anm->getVtxColorIndexPointer(0); + BE(u16)* index2 = index + (uintptr_t)data->mpData; #endif for (u16 k = 0; k < data->mNum; k++) { if (index2[k] == field_0x158[i]) { @@ -1177,7 +1177,7 @@ const J2DAnmTransform* J2DPictureEx::animationPane(J2DAnmTransform const* anm) { if (field_0x19c & (1 << i)) { for (u16 j = 0; j < anm_table_num; j++) { J3DAnmVtxColorIndexData* data = field_0x198->getAnmVtxColorIndexData(0, j); - u16* index = field_0x198->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData; + BE(u16)* index = field_0x198->getVtxColorIndexPointer(0) + (uintptr_t)data->mpData; for (u16 k = 0; k < data->mNum; k++) { if (index[k] == field_0x158[i]) { field_0x198->getColor(0, j, &mCornerColor[i]); diff --git a/libs/JSystem/src/J2DGraph/J2DPrint.cpp b/libs/JSystem/src/J2DGraph/J2DPrint.cpp index 1dbaf1c681..68e03c2095 100644 --- a/libs/JSystem/src/J2DGraph/J2DPrint.cpp +++ b/libs/JSystem/src/J2DGraph/J2DPrint.cpp @@ -90,10 +90,10 @@ u8* J2DPrint::setBuffer(size_t size) { u8* u8Buff = (u8*)mStrBuff; if (sStrBufInitialized) { - delete mStrBuff; + JKR_DELETE(mStrBuff); } - mStrBuff = new (JKRGetSystemHeap(), 0) char[size]; + mStrBuff = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) char[size]; mStrBuffSize = size; sStrBufInitialized = true; return u8Buff; diff --git a/libs/JSystem/src/J2DGraph/J2DScreen.cpp b/libs/JSystem/src/J2DGraph/J2DScreen.cpp index 622f3c2fb0..a03b6a7f76 100644 --- a/libs/JSystem/src/J2DGraph/J2DScreen.cpp +++ b/libs/JSystem/src/J2DGraph/J2DScreen.cpp @@ -27,19 +27,19 @@ J2DScreen::~J2DScreen() { } void J2DScreen::clean() { - delete[] mMaterials; + JKR_DELETE_ARRAY(mMaterials); mMaterialNum = 0; mMaterials = NULL; - delete[] mTexRes; + JKR_DELETE_ARRAY(mTexRes); mTexRes = NULL; - delete[] mFontRes; + JKR_DELETE_ARRAY(mFontRes); mFontRes = NULL; if (mNameTable != NULL) { - delete[] mNameTable->getResNameTable(); - delete mNameTable; + JKR_DELETE_ARRAY(mNameTable->getResNameTable()); + JKR_DELETE(mNameTable); mNameTable = NULL; } } @@ -176,40 +176,40 @@ J2DPane* J2DScreen::createPane(J2DScrnBlockHeader const& header, JSURandomInputS switch (header.mTag) { case 'PAN1': - newPane = new J2DPane(p_basePane, p_stream, 0); + newPane = JKR_NEW J2DPane(p_basePane, p_stream, 0); break; case 'WIN1': - newPane = new J2DWindow(p_basePane, p_stream, p_archive); + newPane = JKR_NEW J2DWindow(p_basePane, p_stream, p_archive); break; case 'PIC1': - newPane = new J2DPicture(p_basePane, p_stream, p_archive); + newPane = JKR_NEW J2DPicture(p_basePane, p_stream, p_archive); break; case 'TBX1': - newPane = new J2DTextBox(p_basePane, p_stream, p_archive); + newPane = JKR_NEW J2DTextBox(p_basePane, p_stream, p_archive); break; case 'PAN2': - newPane = new J2DPane(p_basePane, p_stream, 1); + newPane = JKR_NEW J2DPane(p_basePane, p_stream, 1); break; case 'WIN2': if (param_3 & 0x1F0000) { - newPane = new J2DWindowEx(p_basePane, p_stream, param_3, mMaterials); + newPane = JKR_NEW J2DWindowEx(p_basePane, p_stream, param_3, mMaterials); break; } - newPane = new J2DWindow(p_basePane, p_stream, mMaterials); + newPane = JKR_NEW J2DWindow(p_basePane, p_stream, mMaterials); break; case 'PIC2': if (param_3 & 0x1F0000) { - newPane = new J2DPictureEx(p_basePane, p_stream, param_3, mMaterials); + newPane = JKR_NEW J2DPictureEx(p_basePane, p_stream, param_3, mMaterials); break; } - newPane = new J2DPicture(p_basePane, p_stream, mMaterials); + newPane = JKR_NEW J2DPicture(p_basePane, p_stream, mMaterials); break; case 'TBX2': if (param_3 & 0x1F0000) { - newPane = new J2DTextBoxEx(p_basePane, p_stream, param_3, mMaterials); + newPane = JKR_NEW J2DTextBoxEx(p_basePane, p_stream, param_3, mMaterials); break; } - newPane = new J2DTextBox(p_basePane, p_stream, param_3, mMaterials); + newPane = JKR_NEW J2DTextBox(p_basePane, p_stream, param_3, mMaterials); break; default: JUT_WARN(446, "%s", "unknown pane"); @@ -217,7 +217,7 @@ J2DPane* J2DScreen::createPane(J2DScrnBlockHeader const& header, JSURandomInputS s32 size = header.mSize; s32 start = size + position; - newPane = new J2DPane(p_basePane, p_stream, 0); + newPane = JKR_NEW J2DPane(p_basePane, p_stream, 0); p_stream->seek(start, JSUStreamSeekFrom_SET); break; } @@ -321,9 +321,9 @@ J2DResReference* J2DScreen::getResReference(JSURandomInputStream* p_stream, u32 char* buffer; if (param_1 & 0x1F0000) { - buffer = new char[size1]; + buffer = JKR_NEW char[size1]; } else { - buffer = new (-4) char[size1]; + buffer = JKR_NEW_ARGS (-4) char[size1]; } if (buffer != NULL) { @@ -343,12 +343,12 @@ bool J2DScreen::createMaterial(JSURandomInputStream* p_stream, u32 param_1, JKRA p_stream->skip(2); if (param_1 & 0x1F0000) { - mMaterials = new J2DMaterial[mMaterialNum]; + mMaterials = JKR_NEW J2DMaterial[mMaterialNum]; } else { - mMaterials = new (-4) J2DMaterial[mMaterialNum]; + mMaterials = JKR_NEW_ARGS (-4) J2DMaterial[mMaterialNum]; } - u8* buffer = new (-4) u8[header.mSize]; + u8* buffer = JKR_NEW_ARGS (-4) u8[header.mSize]; if (mMaterials != NULL && buffer != NULL) { J2DMaterialBlock* pBlock = (J2DMaterialBlock*)buffer; p_stream->seek(position, JSUStreamSeekFrom_SET); @@ -372,7 +372,7 @@ bool J2DScreen::createMaterial(JSURandomInputStream* p_stream, u32 param_1, JKRA } size++; - u8* nametab = new u8[size]; + u8* nametab = JKR_NEW u8[size]; if (nametab == NULL) { goto failure; } @@ -380,20 +380,20 @@ bool J2DScreen::createMaterial(JSURandomInputStream* p_stream, u32 param_1, JKRA nametab[i] = (buffer + offset)[i]; } - mNameTable = new JUTNameTab((ResNTAB*)nametab); + mNameTable = JKR_NEW JUTNameTab((ResNTAB*)nametab); if (mNameTable == NULL) { - delete[] nametab; + JKR_DELETE_ARRAY(nametab); goto failure; } } success: - delete[] buffer; + JKR_DELETE_ARRAY(buffer); return true; } failure: - delete[] buffer; + JKR_DELETE_ARRAY(buffer); clean(); return false; } diff --git a/libs/JSystem/src/J2DGraph/J2DTextBox.cpp b/libs/JSystem/src/J2DGraph/J2DTextBox.cpp index 8f8a168104..f09a635e0a 100644 --- a/libs/JSystem/src/J2DGraph/J2DTextBox.cpp +++ b/libs/JSystem/src/J2DGraph/J2DTextBox.cpp @@ -74,13 +74,13 @@ J2DTextBox::J2DTextBox(J2DPane* p_pane, JSURandomInputStream* p_stream, u32 para mStringPtr = NULL; if (strLength != 0) { - mStringPtr = new char[strLength]; + mStringPtr = JKR_NEW char[strLength]; } if (mStringPtr != NULL) { mStringLength = strLength; - u16 var_r26_2 = strLength - 1 < info.field_0x1e ? u16(strLength - 1) : info.field_0x1e; + u16 var_r26_2 = strLength - 1 < info.field_0x1e ? u16(strLength - 1) : (u16)info.field_0x1e; p_stream->peek(mStringPtr, var_r26_2); mStringPtr[var_r26_2] = 0; @@ -121,7 +121,7 @@ J2DTextBox::J2DTextBox(u64 tag, JGeometry::TBox2 const& bounds, ResFONT con void J2DTextBox::initiate(ResFONT const* p_font, char const* string, s16 length, J2DTextBoxHBinding hBind, J2DTextBoxVBinding vBind) { if (p_font != NULL) { - mFont = new JUTResFont(p_font, NULL); + mFont = JKR_NEW JUTResFont(p_font, NULL); } mCharColor.set(0xFFFFFFFF); @@ -144,7 +144,7 @@ void J2DTextBox::initiate(ResFONT const* p_font, char const* string, s16 length, stringLen = len + 1; } - mStringPtr = new char[stringLen]; + mStringPtr = JKR_NEW char[stringLen]; if (stringLen != 0 && mStringPtr != NULL) { strncpy(mStringPtr, string, stringLen - 1); @@ -185,7 +185,7 @@ void J2DTextBox::private_readStream(J2DPane* p_pane, JSURandomInputStream* p_str ResFONT* fontPtr = (ResFONT*)getPointer(p_stream, 'FONT', p_archive); if (fontPtr != NULL) { - mFont = new JUTResFont(fontPtr, NULL); + mFont = JKR_NEW JUTResFont(fontPtr, NULL); } mCharColor.set(p_stream->read32b()); @@ -198,7 +198,7 @@ void J2DTextBox::private_readStream(J2DPane* p_pane, JSURandomInputStream* p_str mFontSizeY = p_stream->read16b(); s16 stringLen = p_stream->read16b(); - mStringPtr = new char[stringLen + 1]; + mStringPtr = JKR_NEW char[stringLen + 1]; if (mStringPtr != NULL) { p_stream->read(mStringPtr, stringLen); @@ -240,16 +240,16 @@ void J2DTextBox::private_readStream(J2DPane* p_pane, JSURandomInputStream* p_str J2DTextBox::~J2DTextBox() { if (mTextFontOwned) { - delete mFont; + JKR_DELETE(mFont); } - delete[] mStringPtr; + JKR_DELETE_ARRAY(mStringPtr); } void J2DTextBox::setFont(JUTFont* p_font) { if (p_font) { if (mTextFontOwned) { - delete mFont; + JKR_DELETE(mFont); } mFont = p_font; mTextFontOwned = false; @@ -317,7 +317,7 @@ s32 J2DTextBox::setString(char const* string, ...) { va_list args; va_start(args, string); - delete[] mStringPtr; + JKR_DELETE_ARRAY(mStringPtr); u32 len = strlen(string); @@ -326,7 +326,7 @@ s32 J2DTextBox::setString(char const* string, ...) { } mStringLength = 0; - mStringPtr = new char[len + 1]; + mStringPtr = JKR_NEW char[len + 1]; if (mStringPtr) { mStringLength = len + 1; @@ -341,7 +341,7 @@ s32 J2DTextBox::setString(s16 length, char const* string, ...) { va_list args; va_start(args, string); - delete[] mStringPtr; + JKR_DELETE_ARRAY(mStringPtr); mStringPtr = NULL; u32 len = strlen(string); @@ -357,7 +357,7 @@ s32 J2DTextBox::setString(s16 length, char const* string, ...) { mStringLength = 0; if (stringLen != 0) { - mStringPtr = new char[stringLen]; + mStringPtr = JKR_NEW char[stringLen]; } if (mStringPtr != NULL) { diff --git a/libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp b/libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp index 637e7e972f..107b9b9c02 100644 --- a/libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp +++ b/libs/JSystem/src/J2DGraph/J2DTextBoxEx.cpp @@ -65,13 +65,13 @@ J2DTextBoxEx::J2DTextBoxEx(J2DPane* p_pane, JSURandomInputStream* p_stream, u32 mStringPtr = NULL; if (strLength != 0) { - mStringPtr = new char[strLength]; + mStringPtr = JKR_NEW char[strLength]; } if (mStringPtr != NULL) { mStringLength = strLength; - u16 var_r26_2 = strLength - 1 < info.field_0x1e ? u16(strLength - 1) : info.field_0x1e; + u16 var_r26_2 = strLength - 1 < info.field_0x1e ? u16(strLength - 1) : (u16)info.field_0x1e; p_stream->peek(mStringPtr, var_r26_2); mStringPtr[var_r26_2] = 0; @@ -88,7 +88,7 @@ J2DTextBoxEx::J2DTextBoxEx(J2DPane* p_pane, JSURandomInputStream* p_stream, u32 J2DTextBoxEx::~J2DTextBoxEx() { if (field_0x140 != 0) { - delete mMaterial; + JKR_DELETE(mMaterial); } } diff --git a/libs/JSystem/src/J2DGraph/J2DWindow.cpp b/libs/JSystem/src/J2DGraph/J2DWindow.cpp index b6d341d507..35de369709 100644 --- a/libs/JSystem/src/J2DGraph/J2DWindow.cpp +++ b/libs/JSystem/src/J2DGraph/J2DWindow.cpp @@ -150,19 +150,19 @@ J2DWindow::J2DWindow(u64 param_0, const JGeometry::TBox2& param_1, const ch void J2DWindow::initiate(const ResTIMG* param_0, const ResTIMG* param_1, const ResTIMG* param_2, const ResTIMG* param_3, const ResTLUT* param_4, J2DWindowMirror param_5, const JGeometry::TBox2& param_6) { if (param_0) { - field_0x100 = new JUTTexture(param_0, 0); + field_0x100 = JKR_NEW JUTTexture(param_0, 0); } if (param_1) { - field_0x104 = new JUTTexture(param_1, 0); + field_0x104 = JKR_NEW JUTTexture(param_1, 0); } if (param_2) { - field_0x108 = new JUTTexture(param_2, 0); + field_0x108 = JKR_NEW JUTTexture(param_2, 0); } if (param_3) { - field_0x10c = new JUTTexture(param_3, 0); + field_0x10c = JKR_NEW JUTTexture(param_3, 0); } if (param_4) { - mPalette = new JUTPalette(GX_TLUT0, const_cast(param_4)); + mPalette = JKR_NEW JUTPalette(GX_TLUT0, const_cast(param_4)); } field_0x144 = param_5; if (field_0x100 && field_0x104 && field_0x108 && field_0x10c) { @@ -189,23 +189,23 @@ void J2DWindow::private_readStream(J2DPane* param_0, JSURandomInputStream* param field_0x114.set(f31, f30, f29, f28); ResTIMG* timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); if (timg) { - field_0x100 = new JUTTexture(timg, 0); + field_0x100 = JKR_NEW JUTTexture(timg, 0); } timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); if (timg) { - field_0x104 = new JUTTexture(timg, 0); + field_0x104 = JKR_NEW JUTTexture(timg, 0); } timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); if (timg) { - field_0x108 = new JUTTexture(timg, 0); + field_0x108 = JKR_NEW JUTTexture(timg, 0); } timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); if (timg) { - field_0x10c = new JUTTexture(timg, 0); + field_0x10c = JKR_NEW JUTTexture(timg, 0); } ResTLUT* tlut = (ResTLUT*)getPointer(param_1, 'TLUT', param_2); if (tlut) { - mPalette = new JUTPalette(GX_TLUT0, tlut); + mPalette = JKR_NEW JUTPalette(GX_TLUT0, tlut); } field_0x144 = param_1->read8b(); field_0x128.set(param_1->read32b()); @@ -218,7 +218,7 @@ void J2DWindow::private_readStream(J2DPane* param_0, JSURandomInputStream* param int unused; timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2); if (timg) { - field_0x110 = new JUTTexture(timg, 0); + field_0x110 = JKR_NEW JUTTexture(timg, 0); } r27--; } @@ -288,12 +288,12 @@ J2DWindowMirror J2DWindow::convertMirror(J2DTextureBase texBase) { } J2DWindow::~J2DWindow() { - delete field_0x100; - delete field_0x104; - delete field_0x108; - delete field_0x10c; - delete mPalette; - delete field_0x110; + JKR_DELETE(field_0x100); + JKR_DELETE(field_0x104); + JKR_DELETE(field_0x108); + JKR_DELETE(field_0x10c); + JKR_DELETE(mPalette); + JKR_DELETE(field_0x110); } void J2DWindow::draw(JGeometry::TBox2 const& param_0) { diff --git a/libs/JSystem/src/J2DGraph/J2DWindowEx.cpp b/libs/JSystem/src/J2DGraph/J2DWindowEx.cpp index 87bb4ef0a2..95d5f0dfeb 100644 --- a/libs/JSystem/src/J2DGraph/J2DWindowEx.cpp +++ b/libs/JSystem/src/J2DGraph/J2DWindowEx.cpp @@ -112,12 +112,12 @@ void J2DWindowEx::setMinSize() { J2DWindowEx::~J2DWindowEx() { for (u8 i = 0; i < 4; i++) { if (field_0x170 & (1 << i)) { - delete mFrameMaterial[i]; + JKR_DELETE(mFrameMaterial[i]); } } if (field_0x170 & 0x10) { - delete mContentsMaterial; + JKR_DELETE(mContentsMaterial); } } @@ -759,7 +759,7 @@ void J2DWindowEx::setAnimation(J2DAnmVtxColor* param_0) { if (field_0x168[i] != 0xffff) { for (u16 j = 0; j < uVar3; j++) { J3DAnmVtxColorIndexData* puVar1 = param_0->getAnmVtxColorIndexData(0, j); - u16* indexPointer2 = + BE(u16)* indexPointer2 = param_0->getVtxColorIndexPointer(0) + (uintptr_t)puVar1->mpData; for (u16 k = 0; k < puVar1->mNum; k++) { if (indexPointer2[k] == field_0x168[i]) { @@ -803,7 +803,7 @@ const J2DAnmTransform* J2DWindowEx::animationPane(J2DAnmTransform const* param_0 if ((field_0x17c & (1 << i))) { for (u16 j = 0; j < uVar3; j++) { J3DAnmVtxColorIndexData* puVar1 = mAnmVtxColor->getAnmVtxColorIndexData(0, j); - u16* indexPointer2 = + BE(u16)* indexPointer2 = mAnmVtxColor->getVtxColorIndexPointer(0) + (uintptr_t)puVar1->mpData; for (u16 k = 0; k < puVar1->mNum; k++) { if (indexPointer2[k] == field_0x168[i]) { diff --git a/libs/JSystem/src/J3DGraphAnimator/J3DAnimation.cpp b/libs/JSystem/src/J3DGraphAnimator/J3DAnimation.cpp index 4fa3c9e688..8bbdc68204 100644 --- a/libs/JSystem/src/J3DGraphAnimator/J3DAnimation.cpp +++ b/libs/JSystem/src/J3DGraphAnimator/J3DAnimation.cpp @@ -554,7 +554,7 @@ inline f32 J3DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16 const* pp2 } // clang-format on return fout; -#else +#else f32 time1 = (f32)*pp2; f32 value1 = (f32)*pp3; f32 tangent1 = (f32)*pp4; @@ -583,6 +583,18 @@ inline f32 J3DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16 const* pp2 #endif } +inline f32 J3DHermiteInterpolation(f32 p1, BE(f32) const* p2, BE(f32) const* p3, BE(f32) const* p4, + BE(f32) const* p5, BE(f32) const* p6, BE(f32) const* p7) { + return JMAHermiteInterpolation(p1, *p2, *p3, *p4, *p5, *p6, *p7); +} + +inline f32 J3DHermiteInterpolation(f32 pp1, BE(s16) const* pp2, + BE(s16) const* pp3, BE(s16) const* pp4, + BE(s16) const* pp5, BE(s16) const* pp6, + BE(s16) const* pp7) { + return JMAHermiteInterpolation(pp1, *pp2, *pp3, *pp4, *pp5, *pp6, *pp7); +} + template f32 J3DGetKeyFrameInterpolation(f32 frame, J3DAnmKeyTableBase* pKeyTable, T* pData) { J3D_ASSERT_NULLPTR(740, pData != NULL); diff --git a/libs/JSystem/src/J3DGraphAnimator/J3DJointTree.cpp b/libs/JSystem/src/J3DGraphAnimator/J3DJointTree.cpp index f6b54ff587..6a0a5297e6 100644 --- a/libs/JSystem/src/J3DGraphAnimator/J3DJointTree.cpp +++ b/libs/JSystem/src/J3DGraphAnimator/J3DJointTree.cpp @@ -73,8 +73,8 @@ void J3DJointTree::findImportantMtxIndex() { s32 wEvlpMtxNum = getWEvlpMtxNum(); u32 tableIdx = 0; u16 drawFullWgtMtxNum = getDrawFullWgtMtxNum(); - u16* wEvlpMixIndex = getWEvlpMixMtxIndex(); - f32* wEvlpMixWeight = getWEvlpMixWeight(); + BE(u16)* wEvlpMixIndex = getWEvlpMixMtxIndex(); + BE(f32)* wEvlpMixWeight = getWEvlpMixWeight(); u16* wEvlpImportantMtxIdx = getWEvlpImportantMtxIndex(); // Rigid matrices are easy. diff --git a/libs/JSystem/src/J3DGraphAnimator/J3DMaterialAttach.cpp b/libs/JSystem/src/J3DGraphAnimator/J3DMaterialAttach.cpp index ee148288a1..6004d366e5 100644 --- a/libs/JSystem/src/J3DGraphAnimator/J3DMaterialAttach.cpp +++ b/libs/JSystem/src/J3DGraphAnimator/J3DMaterialAttach.cpp @@ -1,8 +1,9 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h" #include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h" +#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTAssert.h" void J3DMaterialTable::clear() { @@ -153,7 +154,7 @@ int J3DMaterialTable::createTexMtxForAnimator(J3DAnmTextureSRTKey* pTexSRTKey) { rv = 1; } else { if (texMtx != 0xff && material->getTexMtx(texMtx) == NULL) { - J3DTexMtx* mtx = new J3DTexMtx(); + J3DTexMtx* mtx = JKR_NEW J3DTexMtx(); rv = 4; material->setTexMtx(texMtx, mtx); JUT_WARN(420, "matNo<%d> : texMtx%d nothing !\n", matNo, texMtx); diff --git a/libs/JSystem/src/J3DGraphAnimator/J3DModel.cpp b/libs/JSystem/src/J3DGraphAnimator/J3DModel.cpp index f423f1db2f..9db93d78cd 100644 --- a/libs/JSystem/src/J3DGraphAnimator/J3DModel.cpp +++ b/libs/JSystem/src/J3DGraphAnimator/J3DModel.cpp @@ -1,12 +1,13 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/J3DGraphAnimator/J3DModel.h" #include "JSystem/J3DGraphAnimator/J3DJoint.h" #include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h" +#include "JSystem/J3DGraphAnimator/J3DModel.h" #include "JSystem/J3DGraphAnimator/J3DShapeTable.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" #include "JSystem/J3DGraphBase/J3DShapeMtx.h" #include "JSystem/J3DGraphBase/J3DSys.h" +#include "JSystem/JKernel/JKRHeap.h" #define J3D_ASSERTMSG(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG) #define J3D_WARN1(LINE, MSG, ARG1) JUT_WARN(LINE, MSG, ARG1) @@ -41,7 +42,7 @@ s32 J3DModel::entryModelData(J3DModelData* pModelData, u32 mdlFlags, u32 mtxNum) int ret = kJ3DError_Success; mModelData = pModelData; - mMtxBuffer = new J3DMtxBuffer(); + mMtxBuffer = JKR_NEW J3DMtxBuffer(); if (mMtxBuffer == NULL) { return kJ3DError_Alloc; @@ -99,7 +100,7 @@ s32 J3DModel::createShapePacket(J3DModelData* pModelData) { J3D_ASSERTMSG(173, pModelData != NULL, "Error : null pointer."); if (pModelData->getShapeNum() != 0) { - mShapePacket = new J3DShapePacket[pModelData->getShapeNum()]; + mShapePacket = JKR_NEW J3DShapePacket[pModelData->getShapeNum()]; if (mShapePacket == NULL) { return kJ3DError_Alloc; @@ -119,7 +120,7 @@ s32 J3DModel::createMatPacket(J3DModelData* pModelData, u32 mdlFlags) { s32 ret = 0; if (pModelData->getMaterialNum() != 0) { - mMatPacket = new J3DMatPacket[pModelData->getMaterialNum()]; + mMatPacket = JKR_NEW J3DMatPacket[pModelData->getMaterialNum()]; if (mMatPacket == NULL) { return kJ3DError_Alloc; diff --git a/libs/JSystem/src/J3DGraphAnimator/J3DModelData.cpp b/libs/JSystem/src/J3DGraphAnimator/J3DModelData.cpp index 606882eb0a..e296676187 100644 --- a/libs/JSystem/src/J3DGraphAnimator/J3DModelData.cpp +++ b/libs/JSystem/src/J3DGraphAnimator/J3DModelData.cpp @@ -86,9 +86,9 @@ void J3DModelData::simpleCalcMaterial(u16 idx, Mtx param_1) { void J3DModelData::syncJ3DSysPointers() const { j3dSys.setTexture(getTexture()); - j3dSys.setVtxPos(getVtxPosArray()); - j3dSys.setVtxNrm(getVtxNrmArray()); - j3dSys.setVtxCol(getVtxColorArray(0)); + j3dSys.setVtxPos(getVtxPosArray(), getVtxNum()); + j3dSys.setVtxNrm(getVtxNrmArray(), getNrmNum()); + j3dSys.setVtxCol(getVtxColorArray(0), getColNum()); } void J3DModelData::syncJ3DSysFlags() const { diff --git a/libs/JSystem/src/J3DGraphAnimator/J3DMtxBuffer.cpp b/libs/JSystem/src/J3DGraphAnimator/J3DMtxBuffer.cpp index 8b881d27d0..3e031400ac 100644 --- a/libs/JSystem/src/J3DGraphAnimator/J3DMtxBuffer.cpp +++ b/libs/JSystem/src/J3DGraphAnimator/J3DMtxBuffer.cpp @@ -93,8 +93,8 @@ s32 J3DMtxBuffer::create(J3DModelData* pModelData, u32 mtxNum) { J3DError J3DMtxBuffer::createAnmMtx(J3DModelData* pModelData) { if (pModelData->getJointNum() != 0) { - mpScaleFlagArr = new u8[pModelData->getJointNum()]; - mpAnmMtx = new Mtx[pModelData->getJointNum()]; + mpScaleFlagArr = JKR_NEW u8[pModelData->getJointNum()]; + mpAnmMtx = JKR_NEW Mtx[pModelData->getJointNum()]; mpUserAnmMtx = mpAnmMtx; } @@ -110,8 +110,8 @@ J3DError J3DMtxBuffer::createAnmMtx(J3DModelData* pModelData) { s32 J3DMtxBuffer::createWeightEnvelopeMtx(J3DModelData* pModelData) { if (pModelData->getWEvlpMtxNum() != 0) { - mpEvlpScaleFlagArr = new u8[pModelData->getWEvlpMtxNum()]; - mpWeightEvlpMtx = new Mtx[pModelData->getWEvlpMtxNum()]; + mpEvlpScaleFlagArr = JKR_NEW u8[pModelData->getWEvlpMtxNum()]; + mpWeightEvlpMtx = JKR_NEW Mtx[pModelData->getWEvlpMtxNum()]; } if (pModelData->getWEvlpMtxNum() != 0 && mpEvlpScaleFlagArr == NULL) @@ -132,8 +132,8 @@ s32 J3DMtxBuffer::setNoUseDrawMtx() { s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* pModelData, u32 mtxNum) { if (mtxNum != 0) { for (s32 i = 0; i < 2; i++) { - mpDrawMtxArr[i] = new Mtx*[mtxNum]; - mpNrmMtxArr[i] = new Mtx33*[mtxNum]; + mpDrawMtxArr[i] = JKR_NEW Mtx*[mtxNum]; + mpNrmMtxArr[i] = JKR_NEW Mtx33*[mtxNum]; mpBumpMtxArr[i] = NULL; } } @@ -150,8 +150,8 @@ s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* pModelData, u32 mtxNum) { for (s32 i = 0; i < 2; i++) { for (u32 j = 0; j < mtxNum; j++) { if (pModelData->getDrawMtxNum() != 0) { - mpDrawMtxArr[i][j] = new (0x20) Mtx[pModelData->getDrawMtxNum()]; - mpNrmMtxArr[i][j] = new (0x20) Mtx33[pModelData->getDrawMtxNum()]; + mpDrawMtxArr[i][j] = JKR_NEW_ARGS (0x20) Mtx[pModelData->getDrawMtxNum()]; + mpNrmMtxArr[i][j] = JKR_NEW_ARGS (0x20) Mtx33[pModelData->getDrawMtxNum()]; } } } @@ -187,7 +187,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) { if (bumpMtxNum != 0 && mtxNum != 0) { for (int i = 0; i < 2; i++) { - mpBumpMtxArr[i] = new Mtx33**[(u16)materialCount]; + mpBumpMtxArr[i] = JKR_NEW Mtx33**[(u16)materialCount]; if (mpBumpMtxArr[i] == NULL) { return kJ3DError_Alloc; } @@ -200,7 +200,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) { for (u16 j = 0; j < materialNum; j++) { J3DMaterial* material = i_modelData->getMaterialNodePointer(j); if (material->getNBTScale()->mbHasScale == true) { - mpBumpMtxArr[i][offset] = new Mtx33*[mtxNum]; + mpBumpMtxArr[i][offset] = JKR_NEW Mtx33*[mtxNum]; if (mpBumpMtxArr[i][offset] == NULL) { return kJ3DError_Alloc; } @@ -217,7 +217,7 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) { J3DMaterial* material = i_modelData->getMaterialNodePointer((u16)j); if (material->getNBTScale()->mbHasScale == true) { for (int k = 0; k < mtxNum; k++) { - mpBumpMtxArr[i][offset][k] = new (0x20) Mtx33[i_modelData->getDrawMtxNum()]; + mpBumpMtxArr[i][offset][k] = JKR_NEW_ARGS (0x20) Mtx33[i_modelData->getDrawMtxNum()]; if (mpBumpMtxArr[i][offset][k] == NULL) { return kJ3DError_Alloc; } @@ -240,15 +240,15 @@ static f32 J3DUnit01[] = { 0.0f, 1.0f }; void J3DMtxBuffer::calcWeightEnvelopeMtx() { __REGISTER MtxP weightAnmMtx; __REGISTER Mtx* worldMtx; - __REGISTER Mtx* invMtx; + __REGISTER Mtx invMtx; __REGISTER f32 weight; int idx; int j; int mixNum; int i; int max; - u16* indices; - f32* weights; + BE(u16)* indices; + BE(f32)* weights; u8* pScale; #if DEBUG || !__MWERKS__ @@ -311,11 +311,13 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() { do { idx = *++indices; worldMtx = &mpAnmMtx[idx]; - invMtx = &mJointTree->getInvJointMtx((u16)idx); + #if DEBUG || !__MWERKS__ - MTXConcat(*worldMtx, *invMtx, mtx); + mJointTree->getInvJointMtx((u16)idx).to_host(invMtx); + MTXConcat(*worldMtx, invMtx, mtx); #else + invMtx = &mJointTree->getInvJointMtx((u16)idx); // Fakematch? Doesn't match if worldMtx and invMtx are used directly. __REGISTER void* var_r5 = worldMtx; __REGISTER void* var_r6 = invMtx; diff --git a/libs/JSystem/src/J3DGraphAnimator/J3DSkinDeform.cpp b/libs/JSystem/src/J3DGraphAnimator/J3DSkinDeform.cpp index f461b437a4..b7f6fd3339 100644 --- a/libs/JSystem/src/J3DGraphAnimator/J3DSkinDeform.cpp +++ b/libs/JSystem/src/J3DGraphAnimator/J3DSkinDeform.cpp @@ -79,17 +79,17 @@ J3DSkinDeform::J3DSkinDeform() { mSkinNList = NULL; } -u16* J3DSkinDeform::sWorkArea_WEvlpMixMtx[1024]; +BE(u16)* J3DSkinDeform::sWorkArea_WEvlpMixMtx[1024]; -f32* J3DSkinDeform::sWorkArea_WEvlpMixWeight[1024]; +BE(f32)* J3DSkinDeform::sWorkArea_WEvlpMixWeight[1024]; void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) { J3D_ASSERT_NULLPTR(322, pModelData != NULL); int vtxNum = pModelData->getVtxNum(); int wevlpMtxNum = pModelData->getWEvlpMtxNum(); - u16* wevlpMtxIndex = pModelData->getWEvlpMixMtxIndex(); - f32* wevlpMixWeights = pModelData->getWEvlpMixWeight(); + BE(u16)* wevlpMtxIndex = pModelData->getWEvlpMixMtxIndex(); + BE(f32)* wevlpMixWeights = pModelData->getWEvlpMixWeight(); int currentOffset = 0; for (int i = 0; i < wevlpMtxNum; i++) { @@ -99,7 +99,7 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) { } if (pModelData->getJointNum() != 0) { - mSkinNList = new J3DSkinNList[pModelData->getJointNum()]; + mSkinNList = JKR_NEW J3DSkinNList[pModelData->getJointNum()]; } for (int i = 0; i < pModelData->getVtxNum(); i++) { @@ -111,7 +111,7 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) { } else { u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8); int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex); - u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex]; + BE(u16)* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex]; for (int j = 0; j < wevlpMtxNum; j++) { mSkinNList[indices[j]].field_0x10++; } @@ -128,7 +128,7 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) { } else { u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8); int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex); - u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex]; + BE(u16)* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex]; for (int j = 0; j < wevlpMtxNum; j++) { mSkinNList[indices[j]].field_0x12++; } @@ -138,13 +138,13 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) { for (u16 i = 0; i < pModelData->getJointNum(); i++) { if (mSkinNList[i].field_0x10) { - mSkinNList[i].field_0x0 = new u16[mSkinNList[i].field_0x10]; - mSkinNList[i].field_0x8 = new f32[mSkinNList[i].field_0x10]; + mSkinNList[i].field_0x0 = JKR_NEW u16[mSkinNList[i].field_0x10]; + mSkinNList[i].field_0x8 = JKR_NEW f32[mSkinNList[i].field_0x10]; mSkinNList[i].field_0x10 = 0; } if (mSkinNList[i].field_0x12) { - mSkinNList[i].field_0x4 = new u16[mSkinNList[i].field_0x12]; - mSkinNList[i].field_0xc = new f32[mSkinNList[i].field_0x12]; + mSkinNList[i].field_0x4 = JKR_NEW u16[mSkinNList[i].field_0x12]; + mSkinNList[i].field_0xc = JKR_NEW f32[mSkinNList[i].field_0x12]; mSkinNList[i].field_0x12 = 0; } } @@ -160,8 +160,8 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) { } else { u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8); int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex); - u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex]; - f32* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex]; + BE(u16)* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex]; + BE(f32)* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex]; for (int j = 0; j < wevlpMtxNum; j++) { int uVar9 = mSkinNList[indices[j]].field_0x10++; mSkinNList[indices[j]].field_0x0[uVar9] = i; @@ -182,8 +182,8 @@ void J3DSkinDeform::initSkinInfo(J3DModelData* pModelData) { } else { u16 drawMtxIndex = pModelData->getDrawMtxIndex(uVar8); int wevlpMtxNum = pModelData->getWEvlpMixMtxNum(drawMtxIndex); - u16* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex]; - f32* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex]; + BE(u16)* indices = sWorkArea_WEvlpMixMtx[drawMtxIndex]; + BE(f32)* weights = sWorkArea_WEvlpMixWeight[drawMtxIndex]; for (int j = 0; j < wevlpMtxNum; j++) { int uVar9 = mSkinNList[indices[j]].field_0x12++; mSkinNList[indices[j]].field_0x4[uVar9] = i; @@ -202,7 +202,7 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) { return kJ3DError_Success; } - mPosData = new u16[pModelData->getVtxNum()]; + mPosData = JKR_NEW u16[pModelData->getVtxNum()]; if (mPosData == NULL) { return kJ3DError_Alloc; } @@ -212,7 +212,7 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) { } if (pModelData->getNrmNum()) { - mNrmData = new u16[pModelData->getNrmNum()]; + mNrmData = JKR_NEW u16[pModelData->getNrmNum()]; if (mNrmData == NULL) { return kJ3DError_Alloc; } @@ -223,8 +223,8 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) { mNrmData = NULL; } - mPosMtx = new Mtx[pModelData->getJointNum()]; - mNrmMtx = new (32) Mtx33[pModelData->getDrawMtxNum()]; + mPosMtx = JKR_NEW Mtx[pModelData->getJointNum()]; + mNrmMtx = JKR_NEW_ARGS (32) Mtx33[pModelData->getDrawMtxNum()]; if (mPosMtx == NULL) { return kJ3DError_Alloc; } @@ -298,7 +298,7 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) { #if PLATFORM_GCN uVar13 = *(u16*)(pDListPos + 1); #else - uVar13 = *(u16*)pDListPos; + uVar13 = be16(*(u16*)pDListPos); pDListPos += 2; #endif for (int local_60 = 0; local_60 < uVar13; local_60++) { @@ -308,9 +308,9 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) { u8* iVar5 = ((u8*)pDListPos + r23 * local_60); #endif u8 bVar3 = *(u8*)(iVar5 + pnmtx_num) / 3U; - u16 vtx_idx = *(u16*)(iVar5 + vtx_num); - u16 nrm_idx = *(u16*)(iVar5 + nrm_num); - u16 uVar3 = *(u16*)(iVar5 + tex_num); + u16 vtx_idx = be16(*(u16*)(iVar5 + vtx_num)); + u16 nrm_idx = be16(*(u16*)(iVar5 + nrm_num)); + u16 uVar3 = be16(*(u16*)(iVar5 + tex_num)); u16 local_76 = pShapeMtx->getUseMtxIndex(bVar3); if (local_76 == 0xffff) { local_76 = sWorkArea_MtxReg[bVar3]; @@ -376,9 +376,10 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) { if (cmd != GX_TRIANGLEFAN && cmd != GX_TRIANGLESTRIP) break; - int vtxCount = *(u16*)dl; + u16 vtxCountBE = *(u16*)dl; + int vtxCount = be16(vtxCountBE); dl += 2; - *(u16*)dst = vtxCount; + *(u16*)dst = vtxCountBE; dst += 2; for (int k = 0; k < vtxCount; k++) { @@ -448,7 +449,9 @@ void J3DSkinDeform::transformVtxPosNrm(J3DModelData* pModelData) { u16 drawMtxIndex = pModelData->getDrawMtxIndex(posIndex); Vec* pos = ((Vec*)pModelData->getVtxPosArray()) + i; Mtx invMtx; - MTXInverse(pModelData->getInvJointMtx(drawMtxIndex), invMtx); + Mtx copy; + pModelData->getInvJointMtx(drawMtxIndex).to_host(copy); + MTXInverse(copy, invMtx); MTXMultVec(invMtx, pos, pos); } } @@ -459,7 +462,9 @@ void J3DSkinDeform::transformVtxPosNrm(J3DModelData* pModelData) { u16 drawMtxIndex = pModelData->getDrawMtxIndex(nrmIndex); Vec* nrm = ((Vec*)pModelData->getVtxNrmArray()) + i; Mtx invMtx; - MTXInverse(pModelData->getInvJointMtx(drawMtxIndex), invMtx); + Mtx copy; + pModelData->getInvJointMtx(drawMtxIndex).to_host(copy); + MTXInverse(copy, invMtx); MTXMultVecSR(invMtx, nrm, nrm); } } @@ -474,10 +479,12 @@ void J3DSkinDeform::calcAnmInvJointMtx(J3DMtxBuffer* pMtxBuffer) { if (pMtxBuffer->getJointTree()->getWEvlpMtxNum() != 0) { int jointNum = pMtxBuffer->getJointTree()->getJointNum(); Mtx* anmMtx = (Mtx*)pMtxBuffer->getAnmMtx(0); - Mtx* invJointMtx = &pMtxBuffer->getJointTree()->getInvJointMtx(0); + BE(Mtx)* invJointMtx = &pMtxBuffer->getJointTree()->getInvJointMtx(0); Mtx* posMtx = mPosMtx; for (int i = 0; i < jointNum; i++) { - MTXConcat(anmMtx[i], invJointMtx[i], posMtx[i]); + Mtx copy; + invJointMtx[i].to_host(copy); + MTXConcat(anmMtx[i], copy, posMtx[i]); } } } diff --git a/libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp b/libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp index 03aa07bdd2..fab11a0999 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp @@ -25,7 +25,7 @@ void J3DDrawBuffer::initialize() { } int J3DDrawBuffer::allocBuffer(u32 size) { - mpBuffer = new (0x20) J3DPacket*[size]; + mpBuffer = JKR_NEW_ARGS (0x20) J3DPacket*[size]; if (mpBuffer == NULL) return kJ3DError_Alloc; @@ -39,7 +39,7 @@ int J3DDrawBuffer::allocBuffer(u32 size) { J3DDrawBuffer::~J3DDrawBuffer() { frameInit(); - delete[] mpBuffer; + JKR_DELETE_ARRAY(mpBuffer); mpBuffer = NULL; } diff --git a/libs/JSystem/src/J3DGraphBase/J3DGD.cpp b/libs/JSystem/src/J3DGraphBase/J3DGD.cpp index 6071837637..f38159f937 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DGD.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DGD.cpp @@ -6,6 +6,7 @@ #include "JSystem/J3DGraphBase/J3DGD.h" #include "JSystem/J3DGraphBase/J3DFifo.h" +#include void J3DGDSetGenMode(u8 nTexGens, u8 nChans, u8 nTevs, u8 nInds, GXCullMode cm) { @@ -350,7 +351,7 @@ void J3DGDSetTexImgAttr(GXTexMapID id, u16 width, u16 height, GXTexFmt format) { void J3DGDSetTexImgPtr(GXTexMapID id, void* image_ptr) { #if TARGET_PC - puts("J3DGDSetTexImgPtr is a stub"); + STUB_LOG(); #else J3DGDWriteBPCmd(BP_IMAGE_PTR(OSCachedToPhysical(image_ptr) >> 5, J3DGDTexImage3Ids[id])); #endif @@ -372,7 +373,7 @@ void J3DGDLoadTlut(void* tlut_ptr, u32 tmem_addr, GXTlutSize size) { J3DGDWriteBPCmd(0xFEFFFF00); J3DGDWriteBPCmd(0xF000000); #if TARGET_PC - puts("J3DGDLoadTlut is a stub"); + STUB_LOG(); return; #endif J3DGDWriteBPCmd(BP_LOAD_TLUT0(OSCachedToPhysical(tlut_ptr) >> 5, 0x64)); diff --git a/libs/JSystem/src/J3DGraphBase/J3DMatBlock.cpp b/libs/JSystem/src/J3DGraphBase/J3DMatBlock.cpp index 004189a89b..f401f16c43 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DMatBlock.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DMatBlock.cpp @@ -9,14 +9,14 @@ inline void loadMatColors(const J3DGXColor* color) { J3DGDWriteXFCmdHdr(0x100C, 2); - J3DGDWrite_u32(*(u32*)color); - J3DGDWrite_u32(*(u32*)(color + 1)); + J3DGDWrite_u32(*(BE(u32)*)color); + J3DGDWrite_u32(*(BE(u32)*)(color + 1)); } inline void loadAmbColors(const J3DGXColor* color) { J3DGDWriteXFCmdHdr(0x100A, 2); - J3DGDWrite_u32(*(u32*)color); - J3DGDWrite_u32(*(u32*)(color + 1)); + J3DGDWrite_u32(*(BE(u32)*)color); + J3DGDWrite_u32(*(BE(u32)*)(color + 1)); } inline void loadTexCoordScale(GXTexCoordID coord, const J3DTexCoordScaleInfo& info) { @@ -1366,6 +1366,14 @@ void J3DTevBlock16::ptrToIndex() { DCStoreRange(start, (uintptr_t)end - (uintptr_t)start); } +void J3DTevBlock16::loadTexture() { + for (u32 i = 0; i < 8; i++) { + if (mTexNo[i] != 0xFFFF) { + j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i)); + } + } +} + void J3DTevBlockPatched::ptrToIndex() { GDSetCurrOffset(mTexNoOffset); void* start = GDGetCurrPointer(); @@ -1390,6 +1398,14 @@ void J3DTevBlockPatched::ptrToIndex() { DCStoreRange(start, (uintptr_t)end - (uintptr_t)start); } +void J3DTevBlockPatched::loadTexture() { + for (u32 i = 0; i < 8; i++) { + if (mTexNo[i] != 0xFFFF) { + j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i)); + } + } +} + void J3DTevBlock::indexToPtr_private(u32 offs) { GDSetCurrOffset(offs); void* start = GDGetCurrPointer(); @@ -1682,6 +1698,30 @@ void J3DTevBlockPatched::reset(J3DTevBlock* pBlock) { } } +void J3DTevBlock1::loadTexture() { + for (u32 i = 0; i < 1; i++) { + if (mTexNo[i] != 0xFFFF) { + j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i)); + } + } +} + +void J3DTevBlock2::loadTexture() { + for (u32 i = 0; i < 2; i++) { + if (mTexNo[i] != 0xFFFF) { + j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i)); + } + } +} + +void J3DTevBlock4::loadTexture() { + for (u32 i = 0; i < 4; i++) { + if (mTexNo[i] != 0xFFFF) { + j3dSys.getTexture()->loadGX(mTexNo[i], GXTexMapID(GX_TEXMAP0 + i)); + } + } +} + void J3DTevBlock1::reset(J3DTevBlock* pBlock) { J3D_ASSERT_NULLPTR(2633, pBlock != NULL); diff --git a/libs/JSystem/src/J3DGraphBase/J3DMaterial.cpp b/libs/JSystem/src/J3DGraphBase/J3DMaterial.cpp index 4f577f9045..6c39e96c9b 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DMaterial.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DMaterial.cpp @@ -1,19 +1,20 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/J3DGraphBase/J3DMaterial.h" #include "JSystem/J3DGraphBase/J3DGD.h" +#include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "JSystem/JKernel/JKRHeap.h" J3DColorBlock* J3DMaterial::createColorBlock(u32 flags) { J3DColorBlock* rv = NULL; switch (flags) { case 0: - rv = new J3DColorBlockLightOff(); + rv = JKR_NEW J3DColorBlockLightOff(); break; case 0x40000000: - rv = new J3DColorBlockLightOn(); + rv = JKR_NEW J3DColorBlockLightOn(); break; case 0x80000000: - rv = new J3DColorBlockAmbientOn(); + rv = JKR_NEW J3DColorBlockAmbientOn(); break; } @@ -25,11 +26,11 @@ J3DTexGenBlock* J3DMaterial::createTexGenBlock(u32 flags) { J3DTexGenBlock* rv = NULL; switch (flags) { case 0x8000000: - rv = new J3DTexGenBlock4(); + rv = JKR_NEW J3DTexGenBlock4(); break; case 0: default: - rv = new J3DTexGenBlockBasic(); + rv = JKR_NEW J3DTexGenBlockBasic(); } J3D_ASSERT_ALLOCMEM(83, rv != NULL); @@ -39,13 +40,13 @@ J3DTexGenBlock* J3DMaterial::createTexGenBlock(u32 flags) { J3DTevBlock* J3DMaterial::createTevBlock(int tevStageNum) { J3DTevBlock* rv = NULL; if (tevStageNum <= 1) { - rv = new J3DTevBlock1(); + rv = JKR_NEW J3DTevBlock1(); } else if (tevStageNum == 2) { - rv = new J3DTevBlock2(); + rv = JKR_NEW J3DTevBlock2(); } else if (tevStageNum <= 4) { - rv = new J3DTevBlock4(); + rv = JKR_NEW J3DTevBlock4(); } else if (tevStageNum <= 16) { - rv = new J3DTevBlock16(); + rv = JKR_NEW J3DTevBlock16(); } J3D_ASSERT_ALLOCMEM(116, rv != NULL); @@ -55,9 +56,9 @@ J3DTevBlock* J3DMaterial::createTevBlock(int tevStageNum) { J3DIndBlock* J3DMaterial::createIndBlock(int flags) { J3DIndBlock* rv = NULL; if (flags != 0) { - rv = new J3DIndBlockFull(); + rv = JKR_NEW J3DIndBlockFull(); } else { - rv = new J3DIndBlockNull(); + rv = JKR_NEW J3DIndBlockNull(); } J3D_ASSERT_ALLOCMEM(139, rv != NULL); @@ -68,24 +69,24 @@ J3DPEBlock* J3DMaterial::createPEBlock(u32 flags, u32 materialMode) { J3DPEBlock* rv = NULL; if (flags == 0) { if (materialMode & 1) { - rv = new J3DPEBlockOpa(); + rv = JKR_NEW J3DPEBlockOpa(); J3D_ASSERT_ALLOCMEM(166, rv != NULL); return rv; } else if (materialMode & 2) { - rv = new J3DPEBlockTexEdge(); + rv = JKR_NEW J3DPEBlockTexEdge(); J3D_ASSERT_ALLOCMEM(172, rv != NULL); return rv; } else if (materialMode & 4) { - rv = new J3DPEBlockXlu(); + rv = JKR_NEW J3DPEBlockXlu(); J3D_ASSERT_ALLOCMEM(178, rv != NULL); return rv; } } if (flags == 0x10000000) { - rv = new J3DPEBlockFull(); + rv = JKR_NEW J3DPEBlockFull(); } else if (flags == 0x20000000) { - rv = new J3DPEBlockFogOff(); + rv = JKR_NEW J3DPEBlockFogOff(); } J3D_ASSERT_ALLOCMEM(188, rv != NULL); @@ -217,6 +218,9 @@ void J3DMaterial::makeSharedDisplayList() { void J3DMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (!j3dSys.checkFlag(2)) { loadNBTScale(*mTexGenBlock->getNBTScale()); } @@ -224,6 +228,9 @@ void J3DMaterial::load() { void J3DMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (!j3dSys.checkFlag(2)) { mSharedDLObj->callDL(); loadNBTScale(*mTexGenBlock->getNBTScale()); @@ -334,7 +341,7 @@ void J3DMaterial::change() { s32 J3DMaterial::newSharedDisplayList(u32 dlSize) { if (mSharedDLObj == NULL) { - mSharedDLObj = new J3DDisplayListObj(); + mSharedDLObj = JKR_NEW J3DDisplayListObj(); if (mSharedDLObj == NULL) { return kJ3DError_Alloc; } @@ -350,7 +357,7 @@ s32 J3DMaterial::newSharedDisplayList(u32 dlSize) { s32 J3DMaterial::newSingleSharedDisplayList(u32 dlSize) { if (mSharedDLObj == NULL) { - mSharedDLObj = new J3DDisplayListObj(); + mSharedDLObj = JKR_NEW J3DDisplayListObj(); if (mSharedDLObj == NULL) { return kJ3DError_Alloc; } @@ -374,6 +381,9 @@ void J3DPatchedMaterial::makeSharedDisplayList() {} void J3DPatchedMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (j3dSys.checkFlag(2)) { return; } @@ -381,6 +391,9 @@ void J3DPatchedMaterial::load() { void J3DPatchedMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (!j3dSys.checkFlag(0x02)) mSharedDLObj->callDL(); } @@ -399,6 +412,9 @@ void J3DLockedMaterial::makeSharedDisplayList() {} void J3DLockedMaterial::load() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (j3dSys.checkFlag(2)) { return; } @@ -406,6 +422,9 @@ void J3DLockedMaterial::load() { void J3DLockedMaterial::loadSharedDL() { j3dSys.setMaterialMode(mMaterialMode); +#if TARGET_PC + mTevBlock->loadTexture(); +#endif if (!j3dSys.checkFlag(0x02)) mSharedDLObj->callDL(); } diff --git a/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp b/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp index 71ddc165fc..1ad0f7cfd1 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DPacket.cpp @@ -12,8 +12,8 @@ J3DError J3DDisplayListObj::newDisplayList(u32 maxSize) { mMaxSize = ALIGN_NEXT(maxSize, 0x20); - mpDisplayList[0] = new (0x20) char[mMaxSize]; - mpDisplayList[1] = new (0x20) char[mMaxSize]; + mpDisplayList[0] = JKR_NEW_ARGS (0x20) char[mMaxSize]; + mpDisplayList[1] = JKR_NEW_ARGS (0x20) char[mMaxSize]; mSize = 0; if (mpDisplayList[0] == NULL || mpDisplayList[1] == NULL) @@ -24,7 +24,7 @@ J3DError J3DDisplayListObj::newDisplayList(u32 maxSize) { J3DError J3DDisplayListObj::newSingleDisplayList(u32 maxSize) { mMaxSize = ALIGN_NEXT(maxSize, 0x20); - mpDisplayList[0] = new (0x20) char[mMaxSize]; + mpDisplayList[0] = JKR_NEW_ARGS (0x20) char[mMaxSize]; mpDisplayList[1] = mpDisplayList[0]; mSize = 0; @@ -36,7 +36,7 @@ J3DError J3DDisplayListObj::newSingleDisplayList(u32 maxSize) { int J3DDisplayListObj::single_To_Double() { if (mpDisplayList[0] == mpDisplayList[1]) { - mpDisplayList[1] = new (0x20) char[mMaxSize]; + mpDisplayList[1] = JKR_NEW_ARGS (0x20) char[mMaxSize]; if (mpDisplayList[1] == NULL) return kJ3DError_Alloc; @@ -144,7 +144,7 @@ J3DDrawPacket::J3DDrawPacket() { J3DDrawPacket::~J3DDrawPacket() {} J3DError J3DDrawPacket::newDisplayList(u32 size) { - mpDisplayListObj = new J3DDisplayListObj(); + mpDisplayListObj = JKR_NEW J3DDisplayListObj(); if (mpDisplayListObj == NULL) return kJ3DError_Alloc; @@ -157,7 +157,7 @@ J3DError J3DDrawPacket::newDisplayList(u32 size) { } J3DError J3DDrawPacket::newSingleDisplayList(u32 size) { - mpDisplayListObj = new J3DDisplayListObj(); + mpDisplayListObj = JKR_NEW J3DDisplayListObj(); if (mpDisplayListObj == NULL) return kJ3DError_Alloc; @@ -207,10 +207,16 @@ bool J3DMatPacket::isSame(J3DMatPacket* pOther) const { } void J3DMatPacket::draw() { +#if TARGET_PC + j3dSys.setTexture(mpTexture); +#endif mpMaterial->load(); callDL(); J3DShapePacket* packet = getShapePacket(); +#if TARGET_PC + packet->mpModel->getVertexBuffer()->setArray(); +#endif packet->getShape()->loadPreDrawSetting(); while (packet != NULL) { diff --git a/libs/JSystem/src/J3DGraphBase/J3DShape.cpp b/libs/JSystem/src/J3DGraphBase/J3DShape.cpp index d365dc47ba..662cf18c01 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DShape.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DShape.cpp @@ -7,7 +7,9 @@ #include "JSystem/J3DGraphBase/J3DPacket.h" #include "JSystem/J3DGraphBase/J3DVertex.h" #include "JSystem/J3DGraphBase/J3DFifo.h" +#include #include +#include "JSystem/JKernel/JKRHeap.h" void J3DGDSetVtxAttrFmtv(GXVtxFmt, GXVtxAttrFmtList const*, bool); void J3DFifoLoadPosMtxImm(Mtx, u32); @@ -85,7 +87,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) { if (attrIdx == -1) return; - GXVtxDescList* newVtxDesc = new GXVtxDescList[attrCount + 2]; + GXVtxDescList* newVtxDesc = JKR_NEW GXVtxDescList[attrCount + 2]; bool inserted = false; vtxDesc = getVtxDesc(); @@ -131,12 +133,36 @@ void J3DLoadCPCmd(u8 addr, u32 val) { GXCmd1u32(val); } +#if TARGET_PC +static void J3DLoadArrayBasePtr(GXAttr attr, void* data, u32 size) { + u32 idx = (attr == GX_VA_NBT) ? 1 : (attr - GX_VA_POS); + GXCmd1u8(GX_LOAD_AURORA); + GXCmd1u16(GX_LOAD_AURORA_ARRAYBASE | idx); + GXCmd1u64((u64)data); + GXCmd1u64((u64)size); +} +#else static void J3DLoadArrayBasePtr(GXAttr attr, void* data) { u32 idx = (attr == GX_VA_NBT) ? 1 : (attr - GX_VA_POS); J3DLoadCPCmd(0xA0 + idx, ((uintptr_t)data & 0x7FFFFFFF)); } +#endif void J3DShape::loadVtxArray() const { +#if TARGET_PC + // TODO: these can very easily overcount if the data isn't in F32 format + if (j3dSys.getVtxPos() != mVertexData->getVtxPosArray()) { + J3DLoadArrayBasePtr(GX_VA_POS, j3dSys.getVtxPos(), j3dSys.mVtxPosNum * sizeof(Vec)); + } + + if (!mHasNBT && j3dSys.getVtxNrm() != mVertexData->getVtxNrmArray()) { + J3DLoadArrayBasePtr(GX_VA_NRM, j3dSys.getVtxNrm(), j3dSys.mVtxNrmNum * sizeof(Vec)); + } + + if (j3dSys.getVtxCol() != mVertexData->getVtxColorArray(0)) { + J3DLoadArrayBasePtr(GX_VA_CLR0, j3dSys.getVtxCol(), j3dSys.mVtxColNum * sizeof(GXColor)); + } +#else J3DLoadArrayBasePtr(GX_VA_POS, j3dSys.getVtxPos()); if (!mHasNBT) { @@ -144,6 +170,7 @@ void J3DShape::loadVtxArray() const { } J3DLoadArrayBasePtr(GX_VA_CLR0, j3dSys.getVtxCol()); +#endif } bool J3DShape::isSameVcdVatCmd(J3DShape* other) { @@ -220,17 +247,28 @@ void J3DShape::makeVtxArrayCmd() { mHasNBT = true; stride[GX_VA_NRM - GX_VA_POS] *= 3; array[GX_VA_NRM - GX_VA_POS] = mVertexData->getVtxNBTArray(); + // TODO: How set array size here? } else if (vtxDesc->attr == GX_VA_PNMTXIDX && vtxDesc->type != GX_NONE) { mHasPNMTXIdx = true; } } +#if TARGET_PC + for (u32 i = 0; i < 12; i++) { + GXAttr attr = GXAttr(i + GX_VA_POS); + if (array[i] != nullptr) + GDSetArraySized(attr, array[i], mVertexData->getVtxArrByteSize(attr), mVertexData->getVtxArrStride(attr)); + else + GDSetArraySized(attr, nullptr, 0, mVertexData->getVtxArrStride(attr)); + } +#else for (u32 i = 0; i < 12; i++) { if (array[i] != 0) GDSetArray((GXAttr)(i + GX_VA_POS), array[i], stride[i]); else GDSetArrayRaw((GXAttr)(i + GX_VA_POS), 0, stride[i]); } +#endif } void J3DShape::makeVcdVatCmd() { diff --git a/libs/JSystem/src/J3DGraphBase/J3DShapeDraw.cpp b/libs/JSystem/src/J3DGraphBase/J3DShapeDraw.cpp index f05d907e32..4bf05b26a2 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DShapeDraw.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DShapeDraw.cpp @@ -28,7 +28,7 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) { u32 byteNum = countVertex(stride); u32 oldSize = mDisplayListSize; u32 newSize = ALIGN_NEXT(oldSize + byteNum, 0x20); - u8* newDLStart = new (0x20) u8[newSize]; + u8* newDLStart = JKR_NEW_ARGS (0x20) u8[newSize]; u8* oldDLStart = (u8*)mDisplayList; u8* oldDL = oldDLStart; u8* newDL = newDLStart; @@ -58,7 +58,7 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) { newDL += (stride - attrOffs); } - oldDL = (u8*)oldDL + stride * vtxNum; + oldDL = (u8*)oldDL + stride * be16(vtxNum); } u32 realSize = ALIGN_NEXT((uintptr_t)newDL - (uintptr_t)newDLStart, 0x20); diff --git a/libs/JSystem/src/J3DGraphBase/J3DShapeMtx.cpp b/libs/JSystem/src/J3DGraphBase/J3DShapeMtx.cpp index eda9a1404f..6048ea45ee 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DShapeMtx.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DShapeMtx.cpp @@ -332,7 +332,9 @@ void J3DShapeMtxConcatView::loadMtxConcatView_PNCPU(int slot, u16 drw) const { void J3DShapeMtxConcatView::loadMtxConcatView_PNGP_LOD(int slot, u16 drw) const { Mtx m; MTXConcat(*j3dSys.getShapePacket()->getBaseMtxPtr(), j3dSys.getModelDrawMtx(drw), m); - MTXConcat(m, j3dSys.getModel()->getModelData()->getInvJointMtx(drw), m); + Mtx copy; + j3dSys.getModel()->getModelData()->getInvJointMtx(drw).to_host(copy); + MTXConcat(m, copy, m); J3DDifferedTexMtx::load(m); J3DFifoLoadPosMtxImm(m, slot * 3); loadNrmMtx(slot, drw, m); diff --git a/libs/JSystem/src/J3DGraphBase/J3DSys.cpp b/libs/JSystem/src/J3DGraphBase/J3DSys.cpp index 88324c30b5..b3add6420b 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DSys.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DSys.cpp @@ -264,8 +264,17 @@ void J3DSys::reinitTransform() { } void J3DSys::reinitTexture() { +#if TARGET_PC + static GXTexObj texObj; + static bool initialized = false; + if (!initialized) { + GXInitTexObj(&texObj, NullTexData, 4, 4, GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE); + initialized = true; + } +#else GXTexObj texObj; GXInitTexObj(&texObj, NullTexData, 4, 4, GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE); +#endif GXLoadTexObj(&texObj, GX_TEXMAP0); GXLoadTexObj(&texObj, GX_TEXMAP1); GXLoadTexObj(&texObj, GX_TEXMAP2); diff --git a/libs/JSystem/src/J3DGraphBase/J3DTexture.cpp b/libs/JSystem/src/J3DGraphBase/J3DTexture.cpp index 70d9a69031..dcbb65f86b 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DTexture.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DTexture.cpp @@ -1,12 +1,27 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/J3DGraphBase/J3DTexture.h" #include "JSystem/J3DAssert.h" +#include "JSystem/J3DGraphBase/J3DTexture.h" +#include "JSystem/JKernel/JKRHeap.h" void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const { J3D_ASSERT_RANGE(29, idx < mNum); ResTIMG* timg = getResTIMG(idx); + +#if TARGET_PC + if (timg->width == 0 || timg->height == 0) + return; + if (idx >= mNum) { + OSReport("J3DTexture::loadGX: idx %d out of bounds (mNum=%d)!\n", idx, mNum); + return; + } + if (timg->indexTexture) { + GXLoadTlut(&mpTlutObj[idx], (GXTlut)texMapID); + GXInitTexObjTlut(&mpTexObj[idx], (GXTlut)texMapID); + } + GXLoadTexObj(&mpTexObj[idx], texMapID); +#else GXTexObj texObj; GXTlutObj tlutObj; @@ -30,14 +45,53 @@ void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const { timg->LODBias * kLODBiasScale, timg->biasClamp, timg->doEdgeLOD, (GXAnisotropy)timg->maxAnisotropy); GXLoadTexObj(&texObj, texMapID); +#endif } +#if TARGET_PC +void J3DTexture::loadGXTexObj(u16 idx) { + J3D_ASSERT_RANGE(29, idx < mNum); + ResTIMG* timg = getResTIMG(idx); + + GXTlutObj& tlutObj = mpTlutObj[idx]; + GXTexObj& texObj = mpTexObj[idx]; + + if (!timg->indexTexture) { + GXInitTexObj(&texObj, mpImgDataPtr[idx], timg->width, timg->height, + (GXTexFmt)timg->format, (GXTexWrapMode)timg->wrapS, (GXTexWrapMode)timg->wrapT, + timg->mipmapEnabled); + } else { + GXInitTexObjCI(&texObj, mpImgDataPtr[idx], timg->width, timg->height, + (GXCITexFmt)timg->format, (GXTexWrapMode)timg->wrapS, + (GXTexWrapMode)timg->wrapT, timg->mipmapEnabled, GX_TLUT0); + GXInitTlutObj(&tlutObj, mpTlutDataPtr[idx], (GXTlutFmt)timg->colorFormat, + timg->numColors); + } + + const f32 kLODClampScale = 1.0f / 8.0f; + const f32 kLODBiasScale = 1.0f / 100.0f; + GXInitTexObjLOD(&texObj, (GXTexFilter)timg->minFilter, (GXTexFilter)timg->magFilter, + timg->minLOD * kLODClampScale, timg->maxLOD * kLODClampScale, + timg->LODBias * kLODBiasScale, timg->biasClamp, timg->doEdgeLOD, + (GXAnisotropy)timg->maxAnisotropy); +} +#endif + void J3DTexture::entryNum(u16 num) { J3D_ASSERT_NONZEROARG(79, num != 0); mNum = num; - mpRes = new ResTIMG[num]; + mpRes = JKR_NEW ResTIMG[num]; J3D_ASSERT_ALLOCMEM(83, mpRes != NULL); + + delete[] mpTexObj; + delete[] mpTlutObj; + delete[] mpImgDataPtr; + delete[] mpTlutDataPtr; + mpTexObj = new GXTexObj[num](); + mpTlutObj = new GXTlutObj[num](); + mpImgDataPtr = new u8*[num](); + mpTlutDataPtr = new u8*[num](); for (int i = 0; i < mNum; i++) { mpRes[i].paletteOffset = 0; diff --git a/libs/JSystem/src/J3DGraphBase/J3DVertex.cpp b/libs/JSystem/src/J3DGraphBase/J3DVertex.cpp index 478ff42b0e..7f0086fdf6 100644 --- a/libs/JSystem/src/J3DGraphBase/J3DVertex.cpp +++ b/libs/JSystem/src/J3DGraphBase/J3DVertex.cpp @@ -68,15 +68,15 @@ void J3DVertexBuffer::init() { J3DVertexBuffer::~J3DVertexBuffer() {} void J3DVertexBuffer::setArray() const { - j3dSys.setVtxPos(mCurrentVtxPos); - j3dSys.setVtxNrm(mCurrentVtxNrm); - j3dSys.setVtxCol(mCurrentVtxCol); + j3dSys.setVtxPos(mCurrentVtxPos, mVtxData->getVtxNum()); + j3dSys.setVtxNrm(mCurrentVtxNrm, mVtxData->getNrmNum()); + j3dSys.setVtxCol(mCurrentVtxCol, mVtxData->getColNum()); } s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) { if (flag & 1) { for (int i = 0; i < 2; i++) { - mVtxPosArray[i] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4]; + mVtxPosArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4]; if (mVtxPosArray[i] == NULL) { return kJ3DError_Alloc; } @@ -88,7 +88,7 @@ s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) { mVtxPosArray[0] = mVtxData->getVtxPosArray(); if (mVtxPosArray[1] == NULL) { - mVtxPosArray[1] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4]; + mVtxPosArray[1] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4]; if (mVtxPosArray[1] == NULL) { return kJ3DError_Alloc; } @@ -104,7 +104,7 @@ s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) { s32 J3DVertexBuffer::copyLocalVtxNrmArray(u32 flag) { if (flag & 1) { for (int i = 0; i < 2; i++) { - mVtxNrmArray[i] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4]; + mVtxNrmArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4]; if (mVtxNrmArray[i] == NULL) { return kJ3DError_Alloc; } @@ -116,7 +116,7 @@ s32 J3DVertexBuffer::copyLocalVtxNrmArray(u32 flag) { mVtxNrmArray[0] = mVtxData->getVtxNrmArray(); if (mVtxNrmArray[1] == NULL) { - mVtxNrmArray[1] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4]; + mVtxNrmArray[1] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4]; if (mVtxNrmArray[1] == NULL) { return kJ3DError_Alloc; } @@ -142,7 +142,7 @@ s32 J3DVertexBuffer::copyLocalVtxArray(u32 flag) { for (int i = 0; i < 2; i++) { if (oldPosArray[i] != mVtxPosArray[i]) { if (mVtxPosArray[i] != mVtxData->getVtxPosArray()) - delete mVtxPosArray[i]; + JKR_DELETE(mVtxPosArray[i]); mVtxPosArray[i] = oldPosArray[i]; } } @@ -161,13 +161,13 @@ s32 J3DVertexBuffer::copyLocalVtxArray(u32 flag) { for (int i = 0; i < 2; i++) { if (oldPosArray[i] != mVtxPosArray[i]) { if (mVtxPosArray[i] != mVtxData->getVtxPosArray()) - delete mVtxPosArray[i]; + JKR_DELETE(mVtxPosArray[i]); mVtxPosArray[i] = oldPosArray[i]; } if (oldNrmArray[i] != mVtxNrmArray[i]) { if (mVtxNrmArray[i] != mVtxData->getVtxNrmArray()) - delete mVtxNrmArray[i]; + JKR_DELETE(mVtxNrmArray[i]); mVtxNrmArray[i] = oldNrmArray[i]; } } @@ -186,7 +186,7 @@ s32 J3DVertexBuffer::allocTransformedVtxPosArray() { for (int i = 0; i < 2; i++) { if (i == 0 || mTransformedVtxPosArray[i] == NULL) { - mTransformedVtxPosArray[i] = new (0x20) char[mVtxData->getVtxNum() * 3 * 4]; + mTransformedVtxPosArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4]; if (mTransformedVtxPosArray[i] == NULL) return kJ3DError_Alloc; } @@ -201,7 +201,7 @@ s32 J3DVertexBuffer::allocTransformedVtxNrmArray() { for (int i = 0; i < 2; i++) { if (i == 0 || mTransformedVtxNrmArray[i] == NULL) { - mTransformedVtxNrmArray[i] = new (0x20) char[mVtxData->getNrmNum() * 3 * 4]; + mTransformedVtxNrmArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4]; if (mTransformedVtxNrmArray[i] == NULL) return kJ3DError_Alloc; } diff --git a/libs/JSystem/src/J3DGraphLoader/J3DAnmLoader.cpp b/libs/JSystem/src/J3DGraphLoader/J3DAnmLoader.cpp index 4576815eb7..0e9820a8a9 100644 --- a/libs/JSystem/src/J3DGraphLoader/J3DAnmLoader.cpp +++ b/libs/JSystem/src/J3DGraphLoader/J3DAnmLoader.cpp @@ -9,6 +9,8 @@ #include "JSystem/JSupport/JSupport.h" #include +#include "JSystem/JKernel/JKRHeap.h" + J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseFlag flag) { const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data; J3D_ASSERT_NULLPTR(48, i_data); @@ -19,68 +21,68 @@ J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseF switch (header->mType) { case 'bck1': { J3DAnmKeyLoader_v15 loader; - loader.mAnm = new J3DAnmTransformKey(); + loader.mAnm = JKR_NEW J3DAnmTransformKey(); return loader.load(i_data); } case 'bpk1': { J3DAnmKeyLoader_v15 loader; - loader.mAnm = new J3DAnmColorKey(); + loader.mAnm = JKR_NEW J3DAnmColorKey(); return loader.load(i_data); } case 'blk1': { J3DAnmKeyLoader_v15 loader; - loader.mAnm = new J3DAnmClusterKey(); + loader.mAnm = JKR_NEW J3DAnmClusterKey(); return loader.load(i_data); } case 'btk1': { J3DAnmKeyLoader_v15 loader; - loader.mAnm = new J3DAnmTextureSRTKey(); + loader.mAnm = JKR_NEW J3DAnmTextureSRTKey(); return loader.load(i_data); } case 'brk1': { J3DAnmKeyLoader_v15 loader; - loader.mAnm = new J3DAnmTevRegKey(); + loader.mAnm = JKR_NEW J3DAnmTevRegKey(); return loader.load(i_data); } case 'bxk1': { J3DAnmKeyLoader_v15 loader; - loader.mAnm = new J3DAnmVtxColorKey(); + loader.mAnm = JKR_NEW J3DAnmVtxColorKey(); return loader.load(i_data); } case 'bca1': { J3DAnmFullLoader_v15 loader; if (flag & J3DLOADER_UNK_FLAG1) { - loader.mAnm = new J3DAnmTransformFullWithLerp(); + loader.mAnm = JKR_NEW J3DAnmTransformFullWithLerp(); } else { - loader.mAnm = new J3DAnmTransformFull(); + loader.mAnm = JKR_NEW J3DAnmTransformFull(); } return loader.load(i_data); } case 'bpa1': { J3DAnmFullLoader_v15 loader; - loader.mAnm = new J3DAnmColorFull(); + loader.mAnm = JKR_NEW J3DAnmColorFull(); return loader.load(i_data); } case 'btp1': { J3DAnmFullLoader_v15 loader; - loader.mAnm = new J3DAnmTexPattern(); + loader.mAnm = JKR_NEW J3DAnmTexPattern(); return loader.load(i_data); } case 'bva1': { J3DAnmFullLoader_v15 loader; - loader.mAnm = new J3DAnmVisibilityFull(); + loader.mAnm = JKR_NEW J3DAnmVisibilityFull(); return loader.load(i_data); } case 'bla1': { J3DAnmFullLoader_v15 loader; - loader.mAnm = new J3DAnmClusterFull(); + loader.mAnm = JKR_NEW J3DAnmClusterFull(); return loader.load(i_data); } case 'bxa1': { J3DAnmFullLoader_v15 loader; - loader.mAnm = new J3DAnmVtxColorFull(); + loader.mAnm = JKR_NEW J3DAnmVtxColorFull(); return loader.load(i_data); } default: @@ -291,7 +293,7 @@ void J3DAnmFullLoader_v15::setAnmColor(J3DAnmColorFull* param_1, param_1->mColorB = JSUConvertOffsetToPtr(param_2, param_2->mBValuesOffset); param_1->mColorA = JSUConvertOffsetToPtr(param_2, param_2->mAValuesOffset); param_1->mUpdateMaterialID = - JSUConvertOffsetToPtr(param_2, param_2->mUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(param_2, param_2->mUpdateMaterialIDOffset); param_1->mUpdateMaterialName.setResource( JSUConvertOffsetToPtr(param_2, param_2->mNameTabOffset)); } @@ -312,9 +314,9 @@ void J3DAnmFullLoader_v15::setAnmTexPattern(J3DAnmTexPattern* param_1, param_1->field_0x14 = param_2->field_0xe; param_1->mAnmTable = JSUConvertOffsetToPtr(param_2, param_2->mTableOffset); - param_1->mTextureIndex = JSUConvertOffsetToPtr(param_2, param_2->mValuesOffset); + param_1->mTextureIndex = JSUConvertOffsetToPtr(param_2, param_2->mValuesOffset); param_1->mUpdateMaterialID = - JSUConvertOffsetToPtr(param_2, param_2->mUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(param_2, param_2->mUpdateMaterialIDOffset); param_1->mUpdateMaterialName.setResource( JSUConvertOffsetToPtr(param_2, param_2->mNameTabOffset)); } @@ -536,15 +538,15 @@ void J3DAnmKeyLoader_v15::setAnmTextureSRT(J3DAnmTextureSRTKey* param_1, param_1->mAnmTable = JSUConvertOffsetToPtr(param_2, param_2->mTableOffset); param_1->mUpdateMaterialID = - JSUConvertOffsetToPtr(param_2, param_2->mUpdateMatIDOffset); + JSUConvertOffsetToPtr(param_2, param_2->mUpdateMatIDOffset); param_1->mUpdateMaterialName.setResource( JSUConvertOffsetToPtr(param_2, param_2->mNameTab1Offset)); param_1->mUpdateTexMtxID = JSUConvertOffsetToPtr(param_2, param_2->mUpdateTexMtxIDOffset); - param_1->mSRTCenter = JSUConvertOffsetToPtr(param_2, param_2->unkOffset); - param_1->mScaleData = JSUConvertOffsetToPtr(param_2, param_2->mScaleValOffset); - param_1->mRotData = JSUConvertOffsetToPtr(param_2, param_2->mRotValOffset); - param_1->mTransData = JSUConvertOffsetToPtr(param_2, param_2->mTransValOffset); + param_1->mSRTCenter = JSUConvertOffsetToPtr(param_2, param_2->unkOffset); + param_1->mScaleData = JSUConvertOffsetToPtr(param_2, param_2->mScaleValOffset); + param_1->mRotData = JSUConvertOffsetToPtr(param_2, param_2->mRotValOffset); + param_1->mTransData = JSUConvertOffsetToPtr(param_2, param_2->mTransValOffset); if (param_2->mNameTab2Offset) { param_1->mPostUpdateMaterialName.setResource( JSUConvertOffsetToPtr(param_2, param_2->mNameTab2Offset)); @@ -555,12 +557,12 @@ void J3DAnmKeyLoader_v15::setAnmTextureSRT(J3DAnmTextureSRTKey* param_1, param_1->field_0x48 = param_2->field_0x3a; param_1->field_0x58 = JSUConvertOffsetToPtr(param_2, param_2->mInfoTable2Offset); - param_1->mPostUpdateMaterialID = JSUConvertOffsetToPtr(param_2, param_2->field_0x40); + param_1->mPostUpdateMaterialID = JSUConvertOffsetToPtr(param_2, param_2->field_0x40); param_1->mPostUpdateTexMtxID = JSUConvertOffsetToPtr(param_2, param_2->field_0x48); - param_1->mPostSRTCenter = JSUConvertOffsetToPtr(param_2, param_2->field_0x4c); - param_1->field_0x4c = JSUConvertOffsetToPtr(param_2, param_2->field_0x50); - param_1->field_0x50 = JSUConvertOffsetToPtr(param_2, param_2->field_0x54); - param_1->field_0x54 = JSUConvertOffsetToPtr(param_2, param_2->field_0x58); + param_1->mPostSRTCenter = JSUConvertOffsetToPtr(param_2, param_2->field_0x4c); + param_1->field_0x4c = JSUConvertOffsetToPtr(param_2, param_2->field_0x50); + param_1->field_0x50 = JSUConvertOffsetToPtr(param_2, param_2->field_0x54); + param_1->field_0x54 = JSUConvertOffsetToPtr(param_2, param_2->field_0x58); switch (param_2->field_0x5c) { case 0: case 1: @@ -591,12 +593,12 @@ void J3DAnmKeyLoader_v15::setAnmColor(J3DAnmColorKey* param_1, const J3DAnmColor param_1->field_0x12 = param_2->field_0x16; param_1->mAnmTable = JSUConvertOffsetToPtr(param_2, param_2->mTableOffset); - param_1->mColorR = JSUConvertOffsetToPtr(param_2, param_2->mRValOffset); - param_1->mColorG = JSUConvertOffsetToPtr(param_2, param_2->mGValOffset); - param_1->mColorB = JSUConvertOffsetToPtr(param_2, param_2->mBValOffset); - param_1->mColorA = JSUConvertOffsetToPtr(param_2, param_2->mAValOffset); + param_1->mColorR = JSUConvertOffsetToPtr(param_2, param_2->mRValOffset); + param_1->mColorG = JSUConvertOffsetToPtr(param_2, param_2->mGValOffset); + param_1->mColorB = JSUConvertOffsetToPtr(param_2, param_2->mBValOffset); + param_1->mColorA = JSUConvertOffsetToPtr(param_2, param_2->mAValOffset); param_1->mUpdateMaterialID = - JSUConvertOffsetToPtr(param_2, param_2->mUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(param_2, param_2->mUpdateMaterialIDOffset); param_1->mUpdateMaterialName.setResource( JSUConvertOffsetToPtr(param_2, param_2->mNameTabOffset)); } @@ -636,32 +638,32 @@ void J3DAnmKeyLoader_v15::setAnmTevReg(J3DAnmTevRegKey* param_1, param_1->mAnmCRegKeyTable = JSUConvertOffsetToPtr(param_2, param_2->mCRegTableOffset); param_1->mCRegUpdateMaterialID = - JSUConvertOffsetToPtr(param_2, param_2->mCRegUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(param_2, param_2->mCRegUpdateMaterialIDOffset); param_1->mCRegUpdateMaterialName.setResource( JSUConvertOffsetToPtr(param_2, param_2->mCRegNameTabOffset)); param_1->mKRegUpdateMaterialNum = param_2->mKRegUpdateMaterialNum; param_1->mAnmKRegKeyTable = JSUConvertOffsetToPtr(param_2, param_2->mKRegTableOffset); param_1->mKRegUpdateMaterialID = - JSUConvertOffsetToPtr(param_2, param_2->mKRegUpdateMaterialIDOffset); + JSUConvertOffsetToPtr(param_2, param_2->mKRegUpdateMaterialIDOffset); param_1->mKRegUpdateMaterialName.setResource( JSUConvertOffsetToPtr(param_2, param_2->mKRegNameTabOffset)); param_1->mCRegDataCountR = param_2->field_0x10; param_1->mCRegDataCountG = param_2->field_0x12; param_1->mCRegDataCountB = param_2->field_0x14; param_1->mCRegDataCountA = param_2->field_0x16; - param_1->mAnmCRegDataR = JSUConvertOffsetToPtr(param_2, param_2->mCRValuesOffset); - param_1->mAnmCRegDataG = JSUConvertOffsetToPtr(param_2, param_2->mCGValuesOffset); - param_1->mAnmCRegDataB = JSUConvertOffsetToPtr(param_2, param_2->mCBValuesOffset); - param_1->mAnmCRegDataA = JSUConvertOffsetToPtr(param_2, param_2->mCAValuesOffset); + param_1->mAnmCRegDataR = JSUConvertOffsetToPtr(param_2, param_2->mCRValuesOffset); + param_1->mAnmCRegDataG = JSUConvertOffsetToPtr(param_2, param_2->mCGValuesOffset); + param_1->mAnmCRegDataB = JSUConvertOffsetToPtr(param_2, param_2->mCBValuesOffset); + param_1->mAnmCRegDataA = JSUConvertOffsetToPtr(param_2, param_2->mCAValuesOffset); param_1->mKRegDataCountR = param_2->field_0x18; param_1->mKRegDataCountG = param_2->field_0x1a; param_1->mKRegDataCountB = param_2->field_0x1c; param_1->mKRegDataCountA = param_2->field_0x1e; - param_1->mAnmKRegDataR = JSUConvertOffsetToPtr(param_2, param_2->mKRValuesOffset); - param_1->mAnmKRegDataG = JSUConvertOffsetToPtr(param_2, param_2->mKGValuesOffset); - param_1->mAnmKRegDataB = JSUConvertOffsetToPtr(param_2, param_2->mKBValuesOffset); - param_1->mAnmKRegDataA = JSUConvertOffsetToPtr(param_2, param_2->mKAValuesOffset); + param_1->mAnmKRegDataR = JSUConvertOffsetToPtr(param_2, param_2->mKRValuesOffset); + param_1->mAnmKRegDataG = JSUConvertOffsetToPtr(param_2, param_2->mKGValuesOffset); + param_1->mAnmKRegDataB = JSUConvertOffsetToPtr(param_2, param_2->mKBValuesOffset); + param_1->mAnmKRegDataA = JSUConvertOffsetToPtr(param_2, param_2->mKAValuesOffset); } diff --git a/libs/JSystem/src/J3DGraphLoader/J3DClusterLoader.cpp b/libs/JSystem/src/J3DGraphLoader/J3DClusterLoader.cpp index b222f447d7..d6b78caec3 100644 --- a/libs/JSystem/src/J3DGraphLoader/J3DClusterLoader.cpp +++ b/libs/JSystem/src/J3DGraphLoader/J3DClusterLoader.cpp @@ -29,7 +29,7 @@ J3DClusterLoader_v15::~J3DClusterLoader_v15() {} void* J3DClusterLoader_v15::load(const void* i_data) { J3D_ASSERT_NULLPTR(98, i_data); - mpDeformData = new J3DDeformData(); + mpDeformData = JKR_NEW J3DDeformData(); const JUTDataFileHeader* fileHeader = (JUTDataFileHeader*)i_data; const JUTDataBlockHeader* block = &fileHeader->mFirstBlock; @@ -58,13 +58,13 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) { if (block->mClusterName != NULL) { mpDeformData->mClusterName = - new JUTNameTab(JSUConvertOffsetToPtr(block, block->mClusterName)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(block, block->mClusterName)); } else { mpDeformData->mClusterName = NULL; } if (block->mClusterKeyName != NULL) { mpDeformData->mClusterKeyName = - new JUTNameTab(JSUConvertOffsetToPtr(block, block->mClusterKeyName)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(block, block->mClusterKeyName)); } else { mpDeformData->mClusterKeyName = NULL; } @@ -76,14 +76,14 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) { int clusterKeyPointerSize = (intptr_t)block->mClusterKeyPointer - (intptr_t)block->mClusterPointer; int clusterVertexPointerSize = (intptr_t)block->mClusterVertex - (intptr_t)block->mClusterPointer; int vtxPosSize = (intptr_t)block->mVtxPos - (intptr_t)block->mClusterPointer; - u8* arr = new (0x20) u8[vtxPosSize]; + u8* arr = JKR_NEW_ARGS (0x20) u8[vtxPosSize]; memcpy(arr, JSUConvertOffsetToPtr(block, block->mClusterPointer), vtxPosSize); mpDeformData->mClusterPointer = (J3DCluster*)arr; mpDeformData->mClusterKeyPointer = (J3DClusterKey*)&arr[clusterKeyPointerSize]; mpDeformData->mClusterVertex = (J3DClusterVertex*)&arr[clusterVertexPointerSize]; #if TARGET_PC - mpDeformData->mDeformers = new J3DDeformer*[mpDeformData->getClusterNum()]; + mpDeformData->mDeformers = JKR_NEW J3DDeformer*[mpDeformData->getClusterNum()]; #endif for (int i = 0; i < mpDeformData->getClusterNum(); i++) { @@ -94,14 +94,14 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) { cluster->mClusterVertex = JSUConvertOffsetToPtr(arr - (intptr_t)clusterPointer, cluster->mClusterVertex); #endif - J3DDeformer* deformer = new J3DDeformer(mpDeformData); + J3DDeformer* deformer = JKR_NEW J3DDeformer(mpDeformData); if (cluster->field_0x14 != 0) { - deformer->field_0xc = new f32[cluster->field_0x14 * 3]; + deformer->field_0xc = JKR_NEW f32[cluster->field_0x14 * 3]; } else { deformer->field_0xc = NULL; } deformer->mFlags = cluster->mFlags; - deformer->field_0x8 = new f32[cluster->mKeyNum]; + deformer->field_0x8 = JKR_NEW f32[cluster->mKeyNum]; #if TARGET_PC deformer->mArrayBase = arr - clusterPointer; deformer->mBlockBase = block; diff --git a/libs/JSystem/src/J3DGraphLoader/J3DJointFactory.cpp b/libs/JSystem/src/J3DGraphLoader/J3DJointFactory.cpp index c385b400e1..137b22b7a7 100644 --- a/libs/JSystem/src/J3DGraphLoader/J3DJointFactory.cpp +++ b/libs/JSystem/src/J3DGraphLoader/J3DJointFactory.cpp @@ -1,8 +1,9 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep +#include "JSystem/J3DGraphAnimator/J3DJoint.h" #include "JSystem/J3DGraphLoader/J3DJointFactory.h" #include "JSystem/J3DGraphLoader/J3DModelLoader.h" -#include "JSystem/J3DGraphAnimator/J3DJoint.h" +#include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JSupport/JSupport.h" J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) { @@ -27,7 +28,7 @@ J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) { } J3DJoint* J3DJointFactory::create(int no) { - J3DJoint* joint = new J3DJoint(); + J3DJoint* joint = JKR_NEW J3DJoint(); J3D_ASSERT_ALLOCMEM(50, joint); joint->mJntNo = no; joint->mKind = getKind(no); diff --git a/libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory.cpp b/libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory.cpp index b700190099..b67b9b2527 100644 --- a/libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory.cpp +++ b/libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory.cpp @@ -5,6 +5,7 @@ #include #include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JMath/JMath.h" #include "JSystem/JSupport/JSupport.h" #include "JSystem/JUtility/JUTAssert.h" @@ -135,7 +136,7 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i u32 pe_flag = getMdlDataFlag_PEFlag(i_flags); BOOL ind_flag = (i_flags & 0x1000000) ? TRUE : FALSE; if (i_material == NULL) { - i_material = new J3DMaterial(); + i_material = JKR_NEW J3DMaterial(); J3D_ASSERT_ALLOCMEM(269, i_material); } i_material->mColorBlock = J3DMaterial::createColorBlock(color_flag); @@ -235,14 +236,14 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* i_material, int i_idx, u32 i_flags) const { if (i_material == NULL) { - i_material = new J3DPatchedMaterial(); + i_material = JKR_NEW J3DPatchedMaterial(); J3D_ASSERT_ALLOCMEM(430, i_material); } bool bVar1 = i_flags & 0x3000000 ? true : false; i_material->mColorBlock = J3DMaterial::createColorBlock(0x40000000); - i_material->mTexGenBlock = new J3DTexGenBlockPatched(); + i_material->mTexGenBlock = JKR_NEW J3DTexGenBlockPatched(); J3D_ASSERT_ALLOCMEM(440, i_material->mTexGenBlock); - i_material->mTevBlock = new J3DTevBlockPatched(); + i_material->mTevBlock = JKR_NEW J3DTevBlockPatched(); J3D_ASSERT_ALLOCMEM(442, i_material->mTevBlock); i_material->mIndBlock = J3DMaterial::createIndBlock(bVar1); i_material->mPEBlock = J3DMaterial::createPEBlock(0x10000000, getMaterialMode(i_idx)); @@ -346,17 +347,17 @@ void J3DMaterialFactory::modifyPatchedCurrentMtx(J3DMaterial* i_material, int i_ J3DMaterial* J3DMaterialFactory::createLockedMaterial(J3DMaterial* i_material, int i_idx, u32 i_flags) const { if (i_material == NULL) { - i_material = new J3DLockedMaterial(); + i_material = JKR_NEW J3DLockedMaterial(); J3D_ASSERT_ALLOCMEM(629, i_material); - i_material->mColorBlock = new J3DColorBlockNull(); + i_material->mColorBlock = JKR_NEW J3DColorBlockNull(); J3D_ASSERT_ALLOCMEM(634, i_material->mColorBlock); - i_material->mTexGenBlock = new J3DTexGenBlockNull(); + i_material->mTexGenBlock = JKR_NEW J3DTexGenBlockNull(); J3D_ASSERT_ALLOCMEM(636, i_material->mTexGenBlock); - i_material->mTevBlock = new J3DTevBlockNull(); + i_material->mTevBlock = JKR_NEW J3DTevBlockNull(); J3D_ASSERT_ALLOCMEM(638, i_material->mTevBlock); - i_material->mIndBlock = new J3DIndBlockNull(); + i_material->mIndBlock = JKR_NEW J3DIndBlockNull(); J3D_ASSERT_ALLOCMEM(640, i_material->mIndBlock); - i_material->mPEBlock = new J3DPEBlockNull(); + i_material->mPEBlock = JKR_NEW J3DPEBlockNull(); J3D_ASSERT_ALLOCMEM(642, i_material->mPEBlock); i_material->mIndex = i_idx; i_material->mMaterialMode = mpMaterialMode[i_idx]; @@ -370,7 +371,7 @@ J3DMaterial* J3DMaterialFactory::createLockedMaterial(J3DMaterial* i_material, i i_material->getTevBlock()->setTevRegOffset(mpPatchingInfo[i_idx].mTevRegOffset); i_material->getPEBlock()->setFogOffset(mpPatchingInfo[i_idx].mFogOffset); if (i_material->mSharedDLObj == NULL) { - i_material->mSharedDLObj = new J3DDisplayListObj(); + i_material->mSharedDLObj = JKR_NEW J3DDisplayListObj(); J3D_ASSERT_ALLOCMEM(673, i_material->mSharedDLObj); i_material->mSharedDLObj->setSingleDisplayList((void*)( mpDisplayListInit[i_idx].mOffset + (uintptr_t)&mpDisplayListInit[i_idx]), @@ -544,9 +545,9 @@ J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const { be_swap(tex_mtx_info.mSRT.mRotation); be_swap(tex_mtx_info.mSRT.mTranslationX); be_swap(tex_mtx_info.mSRT.mTranslationY); - tex_mtx = new J3DTexMtx(tex_mtx_info); + tex_mtx = JKR_NEW J3DTexMtx(tex_mtx_info); #else - tex_mtx = new J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]); + tex_mtx = JKR_NEW J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]); #endif } return tex_mtx; diff --git a/libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory_v21.cpp b/libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory_v21.cpp index b00b08ff68..229309545a 100644 --- a/libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory_v21.cpp +++ b/libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory_v21.cpp @@ -1,8 +1,9 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h" -#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h" +#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h" +#include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JMath/JMath.h" #include "JSystem/JSupport/JSupport.h" @@ -89,7 +90,7 @@ J3DMaterial* J3DMaterialFactory_v21::create(J3DMaterial* i_material, int i_idx, u32 pe_flag = getMdlDataFlag_PEFlag(i_flags); BOOL ind_flag = (i_flags & 0x1000000) ? TRUE : FALSE; if (i_material == NULL) { - i_material = new J3DMaterial(); + i_material = JKR_NEW J3DMaterial(); } i_material->mColorBlock = J3DMaterial::createColorBlock(color_flag); i_material->mTexGenBlock = J3DMaterial::createTexGenBlock(texgen_flag); @@ -221,7 +222,7 @@ J3DTexMtx* J3DMaterialFactory_v21::newTexMtx(int i_idx, int i_no) const { J3DTexMtx* tex_mtx = NULL; J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]]; if (mtl_init_data->mTexMtxIdx[i_no] != 0xffff) { - tex_mtx = new J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]); + tex_mtx = JKR_NEW J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]); } return tex_mtx; } diff --git a/libs/JSystem/src/J3DGraphLoader/J3DModelLoader.cpp b/libs/JSystem/src/J3DGraphLoader/J3DModelLoader.cpp index 749009f275..a15ec49370 100644 --- a/libs/JSystem/src/J3DGraphLoader/J3DModelLoader.cpp +++ b/libs/JSystem/src/J3DGraphLoader/J3DModelLoader.cpp @@ -1,19 +1,21 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/J3DGraphLoader/J3DModelLoader.h" #include "JSystem/J3DGraphAnimator/J3DAnimation.h" -#include "JSystem/J3DGraphAnimator/J3DShapeTable.h" -#include "JSystem/J3DGraphAnimator/J3DJointTree.h" #include "JSystem/J3DGraphAnimator/J3DJoint.h" +#include "JSystem/J3DGraphAnimator/J3DJointTree.h" +#include "JSystem/J3DGraphAnimator/J3DModelData.h" +#include "JSystem/J3DGraphAnimator/J3DShapeTable.h" +#include "JSystem/J3DGraphBase/J3DMaterial.h" #include "JSystem/J3DGraphLoader/J3DJointFactory.h" #include "JSystem/J3DGraphLoader/J3DMaterialFactory.h" #include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h" +#include "JSystem/J3DGraphLoader/J3DModelLoader.h" #include "JSystem/J3DGraphLoader/J3DShapeFactory.h" -#include "JSystem/J3DGraphAnimator/J3DModelData.h" -#include "JSystem/J3DGraphBase/J3DMaterial.h" -#include "JSystem/JUtility/JUTNameTab.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JSupport/JSupport.h" +#include "JSystem/JUtility/JUTNameTab.h" +#include "SSystem/SComponent/c_xyz.h" +#include J3DModelLoader::J3DModelLoader() : mpModelData(NULL), @@ -64,7 +66,7 @@ J3DModelData* J3DModelLoaderDataBase::loadBinaryDisplayList(const void* i_data, J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) { s32 freeSize = JKRGetCurrentHeap()->getTotalFreeSize(); - mpModelData = new J3DModelData(); + mpModelData = JKR_NEW J3DModelData(); J3D_ASSERT_ALLOCMEM(177, mpModelData); mpModelData->clear(); mpModelData->mpRawData = i_data; @@ -123,7 +125,7 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) { J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) { int flags = 0x51100000; - mpMaterialTable = new J3DMaterialTable(); + mpMaterialTable = JKR_NEW J3DMaterialTable(); J3D_ASSERT_ALLOCMEM(279, mpMaterialTable); mpMaterialTable->clear(); J3DModelFileData const* data = (J3DModelFileData*)i_data; @@ -146,7 +148,7 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) { block = (J3DModelBlock*)((uintptr_t)block + block->mBlockSize); } if (mpMaterialTable->mTexture == NULL) { - mpMaterialTable->mTexture = new J3DTexture(0, NULL); + mpMaterialTable->mTexture = JKR_NEW J3DTexture(0, NULL); J3D_ASSERT_ALLOCMEM(319, mpMaterialTable->mTexture); } return mpMaterialTable; @@ -157,7 +159,7 @@ inline u32 getBdlFlag_MaterialType(u32 flags) { } J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_flags) { - mpModelData = new J3DModelData(); + mpModelData = JKR_NEW J3DModelData(); J3D_ASSERT_ALLOCMEM(338, mpModelData); mpModelData->clear(); mpModelData->mpRawData = i_data; @@ -262,13 +264,13 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla J3DMtxCalc* mtx_calc = NULL; switch (mpModelData->mFlags & 0xf) { case 0: - mtx_calc = new J3DMtxCalcNoAnm(); + mtx_calc = JKR_NEW J3DMtxCalcNoAnm(); break; case 1: - mtx_calc = new J3DMtxCalcNoAnm(); + mtx_calc = JKR_NEW J3DMtxCalcNoAnm(); break; case 2: - mtx_calc = new J3DMtxCalcNoAnm(); + mtx_calc = JKR_NEW J3DMtxCalcNoAnm(); break; default: JUT_PANIC(529, "Error : Invalid MtxCalcType."); @@ -279,8 +281,24 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla mpModelData->getVertexData().mPacketNum = i_block->mPacketNum; mpModelData->getVertexData().mVtxNum = i_block->mVtxNum; mpModelData->setHierarchy(JSUConvertOffsetToPtr(i_block, i_block->mpHierarchy)); + +#if TARGET_PC + mpModelData->getVertexData().mHasReadInformation = true; +#endif } +#if TARGET_PC +static GXVtxAttrFmtList getFmt(GXVtxAttrFmtList* i_fmtList, GXAttr i_attr) { + for (; i_fmtList->attr != GX_VA_NULL; i_fmtList++) { + if (i_fmtList->attr == i_attr) { + return *i_fmtList; + } + } + + OSPanic(__FILE__, __LINE__, "Unable to find vertex attribute format!"); +} +#endif + static GXCompType getFmtType(GXVtxAttrFmtList* i_fmtList, GXAttr i_attr) { for (; i_fmtList->attr != GX_VA_NULL; i_fmtList++) { if (i_fmtList->attr == i_attr) { @@ -336,9 +354,11 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) { if (vertex_data.mVtxNrmArray == NULL) { vertex_data.mNrmNum = 0; } else if (nrm_end != NULL) { - vertex_data.mNrmNum = ((uintptr_t)nrm_end - (uintptr_t)vertex_data.mVtxNrmArray) / nrm_size + 1; + vertex_data.mNrmNum = + ((uintptr_t)nrm_end - (uintptr_t)vertex_data.mVtxNrmArray) / nrm_size + 1; } else { - vertex_data.mNrmNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxNrmArray) / nrm_size + 1; + vertex_data.mNrmNum = + (i_block->mBlockSize - (uintptr_t)i_block->mpVtxNrmArray) / nrm_size + 1; } void* color0_end = NULL; @@ -351,9 +371,11 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) { if (vertex_data.mVtxColorArray[0] == NULL) { vertex_data.mColNum = 0; } else if (color0_end != NULL) { - vertex_data.mColNum = ((uintptr_t)color0_end - (uintptr_t)vertex_data.mVtxColorArray[0]) / 4 + 1; + vertex_data.mColNum = + ((uintptr_t)color0_end - (uintptr_t)vertex_data.mVtxColorArray[0]) / 4 + 1; } else { - vertex_data.mColNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxColorArray[0]) / 4 + 1; + vertex_data.mColNum = + (i_block->mBlockSize - (uintptr_t)i_block->mpVtxColorArray[0]) / 4 + 1; } int local_28 = 0; @@ -368,21 +390,182 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) { if (local_28) { vertex_data.mTexCoordNum = (local_28 - (uintptr_t)vertex_data.mVtxTexCoordArray[0]) / 8 + 1; } else { - vertex_data.mTexCoordNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxTexCoordArray[0]) / 8 + 1; + vertex_data.mTexCoordNum = + (i_block->mBlockSize - (uintptr_t)i_block->mpVtxTexCoordArray[0]) / 8 + 1; + } + +#if TARGET_PC + readVertexData(*i_block, vertex_data); +#endif +} + +#if TARGET_PC + +// Approach taken from here: +// https://github.com/zeldaret/tp/blob/6c72b91f8e477ee94ccdc56b94605140e9f2abd6/libs/JSystem/src/J3DGraphBase/J3DShape.cpp#L156-L211 + +template +static void FixArrayEndian(void* arrayStart, void* arrayEnd) { +#if TARGET_LITTLE_ENDIAN + u32 itemCount = ((u8*)arrayEnd - (u8*)arrayStart) / sizeof(T); + be_swap((T*)arrayStart, itemCount); +#endif +} + +static void FixArrayEndian_24(void* arrayStart, void* arrayEnd) { +#if TARGET_LITTLE_ENDIAN + for (u8* work = (u8*)arrayStart; work != (u8*)arrayEnd; work += 3) + std::swap(work[0], work[2]); +#endif +} + +static void FixArrayEndian(void* arrayStart, void* arrayEnd, u32 stride) { + switch (stride) { + case 1: + // Nothing needs to happen here! + break; + case 2: + FixArrayEndian(arrayStart, arrayEnd); + break; + case 3: + FixArrayEndian_24(arrayStart, arrayEnd); + break; + case 4: + FixArrayEndian(arrayStart, arrayEnd); + break; + default: + OSPanic(__FILE__, __LINE__, "Unknown component type?"); } } +static GXAttr VertexBlockAttrOrder[13] = { + GX_VA_POS, + GX_VA_NRM, + GX_VA_NBT, + GX_VA_CLR0, + GX_VA_CLR1, + GX_VA_TEX0, + GX_VA_TEX1, + GX_VA_TEX2, + GX_VA_TEX3, + GX_VA_TEX4, + GX_VA_TEX5, + GX_VA_TEX6, + GX_VA_TEX7, +}; + +static void* GetDataEnd(const J3DVertexBlock& block, int start) { + const BE(u32)* attrPtrBase = &block.mpVtxPosArray; + + for (int i = start + 1; i < ARRAY_SIZEU(VertexBlockAttrOrder); i++) { + if (attrPtrBase[i] != 0) { + return JSUConvertOffsetToPtr(&block, attrPtrBase[i]); + } + } + + return JSUConvertOffsetToPtr(&block, block.mBlockSize); +} + +auto StrideForData(GXAttr attr, GXCompType type, GXCompCnt cnt) -> std::pair { + auto CompTypeStrideRaw = [&] { + if (type == GX_F32) + return 4; + else if (type == GX_U16 || type == GX_S16) + return 2; + else + return 1; + }; + + auto HandleColor = [&]() -> std::pair { + if (type == GX_RGB565) + return {1, 2}; // u16[1] + else if (type == GX_RGB8) + return {3, 1}; // u8[3] + else if (type == GX_RGBX8) + return {4, 1}; // u8[4] + else if (type == GX_RGBA4) + return {1, 2}; // u16[1] + else if (type == GX_RGBA6) + return {3, 1}; // u8[3] + else if (type == GX_RGBA8) + return {4, 1}; // u8[4] + }; + + auto CompCnt = [&] { + if (attr == GX_VA_POS) { + return cnt == GX_POS_XY ? 2 : 3; + } else if (attr == GX_VA_NRM) { + return cnt == GX_NRM_XYZ ? 3 : 9; // NBT3 is lies + } else if (attr >= GX_VA_CLR0 && attr <= GX_VA_CLR1) { + return cnt == GX_CLR_RGB ? 3 : 4; // clr is special anyway + } else if (attr >= GX_VA_TEX0 && attr <= GX_VA_TEX7) { + return cnt == GX_TEX_S ? 1 : 2; + } else { + JUT_ASSERT(1234, false); + } + }; + + if (attr >= GX_VA_CLR0 && attr <= GX_VA_CLR1) { + return HandleColor(); + } else { + int compCnt = CompCnt(); + int compStride = CompTypeStrideRaw(); + return {compCnt, compStride}; + } +} + +void J3DModelLoader::readVertexData(const J3DVertexBlock& block, J3DVertexData& data) { + if (!data.mHasReadInformation) { + OSPanic(__FILE__, __LINE__, "Model has VTX1 before INF1?"); + } + + const BE(u32)* attrPtrBase = &block.mpVtxPosArray; + for (int i = 0; i < ARRAY_SIZEU(VertexBlockAttrOrder); i++) { + GXAttr attr = VertexBlockAttrOrder[i]; + + if (attrPtrBase[i] == 0) { + continue; + } + + GXVtxAttrFmtList fmt = getFmt(data.mVtxAttrFmtList, attr); + + void* startAddr = JSUConvertOffsetToPtr(&block, attrPtrBase[i]); + void* endAddr = GetDataEnd(block, i); + auto [compCnt, compStride] = StrideForData(attr, fmt.type, fmt.cnt); + u32 vertStride = compStride * compCnt; + data.mVtxArrStride[attr - GX_VA_POS] = vertStride; + + u32 addrDiff = u32((u8*)endAddr - (u8*)startAddr); + u32 num = addrDiff / vertStride; + data.mVtxArrNum[attr - GX_VA_POS] = num; + FixArrayEndian(startAddr, endAddr, compStride); + + if (attr == GX_VA_POS) { + // can be a little off due to 0x20 alignment, account for that + u32 expect = ((data.mVtxNum * vertStride) + 0x1F) & ~0x1F; + JUT_ASSERT(1234, expect == addrDiff); + } else if (attr == GX_VA_NRM) { + data.mNrmNum = num; + } else if (attr == GX_VA_CLR0) { + data.mColNum = num; + } else if (attr == GX_VA_TEX0) { + data.mTexCoordNum = num; + } + } +} +#endif + void J3DModelLoader::readEnvelop(J3DEnvelopeBlock const* i_block) { J3D_ASSERT_NULLPTR(724, i_block); mpModelData->getJointTree().mWEvlpMtxNum = i_block->mWEvlpMtxNum; mpModelData->getJointTree().mWEvlpMixMtxNum = JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixMtxNum); mpModelData->getJointTree().mWEvlpMixMtxIndex = - JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixIndex); + JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixIndex); mpModelData->getJointTree().mWEvlpMixWeight = - JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixWeight); + JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixWeight); mpModelData->getJointTree().mInvJointMtx = - JSUConvertOffsetToPtr(i_block, i_block->mpInvJointMtx); + JSUConvertOffsetToPtr(i_block, i_block->mpInvJointMtx); } void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) { @@ -390,7 +573,7 @@ void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) { J3DDrawMtxData* drawMtxData = mpModelData->getDrawMtxData(); drawMtxData->mEntryNum = i_block->mMtxNum - mpModelData->getWEvlpMtxNum(); drawMtxData->mDrawMtxFlag = JSUConvertOffsetToPtr(i_block, i_block->mpDrawMtxFlag); - drawMtxData->mDrawMtxIndex = JSUConvertOffsetToPtr(i_block, i_block->mpDrawMtxIndex); + drawMtxData->mDrawMtxIndex = JSUConvertOffsetToPtr(i_block, i_block->mpDrawMtxIndex); u16 i; for (i = 0; i < drawMtxData->mEntryNum; i++) { if (drawMtxData->mDrawMtxFlag[i] == 1) { @@ -398,7 +581,7 @@ void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) { } } drawMtxData->mDrawFullWgtMtxNum = i; - mpModelData->getJointTree().mWEvlpImportantMtxIdx = new u16[drawMtxData->mEntryNum]; + mpModelData->getJointTree().mWEvlpImportantMtxIdx = JKR_NEW u16[drawMtxData->mEntryNum]; J3D_ASSERT_ALLOCMEM(767, mpModelData->getJointTree().mWEvlpImportantMtxIdx); } @@ -408,13 +591,13 @@ void J3DModelLoader::readJoint(J3DJointBlock const* i_block) { mpModelData->getJointTree().mJointNum = i_block->mJointNum; if (i_block->mpNameTable != NULL) { mpModelData->getJointTree().mJointName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(791, mpModelData->getJointTree().mJointName); } else { mpModelData->getJointTree().mJointName = NULL; } mpModelData->getJointTree().mJointNodePointer = - new J3DJoint*[mpModelData->getJointTree().mJointNum]; + JKR_NEW J3DJoint*[mpModelData->getJointTree().mJointNum]; J3D_ASSERT_ALLOCMEM(797, mpModelData->getJointTree().mJointNodePointer); for (u16 i = 0; i < mpModelData->getJointNum(); i++) { mpModelData->getJointTree().mJointNodePointer[i] = factory.create(i); @@ -428,15 +611,15 @@ void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_fla mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials(); if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(832, mpMaterialTable->mMaterialName); } else { mpMaterialTable->mMaterialName = NULL; } - mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum]; + mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum]; J3D_ASSERT_ALLOCMEM(841, mpMaterialTable->mMaterialNodePointer); if (i_flags & 0x200000) { - mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum]; + mpMaterialTable->field_0x10 = JKR_NEW_ARGS (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum]; J3D_ASSERT_ALLOCMEM(846, mpMaterialTable->field_0x10); } else { mpMaterialTable->field_0x10 = NULL; @@ -474,15 +657,15 @@ void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials(); if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(930, mpMaterialTable->mMaterialName); } else { mpMaterialTable->mMaterialName = NULL; } - mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum]; + mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum]; J3D_ASSERT_ALLOCMEM(940, mpMaterialTable->mMaterialNodePointer); if (i_flags & 0x200000) { - mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum]; + mpMaterialTable->field_0x10 = JKR_NEW_ARGS (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum]; J3D_ASSERT_ALLOCMEM(945, mpMaterialTable->field_0x10); } else { mpMaterialTable->field_0x10 = NULL; @@ -518,12 +701,12 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) { shape_table->mShapeNum = i_block->mShapeNum; if (i_block->mpNameTable != NULL) { shape_table->mShapeName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(1026, shape_table->mShapeName); } else { shape_table->mShapeName = NULL; } - shape_table->mShapeNodePointer = new J3DShape*[shape_table->mShapeNum]; + shape_table->mShapeNodePointer = JKR_NEW J3DShape*[shape_table->mShapeNum]; J3D_ASSERT_ALLOCMEM(1034, shape_table->mShapeNodePointer); factory.allocVcdVatCmdBuffer(shape_table->mShapeNum); J3DModelHierarchy const* hierarchy_entry = mpModelData->getHierarchy(); @@ -543,12 +726,12 @@ void J3DModelLoader::readTexture(J3DTextureBlock const* i_block) { ResTIMG* texture_res = JSUConvertOffsetToPtr(i_block, i_block->mpTextureRes); if (i_block->mpNameTable != NULL) { mpMaterialTable->mTextureName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(1077, mpMaterialTable->mTextureName); } else { mpMaterialTable->mTextureName = NULL; } - mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res); + mpMaterialTable->mTexture = JKR_NEW J3DTexture(texture_num, texture_res); J3D_ASSERT_ALLOCMEM(1084, mpMaterialTable->mTexture); } @@ -558,12 +741,12 @@ void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32 mpMaterialTable->mMaterialNum = i_block->mMaterialNum; if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(1114, mpMaterialTable->mMaterialName); } else { mpMaterialTable->mMaterialName = NULL; } - mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum]; + mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum]; J3D_ASSERT_ALLOCMEM(1121, mpMaterialTable->mMaterialNodePointer); for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) { mpMaterialTable->mMaterialNodePointer[i] = @@ -581,12 +764,12 @@ void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_blo mpMaterialTable->mMaterialNum = i_block->mMaterialNum; if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(1165, mpMaterialTable->mMaterialName); } else { mpMaterialTable->mMaterialName = NULL; } - mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum]; + mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum]; J3D_ASSERT_ALLOCMEM(1172, mpMaterialTable->mMaterialNodePointer); for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) { mpMaterialTable->mMaterialNodePointer[i] = @@ -604,12 +787,12 @@ void J3DModelLoader::readTextureTable(J3DTextureBlock const* i_block) { ResTIMG* texture_res = JSUConvertOffsetToPtr(i_block, i_block->mpTextureRes); if (i_block->mpNameTable != NULL) { mpMaterialTable->mTextureName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(1211, mpMaterialTable->mTextureName); } else { mpMaterialTable->mTextureName = NULL; } - mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res); + mpMaterialTable->mTexture = JKR_NEW J3DTexture(texture_num, texture_res); J3D_ASSERT_ALLOCMEM(1218, mpMaterialTable->mTexture); } @@ -620,12 +803,12 @@ void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_ mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials(); if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(1251, mpMaterialTable->mMaterialName); } else { mpMaterialTable->mMaterialName = NULL; } - mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum]; + mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum]; J3D_ASSERT_ALLOCMEM(1260, mpMaterialTable->mMaterialNodePointer); mpMaterialTable->field_0x10 = NULL; for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) { @@ -646,12 +829,12 @@ void J3DModelLoader::readMaterialDL(J3DMaterialDLBlock const* i_block, u32 i_fla mpMaterialTable->mUniqueMatNum = i_block->mMaterialNum; if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); + JKR_NEW JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); J3D_ASSERT_ALLOCMEM(1312, mpMaterialTable->mMaterialName); } else { mpMaterialTable->mMaterialName = NULL; } - mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum]; + mpMaterialTable->mMaterialNodePointer = JKR_NEW J3DMaterial*[mpMaterialTable->mMaterialNum]; J3D_ASSERT_ALLOCMEM(1320, mpMaterialTable->mMaterialNodePointer); mpMaterialTable->field_0x10 = NULL; for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) { diff --git a/libs/JSystem/src/J3DGraphLoader/J3DShapeFactory.cpp b/libs/JSystem/src/J3DGraphLoader/J3DShapeFactory.cpp index 4b357cd8e6..76c1444a3c 100644 --- a/libs/JSystem/src/J3DGraphLoader/J3DShapeFactory.cpp +++ b/libs/JSystem/src/J3DGraphLoader/J3DShapeFactory.cpp @@ -41,14 +41,14 @@ J3DShapeFactory::J3DShapeFactory(J3DShapeBlock const& block) { } J3DShape* J3DShapeFactory::create(int no, u32 flag, GXVtxDescList* vtxDesc) { - J3DShape* shape = new J3DShape; + J3DShape* shape = JKR_NEW J3DShape; J3D_ASSERT_ALLOCMEM(67, shape); shape->mMtxGroupNum = getMtxGroupNum(no); shape->mRadius = getRadius(no); shape->mVtxDesc = getVtxDescList(no); - shape->mShapeMtx = new J3DShapeMtx*[shape->mMtxGroupNum]; + shape->mShapeMtx = JKR_NEW J3DShapeMtx*[shape->mMtxGroupNum]; J3D_ASSERT_ALLOCMEM(74, shape->mShapeMtx); - shape->mShapeDraw = new J3DShapeDraw*[shape->mMtxGroupNum]; + shape->mShapeDraw = JKR_NEW J3DShapeDraw*[shape->mMtxGroupNum]; J3D_ASSERT_ALLOCMEM(76, shape->mShapeDraw); shape->mMin = getMin(no); shape->mMax = getMax(no); @@ -85,16 +85,16 @@ J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) case J3DMdlDataFlag_ConcatView: switch (shapeInitData.mShapeMtxType) { case J3DShapeMtxType_Mtx: - ret = new J3DShapeMtxConcatView(mtxInitData.mUseMtxIndex); + ret = JKR_NEW J3DShapeMtxConcatView(mtxInitData.mUseMtxIndex); break; case J3DShapeMtxType_BBoard: - ret = new J3DShapeMtxBBoardConcatView(mtxInitData.mUseMtxIndex); + ret = JKR_NEW J3DShapeMtxBBoardConcatView(mtxInitData.mUseMtxIndex); break; case J3DShapeMtxType_YBBoard: - ret = new J3DShapeMtxYBBoardConcatView(mtxInitData.mUseMtxIndex); + ret = JKR_NEW J3DShapeMtxYBBoardConcatView(mtxInitData.mUseMtxIndex); break; case J3DShapeMtxType_Multi: - ret = new J3DShapeMtxMultiConcatView(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, + ret = JKR_NEW J3DShapeMtxMultiConcatView(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, &mMtxTable[mtxInitData.mFirstUseMtxIndex]); break; default: @@ -109,10 +109,10 @@ J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) case J3DShapeMtxType_Mtx: case J3DShapeMtxType_BBoard: case J3DShapeMtxType_YBBoard: - ret = new J3DShapeMtx(mtxInitData.mUseMtxIndex); + ret = JKR_NEW J3DShapeMtx(mtxInitData.mUseMtxIndex); break; case J3DShapeMtxType_Multi: - ret = new J3DShapeMtxMulti(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, + ret = JKR_NEW J3DShapeMtxMulti(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, &mMtxTable[mtxInitData.mFirstUseMtxIndex]); break; default: @@ -132,13 +132,13 @@ J3DShapeDraw* J3DShapeFactory::newShapeDraw(int shapeNo, int mtxGroupNo) const { const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]]; const J3DShapeDrawInitData& drawInitData = (&mDrawInitData[shapeInitData.mDrawInitDataIndex])[mtxGroupNo]; - shapeDraw = new J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize); + shapeDraw = JKR_NEW J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize); J3D_ASSERT_ALLOCMEM(193, shapeDraw); return shapeDraw; } void J3DShapeFactory::allocVcdVatCmdBuffer(u32 count) { - mVcdVatCmdBuffer = new (0x20) u8[J3DShape::kVcdVatDLSize * count]; + mVcdVatCmdBuffer = JKR_NEW_ARGS (0x20) u8[J3DShape::kVcdVatDLSize * count]; J3D_ASSERT_ALLOCMEM(211, mVcdVatCmdBuffer); for (u32 i = 0; i < (J3DShape::kVcdVatDLSize * count) / 4; i++) ((u32*)mVcdVatCmdBuffer)[i] = 0; diff --git a/libs/JSystem/src/J3DU/J3DUClipper.cpp b/libs/JSystem/src/J3DU/J3DUClipper.cpp index 56803c50ff..8469011cae 100644 --- a/libs/JSystem/src/J3DU/J3DUClipper.cpp +++ b/libs/JSystem/src/J3DU/J3DUClipper.cpp @@ -1,6 +1,7 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep #include "JSystem/J3DU/J3DUClipper.h" +#include "global.h" #include #include "global.h" diff --git a/libs/JSystem/src/JAWExtSystem/JAWGraphContext.cpp b/libs/JSystem/src/JAWExtSystem/JAWGraphContext.cpp index 66d5605362..59cd421af4 100644 --- a/libs/JSystem/src/JAWExtSystem/JAWGraphContext.cpp +++ b/libs/JSystem/src/JAWExtSystem/JAWGraphContext.cpp @@ -18,9 +18,9 @@ JAWGraphContext::JAWGraphContext() : field_0x16 = 6; field_0x18 = 0; if (!sFont) { - sFont = new JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL); + sFont = JKR_NEW JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL); } - field_0x0 = new J2DPrint(sFont, JUtility::TColor(255, 255, 255, 255), JUtility::TColor(255, 255, 255, 255)); + field_0x0 = JKR_NEW J2DPrint(sFont, JUtility::TColor(255, 255, 255, 255), JUtility::TColor(255, 255, 255, 255)); field_0x0->initiate(); locate(0, 0); } diff --git a/libs/JSystem/src/JAudio2/JAISeMgr.cpp b/libs/JSystem/src/JAudio2/JAISeMgr.cpp index 82885d1db4..0809ede5c6 100644 --- a/libs/JSystem/src/JAudio2/JAISeMgr.cpp +++ b/libs/JSystem/src/JAudio2/JAISeMgr.cpp @@ -49,7 +49,7 @@ void JAISeCategoryMgr::JAISeMgr_freeDeadSe_() { if (i->getObject()->status_.isDead()) { JUT_ASSERT(71, ! i->getObject() ->isHandleAttached()); mSeList.remove(i); - delete i->getObject(); + JKR_DELETE(i->getObject()); } i = link_next; } @@ -258,7 +258,7 @@ JAISe* JAISeMgr::newSe_(int category, u32 priority) { return NULL; } - JAISe* se = new JAISe(this, mStrategyMgr, priority); + JAISe* se = JKR_NEW JAISe(this, mStrategyMgr, priority); if (se == NULL) { JUT_WARN(410, "%s", "JASPoolAllocObject::::operator new failed .\n") return NULL; diff --git a/libs/JSystem/src/JAudio2/JAISeq.cpp b/libs/JSystem/src/JAudio2/JAISeq.cpp index 7f9f9132d1..038ce5989c 100644 --- a/libs/JSystem/src/JAudio2/JAISeq.cpp +++ b/libs/JSystem/src/JAudio2/JAISeq.cpp @@ -56,7 +56,7 @@ void JAISeq::reserveChildTracks_(int param_0) { JUT_ASSERT(92, inner_.outputTrack.getStatus() == JASTrack::STATUS_FREE); for (int i = 0; i < 2; i++) { - JASTrack* track = new JASTrack(); + JASTrack* track = JKR_NEW JASTrack(); if (track) { track->setAutoDelete(true); inner_.outputTrack.connectChild(i, track); @@ -67,7 +67,7 @@ void JAISeq::reserveChildTracks_(int param_0) { continue; } - JASTrack* track2 = new JASTrack(); + JASTrack* track2 = JKR_NEW JASTrack(); if (track2) { track2->setAutoDelete(true); track->connectChild(j, track2); @@ -90,10 +90,10 @@ void JAISeq::releaseChildTracks_() { for (u32 j = 0; j < 16; j++) { JASTrack* track2 = track->getChild(j); if (track2) { - delete track2; + JKR_DELETE(track2); } } - delete track; + JKR_DELETE(track); } } } @@ -176,7 +176,7 @@ void JAISeq::die_() { for (int i = 0; i < 32; i++) { if (inner_.mSoundChild[i]) { - delete inner_.mSoundChild[i]; + JKR_DELETE(inner_.mSoundChild[i]); inner_.mSoundChild[i] = NULL; } } @@ -257,7 +257,7 @@ JAISoundChild* JAISeq::getChild(int index) { return inner_.mSoundChild[index]; } - inner_.mSoundChild[index] = new JAISoundChild(); + inner_.mSoundChild[index] = JKR_NEW JAISoundChild(); if (!inner_.mSoundChild[index]) { JUT_WARN(379, "%s", "JASPoolAllocObject::::operator new failed .\n"); return NULL; @@ -273,7 +273,7 @@ void JAISeq::releaseChild(int index) { if (track) { track->assignExtBuffer(0, NULL); } - delete inner_.mSoundChild[index]; + JKR_DELETE(inner_.mSoundChild[index]); inner_.mSoundChild[index] = NULL; } } diff --git a/libs/JSystem/src/JAudio2/JAISeqMgr.cpp b/libs/JSystem/src/JAudio2/JAISeqMgr.cpp index a077de9434..a1f3554815 100644 --- a/libs/JSystem/src/JAudio2/JAISeqMgr.cpp +++ b/libs/JSystem/src/JAudio2/JAISeqMgr.cpp @@ -43,7 +43,7 @@ void JAISeqMgr::freeDeadSeq_() { JSULink* next = i->getNext(); if (seq->status_.isDead()) { mSeqList.remove(i); - delete seq; + JKR_DELETE(seq); } i = next; } @@ -120,7 +120,7 @@ void JAISeqMgr::mixOut() { } JAISeq* JAISeqMgr::beginStartSeq_() { - JAISeq* seq = new JAISeq(this, field_0x10); + JAISeq* seq = JKR_NEW JAISeq(this, field_0x10); if (seq == NULL) { JUT_WARN(273, "%s", "JASPoolAllocObject::::operator new failed .\n"); } @@ -137,7 +137,7 @@ bool JAISeqMgr::endStartSeq_(JAISeq* seq, JAISoundHandle* handle) { } return true; } - delete sound; + JKR_DELETE(sound); } return false; } diff --git a/libs/JSystem/src/JAudio2/JAISoundInfo.cpp b/libs/JSystem/src/JAudio2/JAISoundInfo.cpp index fa6a84a1da..26bd3e76c4 100644 --- a/libs/JSystem/src/JAudio2/JAISoundInfo.cpp +++ b/libs/JSystem/src/JAudio2/JAISoundInfo.cpp @@ -5,5 +5,7 @@ JAISoundInfo::JAISoundInfo(bool setInstance) : JASGlobalInstance(setInstance) {} JAISoundInfo::~JAISoundInfo() { + #if !TARGET_PC JUT_ASSERT(14, false); + #endif } diff --git a/libs/JSystem/src/JAudio2/JAIStream.cpp b/libs/JSystem/src/JAudio2/JAIStream.cpp index 7a254547a5..72f37ec248 100644 --- a/libs/JSystem/src/JAudio2/JAIStream.cpp +++ b/libs/JSystem/src/JAudio2/JAIStream.cpp @@ -188,7 +188,7 @@ void JAIStream::die_JAIStream_() { for (int i = 0; i < NUM_CHILDREN; i++) { if (children_[i] != NULL) { - delete children_[i]; + JKR_DELETE(children_[i]); children_[i] = NULL; } } @@ -249,7 +249,7 @@ s32 JAIStream::getNumChild() const { JAISoundChild* JAIStream::getChild(int index) { if (children_[index] == NULL) { - children_[index] = new JAISoundChild(); + children_[index] = JKR_NEW JAISoundChild(); if (children_[index] == NULL) { JUT_WARN(370, "%s", "JASPoolAllocObject::::operator new failed .\n") } @@ -259,7 +259,7 @@ JAISoundChild* JAIStream::getChild(int index) { void JAIStream::releaseChild(int index) { if (children_[index] != NULL) { - delete children_[index]; + JKR_DELETE(children_[index]); children_[index] = NULL; } } diff --git a/libs/JSystem/src/JAudio2/JAIStreamDataMgr.cpp b/libs/JSystem/src/JAudio2/JAIStreamDataMgr.cpp index b5e6821822..ca996eb34f 100644 --- a/libs/JSystem/src/JAudio2/JAIStreamDataMgr.cpp +++ b/libs/JSystem/src/JAudio2/JAIStreamDataMgr.cpp @@ -3,9 +3,13 @@ #include "JSystem/JAudio2/JAIStreamDataMgr.h" JAIStreamDataMgr::~JAIStreamDataMgr() { + #if !TARGET_PC JUT_ASSERT(11, false); + #endif } JAIStreamAramMgr::~JAIStreamAramMgr() { + #if !TARGET_PC JUT_ASSERT(16, false); + #endif } diff --git a/libs/JSystem/src/JAudio2/JAIStreamMgr.cpp b/libs/JSystem/src/JAudio2/JAIStreamMgr.cpp index a66f0952a5..2baafdf24a 100644 --- a/libs/JSystem/src/JAudio2/JAIStreamMgr.cpp +++ b/libs/JSystem/src/JAudio2/JAIStreamMgr.cpp @@ -63,7 +63,7 @@ void JAIStreamMgr::freeDeadStream_() { JUT_ASSERT(105, result); } - delete stream; + JKR_DELETE(stream); } i = next; } @@ -114,7 +114,7 @@ JAIStream* JAIStreamMgr::newStream_() { return NULL; } - JAIStream* stream = new JAIStream(this, field_0x6c); + JAIStream* stream = JKR_NEW JAIStream(this, field_0x6c); if (stream == NULL) { JUT_WARN(235, "%s", "JASPoolAllocObject::::operator new failed .\n"); return NULL; diff --git a/libs/JSystem/src/JAudio2/JASAiCtrl.cpp b/libs/JSystem/src/JAudio2/JASAiCtrl.cpp index 29eae172ed..19b5b7b08c 100644 --- a/libs/JSystem/src/JAudio2/JASAiCtrl.cpp +++ b/libs/JSystem/src/JAudio2/JASAiCtrl.cpp @@ -51,15 +51,15 @@ void JASDriver::initAI(void (*param_0)(void)) { u32 dacSize = getDacSize(); const u32 size = dacSize * 2; for (int i = 0; i < 3; i++) { - sDmaDacBuffer[i] = new(JASDram, 0x20) s16[dacSize]; + sDmaDacBuffer[i] = JKR_NEW_ARGS(JASDram, 0x20) s16[dacSize]; JUT_ASSERT(102, sDmaDacBuffer[i]) JASCalc::bzero(sDmaDacBuffer[i], size); DCStoreRange(sDmaDacBuffer[i], size); } - sDspDacBuffer = new(JASDram, 0) s16*[data_804507A8]; + sDspDacBuffer = JKR_NEW_ARGS(JASDram, 0) s16*[data_804507A8]; JUT_ASSERT(113, sDspDacBuffer); for (int i = 0; i < data_804507A8; i++) { - sDspDacBuffer[i] = new(JASDram, 0x20) s16[getDacSize()]; + sDspDacBuffer[i] = JKR_NEW_ARGS(JASDram, 0x20) s16[getDacSize()]; JUT_ASSERT(119, sDspDacBuffer[i]); JASCalc::bzero(sDspDacBuffer[i], size); DCStoreRange(sDspDacBuffer[i], size); diff --git a/libs/JSystem/src/JAudio2/JASAramStream.cpp b/libs/JSystem/src/JAudio2/JASAramStream.cpp index 3c813af5f2..b4dd6f1a48 100644 --- a/libs/JSystem/src/JAudio2/JASAramStream.cpp +++ b/libs/JSystem/src/JAudio2/JASAramStream.cpp @@ -33,7 +33,7 @@ void JASAramStream::initSystem(u32 block_size, u32 channel_max) { if (sLoadThread == NULL) { sLoadThread = JASDvd::getThreadPointer(); } - sReadBuffer = new (JASDram, 0x20) u8[(block_size + 0x20) * channel_max]; + sReadBuffer = JKR_NEW_ARGS (JASDram, 0x20) u8[(block_size + 0x20) * channel_max]; JUT_ASSERT(79, sReadBuffer); sBlockSize = block_size; sChannelMax = channel_max; @@ -667,7 +667,7 @@ void JASAramStream::channelStart() { // probably a fake match, this should be set in the JASWaveInfo constructor static u32 const one = 1; wave_info.field_0x20 = &one; - JASChannel* jc = new JASChannel(channelCallback, this); + JASChannel* jc = JKR_NEW JASChannel(channelCallback, this); JUT_ASSERT(963, jc); jc->setPriority(0x7f7f); for (u32 j = 0; j < 6; j++) { diff --git a/libs/JSystem/src/JAudio2/JASAudioThread.cpp b/libs/JSystem/src/JAudio2/JASAudioThread.cpp index 42fc277fea..ab059cf747 100644 --- a/libs/JSystem/src/JAudio2/JASAudioThread.cpp +++ b/libs/JSystem/src/JAudio2/JASAudioThread.cpp @@ -38,7 +38,7 @@ void JASAudioThread::create(s32 threadPriority) { #else const int size = 0x2800; #endif - JASAudioThread* pAudioThread = new (JASDram, 0) JASAudioThread(threadPriority, 0x10, size); + JASAudioThread* pAudioThread = JKR_NEW_ARGS (JASDram, 0) JASAudioThread(threadPriority, 0x10, size); JUT_ASSERT(46, pAudioThread); JKRHeap* pCurrentHeap = JKRGetSystemHeap(); JUT_ASSERT(48, pCurrentHeap); diff --git a/libs/JSystem/src/JAudio2/JASBNKParser.cpp b/libs/JSystem/src/JAudio2/JASBNKParser.cpp index 9c99d7ef85..67f504f7d6 100644 --- a/libs/JSystem/src/JAudio2/JASBNKParser.cpp +++ b/libs/JSystem/src/JAudio2/JASBNKParser.cpp @@ -56,7 +56,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h heap = JASDram; } - JASBasicBank* bank = new (heap, 0) JASBasicBank(); + JASBasicBank* bank = JKR_NEW_ARGS (heap, 0) JASBasicBank(); if (bank == NULL) { return NULL; } @@ -68,12 +68,12 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h TListChunk* list_chunk = (TListChunk*)findChunk(stream, 'LIST'); JUT_ASSERT(145, list_chunk); - u8* envt = new (heap, 2) u8[envt_chunk->mSize]; + u8* envt = JKR_NEW_ARGS (heap, 2) u8[envt_chunk->mSize]; JASCalc::bcopy(envt_chunk->mData, envt, envt_chunk->mSize); BE(u32)* ptr = &osc_chunk->mCount; u32 count = *ptr++; - JASOscillator::Data* osc_data = new (heap, 0) JASOscillator::Data[count]; + JASOscillator::Data* osc_data = JKR_NEW_ARGS (heap, 0) JASOscillator::Data[count]; for (int i = 0; i < count; i++, ptr += sizeof(TOsc) >> 2) { TOsc* op = (TOsc*)ptr; JUT_ASSERT(155, op->id == 'Osci'); @@ -94,7 +94,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h BE(u32)* data = (BE(u32)*)((intptr_t)stream + list_chunk->mOffsets[i]); switch (*data++) { case 'Inst': { - JASBasicInst* instp = new (heap, 0) JASBasicInst(); + JASBasicInst* instp = JKR_NEW_ARGS (heap, 0) JASBasicInst(); JUT_ASSERT(187, instp != NULL); u32 count = *data++; for (int j = 0; j < count; j++) { @@ -126,7 +126,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h } case 'Perc': { - JASDrumSet* drump = new (heap, 0) JASDrumSet(); + JASDrumSet* drump = JKR_NEW_ARGS (heap, 0) JASDrumSet(); JUT_ASSERT(264, drump != NULL); u32 pmap_count = data[1]; JUT_ASSERT(268, pmap_count <= 128); @@ -135,7 +135,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h for (int j = 0; j < count; j++) { u32 offset = *data++; if (offset != 0) { - JASDrumSet::TPerc* percp = new (heap, 0) JASDrumSet::TPerc(); + JASDrumSet::TPerc* percp = JKR_NEW_ARGS (heap, 0) JASDrumSet::TPerc(); JUT_ASSERT(277, percp); u32 type = data[0]; JUT_ASSERT(282, type == 'Pmap'); @@ -177,7 +177,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h } THeader const* header = (THeader*)stream; - JASBasicBank* bank = new (heap, 0) JASBasicBank(); + JASBasicBank* bank = JKR_NEW_ARGS (heap, 0) JASBasicBank(); if (bank == NULL) { return NULL; } @@ -187,7 +187,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h for (int i = 0; i < 0x80; i++) { TInst* tinst = header->mOffsets.mInstOffset[i].ptr(header); if (tinst != NULL) { - JASBasicInst* instp = new (heap, 0) JASBasicInst(); + JASBasicInst* instp = JKR_NEW_ARGS (heap, 0) JASBasicInst(); JUT_ASSERT(368, instp != NULL); instp->setVolume(tinst->mVolume); instp->setPitch(tinst->mPitch); @@ -200,7 +200,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h if (osc != NULL) { instp->setOsc(osc_idx, osc); } else { - osc = new (heap, 0) JASOscillator::Data(); + osc = JKR_NEW_ARGS (heap, 0) JASOscillator::Data(); JUT_ASSERT(386, osc != NULL); osc->mTarget = tosc->mTarget; osc->_04 = tosc->field_0x4; @@ -209,7 +209,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h if (points != NULL) { const JASOscillator::Point* endPtr = getOscTableEndPtr(points); int size = endPtr - points; - JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size]; + JASOscillator::Point* table = JKR_NEW_ARGS (heap, 0) JASOscillator::Point[size]; JUT_ASSERT(396, table != NULL); JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point)); osc->mTable = table; @@ -221,7 +221,7 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h if (points != NULL) { const JASOscillator::Point* endPtr = getOscTableEndPtr(points); int size = endPtr - points; - JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size]; + JASOscillator::Point* table = JKR_NEW_ARGS (heap, 0) JASOscillator::Point[size]; JUT_ASSERT(409, table != NULL); JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point)); osc->rel_table = table; @@ -256,14 +256,14 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h for (int i = 0; i < 12; i++) { TPerc* tperc = header->mOffsets.mPercOffset[i].ptr(header); if (tperc != NULL) { - JASDrumSet* setp = new (heap, 0) JASDrumSet(); + JASDrumSet* setp = JKR_NEW_ARGS (heap, 0) JASDrumSet(); JUT_ASSERT(509, setp != NULL); setp->newPercArray(0x80, heap); for (int j = 0; j < 0x80; j++) { TPmap* tpmap = tperc->mPmapOffset[j].ptr(header); if (tpmap != NULL) { - JASDrumSet::TPerc* percp = new (heap, 0) JASDrumSet::TPerc(); + JASDrumSet::TPerc* percp = JKR_NEW_ARGS (heap, 0) JASDrumSet::TPerc(); JUT_ASSERT(519, percp); percp->setVolume(tpmap->mVolume); percp->setPitch(tpmap->mPitch); diff --git a/libs/JSystem/src/JAudio2/JASBank.cpp b/libs/JSystem/src/JAudio2/JASBank.cpp index d8d97f3e5d..7d4fb86514 100644 --- a/libs/JSystem/src/JAudio2/JASBank.cpp +++ b/libs/JSystem/src/JAudio2/JASBank.cpp @@ -37,7 +37,7 @@ JASChannel* JASBank::noteOn(JASBank const* param_0, int param_1, u8 param_2, u8 return NULL; } - JASChannel* channel = new JASChannel(param_5, param_6); + JASChannel* channel = JKR_NEW JASChannel(param_5, param_6); if (!channel) { return NULL; } @@ -74,7 +74,7 @@ JASChannel* JASBank::noteOnOsc(int param_0, u8 param_1, u8 param_2, u16 param_3, {0x000F, 0x0000, 0x0000}, }; static const JASOscillator::Data OSC_ENV = {0, 1.0f, NULL, OSC_RELEASE_TABLE, 1.0f, 0.0f}; - JASChannel* channel = new JASChannel(param_4, param_5); + JASChannel* channel = JKR_NEW JASChannel(param_4, param_5); if (!channel) { return NULL; } diff --git a/libs/JSystem/src/JAudio2/JASBasicBank.cpp b/libs/JSystem/src/JAudio2/JASBasicBank.cpp index 510d7a718d..277691d66c 100644 --- a/libs/JSystem/src/JAudio2/JASBasicBank.cpp +++ b/libs/JSystem/src/JAudio2/JASBasicBank.cpp @@ -12,7 +12,7 @@ void JASBasicBank::newInstTable(u8 num, JKRHeap* heap) { if (num != 0) { JUT_ASSERT(31, num <= JASBank::PRG_OSC); mInstNumMax = num; - mInstTable = new (heap, 0) JASInst*[mInstNumMax]; + mInstTable = JKR_NEW_ARGS (heap, 0) JASInst*[mInstNumMax]; JASCalc::bzero(mInstTable, mInstNumMax * 4); } } diff --git a/libs/JSystem/src/JAudio2/JASBasicInst.cpp b/libs/JSystem/src/JAudio2/JASBasicInst.cpp index 4cd85278f6..eaf9222f65 100644 --- a/libs/JSystem/src/JAudio2/JASBasicInst.cpp +++ b/libs/JSystem/src/JAudio2/JASBasicInst.cpp @@ -17,7 +17,7 @@ JASBasicInst::JASBasicInst() { } JASBasicInst::~JASBasicInst() { - delete[] mKeymap; + JKR_DELETE_ARRAY(mKeymap); } bool JASBasicInst::getParam(int param_0, int param_1, JASInstParam* param_2) const { @@ -48,8 +48,8 @@ bool JASBasicInst::getParam(int param_0, int param_1, JASInstParam* param_2) con } void JASBasicInst::setKeyRegionCount(u32 count, JKRHeap* param_1) { - delete [] mKeymap; - mKeymap = new (param_1, 0) TKeymap[count]; + JKR_DELETE_ARRAY(mKeymap); + mKeymap = JKR_NEW_ARGS (param_1, 0) TKeymap[count]; JUT_ASSERT(114, mKeymap != NULL); mKeymapCount = count; } diff --git a/libs/JSystem/src/JAudio2/JASBasicWaveBank.cpp b/libs/JSystem/src/JAudio2/JASBasicWaveBank.cpp index 56991eef2f..6a643d2f58 100644 --- a/libs/JSystem/src/JAudio2/JASBasicWaveBank.cpp +++ b/libs/JSystem/src/JAudio2/JASBasicWaveBank.cpp @@ -15,8 +15,8 @@ JASBasicWaveBank::JASBasicWaveBank() { } JASBasicWaveBank::~JASBasicWaveBank() { - delete[] mWaveTable; - delete[] mWaveGroupArray; + JKR_DELETE_ARRAY(mWaveTable); + JKR_DELETE_ARRAY(mWaveGroupArray); } JASBasicWaveBank::TWaveGroup* JASBasicWaveBank::getWaveGroup(u32 param_0) { @@ -27,9 +27,9 @@ JASBasicWaveBank::TWaveGroup* JASBasicWaveBank::getWaveGroup(u32 param_0) { } void JASBasicWaveBank::setGroupCount(u32 param_0, JKRHeap* param_1) { - delete[] mWaveGroupArray; + JKR_DELETE_ARRAY(mWaveGroupArray); mGroupCount = param_0; - mWaveGroupArray = new(param_1, 0) TWaveGroup[param_0]; + mWaveGroupArray = JKR_NEW_ARGS(param_1, 0) TWaveGroup[param_0]; JUT_ASSERT(62, mWaveGroupArray != NULL); for (int i = 0; i < mGroupCount; i++) { mWaveGroupArray[i].mBank = this; @@ -37,8 +37,8 @@ void JASBasicWaveBank::setGroupCount(u32 param_0, JKRHeap* param_1) { } void JASBasicWaveBank::setWaveTableSize(u32 param_0, JKRHeap* param_1) { - delete[] mWaveTable; - mWaveTable = new(param_1, 0) TWaveHandle[param_0]; + JKR_DELETE_ARRAY(mWaveTable); + mWaveTable = JKR_NEW_ARGS(param_1, 0) TWaveHandle[param_0]; JUT_ASSERT(92, mWaveTable != NULL); mHandleCount = param_0; } @@ -98,13 +98,13 @@ JASBasicWaveBank::TWaveGroup::TWaveGroup() { } JASBasicWaveBank::TWaveGroup::~TWaveGroup() { - delete[] mCtrlWaveArray; + JKR_DELETE_ARRAY(mCtrlWaveArray); } void JASBasicWaveBank::TWaveGroup::setWaveCount(u32 param_0, JKRHeap* param_1) { - delete[] mCtrlWaveArray; + JKR_DELETE_ARRAY(mCtrlWaveArray); mWaveCount = param_0; - mCtrlWaveArray = new(param_1, 0) TGroupWaveInfo[param_0]; + mCtrlWaveArray = JKR_NEW_ARGS(param_1, 0) TGroupWaveInfo[param_0]; JUT_ASSERT(255, mCtrlWaveArray != NULL); } diff --git a/libs/JSystem/src/JAudio2/JASChannel.cpp b/libs/JSystem/src/JAudio2/JASChannel.cpp index 0979b38b8d..8e81ef3e86 100644 --- a/libs/JSystem/src/JAudio2/JASChannel.cpp +++ b/libs/JSystem/src/JAudio2/JASChannel.cpp @@ -57,7 +57,7 @@ JASChannel::~JASChannel() { int JASChannel::play() { JASDSPChannel* channel = JASDSPChannel::alloc(JSULoByte(mPriority), dspUpdateCallback, this); if (channel == NULL) { - delete this; + JKR_DELETE(this); return 0; } mDspCh = channel; @@ -70,7 +70,7 @@ int JASChannel::playForce() { JASDSPChannel* channel = JASDSPChannel::allocForce(JSULoByte(mPriority), dspUpdateCallback, this); if (channel == NULL) { - delete this; + JKR_DELETE(this); return 0; } mDspCh = channel; @@ -212,7 +212,7 @@ s32 JASChannel::dspUpdateCallback(u32 i_type, JASDsp::TChannel* i_channel, void* case JASDSPChannel::CB_DROP: _this->mDspCh->free(); _this->mDspCh = NULL; - delete _this; + JKR_DELETE(_this); return -1; default: JUT_WARN(323, "Unexpected JASDSPChannel::UpdateStatus %d", i_type); @@ -233,7 +233,7 @@ s32 JASChannel::initialUpdateDSPChannel(JASDsp::TChannel* i_channel) { JUT_WARN_DEVICE(346, 2, "%s", "Lost wave data while playing"); mDspCh->free(); mDspCh = NULL; - delete this; + JKR_DELETE(this); return -1; } @@ -241,7 +241,7 @@ s32 JASChannel::initialUpdateDSPChannel(JASDsp::TChannel* i_channel) { JUT_WARN_DEVICE(357, 2, "%s","Lost bank data while playing"); mDspCh->free(); mDspCh = NULL; - delete this; + JKR_DELETE(this); return -1; } @@ -311,7 +311,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) { JUT_WARN_DEVICE(456, 2, "%s","Lost wave data while playing"); mDspCh->free(); mDspCh = NULL; - delete this; + JKR_DELETE(this); return -1; } @@ -319,7 +319,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) { JUT_WARN_DEVICE(467, 2, "%s", "Lost bank data while playing"); mDspCh->free(); mDspCh = NULL; - delete this; + JKR_DELETE(this); return -1; } @@ -329,7 +329,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) { if (mOscillators[0].isRelease()) { mDspCh->free(); mDspCh = NULL; - delete this; + JKR_DELETE(this); return -1; } } else { @@ -350,7 +350,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) { if (i == 0 && mOscillators[i].isStop()) { mDspCh->free(); mDspCh = NULL; - delete this; + JKR_DELETE(this); return -1; } } diff --git a/libs/JSystem/src/JAudio2/JASDSPChannel.cpp b/libs/JSystem/src/JAudio2/JASDSPChannel.cpp index 268c80a779..98d0c115e8 100644 --- a/libs/JSystem/src/JAudio2/JASDSPChannel.cpp +++ b/libs/JSystem/src/JAudio2/JASDSPChannel.cpp @@ -42,7 +42,7 @@ void JASDSPChannel::drop() { } void JASDSPChannel::initAll() { - sDspChannels = new (JASDram, 0x20) JASDSPChannel[0x40]; + sDspChannels = JKR_NEW_ARGS (JASDram, 0x20) JASDSPChannel[0x40]; JUT_ASSERT(102, sDspChannels); for (int i = 0; i < 0x40; i++) { sDspChannels[i].mChannel = JASDsp::getDSPHandle(i); diff --git a/libs/JSystem/src/JAudio2/JASDSPInterface.cpp b/libs/JSystem/src/JAudio2/JASDSPInterface.cpp index 39c9c486e2..3658b453e6 100644 --- a/libs/JSystem/src/JAudio2/JASDSPInterface.cpp +++ b/libs/JSystem/src/JAudio2/JASDSPInterface.cpp @@ -426,9 +426,9 @@ u32 const ATTRIBUTE_ALIGN(32) JASDsp::DSPRES_FILTER[320] = { }; void JASDsp::initBuffer() { - CH_BUF = new(JASDram, 0x20) TChannel[64]; + CH_BUF = JKR_NEW_ARGS(JASDram, 0x20) TChannel[64]; JUT_ASSERT(354, CH_BUF); - FX_BUF = new(JASDram, 0x20) FxBuf[4]; + FX_BUF = JKR_NEW_ARGS(JASDram, 0x20) FxBuf[4]; JUT_ASSERT(356, FX_BUF); JASCalc::bzero(CH_BUF, 0x6000); JASCalc::bzero(FX_BUF, sizeof(FxBuf) * 4); diff --git a/libs/JSystem/src/JAudio2/JASDrumSet.cpp b/libs/JSystem/src/JAudio2/JASDrumSet.cpp index 0262e63c36..ebee34cf21 100644 --- a/libs/JSystem/src/JAudio2/JASDrumSet.cpp +++ b/libs/JSystem/src/JAudio2/JASDrumSet.cpp @@ -17,7 +17,7 @@ void JASDrumSet::newPercArray(u8 num, JKRHeap* heap) { if (num) { JUT_ASSERT(39, num <= 128); mPercNumMax = num; - mPercArray = new (heap, 0) TPerc*[mPercNumMax]; + mPercArray = JKR_NEW_ARGS (heap, 0) TPerc*[mPercNumMax]; JASCalc::bzero(mPercArray, mPercNumMax * sizeof(TPerc*)); } } diff --git a/libs/JSystem/src/JAudio2/JASDvdThread.cpp b/libs/JSystem/src/JAudio2/JASDvdThread.cpp index df118c07a0..31a313a8b1 100644 --- a/libs/JSystem/src/JAudio2/JASDvdThread.cpp +++ b/libs/JSystem/src/JAudio2/JASDvdThread.cpp @@ -16,7 +16,7 @@ bool JASDvd::createThread(s32 priority, int msgCount, u32 stackSize) { return false; } - sThread = new (JASDram, 0) JASTaskThread(priority, msgCount, stackSize); + sThread = JKR_NEW_ARGS (JASDram, 0) JASTaskThread(priority, msgCount, stackSize); JUT_ASSERT(36, sThread); JKRHeap* pCurrentHeap = JKRGetSystemHeap(); diff --git a/libs/JSystem/src/JAudio2/JASHeapCtrl.cpp b/libs/JSystem/src/JAudio2/JASHeapCtrl.cpp index 65d19c03a9..de49572e98 100644 --- a/libs/JSystem/src/JAudio2/JASHeapCtrl.cpp +++ b/libs/JSystem/src/JAudio2/JASHeapCtrl.cpp @@ -242,7 +242,7 @@ JASGenericMemPool::~JASGenericMemPool() { void* chunk = field_0x0; while (chunk != NULL) { void* next_chunk = *(void**)chunk; - delete[] chunk; + JKR_DELETE_ARRAY(chunk); chunk = next_chunk; } } @@ -258,7 +258,7 @@ void JASGenericMemPool::newMemPool(u32 n, int param_1) { JUT_ASSERT(734, n >= sizeof(TNextOnFreeList)); void* runner; for (int i = 0; i < param_1; i++) { - runner = new (JASDram, 0) u8[n]; + runner = JKR_NEW_ARGS (JASDram, 0) u8[n]; JUT_ASSERT(739, runner); *(void**)runner = field_0x0; field_0x0 = runner; @@ -301,7 +301,7 @@ void JASKernel::setupRootHeap(JKRSolidHeap* heap, u32 size) { sSystemHeap = JKRExpHeap::create(size, heap, false); JKRHEAP_NAME(sSystemHeap, "JASKernel::sSystemHeap"); JUT_ASSERT(787, sSystemHeap); - sCommandHeap = new (heap, 0) JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable>(); + sCommandHeap = JKR_NEW_ARGS (heap, 0) JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable>(); JKRHEAP_NAME(sSystemHeap, "JASKernel::sCommandHeap"); JUT_ASSERT(790, sCommandHeap); JASDram = heap; diff --git a/libs/JSystem/src/JAudio2/JASReport.cpp b/libs/JSystem/src/JAudio2/JASReport.cpp index 7afbe68684..00c9925036 100644 --- a/libs/JSystem/src/JAudio2/JASReport.cpp +++ b/libs/JSystem/src/JAudio2/JASReport.cpp @@ -28,7 +28,7 @@ void JASReportInit(JKRHeap* heap, int lineMax) { JUT_ASSERT(35, heap != NULL); OSInitMutex(&sMutex); sLineMax = lineMax; - sBuffer = new (heap, 0) char[sLineMax * 64]; + sBuffer = JKR_NEW_ARGS (heap, 0) char[sLineMax * 64]; JUT_ASSERT(41, sBuffer); } diff --git a/libs/JSystem/src/JAudio2/JASSimpleWaveBank.cpp b/libs/JSystem/src/JAudio2/JASSimpleWaveBank.cpp index 4918be0227..064d1f2efc 100644 --- a/libs/JSystem/src/JAudio2/JASSimpleWaveBank.cpp +++ b/libs/JSystem/src/JAudio2/JASSimpleWaveBank.cpp @@ -9,12 +9,12 @@ JASSimpleWaveBank::JASSimpleWaveBank() { } JASSimpleWaveBank::~JASSimpleWaveBank() { - delete[] mWaveTable; + JKR_DELETE_ARRAY(mWaveTable); } void JASSimpleWaveBank::setWaveTableSize(u32 size, JKRHeap* heap) { - delete[] mWaveTable; - mWaveTable = new (heap, 0) TWaveHandle[size]; + JKR_DELETE_ARRAY(mWaveTable); + mWaveTable = JKR_NEW_ARGS (heap, 0) TWaveHandle[size]; JUT_ASSERT(29, mWaveTable != NULL); mWaveTableSize = size; } diff --git a/libs/JSystem/src/JAudio2/JASTrack.cpp b/libs/JSystem/src/JAudio2/JASTrack.cpp index eec0ebd644..de070adde3 100644 --- a/libs/JSystem/src/JAudio2/JASTrack.cpp +++ b/libs/JSystem/src/JAudio2/JASTrack.cpp @@ -23,7 +23,7 @@ JASTrack::TList JASTrack::sTrackList; JASTrack::~JASTrack() { JUT_ASSERT(70, mStatus != STATUS_RUN); for (int i = 1; i < 4; i++) { - delete mChannelMgrs[i]; + JKR_DELETE(mChannelMgrs[i]); } } @@ -34,7 +34,7 @@ void JASTrack::setChannelMgrCount(u32 count) { mChannelMgrCount = 1; for (int i = 1; i < count; i++) { if (mChannelMgrs[i] == NULL) { - mChannelMgrs[i] = new TChannelMgr(this); + mChannelMgrs[i] = JKR_NEW TChannelMgr(this); if (mChannelMgrs[i] == NULL) { JUT_WARN(87, "%s", "Not enough JASTrackChannelMgr\n"); return; @@ -44,7 +44,7 @@ void JASTrack::setChannelMgrCount(u32 count) { } for (u32 i = mChannelMgrCount; i < 4; i++) { if (mChannelMgrs[i] != NULL) { - delete mChannelMgrs[i]; + JKR_DELETE(mChannelMgrs[i]); mChannelMgrs[i] = NULL; } } @@ -81,7 +81,7 @@ void JASTrack::init() { mChannelMgrCount = 1; for (int i = 1; i < 4; i++) { if (mChannelMgrs[i] != NULL) { - delete mChannelMgrs[i]; + JKR_DELETE(mChannelMgrs[i]); mChannelMgrs[i] = NULL; } } @@ -201,7 +201,7 @@ void JASTrack::close() { if (child != NULL) { child->close(); if (child->mFlags.autoDelete) { - delete child; + JKR_DELETE(child); mChildren[i] = NULL; } } @@ -232,7 +232,7 @@ void JASTrack::closeChild(u32 track_no) { getRootTrack()->updateSeq(false, 1.0f); child->close(); if (child->mFlags.autoDelete) { - delete child; + JKR_DELETE(child); mChildren[track_no] = NULL; } } @@ -259,7 +259,7 @@ JASTrack* JASTrack::openChild(u32 trk_no) { break; } } else { - child = new JASTrack(); + child = JKR_NEW JASTrack(); if (child == NULL) { JUT_WARN(388, "%s", "Not enough JASTrack\n"); return NULL; @@ -736,7 +736,7 @@ int JASTrack::tickProc() { getRootTrack()->updateSeq(false, 1.0f); child->close(); if (child->mFlags.autoDelete) { - delete child; + JKR_DELETE(child); mChildren[i] = NULL; } } @@ -794,7 +794,7 @@ void JASTrack::TList::seqMain() { if (seqMainRes < 0) { Remove(&*it); if (it->mFlags.autoDelete) { - delete &*it; + JKR_DELETE(&*it); } } } @@ -811,7 +811,7 @@ void JASTrack::TList::seqMain() { if (seqMainRes < 0) { Remove(&*it); if (it->mFlags.autoDelete) { - delete &*it; + JKR_DELETE(&*it); } } it = it2; diff --git a/libs/JSystem/src/JAudio2/JASWSParser.cpp b/libs/JSystem/src/JAudio2/JASWSParser.cpp index a03f73f35e..112b9197e8 100644 --- a/libs/JSystem/src/JAudio2/JASWSParser.cpp +++ b/libs/JSystem/src/JAudio2/JASWSParser.cpp @@ -30,7 +30,7 @@ JASBasicWaveBank* JASWSParser::createBasicWaveBank(void const* stream, JKRHeap* u32 free_size = heap->getFreeSize(); THeader* header = (THeader*)stream; - JASBasicWaveBank* wave_bank = new (heap, 0) JASBasicWaveBank(); + JASBasicWaveBank* wave_bank = JKR_NEW_ARGS (heap, 0) JASBasicWaveBank(); if (wave_bank == NULL) { return NULL; } @@ -82,7 +82,7 @@ JASSimpleWaveBank* JASWSParser::createSimpleWaveBank(void const* stream, JKRHeap return NULL; } - JASSimpleWaveBank* wave_bank = new (heap, 0) JASSimpleWaveBank(); + JASSimpleWaveBank* wave_bank = JKR_NEW_ARGS (heap, 0) JASSimpleWaveBank(); if (wave_bank == NULL) { return NULL; } diff --git a/libs/JSystem/src/JAudio2/JASWaveArcLoader.cpp b/libs/JSystem/src/JAudio2/JASWaveArcLoader.cpp index ad1a1e2a76..26567584bd 100644 --- a/libs/JSystem/src/JAudio2/JASWaveArcLoader.cpp +++ b/libs/JSystem/src/JAudio2/JASWaveArcLoader.cpp @@ -168,13 +168,13 @@ void JASWaveArc::setFileName(char const* fileName) { char* currentDir = JASWaveArcLoader::getCurrentDir(); size_t length = strlen(currentDir); length = length + strlen(fileName); - char* path = new (JASKernel::getSystemHeap(), -4) char[length + 1]; + char* path = JKR_NEW_ARGS (JASKernel::getSystemHeap(), -4) char[length + 1]; JUT_ASSERT(322, path); strcpy(path, currentDir); strcat(path, fileName); path[length] = '\0'; int entryNum = DVDConvertPathToEntrynum(path); - delete[] path; + JKR_DELETE_ARRAY(path); if (entryNum < 0) { return; } diff --git a/libs/JSystem/src/JAudio2/JAUAudioMgr.cpp b/libs/JSystem/src/JAudio2/JAUAudioMgr.cpp index 4e92d1667f..2623707979 100644 --- a/libs/JSystem/src/JAudio2/JAUAudioMgr.cpp +++ b/libs/JSystem/src/JAudio2/JAUAudioMgr.cpp @@ -14,7 +14,7 @@ void dummyDefCtor() { //TODO: ShieldD needs the weak functions this pulls in, but in retail it breaks weak function // placement #if VERSION == VERSION_SHIELD_DEBUG - JAUStreamStaticAramMgr_<1>* streamStaticAramMgr = new(NULL, 0) JAUStreamStaticAramMgr_<1>(); + JAUStreamStaticAramMgr_<1>* streamStaticAramMgr = JKR_NEW_ARGS(NULL, 0) JAUStreamStaticAramMgr_<1>(); streamStaticAramMgr->reserveAram(NULL, 0, 0x14); #endif } diff --git a/libs/JSystem/src/JAudio2/JAUSectionHeap.cpp b/libs/JSystem/src/JAudio2/JAUSectionHeap.cpp index b0c127187d..53ed8aa62e 100644 --- a/libs/JSystem/src/JAudio2/JAUSectionHeap.cpp +++ b/libs/JSystem/src/JAudio2/JAUSectionHeap.cpp @@ -38,7 +38,7 @@ namespace { return; } mNumStreamFiles = stack_14.getNumFiles(); - mStreamFileDVDEntryNums = new s32[mNumStreamFiles]; + mStreamFileDVDEntryNums = JKR_NEW s32[mNumStreamFiles]; if (!mStreamFileDVDEntryNums) { mNumStreamFiles = 0; return; @@ -139,7 +139,7 @@ JAUSoundTable* JAUSection::newSoundTable(void const* bst, u32 param_1, bool para bstDst = newCopy(bst, param_1, 4); JUT_ASSERT(296, bstDst); } - JAUSoundTable* soundTable = new JAUSoundTable(param_2); + JAUSoundTable* soundTable = JKR_NEW JAUSoundTable(param_2); JUT_ASSERT(299, soundTable); soundTable->init(bstDst); sectionHeap_->sectionHeapData_.soundTable = soundTable; @@ -161,7 +161,7 @@ JAUSoundNameTable* JAUSection::newSoundNameTable(void const* bstn, u32 param_1, bstnDst = newCopy(bstn, param_1, 4); JUT_ASSERT(326, bstnDst); } - JAUSoundNameTable* soundNameTable = new JAUSoundNameTable(param_2); + JAUSoundNameTable* soundNameTable = JKR_NEW JAUSoundNameTable(param_2); JUT_ASSERT(329, soundNameTable); soundNameTable->init(bstnDst); sectionHeap_->sectionHeapData_.soundNameTable = soundNameTable; @@ -179,12 +179,12 @@ JAIStreamDataMgr* JAUSection::newStreamFileTable(void const* param_0, bool param TPushCurrentHeap push(getHeap_()); JAIStreamDataMgr* r28 = NULL; if (param_1) { - TStreamDataMgr* r26 = new TStreamDataMgr(param_0); + TStreamDataMgr* r26 = JKR_NEW TStreamDataMgr(param_0); if (r26->isValid()) { r28 = r26; } } else { - JAUStreamDataMgr_StreamFileTable* r25 = new JAUStreamDataMgr_StreamFileTable(); + JAUStreamDataMgr_StreamFileTable* r25 = JKR_NEW JAUStreamDataMgr_StreamFileTable(); r25->init(param_0); if (r25->isValid()) { r28 = r25; @@ -204,7 +204,7 @@ JAISeqDataMgr* JAUSection::newSeSeqCollection(void const* bsc, u32 param_1) { JUT_ASSERT(405, bsc); { TPushCurrentHeap push(getHeap_()); - JAUSeqDataMgr_SeqCollection* seSeqDataMgr = new JAUSeqDataMgr_SeqCollection(); + JAUSeqDataMgr_SeqCollection* seSeqDataMgr = JKR_NEW JAUSeqDataMgr_SeqCollection(); JUT_ASSERT(409, seSeqDataMgr); seSeqDataMgr->init(bsc); sectionHeap_->sectionHeapData_.seSeqDataMgr_ = seSeqDataMgr; @@ -219,16 +219,16 @@ u8* JAUSection::newStaticSeqDataBlock_(JAISoundID param_0, u32 size) { JUT_ASSERT(421, size); { TPushCurrentHeap push(getHeap_()); - JAUSeqDataBlock* seqDataBlock = new JAUSeqDataBlock(); + JAUSeqDataBlock* seqDataBlock = JKR_NEW JAUSeqDataBlock(); if (!seqDataBlock) { return NULL; } - JSULink* link = new JSULink(seqDataBlock); + JSULink* link = JKR_NEW JSULink(seqDataBlock); if (!link) { JUT_WARN(432, "%s", "created UNUSED object in Heap\n"); return NULL; } - u8* r28 = new(0x20) u8[size]; + u8* r28 = JKR_NEW_ARGS(0x20) u8[size]; if (!r28) { JUT_WARN(438, "%s", "created UNUSED object in Heap\n"); return NULL; @@ -277,7 +277,7 @@ bool JAUSection::newStaticSeqData(JAISoundID param_0) { void* JAUSection::newCopy(void const* param_0, u32 param_1, s32 param_2) { JUT_ASSERT(516, isOpen()); JUT_ASSERT(517, isBuilding()); - u8* r31 = new(getHeap_(), param_2) u8[param_1]; + u8* r31 = JKR_NEW_ARGS(getHeap_(), param_2) u8[param_1]; if (r31) { memcpy(r31, param_0, param_1); } @@ -358,7 +358,7 @@ JASVoiceBank* JAUSection::newVoiceBank(u32 bank_no, u32 param_1) { JASWaveBank* waveBank = sectionHeap_->getWaveBankTable().getWaveBank(param_1); JUT_ASSERT(688, waveBank != NULL); TPushCurrentHeap push(getHeap_()); - JASBank* voiceBank = new JASVoiceBank(); + JASBank* voiceBank = JKR_NEW JASVoiceBank(); if (voiceBank) { if (buildingBankTable_) { JUT_ASSERT(696, buildingBankTable_->getBank( bank_no ) == NULL); @@ -382,9 +382,9 @@ bool JAUSection::beginNewBankTable(u32 param_0, u32 param_1) { JAUBankTableLink* bankTableLink = NULL; { TPushCurrentHeap push(getHeap_()); - JASBank** r26 = new JASBank*[param_1]; + JASBank** r26 = JKR_NEW JASBank*[param_1]; if (r26) { - bankTableLink = new JAUBankTableLink(param_0, r26, param_1); + bankTableLink = JKR_NEW JAUBankTableLink(param_0, r26, param_1); if (bankTableLink) { buildingBankTable_ = bankTableLink; } else { @@ -435,7 +435,7 @@ static JAUSectionHeap* JAUNewSectionHeap(JKRSolidHeap* heap, bool param_1) { JUT_ASSERT(809, JKRSolidHeap_isEmpty( heap )); TPushCurrentHeap push(heap); s32 r29 = heap->getFreeSize(); - JAUSectionHeap* sectionHeap = new JAUSectionHeap(heap, param_1, r29); + JAUSectionHeap* sectionHeap = JKR_NEW JAUSectionHeap(heap, param_1, r29); return sectionHeap; } @@ -480,16 +480,16 @@ bool JAUSectionHeap::newDynamicSeqBlock(u32 size) { JUT_ASSERT(939, sectionHeap_ == this); { TPushCurrentHeap push(getHeap_()); - JAUSeqDataBlock * seqDataBlock = new JAUSeqDataBlock(); + JAUSeqDataBlock * seqDataBlock = JKR_NEW JAUSeqDataBlock(); if (!seqDataBlock) { return false; } - JSULink * link = new JSULink(seqDataBlock); + JSULink * link = JKR_NEW JSULink(seqDataBlock); if (!link) { JUT_WARN(950, "%s", "created UNUSED object in Heap\n"); return false; } - u8* r25 = new(0x20) u8[size]; + u8* r25 = JKR_NEW_ARGS(0x20) u8[size]; if (!r25) { JUT_WARN(956, "%s", "created UNUSED object in Heap\n"); return false; diff --git a/libs/JSystem/src/JFramework/JFWDisplay.cpp b/libs/JSystem/src/JFramework/JFWDisplay.cpp index 67da53658c..03a1afe94c 100644 --- a/libs/JSystem/src/JFramework/JFWDisplay.cpp +++ b/libs/JSystem/src/JFramework/JFWDisplay.cpp @@ -14,6 +14,9 @@ #include #include "global.h" #include "aurora/aurora.h" +#include "global.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "dusk/logging.h" void JFWDisplay::ctor_subroutine(bool enableAlpha) { mEnableAlpha = enableAlpha; @@ -64,7 +67,7 @@ JFWDisplay* JFWDisplay::createManager(GXRenderModeObj const* p_rObj, JKRHeap* p_ } if (sManager == NULL) { - sManager = new JFWDisplay(p_heap, xfb_num, enableAlpha); + sManager = JKR_NEW JFWDisplay(p_heap, xfb_num, enableAlpha); } return sManager; @@ -226,16 +229,9 @@ void JFWDisplay::endGX() { void JFWDisplay::beginRender() { #if TARGET_PC - // Temporarily clear the current JKRHeap so that Aurora/Dawn/ImGui allocations - // use malloc instead of JKRHeap. Without this, Dawn's internal std::string - // allocations would go through JKRHeap and then crash when freed via standard delete. - JKRHeap* savedHeap = JKRHeap::getCurrentHeap(); - JKRHeap::setCurrentHeap(nullptr); -#endif aurora_begin_frame(); -#if TARGET_PC - JKRHeap::setCurrentHeap(savedHeap); #endif + if (field_0x40) { JUTProcBar::getManager()->wholeLoopEnd(); } @@ -313,16 +309,6 @@ void JFWDisplay::endRender() { JUTProcBar::getManager()->cpuStart(); calcCombinationRatio(); -#if TARGET_PC - { - JKRHeap* savedHeap = JKRHeap::getCurrentHeap(); - JKRHeap::setCurrentHeap(nullptr); - aurora_end_frame(); - JKRHeap::setCurrentHeap(savedHeap); - } -#else - aurora_end_frame(); -#endif } void JFWDisplay::endFrame() { @@ -357,6 +343,10 @@ void JFWDisplay::endFrame() { JUTProcBar::getManager()->setCostFrame(retrace_cnt - prevFrame); prevFrame = retrace_cnt; } + +#if TARGET_PC + aurora_end_frame(); +#endif } void JFWDisplay::waitBlanking(int param_0) { @@ -450,7 +440,7 @@ void JFWDisplay::clearEfb(GXColor color) { void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3, GXColor color) { #if TARGET_PC - puts("clearEfb not implemented"); + STUB_LOG(); return; #endif u16 width; diff --git a/libs/JSystem/src/JFramework/JFWSystem.cpp b/libs/JSystem/src/JFramework/JFWSystem.cpp index e240b8d19c..66a1a19960 100644 --- a/libs/JSystem/src/JFramework/JFWSystem.cpp +++ b/libs/JSystem/src/JFramework/JFWSystem.cpp @@ -73,7 +73,7 @@ void JFWSystem::init() { JKRAram::create(CSetUpParam::aramAudioBufSize, CSetUpParam::aramGraphBufSize, CSetUpParam::streamPriority, CSetUpParam::decompPriority, CSetUpParam::aPiecePriority); - mainThread = new JKRThread(OSGetCurrentThread(), 4); + mainThread = JKR_NEW JKRThread(OSGetCurrentThread(), 4); JUTVideo::createManager(CSetUpParam::renderMode); JUTCreateFifo(CSetUpParam::fifoBufSize); @@ -86,7 +86,7 @@ void JFWSystem::init() { JUTException::create(dbPrint); - systemFont = new JUTResFont(CSetUpParam::systemFontRes, NULL); + systemFont = JKR_NEW JUTResFont(CSetUpParam::systemFontRes, NULL); debugPrint = JUTDbPrint::start(NULL, NULL); debugPrint->changeFont(systemFont); diff --git a/libs/JSystem/src/JGadget/binary.cpp b/libs/JSystem/src/JGadget/binary.cpp index c16c72a29f..a249565981 100644 --- a/libs/JSystem/src/JGadget/binary.cpp +++ b/libs/JSystem/src/JGadget/binary.cpp @@ -5,6 +5,8 @@ #include "global.h" #include +#include "global.h" + #if DEBUG static void dummyString() { // probably some stripped function that called JUT_ASSERT here @@ -24,14 +26,21 @@ const void* JGadget::binary::parseVariableUInt_16_32_following(const void* pBuff pTEBit = &spC; } +#if TARGET_PC + u32 var_r30 = BSWAP16(*pu16); +#elif u32 var_r30 = *pu16; +#endif if ((var_r30 & 0x8000) == 0) { pTEBit->value = 0x10; *pu32First = var_r30; pu16++; +#if TARGET_PC + *pu32Second = BSWAP16(*pu16); +#elif *pu32Second = *pu16; - +#endif return pu16 + 1; } else { pTEBit->value = 0x20; @@ -39,11 +48,19 @@ const void* JGadget::binary::parseVariableUInt_16_32_following(const void* pBuff var_r30 &= 0x7FFF; var_r30 <<= 16; pu16++; +#if TARGET_PC + var_r30 |= BSWAP16(*pu16); +#else var_r30 |= *pu16; +#endif *pu32First = var_r30; pu16++; +#if TARGET_PC + *pu32Second = BSWAP32(*(u32*)pu16); +#else *pu32Second = *(u32*)pu16; +#endif return pu16 + 2; } diff --git a/libs/JSystem/src/JHostIO/JHICommonMem.cpp b/libs/JSystem/src/JHostIO/JHICommonMem.cpp index 3d2f59fc49..cf27e3e6fa 100644 --- a/libs/JSystem/src/JHostIO/JHICommonMem.cpp +++ b/libs/JSystem/src/JHostIO/JHICommonMem.cpp @@ -6,7 +6,7 @@ JHIMemBuf* JHICommonMem::instance; JHIMemBuf* JHICommonMem::Instance() { if (instance == NULL) { - instance = new JHIMemBuf(); + instance = JKR_NEW JHIMemBuf(); } return instance; diff --git a/libs/JSystem/src/JHostIO/JHIMccBuf.cpp b/libs/JSystem/src/JHostIO/JHIMccBuf.cpp index 93bc7edf56..bea9f5e256 100644 --- a/libs/JSystem/src/JHostIO/JHIMccBuf.cpp +++ b/libs/JSystem/src/JHostIO/JHIMccBuf.cpp @@ -40,7 +40,7 @@ void JHIMccBuf::init() { if (mTempBuf != NULL) { initBuf(); } else { - mTempBuf = new (32) u8[0x18000]; + mTempBuf = JKR_NEW_ARGS (32) u8[0x18000]; if (mTempBuf == NULL) { JHIHalt("ERROR: JHIMccBuf cannot alloc temp buf.\n"); } else { @@ -68,7 +68,7 @@ void JHIMccBuf::initBuf() { JHIMccBuf::~JHIMccBuf() { mRefCount--; if (mRefCount == 0) { - delete[] mTempBuf; + JKR_DELETE_ARRAY(mTempBuf); } } diff --git a/libs/JSystem/src/JHostIO/JHIMemBuf.cpp b/libs/JSystem/src/JHostIO/JHIMemBuf.cpp index 4fec9ad532..21d9a98d22 100644 --- a/libs/JSystem/src/JHostIO/JHIMemBuf.cpp +++ b/libs/JSystem/src/JHostIO/JHIMemBuf.cpp @@ -11,7 +11,7 @@ int JHIMemBuf::create() { int rt = 1; if (mp_buffer == NULL) { - mp_buffer = new (32) u8[0x20000]; + mp_buffer = JKR_NEW_ARGS (32) u8[0x20000]; if (mp_buffer == NULL) { rt = 0; @@ -30,7 +30,7 @@ int JHIMemBuf::open() { void JHIMemBuf::close() { if (mp_buffer != NULL) { - delete[] mp_buffer; + JKR_DELETE_ARRAY(mp_buffer); } } diff --git a/libs/JSystem/src/JHostIO/JHIRMcc.cpp b/libs/JSystem/src/JHostIO/JHIRMcc.cpp index 32590961f1..fc1b295181 100644 --- a/libs/JSystem/src/JHostIO/JHIRMcc.cpp +++ b/libs/JSystem/src/JHostIO/JHIRMcc.cpp @@ -65,11 +65,11 @@ bool JHINegotiateInterface(u32) { JHIMccContext JHIGetHiSpeedContext() { if (tContext_new.mp_reader == NULL) { - tContext_new.mp_reader = new JHIMccBufReader(1, 0x18, 0x6000); + tContext_new.mp_reader = JKR_NEW JHIMccBufReader(1, 0x18, 0x6000); } if (tContext_new.mp_writer == NULL) { - tContext_new.mp_writer = new JHIMccBufWriter(1, 0x18, 0x6000); + tContext_new.mp_writer = JKR_NEW JHIMccBufWriter(1, 0x18, 0x6000); } return tContext_new; @@ -77,11 +77,11 @@ JHIMccContext JHIGetHiSpeedContext() { JHIMccContext JHIGetLowSpeedContext() { if (tContext_old.mp_reader == NULL) { - tContext_old.mp_reader = new JHIMccBufReader(1, 2, 0); + tContext_old.mp_reader = JKR_NEW JHIMccBufReader(1, 2, 0); } if (tContext_old.mp_writer == NULL) { - tContext_old.mp_writer = new JHIMccBufWriter(1, 2, 0); + tContext_old.mp_writer = JKR_NEW JHIMccBufWriter(1, 2, 0); } return tContext_old; diff --git a/libs/JSystem/src/JHostIO/JHIhioASync.cpp b/libs/JSystem/src/JHostIO/JHIhioASync.cpp index bc8c5b9e2c..050b8c0f24 100644 --- a/libs/JSystem/src/JHostIO/JHIhioASync.cpp +++ b/libs/JSystem/src/JHostIO/JHIhioASync.cpp @@ -35,8 +35,8 @@ BOOL JHIInit(u32 enabled) { OS_REPORT("INFO: *** Disable JHostIO ***\n"); } - gsReadBuf = new (32) u8[0xC000]; - gsWriteBuf = new (32) u8[0xC000]; + gsReadBuf = JKR_NEW_ARGS (32) u8[0xC000]; + gsWriteBuf = JKR_NEW_ARGS (32) u8[0xC000]; if (gsReadBuf == NULL || gsWriteBuf == NULL) { gsEnableInterface = FALSE; diff --git a/libs/JSystem/src/JHostIO/JOREntry.cpp b/libs/JSystem/src/JHostIO/JOREntry.cpp index 0a6b0271c3..5cf9b528a9 100644 --- a/libs/JSystem/src/JHostIO/JOREntry.cpp +++ b/libs/JSystem/src/JHostIO/JOREntry.cpp @@ -7,12 +7,12 @@ void JORInit() { JHIInit(TRUE); - JHICommBufWriter* pComWriter = new JHICommBufWriter(0x10000, 0x10000, 4); - JHICommBufReader* pComReader = new JHICommBufReader(0, 0x10000, 4); + JHICommBufWriter* pComWriter = JKR_NEW JHICommBufWriter(0x10000, 0x10000, 4); + JHICommBufReader* pComReader = JKR_NEW JHICommBufReader(0, 0x10000, 4); JHIContext ctx; - ctx.mp_reader = new JHICommBufReader(0x10000, 0x10000, 4); - ctx.mp_writer = new JHICommBufWriter(0, 0x10000, 4); + ctx.mp_reader = JKR_NEW JHICommBufReader(0x10000, 0x10000, 4); + ctx.mp_writer = JKR_NEW JHICommBufWriter(0, 0x10000, 4); JHIComPortManager* pPortMng = JHIComPortManager::create(); pPortMng->getRefPort().setBuf(pComReader, pComWriter); diff --git a/libs/JSystem/src/JHostIO/JORServer.cpp b/libs/JSystem/src/JHostIO/JORServer.cpp index 3883252ce1..62086b259c 100644 --- a/libs/JSystem/src/JHostIO/JORServer.cpp +++ b/libs/JSystem/src/JHostIO/JORServer.cpp @@ -117,7 +117,7 @@ JORServer* JORServer::instance; JORServer* JORServer::create() { if (instance == NULL) { - instance = new JORServer(); + instance = JKR_NEW JORServer(); } return instance; diff --git a/libs/JSystem/src/JKernel/JKRAram.cpp b/libs/JSystem/src/JKernel/JKRAram.cpp index 59a2a7848e..8049ee0069 100644 --- a/libs/JSystem/src/JKernel/JKRAram.cpp +++ b/libs/JSystem/src/JKernel/JKRAram.cpp @@ -32,7 +32,7 @@ JKRAram* JKRAram::sAramObject; JKRAram* JKRAram::create(u32 aram_audio_buffer_size, u32 aram_audio_graph_size, s32 stream_priority, s32 decomp_priority, s32 piece_priority) { if (!sAramObject) { - sAramObject = new (JKRGetSystemHeap(), 0) + sAramObject = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRAram(aram_audio_buffer_size, aram_audio_graph_size, piece_priority); } @@ -81,13 +81,13 @@ JKRAram::JKRAram(u32 audio_buffer_size, u32 audio_graph_size, s32 priority) OS_REPORT("ARAM graph area %08x: %08x\n", mGraphMemoryPtr, mGraphMemorySize); OS_REPORT("ARAM user area %08x: %08x\n", mAramMemoryPtr, mAramMemorySize); - mAramHeap = new (JKRGetSystemHeap(), 0) JKRAramHeap(mGraphMemoryPtr, mGraphMemorySize); + mAramHeap = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRAramHeap(mGraphMemoryPtr, mGraphMemorySize); } JKRAram::~JKRAram() { sAramObject = NULL; if (mAramHeap) - delete mAramHeap; + JKR_DELETE(mAramHeap); } void* JKRAram::run(void) { @@ -98,7 +98,7 @@ void* JKRAram::run(void) { JKRAramCommand* message = (JKRAramCommand*)msg; int result = message->field_0x00; JKRAMCommand* command = (JKRAMCommand*)message->command; - delete message; + JKR_DELETE(message); switch (result) { case 1: diff --git a/libs/JSystem/src/JKernel/JKRAramArchive.cpp b/libs/JSystem/src/JKernel/JKRAramArchive.cpp index e318f41a64..d6923ee06b 100644 --- a/libs/JSystem/src/JKernel/JKRAramArchive.cpp +++ b/libs/JSystem/src/JKernel/JKRAramArchive.cpp @@ -48,11 +48,11 @@ JKRAramArchive::~JKRAramArchive() { } if (mDvdFile != NULL) { - delete mDvdFile; + JKR_DELETE(mDvdFile); } if (mBlock != NULL) { - delete mBlock; + JKR_DELETE(mBlock); } JKRFileLoader::sVolumeList.remove(&mFileLoaderLink); @@ -105,7 +105,7 @@ bool JKRAramArchive::open(s32 entryNum) { mStringTable = NULL; mBlock = NULL; - mDvdFile = new (JKRGetSystemHeap(), mMountDirection == MOUNT_DIRECTION_HEAD ? 4 : -4) + mDvdFile = JKR_NEW_ARGS (JKRGetSystemHeap(), mMountDirection == MOUNT_DIRECTION_HEAD ? 4 : -4) JKRDvdFile(entryNum); if (mDvdFile == NULL) { mMountMode = 0; @@ -187,7 +187,7 @@ cleanup: if (mMountMode == 0) { OS_REPORT(":::[%s: %d] Cannot alloc memory\n", __FILE__, 415); if (mDvdFile != NULL) { - delete mDvdFile; + JKR_DELETE(mDvdFile); } return false; } diff --git a/libs/JSystem/src/JKernel/JKRAramBlock.cpp b/libs/JSystem/src/JKernel/JKRAramBlock.cpp index a7a1fcf96d..63b4b3cf67 100644 --- a/libs/JSystem/src/JKernel/JKRAramBlock.cpp +++ b/libs/JSystem/src/JKernel/JKRAramBlock.cpp @@ -30,7 +30,7 @@ JKRAramBlock* JKRAramBlock::allocHead(u32 size, u8 groupId, JKRAramHeap* aramHea u32 nextAddress = mAddress + mSize; u32 nextFreeSize = mFreeSize - size; - JKRAramBlock* block = new (aramHeap->getMgrHeap(), 0) + JKRAramBlock* block = JKR_NEW_ARGS (aramHeap->getMgrHeap(), 0) JKRAramBlock(nextAddress, size, nextFreeSize, groupId, false); mFreeSize = 0; @@ -42,7 +42,7 @@ JKRAramBlock* JKRAramBlock::allocTail(u32 size, u8 groupId, JKRAramHeap* aramHea u32 tailAddress = mAddress + mSize + mFreeSize - size; JKRAramBlock* block = - new (aramHeap->getMgrHeap(), 0) JKRAramBlock(tailAddress, size, 0, groupId, true); + JKR_NEW_ARGS (aramHeap->getMgrHeap(), 0) JKRAramBlock(tailAddress, size, 0, groupId, true); mFreeSize -= size; mBlockLink.getSupervisor()->insert(mBlockLink.getNext(), &block->mBlockLink); diff --git a/libs/JSystem/src/JKernel/JKRAramHeap.cpp b/libs/JSystem/src/JKernel/JKRAramHeap.cpp index 051a5a5c01..83e5cc9ac7 100644 --- a/libs/JSystem/src/JKernel/JKRAramHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRAramHeap.cpp @@ -17,12 +17,12 @@ JKRAramHeap::JKRAramHeap(u32 startAddress, u32 size) { mTailAddress = mHeadAddress + mSize; mGroupId = -1; - JKRAramBlock* block = new (mHeap, 0) JKRAramBlock(mHeadAddress, 0, mSize, -1, false); + JKRAramBlock* block = JKR_NEW_ARGS (mHeap, 0) JKRAramBlock(mHeadAddress, 0, mSize, -1, false); sAramList.append(&block->mBlockLink); } JKRAramHeap::~JKRAramHeap() { - for (JSUListIterator iterator = sAramList.getFirst(); iterator != sAramList.getEnd(); delete (iterator++).getObject()) {} + for (JSUListIterator iterator = sAramList.getFirst(); iterator != sAramList.getEnd(); JKR_DELETE((iterator++).getObject())) {} } JKRAramBlock* JKRAramHeap::alloc(u32 size, JKRAramHeap::EAllocMode allocationMode) { diff --git a/libs/JSystem/src/JKernel/JKRAramPiece.cpp b/libs/JSystem/src/JKernel/JKRAramPiece.cpp index fd23501e97..5069fa4638 100644 --- a/libs/JSystem/src/JKernel/JKRAramPiece.cpp +++ b/libs/JSystem/src/JKernel/JKRAramPiece.cpp @@ -9,7 +9,7 @@ JKRAMCommand* JKRAramPiece::prepareCommand(int direction, uintptr_t src, uintptr_t dst, u32 length, JKRAramBlock* block, JKRAMCommand::AsyncCallback callback) { - JKRAMCommand* command = new (JKRGetSystemHeap(), -4) JKRAMCommand(); + JKRAMCommand* command = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRAMCommand(); command->mTransferDirection = direction; command->mSrc = src; command->mDst = dst; @@ -30,6 +30,7 @@ OSMutex JKRAramPiece::mMutex; JKRAMCommand* JKRAramPiece::orderAsync(int direction, uintptr_t source, uintptr_t destination, u32 length, JKRAramBlock* block, JKRAMCommand::AsyncCallback callback) { lock(); +#if !TARGET_PC if ((source & 0x1f) != 0 || (destination & 0x1f) != 0) { OSReport("direction = %x\n", direction); OSReport("source = %x\n", source); @@ -37,8 +38,9 @@ JKRAMCommand* JKRAramPiece::orderAsync(int direction, uintptr_t source, uintptr_ OSReport("length = %x\n", length); JUTException::panic(__FILE__, 108, "illegal address. abort."); } +#endif - JKRAramCommand* message = new (JKRGetSystemHeap(), -4) JKRAramCommand(); + JKRAramCommand* message = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRAramCommand(); JKRAMCommand* command = JKRAramPiece::prepareCommand(direction, source, destination, length, block, callback); message->setting(1, command); @@ -80,7 +82,7 @@ BOOL JKRAramPiece::orderSync(int direction, uintptr_t source, uintptr_t destinat JKRAMCommand* command = JKRAramPiece::orderAsync(direction, source, destination, length, block, NULL); BOOL result = JKRAramPiece::sync(command, 0); - delete command; + JKR_DELETE(command); unlock(); return result; @@ -132,9 +134,9 @@ JKRAMCommand::JKRAMCommand() : mPieceLink(this), field_0x30(this) { JKRAMCommand::~JKRAMCommand() { if (field_0x8C) - delete field_0x8C; + JKR_DELETE(field_0x8C); if (field_0x90) - delete field_0x90; + JKR_DELETE(field_0x90); if (field_0x94) JKRFree(field_0x94); diff --git a/libs/JSystem/src/JKernel/JKRAramStream.cpp b/libs/JSystem/src/JKernel/JKRAramStream.cpp index 76324f6f14..f4c1f6019a 100644 --- a/libs/JSystem/src/JKernel/JKRAramStream.cpp +++ b/libs/JSystem/src/JKernel/JKRAramStream.cpp @@ -16,7 +16,7 @@ JKRAramStream* JKRAramStream::sAramStreamObject; JKRAramStream* JKRAramStream::create(s32 priority) { if (!sAramStreamObject) { - sAramStreamObject = new (JKRGetSystemHeap(), 0) JKRAramStream(priority); + sAramStreamObject = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRAramStream(priority); JKRResetAramTransferBuffer(); } @@ -141,7 +141,7 @@ JKRHeap* JKRAramStream::transHeap; JKRAramStreamCommand* JKRAramStream::write_StreamToAram_Async(JSUFileInputStream* stream, u32 addr, u32 size, u32 offset, u32* returnSize) { - JKRAramStreamCommand* command = new (JKRGetSystemHeap(), -4) JKRAramStreamCommand(); + JKRAramStreamCommand* command = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRAramStreamCommand(); command->mType = JKRAramStreamCommand::WRITE; command->mAddress = addr; command->mSize = size; diff --git a/libs/JSystem/src/JKernel/JKRArchivePub.cpp b/libs/JSystem/src/JKernel/JKRArchivePub.cpp index ef3b6a950a..731a049457 100644 --- a/libs/JSystem/src/JKernel/JKRArchivePub.cpp +++ b/libs/JSystem/src/JKernel/JKRArchivePub.cpp @@ -45,7 +45,7 @@ JKRArchive* JKRArchive::mount(void* ptr, JKRHeap* heap, int alignment = mountDirection == MOUNT_DIRECTION_HEAD ? 4 : -4; - JKRArchive* newArchive = new (heap, alignment) JKRMemArchive(ptr, 0xFFFF, JKRMEMBREAK_FLAG_UNKNOWN0); + JKRArchive* newArchive = JKR_NEW_ARGS (heap, alignment) JKRMemArchive(ptr, 0xFFFF, JKRMEMBREAK_FLAG_UNKNOWN0); return newArchive; } @@ -60,21 +60,21 @@ JKRArchive* JKRArchive::mount(s32 entryNum, JKRArchive::EMountMode mountMode, JK JKRArchive* newArchive; switch (mountMode) { case JKRArchive::MOUNT_MEM: - newArchive = new (heap, alignment) JKRMemArchive(entryNum, mountDirection); + newArchive = JKR_NEW_ARGS (heap, alignment) JKRMemArchive(entryNum, mountDirection); break; case JKRArchive::MOUNT_ARAM: - newArchive = new (heap, alignment) JKRAramArchive(entryNum, mountDirection); + newArchive = JKR_NEW_ARGS (heap, alignment) JKRAramArchive(entryNum, mountDirection); break; case JKRArchive::MOUNT_DVD: - newArchive = new (heap, alignment) JKRDvdArchive(entryNum, mountDirection); + newArchive = JKR_NEW_ARGS (heap, alignment) JKRDvdArchive(entryNum, mountDirection); break; case JKRArchive::MOUNT_COMP: - newArchive = new (heap, alignment) JKRCompArchive(entryNum, mountDirection); + newArchive = JKR_NEW_ARGS (heap, alignment) JKRCompArchive(entryNum, mountDirection); break; } if (newArchive && newArchive->mMountMode == JKRArchive::UNKNOWN_MOUNT_MODE) { - delete newArchive; + JKR_DELETE(newArchive); newArchive = NULL; } @@ -330,7 +330,7 @@ JKRFileFinder* JKRArchive::getFirstFile(const char* path) const { if (dirEntry) { // don't know what is correct here... for now we're casting away const - return new (JKRGetSystemHeap(), 0) + return JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRArcFinder((JKRArchive*)this, dirEntry->first_file_index, (u32)dirEntry->num_entries); } diff --git a/libs/JSystem/src/JKernel/JKRAssertHeap.cpp b/libs/JSystem/src/JKernel/JKRAssertHeap.cpp index 34e936405e..d72ca62b58 100644 --- a/libs/JSystem/src/JKernel/JKRAssertHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRAssertHeap.cpp @@ -23,7 +23,7 @@ JKRAssertHeap* JKRAssertHeap::create(JKRHeap* parent) { if (!ptr) return NULL; - JKRAssertHeap* heap = new (ptr) JKRAssertHeap(NULL, 0, parent, false); + JKRAssertHeap* heap = JKR_NEW_ARGS (ptr) JKRAssertHeap(NULL, 0, parent, false); return heap; } diff --git a/libs/JSystem/src/JKernel/JKRCompArchive.cpp b/libs/JSystem/src/JKernel/JKRCompArchive.cpp index 56450bcd15..716aaa2838 100644 --- a/libs/JSystem/src/JKernel/JKRCompArchive.cpp +++ b/libs/JSystem/src/JKernel/JKRCompArchive.cpp @@ -54,7 +54,7 @@ JKRCompArchive::~JKRCompArchive() { } if (mDvdFile != NULL) { - delete mDvdFile; + JKR_DELETE(mDvdFile); } sVolumeList.remove(&mFileLoaderLink); @@ -73,7 +73,7 @@ bool JKRCompArchive::open(s32 entryNum) { mFiles = NULL; mStringTable = NULL; - mDvdFile = new (JKRGetSystemHeap(), 0) JKRDvdFile(entryNum); + mDvdFile = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRDvdFile(entryNum); if(mDvdFile == NULL) { mMountMode = 0; return 0; @@ -216,7 +216,7 @@ bool JKRCompArchive::open(s32 entryNum) { if (mMountMode == 0) { OS_REPORT(":::[%s: %d] Cannot alloc memory in mounting CompArchive\n", __FILE__, 567); if(mDvdFile != NULL) { - delete mDvdFile; + JKR_DELETE(mDvdFile); } return false; } diff --git a/libs/JSystem/src/JKernel/JKRDecomp.cpp b/libs/JSystem/src/JKernel/JKRDecomp.cpp index 31509666be..221fe7e70f 100644 --- a/libs/JSystem/src/JKernel/JKRDecomp.cpp +++ b/libs/JSystem/src/JKernel/JKRDecomp.cpp @@ -14,7 +14,7 @@ JKRDecomp* JKRDecomp::sDecompObject; JKRDecomp* JKRDecomp::create(s32 priority) { if (!sDecompObject) { - sDecompObject = new (JKRGetSystemHeap(), 0) JKRDecomp(priority); + sDecompObject = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRDecomp(priority); } return sDecompObject; @@ -62,7 +62,7 @@ void* JKRDecomp::run() { JKRDecompCommand* JKRDecomp::prepareCommand(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 dstLength, JKRDecompCommand::AsyncCallback callback) { - JKRDecompCommand* command = new (JKRGetSystemHeap(), -4) JKRDecompCommand(); + JKRDecompCommand* command = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRDecompCommand(); command->mSrcBuffer = srcBuffer; command->mDstBuffer = dstBuffer; command->mSrcLength = srcLength; @@ -102,7 +102,7 @@ bool JKRDecomp::sync(JKRDecompCommand* command, int isNonBlocking) { bool JKRDecomp::orderSync(u8* srcBuffer, u8* dstBuffer, u32 srcLength, u32 dstLength) { JKRDecompCommand* command = orderAsync(srcBuffer, dstBuffer, srcLength, dstLength, NULL); bool result = sync(command, JKRDECOMP_SYNC_BLOCKING); - delete command; + JKR_DELETE(command); return result; } diff --git a/libs/JSystem/src/JKernel/JKRDvdAramRipper.cpp b/libs/JSystem/src/JKernel/JKRDvdAramRipper.cpp index 6829dcede0..cb969614e0 100644 --- a/libs/JSystem/src/JKernel/JKRDvdAramRipper.cpp +++ b/libs/JSystem/src/JKernel/JKRDvdAramRipper.cpp @@ -38,17 +38,17 @@ JKRAramBlock* JKRDvdAramRipper::loadToAram(JKRDvdFile* dvdFile, u32 address, syncAram(command, 0); if (command->field_0x48 < 0) { - delete command; + JKR_DELETE(command); return NULL; } if (address) { - delete command; + JKR_DELETE(command); return (JKRAramBlock*)-1; } JKRAramBlock* result = command->mBlock; - delete command; + JKR_DELETE(command); return result; } @@ -56,7 +56,7 @@ JKRADCommand* JKRDvdAramRipper::loadToAram_Async(JKRDvdFile* dvdFile, u32 addres JKRExpandSwitch expandSwitch, void (*callback)(u32), u32 param_4, u32 param_5, u32* param_6) { - JKRADCommand* command = new (JKRGetSystemHeap(), -4) JKRADCommand(); + JKRADCommand* command = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JKRADCommand(); command->mDvdFile = dvdFile; command->mAddress = address; command->mBlock = NULL; @@ -68,7 +68,7 @@ JKRADCommand* JKRDvdAramRipper::loadToAram_Async(JKRDvdFile* dvdFile, u32 addres JKRADCommand* cmd2 = callCommand_Async(command); if (!cmd2) { - delete command; + JKR_DELETE(command); return NULL; } @@ -94,7 +94,7 @@ JKRADCommand* JKRDvdAramRipper::callCommand_Async(JKRADCommand* command) { bVar1 = false; } else { dvdFile->field_0x50 = OSGetCurrentThread(); - JSUFileInputStream* stream = new (JKRGetSystemHeap(), -4) JSUFileInputStream(dvdFile); + JSUFileInputStream* stream = JKR_NEW_ARGS (JKRGetSystemHeap(), -4) JSUFileInputStream(dvdFile); dvdFile->mFileStream = stream; u32 fileSize = dvdFile->getFileSize(); if (command->field_0x40 && fileSize > command->field_0x40) { @@ -111,7 +111,7 @@ JKRADCommand* JKRDvdAramRipper::callCommand_Async(JKRADCommand* command) { } if (JKRDvdAramRipper::errorRetry == 0) { - delete stream; + JKR_DELETE(stream); return NULL; } @@ -206,10 +206,10 @@ bool JKRDvdAramRipper::syncAram(JKRADCommand* command, int param_1) { (*((JSUList*)&sDvdAramAsyncList)).remove(&command->mLink); if (command->mStreamCommand) { - delete command->mStreamCommand; + JKR_DELETE(command->mStreamCommand); } - delete dvdFile->mFileStream; + JKR_DELETE(dvdFile->mFileStream); dvdFile->field_0x50 = NULL; OSUnlockMutex(&dvdFile->mMutex2); return true; @@ -222,7 +222,7 @@ JKRADCommand::JKRADCommand() : mLink(this) { JKRADCommand::~JKRADCommand() { if (field_0x4c == 1) { - delete mDvdFile; + JKR_DELETE(mDvdFile); } } diff --git a/libs/JSystem/src/JKernel/JKRDvdArchive.cpp b/libs/JSystem/src/JKernel/JKRDvdArchive.cpp index 67fca69658..b82302c900 100644 --- a/libs/JSystem/src/JKernel/JKRDvdArchive.cpp +++ b/libs/JSystem/src/JKernel/JKRDvdArchive.cpp @@ -46,7 +46,7 @@ JKRDvdArchive::~JKRDvdArchive() { } if (mDvdFile) { - delete mDvdFile; + JKR_DELETE(mDvdFile); } sVolumeList.remove(&mFileLoaderLink); @@ -61,7 +61,7 @@ bool JKRDvdArchive::open(s32 entryNum) { mFiles = NULL; mStringTable = NULL; - mDvdFile = new (JKRGetSystemHeap(), 0) JKRDvdFile(entryNum); + mDvdFile = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRDvdFile(entryNum); if (!mDvdFile) { mMountMode = UNKNOWN_MOUNT_MODE; return false; @@ -137,7 +137,7 @@ cleanup: if (mMountMode == UNKNOWN_MOUNT_MODE) { OS_REPORT(":::Cannot alloc memory [%s][%d]\n", __FILE__, 397); if (mDvdFile) { - delete mDvdFile; + JKR_DELETE(mDvdFile); } return false; } diff --git a/libs/JSystem/src/JKernel/JKRExpHeap.cpp b/libs/JSystem/src/JKernel/JKRExpHeap.cpp index a4f2bbad8c..7774a33959 100644 --- a/libs/JSystem/src/JKernel/JKRExpHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRExpHeap.cpp @@ -30,7 +30,7 @@ JKRExpHeap* JKRExpHeap::createRoot(int maxHeaps, bool errorFlag) { } } #endif - JKRExpHeap* heap2 = new (mem2) JKRExpHeap(local_20, local_24, NULL, errorFlag); + JKRExpHeap* heap2 = JKR_NEW_ARGS (mem2) JKRExpHeap(local_20, local_24, NULL, errorFlag); sRootHeap2 = heap2; heap2->field_0x6e = true; #endif @@ -49,7 +49,7 @@ JKRExpHeap* JKRExpHeap::createRoot(int maxHeaps, bool errorFlag) { } } #endif - heap = new (mem1) JKRExpHeap(start1, alignedSize, NULL, errorFlag); + heap = JKR_NEW_ARGS (mem1) JKRExpHeap(start1, alignedSize, NULL, errorFlag); sRootHeap = heap; } heap->field_0x6e = true; @@ -79,7 +79,7 @@ JKRExpHeap* JKRExpHeap::create(u32 size, JKRHeap* parent, bool errorFlag) { return NULL; } - newHeap = new (memory) JKRExpHeap(dataPtr, alignedSize - expHeapSize, parent, errorFlag); + newHeap = JKR_NEW_ARGS (memory) JKRExpHeap(dataPtr, alignedSize - expHeapSize, parent, errorFlag); if (newHeap == NULL) { JKRFree(memory); @@ -117,7 +117,7 @@ JKRExpHeap* JKRExpHeap::create(void* ptr, u32 size, JKRHeap* parent, bool errorF u8* dataPtr = r28 + expHeapSize; u32 alignedSize = ALIGN_PREV((uintptr_t)ptr + size - (uintptr_t)dataPtr, 0x10); if (r28) { - newHeap = new (r28) JKRExpHeap(dataPtr, alignedSize, parent2, errorFlag); + newHeap = JKR_NEW_ARGS (r28) JKRExpHeap(dataPtr, alignedSize, parent2, errorFlag); } #if DEBUG if (newHeap) { @@ -212,12 +212,17 @@ void* JKRExpHeap::do_alloc(u32 size, int alignment) { } #endif +#if TARGET_PC + JUT_ASSERT_MSG_F(__LINE__, ptr != nullptr, "failed to alloc memory! (0x%x byte).\n", size); +#else if (ptr == NULL) { JUTWarningConsole_f(":::cannot alloc memory (0x%x byte).\n", size); if (getErrorFlag() == true) { callErrorHandler(this, size, alignment); } } +#endif + unlock(); return ptr; @@ -783,9 +788,9 @@ void JKRExpHeap::recycleFreeBlock(JKRExpHeap::CMemBlock* block) { } void JKRExpHeap::joinTwoBlocks(CMemBlock* block) { - u32 endAddr = (uintptr_t)(block + 1) + block->size; + uintptr_t endAddr = (uintptr_t)(block + 1) + block->size; CMemBlock* next = block->mNext; - u32 nextAddr = (uintptr_t)next - (next->mFlags & 0x7f); + uintptr_t nextAddr = (uintptr_t)next - (next->mFlags & 0x7f); if (endAddr > nextAddr) { JUTWarningConsole_f(":::Heap may be broken. (block = %x)", block); OS_REPORT(":::block = %x\n", block); @@ -1005,6 +1010,10 @@ JKRExpHeap::CMemBlock* JKRExpHeap::CMemBlock::allocFore(u32 size1, u8 groupId1, mGroupId = groupId1; mFlags = alignment1; if (size >= size1 + sizeof(CMemBlock)) { +#if TARGET_PC + if ((size - size1) <= sizeof(CMemBlock)) + return NULL; +#endif block = (CMemBlock*)(size1 + (uintptr_t)this); block[1].mGroupId = groupId2; block[1].mFlags = alignment2; diff --git a/libs/JSystem/src/JKernel/JKRFileCache.cpp b/libs/JSystem/src/JKernel/JKRFileCache.cpp index 4579a9ee88..97b0d6fdde 100644 --- a/libs/JSystem/src/JKernel/JKRFileCache.cpp +++ b/libs/JSystem/src/JKernel/JKRFileCache.cpp @@ -33,7 +33,7 @@ JKRFileCache* JKRFileCache::mount(const char* path, JKRHeap* heap, const char* p } - JKRFileCache* fileCache = new (heap, 0) JKRFileCache(path, param_3); + JKRFileCache* fileCache = JKR_NEW_ARGS (heap, 0) JKRFileCache(path, param_3); return fileCache; } @@ -123,7 +123,7 @@ void* JKRFileCache::getResource(const char* path) { if (buffer) { dvdFile.read(buffer, alignedSize, 0); - cacheBlock = new (JKRGetSystemHeap(), 0) + cacheBlock = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) CCacheBlock(dvdFile.getFileID(), dvdFile.getFileInfo()->length, buffer); mCacheBlockList.append(&cacheBlock->mCacheBlockLink); } @@ -202,7 +202,7 @@ void JKRFileCache::removeResourceAll(void) { while (iterator != mCacheBlockList.getEnd()) { JKRFreeToHeap(mParentHeap, iterator->mMemoryPtr); mCacheBlockList.remove(&iterator.getObject()->mCacheBlockLink); - delete (iterator++).getObject(); + JKR_DELETE((iterator++).getObject()); } } @@ -216,7 +216,7 @@ bool JKRFileCache::removeResource(void* resource) { if (--cacheBlock->mReferenceCount == 0) { JKRFreeToHeap(mParentHeap, resource); mCacheBlockList.remove(&cacheBlock->mCacheBlockLink); - delete cacheBlock; + JKR_DELETE(cacheBlock); } return true; @@ -230,7 +230,7 @@ bool JKRFileCache::detachResource(void* resource) { return false; mCacheBlockList.remove(&cacheBlock->mCacheBlockLink); - delete cacheBlock; + JKR_DELETE(cacheBlock); return true; } @@ -262,11 +262,11 @@ u32 JKRFileCache::countFile(const char* path) const { JKRFileFinder* JKRFileCache::getFirstFile(const char* path) const { char* name = getDvdPathName(path); - JKRDvdFinder* finder = new (JKRGetSystemHeap(), 0) JKRDvdFinder(name); + JKRDvdFinder* finder = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JKRDvdFinder(name); JKRFreeToSysHeap(name); if (finder->isAvailable() != true) { - delete finder; + JKR_DELETE(finder); return NULL; } diff --git a/libs/JSystem/src/JKernel/JKRFileLoader.cpp b/libs/JSystem/src/JKernel/JKRFileLoader.cpp index 6bb460e93a..e0e531aaa9 100644 --- a/libs/JSystem/src/JKernel/JKRFileLoader.cpp +++ b/libs/JSystem/src/JKernel/JKRFileLoader.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include "JSystem/JKernel/JKRHeap.h" #include "global.h" JKRFileLoader* JKRFileLoader::sCurrentVolume; @@ -23,7 +25,7 @@ JKRFileLoader::~JKRFileLoader() { void JKRFileLoader::unmount(void) { if (mMountCount != 0) { if (--mMountCount == 0) { - delete this; + JKR_DELETE(this); } } } diff --git a/libs/JSystem/src/JKernel/JKRHeap.cpp b/libs/JSystem/src/JKernel/JKRHeap.cpp index 87473072c4..e5767d6ebb 100644 --- a/libs/JSystem/src/JKernel/JKRHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRHeap.cpp @@ -11,6 +11,8 @@ #include #endif +#include + #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTException.h" #ifdef __MWERKS__ @@ -515,19 +517,54 @@ bool JKRHeap::isSubHeap(JKRHeap* heap) const { return false; } +#if TARGET_PC +[[nodiscard]] +static void* fallback_alloc(size_t size, size_t align, bool log=true) { + if (log) { + auto curHeap = JKRHeap::getCurrentHeap(); + const char* name = ""; + if (curHeap != nullptr) { + name = curHeap->getName(); + } + + OSReport( + "[NEW] JKRHeap (%s) FULL! Fallback to malloc for size %u\n", + name, (unsigned)size); + } + + if (align == 0) { + align = alignof(max_align_t); + } + + assert((align & (align - 1)) == 0 && "Alignment must be a power of two"); + +#if _WIN32 + // aligned_alloc() is not available on Windows. + // NOTE: We always use _aligned_malloc(), even for allocs <= max_align_t, + // because otherwise we can't tell in operator delete() whether a pointer needs to be freed with + // _aligned_free() or regular free(). + return _aligned_malloc(size, align); +#else + // aligned_alloc() requires size be a multiple of align. So ensure it is. + size = ALIGN_NEXT(size, align); + return aligned_alloc(align, size); +#endif + +} +#endif + #if !TARGET_PC void* operator new(size_t size) { return JKRHeap::alloc(size, 4, NULL); } #else -void* operator new(size_t size) { +void* operator new(size_t size JKR_HEAP_TOKEN_PARAM) { if (sCurrentHeap == NULL) { - return malloc(size); + return fallback_alloc(size, 0, false); } void* mem = JKRHeap::alloc(size, alignof(max_align_t), NULL); - if (mem == NULL) { - OSReport("[NEW] JKRHeap FULL! Fallback to malloc for size %u\n", (unsigned)size); - mem = malloc(size); + if (mem == nullptr) { + return fallback_alloc(size, 0, true); } return mem; } @@ -538,27 +575,16 @@ void* operator new(size_t size, int alignment) { return JKRHeap::alloc(size, alignment, NULL); } #else -void* operator new(size_t size, int alignment) { - if (sCurrentHeap == nullptr) -#if !_WIN32 - return aligned_alloc(alignment, size); -#else - return _aligned_malloc(size, alignment); -#endif +void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment) { void* mem = JKRHeap::alloc(size, alignment, nullptr); if (mem == nullptr) { - OSReport("[NEW] JKRHeap FULL! Fallback to aligned_malloc size %u\n", (unsigned)size); -#if !_WIN32 - return aligned_alloc(alignment, size); -#else - return _aligned_malloc(size, alignment); -#endif + return fallback_alloc(size, abs(alignment), true); } return mem; } #endif -void* operator new(size_t size, JKRHeap* heap, int alignment) { +void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) { return JKRHeap::alloc(size, alignment, heap); } @@ -568,11 +594,17 @@ void* operator new[](size_t size) { } #else void* operator new[](size_t size) { - if (sCurrentHeap == NULL) - return malloc(size); + return fallback_alloc(size, 0, false); +} + +void* operator new[](std::size_t size, const std::nothrow_t&) noexcept { + return fallback_alloc(size, 0, false); +} + +void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM) { void* mem = JKRHeap::alloc(size, alignof(max_align_t), NULL); if (mem == NULL) { - mem = malloc(size); + return fallback_alloc(size, 0, true); } return mem; } @@ -583,25 +615,16 @@ void* operator new[](size_t size, int alignment) { return JKRHeap::alloc(size, alignment, NULL); } #else -void* operator new[](size_t size, int alignment) { - if (sCurrentHeap == nullptr) -#if !_WIN32 - return aligned_alloc(alignment, size); -#else - return _aligned_malloc(size, alignment); -#endif +void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, int alignment) { void* mem = JKRHeap::alloc(size, alignment, nullptr); - if (mem == nullptr) -#if !_WIN32 - return aligned_alloc(alignment, size); -#else - return _aligned_malloc(size, alignment); -#endif + if (mem == nullptr) { + return fallback_alloc(size, 0, true); + } return mem; } #endif -void* operator new[](size_t size, JKRHeap* heap, int alignment) { +void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) { return JKRHeap::alloc(size, alignment, heap); } @@ -610,15 +633,19 @@ void operator delete(void* ptr) { JKRHeap::free(ptr, NULL); } #else -void operator delete(void* ptr) { +void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM) { if (ptr == NULL) return; JKRHeap* heap = JKRHeap::findFromRoot(ptr); if (heap == NULL) { +#if !_WIN32 free(ptr); +#else + _aligned_free(ptr); +#endif return; } - JKRHeap::free(ptr, NULL); + JKRHeap::free(ptr, heap); } #endif @@ -632,10 +659,14 @@ void operator delete[](void* ptr) { return; JKRHeap* heap = JKRHeap::findFromRoot(ptr); if (heap == NULL) { +#if !_WIN32 free(ptr); +#else + _aligned_free(ptr); +#endif return; } - JKRHeap::free(ptr, NULL); + JKRHeap::free(ptr, heap); } #endif @@ -681,7 +712,8 @@ JKRHeap* JKRHeap::getCurrentHeap() { void JKRHeap::setName(const char* name) { size_t len = strlen(name); - memcpy(mName, name, std::max(len, sizeof(mName)-1)); + strncpy(mName, name, sizeof(mName) - 1); + mName[sizeof(mName) - 1] = '\0'; } const char* JKRHeap::getName() const { return mName; diff --git a/libs/JSystem/src/JKernel/JKRSolidHeap.cpp b/libs/JSystem/src/JKernel/JKRSolidHeap.cpp index a12cb8835a..ab2c301db0 100644 --- a/libs/JSystem/src/JKernel/JKRSolidHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRSolidHeap.cpp @@ -27,7 +27,7 @@ JKRSolidHeap* JKRSolidHeap::create(u32 size, JKRHeap* heap, bool useErrorHandler if (!mem) return NULL; - return new (mem) JKRSolidHeap(dataPtr, alignedSize - solidHeapSize, heap, useErrorHandler); + return JKR_NEW_ARGS (mem) JKRSolidHeap(dataPtr, alignedSize - solidHeapSize, heap, useErrorHandler); } void JKRSolidHeap::do_destroy(void) { diff --git a/libs/JSystem/src/JKernel/JKRThread.cpp b/libs/JSystem/src/JKernel/JKRThread.cpp index cb5055012a..96dfd53499 100644 --- a/libs/JSystem/src/JKernel/JKRThread.cpp +++ b/libs/JSystem/src/JKernel/JKRThread.cpp @@ -127,7 +127,7 @@ JKRThreadSwitch* JKRThreadSwitch::createManager(JKRHeap* heap) { heap = JKRGetCurrentHeap(); } - sManager = new (heap, 0) JKRThreadSwitch(heap); + sManager = JKR_NEW_ARGS (heap, 0) JKRThreadSwitch(heap); return sManager; } @@ -282,7 +282,7 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console static void dummy4(JKRTask* thread, JSULink* link) { thread->getStack(); - delete link; + JKR_DELETE(link); } JKRTask::~JKRTask() { @@ -322,7 +322,7 @@ int JKRTask::check() { #if !PLATFORM_GCN static void dummy(JKRIdleThread* thread) { thread->run(); - delete thread; + JKR_DELETE(thread); thread->destroy(); } #endif diff --git a/libs/JSystem/src/JMessage/data.cpp b/libs/JSystem/src/JMessage/data.cpp index 4750591a72..29c96c18c7 100644 --- a/libs/JSystem/src/JMessage/data.cpp +++ b/libs/JSystem/src/JMessage/data.cpp @@ -2,6 +2,6 @@ #include "JSystem/JMessage/data.h" -const u32 JMessage::data::ga4cSignature = 'MESG'; +const BE(u32) JMessage::data::ga4cSignature = 'MESG'; -const u32 JMessage::data::ga4cSignature_color = 'MGCL'; +const BE(u32) JMessage::data::ga4cSignature_color = 'MGCL'; diff --git a/libs/JSystem/src/JMessage/resource.cpp b/libs/JSystem/src/JMessage/resource.cpp index 5bda061497..38c2e99972 100644 --- a/libs/JSystem/src/JMessage/resource.cpp +++ b/libs/JSystem/src/JMessage/resource.cpp @@ -6,6 +6,8 @@ #include #include +#include "JSystem/JKernel/JKRHeap.h" + u16 JMessage::TResource::toMessageIndex_messageID(u32 uMsgID, u32 upperHalf, bool* pbValid) const { if (!oParse_TBlock_messageID_.getRaw()) { return 0xFFFF; @@ -63,7 +65,7 @@ u16 JMessage::TResource::toMessageIndex_messageID(u32 uMsgID, u32 upperHalf, boo int nMsgNumber = oParse_TBlock_messageID_.get_number(); - const u32* pContent = oParse_TBlock_messageID_.getContent(); + const u32* pContent = (u32*)oParse_TBlock_messageID_.getContent(); JUT_ASSERT(131, pContent!=NULL); const u32* pFirst = pContent; @@ -112,12 +114,12 @@ JMessage::TResource* JMessage::TResourceContainer::TCResource::Get_groupID(u16 u } JMessage::TResource* JMessage::TResourceContainer::TCResource::Do_create() { - return new TResource(); + return JKR_NEW TResource(); } void JMessage::TResourceContainer::TCResource::Do_destroy(JMessage::TResource* pResource) { #if DEBUG - delete pResource; + JKR_DELETE(pResource); #else operator delete(pResource); #endif @@ -166,7 +168,7 @@ bool JMessage::TParse::parseHeader_next(const void** ppData_inout, u32* puBlock_ JUT_ASSERT(350, pContainer_!=NULL); - if (memcmp(oHeader.get_signature(), &data::ga4cSignature, sizeof(data::ga4cSignature)) != 0) { + if (memcmp((u32*)oHeader.get_signature(), &data::ga4cSignature, sizeof(data::ga4cSignature)) != 0) { JGADGET_WARNMSG(355, "unknown signature"); return false; } diff --git a/libs/JSystem/src/JParticle/JPAEmitterManager.cpp b/libs/JSystem/src/JParticle/JPAEmitterManager.cpp index bd24df12d3..900b701bcd 100644 --- a/libs/JSystem/src/JParticle/JPAEmitterManager.cpp +++ b/libs/JSystem/src/JParticle/JPAEmitterManager.cpp @@ -17,25 +17,25 @@ JPAEmitterManager::JPAEmitterManager(u32 i_ptclNum, u32 i_emtrNum, JKRHeap* pHea JUT_ASSERT(40, emtrNum && ptclNum && gidMax && ridMax); - JPABaseEmitter* p_emtr_link = new (pHeap, 0) JPABaseEmitter[emtrNum]; + JPABaseEmitter* p_emtr_link = JKR_NEW_ARGS (pHeap, 0) JPABaseEmitter[emtrNum]; JUT_ASSERT(44, p_emtr_link); for (u32 i = 0; i < emtrNum; i++) mFreeEmtrList.prepend(&p_emtr_link[i].mLink); - JPANode* p_ptcl_node = new (pHeap, 0) JPANode[ptclNum]; + JPANode* p_ptcl_node = JKR_NEW_ARGS (pHeap, 0) JPANode[ptclNum]; JUT_ASSERT(51, p_ptcl_node); for (u32 i = 0; i < ptclNum; i++) mPtclPool.push_back(&p_ptcl_node[i]); - pEmtrUseList = new (pHeap, 0) JSUList[gidMax]; + pEmtrUseList = JKR_NEW_ARGS (pHeap, 0) JSUList[gidMax]; JUT_ASSERT(58, pEmtrUseList); - pResMgrAry = new (pHeap, 0) JPAResourceManager*[ridMax]; + pResMgrAry = JKR_NEW_ARGS (pHeap, 0) JPAResourceManager*[ridMax]; JUT_ASSERT(62, pResMgrAry) for (int i = 0; i < ridMax; i++) { pResMgrAry[i] = NULL; } - pWd = new (pHeap, 0) JPAEmitterWorkData(); + pWd = JKR_NEW_ARGS (pHeap, 0) JPAEmitterWorkData(); JUT_ASSERT(67, pWd); } diff --git a/libs/JSystem/src/JParticle/JPAFieldBlock.cpp b/libs/JSystem/src/JParticle/JPAFieldBlock.cpp index 87f89bc32f..79e148393e 100644 --- a/libs/JSystem/src/JParticle/JPAFieldBlock.cpp +++ b/libs/JSystem/src/JParticle/JPAFieldBlock.cpp @@ -224,31 +224,31 @@ void JPAFieldBlock::init(JKRHeap* heap) { switch (getType()) { case FIELD_GRAVITY: - pFld = new (heap, 0) JPAFieldGravity(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldGravity(); break; case FIELD_AIR: - pFld = new (heap, 0) JPAFieldAir(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldAir(); break; case FIELD_MAGNET: - pFld = new (heap, 0) JPAFieldMagnet(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldMagnet(); break; case FIELD_NEWTON: - pFld = new (heap, 0) JPAFieldNewton(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldNewton(); break; case FIELD_VORTEX: - pFld = new (heap, 0) JPAFieldVortex(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldVortex(); break; case FIELD_RANDOM: - pFld = new (heap, 0) JPAFieldRandom(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldRandom(); break; case FIELD_DRAG: - pFld = new (heap, 0) JPAFieldDrag(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldDrag(); break; case FIELD_CONVECTION: - pFld = new (heap, 0) JPAFieldConvection(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldConvection(); break; case FIELD_SPIN: - pFld = new (heap, 0) JPAFieldSpin(); + pFld = JKR_NEW_ARGS (heap, 0) JPAFieldSpin(); break; default: pFld = NULL; diff --git a/libs/JSystem/src/JParticle/JPAResourceLoader.cpp b/libs/JSystem/src/JParticle/JPAResourceLoader.cpp index bb772448cc..47fc6706e3 100644 --- a/libs/JSystem/src/JParticle/JPAResourceLoader.cpp +++ b/libs/JSystem/src/JParticle/JPAResourceLoader.cpp @@ -54,22 +54,22 @@ void JPAResourceLoader::load_jpc(u8 const* data, JPAResourceManager* p_res_mgr) JKRHeap* heap = p_res_mgr->mpHeap; p_res_mgr->resMaxNum = *(BE(u16)*)(data + 8); p_res_mgr->texMaxNum = *(BE(u16)*)(data + 0xA); - p_res_mgr->pResAry = new (heap, 0) JPAResource*[p_res_mgr->resMaxNum]; - p_res_mgr->pTexAry = new (heap, 0) JPATexture*[p_res_mgr->texMaxNum]; + p_res_mgr->pResAry = JKR_NEW_ARGS (heap, 0) JPAResource*[p_res_mgr->resMaxNum]; + p_res_mgr->pTexAry = JKR_NEW_ARGS (heap, 0) JPATexture*[p_res_mgr->texMaxNum]; JUT_ASSERT(199, (p_res_mgr->pResAry != NULL) && (p_res_mgr->pTexAry != 0)); u32 offset = 0x10; for (int i = 0; i < *(BE(u16)*)(data + 8); i++) { JPAResourceHeader* header = (JPAResourceHeader*)(data + offset); - JPAResource* p_res = new (heap, 0) JPAResource(); + JPAResource* p_res = JKR_NEW_ARGS (heap, 0) JPAResource(); JUT_ASSERT(211, p_res != NULL); p_res->fldNum = header->mFieldBlockNum; p_res->ppFld = p_res->fldNum != 0 ? - new (heap, 0) JPAFieldBlock*[p_res->fldNum] : NULL; + JKR_NEW_ARGS (heap, 0) JPAFieldBlock*[p_res->fldNum] : NULL; JUT_ASSERT(216, (p_res->ppFld != NULL) || (p_res->fldNum == 0)); p_res->keyNum = header->mKeyBlockNum; p_res->ppKey = p_res->keyNum != 0 ? - new (heap, 0) JPAKeyBlock*[p_res->keyNum] : NULL; + JKR_NEW_ARGS (heap, 0) JPAKeyBlock*[p_res->keyNum] : NULL; JUT_ASSERT(221, (p_res->ppKey != NULL) || (p_res->keyNum == 0)); p_res->texNum = header->mTDB1Num; p_res->mpTDB1 = NULL; @@ -84,33 +84,33 @@ void JPAResourceLoader::load_jpc(u8 const* data, JPAResourceManager* p_res_mgr) u32 size = *(BE(u32)*)(data + offset + 4); switch (magic) { case 'FLD1': - p_res->ppFld[fld_no] = new (heap, 0) JPAFieldBlock(data + offset, heap); + p_res->ppFld[fld_no] = JKR_NEW_ARGS (heap, 0) JPAFieldBlock(data + offset, heap); JUT_ASSERT(244, p_res->ppFld[fld_no] != NULL); fld_no++; break; case 'KFA1': - p_res->ppKey[key_no] = new (heap, 0) JPAKeyBlock(data + offset); + p_res->ppKey[key_no] = JKR_NEW_ARGS (heap, 0) JPAKeyBlock(data + offset); JUT_ASSERT(249, p_res->ppKey[key_no] != NULL); key_no++; break; case 'BEM1': - p_res->pDyn = new (heap, 0) JPADynamicsBlock(data + offset); + p_res->pDyn = JKR_NEW_ARGS (heap, 0) JPADynamicsBlock(data + offset); JUT_ASSERT(254, p_res->pDyn != NULL); break; case 'BSP1': - p_res->pBsp = new (heap, 0) JPABaseShape(data + offset, heap); + p_res->pBsp = JKR_NEW_ARGS (heap, 0) JPABaseShape(data + offset, heap); JUT_ASSERT(258, p_res->pBsp != NULL); break; case 'ESP1': - p_res->pEsp = new (heap, 0) JPAExtraShape(data + offset); + p_res->pEsp = JKR_NEW_ARGS (heap, 0) JPAExtraShape(data + offset); JUT_ASSERT(262, p_res->pEsp != NULL); break; case 'SSP1': - p_res->pCsp = new (heap, 0) JPAChildShape(data + offset); + p_res->pCsp = JKR_NEW_ARGS (heap, 0) JPAChildShape(data + offset); JUT_ASSERT(266, p_res->pCsp != NULL); break; case 'ETX1': - p_res->pEts = new (heap, 0) JPAExTexShape(data + offset); + p_res->pEts = JKR_NEW_ARGS (heap, 0) JPAExTexShape(data + offset); JUT_ASSERT(270, p_res->pEts != NULL); break; case 'TDB1': @@ -130,7 +130,7 @@ void JPAResourceLoader::load_jpc(u8 const* data, JPAResourceManager* p_res_mgr) offset = *(BE(u32)*)(data + 0xC); for (int i = 0; i < *(BE(u16)*)(data + 0xA); i++) { u32 size = *(BE(u32)*)(data + offset + 4); - JPATexture* p_tex = new (heap, 0) JPATexture(data + offset); + JPATexture* p_tex = JKR_NEW_ARGS (heap, 0) JPATexture(data + offset); JUT_ASSERT(298, p_tex != NULL); p_res_mgr->registTex(p_tex); offset += size; diff --git a/libs/JSystem/src/JStage/JSGAmbientLight.cpp b/libs/JSystem/src/JStage/JSGAmbientLight.cpp index b886209bd1..f74e40c529 100644 --- a/libs/JSystem/src/JStage/JSGAmbientLight.cpp +++ b/libs/JSystem/src/JStage/JSGAmbientLight.cpp @@ -2,6 +2,8 @@ #include "JSystem/JStage/JSGAmbientLight.h" +#include "global.h" + JStage::TAmbientLight::~TAmbientLight() {} s32 JStage::TAmbientLight::JSGFGetType() const { diff --git a/libs/JSystem/src/JStage/JSGFog.cpp b/libs/JSystem/src/JStage/JSGFog.cpp index 213fa0dd37..ebdc95825d 100644 --- a/libs/JSystem/src/JStage/JSGFog.cpp +++ b/libs/JSystem/src/JStage/JSGFog.cpp @@ -3,6 +3,8 @@ #include "JSystem/JStage/JSGFog.h" #include +#include "global.h" + JStage::TFog::~TFog() {} s32 JStage::TFog::JSGFGetType() const { diff --git a/libs/JSystem/src/JStage/JSGLight.cpp b/libs/JSystem/src/JStage/JSGLight.cpp index af9c1e11ee..63bf0cf687 100644 --- a/libs/JSystem/src/JStage/JSGLight.cpp +++ b/libs/JSystem/src/JStage/JSGLight.cpp @@ -2,6 +2,8 @@ #include "JSystem/JStage/JSGLight.h" +#include "global.h" + JStage::TLight::~TLight() {} s32 JStage::TLight::JSGFGetType() const { diff --git a/libs/JSystem/src/JStudio/JStudio/ctb.cpp b/libs/JSystem/src/JStudio/JStudio/ctb.cpp index ac8dda9ebb..61046ad35c 100644 --- a/libs/JSystem/src/JStudio/JStudio/ctb.cpp +++ b/libs/JSystem/src/JStudio/JStudio/ctb.cpp @@ -5,6 +5,8 @@ #include #include +#include "JSystem/JKernel/JKRHeap.h" + JStudio::ctb::TObject::~TObject() {} JStudio::ctb::TObject_TxyzRy::TObject_TxyzRy(JStudio::ctb::data::TParse_TBlock const& param_0) @@ -68,14 +70,14 @@ JStudio::ctb::TFactory::~TFactory() {} JStudio::ctb::TObject* JStudio::ctb::TFactory::create(JStudio::ctb::data::TParse_TBlock const& param_0) { switch(param_0.get_scheme()) { case 1: - return new TObject_TxyzRy(param_0); + return JKR_NEW TObject_TxyzRy(param_0); default: return NULL; } } void JStudio::ctb::TFactory::destroy(JStudio::ctb::TObject* param_0) { - delete param_0; + JKR_DELETE(param_0); } // NONMATCHING TParse_header_block vtable location diff --git a/libs/JSystem/src/JStudio/JStudio/fvb.cpp b/libs/JSystem/src/JStudio/JStudio/fvb.cpp index 8aedc819ba..3100901ff1 100644 --- a/libs/JSystem/src/JStudio/JStudio/fvb.cpp +++ b/libs/JSystem/src/JStudio/JStudio/fvb.cpp @@ -4,6 +4,18 @@ #include "JSystem/JUtility/JUTException.h" #include +#if TARGET_PC +namespace { +void endianSwapListData(const f32* data, u32 count) { + // const hack to swap endianness + f32* nonConstData = const_cast(data); + for (int i = 0; i < count; i++) { + be_swap(nonConstData[i]); + } +} +} +#endif + namespace JStudio { namespace fvb { @@ -26,6 +38,7 @@ void TObject::prepare(data::TParse_TBlock const& rBlock, TControl* pControl) { const void* pContent = dat.pContent; switch (u32Type) { case 0: + pData = dat.next; goto end; case 1: prepare_data_(dat, pControl); @@ -41,10 +54,10 @@ void TObject::prepare(data::TParse_TBlock const& rBlock, TControl* pControl) { } JGadget::TVector_pointer& rCnt = pfvaRefer->refer_referContainer(); u8* content = (u8*)pContent; - u32 i = *(u32*)content; + u32 i = *(BE(u32)*)content; u8* ptr = content + 4; for (; i != 0; i--) { - u32 size = *(u32*)ptr; + u32 size = *(BE(u32)*)ptr; TObject* pObject = pControl->getObject(ptr + 4, size); if (pObject != NULL) { TFunctionValue* const rfv = pObject->referFunctionValue(); @@ -68,9 +81,9 @@ void TObject::prepare(data::TParse_TBlock const& rBlock, TControl* pControl) { JGadget::TVector_pointer& rCnt = pfvaRefer->refer_referContainer(); u8* ptr = (u8*)pContent; - u32 i = *(u32*)ptr; + u32 i = *(BE(u32)*)ptr; for (; ptr += 4, i != 0; i--) { - u32 index = *(u32*)ptr; + u32 index = *(BE(u32)*)ptr; TObject* pObject = pControl->getObject_index(index); if (pObject != NULL) { TFunctionValue* const rfv = pObject->referFunctionValue(); @@ -90,7 +103,7 @@ void TObject::prepare(data::TParse_TBlock const& rBlock, TControl* pControl) { JGADGET_WARNMSG(127, "invalid paragraph"); break; } - f32* arr = (f32*)pContent; + BE(f32)* arr = (BE(f32)*)pContent; pfvaRange->range_set(arr[0], arr[1]); } break; case 0x13: { @@ -103,7 +116,7 @@ void TObject::prepare(data::TParse_TBlock const& rBlock, TControl* pControl) { break; } - TFunctionValue::TEProgress prog = *(TFunctionValue::TEProgress*)pContent; + TFunctionValue::TEProgress prog = (TFunctionValue::TEProgress)BSWAP32(*(TFunctionValue::TEProgress*)pContent); pfvaRange->range_setProgress(prog); } break; case 0x14: { @@ -116,7 +129,7 @@ void TObject::prepare(data::TParse_TBlock const& rBlock, TControl* pControl) { break; } - TFunctionValue::TEAdjust adjust = *(TFunctionValue::TEAdjust*)pContent; + TFunctionValue::TEAdjust adjust = (TFunctionValue::TEAdjust)BSWAP32(*(TFunctionValue::TEAdjust*)pContent); pfvaRange->range_setAdjust(adjust); } break; case 0x15: { @@ -129,9 +142,9 @@ void TObject::prepare(data::TParse_TBlock const& rBlock, TControl* pControl) { break; } - u16* out = (u16*)pContent; - pfvaRange->range_setOutside((TFunctionValue::TEOutside)out[0], - (TFunctionValue::TEOutside)out[1]); + BE(u16)* out = (BE(u16)*)pContent; + pfvaRange->range_setOutside((TFunctionValue::TEOutside)(u16)out[0], + (TFunctionValue::TEOutside)(u16)out[1]); } break; case 0x16: { JGADGET_ASSERTWARN(193, u32Size==4); @@ -143,7 +156,7 @@ void TObject::prepare(data::TParse_TBlock const& rBlock, TControl* pControl) { break; } - TFunctionValue::TEInterpolate interp = *(TFunctionValue::TEInterpolate*)pContent; + TFunctionValue::TEInterpolate interp = (TFunctionValue::TEInterpolate)BSWAP32(*(TFunctionValue::TEInterpolate*)pContent); pfvaInterpolate->interpolate_set(interp); } break; default: @@ -164,27 +177,27 @@ TFunctionValue_composite::TData getCompositeData_raw_(const void* arg1) { } TFunctionValue_composite::TData getCompositeData_index_(const void* arg1) { - return TFunctionValue_composite::TData(*(u32*)arg1); + return TFunctionValue_composite::TData(*(BE(u32)*)arg1); } TFunctionValue_composite::TData getCompositeData_parameter_(const void* arg1) { - return TFunctionValue_composite::TData(*(f32*)arg1); + return TFunctionValue_composite::TData(*(BE(f32)*)arg1); } TFunctionValue_composite::TData getCompositeData_add_(const void* arg1) { - return TFunctionValue_composite::TData(*(f32*)arg1); + return TFunctionValue_composite::TData(*(BE(f32)*)arg1); } TFunctionValue_composite::TData getCompositeData_subtract_(const void* arg1) { - return TFunctionValue_composite::TData(*(f32*)arg1); + return TFunctionValue_composite::TData(*(BE(f32)*)arg1); } TFunctionValue_composite::TData getCompositeData_multiply_(const void* arg1) { - return TFunctionValue_composite::TData(*(f32*)arg1); + return TFunctionValue_composite::TData(*(BE(f32)*)arg1); } TFunctionValue_composite::TData getCompositeData_divide_(const void* arg1) { - return TFunctionValue_composite::TData(*(f32*)arg1); + return TFunctionValue_composite::TData(*(BE(f32)*)arg1); } const data::CompositeOperation saCompositeOperation_[8] = { @@ -219,7 +232,7 @@ void TObject_composite::prepare_data_(const data::TParse_TParagraph::TData& rDat JGADGET_ASSERTWARN(310, u32Size== 8); JUT_ASSERT(311, pContent!=NULL); - data::TEComposite type = pContent->composite_type; + data::TEComposite type = (data::TEComposite)BSWAP32(pContent->composite_type); const data::CompositeOperation* op = getCompositeOperation_(type); data::CompositeDataFunc pfn = op->getCompositeData; JUT_ASSERT(316, pfn!=NULL); @@ -234,7 +247,7 @@ void TObject_constant::prepare_data_(const data::TParse_TParagraph::TData& rData JUT_ASSERT(337, rData.u32Type==data::PARAGRAPH_DATA); u32 u32Size = rData.u32Size; - const f32* pContent = static_cast(rData.pContent); + const BE(f32)* pContent = static_cast(rData.pContent); JGADGET_ASSERTWARN(341, u32Size==4); JUT_ASSERT(342, pContent!=NULL); f32 val = pContent[0]; @@ -251,7 +264,7 @@ void TObject_transition::prepare_data_(const data::TParse_TParagraph::TData& rDa u32 u32Size = rData.u32Size; JGADGET_ASSERTWARN(0, u32Size == 8); - const f32* pContent = static_cast(rData.pContent); + const BE(f32)* pContent = static_cast(rData.pContent); ASSERT(pContent != NULL); fnValue.data_set(pContent[0], pContent[1]); @@ -268,6 +281,10 @@ void TObject_list::prepare_data_(const data::TParse_TParagraph::TData& rData, TC const ListData* pContent = static_cast(rData.pContent); ASSERT(pContent != NULL); +#if TARGET_PC + endianSwapListData(pContent->_8, pContent->_4); +#endif + fnValue.data_setInterval(pContent->_0); fnValue.data_set(pContent->_8, pContent->_4); } @@ -285,6 +302,9 @@ void TObject_list_parameter::prepare_data_(const data::TParse_TParagraph::TData& const ListData* pContent = static_cast(rData.pContent); ASSERT(pContent != NULL); +#if TARGET_PC + endianSwapListData(pContent->_4, pContent->_0 * 2); +#endif fnValue.data_set(pContent->_4, pContent->_0); } @@ -300,7 +320,14 @@ void TObject_hermite::prepare_data_(const data::TParse_TParagraph::TData& rData, const ListData* pContent = static_cast(rData.pContent); ASSERT(pContent != NULL); +#if TARGET_PC + u32 u = BE::swap(pContent->_0 & 0xFFFFFFF); + u32 uSize = BE::swap(pContent->_0 >> 0x1C); + endianSwapListData(pContent->_4, u * uSize); + fnValue.data_set(pContent->_4, u, uSize); +#else fnValue.data_set(pContent->_4, pContent->_0 & 0xFFFFFFF, pContent->_0 >> 0x1C); +#endif } TControl::TControl() : pFactory(NULL) {} @@ -351,17 +378,17 @@ TFactory::~TFactory() {} TObject* TFactory::create(data::TParse_TBlock const& rBlock) { switch (rBlock.get_type()) { case 1: - return new TObject_composite(rBlock); + return JKR_NEW TObject_composite(rBlock); case 2: - return new TObject_constant(rBlock); + return JKR_NEW TObject_constant(rBlock); case 3: - return new TObject_transition(rBlock); + return JKR_NEW TObject_transition(rBlock); case 4: - return new TObject_list(rBlock); + return JKR_NEW TObject_list(rBlock); case 5: - return new TObject_list_parameter(rBlock); + return JKR_NEW TObject_list_parameter(rBlock); case 6: - return new TObject_hermite(rBlock); + return JKR_NEW TObject_hermite(rBlock); default: JUTWarn w; w << "unknown type : "; @@ -370,7 +397,7 @@ TObject* TFactory::create(data::TParse_TBlock const& rBlock) { } void TFactory::destroy(TObject* pObject) { - delete pObject; + JKR_DELETE(pObject); } TParse::TParse(TControl* pControl) : pControl_(pControl) { diff --git a/libs/JSystem/src/JStudio/JStudio/jstudio-object.cpp b/libs/JSystem/src/JStudio/JStudio/jstudio-object.cpp index 8e23477cc8..ebf7ab364e 100644 --- a/libs/JSystem/src/JStudio/JStudio/jstudio-object.cpp +++ b/libs/JSystem/src/JStudio/JStudio/jstudio-object.cpp @@ -246,14 +246,14 @@ void JStudio::TAdaptor::adaptor_setVariableValue_IMMEDIATE_(JStudio::TAdaptor* p JStudio::TControl* param_2, u32 param_3, void const* param_4, u32 param_5) { TVariableValue* value = ¶m_1->pValue_[param_3]; - value->setValue_immediate(*(f32*)param_4); + value->setValue_immediate(*(BE(f32)*)param_4); } void JStudio::TAdaptor::adaptor_setVariableValue_TIME_(JStudio::TAdaptor* param_1, JStudio::TControl* param_2, u32 param_3, void const* param_4, u32 param_5) { TVariableValue* value = ¶m_1->pValue_[param_3]; - value->setValue_time(*(f32*)param_4); + value->setValue_time(*(BE(f32)*)param_4); } void JStudio::TAdaptor::adaptor_setVariableValue_FVR_NAME_(JStudio::TAdaptor* param_1, @@ -267,11 +267,11 @@ void JStudio::TAdaptor::adaptor_setVariableValue_FVR_INDEX_(JStudio::TAdaptor* p JStudio::TControl* param_2, u32 param_3, void const* param_4, u32 param_5) { TVariableValue* value = ¶m_1->pValue_[param_3]; - value->setValue_functionValue(param_2->getFunctionValue_index(*(u32*)param_4)); + value->setValue_functionValue(param_2->getFunctionValue_index(*(BE(u32)*)param_4)); } JStudio::TObject::~TObject() { - delete mpAdaptor; + JKR_DELETE(mpAdaptor); } void JStudio::TObject::forward_value(u32 param_0) { diff --git a/libs/JSystem/src/JStudio/JStudio/stb-data.cpp b/libs/JSystem/src/JStudio/JStudio/stb-data.cpp index f7164b6902..79df1744d9 100644 --- a/libs/JSystem/src/JStudio/JStudio/stb-data.cpp +++ b/libs/JSystem/src/JStudio/JStudio/stb-data.cpp @@ -1,6 +1,6 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep - +#include "dusk/endian.h" #include "JSystem/JStudio/JStudio/stb-data.h" const s32 JStudio::stb::data::gauDataSize_TEParagraph_data[8] = {0x0, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40}; -const u32 JStudio::stb::data::ga4cSignature = 'STB\0'; +const BE(u32) JStudio::stb::data::ga4cSignature = 'STB\0'; diff --git a/libs/JSystem/src/JStudio/JStudio/stb.cpp b/libs/JSystem/src/JStudio/JStudio/stb.cpp index b26074e59d..5bf857839b 100644 --- a/libs/JSystem/src/JStudio/JStudio/stb.cpp +++ b/libs/JSystem/src/JStudio/JStudio/stb.cpp @@ -373,7 +373,7 @@ JStudio::TObject* TFactory::create(data::TParse_TBlock_object const& param_0) { } void TFactory::destroy(TObject* p) { - delete p; + JKR_DELETE(p); } TParse::TParse(TControl* pControl) : pControl(pControl) {} diff --git a/libs/JSystem/src/JStudio/JStudio_JAudio2/control.cpp b/libs/JSystem/src/JStudio/JStudio_JAudio2/control.cpp index 6fc661ddcd..f49d4ba6bd 100644 --- a/libs/JSystem/src/JStudio/JStudio_JAudio2/control.cpp +++ b/libs/JSystem/src/JStudio/JStudio_JAudio2/control.cpp @@ -27,7 +27,7 @@ bool JStudio_JAudio2::TCreateObject::create( JStudio::TObject* JStudio_JAudio2::TCreateObject::createObject_JAI_SOUND_( JStudio::stb::data::TParse_TBlock_object const& param_1, JStudio_JAudio2::TCreateObject* param_2) { - JStudio_JAudio2::TAdaptor_sound* adaptor = new JStudio_JAudio2::TAdaptor_sound(param_2); + JStudio_JAudio2::TAdaptor_sound* adaptor = JKR_NEW JStudio_JAudio2::TAdaptor_sound(param_2); if (adaptor == NULL) { return NULL; } diff --git a/libs/JSystem/src/JStudio/JStudio_JAudio2/object-sound.cpp b/libs/JSystem/src/JStudio/JStudio_JAudio2/object-sound.cpp index 95bd769eae..8b3c5ed9ac 100644 --- a/libs/JSystem/src/JStudio/JStudio_JAudio2/object-sound.cpp +++ b/libs/JSystem/src/JStudio/JStudio_JAudio2/object-sound.cpp @@ -5,8 +5,10 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep #include "JSystem/JStudio/JStudio_JAudio2/object-sound.h" + #include "JSystem/JStudio/JStudio_JAudio2/control.h" #include "JSystem/JStudio/JStudio_JStage/control.h" +#include "dusk/audio.h" namespace JStudio_JAudio2 { namespace { @@ -146,6 +148,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_update(u32 param_1) { void JStudio_JAudio2::TAdaptor_sound::adaptor_do_SOUND(JStudio::data::TEOperationData param_1, void const* pContent, u32 uSize) { + DUSK_AUDIO_SKIP() switch(param_1) { case JStudio::data::UNK_0x19: JUT_ASSERT(283, pContent!=NULL); diff --git a/libs/JSystem/src/JStudio/JStudio_JParticle/control.cpp b/libs/JSystem/src/JStudio/JStudio_JParticle/control.cpp index 1f25f43f66..cbaf5da404 100644 --- a/libs/JSystem/src/JStudio/JStudio_JParticle/control.cpp +++ b/libs/JSystem/src/JStudio/JStudio_JParticle/control.cpp @@ -41,7 +41,7 @@ void JStudio_JParticle::TCreateObject::emitter_destroy(JPABaseEmitter* pEmitter) JStudio::TObject* JStudio_JParticle::TCreateObject::createObject_JPA_PARTICLE_( JStudio::stb::data::TParse_TBlock_object const& param_1, JStudio_JParticle::TCreateObject* param_2) { - JStudio_JParticle::TAdaptor_particle* adaptor = new JStudio_JParticle::TAdaptor_particle(param_2); + JStudio_JParticle::TAdaptor_particle* adaptor = JKR_NEW JStudio_JParticle::TAdaptor_particle(param_2); if (adaptor == NULL) { return NULL; } diff --git a/libs/JSystem/src/JStudio/JStudio_JStage/object-actor.cpp b/libs/JSystem/src/JStudio/JStudio_JStage/object-actor.cpp index e2d8ae225f..1dc1919a3d 100644 --- a/libs/JSystem/src/JStudio/JStudio_JStage/object-actor.cpp +++ b/libs/JSystem/src/JStudio/JStudio_JStage/object-actor.cpp @@ -206,7 +206,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_RELATION_NODE( case JStudio::data::UNK_0x19: JUT_ASSERT(358, uSize==4); JUT_ASSERT(359, pContent!=NULL); - field_0x14c = *(u32*)pContent; + field_0x14c = *(BE(u32)*)pContent; break; } } @@ -217,7 +217,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_RELATION_ENABLE( case JStudio::data::UNK_0x2: JUT_ASSERT(378, uSize==4); JUT_ASSERT(379, pContent!=NULL); - pJSGObject_->JSGSetRelation(*(u32*)pContent, field_0x148, field_0x14c); + pJSGObject_->JSGSetRelation(*(BE(u32)*)pContent, field_0x148, field_0x14c); break; } } @@ -227,7 +227,7 @@ void JStudio_JStage::TAdaptor_actor::setJSG_ID_(void (JStage::TActor::*function) void const* pContent, u32 uSize) { switch (operation) { case JStudio::data::UNK_0x19: - (((JStage::TActor*)pJSGObject_)->*function)(*(u32*)pContent); + (((JStage::TActor*)pJSGObject_)->*function)(*(BE(u32)*)pContent); break; } } diff --git a/libs/JSystem/src/JUtility/JUTAssert.cpp b/libs/JSystem/src/JUtility/JUTAssert.cpp index 89799cebf4..f6f07d1c7e 100644 --- a/libs/JSystem/src/JUtility/JUTAssert.cpp +++ b/libs/JSystem/src/JUtility/JUTAssert.cpp @@ -8,6 +8,8 @@ #include #include "global.h" +#include "global.h" + namespace JUTAssertion { void create() {} diff --git a/libs/JSystem/src/JUtility/JUTCacheFont.cpp b/libs/JSystem/src/JUtility/JUTCacheFont.cpp index 37ba023d04..dd1112c28d 100644 --- a/libs/JSystem/src/JUtility/JUTCacheFont.cpp +++ b/libs/JSystem/src/JUtility/JUTCacheFont.cpp @@ -28,15 +28,15 @@ JUTCacheFont::~JUTCacheFont() { void JUTCacheFont::deleteMemBlocks_CacheFont() { if (field_0xb0 != 0) { - delete[] mCacheBuffer; + JKR_DELETE_ARRAY(mCacheBuffer); } JKRFreeToAram(field_0xac); - delete mInf1Ptr; - delete mMemBlocks; - delete field_0x7c; - delete field_0x80; - delete field_0x84; + JKR_DELETE(mInf1Ptr); + JKR_DELETE(mMemBlocks); + JKR_DELETE(field_0x7c); + JKR_DELETE(field_0x80); + JKR_DELETE(field_0x84); } void JUTCacheFont::initialize_state() { @@ -172,20 +172,20 @@ bool JUTCacheFont::internal_initiate(ResFONT const* p_fontRes, void* param_1, u3 } bool JUTCacheFont::allocArea(void* cacheBuffer, u32 param_1, JKRHeap* heap) { - mInf1Ptr = (ResFONT::INF1*)new (heap, 0) ResFONT(); + mInf1Ptr = (ResFONT::INF1*)JKR_NEW_ARGS (heap, 0) ResFONT(); if (mInf1Ptr == NULL) { return false; } if (mTotalWidSize != 0) { - field_0x7c = new (heap, 0) u8[mTotalWidSize]; + field_0x7c = JKR_NEW_ARGS (heap, 0) u8[mTotalWidSize]; if (field_0x7c == NULL) { return false; } } if (mGly1BlockNum != 0) { - field_0x80 = new (heap, 0) u8[mGly1BlockNum * sizeof(ResFONT::GLY1)]; + field_0x80 = JKR_NEW_ARGS (heap, 0) u8[mGly1BlockNum * sizeof(ResFONT::GLY1)]; if (field_0x80 == NULL) { return false; } @@ -197,7 +197,7 @@ bool JUTCacheFont::allocArea(void* cacheBuffer, u32 param_1, JKRHeap* heap) { } if (mTotalMapSize != 0) { - field_0x84 = new (heap, 0) u8[mTotalMapSize]; + field_0x84 = JKR_NEW_ARGS (heap, 0) u8[mTotalMapSize]; if (field_0x84 == NULL) { return false; } @@ -215,7 +215,7 @@ bool JUTCacheFont::allocArea(void* cacheBuffer, u32 param_1, JKRHeap* heap) { mCacheBuffer = cacheBuffer; field_0xb0 = 0; } else { - mCacheBuffer = new (heap, 0x20) u8[v1]; + mCacheBuffer = JKR_NEW_ARGS (heap, 0x20) u8[v1]; if (mCacheBuffer == NULL) { return false; } @@ -227,25 +227,25 @@ bool JUTCacheFont::allocArea(void* cacheBuffer, u32 param_1, JKRHeap* heap) { } bool JUTCacheFont::allocArray(JKRHeap* param_0) { - mMemBlocks = (void**)new (param_0, 0) u32[mWid1BlockNum + mGly1BlockNum + mMap1BlockNum]; + mMemBlocks = (void**)JKR_NEW_ARGS (param_0, 0) uintptr_t[mWid1BlockNum + mGly1BlockNum + mMap1BlockNum]; if (mMemBlocks == NULL) { return false; } void** blocks = mMemBlocks; if (mWid1BlockNum) { - mpWidthBlocks = new (blocks) ResFONT::WID1*[mWid1BlockNum]; + mpWidthBlocks = JKR_NEW_ARGS (blocks) ResFONT::WID1*[mWid1BlockNum]; blocks = blocks + mWid1BlockNum; } if (mGly1BlockNum) { - mpGlyphBlocks = new (blocks) ResFONT::GLY1*[mGly1BlockNum]; + mpGlyphBlocks = JKR_NEW_ARGS (blocks) ResFONT::GLY1*[mGly1BlockNum]; blocks = blocks + mGly1BlockNum; for (int i = 0; i < mGly1BlockNum; i++) { mpGlyphBlocks[i] = (ResFONT::GLY1*)((u8*)mCacheBuffer + (field_0x94 * i)); } } if (mMap1BlockNum) { - mpMapBlocks = new (blocks) ResFONT::MAP1*[mMap1BlockNum]; + mpMapBlocks = JKR_NEW_ARGS (blocks) ResFONT::MAP1*[mMap1BlockNum]; } return true; } diff --git a/libs/JSystem/src/JUtility/JUTConsole.cpp b/libs/JSystem/src/JUtility/JUTConsole.cpp index 4fb9e43547..38c7324ab4 100644 --- a/libs/JSystem/src/JUtility/JUTConsole.cpp +++ b/libs/JSystem/src/JUtility/JUTConsole.cpp @@ -18,7 +18,7 @@ JUTConsole* JUTConsole::create(unsigned int param_0, unsigned int maxLines, JKRH u8* buffer = (u8*)JKRAllocFromHeap(pHeap, getObjectSizeFromBufferSize(param_0, maxLines), 0); - JUTConsole* console = new (buffer) JUTConsole(param_0, maxLines, true); + JUTConsole* console = JKR_NEW_ARGS (buffer) JUTConsole(param_0, maxLines, true); console->mBuf = buffer + sizeof(JUTConsole); console->clear(); @@ -34,7 +34,7 @@ JUTConsole* JUTConsole::create(unsigned int param_0, void* buffer, u32 bufferSiz u32 maxLines = getLineFromObjectSize(bufferSize, param_0); - JUTConsole* console = new (buffer) JUTConsole(param_0, maxLines, false); + JUTConsole* console = JKR_NEW_ARGS (buffer) JUTConsole(param_0, maxLines, false); console->mBuf = (u8*)buffer + sizeof(JUTConsole); console->clear(); @@ -401,7 +401,7 @@ JUTConsoleManager* JUTConsoleManager::createManager(JKRHeap* pHeap) { pHeap = JKRGetCurrentHeap(); } - sManager = new (pHeap, 0) JUTConsoleManager(); + sManager = JKR_NEW_ARGS (pHeap, 0) JUTConsoleManager(); return sManager; } diff --git a/libs/JSystem/src/JUtility/JUTDbPrint.cpp b/libs/JSystem/src/JUtility/JUTDbPrint.cpp index fea630ced3..cdf4c08d29 100644 --- a/libs/JSystem/src/JUtility/JUTDbPrint.cpp +++ b/libs/JSystem/src/JUtility/JUTDbPrint.cpp @@ -23,7 +23,7 @@ JUTDbPrint* JUTDbPrint::start(JUTFont* pFont, JKRHeap* pHeap) { if (pHeap == NULL) { pHeap = JKRGetCurrentHeap(); } - sDebugPrint = new JUTDbPrint(pFont, pHeap); + sDebugPrint = JKR_NEW JUTDbPrint(pFont, pHeap); } return sDebugPrint; diff --git a/libs/JSystem/src/JUtility/JUTDirectPrint.cpp b/libs/JSystem/src/JUtility/JUTDirectPrint.cpp index b8d5345c1d..1b5993c5bd 100644 --- a/libs/JSystem/src/JUtility/JUTDirectPrint.cpp +++ b/libs/JSystem/src/JUtility/JUTDirectPrint.cpp @@ -1,8 +1,9 @@ #include "JSystem/JSystem.h" // IWYU pragma: keep -#include "JSystem/JUtility/JUTDirectPrint.h" #include #include +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JUtility/JUTDirectPrint.h" #include "global.h" #include "angle_utils.h" @@ -15,7 +16,7 @@ JUTDirectPrint::JUTDirectPrint() { JUTDirectPrint* JUTDirectPrint::start() { if (!sDirectPrint) { - sDirectPrint = new JUTDirectPrint(); + sDirectPrint = JKR_NEW JUTDirectPrint(); } return sDirectPrint; @@ -212,7 +213,7 @@ void JUTDirectPrint::setCharColor(u8 r, u8 g, u8 b) { int Y = 0.257 * (int)r + 0.504 * (int)g + 0.098 * (int)b + 16.0f; int Cb = -0.148 * (int)r - 0.291 * (int)g + 0.439 * (int)b + 128.0f; int Cr = 0.439 * (int)r - 0.368 * (int)g - 0.071 * (int)b + 128.0f; - + mCharColor_Y = (u16)Y * 256; mCharColor_Cb = Cb; mCharColor_Cb2 = (u16)Cb / 2; diff --git a/libs/JSystem/src/JUtility/JUTException.cpp b/libs/JSystem/src/JUtility/JUTException.cpp index 608b805977..e34b56c710 100644 --- a/libs/JSystem/src/JUtility/JUTException.cpp +++ b/libs/JSystem/src/JUtility/JUTException.cpp @@ -91,7 +91,7 @@ JUTException::JUTException(JUTDirectPrint* directPrint) JUTException* JUTException::create(JUTDirectPrint* directPrint) { if (!sErrorManager) { - sErrorManager = new (JKRGetSystemHeap(), 0) JUTException(directPrint); + sErrorManager = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) JUTException(directPrint); sErrorManager->resume(); } @@ -778,7 +778,7 @@ void JUTException::createFB() { void* begin = (void*)ALIGN_PREV((uintptr_t)end - size, 32); void* object = (void*)ALIGN_PREV((intptr_t)begin - sizeof(JUTExternalFB), 32); - new (object) JUTExternalFB(renderMode, GX_GM_1_7, begin, size); + JKR_NEW_ARGS (object) JUTExternalFB(renderMode, GX_GM_1_7, begin, size); mDirectPrint->changeFrameBuffer(begin, renderMode->fbWidth, renderMode->efbHeight); VIConfigure(renderMode); @@ -820,7 +820,7 @@ void JUTException::appendMapFile(char const* path) { } } - JUTExMapFile* mapFile = new JUTExMapFile((char*)path); + JUTExMapFile* mapFile = JKR_NEW JUTExMapFile((char*)path); sMapFileList.append(&mapFile->mLink); } diff --git a/libs/JSystem/src/JUtility/JUTProcBar.cpp b/libs/JSystem/src/JUtility/JUTProcBar.cpp index 6bb1fba787..81d55ed3f1 100644 --- a/libs/JSystem/src/JUtility/JUTProcBar.cpp +++ b/libs/JSystem/src/JUtility/JUTProcBar.cpp @@ -35,14 +35,14 @@ JUTProcBar::~JUTProcBar() { JUTProcBar* JUTProcBar::create() { if (!sManager) { - sManager = new JUTProcBar(); + sManager = JKR_NEW JUTProcBar(); } return sManager; } void JUTProcBar::destroy() { if (sManager) { - delete sManager; + JKR_DELETE(sManager); } sManager = NULL; } @@ -107,8 +107,10 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p } void JUTProcBar::draw() { +#if !TARGET_PC drawProcessBar(); drawHeapBar(); +#endif } void JUTProcBar::drawProcessBar() { diff --git a/libs/JSystem/src/JUtility/JUTResFont.cpp b/libs/JSystem/src/JUtility/JUTResFont.cpp index 9efd746392..0daa728d5b 100644 --- a/libs/JSystem/src/JUtility/JUTResFont.cpp +++ b/libs/JSystem/src/JUtility/JUTResFont.cpp @@ -26,7 +26,7 @@ JUTResFont::~JUTResFont() { } void JUTResFont::deleteMemBlocks_ResFont() { - delete[] mMemBlocks; + JKR_DELETE_ARRAY(mMemBlocks); } void JUTResFont::initialize_state() { @@ -62,22 +62,22 @@ bool JUTResFont::protected_initiate(const ResFONT* pFont, JKRHeap* pHeap) { mValid = true; countBlock(); - mMemBlocks = new (pHeap, 0) void*[mWid1BlockNum + mGly1BlockNum + mMap1BlockNum]; + mMemBlocks = JKR_NEW_ARGS (pHeap, 0) void*[mWid1BlockNum + mGly1BlockNum + mMap1BlockNum]; if (!mMemBlocks) { return false; } p = mMemBlocks; if (mWid1BlockNum != 0) { - mpWidthBlocks = new (p) ResFONT::WID1*[mWid1BlockNum]; + mpWidthBlocks = JKR_NEW_ARGS (p) ResFONT::WID1*[mWid1BlockNum]; p += mWid1BlockNum; } if (mGly1BlockNum != 0) { - mpGlyphBlocks = new (p) ResFONT::GLY1*[mGly1BlockNum]; + mpGlyphBlocks = JKR_NEW_ARGS (p) ResFONT::GLY1*[mGly1BlockNum]; p += mGly1BlockNum; } if (mMap1BlockNum != 0) { - mpMapBlocks = new (p) ResFONT::MAP1*[mMap1BlockNum]; + mpMapBlocks = JKR_NEW_ARGS (p) ResFONT::MAP1*[mMap1BlockNum]; } setBlock(); return true; diff --git a/libs/JSystem/src/JUtility/JUTTexture.cpp b/libs/JSystem/src/JUtility/JUTTexture.cpp index d0f08381e6..4021bf552c 100644 --- a/libs/JSystem/src/JUtility/JUTTexture.cpp +++ b/libs/JSystem/src/JUtility/JUTTexture.cpp @@ -4,14 +4,18 @@ #include "JSystem/JUtility/JUTPalette.h" #include #include "os_report.h" +#include "dusk/logging.h" + +#include "JSystem/JKernel/JKRHeap.h" JUTTexture::~JUTTexture() { if (getCaptureFlag()) { - delete[] field_0x3c; + JKR_DELETE_ARRAY(field_0x3c); } if (getEmbPaletteDelFlag()) { - delete mEmbPalette; + JKR_DELETE(mEmbPalette); } + GXDestroyTexObj(&mTexObj); } void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) { @@ -49,7 +53,7 @@ void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) { u32 palOffset = mTexInfo->paletteOffset; if (mEmbPalette == NULL || !getEmbPaletteDelFlag()) { - mEmbPalette = new JUTPalette(tlut, (GXTlutFmt)mTexInfo->colorFormat, + mEmbPalette = JKR_NEW JUTPalette(tlut, (GXTlutFmt)mTexInfo->colorFormat, (JUTTransparency)mTexInfo->alphaEnabled, numColors, (void*)((intptr_t)mTexInfo + palOffset)); @@ -88,7 +92,7 @@ void JUTTexture::storeTIMG(ResTIMG const* param_0, JUTPalette* param_1, GXTlut p mTexData = ((u8*)mTexInfo) + sizeof(ResTIMG); } if (getEmbPaletteDelFlag()) { - delete mEmbPalette; + JKR_DELETE(mEmbPalette); } mEmbPalette = param_1; setEmbPaletteDelFlag(false); @@ -157,9 +161,9 @@ void JUTTexture::initTexObj(GXTlut param_0) { mTlutName = param_0; u8* image = ((u8*)mTexInfo); u32 imgOffset = mTexInfo->imageOffset; - printf("[DIAG] initTexObj: Offset=%u, W=%u, H=%u, Ptr=%p\n", imgOffset, mTexInfo->width, - mTexInfo->height, - mTexInfo); + DuskLog.debug("initTexObj: Offset={}, W={}, H={}, Ptr={}", imgOffset, (u16)mTexInfo->width, + (u16)mTexInfo->height, + (void*)mTexInfo); image += (imgOffset ? imgOffset : 0x20); GXInitTexObjCI(&mTexObj, image, mTexInfo->width, mTexInfo->height, (GXCITexFmt)mTexInfo->format, (GXTexWrapMode)mWrapS, diff --git a/libs/JSystem/src/JUtility/JUTVideo.cpp b/libs/JSystem/src/JUtility/JUTVideo.cpp index 338a3b6f4d..1656aa7e0f 100644 --- a/libs/JSystem/src/JUtility/JUTVideo.cpp +++ b/libs/JSystem/src/JUtility/JUTVideo.cpp @@ -6,6 +6,8 @@ #include #include +#include "JSystem/JKernel/JKRHeap.h" + JUTVideo* JUTVideo::sManager; OSTick JUTVideo::sVideoLastTick; @@ -16,14 +18,14 @@ static bool data_80451544; JUTVideo* JUTVideo::createManager(GXRenderModeObj const* param_0) { if (sManager == NULL) { - sManager = new JUTVideo(param_0); + sManager = JKR_NEW JUTVideo(param_0); } return sManager; } void JUTVideo::destroyManager() { if (sManager != NULL) { - delete sManager; + JKR_DELETE(sManager); sManager = NULL; } } @@ -197,3 +199,9 @@ void JUTVideo::setRenderMode(GXRenderModeObj const* pObj) { } void JUTVideo::waitRetraceIfNeed() {} + +#if TARGET_PC +void JUTVideo::setWindowSize(AuroraWindowSize const& size) { + m_WindowSize = size; +} +#endif diff --git a/libs/JSystem/src/JUtility/JUTXfb.cpp b/libs/JSystem/src/JUtility/JUTXfb.cpp index 2ce6085bf9..805b189abf 100644 --- a/libs/JSystem/src/JUtility/JUTXfb.cpp +++ b/libs/JSystem/src/JUtility/JUTXfb.cpp @@ -44,21 +44,21 @@ JUTXfb::~JUTXfb() { void JUTXfb::delXfb(int xfbIdx) { if (mXfbAllocated[xfbIdx] && mBuffer[xfbIdx]) { - delete mBuffer[xfbIdx]; + JKR_DELETE(mBuffer[xfbIdx]); } } JUTXfb* JUTXfb::createManager(JKRHeap* pHeap, JUTXfb::EXfbNumber xfbNum) { JUT_CONFIRM(273, sManager == NULL); if (sManager == NULL) { - sManager = new JUTXfb(NULL, pHeap, xfbNum); + sManager = JKR_NEW JUTXfb(NULL, pHeap, xfbNum); } return sManager; } void JUTXfb::destroyManager() { JUT_CONFIRM(344, sManager); - delete sManager; + JKR_DELETE(sManager); sManager = NULL; } @@ -69,11 +69,11 @@ void JUTXfb::initiate(u16 width, u16 height, JKRHeap* pHeap, JUTXfb::EXfbNumber int size = (u16)((u16)width + 0xf & ~0xf) * height * 2; - mBuffer[0] = new (pHeap, 0x20) u8[size]; + mBuffer[0] = JKR_NEW_ARGS (pHeap, 0x20) u8[size]; mXfbAllocated[0] = true; if (xfbNum >= 2) { - mBuffer[1] = new (pHeap, 0x20) u8[size]; + mBuffer[1] = JKR_NEW_ARGS (pHeap, 0x20) u8[size]; mXfbAllocated[1] = true; } else { mBuffer[1] = NULL; @@ -81,7 +81,7 @@ void JUTXfb::initiate(u16 width, u16 height, JKRHeap* pHeap, JUTXfb::EXfbNumber } if (xfbNum >= 3) { - mBuffer[2] = new (pHeap, 0x20) u8[size]; + mBuffer[2] = JKR_NEW_ARGS (pHeap, 0x20) u8[size]; mXfbAllocated[2] = true; } else { mBuffer[2] = NULL; diff --git a/libs/dolphin/src/gf/GFPixel.cpp b/libs/dolphin/src/gf/GFPixel.cpp index d78ca9247e..232ed8715c 100644 --- a/libs/dolphin/src/gf/GFPixel.cpp +++ b/libs/dolphin/src/gf/GFPixel.cpp @@ -1,5 +1,6 @@ #include #include +#include void GFSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor color) { f32 A; diff --git a/src/DynamicLink.cpp b/src/DynamicLink.cpp index 969c485f55..5c5a2030d4 100644 --- a/src/DynamicLink.cpp +++ b/src/DynamicLink.cpp @@ -12,6 +12,7 @@ #include "m_Do/m_Do_dvd_thread.h" #include "m_Do/m_Do_ext.h" #include "os_report.h" +#include "dusk/logging.h" DynamicModuleControlBase* DynamicModuleControlBase::mFirst; @@ -185,10 +186,10 @@ static u32 calcSum2(u16 const* data, u32 size) { bool DynamicModuleControl::do_load() { if (mModule != NULL) { - printf("[DIAG] DynamicModuleControl::do_load(%s) already loaded\n", mName); fflush(stdout); + DuskLog.debug("DynamicModuleControl::do_load({}) already loaded", mName); return true; } - printf("[DIAG] DynamicModuleControl::do_load(%s) loading... sArchive=%p sFileCache=%p\n", mName, sArchive, sFileCache); fflush(stdout); + DuskLog.debug("DynamicModuleControl::do_load({}) loading... sArchive={} sFileCache={}", mName, (void*)sArchive, (void*)sFileCache); JKRExpHeap* heap = mDoExt_getArchiveHeap(); s32 i = 0; while (true) { @@ -281,7 +282,7 @@ bool DynamicModuleControl::do_load() { break; } } - printf("[DIAG] DynamicModuleControl::do_load(%s) SUCCESS mModule=%p type=%d size=%d\n", mName, mModule, mResourceType, mSize); fflush(stdout); + DuskLog.debug("DynamicModuleControl::do_load({}) SUCCESS mModule={} type={} size={}", mName, (void*)mModule, mResourceType, mSize); return true; } diff --git a/src/Z2AudioCS/SpkMixingBuffer.cpp b/src/Z2AudioCS/SpkMixingBuffer.cpp index 3118f07f94..281de060f5 100644 --- a/src/Z2AudioCS/SpkMixingBuffer.cpp +++ b/src/Z2AudioCS/SpkMixingBuffer.cpp @@ -8,7 +8,7 @@ SpkMixingBuffer::SpkMixingBuffer(JKRHeap* heap) { JUT_ASSERT(25, heap); for (s32 chan = 0; chan < ARRAY_SIZE(mBuffer); chan++) { - mBuffer[chan] = new (heap, 0) s16[cSamplesPerAudioPacket]; + mBuffer[chan] = JKR_NEW_ARGS (heap, 0) s16[cSamplesPerAudioPacket]; JUT_ASSERT(29, mBuffer[chan]); bzeroBuffer(chan); } diff --git a/src/Z2AudioCS/SpkSound.cpp b/src/Z2AudioCS/SpkSound.cpp index 04467f1919..06e2a718d6 100644 --- a/src/Z2AudioCS/SpkSound.cpp +++ b/src/Z2AudioCS/SpkSound.cpp @@ -331,7 +331,7 @@ bool SpkSoundHolder::startSound(s32 chan, s32 soundNum, SpkSoundHandle* handle) } } - SpkSound* new_sound_p = new SpkSound(); + SpkSound* new_sound_p = JKR_NEW SpkSound(); if (new_sound_p == NULL) { JUT_WARN(520, "%s", "cannot new SpkSound\n"); return false; @@ -344,7 +344,7 @@ bool SpkSoundHolder::startSound(s32 chan, s32 soundNum, SpkSoundHandle* handle) bool startResult = new_sound_p->start(chan, soundNum); if (!startResult) { JUT_WARN(532, "%s", "cannot start SpkSound\n"); - delete new_sound_p; + JKR_DELETE(new_sound_p); return false; } @@ -421,7 +421,7 @@ void SpkSoundHolder::freeDeadSound(s32 chan) { JSULink* next = it->getNext(); if (it->getObject()->isDead()) { mSoundList[chan].remove(it); - delete it->getObject(); + JKR_DELETE(it->getObject()); } it = next; } diff --git a/src/Z2AudioCS/SpkSystem.cpp b/src/Z2AudioCS/SpkSystem.cpp index ebb4c71ff6..1aa25eb0d1 100644 --- a/src/Z2AudioCS/SpkSystem.cpp +++ b/src/Z2AudioCS/SpkSystem.cpp @@ -1,11 +1,12 @@ #include "Z2AudioCS/SpkSystem.h" -#include "Z2AudioCS/SpkMixingBuffer.h" -#include "Z2AudioCS/SpkSound.h" -#include "Z2AudioCS/SpkSpeakerCtrl.h" +#include "../../libs/JSystem/include/JSystem/JKernel/JKRHeap.h" #include "JSystem/JAudio2/JASGadget.h" #include "JSystem/JAudio2/JASHeapCtrl.h" #include "JSystem/JKernel/JKRHeap.h" +#include "Z2AudioCS/SpkMixingBuffer.h" +#include "Z2AudioCS/SpkSound.h" +#include "Z2AudioCS/SpkSpeakerCtrl.h" template<> SpkSystem* JASGlobalInstance::sInstance JAS_GLOBAL_INSTANCE_INIT; template<> SpkSoundHolder* JASGlobalInstance::sInstance JAS_GLOBAL_INSTANCE_INIT; @@ -20,9 +21,9 @@ SpkSystem::SpkSystem(JKRHeap* heap) : JASGlobalInstance(true) { } mHeap = heap; - mMixingBuffer = new (heap, 0) SpkMixingBuffer(heap); + mMixingBuffer = JKR_NEW_ARGS (heap, 0) SpkMixingBuffer(heap); JUT_ASSERT(35, mMixingBuffer); - mSoundHolder = new (heap, 0) SpkSoundHolder(); + mSoundHolder = JKR_NEW_ARGS (heap, 0) SpkSoundHolder(); JUT_ASSERT(38, mSoundHolder); SpkSpeakerCtrl::setup(); SpkSpeakerCtrl::setMixingBuffer(mMixingBuffer); @@ -31,7 +32,7 @@ SpkSystem::SpkSystem(JKRHeap* heap) : JASGlobalInstance(true) { void SpkSystem::setResource(JKRArchive* resArc, u16 param_1, u16 param_2) { JUT_ASSERT(71, mHeap); JUT_ASSERT(72, resArc); - mData = new (mHeap, 0) SpkData(resArc); + mData = JKR_NEW_ARGS (mHeap, 0) SpkData(resArc); JUT_ASSERT(75, mData); mData->loadTable(param_1); mData->loadWave(param_2); diff --git a/src/Z2AudioCS/Z2AudioCS.cpp b/src/Z2AudioCS/Z2AudioCS.cpp index e619876537..f681a9e6a8 100644 --- a/src/Z2AudioCS/Z2AudioCS.cpp +++ b/src/Z2AudioCS/Z2AudioCS.cpp @@ -18,10 +18,10 @@ void Z2AudioCS::newSpkSoundMemPool() { int Z2AudioCS::init(JKRHeap* heap, JKRArchive* res, s32 param_2, s32 param_3) { JUT_ASSERT(59, heap); JUT_ASSERT(60, res); - SpkSystem* spkSys = new(heap, 0) SpkSystem(heap); + SpkSystem* spkSys = JKR_NEW_ARGS(heap, 0) SpkSystem(heap); JUT_ASSERT(67, spkSys); - sSpkHandles = new (heap, 0) SpkSoundHandle[HANDLES_MAX]; + sSpkHandles = JKR_NEW_ARGS (heap, 0) SpkSoundHandle[HANDLES_MAX]; JUT_ASSERT(71, sSpkHandles); spkSys->setResource(res, 2, 3); diff --git a/src/Z2AudioLib/Z2Audience.cpp b/src/Z2AudioLib/Z2Audience.cpp index 5e8522701b..be7bd4b126 100644 --- a/src/Z2AudioLib/Z2Audience.cpp +++ b/src/Z2AudioLib/Z2Audience.cpp @@ -526,7 +526,7 @@ JAIAudible* Z2Audience::newAudible(const JGeometry::TVec3& pos, JAISoundID JAUAudibleParam params = Z2GetSoundInfo()->getAudibleSwFull(soundID); bool x = params.field_0x0.bytes.b0_0 != 0; - Z2Audible* audible = new Z2Audible(pos, param_2, channelNum, x); + Z2Audible* audible = JKR_NEW Z2Audible(pos, param_2, channelNum, x); if (audible == NULL) { return NULL; } @@ -552,7 +552,7 @@ JAIAudible* Z2Audience::newAudible(const JGeometry::TVec3& pos, JAISoundID } void Z2Audience::deleteAudible(JAIAudible* audible) { - delete audible; + JKR_DELETE(audible); } Z2Audible::~Z2Audible() {} diff --git a/src/Z2AudioLib/Z2AudioArcLoader.cpp b/src/Z2AudioLib/Z2AudioArcLoader.cpp index 1b4ab57e91..ed1d6ed2d8 100644 --- a/src/Z2AudioLib/Z2AudioArcLoader.cpp +++ b/src/Z2AudioLib/Z2AudioArcLoader.cpp @@ -56,7 +56,7 @@ void Z2AudioArcLoader::readBSTN(const void* addr, u32 param_1) { u8* bstnDst = (u8*)addr; if (param_1 != 0) { - bstnDst = new (gameHeap, 4) u8[param_1]; + bstnDst = JKR_NEW_ARGS (gameHeap, 4) u8[param_1]; if (bstnDst != NULL) { memcpy(bstnDst, addr, param_1); } @@ -64,7 +64,7 @@ void Z2AudioArcLoader::readBSTN(const void* addr, u32 param_1) { JUT_ASSERT(122, bstnDst); } - JAUSoundNameTable* soundNameTable = new (gameHeap, 0) JAUSoundNameTable(true); + JAUSoundNameTable* soundNameTable = JKR_NEW_ARGS (gameHeap, 0) JAUSoundNameTable(true); JUT_ASSERT(125, soundNameTable); soundNameTable->init(bstnDst); diff --git a/src/Z2AudioLib/Z2AudioMgr.cpp b/src/Z2AudioLib/Z2AudioMgr.cpp index f46a2fc897..32fa4de849 100644 --- a/src/Z2AudioLib/Z2AudioMgr.cpp +++ b/src/Z2AudioLib/Z2AudioMgr.cpp @@ -90,7 +90,7 @@ void Z2AudioMgr::init(JKRSolidHeap* heap, u32 memSize, void* baaData, JKRArchive seqMgr->getParams()->moveVolume(Z2Param::VOL_BGM_DEFAULT, 0); JAIStreamMgr* streamMgr = mSoundMgr.getStreamMgr(); - JAUStreamStaticAramMgr_<1>* streamStaticAramMgr = new(heap, 0) JAUStreamStaticAramMgr_<1>(); + JAUStreamStaticAramMgr_<1>* streamStaticAramMgr = JKR_NEW_ARGS(heap, 0) JAUStreamStaticAramMgr_<1>(); streamStaticAramMgr->reserveAram(NULL, 0, 0x14); streamMgr->setStreamAramMgr(streamStaticAramMgr); streamMgr->getParams()->moveVolume(Z2Param::VOL_BGM_DEFAULT, 0); diff --git a/src/Z2AudioLib/Z2Creature.cpp b/src/Z2AudioLib/Z2Creature.cpp index 36938f3c78..095e799381 100644 --- a/src/Z2AudioLib/Z2Creature.cpp +++ b/src/Z2AudioLib/Z2Creature.cpp @@ -3,6 +3,7 @@ #include "Z2AudioLib/Z2Calc.h" #include "Z2AudioLib/Z2AudioMgr.h" #include "os_report.h" +#include "dusk/logging.h" static void Z2_E_sw_modPitch(Z2SoundHandlePool*, u32); static void Z2_E_ms_modVol(Z2SoundHandlePool*, u32); @@ -139,7 +140,7 @@ void Z2Creature::setSoundStarter(Z2SoundStarter* soundStarter) { void Z2Creature::initAnime(void* animation, bool param_1, f32 startFrame, f32 param_3) { #if TARGET_PC - puts("In this house we HATE anime!!!"); + STUB_LOG(); return; #endif mSoundObjAnime.initAnime(animation, param_1, startFrame, param_3); diff --git a/src/Z2AudioLib/Z2DebugSys.cpp b/src/Z2AudioLib/Z2DebugSys.cpp index 55ee66519c..2f88759d55 100644 --- a/src/Z2AudioLib/Z2DebugSys.cpp +++ b/src/Z2AudioLib/Z2DebugSys.cpp @@ -42,28 +42,28 @@ void Z2DebugSys::initJAW() { JAWPlayerChView* playerChView; JKRSetCurrentHeap(heap); u32 local_50 = heap->getFreeSize(); - soundPlayer = new (heap, 0) Z2SoundPlayer("GC-Zelda2"); - sysMemView = new (heap, 0) JAWSysMemView(); - bankView = new (heap, 0) JAWBankView(); - chView = new (heap, 0) JAWChView(); - trackView = new (heap, 0) Z2TrackView(0, Z2TrackView::DISPMODE0); - reportView = new (heap, 0) JAWReportView(); + soundPlayer = JKR_NEW_ARGS (heap, 0) Z2SoundPlayer("GC-Zelda2"); + sysMemView = JKR_NEW_ARGS (heap, 0) JAWSysMemView(); + bankView = JKR_NEW_ARGS (heap, 0) JAWBankView(); + chView = JKR_NEW_ARGS (heap, 0) JAWChView(); + trackView = JKR_NEW_ARGS (heap, 0) Z2TrackView(0, Z2TrackView::DISPMODE0); + reportView = JKR_NEW_ARGS (heap, 0) JAWReportView(); JASReportInit(heap, 500); - hioBankEdit = new (heap, 0) JAWHioBankEdit(); - waveArcLoader = new (heap, 0) Z2WaveArcLoader(); - volume = new (heap, 0) JAWVolume(90, 480); - playSeView = new (heap, 0) Z2PlaySeView(); - audSettingView = new (heap, 0) Z2AudSettingView(); - dspCheck = new (heap, 0) Z2DSPCheck(); + hioBankEdit = JKR_NEW_ARGS (heap, 0) JAWHioBankEdit(); + waveArcLoader = JKR_NEW_ARGS (heap, 0) Z2WaveArcLoader(); + volume = JKR_NEW_ARGS (heap, 0) JAWVolume(90, 480); + playSeView = JKR_NEW_ARGS (heap, 0) Z2PlaySeView(); + audSettingView = JKR_NEW_ARGS (heap, 0) Z2AudSettingView(); + dspCheck = JKR_NEW_ARGS (heap, 0) Z2DSPCheck(); JAWExtSystem::registWindow(1, soundPlayer, 10, 22); - entrySeView = new (heap, 0) Z2EntrySeView(); + entrySeView = JKR_NEW_ARGS (heap, 0) Z2EntrySeView(); JAWExtSystem::registWindow(2, entrySeView, 10, 22); JAWExtSystem::registWindow(3, playSeView, 10, 22); JAWExtSystem::registWindow(4, sysMemView, 10, 22); JAWExtSystem::registWindow(5, bankView, 10, 22); JAWExtSystem::registWindow(6, chView, 10, 22); JAWExtSystem::registWindow(7, trackView, 10, 22); - playerChView = new (heap, 0) JAWPlayerChView(); + playerChView = JKR_NEW_ARGS (heap, 0) JAWPlayerChView(); JAWExtSystem::registWindow(8, playerChView, 10, 22); JAWExtSystem::registWindow(11, reportView, 330, 0); JAWExtSystem::registWindow(12, hioBankEdit, 10, 0); @@ -80,21 +80,21 @@ void Z2DebugSys::initSoundHioNode() { JKRSetCurrentHeap(heap); s32 freeSize = heap->getFreeSize(); JAHSingletonBase::newInstance(); - JAHioNode* soundRoot = new (heap, 0) JAHioNode("サウンド"); + JAHioNode* soundRoot = JKR_NEW_ARGS (heap, 0) JAHioNode("サウンド"); JUT_ASSERT(239, soundRoot); JAHSingletonBase::getIns()->init_OnGame(); JAHSingletonBase::getIns()->appendRootNode(&mDoHIO_root, soundRoot); mDoHIO_createChild("サウンド", soundRoot); - JAHSoundPlayerNode* soundPlayerNode = new (heap, 0) JAHSoundPlayerNode(); + JAHSoundPlayerNode* soundPlayerNode = JKR_NEW_ARGS (heap, 0) JAHSoundPlayerNode(); JUT_ASSERT(258, soundPlayerNode); soundRoot->appendNode(soundPlayerNode, NULL); - Z2ParamNode* paramNode = new (heap, 0) Z2ParamNode(); + Z2ParamNode* paramNode = JKR_NEW_ARGS (heap, 0) Z2ParamNode(); JUT_ASSERT(262, paramNode); soundRoot->appendNode(paramNode, NULL); - Z2FxLineEditNode* fxNode = new (heap, 0) Z2FxLineEditNode(heap); + Z2FxLineEditNode* fxNode = JKR_NEW_ARGS (heap, 0) Z2FxLineEditNode(heap); JUT_ASSERT(267, fxNode); soundRoot->appendNode(fxNode, NULL); - Z2F1SwingTestNode* f1TestWin = new (heap, 0) Z2F1SwingTestNode(); + Z2F1SwingTestNode* f1TestWin = JKR_NEW_ARGS (heap, 0) Z2F1SwingTestNode(); JUT_ASSERT(284, f1TestWin); soundRoot->appendNode(f1TestWin, NULL); JAWExtSystem::registWindow(10, f1TestWin, 10, 22); @@ -111,9 +111,9 @@ JAISeqDataMgr* Z2DebugSys::initSeSeqDataMgr(const void* param_1) { JKRExpHeap* heap = mDoExt_getGameHeap(); JKRSetCurrentHeap(heap); s32 freeSize = heap->getFreeSize(); - JAWHioReceiver* receiver = new (heap, 0) JAWHioReceiver(); + JAWHioReceiver* receiver = JKR_NEW_ARGS (heap, 0) JAWHioReceiver(); JAWExtSystem::registWindow(0, receiver, 10, 22); - seqDataMgr = new (heap, 0) Z2HioSeSeqDataMgr(param_1, receiver); + seqDataMgr = JKR_NEW_ARGS (heap, 0) Z2HioSeSeqDataMgr(param_1, receiver); JKRSetCurrentHeap(oldHeap); return seqDataMgr; } diff --git a/src/Z2AudioLib/Z2FxLineMgr.cpp b/src/Z2AudioLib/Z2FxLineMgr.cpp index 55f54b99fa..575297572a 100644 --- a/src/Z2AudioLib/Z2FxLineMgr.cpp +++ b/src/Z2AudioLib/Z2FxLineMgr.cpp @@ -21,10 +21,10 @@ void Z2FxLineMgr::initDataArc(JKRArchive* arc, JKRHeap* heap) { JUT_ASSERT(44, arc); JUT_ASSERT(45, heap); - mFxLineBuffer[0] = new (heap, 0x20) u8[0x2800]; - mFxLineBuffer[1] = new (heap, 0x20) u8[0x2800]; - mFxLineBuffer[2] = new (heap, 0x20) u8[0x4B00]; - mFxLineBuffer[3] = new (heap, 0x20) u8[0x4B00]; + mFxLineBuffer[0] = JKR_NEW_ARGS (heap, 0x20) u8[0x2800]; + mFxLineBuffer[1] = JKR_NEW_ARGS (heap, 0x20) u8[0x2800]; + mFxLineBuffer[2] = JKR_NEW_ARGS (heap, 0x20) u8[0x4B00]; + mFxLineBuffer[3] = JKR_NEW_ARGS (heap, 0x20) u8[0x4B00]; JUT_ASSERT(53, mFxLineBuffer[0]); JUT_ASSERT(54, mFxLineBuffer[1]); @@ -32,7 +32,7 @@ void Z2FxLineMgr::initDataArc(JKRArchive* arc, JKRHeap* heap) { JUT_ASSERT(56, mFxLineBuffer[3]); mFxDataNum = arc->countResource(); - mConfig = new (heap, 0) Z2FxLineConfig[mFxDataNum]; + mConfig = JKR_NEW_ARGS (heap, 0) Z2FxLineConfig[mFxDataNum]; for (u8 i = 0; i < mFxDataNum; i++) { void* res = arc->getResource(i); diff --git a/src/Z2AudioLib/Z2SoundHandles.cpp b/src/Z2AudioLib/Z2SoundHandles.cpp index 8990cd4fd1..9b6aa5a9ba 100644 --- a/src/Z2AudioLib/Z2SoundHandles.cpp +++ b/src/Z2AudioLib/Z2SoundHandles.cpp @@ -20,7 +20,7 @@ void Z2SoundHandles::deleteHandlesPool() { JUT_ASSERT(48, handle->getSupervisor() == this); remove(handle); - delete handle; + JKR_DELETE(handle); } handleNum_ = 0; @@ -64,7 +64,7 @@ Z2SoundHandlePool* Z2SoundHandles::getFreeHandle() { } if (getNumHandles() < handleNum_) { - Z2SoundHandlePool* handle = new Z2SoundHandlePool(); + Z2SoundHandlePool* handle = JKR_NEW Z2SoundHandlePool(); if (handle != NULL) { append(handle); JUT_ASSERT(113, handle->getSupervisor() == this); @@ -141,7 +141,7 @@ void Z2SoundHandles::setPos(const JGeometry::TVec3& pos) { } else { remove(handle); - delete handle; + JKR_DELETE(handle); } } } diff --git a/src/c/c_dylink.cpp b/src/c/c_dylink.cpp index 6681f38b13..26a1e7a1ce 100644 --- a/src/c/c_dylink.cpp +++ b/src/c/c_dylink.cpp @@ -12,6 +12,7 @@ #include "d/d_com_inf_game.h" #include "m_Do/m_Do_ext.h" #include +#include "dusk/logging.h" #if DEBUG #include "f_pc/f_pc_debug_sv.h" @@ -843,7 +844,7 @@ int cCc_Init() { } if (DMC[d.mKey] == NULL) { - DMC[d.mKey] = new DynamicModuleControl(d.name); + DMC[d.mKey] = JKR_NEW DynamicModuleControl(d.name); } } } @@ -921,7 +922,7 @@ int cDyl_LinkASync(s16 i_ProfName) { JUT_ASSERT(266, DMC_initialized); if (!cDyl_Initialized) { - printf("[DIAG] cDyl_LinkASync: NOT initialized yet, profName=%d\n", i_ProfName); fflush(stdout); + DuskLog.debug("cDyl_LinkASync: NOT initialized yet, profName={}", i_ProfName); OS_REPORT_ERROR("初期化が終わってないのに呼んでもらっても困ります %d %s\n", i_ProfName, fpcDbSv_getNameString(i_ProfName)); return cPhs_INIT_e; } @@ -942,12 +943,12 @@ int cDyl_LinkASync(s16 i_ProfName) { return cPhs_COMPLEATE_e; } else { // "cDyl_LinkASync: Link failed. Returning\n" - printf("[DIAG] cDyl_LinkASync: link FAILED for profName=%d\n", i_ProfName); fflush(stdout); + DuskLog.debug("cDyl_LinkASync: link FAILED for profName={}", i_ProfName); OSReport_Error("cDyl_LinkASync: リンクに失敗しました。諦めます\n"); return cPhs_ERROR_e; } } else { - printf("[DIAG] cDyl_LinkASync: load_async not ready for profName=%d\n", i_ProfName); fflush(stdout); + DuskLog.debug("cDyl_LinkASync: load_async not ready for profName={}", i_ProfName); return cPhs_INIT_e; } } @@ -956,7 +957,7 @@ int cDyl_LinkASync(s16 i_ProfName) { } static int cDyl_InitCallback(void* param_0) { - printf("[DIAG] cDyl_InitCallback: START\n"); fflush(stdout); + DuskLog.debug("[DIAG] cDyl_InitCallback: START"); JUT_ASSERT(335, !cDyl_Initialized); #ifdef TARGET_PC @@ -968,13 +969,13 @@ static int cDyl_InitCallback(void* param_0) { #else JKRHeap* parentHeap = DynamicModuleControlBase::getHeap(); #endif - printf("[DIAG] cDyl_InitCallback: parentHeap=%p\n", parentHeap); fflush(stdout); + DuskLog.debug("cDyl_InitCallback: parentHeap={}", (void*)parentHeap); JKRFileCache* loader = JKRMountDvdDrive("/", parentHeap, NULL); - printf("[DIAG] cDyl_InitCallback: JKRMountDvdDrive loader=%p\n", loader); fflush(stdout); + DuskLog.debug("cDyl_InitCallback: JKRMountDvdDrive loader={}", (void*)loader); DynamicModuleControl::initialize(); - printf("[DIAG] cDyl_InitCallback: DynamicModuleControl::initialize done\n"); fflush(stdout); + DuskLog.debug("cDyl_InitCallback: DynamicModuleControl::initialize done"); #if PLATFORM_GCN void* strTbl = JKRGetResource("/dvd/str/Final/Release/frameworkF.str"); @@ -983,21 +984,21 @@ static int cDyl_InitCallback(void* param_0) { #else void* strTbl = JKRGetResource("/dvd/str/Final/Release/frameworkF.str"); #endif - printf("[DIAG] cDyl_InitCallback: frameworkF.str=%p\n", strTbl); fflush(stdout); + DuskLog.debug("cDyl_InitCallback: frameworkF.str={}", strTbl); JKRDetachResource(strTbl, loader); JKRUnmountDvdDrive(loader); OSSetStringTable(strTbl); DynamicModuleControl dmc("f_pc_profile_lst"); - printf("[DIAG] cDyl_InitCallback: linking f_pc_profile_lst...\n"); fflush(stdout); + DuskLog.debug("cDyl_InitCallback: linking f_pc_profile_lst..."); dmc.link(); - printf("[DIAG] cDyl_InitCallback: link done\n"); fflush(stdout); + DuskLog.debug("cDyl_InitCallback: link done"); #endif cDyl_Initialized = true; fopScnM_CreateReq(PROC_LOGO_SCENE, 0x7FFF, 0, 0); - printf("[DIAG] cDyl_InitCallback: PROC_LOGO_SCENE created, DONE\n"); fflush(stdout); + DuskLog.debug("cDyl_InitCallback: PROC_LOGO_SCENE created, DONE"); return 1; } diff --git a/src/d/actor/d_a_L7demo_dr.cpp b/src/d/actor/d_a_L7demo_dr.cpp index 046c7313e5..1d52f77263 100644 --- a/src/d/actor/d_a_L7demo_dr.cpp +++ b/src/d/actor/d_a_L7demo_dr.cpp @@ -311,7 +311,7 @@ int daDr_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("B_dr", 0x49); JUT_ASSERT(655, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_dr", 0x1E), 0, 0.0f, 0, -1, &mSound, 0, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_dr", 0x1E), 0, 0.0f, 0, -1, &mSound, 0, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_L7low_dr.cpp b/src/d/actor/d_a_L7low_dr.cpp index 0e546a4eab..eb09d83c73 100644 --- a/src/d/actor/d_a_L7low_dr.cpp +++ b/src/d/actor/d_a_L7low_dr.cpp @@ -124,7 +124,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { int daL7lowDr_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("L7lowDr", 10); JUT_ASSERT(244, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("L7lowDr", 4), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("L7lowDr", 4), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_L7op_demo_dr.cpp b/src/d/actor/d_a_L7op_demo_dr.cpp index e707f4d554..be116c9bea 100644 --- a/src/d/actor/d_a_L7op_demo_dr.cpp +++ b/src/d/actor/d_a_L7op_demo_dr.cpp @@ -756,7 +756,7 @@ static int daL7ODR_Delete(daL7ODR_c* i_this) { int daL7ODR_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("B_dr", 0x49); JUT_ASSERT(1146, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_dr", 0x2F), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_dr", 0x2F), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); field_0x890 = 0x2F; if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_alink.cpp b/src/d/actor/d_a_alink.cpp index 5a7f79c5c3..a8cbc51f4a 100644 --- a/src/d/actor/d_a_alink.cpp +++ b/src/d/actor/d_a_alink.cpp @@ -4105,11 +4105,16 @@ J3DModel* daAlink_c::initModel(J3DModelData* i_modelData, u32 i_mdlFlags, u32 i_ int warpMaterial = false; if (texNo >= 0) { +#if TARGET_PC + u8* imgData = tex->getImgDataPtr(texNo); + if (mpWarpTexData == imgData) + warpMaterial = true; +#else ResTIMG* timg = tex->getResTIMG(texNo); - if (mpWarpTexData == (void*)((uintptr_t)timg + timg->imageOffset)) { warpMaterial = true; } +#endif } if (warpMaterial) { @@ -4151,7 +4156,7 @@ int daAlink_c::initDemoModel(J3DModel** i_ppmodel, char const* i_resName, u32 i_ int daAlink_c::initDemoBck(mDoExt_bckAnm** i_ppbck, char const* i_resName) { J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(dStage_roomControl_c::getDemoArcName(), i_resName); if (bck != NULL) { - *i_ppbck = new mDoExt_bckAnm(); + *i_ppbck = JKR_NEW mDoExt_bckAnm(); if (*i_ppbck == NULL) { return 0; @@ -4216,7 +4221,7 @@ int daAlink_c::createHeap() { return 0; } - mpHIO = new daAlinkHIO_c(); + mpHIO = JKR_NEW daAlinkHIO_c(); if (mpHIO == NULL) { return 0; } @@ -4242,33 +4247,33 @@ int daAlink_c::createHeap() { } int sp38 = 40; - J3DTransformInfo* sp1C = new J3DTransformInfo[sp38]; + J3DTransformInfo* sp1C = JKR_NEW J3DTransformInfo[sp38]; if (sp1C == NULL) { return 0; } - Quaternion* sp30 = new Quaternion[sp38]; + Quaternion* sp30 = JKR_NEW Quaternion[sp38]; if (sp30 == NULL) { return 0; } - field_0x2060 = new mDoExt_MtxCalcOldFrame(sp1C, sp30); + field_0x2060 = JKR_NEW mDoExt_MtxCalcOldFrame(sp1C, sp30); if (field_0x2060 == NULL) { return 0; } - field_0x1f20 = new mDoExt_MtxCalcAnmBlendTblOld(field_0x2060, 3, mNowAnmPackUnder); + field_0x1f20 = JKR_NEW mDoExt_MtxCalcAnmBlendTblOld(field_0x2060, 3, mNowAnmPackUnder); if (field_0x1f20 == NULL) { return 0; } - field_0x1f24 = new mDoExt_MtxCalcAnmBlendTblOld(field_0x2060, 3, mNowAnmPackUpper); + field_0x1f24 = JKR_NEW mDoExt_MtxCalcAnmBlendTblOld(field_0x2060, 3, mNowAnmPackUpper); if (field_0x1f24 == NULL) { return 0; } for (int i = 0; i < 2; i++) { - field_0x2180[i] = new daAlink_matAnm_c(); + field_0x2180[i] = JKR_NEW daAlink_matAnm_c(); if (field_0x2180[i] == NULL) { return 0; } @@ -4279,7 +4284,7 @@ int daAlink_c::createHeap() { return 0; } - field_0x2d78 = new (0x20) u8[0x800]; + field_0x2d78 = JKR_NEW_ARGS (0x20) u8[0x800]; if (field_0x2d78 == NULL) { return 0; } @@ -4307,7 +4312,7 @@ int daAlink_c::createHeap() { } if (mpDemoFCBlendModel != NULL) { - field_0x069c = new mDoExt_blkAnm(); + field_0x069c = JKR_NEW mDoExt_blkAnm(); if (field_0x069c == NULL) { return 0; } @@ -14215,7 +14220,7 @@ BOOL daAlink_c::checkMagicArmorWearAbility() const { J3DModelData* daAlink_c::loadAramBmd(u16 i_resIdx, u32 i_bufSize) { JKRArchive* anmArchive = dComIfGp_getAnmArchive(); - u8* tmpBuffer = new (0x20) u8[i_bufSize]; + u8* tmpBuffer = JKR_NEW_ARGS (0x20) u8[i_bufSize]; JKRReadIdxResource(tmpBuffer, i_bufSize, i_resIdx, anmArchive); #if DEBUG @@ -14236,7 +14241,7 @@ J3DModelData* daAlink_c::loadAramBmd(u16 i_resIdx, u32 i_bufSize) { } void* daAlink_c::loadAram(u16 i_resIdx, u32 i_bufSize) { - u8* tmpBuffer = new (0x20) u8[i_bufSize]; + u8* tmpBuffer = JKR_NEW_ARGS (0x20) u8[i_bufSize]; JKRReadIdxResource(tmpBuffer, i_bufSize, i_resIdx, dComIfGp_getAnmArchive()); #if DEBUG daPy_aramBufferCheck(tmpBuffer, i_bufSize); diff --git a/src/d/actor/d_a_alink_HIO.inc b/src/d/actor/d_a_alink_HIO.inc index a2692ae4ad..ba2b27ef40 100644 --- a/src/d/actor/d_a_alink_HIO.inc +++ b/src/d/actor/d_a_alink_HIO.inc @@ -5166,8 +5166,8 @@ void daAlinkHIO_c::listenPropertyEvent(const JORPropertyEvent* event) { } case PROPERTY_SAVE_FILE_e: { if (file.open(6, "すべてのファイル(*.*)\0*.*\0", NULL, NULL, NULL)) { - char* fileData = new (0x20) char[0x10000]; - char* structData = new (0x20) char[0x10000]; + char* fileData = JKR_NEW_ARGS (0x20) char[0x10000]; + char* structData = JKR_NEW_ARGS (0x20) char[0x10000]; if (fileData != NULL && structData != NULL) { size_t dataSize = makeFileOutData(fileData, structData); @@ -5181,15 +5181,15 @@ void daAlinkHIO_c::listenPropertyEvent(const JORPropertyEvent* event) { OS_REPORT("メモリ破壊が起こりました!!!!!\n"); } - delete[] fileData; - delete[] structData; + JKR_DELETE_ARRAY(fileData); + JKR_DELETE_ARRAY(structData); } else { if (fileData != NULL) { - delete[] fileData; + JKR_DELETE_ARRAY(fileData); } if (structData != NULL) { - delete[] structData; + JKR_DELETE_ARRAY(structData); } // Could not secure the write area @@ -5204,12 +5204,12 @@ void daAlinkHIO_c::listenPropertyEvent(const JORPropertyEvent* event) { } case PROPERTY_LOAD_FILE_e: { if (file.open(1, "すべてのファイル(*.*)\0*.*\0", NULL, NULL, NULL)) { - char* fileData = new (0x20) char[0x10000]; + char* fileData = JKR_NEW_ARGS (0x20) char[0x10000]; if (fileData != NULL) { file.readData(fileData, 0); readFileData(fileData); - delete[] fileData; + JKR_DELETE_ARRAY(fileData); } else { // Could not secure the read area OS_REPORT("読み込み用領域確保できませんでした\n"); diff --git a/src/d/actor/d_a_alink_demo.inc b/src/d/actor/d_a_alink_demo.inc index 6ef8241974..2a1c262d35 100644 --- a/src/d/actor/d_a_alink_demo.inc +++ b/src/d/actor/d_a_alink_demo.inc @@ -693,7 +693,7 @@ void daAlink_c::setDemoData() { mDemo.setSystemDemoType(); } - char* cut_name = dComIfGp_getPEvtManager()->getMyNowCutName(mAlinkStaffId); + char* cut_name = dComIfGp_getPEvtManager()->getMyNowCutNameStr(mAlinkStaffId); if (cut_name != NULL) { // Take the first 3 chars in cut_name, convert them to integers, and calculate demo_mode demo_mode = ((cut_name[0] - '0') * 100) + ((cut_name[1] - '0') * 10) + (cut_name[2] - '0'); diff --git a/src/d/actor/d_a_alink_effect.inc b/src/d/actor/d_a_alink_effect.inc index ebeb985744..af214d6b41 100644 --- a/src/d/actor/d_a_alink_effect.inc +++ b/src/d/actor/d_a_alink_effect.inc @@ -2092,7 +2092,7 @@ BOOL daAlink_lockCursor_c::create() { field_0x4 = false; field_0x30 = 0.0f; - mScrn = new J2DScreen(); + mScrn = JKR_NEW J2DScreen(); if (mScrn == NULL) { return false; } diff --git a/src/d/actor/d_a_alink_hook.inc b/src/d/actor/d_a_alink_hook.inc index 5f609a7017..db1f91c386 100644 --- a/src/d/actor/d_a_alink_hook.inc +++ b/src/d/actor/d_a_alink_hook.inc @@ -24,10 +24,10 @@ void daAlink_c::hsChainShape_c::draw() { J3DModelData* modelData = alink->getItemModelData(); J3DMaterial* material = modelData->getMaterialNodePointer(0); daAlink_hsChainLight_c* chainLight = (daAlink_hsChainLight_c*)&alink->tevStr; - - j3dSys.setVtxPos(modelData->getVtxPosArray()); - j3dSys.setVtxNrm(modelData->getVtxNrmArray()); - j3dSys.setVtxCol(modelData->getVtxColorArray(0)); + + j3dSys.setVtxPos(modelData->getVtxPosArray(), modelData->getVtxNum()); + j3dSys.setVtxNrm(modelData->getVtxNrmArray(), modelData->getNrmNum()); + j3dSys.setVtxCol(modelData->getVtxColorArray(0), modelData->getColNum()); J3DShape::resetVcdVatCache(); material->loadSharedDL(); @@ -399,10 +399,10 @@ void daAlink_c::setHookshotModel() { field_0x0714 = initModel(mpHookTipModel->getModelData(), 0); mpItemModelData = loadAramBmd(dRes_ID_ALANM_BMD_AL_HS_KUSARI_e, 0x1000); - mpHookChain = new hsChainShape_c(); - mpHookSound = new Z2SoundObjSimple(); + mpHookChain = JKR_NEW hsChainShape_c(); + mpHookSound = JKR_NEW Z2SoundObjSimple(); - mpHookshotLinChk = new dBgS_ObjLinChk(); + mpHookshotLinChk = JKR_NEW dBgS_ObjLinChk(); mpHookshotLinChk->OffFullGrp(); mpHookshotLinChk->OnWaterGrp(); diff --git a/src/d/actor/d_a_alink_ironball.inc b/src/d/actor/d_a_alink_ironball.inc index c0c4d6508a..043d3490b3 100644 --- a/src/d/actor/d_a_alink_ironball.inc +++ b/src/d/actor/d_a_alink_ironball.inc @@ -92,22 +92,22 @@ void daAlink_c::setIronBallModel() { mHeldItemModel = initModelEnv(loadAramBmd(dRes_ID_ALANM_BMD_AL_IB_e, 0x2800), 0); mpItemModelData = loadAramBmd(dRes_ID_ALANM_BMD_AL_HS_KUSARI_e, 0x1000); - mpHookChain = new hsChainShape_c(); + mpHookChain = JKR_NEW hsChainShape_c(); - mIronBallChainPos = new cXyz[102]; - mIronBallChainAngle = new csXyz[102]; - field_0x3848 = new cXyz[102]; + mIronBallChainPos = JKR_NEW cXyz[102]; + mIronBallChainAngle = JKR_NEW csXyz[102]; + field_0x3848 = JKR_NEW cXyz[102]; - field_0x0774 = new dBgS_AcchCir(); - field_0x0778 = new dBgS_ObjAcch(); - mpHookSound = new Z2SoundObjSimple(); + field_0x0774 = JKR_NEW dBgS_AcchCir(); + field_0x0778 = JKR_NEW dBgS_ObjAcch(); + mpHookSound = JKR_NEW Z2SoundObjSimple(); - mpHookshotLinChk = new dBgS_ObjLinChk(); + mpHookshotLinChk = JKR_NEW dBgS_ObjLinChk(); mpHookshotLinChk->OffFullGrp(); mpHookshotLinChk->OnWaterGrp(); - field_0x780 = new dBgS_ObjLinChk(); - field_0x2f1c = new dPaPo_c(); + field_0x780 = JKR_NEW dBgS_ObjLinChk(); + field_0x2f1c = JKR_NEW dPaPo_c(); field_0x2f1c->init(field_0x0778, 32.0f, 64.0f); mDoExt_setCurrentHeap(prev_heap); diff --git a/src/d/actor/d_a_alink_swindow.inc b/src/d/actor/d_a_alink_swindow.inc index 63d4765864..3f2a12a03a 100644 --- a/src/d/actor/d_a_alink_swindow.inc +++ b/src/d/actor/d_a_alink_swindow.inc @@ -239,7 +239,7 @@ void daAlink_c::changeModelDataDirectWolf(int param_0) { void daAlink_c::initStatusWindow() { onNoResetFlg2(FLG2_STATUS_WINDOW_DRAW); - void* tmpBuffer = new (0x20) void*[0x500]; + void* tmpBuffer = JKR_NEW_ARGS (0x20) void*[0x500]; JUT_ASSERT(394, tmpBuffer); u16 bckResIdx, btpResIdx, btkResIdx; @@ -261,14 +261,14 @@ void daAlink_c::initStatusWindow() { } JKRReadIdxResource(tmpBuffer, 0x1400, bckResIdx, dComIfGp_getAnmArchive()); - m_sWindowBck = new mDoExt_bckAnm(); + m_sWindowBck = JKR_NEW mDoExt_bckAnm(); JUT_ASSERT(428, m_sWindowBck); if (!m_sWindowBck->init((J3DAnmTransform*)J3DAnmLoaderDataBase::load(tmpBuffer), TRUE, 2, 1.0f, 0, -1, false)) { JUT_ASSERT(433, FALSE); } - tmpBuffer = new (0x20) void*[0x100]; + tmpBuffer = JKR_NEW_ARGS (0x20) void*[0x100]; JUT_ASSERT(437, tmpBuffer); JKRReadIdxResource(tmpBuffer, 0x400, btpResIdx, dComIfGp_getAnmArchive()); @@ -278,7 +278,7 @@ void daAlink_c::initStatusWindow() { btp->searchUpdateMaterialID(field_0x06c0); field_0x06c0->entryTexNoAnimator(btp); - tmpBuffer = new (0x20) void*[0x100]; + tmpBuffer = JKR_NEW_ARGS (0x20) void*[0x100]; JUT_ASSERT(449, tmpBuffer); JKRReadIdxResource(tmpBuffer, 0x400, btkResIdx, dComIfGp_getAnmArchive()); diff --git a/src/d/actor/d_a_alink_wolf.inc b/src/d/actor/d_a_alink_wolf.inc index bc08d64039..7e87b519b1 100644 --- a/src/d/actor/d_a_alink_wolf.inc +++ b/src/d/actor/d_a_alink_wolf.inc @@ -6810,7 +6810,7 @@ void daAlink_c::setWolfBallModel() { field_0x0718 = static_cast(dComIfG_getObjectRes(l_arcName, 0x49)); field_0x0718->searchUpdateMaterialID(mHeldItemModel->getModelData()); - mpHookSound = new Z2SoundObjSimple(); + mpHookSound = JKR_NEW Z2SoundObjSimple(); mDoExt_setCurrentHeap(prev_heap); mEquipItem = 0x10A; diff --git a/src/d/actor/d_a_b_bh.cpp b/src/d/actor/d_a_b_bh.cpp index 777fa09d40..8434f9ab43 100644 --- a/src/d/actor/d_a_b_bh.cpp +++ b/src/d/actor/d_a_b_bh.cpp @@ -1427,7 +1427,7 @@ static int daB_BH_Delete(b_bh_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { b_bh_class* a_this = (b_bh_class*)i_this; - a_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_BH", BMDV_BH), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_BH", 12), 2, 1.0f, 0, -1, &a_this->mSound, 0, 0x11000084); + a_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_BH", BMDV_BH), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_BH", 12), 2, 1.0f, 0, -1, &a_this->mSound, 0, 0x11000084); if (a_this->mpModelMorf == NULL || a_this->mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_bq.cpp b/src/d/actor/d_a_b_bq.cpp index 4b4af6a06f..1dae7be2d5 100644 --- a/src/d/actor/d_a_b_bq.cpp +++ b/src/d/actor/d_a_b_bq.cpp @@ -2427,7 +2427,7 @@ static int daB_BQ_Delete(b_bq_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { b_bq_class* a_this = (b_bq_class*)i_this; - a_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_bq", BMDV_BQ), NULL, + a_this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_bq", BMDV_BQ), NULL, NULL, NULL, J3DFrameCtrl::EMode_LOOP, 0.6f, 0, -1, &a_this->mSound, 0, 0x11000284); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { @@ -2441,7 +2441,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - a_this->mpDeadBrk = new mDoExt_brkAnm(); + a_this->mpDeadBrk = JKR_NEW mDoExt_brkAnm(); if (a_this->mpDeadBrk == NULL) { return false; } @@ -2455,7 +2455,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { a_this->mpDeadBrk->setPlaySpeed(0.0f); - a_this->mpTodomeBtk = new mDoExt_btkAnm(); + a_this->mpTodomeBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpTodomeBtk == NULL) { return false; } diff --git a/src/d/actor/d_a_b_dr.cpp b/src/d/actor/d_a_b_dr.cpp index b47801849d..4317585bbc 100644 --- a/src/d/actor/d_a_b_dr.cpp +++ b/src/d/actor/d_a_b_dr.cpp @@ -4000,12 +4000,12 @@ int daB_DR_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("B_DR", 0x49); JUT_ASSERT(6324, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_DR", 0x2F), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_DR", 0x2F), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } - mpCoreBrk = new mDoExt_brkAnm(); + mpCoreBrk = JKR_NEW mDoExt_brkAnm(); if (mpCoreBrk == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_dre.cpp b/src/d/actor/d_a_b_dre.cpp index 8701a1f261..f11d6fa312 100644 --- a/src/d/actor/d_a_b_dre.cpp +++ b/src/d/actor/d_a_b_dre.cpp @@ -21,18 +21,18 @@ int daB_DRE_c::CreateHeap() { JUT_ASSERT(0xB4, modelData != NULL); if (mAction == 0) { - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_DR", 0x1D), 0, 1.0f, 0, -1, &mSound, 0, 0x11000084); } else { - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_DR", 0x1F), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } - mpCoreBrk = new mDoExt_brkAnm(); + mpCoreBrk = JKR_NEW mDoExt_brkAnm(); if (mpCoreBrk == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_ds.cpp b/src/d/actor/d_a_b_ds.cpp index 2f903c2d2d..630cc428b9 100644 --- a/src/d/actor/d_a_b_ds.cpp +++ b/src/d/actor/d_a_b_ds.cpp @@ -5308,7 +5308,7 @@ int daB_DS_c::CreateHeap() { JUT_ASSERT(0, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO( + mpMorf = JKR_NEW mDoExt_McaMorfSO( modelData, NULL, NULL, static_cast(dComIfG_getObjectRes("B_DS", anm_res)), 0, 1.0f, 0, -1, &mSound, 0, 0x11000084); if (mpMorf == NULL || mpMorf->getModel() == NULL) { @@ -5326,14 +5326,14 @@ int daB_DS_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("B_DS", 74); JUT_ASSERT(0, modelData != NULL); - mpSwordMorf = new mDoExt_McaMorfSO( + mpSwordMorf = JKR_NEW mDoExt_McaMorfSO( modelData, NULL, NULL, static_cast(dComIfG_getObjectRes("B_DS", 63)), 0, 1.0f, 0, -1, NULL, 0, 0x11000084); if (mpSwordMorf == NULL || mpSwordMorf->getModel() == NULL) { return 0; } - mpSwordBrkAnm = new mDoExt_brkAnm(); + mpSwordBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpSwordBrkAnm == NULL) { return 0; } @@ -5348,7 +5348,7 @@ int daB_DS_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("B_DS", 75); JUT_ASSERT(0, modelData != NULL); - mpZantMorf = new mDoExt_McaMorfSO( + mpZantMorf = JKR_NEW mDoExt_McaMorfSO( modelData, NULL, NULL, static_cast(dComIfG_getObjectRes("B_DS", 66)), 2, 1.0f, 0, -1, NULL, 0, 0x11000084); if (mpZantMorf == NULL || mpZantMorf->getModel() == NULL) { @@ -5363,7 +5363,7 @@ int daB_DS_c::CreateHeap() { return 0; } - mpOpPatternBrkAnm = new mDoExt_brkAnm(); + mpOpPatternBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpOpPatternBrkAnm == NULL) { return 0; } @@ -5375,7 +5375,7 @@ int daB_DS_c::CreateHeap() { return 0; } - mpOpPatternBtkAnm = new mDoExt_btkAnm(); + mpOpPatternBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpOpPatternBtkAnm == NULL) { return 0; } @@ -5395,7 +5395,7 @@ int daB_DS_c::CreateHeap() { return 0; } - mpPatternBrkAnm = new mDoExt_brkAnm(); + mpPatternBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpPatternBrkAnm == NULL) { return 0; } @@ -5407,7 +5407,7 @@ int daB_DS_c::CreateHeap() { return 0; } - mpPatternBtkAnm = new mDoExt_btkAnm(); + mpPatternBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpPatternBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_gg.cpp b/src/d/actor/d_a_b_gg.cpp index 212225ece2..c491aebd83 100644 --- a/src/d/actor/d_a_b_gg.cpp +++ b/src/d/actor/d_a_b_gg.cpp @@ -155,7 +155,7 @@ int daB_GG_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("B_gg", 0x23); JUT_ASSERT(207, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gg", 0xE), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gg", 0xE), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_gm.cpp b/src/d/actor/d_a_b_gm.cpp index 99a0f3bd73..411ab4bad1 100644 --- a/src/d/actor/d_a_b_gm.cpp +++ b/src/d/actor/d_a_b_gm.cpp @@ -2013,7 +2013,7 @@ static int daB_GM_Delete(b_gm_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { b_gm_class* a_this = (b_gm_class*)i_this; - a_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_gm", 0x25), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gm", 30), 2, 0.6f, 0, -1, &a_this->mCreatureSound, 0, 0x11000284); + a_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_gm", 0x25), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gm", 30), 2, 0.6f, 0, -1, &a_this->mCreatureSound, 0, 0x11000284); if (a_this->mpModelMorf == NULL || a_this->mpModelMorf->getModel() == NULL) { return 0; } @@ -2025,7 +2025,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - a_this->mpZoomBtk = new mDoExt_btkAnm(); + a_this->mpZoomBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpZoomBtk == NULL) { return 0; } @@ -2035,12 +2035,12 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpBeamModelMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_gm", 0x21), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gm", 7), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); + a_this->mpBeamModelMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_gm", 0x21), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gm", 7), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); if (a_this->mpBeamModelMorf == NULL || a_this->mpBeamModelMorf->getModel() == NULL) { return 0; } - a_this->mpBeamBtk = new mDoExt_btkAnm(); + a_this->mpBeamBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpBeamBtk == NULL) { return 0; } @@ -2061,7 +2061,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { a_this->mSpotLightSize[i] = 1.0f; } - a_this->mpSpotLightBtk = new mDoExt_btkAnm(); + a_this->mpSpotLightBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpSpotLightBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_gnd.cpp b/src/d/actor/d_a_b_gnd.cpp index 76cbb32249..cf36e35952 100644 --- a/src/d/actor/d_a_b_gnd.cpp +++ b/src/d/actor/d_a_b_gnd.cpp @@ -4592,7 +4592,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { static int const blur_model[2] = {0x66, 0x65}; static int btk_d[6] = {0x77, 0x76, 0x73, 0x74, 0x75, 0x72}; - i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_gnd", 0x69), + i_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_gnd", 0x69), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gnd", 0x4b), 2, 1.0f, 0, -1, &i_this->mGndSound, 0, 0x11020284); @@ -4610,7 +4610,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { mDoMtx_stack_c::scaleS(0.0f, 0.0f, 0.0f); model->setBaseTRMtx(mDoMtx_stack_c::get()); - i_this->mpGndCoreBrk = new mDoExt_brkAnm(); + i_this->mpGndCoreBrk = JKR_NEW mDoExt_brkAnm(); if (i_this->mpGndCoreBrk == NULL) { return 0; } @@ -4622,7 +4622,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { } for (int i = 0; i < 6; i++) { - i_this->mpGndEyeBtk[i] = new mDoExt_btkAnm(); + i_this->mpGndEyeBtk[i] = JKR_NEW mDoExt_btkAnm(); if (i_this->mpGndEyeBtk[i] == NULL) { return 0; } @@ -4634,7 +4634,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { } } - i_this->mpGndEyeBtp = new mDoExt_btpAnm(); + i_this->mpGndEyeBtp = JKR_NEW mDoExt_btpAnm(); if (i_this->mpGndEyeBtp == NULL) { return 0; } @@ -4690,7 +4690,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { i_this->mpMantShadowModel[i]->setBaseTRMtx(mDoMtx_stack_c::get()); } - i_this->mpHorseMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_hg", 19), + i_this->mpHorseMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_hg", 19), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_hg", 15), 2, 1.0f, 0, -1, &i_this->mHorseSound, 0x80000, 0x11000084); if (i_this->mpHorseMorf == NULL || i_this->mpHorseMorf->getModel() == NULL) { @@ -4728,14 +4728,14 @@ static int useHeapInit(fopAc_ac_c* a_this) { size++; } - i_this->mpZeldaModel = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_gnd", 0x6a), + i_this->mpZeldaModel = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_gnd", 0x6a), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gnd", 0x5e), 0, 1.0f, 0, -1, 1, NULL, 0, 0x11020284); if (i_this->mpZeldaModel == NULL || i_this->mpZeldaModel->getModel() == NULL) { return 0; } - i_this->mpZeldaBtk = new mDoExt_btkAnm(); + i_this->mpZeldaBtk = JKR_NEW mDoExt_btkAnm(); if (i_this->mpZeldaBtk == NULL) { return 0; } @@ -4746,7 +4746,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { return 0; } - i_this->mpZeldaBtp = new mDoExt_btpAnm(); + i_this->mpZeldaBtp = JKR_NEW mDoExt_btpAnm(); if (i_this->mpZeldaBtp == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_go.cpp b/src/d/actor/d_a_b_go.cpp index 6f593b1597..5189a6e9b6 100644 --- a/src/d/actor/d_a_b_go.cpp +++ b/src/d/actor/d_a_b_go.cpp @@ -209,7 +209,7 @@ static int daB_GO_Delete(b_go_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { b_go_class* a_this = (b_go_class*)i_this; - a_this->mpMorf = new mDoExt_McaMorfSO( + a_this->mpMorf = JKR_NEW mDoExt_McaMorfSO( (J3DModelData*)dComIfG_getObjectRes("B_go", RES_IS_MODEL), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_go", ANM_WAIT_03), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_b_gos.cpp b/src/d/actor/d_a_b_gos.cpp index a71b100158..076a40ba3a 100644 --- a/src/d/actor/d_a_b_gos.cpp +++ b/src/d/actor/d_a_b_gos.cpp @@ -328,7 +328,7 @@ static int daB_GOS_Delete(b_gos_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { b_gos_class* a_this = (b_gos_class*)i_this; - a_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_gos", 9), NULL, + a_this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_gos", 9), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_gos", 6), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_b_mgn.cpp b/src/d/actor/d_a_b_mgn.cpp index a050b672ca..6707c2c745 100644 --- a/src/d/actor/d_a_b_mgn.cpp +++ b/src/d/actor/d_a_b_mgn.cpp @@ -3387,7 +3387,7 @@ static int daB_MGN_Delete(daB_MGN_c* i_this) { int daB_MGN_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("B_mgn", BMDR_MGN); JUT_ASSERT(4010, modelData != NULL); - mpMgnModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMgnModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_mgn", BCK_MGN_WAIT),2, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, 0x11000284); if (mpMgnModelMorf == NULL || mpMgnModelMorf->getModel() == NULL) { @@ -3403,7 +3403,7 @@ int daB_MGN_c::CreateHeap() { } } - mpMgnCoreBrk = new mDoExt_brkAnm(); + mpMgnCoreBrk = JKR_NEW mDoExt_brkAnm(); if (mpMgnCoreBrk == NULL) { return 0; } @@ -3414,7 +3414,7 @@ int daB_MGN_c::CreateHeap() { return 0; } - mpMgnBtk = new mDoExt_btkAnm(); + mpMgnBtk = JKR_NEW mDoExt_btkAnm(); if (mpMgnBtk == NULL) { return 0; } @@ -3440,14 +3440,14 @@ int daB_MGN_c::CreateHeap() { JUT_ASSERT(4084, modelData != NULL); for (int i = 0; i < 4; i++) { - mpGdgateModelMorf[i] = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpGdgateModelMorf[i] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_mgne", BCK_EF_GDGATE_START), 0, 0.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, 0x11000284); if (mpGdgateModelMorf[i] == NULL || mpGdgateModelMorf[i]->getModel() == NULL) { return 0; } - mpGdgateStartBrk[i] = new mDoExt_brkAnm(); + mpGdgateStartBrk[i] = JKR_NEW mDoExt_brkAnm(); if (mpGdgateStartBrk[i] == NULL) { return 0; } @@ -3459,7 +3459,7 @@ int daB_MGN_c::CreateHeap() { return 0; } - mpGdgateAppearBrk[i] = new mDoExt_brkAnm(); + mpGdgateAppearBrk[i] = JKR_NEW mDoExt_brkAnm(); if (mpGdgateAppearBrk[i] == NULL) { return 0; } @@ -3471,7 +3471,7 @@ int daB_MGN_c::CreateHeap() { return 0; } - mpGdgateBtk[i] = new mDoExt_btkAnm(); + mpGdgateBtk[i] = JKR_NEW mDoExt_btkAnm(); if (mpGdgateBtk[i] == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_ob.cpp b/src/d/actor/d_a_b_ob.cpp index 41c2bdddbf..78975ef231 100644 --- a/src/d/actor/d_a_b_ob.cpp +++ b/src/d/actor/d_a_b_ob.cpp @@ -3290,7 +3290,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { b_ob_class* a_this = (b_ob_class*)i_this; a_this->mpCoreMorf = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDV_OH_CORE), NULL, NULL, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDV_OH_CORE), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_oh", BCK_OH_CORE_OPEN), 2, 1.0f, 0, -1, &a_this->mSound, 0, 0x11000084); @@ -3304,7 +3304,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } a_this->mBodyParts[i].mpMorf = - new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", p_bmd[i]), NULL, NULL, + JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", p_bmd[i]), NULL, NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, var_r31, 0x11000084); if (a_this->mBodyParts[i].mpMorf == NULL || @@ -3335,7 +3335,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { if (i >= 4 && i <= 17) { a_this->mBodyParts[i].mpFinMorf = - new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDR_OI_FINA), NULL, NULL, + JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDR_OI_FINA), NULL, NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (a_this->mBodyParts[i].mpFinMorf == NULL || @@ -3366,7 +3366,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { if (i >= 7 && i <= 15) { a_this->mBodyParts[i].mpFinUnkMorf = - new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDR_OI_FINA), NULL, NULL, + JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDR_OI_FINA), NULL, NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (a_this->mBodyParts[i].mpFinUnkMorf == NULL || @@ -3391,7 +3391,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { if (i == 8) { a_this->mBodyParts[i].mpFinBMorf = - new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDR_OI_FINB), NULL, NULL, + JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDR_OI_FINB), NULL, NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (a_this->mBodyParts[i].mpFinBMorf == NULL || @@ -3416,7 +3416,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { if (i == 17) { a_this->mBodyParts[i].mpFinCMorf = - new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDR_OI_FINC), NULL, NULL, + JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDR_OI_FINC), NULL, NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (a_this->mBodyParts[i].mpFinCMorf == NULL || @@ -3454,7 +3454,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { modelData->getJointNodePointer(j)->setCallBack(sui_nodeCallBack); } - a_this->mpSuiBrk = new mDoExt_brkAnm(); + a_this->mpSuiBrk = JKR_NEW mDoExt_brkAnm(); if (a_this->mpSuiBrk == NULL) { return 0; } @@ -3463,7 +3463,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpSuiBtk = new mDoExt_btkAnm(); + a_this->mpSuiBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpSuiBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_oh.cpp b/src/d/actor/d_a_b_oh.cpp index 69d2be6184..f453d9909d 100644 --- a/src/d/actor/d_a_b_oh.cpp +++ b/src/d/actor/d_a_b_oh.cpp @@ -705,7 +705,7 @@ static int daB_OH_Delete(b_oh_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { b_oh_class* this_ = (b_oh_class*)i_this; - this_->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDV_OH), NULL, + this_->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", BMDV_OH), NULL, NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, 0, 0x11000284); if (this_->mpMorf == NULL || this_->mpMorf->getModel() == NULL) { return 0; @@ -722,7 +722,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { nodeCallBack); } - this_->mpBtk = new mDoExt_btkAnm(); + this_->mpBtk = JKR_NEW mDoExt_btkAnm(); if (this_->mpBtk == NULL) { return 0; } @@ -735,7 +735,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { this_->mpBtk->setFrame(cM_rndF(39.0f)); this_->mpBtk->setPlaySpeed(cM_rndFX(0.1f) + 1.0f); - this_->mpBrk = new mDoExt_brkAnm(); + this_->mpBrk = JKR_NEW mDoExt_brkAnm(); if (this_->mpBrk == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_oh2.cpp b/src/d/actor/d_a_b_oh2.cpp index b69e0cde42..b124e13a1d 100644 --- a/src/d/actor/d_a_b_oh2.cpp +++ b/src/d/actor/d_a_b_oh2.cpp @@ -217,7 +217,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { b_oh2_class* _this = static_cast(i_this); _this->mpMorf = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_oh", 0x29), NULL, NULL, NULL, 2, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("B_oh", 0x29), NULL, NULL, NULL, 2, 1.0f, 0, -1, &_this->mZ2Enemy, 0, 0x11000284); if (_this->mpMorf == NULL || _this->mpMorf->getModel() == NULL) { @@ -235,7 +235,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { nodeCallBack); } - _this->mpBtk = new mDoExt_btkAnm(); + _this->mpBtk = JKR_NEW mDoExt_btkAnm(); if (_this->mpBtk == NULL) { return 0; } @@ -248,7 +248,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { _this->mpBtk->setFrame(cM_rndF(39.0f)); _this->mpBtk->setPlaySpeed(cM_rndFX(0.1f) + 1.0f); - _this->mpBrk = new mDoExt_brkAnm(); + _this->mpBrk = JKR_NEW mDoExt_brkAnm(); if (_this->mpBrk == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_tn.cpp b/src/d/actor/d_a_b_tn.cpp index 137195e838..3dacaa507f 100644 --- a/src/d/actor/d_a_b_tn.cpp +++ b/src/d/actor/d_a_b_tn.cpp @@ -4938,7 +4938,7 @@ int daB_TN_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("B_tnp2", BMDR_TN2); } - mpModelMorf2 = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpModelMorf2 = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_tn", BCK_TNA_WAIT), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf2 == NULL || mpModelMorf2->getModel() == NULL) { @@ -4946,7 +4946,7 @@ int daB_TN_c::CreateHeap() { } if (mType == 1) { - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -4986,7 +4986,7 @@ int daB_TN_c::CreateHeap() { } if (sVar1 != -1) { - mpBrkAnms[i] = new mDoExt_brkAnm(); + mpBrkAnms[i] = JKR_NEW mDoExt_brkAnm(); mDoExt_brkAnm* myanm = mpBrkAnms[i]; if (myanm == NULL) { @@ -5006,7 +5006,7 @@ int daB_TN_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes(mArcName, tn_part_model_id[mType * 0x10 + 0xf]); - mpModelMorf1 = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpModelMorf1 = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_tn", BCK_TNB_SWORD_B_PULL_A), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf1 == NULL || mpModelMorf1->getModel() == NULL) { diff --git a/src/d/actor/d_a_b_yo.cpp b/src/d/actor/d_a_b_yo.cpp index e358f7786c..188e2ce76e 100644 --- a/src/d/actor/d_a_b_yo.cpp +++ b/src/d/actor/d_a_b_yo.cpp @@ -3110,7 +3110,7 @@ int daB_YO_c::CreateHeap() { } model_data = (J3DModelData*)dComIfG_getObjectRes("B_YO", BMDE_YKW_B); - mpYetaMorf = new mDoExt_McaMorfSO( + mpYetaMorf = JKR_NEW mDoExt_McaMorfSO( model_data, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_YO", BCK_YKW_B_WAITA), J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, &mCreatureSound, 0, 0x11020284 ); @@ -3118,7 +3118,7 @@ int daB_YO_c::CreateHeap() { return 0; } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } @@ -3129,7 +3129,7 @@ int daB_YO_c::CreateHeap() { } model_data = mpYetaMorf->getModel()->getModelData(); - mpYetaBtkAnm = new mDoExt_btkAnm(); + mpYetaBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpYetaBtkAnm == NULL) { return 0; } @@ -3138,7 +3138,7 @@ int daB_YO_c::CreateHeap() { return 0; } - mpYetaBtpAnm = new mDoExt_btpAnm(); + mpYetaBtpAnm = JKR_NEW mDoExt_btpAnm(); if (mpYetaBtpAnm == NULL) { return 5; } @@ -3147,7 +3147,7 @@ int daB_YO_c::CreateHeap() { return 5; } - mpYetaBrkAnm = new mDoExt_brkAnm(); + mpYetaBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpYetaBrkAnm == NULL) { return 0; } @@ -3156,7 +3156,7 @@ int daB_YO_c::CreateHeap() { return 0; } - mpYetaWhiteBrkAnm = new mDoExt_brkAnm(); + mpYetaWhiteBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpYetaWhiteBrkAnm == NULL) { return 0; } @@ -3165,7 +3165,7 @@ int daB_YO_c::CreateHeap() { return 0; } - mpRoomNormalBgW = new dBgW(); + mpRoomNormalBgW = JKR_NEW dBgW(); if (mpRoomNormalBgW == NULL) { return 0; } @@ -3181,7 +3181,7 @@ int daB_YO_c::CreateHeap() { return 0; } - mpRoomArenaBgW = new dBgW(); + mpRoomArenaBgW = JKR_NEW dBgW(); if (mpRoomArenaBgW == NULL) { return 0; } @@ -3204,7 +3204,7 @@ int daB_YO_c::CreateHeap() { } model_data = (J3DModelData*)dComIfG_getObjectRes("ykW", 0xb); - mpYetaRevertedMorf = new mDoExt_McaMorfSO( + mpYetaRevertedMorf = JKR_NEW mDoExt_McaMorfSO( model_data, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("ykW1", 0x1a), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, &mCreatureSound, 0, 0x11000084 ); @@ -3220,7 +3220,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } int daB_YO_c::CreateHeap2() { - mpRoomNormalBgW = new dBgW(); + mpRoomNormalBgW = JKR_NEW dBgW(); if (mpRoomNormalBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_zant.cpp b/src/d/actor/d_a_b_zant.cpp index 4a95154130..b36dc76e92 100644 --- a/src/d/actor/d_a_b_zant.cpp +++ b/src/d/actor/d_a_b_zant.cpp @@ -5382,7 +5382,7 @@ static int daB_ZANT_Delete(daB_ZANT_c* i_this) { int daB_ZANT_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("B_zan", BMDR_ZAN); JUT_ASSERT(0, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_zan", BCK_ZAN_FLOAT_WAIT), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_zan", BCK_ZAN_FLOAT_WAIT), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } @@ -5397,7 +5397,7 @@ int daB_ZANT_c::CreateHeap() { return 0; } - mpMahojinEndBrk = new mDoExt_brkAnm(); + mpMahojinEndBrk = JKR_NEW mDoExt_brkAnm(); if (mpMahojinEndBrk == NULL) { return 0; } @@ -5406,7 +5406,7 @@ int daB_ZANT_c::CreateHeap() { return 0; } - mpMahojinBtk = new mDoExt_btkAnm(); + mpMahojinBtk = JKR_NEW mDoExt_btkAnm(); if (mpMahojinBtk == NULL) { return 0; } @@ -5415,7 +5415,7 @@ int daB_ZANT_c::CreateHeap() { return 0; } - mpMahojinStartBtk = new mDoExt_btkAnm(); + mpMahojinStartBtk = JKR_NEW mDoExt_btkAnm(); if (mpMahojinStartBtk == NULL) { return 0; } @@ -5429,7 +5429,7 @@ int daB_ZANT_c::CreateHeap() { return 0; } - mpMahojinBrk2 = new mDoExt_brkAnm(); + mpMahojinBrk2 = JKR_NEW mDoExt_brkAnm(); if (mpMahojinBrk2 == NULL) { return 0; } @@ -5438,7 +5438,7 @@ int daB_ZANT_c::CreateHeap() { return 0; } - mpMahojinStartBtk2 = new mDoExt_btkAnm(); + mpMahojinStartBtk2 = JKR_NEW mDoExt_btkAnm(); if (mpMahojinStartBtk2 == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_zant_mobile.cpp b/src/d/actor/d_a_b_zant_mobile.cpp index 7778dadf81..75834871b4 100644 --- a/src/d/actor/d_a_b_zant_mobile.cpp +++ b/src/d/actor/d_a_b_zant_mobile.cpp @@ -403,12 +403,12 @@ int daB_ZANTZ_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("B_zan", daB_ZANT_c::BMDR_ZZ); JUT_ASSERT(0, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_zan", daB_ZANT_c::BCK_ZZ_OPEN), 0, 0.0f, 0, -1, &mSound, 0, 0x11000084); + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("B_zan", daB_ZANT_c::BCK_ZZ_OPEN), 0, 0.0f, 0, -1, &mSound, 0, 0x11000084); if (mpMorf == NULL) { return 0; } - mpBrk = new mDoExt_brkAnm(); + mpBrk = JKR_NEW mDoExt_brkAnm(); if (mpBrk == NULL) { return 0; } @@ -417,7 +417,7 @@ int daB_ZANTZ_c::CreateHeap() { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_b_zant_sima.cpp b/src/d/actor/d_a_b_zant_sima.cpp index 60639516ef..d73919e6af 100644 --- a/src/d/actor/d_a_b_zant_sima.cpp +++ b/src/d/actor/d_a_b_zant_sima.cpp @@ -150,7 +150,7 @@ int daB_ZANTS_c::CreateHeap() { return FALSE; } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return FALSE; } @@ -162,7 +162,7 @@ int daB_ZANTS_c::CreateHeap() { return FALSE; } - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return FALSE; } @@ -174,7 +174,7 @@ int daB_ZANTS_c::CreateHeap() { return FALSE; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return FALSE; } diff --git a/src/d/actor/d_a_balloon_2D.cpp b/src/d/actor/d_a_balloon_2D.cpp index 76b9ce8b3f..d4c82f85aa 100644 --- a/src/d/actor/d_a_balloon_2D.cpp +++ b/src/d/actor/d_a_balloon_2D.cpp @@ -156,7 +156,7 @@ static int daBalloon2D_createHeap(fopAc_ac_c* i_this) { static char* l_arcName = "Balloon2D"; int daBalloon2D_c::createHeap() { - mScreen = new J2DScreen(); + mScreen = JKR_NEW J2DScreen(); if (mScreen == NULL) { return 0; } @@ -165,26 +165,26 @@ int daBalloon2D_c::createHeap() { JKRArchive* arc = resInfo->getArchive(); mScreen->setPriority("zelda_balloon_game.blo", 0x20000, arc); dPaneClass_showNullPane(mScreen); - field_0x578 = new CPaneMgr(mScreen, MULTI_CHAR('n_all'), 2, NULL); - field_0x57c = new CPaneMgr(mScreen, MULTI_CHAR('score_tn'), 0, NULL); - field_0x580 = new CPaneMgr(mScreen, MULTI_CHAR('suji_n'), 2, NULL); - field_0x584 = new CPaneMgr(mScreen, MULTI_CHAR('s_set_n'), 0, NULL); - field_0x588 = new CPaneMgr(mScreen, MULTI_CHAR('tas_n'), 0, NULL); - field_0x58c = new CPaneMgr(mScreen, MULTI_CHAR('combo_tn'), 0, NULL); - field_0x590 = new CPaneMgr(mScreen, MULTI_CHAR('num_n'), 0, NULL); - field_0x594 = new CPaneMgr(mScreen, MULTI_CHAR('co_set_n'), 2, NULL); - field_0x598 = new CPaneMgr(mScreen, MULTI_CHAR('bal_3_n'), 2, NULL); - field_0x59c = new CPaneMgr(mScreen, MULTI_CHAR('bal_2_n'), 2, NULL); - field_0x5a0 = new CPaneMgr(mScreen, MULTI_CHAR('bal_1_n'), 2, NULL); - field_0x5a4 = new CPaneMgr(mScreen, MULTI_CHAR('ba_com_n'), 2, NULL); + field_0x578 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('n_all'), 2, NULL); + field_0x57c = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('score_tn'), 0, NULL); + field_0x580 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('suji_n'), 2, NULL); + field_0x584 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('s_set_n'), 0, NULL); + field_0x588 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('tas_n'), 0, NULL); + field_0x58c = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('combo_tn'), 0, NULL); + field_0x590 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('num_n'), 0, NULL); + field_0x594 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('co_set_n'), 2, NULL); + field_0x598 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('bal_3_n'), 2, NULL); + field_0x59c = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('bal_2_n'), 2, NULL); + field_0x5a0 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('bal_1_n'), 2, NULL); + field_0x5a4 = JKR_NEW CPaneMgr(mScreen, MULTI_CHAR('ba_com_n'), 2, NULL); field_0x578->setAlphaRate(0.0f); field_0x5a4->setAlphaRate(0.0f); for (s32 i = 0; i < 10; i++) { ResTIMG* resTimg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', dMeter2Info_getNumberTextureName(i)); - field_0x5c4[i] = new J2DPicture(resTimg); + field_0x5c4[i] = JKR_NEW J2DPicture(resTimg); } ResTIMG* resTimg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', dMeter2Info_getPlusTextureName()); - field_0x5ec = new J2DPicture(resTimg); + field_0x5ec = JKR_NEW J2DPicture(resTimg); if (field_0x578 == NULL || field_0x57c == NULL || field_0x580 == NULL || field_0x584 == NULL ||field_0x588 == NULL || field_0x58c == NULL || field_0x590 == NULL || field_0x594 == NULL || field_0x598 == NULL || diff --git a/src/d/actor/d_a_bd.cpp b/src/d/actor/d_a_bd.cpp index c0bf605e8b..ccde129de0 100644 --- a/src/d/actor/d_a_bd.cpp +++ b/src/d/actor/d_a_bd.cpp @@ -944,14 +944,14 @@ static int daBd_Delete(bd_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { bd_class* a_this = (bd_class*)i_this; - a_this->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Bd", 0xE), NULL, NULL, + a_this->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Bd", 0xE), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Bd", 8), 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { return 0; } - a_this->mpBtk = new mDoExt_btkAnm(); + a_this->mpBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_bg.cpp b/src/d/actor/d_a_bg.cpp index ddc1184212..1eb617d659 100644 --- a/src/d/actor/d_a_bg.cpp +++ b/src/d/actor/d_a_bg.cpp @@ -30,7 +30,7 @@ static int createMatAnm(J3DModelData* i_modelData, u16 i_materialID) { J3DMaterial* material = i_modelData->getMaterialNodePointer(i_materialID); if (material->getMaterialAnm() == NULL) { - J3DMaterialAnm* anm = new J3DMaterialAnm(); + J3DMaterialAnm* anm = JKR_NEW J3DMaterialAnm(); if (anm == NULL) { return 0; } @@ -47,7 +47,7 @@ static u8 const lit_3756[12] = { }; int daBg_btkAnm_c::create(J3DModelData* i_modelData, J3DAnmTextureSRTKey* i_btk, int i_anmPlay) { - mpBtk = new mDoExt_btkAnm(); + mpBtk = JKR_NEW mDoExt_btkAnm(); if (mpBtk == NULL) { return 0; } @@ -76,7 +76,7 @@ void daBg_btkAnm_c::play() { } int daBg_brkAnm_c::create(J3DModelData* i_modelData, J3DAnmTevRegKey* i_brk, int i_anmPlay) { - mpBrk = new mDoExt_brkAnm(); + mpBrk = JKR_NEW mDoExt_brkAnm(); if (mpBrk == NULL) { return 0; @@ -144,7 +144,7 @@ int daBg_c::createHeap() { J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getStageRes(arcName, l_btkName[i]); if (btk != NULL) { - bgPart->btk = new daBg_btkAnm_c(); + bgPart->btk = JKR_NEW daBg_btkAnm_c(); if (bgPart->btk == NULL) { return 0; } @@ -161,7 +161,7 @@ int daBg_c::createHeap() { J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getStageRes(arcName, l_brkName[i]); if (brk != NULL) { - bgPart->brk = new daBg_brkAnm_c(); + bgPart->brk = JKR_NEW daBg_brkAnm_c(); if (bgPart->brk == NULL) { return 0; } @@ -196,7 +196,7 @@ int daBg_c::createHeap() { return 0; } - bgPart->tevstr = new dKy_tevstr_c(); + bgPart->tevstr = JKR_NEW dKy_tevstr_c(); if (bgPart->tevstr == NULL) { return 0; } @@ -210,7 +210,7 @@ int daBg_c::createHeap() { cBgD_t* dzb = (cBgD_t*)dComIfG_getStageRes(arcName, "room.dzb"); if (dzb != NULL) { mpKCol = NULL; - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } @@ -227,7 +227,7 @@ int daBg_c::createHeap() { if (kcl != NULL && plc != NULL) { mpBgW = NULL; - mpKCol = new dBgWKCol(); + mpKCol = JKR_NEW dBgWKCol(); if (mpKCol == NULL) { return 0; } diff --git a/src/d/actor/d_a_bg_obj.cpp b/src/d/actor/d_a_bg_obj.cpp index 062aaa975e..7559d5966c 100644 --- a/src/d/actor/d_a_bg_obj.cpp +++ b/src/d/actor/d_a_bg_obj.cpp @@ -72,16 +72,16 @@ static const char* dummy() { u8* daBgObj_c::spec_data_c::initParticleBlock(u8* i_dataPtr) { mpParticleBlock = i_dataPtr; - mParticleNum = *(u32*)mpParticleBlock >> 4 & 0xFFFFF; + mParticleNum = BSWAP32(*(u32*)mpParticleBlock) >> 4 & 0xFFFFF; - return i_dataPtr + ((*(u32*)mpParticleBlock & 0xFFFFFF) + 4); + return i_dataPtr + ((BSWAP32(*(u32*)mpParticleBlock) & 0xFFFFFF) + 4); } u8* daBgObj_c::spec_data_c::initSoundBlock(u8* i_dataPtr) { mpSoundBlock = i_dataPtr; - mSoundNum = *(u32*)mpSoundBlock >> 2 & 0x3FFFFF; + mSoundNum = BSWAP32(*(u32*)mpSoundBlock) >> 2 & 0x3FFFFF; - return i_dataPtr + ((*(u32*)mpSoundBlock & 0xFFFFFF) + 4); + return i_dataPtr + ((BSWAP32(*(u32*)mpSoundBlock) & 0xFFFFFF) + 4); } u8* daBgObj_c::spec_data_c::initTexShareBlock(u8* i_dataPtr) { @@ -111,7 +111,7 @@ u8* daBgObj_c::spec_data_c::initTexShareBlock(u8* i_dataPtr) { } u8* daBgObj_c::spec_data_c::initFarInfoBlock(u8* i_dataPtr) { - mpFarInfoBlock = *(f32*)(i_dataPtr + 4); + mpFarInfoBlock = RES_F32(*(f32*)(i_dataPtr + 4)); return i_dataPtr + 8; } @@ -120,7 +120,7 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) { u8* data = (u8*)i_ptr; - mSpecType = *(u16*)i_ptr; + mSpecType = BSWAP16(*(u16*)i_ptr); u8 block_type; u16 temp_r3; @@ -155,7 +155,7 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) { break; } case 1: { - temp_r3 = *(u16*)(data + 2); + temp_r3 = BSWAP16(*(u16*)(data + 2)); field_0x02 = temp_r3 & 0xF; field_0x03 = (temp_r3 >> 0xE) & 3; field_0x15 = (temp_r3 >> 0xC) & 3; @@ -196,7 +196,7 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) { break; } case 2: { - temp_r3 = *(u16*)(data + 2); + temp_r3 = BSWAP16(*(u16*)(data + 2)); field_0x02 = temp_r3 & 0xF; field_0x03 = (temp_r3 >> 0xE) & 3; field_0x15 = (temp_r3 >> 0xC) & 3; @@ -326,7 +326,7 @@ void daBgObj_c::initAtt() { // Failed to generate focus actor OS_REPORT_ERROR("「注目点」生成失敗!!!\n"); } - + mAttnActorID = fopAcM_GetID(actor); const Vec* box = fopAcM_getCullSizeBoxMax(this); eyePos.y += 0.5f * box->y; @@ -546,7 +546,7 @@ int daBgObj_c::CreateHeapType0() { J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes( daSetBgObj_c::getArcName(this), getBtkName(0, i)); if (btk != NULL) { - field_0x5b8[0][i] = new mDoExt_btkAnm(); + field_0x5b8[0][i] = JKR_NEW mDoExt_btkAnm(); if (field_0x5b8[0][i] == NULL || !field_0x5b8[0][i]->init(modelData, btk, TRUE, 2, 1.0f, 0, -1)) { @@ -559,7 +559,7 @@ int daBgObj_c::CreateHeapType0() { J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes( daSetBgObj_c::getArcName(this), getBrkName(0, i)); if (brk != NULL) { - field_0x5c8[0][i] = new mDoExt_brkAnm(); + field_0x5c8[0][i] = JKR_NEW mDoExt_brkAnm(); if (field_0x5c8[0][i] == NULL || !field_0x5c8[0][i]->init(modelData, brk, TRUE, 2, 1.0f, 0, -1)) { @@ -597,7 +597,7 @@ int daBgObj_c::CreateHeapType1() { J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes( daSetBgObj_c::getArcName(this), getBtkName(i, j)); if (btk != NULL) { - field_0x5b8[i][j] = new mDoExt_btkAnm(); + field_0x5b8[i][j] = JKR_NEW mDoExt_btkAnm(); if (field_0x5b8[i][j] == NULL || !field_0x5b8[i][j]->init(modelData, btk, TRUE, 2, 1.0f, 0, -1)) @@ -611,7 +611,7 @@ int daBgObj_c::CreateHeapType1() { J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes( daSetBgObj_c::getArcName(this), getBrkName(i, j)); if (brk != NULL) { - field_0x5c8[i][j] = new mDoExt_brkAnm(); + field_0x5c8[i][j] = JKR_NEW mDoExt_brkAnm(); if (field_0x5c8[i][j] == NULL || !field_0x5c8[i][j]->init(modelData, brk, TRUE, 2, 1.0f, 0, -1)) @@ -629,7 +629,7 @@ int daBgObj_c::CreateHeapType1() { cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes(daSetBgObj_c::getArcName(this), getDzbName(1)); if (dzb != NULL) { - mpBgW2 = new dBgW(); + mpBgW2 = JKR_NEW dBgW(); if (mpBgW2 == NULL || mpBgW2->Set(dzb, cBgW::MOVE_BG_e, &mBgMtx)) { mpBgW2 = NULL; return 0; diff --git a/src/d/actor/d_a_boomerang.cpp b/src/d/actor/d_a_boomerang.cpp index 7d05a714ae..445792acc1 100644 --- a/src/d/actor/d_a_boomerang.cpp +++ b/src/d/actor/d_a_boomerang.cpp @@ -18,7 +18,7 @@ int daBoomerang_sight_c::createHeap() { void* tmpData; JKRArchive* archive = dComIfG_getObjectResInfo(daAlink_c::getAlinkArcName())->getArchive(); - m_cursorYellowScrn = new J2DScreen(); + m_cursorYellowScrn = JKR_NEW J2DScreen(); if (m_cursorYellowScrn == NULL) { return 0; } @@ -54,7 +54,7 @@ int daBoomerang_sight_c::createHeap() { return 0; } - m_cursorRedScrn = new J2DScreen(); + m_cursorRedScrn = JKR_NEW J2DScreen(); if (m_cursorRedScrn == NULL) { return 0; } @@ -76,7 +76,7 @@ int daBoomerang_sight_c::createHeap() { return 0; } - m_cursorOrangeScrn = new J2DScreen(); + m_cursorOrangeScrn = JKR_NEW J2DScreen(); if (m_cursorOrangeScrn == NULL) { return 0; } diff --git a/src/d/actor/d_a_coach_2D.cpp b/src/d/actor/d_a_coach_2D.cpp index 2a457132c9..c10dfc47fa 100644 --- a/src/d/actor/d_a_coach_2D.cpp +++ b/src/d/actor/d_a_coach_2D.cpp @@ -108,7 +108,7 @@ static char* l_arcName = "Coach2D"; static daCoach2D_HIO_c l_HOSTIO; int daCoach2D_c::createHeap() { - mpScrn = new J2DScreen(); + mpScrn = JKR_NEW J2DScreen(); if (mpScrn == NULL) { return 0; } @@ -125,15 +125,15 @@ int daCoach2D_c::createHeap() { mpFireIconBrk->searchUpdateMaterialID(mpScrn); setBrkAnime(true); - mpPaneAll = new CPaneMgr(mpScrn, MULTI_CHAR('n_all'), 2, NULL); - mpPaneBasha = new CPaneMgr(mpScrn, MULTI_CHAR('basha_n'), 2, NULL); - mpPaneFire = new CPaneMgr(mpScrn, MULTI_CHAR('fire_n'), 2, NULL); + mpPaneAll = JKR_NEW CPaneMgr(mpScrn, MULTI_CHAR('n_all'), 2, NULL); + mpPaneBasha = JKR_NEW CPaneMgr(mpScrn, MULTI_CHAR('basha_n'), 2, NULL); + mpPaneFire = JKR_NEW CPaneMgr(mpScrn, MULTI_CHAR('fire_n'), 2, NULL); mpScrn->search(MULTI_CHAR('fire_b_n'))->move(mpPaneFire->getPosX(), mpPaneFire->getPosY()); - mpPaneFireB = new CPaneMgr(mpScrn, MULTI_CHAR('fire_b_n'), 2, NULL); + mpPaneFireB = JKR_NEW CPaneMgr(mpScrn, MULTI_CHAR('fire_b_n'), 2, NULL); - mMsgLight = new dMsgScrnLight_c(6, 0xFF); + mMsgLight = JKR_NEW dMsgScrnLight_c(6, 0xFF); if (mpPaneAll == NULL || mpPaneBasha == NULL || mpPaneFire == NULL || mpPaneFireB == NULL || mMsgLight == NULL) { return 0; diff --git a/src/d/actor/d_a_coach_fire.cpp b/src/d/actor/d_a_coach_fire.cpp index f2f46b9eab..c4d5e79700 100644 --- a/src/d/actor/d_a_coach_fire.cpp +++ b/src/d/actor/d_a_coach_fire.cpp @@ -136,8 +136,8 @@ static int daCoachFire_Execute(daCoachFire_c* i_this) { return i_this->execute(); } -static bool daCoachFire_IsDelete(daCoachFire_c* i_this) { - return true; +static BOOL daCoachFire_IsDelete(daCoachFire_c* i_this) { + return TRUE; } daCoachFire_c::~daCoachFire_c() { diff --git a/src/d/actor/d_a_cow.cpp b/src/d/actor/d_a_cow.cpp index 1830791f66..ba803a9148 100644 --- a/src/d/actor/d_a_cow.cpp +++ b/src/d/actor/d_a_cow.cpp @@ -2976,7 +2976,7 @@ int daCow_c::CreateHeap() { JUT_ASSERT(3826, NULL != modelData); int r24 = 0x11020084; mpMorf = - new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, r24); + JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, r24); if (!mpMorf || !mpMorf->getModel()) { return cPhs_INIT_e; @@ -2991,7 +2991,7 @@ int daCow_c::CreateHeap() { } setBck(daCow_c::Animation_WaitA, J3DFrameCtrl::EMode_LOOP, 0.0f, 1.0f); - mpBtp = new mDoExt_btpAnm(); + mpBtp = JKR_NEW mDoExt_btpAnm(); if (mpBtp == NULL) { return cPhs_ERROR_e; diff --git a/src/d/actor/d_a_cstaF.cpp b/src/d/actor/d_a_cstaF.cpp index 5efb45d8b8..00fd0f2b63 100644 --- a/src/d/actor/d_a_cstaF.cpp +++ b/src/d/actor/d_a_cstaF.cpp @@ -54,7 +54,7 @@ int daCstaF_c::CreateHeap() { const data* data_p = &dataTbl[m_type]; void* pbck = dComIfG_getObjectRes(m_arcName, data_p->bck_idx); - mp_modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(m_arcName, data_p->bmd_idx), NULL, NULL, (J3DAnmTransform*)pbck, 0, 0.0f, 0, -1, &m_sound, 0x80000, 0x11000284); + mp_modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(m_arcName, data_p->bmd_idx), NULL, NULL, (J3DAnmTransform*)pbck, 0, 0.0f, 0, -1, &m_sound, 0x80000, 0x11000284); if (mp_modelMorf == NULL || mp_modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_cstatue.cpp b/src/d/actor/d_a_cstatue.cpp index cbc929cd16..2058f9b1f5 100644 --- a/src/d/actor/d_a_cstatue.cpp +++ b/src/d/actor/d_a_cstatue.cpp @@ -158,7 +158,7 @@ int daCstatue_c::createHeap() { resource_index = data->modelIndex; } - mpMorf = new mDoExt_McaMorfSO( + mpMorf = JKR_NEW mDoExt_McaMorfSO( static_cast(dComIfG_getObjectRes(mResName, (u16)resource_index)), NULL, NULL, animation, 0, 0.0f, animation->getFrameMax(), -1, &mSound, mType == daCstatueType_Normal2 ? J3DMdlFlag_None : J3DMdlFlag_DifferedDLBuffer, data->morfIndex); @@ -180,20 +180,20 @@ int daCstatue_c::createHeap() { } if (checkBossType()) { - mSph = new dCcD_Sph[9](); + mSph = JKR_NEW dCcD_Sph[9](); if (!mSph) { return cPhs_INIT_e; } } else if (mType == daCstatueType_Normal) { - mCps1 = new dCcD_Cps(); + mCps1 = JKR_NEW dCcD_Cps(); if (!mCps1) { return cPhs_INIT_e; } - mCps2 = new dCcD_Cps(); + mCps2 = JKR_NEW dCcD_Cps(); if (!mCps2) { return cPhs_INIT_e; } - mCyl2 = new dCcD_Cyl(); + mCyl2 = JKR_NEW dCcD_Cyl(); if (!mCyl2) { return cPhs_INIT_e; } diff --git a/src/d/actor/d_a_demo00.cpp b/src/d/actor/d_a_demo00.cpp index f4b3b1de5c..71e046f5a6 100644 --- a/src/d/actor/d_a_demo00.cpp +++ b/src/d/actor/d_a_demo00.cpp @@ -205,7 +205,7 @@ static BOOL awaCheck(J3DModel* i_model) { for (u16 i = 0; i < texture->getNum(); i++) { const char* name = nameTab->getName(i); if (strcmp(name, "B_dummy") == 0 || strcmp(name, "cy_kankyo") == 0) { - J3DSkinDeform* skinDeform = new J3DSkinDeform(); + J3DSkinDeform* skinDeform = JKR_NEW J3DSkinDeform(); if (skinDeform == NULL) { return FALSE; } @@ -252,7 +252,7 @@ int daDemo00_c::createHeap() { } if (mModel.mID.field_0xc != -1) { - mModel.mpBtpAnm = new mDoExt_btpAnm(); + mModel.mpBtpAnm = JKR_NEW mDoExt_btpAnm(); if (mModel.mpBtpAnm == NULL) { return 0; } @@ -272,7 +272,7 @@ int daDemo00_c::createHeap() { } if (mModel.mID.field_0x10 != -1) { - mModel.mpBtkAnm = new mDoExt_btkAnm(); + mModel.mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mModel.mpBtkAnm == NULL) { return 0; } @@ -296,7 +296,7 @@ int daDemo00_c::createHeap() { } if (mModel.mID.field_0x14 != -1) { - mModel.mpBrkAnm = new mDoExt_brkAnm(); + mModel.mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mModel.mpBrkAnm == NULL) { return 0; } @@ -314,7 +314,7 @@ int daDemo00_c::createHeap() { } if (mModel.mID.field_0x8 != -1) { - mModel.mpBpkAnm = new mDoExt_bpkAnm(); + mModel.mpBpkAnm = JKR_NEW mDoExt_bpkAnm(); if (mModel.mpBpkAnm == NULL) { return 0; } @@ -353,9 +353,9 @@ int daDemo00_c::createHeap() { } if (field_0x6ad == 0) { - mModel.mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, anm, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); + mModel.mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, anm, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); } else { - mModel.mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, anm, -1, 1.0f, 0, -1, &mSound, 0, uVar1); + mModel.mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, anm, -1, 1.0f, 0, -1, &mSound, 0, uVar1); } if (mModel.mpModelMorf == NULL || mModel.mpModelMorf->getModel() == NULL) { @@ -370,7 +370,7 @@ int daDemo00_c::createHeap() { } if (field_0x6b4 != 0) { - mModel.field_0x5d8 = new mDoExt_invisibleModel(); + mModel.field_0x5d8 = JKR_NEW mDoExt_invisibleModel(); if (mModel.field_0x5d8 == NULL) { return 0; } @@ -384,7 +384,7 @@ int daDemo00_c::createHeap() { mModel.mID.field_0x18 = 1; if (mModel.mID.field_0x18 != -1) { - mModel.mShadow = new daDemo00_shadow_c(); + mModel.mShadow = JKR_NEW daDemo00_shadow_c(); if (mModel.mShadow == NULL) { return 0; } @@ -396,7 +396,7 @@ int daDemo00_c::createHeap() { setShadowSize(); } - mModel.mBgc = new daDemo00_bgc_c(); + mModel.mBgc = JKR_NEW daDemo00_bgc_c(); if (mModel.mBgc == NULL) { return 0; } @@ -407,7 +407,7 @@ int daDemo00_c::createHeap() { JUT_ASSERT(687, mModel.mDeformData != NULL); if (mModel.mID.field_0x20 != -1) { - mModel.mpBlkAnm = new mDoExt_blkAnm(); + mModel.mpBlkAnm = JKR_NEW mDoExt_blkAnm(); if (mModel.mpBlkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_dmidna.cpp b/src/d/actor/d_a_dmidna.cpp index dbe02cdf85..1f096b090f 100644 --- a/src/d/actor/d_a_dmidna.cpp +++ b/src/d/actor/d_a_dmidna.cpp @@ -11,7 +11,7 @@ static const char l_arcName[] = "Dmidna"; int daDmidna_c::createHeap() { - mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(l_arcName, 8), NULL, + mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(l_arcName, 8), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 4), 2, 1.0f, 0, -1, NULL, 0, 0); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_do.cpp b/src/d/actor/d_a_do.cpp index 6a6dee6067..9944ed9755 100644 --- a/src/d/actor/d_a_do.cpp +++ b/src/d/actor/d_a_do.cpp @@ -2357,7 +2357,7 @@ static int daDo_Delete(do_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { do_class* _this = (do_class*)i_this; - _this->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Do", 25), NULL, NULL, + _this->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Do", 25), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Do", 14), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11020284); @@ -2375,7 +2375,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } } - _this->mpBtk = new mDoExt_btkAnm(); + _this->mpBtk = JKR_NEW mDoExt_btkAnm(); if (_this->mpBtk == NULL) { return 0; } @@ -2387,7 +2387,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - _this->mpBtp = new mDoExt_btpAnm(); + _this->mpBtp = JKR_NEW mDoExt_btpAnm(); if (_this->mpBtp == NULL) { return 0; } diff --git a/src/d/actor/d_a_door_boss.cpp b/src/d/actor/d_a_door_boss.cpp index 1b124f12bf..973e11475e 100644 --- a/src/d/actor/d_a_door_boss.cpp +++ b/src/d/actor/d_a_door_boss.cpp @@ -54,12 +54,12 @@ int daBdoor_c::CreateHeap() { } J3DAnmTransform* lock_bck = (J3DAnmTransform*)dComIfG_getObjectRes(getArcName(), "VlockB.bck"); - mpLockAnm = new mDoExt_bckAnm(); + mpLockAnm = JKR_NEW mDoExt_bckAnm(); if (mpLockAnm == NULL || !mpLockAnm->init(lock_bck, 1, 0, 1.0f, 0, -1, false)) { return 0; } - J3DSkinDeform* deform = new J3DSkinDeform(); + J3DSkinDeform* deform = JKR_NEW J3DSkinDeform(); if (deform == NULL) { return 0; } @@ -67,7 +67,7 @@ int daBdoor_c::CreateHeap() { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes(getArcName(), getDzb()); if (dzb == NULL) { return 0; diff --git a/src/d/actor/d_a_door_bossL1.cpp b/src/d/actor/d_a_door_bossL1.cpp index 8a5fd0c752..7e80efd2a3 100644 --- a/src/d/actor/d_a_door_bossL1.cpp +++ b/src/d/actor/d_a_door_bossL1.cpp @@ -205,14 +205,14 @@ int daBdoorL1_c::CreateHeap() { if (nowLevel == 8) { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(getArcName(), "door_shutterBoss.btk"); JUT_ASSERT(341, pbtk != NULL); - field_0x58c = new mDoExt_btkAnm(); + field_0x58c = JKR_NEW mDoExt_btkAnm(); if (field_0x58c == NULL || !field_0x58c->init(field_0x580->getModelData(), pbtk, 1, 0, 1.0f, 0, -1)) { return 0; } } J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectRes(getAnmArcName(), getOpenAnm()); JUT_ASSERT(354, anm != NULL); - field_0x588 = new mDoExt_bckAnm(); + field_0x588 = JKR_NEW mDoExt_bckAnm(); if (field_0x588 == NULL || !field_0x588->init(anm, 1, 0, 1.0f, 0, -1,false)) { return 0; } @@ -223,7 +223,7 @@ int daBdoorL1_c::CreateHeap() { field_0x584->calc(); } calcMtx(); - field_0x590 = new dBgW(); + field_0x590 = JKR_NEW dBgW(); if (field_0x590 == NULL || field_0x590->Set((cBgD_t*)dComIfG_getObjectRes(getAlwaysArcName(), getDzb()), 1, &field_0x7ec)) { return 0; } diff --git a/src/d/actor/d_a_door_bossL5.cpp b/src/d/actor/d_a_door_bossL5.cpp index e78bc00e7b..8c1f0e4850 100644 --- a/src/d/actor/d_a_door_bossL5.cpp +++ b/src/d/actor/d_a_door_bossL5.cpp @@ -81,7 +81,7 @@ int daBdoorL5_c::CreateHeap() { J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectRes(getAnmArcName(), getOpenAnm()); JUT_ASSERT(354, anm != NULL); - field_0x584 = new mDoExt_bckAnm(); + field_0x584 = JKR_NEW mDoExt_bckAnm(); if (field_0x584 == NULL || !field_0x584->init(anm, 1, 0, 1.0f, 0, -1, false)) { return 0; } @@ -89,7 +89,7 @@ int daBdoorL5_c::CreateHeap() { field_0x584->entry(field_0x580->getModelData()); field_0x580->calc(); calcMtx(); - field_0x588 = new dBgW(); + field_0x588 = JKR_NEW dBgW(); if (field_0x588 == NULL || field_0x588->Set((cBgD_t*)dComIfG_getObjectRes(getAlwaysArcName(), getDzb()), 1, &field_0x580->getBaseTRMtx())) { return 0; } diff --git a/src/d/actor/d_a_door_dbdoor00.cpp b/src/d/actor/d_a_door_dbdoor00.cpp index 0f0f827d0c..520e395045 100644 --- a/src/d/actor/d_a_door_dbdoor00.cpp +++ b/src/d/actor/d_a_door_dbdoor00.cpp @@ -90,7 +90,7 @@ int daDbDoor00_c::CreateHeap() { nodePointerR->setCallBack(nodeCallBack); mpModel2->setUserArea((uintptr_t)this); - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes(getAlwaysArcName(), getDzb()); if (dzb == NULL) { return 0; diff --git a/src/d/actor/d_a_door_knob00.cpp b/src/d/actor/d_a_door_knob00.cpp index 68872b4bbe..6fab6cb36d 100644 --- a/src/d/actor/d_a_door_knob00.cpp +++ b/src/d/actor/d_a_door_knob00.cpp @@ -92,7 +92,7 @@ int daKnob20_c::CreateHeap() { if (mModel2 == 0) { return 0; } - field_0x5a0 = new dBgW(); + field_0x5a0 = JKR_NEW dBgW(); if (field_0x5a0 == NULL) { return 0; } diff --git a/src/d/actor/d_a_door_mbossL1.cpp b/src/d/actor/d_a_door_mbossL1.cpp index 1636dd22b9..958bd063c4 100644 --- a/src/d/actor/d_a_door_mbossL1.cpp +++ b/src/d/actor/d_a_door_mbossL1.cpp @@ -303,7 +303,7 @@ int daMBdoorL1_c::CreateHeap() { J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectRes( getAlwaysArcName(), "FDoorA.bck"); JUT_ASSERT(597, anm != NULL); - mBckAnms[i] = new mDoExt_bckAnm(); + mBckAnms[i] = JKR_NEW mDoExt_bckAnm(); if (mBckAnms[i] == NULL || !mBckAnms[i]->init(anm, 1, 0, 1.0f, 0, -1, false)) { return 0; } @@ -324,7 +324,7 @@ int daMBdoorL1_c::CreateHeap() { J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectRes(getAnmArcName(), getOpenAnm()); JUT_ASSERT(628, anm != NULL); - mBckAnms[0] = new mDoExt_bckAnm(); + mBckAnms[0] = JKR_NEW mDoExt_bckAnm(); if (mBckAnms[0] == NULL || !mBckAnms[0]->init(anm, 1, 0, 1.0f, 0, -1, false)) { return 0; } @@ -334,7 +334,7 @@ int daMBdoorL1_c::CreateHeap() { if (level == 8) { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getStageRes(getBtk()); JUT_ASSERT(646, pbtk != NULL); - field_0x594 = new mDoExt_btkAnm(); + field_0x594 = JKR_NEW mDoExt_btkAnm(); if (field_0x594 == NULL || !field_0x594->init(mModels[0]->getModelData(), pbtk, 1, 0, 1.0f, 0, -1)) { @@ -361,7 +361,7 @@ int daMBdoorL1_c::CreateHeap() { mDoMtx_stack_c::scaleM(1.0f, 1.4f, 1.0f); } MTXCopy(mDoMtx_stack_c::get(), field_0x59c); - field_0x598 = new dBgW(); + field_0x598 = JKR_NEW dBgW(); if (field_0x598 == NULL || field_0x598->Set((cBgD_t*)dComIfG_getObjectRes(getAlwaysArcName(), getDzb()), 1, &field_0x59c)) { return 0; } diff --git a/src/d/actor/d_a_door_push.cpp b/src/d/actor/d_a_door_push.cpp index 29f6e6f18e..a37d9b2ed5 100644 --- a/src/d/actor/d_a_door_push.cpp +++ b/src/d/actor/d_a_door_push.cpp @@ -111,7 +111,7 @@ int daDoorPush_c::CreateHeap() { return 0; } } - mpDoorBgW = new dBgW(); + mpDoorBgW = JKR_NEW dBgW(); if (mpDoorBgW == NULL || mpDoorBgW->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, 8), 1, &mDoorMtx)) { diff --git a/src/d/actor/d_a_door_shutter.cpp b/src/d/actor/d_a_door_shutter.cpp index d47c4c9c3c..c627a6ab18 100644 --- a/src/d/actor/d_a_door_shutter.cpp +++ b/src/d/actor/d_a_door_shutter.cpp @@ -148,7 +148,7 @@ int daDoor20_c::CreateHeap() { J3DAnmTextureSRTKey* pbtk; pbtk = (J3DAnmTextureSRTKey*)dComIfG_getStageRes(getBtk()); JUT_ASSERT(421, pbtk != NULL); - field_0x5c0 = new mDoExt_btkAnm(); + field_0x5c0 = JKR_NEW mDoExt_btkAnm(); if (field_0x5c0 == NULL || !field_0x5c0->init(mModel1->getModelData(), pbtk, 1, 0, 1.0f, 0, -1)) { @@ -178,7 +178,7 @@ int daDoor20_c::CreateHeap() { mDoMtx_stack_c::scaleM(1.0f, 1.4f, 1.0f); } MTXCopy(mDoMtx_stack_c::get(), field_0x5f4); - field_0x5c4 = new dBgW(); + field_0x5c4 = JKR_NEW dBgW(); if (field_0x5c4 == 0 || field_0x5c4->Set((cBgD_t*)dComIfG_getObjectRes(getAlwaysArcName(), getDzbName()), 1, &field_0x5f4)) { return 0; } diff --git a/src/d/actor/d_a_door_spiral.cpp b/src/d/actor/d_a_door_spiral.cpp index b8830575ce..ea550063d7 100644 --- a/src/d/actor/d_a_door_spiral.cpp +++ b/src/d/actor/d_a_door_spiral.cpp @@ -218,7 +218,7 @@ int daSpiral_c::CreateHeap() { return 0; } - mpSpiralDzb = new dBgW(); + mpSpiralDzb = JKR_NEW dBgW(); if (mpSpiralDzb == NULL) { return 0; } @@ -230,7 +230,7 @@ int daSpiral_c::CreateHeap() { return 0; } - mDoorDarkDzb = new dBgW(); + mDoorDarkDzb = JKR_NEW dBgW(); if (mDoorDarkDzb == NULL) { return 0; } @@ -1048,7 +1048,7 @@ int dSpiral_stop_c::create(daSpiral_c* i_spiral) { return 0; } - mpBgw = new dBgW(); + mpBgw = JKR_NEW dBgW(); if (mpBgw == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_ai.cpp b/src/d/actor/d_a_e_ai.cpp index a35bee546a..a6688c9b79 100644 --- a/src/d/actor/d_a_e_ai.cpp +++ b/src/d/actor/d_a_e_ai.cpp @@ -861,12 +861,12 @@ int e_ai_class::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_AI", 0xD); JUT_ASSERT(1703, modelData != NULL); - m_modelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_AI", 9), 2, 1.0f, 0, -1, &m_sound, 0, 0x11000084); + m_modelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_AI", 9), 2, 1.0f, 0, -1, &m_sound, 0, 0x11000084); if (m_modelMorf == NULL || m_modelMorf->getModel() == NULL) { return 0; } - m_brk = new mDoExt_brkAnm(); + m_brk = JKR_NEW mDoExt_brkAnm(); if (m_brk == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_ba.cpp b/src/d/actor/d_a_e_ba.cpp index f1271aa873..7238a1d5bf 100644 --- a/src/d/actor/d_a_e_ba.cpp +++ b/src/d/actor/d_a_e_ba.cpp @@ -978,7 +978,7 @@ static int daE_BA_Delete(e_ba_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_ba_class* _this = (e_ba_class*)i_this; - _this->mpMorf = new mDoExt_McaMorfSO( + _this->mpMorf = JKR_NEW mDoExt_McaMorfSO( static_cast(dComIfG_getObjectRes(_this->mArcName, 13)), NULL, NULL, static_cast(dComIfG_getObjectRes(_this->mArcName, 10)), 2, 1.0f, 0, -1, &_this->mCreatureSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_bg.cpp b/src/d/actor/d_a_e_bg.cpp index dbce499069..c25d74f423 100644 --- a/src/d/actor/d_a_e_bg.cpp +++ b/src/d/actor/d_a_e_bg.cpp @@ -1288,7 +1288,7 @@ int daE_BG_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_BG", 10); JUT_ASSERT(0, modelData != NULL); - mpMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_BG", 7), 0, 1.0f, 0, -1, &mCreatureSound, 0x80000, 0x11000084); if (mpMorfSO == NULL || mpMorfSO->getModel() == NULL) { @@ -1303,7 +1303,7 @@ int daE_BG_c::CreateHeap() { model->getModelData()->getJointNodePointer(i)->setCallBack(JointCallBack); } - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_bi.cpp b/src/d/actor/d_a_e_bi.cpp index 8be64c55a8..72c02ae1c4 100644 --- a/src/d/actor/d_a_e_bi.cpp +++ b/src/d/actor/d_a_e_bi.cpp @@ -855,7 +855,7 @@ static int daE_BI_Delete(e_bi_class* i_this) { static int useHeapInit(fopAc_ac_c* actor) { e_bi_class* i_this = (e_bi_class*)actor; - i_this->anm_p = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_BI", BMDR_BI), NULL, NULL, + i_this->anm_p = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_BI", BMDR_BI), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_BI", BCK_BI_WAIT01), 2, 1.0f, 0, -1, &i_this->sound, 0x80000, 0x11000084); if (i_this->anm_p == NULL || i_this->anm_p->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_bs.cpp b/src/d/actor/d_a_e_bs.cpp index 3f2cfdef58..b20ebdcd5f 100644 --- a/src/d/actor/d_a_e_bs.cpp +++ b/src/d/actor/d_a_e_bs.cpp @@ -797,7 +797,7 @@ static int daE_BS_Delete(e_bs_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_bs_class* a_this = (e_bs_class*)i_this; - a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData* )dComIfG_getObjectRes("E_BS", 0xE), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_BS", 7), 0, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + a_this->modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData* )dComIfG_getObjectRes("E_BS", 0xE), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_BS", 7), 0, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { return 0; } @@ -811,7 +811,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } } - a_this->weponModelMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_BS", 0xF), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_BS", 0xA), 0, 1.0f, 0, -1, 1, 0, 0x80000, 0x11000084); + a_this->weponModelMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_BS", 0xF), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_BS", 0xA), 0, 1.0f, 0, -1, 1, 0, 0x80000, 0x11000084); if (a_this->weponModelMorf == NULL || a_this->weponModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_bu.cpp b/src/d/actor/d_a_e_bu.cpp index 4809b36b20..0dd49746da 100644 --- a/src/d/actor/d_a_e_bu.cpp +++ b/src/d/actor/d_a_e_bu.cpp @@ -1008,7 +1008,7 @@ static int daE_BU_Delete(e_bu_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_bu_class* a_this = (e_bu_class*)i_this; - a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_BU", 11), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_BU", 7), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + a_this->modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_BU", 11), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_BU", 7), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_cr.cpp b/src/d/actor/d_a_e_cr.cpp index 4c360fdece..7c29177787 100644 --- a/src/d/actor/d_a_e_cr.cpp +++ b/src/d/actor/d_a_e_cr.cpp @@ -461,7 +461,7 @@ static int daE_CR_Delete(e_cr_class* a_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_cr_class* a_this = (e_cr_class*)i_this; - a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_CR", 0xD), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_CR", 9), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + a_this->modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_CR", 0xD), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_CR", 9), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_db.cpp b/src/d/actor/d_a_e_db.cpp index bb03745617..fd7e276fda 100644 --- a/src/d/actor/d_a_e_db.cpp +++ b/src/d/actor/d_a_e_db.cpp @@ -2033,7 +2033,7 @@ static int daE_DB_Delete(e_db_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_db_class* a_this = (e_db_class*)i_this; - a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_db", 0x17), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_db", 0x12), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + a_this->modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_db", 0x17), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_db", 0x12), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_db_leaf.cpp b/src/d/actor/d_a_e_db_leaf.cpp index 0fe9346bf5..9c6b3f10ae 100644 --- a/src/d/actor/d_a_e_db_leaf.cpp +++ b/src/d/actor/d_a_e_db_leaf.cpp @@ -33,7 +33,7 @@ static int daE_DB_LEAF_Delete(e_db_leaf_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_db_leaf_class* leaf = static_cast(i_this); - leaf->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_DB", 0x18), NULL, NULL, + leaf->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_DB", 0x18), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_DB", 0x13), 2, 1.0, 0, -1, 1, NULL, 0x80000, 0x11000084); if (leaf->mpMorf == NULL || leaf->mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_dd.cpp b/src/d/actor/d_a_e_dd.cpp index 1094366738..8801595ef7 100644 --- a/src/d/actor/d_a_e_dd.cpp +++ b/src/d/actor/d_a_e_dd.cpp @@ -1573,7 +1573,7 @@ static int daE_DD_Delete(e_dd_class* i_this) { static int useHeapInit(fopAc_ac_c* a_this) { e_dd_class* i_this = (e_dd_class*)a_this; - i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_dd", BMDR_DD), NULL, NULL, + i_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_dd", BMDR_DD), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_dd", BCK_DD_WAIT), 2, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11020084); if (i_this->mpModelMorf == NULL || i_this->mpModelMorf->getModel() == NULL) { @@ -1593,7 +1593,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { }; for (int i = 0; i < 5; i++) { - i_this->mpBrkAnms[i] = new mDoExt_brkAnm(); + i_this->mpBrkAnms[i] = JKR_NEW mDoExt_brkAnm(); if (i_this->mpBrkAnms[i] == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_df.cpp b/src/d/actor/d_a_e_df.cpp index ccd68a9083..d9ca2a3bca 100644 --- a/src/d/actor/d_a_e_df.cpp +++ b/src/d/actor/d_a_e_df.cpp @@ -39,7 +39,7 @@ int daE_DF_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_DF", 0xD); JUT_ASSERT(161, modelData != NULL); - mpMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_DF", 10), 2, 1.0f, 0, -1, &mCreatureSound, 0x80000, 0x11000084); if (mpMorfSO == NULL || mpMorfSO->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_dk.cpp b/src/d/actor/d_a_e_dk.cpp index 6efac3410b..28420ad828 100644 --- a/src/d/actor/d_a_e_dk.cpp +++ b/src/d/actor/d_a_e_dk.cpp @@ -939,7 +939,7 @@ static int daE_DK_Delete(daE_DK_c* i_this) { int daE_DK_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_DK", BMDR_DK); JUT_ASSERT(1488, modelData != NULL); - mpMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_DK", BCK_DK_WAIT), 0, 1.0f, 0, -1, &mCreatureSound, 0x80000, 0x31000284); @@ -948,7 +948,7 @@ int daE_DK_c::CreateHeap() { } for (s32 i = 0; i < 2; i++) { - mpBrkAnm[i] = new mDoExt_brkAnm(); + mpBrkAnm[i] = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm[i] == 0) { return 0; } @@ -960,7 +960,7 @@ int daE_DK_c::CreateHeap() { return 0; } - mpBtkAnm[i] = new mDoExt_btkAnm(); + mpBtkAnm[i] = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm[i] == 0) { return 0; } @@ -975,7 +975,7 @@ int daE_DK_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("E_DK", BMDR_DK_CORE); JUT_ASSERT(1537, modelData != NULL); - mpCoreMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpCoreMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_DK", BCK_DK_C_WAIT), 0, 1.0f, 0, -1, &mCreatureSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_dn.cpp b/src/d/actor/d_a_e_dn.cpp index ff4329a8f2..e03c1adf2e 100644 --- a/src/d/actor/d_a_e_dn.cpp +++ b/src/d/actor/d_a_e_dn.cpp @@ -3313,7 +3313,7 @@ static dJntColData_c jc_data[12] = { static int useHeapInit(fopAc_ac_c* actor) { e_dn_class* i_this = (e_dn_class*)actor; - i_this->anm_p = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_dn", 38), NULL, NULL, + i_this->anm_p = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_dn", 38), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_dn", 31), 0, 1.0f, 0, -1, &i_this->sound, 0x80000, 0x11000084); if (i_this->anm_p == NULL || i_this->anm_p->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_dt.cpp b/src/d/actor/d_a_e_dt.cpp index a5a0014a3e..3f1d793390 100644 --- a/src/d/actor/d_a_e_dt.cpp +++ b/src/d/actor/d_a_e_dt.cpp @@ -2414,7 +2414,7 @@ static int daE_DT_Delete(daE_DT_c* i_this) { int daE_DT_c::CreateHeap() { J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("E_DT", 28); - mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_DT", 23), J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, &mSound, 0, 0x11000084); diff --git a/src/d/actor/d_a_e_fb.cpp b/src/d/actor/d_a_e_fb.cpp index a857acb905..57949be764 100644 --- a/src/d/actor/d_a_e_fb.cpp +++ b/src/d/actor/d_a_e_fb.cpp @@ -870,7 +870,7 @@ static int daE_FB_Delete(daE_FB_c* i_this) { int daE_FB_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes("E_FL", 0xB); JUT_ASSERT(1516, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_FL", 0x8), 0, 1.0f, 0, -1, &mCreatureSound, 0, 0x31000084); if (mpMorf == NULL || mpMorf->getModel() == NULL) { @@ -889,7 +889,7 @@ int daE_FB_c::CreateHeap() { } } - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_fk.cpp b/src/d/actor/d_a_e_fk.cpp index 9c28c359c6..bc0cf94458 100644 --- a/src/d/actor/d_a_e_fk.cpp +++ b/src/d/actor/d_a_e_fk.cpp @@ -37,7 +37,7 @@ daE_FK_HIO_c::daE_FK_HIO_c() { int daE_FK_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_fk", 15); JUT_ASSERT(189, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_fk", 12), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_fk", 12), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_fm.cpp b/src/d/actor/d_a_e_fm.cpp index ca5a982bfa..88b3d2c786 100644 --- a/src/d/actor/d_a_e_fm.cpp +++ b/src/d/actor/d_a_e_fm.cpp @@ -3474,7 +3474,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { J3DModelData* modelData; e_fm_class* a_this = (e_fm_class*)i_this; - a_this->mpFmModelMorf = new mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_fm", BMDR_FM)), NULL, NULL, + a_this->mpFmModelMorf = JKR_NEW mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_fm", BMDR_FM)), NULL, NULL, static_cast(dComIfG_getObjectRes("E_fm", BCK_FM_WAIT01)), 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); if (a_this->mpFmModelMorf == NULL || a_this->mpFmModelMorf->getModel() == NULL) { return 0; @@ -3491,7 +3491,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { int anm_mode; for (int i = 0; i < 9; i++) { - a_this->mpFmBrk[i] = new mDoExt_brkAnm(); + a_this->mpFmBrk[i] = JKR_NEW mDoExt_brkAnm(); if (a_this->mpFmBrk[i] == NULL) { return 0; } @@ -3512,7 +3512,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpFmBtk[i] = new mDoExt_btkAnm(); + a_this->mpFmBtk[i] = JKR_NEW mDoExt_btkAnm(); if (a_this->mpFmBtk[i] == NULL) { return 0; } @@ -3528,13 +3528,13 @@ static int useHeapInit(fopAc_ac_c* i_this) { } } - a_this->mpDemoFmModelMorf = new mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_fm", BMDR_FM)), NULL, NULL, + a_this->mpDemoFmModelMorf = JKR_NEW mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_fm", BMDR_FM)), NULL, NULL, static_cast(dComIfG_getObjectRes("E_fm", BCK_FM_DEMOEND03)), 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); if (a_this->mpDemoFmModelMorf == NULL || a_this->mpDemoFmModelMorf->getModel() == NULL) { return 0; } - a_this->mpDemoFmBrk = new mDoExt_brkAnm(); + a_this->mpDemoFmBrk = JKR_NEW mDoExt_brkAnm(); if (a_this->mpDemoFmBrk == NULL) { return 0; } @@ -3552,7 +3552,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpCoreBrk = new mDoExt_brkAnm(); + a_this->mpCoreBrk = JKR_NEW mDoExt_brkAnm(); if (a_this->mpCoreBrk == NULL) { return 0; } @@ -3563,7 +3563,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpCoreBtk = new mDoExt_btkAnm(); + a_this->mpCoreBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpCoreBtk == NULL) { return 0; } @@ -3578,13 +3578,13 @@ static int useHeapInit(fopAc_ac_c* i_this) { for (int i = 0; i < 2; i++) { static int eff_bmd[] = {BMDR_EF_FMATTACK_A, BMDR_EF_FMATTACK_B}; - a_this->mpAttackEfModelMorf[i] = new mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_fm", eff_bmd[i])), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); + a_this->mpAttackEfModelMorf[i] = JKR_NEW mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_fm", eff_bmd[i])), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); if (a_this->mpAttackEfModelMorf[i] == NULL || a_this->mpAttackEfModelMorf[i]->getModel() == NULL) { return 0; } if (i != 0) { - a_this->mpAttackEfBrk = new mDoExt_brkAnm(); + a_this->mpAttackEfBrk = JKR_NEW mDoExt_brkAnm(); if (a_this->mpAttackEfBrk == NULL) { return 0; } @@ -3596,7 +3596,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } } - a_this->mpAttackEfBtk[i] = new mDoExt_btkAnm(); + a_this->mpAttackEfBtk[i] = JKR_NEW mDoExt_btkAnm(); if (a_this->mpAttackEfBtk[i] == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_fs.cpp b/src/d/actor/d_a_e_fs.cpp index 2014c21ebc..f3c39bcb53 100644 --- a/src/d/actor/d_a_e_fs.cpp +++ b/src/d/actor/d_a_e_fs.cpp @@ -708,7 +708,7 @@ static int daE_Fs_Delete(e_fs_class* i_this) { static int useHeapIe_fst(fopAc_ac_c* i_this) { e_fs_class* _this = (e_fs_class*)i_this; - _this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_FS", 0xc), NULL, + _this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_FS", 0xc), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_FS", 9), J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, &_this->mCreatureSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_fz.cpp b/src/d/actor/d_a_e_fz.cpp index ad11594686..5ebea3988f 100644 --- a/src/d/actor/d_a_e_fz.cpp +++ b/src/d/actor/d_a_e_fz.cpp @@ -887,8 +887,8 @@ void daE_FZ_c::demoDelete() { fopAcM_delete(this); } -static bool daE_FZ_IsDelete(daE_FZ_c* i_this) { - return true; +static BOOL daE_FZ_IsDelete(daE_FZ_c* i_this) { + return TRUE; } s32 daE_FZ_c::_delete() { diff --git a/src/d/actor/d_a_e_gb.cpp b/src/d/actor/d_a_e_gb.cpp index 413f457bcc..5f05872ce6 100644 --- a/src/d/actor/d_a_e_gb.cpp +++ b/src/d/actor/d_a_e_gb.cpp @@ -1568,14 +1568,14 @@ static int daE_GB_Delete(e_gb_class* i_this) { static int useHeapInit(fopAc_ac_c* actor) { e_gb_class* i_this = (e_gb_class*)actor; - i_this->anmP = new mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_gb", dRes_INDEX_E_GB_BMD_GB_e)), NULL, NULL, + i_this->anmP = JKR_NEW mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_gb", dRes_INDEX_E_GB_BMD_GB_e)), NULL, NULL, static_cast(dComIfG_getObjectRes("E_gb", dRes_INDEX_E_GB_BCK_GB_WAIT_e)), 2, 1.0f, 0, -1, 1, NULL, J3DMdlFlag_DifferedDLBuffer, 0x11000084); if (i_this->anmP == NULL || i_this->anmP->getModel() == NULL) { return 0; } - i_this->flowerAnmP = new mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_gb", dRes_INDEX_E_GB_BMD_GF_e)), NULL, NULL, + i_this->flowerAnmP = JKR_NEW mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("E_gb", dRes_INDEX_E_GB_BMD_GF_e)), NULL, NULL, static_cast(dComIfG_getObjectRes("E_gb", dRes_INDEX_E_GB_BCK_GF_WAIT_CLOSE_e)), 2, 1.0f, 0, -1, 1, NULL, J3DMdlFlag_DifferedDLBuffer, 0x11000084); i_this->bodyAnmNo = dRes_ID_E_GB_BCK_GF_WAIT_CLOSE_e; @@ -1583,7 +1583,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - i_this->brkAnmP = new mDoExt_brkAnm(); + i_this->brkAnmP = JKR_NEW mDoExt_brkAnm(); if (i_this->brkAnmP == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_ge.cpp b/src/d/actor/d_a_e_ge.cpp index 4221e24b56..3e01743046 100644 --- a/src/d/actor/d_a_e_ge.cpp +++ b/src/d/actor/d_a_e_ge.cpp @@ -1257,7 +1257,7 @@ static int daE_GE_Delete(daE_GE_c* i_this) { } int daE_GE_c::CreateHeap() { - mpMorfSO = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_GE", 0xF), NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_GE", 0xF), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_GE", 0xC), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_gi.cpp b/src/d/actor/d_a_e_gi.cpp index 387e8619b3..607bb1388e 100644 --- a/src/d/actor/d_a_e_gi.cpp +++ b/src/d/actor/d_a_e_gi.cpp @@ -989,7 +989,7 @@ int daE_GI_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_GI", 0x13); JUT_ASSERT(1621, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_GI", 0xB), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_GI", 0xB), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_gm.cpp b/src/d/actor/d_a_e_gm.cpp index eef5561904..0232d04ae6 100644 --- a/src/d/actor/d_a_e_gm.cpp +++ b/src/d/actor/d_a_e_gm.cpp @@ -1660,7 +1660,7 @@ int daE_GM_c::CreateHeap() { JUT_ASSERT(2683, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mg", 9), + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mg", 9), 0, 1.0f, 0, -1, &mSound, 0, 0x11000084); } else { if (mType != TYPE_NORMAL) { @@ -1678,7 +1678,7 @@ int daE_GM_c::CreateHeap() { JUT_ASSERT(2714, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_gm", BCK_GB_APPEAR), + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_gm", BCK_GB_APPEAR), 0, 1.0f, 0, -1, &mSound, 0, 0x11000084); } diff --git a/src/d/actor/d_a_e_gob.cpp b/src/d/actor/d_a_e_gob.cpp index ac352decea..da54db1c43 100644 --- a/src/d/actor/d_a_e_gob.cpp +++ b/src/d/actor/d_a_e_gob.cpp @@ -2244,7 +2244,7 @@ static int daE_GOB_Delete(e_gob_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_gob_class* a_this = (e_gob_class*)i_this; - a_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_gob", BMDR_MG), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_gob", BCK_MG_WAIT), 2, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11000084); + a_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_gob", BMDR_MG), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_gob", BCK_MG_WAIT), 2, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11000084); if (a_this->mpModelMorf == NULL || a_this->mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_gs.cpp b/src/d/actor/d_a_e_gs.cpp index a9683523e6..07696af21a 100644 --- a/src/d/actor/d_a_e_gs.cpp +++ b/src/d/actor/d_a_e_gs.cpp @@ -172,7 +172,7 @@ static int daE_GS_Delete(e_gs_class* a_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_gs_class* a_this = (e_gs_class*)i_this; - a_this->model_morf = new mDoExt_McaMorfSO((J3DModelData* )dComIfG_getObjectRes("E_gs", 9), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_gs", 6), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + a_this->model_morf = JKR_NEW mDoExt_McaMorfSO((J3DModelData* )dComIfG_getObjectRes("E_gs", 9), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_gs", 6), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); if (a_this->model_morf == NULL || a_this->model_morf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_hb.cpp b/src/d/actor/d_a_e_hb.cpp index 46d1cd9645..d278a2d535 100644 --- a/src/d/actor/d_a_e_hb.cpp +++ b/src/d/actor/d_a_e_hb.cpp @@ -1341,7 +1341,7 @@ static int daE_HB_Delete(e_hb_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_hb_class* a_this = (e_hb_class*)i_this; - a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_hb", 0x17), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_hb", 0x12), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + a_this->modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_hb", 0x17), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_hb", 0x12), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_hb_leaf.cpp b/src/d/actor/d_a_e_hb_leaf.cpp index 4a28434d3c..21d1c0b262 100644 --- a/src/d/actor/d_a_e_hb_leaf.cpp +++ b/src/d/actor/d_a_e_hb_leaf.cpp @@ -48,7 +48,7 @@ static int daE_HB_LEAF_Delete(e_hb_leaf_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_hb_leaf_class* a_this = static_cast(i_this); - a_this->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_HB", 0x18), NULL, + a_this->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_HB", 0x18), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_HB", 0x13), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_hm.cpp b/src/d/actor/d_a_e_hm.cpp index fbb5294625..a3c0b19c5f 100644 --- a/src/d/actor/d_a_e_hm.cpp +++ b/src/d/actor/d_a_e_hm.cpp @@ -56,7 +56,7 @@ void daE_HM_HIO_c::genMessage(JORMContext* ctx) { int daE_HM_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_HM", 17); JUT_ASSERT(0xbf, modelData != NULL); - mAnm_p = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_HM", 13), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000284); if (mAnm_p == NULL || mAnm_p->getModel() == NULL) { @@ -65,7 +65,7 @@ int daE_HM_c::CreateHeap() { J3DModel* model = mAnm_p->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -74,7 +74,7 @@ int daE_HM_c::CreateHeap() { return 0; } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_hp.cpp b/src/d/actor/d_a_e_hp.cpp index cdb00ae7b7..97cff99445 100644 --- a/src/d/actor/d_a_e_hp.cpp +++ b/src/d/actor/d_a_e_hp.cpp @@ -1137,7 +1137,7 @@ static int daE_HP_Delete(daE_HP_c* i_this) { int daE_HP_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_HP", 19); JUT_ASSERT(0x764, modelData != NULL); - mpMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_HP", 13), 2, 1.0f, 0, -1, &mSound1, 0x80000, 0x11000084); if (mpMorfSO == NULL || mpMorfSO->getModel() == NULL) { @@ -1174,7 +1174,7 @@ int daE_HP_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("E_HP", 18); mpMorf = - new mDoExt_McaMorf(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_HP", 4), + JKR_NEW mDoExt_McaMorf(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_HP", 4), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (mpMorf == NULL || mpMorf->getModel() == 0) { diff --git a/src/d/actor/d_a_e_hz.cpp b/src/d/actor/d_a_e_hz.cpp index 217f3a2664..7b72c955ab 100644 --- a/src/d/actor/d_a_e_hz.cpp +++ b/src/d/actor/d_a_e_hz.cpp @@ -1926,7 +1926,7 @@ int daE_HZ_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_HZ", dRes_INDEX_E_HZ_BMD_HZ_e); JUT_ASSERT(2479, modelData != NULL); - mpMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_HZ", dRes_INDEX_E_HZ_BCK_HZ_WAIT_e), 0, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, 0x11000084); @@ -1947,7 +1947,7 @@ int daE_HZ_c::CreateHeap() { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_hzelda.cpp b/src/d/actor/d_a_e_hzelda.cpp index 6ecd3313e7..8f17db3939 100644 --- a/src/d/actor/d_a_e_hzelda.cpp +++ b/src/d/actor/d_a_e_hzelda.cpp @@ -1311,7 +1311,7 @@ static int daE_HZELDA_Delete(e_hzelda_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_hzelda_class* a_this = (e_hzelda_class*)i_this; - a_this->mpModelMorf = new mDoExt_McaMorfSO(static_cast(dComIfG_getObjectRes("Hzelda", 0x1B)), NULL, NULL, + a_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO(static_cast(dComIfG_getObjectRes("Hzelda", 0x1B)), NULL, NULL, static_cast(dComIfG_getObjectRes("Hzelda", 0x15)), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11000284); if (a_this->mpModelMorf == NULL || a_this->mpModelMorf->getModel() == NULL) { @@ -1339,7 +1339,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpTriangleAtBrk = new mDoExt_brkAnm(); + a_this->mpTriangleAtBrk = JKR_NEW mDoExt_brkAnm(); if (a_this->mpTriangleAtBrk == NULL) { return 0; } @@ -1349,7 +1349,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpTriangleAtBtk = new mDoExt_btkAnm(); + a_this->mpTriangleAtBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpTriangleAtBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_is.cpp b/src/d/actor/d_a_e_is.cpp index 1379fbf62e..505406a6d5 100644 --- a/src/d/actor/d_a_e_is.cpp +++ b/src/d/actor/d_a_e_is.cpp @@ -619,7 +619,7 @@ static int daE_IS_Delete(e_is_class* a_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_is_class* a_this = (e_is_class*)i_this; - a_this->model_morf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_IS", 0x13), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_IS", 0xE), 2, 1.0f, 0, -1, &a_this->sound, 0, 0x11020203); + a_this->model_morf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_IS", 0x13), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_IS", 0xE), 2, 1.0f, 0, -1, &a_this->sound, 0, 0x11020203); if (a_this->model_morf == NULL || a_this->model_morf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_kg.cpp b/src/d/actor/d_a_e_kg.cpp index 570944ff21..db90f9175d 100644 --- a/src/d/actor/d_a_e_kg.cpp +++ b/src/d/actor/d_a_e_kg.cpp @@ -656,14 +656,14 @@ static int daE_KG_Delete(e_kg_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_kg_class* a_this = (e_kg_class*) i_this; - a_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_kg", 0x12), NULL, NULL, + a_this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_kg", 0x12), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_kg", 0xE), 2, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11020084); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { return 0; } - a_this->mpBtp = new mDoExt_btpAnm(); + a_this->mpBtp = JKR_NEW mDoExt_btpAnm(); if (a_this->mpBtp == NULL) { return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_e_kk.cpp b/src/d/actor/d_a_e_kk.cpp index 8038ca1365..99e5a50711 100644 --- a/src/d/actor/d_a_e_kk.cpp +++ b/src/d/actor/d_a_e_kk.cpp @@ -1329,7 +1329,7 @@ int daE_KK_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_KK", 0x22); JUT_ASSERT(2212, modelData != NULL); - mpMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_KK", 0x19), 0, 1.0f, 0, -1, &mCreatureSound, 0, 0x31000084); if (mpMorfSO == NULL || mpMorfSO->getModel() == NULL) { @@ -1347,7 +1347,7 @@ int daE_KK_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_KK", 0x23); JUT_ASSERT(2247, modelData != NULL); - mpWeaponMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpWeaponMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_KK", 0x1D), 0, 1.0f, 0, -1, &mCreatureSound, 0, 0x31000084); if (mpWeaponMorfSO == NULL || mpWeaponMorfSO->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_kr.cpp b/src/d/actor/d_a_e_kr.cpp index af60702e80..3e64a1ec0d 100644 --- a/src/d/actor/d_a_e_kr.cpp +++ b/src/d/actor/d_a_e_kr.cpp @@ -2225,7 +2225,7 @@ static int daE_Kr_Delete(e_kr_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_kr_class* kr = (e_kr_class*)i_this; - kr->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_kr", 24), NULL, NULL, + kr->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_kr", 24), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_kr", 13), 2, 1.0f, 0, -1, &((e_kr_class*)i_this)->mSound, 0x80000, 0x11000084); if (kr->mpMorf == NULL || kr->mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_mb.cpp b/src/d/actor/d_a_e_mb.cpp index b750c328fd..0febef285f 100644 --- a/src/d/actor/d_a_e_mb.cpp +++ b/src/d/actor/d_a_e_mb.cpp @@ -638,12 +638,12 @@ static int daE_MB_Delete(e_mb_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_mb_class* a_this = (e_mb_class*)i_this; - a_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_mb", 0x19), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mb", 10), 0, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11020084); + a_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_mb", 0x19), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mb", 10), 0, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11020084); if (a_this->mpModelMorf == NULL || a_this->mpModelMorf->getModel() == NULL) { return 0; } - a_this->mpBtp = new mDoExt_btpAnm(); + a_this->mpBtp = JKR_NEW mDoExt_btpAnm(); if (a_this->mpBtp == NULL) { return cPhs_ERROR_e; } @@ -653,12 +653,12 @@ static int useHeapInit(fopAc_ac_c* i_this) { return cPhs_ERROR_e; } - a_this->mpBombModelMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_mb", 0x1B), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mb", 0x15), 0, 1.0f, 0, 1, 0, &a_this->mSound, 0x80000, 0x11000084); + a_this->mpBombModelMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_mb", 0x1B), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mb", 0x15), 0, 1.0f, 0, 1, 0, &a_this->mSound, 0x80000, 0x11000084); if (a_this->mpBombModelMorf == NULL || a_this->mpBombModelMorf->getModel() == NULL) { return 0; } - a_this->mpBombModel2Morf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_mb", 0x1A), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mb", 0x14), 0, 1.0f, 0, 1, 0, &a_this->mSound, 0x80000, 0x11000084); + a_this->mpBombModel2Morf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_mb", 0x1A), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mb", 0x14), 0, 1.0f, 0, 1, 0, &a_this->mSound, 0x80000, 0x11000084); if (a_this->mpBombModel2Morf == NULL || a_this->mpBombModel2Morf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_md.cpp b/src/d/actor/d_a_e_md.cpp index 30e5b5422b..8fd0ea3797 100644 --- a/src/d/actor/d_a_e_md.cpp +++ b/src/d/actor/d_a_e_md.cpp @@ -68,20 +68,20 @@ int daE_MD_c::CreateHeap() { JUT_ASSERT(180, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, NULL, NULL, 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, NULL, NULL, 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } if (mType == TYPE_DUMMY) { modelData = (J3DModelData*)dComIfG_getObjectRes("E_MD", 0xD); - mpYariModelMorf = new mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, NULL, NULL, 2, 1.0f, 0, -1, NULL, 0x80000, 0x11000084); + mpYariModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, NULL, NULL, 2, 1.0f, 0, -1, NULL, 0x80000, 0x11000084); if (mpYariModelMorf == NULL || mpYariModelMorf->getModel() == NULL) { return 0; } } else if (mType == TYPE_LV9) { modelData = (J3DModelData*)dComIfG_getObjectRes("E_MD", 0xA); - mpYariModelMorf = new mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, NULL, NULL, 2, 1.0f, 0, -1, NULL, 0x80000, 0x11000084); + mpYariModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, NULL, NULL, 2, 1.0f, 0, -1, NULL, 0x80000, 0x11000084); if (mpYariModelMorf == NULL || mpYariModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_mf.cpp b/src/d/actor/d_a_e_mf.cpp index f65c135958..da009ebc0d 100644 --- a/src/d/actor/d_a_e_mf.cpp +++ b/src/d/actor/d_a_e_mf.cpp @@ -3100,7 +3100,7 @@ static dJntColData_c jc_data[12] = { static int useHeapInit(fopAc_ac_c* a_this) { e_mf_class* i_this = (e_mf_class*)a_this; - i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_mf", 38), NULL, NULL, + i_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_mf", 38), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mf", 31), 0, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11000084); if (i_this->mpModelMorf == NULL || i_this->mpModelMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_mk.cpp b/src/d/actor/d_a_e_mk.cpp index bf9675440e..ab45d05ac9 100644 --- a/src/d/actor/d_a_e_mk.cpp +++ b/src/d/actor/d_a_e_mk.cpp @@ -2792,14 +2792,14 @@ static int daE_MK_Delete(e_mk_class* i_this) { static int useHeapInit(fopAc_ac_c* actor) { e_mk_class* i_this = (e_mk_class*)actor; - i_this->anmP = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_mk", dRes_INDEX_E_MK_BMD_MK_e), NULL, NULL, + i_this->anmP = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_mk", dRes_INDEX_E_MK_BMD_MK_e), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mk", dRes_INDEX_E_MK_BCK_MK_WAIT_e), 0, 1.0f, 0, -1, &i_this->sound, 0x80000, 0x11020084); if (i_this->anmP == NULL || i_this->anmP->getModel() == NULL) { return 0; } - i_this->btpP = new mDoExt_btpAnm(); + i_this->btpP = JKR_NEW mDoExt_btpAnm(); if (i_this->btpP == NULL) { return 0; } @@ -2808,7 +2808,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - i_this->crownAnmP = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_mk", dRes_INDEX_E_MK_BMD_OK_e), NULL, NULL, + i_this->crownAnmP = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_mk", dRes_INDEX_E_MK_BMD_OK_e), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mk", dRes_INDEX_E_MK_BCK_OK_DEFAULTPOSE_e), 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (i_this->crownAnmP == NULL || i_this->crownAnmP->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_mk_bo.cpp b/src/d/actor/d_a_e_mk_bo.cpp index 8cd027d63b..13a94c74b6 100644 --- a/src/d/actor/d_a_e_mk_bo.cpp +++ b/src/d/actor/d_a_e_mk_bo.cpp @@ -736,12 +736,12 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->efModelMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_mk", 0x2F), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mk", 6), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); + a_this->efModelMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_mk", 0x2F), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mk", 6), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); if (a_this->efModelMorf == NULL || a_this->efModelMorf->getModel() == NULL) { return 0; } - a_this->pbtk = new mDoExt_btkAnm(); + a_this->pbtk = JKR_NEW mDoExt_btkAnm(); if (a_this->pbtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_mm.cpp b/src/d/actor/d_a_e_mm.cpp index dcca056461..220fef256b 100644 --- a/src/d/actor/d_a_e_mm.cpp +++ b/src/d/actor/d_a_e_mm.cpp @@ -1017,7 +1017,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { bmd_index = 0x12; } - a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_MM", bmd_index), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_MM", 0xD), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + a_this->modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_MM", bmd_index), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_MM", 0xD), 2, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_ms.cpp b/src/d/actor/d_a_e_ms.cpp index 61690490ab..bd4d8a01bb 100644 --- a/src/d/actor/d_a_e_ms.cpp +++ b/src/d/actor/d_a_e_ms.cpp @@ -962,7 +962,7 @@ static int daE_MS_Delete(e_ms_class* i_this) { static int useHeapInit(fopAc_ac_c* actor) { e_ms_class* i_this = (e_ms_class*)actor; mDoExt_McaMorfSO* mMorf = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_MS", 20), NULL, NULL, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_MS", 20), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_MS", 16), 2, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11000084); i_this->mpModelMorf = mMorf; diff --git a/src/d/actor/d_a_e_nz.cpp b/src/d/actor/d_a_e_nz.cpp index dec0970516..e4958c5c7b 100644 --- a/src/d/actor/d_a_e_nz.cpp +++ b/src/d/actor/d_a_e_nz.cpp @@ -663,7 +663,7 @@ static int daE_NZ_Delete(e_nz_class* i_this) { static int useHeapInit(fopAc_ac_c* a_this) { e_nz_class* i_this = (e_nz_class*)a_this; - i_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_NZ", 13), NULL, + i_this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_NZ", 13), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_NZ", 10), 2, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11000084); if (i_this->mpMorf == NULL || i_this->mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_oc.cpp b/src/d/actor/d_a_e_oc.cpp index 3f7d418ee6..47afc8e658 100644 --- a/src/d/actor/d_a_e_oc.cpp +++ b/src/d/actor/d_a_e_oc.cpp @@ -2616,8 +2616,8 @@ static void daE_OC_Execute(daE_OC_c* i_this) { i_this->execute(); } -static bool daE_OC_IsDelete(daE_OC_c* param_0) { - return true; +static BOOL daE_OC_IsDelete(daE_OC_c* param_0) { + return TRUE; } int daE_OC_c::_delete() { @@ -2643,7 +2643,7 @@ static void daE_OC_Delete(daE_OC_c* i_this) { int daE_OC_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes(mName, 0x3); JUT_ASSERT(3443, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_ocb", 0x1b), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_oct_bg.cpp b/src/d/actor/d_a_e_oct_bg.cpp index da094293f1..aee083e1d7 100644 --- a/src/d/actor/d_a_e_oct_bg.cpp +++ b/src/d/actor/d_a_e_oct_bg.cpp @@ -764,7 +764,7 @@ int daE_OctBg_c::JointCallBack(J3DJoint* param_0, int param_1) { int daE_OctBg_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_bg", 10); JUT_ASSERT(1341, modelData != NULL); - field_0x5b4 = new mDoExt_McaMorfSO( + field_0x5b4 = JKR_NEW mDoExt_McaMorfSO( modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_bg", 7), 0, 1.0f, 0, -1, &field_0x5bc, 0x80000, 0x11000084); if (field_0x5b4 == NULL || field_0x5b4->getModel() == NULL) { @@ -775,7 +775,7 @@ int daE_OctBg_c::CreateHeap() { for (u16 i = 1; i < model->getModelData()->getJointNum(); i++) { model->getModelData()->getJointNodePointer(i)->setCallBack(JointCallBack); } - field_0x5b8 = new mDoExt_brkAnm(); + field_0x5b8 = JKR_NEW mDoExt_brkAnm(); if (field_0x5b8 == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_ot.cpp b/src/d/actor/d_a_e_ot.cpp index 0da1766553..8a364fa486 100644 --- a/src/d/actor/d_a_e_ot.cpp +++ b/src/d/actor/d_a_e_ot.cpp @@ -710,7 +710,7 @@ static int daE_OT_Delete(daE_OT_c* i_this) { int daE_OT_c::CreateHeap() { J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("E_OT", 14); - mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_OT", ANM_BORN), J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); @@ -724,7 +724,7 @@ int daE_OT_c::CreateHeap() { return 0; } - mpEggAnm = new mDoExt_btkAnm(); + mpEggAnm = JKR_NEW mDoExt_btkAnm(); if (mpEggAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_ph.cpp b/src/d/actor/d_a_e_ph.cpp index 01440f62ab..f2195b41d9 100644 --- a/src/d/actor/d_a_e_ph.cpp +++ b/src/d/actor/d_a_e_ph.cpp @@ -160,7 +160,7 @@ int daE_PH_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_PH", PH_BMD); JUT_ASSERT(0, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO( + mpMorf = JKR_NEW mDoExt_McaMorfSO( modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PH", ANM_WAIT), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpMorf == NULL || mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_pm.cpp b/src/d/actor/d_a_e_pm.cpp index 4d3cae2e62..81d2422985 100644 --- a/src/d/actor/d_a_e_pm.cpp +++ b/src/d/actor/d_a_e_pm.cpp @@ -174,7 +174,7 @@ int daE_PM_c::DemoSkipCallBack(void* i_this, int param_1) { int daE_PM_c::CreateHeap() { J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1d); - mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PM", 0x10), J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, &mCreatureSound, 0x80000, 0x11020084); @@ -182,7 +182,7 @@ int daE_PM_c::CreateHeap() { return 0; } - mpEyeAnm = new mDoExt_btpAnm(); + mpEyeAnm = JKR_NEW mDoExt_btpAnm(); if (mpEyeAnm == NULL) { return 5; } @@ -198,7 +198,7 @@ int daE_PM_c::CreateHeap() { return 0; } - mpTrumpetMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1f), NULL, + mpTrumpetMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1f), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PM", 0x19), J3DFrameCtrl::EMode_NONE, 0.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); @@ -206,7 +206,7 @@ int daE_PM_c::CreateHeap() { return 0; } - mpGlowEffectMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1c), NULL, + mpGlowEffectMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1c), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PM", 5), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); @@ -293,7 +293,7 @@ void daE_PM_c::SetAnm(int i_anm, int i_attr, f32 i_morf, f32 i_rate) { } static void dummy() { - delete (cM3dGPla*)NULL; + JKR_DELETE((cM3dGPla*)NULL); } static BOOL way_bg_check2(daE_PM_c* i_this, cXyz i_start, cXyz i_end) { diff --git a/src/d/actor/d_a_e_po.cpp b/src/d/actor/d_a_e_po.cpp index c4790c355e..186323e400 100644 --- a/src/d/actor/d_a_e_po.cpp +++ b/src/d/actor/d_a_e_po.cpp @@ -2842,7 +2842,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { e_po_class* a_this = (e_po_class*)i_this; a_this->mpMorf = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_PO", 0x1B), NULL, NULL, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_PO", 0x1B), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PO", 0x15), 2, 1.0f, 0, -1, &a_this->mSound1, 0x80000, 0x11000084); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { @@ -2867,7 +2867,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } a_this->mpMorf3 = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_PO", 0x1D), NULL, NULL, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_PO", 0x1D), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PO", 0x17), 0, 1.0f, 0, -1, &a_this->mSound1, 0x80000, 0x11000084); if (a_this->mpMorf3 == NULL || a_this->mpMorf3->getModel() == NULL) { @@ -2879,7 +2879,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpMorf2 = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_PO", 0x1A), NULL, + a_this->mpMorf2 = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_PO", 0x1A), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PO", 0x4), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (a_this->mpMorf2 == NULL || a_this->mpMorf2->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_pz.cpp b/src/d/actor/d_a_e_pz.cpp index 3801be9c80..6b19d21abd 100644 --- a/src/d/actor/d_a_e_pz.cpp +++ b/src/d/actor/d_a_e_pz.cpp @@ -2392,7 +2392,7 @@ int daE_PZ_c::CreateHeap() { return 0; } - mpPortalBtk = new mDoExt_btkAnm(); + mpPortalBtk = JKR_NEW mDoExt_btkAnm(); if (mpPortalBtk == NULL) { return 0; } @@ -2402,7 +2402,7 @@ int daE_PZ_c::CreateHeap() { } for (int i = 0; i < 2; i++) { - mpPortalBrk[i] = new mDoExt_brkAnm(); + mpPortalBrk[i] = JKR_NEW mDoExt_brkAnm(); if (mpPortalBrk[i] == NULL) { return 0; } @@ -2415,13 +2415,13 @@ int daE_PZ_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("E_PZ", 0x19); JUT_ASSERT(3920, modelData != NULL); - mpBallModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PZ", 7), 2, 1.0f, 0, -1, NULL, 0, 0x11000084); + mpBallModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PZ", 7), 2, 1.0f, 0, -1, NULL, 0, 0x11000084); if (mpBallModelMorf == NULL) { return 0; } for (int i = 0; i < 2; i++) { - mpBallBrk = new mDoExt_brkAnm(); + mpBallBrk = JKR_NEW mDoExt_brkAnm(); if (mpBallBrk == NULL) { return 0; } @@ -2436,12 +2436,12 @@ int daE_PZ_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_PZ", 0x1C); JUT_ASSERT(3959, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PZ", 8), 2, 1.0f, 0, -1, &field_0x5dc, 0, 0x11000284); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PZ", 8), 2, 1.0f, 0, -1, &field_0x5dc, 0, 0x11000284); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } - mpPzBrk = new mDoExt_brkAnm(); + mpPzBrk = JKR_NEW mDoExt_brkAnm(); if (mpPzBrk == NULL) { return 0; } @@ -2450,7 +2450,7 @@ int daE_PZ_c::CreateHeap() { return 0; } - mpPzBtk = new mDoExt_btkAnm(); + mpPzBtk = JKR_NEW mDoExt_btkAnm(); if (mpPzBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_rb.cpp b/src/d/actor/d_a_e_rb.cpp index c34dddbd43..1976e43c0f 100644 --- a/src/d/actor/d_a_e_rb.cpp +++ b/src/d/actor/d_a_e_rb.cpp @@ -756,7 +756,7 @@ static int daE_RB_Delete(e_rb_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_rb_class* a_this = (e_rb_class*)i_this; - a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_rb", 0xB), NULL, NULL, NULL, 0, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); + a_this->modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_rb", 0xB), NULL, NULL, NULL, 0, 1.0f, 0, -1, &a_this->sound, 0x80000, 0x11000084); if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_rd.cpp b/src/d/actor/d_a_e_rd.cpp index 257067c169..055f2fad7f 100644 --- a/src/d/actor/d_a_e_rd.cpp +++ b/src/d/actor/d_a_e_rd.cpp @@ -2472,14 +2472,14 @@ static void e_rd_wb_run_B(e_rd_class* i_this) { } } - if (i_this->anm == e_rdb_class::BCK_RB_RGUARD_F || i_this->anm == e_rdb_class::BCK_RB_RDAMAGEB + if (i_this->anm == e_rdb_class::BCK_RB_RGUARD_F || i_this->anm == e_rdb_class::BCK_RB_RDAMAGEB || i_this->anm == e_rdb_class::BCK_RB_RGUARD_L || i_this->anm == e_rdb_class::BCK_RB_RGUARD_R) { i_this->field_0x9c8 = 0; if (i_this->anm_p->isStop()) { anm_init(i_this, e_rdb_class::BCK_RB_RRUN, 5.0f, 2, 1.0f); } - } else if (i_this->anm == e_rdb_class::BCK_RB_RPLAY_RUNR || i_this->anm == e_rdb_class::BCK_RB_RPLAY_RUNL + } else if (i_this->anm == e_rdb_class::BCK_RB_RPLAY_RUNR || i_this->anm == e_rdb_class::BCK_RB_RPLAY_RUNL || i_this->anm == e_rdb_class::BCK_RB_RPLAY_STOP) { if ((int)i_this->anm_p->getFrame() == 21) { i_this->sound.startCreatureVoice(Z2SE_EN_RDB_HORN, -1); @@ -4327,7 +4327,7 @@ static void damage_check(e_rd_class* i_this) { s16 cur_health = enemy->health; // unused OS_REPORT(" HIT AT %d\n", i_this->AtInfo.mAttackPower); - if (i_this->one_hit_kill != 0 && (i_this->AtInfo.mpCollider->ChkAtType(AT_TYPE_SLINGSHOT) || + if (i_this->one_hit_kill != 0 && (i_this->AtInfo.mpCollider->ChkAtType(AT_TYPE_SLINGSHOT) || (i_this->AtInfo.mHitType != 1 && i_this->AtInfo.mHitType != 16 && i_this->AtInfo.mHitType != 2))) { i_this->damage_timer = 1000; i_this->action = ACTION_DROP; @@ -4443,7 +4443,7 @@ static void damage_check(e_rd_class* i_this) { i_this->sound.startCreatureVoice(Z2SE_EN_RDB_V_DAMAGE, -1); - if (i_this->anm == e_rdb_class::BCK_RB_RPLAY_RUNL || i_this->anm == e_rdb_class::BCK_RB_RPLAY_RUNR + if (i_this->anm == e_rdb_class::BCK_RB_RPLAY_RUNL || i_this->anm == e_rdb_class::BCK_RB_RPLAY_RUNR || i_this->anm == e_rdb_class::BCK_RB_RPLAY_STOP) { i_this->anm = i_this->field_0x680; i_this->field_0x680 = 0; @@ -4921,7 +4921,7 @@ static void e_rd_tag(e_rd_class* i_this) { break; } - if (S_find != 0 && (i_this->counter & 31) == 0 && !dComIfGp_event_runCheck() && i_this->dis < 3000.0f && i_this->dis > 500.0f && + if (S_find != 0 && (i_this->counter & 31) == 0 && !dComIfGp_event_runCheck() && i_this->dis < 3000.0f && i_this->dis > 500.0f && i_this->field_0x5bb != 0 && !fopAcM_otherBgCheck(enemy, pla)) { rd_count = 0; fpcM_Search(s_tag_sub, i_this); @@ -5647,7 +5647,7 @@ static void action(e_rd_class* i_this) { cXyz sc(scale, scale, scale); csXyz rot(0, 0, 0); for (int i = 0; i < 3; i++) { - i_this->enemy_downWtrA[i] = dComIfGp_particle_set(i_this->enemy_downWtrA[i], w_eff_name[i], &ato, &enemy->tevStr, + i_this->enemy_downWtrA[i] = dComIfGp_particle_set(i_this->enemy_downWtrA[i], w_eff_name[i], &ato, &enemy->tevStr, &rot, &sc, 0xFF, 0, -1, NULL, NULL, NULL); } } else { @@ -7136,7 +7136,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { J3DModel* model; if (i_this->actor_set != 0) { - i_this->anm_p = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_rdb", e_rdb_class::BMDR_RB), NULL, NULL, + i_this->anm_p = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_rdb", e_rdb_class::BMDR_RB), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_rdb", e_rdb_class::BCK_RB_RWAIT), 2, 1.0f, 0, -1, &i_this->sound, 0x80000, 0x11000084); if (i_this->anm_p == NULL || i_this->anm_p->getModel() == NULL) { @@ -7151,7 +7151,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { } if (i_this->actor_set == 1) { - i_this->mpMorfHornAnm = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_rdb", e_rdb_class::BMDR_RB_HORN), + i_this->mpMorfHornAnm = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_rdb", e_rdb_class::BMDR_RB_HORN), NULL, NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (i_this->mpMorfHornAnm == NULL || i_this->mpMorfHornAnm->getModel() == NULL) { return 0; @@ -7197,7 +7197,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { } } } else { - i_this->anm_p = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->resName, BMDR_RD), NULL, NULL, + i_this->anm_p = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->resName, BMDR_RD), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(i_this->resName, BCK_RD_WAIT01), 0, 1.0f, 0, -1, &i_this->sound, 0x80000, 0x11000084); if (i_this->anm_p == NULL || i_this->anm_p->getModel() == NULL) { @@ -7229,7 +7229,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { i_this->arrow->setBaseTRMtx(mDoMtx_stack_c::get()); } else if (i_this->weapon_type >= 2) { - i_this->bow_anm = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->resName, BMDR_RD_BOW), NULL, NULL, + i_this->bow_anm = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->resName, BMDR_RD_BOW), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(i_this->resName, BCK_RD_BOW_SHOOT), 0, 1.0f, 0, -1, NULL, 0x80000, 0x11000084); if (i_this->bow_anm == NULL || i_this->bow_anm->getModel() == NULL) { @@ -7384,7 +7384,7 @@ static cPhs_Step daE_RD_Create(fopAc_ac_c* actor) { i_this->action = ACTION_BOW_IKKI; i_this->timer[0] = 142 + XREG_S(2); } else if (i_this->arg2 == 11) { - fopAcM_create(PROC_E_RDY, fopAcM_GetParam(actor), &actor->home.pos, + fopAcM_create(PROC_E_RDY, fopAcM_GetParam(actor), &actor->home.pos, fopAcM_GetRoomNo(actor), &actor->home.angle, NULL, -1); } diff --git a/src/d/actor/d_a_e_rdb.cpp b/src/d/actor/d_a_e_rdb.cpp index 9f289ae00f..2c4a96753f 100644 --- a/src/d/actor/d_a_e_rdb.cpp +++ b/src/d/actor/d_a_e_rdb.cpp @@ -1753,7 +1753,7 @@ static int daE_RDB_Delete(e_rdb_class* i_this) { static int useHeapInit(fopAc_ac_c* actor) { e_rdb_class* i_this = (e_rdb_class*)actor; i_this->mpModelMorf = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_rdb", e_rdb_class::BMDR_RB), NULL, NULL, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_rdb", e_rdb_class::BMDR_RB), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_rdb", e_rdb_class::BCK_RB_WAIT01), 2, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11000084); if (i_this->mpModelMorf == NULL || i_this->mpModelMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_rdy.cpp b/src/d/actor/d_a_e_rdy.cpp index 3f37e1c119..0b193c813a 100644 --- a/src/d/actor/d_a_e_rdy.cpp +++ b/src/d/actor/d_a_e_rdy.cpp @@ -4796,7 +4796,7 @@ static dJntColData_c jc_data[11] = { static int useHeapInit(fopAc_ac_c* i_this) { e_rdy_class* _this = (e_rdy_class*)i_this; - _this->mpMorf = new mDoExt_McaMorfSO( + _this->mpMorf = JKR_NEW mDoExt_McaMorfSO( (J3DModelData*)dComIfG_getObjectRes(_this->mpArcName, 81), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(_this->mpArcName, 76), J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, &_this->mSound, 0x80000, 0x11000084); @@ -4821,7 +4821,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } } else if (_this->mWeaponType >= WEAPON_BOW) { - _this->mpBowMorf = new mDoExt_McaMorfSO( + _this->mpBowMorf = JKR_NEW mDoExt_McaMorfSO( (J3DModelData*)dComIfG_getObjectRes(_this->mpArcName, 84), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(_this->mpArcName, 11), J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, NULL, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_s1.cpp b/src/d/actor/d_a_e_s1.cpp index 0d28f23cda..28f8b23e4a 100644 --- a/src/d/actor/d_a_e_s1.cpp +++ b/src/d/actor/d_a_e_s1.cpp @@ -2064,7 +2064,7 @@ static dJntColData_c jc_data[] = { static int useHeapInit(fopAc_ac_c* i_this) { e_s1_class* a_this = (e_s1_class*)i_this; - a_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_S2", 0x22), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_S2", 0x1D), 0, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11000084); + a_this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_S2", 0x22), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_S2", 0x1D), 0, 1.0f, 0, -1, &a_this->mSound, 0x80000, 0x11000084); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_sb.cpp b/src/d/actor/d_a_e_sb.cpp index 065cb8e67e..9910cd9848 100644 --- a/src/d/actor/d_a_e_sb.cpp +++ b/src/d/actor/d_a_e_sb.cpp @@ -68,7 +68,7 @@ void daE_SB_HIO_c::genMessage(JORMContext* ctext) { int daE_SB_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes("E_SB", 0xF); JUT_ASSERT(271, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_SB", 0xC), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_sf.cpp b/src/d/actor/d_a_e_sf.cpp index a989779dfb..21ca6b8b18 100644 --- a/src/d/actor/d_a_e_sf.cpp +++ b/src/d/actor/d_a_e_sf.cpp @@ -1698,7 +1698,7 @@ static int daE_SF_Delete(e_sf_class* i_this) { static int useHeapInit(fopAc_ac_c* a_this) { e_sf_class* i_this = (e_sf_class*)a_this; - i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_sf", BMDR_SF), NULL, NULL, + i_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_sf", BMDR_SF), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_sf", BCK_SF_WAIT01), 0, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11000084); if (i_this->mpModelMorf == NULL || i_this->mpModelMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_sh.cpp b/src/d/actor/d_a_e_sh.cpp index 397f067d20..af88039e29 100644 --- a/src/d/actor/d_a_e_sh.cpp +++ b/src/d/actor/d_a_e_sh.cpp @@ -1130,7 +1130,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { e_sh_class* sh = (e_sh_class*)i_this; - sh->mAnm_p = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_sh", 22), NULL, NULL, + sh->mAnm_p = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_sh", 22), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_sh", 14), 2, 1.0f, 0, -1, &sh->mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_sm.cpp b/src/d/actor/d_a_e_sm.cpp index 3e05e7ad61..d50a676406 100644 --- a/src/d/actor/d_a_e_sm.cpp +++ b/src/d/actor/d_a_e_sm.cpp @@ -1848,7 +1848,7 @@ int daE_SM_c::CreateHeap() { return 0; } - mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_SM", BMDR_SC), NULL, NULL, + mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_SM", BMDR_SC), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_SM", BCK_SC_WAIT), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_e_sm2.cpp b/src/d/actor/d_a_e_sm2.cpp index c81be26d70..cd28399840 100644 --- a/src/d/actor/d_a_e_sm2.cpp +++ b/src/d/actor/d_a_e_sm2.cpp @@ -1420,7 +1420,7 @@ static int daE_SM2_Delete(e_sm2_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_sm2_class* a_this = (e_sm2_class*)i_this; - a_this->modelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_sm2", 8), NULL, NULL, NULL, 2, 1.0f, 0, -1, &a_this->sound, 0, 0x11000284); + a_this->modelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_sm2", 8), NULL, NULL, NULL, 2, 1.0f, 0, -1, &a_this->sound, 0, 0x11000284); if (a_this->modelMorf == NULL || a_this->modelMorf->getModel() == NULL) { return 0; } @@ -1437,7 +1437,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } } - a_this->pbtk = new mDoExt_btkAnm(); + a_this->pbtk = JKR_NEW mDoExt_btkAnm(); if (a_this->pbtk == NULL) { return 0; } @@ -1446,7 +1446,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->pieceModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_sm2", 5), NULL, NULL, NULL, 0, 1.0f, 0, -1, &a_this->sound, 0, 0x11000084); + a_this->pieceModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_sm2", 5), NULL, NULL, NULL, 0, 1.0f, 0, -1, &a_this->sound, 0, 0x11000084); if (a_this->pieceModelMorf == NULL || a_this->pieceModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_st.cpp b/src/d/actor/d_a_e_st.cpp index 8a7392d32c..30dc9665cc 100644 --- a/src/d/actor/d_a_e_st.cpp +++ b/src/d/actor/d_a_e_st.cpp @@ -2911,7 +2911,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { i_index = BMDR_ST2; } - i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_st", i_index), NULL, NULL, + i_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_st", i_index), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_st", BCK_ST_WAIT), 0, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11000084); if (i_this->mpModelMorf == NULL || i_this->mpModelMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_sw.cpp b/src/d/actor/d_a_e_sw.cpp index b1b861e86a..86ae7252cc 100644 --- a/src/d/actor/d_a_e_sw.cpp +++ b/src/d/actor/d_a_e_sw.cpp @@ -1624,7 +1624,7 @@ static int daE_SW_Delete(daE_SW_c* i_this) { } int daE_SW_c::CreateHeap() { - mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_SW", BMDR_SW), NULL, NULL, + mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_SW", BMDR_SW), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_SW", BCK_SW_WAIT), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_e_th.cpp b/src/d/actor/d_a_e_th.cpp index d030dd7565..211d31eebf 100644 --- a/src/d/actor/d_a_e_th.cpp +++ b/src/d/actor/d_a_e_th.cpp @@ -1175,7 +1175,7 @@ static int daE_TH_Delete(e_th_class* i_this) { static int useHeapInit(fopAc_ac_c* a_this) { e_th_class* i_this = (e_th_class*)a_this; - i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_th", 0x1F), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_th", 0x1B), 0, 1.0f, 0, -1, &i_this->mSound, 0, 0x11000084); + i_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_th", 0x1F), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_th", 0x1B), 0, 1.0f, 0, -1, &i_this->mSound, 0, 0x11000084); if (i_this->mpModelMorf == NULL || i_this->mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_tk.cpp b/src/d/actor/d_a_e_tk.cpp index ca9a5445e4..392b9591f4 100644 --- a/src/d/actor/d_a_e_tk.cpp +++ b/src/d/actor/d_a_e_tk.cpp @@ -721,7 +721,7 @@ static int useHeapInit(fopAc_ac_c* actor) { e_tk_class* i_this = static_cast(actor); i_this->mpMorf = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_tk", 0xE), NULL, NULL, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_tk", 0xE), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_tk", ANM_TK_SWIM), 2, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_tk2.cpp b/src/d/actor/d_a_e_tk2.cpp index b28faa1b9b..51bfe24ab8 100644 --- a/src/d/actor/d_a_e_tk2.cpp +++ b/src/d/actor/d_a_e_tk2.cpp @@ -533,7 +533,7 @@ static int useHeapInit(fopAc_ac_c* actor) { e_tk2_class* i_this = static_cast(actor); i_this->mpMorf = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_tk2", 0xE), NULL, NULL, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_tk2", 0xE), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_tk2", 0x9), 2, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_tt.cpp b/src/d/actor/d_a_e_tt.cpp index 1c26e5c721..c75277bbe6 100644 --- a/src/d/actor/d_a_e_tt.cpp +++ b/src/d/actor/d_a_e_tt.cpp @@ -1206,7 +1206,7 @@ int daE_TT_c::CreateHeap() { JUT_ASSERT(1881, modelData != NULL); - mpMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_TT", 0xE), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpMorfSO == NULL || mpMorfSO->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_vt.cpp b/src/d/actor/d_a_e_vt.cpp index 477527a9e2..c474cad11b 100644 --- a/src/d/actor/d_a_e_vt.cpp +++ b/src/d/actor/d_a_e_vt.cpp @@ -3651,7 +3651,7 @@ int daE_VA_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_VA", 0x33); JUT_ASSERT(0, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_VA", 15), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x31000084); if (mpMorf == NULL || mpMorf->getModel() == NULL) { @@ -3679,7 +3679,7 @@ int daE_VA_c::CreateHeap() { return 0; } - mpWeaponBrk = new mDoExt_brkAnm(); + mpWeaponBrk = JKR_NEW mDoExt_brkAnm(); if (mpWeaponBrk == NULL) { return 0; } @@ -3694,7 +3694,7 @@ int daE_VA_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("E_VA", 0x37); JUT_ASSERT(0, modelData != NULL); - mpEndEfMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpEndEfMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_VA", 7), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x31000084); if (mpEndEfMorf == NULL || mpEndEfMorf->getModel() == NULL) { @@ -3710,7 +3710,7 @@ int daE_VA_c::CreateHeap() { } } - mpEndEfBrk = new mDoExt_brkAnm(); + mpEndEfBrk = JKR_NEW mDoExt_brkAnm(); if (mpEndEfBrk == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_warpappear.cpp b/src/d/actor/d_a_e_warpappear.cpp index e011101282..b6c5c627e6 100644 --- a/src/d/actor/d_a_e_warpappear.cpp +++ b/src/d/actor/d_a_e_warpappear.cpp @@ -838,7 +838,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - i_this->btk = new mDoExt_btkAnm(); + i_this->btk = JKR_NEW mDoExt_btkAnm(); if (i_this->btk == NULL) { return 0; } @@ -847,7 +847,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - i_this->anm_p[0] = new mDoExt_brkAnm(); + i_this->anm_p[0] = JKR_NEW mDoExt_brkAnm(); if (i_this->anm_p[0] == NULL) { return 0; } @@ -857,7 +857,7 @@ static int useHeapInit(fopAc_ac_c* actor) { } i_this->anm_p[0]->setPlaySpeed(0.0f); - i_this->anm_p[1] = new mDoExt_brkAnm(); + i_this->anm_p[1] = JKR_NEW mDoExt_brkAnm(); if (i_this->anm_p[1] == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_wb.cpp b/src/d/actor/d_a_e_wb.cpp index 39aa274db7..e078e09c22 100644 --- a/src/d/actor/d_a_e_wb.cpp +++ b/src/d/actor/d_a_e_wb.cpp @@ -5475,7 +5475,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { e_wb_class* i_this = (e_wb_class*)a_this; i_this->mpModelMorf = - new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 0x2e), NULL, + JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->mResName, 0x2e), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(i_this->mResName, 0x28), 0, 1.0f, 0, -1, &i_this->mZ2Ride, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_ws.cpp b/src/d/actor/d_a_e_ws.cpp index 4c4d80c248..4f5e229cc7 100644 --- a/src/d/actor/d_a_e_ws.cpp +++ b/src/d/actor/d_a_e_ws.cpp @@ -891,7 +891,7 @@ int daE_WS_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_WS", 0xD); JUT_ASSERT(1401, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_WS", 7), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_WS", 7), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_ww.cpp b/src/d/actor/d_a_e_ww.cpp index 0c3a254603..e77b8b2028 100644 --- a/src/d/actor/d_a_e_ww.cpp +++ b/src/d/actor/d_a_e_ww.cpp @@ -2152,7 +2152,7 @@ int daE_WW_c::CreateHeap() { JUT_ASSERT(2823, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_WW", BCK_WW_APPEAR), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_WW", BCK_WW_APPEAR), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_yc.cpp b/src/d/actor/d_a_e_yc.cpp index f6b975f4e9..9e9a5d4c82 100644 --- a/src/d/actor/d_a_e_yc.cpp +++ b/src/d/actor/d_a_e_yc.cpp @@ -742,7 +742,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { e_yc_class* _this = static_cast(i_this); _this->mpMorf = - new mDoExt_McaMorfSO(static_cast(dComIfG_getObjectRes("E_yc", 24)), NULL, + JKR_NEW mDoExt_McaMorfSO(static_cast(dComIfG_getObjectRes("E_yc", 24)), NULL, NULL, static_cast(dComIfG_getObjectRes("E_yc", 21)), 2, 1.0f, 0, -1, &_this->mCreatureSound, 0x80000, 0x11000084); if (_this->mpMorf == NULL || _this->mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_yd.cpp b/src/d/actor/d_a_e_yd.cpp index 3146abf018..e56167154c 100644 --- a/src/d/actor/d_a_e_yd.cpp +++ b/src/d/actor/d_a_e_yd.cpp @@ -1313,7 +1313,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { e_yd_class* a_this = (e_yd_class*)i_this; - a_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_yd", 24), + a_this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_yd", 24), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_yd", 19), 2, 1.0f, 0, -1, &a_this->mCreatureSound, 0x80000, 0x11000084); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { @@ -1322,7 +1322,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { J3DModel* model = a_this->mpMorf->getModel(); - a_this->mBrkAnm = new mDoExt_brkAnm(); + a_this->mBrkAnm = JKR_NEW mDoExt_brkAnm(); if (a_this->mBrkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_yd_leaf.cpp b/src/d/actor/d_a_e_yd_leaf.cpp index dbcc9a2f93..c6ba61eddf 100644 --- a/src/d/actor/d_a_e_yd_leaf.cpp +++ b/src/d/actor/d_a_e_yd_leaf.cpp @@ -55,7 +55,7 @@ static int daE_YD_LEAF_Delete(e_yd_leaf_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_yd_leaf_class* a_this = static_cast(i_this); - a_this->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_YD", 0x19), NULL, + a_this->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_YD", 0x19), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_YD", 0x14), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_yg.cpp b/src/d/actor/d_a_e_yg.cpp index d5d0e53868..1fa8227af1 100644 --- a/src/d/actor/d_a_e_yg.cpp +++ b/src/d/actor/d_a_e_yg.cpp @@ -1318,7 +1318,7 @@ static int daE_YG_Delete(e_yg_class* i_this) { static int useHeapInit(fopAc_ac_c* a_this) { e_yg_class* i_this = (e_yg_class*)a_this; - i_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_YG", 0x13), NULL, NULL, + i_this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_YG", 0x13), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_YG", 0xF), 2, 1.0f, 0, -1, &i_this->mSound, J3DMdlFlag_DifferedDLBuffer, 0x11000084); if (i_this->mpMorf == NULL || i_this->mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_e_yh.cpp b/src/d/actor/d_a_e_yh.cpp index 369b19b216..2c974a9add 100644 --- a/src/d/actor/d_a_e_yh.cpp +++ b/src/d/actor/d_a_e_yh.cpp @@ -2072,7 +2072,7 @@ static int daE_YH_Delete(e_yh_class* i_this) { static int useHeapInit(fopAc_ac_c* a_this) { e_yh_class* i_this = (e_yh_class*)a_this; - i_this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_yd", 0x18), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_yd", 0x13), 2, 1.0, 0, -1, &i_this->mSound, + i_this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_yd", 0x18), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_yd", 0x13), 2, 1.0, 0, -1, &i_this->mSound, 0x80000, 0x11000084); if (i_this->mpMorf == NULL || i_this->mpMorf->getModel() == NULL) { @@ -2080,7 +2080,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { } J3DModel* model = i_this->mpMorf->getModel(); - i_this->mBrk = new mDoExt_brkAnm(); + i_this->mBrk = JKR_NEW mDoExt_brkAnm(); if (i_this->mBrk == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_yk.cpp b/src/d/actor/d_a_e_yk.cpp index b9dcff3ff8..01ad370b34 100644 --- a/src/d/actor/d_a_e_yk.cpp +++ b/src/d/actor/d_a_e_yk.cpp @@ -1411,7 +1411,7 @@ static int daE_YK_Delete(e_yk_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_yk_class* yk = (e_yk_class*)i_this; - yk->mpMorfSO = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_YK", 12), + yk->mpMorfSO = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_YK", 12), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_YK",9), 2, 1.0f, 0, -1, &yk->mCreature, 0x80000,0x11000084); if (!yk->mpMorfSO || !yk->mpMorfSO->mpModel) { return 0; diff --git a/src/d/actor/d_a_e_ym.cpp b/src/d/actor/d_a_e_ym.cpp index abd0708023..39beadca9d 100644 --- a/src/d/actor/d_a_e_ym.cpp +++ b/src/d/actor/d_a_e_ym.cpp @@ -3322,13 +3322,13 @@ int daE_YM_c::CreateHeap() { if (mFlyType == 1) { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_TM", 0x11); JUT_ASSERT(0x1094, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_TM", 10), + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_TM", 10), 0, 1.0f, 0, -1, &mSound, 0x80000,0x11000084); if (mpMorf == NULL || mpMorf->getModel() == NULL) { return 0; } - mpBrk = new mDoExt_brkAnm(); + mpBrk = JKR_NEW mDoExt_brkAnm(); if (mpBrk == NULL) { return 0; } @@ -3341,13 +3341,13 @@ int daE_YM_c::CreateHeap() { } else { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_YM", 0x13); JUT_ASSERT(0x10bb, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_YM", 0x10), + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_YM", 0x10), 0, 1.0f, 0, -1, &mSound, 0x80000,0x11000084); if (mpMorf == NULL || mpMorf->getModel() == NULL) { return 0; } - mpBrk = new mDoExt_brkAnm(); + mpBrk = JKR_NEW mDoExt_brkAnm(); if (mpBrk == NULL) { return 0; } @@ -3360,7 +3360,7 @@ int daE_YM_c::CreateHeap() { } if (mType == 6) { - field_0x6d0 = new cXyz[45]; + field_0x6d0 = JKR_NEW cXyz[45]; } return 1; diff --git a/src/d/actor/d_a_e_ymb.cpp b/src/d/actor/d_a_e_ymb.cpp index c99fbfa297..2e6dea2e33 100644 --- a/src/d/actor/d_a_e_ymb.cpp +++ b/src/d/actor/d_a_e_ymb.cpp @@ -3114,7 +3114,7 @@ static int daE_YMB_Delete(daE_YMB_c* i_this) { int daE_YMB_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_YB", BMDR_YB_TW); JUT_ASSERT(4196, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_YB", BCK_YB_FLY_WAIT), + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_YB", BCK_YB_FLY_WAIT), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x31000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; @@ -3130,7 +3130,7 @@ int daE_YMB_c::CreateHeap() { model->getModelData()->getJointNodePointer(i)->setCallBack(JointCallBack); } - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -3139,7 +3139,7 @@ int daE_YMB_c::CreateHeap() { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_yr.cpp b/src/d/actor/d_a_e_yr.cpp index 4484918107..4504c5c8cc 100644 --- a/src/d/actor/d_a_e_yr.cpp +++ b/src/d/actor/d_a_e_yr.cpp @@ -2379,7 +2379,7 @@ static int daE_Yr_Delete(e_yr_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { e_yr_class* yr = (e_yr_class*)i_this; - yr->mpMorfSO = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_Yr", 21), NULL, NULL, + yr->mpMorfSO = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_Yr", 21), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_Yr", 12), 2, 1.0f, 0, -1, &yr->mSound, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_e_zh.cpp b/src/d/actor/d_a_e_zh.cpp index ea97676244..9fa95b6abc 100644 --- a/src/d/actor/d_a_e_zh.cpp +++ b/src/d/actor/d_a_e_zh.cpp @@ -2131,13 +2131,13 @@ int daE_ZH_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("E_ZH", BMDV_ZH); JUT_ASSERT(3305, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_ZH", BCK_ZH_WAIT01), + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_ZH", BCK_ZH_WAIT01), 2, 1.0f, 0, -1, &mSound, 0, 0x31000284); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_zm.cpp b/src/d/actor/d_a_e_zm.cpp index 7380087686..4943bf3123 100644 --- a/src/d/actor/d_a_e_zm.cpp +++ b/src/d/actor/d_a_e_zm.cpp @@ -893,7 +893,7 @@ int daE_ZM_c::CreateHeap() { JUT_ASSERT(1558, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_ZM", BCK_ZM_MOUTHOPEN), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_ZM", BCK_ZM_MOUTHOPEN), 2, 1.0f, 0, -1, &mSound, 0, 0x11000084); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_e_zs.cpp b/src/d/actor/d_a_e_zs.cpp index 1a2e827453..840c27697b 100644 --- a/src/d/actor/d_a_e_zs.cpp +++ b/src/d/actor/d_a_e_zs.cpp @@ -487,7 +487,7 @@ static int daE_ZS_Delete(daE_ZS_c* i_this) { int daE_ZS_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes("E_ZS", 0xC); JUT_ASSERT(0x3e9, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_ZS", 4), + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_ZS", 4), 1, 1.0f, 0, -1, &mSound, 0,0x11000084); if (mpMorf == NULL) { return 0; diff --git a/src/d/actor/d_a_formation_mng.cpp b/src/d/actor/d_a_formation_mng.cpp index 70535c25ff..a17db0b37e 100644 --- a/src/d/actor/d_a_formation_mng.cpp +++ b/src/d/actor/d_a_formation_mng.cpp @@ -213,7 +213,7 @@ void daFmtMng_c::executeReverse() { int i; FmtPos_c* currentPos; currentPos = mPos; - tempPos = new FmtPos_c[mFormationRow]; + tempPos = JKR_NEW FmtPos_c[mFormationRow]; for (i = 0; i < mFormationRow; i++, currentPos++, tempPos++) { tempPos->field_0x10.set(currentPos->field_0x10); tempPos->field_0x1c = currentPos->field_0x1c; @@ -226,7 +226,7 @@ void daFmtMng_c::executeReverse() { currentPos->chgDir(); currentPos->setNextPoint(¤tPos->field_0x10); } - delete [] (tempPos + 1); + JKR_DELETE_ARRAY((tempPos + 1)); setAction(MODE_1_e); } } @@ -354,10 +354,10 @@ void daFmtMng_c::create_init() { mFormationLine = getFormationLine(); mFormationRow = getFormationRow(); mPos = NULL; - mPos = new FmtPos_c[mFormationRow]; + mPos = JKR_NEW FmtPos_c[mFormationRow]; JUT_ASSERT(357, mPos != NULL); mMember = NULL; - mMember = new FmtMember_c[mFormationLine * mFormationRow]; + mMember = JKR_NEW FmtMember_c[mFormationLine * mFormationRow]; JUT_ASSERT(361, mMember != NULL); FmtMember_c* member = mMember; diff --git a/src/d/actor/d_a_fr.cpp b/src/d/actor/d_a_fr.cpp index 4daceb2679..f5db025cfd 100644 --- a/src/d/actor/d_a_fr.cpp +++ b/src/d/actor/d_a_fr.cpp @@ -659,7 +659,7 @@ static int daFr_Delete(fr_class* i_this) { static BOOL useHeapIfrt(fopAc_ac_c* a_this) { fr_class* i_this = (fr_class*)a_this; - i_this->mMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Fr", 14), NULL, NULL, + i_this->mMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Fr", 14), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Fr", 11), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); @@ -667,7 +667,7 @@ static BOOL useHeapIfrt(fopAc_ac_c* a_this) { return 0; } - i_this->mBtkAnm = new mDoExt_btkAnm(); + i_this->mBtkAnm = JKR_NEW mDoExt_btkAnm(); if (i_this->mBtkAnm == 0) { return 0; } diff --git a/src/d/actor/d_a_grass.cpp b/src/d/actor/d_a_grass.cpp index 89e84015c9..16e8b78fd9 100644 --- a/src/d/actor/d_a_grass.cpp +++ b/src/d/actor/d_a_grass.cpp @@ -65,7 +65,7 @@ bool daGrass_c::createGrass() { return 1; } - m_grass = new dGrass_packet_c(); + m_grass = JKR_NEW dGrass_packet_c(); if (m_grass == NULL) { return 0; } @@ -75,7 +75,7 @@ bool daGrass_c::createGrass() { void daGrass_c::deleteGrass() { if (m_grass != NULL) { - delete m_grass; + JKR_DELETE(m_grass); m_grass = NULL; } } @@ -105,7 +105,7 @@ bool daGrass_c::createFlower() { return 1; } - m_flower = new dFlower_packet_c(); + m_flower = JKR_NEW dFlower_packet_c(); if (m_flower == NULL) { return 0; } @@ -115,7 +115,7 @@ bool daGrass_c::createFlower() { void daGrass_c::deleteFlower() { if (m_flower != NULL) { - delete m_flower; + JKR_DELETE(m_flower); m_flower = NULL; } } diff --git a/src/d/actor/d_a_horse.cpp b/src/d/actor/d_a_horse.cpp index e873365d7c..296376f7b0 100644 --- a/src/d/actor/d_a_horse.cpp +++ b/src/d/actor/d_a_horse.cpp @@ -496,22 +496,22 @@ int daHorse_c::createHeap() { return 0; } - J3DTransformInfo* transInfoBuf = new J3DTransformInfo[38]; + J3DTransformInfo* transInfoBuf = JKR_NEW J3DTransformInfo[38]; if (transInfoBuf == NULL) { return 0; } - Quaternion* quatBuf = new Quaternion[38]; + Quaternion* quatBuf = JKR_NEW Quaternion[38]; if (quatBuf == NULL) { return 0; } - m_oldFrame = new mDoExt_MtxCalcOldFrame(transInfoBuf, quatBuf); + m_oldFrame = JKR_NEW mDoExt_MtxCalcOldFrame(transInfoBuf, quatBuf); if (m_oldFrame == NULL) { return 0; } - m_mtxcalc = new mDoExt_MtxCalcAnmBlendTblOld(m_oldFrame, 3, m_anmRatio); + m_mtxcalc = JKR_NEW mDoExt_MtxCalcAnmBlendTblOld(m_oldFrame, 3, m_anmRatio); if (m_mtxcalc == NULL) { return 0; } @@ -520,7 +520,7 @@ int daHorse_c::createHeap() { return 0; } - m_hio = new HORSE_HIO_CLASS(); + m_hio = JKR_NEW HORSE_HIO_CLASS(); if (m_hio == NULL) { return 0; } @@ -538,12 +538,12 @@ int daHorse_c::createHeap() { daHorseRein_c* rein_p = m_rein; for (int i = 0; i < 3; i++, rein_p++) { - rein_p->field_0x0[0] = new cXyz[rein_p->field_0x8[1]]; + rein_p->field_0x0[0] = JKR_NEW cXyz[rein_p->field_0x8[1]]; if (rein_p->field_0x0[0] == NULL) { return 0; } - rein_p->field_0x0[1] = new cXyz[rein_p->field_0x8[1]]; + rein_p->field_0x0[1] = JKR_NEW cXyz[rein_p->field_0x8[1]]; if (rein_p->field_0x0[1] == NULL) { return 0; } @@ -1295,7 +1295,7 @@ void daHorse_c::setDemoData() { } if (m_demoStaffId != -1) { - char* cutname = dComIfGp_getPEvtManager()->getMyNowCutName(m_demoStaffId); + char* cutname = dComIfGp_getPEvtManager()->getMyNowCutNameStr(m_demoStaffId); if (cutname != NULL) { mode = ((cutname[0] - '0') * 100) + ((cutname[1] - '0') * 10) + (cutname[2] - '0'); diff --git a/src/d/actor/d_a_hozelda.cpp b/src/d/actor/d_a_hozelda.cpp index fea51232d9..701564ca2e 100644 --- a/src/d/actor/d_a_hozelda.cpp +++ b/src/d/actor/d_a_hozelda.cpp @@ -82,28 +82,28 @@ BOOL daHoZelda_c::createHeap() { } for (int i = 0; i < 2; i++) { - mpMatAnm[i] = new daHoZelda_matAnm_c(); + mpMatAnm[i] = JKR_NEW daHoZelda_matAnm_c(); if (mpMatAnm[i] == NULL) { return FALSE; } } - J3DTransformInfo* transinfo_buf = new J3DTransformInfo[47]; + J3DTransformInfo* transinfo_buf = JKR_NEW J3DTransformInfo[47]; if (transinfo_buf == NULL) { return FALSE; } - Quaternion* quat_buf = new Quaternion[47]; + Quaternion* quat_buf = JKR_NEW Quaternion[47]; if (quat_buf == NULL) { return FALSE; } - field_0x5c4 = new mDoExt_MtxCalcOldFrame(transinfo_buf, quat_buf); + field_0x5c4 = JKR_NEW mDoExt_MtxCalcOldFrame(transinfo_buf, quat_buf); if (field_0x5c4 == NULL) { return FALSE; } - field_0x5a8 = new mDoExt_MtxCalcAnmBlendTblOld(field_0x5c4, 3, mAnmRatioPack); + field_0x5a8 = JKR_NEW mDoExt_MtxCalcAnmBlendTblOld(field_0x5c4, 3, mAnmRatioPack); if (field_0x5a8 == NULL) { return FALSE; } @@ -125,7 +125,7 @@ BOOL daHoZelda_c::createHeap() { return FALSE; } - mpHIO = new HOZELDA_HIO_CLASS(); + mpHIO = JKR_NEW HOZELDA_HIO_CLASS(); if (mpHIO == NULL) { return FALSE; } diff --git a/src/d/actor/d_a_itembase.cpp b/src/d/actor/d_a_itembase.cpp index 7c5f2b3278..084fb5221f 100644 --- a/src/d/actor/d_a_itembase.cpp +++ b/src/d/actor/d_a_itembase.cpp @@ -60,7 +60,7 @@ int daItemBase_c::CreateItemHeap(char const* i_arcName, s16 i_bmdName, s16 i_btk (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(i_arcName, i_btkName); JUT_ASSERT(0, pbtk != NULL); - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL || !mpBtkAnm->init(modelData, pbtk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { return 0; } @@ -71,7 +71,7 @@ int daItemBase_c::CreateItemHeap(char const* i_arcName, s16 i_bmdName, s16 i_btk J3DAnmColor* pbpk = (J3DAnmColor*)dComIfG_getObjectRes(i_arcName, i_bpkName); JUT_ASSERT(0, pbpk != NULL); - mpBpkAnm = new mDoExt_bpkAnm(); + mpBpkAnm = JKR_NEW mDoExt_bpkAnm(); if (mpBpkAnm == NULL || !mpBpkAnm->init(modelData, pbpk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { return 0; } @@ -82,7 +82,7 @@ int daItemBase_c::CreateItemHeap(char const* i_arcName, s16 i_bmdName, s16 i_btk J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(i_arcName, i_bckName); JUT_ASSERT(0, pbck != NULL); - mpBckAnm = new mDoExt_bckAnm(); + mpBckAnm = JKR_NEW mDoExt_bckAnm(); if (mpBckAnm == NULL || !mpBckAnm->init(pbck, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false)) { return 0; } @@ -99,7 +99,7 @@ int daItemBase_c::CreateItemHeap(char const* i_arcName, s16 i_bmdName, s16 i_btk anmPlay = FALSE; } - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || !mpBrkAnm->init(modelData, pbrk, anmPlay, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { return 0; } @@ -110,7 +110,7 @@ int daItemBase_c::CreateItemHeap(char const* i_arcName, s16 i_bmdName, s16 i_btk J3DAnmTexPattern* pbtp = (J3DAnmTexPattern*)dComIfG_getObjectRes(i_arcName, i_btpName); JUT_ASSERT(0, pbtp != NULL); - mpBtpAnm = new mDoExt_btpAnm(); + mpBtpAnm = JKR_NEW mDoExt_btpAnm(); if (mpBtpAnm == NULL || !mpBtpAnm->init(modelData, pbtp, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_kago.cpp b/src/d/actor/d_a_kago.cpp index 8f2ffa2140..e478a650f3 100644 --- a/src/d/actor/d_a_kago.cpp +++ b/src/d/actor/d_a_kago.cpp @@ -3744,7 +3744,7 @@ int daKago_c::CreateHeap() { } JUT_ASSERT(5023, modelData != NULL); - mAnm_p = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(mArcName, getBckName(dRes_ID_E_YC_BCK_YC_FLY_e)), 2, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mAnm_p == NULL || mAnm_p->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_mant.cpp b/src/d/actor/d_a_mant.cpp index 5d8f0027e0..9afc797b77 100644 --- a/src/d/actor/d_a_mant.cpp +++ b/src/d/actor/d_a_mant.cpp @@ -754,8 +754,8 @@ static int daMant_Execute(mant_class* i_this) { return 1; } -static bool daMant_IsDelete(mant_class* i_this) { - return true; +static BOOL daMant_IsDelete(mant_class* i_this) { + return TRUE; } static int daMant_Delete(mant_class* i_this) { diff --git a/src/d/actor/d_a_mg_fish.cpp b/src/d/actor/d_a_mg_fish.cpp index 6c15c9b0d8..d1e2fb2ae3 100644 --- a/src/d/actor/d_a_mg_fish.cpp +++ b/src/d/actor/d_a_mg_fish.cpp @@ -3660,7 +3660,7 @@ static int useHeapInit2(fopAc_ac_c* i_actor) { if (i_this->mpModel[0] == NULL) { return 0; } - i_this->mpBtpAnm = new mDoExt_btpAnm(); + i_this->mpBtpAnm = JKR_NEW mDoExt_btpAnm(); if (i_this->mpBtpAnm == 0) { return 0; } @@ -3724,7 +3724,7 @@ static int useHeapImg_fisht(fopAc_ac_c* i_actor) { } else { i_this->mAnmTransform = 0; } - i_this->mpMorf = new mDoExt_McaMorf( + i_this->mpMorf = JKR_NEW mDoExt_McaMorf( (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, fish_bmd[i_this->mGedouKind]), NULL, NULL, i_this->mAnmTransform, 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); @@ -3743,7 +3743,7 @@ static int useHeapImg_fisht(fopAc_ac_c* i_actor) { } if (i_this->mKind2 == 4) { - i_this->mpBrkAnm = new mDoExt_brkAnm(); + i_this->mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (i_this->mpBrkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_mg_fshop.cpp b/src/d/actor/d_a_mg_fshop.cpp index 02801d4b98..30d0d6562e 100644 --- a/src/d/actor/d_a_mg_fshop.cpp +++ b/src/d/actor/d_a_mg_fshop.cpp @@ -1172,7 +1172,7 @@ static int koro2_heapinit(fopAc_ac_c* actor) { fshop_class* i_this = (fshop_class*)actor; - i_this->koro2WakuBgw = new dBgW(); + i_this->koro2WakuBgw = JKR_NEW dBgW(); if (i_this->koro2WakuBgw == NULL) { return 0; } @@ -1294,7 +1294,7 @@ static int koro2_heapinit(fopAc_ac_c* actor) { return 0; } - i_this->mKoro2[part_no].bgw = new dBgW(); + i_this->mKoro2[part_no].bgw = JKR_NEW dBgW(); if (i_this->mKoro2[part_no].bgw == NULL) { return 0; } @@ -1483,7 +1483,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - i_this->tableBgw = new dBgW(); + i_this->tableBgw = JKR_NEW dBgW(); if (i_this->tableBgw == NULL) { return 0; } diff --git a/src/d/actor/d_a_mg_rod.cpp b/src/d/actor/d_a_mg_rod.cpp index 1741ec677a..827afa9fbd 100644 --- a/src/d/actor/d_a_mg_rod.cpp +++ b/src/d/actor/d_a_mg_rod.cpp @@ -6152,7 +6152,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } } - a_this->rod_modelMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes(a_this->arcname, 4), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, 0, 0x80000, 0x11000084); + a_this->rod_modelMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes(a_this->arcname, 4), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, 0, 0x80000, 0x11000084); if (a_this->rod_modelMorf == NULL || a_this->rod_modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_midna.cpp b/src/d/actor/d_a_midna.cpp index a3b7bfcaa1..85f15051b8 100644 --- a/src/d/actor/d_a_midna.cpp +++ b/src/d/actor/d_a_midna.cpp @@ -374,7 +374,7 @@ int daMidna_c::createHeap() { } for (int i = 0; i < 2; i++) { - mpEyeMatAnm[i] = new daMidna_matAnm_c(); + mpEyeMatAnm[i] = JKR_NEW daMidna_matAnm_c(); if (mpEyeMatAnm[i] == NULL) { return 0; } @@ -463,7 +463,7 @@ int daMidna_c::createHeap() { J3DAnmTransform* md_anm = (J3DAnmTransform*)J3DAnmLoaderDataBase::load(mBckHeap[0].getBuffer()); modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 14); JUT_ASSERT(852, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, &mMorfCB, NULL, md_anm, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, NULL, 0, 0x11000284); + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, &mMorfCB, NULL, md_anm, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, NULL, 0, 0x11000284); if (mpMorf == NULL || mpMorf->getModel() == NULL) { return 0; } @@ -508,13 +508,13 @@ int daMidna_c::createHeap() { return 0; } - mpHIO = new NPC_MIDNA_HIO_CLASS(); + mpHIO = JKR_NEW NPC_MIDNA_HIO_CLASS(); if (mpHIO == NULL) { return 0; } if (mpDemoFCBlendBmd != NULL) { - mpDemoFCTmpBlk = new mDoExt_blkAnm(); + mpDemoFCTmpBlk = JKR_NEW mDoExt_blkAnm(); if (mpDemoFCTmpBlk == NULL) { return 0; } @@ -2836,7 +2836,7 @@ void daMidna_c::setDemoData() { mDemoType = 2; } - char* cut_name = dComIfGp_getPEvtManager()->getMyNowCutName(mStaffID); + char* cut_name = dComIfGp_getPEvtManager()->getMyNowCutNameStr(mStaffID); if (cut_name != NULL) { mDemoMode = (cut_name[0] - 0x30) * 10 + (cut_name[1] - 0x30); diff --git a/src/d/actor/d_a_myna.cpp b/src/d/actor/d_a_myna.cpp index 73eaf967c6..b7412cc52c 100644 --- a/src/d/actor/d_a_myna.cpp +++ b/src/d/actor/d_a_myna.cpp @@ -443,7 +443,7 @@ int daMyna_c::createHeap() { J3DModelData* aMdlData_p = NULL; aMdlData_p = static_cast(dComIfG_getObjectRes("Npc_myna", "MYNA.bmd")); JUT_ASSERT(803, NULL != aMdlData_p); - mpMorf = new mDoExt_McaMorfSO(aMdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, + mpMorf = JKR_NEW mDoExt_McaMorfSO(aMdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, 0x11020084); if (mpMorf != NULL && mpMorf->getModel() == NULL) { mpMorf->stopZelAnime(); diff --git a/src/d/actor/d_a_nbomb.cpp b/src/d/actor/d_a_nbomb.cpp index 10c0fe849a..fea345e07e 100644 --- a/src/d/actor/d_a_nbomb.cpp +++ b/src/d/actor/d_a_nbomb.cpp @@ -146,7 +146,7 @@ int daNbomb_c::createHeap() { } if (trans != NULL) { - mpBck = new mDoExt_bckAnm(); + mpBck = JKR_NEW mDoExt_bckAnm(); if (mpBck == NULL) { return 0; } diff --git a/src/d/actor/d_a_ni.cpp b/src/d/actor/d_a_ni.cpp index 720f86b6c9..6f83d51715 100644 --- a/src/d/actor/d_a_ni.cpp +++ b/src/d/actor/d_a_ni.cpp @@ -1852,7 +1852,7 @@ static int daNi_Delete(ni_class* i_this) { static BOOL useHeapInit(fopAc_ac_c* i_this) { ni_class* a_this = (ni_class*)i_this; - a_this->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Ni", 16), NULL, NULL, + a_this->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Ni", 16), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Ni", 11), 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); @@ -1868,7 +1868,7 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) { model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - a_this->mpBtk = new mDoExt_btkAnm(); + a_this->mpBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpBtk == NULL) { return false; } diff --git a/src/d/actor/d_a_npc2.cpp b/src/d/actor/d_a_npc2.cpp index 2558f4c092..9d5d0beee8 100644 --- a/src/d/actor/d_a_npc2.cpp +++ b/src/d/actor/d_a_npc2.cpp @@ -717,7 +717,7 @@ int daBaseNpc_moveBgActor_c::MoveBGCreateHeap() { return 1; } - mpBgw = new dBgW(); + mpBgw = JKR_NEW dBgW(); if (mpBgw != NULL && !mpBgw->Set((cBgD_t*)dComIfG_getObjectRes(m_name, m_dzb_id), 1, &mBgMtx)) { if (m_set_func != NULL) { diff --git a/src/d/actor/d_a_npc_aru.cpp b/src/d/actor/d_a_npc_aru.cpp index 2ad201cb0d..37371629ed 100644 --- a/src/d/actor/d_a_npc_aru.cpp +++ b/src/d/actor/d_a_npc_aru.cpp @@ -465,7 +465,7 @@ int daNpc_Aru_c::CreateHeap() { } u32 sp_0x18 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x18); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -477,7 +477,7 @@ int daNpc_Aru_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_ash.cpp b/src/d/actor/d_a_npc_ash.cpp index 55ca5f3941..bc985489e9 100644 --- a/src/d/actor/d_a_npc_ash.cpp +++ b/src/d/actor/d_a_npc_ash.cpp @@ -307,7 +307,7 @@ cPhs_Step daNpcAsh_c::Create() { BOOL daNpcAsh_c::CreateHeap() { J3DModelData* modelData = static_cast(dComIfG_getObjectRes(l_arcNames[0], 11)); - mAnm_p = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->mpModel == NULL) { mAnm_p->stopZelAnime(); @@ -323,7 +323,7 @@ BOOL daNpcAsh_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return false; } diff --git a/src/d/actor/d_a_npc_ashB.cpp b/src/d/actor/d_a_npc_ashB.cpp index 5dcb0b719d..691da6e755 100644 --- a/src/d/actor/d_a_npc_ashB.cpp +++ b/src/d/actor/d_a_npc_ashB.cpp @@ -184,7 +184,7 @@ BOOL daNpcAshB_c::CreateHeap() { mdlData_p = static_cast(dComIfG_getObjectRes(l_arcNames[0], 28)); JUT_ASSERT(332, NULL != mdlData_p); u32 sp_0x18 = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, 0x80000, sp_0x18); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -200,7 +200,7 @@ BOOL daNpcAshB_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return false; } else { @@ -1083,8 +1083,8 @@ static int daNpcAshB_Draw(void* i_this) { return static_cast(i_this)->Draw(); } -static bool daNpcAshB_IsDelete(void* param_0) { - return true; +static BOOL daNpcAshB_IsDelete(void* param_0) { + return TRUE; } void daNpcAshB_c::setParam() { diff --git a/src/d/actor/d_a_npc_bans.cpp b/src/d/actor/d_a_npc_bans.cpp index 98fec99130..756de1db84 100644 --- a/src/d/actor/d_a_npc_bans.cpp +++ b/src/d/actor/d_a_npc_bans.cpp @@ -451,7 +451,7 @@ int daNpc_Bans_c::CreateHeap() { } u32 uVar2 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, (int)idx == 1 ? J3DMdlFlag_DifferedDLBuffer : J3DMdlFlag_None, uVar2); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, (int)idx == 1 ? J3DMdlFlag_DifferedDLBuffer : J3DMdlFlag_None, uVar2); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -462,7 +462,7 @@ int daNpc_Bans_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } @@ -477,7 +477,7 @@ int daNpc_Bans_c::CreateHeap() { } uVar2 = 0x11000084; - mpScoopMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, J3DMdlFlag_DifferedDLBuffer, uVar2); + mpScoopMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, J3DMdlFlag_DifferedDLBuffer, uVar2); if (mpScoopMorf == NULL || mpScoopMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_besu.cpp b/src/d/actor/d_a_npc_besu.cpp index 6a586c0eae..0f86035d4d 100644 --- a/src/d/actor/d_a_npc_besu.cpp +++ b/src/d/actor/d_a_npc_besu.cpp @@ -727,7 +727,7 @@ int daNpc_Besu_c::CreateHeap() { } u32 dbg_0x24 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, dbg_0x24); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -738,7 +738,7 @@ int daNpc_Besu_c::CreateHeap() { modelData->getJointNodePointer(i)->setCallBack(ctrlJointCallBack); } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } @@ -755,7 +755,7 @@ int daNpc_Besu_c::CreateHeap() { } dbg_0x24 = 0x11000084; - mpCupModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, + mpCupModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, 0x80000, dbg_0x24); if (mpCupModelMorf == NULL || mpCupModelMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_blue_ns.cpp b/src/d/actor/d_a_npc_blue_ns.cpp index 220c64af3f..7f2de16d50 100644 --- a/src/d/actor/d_a_npc_blue_ns.cpp +++ b/src/d/actor/d_a_npc_blue_ns.cpp @@ -199,7 +199,7 @@ int daNpcBlueNS_c::CreateHeap() { J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_arcNames[0], 0x10); JUT_ASSERT(406, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_bou.cpp b/src/d/actor/d_a_npc_bou.cpp index 5f168ef904..ffe2b8bc60 100644 --- a/src/d/actor/d_a_npc_bou.cpp +++ b/src/d/actor/d_a_npc_bou.cpp @@ -254,7 +254,7 @@ int daNpc_Bou_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -266,7 +266,7 @@ int daNpc_Bou_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_bouS.cpp b/src/d/actor/d_a_npc_bouS.cpp index 6d807edacd..e2111e87a6 100644 --- a/src/d/actor/d_a_npc_bouS.cpp +++ b/src/d/actor/d_a_npc_bouS.cpp @@ -387,7 +387,7 @@ int daNpcBouS_c::CreateHeap() { JUT_ASSERT(393, NULL != mdlData_p); u32 i_differedDlistFlag = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, i_differedDlistFlag); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, i_differedDlistFlag); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -403,7 +403,7 @@ int daNpcBouS_c::CreateHeap() { } mdl_p->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_cd.cpp b/src/d/actor/d_a_npc_cd.cpp index 1c9cc3c89d..3b008b73e7 100644 --- a/src/d/actor/d_a_npc_cd.cpp +++ b/src/d/actor/d_a_npc_cd.cpp @@ -181,7 +181,7 @@ int daNpcCd_c::NpcCreate(int param_1) { JUT_ASSERT(470, NULL != a_mdlData_p); - mpMorf = new mDoExt_McaMorfSO(a_mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, + mpMorf = JKR_NEW mDoExt_McaMorfSO(a_mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, 0x11000084); if (mpMorf != NULL && mpMorf->getModel() == NULL) { mpMorf->stopZelAnime(); diff --git a/src/d/actor/d_a_npc_cd2.cpp b/src/d/actor/d_a_npc_cd2.cpp index c3bfee4aff..c54f72fab4 100644 --- a/src/d/actor/d_a_npc_cd2.cpp +++ b/src/d/actor/d_a_npc_cd2.cpp @@ -252,7 +252,7 @@ int daNpcCd2_c::NpcCreate(int param_1) { } else { uVar5 = 0x11000084; } - mpMorf = new mDoExt_McaMorfSO(a_mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCitizen, + mpMorf = JKR_NEW mDoExt_McaMorfSO(a_mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCitizen, 0x80000, uVar5); if (mpMorf != NULL && mpMorf->getModel() == NULL) { mpMorf->stopZelAnime(); @@ -264,7 +264,7 @@ int daNpcCd2_c::NpcCreate(int param_1) { mCitizen.init(¤t.pos, &eyePos, 3, 1); mCitizen.setMdlType(param_1, false, mIsDarkWorld != 0 ? 1 : 0); if (anmTex != NULL) { - mpBtpAnm = new mDoExt_btpAnm(); + mpBtpAnm = JKR_NEW mDoExt_btpAnm(); JUT_ASSERT(622, NULL != mpBtpAnm); if (mpBtpAnm == NULL || !mpBtpAnm->init(a_mdlData_p, anmTex, 1, 2, 1.0f, 0, -1)) { return 0; diff --git a/src/d/actor/d_a_npc_chat.cpp b/src/d/actor/d_a_npc_chat.cpp index 80beb543f1..5722ef257c 100644 --- a/src/d/actor/d_a_npc_chat.cpp +++ b/src/d/actor/d_a_npc_chat.cpp @@ -2288,7 +2288,7 @@ BOOL daNpcChat_c::NpcCreate(int type) { J3DAnmTexPattern* texAnmP = getTexAnmP(type); u32 uVar1 = texAnmP != NULL ? 0x11020084 : 0x11000084; - mAnm_p = new mDoExt_McaMorfSO(a_mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(a_mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_chin.cpp b/src/d/actor/d_a_npc_chin.cpp index 6fc9002f1a..86ca857125 100644 --- a/src/d/actor/d_a_npc_chin.cpp +++ b/src/d/actor/d_a_npc_chin.cpp @@ -334,7 +334,7 @@ int daNpcChin_c::CreateHeap() { JUT_ASSERT(625, NULL != mdlData_p); u32 differedDlistFlag = 0x15020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, differedDlistFlag); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -351,7 +351,7 @@ int daNpcChin_c::CreateHeap() { model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_clerka.cpp b/src/d/actor/d_a_npc_clerka.cpp index b9209cccd7..23393a301b 100644 --- a/src/d/actor/d_a_npc_clerka.cpp +++ b/src/d/actor/d_a_npc_clerka.cpp @@ -181,7 +181,7 @@ int daNpc_clerkA_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[res_idx], bmd_idx); mpMorf[0] = - new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); + JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -196,7 +196,7 @@ int daNpc_clerkA_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_clerkb.cpp b/src/d/actor/d_a_npc_clerkb.cpp index 0b2d1acf94..1a3f1bfade 100644 --- a/src/d/actor/d_a_npc_clerkb.cpp +++ b/src/d/actor/d_a_npc_clerkb.cpp @@ -187,7 +187,7 @@ int daNpc_clerkB_c::CreateHeap() { static_cast(dComIfG_getObjectRes(l_resNameList[res_idx], bmd_idx)); mpMorf[0] = - new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020285); + JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020285); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -202,7 +202,7 @@ int daNpc_clerkB_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_clerkt.cpp b/src/d/actor/d_a_npc_clerkt.cpp index a7c799cc5b..8d6f6f7bcf 100644 --- a/src/d/actor/d_a_npc_clerkt.cpp +++ b/src/d/actor/d_a_npc_clerkt.cpp @@ -174,7 +174,7 @@ int daNpcClerkT_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[res_idx], bmd_idx); mpMorf[0] = - new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); + JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -189,7 +189,7 @@ int daNpcClerkT_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_coach.cpp b/src/d/actor/d_a_npc_coach.cpp index 1ae9adda9f..89d1e72112 100644 --- a/src/d/actor/d_a_npc_coach.cpp +++ b/src/d/actor/d_a_npc_coach.cpp @@ -706,7 +706,7 @@ int daNpcCoach_c::createHeap() { JUT_ASSERT(2702, modelData != NULL); - mChHorse.mpModelMorf = new mDoExt_McaMorf2(modelData, NULL, NULL, + mChHorse.mpModelMorf = JKR_NEW mDoExt_McaMorf2(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, BCK_HU_WAIT_01), NULL, 2, 1.0f, 0, -1, &mChHorse.mSound, 0x80000, 0x11020084); if (mChHorse.mpModelMorf != NULL && mChHorse.mpModelMorf->getModel() == NULL) { @@ -724,14 +724,14 @@ int daNpcCoach_c::createHeap() { } mChHorse.mpModelMorf->getModel()->setUserArea((uintptr_t)this); - mChHorse.mpBtpAnm = new mDoExt_btpAnm(); + mChHorse.mpBtpAnm = JKR_NEW mDoExt_btpAnm(); J3DAnmTexPattern* i_btk = (J3DAnmTexPattern*)dComIfG_getObjectRes(l_arcName, BTP_HU_EYE); if (mChHorse.mpBtpAnm == NULL || mChHorse.mpBtpAnm->init(modelData, i_btk, 1, 0, 1.0f, 0, -1) == 0) { return 0; } - mChHorse.mpBckAnm = new mDoExt_bckAnm(); + mChHorse.mpBckAnm = JKR_NEW mDoExt_bckAnm(); J3DAnmTransform* i_bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, BCK_HU_LASH); if (mChHorse.mpBckAnm == NULL || mChHorse.mpBckAnm->init(i_bck, 1, 0, 1.0f, 0, -1, false) == 0) { return 0; @@ -765,7 +765,7 @@ int daNpcCoach_c::createHeap() { } mChHarness.mHarnessModel->setUserArea((uintptr_t)this); - mChHarness.field_0x6a0 = new dBgW(); + mChHarness.field_0x6a0 = JKR_NEW dBgW(); if (mChHarness.field_0x6a0 == NULL) { return 0; } @@ -795,7 +795,7 @@ int daNpcCoach_c::createHeap() { } mChCoach.mCoachModel->setUserArea((uintptr_t)this); - mChCoach.field_0x564 = new dBgW(); + mChCoach.field_0x564 = JKR_NEW dBgW(); if (mChCoach.field_0x564 == NULL) { return 0; } @@ -810,7 +810,7 @@ int daNpcCoach_c::createHeap() { JUT_ASSERT(2816, modelData != NULL); - mChYelia.mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, BCK_YELIA_WAIT), + mChYelia.mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, BCK_YELIA_WAIT), -1, 1.0f, 0, -1, &mChYelia.mSound, 0x80000, 0x11000084); if (mChYelia.mpModelMorf != NULL && mChYelia.mpModelMorf->getModel() == NULL) { mChYelia.mpModelMorf->stopZelAnime(); diff --git a/src/d/actor/d_a_npc_doc.cpp b/src/d/actor/d_a_npc_doc.cpp index bffee6496b..43ec3422d9 100644 --- a/src/d/actor/d_a_npc_doc.cpp +++ b/src/d/actor/d_a_npc_doc.cpp @@ -235,7 +235,7 @@ int daNpc_Doc_c::CreateHeap() { } u32 sp1C = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, sp1C); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, sp1C); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -246,7 +246,7 @@ int daNpc_Doc_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_doorboy.cpp b/src/d/actor/d_a_npc_doorboy.cpp index edd785c781..af2cafb2dd 100644 --- a/src/d/actor/d_a_npc_doorboy.cpp +++ b/src/d/actor/d_a_npc_doorboy.cpp @@ -243,7 +243,7 @@ int daNpcDoorBoy_c::CreateHeap() { JUT_ASSERT(292, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_drainSol.cpp b/src/d/actor/d_a_npc_drainSol.cpp index 0b4e8250f3..5002050a83 100644 --- a/src/d/actor/d_a_npc_drainSol.cpp +++ b/src/d/actor/d_a_npc_drainSol.cpp @@ -142,7 +142,7 @@ int daNpcDrSol_c::CreateHeap() { J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_arcNames[mType], l_bmdGetParamList[mType]); JUT_ASSERT(268, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_du.cpp b/src/d/actor/d_a_npc_du.cpp index 9443a720ed..01358eb4e1 100644 --- a/src/d/actor/d_a_npc_du.cpp +++ b/src/d/actor/d_a_npc_du.cpp @@ -603,7 +603,7 @@ static int daNpc_Du_Delete(npc_du_class* i_this) { static int useHeapInit(fopAc_ac_c* actor) { npc_du_class* i_this = (npc_du_class*)actor; - i_this->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Npc_Du", 0xA), NULL, NULL, + i_this->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Npc_Du", 0xA), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Npc_Du", 6), 0, 1.0f, 0, -1, 1, NULL, J3DMdlFlag_DifferedDLBuffer, 0x11020084); if (i_this->mpMorf == NULL || i_this->mpMorf->getModel() == NULL) { @@ -616,7 +616,7 @@ static int useHeapInit(fopAc_ac_c* actor) { model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - i_this->mpBtpAnm = new mDoExt_btpAnm(); + i_this->mpBtpAnm = JKR_NEW mDoExt_btpAnm(); if (i_this->mpBtpAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_fairy.cpp b/src/d/actor/d_a_npc_fairy.cpp index f579985d22..397891c28e 100644 --- a/src/d/actor/d_a_npc_fairy.cpp +++ b/src/d/actor/d_a_npc_fairy.cpp @@ -323,7 +323,7 @@ BOOL _Fairy_Feather_c::loadModel() { JUT_ASSERT(674, NULL != mdlData_p); u32 uVar1 = 0x11000284; - mpMorf = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_None, uVar1); + mpMorf = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_None, uVar1); if (mpMorf != NULL && mpMorf->getModel() == NULL) { mpMorf->stopZelAnime(); mpMorf = NULL; @@ -587,7 +587,7 @@ int daNpc_Fairy_c::CreateHeap() { JUT_ASSERT(1113, NULL != mdlData_p); u32 uVar1 = 0x11020285; - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_None, uVar1); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_None, uVar1); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -608,7 +608,7 @@ int daNpc_Fairy_c::CreateHeap() { mdl_p->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_gnd.cpp b/src/d/actor/d_a_npc_gnd.cpp index 9fc5c2cddd..689bfc870a 100644 --- a/src/d/actor/d_a_npc_gnd.cpp +++ b/src/d/actor/d_a_npc_gnd.cpp @@ -180,7 +180,7 @@ int daNpc_Gnd_c::CreateHeap() { JUT_ASSERT(433, NULL != mdlData_p); u32 sp_0x24 = 0x11020285; - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x24); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x24); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -197,7 +197,7 @@ int daNpc_Gnd_c::CreateHeap() { model->setUserArea((uintptr_t)this); for (int idx = 0; idx < 2; ++idx) { - mpMatAnm[idx] = new daNpcT_MatAnm_c(); + mpMatAnm[idx] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[idx] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_gra.cpp b/src/d/actor/d_a_npc_gra.cpp index 4d0dbddbd5..701bd7e358 100644 --- a/src/d/actor/d_a_npc_gra.cpp +++ b/src/d/actor/d_a_npc_gra.cpp @@ -420,7 +420,7 @@ BOOL daNpc_grA_c::CreateHeap() { } JUT_ASSERT(774, NULL != mdlData_p); int v = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, v); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, v); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_grc.cpp b/src/d/actor/d_a_npc_grc.cpp index c19b264a19..fab87179cc 100644 --- a/src/d/actor/d_a_npc_grc.cpp +++ b/src/d/actor/d_a_npc_grc.cpp @@ -384,7 +384,7 @@ int daNpc_grC_c::CreateHeap() { JUT_ASSERT(452, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_grd.cpp b/src/d/actor/d_a_npc_grd.cpp index 351e05b443..c8176cf824 100644 --- a/src/d/actor/d_a_npc_grd.cpp +++ b/src/d/actor/d_a_npc_grd.cpp @@ -233,7 +233,7 @@ int daNpc_Grd_c::CreateHeap() { l_bmdGetParamList[0].fileIdx); } - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -250,7 +250,7 @@ int daNpc_Grd_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return false; } diff --git a/src/d/actor/d_a_npc_grm.cpp b/src/d/actor/d_a_npc_grm.cpp index c530f869f9..64e8a16c4d 100644 --- a/src/d/actor/d_a_npc_grm.cpp +++ b/src/d/actor/d_a_npc_grm.cpp @@ -234,7 +234,7 @@ int daNpc_grM_c::CreateHeap() { JUT_ASSERT(701, NULL != mdlData_p); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); diff --git a/src/d/actor/d_a_npc_grmc.cpp b/src/d/actor/d_a_npc_grmc.cpp index 0f61ac33d0..7c1f75603c 100644 --- a/src/d/actor/d_a_npc_grmc.cpp +++ b/src/d/actor/d_a_npc_grmc.cpp @@ -294,7 +294,7 @@ int daNpc_grMC_c::CreateHeap() { JUT_ASSERT(701, NULL != mdlData_p); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; diff --git a/src/d/actor/d_a_npc_gro.cpp b/src/d/actor/d_a_npc_gro.cpp index 3f50f09742..8db8f7349f 100644 --- a/src/d/actor/d_a_npc_gro.cpp +++ b/src/d/actor/d_a_npc_gro.cpp @@ -472,7 +472,7 @@ int daNpc_grO_c::CreateHeap() { JUT_ASSERT(480, NULL != mdlData_p); u32 uVar1 = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, uVar1); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, uVar1); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -488,7 +488,7 @@ int daNpc_grO_c::CreateHeap() { } mdl_p->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_grr.cpp b/src/d/actor/d_a_npc_grr.cpp index 5af37cf19a..854aee437c 100644 --- a/src/d/actor/d_a_npc_grr.cpp +++ b/src/d/actor/d_a_npc_grr.cpp @@ -337,7 +337,7 @@ int daNpc_grR_c::CreateHeap() { JUT_ASSERT(458, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -353,7 +353,7 @@ int daNpc_grR_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_grs.cpp b/src/d/actor/d_a_npc_grs.cpp index ba99deac5d..8182b9ca6c 100644 --- a/src/d/actor/d_a_npc_grs.cpp +++ b/src/d/actor/d_a_npc_grs.cpp @@ -220,7 +220,7 @@ int daNpc_grS_c::CreateHeap() { } JUT_ASSERT(420, NULL != mdlData_p); u32 differedDlistFlag = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, differedDlistFlag); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { @@ -237,7 +237,7 @@ int daNpc_grS_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_grz.cpp b/src/d/actor/d_a_npc_grz.cpp index 7aade0ff2e..ee27fcbfed 100644 --- a/src/d/actor/d_a_npc_grz.cpp +++ b/src/d/actor/d_a_npc_grz.cpp @@ -526,7 +526,7 @@ int daNpc_Grz_c::CreateHeap() { JUT_ASSERT(556, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -542,7 +542,7 @@ int daNpc_Grz_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_gwolf.cpp b/src/d/actor/d_a_npc_gwolf.cpp index 33eddd3c07..f7a074c0dd 100644 --- a/src/d/actor/d_a_npc_gwolf.cpp +++ b/src/d/actor/d_a_npc_gwolf.cpp @@ -364,7 +364,7 @@ int daNpc_GWolf_c::CreateHeap() { JUT_ASSERT(538, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -380,7 +380,7 @@ int daNpc_GWolf_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_hanjo.cpp b/src/d/actor/d_a_npc_hanjo.cpp index e9dac046ab..52002f98e4 100644 --- a/src/d/actor/d_a_npc_hanjo.cpp +++ b/src/d/actor/d_a_npc_hanjo.cpp @@ -256,7 +256,7 @@ int daNpc_Hanjo_c::CreateHeap() { if (modelData == NULL) { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -266,7 +266,7 @@ int daNpc_Hanjo_c::CreateHeap() { modelData->getJointNodePointer(i)->setCallBack(ctrlJointCallBack); } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_henna.cpp b/src/d/actor/d_a_npc_henna.cpp index 4a6b1fdbc6..4a352c49bf 100644 --- a/src/d/actor/d_a_npc_henna.cpp +++ b/src/d/actor/d_a_npc_henna.cpp @@ -213,7 +213,7 @@ static f32 dummy_m300() { } static void dummy_dt_cm3dgpla() { - delete (cM3dGPla*)NULL; + JKR_DELETE((cM3dGPla*)NULL); } static void* s_npc_sub(void* param_0, void* param_1) { @@ -2625,7 +2625,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { resId = 38; } - a_this->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Henna", resId), NULL, + a_this->mpMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Henna", resId), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11020284); if (a_this->mpMorf == NULL || a_this->mpMorf->getModel() == NULL) { return 0; @@ -2639,7 +2639,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } for (s32 i = 0; i < 3; i++) { - a_this->mpBtkAnms[i] = new mDoExt_btkAnm(); + a_this->mpBtkAnms[i] = JKR_NEW mDoExt_btkAnm(); if (a_this->mpBtkAnms[i] == NULL) { return 0; } @@ -2652,7 +2652,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } for (s32 i = 0; i < 8; i++) { - a_this->mpBtpAnms[i] = new mDoExt_btpAnm(); + a_this->mpBtpAnms[i] = JKR_NEW mDoExt_btpAnm(); if (a_this->mpBtpAnms[i] == NULL) { return 0; } @@ -2666,7 +2666,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } for (s32 i = 0; i < 8; i++) { - a_this->mpBckAnms[i] = new mDoExt_bckAnm(); + a_this->mpBckAnms[i] = JKR_NEW mDoExt_bckAnm(); if (a_this->mpBckAnms[i] == 0) { return 0; } diff --git a/src/d/actor/d_a_npc_hoz.cpp b/src/d/actor/d_a_npc_hoz.cpp index b493477901..31f093bb83 100644 --- a/src/d/actor/d_a_npc_hoz.cpp +++ b/src/d/actor/d_a_npc_hoz.cpp @@ -379,7 +379,7 @@ int daNpc_Hoz_c::CreateHeap() { JUT_ASSERT(1543, NULL != mdlData_p); u32 sp1C = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, sp1C); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, sp1C); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -395,7 +395,7 @@ int daNpc_Hoz_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_impal.cpp b/src/d/actor/d_a_npc_impal.cpp index 8cb7ac80f1..38592500f8 100644 --- a/src/d/actor/d_a_npc_impal.cpp +++ b/src/d/actor/d_a_npc_impal.cpp @@ -189,7 +189,7 @@ BOOL daNpcImpal_c::CreateHeap() { mdlData_p = static_cast(dComIfG_getObjectRes(l_arcNames[0], 26)); JUT_ASSERT(349, 0 != mdlData_p); u32 reg_r23 = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, 0x80000, reg_r23); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -205,7 +205,7 @@ BOOL daNpcImpal_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return FALSE; } diff --git a/src/d/actor/d_a_npc_inko.cpp b/src/d/actor/d_a_npc_inko.cpp index c977ba8b74..159053691d 100644 --- a/src/d/actor/d_a_npc_inko.cpp +++ b/src/d/actor/d_a_npc_inko.cpp @@ -435,7 +435,7 @@ static int daNpc_Inko_Delete(npc_inko_class* i_this) { static int useHeapInit(fopAc_ac_c* actor) { npc_inko_class* i_this = (npc_inko_class*)actor; - i_this->anm_p = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Npc_inko", 8), NULL, + i_this->anm_p = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Npc_inko", 8), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, 0, 0x80000, 0x11000084); if (i_this->anm_p == NULL || i_this->anm_p->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_ins.cpp b/src/d/actor/d_a_npc_ins.cpp index 865c12ea59..00192fcf29 100644 --- a/src/d/actor/d_a_npc_ins.cpp +++ b/src/d/actor/d_a_npc_ins.cpp @@ -469,7 +469,7 @@ int daNpcIns_c::CreateHeap() { JUT_ASSERT(424, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -504,7 +504,7 @@ int daNpcIns_c::CreateHeap() { } } - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_jagar.cpp b/src/d/actor/d_a_npc_jagar.cpp index d047687432..27119c26ba 100644 --- a/src/d/actor/d_a_npc_jagar.cpp +++ b/src/d/actor/d_a_npc_jagar.cpp @@ -398,7 +398,7 @@ int daNpc_Jagar_c::CreateHeap() { if (modelData == NULL) { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -409,7 +409,7 @@ int daNpc_Jagar_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_kakashi.cpp b/src/d/actor/d_a_npc_kakashi.cpp index 3da4a5eea5..96bfc21c33 100644 --- a/src/d/actor/d_a_npc_kakashi.cpp +++ b/src/d/actor/d_a_npc_kakashi.cpp @@ -258,7 +258,7 @@ int daNpc_Kakashi_c::CreateHeap() { } u32 diff_flags = J3D_DIFF_FLAG(FALSE, FALSE, TRUE, 8, 2, FALSE, 2, 0, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE); - mpMorf[0] = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, J3DMdlFlag_DifferedDLBuffer, diff_flags); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, J3DMdlFlag_DifferedDLBuffer, diff_flags); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_kasi_hana.cpp b/src/d/actor/d_a_npc_kasi_hana.cpp index e9544a9a52..16dec8f5d9 100644 --- a/src/d/actor/d_a_npc_kasi_hana.cpp +++ b/src/d/actor/d_a_npc_kasi_hana.cpp @@ -697,7 +697,7 @@ int daNpcKasiHana_c::CreateHeap() { JUT_ASSERT(950, NULL != mdlData_p); u32 reg_r25 = 0x11020084; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, reg_r25); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, reg_r25); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_kasi_kyu.cpp b/src/d/actor/d_a_npc_kasi_kyu.cpp index 8f3f9464cf..48bdd83016 100644 --- a/src/d/actor/d_a_npc_kasi_kyu.cpp +++ b/src/d/actor/d_a_npc_kasi_kyu.cpp @@ -268,7 +268,7 @@ int daNpcKasiKyu_c::CreateHeap() { JUT_ASSERT(322, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_kasi_mich.cpp b/src/d/actor/d_a_npc_kasi_mich.cpp index 86e0632047..e10a8d785b 100644 --- a/src/d/actor/d_a_npc_kasi_mich.cpp +++ b/src/d/actor/d_a_npc_kasi_mich.cpp @@ -268,7 +268,7 @@ int daNpcKasiMich_c::CreateHeap() { JUT_ASSERT(314, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_kkri.cpp b/src/d/actor/d_a_npc_kkri.cpp index 1a086a2c6f..49d11700c2 100644 --- a/src/d/actor/d_a_npc_kkri.cpp +++ b/src/d/actor/d_a_npc_kkri.cpp @@ -405,7 +405,7 @@ int daNpc_Kkri_c::CreateHeap() { } u32 diff_flags = J3D_DIFF_FLAG(FALSE, FALSE, TRUE, 8, 2, FALSE, 2, 0, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE); - mpMorf[0] = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, diff_flags); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, diff_flags); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -417,7 +417,7 @@ int daNpc_Kkri_c::CreateHeap() { mdl_p->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_kn.cpp b/src/d/actor/d_a_npc_kn.cpp index 1197e744ce..8cad3cb871 100644 --- a/src/d/actor/d_a_npc_kn.cpp +++ b/src/d/actor/d_a_npc_kn.cpp @@ -607,7 +607,7 @@ int daNpc_Kn_c::CreateHeap() { JUT_ASSERT(1259, NULL != mdlData_p); u32 sp2C = 0x11020284; - mpModelMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp2C); + mpModelMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp2C); if (mpModelMorf[0] != NULL && mpModelMorf[0]->getModel() == NULL) { mpModelMorf[0]->stopZelAnime(); mpModelMorf[0] = NULL; @@ -636,7 +636,7 @@ int daNpc_Kn_c::CreateHeap() { JUT_ASSERT(1310, NULL != mdlData_p); sp2C = 0x11020284; - mpModelMorf[1] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp2C); + mpModelMorf[1] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp2C); if (mpModelMorf[1] != NULL && mpModelMorf[1]->getModel() == NULL) { mpModelMorf[1] = NULL; diff --git a/src/d/actor/d_a_npc_knj.cpp b/src/d/actor/d_a_npc_knj.cpp index 1cb0913b87..f74d4f6160 100644 --- a/src/d/actor/d_a_npc_knj.cpp +++ b/src/d/actor/d_a_npc_knj.cpp @@ -182,7 +182,7 @@ int daNpc_Knj_c::CreateHeap() { J3DModelData* modelData = static_cast( dComIfG_getObjectRes(l_resNameList[l_bmdData[0][1]], l_bmdData[0][0])); - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { diff --git a/src/d/actor/d_a_npc_kolin.cpp b/src/d/actor/d_a_npc_kolin.cpp index a68846b7eb..ff93ea6ee3 100644 --- a/src/d/actor/d_a_npc_kolin.cpp +++ b/src/d/actor/d_a_npc_kolin.cpp @@ -500,7 +500,7 @@ int daNpc_Kolin_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -511,7 +511,7 @@ int daNpc_Kolin_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_kolinb.cpp b/src/d/actor/d_a_npc_kolinb.cpp index 32d7297382..5f89f5c852 100644 --- a/src/d/actor/d_a_npc_kolinb.cpp +++ b/src/d/actor/d_a_npc_kolinb.cpp @@ -357,7 +357,7 @@ int daNpc_Kolinb_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -368,7 +368,7 @@ int daNpc_Kolinb_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_ks.cpp b/src/d/actor/d_a_npc_ks.cpp index 3630f58d8c..639cb4167f 100644 --- a/src/d/actor/d_a_npc_ks.cpp +++ b/src/d/actor/d_a_npc_ks.cpp @@ -6882,7 +6882,7 @@ static int daNpc_Ks_Delete(npc_ks_class* i_this) { static int useHeapInit(fopAc_ac_c* actor) { npc_ks_class* i_this = (npc_ks_class*)actor; - i_this->model = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BMDR_SARU), NULL, NULL, + i_this->model = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BMDR_SARU), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BCK_SARU_WAIT_A), 0, 1.0f, 0, -1, &i_this->sound, 0x80000, 0x11020084); if (i_this->model == NULL || i_this->model->getModel() == NULL) { @@ -6895,7 +6895,7 @@ static int useHeapInit(fopAc_ac_c* actor) { model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - i_this->btp = new mDoExt_btpAnm(); + i_this->btp = JKR_NEW mDoExt_btpAnm(); if (i_this->btp == NULL) { return 0; } @@ -6904,7 +6904,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - i_this->btp2 = new mDoExt_btpAnm(); + i_this->btp2 = JKR_NEW mDoExt_btpAnm(); if (i_this->btp2 == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_kyury.cpp b/src/d/actor/d_a_npc_kyury.cpp index b6a63565da..66e11f4149 100644 --- a/src/d/actor/d_a_npc_kyury.cpp +++ b/src/d/actor/d_a_npc_kyury.cpp @@ -228,7 +228,7 @@ int daNpc_Kyury_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -242,7 +242,7 @@ int daNpc_Kyury_c::CreateHeap() { model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_len.cpp b/src/d/actor/d_a_npc_len.cpp index 263dd9e64a..f3b1330f51 100644 --- a/src/d/actor/d_a_npc_len.cpp +++ b/src/d/actor/d_a_npc_len.cpp @@ -227,7 +227,7 @@ int daNpc_Len_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -241,7 +241,7 @@ int daNpc_Len_c::CreateHeap() { model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_lf.cpp b/src/d/actor/d_a_npc_lf.cpp index 06b44c70bb..4ee24c6c5a 100644 --- a/src/d/actor/d_a_npc_lf.cpp +++ b/src/d/actor/d_a_npc_lf.cpp @@ -223,8 +223,8 @@ static int daNPC_LF_Execute(npc_lf_class* i_this2) { return 1; } -static bool daNPC_LF_IsDelete(npc_lf_class* param_0) { - return true; +static BOOL daNPC_LF_IsDelete(npc_lf_class* param_0) { + return TRUE; } static int daNPC_LF_Delete(npc_lf_class* i_this) { diff --git a/src/d/actor/d_a_npc_lud.cpp b/src/d/actor/d_a_npc_lud.cpp index 4f96c98e9b..e49570602f 100644 --- a/src/d/actor/d_a_npc_lud.cpp +++ b/src/d/actor/d_a_npc_lud.cpp @@ -306,7 +306,7 @@ int daNpc_Lud_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -320,7 +320,7 @@ int daNpc_Lud_c::CreateHeap() { model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } @@ -332,7 +332,7 @@ int daNpc_Lud_c::CreateHeap() { res_idx = l_bmdData[bmd_idx][0]; modelData = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[arc_idx], res_idx); - mpBowlMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, + mpBowlMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, 0x80000, 0x11000084); if (mpBowlMorf == NULL || mpBowlMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_maro.cpp b/src/d/actor/d_a_npc_maro.cpp index 1bcf6892d8..b96083b7f6 100644 --- a/src/d/actor/d_a_npc_maro.cpp +++ b/src/d/actor/d_a_npc_maro.cpp @@ -349,7 +349,7 @@ int daNpc_Maro_c::CreateHeap() { } u32 sp_0x1c = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x1c); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -361,7 +361,7 @@ int daNpc_Maro_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_midp.cpp b/src/d/actor/d_a_npc_midp.cpp index 8593541b7c..acd11c56dc 100644 --- a/src/d/actor/d_a_npc_midp.cpp +++ b/src/d/actor/d_a_npc_midp.cpp @@ -206,7 +206,7 @@ int daNpc_midP_c::CreateHeap() { J3DModelData* modelData = static_cast(dComIfG_getObjectRes( l_resNameList[l_bmdData[0][1]], l_bmdData[0][0])); - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { if (mpMorf[0] != NULL) { @@ -222,7 +222,7 @@ int daNpc_midP_c::CreateHeap() { model->setUserArea((uintptr_t)this); for (int i = 0; i < 2; i++) { - mpMatAnm[i] = new daNpcT_MatAnm_c(); + mpMatAnm[i] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[i] == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_mk.cpp b/src/d/actor/d_a_npc_mk.cpp index d9775816f8..1f28e74e2f 100644 --- a/src/d/actor/d_a_npc_mk.cpp +++ b/src/d/actor/d_a_npc_mk.cpp @@ -23,8 +23,8 @@ static bool daNpc_Mk_Draw(void* param_0) { return true; } -static bool daNpc_Mk_IsDelete(void* param_0) { - return true; +static BOOL daNpc_Mk_IsDelete(void* param_0) { + return TRUE; } static actor_method_class daNpc_Mk_MethodTable = { diff --git a/src/d/actor/d_a_npc_moi.cpp b/src/d/actor/d_a_npc_moi.cpp index dfd9d4d007..81a60b15e2 100644 --- a/src/d/actor/d_a_npc_moi.cpp +++ b/src/d/actor/d_a_npc_moi.cpp @@ -337,7 +337,7 @@ int daNpc_Moi_c::CreateHeap() { return 1; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -351,7 +351,7 @@ int daNpc_Moi_c::CreateHeap() { model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_moir.cpp b/src/d/actor/d_a_npc_moir.cpp index 963c646ea8..e0c9306364 100644 --- a/src/d/actor/d_a_npc_moir.cpp +++ b/src/d/actor/d_a_npc_moir.cpp @@ -392,7 +392,7 @@ int daNpcMoiR_c::CreateHeap() { JUT_ASSERT(403, NULL != mdlData_p); u32 sp_0x18 = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x18); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x18); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -408,7 +408,7 @@ int daNpcMoiR_c::CreateHeap() { } mdl_p->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_myna2.cpp b/src/d/actor/d_a_npc_myna2.cpp index 8c2aa84525..03eb48944d 100644 --- a/src/d/actor/d_a_npc_myna2.cpp +++ b/src/d/actor/d_a_npc_myna2.cpp @@ -265,7 +265,7 @@ int daNpc_myna2_c::CreateHeap() { JUT_ASSERT(476, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_ne.cpp b/src/d/actor/d_a_npc_ne.cpp index a424218841..6f03de96ce 100644 --- a/src/d/actor/d_a_npc_ne.cpp +++ b/src/d/actor/d_a_npc_ne.cpp @@ -3036,7 +3036,7 @@ static int daNpc_Ne_Delete(npc_ne_class* i_this) { static int useHeapInit(fopAc_ac_c* i_this) { npc_ne_class* _this = static_cast(i_this); _this->mpMorf = - new mDoExt_McaMorf(static_cast(dComIfG_getObjectRes(_this->mResName, 28)), + JKR_NEW mDoExt_McaMorf(static_cast(dComIfG_getObjectRes(_this->mResName, 28)), NULL, NULL, static_cast(dComIfG_getObjectRes(_this->mResName, 24)), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11020284); @@ -3054,7 +3054,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } } - _this->mpBtkAnm = new mDoExt_btkAnm(); + _this->mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (_this->mpBtkAnm == NULL) { return 0; } @@ -3063,7 +3063,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - _this->mpBtpAnm = new mDoExt_btpAnm(); + _this->mpBtpAnm = JKR_NEW mDoExt_btpAnm(); if (_this->mpBtpAnm == NULL) { return 0; } @@ -3083,7 +3083,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } else { dish_flag = 0; } - _this->mpDishMorf = new mDoExt_McaMorf( + _this->mpDishMorf = JKR_NEW mDoExt_McaMorf( static_cast(dComIfG_getObjectRes(_this->mResName, 29)), NULL, NULL, static_cast(dComIfG_getObjectRes(_this->mResName, dish_bck[dish_flag])), diff --git a/src/d/actor/d_a_npc_p2.cpp b/src/d/actor/d_a_npc_p2.cpp index 181cf352b0..a3f34d789f 100644 --- a/src/d/actor/d_a_npc_p2.cpp +++ b/src/d/actor/d_a_npc_p2.cpp @@ -23,8 +23,8 @@ static bool daNpc_P2Draw(void* param_0) { return true; } -static bool daNpc_P2IsDelete(void* param_0) { - return true; +static BOOL daNpc_P2IsDelete(void* param_0) { + return TRUE; } static actor_method_class daNpc_P2MethodTable = { diff --git a/src/d/actor/d_a_npc_pachi_besu.cpp b/src/d/actor/d_a_npc_pachi_besu.cpp index afac516600..22e9717c7e 100644 --- a/src/d/actor/d_a_npc_pachi_besu.cpp +++ b/src/d/actor/d_a_npc_pachi_besu.cpp @@ -609,7 +609,7 @@ int daNpc_Pachi_Besu_c::CreateHeap() { return 1; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -621,7 +621,7 @@ int daNpc_Pachi_Besu_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_pachi_maro.cpp b/src/d/actor/d_a_npc_pachi_maro.cpp index aaea430504..587a58346c 100644 --- a/src/d/actor/d_a_npc_pachi_maro.cpp +++ b/src/d/actor/d_a_npc_pachi_maro.cpp @@ -626,7 +626,7 @@ int daNpc_Pachi_Maro_c::CreateHeap() { } u32 uVar1 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -638,7 +638,7 @@ int daNpc_Pachi_Maro_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_pachi_taro.cpp b/src/d/actor/d_a_npc_pachi_taro.cpp index 45a62de66d..525d8387ee 100644 --- a/src/d/actor/d_a_npc_pachi_taro.cpp +++ b/src/d/actor/d_a_npc_pachi_taro.cpp @@ -852,7 +852,7 @@ int daNpc_Pachi_Taro_c::CreateHeap() { } u32 uVar1 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, uVar1); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -864,7 +864,7 @@ int daNpc_Pachi_Taro_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_post.cpp b/src/d/actor/d_a_npc_post.cpp index b7bfe44042..24722e18e3 100644 --- a/src/d/actor/d_a_npc_post.cpp +++ b/src/d/actor/d_a_npc_post.cpp @@ -465,7 +465,7 @@ int daNpc_Post_c::CreateHeap() { } u32 sp28 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp28); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -477,7 +477,7 @@ int daNpc_Post_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } @@ -492,7 +492,7 @@ int daNpc_Post_c::CreateHeap() { if (mType != TYPE_BAR) { sp28 = 0x11000084; - mpFlagModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, + mpFlagModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, J3DMdlFlag_DifferedDLBuffer, sp28); if (mpFlagModelMorf == NULL || mpFlagModelMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_pouya.cpp b/src/d/actor/d_a_npc_pouya.cpp index b865af2342..8048b02456 100644 --- a/src/d/actor/d_a_npc_pouya.cpp +++ b/src/d/actor/d_a_npc_pouya.cpp @@ -234,7 +234,7 @@ int daNpc_Pouya_c::CreateHeap() { u32 local_30 = chkPouyaB() ? 0x11020284 : 0x11000284; mpMorf[0] = - new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, local_30); + JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, local_30); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -248,7 +248,7 @@ int daNpc_Pouya_c::CreateHeap() { model->setUserArea((uintptr_t)this); if (chkPouyaB()) { - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } @@ -1186,8 +1186,8 @@ static int daNpc_Pouya_Draw(void* i_this) { return static_cast(i_this)->Draw(); } -static bool daNpc_Pouya_IsDelete(void* i_this) { - return 1; +static BOOL daNpc_Pouya_IsDelete(void* i_this) { + return TRUE; } static NPC_POUYA_HIO_CLASS l_HIO; diff --git a/src/d/actor/d_a_npc_prayer.cpp b/src/d/actor/d_a_npc_prayer.cpp index 4974fad798..1cfc2c18df 100644 --- a/src/d/actor/d_a_npc_prayer.cpp +++ b/src/d/actor/d_a_npc_prayer.cpp @@ -175,7 +175,7 @@ int daNpcPray_c::CreateHeap() { J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_arcNames[0], 9); JUT_ASSERT(313, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_raca.cpp b/src/d/actor/d_a_npc_raca.cpp index 328992f59b..07a6b353cb 100644 --- a/src/d/actor/d_a_npc_raca.cpp +++ b/src/d/actor/d_a_npc_raca.cpp @@ -295,7 +295,7 @@ int daNpc_Raca_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -311,7 +311,7 @@ int daNpc_Raca_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_rafrel.cpp b/src/d/actor/d_a_npc_rafrel.cpp index cc9b2382d9..065c16330e 100644 --- a/src/d/actor/d_a_npc_rafrel.cpp +++ b/src/d/actor/d_a_npc_rafrel.cpp @@ -284,7 +284,7 @@ int daNpcRafrel_c::CreateHeap() { JUT_ASSERT(403, NULL != mdlData_p); u32 mdl_diff_flags = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, mdl_diff_flags); + mAnm_p = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, mdl_diff_flags); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -302,7 +302,7 @@ int daNpcRafrel_c::CreateHeap() { mdl_p->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_saru.cpp b/src/d/actor/d_a_npc_saru.cpp index a894050445..4da2185851 100644 --- a/src/d/actor/d_a_npc_saru.cpp +++ b/src/d/actor/d_a_npc_saru.cpp @@ -372,7 +372,7 @@ int daNpc_Saru_c::CreateHeap() { if (modelData == NULL) { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_seib.cpp b/src/d/actor/d_a_npc_seib.cpp index 382a5350f5..ccb87510a4 100644 --- a/src/d/actor/d_a_npc_seib.cpp +++ b/src/d/actor/d_a_npc_seib.cpp @@ -183,7 +183,7 @@ int daNpc_seiB_c::CreateHeap() { JUT_ASSERT(466, NULL != mdlData_p); mpMorf[0] = - new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); + JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); if (mpMorf[0] && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; diff --git a/src/d/actor/d_a_npc_seic.cpp b/src/d/actor/d_a_npc_seic.cpp index b3a688f721..0961d04bb1 100644 --- a/src/d/actor/d_a_npc_seic.cpp +++ b/src/d/actor/d_a_npc_seic.cpp @@ -186,7 +186,7 @@ int daNpc_seiC_c::CreateHeap() { J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[l_bmdData[0][1]], l_bmdData[0][0]); JUT_ASSERT(424, NULL != mdlData_p); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; diff --git a/src/d/actor/d_a_npc_seid.cpp b/src/d/actor/d_a_npc_seid.cpp index ba0e82bd49..b516ec4c09 100644 --- a/src/d/actor/d_a_npc_seid.cpp +++ b/src/d/actor/d_a_npc_seid.cpp @@ -186,7 +186,7 @@ int daNpc_seiD_c::CreateHeap() { J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[l_bmdData[0][1]], l_bmdData[0][0]); JUT_ASSERT(424, NULL != mdlData_p); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; diff --git a/src/d/actor/d_a_npc_seira.cpp b/src/d/actor/d_a_npc_seira.cpp index 6969645ed1..678fabc8bb 100644 --- a/src/d/actor/d_a_npc_seira.cpp +++ b/src/d/actor/d_a_npc_seira.cpp @@ -268,7 +268,7 @@ int daNpc_Seira_c::CreateHeap() { } u32 sp_0x28 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x28); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -280,7 +280,7 @@ int daNpc_Seira_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } @@ -296,7 +296,7 @@ int daNpc_Seira_c::CreateHeap() { } sp_0x28 = 0x11000084; - mpSeiraMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, + mpSeiraMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, 0, sp_0x28); if (mpSeiraMorf == NULL || mpSeiraMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_seira2.cpp b/src/d/actor/d_a_npc_seira2.cpp index ed9e2ea3c9..a12c06e86e 100644 --- a/src/d/actor/d_a_npc_seira2.cpp +++ b/src/d/actor/d_a_npc_seira2.cpp @@ -253,7 +253,7 @@ int daNpc_Seira2_c::CreateHeap() { } u32 sp_0x28 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x28); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -265,7 +265,7 @@ int daNpc_Seira2_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } @@ -277,7 +277,7 @@ int daNpc_Seira2_c::CreateHeap() { l_resNameList[res_name_idx], sp_0x2c)); sp_0x28 = 0x11000084; - mpSeiraMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, + mpSeiraMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, 0, sp_0x28); if (mpSeiraMorf == NULL || mpSeiraMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_seirei.cpp b/src/d/actor/d_a_npc_seirei.cpp index 87216b3ee1..e78a255dad 100644 --- a/src/d/actor/d_a_npc_seirei.cpp +++ b/src/d/actor/d_a_npc_seirei.cpp @@ -293,7 +293,7 @@ int daNpc_Seirei_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_shad.cpp b/src/d/actor/d_a_npc_shad.cpp index 1665797d58..7f6d35ffc6 100644 --- a/src/d/actor/d_a_npc_shad.cpp +++ b/src/d/actor/d_a_npc_shad.cpp @@ -475,7 +475,7 @@ cPhs_Step daNpcShad_c::Create() { int daNpcShad_c::CreateHeap() { J3DModelData* mdlData_p = static_cast(dComIfG_getObjectRes(l_arcNames[0], BMDR_SHAD)); JUT_ASSERT(483, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -492,7 +492,7 @@ int daNpcShad_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_shaman.cpp b/src/d/actor/d_a_npc_shaman.cpp index d1c31ea12e..4acc8cd723 100644 --- a/src/d/actor/d_a_npc_shaman.cpp +++ b/src/d/actor/d_a_npc_shaman.cpp @@ -304,7 +304,7 @@ int daNpc_Sha_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -315,7 +315,7 @@ int daNpc_Sha_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_shoe.cpp b/src/d/actor/d_a_npc_shoe.cpp index 06b63797a7..eb00596bf4 100644 --- a/src/d/actor/d_a_npc_shoe.cpp +++ b/src/d/actor/d_a_npc_shoe.cpp @@ -175,7 +175,7 @@ BOOL daNpcShoe_c::CreateHeap() { JUT_ASSERT(292, NULL != mdlData_p) - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, 0x11020084); if (mAnm_p != NULL && mAnm_p->mpModel == NULL) { @@ -650,8 +650,8 @@ static int daNpcShoe_Draw(void* i_this) { return static_cast(i_this)->Draw(); } -static bool daNpcShoe_IsDelete(void* param_0) { - return true; +static BOOL daNpcShoe_IsDelete(void* param_0) { + return TRUE; } void daNpcShoe_c::setParam() { diff --git a/src/d/actor/d_a_npc_shop0.cpp b/src/d/actor/d_a_npc_shop0.cpp index 1c6d3d1c36..557b836ddc 100644 --- a/src/d/actor/d_a_npc_shop0.cpp +++ b/src/d/actor/d_a_npc_shop0.cpp @@ -76,7 +76,7 @@ int daNpc_Shop0_c::createHeap() { return 0; } - mpShopParam = new daNpc_Shop0_Param_c(); + mpShopParam = JKR_NEW daNpc_Shop0_Param_c(); if (mpShopParam == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_shop_maro.cpp b/src/d/actor/d_a_npc_shop_maro.cpp index 13133a1355..54c4eb882e 100644 --- a/src/d/actor/d_a_npc_shop_maro.cpp +++ b/src/d/actor/d_a_npc_shop_maro.cpp @@ -24,8 +24,8 @@ static bool daNpc_shopMaro_Draw(void* i_this) { return false; } -static bool daNpc_shopMaro_IsDelete(void* i_this) { - return true; +static BOOL daNpc_shopMaro_IsDelete(void* i_this) { + return TRUE; } int daNpc_shopMaro_c::create() { diff --git a/src/d/actor/d_a_npc_sola.cpp b/src/d/actor/d_a_npc_sola.cpp index cf026eb243..5e9c19d8cc 100644 --- a/src/d/actor/d_a_npc_sola.cpp +++ b/src/d/actor/d_a_npc_sola.cpp @@ -161,7 +161,7 @@ int daNpc_solA_c::CreateHeap() { mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[res_name_idx], sp_0x2c); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); diff --git a/src/d/actor/d_a_npc_soldierA.cpp b/src/d/actor/d_a_npc_soldierA.cpp index 439ae1f11f..8337164b25 100644 --- a/src/d/actor/d_a_npc_soldierA.cpp +++ b/src/d/actor/d_a_npc_soldierA.cpp @@ -277,7 +277,7 @@ int daNpc_SoldierA_c::CreateHeap() { JUT_ASSERT(413, NULL != mdlData_p); u32 uVar1 = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, uVar1); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, uVar1); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; diff --git a/src/d/actor/d_a_npc_soldierB.cpp b/src/d/actor/d_a_npc_soldierB.cpp index 74d68caa56..24237bdde6 100644 --- a/src/d/actor/d_a_npc_soldierB.cpp +++ b/src/d/actor/d_a_npc_soldierB.cpp @@ -237,7 +237,7 @@ int daNpc_SoldierB_c::CreateHeap() { } u32 uVar1 = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, uVar1); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); diff --git a/src/d/actor/d_a_npc_sq.cpp b/src/d/actor/d_a_npc_sq.cpp index 4f0ba6b40b..8d461aab57 100644 --- a/src/d/actor/d_a_npc_sq.cpp +++ b/src/d/actor/d_a_npc_sq.cpp @@ -300,14 +300,14 @@ static int useHeapInit(fopAc_ac_c* i_this) { npc_sq_class* _this = static_cast(i_this); _this->mpMorf = - new mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("Sq", 17)), NULL, NULL, + JKR_NEW mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("Sq", 17)), NULL, NULL, static_cast(dComIfG_getObjectRes("Sq", 9)), 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); if (_this->mpMorf == NULL || _this->mpMorf->getModel() == NULL) { return 0; } - _this->mpBtkAnm = new mDoExt_btkAnm(); + _this->mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (_this->mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_taro.cpp b/src/d/actor/d_a_npc_taro.cpp index 7cde2b396c..9690c365de 100644 --- a/src/d/actor/d_a_npc_taro.cpp +++ b/src/d/actor/d_a_npc_taro.cpp @@ -359,7 +359,7 @@ int daNpc_Taro_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -370,7 +370,7 @@ int daNpc_Taro_c::CreateHeap() { modelData->getJointNodePointer(i)->setCallBack(ctrlJointCallBack); } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_the.cpp b/src/d/actor/d_a_npc_the.cpp index 1708668d33..4eba37be20 100644 --- a/src/d/actor/d_a_npc_the.cpp +++ b/src/d/actor/d_a_npc_the.cpp @@ -196,7 +196,7 @@ int daNpcThe_c::CreateHeap() { dComIfG_getObjectRes(l_resNames[l_bmdGetParamList[bmd_get_idx].arcIdx], l_bmdGetParamList[bmd_get_idx].fileIdx)); } - mAnm_p = new mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { @@ -213,7 +213,7 @@ int daNpcThe_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_theB.cpp b/src/d/actor/d_a_npc_theB.cpp index 5cde34a632..73731ae198 100644 --- a/src/d/actor/d_a_npc_theB.cpp +++ b/src/d/actor/d_a_npc_theB.cpp @@ -294,7 +294,7 @@ int daNpcTheB_c::CreateHeap() { mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 0x26); JUT_ASSERT(383, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 0x1B), + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 0x1B), 2, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -312,7 +312,7 @@ int daNpcTheB_c::CreateHeap() { mdlData_p->getJointNodePointer(JNT_MOUTH)->setCallBack(ctrlJointCallBack); mAnm_p->getModel()->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_tk.cpp b/src/d/actor/d_a_npc_tk.cpp index daaaeeebfc..6ac80659ee 100644 --- a/src/d/actor/d_a_npc_tk.cpp +++ b/src/d/actor/d_a_npc_tk.cpp @@ -3213,7 +3213,7 @@ int daNPC_TK_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Npc_tk", "tk.bmd"); JUT_ASSERT(0xf4f, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Npc_tk", 6), 0, 1.0f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpMorf == NULL || mpMorf->getModel() == NULL) { diff --git a/src/d/actor/d_a_npc_tkc.cpp b/src/d/actor/d_a_npc_tkc.cpp index a0a89a007d..ef6019b49b 100644 --- a/src/d/actor/d_a_npc_tkc.cpp +++ b/src/d/actor/d_a_npc_tkc.cpp @@ -269,7 +269,7 @@ int daNpcTkc_c::CreateHeap() { JUT_ASSERT(330, NULL != mdlData_p); u32 uVar1 = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, uVar1); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, uVar1); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -285,7 +285,7 @@ int daNpcTkc_c::CreateHeap() { } mdl_p->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_tkj.cpp b/src/d/actor/d_a_npc_tkj.cpp index 74589199c9..33491749f4 100644 --- a/src/d/actor/d_a_npc_tkj.cpp +++ b/src/d/actor/d_a_npc_tkj.cpp @@ -221,7 +221,7 @@ int daNpcTkj_c::CreateHeap() { JUT_ASSERT(446, NULL != mdlData_p); u32 diff_flags = J3D_DIFF_FLAG(FALSE, FALSE, TRUE, 8, 2, FALSE, 2, 0, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, diff_flags); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, diff_flags); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -238,7 +238,7 @@ int daNpcTkj_c::CreateHeap() { mdl_p->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_tkj2.cpp b/src/d/actor/d_a_npc_tkj2.cpp index d364c06cc1..8885746542 100644 --- a/src/d/actor/d_a_npc_tkj2.cpp +++ b/src/d/actor/d_a_npc_tkj2.cpp @@ -1043,7 +1043,7 @@ static int daNpc_Tkj2_Delete(npc_tkj2_class* i_this) { static int useHeapInit(fopAc_ac_c* a_this) { npc_tkj2_class* i_this = (npc_tkj2_class*)a_this; - i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("Tkj2", BMDR_TKJ), NULL, NULL, + i_this->mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("Tkj2", BMDR_TKJ), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Tkj2", BCK_TKJ_WAIT_A), 0, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11020284); if (i_this->mpModelMorf == NULL || i_this->mpModelMorf->getModel() == NULL) { return 0; @@ -1056,7 +1056,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - i_this->mpBtkAnm = new mDoExt_btkAnm(); + i_this->mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (i_this->mpBtkAnm == NULL) { return 0; } @@ -1065,7 +1065,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { return 0; } - i_this->mpBtpAnm = new mDoExt_btpAnm(); + i_this->mpBtpAnm = JKR_NEW mDoExt_btpAnm(); if (i_this->mpBtpAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_tks.cpp b/src/d/actor/d_a_npc_tks.cpp index f2835af152..cfab685415 100644 --- a/src/d/actor/d_a_npc_tks.cpp +++ b/src/d/actor/d_a_npc_tks.cpp @@ -371,7 +371,7 @@ int daNpcTks_c::CreateHeap() { JUT_ASSERT(410, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -387,7 +387,7 @@ int daNpcTks_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } @@ -405,7 +405,7 @@ int daNpcTks_c::CreateHeap() { JUT_ASSERT(453, NULL != mdlData_p); - mTksTsubo.mpModelMorf = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, getTrnsfrmKeyAnmP(l_arcName, BCK_TKS_TUBO_HIDE), -1, 1.0f, 0, -1, &mTksTsubo.mSound, 0x80000, 0x11000084); + mTksTsubo.mpModelMorf = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, getTrnsfrmKeyAnmP(l_arcName, BCK_TKS_TUBO_HIDE), -1, 1.0f, 0, -1, &mTksTsubo.mSound, 0x80000, 0x11000084); if (mTksTsubo.mpModelMorf == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_toby.cpp b/src/d/actor/d_a_npc_toby.cpp index 76573c8ab5..c15d5bc02e 100644 --- a/src/d/actor/d_a_npc_toby.cpp +++ b/src/d/actor/d_a_npc_toby.cpp @@ -359,7 +359,7 @@ int daNpc_Toby_c::CreateHeap() { } u32 sp_0x24 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x24); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x24); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -370,7 +370,7 @@ int daNpc_Toby_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_tr.cpp b/src/d/actor/d_a_npc_tr.cpp index cc30258dcd..2aac271a40 100644 --- a/src/d/actor/d_a_npc_tr.cpp +++ b/src/d/actor/d_a_npc_tr.cpp @@ -186,8 +186,8 @@ static int daNPC_TR_Execute(npc_tr_class* npc_tr) { return 1; } -static bool daNPC_TR_IsDelete(npc_tr_class* param_0) { - return true; +static BOOL daNPC_TR_IsDelete(npc_tr_class* param_0) { + return TRUE; } static int daNPC_TR_Delete(npc_tr_class* npc_tr) { diff --git a/src/d/actor/d_a_npc_uri.cpp b/src/d/actor/d_a_npc_uri.cpp index c1fe5f439b..0f006d9f33 100644 --- a/src/d/actor/d_a_npc_uri.cpp +++ b/src/d/actor/d_a_npc_uri.cpp @@ -291,7 +291,7 @@ int daNpc_Uri_c::CreateHeap() { return 1; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -305,7 +305,7 @@ int daNpc_Uri_c::CreateHeap() { model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_wrestler.cpp b/src/d/actor/d_a_npc_wrestler.cpp index f57c4c34a7..8b109c8768 100644 --- a/src/d/actor/d_a_npc_wrestler.cpp +++ b/src/d/actor/d_a_npc_wrestler.cpp @@ -733,7 +733,7 @@ int daNpcWrestler_c::CreateHeap() { JUT_ASSERT(830, NULL != mdlData_p); u32 reg_r23 = 0x11020284; - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, reg_r23); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, reg_r23); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -748,7 +748,7 @@ int daNpcWrestler_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_yamid.cpp b/src/d/actor/d_a_npc_yamid.cpp index f55f755e04..e92ac9b553 100644 --- a/src/d/actor/d_a_npc_yamid.cpp +++ b/src/d/actor/d_a_npc_yamid.cpp @@ -268,7 +268,7 @@ int daNpc_yamiD_c::CreateHeap() { JUT_ASSERT(477, NULL != mdlData_p); u32 sp_0x1C = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x1C); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x1C); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -284,7 +284,7 @@ int daNpc_yamiD_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_yamis.cpp b/src/d/actor/d_a_npc_yamis.cpp index 6db606a991..7689bf40a4 100644 --- a/src/d/actor/d_a_npc_yamis.cpp +++ b/src/d/actor/d_a_npc_yamis.cpp @@ -203,7 +203,7 @@ int daNpc_yamiS_c::CreateHeap() { mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[res_name_idx], index); u32 sp_0x1C = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x1C); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); @@ -220,7 +220,7 @@ int daNpc_yamiS_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_yamit.cpp b/src/d/actor/d_a_npc_yamit.cpp index fb74a15e52..47acc83d9f 100644 --- a/src/d/actor/d_a_npc_yamit.cpp +++ b/src/d/actor/d_a_npc_yamit.cpp @@ -206,7 +206,7 @@ int daNpc_yamiT_c::CreateHeap() { mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[res_name_idx], index); u32 sp_0x1C = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp_0x1C); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); @@ -223,7 +223,7 @@ int daNpc_yamiT_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_yelia.cpp b/src/d/actor/d_a_npc_yelia.cpp index d26b030a49..84f97a65da 100644 --- a/src/d/actor/d_a_npc_yelia.cpp +++ b/src/d/actor/d_a_npc_yelia.cpp @@ -444,7 +444,7 @@ int daNpc_Yelia_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; @@ -456,7 +456,7 @@ int daNpc_Yelia_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_ykm.cpp b/src/d/actor/d_a_npc_ykm.cpp index 1cae05166a..e3f595deec 100644 --- a/src/d/actor/d_a_npc_ykm.cpp +++ b/src/d/actor/d_a_npc_ykm.cpp @@ -656,7 +656,7 @@ int daNpc_ykM_c::CreateHeap() { } int sp34 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp34); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, sp34); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -667,7 +667,7 @@ int daNpc_ykM_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } @@ -700,7 +700,7 @@ int daNpc_ykM_c::CreateHeap() { JUT_ASSERT(1595, NULL != mdlData_p); sp34 = 0x11000084; - mFishModelMorf = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, + mFishModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, 0x80000, sp34); if (mFishModelMorf == NULL || mFishModelMorf->getModel() == NULL) { return 0; @@ -714,7 +714,7 @@ int daNpc_ykM_c::CreateHeap() { JUT_ASSERT(1622, NULL != mdlData_p); sp34 = 0x11000084; - mLeafModelMorf = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, + mLeafModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, 0x80000, sp34); if (mLeafModelMorf == NULL || mLeafModelMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_ykw.cpp b/src/d/actor/d_a_npc_ykw.cpp index 25b3df0e8f..deb61d7dba 100644 --- a/src/d/actor/d_a_npc_ykw.cpp +++ b/src/d/actor/d_a_npc_ykw.cpp @@ -389,7 +389,7 @@ int daNpc_ykW_c::CreateHeap() { } int temp1 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, temp1); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { @@ -406,7 +406,7 @@ int daNpc_ykW_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_zanb.cpp b/src/d/actor/d_a_npc_zanb.cpp index 296e81c21b..77aa9deab3 100644 --- a/src/d/actor/d_a_npc_zanb.cpp +++ b/src/d/actor/d_a_npc_zanb.cpp @@ -215,7 +215,7 @@ int daNpc_zanB_c::CreateHeap() { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, J3DMdlFlag_DifferedDLBuffer, 0x11020284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -226,7 +226,7 @@ int daNpc_zanB_c::CreateHeap() { } mdl_p->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_zant.cpp b/src/d/actor/d_a_npc_zant.cpp index 3fdcf6d84c..5ffc222843 100644 --- a/src/d/actor/d_a_npc_zant.cpp +++ b/src/d/actor/d_a_npc_zant.cpp @@ -151,7 +151,7 @@ int daNpc_Zant_c::create() { int daNpc_Zant_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[l_bmdData[1]], l_bmdData[0]); - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); diff --git a/src/d/actor/d_a_npc_zelR.cpp b/src/d/actor/d_a_npc_zelR.cpp index dee038bd59..9bc2766843 100644 --- a/src/d/actor/d_a_npc_zelR.cpp +++ b/src/d/actor/d_a_npc_zelR.cpp @@ -203,7 +203,7 @@ int daNpc_ZelR_c::CreateHeap() { JUT_ASSERT(0x1b0, NULL != mdlData_p); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -220,7 +220,7 @@ int daNpc_ZelR_c::CreateHeap() { model->setUserArea((uintptr_t)this); for (int i = 0; i < 2; i++) { - mpMatAnm[i] = new daNpcT_MatAnm_c(); + mpMatAnm[i] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[i] == NULL) { return 0; diff --git a/src/d/actor/d_a_npc_zelRo.cpp b/src/d/actor/d_a_npc_zelRo.cpp index 5a0c750dc9..e03662812e 100644 --- a/src/d/actor/d_a_npc_zelRo.cpp +++ b/src/d/actor/d_a_npc_zelRo.cpp @@ -228,7 +228,7 @@ int daNpc_ZelRo_c::CreateHeap() { JUT_ASSERT(432, NULL != mdlData_p); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); mpMorf[0] = NULL; @@ -245,7 +245,7 @@ int daNpc_ZelRo_c::CreateHeap() { model->setUserArea((uintptr_t)this); for (int i = 0; i < 2; i++) { - mpMatAnm[i] = new daNpcT_MatAnm_c(); + mpMatAnm[i] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[i] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_zelda.cpp b/src/d/actor/d_a_npc_zelda.cpp index 42dc79070a..7fb6649645 100644 --- a/src/d/actor/d_a_npc_zelda.cpp +++ b/src/d/actor/d_a_npc_zelda.cpp @@ -258,7 +258,7 @@ int daNpc_Zelda_c::CreateHeap() { } s32 temp4 = 0x11020284; - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, temp4); + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0, temp4); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } @@ -271,7 +271,7 @@ int daNpc_Zelda_c::CreateHeap() { model->setUserArea((uintptr_t)this); for (s32 i = 0; i < 2; i++) { - mpMatAnm[i] = new daNpcT_MatAnm_c(); + mpMatAnm[i] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[i] == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_zra.cpp b/src/d/actor/d_a_npc_zra.cpp index 4386b54190..2278d7b3ef 100644 --- a/src/d/actor/d_a_npc_zra.cpp +++ b/src/d/actor/d_a_npc_zra.cpp @@ -605,7 +605,7 @@ int daNpc_zrA_c::CreateHeap() { } model_flag = 0; } - mAnm_p = new mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, model_flag, 0x11020285); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -633,7 +633,7 @@ int daNpc_zrA_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_zrc.cpp b/src/d/actor/d_a_npc_zrc.cpp index 2745b04d8f..07599054c6 100644 --- a/src/d/actor/d_a_npc_zrc.cpp +++ b/src/d/actor/d_a_npc_zrc.cpp @@ -305,7 +305,7 @@ int daNpc_zrC_c::CreateHeap() { model_flag = 0; } - mAnm_p = new mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, model_flag, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -321,7 +321,7 @@ int daNpc_zrC_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_npc_zrz.cpp b/src/d/actor/d_a_npc_zrz.cpp index a811e4b326..607f63891f 100644 --- a/src/d/actor/d_a_npc_zrz.cpp +++ b/src/d/actor/d_a_npc_zrz.cpp @@ -278,7 +278,7 @@ int daNpc_zrZ_c::CreateHeap() { } } - mAnm_p = new mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, + mAnm_p = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreatureSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); @@ -298,7 +298,7 @@ int daNpc_zrZ_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_Turara.cpp b/src/d/actor/d_a_obj_Turara.cpp index 35711715ed..89a98a348c 100644 --- a/src/d/actor/d_a_obj_Turara.cpp +++ b/src/d/actor/d_a_obj_Turara.cpp @@ -95,7 +95,7 @@ int daTurara_c::CreateHeap() { if (mpModel[1] == NULL) { return 0; } - field_0x980 = new dBgW; + field_0x980 = JKR_NEW dBgW; if (field_0x980 == NULL || field_0x980->Set((cBgD_t *)dComIfG_getObjectRes("M_Turara", 0xd), 1, &mBgMtx) != 0) { field_0x980 = NULL; diff --git a/src/d/actor/d_a_obj_ari.cpp b/src/d/actor/d_a_obj_ari.cpp index 0c35f13ad8..7a5f438a74 100644 --- a/src/d/actor/d_a_obj_ari.cpp +++ b/src/d/actor/d_a_obj_ari.cpp @@ -85,7 +85,7 @@ int daObjARI_c::CreateHeap() { } else { model_data = static_cast(dComIfG_getObjectRes("I_Ari", 10)); } - mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, static_cast(dComIfG_getObjectRes("I_Ari", 6)), 2, 0.5f, 0, -1, &mCreatureSound, 0, 0x11000284); if (mpMorf == NULL || mpMorf->getModel() == NULL) { @@ -93,7 +93,7 @@ int daObjARI_c::CreateHeap() { } J3DModel* model = mpMorf->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -109,7 +109,7 @@ int daObjARI_c::CreateHeap() { } } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_automata.cpp b/src/d/actor/d_a_obj_automata.cpp index 7a54a16fce..3c43af4d69 100644 --- a/src/d/actor/d_a_obj_automata.cpp +++ b/src/d/actor/d_a_obj_automata.cpp @@ -126,7 +126,7 @@ int daObj_AutoMata_c::CreateHeap() { if (modelData == NULL) { return 0; } - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mCreature, 0x80000, 0x11000284); if (mpMorf == NULL || mpMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_obj_avalanche.cpp b/src/d/actor/d_a_obj_avalanche.cpp index 795b9ff45f..cf0e126f88 100644 --- a/src/d/actor/d_a_obj_avalanche.cpp +++ b/src/d/actor/d_a_obj_avalanche.cpp @@ -88,12 +88,12 @@ int daObjAvalanche_c::CreateHeap() { J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 6); JUT_ASSERT(247, anm != NULL); - mBckAnm = new mDoExt_bckAnm(); + mBckAnm = JKR_NEW mDoExt_bckAnm(); if (mBckAnm == NULL || !mBckAnm->init(anm, 1, 0, 1.0, 0, -1, false)) { return 0; } mBckAnm->setPlaySpeed(0.0f); - mpBgW2 = new dBgW(); + mpBgW2 = JKR_NEW dBgW(); if (mpBgW2 != NULL && !mpBgW2->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, l_dzb[1]), 1, &mMtx2)) { mpBgW2->SetCrrFunc(dBgS_MoveBGProc_Trans); } else { diff --git a/src/d/actor/d_a_obj_batta.cpp b/src/d/actor/d_a_obj_batta.cpp index eb187f1ac0..81d3e6a084 100644 --- a/src/d/actor/d_a_obj_batta.cpp +++ b/src/d/actor/d_a_obj_batta.cpp @@ -89,7 +89,7 @@ static u32 const l_batta_btk_index[2] = { inline int daObjBATTA_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Bat", 0xb); JUT_ASSERT(256, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Bat", 8), 2, 1.0f, 0, -1, &mCreature, 0x80000, 0x11000284); if (mpMorf == NULL || mpMorf->getModel() == NULL) { @@ -97,7 +97,7 @@ inline int daObjBATTA_c::CreateHeap() { } J3DModel* morfModel = mpMorf->getModel(); - mBrk = new mDoExt_brkAnm(); + mBrk = JKR_NEW mDoExt_brkAnm(); if (mBrk == NULL) { return 0; } @@ -107,7 +107,7 @@ inline int daObjBATTA_c::CreateHeap() { return 0; } - mBtk = new mDoExt_btkAnm(); + mBtk = JKR_NEW mDoExt_btkAnm(); if (mBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_bed.cpp b/src/d/actor/d_a_obj_bed.cpp index 06c2eb71da..77f17a6e62 100644 --- a/src/d/actor/d_a_obj_bed.cpp +++ b/src/d/actor/d_a_obj_bed.cpp @@ -93,7 +93,7 @@ int daObj_Bed_c::CreateHeap() { if (mpModel == NULL) { return 0; } - mpCollider = new dBgW(); + mpCollider = JKR_NEW dBgW(); if (mpCollider == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_bemos.cpp b/src/d/actor/d_a_obj_bemos.cpp index 2bbd723340..966a80b64b 100644 --- a/src/d/actor/d_a_obj_bemos.cpp +++ b/src/d/actor/d_a_obj_bemos.cpp @@ -421,7 +421,7 @@ int daObjBm_c::CreateHeap() { { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, dRes_INDEX_OBJ_BM_BRK_SERCH_e); JUT_ASSERT(780, pbrk != NULL); - mSerchBrk = new mDoExt_brkAnm(); + mSerchBrk = JKR_NEW mDoExt_brkAnm(); if (mSerchBrk == NULL || mSerchBrk->init(modelData, pbrk, 1, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1) == 0) { return 0; } @@ -436,7 +436,7 @@ int daObjBm_c::CreateHeap() { { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, dRes_INDEX_OBJ_BM_BCK_BM_UP_e); JUT_ASSERT(798, pbck != NULL); - mBeamosBck = new mDoExt_bckAnm(); + mBeamosBck = JKR_NEW mDoExt_bckAnm(); if (mBeamosBck == NULL || mBeamosBck->init(pbck, 1, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false) == 0) { return 0; } @@ -454,7 +454,7 @@ int daObjBm_c::CreateHeap() { { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, dRes_INDEX_OBJ_BM_BTK_EF_BIMOBEAMB_OFF_e); JUT_ASSERT(827, pbtk != NULL); - mBeamBtk = new mDoExt_btkAnm(); + mBeamBtk = JKR_NEW mDoExt_btkAnm(); if (mBeamBtk == NULL || mBeamBtk->init(modelData, pbtk, 1, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1) == 0) { return 0; } @@ -468,7 +468,7 @@ int daObjBm_c::CreateHeap() { pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes( l_arcName, dRes_INDEX_OBJ_BM_BTK_EF_BIMOBEAM_e); JUT_ASSERT(846, pbtk != NULL); - mBeamEffBtk = new mDoExt_btkAnm(); + mBeamEffBtk = JKR_NEW mDoExt_btkAnm(); if (mBeamEffBtk == NULL || mBeamEffBtk->init(modelData, pbtk, 1, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1) == 0) { return 0; } @@ -477,7 +477,7 @@ int daObjBm_c::CreateHeap() { { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, dRes_INDEX_OBJ_BM_BCK_EF_BIMOBEAM_e); JUT_ASSERT(858, pbck != NULL); - mBeamEffBck = new mDoExt_bckAnm(); + mBeamEffBck = JKR_NEW mDoExt_bckAnm(); if (mBeamEffBck == NULL || mBeamEffBck->init(pbck, 1, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false) == 0) { return 0; } @@ -495,7 +495,7 @@ int daObjBm_c::CreateHeap() { { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, dRes_INDEX_OBJ_BM_BCK_BMF_OFF_e); JUT_ASSERT(885, pbck != NULL); - mBmfOffBck = new mDoExt_bckAnm(); + mBmfOffBck = JKR_NEW mDoExt_bckAnm(); if (mBmfOffBck == NULL || mBmfOffBck->init(pbck, 1, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false) == 0) { return 0; } diff --git a/src/d/actor/d_a_obj_bk_leaf.cpp b/src/d/actor/d_a_obj_bk_leaf.cpp index e5f6a56994..a2a3251372 100644 --- a/src/d/actor/d_a_obj_bk_leaf.cpp +++ b/src/d/actor/d_a_obj_bk_leaf.cpp @@ -63,7 +63,7 @@ int daBkLeaf_c::CreateHeap() { } else { J3DAnmTransform* transform = static_cast(dComIfG_getObjectRes(l_arcName, l_bckName)); - mpBckAnm = new mDoExt_bckAnm; + mpBckAnm = JKR_NEW mDoExt_bckAnm; if (mpBckAnm == NULL || mpBckAnm->init(transform, 1, 0, 1.0f, 0, -1, false) == 0) { retVal = 0; } else { diff --git a/src/d/actor/d_a_obj_bky_rock.cpp b/src/d/actor/d_a_obj_bky_rock.cpp index 08fc622c8c..cf8b62c895 100644 --- a/src/d/actor/d_a_obj_bky_rock.cpp +++ b/src/d/actor/d_a_obj_bky_rock.cpp @@ -157,7 +157,7 @@ int daBkyRock_c::createHeap() { } } if (nameNo == 1) { - mBgW = new dBgW(); + mBgW = JKR_NEW dBgW(); if (mBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_bosswarp.cpp b/src/d/actor/d_a_obj_bosswarp.cpp index 19fe7f3a41..90abc38275 100644 --- a/src/d/actor/d_a_obj_bosswarp.cpp +++ b/src/d/actor/d_a_obj_bosswarp.cpp @@ -129,7 +129,7 @@ int daObjBossWarp_c::CreateHeap() { } J3DAnmTevRegKey* brk_anm = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 9); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || !mpBrkAnm->init(model_data, brk_anm, 1, 0, 1.0f, 0, -1)) { return 0; } @@ -140,7 +140,7 @@ int daObjBossWarp_c::CreateHeap() { for (int i = 0; i < 2; i++) { J3DAnmTextureSRTKey* btk_anm = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, l_btk_idx[i]); - mpBtkAnm[i] = new mDoExt_btkAnm(); + mpBtkAnm[i] = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm[i] == NULL || !mpBtkAnm[i]->init(model_data, btk_anm, 1, l_play_mode[i], 1.0f, 0, -1)) { diff --git a/src/d/actor/d_a_obj_brakeeff.cpp b/src/d/actor/d_a_obj_brakeeff.cpp index 6a43938f72..4ea698c8e2 100644 --- a/src/d/actor/d_a_obj_brakeeff.cpp +++ b/src/d/actor/d_a_obj_brakeeff.cpp @@ -155,7 +155,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpBrk = new mDoExt_brkAnm(); + a_this->mpBrk = JKR_NEW mDoExt_brkAnm(); if (!a_this->mpBrk) { return 0; } @@ -168,7 +168,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpDBgW = new dBgW(); + a_this->mpDBgW = JKR_NEW dBgW(); if (!a_this->mpDBgW) { return 0; } diff --git a/src/d/actor/d_a_obj_brg.cpp b/src/d/actor/d_a_obj_brg.cpp index c66a45b20f..cfcaab1335 100644 --- a/src/d/actor/d_a_obj_brg.cpp +++ b/src/d/actor/d_a_obj_brg.cpp @@ -1604,7 +1604,7 @@ static int CallbackCreateHeap(fopAc_ac_c* i_this) { OS_REPORT("BGSV SET 1!\n"); - a_this->mpBgW = new dBgWSv(); + a_this->mpBgW = JKR_NEW dBgWSv(); if (a_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_catdoor.cpp b/src/d/actor/d_a_obj_catdoor.cpp index d60831b6d2..8967312fe6 100644 --- a/src/d/actor/d_a_obj_catdoor.cpp +++ b/src/d/actor/d_a_obj_catdoor.cpp @@ -159,8 +159,8 @@ static int daObjCatDoor_Execute(daObjCatDoor_c* i_this) { return static_cast(i_this)->execute(); } -static bool daObjCatDoor_IsDelete(daObjCatDoor_c* i_this) { - return true; +static BOOL daObjCatDoor_IsDelete(daObjCatDoor_c* i_this) { + return TRUE; } static int daObjCatDoor_Delete(daObjCatDoor_c* i_this) { diff --git a/src/d/actor/d_a_obj_cb.cpp b/src/d/actor/d_a_obj_cb.cpp index 9744a71b1e..fd96759686 100644 --- a/src/d/actor/d_a_obj_cb.cpp +++ b/src/d/actor/d_a_obj_cb.cpp @@ -174,7 +174,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } if (i_this->home.angle.x == 0) { - i_this->mBgW = new dBgW(); + i_this->mBgW = JKR_NEW dBgW(); if (i_this->mBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_cblock.cpp b/src/d/actor/d_a_obj_cblock.cpp index 870dd108d8..0eb34c08d5 100644 --- a/src/d/actor/d_a_obj_cblock.cpp +++ b/src/d/actor/d_a_obj_cblock.cpp @@ -162,7 +162,7 @@ int daObjCBlk_c::CreateHeap() { if (model1 == NULL) { return 0; } - chains = new chain_s[6]; + chains = JKR_NEW chain_s[6]; if (chains == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_cho.cpp b/src/d/actor/d_a_obj_cho.cpp index 972cf83a89..a6662aa58a 100644 --- a/src/d/actor/d_a_obj_cho.cpp +++ b/src/d/actor/d_a_obj_cho.cpp @@ -55,7 +55,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { int daObjCHO_c::CreateHeap() { J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("I_Cho", 10); - mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("I_Cho", 6), 2, 1.0f, 0, -1, &mCreatureSound, 0, 0x11000284); if (mpMorf == NULL || mpMorf->getModel() == NULL) { @@ -63,7 +63,7 @@ int daObjCHO_c::CreateHeap() { } J3DModel* model = mpMorf->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -79,7 +79,7 @@ int daObjCHO_c::CreateHeap() { } } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_cwall.cpp b/src/d/actor/d_a_obj_cwall.cpp index b7805ef4ac..ac07b447f1 100644 --- a/src/d/actor/d_a_obj_cwall.cpp +++ b/src/d/actor/d_a_obj_cwall.cpp @@ -168,7 +168,7 @@ int daObjCwall_c::CreateHeap() { if (mWallModel == NULL) { return 0; } - mChains = new chain_s[6]; + mChains = JKR_NEW chain_s[6]; if (mChains == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_dan.cpp b/src/d/actor/d_a_obj_dan.cpp index 37067ad236..2303659997 100644 --- a/src/d/actor/d_a_obj_dan.cpp +++ b/src/d/actor/d_a_obj_dan.cpp @@ -56,7 +56,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { int daObjDAN_c::CreateHeap() { J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("I_Dan", 11); - mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, static_cast(dComIfG_getObjectRes("I_Dan", 8)), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, &mCreatureSound, 0, 0x11000284); @@ -65,7 +65,7 @@ int daObjDAN_c::CreateHeap() { } J3DModel* model = mpMorf->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -83,7 +83,7 @@ int daObjDAN_c::CreateHeap() { } } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } @@ -95,7 +95,7 @@ int daObjDAN_c::CreateHeap() { return 0; } } else { - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); J3DAnmTextureSRTKey* tex_anm = static_cast(dComIfG_getObjectRes("I_Dan", 19)); if (!mpBtkAnm->init(model->getModelData(), tex_anm, TRUE, diff --git a/src/d/actor/d_a_obj_dmelevator.cpp b/src/d/actor/d_a_obj_dmelevator.cpp index e37490fbbf..d478fcf88a 100644 --- a/src/d/actor/d_a_obj_dmelevator.cpp +++ b/src/d/actor/d_a_obj_dmelevator.cpp @@ -224,7 +224,7 @@ int daObjDmElevator_c::CreateHeap() { if (mpSwitchModel == NULL) { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW != NULL && mpBgW->Set((cBgD_t*)dComIfG_getObjectRes(l_sw_arcName, 8), 1, &mMtx) == 0) { diff --git a/src/d/actor/d_a_obj_enemy_create.cpp b/src/d/actor/d_a_obj_enemy_create.cpp index c85d1c8f94..d54c35712f 100644 --- a/src/d/actor/d_a_obj_enemy_create.cpp +++ b/src/d/actor/d_a_obj_enemy_create.cpp @@ -135,7 +135,7 @@ int daObjE_CREATE_c::Execute() { int daObjE_CREATE_c::Delete() { if (mActorList != NULL) { - delete[] mActorList; + JKR_DELETE_ARRAY(mActorList); } return 1; @@ -234,7 +234,7 @@ int daObjE_CREATE_c::create() { mActivateSw = fopAcM_GetParam(this) >> 8; mDeactivateSw = fopAcM_GetParam(this) >> 0x10; - mActorList = new u32[mEnemyNum]; + mActorList = JKR_NEW u32[mEnemyNum]; if (mActorList == NULL) { return cPhs_ERROR_e; diff --git a/src/d/actor/d_a_obj_fan.cpp b/src/d/actor/d_a_obj_fan.cpp index 52f864d150..981b429fff 100644 --- a/src/d/actor/d_a_obj_fan.cpp +++ b/src/d/actor/d_a_obj_fan.cpp @@ -124,7 +124,7 @@ int daObjFan_c::CreateHeap() { if (mModel == NULL) { return 0; } - field_0x5ac = new dBgW(); + field_0x5ac = JKR_NEW dBgW(); if (field_0x5ac == NULL || field_0x5ac->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName[field_0xad4], l_dzb3[field_0xad4]), 1, &mBgMtx)) diff --git a/src/d/actor/d_a_obj_fchain.cpp b/src/d/actor/d_a_obj_fchain.cpp index 0dc8a9c300..0b0ff0abbd 100644 --- a/src/d/actor/d_a_obj_fchain.cpp +++ b/src/d/actor/d_a_obj_fchain.cpp @@ -253,9 +253,9 @@ void daObjFchain_shape_c::draw() { J3DModelData* modelData = i_this->getModelData(); J3DMaterial* material = modelData->getMaterialNodePointer(0); dKy_tevstr_c* tevStr = &i_this->tevStr; - j3dSys.setVtxPos(modelData->getVtxPosArray()); - j3dSys.setVtxNrm(modelData->getVtxNrmArray()); - j3dSys.setVtxCol(modelData->getVtxColorArray(0)); + j3dSys.setVtxPos(modelData->getVtxPosArray(), modelData->getVtxNum()); + j3dSys.setVtxNrm(modelData->getVtxNrmArray(), modelData->getNrmNum()); + j3dSys.setVtxCol(modelData->getVtxColorArray(0), modelData->getColNum()); J3DShape::resetVcdVatCache(); material->loadSharedDL(); material->getShape()->loadPreDrawSetting(); diff --git a/src/d/actor/d_a_obj_firepillar2.cpp b/src/d/actor/d_a_obj_firepillar2.cpp index a61b60bf5b..1af70c33c3 100644 --- a/src/d/actor/d_a_obj_firepillar2.cpp +++ b/src/d/actor/d_a_obj_firepillar2.cpp @@ -115,13 +115,13 @@ int daObjFPillar2_c::CreateHeap() { } J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 11); JUT_ASSERT(377, pbtk != NULL); - mBtk = new mDoExt_btkAnm(); + mBtk = JKR_NEW mDoExt_btkAnm(); if (mBtk == NULL || !mBtk->init(modelData, pbtk, 1, 2, 1.0f, 0, -1)) { return 0; } J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 5); JUT_ASSERT(389, pbck != NULL); - mBck = new mDoExt_bckAnm(); + mBck = JKR_NEW mDoExt_bckAnm(); if (mBck == NULL || !mBck->init(pbck, 1, 0, 1.0f, 0, -1, false)) { return 0; } diff --git a/src/d/actor/d_a_obj_fmobj.cpp b/src/d/actor/d_a_obj_fmobj.cpp index e3de14f9b4..061032544d 100644 --- a/src/d/actor/d_a_obj_fmobj.cpp +++ b/src/d/actor/d_a_obj_fmobj.cpp @@ -58,7 +58,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpBgW = new dBgW(); + a_this->mpBgW = JKR_NEW dBgW(); if (a_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_fw.cpp b/src/d/actor/d_a_obj_fw.cpp index 48f11e1c1d..d4717e7706 100644 --- a/src/d/actor/d_a_obj_fw.cpp +++ b/src/d/actor/d_a_obj_fw.cpp @@ -220,7 +220,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { return 0; } - i_this->mpBgW = new dBgW(); + i_this->mpBgW = JKR_NEW dBgW(); if (i_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_ganonwall.cpp b/src/d/actor/d_a_obj_ganonwall.cpp index 71c103bc2c..450e9e6297 100644 --- a/src/d/actor/d_a_obj_ganonwall.cpp +++ b/src/d/actor/d_a_obj_ganonwall.cpp @@ -76,7 +76,7 @@ int daObjGWall_c::CreateHeap() { return 0; } J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 7); - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL || mpBtkAnm->init(model_data, btk, 1, 2, 1.0, 0, -1) == 0) { diff --git a/src/d/actor/d_a_obj_ganonwall2.cpp b/src/d/actor/d_a_obj_ganonwall2.cpp index 2663d8fc6d..bdfd644875 100644 --- a/src/d/actor/d_a_obj_ganonwall2.cpp +++ b/src/d/actor/d_a_obj_ganonwall2.cpp @@ -66,7 +66,7 @@ int daObjGWall2_c::CreateHeap() { return 0; } J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 8); - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL || mpBtkAnm->init(model_data, btk, 1, 2, 1.0f, 0, -1) == 0) { diff --git a/src/d/actor/d_a_obj_gb.cpp b/src/d/actor/d_a_obj_gb.cpp index 94f4da3d3d..df923bf76b 100644 --- a/src/d/actor/d_a_obj_gb.cpp +++ b/src/d/actor/d_a_obj_gb.cpp @@ -135,7 +135,7 @@ static int useHeapInit(fopAc_ac_c* actor) { if (i_this->mModel == NULL) { return 0; } - i_this->mBtk = new mDoExt_btkAnm(); + i_this->mBtk = JKR_NEW mDoExt_btkAnm(); if (i_this->mBtk == NULL) { return 0; } @@ -144,7 +144,7 @@ static int useHeapInit(fopAc_ac_c* actor) { if (i_this->mBtk->init(i_this->mModel->getModelData(), anmTexture, 1, 2, 1.0f, 0, -1) == 0) { return 0; } - i_this->mBrk = new mDoExt_brkAnm(); + i_this->mBrk = JKR_NEW mDoExt_brkAnm(); if (i_this->mBrk== NULL) { return 0; } @@ -157,7 +157,7 @@ static int useHeapInit(fopAc_ac_c* actor) { if (i_this->mBrk->init(i_this->mModel->getModelData(), anmTevKey, 1, 2, 0.0f, 0, -1) == 0) { return 0; } - i_this->mpBgW = new dBgW(); + i_this->mpBgW = JKR_NEW dBgW(); if (i_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_gra2.cpp b/src/d/actor/d_a_obj_gra2.cpp index 7a88390269..3290224ca7 100644 --- a/src/d/actor/d_a_obj_gra2.cpp +++ b/src/d/actor/d_a_obj_gra2.cpp @@ -378,7 +378,7 @@ int daObj_GrA_c::CreateHeap() { aMdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_resNames[l_bmdGetParamList[1]], l_bmdGetParamList[0]); JUT_ASSERT(854, NULL != aMdlData_p); u32 reg_r25 = 0x11020284; - mpModelMorf = new mDoExt_McaMorfSO(aMdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, reg_r25); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(aMdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, reg_r25); if (mpModelMorf != NULL && mpModelMorf->getModel() == NULL) { mpModelMorf->stopZelAnime(); mpModelMorf = NULL; diff --git a/src/d/actor/d_a_obj_hakai_ftr.cpp b/src/d/actor/d_a_obj_hakai_ftr.cpp index 95fcf1acca..c3d0914221 100644 --- a/src/d/actor/d_a_obj_hakai_ftr.cpp +++ b/src/d/actor/d_a_obj_hakai_ftr.cpp @@ -38,7 +38,7 @@ int daObjHFtr_c::createHeap() { return 0; } - field_0x5a4 = new dBgW(); + field_0x5a4 = JKR_NEW dBgW(); if (field_0x5a4 == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_iceblock.cpp b/src/d/actor/d_a_obj_iceblock.cpp index a7f033b34a..3edd81d55d 100644 --- a/src/d/actor/d_a_obj_iceblock.cpp +++ b/src/d/actor/d_a_obj_iceblock.cpp @@ -312,7 +312,7 @@ int daObjIceBlk_c::CreateHeap() { return 0; } - mpIceBgW = new dBgW(); + mpIceBgW = JKR_NEW dBgW(); if (mpIceBgW != NULL && !mpIceBgW->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, 11), dBgW::MOVE_BG_e, &mBgMtx)) { diff --git a/src/d/actor/d_a_obj_iceleaf.cpp b/src/d/actor/d_a_obj_iceleaf.cpp index f146c0da91..873f5058fb 100644 --- a/src/d/actor/d_a_obj_iceleaf.cpp +++ b/src/d/actor/d_a_obj_iceleaf.cpp @@ -157,7 +157,7 @@ int daObjIceLeaf_c::CreateHeap() { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 4); JUT_ASSERT(0x196, pbck != NULL); - mpBck = new mDoExt_bckAnm(); + mpBck = JKR_NEW mDoExt_bckAnm(); if (mpBck == NULL || !mpBck->init(pbck, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false)) { return 0; } diff --git a/src/d/actor/d_a_obj_ihasi.cpp b/src/d/actor/d_a_obj_ihasi.cpp index b5e62fb9d0..f07be7aa9b 100644 --- a/src/d/actor/d_a_obj_ihasi.cpp +++ b/src/d/actor/d_a_obj_ihasi.cpp @@ -118,7 +118,7 @@ static int useHeapInit(fopAc_ac_c* i_actor) { return 0; } - i_this->mpBgW = new dBgW(); + i_this->mpBgW = JKR_NEW dBgW(); if (i_this->mpBgW == NULL) { return 0; } @@ -137,7 +137,7 @@ static int useHeapInit(fopAc_ac_c* i_actor) { return 0; } - i_this->mpBtkAnm = new mDoExt_btkAnm(); + i_this->mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (i_this->mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_kabuto.cpp b/src/d/actor/d_a_obj_kabuto.cpp index 06dca197c5..1012e9eb1c 100644 --- a/src/d/actor/d_a_obj_kabuto.cpp +++ b/src/d/actor/d_a_obj_kabuto.cpp @@ -62,7 +62,7 @@ int daObjKABUTO_c::CreateHeap() { } else { model_data = static_cast(dComIfG_getObjectRes("Kab_m", 11)); } - mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(model_data, NULL, NULL, static_cast(dComIfG_getObjectRes("Kab_m", 7)), 2, 1.5f, 0, -1, &mCreatureSound, 0, 0x11000284); if (mpMorf == NULL || mpMorf->getModel() == NULL) { @@ -70,7 +70,7 @@ int daObjKABUTO_c::CreateHeap() { } J3DModel* model = mpMorf->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -86,7 +86,7 @@ int daObjKABUTO_c::CreateHeap() { } } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_kag.cpp b/src/d/actor/d_a_obj_kag.cpp index 0b6f0dfcc3..49313a7bf5 100644 --- a/src/d/actor/d_a_obj_kag.cpp +++ b/src/d/actor/d_a_obj_kag.cpp @@ -91,14 +91,14 @@ int daObjKAG_c::CreateHeap() { JUT_ASSERT(246, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("I_Kag", BCK_KAG_FLY), 2, 1.0f, 0, -1, &mSound, 0, 0x11000284); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("I_Kag", BCK_KAG_FLY), 2, 1.0f, 0, -1, &mSound, 0, 0x11000284); if (mpModelMorf == NULL || mpModelMorf->getModel() == NULL) { return 0; } J3DModel* model = mpModelMorf->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -107,7 +107,7 @@ int daObjKAG_c::CreateHeap() { return 0; } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_kamakiri.cpp b/src/d/actor/d_a_obj_kamakiri.cpp index 2c3e0363b8..e7fbe844e0 100644 --- a/src/d/actor/d_a_obj_kamakiri.cpp +++ b/src/d/actor/d_a_obj_kamakiri.cpp @@ -65,14 +65,14 @@ int daObjKAM_c::CreateHeap() { modelData = (J3DModelData*)dComIfG_getObjectRes("I_Kam", 10); JUT_ASSERT(0x103, modelData != NULL); } - mpMorfSO = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorfSO = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("I_Kam", 7), 2, 1.0f, 0, -1, &mCreatureSound, 0, 0x11000284); if (mpMorfSO == NULL || mpMorfSO->getModel() == NULL) { return 0; } J3DModel* model = mpMorfSO->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -92,7 +92,7 @@ int daObjKAM_c::CreateHeap() { } } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } @@ -894,8 +894,8 @@ int daObjKAM_c::create() { return loadResult; } -static bool daObjKAM_IsDelete(daObjKAM_c* param_0) { - return true; +static BOOL daObjKAM_IsDelete(daObjKAM_c* param_0) { + return TRUE; } static actor_method_class l_daObjKAM_Method = { diff --git a/src/d/actor/d_a_obj_katatsumuri.cpp b/src/d/actor/d_a_obj_katatsumuri.cpp index 9cb879483d..9b69e2f429 100644 --- a/src/d/actor/d_a_obj_katatsumuri.cpp +++ b/src/d/actor/d_a_obj_katatsumuri.cpp @@ -111,14 +111,14 @@ inline int daObjKAT_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Kat", 9); JUT_ASSERT(0x136, modelData != NULL); mpMorfSO = - new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Kat", 6), + JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Kat", 6), 2, 1.0f, 0, -1, &mCreatureSound, 0, 0x11000284); if (mpMorfSO == NULL || mpMorfSO->getModel() == NULL) { return 0; } J3DModel* model = mpMorfSO->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -137,7 +137,7 @@ inline int daObjKAT_c::CreateHeap() { } } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_kbox.cpp b/src/d/actor/d_a_obj_kbox.cpp index 8f85615ea9..5951a5d4c7 100644 --- a/src/d/actor/d_a_obj_kbox.cpp +++ b/src/d/actor/d_a_obj_kbox.cpp @@ -451,7 +451,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { } a_this->model = i_this->mModel; - i_this->mBgw = new dBgW(); + i_this->mBgw = JKR_NEW dBgW(); if (i_this->mBgw == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_keyhole.cpp b/src/d/actor/d_a_obj_keyhole.cpp index e3562dd4d1..e50106aa00 100644 --- a/src/d/actor/d_a_obj_keyhole.cpp +++ b/src/d/actor/d_a_obj_keyhole.cpp @@ -681,7 +681,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } } } else { - a_this->lock_modelMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes(a_this->arcname, bmd_d[a_this->arg0]), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, NULL, mdl_f[a_this->arg0], 0x11000084); + a_this->lock_modelMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes(a_this->arcname, bmd_d[a_this->arg0]), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, NULL, mdl_f[a_this->arg0], 0x11000084); if (a_this->lock_modelMorf == NULL || a_this->lock_modelMorf->getModel() == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_kgate.cpp b/src/d/actor/d_a_obj_kgate.cpp index 8866ac7a4c..7f2d395f99 100644 --- a/src/d/actor/d_a_obj_kgate.cpp +++ b/src/d/actor/d_a_obj_kgate.cpp @@ -305,7 +305,7 @@ int daObjKGate_c::CreateHeap() { } } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL || mpBgW->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName[mNameArg], l_gateDzbIdx[mNameArg]), cBgW::MOVE_BG_e, &field_0xae8)) diff --git a/src/d/actor/d_a_obj_ki.cpp b/src/d/actor/d_a_obj_ki.cpp index cec0fa740c..95f68c5a3f 100644 --- a/src/d/actor/d_a_obj_ki.cpp +++ b/src/d/actor/d_a_obj_ki.cpp @@ -110,7 +110,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { obj_ki_class* _this = static_cast(i_this); _this->mpMorf = - new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Obj_Ki", ki_bmd[_this->mBmdIdx]), + JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Obj_Ki", ki_bmd[_this->mBmdIdx]), NULL, NULL, NULL, 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (_this->mpMorf == NULL || _this->mpMorf->getModel() == NULL) { return 0; @@ -125,7 +125,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - _this->mpBgW = new dBgW(); + _this->mpBgW = JKR_NEW dBgW(); if (_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_kita.cpp b/src/d/actor/d_a_obj_kita.cpp index cedff61cf8..41ee61bbf7 100644 --- a/src/d/actor/d_a_obj_kita.cpp +++ b/src/d/actor/d_a_obj_kita.cpp @@ -189,7 +189,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { return 0; } - i_this->mKitas[i].mBgW = new dBgW(); + i_this->mKitas[i].mBgW = JKR_NEW dBgW(); if (i_this->mKitas[i].mBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_klift00.cpp b/src/d/actor/d_a_obj_klift00.cpp index c802bc9b6f..151f0b5e96 100644 --- a/src/d/actor/d_a_obj_klift00.cpp +++ b/src/d/actor/d_a_obj_klift00.cpp @@ -110,8 +110,8 @@ static const int l_dzbidx[] = {9}; // force dCcD_Sph::~dCcD_Sph to be emitted earlier than it otherwise would static void dummy() { - delete (dCcD_Sph*)NULL; - delete (dCcD_Cyl*)NULL; + JKR_DELETE((dCcD_Sph*)NULL); + JKR_DELETE((dCcD_Cyl*)NULL); } cPhs_Step daObjKLift00_c::create1st() { @@ -251,14 +251,14 @@ int daObjKLift00_c::CreateHeap() { mpChainBase = NULL; } - mChainPositions = new ChainPos[mNumChains]; + mChainPositions = JKR_NEW ChainPos[mNumChains]; if(!mChainPositions) return 0; mChainModelData = static_cast(dComIfG_getObjectRes(l_arcName, l_bmdidx[1])); JUT_ASSERT(334, mChainModelData != NULL); - mChainMdlObjs = new dMdl_obj_c[mNumChainModels]; + mChainMdlObjs = JKR_NEW dMdl_obj_c[mNumChainModels]; return mChainMdlObjs ? TRUE : FALSE; } diff --git a/src/d/actor/d_a_obj_kshutter.cpp b/src/d/actor/d_a_obj_kshutter.cpp index a484837a78..2923578977 100644 --- a/src/d/actor/d_a_obj_kshutter.cpp +++ b/src/d/actor/d_a_obj_kshutter.cpp @@ -264,7 +264,7 @@ int daObjKshtr_c::CreateHeap() { JUT_ASSERT(446, anm != NULL); - mpBckAnm = new mDoExt_bckAnm(); + mpBckAnm = JKR_NEW mDoExt_bckAnm(); if (mpBckAnm == NULL || mpBckAnm->init(anm, 1, 0, 1.0f, 0, -1, false) == 0) { return 0; } diff --git a/src/d/actor/d_a_obj_kuwagata.cpp b/src/d/actor/d_a_obj_kuwagata.cpp index 69e2b32e56..3a097e7bd7 100644 --- a/src/d/actor/d_a_obj_kuwagata.cpp +++ b/src/d/actor/d_a_obj_kuwagata.cpp @@ -81,14 +81,14 @@ int daObjKUW_c::CreateHeap() { JUT_ASSERT(259, modelData != NULL); } - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("I_Kuw", 7), 2, 1.0f, 0, -1, &mSound, 0, 0x11000284); + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("I_Kuw", 7), 2, 1.0f, 0, -1, &mSound, 0, 0x11000284); if (mpMorf == NULL || mpMorf->getModel() == NULL) { return 0; } J3DModel* model = mpMorf->getModel(); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL) { return 0; } @@ -106,7 +106,7 @@ int daObjKUW_c::CreateHeap() { } } - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_kwheel01.cpp b/src/d/actor/d_a_obj_kwheel01.cpp index f75d7398c4..d6d0b074ab 100644 --- a/src/d/actor/d_a_obj_kwheel01.cpp +++ b/src/d/actor/d_a_obj_kwheel01.cpp @@ -149,7 +149,7 @@ int daObjKWheel01_c::CreateHeap() { if (!CHECK_KLIFT_EXISTS(i)) { mKLiftCollisions[i] = NULL; } else { - mKLiftCollisions[i] = new (dBgW); + mKLiftCollisions[i] = JKR_NEW (dBgW); if (!mKLiftCollisions[i]) { return 0; diff --git a/src/d/actor/d_a_obj_laundry.cpp b/src/d/actor/d_a_obj_laundry.cpp index e5a6923793..54a210cea2 100644 --- a/src/d/actor/d_a_obj_laundry.cpp +++ b/src/d/actor/d_a_obj_laundry.cpp @@ -194,7 +194,7 @@ int daObjLdy_c::createHeap() { J3DAnmTextureSRTKey* key = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, "J_Sentaku.btk"); - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); int initResult = mpBtkAnm->init(modelData, key, 1, 2, 1.0f, 0, -1); if (initResult == 0) { return 0; diff --git a/src/d/actor/d_a_obj_lbox.cpp b/src/d/actor/d_a_obj_lbox.cpp index 2928266677..9dff68dfeb 100644 --- a/src/d/actor/d_a_obj_lbox.cpp +++ b/src/d/actor/d_a_obj_lbox.cpp @@ -120,7 +120,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpBgW = new dBgW(); + a_this->mpBgW = JKR_NEW dBgW(); if (a_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_lv3WaterB.cpp b/src/d/actor/d_a_obj_lv3WaterB.cpp index ab842c6748..763b77034c 100644 --- a/src/d/actor/d_a_obj_lv3WaterB.cpp +++ b/src/d/actor/d_a_obj_lv3WaterB.cpp @@ -129,7 +129,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - actor->mpBWaterBtk = new mDoExt_btkAnm(); + actor->mpBWaterBtk = JKR_NEW mDoExt_btkAnm(); if (actor->mpBWaterBtk == NULL) { return 0; } @@ -141,7 +141,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - actor->mpBWaterBgW = new dBgW(); + actor->mpBWaterBgW = JKR_NEW dBgW(); if (actor->mpBWaterBgW == NULL) { return 0; } @@ -159,7 +159,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - actor->mpOctHibiBgW = new dBgW(); + actor->mpOctHibiBgW = JKR_NEW dBgW(); if (actor->mpOctHibiBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_lv3saka00.cpp b/src/d/actor/d_a_obj_lv3saka00.cpp index 0a32b9739d..b772ba5599 100644 --- a/src/d/actor/d_a_obj_lv3saka00.cpp +++ b/src/d/actor/d_a_obj_lv3saka00.cpp @@ -73,7 +73,7 @@ static int const l_dzbIdx[] = {3, 3}; static int const l_dzbIdx2[] = {4, 4}; int daObjLv3saka_c::CreateHeap() { - mpBgW2 = new dBgW(); + mpBgW2 = JKR_NEW dBgW(); if (mpBgW2 == NULL || mpBgW2->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName[getType()], l_dzbIdx2[getType()]), 1, &mBgMtx)) diff --git a/src/d/actor/d_a_obj_lv4chandelier.cpp b/src/d/actor/d_a_obj_lv4chandelier.cpp index f34da80ddf..e9a2e69e13 100644 --- a/src/d/actor/d_a_obj_lv4chandelier.cpp +++ b/src/d/actor/d_a_obj_lv4chandelier.cpp @@ -213,17 +213,17 @@ int daObjLv4Chan_c::CreateHeap() { return 0; } - mChains[0] = new ChainPos[mChainLengths[0]]; + mChains[0] = JKR_NEW ChainPos[mChainLengths[0]]; if (mChains[0] == NULL) { return 0; } - mChains[1] = new ChainPos[mChainLengths[1]]; + mChains[1] = JKR_NEW ChainPos[mChainLengths[1]]; if (mChains[1] == NULL) { return 0; } - mChains[2] = new ChainPos[mChainLengths[2]]; + mChains[2] = JKR_NEW ChainPos[mChainLengths[2]]; if (mChains[2] == NULL) { return 0; } @@ -231,17 +231,17 @@ int daObjLv4Chan_c::CreateHeap() { mChainModelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, l_bmdidx[1]); JUT_ASSERT(500, mChainModelData != NULL); - mMdls[0] = new dMdl_obj_c[mMdlLengths[0]]; + mMdls[0] = JKR_NEW dMdl_obj_c[mMdlLengths[0]]; if (mMdls[0] == NULL) { return 0; } - mMdls[1] = new dMdl_obj_c[mMdlLengths[1]]; + mMdls[1] = JKR_NEW dMdl_obj_c[mMdlLengths[1]]; if (mMdls[1] == NULL) { return 0; } - mMdls[2] = new dMdl_obj_c[mMdlLengths[2]]; + mMdls[2] = JKR_NEW dMdl_obj_c[mMdlLengths[2]]; if (mMdls[2] == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_lv4sand.cpp b/src/d/actor/d_a_obj_lv4sand.cpp index 6552b64759..7aa0f51a39 100644 --- a/src/d/actor/d_a_obj_lv4sand.cpp +++ b/src/d/actor/d_a_obj_lv4sand.cpp @@ -49,7 +49,7 @@ int daObjLv4Sand_c::CreateHeap() { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 8); JUT_ASSERT(181, pbtk != NULL); - mpBtk = new mDoExt_btkAnm(); + mpBtk = JKR_NEW mDoExt_btkAnm(); if (mpBtk == NULL || !mpBtk->init(modelData, pbtk, TRUE, 2, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_obj_lv6SwGate.cpp b/src/d/actor/d_a_obj_lv6SwGate.cpp index c90472918b..0549e3c9c5 100644 --- a/src/d/actor/d_a_obj_lv6SwGate.cpp +++ b/src/d/actor/d_a_obj_lv6SwGate.cpp @@ -77,7 +77,7 @@ int daLv6SwGate_c::CreateHeap() { if (mModel2 == NULL) { return FALSE; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW != NULL && !mpBgW->Set((cBgD_t*)dComIfG_getObjectRes("L6SwGate", 7), 0x1, &mMtx)) { mpBgW->SetCrrFunc(dBgS_MoveBGProc_TypicalRotY); } else { diff --git a/src/d/actor/d_a_obj_lv6SzGate.cpp b/src/d/actor/d_a_obj_lv6SzGate.cpp index 2ac61affec..269a4f24f6 100644 --- a/src/d/actor/d_a_obj_lv6SzGate.cpp +++ b/src/d/actor/d_a_obj_lv6SzGate.cpp @@ -56,7 +56,7 @@ int daLv6SzGate_c::CreateHeap() { return 0; } - field_0x5e8 = new dBgW(); + field_0x5e8 = JKR_NEW dBgW(); if (field_0x5e8 != NULL && !field_0x5e8->Set(static_cast(dComIfG_getObjectRes("L6SzGate", 15)), 1, &mMtx)) diff --git a/src/d/actor/d_a_obj_lv6Tenbin.cpp b/src/d/actor/d_a_obj_lv6Tenbin.cpp index 0e04c362bf..92e0c7678a 100644 --- a/src/d/actor/d_a_obj_lv6Tenbin.cpp +++ b/src/d/actor/d_a_obj_lv6Tenbin.cpp @@ -88,7 +88,7 @@ int daTenbin_c::CreateHeap() { if (mModel2 == NULL) { return FALSE; } - mdBgW = new dBgW(); + mdBgW = JKR_NEW dBgW(); if (mdBgW != NULL && !mdBgW->Set((cBgD_t*)dComIfG_getObjectRes("L6Tenbin", 8), 1, &field_0x620)) { mdBgW->SetCrrFunc(dBgS_MoveBGProc_Typical); } else { diff --git a/src/d/actor/d_a_obj_lv6bemos.cpp b/src/d/actor/d_a_obj_lv6bemos.cpp index 2945ce8fce..15dea7088d 100644 --- a/src/d/actor/d_a_obj_lv6bemos.cpp +++ b/src/d/actor/d_a_obj_lv6bemos.cpp @@ -179,7 +179,7 @@ int daObjL6Bm_c::CreateHeap() { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, BTK_EF_BIMOBEAM_ON); JUT_ASSERT(648, pbtk != NULL); - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL || mpBtkAnm->init(modelData, pbtk, 1, 0, 1.0f, 0, -1) == 0) { return 0; } @@ -191,14 +191,14 @@ int daObjL6Bm_c::CreateHeap() { pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, BTK_EF_BIMOBEAM); JUT_ASSERT(666, pbtk != NULL); - mpBtkAnm2 = new mDoExt_btkAnm(); + mpBtkAnm2 = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm2 == NULL || mpBtkAnm2->init(modelData, pbtk, 1, 2, 1.0f, 0, -1) == 0) { return 0; } J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, BCK_EF_BIMOBEAM); JUT_ASSERT(678, pbck != NULL); - mBeamBck = new mDoExt_bckAnm(); + mBeamBck = JKR_NEW mDoExt_bckAnm(); if (mBeamBck == NULL || mBeamBck->init(pbck, 1, 2, 1.0f, 0, -1, false) == 0) { return 0; } diff --git a/src/d/actor/d_a_obj_lv6bemos2.cpp b/src/d/actor/d_a_obj_lv6bemos2.cpp index 134c3fa042..f49d31e00d 100644 --- a/src/d/actor/d_a_obj_lv6bemos2.cpp +++ b/src/d/actor/d_a_obj_lv6bemos2.cpp @@ -246,7 +246,7 @@ int daObjLv6Bm_c::CreateHeap() { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, BRK_BM6_SERCH); JUT_ASSERT(633, pbrk != NULL); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || mpBrkAnm->init(modelData, pbrk, 1, 0, 1.0f, 0, -1) == 0) { return 0; } @@ -258,7 +258,7 @@ int daObjLv6Bm_c::CreateHeap() { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, BCK_BM6_UP); JUT_ASSERT(651, pbck != NULL); - mpBckAnm = new mDoExt_bckAnm(); + mpBckAnm = JKR_NEW mDoExt_bckAnm(); if (mpBckAnm == NULL || mpBckAnm->init(pbck, 1, 0, 1.0f, 0, -1, false) == 0) { return 0; } @@ -272,7 +272,7 @@ int daObjLv6Bm_c::CreateHeap() { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, BTK_EF_BIMOL6_OFF); JUT_ASSERT(680, pbtk != NULL); - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL || mpBtkAnm->init(modelData, pbtk, 1, 0, 1.0f, 0, -1) == 0) { return 0; } @@ -285,14 +285,14 @@ int daObjLv6Bm_c::CreateHeap() { pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, BTK_EF_BIMOL6); JUT_ASSERT(699, pbtk != NULL); - mpBtkAnm2 = new mDoExt_btkAnm(); + mpBtkAnm2 = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm2 == NULL || mpBtkAnm2->init(modelData, pbtk, 1, 2, 1.0f, 0, -1) == 0) { return 0; } J3DAnmTransform* pbck2 = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, BCK_EF_BIMOL6); JUT_ASSERT(711, pbck != NULL); - mpBckAnm2 = new mDoExt_bckAnm(); + mpBckAnm2 = JKR_NEW mDoExt_bckAnm(); if (mpBckAnm2 == NULL || mpBckAnm2->init(pbck2, 1, 2, 1.0f, 0, -1, false) == 0) { return 0; } diff --git a/src/d/actor/d_a_obj_lv7bridge.cpp b/src/d/actor/d_a_obj_lv7bridge.cpp index 6d4b35cec5..3e5632dcbd 100644 --- a/src/d/actor/d_a_obj_lv7bridge.cpp +++ b/src/d/actor/d_a_obj_lv7bridge.cpp @@ -196,13 +196,13 @@ int daObjLv7Brg_c::CreateHeap() { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName[mKind], l_bck[i]); JUT_ASSERT(411, pbck != NULL); - mpBck[i] = new mDoExt_bckAnm(); + mpBck[i] = JKR_NEW mDoExt_bckAnm(); if (mpBck[i] == NULL || !mpBck[i]->init(pbck, 1, 0, 1.0f, 0, -1, 0)) { return 0; } } - mpBgw2 = new dBgW(); + mpBgw2 = JKR_NEW dBgW(); if (mpBgw2 != NULL && !mpBgw2->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName[mKind], 0xE), 1, &mBgMtx)) { mpBgw2->SetCrrFunc(dBgS_MoveBGProc_Typical); } else { diff --git a/src/d/actor/d_a_obj_magne_arm.cpp b/src/d/actor/d_a_obj_magne_arm.cpp index 049323dace..f15f6506f9 100644 --- a/src/d/actor/d_a_obj_magne_arm.cpp +++ b/src/d/actor/d_a_obj_magne_arm.cpp @@ -261,7 +261,7 @@ int daObjMarm_c::CreateHeap() { return FALSE; } - mpBgW1 = new dBgW(); + mpBgW1 = JKR_NEW dBgW(); if (mpBgW1 == NULL || mpBgW1->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, 22), cBgW::MOVE_BG_e, &mBgMtx1)) { @@ -287,7 +287,7 @@ int daObjMarm_c::CreateHeap() { } J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 15); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || !mpBrkAnm->init(model_data, pbrk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { @@ -296,7 +296,7 @@ int daObjMarm_c::CreateHeap() { mpBrkAnm->setPlaySpeed(1.0f); J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 18); - mpBtkAnm = new mDoExt_btkAnm(); + mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpBtkAnm == NULL || !mpBtkAnm->init(model_data, pbtk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { @@ -304,7 +304,7 @@ int daObjMarm_c::CreateHeap() { } mpBtkAnm->setPlaySpeed(1.0f); - mpBgW2 = new dBgW(); + mpBgW2 = JKR_NEW dBgW(); if (mpBgW2 == NULL || mpBgW2->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, 23), cBgW::MOVE_BG_e, &mBgMtx3)) { @@ -315,8 +315,8 @@ int daObjMarm_c::CreateHeap() { field_0xA28 = 2; field_0xA29 = 5; - mpRope1 = new mDoExt_3DlineMat1_c(); - mpRope2 = new mDoExt_3DlineMat1_c(); + mpRope1 = JKR_NEW mDoExt_3DlineMat1_c(); + mpRope2 = JKR_NEW mDoExt_3DlineMat1_c(); if (mpRope1 == NULL || mpRope2 == NULL) { return FALSE; } diff --git a/src/d/actor/d_a_obj_maki.cpp b/src/d/actor/d_a_obj_maki.cpp index a36f20c2dd..b1d77887b3 100644 --- a/src/d/actor/d_a_obj_maki.cpp +++ b/src/d/actor/d_a_obj_maki.cpp @@ -156,7 +156,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mBrk = new mDoExt_brkAnm(); + a_this->mBrk = JKR_NEW mDoExt_brkAnm(); if (a_this->mBrk == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_mhole.cpp b/src/d/actor/d_a_obj_mhole.cpp index 7c7a1a15b4..2baf2058b7 100644 --- a/src/d/actor/d_a_obj_mhole.cpp +++ b/src/d/actor/d_a_obj_mhole.cpp @@ -145,7 +145,7 @@ int daObjMHole_c::CreateHeap() { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName[mKind], l_brk[mKind]); JUT_ASSERT(360, pbrk != NULL); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || !mpBrkAnm->init(modelData, pbrk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { @@ -156,7 +156,7 @@ int daObjMHole_c::CreateHeap() { { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName[mKind], l_btk1[mKind]); JUT_ASSERT(375, pbtk != NULL); - mpBtk1Anm = new mDoExt_btkAnm(); + mpBtk1Anm = JKR_NEW mDoExt_btkAnm(); if (mpBtk1Anm == NULL || !mpBtk1Anm->init(modelData, pbtk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { @@ -168,7 +168,7 @@ int daObjMHole_c::CreateHeap() { { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName[mKind], l_btk2[mKind]); JUT_ASSERT(391, pbtk != NULL); - mpBtk2Anm = new mDoExt_btkAnm(); + mpBtk2Anm = JKR_NEW mDoExt_btkAnm(); if (mpBtk2Anm == NULL || !mpBtk2Anm->init(modelData, pbtk, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1)) { diff --git a/src/d/actor/d_a_obj_mirror_6pole.cpp b/src/d/actor/d_a_obj_mirror_6pole.cpp index 91076e19a7..6e679cc1e2 100644 --- a/src/d/actor/d_a_obj_mirror_6pole.cpp +++ b/src/d/actor/d_a_obj_mirror_6pole.cpp @@ -89,7 +89,7 @@ int daObjMirror6Pole_c::CreateHeap() { J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 4); JUT_ASSERT(327, bck != NULL); - mpBck = new mDoExt_bckAnm(); + mpBck = JKR_NEW mDoExt_bckAnm(); f32 speed = isSwitch() ? 1.0f : 0.0f; diff --git a/src/d/actor/d_a_obj_mirror_chain.cpp b/src/d/actor/d_a_obj_mirror_chain.cpp index 47cec7b99f..3787cd954e 100644 --- a/src/d/actor/d_a_obj_mirror_chain.cpp +++ b/src/d/actor/d_a_obj_mirror_chain.cpp @@ -204,7 +204,7 @@ int daObjMirrorChain_c::createHeap() { J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 21); JUT_ASSERT(316, brk != NULL); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || !mpBrkAnm->init(modelData, brk, 1, 2, 1.0f, 0, -1)) { return 0; } @@ -230,7 +230,7 @@ int daObjMirrorChain_c::createHeap() { J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 9); JUT_ASSERT(344, bck != NULL); - mpBckAnm = new mDoExt_bckAnm(); + mpBckAnm = JKR_NEW mDoExt_bckAnm(); if (mpBckAnm == NULL || !mpBckAnm->init(bck, 1, 2, 1.0f, 0, -1, false)) { return 0; } @@ -238,7 +238,7 @@ int daObjMirrorChain_c::createHeap() { J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 20); JUT_ASSERT(353, brk != NULL); - mpPortalBrkAnm = new mDoExt_brkAnm(); + mpPortalBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpPortalBrkAnm == NULL || !mpPortalBrkAnm->init(modelData, brk, 1, 0, 1.0f, 0, -1)) { return 0; @@ -254,7 +254,7 @@ int daObjMirrorChain_c::createHeap() { } else { J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 8); JUT_ASSERT(367, bck != NULL); - mpBckAnm = new mDoExt_bckAnm(); + mpBckAnm = JKR_NEW mDoExt_bckAnm(); /* dSv_event_flag_c::F_0361 - Arbiter's Grounds - Spun the spinning pillars */ f32 rate = (fopAcM_isSwitch(this, getSwitchNo()) || dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[361])) ? 1.0f : 0.0f; @@ -270,7 +270,7 @@ int daObjMirrorChain_c::createHeap() { J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 19); JUT_ASSERT(381, brk != NULL); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || !mpBrkAnm->init(modelData, brk, 1, 0, 0.0f, 0, -1)) { return 0; diff --git a/src/d/actor/d_a_obj_mirror_sand.cpp b/src/d/actor/d_a_obj_mirror_sand.cpp index 112d2f69c0..128708577a 100644 --- a/src/d/actor/d_a_obj_mirror_sand.cpp +++ b/src/d/actor/d_a_obj_mirror_sand.cpp @@ -18,7 +18,7 @@ int daObjMirrorSand_c::createHeap() { } J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 5); - mpBck = new mDoExt_bckAnm(); + mpBck = JKR_NEW mDoExt_bckAnm(); f32 speed; if (isSwitch()) { diff --git a/src/d/actor/d_a_obj_mirror_table.cpp b/src/d/actor/d_a_obj_mirror_table.cpp index 2ccb112a26..341bc4a027 100644 --- a/src/d/actor/d_a_obj_mirror_table.cpp +++ b/src/d/actor/d_a_obj_mirror_table.cpp @@ -45,7 +45,7 @@ int daObjMirrorTable_c::createHeap() { J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 10); JUT_ASSERT(123, bck != NULL); - mpTableUpBckAnm = new mDoExt_bckAnm(); + mpTableUpBckAnm = JKR_NEW mDoExt_bckAnm(); f32 rate = isSwitch() ? 1.0f : 0.0f; if (mpTableUpBckAnm == NULL || !mpTableUpBckAnm->init(bck, 1, 0, rate, 0, -1, false)) { return 0; @@ -85,7 +85,7 @@ int daObjMirrorTable_c::createHeap() { J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 25); JUT_ASSERT(160, brk != NULL); - mpStairBrkAnm = new mDoExt_brkAnm(); + mpStairBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpStairBrkAnm == NULL || !mpStairBrkAnm->init(modelData, brk, 1, 0, 1.0f, 0, -1)) { @@ -106,7 +106,7 @@ int daObjMirrorTable_c::createHeap() { J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 28); JUT_ASSERT(187, btk != NULL); - mpLightBtkAnm = new mDoExt_btkAnm(); + mpLightBtkAnm = JKR_NEW mDoExt_btkAnm(); if (mpLightBtkAnm == NULL || !mpLightBtkAnm->init(modelData, btk, 1, 0, 1.0f, 0, -1)) { @@ -119,7 +119,7 @@ int daObjMirrorTable_c::createHeap() { brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 24); JUT_ASSERT(202, brk != NULL); - mpMSquareBrkAnm = new mDoExt_brkAnm(); + mpMSquareBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpMSquareBrkAnm == NULL || !mpMSquareBrkAnm->init(modelData, brk, 1, 0, 1.0f, 0, -1)) { @@ -128,7 +128,7 @@ int daObjMirrorTable_c::createHeap() { bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 9); JUT_ASSERT(210, bck != NULL); - mpMSquareBckAnm = new mDoExt_bckAnm(); + mpMSquareBckAnm = JKR_NEW mDoExt_bckAnm(); if (mpMSquareBckAnm == NULL || !mpMSquareBckAnm->init(bck, 1, 0, 1.0f, 0, -1, false)) { diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index bd9acf4305..97396cb349 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -1109,7 +1109,7 @@ void daObjMovebox::Act_c::mode_afl() { } static void dummy() { - delete (dBgS_ObjGndChk*)NULL; + JKR_DELETE((dBgS_ObjGndChk*)NULL); } void daObjMovebox::Act_c::mode_proc_call() { diff --git a/src/d/actor/d_a_obj_msima.cpp b/src/d/actor/d_a_obj_msima.cpp index d6ffe7692a..5b5b6dbbac 100644 --- a/src/d/actor/d_a_obj_msima.cpp +++ b/src/d/actor/d_a_obj_msima.cpp @@ -379,7 +379,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { return 0; } - i_this->mpBgW = new dBgW(); + i_this->mpBgW = JKR_NEW dBgW(); if (i_this->mpBgW == NULL) { return 0; } @@ -392,7 +392,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { i_this->mpBgW->SetCrrFunc(dBgS_MoveBGProc_Typical); i_this->mpBgW->SetRideCallback(ride_call_back); - i_this->mpBtk = new mDoExt_btkAnm(); + i_this->mpBtk = JKR_NEW mDoExt_btkAnm(); if (i_this->mpBtk == NULL) { return 0; } @@ -401,7 +401,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { return 0; } - i_this->mpBrk = new mDoExt_brkAnm(); + i_this->mpBrk = JKR_NEW mDoExt_brkAnm(); if (i_this->mpBrk == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_myogan.cpp b/src/d/actor/d_a_obj_myogan.cpp index 2c7e7ee191..dfdab85bb1 100644 --- a/src/d/actor/d_a_obj_myogan.cpp +++ b/src/d/actor/d_a_obj_myogan.cpp @@ -90,7 +90,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpBrk = new mDoExt_brkAnm(); + a_this->mpBrk = JKR_NEW mDoExt_brkAnm(); if (a_this->mpBrk == NULL) { return 0; } @@ -102,7 +102,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpBtk = new mDoExt_btkAnm(); + a_this->mpBtk = JKR_NEW mDoExt_btkAnm(); if (a_this->mpBtk == NULL) { return 0; } @@ -114,7 +114,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpBgW = new dBgW(); + a_this->mpBgW = JKR_NEW dBgW(); if (a_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_nagaisu.cpp b/src/d/actor/d_a_obj_nagaisu.cpp index 0537544cf5..e2153b4bd8 100644 --- a/src/d/actor/d_a_obj_nagaisu.cpp +++ b/src/d/actor/d_a_obj_nagaisu.cpp @@ -197,7 +197,7 @@ daObjIsuChild_c::daObjIsuChild_c() { daObjIsuChild_c::~daObjIsuChild_c() {} int daObjIsuChild_c::createHeap() { - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_nan.cpp b/src/d/actor/d_a_obj_nan.cpp index 26e2ede5f1..4666850fbe 100644 --- a/src/d/actor/d_a_obj_nan.cpp +++ b/src/d/actor/d_a_obj_nan.cpp @@ -62,14 +62,14 @@ static int const l_nan_btk_index[2] = { inline int daObjNAN_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("I_Nan", 9); JUT_ASSERT(254, modelData != NULL); - mMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("I_Nan", 6), 2, 1.0f, 0, -1, &mCreatureSound, 0, 0x11000284); if (mMorf == NULL || mMorf->getModel() == NULL) { return 0; } J3DModel* model = mMorf->getModel(); - mBrk = new mDoExt_brkAnm(); + mBrk = JKR_NEW mDoExt_brkAnm(); if (mBrk == NULL) { return 0; } @@ -78,7 +78,7 @@ inline int daObjNAN_c::CreateHeap() { if (mBrk->init(model->getModelData(), anmRegKey, 1, 2, 1.0f, 0, -1) == 0) { return 0; } - mBtk = new mDoExt_btkAnm(); + mBtk = JKR_NEW mDoExt_btkAnm(); if (mBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_octhashi.cpp b/src/d/actor/d_a_obj_octhashi.cpp index 7dc32dbb15..592f2bcb9f 100644 --- a/src/d/actor/d_a_obj_octhashi.cpp +++ b/src/d/actor/d_a_obj_octhashi.cpp @@ -341,7 +341,7 @@ static int daObjOCTHASHI_IsDelete(daObjOCTHASHI_c* param_0) { } static void dummy() { - delete (cCcD_GStts*)NULL; + JKR_DELETE((cCcD_GStts*)NULL); } int daObjOCTHASHI_c::Create() { diff --git a/src/d/actor/d_a_obj_onsen.cpp b/src/d/actor/d_a_obj_onsen.cpp index ac339bb52f..891cd048cf 100644 --- a/src/d/actor/d_a_obj_onsen.cpp +++ b/src/d/actor/d_a_obj_onsen.cpp @@ -59,7 +59,7 @@ int daObjOnsen_c::CreateHeap() { J3DAnmTextureSRTKey* srtKey = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName[mType], l_btk[mType]); - mpBtk = new mDoExt_btkAnm(); + mpBtk = JKR_NEW mDoExt_btkAnm(); if (!mpBtk || !mpBtk->init(modelData, srtKey, 1, 2, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_obj_ornament_cloth.cpp b/src/d/actor/d_a_obj_ornament_cloth.cpp index 9218105670..64e45d1d1a 100644 --- a/src/d/actor/d_a_obj_ornament_cloth.cpp +++ b/src/d/actor/d_a_obj_ornament_cloth.cpp @@ -218,7 +218,7 @@ int daObjOnCloth_c::createHeap() { JUT_ASSERT(420, pbtk != NULL); - mBtkAnm = new mDoExt_btkAnm(); + mBtkAnm = JKR_NEW mDoExt_btkAnm(); JUT_ASSERT(424, mBtkAnm); diff --git a/src/d/actor/d_a_obj_pdwall.cpp b/src/d/actor/d_a_obj_pdwall.cpp index 444b1e0f1d..22f42602c6 100644 --- a/src/d/actor/d_a_obj_pdwall.cpp +++ b/src/d/actor/d_a_obj_pdwall.cpp @@ -67,7 +67,7 @@ int daObjPDwall_c::CreateHeap() { } for (int i = 0; i < 9; i++) { - mpBgw[i] = new dBgW(); + mpBgw[i] = JKR_NEW dBgW(); if (mpBgw[i] == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_picture.cpp b/src/d/actor/d_a_obj_picture.cpp index 12d8f54e3c..a35c7aec0b 100644 --- a/src/d/actor/d_a_obj_picture.cpp +++ b/src/d/actor/d_a_obj_picture.cpp @@ -61,7 +61,7 @@ int daObjPicture_c::createHeap() { break; } - mpBgw[i] = new dBgW(); + mpBgw[i] = JKR_NEW dBgW(); if (mpBgw[i] == NULL) { return 0; } @@ -98,7 +98,7 @@ int daObjPicture_c::createHeap() { } for (int i = 0; i < 2; i++) { - mpRopeMat[i] = new mDoExt_3DlineMat1_c(); + mpRopeMat[i] = JKR_NEW mDoExt_3DlineMat1_c(); if (mpRopeMat[i] == NULL) { OS_REPORT_ERROR("止め具ロープ:3Dラインマテリアルクラス生成失敗\n"); return 0; diff --git a/src/d/actor/d_a_obj_poTbox.cpp b/src/d/actor/d_a_obj_poTbox.cpp index 74a4f89de3..f660e6114e 100644 --- a/src/d/actor/d_a_obj_poTbox.cpp +++ b/src/d/actor/d_a_obj_poTbox.cpp @@ -90,7 +90,7 @@ int daPoTbox_c::CreateHeap() { res = mBrk.init(modelData2, (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_type[mStat], 0xF), 1, 0, 1.0f, 0, -1); JUT_ASSERT(244, res == TRUE); - mpBgw2 = new dBgW(); + mpBgw2 = JKR_NEW dBgW(); if (mpBgw2 == NULL || mpBgw2->Set((cBgD_t*)dComIfG_getObjectRes(l_type[mStat], 0x16), 1, &mBgMtx)) { mpBgw2 = NULL; return 0; diff --git a/src/d/actor/d_a_obj_rgate.cpp b/src/d/actor/d_a_obj_rgate.cpp index 024b545284..13d2b8c54b 100644 --- a/src/d/actor/d_a_obj_rgate.cpp +++ b/src/d/actor/d_a_obj_rgate.cpp @@ -290,7 +290,7 @@ int daObjRgate_c::CreateHeap() { } } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL || mpBgW->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, 10), cBgW::MOVE_BG_e, &field_0xae4)) { diff --git a/src/d/actor/d_a_obj_rock.cpp b/src/d/actor/d_a_obj_rock.cpp index 2494a2f534..997d160466 100644 --- a/src/d/actor/d_a_obj_rock.cpp +++ b/src/d/actor/d_a_obj_rock.cpp @@ -50,8 +50,8 @@ static int daObj_Rock_Execute(obj_rock_class* i_this) { return TRUE; } -static bool daObj_Rock_IsDelete(obj_rock_class* i_this) { - return true; +static BOOL daObj_Rock_IsDelete(obj_rock_class* i_this) { + return TRUE; } static int daObj_Rock_Delete(obj_rock_class* i_this) { diff --git a/src/d/actor/d_a_obj_rope_bridge.cpp b/src/d/actor/d_a_obj_rope_bridge.cpp index 402ca74b46..0810712c4e 100644 --- a/src/d/actor/d_a_obj_rope_bridge.cpp +++ b/src/d/actor/d_a_obj_rope_bridge.cpp @@ -360,13 +360,13 @@ int daObjRBridge_c::CreateHeap() { if (!fopAcM_isSwitch(this, getSwbit2()) && !fopAcM_isSwitch(this, getSwbit())) { mRopeSegmentNum = 10; - field_0xb04 = new cXyz[mRopeSegmentNum]; + field_0xb04 = JKR_NEW cXyz[mRopeSegmentNum]; if (field_0xb04 == NULL) { return 0; } for (int i = 0; i < 2; i++) { - mpLineMat[i] = new mDoExt_3DlineMat1_c(); + mpLineMat[i] = JKR_NEW mDoExt_3DlineMat1_c(); if (mpLineMat[i] == NULL) { // "Rope Stop: 3D line material class creation failure" OS_REPORT_ERROR("止め具ロープ:3Dラインマテリアルクラス生成失敗\n"); diff --git a/src/d/actor/d_a_obj_rotBridge.cpp b/src/d/actor/d_a_obj_rotBridge.cpp index bee843be0f..bb9ce07e06 100644 --- a/src/d/actor/d_a_obj_rotBridge.cpp +++ b/src/d/actor/d_a_obj_rotBridge.cpp @@ -78,7 +78,7 @@ int daRotBridge_c::CreateHeap() { u8 temp_r25 = (fopAcM_GetParam(this) & 0xF000) >> 0xC; if (mType == 1 && temp_r25 != 15) { - mpBgW2 = new dBgW(); + mpBgW2 = JKR_NEW dBgW(); if (mpBgW2 == NULL || mpBgW2->Set((cBgD_t*)dComIfG_getObjectRes(l_resNameIdx[mType], 0xB), 1, &mMtx)) { mpBgW2 = NULL; return 0; diff --git a/src/d/actor/d_a_obj_rotTrap.cpp b/src/d/actor/d_a_obj_rotTrap.cpp index 72f7217102..452ff01684 100644 --- a/src/d/actor/d_a_obj_rotTrap.cpp +++ b/src/d/actor/d_a_obj_rotTrap.cpp @@ -85,7 +85,7 @@ int daRotTrap_c::CreateHeap() { return 0; } - mpBgW2 = new dBgW(); + mpBgW2 = JKR_NEW dBgW(); if (mpBgW2 == NULL || mpBgW2->Set((cBgD_t*)dComIfG_getObjectRes("P_kama", 8), 1, &mBgMtx)) { mpBgW2 = NULL; return 0; diff --git a/src/d/actor/d_a_obj_rstair.cpp b/src/d/actor/d_a_obj_rstair.cpp index 32112c3135..802697e8d0 100644 --- a/src/d/actor/d_a_obj_rstair.cpp +++ b/src/d/actor/d_a_obj_rstair.cpp @@ -92,12 +92,12 @@ int daObjRotStair_c::CreateHeap() { } J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, l_wtr_btk[i]); JUT_ASSERT(245, pbtk != NULL); - mBtks[i] = new mDoExt_btkAnm(); + mBtks[i] = JKR_NEW mDoExt_btkAnm(); if (mBtks[i] == NULL || mBtks[i]->init(modelData, pbtk, 1, 2, 1.0f, 0, -1) == 0) { return 0; } } - mWaterBgw = new dBgW(); + mWaterBgw = JKR_NEW dBgW(); if (mWaterBgw == NULL || mWaterBgw->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, 0xf), 1, &mBgMtx) != 0) { mWaterBgw = NULL; return 0; diff --git a/src/d/actor/d_a_obj_sakuita_rope.cpp b/src/d/actor/d_a_obj_sakuita_rope.cpp index d0fbc480af..c55e56f274 100644 --- a/src/d/actor/d_a_obj_sakuita_rope.cpp +++ b/src/d/actor/d_a_obj_sakuita_rope.cpp @@ -144,8 +144,8 @@ inline daObjItaRope_c::~daObjItaRope_c() { #if DEBUG M_hio.dt(); #endif - delete [] mRopes; - delete [] mSakuitas; + JKR_DELETE_ARRAY(mRopes); + JKR_DELETE_ARRAY(mSakuitas); if (field_0x636 != 0) { J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes(l_arcName, "A_Sakuita.bmd"); @@ -267,13 +267,13 @@ void daObjItaRope_c::setNormalRopePos() { inline int daObjItaRope_c::createHeap() { mRopes = NULL; - mRopes = new RopeWork_c[field_0x635 - 2]; + mRopes = JKR_NEW RopeWork_c[field_0x635 - 2]; if (mRopes == NULL) { return 0; } mSakuitas = NULL; - mSakuitas = new Sakuita_c[field_0x635 - 2]; + mSakuitas = JKR_NEW Sakuita_c[field_0x635 - 2]; if (mSakuitas == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_scannon.cpp b/src/d/actor/d_a_obj_scannon.cpp index 3dcc1837de..0a910358fe 100644 --- a/src/d/actor/d_a_obj_scannon.cpp +++ b/src/d/actor/d_a_obj_scannon.cpp @@ -310,7 +310,7 @@ int daSCannon_c::createHeap() { if (mIsPortal != 0) { J3DAnmTextureSRTKey* a_btk_p = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName_Crash, 9); JUT_ASSERT(606, a_btk_p != NULL); - mpCrashBtk = new mDoExt_btkAnm(); + mpCrashBtk = JKR_NEW mDoExt_btkAnm(); if (mpCrashBtk == NULL || !mpCrashBtk->init(a_model_data_p, a_btk_p, 1, 0, 0.0f, 0, -1)) { return 0; } @@ -324,14 +324,14 @@ int daSCannon_c::createHeap() { a_btk_p = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName_Ptl, 0xC); JUT_ASSERT(642, a_btk_p != NULL); - mpPtlBtk = new mDoExt_btkAnm(); + mpPtlBtk = JKR_NEW mDoExt_btkAnm(); if (mpPtlBtk == NULL || !mpPtlBtk->init(a_ptl_model_data_p, a_btk_p, 1, 2, 0.0f, 0, -1)) { return 0; } } } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_scannon_crs.cpp b/src/d/actor/d_a_obj_scannon_crs.cpp index e911437d42..6a593edd1a 100644 --- a/src/d/actor/d_a_obj_scannon_crs.cpp +++ b/src/d/actor/d_a_obj_scannon_crs.cpp @@ -411,7 +411,7 @@ int daSCannonCrs_c::createHeap() { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_scannon_ten.cpp b/src/d/actor/d_a_obj_scannon_ten.cpp index e425d3b490..b804951698 100644 --- a/src/d/actor/d_a_obj_scannon_ten.cpp +++ b/src/d/actor/d_a_obj_scannon_ten.cpp @@ -56,7 +56,7 @@ int daObjSCannonTen_c::createHeap() { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_sekizoa.cpp b/src/d/actor/d_a_obj_sekizoa.cpp index b29714116e..a94531ecf5 100644 --- a/src/d/actor/d_a_obj_sekizoa.cpp +++ b/src/d/actor/d_a_obj_sekizoa.cpp @@ -247,7 +247,7 @@ int daObj_Sekizoa_c::CreateHeap() { if (modelData == NULL) { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11000284); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { @@ -259,7 +259,7 @@ int daObj_Sekizoa_c::CreateHeap() { return 0; } - mpMorf[1] = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, + mpMorf[1] = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11000284); if (mpMorf[1] == NULL || mpMorf[1]->getModel() == NULL) { return 0; @@ -294,7 +294,7 @@ int daObj_Sekizoa_c::CreateHeap() { if (modelData == NULL) { return 0; } - mpMcaMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, + mpMcaMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, -1, 1.0f, 0, -1, NULL, 0x80000, 0x11000284); if (mpMcaMorf == NULL || mpMcaMorf->getModel() == NULL) { return 0; diff --git a/src/d/actor/d_a_obj_smw_stone.cpp b/src/d/actor/d_a_obj_smw_stone.cpp index 1eab4fb32c..3db70885a5 100644 --- a/src/d/actor/d_a_obj_smw_stone.cpp +++ b/src/d/actor/d_a_obj_smw_stone.cpp @@ -130,7 +130,7 @@ int daSmWStone_c::createHeap() { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_so.cpp b/src/d/actor/d_a_obj_so.cpp index d3e4112784..37c95200bd 100644 --- a/src/d/actor/d_a_obj_so.cpp +++ b/src/d/actor/d_a_obj_so.cpp @@ -938,7 +938,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { } for (int i = 0; i < 2; i++) { - i_this->mBgW[i] = new dBgW(); + i_this->mBgW[i] = JKR_NEW dBgW(); if (i_this->mBgW[i] == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_ss_drink.cpp b/src/d/actor/d_a_obj_ss_drink.cpp index bc9deedc78..3df4d49b18 100644 --- a/src/d/actor/d_a_obj_ss_drink.cpp +++ b/src/d/actor/d_a_obj_ss_drink.cpp @@ -64,14 +64,14 @@ int daObj_SSDrink_c::CreateHeap() { pbtp = (J3DAnmTexPattern*)dComIfG_getObjectRes(l_resFileName, "al_bottle.btp"); JUT_ASSERT(230, pbtp != NULL); - mpBtpAnm = new mDoExt_btpAnm(); + mpBtpAnm = JKR_NEW mDoExt_btpAnm(); if (mpBtpAnm == NULL || !mpBtpAnm->init(mdlData_p, pbtp, 1, 2, 1.0f, 0, -1)) { return 0; } pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_resFileName, "al_bottle.brk"); JUT_ASSERT(242, pbrk != NULL); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || !mpBrkAnm->init(mdlData_p, pbrk, 1, 2, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_obj_stick.cpp b/src/d/actor/d_a_obj_stick.cpp index 2569f2f4b9..c393ce61d2 100644 --- a/src/d/actor/d_a_obj_stick.cpp +++ b/src/d/actor/d_a_obj_stick.cpp @@ -214,8 +214,8 @@ static void daObj_Stick_Draw(void* param_0) { static_cast(param_0)->Draw(); } -static bool daObj_Stick_IsDelete(void* param_0) { - return true; +static BOOL daObj_Stick_IsDelete(void* param_0) { + return TRUE; } static actor_method_class daObj_Stick_MethodTable = { diff --git a/src/d/actor/d_a_obj_sw.cpp b/src/d/actor/d_a_obj_sw.cpp index 1aa49a13b1..73c13d1db3 100644 --- a/src/d/actor/d_a_obj_sw.cpp +++ b/src/d/actor/d_a_obj_sw.cpp @@ -661,7 +661,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { if (i_this->field_0x570 == 8) { for (int i = 0; i < 8; i++) { i_this->field_0x5a8[i].mpModelMorf = - new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Npc_ksw", 17), NULL, NULL, + JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Npc_ksw", 17), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Npc_ksw", 13), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); diff --git a/src/d/actor/d_a_obj_swBallA.cpp b/src/d/actor/d_a_obj_swBallA.cpp index ffed7cbaa2..af9237be3c 100644 --- a/src/d/actor/d_a_obj_swBallA.cpp +++ b/src/d/actor/d_a_obj_swBallA.cpp @@ -139,7 +139,7 @@ int daObjSwBallA_c::CreateHeap() { } J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 7); JUT_ASSERT(381, pbtk != NULL); - field_0x588 = new mDoExt_btkAnm(); + field_0x588 = JKR_NEW mDoExt_btkAnm(); if (field_0x588 == NULL || field_0x588->init(modelData, pbtk, 1, 0, 1.0f, 0, -1) == 0) { return 0; } diff --git a/src/d/actor/d_a_obj_swBallB.cpp b/src/d/actor/d_a_obj_swBallB.cpp index 94c837e986..7b53115c02 100644 --- a/src/d/actor/d_a_obj_swBallB.cpp +++ b/src/d/actor/d_a_obj_swBallB.cpp @@ -167,7 +167,7 @@ int daObjSwBallB_c::CreateHeap() { } J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 9); JUT_ASSERT(441, pbtk != NULL); - field_0x588 = new mDoExt_btkAnm(); + field_0x588 = JKR_NEW mDoExt_btkAnm(); if (field_0x588 == NULL || field_0x588->init(modelData, pbtk, 1, 0, 1.0f, 0, -1) == 0) { return 0; } diff --git a/src/d/actor/d_a_obj_swBallC.cpp b/src/d/actor/d_a_obj_swBallC.cpp index 7461739c8e..e4ceb8e3ee 100644 --- a/src/d/actor/d_a_obj_swBallC.cpp +++ b/src/d/actor/d_a_obj_swBallC.cpp @@ -104,7 +104,7 @@ int daObjSwBallC_c::CreateHeap() { } J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 10); JUT_ASSERT(441, pbtk != NULL); - field_0x574 = new mDoExt_btkAnm(); + field_0x574 = JKR_NEW mDoExt_btkAnm(); if (field_0x574 == NULL || field_0x574->init(modelData, pbtk, 1, 0, 1.0f, 0, -1) == 0) { return 0; } diff --git a/src/d/actor/d_a_obj_swchain.cpp b/src/d/actor/d_a_obj_swchain.cpp index 3938dc5761..70ce64e101 100644 --- a/src/d/actor/d_a_obj_swchain.cpp +++ b/src/d/actor/d_a_obj_swchain.cpp @@ -197,7 +197,7 @@ int daObjSwChain_c::Create() { } int daObjSwChain_c::CreateHeap() { - mChains = new chain_s[mChainNum + 1]; + mChains = JKR_NEW chain_s[mChainNum + 1]; if (mChains == NULL) { return 0; diff --git a/src/d/actor/d_a_obj_swhang.cpp b/src/d/actor/d_a_obj_swhang.cpp index d6834c3704..00acbfd056 100644 --- a/src/d/actor/d_a_obj_swhang.cpp +++ b/src/d/actor/d_a_obj_swhang.cpp @@ -162,7 +162,7 @@ int daObjSwHang_c::CreateHeap() { if (mpModel == NULL) { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL || mpBgW->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName[mType], l_dzbIdx[mType]), 1, &field_0x738) != 0) @@ -490,7 +490,7 @@ static int daObjSwHang_MoveBGDraw(daObjSwHang_c* i_this) { static void dummy() { ((dEvLib_callback_c*)NULL)->eventStart(); - delete (cCcD_GStts*)NULL; + JKR_DELETE((cCcD_GStts*)NULL); } static actor_method_class daObjSwHang_METHODS = { diff --git a/src/d/actor/d_a_obj_swpush.cpp b/src/d/actor/d_a_obj_swpush.cpp index 5b8f23d3b6..a74fad8287 100644 --- a/src/d/actor/d_a_obj_swpush.cpp +++ b/src/d/actor/d_a_obj_swpush.cpp @@ -92,7 +92,7 @@ bool daObjSwpush::Act_c::create_heap() { JUT_ASSERT(569, bg_data != NULL); bool bVar2 = false; - mpBgW = new dBgWSv(); + mpBgW = JKR_NEW dBgWSv(); if (mpBgW != NULL && mpBgW->Set(bg_data, 0) == 0) { bVar2 = true; } diff --git a/src/d/actor/d_a_obj_swpush2.cpp b/src/d/actor/d_a_obj_swpush2.cpp index 58a3286517..e97638bbaa 100644 --- a/src/d/actor/d_a_obj_swpush2.cpp +++ b/src/d/actor/d_a_obj_swpush2.cpp @@ -160,7 +160,7 @@ bool daObjSwpush2::Act_c::create_heap() { { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(getArcName(), getNmlBrkName()); JUT_ASSERT(452, pbrk != NULL); - mpNmlBrk = new mDoExt_brkAnm(); + mpNmlBrk = JKR_NEW mDoExt_brkAnm(); if (mpNmlBrk == NULL || !mpNmlBrk->init((J3DModelData*)model_data, pbrk, 1, 2, 1.0f, 0, -1)) { return 0; } @@ -172,7 +172,7 @@ bool daObjSwpush2::Act_c::create_heap() { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(getArcName(), getNmlBtkName()); JUT_ASSERT(465, pbtk != NULL); - mpNmlBtk = new mDoExt_btkAnm(); + mpNmlBtk = JKR_NEW mDoExt_btkAnm(); if (mpNmlBtk == NULL || !mpNmlBtk->init((J3DModelData*)model_data, pbtk, 1, 2, 1.0f, 0, -1)) { return 0; } @@ -183,7 +183,7 @@ bool daObjSwpush2::Act_c::create_heap() { { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(getArcName(), getOnBtkName()); JUT_ASSERT(478, pbtk != NULL); - mpOnBtk = new mDoExt_btkAnm(); + mpOnBtk = JKR_NEW mDoExt_btkAnm(); if (mpOnBtk == NULL || !mpOnBtk->init((J3DModelData*)model_data, pbtk, 1, 0, 1.0f, 0, -1)) { return 0; } @@ -194,7 +194,7 @@ bool daObjSwpush2::Act_c::create_heap() { { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(getArcName(), getRunBtkName()); JUT_ASSERT(491, pbtk != NULL); - mpRunBtk = new mDoExt_btkAnm(); + mpRunBtk = JKR_NEW mDoExt_btkAnm(); if (mpRunBtk == NULL || !mpRunBtk->init((J3DModelData*)model_data, pbtk, 1, 0, 1.0f, 0, -1)) { return 0; } @@ -205,7 +205,7 @@ bool daObjSwpush2::Act_c::create_heap() { { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(getArcName(), getRunBrkName()); JUT_ASSERT(504, pbrk != NULL); - mpRunBrk = new mDoExt_brkAnm(); + mpRunBrk = JKR_NEW mDoExt_brkAnm(); if (mpRunBrk == NULL || !mpRunBrk->init((J3DModelData*)model_data, pbrk, 1, 0, 1.0f, 0, -1)) { return 0; } @@ -216,7 +216,7 @@ bool daObjSwpush2::Act_c::create_heap() { { J3DAnmColor* pbpk = (J3DAnmColor*)dComIfG_getObjectRes(getArcName(), getRunBpkName()); JUT_ASSERT(517, pbpk != NULL); - mpRunBpk = new mDoExt_bpkAnm(); + mpRunBpk = JKR_NEW mDoExt_bpkAnm(); if (mpRunBpk == NULL || !mpRunBpk->init((J3DModelData*)model_data, pbpk, 1, 0, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_obj_swpush5.cpp b/src/d/actor/d_a_obj_swpush5.cpp index b3b5fad08f..6374368885 100644 --- a/src/d/actor/d_a_obj_swpush5.cpp +++ b/src/d/actor/d_a_obj_swpush5.cpp @@ -123,7 +123,7 @@ int daObjSw5_c::CreateHeap() { return 0; } - mpBgW2 = new dBgW(); + mpBgW2 = JKR_NEW dBgW(); if (mpBgW2 == NULL || mpBgW2->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, l_dzbIdx[0]), 1, &mMtx)) { mpBgW2 = NULL; return 0; diff --git a/src/d/actor/d_a_obj_swspinner.cpp b/src/d/actor/d_a_obj_swspinner.cpp index bb72938ba9..964f9a7376 100644 --- a/src/d/actor/d_a_obj_swspinner.cpp +++ b/src/d/actor/d_a_obj_swspinner.cpp @@ -87,7 +87,7 @@ int daObjSwSpinner_c::CreateHeap() { return 0; } - mpBgW2 = new dBgW(); + mpBgW2 = JKR_NEW dBgW(); if (mpBgW2 == NULL || mpBgW2->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, 8), 1, &mMtx)) { mpBgW2 = NULL; return 0; diff --git a/src/d/actor/d_a_obj_syRock.cpp b/src/d/actor/d_a_obj_syRock.cpp index 296ebc42d1..5432f01d6c 100644 --- a/src/d/actor/d_a_obj_syRock.cpp +++ b/src/d/actor/d_a_obj_syRock.cpp @@ -141,7 +141,7 @@ int daSyRock_c::CreateHeap() { return 0; } - mpBrokenCollision = new dBgW; + mpBrokenCollision = JKR_NEW dBgW; if (!mpBrokenCollision || mpBrokenCollision->Set(static_cast(dComIfG_getObjectRes("syourock", 9)), 1, &mBgMtx)) { mpBrokenCollision = NULL; diff --git a/src/d/actor/d_a_obj_takaraDai.cpp b/src/d/actor/d_a_obj_takaraDai.cpp index e8a1e919f2..58e2ca31fe 100644 --- a/src/d/actor/d_a_obj_takaraDai.cpp +++ b/src/d/actor/d_a_obj_takaraDai.cpp @@ -59,7 +59,7 @@ int daTkraDai_c::CreateHeap() { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW != NULL && !mpBgW->Set((cBgD_t*)dComIfG_getObjectRes("M_TakaraD", 9), 1, &field_0x62c)) { diff --git a/src/d/actor/d_a_obj_ten.cpp b/src/d/actor/d_a_obj_ten.cpp index 05f9c59e24..be3bb229b5 100644 --- a/src/d/actor/d_a_obj_ten.cpp +++ b/src/d/actor/d_a_obj_ten.cpp @@ -58,13 +58,13 @@ static int useHeapInit(fopAc_ac_c* actor) { daObjTEN_c* i_this = static_cast(actor); J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("I_Ten", 10); JUT_ASSERT(246, modelData != NULL); - i_this->mMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, 2, 1.0f, 0, -1, + i_this->mMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, NULL, 2, 1.0f, 0, -1, &i_this->mCreature, 0, 0x11000284); if (i_this->mMorf == NULL || i_this->mMorf->getModel() == NULL) { return 0; } J3DModel* model = i_this->mMorf->getModel(); - i_this->mBrk = new mDoExt_brkAnm(); + i_this->mBrk = JKR_NEW mDoExt_brkAnm(); if (i_this->mBrk == NULL) { return 0; } @@ -80,7 +80,7 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } } - i_this->mBtk = new mDoExt_btkAnm(); + i_this->mBtk = JKR_NEW mDoExt_btkAnm(); if (i_this->mBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_thashi.cpp b/src/d/actor/d_a_obj_thashi.cpp index 0d0e8495a5..9d1d899677 100644 --- a/src/d/actor/d_a_obj_thashi.cpp +++ b/src/d/actor/d_a_obj_thashi.cpp @@ -102,8 +102,8 @@ static int daObjTHASHI_Delete(daObjTHASHI_c* i_this) { // stripped function to move dtor weak ordering static void strippedFunc3(cXyz* a, csXyz* b) { - delete[] b; - delete[] a; + JKR_DELETE_ARRAY(b); + JKR_DELETE_ARRAY(a); } void daObjTHASHI_c::setBaseMtx() { @@ -194,7 +194,7 @@ int daObjTHASHI_c::CreateHeap() { return FALSE; } u32 ind = dComIfG_getObjctResName2Index(l_arcName, "S_thashi01.dzb"); - unk5A0 = new dBgW(); + unk5A0 = JKR_NEW dBgW(); if (unk5A0 != NULL && !unk5A0->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, ind), 1, &mBgMtx)) { if (m_set_func != NULL) { diff --git a/src/d/actor/d_a_obj_tks.cpp b/src/d/actor/d_a_obj_tks.cpp index f769340976..f2a25ecc72 100644 --- a/src/d/actor/d_a_obj_tks.cpp +++ b/src/d/actor/d_a_obj_tks.cpp @@ -174,7 +174,7 @@ int daObjTks_c::CreateHeap() { J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 0xE); JUT_ASSERT(314, NULL != mdlData_p); - mAnm_p = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); + mAnm_p = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mAnm_p != NULL && mAnm_p->getModel() == NULL) { mAnm_p->stopZelAnime(); mAnm_p = NULL; @@ -192,7 +192,7 @@ int daObjTks_c::CreateHeap() { mdl_p->setUserArea((uintptr_t)this); - mpMatAnm = new daNpcF_MatAnm_c(); + mpMatAnm = JKR_NEW daNpcF_MatAnm_c(); if (mpMatAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_toaru_maki.cpp b/src/d/actor/d_a_obj_toaru_maki.cpp index 17ee50cfcc..5c776f541d 100644 --- a/src/d/actor/d_a_obj_toaru_maki.cpp +++ b/src/d/actor/d_a_obj_toaru_maki.cpp @@ -35,7 +35,7 @@ int daObjToaruMaki_c::createHeap() { return 0; } if (nameArg == 0) { - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_toby.cpp b/src/d/actor/d_a_obj_toby.cpp index 0ea49a1a08..4c432de9b9 100644 --- a/src/d/actor/d_a_obj_toby.cpp +++ b/src/d/actor/d_a_obj_toby.cpp @@ -445,7 +445,7 @@ static int useHeapInit(fopAc_ac_c* a_this) { return 0; } - pYuka->mBgW = new dBgW(); + pYuka->mBgW = JKR_NEW dBgW(); if (pYuka->mBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_tobyhouse.cpp b/src/d/actor/d_a_obj_tobyhouse.cpp index d9b890b65d..30d5d76306 100644 --- a/src/d/actor/d_a_obj_tobyhouse.cpp +++ b/src/d/actor/d_a_obj_tobyhouse.cpp @@ -193,7 +193,7 @@ int daObjTobyHouse_c::CreateHeap() { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName[mType], l_bck[i]); JUT_ASSERT(447, pbck != NULL); - mBcks[i] = new mDoExt_bckAnm(); + mBcks[i] = JKR_NEW mDoExt_bckAnm(); if (mBcks[i] == NULL || !mBcks[i]->init(pbck, 1, 0, 1.0, 0, -1, false)) { return 0; } diff --git a/src/d/actor/d_a_obj_tombo.cpp b/src/d/actor/d_a_obj_tombo.cpp index 54878a8dbf..85e0ae47ee 100644 --- a/src/d/actor/d_a_obj_tombo.cpp +++ b/src/d/actor/d_a_obj_tombo.cpp @@ -83,7 +83,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { int daObjTOMBO_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Tombo", 9); JUT_ASSERT(259, modelData != NULL); - mpMorf = new mDoExt_McaMorfSO(modelData, NULL, NULL, + mpMorf = JKR_NEW mDoExt_McaMorfSO(modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Tombo", 6), 2, 1.0, 0, -1, &mCreature, 0, 0x11000284); if (mpMorf == NULL || mpMorf->getModel() == NULL) { @@ -91,7 +91,7 @@ int daObjTOMBO_c::CreateHeap() { } J3DModel* morfModel = mpMorf->getModel(); - mBrk = new mDoExt_brkAnm(); + mBrk = JKR_NEW mDoExt_brkAnm(); if (mBrk == NULL) { return 0; } @@ -105,7 +105,7 @@ int daObjTOMBO_c::CreateHeap() { return 0; } } - mBtk = new mDoExt_btkAnm(); + mBtk = JKR_NEW mDoExt_btkAnm(); if (mBtk == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_tp.cpp b/src/d/actor/d_a_obj_tp.cpp index 86b21b28b8..d899ef5c25 100644 --- a/src/d/actor/d_a_obj_tp.cpp +++ b/src/d/actor/d_a_obj_tp.cpp @@ -331,13 +331,13 @@ static dCcD_SrcCyl cc_cyl_src = { static int useHeapInit(fopAc_ac_c* i_this) { obj_tp_class* tp = static_cast(i_this); tp->mMorf = - new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Obj_tp", bmd[tp->field_0x594]), + JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Obj_tp", bmd[tp->field_0x594]), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Obj_tp", 7), 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000084); if (tp->mMorf == NULL || tp->mMorf->getModel() == NULL) { return 0; } - tp->mBrk = new mDoExt_brkAnm(); + tp->mBrk = JKR_NEW mDoExt_brkAnm(); if (tp->mBrk == NULL) { return 0; } @@ -362,7 +362,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { if (tp->mModels[i] == NULL) { return 0; } - tp->mBtks[i] = new mDoExt_btkAnm(); + tp->mBtks[i] = JKR_NEW mDoExt_btkAnm(); if (tp->mBtks[i] == NULL) { return 0; }; @@ -375,7 +375,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { { return 0; } - tp->mBrks[i] = new mDoExt_brkAnm(); + tp->mBrks[i] = JKR_NEW mDoExt_brkAnm(); if (tp->mBrks[i] == NULL) { return 0; } @@ -388,7 +388,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } } - tp->mBgw = new dBgW(); + tp->mBgw = JKR_NEW dBgW(); if (tp->mBgw == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_udoor.cpp b/src/d/actor/d_a_obj_udoor.cpp index 43cd6e35b9..ed1ea90cf8 100644 --- a/src/d/actor/d_a_obj_udoor.cpp +++ b/src/d/actor/d_a_obj_udoor.cpp @@ -63,8 +63,8 @@ static int daObj_Udoor_Execute(obj_udoor_class* i_this) { return 1; } -static bool daObj_Udoor_IsDelete(obj_udoor_class* param_0) { - return true; +static BOOL daObj_Udoor_IsDelete(obj_udoor_class* param_0) { + return TRUE; } static int daObj_Udoor_Delete(obj_udoor_class* i_this) { @@ -92,7 +92,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - a_this->mpBgW = new dBgW(); + a_this->mpBgW = JKR_NEW dBgW(); if (a_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_usaku.cpp b/src/d/actor/d_a_obj_usaku.cpp index acf8b1c5ab..a91a7c9fa6 100644 --- a/src/d/actor/d_a_obj_usaku.cpp +++ b/src/d/actor/d_a_obj_usaku.cpp @@ -59,7 +59,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { } OS_REPORT("//////////////OBJ_USAKU SET 5 !!\n"); - a_this->mpBgW = new dBgW(); + a_this->mpBgW = JKR_NEW dBgW(); if (a_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_vground.cpp b/src/d/actor/d_a_obj_vground.cpp index 3af6e0c5e7..7c4ece9e07 100644 --- a/src/d/actor/d_a_obj_vground.cpp +++ b/src/d/actor/d_a_obj_vground.cpp @@ -46,7 +46,7 @@ int daObjVGnd_c::CreateHeap() { { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 0xb); JUT_ASSERT(198, pbtk != NULL); - mpBtk = new mDoExt_btkAnm(); + mpBtk = JKR_NEW mDoExt_btkAnm(); if ((!mpBtk) || (!mpBtk->init(modelData, pbtk, 1, 0, 1.0f, 0, -1))) { return 0; } @@ -55,7 +55,7 @@ int daObjVGnd_c::CreateHeap() { { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 0x8); JUT_ASSERT(212, pbrk != NULL); - mpBrk = new mDoExt_brkAnm(); + mpBrk = JKR_NEW mDoExt_brkAnm(); if ((!mpBrk) || (!mpBrk->init(modelData, pbrk, 1, 0, 1.0f, 0, -1))) { return 0; } diff --git a/src/d/actor/d_a_obj_volcbom.cpp b/src/d/actor/d_a_obj_volcbom.cpp index 8e2d138d59..66669a8e76 100644 --- a/src/d/actor/d_a_obj_volcbom.cpp +++ b/src/d/actor/d_a_obj_volcbom.cpp @@ -149,21 +149,21 @@ int daObjVolcBom_c::CreateHeap() { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 16); JUT_ASSERT(403, pbrk != NULL); - mBrk1 = new mDoExt_brkAnm(); + mBrk1 = JKR_NEW mDoExt_brkAnm(); if (mBrk1 == NULL || !mBrk1->init(modelData, pbrk, 1, 2, 1.0f, 0, -1)) { return 0; } J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 21); JUT_ASSERT(416, pbtk != NULL); - mBtk1 = new mDoExt_btkAnm(); + mBtk1 = JKR_NEW mDoExt_btkAnm(); if (mBtk1 == NULL || !mBtk1->init(modelData, pbtk, 1, 2, 1.0f, 0, -1)) { return 0; } J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 8); JUT_ASSERT(428, pbck != NULL); - mBck1 = new mDoExt_bckAnm(); + mBck1 = JKR_NEW mDoExt_bckAnm(); if (mBck1 == NULL || !mBck1->init(pbck, 1, 0, 1.0f, 0, -1, false)) { return 0; } @@ -178,7 +178,7 @@ int daObjVolcBom_c::CreateHeap() { pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 15); JUT_ASSERT(457, pbrk != NULL); - mBrk2 = new mDoExt_brkAnm(); + mBrk2 = JKR_NEW mDoExt_brkAnm(); if (mBrk2 == NULL || !mBrk2->init(modelData, pbrk, 1, 0, 1.0f, 0, -1)) { return 0; } @@ -186,7 +186,7 @@ int daObjVolcBom_c::CreateHeap() { mBrk2->setPlaySpeed(0.0f); pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 19); JUT_ASSERT(471, pbtk != NULL); - mBtk2 = new mDoExt_btkAnm(); + mBtk2 = JKR_NEW mDoExt_btkAnm(); if (mBtk2 == NULL || !mBtk2->init(modelData, pbtk, 1, 2, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_obj_warp_kbrg.cpp b/src/d/actor/d_a_obj_warp_kbrg.cpp index 367144686c..d1d28a4faf 100644 --- a/src/d/actor/d_a_obj_warp_kbrg.cpp +++ b/src/d/actor/d_a_obj_warp_kbrg.cpp @@ -167,7 +167,7 @@ int daObjWarpKBrg_c::CreateHeap() { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName[getNameArg()], l_btk_idx[getNameArg()]); JUT_ASSERT(394, pbtk != NULL); - mpBridgeBtk = new mDoExt_btkAnm(); + mpBridgeBtk = JKR_NEW mDoExt_btkAnm(); if (mpBridgeBtk == NULL || !mpBridgeBtk->init(modelData, pbtk, TRUE, 0, 1.0f, 0, -1)) { return 0; } @@ -175,7 +175,7 @@ int daObjWarpKBrg_c::CreateHeap() { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName[getNameArg()], l_bck_idx[getNameArg()]); JUT_ASSERT(407, pbck != NULL); - mpBridgeBck = new mDoExt_bckAnm(); + mpBridgeBck = JKR_NEW mDoExt_bckAnm(); if (mpBridgeBck == NULL || !mpBridgeBck->init(pbck, TRUE, 0, 1.0f, 0, -1, false)) { return 0; } @@ -190,7 +190,7 @@ int daObjWarpKBrg_c::CreateHeap() { pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName[getNameArg()], 18); JUT_ASSERT(438, pbtk != NULL); - mpPortalBtk = new mDoExt_btkAnm(); + mpPortalBtk = JKR_NEW mDoExt_btkAnm(); if (mpPortalBtk == NULL || !mpPortalBtk->init(modelData, pbtk, TRUE, 2, 1.0f, 0, -1)) { return 0; } @@ -198,7 +198,7 @@ int daObjWarpKBrg_c::CreateHeap() { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName[getNameArg()], 14); JUT_ASSERT(451, pbrk != NULL); - mpPortalBrk = new mDoExt_brkAnm(); + mpPortalBrk = JKR_NEW mDoExt_brkAnm(); if (mpPortalBrk == NULL || !mpPortalBrk->init(modelData, pbrk, TRUE, 0, 1.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_obj_warp_obrg.cpp b/src/d/actor/d_a_obj_warp_obrg.cpp index e974f99f9b..4b7a88188b 100644 --- a/src/d/actor/d_a_obj_warp_obrg.cpp +++ b/src/d/actor/d_a_obj_warp_obrg.cpp @@ -100,7 +100,7 @@ int daObjWarpOBrg_c::CreateHeap() { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, l_bck_idx[getNameArg()]); JUT_ASSERT(263, pbck != NULL); - mpBck = new mDoExt_bckAnm(); + mpBck = JKR_NEW mDoExt_bckAnm(); if (mpBck == NULL || !mpBck->init(pbck, TRUE, 0, 0.0f, 0, -1, false)) { return 0; } @@ -112,7 +112,7 @@ int daObjWarpOBrg_c::CreateHeap() { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, l_btk_idx[getNameArg()]); JUT_ASSERT(271, pbtk != NULL); - mpBtk = new mDoExt_btkAnm(); + mpBtk = JKR_NEW mDoExt_btkAnm(); if (mpBtk == NULL || !mpBtk->init(modelData, pbtk, TRUE, 0, 0.0f, 0, -1)) { return 0; } diff --git a/src/d/actor/d_a_obj_wchain.cpp b/src/d/actor/d_a_obj_wchain.cpp index 1200d62938..f7c736fee9 100644 --- a/src/d/actor/d_a_obj_wchain.cpp +++ b/src/d/actor/d_a_obj_wchain.cpp @@ -312,9 +312,9 @@ void daObjWchain_shape_c::draw() { J3DModelData* model_data = chain->getChainModelData(); J3DMaterial* material = model_data->getMaterialNodePointer(0); dKy_tevstr_c& tevstr = chain->tevStr; - j3dSys.setVtxPos(model_data->getVtxPosArray()); - j3dSys.setVtxNrm(model_data->getVtxNrmArray()); - j3dSys.setVtxCol(model_data->getVtxColorArray(0)); + j3dSys.setVtxPos(model_data->getVtxPosArray(), model_data->getVtxNum()); + j3dSys.setVtxNrm(model_data->getVtxNrmArray(), model_data->getNrmNum()); + j3dSys.setVtxCol(model_data->getVtxColorArray(0), model_data->getColNum()); J3DShape::resetVcdVatCache(); material->loadSharedDL(); material->getShape()->loadPreDrawSetting(); diff --git a/src/d/actor/d_a_obj_web0.cpp b/src/d/actor/d_a_obj_web0.cpp index b848781a4c..128f53aee1 100644 --- a/src/d/actor/d_a_obj_web0.cpp +++ b/src/d/actor/d_a_obj_web0.cpp @@ -180,7 +180,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - _this->mpBrk = new mDoExt_brkAnm(); + _this->mpBrk = JKR_NEW mDoExt_brkAnm(); if (_this->mpBrk == NULL) { return 0; } @@ -193,7 +193,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { _this->mpBrk->setPlaySpeed(0.0f); - _this->mpBgW = new dBgW(); + _this->mpBgW = JKR_NEW dBgW(); if (_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_web1.cpp b/src/d/actor/d_a_obj_web1.cpp index 23586b8825..20cd899aea 100644 --- a/src/d/actor/d_a_obj_web1.cpp +++ b/src/d/actor/d_a_obj_web1.cpp @@ -208,7 +208,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { return 0; } - _this->mpBrk = new mDoExt_brkAnm(); + _this->mpBrk = JKR_NEW mDoExt_brkAnm(); if (_this->mpBrk == NULL) { return 0; } @@ -220,7 +220,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { _this->mpBrk->setPlaySpeed(0.0f); - _this->mpBgW = new dBgW(); + _this->mpBgW = JKR_NEW dBgW(); if (_this->mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_wflag.cpp b/src/d/actor/d_a_obj_wflag.cpp index 7fea4e50df..9bfe15abb1 100644 --- a/src/d/actor/d_a_obj_wflag.cpp +++ b/src/d/actor/d_a_obj_wflag.cpp @@ -152,11 +152,11 @@ static int useHeapInit(fopAc_ac_c* i_actor) { if (i_this->mpModel == NULL) { return 0; } - i_this->mMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Obj_wflag", 11), NULL, NULL, ( J3DAnmTransform*)dComIfG_getObjectRes("Obj_wflag", 6), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11020284); + i_this->mMorf = JKR_NEW mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Obj_wflag", 11), NULL, NULL, ( J3DAnmTransform*)dComIfG_getObjectRes("Obj_wflag", 6), 2, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11020284); if (i_this->mMorf == NULL || i_this->mMorf->getModel() == NULL) { return 0; } - i_this->field_0x578 = new mDoExt_btkAnm(); + i_this->field_0x578 = JKR_NEW mDoExt_btkAnm(); if (i_this->field_0x578 == NULL) { return 0; } @@ -165,7 +165,7 @@ static int useHeapInit(fopAc_ac_c* i_actor) { return 0; } - i_this->field_0x57c = new mDoExt_btpAnm(); + i_this->field_0x57c = JKR_NEW mDoExt_btpAnm(); if (i_this->field_0x57c == NULL) { return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_obj_wind_stone.cpp b/src/d/actor/d_a_obj_wind_stone.cpp index bdbd66e198..dfa67bab1a 100644 --- a/src/d/actor/d_a_obj_wind_stone.cpp +++ b/src/d/actor/d_a_obj_wind_stone.cpp @@ -28,7 +28,7 @@ int daWindStone_c::createHeap() { if (mpModel == NULL) { return 0; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_window.cpp b/src/d/actor/d_a_obj_window.cpp index fe74f440de..e51f4f55a2 100644 --- a/src/d/actor/d_a_obj_window.cpp +++ b/src/d/actor/d_a_obj_window.cpp @@ -72,7 +72,7 @@ int daObjWindow_c::CreateHeap() { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, l_bck[mType]); JUT_ASSERT(266, pbck != NULL); - mpBckAnm = new mDoExt_bckAnm(); + mpBckAnm = JKR_NEW mDoExt_bckAnm(); if (mpBckAnm == NULL || !mpBckAnm->init(pbck, 1, 2, 1.0f, 0, -1, false)) { return 0; } diff --git a/src/d/actor/d_a_obj_yobikusa.cpp b/src/d/actor/d_a_obj_yobikusa.cpp index ad24f8ddf3..bfe75c439e 100644 --- a/src/d/actor/d_a_obj_yobikusa.cpp +++ b/src/d/actor/d_a_obj_yobikusa.cpp @@ -367,8 +367,8 @@ int daObjYobikusa_c::execute() { return TRUE; } -static bool daObjYobikusa_IsDelete(daObjYobikusa_c* i_this) { - return true; +static BOOL daObjYobikusa_IsDelete(daObjYobikusa_c* i_this) { + return TRUE; } daObjYobikusa_c::~daObjYobikusa_c() { diff --git a/src/d/actor/d_a_obj_yousei.cpp b/src/d/actor/d_a_obj_yousei.cpp index 20555536f1..68c16b5271 100644 --- a/src/d/actor/d_a_obj_yousei.cpp +++ b/src/d/actor/d_a_obj_yousei.cpp @@ -41,7 +41,7 @@ int daObjYOUSEI_c::CreateHeap() { void* modelData = dComIfG_getObjectRes("Always", 0x21); JUT_ASSERT(177, modelData != NULL); - mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Always", 0xF), 2, 0.4f, 0, -1, &mSound, 0x80000, 0x11000084); + mpModelMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("Always", 0xF), 2, 0.4f, 0, -1, &mSound, 0x80000, 0x11000084); if (mpModelMorf == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_ystone.cpp b/src/d/actor/d_a_obj_ystone.cpp index 41790e119a..e3d8465aca 100644 --- a/src/d/actor/d_a_obj_ystone.cpp +++ b/src/d/actor/d_a_obj_ystone.cpp @@ -217,21 +217,21 @@ static int useHeapInit(fopAc_ac_c* i_this) { J3DAnmTevRegKey* brk_anm = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName[_this->mLevel], l_brkIndex[_this->mLevel]); - _this->mpBrkAnm = new mDoExt_brkAnm(); + _this->mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (_this->mpBrkAnm == NULL || !_this->mpBrkAnm->init((J3DModelData*)model_data, brk_anm, 1, 2, 1.0f, 0, -1)) { return 0; } } else { - _this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)model_data, NULL, NULL, + _this->mpMorf = JKR_NEW mDoExt_McaMorfSO((J3DModelData*)model_data, NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName[_this->mLevel], 5), 0, 1.0f, 0, -1, NULL, 0, 0x11000284); if (_this->mpMorf == NULL || _this->mpMorf->getModel() == NULL) { return 0; } - _this->mpBtkAnm = new mDoExt_btkAnm(); + _this->mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (_this->mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_obj_zrTurara.cpp b/src/d/actor/d_a_obj_zrTurara.cpp index 9e9767db06..0cb710e4a1 100644 --- a/src/d/actor/d_a_obj_zrTurara.cpp +++ b/src/d/actor/d_a_obj_zrTurara.cpp @@ -65,7 +65,7 @@ int daZrTurara_c::CreateHeap() { if (mpRockModel == NULL) { return 0; } - mpRockBgW = new dBgW(); + mpRockBgW = JKR_NEW dBgW(); if (mpRockBgW == NULL || mpRockBgW->Set((cBgD_t*)dComIfG_getObjectRes("M_DrpRock", 8), 1, &mRockBgMtx)) { diff --git a/src/d/actor/d_a_passer_mng.cpp b/src/d/actor/d_a_passer_mng.cpp index ea584d9158..b7b450e2da 100644 --- a/src/d/actor/d_a_passer_mng.cpp +++ b/src/d/actor/d_a_passer_mng.cpp @@ -525,7 +525,7 @@ void daPasserMng_c::create_init() { dPnt* pnt1 = dPath_GetPnt(mPath, 1); current.pos.set(pnt0->m_position); current.angle.y = cLib_targetAngleY(pnt0->m_position, pnt1->m_position); - childProcIds = new fpc_ProcID[getMaxNum()]; + childProcIds = JKR_NEW fpc_ProcID[getMaxNum()]; currentChildIndex = 0; int time = getTime(); intervalTime = getIntervalTime() * 5; @@ -556,7 +556,7 @@ void daPasserMng_c::create_init() { max = mPath->m_num - 2; } int i; - int* arr = new int[max]; + int* arr = JKR_NEW int[max]; int ind = 0; while (ind < max) { int rnd = cLib_getRndValue(1, mPath->m_num - 2); @@ -590,7 +590,7 @@ void daPasserMng_c::create_init() { -1, 0); currentChildIndex = (currentChildIndex + 1) % getMaxNum(); } - delete [] arr; + JKR_DELETE_ARRAY(arr); } } diff --git a/src/d/actor/d_a_peru.cpp b/src/d/actor/d_a_peru.cpp index e6f86f68d9..399dcb850d 100644 --- a/src/d/actor/d_a_peru.cpp +++ b/src/d/actor/d_a_peru.cpp @@ -241,7 +241,7 @@ int daPeru_c::CreateHeap() { J3DModelData* mdlData_p = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[l_bmdData[idx][1]], l_bmdData[idx][0]); JUT_ASSERT(660, NULL != mdlData_p); - mpMorf[0] = new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, + mpMorf[0] = JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020284); if (mpMorf[0] != NULL && mpMorf[0]->getModel() == NULL) { mpMorf[0]->stopZelAnime(); @@ -258,7 +258,7 @@ int daPeru_c::CreateHeap() { } model->setUserArea((uintptr_t)this); - mpMatAnm[0] = new daNpcT_MatAnm_c(); + mpMatAnm[0] = JKR_NEW daNpcT_MatAnm_c(); if (mpMatAnm[0] == NULL) { return 0; } diff --git a/src/d/actor/d_a_player.cpp b/src/d/actor/d_a_player.cpp index 0b6dd246ff..df05851e15 100644 --- a/src/d/actor/d_a_player.cpp +++ b/src/d/actor/d_a_player.cpp @@ -233,7 +233,7 @@ void daPy_anmHeap_c::initData() { } void* daPy_anmHeap_c::mallocBuffer() { - mBuffer = new (0x20) u8[mBufferSize]; + mBuffer = JKR_NEW_ARGS (0x20) u8[mBufferSize]; return mBuffer; } @@ -262,19 +262,19 @@ void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType) { mAnimeHeap = mDoExt_createSolidHeapFromGameToCurrent(&tmp, size, 0x20); if (i_heapType == 4) { - tmpWork = new char[size]; + tmpWork = JKR_NEW char[size]; JUT_ASSERT(669, tmpWork != NULL); } else if (i_heapType == 3) { - tmpTransBas = new mDoExt_transAnmBas(NULL); + tmpTransBas = JKR_NEW mDoExt_transAnmBas(NULL); JUT_ASSERT(672, tmpTransBas != NULL); } else if (i_heapType == 0) { - tmpTrans = new J3DAnmTransformKey(); + tmpTrans = JKR_NEW J3DAnmTransformKey(); JUT_ASSERT(675, tmpTrans != NULL); } else if (i_heapType == 1) { - tmpTp = new J3DAnmTexPattern(); + tmpTp = JKR_NEW J3DAnmTexPattern(); JUT_ASSERT(678, tmpTp != NULL); } else { - tmpTk = new J3DAnmTextureSRTKey(); + tmpTk = JKR_NEW J3DAnmTextureSRTKey(); JUT_ASSERT(681, tmpTk != NULL); } diff --git a/src/d/actor/d_a_set_bgobj.cpp b/src/d/actor/d_a_set_bgobj.cpp index 6beae751cd..9334b04cd7 100644 --- a/src/d/actor/d_a_set_bgobj.cpp +++ b/src/d/actor/d_a_set_bgobj.cpp @@ -16,7 +16,7 @@ int daSetBgObj_c::CreateInit() { PROC_BG_OBJ, PROC_BG_OBJ, PROC_BG_OBJ, PROC_Obj_Flag2, PROC_Obj_Flag3, }; - u16* spec_data_p = (u16*)dComIfG_getObjectRes(mArcName, l_specName); + BE(u16)* spec_data_p = (BE(u16)*)dComIfG_getObjectRes(mArcName, l_specName); fopAcM_create(l_bg_profName[*spec_data_p], fopAcM_GetParam(this), ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle, &scale, -1); diff --git a/src/d/actor/d_a_skip_2D.cpp b/src/d/actor/d_a_skip_2D.cpp index d1e91a366f..08e4b91040 100644 --- a/src/d/actor/d_a_skip_2D.cpp +++ b/src/d/actor/d_a_skip_2D.cpp @@ -14,7 +14,7 @@ static int daSkip2D_createHeap(fopAc_ac_c* i_this) { } int daSkip2D_c::createHeap() { - mpButton = new dMeterButton_c(); + mpButton = JKR_NEW dMeterButton_c(); if (mpButton == NULL) { return 0; diff --git a/src/d/actor/d_a_sq.cpp b/src/d/actor/d_a_sq.cpp index a8abcd0134..cc9b120e0f 100644 --- a/src/d/actor/d_a_sq.cpp +++ b/src/d/actor/d_a_sq.cpp @@ -474,14 +474,14 @@ static int useHeapInit(fopAc_ac_c* i_this) { sq_class* _this = static_cast(i_this); _this->mpMorf = - new mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("Sq", 17)), NULL, NULL, + JKR_NEW mDoExt_McaMorf(static_cast(dComIfG_getObjectRes("Sq", 17)), NULL, NULL, static_cast(dComIfG_getObjectRes("Sq", 9)), 0, 1.0f, 0, -1, 1, NULL, 0x80000, 0x11000284); if (_this->mpMorf == NULL || _this->mpMorf->getModel() == NULL) { return 0; } - _this->mpBtkAnm = new mDoExt_btkAnm(); + _this->mpBtkAnm = JKR_NEW mDoExt_btkAnm(); if (_this->mpBtkAnm == NULL) { return 0; } diff --git a/src/d/actor/d_a_tag_Lv6Gate.cpp b/src/d/actor/d_a_tag_Lv6Gate.cpp index caad0162a2..e00d893413 100644 --- a/src/d/actor/d_a_tag_Lv6Gate.cpp +++ b/src/d/actor/d_a_tag_Lv6Gate.cpp @@ -33,7 +33,7 @@ inline int daTagLv6Gate_c::createHeap() { btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 19); JUT_ASSERT(100, btk != NULL); - mpBtk[0] = new mDoExt_btkAnm(); + mpBtk[0] = JKR_NEW mDoExt_btkAnm(); if (mpBtk[0] == NULL || !mpBtk[0]->init(modelData, btk, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1)) { @@ -46,7 +46,7 @@ inline int daTagLv6Gate_c::createHeap() { btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 20); JUT_ASSERT(108, btk != NULL); - mpBtk[1] = new mDoExt_btkAnm(); + mpBtk[1] = JKR_NEW mDoExt_btkAnm(); if (mpBtk[1] == NULL || !mpBtk[1]->init(modelData, btk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { diff --git a/src/d/actor/d_a_tag_Lv7Gate.cpp b/src/d/actor/d_a_tag_Lv7Gate.cpp index f622fff77d..d53ce4b2d1 100644 --- a/src/d/actor/d_a_tag_Lv7Gate.cpp +++ b/src/d/actor/d_a_tag_Lv7Gate.cpp @@ -29,7 +29,7 @@ int daTagLv7Gate_c::createHeap() { J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 7); JUT_ASSERT(100, bck != NULL); - mpBck = new mDoExt_bckAnm(); + mpBck = JKR_NEW mDoExt_bckAnm(); if (mpBck == NULL || !mpBck->init(bck, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false)) { return 0; diff --git a/src/d/actor/d_a_tag_Lv8Gate.cpp b/src/d/actor/d_a_tag_Lv8Gate.cpp index 6927449e86..ba07c7fd86 100644 --- a/src/d/actor/d_a_tag_Lv8Gate.cpp +++ b/src/d/actor/d_a_tag_Lv8Gate.cpp @@ -100,7 +100,7 @@ int daTagLv8Gate_c::createHeap() { J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 5); JUT_ASSERT(283, bck != NULL); - mpBck = new mDoExt_bckAnm(); + mpBck = JKR_NEW mDoExt_bckAnm(); if (mpBck == NULL || !mpBck->init(bck, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false)) { diff --git a/src/d/actor/d_a_tag_TWgate.cpp b/src/d/actor/d_a_tag_TWgate.cpp index eadfb3342b..697ceeeaef 100644 --- a/src/d/actor/d_a_tag_TWgate.cpp +++ b/src/d/actor/d_a_tag_TWgate.cpp @@ -1080,7 +1080,7 @@ int daTagTWGate_c::CreateHeap() { mdlData_p = static_cast(dComIfG_getObjectRes("TWGate_Md", 7)); JUT_ASSERT(1685, NULL != mdlData_p); mpMorf = - new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, + JKR_NEW mDoExt_McaMorfSO(mdlData_p, NULL, NULL, static_cast(dComIfG_getObjectRes("TWGate_Md", 4)), 0, 0.0f, 0, -1, NULL, 0, 0x11000084); diff --git a/src/d/actor/d_a_tag_csw.cpp b/src/d/actor/d_a_tag_csw.cpp index f8638cde95..bf5b174f0b 100644 --- a/src/d/actor/d_a_tag_csw.cpp +++ b/src/d/actor/d_a_tag_csw.cpp @@ -114,7 +114,7 @@ int daTagCsw_c::createHeap() { } field_0x8e8.x = field_0x8e8.y = field_0x8e8.z; setMtx(); - field_0x57c = new mDoExt_brkAnm(); + field_0x57c = JKR_NEW mDoExt_brkAnm(); if (field_0x57c == NULL) { return 0; } @@ -127,7 +127,7 @@ int daTagCsw_c::createHeap() { if (field_0x578 == NULL) { field_0x580 = NULL; } else { - field_0x580 = new mDoExt_brkAnm(); + field_0x580 = JKR_NEW mDoExt_brkAnm(); if (field_0x580 == NULL) { return 0; } @@ -138,7 +138,7 @@ int daTagCsw_c::createHeap() { return 0; } } - field_0x584 = new dBgW(); + field_0x584 = JKR_NEW dBgW(); if (field_0x584 == NULL) { return 0; } @@ -148,7 +148,7 @@ int daTagCsw_c::createHeap() { if (field_0x578 == NULL) { field_0x5f0 = NULL; } else { - field_0x5f0 = new dBgW(); + field_0x5f0 = JKR_NEW dBgW(); if (field_0x5f0 == NULL) { return 0; } @@ -156,7 +156,7 @@ int daTagCsw_c::createHeap() { return 0; } } - field_0x588 = new dBgW(); + field_0x588 = JKR_NEW dBgW(); if (field_0x588 == NULL) { return 0; } diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index bf29c20e80..6759531caa 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -63,7 +63,7 @@ int daTag_Msg_c::create() { } int daTag_Msg_c::createHeap() { - mpHIO = new TAG_MSG_HIO_CLASS(); + mpHIO = JKR_NEW TAG_MSG_HIO_CLASS(); if (mpHIO == NULL) { return 0; } diff --git a/src/d/actor/d_a_tag_statue_evt.cpp b/src/d/actor/d_a_tag_statue_evt.cpp index eb7d3752eb..3017abcb07 100644 --- a/src/d/actor/d_a_tag_statue_evt.cpp +++ b/src/d/actor/d_a_tag_statue_evt.cpp @@ -161,7 +161,7 @@ int daTagStatue_c::CreateHeap() { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 12); JUT_ASSERT(291, pbtk != NULL); - mpPlatformCircleBtk = new mDoExt_btkAnm(); + mpPlatformCircleBtk = JKR_NEW mDoExt_btkAnm(); if (!mpPlatformCircleBtk || !mpPlatformCircleBtk->init(modelData, pbtk, 1, 0, 1.0f, 0, -1)) { @@ -170,7 +170,7 @@ int daTagStatue_c::CreateHeap() { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 9); JUT_ASSERT(303, pbrk != NULL); - mpGlowingSkyCharacterBrk = new mDoExt_brkAnm(); + mpGlowingSkyCharacterBrk = JKR_NEW mDoExt_brkAnm(); if (!mpGlowingSkyCharacterBrk || !mpGlowingSkyCharacterBrk->init(modelData, pbrk, 1, 0, 1.0f, 0, -1)) { diff --git a/src/d/actor/d_a_tbox.cpp b/src/d/actor/d_a_tbox.cpp index 8e564b9887..1da82cd477 100644 --- a/src/d/actor/d_a_tbox.cpp +++ b/src/d/actor/d_a_tbox.cpp @@ -108,7 +108,7 @@ cPhs_Step daTbox_c::commonShapeSet() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(model_info->mArcName, model_info->mModelResNo); JUT_ASSERT(0x191, modelData != NULL); - mpAnm = new mDoExt_bckAnm(); + mpAnm = JKR_NEW mDoExt_bckAnm(); if (mpAnm == NULL) { return cPhs_ERROR_e; } @@ -146,7 +146,7 @@ cPhs_Step daTbox_c::commonShapeSet() { return cPhs_ERROR_e; } - mpEffectAnm = new mDoExt_brkAnm(); + mpEffectAnm = JKR_NEW mDoExt_brkAnm(); if (mpEffectAnm == NULL) { return cPhs_ERROR_e; } @@ -184,7 +184,7 @@ cPhs_Step daTbox_c::bgCheckSet() { cBgD_t* bgd = (cBgD_t*)dComIfG_getObjectRes(model_info->mArcName, model_info->mOpenDzbResNo); JUT_ASSERT(528, bgd != NULL); - mpOpenBgW = new dBgW(); + mpOpenBgW = JKR_NEW dBgW(); if (mpOpenBgW == NULL) { return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_tbox2.cpp b/src/d/actor/d_a_tbox2.cpp index 0d0d62397d..03c35f49ac 100644 --- a/src/d/actor/d_a_tbox2.cpp +++ b/src/d/actor/d_a_tbox2.cpp @@ -115,12 +115,12 @@ int daTbox2_c::CreateHeap() { J3DAnmTransform* pbck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, l_resInfo[mModelType].bck_no); JUT_ASSERT(0, pbck != NULL); - mpBck = new mDoExt_bckAnm(); + mpBck = JKR_NEW mDoExt_bckAnm(); if (mpBck == NULL || !mpBck->init(pbck, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1, false)) { return false; } - mBoxBgW = new dBgW(); + mBoxBgW = JKR_NEW dBgW(); if (mBoxBgW != NULL && !mBoxBgW->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, l_resInfo[mModelType].dzb_no), cBgW::MOVE_BG_e, &mBgMtx)) diff --git a/src/d/actor/d_a_title.cpp b/src/d/actor/d_a_title.cpp index fef3260ef1..3b3a0034a6 100644 --- a/src/d/actor/d_a_title.cpp +++ b/src/d/actor/d_a_title.cpp @@ -216,7 +216,7 @@ void daTitle_c::loadWait_proc() { mpFont = mDoExt_getMesgFont(); - mTitle.Scr = new J2DScreen(); + mTitle.Scr = JKR_NEW J2DScreen(); JUT_ASSERT(529, mTitle.Scr != NULL); mTitle.Scr->setPriority("zelda_press_start.blo", 0x100000, mpMount->getArchive()); @@ -238,7 +238,7 @@ void daTitle_c::loadWait_proc() { fopMsgM_messageGet(msg, 100); } - field_0x600 = new CPaneMgrAlpha(mTitle.Scr, MULTI_CHAR('n_all'), 2, NULL); + field_0x600 = JKR_NEW CPaneMgrAlpha(mTitle.Scr, MULTI_CHAR('n_all'), 2, NULL); field_0x600->setAlpha(0); J2DPane* pane = mTitle.Scr->search(MULTI_CHAR('n_all')); pane->translate(g_daTitHIO.mPSPosX, g_daTitHIO.mPSPosY); @@ -387,8 +387,8 @@ int daTitle_c::Delete() { mDoHIO_DELETE_CHILD(g_daTitHIO.id); dComIfG_resDelete(&mPhaseReq, l_arcName); - delete mTitle.Scr; - delete field_0x600; + JKR_DELETE(mTitle.Scr); + JKR_DELETE(field_0x600); mpMount->getArchive()->removeResourceAll(); JKRUnmountArchive(mpMount->getArchive()); diff --git a/src/d/actor/d_a_warp_bug.cpp b/src/d/actor/d_a_warp_bug.cpp index 2e0a1bc089..d317b12fe4 100644 --- a/src/d/actor/d_a_warp_bug.cpp +++ b/src/d/actor/d_a_warp_bug.cpp @@ -22,7 +22,7 @@ int daWarpBug_c::createHeap() { J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, "kisei.btk"); if (pbrk != NULL) { - mpBrk = new mDoExt_brkAnm(); + mpBrk = JKR_NEW mDoExt_brkAnm(); if (!mpBrk->init(modelData, pbrk, TRUE, 2, 1.0f, 0, -1)) { return 0; @@ -30,7 +30,7 @@ int daWarpBug_c::createHeap() { } if (pbtk != NULL) { - mpBtk = new mDoExt_btkAnm(); + mpBtk = JKR_NEW mDoExt_btkAnm(); if (!mpBtk->init(modelData, pbtk, TRUE, 2, 1.0f, 0, -1)) { return 0; diff --git a/src/d/d_attention.cpp b/src/d/d_attention.cpp index 1a2385821f..332194e75f 100644 --- a/src/d/d_attention.cpp +++ b/src/d/d_attention.cpp @@ -253,7 +253,7 @@ dAttention_c::dAttention_c(fopAc_ac_c* i_player, u32 i_padNo) { mZHintTarget.init(); mCatghTarget.init(); mLookTarget.init(); - new (&mAttParam) dAttParam_c(0); + JKR_NEW_ARGS (&mAttParam) dAttParam_c(0); g_AttDwHIO.field_0x4 = mDoHIO_CREATE_CHILD("注目カーソル", &g_AttDwHIO); } diff --git a/src/d/d_bg_parts.cpp b/src/d/d_bg_parts.cpp index ccafb31b5b..1ee7198999 100644 --- a/src/d/d_bg_parts.cpp +++ b/src/d/d_bg_parts.cpp @@ -41,9 +41,9 @@ void dBgp_c::modelMaterial_c::drawSimple() { J3DShape* shape = modelMaterial->getMaterial()->getShape(); J3DModelData* modelData = modelMaterial->getModelData(); - j3dSys.setVtxPos(modelData->getVtxPosArray()); - j3dSys.setVtxNrm(modelData->getVtxNrmArray()); - j3dSys.setVtxCol(modelData->getVtxColorArray(0)); + j3dSys.setVtxPos(modelData->getVtxPosArray(), modelData->getVtxNum()); + j3dSys.setVtxNrm(modelData->getVtxNrmArray(), modelData->getNrmNum()); + j3dSys.setVtxCol(modelData->getVtxColorArray(0), modelData->getColNum()); MTXConcat(j3dSys.getViewMtx(), modelMaterial->getMtx(), m); GXLoadPosMtxImm(m, 0); GXLoadNrmMtxImm(m, 0); @@ -114,7 +114,7 @@ void dBgp_c::model_c::create(J3DModelData* i_modelData, Mtx i_mtx) { JUT_ASSERT(205, i_modelData->getJointNum() == 1); JUT_ASSERT(206, i_modelData->getMaterialNum() != 0); - mMaterial = new modelMaterial_c[i_modelData->getMaterialNum()]; + mMaterial = JKR_NEW modelMaterial_c[i_modelData->getMaterialNum()]; JUT_ASSERT(212, mMaterial != NULL); J3DJoint* joint = i_modelData->getJointNodePointer(0); @@ -242,11 +242,11 @@ void dBgp_c::share_c::reset() { for (u16 i = 0; i < mModelData->getMaterialNum(); i++) { J3DMaterial* material = mModelData->getMaterialNodePointer(i); if (material->getMaterialAnm() != NULL) { - delete material->getMaterialAnm(); + JKR_DELETE(material->getMaterialAnm()); } } - delete[] mMaterial; + JKR_DELETE_ARRAY(mMaterial); dComIfG_deleteObjectResMain(getArcName()); mStatus = -1; @@ -263,7 +263,7 @@ static BOOL createMatAnm(J3DModelData* i_modelData, u16 i_materialId) { if (i_materialId != 0xFFFF) { J3DMaterial* material = i_modelData->getMaterialNodePointer(i_materialId); if (material->getMaterialAnm() == NULL) { - J3DMaterialAnm* anm = new J3DMaterialAnm(); + J3DMaterialAnm* anm = JKR_NEW J3DMaterialAnm(); if (anm == NULL) { return FALSE; } @@ -288,7 +288,7 @@ int dBgp_c::share_c::execute() { JUT_ASSERT(544, mModelData->getMaterialNum() != 0); - mMaterial = new modelMaterial_c[mModelData->getMaterialNum()]; + mMaterial = JKR_NEW modelMaterial_c[mModelData->getMaterialNum()]; JUT_ASSERT(546, mMaterial != NULL); for (u16 i = 0; i < mModelData->getMaterialNum(); i++) { @@ -446,11 +446,11 @@ void dBgp_c::create(s8 i_roomNo, void* i_data) { JKRHeap* prevHeap = mDoExt_setCurrentHeap(mHeap); - mModel = new model_c[((stage_map_unit_class*)mPointer)->num]; + mModel = JKR_NEW model_c[((stage_map_unit_class*)mPointer)->num]; JUT_ASSERT(886, mModel != NULL); unit_class* mapUnit = (unit_class*)((stage_map_unit_class*)mPointer)->entries; - mBgWork = new dBgW[mapUnit->num]; + mBgWork = JKR_NEW dBgW[mapUnit->num]; JUT_ASSERT(890, mBgWork != NULL); dBgW* bgw = mBgWork; @@ -758,7 +758,7 @@ void dBgp_c::createShare() { mShareHeap = mDoExt_createSolidHeapFromGameToCurrent(0, 0x20); JUT_ASSERT(1409, mShareHeap != NULL); - mShare = new share_c[16]; + mShare = JKR_NEW share_c[16]; JUT_ASSERT(1411, mShare != NULL); u32 heapSize = mDoExt_adjustSolidHeapToSystem(mShareHeap); diff --git a/src/d/d_bg_s_movebg_actor.cpp b/src/d/d_bg_s_movebg_actor.cpp index 3e0735cf91..a3030349f6 100644 --- a/src/d/d_bg_s_movebg_actor.cpp +++ b/src/d/d_bg_s_movebg_actor.cpp @@ -66,7 +66,7 @@ int dBgS_MoveBgActor::MoveBGCreateHeap() { return 1; } - mpBgW = new dBgW(); + mpBgW = JKR_NEW dBgW(); if (mpBgW != NULL) { cBgD_t* res = (cBgD_t*)dComIfG_getObjectRes(m_name, m_dzb_id); if (!mpBgW->Set(res, cBgW::MOVE_BG_e, &mBgMtx)) { diff --git a/src/d/d_bg_w.cpp b/src/d/d_bg_w.cpp index 7fb93080a2..fa070854a1 100644 --- a/src/d/d_bg_w.cpp +++ b/src/d/d_bg_w.cpp @@ -88,7 +88,7 @@ bool cBgW::SetVtx() { if (mFlags & NO_VTX_TBL_e) { pm_vtx_tbl = NULL; } else if (mFlags & MOVE_BG_e) { - pm_vtx_tbl = (cBgD_Vtx_t*)new Vec[pm_bgd->m_v_num]; + pm_vtx_tbl = (cBgD_Vtx_t*)JKR_NEW Vec[pm_bgd->m_v_num]; if (pm_vtx_tbl == NULL) { return true; @@ -139,7 +139,7 @@ void cBgW::CalcPlane() { } bool cBgW::SetTri() { - pm_tri = new cBgW_TriElm[pm_bgd->m_t_num]; + pm_tri = JKR_NEW cBgW_TriElm[pm_bgd->m_t_num]; if (pm_tri == NULL) { return true; @@ -387,25 +387,25 @@ bool cBgW::Set(cBgD_t* pbgd, u32 flags, Mtx* pbase_mtx) { return true; } - pm_rwg = new cBgW_RwgElm[pm_bgd->m_t_num]; + pm_rwg = JKR_NEW cBgW_RwgElm[pm_bgd->m_t_num]; if (pm_rwg == NULL) { FreeArea(); return true; } - pm_blk = new cBgW_BlkElm[pm_bgd->m_b_num]; + pm_blk = JKR_NEW cBgW_BlkElm[pm_bgd->m_b_num]; if (pm_blk == NULL) { FreeArea(); return true; } - pm_node_tree = new cBgW_NodeTree[pm_bgd->m_tree_num]; + pm_node_tree = JKR_NEW cBgW_NodeTree[pm_bgd->m_tree_num]; if (pm_node_tree == NULL) { FreeArea(); return true; } - pm_grp = new cBgW_GrpElm[pm_bgd->m_g_num]; + pm_grp = JKR_NEW cBgW_GrpElm[pm_bgd->m_g_num]; if (pm_grp == NULL) { FreeArea(); return true; @@ -2154,7 +2154,7 @@ u32 dBgW::ChkMoveFlag() const { } dBgW* dBgW_NewSet(cBgD_t* pbgd, u32 flags, Mtx* pbase_mtx) { - dBgW* nw = new dBgW(); + dBgW* nw = JKR_NEW dBgW(); if (nw == NULL) { return NULL; diff --git a/src/d/d_bg_w_sv.cpp b/src/d/d_bg_w_sv.cpp index e532d9224c..064a323900 100644 --- a/src/d/d_bg_w_sv.cpp +++ b/src/d/d_bg_w_sv.cpp @@ -18,7 +18,7 @@ u8 dBgWSv::Set(cBgD_t* pbgd, u32 param_1) { return 0; } - field_0xc0 = new Vec[pm_bgd->m_v_num]; + field_0xc0 = JKR_NEW Vec[pm_bgd->m_v_num]; return field_0xc0 == NULL; } diff --git a/src/d/d_bright_check.cpp b/src/d/d_bright_check.cpp index e7695b7451..36f24ebd72 100644 --- a/src/d/d_bright_check.cpp +++ b/src/d/d_bright_check.cpp @@ -13,7 +13,7 @@ dBrightCheck_c::dBrightCheck_c(JKRArchive* i_archive) { mArchive = i_archive; - mBrightCheck.mMsgString = new dMsgString_c(); + mBrightCheck.mMsgString = JKR_NEW dMsgString_c(); JUT_ASSERT(0, mBrightCheck.mMsgString != NULL); screenSet(); @@ -22,8 +22,8 @@ dBrightCheck_c::dBrightCheck_c(JKRArchive* i_archive) { } dBrightCheck_c::~dBrightCheck_c() { - delete mBrightCheck.Scr; - delete mBrightCheck.mMsgString; + JKR_DELETE(mBrightCheck.Scr); + JKR_DELETE(mBrightCheck.mMsgString); } void dBrightCheck_c::screenSet() { @@ -57,7 +57,7 @@ void dBrightCheck_c::screenSet() { }; #endif - mBrightCheck.Scr = new J2DScreen(); + mBrightCheck.Scr = JKR_NEW J2DScreen(); JUT_ASSERT(0, mBrightCheck.Scr != NULL); mBrightCheck.Scr->setPriority("zelda_option_check.blo", 0x1100000, mArchive); diff --git a/src/d/d_cam_param.cpp b/src/d/d_cam_param.cpp index 45c45d6038..cce02ee523 100644 --- a/src/d/d_cam_param.cpp +++ b/src/d/d_cam_param.cpp @@ -247,7 +247,7 @@ dCamParam_c::dCamParam_c(s32 i_styleID) { void* objRes = dComIfG_getObjectRes(fileName, "camstyle.dat"); u8* cam_data = (u8*)objRes; - mCamStyleData = (dCamStyleData::StyleData*)(cam_data + 8); + mCamStyleData = ((dCamStyleData*)cam_data)->mStyleData; mStyleNum = ((dCamStyleData*)cam_data)->mStyleNum; #if DEBUG diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index f41bd3a30b..5a9e79f71c 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -350,7 +350,7 @@ void dCamera_c::initialize(camera_class* i_camera, fopAc_ac_c* i_player, u32 i_c void* objRes = dComIfG_getObjectRes(fileName, "camtype.dat"); char* typeData = (char*)objRes; mCamTypeData = (dCamera_type_data*)(typeData + 8); - mCamTypeNum = *(int*)(typeData + 4); + mCamTypeNum = BSWAP32(*(int*)(typeData + 4)); field_0x0 = i_camera; field_0x20 = 1; @@ -2675,6 +2675,12 @@ void dCamera_c::setView(f32 i_xOrig, f32 i_yOrig, f32 i_width, f32 i_height) { window->setScissor(i_xOrig, i_yOrig, i_width, i_height); } +#if TARGET_PC +void dCamera_c::ResetView() { + setView(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight()); +} +#endif + cSAngle dCamera_c::forwardCheckAngle() { dBgS_CamLinChk lin_chk; cSAngle ret = cSAngle::_0; @@ -11087,7 +11093,7 @@ static int init_phase2(camera_class* i_this) { fopAcM_setStageLayer(player); dComIfGp_setWindowNum(1); - new (body) dCamera_c(i_this); + JKR_NEW_ARGS (body) dCamera_c(i_this); f32 var_f31 = 0.0f; f32 var_f30 = 160000.0f; diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 1777c742e4..4160cfcf63 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -893,20 +893,20 @@ int dComIfG_play_c::getLayerNo(int param_1) { } void dComIfG_play_c::createParticle() { - mParticle = new dPa_control_c(); + mParticle = JKR_NEW dPa_control_c(); JUT_ASSERT(1095, mParticle != NULL); } dSmplMdl_draw_c* dComIfG_play_c::createSimpleModel() { if (mSimpleModel == NULL) { - mSimpleModel = new dSmplMdl_draw_c(); + mSimpleModel = JKR_NEW dSmplMdl_draw_c(); } return mSimpleModel; } void dComIfG_play_c::deleteSimpleModel() { if (mSimpleModel != NULL) { - delete mSimpleModel; + JKR_DELETE(mSimpleModel); mSimpleModel = NULL; } } @@ -1160,7 +1160,7 @@ void dComIfG_inf_c::baseCsr_c::create() { if (m_navi) { return; } - m_navi = new navi_c(); + m_navi = JKR_NEW navi_c(); JUT_ASSERT(1517, m_navi != NULL); m_navi->create(); } @@ -1197,7 +1197,7 @@ void dComIfG_inf_c::ct() { #if PLATFORM_WII || PLATFORM_SHIELD void dComIfG_inf_c::createBaseCsr() { JUT_ASSERT(1622, m_baseCsr == NULL); - m_baseCsr = new baseCsr_c(1); + m_baseCsr = JKR_NEW baseCsr_c(1); JUT_ASSERT(1624, m_baseCsr != NULL); m_baseCsr->create(); mDoGph_gInf_c::entryBaseCsr(m_baseCsr); @@ -2260,7 +2260,7 @@ int dComIfGd_setShadow(u32 param_0, s8 param_1, J3DModel* param_2, cXyz* param_3 if (param_7 <= -G_CM3D_F_INF) { return 0; } else { - + param_0 = dComIfGd_setRealShadow(param_0, param_1, param_2, param_3, param_4, param_6 - param_7, param_9); return param_0; diff --git a/src/d/d_cursor_mng.cpp b/src/d/d_cursor_mng.cpp index 223d01bffc..fd921d6a22 100644 --- a/src/d/d_cursor_mng.cpp +++ b/src/d/d_cursor_mng.cpp @@ -1,7 +1,10 @@ +#include "JSystem/JKernel/JKRHeap.h" + #include "d/dolzel.h" // IWYU pragma: keep #include "d/d_cursor_mng.h" +#include "../../libs/JSystem/include/JSystem/JKernel/JKRHeap.h" #include "d/d_com_inf_game.h" dCsr_mng_c* dCsr_mng_c::m_myObj; @@ -100,7 +103,7 @@ void dCsr_mng_c::insideObjReleaseCheck_(void) { } void dCsr_mng_c::create(void) { - dCsr_mng_c* mng = new dCsr_mng_c(); + dCsr_mng_c* mng = JKR_NEW dCsr_mng_c(); m_myObj = mng; } @@ -242,7 +245,7 @@ BOOL dCsr_mng_c::list_c::isEntry(const node_c* i_node) const { dCsr_mng_c::bloObj_c::~bloObj_c() { if (m_panes != NULL) { - delete[] m_panes; + JKR_DELETE_ARRAY(m_panes); m_panes = NULL; } m_screen = NULL; @@ -274,7 +277,7 @@ BOOL dCsr_mng_c::bloObj_c::create(J2DScreen* i_screen, u16 i_mask, u8 i_priority m_screen = i_screen; m_pane_num = 0; calcPaneObjNum(i_screen); - m_panes = new paneObj_c[m_pane_num]; + m_panes = JKR_NEW paneObj_c[m_pane_num]; paneObj_c* sp08 = m_panes + m_pane_num; createPaneObj(&sp08, m_screen); return TRUE; diff --git a/src/d/d_debug_camera.cpp b/src/d/d_debug_camera.cpp index 10c5edd71f..f9c9409edc 100644 --- a/src/d/d_debug_camera.cpp +++ b/src/d/d_debug_camera.cpp @@ -727,7 +727,7 @@ int dDbgCamera_c::makeZevData() { field_0xb14 = 0; if (zevwork::WorkBuffer == NULL) { - zevwork::WorkBuffer = new u8[zevwork::WorkSize]; + zevwork::WorkBuffer = JKR_NEW u8[zevwork::WorkSize]; if (zevwork::WorkBuffer == NULL) { OSReport("debug camera: memory allocate error!! %d byte\n", zevwork::WorkSize); return 0; diff --git a/src/d/d_debug_viewer.cpp b/src/d/d_debug_viewer.cpp index eb873f483d..288e073259 100644 --- a/src/d/d_debug_viewer.cpp +++ b/src/d/d_debug_viewer.cpp @@ -17,7 +17,7 @@ J3DPacket* dDbVw_setDrawPacketList(J3DPacket* i_packet, int i_bufferType) { } if (l_drawPacketListNum >= 1000) { - delete (void*)i_packet; + JKR_DELETE((void*)i_packet); return NULL; } @@ -28,29 +28,29 @@ J3DPacket* dDbVw_setDrawPacketList(J3DPacket* i_packet, int i_bufferType) { void dDbVw_deleteDrawPacketList() { for (int i = 0; i < l_drawPacketListNum; i++) { - delete (void*)l_drawPacketList[i]; + JKR_DELETE((void*)l_drawPacketList[i]); } l_drawPacketListNum = 0; } void dDbVw_drawCube8p(int i_bufferType, cXyz* i_points, const GXColor& i_color) { - mDoExt_cube8pPacket* packet = new mDoExt_cube8pPacket(i_points, i_color); + mDoExt_cube8pPacket* packet = JKR_NEW mDoExt_cube8pPacket(i_points, i_color); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawCube(int i_bufferType, cXyz& i_pos, cXyz& i_size, csXyz& i_angle, const GXColor& i_color) { - mDoExt_cubePacket* packet = new mDoExt_cubePacket(i_pos, i_size, i_angle, i_color); + mDoExt_cubePacket* packet = JKR_NEW mDoExt_cubePacket(i_pos, i_size, i_angle, i_color); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawTriangle(int i_bufferType, cXyz* i_points, const GXColor& i_color, u8 i_clipZ) { - mDoExt_trianglePacket* packet = new mDoExt_trianglePacket(i_points, i_color, i_clipZ); + mDoExt_trianglePacket* packet = JKR_NEW mDoExt_trianglePacket(i_points, i_color, i_clipZ); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawQuad(int i_bufferType, cXyz* i_points, const GXColor& i_color, u8 i_clipZ) { - mDoExt_quadPacket* packet = new mDoExt_quadPacket(i_points, i_color, i_clipZ); + mDoExt_quadPacket* packet = JKR_NEW mDoExt_quadPacket(i_points, i_color, i_clipZ); dDbVw_setDrawPacketList(packet, i_bufferType); } @@ -75,42 +75,42 @@ void dDbVw_drawQuad(int i_bufferType, cXyz* param_1, cXyz* param_2, cXyz* i_pos, mDoMtx_stack_c::multVec(&points[i], &points[i]); } - mDoExt_quadPacket* packet = new mDoExt_quadPacket(points, i_color, i_clipZ); + mDoExt_quadPacket* packet = JKR_NEW mDoExt_quadPacket(points, i_color, i_clipZ); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawLine(int i_bufferType, cXyz& i_start, cXyz& i_end, const GXColor& i_color, u8 i_clipZ, u8 i_width) { - mDoExt_linePacket* packet = new mDoExt_linePacket(i_start, i_end, i_color, i_clipZ, i_width); + mDoExt_linePacket* packet = JKR_NEW mDoExt_linePacket(i_start, i_end, i_color, i_clipZ, i_width); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawArrow(int i_bufferType, cXyz& i_pos, cXyz& param_2, const GXColor& i_color, u8 i_clipZ, u8 i_width) { - mDoExt_ArrowPacket* packet = new mDoExt_ArrowPacket(i_pos, param_2, i_color, i_clipZ, i_width); + mDoExt_ArrowPacket* packet = JKR_NEW mDoExt_ArrowPacket(i_pos, param_2, i_color, i_clipZ, i_width); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawPoint(int i_bufferType, cXyz& i_pos, const GXColor& i_color, u8 i_clipZ, u8 i_width) { - mDoExt_pointPacket* packet = new mDoExt_pointPacket(i_pos, i_color, i_clipZ, i_width); + mDoExt_pointPacket* packet = JKR_NEW mDoExt_pointPacket(i_pos, i_color, i_clipZ, i_width); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawCircle(int i_bufferType, cXyz& i_pos, f32 i_radius, const GXColor& i_color, u8 i_clipZ, u8 i_width) { - mDoExt_circlePacket* packet = new mDoExt_circlePacket(i_pos, i_radius, i_color, i_clipZ, i_width); + mDoExt_circlePacket* packet = JKR_NEW mDoExt_circlePacket(i_pos, i_radius, i_color, i_clipZ, i_width); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawSphere(int i_bufferType, cXyz& i_pos, f32 i_size, const GXColor& i_color, u8 i_clipZ) { - mDoExt_spherePacket* packet = new mDoExt_spherePacket(i_pos, i_size, i_color, i_clipZ); + mDoExt_spherePacket* packet = JKR_NEW mDoExt_spherePacket(i_pos, i_size, i_color, i_clipZ); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawCylinder(int i_bufferType, cXyz& i_pos, f32 i_radius, f32 i_height, const GXColor& i_color, u8 i_clipZ) { - mDoExt_cylinderPacket* packet = new mDoExt_cylinderPacket(i_pos, i_radius, i_height, i_color, i_clipZ); + mDoExt_cylinderPacket* packet = JKR_NEW mDoExt_cylinderPacket(i_pos, i_radius, i_height, i_color, i_clipZ); dDbVw_setDrawPacketList(packet, i_bufferType); } void dDbVw_drawCylinderM(int i_bufferType, Mtx i_mtx, const GXColor& i_color, u8 i_clipZ) { - mDoExt_cylinderMPacket* packet = new mDoExt_cylinderMPacket(i_mtx, i_color, i_clipZ); + mDoExt_cylinderMPacket* packet = JKR_NEW mDoExt_cylinderMPacket(i_mtx, i_color, i_clipZ); dDbVw_setDrawPacketList(packet, i_bufferType); } diff --git a/src/d/d_demo.cpp b/src/d/d_demo.cpp index 3ac20443b5..25c54edca8 100644 --- a/src/d/d_demo.cpp +++ b/src/d/d_demo.cpp @@ -48,7 +48,7 @@ jstudio_tCreateObject_message::create(JStudio::TObject** ppObject, switch (type) { case 'JMSG': { - jstudio_tAdaptor_message* adaptor = new jstudio_tAdaptor_message(); + jstudio_tAdaptor_message* adaptor = JKR_NEW jstudio_tAdaptor_message(); if (adaptor == NULL) { return false; } @@ -215,6 +215,7 @@ int dDemo_actor_c::getDemoIDData(int* o_arg0, int* o_arg1, int* o_arg2, u16* o_r } u32 var_r31 = *it; + be_swap(var_r31); *o_arg0 = var_r31 >> 0x1E; *o_arg1 = (var_r31 >> 0x18) & 0xF; *o_arg2 = (var_r31 >> 0x10) & 0xF; @@ -676,7 +677,7 @@ JStage::TObject* dDemo_object_c::appendActor(fopAc_ac_c* p_actor) { return NULL; } - demoActor = new dDemo_actor_c(); + demoActor = JKR_NEW dDemo_actor_c(); if (demoActor == NULL) { // "Failed to get Demo Actor!!\n" OS_REPORT("デモアクター確保失敗!!\n"); @@ -709,7 +710,7 @@ dDemo_camera_c* dDemo_object_c::createCamera() { return mpCamera; } - mpCamera = new dDemo_camera_c(); + mpCamera = JKR_NEW dDemo_camera_c(); return mpCamera; } @@ -720,7 +721,7 @@ dDemo_camera_c* dDemo_object_c::createEditorCamera() { return mpEditorCamera; } - mpEditorCamera = new dDemo_camera_c(); + mpEditorCamera = JKR_NEW dDemo_camera_c(); return mpEditorCamera; } #endif @@ -740,7 +741,7 @@ JStage::TObject* dDemo_object_c::createAmbient() { return mpAmbient; } - mpAmbient = new dDemo_ambient_c(); + mpAmbient = JKR_NEW dDemo_ambient_c(); return mpAmbient; } @@ -751,7 +752,7 @@ JStage::TObject* dDemo_object_c::appendLight() { return NULL; } - dDemo_light_c* demoLight = new dDemo_light_c(); + dDemo_light_c* demoLight = JKR_NEW dDemo_light_c(); if (demoLight == NULL) { // "Failed to get Demo Light!!\n" OS_REPORT("デモライト確保失敗!!\n"); @@ -770,31 +771,31 @@ JStage::TObject* dDemo_object_c::createFog() { return mpFog; } - mpFog = new dDemo_fog_c(); + mpFog = JKR_NEW dDemo_fog_c(); return mpFog; } void dDemo_object_c::remove() { while (mActorNum != 0) { - delete mpActors[--mActorNum]; + JKR_DELETE(mpActors[--mActorNum]); } if (mpCamera != NULL) { - delete mpCamera; + JKR_DELETE(mpCamera); mpCamera = NULL; } if (mpAmbient != NULL) { - delete mpAmbient; + JKR_DELETE(mpAmbient); mpAmbient = NULL; } while (mLightNum != 0) { - delete mpLights[--mLightNum]; + JKR_DELETE(mpLights[--mLightNum]); } if (mpFog != NULL) { - delete mpFog; + JKR_DELETE(mpFog); mpFog = NULL; } } @@ -802,7 +803,7 @@ void dDemo_object_c::remove() { #if DEBUG void dDemo_object_c::removeEditorCamera() { if (mpEditorCamera) { - delete mpEditorCamera; + JKR_DELETE(mpEditorCamera); mpEditorCamera = NULL; } } @@ -877,33 +878,33 @@ int dDemo_system_c::JSGFindObject(JStage::TObject** p_TObj, char const* actorNam } void dDemo_c::create() { - m_system = new dDemo_system_c(); + m_system = JKR_NEW dDemo_system_c(); JUT_ASSERT(1774, m_system != NULL); - m_control = new JStudio::TControl(); + m_control = JKR_NEW JStudio::TControl(); JUT_ASSERT(1776, m_control != NULL); - m_mesgControl = new jmessage_tControl(); + m_mesgControl = JKR_NEW jmessage_tControl(); JUT_ASSERT(1778, m_mesgControl != NULL); - m_stage = new JStudio_JStage::TCreateObject(m_system); + m_stage = JKR_NEW JStudio_JStage::TCreateObject(m_system); JUT_ASSERT(1781, m_stage != NULL); - JStudio_JAudio2::TCreateObject* p_audio = new JStudio_JAudio2::TCreateObject(Z2GetSoundStarter(), m_system); + JStudio_JAudio2::TCreateObject* p_audio = JKR_NEW JStudio_JAudio2::TCreateObject(Z2GetSoundStarter(), m_system); m_audio = p_audio; JUT_ASSERT(1787, m_audio != NULL); p_audio->setPermit_onExit_notEnd(true); - m_particle = new dDemo_particle_c(dPa_control_c::getEmitterManager(), m_system); + m_particle = JKR_NEW dDemo_particle_c(dPa_control_c::getEmitterManager(), m_system); JUT_ASSERT(1794, m_particle != NULL); - m_message = new jstudio_tCreateObject_message(); + m_message = JKR_NEW jstudio_tCreateObject_message(); JUT_ASSERT(1797, m_message != NULL); - m_factory = new JStudio::TFactory(); + m_factory = JKR_NEW JStudio::TFactory(); JUT_ASSERT(1800, m_factory != NULL); - m_object = new dDemo_object_c(); + m_object = JKR_NEW dDemo_object_c(); JUT_ASSERT(1802, m_object != NULL); m_control->setSecondPerFrame(1.0f / 30.0f); @@ -923,47 +924,47 @@ void dDemo_c::remove() { end(); if (m_object != NULL) { - delete m_object; + JKR_DELETE(m_object); m_object = NULL; } if (m_factory != NULL) { - delete m_factory; + JKR_DELETE(m_factory); m_factory = NULL; } if (m_message != NULL) { - delete m_message; + JKR_DELETE(m_message); m_message = NULL; } if (m_particle != NULL) { - delete m_particle; + JKR_DELETE(m_particle); m_particle = NULL; } if (m_audio != NULL) { - delete m_audio; + JKR_DELETE(m_audio); m_audio = NULL; } if (m_stage != NULL) { - delete m_stage; + JKR_DELETE(m_stage); m_stage = NULL; } if (m_mesgControl != NULL) { - delete m_mesgControl; + JKR_DELETE(m_mesgControl); m_mesgControl = NULL; } if (m_control != NULL) { - delete m_control; + JKR_DELETE(m_control); m_control = NULL; } if (m_system != NULL) { - delete m_system; + JKR_DELETE(m_system); m_system = NULL; } } diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 71794623eb..af43e773af 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -5,6 +5,7 @@ #include "JSystem/J2DGraph/J2DGrafContext.h" #include "JSystem/J2DGraph/J2DScreen.h" #include "JSystem/J3DGraphBase/J3DDrawBuffer.h" +#include "JSystem/JKernel/JKRHeap.h" #include "SSystem/SComponent/c_bg_s_shdw_draw.h" #include "SSystem/SComponent/c_math.h" #include "d/d_com_inf_game.h" @@ -13,6 +14,7 @@ #include "m_Do/m_Do_graphic.h" #include "m_Do/m_Do_lib.h" #include "m_Do/m_Do_mtx.h" +#include "dusk/logging.h" class dDlst_2Dm_c { public: @@ -309,6 +311,9 @@ void dDlst_2DT_c::draw() { GXEnd(); GXSetClipMode(GX_CLIP_ENABLE); dComIfGp_getCurrentGrafPort()->setup2D(); +#if TARGET_PC + GXDestroyTexObj(&tex); +#endif } void dDlst_2DT2_c::draw() { @@ -710,6 +715,10 @@ void dDlst_2DM_c::draw() { GXTexCoord2s16(r27, r24); GXEnd(); dComIfGp_getCurrentGrafPort()->setup2D(); +#if TARGET_PC + GXDestroyTexObj(&tex[0]); + GXDestroyTexObj(&tex[1]); +#endif } @@ -868,9 +877,8 @@ dDlst_2D_c::dDlst_2D_c(ResTIMG* i_timg, s16 i_posX, s16 i_posY, s16 i_sizeX, s16 void dDlst_2D_c::draw() { static int s2DDrawLogCount = 0; if (s2DDrawLogCount < 10) { - printf("[DIAG] dDlst_2D_c::draw: pos=(%d,%d) size=(%d,%d) alpha=%d\n", + DuskLog.debug("dDlst_2D_c::draw: pos=({},{}) size=({},{}) alpha={}", mPosX, mPosY, mSizeX, mSizeY, mAlpha); - fflush(stdout); s2DDrawLogCount++; } mpPicture.setAlpha(mAlpha); @@ -883,7 +891,7 @@ void dDlst_blo_c::draw() { // stand-in for a function that pulls in a bunch of inline functions but was presumably stripped static void dummy_misc(J2DAnmBase* anmBase, J2DPicture* picture, J2DPane* pane, J2DScreen* screen) { - delete anmBase; + JKR_DELETE(anmBase); picture->setBlack(JUtility::TColor(0, 0, 0, 0)); picture->setWhite(JUtility::TColor(0, 0, 0, 0)); pane->getTypeID(); @@ -1030,14 +1038,14 @@ void dDlst_shadowPoly_c::draw() { } static J3DDrawBuffer* J3DDrawBuffer__create(u32 size) { - J3DDrawBuffer* buffer = new J3DDrawBuffer(); + J3DDrawBuffer* buffer = JKR_NEW J3DDrawBuffer(); if (buffer) { int error = buffer->allocBuffer(size); if (error == kJ3DError_Success) { return buffer; } - delete buffer; + JKR_DELETE(buffer); } return NULL; } @@ -1396,7 +1404,7 @@ void dDlst_shadowControl_c::init() { u16 size = l_realImageSize[i]; u32 buffer_size = GXGetTexBufferSize(size, size, 5, GX_DISABLE, 0); - field_0x15ef0[i] = new (0x20) u8[buffer_size]; + field_0x15ef0[i] = JKR_NEW_ARGS (0x20) u8[buffer_size]; GXInitTexObj(&field_0x15eb0[i], field_0x15ef0[i], size, size, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_DISABLE); GXInitTexObjLOD(&field_0x15eb0[i], GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, @@ -1442,7 +1450,11 @@ void dDlst_shadowControl_c::imageDraw(Mtx param_0) { GXCallDisplayList(l_matDL, 0x60); GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_DISABLE); GXSetZCompLoc(GX_TRUE); +#if TARGET_PC + GXSetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ONE, GX_LO_CLEAR); +#else GXSetBlendMode(GX_BM_LOGIC, GX_BL_ONE, GX_BL_ONE, GX_LO_OR); +#endif GXSetClipMode(GX_CLIP_DISABLE); j3dSys.setDrawModeOpaTexEdge(); J3DShape::resetVcdVatCache(); @@ -1762,7 +1774,7 @@ dDlst_list_c::~dDlst_list_c() { J3DDrawBuffer* tmp = *buffer; buffer++; - delete tmp; + JKR_DELETE(tmp); } } diff --git a/src/d/d_event_manager.cpp b/src/d/d_event_manager.cpp index 84af0a5d51..5343ee7ed3 100644 --- a/src/d/d_event_manager.cpp +++ b/src/d/d_event_manager.cpp @@ -1146,7 +1146,7 @@ int dEvent_manager_c::getMyActIdx(int staffId, const char* const* action, int n_ } int i; - char* nowCutName = getMyNowCutName(staffId); + char* nowCutName = getMyNowCutNameStr(staffId); if (nowCutName == NULL) { staff->field_0x3c = -1; // "event: getMyActIdx(): staff %s is not an active participant." @@ -1181,6 +1181,18 @@ int dEvent_manager_c::getMyActIdx(int staffId, const char* const* action, int n_ } char* dEvent_manager_c::getMyNowCutName(int staffId) { +#if TARGET_LITTLE_ENDIAN + static char buf[4] = {}; + memcpy(buf, getMyNowCutNameStr(staffId), 4); + std::swap(buf[0], buf[3]); + std::swap(buf[1], buf[2]); + return buf; +#else + return getMyNowCutNameStr(staffId); +#endif +} + +char* dEvent_manager_c::getMyNowCutNameStr(int staffId) { dEvDtCut_c* cut; if (dComIfGp_getEvent()->getMode() == dEvt_mode_WAIT_e) { if (OREG_F(8)) { diff --git a/src/d/d_file_sel_info.cpp b/src/d/d_file_sel_info.cpp index ca2387a071..f305f59a9e 100644 --- a/src/d/d_file_sel_info.cpp +++ b/src/d/d_file_sel_info.cpp @@ -23,23 +23,23 @@ dFile_info_c::dFile_info_c(JKRArchive* i_archive, u8 param_1) { } dFile_info_c::~dFile_info_c() { - delete mFileInfo.Scr; - delete mDatBase; - delete mNoDatBase; + JKR_DELETE(mFileInfo.Scr); + JKR_DELETE(mDatBase); + JKR_DELETE(mNoDatBase); mDoExt_removeMesgFont(); } void dFile_info_c::screenSet() { - mFileInfo.Scr = new J2DScreen(); + mFileInfo.Scr = JKR_NEW J2DScreen(); JUT_ASSERT(0, mFileInfo.Scr != NULL); mFileInfo.Scr->setPriority("zelda_file_select_info_text.blo", 0x1100000, mArchive); mFileInfo.mFont = mDoExt_getMesgFont(); mFileInfo.Scr->search(MULTI_CHAR('w_cp_ef1'))->hide(); mFileInfo.field_0x10 = mFileInfo.Scr->search(MULTI_CHAR('w_dat_i1')); - mDatBase = new CPaneMgrAlpha(mFileInfo.Scr, MULTI_CHAR('w_dat_i1'), 2, NULL); - mNoDatBase = new CPaneMgrAlpha(mFileInfo.Scr, MULTI_CHAR('w_nda_i1'), 2, NULL); + mDatBase = JKR_NEW CPaneMgrAlpha(mFileInfo.Scr, MULTI_CHAR('w_dat_i1'), 2, NULL); + mNoDatBase = JKR_NEW CPaneMgrAlpha(mFileInfo.Scr, MULTI_CHAR('w_nda_i1'), 2, NULL); J2DTextBox* info_text[4]; diff --git a/src/d/d_file_sel_warning.cpp b/src/d/d_file_sel_warning.cpp index 4fbce3920b..e2d767453b 100644 --- a/src/d/d_file_sel_warning.cpp +++ b/src/d/d_file_sel_warning.cpp @@ -25,10 +25,10 @@ dFile_warning_c::dFile_warning_c(JKRArchive* i_archive, u8 param_1) { } dFile_warning_c::~dFile_warning_c() { - delete mFileWarn.mMsgString; - delete mFileWarn.Scr; - delete field_0x24; - delete mpRootPane; + JKR_DELETE(mFileWarn.mMsgString); + JKR_DELETE(mFileWarn.Scr); + JKR_DELETE(field_0x24); + JKR_DELETE(mpRootPane); mDoExt_removeMesgFont(); } @@ -44,10 +44,10 @@ void dFile_warning_c::screenSet() { "zelda_option_set_up_window.bck", }; - mFileWarn.Scr = new J2DScreen(); + mFileWarn.Scr = JKR_NEW J2DScreen(); JUT_ASSERT(0, mFileWarn.Scr != NULL); - mFileWarn.mMsgString = new dMsgString_c(); + mFileWarn.mMsgString = JKR_NEW dMsgString_c(); JUT_ASSERT(0, mFileWarn.mMsgString != NULL); mFileWarn.Scr->setPriority(blo_name[field_0x3e], 0x100000, mpArchive); @@ -59,7 +59,7 @@ void dFile_warning_c::screenSet() { mFileWarn.Scr->animation(); mFileWarn.mFont = mDoExt_getMesgFont(); - mpRootPane = new CPaneMgr(mFileWarn.Scr, MULTI_CHAR('Nm_02'), 0, NULL); + mpRootPane = JKR_NEW CPaneMgr(mFileWarn.Scr, MULTI_CHAR('Nm_02'), 0, NULL); JUT_ASSERT(0, mpRootPane != NULL); field_0x34 = mpRootPane->getTranslateY(); diff --git a/src/d/d_file_select.cpp b/src/d/d_file_select.cpp index 55456ad826..0c5055b5ed 100644 --- a/src/d/d_file_select.cpp +++ b/src/d/d_file_select.cpp @@ -131,101 +131,101 @@ static dFs_HIO_c g_fsHIO; dFile_select_c::dFile_select_c(JKRArchive* i_archiveP) { mpArchive = i_archiveP; - mpFileSelect3d = new dFile_select3D_c(); + mpFileSelect3d = JKR_NEW dFile_select3D_c(); } dFile_select_c::~dFile_select_c() { int i; for (i = 0; i < 3; i++) { - delete mSelFileMoyoPane[i]; - delete mSelFileGoldPane[i]; - delete mSelFileGold2Pane[i]; - delete m3mSelPane_mo[i]; - delete m3mSelPane_g[i]; - delete m3mSelPane_gr[i]; - delete m3mSelTextPane[i]; - delete mSelFilePane_Book_l[i]; - delete mDeleteEfPane[i]; - delete mCopyEfPane[i]; - delete mSelFilePanes[i]; - delete m3mSelPane[i]; - delete mFileInfo[i]; + JKR_DELETE(mSelFileMoyoPane[i]); + JKR_DELETE(mSelFileGoldPane[i]); + JKR_DELETE(mSelFileGold2Pane[i]); + JKR_DELETE(m3mSelPane_mo[i]); + JKR_DELETE(m3mSelPane_g[i]); + JKR_DELETE(m3mSelPane_gr[i]); + JKR_DELETE(m3mSelTextPane[i]); + JKR_DELETE(mSelFilePane_Book_l[i]); + JKR_DELETE(mDeleteEfPane[i]); + JKR_DELETE(mCopyEfPane[i]); + JKR_DELETE(mSelFilePanes[i]); + JKR_DELETE(m3mSelPane[i]); + JKR_DELETE(mFileInfo[i]); } - delete mBaseMovePane; + JKR_DELETE(mBaseMovePane); for (i = 0; i < 2; i++) { - delete mYnSelPane[i]; - delete mYnSelPane_m[i]; - delete mYnSelPane_g[i]; - delete mYnSelPane_gr[i]; - delete mHeaderTxtPane[i]; - delete mErrorMsgTxtPane[i]; - delete mYnSelTxtPane[i]; - delete mCpFileInfo[i]; - delete mCpSelPane[i]; - delete mCpSelPane_moyo[i]; - delete mCpSelPane_gold[i]; - delete mCpSelPane_gold2[i]; - delete mCpSelPane_book[i]; + JKR_DELETE(mYnSelPane[i]); + JKR_DELETE(mYnSelPane_m[i]); + JKR_DELETE(mYnSelPane_g[i]); + JKR_DELETE(mYnSelPane_gr[i]); + JKR_DELETE(mHeaderTxtPane[i]); + JKR_DELETE(mErrorMsgTxtPane[i]); + JKR_DELETE(mYnSelTxtPane[i]); + JKR_DELETE(mCpFileInfo[i]); + JKR_DELETE(mCpSelPane[i]); + JKR_DELETE(mCpSelPane_moyo[i]); + JKR_DELETE(mCpSelPane_gold[i]); + JKR_DELETE(mCpSelPane_gold2[i]); + JKR_DELETE(mCpSelPane_book[i]); } - delete mBbtnPane; - delete mModoruTxtPane; - delete mAbtnPane; - delete mKetteiTxtPane; - delete mBaseMoveAnm; - delete field_0x0088; - delete mYnSelBck3; - delete mFileSelBpk; - delete mFileSel05Btk; - delete mSelFileBookBpk; - delete mSelFileBookBtk; - delete mSelFileBookBrk; - delete mDtEffBtk; - delete mCpEffBtk; - delete mCpDtEffBrk; - delete field_0x0090; - delete field_0x0094; - delete field_0x0098; - delete field_0x009c; + JKR_DELETE(mBbtnPane); + JKR_DELETE(mModoruTxtPane); + JKR_DELETE(mAbtnPane); + JKR_DELETE(mKetteiTxtPane); + JKR_DELETE(mBaseMoveAnm); + JKR_DELETE(field_0x0088); + JKR_DELETE(mYnSelBck3); + JKR_DELETE(mFileSelBpk); + JKR_DELETE(mFileSel05Btk); + JKR_DELETE(mSelFileBookBpk); + JKR_DELETE(mSelFileBookBtk); + JKR_DELETE(mSelFileBookBrk); + JKR_DELETE(mDtEffBtk); + JKR_DELETE(mCpEffBtk); + JKR_DELETE(mCpDtEffBrk); + JKR_DELETE(field_0x0090); + JKR_DELETE(field_0x0094); + JKR_DELETE(field_0x0098); + JKR_DELETE(field_0x009c); mDoExt_removeMesgFont(); mDoExt_removeSubFont(); - delete stick; - delete mSelIcon; - delete mSelIcon2; - delete mpName; - delete mpFileWarning; + JKR_DELETE(stick); + JKR_DELETE(mSelIcon); + JKR_DELETE(mSelIcon2); + JKR_DELETE(mpName); + JKR_DELETE(mpFileWarning); - delete mCpSelBck; - delete mCpSelBck2; - delete mCpSelBpk; - delete mCpSel03Btk; - delete mCpSelBookBpk; - delete mCpSelBookBtk; - delete mCpSelBookBrk; + JKR_DELETE(mCpSelBck); + JKR_DELETE(mCpSelBck2); + JKR_DELETE(mCpSelBpk); + JKR_DELETE(mCpSel03Btk); + JKR_DELETE(mCpSelBookBpk); + JKR_DELETE(mCpSelBookBtk); + JKR_DELETE(mCpSelBookBrk); - delete mYnSelBck; - delete mYnSelBck2; - delete mYnSelBpk; - delete mYnSelBtk; + JKR_DELETE(mYnSelBck); + JKR_DELETE(mYnSelBck2); + JKR_DELETE(mYnSelBpk); + JKR_DELETE(mYnSelBtk); - delete m3mBck; - delete m3mBck2; - delete m3mBpk; - delete m3mBtk; + JKR_DELETE(m3mBck); + JKR_DELETE(m3mBck2); + JKR_DELETE(m3mBpk); + JKR_DELETE(m3mBtk); - delete mSelDtBtk; - delete mSelDtPane_mset; + JKR_DELETE(mSelDtBtk); + JKR_DELETE(mSelDtPane_mset); mpFileSelect3d->_delete(); - delete mpFileSelect3d; + JKR_DELETE(mpFileSelect3d); #if PLATFORM_GCN - delete mpFadePict; + JKR_DELETE(mpFadePict); dComIfGp_getMain2DArchive()->removeResourceAll(); #endif @@ -239,7 +239,7 @@ void dFile_select_c::_create() { mDoGph_gInf_c::setFadeColor(static_cast(g_blackColor)); - stick = new STControl(2, 2, 1, 1, 0.9f, 0.5f, 0, 0x2000); + stick = JKR_NEW STControl(2, 2, 1, 1, 0.9f, 0.5f, 0, 0x2000); JUT_ASSERT(355, stick != NULL); g_fsHIO.no = mDoHIO_CREATE_CHILD("ファイルセレクト画面", &g_fsHIO); @@ -2927,7 +2927,7 @@ void dFile_select_c::screenSet() { static u64 l_tagName131[3] = {MULTI_CHAR('N_sel_00'), MULTI_CHAR('N_sel_01'), MULTI_CHAR('N_sel_02')}; - fileSel.Scr = new J2DScreen(); + fileSel.Scr = JKR_NEW J2DScreen(); JUT_ASSERT(4917, fileSel.Scr != NULL); fileSel.Scr->setPriority("zelda_file_select.blo", 0x1100000, mpArchive); dPaneClass_showNullPane(fileSel.Scr); @@ -2944,25 +2944,25 @@ void dFile_select_c::screenSet() { field_0x0090->searchUpdateMaterialID(fileSel.Scr); field_0x009c->searchUpdateMaterialID(fileSel.Scr); - mBaseMovePane = new CPaneMgr(fileSel.Scr, MULTI_CHAR('w_move_n'), 0, NULL); + mBaseMovePane = JKR_NEW CPaneMgr(fileSel.Scr, MULTI_CHAR('w_move_n'), 0, NULL); mBaseSubPane = fileSel.Scr->search(MULTI_CHAR('w_sub_n')); for (int i = 0; i < 3; i++) { - mSelFilePanes[i] = new CPaneMgr(fileSel.Scr, l_tagName0[i], 1, NULL); + mSelFilePanes[i] = JKR_NEW CPaneMgr(fileSel.Scr, l_tagName0[i], 1, NULL); } fileSel.Scr->search(MULTI_CHAR('Wi_btn_n'))->hide(); - mBbtnPane = new CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_n_bbtn'), 2, NULL); - mAbtnPane = new CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_n_abtn'), 2, NULL); + mBbtnPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_n_bbtn'), 2, NULL); + mAbtnPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_n_abtn'), 2, NULL); #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) - mModoruTxtPane = new CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_modo'), 2, NULL); - mKetteiTxtPane = new CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_kete'), 2, NULL); + mModoruTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_modo'), 2, NULL); + mKetteiTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('w_kete'), 2, NULL); fileSel.Scr->search(MULTI_CHAR('f_modo'))->hide(); fileSel.Scr->search(MULTI_CHAR('f_kete'))->hide(); #else - mModoruTxtPane = new CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('f_modo'), 2, NULL); - mKetteiTxtPane = new CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('f_kete'), 2, NULL); + mModoruTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('f_modo'), 2, NULL); + mKetteiTxtPane = JKR_NEW CPaneMgrAlpha(fileSel.Scr, MULTI_CHAR('f_kete'), 2, NULL); fileSel.Scr->search(MULTI_CHAR('w_modo'))->hide(); fileSel.Scr->search(MULTI_CHAR('w_kete'))->hide(); #endif @@ -2992,9 +2992,9 @@ void dFile_select_c::screenSet() { mSelFileBtk05Frame = 0; for (int i = 0; i < 3; i++) { - mSelFileMoyoPane[i] = new CPaneMgr(fileSel.Scr, l_tagName3[i], 0, NULL); - mSelFileGoldPane[i] = new CPaneMgr(fileSel.Scr, l_tagName4[i], 0, NULL); - mSelFileGold2Pane[i] = new CPaneMgr(fileSel.Scr, l_tagName5[i], 0, NULL); + mSelFileMoyoPane[i] = JKR_NEW CPaneMgr(fileSel.Scr, l_tagName3[i], 0, NULL); + mSelFileGoldPane[i] = JKR_NEW CPaneMgr(fileSel.Scr, l_tagName4[i], 0, NULL); + mSelFileGold2Pane[i] = JKR_NEW CPaneMgr(fileSel.Scr, l_tagName5[i], 0, NULL); mSelFileMoyoPane[i]->getPanePtr()->setAnimation(mFileSelBpk); mSelFileGoldPane[i]->getPanePtr()->setAnimation(mFileSelBpk); mSelFileGold2Pane[i]->getPanePtr()->setAnimation(mFileSelBpk); @@ -3021,7 +3021,7 @@ void dFile_select_c::screenSet() { mSelFileBookBtkFrame = 0; mSelFileBookBrkFrame = 0; for (int i = 0; i < 3; i++) { - mSelFilePane_Book_l[i] = new CPaneMgr(fileSel.Scr, l_tagName12[i], 0, NULL); + mSelFilePane_Book_l[i] = JKR_NEW CPaneMgr(fileSel.Scr, l_tagName12[i], 0, NULL); mSelFilePane_Book_l[i]->getPanePtr()->setAnimation(mSelFileBookBpk); mSelFilePane_Book_l[i]->getPanePtr()->setAnimation(mSelFileBookBtk); mSelFilePane_Book_l[i]->getPanePtr()->setAnimation(mSelFileBookBrk); @@ -3042,7 +3042,7 @@ void dFile_select_c::screenSet() { #endif for (int i = 0; i < 2; i++) { - mHeaderTxtPane[i] = new CPaneMgrAlpha(fileSel.Scr, l_tagName21[i], 0, NULL); + mHeaderTxtPane[i] = JKR_NEW CPaneMgrAlpha(fileSel.Scr, l_tagName21[i], 0, NULL); ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setFont(fileSel.font[0]); ((J2DTextBox*)mHeaderTxtPane[i]->getPanePtr())->setString(512, ""); #if VERSION == VERSION_GCN_JPN @@ -3075,8 +3075,8 @@ void dFile_select_c::screenSet() { mCpEffBtkFrame = 0; mCpDtEffBrkFrame = 0; for (int i = 0; i < 3; i++) { - mDeleteEfPane[i] = new CPaneMgrAlpha(fileSel.Scr, l_tagName18[i], 0, NULL); - mCopyEfPane[i] = new CPaneMgrAlpha(fileSel.Scr, l_tagName19[i], 0, NULL); + mDeleteEfPane[i] = JKR_NEW CPaneMgrAlpha(fileSel.Scr, l_tagName18[i], 0, NULL); + mCopyEfPane[i] = JKR_NEW CPaneMgrAlpha(fileSel.Scr, l_tagName19[i], 0, NULL); mDeleteEfPane[i]->getPanePtr()->setAnimation(mDtEffBtk); mDeleteEfPane[i]->getPanePtr()->setAnimation(mCpDtEffBrk); mCopyEfPane[i]->getPanePtr()->setAnimation(mCpEffBtk); @@ -3098,7 +3098,7 @@ void dFile_select_c::screenSet() { fileSel.Scr->search(MULTI_CHAR('w_er_msE'))->hide(); for (int i = 0; i < 2; i++) { - mErrorMsgTxtPane[i] = new CPaneMgrAlpha(fileSel.Scr, l_tagName20[i], 0, NULL); + mErrorMsgTxtPane[i] = JKR_NEW CPaneMgrAlpha(fileSel.Scr, l_tagName20[i], 0, NULL); ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setFont(fileSel.font[0]); ((J2DTextBox*)mErrorMsgTxtPane[i]->getPanePtr())->setString(512, ""); @@ -3124,7 +3124,7 @@ void dFile_select_c::screenSet() { mErrorMsgTxtPane[mErrorTxtDispIdx]->setAlpha(0xff); mErrorMsgTxtPane[mErrorTxtDispIdx ^ 1]->setAlpha(0); - mSelIcon = new dSelect_cursor_c(0, 1.0f, NULL); + mSelIcon = JKR_NEW dSelect_cursor_c(0, 1.0f, NULL); JUT_ASSERT(5209, mSelIcon != NULL); mSelIcon->setParam(0.96f, 0.94f, 0.03f, 0.7f, 0.7f); Vec vtxCenter; @@ -3148,23 +3148,23 @@ void dFile_select_c::screenSet() { J2DPane* selChildPanes[3]; for (int i = 0; i < 3; i++) { - selChildPanes[i] = new J2DPane(l_tagName13[i], JGeometry::TBox2(238.0f, 43.0f, 712.0f, 130.0f)); + selChildPanes[i] = JKR_NEW J2DPane(l_tagName13[i], JGeometry::TBox2(238.0f, 43.0f, 712.0f, 130.0f)); selChildPanes[i]->setUserInfo('n_43'); mSelFilePanes[i]->getPanePtr()->insertChild(fileSel.Scr->search(l_tagName131[i]), selChildPanes[i]); } for (int i = 0; i < 3; i++) { - mFileInfo[i] = new dFile_info_c(mpArchive, 0); + mFileInfo[i] = JKR_NEW dFile_info_c(mpArchive, 0); mFileInfo[i]->setBasePane(selChildPanes[i]); mFileInfoDatBasePane[i] = mFileInfo[i]->getDatBase(); mFileInfoNoDatBasePane[i] = mFileInfo[i]->getNoDatBase(); } mNameBasePane = fileSel.Scr->search(MULTI_CHAR('name_n')); - mpName = new dName_c(mNameBasePane); + mpName = JKR_NEW dName_c(mNameBasePane); field_0x0128 = false; - mpFileWarning = new dFile_warning_c(mpArchive, 0); + mpFileWarning = JKR_NEW dFile_warning_c(mpArchive, 0); mSelDt.mpPane = fileSel.Scr->search(MULTI_CHAR('w_moyo03')); #if PLATFORM_GCN @@ -3174,7 +3174,7 @@ void dFile_select_c::screenSet() { white.a = 0xff; ResTIMG* timg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpFadePict = new J2DPicture(MULTI_CHAR('PICT01'), JGeometry::TBox2(0.0f, FB_WIDTH, 0.0f, FB_HEIGHT), + mpFadePict = JKR_NEW J2DPicture(MULTI_CHAR('PICT01'), JGeometry::TBox2(0.0f, FB_WIDTH, 0.0f, FB_HEIGHT), timg, NULL); mpFadePict->setBlackWhite(black, white); mpFadePict->setAlpha(0); @@ -3189,7 +3189,7 @@ void dFile_select_c::screenSetCopySel() { static u64 l_tagName004[2] = {MULTI_CHAR('w_bk_l01'), MULTI_CHAR('w_bk_l02')}; static u64 l_tagName005[2] = {MULTI_CHAR('w_cp_ef1'), MULTI_CHAR('w_cp_ef2')}; - mCpSel.Scr = new J2DScreen(); + mCpSel.Scr = JKR_NEW J2DScreen(); JUT_ASSERT(5286, mCpSel.Scr != NULL); mCpSel.Scr->setPriority("zelda_file_select_copy_select.blo", 0x1100000, mpArchive); @@ -3231,11 +3231,11 @@ void dFile_select_c::screenSetCopySel() { mCpSelBookBrkFrame = 0; for (int i = 0; i < 2; i++) { - mCpSelPane[i] = new CPaneMgr(mCpSel.Scr, l_tagName000[i], 0, NULL); - mCpSelPane_moyo[i] = new CPaneMgr(mCpSel.Scr, l_tagName001[i], 0, NULL); - mCpSelPane_gold[i] = new CPaneMgr(mCpSel.Scr, l_tagName002[i], 0, NULL); - mCpSelPane_gold2[i] = new CPaneMgr(mCpSel.Scr, l_tagName003[i], 0, NULL); - mCpSelPane_book[i] = new CPaneMgr(mCpSel.Scr, l_tagName004[i], 0, NULL); + mCpSelPane[i] = JKR_NEW CPaneMgr(mCpSel.Scr, l_tagName000[i], 0, NULL); + mCpSelPane_moyo[i] = JKR_NEW CPaneMgr(mCpSel.Scr, l_tagName001[i], 0, NULL); + mCpSelPane_gold[i] = JKR_NEW CPaneMgr(mCpSel.Scr, l_tagName002[i], 0, NULL); + mCpSelPane_gold2[i] = JKR_NEW CPaneMgr(mCpSel.Scr, l_tagName003[i], 0, NULL); + mCpSelPane_book[i] = JKR_NEW CPaneMgr(mCpSel.Scr, l_tagName004[i], 0, NULL); mCpSelPane_moyo[i]->getPanePtr()->setAnimation(mCpSelBpk); mCpSelPane_gold[i]->getPanePtr()->setAnimation(mCpSelBpk); @@ -3255,7 +3255,7 @@ void dFile_select_c::screenSetCopySel() { namePane->animationTransform(); namePane->setAnimation((J2DAnmTransform*)NULL); - mSelIcon2 = new dSelect_cursor_c(0, 1.0f, NULL); + mSelIcon2 = JKR_NEW dSelect_cursor_c(0, 1.0f, NULL); JUT_ASSERT(5406, mSelIcon2 != NULL); mSelIcon2->setParam(0.96f, 0.94f, 0.03f, 0.7f, 0.7f); Vec center = mCpSelPane[0]->getGlobalVtxCenter(false, 0); @@ -3263,7 +3263,7 @@ void dFile_select_c::screenSetCopySel() { mSelIcon2->setAlphaRate(0.0f); for (int i = 0; i < 2; i++) { - mCpFileInfo[i] = new dFile_info_c(mpArchive, 0); + mCpFileInfo[i] = JKR_NEW dFile_info_c(mpArchive, 0); mCpFileInfo[i]->setBasePane(mCpSel.Scr->search(l_tagName13[i + 1])); } @@ -3282,7 +3282,7 @@ void dFile_select_c::screenSetYesNo() { static u64 l_tagName11[2] = {MULTI_CHAR('w_no_gr'), MULTI_CHAR('w_yes_gr')}; static u8 l_msgNum2[2] = {0x08, 0x07}; - mYnSel.ScrYn = new J2DScreen(); + mYnSel.ScrYn = JKR_NEW J2DScreen(); JUT_ASSERT(5435, mYnSel.ScrYn != NULL); mYnSel.ScrYn->setPriority("zelda_file_select_yes_no_window.blo", 0x1100000, mpArchive); dPaneClass_showNullPane(mYnSel.ScrYn); @@ -3296,12 +3296,12 @@ void dFile_select_c::screenSetYesNo() { mYnSelBck3->searchUpdateMaterialID(mYnSel.ScrYn); for (int i = 0; i < 2; i++) { - mYnSelPane[i] = new CPaneMgr(mYnSel.ScrYn, l_tagName012[i], 0, NULL); + mYnSelPane[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName012[i], 0, NULL); #if VERSION == VERSION_GCN_JPN - mYnSelTxtPane[i] = new CPaneMgr(mYnSel.ScrYn, l_tagName013[i], 0, NULL); + mYnSelTxtPane[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName013[i], 0, NULL); mYnSel.ScrYn->search(l_tagName013U[i])->hide(); #else - mYnSelTxtPane[i] = new CPaneMgr(mYnSel.ScrYn, l_tagName013U[i], 0, NULL); + mYnSelTxtPane[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName013U[i], 0, NULL); mYnSel.ScrYn->search(l_tagName013[i])->hide(); #endif ((J2DTextBox*)mYnSelTxtPane[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); @@ -3324,9 +3324,9 @@ void dFile_select_c::screenSetYesNo() { mYnSelBtkFrame = 0; for (int i = 0; i < 2; i++) { - mYnSelPane_m[i] = new CPaneMgr(mYnSel.ScrYn, l_tagName9[i], 0, NULL); - mYnSelPane_g[i] = new CPaneMgr(mYnSel.ScrYn, l_tagName10[i], 0, NULL); - mYnSelPane_gr[i] = new CPaneMgr(mYnSel.ScrYn, l_tagName11[i], 0, NULL); + mYnSelPane_m[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName9[i], 0, NULL); + mYnSelPane_g[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName10[i], 0, NULL); + mYnSelPane_gr[i] = JKR_NEW CPaneMgr(mYnSel.ScrYn, l_tagName11[i], 0, NULL); mYnSelPane_m[i]->getPanePtr()->setAnimation(mYnSelBpk); mYnSelPane_g[i]->getPanePtr()->setAnimation(mYnSelBpk); @@ -3345,7 +3345,7 @@ void dFile_select_c::screenSet3Menu() { static u64 l_tagName011U[3] = {MULTI_CHAR('f_sta'), MULTI_CHAR('f_del'), MULTI_CHAR('f_cop_t')}; static u8 l_msgNum[3] = {0x57, 0x58, 0x56}; - m3mSel.Scr3m = new J2DScreen(); + m3mSel.Scr3m = JKR_NEW J2DScreen(); JUT_ASSERT(5530, m3mSel.Scr3m != NULL); m3mSel.Scr3m->setPriority("zelda_file_select_3menu_window.blo", 0x1100000, mpArchive); dPaneClass_showNullPane(m3mSel.Scr3m); @@ -3374,12 +3374,12 @@ void dFile_select_c::screenSet3Menu() { m3mMenuPane->animationTransform(); for (int i = 0; i < 3; i++) { - m3mSelPane[i] = new CPaneMgr(m3mSel.Scr3m, l_tagName1[i], 0, NULL); + m3mSelPane[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName1[i], 0, NULL); #if VERSION == VERSION_GCN_JPN - m3mSelTextPane[i] = new CPaneMgr(m3mSel.Scr3m, l_tagName011[i], 0, NULL); + m3mSelTextPane[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName011[i], 0, NULL); m3mSel.Scr3m->search(l_tagName011U[i])->hide(); #else - m3mSelTextPane[i] = new CPaneMgr(m3mSel.Scr3m, l_tagName011U[i], 0, NULL); + m3mSelTextPane[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName011U[i], 0, NULL); m3mSel.Scr3m->search(l_tagName011[i])->hide(); #endif @@ -3388,9 +3388,9 @@ void dFile_select_c::screenSet3Menu() { fopMsgM_messageGet(textbuf, l_msgNum[i]); ((J2DTextBox*)m3mSelTextPane[i]->getPanePtr())->setString(textbuf); - m3mSelPane_mo[i] = new CPaneMgr(m3mSel.Scr3m, l_tagName6[i], 0, NULL); - m3mSelPane_g[i] = new CPaneMgr(m3mSel.Scr3m, l_tagName7[i], 0, NULL); - m3mSelPane_gr[i] = new CPaneMgr(m3mSel.Scr3m, l_tagName8[i], 0, NULL); + m3mSelPane_mo[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName6[i], 0, NULL); + m3mSelPane_g[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName7[i], 0, NULL); + m3mSelPane_gr[i] = JKR_NEW CPaneMgr(m3mSel.Scr3m, l_tagName8[i], 0, NULL); m3mSelPane_mo[i]->getPanePtr()->setAnimation(m3mBpk); m3mSelPane_g[i]->getPanePtr()->setAnimation(m3mBpk); @@ -3402,7 +3402,7 @@ void dFile_select_c::screenSet3Menu() { } void dFile_select_c::screenSetDetail() { - mSelDt.ScrDt = new J2DScreen(); + mSelDt.ScrDt = JKR_NEW J2DScreen(); JUT_ASSERT(5622, mSelDt.ScrDt != NULL); mSelDt.ScrDt->setPriority("zelda_file_select_details.blo", 0x1100000, mpArchive); @@ -3413,7 +3413,7 @@ void dFile_select_c::screenSetDetail() { mSelDtBtkFrame = 0; mSelDt.mpPane2 = mSelDt.ScrDt->search(MULTI_CHAR('n_all')); - mSelDtPane_mset = new CPaneMgr(mSelDt.ScrDt, MULTI_CHAR('mset_p_n'), 0, NULL); + mSelDtPane_mset = JKR_NEW CPaneMgr(mSelDt.ScrDt, MULTI_CHAR('mset_p_n'), 0, NULL); mpFileSelect3d->setBasePane(mSelDtPane_mset); mpFileSelect3d->setBase2Pane(fileSel.Scr->search(MULTI_CHAR('w_sub_n'))); @@ -5263,12 +5263,12 @@ void dFile_select3D_c::setJ3D(char const* param_0, char const* param_1, char con JUT_ASSERT(8823, modelData != NULL); for (u16 i = 0; i < modelData->getMaterialNum(); i++) { - material = new J3DMaterialAnm(); + material = JKR_NEW J3DMaterialAnm(); modelData->getMaterialNodePointer(i)->change(); modelData->getMaterialNodePointer(i)->setMaterialAnm(material); } - mpModel = new J3DModel(modelData, 0, 1); + mpModel = JKR_NEW J3DModel(modelData, 0, 1); JUT_ASSERT(8836, mpModel != NULL); if (param_1) { @@ -5276,7 +5276,7 @@ void dFile_select3D_c::setJ3D(char const* param_0, char const* param_1, char con anmBase = (J3DAnmTransform*)J3DAnmLoaderDataBase::load(bckRes); JUT_ASSERT(8846, anmBase != NULL); - mBckAnm = new mDoExt_bckAnm(); + mBckAnm = JKR_NEW mDoExt_bckAnm(); if (mBckAnm == NULL || !mBckAnm->init((J3DAnmTransform*)anmBase, 1, 2, 1.0f, 0, -1, false)) { return; @@ -5289,7 +5289,7 @@ void dFile_select3D_c::setJ3D(char const* param_0, char const* param_1, char con JUT_ASSERT(8859, anmBase != NULL); ((J3DAnmTevRegKey*)anmBase)->searchUpdateMaterialID(modelData); - mBrkAnm = new mDoExt_brkAnm(); + mBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mBrkAnm == NULL || !mBrkAnm->init(modelData, (J3DAnmTevRegKey*)anmBase, -1, 2, 1.0f, 0, -1)) { diff --git a/src/d/d_gameover.cpp b/src/d/d_gameover.cpp index 4275dbe3f5..762c8b01fd 100644 --- a/src/d/d_gameover.cpp +++ b/src/d/d_gameover.cpp @@ -142,8 +142,8 @@ int dGameover_c::_create() { JKRHeap* old_heap = mDoExt_setCurrentHeap(mpHeap); int temp = mpHeap->getTotalFreeSize(); - dgo_screen_c = new dDlst_GameOverScrnDraw_c(resInfo->getArchive()); - dMs_c = new dMenu_save_c(); + dgo_screen_c = JKR_NEW dDlst_GameOverScrnDraw_c(resInfo->getArchive()); + dMs_c = JKR_NEW dMenu_save_c(); JUT_ASSERT(0, dMs_c != NULL); if (dMeter2Info_getGameOverType() == 1) { @@ -162,7 +162,7 @@ int dGameover_c::_create() { } dMs_c->_create(); - dgo_capture_c = new dDlst_Gameover_CAPTURE_c(); + dgo_capture_c = JKR_NEW dDlst_Gameover_CAPTURE_c(); JUT_ASSERT(0, dgo_capture_c != NULL); OS_REPORT("game over create size ===> %d\n", temp - mpHeap->getTotalFreeSize()); @@ -345,13 +345,13 @@ int dGameover_c::_delete() { JKRHeap* old_heap = mDoExt_setCurrentHeap(mpHeap); if (dgo_screen_c != NULL) { - delete dgo_screen_c; + JKR_DELETE(dgo_screen_c); dgo_screen_c = NULL; } dMs_c->_delete(); - delete dMs_c; - delete dgo_capture_c; + JKR_DELETE(dMs_c); + JKR_DELETE(dgo_capture_c); mpHeap->freeAll(); dComIfGp_offHeapLockFlag(0); @@ -362,7 +362,7 @@ int dGameover_c::_delete() { } dDlst_GameOverScrnDraw_c::dDlst_GameOverScrnDraw_c(JKRArchive* i_archive) { - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); mpScreen->setPriority("zelda_game_over.blo", 0x100000, i_archive); dPaneClass_showNullPane(mpScreen); @@ -385,7 +385,7 @@ dDlst_GameOverScrnDraw_c::dDlst_GameOverScrnDraw_c(JKRArchive* i_archive) { ResTIMG* img = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); mpBackImg = - new J2DPicture(MULTI_CHAR('PICT01'), JGeometry::TBox2(0.0f, 486.0f, 0.0f, 660.0f), img, NULL); + JKR_NEW J2DPicture(MULTI_CHAR('PICT01'), JGeometry::TBox2(0.0f, 486.0f, 0.0f, 660.0f), img, NULL); mpBackImg->setBlackWhite(img_white, img_black); J2DTextBox* gold_tbox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('gold_00')); @@ -395,14 +395,14 @@ dDlst_GameOverScrnDraw_c::dDlst_GameOverScrnDraw_c(JKRArchive* i_archive) { dMeter2Info_getString(0x381, string, NULL); gold_tbox->setString(string); - mpLight = new dMsgScrnLight_c(6, 0xFF); + mpLight = JKR_NEW dMsgScrnLight_c(6, 0xFF); field_0x10 = 0.0f; } dDlst_GameOverScrnDraw_c::~dDlst_GameOverScrnDraw_c() { - delete mpBackImg; - delete mpScreen; + JKR_DELETE(mpBackImg); + JKR_DELETE(mpScreen); dComIfGp_getMain2DArchive()->removeResourceAll(); } diff --git a/src/d/d_home_button.cpp b/src/d/d_home_button.cpp index c8fe9e5b1b..45a1c86ad9 100644 --- a/src/d/d_home_button.cpp +++ b/src/d/d_home_button.cpp @@ -164,7 +164,7 @@ void dHomeButton_c::onReset() { } void dHomeButton_c::create(int param_0, void* param_1) { - m_myObj = new dHomeButton_c(); + m_myObj = JKR_NEW dHomeButton_c(); m_myObj->create_(param_0, param_1); } diff --git a/src/d/d_jcam_editor.cpp b/src/d/d_jcam_editor.cpp index 4700fdbe10..2d0d315e73 100644 --- a/src/d/d_jcam_editor.cpp +++ b/src/d/d_jcam_editor.cpp @@ -5,13 +5,13 @@ dJcame_c* dJcame_c::m_myObj; dJcame_c::dJcame_c(const JStage::TSystem* i_system, f32 param_1, JUTGamePad& i_pad) { - mOrthoGraph = new J2DOrthoGraph(0.0f, 0.0f, 608.0f, 448.0f, -1.0f, 1.0f); - mFont = new JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL); + mOrthoGraph = JKR_NEW J2DOrthoGraph(0.0f, 0.0f, 608.0f, 448.0f, -1.0f, 1.0f); + mFont = JKR_NEW JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL); mHeap = JKRExpHeap::create(0x100000, JKRHeap::getRootHeap2(), false); JUT_ASSERT(54, mHeap != NULL); - mControl = new JStudioCameraEditor::TControl(); + mControl = JKR_NEW JStudioCameraEditor::TControl(); mHioId = mDoHIO_createChild("JStudioCameraEditor", mControl); JUT_ASSERT(57, mControl != NULL); @@ -29,29 +29,29 @@ dJcame_c::dJcame_c(const JStage::TSystem* i_system, f32 param_1, JUTGamePad& i_p dJcame_c::~dJcame_c() { if (mAdaptor != NULL) { - delete mAdaptor; + JKR_DELETE(mAdaptor); } mControl->jstudio_setAdaptor(NULL); mDoHIO_deleteChild(mHioId); - delete mControl; + JKR_DELETE(mControl); mHeap->destroy(); - delete mFont; - delete mOrthoGraph; + JKR_DELETE(mFont); + JKR_DELETE(mOrthoGraph); m_myObj = NULL; } void dJcame_c::create(const JStage::TSystem* i_system, f32 param_1, JUTGamePad& i_pad) { JUT_ASSERT(109, m_myObj == NULL); - new dJcame_c(i_system, param_1, i_pad); + JKR_NEW dJcame_c(i_system, param_1, i_pad); JUT_ASSERT(111, m_myObj != NULL); } void dJcame_c::remove() { JUT_ASSERT(126, m_myObj != NULL); - delete m_myObj; + JKR_DELETE(m_myObj); } void dJcame_c::update() { @@ -63,7 +63,7 @@ void dJcame_c::update() { return; } - mAdaptor = new JStudio_JStage::TAdaptor_camera(mSystem, (JStage::TCamera*)object); + mAdaptor = JKR_NEW JStudio_JStage::TAdaptor_camera(mSystem, (JStage::TCamera*)object); JUT_ASSERT(155, mAdaptor != NULL); mControl->jstudio_setAdaptor(mAdaptor); diff --git a/src/d/d_jnt_col.cpp b/src/d/d_jnt_col.cpp index 7cf0d4af2b..b8aff7ed48 100644 --- a/src/d/d_jnt_col.cpp +++ b/src/d/d_jnt_col.cpp @@ -207,7 +207,7 @@ void dJntCol_HIO_c::update() { } void dJntCol_HIO_c::fileOut() { - char* buffer = new(0x20) char[0x10000]; + char* buffer = JKR_NEW_ARGS(0x20) char[0x10000]; if (!buffer) { OSReport("書き込み用領域確保できませんでした\n"); return; @@ -266,7 +266,7 @@ void dJntCol_HIO_c::fileOut() { } else { OSReport("書き込みファイルが開けません\n"); } - delete[] buffer; + JKR_DELETE_ARRAY(buffer); } #endif diff --git a/src/d/d_jpreviewer.cpp b/src/d/d_jpreviewer.cpp index 5321d02f89..ad15e50191 100644 --- a/src/d/d_jpreviewer.cpp +++ b/src/d/d_jpreviewer.cpp @@ -32,15 +32,15 @@ public: }; dJprev_c::dJprev_c(JStudio::TControl* param_1, const JUTGamePad& param_2) { - mOrthoGraph = new J2DOrthoGraph(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f); + mOrthoGraph = JKR_NEW J2DOrthoGraph(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f); JUT_ASSERT(72, mOrthoGraph != NULL) - mFont = new JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL); + mFont = JKR_NEW JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL); JUT_ASSERT(74, mFont != NULL) - m_parse = new tParse_(); + m_parse = JKR_NEW tParse_(); JUT_ASSERT(76, m_parse != NULL) mHeap = JKRExpHeap::create(0x100000, JKRHeap::getRootHeap2(), NULL); JUT_ASSERT(82, mHeap != NULL) - mControl = new dJprevCtrl_c(); + mControl = JKR_NEW dJprevCtrl_c(); JUT_ASSERT(86, mControl != NULL) mHIOId = mDoHIO_createChild("JStudioPreviewer", mControl); mControl->interface_setPad(¶m_2); @@ -53,23 +53,23 @@ dJprev_c::dJprev_c(JStudio::TControl* param_1, const JUTGamePad& param_2) { dJprev_c::~dJprev_c() { mDoHIO_deleteChild(mHIOId); - delete mControl; + JKR_DELETE(mControl); mHeap->destroy(); - delete m_parse; - delete mFont; - delete mOrthoGraph; + JKR_DELETE(m_parse); + JKR_DELETE(mFont); + JKR_DELETE(mOrthoGraph); m_myObj = NULL; } void dJprev_c::create(JStudio::TControl* pControl, const JUTGamePad& pad) { JUT_ASSERT(130, m_myObj == NULL); - new dJprev_c(pControl, pad); + JKR_NEW dJprev_c(pControl, pad); JUT_ASSERT(132, m_myObj != NULL); } void dJprev_c::remove() { JUT_ASSERT(147, m_myObj != NULL); - delete m_myObj; + JKR_DELETE(m_myObj); } void dJprev_c::update() { diff --git a/src/d/d_k_wmark.cpp b/src/d/d_k_wmark.cpp index a619943ccc..4594622b95 100644 --- a/src/d/d_k_wmark.cpp +++ b/src/d/d_k_wmark.cpp @@ -18,7 +18,7 @@ int dkWmark_c::m_nowID; int dkWmark_c::create() { static cXyz wolfFootScale(1.1f, 1.0f, 0.6f); - new (this) dkWmark_c(); + JKR_NEW_ARGS (this) dkWmark_c(); field_0x48a = this->parameters >> 0x10; this->parameters &= 0xFFFF; diff --git a/src/d/d_k_wpillar.cpp b/src/d/d_k_wpillar.cpp index b89783c6ee..bb70b50cf9 100644 --- a/src/d/d_k_wpillar.cpp +++ b/src/d/d_k_wpillar.cpp @@ -8,7 +8,7 @@ static const char l_arcName[] = "Always"; int dkWpillar_c::create() { - new (this) dkWpillar_c(); + JKR_NEW_ARGS (this) dkWpillar_c(); int roomNo; u8 envrOverride; diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index 2cdd9b58d0..df6175b237 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -1179,7 +1179,7 @@ static void undwater_init() { g_env_light.undwater_ef_model = mDoExt_J3DModel__create(modelData2, 0x80000, 0x11020202); if (g_env_light.undwater_ef_model != NULL) { - g_env_light.undwater_btk = new mDoExt_btkAnm(); + g_env_light.undwater_btk = JKR_NEW mDoExt_btkAnm(); if (g_env_light.undwater_btk != NULL) { if (!g_env_light.undwater_btk->init(modelData2, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Always", 0x3C), TRUE, @@ -9691,6 +9691,11 @@ void dKy_ParticleColor_get_base(cXyz* param_0, dKy_tevstr_c* param_1, GXColor* p #endif f32 var_f31; + + #if AVOID_UB + var_f31 = 0; + #endif + if (dKy_SunMoon_Light_Check() == TRUE && i <= 1) { if (g_env_light.daytime >= 90.0f && g_env_light.daytime <= 285.0f) { if (i == 0) { diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index 8150e82887..4ed11a4411 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -1226,7 +1226,7 @@ void dKyr_housi_move() { void dKyr_snow_init() { camera_class* camera = (camera_class*)dComIfGp_getCamera(0); - g_env_light.mpSnowPacket = new (32) dKankyo_snow_Packet(); + g_env_light.mpSnowPacket = JKR_NEW_ARGS (32) dKankyo_snow_Packet(); if (g_env_light.mpSnowPacket == NULL) { return; @@ -1520,7 +1520,7 @@ void dKyr_snow_move() { void dKyr_star_init() { camera_class* camera = (camera_class*)dComIfGp_getCamera(0); - g_env_light.mpStarPacket = new (32) dKankyo_star_Packet(); + g_env_light.mpStarPacket = JKR_NEW_ARGS (32) dKankyo_star_Packet(); if (g_env_light.mpStarPacket == NULL) { return; diff --git a/src/d/d_kankyo_wether.cpp b/src/d/d_kankyo_wether.cpp index 5ab08fd2b0..ad8a70abf1 100644 --- a/src/d/d_kankyo_wether.cpp +++ b/src/d/d_kankyo_wether.cpp @@ -316,50 +316,50 @@ void dKyw_wether_init2() { void dKyw_wether_delete() { if (g_env_light.mSunInitialized) { - delete g_env_light.mpSunPacket; - delete g_env_light.mpSunLenzPacket; + JKR_DELETE(g_env_light.mpSunPacket); + JKR_DELETE(g_env_light.mpSunLenzPacket); g_env_light.mpSunPacket = NULL; g_env_light.mpSunLenzPacket = NULL; } if (g_env_light.mRainInitialized) { - delete g_env_light.mpRainPacket; + JKR_DELETE(g_env_light.mpRainPacket); g_env_light.mpRainPacket = NULL; } if (g_env_light.mSnowInitialized) { - delete g_env_light.mpSnowPacket; + JKR_DELETE(g_env_light.mpSnowPacket); g_env_light.mpSnowPacket = NULL; g_env_light.field_0xe90 = 0; } if (g_env_light.mStarInitialized) { - delete g_env_light.mpStarPacket; + JKR_DELETE(g_env_light.mpStarPacket); g_env_light.mpStarPacket = NULL; } if (g_env_light.mHousiInitialized) { - delete g_env_light.mpHousiPacket; + JKR_DELETE(g_env_light.mpHousiPacket); g_env_light.mpHousiPacket = NULL; } if (g_env_light.mCloudInitialized) { - delete g_env_light.mpCloudPacket; + JKR_DELETE(g_env_light.mpCloudPacket); g_env_light.mpCloudPacket = NULL; } if (g_env_light.mOdourData.mOdourPacketStatus) { - delete g_env_light.mOdourData.mpOdourPacket; + JKR_DELETE(g_env_light.mOdourData.mpOdourPacket); g_env_light.mOdourData.mpOdourPacket = NULL; } if (g_env_light.mMudInitialized) { - delete g_env_light.mpMudPacket; + JKR_DELETE(g_env_light.mpMudPacket); g_env_light.mpMudPacket = NULL; } if (g_env_light.mEvilInitialized) { - delete g_env_light.mpEvilPacket; + JKR_DELETE(g_env_light.mpEvilPacket); g_env_light.mpEvilPacket = NULL; } } @@ -386,7 +386,7 @@ dKankyo_sun_Packet::~dKankyo_sun_Packet() {} void dKyw_wether_delete2() { if (g_env_light.mVrkumoStatus != 0) { - delete g_env_light.mpVrkumoPacket; + JKR_DELETE(g_env_light.mpVrkumoPacket); g_env_light.mpVrkumoPacket = NULL; } } @@ -433,8 +433,8 @@ static void wether_move_sun() { switch (g_env_light.mSunInitialized) { case FALSE: if (sunVisible && dKy_darkworld_check() != true) { - g_env_light.mpSunPacket = new (0x20) dKankyo_sun_Packet(); - g_env_light.mpSunLenzPacket = new (0x20) dKankyo_sunlenz_Packet(); + g_env_light.mpSunPacket = JKR_NEW_ARGS (0x20) dKankyo_sun_Packet(); + g_env_light.mpSunLenzPacket = JKR_NEW_ARGS (0x20) dKankyo_sunlenz_Packet(); if (g_env_light.mpSunPacket != NULL && g_env_light.mpSunLenzPacket != NULL) { g_env_light.mpSunPacket->mpResMoon = (u8*)dComIfG_getStageRes("F_moon.bti"); g_env_light.mpSunPacket->mpResMoon_A = (u8*)dComIfG_getStageRes("F_moon_A.bti"); @@ -499,8 +499,8 @@ static void wether_move_sun() { case TRUE: if (!sunVisible) { g_env_light.mSunInitialized = false; - delete g_env_light.mpSunPacket; - delete g_env_light.mpSunLenzPacket; + JKR_DELETE(g_env_light.mpSunPacket); + JKR_DELETE(g_env_light.mpSunLenzPacket); g_env_light.mpSunPacket = NULL; g_env_light.mpSunLenzPacket = NULL; } else { @@ -516,7 +516,7 @@ static void wether_move_rain() { switch (g_env_light.mRainInitialized) { case FALSE: if (g_env_light.raincnt > 3) { - g_env_light.mpRainPacket = new (32) dKankyo_rain_Packet(); + g_env_light.mpRainPacket = JKR_NEW_ARGS (32) dKankyo_rain_Packet(); if (g_env_light.mpRainPacket != NULL) { dKyr_rain_init(); @@ -547,7 +547,7 @@ static void wether_move_rain() { if (g_env_light.raincnt <= 3) { g_env_light.mRainInitialized = 0; mDoAud_seStart(JA_SE_ATM_RAIN_END, NULL, 0, 0); - delete g_env_light.mpRainPacket; + JKR_DELETE(g_env_light.mpRainPacket); g_env_light.mpRainPacket = NULL; } break; @@ -653,7 +653,7 @@ static void wether_move_star() { if (g_env_light.mStarCount == 0) { g_env_light.mStarInitialized = false; - delete g_env_light.mpStarPacket; + JKR_DELETE(g_env_light.mpStarPacket); g_env_light.mpStarPacket = NULL; } break; @@ -705,7 +705,7 @@ static void wether_move_housi() { switch (g_env_light.mHousiInitialized) { case FALSE: if (g_env_light.mHousiCount != 0) { - g_env_light.mpHousiPacket = new (32) dKankyo_housi_Packet(); + g_env_light.mpHousiPacket = JKR_NEW_ARGS (32) dKankyo_housi_Packet(); if (g_env_light.mpHousiPacket != NULL) { if (dKy_darkworld_check() == true) { @@ -748,7 +748,7 @@ static void wether_move_housi() { g_env_light.mpHousiPacket->field_0x5de8 <= 0.0f) { g_env_light.mHousiInitialized = false; - delete g_env_light.mpHousiPacket; + JKR_DELETE(g_env_light.mpHousiPacket); g_env_light.mpHousiPacket = NULL; } else { dKyr_housi_move(); @@ -764,7 +764,7 @@ static void wether_move_odour() { switch (g_env_light.mOdourData.mOdourPacketStatus) { case 0: if (g_env_light.mOdourData.field_0xf21 != 0) { - g_env_light.mOdourData.mpOdourPacket = new (32) dKankyo_odour_Packet(); + g_env_light.mOdourData.mpOdourPacket = JKR_NEW_ARGS (32) dKankyo_odour_Packet(); if (g_env_light.mOdourData.mpOdourPacket != NULL) { g_env_light.mOdourData.mpOdourPacket->mpResTex = (u8*)dComIfG_getObjectRes("Always", 0x53); @@ -778,7 +778,7 @@ static void wether_move_odour() { if (g_env_light.mOdourData.field_0xf21 == 0) { g_env_light.mOdourData.mOdourPacketStatus = 0; if (g_env_light.mOdourData.mpOdourPacket != NULL) { - delete g_env_light.mOdourData.mpOdourPacket; + JKR_DELETE(g_env_light.mOdourData.mpOdourPacket); g_env_light.mOdourData.mpOdourPacket = NULL; } } else { @@ -788,7 +788,7 @@ static void wether_move_odour() { case 2: g_env_light.mOdourData.field_0xf21 = 0; g_env_light.mOdourData.mOdourPacketStatus = 0; - delete g_env_light.mOdourData.mpOdourPacket; + JKR_DELETE(g_env_light.mOdourData.mpOdourPacket); g_env_light.mOdourData.mpOdourPacket = NULL; break; } @@ -798,7 +798,7 @@ static void wether_move_moya() { switch (g_env_light.mCloudInitialized) { case 0: if (g_env_light.mMoyaCount != 0) { - g_env_light.mpCloudPacket = new (32) dKankyo_cloud_Packet(); + g_env_light.mpCloudPacket = JKR_NEW_ARGS (32) dKankyo_cloud_Packet(); if (g_env_light.mpCloudPacket != NULL) { g_env_light.mpCloudPacket->mpResTex = (u8*)dComIfG_getObjectRes("Always", 0x53); @@ -822,7 +822,7 @@ static void wether_move_moya() { if (g_env_light.mMoyaCount == 0 && g_env_light.mpCloudPacket->mCount == 0) { g_env_light.mCloudInitialized = 0; - delete g_env_light.mpCloudPacket; + JKR_DELETE(g_env_light.mpCloudPacket); g_env_light.mpCloudPacket = NULL; } break; @@ -884,7 +884,7 @@ static void wether_move_vrkumo() { switch (g_env_light.mVrkumoStatus) { case 0: if (g_env_light.mVrkumoCount != 0) { - g_env_light.mpVrkumoPacket = new (0x20) dKankyo_vrkumo_Packet(); + g_env_light.mpVrkumoPacket = JKR_NEW_ARGS (0x20) dKankyo_vrkumo_Packet(); if (g_env_light.mpVrkumoPacket == NULL) { return; } @@ -964,7 +964,7 @@ static void wether_move_mud() { switch (g_env_light.mMudInitialized) { case 0: if (g_env_light.field_0x1048 != 0) { - g_env_light.mpMudPacket = new (32) dKankyo_mud_Packet(); + g_env_light.mpMudPacket = JKR_NEW_ARGS (32) dKankyo_mud_Packet(); if (g_env_light.mpMudPacket != NULL) { dKyr_mud_init(); @@ -979,7 +979,7 @@ static void wether_move_mud() { if (g_env_light.field_0x1048 == 0 && g_env_light.mpMudPacket->mEffectNum == 0) { g_env_light.mMudInitialized = 0; - delete g_env_light.mpMudPacket; + JKR_DELETE(g_env_light.mpMudPacket); g_env_light.mpMudPacket = NULL; } break; @@ -990,7 +990,7 @@ static void wether_move_evil() { switch (g_env_light.mEvilInitialized & 0xF) { case 0: if (g_env_light.field_0x1054 != 0) { - g_env_light.mpEvilPacket = new (32) dKankyo_evil_Packet(); + g_env_light.mpEvilPacket = JKR_NEW_ARGS (32) dKankyo_evil_Packet(); if (g_env_light.mpEvilPacket != NULL) { dKyr_evil_init(); @@ -1005,7 +1005,7 @@ static void wether_move_evil() { if (g_env_light.field_0x1054 == 0 && g_env_light.mpEvilPacket->mEffectNum == 0) { g_env_light.mEvilInitialized = 0; - delete g_env_light.mpEvilPacket; + JKR_DELETE(g_env_light.mpEvilPacket); g_env_light.mpEvilPacket = NULL; } break; diff --git a/src/d/d_kantera_icon_meter.cpp b/src/d/d_kantera_icon_meter.cpp index fa31a962ea..427351053e 100644 --- a/src/d/d_kantera_icon_meter.cpp +++ b/src/d/d_kantera_icon_meter.cpp @@ -12,28 +12,28 @@ dKantera_icon_c::dKantera_icon_c() { } dKantera_icon_c::~dKantera_icon_c() { - delete mpKanteraIcon->getScreen(); - delete mpKanteraIcon; + JKR_DELETE(mpKanteraIcon->getScreen()); + JKR_DELETE(mpKanteraIcon); mpKanteraIcon = NULL; - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; - delete mpGauge; + JKR_DELETE(mpGauge); mpGauge = NULL; } void dKantera_icon_c::initiate() { - mpKanteraIcon = new dDlst_KanteraIcon_c(); + mpKanteraIcon = JKR_NEW dDlst_KanteraIcon_c(); - J2DScreen* scrn = new J2DScreen(); + J2DScreen* scrn = JKR_NEW J2DScreen(); scrn->setPriority("zelda_kantera_icon_mater.blo", 0x20000, dComIfGp_getMain2DArchive()); dPaneClass_showNullPane(scrn); mpKanteraIcon->setScreen(scrn); - mpParent = new CPaneMgr(scrn, MULTI_CHAR('kan_m_n'), 2, NULL); + mpParent = JKR_NEW CPaneMgr(scrn, MULTI_CHAR('kan_m_n'), 2, NULL); - mpGauge = new CPaneMgr(scrn, MULTI_CHAR('yellow_m'), 0, NULL); + mpGauge = JKR_NEW CPaneMgr(scrn, MULTI_CHAR('yellow_m'), 0, NULL); } void dKantera_icon_c::setAlphaRate(f32 alphaRate) { diff --git a/src/d/d_ky_thunder.cpp b/src/d/d_ky_thunder.cpp index 4a5bb0649e..bcb5ccb690 100644 --- a/src/d/d_ky_thunder.cpp +++ b/src/d/d_ky_thunder.cpp @@ -152,7 +152,7 @@ int dThunder_c::create() { f32 var_r28; f32 var_r27; - new (this) dThunder_c(); + JKR_NEW_ARGS (this) dThunder_c(); J3DModelData* modelData; if (cM_rndF(1.0f) < 0.5f) { diff --git a/src/d/d_map.cpp b/src/d/d_map.cpp index 0d123f9c3c..88e3a62e1a 100644 --- a/src/d/d_map.cpp +++ b/src/d/d_map.cpp @@ -1132,7 +1132,7 @@ dMap_c::dMap_c(int param_0, int param_1, int param_2, int param_3) { m_mySelfPointer = this; #endif - m_res = new (0x20) dMap_prm_res_s; + m_res = JKR_NEW_ARGS (0x20) dMap_prm_res_s; JUT_ASSERT(2559, m_res != NULL); dMap_HIO_prm_res_dst_s::m_res = m_res; @@ -1177,12 +1177,12 @@ dMap_c::dMap_c(int param_0, int param_1, int param_2, int param_3) { } int buffer_size = GXGetTexBufferSize(param_2, param_3, 9, GX_FALSE, 0); - mImage_p = new (0x20) u8[buffer_size]; + mImage_p = JKR_NEW_ARGS (0x20) u8[buffer_size]; JUT_ASSERT(2638, mImage_p != NULL); renderingDAmap_c::init(mImage_p, mTexSizeX, mTexSizeY, mTexSizeX, mTexSizeY); - mResTIMG = new (0x20) ResTIMG; + mResTIMG = JKR_NEW_ARGS (0x20) ResTIMG; JUT_ASSERT(2647, mResTIMG != NULL); makeResTIMG(mResTIMG, mTexSizeX, mTexSizeY, mImage_p, (u8*)m_res, 0x33); @@ -1208,17 +1208,17 @@ void dMap_c::changeTextureSize(int param_1, int param_2, int param_3) { void dMap_c::_remove() { if (mImage_p != NULL) { - delete[] mImage_p; + JKR_DELETE_ARRAY(mImage_p); mImage_p = NULL; } if (mResTIMG != NULL) { - delete mResTIMG; + JKR_DELETE(mResTIMG); mResTIMG = NULL; } if (m_res != NULL) { - delete m_res; + JKR_DELETE(m_res); m_res = NULL; } } diff --git a/src/d/d_map_path.cpp b/src/d/d_map_path.cpp index 709c4f8aa1..03ead56fd3 100644 --- a/src/d/d_map_path.cpp +++ b/src/d/d_map_path.cpp @@ -20,7 +20,7 @@ void dMpath_n::dTexObjAggregate_c::create() { }; for (int lp1 = 0; lp1 < 7; lp1++) { - mp_texObj[lp1] = new GXTexObj(); + mp_texObj[lp1] = JKR_NEW GXTexObj(); JUT_ASSERT(70, mp_texObj[lp1] != NULL); ResTIMG* image = (ResTIMG*)dComIfG_getObjectRes("Always", data[lp1]); JUT_ASSERT(72, image != NULL); @@ -32,7 +32,7 @@ void dMpath_n::dTexObjAggregate_c::create() { void dMpath_n::dTexObjAggregate_c::remove() { for (int i = 0; i < 7; i++) { - delete mp_texObj[i]; + JKR_DELETE(mp_texObj[i]); mp_texObj[i] = NULL; } } @@ -212,13 +212,13 @@ bool dMpath_HIO_file_base_c::readBinaryFile(const char* param_1) { } if (file.open(JORFile::EFlags_READ, r26, NULL, NULL, NULL)) { s32 r28 = file.getFileSize(); - char* buf = new char[r28]; + char* buf = JKR_NEW char[r28]; JUT_ASSERT(855, buf != NULL); file.readData(buf, r28); copyReadBufToData(buf, r28); OSReport("write read success!::%6d\n", r28); result = true; - delete[] buf; + JKR_DELETE_ARRAY(buf); buf = NULL; file.close(); } else { diff --git a/src/d/d_map_path_dmap.cpp b/src/d/d_map_path_dmap.cpp index 3e587fcce8..a97b314997 100644 --- a/src/d/d_map_path_dmap.cpp +++ b/src/d/d_map_path_dmap.cpp @@ -384,7 +384,7 @@ int dMpath_c::getTopBottomFloorNo(s8* i_topFloorNo, s8* i_bottomFloorNo) { } void dMpath_c::createWork() { - mLayerList = new dDrawPath_c::layer_data; + mLayerList = JKR_NEW dDrawPath_c::layer_data; JUT_ASSERT(1416, mLayerList!=NULL); } diff --git a/src/d/d_map_path_fmap.cpp b/src/d/d_map_path_fmap.cpp index 13eba6d653..d1032631cd 100644 --- a/src/d/d_map_path_fmap.cpp +++ b/src/d/d_map_path_fmap.cpp @@ -7,7 +7,7 @@ void fmpTresTypeGroupDataList_c::addTypeGroupData(u8 i_typeGroupNo, dTres_c::data_s const* i_tresData) { fmpTresTypeGroupData_c* next = mpNextData; - fmpTresTypeGroupData_c* fmpTresTypeGroupData_p = new fmpTresTypeGroupData_c(); + fmpTresTypeGroupData_c* fmpTresTypeGroupData_p = JKR_NEW fmpTresTypeGroupData_c(); if (mpTypeGroupDataHead == NULL) { mpTypeGroupDataHead = fmpTresTypeGroupData_p; @@ -36,7 +36,7 @@ void dMenu_Fmap_room_data_c::buildTresTypeGroup(int i_stageNo, int i_roomIndex, dTres_c::data_s* data_p = tresure_p->field_0x4->getDataPointer(); if (mp_fmpTresTypeGroupDataListAll == NULL) { - mp_fmpTresTypeGroupDataListAll = new fmpTresTypeGroupDataListAll_c(); + mp_fmpTresTypeGroupDataListAll = JKR_NEW fmpTresTypeGroupDataListAll_c(); } for (int i = 0; i < num; i++) { diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 6536067bcf..d2b5c0ec36 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -97,11 +97,11 @@ dMenu_Collect2D_c::~dMenu_Collect2D_c() { void dMenu_Collect2D_c::_create() { mpHeap->getTotalFreeSize(); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); mpScreen->setPriority("zelda_collect_soubi_screen.blo", 0x1020000, dComIfGp_getCollectResArchive()); dPaneClass_showNullPane(mpScreen); - mpScreenIcon = new J2DScreen(); + mpScreenIcon = JKR_NEW J2DScreen(); mpScreenIcon->setPriority("zelda_collect_soubi_do_icon_parts.blo", 0x20000, dComIfGp_getCollectResArchive()); for (int i = 0; i < 2; i++) { @@ -109,13 +109,13 @@ void dMenu_Collect2D_c::_create() { mpButtonText[i] = NULL; } dPaneClass_showNullPane(mpScreenIcon); - mpDraw2DTop = new dMenu_Collect2DTop_c(this); + mpDraw2DTop = JKR_NEW dMenu_Collect2DTop_c(this); ResTIMG* image = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBlackTex = new J2DPicture(image); + mpBlackTex = JKR_NEW J2DPicture(image); mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 255)); mpBlackTex->setAlpha(0); - mpDrawCursor = new dSelect_cursor_c(2, 1.0f, NULL); - mpString = new dMsgString_c(); + mpDrawCursor = JKR_NEW dSelect_cursor_c(2, 1.0f, NULL); + mpString = JKR_NEW dMsgString_c(); mpSaveScrn = NULL; mpOptionScrn = NULL; mpLetterScrn = NULL; @@ -132,81 +132,81 @@ void dMenu_Collect2D_c::_create() { void dMenu_Collect2D_c::_delete() { mpHeap->getTotalFreeSize(); dMeter2Info_setCollectCursorPosXY(mCursorX, mCursorY); - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpScreenIcon; + JKR_DELETE(mpScreenIcon); mpScreenIcon = NULL; for (int i = 0; i < 2; i++) { if (mpButtonAB[i]) { - delete mpButtonAB[i]; + JKR_DELETE(mpButtonAB[i]); mpButtonAB[i] = NULL; } if (mpButtonText[i]) { - delete mpButtonText[i]; + JKR_DELETE(mpButtonText[i]); mpButtonText[i] = NULL; } } - delete mpDraw2DTop; + JKR_DELETE(mpDraw2DTop); mpDraw2DTop = NULL; - delete mpBlackTex; + JKR_DELETE(mpBlackTex); mpBlackTex = NULL; - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; - delete mpString; + JKR_DELETE(mpString); mpString = NULL; JKRHeap* heap = mDoExt_setCurrentHeap(mpSubHeap); if (mpSaveScrn) { mpSaveScrn->_delete(); - delete mpSaveScrn; + JKR_DELETE(mpSaveScrn); mpSaveScrn = NULL; mpSubHeap->freeAll(); } if (mpOptionScrn) { mpOptionScrn->_delete(); - delete mpOptionScrn; + JKR_DELETE(mpOptionScrn); mpOptionScrn = NULL; mpSubHeap->freeAll(); } if (mpLetterScrn) { - delete mpLetterScrn; + JKR_DELETE(mpLetterScrn); mpLetterScrn = NULL; mpSubHeap->freeAll(); } if (mpFishingScrn) { - delete mpFishingScrn; + JKR_DELETE(mpFishingScrn); mpFishingScrn = NULL; mpSubHeap->freeAll(); } if (mpSkillScrn) { - delete mpSkillScrn; + JKR_DELETE(mpSkillScrn); mpSkillScrn = NULL; mpSubHeap->freeAll(); } if (mpInsectScrn) { - delete mpInsectScrn; + JKR_DELETE(mpInsectScrn); mpInsectScrn = NULL; mpSubHeap->freeAll(); } mDoExt_setCurrentHeap(heap); - delete mpAnmKey; + JKR_DELETE(mpAnmKey); mpAnmKey = NULL; for (int i = 0; i < 7; i++) { for (int j = 0; j < 6; j++) { if (mpSelPm[i][j]) { - delete mpSelPm[i][j]; + JKR_DELETE(mpSelPm[i][j]); mpSelPm[i][j] = NULL; } } } - delete mpLinkPm; + JKR_DELETE(mpLinkPm); mpLinkPm = NULL; - delete mpMaskPm; + JKR_DELETE(mpMaskPm); mpMaskPm = NULL; - delete mpModelBg; + JKR_DELETE(mpModelBg); mpModelBg = NULL; - delete mpHeartParent; + JKR_DELETE(mpHeartParent); mpHeartParent = NULL; - delete mpHeartPiece; + JKR_DELETE(mpHeartPiece); mpHeartPiece = NULL; dComIfGp_getCollectResArchive()->removeResourceAll(); } @@ -635,7 +635,7 @@ void dMenu_Collect2D_c::screenSet() { for (int i = 0; i < 7; i++) { for (int j = 0; j < 6; j++) { if (getItemTag(i, j, true)) { - mpSelPm[i][j] = new CPaneMgr(mpScreen, getItemTag(i, j, true), 0, NULL); + mpSelPm[i][j] = JKR_NEW CPaneMgr(mpScreen, getItemTag(i, j, true), 0, NULL); if (!bVar18) { i_copy = i; j_copy = j; @@ -662,14 +662,14 @@ void dMenu_Collect2D_c::screenSet() { mCursorX = i_copy; mCursorY = j_copy; } - mpLinkPm = new CPaneMgr(mpScreen, MULTI_CHAR('linki_n'), 0, NULL); + mpLinkPm = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('linki_n'), 0, NULL); mLinkGlobalCenterPos.x = mpLinkPm->getInitGlobalCenterPosX(); mLinkGlobalCenterPos.y = mpLinkPm->getInitGlobalCenterPosY(); mLinkGlobalCenterPos.z = -1000.0f; - mpMaskPm = new CPaneMgr(mpScreen, MULTI_CHAR('kamen_n'), 0, NULL); - mpModelBg = new CPaneMgr(mpScreen, MULTI_CHAR('modelbgn'), 2, NULL); - mpHeartParent = new CPaneMgr(mpScreen, MULTI_CHAR('heart_n'), 0, NULL); - mpHeartPiece = new CPaneMgr(mpScreen, MULTI_CHAR('heart_kn'), 0, NULL); + mpMaskPm = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('kamen_n'), 0, NULL); + mpModelBg = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('modelbgn'), 2, NULL); + mpHeartParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('heart_n'), 0, NULL); + mpHeartPiece = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('heart_kn'), 0, NULL); setAButtonString(mCurrentAString); setBButtonString(mCurrentBString); setItemNameString(mCursorX, mCursorY); @@ -1538,38 +1538,38 @@ void dMenu_Collect2D_c::wait_init() { if (mpSaveScrn != NULL) { mpSaveScrn->_delete(); - delete mpSaveScrn; + JKR_DELETE(mpSaveScrn); mpSaveScrn = NULL; mpSubHeap->freeAll(); } if (mpOptionScrn != NULL) { mpOptionScrn->_delete(); - delete mpOptionScrn; + JKR_DELETE(mpOptionScrn); mpOptionScrn = NULL; mpSubHeap->freeAll(); } if (mpLetterScrn != NULL) { - delete mpLetterScrn; + JKR_DELETE(mpLetterScrn); mpLetterScrn = NULL; mpSubHeap->freeAll(); } if (mpFishingScrn != NULL) { - delete mpFishingScrn; + JKR_DELETE(mpFishingScrn); mpFishingScrn = NULL; mpSubHeap->freeAll(); } if (mpSkillScrn != NULL) { - delete mpSkillScrn; + JKR_DELETE(mpSkillScrn); mpSkillScrn = NULL; mpSubHeap->freeAll(); } if (mpInsectScrn != NULL) { - delete mpInsectScrn; + JKR_DELETE(mpInsectScrn); mpInsectScrn = NULL; mpSubHeap->freeAll(); } @@ -1683,7 +1683,7 @@ void dMenu_Collect2D_c::wait_proc() { void dMenu_Collect2D_c::save_open_init() { JKRHeap* heap = mDoExt_setCurrentHeap(mpSubHeap); if (!mpSaveScrn) { - mpSaveScrn = new dMenu_save_c(); + mpSaveScrn = JKR_NEW dMenu_save_c(); } mpSaveScrn->setUseType(1); mpSaveScrn->_create(); @@ -1741,7 +1741,7 @@ void dMenu_Collect2D_c::save_close_proc() { void dMenu_Collect2D_c::option_open_init() { JKRHeap* heap = mDoExt_setCurrentHeap(mpSubHeap); if (!mpOptionScrn) { - mpOptionScrn = new dMenu_Option_c(dComIfGp_getCollectResArchive(), mpStick); + mpOptionScrn = JKR_NEW dMenu_Option_c(dComIfGp_getCollectResArchive(), mpStick); } mpOptionScrn->initialize(); setAButtonString(0); @@ -1797,7 +1797,7 @@ void dMenu_Collect2D_c::option_close_proc() { void dMenu_Collect2D_c::letter_open_init() { JKRHeap* heap = mDoExt_setCurrentHeap(mpSubHeap); if (!mpLetterScrn) { - mpLetterScrn = new dMenu_Letter_c(mpSubHeap, mpStick, mpCStick); + mpLetterScrn = JKR_NEW dMenu_Letter_c(mpSubHeap, mpStick, mpCStick); } setAButtonString(0); setBButtonString(0); @@ -1852,7 +1852,7 @@ void dMenu_Collect2D_c::letter_close_proc() { void dMenu_Collect2D_c::fishing_open_init() { JKRHeap* heap = mDoExt_setCurrentHeap(mpSubHeap); if (!mpFishingScrn) { - mpFishingScrn = new dMenu_Fishing_c(mpSubHeap, mpStick, mpCStick); + mpFishingScrn = JKR_NEW dMenu_Fishing_c(mpSubHeap, mpStick, mpCStick); } setAButtonString(0); setBButtonString(0); @@ -1907,7 +1907,7 @@ void dMenu_Collect2D_c::fishing_close_proc() { void dMenu_Collect2D_c::skill_open_init() { JKRHeap* heap = mDoExt_setCurrentHeap(mpSubHeap); if (!mpSkillScrn) { - mpSkillScrn = new dMenu_Skill_c(mpSubHeap, mpStick, mpCStick); + mpSkillScrn = JKR_NEW dMenu_Skill_c(mpSubHeap, mpStick, mpCStick); } setAButtonString(0); setBButtonString(0); @@ -1962,7 +1962,7 @@ void dMenu_Collect2D_c::skill_close_proc() { void dMenu_Collect2D_c::insect_open_init() { JKRHeap* heap = mDoExt_setCurrentHeap(mpSubHeap); if (!mpInsectScrn) { - mpInsectScrn = new dMenu_Insect_c(mpSubHeap, mpStick, mpCStick, 0); + mpInsectScrn = JKR_NEW dMenu_Insect_c(mpSubHeap, mpStick, mpCStick, 0); } setAButtonString(0); setBButtonString(0); @@ -2337,15 +2337,15 @@ void dMenu_Collect3D_c::setJ3D(const char* param_0, const char* param_1, const c resArchive->getResource('BMD ', param_0), 0x51020010); for (u16 i = 0; i < modelData->getMaterialNum(); i++) { - J3DMaterialAnm* matAnm = new J3DMaterialAnm(); + J3DMaterialAnm* matAnm = JKR_NEW J3DMaterialAnm(); modelData->getMaterialNodePointer(i)->change(); modelData->getMaterialNodePointer(i)->setMaterialAnm(matAnm); } - mpModel = new J3DModel(modelData, 0, 1); + mpModel = JKR_NEW J3DModel(modelData, 0, 1); if (param_1 != NULL) { J3DAnmTransform* pbck = (J3DAnmTransform*)J3DAnmLoaderDataBase::load( resArchive->getResource('BCK ', param_1), J3DLOADER_UNK_FLAG0); - mpBckAnm = new mDoExt_bckAnm(); + mpBckAnm = JKR_NEW mDoExt_bckAnm(); if (mpBckAnm == NULL || !mpBckAnm->init(pbck, 1, 2, 1.0f, 0, -1, false)) { return; } @@ -2354,7 +2354,7 @@ void dMenu_Collect3D_c::setJ3D(const char* param_0, const char* param_1, const c J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)J3DAnmLoaderDataBase::load( resArchive->getResource('BRK ', param_2), J3DLOADER_UNK_FLAG0); pbrk->searchUpdateMaterialID(modelData); - mpBrkAnm = new mDoExt_brkAnm(); + mpBrkAnm = JKR_NEW mDoExt_brkAnm(); if (mpBrkAnm == NULL || !mpBrkAnm->init(modelData, pbrk, -1, 2, 1.0f, 0, -1)) { return; } @@ -2616,17 +2616,17 @@ void dMenu_Collect2DTop_c::draw() { } dMenu_Collect_c::dMenu_Collect_c(JKRExpHeap* param_0, STControl* param_1, CSTControl* param_2) { - mpCollect2D = new dMenu_Collect2D_c(param_0, param_1, param_2); - mpCollect3D = new dMenu_Collect3D_c(param_0, mpCollect2D, param_2); + mpCollect2D = JKR_NEW dMenu_Collect2D_c(param_0, param_1, param_2); + mpCollect3D = JKR_NEW dMenu_Collect3D_c(param_0, mpCollect2D, param_2); } dMenu_Collect_c::~dMenu_Collect_c() { if (mpCollect2D) { - delete mpCollect2D; + JKR_DELETE(mpCollect2D); mpCollect2D = NULL; } if (mpCollect3D) { - delete mpCollect3D; + JKR_DELETE(mpCollect3D); mpCollect3D = NULL; } } diff --git a/src/d/d_menu_dmap.cpp b/src/d/d_menu_dmap.cpp index 187fa4b172..28f86cfd12 100644 --- a/src/d/d_menu_dmap.cpp +++ b/src/d/d_menu_dmap.cpp @@ -95,7 +95,7 @@ dMenu_DmapBg_c::dMenu_DmapBg_c(JKRExpHeap* i_heap, STControl* i_stick) { field_0xdd7 = 0; field_0xdd8 = 1; - mString = new dMsgString_c(); + mString = JKR_NEW dMsgString_c(); JUT_ASSERT(621, mString != NULL); mpTalkHeap = JKRCreateExpHeap(0x32000, mpHeap, false); @@ -103,7 +103,7 @@ dMenu_DmapBg_c::dMenu_DmapBg_c(JKRExpHeap* i_heap, STControl* i_stick) { mpItemExplain = NULL; - mpMeterHaihai = new dMeterHaihai_c(2); + mpMeterHaihai = JKR_NEW dMeterHaihai_c(2); JUT_ASSERT(630, mpMeterHaihai != NULL); field_0xdda = 0; @@ -137,7 +137,7 @@ dMenu_DmapBg_c::dMenu_DmapBg_c(JKRExpHeap* i_heap, STControl* i_stick) { void dMenu_DmapBg_c::mapScreenInit() { for (int i = 0; i < 2; i++) { - mMapScreen[i] = new J2DScreen(); + mMapScreen[i] = JKR_NEW J2DScreen(); JUT_ASSERT(689, mMapScreen[i] != NULL); bool fg = mMapScreen[i]->setPriority("zelda_dungeon_map_map.blo", 0x20000, dComIfGp_getDmapResArchive()); @@ -147,7 +147,7 @@ void dMenu_DmapBg_c::mapScreenInit() { } #if (PLATFORM_WII || PLATFORM_SHIELD) - mpBlack = new CPaneMgrAlpha(mMapScreen[0], MULTI_CHAR('m_black'), 2, NULL); + mpBlack = JKR_NEW CPaneMgrAlpha(mMapScreen[0], MULTI_CHAR('m_black'), 2, NULL); JUT_ASSERT(699, mpBlack != NULL); mpBlack->setAlphaRate(0.0f); #else @@ -178,7 +178,7 @@ void dMenu_DmapBg_c::mapScreenInit() { } for (int i = 0; i < 2; i++) { - mpMapRoot[i] = new CPaneMgrAlphaMorf(mMapScreen[i], 'ROOT', 2, NULL); + mpMapRoot[i] = JKR_NEW CPaneMgrAlphaMorf(mMapScreen[i], 'ROOT', 2, NULL); JUT_ASSERT(751, mpMapRoot[i] != NULL); } @@ -212,7 +212,7 @@ void dMenu_DmapBg_c::mapScreenInit() { initiate(dComIfGp_getDmapResArchive()); for (int i = 0; i < 2; i++) { - mpMapSpace[i] = new CPaneMgr(mMapScreen[i], MULTI_CHAR('mapspace'), 0, NULL); + mpMapSpace[i] = JKR_NEW CPaneMgr(mMapScreen[i], MULTI_CHAR('mapspace'), 0, NULL); JUT_ASSERT(817, mpMapSpace[i] != NULL); mpMapSpace[i]->paneTrans(0.0f, -15.0f); @@ -294,7 +294,7 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { #endif }; - mButtonScreen = new J2DScreen(); + mButtonScreen = JKR_NEW J2DScreen(); JUT_ASSERT(916, mButtonScreen != NULL); bool fg = mButtonScreen->setPriority("zelda_dungeon_map_spot_button.blo", 0x20000, dComIfGp_getDmapResArchive()); @@ -302,14 +302,14 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { dPaneClass_showNullPane(mButtonScreen); #if (PLATFORM_WII || PLATFORM_SHIELD) - mDecorateScreen = new J2DScreen(); + mDecorateScreen = JKR_NEW J2DScreen(); JUT_ASSERT(926, mDecorateScreen != NULL); fg = mDecorateScreen->setPriority("zelda_dungeon_map_decoration_revo.blo", 0x20000, dComIfGp_getDmapResArchive()); JUT_ASSERT(930, fg != false); dPaneClass_showNullPane(mDecorateScreen); - mpDecorateRoot = new CPaneMgrAlphaMorf(mDecorateScreen, 'ROOT', 2, NULL); + mpDecorateRoot = JKR_NEW CPaneMgrAlphaMorf(mDecorateScreen, 'ROOT', 2, NULL); JUT_ASSERT(934, mpDecorateRoot != NULL); #else mDecorateScreen = NULL; @@ -319,7 +319,7 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { mButtonScreen->search(MULTI_CHAR('spot01'))->hide(); #endif - mpButtonRoot = new CPaneMgrAlphaMorf(mButtonScreen, 'ROOT', 2, NULL); + mpButtonRoot = JKR_NEW CPaneMgrAlphaMorf(mButtonScreen, 'ROOT', 2, NULL); JUT_ASSERT(952, mpButtonRoot != NULL); for (int i = 0; i < 2; i++) { @@ -327,7 +327,7 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { mpButtonText[i] = NULL; } - mpCButton = new CPaneMgrAlpha(mButtonScreen, MULTI_CHAR('c_btn'), 2, NULL); + mpCButton = JKR_NEW CPaneMgrAlpha(mButtonScreen, MULTI_CHAR('c_btn'), 2, NULL); JUT_ASSERT(978, mpCButton != NULL); mpJButton = NULL; @@ -349,7 +349,7 @@ void dMenu_DmapBg_c::buttonIconScreenInit() { #endif } - field_0xcf4 = new CPaneMgr(mButtonScreen, 'c_n', 2, NULL); + field_0xcf4 = JKR_NEW CPaneMgr(mButtonScreen, 'c_n', 2, NULL); field_0xcf8 = NULL; J2DTextBox* textBox; @@ -447,7 +447,7 @@ void dMenu_DmapBg_c::setJButtonString(u32 i_msgNo) { void dMenu_DmapBg_c::createExplain() { if (mpItemExplain == NULL) { JKRHeap* prevHeap = mDoExt_setCurrentHeap(mpTalkHeap); - mpItemExplain = new dMenu_ItemExplain_c(mpTalkHeap, dComIfGp_getDmapResArchive(), mpStick, true); + mpItemExplain = JKR_NEW dMenu_ItemExplain_c(mpTalkHeap, dComIfGp_getDmapResArchive(), mpStick, true); JUT_ASSERT(1308, mpItemExplain != NULL); mDoExt_setCurrentHeap(prevHeap); @@ -457,21 +457,21 @@ void dMenu_DmapBg_c::createExplain() { void dMenu_DmapBg_c::deleteExplain() { if (mpItemExplain != NULL) { JKRHeap* prevHeap = mDoExt_setCurrentHeap(mpTalkHeap); - delete mpItemExplain; + JKR_DELETE(mpItemExplain); mpItemExplain = NULL; mDoExt_setCurrentHeap(prevHeap); } } void dMenu_DmapBg_c::baseScreenInit() { - mBaseScreen = new J2DScreen(); + mBaseScreen = JKR_NEW J2DScreen(); JUT_ASSERT(1336, mBaseScreen != NULL); bool fg = mBaseScreen->setPriority("zelda_dungeon_map_base.blo", 0x20000, dComIfGp_getDmapResArchive()); JUT_ASSERT(1347, fg != false); dPaneClass_showNullPane(mBaseScreen); - mFloorScreen = new J2DScreen(); + mFloorScreen = JKR_NEW J2DScreen(); JUT_ASSERT(1351, mFloorScreen != NULL); fg = mFloorScreen->setPriority("zelda_dungeon_map_floor_parts.blo", 0x20000, @@ -481,13 +481,13 @@ void dMenu_DmapBg_c::baseScreenInit() { mBaseScreen->search(MULTI_CHAR('w_btn_n'))->hide(); - mpBaseRoot = new CPaneMgrAlphaMorf(mBaseScreen, 'ROOT', 2, NULL); + mpBaseRoot = JKR_NEW CPaneMgrAlphaMorf(mBaseScreen, 'ROOT', 2, NULL); JUT_ASSERT(1396, mpBaseRoot != NULL); - mpFloorRoot = new CPaneMgrAlphaMorf(mFloorScreen, 'ROOT', 2, NULL); + mpFloorRoot = JKR_NEW CPaneMgrAlphaMorf(mFloorScreen, 'ROOT', 2, NULL); JUT_ASSERT(1399, mpFloorRoot != NULL); - mpDrawCursor = new dSelect_cursor_c(2, 1.0f, NULL); + mpDrawCursor = JKR_NEW dSelect_cursor_c(2, 1.0f, NULL); JUT_ASSERT(1403, mpDrawCursor != NULL); mpDrawCursor->setAlphaRate(1.0f); @@ -642,60 +642,60 @@ bool dMenu_DmapBg_c::dpdMove(s8 param_0, s8 param_1, s8 param_2, u8* param_3, u8 dMenu_DmapBg_c::~dMenu_DmapBg_c() { dComIfGp_getDmapResArchive()->removeResourceAll(); - delete mString; + JKR_DELETE(mString); if (mpMeterHaihai != NULL) { - delete mpMeterHaihai; + JKR_DELETE(mpMeterHaihai); mpMeterHaihai = NULL; } - delete mBaseScreen; + JKR_DELETE(mBaseScreen); mBaseScreen = NULL; - delete mFloorScreen; + JKR_DELETE(mFloorScreen); mFloorScreen = NULL; - delete mpBaseRoot; + JKR_DELETE(mpBaseRoot); mpBaseRoot = NULL; - delete mpFloorRoot; + JKR_DELETE(mpFloorRoot); mpFloorRoot = NULL; - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; for (int i = 0; i < 2; i++) { - delete mMapScreen[i]; + JKR_DELETE(mMapScreen[i]); mMapScreen[i] = NULL; - delete mpMapSpace[i]; + JKR_DELETE(mpMapSpace[i]); mpMapSpace[i] = NULL; - delete mpMapRoot[i]; + JKR_DELETE(mpMapRoot[i]); mpMapRoot[i] = NULL; } if (mpBlack != NULL) { - delete mpBlack; + JKR_DELETE(mpBlack); mpBlack = NULL; } for (int i = 0; i < 1; i++) { - delete field_0xd28[i]; + JKR_DELETE(field_0xd28[i]); } for (int i = 0; i < 2; i++) { - delete mpMapSpace[i]; + JKR_DELETE(mpMapSpace[i]); mpMapSpace[i] = NULL; } if (field_0xcf4 != NULL) { - delete field_0xcf4; + JKR_DELETE(field_0xcf4); field_0xcf4 = NULL; } if (field_0xcf8 != NULL) { - delete field_0xcf8; + JKR_DELETE(field_0xcf8); field_0xcf8 = NULL; } @@ -713,43 +713,43 @@ dMenu_DmapBg_c::~dMenu_DmapBg_c() { } if (mpBackTexture != NULL) { - delete mpBackTexture; + JKR_DELETE(mpBackTexture); mpBackTexture = NULL; } - delete mButtonScreen; + JKR_DELETE(mButtonScreen); mButtonScreen = NULL; if (mDecorateScreen != NULL) { - delete mDecorateScreen; + JKR_DELETE(mDecorateScreen); mDecorateScreen = NULL; } if (mpDecorateRoot != NULL) { - delete mpDecorateRoot; + JKR_DELETE(mpDecorateRoot); mpDecorateRoot = NULL; } - delete mpButtonRoot; + JKR_DELETE(mpButtonRoot); mpButtonRoot = NULL; for (int i = 0; i < 2; i++) { if (mpButtonAB[i] != NULL) { - delete mpButtonAB[i]; + JKR_DELETE(mpButtonAB[i]); mpButtonAB[i] = NULL; } if (mpButtonText[i] != NULL) { - delete mpButtonText[i]; + JKR_DELETE(mpButtonText[i]); mpButtonText[i] = NULL; } } - delete mpCButton; + JKR_DELETE(mpCButton); mpCButton = NULL; if (mpJButton != NULL) { - delete mpJButton; + JKR_DELETE(mpJButton); mpJButton = NULL; } @@ -965,7 +965,7 @@ void dMenu_DmapBg_c::update() { ResTIMG* mp_image = (ResTIMG*)mpArchive->getResource("tex/bg.bti"); JUT_ASSERT(2321, mp_image != NULL); - mpBackTexture = new J2DPicture(mp_image); + mpBackTexture = JKR_NEW J2DPicture(mp_image); JUT_ASSERT(2323, mpBackTexture != NULL); void* spec = mpArchive->getResource("spec/spec.dat"); @@ -1072,20 +1072,20 @@ void dMenu_Dmap_c::screenInit() { static u64 const key_tag[3] = {MULTI_CHAR('key_00'), MULTI_CHAR('key_01'), MULTI_CHAR('key_02')}; static u64 const item_tag[3] = {MULTI_CHAR('map000'), MULTI_CHAR('con000'), MULTI_CHAR('i_key_n')}; - field_0x10 = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('floo_s_n'), 0, NULL); + field_0x10 = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('floo_s_n'), 0, NULL); for (int i = 0; i < 8; i++) { field_0x114[i] = 0.0f; - mSelFloor[i] = new CPaneMgr(mpDrawBg->mFloorScreen, floor_tag[i], 3, NULL); + mSelFloor[i] = JKR_NEW CPaneMgr(mpDrawBg->mFloorScreen, floor_tag[i], 3, NULL); JUT_ASSERT(2654, mSelFloor[i] != NULL); - mIconLinkPos[i] = new CPaneMgr(mpDrawBg->mFloorScreen, icon_tag[i], 0, NULL); + mIconLinkPos[i] = JKR_NEW CPaneMgr(mpDrawBg->mFloorScreen, icon_tag[i], 0, NULL); JUT_ASSERT(2657, mIconLinkPos[i] != NULL); - mIconBossPos[i] = new CPaneMgr(mpDrawBg->mFloorScreen, boss_tag[i], 0, NULL); + mIconBossPos[i] = JKR_NEW CPaneMgr(mpDrawBg->mFloorScreen, boss_tag[i], 0, NULL); JUT_ASSERT(2660, mIconBossPos[i] != NULL); } for (int i = 0; i < 2; i++) { - mStayIcon[i] = new CPaneMgr(mpDrawBg->mFloorScreen, stay_tag[i], 0, NULL); + mStayIcon[i] = JKR_NEW CPaneMgr(mpDrawBg->mFloorScreen, stay_tag[i], 0, NULL); JUT_ASSERT(2665, mStayIcon[i] != NULL); mStayIcon[i]->hide(); @@ -1138,19 +1138,19 @@ void dMenu_Dmap_c::screenInit() { iconMoveCalc(); Vec local_b0 = mSelFloor[getDefaultCurFloorPos()]->getGlobalVtxCenter(false, 0); mpDrawBg->mpDrawCursor->setPos(local_b0.x + field_0x104, local_b0.y, mSelFloor[getDefaultCurFloorPos()]->getPanePtr(), true); - field_0x94 = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('item_s_n'), 0, NULL); - field_0x7c[0] = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('map_n'), 3, NULL); - field_0x7c[1] = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('con_n'), 3, NULL); - field_0x7c[2] = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('key_n'), 3, NULL); - field_0x88[0] = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('map000'), 3, NULL); - field_0x88[1] = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('con000'), 3, NULL); + field_0x94 = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('item_s_n'), 0, NULL); + field_0x7c[0] = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('map_n'), 3, NULL); + field_0x7c[1] = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('con_n'), 3, NULL); + field_0x7c[2] = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('key_n'), 3, NULL); + field_0x88[0] = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('map000'), 3, NULL); + field_0x88[1] = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('con000'), 3, NULL); if (dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo()) == dStage_SaveTbl_LV2) { - field_0x88[2] = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('i_key_n'), 3, NULL); + field_0x88[2] = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('i_key_n'), 3, NULL); } else if (dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo()) == dStage_SaveTbl_LV5) { - field_0x88[2] = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('lv5_k_n'), 3, NULL); + field_0x88[2] = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('lv5_k_n'), 3, NULL); } else { - field_0x88[2] = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('nor_k_n'), 3, NULL); + field_0x88[2] = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('nor_k_n'), 3, NULL); } for (int i = 0; i < 3; i++) { @@ -1270,7 +1270,7 @@ void dMenu_Dmap_c::screenInit() { } field_0x94->hide(); - field_0x98 = new CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('so_s_n'), 0, NULL); + field_0x98 = JKR_NEW CPaneMgr(mpDrawBg->mBaseScreen, MULTI_CHAR('so_s_n'), 0, NULL); field_0x98->hide(); } @@ -1408,7 +1408,7 @@ dMenu_Dmap_c::~dMenu_Dmap_c() { s32 iVar4 = field_0xe8->getTotalFreeSize(); if (mpDrawBg != NULL) { - delete mpDrawBg; + JKR_DELETE(mpDrawBg); mpDrawBg = NULL; } @@ -1421,57 +1421,57 @@ dMenu_Dmap_c::~dMenu_Dmap_c() { field_0xe8->getTotalFreeSize() - iVar4, field_0xe8->getTotalFreeSize()); if (mSelStick != NULL) { - delete mSelStick; + JKR_DELETE(mSelStick); } if (field_0x94 != NULL) { - delete field_0x94; + JKR_DELETE(field_0x94); } for (int i = 0; i < 8; i++) { if (mSelFloor[i] != NULL) { - delete mSelFloor[i]; + JKR_DELETE(mSelFloor[i]); mSelFloor[i] = NULL; } if (mIconLinkPos[i] != NULL) { - delete mIconLinkPos[i]; + JKR_DELETE(mIconLinkPos[i]); mIconLinkPos[i] = NULL; } if (mIconBossPos[i] != NULL) { - delete mIconBossPos[i]; + JKR_DELETE(mIconBossPos[i]); mIconBossPos[i] = NULL; } } for (int i = 0; i < 2; i++) { if (mStayIcon[i] != NULL) { - delete mStayIcon[i]; + JKR_DELETE(mStayIcon[i]); mStayIcon[i] = NULL; } } if (field_0x10 != NULL) { - delete field_0x10; + JKR_DELETE(field_0x10); } for (int i = 0; i < 3; i++) { if (field_0x7c[i] != NULL) { - delete field_0x7c[i]; + JKR_DELETE(field_0x7c[i]); field_0x7c[i] = NULL; } if (field_0x88[i] != NULL) { - delete field_0x88[i]; + JKR_DELETE(field_0x88[i]); field_0x88[i] = NULL; } } if (field_0x98 != NULL) { - delete field_0x98; + JKR_DELETE(field_0x98); } if (mMapCtrl != NULL) { mMapCtrl->_delete(); - delete mMapCtrl; + JKR_DELETE(mMapCtrl); } if (mpDresArchiveMount != NULL) { @@ -1632,7 +1632,7 @@ void dMenu_Dmap_c::_create() { JKRHeap* heap = mDoExt_setCurrentHeap(mDmapHeap); u32 sp28 = mDmapHeap->getTotalFreeSize(); - mMapCtrl = new dMenu_DmapMapCtrl_c(); + mMapCtrl = JKR_NEW dMenu_DmapMapCtrl_c(); JUT_ASSERT(3739, mMapCtrl != NULL); mCMessageNum = 0; @@ -1643,12 +1643,12 @@ void dMenu_Dmap_c::_create() { field_0x184 = false; } - mSelStick = new STControl(5, 2, 1, 1, 0.9f, 0.5f, 0, 0x800); + mSelStick = JKR_NEW STControl(5, 2, 1, 1, 0.9f, 0.5f, 0, 0x800); JUT_ASSERT(3753, mSelStick != NULL); mSelStick->setFirstWaitTime(8); u32 sp24 = field_0xe8->getTotalFreeSize(); - mpDrawBg = new dMenu_DmapBg_c(mDmapHeap, mpStick); + mpDrawBg = JKR_NEW dMenu_DmapBg_c(mDmapHeap, mpStick); JUT_ASSERT(3763, mpDrawBg != NULL); mItemTexBuf = (u8*)mDmapHeap->alloc(0xC00, 0x20); diff --git a/src/d/d_menu_dmap_map.cpp b/src/d/d_menu_dmap_map.cpp index 1f5e43dd49..c9dbceabd5 100644 --- a/src/d/d_menu_dmap_map.cpp +++ b/src/d/d_menu_dmap_map.cpp @@ -291,11 +291,11 @@ void dMenu_DmapMap_c::_create(u16 param_0, u16 param_1, u16 param_2, u16 param_3 void dMenu_DmapMap_c::_delete() { for (int i = 0; i < 2; i++) { if (mMapImage_p[i] != NULL) { - delete[] mMapImage_p[i]; + JKR_DELETE_ARRAY(mMapImage_p[i]); } if (mResTIMG[i] != NULL) { - delete[] mResTIMG[i]; + JKR_DELETE_ARRAY(mResTIMG[i]); } } } @@ -303,11 +303,11 @@ void dMenu_DmapMap_c::_delete() { void dMenu_DmapMap_c::setTexture(u16 param_0, u16 param_1, u16 param_2, u16 param_3) { for (int lp1 = 0; lp1 < 2; lp1++) { u32 var_r27 = GXGetTexBufferSize(param_0, param_1, 9, 0, 0); - mMapImage_p[lp1] = new (0x20) u8[var_r27]; + mMapImage_p[lp1] = JKR_NEW_ARGS (0x20) u8[var_r27]; JUT_ASSERT(1672, mMapImage_p[lp1] != NULL); mRend[lp1].init(mMapImage_p[lp1], param_0, param_1, param_2, param_3); - mResTIMG[lp1] = new (0x20) ResTIMG; + mResTIMG[lp1] = JKR_NEW_ARGS (0x20) ResTIMG; JUT_ASSERT(1687, mResTIMG[lp1] != NULL); mRend[lp1].makeResTIMG(mResTIMG[lp1], param_0, param_1, mMapImage_p[lp1], (u8*)dMdm_HIO_prm_res_dst_s::m_res, 30); } diff --git a/src/d/d_menu_fishing.cpp b/src/d/d_menu_fishing.cpp index a37c4f510e..189ce57e0f 100644 --- a/src/d/d_menu_fishing.cpp +++ b/src/d/d_menu_fishing.cpp @@ -38,43 +38,43 @@ dMenu_Fishing_c::dMenu_Fishing_c(JKRExpHeap* i_heap, STControl* i_stick, CSTCont } dMenu_Fishing_c::~dMenu_Fishing_c() { - delete mpString; + JKR_DELETE(mpString); mpString = NULL; - delete mpBlackTex; + JKR_DELETE(mpBlackTex); mpBlackTex = NULL; - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; for (int i = 0; i < MAX_FINDABLE_FISHES; i++) { - delete mpFishParent[i]; + JKR_DELETE(mpFishParent[i]); mpFishParent[i] = NULL; for (int j = 0; j < MAX_FINDABLE_FISHES; j++) { - delete mpFishParts[j][i]; + JKR_DELETE(mpFishParts[j][i]); mpFishParts[j][i] = NULL; } } for (int i = 0; i < 2; i++) { - delete mpFishInfoParent[i]; + JKR_DELETE(mpFishInfoParent[i]); mpFishInfoParent[i] = NULL; } - delete mpIconScreen; + JKR_DELETE(mpIconScreen); mpIconScreen = NULL; for (int i = 0; i < 2; i++) { if (mpButtonAB[i]) { - delete mpButtonAB[i]; + JKR_DELETE(mpButtonAB[i]); mpButtonAB[i] = NULL; } if (mpButtonText[i]) { - delete mpButtonText[i]; + JKR_DELETE(mpButtonText[i]); mpButtonText[i] = NULL; } } @@ -92,7 +92,7 @@ dMenu_Fishing_c::~dMenu_Fishing_c() { } void dMenu_Fishing_c::_create() { - mpString = new dMsgString_c(); + mpString = JKR_NEW dMsgString_c(); screenSetBase(); screenSetDoIcon(); setHIO(true); @@ -164,7 +164,7 @@ int dMenu_Fishing_c::_open() { if (mpMount->sync()) { if (mpArchive == NULL) { mpArchive = (JKRArchive*)mpMount->getArchive(); - delete mpMount; + JKR_DELETE(mpMount); mpMount = NULL; _create(); } @@ -275,25 +275,25 @@ void dMenu_Fishing_c::screenSetBase() { }; ResTIMG* TIMG = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBlackTex = new J2DPicture(TIMG); + mpBlackTex = JKR_NEW J2DPicture(TIMG); mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 0xFF)); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); mpScreen->setPriority("zelda_fish_window.blo", 0x20000, mpArchive); dPaneClass_showNullPane(mpScreen); - mpParent = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); mpParent->setAlphaRate(0.0f); for (int i = 0; i < MAX_FINDABLE_FISHES; i++) { - mpFishParent[i] = new CPaneMgr(mpScreen, fish_n[i], 0, NULL); - mpFishParts[0][i] = new CPaneMgr(mpScreen, fish_p0[i], 0, NULL); - mpFishParts[1][i] = new CPaneMgr(mpScreen, fish_p1[i], 0, NULL); - mpFishParts[2][i] = new CPaneMgr(mpScreen, fish_p2[i], 0, NULL); - mpFishParts[3][i] = new CPaneMgr(mpScreen, fish_p3[i], 0, NULL); - mpFishParts[4][i] = new CPaneMgr(mpScreen, fish_p4[i], 0, NULL); - mpFishParts[5][i] = new CPaneMgr(mpScreen, fish_p5[i], 0, NULL); + mpFishParent[i] = JKR_NEW CPaneMgr(mpScreen, fish_n[i], 0, NULL); + mpFishParts[0][i] = JKR_NEW CPaneMgr(mpScreen, fish_p0[i], 0, NULL); + mpFishParts[1][i] = JKR_NEW CPaneMgr(mpScreen, fish_p1[i], 0, NULL); + mpFishParts[2][i] = JKR_NEW CPaneMgr(mpScreen, fish_p2[i], 0, NULL); + mpFishParts[3][i] = JKR_NEW CPaneMgr(mpScreen, fish_p3[i], 0, NULL); + mpFishParts[4][i] = JKR_NEW CPaneMgr(mpScreen, fish_p4[i], 0, NULL); + mpFishParts[5][i] = JKR_NEW CPaneMgr(mpScreen, fish_p5[i], 0, NULL); } - mpFishInfoParent[0] = new CPaneMgr(mpScreen, MULTI_CHAR('info_blu'), 0, NULL); - mpFishInfoParent[1] = new CPaneMgr(mpScreen, MULTI_CHAR('info_red'), 0, NULL); + mpFishInfoParent[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('info_blu'), 0, NULL); + mpFishInfoParent[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('info_red'), 0, NULL); #if (VERSION == VERSION_GCN_JPN) || (VERSION == VERSION_WII_JPN) J2DTextBox* textBox = (J2DTextBox*)mpScreen->search(MULTI_CHAR('t_t00')); @@ -343,7 +343,7 @@ void dMenu_Fishing_c::screenSetDoIcon() { static const u64 text_a_tag[5] = {MULTI_CHAR('atext1_1'), MULTI_CHAR('atext1_2'), MULTI_CHAR('atext1_3'), MULTI_CHAR('atext1_4'), MULTI_CHAR('atext1_5')}; static const u64 text_b_tag[5] = {MULTI_CHAR('btext1_1'), MULTI_CHAR('btext1_2'), MULTI_CHAR('btext1_3'), MULTI_CHAR('btext1_4'), MULTI_CHAR('btext1_5')}; - mpIconScreen = new J2DScreen(); + mpIconScreen = JKR_NEW J2DScreen(); mpIconScreen->setPriority("zelda_collect_soubi_do_icon_parts.blo", 0x20000, mpArchive); for (int i = 0; i < 2; i++) { mpButtonAB[i] = NULL; diff --git a/src/d/d_menu_fmap.cpp b/src/d/d_menu_fmap.cpp index 2cb5987613..58c839d666 100644 --- a/src/d/d_menu_fmap.cpp +++ b/src/d/d_menu_fmap.cpp @@ -296,16 +296,16 @@ dMenu_Fmap_c::~dMenu_Fmap_c() { removeAreaData(); if (mpDraw2DBack != NULL) { - delete mpDraw2DBack; + JKR_DELETE(mpDraw2DBack); mpDraw2DBack = NULL; } if (mpDraw2DTop != NULL) { - delete mpDraw2DTop; + JKR_DELETE(mpDraw2DTop); mpDraw2DTop = NULL; } if (mpMenuFmapMap != NULL) { mpMenuFmapMap->_delete(); - delete mpMenuFmapMap; + JKR_DELETE(mpMenuFmapMap); mpMenuFmapMap = NULL; } @@ -338,12 +338,12 @@ dMenu_Fmap_c::~dMenu_Fmap_c() { void dMenu_Fmap_c::_create() { mpHeap->getTotalFreeSize(); - mpDraw2DBack = new dMenu_Fmap2DBack_c(); + mpDraw2DBack = JKR_NEW dMenu_Fmap2DBack_c(); JUT_ASSERT(594, mpDraw2DBack != NULL); mpDraw2DBack->setRegionCursor(dComIfGp_getNowLevel() - 1); - mpDraw2DTop = new dMenu_Fmap2DTop_c(mpHeap, mpStick); + mpDraw2DTop = JKR_NEW dMenu_Fmap2DTop_c(mpHeap, mpStick); JUT_ASSERT(599, mpDraw2DTop != NULL); - mpMenuFmapMap = new dMenu_FmapMap_c(); + mpMenuFmapMap = JKR_NEW dMenu_FmapMap_c(); JUT_ASSERT(603, mpMenuFmapMap != NULL); mpMenuFmapMap->_create(dMeter2Info_get2DWidth(), dMeter2Info_get2DHeight(), dMeter2Info_get2DWidth(), dMeter2Info_get2DHeight(), mpFmapMapRes); @@ -1999,7 +1999,7 @@ bool dMenu_Fmap_c::readWorldData(u8 i_regionNo) { } if (head != -1 && mpWorldData == NULL) { - mpWorldData = new dMenu_Fmap_world_data_c(mpRegionData[head]); + mpWorldData = JKR_NEW dMenu_Fmap_world_data_c(mpRegionData[head]); mpDraw2DBack->setWorldPosMinMax(mpWorldData->getWorldMinX(), mpWorldData->getWorldMinZ(), mpWorldData->getWorldMaxX(), mpWorldData->getWorldMaxZ()); } @@ -2099,7 +2099,7 @@ bool dMenu_Fmap_c::readAreaData(u8 i_regionNo, bool i_isSelectedRegion) { } if (bVar2) { - dMenu_Fmap_stage_data_c* stage_data = new dMenu_Fmap_stage_data_c(); + dMenu_Fmap_stage_data_c* stage_data = JKR_NEW dMenu_Fmap_stage_data_c(); if (mpStageData[i_regionNo - 1] == NULL) { mpStageData[i_regionNo - 1] = stage_data; } else { @@ -2140,7 +2140,7 @@ bool dMenu_Fmap_c::readAreaData(u8 i_regionNo, bool i_isSelectedRegion) { mSpotNum++; } - dMenuMapCommon_c::RoomData_c* room_data = new dMenuMapCommon_c::RoomData_c(); + dMenuMapCommon_c::RoomData_c* room_data = JKR_NEW dMenuMapCommon_c::RoomData_c(); if (mpRoomData[i_regionNo - 1] == NULL) { mpRoomData[i_regionNo - 1] = room_data; } else { @@ -2160,7 +2160,7 @@ bool dMenu_Fmap_c::readAreaData(u8 i_regionNo, bool i_isSelectedRegion) { } if (mpRegionData[i_regionNo - 1] == NULL) { - mpRegionData[i_regionNo - 1] = new dMenu_Fmap_region_data_c(i_regionNo, + mpRegionData[i_regionNo - 1] = JKR_NEW dMenu_Fmap_region_data_c(i_regionNo, mpStageData[i_regionNo - 1], mRegionOffsetX[i_regionNo - 1], mRegionOffsetZ[i_regionNo - 1]); @@ -2201,9 +2201,9 @@ bool dMenu_Fmap_c::readRoomData(char const* i_stageName, dMenu_Fmap_stage_data_c sprintf(room_path, "%s/room%d.dzs", i_stageName, room_nos[i]); if (readRoomDzsData(&dzs_data, 0x1500, room_path)) { - dMenu_Fmap_data_c* map_data = new dMenu_Fmap_data_c(); + dMenu_Fmap_data_c* map_data = JKR_NEW dMenu_Fmap_data_c(); dMenu_Fmap_room_data_c* room_data - = new dMenu_Fmap_room_data_c(room_nos[i], i_stageData, map_data); + = JKR_NEW dMenu_Fmap_room_data_c(room_nos[i], i_stageData, map_data); if (prev_room_data == NULL) { i_stageData->setFmapRoomDataTop(room_data); } else { @@ -2362,7 +2362,7 @@ bool dMenu_Fmap_c::removeAreaData() { if (mpWorldData != NULL) { if (mpWorldData != NULL) { - delete mpWorldData; + JKR_DELETE(mpWorldData); } mpWorldData = NULL; } @@ -2370,7 +2370,7 @@ bool dMenu_Fmap_c::removeAreaData() { for (int i = 0; i < 8; i++) { if (mpRegionData[i] != NULL) { if (mpRegionData[i] != NULL) { - delete mpRegionData[i]; + JKR_DELETE(mpRegionData[i]); } mpRegionData[i] = NULL; } @@ -2382,7 +2382,7 @@ bool dMenu_Fmap_c::removeAreaData() { dMenu_Fmap_stage_data_c* next_data = stage_data->getNextData(); removeRoomData(stage_data); if (stage_data != NULL) { - delete stage_data; + JKR_DELETE(stage_data); } stage_data = next_data; } @@ -2394,7 +2394,7 @@ bool dMenu_Fmap_c::removeAreaData() { if (data != NULL) { mpHeap->free(data); } - delete room_data; + JKR_DELETE(room_data); room_data = next_data; } } @@ -2426,9 +2426,9 @@ bool dMenu_Fmap_c::removeRoomData(dMenu_Fmap_stage_data_c* i_stageData) { mpHeap->free(dzs_data); } if (fmap_data != NULL) { - delete fmap_data; + JKR_DELETE(fmap_data); } - delete room_data; + JKR_DELETE(room_data); room_data = next_data; } return true; diff --git a/src/d/d_menu_fmap2D.cpp b/src/d/d_menu_fmap2D.cpp index 9f6cf74c07..4048ddd4d2 100644 --- a/src/d/d_menu_fmap2D.cpp +++ b/src/d/d_menu_fmap2D.cpp @@ -151,7 +151,7 @@ dMenu_Fmap2DBack_c::dMenu_Fmap2DBack_c() { initiate(dComIfGp_getFmapResArchive()); - mpBackScreen = new J2DScreen(); + mpBackScreen = JKR_NEW J2DScreen(); JUT_ASSERT(238, mpBackScreen != NULL); bool fg = mpBackScreen->setPriority("zelda_map_screen_stone_base.blo", 0x20000, @@ -160,7 +160,7 @@ dMenu_Fmap2DBack_c::dMenu_Fmap2DBack_c() { dPaneClass_showNullPane(mpBackScreen); - mpBaseScreen = new J2DScreen(); + mpBaseScreen = JKR_NEW J2DScreen(); JUT_ASSERT(248, mpBaseScreen != NULL) fg = mpBaseScreen->setPriority("zelda_map_screen_base.blo", 0x20000, @@ -175,27 +175,27 @@ dMenu_Fmap2DBack_c::dMenu_Fmap2DBack_c() { mAnmFrame = 0.0; - mpBaseRoot = new CPaneMgrAlphaMorf(mpBaseScreen, 'ROOT', 2, NULL); + mpBaseRoot = JKR_NEW CPaneMgrAlphaMorf(mpBaseScreen, 'ROOT', 2, NULL); JUT_ASSERT(264, mpBaseRoot != NULL); - mpMapArea = new CPaneMgr(mpBaseScreen, MULTI_CHAR('center_n'), 0, NULL); + mpMapArea = JKR_NEW CPaneMgr(mpBaseScreen, MULTI_CHAR('center_n'), 0, NULL); JUT_ASSERT(269, mpMapArea != NULL); - mpMapBlack = new CPaneMgr(mpBaseScreen, MULTI_CHAR('map_blak'), 0, NULL); + mpMapBlack = JKR_NEW CPaneMgr(mpBaseScreen, MULTI_CHAR('map_blak'), 0, NULL); JUT_ASSERT(273, mpMapBlack != NULL); - mpMeterHaihai = new dMeterHaihai_c(1); + mpMeterHaihai = JKR_NEW dMeterHaihai_c(1); JUT_ASSERT(277, mpMeterHaihai != NULL); ResTIMG* backTexResource = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBackTex = new J2DPicture(backTexResource); + mpBackTex = JKR_NEW J2DPicture(backTexResource); JUT_ASSERT(282, mpBackTex != NULL); mpBackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 255)); mpBackTex->setAlpha(0); - mpPointScreen = new J2DScreen(); + mpPointScreen = JKR_NEW J2DScreen(); JUT_ASSERT(293, mpPointScreen != NULL); mpPointScreen->setPriority("zelda_field_map_point_cursor.blo", 0x20000, @@ -204,7 +204,7 @@ dMenu_Fmap2DBack_c::dMenu_Fmap2DBack_c() { dPaneClass_showNullPane(mpPointScreen); - mpPointParent = new CPaneMgr(mpPointScreen, MULTI_CHAR('f_po_n'), 2, NULL); + mpPointParent = JKR_NEW CPaneMgr(mpPointScreen, MULTI_CHAR('f_po_n'), 2, NULL); JUT_ASSERT(301, mpPointParent != NULL); mpPointParent->scale(g_fmapHIO.mCursorScale, g_fmapHIO.mCursorScale); @@ -224,39 +224,39 @@ dMenu_Fmap2DBack_c::dMenu_Fmap2DBack_c() { } dMenu_Fmap2DBack_c::~dMenu_Fmap2DBack_c() { - delete mpBackScreen; + JKR_DELETE(mpBackScreen); mpBackScreen = NULL; - delete mpBaseScreen; + JKR_DELETE(mpBaseScreen); mpBaseScreen = NULL; - delete mpBaseAnm; + JKR_DELETE(mpBaseAnm); mpBaseAnm = NULL; - delete mpBaseRoot; + JKR_DELETE(mpBaseRoot); mpBaseRoot = NULL; - delete mpMapArea; + JKR_DELETE(mpMapArea); mpMapArea = NULL; - delete mpMapBlack; + JKR_DELETE(mpMapBlack); mpMapBlack = NULL; - delete mpMeterHaihai; + JKR_DELETE(mpMeterHaihai); mpMeterHaihai = NULL; - delete mpBackTex; + JKR_DELETE(mpBackTex); mpBackTex = NULL; - delete mpPointScreen; + JKR_DELETE(mpPointScreen); mpPointScreen = NULL; - delete mpPointParent; + JKR_DELETE(mpPointParent); mpPointParent = NULL; for (int i = 0; i < 8; i++) { if (mpAreaTex[i] != NULL) { - delete mpAreaTex[i]; + JKR_DELETE(mpAreaTex[i]); mpAreaTex[i] = NULL; } } @@ -434,7 +434,7 @@ void dMenu_Fmap2DBack_c::setRegionTexData(u8 i_areaType, ResTIMG* i_timg, f32 i_ i_scale = 100.0f; } - mpAreaTex[i_areaType] = new J2DPicture(i_timg); + mpAreaTex[i_areaType] = JKR_NEW J2DPicture(i_timg); JUT_ASSERT(763, mpAreaTex[i_areaType] != NULL); mRegionOriginX[i_areaType] = i_originX; @@ -673,14 +673,14 @@ void dMenu_Fmap2DBack_c::calcAllMapPosWorld(f32 param_0, f32 param_1, f32* outX, void dMenu_Fmap2DBack_c::setSpotPane(ResTIMG* i_timg) { if (mpSpotTexture == NULL) { - mpSpotTexture = new J2DPicture(i_timg); + mpSpotTexture = JKR_NEW J2DPicture(i_timg); JUT_ASSERT(1169, mpSpotTexture != NULL); } } void dMenu_Fmap2DBack_c::deleteSpotPane() { if (mpSpotTexture != NULL) { - delete mpSpotTexture; + JKR_DELETE(mpSpotTexture); mpSpotTexture = NULL; } } @@ -2164,7 +2164,7 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { mpPortalBin = NULL; mpScrnExplain = NULL; - mpTitleScreen = new J2DScreen(); + mpTitleScreen = JKR_NEW J2DScreen(); JUT_ASSERT(3872, mpTitleScreen != NULL); #if PLATFORM_GCN bool fg = mpTitleScreen->setPriority("zelda_map_screen_title.blo", 0x1020000, @@ -2176,7 +2176,7 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { JUT_ASSERT(3877, fg != false); dPaneClass_showNullPane(mpTitleScreen); - mpTitleRoot = new CPaneMgrAlphaMorf(mpTitleScreen, 'ROOT', 2, NULL); + mpTitleRoot = JKR_NEW CPaneMgrAlphaMorf(mpTitleScreen, 'ROOT', 2, NULL); JUT_ASSERT(3881, mpTitleRoot != NULL); #if PLATFORM_SHIELD for (int i = 0; i < 2; i++) { @@ -2190,43 +2190,43 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { mpTitleScreen->search(MULTI_CHAR('tri_Null'))->hide(); #endif #if PLATFORM_GCN - mpArrowLAlpha[0] = new CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('yaji_04'), 0, NULL); - mpArrowLAlpha[1] = new CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('yaji_05'), 0, NULL); - mpArrowRAlpha[0] = new CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('yaji_06'), 0, NULL); - mpArrowRAlpha[1] = new CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('yaji_07'), 0, NULL); + mpArrowLAlpha[0] = JKR_NEW CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('yaji_04'), 0, NULL); + mpArrowLAlpha[1] = JKR_NEW CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('yaji_05'), 0, NULL); + mpArrowRAlpha[0] = JKR_NEW CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('yaji_06'), 0, NULL); + mpArrowRAlpha[1] = JKR_NEW CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('yaji_07'), 0, NULL); - mpDpadAlpha = new CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('juji_c_n'), 2, NULL); + mpDpadAlpha = JKR_NEW CPaneMgrAlpha(mpTitleScreen, MULTI_CHAR('juji_c_n'), 2, NULL); mpDpadAlpha->setAlphaRate(0.0f); - mpAnalogStickAlpha = new CPaneMgrAlpha(mpTitleScreen, 'as_n', 2, NULL); + mpAnalogStickAlpha = JKR_NEW CPaneMgrAlpha(mpTitleScreen, 'as_n', 2, NULL); mpAnalogStickAlpha->setAlphaRate(0.0f); - mpAnalogStick = new CPaneMgr(mpTitleScreen, 'as_n', 0, NULL); - mpDpad = new CPaneMgr(mpTitleScreen, MULTI_CHAR('juji_c_n'), 0, NULL); + mpAnalogStick = JKR_NEW CPaneMgr(mpTitleScreen, 'as_n', 0, NULL); + mpDpad = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('juji_c_n'), 0, NULL); #endif #if PLATFORM_SHIELD - mpButtonA = new CPaneMgr(mpTitleScreen, MULTI_CHAR('abtn_n'), 2, NULL); + mpButtonA = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('abtn_n'), 2, NULL); JUT_ASSERT(3935, mpButtonA != NULL); - mpButtonB = new CPaneMgr(mpTitleScreen, MULTI_CHAR('bbtn_n'), 2, NULL); + mpButtonB = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('bbtn_n'), 2, NULL); JUT_ASSERT(3938, mpButtonB != NULL); - mpButtonZ = new CPaneMgr(mpTitleScreen, MULTI_CHAR('j_scal_n'), 2, NULL); + mpButtonZ = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('j_scal_n'), 2, NULL); JUT_ASSERT(3941, mpButtonZ != NULL); - mpButtonTextA = new CPaneMgr(mpTitleScreen, MULTI_CHAR('a_text_n'), 2, NULL); + mpButtonTextA = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('a_text_n'), 2, NULL); JUT_ASSERT(3953, mpButtonTextA != NULL); - mpButtonTextB = new CPaneMgr(mpTitleScreen, MULTI_CHAR('b_text_n'), 2, NULL); + mpButtonTextB = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('b_text_n'), 2, NULL); JUT_ASSERT(3956, mpButtonTextB != NULL); - mpButtonTextZ = new CPaneMgr(mpTitleScreen, MULTI_CHAR('z_text_n'), 2, NULL); + mpButtonTextZ = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('z_text_n'), 2, NULL); JUT_ASSERT(3959, mpButtonTextZ != NULL); #else - mpButtonA = new CPaneMgr(mpTitleScreen, MULTI_CHAR('abtn_n1'), 2, NULL); + mpButtonA = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('abtn_n1'), 2, NULL); JUT_ASSERT(3935, mpButtonA != NULL); - mpButtonB = new CPaneMgr(mpTitleScreen, MULTI_CHAR('bbtn_n1'), 2, NULL); + mpButtonB = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('bbtn_n1'), 2, NULL); JUT_ASSERT(3938, mpButtonB != NULL); - mpButtonZ = new CPaneMgr(mpTitleScreen, MULTI_CHAR('zbtn_n1'), 2, NULL); + mpButtonZ = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('zbtn_n1'), 2, NULL); JUT_ASSERT(3941, mpButtonZ != NULL); - mpButtonTextA = new CPaneMgr(mpTitleScreen, MULTI_CHAR('a_text_n'), 2, NULL); + mpButtonTextA = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('a_text_n'), 2, NULL); JUT_ASSERT(3953, mpButtonTextA != NULL); - mpButtonTextB = new CPaneMgr(mpTitleScreen, MULTI_CHAR('b_text_n'), 2, NULL); + mpButtonTextB = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('b_text_n'), 2, NULL); JUT_ASSERT(3956, mpButtonTextB != NULL); - mpButtonTextZ = new CPaneMgr(mpTitleScreen, MULTI_CHAR('z_text_n'), 2, NULL); + mpButtonTextZ = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('z_text_n'), 2, NULL); JUT_ASSERT(3959, mpButtonTextZ != NULL); #endif mpButtonA->setAlphaRate(0.0f); @@ -2236,16 +2236,16 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { mpButtonTextB->setAlphaRate(0.0f); mpButtonTextZ->setAlphaRate(0.0f); - mpNamePane = new CPaneMgr(mpTitleScreen, MULTI_CHAR('name_n'), 0, NULL); + mpNamePane = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('name_n'), 0, NULL); JUT_ASSERT(3970, mpNamePane != NULL); - mpSubPane = new CPaneMgr(mpTitleScreen, MULTI_CHAR('sub_n_n'), 0, NULL); + mpSubPane = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('sub_n_n'), 0, NULL); JUT_ASSERT(3974, mpSubPane != NULL); if (dMeter2Info_getMapStatus() == 9) { mpNamePane->hide(); mpSubPane->hide(); } - mpContPane = new CPaneMgr(mpTitleScreen, MULTI_CHAR('cont_n'), 0, NULL); + mpContPane = JKR_NEW CPaneMgr(mpTitleScreen, MULTI_CHAR('cont_n'), 0, NULL); JUT_ASSERT(3984, mpContPane != NULL); mTitlePosX = mTitlePosY = 0.0f; @@ -2412,58 +2412,58 @@ dMenu_Fmap2DTop_c::dMenu_Fmap2DTop_c(JKRExpHeap* i_heap, STControl* i_stick) { dMenu_Fmap2DTop_c::~dMenu_Fmap2DTop_c() { deleteExplain(); - delete mpTitleScreen; + JKR_DELETE(mpTitleScreen); mpTitleScreen = NULL; - delete mpTitleRoot; + JKR_DELETE(mpTitleRoot); if (mpTitleRoot != NULL) { } - delete mpButtonA; + JKR_DELETE(mpButtonA); mpButtonA = NULL; - delete mpButtonB; + JKR_DELETE(mpButtonB); mpButtonB = NULL; - delete mpButtonZ; + JKR_DELETE(mpButtonZ); mpButtonZ = NULL; - delete mpButtonTextA; + JKR_DELETE(mpButtonTextA); mpButtonTextA = NULL; - delete mpButtonTextB; + JKR_DELETE(mpButtonTextB); mpButtonTextB = NULL; - delete mpButtonTextZ; + JKR_DELETE(mpButtonTextZ); mpButtonTextZ = NULL; if (mpDpadAlpha != NULL) { - delete mpDpadAlpha; + JKR_DELETE(mpDpadAlpha); mpDpadAlpha = NULL; } if (mpAnalogStickAlpha != NULL) { - delete mpAnalogStickAlpha; + JKR_DELETE(mpAnalogStickAlpha); mpAnalogStickAlpha = NULL; } - delete mpNamePane; + JKR_DELETE(mpNamePane); mpNamePane = NULL; - delete mpSubPane; + JKR_DELETE(mpSubPane); mpSubPane = NULL; if (mpAnalogStick != NULL) { - delete mpAnalogStick; + JKR_DELETE(mpAnalogStick); mpAnalogStick = NULL; } if (mpDpad != NULL) { - delete mpDpad; + JKR_DELETE(mpDpad); mpDpad = NULL; } - delete mpContPane; + JKR_DELETE(mpContPane); mpContPane = NULL; for (int i = 0; i < 2; i++) { if (mpArrowLAlpha[i] != NULL) { - delete mpArrowLAlpha[i]; + JKR_DELETE(mpArrowLAlpha[i]); if (mpArrowLAlpha[i] != NULL) { } } if (mpArrowRAlpha[i] != NULL) { - delete mpArrowRAlpha[i]; + JKR_DELETE(mpArrowRAlpha[i]); if (mpArrowRAlpha[i] != NULL) { } } } - delete mpAnm; + JKR_DELETE(mpAnm); mpAnm = NULL; } @@ -2781,7 +2781,7 @@ void dMenu_Fmap2DTop_c::set3DStickString(u32 param_0) { void dMenu_Fmap2DTop_c::createExplain(JKRExpHeap* i_heap, STControl* i_stick) { if (!mpScrnExplain) { JKRHeap* heap = mDoExt_setCurrentHeap(i_heap); - mpScrnExplain = new dMsgScrnExplain_c(i_stick, 0, false, 1); + mpScrnExplain = JKR_NEW dMsgScrnExplain_c(i_stick, 0, false, 1); JUT_ASSERT(4743, mpScrnExplain != NULL); mDoExt_setCurrentHeap(heap); } @@ -2789,7 +2789,7 @@ void dMenu_Fmap2DTop_c::createExplain(JKRExpHeap* i_heap, STControl* i_stick) { void dMenu_Fmap2DTop_c::deleteExplain() { if (mpScrnExplain) { - delete mpScrnExplain; + JKR_DELETE(mpScrnExplain); mpScrnExplain = NULL; } } diff --git a/src/d/d_menu_fmap_map.cpp b/src/d/d_menu_fmap_map.cpp index 39e23e5ef8..bfd87bf74c 100644 --- a/src/d/d_menu_fmap_map.cpp +++ b/src/d/d_menu_fmap_map.cpp @@ -490,11 +490,11 @@ void dMenu_FmapMap_c::_create(u16 i_texWidth, u16 i_texHeight, u16 param_2, u16 void dMenu_FmapMap_c::_delete() { if (mResTIMG != NULL) { - delete mResTIMG; + JKR_DELETE(mResTIMG); mResTIMG = NULL; } if (mMapImage_p != NULL) { - delete[] mMapImage_p; + JKR_DELETE_ARRAY(mMapImage_p); mMapImage_p = NULL; } } @@ -660,9 +660,9 @@ void dMenu_FmapMap_c::setTexture(u16 i_width, u16 i_height, u16 param_2, u16 par mMapImage_p = NULL; mResTIMG = NULL; int size = GXGetTexBufferSize(i_width, i_height, GX_TF_C8, 0, 0); - mMapImage_p = new (0x20) u8[size]; + mMapImage_p = JKR_NEW_ARGS (0x20) u8[size]; init(mMapImage_p, i_width, i_height, param_2, param_3); - mResTIMG = new (0x20) ResTIMG(); + mResTIMG = JKR_NEW_ARGS (0x20) ResTIMG(); makeResTIMG(mResTIMG, i_width, i_height, mMapImage_p, (u8*)m_palette, 0x1b); } diff --git a/src/d/d_menu_insect.cpp b/src/d/d_menu_insect.cpp index 1cc94b391b..2ca08206f7 100644 --- a/src/d/d_menu_insect.cpp +++ b/src/d/d_menu_insect.cpp @@ -55,77 +55,77 @@ dMenu_Insect_c::dMenu_Insect_c(JKRExpHeap* i_heap, STControl* i_stick, CSTContro field_0xfb = 0xff; field_0xf7 = 1; ResTIMG* image = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBlackTex = new J2DPicture(image); + mpBlackTex = JKR_NEW J2DPicture(image); mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 0xff)); field_0xfc = 0; - mpDrawCursor = new dSelect_cursor_c(2, 1.0f, NULL); + mpDrawCursor = JKR_NEW dSelect_cursor_c(2, 1.0f, NULL); mpDrawCursor->setParam(1.0f, 1.0f, 0.1f, 0.7f, 0.7f); mpDrawCursor->setAlphaRate(0.0f); mpDrawCursor->setScale(0.0f); mpDrawCursor->offPlayAnime(0); - mpSelect_c = new dMsgScrn3Select_c(); + mpSelect_c = JKR_NEW dMsgScrn3Select_c(); mpExpItemTex = (ResTIMG*)mpHeap->alloc(0xc00, 0x20); } dMenu_Insect_c::~dMenu_Insect_c() { - delete mpBlackTex; + JKR_DELETE(mpBlackTex); mpBlackTex = NULL; - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; - delete mpSelect_c; + JKR_DELETE(mpSelect_c); mpSelect_c = NULL; mpHeap->free(mpExpItemTex); mpExpItemTex = NULL; - delete mpString; + JKR_DELETE(mpString); mpString = NULL; - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; for (int i = 0; i < MAX_INSECT_NUM; i++) { - delete mpINSParent[i]; + JKR_DELETE(mpINSParent[i]); mpINSParent[i] = NULL; } - delete mpExpScreen; + JKR_DELETE(mpExpScreen); mpExpScreen = NULL; - delete mpExpParent; + JKR_DELETE(mpExpParent); mpExpParent = NULL; for (int i = 0; i < 2; i++) { - delete mpExpSubWin[i]; + JKR_DELETE(mpExpSubWin[i]); mpExpSubWin[i] = NULL; } - delete mpInfoText; + JKR_DELETE(mpInfoText); mpInfoText = NULL; - delete mpIconScreen; + JKR_DELETE(mpIconScreen); mpIconScreen = NULL; for (int i = 0; i < 2; i++) { if (mpButtonAB[i] != NULL) { - delete mpButtonAB[i]; + JKR_DELETE(mpButtonAB[i]); mpButtonAB[i] = NULL; } if (mpButtonText[i] != NULL) { - delete mpButtonText[i]; + JKR_DELETE(mpButtonText[i]); mpButtonText[i] = NULL; } } if (mpMount != NULL) { mpMount->getArchive()->unmount(); - delete mpMount; + JKR_DELETE(mpMount); mpMount = NULL; } @@ -138,7 +138,7 @@ dMenu_Insect_c::~dMenu_Insect_c() { } void dMenu_Insect_c::_create() { - mpString = new dMsgString_c(); + mpString = JKR_NEW dMsgString_c(); screenSetBase(); screenSetExplain(); screenSetDoIcon(); @@ -195,7 +195,7 @@ int dMenu_Insect_c::_open() { if (mpMount->sync() != 0) { if (mpArchive == NULL) { mpArchive = (JKRArchive*)mpMount->getArchive(); - delete mpMount; + JKR_DELETE(mpMount); mpMount = NULL; _create(); } @@ -451,13 +451,13 @@ void dMenu_Insect_c::screenSetBase() { MULTI_CHAR('ageha16'), MULTI_CHAR('ageha17'), MULTI_CHAR('ageha18'), MULTI_CHAR('ageha19'), MULTI_CHAR('ageha20'), MULTI_CHAR('ageha21'), MULTI_CHAR('ageha22'), MULTI_CHAR('ageha23'), }; - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); mpScreen->setPriority("zelda_gold_insects.blo", 0x20000, mpArchive); dPaneClass_showNullPane(mpScreen); - mpParent = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); mpParent->setAlphaRate(0.0f); for (int i = 0; i < MAX_INSECT_NUM; i++) { - mpINSParent[i] = new CPaneMgr(mpScreen, insect_tag[i], 0, NULL); + mpINSParent[i] = JKR_NEW CPaneMgr(mpScreen, insect_tag[i], 0, NULL); } for (int i = 0; i < 6; i++) { for (int j = 0; j < 4; j++) { @@ -487,23 +487,23 @@ void dMenu_Insect_c::screenSetBase() { } void dMenu_Insect_c::screenSetExplain() { - mpExpScreen = new J2DScreen(); + mpExpScreen = JKR_NEW J2DScreen(); mpExpScreen->setPriority("zelda_gold_insects_info.blo", 0x20000, mpArchive); dPaneClass_showNullPane(mpExpScreen); - mpExpParent = new CPaneMgr(mpExpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpExpParent = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('n_all'), 2, NULL); mpExpParent->setAlphaRate(0.0f); - mpExpSubWin[0] = new CPaneMgr(mpExpScreen, MULTI_CHAR('in_win_n'), 0, NULL); - mpExpSubWin[1] = new CPaneMgr(mpExpScreen, MULTI_CHAR('w_d_mo_n'), 0, NULL); + mpExpSubWin[0] = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('in_win_n'), 0, NULL); + mpExpSubWin[1] = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('w_d_mo_n'), 0, NULL); if (field_0xf6 == 0) { mpExpSubWin[1]->hide(); } #if VERSION == VERSION_GCN_JPN - mpInfoText = new CPaneMgr(mpExpScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpInfoText = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('mg_3line'), 0, NULL); mpExpScreen->search(MULTI_CHAR('n_e4line'))->hide(); field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('w_msg_jp')); mpExpScreen->search(MULTI_CHAR('ms_for_2'))->hide(); #else - mpInfoText = new CPaneMgr(mpExpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpInfoText = JKR_NEW CPaneMgr(mpExpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); mpExpScreen->search(MULTI_CHAR('n_3line'))->hide(); field_0x5c = (J2DTextBox*)mpExpScreen->search(MULTI_CHAR('ms_for_2')); mpExpScreen->search(MULTI_CHAR('w_msg_jp'))->hide(); @@ -527,7 +527,7 @@ void dMenu_Insect_c::screenSetDoIcon() { MULTI_CHAR('btext1_1'), MULTI_CHAR('btext1_2'), MULTI_CHAR('btext1_3'), MULTI_CHAR('btext1_4'), MULTI_CHAR('btext1_5'), }; - mpIconScreen = new J2DScreen(); + mpIconScreen = JKR_NEW J2DScreen(); mpIconScreen->setPriority("zelda_collect_soubi_do_icon_parts.blo", 0x20000, mpArchive); for (int i = 0; i < 2; i++) { mpButtonAB[i] = 0; diff --git a/src/d/d_menu_item_explain.cpp b/src/d/d_menu_item_explain.cpp index 7119ef3e03..a9db695937 100644 --- a/src/d/d_menu_item_explain.cpp +++ b/src/d/d_menu_item_explain.cpp @@ -93,21 +93,21 @@ dMenu_ItemExplain_c::dMenu_ItemExplain_c(JKRExpHeap* i_heap, JKRArchive* i_archi field_0x60[i] = 0; } field_0xdc = 0; - mpInfoString = new dMsgString_c(1); - mpKanteraMeter = new dKantera_icon_c(); - mpInfoScreen = new J2DScreen(); + mpInfoString = JKR_NEW dMsgString_c(1); + mpKanteraMeter = JKR_NEW dKantera_icon_c(); + mpInfoScreen = JKR_NEW J2DScreen(); mpInfoScreen->setPriority("zelda_item_screen_info.blo", 0x20000, mpArchive); - mpParent[0] = new CPaneMgr(mpInfoScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent[0] = JKR_NEW CPaneMgr(mpInfoScreen, MULTI_CHAR('n_all'), 2, NULL); mpParent[1] = NULL; - mpLabel = new CPaneMgr(mpInfoScreen, MULTI_CHAR('label_n'), 0, NULL); + mpLabel = JKR_NEW CPaneMgr(mpInfoScreen, MULTI_CHAR('label_n'), 0, NULL); mDescAlpha = 0.0f; field_0x78 = 0; mAlphaRatio = 201.0f; #if VERSION == VERSION_GCN_JPN - mpInfoText = new CPaneMgr(mpInfoScreen, MULTI_CHAR('i_text4'), 0, NULL); + mpInfoText = JKR_NEW CPaneMgr(mpInfoScreen, MULTI_CHAR('i_text4'), 0, NULL); mpInfoScreen->search(MULTI_CHAR('i_text1'))->hide(); #else - mpInfoText = new CPaneMgr(mpInfoScreen, MULTI_CHAR('i_text1'), 0, NULL); + mpInfoText = JKR_NEW CPaneMgr(mpInfoScreen, MULTI_CHAR('i_text1'), 0, NULL); mpInfoScreen->search(MULTI_CHAR('i_text4'))->hide(); #endif ((J2DTextBox*)(mpInfoText->getPanePtr()))->setFont(mDoExt_getMesgFont()); @@ -115,33 +115,33 @@ dMenu_ItemExplain_c::dMenu_ItemExplain_c(JKRExpHeap* i_heap, JKRArchive* i_archi mpInfoText->show(); for (int i = 0; i < 4; i++) { #if VERSION == VERSION_GCN_JPN - mpNameText[i] = new CPaneMgr(mpInfoScreen, name_tag[i], 0, NULL); + mpNameText[i] = JKR_NEW CPaneMgr(mpInfoScreen, name_tag[i], 0, NULL); mpInfoScreen->search(fame_tag[i])->hide(); #else - mpNameText[i] = new CPaneMgr(mpInfoScreen, fame_tag[i], 0, NULL); + mpNameText[i] = JKR_NEW CPaneMgr(mpInfoScreen, fame_tag[i], 0, NULL); mpInfoScreen->search(name_tag[i])->hide(); #endif ((J2DTextBox*)(mpNameText[i]->getPanePtr()))->setFont(mDoExt_getMesgFont()); ((J2DTextBox*)(mpNameText[i]->getPanePtr()))->setString(0x20, ""); } - mpInfoIcon = new CPaneMgr(mpInfoScreen, MULTI_CHAR('i_icon_p'), 0, NULL); + mpInfoIcon = JKR_NEW CPaneMgr(mpInfoScreen, MULTI_CHAR('i_icon_p'), 0, NULL); for (int i = 0; i < 4; i++) { mpExpItemTex[i] = (ResTIMG*)mpHeap->alloc(0xC00, 0x20); } - mpExpItemPane[0] = new J2DPicture( + mpExpItemPane[0] = JKR_NEW J2DPicture( MULTI_CHAR('i_icon_1'), JGeometry::TBox2(0.0f, 0.0f, mpInfoIcon->getInitSizeX(), mpInfoIcon->getInitSizeY()), ((J2DPicture*)(mpInfoIcon->getPanePtr()))->getTexture(0)->getTexInfo(), NULL); mpExpItemPane[0]->setBasePosition(J2DBasePosition_4); mpInfoIcon->getPanePtr()->appendChild(mpExpItemPane[0]); - mpExpItemPane[1] = new J2DPicture( + mpExpItemPane[1] = JKR_NEW J2DPicture( MULTI_CHAR('i_icon_2'), JGeometry::TBox2(0.0f, 0.0f, mpInfoIcon->getInitSizeX(), mpInfoIcon->getInitSizeY()), ((J2DPicture*)(mpInfoIcon->getPanePtr()))->getTexture(0)->getTexInfo(), NULL); mpExpItemPane[1]->setBasePosition(J2DBasePosition_4); mpInfoIcon->getPanePtr()->appendChild(mpExpItemPane[1]); - mpExpItemPane[2] = new J2DPicture( + mpExpItemPane[2] = JKR_NEW J2DPicture( MULTI_CHAR('i_icon_3'), JGeometry::TBox2(0.0f, 0.0f, mpInfoIcon->getInitSizeX(), mpInfoIcon->getInitSizeY()), ((J2DPicture*)(mpInfoIcon->getPanePtr()))->getTexture(0)->getTexInfo(), NULL); @@ -151,7 +151,7 @@ dMenu_ItemExplain_c::dMenu_ItemExplain_c(JKRExpHeap* i_heap, JKRArchive* i_archi ResTIMG* texResource = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource( 'TIMG', dMeter2Info_getNumberTextureName(0)); for (int i = 0; i < 3; i++) { - mpItemNumTex[i] = new J2DPicture(texResource); + mpItemNumTex[i] = JKR_NEW J2DPicture(texResource); mpInfoScreen->search(MULTI_CHAR('info_n1'))->appendChild(mpItemNumTex[i]); mpItemNumTex[i]->move(i * 16.0f + (mpInfoIcon->getPosX() + mpInfoIcon->getSizeX() * 0.5f), mpInfoIcon->getPosY() + mpInfoIcon->getSizeY() - 3.0f); @@ -160,7 +160,7 @@ dMenu_ItemExplain_c::dMenu_ItemExplain_c(JKRExpHeap* i_heap, JKRArchive* i_archi if (param_3 == 1) { texResource = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBackTex = new J2DPicture(texResource); + mpBackTex = JKR_NEW J2DPicture(texResource); mpBackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 0xff)); mpBackTex->setAlpha(0); } else { @@ -175,75 +175,75 @@ dMenu_ItemExplain_c::dMenu_ItemExplain_c(JKRExpHeap* i_heap, JKRArchive* i_archi } dMenu_ItemExplain_c::~dMenu_ItemExplain_c() { - delete mpInfoString; + JKR_DELETE(mpInfoString); mpInfoString = NULL; - delete mpInfoScreen; + JKR_DELETE(mpInfoScreen); mpInfoScreen = NULL; - delete mpKanteraMeter; + JKR_DELETE(mpKanteraMeter); mpKanteraMeter = NULL; for (int i = 0; i < 2; i++) { if (mpParent[i] != NULL) { - delete mpParent[i]; + JKR_DELETE(mpParent[i]); mpParent[i] = NULL; } } - delete mpLabel; + JKR_DELETE(mpLabel); mpLabel = NULL; - delete mpInfoText; + JKR_DELETE(mpInfoText); mpInfoText = NULL; for (int i = 0; i < 4; i++) { - delete mpNameText[i]; + JKR_DELETE(mpNameText[i]); mpNameText[i] = NULL; } if (field_0x74 != NULL) { - delete field_0x74; + JKR_DELETE(field_0x74); field_0x74 = NULL; } for (int i = 0; i < 2; i++) { if (field_0x44[i] != NULL) { - delete field_0x44[i]; + JKR_DELETE(field_0x44[i]); field_0x44[i] = NULL; } } if (field_0x50 != NULL) { - delete field_0x50; + JKR_DELETE(field_0x50); field_0x50 = NULL; } if (field_0x5c != NULL) { - delete field_0x5c; + JKR_DELETE(field_0x5c); field_0x5c = NULL; } if (field_0x14 != NULL) { - delete field_0x14; + JKR_DELETE(field_0x14); field_0x14 = NULL; } for (int i = 0; i < 4; i++) { if (field_0x28[i] != NULL) { - delete field_0x28[i]; + JKR_DELETE(field_0x28[i]); field_0x28[i] = NULL; } } for (int i = 0; i < 3; i++) { if (field_0x60[i] != NULL) { - delete field_0x60[i]; + JKR_DELETE(field_0x60[i]); field_0x60[i] = NULL; } } - delete mpInfoIcon; + JKR_DELETE(mpInfoIcon); mpInfoIcon = NULL; for (int i = 0; i < 4; i++) { @@ -266,17 +266,17 @@ dMenu_ItemExplain_c::~dMenu_ItemExplain_c() { } if (mpBackTex != NULL) { - delete mpBackTex; + JKR_DELETE(mpBackTex); mpBackTex = NULL; } if (mpArrow != NULL) { - delete mpArrow; + JKR_DELETE(mpArrow); mpArrow = NULL; } if (mpSelect_c != NULL) { - delete mpSelect_c; + JKR_DELETE(mpSelect_c); mpSelect_c = NULL; } diff --git a/src/d/d_menu_letter.cpp b/src/d/d_menu_letter.cpp index 32947bb6a3..6997655860 100644 --- a/src/d/d_menu_letter.cpp +++ b/src/d/d_menu_letter.cpp @@ -78,73 +78,73 @@ dMenu_Letter_c::dMenu_Letter_c(JKRExpHeap* i_heap, STControl* i_stick, CSTContro dMenu_Letter_c::~dMenu_Letter_c() { - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; - delete mpArrow; + JKR_DELETE(mpArrow); mpArrow = NULL; - delete mpString; + JKR_DELETE(mpString); mpString = NULL; - delete mpMenuScreen; + JKR_DELETE(mpMenuScreen); mpMenuScreen = NULL; - delete mpMenuDMYScreen; + JKR_DELETE(mpMenuDMYScreen); mpMenuDMYScreen = NULL; - delete mpBaseScreen; + JKR_DELETE(mpBaseScreen); mpBaseScreen = NULL; - delete mpSdwScreen; + JKR_DELETE(mpSdwScreen); mpSdwScreen = NULL; for (int i = 0; i < 2; i++) { - delete mpLetterScreen[i]; + JKR_DELETE(mpLetterScreen[i]); mpLetterScreen[i] = NULL; - delete field_0x2ec[i]; + JKR_DELETE(field_0x2ec[i]); field_0x2ec[i] = NULL; if (field_0x2f4[i] != NULL) { - delete field_0x2f4[i]; + JKR_DELETE(field_0x2f4[i]); field_0x2f4[i] = NULL; } - delete mpTextParent[i]; + JKR_DELETE(mpTextParent[i]); mpTextParent[i] = NULL; } - delete mpLineParent; + JKR_DELETE(mpLineParent); mpLineParent = NULL; - delete mpBlackTex; + JKR_DELETE(mpBlackTex); mpBlackTex = NULL; for (int i = 0; i < 3; i++) { - delete mpParent[i]; + JKR_DELETE(mpParent[i]); mpParent[i] = NULL; } for (int i = 0; i < 6; i++) { - delete mpLetterParent[i]; + JKR_DELETE(mpLetterParent[i]); mpLetterParent[i] = NULL; } - delete mpDMYParent; + JKR_DELETE(mpDMYParent); mpDMYParent = NULL; - delete mpIconScreen; + JKR_DELETE(mpIconScreen); mpIconScreen = NULL; for (int i = 0; i < 2; i++) { if (mpButtonAB[i] != NULL) { - delete mpButtonAB[i]; + JKR_DELETE(mpButtonAB[i]); mpButtonAB[i] = NULL; } if (mpButtonText[i] != NULL) { - delete mpButtonText[i]; + JKR_DELETE(mpButtonText[i]); mpButtonText[i] = NULL; } } @@ -163,7 +163,7 @@ dMenu_Letter_c::~dMenu_Letter_c() { } void dMenu_Letter_c::_create() { - mpDrawCursor = new dSelect_cursor_c(2, 1.0f, NULL); + mpDrawCursor = JKR_NEW dSelect_cursor_c(2, 1.0f, NULL); JUT_ASSERT(231, mpDrawCursor != NULL); // shield prod uses same values as GCN? #if PLATFORM_WII || VERSION == VERSION_SHIELD_DEBUG @@ -175,10 +175,10 @@ void dMenu_Letter_c::_create() { mpDrawCursor->setScale(0.0f); mpDrawCursor->offPlayAnime(0); - mpString = new dMsgString_c(); + mpString = JKR_NEW dMsgString_c(); JUT_ASSERT(245, mpString != NULL); - mpArrow = new dMsgScrnArrow_c(); + mpArrow = JKR_NEW dMsgScrnArrow_c(); JUT_ASSERT(249, mpArrow != NULL); screenSetMenu(); @@ -311,7 +311,7 @@ int dMenu_Letter_c::_open() { if (mpMount->sync() != 0) { if (!mpArchive) { mpArchive = (JKRArchive*)mpMount->getArchive(); - delete mpMount; + JKR_DELETE(mpMount); mpMount = NULL; _create(); } @@ -752,12 +752,12 @@ void dMenu_Letter_c::screenSetMenu() { MULTI_CHAR('midoku_0'), MULTI_CHAR('midoku_1'), MULTI_CHAR('midoku_2'), MULTI_CHAR('midoku_3'), MULTI_CHAR('midoku_4'), MULTI_CHAR('midoku_5'), }; - mpMenuScreen = new J2DScreen(); + mpMenuScreen = JKR_NEW J2DScreen(); JUT_ASSERT(1146, mpMenuScreen != NULL); bool fg = mpMenuScreen->setPriority("zelda_letter_select_6menu.blo", 0x20000, mpArchive); JUT_ASSERT(1156, fg != false); dPaneClass_showNullPane(mpMenuScreen); - mpParent[0] = new CPaneMgr(mpMenuScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent[0] = JKR_NEW CPaneMgr(mpMenuScreen, MULTI_CHAR('n_all'), 2, NULL); JUT_ASSERT(1161, mpParent[0] != NULL); mpParent[0]->setAlphaRate(0.0f); for (int i = 0; i < 6; i++) { @@ -786,7 +786,7 @@ void dMenu_Letter_c::screenSetMenu() { } } for (int i = 0; i < 6; i++) { - mpLetterParent[i] = new CPaneMgr(mpMenuScreen, tag_letter[i], 0, NULL); + mpLetterParent[i] = JKR_NEW CPaneMgr(mpMenuScreen, tag_letter[i], 0, NULL); JUT_ASSERT(1212, mpLetterParent[i] != NULL); } for (int i = 0; i < 6; i++) { @@ -824,12 +824,12 @@ void dMenu_Letter_c::screenSetMenu() { field_0x338[i] = ((J2DTextBox*)field_0x34[1][i])->getWhite(); } } - mpMenuDMYScreen = new J2DScreen(); + mpMenuDMYScreen = JKR_NEW J2DScreen(); JUT_ASSERT(1270, mpMenuDMYScreen != NULL); fg = mpMenuDMYScreen->setPriority("zelda_letter_select_6menu.blo", 0x20000, mpArchive); JUT_ASSERT(1280, fg != false); dPaneClass_showNullPane(mpMenuDMYScreen); - mpDMYParent = new CPaneMgr(mpMenuDMYScreen, MULTI_CHAR('n_all'), 2, NULL); + mpDMYParent = JKR_NEW CPaneMgr(mpMenuDMYScreen, MULTI_CHAR('n_all'), 2, NULL); JUT_ASSERT(1285, mpDMYParent != NULL); for (int i = 0; i < 6; i++) { #if VERSION == VERSION_GCN_JPN @@ -878,13 +878,13 @@ void dMenu_Letter_c::screenSetBase() { MULTI_CHAR('pi_00'), MULTI_CHAR('pi_01'), MULTI_CHAR('pi_02'), MULTI_CHAR('pi_03'), MULTI_CHAR('pi_04'), MULTI_CHAR('pi_05'), MULTI_CHAR('pi_06'), MULTI_CHAR('pi_07'), MULTI_CHAR('pi_08'), }; - mpBaseScreen = new J2DScreen(); + mpBaseScreen = JKR_NEW J2DScreen(); JUT_ASSERT(1357, mpBaseScreen != NULL); bool fg = mpBaseScreen->setPriority("zelda_letter_select_base.blo", 0x20000, mpArchive); JUT_ASSERT(1361, fg != false); dPaneClass_showNullPane(mpBaseScreen); mpBaseScreen->search(MULTI_CHAR('wi_btn_n'))->hide(); - mpParent[1] = new CPaneMgr(mpBaseScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent[1] = JKR_NEW CPaneMgr(mpBaseScreen, MULTI_CHAR('n_all'), 2, NULL); JUT_ASSERT(1372, mpParent[1] != NULL); mpParent[1]->setAlphaRate(0.0f); #if VERSION == VERSION_GCN_JPN @@ -967,15 +967,15 @@ void dMenu_Letter_c::screenSetBase() { } void dMenu_Letter_c::screenSetShadow() { - mpSdwScreen = new J2DScreen(); + mpSdwScreen = JKR_NEW J2DScreen(); mpSdwScreen->setPriority("zelda_letter_select_shadow.blo", 0x20000, mpArchive); dPaneClass_showNullPane(mpSdwScreen); - mpParent[2] = new CPaneMgr(mpSdwScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent[2] = JKR_NEW CPaneMgr(mpSdwScreen, MULTI_CHAR('n_all'), 2, NULL); mpParent[2]->setAlphaRate(0.0f); } void dMenu_Letter_c::screenSetLetter() { - mpLetterScreen[0] = new J2DScreen(); + mpLetterScreen[0] = JKR_NEW J2DScreen(); JUT_ASSERT(1507, mpLetterScreen[0] != NULL); bool fg = mpLetterScreen[0]->setPriority("zelda_letter_window_base.blo", 0x20000, mpArchive); JUT_ASSERT(1511, fg != false); @@ -983,15 +983,15 @@ void dMenu_Letter_c::screenSetLetter() { #if VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { - field_0x2ec[0] = new CPaneMgr(mpLetterScreen[0], MULTI_CHAR('t3f_s'), 0, NULL); - field_0x2ec[1] = new CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3flin'), 0, NULL); - field_0x2f4[0] = new CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3f_s'), 0, NULL); - field_0x2f4[1] = new CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3f'), 0, NULL); + field_0x2ec[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('t3f_s'), 0, NULL); + field_0x2ec[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3flin'), 0, NULL); + field_0x2f4[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3f_s'), 0, NULL); + field_0x2f4[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3f'), 0, NULL); mpLetterScreen[0]->search('t4_s')->hide(); mpLetterScreen[0]->search(MULTI_CHAR('mg_e4lin'))->hide(); mpLetterScreen[0]->search('t3_s')->hide(); mpLetterScreen[0]->search(MULTI_CHAR('mg_3line'))->hide(); - mpLineParent = new CPaneMgr(mpLetterScreen[0], MULTI_CHAR('jp_fri_n'), 0, NULL); + mpLineParent = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('jp_fri_n'), 0, NULL); JUT_ASSERT(1530, mpLineParent != NULL); for (int i = 0; i < 12; i++) { static u64 const line_tag[12] = { @@ -1011,8 +1011,8 @@ void dMenu_Letter_c::screenSetLetter() { ((J2DTextBox*)field_0x2f4[0]->getPanePtr())->setLineSpace(((J2DTextBox*)field_0x2ec[0]->getPanePtr())->getLineSpace()); ((J2DTextBox*)field_0x2f4[1]->getPanePtr())->setLineSpace(((J2DTextBox*)field_0x2ec[1]->getPanePtr())->getLineSpace()); } else { - field_0x2ec[0] = new CPaneMgr(mpLetterScreen[0], 't3_s', 0, NULL); - field_0x2ec[1] = new CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3line'), 0, NULL); + field_0x2ec[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], 't3_s', 0, NULL); + field_0x2ec[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_3line'), 0, NULL); for (int i = 0; i < 2; i++) { field_0x2f4[i] = NULL; } @@ -1022,7 +1022,7 @@ void dMenu_Letter_c::screenSetLetter() { mpLetterScreen[0]->search(MULTI_CHAR('mg_3flin'))->hide(); mpLetterScreen[0]->search(MULTI_CHAR('mg_3f_s'))->hide(); mpLetterScreen[0]->search(MULTI_CHAR('mg_3f'))->hide(); - mpLineParent = new CPaneMgr(mpLetterScreen[0], 'jp_n', 0, NULL); + mpLineParent = JKR_NEW CPaneMgr(mpLetterScreen[0], 'jp_n', 0, NULL); JUT_ASSERT(1530, mpLineParent != NULL); for (int i = 0; i < 12; i++) { static u64 const line_tag[12] = { @@ -1046,8 +1046,8 @@ void dMenu_Letter_c::screenSetLetter() { MULTI_CHAR('line15'), MULTI_CHAR('line16'), MULTI_CHAR('line17'), MULTI_CHAR('line18'), MULTI_CHAR('line19'), MULTI_CHAR('line20'), }; - field_0x2ec[0] = new CPaneMgr(mpLetterScreen[0], 't4_s', 0, NULL); - field_0x2ec[1] = new CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_e4lin'), 0, NULL); + field_0x2ec[0] = JKR_NEW CPaneMgr(mpLetterScreen[0], 't4_s', 0, NULL); + field_0x2ec[1] = JKR_NEW CPaneMgr(mpLetterScreen[0], MULTI_CHAR('mg_e4lin'), 0, NULL); for (int i = 0; i < 2; i++) { field_0x2f4[i] = NULL; } @@ -1057,7 +1057,7 @@ void dMenu_Letter_c::screenSetLetter() { mpLetterScreen[0]->search(MULTI_CHAR('mg_3f'))->hide(); mpLetterScreen[0]->search('t3_s')->hide(); mpLetterScreen[0]->search(MULTI_CHAR('mg_3line'))->hide(); - mpLineParent = new CPaneMgr(mpLetterScreen[0], 'us_n', 0, NULL); + mpLineParent = JKR_NEW CPaneMgr(mpLetterScreen[0], 'us_n', 0, NULL); JUT_ASSERT(1530, mpLineParent != NULL); for (int i = 0; i < 12; i++) { if (line_tag[i] != 0) { @@ -1092,19 +1092,19 @@ void dMenu_Letter_c::screenSetLetter() { field_0x1e4[i]->setFont(mDoExt_getSubFont()); field_0x1e4[i]->setString(0x10, ""); } - mpLetterScreen[1] = new J2DScreen(); + mpLetterScreen[1] = JKR_NEW J2DScreen(); JUT_ASSERT(1627, mpLetterScreen[1] != NULL); fg = mpLetterScreen[1]->setPriority("zelda_letter_window_spot.blo", 0x20000, mpArchive); JUT_ASSERT(1631, fg != false); dPaneClass_showNullPane(mpLetterScreen[1]); for (int i = 0; i < 2; i++) { - mpTextParent[i] = new CPaneMgr(mpLetterScreen[i], MULTI_CHAR('n_all'), 2, NULL); + mpTextParent[i] = JKR_NEW CPaneMgr(mpLetterScreen[i], MULTI_CHAR('n_all'), 2, NULL); JUT_ASSERT(1636, mpTextParent[i] != NULL); mpTextParent[i]->scale(0.0f, 0.0f); mpTextParent[i]->setAlphaRate(0.0f); } ResTIMG* local_30 = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBlackTex = new J2DPicture(local_30); + mpBlackTex = JKR_NEW J2DPicture(local_30); JUT_ASSERT(1644, mpBlackTex != NULL); mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 255)); mpBlackTex->setAlpha(0); @@ -1118,7 +1118,7 @@ void dMenu_Letter_c::screenSetDoIcon() { MULTI_CHAR('btext1_1'), MULTI_CHAR('btext1_2'), MULTI_CHAR('btext1_3'), MULTI_CHAR('btext1_4'), MULTI_CHAR('btext1_5'), }; - mpIconScreen = new J2DScreen(); + mpIconScreen = JKR_NEW J2DScreen(); mpIconScreen->setPriority("zelda_collect_soubi_do_icon_parts.blo", 0x20000, mpArchive); for (int i = 0; i < 2; i++) { mpButtonAB[i] = NULL; diff --git a/src/d/d_menu_map_common.cpp b/src/d/d_menu_map_common.cpp index 4d5ed2699b..e7d0fef7ad 100644 --- a/src/d/d_menu_map_common.cpp +++ b/src/d/d_menu_map_common.cpp @@ -63,23 +63,23 @@ dMenuMapCommon_c::dMenuMapCommon_c() { dMenuMapCommon_c::~dMenuMapCommon_c() { for (int i = 0; i < ICON_MAX_e; i++) { if (mPictures[i] != NULL) { - delete mPictures[i]; + JKR_DELETE(mPictures[i]); mPictures[i] = NULL; } } if (mLightDropPic != NULL) { - delete mLightDropPic; + JKR_DELETE(mLightDropPic); mLightDropPic = NULL; } if (mpDrawCursor != NULL) { - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; } if (mpPortalIcon != NULL) { - delete mpPortalIcon; + JKR_DELETE(mpPortalIcon); mpPortalIcon = NULL; } } @@ -89,7 +89,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_boss_s_ci8_16_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_BOSS_e] = new J2DPicture(mp_image); + mPictures[ICON_BOSS_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_boss_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_BOSS_e]->append(mp_image, 0.0f); @@ -98,7 +98,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_boss_s_ci8_16_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_BOSS_GANON_e] = new J2DPicture(mp_image); + mPictures[ICON_BOSS_GANON_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_boss_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_BOSS_GANON_e]->append(mp_image, 0.0f); @@ -107,7 +107,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_map_icon_enter_ci8_24_02.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_DUNGEON_ENTER_e] = new J2DPicture(mp_image); + mPictures[ICON_DUNGEON_ENTER_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_map_icon_enter_ci8_02.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_DUNGEON_ENTER_e]->append(mp_image, 0.0f); @@ -116,7 +116,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_enter_s_ci8_24_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_LINK_ENTER_e] = new J2DPicture(mp_image); + mPictures[ICON_LINK_ENTER_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_enter_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_LINK_ENTER_e]->append(mp_image, 0.0f); @@ -125,7 +125,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_map_icon_warp_24_ci8_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_LV8_WARP_e] = new J2DPicture(mp_image); + mPictures[ICON_LV8_WARP_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_map_icon_warp_32_ci8_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_LV8_WARP_e]->append(mp_image, 0.0f); @@ -134,7 +134,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_box_s_ci8_24_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_TREASURE_CHEST_e] = new J2DPicture(mp_image); + mPictures[ICON_TREASURE_CHEST_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_box_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_TREASURE_CHEST_e]->append(mp_image, 0.0f); @@ -143,7 +143,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_gray_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_KEY_e] = new J2DPicture(mp_image); + mPictures[ICON_KEY_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_key_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_KEY_e]->append(mp_image, 0.0f); @@ -152,7 +152,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_YETO_e] = new J2DPicture(mp_image); + mPictures[ICON_YETO_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "st_yuki_M.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_YETO_e]->append(mp_image, 0.0f); @@ -161,7 +161,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_YETA_e] = new J2DPicture(mp_image); + mPictures[ICON_YETA_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "st_yuki_W.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_YETA_e]->append(mp_image, 0.0f); @@ -170,7 +170,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_yellow_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_GOLD_WOLF_e] = new J2DPicture(mp_image); + mPictures[ICON_GOLD_WOLF_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "st_gold_wolf.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_GOLD_WOLF_e]->append(mp_image, 0.0f); @@ -179,7 +179,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_MONKEY_e] = new J2DPicture(mp_image); + mPictures[ICON_MONKEY_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_monkey_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_MONKEY_e]->append(mp_image, 0.0f); @@ -188,7 +188,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_blue_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_OOCCOO_e] = new J2DPicture(mp_image); + mPictures[ICON_OOCCOO_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "ni_obacyan.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_OOCCOO_e]->append(mp_image, 0.0f); @@ -197,7 +197,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_blue_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_OOCCOO_JR_e] = new J2DPicture(mp_image); + mPictures[ICON_OOCCOO_JR_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "ni_obacyan.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_OOCCOO_JR_e]->append(mp_image, 0.0f); @@ -206,7 +206,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[8] = new J2DPicture(mp_image); + mPictures[8] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_zelda_map_icon_copy_stone_statue_snup_try_00_04.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[8]->append(mp_image, 0.0f); @@ -215,7 +215,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_link_s_ci8_24_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_LINK_e] = new J2DPicture(mp_image); + mPictures[ICON_LINK_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_link_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_LINK_e]->append(mp_image, 0.0f); @@ -224,7 +224,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_penant_s_ci8_24_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_DUNGEON_WARP_e] = new J2DPicture(mp_image); + mPictures[ICON_DUNGEON_WARP_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_penant_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_DUNGEON_WARP_e]->append(mp_image, 0.0f); @@ -233,7 +233,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_black_32.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_LIGHT_DROP_e] = new J2DPicture(mp_image); + mPictures[ICON_LIGHT_DROP_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_black_32.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_LIGHT_DROP_e]->append(mp_image, 0.0f); @@ -243,7 +243,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_hikari_no_shizuku_try_10_00_24x24.bti"); JUT_ASSERT(0, mp_image != NULL); - mLightDropPic = new J2DPicture(mp_image); + mLightDropPic = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_hikari_no_shizuku_try_10_00_24x24.bti"); JUT_ASSERT(0, mp_image != NULL); mLightDropPic->append(mp_image, 0.0f); @@ -253,7 +253,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_LIGHT_BALL_e] = new J2DPicture(mp_image); + mPictures[ICON_LIGHT_BALL_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_zelda_map_icon_hikari_ball_03.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_LIGHT_BALL_e]->append(mp_image, 0.0f); @@ -262,7 +262,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_CANNON_BALL_e] = new J2DPicture(mp_image); + mPictures[ICON_CANNON_BALL_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_map_icon_iron_ball_ci8_32_00.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_CANNON_BALL_e]->append(mp_image, 0.0f); @@ -271,7 +271,7 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "tt_map_icon_s_size_circle_ci4_00.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_COACH_e] = new J2DPicture(mp_image); + mPictures[ICON_COACH_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_map_icon_basha_ci8.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_COACH_e]->append(mp_image, 0.0f); @@ -280,18 +280,18 @@ void dMenuMapCommon_c::initiate(JKRArchive* i_archive) { mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_nijumaru_40x40_ind_01.bti"); JUT_ASSERT(0, mp_image != NULL); - mPictures[ICON_DESTINATION_e] = new J2DPicture(mp_image); + mPictures[ICON_DESTINATION_e] = JKR_NEW J2DPicture(mp_image); mp_image = (ResTIMG*)i_archive->getResource('TIMG', "im_nijumaru_40x40_ind_01.bti"); JUT_ASSERT(0, mp_image != NULL); mPictures[ICON_DESTINATION_e]->append(mp_image, 0.0f); mPictures[ICON_DESTINATION_e]->setBasePosition(J2DBasePosition_4); mPictures[ICON_DESTINATION_e]->setInfluencedAlpha(false, false); - mpDrawCursor = new dSelect_cursor_c(4, 1.0f, NULL); + mpDrawCursor = JKR_NEW dSelect_cursor_c(4, 1.0f, NULL); JUT_ASSERT(0, mpDrawCursor != NULL); if (i_archive == dComIfGp_getFmapResArchive()) { - mpPortalIcon = new dSelect_cursor_c(5, 1.0f, i_archive); + mpPortalIcon = JKR_NEW dSelect_cursor_c(5, 1.0f, i_archive); JUT_ASSERT(0, mpPortalIcon != NULL); } } diff --git a/src/d/d_menu_option.cpp b/src/d/d_menu_option.cpp index 32762905d9..5e00afe208 100644 --- a/src/d/d_menu_option.cpp +++ b/src/d/d_menu_option.cpp @@ -102,15 +102,15 @@ void dMenu_Option_c::_create() { static const u8 l_msgNum2[2] = {8, 7}; mpFont = mDoExt_getMesgFont(); - mpString = new dMsgString_c(); + mpString = JKR_NEW dMsgString_c(); JUT_ASSERT(197, mpString != NULL); - mpMeterHaihai = new dMeterHaihai_c(3); + mpMeterHaihai = JKR_NEW dMeterHaihai_c(3); JUT_ASSERT(201, mpMeterHaihai); field_0x3f6 = 0; - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(205, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_option_select_menu.blo", 0x20000, mpArchive); @@ -128,41 +128,41 @@ void dMenu_Option_c::_create() { field_0x254[i]->setFont(mDoExt_getMesgFont()); field_0x254[i]->setString(0x20, ""); } - mpBackScreen = new J2DScreen(); + mpBackScreen = JKR_NEW J2DScreen(); JUT_ASSERT(246, mpBackScreen != NULL); fg = mpBackScreen->setPriority("zelda_option_base.blo", 0x20000, mpArchive); JUT_ASSERT(251, fg != false); mpBackScreen->search(MULTI_CHAR('wi_btn_n'))->hide(); field_0x27c = mpBackScreen->search(MULTI_CHAR('let_area')); - mpClipScreen = new J2DScreen(); + mpClipScreen = JKR_NEW J2DScreen(); JUT_ASSERT(265, mpClipScreen != NULL); fg = mpClipScreen->setPriority("zelda_option_menu_text.blo", 0x20000, mpArchive); JUT_ASSERT(269, fg != false); dPaneClass_showNullPane(mpClipScreen); mpClipScreen->setScissor(true); - mpShadowScreen = new J2DScreen(); + mpShadowScreen = JKR_NEW J2DScreen(); JUT_ASSERT(274, mpShadowScreen != NULL); fg = mpShadowScreen->setPriority("zelda_option_menu_shadow.blo", 0x20000, mpArchive); JUT_ASSERT(278, fg != false); dPaneClass_showNullPane(mpShadowScreen); mpShadowScreen->search(MULTI_CHAR('mw_n_5'))->hide(); - mpTVScreen = new J2DScreen(); + mpTVScreen = JKR_NEW J2DScreen(); JUT_ASSERT(287, mpTVScreen != NULL); fg = mpTVScreen->setPriority("zelda_option_check.blo", 0x20000, mpArchive); JUT_ASSERT(291, fg != false); dPaneClass_showNullPane(mpTVScreen); - mpTVButtonAB = new CPaneMgr(mpTVScreen, MULTI_CHAR('g_abtn_n'), 0, NULL); + mpTVButtonAB = JKR_NEW CPaneMgr(mpTVScreen, MULTI_CHAR('g_abtn_n'), 0, NULL); JUT_ASSERT(295, mpTVButtonAB != NULL); - mpTVButtonText = new CPaneMgr(mpTVScreen, MULTI_CHAR('a_text_n'), 0, NULL); + mpTVButtonText = JKR_NEW CPaneMgr(mpTVScreen, MULTI_CHAR('a_text_n'), 0, NULL); JUT_ASSERT(298, mpTVButtonText != NULL); mpTVScreen->search(MULTI_CHAR('g_abtn_n'))->hide(); - mpScreenIcon = new J2DScreen(); + mpScreenIcon = JKR_NEW J2DScreen(); JUT_ASSERT(325, mpScreenIcon != NULL); mpScreenIcon->setPriority("zelda_collect_soubi_do_icon_parts.blo", 0x20000, mpArchive); for (int i = 0; i < 2; i++) { @@ -182,15 +182,15 @@ void dMenu_Option_c::_create() { setAButtonString(0x40C); setBButtonString(0x3F9); ResTIMG* timg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBlackTex = new J2DPicture(timg); + mpBlackTex = JKR_NEW J2DPicture(timg); JUT_ASSERT(402, mpBlackTex != NULL); mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 0xff)); mpBlackTex->setAlpha(0); field_0x374 = 0.0f; - mpWarning = new dFile_warning_c(mpArchive, 1); + mpWarning = JKR_NEW dFile_warning_c(mpArchive, 1); JUT_ASSERT(408, mpWarning != NULL); mpWarning->setFontColor(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0xc8, 0xc8, 0xc8, 0xff)); - mpSelectScreen = new J2DScreen(); + mpSelectScreen = JKR_NEW J2DScreen(); JUT_ASSERT(412, mpSelectScreen != NULL); fg = mpSelectScreen->setPriority("zelda_file_select_yes_no_window.blo", 0x1100000, mpArchive); JUT_ASSERT(416, fg != false); @@ -204,9 +204,9 @@ void dMenu_Option_c::_create() { field_0x28->searchUpdateMaterialID(mpSelectScreen); field_0x20->searchUpdateMaterialID(mpSelectScreen); for (int i = 0; i < 2; i++) { - mpYesNoSelBase_c[i] = new CPaneMgr(mpSelectScreen, l_tagName012[i], 0, NULL); + mpYesNoSelBase_c[i] = JKR_NEW CPaneMgr(mpSelectScreen, l_tagName012[i], 0, NULL); JUT_ASSERT(439, mpYesNoSelBase_c[i] != NULL); - mpYesNoTxt_c[i] = new CPaneMgr(mpSelectScreen, l_tagName013[i], 0, NULL); + mpYesNoTxt_c[i] = JKR_NEW CPaneMgr(mpSelectScreen, l_tagName013[i], 0, NULL); JUT_ASSERT(441, mpYesNoTxt_c[i] != NULL); J2DTextBox* yesNoTxt = (J2DTextBox*)mpYesNoTxt_c[i]->getPanePtr(); yesNoTxt->setFont(mDoExt_getMesgFont()); @@ -229,11 +229,11 @@ void dMenu_Option_c::_create() { field_0x3c4 = 0; for (int i = 0; i < 2; i++) { - mpYesNoCurWaku_c[i] = new CPaneMgr(mpSelectScreen, l_tagName9[i], 0, NULL); + mpYesNoCurWaku_c[i] = JKR_NEW CPaneMgr(mpSelectScreen, l_tagName9[i], 0, NULL); JUT_ASSERT(482, mpYesNoCurWaku_c[i] != NULL); - mpYesNoCurWakuG0_c[i] = new CPaneMgr(mpSelectScreen, l_tagName10[i], 0, NULL); + mpYesNoCurWakuG0_c[i] = JKR_NEW CPaneMgr(mpSelectScreen, l_tagName10[i], 0, NULL); JUT_ASSERT(484, mpYesNoCurWakuG0_c[i] != NULL); - mpYesNoCurWakuG1_c[i] = new CPaneMgr(mpSelectScreen, l_tagName11[i], 0, NULL); + mpYesNoCurWakuG1_c[i] = JKR_NEW CPaneMgr(mpSelectScreen, l_tagName11[i], 0, NULL); JUT_ASSERT(486, mpYesNoCurWakuG1_c[i] != NULL); mpYesNoCurWaku_c[i]->getPanePtr()->setAnimation(field_0x2c); mpYesNoCurWakuG0_c[i]->getPanePtr()->setAnimation(field_0x2c); @@ -291,91 +291,91 @@ void dMenu_Option_c::_create() { } void dMenu_Option_c::_delete() { - delete mpString; + JKR_DELETE(mpString); mpString = NULL; - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpMeterHaihai; + JKR_DELETE(mpMeterHaihai); mpMeterHaihai = NULL; - delete mpBackScreen; + JKR_DELETE(mpBackScreen); mpBackScreen = NULL; - delete mpClipScreen; + JKR_DELETE(mpClipScreen); mpClipScreen = NULL; - delete mpShadowScreen; + JKR_DELETE(mpShadowScreen); mpShadowScreen = NULL; - delete mpTVScreen; + JKR_DELETE(mpTVScreen); mpTVScreen = NULL; if (mpTVButtonAB != NULL) { - delete mpTVButtonAB; + JKR_DELETE(mpTVButtonAB); mpTVButtonAB = NULL; } if (mpTVButtonText != NULL) { - delete mpTVButtonText; + JKR_DELETE(mpTVButtonText); mpTVButtonText = NULL; } - delete mpScreenIcon; + JKR_DELETE(mpScreenIcon); mpScreenIcon = NULL; for (int i = 0; i < 2; i++) { if (mpButtonAB[i] != NULL) { - delete mpButtonAB[i]; + JKR_DELETE(mpButtonAB[i]); mpButtonAB[i] = NULL; } if (mpButtonText[i] != NULL) { - delete mpButtonText[i]; + JKR_DELETE(mpButtonText[i]); mpButtonText[i] = NULL; } } - delete mpBlackTex; + JKR_DELETE(mpBlackTex); mpBlackTex = NULL; - delete mpWarning; + JKR_DELETE(mpWarning); mpWarning = NULL; - delete mpSelectScreen; + JKR_DELETE(mpSelectScreen); mpSelectScreen = NULL; - delete field_0x24; + JKR_DELETE(field_0x24); field_0x24 = NULL; - delete field_0x28; + JKR_DELETE(field_0x28); field_0x28 = NULL; - delete field_0x20; + JKR_DELETE(field_0x20); field_0x20 = NULL; for (int i = 0; i < 2; i++) { - delete mpYesNoSelBase_c[i]; + JKR_DELETE(mpYesNoSelBase_c[i]); mpYesNoSelBase_c[i] = NULL; - delete mpYesNoTxt_c[i]; + JKR_DELETE(mpYesNoTxt_c[i]); mpYesNoTxt_c[i] = NULL; - delete mpYesNoCurWaku_c[i]; + JKR_DELETE(mpYesNoCurWaku_c[i]); mpYesNoCurWaku_c[i] = NULL; - delete mpYesNoCurWakuG0_c[i]; + JKR_DELETE(mpYesNoCurWakuG0_c[i]); mpYesNoCurWakuG0_c[i] = NULL; - delete mpYesNoCurWakuG1_c[i]; + JKR_DELETE(mpYesNoCurWakuG1_c[i]); mpYesNoCurWakuG1_c[i] = NULL; } - delete field_0x2c; + JKR_DELETE(field_0x2c); field_0x2c = NULL; - delete field_0x30; + JKR_DELETE(field_0x30); field_0x30 = NULL; if ( @@ -387,53 +387,53 @@ void dMenu_Option_c::_delete() { #endif ) ) { - delete mpStick; + JKR_DELETE(mpStick); mpStick = NULL; } - delete mpTitle; + JKR_DELETE(mpTitle); mpTitle = NULL; - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; for (int i = 0; i < 5; i++) { - delete mpParent[i]; + JKR_DELETE(mpParent[i]); mpParent[i] = NULL; } for (int i = 0; i < 5; i++) { - delete mpHaihaiPosL[i]; + JKR_DELETE(mpHaihaiPosL[i]); mpHaihaiPosL[i] = NULL; - delete mpHaihaiPosR[i]; + JKR_DELETE(mpHaihaiPosR[i]); mpHaihaiPosR[i] = NULL; } for (int i = 0; i < 6; i++) { - delete mpMenuNull[i]; + JKR_DELETE(mpMenuNull[i]); mpMenuNull[i] = NULL; - delete mpMenuPane[i]; + JKR_DELETE(mpMenuPane[i]); mpMenuPane[i] = NULL; if (mpMenuPaneC[i] != NULL) { - delete mpMenuPaneC[i]; + JKR_DELETE(mpMenuPaneC[i]); mpMenuPaneC[i] = NULL; } if (mpMenuPane2[i] != NULL) { - delete mpMenuPane2[i]; + JKR_DELETE(mpMenuPane2[i]); mpMenuPane2[i] = NULL; } if (mpMenuPane3[i] != NULL) { - delete mpMenuPane3[i]; + JKR_DELETE(mpMenuPane3[i]); mpMenuPane3[i] = NULL; } if (mpMenuPane32[i] != NULL) { - delete mpMenuPane32[i]; + JKR_DELETE(mpMenuPane32[i]); mpMenuPane32[i] = NULL; } } @@ -441,7 +441,7 @@ void dMenu_Option_c::_delete() { for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { if (mpMenuText[i][j] != NULL) { - delete mpMenuText[i][j]; + JKR_DELETE(mpMenuText[i][j]); mpMenuText[i][j] = NULL; } } @@ -449,14 +449,14 @@ void dMenu_Option_c::_delete() { for (int i = 0; i < 4; i++) { if (field_0x1c0[i] != NULL) { - delete field_0x1c0[i]; + JKR_DELETE(field_0x1c0[i]); field_0x1c0[i] = NULL; } } for (int i = 0; i < 3; i++) { if (mpZButtonText[i] != NULL) { - delete mpZButtonText[i]; + JKR_DELETE(mpZButtonText[i]); mpZButtonText[i] = NULL; } } @@ -642,7 +642,7 @@ bool dMenu_Option_c::_open() { if (!dComIfGp_getOptionResArchive()) { dComIfGp_setOptionResArchive(mpMount->getArchive()); mpArchive = dComIfGp_getOptionResArchive(); - delete mpMount; + JKR_DELETE(mpMount); mpMount = NULL; _create(); } @@ -1423,7 +1423,7 @@ void dMenu_Option_c::screenSet() { }; #endif - mpTitle = new CPaneMgr(mpBackScreen, MULTI_CHAR('title_n'), 0, NULL); + mpTitle = JKR_NEW CPaneMgr(mpBackScreen, MULTI_CHAR('title_n'), 0, NULL); Vec pos = mpTitle->getGlobalVtxCenter(mpTitle->mPane, false, 0); mpWarning->mPosY = pos.y + g_drawHIO.mOptionScreen.mBackgroundPosY; for (int i = 0; i < 6; i++) { @@ -1440,21 +1440,21 @@ void dMenu_Option_c::screenSet() { field_0x2c8[1] = field_0x298[0]->getWhite(); field_0x2b8[0].a = 0xff; field_0x2b0[0].a = 0xff; - mpDrawCursor = new dSelect_cursor_c(2, 1.0f, NULL); + mpDrawCursor = JKR_NEW dSelect_cursor_c(2, 1.0f, NULL); mpDrawCursor->setAlphaRate(0.0f); mpDrawCursor->setScale(0.0f); mpDrawCursor->setParam(1.01f, 0.85f, 0.02f, 0.5f, 0.5f); mpDrawCursor->offPlayAnime(0); - mpParent[0] = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); - mpParent[1] = new CPaneMgr(mpClipScreen, MULTI_CHAR('n_all'), 2, NULL); - mpParent[2] = new CPaneMgr(mpShadowScreen, 'nall', 2, NULL); - mpParent[3] = new CPaneMgr(mpTVScreen, MULTI_CHAR('n_all'), 2, NULL); - mpParent[4] = new CPaneMgr(mpBackScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent[1] = JKR_NEW CPaneMgr(mpClipScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent[2] = JKR_NEW CPaneMgr(mpShadowScreen, 'nall', 2, NULL); + mpParent[3] = JKR_NEW CPaneMgr(mpTVScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent[4] = JKR_NEW CPaneMgr(mpBackScreen, MULTI_CHAR('n_all'), 2, NULL); for (int i = 0; i < 6; i++) { - mpMenuNull[i] = new CPaneMgr(mpScreen, let_n[i], 0, NULL); - mpMenuPane[i] = new CPaneMgr(mpScreen, menu_n[i], 0, NULL); + mpMenuNull[i] = JKR_NEW CPaneMgr(mpScreen, let_n[i], 0, NULL); + mpMenuPane[i] = JKR_NEW CPaneMgr(mpScreen, menu_n[i], 0, NULL); if (menu2_n[i] != 0) { - mpMenuPaneC[i] = new CPaneMgr(mpScreen, menu2_n[i], 0, NULL); + mpMenuPaneC[i] = JKR_NEW CPaneMgr(mpScreen, menu2_n[i], 0, NULL); Vec pos = mpMenuPaneC[i]->getGlobalVtxCenter(mpMenuPaneC[i]->mPane, false, 0); field_0x344[i] = pos.x; field_0x35c[i] = pos.y; @@ -1473,24 +1473,24 @@ void dMenu_Option_c::screenSet() { field_0x408[i] = field_0x2d0[0][i]->getAlpha(); } for (int i = 0; i < 5; i++) { - mpHaihaiPosL[i] = new CPaneMgr(mpScreen, haihail_n[i], 0, NULL); - mpHaihaiPosR[i] = new CPaneMgr(mpScreen, haihair_n[i], 0, NULL); + mpHaihaiPosL[i] = JKR_NEW CPaneMgr(mpScreen, haihail_n[i], 0, NULL); + mpHaihaiPosR[i] = JKR_NEW CPaneMgr(mpScreen, haihair_n[i], 0, NULL); } for (int i = 0; i < 6; i++) { if (let2_n[i] != 0) { - mpMenuPane2[i] = new CPaneMgr(mpShadowScreen, let2_n[i], 0, NULL); + mpMenuPane2[i] = JKR_NEW CPaneMgr(mpShadowScreen, let2_n[i], 0, NULL); } else { mpMenuPane2[i] = NULL; } } for (int i = 0; i < 6; i++) { if (let2_n[i] != 0) { - mpMenuPane3[i] = new CPaneMgr(mpClipScreen, let2_n[i], 0, NULL); + mpMenuPane3[i] = JKR_NEW CPaneMgr(mpClipScreen, let2_n[i], 0, NULL); } else { mpMenuPane3[i] = NULL; } if (menu3_n[i] != 0) { - mpMenuPane32[i] = new CPaneMgr(mpClipScreen, menu3_n[i], 0, NULL); + mpMenuPane32[i] = JKR_NEW CPaneMgr(mpClipScreen, menu3_n[i], 0, NULL); } else { mpMenuPane32[i] = NULL; } @@ -1613,11 +1613,11 @@ void dMenu_Option_c::screenSet() { for (int i = 0; i < 6; i++) { #if VERSION == VERSION_GCN_JPN paneResize(menut_0[i]); - mpMenuText[0][i] = new CPaneMgr(mpClipScreen, menut_0[i], 0, NULL); + mpMenuText[0][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_0[i], 0, NULL); mpClipScreen->search(fenut_0[i])->hide(); #else paneResize(fenut_0[i]); - mpMenuText[0][i] = new CPaneMgr(mpClipScreen, fenut_0[i], 0, NULL); + mpMenuText[0][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_0[i], 0, NULL); mpClipScreen->search(menut_0[i])->hide(); #endif ((J2DTextBox*)(mpMenuText[0][i]->getPanePtr()))->setFont(mpFont); @@ -1627,11 +1627,11 @@ void dMenu_Option_c::screenSet() { for (int i = 0; i < 6; i++) { #if VERSION == VERSION_GCN_JPN paneResize(menut_1[i]); - mpMenuText[1][i] = new CPaneMgr(mpClipScreen, menut_1[i], 0, NULL); + mpMenuText[1][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_1[i], 0, NULL); mpClipScreen->search(fenut_1[i])->hide(); #else paneResize(fenut_1[i]); - mpMenuText[1][i] = new CPaneMgr(mpClipScreen, fenut_1[i], 0, NULL); + mpMenuText[1][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_1[i], 0, NULL); mpClipScreen->search(menut_1[i])->hide(); #endif mpMenuText[1][i]->show(); @@ -1642,11 +1642,11 @@ void dMenu_Option_c::screenSet() { for (int i = 0; i < 6; i++) { #if VERSION == VERSION_GCN_JPN paneResize(menut_2[i]); - mpMenuText[2][i] = new CPaneMgr(mpClipScreen, menut_2[i], 0, NULL); + mpMenuText[2][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_2[i], 0, NULL); mpClipScreen->search(fenut_2[i])->hide(); #else paneResize(fenut_2[i]); - mpMenuText[2][i] = new CPaneMgr(mpClipScreen, fenut_2[i], 0, NULL); + mpMenuText[2][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_2[i], 0, NULL); mpClipScreen->search(menut_2[i])->hide(); #endif mpMenuText[2][i]->show(); @@ -1657,11 +1657,11 @@ void dMenu_Option_c::screenSet() { for (int i = 0; i < 6; i++) { #if VERSION == VERSION_GCN_JPN paneResize(menut_3[i]); - mpMenuText[3][i] = new CPaneMgr(mpClipScreen, menut_3[i], 0, NULL); + mpMenuText[3][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_3[i], 0, NULL); mpClipScreen->search(fenut_3[i])->hide(); #else paneResize(fenut_3[i]); - mpMenuText[3][i] = new CPaneMgr(mpClipScreen, fenut_3[i], 0, NULL); + mpMenuText[3][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_3[i], 0, NULL); mpClipScreen->search(menut_3[i])->hide(); #endif mpMenuText[3][i]->show(); @@ -1672,11 +1672,11 @@ void dMenu_Option_c::screenSet() { for (int i = 0; i < 6; i++) { #if VERSION == VERSION_GCN_JPN paneResize(menut_4[i]); - mpMenuText[4][i] = new CPaneMgr(mpClipScreen, menut_4[i], 0, NULL); + mpMenuText[4][i] = JKR_NEW CPaneMgr(mpClipScreen, menut_4[i], 0, NULL); mpClipScreen->search(fenut_4[i])->hide(); #else paneResize(fenut_4[i]); - mpMenuText[4][i] = new CPaneMgr(mpClipScreen, fenut_4[i], 0, NULL); + mpMenuText[4][i] = JKR_NEW CPaneMgr(mpClipScreen, fenut_4[i], 0, NULL); mpClipScreen->search(menut_4[i])->hide(); #endif mpMenuText[4][i]->show(); @@ -1721,7 +1721,7 @@ void dMenu_Option_c::screenSet() { } for (int i = 0; i < 3; i++) { if (z_tx[i] != 0) { - mpZButtonText[i] = new CPaneMgr(mpBackScreen, z_tx[i], 2, NULL); + mpZButtonText[i] = JKR_NEW CPaneMgr(mpBackScreen, z_tx[i], 2, NULL); } else { mpZButtonText[i] = NULL; } diff --git a/src/d/d_menu_quit.cpp b/src/d/d_menu_quit.cpp index 6ad35a184b..238d5da1de 100644 --- a/src/d/d_menu_quit.cpp +++ b/src/d/d_menu_quit.cpp @@ -25,8 +25,8 @@ dMenu_Quit_c::dMenu_Quit_c() { } dMenu_Quit_c::~dMenu_Quit_c() { - delete mStick; - delete mpScrnExplain; + JKR_DELETE(mStick); + JKR_DELETE(mpScrnExplain); mpScrnExplain = NULL; } diff --git a/src/d/d_menu_ring.cpp b/src/d/d_menu_ring.cpp index efb8e0c4fd..c43479c21f 100644 --- a/src/d/d_menu_ring.cpp +++ b/src/d/d_menu_ring.cpp @@ -247,7 +247,7 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i setSelectItem(i, 0x43); } for (int j = 0; j < 3; j++) { - mpSelectItemTex[i][j] = new J2DPicture(mpSelectItemTexBuf[i][field_0x6be[i]][0]); + mpSelectItemTex[i][j] = JKR_NEW J2DPicture(mpSelectItemTexBuf[i][field_0x6be[i]][0]); mpSelectItemTex[i][j]->setBasePosition(J2DBasePosition_4); } field_0x548[i] = 0.0f; @@ -256,21 +256,21 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i ResTIMG* timg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource( 'TIMG', dMeter2Info_getNumberTextureName(0)); for (int i = 0; i < 3; i++) { - mpItemNumTex[i] = new J2DPicture(timg); + mpItemNumTex[i] = JKR_NEW J2DPicture(timg); } - mpKanteraMeter = new dKantera_icon_c(); - mpScreen = new J2DScreen(); + mpKanteraMeter = JKR_NEW dKantera_icon_c(); + mpScreen = JKR_NEW J2DScreen(); dPaneClass_setPriority(&mpResData[0], mpHeap, mpScreen, "SCRN/zelda_item_select_icon_message_ver2.blo", 0x20000, dComIfGp_getRingResArchive()); dPaneClass_showNullPane(mpScreen); - mpMessageParent = new CPaneMgrAlpha(mpScreen, MULTI_CHAR('n_all'), 2, NULL); - mpTextParent[0] = new CPaneMgr(mpScreen, 'r_n', 0, NULL); - mpTextParent[1] = new CPaneMgr(mpScreen, 'c_n', 2, NULL); + mpMessageParent = JKR_NEW CPaneMgrAlpha(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpTextParent[0] = JKR_NEW CPaneMgr(mpScreen, 'r_n', 0, NULL); + mpTextParent[1] = JKR_NEW CPaneMgr(mpScreen, 'c_n', 2, NULL); mpTextParent[1]->setAlphaRate(1.0f); mpTextParent[2] = NULL; - mpTextParent[3] = new CPaneMgr(mpScreen, MULTI_CHAR('c_sen_n'), 2, NULL); - mpTextParent[4] = new CPaneMgr(mpScreen, 'gr_n', 2, NULL); + mpTextParent[3] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('c_sen_n'), 2, NULL); + mpTextParent[4] = JKR_NEW CPaneMgr(mpScreen, 'gr_n', 2, NULL); mpTextParent[4]->hide(); for (int i = 5; i < 10; i++) { mpTextParent[i] = NULL; @@ -289,7 +289,7 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i dMeter2Info_readItemTexture(item, mpItemBuf[i][0], NULL, mpItemBuf[i][1], NULL, mpItemBuf[i][2], NULL, NULL, NULL, -1); for (int k = 0; k < i_textureNum; k++) { - mpItemTex[i][k] = new J2DPicture(mpItemBuf[i][k]); + mpItemTex[i][k] = JKR_NEW J2DPicture(mpItemBuf[i][k]); mpItemTex[i][k]->setBasePosition(J2DBasePosition_4); } dMeter2Info_setItemColor(item, mpItemTex[i][0], mpItemTex[i][1], mpItemTex[i][2], NULL); @@ -316,7 +316,7 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i mpScreen->search(MULTI_CHAR('x_btn_n'))->hide(); mpScreen->search(MULTI_CHAR('y_btn_n'))->hide(); } - mpString = new dMsgString_c(); + mpString = JKR_NEW dMsgString_c(); for (i = 0; i < 5; i++) { #if VERSION == VERSION_GCN_JPN J2DTextBox* fxy_TextBox = (J2DTextBox*)mpScreen->search(xy_text[i]); @@ -379,23 +379,23 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i } mpHeap->getTotalFreeSize(); timg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBlackTex = new J2DPicture(timg); + mpBlackTex = JKR_NEW J2DPicture(timg); mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 0xff)); mpBlackTex->setAlpha(0); - mpSpotScreen = new J2DScreen(); + mpSpotScreen = JKR_NEW J2DScreen(); dPaneClass_setPriority(&mpResData[1], mpHeap, mpSpotScreen, "SCRN/zelda_item_select_icon3_spot.blo", 0x20000, dComIfGp_getRingResArchive()); dPaneClass_showNullPane(mpSpotScreen); - mpSpotParent = new CPaneMgrAlpha(mpSpotScreen, MULTI_CHAR('n_all'), 2, NULL); - mpCenterScreen = new J2DScreen(); + mpSpotParent = JKR_NEW CPaneMgrAlpha(mpSpotScreen, MULTI_CHAR('n_all'), 2, NULL); + mpCenterScreen = JKR_NEW J2DScreen(); dPaneClass_setPriority(&mpResData[2], mpHeap, mpCenterScreen, "SCRN/zelda_item_select_icon3_center_parts.blo", 0x20000, dComIfGp_getRingResArchive()); dPaneClass_showNullPane(mpCenterScreen); - mpCenterParent = new CPaneMgrAlpha(mpCenterScreen, MULTI_CHAR('center_n'), 2, NULL); - mpNameParent = new CPaneMgr(mpCenterScreen, MULTI_CHAR('label_n'), 1, NULL); - mpCircle = new CPaneMgr(mpCenterScreen, MULTI_CHAR('circle_n'), 2, NULL); + mpCenterParent = JKR_NEW CPaneMgrAlpha(mpCenterScreen, MULTI_CHAR('center_n'), 2, NULL); + mpNameParent = JKR_NEW CPaneMgr(mpCenterScreen, MULTI_CHAR('label_n'), 1, NULL); + mpCircle = JKR_NEW CPaneMgr(mpCenterScreen, MULTI_CHAR('circle_n'), 2, NULL); J2DTextBox* textBox[4]; #if VERSION == VERSION_GCN_JPN textBox[0] = (J2DTextBox*)mpCenterScreen->search(MULTI_CHAR('item_n04')); @@ -425,9 +425,9 @@ dMenu_Ring_c::dMenu_Ring_c(JKRExpHeap* i_heap, STControl* i_stick, CSTControl* i textBox[i]->setString(0x40, ""); } textCentering(); - mpDrawCursor = new dSelect_cursor_c(2, g_ringHIO.mCursorScale, dComIfGp_getMain2DArchive()); + mpDrawCursor = JKR_NEW dSelect_cursor_c(2, g_ringHIO.mCursorScale, dComIfGp_getMain2DArchive()); mpDrawCursor->setAlphaRate(1.0f); - mpItemExplain = new dMenu_ItemExplain_c(mpHeap, dComIfGp_getRingResArchive(), i_stick, true); + mpItemExplain = JKR_NEW dMenu_ItemExplain_c(mpHeap, dComIfGp_getRingResArchive(), i_stick, true); setRotate(); mpDrawCursor->setPos(mItemSlotPosX[0] + mCenterPosX, mItemSlotPosY[0] + mCenterPosY); if (dComIfGs_getItem(mItemSlots[0], false) != fpcNm_ITEM_NONE) { @@ -447,7 +447,7 @@ dMenu_Ring_c::~dMenu_Ring_c() { mpSelectItemTexBuf[i][j][k] = NULL; } if (mpSelectItemTex[i][j] != NULL) { - delete mpSelectItemTex[i][j]; + JKR_DELETE(mpSelectItemTex[i][j]); mpSelectItemTex[i][j] = NULL; } } @@ -455,23 +455,23 @@ dMenu_Ring_c::~dMenu_Ring_c() { for (int i = 0; i < 3; i++) { if (mpItemNumTex[i] != NULL) { - delete mpItemNumTex[i]; + JKR_DELETE(mpItemNumTex[i]); mpItemNumTex[i] = NULL; } } - delete mpKanteraMeter; + JKR_DELETE(mpKanteraMeter); mpKanteraMeter = NULL; - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpMessageParent; + JKR_DELETE(mpMessageParent); mpMessageParent = NULL; for (int i = 0; i < 10; i++) { if (mpTextParent[i] != NULL) { - delete mpTextParent[i]; + JKR_DELETE(mpTextParent[i]); mpTextParent[i] = NULL; } } @@ -479,7 +479,7 @@ dMenu_Ring_c::~dMenu_Ring_c() { for (int i = 0; i < MAX_ITEM_SLOTS; i++) { for (int j = 0; j < 3; j++) { if (mpItemTex[i][j] != NULL) { - delete mpItemTex[i][j]; + JKR_DELETE(mpItemTex[i][j]); mpItemTex[i][j] = NULL; } @@ -490,21 +490,21 @@ dMenu_Ring_c::~dMenu_Ring_c() { } } - delete mpString; + JKR_DELETE(mpString); mpString = NULL; mpHeap->getTotalFreeSize(); - delete mpBlackTex; + JKR_DELETE(mpBlackTex); mpBlackTex = NULL; - delete mpSpotScreen; + JKR_DELETE(mpSpotScreen); mpSpotScreen = NULL; - delete mpSpotParent; + JKR_DELETE(mpSpotParent); mpSpotParent = NULL; - delete mpCenterScreen; + JKR_DELETE(mpCenterScreen); mpCenterScreen = NULL; for (int i = 0; i < 3; i++) { @@ -514,19 +514,19 @@ dMenu_Ring_c::~dMenu_Ring_c() { } } - delete mpCenterParent; + JKR_DELETE(mpCenterParent); mpCenterParent = NULL; - delete mpNameParent; + JKR_DELETE(mpNameParent); mpNameParent = NULL; - delete mpCircle; + JKR_DELETE(mpCircle); mpCircle = NULL; - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; - delete mpItemExplain; + JKR_DELETE(mpItemExplain); mpItemExplain = NULL; dComIfGp_getRingResArchive()->removeResourceAll(); diff --git a/src/d/d_menu_save.cpp b/src/d/d_menu_save.cpp index 957910a036..e6ad7a5a70 100644 --- a/src/d/d_menu_save.cpp +++ b/src/d/d_menu_save.cpp @@ -115,7 +115,7 @@ dMenu_save_c::dMenu_save_c() { } void dMenu_save_c::_create() { - stick = new STControl(2, 2, 1, 1, 0.9f, 0.5f, 0, 0x2000); + stick = JKR_NEW STControl(2, 2, 1, 1, 0.9f, 0.5f, 0, 0x2000); if (mUseType == TYPE_DEFAULT || mUseType == TYPE_WHITE_EVENT || mUseType == TYPE_BLACK_EVENT) { mpMount = @@ -137,7 +137,7 @@ void dMenu_save_c::_create() { break; } - mpScrnExplain = new dMsgScrnExplain_c(stick, var_r31, false, 0); + mpScrnExplain = JKR_NEW dMsgScrnExplain_c(stick, var_r31, false, 0); field_0x219d = 0; field_0x2190 = 0; field_0x2192 = 0; @@ -175,13 +175,13 @@ void dMenu_save_c::screenSet() { static u8 l_msgNum0[2] = {0x08, 0x07}; static u8 l_msgNum[2] = {0x54, 0x55}; - mSaveSel.Scr = new J2DScreen(); + mSaveSel.Scr = JKR_NEW J2DScreen(); mSaveSel.Scr->setPriority("zelda_file_select2.blo", 0x1100000, mpArchive); dPaneClass_showNullPane(mSaveSel.Scr); mSaveSel.font[0] = mDoExt_getMesgFont(); mSaveSel.font[1] = mDoExt_getSubFont(); - mSaveSel.mMsgString = new dMsgString_c(); + mSaveSel.mMsgString = JKR_NEW dMsgString_c(); void* bck = JKRGetNameResource("zelda_file_select2.bck", mpArchive); field_0x40 = (J2DAnmTransformKey*)J2DAnmLoaderDataBase::load(bck); @@ -193,22 +193,22 @@ void dMenu_save_c::screenSet() { field_0x48->searchUpdateMaterialID(mSaveSel.Scr); field_0x4c->searchUpdateMaterialID(mSaveSel.Scr); - mpSelectMoveBase = new CPaneMgr(mSaveSel.Scr, MULTI_CHAR('w_move_n'), 0, NULL); + mpSelectMoveBase = JKR_NEW CPaneMgr(mSaveSel.Scr, MULTI_CHAR('w_move_n'), 0, NULL); field_0xa0 = mSaveSel.Scr->search(MULTI_CHAR('wmenu_n')); for (int i = 0; i < 3; i++) { - mpSelData[i] = new CPaneMgr(mSaveSel.Scr, l_tagName0[i], 0, NULL); + mpSelData[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName0[i], 0, NULL); } - mpNoYes[0] = new CPaneMgr(mSaveSel.Scr, MULTI_CHAR('w_no_n'), 0, NULL); - mpNoYes[1] = new CPaneMgr(mSaveSel.Scr, MULTI_CHAR('w_yes_n'), 0, NULL); + mpNoYes[0] = JKR_NEW CPaneMgr(mSaveSel.Scr, MULTI_CHAR('w_no_n'), 0, NULL); + mpNoYes[1] = JKR_NEW CPaneMgr(mSaveSel.Scr, MULTI_CHAR('w_yes_n'), 0, NULL); for (int i = 0; i < 2; i++) { #if VERSION == VERSION_GCN_JPN - mpNoYesTxt[i] = new CPaneMgr(mSaveSel.Scr, l_tagName000[i], 0, NULL); + mpNoYesTxt[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName000[i], 0, NULL); mSaveSel.Scr->search(l_tagName000U[i])->hide(); #else - mpNoYesTxt[i] = new CPaneMgr(mSaveSel.Scr, l_tagName000U[i], 0, NULL); + mpNoYesTxt[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName000U[i], 0, NULL); mSaveSel.Scr->search(l_tagName000[i])->hide(); #endif ((J2DTextBox*)mpNoYesTxt[i]->getPanePtr())->setFont(mSaveSel.font[0]); @@ -221,14 +221,14 @@ void dMenu_save_c::screenSet() { mSaveSel.Scr->search(MULTI_CHAR('Wi_btn_n'))->hide(); mSaveSel.Scr->search(MULTI_CHAR('GC_btn_n'))->show(); - mpBBtnIcon = new CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_nbbtn'), 2, NULL); - mpABtnIcon = new CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_nabtn'), 2, NULL); + mpBBtnIcon = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_nbbtn'), 2, NULL); + mpABtnIcon = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_nabtn'), 2, NULL); #if VERSION == VERSION_GCN_JPN - mpBackTxt = new CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_modo'), 2, NULL); - mpConfirmTxt = new CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_kete'), 2, NULL); + mpBackTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_modo'), 2, NULL); + mpConfirmTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('w_kete'), 2, NULL); #else - mpBackTxt = new CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('f_modo'), 2, NULL); - mpConfirmTxt = new CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('f_kete'), 2, NULL); + mpBackTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('f_modo'), 2, NULL); + mpConfirmTxt = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, MULTI_CHAR('f_kete'), 2, NULL); #endif mpBackTxt->setAlpha(0); @@ -263,9 +263,9 @@ void dMenu_save_c::screenSet() { mFileWakuRotAnmFrame = 0; for (int i = 0; i < 3; i++) { - mpSelWakuMoyo[i] = new CPaneMgr(mSaveSel.Scr, l_tagName3[i], 0, NULL); - mpSelWakuGold[i] = new CPaneMgr(mSaveSel.Scr, l_tagName4[i], 0, NULL); - mpSelWakuGold2[i] = new CPaneMgr(mSaveSel.Scr, l_tagName5[i], 0, NULL); + mpSelWakuMoyo[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName3[i], 0, NULL); + mpSelWakuGold[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName4[i], 0, NULL); + mpSelWakuGold2[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName5[i], 0, NULL); mpSelWakuMoyo[i]->getPanePtr()->setAnimation(mpFileWakuAnm); mpSelWakuGold[i]->getPanePtr()->setAnimation(mpFileWakuAnm); @@ -275,9 +275,9 @@ void dMenu_save_c::screenSet() { } for (int i = 0; i < 2; i++) { - mNoYesBase[i] = new CPaneMgr(mSaveSel.Scr, l_tagName9[i], 0, NULL); - mNoYesGold[i] = new CPaneMgr(mSaveSel.Scr, l_tagName10[i], 0, NULL); - mNoYesGold2[i] = new CPaneMgr(mSaveSel.Scr, l_tagName11[i], 0, NULL); + mNoYesBase[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName9[i], 0, NULL); + mNoYesGold[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName10[i], 0, NULL); + mNoYesGold2[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName11[i], 0, NULL); mNoYesBase[i]->getPanePtr()->setAnimation(mpFileWakuAnm); mNoYesGold[i]->getPanePtr()->setAnimation(mpFileWakuAnm); @@ -305,7 +305,7 @@ void dMenu_save_c::screenSet() { field_0x164 = 0; for (int i = 0; i < 3; i++) { - mpBookWaku[i] = new CPaneMgr(mSaveSel.Scr, l_tagName12[i], 0, NULL); + mpBookWaku[i] = JKR_NEW CPaneMgr(mSaveSel.Scr, l_tagName12[i], 0, NULL); mpBookWaku[i]->getPanePtr()->setAnimation(field_0x150); mpBookWaku[i]->getPanePtr()->setAnimation(field_0x158); @@ -326,7 +326,7 @@ void dMenu_save_c::screenSet() { #endif for (int i = 0; i < 2; i++) { - mpHeaderTxtPane[i] = new CPaneMgrAlpha(mSaveSel.Scr, l_tagName21[i], 0, NULL); + mpHeaderTxtPane[i] = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, l_tagName21[i], 0, NULL); ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setFont(mSaveSel.font[0]); ((J2DTextBox*)mpHeaderTxtPane[i]->getPanePtr())->setString(0x100, ""); @@ -357,9 +357,9 @@ void dMenu_save_c::screenSet() { for (int i = 0; i < 2; i++) { #if VERSION == VERSION_GCN_JPN - mpErrTxtPane[i] = new CPaneMgrAlpha(mSaveSel.Scr, l_tagName20[i], 0, NULL); + mpErrTxtPane[i] = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, l_tagName20[i], 0, NULL); #else - mpErrTxtPane[i] = new CPaneMgrAlpha(mSaveSel.Scr, l_tagName20[i], 0, NULL); + mpErrTxtPane[i] = JKR_NEW CPaneMgrAlpha(mSaveSel.Scr, l_tagName20[i], 0, NULL); #endif ((J2DTextBox*)mpErrTxtPane[i]->getPanePtr())->setFont(mSaveSel.font[0]); @@ -383,7 +383,7 @@ void dMenu_save_c::screenSet() { mpErrTxtPane[mErrTxtType ^ 1]->setAlpha(0); mSelectedFile = dComIfGs_getDataNum(); - mSelIcon = new dSelect_cursor_c(0, 1.0f, NULL); + mSelIcon = JKR_NEW dSelect_cursor_c(0, 1.0f, NULL); mSelIcon->setParam(0.96f, 0.94f, 0.03f, 0.7f, 0.7f); Vec pos; @@ -403,13 +403,13 @@ void dMenu_save_c::screenSet() { mpHeaderTxtPane[1]->getPanePtr()->scale(1.0f, 1.0f); for (int i = 0; i < 3; i++) { - mFileInfo[i] = new dFile_info_c(mpArchive, 1); + mFileInfo[i] = JKR_NEW dFile_info_c(mpArchive, 1); mFileInfo[i]->setBasePane(mSaveSel.Scr->search(l_tagName13[i])); mpDataBase[i] = mFileInfo[i]->getDatBase(); mpNoDataBase[i] = mFileInfo[i]->getNoDatBase(); } - mWarning = new dFile_warning_c(mpArchive, 0); + mWarning = JKR_NEW dFile_warning_c(mpArchive, 0); } @@ -493,139 +493,139 @@ int dMenu_save_c::_close() { } void dMenu_save_c::_delete() { - delete stick; + JKR_DELETE(stick); if (mpScrnExplain != NULL) { - delete mpScrnExplain; + JKR_DELETE(mpScrnExplain); mpScrnExplain = NULL; } if (mSaveSel.mMsgString != NULL) { - delete mSaveSel.mMsgString; + JKR_DELETE(mSaveSel.mMsgString); } if (mSaveSel.Scr != NULL) { - delete mSaveSel.Scr; + JKR_DELETE(mSaveSel.Scr); } for (int i = 0; i < 3; i++) { if (mpSelWakuMoyo[i] != NULL) { - delete mpSelWakuMoyo[i]; + JKR_DELETE(mpSelWakuMoyo[i]); } if (mpSelWakuGold[i] != NULL) { - delete mpSelWakuGold[i]; + JKR_DELETE(mpSelWakuGold[i]); } if (mpSelWakuGold2[i] != NULL) { - delete mpSelWakuGold2[i]; + JKR_DELETE(mpSelWakuGold2[i]); } if (mpBookWaku[i] != NULL) { - delete mpBookWaku[i]; + JKR_DELETE(mpBookWaku[i]); } if (mpSelData[i] != NULL) { - delete mpSelData[i]; + JKR_DELETE(mpSelData[i]); } if (mFileInfo[i] != NULL) { - delete mFileInfo[i]; + JKR_DELETE(mFileInfo[i]); } } if (mpSelectMoveBase != NULL) { - delete mpSelectMoveBase; + JKR_DELETE(mpSelectMoveBase); } for (int i = 0; i < 2; i++) { if (mpNoYes[i] != NULL) { - delete mpNoYes[i]; + JKR_DELETE(mpNoYes[i]); } if (mNoYesBase[i] != NULL) { - delete mNoYesBase[i]; + JKR_DELETE(mNoYesBase[i]); } if (mNoYesGold[i] != NULL) { - delete mNoYesGold[i]; + JKR_DELETE(mNoYesGold[i]); } if (mNoYesGold2[i] != NULL) { - delete mNoYesGold2[i]; + JKR_DELETE(mNoYesGold2[i]); } if (mpHeaderTxtPane[i] != NULL) { - delete mpHeaderTxtPane[i]; + JKR_DELETE(mpHeaderTxtPane[i]); } if (mpErrTxtPane[i] != NULL) { - delete mpErrTxtPane[i]; + JKR_DELETE(mpErrTxtPane[i]); } if (mpNoYesTxt[i] != NULL) { - delete mpNoYesTxt[i]; + JKR_DELETE(mpNoYesTxt[i]); } } if (field_0x40 != NULL) { - delete field_0x40; + JKR_DELETE(field_0x40); } if (field_0x44 != NULL) { - delete field_0x44; + JKR_DELETE(field_0x44); } if (field_0x48 != NULL) { - delete field_0x48; + JKR_DELETE(field_0x48); } if (mpFileWakuAnm != NULL) { - delete mpFileWakuAnm; + JKR_DELETE(mpFileWakuAnm); } if (mpFileWakuRotAnm != NULL) { - delete mpFileWakuRotAnm; + JKR_DELETE(mpFileWakuRotAnm); } if (field_0x150 != NULL) { - delete field_0x150; + JKR_DELETE(field_0x150); } if (field_0x158 != NULL) { - delete field_0x158; + JKR_DELETE(field_0x158); } if (field_0x160 != NULL) { - delete field_0x160; + JKR_DELETE(field_0x160); } if (field_0x4c != NULL) { - delete field_0x4c; + JKR_DELETE(field_0x4c); } if (mpBBtnIcon != NULL) { - delete mpBBtnIcon; + JKR_DELETE(mpBBtnIcon); } if (mpABtnIcon != NULL) { - delete mpABtnIcon; + JKR_DELETE(mpABtnIcon); } if (mpBackTxt != NULL) { - delete mpBackTxt; + JKR_DELETE(mpBackTxt); } if (mpConfirmTxt != NULL) { - delete mpConfirmTxt; + JKR_DELETE(mpConfirmTxt); } if (mSelIcon != NULL) { - delete mSelIcon; + JKR_DELETE(mSelIcon); } if (mWarning != NULL) { - delete mWarning; + JKR_DELETE(mWarning); } mDoExt_removeMesgFont(); diff --git a/src/d/d_menu_skill.cpp b/src/d/d_menu_skill.cpp index b9129efb2f..cc22e136c7 100644 --- a/src/d/d_menu_skill.cpp +++ b/src/d/d_menu_skill.cpp @@ -55,55 +55,55 @@ dMenu_Skill_c::dMenu_Skill_c(JKRExpHeap* i_heap, STControl* i_stcontrol, CSTCont } dMenu_Skill_c::~dMenu_Skill_c() { - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; - delete mpString; + JKR_DELETE(mpString); mpString = NULL; - delete mpMenuScreen; + JKR_DELETE(mpMenuScreen); mpMenuScreen = NULL; - delete mpLetterScreen; + JKR_DELETE(mpLetterScreen); mpLetterScreen = NULL; - delete mpTextPane; + JKR_DELETE(mpTextPane); mpTextPane = NULL; - delete mpExpName; + JKR_DELETE(mpExpName); mpExpName = NULL; - delete mpTextParent; + JKR_DELETE(mpTextParent); mpTextParent = NULL; - delete mpBlackTex; + JKR_DELETE(mpBlackTex); mpBlackTex = NULL; - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; for (int i = 0; i < 7; i++) { - delete mpLetterParent[i]; + JKR_DELETE(mpLetterParent[i]); mpLetterParent[i] = NULL; } - delete mpIconScreen; + JKR_DELETE(mpIconScreen); mpIconScreen = NULL; for (int i = 0; i < 2; i++) { if (mpButtonAB[i] != NULL) { - delete mpButtonAB[i]; + JKR_DELETE(mpButtonAB[i]); mpButtonAB[i] = NULL; } if (mpButtonText[i] != NULL) { - delete mpButtonText[i]; + JKR_DELETE(mpButtonText[i]); mpButtonText[i] = NULL; } } if (mpMount != NULL) { mpMount->getArchive()->unmount(); - delete mpMount; + JKR_DELETE(mpMount); mpMount = NULL; } @@ -114,12 +114,12 @@ dMenu_Skill_c::~dMenu_Skill_c() { } void dMenu_Skill_c::_create() { - mpDrawCursor = new dSelect_cursor_c(2, 1.0f, NULL); + mpDrawCursor = JKR_NEW dSelect_cursor_c(2, 1.0f, NULL); mpDrawCursor->setParam(1.01f, 0.85f, 0.02f, 0.5f, 0.5f); mpDrawCursor->setAlphaRate(0.0f); mpDrawCursor->setScale(0.0f); mpDrawCursor->offPlayAnime(0); - mpString = new dMsgString_c(); + mpString = JKR_NEW dMsgString_c(); screenSetMenu(); screenSetLetter(); screenSetDoIcon(); @@ -196,7 +196,7 @@ int dMenu_Skill_c::_open() { if (mpMount->sync() != 0) { if (!mpArchive) { mpArchive = (JKRArchive*)mpMount->getArchive(); - delete mpMount; + JKR_DELETE(mpMount); mpMount = NULL; _create(); } @@ -408,10 +408,10 @@ void dMenu_Skill_c::screenSetMenu() { MULTI_CHAR('maki_0'), MULTI_CHAR('maki_1'), MULTI_CHAR('maki_2'), MULTI_CHAR('maki_3'), MULTI_CHAR('maki_4'), MULTI_CHAR('maki_5'), MULTI_CHAR('maki_6'), }; - mpMenuScreen = new J2DScreen(); + mpMenuScreen = JKR_NEW J2DScreen(); mpMenuScreen->setPriority("zelda_ougi_window.blo", 0x20000, mpArchive); dPaneClass_showNullPane(mpMenuScreen); - mpParent = new CPaneMgr(mpMenuScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent = JKR_NEW CPaneMgr(mpMenuScreen, MULTI_CHAR('n_all'), 2, NULL); mpParent->setAlphaRate(0.0f); for (int i = 0; i < 7; i++) { #if VERSION == VERSION_GCN_JPN @@ -439,7 +439,7 @@ void dMenu_Skill_c::screenSetMenu() { } } for (int i = 0; i < 7; i++) { - mpLetterParent[i] = new CPaneMgr(mpMenuScreen, tag_letter[i], 0, NULL); + mpLetterParent[i] = JKR_NEW CPaneMgr(mpMenuScreen, tag_letter[i], 0, NULL); } for (int i = 0; i < 7; i++) { mpTagPicture[i][0] = (J2DPicture*)mpMenuScreen->search(tag_frame[i]); @@ -495,17 +495,17 @@ void dMenu_Skill_c::screenSetLetter() { MULTI_CHAR('f_item_4'), }; - mpLetterScreen = new J2DScreen(); + mpLetterScreen = JKR_NEW J2DScreen(); mpLetterScreen->setPriority("zelda_ougi_info.blo", 0x20000, mpArchive); dPaneClass_showNullPane(mpLetterScreen); #if VERSION == VERSION_GCN_JPN - mpTextPane = new CPaneMgr(mpLetterScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTextPane = JKR_NEW CPaneMgr(mpLetterScreen, MULTI_CHAR('mg_3line'), 0, NULL); mpLetterScreen->search(MULTI_CHAR('n_e4line'))->hide(); #else - mpTextPane = new CPaneMgr(mpLetterScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpTextPane = JKR_NEW CPaneMgr(mpLetterScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); mpLetterScreen->search(MULTI_CHAR('n_3line'))->hide(); #endif - mpExpName = new CPaneMgr(mpLetterScreen, MULTI_CHAR('label_n'), 0, NULL); + mpExpName = JKR_NEW CPaneMgr(mpLetterScreen, MULTI_CHAR('label_n'), 0, NULL); J2DTextBox* paneFont = (J2DTextBox*)mpTextPane->getPanePtr(); paneFont->setFont(mDoExt_getMesgFont()); J2DTextBox* paneString = (J2DTextBox*)mpTextPane->getPanePtr(); @@ -521,10 +521,10 @@ void dMenu_Skill_c::screenSetLetter() { mpNameString[i]->setFont(mDoExt_getMesgFont()); mpNameString[i]->setString(0x40, ""); } - mpTextParent = new CPaneMgr(mpLetterScreen, MULTI_CHAR('n_all'), 2, NULL); + mpTextParent = JKR_NEW CPaneMgr(mpLetterScreen, MULTI_CHAR('n_all'), 2, NULL); mpTextParent->setAlphaRate(0.0f); ResTIMG* timg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBlackTex = new J2DPicture(timg); + mpBlackTex = JKR_NEW J2DPicture(timg); mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 0xff)); mpBlackTex->setAlpha(0); } @@ -536,7 +536,7 @@ void dMenu_Skill_c::screenSetDoIcon() { static const u64 text_b_tag[5] = { MULTI_CHAR('btext1_1'), MULTI_CHAR('btext1_2'), MULTI_CHAR('btext1_3'), MULTI_CHAR('btext1_4'), MULTI_CHAR('btext1_5'), }; - mpIconScreen = new J2DScreen(); + mpIconScreen = JKR_NEW J2DScreen(); mpIconScreen->setPriority("zelda_collect_soubi_do_icon_parts.blo", 0x20000, mpArchive); for (int i = 0; i < 2; i++) { mpButtonAB[i] = 0; diff --git a/src/d/d_menu_window.cpp b/src/d/d_menu_window.cpp index 860bb57323..d43d85d128 100644 --- a/src/d/d_menu_window.cpp +++ b/src/d/d_menu_window.cpp @@ -1026,7 +1026,7 @@ void dMw_c::insect_close_proc() { void dMw_c::dMw_capture_create() { if (!dComIfGp_isPauseFlag() && mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(1996, mpCapture != NULL); mpCapture->setCaptureFlag(); } @@ -1035,7 +1035,7 @@ void dMw_c::dMw_capture_create() { void dMw_c::dMw_capture_delete() { if (dComIfGp_isPauseFlag()) { if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } dComIfGp_offPauseFlag(); @@ -1047,12 +1047,12 @@ void dMw_c::dMw_ring_create(u8 i_origin) { markMemSize(); dComIfGp_setHeapLockFlag(1); - mpMenuRing = new dMenu_Ring_c(mpHeap, mpStick, mpCStick, i_origin); + mpMenuRing = JKR_NEW dMenu_Ring_c(mpHeap, mpStick, mpCStick, i_origin); JUT_ASSERT(2038, mpMenuRing != NULL); mpMenuRing->_create(); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2043, mpCapture != NULL); } @@ -1062,12 +1062,12 @@ void dMw_c::dMw_ring_create(u8 i_origin) { bool dMw_c::dMw_ring_delete() { if (mpMenuRing != NULL) { mpMenuRing->_delete(); - delete mpMenuRing; + JKR_DELETE(mpMenuRing); mpMenuRing = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1078,7 +1078,7 @@ bool dMw_c::dMw_ring_delete() { void dMw_c::dMw_collect_create() { markMemSize(); - mpMenuCollect = new dMenu_Collect_c(mpHeap, mpStick, mpCStick); + mpMenuCollect = JKR_NEW dMenu_Collect_c(mpHeap, mpStick, mpCStick); JUT_ASSERT(2093, mpMenuCollect != NULL); mpMenuCollect->_create(); @@ -1092,7 +1092,7 @@ void dMw_c::dMw_collect_create() { bool dMw_c::dMw_collect_delete(bool) { if (mpMenuCollect != NULL) { mpMenuCollect->_delete(); - delete mpMenuCollect; + JKR_DELETE(mpMenuCollect); mpMenuCollect = NULL; } checkMemSize(); @@ -1118,12 +1118,12 @@ void dMw_c::dMw_fmap_create() { tmp = 3; } - mpMenuFmap = new dMenu_Fmap_c(mpHeap, mpStick, mpCStick, mFmapProcess, mFmapRegionCursor, + mpMenuFmap = JKR_NEW dMenu_Fmap_c(mpHeap, mpStick, mpCStick, mFmapProcess, mFmapRegionCursor, mFmapStageCursor, mFmapStageTransX, mFmapStageTransZ, tmp); JUT_ASSERT(2194, mpMenuFmap != NULL); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2200, mpCapture != NULL); } @@ -1144,12 +1144,12 @@ bool dMw_c::dMw_fmap_delete(bool param_0) { mFmapStageTransZ = mpMenuFmap->getStageTransZ(); mpMenuFmap->_delete(); - delete mpMenuFmap; + JKR_DELETE(mpMenuFmap); mpMenuFmap = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1162,7 +1162,7 @@ void dMw_c::dMw_dmap_create() { dComIfGp_setHeapLockFlag(3); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2294, mpCapture != NULL); } @@ -1179,7 +1179,7 @@ void dMw_c::dMw_dmap_create() { tmp = 0; } - mpMenuDmap = new dMenu_Dmap_c(mpHeap, mpStick, mpCStick, field_0x14C, tmp); + mpMenuDmap = JKR_NEW dMenu_Dmap_c(mpHeap, mpStick, mpCStick, field_0x14C, tmp); JUT_ASSERT(2314, mpMenuDmap != NULL); dMeter2Info_resetWarpStatus(); @@ -1193,12 +1193,12 @@ bool dMw_c::dMw_dmap_delete(bool param_0) { field_0x14C = mpMenuDmap->getZoomState(); - delete mpMenuDmap; + JKR_DELETE(mpMenuDmap); mpMenuDmap = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1209,7 +1209,7 @@ bool dMw_c::dMw_dmap_delete(bool param_0) { void dMw_c::dMw_save_create() { markMemSize(); - mpMenuSave = new dMenu_save_c(); + mpMenuSave = JKR_NEW dMenu_save_c(); JUT_ASSERT(2365, mpMenuSave != NULL); mpMenuSave->setUseType(1); @@ -1217,7 +1217,7 @@ void dMw_c::dMw_save_create() { mpMenuSave->initialize(); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2373, mpCapture != NULL); } } @@ -1225,12 +1225,12 @@ void dMw_c::dMw_save_create() { bool dMw_c::dMw_save_delete() { if (mpMenuSave != NULL) { mpMenuSave->_delete(); - delete mpMenuSave; + JKR_DELETE(mpMenuSave); mpMenuSave = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1241,11 +1241,11 @@ bool dMw_c::dMw_save_delete() { void dMw_c::dMw_option_create() { markMemSize(); - mpMenuOption = new dMenu_Option_c(dComIfGp_getCollectResArchive(), mpStick); + mpMenuOption = JKR_NEW dMenu_Option_c(dComIfGp_getCollectResArchive(), mpStick); JUT_ASSERT(2415, mpMenuOption != NULL); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2420, mpCapture != NULL); } } @@ -1256,12 +1256,12 @@ bool dMw_c::dMw_option_delete() { return false; } mpMenuOption->_delete(); - delete mpMenuOption; + JKR_DELETE(mpMenuOption); mpMenuOption = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1272,11 +1272,11 @@ bool dMw_c::dMw_option_delete() { void dMw_c::dMw_letter_create() { markMemSize(); - mpMenuLetter = new dMenu_Letter_c(mpHeap, mpStick, mpCStick); + mpMenuLetter = JKR_NEW dMenu_Letter_c(mpHeap, mpStick, mpCStick); JUT_ASSERT(2463, mpMenuLetter != NULL); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2467, mpCapture != NULL); } } @@ -1286,12 +1286,12 @@ bool dMw_c::dMw_letter_delete() { if (!mpMenuLetter->isSync()) { return false; } - delete mpMenuLetter; + JKR_DELETE(mpMenuLetter); mpMenuLetter = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1302,11 +1302,11 @@ bool dMw_c::dMw_letter_delete() { void dMw_c::dMw_fishing_create() { markMemSize(); - mpMenuFishing = new dMenu_Fishing_c(mpHeap, mpStick, mpCStick); + mpMenuFishing = JKR_NEW dMenu_Fishing_c(mpHeap, mpStick, mpCStick); JUT_ASSERT(2509, mpMenuFishing != NULL); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2513, mpCapture != NULL); } } @@ -1316,12 +1316,12 @@ bool dMw_c::dMw_fishing_delete() { if (!mpMenuFishing->isSync()) { return false; } - delete mpMenuFishing; + JKR_DELETE(mpMenuFishing); mpMenuFishing = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1332,11 +1332,11 @@ bool dMw_c::dMw_fishing_delete() { void dMw_c::dMw_skill_create() { markMemSize(); - mpMenuSkill = new dMenu_Skill_c(mpHeap, mpStick, mpCStick); + mpMenuSkill = JKR_NEW dMenu_Skill_c(mpHeap, mpStick, mpCStick); JUT_ASSERT(2555, mpMenuSkill != NULL); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2559, mpCapture != NULL); } } @@ -1346,12 +1346,12 @@ bool dMw_c::dMw_skill_delete() { if (!mpMenuSkill->isSync()) { return false; } - delete mpMenuSkill; + JKR_DELETE(mpMenuSkill); mpMenuSkill = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1362,11 +1362,11 @@ bool dMw_c::dMw_skill_delete() { void dMw_c::dMw_insect_create(u8 param_0) { markMemSize(); - mpMenuInsect = new dMenu_Insect_c(mpHeap, mpStick, mpCStick, param_0); + mpMenuInsect = JKR_NEW dMenu_Insect_c(mpHeap, mpStick, mpCStick, param_0); JUT_ASSERT(2601, mpMenuInsect != NULL); if (mpCapture == NULL) { - mpCapture = new dDlst_MENU_CAPTURE_c(); + mpCapture = JKR_NEW dDlst_MENU_CAPTURE_c(); JUT_ASSERT(2605, mpCapture != NULL); } } @@ -1376,12 +1376,12 @@ bool dMw_c::dMw_insect_delete() { if (!mpMenuInsect->isSync()) { return false; } - delete mpMenuInsect; + JKR_DELETE(mpMenuInsect); mpMenuInsect = NULL; } if (mpCapture != NULL) { - delete mpCapture; + JKR_DELETE(mpCapture); mpCapture = NULL; } @@ -1502,11 +1502,11 @@ void dMw_c::checkMemSize() { int dMw_c::_create() { mpHeap = dComIfGp_getExpHeap2D(); - mpStick = new STControl(5, 2, 1, 1, 0.9f, 0.5f, 0, 0x800); + mpStick = JKR_NEW STControl(5, 2, 1, 1, 0.9f, 0.5f, 0, 0x800); JUT_ASSERT(2967, mpStick != NULL); mpStick->setFirstWaitTime(8); - mpCStick = new CSTControl(5, 2, 3, 2, 0.9f, 0.5f, 0, 0x2000); + mpCStick = JKR_NEW CSTControl(5, 2, 3, 2, 0.9f, 0.5f, 0, 0x2000); JUT_ASSERT(2976, mpCStick != NULL); mpCStick->setWaitParm(5, 2, 3, 2, 0.9f, 0.5f, 0, 0x2000); @@ -1644,10 +1644,10 @@ int dMw_c::_draw() { int dMw_c::_delete() { JKRHeap* heap = mDoExt_getCurrentHeap(); - delete mpStick; + JKR_DELETE(mpStick); mpStick = NULL; - delete mpCStick; + JKR_DELETE(mpCStick); mpCStick = NULL; mDoExt_setCurrentHeap(mpHeap); diff --git a/src/d/d_meter2.cpp b/src/d/d_meter2.cpp index 28cebd533b..76dfa66651 100644 --- a/src/d/d_meter2.cpp +++ b/src/d/d_meter2.cpp @@ -183,7 +183,7 @@ int dMeter2_c::_create() { field_0x1ac = dMeter2Info_isUseButton(16); field_0x19a = 0; - mpMeterDraw = new dMeter2Draw_c(mpHeap); + mpMeterDraw = JKR_NEW dMeter2Draw_c(mpHeap); field_0x130 = mpMeterDraw->getNowLightDropRateCalc(); mpHeap->getTotalFreeSize(); @@ -222,7 +222,7 @@ int dMeter2_c::_create() { mpMap = NULL; if (dMeterMap_c::isEnableDispMapAndMapDispSizeTypeNo()) { - mpMap = new dMeterMap_c(mpMeterDraw->getMainScreenPtr()); + mpMap = JKR_NEW dMeterMap_c(mpMeterDraw->getMainScreenPtr()); } else { if (g_meter2_info.mMapStatus == 2) { g_meter2_info.mMapStatus = 0; @@ -361,30 +361,30 @@ int dMeter2_c::_delete() { mpHeap->getTotalFreeSize(); if (mpMap != NULL) { - delete mpMap; + JKR_DELETE(mpMap); mpMap = NULL; } mpHeap->getTotalFreeSize(); mDoExt_setCurrentHeap(mpSubHeap); if (mpSubContents != NULL) { - delete mpSubContents; + JKR_DELETE(mpSubContents); mpSubContents = NULL; } if (mpSubSubContents != NULL) { - delete mpSubSubContents; + JKR_DELETE(mpSubSubContents); mpSubSubContents = NULL; } mpHeap->getTotalFreeSize(); if (field_0x11c != NULL) { - delete field_0x11c; + JKR_DELETE(field_0x11c); field_0x11c = NULL; } mDoExt_setCurrentHeap(heap); - delete mpMeterDraw; + JKR_DELETE(mpMeterDraw); mpMeterDraw = NULL; fopMsgM_destroyExpHeap(mpSubHeap); @@ -399,7 +399,7 @@ int dMeter2_c::emphasisButtonDelete() { mpEmpButton->hideAll(); if (heap != NULL) { - delete mpEmpButton; + JKR_DELETE(mpEmpButton); mpEmpButton = NULL; heap->freeAll(); dComIfGp_offHeapLockFlag(8); @@ -2335,7 +2335,7 @@ void dMeter2_c::checkSubContents() { killSubContents(4); if (mSubContentType == 0) { - mpSubContents = new dScope_c(0); + mpSubContents = JKR_NEW dScope_c(0); mSubContentType = 4; } return; @@ -2347,7 +2347,7 @@ void dMeter2_c::checkSubContents() { if (mSubContentType == 0) { mpSubHeap->getTotalFreeSize(); - mpSubContents = new dMeterHakusha_c(mpMeterDraw->getMainScreenPtr()); + mpSubContents = JKR_NEW dMeterHakusha_c(mpMeterDraw->getMainScreenPtr()); mSubContentType = 1; } return; @@ -2358,8 +2358,8 @@ void dMeter2_c::checkSubContents() { killSubContents(5); if (mSubContentType == 0) { - mpSubContents = new dMeterHaihai_c(0); - mpSubSubContents = new dMeterString_c(dMeter2Info_getMeterStringType()); + mpSubContents = JKR_NEW dMeterHaihai_c(0); + mpSubSubContents = JKR_NEW dMeterString_c(dMeter2Info_getMeterStringType()); mSubContentType = 5; mSubContentsStringType = dMeter2Info_getMeterStringType(); } @@ -2367,14 +2367,14 @@ void dMeter2_c::checkSubContents() { killSubContents(2); if (mSubContentType == 0) { - mpSubContents = new dMeterHaihai_c(0); + mpSubContents = JKR_NEW dMeterHaihai_c(0); mSubContentType = 2; } } else if (dMeter2Info_getMeterStringType() != 0) { killSubContents(3); if (mSubContentType == 0) { - mpSubContents = new dMeterString_c(dMeter2Info_getMeterStringType()); + mpSubContents = JKR_NEW dMeterString_c(dMeter2Info_getMeterStringType()); mSubContentType = 3; } } else if (mSubContentType == 4) { @@ -2382,13 +2382,13 @@ void dMeter2_c::checkSubContents() { bool free_heap = false; if (mpSubContents != NULL && mpSubContents->isDead()) { - delete mpSubContents; + JKR_DELETE(mpSubContents); mpSubContents = NULL; free_heap = true; } if (mpSubSubContents != NULL && mpSubSubContents->isDead()) { - delete mpSubSubContents; + JKR_DELETE(mpSubSubContents); mpSubSubContents = NULL; free_heap = true; } @@ -2405,13 +2405,13 @@ void dMeter2_c::checkSubContents() { bool free_heap = false; if (mpSubContents != NULL) { - delete mpSubContents; + JKR_DELETE(mpSubContents); mpSubContents = NULL; free_heap = true; } if (mpSubSubContents != NULL) { - delete mpSubSubContents; + JKR_DELETE(mpSubSubContents); mpSubSubContents = NULL; free_heap = true; } @@ -2441,7 +2441,7 @@ void dMeter2_c::check2DContents() { field_0x108 = mDoExt_setCurrentHeap(dComIfGp_getSubHeap2D(8)); } - mpEmpButton = new dMeterButton_c(); + mpEmpButton = JKR_NEW dMeterButton_c(); } } else if (dComIfGp_isHeapLockFlag() == 5 && !dMeter2Info_isFloatingMessageVisible()) { if (!mpMeterDraw->isEmphasisA() && !mpMeterDraw->isEmphasisB() && @@ -2450,7 +2450,7 @@ void dMeter2_c::check2DContents() { !mpMeterDraw->isEmphasisS() && !mpMeterDraw->isEmphasisX() && !mpMeterDraw->isEmphasisY() && !mpMeterDraw->isEmphasisBin() && mpEmpButton->isClose()) { - delete mpEmpButton; + JKR_DELETE(mpEmpButton); mpEmpButton = NULL; dComIfGp_getSubHeap2D(8)->freeAll(); @@ -2988,13 +2988,13 @@ void dMeter2_c::killSubContents(u8 param_0) { bool free = false; if (mpSubContents != NULL) { - delete mpSubContents; + JKR_DELETE(mpSubContents); mpSubContents = NULL; free = true; } if (mpSubSubContents != NULL) { - delete mpSubSubContents; + JKR_DELETE(mpSubSubContents); mpSubSubContents = NULL; free = true; } diff --git a/src/d/d_meter2_draw.cpp b/src/d/d_meter2_draw.cpp index 302ef5e06a..78adf89d9f 100644 --- a/src/d/d_meter2_draw.cpp +++ b/src/d/d_meter2_draw.cpp @@ -44,7 +44,7 @@ dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) { dMeter2Info_setMsgUnitResource(msg_unit_res); mDoExt_setCurrentHeap(heap); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_game_image.blo", 0x20000, dComIfGp_getMain2DArchive()); JUT_ASSERT(0, fg != false); @@ -54,24 +54,24 @@ dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) { field_0x73c = 0.0f; for (int i = 0; i < 2; i++) { - mpKanteraMeter[i] = new dKantera_icon_c(); + mpKanteraMeter[i] = JKR_NEW dKantera_icon_c(); JUT_ASSERT(0, mpKanteraMeter[i] != NULL); } - mpKanteraScreen = new J2DScreen(); + mpKanteraScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpKanteraScreen != NULL); fg = mpKanteraScreen->setPriority("zelda_game_image_kantera.blo", 0x20000, dComIfGp_getMain2DArchive()); JUT_ASSERT(0, fg != false); dPaneClass_showNullPane(mpKanteraScreen); - mpPikariScreen = new J2DScreen(); + mpPikariScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpPikariScreen != NULL); fg = mpPikariScreen->setPriority("zelda_icon_pikari.blo", 0x20000, dComIfGp_getMain2DArchive()); JUT_ASSERT(0, fg != false); dPaneClass_showNullPane(mpPikariScreen); - mpPikariParent = new CPaneMgr(mpPikariScreen, MULTI_CHAR('pika_n'), 0, NULL); + mpPikariParent = JKR_NEW CPaneMgr(mpPikariScreen, MULTI_CHAR('pika_n'), 0, NULL); JUT_ASSERT(0, mpPikariParent != NULL); mPikariBlack = static_cast(mpPikariScreen->search(MULTI_CHAR('pika00')))->getBlack(); mPikariWhite = static_cast(mpPikariScreen->search(MULTI_CHAR('pika00')))->getWhite(); @@ -86,7 +86,7 @@ dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) { mPikariBpk->searchUpdateMaterialID(mpPikariScreen); playPikariBpkAnimation(1.0f); - mpParent = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); JUT_ASSERT(0, mpParent != NULL); static u64 const a_tag[] = {MULTI_CHAR('cont_at1'), MULTI_CHAR('cont_at2'), MULTI_CHAR('cont_at3'), MULTI_CHAR('cont_at4'), MULTI_CHAR('cont_at')}; @@ -96,29 +96,29 @@ dMeter2Draw_c::dMeter2Draw_c(JKRExpHeap* mp_heap) { static u64 const y_tag[] = {MULTI_CHAR('cont_yt1'), MULTI_CHAR('cont_yt2'), MULTI_CHAR('cont_yt3'), MULTI_CHAR('cont_yt4'), MULTI_CHAR('cont_yt5')}; for (int i = 0; i < 5; i++) { - mpAText[i] = new CPaneMgr(mpScreen, a_tag[i], 0, NULL); + mpAText[i] = JKR_NEW CPaneMgr(mpScreen, a_tag[i], 0, NULL); JUT_ASSERT(0, mpAText[i] != NULL); static_cast(mpAText[i]->getPanePtr())->setString(64, ""); static_cast(mpAText[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); static_cast(mpAText[i]->getPanePtr()) ->setCharSpace(g_drawHIO.mButtonATextSpacing); - mpBText[i] = new CPaneMgr(mpScreen, b_tag[i], 0, NULL); + mpBText[i] = JKR_NEW CPaneMgr(mpScreen, b_tag[i], 0, NULL); JUT_ASSERT(0, mpBText[i] != NULL); static_cast(mpBText[i]->getPanePtr())->setString(64, ""); static_cast(mpBText[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); - mpXYText[i][2] = new CPaneMgr(mpScreen, z_tag[i], 0, NULL); + mpXYText[i][2] = JKR_NEW CPaneMgr(mpScreen, z_tag[i], 0, NULL); JUT_ASSERT(0, mpXYText[i][2] != NULL); static_cast(mpXYText[i][2]->getPanePtr())->setString(64, ""); static_cast(mpXYText[i][2]->getPanePtr())->setFont(mDoExt_getMesgFont()); - mpXYText[i][0] = new CPaneMgr(mpScreen, x_tag[i], 0, NULL); + mpXYText[i][0] = JKR_NEW CPaneMgr(mpScreen, x_tag[i], 0, NULL); JUT_ASSERT(0, mpXYText[i][0] != NULL); static_cast(mpXYText[i][0]->getPanePtr())->setString(64, ""); static_cast(mpXYText[i][0]->getPanePtr())->setFont(mDoExt_getMesgFont()); - mpXYText[i][1] = new CPaneMgr(mpScreen, y_tag[i], 0, NULL); + mpXYText[i][1] = JKR_NEW CPaneMgr(mpScreen, y_tag[i], 0, NULL); JUT_ASSERT(0, mpXYText[i][1] != NULL); static_cast(mpXYText[i][1]->getPanePtr())->setString(64, ""); static_cast(mpXYText[i][1]->getPanePtr())->setFont(mDoExt_getMesgFont()); @@ -151,127 +151,127 @@ dMeter2Draw_c::~dMeter2Draw_c() { dComIfGp_getMsgDtArchive(0)->removeResource(dMeter2Info_getMsgUnitResource()); dComIfGp_getItemIconArchive()->removeResourceAll(); - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpKanteraScreen; + JKR_DELETE(mpKanteraScreen); mpKanteraScreen = NULL; for (int i = 0; i < 2; i++) { - delete mpKanteraMeter[i]; + JKR_DELETE(mpKanteraMeter[i]); mpKanteraMeter[i] = NULL; } - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; - delete mpPikariScreen; + JKR_DELETE(mpPikariScreen); mpPikariScreen = NULL; - delete mpPikariParent; + JKR_DELETE(mpPikariParent); mpPikariParent = NULL; - delete mPikariBck; + JKR_DELETE(mPikariBck); mPikariBck = NULL; - delete mPikariBpk; + JKR_DELETE(mPikariBpk); mPikariBpk = NULL; for (int i = 0; i < 5; i++) { - delete mpAText[i]; + JKR_DELETE(mpAText[i]); mpAText[i] = NULL; - delete mpBText[i]; + JKR_DELETE(mpBText[i]); mpBText[i] = NULL; for (int j = 0; j < 3; j++) { - delete mpXYText[i][j]; + JKR_DELETE(mpXYText[i][j]); mpXYText[i][j] = NULL; } } - delete mpLifeParent; + JKR_DELETE(mpLifeParent); mpLifeParent = NULL; for (int i = 0; i < 20; i++) { - delete mpLifeParts[i]; + JKR_DELETE(mpLifeParts[i]); mpLifeParts[i] = NULL; - delete mpHeartMark[i]; + JKR_DELETE(mpHeartMark[i]); mpHeartMark[i] = NULL; - delete mpHeartBase[i]; + JKR_DELETE(mpHeartBase[i]); mpHeartBase[i] = NULL; - delete mpLifeTexture[i][0]; + JKR_DELETE(mpLifeTexture[i][0]); mpLifeTexture[i][0] = NULL; - delete mpLifeTexture[i][1]; + JKR_DELETE(mpLifeTexture[i][1]); mpLifeTexture[i][1] = NULL; } - delete mpBigHeart; + JKR_DELETE(mpBigHeart); mpBigHeart = NULL; - delete mpMagicParent; + JKR_DELETE(mpMagicParent); mpMagicParent = NULL; - delete mpMagicBase; + JKR_DELETE(mpMagicBase); mpMagicBase = NULL; - delete mpMagicFrameL; + JKR_DELETE(mpMagicFrameL); mpMagicFrameL = NULL; - delete mpMagicFrameR; + JKR_DELETE(mpMagicFrameR); mpMagicFrameR = NULL; for (int i = 0; i < 3; i++) { - delete mpOxygenBpk[i]; + JKR_DELETE(mpOxygenBpk[i]); mpOxygenBpk[i] = NULL; } - delete mpMagicMeter; + JKR_DELETE(mpMagicMeter); mpMagicMeter = NULL; for (int i = 0; i < 2; i++) { - delete mpSIParent[i]; + JKR_DELETE(mpSIParent[i]); mpSIParent[i] = NULL; } - delete mpLightDropParent; + JKR_DELETE(mpLightDropParent); mpLightDropParent = NULL; for (int i = 0; i < 16; i++) { for (int j = 0; j < 3; j++) { if (mpSIParts[i][j] != NULL) { - delete mpSIParts[i][j]; + JKR_DELETE(mpSIParts[i][j]); mpSIParts[i][j] = NULL; } } } - delete mpRupeeKeyParent; + JKR_DELETE(mpRupeeKeyParent); mpRupeeKeyParent = NULL; for (int i = 0; i < 4; i++) { - delete mpRupeeTexture[i][0]; + JKR_DELETE(mpRupeeTexture[i][0]); mpRupeeTexture[i][0] = NULL; - delete mpRupeeTexture[i][1]; + JKR_DELETE(mpRupeeTexture[i][1]); mpRupeeTexture[i][1] = NULL; } for (int i = 0; i < 3; i++) { - delete mpRupeeParent[i]; + JKR_DELETE(mpRupeeParent[i]); mpRupeeParent[i] = NULL; } for (int i = 0; i < 5; i++) { - delete mpKeyTexture[i]; + JKR_DELETE(mpKeyTexture[i]); mpKeyTexture[i] = NULL; } - delete mpKeyParent; + JKR_DELETE(mpKeyParent); mpKeyParent = NULL; for (int i = 0; i < 2; i++) { @@ -290,105 +290,105 @@ dMeter2Draw_c::~dMeter2Draw_c() { } } - delete mpItemB; + JKR_DELETE(mpItemB); mpItemB = NULL; mpItemBPane = NULL; for (int i = 0; i < 2; i++) { if (mpItemXY[i] != NULL) { - delete mpItemXY[i]; + JKR_DELETE(mpItemXY[i]); mpItemXY[i] = NULL; } } - delete mpItemR; + JKR_DELETE(mpItemR); mpItemR = NULL; for (int i = 0; i < 3; i++) { mpItemXYPane[i] = NULL; } - delete mpLightB; + JKR_DELETE(mpLightB); mpLightB = NULL; for (int i = 0; i < 3; i++) { if (mpLightXY[i] != NULL) { - delete mpLightXY[i]; + JKR_DELETE(mpLightXY[i]); mpLightXY[i] = NULL; } } - delete mpBTextA; + JKR_DELETE(mpBTextA); mpBTextA = NULL; - delete mpBTextB; + JKR_DELETE(mpBTextB); mpBTextB = NULL; for (int i = 0; i < 3; i++) { if (mpBTextXY[i] != NULL) { - delete mpBTextXY[i]; + JKR_DELETE(mpBTextXY[i]); mpBTextXY[i] = NULL; } } - delete mpTextA; + JKR_DELETE(mpTextA); mpTextA = NULL; - delete mpTextB; + JKR_DELETE(mpTextB); mpTextB = NULL; for (int i = 0; i < 3; i++) { - delete mpTextXY[i]; + JKR_DELETE(mpTextXY[i]); mpTextXY[i] = NULL; } - delete mpTextI; + JKR_DELETE(mpTextI); mpTextI = NULL; - delete mpTextM; + JKR_DELETE(mpTextM); mpTextM = NULL; for (int i = 0; i < 5; i++) { if (mpJujiI[i] != NULL) { - delete mpJujiI[i]; + JKR_DELETE(mpJujiI[i]); mpJujiI[i] = NULL; } if (mpJujiM[i] != NULL) { - delete mpJujiM[i]; + JKR_DELETE(mpJujiM[i]); mpJujiM[i] = NULL; } } - delete mpButtonParent; + JKR_DELETE(mpButtonParent); mpButtonParent = NULL; - delete mpButtonA; + JKR_DELETE(mpButtonA); mpButtonA = NULL; - delete mpButtonB; + JKR_DELETE(mpButtonB); mpButtonB = NULL; - delete mpButtonMidona; + JKR_DELETE(mpButtonMidona); mpButtonMidona = NULL; for (int i = 0; i < 3; i++) { - delete mpButtonXY[i]; + JKR_DELETE(mpButtonXY[i]); mpButtonXY[i] = NULL; } if (mpUzu != NULL) { - delete mpUzu; + JKR_DELETE(mpUzu); mpUzu = NULL; } - delete mpButtonCrossParent; + JKR_DELETE(mpButtonCrossParent); mpButtonCrossParent = NULL; for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { if (mpItemNumTex[i][j] != NULL) { - delete mpItemNumTex[i][j]; + JKR_DELETE(mpItemNumTex[i][j]); mpItemNumTex[i][j] = NULL; } } @@ -396,7 +396,7 @@ dMeter2Draw_c::~dMeter2Draw_c() { for (int i = 0; i < 3; i++) { if (field_0x9c[i] != NULL) { - delete field_0x9c[i]; + JKR_DELETE(field_0x9c[i]); field_0x9c[i] = NULL; } } @@ -750,27 +750,27 @@ void dMeter2Draw_c::initLife() { MULTI_CHAR('hear_14'), MULTI_CHAR('hear_15'), MULTI_CHAR('hear_16'), MULTI_CHAR('hear_17'), MULTI_CHAR('hear_18'), MULTI_CHAR('hear_19'), }; - mpLifeParent = new CPaneMgr(mpScreen, MULTI_CHAR('heart_n'), 2, NULL); + mpLifeParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('heart_n'), 2, NULL); JUT_ASSERT(0, mpLifeParent != NULL); for (int i = 0; i < 20; i++) { - mpLifeParts[i] = new CPaneMgr(mpScreen, life_tag[i], 0, NULL); + mpLifeParts[i] = JKR_NEW CPaneMgr(mpScreen, life_tag[i], 0, NULL); JUT_ASSERT(0, mpLifeParts[i] != NULL); - mpHeartMark[i] = new CPaneMgr(mpScreen, mark_tag[i], 2, NULL); + mpHeartMark[i] = JKR_NEW CPaneMgr(mpScreen, mark_tag[i], 2, NULL); JUT_ASSERT(0, mpHeartMark[i] != NULL); - mpHeartBase[i] = new CPaneMgrAlpha(mpScreen, base_tag[i], 2, NULL); + mpHeartBase[i] = JKR_NEW CPaneMgrAlpha(mpScreen, base_tag[i], 2, NULL); JUT_ASSERT(0, mpHeartBase[i] != NULL); - mpLifeTexture[i][0] = new CPaneMgrAlpha(mpScreen, lifet1_tag[i], 0, NULL); + mpLifeTexture[i][0] = JKR_NEW CPaneMgrAlpha(mpScreen, lifet1_tag[i], 0, NULL); JUT_ASSERT(0, mpLifeTexture[i][0] != NULL); - mpLifeTexture[i][1] = new CPaneMgrAlpha(mpScreen, lifet2_tag[i], 0, NULL); + mpLifeTexture[i][1] = JKR_NEW CPaneMgrAlpha(mpScreen, lifet2_tag[i], 0, NULL); JUT_ASSERT(0, mpLifeTexture[i][1] != NULL); } - mpBigHeart = new CPaneMgr(mpScreen, MULTI_CHAR('bigh_n'), 2, NULL); + mpBigHeart = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('bigh_n'), 2, NULL); JUT_ASSERT(0, mpBigHeart != NULL); mpLifeParent->setAlphaRate(0.0f); @@ -791,20 +791,20 @@ void dMeter2Draw_c::initMagic() { field_0x550 = 0.0f; field_0x554 = 0.0f; - mpMagicParent = new CPaneMgr(mpKanteraScreen, MULTI_CHAR('magic_n'), 2, NULL); + mpMagicParent = JKR_NEW CPaneMgr(mpKanteraScreen, MULTI_CHAR('magic_n'), 2, NULL); JUT_ASSERT(0, mpMagicParent != NULL); - mpMagicBase = new CPaneMgr(mpKanteraScreen, MULTI_CHAR('mm_base'), 0, NULL); + mpMagicBase = JKR_NEW CPaneMgr(mpKanteraScreen, MULTI_CHAR('mm_base'), 0, NULL); JUT_ASSERT(0, mpMagicBase != NULL); - mpMagicFrameL = new CPaneMgr(mpKanteraScreen, MULTI_CHAR('m_w_l_n'), 2, NULL); + mpMagicFrameL = JKR_NEW CPaneMgr(mpKanteraScreen, MULTI_CHAR('m_w_l_n'), 2, NULL); JUT_ASSERT(0, mpMagicFrameL != NULL); mpMagicFrameR = - new CPaneMgr(mpKanteraScreen, MULTI_CHAR('m_w_r_n'), 2, NULL); + JKR_NEW CPaneMgr(mpKanteraScreen, MULTI_CHAR('m_w_r_n'), 2, NULL); JUT_ASSERT(0, mpMagicFrameR != NULL); - mpMagicMeter = new CPaneMgr(mpKanteraScreen, MULTI_CHAR('mm_00'), 0, NULL); + mpMagicMeter = JKR_NEW CPaneMgr(mpKanteraScreen, MULTI_CHAR('mm_00'), 0, NULL); JUT_ASSERT(0, mpMagicMeter != NULL); OSInitFastCast(); @@ -851,7 +851,7 @@ void dMeter2Draw_c::initMagic() { } void dMeter2Draw_c::initLightDrop() { - mpLightDropParent = new CPaneMgr(mpScreen, MULTI_CHAR('s_tuta_n'), 2, NULL); + mpLightDropParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('s_tuta_n'), 2, NULL); JUT_ASSERT(0, mpLightDropParent != NULL); static u64 const tuta_0[] = { @@ -870,20 +870,20 @@ void dMeter2Draw_c::initLightDrop() { }; for (int i = 0; i < 16; i++) { - mpSIParts[i][0] = new CPaneMgr(mpScreen, tuta_0[i], 0, NULL); + mpSIParts[i][0] = JKR_NEW CPaneMgr(mpScreen, tuta_0[i], 0, NULL); JUT_ASSERT(0, mpSIParts[i][0] != NULL); - mpSIParts[i][1] = new CPaneMgr(mpScreen, tuta_1[i], 0, NULL); + mpSIParts[i][1] = JKR_NEW CPaneMgr(mpScreen, tuta_1[i], 0, NULL); JUT_ASSERT(0, mpSIParts[i][1] != NULL); - mpSIParts[i][2] = new CPaneMgr(mpScreen, tuta_2[i], 0, NULL); + mpSIParts[i][2] = JKR_NEW CPaneMgr(mpScreen, tuta_2[i], 0, NULL); JUT_ASSERT(0, mpSIParts[i][2] != NULL); } - mpSIParent[0] = new CPaneMgr(mpScreen, MULTI_CHAR('tuta_n'), 2, NULL); + mpSIParent[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('tuta_n'), 2, NULL); JUT_ASSERT(0, mpSIParent[0] != NULL); - mpSIParent[1] = new CPaneMgr(mpScreen, MULTI_CHAR('s_null'), 2, NULL); + mpSIParent[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('s_null'), 2, NULL); JUT_ASSERT(0, mpSIParent[1] != NULL); mpLightDropParent->setAlphaRate(0.0f); @@ -907,7 +907,7 @@ void dMeter2Draw_c::initLightDrop() { } void dMeter2Draw_c::initRupeeKey() { - mpRupeeKeyParent = new CPaneMgr(mpScreen, MULTI_CHAR('r_k_n'), 2, NULL); + mpRupeeKeyParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('r_k_n'), 2, NULL); JUT_ASSERT(0, mpRupeeKeyParent != NULL); field_0x718 = 1.0f; @@ -915,22 +915,22 @@ void dMeter2Draw_c::initRupeeKey() { static u64 const rupeet2_tag[] = {MULTI_CHAR('r_n_1'), MULTI_CHAR('r_n_2'), MULTI_CHAR('r_n_3'), MULTI_CHAR('r_n_4')}; for (int i = 0; i < 4; i++) { - mpRupeeTexture[i][0] = new CPaneMgr(mpScreen, rupeet1_tag[i], 0, NULL); + mpRupeeTexture[i][0] = JKR_NEW CPaneMgr(mpScreen, rupeet1_tag[i], 0, NULL); JUT_ASSERT(0, mpRupeeTexture[i][0] != NULL); mpRupeeTexture[i][0]->getPanePtr()->setBasePosition(J2DBasePosition_4); - mpRupeeTexture[i][1] = new CPaneMgr(mpScreen, rupeet2_tag[i], 0, NULL); + mpRupeeTexture[i][1] = JKR_NEW CPaneMgr(mpScreen, rupeet2_tag[i], 0, NULL); JUT_ASSERT(0, mpRupeeTexture[i][1] != NULL); mpRupeeTexture[i][1]->getPanePtr()->setBasePosition(J2DBasePosition_4); } - mpRupeeParent[0] = new CPaneMgr(mpScreen, MULTI_CHAR('rupi_n'), 2, NULL); + mpRupeeParent[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('rupi_n'), 2, NULL); JUT_ASSERT(0, mpRupeeParent[0] != NULL); - mpRupeeParent[1] = new CPaneMgr(mpScreen, MULTI_CHAR('moyou_rn'), 2, NULL); + mpRupeeParent[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('moyou_rn'), 2, NULL); JUT_ASSERT(0, mpRupeeParent[1] != NULL); - mpRupeeParent[2] = new CPaneMgr(mpScreen, MULTI_CHAR('moyou_ln'), 2, NULL); + mpRupeeParent[2] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('moyou_ln'), 2, NULL); JUT_ASSERT(0, mpRupeeParent[2] != NULL); mpRupeeParent[0]->setAlphaRate(0.0f); @@ -940,13 +940,13 @@ void dMeter2Draw_c::initRupeeKey() { static u64 const key_tag[] = {MULTI_CHAR('key_nul'), MULTI_CHAR('k_n_1_n'), MULTI_CHAR('k_n_2_n'), MULTI_CHAR('k_n_3_n'), MULTI_CHAR('k_n_4_n')}; for (int i = 0; i < 5; i++) { - mpKeyTexture[i] = new CPaneMgr(mpScreen, key_tag[i], 0, NULL); + mpKeyTexture[i] = JKR_NEW CPaneMgr(mpScreen, key_tag[i], 0, NULL); JUT_ASSERT(0, mpKeyTexture[i] != NULL); mpKeyTexture[i]->getPanePtr()->setBasePosition(J2DBasePosition_4); mpKeyTexture[i]->hide(); } - mpKeyParent = new CPaneMgr(mpScreen, MULTI_CHAR('key_n'), 2, NULL); + mpKeyParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('key_n'), 2, NULL); JUT_ASSERT(0, mpKeyParent != NULL); mpKeyParent->setAlphaRate(0.0f); @@ -988,7 +988,7 @@ void dMeter2Draw_c::initButton() { } } - mpItemB = new CPaneMgr(mpScreen, MULTI_CHAR('b_itm_p'), 0, NULL); + mpItemB = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_itm_p'), 0, NULL); JUT_ASSERT(0, mpItemB != NULL); mpItemB->getPanePtr()->setBasePosition(J2DBasePosition_4); mpItemB->show(); @@ -1002,7 +1002,7 @@ void dMeter2Draw_c::initButton() { field_0x770 = 0xFF; field_0x771 = dComIfGs_getBButtonItemKey(); - mpItemBPane = new J2DPicture( + mpItemBPane = JKR_NEW J2DPicture( MULTI_CHAR('b_itm_pp'), JGeometry::TBox2(0.0f, 0.0f, mpItemB->getInitSizeX(), mpItemB->getInitSizeY()), static_cast(mpItemB->getPanePtr())->getTexture(0)->getTexInfo(), NULL); @@ -1010,12 +1010,12 @@ void dMeter2Draw_c::initButton() { mpItemBPane->setBasePosition(J2DBasePosition_4); mpItemB->getPanePtr()->appendChild(mpItemBPane); - mpItemXY[0] = new CPaneMgr(mpScreen, MULTI_CHAR('x_itm_p'), 0, NULL); + mpItemXY[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('x_itm_p'), 0, NULL); JUT_ASSERT(0, mpItemXY[0] != NULL); mpItemXY[0]->getPanePtr()->setBasePosition(J2DBasePosition_4); dMeter2Info_setMeterItemPanePtr(0, mpItemXY[0]); - mpItemXY[1] = new CPaneMgr(mpScreen, MULTI_CHAR('y_itm_p'), 0, NULL); + mpItemXY[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('y_itm_p'), 0, NULL); JUT_ASSERT(0, mpItemXY[1] != NULL); mpItemXY[1]->getPanePtr()->setBasePosition(J2DBasePosition_4); dMeter2Info_setMeterItemPanePtr(1, mpItemXY[1]); @@ -1023,7 +1023,7 @@ void dMeter2Draw_c::initButton() { mpItemR = NULL; mpBTextA = NULL; - mpItemXYPane[0] = new J2DPicture( + mpItemXYPane[0] = JKR_NEW J2DPicture( MULTI_CHAR('x_itm_pp'), JGeometry::TBox2(0.0f, 0.0f, mpItemXY[0]->getInitSizeX(), mpItemXY[0]->getInitSizeY()), static_cast(mpItemXY[0]->getPanePtr())->getTexture(0)->getTexInfo(), NULL); @@ -1031,7 +1031,7 @@ void dMeter2Draw_c::initButton() { mpItemXYPane[0]->setBasePosition(J2DBasePosition_4); mpItemXY[0]->getPanePtr()->appendChild(mpItemXYPane[0]); - mpItemXYPane[1] = new J2DPicture( + mpItemXYPane[1] = JKR_NEW J2DPicture( MULTI_CHAR('y_itm_pp'), JGeometry::TBox2(0.0f, 0.0f, mpItemXY[1]->getInitSizeX(), mpItemXY[1]->getInitSizeY()), static_cast(mpItemXY[1]->getPanePtr())->getTexture(0)->getTexInfo(), NULL); @@ -1039,12 +1039,12 @@ void dMeter2Draw_c::initButton() { mpItemXYPane[1]->setBasePosition(J2DBasePosition_4); mpItemXY[1]->getPanePtr()->appendChild(mpItemXYPane[1]); - mpItemR = new CPaneMgr(mpScreen, MULTI_CHAR('r_itm_p'), 0, NULL); + mpItemR = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('r_itm_p'), 0, NULL); JUT_ASSERT(0, mpItemR != NULL); mpItemR->getPanePtr()->setBasePosition(J2DBasePosition_4); dMeter2Info_setMeterItemPanePtr(2, mpItemR); - mpItemXYPane[2] = new J2DPicture( + mpItemXYPane[2] = JKR_NEW J2DPicture( MULTI_CHAR('r_itm_pp'), JGeometry::TBox2(0.0f, 0.0f, mpItemR->getInitSizeX(), mpItemR->getInitSizeY()), static_cast(mpItemR->getPanePtr())->getTexture(0)->getTexInfo(), NULL); @@ -1052,60 +1052,60 @@ void dMeter2Draw_c::initButton() { mpItemXYPane[2]->setBasePosition(J2DBasePosition_4); mpItemR->getPanePtr()->appendChild(mpItemXYPane[2]); - mpLightB = new CPaneMgr(mpScreen, MULTI_CHAR('b_light'), 0, NULL); + mpLightB = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_light'), 0, NULL); JUT_ASSERT(0, mpLightB != NULL); mpLightB->getPanePtr()->setBasePosition(J2DBasePosition_4); field_0x72c = 1.0f; mpLightB->hide(); - mpLightXY[0] = new CPaneMgr(mpScreen, MULTI_CHAR('x_light'), 0, NULL); + mpLightXY[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('x_light'), 0, NULL); JUT_ASSERT(0, mpLightXY[0] != NULL); mpLightXY[0]->getPanePtr()->setBasePosition(J2DBasePosition_4); mpLightXY[0]->hide(); - mpLightXY[1] = new CPaneMgr(mpScreen, MULTI_CHAR('y_light'), 0, NULL); + mpLightXY[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('y_light'), 0, NULL); JUT_ASSERT(0, mpLightXY[1] != NULL); mpLightXY[1]->getPanePtr()->setBasePosition(J2DBasePosition_4); mpLightXY[1]->hide(); - mpLightXY[2] = new CPaneMgr(mpScreen, MULTI_CHAR('r_light'), 0, NULL); + mpLightXY[2] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('r_light'), 0, NULL); JUT_ASSERT(0, mpLightXY[2] != NULL); mpLightXY[2]->getPanePtr()->setBasePosition(J2DBasePosition_4); mpLightXY[2]->hide(); - mpBTextA = new CPaneMgr(mpScreen, MULTI_CHAR('b_text_a'), 0, NULL); + mpBTextA = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_text_a'), 0, NULL); JUT_ASSERT(0, mpBTextA != NULL); - mpBTextB = new CPaneMgr(mpScreen, MULTI_CHAR('b_text_b'), 0, NULL); + mpBTextB = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_text_b'), 0, NULL); JUT_ASSERT(0, mpBTextB != NULL); - mpBTextXY[0] = new CPaneMgr(mpScreen, MULTI_CHAR('b_text_x'), 0, NULL); + mpBTextXY[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_text_x'), 0, NULL); JUT_ASSERT(0, mpBTextXY[0] != NULL); - mpBTextXY[1] = new CPaneMgr(mpScreen, MULTI_CHAR('b_text_y'), 0, NULL); + mpBTextXY[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_text_y'), 0, NULL); JUT_ASSERT(0, mpBTextXY[1] != NULL); mpBTextXY[2] = NULL; - mpTextA = new CPaneMgr(mpScreen, MULTI_CHAR('a_text_n'), 0, NULL); + mpTextA = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('a_text_n'), 0, NULL); JUT_ASSERT(0, mpTextA != NULL); - mpTextB = new CPaneMgr(mpScreen, MULTI_CHAR('b_text_n'), 0, NULL); + mpTextB = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_text_n'), 0, NULL); JUT_ASSERT(0, mpTextB != NULL); - mpTextXY[2] = new CPaneMgr(mpScreen, MULTI_CHAR('z_text_n'), 0, NULL); + mpTextXY[2] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('z_text_n'), 0, NULL); JUT_ASSERT(0, mpTextXY[2] != NULL); - mpTextXY[0] = new CPaneMgr(mpScreen, MULTI_CHAR('x_text_n'), 0, NULL); + mpTextXY[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('x_text_n'), 0, NULL); JUT_ASSERT(0, mpTextXY[0] != NULL); - mpTextXY[1] = new CPaneMgr(mpScreen, MULTI_CHAR('y_text_n'), 0, NULL); + mpTextXY[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('y_text_n'), 0, NULL); JUT_ASSERT(0, mpTextXY[1] != NULL); - mpTextI = new CPaneMgr(mpScreen, MULTI_CHAR('i_text_n'), 2, NULL); + mpTextI = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('i_text_n'), 2, NULL); JUT_ASSERT(0, mpTextI != NULL); - mpTextM = new CPaneMgr(mpScreen, MULTI_CHAR('m_text_n'), 2, NULL); + mpTextM = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('m_text_n'), 2, NULL); JUT_ASSERT(0, mpTextM != NULL); static u64 const juji_i_tag[] = {MULTI_CHAR('ju_ring4'), MULTI_CHAR('yaji_00'), MULTI_CHAR('yaji_01'), MULTI_CHAR('ju_ring2'), MULTI_CHAR('ju_ring4')}; @@ -1113,14 +1113,14 @@ void dMeter2Draw_c::initButton() { for (int i = 0; i < 5; i++) { if (juji_i_tag[i] != 0) { - mpJujiI[i] = new CPaneMgr(mpScreen, juji_i_tag[i], 0, NULL); + mpJujiI[i] = JKR_NEW CPaneMgr(mpScreen, juji_i_tag[i], 0, NULL); JUT_ASSERT(0, mpJujiI[i] != NULL); } else { mpJujiI[i] = NULL; } if (juji_m_tag[i] != 0) { - mpJujiM[i] = new CPaneMgr(mpScreen, juji_m_tag[i], 0, NULL); + mpJujiM[i] = JKR_NEW CPaneMgr(mpScreen, juji_m_tag[i], 0, NULL); JUT_ASSERT(0, mpJujiM[i] != NULL); } else { mpJujiM[i] = NULL; @@ -1130,40 +1130,40 @@ void dMeter2Draw_c::initButton() { mpTextXY[0]->hide(); mpTextXY[1]->hide(); - mpButtonParent = new CPaneMgr(mpScreen, MULTI_CHAR('cont_n'), 2, NULL); + mpButtonParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('cont_n'), 2, NULL); JUT_ASSERT(0, mpButtonParent != NULL); - mpButtonA = new CPaneMgr(mpScreen, MULTI_CHAR('abtn_n'), 2, NULL); + mpButtonA = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('abtn_n'), 2, NULL); JUT_ASSERT(0, mpButtonA != NULL); - mpButtonB = new CPaneMgr(mpScreen, MULTI_CHAR('bbtn_n'), 2, NULL); + mpButtonB = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('bbtn_n'), 2, NULL); JUT_ASSERT(0, mpButtonB != NULL); field_0x730 = 1.0f; - mpButtonMidona = new CPaneMgr(mpScreen, MULTI_CHAR('midona_n'), 2, NULL); + mpButtonMidona = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('midona_n'), 2, NULL); JUT_ASSERT(0, mpButtonMidona != NULL); mButtonZAlpha = 0.0f; field_0x724 = 0.0f; field_0x738 = 0.0f; field_0x740 = 0; - mpButtonXY[0] = new CPaneMgr(mpScreen, MULTI_CHAR('xbtn_n'), 2, NULL); + mpButtonXY[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('xbtn_n'), 2, NULL); JUT_ASSERT(0, mpButtonXY[0] != NULL); - mpButtonXY[1] = new CPaneMgr(mpScreen, MULTI_CHAR('ybtn_n'), 2, NULL); + mpButtonXY[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('ybtn_n'), 2, NULL); JUT_ASSERT(0, mpButtonXY[1] != NULL); - mpButtonXY[2] = new CPaneMgr(mpScreen, MULTI_CHAR('zbtn_n'), 2, NULL); + mpButtonXY[2] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('zbtn_n'), 2, NULL); JUT_ASSERT(0, mpButtonXY[2] != NULL); - mpUzu = new CPaneMgrAlpha(mpScreen, MULTI_CHAR('uzu_n'), 2, NULL); + mpUzu = JKR_NEW CPaneMgrAlpha(mpScreen, MULTI_CHAR('uzu_n'), 2, NULL); JUT_ASSERT(0, mpUzu != NULL); ResTIMG* timg = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource( 'TIMG', dMeter2Info_getNumberTextureName(0)); for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { - mpItemNumTex[i][j] = new J2DPicture(timg); + mpItemNumTex[i][j] = JKR_NEW J2DPicture(timg); JUT_ASSERT(0, mpItemNumTex[i][j] != NULL); } } @@ -1208,7 +1208,7 @@ void dMeter2Draw_c::initButton() { } void dMeter2Draw_c::initButtonCross() { - mpButtonCrossParent = new CPaneMgr(mpScreen, MULTI_CHAR('juji_n'), 2, NULL); + mpButtonCrossParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('juji_n'), 2, NULL); JUT_ASSERT(0, mpButtonCrossParent != NULL); static_cast(mpScreen->search(MULTI_CHAR('cont_ju0')))->setFont(mDoExt_getMesgFont()); diff --git a/src/d/d_meter_HIO.cpp b/src/d/d_meter_HIO.cpp index 73fe999993..90d5f98192 100644 --- a/src/d/d_meter_HIO.cpp +++ b/src/d/d_meter_HIO.cpp @@ -3499,11 +3499,11 @@ BOOL subJOREventCallbackListNode::JORAct(u32 param_1, const char* param_2) { file.close(); if (g_fmapHIO.mpArcData) { JKRUnmountArchive(g_fmapHIO.mpArcData); - delete g_fmapHIO.mpArcData; + JKR_DELETE(g_fmapHIO.mpArcData); g_fmapHIO.mpArcData = NULL; } JKRDecompress((u8*)g_fmapHIO.mpArcFile, (u8*)g_fmapHIO.mpDecompBuf, 0x46000, 0); - g_fmapHIO.mpArcData = new(mDoExt_getArchiveHeap(), 0) JKRMemArchive(g_fmapHIO.mpDecompBuf, 0x46000, JKRMEMBREAK_FLAG_UNKNOWN0); + g_fmapHIO.mpArcData = JKR_NEW_ARGS(mDoExt_getArchiveHeap(), 0) JKRMemArchive(g_fmapHIO.mpDecompBuf, 0x46000, JKRMEMBREAK_FLAG_UNKNOWN0); JUT_ASSERT(6413, g_fmapHIO.mpArcData != NULL); if (dComIfGp_isHeapLockFlag() == 2) { g_fmapHIO.field_0x2f9 = true; @@ -3952,13 +3952,13 @@ dMeter_fmapHIO_c::~dMeter_fmapHIO_c() { if (mpArcData != NULL) { JKRUnmountArchive(mpArcData); - delete mpArcData; + JKR_DELETE(mpArcData); mpArcData = NULL; } #if DEBUG if (mpEvtCallBack != NULL) { - delete mpEvtCallBack; + JKR_DELETE(mpEvtCallBack); mpEvtCallBack = NULL; } #endif @@ -4195,11 +4195,11 @@ void dMeter_fmapHIO_c::listenPropertyEvent(const JORPropertyEvent* property) { file.close(); if (mpArcData) { JKRUnmountArchive(mpArcData); - delete mpArcData; + JKR_DELETE(mpArcData); mpArcData = NULL; } JKRDecompress((u8*)mpArcFile, (u8*)mpDecompBuf, 0x46000, 0); - mpArcData = new(mDoExt_getArchiveHeap(), 0) JKRMemArchive(mpDecompBuf, 0x46000, JKRMEMBREAK_FLAG_UNKNOWN0); + mpArcData = JKR_NEW_ARGS(mDoExt_getArchiveHeap(), 0) JKRMemArchive(mpDecompBuf, 0x46000, JKRMEMBREAK_FLAG_UNKNOWN0); JUT_ASSERT(7429, mpArcData != NULL); if (dComIfGp_isHeapLockFlag() == 2) { field_0x2f9 = true; @@ -4222,13 +4222,13 @@ void dMeter_fmapHIO_c::createEvtCallBackObject() { if (mpEvtCallBack) { return; } - mpEvtCallBack = new subJOREventCallbackListNode(); + mpEvtCallBack = JKR_NEW subJOREventCallbackListNode(); JUT_ASSERT(7460, mpEvtCallBack != NULL) } void dMeter_fmapHIO_c::deleteEvtCallBackObject() { if (mpEvtCallBack) { - delete mpEvtCallBack; + JKR_DELETE(mpEvtCallBack); mpEvtCallBack = NULL; } } diff --git a/src/d/d_meter_button.cpp b/src/d/d_meter_button.cpp index 21f027c11d..22d6e6b830 100644 --- a/src/d/d_meter_button.cpp +++ b/src/d/d_meter_button.cpp @@ -439,171 +439,171 @@ int dMeterButton_c::_delete() { mpHeap->free(mpFishingTex); mpFishingTex = NULL; - delete mpButtonScreen; + JKR_DELETE(mpButtonScreen); mpButtonScreen = NULL; if (field_0x00c != NULL) { - delete field_0x00c; + JKR_DELETE(field_0x00c); field_0x00c = NULL; } - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; - delete mpButtonA; + JKR_DELETE(mpButtonA); mpButtonA = NULL; - delete mpButtonB; + JKR_DELETE(mpButtonB); mpButtonB = NULL; if (mpButtonR != NULL) { - delete mpButtonR; + JKR_DELETE(mpButtonR); mpButtonR = NULL; } if (mpButtonZ != NULL) { - delete mpButtonZ; + JKR_DELETE(mpButtonZ); mpButtonZ = NULL; } if (mpMidona != NULL) { - delete mpMidona; + JKR_DELETE(mpMidona); mpMidona = NULL; } for (int i = 0; i < 4; i++) { if (field_0x0fc[i] != NULL) { - delete field_0x0fc[i]; + JKR_DELETE(field_0x0fc[i]); field_0x0fc[i] = NULL; } } - delete mpButton3D; + JKR_DELETE(mpButton3D); mpButton3D = NULL; - delete mpButtonC; + JKR_DELETE(mpButtonC); mpButtonC = NULL; - delete mpButtonS; + JKR_DELETE(mpButtonS); mpButtonS = NULL; if (mpButtonX != NULL) { - delete mpButtonX; + JKR_DELETE(mpButtonX); mpButtonX = NULL; } if (mpButtonY != NULL) { - delete mpButtonY; + JKR_DELETE(mpButtonY); mpButtonY = NULL; } if (mpButtonNun != NULL) { - delete mpButtonNun; + JKR_DELETE(mpButtonNun); mpButtonNun = NULL; } if (mpButtonRemo != NULL) { - delete mpButtonRemo; + JKR_DELETE(mpButtonRemo); mpButtonRemo = NULL; } if (mpButtonRemo2 != NULL) { - delete mpButtonRemo2; + JKR_DELETE(mpButtonRemo2); mpButtonRemo2 = NULL; } if (mpButtonAR != NULL) { - delete mpButtonAR; + JKR_DELETE(mpButtonAR); mpButtonAR = NULL; } if (mpButton3DB != NULL) { - delete mpButton3DB; + JKR_DELETE(mpButton3DB); mpButton3DB = NULL; } if (mpButtonNURE != NULL) { - delete mpButtonNURE; + JKR_DELETE(mpButtonNURE); mpButtonNURE = NULL; } if (mpButtonReel != NULL) { - delete mpButtonReel; + JKR_DELETE(mpButtonReel); mpButtonReel = NULL; } if (mpButtonReel2 != NULL) { - delete mpButtonReel2; + JKR_DELETE(mpButtonReel2); mpButtonReel2 = NULL; } if (mpButtonAB != NULL) { - delete mpButtonAB; + JKR_DELETE(mpButtonAB); mpButtonAB = NULL; } if (mpButtonTate != NULL) { - delete mpButtonTate; + JKR_DELETE(mpButtonTate); mpButtonTate = NULL; } if (mpButtonNunZ != NULL) { - delete mpButtonNunZ; + JKR_DELETE(mpButtonNunZ); mpButtonNunZ = NULL; } if (mpButtonNunC != NULL) { - delete mpButtonNunC; + JKR_DELETE(mpButtonNunC); mpButtonNunC = NULL; } if (mpButtonBin != NULL) { - delete mpButtonBin; + JKR_DELETE(mpButtonBin); mpButtonBin = NULL; } for (int i = 0; i < 2; i++) { - delete mpText[i]; + JKR_DELETE(mpText[i]); mpText[i] = NULL; } - delete mpItem_c; + JKR_DELETE(mpItem_c); mpItem_c = NULL; if (field_0x080 != NULL) { - delete field_0x080; + JKR_DELETE(field_0x080); field_0x080 = NULL; } - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpFkAll_c; + JKR_DELETE(mpFkAll_c); mpFkAll_c = NULL; - delete mpFkRoot_c; + JKR_DELETE(mpFkRoot_c); mpFkRoot_c = NULL; - delete mpTextScreen; + JKR_DELETE(mpTextScreen); mpTextScreen = NULL; - delete mpTmRoot_c; + JKR_DELETE(mpTmRoot_c); mpTmRoot_c = NULL; for (int i = 0; i < 2; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; if (field_0x0ec[i] != NULL) { - delete field_0x0ec[i]; + JKR_DELETE(field_0x0ec[i]); field_0x0ec[i] = NULL; } } - delete mpString_c; + JKR_DELETE(mpString_c); mpString_c = NULL; - delete mpOutFont; + JKR_DELETE(mpOutFont); mpOutFont = NULL; dComIfGp_getMeterButtonArchive()->removeResourceAll(); @@ -998,7 +998,7 @@ void dMeterButton_c::screenInitButton() { OS_REPORT("enter dMeterButton_c::screenInitButton\n"); - mpButtonScreen = new J2DScreen(); + mpButtonScreen = JKR_NEW J2DScreen(); JUT_ASSERT(1830, mpButtonScreen != NULL); OS_REPORT("load zelda_game_image_button_info.blo"); @@ -1013,7 +1013,7 @@ void dMeterButton_c::screenInitButton() { dPaneClass_showNullPane(mpButtonScreen); field_0x00c = NULL; - mpParent = new CPaneMgr(mpButtonScreen, MULTI_CHAR('info_n'), 0, NULL); + mpParent = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('info_n'), 0, NULL); if (mpParent == NULL) OS_REPORT("[%s] %d\n", __FILE__, 1867); JUT_ASSERT(1868, mpParent != NULL); @@ -1038,7 +1038,7 @@ void dMeterButton_c::screenInitButton() { mParentCenterX = (608.0f / 2) - mpParent->getInitCenterPosX(); paneTrans(mpParent, mParentCenterX, 0.0f, 0xFF); - mpButtonA = new CPaneMgr(mpButtonScreen, MULTI_CHAR('abtn_n'), 2, NULL); + mpButtonA = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('abtn_n'), 2, NULL); if (mpButtonA == NULL) { OS_REPORT("[%s] %d\n", __FILE__, 1902); } @@ -1046,7 +1046,7 @@ void dMeterButton_c::screenInitButton() { mpButtonA->setAlphaRate(0.0f); mpButtonA->show(); - mpButtonB = new CPaneMgr(mpButtonScreen, MULTI_CHAR('bbtn_n'), 2, NULL); + mpButtonB = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('bbtn_n'), 2, NULL); if (mpButtonB == NULL) { OS_REPORT("[%s] %d\n", __FILE__, 1914); } @@ -1054,7 +1054,7 @@ void dMeterButton_c::screenInitButton() { mpButtonB->setAlphaRate(0.0f); mpButtonB->show(); - mpButtonR = new CPaneMgr(mpButtonScreen, MULTI_CHAR('rbtn_n'), 2, NULL); + mpButtonR = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('rbtn_n'), 2, NULL); if (mpButtonR == NULL) { OS_REPORT("[%s] %d\n", __FILE__, 1932); } @@ -1062,7 +1062,7 @@ void dMeterButton_c::screenInitButton() { mpButtonR->setAlphaRate(0.0f); mpButtonR->show(); - mpMidona = new CPaneMgr(mpButtonScreen, MULTI_CHAR('midona'), 0, NULL); + mpMidona = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('midona'), 0, NULL); JUT_ASSERT(1939, mpMidona != NULL); if (mpMidona == NULL) { OS_REPORT("[%s] %d\n", __FILE__, 1941); @@ -1079,7 +1079,7 @@ void dMeterButton_c::screenInitButton() { mpButtonScreen->search('zbtn')->show(); mpButtonScreen->search(MULTI_CHAR('z_btnl'))->show(); - mpButtonZ = new CPaneMgr(mpButtonScreen, MULTI_CHAR('zbtn_n'), 2, NULL); + mpButtonZ = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('zbtn_n'), 2, NULL); if (mpButtonZ == NULL) { OS_REPORT("[%s] %d\n", __FILE__, 1954); } @@ -1087,7 +1087,7 @@ void dMeterButton_c::screenInitButton() { mpButtonZ->setAlphaRate(0.0f); mpButtonZ->show(); - mpButton3D = new CPaneMgr(mpButtonScreen, MULTI_CHAR('asbtn_n'), 2, NULL); + mpButton3D = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('asbtn_n'), 2, NULL); JUT_ASSERT(1964, mpButton3D != NULL); mpButton3D->setAlphaRate(0.0f); mpButton3D->show(); @@ -1097,7 +1097,7 @@ void dMeterButton_c::screenInitButton() { mpButtonScreen->search(MULTI_CHAR('yaji_d_n'))->hide(); mpButtonScreen->search(MULTI_CHAR('yaji_r_n'))->hide(); - mpButtonC = new CPaneMgr(mpButtonScreen, MULTI_CHAR('cbtn_n'), 2, NULL); + mpButtonC = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('cbtn_n'), 2, NULL); JUT_ASSERT(1992, mpButtonC != NULL); mpButtonC->setAlphaRate(0.0f); mpButtonC->show(); @@ -1107,15 +1107,15 @@ void dMeterButton_c::screenInitButton() { mpButtonScreen->search(MULTI_CHAR('yaji_dn'))->hide(); mpButtonScreen->search(MULTI_CHAR('yaji_rn'))->hide(); - mpButtonS = new CPaneMgr(mpButtonScreen, MULTI_CHAR('sbtn_n'), 2, NULL); + mpButtonS = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('sbtn_n'), 2, NULL); JUT_ASSERT(2002, mpButtonS != NULL); mpButtonS->setAlphaRate(0.0f); - mpButtonX = new CPaneMgr(mpButtonScreen, MULTI_CHAR('xbtn_n'), 2, NULL); + mpButtonX = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('xbtn_n'), 2, NULL); JUT_ASSERT(2048, mpButtonX != NULL); mpButtonX->setAlphaRate(0.0f); - mpButtonY = new CPaneMgr(mpButtonScreen, MULTI_CHAR('ybtn_n'), 2, NULL); + mpButtonY = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('ybtn_n'), 2, NULL); JUT_ASSERT(2052, mpButtonY != NULL); mpButtonY->setAlphaRate(0.0f); @@ -1124,7 +1124,7 @@ void dMeterButton_c::screenInitButton() { mpButtonRemo2 = NULL; mpButtonAR = NULL; - mpButton3DB = new CPaneMgr(mpButtonScreen, MULTI_CHAR('as_b_n'), 2, NULL); + mpButton3DB = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('as_b_n'), 2, NULL); JUT_ASSERT(2060, mpButton3DB != NULL); mpButton3DB->setAlphaRate(0.0f); @@ -1136,19 +1136,19 @@ void dMeterButton_c::screenInitButton() { mpButtonNunZ = NULL; mpButtonNunC = NULL; - mpButtonBin = new CPaneMgr(mpButtonScreen, MULTI_CHAR('bottl_n'), 2, NULL); + mpButtonBin = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('bottl_n'), 2, NULL); JUT_ASSERT(2071, mpButtonBin != NULL); mpButtonBin->setAlphaRate(0.0f); - mpText[0] = new CPaneMgr(mpButtonScreen, MULTI_CHAR('text_n'), 2, NULL); + mpText[0] = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('text_n'), 2, NULL); JUT_ASSERT(2075, mpText[0] != NULL); mpText[0]->setAlphaRate(0.0f); - mpText[1] = new CPaneMgr(mpButtonScreen, MULTI_CHAR('text2_n'), 2, NULL); + mpText[1] = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('text2_n'), 2, NULL); JUT_ASSERT(2079, mpText[1] != NULL); mpText[1]->setAlphaRate(0.0f); - mpItem_c = new CPaneMgr(mpButtonScreen, MULTI_CHAR('fishing'), 0, NULL); + mpItem_c = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('fishing'), 0, NULL); JUT_ASSERT(2083, mpItem_c != NULL); mpItem_c->setAlphaRate(0.0f); @@ -1395,7 +1395,7 @@ void dMeterButton_c::screenInitButton() { } void dMeterButton_c::screenInitText() { - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(2442, mpScreen != NULL); OS_REPORT("enter dMeterButton_c::screenInitText(void)\n"); @@ -1412,7 +1412,7 @@ void dMeterButton_c::screenInitText() { JUT_ASSERT(2457, fg != false); dPaneClass_showNullPane(mpScreen); - mpFkAll_c = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpFkAll_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); OS_REPORT("[%s] %d\n", __FILE__, 2461); JUT_ASSERT(2462, mpFkAll_c != NULL); mpFkAll_c->setAlphaRate(0.0f); @@ -1423,11 +1423,11 @@ void dMeterButton_c::screenInitText() { g_MsgObject_HIO_c.mTextPosY + mpScreen->search(MULTI_CHAR('mg_null'))->getBounds().i.y); OS_REPORT("[%s] %d\n", __FILE__, 2469); - mpFkRoot_c = new CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpFkRoot_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(2472, mpFkRoot_c != NULL); OS_REPORT("[%s] %d\n", __FILE__, 2474); - mpTextScreen = new J2DScreen(); + mpTextScreen = JKR_NEW J2DScreen(); JUT_ASSERT(2478, mpTextScreen != NULL); OS_REPORT("[%s] %d\n", __FILE__, 2480); @@ -1441,26 +1441,26 @@ void dMeterButton_c::screenInitText() { dPaneClass_showNullPane(mpTextScreen); OS_REPORT("[%s] %d\n", __FILE__, 2496); - mpTmRoot_c = new CPaneMgr(mpTextScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpTmRoot_c = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(2499, mpTmRoot_c != NULL); #if VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { - mpTm_c[0] = new CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3flin'), 0, NULL); - mpTm_c[1] = new CPaneMgr(mpTextScreen, MULTI_CHAR('t3f_s'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('t3f_s'), 0, NULL); - field_0x0ec[0] = new CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3f'), 0, NULL); + field_0x0ec[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3f'), 0, NULL); - field_0x0ec[1] = new CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + field_0x0ec[1] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); mpTextScreen->search(MULTI_CHAR('n_3line'))->hide(); mpTextScreen->search(MULTI_CHAR('n_3fline'))->show(); mpTextScreen->search(MULTI_CHAR('n_e4line'))->hide(); } else { - mpTm_c[0] = new CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_3line'), 0, NULL); - mpTm_c[1] = new CPaneMgr(mpTextScreen, 't3_s', 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTextScreen, 't3_s', 0, NULL); field_0x0ec[0] = NULL; field_0x0ec[1] = NULL; @@ -1471,10 +1471,10 @@ void dMeterButton_c::screenInitText() { mpTextScreen->search(MULTI_CHAR('n_e4line'))->hide(); } #else - mpTm_c[0] = new CPaneMgr(mpTextScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTextScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); JUT_ASSERT(2504, mpTm_c[0] != NULL); - mpTm_c[1] = new CPaneMgr(mpTextScreen, 't4_s', 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTextScreen, 't4_s', 0, NULL); JUT_ASSERT(2507, mpTm_c[1] != NULL); field_0x0ec[0] = NULL; @@ -1513,12 +1513,12 @@ void dMeterButton_c::screenInitText() { field_0x4b6 = 0; field_0x4b4 = 0; - mpString_c = new dMsgString_c(); + mpString_c = JKR_NEW dMsgString_c(); JUT_ASSERT(2572, mpString_c != NULL); OS_REPORT("[%s] %d\n", __FILE__, 2574); - mpOutFont = new COutFont_c(0); + mpOutFont = JKR_NEW COutFont_c(0); JUT_ASSERT(2577, mpOutFont != NULL); mpOutFont->createPane(); diff --git a/src/d/d_meter_haihai.cpp b/src/d/d_meter_haihai.cpp index 5e6c9fd3e7..e51e0b070e 100644 --- a/src/d/d_meter_haihai.cpp +++ b/src/d/d_meter_haihai.cpp @@ -22,7 +22,7 @@ dMeterHaihai_c::~dMeterHaihai_c() { } int dMeterHaihai_c::_create() { - mpHaihaiScreen = new J2DScreen(); + mpHaihaiScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpHaihaiScreen != NULL); bool fg = @@ -30,7 +30,7 @@ int dMeterHaihai_c::_create() { JUT_ASSERT(0, fg != false); dPaneClass_showNullPane(mpHaihaiScreen); - mpParent = new CPaneMgr(mpHaihaiScreen, MULTI_CHAR('n_all'), 2, NULL); + mpParent = JKR_NEW CPaneMgr(mpHaihaiScreen, MULTI_CHAR('n_all'), 2, NULL); JUT_ASSERT(0, mpParent != NULL); OSInitFastCast(); @@ -256,19 +256,19 @@ void dMeterHaihai_c::setScale(f32 i_scaleFactor) { } int dMeterHaihai_c::_delete() { - delete mpHaihaiScreen; + JKR_DELETE(mpHaihaiScreen); mpHaihaiScreen = NULL; - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; - delete mpCursorBck; + JKR_DELETE(mpCursorBck); mpCursorBck = NULL; - delete mpCursorBtk; + JKR_DELETE(mpCursorBtk); mpCursorBtk = NULL; - delete mpCursorBpk; + JKR_DELETE(mpCursorBpk); mpCursorBpk = NULL; return 1; } diff --git a/src/d/d_meter_hakusha.cpp b/src/d/d_meter_hakusha.cpp index 8c4c25d624..aa03e1755a 100644 --- a/src/d/d_meter_hakusha.cpp +++ b/src/d/d_meter_hakusha.cpp @@ -30,14 +30,14 @@ int dMeterHakusha_c::_create() { }; for (int i = 0; i < 6; i++) { - mpHakushaPos[i] = new CPaneMgr(field_0x004, haku_tag[i], 0, NULL); + mpHakushaPos[i] = JKR_NEW CPaneMgr(field_0x004, haku_tag[i], 0, NULL); JUT_ASSERT(0, mpHakushaPos[i] != NULL); } - mpHakushaParent = new CPaneMgr(field_0x004, MULTI_CHAR('hakunall'), 0, NULL); + mpHakushaParent = JKR_NEW CPaneMgr(field_0x004, MULTI_CHAR('hakunall'), 0, NULL); JUT_ASSERT(0, mpHakushaParent != NULL); - mpHakushaScreen = new J2DScreen(); + mpHakushaScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpHakushaScreen != NULL); bool fg = mpHakushaScreen->setPriority("zelda_game_image_hakusha_parts.blo", 0x20000, @@ -45,10 +45,10 @@ int dMeterHakusha_c::_create() { JUT_ASSERT(0, fg != false); dPaneClass_showNullPane(mpHakushaScreen); - mpHakushaOn = new CPaneMgr(mpHakushaScreen, MULTI_CHAR('haku_n'), 2, NULL); + mpHakushaOn = JKR_NEW CPaneMgr(mpHakushaScreen, MULTI_CHAR('haku_n'), 2, NULL); JUT_ASSERT(0, mpHakushaOn != NULL); - mpHakushaOff = new CPaneMgr(mpHakushaScreen, MULTI_CHAR('haku_b_n'), 2, NULL); + mpHakushaOff = JKR_NEW CPaneMgr(mpHakushaScreen, MULTI_CHAR('haku_b_n'), 2, NULL); JUT_ASSERT(0, mpHakushaOff != NULL); mpHakushaOn->setAlphaRate(0.0f); @@ -66,7 +66,7 @@ int dMeterHakusha_c::_create() { mHakushaNum = dMeter2Info_getHorseLifeCount(); - mpButtonScreen = new J2DScreen(); + mpButtonScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpButtonScreen != NULL); fg = mpButtonScreen->setPriority("zelda_game_image_hakusha_a_btn.blo", 0x20000, @@ -74,7 +74,7 @@ int dMeterHakusha_c::_create() { JUT_ASSERT(0, fg != false); dPaneClass_showNullPane(mpButtonScreen); - mpButtonA = new CPaneMgr(mpButtonScreen, MULTI_CHAR('abtn_n'), 2, NULL); + mpButtonA = JKR_NEW CPaneMgr(mpButtonScreen, MULTI_CHAR('abtn_n'), 2, NULL); JUT_ASSERT(0, mpButtonA != NULL); mpButtonA->show(); mpButtonA->setAlphaRate(0.0f); @@ -154,28 +154,28 @@ void dMeterHakusha_c::draw() { int dMeterHakusha_c::_delete() { for (int i = 0; i < 6; i++) { - delete mpHakushaPos[i]; + JKR_DELETE(mpHakushaPos[i]); mpHakushaPos[i] = NULL; } mpHakushaParent->paneTrans(0.0f, 0.0f); mpHakushaParent->scale(1.0f, 1.0f); - delete mpHakushaParent; + JKR_DELETE(mpHakushaParent); mpHakushaParent = NULL; - delete mpHakushaScreen; + JKR_DELETE(mpHakushaScreen); mpHakushaScreen = NULL; - delete mpHakushaOn; + JKR_DELETE(mpHakushaOn); mpHakushaOn = NULL; - delete mpHakushaOff; + JKR_DELETE(mpHakushaOff); mpHakushaOff = NULL; - delete mpButtonScreen; + JKR_DELETE(mpButtonScreen); mpButtonScreen = NULL; - delete mpButtonA; + JKR_DELETE(mpButtonA); mpButtonA = NULL; return 1; } diff --git a/src/d/d_meter_map.cpp b/src/d/d_meter_map.cpp index 79bffe0018..1e0f7e397d 100644 --- a/src/d/d_meter_map.cpp +++ b/src/d/d_meter_map.cpp @@ -444,10 +444,10 @@ void dMeterMap_c::_create(J2DScreen* unused) { mSizeW = (s16)sizeX; mSizeH = (s16)sizeY; - mMap = new dMap_c(sizeX, sizeY, dispSizeW, dispSizeH); + mMap = JKR_NEW dMap_c(sizeX, sizeY, dispSizeW, dispSizeH); JUT_ASSERT(999, mMap != NULL); - mMapJ2DPicture = new J2DPicture(mMap->getResTIMGPointer()); + mMapJ2DPicture = JKR_NEW J2DPicture(mMap->getResTIMGPointer()); JUT_ASSERT(1002, mMapJ2DPicture != NULL); mIsCompass = dComIfGs_isDungeonItemCompass(); @@ -498,11 +498,11 @@ void dMeterMap_c::setDispPosInSide() { void dMeterMap_c::_delete() { if (mMapJ2DPicture != NULL) { - delete mMapJ2DPicture; + JKR_DELETE(mMapJ2DPicture); } if (mMap != NULL) { - delete mMap; + JKR_DELETE(mMap); } if (isEnableDispMapAndMapDispSizeTypeNo()) { diff --git a/src/d/d_meter_string.cpp b/src/d/d_meter_string.cpp index 1f8ee5f1e1..ad95c53edd 100644 --- a/src/d/d_meter_string.cpp +++ b/src/d/d_meter_string.cpp @@ -47,7 +47,7 @@ int dMeterString_c::_create() { mpMapArchive = dComIfGp_getAllMapArchive(); } - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_game_image_cow_get_in.blo", 0x20000, mpMapArchive); @@ -58,13 +58,13 @@ int dMeterString_c::_create() { mpGetInBck = (J2DAnmTransformKey*)J2DAnmLoaderDataBase::load( JKRGetNameResource("zelda_game_image_cow_get_in.bck", mpMapArchive)); - mpParentPane = new CPaneMgr(mpScreen, MULTI_CHAR('get_in_n'), 2, NULL); + mpParentPane = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('get_in_n'), 2, NULL); JUT_ASSERT(0, mpParentPane != NULL); - mpRootPane = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 0, NULL); + mpRootPane = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 0, NULL); JUT_ASSERT(0, mpRootPane != NULL); - mpTextPane = new CPaneMgr(mpScreen, MULTI_CHAR('get_in'), 0, NULL); + mpTextPane = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('get_in'), 0, NULL); JUT_ASSERT(0, mpTextPane != NULL); static_cast(mpScreen->search(MULTI_CHAR('get_in_s')))->setFont(mDoExt_getMesgFont()); @@ -141,19 +141,19 @@ void dMeterString_c::draw() { } int dMeterString_c::_delete() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpGetInBck; + JKR_DELETE(mpGetInBck); mpGetInBck = NULL; - delete mpParentPane; + JKR_DELETE(mpParentPane); mpParentPane = NULL; - delete mpRootPane; + JKR_DELETE(mpRootPane); mpRootPane = NULL; - delete mpTextPane; + JKR_DELETE(mpTextPane); mpTextPane = NULL; if (field_0x28 != 0) { diff --git a/src/d/d_model.cpp b/src/d/d_model.cpp index 59562d9b15..41a054571f 100644 --- a/src/d/d_model.cpp +++ b/src/d/d_model.cpp @@ -6,9 +6,9 @@ #include "d/d_com_inf_game.h" void dMdl_c::draw() { - j3dSys.setVtxPos(mpModelData->getVtxPosArray()); - j3dSys.setVtxNrm(mpModelData->getVtxNrmArray()); - j3dSys.setVtxCol(mpModelData->getVtxColorArray(0)); + j3dSys.setVtxPos(mpModelData->getVtxPosArray(), mpModelData->getVtxNum()); + j3dSys.setVtxNrm(mpModelData->getVtxNrmArray(), mpModelData->getNrmNum()); + j3dSys.setVtxCol(mpModelData->getVtxColorArray(0), mpModelData->getColNum()); J3DShape::resetVcdVatCache(); J3DShape* shape = mpModelData->getMaterialNodePointer(mMaterialId)->getShape(); @@ -83,14 +83,14 @@ dMdl_c* dMdl_mng_c::entry(J3DModelData* i_modelData, u16 i_materialId, dKy_tevst dMdl_mng_c* dMdl_mng_c::m_myObj; void dMdl_mng_c::create() { - m_myObj = new dMdl_mng_c(); + m_myObj = JKR_NEW dMdl_mng_c(); } dMdl_c::~dMdl_c() {} void dMdl_mng_c::remove() { if (m_myObj != NULL) { - delete m_myObj; + JKR_DELETE(m_myObj); m_myObj = NULL; } } diff --git a/src/d/d_msg_class.cpp b/src/d/d_msg_class.cpp index 1c7edf2dd4..2a6f76c4a6 100644 --- a/src/d/d_msg_class.cpp +++ b/src/d/d_msg_class.cpp @@ -348,7 +348,7 @@ static u8 getPohNum() { } jmessage_tReference::jmessage_tReference() { - mpStick = new STControl(5, 2, 3, 2, 0.9f, 0.5f, 0, 0x2000); + mpStick = JKR_NEW STControl(5, 2, 3, 2, 0.9f, 0.5f, 0, 0x2000); JUT_ASSERT(518, mpStick != NULL); mpStick->setWaitParm(5, 2, 3, 2, 0.9f, 0.5f, 0, 0x800); @@ -410,7 +410,7 @@ jmessage_tReference::jmessage_tReference() { } jmessage_tReference::~jmessage_tReference() { - delete mpStick; + JKR_DELETE(mpStick); mpStick = NULL; } diff --git a/src/d/d_msg_object.cpp b/src/d/d_msg_object.cpp index aa2a6957aa..32c0b807ef 100644 --- a/src/d/d_msg_object.cpp +++ b/src/d/d_msg_object.cpp @@ -348,22 +348,22 @@ int dMsgObject_c::_create(msg_class* param_1) { changeGroup(0); mpOutFont = NULL; mpScrnDraw = NULL; - mpResCont = new JMessage::TResourceContainer(); + mpResCont = JKR_NEW JMessage::TResourceContainer(); JUT_ASSERT(1299, mpResCont != NULL); mpCtrl = dDemo_c::getMesgControl(); JUT_ASSERT(1302, mpCtrl != NULL); - mpRefer = new jmessage_tReference(); + mpRefer = JKR_NEW jmessage_tReference(); JUT_ASSERT(1305, mpRefer != NULL); mpRefer->setpStatus(¶m_1->mode); - mpSeqProc = new jmessage_tSequenceProcessor(mpRefer, mpCtrl); + mpSeqProc = JKR_NEW jmessage_tSequenceProcessor(mpRefer, mpCtrl); JUT_ASSERT(1310, mpSeqProc != NULL); - mpRenProc = new jmessage_tRenderingProcessor(mpRefer); + mpRenProc = JKR_NEW jmessage_tRenderingProcessor(mpRefer); JUT_ASSERT(1313, mpRenProc != NULL); mpRefer->setResourceContainer(mpResCont); mpCtrl->setSequenceProcessor(mpSeqProc); mpCtrl->setRenderingProcessor(mpRenProc); mpRefer->setObjectPtr(this); - field_0x124 = new JMessage::TParse(mpResCont); + field_0x124 = JKR_NEW JMessage::TParse(mpResCont); field_0x124->parse(mpMsgDt, 0); mpCtrl->reset(); mpCtrl->resetResourceCache(); @@ -396,7 +396,7 @@ int dMsgObject_c::_create(msg_class* param_1) { field_0x15c = 0; field_0x172 = 0; setStatusLocal(1); - mpMsgString = new dMsgString_c(); + mpMsgString = JKR_NEW dMsgString_c(); JUT_ASSERT(1366, mpMsgString != NULL); return 4; } @@ -551,27 +551,27 @@ int dMsgObject_c::_draw() { int dMsgObject_c::_delete() { mpResCont->destroyResource_all(); if (mpScrnDraw != NULL) { - delete mpScrnDraw; + JKR_DELETE(mpScrnDraw); mpScrnDraw = 0; } mpMsgDt = 0; mpMsgRes = 0; field_0x12c = 0; if (mpOutFont != NULL) { - delete mpOutFont; + JKR_DELETE(mpOutFont); mpOutFont = NULL; } - delete mpResCont; + JKR_DELETE(mpResCont); mpResCont = NULL; - delete mpRefer; + JKR_DELETE(mpRefer); mpRefer = NULL; - delete mpSeqProc; + JKR_DELETE(mpSeqProc); mpSeqProc = NULL; - delete mpRenProc; + JKR_DELETE(mpRenProc); mpRenProc = NULL; - delete field_0x124; + JKR_DELETE(field_0x124); field_0x124 = NULL; - delete mpMsgString; + JKR_DELETE(mpMsgString); mpMsgString = NULL; if (mpTalkHeap != NULL) { mpTalkHeap = NULL; @@ -1336,7 +1336,7 @@ void dMsgObject_c::talkStartInit() { bool local_98 = false; if (mpOutFont == NULL) { OS_REPORT("free size (0x%x)=====> %d\n", mDoExt_getCurrentHeap(), mDoExt_getCurrentHeap()->getTotalFreeSize()); - mpOutFont = new COutFont_c(0); + mpOutFont = JKR_NEW COutFont_c(0); JUT_ASSERT(3035, mpOutFont != NULL); mpOutFont->createPane(); mpRenProc->setOutFont(mpOutFont); @@ -1346,7 +1346,7 @@ void dMsgObject_c::talkStartInit() { switch (mFukiKind) { case 9: pRef = (jmessage_tReference*)mpRenProc->getReference(); - pData = new dMsgScrnItem_c(pRef->getFukiPosType(), pRef->getForm(), mpTalkHeap); + pData = JKR_NEW dMsgScrnItem_c(pRef->getFukiPosType(), pRef->getForm(), mpTalkHeap); JUT_ASSERT(3049, pData != NULL); mpScrnDraw = pData; break; @@ -1354,32 +1354,32 @@ void dMsgObject_c::talkStartInit() { if (mFukiKind == 15) { local_30 = mDoExt_getRubyFont(); } - pData = new dMsgScrnTree_c(local_30, mpTalkHeap); + pData = JKR_NEW dMsgScrnTree_c(local_30, mpTalkHeap); JUT_ASSERT(3061, pData != NULL); mpScrnDraw = pData; break; case 6: - pData = new dMsgScrnKanban_c(mpTalkHeap); + pData = JKR_NEW dMsgScrnKanban_c(mpTalkHeap); JUT_ASSERT(3069, pData != NULL); mpScrnDraw = pData; break; case 7: - pData = new dMsgScrnStaff_c(((jmessage_tReference*)mpRenProc->getReference())->getArrange()); + pData = JKR_NEW dMsgScrnStaff_c(((jmessage_tReference*)mpRenProc->getReference())->getArrange()); JUT_ASSERT(3083, pData != NULL); mpScrnDraw = pData; break; case 12: - pData = new dMsgScrnPlace_c(); + pData = JKR_NEW dMsgScrnPlace_c(); JUT_ASSERT(3092, pData != NULL); mpScrnDraw = pData; break; case 19: - pData = new dMsgScrnBoss_c(); + pData = JKR_NEW dMsgScrnBoss_c(); JUT_ASSERT(3100, pData != NULL); mpScrnDraw = pData; break; case 17: - pData = new dMsgScrnHowl_c(); + pData = JKR_NEW dMsgScrnHowl_c(); JUT_ASSERT(3108, pData != NULL); mpScrnDraw = pData; local_98 = true; @@ -1387,7 +1387,7 @@ void dMsgObject_c::talkStartInit() { case 1: case 5: pRef = (jmessage_tReference*)mpRenProc->getReference(); - pData = new dMsgScrnJimaku_c(pRef->getForm(), mpTalkHeap); + pData = JKR_NEW dMsgScrnJimaku_c(pRef->getForm(), mpTalkHeap); JUT_ASSERT(3119, pData != NULL); mpScrnDraw = pData; break; @@ -1396,11 +1396,11 @@ void dMsgObject_c::talkStartInit() { default: pRef = (jmessage_tReference*)mpRenProc->getReference(); if (mpRefer->getMsgID() == 0x2a5) { - pData = new dMsgScrnItem_c(0, pRef->getForm(), mpTalkHeap); + pData = JKR_NEW dMsgScrnItem_c(0, pRef->getForm(), mpTalkHeap); JUT_ASSERT(3131, pData != NULL); mpScrnDraw = pData; } else { - pData = new dMsgScrnTalk_c(pRef->getFukiPosType(), pRef->getForm(), mpTalkHeap); + pData = JKR_NEW dMsgScrnTalk_c(pRef->getFukiPosType(), pRef->getForm(), mpTalkHeap); JUT_ASSERT(3138, pData != NULL); mpScrnDraw = pData; local_98 = true; @@ -1509,11 +1509,11 @@ u16 dMsgObject_c::getStatusLocal() { void dMsgObject_c::delete_screen(bool param_1) { if (mpOutFont != NULL) { - delete mpOutFont; + JKR_DELETE(mpOutFont); mpOutFont = NULL; } if (mpScrnDraw != NULL) { - delete mpScrnDraw; + JKR_DELETE(mpScrnDraw); mpScrnDraw = NULL; if (param_1 && dComIfGp_isHeapLockFlag() == 5) { diff --git a/src/d/d_msg_out_font.cpp b/src/d/d_msg_out_font.cpp index 70ade423bb..4d15b069d3 100644 --- a/src/d/d_msg_out_font.cpp +++ b/src/d/d_msg_out_font.cpp @@ -39,7 +39,7 @@ COutFont_c::COutFont_c(u8 param_0) { field_0x242 = param_0; for (int i = 0; i < 35; i++) { - mpOfs[i] = new COutFontSet_c(); + mpOfs[i] = JKR_NEW COutFontSet_c(); } for (int i = 0; i < 70; i++) { @@ -56,7 +56,7 @@ COutFont_c::COutFont_c(u8 param_0) { COutFont_c::~COutFont_c() { for (int i = 0; i < 35; i++) { - delete mpOfs[i]; + JKR_DELETE(mpOfs[i]); mpOfs[i] = NULL; } @@ -65,7 +65,7 @@ COutFont_c::~COutFont_c() { for (int i = 0; i < 70; i++) { if (mpPane[i] != NULL) { - delete mpPane[i]; + JKR_DELETE(mpPane[i]); mpPane[i] = NULL; } } @@ -95,7 +95,7 @@ void COutFont_c::createPane() { img = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', getBtiName(i)); } - mpPane[i] = new J2DPicture(img); + mpPane[i] = JKR_NEW J2DPicture(img); switch (i) { case 0: mpPane[i]->setBlackWhite(JUtility::TColor(255, 255, 255, 0), diff --git a/src/d/d_msg_scrn_3select.cpp b/src/d/d_msg_scrn_3select.cpp index 8f7862d2f5..27a0bf5e1b 100644 --- a/src/d/d_msg_scrn_3select.cpp +++ b/src/d/d_msg_scrn_3select.cpp @@ -37,7 +37,7 @@ dMsgScrn3Select_c::dMsgScrn3Select_c() { MULTI_CHAR('sel_po02'), MULTI_CHAR('c_kahen'), MULTI_CHAR('c_cursor') }; - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_window_3menu.blo", 0x20000, dComIfGp_getMsgArchive(0)); @@ -62,11 +62,11 @@ dMsgScrn3Select_c::dMsgScrn3Select_c() { mpAnmBtk->searchUpdateMaterialID(mpScreen); mBtkFrame = 0.0f; - mpSelectCursor = new dSelect_cursor_c(0, 1.0f, NULL); + mpSelectCursor = JKR_NEW dSelect_cursor_c(0, 1.0f, NULL); JUT_ASSERT(0, mpSelectCursor != NULL); mpSelectCursor->setAlphaRate(0.0f); - mpParent = new CPaneMgr(mpScreen, MULTI_CHAR('abc_n'), 0, NULL); + mpParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('abc_n'), 0, NULL); JUT_ASSERT(0, mpParent != NULL); for (int i = 0; i < 3; i++) { @@ -74,52 +74,52 @@ dMsgScrn3Select_c::dMsgScrn3Select_c() { mCursorPos[i].y = 0.0f; mCursorPos[i].z = 0.0f; - mpSel_c[i] = new CPaneMgr(mpScreen, tag_name[i][0], 0, NULL); + mpSel_c[i] = JKR_NEW CPaneMgr(mpScreen, tag_name[i][0], 0, NULL); JUT_ASSERT(0, mpSel_c[i] != NULL); mpSel_c[i]->hide(); - mpSelCld_c[i] = new CPaneMgr(mpScreen, tag_name[i][1], 0, NULL); + mpSelCld_c[i] = JKR_NEW CPaneMgr(mpScreen, tag_name[i][1], 0, NULL); JUT_ASSERT(0, mpSelCld_c[i] != NULL); mpSelCld_c[i]->getPanePtr()->setAnimation(mpAnmBtk); - mpSelCldr_c[i] = new CPaneMgr(mpScreen, tag_name[i][2], 0, NULL); + mpSelCldr_c[i] = JKR_NEW CPaneMgr(mpScreen, tag_name[i][2], 0, NULL); JUT_ASSERT(0, mpSelCldr_c[i] != NULL); mpSelCldr_c[i]->getPanePtr()->setAnimation(mpAnmBtk); - mpSelCldm_c[i] = new CPaneMgr(mpScreen, tag_name[i][3], 0, NULL); + mpSelCldm_c[i] = JKR_NEW CPaneMgr(mpScreen, tag_name[i][3], 0, NULL); JUT_ASSERT(0, mpSelCldm_c[i] != NULL); mpSelCldm_c[i]->getPanePtr()->setAnimation(mpAnmBpk); for (int j = 0; j < 5; j++) { - mpSelCldw_c[j][i] = new CPaneMgr(mpScreen, tag_name[i][4 + j], 0, NULL); + mpSelCldw_c[j][i] = JKR_NEW CPaneMgr(mpScreen, tag_name[i][4 + j], 0, NULL); JUT_ASSERT(0, mpSelCldw_c[j][i] != NULL); } - mpSelPo_c[i] = new CPaneMgr(mpScreen, tag_name[i][9], 0, NULL); + mpSelPo_c[i] = JKR_NEW CPaneMgr(mpScreen, tag_name[i][9], 0, NULL); JUT_ASSERT(0, mpSelPo_c[i] != NULL); mpSelPo_c[i]->hide(); - mpKahen_c[i] = new CPaneMgr(mpScreen, tag_name[i][10], 0, NULL); + mpKahen_c[i] = JKR_NEW CPaneMgr(mpScreen, tag_name[i][10], 0, NULL); JUT_ASSERT(0, mpKahen_c[i] != NULL); - mpCursor_c[i] = new CPaneMgr(mpScreen, tag_name[i][11], 0, NULL); + mpCursor_c[i] = JKR_NEW CPaneMgr(mpScreen, tag_name[i][11], 0, NULL); JUT_ASSERT(0, mpCursor_c[i] != NULL); mCursorPos[i] = mpCursor_c[i]->getGlobalVtxCenter(true, 0); } #if VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { - mpTmSel_c[0] = new CPaneMgr(mpScreen, 'a_tf', 0, NULL); + mpTmSel_c[0] = JKR_NEW CPaneMgr(mpScreen, 'a_tf', 0, NULL); - mpTmSel_c[1] = new CPaneMgr(mpScreen, 'b_tf', 0, NULL); + mpTmSel_c[1] = JKR_NEW CPaneMgr(mpScreen, 'b_tf', 0, NULL); - mpTmSel_c[2] = new CPaneMgr(mpScreen, 'c_tf', 0, NULL); + mpTmSel_c[2] = JKR_NEW CPaneMgr(mpScreen, 'c_tf', 0, NULL); - mpTmrSel_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('a_tf_f'), 0, NULL); + mpTmrSel_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('a_tf_f'), 0, NULL); - mpTmrSel_c[1] = new CPaneMgr(mpScreen, MULTI_CHAR('b_tf_f'), 0, NULL); + mpTmrSel_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_tf_f'), 0, NULL); - mpTmrSel_c[2] = new CPaneMgr(mpScreen, MULTI_CHAR('c_tf_f'), 0, NULL); + mpTmrSel_c[2] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('c_tf_f'), 0, NULL); for (int i = 0; i < 3; i++) { ((J2DTextBox*)(mpTmSel_c[i]->getPanePtr()))->setString(64, ""); @@ -142,11 +142,11 @@ dMsgScrn3Select_c::dMsgScrn3Select_c() { mpScreen->search('b_t')->hide(); mpScreen->search('c_t')->hide(); } else { - mpTmSel_c[0] = new CPaneMgr(mpScreen, 'a_t', 0, NULL); + mpTmSel_c[0] = JKR_NEW CPaneMgr(mpScreen, 'a_t', 0, NULL); - mpTmSel_c[1] = new CPaneMgr(mpScreen, 'b_t', 0, NULL); + mpTmSel_c[1] = JKR_NEW CPaneMgr(mpScreen, 'b_t', 0, NULL); - mpTmSel_c[2] = new CPaneMgr(mpScreen, 'c_t', 0, NULL); + mpTmSel_c[2] = JKR_NEW CPaneMgr(mpScreen, 'c_t', 0, NULL); for (int i = 0; i < 3; i++) { ((J2DTextBox*)(mpTmSel_c[i]->getPanePtr()))->setString(64, ""); @@ -168,13 +168,13 @@ dMsgScrn3Select_c::dMsgScrn3Select_c() { mpScreen->search('c_t')->show(); } #else - mpTmSel_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('a_t_e'), 0, NULL); + mpTmSel_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('a_t_e'), 0, NULL); JUT_ASSERT(0, mpTmSel_c[0] != NULL); - mpTmSel_c[1] = new CPaneMgr(mpScreen, MULTI_CHAR('b_t_e'), 0, NULL); + mpTmSel_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('b_t_e'), 0, NULL); JUT_ASSERT(0, mpTmSel_c[1] != NULL); - mpTmSel_c[2] = new CPaneMgr(mpScreen, MULTI_CHAR('c_t_e'), 0, NULL); + mpTmSel_c[2] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('c_t_e'), 0, NULL); JUT_ASSERT(0, mpTmSel_c[2] != NULL); for (int i = 0; i < 3; i++) { @@ -218,57 +218,57 @@ dMsgScrn3Select_c::dMsgScrn3Select_c() { } dMsgScrn3Select_c::~dMsgScrn3Select_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpAnmBck; + JKR_DELETE(mpAnmBck); mpAnmBck = NULL; - delete mpAnmBpk; + JKR_DELETE(mpAnmBpk); mpAnmBpk = NULL; - delete mpAnmBtk; + JKR_DELETE(mpAnmBtk); mpAnmBtk = NULL; - delete mpSelectCursor; + JKR_DELETE(mpSelectCursor); mpSelectCursor = NULL; - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; for (int i = 0; i < 3; i++) { - delete mpSel_c[i]; + JKR_DELETE(mpSel_c[i]); mpSel_c[i] = NULL; - delete mpSelCld_c[i]; + JKR_DELETE(mpSelCld_c[i]); mpSelCld_c[i] = NULL; - delete mpSelCldr_c[i]; + JKR_DELETE(mpSelCldr_c[i]); mpSelCldr_c[i] = NULL; - delete mpSelCldm_c[i]; + JKR_DELETE(mpSelCldm_c[i]); mpSelCldm_c[i] = NULL; - delete mpTmSel_c[i]; + JKR_DELETE(mpTmSel_c[i]); mpTmSel_c[i] = NULL; - delete mpKahen_c[i]; + JKR_DELETE(mpKahen_c[i]); mpKahen_c[i] = NULL; - delete mpCursor_c[i]; + JKR_DELETE(mpCursor_c[i]); mpCursor_c[i] = NULL; if (mpTmrSel_c[i] != NULL) { - delete mpTmrSel_c[i]; + JKR_DELETE(mpTmrSel_c[i]); mpTmrSel_c[i] = NULL; } for (int j = 0; j < 5; j++) { - delete mpSelCldw_c[j][i]; + JKR_DELETE(mpSelCldw_c[j][i]); mpSelCldw_c[j][i] = NULL; } - delete mpSelPo_c[i]; + JKR_DELETE(mpSelPo_c[i]); mpSelPo_c[i] = NULL; } } diff --git a/src/d/d_msg_scrn_arrow.cpp b/src/d/d_msg_scrn_arrow.cpp index ba85ceea2f..7ee3b0503c 100644 --- a/src/d/d_msg_scrn_arrow.cpp +++ b/src/d/d_msg_scrn_arrow.cpp @@ -7,7 +7,7 @@ #include "d/d_pane_class.h" dMsgScrnArrow_c::dMsgScrnArrow_c() { - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_window_yajirushi.blo", 0x20000, dComIfGp_getMsgArchive(0)); @@ -25,10 +25,10 @@ dMsgScrnArrow_c::dMsgScrnArrow_c() { mpBpk->searchUpdateMaterialID(mpScreen); mBpkFrame = 0.0f; - mpParent_c = new CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); + mpParent_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); JUT_ASSERT(0, mpParent_c != NULL); - mpArw_c = new CPaneMgr(mpScreen, MULTI_CHAR('ya_next'), 0, NULL); + mpArw_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('ya_next'), 0, NULL); JUT_ASSERT(0, mpArw_c != NULL); mpArw_c->hide(); @@ -36,7 +36,7 @@ dMsgScrnArrow_c::dMsgScrnArrow_c() { mpScreen->search(MULTI_CHAR('yajnext'))->setAnimation(mpBpk); mpScreen->search(MULTI_CHAR('yajinexl'))->setAnimation(mpBpk); - mpDot_c = new CPaneMgr(mpScreen, MULTI_CHAR('ya_end'), 0, NULL); + mpDot_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('ya_end'), 0, NULL); JUT_ASSERT(0, mpDot_c != NULL); mpDot_c->hide(); @@ -45,22 +45,22 @@ dMsgScrnArrow_c::dMsgScrnArrow_c() { } dMsgScrnArrow_c::~dMsgScrnArrow_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpBck; + JKR_DELETE(mpBck); mpBck = NULL; - delete mpBpk; + JKR_DELETE(mpBpk); mpBpk = NULL; - delete mpParent_c; + JKR_DELETE(mpParent_c); mpParent_c = NULL; - delete mpArw_c; + JKR_DELETE(mpArw_c); mpArw_c = NULL; - delete mpDot_c; + JKR_DELETE(mpDot_c); mpDot_c = NULL; } diff --git a/src/d/d_msg_scrn_boss.cpp b/src/d/d_msg_scrn_boss.cpp index d2110e7cec..64141770b3 100644 --- a/src/d/d_msg_scrn_boss.cpp +++ b/src/d/d_msg_scrn_boss.cpp @@ -13,25 +13,25 @@ dMsgScrnBoss_c::dMsgScrnBoss_c() { init(); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); mpScreen->setPriority("zelda_boss_name.blo", 0x20000, dComIfGp_getMsgArchive(4)); dPaneClass_showNullPane(mpScreen); - mpPmP_c = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); mpPmP_c->scale(g_MsgObject_HIO_c.mBossNameScaleX, g_MsgObject_HIO_c.mBossNameScaleY); - mpFontParent = new CPaneMgr(mpScreen, MULTI_CHAR('s_font_n'), 0, NULL); + mpFontParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('s_font_n'), 0, NULL); mpFontParent->scale(g_MsgObject_HIO_c.mBossNameCharSizeX, g_MsgObject_HIO_c.mBossNameCharSizeY); mpFontParent->paneTrans(g_MsgObject_HIO_c.mBossNameCharPosX, g_MsgObject_HIO_c.mBossNameCharPosY); - mpBaseParent = new CPaneMgr(mpScreen, MULTI_CHAR('base_n'), 2, NULL); + mpBaseParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('base_n'), 2, NULL); mpBaseParent->scale(g_MsgObject_HIO_c.mBossNameBaseSizeX, g_MsgObject_HIO_c.mBossNameBaseSizeY); mpBaseParent->paneTrans(g_MsgObject_HIO_c.mBossNameBasePosX, g_MsgObject_HIO_c.mBossNameBasePosY); for (int i = 0; i < 7; i++) { - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getRubyFont()); #if VERSION != VERSION_GCN_JPN ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setCharSpace(1.0f); @@ -54,20 +54,20 @@ dMsgScrnBoss_c::dMsgScrnBoss_c() { } dMsgScrnBoss_c::~dMsgScrnBoss_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; - delete mpFontParent; + JKR_DELETE(mpFontParent); mpFontParent = NULL; - delete mpBaseParent; + JKR_DELETE(mpBaseParent); mpBaseParent = NULL; for (int i = 0; i < 7; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; } diff --git a/src/d/d_msg_scrn_explain.cpp b/src/d/d_msg_scrn_explain.cpp index f55fbc3fa2..de4ee0caf0 100644 --- a/src/d/d_msg_scrn_explain.cpp +++ b/src/d/d_msg_scrn_explain.cpp @@ -48,14 +48,14 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs mKeyWaitTimer = 0; field_0x67 = param_3; - mpString_c = new dMsgString_c(); + mpString_c = JKR_NEW dMsgString_c(); JUT_ASSERT(79, mpString_c != NULL); - mpOutFont = new COutFont_c(0); + mpOutFont = JKR_NEW COutFont_c(0); JUT_ASSERT(83, mpOutFont != NULL); mpOutFont->createPane(); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(88, mpScreen != NULL); #if PLATFORM_GCN @@ -68,7 +68,7 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs JUT_ASSERT(98, fg != false); dPaneClass_showNullPane(mpScreen); - mpTxScreen = new J2DScreen(); + mpTxScreen = JKR_NEW J2DScreen(); JUT_ASSERT(102, mpTxScreen != NULL); field_0x48 = 608.0f; @@ -82,10 +82,10 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs JUT_ASSERT(119, fg != false); dPaneClass_showNullPane(mpTxScreen); - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); JUT_ASSERT(124, mpTm_c[0] != NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, 't3_s', 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't3_s', 0, NULL); JUT_ASSERT(127, mpTm_c[1] != NULL); mpTmr_c[0] = NULL; @@ -113,18 +113,18 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs field_0x50 = 0.0f; if (dComIfGs_getOptRuby() == 0) { - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); - mpTmr_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); - mpTmr_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + mpTmr_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); + mpTmr_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); mpTxScreen->search(MULTI_CHAR('n_3fline'))->show(); mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); } else { - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, 't3_s', 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't3_s', 0, NULL); mpTmr_c[0] = NULL; mpTmr_c[1] = NULL; @@ -136,10 +136,10 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs #else field_0x50 = -10.0f; - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); JUT_ASSERT(162, mpTm_c[0] != NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, 't4_s', 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't4_s', 0, NULL); JUT_ASSERT(165, mpTm_c[1] != NULL); mpTmr_c[0] = NULL; @@ -182,27 +182,27 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs g_MsgObject_HIO_c.mTextPosX + mpScreen->search(MULTI_CHAR('mg_null'))->getBounds().i.x, g_MsgObject_HIO_c.mTextPosY + mpScreen->search(MULTI_CHAR('mg_null'))->getBounds().i.y); - mpArw_c = new CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); + mpArw_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); JUT_ASSERT(241, mpArw_c != NULL); - mpMg_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpMg_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(244, mpMg_c[0] != NULL); - mpMg_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpMg_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(247, mpMg_c[1] != NULL); - mpArw_c = new CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); - mpMg_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); - mpMg_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_null'), 0, NULL); - mpRoot_c[0] = new CPaneMgr(mpScreen, 'ROOT', 2, NULL); + mpArw_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); + mpMg_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpMg_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpRoot_c[0] = JKR_NEW CPaneMgr(mpScreen, 'ROOT', 2, NULL); JUT_ASSERT(250, mpRoot_c[0] != NULL); - mpRoot_c[1] = new CPaneMgr(mpTxScreen, 'ROOT', 2, NULL); + mpRoot_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 'ROOT', 2, NULL); JUT_ASSERT(253, mpRoot_c[1] != NULL); if (i_isUseBackTex == true) { ResTIMG* texResource = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBackTex = new J2DPicture(texResource); + mpBackTex = JKR_NEW J2DPicture(texResource); JUT_ASSERT(259, mpBackTex != NULL); mpBackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 0xff)); @@ -211,11 +211,11 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs mpBackTex = NULL; } - mpArrow_c = new dMsgScrnArrow_c(); + mpArrow_c = JKR_NEW dMsgScrnArrow_c(); JUT_ASSERT(269, mpArrow_c != NULL); if (i_stick != NULL) { - mpSelect_c = new dMsgScrn3Select_c(); + mpSelect_c = JKR_NEW dMsgScrn3Select_c(); JUT_ASSERT(274, mpSelect_c != NULL); } else { mpSelect_c = NULL; @@ -229,49 +229,49 @@ dMsgScrnExplain_c::dMsgScrnExplain_c(STControl* i_stick, u8 param_1, bool i_isUs } dMsgScrnExplain_c::~dMsgScrnExplain_c() { - delete mpString_c; + JKR_DELETE(mpString_c); mpString_c = NULL; - delete mpOutFont; + JKR_DELETE(mpOutFont); mpOutFont = NULL; - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpTxScreen; + JKR_DELETE(mpTxScreen); mpTxScreen = NULL; - delete mpArw_c; + JKR_DELETE(mpArw_c); mpArw_c = NULL; for (int i = 0; i < 2; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; if (mpTmr_c[i] != NULL) { - delete mpTmr_c[i]; + JKR_DELETE(mpTmr_c[i]); mpTmr_c[i] = NULL; } - delete mpMg_c[i]; + JKR_DELETE(mpMg_c[i]); mpMg_c[i] = NULL; - delete mpRoot_c[i]; + JKR_DELETE(mpRoot_c[i]); mpRoot_c[i] = NULL; } if (mpBackTex != NULL) { - delete mpBackTex; + JKR_DELETE(mpBackTex); mpBackTex = NULL; } if (mpArrow_c != NULL) { - delete mpArrow_c; + JKR_DELETE(mpArrow_c); mpArrow_c = NULL; } if (mpSelect_c) { - delete mpSelect_c; + JKR_DELETE(mpSelect_c); mpSelect_c = NULL; } diff --git a/src/d/d_msg_scrn_howl.cpp b/src/d/d_msg_scrn_howl.cpp index 473de9c350..58e70e84ff 100644 --- a/src/d/d_msg_scrn_howl.cpp +++ b/src/d/d_msg_scrn_howl.cpp @@ -54,25 +54,25 @@ dMsgScrnHowl_c::dMsgScrnHowl_c() { }; init(); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(61, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_wolf_howl.blo", 0x20000, dComIfGp_getMsgArchive(5)); JUT_ASSERT(73, fg != false); dPaneClass_showNullPane(mpScreen); mpScreen->search(MULTI_CHAR('line00'))->hide(); - mpPmP_c = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 3, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 3, NULL); JUT_ASSERT(79, mpPmP_c != NULL); mpScreen->search('ag_n')->hide(); field_0x1994 = 0.0f; field_0x1998 = 0.0f; mpScreen->search(MULTI_CHAR('wi_btn_n'))->hide(); - mpButtonIcon[0] = new CPaneMgr(mpScreen, MULTI_CHAR('cbtn_n'), 2, NULL); + mpButtonIcon[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('cbtn_n'), 2, NULL); JUT_ASSERT(91, mpButtonIcon[0] != NULL); - mpButtonText[0] = new CPaneMgr(mpScreen, MULTI_CHAR('g_ltxt_n'), 2, NULL); + mpButtonText[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('g_ltxt_n'), 2, NULL); JUT_ASSERT(93, mpButtonText[0] != NULL); - mpButtonIcon[1] = new CPaneMgr(mpScreen, MULTI_CHAR('abt_n'), 2, NULL); + mpButtonIcon[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('abt_n'), 2, NULL); JUT_ASSERT(96, mpButtonIcon[1] != NULL); - mpButtonText[1] = new CPaneMgr(mpScreen, MULTI_CHAR('gr_txt_n'), 2, NULL); + mpButtonText[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('gr_txt_n'), 2, NULL); JUT_ASSERT(98, mpButtonText[1] != NULL); #if VERSION == VERSION_GCN_JPN J2DTextBox* piStack_19c = (J2DTextBox*)mpScreen->search(MULTI_CHAR('g_l_info')); @@ -138,9 +138,9 @@ dMsgScrnHowl_c::dMsgScrnHowl_c() { field_0x2136 = (350.0f / field_0x1980); field_0x2138 = 0; field_0x1984 = 255.0f / field_0x2136; - mpABase = new CPaneMgr(mpScreen, MULTI_CHAR('a_base'), 0, NULL); + mpABase = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('a_base'), 0, NULL); JUT_ASSERT(218, mpABase != NULL); - mpLineAll = new CPaneMgr(mpScreen, MULTI_CHAR('line_all'), 0, NULL); + mpLineAll = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('line_all'), 0, NULL); JUT_ASSERT(221, mpLineAll != NULL); f32 in_f31; for (int i = 0; i < 7; i++) { @@ -158,11 +158,11 @@ dMsgScrnHowl_c::dMsgScrnHowl_c() { f29); } for (int i = 0; i < 3; i++) { - mpLineH[i] = new CPaneMgr(mpScreen, ylinen_tag[i], 0, NULL); + mpLineH[i] = JKR_NEW CPaneMgr(mpScreen, ylinen_tag[i], 0, NULL); JUT_ASSERT(242, mpLineH[i] != NULL); } for (int i = 0; i < 7; i++) { - mpLineV[i] = new CPaneMgr(mpScreen, tlinen_tag[i], 2, NULL); + mpLineV[i] = JKR_NEW CPaneMgr(mpScreen, tlinen_tag[i], 2, NULL); JUT_ASSERT(247, mpLineV[i] != NULL); } Mtx mtx2; @@ -178,21 +178,21 @@ dMsgScrnHowl_c::dMsgScrnHowl_c() { field_0x27a4 = 1.0f; field_0x27a8 = 0.0f; ResTIMG const* res = (ResTIMG const*) dComIfGp_getMsgArchive(5)->getResource('TIMG', "tt_ginnouroko_s3tc.bti"); - mpDot = new J2DPicture(res); + mpDot = JKR_NEW J2DPicture(res); JUT_ASSERT(275, mpDot != NULL); mpDot->setWhite(JUtility::TColor(0xff, 0xff, 0x71, 0xff)); res = (ResTIMG const*)dComIfGp_getMsgArchive(5)->getResource('TIMG', "tt_black_32.bti"); - mpGuideDot = new J2DPicture(res); + mpGuideDot = JKR_NEW J2DPicture(res); JUT_ASSERT(280, mpGuideDot != NULL); mpGuideDot->setBlackWhite(((J2DPicture*)mpScreen->search(MULTI_CHAR('line00')))->getBlack(), ((J2DPicture*)mpScreen->search(MULTI_CHAR('line00')))->getWhite()); res = (ResTIMG const*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_iastarRR.bti"); - mpTopBall = new J2DPicture(res); + mpTopBall = JKR_NEW J2DPicture(res); JUT_ASSERT(287, mpTopBall != NULL); mpTopBall->setBlackWhite(g_MsgObject_HIO_c.mHowlHIO.mDotBlack, g_MsgObject_HIO_c.mHowlHIO.mDotWhite); ; for (int i = 0; i < 5; i++) { - mpTopBallTail[i] = new J2DPicture(res); + mpTopBallTail[i] = JKR_NEW J2DPicture(res); JUT_ASSERT(292, mpTopBallTail[i] != NULL); mpTopBallTail[i]->setBlackWhite(g_MsgObject_HIO_c.mHowlHIO.mDotBlack, g_MsgObject_HIO_c.mHowlHIO.mDotWhite); } @@ -203,7 +203,7 @@ dMsgScrnHowl_c::dMsgScrnHowl_c() { mCorrectLineMax = 0; field_0x2197 = 0; res = (ResTIMG const*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpWaveTex = new J2DPicture(res); + mpWaveTex = JKR_NEW J2DPicture(res); JUT_ASSERT(307, mpWaveTex != NULL); mpWaveTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 200, 0, 255)); mpWaveTex->setCornerColor( @@ -220,41 +220,41 @@ dMsgScrnHowl_c::dMsgScrnHowl_c() { } dMsgScrnHowl_c::~dMsgScrnHowl_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; for (int i = 0; i < 2; i++) { - delete mpButtonIcon[i]; + JKR_DELETE(mpButtonIcon[i]); mpButtonIcon[i] = NULL; - delete mpButtonText[i]; + JKR_DELETE(mpButtonText[i]); mpButtonText[i] = NULL; } for (int i = 0; i < 3; i++) { - delete mpLineH[i]; + JKR_DELETE(mpLineH[i]); mpLineH[i] = NULL; } for (int i = 0; i < 7; i++) { - delete mpLineV[i]; + JKR_DELETE(mpLineV[i]); mpLineV[i] = NULL; } - delete mpABase; + JKR_DELETE(mpABase); mpABase = NULL; - delete mpLineAll; + JKR_DELETE(mpLineAll); mpLineAll = NULL; - delete mpDot; + JKR_DELETE(mpDot); mpDot = NULL; - delete mpGuideDot; + JKR_DELETE(mpGuideDot); mpGuideDot = NULL; - delete mpTopBall; + JKR_DELETE(mpTopBall); mpTopBall = NULL; for (int i = 0; i < 5; i++) { - delete mpTopBallTail[i]; + JKR_DELETE(mpTopBallTail[i]); mpTopBallTail[i] = NULL; } - delete mpWaveTex; + JKR_DELETE(mpWaveTex); mpWaveTex = NULL; dComIfGp_getMsgArchive(5)->removeResourceAll();; } diff --git a/src/d/d_msg_scrn_item.cpp b/src/d/d_msg_scrn_item.cpp index 904b418ab9..bb4daf3927 100644 --- a/src/d/d_msg_scrn_item.cpp +++ b/src/d/d_msg_scrn_item.cpp @@ -109,7 +109,7 @@ dMsgScrnItem_c::dMsgScrnItem_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { if (isOugiID()) { JKRReadIdxResource(mpItemTex[0], 0xc00, 0x3d, dComIfGp_getItemIconArchive()); field_0x0e0[0] = (ResTIMG*)mpItemTex[0]; - mpItemPane[0] = new J2DPicture(field_0x0e0[0]); + mpItemPane[0] = JKR_NEW J2DPicture(field_0x0e0[0]); JUT_ASSERT(148, mpItemPane[0] != NULL); } else { int texNum = @@ -117,7 +117,7 @@ dMsgScrnItem_c::dMsgScrnItem_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { (J2DPicture*)NULL, mpItemTex[2], (J2DPicture*)NULL, NULL, (J2DPicture*)NULL, uStack_60); for (int i = 0; i < texNum; i++) { field_0x0e0[i] = (ResTIMG*)mpItemTex[i]; - mpItemPane[i] = new J2DPicture(field_0x0e0[i]); + mpItemPane[i] = JKR_NEW J2DPicture(field_0x0e0[i]); JUT_ASSERT(165, mpItemPane[i] != NULL); } dMeter2Info_setItemColor( @@ -129,12 +129,12 @@ dMsgScrnItem_c::dMsgScrnItem_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { } #endif } - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(188, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_item_get_window.blo", 0x1020000, dComIfGp_getMsgArchive(3)); JUT_ASSERT(195, fg != false); dPaneClass_showNullPane(mpScreen); - mpTxScreen = new J2DScreen(); + mpTxScreen = JKR_NEW J2DScreen(); JUT_ASSERT(199, mpTxScreen != NULL); fg = mpTxScreen->setPriority("zelda_item_get_window_text.blo", 0x20000, dComIfGp_getMsgArchive(3)); JUT_ASSERT(206, fg != false); @@ -157,11 +157,11 @@ dMsgScrnItem_c::dMsgScrnItem_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { mpItemPane[i]->setBasePosition(J2DBasePosition_4); } } - mpArrow_c = new dMsgScrnArrow_c(); + mpArrow_c = JKR_NEW dMsgScrnArrow_c(); JUT_ASSERT(280, mpArrow_c != NULL); - mpSelect_c = new dMsgScrn3Select_c(); + mpSelect_c = JKR_NEW dMsgScrn3Select_c(); JUT_ASSERT(284, mpSelect_c != NULL); - mpLight_c = new dMsgScrnLight_c(3, param_2); + mpLight_c = JKR_NEW dMsgScrnLight_c(3, param_2); JUT_ASSERT(288, mpLight_c != NULL); void* mpBuf = field_0x138->alloc(0x106a, 0x20); JUT_ASSERT(291, mpBuf != NULL); @@ -175,11 +175,11 @@ dMsgScrnItem_c::dMsgScrnItem_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { field_0x188[i] = g_MsgObject_HIO_c.mBoxPos[i][3]; } field_0x194 = 0.0f; - mpArw_c = new CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); + mpArw_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); JUT_ASSERT(306, mpArw_c != NULL); - mpMg_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpMg_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(309, mpMg_c[0] != NULL); - mpMg_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpMg_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(312, mpMg_c[1] != NULL); OSInitFastCast(); fukiPosCalc(param_1); @@ -193,51 +193,51 @@ dMsgScrnItem_c::dMsgScrnItem_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { field_0x12c[1]->searchUpdateMaterialID(mpScreen); field_0x154[1] = 0.0f; field_0x19d = false; - mpPmP_c = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 3, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 3, NULL); JUT_ASSERT(389, mpPmP_c != NULL); mpPmP_c->scale(g_MsgObject_HIO_c.mBoxItemScaleX, g_MsgObject_HIO_c.mBoxItemScaleY); #if VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); JUT_ASSERT(407, mpTm_c[0] != NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); JUT_ASSERT(410, mpTm_c[1] != NULL); - mpTm_c[2] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_w'), 0, NULL); + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_w'), 0, NULL); JUT_ASSERT(413, mpTm_c[2] != NULL); - mpTmr_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); + mpTmr_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); JUT_ASSERT(416, mpTmr_c[0] != NULL); - mpTmr_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + mpTmr_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); JUT_ASSERT(419, mpTmr_c[1] != NULL); - mpTmr_c[2] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_w'), 0, NULL); + mpTmr_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_w'), 0, NULL); JUT_ASSERT(422, mpTmr_c[2] != NULL); mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); mpTxScreen->search(MULTI_CHAR('n_3fline'))->show(); mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); } else { - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); JUT_ASSERT(407, mpTm_c[0] != NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, 't3_s', 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't3_s', 0, NULL); JUT_ASSERT(410, mpTm_c[1] != NULL); - mpTm_c[2] = new CPaneMgr(mpTxScreen, 't3_w', 0, NULL); + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, 't3_w', 0, NULL); JUT_ASSERT(413, mpTm_c[2] != NULL); mpTxScreen->search(MULTI_CHAR('n_3line'))->show(); mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); } #else - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); JUT_ASSERT(407, mpTm_c[0] != NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, 't4_s', 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't4_s', 0, NULL); JUT_ASSERT(410, mpTm_c[1] != NULL); - mpTm_c[2] = new CPaneMgr(mpTxScreen, 't4_w', 0, NULL); + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, 't4_w', 0, NULL); JUT_ASSERT(413, mpTm_c[2] != NULL); mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); mpTxScreen->search(MULTI_CHAR('n_3fline'))->hide(); @@ -299,45 +299,45 @@ dMsgScrnItem_c::~dMsgScrnItem_c() { mpItemTex[i] = NULL; } if (mpItemPane[i] != NULL) { - delete mpItemPane[i]; + JKR_DELETE(mpItemPane[i]); mpItemPane[i] = NULL; } } - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpTxScreen; + JKR_DELETE(mpTxScreen); mpTxScreen = NULL; - delete mpArrow_c; + JKR_DELETE(mpArrow_c); mpArrow_c = NULL; - delete mpSelect_c; + JKR_DELETE(mpSelect_c); mpSelect_c = NULL; - delete mpLight_c; + JKR_DELETE(mpLight_c); mpLight_c = NULL; if (mCharInfoPtr != 0) { field_0x138->free(mCharInfoPtr); mCharInfoPtr = NULL; } - delete mpArw_c; + JKR_DELETE(mpArw_c); mpArw_c = NULL; for (int i = 0; i < 2; i++) { - delete mpMg_c[i]; + JKR_DELETE(mpMg_c[i]); mpMg_c[i] = NULL; } for (int i = 0; i < 1; i++) { - delete field_0x118[i]; + JKR_DELETE(field_0x118[i]); field_0x118[i] = NULL; } for (int i = 0; i < 2; i++) { - delete field_0x12c[i]; + JKR_DELETE(field_0x12c[i]); field_0x12c[i] = NULL; } - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; for (int i = 0; i < 3; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; if (mpTmr_c[i] != NULL) { - delete mpTmr_c[i]; + JKR_DELETE(mpTmr_c[i]); mpTmr_c[i] = NULL; } } diff --git a/src/d/d_msg_scrn_jimaku.cpp b/src/d/d_msg_scrn_jimaku.cpp index b92c1afd0e..ce059bd194 100644 --- a/src/d/d_msg_scrn_jimaku.cpp +++ b/src/d/d_msg_scrn_jimaku.cpp @@ -24,7 +24,7 @@ dMsgScrnJimaku_c::dMsgScrnJimaku_c(u8 param_0, JKRExpHeap* i_heap) { init(); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_jimaku_message_text.blo", 0x20000, @@ -32,7 +32,7 @@ dMsgScrnJimaku_c::dMsgScrnJimaku_c(u8 param_0, JKRExpHeap* i_heap) { JUT_ASSERT(0, fg != false); dPaneClass_showNullPane(mpScreen); - mpLight_c = new dMsgScrnLight_c(0, param_0); + mpLight_c = JKR_NEW dMsgScrnLight_c(0, param_0); JUT_ASSERT(0, mpLight_c != NULL); void* mpBuf = heap->alloc(0x106A, 0x20); @@ -40,7 +40,7 @@ dMsgScrnJimaku_c::dMsgScrnJimaku_c(u8 param_0, JKRExpHeap* i_heap) { memset(mpBuf, 0, 0x106A); mCharInfoPtr = (CharInfo_c*)mpBuf; - mpPmP_c = new CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 3, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 3, NULL); JUT_ASSERT(0, mpPmP_c != NULL); mpPmP_c->scale(g_MsgObject_HIO_c.mSubtitleScaleX, g_MsgObject_HIO_c.mSubtitleScaleY); field_0xcc = g_MsgObject_HIO_c.mBoxPos[0][5]; @@ -48,28 +48,28 @@ dMsgScrnJimaku_c::dMsgScrnJimaku_c(u8 param_0, JKRExpHeap* i_heap) { #if VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { - mpTm_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_3flin'), 0, NULL); - mpTm_c[1] = new CPaneMgr(mpScreen, MULTI_CHAR('t3f_s'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('t3f_s'), 0, NULL); - mpTmr_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_3f'), 0, NULL); - mpTmr_c[1] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + mpTmr_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3f'), 0, NULL); + mpTmr_c[1] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); mpScreen->search(MULTI_CHAR('n_3line'))->hide(); mpScreen->search(MULTI_CHAR('n_3fline'))->show(); mpScreen->search(MULTI_CHAR('n_e4line'))->hide(); } else { - mpTm_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_3line'), 0, NULL); - mpTm_c[1] = new CPaneMgr(mpScreen, 't3_s', 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpScreen, 't3_s', 0, NULL); mpScreen->search(MULTI_CHAR('n_3line'))->show(); mpScreen->search(MULTI_CHAR('n_3fline'))->hide(); mpScreen->search(MULTI_CHAR('n_e4line'))->hide(); } #else - mpTm_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); JUT_ASSERT(0, mpTm_c[0] != NULL); - mpTm_c[1] = new CPaneMgr(mpScreen, 't4_s', 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpScreen, 't4_s', 0, NULL); JUT_ASSERT(0, mpTm_c[1] != NULL); mpScreen->search(MULTI_CHAR('n_3line'))->hide(); @@ -130,10 +130,10 @@ dMsgScrnJimaku_c::dMsgScrnJimaku_c(u8 param_0, JKRExpHeap* i_heap) { } dMsgScrnJimaku_c::~dMsgScrnJimaku_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpLight_c; + JKR_DELETE(mpLight_c); mpLight_c = NULL; if (mCharInfoPtr != NULL) { @@ -141,15 +141,15 @@ dMsgScrnJimaku_c::~dMsgScrnJimaku_c() { mCharInfoPtr = NULL; } - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; for (int i = 0; i < 2; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; if (mpTmr_c[i] != NULL) { - delete mpTmr_c[i]; + JKR_DELETE(mpTmr_c[i]); mpTmr_c[i] = NULL; } } diff --git a/src/d/d_msg_scrn_kanban.cpp b/src/d/d_msg_scrn_kanban.cpp index 681986c25a..a9edbef7df 100644 --- a/src/d/d_msg_scrn_kanban.cpp +++ b/src/d/d_msg_scrn_kanban.cpp @@ -23,7 +23,7 @@ dMsgScrnKanban_c::dMsgScrnKanban_c(JKRExpHeap* param_0) { s32 uVar14 = field_0xd4->getTotalFreeSize(); init(); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(43, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_kanban_stone_a.blo", 0x1020000, dComIfGp_getMsgArchive(2)); @@ -39,7 +39,7 @@ dMsgScrnKanban_c::dMsgScrnKanban_c(JKRExpHeap* param_0) { field_0xd0->searchUpdateMaterialID(mpScreen); field_0xd8 = 0.0f; - mpPmP_c = new CPaneMgr(mpScreen, MULTI_CHAR('n_size'), 2, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_size'), 2, NULL); JUT_ASSERT(60, mpPmP_c != NULL); mpPmP_c->getPanePtr()->setAnimation(field_0xcc); @@ -48,10 +48,10 @@ dMsgScrnKanban_c::dMsgScrnKanban_c(JKRExpHeap* param_0) { mpPmP_c->getPanePtr()->setAnimation((J2DAnmTransform*)NULL); mpPmP_c->scale(g_MsgObject_HIO_c.mBoxStoneScaleX, g_MsgObject_HIO_c.mBoxStoneScaleY); - mpBack_c = new CPaneMgr(mpScreen, MULTI_CHAR('back_b'), 0, NULL); + mpBack_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('back_b'), 0, NULL); JUT_ASSERT(68, mpBack_c != NULL); - mpSpot_c = new CPaneMgr(mpScreen, MULTI_CHAR('spot00'), 0, NULL); + mpSpot_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('spot00'), 0, NULL); JUT_ASSERT(72, mpSpot_c != NULL); mpSpot_c->getPanePtr()->setAnimation(field_0xd0); @@ -61,7 +61,7 @@ dMsgScrnKanban_c::dMsgScrnKanban_c(JKRExpHeap* param_0) { if (dComIfGs_getOptRuby() != 0) { static u64 const t_tag[3] = {MULTI_CHAR('mg_3line'), 't3_w', 't3_s'}; for (int i = 0; i < 3; i++) { - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); } @@ -73,10 +73,10 @@ dMsgScrnKanban_c::dMsgScrnKanban_c(JKRExpHeap* param_0) { static u64 const tr_tag[3] = {MULTI_CHAR('mg_3f'), MULTI_CHAR('mg_3f_w'), MULTI_CHAR('mg_3f_s')}; for (int i = 0; i < 3; i++) { - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag_2[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag_2[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); - mpTmr_c[i] = new CPaneMgr(mpScreen, tr_tag[i], 0, NULL); + mpTmr_c[i] = JKR_NEW CPaneMgr(mpScreen, tr_tag[i], 0, NULL); ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); } @@ -88,7 +88,7 @@ dMsgScrnKanban_c::dMsgScrnKanban_c(JKRExpHeap* param_0) { static u64 const t_tag[3] = {MULTI_CHAR('mg_e4lin'), 'f4_w', 't4_s'}; for (int i = 0; i < 3; i++) { - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); JUT_ASSERT(81, mpTm_c[i] != NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); } @@ -129,29 +129,29 @@ dMsgScrnKanban_c::dMsgScrnKanban_c(JKRExpHeap* param_0) { } dMsgScrnKanban_c::~dMsgScrnKanban_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete field_0xcc; + JKR_DELETE(field_0xcc); field_0xcc = NULL; - delete field_0xd0; + JKR_DELETE(field_0xd0); field_0xd0 = NULL; - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; - delete mpBack_c; + JKR_DELETE(mpBack_c); mpBack_c = NULL; - delete mpSpot_c; + JKR_DELETE(mpSpot_c); mpSpot_c = NULL; for (int i = 0; i < 3; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; if (mpTmr_c[i] != NULL) { - delete mpTmr_c[i]; + JKR_DELETE(mpTmr_c[i]); mpTmr_c[i] = NULL; } } diff --git a/src/d/d_msg_scrn_light.cpp b/src/d/d_msg_scrn_light.cpp index 55872b72fb..4635a8e680 100644 --- a/src/d/d_msg_scrn_light.cpp +++ b/src/d/d_msg_scrn_light.cpp @@ -126,7 +126,7 @@ dMsgScrnLight_c::dMsgScrnLight_c(u8 i_colorType, u8 param_1) { g_MsgScrnLight_HIO_c.updateColor(i_colorType); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_message_window_text_light.blo", 0x20000, dComIfGp_getMain2DArchive()); @@ -143,7 +143,7 @@ dMsgScrnLight_c::dMsgScrnLight_c(u8 i_colorType, u8 param_1) { mpBpk->searchUpdateMaterialID(mpScreen); mBpkFrame = 0.0f; - mpParent_c = new CPaneMgr(mpScreen, MULTI_CHAR('moya00'), 0, NULL); + mpParent_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('moya00'), 0, NULL); JUT_ASSERT(0, mpParent_c != NULL); mpParent_c->getPanePtr()->setAnimation(mpBck); @@ -155,16 +155,16 @@ dMsgScrnLight_c::dMsgScrnLight_c(u8 i_colorType, u8 param_1) { dMsgScrnLight_c::~dMsgScrnLight_c() { l_lightCount--; - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpBck; + JKR_DELETE(mpBck); mpBck = NULL; - delete mpBpk; + JKR_DELETE(mpBpk); mpBpk = NULL; - delete mpParent_c; + JKR_DELETE(mpParent_c); mpParent_c = NULL; } diff --git a/src/d/d_msg_scrn_place.cpp b/src/d/d_msg_scrn_place.cpp index c9c76484c6..881852c259 100644 --- a/src/d/d_msg_scrn_place.cpp +++ b/src/d/d_msg_scrn_place.cpp @@ -27,7 +27,7 @@ dMsgScrnPlace_c::dMsgScrnPlace_c() { mScaleX = 0.0f; } - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); #if VERSION == VERSION_GCN_JPN mpScreen->setPriority("zelda_stage_title.blo", 0x20000, dComIfGp_getMsgArchive(4)); #else @@ -35,23 +35,23 @@ dMsgScrnPlace_c::dMsgScrnPlace_c() { #endif dPaneClass_showNullPane(mpScreen); - mpPmP_c = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); mpPmP_c->scale(g_MsgObject_HIO_c.mStageTitleScaleX, g_MsgObject_HIO_c.mStageTitleScaleY); - mpFontParent = new CPaneMgr(mpScreen, MULTI_CHAR('s_font_n'), 0, NULL); + mpFontParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('s_font_n'), 0, NULL); mpFontParent->scale(g_MsgObject_HIO_c.mStageTitleCharSizeX, g_MsgObject_HIO_c.mStageTitleCharSizeY); mpFontParent->paneTrans(g_MsgObject_HIO_c.mStageTitleCharPosX, g_MsgObject_HIO_c.mStageTitleCharPosY - mScaleX); - mpBaseParent = new CPaneMgr(mpScreen, MULTI_CHAR('base_n'), 2, NULL); + mpBaseParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('base_n'), 2, NULL); mpBaseParent->scale(g_MsgObject_HIO_c.mStageTitleBaseSizeX, g_MsgObject_HIO_c.mStageTitleBaseSizeY); mpBaseParent->paneTrans(g_MsgObject_HIO_c.mStageTitleBasePosX, g_MsgObject_HIO_c.mStageTitleBasePosY - mScaleY); for (int i = 0; i < 7; i++) { - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getRubyFont()); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x80, ""); #if VERSION != VERSION_GCN_JPN @@ -76,20 +76,20 @@ dMsgScrnPlace_c::dMsgScrnPlace_c() { } dMsgScrnPlace_c::~dMsgScrnPlace_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; - delete mpFontParent; + JKR_DELETE(mpFontParent); mpFontParent = NULL; - delete mpBaseParent; + JKR_DELETE(mpBaseParent); mpBaseParent = NULL; for (int i = 0; i < 7; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; } diff --git a/src/d/d_msg_scrn_staff.cpp b/src/d/d_msg_scrn_staff.cpp index 1f92124146..4d7d8cbe2b 100644 --- a/src/d/d_msg_scrn_staff.cpp +++ b/src/d/d_msg_scrn_staff.cpp @@ -21,16 +21,16 @@ dMsgScrnStaff_c::dMsgScrnStaff_c(u8 unused) { field_0xd0 = 0.0f; field_0xcc = 0.0f; - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); mpScreen->setPriority("zelda_staff_roll.blo", 0x20000, dComIfGp_getMsgArchive(6)); dPaneClass_showNullPane(mpScreen); - mpPmP_c = new CPaneMgr(mpScreen, 'ROOT', 2, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, 'ROOT', 2, NULL); mpScreen->search(MULTI_CHAR('left_n'))->hide(); mpScreen->search(MULTI_CHAR('right_n'))->hide(); for (int i = 0; i < 6; i++) { - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(mDoExt_getMesgFont()); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x200, ""); } @@ -52,14 +52,14 @@ dMsgScrnStaff_c::dMsgScrnStaff_c(u8 unused) { } dMsgScrnStaff_c::~dMsgScrnStaff_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; for (int i = 0; i < 6; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = 0; } diff --git a/src/d/d_msg_scrn_talk.cpp b/src/d/d_msg_scrn_talk.cpp index 941e984fbd..226ece0304 100644 --- a/src/d/d_msg_scrn_talk.cpp +++ b/src/d/d_msg_scrn_talk.cpp @@ -27,13 +27,13 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { field_0xe4 = dComIfGp_getSubHeap2D(7); } init(); - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(70, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_message_window_new.blo", 0x20000, dComIfGp_getMsgArchive(1)); JUT_ASSERT(77, fg != false); dPaneClass_showNullPane(mpScreen); - mpTxScreen = new J2DScreen(); + mpTxScreen = JKR_NEW J2DScreen(); JUT_ASSERT(81, mpTxScreen != NULL); if (dMsgObject_getMsgObjectClass()->getFukiKind() == 8) { fg = mpTxScreen->setPriority("zelda_message_window_text_seirei.blo", 0x20000, @@ -44,10 +44,10 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { } JUT_ASSERT(90, fg != false); dPaneClass_showNullPane(mpTxScreen); - mpArrow_c = new dMsgScrnArrow_c(); + mpArrow_c = JKR_NEW dMsgScrnArrow_c(); JUT_ASSERT(95, mpArrow_c != NULL); if (dComIfGp_isHeapLockFlag() != 3) { - mpSelect_c = new dMsgScrn3Select_c(); + mpSelect_c = JKR_NEW dMsgScrn3Select_c(); JUT_ASSERT(100, mpSelect_c != NULL); } else { mpSelect_c = NULL; @@ -68,7 +68,7 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { break; } - mpLight_c = new dMsgScrnLight_c(uVar22, param_2); + mpLight_c = JKR_NEW dMsgScrnLight_c(uVar22, param_2); JUT_ASSERT(123, mpLight_c != NULL); void* mpBuf = field_0xe4->alloc(0x106a, 0x20); JUT_ASSERT(126, mpBuf != NULL); @@ -88,11 +88,11 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { mpScreen->search(MULTI_CHAR('mg_null'))->move( mpScreen->search(MULTI_CHAR('mg_null'))->getBounds().i.x + g_MsgObject_HIO_c.mTextPosX, mpScreen->search(MULTI_CHAR('mg_null'))->getBounds().i.y + g_MsgObject_HIO_c.mTextPosY); - mpArw_c = new CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); + mpArw_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('set_ya_n'), 0, NULL); JUT_ASSERT(147, mpArw_c != NULL); - mpMg_c[0] = new CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpMg_c[0] = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(150, mpMg_c[0] != NULL); - mpMg_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_null'), 0, NULL); + mpMg_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_null'), 0, NULL); JUT_ASSERT(153, mpMg_c[1] != NULL); OSInitFastCast(); @@ -102,42 +102,42 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { field_0xf4 = -10.0f; #endif fukiPosCalc(param_1); - mpPmP_c = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 3, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 3, NULL); JUT_ASSERT(176, mpPmP_c != NULL); mpPmP_c->scale(g_MsgObject_HIO_c.mBoxTalkScaleX, g_MsgObject_HIO_c.mBoxTalkScaleY); #if VERSION == VERSION_GCN_JPN if (dComIfGs_getOptRuby() == 0) { - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3flin'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s'), 0, NULL); - mpTmr_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); + mpTmr_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f'), 0, NULL); if (dMsgObject_getMsgObjectClass()->getFukiKind() == 8) { - mpTm_c[2] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s1'), 0, NULL); - mpTm_c[3] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s2'), 0, NULL); - mpTm_c[4] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s3'), 0, NULL); - mpTm_c[5] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s4'), 0, NULL); - mpTmr_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s1'), 0, NULL); - mpTmr_c[2] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s2'), 0, NULL); + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s1'), 0, NULL); + mpTm_c[3] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s2'), 0, NULL); + mpTm_c[4] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s3'), 0, NULL); + mpTm_c[5] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3f_s4'), 0, NULL); + mpTmr_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s1'), 0, NULL); + mpTmr_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s2'), 0, NULL); } else { - mpTmr_c[1] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); + mpTmr_c[1] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3f_s'), 0, NULL); } mpTxScreen->search(MULTI_CHAR('n_3line'))->hide(); mpTxScreen->search(MULTI_CHAR('n_3fline'))->show(); mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); } else { - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, 't3_s', 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_3line'), 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't3_s', 0, NULL); if (dMsgObject_getMsgObjectClass()->getFukiKind() == 8) { - mpTm_c[2] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s1'), 0, NULL); + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s1'), 0, NULL); JUT_ASSERT(189, mpTm_c[2] != NULL); - mpTm_c[3] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s2'), 0, NULL); + mpTm_c[3] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s2'), 0, NULL); JUT_ASSERT(191, mpTm_c[3] != NULL); - mpTm_c[4] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s3'), 0, NULL); + mpTm_c[4] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s3'), 0, NULL); JUT_ASSERT(193, mpTm_c[4] != NULL); - mpTm_c[5] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s4'), 0, NULL); + mpTm_c[5] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t3_s4'), 0, NULL); JUT_ASSERT(193, mpTm_c[5] != NULL); } @@ -146,19 +146,19 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { mpTxScreen->search(MULTI_CHAR('n_e4line'))->hide(); } #else - mpTm_c[0] = new CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); + mpTm_c[0] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('mg_e4lin'), 0, NULL); JUT_ASSERT(182, mpTm_c[0] != NULL); - mpTm_c[1] = new CPaneMgr(mpTxScreen, 't4_s', 0, NULL); + mpTm_c[1] = JKR_NEW CPaneMgr(mpTxScreen, 't4_s', 0, NULL); JUT_ASSERT(185, mpTm_c[1] != NULL); if (dMsgObject_getMsgObjectClass()->getFukiKind() == 8) { - mpTm_c[2] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s1'), 0, NULL); + mpTm_c[2] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s1'), 0, NULL); JUT_ASSERT(189, mpTm_c[2] != NULL); - mpTm_c[3] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s2'), 0, NULL); + mpTm_c[3] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s2'), 0, NULL); JUT_ASSERT(191, mpTm_c[3] != NULL); - mpTm_c[4] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s3'), 0, NULL); + mpTm_c[4] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s3'), 0, NULL); JUT_ASSERT(193, mpTm_c[4] != NULL); - mpTm_c[5] = new CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s4'), 0, NULL); + mpTm_c[5] = JKR_NEW CPaneMgr(mpTxScreen, MULTI_CHAR('t4_s4'), 0, NULL); JUT_ASSERT(193, mpTm_c[5] != NULL); } @@ -245,37 +245,37 @@ dMsgScrnTalk_c::dMsgScrnTalk_c(u8 param_1, u8 param_2, JKRExpHeap* param_3) { } dMsgScrnTalk_c::~dMsgScrnTalk_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete mpTxScreen; + JKR_DELETE(mpTxScreen); mpTxScreen = NULL; - delete mpArrow_c; + JKR_DELETE(mpArrow_c); mpArrow_c = NULL; if (mpSelect_c != NULL) { - delete mpSelect_c; + JKR_DELETE(mpSelect_c); mpSelect_c = NULL; } - delete mpLight_c; + JKR_DELETE(mpLight_c); mpLight_c = NULL; if (mCharInfoPtr != NULL) { field_0xe4->free(mCharInfoPtr); mCharInfoPtr = NULL; } - delete mpArw_c; + JKR_DELETE(mpArw_c); mpArw_c = NULL; for (int i = 0; i < 2; i++) { - delete mpMg_c[i]; + JKR_DELETE(mpMg_c[i]); mpMg_c[i] = NULL; } - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; for (int i = 0; i < 6; i++) { if (mpTm_c[i] != NULL) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; } if (mpTmr_c[i] != NULL) { - delete mpTmr_c[i]; + JKR_DELETE(mpTmr_c[i]); mpTmr_c[i] = NULL; } } diff --git a/src/d/d_msg_scrn_tree.cpp b/src/d/d_msg_scrn_tree.cpp index eb29b1e266..0dee41ef5a 100644 --- a/src/d/d_msg_scrn_tree.cpp +++ b/src/d/d_msg_scrn_tree.cpp @@ -25,7 +25,7 @@ dMsgScrnTree_c::dMsgScrnTree_c(JUTFont* param_0, JKRExpHeap* param_1) { field_0x54 = param_0; } - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); mpScreen->setPriority("zelda_kanban_wood_a.blo", 0x1020000, dComIfGp_getMsgArchive(2)); dPaneClass_showNullPane(mpScreen); @@ -44,15 +44,15 @@ dMsgScrnTree_c::dMsgScrnTree_c(JUTFont* param_0, JKRExpHeap* param_1) { field_0xd4->searchUpdateMaterialID(mpScreen); field_0xe0 = 0.0f; - mpPmP_c = new CPaneMgr(mpScreen, MULTI_CHAR('n_size'), 2, NULL); + mpPmP_c = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_size'), 2, NULL); mpPmP_c->getPanePtr()->setAnimation(field_0xcc); field_0xcc->setFrame(1.0f); mpPmP_c->getPanePtr()->animationTransform(); mpPmP_c->getPanePtr()->setAnimation((J2DAnmTransform*)NULL); mpPmP_c->scale(g_MsgObject_HIO_c.mBoxWoodScaleX, g_MsgObject_HIO_c.mBoxWoodScaleY); - field_0xc4 = new CPaneMgr(mpScreen, MULTI_CHAR('back_b'), 0, NULL); - field_0xc8 = new CPaneMgr(mpScreen, MULTI_CHAR('spot00'), 0, NULL); + field_0xc4 = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('back_b'), 0, NULL); + field_0xc8 = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('spot00'), 0, NULL); field_0xc8->getPanePtr()->setAnimation(field_0xd0); mpScreen->search(MULTI_CHAR('white_m'))->setAnimation(field_0xd4); @@ -62,7 +62,7 @@ dMsgScrnTree_c::dMsgScrnTree_c(JUTFont* param_0, JKRExpHeap* param_1) { for (int i = 0; i < 3; i++) { static u64 const t_tag[3] = {MULTI_CHAR('mg_3line'), 't3_w', 't3_s'}; - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(field_0x54); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x210, ""); } @@ -75,11 +75,11 @@ dMsgScrnTree_c::dMsgScrnTree_c(JUTFont* param_0, JKRExpHeap* param_1) { static u64 const t_tag[3] = {MULTI_CHAR('t3fline'), MULTI_CHAR('t3f_w'), MULTI_CHAR('t3f_s')}; static u64 const tr_tag[3] = {MULTI_CHAR('mg_3f'), MULTI_CHAR('mg_3f_w'), MULTI_CHAR('mg_3f_s')}; - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(field_0x54); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x210, ""); - mpTmr_c[i] = new CPaneMgr(mpScreen, tr_tag[i], 0, NULL); + mpTmr_c[i] = JKR_NEW CPaneMgr(mpScreen, tr_tag[i], 0, NULL); ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setFont(field_0x54); ((J2DTextBox*)mpTmr_c[i]->getPanePtr())->setString(0x210, ""); } @@ -92,7 +92,7 @@ dMsgScrnTree_c::dMsgScrnTree_c(JUTFont* param_0, JKRExpHeap* param_1) { for (int i = 0; i < 3; i++) { static u64 const t_tag[3] = {MULTI_CHAR('mg_e4lin'), 'f4_w', 't4_s'}; - mpTm_c[i] = new CPaneMgr(mpScreen, t_tag[i], 0, NULL); + mpTm_c[i] = JKR_NEW CPaneMgr(mpScreen, t_tag[i], 0, NULL); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setFont(field_0x54); ((J2DTextBox*)mpTm_c[i]->getPanePtr())->setString(0x200, ""); } @@ -132,33 +132,33 @@ dMsgScrnTree_c::dMsgScrnTree_c(JUTFont* param_0, JKRExpHeap* param_1) { } dMsgScrnTree_c::~dMsgScrnTree_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; - delete field_0xcc; + JKR_DELETE(field_0xcc); field_0xcc = NULL; - delete field_0xd0; + JKR_DELETE(field_0xd0); field_0xd0 = NULL; - delete field_0xd4; + JKR_DELETE(field_0xd4); field_0xd4 = NULL; - delete mpPmP_c; + JKR_DELETE(mpPmP_c); mpPmP_c = NULL; - delete field_0xc4; + JKR_DELETE(field_0xc4); field_0xc4 = NULL; - delete field_0xc8; + JKR_DELETE(field_0xc8); field_0xc8 = NULL; for (int i = 0; i < 3; i++) { - delete mpTm_c[i]; + JKR_DELETE(mpTm_c[i]); mpTm_c[i] = NULL; if (mpTmr_c[i]) { - delete mpTmr_c[i]; + JKR_DELETE(mpTmr_c[i]); mpTmr_c[i] = NULL; } } diff --git a/src/d/d_msg_string.cpp b/src/d/d_msg_string.cpp index 8d4e29dd40..c180093010 100644 --- a/src/d/d_msg_string.cpp +++ b/src/d/d_msg_string.cpp @@ -6,20 +6,20 @@ dMsgString_c::dMsgString_c() { field_0x28 = 0; - mpOutFont = new COutFont_c(field_0x28); + mpOutFont = JKR_NEW COutFont_c(field_0x28); mpOutFont->createPane(); getResource(); } dMsgString_c::dMsgString_c(u8 param_0) { field_0x28 = param_0; - mpOutFont = new COutFont_c(field_0x28); + mpOutFont = JKR_NEW COutFont_c(field_0x28); mpOutFont->createPane(); getResource(); } dMsgString_c::~dMsgString_c() { - delete mpOutFont; + JKR_DELETE(mpOutFont); mpOutFont = NULL; } diff --git a/src/d/d_msg_string_base.cpp b/src/d/d_msg_string_base.cpp index 2a57a87fb8..7346047661 100644 --- a/src/d/d_msg_string_base.cpp +++ b/src/d/d_msg_string_base.cpp @@ -15,17 +15,17 @@ dMsgStringBase_c::dMsgStringBase_c() { field_0x20 = 0; getResource(); - mpResCont = new JMessage::TResourceContainer(); + mpResCont = JKR_NEW JMessage::TResourceContainer(); JUT_ASSERT(33, mpResCont != NULL); - mpCtrl = new jmessage_string_tControl(); + mpCtrl = JKR_NEW jmessage_string_tControl(); JUT_ASSERT(36, mpCtrl != NULL); - mpRefer = new jmessage_string_tReference(); + mpRefer = JKR_NEW jmessage_string_tReference(); JUT_ASSERT(39, mpRefer != NULL); - mpSeqProc = new jmessage_string_tSequenceProcessor(mpRefer, mpCtrl); + mpSeqProc = JKR_NEW jmessage_string_tSequenceProcessor(mpRefer, mpCtrl); JUT_ASSERT(42, mpSeqProc != NULL); - mpRenProc = new jmessage_string_tRenderingProcessor(mpRefer); + mpRenProc = JKR_NEW jmessage_string_tRenderingProcessor(mpRefer); JUT_ASSERT(45, mpRenProc != NULL); - mpParse = new JMessage::TParse(mpResCont); + mpParse = JKR_NEW JMessage::TParse(mpResCont); JUT_ASSERT(48, mpParse != NULL); mpRefer->setResourceContainer(mpResCont); mpCtrl->setSequenceProcessor(mpSeqProc); @@ -37,17 +37,17 @@ dMsgStringBase_c::dMsgStringBase_c() { dMsgStringBase_c::~dMsgStringBase_c() { mpResCont->destroyResource_all(); - delete mpResCont; + JKR_DELETE(mpResCont); mpResCont = NULL; - delete mpCtrl; + JKR_DELETE(mpCtrl); mpCtrl = NULL; - delete mpRefer; + JKR_DELETE(mpRefer); mpRefer = NULL; - delete mpSeqProc; + JKR_DELETE(mpSeqProc); mpSeqProc = NULL; - delete mpRenProc; + JKR_DELETE(mpRenProc); mpRenProc = NULL; - delete mpParse; + JKR_DELETE(mpParse); mpParse = NULL; void* iVar1 = dMeter2Info_getMsgResource(); diff --git a/src/d/d_name.cpp b/src/d/d_name.cpp index e5d4f84506..ee51e2e583 100644 --- a/src/d/d_name.cpp +++ b/src/d/d_name.cpp @@ -104,32 +104,32 @@ dName_c::dName_c(J2DPane* pane) { } dName_c::~dName_c() { - delete stick; - delete nameIn.NameInScr; + JKR_DELETE(stick); + JKR_DELETE(nameIn.NameInScr); mDoExt_removeMesgFont(); for (int i = 0; i < 8; i++) { - delete mNameCursor[i]; + JKR_DELETE(mNameCursor[i]); } for (int i = 0; i < 65; i++) { - delete mMojiIcon[i]; + JKR_DELETE(mMojiIcon[i]); } for (int i = 0; i < 4; i++) { if (mMenuIcon[i] != NULL) { - delete mMenuIcon[i]; + JKR_DELETE(mMenuIcon[i]); } } - delete mCursorColorKey; - delete mCursorTexKey; - delete mSelIcon; + JKR_DELETE(mCursorColorKey); + JKR_DELETE(mCursorTexKey); + JKR_DELETE(mSelIcon); archive->removeResourceAll(); } void dName_c::_create() { - stick = new STControl(5, 2, 2, 1, 0.9f, 0.5f, 0, 0x800); + stick = JKR_NEW STControl(5, 2, 2, 1, 0.9f, 0.5f, 0, 0x800); stick->setFirstWaitTime(5); nameIn.font = mDoExt_getMesgFont(); g_nmHIO.field_0x4 = -1; @@ -1345,7 +1345,7 @@ void dName_c::screenSet() { MULTI_CHAR('s__n_00'), MULTI_CHAR('s__n_01'), MULTI_CHAR('s__n_02'), MULTI_CHAR('s__n_03'), MULTI_CHAR('s__n_04'), MULTI_CHAR('s__n_05'), MULTI_CHAR('s__n_06'), MULTI_CHAR('s__n_07'), }; - nameIn.NameInScr = new J2DScreen(); + nameIn.NameInScr = JKR_NEW J2DScreen(); JUT_ASSERT(0, nameIn.NameInScr != NULL); archive = dComIfGp_getNameResArchive(); @@ -1402,7 +1402,7 @@ void dName_c::screenSet() { mMenuText[i] = NULL; } else { #endif - mMenuIcon[i] = new CPaneMgr(nameIn.NameInScr, l_menu_icon_tag[i], 1, NULL); + mMenuIcon[i] = JKR_NEW CPaneMgr(nameIn.NameInScr, l_menu_icon_tag[i], 1, NULL); char buf[16]; fopMsgM_messageGet(buf, l_menu_msg[i]); @@ -1429,7 +1429,7 @@ void dName_c::screenSet() { mMojiPane = nameIn.NameInScr->search(MULTI_CHAR('moji_n')); for (u32 i = 0; i < 65; i++) { - mMojiIcon[i] = new CPaneMgr(nameIn.NameInScr, l_tagName[i], 2, NULL); + mMojiIcon[i] = JKR_NEW CPaneMgr(nameIn.NameInScr, l_tagName[i], 2, NULL); ((J2DTextBox*)mMojiIcon[i]->getPanePtr())->setFont(nameIn.font); ((J2DTextBox*)mMojiIcon[i]->getPanePtr())->setString(72, ""); mMojiText[i] = ((J2DTextBox*)mMojiIcon[i]->getPanePtr())->getStringPtr(); @@ -1437,7 +1437,7 @@ void dName_c::screenSet() { J2DPane* nameTagPane[8]; for (int i = 0; i < 8; i++) { - mNameCursor[i] = new CPaneMgrAlpha(nameIn.NameInScr, l_nameCurTagName[i], 2, NULL); + mNameCursor[i] = JKR_NEW CPaneMgrAlpha(nameIn.NameInScr, l_nameCurTagName[i], 2, NULL); nameTagPane[i] = nameIn.NameInScr->search(l_nameTagName[i]); ((J2DTextBox*)nameTagPane[i])->setFont(nameIn.font); ((J2DTextBox*)nameTagPane[i])->setString(72, ""); @@ -1482,7 +1482,7 @@ void dName_c::screenSet() { mCharColumn = 0; mCharRow = 0; - mSelIcon = new dSelect_cursor_c(0, 1.0f, NULL); + mSelIcon = JKR_NEW dSelect_cursor_c(0, 1.0f, NULL); JUT_ASSERT(0, mSelIcon != NULL); mSelIcon->setParam(0.82f, 0.77f, 0.05f, 0.4f, 0.4f); diff --git a/src/d/d_ovlp_fade2.cpp b/src/d/d_ovlp_fade2.cpp index 6a9dbd8740..dffd9900d9 100644 --- a/src/d/d_ovlp_fade2.cpp +++ b/src/d/d_ovlp_fade2.cpp @@ -226,7 +226,7 @@ static int dOvlpFd2_Delete(dOvlpFd2_c* i_this) { } static int dOvlpFd2_Create(void* i_this) { - new (i_this) dOvlpFd2_c(); + JKR_NEW_ARGS (i_this) dOvlpFd2_c(); return cPhs_COMPLEATE_e; } diff --git a/src/d/d_ovlp_fade3.cpp b/src/d/d_ovlp_fade3.cpp index 8911220768..04f8bced7d 100644 --- a/src/d/d_ovlp_fade3.cpp +++ b/src/d/d_ovlp_fade3.cpp @@ -224,7 +224,7 @@ static int dOvlpFd3_Delete(dOvlpFd3_c* i_this) { } static int dOvlpFd3_Create(void* i_this) { - new (i_this) dOvlpFd3_c(); + JKR_NEW_ARGS (i_this) dOvlpFd3_c(); return cPhs_COMPLEATE_e; } diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index c7354678b1..fda250e578 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -632,14 +632,14 @@ void dPa_modelEcallBack::setup(JPABaseEmitter* i_emitter, cXyz const* param_1, c } void dPa_modelEcallBack::create(u8 param_0) { - mModel = new model_c[param_0]; + mModel = JKR_NEW model_c[param_0]; struct_80450E9C = param_0; struct_80450E9D = 0; } void dPa_modelEcallBack::remove() { if (mModel != NULL) { - delete [] mModel; + JKR_DELETE_ARRAY(mModel); mModel = NULL; } } @@ -767,7 +767,7 @@ JPABaseEmitter* dPa_simpleEcallBack::create(JPAEmitterManager* param_0, u16 id, field_0xa = param_2; mID = id; field_0xe = 0x20; - mData = new dPa_simpleData_c[field_0xe]; + mData = JKR_NEW dPa_simpleData_c[field_0xe]; JUT_ASSERT(1747, mData != NULL); createEmitter(param_0); return mEmitter; @@ -1203,10 +1203,10 @@ void dPa_control_c::createCommon(void const* param_0) { mHeap = mDoExt_createSolidHeapFromSystem(0, 0); JKRHEAP_NAME(mHeap, "dPa_control_c::mHeap"); JUT_ASSERT(2518, mHeap != NULL); - mCommonResMng = new (mHeap, 0) JPAResourceManager(param_0, mHeap); + mCommonResMng = JKR_NEW_ARGS (mHeap, 0) JPAResourceManager(param_0, mHeap); JUT_ASSERT(2521, mCommonResMng != NULL); mCommonResMng->swapTexture(mDoGph_gInf_c::getFrameBufferTimg(), "dummy"); - mEmitterMng = new (mHeap, 0) JPAEmitterManager(3000, 250, *(JKRHeap**)this, 0x13, 2); + mEmitterMng = JKR_NEW_ARGS (mHeap, 0) JPAEmitterManager(3000, 250, mHeap, 0x13, 2); JUT_ASSERT(2531, mEmitterMng != NULL); mEmitterMng->entryResourceManager(mCommonResMng, 0); JKRHeap* prevHeap = mDoExt_setCurrentHeap(mHeap); @@ -1229,7 +1229,7 @@ void dPa_control_c::createRoomScene() { mSceneHeap = mDoExt_createSolidHeapFromGame(0, 0); JKRHEAP_NAME(mSceneHeap, "dPa_control_c::mSceneHeap"); JUT_ASSERT(2573, mSceneHeap != NULL); - mSceneResMng = new (mSceneHeap, 0) JPAResourceManager(m_sceneRes, mSceneHeap); + mSceneResMng = JKR_NEW_ARGS (mSceneHeap, 0) JPAResourceManager(m_sceneRes, mSceneHeap); JUT_ASSERT(2576, mSceneResMng != NULL); mSceneResMng->swapTexture(mDoGph_gInf_c::getFrameBufferTimg(), "dummy"); mEmitterMng->entryResourceManager(mSceneResMng, 1); diff --git a/src/d/d_resorce.cpp b/src/d/d_resorce.cpp index ddd1adc727..9bcbd1c3a1 100644 --- a/src/d/d_resorce.cpp +++ b/src/d/d_resorce.cpp @@ -16,11 +16,11 @@ #include "f_ap/f_ap_game.h" #include "f_op/f_op_camera_mng.h" #include "m_Do/m_Do_graphic.h" +#include "res/Object/Always.h" #include #include #ifndef __MWERKS__ -#include #include "dusk/extras.h" #endif @@ -100,9 +100,11 @@ static void setIndirectTex(J3DModelData* i_modelData) { if (memcmp(textureName, "dummy", 6) == 0) { texture->setResTIMG(i, *mDoGph_gInf_c::getFrameBufferTimg()); } +#if !TARGET_PC if (memcmp(textureName, "Zbuffer", 8) == 0) { texture->setResTIMG(i, *mDoGph_gInf_c::getZbufferTimg()); } +#endif } } @@ -132,14 +134,14 @@ static void addWarpMaterial(J3DModelData* i_modelData) { }; static J3DAlphaCompInfo const l_alphaCompInfo = {0x04, 0x80, 0x00, 0x03, 0xFF}; - ResTIMG* resTimg = (ResTIMG*)dComIfG_getObjectRes("Always", 0x5d); + ResTIMG* resTimg = (ResTIMG*)dComIfG_getObjectRes("Always", dRes_ID_ALWAYS_BTI_WARP_TEX_e); JUT_ASSERT(279, resTimg != NULL); J3DTexture* texture = i_modelData->getTexture(); u16 textureNum = texture->getNum(); texture->addResTIMG(1, resTimg - textureNum); - J3DTexMtx* newTexMtx = new J3DTexMtx(l_texMtxInfo); + J3DTexMtx* newTexMtx = JKR_NEW J3DTexMtx(l_texMtxInfo); JUT_ASSERT(285, newTexMtx != NULL); for (u16 i = 0; i < i_modelData->getMaterialNum(); i++) { @@ -149,7 +151,7 @@ static void addWarpMaterial(J3DModelData* i_modelData) { JUT_ASSERT(290, texGenNum < 4); J3DTexCoord* coord = texGenBlock->getTexCoord(texGenNum); - l_texCoordInfo.mTexGenMtx = texGenNum * 3 + 0x1e; + l_texCoordInfo.mTexGenMtx = texGenNum * 3 + GX_TEXMTX0; coord->setTexCoordInfo(l_texCoordInfo); coord->resetTexMtxReg(); @@ -166,7 +168,7 @@ static void addWarpMaterial(J3DModelData* i_modelData) { tevBlock->setTevStageNum(tevStageNum + 1); J3DShape* shape = material->getShape(); - GXAttr attr = (GXAttr)(texGenNum + 1); + GXAttr attr = (GXAttr)(texGenNum + GX_VA_TEX0MTXIDX); shape->addTexMtxIndexInDL(attr, 0); shape->addTexMtxIndexInVcd(attr); @@ -277,7 +279,7 @@ J3DModelData* dRes_info_c::loaderBasicBmd(u32 i_tag, void* i_data) { material->getColorChan(0)->setLightMask(lightMask); material->change(); - materialAnm = new J3DMaterialAnm(); + materialAnm = JKR_NEW J3DMaterialAnm(); if (materialAnm == NULL) { return NULL; } @@ -308,7 +310,7 @@ int dRes_info_c::loadResource() { JUT_ASSERT(709, mRes == NULL); s32 countFile = mArchive->countFile(); - mRes = new void*[countFile]; + mRes = JKR_NEW void*[countFile]; if (mRes == NULL) { OSReport_Error("<%s.arc> setRes: res pointer buffer nothing !!\n", mArchiveName); return -1; @@ -329,6 +331,12 @@ int dRes_info_c::loadResource() { const char* tmp = mArchive->mStringTable + (mArchive->findIdxResource(fileIndex)->type_flags_and_name_offset & 0xFFFFFF); #endif void* res = mArchive->getIdxResource(fileIndex); +#if TARGET_PC + u32 size = mArchive->findIdxResource(fileIndex)->data_size; + std::string fileName = mArchive->mStringTable + + (mArchive->findIdxResource(fileIndex)->type_flags_and_name_offset & 0xFFFFFF); + DuskLog.debug("Loading Resource: {} (Size: {})", fileName, size); +#endif if (res == NULL) { OSReport_Error("<%s> res == NULL !!\n", @@ -374,7 +382,7 @@ int dRes_info_c::loadResource() { J3DMaterial* material_p = modelData->getMaterialNodePointer(k); material_p->change(); - J3DMaterialAnm* materialAnm = new J3DMaterialAnm(); + J3DMaterialAnm* materialAnm = JKR_NEW J3DMaterialAnm(); if (materialAnm == NULL) { return -1; } @@ -474,7 +482,7 @@ int dRes_info_c::loadResource() { } else if (nodeType == 'BCKS' || nodeType == 'BCK ') { struct J3DUnkChunk { u8 unk_data[0x1C]; - u32 some_data_offset; + BE(u32) some_data_offset; }; J3DUnkChunk* chunk = (J3DUnkChunk*)res; void* bas; @@ -485,7 +493,7 @@ int dRes_info_c::loadResource() { bas = NULL; } - mDoExt_transAnmBas* transAnmBas = new mDoExt_transAnmBas(bas); + mDoExt_transAnmBas* transAnmBas = JKR_NEW mDoExt_transAnmBas(bas); if (transAnmBas == NULL) { return -1; } @@ -1000,7 +1008,7 @@ int dRes_control_c::setObjectRes(char const* i_arcName, void* i_archiveRes, u32 return 0; } - JKRMemArchive* memArchive = new JKRMemArchive(i_archiveRes, i_bufferSize, JKRMEMBREAK_FLAG_UNKNOWN0); + JKRMemArchive* memArchive = JKR_NEW JKRMemArchive(i_archiveRes, i_bufferSize, JKRMEMBREAK_FLAG_UNKNOWN0); if (memArchive == NULL || !memArchive->isMounted()) { return 0; } diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index 95d884d9c1..f5f35be35c 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -23,6 +23,8 @@ #include "m_Do/m_Do_main.h" #include "JSystem/JUtility/JUTConsole.h" +#include "dusk/logging.h" + #if !PLATFORM_GCN #include #include @@ -125,14 +127,14 @@ void dLog_HIO_c::genMessage(JORMContext*) {} #endif void dScnLogo_c::preLoad_dyl_create() { - m_preLoad_dylPhase = new request_of_phase_process_class[14]; + m_preLoad_dylPhase = JKR_NEW request_of_phase_process_class[14]; JUT_ASSERT(194, m_preLoad_dylPhase != NULL); memset(m_preLoad_dylPhase, 0, sizeof(request_of_phase_process_class) * 14); } void dScnLogo_c::preLoad_dyl_remove() { - delete[] m_preLoad_dylPhase; + JKR_DELETE_ARRAY(m_preLoad_dylPhase); } typedef void (dScnLogo_c::*execFunc)(); @@ -221,8 +223,7 @@ void dScnLogo_c::checkProgSelect() { int dScnLogo_c::draw() { static int sDrawLogCount = 0; if (sDrawLogCount < 10) { - printf("[DIAG] dScnLogo_c::draw: mExecCommand=%d mTimer=%d\n", mExecCommand, mTimer); - fflush(stdout); + DuskLog.debug("dScnLogo_c::draw: mExecCommand={} mTimer={}", mExecCommand, mTimer); } cLib_calcTimer(&mTimer); (this->*l_execFunc[mExecCommand])(); @@ -775,18 +776,18 @@ dScnLogo_c::~dScnLogo_c() { } #if PLATFORM_WII || PLATFORM_SHIELD - delete mStrapImg; + JKR_DELETE(mStrapImg); #endif #if !(PLATFORM_WII || PLATFORM_SHIELD) - delete mNintendoLogo; - delete mWarning; - delete mWarningStart; - delete mDolbyLogo; - delete mProgressiveChoice; - delete mProgressiveYes; - delete mProgressiveNo; - delete mProgressiveSel; + JKR_DELETE(mNintendoLogo); + JKR_DELETE(mWarning); + JKR_DELETE(mWarningStart); + JKR_DELETE(mDolbyLogo); + JKR_DELETE(mProgressiveChoice); + JKR_DELETE(mProgressiveYes); + JKR_DELETE(mProgressiveNo); + JKR_DELETE(mProgressiveSel); #if VERSION == VERSION_GCN_PAL mpPalLogoResCommand->getArchive()->removeResourceAll(); @@ -796,8 +797,8 @@ dScnLogo_c::~dScnLogo_c() { #endif #if VERSION == VERSION_SHIELD - delete mNvLogo; - delete mMocImg; + JKR_DELETE(mNvLogo); + JKR_DELETE(mMocImg); #endif preLoad_dyl_remove(); @@ -884,7 +885,7 @@ dScnLogo_c::~dScnLogo_c() { #if !PLATFORM_SHIELD mParticleCommand->destroy(); #else - delete mParticleCommand; + JKR_DELETE(mParticleCommand); #endif JKRAramHeap* aram_heap = JKRAram::getAramHeap(); @@ -905,14 +906,14 @@ dScnLogo_c::~dScnLogo_c() { #if !PLATFORM_SHIELD mItemTableCommand->destroy(); #else - delete mItemTableCommand; + JKR_DELETE(mItemTableCommand); #endif dEnemyItem_c::setItemData((u8*)mEnemyItemCommand->getMemAddress()); #if !PLATFORM_SHIELD mEnemyItemCommand->destroy(); #else - delete mEnemyItemCommand; + JKR_DELETE(mEnemyItemCommand); #endif dDlst_shadowControl_c::setSimpleTex((ResTIMG*)dComIfG_getObjectRes("Always", 0x4A)); @@ -1042,18 +1043,18 @@ static int resLoad(request_of_phase_process_class* i_phase, dScnLogo_c* i_this) int dScnLogo_c::create() { static bool sDiagLogged = false; if (!sDiagLogged) { - printf("[DIAG] dScnLogo_c::create START\n"); fflush(stdout); + DuskLog.debug("dScnLogo_c::create START"); } int phase_state = resLoad(&field_0x1c4, this); if (!sDiagLogged) { - printf("[DIAG] dScnLogo_c::create resLoad=%d (need %d for complete)\n", phase_state, cPhs_COMPLEATE_e); fflush(stdout); + DuskLog.debug("dScnLogo_c::create resLoad={} (need {} for complete)", phase_state, fmt::underlying(cPhs_COMPLEATE_e)); sDiagLogged = true; } if (phase_state != cPhs_COMPLEATE_e) { return phase_state; } - printf("[DIAG] dScnLogo_c::create resLoad COMPLETE, continuing init...\n"); fflush(stdout); + DuskLog.debug("dScnLogo_c::create resLoad COMPLETE, continuing init..."); #if PLATFORM_WII data_8053a730 = 1; @@ -1173,14 +1174,14 @@ void dScnLogo_c::logoInitWii() { } JUT_ASSERT(2309, timg != NULL); - mStrapImg = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mStrapImg = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); #if VERSION == VERSION_SHIELD timg = (ResTIMG*)dComIfG_getObjectRes("LogoUsWii", 5); - mNvLogo = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mNvLogo = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); timg = (ResTIMG*)dComIfG_getObjectRes("LogoUsWii", 4); - mMocImg = new dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); + mMocImg = JKR_NEW dDlst_2D_c(timg, 304 - (width / 2), 224 - (height / 2), width, height, 255); #endif OS_REPORT("\x1b[32m%d archiveHeap->getTotalFreeSize %08x\n\x1b[m", 2316, archiveHeap->getTotalFreeSize()); @@ -1204,7 +1205,7 @@ void dScnLogo_c::logoInitWii() { #else void dScnLogo_c::logoInitGC() { ResTIMG* nintendoImg = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 4); - mNintendoLogo = new dDlst_2D_c(nintendoImg, 117, 154, 376, 104, 255); + mNintendoLogo = JKR_NEW dDlst_2D_c(nintendoImg, 117, 154, 376, 104, 255); #if VERSION == VERSION_GCN_JPN mNintendoLogo->getPicture()->setWhite(JUtility::TColor(0, 70, 255, 255)); #else @@ -1212,7 +1213,7 @@ void dScnLogo_c::logoInitGC() { #endif ResTIMG* dolbyImg = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 3); - mDolbyLogo = new dDlst_2D_c(dolbyImg, 189, 150, 232, 112, 255); + mDolbyLogo = JKR_NEW dDlst_2D_c(dolbyImg, 189, 150, 232, 112, 255); #if VERSION == VERSION_GCN_PAL u8 language = getPalLanguage(); @@ -1277,46 +1278,46 @@ void dScnLogo_c::logoInitGC() { }; ResTIMG* warningImg = (ResTIMG*)mpPalLogoResCommand->getArchive()->getResource('DAT ', warning[language]); - mWarning = new dDlst_2D_c(warningImg, 0, 0, FB_WIDTH, FB_HEIGHT, 255); + mWarning = JKR_NEW dDlst_2D_c(warningImg, 0, 0, FB_WIDTH, FB_HEIGHT, 255); ResTIMG* warnStartImg = (ResTIMG*)mpPalLogoResCommand->getArchive()->getResource('DAT ', warningPs[language]); - mWarningStart = new dDlst_2D_c(warnStartImg, 0, 359, FB_WIDTH, 48, 255); + mWarningStart = JKR_NEW dDlst_2D_c(warnStartImg, 0, 359, FB_WIDTH, 48, 255); ResTIMG* progChoiceImg = (ResTIMG*)mpPalLogoResCommand->getArchive()->getResource('DAT ', choice[language]); - mProgressiveChoice = new dDlst_2D_c(progChoiceImg, 113, 143, 416, 210, 255); + mProgressiveChoice = JKR_NEW dDlst_2D_c(progChoiceImg, 113, 143, 416, 210, 255); ResTIMG* progYesImg = (ResTIMG*)mpPalLogoResCommand->getArchive()->getResource('DAT ', yes[language]); - mProgressiveYes = new dDlst_2D_c(progYesImg, 121, 352, 200, 72, 255); + mProgressiveYes = JKR_NEW dDlst_2D_c(progYesImg, 121, 352, 200, 72, 255); mProgressiveYes->getPicture()->setWhite(JUtility::TColor(160, 160, 160, 255)); ResTIMG* progNoImg = (ResTIMG*)mpPalLogoResCommand->getArchive()->getResource('DAT ', no[language]); - mProgressiveNo = new dDlst_2D_c(progNoImg, 320, 352, 200, 72, 255); + mProgressiveNo = JKR_NEW dDlst_2D_c(progNoImg, 320, 352, 200, 72, 255); mProgressiveNo->getPicture()->setWhite(JUtility::TColor(160, 160, 160, 255)); mProgressivePro = (ResTIMG*)mpPalLogoResCommand->getArchive()->getResource('DAT ', prog[language]); mProgressiveInter = (ResTIMG*)mpPalLogoResCommand->getArchive()->getResource('DAT ', intr[language]); - mProgressiveSel = new dDlst_2D_c(mProgressivePro, 153, 309, 336, 88, 255); + mProgressiveSel = JKR_NEW dDlst_2D_c(mProgressivePro, 153, 309, 336, 88, 255); #else ResTIMG* warningImg = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 10); - mWarning = new dDlst_2D_c(warningImg, 0, 0, FB_WIDTH, FB_HEIGHT, 255); + mWarning = JKR_NEW dDlst_2D_c(warningImg, 0, 0, FB_WIDTH, FB_HEIGHT, 255); ResTIMG* warnStartImg = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 11); - mWarningStart = new dDlst_2D_c(warnStartImg, 0, 359, FB_WIDTH, 48, 255); + mWarningStart = JKR_NEW dDlst_2D_c(warnStartImg, 0, 359, FB_WIDTH, 48, 255); ResTIMG* progChoiceImg = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 5); - mProgressiveChoice = new dDlst_2D_c(progChoiceImg, 113, 281, 416, 72, 255); + mProgressiveChoice = JKR_NEW dDlst_2D_c(progChoiceImg, 113, 281, 416, 72, 255); ResTIMG* progYesImg = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 9); - mProgressiveYes = new dDlst_2D_c(progYesImg, 211, 372, 80, 32, 255); + mProgressiveYes = JKR_NEW dDlst_2D_c(progYesImg, 211, 372, 80, 32, 255); mProgressiveYes->getPicture()->setWhite(JUtility::TColor(160, 160, 160, 255)); ResTIMG* progNoImg = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 7); - mProgressiveNo = new dDlst_2D_c(progNoImg, 350, 372, 80, 32, 255); + mProgressiveNo = JKR_NEW dDlst_2D_c(progNoImg, 350, 372, 80, 32, 255); mProgressiveNo->getPicture()->setWhite(JUtility::TColor(160, 160, 160, 255)); mProgressivePro = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 8); mProgressiveInter = (ResTIMG*)dComIfG_getObjectRes(LOGO_ARC, 6); - mProgressiveSel = new dDlst_2D_c(mProgressivePro, 153, 309, 336, 88, 255); + mProgressiveSel = JKR_NEW dDlst_2D_c(mProgressivePro, 153, 309, 336, 88, 255); #endif } #endif @@ -1452,8 +1453,8 @@ void dScnLogo_c::dvdDataLoad() { } static int dScnLogo_Create(scene_class* i_this) { - printf("[DIAG] dScnLogo_Create: entry i_this=%p\n", i_this); fflush(stdout); - return (new (i_this) dScnLogo_c())->create(); + DuskLog.debug("[DIAG] dScnLogo_Create: entry i_this={}", (void*)i_this); + return (JKR_NEW_ARGS (i_this) dScnLogo_c())->create(); } static int dScnLogo_Execute(dScnLogo_c* i_this) { diff --git a/src/d/d_s_menu.cpp b/src/d/d_s_menu.cpp index 8fb2ff819b..50004ccb5d 100644 --- a/src/d/d_s_menu.cpp +++ b/src/d/d_s_menu.cpp @@ -1473,7 +1473,7 @@ int dScnMenu_Delete(dScnMenu_c* i_this) { "dScnMenu_Delete():\n"; JUTDbPrint::getManager()->changeFont(JFWSystem::getSystemFont()); - delete i_this->font; + JKR_DELETE(i_this->font); JKRFree(i_this->info); JKRFree(i_this->fontRes); @@ -1583,7 +1583,7 @@ int phase_2(dScnMenu_c* i_this) { } if (l_groupPoint == NULL) { - l_groupPoint = new s8[menu_info->num]; + l_groupPoint = JKR_NEW s8[menu_info->num]; JUT_ASSERT(3252, l_groupPoint != NULL); if (mDoExt_getSafeZeldaHeapSize() >= 0) { @@ -1611,15 +1611,15 @@ int phase_2(dScnMenu_c* i_this) { category_info->data = (menu_category_data_class*)((uintptr_t)category_info->data + (uintptr_t)menu_info); i_this->current_category = menu_info->stage_data[l_cursolID].field_0x43; - delete i_this->command; + JKR_DELETE(i_this->command); u8 sp8 = search(menu_info); i_this->fontRes = (ResFONT*)i_this->fontCommand->getMemAddress(); - delete i_this->fontCommand; + JKR_DELETE(i_this->fontCommand); if (i_this->fontRes != NULL) { - i_this->font = new myFontClass(i_this->fontRes, NULL); + i_this->font = JKR_NEW myFontClass(i_this->fontRes, NULL); if (i_this->font != NULL) { JUTDbPrint::getManager()->changeFont(i_this->font); } diff --git a/src/d/d_s_name.cpp b/src/d/d_s_name.cpp index 1f221f0db6..35513c46ea 100644 --- a/src/d/d_s_name.cpp +++ b/src/d/d_s_name.cpp @@ -76,7 +76,7 @@ s32 dScnName_c::create() { dRes_info_c* resInfo = dComIfG_getObjectResInfo("fileSel"); JUT_ASSERT(293, resInfo != NULL); - dFs_c = new dFile_select_c(resInfo->getArchive()); + dFs_c = JKR_NEW dFile_select_c(resInfo->getArchive()); JUT_ASSERT(297, dFs_c != NULL); @@ -94,7 +94,7 @@ s32 dScnName_c::create() { #endif } - mBrightCheck = new dBrightCheck_c(resInfo->getArchive()); + mBrightCheck = JKR_NEW dBrightCheck_c(resInfo->getArchive()); field_0x420 = 0; g_snHIO.id = mDoHIO_CREATE_CHILD("名前登録シーン", &g_snHIO); @@ -251,8 +251,8 @@ s32 dScnName_c::draw() { dScnName_c::~dScnName_c() { mDoHIO_DELETE_CHILD(g_snHIO.id); - delete dFs_c; - delete mBrightCheck; + JKR_DELETE(dFs_c); + JKR_DELETE(mBrightCheck); dComIfG_deleteObjectResMain("fileSel"); mHeap->destroy(); @@ -407,7 +407,7 @@ static int dScnName_Delete(dScnName_c* i_this) { } static int dScnName_Create(scene_class* i_this) { - new (i_this) dScnName_c(); + JKR_NEW_ARGS (i_this) dScnName_c(); return static_cast(i_this)->create(); } diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index 070d198824..a95dc5dd40 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -1376,7 +1376,7 @@ static int phase_4(dScnPly_c* i_this) { if (i_this->sceneCommand) { JUT_ASSERT(2610, i_this->sceneCommand->getMemAddress() != NULL); dComIfGp_particle_createScene(i_this->sceneCommand->getMemAddress()); - delete i_this->sceneCommand; + JKR_DELETE(i_this->sceneCommand); } else { dComIfGp_particle_createScene(NULL); } @@ -1459,7 +1459,7 @@ static int phase_4(dScnPly_c* i_this) { #endif dAttention_c* attention = dComIfGp_getAttention(); - new (attention) dAttention_c(dComIfGp_getPlayer(0), 0); + JKR_NEW_ARGS (attention) dAttention_c(dComIfGp_getPlayer(0), 0); dComIfGp_getVibration().Init(); daYkgr_c::init(); diff --git a/src/d/d_s_room.cpp b/src/d/d_s_room.cpp index 97956980c8..396a032355 100644 --- a/src/d/d_s_room.cpp +++ b/src/d/d_s_room.cpp @@ -66,7 +66,7 @@ static int getResetArchiveBank(int i_roomNo, const u8** o_bankIDList) { return i; } } - + return bankNum; } @@ -133,7 +133,7 @@ static int objectDeleteJugge(void* i_process, void* i_data) { if (!fopAcM_CheckCondition((fopAc_ac_c*)i_process, fopAcCnd_NODRAW_e)) { return 0; } - + OS_REPORT("削除!<%s>\n", namebuf); } @@ -280,7 +280,7 @@ static int dScnRoom_Execute(room_of_scene_class* i_this) { dScnPly_c::setPauseTimer(2); } else { i_this->field_0x1d5 = 0; - } + } } } } @@ -456,7 +456,7 @@ static int phase_2(room_of_scene_class* i_this) { #if DEBUG void* unit = dComIfGp_roomControl_getStatusRoomDt(roomNo)->getUnit(); if (unit != NULL) { - dBgp_c* bgp = new dBgp_c(); + dBgp_c* bgp = JKR_NEW dBgp_c(); JUT_ASSERT(786, bgp != NULL); bgp->create(roomNo, unit); diff --git a/src/d/d_scope.cpp b/src/d/d_scope.cpp index c81267f174..3e2c18131d 100644 --- a/src/d/d_scope.cpp +++ b/src/d/d_scope.cpp @@ -42,13 +42,13 @@ dScope_c::dScope_c(u8 param_0) : field_0x58(-1), field_0x5c(-1) { } } - mpWipeTex = new J2DPicture(mp_image); + mpWipeTex = JKR_NEW J2DPicture(mp_image); mpWipeTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 255)); mWidth = mp_image->width; mHeight = mp_image->height; mp_image = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "tt_block8x8.bti"); - mpBlackTex = new J2DPicture(mp_image); + mpBlackTex = JKR_NEW J2DPicture(mp_image); mpBlackTex->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 255)); mScale = 3.0f; mAlpha = 0.0f; @@ -61,45 +61,45 @@ dScope_c::dScope_c(u8 param_0) : field_0x58(-1), field_0x5c(-1) { dScope_c::~dScope_c() { if (mHawkEyeScrn != NULL) { - delete mHawkEyeScrn; + JKR_DELETE(mHawkEyeScrn); mHawkEyeScrn = NULL; } if (mHawkEyeRootPane != NULL) { - delete mHawkEyeRootPane; + JKR_DELETE(mHawkEyeRootPane); mHawkEyeRootPane = NULL; } for (int i = 0; i < 3; i++) { if (mHawkEyePanes[i] != NULL) { - delete mHawkEyePanes[i]; + JKR_DELETE(mHawkEyePanes[i]); mHawkEyePanes[i] = NULL; } } if (mZoomInOutScrn != NULL) { - delete mZoomInOutScrn; + JKR_DELETE(mZoomInOutScrn); mZoomInOutScrn = NULL; } if (mZoomInOutRootPane != NULL) { - delete mZoomInOutRootPane; + JKR_DELETE(mZoomInOutRootPane); mZoomInOutRootPane = NULL; } for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { if (mZoomInOutPanes[i][j] != NULL) { - delete mZoomInOutPanes[i][j]; + JKR_DELETE(mZoomInOutPanes[i][j]); mZoomInOutPanes[i][j] = NULL; } } } - delete mpWipeTex; + JKR_DELETE(mpWipeTex); mpWipeTex = NULL; - delete mpBlackTex; + JKR_DELETE(mpBlackTex); mpBlackTex = NULL; dMeter2Info_setScopeZoomPointer(0); diff --git a/src/d/d_select_cursor.cpp b/src/d/d_select_cursor.cpp index 4291a9b933..17ee9ca451 100644 --- a/src/d/d_select_cursor.cpp +++ b/src/d/d_select_cursor.cpp @@ -54,7 +54,7 @@ dSelect_cursor_c::dSelect_cursor_c(u8 param_0, f32 param_1, JKRArchive* param_2) "", }; - mpCursorHIO = new dSelect_cursorHIO_c(); + mpCursorHIO = JKR_NEW dSelect_cursorHIO_c(); mpCursorHIO->field_0x4 = -1; mNameIdx = 0; field_0xb6 = param_0; @@ -92,7 +92,7 @@ dSelect_cursor_c::dSelect_cursor_c(u8 param_0, f32 param_1, JKRArchive* param_2) param_2 = dComIfGp_getMain2DArchive(); } - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); mpScreen->setPriority(blo_name[mNameIdx], 0x20000, param_2); dPaneClass_showNullPane(mpScreen); @@ -102,13 +102,13 @@ dSelect_cursor_c::dSelect_cursor_c(u8 param_0, f32 param_1, JKRArchive* param_2) switch(mNameIdx) { case 0: { - mpPaneMgr = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpPaneMgr = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); mpPaneMgr->hide(); mpPaneMgr->setAlpha(0); static u64 const corner_tag[4] = {MULTI_CHAR('l_u_null'), MULTI_CHAR('l_d_null'), MULTI_CHAR('r_u_null'), MULTI_CHAR('r_d_null')}; for (int i = 0; i< 4; i++) { - field_0x1C[i] = new CPaneMgr(mpScreen, corner_tag[i], 0, NULL); + field_0x1C[i] = JKR_NEW CPaneMgr(mpScreen, corner_tag[i], 0, NULL); field_0x94[i] = mpScreen->search(corner_tag[i])->getTranslateX(); field_0xa4[i] = mpScreen->search(corner_tag[i])->getTranslateY(); field_0x74[i] = field_0x94[i]; @@ -120,16 +120,16 @@ dSelect_cursor_c::dSelect_cursor_c(u8 param_0, f32 param_1, JKRArchive* param_2) field_0x18 = NULL; } break; case 1: - mpPaneMgr = new CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); + mpPaneMgr = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all'), 2, NULL); mpPaneMgr->hide(); mpPaneMgr->setAlpha(0); mpPaneMgr->scale(param_1, param_1); - field_0x14 = new CPaneMgr(mpScreen, MULTI_CHAR('sel_po00'), 0, NULL); + field_0x14 = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('sel_po00'), 0, NULL); field_0x14->hide(); - field_0x18 = new CPaneMgr(mpScreen, MULTI_CHAR('n_all2'), 2, NULL); + field_0x18 = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('n_all2'), 2, NULL); break; case 2: - mpPaneMgr = new CPaneMgr(mpScreen, 'Null', 2, NULL); + mpPaneMgr = JKR_NEW CPaneMgr(mpScreen, 'Null', 2, NULL); mpPaneMgr->hide(); mpPaneMgr->setAlpha(0); mpPaneMgr->scale(param_1, param_1); @@ -137,7 +137,7 @@ dSelect_cursor_c::dSelect_cursor_c(u8 param_0, f32 param_1, JKRArchive* param_2) field_0x18 = NULL; break; case 3: - mpPaneMgr = new CPaneMgr(mpScreen, MULTI_CHAR('batsu'), 2, NULL); + mpPaneMgr = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('batsu'), 2, NULL); mpPaneMgr->hide(); mpPaneMgr->setAlpha(0); mpPaneMgr->scale(param_1, param_1); @@ -198,46 +198,46 @@ dSelect_cursor_c::dSelect_cursor_c(u8 param_0, f32 param_1, JKRArchive* param_2) dSelect_cursor_c::~dSelect_cursor_c() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; if (mpPaneMgr) { - delete mpPaneMgr; + JKR_DELETE(mpPaneMgr); mpPaneMgr = NULL; } for (int i = 0; i < 4; i++) { if (field_0x1C[i]) { - delete field_0x1C[i]; + JKR_DELETE(field_0x1C[i]); field_0x1C[i] = NULL; } } if (field_0x14) { - delete field_0x14; + JKR_DELETE(field_0x14); field_0x14 = NULL; } if (field_0x18) { - delete field_0x18; + JKR_DELETE(field_0x18); field_0x18 = NULL; } if (mpSelectIcon) { - delete mpSelectIcon; + JKR_DELETE(mpSelectIcon); mpSelectIcon = NULL; } if (field_0x30) { - delete field_0x30; + JKR_DELETE(field_0x30); field_0x30 = NULL; } for (int i = 0; i < 2; i++) { if (field_0x34[i]) { - delete field_0x34[i]; + JKR_DELETE(field_0x34[i]); field_0x34[i] = NULL; } } if (field_0x2C) { - delete field_0x2C; + JKR_DELETE(field_0x2C); field_0x2C = NULL; } if (mpCursorHIO) { - delete mpCursorHIO; + JKR_DELETE(mpCursorHIO); mpCursorHIO = NULL; } } diff --git a/src/d/d_shop_system.cpp b/src/d/d_shop_system.cpp index a10ef7556e..1395bff729 100644 --- a/src/d/d_shop_system.cpp +++ b/src/d/d_shop_system.cpp @@ -123,11 +123,11 @@ void dShopSystem_c::initShopSystem() { dShopSystem_camera_count = 0; if (mpStick == NULL) { - mpStick = new STControl(); + mpStick = JKR_NEW STControl(); } if (mpDrawCursor == NULL) { - mpDrawCursor = new dSelect_cursor_c(1, 1.0f, NULL); + mpDrawCursor = JKR_NEW dSelect_cursor_c(1, 1.0f, NULL); mpDrawCursor->setParam(1.0f, 1.0f, 0.1f, 0.7f, 0.7f); } @@ -1388,12 +1388,12 @@ void dShopSystem_c::setSoldOutItemHide() { void dShopSystem_c::deleteObject() { if (mpStick != NULL) { - delete mpStick; + JKR_DELETE(mpStick); mpStick = NULL; } if (mpDrawCursor != NULL) { - delete mpDrawCursor; + JKR_DELETE(mpDrawCursor); mpDrawCursor = NULL; } } diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 1f79aedae8..2083cc8bc8 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -427,7 +427,7 @@ bool dStage_roomControl_c::resetArchiveBank(int i_bank) { void dStage_roomControl_c::roomDzs_c::create(u8 i_num) { JUT_ASSERT(1112, !m_num && 0 < i_num && i_num < 64); - m_dzs = new (mDoExt_getArchiveHeap(), -4) void*[i_num]; + m_dzs = JKR_NEW_ARGS (mDoExt_getArchiveHeap(), -4) void*[i_num]; JUT_ASSERT(1114, m_dzs != NULL); if (m_dzs != NULL) { @@ -449,7 +449,7 @@ void dStage_roomControl_c::roomDzs_c::remove() { } dzs++; } - delete[] m_dzs; + JKR_DELETE_ARRAY(m_dzs); m_num = 0; } } diff --git a/src/d/d_timer.cpp b/src/d/d_timer.cpp index 5dc0201483..c35b5c7a22 100644 --- a/src/d/d_timer.cpp +++ b/src/d/d_timer.cpp @@ -44,7 +44,7 @@ int dTimer_c::_create() { if (mp_heap != NULL) { mp_heap->getTotalFreeSize(); - mp_tm_scrn = new dDlst_TimerScrnDraw_c(); + mp_tm_scrn = JKR_NEW dDlst_TimerScrnDraw_c(); JUT_ASSERT(0, mp_tm_scrn != NULL); if (appen->timer_mode == 10) { @@ -299,7 +299,7 @@ int dTimer_c::_delete() { mp_heap->getTotalFreeSize(); mp_tm_scrn->deleteScreen(); - delete mp_tm_scrn; + JKR_DELETE(mp_tm_scrn); mp_tm_scrn = NULL; fopMsgM_destroyExpHeap(mp_heap); @@ -592,7 +592,7 @@ void dDlst_TimerScrnDraw_c::setScreen(s32 param_0, JKRArchive* i_archive) { setShowType(3); - mpGetInScreen = new J2DScreen(); + mpGetInScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpGetInScreen != NULL); bool fg = mpGetInScreen->setPriority("zelda_game_image_cow_get_in.blo", 0x20000, mpArchive); @@ -603,13 +603,13 @@ void dDlst_TimerScrnDraw_c::setScreen(s32 param_0, JKRArchive* i_archive) { mpGetInBck = (J2DAnmTransform*)J2DAnmLoaderDataBase::load( JKRGetNameResource("zelda_game_image_cow_get_in.bck", mpArchive)); - mpGetInParent = new CPaneMgr(mpGetInScreen, MULTI_CHAR('get_in_n'), 2, NULL); + mpGetInParent = JKR_NEW CPaneMgr(mpGetInScreen, MULTI_CHAR('get_in_n'), 2, NULL); JUT_ASSERT(0, mpGetInParent != NULL); - mpGetInRoot = new CPaneMgr(mpGetInScreen, MULTI_CHAR('n_all'), 0, NULL); + mpGetInRoot = JKR_NEW CPaneMgr(mpGetInScreen, MULTI_CHAR('n_all'), 0, NULL); JUT_ASSERT(0, mpGetInRoot != NULL); - mpGetInText = new CPaneMgr(mpGetInScreen, MULTI_CHAR('get_in'), 0, NULL); + mpGetInText = JKR_NEW CPaneMgr(mpGetInScreen, MULTI_CHAR('get_in'), 0, NULL); JUT_ASSERT(0, mpGetInText != NULL); static_cast(mpGetInScreen->search(MULTI_CHAR('get_in_s')))->setFont(mDoExt_getMesgFont()); @@ -631,7 +631,7 @@ void dDlst_TimerScrnDraw_c::setScreen(s32 param_0, JKRArchive* i_archive) { } void dDlst_TimerScrnDraw_c::setScreenBase() { - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_game_image_cow_game.blo", 0x20000, mpArchive); @@ -640,15 +640,15 @@ void dDlst_TimerScrnDraw_c::setScreenBase() { mpParent = NULL; - mpCowParent = new CPaneMgr(mpScreen, MULTI_CHAR('cow_n'), 2, NULL); + mpCowParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('cow_n'), 2, NULL); JUT_ASSERT(0, mpCowParent != NULL); mpCowParent->setAlphaRate(0.0f); - mpTimeParent = new CPaneMgr(mpScreen, MULTI_CHAR('time_n'), 2, NULL); + mpTimeParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('time_n'), 2, NULL); JUT_ASSERT(0, mpTimeParent != NULL); mpTimeParent->setAlphaRate(0.0f); - mpImageParent = new CPaneMgr(mpScreen, MULTI_CHAR('cow_i_n'), 2, NULL); + mpImageParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('cow_i_n'), 2, NULL); JUT_ASSERT(0, mpImageParent != NULL); mpImageParent->setAlphaRate(0.0f); @@ -677,23 +677,23 @@ void dDlst_TimerScrnDraw_c::setScreenBase() { } void dDlst_TimerScrnDraw_c::setScreenBoatRace() { - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_game_image_zora_kawakudari.blo", 0x20000, mpArchive); JUT_ASSERT(0, fg != false); dPaneClass_showNullPane(mpScreen); - mpParent = new CPaneMgr(mpScreen, MULTI_CHAR('ta_co_n'), 2, NULL); + mpParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('ta_co_n'), 2, NULL); JUT_ASSERT(0, mpParent != NULL); - mpCowParent = new CPaneMgr(mpScreen, MULTI_CHAR('num_n'), 2, NULL); + mpCowParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('num_n'), 2, NULL); JUT_ASSERT(0, mpCowParent != NULL); mpCowParent->setAlphaRate(0.0f); mpTimeParent = NULL; - mpImageParent = new CPaneMgr(mpScreen, MULTI_CHAR('target_n'), 2, NULL); + mpImageParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('target_n'), 2, NULL); JUT_ASSERT(0, mpImageParent != NULL); mpImageParent->setAlphaRate(0.0f); @@ -719,7 +719,7 @@ void dDlst_TimerScrnDraw_c::setScreenBoatRace() { } void dDlst_TimerScrnDraw_c::setScreenRider() { - mpScreen = new J2DScreen(); + mpScreen = JKR_NEW J2DScreen(); JUT_ASSERT(0, mpScreen != NULL); bool fg = mpScreen->setPriority("zelda_game_image_rider.blo", 0x20000, mpArchive); @@ -728,13 +728,13 @@ void dDlst_TimerScrnDraw_c::setScreenRider() { mpParent = NULL; - mpCowParent = new CPaneMgr(mpScreen, MULTI_CHAR('num_n'), 2, NULL); + mpCowParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('num_n'), 2, NULL); JUT_ASSERT(0, mpCowParent != NULL); mpCowParent->setAlphaRate(0.0f); mpTimeParent = NULL; - mpImageParent = new CPaneMgr(mpScreen, MULTI_CHAR('rid_i_n'), 2, NULL); + mpImageParent = JKR_NEW CPaneMgr(mpScreen, MULTI_CHAR('rid_i_n'), 2, NULL); JUT_ASSERT(0, mpImageParent != NULL); mpImageParent->setAlphaRate(0.0f); @@ -782,42 +782,42 @@ void dDlst_TimerScrnDraw_c::hideDenominator() { } void dDlst_TimerScrnDraw_c::deleteScreen() { - delete mpScreen; + JKR_DELETE(mpScreen); mpScreen = NULL; if (mpParent != NULL) { - delete mpParent; + JKR_DELETE(mpParent); mpParent = NULL; } if (mpTimeParent != NULL) { - delete mpTimeParent; + JKR_DELETE(mpTimeParent); mpTimeParent = NULL; } if (mpCowParent != NULL) { - delete mpCowParent; + JKR_DELETE(mpCowParent); mpCowParent = NULL; } if (mpImageParent != NULL) { - delete mpImageParent; + JKR_DELETE(mpImageParent); mpImageParent = NULL; } - delete mpGetInScreen; + JKR_DELETE(mpGetInScreen); mpGetInScreen = NULL; - delete mpGetInBck; + JKR_DELETE(mpGetInBck); mpGetInBck = NULL; - delete mpGetInParent; + JKR_DELETE(mpGetInParent); mpGetInParent = NULL; - delete mpGetInRoot; + JKR_DELETE(mpGetInRoot); mpGetInRoot = NULL; - delete mpGetInText; + JKR_DELETE(mpGetInText); mpGetInText = NULL; } diff --git a/src/d/d_tresure.cpp b/src/d/d_tresure.cpp index b00dc294dd..f250367480 100644 --- a/src/d/d_tresure.cpp +++ b/src/d/d_tresure.cpp @@ -11,7 +11,7 @@ static bool data_80450680 = true; dTres_c::typeGroupData_c* dTres_c::mTypeGroupData; int dTres_c::createWork() { - mTypeGroupData = new dTres_c::typeGroupData_c[0x40]; + mTypeGroupData = JKR_NEW dTres_c::typeGroupData_c[0x40]; return 1; } diff --git a/src/dusk/OSMutex.cpp b/src/dusk/OSMutex.cpp index 9ec3197cb1..55d8ccb52f 100644 --- a/src/dusk/OSMutex.cpp +++ b/src/dusk/OSMutex.cpp @@ -12,6 +12,8 @@ #include #include +#include "JSystem/JKernel/JKRHeap.h" + // ============================================================================ // Malloc-based allocator to bypass JKRHeap operator new/delete // Without this, side-table allocations call operator new -> JKRHeap::alloc @@ -45,7 +47,7 @@ template std::unique_ptr> make_malloc_unique(Args&&... args) { void* mem = std::malloc(sizeof(T)); if (!mem) throw std::bad_alloc(); - T* obj = new (mem) T(std::forward(args)...); + T* obj = JKR_NEW_ARGS (mem) T(std::forward(args)...); return std::unique_ptr>(obj); } diff --git a/src/dusk/OSThread.cpp b/src/dusk/OSThread.cpp index 96ef2bcfff..2d19139272 100644 --- a/src/dusk/OSThread.cpp +++ b/src/dusk/OSThread.cpp @@ -16,6 +16,8 @@ #include #include +#include "JSystem/JKernel/JKRHeap.h" + // ============================================================================ // Malloc-based allocator to bypass JKRHeap operator new/delete // ============================================================================ @@ -47,7 +49,7 @@ template std::unique_ptr> make_malloc_unique(Args&&... args) { void* mem = std::malloc(sizeof(T)); if (!mem) throw std::bad_alloc(); - T* obj = new (mem) T(std::forward(args)...); + T* obj = JKR_NEW_ARGS (mem) T(std::forward(args)...); return std::unique_ptr>(obj); } diff --git a/src/dusk/dvd_emu.cpp b/src/dusk/dvd_emu.cpp index 6c886a4372..70ae9d3ddd 100644 --- a/src/dusk/dvd_emu.cpp +++ b/src/dusk/dvd_emu.cpp @@ -4,6 +4,7 @@ #include #include #include "dolphin/os.h" +#include "dusk/logging.h" #ifdef _WIN32 #include @@ -51,7 +52,7 @@ void setBasePath(const char* path) { g_basePath() = path; #endif - printf("[DvdEmu] Base path set to: %s\n", g_basePath().c_str()); fflush(stdout); + DuskLog.debug("[DvdEmu] Base path set to: %s\n", g_basePath().c_str()); } const char* getBasePath() { @@ -93,9 +94,9 @@ bool fileExists(const char* gcPath) { #endif if (exists) { - printf("[DvdEmu] FOUND: %s\n", gcPath); fflush(stdout); + DuskLog.info("[DvdEmu] FOUND: {}", gcPath); } else { - printf("[DvdEmu] MISSING: %s\n", gcPath); fflush(stdout); + DuskLog.warn("[DvdEmu] MISSING: {}", gcPath); } return exists; @@ -116,11 +117,11 @@ u32 getFileSize(const char* gcPath) { void* loadFile(const char* gcPath, u32* outSize, void* heap) { std::string fullPath = convertPath(gcPath); - printf("[DvdEmu] Loading request: '%s'\n", gcPath); fflush(stdout); + DuskLog.debug("[DvdEmu] Loading request: '{}'", gcPath); FILE* f = fopen(fullPath.c_str(), "rb"); if (!f) { - printf("[DvdEmu] ERROR: Failed to open file at physical path: %s\n", fullPath.c_str()); fflush(stdout); + DuskLog.error("[DvdEmu] Failed to open file at physical path: {}", fullPath.c_str()); if (outSize) *outSize = 0; return nullptr; @@ -139,7 +140,7 @@ void* loadFile(const char* gcPath, u32* outSize, void* heap) { #endif if (!data) { - printf("[DvdEmu] FATAL: Failed to allocate %u bytes for %s\n", size, gcPath); fflush(stdout); + DuskLog.fatal("[DvdEmu] Failed to allocate {} bytes for {}", size, gcPath); fclose(f); if (outSize) *outSize = 0; @@ -150,14 +151,14 @@ void* loadFile(const char* gcPath, u32* outSize, void* heap) { fclose(f); if (bytesRead != size) { - printf("[DvdEmu] WARNING: Read error: expected %u, got %u for %s\n", size, bytesRead, - gcPath); fflush(stdout); + DuskLog.fatal("[DvdEmu] Read error: expected {}, got {} for {}", size, bytesRead, + gcPath); } if (outSize) *outSize = bytesRead; - printf("[DvdEmu] SUCCESS: Loaded %s (%u bytes)\n", gcPath, bytesRead); fflush(stdout); + DuskLog.info("[DvdEmu] Loaded {} ({} bytes)", gcPath, bytesRead); return data; } @@ -166,7 +167,7 @@ u32 loadFileToBuffer(const char* gcPath, void* buffer, u32 bufferSize, u32 offse FILE* f = fopen(fullPath.c_str(), "rb"); if (!f) { - printf("[DvdEmu] Failed to open file for buffer load: %s\n", fullPath.c_str()); fflush(stdout); + DuskLog.error("[DvdEmu] Failed to open file for buffer load: {}", fullPath.c_str()); return 0; } @@ -186,7 +187,7 @@ u32 loadFileToBuffer(const char* gcPath, void* buffer, u32 bufferSize, u32 offse s32 DVDConvertPathToEntrynum_Emu(const char* path) { if (!DvdEmu::fileExists(path)) { - printf("[DVD] Error: File not found for entrynum conversion: %s\n", path); fflush(stdout); + printf("[DVD] Error: File not found for entrynum conversion: %s\n", path); return -1; } diff --git a/src/dusk/endian.cpp b/src/dusk/endian.cpp index bdde738911..777ed8ae69 100644 --- a/src/dusk/endian.cpp +++ b/src/dusk/endian.cpp @@ -1,5 +1,6 @@ -#include #include "dusk/endian.h" +#include +#include "SSystem/SComponent/c_xyz.h" #include "dusk/endian_gx.hpp" #define IMPL_ENUM(type) \ @@ -39,3 +40,11 @@ GXVtxAttrFmtList BE::swap(GXVtxAttrFmtList val) { val.frac }; } + +template<> +cXy BE::swap(cXy val) { + return { + BE::swap(val.x), + BE::swap(val.y), + }; +} diff --git a/src/dusk/globals.cpp b/src/dusk/globals.cpp index d82a680fcc..49ab54ccbe 100644 --- a/src/dusk/globals.cpp +++ b/src/dusk/globals.cpp @@ -9,8 +9,6 @@ dDebugPad_c dDebugPad; u32 __OSFpscrEnableBits; -GDLObj* __GDCurrentDL; - // DSP #include DSPTaskInfo* __DSP_first_task; diff --git a/src/dusk/imgui.cpp b/src/dusk/imgui.cpp index 245941a3e9..f93428382c 100644 --- a/src/dusk/imgui.cpp +++ b/src/dusk/imgui.cpp @@ -32,6 +32,8 @@ void imgui_main(const AuroraInfo *info) DuskImguiDebugOverlay(info); DuskImguiProcesses(); DuskImguiHeaps(); + DuskCameraDebug(); + DuskDebugPad(); ImGui::EndMainMenuBar(); } diff --git a/src/dusk/imgui/camera.cpp b/src/dusk/imgui/camera.cpp new file mode 100644 index 0000000000..5edc26f905 --- /dev/null +++ b/src/dusk/imgui/camera.cpp @@ -0,0 +1,112 @@ +#include "f_op/f_op_camera_mng.h" +#include "SSystem/SComponent/c_xyz.h" + +#include "imgui.h" +#include "imgui.hpp" + +static bool Active = false; +static int m_cameraOverlayCorner = 3; + +void DuskCameraDebug() { + if (ImGui::BeginMenu(MenuView)) { + ImGui::MenuItem("Camera", "F6", &Active); + + ImGui::EndMenu(); + } + + if (ImGui::IsKeyPressed(ImGuiKey_F6)) { + Active = !Active; + } + + auto* cam = (camera_process_class*)dCam_getCamera(); + + if (!Active || cam == nullptr) + return; + + auto* dCam = &cam->mCamera; + + ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | + ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav; + if (m_cameraOverlayCorner != -1) { + SetOverlayWindowLocation(m_cameraOverlayCorner); + windowFlags |= ImGuiWindowFlags_NoMove; + } + + ImGui::SetNextWindowBgAlpha(0.65f); + ImGui::SetNextWindowSizeConstraints(ImVec2(300, 0), ImVec2(FLT_MAX, FLT_MAX)); + + if (!ImGui::Begin("Camera Debug", nullptr, windowFlags)) { + ImGui::End(); + return; + } + + ImGui::SeparatorText("Camera Transform Data"); + + cXyz center = dCam->mCenter; + cXyz eye = dCam->mEye; + + if (ImGui::InputFloat3("Camera Center", ¢er.x)) { + dCam->Reset(center, eye); + } + if (ImGui::InputFloat3("Camera Eye", &eye.x)) { + dCam->Reset(center, eye); + } + + ImGui::InputFloat("Camera FOV", &dCam->mFovy); + + ImGui::SeparatorText("Free-look Data"); + + static float eyeYawDeg = 0.0f; + static float moveSpeed = 10000.0f; + static float rotSpeed = 5.0f; + static cXyz freeLookPos = cXyz::Zero; + + bool changed = false; + + if (ImGui::IsKeyDown(ImGuiKey_LeftArrow)) { + eyeYawDeg += rotSpeed; + if (eyeYawDeg >= 360.0f) + eyeYawDeg -= 360.0f; + + changed = true; + } else if (ImGui::IsKeyDown(ImGuiKey_RightArrow)) { + eyeYawDeg -= rotSpeed; + if (eyeYawDeg < 0.0f) + eyeYawDeg += 360.0f; + + changed = true; + } + cSAngle yawAngle = cSAngle(eyeYawDeg); + cXyz frontDir = cXyz(yawAngle.Sin(), 0.0f, yawAngle.Cos()); + + if (ImGui::IsKeyDown(ImGuiKey_UpArrow)) { + freeLookPos -= frontDir * moveSpeed * ImGui::GetIO().DeltaTime; + changed = true; + } else if (ImGui::IsKeyDown(ImGuiKey_DownArrow)) { + freeLookPos += frontDir * moveSpeed * ImGui::GetIO().DeltaTime; + changed = true; + } + + if (ImGui::IsKeyDown(ImGuiKey_LeftShift)) { + freeLookPos += cXyz::BaseY * moveSpeed * ImGui::GetIO().DeltaTime; + changed = true; + } + + if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) { + freeLookPos -= cXyz::BaseY * moveSpeed * ImGui::GetIO().DeltaTime; + changed = true; + } + + if (changed) { + dCam->Reset(freeLookPos, freeLookPos + (frontDir * 100.0f)); + } + + ImGui::InputFloat("Free-look Yaw", &eyeYawDeg); + ImGui::InputFloat3("Free-look Position", &freeLookPos.x); + ImGui::InputFloat("Free-look Move Speed", &moveSpeed); + ImGui::InputFloat("Free-look Rotation Speed", &rotSpeed); + + ShowCornerContextMenu(m_cameraOverlayCorner, 0); + + ImGui::End(); +} \ No newline at end of file diff --git a/src/dusk/imgui/debug_overlay.cpp b/src/dusk/imgui/debug_overlay.cpp index e453d5bd26..4e9fb02540 100644 --- a/src/dusk/imgui/debug_overlay.cpp +++ b/src/dusk/imgui/debug_overlay.cpp @@ -17,7 +17,7 @@ static int m_debugOverlayCorner = 0; // top-left using namespace std::string_literals; using namespace std::string_view_literals; -static void SetOverlayWindowLocation(int corner) +void SetOverlayWindowLocation(int corner) { const ImGuiViewport *viewport = ImGui::GetMainViewport(); ImVec2 workPos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any! @@ -32,6 +32,34 @@ static void SetOverlayWindowLocation(int corner) ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always, windowPosPivot); } +bool ShowCornerContextMenu(int& corner, int avoidCorner) { + bool result = false; + if (ImGui::BeginPopupContextWindow()) { + if (ImGui::MenuItem("Custom", nullptr, corner == -1)) { + corner = -1; + result = true; + } + if (ImGui::MenuItem("Top-left", nullptr, corner == 0, avoidCorner != 0)) { + corner = 0; + result = true; + } + if (ImGui::MenuItem("Top-right", nullptr, corner == 1, avoidCorner != 1)) { + corner = 1; + result = true; + } + if (ImGui::MenuItem("Bottom-left", nullptr, corner == 2, avoidCorner != 2)) { + corner = 2; + result = true; + } + if (ImGui::MenuItem("Bottom-right", nullptr, corner == 3, avoidCorner != 3)) { + corner = 3; + result = true; + } + ImGui::EndPopup(); + } + return result; +} + static void ImGuiStringViewText(std::string_view text) { // begin()/end() do not work on MSVC diff --git a/src/dusk/imgui/imgui.hpp b/src/dusk/imgui/imgui.hpp index d6006f8353..1a66d670a7 100644 --- a/src/dusk/imgui/imgui.hpp +++ b/src/dusk/imgui/imgui.hpp @@ -9,6 +9,11 @@ inline const char* MenuView = "View"; void DuskImguiDebugOverlay(const AuroraInfo *info); void DuskImguiProcesses(); void DuskImguiHeaps(); +void DuskCameraDebug(); +void DuskDebugPad(); + +void SetOverlayWindowLocation(int corner); +bool ShowCornerContextMenu(int& corner, int avoidCorner); std::string BytesToString(size_t bytes); diff --git a/src/dusk/imgui/kb_pad.cpp b/src/dusk/imgui/kb_pad.cpp new file mode 100644 index 0000000000..42816a40e8 --- /dev/null +++ b/src/dusk/imgui/kb_pad.cpp @@ -0,0 +1,70 @@ +#include "m_Do/m_Do_controller_pad.h" + +#include "imgui.h" +#include "imgui.hpp" + +void DuskDebugPad() { + if (ImGui::IsKeyPressed(ImGuiKey_K)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_A; + } + + if (ImGui::IsKeyPressed(ImGuiKey_J)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_B; + } + + if (ImGui::IsKeyPressed(ImGuiKey_L)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_X; + } + + if (ImGui::IsKeyPressed(ImGuiKey_I)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_Y; + } + + if (ImGui::IsKeyPressed(ImGuiKey_H)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_START; + } + + if (ImGui::IsKeyPressed(ImGuiKey_O)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_TRIGGER_Z; + } + + if (ImGui::IsKeyPressed(ImGuiKey_Keypad8)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_UP; + } + + if (ImGui::IsKeyPressed(ImGuiKey_Keypad2)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_DOWN; + } + + if (ImGui::IsKeyPressed(ImGuiKey_Keypad6)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_RIGHT; + } + + if (ImGui::IsKeyPressed(ImGuiKey_Keypad4)) { + mDoCPd_c::getCpadInfo(PAD_1).mPressedButtonFlags |= PAD_BUTTON_LEFT; + } + + if (ImGui::IsKeyPressed(ImGuiKey_W)) { + mDoCPd_c::getCpadInfo(PAD_1).mMainStickPosY = 1.0f; + mDoCPd_c::getCpadInfo(PAD_1).mMainStickValue = 1.0f; + mDoCPd_c::getCpadInfo(PAD_1).mMainStickAngle = 0x8000; + } + + if (ImGui::IsKeyPressed(ImGuiKey_S)) { + mDoCPd_c::getCpadInfo(PAD_1).mMainStickPosY = -1.0f; + mDoCPd_c::getCpadInfo(PAD_1).mMainStickValue = 1.0f; + mDoCPd_c::getCpadInfo(PAD_1).mMainStickAngle = 0; + } + + if (ImGui::IsKeyPressed(ImGuiKey_D)) { + mDoCPd_c::getCpadInfo(PAD_1).mMainStickPosX = 1.0f; + mDoCPd_c::getCpadInfo(PAD_1).mMainStickValue = 1.0f; + mDoCPd_c::getCpadInfo(PAD_1).mMainStickAngle = 0x4000; + } + + if (ImGui::IsKeyPressed(ImGuiKey_A)) { + mDoCPd_c::getCpadInfo(PAD_1).mMainStickPosX = -1.0f; + mDoCPd_c::getCpadInfo(PAD_1).mMainStickValue = 1.0f; + mDoCPd_c::getCpadInfo(PAD_1).mMainStickAngle = -0x4000; + } +} \ No newline at end of file diff --git a/src/dusk/logging.cpp b/src/dusk/logging.cpp new file mode 100644 index 0000000000..d69d52094f --- /dev/null +++ b/src/dusk/logging.cpp @@ -0,0 +1,35 @@ +#include "dusk/logging.h" +#include +#include + +void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message, + unsigned int len) { + const char* levelStr = "??"; + FILE* out = stdout; + switch (level) { + case LOG_DEBUG: + levelStr = "DEBUG"; + break; + case LOG_INFO: + levelStr = "INFO"; + break; + case LOG_WARNING: + levelStr = "WARNING"; + break; + case LOG_ERROR: + levelStr = "ERROR"; + out = stderr; + break; + case LOG_FATAL: + levelStr = "FATAL"; + out = stderr; + break; + } + fprintf(out, "[%s | %s] %s\n", levelStr, module, message); + if (level == LOG_FATAL) { + fflush(out); + abort(); + } +} + +aurora::Module DuskLog("dusk"); diff --git a/src/dusk/stubs.cpp b/src/dusk/stubs.cpp index cff00b03bd..55e22fbea3 100644 --- a/src/dusk/stubs.cpp +++ b/src/dusk/stubs.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #ifndef _WIN32 @@ -39,9 +40,6 @@ static bool PerfInitialized = false; #endif -#define STUB_LOG(v) // puts(v); - - // ========================================================================== // General OS // ========================================================================== @@ -257,16 +255,16 @@ void OSSetAlarm(OSAlarm* alarm, OSTime tick, OSAlarmHandler handler) {} #pragma mark SOUND void SoundChoID(int a, int b) { - STUB_LOG("SoundChoID is a stub"); + STUB_LOG(); } void SoundPan(int a, int b, int c) { - STUB_LOG("SoundPan is a stub"); + STUB_LOG(); } void SoundPitch(u16 a, int b) { - STUB_LOG("SoundPitch is a stub"); + STUB_LOG(); } void SoundRevID(int a, int b) { - STUB_LOG("SoundRevID is a stub"); + STUB_LOG(); } #pragma mark CARD @@ -274,150 +272,150 @@ void SoundRevID(int a, int b) { #include extern "C" int CARDProbe(s32 chan) { - STUB_LOG("CARDProbe is a stub"); + STUB_LOG(); return 0; } s32 CARDCancel(CARDFileInfo* fileInfo) { - STUB_LOG("CARDCancel is a stub"); + STUB_LOG(); return 0; } s32 CARDCheck(s32 chan) { - STUB_LOG("CARDCheck is a stub"); + STUB_LOG(); return 0; } s32 CARDCheckAsync(s32 chan, CARDCallback callback) { - STUB_LOG("CARDCheckAsync is a stub"); + STUB_LOG(); return 0; } s32 CARDClose(CARDFileInfo* fileInfo) { - STUB_LOG("CARDClose is a stub"); + STUB_LOG(); return 0; } s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo) { - STUB_LOG("CARDCreate is a stub"); + STUB_LOG(); return 0; } s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback) { - STUB_LOG("CARDCreateAsync is a stub"); + STUB_LOG(); return 0; } s32 CARDDelete(s32 chan, const char* fileName) { - STUB_LOG("CARDDelete is a stub"); + STUB_LOG(); return 0; } s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback) { - STUB_LOG("CARDDeleteAsync is a stub"); + STUB_LOG(); return 0; } s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback) { - STUB_LOG("CARDFastDeleteAsync is a stub"); + STUB_LOG(); return 0; } s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo) { - STUB_LOG("CARDFastOpen is a stub"); + STUB_LOG(); return 0; } s32 CARDFormat(s32 chan) { - STUB_LOG("CARDFormat is a stub"); + STUB_LOG(); return 0; } s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed) { - STUB_LOG("CARDFreeBlocks is a stub"); + STUB_LOG(); return 0; } s32 CARDGetResultCode(s32 chan) { - STUB_LOG("CARDGetResultCode is a stub"); + STUB_LOG(); return 0; } s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat) { - STUB_LOG("CARDGetStatus is a stub"); + STUB_LOG(); return 0; } s32 CARDGetSectorSize(s32 chan, u32* size) { - STUB_LOG("CARDGetSectorSize is a stub"); + STUB_LOG(); return 0; } void CARDInit() { - STUB_LOG("CARDInit is a stub"); + STUB_LOG(); } s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback) { - STUB_LOG("CARDMount is a stub"); + STUB_LOG(); return 0; } s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback) { - STUB_LOG("CARDMountAsync is a stub"); + STUB_LOG(); return 0; } s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo) { - STUB_LOG("CARDOpen is a stub"); + STUB_LOG(); return 0; } s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize) { - STUB_LOG("CARDProbeEx is a stub"); + STUB_LOG(); return 0; } s32 CARDRead(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset) { - STUB_LOG("CARDRead is a stub"); + STUB_LOG(); return 0; } s32 CARDReadAsync(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset, CARDCallback callback) { - STUB_LOG("CARDReadAsync is a stub"); + STUB_LOG(); return 0; } s32 CARDRename(s32 chan, const char* oldName, const char* newName) { - STUB_LOG("CARDRename is a stub"); + STUB_LOG(); return 0; } s32 CARDRenameAsync(s32 chan, const char* oldName, const char* newName, CARDCallback callback) { - STUB_LOG("CARDRenameAsync is a stub"); + STUB_LOG(); return 0; } s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callback) { - STUB_LOG("CARDSetStatusAsync is a stub"); + STUB_LOG(); return 0; } s32 CARDUnmount(s32 chan) { - STUB_LOG("CARDUnmount is a stub"); + STUB_LOG(); return 0; } extern "C" s32 CARDWrite(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset) { - STUB_LOG("CARDWrite is a stub"); + STUB_LOG(); return 0; } s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset, CARDCallback callback) { - STUB_LOG("CARDWriteAsync is a stub"); + STUB_LOG(); return 0; } @@ -430,73 +428,73 @@ s32 CARDSetStatus(s32 chan, s32 fileNo, CARDStat* stat) { } s32 __CARDFormatRegionAsync(int a, int b) { - STUB_LOG("__CARDFormatRegionAsync is a stub"); + STUB_LOG(); return 0; } #pragma mark DC void DCFlushRange(void* addr, u32 nBytes) { - // STUB_LOG("DCFlushRange is a stub"); + // Not needed on PC. } void DCFlushRangeNoSync(void* addr, u32 nBytes) { - // STUB_LOG("DCFlushRangeNoSync is a stub"); + // Not needed on PC. } void DCInvalidateRange(void* addr, u32 nBytes) { - // STUB_LOG("DCInvalidateRange is a stub"); + // Not needed on PC. } void DCStoreRange(void* addr, u32 nBytes) { - // STUB_LOG("DCStoreRange is a stub"); + // Not needed on PC. } void DCStoreRangeNoSync(void* addr, u32 nBytes) { - // STUB_LOG("DCStoreRangeNoSync is a stub"); + // Not needed on PC. } #pragma mark EXI BOOL EXIDeselect(int chan) { - STUB_LOG("EXIDeselect is a stub"); + STUB_LOG(); return FALSE; } BOOL EXIDma(int chan, void* buffer, s32 size, int d, int e) { - STUB_LOG("EXIDma is a stub"); + STUB_LOG(); return FALSE; } BOOL EXIImm(int chan, u32* b, int c, int d, int e) { - STUB_LOG("EXIImm is a stub"); + STUB_LOG(); return FALSE; } BOOL EXILock(int chan, int b, int c) { - STUB_LOG("EXILock is a stub"); + STUB_LOG(); return FALSE; } BOOL EXISelect(int chan, int b, int c) { - STUB_LOG("EXISelect is a stub"); + STUB_LOG(); return FALSE; } BOOL EXISync(int chan) { - STUB_LOG("EXISync is a stub"); + STUB_LOG(); return FALSE; } BOOL EXIUnlock(int chan) { - STUB_LOG("EXIUnlock is a stub"); + STUB_LOG(); return FALSE; } #pragma mark LC void LCEnable() { - STUB_LOG("LCEnable is a stub"); + STUB_LOG(); } // OS-related functions consolidated under "# pragma mark OS" further up @@ -515,11 +513,11 @@ static VIRetraceCallback sVIPostRetraceCallback = NULL; extern "C" { void VIConfigure(const GXRenderModeObj* rm) { - // STUB_LOG("VIConfigure is a stub"); + STUB_LOG(); } void VIConfigurePan(u16 xOrg, u16 yOrg, u16 width, u16 height) { - // STUB_LOG("VIConfigurePan is a stub"); + STUB_LOG(); } u32 VIGetRetraceCount() { @@ -531,11 +529,11 @@ u32 VIGetNextField() { } void VISetBlack(BOOL black) { - // STUB_LOG("VISetBlack is a stub"); + STUB_LOG(); } void VISetNextFrameBuffer(void* fb) { - // STUB_LOG("VISetNextFrameBuffer is a stub"); + STUB_LOG(); } void VIWaitForRetrace() { @@ -577,41 +575,41 @@ VIRetraceCallback VISetPreRetraceCallback(VIRetraceCallback cb) { #pragma mark DSP #include extern "C" void __DSP_insert_task(DSPTaskInfo* task) { - STUB_LOG("__DSP_insert_task is a stub"); + STUB_LOG(); } extern "C" void __DSP_boot_task(DSPTaskInfo*) { - STUB_LOG("__DSP_boot_task is a stub"); + STUB_LOG(); } extern "C" void __DSP_exec_task(DSPTaskInfo*, DSPTaskInfo*) { - STUB_LOG("__DSP_exec_task is a stub"); + STUB_LOG(); } extern "C" void __DSP_remove_task(DSPTaskInfo* task) { - STUB_LOG("__DSP_remove_task is a stub"); + STUB_LOG(); } void DSPAssertInt(void) { - STUB_LOG("DSPAssertInt is a stub"); + STUB_LOG(); } u32 DSPCheckMailFromDSP(void) { - STUB_LOG("DSPCheckMailFromDSP is a stub"); + STUB_LOG(); return 0; } u32 DSPCheckMailToDSP(void) { - STUB_LOG("DSPCheckMailToDSP is a stub"); + STUB_LOG(); return 0; } void DSPInit(void) { - STUB_LOG("DSPInit is a stub"); + STUB_LOG(); } u32 DSPReadMailFromDSP(void) { - STUB_LOG("DSPReadMailFromDSP is a stub"); + STUB_LOG(); return 0; } void DSPSendMailToDSP(u32 mail) { - STUB_LOG("DSPSendMailToDSP is a stub"); + STUB_LOG(); } #pragma mark Z2Audio @@ -620,7 +618,7 @@ public: void extensionProcess(s32, s32); }; void Z2AudioCS::extensionProcess(s32, s32) { - STUB_LOG("Z2AudioMgr::play is a stub"); + STUB_LOG(); } #pragma mark JORServer @@ -655,21 +653,21 @@ JKRHeap* JKRHeap::sRootHeap2; // XXX this is defined for WII/SHIELD, should we #pragma mark mDoExt_onCupOnAupPacket #include mDoExt_offCupOnAupPacket::~mDoExt_offCupOnAupPacket() { - STUB_LOG("mDoExt_onCupOffAupPacket_c destructor is a stub"); + STUB_LOG(); } #pragma mark mDoExt_onCupOffAupPacket mDoExt_onCupOffAupPacket::~mDoExt_onCupOffAupPacket() { - STUB_LOG("mDoExt_onCupOffAupPacket_c destructor is a stub"); + STUB_LOG(); } #pragma mark dKankyo_vrboxHIO_c #include void dKankyo_vrboxHIO_c::dKankyo_vrboxHIOInfoUpDateF() { - STUB_LOG("dKankyo_vrboxHIO_c::dKankyo_vrboxHIOInfoUpDateF is a stub"); + STUB_LOG(); } void dKankyo_lightHIO_c::dKankyo_lightHIOInfoUpDateF() { - STUB_LOG("dKankyo_lightHIO_c::dKankyo_lightHIOInfoUpDateF is a stub"); + STUB_LOG(); } #pragma mark dKankyo_HIO_c @@ -1139,62 +1137,62 @@ dKankyo_navyHIO_c::dKankyo_navyHIO_c() { #pragma mark AI #include u32 AIGetDSPSampleRate(void) { - STUB_LOG("AIGetDSPSampleRate is a stub"); + STUB_LOG(); return 48000; // Default sample rate? } void AIInit(u8* stack) { - STUB_LOG("AIInit is a stub"); + STUB_LOG(); // This function initializes the AI system, but we don't have any specific implementation here. // In a real scenario, it would set up the audio interface and prepare it for use. } void AIInitDMA(u32 start_addr, u32 length) { - STUB_LOG("AIInitDMA is a stub"); + STUB_LOG(); } AIDCallback AIRegisterDMACallback(AIDCallback callback) { - STUB_LOG("AIRegisterDMACallback is a stub"); + STUB_LOG(); return callback; } void AISetDSPSampleRate(u32 rate) { // Should this link with the getsamplerate? this is very TODO - STUB_LOG("AISetDSPSampleRate is a stub"); + STUB_LOG(); } void AIStartDMA(void) { - STUB_LOG("AIStartDMA is a stub"); + STUB_LOG(); } void AIStopDMA(void) { - STUB_LOG("AIStopDMA is a stub"); + STUB_LOG(); } #pragma mark DVD #include s32 DVDCancel(volatile DVDCommandBlock* block) { - STUB_LOG("DVDCancel is a stub"); + STUB_LOG(); return 0; } s32 DVDCancel(DVDCommandBlock* block) { - STUB_LOG("DVDCancel is a stub"); + STUB_LOG(); return 0; } BOOL DVDChangeDir(const char* dirName) { - STUB_LOG("DVDChangeDir is a stub"); + STUB_LOG(); return TRUE; } BOOL DVDCheckDisk(void) { - STUB_LOG("DVDCheckDisk is a stub"); + STUB_LOG(); return TRUE; } BOOL DVDClose(DVDFileInfo* fileInfo) { - STUB_LOG("DVDClose is a stub"); + STUB_LOG(); return TRUE; } int DVDCloseDir(DVDDir* dir) { - STUB_LOG("DVDCloseDir is a stub"); + STUB_LOG(); return 0; } s32 DVDConvertPathToEntrynum(const char* pathPtr) { @@ -1219,19 +1217,19 @@ BOOL DVDFastOpen(s32 entrynum, DVDFileInfo* fileInfo) { return TRUE; } s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) { - STUB_LOG("DVDGetCommandBlockStatus is a stub"); + STUB_LOG(); return 0; } DVDDiskID* DVDGetCurrentDiskID(void) { - STUB_LOG("DVDGetCurrentDiskID is a stub"); + STUB_LOG(); return NULL; } s32 DVDGetDriveStatus(void) { - //STUB_LOG("DVDGetDriveStatus is a stub"); + STUB_LOG(); return 0; } void DVDInit(void) { - STUB_LOG("DVDInit is a stub"); + STUB_LOG(); } BOOL DVDOpen(const char* fileName, DVDFileInfo* fileInfo) { s32 entryNum = DVDConvertPathToEntrynum(fileName); @@ -1242,7 +1240,7 @@ BOOL DVDOpen(const char* fileName, DVDFileInfo* fileInfo) { return DVDFastOpen(entryNum, fileInfo); } int DVDOpenDir(const char* dirName, DVDDir* dir) { - STUB_LOG("DVDOpenDir is a stub"); + STUB_LOG(); return 0; } BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, @@ -1262,7 +1260,7 @@ BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, return TRUE; } int DVDReadDir(DVDDir* dir, DVDDirEntry* dirent) { - STUB_LOG("DVDReadDir is a stub"); + STUB_LOG(); return 0; } s32 DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 prio) { @@ -1277,45 +1275,15 @@ s32 DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 p } void DVDReadAbsAsyncForBS(void* a, struct bb2struct* b, int c, int d, void (*e)()) { - STUB_LOG("DVDReadAbsAsyncForBS is a stub"); + STUB_LOG(); } void DVDReadDiskID(void* a, DVDDiskID* b, void (*c)()) { - STUB_LOG("DVDReadDiskID is a stub"); + STUB_LOG(); } void DVDReset() { - STUB_LOG("DVDReset is a stub"); -} - -#pragma mark GD -#include -#include -void GDFlushCurrToMem(void) { - STUB_LOG("GDFlushCurrToMem is a stub"); -} -void GDInitGDLObj(GDLObj* dl, void* start, u32 length) { - ASSERTMSGLINE(40, !((u32)start & 0x1F), "start must be aligned to 32 bytes"); - ASSERTMSGLINE(41, !((u32)length & 0x1F), "length must be aligned to 32 bytes"); - dl->start = static_cast(start); - dl->ptr = static_cast(start); - dl->top = (u8*)start + length; - dl->length = length; -} -void GDOverflowed(void) { - STUB_LOG("GDOverflowed is a stub"); -} -void GDPadCurr32(void) { - STUB_LOG("GDPadCurr32 is a stub"); -} -void GDSetArray(GXAttr attr, void* base_ptr, u8 stride) { - STUB_LOG("GDSetArray is a stub"); -} -void GDSetArrayRaw(GXAttr attr, u32 base_ptr_raw, u8 stride) { - STUB_LOG("GDSetArrayRaw is a stub"); -} -void GDSetVtxDescv(const GXVtxDescList* attrPtr) { - STUB_LOG("GDSetVtxDescv is a stub"); + STUB_LOG(); } #pragma mark GX @@ -1323,54 +1291,54 @@ void GDSetVtxDescv(const GXVtxDescList* attrPtr) { // Moved-in GX helpers and helpers for metrics/project void __GXSetSUTexSize() { - STUB_LOG("__GXSetSUTexSize is a stub"); + STUB_LOG(); } // __GXSetVAT, __GXSetVCD, __GXUpdateBPMask: now provided by Aurora's GXManage.cpp (fifo branch) void GXSetGPMetric(GXPerf0 perf0, GXPerf1 perf1) { - // STUB_LOG("GXSetGPMetric is a stub"); + STUB_LOG(); } void GXReadGPMetric(u32* cnt0, u32* cnt1) { - // STUB_LOG("GXReadGPMetric is a stub"); + STUB_LOG(); } void GXClearGPMetric(void) { - // STUB_LOG("GXClearGPMetric is a stub"); + STUB_LOG(); } void GXReadMemMetric(u32* cp_req, u32* tc_req, u32* cpu_rd_req, u32* cpu_wr_req, u32* dsp_req, u32* io_req, u32* vi_req, u32* pe_req, u32* rf_req, u32* fi_req) { - // STUB_LOG("GXReadMemMetric is a stub"); + STUB_LOG(); } void GXClearMemMetric(void) { - // STUB_LOG("GXClearMemMetric is a stub"); + STUB_LOG(); } void GXClearVCacheMetric(void) { - // STUB_LOG("GXClearVCacheMetric is a stub"); + STUB_LOG(); } void GXReadPixMetric(u32* top_pixels_in, u32* top_pixels_out, u32* bot_pixels_in, u32* bot_pixels_out, u32* clr_pixels_in, u32* copy_clks) { - // STUB_LOG("GXReadPixMetric is a stub"); + STUB_LOG(); } void GXClearPixMetric(void) { - // STUB_LOG("GXClearPixMetric is a stub"); + STUB_LOG(); } void GXSetVCacheMetric(GXVCachePerf attr) { - // STUB_LOG("GXSetVCacheMetric is a stub"); + STUB_LOG(); } void GXReadVCacheMetric(u32* check, u32* miss, u32* stall) { - // STUB_LOG("GXReadVCacheMetric is a stub"); + STUB_LOG(); } void GXSetDrawSync(u16 token) { - // STUB_LOG("GXSetDrawSync is a stub"); + STUB_LOG(); } GXDrawSyncCallback GXSetDrawSyncCallback(GXDrawSyncCallback cb) { - STUB_LOG("GXSetDrawSyncCallback is a stub"); + STUB_LOG(); return cb; } void GXDrawCylinder(u8 numEdges) { - STUB_LOG("GXDrawCylinder is a stub"); + STUB_LOG(); } void GXWaitDrawDone(void) { - // STUB_LOG("GXWaitDrawDone is a stub"); + STUB_LOG(); } void GXSetTevIndTile(GXTevStageID tev_stage, GXIndTexStageID ind_stage, u16 tilesize_s, u16 tilesize_t, u16 tilespacing_s, u16 tilespacing_t, GXIndTexFormat format, @@ -1379,55 +1347,55 @@ void GXSetTevIndTile(GXTevStageID tev_stage, GXIndTexStageID ind_stage, u16 tile // TODO } void GXResetWriteGatherPipe(void) { - // STUB_LOG("GXResetWriteGatherPipe is a stub"); + STUB_LOG(); } void GXAbortFrame(void) { - STUB_LOG("GXAbortFrame is a stub"); + STUB_LOG(); } // GXEnableTexOffsets: now provided by Aurora's GXGeometry.cpp (fifo branch) OSThread* GXGetCurrentGXThread(void) { - STUB_LOG("GXGetCurrentGXThread is a stub"); + STUB_LOG(); return NULL; } void* GXGetFifoBase(const GXFifoObj* fifo) { - STUB_LOG("GXGetFifoBase is a stub"); + STUB_LOG(); return NULL; } u32 GXGetFifoSize(const GXFifoObj* fifo) { - STUB_LOG("GXGetFifoSize is a stub"); + STUB_LOG(); return 0; } u16 GXGetNumXfbLines(u16 efbHeight, f32 yScale) { - STUB_LOG("GXGetNumXfbLines is a stub"); + STUB_LOG(); return 0; } void GXGetScissor(u32* left, u32* top, u32* wd, u32* ht) { - STUB_LOG("GXGetScissor is a stub"); + STUB_LOG(); } u32 GXGetTexObjTlut(const GXTexObj* tex_obj) { - STUB_LOG("GXGetTexObjTlut is a stub"); + STUB_LOG(); return 0; } f32 GXGetYScaleFactor(u16 efbHeight, u16 xfbHeight) { - STUB_LOG("GXGetYScaleFactor is a stub"); + STUB_LOG(); return 0.0f; } void GXInitTexCacheRegion(GXTexRegion* region, GXBool is_32b_mipmap, u32 tmem_even, GXTexCacheSize size_even, u32 tmem_odd, GXTexCacheSize size_odd) { - STUB_LOG("GXInitTexCacheRegion is a stub"); + STUB_LOG(); } // XXX, this should be some struct? // GXRenderModeObj GXNtsc480IntDf; //GXRenderModeObj GXNtsc480Int; void GXPeekZ(u16 x, u16 y, u32* z) { - STUB_LOG("GXPeekZ is a stub"); + STUB_LOG(); *z = 0; } void GXReadXfRasMetric(u32* xf_wait_in, u32* xf_wait_out, u32* ras_busy, u32* clocks) { - STUB_LOG("GXReadXfRasMetric is a stub"); + STUB_LOG(); *xf_wait_in = 0; *xf_wait_out = 0; *ras_busy = 0; @@ -1435,104 +1403,81 @@ void GXReadXfRasMetric(u32* xf_wait_in, u32* xf_wait_out, u32* ras_busy, u32* cl } void GXSetCopyClamp(GXFBClamp clamp) { - STUB_LOG("GXSetCopyClamp is a stub"); + STUB_LOG(); } OSThread* GXSetCurrentGXThread(void) { - STUB_LOG("GXSetCurrentGXThread is a stub"); + STUB_LOG(); return NULL; } void GXSetMisc(GXMiscToken token, u32 val) { - STUB_LOG("GXSetMisc is a stub"); + STUB_LOG(); } void GXSetProjectionv(const f32* ptr) { - STUB_LOG("GXSetProjectionv is a stub"); + STUB_LOG(); } void GXSetVtxAttrFmtv(GXVtxFmt vtxfmt, const GXVtxAttrFmtList* list) { - STUB_LOG("GXSetVtxAttrFmtv is a stub"); + STUB_LOG(); } #pragma mark KPAD // is this actually used? extern "C" void KPADDisableDPD(s32) { - STUB_LOG("KPADDisableDPD is a stub"); + STUB_LOG(); } extern "C" void KPADEnableDPD(s32) { - STUB_LOG("KPADEnableDPD is a stub"); + STUB_LOG(); } // LC (consolidated above) void LCDisable(void) { - STUB_LOG("LCDisable is a stub"); + STUB_LOG(); } void LCQueueWait(__REGISTER u32 len) { - STUB_LOG("LCQueueWait is a stub"); + STUB_LOG(); } u32 LCStoreData(void* destAddr, void* srcAddr, u32 nBytes) { - STUB_LOG("LCStoreData is a stub"); + STUB_LOG(); return 0; } #pragma mark PPC Arch // MSR stuff? void PPCHalt() { - STUB_LOG("PPCHalt is a stub"); + STUB_LOG(); } extern "C" void PPCSync(void) { - // STUB_LOG("PPCSync is a stub"); + STUB_LOG(); } u32 PPCMfhid2() { - STUB_LOG("PPCMfhid2 is a stub"); + STUB_LOG(); return 0; } u32 PPCMfmsr() { - STUB_LOG("PPCMfmsr is a stub"); + STUB_LOG(); return 0; } void PPCMtmsr(u32 newMSR) { - STUB_LOG("PPCMtmsr is a stub"); + STUB_LOG(); } #pragma mark WPAD // uh.. this is revolution include not dolphin? typedef void (*WPADExtensionCallback)(s32 chan, s32 devType); extern "C" WPADExtensionCallback WPADSetExtensionCallback(s32 chan, WPADExtensionCallback cb) { - STUB_LOG("WPADSetExtensionCallback is a stub"); + STUB_LOG(); return cb; } -#pragma mark GF -#include -void GFSetZMode(u8 compare_enable, GXCompare func, u8 update_enable) { - STUB_LOG("GFSetZMode is a stub"); -} -void GFSetGenMode2(u8 nTexGens, u8 nChans, u8 nTevs, u8 nInds, GXCullMode cm) { - STUB_LOG("GFSetGenMode2 is a stub"); -} -void GFSetTevColorS10(GXTevRegID reg, GXColorS10 color) { - STUB_LOG("GFSetTevColorS10 is a stub"); -} -void GFSetBlendModeEtc(GXBlendMode type, GXBlendFactor src_factor, GXBlendFactor dst_factor, - GXLogicOp logic_op, u8 color_update_enable, u8 alpha_update_enable, - u8 dither_enable) { - STUB_LOG("GFSetBlendModeEtc is a stub"); -} -void GFSetChanAmbColor(GXChannelID chan, GXColor color) { - STUB_LOG("GFSetChanAmbColor is a stub"); -} -void GFSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor color) { - STUB_LOG("GFSetFog is a stub"); -} - #pragma mark DEBUGPAD #include dDebugPad_c::dDebugPad_c() { - STUB_LOG("constructing debug pad, stubbed?"); + STUB_LOG(); } #pragma mark f_ap @@ -1542,95 +1487,95 @@ u8 fapGm_HIO_c::mCaptureScreenDivH = 1; #pragma mark dMsgObject #include void dMsgObject_c::setWord(const char* i_word) { - STUB_LOG("dMsgObject_c::setWord is a stub"); + STUB_LOG(); } void dMsgObject_c::setSelectWord(int i_no, const char* i_word) { - STUB_LOG("dMsgObject_c::setSelectWord is a stub"); + STUB_LOG(); } #pragma mark HIO #include #include BOOL HIO2Close(s32 handle) { - STUB_LOG("HIO2Close is a stub"); + STUB_LOG(); return FALSE; } BOOL HIO2EnumDevices(HIO2EnumCallback callback) { - STUB_LOG("HIO2EnumDevices is a stub"); + STUB_LOG(); return FALSE; } BOOL HIO2Init(void) { - STUB_LOG("HIO2Init is a stub"); + STUB_LOG(); return FALSE; } s32 HIO2Open(HIO2DeviceType type, HIO2UnkCallback exiCb, HIO2DisconnectCallback disconnectCb) { - STUB_LOG("HIO2Open is a stub"); + STUB_LOG(); return 0; } BOOL HIO2Read(s32 handle, u32 addr, void* buffer, s32 size) { - STUB_LOG("HIO2Read is a stub"); + STUB_LOG(); return FALSE; } BOOL HIO2Write(s32 handle, u32 addr, void* buffer, s32 size) { - STUB_LOG("HIO2Write is a stub"); + STUB_LOG(); return FALSE; } BOOL HIORead(u32 addr, void* buffer, s32 size) { - STUB_LOG("HIORead is a stub"); + STUB_LOG(); return FALSE; } BOOL HIOWrite(u32 addr, void* buffer, s32 size) { - STUB_LOG("HIOWrite is a stub"); + STUB_LOG(); return FALSE; } #pragma mark JHICommBuf #include void JHICommBufHeader::init() { - STUB_LOG("JHICommBufHeader::init is a stub"); + STUB_LOG(); } int JHICommBufHeader::load() { - STUB_LOG("JHICommBufHeader::load is a stub"); + STUB_LOG(); return 0; } int JHICommBufReader::read(void*, int) { - STUB_LOG("JHICommBufReader::read is a stub"); + STUB_LOG(); return 0; } void JHICommBufReader::readEnd() { - STUB_LOG("JHICommBufReader::readEnd is a stub"); + STUB_LOG(); } int JHICommBufReader::readBegin() { - STUB_LOG("JHICommBufReader::readBegin is a stub"); + STUB_LOG(); return 0; } int JHICommBufWriter::writeBegin() { - STUB_LOG("JHICommBufWriter::writeBegin is a stub"); + STUB_LOG(); return 0; } int JHICommBufWriter::write(void*, int) { - STUB_LOG("JHICommBufWriter::write is a stub"); + STUB_LOG(); return 0; } void JHICommBufWriter::writeEnd() { - STUB_LOG("JHICommBufWriter::writeEnd is a stub"); + STUB_LOG(); } u32 JHICommBufReader::Header::getReadableSize() const { - STUB_LOG("JHICommBufReader::Header::getReadableSize is a stub"); + STUB_LOG(); return 0; } diff --git a/src/f_ap/f_ap_game.cpp b/src/f_ap/f_ap_game.cpp index ee050b1a63..6c61acb5dc 100644 --- a/src/f_ap/f_ap_game.cpp +++ b/src/f_ap/f_ap_game.cpp @@ -20,6 +20,7 @@ #include "d/actor/d_a_grass.h" #include "d/d_tresure.h" #include +#include "dusk/logging.h" fapGm_HIO_c::fapGm_HIO_c() { mUsingHostIO = true; @@ -656,7 +657,7 @@ void fapGm_HIO_c::listenPropertyEvent(const JORPropertyEvent* property) { mDoExt_destroySolidHeap(heap); JKRFree(model_buffer); - delete[] bdlData; + JKR_DELETE_ARRAY(bdlData); } } break; @@ -723,8 +724,7 @@ void fapGm_After() { void fapGm_Execute() { static u32 sExecCount = 0; if (sExecCount < 10 || (sExecCount % 300 == 0)) { - printf("[DIAG] fapGm_Execute frame=%d\n", sExecCount); - fflush(stdout); + DuskLog.debug("fapGm_Execute frame={}", sExecCount); } sExecCount++; @@ -732,9 +732,7 @@ void fapGm_Execute() { JUTDbPrint::getManager()->setCharColor(g_HIO.mColor); #endif - printf("[DIAG] fapGm_Execute: entering fpcM_Management...\n"); fflush(stdout); - fpcM_Management(NULL, fapGm_After); - printf("[DIAG] fapGm_Execute: fpcM_Management returned\n"); fflush(stdout); + fpcM_Management(NULL, fapGm_After); cCt_Counter(0); } diff --git a/src/f_op/f_op_scene_mng.cpp b/src/f_op/f_op_scene_mng.cpp index 5d516e8adf..6fe54bce57 100644 --- a/src/f_op/f_op_scene_mng.cpp +++ b/src/f_op/f_op_scene_mng.cpp @@ -8,6 +8,7 @@ #include "f_op/f_op_scene_iter.h" #include "f_op/f_op_scene_req.h" #include +#include "dusk/logging.h" scene_class* fopScnM_SearchByID(fpc_ProcID id) { return (scene_class*)fopScnIt_Judge((fop_ScnItFunc)fpcSch_JudgeByID, &id); @@ -30,9 +31,9 @@ fpc_ProcID fopScnM_DeleteReq(scene_class* i_scene) { } int fopScnM_CreateReq(s16 i_procName, s16 param_2, u16 param_3, uintptr_t i_data) { - printf("[DIAG] fopScnM_CreateReq: procName=%d fade=%d\n", i_procName, param_2); fflush(stdout); + DuskLog.debug("fopScnM_CreateReq: procName={} fade={}", i_procName, param_2); fpc_ProcID result = fopScnRq_Request(0, 0, i_procName, (void*)i_data, param_2, param_3); - printf("[DIAG] fopScnM_CreateReq: result=%d (error=%d)\n", result, fpcM_ERROR_PROCESS_ID_e); fflush(stdout); + DuskLog.debug("fopScnM_CreateReq: result={} (error={})", result, fmt::underlying(fpcM_ERROR_PROCESS_ID_e)); return result != fpcM_ERROR_PROCESS_ID_e; } diff --git a/src/f_op/f_op_scene_req.cpp b/src/f_op/f_op_scene_req.cpp index 05a44e10f1..79b87eee4c 100644 --- a/src/f_op/f_op_scene_req.cpp +++ b/src/f_op/f_op_scene_req.cpp @@ -10,6 +10,7 @@ #include "f_pc/f_pc_executor.h" #include "f_pc/f_pc_manager.h" #include +#include "dusk/logging.h" static cPhs_Step fopScnRq_phase_ClearOverlap(scene_request_class* i_sceneReq) { return fopOvlpM_ClearOfReq() == 1 ? cPhs_NEXT_e : cPhs_INIT_e; @@ -20,7 +21,7 @@ static cPhs_Step fopScnRq_phase_Execute(scene_request_class* i_sceneReq) { static int sExecLogCount = 0; cPhs_Step ret = (cPhs_Step)fpcNdRq_Execute(&i_sceneReq->create_request); if (sExecLogCount < 30) { - printf("[DIAG] fopScnRq_phase_Execute: ret=%d name=%d\n", ret, i_sceneReq->create_request.name); fflush(stdout); + DuskLog.debug("fopScnRq_phase_Execute: ret={} name={}", ret, i_sceneReq->create_request.name); sExecLogCount++; } return ret; diff --git a/src/f_pc/f_pc_base.cpp b/src/f_pc/f_pc_base.cpp index edd8a842f4..08a462ead8 100644 --- a/src/f_pc/f_pc_base.cpp +++ b/src/f_pc/f_pc_base.cpp @@ -16,6 +16,7 @@ #include "f_pc/f_pc_debug_sv.h" #include "Z2AudioLib/Z2AudioMgr.h" #include +#include "dusk/logging.h" #if TARGET_PC #include "d/d_procname.h" @@ -135,13 +136,13 @@ base_process_class* fpcBs_Create(s16 i_profname, fpc_ProcID i_procID, void* i_ap u32 size; pprofile = (process_profile_definition*)fpcPf_Get(i_profname); - printf("[DIAG] fpcBs_Create: pid=%d profname=%s (%d) profile=%p procSize=%d unkSize=%d\n", - i_procID, getProcName(i_profname), i_profname, pprofile, pprofile->process_size, pprofile->unk_size); fflush(stdout); + DuskLog.debug("fpcBs_Create: pid={} profname={} ({}) profile={} procSize={} unkSize={}", + i_procID, getProcName(i_profname), i_profname, (void*)pprofile, pprofile->process_size, pprofile->unk_size); size = pprofile->process_size + pprofile->unk_size; pprocess = (base_process_class*)cMl::memalignB(-4, size); if (pprocess == NULL) { - printf("[DIAG] fpcBs_Create: memalignB FAILED for size=%u\n", size); fflush(stdout); + DuskLog.debug("fpcBs_Create: memalignB FAILED for size={}", size); return NULL; } diff --git a/src/f_pc/f_pc_create_req.cpp b/src/f_pc/f_pc_create_req.cpp index 66ea2be21e..e5fdd5ef00 100644 --- a/src/f_pc/f_pc_create_req.cpp +++ b/src/f_pc/f_pc_create_req.cpp @@ -13,6 +13,7 @@ #include "f_pc/f_pc_layer.h" #include "f_pc/f_pc_debug_sv.h" #include +#include "dusk/logging.h" BOOL fpcCtRq_isCreatingByID(create_tag* i_createTag, fpc_ProcID* i_id) { fpc_ProcID id = ((create_request*)i_createTag->base.mpTagData)->id; @@ -95,7 +96,7 @@ BOOL fpcCtRq_Do(create_request* i_request) { static int sCtRqDoLogCount = 0; if (sCtRqDoLogCount < 30) { - printf("[DIAG] fpcCtRq_Do: phase=%d process=%p\n", phase, i_request->process); fflush(stdout); + DuskLog.debug("fpcCtRq_Do: phase={} process={}", phase, (void*)i_request->process); sCtRqDoLogCount++; } diff --git a/src/f_pc/f_pc_draw.cpp b/src/f_pc/f_pc_draw.cpp index 0a3162793a..0677a47827 100644 --- a/src/f_pc/f_pc_draw.cpp +++ b/src/f_pc/f_pc_draw.cpp @@ -9,6 +9,7 @@ #include "f_pc/f_pc_node.h" #include "f_pc/f_pc_pause.h" #include +#include "dusk/logging.h" int fpcDw_Execute(base_process_class* i_proc) { if (!fpcPause_IsEnable(i_proc, 2)) { @@ -35,13 +36,13 @@ int fpcDw_Execute(base_process_class* i_proc) { int fpcDw_Handler(fpcDw_HandlerFuncFunc i_iterHandler, fpcDw_HandlerFunc i_func) { static int sDwLogCount = 0; int ret; - if (sDwLogCount < 5) { printf("[DIAG] fpcDw_Handler: before BeforeOfDraw\n"); fflush(stdout); } + if (sDwLogCount < 5) { DuskLog.debug("fpcDw_Handler: before BeforeOfDraw"); } cAPIGph_BeforeOfDraw(); - if (sDwLogCount < 5) { printf("[DIAG] fpcDw_Handler: before draw iteration\n"); fflush(stdout); } + if (sDwLogCount < 5) { DuskLog.debug("fpcDw_Handler: before draw iteration"); } ret = i_iterHandler(i_func); - if (sDwLogCount < 5) { printf("[DIAG] fpcDw_Handler: before AfterOfDraw\n"); fflush(stdout); } + if (sDwLogCount < 5) { DuskLog.debug("fpcDw_Handler: before AfterOfDraw"); } cAPIGph_AfterOfDraw(); - if (sDwLogCount < 5) { printf("[DIAG] fpcDw_Handler: done\n"); fflush(stdout); } + if (sDwLogCount < 5) { DuskLog.debug("fpcDw_Handler: done"); } sDwLogCount++; return ret; } diff --git a/src/f_pc/f_pc_manager.cpp b/src/f_pc/f_pc_manager.cpp index 1ecb2b7473..4f676c242f 100644 --- a/src/f_pc/f_pc_manager.cpp +++ b/src/f_pc/f_pc_manager.cpp @@ -43,8 +43,6 @@ BOOL fpcM_IsCreating(fpc_ProcID i_id) { } void fpcM_Management(fpcM_ManagementFunc i_preExecuteFn, fpcM_ManagementFunc i_postExecuteFn) { - static int sMgmtLogCount = 0; - MtxInit(); if (!fapGm_HIO_c::isCaptureScreen()) { dComIfGd_peekZdata(); @@ -52,16 +50,10 @@ void fpcM_Management(fpcM_ManagementFunc i_preExecuteFn, fpcM_ManagementFunc i_p fapGm_HIO_c::executeCaptureScreen(); bool shutdownRet = dShutdownErrorMsg_c::execute(); - if (sMgmtLogCount < 10) { - printf("[DIAG] fpcM_Management: shutdown=%d\n", shutdownRet); fflush(stdout); - } if (!shutdownRet) { static bool l_dvdError = false; bool dvdErrRet = dDvdErrorMsg_c::execute(); - if (sMgmtLogCount < 10) { - printf("[DIAG] fpcM_Management: dvdError=%d\n", dvdErrRet); fflush(stdout); - } if (!dvdErrRet) { if (l_dvdError) { dLib_time_c::startTime(); @@ -71,55 +63,37 @@ void fpcM_Management(fpcM_ManagementFunc i_preExecuteFn, fpcM_ManagementFunc i_p cAPIGph_Painter(); - if (sMgmtLogCount < 10) { printf("[DIAG] fpcM_Management: after cAPIGph_Painter\n"); fflush(stdout); } - if (!dPa_control_c::isStatus(1)) { fpcDt_Handler(); } else { dPa_control_c::offStatus(1); } - if (sMgmtLogCount < 10) { printf("[DIAG] fpcM_Management: after fpcDt_Handler\n"); fflush(stdout); } - if (!fpcPi_Handler()) { JUT_ASSERT(353, FALSE); } - if (sMgmtLogCount < 10) { printf("[DIAG] fpcM_Management: after fpcPi_Handler\n"); fflush(stdout); } - if (!fpcCt_Handler()) { JUT_ASSERT(357, FALSE); } - if (sMgmtLogCount < 10) { printf("[DIAG] fpcM_Management: after fpcCt_Handler\n"); fflush(stdout); } - if (i_preExecuteFn != NULL) { i_preExecuteFn(); } - if (sMgmtLogCount < 10) { printf("[DIAG] fpcM_Management: after preExecute\n"); fflush(stdout); } - if (!fapGm_HIO_c::isCaptureScreen()) { fpcEx_Handler((fpcLnIt_QueueFunc)fpcM_Execute); } - if (sMgmtLogCount < 10) { printf("[DIAG] fpcM_Management: after fpcEx_Handler\n"); fflush(stdout); } - if (!fapGm_HIO_c::isCaptureScreen() || fapGm_HIO_c::getCaptureScreenDivH() != 1) { fpcDw_Handler((fpcDw_HandlerFuncFunc)fpcM_DrawIterater, (fpcDw_HandlerFunc)fpcM_Draw); } - if (sMgmtLogCount < 10) { printf("[DIAG] fpcM_Management: after fpcDw_Handler\n"); fflush(stdout); } - if (i_postExecuteFn != NULL) { - if (sMgmtLogCount < 10) { - printf("[DIAG] fpcM_Management: calling postExecuteFn (fapGm_After)\n"); fflush(stdout); - } i_postExecuteFn(); } dComIfGp_drawSimpleModel(); - sMgmtLogCount++; } else if (!l_dvdError) { dLib_time_c::stopTime(); Z2GetSoundMgr()->pauseAllGameSound(true); diff --git a/src/f_pc/f_pc_node_req.cpp b/src/f_pc/f_pc_node_req.cpp index 7ecf1ea7e1..32d04055d9 100644 --- a/src/f_pc/f_pc_node_req.cpp +++ b/src/f_pc/f_pc_node_req.cpp @@ -13,6 +13,7 @@ #include "f_pc/f_pc_manager.h" #include "f_pc/f_pc_debug_sv.h" #include +#include "dusk/logging.h" void fpcNdRq_RequestQTo(node_create_request* i_request) { fpcLy_CreatedMesg(i_request->layer); @@ -48,12 +49,12 @@ int fpcNdRq_phase_IsCreated(node_create_request* i_request) { } int fpcNdRq_phase_Create(node_create_request* i_request) { - printf("[DIAG] fpcNdRq_phase_Create: name=%d layer=%p\n", i_request->name, i_request->layer); fflush(stdout); + DuskLog.debug("fpcNdRq_phase_Create: name={} layer={}", i_request->name, (void*)i_request->layer); i_request->creating_id = fpcSCtRq_Request(i_request->layer, i_request->name, (stdCreateFunc)i_request->create_req_methods->post_method, i_request, i_request->data); - printf("[DIAG] fpcNdRq_phase_Create: creating_id=%d (error=%d)\n", i_request->creating_id, fpcM_ERROR_PROCESS_ID_e); fflush(stdout); + DuskLog.debug("fpcNdRq_phase_Create: creating_id={} (error={})", i_request->creating_id, fmt::underlying(fpcM_ERROR_PROCESS_ID_e)); if (i_request->creating_id == fpcM_ERROR_PROCESS_ID_e) { return cPhs_UNK3_e; } @@ -145,7 +146,7 @@ int fpcNdRq_Handler() { static int sNdRqLogCount = 0; if (l_fpcNdRq_Queue.mSize > 0 && sNdRqLogCount < 30) { - printf("[DIAG] fpcNdRq_Handler: queue size=%d\n", l_fpcNdRq_Queue.mSize); fflush(stdout); + DuskLog.debug("fpcNdRq_Handler: queue size={}", l_fpcNdRq_Queue.mSize); sNdRqLogCount++; } diff --git a/src/f_pc/f_pc_stdcreate_req.cpp b/src/f_pc/f_pc_stdcreate_req.cpp index fa8ac20ae6..a262a1bac6 100644 --- a/src/f_pc/f_pc_stdcreate_req.cpp +++ b/src/f_pc/f_pc_stdcreate_req.cpp @@ -16,6 +16,7 @@ #endif #include #include "os_report.h" +#include "dusk/logging.h" typedef struct standard_create_request_class { /* 0x00 */ create_request base; @@ -31,7 +32,7 @@ typedef struct standard_create_request_class { int fpcSCtRq_phase_Load(standard_create_request_class* i_request) { int ret = fpcLd_Load(i_request->process_name); - printf("[DIAG] fpcSCtRq_phase_Load: procName=%d ret=%d\n", i_request->process_name, ret); fflush(stdout); + DuskLog.debug("[DIAG] fpcSCtRq_phase_Load: procName={} ret={}", i_request->process_name, ret); switch (ret) { case cPhs_INIT_e: @@ -46,18 +47,18 @@ int fpcSCtRq_phase_Load(standard_create_request_class* i_request) { } int fpcSCtRq_phase_CreateProcess(standard_create_request_class* i_request) { - printf("[DIAG] fpcSCtRq_phase_CreateProcess: procName=%d\n", i_request->process_name); fflush(stdout); + DuskLog.debug("fpcSCtRq_phase_CreateProcess: procName={}", i_request->process_name); fpcLy_SetCurrentLayer(i_request->base.layer); i_request->base.process = fpcBs_Create(i_request->process_name, i_request->base.id, i_request->process_append); if (i_request->base.process == NULL) { - printf("[DIAG] fpcSCtRq_phase_CreateProcess: fpcBs_Create FAILED for procName=%d\n", i_request->process_name); fflush(stdout); + DuskLog.debug("fpcSCtRq_phase_CreateProcess: fpcBs_Create FAILED for procName={}", i_request->process_name); OS_REPORT("fpcSCtRq_phase_CreateProcess %d\n", i_request->process_name); fpcLd_Free(i_request->process_name); return cPhs_ERROR_e; } else { - printf("[DIAG] fpcSCtRq_phase_CreateProcess: fpcBs_Create OK proc=%p\n", i_request->base.process); fflush(stdout); + DuskLog.debug("fpcSCtRq_phase_CreateProcess: fpcBs_Create OK proc={}", (void*)i_request->base.process); i_request->base.process->create_req = &i_request->base; return cPhs_NEXT_e; } @@ -68,7 +69,7 @@ int fpcSCtRq_phase_SubCreateProcess(standard_create_request_class* i_request) { int ret = fpcBs_SubCreate(i_request->base.process); static int sSubCreateLogCount = 0; if (sSubCreateLogCount < 20) { - printf("[DIAG] fpcSCtRq_phase_SubCreateProcess: pid=%d procName=%04x ret=%d\n", i_request->base.id, i_request->process_name, ret); fflush(stdout); + DuskLog.debug("fpcSCtRq_phase_SubCreateProcess: pid={} procName={:04x} ret={}", i_request->base.id, i_request->process_name, ret); sSubCreateLogCount++; } diff --git a/src/m_Do/m_Do_controller_pad.cpp b/src/m_Do/m_Do_controller_pad.cpp index dfc784a8eb..c8a8566313 100644 --- a/src/m_Do/m_Do_controller_pad.cpp +++ b/src/m_Do/m_Do_controller_pad.cpp @@ -18,17 +18,17 @@ interface_of_controller_pad mDoCPd_c::m_debugCpadInfo[4]; void mDoCPd_c::create() { #if PLATFORM_GCN || PLATFORM_SHIELD - m_gamePad[0] = new JUTGamePad(JUTGamePad::EPort1); + m_gamePad[0] = JKR_NEW JUTGamePad(JUTGamePad::EPort1); #endif if (DEBUG || mDoMain::developmentMode != 0) { #if PLATFORM_WII - m_gamePad[0] = new JUTGamePad(JUTGamePad::EPort1); + m_gamePad[0] = JKR_NEW JUTGamePad(JUTGamePad::EPort1); #endif - m_gamePad[1] = new JUTGamePad(JUTGamePad::EPort2); - m_gamePad[2] = new JUTGamePad(JUTGamePad::EPort3); - m_gamePad[3] = new JUTGamePad(JUTGamePad::EPort4); + m_gamePad[1] = JKR_NEW JUTGamePad(JUTGamePad::EPort2); + m_gamePad[2] = JKR_NEW JUTGamePad(JUTGamePad::EPort3); + m_gamePad[3] = JKR_NEW JUTGamePad(JUTGamePad::EPort4); } else { #if PLATFORM_WII m_gamePad[0] = NULL; diff --git a/src/m_Do/m_Do_dvd_thread.cpp b/src/m_Do/m_Do_dvd_thread.cpp index 6a7e4a8bcf..33ff950ab3 100644 --- a/src/m_Do/m_Do_dvd_thread.cpp +++ b/src/m_Do/m_Do_dvd_thread.cpp @@ -188,7 +188,7 @@ mDoDvdThd_callback_c::mDoDvdThd_callback_c(mDoDvdThd_callback_func pFunc, void* mDoDvdThd_callback_c* mDoDvdThd_callback_c::create(mDoDvdThd_callback_func pFunc, void* pData) { mDoDvdThd_callback_c* callCmd = - new (mDoExt_getCommandHeap(), -4) mDoDvdThd_callback_c(pFunc, pData); + JKR_NEW_ARGS (mDoExt_getCommandHeap(), -4) mDoDvdThd_callback_c(pFunc, pData); if (callCmd != NULL) { mDoDvdThd::l_param.addition(callCmd); if (mDoDvdThd::DVDLogoMode) { @@ -219,12 +219,12 @@ mDoDvdThd_mountArchive_c::mDoDvdThd_mountArchive_c(u8 param_0) { mDoDvdThd_mountArchive_c* mDoDvdThd_mountArchive_c::create(char const* pArchivePath, u8 mountDirection, JKRHeap* pHeap) { mDoDvdThd_mountArchive_c* mountArcCmd = - new (mDoExt_getCommandHeap(), -4) mDoDvdThd_mountArchive_c(mountDirection); + JKR_NEW_ARGS (mDoExt_getCommandHeap(), -4) mDoDvdThd_mountArchive_c(mountDirection); if (mountArcCmd != NULL) { mountArcCmd->mEntryNumber = my_DVDConvertPathToEntrynum(pArchivePath); if (mountArcCmd->mEntryNumber == -1) { mountArcCmd->mIsDone = true; - delete mountArcCmd; + JKR_DELETE(mountArcCmd); mountArcCmd = NULL; } else { mountArcCmd->mHeap = pHeap; @@ -263,10 +263,10 @@ s32 mDoDvdThd_mountArchive_c::execute() { #endif if (mMountDirection == 0) { memArchive = - new (heap, 0) JKRMemArchive(mEntryNumber, JKRArchive::MOUNT_DIRECTION_HEAD); + JKR_NEW_ARGS (heap, 0) JKRMemArchive(mEntryNumber, JKRArchive::MOUNT_DIRECTION_HEAD); } else { memArchive = - new (heap, -4) JKRMemArchive(mEntryNumber, JKRArchive::MOUNT_DIRECTION_TAIL); + JKR_NEW_ARGS (heap, -4) JKRMemArchive(mEntryNumber, JKRArchive::MOUNT_DIRECTION_TAIL); } if (memArchive != NULL && memArchive->isMounted()) { mArchive = memArchive; @@ -282,7 +282,7 @@ s32 mDoDvdThd_mountArchive_c::execute() { OSReport_Error("mDoDvdThd_mountArchive_c::execute マウント失敗\n"); OS_REPORT_ERROR("Name = %s\n", mDoDvdHack::ConvertEntrynumToName(mEntryNumber)); if (memArchive) { - delete memArchive; + JKR_DELETE(memArchive); } memArchive = NULL; #if PLATFORM_GCN @@ -327,9 +327,9 @@ s32 mDoDvdThd_mountAramArchive_c::execute() { BOOL result = FALSE; if (!mArchive) { if (mMountDirection == 0) { - mArchive = new (heap, 0x20) JKRAramArchive(); + mArchive = JKR_NEW_ARGS (heap, 0x20) JKRAramArchive(); } else { - mArchive = new (heap, -0x20) JKRAramArchive(); + mArchive = JKR_NEW_ARGS (heap, -0x20) JKRAramArchive(); } #if DEBUG if (mDoDvdThd::verbose) { @@ -374,12 +374,12 @@ mDoDvdThd_mountXArchive_c* mDoDvdThd_mountXArchive_c::create(char const* pArchiv JKRArchive::EMountMode mountMode, JKRHeap* pHeap) { mDoDvdThd_mountXArchive_c* mountXArcCmd = - new (mDoExt_getCommandHeap(), -4) mDoDvdThd_mountXArchive_c(mountDirection, mountMode); + JKR_NEW_ARGS (mDoExt_getCommandHeap(), -4) mDoDvdThd_mountXArchive_c(mountDirection, mountMode); if (mountXArcCmd != NULL) { mountXArcCmd->mEntryNum = my_DVDConvertPathToEntrynum(pArchivePath); if (mountXArcCmd->mEntryNum == -1) { mountXArcCmd->mIsDone = true; - delete mountXArcCmd; + JKR_DELETE(mountXArcCmd); mountXArcCmd = NULL; } else { mountXArcCmd->mHeap = pHeap; @@ -458,12 +458,12 @@ mDoDvdThd_toMainRam_c::mDoDvdThd_toMainRam_c(u8 param_0) { mDoDvdThd_toMainRam_c* mDoDvdThd_toMainRam_c::create(char const* pArchivePath, u8 mountDirection, JKRHeap* pHeap) { mDoDvdThd_toMainRam_c* toMainRAMCmd = - new (mDoExt_getCommandHeap(), -4) mDoDvdThd_toMainRam_c(mountDirection); + JKR_NEW_ARGS (mDoExt_getCommandHeap(), -4) mDoDvdThd_toMainRam_c(mountDirection); if (toMainRAMCmd != NULL) { toMainRAMCmd->mEntryNum = my_DVDConvertPathToEntrynum(pArchivePath); if (toMainRAMCmd->mEntryNum == -1) { toMainRAMCmd->mIsDone = true; - delete toMainRAMCmd; + JKR_DELETE(toMainRAMCmd); toMainRAMCmd = NULL; } else { toMainRAMCmd->mHeap = pHeap; diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 6b438fa5c0..eefbf4716b 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -24,6 +24,7 @@ #include "m_Do/m_Do_mtx.h" #include #include +#include "dusk/logging.h" u8 mDoExt::CurrentHeapAdjustVerbose; u8 mDoExt::HeapAdjustVerbose; @@ -211,7 +212,7 @@ int mDoExt_bckAnm::init(J3DAnmTransform* i_bck, int i_play, int i_attr, f32 i_ra JUT_ASSERT(614, (i_modify || isCurrentSolidHeap()) && i_bck != NULL); mAnmTransform = i_bck; if (!i_modify) { - mAnm = new J3DMtxCalcAnimation, J3DMtxCalcJ3DSysInitMaya>(mAnmTransform); + mAnm = JKR_NEW J3DMtxCalcAnimation, J3DMtxCalcJ3DSysInitMaya>(mAnmTransform); if (!mAnm) { return 0; } @@ -423,8 +424,8 @@ static void dummy2() { J3DTevSwapModeTable tevSwapModeTable; J3DIndTexOrder indTexOrder; - J3DIndTexMtx* indTexMtx = new J3DIndTexMtx(); - J3DIndTexCoordScale* indTexCoordScale = new J3DIndTexCoordScale(); + J3DIndTexMtx* indTexMtx = JKR_NEW J3DIndTexMtx(); + J3DIndTexCoordScale* indTexCoordScale = JKR_NEW J3DIndTexCoordScale(); J3DColorBlock* colorBlock = NULL; colorBlock->setColorChanNum((u8)NULL); colorBlock->setMatColor(0, gxColor); @@ -504,7 +505,7 @@ static void dummy2() { int mDoExt_invisibleModel::create(J3DModel* i_model, u8 param_1) { J3DModelData* model_data = i_model->getModelData(); - mpPackets = new mDoExt_invJntPacket[model_data->getJointNum()]; + mpPackets = JKR_NEW mDoExt_invJntPacket[model_data->getJointNum()]; if (mpPackets == NULL) { return 0; } @@ -1319,18 +1320,18 @@ int mDoExt_McaMorf::create(J3DModelData* modelData, mDoExt_McaMorfCallBack1_c* c } } if (param_8) { - mpSound = new mDoExt_zelAnime(); + mpSound = JKR_NEW mDoExt_zelAnime(); if (!mpSound) { goto cleanup; } } setAnm(anmTransform, param_4, 0.0f, param_5, param_6, param_7, param_9); mPrevMorf = -1.0f; - mpTransformInfo = new J3DTransformInfo[modelData->getJointNum()]; + mpTransformInfo = JKR_NEW J3DTransformInfo[modelData->getJointNum()]; if (!mpTransformInfo) { goto cleanup; } - mpQuat = new Quaternion[modelData->getJointNum()]; + mpQuat = JKR_NEW Quaternion[modelData->getJointNum()]; if (mpQuat) { J3DTransformInfo* info = mpTransformInfo; Quaternion* quat = mpQuat; @@ -1577,9 +1578,9 @@ int mDoExt_McaMorfSO::create(J3DModelData* i_modelData, mDoExt_McaMorfCallBack1_ setAnm(param_3, param_4, 0.0f, param_5, param_6, param_7); mPrevMorf = -1.0f; - mpTransformInfo = new J3DTransformInfo[i_modelData->getJointNum()]; + mpTransformInfo = JKR_NEW J3DTransformInfo[i_modelData->getJointNum()]; if (mpTransformInfo != NULL) { - mpQuat = new Quaternion[i_modelData->getJointNum()]; + mpQuat = JKR_NEW Quaternion[i_modelData->getJointNum()]; if (mpQuat != NULL) { J3DTransformInfo* transInfo_p = mpTransformInfo; @@ -1737,7 +1738,7 @@ void mDoExt_McaMorfSO::setAnm(J3DAnmTransform* i_anm, int i_attr, f32 i_morf, f3 setMorf(i_morf); #if TARGET_PC - puts("We don't know why, but initAnime doesn't work"); + STUB_LOG(); return; #endif if (mpSound != NULL) { @@ -1865,13 +1866,13 @@ mDoExt_McaMorf2::~mDoExt_McaMorf2() { setAnm(param_3, param_4, 0.0f, param_5, 0.0f, param_6, param_7, param_8); mPrevMorf = -1.0f; - mpTransformInfo = new J3DTransformInfo[param_0->getJointNum()]; + mpTransformInfo = JKR_NEW J3DTransformInfo[param_0->getJointNum()]; if (mpTransformInfo == NULL) { ERROR_EXIT(); return 0; } - mpQuat = new Quaternion[param_0->getJointNum()]; + mpQuat = JKR_NEW Quaternion[param_0->getJointNum()]; if (mpQuat == NULL) { ERROR_EXIT(); return 0; @@ -2260,13 +2261,13 @@ void mDoExt_invJntPacket::draw() { } int mDoExt_3Dline_c::init(u16 param_0, int param_1, BOOL param_2) { - field_0x0 = new cXyz[param_0]; + field_0x0 = JKR_NEW cXyz[param_0]; if (field_0x0 == NULL) { return 0; } if (param_1 != 0) { - field_0x4 = new f32[param_0]; + field_0x4 = JKR_NEW f32[param_0]; if (field_0x4 == NULL) { return 0; } @@ -2276,33 +2277,33 @@ int mDoExt_3Dline_c::init(u16 param_0, int param_1, BOOL param_2) { int sp20 = param_0 * 2; - field_0x8[0] = new cXyz[sp20]; + field_0x8[0] = JKR_NEW cXyz[sp20]; if (field_0x8 == NULL) { return 0; } - field_0x8[1] = new cXyz[sp20]; + field_0x8[1] = JKR_NEW cXyz[sp20]; if (field_0x8[1] == NULL) { return 0; } - field_0x10[0] = new mDoExt_3Dline_field_0x10_c[sp20]; + field_0x10[0] = JKR_NEW mDoExt_3Dline_field_0x10_c[sp20]; if (field_0x10 == NULL) { return 0; } - field_0x10[1] = new mDoExt_3Dline_field_0x10_c[sp20]; + field_0x10[1] = JKR_NEW mDoExt_3Dline_field_0x10_c[sp20]; if (field_0x10[1] == NULL) { return 0; } if (param_2) { - field_0x18[0] = new cXy[sp20]; + field_0x18[0] = JKR_NEW cXy[sp20]; if (field_0x18[0] == NULL) { return 0; } - field_0x18[1] = new cXy[sp20]; + field_0x18[1] = JKR_NEW cXy[sp20]; if (field_0x18[1] == NULL) { return 0; } @@ -2328,7 +2329,7 @@ int mDoExt_3DlineMat0_c::init(u16 param_0, u16 param_1, int param_2) { field_0x10 = param_0; field_0x12 = param_1; - field_0x18 = new mDoExt_3Dline_c[param_0]; + field_0x18 = JKR_NEW mDoExt_3Dline_c[param_0]; if (field_0x18 == NULL) { return 0; } @@ -2634,7 +2635,7 @@ void mDoExt_3DlineMat0_c::update(int param_0, GXColor& param_2, dKy_tevstr_c* pa int mDoExt_3DlineMat1_c::init(u16 param_0, u16 param_1, ResTIMG* param_2, int param_3) { mNumLines = param_0; field_0x32 = param_1; - mpLines = new mDoExt_3Dline_c[param_0]; + mpLines = JKR_NEW mDoExt_3Dline_c[param_0]; if (mpLines == NULL) { return 0; } @@ -2698,9 +2699,11 @@ void mDoExt_3DlineMat1_c::draw() { mDoExt_3Dline_c* lines = mpLines; u16 vert_num = field_0x34 << 1; for (s32 i = 0; i < mNumLines; i++) { - GXSETARRAY(GX_VA_POS, ((mDoExt_3Dline_c*)((intptr_t)lines + (mIsDrawn << 2)))->field_0x8, vert_num * sizeof(cXyz), sizeof(cXyz)); - GXSETARRAY(GX_VA_NRM, ((mDoExt_3Dline_c*)((intptr_t) lines + (mIsDrawn << 2)))->field_0x10, vert_num * sizeof(mDoExt_3Dline_field_0x10_c), sizeof(mDoExt_3Dline_field_0x10_c)); - GXSETARRAY(GX_VA_TEX0, ((mDoExt_3Dline_c*)((intptr_t)lines + (mIsDrawn << 2)))->field_0x18, vert_num * sizeof(cXy), sizeof(cXy)); + GXSETARRAY(GX_VA_POS, lines->field_0x8[mIsDrawn], vert_num * sizeof(cXyz), sizeof(cXyz)); + GXSETARRAY(GX_VA_NRM, lines->field_0x10[mIsDrawn], + vert_num * sizeof(mDoExt_3Dline_field_0x10_c), + sizeof(mDoExt_3Dline_field_0x10_c)); + GXSETARRAY(GX_VA_TEX0, lines->field_0x18[mIsDrawn], vert_num * sizeof(cXy), sizeof(cXy)); GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, vert_num); u16 j = 0; @@ -3575,7 +3578,7 @@ static void mDoExt_initFontCommon(JUTFont** mDoExt_font_p, ResFONT** mDoExt_resf JUT_ASSERT_MSG(7144, *mDoExt_resfont != NULL, "mDoExt_resfont != 0"); if (param_5 == 0) { u32 cacheSize = JUTCacheFont::calcCacheSize(param_7, param_6); - JUTCacheFont* cacheFont = new (param_2, 0) JUTCacheFont(*mDoExt_resfont, cacheSize, param_2); + JUTCacheFont* cacheFont = JKR_NEW_ARGS (param_2, 0) JUTCacheFont(*mDoExt_resfont, cacheSize, param_2); if (cacheFont->isValid()) { // "Allocated %d bytes for font cache buffer size" OS_REPORT("\nキャッシュフォントバッファサイズとして %d バイト確保しました\n", cacheSize); @@ -3591,7 +3594,7 @@ static void mDoExt_initFontCommon(JUTFont** mDoExt_font_p, ResFONT** mDoExt_resf JKRRemoveResource(*mDoExt_resfont, NULL); *mDoExt_resfont = NULL; } else { - *mDoExt_font = new JUTResFont(*mDoExt_resfont, param_2); + *mDoExt_font = JKR_NEW JUTResFont(*mDoExt_resfont, param_2); // "Allocated %d bytes for the font buffer size" OS_REPORT("\nフォントバッファサイズとして %d バイト確保しました\n", JKRGetMemBlockSize(param_2, *mDoExt_font)); @@ -3601,7 +3604,7 @@ static void mDoExt_initFontCommon(JUTFont** mDoExt_font_p, ResFONT** mDoExt_resf if (*mDoExt_font != NULL && !(*mDoExt_font)->isValid()) { // "Failed to create cache font class" OSReport_FatalError("\nキャッシュフォントクラス作成に失敗しました\n"); - delete *mDoExt_font; + JKR_DELETE(*mDoExt_font); *mDoExt_font = NULL; } JUT_ASSERT_MSG(7183, *mDoExt_font != NULL, "mDoExt_font != 0"); @@ -3639,7 +3642,7 @@ void mDoExt_removeMesgFont() { mDoExt_font0_getCount--; JUT_ASSERT(7241, mDoExt_font0_getCount > 0); if (mDoExt_font0_getCount == 0) { - delete mDoExt_font0; + JKR_DELETE(mDoExt_font0); mDoExt_font0 = NULL; if (mDoExt_resfont0 != NULL) { #if REGION_JPN @@ -3705,7 +3708,7 @@ void mDoExt_removeSubFont() { mDoExt_font2_getCount--; JUT_ASSERT(7357, mDoExt_font2_getCount > 0); if (mDoExt_font2_getCount == 0) { - delete mDoExt_font2; + JKR_DELETE(mDoExt_font2); mDoExt_font2 = NULL; if (mDoExt_resfont2 != NULL) { JKRFree(mDoExt_resfont2); @@ -3717,7 +3720,7 @@ void mDoExt_removeSubFont() { J3DModel* mDoExt_J3DModel__create(J3DModelData* i_modelData, u32 i_modelFlag, u32 i_differedDlistFlag) { if (i_modelData != NULL) { - J3DModel* model = new J3DModel(); + J3DModel* model = JKR_NEW J3DModel(); if (model != NULL) { #if DEBUG @@ -3812,7 +3815,7 @@ void DummyCheckHeap::setHeap(JKRHeap* heap) { int DummyCheckHeap_init() { JUT_ASSERT(7634, dch == NULL); - dch = new((JKRHeap*)mDoExt_getZeldaHeap(), 0) DummyCheckHeap(); + dch = JKR_NEW_ARGS((JKRHeap*)mDoExt_getZeldaHeap(), 0) DummyCheckHeap(); if (dch == NULL) { return false; } diff --git a/src/m_Do/m_Do_ext2.cpp b/src/m_Do/m_Do_ext2.cpp index 2dad761fc7..fe1a09063b 100644 --- a/src/m_Do/m_Do_ext2.cpp +++ b/src/m_Do/m_Do_ext2.cpp @@ -22,9 +22,9 @@ FixedMemoryCheck::FixedMemoryCheck(u32* param_1, u32 size, JKRHeap* heap) { FixedMemoryCheck* FixedMemoryCheck::easyCreate(void* param_1, u32 size) { JKRHeap* heap = JKRGetRootHeap2(); - FixedMemoryCheck* memCheck = new (heap, 0) FixedMemoryCheck((u32*)param_1, size, heap); + FixedMemoryCheck* memCheck = JKR_NEW_ARGS (heap, 0) FixedMemoryCheck((u32*)param_1, size, heap); if (!memCheck) { - memCheck = new (JKRGetSystemHeap(), 0) FixedMemoryCheck((u32*)param_1, size, NULL); + memCheck = JKR_NEW_ARGS (JKRGetSystemHeap(), 0) FixedMemoryCheck((u32*)param_1, size, NULL); } if (memCheck) { memCheck->alloc(); diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 1ce8ab8a07..f9e472353d 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -35,6 +35,7 @@ #include "DynamicLink.h" #include #include "dusk/endian.h" +#include "dusk/logging.h" #if PLATFORM_WII || PLATFORM_SHIELD #include @@ -301,7 +302,7 @@ void mDoGph_gInf_c::create() { JFWDisplay::getManager()->setDrawDoneMethod(JFWDisplay::UNK_METHOD_1); - JUTFader* faderPtr = new JUTFader(0, 0, JUTVideo::getManager()->getRenderMode()->fbWidth, + JUTFader* faderPtr = JKR_NEW JUTFader(0, 0, JUTVideo::getManager()->getRenderMode()->fbWidth, JUTVideo::getManager()->getRenderMode()->efbHeight, JUtility::TColor(0, 0, 0, 0)); JUT_ASSERT(352, faderPtr != NULL); @@ -675,6 +676,13 @@ void mDoGph_gInf_c::setWideZoomLightProjection(Mtx& m) { } #endif +#if TARGET_PC +void mDoGph_gInf_c::setWindowSize(AuroraWindowSize const& size) { + JUTVideo::getManager()->setWindowSize(size); + mFader->mBox.set(0, 0, getWidth(), getHeight()); +} +#endif + #if PLATFORM_WII || PLATFORM_SHIELD void mDoGph_gInf_c::entryBaseCsr(mDoGph_gInf_c::csr_c* i_entry) { JUT_ASSERT(876, m_baseCsr == NULL); @@ -1122,7 +1130,11 @@ void mDoGph_gInf_c::bloom_c::remove() { } void mDoGph_gInf_c::bloom_c::draw() { +#if TARGET_PC // TODO: fix bloom + bool enabled = false; +#else bool enabled = mEnable && m_buffer != NULL; +#endif if (mMonoColor.a != 0 || enabled) { GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f); GXSetScissor(0, 0, FB_WIDTH, FB_HEIGHT); @@ -1534,7 +1546,7 @@ int mDoGph_Painter() { static bool sDiagLoggedWindow = false; if (!sDiagLoggedWindow) { int wn = dComIfGp_getWindowNum(); - printf("[DIAG] mDoGph_Painter: windowNum=%d\n", wn); fflush(stdout); + DuskLog.debug("mDoGph_Painter: windowNum={}", wn); if (wn != 0) sDiagLoggedWindow = true; } @@ -1558,7 +1570,8 @@ int mDoGph_Painter() { j3dSys.drawInit(); GXSetDither(GX_ENABLE); - J2DOrthoGraph ortho(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, -1.0f, 1.0f); + J2DOrthoGraph ortho(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), -1.0f, + 1.0f); ortho.setOrtho(mDoGph_gInf_c::getMinXF(), mDoGph_gInf_c::getMinYF(), mDoGph_gInf_c::getWidthF(), mDoGph_gInf_c::getHeightF(), -1.0f, 1.0f); @@ -2111,8 +2124,7 @@ int mDoGph_Painter() { // (needed for logo scene, which has no 3D camera) static int sElseLogCount = 0; if (sElseLogCount < 10) { - printf("[DIAG] mDoGph_Painter else: drawing 2D lists (frame %d)\n", sElseLogCount); - fflush(stdout); + DuskLog.debug("mDoGph_Painter else: drawing 2D lists (frame {})", sElseLogCount); sElseLogCount++; } ortho.setPort(); diff --git a/src/m_Do/m_Do_machine.cpp b/src/m_Do/m_Do_machine.cpp index 13c55de871..fef1875e92 100644 --- a/src/m_Do/m_Do_machine.cpp +++ b/src/m_Do/m_Do_machine.cpp @@ -963,7 +963,7 @@ int mDoMch_Create() { JKRSetAramTransferBuffer(NULL, 0x2000, JKRGetSystemHeap()); JKRThreadSwitch::createManager(NULL); { // Fakematch to fix stack on debug, unsure where this block is supposed to go - JKRThread* thread = new JKRThread(OSGetCurrentThread(), 0); + JKRThread* thread = JKR_NEW JKRThread(OSGetCurrentThread(), 0); } JUTConsole* sysConsole = JFWSystem::getSystemConsole(); diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index 3c0b3beb2a..f0c1ba115d 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -46,11 +46,14 @@ #include "SSystem/SComponent/c_API.h" #include "dusk/dvd_emu.h" #include "dusk/dusk.h" +#include "dusk/logging.h" #include #include #include +#include "cxxopts.hpp" + // --- GLOBALS --- s8 mDoMain::developmentMode = -1; OSTime mDoMain::sPowerOnTime; @@ -63,37 +66,6 @@ const int audioHeapSize = 0x14D800 * 2; const int audioHeapSize = 0x14D800; #endif -// --- PC LOGGING CALLBACK --- -void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message, - unsigned int len) { - const char* levelStr = "??"; - FILE* out = stdout; - switch (level) { - case LOG_DEBUG: - levelStr = "DEBUG"; - break; - case LOG_INFO: - levelStr = "INFO"; - break; - case LOG_WARNING: - levelStr = "WARNING"; - break; - case LOG_ERROR: - levelStr = "ERROR"; - out = stderr; - break; - case LOG_FATAL: - levelStr = "FATAL"; - out = stderr; - break; - } - fprintf(out, "[%s | %s] %s\n", levelStr, module, message); - if (level == LOG_FATAL) { - fflush(out); - abort(); - } -} - // ========================================================================= // LOAD_COPYDATE - PC Version using DvdEmu // ========================================================================= @@ -181,6 +153,9 @@ void main01(void) { switch (event->type) { case AURORA_NONE: goto eventsDone; + case AURORA_WINDOW_RESIZED: + mDoGph_gInf_c::setWindowSize(event->windowSize); + break; case AURORA_EXIT: goto exit; } @@ -221,16 +196,39 @@ void main01(void) { // PC ENTRY POINT // ========================================================================= int game_main(int argc, char* argv[]) { - // 1. Aurora Init + cxxopts::ParseResult parsed_arg_options; + + try { + cxxopts::Options arg_options("Dusk", "PC Port of The Legend of Zelda: Twilight Princess"); + + arg_options.add_options() + ("l,log-level", "Log level from " + std::to_string(AuroraLogLevel::LOG_DEBUG) + " to " + std::to_string(AuroraLogLevel::LOG_FATAL), cxxopts::value()->default_value("0")) + ("h,help", "Print usage"); + + arg_options.allow_unrecognised_options(); + + parsed_arg_options = arg_options.parse(argc, argv); + + if (parsed_arg_options.count("help")) + { + printf((arg_options.help() + "\n").c_str()); + exit(0); + } + } + catch (const cxxopts::exceptions::exception& e) { + fprintf(stderr, "Argument Error: %s\n", e.what()); + exit(1); + } + AuroraConfig config{}; config.appName = "Dusk"; - config.desiredBackend = BACKEND_VULKAN; - config.windowPosX = 100; - config.windowPosY = 100; - config.windowWidth = 640; - config.windowHeight = 480; + config.windowPosX = -1; + config.windowPosY = -1; + config.windowWidth = 608 * 2; + config.windowHeight = 448 * 2; config.configPath = "."; config.logCallback = &aurora_log_callback; + config.logLevel = (AuroraLogLevel)parsed_arg_options["log-level"].as(); config.mem1Size = 256 * 1024 * 1024; config.mem2Size = 24 * 1024 * 1024; @@ -261,6 +259,9 @@ int game_main(int argc, char* argv[]) { main01(); + fflush(stdout); + fflush(stderr); + aurora_shutdown(); return 0;