JNechaevsky / international-doom

Small, functional and simple source ports, created with help, efforts and bits of code from people around the world.
https://jnechaevsky.github.io/inter-doom/
GNU General Public License v2.0
30 stars 2 forks source link

Hexen: crash on load game after death #116

Closed kitchen-ace closed 9 months ago

kitchen-ace commented 9 months ago

Can't reproduce but maybe you have an idea. Was playing this wad: https://www.doomworld.com/idgames/levels/hexen/a-c/cent092b

Saved, died shortly after, pressing spacebar to reload crashed:

P_SetupLevel: MAP01 ("CENTROMERE"), loaded in 5 ms.
P_SetupLevel: MAP02 ("THE AMBUSH POINT"), loaded in 4 ms.
Corrupt save game: Segment [104] failed alignment check

Note that I was still on MAP01.

After starting inter-hexen again the save worked fine, even after dying.


edit: OK got it to reproduce: start a new game with cent092b.wad and On Death Action set to "Last Save", quicksave, die, press space.

gdb doesn't give me anything useful.

JNechaevsky commented 9 months ago

Figured out, more or less. Looks likes, "Last save" is always using 1st save slot, matters no in which slot save was made. This leads to one of two possible problems:

JNechaevsky commented 9 months ago

Total kaboom 🤯, but should work fine now. Don't ask anything, save system in Hexen is a nightmare, like saving into temporal slot first and moving to normal one second. So, "on death action" should work properly with any save slot, not just first one.

Following case should also be fixed:

kitchen-ace commented 9 months ago

Total kaboom 🤯, but should work fine now.

Unfortunately still happening. You're right that it doesn't affect the first slot though.

Following case should also be fixed

That does work fine.

JNechaevsky commented 9 months ago

This is getting too annoying. After couple of attempts, I don't proceed any farther than either game is always trying to load first slot, or ignoring any slot at all. I'll try a bit more, but if nothing will changes, probably better to just remove this feature entirely as not working properly.

kitchen-ace commented 9 months ago

What's different about starting a new game right after you start the program and then loading it, vs. loading a game when no game is playing? Because if you do it the 2nd way, the load slot is changed:

I couldn't find a proper fix either. As a hack adding G_LoadGame(6); to the end of G_DoSaveGame here kind of works, though this makes it so "Default Action" still loads your last save too.

Anyhow if you can't figure it out no problem, though maybe just comment out the existing on-death action code so someone can try it again later.

kitchen-ace commented 9 months ago

What about adding GameLoadSlot = slot; to the end of G_SaveGame? Is that too much of a hack?

JNechaevsky commented 9 months ago

This seems to do the trick, thank you! ❤️ I was thinking to make a copy of saved slot to another one (8th), but this is silly. My only extra though is - what to do, if this slot will be deleted? But shouldn't be a problem though.

Any ways, should I add it now, or you have some extra plans for farther investigation? Will do as you say.

kitchen-ace commented 9 months ago

Any ways, should I add it now, or you have some extra plans for farther investigation? Will do as you say.

Go ahead and add it if you're happy with that as a solution. Figuring out that one line took me way longer than it should have, I don't wanna touch it again if I don't have to!

My only extra though is - what to do, if this slot will be deleted? But shouldn't be a problem though.

There is probably a way to check if the save file exists before loading it here right? I'll take a look at this another time.

JNechaevsky commented 9 months ago

Figuring out that one line took me way longer than it should have, I don't wanna touch it again if I don't have to!

To be honest - me neither. Burned couple of nerves trying to understand why "destination" (actual) slot was always returning 1st slot.

kitchen-ace commented 9 months ago

Hah! Add it now then and we'll deal with the case where the save game is deleted another time.

JNechaevsky commented 9 months ago

Sure thing! It's not that how-swappable like in Doom or Heretic, but it's working. No need to rush, it's a straight finish release line. I would like to release everything on 8th March, mostly because of nice joke and nice date... 😀

kitchen-ace commented 9 months ago

8th March

https://en.wikipedia.org/wiki/International_Women%27s_Day ?

JNechaevsky commented 9 months ago

Yep, it is.

kitchen-ace commented 9 months ago

Heh, I love it! OK, no new feature discussion until then, and hopefully no bugs either.

JNechaevsky commented 9 months ago

Yeah, though it's not the real "point of attention", I'll briefly mention it in the last line of DoomWorld post. Guess I'm... Ahem, too old and too adult for turning my personal fads into eye-catchers.

Thanks again for your correction. This gave me extra small boost of motivation, I'll try to experiment a little more, maybe there is even no need for introduced savename. Just need to don't break it again!