+ changed the behavior of GetCurrentBetaName() to comply with the docs, might break stuff

+ allow customizing the behavior via is_beta_branch.txt + force_branch_name.txt config files
This commit is contained in:
otavepto 2023-12-18 05:21:31 +02:00 committed by otavepto
parent fa8f594207
commit 6ed6a0a04b
5 changed files with 40 additions and 5 deletions

View File

@ -211,6 +211,10 @@ public:
bool assume_any_app_installed = true;
bool appIsInstalled(AppId_t appID);
//is playing on beta branch + current/forced branch name
bool is_beta_branch = false;
std::string current_branch_name = "public";
//controller
struct Controller_Settings controller_settings;
std::string glyphs_directory;

View File

@ -461,6 +461,7 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
bool disable_source_query = false;
bool disable_account_avatar = false;
bool achievement_bypass = false;
bool is_beta_branch = false;
int build_id = 10;
bool warn_forced = false;
@ -495,6 +496,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
disable_account_avatar = true;
} else if (p == "achievements_bypass.txt") {
achievement_bypass = true;
} else if (p == "is_beta_branch.txt") {
is_beta_branch = true;
} else if (p == "force_language.txt") {
int len = Local_Storage::get_file_data(steam_settings_path + "force_language.txt", language, sizeof(language) - 1);
if (len > 0) {
@ -567,6 +570,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
settings_server->http_online = steamhttp_online_mode;
settings_client->achievement_bypass = achievement_bypass;
settings_server->achievement_bypass = achievement_bypass;
settings_client->is_beta_branch = is_beta_branch;
settings_server->is_beta_branch = is_beta_branch;
if (local_save) {
settings_client->local_save = save_path;
@ -836,6 +841,29 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
}
}
{
std::string installed_apps_list_path = Local_Storage::get_game_settings_path() + "force_branch_name.txt";
std::ifstream input( utf8_decode(installed_apps_list_path) );
if (input.is_open()) {
consume_bom(input);
std::string line;
getline( input, line );
constexpr const char * const whitespaces = " \t\r\n";
size_t start = line.find_first_not_of(whitespaces);
size_t end = line.find_last_not_of(whitespaces);
line = start == end
? std::string()
: line.substr(start, end - start + 1);
if (!line.empty()) {
settings_client->current_branch_name = line;
settings_server->current_branch_name = line;
PRINT_DEBUG("Forcing current branch name to '%s'\n", line.c_str());
}
}
}
load_subscribed_groups_clans(local_storage->get_global_settings_path() + "subscribed_groups_clans.txt", settings_client, settings_server);
load_subscribed_groups_clans(Local_Storage::get_game_settings_path() + "subscribed_groups_clans.txt", settings_client, settings_server);

View File

@ -170,17 +170,17 @@ void Steam_Apps::RequestAppProofOfPurchaseKey( AppId_t nAppID )
}
// returns current beta branch name, 'public' is the default branch
// "true if the user is on a beta branch; otherwise, false"
// https://partner.steamgames.com/doc/api/ISteamApps
bool Steam_Apps::GetCurrentBetaName( char *pchName, int cchNameBufferSize )
{
PRINT_DEBUG("GetCurrentBetaName %i\n", cchNameBufferSize);
if (!pchName) return false;
if (sizeof("public") > cchNameBufferSize) {
return false;
if (pchName && cchNameBufferSize > settings->current_branch_name.size()) {
memcpy(pchName, settings->current_branch_name.c_str(), settings->current_branch_name.size());
}
memcpy(pchName, "public", sizeof("public"));
return true;
return settings->is_beta_branch;
}
// signal Steam that game files seems corrupt or missing

View File

@ -0,0 +1,2 @@
rename to: force_branch_name.txt and put the name of the branch on a single line that you wish to report to the game.
by default this is "public", you might want to look at is_beta_branch.EXAMPLE.txt

View File

@ -0,0 +1 @@
rename to: is_beta_branch.txt to tell the game that we're playing on a beta branch.