Suggestion: Store mod version number in savegame

Discuss modding questions and implementation details.
User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Suggestion: Store mod version number in savegame

Post by TheLacus »

jefetienne wrote: Mon Jun 08, 2020 11:23 pm
Jay_H wrote: Mon Jun 08, 2020 10:40 pm That actually already happens. I installed Advanced Teleportation on my main save, then disabled all mods and tried loading it again. The save is now bricked :lol:
Ouch :o

I could talk to Interkarma about looking into making a PR that just displays a pop-up warning upon loading a save with missing mods and/or mismatched versions/checksums.
The first thing is to store mods list into save data (i.e. an internal struct ModInfo and store List<ModInfo> into SaveData.txt when a save is created).

Code: Select all

{
        "FileName": "test",
        "Title": "test",
        "GUID": "",
        "Version": "",
        "Enabled": false,
        "LoadPriority": 3
},
If you want, feel free to work on it :)

User avatar
jefetienne
Posts: 170
Joined: Thu Jan 16, 2020 8:14 pm
Location: Gallomont, Wayrest
Contact:

Re: Suggestion: Store mod version number in savegame

Post by jefetienne »

TheLacus wrote: Mon Jun 08, 2020 11:34 pm The first thing is to store mods list into save data (i.e. an internal struct ModInfo and store List<ModInfo> into SaveData.txt when a save is created).

Code: Select all

{
        "FileName": "test",
        "Title": "test",
        "GUID": "",
        "Version": "",
        "Enabled": false,
        "LoadPriority": 3
},
If you want, feel free to work on it :)
Great, I'll get to it. :D
El jefe, Etienne
Nexus Mods | GitHub

User avatar
jefetienne
Posts: 170
Joined: Thu Jan 16, 2020 8:14 pm
Location: Gallomont, Wayrest
Contact:

Re: Suggestion: Store mod version number in savegame

Post by jefetienne »

TheLacus wrote: Mon Jun 08, 2020 11:34 pm If you want, feel free to work on it :)
How does this look?

Most of the code in done in SaveLoadManager. For now, I compare the saved "ModInfo_v1" in SaveData.txt by the currently enabled and loaded-in mods against its GUID. If it cannot find the a mod with the same GUID, then it will say "Mod is either not loaded or has been altered." If it does find it, then it will compare against versions, and display not only the incoming version but also the title, in case if that has also been changed. I demonstrate this with "(OLD) Test Mod" vs. "Test Mod" in the screenshots below.

I tried to format the text the way you wrote your mod dependency PR.

There is an issue with the scrollbar getting in the way of the first line of text, but I think that should be resolved as a separate PR just to extend the message box width a bit more.

menu.png
menu.png (188.12 KiB) Viewed 1536 times

Don't forget quickloading!

quickload.png
quickload.png (187 KiB) Viewed 1536 times
El jefe, Etienne
Nexus Mods | GitHub

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Suggestion: Store mod version number in savegame

Post by TheLacus »

It looks good! If you aren't already doing it, you can use ModManager.IsVersionLowerOrEqual() and show the warning only if a mod has been downgraded (or version format is unknown).

User avatar
jefetienne
Posts: 170
Joined: Thu Jan 16, 2020 8:14 pm
Location: Gallomont, Wayrest
Contact:

Re: Suggestion: Store mod version number in savegame

Post by jefetienne »

TheLacus wrote: Thu Jun 11, 2020 4:39 pm It looks good! If you aren't already doing it, you can use ModManager.IsVersionLowerOrEqual() and show the warning only if a mod has been downgraded (or version format is unknown).
Thanks for the info! I implemented the changes accordingly.

I can setup a PR now and tag you as a reviewer if you'd like.

EDIT: I removed the word 'mod' so it just says "Incoming version is older/different"
older.png
older.png (81.63 KiB) Viewed 1498 times
different.png
different.png (77.53 KiB) Viewed 1498 times
El jefe, Etienne
Nexus Mods | GitHub

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Suggestion: Store mod version number in savegame

Post by TheLacus »

jefetienne wrote: Thu Jun 11, 2020 9:14 pm I can setup a PR now and tag you as a reviewer if you'd like.
Sure, go ahead when you're ready. :)

User avatar
jefetienne
Posts: 170
Joined: Thu Jan 16, 2020 8:14 pm
Location: Gallomont, Wayrest
Contact:

Re: Suggestion: Store mod version number in savegame

Post by jefetienne »

TheLacus wrote: Mon Jun 15, 2020 8:51 pm Sure, go ahead when you're ready. :)
Created!
El jefe, Etienne
Nexus Mods | GitHub

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Suggestion: Store mod version number in savegame

Post by TheLacus »

Changed type from Sticky to Normal as topic has been addressed.

Post Reply