diff --git a/Dependencies/GWCA/bin/gwca.dll b/Dependencies/GWCA/bin/gwca.dll index 78d361475..b334cdbfc 100644 Binary files a/Dependencies/GWCA/bin/gwca.dll and b/Dependencies/GWCA/bin/gwca.dll differ diff --git a/Dependencies/GWCA/include/GWCA/Context/GameplayContext.h b/Dependencies/GWCA/include/GWCA/Context/GameplayContext.h index 455eb6b1d..e8aed4836 100644 --- a/Dependencies/GWCA/include/GWCA/Context/GameplayContext.h +++ b/Dependencies/GWCA/include/GWCA/Context/GameplayContext.h @@ -1,6 +1,5 @@ #pragma once -#include #include namespace GW { diff --git a/Dependencies/GWCA/include/GWCA/Managers/SkillbarMgr.h b/Dependencies/GWCA/include/GWCA/Managers/SkillbarMgr.h index 19a4001f6..13eb7c8c3 100644 --- a/Dependencies/GWCA/include/GWCA/Managers/SkillbarMgr.h +++ b/Dependencies/GWCA/include/GWCA/Managers/SkillbarMgr.h @@ -1,7 +1,6 @@ #pragma once #include -#include #include namespace GW { diff --git a/Dependencies/GWCA/include/GWCA/Managers/TradeMgr.h b/Dependencies/GWCA/include/GWCA/Managers/TradeMgr.h index 54178f602..56648e31f 100644 --- a/Dependencies/GWCA/include/GWCA/Managers/TradeMgr.h +++ b/Dependencies/GWCA/include/GWCA/Managers/TradeMgr.h @@ -1,7 +1,6 @@ #pragma once #include -#include namespace GW { struct Module; diff --git a/Dependencies/GWCA/include/GWCA/Managers/UIMgr.h b/Dependencies/GWCA/include/GWCA/Managers/UIMgr.h index 5d5081008..08339c4aa 100644 --- a/Dependencies/GWCA/include/GWCA/Managers/UIMgr.h +++ b/Dependencies/GWCA/include/GWCA/Managers/UIMgr.h @@ -7,8 +7,6 @@ #include #include -#include "RenderMgr.h" - namespace GW { struct Module; @@ -1078,7 +1076,7 @@ namespace GW { GWCA_API bool SetFrameLimit(uint32_t value); //GWCA_API void SetPreference(Preference pref, uint32_t value); - + GWCA_API bool SetFrameVisible(UI::Frame* frame, bool is_visible); typedef HookCallback KeyCallback; // Listen for a gw hotkey press diff --git a/Dependencies/GWCA/lib/gwca.lib b/Dependencies/GWCA/lib/gwca.lib index 531da61d8..9605097eb 100644 Binary files a/Dependencies/GWCA/lib/gwca.lib and b/Dependencies/GWCA/lib/gwca.lib differ diff --git a/GWToolboxdll/Modules/GameSettings.cpp b/GWToolboxdll/Modules/GameSettings.cpp index 141d1890f..91113a4b1 100644 --- a/GWToolboxdll/Modules/GameSettings.cpp +++ b/GWToolboxdll/Modules/GameSettings.cpp @@ -215,6 +215,8 @@ namespace { bool automatically_flag_pet_to_fight_called_target = true; + bool remove_window_border_in_windowed_mode = false; + bool skip_fade_animations = false; using FadeFrameContent_pt = void(__cdecl*)(uint32_t frame_id, float source_opacity, float target_opacity, float duration_seconds, uint32_t unk); FadeFrameContent_pt FadeFrameContent_Func = nullptr, FadeFrameContent_Ret = nullptr; @@ -1186,6 +1188,40 @@ namespace { } } + void CheckRemoveWindowBorder() { + // @TODO: When frame is removed, the game "expands" to fill the space, but the UI is still offset as if its factoring in the for title bar. Intercept SetWindowPos on the game side instead of doing this??? + const auto pref = GW::UI::GetPreference(GW::UI::NumberPreference::ScreenBorderless); + Log::Log("Pref changed %d", pref); + if (remove_window_border_in_windowed_mode && pref == 0) { + const auto hwnd = GW::MemoryMgr::GetGWWindowHandle(); + if (!hwnd) return; + + auto remove_styles = (WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU); + auto lStyle = GetWindowLong(hwnd, GWL_STYLE); + + if (!lStyle) return; + if ((lStyle & remove_styles) != 0) { + lStyle &= ~remove_styles; + SetWindowLong(hwnd, GWL_STYLE, lStyle); + } + + remove_styles = (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE); + lStyle = GetWindowLong(hwnd, GWL_EXSTYLE); + if ((lStyle & remove_styles) != 0) { + lStyle &= ~remove_styles; + //SetWindowLong(hwnd, GWL_EXSTYLE, lStyle); + } + //SetWindowLong(hwnd, GWL_EXSTYLE, lExStyle); + + //SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); + + // Display close/restore/min buttons top right + GW::UI::SetFrameVisible(GW::UI::GetFrameByLabel(L"BtnMin"), true); + GW::UI::SetFrameVisible(GW::UI::GetFrameByLabel(L"BtnRestore"), true); + GW::UI::SetFrameVisible(GW::UI::GetFrameByLabel(L"BtnExit"), true); + } + } + GW::HookEntry OnPostUIMessage_HookEntry; void OnPostUIMessage(GW::HookStatus* status, GW::UI::UIMessage message_id, void* wParam, void*) { if (status->blocked) @@ -1207,8 +1243,8 @@ namespace { } break; case GW::UI::UIMessage::kPreferenceValueChanged: { const auto packet = (GW::UI::UIPacket::kPreferenceValueChanged*)wParam; - if (packet->preference_id == GW::UI::NumberPreference::TextLanguage) - FontLoader::LoadFonts(true); + if (packet->preference_id == GW::UI::NumberPreference::ScreenBorderless) + CheckRemoveWindowBorder(); } break; case GW::UI::UIMessage::kPartyDefeated: { if (auto_return_on_defeat && GW::PartyMgr::GetIsLeader() && !GW::PartyMgr::ReturnToOutpost()) @@ -1433,6 +1469,8 @@ void GameSettings::Initialize() } Log::Log("[GameSettings] ctrl_click_patch = %p\n", ctrl_click_patch.GetAddress()); + + SkillList_UICallback_Func = (GW::UI::UIInteractionCallback)GW::Scanner::ToFunctionStart(GW::Scanner::FindAssertion("GmCtlSkList.cpp", "!obj", 0xc71,0)); Log::Log("[GameSettings] SkillList_UICallback_Func = %p\n", SkillList_UICallback_Func); @@ -1647,6 +1685,8 @@ void GameSettings::Initialize() last_online_status = static_cast(GW::FriendListMgr::GetMyStatus()); + GW::GameThread::Enqueue(CheckRemoveWindowBorder); + #ifdef APRIL_FOOLS AF::ApplyPatchesIfItsTime(); #endif