* new config file overlay_hook_delay_sec.txt to control the initial delay for the overlay's renderer detector

* send the value of the `accept_overlay_invites` to settings_server too!
This commit is contained in:
otavepto 2024-03-05 22:45:36 +02:00 committed by otavepto
parent c50ac8fa71
commit 4d23a859f3
2 changed files with 33 additions and 10 deletions

View File

@ -275,6 +275,7 @@ public:
//overlay //overlay
bool disable_overlay = false; bool disable_overlay = false;
int overlay_hook_delay_sec = 5;
bool disable_overlay_achievement_notification = false; bool disable_overlay_achievement_notification = false;
bool disable_overlay_friend_notification = false; bool disable_overlay_friend_notification = false;
//warn people who use force_ settings //warn people who use force_ settings

View File

@ -1123,8 +1123,10 @@ static void parse_auto_accept_invite(class Settings *settings_client, Settings *
if (accept_any_invite) { if (accept_any_invite) {
PRINT_DEBUG("Auto accepting any overlay invitation\n"); PRINT_DEBUG("Auto accepting any overlay invitation\n");
settings_client->acceptAnyOverlayInvites(true); settings_client->acceptAnyOverlayInvites(true);
settings_server->acceptAnyOverlayInvites(true);
} else { } else {
settings_client->acceptAnyOverlayInvites(false); settings_client->acceptAnyOverlayInvites(false);
settings_server->acceptAnyOverlayInvites(false);
} }
} }
} }
@ -1155,6 +1157,35 @@ static void parse_ip_country(class Settings *settings_client, Settings *settings
} }
} }
// overlay_hook_delay_sec.txt
static void parse_overlay_hook_delay_sec(class Settings *settings_client, Settings *settings_server)
{
std::string auto_accept_list_path = Local_Storage::get_game_settings_path() + "overlay_hook_delay_sec.txt";
std::ifstream input( utf8_decode(auto_accept_list_path) );
if (input.is_open()) {
bool accept_any_invite = true;
consume_bom(input);
std::string line{};
std::getline( input, line );
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()) {
try {
auto delay_sec = std::stoi(line);
if (delay_sec >= 0) {
settings_client->overlay_hook_delay_sec = delay_sec;
settings_server->overlay_hook_delay_sec = delay_sec;
PRINT_DEBUG("Setting overlay hook delay to %i seconds\n", delay_sec);
}
} catch (...) {}
}
}
}
uint32 create_localstorage_settings(Settings **settings_client_out, Settings **settings_server_out, Local_Storage **local_storage_out) uint32 create_localstorage_settings(Settings **settings_client_out, Settings **settings_server_out, Local_Storage **local_storage_out)
{ {
std::string program_path = Local_Storage::get_program_path(); std::string program_path = Local_Storage::get_program_path();
@ -1348,19 +1379,12 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
} }
parse_dlc(settings_client, settings_server); parse_dlc(settings_client, settings_server);
parse_app_paths(settings_client, settings_server, program_path); parse_app_paths(settings_client, settings_server, program_path);
parse_leaderboards(settings_client, settings_server); parse_leaderboards(settings_client, settings_server);
parse_stats(settings_client, settings_server); parse_stats(settings_client, settings_server);
parse_depots(settings_client, settings_server); parse_depots(settings_client, settings_server);
parse_subscribed_groups(settings_client, settings_server); parse_subscribed_groups(settings_client, settings_server);
parse_installed_app_Ids(settings_client, settings_server); parse_installed_app_Ids(settings_client, settings_server);
parse_force_branch_name(settings_client, settings_server); parse_force_branch_name(settings_client, settings_server);
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_global_settings_path() + "subscribed_groups_clans.txt", settings_client, settings_server);
@ -1370,12 +1394,10 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
load_overlay_appearance(Local_Storage::get_game_settings_path() + "overlay_appearance.txt", settings_client, settings_server); load_overlay_appearance(Local_Storage::get_game_settings_path() + "overlay_appearance.txt", settings_client, settings_server);
parse_mods_folder(settings_client, settings_server, local_storage); parse_mods_folder(settings_client, settings_server, local_storage);
load_gamecontroller_settings(settings_client); load_gamecontroller_settings(settings_client);
parse_auto_accept_invite(settings_client, settings_server); parse_auto_accept_invite(settings_client, settings_server);
parse_ip_country(settings_client, settings_server); parse_ip_country(settings_client, settings_server);
parse_overlay_hook_delay_sec(settings_client, settings_server);
*settings_client_out = settings_client; *settings_client_out = settings_client;
*settings_server_out = settings_server; *settings_server_out = settings_server;