Die4Ever / deus-ex-randomizer

Randomizer for Deus Ex
https://mods4ever.com
GNU General Public License v3.0
111 stars 12 forks source link

too many saves can cause issues #891

Open Die4Ever opened 2 months ago

Die4Ever commented 2 months ago

Voukras had 465 saves and making a new hardsave caused an older one to be overwritten (maybe specifically a save of the same map?).

We should:


function PerformSave()
{
    local DeusExRootWindow localRoot;
    local DeusExPlayer localPlayer;
    local int gameIndex;
    local String saveName;

    // Get the save index if this is an existing savegame
    gameIndex = int(lstGames.GetFieldValue(saveRowID, 4));

    // If gameIndex is -2, this is our New Save Game and we 
    // need to set gameIndex to 0, which is not a valid
    // gameIndex, in which case the DeusExGameEngine::SaveGame()
    // code will be kind and get us a new GameIndex (Really!
    // If you don't believe me, go look at the code!)

    if (gameIndex == -2)
        gameIndex = 0;

    saveName = editName.GetText();

    localPlayer   = player;
    localRoot     = root;

    localRoot.ClearWindowStack();
    localPlayer.SaveGame(gameIndex, saveName);
    localRoot.Show();
}

it uses save slot 0 to ask the game engine for an unused slot, but I think we could just search all the saves and find a slot ourselves in UnrealScript. For an example of looping through all saves see DXRVanilla\DeusEx\Classes\Player.uc::LoadLatestConfirmed()

MQDuck commented 2 months ago

This sounds like a bug I've had a few times, where new saves just overwrite the last one. It doesn't seem related to number of saves. There's always a save that causes it, and deleting that one particular save makes the problem go away. Narrowing down which one it is can be a big pain.