build: Remove unnecessary includes to improve compile times

Also revert PCH reuse for everything but MSVC. Other compilers/platforms have limitations that make reused PCH a bit too fragile. I got it to work but only after forcing certain flags globally (like -pthread) and I dont think its a good idea to do that
This commit is contained in:
Exzap 2026-03-06 07:49:26 +01:00
parent 8e2e2c44bb
commit a5ae41fdbe
46 changed files with 150 additions and 140 deletions

View File

@ -9,6 +9,8 @@ set(EMULATOR_VERSION_MAJOR "0" CACHE STRING "")
set(EMULATOR_VERSION_MINOR "0" CACHE STRING "") set(EMULATOR_VERSION_MINOR "0" CACHE STRING "")
set(EMULATOR_VERSION_PATCH "0" CACHE STRING "") set(EMULATOR_VERSION_PATCH "0" CACHE STRING "")
set(THREADS_PREFER_PTHREAD_FLAG true) # needs to be set before vcpkg
execute_process( execute_process(
COMMAND git log --format=%h -1 COMMAND git log --format=%h -1
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} 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) option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON)
set(THREADS_PREFER_PTHREAD_FLAG true)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
find_package(CURL REQUIRED) find_package(CURL REQUIRED)

View File

@ -39,6 +39,15 @@ add_compile_definitions(VK_NO_PROTOTYPES)
set(CMAKE_INCLUDE_CURRENT_DIR ON) 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(Common)
add_subdirectory(gui) add_subdirectory(gui)
add_subdirectory(Cafe) add_subdirectory(Cafe)
@ -55,7 +64,7 @@ add_executable(CemuBin
mainLLE.cpp mainLLE.cpp
) )
target_precompile_headers(CemuBin REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuBin)
if(MSVC AND MSVC_VERSION EQUAL 1940) if(MSVC AND MSVC_VERSION EQUAL 1940)
# workaround for an msvc issue on VS 17.10 where generated ILK files are too large # workaround for an msvc issue on VS 17.10 where generated ILK files are too large

View File

@ -1,6 +1,6 @@
#include "Account.h" #include "Account.h"
#include "AccountError.h"
#include "util/helpers/helpers.h" #include "util/helpers/helpers.h"
#include "util/helpers/SystemException.h"
#include "util/helpers/StringHelpers.h" #include "util/helpers/StringHelpers.h"
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "Cafe/IOSU/legacy/iosu_crypto.h" #include "Cafe/IOSU/legacy/iosu_crypto.h"

View File

