From 22dbda6007135147445a38fc188ada2ffef81c8a Mon Sep 17 00:00:00 2001 From: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com> Date: Sat, 23 May 2026 12:49:28 +0200 Subject: [PATCH] logs --- src/engine/surface_collision.c | 1 - src/game/player_palette.c | 15 +++++++++++---- src/game/spawn_object.c | 6 +++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/engine/surface_collision.c b/src/engine/surface_collision.c index 3e16d941a..ba8111c8f 100644 --- a/src/engine/surface_collision.c +++ b/src/engine/surface_collision.c @@ -645,7 +645,6 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32 f32 diff = (surf->prevVertex1[0] - x1) * (surf->prevVertex1[0] - x1); diff += (surf->prevVertex1[1] - surf->vertex1[1]) * (surf->prevVertex1[1] - surf->vertex1[1]); diff += (surf->prevVertex1[2] - z1) * (surf->prevVertex1[2] - z1); - //printf("%f\n", sqrtf(diff)); if (diff > 10000) { interpolate = FALSE; } else { diff --git a/src/game/player_palette.c b/src/game/player_palette.c index 9300df262..70f6d5a72 100644 --- a/src/game/player_palette.c +++ b/src/game/player_palette.c @@ -3,6 +3,7 @@ #include "pc/ini.h" #include "pc/mods/mods.h" #include "pc/mods/mods_utils.h" +#include "pc/debuglog.h" #include "player_palette.h" const struct PlayerPalette DEFAULT_MARIO_PALETTE = @@ -118,7 +119,7 @@ void player_palettes_read(const char* palettesPath, bool appendPalettes) { if (!player_palette_init(palettesPath, path, appendPalettes)) { #ifdef DEVELOPMENT - printf("Failed to load palette '%s.ini'\n", path); + LOG_ERROR("Failed to load palette '%s.ini'", path); #endif continue; } @@ -140,7 +141,7 @@ void player_palettes_read(const char* palettesPath, bool appendPalettes) { gPresetPalettes[gPresetPaletteCount].palette = palette; gPresetPaletteCount++; #ifdef DEVELOPMENT - printf("Loaded palette '%s.ini'\n", path); + LOG_INFO("Loaded palette '%s.ini'", path); #endif if (gPresetPaletteCount >= MAX_PRESET_PALETTES) { break; } } @@ -160,8 +161,12 @@ void player_palette_export(char* name) { snprintf(ppath, SYS_MAX_PATH, "%s/%s.ini", palettesPath, name); fs_sys_mkdir(palettesPath); - printf("Saving palette as '%s.ini'\n", name); FILE* file = fopen(ppath, "w"); + if (!file) { + LOG_ERROR("Unable to create file '%s.ini'!", name); + return; + } + fprintf(file, "[PALETTE]\n\ PANTS_R = %d\n\ PANTS_G = %d\n\ @@ -212,6 +217,8 @@ EMBLEM_B = %d\n", configPlayerPalette.parts[EMBLEM][1], configPlayerPalette.parts[EMBLEM][2]); fclose(file); + + LOG_INFO("Saving palette as '%s.ini'", name); } bool player_palette_delete(const char* palettesPath, char* name, bool appendPalettes) { @@ -224,7 +231,7 @@ bool player_palette_delete(const char* palettesPath, char* name, bool appendPale } if (remove(ppath) == 0) { - printf("Deleting palette '%s.ini'\n", name); + LOG_INFO("Deleting palette '%s.ini'", name); return true; } return false; diff --git a/src/game/spawn_object.c b/src/game/spawn_object.c index 50e8ce8af..3bcadfe7a 100644 --- a/src/game/spawn_object.c +++ b/src/game/spawn_object.c @@ -85,7 +85,7 @@ struct Object *try_allocate_object(struct ObjectNode *destList, struct ObjectNod struct ObjectNode *nextObj = NULL; if (destList == NULL || freeList == NULL) { - fprintf(stderr, "FATAL ERROR: Failed to try and allocate a object because either the destList %p or freeList %p was NULL!\n", destList, freeList); + LOG_ERROR("Failed to try and allocate a object because either the destList %p or freeList %p was NULL!", destList, freeList); return NULL; } @@ -99,7 +99,7 @@ struct Object *try_allocate_object(struct ObjectNode *destList, struct ObjectNod if (destList->prev != NULL) { destList->prev->next = nextObj; } else { - fprintf(stderr, "ERROR: The previous object in the destination list %p was NULL! Unexpected errors may occur.\n", destList); + LOG_ERROR("The previous object in the destination list %p was NULL! Unexpected errors may occur.", destList); } destList->prev = nextObj; } else { @@ -383,7 +383,7 @@ struct Object *create_object(const BehaviorScript *bhvScript) { } if (objListIndex >= NUM_OBJ_LISTS) { - fprintf(stderr, "Failed to create object with non-existent object list index %i with behavior script %p.\n", objListIndex, bhvScript); + LOG_ERROR("Failed to create object with non-existent object list index %i with behavior script %p.", objListIndex, bhvScript); return NULL; }