squattingmonk/nasher

Mod_Entry_ Values Reset in module.ifo

Opened this issue · 3 comments

The start locations in the module.ifo file are reset when using nasher pack. From the troubleshooting I've done, it seems to be happening somewhere in the gffRootFromJson extension (not sure if that's the right term).

output.write(ifoJson.gffRootFromJson)

I inserted some logging statements to output the values from the json before this call, and they are still set correctly.

  ifoJson.postProcessJson
  ifoJson.truncateFloats
## Log entry x pos
  let entryX = $(ifoJson["Mod_Entry_X"]["value"].getFloat)
  info("Mod_Entry_X", entryX)
## Mode_Entry: 10
  output.write(ifoJson.gffRootFromJson)

I also redirected the output to a different file instead of overwriting the module.ifo that was converted from json upstream. The result was the module.ifo kept all the correct Mod_Entry_X, Mod_Entry_Y, Mod_Entry_Z and the Mod_Entry_Dir_* variables while the new ifo file had them reset to zero.

I couldn't figure out exactly where this is going wrong, but one thing I noticed is the Mod_Entry variables are the only floats in module.ifo.


For reference

  • OS: Ubuntu 22.04 (64-bit)
  • neverwinter: Cloned https://github.com/niv/neverwinter.nim and built
    • All the recent releases seemed to be 32-bit builds, even the ones named amd64
  • nwnsc 1.1.5
  • Nim Compiler Version 1.6.14 [Linux: amd64]

I have also seen this, but haven't been able to determine the cause yet. Going back to older versions of nim and neverwinter.nim didn't seem to fix it, but then when I went back to nim 1.6.14 and neverwinter.nim 1.5.9, suddenly I couldn't reproduce it anymore.

What version of nim are you using?

Edit: Sorry, reading is hard.

  • Nim Compiler Version 1.6.14 [Linux: amd64]

For what it's worth, I was able to reproduce the issue every time. I tried previous versions of neverwinter.nim, but that was mostly for the 32 vs 64bit issue I was having. I originally started on a windows machine (my gaming pc) but got annoyed and booted up a new linux vm.


I cloned the neverwinter.nim repo and built it locally. At the time I believe this would have been 1.6.0. I was having issues with the actual releases, in that they all seemed to be 32-bit which crashed with the large ints in the module I was working on. I see there's a newer version now.

What I ended up doing is reworking nasher's code a little to get past this. The original code converts the module.ifo file to json, updates it and then calls gffRootFromJson to overwrite the ifo file. I changed it so that the module.ifo.json file is opened instead and then the json file is overwritten, and then the jsonToGff function is called to overwrite the iso. I kind of like this better anyway, because now I'm getting the changes in git immediately instead of the next time I unpack the module.

Could be related to #110 ?

When I started digging into it, it was an error writing the module.ifo. I didn't go into the same level of depth as @ModifAmorphic though.