Skip to content

Commit

Permalink
implement XBLA title info fallback when querying unity
Browse files Browse the repository at this point in the history
  • Loading branch information
iliazeus committed May 2, 2023
1 parent 4a28b56 commit cb1f707
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iso2god"
version = "1.4.4"
version = "1.4.5"
description = "A tool to convert between Xbox 360 ISO and Games On Demand file formats"
repository = "https://github.com/iliazeus/iso2god-rs"
edition = "2021"
Expand Down
18 changes: 14 additions & 4 deletions src/unity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ pub enum TitleType {
#[serde(rename = "360")]
Xbox360,

#[serde(rename = "XBLA")]
Xbla,

Xbox1,
}

Expand All @@ -75,6 +78,7 @@ impl fmt::Display for TitleType {
match self {
Self::Xbox => write!(f, "Xbox title"),
Self::Xbox360 => write!(f, "Xbox 360 title"),
Self::Xbla => write!(f, "Xbox Live Arcade title"),
Self::Xbox1 => write!(f, "Xbox One title"),
}
}
Expand Down Expand Up @@ -128,11 +132,17 @@ impl Client {

let title_list = self.search(&title_id)?;

let title = title_list
let best_title = title_list
.items
.into_iter()
.find(|title| title.title_type == TitleType::Xbox360 && title.title_id == title_id);

Ok(title)
.filter(|t| t.title_id == title_id)
.filter(|t| t.title_type == TitleType::Xbox360 || t.title_type == TitleType::Xbla)
.min_by_key(|t| match t.title_type {
TitleType::Xbox360 => 0,
TitleType::Xbla => 1,
_ => 2,
});

Ok(best_title)
}
}

0 comments on commit cb1f707

Please sign in to comment.