@ -1,12 +1,8 @@
#pragma once #pragma once
#include "AccountError.h"
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <system_error> #include <system_error>
#include <vector>
#include <optional>
enum class OnlineAccountError enum class OnlineAccountError
{ {

View File

@ -525,6 +525,7 @@ add_library(CemuCafe
OS/RPL/rpl_structs.h OS/RPL/rpl_structs.h
OS/RPL/rpl_symbol_storage.cpp OS/RPL/rpl_symbol_storage.cpp
OS/RPL/rpl_symbol_storage.h OS/RPL/rpl_symbol_storage.h
TitleList/GameInfo.cpp
TitleList/GameInfo.h TitleList/GameInfo.h
TitleList/ParsedMetaXml.h TitleList/ParsedMetaXml.h
TitleList/SaveInfo.cpp TitleList/SaveInfo.cpp
@ -614,7 +615,7 @@ endif()
set_property(TARGET CemuCafe PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuCafe PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuCafe REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuCafe)
target_include_directories(CemuCafe PUBLIC "../") target_include_directories(CemuCafe PUBLIC "../")

View File

@ -1,11 +1,10 @@
#pragma once #pragma once
#include "Cafe/OS/RPL/rpl.h" #include "Cafe/OS/RPL/rpl.h"
#include "util/helpers/Semaphore.h"
#include "Cafe/TitleList/TitleId.h" #include "Cafe/TitleList/TitleId.h"
#include "config/CemuConfig.h"
enum class CosCapabilityBits : uint64; enum class CosCapabilityBits : uint64;
enum class CosCapabilityGroup : uint32; enum class CosCapabilityGroup : uint32;
enum class CafeConsoleRegion;
namespace CafeSystem namespace CafeSystem
{ {

View File

@ -1,6 +1,4 @@
#pragma once #pragma once
#include <optional>
#include "config/CemuConfig.h" #include "config/CemuConfig.h"
struct gameProfileIntegerOption_t struct gameProfileIntegerOption_t

View File

@ -1,18 +1,18 @@
#include "Cafe/GraphicPack/GraphicPack2.h" #include "Cafe/GraphicPack/GraphicPack2.h"
#include "Cafe/Filesystem/fsc.h"
#include "config/CemuConfig.h" #include "config/CemuConfig.h"
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "openssl/sha.h" #include "openssl/sha.h"
#include "Cafe/HW/Latte/Renderer/RendererOuputShader.h"
#include "Cafe/Filesystem/fsc.h"
#include "boost/algorithm/string.hpp" #include "boost/algorithm/string.hpp"
#include "util/helpers/MapAdaptor.h" #include "util/helpers/MapAdaptor.h"
#include "util/helpers/StringParser.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/helpers/StringHelpers.h"
#include "util/IniParser/IniParser.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#include "HW/Espresso/Debugger/Debugger.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 <cinttypes> #include <cinttypes>
std::vector<GraphicPackPtr> GraphicPack2::s_graphic_packs; std::vector<GraphicPackPtr> GraphicPack2::s_graphic_packs;
@ -21,6 +21,37 @@ std::atomic_bool GraphicPack2::s_isReady;
#define GP_LEGACY_VERSION (2) #define GP_LEGACY_VERSION (2)
template<typename T>
bool ParseRule(const ExpressionParser& parser, IniParser& iniParser, const char* option_name, T* valueOut)
{
auto optionValue = iniParser.FindOption(option_name);
if (optionValue)
{
*valueOut = parser.Evaluate<T>(*optionValue);
return true;
}
return false;
}
template<typename T>
std::vector<T> ParseList(const ExpressionParser& parser, IniParser& iniParser, const char* optionName)
{
std::vector<T> result;
auto optionText = iniParser.FindOption(optionName);
if (!optionText)
return result;
for (auto& token : Tokenize(*optionText, ','))
{
try
{
result.emplace_back(parser.Evaluate<T>(token));
}
catch (const std::invalid_argument&)
{}
}
return result;
}
void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath) void GraphicPack2::LoadGraphicPack(fs::path graphicPackPath)
{ {
fs::path rulesPath = graphicPackPath; fs::path rulesPath = graphicPackPath;

View File

@ -6,10 +6,10 @@
#include "util/helpers/Serializer.h" #include "util/helpers/Serializer.h"
#include "Cafe/OS/RPL/rpl.h" #include "Cafe/OS/RPL/rpl.h"
#include "Cemu/PPCAssembler/ppcAssembler.h" #include "Cemu/PPCAssembler/ppcAssembler.h"
#include <variant>
#include "Cafe/HW/Latte/Renderer/Renderer.h"
#include "GraphicPack2Patches.h" #include "GraphicPack2Patches.h"
#include "util/IniParser/IniParser.h"
enum class RendererAPI;
enum class GfxVendor;
class GraphicPack2 class GraphicPack2
{ {
@ -99,7 +99,7 @@ public:
}; };
using PresetPtr = std::shared_ptr<Preset>; using PresetPtr = std::shared_ptr<Preset>;
GraphicPack2(fs::path rulesPath, IniParser& rules); GraphicPack2(fs::path rulesPath, class IniParser& rules);
bool IsEnabled() const { return m_enabled; } bool IsEnabled() const { return m_enabled; }
bool IsActivated() const { return m_activated; } 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::string m_output_shader_source, m_upscaling_shader_source, m_downscaling_shader_source;
std::unique_ptr<RendererOutputShader> m_output_shader, m_upscaling_shader, m_downscaling_shader, m_output_shader_ud, m_upscaling_shader_ud, m_downscaling_shader_ud; std::unique_ptr<RendererOutputShader> m_output_shader, m_upscaling_shader, m_downscaling_shader, m_output_shader_ud, m_upscaling_shader_ud, m_downscaling_shader_ud;
template<typename T>
bool ParseRule(const ExpressionParser& parser, IniParser& iniParser, const char* option_name, T* value_out) const;
template<typename T>
std::vector<T> ParseList(const ExpressionParser& parser, IniParser& iniParser, const char* option_name) const;
std::unordered_map<std::string, PresetVar> ParsePresetVars(IniParser& rules) const; std::unordered_map<std::string, PresetVar> ParsePresetVars(IniParser& rules) const;
std::vector<uint64> ParseTitleIds(IniParser& rules, const char* option_name); std::vector<uint64> ParseTitleIds(IniParser& rules, const char* option_name);
@ -307,37 +301,3 @@ public:
}; };
using GraphicPackPtr = std::shared_ptr<GraphicPack2>; using GraphicPackPtr = std::shared_ptr<GraphicPack2>;
template <typename T>
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<T>(*option_value);
return true;
}
return false;
}
template <typename T>
std::vector<T> GraphicPack2::ParseList(const ExpressionParser& parser, IniParser& iniParser, const char* option_name) const
{
std::vector<T> 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<T>(token));
}
catch (const std::invalid_argument&) {}
}
return result;
}

View File

@ -12,6 +12,10 @@
#include "Cafe/HW/Espresso/EspressoISA.h" #include "Cafe/HW/Espresso/EspressoISA.h"
#include "Common/socket.h" #include "Common/socket.h"
#if BOOST_OS_UNIX
#include <netinet/tcp.h>
#endif
#define GET_THREAD_ID(threadPtr) memory_getVirtualOffsetFromPointer(threadPtr) #define GET_THREAD_ID(threadPtr) memory_getVirtualOffsetFromPointer(threadPtr)
#define GET_THREAD_BY_ID(threadId) (OSThread_t*)memory_getPointerFromPhysicalOffset(threadId) #define GET_THREAD_BY_ID(threadId) (OSThread_t*)memory_getPointerFromPhysicalOffset(threadId)

View File

@ -1,11 +1,10 @@
#include "Cafe/HW/Latte/Core/LatteOverlay.h" #include "Cafe/HW/Latte/Core/LatteOverlay.h"
#include "Cafe/HW/Latte/Core/LattePerformanceMonitor.h" #include "Cafe/HW/Latte/Core/LattePerformanceMonitor.h"
#include "WindowSystem.h"
#include "config/CemuConfig.h"
#include "Cafe/HW/Latte/Renderer/Renderer.h" #include "Cafe/HW/Latte/Renderer/Renderer.h"
#include "Cafe/Account/Account.h"
#include "config/CemuConfig.h"
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "WindowSystem.h"
#include <imgui.h> #include <imgui.h>
#include "resource/IconsFontAwesome5.h" #include "resource/IconsFontAwesome5.h"

View File

@ -1,6 +1,7 @@
#include "Cafe/HW/Latte/Core/Latte.h"
#include "Cafe/HW/Latte/Core/LatteTexture.h" #include "Cafe/HW/Latte/Core/LatteTexture.h"
#include "Cafe/HW/Latte/Core/LatteTextureView.h" #include "Cafe/HW/Latte/Core/LatteTextureView.h"
#include "Cafe/HW/Latte/Core/Latte.h" #include "LatteCachedFBO.h"
#include "Cafe/GraphicPack/GraphicPack2.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) LatteTextureView::LatteTextureView(LatteTexture* texture, sint32 firstMip, sint32 mipCount, sint32 firstSlice, sint32 sliceCount, Latte::E_DIM dim, Latte::E_GX2SURFFMT format, bool registerView)

View File

