NiceneNerd / UKMM

A new mod manager for The Legend of Zelda: Breath of the Wild. Successor to BCML.
https://nicenenerd.github.io/UKMM/
GNU General Public License v3.0
169 stars 10 forks source link

Failed to convert BNP to UKMM mod (The Legend of Linkle Dialogue Mod) #190

Closed RevontuletCXVII closed 1 month ago

RevontuletCXVII commented 1 month ago

Error log:

Failed to convert BNP to UKMM mod

Caused by:
    0: Failed to unpack the_legend_of_linkle_dialogue_mod_ver118.bnp at `crates\uk-manager\src\bnp.rs@520:42`
    1: Failed to process texts log at `crates\uk-manager\src\bnp.rs@421:29`
    2: missing field `type` at line 864 column 10

I have tried unpacking it and repacking it using the packager in UKMM, it causes a crash when the game is loading.

ilonachan commented 1 month ago

I just started trying to work with this project today, so I could be wrong here. But digging through the code, I'm pretty sure the problem is that UKMM, through the msyt crate, does not understand text log files correctly.

Looking at the section of logs/texts.json where this error message comes up (I'm doing this for the NX version of the dialogue mod so my error location was different, 27:10 to be exact), it looks like this:

"Demo148_0_Text003": {
  "contents": [
    ...
    {
      "control": {
        "kind": "raw",
        "zero": {
          "four": {
            "field_1": 0
          }
        }
      } // < ERROR HERE: expected the "control" object to contain a "type" field
    },
    ...
  ]
},

And of course I have no big idea what any of this means, but this file should know. It's all defined through Serde, and "kind": "raw" means we get a RawControl (whatever that is).

The problem is that the "code" parsing this RawControl is wrong. Since I'm unfortunately not well-practiced with serde I'm not 100% sure what the expected structure would be, but I imagine it'd be sth like

"control": {
  "kind": "raw",
  "type": "zero",
  "four": {
    "field_1": 0
  }
}

This is, of course, not what we find in the real mod. Which does work properly in BCML, so this is a regression. It's very possible this entire problem is solved just by removing tag = "type" from the Serde annotation for RawControl, but if there are mods that use this other format instead then that would cause problems for those, and special handling for both cases would be needed.

EDIT: I just tested this change, and now it imports the mod correctly and everything seems to work flawlessly. Will be making a (very small) PR to https://github.com/NiceneNerd/msyt

NiceneNerd commented 1 month ago

I ran into quite a number of issues trying to update various dependencies and tweak stuff a while back, so for now I've reverted to the last pre-TOTK version of msyt until I can sort it all out for sure.

RevontuletCXVII commented 1 month ago

Will you be pushing a build with this reversion?

NiceneNerd commented 1 month ago

Yes, after finishing a couple other patches.