Skip to content

Commit

Permalink
Also load patch.rom file & patch directory for game assets
Browse files Browse the repository at this point in the history
  • Loading branch information
DCNick3 committed Mar 2, 2023
1 parent 97554e5 commit a3f6139
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions shin/assets/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Original umineko unpacked game data (can't really commit it...)
data
data.rom
patch.rom
saves
14 changes: 14 additions & 0 deletions shin/src/asset/locate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ fn try_assets_directory(path: &Path) -> anyhow::Result<Option<LayeredAssetIo>> {
}
let mut result = LayeredAssetIo::new();
// try to use "data" directory first and them data.rom file
if let Ok(patch_dir) = path.join("patch").canonicalize() {
trace!("Trying patch directory {:?}...", patch_dir);
match result.try_with_dir(&patch_dir) {
Ok(_) => trace!("Using patch directory {:?}", patch_dir),
Err(err) => trace!("Cannot use {:?} as assets directory: {}", path, err),
}
}
if let Ok(patch_rom) = path.join("patch.rom").canonicalize() {
trace!("Trying patch ROM {:?}...", patch_rom);
match result.try_with_rom(&patch_rom) {
Ok(_) => trace!("Using patch ROM {:?}", patch_rom),
Err(err) => trace!("Cannot use {:?} as assets directory: {}", path, err),
}
}
if let Ok(data_dir) = path.join("data").canonicalize() {
trace!("Trying data directory {:?}...", data_dir);
match result.try_with_dir(&data_dir) {
Expand Down

0 comments on commit a3f6139

Please sign in to comment.