@ -10,7 +10,7 @@
#include "util/helpers/StringHelpers.h" #include "util/helpers/StringHelpers.h"
#include "Cafe/IOSU/iosu_types_common.h" #include "Cafe/IOSU/iosu_types_common.h"
#include "Cafe/IOSU/nn/iosu_nn_service.h" #include "Cafe/IOSU/nn/iosu_nn_service.h"
#include "Common/socket.h"
#include "Common/CafeString.h" #include "Common/CafeString.h"
std::mutex g_friend_notification_mutex; std::mutex g_friend_notification_mutex;

View File

@ -11,6 +11,8 @@
#include "Cemu/napi/napi.h" #include "Cemu/napi/napi.h"
#include "Cemu/ncrypto/ncrypto.h" #include "Cemu/ncrypto/ncrypto.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#include "Cafe/Account/Account.h"
#include "config/ActiveSettings.h"
namespace iosu namespace iosu
{ {

View File

@ -1,7 +1,5 @@
#include "Cafe/OS/libs/nn_common.h" #include "Cafe/OS/libs/nn_common.h"
#include "Cafe/OS/libs/coreinit/coreinit_Time.h"
#include "util/helpers/helpers.h" #include "util/helpers/helpers.h"
#include "Cafe/Filesystem/fsc.h"
#include "Cafe/IOSU/iosu_types_common.h" #include "Cafe/IOSU/iosu_types_common.h"
#include "Cafe/IOSU/nn/iosu_nn_service.h" #include "Cafe/IOSU/nn/iosu_nn_service.h"
@ -9,6 +7,7 @@
#include "Cafe/IOSU/legacy/iosu_act.h" #include "Cafe/IOSU/legacy/iosu_act.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "Cafe/Account/Account.h"
#include "boss_service.h" #include "boss_service.h"
#include "boss_common.h" #include "boss_common.h"

View File

@ -1,6 +1,7 @@
#include "Cafe/OS/common/OSCommon.h" #include "Cafe/OS/common/OSCommon.h"
#include "Cafe/OS/libs/nn_common.h" #include "Cafe/OS/libs/nn_common.h"
#include "nn_ac.h" #include "nn_ac.h"
#include "Common/socket.h"
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
#include <iphlpapi.h> #include <iphlpapi.h>

View File

@ -5,6 +5,7 @@
#include "util/crypto/aes128.h" #include "util/crypto/aes128.h"
#include "openssl/sha.h" #include "openssl/sha.h"
#include "Cemu/napi/napi.h" #include "Cemu/napi/napi.h"
#include "config/ActiveSettings.h"
namespace nn namespace nn
{ {

View File

@ -8,23 +8,8 @@
#include "Common/socket.h" #include "Common/socket.h"
#if BOOST_OS_UNIX #if BOOST_OS_UNIX
#include <netinet/tcp.h>
#define WSAEWOULDBLOCK EWOULDBLOCK #endif
#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
#define WU_AF_INET 2 #define WU_AF_INET 2

View File

@ -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));
}

View File

@ -1,8 +1,5 @@
#pragma once #pragma once
#include "config/CemuConfig.h"
#include "TitleInfo.h" #include "TitleInfo.h"
#include "config/ActiveSettings.h"
class GameInfo2 class GameInfo2
{ {
@ -116,10 +113,7 @@ public:
return m_aoc.front().GetAppTitleVersion(); return m_aoc.front().GetAppTitleVersion();
} }
fs::path GetSaveFolder() fs::path GetSaveFolder();
{
return ActiveSettings::GetMlcPath(fmt::format("usr/save/{:08x}/{:08x}", (GetBaseTitleId() >> 32), GetBaseTitleId() & 0xFFFFFFFF));
}
private: private:
bool IsPrioritizedVersionOrFormat(const TitleInfo& currentTitle, const TitleInfo& newTitle) bool IsPrioritizedVersionOrFormat(const TitleInfo& currentTitle, const TitleInfo& newTitle)

View File

@ -8,6 +8,7 @@ add_library(CemuComponents
Logging/CemuLogging.h Logging/CemuLogging.h
napi/napi_act.cpp napi/napi_act.cpp
napi/napi_ec.cpp napi/napi_ec.cpp
napi/napi.cpp
napi/napi.h napi/napi.h
napi/napi_helper.cpp napi/napi_helper.cpp
napi/napi_helper.h napi/napi_helper.h
@ -40,7 +41,7 @@ endif()
set_property(TARGET CemuComponents PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuComponents PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuComponents REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuComponents)
target_include_directories(CemuComponents PUBLIC "../") target_include_directories(CemuComponents PUBLIC "../")

View File

@ -22,7 +22,10 @@ namespace shim
#include <windows.h> #include <windows.h>
#else #else
#include <fcntl.h> #include <fcntl.h>
#include <poll.h>
#include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h> #include <unistd.h>
#endif #endif

12
src/Cemu/napi/napi.cpp Normal file
View File

@ -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());
}
}

