Move stuff around

This commit is contained in:
Jarrod Doyle 2024-07-21 17:40:26 +01:00
parent 465e6825f4
commit e85008a505
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
48 changed files with 145 additions and 146 deletions

View File

@ -4,3 +4,16 @@ struct Table<T> {
s32 size; s32 size;
T data; T data;
}; };
struct Vec3<T> {
T x;
T y;
T z;
};
struct Vec4<T> {
T x;
T y;
T z;
T w;
};

View File

@ -1,50 +0,0 @@
#pragma once
using TOCEntry;
struct Version {
u32 major;
u32 minor;
};
struct FileHeader {
u32 toc_offset;
Version version;
padding[256];
u32 deadbeef;
};
struct TableOfContents {
u32 item_count;
TOCEntry items[item_count];
};
struct TOCEntry {
char name[12];
u32 offset;
u32 size;
};
struct ChunkHeader {
char name[12];
Version version;
padding[4];
};
struct Chunk<T> {
ChunkHeader header;
T data;
};
fn get_toc_entry(TableOfContents toc, str entry_name) {
for (u32 i = 0, i < toc.item_count, i = i + 1) {
if (std::string::starts_with(toc.items[i].name, entry_name)) {
return toc.items[i];
}
}
};
fn get_offset(TableOfContents toc, str entry_name) {
TOCEntry entry = get_toc_entry(toc, entry_name);
return entry.offset;
};

View File

@ -0,0 +1,43 @@
#pragma once
#include "db_files/chunks/AI_ROOM_DB.hexpat"
#include "db_files/chunks/AIACS.hexpat"
#include "db_files/chunks/AICONVERSE.hexpat"
#include "db_files/chunks/AICRTSZ.hexpat"
#include "db_files/chunks/AIGPTHVAR.hexpat"
#include "db_files/chunks/AIHearStat.hexpat"
#include "db_files/chunks/AIPATHVAR.hexpat"
#include "db_files/chunks/AISNDTWK.hexpat"
#include "db_files/chunks/AMBIENT.hexpat"
#include "db_files/chunks/BASH.hexpat"
#include "db_files/chunks/BRHEAD.hexpat"
#include "db_files/chunks/BRLIST.hexpat"
#include "db_files/chunks/BRVER.hexpat"
#include "db_files/chunks/CELL_MOTION.hexpat"
#include "db_files/chunks/CELOBJVAR.hexpat"
#include "db_files/chunks/CLOUDOBJVAR.hexpat"
#include "db_files/chunks/DARKCOMBAT.hexpat"
#include "db_files/chunks/DARKMISS.hexpat"
#include "db_files/chunks/DISTOBJVAR.hexpat"
#include "db_files/chunks/DRKSET.hexpat"
#include "db_files/chunks/ENVMAPVAR.hexpat"
#include "db_files/chunks/FAMILY.hexpat"
#include "db_files/chunks/FILE_TYPE.hexpat"
#include "db_files/chunks/FLOW_TEX.hexpat"
#include "db_files/chunks/FOGZONEVAR.hexpat"
#include "db_files/chunks/MAPISRC.hexpat"
#include "db_files/chunks/Mission_GameSysEAX.hexpat"
#include "db_files/chunks/RENDPARAMS.hexpat"
#include "db_files/chunks/ROOM_DB.hexpat"
#include "db_files/chunks/ROOM_EAX.hexpat"
#include "db_files/chunks/ScrModules.hexpat"
#include "db_files/chunks/SKYMODE.hexpat"
#include "db_files/chunks/SKYOBJVAR.hexpat"
#include "db_files/chunks/SONGPARAMS.hexpat"
#include "db_files/chunks/STAROBJVAR.hexpat"
#include "db_files/chunks/TILIST.hexpat"
#include "db_files/chunks/TXLIST.hexpat"
#include "db_files/chunks/TXTPAT_DB.hexpat"
#include "db_files/chunks/WATERBANKS.hexpat"
#include "db_files/chunks/WEATHERVAR.hexpat"
#include "db_files/chunks/WREXT.hexpat"

View File

