Rehost annual creditor pressure policy branch

This commit is contained in:
Jan Petykiewicz 2026-04-18 00:09:09 -07:00
commit 64fc4a8488
8 changed files with 739 additions and 17 deletions

View file

@ -133,6 +133,10 @@ const RT3_SAVE_WORLD_BLOCK_ISSUE_OPINION_TERM_COUNT: usize = 0x3b;
const RT3_SAVE_WORLD_BLOCK_CHAIRMAN_SLOT_SELECTOR_RELATIVE_OFFSET: usize = 0x83;
const RT3_SAVE_WORLD_BLOCK_CAMPAIGN_OVERRIDE_FLAG_RELATIVE_OFFSET: usize = 0xc1;
const RT3_SAVE_WORLD_BLOCK_CHAIRMAN_ROLE_GATE_RELATIVE_OFFSET: usize = 0x0bbf;
const RT3_SAVE_WORLD_BLOCK_STOCK_POLICY_RELATIVE_OFFSET: usize = 0x4a83;
const RT3_SAVE_WORLD_BLOCK_BOND_POLICY_RELATIVE_OFFSET: usize = 0x4a87;
const RT3_SAVE_WORLD_BLOCK_BANKRUPTCY_POLICY_RELATIVE_OFFSET: usize = 0x4a8b;
const RT3_SAVE_WORLD_BLOCK_DIVIDEND_POLICY_RELATIVE_OFFSET: usize = 0x4a8f;
const RT3_SAVE_WORLD_BLOCK_ECONOMIC_TUNING_MIRROR_RELATIVE_OFFSET: usize = 0x0bda;
const RT3_SAVE_WORLD_BLOCK_ECONOMIC_TUNING_PRIMARY_RELATIVE_OFFSETS: [usize; 6] =
[0x0bde, 0x0be2, 0x0be6, 0x0bea, 0x0bee, 0x0bf2];
@ -1572,6 +1576,14 @@ pub struct SmpSaveWorldFinanceNeighborhoodProbe {
pub current_calendar_tuple_word_2_lane: SmpSaveDwordCandidate,
pub absolute_counter_lane: SmpSaveDwordCandidate,
pub absolute_counter_mirror_lane: SmpSaveDwordCandidate,
pub stock_policy_raw_u8: u8,
pub stock_policy_raw_hex: String,
pub bond_policy_raw_u8: u8,
pub bond_policy_raw_hex: String,
pub bankruptcy_policy_raw_u8: u8,
pub bankruptcy_policy_raw_hex: String,
pub dividend_policy_raw_u8: u8,
pub dividend_policy_raw_hex: String,
pub dword_candidates: Vec<SmpSaveDwordCandidate>,
pub evidence: Vec<String>,
}
@ -2256,6 +2268,14 @@ pub struct SmpLoadedWorldFinanceNeighborhoodState {
pub absolute_counter_raw_hex: String,
pub absolute_counter_mirror_raw_u32: u32,
pub absolute_counter_mirror_raw_hex: String,
pub stock_policy_raw_u8: u8,
pub stock_policy_raw_hex: String,
pub bond_policy_raw_u8: u8,
pub bond_policy_raw_hex: String,
pub bankruptcy_policy_raw_u8: u8,
pub bankruptcy_policy_raw_hex: String,
pub dividend_policy_raw_u8: u8,
pub dividend_policy_raw_hex: String,
pub labels: Vec<String>,
pub relative_offsets: Vec<usize>,
pub relative_offset_hex: Vec<String>,
@ -3500,6 +3520,14 @@ fn derive_loaded_world_finance_neighborhood_state_from_probe(
absolute_counter_raw_hex: probe.absolute_counter_lane.raw_u32_hex.clone(),
absolute_counter_mirror_raw_u32: probe.absolute_counter_mirror_lane.raw_u32,
absolute_counter_mirror_raw_hex: probe.absolute_counter_mirror_lane.raw_u32_hex.clone(),
stock_policy_raw_u8: probe.stock_policy_raw_u8,
stock_policy_raw_hex: probe.stock_policy_raw_hex.clone(),
bond_policy_raw_u8: probe.bond_policy_raw_u8,
bond_policy_raw_hex: probe.bond_policy_raw_hex.clone(),
bankruptcy_policy_raw_u8: probe.bankruptcy_policy_raw_u8,
bankruptcy_policy_raw_hex: probe.bankruptcy_policy_raw_hex.clone(),
dividend_policy_raw_u8: probe.dividend_policy_raw_u8,
dividend_policy_raw_hex: probe.dividend_policy_raw_hex.clone(),
labels: probe
.dword_candidates
.iter()
@ -9100,6 +9128,22 @@ fn parse_save_world_finance_neighborhood_probe(
"absolute_calendar_counter_mirror",
RT3_SAVE_WORLD_BLOCK_ABSOLUTE_COUNTER_MIRROR_RELATIVE_OFFSET,
)?;
let stock_policy_raw_u8 = read_u8_at(
bytes,
payload_offset + RT3_SAVE_WORLD_BLOCK_STOCK_POLICY_RELATIVE_OFFSET,
)?;
let bond_policy_raw_u8 = read_u8_at(
bytes,
payload_offset + RT3_SAVE_WORLD_BLOCK_BOND_POLICY_RELATIVE_OFFSET,
)?;
let bankruptcy_policy_raw_u8 = read_u8_at(
bytes,
payload_offset + RT3_SAVE_WORLD_BLOCK_BANKRUPTCY_POLICY_RELATIVE_OFFSET,
)?;
let dividend_policy_raw_u8 = read_u8_at(
bytes,
payload_offset + RT3_SAVE_WORLD_BLOCK_DIVIDEND_POLICY_RELATIVE_OFFSET,
)?;
let dword_candidates =
build_save_world_finance_neighborhood_candidates(bytes, payload_offset)?;
@ -9119,6 +9163,14 @@ fn parse_save_world_finance_neighborhood_probe(
current_calendar_tuple_word_2_lane,
absolute_counter_lane,
absolute_counter_mirror_lane,
stock_policy_raw_u8,
stock_policy_raw_hex: format!("0x{stock_policy_raw_u8:02x}"),
bond_policy_raw_u8,
bond_policy_raw_hex: format!("0x{bond_policy_raw_u8:02x}"),
bankruptcy_policy_raw_u8,
bankruptcy_policy_raw_hex: format!("0x{bankruptcy_policy_raw_u8:02x}"),
dividend_policy_raw_u8,
dividend_policy_raw_hex: format!("0x{dividend_policy_raw_u8:02x}"),
dword_candidates,
evidence: vec![
format!(
@ -9133,6 +9185,13 @@ fn parse_save_world_finance_neighborhood_probe(
RT3_SAVE_WORLD_BLOCK_CURRENT_CALENDAR_TUPLE_WORD_2_RELATIVE_OFFSET,
RT3_SAVE_WORLD_BLOCK_ABSOLUTE_COUNTER_RELATIVE_OFFSET
),
format!(
"payload +0x{:x}/+0x{:x}/+0x{:x}/+0x{:x} carry the stock, bond, bankruptcy, and dividend finance-policy bytes mirrored from scenario offsets 0x4a87/0x4a8b/0x4a8f/0x4a93",
RT3_SAVE_WORLD_BLOCK_STOCK_POLICY_RELATIVE_OFFSET,
RT3_SAVE_WORLD_BLOCK_BOND_POLICY_RELATIVE_OFFSET,
RT3_SAVE_WORLD_BLOCK_BANKRUPTCY_POLICY_RELATIVE_OFFSET,
RT3_SAVE_WORLD_BLOCK_DIVIDEND_POLICY_RELATIVE_OFFSET
),
"finance-neighborhood candidates cover the fixed dword strip around the grounded world calendar tuple, absolute-counter, selection-context, and issue-0x37 lanes so broader finance reader closure can build on one rehosted owner surface.".to_string(),
],
});
@ -15868,6 +15927,10 @@ mod tests {
bytes[payload_offset + relative_offset..payload_offset + relative_offset + 4]
.copy_from_slice(&((index as u32) + 1).to_le_bytes());
}
bytes[payload_offset + RT3_SAVE_WORLD_BLOCK_STOCK_POLICY_RELATIVE_OFFSET] = 1;
bytes[payload_offset + RT3_SAVE_WORLD_BLOCK_BOND_POLICY_RELATIVE_OFFSET] = 2;
bytes[payload_offset + RT3_SAVE_WORLD_BLOCK_BANKRUPTCY_POLICY_RELATIVE_OFFSET] = 3;
bytes[payload_offset + RT3_SAVE_WORLD_BLOCK_DIVIDEND_POLICY_RELATIVE_OFFSET] = 4;
let next_chunk_offset = payload_offset + RT3_SAVE_WORLD_BLOCK_LEN;
bytes[next_chunk_offset..next_chunk_offset + 4]
.copy_from_slice(&RT3_SAVE_WORLD_BLOCK_NEXT_CHUNK_TAG.to_le_bytes());
@ -15897,6 +15960,14 @@ mod tests {
assert_eq!(probe.packed_year_word_raw_hex, "0x0001");
assert_eq!(probe.partial_year_progress_raw_u8, 0);
assert_eq!(probe.partial_year_progress_raw_hex, "0x00");
assert_eq!(probe.stock_policy_raw_u8, 1);
assert_eq!(probe.stock_policy_raw_hex, "0x01");
assert_eq!(probe.bond_policy_raw_u8, 2);
assert_eq!(probe.bond_policy_raw_hex, "0x02");
assert_eq!(probe.bankruptcy_policy_raw_u8, 3);
assert_eq!(probe.bankruptcy_policy_raw_hex, "0x03");
assert_eq!(probe.dividend_policy_raw_u8, 4);
assert_eq!(probe.dividend_policy_raw_hex, "0x04");
assert_eq!(probe.current_calendar_tuple_word_lane.value_i32, 1);
assert_eq!(
probe.current_calendar_tuple_word_2_lane.relative_offset_hex,