diff --git a/CMakeLists.txt b/CMakeLists.txt index f71595f6..a00879fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,8 @@ set(EMULATOR_VERSION_MAJOR "0" CACHE STRING "") set(EMULATOR_VERSION_MINOR "0" CACHE STRING "") set(EMULATOR_VERSION_PATCH "0" CACHE STRING "") +set(THREADS_PREFER_PTHREAD_FLAG true) # needs to be set before vcpkg + execute_process( COMMAND git log --format=%h -1 WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} @@ -136,7 +138,6 @@ option(ENABLE_CUBEB "Enabled cubeb backend" ON) option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON) -set(THREADS_PREFER_PTHREAD_FLAG true) find_package(Threads REQUIRED) find_package(SDL2 REQUIRED) find_package(CURL REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 81d432ec..e73d5f1f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,6 +39,15 @@ add_compile_definitions(VK_NO_PROTOTYPES) set(CMAKE_INCLUDE_CURRENT_DIR ON) +# on msvc we can reuse the PCH from CemuCommon, on other platforms it's not straight forward to reuse the PCH so we opt out of it +function(cemu_use_precompiled_header target_name) + if(MSVC) + target_precompile_headers(${target_name} REUSE_FROM CemuCommon) + else() + target_precompile_headers(${target_name} PRIVATE "${CMAKE_SOURCE_DIR}/src/Common/precompiled.h") + endif() +endfunction() + add_subdirectory(Common) add_subdirectory(gui) add_subdirectory(Cafe) @@ -55,7 +64,7 @@ add_executable(CemuBin mainLLE.cpp ) -target_precompile_headers(CemuBin REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuBin) if(MSVC AND MSVC_VERSION EQUAL 1940) # workaround for an msvc issue on VS 17.10 where generated ILK files are too large diff --git a/src/Cafe/Account/Account.cpp b/src/Cafe/Account/Account.cpp index 729786b1..6f576ae1 100644 --- a/src/Cafe/Account/Account.cpp +++ b/src/Cafe/Account/Account.cpp @@ -1,6 +1,6 @@ #include "Account.h" +#include "AccountError.h" #include "util/helpers/helpers.h" -#include "util/helpers/SystemException.h" #include "util/helpers/StringHelpers.h" #include "config/ActiveSettings.h" #include "Cafe/IOSU/legacy/iosu_crypto.h" diff --git a/src/Cafe/Account/Account.h b/src/Cafe/Account/Account.h index ed32de5a..c9abd395 100644 --- a/src/Cafe/Account/Account.h +++ b/src/Cafe/Account/Account.h @@ -1,12 +1,8 @@ #pragma once -#include "AccountError.h" - #include #include #include -#include -#include enum class OnlineAccountError { diff --git a/src/Cafe/CMakeLists.txt b/src/Cafe/CMakeLists.txt index 653dea6e..3ca34e35 100644 --- a/src/Cafe/CMakeLists.txt +++ b/src/Cafe/CMakeLists.txt @@ -525,6 +525,7 @@ add_library(CemuCafe OS/RPL/rpl_structs.h OS/RPL/rpl_symbol_storage.cpp OS/RPL/rpl_symbol_storage.h + TitleList/GameInfo.cpp TitleList/GameInfo.h TitleList/ParsedMetaXml.h TitleList/SaveInfo.cpp @@ -614,7 +615,7 @@ endif() set_property(TARGET CemuCafe PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(CemuCafe REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuCafe) target_include_directories(CemuCafe PUBLIC "../") diff --git a/src/Cafe/CafeSystem.h b/src/Cafe/CafeSystem.h index e9de8d7d..4003b393 100644 --- a/src/Cafe/CafeSystem.h +++ b/src/Cafe/CafeSystem.h @@ -1,11 +1,10 @@ #pragma once #include "Cafe/OS/RPL/rpl.h" -#include "util/helpers/Semaphore.h" #include "Cafe/TitleList/TitleId.h" -#include "config/CemuConfig.h" enum class CosCapabilityBits : uint64; enum class CosCapabilityGroup : uint32; +enum class CafeConsoleRegion; namespace CafeSystem { diff --git a/src/Cafe/GameProfile/GameProfile.h b/src/Cafe/GameProfile/GameProfile.h index 42424957..5155beac 100644 --- a/src/Cafe/GameProfile/GameProfile.h +++ b/src/Cafe/GameProfile/GameProfile.h @@ -1,6 +1,4 @@ #pragma once - -#include #include "config/CemuConfig.h" struct gameProfileIntegerOption_t diff --git a/src/Cafe/GraphicPack/GraphicPack2.cpp b/src/Cafe/GraphicPack/GraphicPack2.cpp index 295d5dce..e79f9fc5 100644 --- a/src/Cafe/GraphicPack/GraphicPack2.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2.cpp @@ -1,18 +1,18 @@ #include "Cafe/GraphicPack/GraphicPack2.h" +#include "Cafe/Filesystem/fsc.h" #include "config/CemuConfig.h" #include "config/ActiveSettings.h" #include "openssl/sha.h" -#include "Cafe/HW/Latte/Renderer/RendererOuputShader.h" -#include "Cafe/Filesystem/fsc.h" #include "boost/algorithm/string.hpp" #include "util/helpers/MapAdaptor.h" #include "util/helpers/StringParser.h" -#include "Cafe/HW/Latte/Core/LatteTiming.h" -#include "util/IniParser/IniParser.h" #include "util/helpers/StringHelpers.h" +#include "util/IniParser/IniParser.h" #include "Cafe/CafeSystem.h" #include "HW/Espresso/Debugger/Debugger.h" - +#include "Cafe/HW/Latte/Core/LatteTiming.h" +#include "Cafe/HW/Latte/Renderer/Renderer.h" +#include "Cafe/HW/Latte/Renderer/RendererOuputShader.h" #include std::vector GraphicPack2::s_graphic_packs; @@ -21,6 +21,37 @@ std::atomic_bool GraphicPack2::s_isReady; #define GP_LEGACY_VERSION (2) +template +bool ParseRule(const ExpressionParser& parser, IniParser& iniParser, const char* option_name, T* valueOut) +{ + auto optionValue = iniParser.FindOption(option_name); + if (optionValue) + { + *valueOut = parser.Evaluate(*optionValue); + return true; + } + return false; +} + +template +std::vector ParseList(const ExpressionParser& parser, IniParser& iniParser, const char* optionName) +{ + std::vector result; + auto optionText = iniParser.FindOption(optionName); + if (!optionText) + return result; + for (auto& token : Tokenize(*optionText, ',')) + { + try + { + result.emplace_back(parser.Evaluate(token)); + } + catch (const std::invalid_argument&) + {} + } + return result; +} + void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath) { fs::path rulesPath = graphicPackPath; diff --git a/src/Cafe/GraphicPack/GraphicPack2.h b/src/Cafe/GraphicPack/GraphicPack2.h index 54af7a5f..88d02017 100644 --- a/src/Cafe/GraphicPack/GraphicPack2.h +++ b/src/Cafe/GraphicPack/GraphicPack2.h @@ -6,10 +6,10 @@ #include "util/helpers/Serializer.h" #include "Cafe/OS/RPL/rpl.h" #include "Cemu/PPCAssembler/ppcAssembler.h" -#include -#include "Cafe/HW/Latte/Renderer/Renderer.h" #include "GraphicPack2Patches.h" -#include "util/IniParser/IniParser.h" + +enum class RendererAPI; +enum class GfxVendor; class GraphicPack2 { @@ -99,7 +99,7 @@ public: }; using PresetPtr = std::shared_ptr; - GraphicPack2(fs::path rulesPath, IniParser& rules); + GraphicPack2(fs::path rulesPath, class IniParser& rules); bool IsEnabled() const { return m_enabled; } bool IsActivated() const { return m_activated; } @@ -253,12 +253,6 @@ private: std::string m_output_shader_source, m_upscaling_shader_source, m_downscaling_shader_source; std::unique_ptr m_output_shader, m_upscaling_shader, m_downscaling_shader, m_output_shader_ud, m_upscaling_shader_ud, m_downscaling_shader_ud; - template - bool ParseRule(const ExpressionParser& parser, IniParser& iniParser, const char* option_name, T* value_out) const; - - template - std::vector ParseList(const ExpressionParser& parser, IniParser& iniParser, const char* option_name) const; - std::unordered_map ParsePresetVars(IniParser& rules) const; std::vector ParseTitleIds(IniParser& rules, const char* option_name); @@ -307,37 +301,3 @@ public: }; using GraphicPackPtr = std::shared_ptr; - -template -bool GraphicPack2::ParseRule(const ExpressionParser& parser, IniParser& iniParser, const char* option_name, T* value_out) const -{ - auto option_value = iniParser.FindOption(option_name); - if (option_value) - { - *value_out = parser.Evaluate(*option_value); - return true; - } - - return false; -} - -template -std::vector GraphicPack2::ParseList(const ExpressionParser& parser, IniParser& iniParser, const char* option_name) const -{ - std::vector result; - - auto option_text = iniParser.FindOption(option_name); - if (!option_text) - return result; - - for(auto& token : Tokenize(*option_text, ',')) - { - try - { - result.emplace_back(parser.Evaluate(token)); - } - catch (const std::invalid_argument&) {} - } - - return result; -} diff --git a/src/Cafe/HW/Espresso/Debugger/GDBStub.cpp b/src/Cafe/HW/Espresso/Debugger/GDBStub.cpp index e54fae1b..e7cb2257 100644 --- a/src/Cafe/HW/Espresso/Debugger/GDBStub.cpp +++ b/src/Cafe/HW/Espresso/Debugger/GDBStub.cpp @@ -12,6 +12,10 @@ #include "Cafe/HW/Espresso/EspressoISA.h" #include "Common/socket.h" +#if BOOST_OS_UNIX +#include +#endif + #define GET_THREAD_ID(threadPtr) memory_getVirtualOffsetFromPointer(threadPtr) #define GET_THREAD_BY_ID(threadId) (OSThread_t*)memory_getPointerFromPhysicalOffset(threadId) @@ -985,4 +989,4 @@ void GDBServer::HandleEntryStop(uint32 entryAddress) { this->m_patchedInstructions.try_emplace(entryAddress, entryAddress, BreakpointType::BP_SINGLE, false, ""); m_entry_point = entryAddress; -} \ No newline at end of file +} diff --git a/src/Cafe/HW/Latte/Core/LatteOverlay.cpp b/src/Cafe/HW/Latte/Core/LatteOverlay.cpp index 7499d743..1a1a560c 100644 --- a/src/Cafe/HW/Latte/Core/LatteOverlay.cpp +++ b/src/Cafe/HW/Latte/Core/LatteOverlay.cpp @@ -1,11 +1,10 @@ #include "Cafe/HW/Latte/Core/LatteOverlay.h" #include "Cafe/HW/Latte/Core/LattePerformanceMonitor.h" -#include "WindowSystem.h" - -#include "config/CemuConfig.h" - #include "Cafe/HW/Latte/Renderer/Renderer.h" +#include "Cafe/Account/Account.h" +#include "config/CemuConfig.h" #include "config/ActiveSettings.h" +#include "WindowSystem.h" #include #include "resource/IconsFontAwesome5.h" diff --git a/src/Cafe/HW/Latte/Core/LatteTextureView.cpp b/src/Cafe/HW/Latte/Core/LatteTextureView.cpp index 2773a34d..a1a94e4d 100644 --- a/src/Cafe/HW/Latte/Core/LatteTextureView.cpp +++ b/src/Cafe/HW/Latte/Core/LatteTextureView.cpp @@ -1,6 +1,7 @@ +#include "Cafe/HW/Latte/Core/Latte.h" #include "Cafe/HW/Latte/Core/LatteTexture.h" #include "Cafe/HW/Latte/Core/LatteTextureView.h" -#include "Cafe/HW/Latte/Core/Latte.h" +#include "LatteCachedFBO.h" #include "Cafe/GraphicPack/GraphicPack2.h" LatteTextureView::LatteTextureView(LatteTexture* texture, sint32 firstMip, sint32 mipCount, sint32 firstSlice, sint32 sliceCount, Latte::E_DIM dim, Latte::E_GX2SURFFMT format, bool registerView) diff --git a/src/Cafe/IOSU/legacy/iosu_fpd.cpp b/src/Cafe/IOSU/legacy/iosu_fpd.cpp index a667e61c..0445d309 100644 --- a/src/Cafe/IOSU/legacy/iosu_fpd.cpp +++ b/src/Cafe/IOSU/legacy/iosu_fpd.cpp @@ -10,7 +10,7 @@ #include "util/helpers/StringHelpers.h" #include "Cafe/IOSU/iosu_types_common.h" #include "Cafe/IOSU/nn/iosu_nn_service.h" - +#include "Common/socket.h" #include "Common/CafeString.h" std::mutex g_friend_notification_mutex; diff --git a/src/Cafe/IOSU/legacy/iosu_nim.cpp b/src/Cafe/IOSU/legacy/iosu_nim.cpp index 5cab16f8..dcafb457 100644 --- a/src/Cafe/IOSU/legacy/iosu_nim.cpp +++ b/src/Cafe/IOSU/legacy/iosu_nim.cpp @@ -11,6 +11,8 @@ #include "Cemu/napi/napi.h" #include "Cemu/ncrypto/ncrypto.h" #include "Cafe/CafeSystem.h" +#include "Cafe/Account/Account.h" +#include "config/ActiveSettings.h" namespace iosu { diff --git a/src/Cafe/IOSU/nn/boss/boss_service.cpp b/src/Cafe/IOSU/nn/boss/boss_service.cpp index 48d6be52..3f710c40 100644 --- a/src/Cafe/IOSU/nn/boss/boss_service.cpp +++ b/src/Cafe/IOSU/nn/boss/boss_service.cpp @@ -1,7 +1,5 @@ #include "Cafe/OS/libs/nn_common.h" -#include "Cafe/OS/libs/coreinit/coreinit_Time.h" #include "util/helpers/helpers.h" -#include "Cafe/Filesystem/fsc.h" #include "Cafe/IOSU/iosu_types_common.h" #include "Cafe/IOSU/nn/iosu_nn_service.h" @@ -9,6 +7,7 @@ #include "Cafe/IOSU/legacy/iosu_act.h" #include "Cafe/CafeSystem.h" #include "config/ActiveSettings.h" +#include "Cafe/Account/Account.h" #include "boss_service.h" #include "boss_common.h" diff --git a/src/Cafe/OS/libs/nn_ac/nn_ac.cpp b/src/Cafe/OS/libs/nn_ac/nn_ac.cpp index 4fbfc166..61e7a677 100644 --- a/src/Cafe/OS/libs/nn_ac/nn_ac.cpp +++ b/src/Cafe/OS/libs/nn_ac/nn_ac.cpp @@ -1,6 +1,7 @@ #include "Cafe/OS/common/OSCommon.h" #include "Cafe/OS/libs/nn_common.h" #include "nn_ac.h" +#include "Common/socket.h" #if BOOST_OS_WINDOWS #include diff --git a/src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp b/src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp index 0ea0513a..67252b27 100644 --- a/src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp +++ b/src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp @@ -5,6 +5,7 @@ #include "util/crypto/aes128.h" #include "openssl/sha.h" #include "Cemu/napi/napi.h" +#include "config/ActiveSettings.h" namespace nn { diff --git a/src/Cafe/OS/libs/nsysnet/nsysnet.cpp b/src/Cafe/OS/libs/nsysnet/nsysnet.cpp index 72a64a7b..032ca5a4 100644 --- a/src/Cafe/OS/libs/nsysnet/nsysnet.cpp +++ b/src/Cafe/OS/libs/nsysnet/nsysnet.cpp @@ -8,23 +8,8 @@ #include "Common/socket.h" #if BOOST_OS_UNIX - -#define WSAEWOULDBLOCK EWOULDBLOCK -#define WSAEINPROGRESS EINPROGRESS -#define WSAESHUTDOWN ESHUTDOWN -#define WSAECONNABORTED ECONNABORTED -#define WSAHOST_NOT_FOUND EAI_NONAME -#define WSAENOTCONN ENOTCONN - -#define GETLASTERR errno - -#endif // BOOST_OS_UNIX - -#if BOOST_OS_WINDOWS - -#define GETLASTERR WSAGetLastError() - -#endif //BOOST_OS_WINDOWS +#include +#endif #define WU_AF_INET 2 diff --git a/src/Cafe/TitleList/GameInfo.cpp b/src/Cafe/TitleList/GameInfo.cpp new file mode 100644 index 00000000..ca14c931 --- /dev/null +++ b/src/Cafe/TitleList/GameInfo.cpp @@ -0,0 +1,7 @@ +#include "GameInfo.h" +#include "config/ActiveSettings.h" + +fs::path GameInfo2::GetSaveFolder() +{ + return ActiveSettings::GetMlcPath(fmt::format("usr/save/{:08x}/{:08x}", (GetBaseTitleId() >> 32), GetBaseTitleId() & 0xFFFFFFFF)); +} \ No newline at end of file diff --git a/src/Cafe/TitleList/GameInfo.h b/src/Cafe/TitleList/GameInfo.h index 6e922b93..72295ae8 100644 --- a/src/Cafe/TitleList/GameInfo.h +++ b/src/Cafe/TitleList/GameInfo.h @@ -1,8 +1,5 @@ #pragma once - -#include "config/CemuConfig.h" #include "TitleInfo.h" -#include "config/ActiveSettings.h" class GameInfo2 { @@ -116,10 +113,7 @@ public: return m_aoc.front().GetAppTitleVersion(); } - fs::path GetSaveFolder() - { - return ActiveSettings::GetMlcPath(fmt::format("usr/save/{:08x}/{:08x}", (GetBaseTitleId() >> 32), GetBaseTitleId() & 0xFFFFFFFF)); - } + fs::path GetSaveFolder(); private: bool IsPrioritizedVersionOrFormat(const TitleInfo& currentTitle, const TitleInfo& newTitle) diff --git a/src/Cemu/CMakeLists.txt b/src/Cemu/CMakeLists.txt index eb658d29..22dab274 100644 --- a/src/Cemu/CMakeLists.txt +++ b/src/Cemu/CMakeLists.txt @@ -8,6 +8,7 @@ add_library(CemuComponents Logging/CemuLogging.h napi/napi_act.cpp napi/napi_ec.cpp + napi/napi.cpp napi/napi.h napi/napi_helper.cpp napi/napi_helper.h @@ -40,7 +41,7 @@ endif() set_property(TARGET CemuComponents PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(CemuComponents REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuComponents) target_include_directories(CemuComponents PUBLIC "../") diff --git a/src/Cemu/DiscordPresence/DiscordRPCLite.cpp b/src/Cemu/DiscordPresence/DiscordRPCLite.cpp index bd04e96f..5459d553 100644 --- a/src/Cemu/DiscordPresence/DiscordRPCLite.cpp +++ b/src/Cemu/DiscordPresence/DiscordRPCLite.cpp @@ -22,7 +22,10 @@ namespace shim #include #else #include +#include +#include #include +#include #include #endif @@ -680,4 +683,4 @@ void DiscordRPCLite::WorkerThread(std::string applicationId) pipe.SendPresenceUpdate({}); std::this_thread::sleep_for(std::chrono::milliseconds(75)); } -} \ No newline at end of file +} diff --git a/src/Cemu/napi/napi.cpp b/src/Cemu/napi/napi.cpp new file mode 100644 index 00000000..13812285 --- /dev/null +++ b/src/Cemu/napi/napi.cpp @@ -0,0 +1,12 @@ +#include "napi.h" +#include "config/CemuConfig.h" +#include "config/NetworkSettings.h" +#include "config/ActiveSettings.h" + +namespace NAPI +{ + NetworkService AuthInfo::GetService() const + { + return serviceOverwrite.value_or(ActiveSettings::GetNetworkService()); + } +} diff --git a/src/Cemu/napi/napi.h b/src/Cemu/napi/napi.h index e1397d62..47c843d0 100644 --- a/src/Cemu/napi/napi.h +++ b/src/Cemu/napi/napi.h @@ -1,7 +1,8 @@ #pragma once -#include "config/CemuConfig.h" // for ConsoleLanguage -#include "config/NetworkSettings.h" // for NetworkService -#include "config/ActiveSettings.h" // for GetNetworkService() + +enum class NetworkService; +enum class CafeConsoleRegion; +enum class CafeConsoleLanguage; enum class NAPI_RESULT { @@ -43,10 +44,7 @@ namespace NAPI // service selection, if not set fall back to global setting std::optional serviceOverwrite; - NetworkService GetService() const - { - return serviceOverwrite.value_or(ActiveSettings::GetNetworkService()); - } + NetworkService GetService() const; }; bool NAPI_MakeAuthInfoFromCurrentAccount(AuthInfo& authInfo); // helper function. Returns false if online credentials/dumped files are not available diff --git a/src/Cemu/napi/napi_act.cpp b/src/Cemu/napi/napi_act.cpp index c72d9f47..80f5d7b7 100644 --- a/src/Cemu/napi/napi_act.cpp +++ b/src/Cemu/napi/napi_act.cpp @@ -1,16 +1,12 @@ #include "Common/precompiled.h" +#include "Cafe/Account/Account.h" #include "Cemu/ncrypto/ncrypto.h" #include "napi.h" #include "napi_helper.h" - #include "curl/curl.h" -#include "pugixml.hpp" -#include "Cafe/IOSU/legacy/iosu_crypto.h" - #include "config/ActiveSettings.h" #include "util/helpers/StringHelpers.h" #include "util/highresolutiontimer/HighResolutionTimer.h" -#include "config/LaunchSettings.h" namespace NAPI { diff --git a/src/Cemu/ncrypto/ncrypto.cpp b/src/Cemu/ncrypto/ncrypto.cpp index bbda681f..28b3bac9 100644 --- a/src/Cemu/ncrypto/ncrypto.cpp +++ b/src/Cemu/ncrypto/ncrypto.cpp @@ -1,6 +1,7 @@ #include "Common/precompiled.h" #include "Cemu/ncrypto/ncrypto.h" #include "util/helpers/helpers.h" +#include "config/CemuConfig.h" #include "openssl/bn.h" #include "openssl/ec.h" diff --git a/src/Cemu/ncrypto/ncrypto.h b/src/Cemu/ncrypto/ncrypto.h index 1ed7e91b..5c5e5557 100644 --- a/src/Cemu/ncrypto/ncrypto.h +++ b/src/Cemu/ncrypto/ncrypto.h @@ -1,6 +1,6 @@ #pragma once -#include "Common/betype.h" -#include "config/CemuConfig.h" // for ConsoleRegion + +enum class CafeConsoleRegion; /* OpenSSL forward declarations */ typedef struct ec_key_st EC_KEY; diff --git a/src/Common/CMakeLists.txt b/src/Common/CMakeLists.txt index 8b0a456c..cb80eb69 100644 --- a/src/Common/CMakeLists.txt +++ b/src/Common/CMakeLists.txt @@ -53,7 +53,7 @@ if(LINUX) ) endif() -# the precompiled header is produced by CemuCommon and reused by all the other targets +# CemuCommon always builts the precompiled header target_precompile_headers(CemuCommon PRIVATE precompiled.h) target_include_directories(CemuCommon PUBLIC "../") @@ -70,6 +70,7 @@ endif() # - boost/predef/os.h is included in platform.h # - fmt/core.h is included in precompiled.h target_link_libraries(CemuCommon PUBLIC + Threads::Threads # necessary because some targets may need -pthreads Boost::nowide Boost::headers fmt::fmt diff --git a/src/Common/ExceptionHandler/ELFSymbolTable.cpp b/src/Common/ExceptionHandler/ELFSymbolTable.cpp index 0f297bdd..7258338e 100644 --- a/src/Common/ExceptionHandler/ELFSymbolTable.cpp +++ b/src/Common/ExceptionHandler/ELFSymbolTable.cpp @@ -2,6 +2,8 @@ #include "Common/FileStream.h" #include #include +#include +#include uint16 ELFSymbolTable::FindSection(int type, const std::string_view& name) { @@ -33,7 +35,7 @@ ELFSymbolTable::ELFSymbolTable() { // create file handle int fd = open("/proc/self/exe", O_RDONLY); - if (!fd) + if (fd < 0) return; // retrieve file size. diff --git a/src/Common/precompiled.h b/src/Common/precompiled.h index f48bba47..6a4f3f57 100644 --- a/src/Common/precompiled.h +++ b/src/Common/precompiled.h @@ -75,11 +75,11 @@ #include #include #include +#include #include #include #include -#include #include #include diff --git a/src/Common/socket.h b/src/Common/socket.h index 37d53c09..af0805cf 100644 --- a/src/Common/socket.h +++ b/src/Common/socket.h @@ -3,14 +3,32 @@ #if BOOST_OS_WINDOWS #include +#include typedef int socklen_t; -#else +#define GETLASTERR WSAGetLastError() + +#elif BOOST_OS_UNIX #include +#include +#include +#include +#include +#include + +#define WSAEWOULDBLOCK EWOULDBLOCK +#define WSAEINPROGRESS EINPROGRESS +#define WSAESHUTDOWN ESHUTDOWN +#define WSAECONNABORTED ECONNABORTED +#define WSAHOST_NOT_FOUND EAI_NONAME +#define WSAENOTCONN ENOTCONN + +#define GETLASTERR errno + #define SOCKET int #define closesocket close #define SOCKET_ERROR -1 #define INVALID_SOCKET -1 -#endif +#endif // BOOST_OS_UNIX diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 40c4ee22..7f2d6264 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -7,7 +7,7 @@ add_library(CemuAudio set_property(TARGET CemuAudio PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(CemuAudio REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuAudio) if(WIN32) target_sources(CemuAudio PRIVATE diff --git a/src/config/ActiveSettings.cpp b/src/config/ActiveSettings.cpp index 3ecd8855..862ac6c3 100644 --- a/src/config/ActiveSettings.cpp +++ b/src/config/ActiveSettings.cpp @@ -1,12 +1,13 @@ #include "Cafe/GameProfile/GameProfile.h" #include "Cafe/IOSU/legacy/iosu_crypto.h" +#include "Cafe/HW/Latte/Core/Latte.h" #include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h" #include "Cafe/CafeSystem.h" #include "Cemu/Logging/CemuLogging.h" #include "config/ActiveSettings.h" #include "config/LaunchSettings.h" +#include "Cafe/Account/Account.h" #include "util/helpers/helpers.h" -#include "Cafe/HW/Latte/Core/Latte.h" void ActiveSettings::SetPaths(bool isPortableMode, const fs::path& executablePath, diff --git a/src/config/ActiveSettings.h b/src/config/ActiveSettings.h index 91555bb4..19cce79b 100644 --- a/src/config/ActiveSettings.h +++ b/src/config/ActiveSettings.h @@ -1,6 +1,4 @@ #pragma once - -#include #include "config/CemuConfig.h" #include "config/NetworkSettings.h" diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt index 1c1f8cbc..34720b3f 100644 --- a/src/config/CMakeLists.txt +++ b/src/config/CMakeLists.txt @@ -13,7 +13,7 @@ add_library(CemuConfig set_property(TARGET CemuConfig PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(CemuConfig REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuConfig) target_include_directories(CemuConfig PUBLIC "../") diff --git a/src/config/CemuConfig.cpp b/src/config/CemuConfig.cpp index 51f18a57..097587f8 100644 --- a/src/config/CemuConfig.cpp +++ b/src/config/CemuConfig.cpp @@ -1,10 +1,7 @@ #include "config/CemuConfig.h" -#include "WindowSystem.h" - #include "util/helpers/helpers.h" #include "config/ActiveSettings.h" - -#include "ActiveSettings.h" +#include "Cafe/Account/Account.h" void CemuConfig::SetMLCPath(fs::path path, bool save) { diff --git a/src/config/CemuConfig.h b/src/config/CemuConfig.h index 1f230093..6778ceb5 100644 --- a/src/config/CemuConfig.h +++ b/src/config/CemuConfig.h @@ -2,8 +2,6 @@ #include "ConfigValue.h" #include "XMLConfig.h" -#include "util/math/vector2.h" -#include "Cafe/Account/Account.h" enum class NetworkService; @@ -489,7 +487,7 @@ struct CemuConfig // account struct { - ConfigValueBounds m_persistent_id{ Account::kMinPersistendId, Account::kMinPersistendId, 0xFFFFFFFF }; + ConfigValueBounds m_persistent_id{0x80000001, 0x80000001, 0xFFFFFFFF}; ConfigValue legacy_online_enabled{false}; ConfigValue legacy_active_service{0}; std::unordered_map service_select; // per-account service index. Key is persistentId diff --git a/src/gui/interface/WindowSystem.h b/src/gui/interface/WindowSystem.h index 89e35ee6..b2346c17 100644 --- a/src/gui/interface/WindowSystem.h +++ b/src/gui/interface/WindowSystem.h @@ -1,6 +1,5 @@ #pragma once -#include "config/CemuConfig.h" #include "input/api/ControllerState.h" namespace WindowSystem diff --git a/src/gui/wxgui/CMakeLists.txt b/src/gui/wxgui/CMakeLists.txt index f625f614..12fc62d9 100644 --- a/src/gui/wxgui/CMakeLists.txt +++ b/src/gui/wxgui/CMakeLists.txt @@ -132,7 +132,7 @@ endif() set_property(TARGET CemuWxGui PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(CemuWxGui REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuWxGui) target_include_directories(CemuWxGui PUBLIC "../") diff --git a/src/gui/wxgui/GameUpdateWindow.cpp b/src/gui/wxgui/GameUpdateWindow.cpp index b50f1d38..253a7610 100644 --- a/src/gui/wxgui/GameUpdateWindow.cpp +++ b/src/gui/wxgui/GameUpdateWindow.cpp @@ -1,14 +1,10 @@ #include "wxgui/wxgui.h" #include "wxgui/GameUpdateWindow.h" #include "util/helpers/helpers.h" - -#include -#include #include "util/helpers/SystemException.h" -#include "wxgui/CemuApp.h" #include "Cafe/TitleList/GameInfo.h" +#include "config/ActiveSettings.h" #include "wxgui/helpers/wxHelpers.h" -#include "wxHelper.h" wxString _GetTitleIdTypeStr(TitleId titleId) { diff --git a/src/gui/wxgui/wxCemuConfig.h b/src/gui/wxgui/wxCemuConfig.h index 38802ab4..0be9ea2f 100644 --- a/src/gui/wxgui/wxCemuConfig.h +++ b/src/gui/wxgui/wxCemuConfig.h @@ -1,6 +1,5 @@ #pragma once -#include "config/CemuConfig.h" #include "config/XMLConfig.h" #include "util/math/vector2.h" diff --git a/src/imgui/CMakeLists.txt b/src/imgui/CMakeLists.txt index a77b807b..e2d669c5 100644 --- a/src/imgui/CMakeLists.txt +++ b/src/imgui/CMakeLists.txt @@ -18,7 +18,7 @@ endif () set_property(TARGET imguiImpl PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(imguiImpl REUSE_FROM CemuCommon) +cemu_use_precompiled_header(imguiImpl) target_include_directories(imguiImpl PUBLIC "../") diff --git a/src/input/CMakeLists.txt b/src/input/CMakeLists.txt index 7953c26b..d24a5ca0 100644 --- a/src/input/CMakeLists.txt +++ b/src/input/CMakeLists.txt @@ -43,7 +43,7 @@ add_library(CemuInput set_property(TARGET CemuInput PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(CemuInput REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuInput) if(WIN32) # XInput diff --git a/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp b/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp index a6bdf574..07c74dd0 100644 --- a/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp +++ b/src/input/api/Wiimote/l2cap/L2CapWiimote.cpp @@ -1,5 +1,7 @@ #include "L2CapWiimote.h" #include +#include +#include constexpr auto comparator = [](const bdaddr_t& a, const bdaddr_t& b) { return bacmp(&a, &b); @@ -145,4 +147,4 @@ bool L2CapWiimote::operator==(const WiimoteDevice& rhs) const if (!mote) return false; return bacmp(&m_addr, &mote->m_addr) == 0; -} \ No newline at end of file +} diff --git a/src/resource/CMakeLists.txt b/src/resource/CMakeLists.txt index f946a528..12415702 100644 --- a/src/resource/CMakeLists.txt +++ b/src/resource/CMakeLists.txt @@ -2,7 +2,7 @@ add_library(CemuResource) set_property(TARGET CemuResource PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(CemuResource REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuResource) enable_language(ASM) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index e8e45ff9..390e9c10 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -89,7 +89,7 @@ endif() set_property(TARGET CemuUtil PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") -target_precompile_headers(CemuUtil REUSE_FROM CemuCommon) +cemu_use_precompiled_header(CemuUtil) target_include_directories(CemuUtil PUBLIC "../")