From 05e611b7f2766a8b02d21c16e068e37ea26e92c8 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Tue, 26 Sep 2023 22:44:11 +0300 Subject: [PATCH] clean up code, fix one memory leak --- source/host.c | 3 ++- source/psp/video_hardware_hlmdl.cpp | 4 ---- source/psp/video_hardware_model.cpp | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/source/host.c b/source/host.c index d1dae93..66112c8 100644 --- a/source/host.c +++ b/source/host.c @@ -704,7 +704,8 @@ void _Host_Frame (float time) pass1+pass2+pass3, pass1, pass2, pass3); } - // if ((host_framecount % 120) == 0) Con_Printf ("%dkB free \n", pspSdkTotalFreeUserMemSize()/1024); + // Debug log free memory + // if ((host_framecount % 120) == 0) Con_Printf ("%.2fkB free \n", pspSdkTotalFreeUserMemSize()/1024.f); //frame speed counter fps_count++;//muff diff --git a/source/psp/video_hardware_hlmdl.cpp b/source/psp/video_hardware_hlmdl.cpp index 7bce615..8d7722f 100644 --- a/source/psp/video_hardware_hlmdl.cpp +++ b/source/psp/video_hardware_hlmdl.cpp @@ -31,8 +31,6 @@ extern"C" #include #include -extern std::list mapTextureNameList; - extern model_t *loadmodel; extern vec3_t lightcolor; // LordHavoc: .lit support @@ -157,9 +155,7 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer) for(i = 0; i < header->numtextures; i++) { - tex[i].i = GL_LoadPalTex (tex[i].name, tex[i].w, tex[i].h, (byte *) header + tex[i].i, qtrue, GU_LINEAR, 0, (byte *) header + tex[i].w * tex[i].h + tex[i].i, PAL_RGB); - mapTextureNameList.push_back(tex[i].i); // for unload textures } // // move the complete, relocatable alias model to the cache diff --git a/source/psp/video_hardware_model.cpp b/source/psp/video_hardware_model.cpp index bd347b3..6896bdd 100644 --- a/source/psp/video_hardware_model.cpp +++ b/source/psp/video_hardware_model.cpp @@ -1189,7 +1189,6 @@ void Mod_LoadFaces (lump_t *l) if (l->filelen % sizeof(*in)) Con_Printf ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name); count = l->filelen / sizeof(*in); - Con_Printf("Model faces %d\n", count); out = static_cast(Hunk_AllocName ( count*sizeof(*out), loadname)); loadmodel->surfaces = out; @@ -2018,7 +2017,7 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight ) qboolean model_is_gun(char name[MAX_QPATH]) { - char* wep_path = static_cast(malloc(sizeof(char)*15)); + char wep_path[15]; for (int i = 0; i < 15; i++) { wep_path[i] = name[i];