LibT2FS 0.1
C API for accessing TEngine data in memory.
Loading...
Searching...
No Matches
textures.h
Go to the documentation of this file.
1/* This file is part of LibT2FS.
2 *
3 * LibT2FS is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * LibT2FS is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16
17#ifndef H_T2FS_TEXTURES
18#define H_T2FS_TEXTURES
19
20#include <stdint.h>
21
22#include "t2fs.h"
23#include "models/common.h"
24
25
26// ********************************************************************
27// Structs as in file (possible after decompression and/or deinterleaving)
28// ********************************************************************
29
32typedef struct __attribute__((__packed__)) s_t2fsDataTextureHeader {
33 uint8_t type;
34 uint8_t unk1;
35 uint8_t width;
36 uint8_t height;
37 uint16_t unk2;
38 uint16_t unk3;
40
42
43
44// ********************************************************************
45// Our structs
46// ********************************************************************
47
48typedef struct s_t2fsTexture {
53 uint32_t frameCount;
54 uint32_t frameSize;
55 uint32_t paletteCount;
56 uint32_t paletteSize;
57 uint32_t width;
58 uint32_t height;
59 uint8_t *name;
60
61 uint32_t currentFrame;
62 uint8_t *frameData;
63 uint8_t *paletteData;
64
65 uint8_t paletteRed[256];
66 uint8_t paletteGreen[256];
67 uint8_t paletteBlue[256];
68
69 uint8_t isValid;
71
72
73void
75
76uint32_t
78
79// user should check frameIndex sanity..
80void
81t2fs_texture_set_frame(t2fsTexture *texture, uint32_t frameIndex);
82
83int
84t2fs_texture_load(t_t2fs *lib, t2fsTexture* texture, uint32_t id);
85
86void
88
89#endif
struct s_t2fsDataTextureHeader t2fsDataTextureHeader
#define SASSERT_SIZE(what, size)
Definition models/common.h:24
Definition textures.h:32
uint16_t unk2
fg color? always set to 0xFF00 ?
Definition textures.h:37
uint8_t height
shift value
Definition textures.h:36
uint8_t unk1
Definition textures.h:34
uint8_t width
shift value
Definition textures.h:35
uint8_t type
Definition textures.h:33
uint16_t unk3
bg color? always set to 0x0000 ?
Definition textures.h:38
Definition textures.h:48
uint8_t * frameData
Definition textures.h:62
t2fsNode * framesNode
Definition textures.h:50
uint8_t paletteBlue[256]
Definition textures.h:67
uint8_t * paletteData
Definition textures.h:63
uint32_t width
Definition textures.h:57
uint32_t frameCount
Definition textures.h:53
t2fsNode * palettesNode
Definition textures.h:51
uint32_t frameSize
Definition textures.h:54
uint8_t isValid
Definition textures.h:69
uint8_t * name
Definition textures.h:59
uint32_t paletteSize
Definition textures.h:56
uint8_t paletteGreen[256]
Definition textures.h:66
uint8_t paletteRed[256]
Definition textures.h:65
uint32_t paletteCount
Definition textures.h:55
uint32_t height
Definition textures.h:58
t2fsDataTextureHeader * header
Definition textures.h:52
uint32_t currentFrame
Definition textures.h:61
t2fsNode * node
Definition textures.h:49
struct s_t2fsNode t2fsNode
This is the core object to describe a path inside the tree.
Definition t2fs.h:110
struct s_t2fs t_t2fs
This is the core LibT2FS object that you will be passing around.
Definition t2fs.h:53
void t2fs_texture_clear(t2fsTexture *texture)
void t2fs_texture_unload(t2fsTexture *texture)
struct s_t2fsTexture t2fsTexture
uint32_t t2fs_texture_count(t_t2fs *lib)
void t2fs_texture_set_frame(t2fsTexture *texture, uint32_t frameIndex)
int t2fs_texture_load(t_t2fs *lib, t2fsTexture *texture, uint32_t id)