Update CHANGELOG.md

This commit is contained in:
Crayon2000 2024-10-31 08:57:29 -04:00
parent b1fdc58bed
commit 4c96e18b17
4 changed files with 5 additions and 5 deletions

View file

@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased][] ## [Unreleased][]
- Allow compilation and installation with cmake. - 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. - Added `GRRLIB_CreateEmptyTextureFmt()` to create an empty texture with a given format.
## [4.5.1][] - 2024-03-02 ## [4.5.1][] - 2024-03-02

View file

@ -29,7 +29,7 @@ THE SOFTWARE.
#include <grrlib.h> #include <grrlib.h>
#define TPL_HDR_VERSION_FIELD 0 /**< Version field. */ #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_HDRSIZE_FIELD 8 /**< Header size field. */
#define TPL_HDR_DESCR_FIELD 12 /**< Descriptor 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. * Set TPL data to a GRRLIB_texImg structure.
* @param my_tpl The TPL buffer to set. * @param my_tpl The TPL buffer to set.
* @param size Size of 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. * @return A GRRLIB_texImg structure filled with image information.
*/ */
GRRLIB_texImg* GRRLIB_LoadTextureTPL (const u8 *my_tpl, const int size, u32 id) { 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->w = imghead->width;
my_texture->h = imghead->height; my_texture->h = imghead->height;
my_texture->format = imghead->fmt; my_texture->format = imghead->fmt;
my_texture->freedata = true;
GRRLIB_SetHandle( my_texture, 0, 0 ); GRRLIB_SetHandle( my_texture, 0, 0 );
GRRLIB_FlushTex( my_texture ); GRRLIB_FlushTex( my_texture );

View file

@ -123,7 +123,6 @@ typedef struct GRRLIB_texImg {
f32 ofnormaltexy;/**< Offset of normalized texture on y. */ f32 ofnormaltexy;/**< Offset of normalized texture on y. */
void *data; /**< Pointer to the texture data. */ void *data; /**< Pointer to the texture data. */
bool freedata; /**< Should the data be freed. */
} GRRLIB_texImg; } GRRLIB_texImg;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View file

@ -49,7 +49,7 @@ void GRRLIB_FreeTexture (GRRLIB_texImg *tex) {
if(tex == NULL) { if(tex == NULL) {
return; return;
} }
if (tex->data != NULL && tex->freedata == true) { if (tex->data != NULL) {
free(tex->data); free(tex->data);
} }
free(tex); free(tex);
@ -61,7 +61,7 @@ void GRRLIB_FreeTexture (GRRLIB_texImg *tex) {
*/ */
INLINE INLINE
void GRRLIB_ClearTex(GRRLIB_texImg* tex) { void GRRLIB_ClearTex(GRRLIB_texImg* tex) {
if(tex == NULL || tex->freedata == false) { if(tex == NULL) {
return; return;
} }
memset(tex->data, 0, GX_GetTexBufferSize(tex->w, tex->h, tex->format, 0, 0)); memset(tex->data, 0, GX_GetTexBufferSize(tex->w, tex->h, tex->format, 0, 0));