Fix warnings and some bugs
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled

thanks maniscat
This commit is contained in:
PeachyPeachSM64 2025-07-02 18:49:44 +02:00
parent 81af37eef6
commit 9c28364d81
17 changed files with 28 additions and 33 deletions

View file

@ -5073,7 +5073,7 @@ end
--- @param id integer --- @param id integer
--- @return boolean --- @return boolean
--- Checks if a lighting engine point light exists --- Checks if a lighting engine point light corresponding to `id` exists
function le_light_exists(id) function le_light_exists(id)
-- ... -- ...
end end
@ -11549,14 +11549,12 @@ function get_secondary_camera_focus()
end end
--- @param o Object --- @param o Object
--- @return void*
--- Sets the cutscene focus object --- Sets the cutscene focus object
function set_cutscene_focus(o) function set_cutscene_focus(o)
-- ... -- ...
end end
--- @param o Object --- @param o Object
--- @return void*
--- Sets the secondary camera focus object --- Sets the secondary camera focus object
function set_secondary_camera_focus(o) function set_secondary_camera_focus(o)
-- ... -- ...

View file

@ -1245,7 +1245,8 @@ static std::string ResolveGfxCommand(lua_State *L, GfxData *aGfxData, const char
// Count parameters // Count parameters
// Find the position of each % to retrieve the correct expected type from the command paramInfo // Find the position of each % to retrieve the correct expected type from the command paramInfo
u8 paramPos[paramInfo->count] = { 0 }; u8 paramPos[paramInfo->count];
memset(paramPos, 0, sizeof(u8) * paramInfo->count);
u8 paramPosIndex = 0; u8 paramPosIndex = 0;
u8 paramCount = 1; u8 paramCount = 1;
bool inBrackets = false; bool inBrackets = false;

View file

@ -91,7 +91,7 @@ static struct GraphNode* DynOS_Model_LoadCommonInternal(u32* aId, enum ModelPool
// check maps, permanent pool is always checked // check maps, permanent pool is always checked
struct GraphNode *node = NULL; struct GraphNode *node = NULL;
#define CHECK_POOL(pool) if (node = DynOS_Model_CheckMap(pool, aId, aAsset, aDeDuplicate)) { return node; } #define CHECK_POOL(pool) if ((node = DynOS_Model_CheckMap(pool, aId, aAsset, aDeDuplicate)) != NULL) { return node; }
CHECK_POOL(MODEL_POOL_PERMANENT); CHECK_POOL(MODEL_POOL_PERMANENT);
if (aModelPool == MODEL_POOL_SESSION) { if (aModelPool == MODEL_POOL_SESSION) {
CHECK_POOL(MODEL_POOL_SESSION); CHECK_POOL(MODEL_POOL_SESSION);

View file

@ -6873,7 +6873,7 @@ Gets the total number of lights currently loaded in the lighting engine
## [le_light_exists](#le_light_exists) ## [le_light_exists](#le_light_exists)
### Description ### Description
Checks if a lighting engine point light exists Checks if a lighting engine point light corresponding to `id` exists
### Lua Example ### Lua Example
`local booleanValue = le_light_exists(id)` `local booleanValue = le_light_exists(id)`

View file

@ -6201,7 +6201,7 @@ Gets the secondary camera focus object
Sets the cutscene focus object Sets the cutscene focus object
### Lua Example ### Lua Example
`local voidValue = set_cutscene_focus(o)` `set_cutscene_focus(o)`
### Parameters ### Parameters
| Field | Type | | Field | Type |
@ -6209,10 +6209,10 @@ Sets the cutscene focus object
| o | [Object](structs.md#Object) | | o | [Object](structs.md#Object) |
### Returns ### Returns
- `void *` - None
### C Prototype ### C Prototype
`void *set_cutscene_focus(struct Object *o);` `void set_cutscene_focus(struct Object *o);`
[:arrow_up_small:](#) [:arrow_up_small:](#)
@ -6224,7 +6224,7 @@ Sets the cutscene focus object
Sets the secondary camera focus object Sets the secondary camera focus object
### Lua Example ### Lua Example
`local voidValue = set_secondary_camera_focus(o)` `set_secondary_camera_focus(o)`
### Parameters ### Parameters
| Field | Type | | Field | Type |
@ -6232,10 +6232,10 @@ Sets the secondary camera focus object
| o | [Object](structs.md#Object) | | o | [Object](structs.md#Object) |
### Returns ### Returns
- `void *` - None
### C Prototype ### C Prototype
`void *set_secondary_camera_focus(struct Object *o);` `void set_secondary_camera_focus(struct Object *o);`
[:arrow_up_small:](#) [:arrow_up_small:](#)

View file

@ -38,7 +38,7 @@ void rolling_log_roll_log(void) {
f32 sp24; f32 sp24;
f32 x = 0; f32 x = 0;
f32 y = 0; UNUSED f32 y = 0;
f32 z = 0; f32 z = 0;
u8 playersTouched = 0; u8 playersTouched = 0;

View file

@ -10011,7 +10011,7 @@ s32 intro_peach_move_camera_start_to_pipe(struct Camera *c, struct CutsceneSplin
struct CutsceneSplinePoint focusSpline[]) { struct CutsceneSplinePoint focusSpline[]) {
if (!c) { return 0; } if (!c) { return 0; }
Vec3f offset; Vec3f offset;
s32 posReturn = 0; UNUSED s32 posReturn = 0;
s32 focusReturn = 0; s32 focusReturn = 0;
/** /**

View file

@ -422,7 +422,7 @@ void djui_interactable_update(void) {
// update focused // update focused
if (gInteractableFocus) { if (gInteractableFocus) {
u16 mainButtons = PAD_BUTTON_A | PAD_BUTTON_B; u16 mainButtons = PAD_BUTTON_A | PAD_BUTTON_B;
if ((mouseButtons & MOUSE_BUTTON_1) && !(sLastMouseButtons && MOUSE_BUTTON_1) && !djui_cursor_inside_base(gInteractableFocus)) { if ((mouseButtons & MOUSE_BUTTON_1) && !(sLastMouseButtons & MOUSE_BUTTON_1) && !djui_cursor_inside_base(gInteractableFocus)) {
// clicked outside of focus // clicked outside of focus
if (!gDjuiChatBoxFocus) { if (!gDjuiChatBoxFocus) {
djui_interactable_set_input_focus(NULL); djui_interactable_set_input_focus(NULL);

View file

@ -179,7 +179,7 @@ static void djui_panel_on_categories_change(UNUSED struct DjuiBase* caller) {
djui_paginated_calculate_height(sModPaginated); djui_paginated_calculate_height(sModPaginated);
} }
static void* threaded_mod_refresh(void*) { static void* threaded_mod_refresh(UNUSED void* unused) {
mods_refresh_local(); mods_refresh_local();
if (gModRefreshThread.state == RUNNING) { join_thread(&gModRefreshThread); } if (gModRefreshThread.state == RUNNING) { join_thread(&gModRefreshThread); }

View file

@ -118,11 +118,9 @@ void djui_panel_mod_menu_mod_create(struct DjuiBase* caller) {
{ {
struct DjuiPaginated* paginated = djui_paginated_create(body, 8); struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
struct DjuiBase* layoutBase = &paginated->layout->base; struct DjuiBase* layoutBase = &paginated->layout->base;
s32 count = 0;
for (int i = 0; i < gHookedModMenuElementsCount; i++) { for (int i = 0; i < gHookedModMenuElementsCount; i++) {
if (gHookedModMenuElements[i].mod == mod) { if (gHookedModMenuElements[i].mod == mod) {
djui_panel_mod_menu_mod_create_element(layoutBase, i); djui_panel_mod_menu_mod_create_element(layoutBase, i);
count++;
} }
} }
djui_paginated_calculate_height(paginated); djui_paginated_calculate_height(paginated);

View file

@ -1,10 +1,10 @@
#ifndef SMLUA_UTILS_H #ifndef SMLUA_UTILS_H
#define SMLUA_UTILS_H #define SMLUA_UTILS_H
#include "src/pc/network/packets/packet.h"
extern u8 gSmLuaConvertSuccess; extern u8 gSmLuaConvertSuccess;
typedef int LuaFunction; typedef int LuaFunction;
struct Packet;
struct LSTNetworkType;
typedef struct ByteString { typedef struct ByteString {
const char *bytes; const char *bytes;

View file

@ -121,8 +121,8 @@ struct Object *get_current_object(void) { return gCurrentObject; }
struct Object *get_dialog_object(void) { return gContinueDialogFunctionObject; } struct Object *get_dialog_object(void) { return gContinueDialogFunctionObject; }
struct Object *get_cutscene_focus(void) { return gCutsceneFocus; } struct Object *get_cutscene_focus(void) { return gCutsceneFocus; }
struct Object *get_secondary_camera_focus(void) { return gSecondCameraFocus; } struct Object *get_secondary_camera_focus(void) { return gSecondCameraFocus; }
void *set_cutscene_focus(struct Object *o) { gCutsceneFocus = o; } void set_cutscene_focus(struct Object *o) { gCutsceneFocus = o; }
void *set_secondary_camera_focus(struct Object *o) { gSecondCameraFocus = o; } void set_secondary_camera_focus(struct Object *o) { gSecondCameraFocus = o; }
// //
// Helpers to iterate through the object table // Helpers to iterate through the object table

View file

@ -43,9 +43,9 @@ struct Object *get_cutscene_focus(void);
/* |description|Gets the secondary camera focus object|descriptionEnd| */ /* |description|Gets the secondary camera focus object|descriptionEnd| */
struct Object *get_secondary_camera_focus(void); struct Object *get_secondary_camera_focus(void);
/* |description|Sets the cutscene focus object|descriptionEnd| */ /* |description|Sets the cutscene focus object|descriptionEnd| */
void *set_cutscene_focus(struct Object *o); void set_cutscene_focus(struct Object *o);
/* |description|Sets the secondary camera focus object|descriptionEnd| */ /* |description|Sets the secondary camera focus object|descriptionEnd| */
void *set_secondary_camera_focus(struct Object *o); void set_secondary_camera_focus(struct Object *o);
// //
// Helpers to iterate through the object table // Helpers to iterate through the object table

View file

@ -279,7 +279,6 @@ void mod_cache_load(void) {
gfx_shutdown(); gfx_shutdown();
} }
u16 count = 0;
while (true) { while (true) {
u8 dataHash[16] = { 0 }; u8 dataHash[16] = { 0 };
u64 lastLoaded = 0; u64 lastLoaded = 0;
@ -298,7 +297,6 @@ void mod_cache_load(void) {
mod_cache_add_internal(dataHash, lastLoaded, (char*)path); mod_cache_add_internal(dataHash, lastLoaded, (char*)path);
free((void*)path); free((void*)path);
count++;
} }
LOG_INFO("Loading mod cache complete"); LOG_INFO("Loading mod cache complete");

View file

@ -982,8 +982,8 @@ C_DEFINE lua_Integer mod_fs_file_read_integer(struct ModFsFile *file, enum ModFs
case INT_TYPE_S16: return mod_fs_file_read_data<s16>(file, 0); case INT_TYPE_S16: return mod_fs_file_read_data<s16>(file, 0);
case INT_TYPE_S32: return mod_fs_file_read_data<s32>(file, 0); case INT_TYPE_S32: return mod_fs_file_read_data<s32>(file, 0);
case INT_TYPE_S64: return mod_fs_file_read_data<s64>(file, 0); case INT_TYPE_S64: return mod_fs_file_read_data<s64>(file, 0);
default: return 0;
} }
return 0;
} }
C_DEFINE lua_Number mod_fs_file_read_number(struct ModFsFile *file, enum ModFsFileFloatType floatType) { C_DEFINE lua_Number mod_fs_file_read_number(struct ModFsFile *file, enum ModFsFileFloatType floatType) {
@ -1006,8 +1006,8 @@ C_DEFINE lua_Number mod_fs_file_read_number(struct ModFsFile *file, enum ModFsFi
switch (floatType) { switch (floatType) {
case FLOAT_TYPE_F32: return mod_fs_file_read_data<f32>(file, 0); case FLOAT_TYPE_F32: return mod_fs_file_read_data<f32>(file, 0);
case FLOAT_TYPE_F64: return mod_fs_file_read_data<f64>(file, 0); case FLOAT_TYPE_F64: return mod_fs_file_read_data<f64>(file, 0);
default: return 0;
} }
return 0;
} }
C_DEFINE ByteString mod_fs_file_read_bytes(struct ModFsFile *file, u32 length) { C_DEFINE ByteString mod_fs_file_read_bytes(struct ModFsFile *file, u32 length) {
@ -1185,8 +1185,8 @@ C_DEFINE bool mod_fs_file_write_integer(struct ModFsFile *file, lua_Integer valu
case INT_TYPE_S16: return mod_fs_file_write_data<s16>(file, value); case INT_TYPE_S16: return mod_fs_file_write_data<s16>(file, value);
case INT_TYPE_S32: return mod_fs_file_write_data<s32>(file, value); case INT_TYPE_S32: return mod_fs_file_write_data<s32>(file, value);
case INT_TYPE_S64: return mod_fs_file_write_data<s64>(file, value); case INT_TYPE_S64: return mod_fs_file_write_data<s64>(file, value);
default: return false;
} }
return false;
} }
C_DEFINE bool mod_fs_file_write_number(struct ModFsFile *file, lua_Number value, enum ModFsFileFloatType floatType) { C_DEFINE bool mod_fs_file_write_number(struct ModFsFile *file, lua_Number value, enum ModFsFileFloatType floatType) {
@ -1214,8 +1214,8 @@ C_DEFINE bool mod_fs_file_write_number(struct ModFsFile *file, lua_Number value,
switch (floatType) { switch (floatType) {
case FLOAT_TYPE_F32: return mod_fs_file_write_data<f32>(file, value); case FLOAT_TYPE_F32: return mod_fs_file_write_data<f32>(file, value);
case FLOAT_TYPE_F64: return mod_fs_file_write_data<f64>(file, value); case FLOAT_TYPE_F64: return mod_fs_file_write_data<f64>(file, value);
default: return false;
} }
return false;
} }
C_DEFINE bool mod_fs_file_write_bytes(struct ModFsFile *file, ByteString bytestring) { C_DEFINE bool mod_fs_file_write_bytes(struct ModFsFile *file, ByteString bytestring) {
@ -1308,11 +1308,12 @@ C_DEFINE bool mod_fs_file_seek(struct ModFsFile *file, s32 offset, enum ModFsFil
return false; return false;
} }
s32 start = 0; s32 start;
switch (origin) { switch (origin) {
case FILE_SEEK_SET: start = 0; break; case FILE_SEEK_SET: start = 0; break;
case FILE_SEEK_CUR: start = file->offset; break; case FILE_SEEK_CUR: start = file->offset; break;
case FILE_SEEK_END: start = file->size; break; case FILE_SEEK_END: start = file->size; break;
default: start = 0; break;
} }
file->offset = MIN(MAX(start + offset, 0), (s32) file->size); file->offset = MIN(MAX(start + offset, 0), (s32) file->size);
return true; return true;

View file

@ -103,7 +103,6 @@ void sync_object_forget(u32 syncId) {
so->forgetting = true; so->forgetting = true;
// add it to a list to free later // add it to a list to free later
s32 forgetCount = 1;
struct SyncObjectForgetEntry* newEntry = calloc(1, sizeof(struct SyncObjectForgetEntry)); struct SyncObjectForgetEntry* newEntry = calloc(1, sizeof(struct SyncObjectForgetEntry));
newEntry->so = so; newEntry->so = so;
newEntry->forgetTimer = FORGET_TIMEOUT; newEntry->forgetTimer = FORGET_TIMEOUT;
@ -113,7 +112,6 @@ void sync_object_forget(u32 syncId) {
struct SyncObjectForgetEntry* entry = sForgetList; struct SyncObjectForgetEntry* entry = sForgetList;
while (entry->next != NULL) { while (entry->next != NULL) {
entry = entry->next; entry = entry->next;
forgetCount++;
} }
entry->next = newEntry; entry->next = newEntry;
} }

View file

@ -415,6 +415,7 @@ void* main_game_init(UNUSED void* dummy) {
mumble_init(); mumble_init();
gGameInited = true; gGameInited = true;
return NULL;
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {