SpikeHimself / XPortal

XPortal is a Valheim mod that lets you select a portal's destination from a list. XPortal is a complete rewrite of AnyPortal.
GNU General Public License v3.0
20 stars 6 forks source link

Latest version throws error, wont allow world to load. Reverting to .15 everything is OK. #68

Closed kmGaijin closed 1 year ago

kmGaijin commented 1 year ago

Describe the bug

[Error  : Unity Log] 09/11/2023 16:21:31: Exception while loading world C:/Users/Tim/AppData/LocalLow/IronGate/Valheim/worlds_local/HRPlaythrough.db:System.NullReferenceException: Object reference not set to an instance of an object
  at XPortal.Patches.ZDOMan_ConnectPortals.Postfix () [0x000f8] in <de0320a6adfa41e6b474e1fd8a07f9bc>:0
  at (wrapper dynamic-method) ZDOMan.DMD<ZDOMan::ConnectPortals>(ZDOMan)
  at (wrapper dynamic-method) ZDOMan.DMD<ZDOMan::Load>(ZDOMan,System.IO.BinaryReader,int)
  at ZNet.LoadWorld () [0x000cf] in <447b19510f604ca3807cd6cce3a7c1ef>:0

To Reproduce

Expected behaviour

Version

Environment Choose from the following options where you are experiencing the problem (leave only the ones you know about):

Priority

Additional information

kmGaijin commented 1 year ago

Was able to load a previous world and use ver .16.

SpikeHimself commented 1 year ago

Hi @kmGaijin thank you for reporting this.

Could you download the Debug release, enable Debug Logging, and then show me the error again with those?

You can find the Debug release here: https://github.com/SpikeHimself/XPortal/releases/download/v1.2.16/XPortal-debug-v1.2.16.zip

You can find a guide to enabling debug logging here: https://github.com/SpikeHimself/resources/wiki/BepInEx:-Enable-debug-logging

This way the error in your log file will be more verbose and hopefully help me find the cause.

p.s. you can just drag your LogOutput.log file onto your comment -- it will attach the file

kmGaijin commented 1 year ago

Loaded up debug version, enabled logging as instructed.

https://i.imgur.com/NvHoOjt.jpeg LogOutput.log

SpikeHimself commented 1 year ago

Thanks for that @kmGaijin, but it seems that your game still loaded up the "normal" XPortal dll. Are you sure your mod manager isn't replacing the .dll file from the debug release?

SpikeHimself commented 1 year ago

Regardless, I have a rough idea of why XPortal crashes. I created a new debug release, please test using this: XPortal-debug-1.2.17-issue68-01.zip

Please note that this version stops the game from crashing (at least, that's the aim), but it does not take away the root cause of the error. I don't know what that is, and I don't think it's related to XPortal.

When the game loads, XPortal fetches a list of all the portals in your world, so that it can restore their connections. However, in your case, one of those objects has an invalid ZDOID (that's the unique identifier that the game uses). This should be impossible in normal cases, and so my guess is that another mod is creating an issue at an earlier point.

kmGaijin commented 1 year ago

Hrm, redid everything, ensuring only the debug version of XPortal was installed. Same result. Here's the log file. LogOutput.log

kmGaijin commented 1 year ago

Sorry, didnt refresh page and didnt realized you posted a .17 debug. Need me to run it with that version?

SpikeHimself commented 1 year ago

Hi @kmGaijin, please ignore my previous comment, it was largely incorrect (your new logfile contained the information I was looking for!).

This new debug version should fix it, please let me know if that is the case:

XPortal-debug-1.2.17-issue68-02.zip

kmGaijin commented 1 year ago

Loaded cleanly.

LogOutput.log

kmGaijin commented 1 year ago

Where does XPortal store Portal name and destination info?

I had been having an issue where each time I logged out, all info was wiped for any portal that was not a standard vanilla wooden portal.

This is what I'm getting now. https://i.imgur.com/6JDq98h.jpeg

SpikeHimself commented 1 year ago

Hi @kmGaijin thanks for confirming, I will create a new hotfix release based on this ASAP. Thank you very much for your assistance and swift replies!

Where does XPortal store Portal name and destination info?

They are stored in the ZDO object using custom properties. The name/tag is stored in the "tag" property (equal to vanilla behaviour), the destination is stored in the custom "XPortal_TargetId" property.

These values are saved into your world file, this is done automatically by the game itself.

https://github.com/SpikeHimself/XPortal/blob/a1203c6d40ca344523c2702d02fc0e4ca1c782eb/XPortal/RPC/ServerEvents.cs#L40-L43

This is what I'm getting now. https://i.imgur.com/6JDq98h.jpeg

The weird text you're seeing suggests that the translation files didn't load. I can indeed confirm that your logfile does not mention them. This is most likely a result of you removing the original XPortal release and replacing it with the debug release (which ships without the translation files).

I'll finish up the 1.2.17 hotfix and I'll tag you again here when it's available. Give me a few minutes :)

kmGaijin commented 1 year ago

No problem. Glad I could help.

Thanks, Spike.

SpikeHimself commented 1 year ago

Hi @kmGaijin, v1.2.17 is now available in the usual places:

You can now delete the files that came from the debug releases. You can also disable debug logging again if you wish (leaving it on causes no harm).

kmGaijin commented 1 year ago

Thanks, Spike!