Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New saving/loading behaviors to fix bugs related to saving #73

Merged
merged 27 commits into from
Jan 9, 2023

Conversation

moonysolari
Copy link
Member

Tested with casual gameplay, both before and after restarting the game and Peacock.

New saving/loading behaviors

  • When saving,
    • The incoming data is checked against several criteria to reject unwanted requests.
    • Information about the saved sessions and the slot they correspond to are stored in a new field Saves in user profiles.
    • The contract session gets stored to a file in contractSessions. The filename is in the format of slot_token_sessionID.json.
  • When a save slot gets overwritten,
    • The Saves field of the user is updated with new information.
    • The file that keeps track of the overwritten session is deleted.
    • A new file is created for the newly stored session.
  • When loading,
    • Peacock will load any file with the given token and sessionID in the filename, ignoring the slot name.

Other changes

  • The list of SaveFiles received from /authentication/api/userchannel/ProfileService/UpdateUserSaveFileTable is correctly processed, such that the one with the latest timestamp is used instead of the last one in the list.
  • The naming convention of the files in contractSessions is changed. They now have the slot name prepended.
  • Several variable were renamed in components/databaseHandler.ts to avoid confusion. There were previously named sessionids but none of them were IDs of a session.
  • saveSession and loadSession were moved to components/profileHandler.ts.
  • Removed unused property PeacockCChild in user profiles.
  • Added some debug info for related functions.

Issues likely fixed (need testing)

  • Wrong token and sessionID saved when game saves #72 .
  • Any problem with loading an autosave, as their sessions were completely unsaved previously.
  • Save/load exploit to spam leaderboards with impossible time records.
  • Getting incorrect scoring and/or rating after loading a Peacock save.
  • Other issues related to saving/loading.

@moonysolari moonysolari added the saves Related to saving and loading. label Jan 9, 2023
@moonysolari moonysolari requested a review from RDIL January 9, 2023 09:33
@moonysolari moonysolari self-assigned this Jan 9, 2023
components/databaseHandler.ts Outdated Show resolved Hide resolved
components/eventHandler.ts Outdated Show resolved Hide resolved
components/eventHandler.ts Outdated Show resolved Hide resolved
components/eventHandler.ts Outdated Show resolved Hide resolved
components/profileHandler.ts Outdated Show resolved Hide resolved
components/profileHandler.ts Outdated Show resolved Hide resolved
components/profileHandler.ts Outdated Show resolved Hide resolved
components/types/types.ts Show resolved Hide resolved
@RDIL
Copy link
Member

RDIL commented Jan 9, 2023

Mainly just consistency stuff, but one nullability concern.

In general, we use new Error instead of Error, and have a space before and after if statements, unless it starts/ends a block.

moonysolari and others added 7 commits January 9, 2023 14:16
Co-authored-by: Reece Dunham <me@rdil.rocks>
Signed-off-by: moonysolari <118079569+moonysolari@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
Signed-off-by: moonysolari <118079569+moonysolari@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
Signed-off-by: moonysolari <118079569+moonysolari@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
Signed-off-by: moonysolari <118079569+moonysolari@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
Signed-off-by: moonysolari <118079569+moonysolari@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
Signed-off-by: moonysolari <118079569+moonysolari@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
Signed-off-by: moonysolari <118079569+moonysolari@users.noreply.github.com>
Copy link
Member

@RDIL RDIL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you've tested this already, so LGTM

@RDIL RDIL merged commit e548325 into thepeacockproject:v6 Jan 9, 2023
@moonysolari moonysolari deleted the saving branch January 10, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
saves Related to saving and loading.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

3 participants