View File

@ -1,7 +1,8 @@
#pragma once #pragma once
#include "config/CemuConfig.h" // for ConsoleLanguage
#include "config/NetworkSettings.h" // for NetworkService enum class NetworkService;
#include "config/ActiveSettings.h" // for GetNetworkService() enum class CafeConsoleRegion;
enum class CafeConsoleLanguage;
enum class NAPI_RESULT enum class NAPI_RESULT
{ {
@ -43,10 +44,7 @@ namespace NAPI
// service selection, if not set fall back to global setting // service selection, if not set fall back to global setting
std::optional<NetworkService> serviceOverwrite; std::optional<NetworkService> serviceOverwrite;
NetworkService GetService() const NetworkService GetService() const;
{
return serviceOverwrite.value_or(ActiveSettings::GetNetworkService());
}
}; };
bool NAPI_MakeAuthInfoFromCurrentAccount(AuthInfo& authInfo); // helper function. Returns false if online credentials/dumped files are not available bool NAPI_MakeAuthInfoFromCurrentAccount(AuthInfo& authInfo); // helper function. Returns false if online credentials/dumped files are not available

View File

@ -1,16 +1,12 @@
#include "Common/precompiled.h" #include "Common/precompiled.h"
#include "Cafe/Account/Account.h"
#include "Cemu/ncrypto/ncrypto.h" #include "Cemu/ncrypto/ncrypto.h"
#include "napi.h" #include "napi.h"
#include "napi_helper.h" #include "napi_helper.h"
#include "curl/curl.h" #include "curl/curl.h"
#include "pugixml.hpp"
#include "Cafe/IOSU/legacy/iosu_crypto.h"
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "util/helpers/StringHelpers.h" #include "util/helpers/StringHelpers.h"
#include "util/highresolutiontimer/HighResolutionTimer.h" #include "util/highresolutiontimer/HighResolutionTimer.h"
#include "config/LaunchSettings.h"
namespace NAPI namespace NAPI
{ {

View File

@ -1,6 +1,7 @@
#include "Common/precompiled.h" #include "Common/precompiled.h"
#include "Cemu/ncrypto/ncrypto.h" #include "Cemu/ncrypto/ncrypto.h"
#include "util/helpers/helpers.h" #include "util/helpers/helpers.h"
#include "config/CemuConfig.h"
#include "openssl/bn.h" #include "openssl/bn.h"
#include "openssl/ec.h" #include "openssl/ec.h"

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Common/betype.h"
#include "config/CemuConfig.h" // for ConsoleRegion enum class CafeConsoleRegion;
/* OpenSSL forward declarations */ /* OpenSSL forward declarations */
typedef struct ec_key_st EC_KEY; typedef struct ec_key_st EC_KEY;

View File

@ -53,7 +53,7 @@ if(LINUX)
) )
endif() 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_precompile_headers(CemuCommon PRIVATE precompiled.h)
target_include_directories(CemuCommon PUBLIC "../") target_include_directories(CemuCommon PUBLIC "../")
@ -70,6 +70,7 @@ endif()
# - boost/predef/os.h is included in platform.h # - boost/predef/os.h is included in platform.h
# - fmt/core.h is included in precompiled.h # - fmt/core.h is included in precompiled.h
target_link_libraries(CemuCommon PUBLIC target_link_libraries(CemuCommon PUBLIC
Threads::Threads # necessary because some targets may need -pthreads
Boost::nowide Boost::nowide
Boost::headers Boost::headers
fmt::fmt fmt::fmt

View File

@ -2,6 +2,8 @@
#include "Common/FileStream.h" #include "Common/FileStream.h"
#include <sys/mman.h> #include <sys/mman.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
uint16 ELFSymbolTable::FindSection(int type, const std::string_view& name) uint16 ELFSymbolTable::FindSection(int type, const std::string_view& name)
{ {
@ -33,7 +35,7 @@ ELFSymbolTable::ELFSymbolTable()
{ {
// create file handle // create file handle
int fd = open("/proc/self/exe", O_RDONLY); int fd = open("/proc/self/exe", O_RDONLY);
if (!fd) if (fd < 0)
return; return;
// retrieve file size. // retrieve file size.

View File

@ -75,11 +75,11 @@
#include <optional> #include <optional>
#include <span> #include <span>
#include <ranges> #include <ranges>
#include <variant>
#include <boost/predef.h> #include <boost/predef.h>
#include <boost/nowide/convert.hpp> #include <boost/nowide/convert.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp> #include <glm/gtc/quaternion.hpp>

View File

@ -3,14 +3,32 @@
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
#include <WinSock2.h> #include <WinSock2.h>
#include <ws2tcpip.h>
typedef int socklen_t; typedef int socklen_t;
#else #define GETLASTERR WSAGetLastError()
#elif BOOST_OS_UNIX
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#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 SOCKET int
#define closesocket close #define closesocket close
#define SOCKET_ERROR -1 #define SOCKET_ERROR -1
#define INVALID_SOCKET -1 #define INVALID_SOCKET -1
#endif #endif // BOOST_OS_UNIX

View File

@ -7,7 +7,7 @@ add_library(CemuAudio
set_property(TARGET CemuAudio PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuAudio PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuAudio REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuAudio)
if(WIN32) if(WIN32)
target_sources(CemuAudio PRIVATE target_sources(CemuAudio PRIVATE

View File

@ -1,12 +1,13 @@
#include "Cafe/GameProfile/GameProfile.h" #include "Cafe/GameProfile/GameProfile.h"
#include "Cafe/IOSU/legacy/iosu_crypto.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/HW/Latte/Renderer/Vulkan/VulkanAPI.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
#include "Cemu/Logging/CemuLogging.h" #include "Cemu/Logging/CemuLogging.h"
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "config/LaunchSettings.h" #include "config/LaunchSettings.h"
#include "Cafe/Account/Account.h"
#include "util/helpers/helpers.h" #include "util/helpers/helpers.h"
#include "Cafe/HW/Latte/Core/Latte.h"
void ActiveSettings::SetPaths(bool isPortableMode, void ActiveSettings::SetPaths(bool isPortableMode,
const fs::path& executablePath, const fs::path& executablePath,

View File

@ -1,6 +1,4 @@
#pragma once #pragma once
#include <utility>
#include "config/CemuConfig.h" #include "config/CemuConfig.h"
#include "config/NetworkSettings.h" #include "config/NetworkSettings.h"

View File

@ -13,7 +13,7 @@ add_library(CemuConfig
set_property(TARGET CemuConfig PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuConfig PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuConfig REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuConfig)
target_include_directories(CemuConfig PUBLIC "../") target_include_directories(CemuConfig PUBLIC "../")

View File

@ -1,10 +1,7 @@
#include "config/CemuConfig.h" #include "config/CemuConfig.h"
#include "WindowSystem.h"
#include "util/helpers/helpers.h" #include "util/helpers/helpers.h"
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "Cafe/Account/Account.h"
#include "ActiveSettings.h"
void CemuConfig::SetMLCPath(fs::path path, bool save) void CemuConfig::SetMLCPath(fs::path path, bool save)
{ {

View File

@ -2,8 +2,6 @@
#include "ConfigValue.h" #include "ConfigValue.h"
#include "XMLConfig.h" #include "XMLConfig.h"
#include "util/math/vector2.h"
#include "Cafe/Account/Account.h"
enum class NetworkService; enum class NetworkService;
@ -489,7 +487,7 @@ struct CemuConfig
// account // account
struct struct
{ {
ConfigValueBounds<uint32> m_persistent_id{ Account::kMinPersistendId, Account::kMinPersistendId, 0xFFFFFFFF }; ConfigValueBounds<uint32> m_persistent_id{0x80000001, 0x80000001, 0xFFFFFFFF};
ConfigValue<bool> legacy_online_enabled{false}; ConfigValue<bool> legacy_online_enabled{false};
ConfigValue<int> legacy_active_service{0}; ConfigValue<int> legacy_active_service{0};
std::unordered_map<uint32, NetworkService> service_select; // per-account service index. Key is persistentId std::unordered_map<uint32, NetworkService> service_select; // per-account service index. Key is persistentId

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "config/CemuConfig.h"
#include "input/api/ControllerState.h" #include "input/api/ControllerState.h"
namespace WindowSystem namespace WindowSystem

View File

@ -132,7 +132,7 @@ endif()
set_property(TARGET CemuWxGui PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuWxGui PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuWxGui REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuWxGui)
target_include_directories(CemuWxGui PUBLIC "../") target_include_directories(CemuWxGui PUBLIC "../")

View File

@ -1,14 +1,10 @@
#include "wxgui/wxgui.h" #include "wxgui/wxgui.h"
#include "wxgui/GameUpdateWindow.h" #include "wxgui/GameUpdateWindow.h"
#include "util/helpers/helpers.h" #include "util/helpers/helpers.h"
#include <filesystem>
#include <sstream>
#include "util/helpers/SystemException.h" #include "util/helpers/SystemException.h"
#include "wxgui/CemuApp.h"
#include "Cafe/TitleList/GameInfo.h" #include "Cafe/TitleList/GameInfo.h"
#include "config/ActiveSettings.h"
#include "wxgui/helpers/wxHelpers.h" #include "wxgui/helpers/wxHelpers.h"
#include "wxHelper.h"
wxString _GetTitleIdTypeStr(TitleId titleId) wxString _GetTitleIdTypeStr(TitleId titleId)
{ {

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "config/CemuConfig.h"
#include "config/XMLConfig.h" #include "config/XMLConfig.h"
#include "util/math/vector2.h" #include "util/math/vector2.h"

View File

@ -18,7 +18,7 @@ endif ()
set_property(TARGET imguiImpl PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET imguiImpl PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(imguiImpl REUSE_FROM CemuCommon) cemu_use_precompiled_header(imguiImpl)
target_include_directories(imguiImpl PUBLIC "../") target_include_directories(imguiImpl PUBLIC "../")

View File

@ -43,7 +43,7 @@ add_library(CemuInput
set_property(TARGET CemuInput PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuInput PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuInput REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuInput)
if(WIN32) if(WIN32)
# XInput # XInput

View File

@ -1,5 +1,7 @@
#include "L2CapWiimote.h" #include "L2CapWiimote.h"
#include <bluetooth/l2cap.h> #include <bluetooth/l2cap.h>
#include <fcntl.h>
#include <unistd.h>
constexpr auto comparator = [](const bdaddr_t& a, const bdaddr_t& b) { constexpr auto comparator = [](const bdaddr_t& a, const bdaddr_t& b) {
return bacmp(&a, &b); return bacmp(&a, &b);

View File

@ -2,7 +2,7 @@ add_library(CemuResource)
set_property(TARGET CemuResource PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuResource PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuResource REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuResource)
enable_language(ASM) enable_language(ASM)

View File

@ -89,7 +89,7 @@ endif()
set_property(TARGET CemuUtil PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set_property(TARGET CemuUtil PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuUtil REUSE_FROM CemuCommon) cemu_use_precompiled_header(CemuUtil)
target_include_directories(CemuUtil PUBLIC "../") target_include_directories(CemuUtil PUBLIC "../")