LibT2FS 0.1
C API for accessing TEngine data in memory.
Loading...
Searching...
No Matches
Core Basics
#include "t2fs.h"
int main() {
const char *filepath = "/home/user/games/Seeds of Evil.lss";
t2fs_init(&ctx);
// Auto detect needed config for the given input file.
// This to handle endianness and other differences between files.
// For PC data files it will try to match by filename (case
// insensitive), and for N64 .z64 files it will try to match by
// game ID and checksum from the file.
if (t2fs_config_auto_detect(&ctx.config, filepath) != 0) {
return 1;
}
if (t2fs_open(&ctx, filepath, NULL, 1) != T2FS_OK) {
// error .. do not use the lib object after this, calling t2fs_close()
// would be ok as long as it's inited.
return 1;
}
// do stuff
// ..
// free all nodes, their data and close the file.
t2fs_close(&ctx);
return 0;
}
int t2fs_config_auto_detect(T2FSFileConfig *dest, const char *const filepath)
Auto detect the needed config based on filename.
T2FSFileConfig config
We might need different config for different files, these configs are pre-defined and contain info li...
Definition t2fs.h:296
T2FSStatus t2fs_open(T2FSContext *ctx, const char *const filepath, const char *const schemaPath, uint8_t searchSchema)
Open .dat/.lss/.lsm file.
@ T2FS_OK
Definition t2fs.h:282
struct s_T2FSContext T2FSContext
This is the core LibT2FS object that you will be passing around.
Definition t2fs.h:53
void t2fs_init(T2FSContext *ctx)
Always initialize your T2FSContext object.
void t2fs_close(T2FSContext *ctx)
Close opened file and free all allocated node/data memory.