FanTranslatorsInternational / Kuriimu2

Kuriimu is a general purpose game translation project manager and toolkit for authors of fan translations and game mods.
GNU General Public License v3.0
311 stars 56 forks source link

Error in Backwards Lz77 Nintendo compression #161

Closed rmariotti closed 3 years ago

rmariotti commented 3 years ago

Game Name: Dragon Quest XI: Sugi Sarishi Toki o Motomete Console: 3DS Format extension(s): .pack (PACA) Type: archive

Bug details: There seem to be a bug in the Backwards Lz77 Nintendo compression extension: some of the files in Dragon Quest XI are compressed using this algorithm, decompressing them and re-compressing (without altering the content between the decompression and re-compression step) them causes the game to crash.

Also after:

  1. decompressing a file A (A -> A.uncompressed),
  2. compressing A.uncompressed (A.uncompressed -> A.recompressed),
  3. decompressing A.recompressed (A.recompressed -> A.recompressed.uncompressed),

the diff command shows that A.uncompressed != A.recompressed.uncompressed, so there is some data corruption; md5sum confirms this behavior. In Citra, injecting the re-compressed files (A.recompressed and A.recompressed.uncompressed), causes the game to crash. The original file (A) obviously works and so does the the decompressed file (A.decompressed), showing that the decompression algorithm works fine.

How to reproduce the bug OS: Devuan GNU/Linux 4.0 (similar to Debian 11.0) Kuriimu2 version: 1.2.1-977136631 Citra version: Canary 1979

Steps

  1. Use some tool to extract the 3DS romfs.
  2. Grab the RomFS/ui/title.pack file.
  3. Use Kuriimu2 to decompress it using the Backwards Lz77 Nintendo (I'll call the decompression output file title.decompressed from now on).
  4. Use Citra rom patching to load title.decompressed -> the game works as expected.
  5. Recompress title.decompressed (I'll call the compression output file title.recompressed from now on).
  6. Use Citra rom patching to load title.recompressed -> the game crashes before the title screen.

Bonus steps

  1. Decompress title.recompressed and compare the output of the decompression (title.recompressed.decompressed) with title.decompressed, md5sum and diff both shows that the files are different.
  2. Use Citra rom patching to load title.recompressed.decompressed -> the game crashes before the title screen.

Sample files (if possible): sample_files

onepiecefreak3 commented 3 years ago

The issue cannot be reproduced on the newest release 1.2.1 or any following dev build. Please use one of the named iterations of Kuriimu2 and try again. The issue will be closed in 2 days, if no further response is given.

onepiecefreak3 commented 3 years ago

The compression implementation does work as expected in the newest versions of Kuriimu2. Issue closed.