Skip to content

Conversation

@Archez
Copy link
Contributor

@Archez Archez commented Mar 8, 2023

When only an MQ rom is provided and a MQ save or rando save is created, then deleted, If you try to create a new rando save on top of the same deleted file slot, it will fail to be a rando save and fall back to a vanilla savefile.

This is due to a broken check during file creation that first checks for the quest mode to be rando, and then checks the filemetainfo to see if it relies on master quest. The check is broken as it compares requiresMasterQuest against both ResourceMgr_GameHasMasterQuest() and ResourceMgr_GameHasOriginal(). I think the intent of this check was to not allow a rando save be created if the spoiler log depended on a rom that isn't available.

The issue with this check is that the fileMetaInfo is not considered valid until after the save is created. So checking during save init is wrong as the values will not be correct. The reason why it seemed to work today is because on SoH launch, the fileMetaInfo is 0, and the check is broken so everything succeeds. And if a vanilla rom is provided, then again because of the broken check everything succeeds. Only when deleting a save and creating ontop with only a MQ rom does the issue arise, as deleting a save does not fully clear the fileMetaInfo.

This PR removes the broken check entirely as since fileMetaInfo is not valid until after the save is created, it can't be relied on. I updated the file delete method to at least clear out the requiresX properties of the fileMetaInfo just to reduce future headaches.

In my opinion, it is ok to remove this check. If someone loads a spoiler log that requires a rom they dont have, I think it makes more sense to allow the file to be created as expected and then grey it out, rather than turning it into a vanilla save unexpectedly.

Fixes #2595

For context, the broken check is the following

!((Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasMasterQuest()) ||
(Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasOriginal()))

VS what I think it was intended to be

!((Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasMasterQuest()) ||
(Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresOriginal && !ResourceMgr_GameHasOriginal()))

But as I said, we can't rely on the fileMetaInfo here anyways

Build Artifacts

@briaguya0 briaguya0 merged commit 7c558ae into HarbourMasters:develop-khan Mar 8, 2023
@Archez Archez deleted the fix-rando-save-create-only-mq branch March 8, 2023 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants