Fixed everything being broken and ImHex memory leak
This commit is contained in:
parent
2efb6374e6
commit
e7bf306211
|
@ -17,3 +17,17 @@ struct Vec4<T> {
|
|||
T z;
|
||||
T w;
|
||||
};
|
||||
|
||||
struct Plane {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float d;
|
||||
};
|
||||
|
||||
struct DPlane {
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
double d;
|
||||
};
|
|
@ -1,53 +1,5 @@
|
|||
#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;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <std/string.pat>
|
||||
#include <std/io.pat>
|
||||
|
||||
#include "FileBase.hexpat"
|
||||
#include "lgtypes.hexpat"
|
||||
|
||||
#include "db_files/FileBase.pat"
|
||||
#include "db_files/Common.hexpat"
|
||||
#include "db_files/AllChunks.pat"
|
||||
|
||||
FileHeader file_header @ 0x0;
|
||||
|
@ -40,10 +41,10 @@ Chunk<FileType> file_type @ get_offset(toc, "FILE_TYPE");
|
|||
Chunk<FlowTex> flow_tex @ get_offset(toc, "FLOW_TEX");
|
||||
Chunk<FogZoneVar> fog_zone_var @ get_offset(toc, "FOGZONEVAR");
|
||||
Chunk<AccousticsProperty> gamesys_eax @ get_offset(toc, "GameSysEAX");
|
||||
Chunk<NameNum> hot_regions @ get_offset(toc, "HotRegions");
|
||||
Chunk<NameNum::Table> hot_regions @ get_offset(toc, "HotRegions");
|
||||
Chunk<MapISrc> map_i_src @ get_offset(toc, "MAPISRC");
|
||||
Chunk<AccousticsProperty> mission_eax @ get_offset(toc, "MissionEAX");
|
||||
Chunk<NameNum> multibrush @ get_offset(toc, "MultiBrush");
|
||||
Chunk<NameNum::Table> multibrush @ get_offset(toc, "MultiBrush");
|
||||
Chunk<RendParams> rend_params @ get_offset(toc, "RENDPARAMS");
|
||||
Chunk<RoomDb> room_db @ get_offset(toc, "ROOM_DB");
|
||||
Chunk<RoomEax> room_eax @ get_offset(toc, "ROOM_EAX");
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
#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;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
#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;
|
||||
};
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "Common.hexpat"
|
||||
#include "lgtypes.hexpat"
|
||||
|
||||
namespace AiRoomDb {
|
||||
struct Cell {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "lgtypes.hexpat"
|
||||
#include "Common.hexpat"
|
||||
|
||||
using Br;
|
||||
using Grid;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "lgtypes.hexpat"
|
||||
#include "Common.hexpat"
|
||||
|
||||
struct CellMotionPortal {
|
||||
Vec3<float> center;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Common.hexpat"
|
||||
|
||||
struct CelObjVar {
|
||||
bool enable_object;
|
||||
padding[3];
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "lgtypes.hexpat"
|
||||
#include "Common.hexpat"
|
||||
#include "db_files/Common.hexpat"
|
||||
|
||||
using ColorSettings;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Common.hexpat"
|
||||
|
||||
struct DistantArtVar {
|
||||
bool enable_distant_art;
|
||||
padding[3];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "lgtypes.hexpat"
|
||||
#include "Common.hexpat"
|
||||
|
||||
struct FogZone {
|
||||
padding[1];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "lgtypes.hexpat"
|
||||
#include "Common.hexpat"
|
||||
|
||||
enum SunlightMode : s32 {
|
||||
SingleUnshadowed = 0x0,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "lgtypes.hexpat"
|
||||
#include "Common.hexpat"
|
||||
|
||||
struct RoomPortal {
|
||||
s32 id;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "lgtypes.hexpat"
|
||||
#include "Common.hexpat"
|
||||
#include "db_files/Common.hexpat"
|
||||
|
||||
struct SkyObjVar {
|
||||
bool enable_new_sky;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Common.hexpat"
|
||||
|
||||
struct RGBA {
|
||||
Vec3<u8> rgb;
|
||||
padding[1];
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Common.hexpat"
|
||||
|
||||
enum Precipitation : u32 {
|
||||
Snow = 0x0,
|
||||
Rain = 0x1,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <std/math.pat>
|
||||
#include <std/core.pat>
|
||||
#include <std/io.pat>
|
||||
#include "FileBase.hexpat"
|
||||
#include "Common.hexpat"
|
||||
|
||||
using WrHeader;
|
||||
using WrCell;
|
||||
|
|
Loading…
Reference in New Issue