Skip to content

Commit

Permalink
Fix lightfall support
Browse files Browse the repository at this point in the history
  • Loading branch information
cohaereo committed Jun 7, 2024
1 parent 33a62bf commit 9c7a022
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 32 deletions.
11 changes: 3 additions & 8 deletions src/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,9 @@ pub fn initialize_reference_names() {
destiny_pkg::PackageVersion::Destiny2Shadowkeep => REFERENCE_MAP_SK.clone(),
destiny_pkg::PackageVersion::Destiny2BeyondLight
| destiny_pkg::PackageVersion::Destiny2WitchQueen
| destiny_pkg::PackageVersion::Destiny2Lightfall => REFERENCE_MAP_BL.clone(),
_ => {
warn!(
"No reference table found for {:?}",
package_manager().version
);
Default::default()
}
| destiny_pkg::PackageVersion::Destiny2Lightfall
| destiny_pkg::PackageVersion::Destiny2TheFinalShape => REFERENCE_MAP_BL.clone(),
u => panic!("Unsupported game version {u:?} (initialize_reference_names)"),
};

references.extend(version_specific);
Expand Down
9 changes: 4 additions & 5 deletions src/tagtypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,17 @@ impl Display for TagType {

impl TagType {
pub fn from_type_subtype(t: u8, st: u8) -> TagType {
// TODO: Change this match to use ordered version checking after destiny-pkg 0.11
match package_manager().version {
PackageVersion::DestinyInternalAlpha => Self::from_type_subtype_devalpha(t, st),
PackageVersion::DestinyTheTakenKing => Self::from_type_subtype_ttk(t, st),
PackageVersion::DestinyRiseOfIron => Self::from_type_subtype_roi(t, st),
PackageVersion::Destiny2Shadowkeep => Self::from_type_subtype_sk(t, st),
PackageVersion::Destiny2BeyondLight
| PackageVersion::Destiny2WitchQueen
| PackageVersion::Destiny2Lightfall => Self::from_type_subtype_lf(t, st),
_ => TagType::Unknown {
ftype: t,
fsubtype: st,
},
| PackageVersion::Destiny2Lightfall
| PackageVersion::Destiny2TheFinalShape => Self::from_type_subtype_lf(t, st),
u => panic!("Unsupported game version {u:?} (TagType::from_type_subtype)"),
}
}

Expand Down
32 changes: 13 additions & 19 deletions src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,26 +364,20 @@ pub fn decode_text(data: &[u8], cipher: u16) -> String {
}

pub fn create_stringmap() -> anyhow::Result<StringCache> {
if matches!(
package_manager().version,
// TODO: Change this match to use ordered version checking after destiny-pkg 0.11
match package_manager().version {
PackageVersion::Destiny2Shadowkeep
| PackageVersion::Destiny2BeyondLight
| PackageVersion::Destiny2WitchQueen
| PackageVersion::Destiny2Lightfall
// cohae: Rise of Iron uses the same string format as D2
| PackageVersion::DestinyRiseOfIron
) {
create_stringmap_d2()
} else if package_manager().version == PackageVersion::DestinyTheTakenKing {
create_stringmap_d1()
} else if package_manager().version == PackageVersion::DestinyInternalAlpha {
create_stringmap_d1_devalpha()
} else {
warn!(
"{:?} does not support string loading",
package_manager().version
);
Ok(StringCache::default())
| PackageVersion::Destiny2BeyondLight
| PackageVersion::Destiny2WitchQueen
| PackageVersion::Destiny2Lightfall
| PackageVersion::Destiny2TheFinalShape
// cohae: Rise of Iron uses the same string format as D2
| PackageVersion::DestinyRiseOfIron => create_stringmap_d2(),
PackageVersion::DestinyTheTakenKing => create_stringmap_d1(),
PackageVersion::DestinyInternalAlpha => create_stringmap_d1_devalpha(),
u =>
panic!("Unsupported game version {u:?} (create_stringmap)")

}
}

Expand Down

0 comments on commit 9c7a022

Please sign in to comment.