From c41c160338dc88dee8e0021e4a02bda273dc8a9f Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 28 Jun 2024 05:53:42 -0400 Subject: [PATCH] Fix oversight with u32 offsets used in index files API This breaks on Dawntrail's gigantic files, but this also breaks API... --- src/gamedata.rs | 2 +- src/index.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gamedata.rs b/src/gamedata.rs index 96e65d7..f4d4cf1 100755 --- a/src/gamedata.rs +++ b/src/gamedata.rs @@ -194,7 +194,7 @@ impl GameData { } /// Finds the offset inside of the DAT file for `path`. - pub fn find_offset(&mut self, path: &str) -> Option { + pub fn find_offset(&mut self, path: &str) -> Option { let slice = self.find_entry(path); match slice { Some((entry, chunk)) => { diff --git a/src/index.rs b/src/index.rs index 09b0060..71c4077 100755 --- a/src/index.rs +++ b/src/index.rs @@ -62,9 +62,9 @@ pub struct IndexHashTableEntry { #[bw(ignore)] pub data_file_id: u8, - #[br(calc = (data & !0xF) * 0x08)] + #[br(calc = (data & !0xF) as u64 * 0x08)] #[bw(ignore)] - pub offset: u32, + pub offset: u64, } // The only difference between index and index2 is how the path hash is stored. @@ -87,16 +87,16 @@ pub struct Index2HashTableEntry { #[bw(ignore)] pub data_file_id: u8, - #[br(calc = (data & !0xF) * 0x08)] + #[br(calc = (data & !0xF) as u64 * 0x08)] #[bw(ignore)] - pub offset: u32, + pub offset: u64, } #[derive(Debug)] pub struct IndexEntry { pub hash: u64, pub data_file_id: u8, - pub offset: u32, + pub offset: u64, } #[binrw]