LibT2FS 0.1
C API for accessing TEngine data in memory.
Loading...
Searching...
No Matches
scenes.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#ifndef H_T2FS_SCENES
17#define H_T2FS_SCENES
18
19#include <stdint.h>
20
21#include "t2fs.h"
22#include "array.h"
23#include "models/common.h"
24
25
26// ********************************************************************
27// Structs as in file (possible after decompression and/or deinterleaving)
28// ********************************************************************
29
40typedef struct __attribute__((__packed__)) s_T2FSDataSceneHeader {
41 int32_t levelId;
42 int32_t regionId;
43
44 uint32_t unk2;
45
48 uint32_t unk3;
49
53 uint32_t unk4;
54
57 uint32_t unk5;
58
59 // This is weird, string can be 27 bytes (inc \0) but when shorter
60 // it seeme random bytes are set after the \0.
61 char name[28];
62
63
64 uint32_t unk6;
65 uint32_t unk7;
66
67 uint32_t unk8;
68 uint32_t unk9;
69 uint32_t unk10;
70
71 uint32_t unk11;
73
75T2FS_CREATE_SWAP_STRUCT(T2FSDataSceneHeader, (4,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,4,4,4,4,4));
76
77
84typedef struct __attribute__((__packed__)) s_T2FSDataSceneHeader_0x48 {
85 int32_t levelId;
86 int32_t regionId;
87
88 uint32_t unk2;
89
92 uint32_t unk3;
93
97 uint32_t unk4;
98
101 uint32_t unk5;
102
103 char name[28];
104
105 uint32_t unk6;
106 uint32_t unk7;
107
108 uint32_t unk8;
109 uint32_t unk9;
110 uint32_t unk10;
112
114
115
116// ********************************************************************
117// Our structs
118// ********************************************************************
119
120typedef struct s_T2FSScene {
121 T2FSNode *node; // scene node /root/scenes/curSceneIndex/
122 uint8_t isValid;
123
124 // current set entry from /root/scenes/0/0/data
126 uint32_t id;
128
129
130typedef struct s_T2FSScenes {
131 T2FSNode *node; // /root/scenes/
132 T2FSNode *nodeHeader; // info node /root/scenes/0/0/
134 uint8_t isValid;
135
136 // /root/scenes/0/0/data
139
140
141void
143
144void
146
147void
149
150uint32_t
152
153int
155
156void
158
159int
161
162int
163t2fs_scene_load(T2FSScenes *scenes, T2FSScene *dest, uint32_t id);
164
165void
167
168#endif
struct s_T2FSArray T2FSArray
struct s_T2FSDataSceneHeader T2FSDataSceneHeader
struct s_T2FSDataSceneHeader_0x48 T2FSDataSceneHeader_0x48
#define SASSERT_SIZE(what, size)
Definition models/common.h:26
#define T2FS_CREATE_SWAP_STRUCT(name, sizes)
Definition models/common.h:36
void t2fs_scene_unload(T2FSScene *scene)
struct s_T2FSScenes T2FSScenes
void t2fs_scene_header_clear(T2FSDataSceneHeader *info)
void t2fs_scenes_unload(T2FSScenes *scenes)
int t2fs_scene_load(T2FSScenes *scenes, T2FSScene *dest, uint32_t id)
int t2ts_scenes_get_header(T2FSScenes *scenes, T2FSDataSceneHeader *dest, uint32_t id)
int t2fs_scenes_load(T2FSContext *ctx, T2FSScenes *scenes)
struct s_T2FSScene T2FSScene
void t2fs_scene_clear(T2FSScene *scene)
void t2fs_scenes_clear(T2FSScenes *scenes)
uint32_t t2fs_scenes_count(T2FSContext *ctx)
Definition scenes.h:84
uint32_t unk7
Definition scenes.h:106
uint32_t unk5
Definition scenes.h:101
int32_t levelId
might be unused (-1)
Definition scenes.h:85
uint32_t unk9
Either 0x00000000 or 0x01000000.
Definition scenes.h:109
uint32_t unk10
Either 0x00000000 or 0x01000000.
Definition scenes.h:110
uint32_t unk3
Definition scenes.h:92
int32_t regionId
might be unused (-1)
Definition scenes.h:86
char name[28]
Definition scenes.h:103
uint32_t unk8
Almost always set to 0xcdcc0c40, two entries set to 0x0000803f.
Definition scenes.h:108
uint32_t unk4
Definition scenes.h:97
uint32_t unk6
Definition scenes.h:105
uint32_t unk2
Definition scenes.h:88
Definition scenes.h:40
int32_t regionId
might be unused (-1)
Definition scenes.h:42
uint32_t unk9
Either 0x00000000 or 0x01000000.
Definition scenes.h:68
uint32_t unk11
Missing on South Park.
Definition scenes.h:71
uint32_t unk3
Definition scenes.h:48
uint32_t unk2
Definition scenes.h:44
uint32_t unk8
On seeds always set to 0xcdcc0c40.
Definition scenes.h:67
uint32_t unk5
Definition scenes.h:57
uint32_t unk6
Definition scenes.h:64
uint32_t unk7
Definition scenes.h:65
uint32_t unk4
Definition scenes.h:53
int32_t levelId
might be unused (-1)
Definition scenes.h:41
uint32_t unk10
Either 0x00000000 or 0x01000000.
Definition scenes.h:69
char name[28]
Definition scenes.h:61
Definition scenes.h:120
T2FSDataSceneHeader header
Definition scenes.h:125
uint32_t id
Definition scenes.h:126
T2FSNode * node
Definition scenes.h:121
uint8_t isValid
Definition scenes.h:122
Definition scenes.h:130
T2FSNode * nodeHeader
Definition scenes.h:132
uint8_t isValid
Definition scenes.h:134
T2FSContext * ctx
Definition scenes.h:133
T2FSNode * node
Definition scenes.h:131
T2FSArray infoArray
Definition scenes.h:137
struct s_T2FSNode T2FSNode
This is the core object to describe a path inside the tree.
Definition t2fs.h:110
struct s_T2FSContext T2FSContext
This is the core LibT2FS object that you will be passing around.
Definition t2fs.h:53