diff --git a/Cargo.toml b/Cargo.toml index 40e06b1..9896b6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "papers-tools" -version = "0.1.0" +version = "1.0.0" edition = "2021" authors = ["creepycode"] diff --git a/README.md b/README.md index 0a63379..233c167 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,73 @@ # Papers Tools -## Unpacking `Art.dat`: +## Unpacking `sharedassets0.assets`: ```bash -./papers-tools -i ./Art.dat -o ./out -g /path/to/game/dir +./papers-tools -g /path/to/steamapps/common/PapersPlease unpack ``` -## Packing a folder into the `Art.dat` format: +You can also pass the Art.dat file as the input directly. + +## Patching + +To overwrite textures, just put the new texture in the same path as the original one, with the same name. For example, +to replace the `RifleTranq.png` texture, put the new texture in `patch/assets/textures/RifleTranq.png`. +Editing xml files is also supported. The tool will merge your changes with the original file. Example for adding a new +paper (`patch/assets/data/Papers.xml`): + +```xml + + + + + + +``` + +for more information on the format, just check out the unpacked files. +Replacing audio files is also supported, but a separate json file is needed to map the original audio file to the new +one. Example (json path: `patch/audio_patches.json` audio path: `patch/audio/awp.fsb`): + +```json +[ + { + "objectName": "border-gunshot", + "patchedPath": "audio/awp.fsb", + "loadType": 0, + "channels": 2, + "frequency": 48000, + "bitsPerSample": 16, + "length": 4.642667, + "isTrackerFormat": false, + "subsoundIndex": 0, + "preloadAudioData": false, + "loadInBackground": false, + "legacy3d": true, + "compressionFormat": "adpcm" + } +] +``` + +Please note that the audio files need to be unity compatible fmod sound banks. Any other format will not work. + +To apply the patch, run: ```bash -./papers-tools -i ./dir -o Art-modded.dat -g /path/to/game/dir +./papers-tools -g /path/to/steamapps/common/PapersPlease patch -p patch ``` -The first folder will not be included in the asset names when packing. So make sure your folder structure is something like: -* `./dir/assets/some_texture.png` -* `./dir/assets/some_other_texture.png` -* `./dir/assets/fonts/some_font.fnt` +`-p patch` can be omitted if the patch is in the default path `patch`. + +## Reverting + +To revert the changes made by the patch, run: + +```bash +./papers-tools -g /path/to/steamapps/common/PapersPlease revert +``` + +For less common used commands, check the built-in help: + +```bash +./papers-tools -h +``` \ No newline at end of file diff --git a/src/command/patch/audio_patcher.rs b/src/command/patch/audio_patcher.rs index 29b421c..185a4fc 100644 --- a/src/command/patch/audio_patcher.rs +++ b/src/command/patch/audio_patcher.rs @@ -55,6 +55,7 @@ pub fn patch_audio(audio_patches_path: &PathBuf, game_dir: &PathBuf, repack_info .context("Failed to get parent directory of audio patches file")?; let mut offset = 0u64; + println!("Patching {} audio clips...", audio_patches.len()); for patch in &audio_patches { if patch.patched_path.extension() != Some(OsStr::new("fsb")) { anyhow::bail!("Only FSB files are supported for audio patches.");