[NOT A BUG] Custom books can only be loaded from loose files
Posted: Wed Sep 23, 2020 3:47 pm
I suspect that to load binary files via unity textAsset it now needs to have the .bytes extension and DFU currently requires that books have a .txt extension, as books usually do. Doesn't affect vanilla books as they are loaded from files in arena2 folder, and doesn't affect loose files as they're also loaded from the files. Only files that load into text assets and they are extracted via textAsset.bytes on line 178 of BookReplacement.cs - I'm only guessing it's the extension because the binary files I use in the roads mod work fine that way.
This image shows the difference in values of the byte array that gets returned from File.ReadAllBytes(path) on the left and textAsset.bytes on the right.
This causes the number of pages to be read as far too high rather than the 6 it should be. (bytes 234 & 235)
@TheLacus, any ideas how this could be fixed? Can we change the extension required for custom books or is there a reason not to?
@Interkarma, is this some kind of localisation running before the text asset converts to byte array in unity - anything that could be disabled? Looks to me like the byte 210 is being replaced by 239,191,189 for some reason.
This image shows the difference in values of the byte array that gets returned from File.ReadAllBytes(path) on the left and textAsset.bytes on the right.
This causes the number of pages to be read as far too high rather than the 6 it should be. (bytes 234 & 235)
@TheLacus, any ideas how this could be fixed? Can we change the extension required for custom books or is there a reason not to?
@Interkarma, is this some kind of localisation running before the text asset converts to byte array in unity - anything that could be disabled? Looks to me like the byte 210 is being replaced by 239,191,189 for some reason.