nukeykt / NBlood

Reverse-engineered ports of Build games using EDuke32 engine technology and development principles (NBlood/Rednukem/PCExhumed)
598 stars 74 forks source link

[NBlood] Save games are not being loaded #791

Closed itaranto closed 4 months ago

itaranto commented 5 months ago

I stopped playing the game for a couple of months, installed the latest release r14007 and now save games are not being loaded.

OS: Arch Linux

Here's the logs:

 runtime  src|

(nblood:31148): Gtk-WARNING **: 23:48:57.383: Unable to locate theme engine in module_path: "adwaita",

(nblood:31148): Gtk-WARNING **: 23:48:57.383: Unable to locate theme engine in module_path: "adwaita",

(nblood:31148): Gtk-WARNING **: 23:48:57.385: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.385: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.385: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.386: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.386: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.386: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.386: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.387: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.387: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.387: Unable to locate theme engine in module_path: "murrine",

(nblood:31148): Gtk-WARNING **: 23:48:57.387: Unable to locate theme engine in module_path: "murrine",
 0.1797s INFO| Started at 2024-03-16 23:48:57.424
 0.1798s INFO| NBlood r14007[makepkg]-7382d5fa2
 0.1799s INFO| Built Mar 17 2024 02:32:03, GCC 13.2.1, 64-bit
 0.1799s INFO| Using directory /home/ignacio/
 0.1800s INFO| Using directory /home/ignacio/.config/nblood/
 0.1802s INFO| Using directory /usr/share/games/nblood/
 0.1823s INFO| CPU: AMD Ryzen 7 2700X Eight-Core Processor
 0.1824s INFO| Initializing SDL 2.30.1 (SDL-release-2.30.1-0-g5adbf3765)
 0.3145s INFO| Using 'wayland' video driver.
 3.4922s INFO| Using "nblood.pk3" as main game data file.
 3.4923s INFO| Using group file "autoload/blood-coagulated.zip".
 3.4936s INFO| Initializing OSD...
 3.4948s INFO| Initializing Build 3D engine
 3.4949s INFO| Initializing engine
 3.4953s INFO| Loading palettes
 3.4955s INFO| Loading translucency table
 3.4956s INFO| Loading gamma correction table
 3.4957s INFO| Creating standard color lookups
 3.4957s INFO| Loading tiles
 3.4985s INFO| Initialized 96.0M cache
 3.5048s INFO| Loading blood_widescreen.def
 3.5139s INFO| Loading blood.def
 3.9797s INFO| Definitions file "blood.def" loaded in 466 ms.
 3.9807s INFO| Loading cosine table
 3.9808s INFO| Initializing view subsystem
 3.9808s INFO| Initializing status bar
 3.9809s INFO| Initializing dynamic fire
 3.9839s INFO| Initializing weapon animations
 3.9843s INFO| There are 4 demo(s) in the loop
 3.9843s INFO| Loading control setup
 4.0148s INFO| Executing nblood_cvars.cfg
 4.0149s INFO| Initializing network users
 4.0516s INFO| Opened texturecache as cache file.
 4.0519s INFO| Mapped 262165240 byte texcache
 4.1340s INFO| Generating 3D meshes from voxel model data. This may take a while...
 5.3199s INFO| Generated 3D meshes for 744 voxels in 1185.76 ms.
 5.3205s INFO| Initializing sound system
10.1406s INFO| Waiting for network players!
10.1411s INFO|
10.1438s INFO| Loaded map hack file "maphacks/E1M1.MHK"
16.4434s INFO| Wrote nblood.cfg
16.4487s INFO| Wrote nblood_cvars.cfg
tmyqlfpir commented 5 months ago

Save file versions have been updated as of 13c6307154c4821af947e2d105ac422f747e130e, and previous save files are no longer compatible.

itaranto commented 5 months ago

Save file versions have been updated as of 13c6307, and previous save files are no longer compatible.

So, does this basically means I've lost all my saves?

Is there any way to migrate old saves?

tmyqlfpir commented 5 months ago

Unfortunately the struct sizes have changed since then, and unless you're comfortable with a hex editor it is unlikely to play them with the current build.

You're better off to remain with your old version.

itaranto commented 5 months ago

Unfortunately the struct sizes have changed since then, and unless you're comfortable with a hex editor it is unlikely to play them with the current build.

I could, actually. What do I need to do?

You're better off to remain with your old version.

Yes, I complied an older release, and the saves are working again.

tmyqlfpir commented 5 months ago

I could, actually. What do I need to do?

It depends on what version of save file, and what platform and if you're on x86 or x64.

If you can, could you start E5M3 and post a save file from the current version and the old version. I can compare and see.

itaranto commented 5 months ago

It depends on what version of save file, and what platform and if you're on x86 or x64.

I'm using version r13984 which is from a month ago. I choose this since the breaking change was introduced around 3 weeks ago.

I'm on x86_64.

If you can, could you start E5M3 and post a save file from the current version and the old version. I can compare and see.

Sure, here it is:

game0008.zip

tmyqlfpir commented 5 months ago

Here is the edited version

game0008.zip

It appears there is more than just changing version and adding two variables to the gGameOptions struct. I recommend staying with the older builds until you're finished those save games.

itaranto commented 5 months ago

Here is the edited version

game0008.zip

It appears there is more than just changing version and adding two variables to the gGameOptions struct. I recommend staying with the older builds until you're finished those save games.

I believe these kind of breaking changes must be mentioned, at the very least in the release description.

itaranto commented 5 months ago

You could also implement some sort of versioning for the save games, so that way you can support older save games. But I'm not familiar with this project so I won't delve into that.

tmyqlfpir commented 5 months ago

It could be implemented (like Raze does), but eventually when newer NoOne extensions are implemented, there won't be any easy way to convert older structures to newer one when a lot of the variables have been tweaked.

Versions are not changed very often (last change was over two years ago 0d184bb71beb9188a377c57c716e5ff61cabcdfd), and it's usually done when there has been new variables introduced in important structs like gGameOptions.

It is unlikely that this issue will be resolved.

Anyway, it is possible to hex edit the saves to be compatible as I made a mistake previously. There are two gGameOptions structs in the game save file.

First, update the game version byte (offset byte 0x04) to 0x69.

Then identify the first difficulty byte at the start (offset byte 0x07) and copy it twice like so

example

Then find the second copy of gGameOptions in the structure by searching the current map name (this should be located at offset 0x10)

Once you have found it, walk back 8 bytes to find the difficulty byte flag, and copy it another two times.

Here is a working save file that I converted. Hope this helps!

save convert.zip

itaranto commented 4 months ago

Anyway, it is possible to hex edit the saves to be compatible as I made a mistake previously. There are two gGameOptions structs in the game save file.

First, update the game version byte (offset byte 0x04) to 0x69.

Then identify the first difficulty byte at the start (offset byte 0x07) and copy it twice like so example

Then find the second copy of gGameOptions in the structure by searching the current map name (this should be located at offset 0x10)

Once you have found it, walk back 8 bytes to find the difficulty byte flag, and copy it another two times.

Here is a working save file that I converted. Hope this helps!

This worked. Thanks!