feat: display module for chunithm

Also make the progress bar all shiny
This commit is contained in:
2025-04-12 17:33:39 +00:00
parent 7db36b7bc0
commit 6270fce05f
17 changed files with 188 additions and 83 deletions

View File

@ -72,7 +72,7 @@ impl Profile {
mods: BTreeSet::new(),
sgt: Segatools::default_for(meta.game),
#[cfg(target_os = "windows")]
display: if meta.game == Game::Ongeki { Some(Display::default_for(meta.game)) } else { None },
display: Some(Display::default_for(meta.game)),
#[cfg(not(target_os = "windows"))]
display: None,
network: Network::default(),
@ -120,6 +120,9 @@ impl Profile {
if data.patches.is_none() {
data.patches = Some(PatchSelection(BTreeMap::new()));
}
if data.display.is_none() {
data.display = Some(Display::default_for(Game::Chunithm));
}
}
Ok(Profile {
@ -205,7 +208,7 @@ impl Profile {
pub async fn line_up(&self, pkg_hash: String, refresh: bool, _app: AppHandle) -> Result<()> {
let info = match &self.data.display {
None => None,
Some(display) => display.line_up()?
Some(display) => display.prepare()?
};
let res = self.line_up_the_rest(pkg_hash, refresh).await;
@ -238,6 +241,10 @@ impl Profile {
.map_err(|e| anyhow!("segatools configuration failed:\n{:?}", e))?;
self.data.network.line_up(&mut ini)?;
if let Some(display) = &self.data.display {
display.line_up(self.meta.game, &mut ini);
}
if let Some(keyboard) = &self.data.keyboard {
keyboard.line_up(&mut ini)?;
}
@ -305,24 +312,30 @@ impl Profile {
"INOHARA_CONFIG_PATH",
self.config_dir().join("inohara.cfg"),
)
.env(
"SAEKAWA_CONFIG_PATH",
self.config_dir().join("saekawa.toml"),
)
.current_dir(&exe_dir)
.args(["-d", "-k"])
.arg(sgt_dir.join(self.meta.game.hook_exe()))
.arg(self.meta.game.exe());
if let Some(display) = &self.data.display {
if display.dont_switch_primary && display.target != "default" {
game_builder.args(["-monitor", &display.monitor_index_override.unwrap_or_else(|| 1).to_string()]);
} else {
game_builder.args(["-monitor", "1"]);
}
game_builder.args([
"-screen-width", &display.rez.0.to_string(),
"-screen-height", &display.rez.1.to_string(),
"-screen-fullscreen", if display.mode == DisplayMode::Fullscreen { "1" } else { "0" }
]);
if display.mode == DisplayMode::Borderless {
game_builder.arg("-popupwindow");
if self.meta.game.has_module(ProfileModule::BepInEx) {
if let Some(display) = &self.data.display {
if display.dont_switch_primary && display.target != "default" {
game_builder.args(["-monitor", &display.monitor_index_override.unwrap_or_else(|| 1).to_string()]);
} else {
game_builder.args(["-monitor", "1"]);
}
game_builder.args([
"-screen-width", &display.rez.0.to_string(),
"-screen-height", &display.rez.1.to_string(),
"-screen-fullscreen", if display.mode == DisplayMode::Fullscreen { "1" } else { "0" }
]);
if display.mode == DisplayMode::Borderless {
game_builder.arg("-popupwindow");
}
}
}