diff --git a/docs/BUILDING.md b/docs/BUILDING.md index ad1f3fc..a0d74da 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -11,14 +11,11 @@ Requirements: - Qt 6.2.X (GlosSIConfig only) - Qt Visual Studio addin (GlosSIConfig only) -```bat -git submodule init -git submodule update --recursive -buildSFML.bat -buildViGEmClient.bat +```powershell +.\prebuild.ps1 -:: Open GlosSI.sln and hit build! -start GlosSI.sln +# Open GlosSI.sln and hit build! +Invoke-Item GlosSI.sln ``` In addition to the above, you will need to install the required drivers: diff --git a/prebuild.ps1 b/prebuild.ps1 new file mode 100644 index 0000000..e8098ae --- /dev/null +++ b/prebuild.ps1 @@ -0,0 +1,11 @@ +git submodule init +git submodule update --recursive + +cmd.exe /c buildSFML.bat +cmd.exe /c buildViGEmClient.bat + +cd deps/traypp + +git apply ../../traypp_unicode.patch + +cd ../../ \ No newline at end of file diff --git a/traypp_unicode.patch b/traypp_unicode.patch new file mode 100644 index 0000000..d0c6441 --- /dev/null +++ b/traypp_unicode.patch @@ -0,0 +1,79 @@ +diff --git a/tray/include/core/windows/tray.hpp b/tray/include/core/windows/tray.hpp +index ab5949922b41c519a6632544286811f379f36392..6f658feda1aae2c1770648b3bffc3af201672fe6 100755 +--- a/tray/include/core/windows/tray.hpp ++++ b/tray/include/core/windows/tray.hpp +@@ -11,7 +11,7 @@ namespace Tray + { + HWND hwnd = nullptr; + HMENU menu = nullptr; +- WNDCLASSEX windowClass; ++ WNDCLASSEXA windowClass; + NOTIFYICONDATA notifyData; + + std::vector> allocations; +diff --git a/tray/src/core/windows/image.cpp b/tray/src/core/windows/image.cpp +index 75a7868350bd1069521345826163eb9275607277..1ecb1de7edaeaff871426238862531dcf4015a76 100755 +--- a/tray/src/core/windows/image.cpp ++++ b/tray/src/core/windows/image.cpp +@@ -5,7 +5,7 @@ + Tray::Image::Image(HBITMAP image) : image(image) {} + Tray::Image::Image(const char *path) : Image(std::string(path)) {} + Tray::Image::Image(const std::string &path) +- : image(reinterpret_cast(LoadImage(nullptr, path.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE))) ++ : image(reinterpret_cast(LoadImageA(nullptr, path.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE))) + { + if (image == nullptr) + { +diff --git a/tray/src/core/windows/tray.cpp b/tray/src/core/windows/tray.cpp +index 38111083207e3e9512f24749360172b995cf2bb0..089fdc56fab1c9d6bdd60b4b93158ecdf22e5bf6 100755 +--- a/tray/src/core/windows/tray.cpp ++++ b/tray/src/core/windows/tray.cpp +@@ -23,14 +23,14 @@ Tray::Tray::Tray(std::string identifier, Icon icon) : BaseTray(std::move(identif + windowClass.lpszClassName = this->identifier.c_str(); + windowClass.hInstance = GetModuleHandle(nullptr); + +- if (RegisterClassEx(&windowClass) == 0) ++ if (RegisterClassExA(&windowClass) == 0) + { + throw std::runtime_error("Failed to register class"); + } + + // NOLINTNEXTLINE +- hwnd = CreateWindow(this->identifier.c_str(), nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, windowClass.hInstance, +- nullptr); ++ hwnd = CreateWindowA(this->identifier.c_str(), nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, windowClass.hInstance, ++ nullptr); + if (hwnd == nullptr) + { + throw std::runtime_error("Failed to create window"); +@@ -64,7 +64,7 @@ void Tray::Tray::exit() + DestroyIcon(notifyData.hIcon); + DestroyMenu(menu); + +- UnregisterClass(identifier.c_str(), GetModuleHandle(nullptr)); ++ UnregisterClassA(identifier.c_str(), GetModuleHandle(nullptr)); + PostMessage(hwnd, WM_QUIT, 0, 0); + allocations.clear(); + +@@ -98,10 +98,10 @@ HMENU Tray::Tray::construct(const std::vector> &entri + auto *item = entry.get(); + + auto name = std::shared_ptr(new char[item->getText().size() + 1]); +- strcpy(name.get(), item->getText().c_str()); // NOLINT ++ strcpy_s(name.get(), strlen(name.get()), item->getText().c_str()); // NOLINT + parent->allocations.emplace_back(name); + +- MENUITEMINFO winItem{0}; ++ MENUITEMINFOA winItem{0}; + + winItem.wID = ++id; + winItem.dwTypeData = name.get(); +@@ -158,7 +158,7 @@ HMENU Tray::Tray::construct(const std::vector> &entri + } + } + +- InsertMenuItem(menu, id, TRUE, &winItem); ++ InsertMenuItemA(menu, id, TRUE, &winItem); + } + + return menu;