From 446df060f24312b2eb1a0bf0127d93473d2b8559 Mon Sep 17 00:00:00 2001 From: robojumper Date: Wed, 26 Jun 2024 20:28:09 +0200 Subject: [PATCH] Fix some compiler warnings --- .../SOUE01/rels/d_t_sound_areaNP/symbols.txt | 6 +- include/d/tg/d_t_timer.h | 2 +- include/egg/core/eggController.h | 57 ++++++++++++++----- src/REL/d/t/d_t_timer.cpp | 24 ++++---- src/m/m_dvd.cpp | 11 ++-- src/nw4r/lyt/lyt_material.cpp | 3 +- src/nw4r/ut/ut_ResFont.cpp | 6 +- 7 files changed, 71 insertions(+), 38 deletions(-) diff --git a/config/SOUE01/rels/d_t_sound_areaNP/symbols.txt b/config/SOUE01/rels/d_t_sound_areaNP/symbols.txt index cdc4ffe7..7625aa33 100644 --- a/config/SOUE01/rels/d_t_sound_areaNP/symbols.txt +++ b/config/SOUE01/rels/d_t_sound_areaNP/symbols.txt @@ -14,8 +14,8 @@ checkAlg3__10dTgSndAr_cFRC7mVec3_c = .text:0x00000540; // type:function size:0x1 __dt__10dTgSndAr_cFv = .text:0x00000690; // type:function size:0x70 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global -lbl_497_rodata_0 = .rodata:0x00000000; // type:object size:0x18 data:float -lbl_497_rodata_18 = .rodata:0x00000018; // type:object size:0x10 data:float -lbl_497_rodata_28 = .rodata:0x00000028; // type:object size:0x4 data:float +lbl_497_rodata_0 = .rodata:0x00000000; // type:object size:0x18 scope:local data:float +lbl_497_rodata_18 = .rodata:0x00000018; // type:object size:0x10 scope:local data:float +lbl_497_rodata_28 = .rodata:0x00000028; // type:object size:0x4 scope:local data:float g_profile_TAG_SOUND_AREA = .data:0x00000000; // type:object size:0x10 __vt__10dTgSndAr_c = .data:0x00000010; // type:object size:0x74 diff --git a/include/d/tg/d_t_timer.h b/include/d/tg/d_t_timer.h index 463bf0b3..8bf7b15c 100644 --- a/include/d/tg/d_t_timer.h +++ b/include/d/tg/d_t_timer.h @@ -23,7 +23,7 @@ public: u16 getCheckSceneflag(); u16 getSetSceneflag(); u16 getTimer(); - u16 setTimer(u16 val); + void setTimer(u16 val); u16 getTargetTime(); bool checkShouldTrigger(); u16 getStoredTargetTime(); diff --git a/include/egg/core/eggController.h b/include/egg/core/eggController.h index ba983622..384df8a6 100644 --- a/include/egg/core/eggController.h +++ b/include/egg/core/eggController.h @@ -19,7 +19,7 @@ class CoreController; enum eCoreDevType {}; typedef void (*ConnectCallback)(int args[]); -typedef class CoreController* (*ControllerFactory)(); +typedef class CoreController *(*ControllerFactory)(); class CoreStatus { public: @@ -52,16 +52,42 @@ public: // vtable 0x000 | 8056ec50 // TODO all of these have inline implementations and are scattered // across the binary - /* vt 0x08 | 80064920 */ virtual void setPosParam(f32, f32) {} - /* vt 0x0C | 8049a940 */ virtual void setHoriParam(f32, f32) {} - /* vt 0x10 | 8049a930 */ virtual void setDistParam(f32, f32) {} - /* vt 0x14 | 8049a920 */ virtual void setAccParam(f32, f32) {} - /* vt 0x18 | 80059820 */ virtual bool isPressed(u32 mask) {} - /* vt 0x1C | 80059a60 */ virtual bool isAnyPressed(u32 mask) {} - /* vt 0x20 | 80014e30 */ virtual bool isTriggered(u32 mask) {} - /* vt 0x24 | 800599e0 */ virtual bool isReleased() {} - /* vt 0x28 | 80059840 */ virtual bool isAllPressed() {} - /* vt 0x2C | 80059a80 */ virtual bool isNotPressed() {} + /* vt 0x08 | 80064920 */ virtual void setPosParam(f32, f32) { + // TODO + } + /* vt 0x0C | 8049a940 */ virtual void setHoriParam(f32, f32) { + // TODO + } + /* vt 0x10 | 8049a930 */ virtual void setDistParam(f32, f32) { + // TODO + } + /* vt 0x14 | 8049a920 */ virtual void setAccParam(f32, f32) { + // TODO + } + /* vt 0x18 | 80059820 */ virtual bool isPressed(u32 mask) { + // TODO + return false; + } + /* vt 0x1C | 80059a60 */ virtual bool isAnyPressed(u32 mask) { + // TODO + return false; + } + /* vt 0x20 | 80014e30 */ virtual bool isTriggered(u32 mask) { + // TODO + return false; + } + /* vt 0x24 | 800599e0 */ virtual bool isReleased() { + // TODO + return false; + } + /* vt 0x28 | 80059840 */ virtual bool isAllPressed() { + // TODO + return false; + } + /* vt 0x2C | 80059a80 */ virtual bool isNotPressed() { + // TODO + return false; + } // We know the above are inline because if a class has any non-inline virtual functions, // then the TU that contains an implementation of said function gets the vtable, // and we know that eggController.cpp contains the vtable and the functions below @@ -163,14 +189,16 @@ public: class ControllerRumbleUnit { public: // 0x00 vtable | 8056ebb4 - inline ControllerRumbleUnit(): mFlag(0) { init(); } + inline ControllerRumbleUnit() : mFlag(0) { + init(); + } /* vt 0x08 | 8049a8e0 */ virtual ~ControllerRumbleUnit() {} public: /* 0x04 */ const char *mPattern; /* 0x08 */ const char *mPatternPos; - /* 0x0C */ s32 mTimer; // guess - /* 0x10 */ f32 mRampUp; // guess + /* 0x0C */ s32 mTimer; // guess + /* 0x10 */ f32 mRampUp; // guess /* 0x14 */ f32 mIntensity; // guess /* 0x18 */ TBitFlag mFlag; /* 0x1C */ nw4r::ut::Node mNode; @@ -200,7 +228,6 @@ public: /* 8049a7f0 */ ControllerRumbleUnit *getUnitFromList(bool bGrabActive); }; - } // namespace EGG #endif diff --git a/src/REL/d/t/d_t_timer.cpp b/src/REL/d/t/d_t_timer.cpp index 2a01f374..4eef47a2 100644 --- a/src/REL/d/t/d_t_timer.cpp +++ b/src/REL/d/t/d_t_timer.cpp @@ -14,17 +14,17 @@ bool increment(u16 *t) { int dTgTimer_c::create() { switch (getSubtypeFromParams()) { - case 0: - mGetTargetTimeFunc = dTgTimer_c::getConstant0x50_Thunk; - break; - case 1: - mTargetTime = getTimerFromParams() * 0x1e; - mGetTargetTimeFunc = getStoredTargetTime; - break; - default: - mTargetTime = getTimerFromParams(); - mGetTargetTimeFunc = getStoredTargetTime; - break; + case 0: + mGetTargetTimeFunc = &dTgTimer_c::getConstant0x50_Thunk; + break; + case 1: + mTargetTime = getTimerFromParams() * 0x1e; + mGetTargetTimeFunc = &dTgTimer_c::getStoredTargetTime; + break; + default: + mTargetTime = getTimerFromParams(); + mGetTargetTimeFunc = &dTgTimer_c::getStoredTargetTime; + break; } resetTimer(); return 1; @@ -68,7 +68,7 @@ u16 dTgTimer_c::getConstant0x50() { return 0x50; } -u16 dTgTimer_c::setTimer(u16 val) { +void dTgTimer_c::setTimer(u16 val) { mTimer = val; } diff --git a/src/m/m_dvd.cpp b/src/m/m_dvd.cpp index 21fed247..8472c878 100644 --- a/src/m/m_dvd.cpp +++ b/src/m/m_dvd.cpp @@ -127,8 +127,8 @@ void create(int priority, EGG::Heap *commandHeap, EGG::Heap *archiveHeap, EGG::H } /** 802eef30 */ -static void *loadToMainRAM(int entryNum, char *dst, EGG::Heap *heap, EGG::DvdRipper::EAllocDirection allocDir, s32 offset, - u32 *outAmountRead, u32 *outFileSize, u32 decompressorType) { +static void *loadToMainRAM(int entryNum, char *dst, EGG::Heap *heap, EGG::DvdRipper::EAllocDirection allocDir, + s32 offset, u32 *outAmountRead, u32 *outFileSize, u32 decompressorType) { void *result; u32 amountRead = 0; u32 fileSize = 0; @@ -492,7 +492,9 @@ u32 mDvd_mountMemArchive_c::execute() { mDataPtr = archive; } else { if (data != nullptr) { - delete data; + // TODO so far data seems to have been passed around as void * + // but this silences a compiler warning. Unsure about the actual type. + delete (char *)data; } mAmountRead = 0; } @@ -568,7 +570,8 @@ mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::create(EGG::Archive *arc, const char } /** 802efe90 */ -mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::createOrFail(EGG::Archive *arc, const char *path, int mountDirection, EGG::Heap *heap) { +mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::createOrFail(EGG::Archive *arc, const char *path, int mountDirection, + EGG::Heap *heap) { mDvd_toMainRam_arc_c *cmd = mDvd_toMainRam_arc_c::create(arc, path, mountDirection, heap); while (!cmd) {} return cmd; diff --git a/src/nw4r/lyt/lyt_material.cpp b/src/nw4r/lyt/lyt_material.cpp index cf8fe4df..55b9be64 100644 --- a/src/nw4r/lyt/lyt_material.cpp +++ b/src/nw4r/lyt/lyt_material.cpp @@ -591,13 +591,14 @@ void Material::SetColorElement(u32 colorType, s16 value) { // 28:[TevKCol->r] 29:[TevKCol->g] 30:[TevKCol->b] 31:[TevKCol->a] // clang-format off switch (colorType) { - case 0: case 1: case 2: case 3: + case 0: case 1: case 2: case 3: { if (mGXMemNum.matCol < 1 ) { break; } ut::Color *matCols = GetMatColAry(); SetColorComponentValue(matCols, colorType , value); break; + } case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: { u32 regIdx = (colorType - 4) / 4; diff --git a/src/nw4r/ut/ut_ResFont.cpp b/src/nw4r/ut/ut_ResFont.cpp index 2a9784fc..2fd198e2 100644 --- a/src/nw4r/ut/ut_ResFont.cpp +++ b/src/nw4r/ut/ut_ResFont.cpp @@ -94,18 +94,20 @@ FontInformation *ResFont::Rebuild(BinaryFileHeader *header) { case MAGIC_TEXGLYPH: ResolveOffset(reinterpret_cast(block + 1)->sheetImage, header); break; - case MAGIC_CHARWIDTH: + case MAGIC_CHARWIDTH: { FontWidth *width = reinterpret_cast(block + 1); if (width->next != 0) { ResolveOffset(width->next, header); } break; - case MAGIC_CHARMAP: + } + case MAGIC_CHARMAP: { FontCodeMap *map = reinterpret_cast(block + 1); if (map->next != 0) { ResolveOffset(map->next, header); } break; + } case MAGIC_GLGR: break; default: