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.
[NOT A BUG] Custom books can only be loaded from loose files
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
[NOT A BUG] Custom books can only be loaded from loose files
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: [0.10.26] Custom books can only be loaded from loose files
Nothing changed as far as i know. Books must have .bytes extension (and always had to), for example BOK00000.TXT.bytes. Isn't this working?
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: [0.10.26] Custom books can only be loaded from loose files
I have always had my books with just the .TXT extension since I did them originally, not changed it since.
The mod docs at https://www.dfworkshop.net/projects/dag ... ing/books/ doesn't say this either.
EDIT: it does say at the top actually, I was looking at the file list at the bottom. Let me test this works. I thought it had to be just .TXT from the param
The mod docs at https://www.dfworkshop.net/projects/dag ... ing/books/ doesn't say this either.
EDIT: it does say at the top actually, I was looking at the file list at the bottom. Let me test this works. I thought it had to be just .TXT from the param
Code: Select all
<param name="name">Name of book including .TXT extension</param>
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: [NOT A BUG] Custom books can only be loaded from loose files
Oh if only everything were that simple. Apologies, I had never noticed that .bytes before and it worked fine in unity 2018.
Thanks TheLacus, note to self check documentation before spending an hour debugging the byte differences....
Thanks TheLacus, note to self check documentation before spending an hour debugging the byte differences....
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: [NOT A BUG] Custom books can only be loaded from loose files
I fixed the misleading example, thanks for pointing that out.
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: [NOT A BUG] Custom books can only be loaded from loose files
Great stuff. I still feel but that's the gig I guess..
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods