mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 09:09:18 +01:00
Initial macOS port bringup (#52)
This commit is contained in:
parent
a2abffd37b
commit
974edaa649
@ -20,11 +20,13 @@ if(MSVC)
|
||||
# _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
|
||||
# _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
||||
elseif(UNIX)
|
||||
if(NOT APPLE)
|
||||
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) # legacy. Do we need to support XLIB surfaces?
|
||||
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
|
||||
endif()
|
||||
add_definitions(-fms-extensions)
|
||||
add_definitions(-fms-compatibility-version=19.14)
|
||||
add_definitions(-fdelayed-template-parsing)
|
||||
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) # legacy. Do we need to support XLIB surfaces?
|
||||
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
|
||||
add_definitions(-maes)
|
||||
# warnings
|
||||
add_compile_options(-Wno-switch -Wno-ignored-attributes -Wno-deprecated-enum-enum-conversion -Wno-ambiguous-reversed-operator)
|
||||
|
@ -364,7 +364,7 @@ void cemu_initForGame()
|
||||
time_t theTime = (time(NULL) - 946684800);
|
||||
{
|
||||
tm* lt = localtime(&theTime);
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
theTime = _mkgmtime(lt);
|
||||
#else
|
||||
theTime = timegm(lt);
|
||||
|
@ -1029,7 +1029,7 @@ bool FSTVerifier::VerifyContentFile(FileStream* fileContent, const NCrypto::AesK
|
||||
SHA256_Init(&sha256Ctx);
|
||||
while (remainingBytes > 0)
|
||||
{
|
||||
uint32 bytesToRead = (uint32)std::min(remainingBytes, buffer.size());
|
||||
uint32 bytesToRead = (uint32)std::min(remainingBytes, (uint64)buffer.size());
|
||||
uint32 bytesToReadPadded = ((bytesToRead + 0xF) & ~0xF);
|
||||
uint32 bytesRead = fileContent->readData(buffer.data(), bytesToReadPadded);
|
||||
if (bytesRead != bytesToReadPadded)
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "Cafe/OS/libs/coreinit/coreinit.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
@ -158,7 +158,7 @@ void debugger_updateMemoryBreakpoint(DebuggerBreakpoint* bp)
|
||||
{
|
||||
std::vector<std::thread::native_handle_type> schedulerThreadHandles = coreinit::OSGetSchedulerThreads();
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
debuggerState.activeMemoryBreakpoint = bp;
|
||||
for (auto& hThreadNH : schedulerThreadHandles)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "util/helpers/fspinlock.h"
|
||||
#include "util/highresolutiontimer/HighResolutionTimer.h"
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
static __inline__
|
||||
unsigned __int64 _umul128(unsigned __int64,
|
||||
unsigned __int64,
|
||||
@ -113,7 +113,7 @@ uint64 PPCTimer_microsecondsToTsc(uint64 us)
|
||||
uint64 PPCTimer_tscToMicroseconds(uint64 us)
|
||||
{
|
||||
uint128_t r{};
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
r.low = _umul128(us, 1000000ULL, &r.high);
|
||||
#else
|
||||
r.low = _umul128(us, 1000000ULL, (unsigned long long*)&r.high);
|
||||
@ -153,7 +153,7 @@ uint64 PPCTimer_getFromRDTSC()
|
||||
rdtscDif = rdtscDif & ~(uint64)((sint64)rdtscDif >> 63);
|
||||
|
||||
uint128_t diff{};
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
diff.low = _umul128(rdtscDif, Espresso::CORE_CLOCK, &diff.high);
|
||||
#else
|
||||
diff.low = _umul128(rdtscDif, Espresso::CORE_CLOCK, (unsigned long long*)&diff.high);
|
||||
@ -163,7 +163,7 @@ uint64 PPCTimer_getFromRDTSC()
|
||||
_rdtscLastMeasure = rdtscCurrentMeasure; // only travel forward in time
|
||||
|
||||
uint8 c = 0;
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
c = _addcarry_u64(c, _rdtscAcc.low, diff.low, &_rdtscAcc.low);
|
||||
_addcarry_u64(c, _rdtscAcc.high, diff.high, &_rdtscAcc.high);
|
||||
#else
|
||||
|
@ -72,7 +72,7 @@ void PPCRecompiler_recompileIfUnvisited(uint32 enterAddress)
|
||||
|
||||
void PPCRecompiler_enter(PPCInterpreter_t* hCPU, PPCREC_JUMP_ENTRY funcPtr)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
uint32 prevState = _controlfp(0, 0);
|
||||
_controlfp(_RC_NEAR, _MCW_RC);
|
||||
PPCRecompiler_enterRecompilerCode((uint64)funcPtr, (uint64)hCPU);
|
||||
|
@ -284,7 +284,7 @@ void LatteIndices_generateAutoLineLoopIndices(void* indexDataOutput, uint32 coun
|
||||
indexMax = std::max(count, 1u) - 1;
|
||||
}
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
|
||||
#endif
|
||||
|
||||
@ -352,11 +352,11 @@ void LatteIndices_fastConvertU16_AVX2(const void* indexDataInput, void* indexDat
|
||||
indexMin = std::min(indexMin, _minIndex);
|
||||
}
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#pragma clang attribute pop
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
|
||||
#endif
|
||||
|
||||
@ -423,11 +423,11 @@ void LatteIndices_fastConvertU16_SSE41(const void* indexDataInput, void* indexDa
|
||||
indexMin = std::min(indexMin, _minIndex);
|
||||
}
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#pragma clang attribute pop
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
|
||||
#endif
|
||||
|
||||
@ -497,7 +497,7 @@ void LatteIndices_fastConvertU32_AVX2(const void* indexDataInput, void* indexDat
|
||||
indexMin = std::min(indexMin, _minIndex);
|
||||
}
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#pragma clang attribute pop
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <psapi.h>
|
||||
#endif
|
||||
|
||||
@ -189,7 +189,7 @@ void LatteShaderCache_load()
|
||||
|
||||
const auto timeLoadStart = now_cached();
|
||||
// remember current amount of committed memory
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
PROCESS_MEMORY_COUNTERS pmc1;
|
||||
GetProcessMemoryInfo(GetCurrentProcess(), &pmc1, sizeof(PROCESS_MEMORY_COUNTERS));
|
||||
LONGLONG totalMem1 = pmc1.PagefileUsage;
|
||||
@ -285,7 +285,7 @@ void LatteShaderCache_load()
|
||||
|
||||
LatteShaderCache_updateCompileQueue(0);
|
||||
// write load time and RAM usage to log file (in dev build)
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
const auto timeLoadEnd = now_cached();
|
||||
const auto timeLoad = std::chrono::duration_cast<std::chrono::milliseconds>(timeLoadEnd - timeLoadStart).count();
|
||||
PROCESS_MEMORY_COUNTERS pmc2;
|
||||
|
@ -145,7 +145,7 @@ uint32 LatteTexture_CalculateTextureDataHash(LatteTexture* hostTexture)
|
||||
bool isCompressedFormat = hostTexture->IsCompressedFormat();
|
||||
if( isCompressedFormat == false )
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
if (_cpuExtension_AVX2)
|
||||
{
|
||||
__m256i h256 = { 0 };
|
||||
|
@ -7,7 +7,7 @@ using namespace Latte;
|
||||
namespace LatteAddrLib
|
||||
{
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
unsigned char _BitScanReverse(uint32* _Index, uint32 _Mask)
|
||||
{
|
||||
if (!_Mask)
|
||||
|
@ -95,7 +95,7 @@ OpenGLRenderer::OpenGLRenderer()
|
||||
glRendererState.uploadIndex = 0;
|
||||
}
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
try
|
||||
{
|
||||
m_dxgi_wrapper = std::make_unique<DXGIWrapper>();
|
||||
@ -191,7 +191,7 @@ void OpenGLRenderer::DeleteFontTextures()
|
||||
|
||||
typedef void(*GL_IMPORT)();
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
GL_IMPORT _GetOpenGLFunction(HMODULE hLib, const char* name)
|
||||
{
|
||||
GL_IMPORT r = (GL_IMPORT)wglGetProcAddress(name);
|
||||
@ -207,7 +207,7 @@ void LoadOpenGLImports()
|
||||
#include "Common/GLInclude/glFunctions.h"
|
||||
#undef GLFUNC
|
||||
}
|
||||
#else
|
||||
#elif BOOST_OS_LINUX
|
||||
GL_IMPORT _GetOpenGLFunction(void* hLib, PFNGLXGETPROCADDRESSPROC func, const char* name)
|
||||
{
|
||||
GL_IMPORT r = (GL_IMPORT)func((const GLubyte*)name);
|
||||
@ -233,6 +233,11 @@ void LoadOpenGLImports()
|
||||
#include "Common/GLInclude/glFunctions.h"
|
||||
#undef GLFUNC
|
||||
}
|
||||
#elif BOOST_OS_MACOS
|
||||
void LoadOpenGLImports()
|
||||
{
|
||||
cemu_assert_unimplemented();
|
||||
}
|
||||
#endif
|
||||
|
||||
void OpenGLRenderer::Initialize()
|
||||
@ -244,7 +249,7 @@ void OpenGLRenderer::Initialize()
|
||||
LoadOpenGLImports();
|
||||
GetVendorInformation();
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
if (wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(0); // disable V-Sync per default
|
||||
#endif
|
||||
@ -349,7 +354,7 @@ void OpenGLRenderer::NotifyLatteCommandProcessorIdle()
|
||||
|
||||
void OpenGLRenderer::EnableVSync(int state)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
if(wglSwapIntervalEXT)
|
||||
wglSwapIntervalEXT(state); // 1 = enabled, 0 = disabled
|
||||
#else
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define VKFUNC_DEFINE
|
||||
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h"
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
|
@ -104,7 +104,7 @@ std::vector<VulkanRenderer::DeviceInfo> VulkanRenderer::GetDevices()
|
||||
requiredExtensions.emplace_back(VK_KHR_SURFACE_EXTENSION_NAME);
|
||||
#if BOOST_OS_WINDOWS
|
||||
requiredExtensions.emplace_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
|
||||
#else
|
||||
#elif BOOST_OS_LINUX
|
||||
requiredExtensions.emplace_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
|
||||
@ -1143,7 +1143,7 @@ std::vector<const char*> VulkanRenderer::CheckInstanceExtensionSupport(FeatureCo
|
||||
requiredInstanceExtensions.emplace_back(VK_KHR_SURFACE_EXTENSION_NAME);
|
||||
#if BOOST_OS_WINDOWS
|
||||
requiredInstanceExtensions.emplace_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
|
||||
#else
|
||||
#elif BOOST_OS_LINUX
|
||||
requiredInstanceExtensions.emplace_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
if (cafeLog_isLoggingFlagEnabled(LOG_TYPE_VULKAN_VALIDATION))
|
||||
@ -1319,8 +1319,11 @@ VkSurfaceKHR VulkanRenderer::CreateFramebufferSurface(VkInstance instance, struc
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
return CreateWinSurface(instance, windowInfo.hwnd);
|
||||
#else
|
||||
#elif BOOST_OS_LINUX
|
||||
return CreateXlibSurface(instance, windowInfo.xlib_display, windowInfo.xlib_window);
|
||||
#elif BOOST_OS_MACOS
|
||||
cemu_assert_unimplemented();
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -201,6 +201,9 @@ static uint16 CPU_swapEndianU16(uint16 v)
|
||||
#elif BOOST_OS_LINUX
|
||||
#define CPU_swapEndianU64(_v) bswap_64((uint64)(_v))
|
||||
#define CPU_swapEndianU32(_v) bswap_32((uint32)(_v))
|
||||
#elif BOOST_OS_MACOS
|
||||
#define CPU_swapEndianU64(_v) OSSwapInt64((uint64)(_v))
|
||||
#define CPU_swapEndianU32(_v) OSSwapInt32((uint32)(_v))
|
||||
#endif
|
||||
|
||||
// direct memory access (no hardware interface access)
|
||||
|
@ -78,7 +78,7 @@ void CafeInit()
|
||||
rpxPathStart = 0;
|
||||
}
|
||||
|
||||
std::string_view rpxFileName = std::basic_string_view<char>(_pathToExecutable.data() + rpxPathStart, _pathToExecutable.data() + _pathToExecutable.size());
|
||||
std::string_view rpxFileName(_pathToExecutable.data() + rpxPathStart, _pathToExecutable.size() - rpxPathStart);
|
||||
|
||||
argStorageIndex = 0;
|
||||
_coreinitInfo->argc = 0;
|
||||
|
@ -424,7 +424,7 @@ typedef struct
|
||||
|
||||
static_assert(sizeof(UCParamStruct_t) == 0x54); // unsure
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#define _strcmpi strcasecmp
|
||||
#endif
|
||||
|
||||
|
@ -63,7 +63,8 @@ namespace coreinit
|
||||
bool negativeAlignment = alignment < 0;
|
||||
if (negativeAlignment)
|
||||
alignment = -alignment;
|
||||
if (!std::has_single_bit<uint32>((uint32)alignment))
|
||||
uint32 bits = (uint32)alignment;
|
||||
if (bits == 0 || (bits & (bits - 1)) != 0)
|
||||
{
|
||||
cemuLog_log(LogType::APIErrors, "MEMGetAllocatableSizeForFrmHeapEx(): Invalid alignment");
|
||||
return 0;
|
||||
|
@ -455,7 +455,7 @@ void export_curl_multi_fdset(PPCInterpreter_t* hCPU)
|
||||
ppcDefineParamMEMPTR(exceptionFd, wu_fd_set, 3);
|
||||
ppcDefineParamU32BEPtr(maxFd, 4);
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
cemuLog_log(LogType::Force, "curl_multi_fdset(...) - todo");
|
||||
|
||||
osLib_returnFromFunction(hCPU, 0);
|
||||
|
@ -242,7 +242,7 @@ namespace save
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
std::wstringstream errorMsg;
|
||||
errorMsg << L"Couldn't move your save files!" << std::endl << std::endl;
|
||||
errorMsg << L"Error: " << ex.what() << std::endl << std::endl;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <bitset>
|
||||
#include "nsyshid.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
#include <setupapi.h>
|
||||
#include <initguid.h>
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "Common/socket.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
#define WU_AF_INET 2
|
||||
|
||||
@ -2085,7 +2085,7 @@ void nsysnet_load()
|
||||
osLib_addFunction("nsysnet", "NSSLExportInternalClientCertificate", nsysnet::export_NSSLExportInternalClientCertificate);
|
||||
}
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
void nsysnet_notifyCloseSharedSocket(SOCKET existingSocket)
|
||||
{
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <WinSock2.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <fmt/format.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#include "Common/linux/fast_float.h"
|
||||
#include "Common/unix/fast_float.h"
|
||||
#define _EP_FROM_CHARS_DBL(...) _convFastFloatResult(fast_float::from_chars(__VA_ARGS__))
|
||||
|
||||
inline std::from_chars_result _convFastFloatResult(fast_float::from_chars_result r)
|
||||
|
@ -200,7 +200,7 @@ void cafeLog_log(uint32 type, const char* format, ...)
|
||||
char logTempStr[2048];
|
||||
va_list(args);
|
||||
va_start(args, format);
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
vsprintf_s(logTempStr, format, args);
|
||||
#else
|
||||
vsprintf(logTempStr, format, args);
|
||||
@ -226,7 +226,7 @@ void cafeLog_logW(uint32 type, const wchar_t* format, ...)
|
||||
wchar_t logTempStr[2048];
|
||||
va_list(args);
|
||||
va_start(args, format);
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
vswprintf_s(logTempStr, format, args);
|
||||
#else
|
||||
vswprintf(logTempStr, 2048, format, args);
|
||||
|
@ -628,7 +628,7 @@ public:
|
||||
ppcAssembler_setError(assemblerCtx->ctx, fmt::format("\'{}\' does not end with valid memory register syntax. Memory operand must have the form offset(gpr). Example: 0x20(r3)", svOpText));
|
||||
return false;
|
||||
}
|
||||
std::string_view svExpressionPart(startPtr, endPtr);
|
||||
std::string_view svExpressionPart(startPtr, endPtr - startPtr);
|
||||
std::string_view svRegPart(memoryRegBegin, memoryRegEnd - memoryRegBegin);
|
||||
sint32 memGpr = _parseRegIndex(svRegPart, "r");
|
||||
//if (_ppcAssembler_parseRegister(svRegPart, "r", memGpr) == false || (memGpr < 0 || memGpr >= 32))
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "util/crypto/md5.h"
|
||||
|
||||
// for inet_pton:
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <WS2tcpip.h>
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
|
@ -529,7 +529,7 @@ prudpClient::prudpClient(uint32 dstIp, uint16 dstPort, const char* key) : prudpC
|
||||
break;
|
||||
}
|
||||
// set socket to non-blocking mode
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
u_long nonBlockingMode = 1; // 1 to enable non-blocking socket
|
||||
ioctlsocket(socketUdp, FIONBIO, &nonBlockingMode);
|
||||
#else
|
||||
|
@ -17,8 +17,8 @@ PRIVATE
|
||||
else()
|
||||
target_sources(CemuCommon
|
||||
PRIVATE
|
||||
linux/platform.cpp
|
||||
linux/platform.h
|
||||
unix/platform.cpp
|
||||
unix/platform.h
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "Common/precompiled.h"
|
||||
#include "Cafe/CafeSystem.h"
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
@ -6,11 +6,12 @@
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include "Common/windows/platform.h"
|
||||
#elif BOOST_OS_LINUX
|
||||
#include "byteswap.h"
|
||||
//#include <boost/core/enable_if.hpp>
|
||||
// #include <boost/type_traits.hpp>
|
||||
#include "Common/linux/platform.h"
|
||||
|
||||
#include <byteswap.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrender.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include "Common/unix/platform.h"
|
||||
#elif BOOST_OS_MACOS
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#include "Common/unix/platform.h"
|
||||
#endif
|
@ -144,22 +144,32 @@ inline sint16 _swapEndianS16(sint16 v)
|
||||
{
|
||||
return (sint16)(((uint16)v >> 8) | ((uint16)v << 8));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#else
|
||||
inline uint64 _swapEndianU64(uint64 v)
|
||||
{
|
||||
#if BOOST_OS_MACOS
|
||||
return OSSwapInt64(v);
|
||||
#else
|
||||
return bswap_64(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline uint32 _swapEndianU32(uint32 v)
|
||||
{
|
||||
#if BOOST_OS_MACOS
|
||||
return OSSwapInt32(v);
|
||||
#else
|
||||
return bswap_32(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline sint32 _swapEndianS32(sint32 v)
|
||||
{
|
||||
#if BOOST_OS_MACOS
|
||||
return (sint32)OSSwapInt32((uint32)v);
|
||||
#else
|
||||
return (sint32)bswap_32((uint32)v);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline uint16 _swapEndianU16(uint16 v)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
#include <WinSock2.h>
|
||||
typedef int socklen_t;
|
||||
|
@ -32,9 +32,6 @@ inline uint32_t GetExceptionError()
|
||||
return errno;
|
||||
}
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrender.h>
|
||||
#include <X11/Xutil.h>
|
||||
#undef False
|
||||
#undef True
|
||||
#undef None
|
@ -12,7 +12,11 @@ set_source_files_properties(x64util_masm.asm PROPERTIES LANGUAGE ASM_MASM)
|
||||
ELSE()
|
||||
|
||||
# NASM
|
||||
IF (APPLE)
|
||||
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> -g -Fdwarf -f macho64 --prefix _ -o <OBJECT> <SOURCE>")
|
||||
ELSE()
|
||||
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> -g -Fdwarf -f elf64 -o <OBJECT> <SOURCE>")
|
||||
ENDIF()
|
||||
set(CMAKE_ASM_NASM_LINK_EXECUTABLE "ld <FLAGS> <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS> -fPIC <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
|
||||
enable_language(C ASM_NASM)
|
||||
@ -22,7 +26,11 @@ x64util_nasm.asm
|
||||
)
|
||||
set_source_files_properties(x64util_nasm.asm PROPERTIES LANGUAGE ASM_NASM)
|
||||
|
||||
IF (APPLE)
|
||||
set_target_properties(CemuAsm PROPERTIES NASM_OBJ_FORMAT macho64)
|
||||
ELSE()
|
||||
set_target_properties(CemuAsm PROPERTIES NASM_OBJ_FORMAT elf64)
|
||||
ENDIF()
|
||||
set_target_properties(CemuAsm PROPERTIES LINKER_LANGUAGE C)
|
||||
|
||||
ENDIF()
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "IAudioAPI.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include "XAudio2API.h"
|
||||
#include "XAudio27API.h"
|
||||
#include "DirectSoundAPI.h"
|
||||
@ -37,7 +37,7 @@ void IAudioAPI::PrintLogging()
|
||||
|
||||
void IAudioAPI::InitWFX(sint32 samplerate, sint32 channels, sint32 bits_per_sample)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
// move this to Windows-specific audio API implementations and use a cross-platform format here
|
||||
m_wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||
m_wfx.Format.nChannels = channels;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <mmreg.h>
|
||||
#endif
|
||||
|
||||
@ -64,7 +64,7 @@ public:
|
||||
static std::vector<DeviceDescriptionPtr> GetDevices(AudioAPI api);
|
||||
|
||||
protected:
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
WAVEFORMATEXTENSIBLE m_wfx{};
|
||||
#endif
|
||||
|
||||
|
@ -406,7 +406,7 @@ public:
|
||||
}
|
||||
|
||||
FILE* file = nullptr;
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
file = _wfopen(tmp_name.c_str(), L"wb");
|
||||
#else
|
||||
file = fopen(boost::nowide::narrow(tmp_name).c_str(), "wb");
|
||||
|
@ -150,7 +150,7 @@ bool CemuApp::OnInit()
|
||||
int CemuApp::OnExit()
|
||||
{
|
||||
wxApp::OnExit();
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
ExitProcess(0);
|
||||
#else
|
||||
exit(0);
|
||||
@ -306,7 +306,7 @@ void CemuApp::CreateDefaultFiles(bool first_start)
|
||||
std::stringstream errorMsg;
|
||||
errorMsg << fmt::format(_("Couldn't create a required mlc01 subfolder or file!\n\nError: {0}\nTarget path:\n{1}").ToStdString(), ex.what(), boost::nowide::narrow(mlc));
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
const DWORD lastError = GetLastError();
|
||||
if (lastError != ERROR_SUCCESS)
|
||||
errorMsg << fmt::format("\n\n{}", GetSystemErrorMessage(lastError));
|
||||
@ -332,7 +332,7 @@ void CemuApp::CreateDefaultFiles(bool first_start)
|
||||
std::stringstream errorMsg;
|
||||
errorMsg << fmt::format(_("Couldn't create a required cemu directory or file!\n\nError: {0}").ToStdString(), ex.what());
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
const DWORD lastError = GetLastError();
|
||||
if (lastError != ERROR_SUCCESS)
|
||||
errorMsg << fmt::format("\n\n{}", GetSystemErrorMessage(lastError));
|
||||
|
@ -515,7 +515,7 @@ void CemuUpdateWindow::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
if (m_restart_required && !m_restart_file.empty() && fs::exists(m_restart_file))
|
||||
{
|
||||
PROCESS_INFORMATION pi{};
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "input/InputManager.h"
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#include "resource/linux/resources.h"
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id)
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "config/CemuConfig.h"
|
||||
|
||||
#include "audio/IAudioAPI.h"
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include "audio/DirectSoundAPI.h"
|
||||
#include "audio/XAudio27API.h"
|
||||
#endif
|
||||
@ -31,7 +31,7 @@
|
||||
#include "gui/dialogs/CreateAccount/wxCreateAccountDialog.h"
|
||||
#include "config/PermanentStorage.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <VersionHelpers.h>
|
||||
#endif
|
||||
|
||||
@ -39,8 +39,8 @@
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#include "resource/linux/resources.h"
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
#include "Cafe/CafeSystem.h"
|
||||
@ -649,7 +649,7 @@ wxPanel* GeneralSettings2::AddAccountPage(wxNotebook* notebook)
|
||||
|
||||
{
|
||||
m_account_information = new wxCollapsiblePane(online_panel, wxID_ANY, _("Account information"));
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
m_account_information->GetControlWidget()->SetBackgroundColour(*wxWHITE);
|
||||
#endif
|
||||
auto win = m_account_information->GetPane();
|
||||
@ -1063,7 +1063,7 @@ void GeneralSettings2::ResetAccountInformation()
|
||||
|
||||
// refresh pane size
|
||||
m_account_information->InvalidateBestSize();
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
m_account_information->OnStateChange(GetBestSize());
|
||||
#endif
|
||||
}
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#include "resource/linux/resources.h"
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
#include "wxHelper.h"
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include "Cafe/CafeSystem.h"
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#include "resource/linux/resources.h"
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
// main.cpp
|
||||
|
@ -50,12 +50,12 @@
|
||||
#include "gui/input/InputSettings2.h"
|
||||
#include "input/InputManager.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#define exit(__c) ExitProcess(__c)
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#include "resource/linux/resources.h"
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
#include "Cafe/TitleList/TitleInfo.h"
|
||||
@ -296,7 +296,7 @@ MainWindow::MainWindow()
|
||||
SetClientSize(1280, 720);
|
||||
SetIcon(wxICON(M_WND_ICON128));
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
HICON hWindowIcon = (HICON)LoadImageA(NULL, "M_WND_ICON16", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
|
||||
SendMessage(this->GetHWND(), WM_SETICON, ICON_SMALL, (LPARAM)hWindowIcon);
|
||||
#endif
|
||||
@ -650,7 +650,7 @@ void MainWindow::OnInstallUpdate(wxCommandEvent& event)
|
||||
break;
|
||||
if (modalChoice == wxID_OK)
|
||||
{
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
fs::path dirPath((const char*)(openDirDialog.GetPath().fn_str()));
|
||||
#else
|
||||
fs::path dirPath(openDirDialog.GetPath().fn_str());
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "input/InputManager.h"
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#include "resource/linux/resources.h"
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
#include "wxHelper.h"
|
||||
|
||||
|
@ -42,8 +42,8 @@
|
||||
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#include "resource/linux/resources.h"
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
#include "Cafe/TitleList/SaveList.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "util/helpers/helpers.h"
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#include "resource/linux/resources.h"
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
enum
|
||||
|
@ -159,9 +159,9 @@ typedef void GdkDisplay;
|
||||
|
||||
void gui_initHandleContextFromWxWidgetsWindow(WindowHandleInfo& handleInfoOut, class wxWindow* wxw)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
handleInfoOut.hwnd = wxw->GetHWND();
|
||||
#else
|
||||
#elif BOOST_OS_LINUX
|
||||
/* dynamically retrieve GTK imports so we dont have to include and link the whole lib */
|
||||
void (*dyn_gtk_widget_realize)(GtkWidget *widget);
|
||||
dyn_gtk_widget_realize = (void(*)(GtkWidget* widget))dlsym(RTLD_NEXT, "gtk_widget_realize");
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#if BOOST_OS_LINUX
|
||||
#include "xcb/xproto.h"
|
||||
#endif
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "util/EventService.h"
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
#include "resource/linux/resources.h"
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
bool g_inputConfigWindowHasFocus = false;
|
||||
|
24
src/main.cpp
24
src/main.cpp
@ -28,14 +28,14 @@
|
||||
#include "Cafe/OS/libs/vpad/vpad.h"
|
||||
|
||||
#include "audio/IAudioAPI.h"
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#pragma comment(lib,"Dbghelp.lib")
|
||||
#endif
|
||||
|
||||
#define SDL_MAIN_HANDLED
|
||||
#include <SDL.h>
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#define _putenv(__s) putenv((char*)(__s))
|
||||
#endif
|
||||
|
||||
@ -61,7 +61,7 @@ bool IsCemuhookLoaded()
|
||||
|
||||
void checkForCemuhook()
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
// check if there is a dbghelp.dll in the current working directory
|
||||
if (!fs::exists(ActiveSettings::GetPath("cemuhook.dll")))
|
||||
return;
|
||||
@ -93,7 +93,7 @@ void checkForCemuhook()
|
||||
|
||||
void logCPUAndMemoryInfo()
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
int CPUInfo[4] = { -1 };
|
||||
unsigned nExIds, i = 0;
|
||||
char CPUBrandString[0x40];
|
||||
@ -129,7 +129,7 @@ bool IsRunningInWine()
|
||||
|
||||
void checkForWine()
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
const HMODULE hmodule = GetModuleHandleA("ntdll.dll");
|
||||
if (!hmodule)
|
||||
return;
|
||||
@ -206,7 +206,7 @@ void reconfigureGLDrivers()
|
||||
std::string nvCacheDirEnvOption("__GL_SHADER_DISK_CACHE_PATH=");
|
||||
nvCacheDirEnvOption.append(_utf8Wrapper(nvCacheDir));
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
std::wstring tmpW = boost::nowide::widen(nvCacheDirEnvOption);
|
||||
_wputenv(tmpW.c_str());
|
||||
#else
|
||||
@ -239,7 +239,7 @@ void mainEmulatorCommonInit()
|
||||
__cpuidex(cpuInfo, 0x7, 0);
|
||||
_cpuExtension_AVX2 = ((cpuInfo[1] >> 5) & 1) != 0;
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
executablePath.resize(4096);
|
||||
int i = GetModuleFileName(NULL, executablePath.data(), executablePath.size());
|
||||
if(i >= 0)
|
||||
@ -324,7 +324,7 @@ int mainEmulatorHLE()
|
||||
bool isConsoleConnected = false;
|
||||
void requireConsole()
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
if (isConsoleConnected)
|
||||
return;
|
||||
|
||||
@ -345,7 +345,7 @@ void HandlePostUpdate()
|
||||
const auto filename = ActiveSettings::GetFullPath().replace_extension("exe.backup");
|
||||
if (fs::exists(filename))
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
HANDLE lock;
|
||||
do
|
||||
{
|
||||
@ -374,7 +374,7 @@ void HandlePostUpdate()
|
||||
|
||||
void ToolShaderCacheMerger();
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
#ifndef PUBLIC_RELEASE
|
||||
#include <crtdbg.h>
|
||||
@ -411,7 +411,9 @@ int wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ L
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if BOOST_OS_LINUX
|
||||
XInitThreads();
|
||||
#endif
|
||||
if (!LaunchSettings::HandleCommandline(argc, argv))
|
||||
return 0;
|
||||
|
||||
@ -440,7 +442,7 @@ __declspec(dllexport) uint64 gameMeta_getTitleId()
|
||||
}
|
||||
|
||||
/* Cemuhook loading */
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
#pragma init_seg(".CRT$XCT")
|
||||
|
||||
HANDLE dbgLib;
|
||||
|
@ -7,8 +7,8 @@ target_precompile_headers(CemuResource PRIVATE ../Common/precompiled.h)
|
||||
# icon resources
|
||||
if(UNIX)
|
||||
target_sources(CemuResource PRIVATE
|
||||
linux/resources.cpp
|
||||
linux/resources.h
|
||||
embedded/resources.cpp
|
||||
embedded/resources.h
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "Fiber.h"
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#define _XOPEN_SOURCE
|
||||
#include <ucontext.h>
|
||||
|
||||
thread_local Fiber* sCurrentFiber{};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "util/MemMapper/MemMapper.h"
|
||||
|
||||
#if BOOST_OS_LINUX > 0
|
||||
#if BOOST_OS_LINUX || BOOST_OS_MACOS
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "util/MemMapper/MemMapper.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
|
@ -46,7 +46,7 @@ std::string_view& trim(std::string_view& str, const std::string& chars)
|
||||
return ltrim(rtrim(str, chars), chars);
|
||||
}
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
std::wstring GetSystemErrorMessageW()
|
||||
{
|
||||
@ -120,7 +120,7 @@ std::string GetSystemErrorMessage(const std::error_code& ec)
|
||||
return fmt::format("{}\n{}",msg, ec.message());
|
||||
}
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||
#pragma pack(push,8)
|
||||
typedef struct tagTHREADNAME_INFO
|
||||
@ -135,7 +135,7 @@ typedef struct tagTHREADNAME_INFO
|
||||
|
||||
void SetThreadName(const char* name)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
#ifndef _PUBLIC_RELEASE
|
||||
THREADNAME_INFO info;
|
||||
@ -154,12 +154,14 @@ void SetThreadName(const char* name)
|
||||
|
||||
#endif
|
||||
|
||||
#elif BOOST_OS_MACOS
|
||||
pthread_setname_np(name);
|
||||
#else
|
||||
pthread_setname_np(pthread_self(), name);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
std::pair<DWORD, DWORD> GetWindowsVersion()
|
||||
{
|
||||
using RtlGetVersion_t = LONG(*)(POSVERSIONINFOEXW);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "util/math/vector3.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#include "Common/linux/fast_float.h"
|
||||
#include "Common/unix/fast_float.h"
|
||||
#endif
|
||||
|
||||
template <typename TType>
|
||||
|
@ -60,7 +60,7 @@ void libusbWrapper::init()
|
||||
|
||||
libusbWrapper::~libusbWrapper()
|
||||
{
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
// destroy default context
|
||||
if(p_libusb_exit)
|
||||
p_libusb_exit(nullptr);
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
#if BOOST_OS_WINDOWS > 0
|
||||
#if BOOST_OS_WINDOWS
|
||||
HMODULE m_module = nullptr;
|
||||
bool m_isInitialized = false;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user