use the new flags in the overlay
This commit is contained in:
parent
2fa2a9229c
commit
0b8e5cb283
@ -105,8 +105,14 @@ class Steam_Overlay
|
|||||||
bool show_achievements, show_settings;
|
bool show_achievements, show_settings;
|
||||||
void *fonts_atlas;
|
void *fonts_atlas;
|
||||||
|
|
||||||
bool disable_forced, local_save, warning_forced;
|
// disable input when force_*.txt file is used
|
||||||
uint32_t appid;
|
bool disable_user_input;
|
||||||
|
// warn when force_*.txt file is used
|
||||||
|
bool warn_forced_setting;
|
||||||
|
// warn when using local save
|
||||||
|
bool warn_local_save;
|
||||||
|
// warn when app ID = 0
|
||||||
|
bool warn_bad_appid;
|
||||||
|
|
||||||
char username_text[256];
|
char username_text[256];
|
||||||
std::atomic_bool save_settings;
|
std::atomic_bool save_settings;
|
||||||
|
@ -139,19 +139,16 @@ Steam_Overlay::Steam_Overlay(Settings* settings, SteamCallResults* callback_resu
|
|||||||
{
|
{
|
||||||
strncpy(username_text, settings->get_local_name(), sizeof(username_text));
|
strncpy(username_text, settings->get_local_name(), sizeof(username_text));
|
||||||
|
|
||||||
if (settings->warn_forced) {
|
// we need these copies to show the warning only once, then disable the flag
|
||||||
this->disable_forced = true;
|
// avoid manipulating settings->xxx
|
||||||
this->warning_forced = true;
|
this->warn_forced_setting =
|
||||||
} else {
|
!settings->disable_overlay_warning_any && !settings->disable_overlay_warning_forced_setting && settings->overlay_warn_forced_setting;
|
||||||
this->disable_forced = false;
|
this->warn_local_save =
|
||||||
this->warning_forced = false;
|
!settings->disable_overlay_warning_any && !settings->disable_overlay_warning_local_save && settings->overlay_warn_local_save;
|
||||||
}
|
this->warn_bad_appid =
|
||||||
|
!settings->disable_overlay_warning_any && !settings->disable_overlay_warning_bad_appid && settings->get_local_game_id().AppID() == 0;
|
||||||
|
|
||||||
if (settings->warn_local_save) {
|
this->disable_user_input = this->warn_forced_setting;
|
||||||
this->local_save = true;
|
|
||||||
} else {
|
|
||||||
this->local_save = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
current_language = 0;
|
current_language = 0;
|
||||||
const char *language = settings->get_language();
|
const char *language = settings->get_language();
|
||||||
@ -1134,21 +1131,17 @@ void Steam_Overlay::OverlayProc()
|
|||||||
|
|
||||||
ImGui::Text(translationUsername[current_language]);
|
ImGui::Text(translationUsername[current_language]);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::InputText("##username", username_text, sizeof(username_text), disable_forced ? ImGuiInputTextFlags_ReadOnly : 0);
|
ImGui::InputText("##username", username_text, sizeof(username_text), disable_user_input ? ImGuiInputTextFlags_ReadOnly : 0);
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::Text(translationLanguage[current_language]);
|
ImGui::Text(translationLanguage[current_language]);
|
||||||
|
ImGui::ListBox("##language", ¤t_language, valid_languages, sizeof(valid_languages) / sizeof(char *), 7);
|
||||||
if (ImGui::ListBox("##language", ¤t_language, valid_languages, sizeof(valid_languages) / sizeof(char *), 7)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Text(translationSelectedLanguage[current_language], valid_languages[current_language]);
|
ImGui::Text(translationSelectedLanguage[current_language], valid_languages[current_language]);
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if (!disable_forced) {
|
if (!disable_user_input) {
|
||||||
ImGui::Text(translationRestartTheGameToApply[current_language]);
|
ImGui::Text(translationRestartTheGameToApply[current_language]);
|
||||||
if (ImGui::Button(translationSave[current_language])) {
|
if (ImGui::Button(translationSave[current_language])) {
|
||||||
save_settings = true;
|
save_settings = true;
|
||||||
@ -1181,22 +1174,22 @@ void Steam_Overlay::OverlayProc()
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool show_warning = (local_save & !settings->disable_overlay_warning) || warning_forced || appid == 0;
|
bool show_warning = warn_local_save || warn_forced_setting || warn_bad_appid;
|
||||||
if (show_warning) {
|
if (show_warning) {
|
||||||
ImGui::SetNextWindowSizeConstraints(ImVec2(ImGui::GetFontSize() * 32, ImGui::GetFontSize() * 32), ImVec2(8192, 8192));
|
ImGui::SetNextWindowSizeConstraints(ImVec2(ImGui::GetFontSize() * 32, ImGui::GetFontSize() * 32), ImVec2(8192, 8192));
|
||||||
ImGui::SetNextWindowFocus();
|
ImGui::SetNextWindowFocus();
|
||||||
if (ImGui::Begin(translationWarning[current_language], &show_warning)) {
|
if (ImGui::Begin(translationWarning[current_language], &show_warning)) {
|
||||||
if (appid == 0) {
|
if (warn_bad_appid) {
|
||||||
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
||||||
ImGui::TextWrapped(translationWarningDescription2[current_language]);
|
ImGui::TextWrapped(translationWarningDescription2[current_language]);
|
||||||
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
||||||
}
|
}
|
||||||
if (local_save) {
|
if (warn_local_save) {
|
||||||
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
||||||
ImGui::TextWrapped(translationWarningDescription3[current_language]);
|
ImGui::TextWrapped(translationWarningDescription3[current_language]);
|
||||||
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
||||||
}
|
}
|
||||||
if (warning_forced) {
|
if (warn_forced_setting) {
|
||||||
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
||||||
ImGui::TextWrapped(translationWarningDescription4[current_language]);
|
ImGui::TextWrapped(translationWarningDescription4[current_language]);
|
||||||
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
ImGui::TextColored(ImVec4(255, 0, 0, 255), translationWarningWarningWarning[current_language]);
|
||||||
@ -1204,7 +1197,7 @@ void Steam_Overlay::OverlayProc()
|
|||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
if (!show_warning) {
|
if (!show_warning) {
|
||||||
local_save = warning_forced = false;
|
warn_local_save = warn_forced_setting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1327,8 +1320,6 @@ void Steam_Overlay::RunCallbacks()
|
|||||||
save_settings = false;
|
save_settings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
appid = settings->get_local_game_id().AppID();
|
|
||||||
|
|
||||||
i_have_lobby = IHaveLobby();
|
i_have_lobby = IHaveLobby();
|
||||||
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
|
||||||
std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i)
|
std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user