@ -0,0 +1,74 @@
#pragma once
struct Version {
u32 major;
u32 minor;
};
struct FileHeader {
u32 toc_offset;
Version version;
padding[256];
u32 deadbeef;
};
struct TOCEntry {
char name[12];
u32 offset;
u32 size;
};
struct TableOfContents {
u32 item_count;
TOCEntry items[item_count];
};
struct ChunkHeader {
char name[12];
Version version;
padding[4];
};
struct Chunk<T> {
ChunkHeader header;
T data;
};
struct Plane {
float x;
float y;
float z;
float d;
};
struct DPlane {
double x;
double y;
double z;
double d;
};
namespace NameNum {
struct Tag {
s32 value;
if (value != -1) {
s32 name_len;
if (name_len != -1) {
char name[name_len];
}
}
};
struct Table {
// This header section is actually a tag too, but for namings sake I'll leave it like this
s32 max_names;
s32 sys_name_len;
char sys_name[sys_name_len];
Tag tags[max_names];
};
}
enum ColorMethod : s32 {
Sum = 0x0,
Interpolate = 0x1,
};

View File

@ -4,47 +4,7 @@
#include "FileBase.hexpat" #include "FileBase.hexpat"
#include "lgtypes.hexpat" #include "lgtypes.hexpat"
#include "chunks/AI_ROOM_DB.hexpat" #include "db_files/AllChunks.pat"
#include "chunks/AIACS.hexpat"
#include "chunks/AICONVERSE.hexpat"
#include "chunks/AICRTSZ.hexpat"
#include "chunks/AIGPTHVAR.hexpat"
#include "chunks/AIHearStat.hexpat"
#include "chunks/AIPATHVAR.hexpat"
#include "chunks/AISNDTWK.hexpat"
#include "chunks/AMBIENT.hexpat"
#include "chunks/BASH.hexpat"
#include "chunks/BRHEAD.hexpat"
#include "chunks/BRLIST.hexpat"
#include "chunks/BRVER.hexpat"
#include "chunks/CELL_MOTION.hexpat"
#include "chunks/CELOBJVAR.hexpat"
#include "chunks/CLOUDOBJVAR.hexpat"
#include "chunks/DARKCOMBAT.hexpat"
#include "chunks/DARKMISS.hexpat"
#include "chunks/DISTOBJVAR.hexpat"
#include "chunks/DRKSET.hexpat"
#include "chunks/ENVMAPVAR.hexpat"
#include "chunks/FAMILY.hexpat"
#include "chunks/FILE_TYPE.hexpat"
#include "chunks/FLOW_TEX.hexpat"
#include "chunks/FOGZONEVAR.hexpat"
#include "chunks/MAPISRC.hexpat"
#include "chunks/Mission_GameSysEAX.hexpat"
#include "chunks/RENDPARAMS.hexpat"
#include "chunks/ROOM_DB.hexpat"
#include "chunks/ROOM_EAX.hexpat"
#include "chunks/ScrModules.hexpat"
#include "chunks/SKYMODE.hexpat"
#include "chunks/SKYOBJVAR.hexpat"
#include "chunks/SONGPARAMS.hexpat"
#include "chunks/STAROBJVAR.hexpat"
#include "chunks/TILIST.hexpat"
#include "chunks/TXLIST.hexpat"
#include "chunks/TXTPAT_DB.hexpat"
#include "chunks/WATERBANKS.hexpat"
#include "chunks/WEATHERVAR.hexpat"
#include "chunks/WREXT.hexpat"
FileHeader file_header @ 0x0; FileHeader file_header @ 0x0;
TableOfContents toc @ file_header.toc_offset; TableOfContents toc @ file_header.toc_offset;

View File

@ -0,0 +1,14 @@
#pragma once
fn get_toc_entry(TableOfContents toc, str entry_name) {
for (u32 i = 0, i < toc.item_count, i = i + 1) {
if (std::string::starts_with(toc.items[i].name, entry_name)) {
return toc.items[i];
}
}
};
fn get_offset(TableOfContents toc, str entry_name) {
TOCEntry entry = get_toc_entry(toc, entry_name);
return entry.offset;
};

View File

@ -1,55 +0,0 @@
#pragma once
using Vec3;
using NameNum;
using NameNumTag;
struct Plane {
float x;
float y;
float z;
float d;
};
struct DPlane {
double x;
double y;
double z;
double d;
};
struct Vec3<T> {
T x;
T y;
T z;
};
struct Vec4<T> {
T x;
T y;
T z;
T w;
};
struct NameNum {
// This header section is actually a tag too, but for namings sake I'll leave it like this
s32 max_names;
s32 sys_name_len;
char sys_name[sys_name_len];
NameNumTag tags[max_names];
};
struct NameNumTag {
s32 value;
if (value != -1) {
s32 name_len;
if (name_len != -1) {
char name[name_len];
}
}
};
enum ColorMethod : s32 {
Sum = 0x0,
Interpolate = 0x1,
};