From b17ecb3f3d107d3621bdb6ec4877db7f33d8174a Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Fri, 23 Aug 2024 12:08:57 +0100 Subject: [PATCH] Fix incorrect ending offsets for looping chunks --- patterns/db_files/chunks/BRLIST.hexpat | 3 ++- patterns/db_files/chunks/OBJ_MAP.hexpat | 3 ++- patterns/db_files/chunks/ScrModules.hexpat | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/patterns/db_files/chunks/BRLIST.hexpat b/patterns/db_files/chunks/BRLIST.hexpat index 49e3bcb..2191882 100644 --- a/patterns/db_files/chunks/BRLIST.hexpat +++ b/patterns/db_files/chunks/BRLIST.hexpat @@ -9,7 +9,8 @@ using BrMedia; using BrType; struct BrList { - Br brushes[while($ < brlist_toc.offset + brlist_toc.size)]; + u32 max = get_end(toc, parent.header.name); + Br brushes[while($ < max)]; }; // There's one core struct here, but fields are used differently for non-terrain brushes diff --git a/patterns/db_files/chunks/OBJ_MAP.hexpat b/patterns/db_files/chunks/OBJ_MAP.hexpat index 4e57cec..54d1d5f 100644 --- a/patterns/db_files/chunks/OBJ_MAP.hexpat +++ b/patterns/db_files/chunks/OBJ_MAP.hexpat @@ -9,5 +9,6 @@ struct ObjMapElement { }; struct ObjMap { - ObjMapElement objects[while($ < objmap_toc.offset + objmap_toc.size)]; + u32 max = get_end(toc, parent.header.name); + ObjMapElement objects[while($ < max)]; }; \ No newline at end of file diff --git a/patterns/db_files/chunks/ScrModules.hexpat b/patterns/db_files/chunks/ScrModules.hexpat index 4419b43..e46cb3b 100644 --- a/patterns/db_files/chunks/ScrModules.hexpat +++ b/patterns/db_files/chunks/ScrModules.hexpat @@ -9,6 +9,7 @@ namespace ScrModules { }; struct ChunkData { - Name names[while($ < scrmodules_toc.offset + scrmodules_toc.size)]; + u32 max = get_end(toc, parent.header.name); + Name names[while($ < max)]; }; } \ No newline at end of file