From cba49807049a3b996bdc028e3f370039bbdf2949 Mon Sep 17 00:00:00 2001 From: Delta <46466697+DeltaGW2@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:43:00 +0200 Subject: [PATCH 1/7] change QA offset to dragslider --- src/GUI/Widgets/Options/COptionsWindow.cpp | 3 ++- src/GUI/Widgets/QuickAccess/QuickAccess.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GUI/Widgets/Options/COptionsWindow.cpp b/src/GUI/Widgets/Options/COptionsWindow.cpp index 4458dcf..5ca7a80 100644 --- a/src/GUI/Widgets/Options/COptionsWindow.cpp +++ b/src/GUI/Widgets/Options/COptionsWindow.cpp @@ -163,8 +163,9 @@ namespace GUI ImGui::EndCombo(); } + ImGui::Text(Language.Translate("((000051))")); - if (ImGui::InputFloat2("##qaoffset", (float*)&QuickAccess::Offset)) + if (ImGui::DragFloat2("##qaoffset", (float*)&QuickAccess::Offset, 1.0f, ((int)Renderer::Height) * -1, (int)Renderer::Height)) { Settings::Settings[OPT_QAOFFSETX] = QuickAccess::Offset.x; Settings::Settings[OPT_QAOFFSETY] = QuickAccess::Offset.y; diff --git a/src/GUI/Widgets/QuickAccess/QuickAccess.cpp b/src/GUI/Widgets/QuickAccess/QuickAccess.cpp index dca6180..603679d 100644 --- a/src/GUI/Widgets/QuickAccess/QuickAccess.cpp +++ b/src/GUI/Widgets/QuickAccess/QuickAccess.cpp @@ -35,7 +35,7 @@ namespace GUI bool AlwaysShow = false; bool VerticalLayout = false; EQAPosition Location = EQAPosition::Extend; - ImVec2 Offset = ImVec2(((size + 1) * Renderer::Scaling) * 9, 0.0f); + ImVec2 Offset = ImVec2(0, 0); Texture* IconNotification = nullptr; From 7408288ffb5cc984a52088e78c5beb69467ebc66 Mon Sep 17 00:00:00 2001 From: Delta <46466697+DeltaGW2@users.noreply.github.com> Date: Tue, 23 Apr 2024 18:09:10 +0200 Subject: [PATCH 2/7] fix config saving --- src/GUI/Widgets/Addons/AddonItem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GUI/Widgets/Addons/AddonItem.cpp b/src/GUI/Widgets/Addons/AddonItem.cpp index 6e2a348..57850e9 100644 --- a/src/GUI/Widgets/Addons/AddonItem.cpp +++ b/src/GUI/Widgets/Addons/AddonItem.cpp @@ -159,6 +159,7 @@ namespace GUI CtxMenuBullet->Resource, CtxMenuHighlight->Resource, ImVec2(btnWidth * ImGui::GetFontSize(), btnHeight))) { aAddon->IsPausingUpdates = !aAddon->IsPausingUpdates; + Loader::SaveAddonConfig(); } ImGui::Separator(); From 7044205d713b5535afac5b74826f8afca896a539 Mon Sep 17 00:00:00 2001 From: Delta <46466697+DeltaGW2@users.noreply.github.com> Date: Tue, 23 Apr 2024 22:54:10 +0200 Subject: [PATCH 3/7] fix crash when importing arc settings --- src/CrashHandler.cpp | 2 +- src/GUI/GUI.cpp | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/CrashHandler.cpp b/src/CrashHandler.cpp index afd6e2e..1e2d50e 100644 --- a/src/CrashHandler.cpp +++ b/src/CrashHandler.cpp @@ -30,7 +30,7 @@ void create_minidump(struct _EXCEPTION_POINTERS* apExceptionInfo) LONG WINAPI UnhandledExcHandler(struct _EXCEPTION_POINTERS* aExceptionInfoPtr) { - MessageBoxA(NULL, "I'M CRASHING BROOOO.", "Unhandled Exception", 0); + MessageBoxA(NULL, "Unhandled Exception", "Unhandled Exception", 0); create_minidump(aExceptionInfoPtr); return EXCEPTION_CONTINUE_SEARCH; } \ No newline at end of file diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 9891a2b..419e95e 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -328,21 +328,24 @@ namespace GUI while (std::getline(arcIni, line)) { - if (line.find(styleKey, 0) != line.npos) + if (size_t idx = line.find(styleKey, 0) != line.npos && + line.c_str()[0] != ';') { - line = line.substr(styleKey.length()); + line = line.substr(idx + styleKey.length()); std::string decode = Base64::Decode(&line[0], line.length()); memcpy(style, &decode[0], decode.length()); } - else if (line.find(coloursKey, 0) != line.npos) + else if (size_t idx = line.find(coloursKey, 0) != line.npos && + line.c_str()[0] != ';') { - line = line.substr(coloursKey.length()); + line = line.substr(idx + coloursKey.length()); std::string decode = Base64::Decode(&line[0], line.length()); memcpy(&style->Colors[0], &decode[0], decode.length()); } - else if (line.find(fontSizeKey, 0) != line.npos) + else if (size_t idx = line.find(fontSizeKey, 0) != line.npos && + line.c_str()[0] != ';') { - line = line.substr(fontSizeKey.length()); + line = line.substr(idx + fontSizeKey.length()); FontSize = std::stof(line); } } From 8d495b23bd7cd0bff2b72ce4324e61edeafef957 Mon Sep 17 00:00:00 2001 From: Delta <46466697+DeltaGW2@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:50:05 +0200 Subject: [PATCH 4/7] fix bug --- src/GUI/GUI.cpp | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 419e95e..20ee023 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -326,29 +326,34 @@ namespace GUI ImGuiStyle* style = &ImGui::GetStyle(); - while (std::getline(arcIni, line)) + try { - if (size_t idx = line.find(styleKey, 0) != line.npos && - line.c_str()[0] != ';') + while (std::getline(arcIni, line)) { - line = line.substr(idx + styleKey.length()); - std::string decode = Base64::Decode(&line[0], line.length()); - memcpy(style, &decode[0], decode.length()); - } - else if (size_t idx = line.find(coloursKey, 0) != line.npos && - line.c_str()[0] != ';') - { - line = line.substr(idx + coloursKey.length()); - std::string decode = Base64::Decode(&line[0], line.length()); - memcpy(&style->Colors[0], &decode[0], decode.length()); - } - else if (size_t idx = line.find(fontSizeKey, 0) != line.npos && - line.c_str()[0] != ';') - { - line = line.substr(idx + fontSizeKey.length()); - FontSize = std::stof(line); + if (line.find(styleKey, 0) != line.npos) + { + line = line.substr(styleKey.length()); + std::string decode = Base64::Decode(&line[0], line.length()); + memcpy(style, &decode[0], decode.length()); + } + else if (line.find(coloursKey, 0) != line.npos) + { + line = line.substr(coloursKey.length()); + std::string decode = Base64::Decode(&line[0], line.length()); + memcpy(&style->Colors[0], &decode[0], decode.length()); + } + else if (line.find(fontSizeKey, 0) != line.npos) + { + line = line.substr(fontSizeKey.length()); + FontSize = std::stof(line); + } } } + catch (...) + { + LogDebug(CH_CORE, "Couldn't parse ArcDPS style."); + } + arcIni.close(); } } From 333d9d5cf4e9b0b5a63b69cff0274974e8ae79ac Mon Sep 17 00:00:00 2001 From: Delta <46466697+DeltaGW2@users.noreply.github.com> Date: Wed, 24 Apr 2024 16:29:41 +0200 Subject: [PATCH 5/7] some ui changes --- src/GUI/EFontIdentifier.h | 2 ++ src/GUI/GUI.cpp | 40 ++++++++++++++++++---- src/GUI/Widgets/Overlay/CMumbleOverlay.cpp | 6 +++- src/Shared.cpp | 2 ++ src/Shared.h | 2 ++ 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/GUI/EFontIdentifier.h b/src/GUI/EFontIdentifier.h index 3c62844..66d151f 100644 --- a/src/GUI/EFontIdentifier.h +++ b/src/GUI/EFontIdentifier.h @@ -9,6 +9,8 @@ namespace GUI User, + Monospace, + Menomonia_Small, MenomoniaBig_Small, Trebuchet_Small, diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 20ee023..1681c17 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -284,6 +284,33 @@ namespace GUI } /* draw overlay end */ +#ifdef _DEBUG + std::string watermark = "Debug Build "; + watermark.append(__DATE__); + watermark.append(" "); + watermark.append(__TIME__); + watermark.append(" (v"); + watermark.append(Version.ToString()); + watermark.append(")"); + watermark.append(" ["); + watermark.append(BRANCH_NAME); + watermark.append("]"); + + ImGui::PushFont(MonospaceFont); + ImVec2 sz = ImGui::CalcTextSize(watermark.c_str()); + + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); + ImGui::SetNextWindowPos(ImVec2((Renderer::Width - sz.x) / 2, 0)); + if (ImGui::Begin("NEXUS_BUILDINFO", (bool*)0, WindowFlags_Watermark)) + { + ImGui::SetCursorPos(ImVec2(0, 0)); + ImGui::TextOutlined(watermark.c_str()); + }; + ImGui::End(); + ImGui::PopStyleVar(); + ImGui::PopFont(); +#endif + /* end frame */ ImGui::EndFrame(); ImGui::Render(); @@ -662,24 +689,23 @@ namespace GUI rb.AddRanges(io.Fonts->GetGlyphRangesChineseSimplifiedCommon()); rb.BuildRanges(&ranges); - /* add user font, or fallback to default */ + /* add user font */ if (!LinkArcDPSStyle && std::filesystem::exists(Path::F_FONT)) { fontPath = Path::F_FONT; std::string strFont = Path::F_FONT.string(); - io.Fonts->AddFontFromFileTTF(strFont.c_str(), FontSize, nullptr, ranges.Data); + UserFont = io.Fonts->AddFontFromFileTTF(strFont.c_str(), FontSize, nullptr, ranges.Data); } else if (LinkArcDPSStyle && std::filesystem::exists(Path::D_GW2_ADDONS / "arcdps" / "arcdps_font.ttf")) { fontPath = Path::D_GW2_ADDONS / "arcdps" / "arcdps_font.ttf"; std::string strFont = (Path::D_GW2_ADDONS / "arcdps" / "arcdps_font.ttf").string(); - io.Fonts->AddFontFromFileTTF(strFont.c_str(), FontSize, nullptr, ranges.Data); - } - else - { - io.Fonts->AddFontDefault(); + UserFont = io.Fonts->AddFontFromFileTTF(strFont.c_str(), FontSize, nullptr, ranges.Data); } + /* add default font */ + MonospaceFont = io.Fonts->AddFontDefault(); + /* load gw2 fonts */ LPVOID resM{}; DWORD szM{}; GetResource(NexusHandle, MAKEINTRESOURCE(RES_FONT_MENOMONIA), RT_FONT, &resM, &szM); diff --git a/src/GUI/Widgets/Overlay/CMumbleOverlay.cpp b/src/GUI/Widgets/Overlay/CMumbleOverlay.cpp index bef95d0..fe233e8 100644 --- a/src/GUI/Widgets/Overlay/CMumbleOverlay.cpp +++ b/src/GUI/Widgets/Overlay/CMumbleOverlay.cpp @@ -15,8 +15,10 @@ namespace GUI { if (!Visible) { return; } + ImGui::PushFont(MonospaceFont); + ImVec2 pos = ImVec2(16.0f, 16.0f); - ImVec2 size = ImVec2(ImGui::GetFontSize() * 10.0f, 0.0f); + ImVec2 size = ImVec2(ImGui::CalcTextSize("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").x, 0.0f); ImGui::SetNextWindowBgAlpha(0.35f); ImGui::SetNextWindowPos(pos); @@ -282,5 +284,7 @@ namespace GUI } ImGui::End(); } + + ImGui::PopFont(); } } \ No newline at end of file diff --git a/src/Shared.cpp b/src/Shared.cpp index 3ee08b0..d9e60d4 100644 --- a/src/Shared.cpp +++ b/src/Shared.cpp @@ -24,6 +24,8 @@ NexusLinkData* NexusLink = nullptr; CLocalization& Language = CLocalization::GetInstance(); +ImFont* MonospaceFont = nullptr; +ImFont* UserFont = nullptr; ImFont* Font = nullptr; ImFont* FontBig = nullptr; ImFont* FontUI = nullptr; diff --git a/src/Shared.h b/src/Shared.h index 705ce00..0136402 100644 --- a/src/Shared.h +++ b/src/Shared.h @@ -40,6 +40,8 @@ extern NexusLinkData* NexusLink; extern CLocalization& Language; +extern ImFont* MonospaceFont; /* default/monospace/console font */ +extern ImFont* UserFont; /* custom user font */ extern ImFont* Font; /* Menomonia */ extern ImFont* FontBig; /* Menomonia, but slightly bigger */ extern ImFont* FontUI; /* Trebuchet */ From f92962382bc2c01c0c59944c430b7eed31ea603c Mon Sep 17 00:00:00 2001 From: Delta <46466697+DeltaGW2@users.noreply.github.com> Date: Wed, 24 Apr 2024 22:57:45 +0200 Subject: [PATCH 6/7] simplify debug watermark --- src/GUI/GUI.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/GUI/GUI.cpp b/src/GUI/GUI.cpp index 1681c17..75125ce 100644 --- a/src/GUI/GUI.cpp +++ b/src/GUI/GUI.cpp @@ -11,6 +11,7 @@ #include "Shared.h" #include "Consts.h" #include "Branch.h" +#include "Version.h" #include "Mumble/Mumble.h" @@ -40,6 +41,17 @@ #include "resource.h" #include "Textures/Texture.h" +#ifndef STRINGIFY +#define STRINGIFY(x) #x +#endif +#ifndef TOSTRING +#define TOSTRING(x) STRINGIFY(x) +#endif + +#ifndef WATERMARK +#define WATERMARK __DATE__ " " __TIME__ " (v" TOSTRING(V_MAJOR) "." TOSTRING(V_MINOR) "." TOSTRING(V_BUILD) "." TOSTRING(V_REVISION) ") [" BRANCH_NAME "]" +#endif + namespace GUI { /* internal forward declarations */ @@ -285,26 +297,14 @@ namespace GUI /* draw overlay end */ #ifdef _DEBUG - std::string watermark = "Debug Build "; - watermark.append(__DATE__); - watermark.append(" "); - watermark.append(__TIME__); - watermark.append(" (v"); - watermark.append(Version.ToString()); - watermark.append(")"); - watermark.append(" ["); - watermark.append(BRANCH_NAME); - watermark.append("]"); - ImGui::PushFont(MonospaceFont); - ImVec2 sz = ImGui::CalcTextSize(watermark.c_str()); + ImVec2 sz = ImGui::CalcTextSize(WATERMARK); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::SetNextWindowPos(ImVec2((Renderer::Width - sz.x) / 2, 0)); if (ImGui::Begin("NEXUS_BUILDINFO", (bool*)0, WindowFlags_Watermark)) { - ImGui::SetCursorPos(ImVec2(0, 0)); - ImGui::TextOutlined(watermark.c_str()); + ImGui::TextOutlined(WATERMARK); }; ImGui::End(); ImGui::PopStyleVar(); From 2caaa9a9085a638bcf812b0f117735f0d104b363 Mon Sep 17 00:00:00 2001 From: Delta <46466697+DeltaGW2@users.noreply.github.com> Date: Sat, 27 Apr 2024 17:36:02 +0200 Subject: [PATCH 7/7] update localisation + fix loader internal crash --- src/GUI/Widgets/Addons/AddonItem.cpp | 20 ++++++++++++++++++++ src/Loader/Loader.cpp | 5 +---- src/Resources/Locales | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/GUI/Widgets/Addons/AddonItem.cpp b/src/GUI/Widgets/Addons/AddonItem.cpp index 57850e9..91363a4 100644 --- a/src/GUI/Widgets/Addons/AddonItem.cpp +++ b/src/GUI/Widgets/Addons/AddonItem.cpp @@ -137,6 +137,26 @@ namespace GUI aAddon->Definitions->UpdateLink != nullptr ? aAddon->Definitions->UpdateLink : "")) { Loader::QueueAddon(ELoaderAction::Reload, tmpPath); + + std::string notification = aAddon->Definitions->Name; + if (aAddon->State == EAddonState::LoadedLOCKED) + { + notification.append(Language.Translate("((000079))")); + } + else + { + notification.append(" "); + notification.append(Language.Translate("((000081))")); + } + + GUI::Alerts::Notify(notification.c_str()); + } + else + { + std::string notification = aAddon->Definitions->Name; + notification.append(" "); + notification.append(Language.Translate("((000082))")); + GUI::Alerts::Notify(notification.c_str()); } Sleep(1000); // arbitrary sleep otherwise the user never even sees "is checking..." aAddon->IsCheckingForUpdates = false; diff --git a/src/Loader/Loader.cpp b/src/Loader/Loader.cpp index 28ef83c..0dca0aa 100644 --- a/src/Loader/Loader.cpp +++ b/src/Loader/Loader.cpp @@ -510,11 +510,9 @@ namespace Loader catch (std::filesystem::filesystem_error fErr) { LogDebug(CH_LOADER, "%s", fErr.what()); - return; } } - - if (path.extension() == extOld) + else if (path.extension() == extOld) { try { @@ -523,7 +521,6 @@ namespace Loader catch (std::filesystem::filesystem_error fErr) { LogDebug(CH_LOADER, "%s", fErr.what()); - return; } } } diff --git a/src/Resources/Locales b/src/Resources/Locales index a049529..a14274a 160000 --- a/src/Resources/Locales +++ b/src/Resources/Locales @@ -1 +1 @@ -Subproject commit a049529e34f597be513c233ae0931d1e68d08989 +Subproject commit a14274ade7292785ad48b9af86b7df335f175d36