Skip to content

Commit dff6ce0

Browse files
committed
strings: Skip FNV1_BASE hashes
1 parent 43f971f commit dff6ce0

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

crates/strings/src/localized.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ use std::ops::Deref;
66
use std::slice::Iter;
77

88
use binrw::{BinRead, BinReaderExt, BinResult, Endian, VecArgs};
9-
use log::error;
9+
use log::{error, warn};
10+
use quicktag_core::util::FNV1_BASE;
1011
use rustc_hash::{FxHashMap, FxHashSet};
1112
use tiger_pkg::{DestinyVersion, GameVersion, MarathonVersion, TagHash, package_manager};
1213

@@ -476,6 +477,13 @@ pub fn create_stringmap_d2() -> anyhow::Result<StringCache> {
476477
}
477478
}
478479

480+
if *hash == FNV1_BASE {
481+
if !final_string.is_empty() {
482+
warn!("String '{final_string}' has an empty hash (0x{FNV1_BASE:X})");
483+
}
484+
continue;
485+
}
486+
479487
tmp_map.entry(*hash).or_default().insert(final_string);
480488
}
481489
}
@@ -529,6 +537,13 @@ pub fn create_stringmap_d1() -> anyhow::Result<StringCache> {
529537
final_string += &decode_text(&data, part.cipher_shift);
530538
}
531539

540+
if *hash == FNV1_BASE {
541+
if !final_string.is_empty() {
542+
warn!("String '{final_string}' has an empty hash (0x{FNV1_BASE:X})");
543+
}
544+
continue;
545+
}
546+
532547
tmp_map.entry(*hash).or_default().insert(final_string);
533548
}
534549
}
@@ -588,6 +603,13 @@ pub fn create_stringmap_d1_devalpha() -> anyhow::Result<StringCache> {
588603
final_string += &String::from_utf16_lossy(&data);
589604
}
590605

606+
if *hash == FNV1_BASE {
607+
if !final_string.is_empty() {
608+
warn!("String '{final_string}' has an empty hash (0x{FNV1_BASE:X})");
609+
}
610+
continue;
611+
}
612+
591613
tmp_map.entry(*hash).or_default().insert(final_string);
592614
}
593615
}
@@ -650,6 +672,13 @@ pub fn create_stringmap_d1_firstlook() -> anyhow::Result<StringCache> {
650672
final_string += &String::from_utf16(&data_u16)?;
651673
}
652674

675+
if *hash == FNV1_BASE {
676+
if !final_string.is_empty() {
677+
warn!("String '{final_string}' has an empty hash (0x{FNV1_BASE:X})");
678+
}
679+
continue;
680+
}
681+
653682
tmp_map.entry(*hash).or_default().insert(final_string);
654683
}
655684
}

0 commit comments

Comments
 (0)