Rehost saved company year stat families
This commit is contained in:
parent
5ea2ce58b4
commit
cbf0dbeda5
5 changed files with 366 additions and 13 deletions
|
|
@ -3588,6 +3588,11 @@ const SAVE_COMPANY_RECORD_STAT_BAND_ROOT_0CFB_OFFSET: usize = 0x0cfb;
|
|||
const SAVE_COMPANY_RECORD_STAT_BAND_ROOT_0D7F_OFFSET: usize = 0x0d7f;
|
||||
const SAVE_COMPANY_RECORD_STAT_BAND_ROOT_1C47_OFFSET: usize = 0x1c47;
|
||||
const SAVE_COMPANY_RECORD_STAT_BAND_ROOT_WINDOW_LEN_DWORDS: usize = 32;
|
||||
const SAVE_COMPANY_RECORD_YEAR_STAT_FAMILY_QWORD_COUNT: usize =
|
||||
crate::runtime::RUNTIME_COMPANY_STAT_SLOT_COUNT as usize
|
||||
* crate::runtime::RUNTIME_COMPANY_YEAR_STAT_FAMILY_SPAN as usize;
|
||||
const SAVE_COMPANY_RECORD_SPECIAL_STAT_FAMILY_232A_QWORD_COUNT: usize =
|
||||
crate::runtime::RUNTIME_COMPANY_STAT_SLOT_COUNT as usize;
|
||||
const SAVE_COMPANY_RECORD_SCALAR_CANDIDATE_FIELDS: [(&str, usize); 9] = [
|
||||
("mutable_support_scalar", 0x4f),
|
||||
("young_company_support_scalar", 0x57),
|
||||
|
|
@ -3784,6 +3789,18 @@ fn parse_save_company_roster_probe(
|
|||
"stat_band_1c47",
|
||||
SAVE_COMPANY_RECORD_STAT_BAND_ROOT_WINDOW_LEN_DWORDS,
|
||||
)?;
|
||||
let year_stat_family_qword_bits = build_save_company_stat_qword_bits(
|
||||
bytes,
|
||||
record_offset,
|
||||
SAVE_COMPANY_RECORD_STAT_BAND_ROOT_0D7F_OFFSET,
|
||||
SAVE_COMPANY_RECORD_YEAR_STAT_FAMILY_QWORD_COUNT,
|
||||
)?;
|
||||
let special_stat_family_232a_qword_bits = build_save_company_stat_qword_bits(
|
||||
bytes,
|
||||
record_offset,
|
||||
SAVE_COMPANY_RECORD_STAT_BAND_ROOT_1C47_OFFSET,
|
||||
SAVE_COMPANY_RECORD_SPECIAL_STAT_FAMILY_232A_QWORD_COUNT,
|
||||
)?;
|
||||
entries.push(SmpLoadedCompanyRosterEntry {
|
||||
company_id,
|
||||
active,
|
||||
|
|
@ -3835,6 +3852,8 @@ fn parse_save_company_roster_probe(
|
|||
.iter()
|
||||
.map(runtime_company_stat_band_candidate_from_save)
|
||||
.collect(),
|
||||
year_stat_family_qword_bits,
|
||||
special_stat_family_232a_qword_bits,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
|
@ -3878,6 +3897,20 @@ fn build_save_company_stat_band_candidates(
|
|||
.collect::<Option<Vec<_>>>()
|
||||
}
|
||||
|
||||
fn build_save_company_stat_qword_bits(
|
||||
bytes: &[u8],
|
||||
record_offset: usize,
|
||||
root_offset: usize,
|
||||
qword_count: usize,
|
||||
) -> Option<Vec<u64>> {
|
||||
(0..qword_count)
|
||||
.map(|index| {
|
||||
let relative_offset = root_offset.checked_add(index.checked_mul(8)?)?;
|
||||
read_u64_at(bytes, record_offset + relative_offset)
|
||||
})
|
||||
.collect::<Option<Vec<_>>>()
|
||||
}
|
||||
|
||||
fn detect_save_company_record_start_offset(
|
||||
bytes: &[u8],
|
||||
header_probe: &SmpSaveTaggedCollectionHeaderProbe,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue