diff --git a/CHANGELOG.md b/CHANGELOG.md index 47ea89e..fc9ba60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased][] - Allow compilation and installation with cmake. +- Added `GRRLIB_LoadTextureTPL` to load TPL data (Texture Palette Library) into a `GRRLIB_texImg`. - Added `GRRLIB_CreateEmptyTextureFmt()` to create an empty texture with a given format. ## [4.5.1][] - 2024-03-02 diff --git a/GRRLIB/GRRLIB/GRRLIB_texEdit.c b/GRRLIB/GRRLIB/GRRLIB_texEdit.c index 1111958..de6049d 100644 --- a/GRRLIB/GRRLIB/GRRLIB_texEdit.c +++ b/GRRLIB/GRRLIB/GRRLIB_texEdit.c @@ -29,7 +29,7 @@ THE SOFTWARE. #include #define TPL_HDR_VERSION_FIELD 0 /**< Version field. */ -#define TPL_HDR_NTEXTURE_FIELD 4 /**< Textrure field. */ +#define TPL_HDR_NTEXTURE_FIELD 4 /**< Texture field. */ #define TPL_HDR_HDRSIZE_FIELD 8 /**< Header size field. */ #define TPL_HDR_DESCR_FIELD 12 /**< Descriptor field. */ @@ -205,6 +205,7 @@ GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const u32 width, const u32 height) * Set TPL data to a GRRLIB_texImg structure. * @param my_tpl The TPL buffer to set. * @param size Size of the TPL buffer to set. + * @param id ID of the TPL buffer to set. * @return A GRRLIB_texImg structure filled with image information. */ GRRLIB_texImg* GRRLIB_LoadTextureTPL (const u8 *my_tpl, const int size, u32 id) { @@ -232,7 +233,6 @@ GRRLIB_texImg* GRRLIB_LoadTextureTPL (const u8 *my_tpl, const int size, u32 id) my_texture->w = imghead->width; my_texture->h = imghead->height; my_texture->format = imghead->fmt; - my_texture->freedata = true; GRRLIB_SetHandle( my_texture, 0, 0 ); GRRLIB_FlushTex( my_texture ); diff --git a/GRRLIB/GRRLIB/grrlib.h b/GRRLIB/GRRLIB/grrlib.h index cee9fd4..a2b30e8 100644 --- a/GRRLIB/GRRLIB/grrlib.h +++ b/GRRLIB/GRRLIB/grrlib.h @@ -123,7 +123,6 @@ typedef struct GRRLIB_texImg { f32 ofnormaltexy;/**< Offset of normalized texture on y. */ void *data; /**< Pointer to the texture data. */ - bool freedata; /**< Should the data be freed. */ } GRRLIB_texImg; //------------------------------------------------------------------------------ diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h b/GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h index 20c25dc..ca3acdd 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h @@ -49,7 +49,7 @@ void GRRLIB_FreeTexture (GRRLIB_texImg *tex) { if(tex == NULL) { return; } - if (tex->data != NULL && tex->freedata == true) { + if (tex->data != NULL) { free(tex->data); } free(tex); @@ -61,7 +61,7 @@ void GRRLIB_FreeTexture (GRRLIB_texImg *tex) { */ INLINE void GRRLIB_ClearTex(GRRLIB_texImg* tex) { - if(tex == NULL || tex->freedata == false) { + if(tex == NULL) { return; } memset(tex->data, 0, GX_GetTexBufferSize(tex->w, tex->h, tex->format, 0, 0));