AnthonyMichaelTDM / DRG-Save-Editor

Rock and stone!
GNU General Public License v3.0
115 stars 17 forks source link

[Bug] - Can't change current season value #97

Closed Iveess closed 3 months ago

Iveess commented 4 months ago

Report

Describe the bug

When I tried to select which season I want to change in the editor, the list did not open and I can’t do anything (other season data I put manually). Skillisue

To Reproduce

Steps to reproduce the behavior:

  1. Open save file
  2. Press CTRL+R to reset my values from save
  3. Click on 'Season' list
  4. See that nothing happens

Expected behavior

A list of seasons available to choose from has opened.

Context

Save File

attached Backup file: Backup.zip

Environment

Checklist

wahlp commented 3 months ago

i get a parsing error on the v1.9.1 build, not even able to load the file you provided and reach the point where you can start changing values

simon-wg commented 3 months ago

I just looked into this a bit, and it's quite bad. The parsing error is due to no overclocks being unlocked, and I'm about to open a PR for it now.

However the major issue I found is that it appears the XP values for a season is not hardcoded as we've thought, we use a 169 bit offset for it right now, but his save file is exactly 48 bits from the season marker. Scrips have the same issue where we have it hardcoded to 209, but his are 88 bits from the marker.

I believe this issue also extends to blank cores, since I doubt he has 576495936675512320 blank cores added.

And those are only the ones I can find at a glance, so we might have to change the way we look for season xp and scrip values, to instead search for the first instance of 'XP' and 'Tokens' after the season marker.

simon-wg commented 3 months ago

100 might fix the season select issue if it's caused by a runtime error, and I think the issue with the offsets is caused by trying to edit a save with little progress in the season since the game appears to insert CountSeasonContentEnabled and CountSeasonContentDisabled between the season marker and the XP value at some point.

That or they have changed how the save files are structured with Update 5.

AnthonyMichaelTDM commented 3 months ago

48 and 88 were the offsets we used back before you could change seasons, perhaps this is an old save (hasn't been run in the most recent version of DRG)? either way we should figure out a mechanism for determining which offsets to use (perhaps the logic could be "if only 1 season is found, use legacy offsets")

simon-wg commented 3 months ago

Huh, didn't know that. But I've got a PR on the way that should find the offsets by searching for the XP and Token strings, so that should cover all our bases (unless GSG decide to increase the offset even more)

simon-wg commented 3 months ago

This solution should work in all cases since the amount of bytes between the key (xp/tokens) and the value should be constant.

AnthonyMichaelTDM commented 3 months ago

alr, I'll write some tests to validate that and then we can merge

AnthonyMichaelTDM commented 3 months ago

Huh, didn't know that. But I've got a PR on the way that should find the offsets by searching for the XP and Token strings, so that should cover all our bases (unless GSG decide to increase the offset even more)

right, and we can always change things again if that does happen

AnthonyMichaelTDM commented 3 months ago

this was partially fixed in #101 and should be fully fixed once #100 is ready