SydMontague / DSCSTools

Modding tools for Digimon Story: Cyber Sleuth
BSD 3-Clause "New" or "Revised" License
38 stars 9 forks source link

[Bug Fix] Fix AFS2 archive to work with odd numbers of input files and filecounts < 2 #17

Closed Pherakki closed 2 years ago

Pherakki commented 2 years ago

Fixes two bugs: 1) DSCSTools would pack and extract files with an odd number of files inconsistently (padding was added to the fileID list on pack, no padding was assumed on extract), fixed on lines 94 and 116 of Pull Request 2) DSCSTools would incorrectly calculate the initial offset if the blocksize < 0x20, fixed on lines 39, 40 and 95, 96 of Pull Request

Additions on lines 39, 40 and 95, 96 only true if number of files <2: can modify these checks to check if the number of files is less than 2 instead, but maybe checking against the blocksize shows intent more clearly?

Edits tested in-game: AFS2 archives with 1 and 9 files both work correctly. Also extracted + repacked DSDBbgm.steam.mvgl; 100% byte reproducibility maintained from original code.