DCNick3 / ShinDataUtil

This is an utility for working with game files of Higurashi no Naku Koro ni and Kono Subarashii Sekai ni Shukufuku wo! Kibou no Meikyuu to Tsudoishi Boukenshata Plus (see branch konosuba) visual novels released for Nintendo Switch.
GNU General Public License v2.0
18 stars 4 forks source link

Fix rom building with folders #3

Closed TellowKrinkle closed 3 years ago

DCNick3 commented 3 years ago

Can you please describe what the bug was and how the fix works?

TellowKrinkle commented 3 years ago

Two bugs:

  1. Subfolders were getting negative sizes, resulting in assertion failures in the checked conversions from int to uint. This was because nameOffset did not already include currentOffset (as you can see from the fact that the code seeks to nameOffset + currentOffset, not nameOffset). Fixed by not subtracting currentOffset from nameOffset
  2. Folder offsets are from the start of the folder index, not the start of the file. You can see them being read from the start of the index in the folder reading code here. Fixed by subtracting the size of the header before writing folder offsets
DCNick3 commented 3 years ago

Cool, seems sane