mirror of
https://github.com/pmret/papermario.git
synced 2024-11-09 12:32:38 +01:00
resolve clang-tidy errors
This commit is contained in:
parent
42747be7ae
commit
728c879b9f
@ -1,2 +1,2 @@
|
|||||||
Checks: '-*,clang-analyzer-core.*,clang-analyzer-deadcode.*,readability-*,-readability-magic-numbers,-readability-else-after-return,-readability-named-parameter,-readability-braces-around-statements,-clang-diagnostic-error'
|
Checks: '-*,clang-analyzer-core.*,clang-analyzer-deadcode.*,readability-*,-readability-magic-numbers,-readability-else-after-return,-readability-named-parameter,-readability-braces-around-statements,-readability-isolate-declaration,-clang-diagnostic-error'
|
||||||
HeaderFilterRegex: '(src|include)\/.*\.h'
|
HeaderFilterRegex: '(src|include)\/.*\.h'
|
||||||
|
4
Makefile
4
Makefile
@ -54,10 +54,10 @@ OBJCOPY = $(CROSS)objcopy
|
|||||||
|
|
||||||
TARGET = papermario
|
TARGET = papermario
|
||||||
|
|
||||||
CPPFLAGS = -Iinclude -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2
|
CPPFLAGS = -fno-builtin -Iinclude -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2
|
||||||
ASFLAGS = -EB -march=vr4300 -mtune=vr4300 -Iinclude
|
ASFLAGS = -EB -march=vr4300 -mtune=vr4300 -Iinclude
|
||||||
OLDASFLAGS= -EB -Iinclude
|
OLDASFLAGS= -EB -Iinclude
|
||||||
CFLAGS = -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32
|
CFLAGS = -fno-builtin -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32
|
||||||
LDFLAGS = -T undefined_syms.txt -T $(LD_SCRIPT) -Map $(BUILD_DIR)/papermario.map --no-check-sections
|
LDFLAGS = -T undefined_syms.txt -T $(LD_SCRIPT) -Map $(BUILD_DIR)/papermario.map --no-check-sections
|
||||||
|
|
||||||
######################## Targets #############################
|
######################## Targets #############################
|
||||||
|
@ -222,6 +222,11 @@ typedef struct StaticNpcSettings {
|
|||||||
/* 0x2A */ s16 unkFlags;
|
/* 0x2A */ s16 unkFlags;
|
||||||
} StaticNpcSettings; // size = 0x2C
|
} StaticNpcSettings; // size = 0x2C
|
||||||
|
|
||||||
|
typedef union ScriptBufferValue {
|
||||||
|
f32 f;
|
||||||
|
s32 s;
|
||||||
|
} ScriptBufferValue;
|
||||||
|
|
||||||
typedef struct ScriptInstance {
|
typedef struct ScriptInstance {
|
||||||
/* 0x000 */ u8 state;
|
/* 0x000 */ u8 state;
|
||||||
/* 0x001 */ u8 currentArgc;
|
/* 0x001 */ u8 currentArgc;
|
||||||
@ -247,9 +252,9 @@ typedef struct ScriptInstance {
|
|||||||
/* 0x0F0 */ s32 loopCounterTable[8];
|
/* 0x0F0 */ s32 loopCounterTable[8];
|
||||||
/* 0x110 */ u8 switchBlockState[8];
|
/* 0x110 */ u8 switchBlockState[8];
|
||||||
/* 0x118 */ s32 switchBlockValue[8];
|
/* 0x118 */ s32 switchBlockValue[8];
|
||||||
/* 0x138 */ s32* buffer;
|
/* 0x138 */ ScriptBufferValue* buffer;
|
||||||
/* 0x13C */ UNK_PTR array;
|
/* 0x13C */ s32* array;
|
||||||
/* 0x140 */ UNK_PTR flagArray;
|
/* 0x140 */ s32* flagArray;
|
||||||
/* 0x144 */ s32 uniqueID;
|
/* 0x144 */ s32 uniqueID;
|
||||||
/* 0x148 */ struct Enemy* ownerActorID; /* controller*, battle ID, trigger* */
|
/* 0x148 */ struct Enemy* ownerActorID; /* controller*, battle ID, trigger* */
|
||||||
/* 0x14C */ u32 ownerID; /* can be an npcID, a triggerID, a trigger ptr */
|
/* 0x14C */ u32 ownerID; /* can be an npcID, a triggerID, a trigger ptr */
|
||||||
@ -1268,8 +1273,8 @@ typedef struct TileDescriptor {
|
|||||||
} TileDescriptor; // size = 0x30
|
} TileDescriptor; // size = 0x30
|
||||||
|
|
||||||
typedef struct BackgroundHeader {
|
typedef struct BackgroundHeader {
|
||||||
/* 0x00 */ u32 raster;
|
/* 0x00 */ UNK_PTR raster;
|
||||||
/* 0x04 */ u32 palette;
|
/* 0x04 */ UNK_PTR palette;
|
||||||
/* 0x08 */ u16 startX;
|
/* 0x08 */ u16 startX;
|
||||||
/* 0x0A */ u16 startY;
|
/* 0x0A */ u16 startY;
|
||||||
/* 0x0C */ u16 width;
|
/* 0x0C */ u16 width;
|
||||||
|
@ -56,10 +56,10 @@ extern PrintContext* gCurrentPrintContext;
|
|||||||
extern PrintContext* D_802DB268;
|
extern PrintContext* D_802DB268;
|
||||||
|
|
||||||
// Triggers
|
// Triggers
|
||||||
/* 0x80151334 */ extern s16 gTriggerCount;
|
extern s16 gTriggerCount;
|
||||||
/* 0x80159190 */ extern Trigger gTriggerList1[64];
|
extern Trigger* gTriggerList1[64];
|
||||||
/* 0x80159290 */ extern Trigger gTriggerList2[64];
|
extern Trigger* gTriggerList2[64];
|
||||||
/* 0x80159390 */ extern Trigger** gCurrentTriggerListPtr[64];
|
extern Trigger** gCurrentTriggerListPtr[64];
|
||||||
|
|
||||||
extern u16 gMapTransitionAlpha;
|
extern u16 gMapTransitionAlpha;
|
||||||
extern u16 D_800A0942;
|
extern u16 D_800A0942;
|
||||||
@ -76,8 +76,5 @@ extern UNK_TYPE D_80147474;
|
|||||||
extern UNK_TYPE D_80147574;
|
extern UNK_TYPE D_80147574;
|
||||||
extern UNK_TYPE D_80109270;
|
extern UNK_TYPE D_80109270;
|
||||||
extern UNK_TYPE D_80108558;
|
extern UNK_TYPE D_80108558;
|
||||||
extern u16 D_800A0940;
|
|
||||||
extern u16 D_800A0942;
|
|
||||||
extern s16 D_800A0944;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,6 +40,6 @@ INCLUDE_ASM("code_341d0_len_20d0", get_current_map_header);
|
|||||||
|
|
||||||
INCLUDE_ASM("code_341d0_len_20d0", get_map_IDs_by_name);
|
INCLUDE_ASM("code_341d0_len_20d0", get_map_IDs_by_name);
|
||||||
|
|
||||||
INCLUDE_ASM("code_341d0_len_20d0", load_asset_by_name);
|
void* INCLUDE_ASM("code_341d0_len_20d0", load_asset_by_name, char* name, s32* decompressedSize);
|
||||||
|
|
||||||
INCLUDE_ASM("code_341d0_len_20d0", get_asset_offset);
|
INCLUDE_ASM("code_341d0_len_20d0", get_asset_offset);
|
||||||
|
@ -373,7 +373,6 @@ void show_coin_counter(void) {
|
|||||||
uiStatus->ignoreChanges = 1;
|
uiStatus->ignoreChanges = 1;
|
||||||
D_8010CD10 = 1;
|
D_8010CD10 = 1;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hide_coin_counter(void) {
|
void hide_coin_counter(void) {
|
||||||
|
@ -7,7 +7,6 @@ void default_trigger_function_handler(s32* arg0) {
|
|||||||
|
|
||||||
INCLUDE_ASM("code_dbd70_len_700", clear_trigger_data);
|
INCLUDE_ASM("code_dbd70_len_700", clear_trigger_data);
|
||||||
|
|
||||||
//INCLUDE_ASM("code_dbd70_len_700", init_trigger_list);
|
|
||||||
void init_trigger_list(void) {
|
void init_trigger_list(void) {
|
||||||
if ((*gGameStatusPtr)->isBattle == 0) {
|
if ((*gGameStatusPtr)->isBattle == 0) {
|
||||||
*gCurrentTriggerListPtr = gTriggerList1;
|
*gCurrentTriggerListPtr = gTriggerList1;
|
||||||
@ -40,7 +39,6 @@ void delete_trigger(Trigger* toDelete) {
|
|||||||
|
|
||||||
INCLUDE_ASM("code_dbd70_len_700", is_trigger_bound);
|
INCLUDE_ASM("code_dbd70_len_700", is_trigger_bound);
|
||||||
|
|
||||||
//INCLUDE_ASM("code_dbd70_len_700", get_trigger_by_id);
|
|
||||||
Trigger* get_trigger_by_id(s32 triggerID) {
|
Trigger* get_trigger_by_id(s32 triggerID) {
|
||||||
return (*gCurrentTriggerListPtr)[triggerID];
|
return (*gCurrentTriggerListPtr)[triggerID];
|
||||||
}
|
}
|
||||||
|
@ -243,8 +243,7 @@ s32 resume_all_group(s32 groupFlags) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void suspend_group_others(ScriptInstance* script, s32 groupFlags) {
|
||||||
void suspend_group_others(s32 script, s32 groupFlags) {
|
|
||||||
s32 i;
|
s32 i;
|
||||||
ScriptInstance* scriptContextPtr;
|
ScriptInstance* scriptContextPtr;
|
||||||
|
|
||||||
@ -256,7 +255,7 @@ void suspend_group_others(s32 script, s32 groupFlags) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void resume_group_others(s32 script, s32 groupFlags) {
|
void resume_group_others(ScriptInstance* script, s32 groupFlags) {
|
||||||
s32 i;
|
s32 i;
|
||||||
ScriptInstance* scriptContextPtr;
|
ScriptInstance* scriptContextPtr;
|
||||||
|
|
||||||
|
@ -68,7 +68,6 @@ ApiStatus si_handle_if_AND(ScriptInstance* script) {
|
|||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//INCLUDE_ASM("code_e92d0_len_5da0", si_handle_if_not_AND);
|
|
||||||
ApiStatus si_handle_if_not_AND(ScriptInstance* script) {
|
ApiStatus si_handle_if_not_AND(ScriptInstance* script) {
|
||||||
s32 var1;
|
s32 var1;
|
||||||
s32* ptrReadPos = script->ptrReadPos;
|
s32* ptrReadPos = script->ptrReadPos;
|
||||||
@ -197,20 +196,19 @@ INCLUDE_ASM("code_e92d0_len_5da0", si_handle_multiplyF);
|
|||||||
INCLUDE_ASM("code_e92d0_len_5da0", si_handle_divideF);
|
INCLUDE_ASM("code_e92d0_len_5da0", si_handle_divideF);
|
||||||
|
|
||||||
ApiStatus si_handle_set_int_buffer_ptr(ScriptInstance* script) {
|
ApiStatus si_handle_set_int_buffer_ptr(ScriptInstance* script) {
|
||||||
script->buffer = get_variable(script, *script->ptrReadPos);
|
script->buffer = (ScriptBufferValue*)get_variable(script, *script->ptrReadPos);
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiStatus si_handle_set_float_buffer_ptr(ScriptInstance* script) {
|
ApiStatus si_handle_set_float_buffer_ptr(ScriptInstance* script) {
|
||||||
script->buffer = get_variable(script, *script->ptrReadPos);
|
script->buffer = (ScriptBufferValue*)get_variable(script, *script->ptrReadPos);
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiStatus si_handle_get_1_word(ScriptInstance* script) {
|
ApiStatus si_handle_get_1_word(ScriptInstance* script) {
|
||||||
s32 ptrReadPos = *script->ptrReadPos;
|
s32 out = *script->ptrReadPos;
|
||||||
s32 buffer = *script->buffer++;
|
|
||||||
|
|
||||||
set_variable(script, ptrReadPos, buffer);
|
set_variable(script, out, (*script->buffer++).s);
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,9 +220,10 @@ INCLUDE_ASM("code_e92d0_len_5da0", si_handle_get_4_word);
|
|||||||
|
|
||||||
ApiStatus si_handle_get_Nth_word(ScriptInstance* script) {
|
ApiStatus si_handle_get_Nth_word(ScriptInstance* script) {
|
||||||
Bytecode* ptrReadPos = script->ptrReadPos;
|
Bytecode* ptrReadPos = script->ptrReadPos;
|
||||||
s32 curPtrReadPos = ptrReadPos[0];
|
s32 out = ptrReadPos[0];
|
||||||
|
s32 n = get_variable(script, ptrReadPos[1]);
|
||||||
|
|
||||||
set_variable(script, curPtrReadPos, script->buffer[get_variable(script, ptrReadPos[1])]);
|
set_variable(script, out, script->buffer[n].s);
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,12 +238,12 @@ INCLUDE_ASM("code_e92d0_len_5da0", si_handle_get_4_float);
|
|||||||
INCLUDE_ASM("code_e92d0_len_5da0", si_handle_get_Nth_float);
|
INCLUDE_ASM("code_e92d0_len_5da0", si_handle_get_Nth_float);
|
||||||
|
|
||||||
ApiStatus si_handle_set_array(ScriptInstance* script) {
|
ApiStatus si_handle_set_array(ScriptInstance* script) {
|
||||||
script->array = get_variable(script, *script->ptrReadPos);
|
script->array = (s32*)get_variable(script, *script->ptrReadPos);
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiStatus si_handle_set_flag_array(ScriptInstance* script) {
|
ApiStatus si_handle_set_flag_array(ScriptInstance* script) {
|
||||||
script->flagArray = get_variable(script, *script->ptrReadPos);
|
script->flagArray = (s32*)get_variable(script, *script->ptrReadPos);
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +292,7 @@ ApiStatus si_handle_exec_wait(ScriptInstance* script) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ApiStatus si_handle_jump(ScriptInstance* script) {
|
ApiStatus si_handle_jump(ScriptInstance* script) {
|
||||||
script->ptrFirstLine = get_variable(script, *script->ptrReadPos);
|
script->ptrFirstLine = (Bytecode*)get_variable(script, *script->ptrReadPos);
|
||||||
restart_script(script);
|
restart_script(script);
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
@ -387,7 +386,7 @@ ApiStatus func_802C6E14(ScriptInstance* script) {
|
|||||||
ApiStatus INCLUDE_ASM("code_e92d0_len_5da0", si_handle_print_debug_var);
|
ApiStatus INCLUDE_ASM("code_e92d0_len_5da0", si_handle_print_debug_var);
|
||||||
|
|
||||||
ApiStatus func_802C739C(ScriptInstance* script) {
|
ApiStatus func_802C739C(ScriptInstance* script) {
|
||||||
script->ptrSavedPosition = *script->ptrReadPos;
|
script->ptrSavedPosition = (Bytecode*)*script->ptrReadPos;
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ ApiStatus GetNpcPointer(ScriptInstance* script, s32 isInitialCall) {
|
|||||||
NpcId npcID = get_variable(script, *ptrReadPos++);
|
NpcId npcID = get_variable(script, *ptrReadPos++);
|
||||||
Bytecode varNPC = *ptrReadPos++;
|
Bytecode varNPC = *ptrReadPos++;
|
||||||
|
|
||||||
set_variable(script, varNPC, get_npc_safe(npcID));
|
set_variable(script, varNPC, (s32)get_npc_safe(npcID));
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,9 +181,9 @@ ApiStatus FindKeyItem(ScriptInstance* script, s32 isInitialCall) {
|
|||||||
ApiStatus AddItem(ScriptInstance* script, s32 isInitialCall) {
|
ApiStatus AddItem(ScriptInstance* script, s32 isInitialCall) {
|
||||||
Bytecode* ptrReadPos = script->ptrReadPos;
|
Bytecode* ptrReadPos = script->ptrReadPos;
|
||||||
s32 itemID = get_variable(script, *ptrReadPos++);
|
s32 itemID = get_variable(script, *ptrReadPos++);
|
||||||
s32* ptrNextPos = (s32*) *ptrReadPos++;
|
Bytecode outItemIdx = *ptrReadPos++;
|
||||||
|
|
||||||
set_variable(script, ptrNextPos, add_item(itemID));
|
set_variable(script, outItemIdx, add_item(itemID));
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,10 +291,10 @@ ApiStatus RemoveItemEntity(ScriptInstance* script, s32 isInitialCall) {
|
|||||||
|
|
||||||
ApiStatus AddBadge(ScriptInstance* script, s32 isInitialCall) {
|
ApiStatus AddBadge(ScriptInstance* script, s32 isInitialCall) {
|
||||||
Bytecode* ptrReadPos = script->ptrReadPos;
|
Bytecode* ptrReadPos = script->ptrReadPos;
|
||||||
s32 itemID = get_variable(script, *ptrReadPos++);
|
s32 badgeID = get_variable(script, *ptrReadPos++);
|
||||||
s32* ptrNextPos = (s32*) *ptrReadPos++;
|
Bytecode outBadgeIdx = *ptrReadPos++;
|
||||||
|
|
||||||
set_variable(script, ptrNextPos, add_badge(itemID));
|
set_variable(script, outBadgeIdx, add_badge(badgeID));
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
INCLUDE_API_ASM("os/code_3d2f0_len_10", sqrtf);
|
f32 INCLUDE_ASM("os/code_3d2f0_len_10", sqrtf, f32 value);
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
INCLUDE_ASM("os/code_4a1f0_len_170", decode_yay0);
|
void INCLUDE_ASM("os/code_4a1f0_len_170", decode_yay0, void* src, void* dest);
|
||||||
|
Loading…
Reference in New Issue
Block a user