Skip to content

Conversation

@DerpingtonDerp
Copy link

This PR adds support to specify a purchase date in configs.app.ini.

Some games check using GetEarliestPurchaseUnixTime when the game was purchased to provide preorder bonus items.
The old logic will be used by default if no purchase_date has been specific in configs.app.ini.

@alex47exe
Copy link
Owner

May I ask first why it defaults to 4 days before launch? Can you make that configurable as well, or even add a third option like defaulting to a fixed date?

@alex47exe alex47exe requested a review from Copilot June 22, 2025 13:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for specifying a purchase date through the configuration file, enabling certain games to properly calculate preorder bonuses based on custom purchase timestamps.

  • Added a new "purchase_date" configuration key in the ini file.
  • Updated GetEarliestPurchaseUnixTime in steam_apps.cpp to use the parsed purchase date.
  • Implemented parse_purchase_date in settings_parser.cpp and added getter/setter functions in Settings.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

File Description
post_build/steam_settings.EXAMPLE/configs.app.EXAMPLE.ini Added a new purchase_date config entry with descriptive comments.
dll/steam_apps.cpp Modified GetEarliestPurchaseUnixTime to use the new purchase date from settings.
dll/settings_parser.cpp Introduced parse_purchase_date to parse and fallback on the purchase_date value.
dll/settings.cpp & dll/dll/settings.h Added getter and setter for purchase_date in the Settings class.
Comments suppressed due to low confidence (1)

post_build/steam_settings.EXAMPLE/configs.app.EXAMPLE.ini:17

  • [nitpick] Clarify if the empty default value is intended to trigger a fallback behavior and consider documenting the expected format and fallback logic more explicitly.
# default=

is >> std::get_time(&time, "%Y/%m/%d %H:%M:%S");

// if date is formatted incorrectly
if (is.fail()) {
Copy link

Copilot AI Jun 22, 2025

Choose a reason for hiding this comment

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

Consider adding a log warning here when parsing fails, to help with diagnosing misconfigured purchase dates.

Copilot uses AI. Check for mistakes.
@DerpingtonDerp
Copy link
Author

4 days before launch was the default value that was returned before adding this change.
Therefore the 4 days was chosen as a fallback when no specific purchase date has been set.
Important to not it is 4 days before the launch day, meaning if you start the game at 06/30/2025 10:00:00 it will return 06/26/2025 10:00:00 as the earliest purchase date. This is the logic that was always applied by the Goldberg emu for the GetEarliestPurchaseDate.
Adding another option for customizing the time shift from game launch would not be useful at all. Then you could just set the date of purchase itself and will always be the same and not change if you for example start the game at another day.

@alex47exe alex47exe closed this Jul 14, 2025
@alex47exe alex47exe reopened this Jul 26, 2025
@alex47exe alex47exe merged commit b5e71e8 into alex47exe:dev Jul 26, 2025
62 checks passed
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