UI+build: Isolate wxWidgets code from non-GUI code (#1633)

This commit is contained in:
SSimco 2025-07-15 05:28:41 +03:00 committed by GitHub
parent 5f3c2816ec
commit 67de63bed6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
199 changed files with 2414 additions and 2091 deletions

View file

@ -98,7 +98,3 @@ target_link_libraries(CemuUtil PRIVATE
Boost::nowide
OpenSSL::Crypto
)
if (ENABLE_WXWIDGETS)
target_link_libraries(CemuUtil PRIVATE wx::base wx::core)
endif()

View file

@ -5,8 +5,6 @@
#include <cctype>
#include <random>
#include <wx/translation.h>
#include "config/ActiveSettings.h"
#include <boost/random/uniform_int.hpp>
@ -53,29 +51,6 @@ std::string_view& trim(std::string_view& str, const std::string& chars)
#if BOOST_OS_WINDOWS
std::wstring GetSystemErrorMessageW()
{
return GetSystemErrorMessageW(GetLastError());
}
std::wstring GetSystemErrorMessageW(DWORD error_code)
{
if(error_code == ERROR_SUCCESS)
return {};
LPWSTR lpMsgBuf = nullptr;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, error_code, 0, (LPWSTR)&lpMsgBuf, 0, nullptr);
if (lpMsgBuf)
{
std::wstring str = fmt::format(L"{}: {}", _("Error").ToStdWstring(), lpMsgBuf); // TRANSLATE
LocalFree(lpMsgBuf);
return str;
}
return fmt::format(L"{}: {:#x}", _("Error code").ToStdWstring(), error_code);
}
std::string GetSystemErrorMessage(DWORD error_code)
{
if(error_code == ERROR_SUCCESS)
@ -85,12 +60,12 @@ std::string GetSystemErrorMessage(DWORD error_code)
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, error_code, 0, (LPSTR)&lpMsgBuf, 0, nullptr);
if (lpMsgBuf)
{
std::string str = fmt::format("{}: {}", _("Error").ToStdString(), lpMsgBuf); // TRANSLATE
std::string str = fmt::format("{}: {}", _tr("Error"), lpMsgBuf); // TRANSLATE
LocalFree(lpMsgBuf);
return str;
}
return fmt::format("{}: {:#x}", _("Error code").ToStdString(), error_code);
return fmt::format("{}: {:#x}", _tr("Error code"), error_code);
}
std::string GetSystemErrorMessage()

View file

@ -76,8 +76,6 @@ std::string_view& trim(std::string_view& str, const std::string& chars = "\t\n\v
std::string GenerateRandomString(size_t length);
std::string GenerateRandomString(size_t length, std::string_view characters);
std::wstring GetSystemErrorMessageW();
std::wstring GetSystemErrorMessageW(DWORD error_code);
std::string GetSystemErrorMessage();
std::string GetSystemErrorMessage(DWORD error_code);
std::string GetSystemErrorMessage(const std::exception& ex);

View file

@ -1,7 +1,7 @@
#pragma once
#include <tuple>
#include <wx/math.h>
#include "util/helpers/helpers.h"
#include "util/math/vector3.h"
#define DEG2RAD(__d__) ((__d__ * M_PI) / 180.0f )
#define RAD2DEG(__r__) ((__r__ * 180.0f) / M_PI)