Render96 / Render96ex

Fork of https://github.com/sm64-port/sm64-port with additional features.
253 stars 44 forks source link

Green Keys not saving to/loading from save file correctly on Linux/macOS #7

Closed ghost closed 3 years ago

ghost commented 4 years ago

Describe the bug So it's a bit tricky to explain, but whenever I collect one of the green keys, it does not save correctly. It'll save the first key from Bobomb Battlefield, but no others. even if the first key I got wasn't from BoB.

If I edit the save file after compiling with "text saves", I can add in the amount of 1's needed to obtain all the keys, but saving a star or anything after that reverts it, where the save file only says 1, rather than how many zeroes.

Everything else saves just find, stars and caps, and the unlockable the keys unlock saves if I happen to save while that's active, but switching back requires editing the save or reobtaining the keys again.

This was tested on the previous stable 1.4.2, but within the SM64 Discord I and one other user can confirm this issue persists into the current 2.0 Alpha. We're not sure if this is a Linux only issue or what it is.

To Reproduce Steps to reproduce the behavior:

  1. Go to any level with one of the keys, Bob Omb Battlefield and the Secret Slide have two quick and easy ones.
  2. Pick up the key
  3. Quit the game, the keys autosave but saving with a star is optional
  4. Reload the game

Expected behavior You should have 2 Keys

Actual behavior You only have 1 key, regardless of the amount you had prior

Desktop (please complete the following information):

Additional context My version was built with the smlinux scripts, tested various configurations, including a vanilla Render96ex with no extra patches or cheats, and this issue persists within all of them.

GammaTendonNine commented 4 years ago

Results of My Testing on macOS

  1. The key do in fact save to the text save file correctly, immediately upon collection, including the specific level that it came from (e.g. keys = "1101000000" after collecting BOB, WF, & CCM keys).
  2. While the number of collected keys does appear to get loaded from the save file when relaunching the game (according to the source code), all keys reappear in game, and upon collection it overwrites the entire keys = string in the save file (e.g. keys = "1000000000" after relaunching the game and collecting the BOB key).

So as you said, when you reload the game you have to collect them all (again) and then unlock Luigi in a single run. If you unlock Luigi however, this will be saved and you will be Luigi when you reload the game, but will not be able to switch back to Mario via the Boo Hat until you've recollected all keys (or edit the save file manually).

I always assumed this was by design to facilitate the speedrun competitions that are put on in Discord, and the keys are saved to the save file to track the total to determine when to unlock Luigi/Mario during a single run. Let me confirm with @DorfDork and I can look into fixing the Luigi Key Loading/Saving functionality if that is the intended behavior.

@WandeingLagomorph793 It appears this issue is isolated to Linux/macOS, it is not the intended behavior, and I'm working on tracking down the root cause.

GammaTendonNine commented 3 years ago

This issue has been addressed with the latest Hotfix: https://discord.com/channels/727721825953513472/730551213376143431/779172409960955905