Skip to content

Commit

Permalink
Merge pull request #15 from robojumper/fix-compiler-warnings
Browse files Browse the repository at this point in the history
Fix some compiler warnings
  • Loading branch information
robojumper authored Jun 27, 2024
2 parents 9d07cbc + 446df06 commit 332f006
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 38 deletions.
6 changes: 3 additions & 3 deletions config/SOUE01/rels/d_t_sound_areaNP/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion include/d/tg/d_t_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class dTgTimer_c : public dTgTimerBase_c {
u16 getCheckSceneflag();
u16 getSetSceneflag();
u16 getTimer();
u16 setTimer(u16 val);
void setTimer(u16 val);
u16 getTargetTime();
bool checkShouldTrigger();
u16 getStoredTargetTime();
Expand Down
57 changes: 42 additions & 15 deletions include/egg/core/eggController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CoreController;
enum eCoreDevType {};

typedef void (*ConnectCallback)(int args[]);
typedef class CoreController* (*ControllerFactory)();
typedef class CoreController *(*ControllerFactory)();

class CoreStatus {
public:
Expand Down Expand Up @@ -52,16 +52,42 @@ class CoreController {
// 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
Expand Down Expand Up @@ -163,14 +189,16 @@ class NullController : public CoreController {
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<u8> mFlag;
/* 0x1C */ nw4r::ut::Node mNode;
Expand Down Expand Up @@ -200,7 +228,6 @@ class ControllerRumbleMgr {
/* 8049a7f0 */ ControllerRumbleUnit *getUnitFromList(bool bGrabActive);
};


} // namespace EGG

#endif
24 changes: 12 additions & 12 deletions src/REL/d/t/d_t_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -68,7 +68,7 @@ u16 dTgTimer_c::getConstant0x50() {
return 0x50;
}

u16 dTgTimer_c::setTimer(u16 val) {
void dTgTimer_c::setTimer(u16 val) {
mTimer = val;
}

Expand Down
11 changes: 7 additions & 4 deletions src/m/m_dvd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/nw4r/lyt/lyt_material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions src/nw4r/ut/ut_ResFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,20 @@ FontInformation *ResFont::Rebuild(BinaryFileHeader *header) {
case MAGIC_TEXGLYPH:
ResolveOffset<u8>(reinterpret_cast<FontTextureGlyph *>(block + 1)->sheetImage, header);
break;
case MAGIC_CHARWIDTH:
case MAGIC_CHARWIDTH: {
FontWidth *width = reinterpret_cast<FontWidth *>(block + 1);
if (width->next != 0) {
ResolveOffset<FontWidth>(width->next, header);
}
break;
case MAGIC_CHARMAP:
}
case MAGIC_CHARMAP: {
FontCodeMap *map = reinterpret_cast<FontCodeMap *>(block + 1);
if (map->next != 0) {
ResolveOffset<FontCodeMap>(map->next, header);
}
break;
}
case MAGIC_GLGR:
break;
default:
Expand Down

0 comments on commit 332f006

Please sign in to comment.