mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
WIN32 macro -> _WIN32
This commit is contained in:
parent
489de3f9ce
commit
911e9a37f1
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
TEST(FileSystem, IsAbsolutePath)
|
TEST(FileSystem, IsAbsolutePath)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\"));
|
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\"));
|
||||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\Path"));
|
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\Path"));
|
||||||
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\Path\\Subdirectory"));
|
ASSERT_TRUE(FileSystem::IsAbsolutePath("C:\\Path\\Subdirectory"));
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#include <tlhelp32.h>
|
#include <tlhelp32.h>
|
||||||
|
@ -13,7 +13,7 @@ static std::mutex s_AssertFailedMutex;
|
||||||
|
|
||||||
static inline void FreezeThreads(void** ppHandle)
|
static inline void FreezeThreads(void** ppHandle)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
|
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
|
||||||
if (hSnapshot != INVALID_HANDLE_VALUE)
|
if (hSnapshot != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ static inline void FreezeThreads(void** ppHandle)
|
||||||
|
|
||||||
static inline void ResumeThreads(void* pHandle)
|
static inline void ResumeThreads(void* pHandle)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HANDLE hSnapshot = (HANDLE)pHandle;
|
HANDLE hSnapshot = (HANDLE)pHandle;
|
||||||
if (pHandle != INVALID_HANDLE_VALUE)
|
if (pHandle != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ void Y_OnAssertFailed(const char* szMessage, const char* szFunction, const char*
|
||||||
char szMsg[512];
|
char szMsg[512];
|
||||||
std::snprintf(szMsg, sizeof(szMsg), "%s in function %s (%s:%u)", szMessage, szFunction, szFile, uLine);
|
std::snprintf(szMsg, sizeof(szMsg), "%s in function %s (%s:%u)", szMessage, szFunction, szFile, uLine);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_ERROR_HANDLE), FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
|
SetConsoleTextAttribute(GetStdHandle(STD_ERROR_HANDLE), FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
|
||||||
WriteConsoleA(GetStdHandle(STD_ERROR_HANDLE), szMsg, static_cast<DWORD>(std::strlen(szMsg)), NULL, NULL);
|
WriteConsoleA(GetStdHandle(STD_ERROR_HANDLE), szMsg, static_cast<DWORD>(std::strlen(szMsg)), NULL, NULL);
|
||||||
OutputDebugStringA(szMsg);
|
OutputDebugStringA(szMsg);
|
||||||
|
@ -114,7 +114,7 @@ void Y_OnPanicReached(const char* szMessage, const char* szFunction, const char*
|
||||||
char szMsg[512];
|
char szMsg[512];
|
||||||
std::snprintf(szMsg, sizeof(szMsg), "%s in function %s (%s:%u)", szMessage, szFunction, szFile, uLine);
|
std::snprintf(szMsg, sizeof(szMsg), "%s in function %s (%s:%u)", szMessage, szFunction, szFile, uLine);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_ERROR_HANDLE), FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
|
SetConsoleTextAttribute(GetStdHandle(STD_ERROR_HANDLE), FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
|
||||||
WriteConsoleA(GetStdHandle(STD_ERROR_HANDLE), szMsg, static_cast<DWORD>(std::strlen(szMsg)), NULL, NULL);
|
WriteConsoleA(GetStdHandle(STD_ERROR_HANDLE), szMsg, static_cast<DWORD>(std::strlen(szMsg)), NULL, NULL);
|
||||||
OutputDebugStringA(szMsg);
|
OutputDebugStringA(szMsg);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
virtual bool SeekAbsolute(u64 Offset) override
|
virtual bool SeekAbsolute(u64 Offset) override
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ public:
|
||||||
{
|
{
|
||||||
if (m_discarded)
|
if (m_discarded)
|
||||||
{
|
{
|
||||||
#if WIN32
|
#if _WIN32
|
||||||
// delete the temporary file
|
// delete the temporary file
|
||||||
if (!DeleteFileW(StringUtil::UTF8StringToWideString(m_temporaryFileName).c_str()))
|
if (!DeleteFileW(StringUtil::UTF8StringToWideString(m_temporaryFileName).c_str()))
|
||||||
{
|
{
|
||||||
|
@ -308,7 +308,7 @@ public:
|
||||||
|
|
||||||
fflush(m_pFile);
|
fflush(m_pFile);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// move the atomic file name to the original file name
|
// move the atomic file name to the original file name
|
||||||
if (!MoveFileExW(StringUtil::UTF8StringToWideString(m_temporaryFileName).c_str(),
|
if (!MoveFileExW(StringUtil::UTF8StringToWideString(m_temporaryFileName).c_str(),
|
||||||
StringUtil::UTF8StringToWideString(m_originalFileName).c_str(), MOVEFILE_REPLACE_EXISTING))
|
StringUtil::UTF8StringToWideString(m_originalFileName).c_str(), MOVEFILE_REPLACE_EXISTING))
|
||||||
|
@ -975,7 +975,7 @@ std::unique_ptr<ByteStream> ByteStream_OpenFileStream(const char* fileName, u32
|
||||||
}
|
}
|
||||||
|
|
||||||
// append platform path seperator
|
// append platform path seperator
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
tempStr[i] = '\\';
|
tempStr[i] = '\\';
|
||||||
#else
|
#else
|
||||||
tempStr[i] = '/';
|
tempStr[i] = '/';
|
||||||
|
@ -1119,7 +1119,7 @@ std::unique_ptr<ByteStream> ByteStream_OpenFileStream(const char* fileName, u32
|
||||||
const u32 fileNameLength = static_cast<u32>(std::strlen(fileName));
|
const u32 fileNameLength = static_cast<u32>(std::strlen(fileName));
|
||||||
char* tempStr = (char*)alloca(fileNameLength + 1);
|
char* tempStr = (char*)alloca(fileNameLength + 1);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
// check if it starts with a drive letter. if so, skip ahead
|
// check if it starts with a drive letter. if so, skip ahead
|
||||||
if (fileNameLength >= 2 && fileName[1] == ':')
|
if (fileNameLength >= 2 && fileName[1] == ':')
|
||||||
{
|
{
|
||||||
|
@ -1156,7 +1156,7 @@ std::unique_ptr<ByteStream> ByteStream_OpenFileStream(const char* fileName, u32
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
{
|
{
|
||||||
// try creating it
|
// try creating it
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
if (mkdir(tempStr) < 0)
|
if (mkdir(tempStr) < 0)
|
||||||
#else
|
#else
|
||||||
if (mkdir(tempStr, 0777) < 0)
|
if (mkdir(tempStr, 0777) < 0)
|
||||||
|
@ -1175,7 +1175,7 @@ std::unique_ptr<ByteStream> ByteStream_OpenFileStream(const char* fileName, u32
|
||||||
}
|
}
|
||||||
|
|
||||||
// append platform path seperator
|
// append platform path seperator
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
tempStr[i] = '\\';
|
tempStr[i] = '\\';
|
||||||
#else
|
#else
|
||||||
tempStr[i] = '/';
|
tempStr[i] = '/';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__HAIKU__)
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__HAIKU__)
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
#if defined(WIN32) && defined(USE_WIN32_EVENT_OBJECTS)
|
#if defined(_WIN32) && defined(USE_WIN32_EVENT_OBJECTS)
|
||||||
|
|
||||||
Event::Event(bool auto_reset /* = false */)
|
Event::Event(bool auto_reset /* = false */)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ void Event::WaitForMultiple(Event** events, u32 num_events)
|
||||||
WaitForMultipleObjects(num_events, event_handles, TRUE, INFINITE);
|
WaitForMultipleObjects(num_events, event_handles, TRUE, INFINITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
|
|
||||||
Event::Event(bool auto_reset /* = false */) : m_auto_reset(auto_reset)
|
Event::Event(bool auto_reset /* = false */) : m_auto_reset(auto_reset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
// #define USE_WIN32_EVENT_OBJECTS 1
|
// #define USE_WIN32_EVENT_OBJECTS 1
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(USE_WIN32_EVENT_OBJECTS)
|
#if defined(_WIN32) && !defined(USE_WIN32_EVENT_OBJECTS)
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__HAIKU__)
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__HAIKU__)
|
||||||
|
@ -31,9 +31,9 @@ public:
|
||||||
static void WaitForMultiple(Event** events, u32 num_events);
|
static void WaitForMultiple(Event** events, u32 num_events);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(WIN32) && defined(USE_WIN32_EVENT_OBJECTS)
|
#if defined(_WIN32) && defined(USE_WIN32_EVENT_OBJECTS)
|
||||||
void* m_event_handle;
|
void* m_event_handle;
|
||||||
#elif defined(WIN32)
|
#elif defined(_WIN32)
|
||||||
CRITICAL_SECTION m_cs;
|
CRITICAL_SECTION m_cs;
|
||||||
CONDITION_VARIABLE m_cv;
|
CONDITION_VARIABLE m_cv;
|
||||||
std::atomic_uint32_t m_waiters{0};
|
std::atomic_uint32_t m_waiters{0};
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#else
|
#else
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
@ -573,7 +573,7 @@ void SanitizeFileName(std::string& Destination, bool StripSlashes /* = true*/)
|
||||||
|
|
||||||
bool IsAbsolutePath(const std::string_view& path)
|
bool IsAbsolutePath(const std::string_view& path)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return (path.length() >= 3 && ((path[0] >= 'A' && path[0] <= 'Z') || (path[0] >= 'a' && path[0] <= 'z')) &&
|
return (path.length() >= 3 && ((path[0] >= 'A' && path[0] <= 'Z') || (path[0] >= 'a' && path[0] <= 'z')) &&
|
||||||
path[1] == ':' && (path[2] == '/' || path[2] == '\\'));
|
path[1] == ':' && (path[2] == '/' || path[2] == '\\'));
|
||||||
#else
|
#else
|
||||||
|
@ -713,7 +713,7 @@ std::vector<std::string> GetRootDirectoryList()
|
||||||
{
|
{
|
||||||
std::vector<std::string> results;
|
std::vector<std::string> results;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
char buf[256];
|
char buf[256];
|
||||||
if (GetLogicalDriveStringsA(sizeof(buf), buf) != 0)
|
if (GetLogicalDriveStringsA(sizeof(buf), buf) != 0)
|
||||||
{
|
{
|
||||||
|
@ -774,7 +774,7 @@ FileSystem::ManagedCFilePtr OpenManagedCFile(const char* filename, const char* m
|
||||||
|
|
||||||
std::FILE* OpenCFile(const char* filename, const char* mode)
|
std::FILE* OpenCFile(const char* filename, const char* mode)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
int filename_len = static_cast<int>(std::strlen(filename));
|
int filename_len = static_cast<int>(std::strlen(filename));
|
||||||
int mode_len = static_cast<int>(std::strlen(mode));
|
int mode_len = static_cast<int>(std::strlen(mode));
|
||||||
int wlen = MultiByteToWideChar(CP_UTF8, 0, filename, filename_len, nullptr, 0);
|
int wlen = MultiByteToWideChar(CP_UTF8, 0, filename, filename_len, nullptr, 0);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
class ByteStream;
|
class ByteStream;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#define FS_OSPATH_SEPARATOR_CHARACTER '\\'
|
#define FS_OSPATH_SEPARATOR_CHARACTER '\\'
|
||||||
#define FS_OSPATH_SEPARATOR_STR "\\"
|
#define FS_OSPATH_SEPARATOR_STR "\\"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#endif
|
#endif
|
||||||
Log_SetChannel(GL::Context);
|
Log_SetChannel(GL::Context);
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(_M_ARM64)
|
#if defined(_WIN32) && !defined(_M_ARM64)
|
||||||
#include "context_wgl.h"
|
#include "context_wgl.h"
|
||||||
#elif defined(__APPLE__) && !defined(LIBERTRO)
|
#elif defined(__APPLE__) && !defined(LIBERTRO)
|
||||||
#include "context_agl.h"
|
#include "context_agl.h"
|
||||||
|
@ -97,7 +97,7 @@ std::unique_ptr<GL::Context> Context::Create(const WindowInfo& wi, const Version
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Context> context;
|
std::unique_ptr<Context> context;
|
||||||
#if defined(WIN32) && !defined(_M_ARM64)
|
#if defined(_WIN32) && !defined(_M_ARM64)
|
||||||
context = ContextWGL::Create(wi, versions_to_try, num_versions_to_try);
|
context = ContextWGL::Create(wi, versions_to_try, num_versions_to_try);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try);
|
context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
static const std::array<Version, 16>& GetAllVersionsList();
|
static const std::array<Version, 16>& GetAllVersionsList();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WindowInfo m_wi;
|
WindowInfo m_wi;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
Log_SetChannel(JitCodeBuffer);
|
Log_SetChannel(JitCodeBuffer);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#else
|
#else
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -43,7 +43,7 @@ bool JitCodeBuffer::Allocate(u32 size /* = 64 * 1024 * 1024 */, u32 far_code_siz
|
||||||
|
|
||||||
m_total_size = size + far_code_size;
|
m_total_size = size + far_code_size;
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
m_code_ptr = static_cast<u8*>(VirtualAlloc(nullptr, m_total_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE));
|
m_code_ptr = static_cast<u8*>(VirtualAlloc(nullptr, m_total_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE));
|
||||||
if (!m_code_ptr)
|
if (!m_code_ptr)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ bool JitCodeBuffer::Initialize(void* buffer, u32 size, u32 far_code_size /* = 0
|
||||||
if ((far_code_size > 0 && guard_size >= far_code_size) || (far_code_size + (guard_size * 2)) > size)
|
if ((far_code_size > 0 && guard_size >= far_code_size) || (far_code_size + (guard_size * 2)) > size)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
DWORD old_protect = 0;
|
DWORD old_protect = 0;
|
||||||
if (!VirtualProtect(buffer, size, PAGE_EXECUTE_READWRITE, &old_protect))
|
if (!VirtualProtect(buffer, size, PAGE_EXECUTE_READWRITE, &old_protect))
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ void JitCodeBuffer::Destroy()
|
||||||
{
|
{
|
||||||
if (m_owns_buffer)
|
if (m_owns_buffer)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
VirtualFree(m_code_ptr, 0, MEM_RELEASE);
|
VirtualFree(m_code_ptr, 0, MEM_RELEASE);
|
||||||
#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__)
|
#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__)
|
||||||
munmap(m_code_ptr, m_total_size);
|
munmap(m_code_ptr, m_total_size);
|
||||||
|
@ -164,7 +164,7 @@ void JitCodeBuffer::Destroy()
|
||||||
}
|
}
|
||||||
else if (m_code_ptr)
|
else if (m_code_ptr)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
DWORD old_protect = 0;
|
DWORD old_protect = 0;
|
||||||
VirtualProtect(m_code_ptr, m_total_size, m_old_protection, &old_protect);
|
VirtualProtect(m_code_ptr, m_total_size, m_old_protection, &old_protect);
|
||||||
#else
|
#else
|
||||||
|
@ -237,7 +237,7 @@ void JitCodeBuffer::Align(u32 alignment, u8 padding_value)
|
||||||
|
|
||||||
void JitCodeBuffer::FlushInstructionCache(void* address, u32 size)
|
void JitCodeBuffer::FlushInstructionCache(void* address, u32 size)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
::FlushInstructionCache(GetCurrentProcess(), address, size);
|
::FlushInstructionCache(GetCurrentProcess(), address, size);
|
||||||
#elif defined(__GNUC__) || defined(__clang__)
|
#elif defined(__GNUC__) || defined(__clang__)
|
||||||
__builtin___clear_cache(reinterpret_cast<char*>(address), reinterpret_cast<char*>(address) + size);
|
__builtin___clear_cache(reinterpret_cast<char*>(address), reinterpret_cast<char*>(address) + size);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
@ -531,7 +531,7 @@ void Writev(const char* channelName, const char* functionName, LOGLEVEL level, c
|
||||||
va_list apCopy;
|
va_list apCopy;
|
||||||
va_copy(apCopy, ap);
|
va_copy(apCopy, ap);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
u32 requiredSize = static_cast<u32>(_vscprintf(format, apCopy));
|
u32 requiredSize = static_cast<u32>(_vscprintf(format, apCopy));
|
||||||
#else
|
#else
|
||||||
u32 requiredSize = std::vsnprintf(nullptr, 0, format, apCopy);
|
u32 requiredSize = std::vsnprintf(nullptr, 0, format, apCopy);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
Log_SetChannel(Common::MemoryArena);
|
Log_SetChannel(Common::MemoryArena);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
#elif defined(ANDROID)
|
#elif defined(ANDROID)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
@ -69,7 +69,7 @@ MemoryArena::~MemoryArena()
|
||||||
void* MemoryArena::FindBaseAddressForMapping(size_t size)
|
void* MemoryArena::FindBaseAddressForMapping(size_t size)
|
||||||
{
|
{
|
||||||
void* base_address;
|
void* base_address;
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
base_address = VirtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE);
|
base_address = VirtualAlloc(nullptr, size, MEM_RESERVE, PAGE_READWRITE);
|
||||||
if (base_address)
|
if (base_address)
|
||||||
VirtualFree(base_address, 0, MEM_RELEASE);
|
VirtualFree(base_address, 0, MEM_RELEASE);
|
||||||
|
@ -96,7 +96,7 @@ void* MemoryArena::FindBaseAddressForMapping(size_t size)
|
||||||
|
|
||||||
bool MemoryArena::IsValid() const
|
bool MemoryArena::IsValid() const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
return m_file_handle != nullptr;
|
return m_file_handle != nullptr;
|
||||||
#else
|
#else
|
||||||
return m_shmem_fd >= 0;
|
return m_shmem_fd >= 0;
|
||||||
|
@ -217,7 +217,7 @@ bool MemoryArena::Create(size_t size, bool writable, bool executable)
|
||||||
|
|
||||||
void MemoryArena::Destroy()
|
void MemoryArena::Destroy()
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
if (m_file_handle)
|
if (m_file_handle)
|
||||||
{
|
{
|
||||||
CloseHandle(m_file_handle);
|
CloseHandle(m_file_handle);
|
||||||
|
@ -255,7 +255,7 @@ void* MemoryArena::CreateViewPtr(size_t offset, size_t size, bool writable, bool
|
||||||
void* fixed_address /*= nullptr*/)
|
void* fixed_address /*= nullptr*/)
|
||||||
{
|
{
|
||||||
void* base_pointer;
|
void* base_pointer;
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
const DWORD desired_access = FILE_MAP_READ | (writable ? FILE_MAP_WRITE : 0) | (executable ? FILE_MAP_EXECUTE : 0);
|
const DWORD desired_access = FILE_MAP_READ | (writable ? FILE_MAP_WRITE : 0) | (executable ? FILE_MAP_EXECUTE : 0);
|
||||||
base_pointer =
|
base_pointer =
|
||||||
MapViewOfFileEx(m_file_handle, desired_access, Truncate32(offset >> 32), Truncate32(offset), size, fixed_address);
|
MapViewOfFileEx(m_file_handle, desired_access, Truncate32(offset >> 32), Truncate32(offset), size, fixed_address);
|
||||||
|
@ -277,7 +277,7 @@ void* MemoryArena::CreateViewPtr(size_t offset, size_t size, bool writable, bool
|
||||||
|
|
||||||
bool MemoryArena::FlushViewPtr(void* address, size_t size)
|
bool MemoryArena::FlushViewPtr(void* address, size_t size)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
return FlushViewOfFile(address, size);
|
return FlushViewOfFile(address, size);
|
||||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
return (msync(address, size, 0) >= 0);
|
return (msync(address, size, 0) >= 0);
|
||||||
|
@ -289,7 +289,7 @@ bool MemoryArena::FlushViewPtr(void* address, size_t size)
|
||||||
bool MemoryArena::ReleaseViewPtr(void* address, size_t size)
|
bool MemoryArena::ReleaseViewPtr(void* address, size_t size)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
result = static_cast<bool>(UnmapViewOfFile(address));
|
result = static_cast<bool>(UnmapViewOfFile(address));
|
||||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
result = (munmap(address, size) >= 0);
|
result = (munmap(address, size) >= 0);
|
||||||
|
@ -311,7 +311,7 @@ bool MemoryArena::ReleaseViewPtr(void* address, size_t size)
|
||||||
void* MemoryArena::CreateReservedPtr(size_t size, void* fixed_address /*= nullptr*/)
|
void* MemoryArena::CreateReservedPtr(size_t size, void* fixed_address /*= nullptr*/)
|
||||||
{
|
{
|
||||||
void* base_pointer;
|
void* base_pointer;
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
base_pointer = VirtualAlloc(fixed_address, size, MEM_RESERVE, PAGE_NOACCESS);
|
base_pointer = VirtualAlloc(fixed_address, size, MEM_RESERVE, PAGE_NOACCESS);
|
||||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
const int flags =
|
const int flags =
|
||||||
|
@ -330,7 +330,7 @@ void* MemoryArena::CreateReservedPtr(size_t size, void* fixed_address /*= nullpt
|
||||||
bool MemoryArena::ReleaseReservedPtr(void* address, size_t size)
|
bool MemoryArena::ReleaseReservedPtr(void* address, size_t size)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
result = static_cast<bool>(VirtualFree(address, 0, MEM_RELEASE));
|
result = static_cast<bool>(VirtualFree(address, 0, MEM_RELEASE));
|
||||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
result = (munmap(address, size) >= 0);
|
result = (munmap(address, size) >= 0);
|
||||||
|
@ -351,7 +351,7 @@ bool MemoryArena::ReleaseReservedPtr(void* address, size_t size)
|
||||||
|
|
||||||
bool MemoryArena::SetPageProtection(void* address, size_t length, bool readable, bool writable, bool executable)
|
bool MemoryArena::SetPageProtection(void* address, size_t length, bool readable, bool writable, bool executable)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
static constexpr DWORD protection_table[2][2][2] = {
|
static constexpr DWORD protection_table[2][2][2] = {
|
||||||
{{PAGE_NOACCESS, PAGE_EXECUTE}, {PAGE_WRITECOPY, PAGE_EXECUTE_WRITECOPY}},
|
{{PAGE_NOACCESS, PAGE_EXECUTE}, {PAGE_WRITECOPY, PAGE_EXECUTE_WRITECOPY}},
|
||||||
{{PAGE_READONLY, PAGE_EXECUTE_READ}, {PAGE_READWRITE, PAGE_EXECUTE_READWRITE}}};
|
{{PAGE_READONLY, PAGE_EXECUTE_READ}, {PAGE_READWRITE, PAGE_EXECUTE_READWRITE}}};
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
static bool SetPageProtection(void* address, size_t length, bool readable, bool writable, bool executable);
|
static bool SetPageProtection(void* address, size_t length, bool readable, bool writable, bool executable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
void* m_file_handle = nullptr;
|
void* m_file_handle = nullptr;
|
||||||
#elif defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(__FreeBSD__)
|
#elif defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
int m_shmem_fd = -1;
|
int m_shmem_fd = -1;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
Log_SetChannel(Common::PageFaultHandler);
|
Log_SetChannel(Common::PageFaultHandler);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#elif defined(__linux__) || defined(__ANDROID__)
|
#elif defined(__linux__) || defined(__ANDROID__)
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -78,7 +78,7 @@ static bool IsStoreInstruction(const void* ptr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIN32) && (defined(CPU_X64) || defined(CPU_AARCH64))
|
#if defined(_WIN32) && (defined(CPU_X64) || defined(CPU_AARCH64))
|
||||||
static PVOID s_veh_handle;
|
static PVOID s_veh_handle;
|
||||||
|
|
||||||
static LONG ExceptionHandler(PEXCEPTION_POINTERS exi)
|
static LONG ExceptionHandler(PEXCEPTION_POINTERS exi)
|
||||||
|
@ -222,7 +222,7 @@ bool InstallHandler(void* owner, Callback callback)
|
||||||
|
|
||||||
if (was_empty)
|
if (was_empty)
|
||||||
{
|
{
|
||||||
#if defined(WIN32) && (defined(CPU_X64) || defined(CPU_AARCH64))
|
#if defined(_WIN32) && (defined(CPU_X64) || defined(CPU_AARCH64))
|
||||||
s_veh_handle = AddVectoredExceptionHandler(1, ExceptionHandler);
|
s_veh_handle = AddVectoredExceptionHandler(1, ExceptionHandler);
|
||||||
if (!s_veh_handle)
|
if (!s_veh_handle)
|
||||||
{
|
{
|
||||||
|
@ -279,7 +279,7 @@ bool RemoveHandler(void* owner)
|
||||||
|
|
||||||
if (m_handlers.empty())
|
if (m_handlers.empty())
|
||||||
{
|
{
|
||||||
#if defined(WIN32) && (defined(CPU_X64) || defined(CPU_AARCH64))
|
#if defined(_WIN32) && (defined(CPU_X64) || defined(CPU_AARCH64))
|
||||||
RemoveVectoredExceptionHandler(s_veh_handle);
|
RemoveVectoredExceptionHandler(s_veh_handle);
|
||||||
s_veh_handle = nullptr;
|
s_veh_handle = nullptr;
|
||||||
#elif defined(USE_SIGSEGV)
|
#elif defined(USE_SIGSEGV)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ std::string StdStringFromFormatV(const char* format, std::va_list ap)
|
||||||
std::va_list ap_copy;
|
std::va_list ap_copy;
|
||||||
va_copy(ap_copy, ap);
|
va_copy(ap_copy, ap);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
int len = _vscprintf(format, ap_copy);
|
int len = _vscprintf(format, ap_copy);
|
||||||
#else
|
#else
|
||||||
int len = std::vsnprintf(nullptr, 0, format, ap_copy);
|
int len = std::vsnprintf(nullptr, 0, format, ap_copy);
|
||||||
|
@ -190,7 +190,7 @@ std::string EncodeHex(const u8* data, int length)
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
std::wstring UTF8StringToWideString(const std::string_view& str)
|
std::wstring UTF8StringToWideString(const std::string_view& str)
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,7 +160,7 @@ ALWAYS_INLINE static int StrideMemCmp(const void* p1, std::size_t p1_stride, con
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
/// Converts the specified UTF-8 string to a wide string.
|
/// Converts the specified UTF-8 string to a wide string.
|
||||||
std::wstring UTF8StringToWideString(const std::string_view& str);
|
std::wstring UTF8StringToWideString(const std::string_view& str);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
static double s_counter_frequency;
|
static double s_counter_frequency;
|
||||||
static bool s_counter_initialized = false;
|
static bool s_counter_initialized = false;
|
||||||
|
@ -250,7 +250,7 @@ void Timer::HybridSleep(std::uint64_t ns, std::uint64_t min_sleep_time)
|
||||||
|
|
||||||
void Timer::NanoSleep(std::uint64_t ns)
|
void Timer::NanoSleep(std::uint64_t ns)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
HANDLE timer = GetSleepTimer();
|
HANDLE timer = GetSleepTimer();
|
||||||
if (timer)
|
if (timer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);
|
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);
|
||||||
static time_t SystemTimeToUnixTime(const SYSTEMTIME* pst);
|
static time_t SystemTimeToUnixTime(const SYSTEMTIME* pst);
|
||||||
|
@ -11,7 +11,7 @@ static time_t SystemTimeToUnixTime(const SYSTEMTIME* pst);
|
||||||
|
|
||||||
Timestamp::Timestamp()
|
Timestamp::Timestamp()
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
m_value.wYear = 1970;
|
m_value.wYear = 1970;
|
||||||
m_value.wMonth = 1;
|
m_value.wMonth = 1;
|
||||||
m_value.wDayOfWeek = 0;
|
m_value.wDayOfWeek = 0;
|
||||||
|
@ -28,7 +28,7 @@ Timestamp::Timestamp()
|
||||||
|
|
||||||
Timestamp::Timestamp(const Timestamp& copy)
|
Timestamp::Timestamp(const Timestamp& copy)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
std::memcpy(&m_value, ©.m_value, sizeof(m_value));
|
std::memcpy(&m_value, ©.m_value, sizeof(m_value));
|
||||||
#else
|
#else
|
||||||
std::memcpy(&m_value, ©.m_value, sizeof(m_value));
|
std::memcpy(&m_value, ©.m_value, sizeof(m_value));
|
||||||
|
@ -37,7 +37,7 @@ Timestamp::Timestamp(const Timestamp& copy)
|
||||||
|
|
||||||
double Timestamp::DifferenceInSeconds(Timestamp& other) const
|
double Timestamp::DifferenceInSeconds(Timestamp& other) const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
FILETIME lft, rft;
|
FILETIME lft, rft;
|
||||||
SystemTimeToFileTime(&m_value, &lft);
|
SystemTimeToFileTime(&m_value, &lft);
|
||||||
SystemTimeToFileTime(&other.m_value, &rft);
|
SystemTimeToFileTime(&other.m_value, &rft);
|
||||||
|
@ -55,7 +55,7 @@ double Timestamp::DifferenceInSeconds(Timestamp& other) const
|
||||||
|
|
||||||
s64 Timestamp::DifferenceInSecondsInt(Timestamp& other) const
|
s64 Timestamp::DifferenceInSecondsInt(Timestamp& other) const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
FILETIME lft, rft;
|
FILETIME lft, rft;
|
||||||
SystemTimeToFileTime(&m_value, &lft);
|
SystemTimeToFileTime(&m_value, &lft);
|
||||||
SystemTimeToFileTime(&other.m_value, &rft);
|
SystemTimeToFileTime(&other.m_value, &rft);
|
||||||
|
@ -72,7 +72,7 @@ s64 Timestamp::DifferenceInSecondsInt(Timestamp& other) const
|
||||||
|
|
||||||
Timestamp::UnixTimestampValue Timestamp::AsUnixTimestamp() const
|
Timestamp::UnixTimestampValue Timestamp::AsUnixTimestamp() const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
return (UnixTimestampValue)SystemTimeToUnixTime(&m_value);
|
return (UnixTimestampValue)SystemTimeToUnixTime(&m_value);
|
||||||
#else
|
#else
|
||||||
return (UnixTimestampValue)m_value.tv_sec;
|
return (UnixTimestampValue)m_value.tv_sec;
|
||||||
|
@ -83,7 +83,7 @@ Timestamp::ExpandedTime Timestamp::AsExpandedTime() const
|
||||||
{
|
{
|
||||||
ExpandedTime et;
|
ExpandedTime et;
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
et.Year = m_value.wYear;
|
et.Year = m_value.wYear;
|
||||||
et.Month = m_value.wMonth;
|
et.Month = m_value.wMonth;
|
||||||
et.DayOfMonth = m_value.wDay;
|
et.DayOfMonth = m_value.wDay;
|
||||||
|
@ -111,7 +111,7 @@ Timestamp::ExpandedTime Timestamp::AsExpandedTime() const
|
||||||
|
|
||||||
void Timestamp::SetNow()
|
void Timestamp::SetNow()
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
GetSystemTime(&m_value);
|
GetSystemTime(&m_value);
|
||||||
#else
|
#else
|
||||||
gettimeofday(&m_value, NULL);
|
gettimeofday(&m_value, NULL);
|
||||||
|
@ -120,7 +120,7 @@ void Timestamp::SetNow()
|
||||||
|
|
||||||
void Timestamp::SetUnixTimestamp(UnixTimestampValue value)
|
void Timestamp::SetUnixTimestamp(UnixTimestampValue value)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
UnixTimeToSystemTime((time_t)value, &m_value);
|
UnixTimeToSystemTime((time_t)value, &m_value);
|
||||||
#else
|
#else
|
||||||
m_value.tv_sec = (time_t)value;
|
m_value.tv_sec = (time_t)value;
|
||||||
|
@ -130,7 +130,7 @@ void Timestamp::SetUnixTimestamp(UnixTimestampValue value)
|
||||||
|
|
||||||
void Timestamp::SetExpandedTime(const ExpandedTime& value)
|
void Timestamp::SetExpandedTime(const ExpandedTime& value)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
// bit of a hacky way to fill in the missing fields
|
// bit of a hacky way to fill in the missing fields
|
||||||
SYSTEMTIME st;
|
SYSTEMTIME st;
|
||||||
st.wYear = (WORD)value.Year;
|
st.wYear = (WORD)value.Year;
|
||||||
|
@ -170,7 +170,7 @@ void Timestamp::ToString(String& destination, const char* format) const
|
||||||
time_t unixTime = (time_t)AsUnixTimestamp();
|
time_t unixTime = (time_t)AsUnixTimestamp();
|
||||||
tm localTime;
|
tm localTime;
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
localtime_s(&localTime, &unixTime);
|
localtime_s(&localTime, &unixTime);
|
||||||
#else
|
#else
|
||||||
localtime_r(&unixTime, &localTime);
|
localtime_r(&unixTime, &localTime);
|
||||||
|
@ -207,7 +207,7 @@ Timestamp Timestamp::FromExpandedTime(const ExpandedTime& value)
|
||||||
|
|
||||||
bool Timestamp::operator==(const Timestamp& other) const
|
bool Timestamp::operator==(const Timestamp& other) const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
return std::memcmp(&m_value, &other.m_value, sizeof(m_value)) == 0;
|
return std::memcmp(&m_value, &other.m_value, sizeof(m_value)) == 0;
|
||||||
#else
|
#else
|
||||||
return std::memcmp(&m_value, &other.m_value, sizeof(m_value)) == 0;
|
return std::memcmp(&m_value, &other.m_value, sizeof(m_value)) == 0;
|
||||||
|
@ -221,7 +221,7 @@ bool Timestamp::operator!=(const Timestamp& other) const
|
||||||
|
|
||||||
bool Timestamp::operator<(const Timestamp& other) const
|
bool Timestamp::operator<(const Timestamp& other) const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
if (m_value.wYear > other.m_value.wYear)
|
if (m_value.wYear > other.m_value.wYear)
|
||||||
return false;
|
return false;
|
||||||
|
@ -279,7 +279,7 @@ bool Timestamp::operator<(const Timestamp& other) const
|
||||||
|
|
||||||
bool Timestamp::operator<=(const Timestamp& other) const
|
bool Timestamp::operator<=(const Timestamp& other) const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
if (m_value.wYear > other.m_value.wYear)
|
if (m_value.wYear > other.m_value.wYear)
|
||||||
return false;
|
return false;
|
||||||
|
@ -337,7 +337,7 @@ bool Timestamp::operator<=(const Timestamp& other) const
|
||||||
|
|
||||||
bool Timestamp::operator>(const Timestamp& other) const
|
bool Timestamp::operator>(const Timestamp& other) const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
if (m_value.wYear < other.m_value.wYear)
|
if (m_value.wYear < other.m_value.wYear)
|
||||||
return false;
|
return false;
|
||||||
|
@ -395,7 +395,7 @@ bool Timestamp::operator>(const Timestamp& other) const
|
||||||
|
|
||||||
bool Timestamp::operator>=(const Timestamp& other) const
|
bool Timestamp::operator>=(const Timestamp& other) const
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
if (m_value.wYear < other.m_value.wYear)
|
if (m_value.wYear < other.m_value.wYear)
|
||||||
return false;
|
return false;
|
||||||
|
@ -453,7 +453,7 @@ bool Timestamp::operator>=(const Timestamp& other) const
|
||||||
|
|
||||||
Timestamp& Timestamp::operator=(const Timestamp& other)
|
Timestamp& Timestamp::operator=(const Timestamp& other)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
std::memcpy(&m_value, &other.m_value, sizeof(m_value));
|
std::memcpy(&m_value, &other.m_value, sizeof(m_value));
|
||||||
#else
|
#else
|
||||||
std::memcpy(&m_value, &other.m_value, sizeof(m_value));
|
std::memcpy(&m_value, &other.m_value, sizeof(m_value));
|
||||||
|
@ -462,7 +462,7 @@ Timestamp& Timestamp::operator=(const Timestamp& other)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
// http://support.microsoft.com/kb/167296
|
// http://support.microsoft.com/kb/167296
|
||||||
static void UnixTimeToFileTime(time_t t, LPFILETIME pft)
|
static void UnixTimeToFileTime(time_t t, LPFILETIME pft)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#include "windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
static Timestamp FromExpandedTime(const ExpandedTime& value);
|
static Timestamp FromExpandedTime(const ExpandedTime& value);
|
||||||
|
|
||||||
// windows-specific
|
// windows-specific
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
FILETIME AsFileTime();
|
FILETIME AsFileTime();
|
||||||
void SetWindowsFileTime(const FILETIME* pFileTime);
|
void SetWindowsFileTime(const FILETIME* pFileTime);
|
||||||
static Timestamp FromWindowsFileTime(const FILETIME* pFileTime);
|
static Timestamp FromWindowsFileTime(const FILETIME* pFileTime);
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
Timestamp& operator=(const Timestamp& other);
|
Timestamp& operator=(const Timestamp& other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
SYSTEMTIME m_value;
|
SYSTEMTIME m_value;
|
||||||
#else
|
#else
|
||||||
struct timeval m_value;
|
struct timeval m_value;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#if defined(CPU_X64)
|
#if defined(CPU_X64)
|
||||||
|
|
||||||
// We need to include windows.h before xbyak does..
|
// We need to include windows.h before xbyak does..
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ constexpr u32 MAX_FAR_HOST_BYTES_PER_INSTRUCTION = 128;
|
||||||
constexpr u32 CODE_STORAGE_ALIGNMENT = 4096;
|
constexpr u32 CODE_STORAGE_ALIGNMENT = 4096;
|
||||||
|
|
||||||
// ABI selection
|
// ABI selection
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
#define ABI_WIN64 1
|
#define ABI_WIN64 1
|
||||||
#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__)
|
#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__)
|
||||||
#define ABI_SYSV 1
|
#define ABI_SYSV 1
|
||||||
|
|
|
@ -650,12 +650,12 @@ const char* Settings::GetCPUFastmemModeDisplayName(CPUFastmemMode mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr auto s_gpu_renderer_names = make_array(
|
static constexpr auto s_gpu_renderer_names = make_array(
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
"D3D11",
|
"D3D11",
|
||||||
#endif
|
#endif
|
||||||
"Vulkan", "OpenGL", "Software");
|
"Vulkan", "OpenGL", "Software");
|
||||||
static constexpr auto s_gpu_renderer_display_names = make_array(
|
static constexpr auto s_gpu_renderer_display_names = make_array(
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
TRANSLATABLE("GPURenderer", "Hardware (D3D11)"),
|
TRANSLATABLE("GPURenderer", "Hardware (D3D11)"),
|
||||||
#endif
|
#endif
|
||||||
TRANSLATABLE("GPURenderer", "Hardware (Vulkan)"), TRANSLATABLE("GPURenderer", "Hardware (OpenGL)"),
|
TRANSLATABLE("GPURenderer", "Hardware (Vulkan)"), TRANSLATABLE("GPURenderer", "Hardware (OpenGL)"),
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ bool CreateGPU(GPURenderer renderer)
|
||||||
g_gpu = GPU::CreateHardwareVulkanRenderer();
|
g_gpu = GPU::CreateHardwareVulkanRenderer();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
case GPURenderer::HardwareD3D11:
|
case GPURenderer::HardwareD3D11:
|
||||||
g_gpu = GPU::CreateHardwareD3D11Renderer();
|
g_gpu = GPU::CreateHardwareD3D11Renderer();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -183,7 +183,7 @@ bool TextureReplacements::ParseReplacementFilename(const std::string& filename,
|
||||||
{
|
{
|
||||||
const char* extension = std::strrchr(filename.c_str(), '.');
|
const char* extension = std::strrchr(filename.c_str(), '.');
|
||||||
const char* title = std::strrchr(filename.c_str(), '/');
|
const char* title = std::strrchr(filename.c_str(), '/');
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
const char* title2 = std::strrchr(filename.c_str(), '\\');
|
const char* title2 = std::strrchr(filename.c_str(), '\\');
|
||||||
if (title2 && (!title || title2 > title))
|
if (title2 && (!title || title2 > title))
|
||||||
title = title2;
|
title = title2;
|
||||||
|
|
|
@ -54,7 +54,7 @@ enum class PGXPMode : u8
|
||||||
|
|
||||||
enum class GPURenderer : u8
|
enum class GPURenderer : u8
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HardwareD3D11,
|
HardwareD3D11,
|
||||||
#endif
|
#endif
|
||||||
HardwareVulkan,
|
HardwareVulkan,
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
Log_SetChannel(NoGUIHostInterface);
|
Log_SetChannel(NoGUIHostInterface);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "frontend-common/d3d11_host_display.h"
|
#include "frontend-common/d3d11_host_display.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -97,13 +97,13 @@ bool NoGUIHostInterface::CreateDisplay(bool fullscreen)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GPURenderer::HardwareOpenGL:
|
case GPURenderer::HardwareOpenGL:
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
default:
|
default:
|
||||||
#endif
|
#endif
|
||||||
m_display = std::make_unique<FrontendCommon::OpenGLHostDisplay>();
|
m_display = std::make_unique<FrontendCommon::OpenGLHostDisplay>();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
case GPURenderer::HardwareD3D11:
|
case GPURenderer::HardwareD3D11:
|
||||||
default:
|
default:
|
||||||
m_display = std::make_unique<FrontendCommon::D3D11HostDisplay>();
|
m_display = std::make_unique<FrontendCommon::D3D11HostDisplay>();
|
||||||
|
@ -151,7 +151,7 @@ bool NoGUIHostInterface::AcquireHostDisplay()
|
||||||
bool needs_switch = false;
|
bool needs_switch = false;
|
||||||
switch (g_settings.gpu_renderer)
|
switch (g_settings.gpu_renderer)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
case GPURenderer::HardwareD3D11:
|
case GPURenderer::HardwareD3D11:
|
||||||
needs_switch = (render_api != HostDisplay::RenderAPI::D3D11);
|
needs_switch = (render_api != HostDisplay::RenderAPI::D3D11);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,7 +25,7 @@ Log_SetChannel(AutoUpdaterDialog);
|
||||||
|
|
||||||
// Logic to detect whether we can use the auto updater.
|
// Logic to detect whether we can use the auto updater.
|
||||||
// Currently Windows-only, and requires that the channel be defined by the buildbot.
|
// Currently Windows-only, and requires that the channel be defined by the buildbot.
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#if defined(__has_include) && __has_include("scmversion/tag.h")
|
#if defined(__has_include) && __has_include("scmversion/tag.h")
|
||||||
#include "scmversion/tag.h"
|
#include "scmversion/tag.h"
|
||||||
#ifdef SCM_RELEASE_TAGS
|
#ifdef SCM_RELEASE_TAGS
|
||||||
|
@ -444,7 +444,7 @@ void AutoUpdaterDialog::remindMeLaterClicked()
|
||||||
done(0);
|
done(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data)
|
bool AutoUpdaterDialog::processUpdate(const QByteArray& update_data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ private:
|
||||||
bool updateNeeded() const;
|
bool updateNeeded() const;
|
||||||
std::string getCurrentUpdateTag() const;
|
std::string getCurrentUpdateTag() const;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
bool processUpdate(const QByteArray& update_data);
|
bool processUpdate(const QByteArray& update_data);
|
||||||
bool extractUpdater(const QString& zip_path, const QString& destination_path);
|
bool extractUpdater(const QString& zip_path, const QString& destination_path);
|
||||||
bool doUpdate(const QString& zip_path, const QString& updater_path, const QString& destination_path);
|
bool doUpdate(const QString& zip_path, const QString& updater_path, const QString& destination_path);
|
||||||
|
|
|
@ -359,7 +359,7 @@ void DebuggerWindow::closeEvent(QCloseEvent* event)
|
||||||
|
|
||||||
void DebuggerWindow::setupAdditionalUi()
|
void DebuggerWindow::setupAdditionalUi()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
QFont fixedFont;
|
QFont fixedFont;
|
||||||
fixedFont.setFamily(QStringLiteral("Consolas"));
|
fixedFont.setFamily(QStringLiteral("Consolas"));
|
||||||
fixedFont.setFixedPitch(true);
|
fixedFont.setFixedPitch(true);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
// For enumerating adapters.
|
// For enumerating adapters.
|
||||||
#include "frontend-common/vulkan_host_display.h"
|
#include "frontend-common/vulkan_host_display.h"
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "frontend-common/d3d11_host_display.h"
|
#include "frontend-common/d3d11_host_display.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ void DisplaySettingsWidget::populateGPUAdaptersAndResolutions()
|
||||||
bool threaded_presentation_supported = false;
|
bool threaded_presentation_supported = false;
|
||||||
switch (static_cast<GPURenderer>(m_ui.renderer->currentIndex()))
|
switch (static_cast<GPURenderer>(m_ui.renderer->currentIndex()))
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
case GPURenderer::HardwareD3D11:
|
case GPURenderer::HardwareD3D11:
|
||||||
aml = FrontendCommon::D3D11HostDisplay::StaticGetAdapterAndModeList();
|
aml = FrontendCommon::D3D11HostDisplay::StaticGetAdapterAndModeList();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1626,7 +1626,7 @@ void MainWindow::checkForUpdates(bool display_message)
|
||||||
mbox.setTextFormat(Qt::RichText);
|
mbox.setTextFormat(Qt::RichText);
|
||||||
|
|
||||||
QString message;
|
QString message;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
message =
|
message =
|
||||||
tr("<p>Sorry, you are trying to update a DuckStation version which is not an official GitHub release. To "
|
tr("<p>Sorry, you are trying to update a DuckStation version which is not an official GitHub release. To "
|
||||||
"prevent incompatibilities, the auto-updater is only enabled on official builds.</p>"
|
"prevent incompatibilities, the auto-updater is only enabled on official builds.</p>"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <QtGui/QWindowStateChangeEvent>
|
#include <QtGui/QWindowStateChangeEvent>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(APPLE)
|
#if !defined(_WIN32) && !defined(APPLE)
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ std::optional<WindowInfo> QtDisplayWidget::getWindowInfo() const
|
||||||
WindowInfo wi;
|
WindowInfo wi;
|
||||||
|
|
||||||
// Windows and Apple are easy here since there's no display connection.
|
// Windows and Apple are easy here since there's no display connection.
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
wi.type = WindowInfo::Type::Win32;
|
wi.type = WindowInfo::Type::Win32;
|
||||||
wi.window_handle = reinterpret_cast<void*>(winId());
|
wi.window_handle = reinterpret_cast<void*>(winId());
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
Log_SetChannel(QtHostInterface);
|
Log_SetChannel(QtHostInterface);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
#include "frontend-common/d3d11_host_display.h"
|
#include "frontend-common/d3d11_host_display.h"
|
||||||
#include <KnownFolders.h>
|
#include <KnownFolders.h>
|
||||||
|
@ -570,13 +570,13 @@ HostDisplay* QtHostInterface::createHostDisplay()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GPURenderer::HardwareOpenGL:
|
case GPURenderer::HardwareOpenGL:
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
default:
|
default:
|
||||||
#endif
|
#endif
|
||||||
m_display = std::make_unique<FrontendCommon::OpenGLHostDisplay>();
|
m_display = std::make_unique<FrontendCommon::OpenGLHostDisplay>();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
case GPURenderer::HardwareD3D11:
|
case GPURenderer::HardwareD3D11:
|
||||||
default:
|
default:
|
||||||
m_display = std::make_unique<FrontendCommon::D3D11HostDisplay>();
|
m_display = std::make_unique<FrontendCommon::D3D11HostDisplay>();
|
||||||
|
@ -1616,7 +1616,7 @@ void QtHostInterface::wakeThread()
|
||||||
|
|
||||||
static std::string GetFontPath(const char* name)
|
static std::string GetFontPath(const char* name)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
PWSTR folder_path;
|
PWSTR folder_path;
|
||||||
if (FAILED(SHGetKnownFolderPath(FOLDERID_Fonts, 0, nullptr, &folder_path)))
|
if (FAILED(SHGetKnownFolderPath(FOLDERID_Fonts, 0, nullptr, &folder_path)))
|
||||||
return StringUtil::StdStringFromFormat("C:\\Windows\\Fonts\\%s", name);
|
return StringUtil::StdStringFromFormat("C:\\Windows\\Fonts\\%s", name);
|
||||||
|
@ -1637,7 +1637,7 @@ void QtHostInterface::setImGuiFont()
|
||||||
|
|
||||||
std::string path;
|
std::string path;
|
||||||
const ImWchar* range = nullptr;
|
const ImWchar* range = nullptr;
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (language == "ja")
|
if (language == "ja")
|
||||||
{
|
{
|
||||||
path = GetFontPath("msgothic.ttc");
|
path = GetFontPath("msgothic.ttc");
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
#include "cheevos.h"
|
#include "cheevos.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
#include <KnownFolders.h>
|
#include <KnownFolders.h>
|
||||||
#include <ShlObj.h>
|
#include <ShlObj.h>
|
||||||
|
@ -926,7 +926,7 @@ void CommonHostInterface::SetUserDirectory()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(_WIN32)
|
||||||
// On Windows, use My Documents\DuckStation.
|
// On Windows, use My Documents\DuckStation.
|
||||||
PWSTR documents_directory;
|
PWSTR documents_directory;
|
||||||
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &documents_directory)))
|
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &documents_directory)))
|
||||||
|
@ -3092,7 +3092,7 @@ void CommonHostInterface::SetTimerResolutionIncreased(bool enabled)
|
||||||
|
|
||||||
m_timer_resolution_increased = enabled;
|
m_timer_resolution_increased = enabled;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (enabled)
|
if (enabled)
|
||||||
timeBeginPeriod(1);
|
timeBeginPeriod(1);
|
||||||
else
|
else
|
||||||
|
|
|
@ -109,7 +109,7 @@ static constexpr std::array<const char*, static_cast<u32>(ControllerInterface::B
|
||||||
#ifdef WITH_SDL2
|
#ifdef WITH_SDL2
|
||||||
TRANSLATABLE("ControllerInterface", "SDL"),
|
TRANSLATABLE("ControllerInterface", "SDL"),
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
TRANSLATABLE("ControllerInterface", "XInput"),
|
TRANSLATABLE("ControllerInterface", "XInput"),
|
||||||
TRANSLATABLE("ControllerInterface", "DInput"),
|
TRANSLATABLE("ControllerInterface", "DInput"),
|
||||||
#endif
|
#endif
|
||||||
|
@ -143,7 +143,7 @@ ControllerInterface::Backend ControllerInterface::GetDefaultBackend()
|
||||||
#ifdef WITH_SDL2
|
#ifdef WITH_SDL2
|
||||||
return Backend::SDL;
|
return Backend::SDL;
|
||||||
#else
|
#else
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
return Backend::XInput;
|
return Backend::XInput;
|
||||||
#else
|
#else
|
||||||
return Backend::None;
|
return Backend::None;
|
||||||
|
@ -154,7 +154,7 @@ ControllerInterface::Backend ControllerInterface::GetDefaultBackend()
|
||||||
#ifdef WITH_SDL2
|
#ifdef WITH_SDL2
|
||||||
#include "sdl_controller_interface.h"
|
#include "sdl_controller_interface.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "dinput_controller_interface.h"
|
#include "dinput_controller_interface.h"
|
||||||
#include "xinput_controller_interface.h"
|
#include "xinput_controller_interface.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -168,7 +168,7 @@ std::unique_ptr<ControllerInterface> ControllerInterface::Create(Backend type)
|
||||||
if (type == Backend::SDL)
|
if (type == Backend::SDL)
|
||||||
return std::make_unique<SDLControllerInterface>();
|
return std::make_unique<SDLControllerInterface>();
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (type == Backend::XInput)
|
if (type == Backend::XInput)
|
||||||
return std::make_unique<XInputControllerInterface>();
|
return std::make_unique<XInputControllerInterface>();
|
||||||
if (type == Backend::DInput)
|
if (type == Backend::DInput)
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
#ifdef WITH_SDL2
|
#ifdef WITH_SDL2
|
||||||
SDL,
|
SDL,
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
XInput,
|
XInput,
|
||||||
DInput,
|
DInput,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
Log_SetChannel(CubebAudioStream);
|
Log_SetChannel(CubebAudioStream);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#pragma comment(lib, "Ole32.lib")
|
#pragma comment(lib, "Ole32.lib")
|
||||||
|
@ -21,7 +21,7 @@ bool CubebAudioStream::OpenDevice()
|
||||||
{
|
{
|
||||||
Assert(!IsOpen());
|
Assert(!IsOpen());
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||||
m_com_initialized_by_us = SUCCEEDED(hr);
|
m_com_initialized_by_us = SUCCEEDED(hr);
|
||||||
if (FAILED(hr) && hr != RPC_E_CHANGED_MODE && hr != S_FALSE)
|
if (FAILED(hr) && hr != RPC_E_CHANGED_MODE && hr != S_FALSE)
|
||||||
|
@ -150,7 +150,7 @@ void CubebAudioStream::DestroyContext()
|
||||||
cubeb_destroy(m_cubeb_context);
|
cubeb_destroy(m_cubeb_context);
|
||||||
m_cubeb_context = nullptr;
|
m_cubeb_context = nullptr;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
if (m_com_initialized_by_us)
|
if (m_com_initialized_by_us)
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@ protected:
|
||||||
cubeb_stream* m_cubeb_stream = nullptr;
|
cubeb_stream* m_cubeb_stream = nullptr;
|
||||||
bool m_paused = true;
|
bool m_paused = true;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
bool m_com_initialized_by_us = false;
|
bool m_com_initialized_by_us = false;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -2054,7 +2054,7 @@ void DrawSettingsWindow()
|
||||||
|
|
||||||
switch (s_settings_copy.gpu_renderer)
|
switch (s_settings_copy.gpu_renderer)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
case GPURenderer::HardwareD3D11:
|
case GPURenderer::HardwareD3D11:
|
||||||
{
|
{
|
||||||
settings_changed |= ToggleButtonForNonSetting(
|
settings_changed |= ToggleButtonForNonSetting(
|
||||||
|
@ -2463,7 +2463,7 @@ void DrawSettingsWindow()
|
||||||
"Use Debug GPU Device", "Enable debugging when supported by the host's renderer API. Only for developer use.",
|
"Use Debug GPU Device", "Enable debugging when supported by the host's renderer API. Only for developer use.",
|
||||||
&s_settings_copy.gpu_use_debug_device);
|
&s_settings_copy.gpu_use_debug_device);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
settings_changed |=
|
settings_changed |=
|
||||||
ToggleButton("Increase Timer Resolution", "Enables more precise frame pacing at the cost of battery life.",
|
ToggleButton("Increase Timer Resolution", "Enables more precise frame pacing at the cost of battery life.",
|
||||||
&s_settings_copy.increase_timer_resolution);
|
&s_settings_copy.increase_timer_resolution);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
Log_SetChannel(GameSettings);
|
Log_SetChannel(GameSettings);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
#endif
|
#endif
|
||||||
#include "SimpleIni.h"
|
#include "SimpleIni.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
|
|
||||||
// being a pain here...
|
// being a pain here...
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include "common/windows_headers.h"
|
#include "common/windows_headers.h"
|
||||||
#endif
|
#endif
|
||||||
#include "SimpleIni.h"
|
#include "SimpleIni.h"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ bool Updater::OpenUpdateZip(const char* path)
|
||||||
|
|
||||||
bool Updater::RecursiveDeleteDirectory(const char* path)
|
bool Updater::RecursiveDeleteDirectory(const char* path)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
// making this safer on Win32...
|
// making this safer on Win32...
|
||||||
std::wstring wpath(StringUtil::UTF8StringToWideString(path));
|
std::wstring wpath(StringUtil::UTF8StringToWideString(path));
|
||||||
wpath += L'\0';
|
wpath += L'\0';
|
||||||
|
@ -286,7 +286,7 @@ bool Updater::CommitUpdate()
|
||||||
const std::string dest_file_name = StringUtil::StdStringFromFormat(
|
const std::string dest_file_name = StringUtil::StdStringFromFormat(
|
||||||
"%s" FS_OSPATH_SEPARATOR_STR "%s", m_destination_directory.c_str(), ftu.destination_filename.c_str());
|
"%s" FS_OSPATH_SEPARATOR_STR "%s", m_destination_directory.c_str(), ftu.destination_filename.c_str());
|
||||||
m_progress->DisplayFormattedInformation("Moving '%s' to '%s'", staging_file_name.c_str(), dest_file_name.c_str());
|
m_progress->DisplayFormattedInformation("Moving '%s' to '%s'", staging_file_name.c_str(), dest_file_name.c_str());
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
const bool result =
|
const bool result =
|
||||||
MoveFileExW(StringUtil::UTF8StringToWideString(staging_file_name).c_str(),
|
MoveFileExW(StringUtil::UTF8StringToWideString(staging_file_name).c_str(),
|
||||||
StringUtil::UTF8StringToWideString(dest_file_name).c_str(), MOVEFILE_REPLACE_EXISTING);
|
StringUtil::UTF8StringToWideString(dest_file_name).c_str(), MOVEFILE_REPLACE_EXISTING);
|
||||||
|
|
Loading…
Reference in a new issue