Invert analog + mapper save versioning #275

Merged
ahnada merged 4 commits from asc into master 2024-01-31 23:40:22 +03:00
ahnada commented 2023-12-16 08:48:06 +03:00 (Migrated from github.com)

Implements issue #51.

Also added save versioning so people won't lose their configuration on upgrade.

Implements issue #51. Also added save versioning so people won't lose their configuration on upgrade.
decafcode commented 2023-12-26 18:16:52 +03:00 (Migrated from github.com)

Looks okay to me. The versioning problem seems a bit tricky, I maybe wouldn't try to stuff a magic FourCC at the start of the file, instead I would use a different file name that doesn't contain a version in the file name, and define a new format for that new-style file. If geninput is asked to load its config, check for an old-style config file and if it loads one then write out a migrated new file.

Of course, it's more work to do it that way. Up to you which direction you choose to go, of course.

Looks okay to me. The versioning problem seems a bit tricky, I maybe wouldn't try to stuff a magic FourCC at the start of the file, instead I would use a different file name that doesn't contain a version in the file name, and define a new format for that new-style file. If geninput is asked to load its config, check for an old-style config file and if it loads one then write out a migrated new file. Of course, it's more work to do it that way. Up to you which direction you choose to go, of course.
ahnada commented 2023-12-28 09:43:52 +03:00 (Migrated from github.com)

Added code to read from the old saves but write out to a new filename without the version string appended.

Also here are some concerns that were brought up on Discord:

  • People might downgrade versions and the new FourCC might cause the program to immediately crash
    • The old code does treat the FourCC is a count and the loading code will soon try to read in a ridiculously large string (1+ gb in my test). Luckily either the allocation will fail or the subsequent fread fails, and the program will happily abort the load and start clean.
  • Loader for the new format should check the version field and only load versions >= 1
    • The loader already knows how to correctly read the old version files so I didn't really see a point to this. If people want to rename old saves to the new filename or new saves to the old filename, the program will properly parse it.
  • Make a copy of the current config as a ".back" before any upgrades
    • The new saves are using a new filename and it doesn't delete the old files.
Added code to read from the old saves but write out to a new filename without the version string appended. Also here are some concerns that were brought up on Discord: - People might downgrade versions and the new FourCC might cause the program to immediately crash - The old code does treat the FourCC is a count and the loading code will soon try to read in a ridiculously large string (1+ gb in my test). Luckily either the allocation will fail or the subsequent fread fails, and the program will happily abort the load and start clean. - Loader for the new format should check the version field and only load versions >= 1 - The loader already knows how to correctly read the old version files so I didn't really see a point to this. If people want to rename old saves to the new filename or new saves to the old filename, the program will properly parse it. - Make a copy of the current config as a ".back" before any upgrades - The new saves are using a new filename and it doesn't delete the old files.
icex2 commented 2024-01-21 15:55:33 +03:00 (Migrated from github.com)

lgtm, what do you think @decafcode ?

lgtm, what do you think @decafcode ?
icex2 commented 2024-01-31 23:40:17 +03:00 (Migrated from github.com)

lgtm, what do you think @decafcode ?

Talked to him and he said "it's fine"

> lgtm, what do you think @decafcode ? Talked to him and he said "it's fine"
Sign in to join this conversation.