Add achievements display to overlay and ability to change some settings.

This commit is contained in:
Mr_Goldberg
2022-08-05 02:09:43 -04:00
parent c17fb0c931
commit 5e880cd974
11 changed files with 411 additions and 36 deletions

View File

@ -180,10 +180,13 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
}
}
bool local_save = false;
{
char array[33] = {};
if (Local_Storage::get_file_data(program_path + "local_save.txt", array, sizeof(array) - 1) != -1) {
save_path = program_path + Settings::sanitize(array);
local_save = true;
}
}
@ -263,6 +266,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
bool disable_lobby_creation = false;
int build_id = 10;
bool warn_forced = false;
{
std::string steam_settings_path = Local_Storage::get_game_settings_path();
@ -279,22 +284,32 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
disable_lobby_creation = 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) language[len] = 0;
if (len > 0) {
language[len] = 0;
warn_forced = true;
}
} else if (p == "force_steamid.txt") {
char steam_id_text[32] = {};
if (Local_Storage::get_file_data(steam_settings_path + "force_steamid.txt", steam_id_text, sizeof(steam_id_text) - 1) > 0) {
CSteamID temp_id = CSteamID((uint64)std::atoll(steam_id_text));
if (temp_id.IsValid()) {
user_id = temp_id;
warn_forced = true;
}
}
} else if (p == "force_account_name.txt") {
int len = Local_Storage::get_file_data(steam_settings_path + "force_account_name.txt", name, sizeof(name) - 1);
if (len > 0) name[len] = 0;
if (len > 0) {
name[len] = 0;
warn_forced = true;
}
} else if (p == "force_listen_port.txt") {
char array_port[10] = {};
int len = Local_Storage::get_file_data(steam_settings_path + "force_listen_port.txt", array_port, sizeof(array_port) - 1);
if (len > 0) port = std::stoi(array_port);
if (len > 0) {
port = std::stoi(array_port);
warn_forced = true;
}
} else if (p == "build_id.txt") {
char array_id[10] = {};
int len = Local_Storage::get_file_data(steam_settings_path + "build_id.txt", array_id, sizeof(array_id) - 1);
@ -317,6 +332,10 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
settings_server->disable_lobby_creation = disable_lobby_creation;
settings_client->build_id = build_id;
settings_server->build_id = build_id;
settings_client->warn_forced = warn_forced;
settings_server->warn_forced = warn_forced;
settings_client->warn_local_save = local_save;
settings_server->warn_local_save = local_save;
{
std::string dlc_config_path = Local_Storage::get_game_settings_path() + "DLC.txt";
@ -571,3 +590,9 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
return appid;
}
void save_global_settings(Local_Storage *local_storage, char *name, char *language)
{
local_storage->store_data_settings("account_name.txt", name, strlen(name));
local_storage->store_data_settings("language.txt", language, strlen(language));
}