mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Rename cpu_detect.h to platform.h and add OS
This commit is contained in:
parent
d41b5be908
commit
2ac6f60bbb
|
@ -24,7 +24,6 @@ add_library(common
|
||||||
cd_subchannel_replacement.h
|
cd_subchannel_replacement.h
|
||||||
cd_xa.cpp
|
cd_xa.cpp
|
||||||
cd_xa.h
|
cd_xa.h
|
||||||
cpu_detect.h
|
|
||||||
crash_handler.cpp
|
crash_handler.cpp
|
||||||
crash_handler.h
|
crash_handler.h
|
||||||
dimensional_array.h
|
dimensional_array.h
|
||||||
|
@ -66,6 +65,7 @@ add_library(common
|
||||||
memory_arena.h
|
memory_arena.h
|
||||||
page_fault_handler.cpp
|
page_fault_handler.cpp
|
||||||
page_fault_handler.h
|
page_fault_handler.h
|
||||||
|
platform.h
|
||||||
pbp_types.h
|
pbp_types.h
|
||||||
progress_callback.cpp
|
progress_callback.cpp
|
||||||
progress_callback.h
|
progress_callback.h
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "cd_image.h"
|
#include "cd_image.h"
|
||||||
#include "cd_subchannel_replacement.h"
|
#include "cd_subchannel_replacement.h"
|
||||||
#include "cpu_detect.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "file_system.h"
|
#include "file_system.h"
|
||||||
#include "libchdr/chd.h"
|
#include "libchdr/chd.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "platform.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
@ -180,7 +180,7 @@ bool CDImageCHD::Open(const char* filename, Common::Error* error)
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
error->SetFormattedMessage("Incorrect track number at index %d, expected %d got %d", num_tracks,
|
error->SetFormattedMessage("Incorrect track number at index %d, expected %d got %d", num_tracks,
|
||||||
(num_tracks + 1), track_num);
|
(num_tracks + 1), track_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
<ClInclude Include="byte_stream.h" />
|
<ClInclude Include="byte_stream.h" />
|
||||||
<ClInclude Include="cd_image.h" />
|
<ClInclude Include="cd_image.h" />
|
||||||
<ClInclude Include="cd_image_hasher.h" />
|
<ClInclude Include="cd_image_hasher.h" />
|
||||||
<ClInclude Include="cpu_detect.h" />
|
|
||||||
<ClInclude Include="crash_handler.h" />
|
<ClInclude Include="crash_handler.h" />
|
||||||
<ClInclude Include="d3d11\shader_cache.h" />
|
<ClInclude Include="d3d11\shader_cache.h" />
|
||||||
<ClInclude Include="d3d11\shader_compiler.h" />
|
<ClInclude Include="d3d11\shader_compiler.h" />
|
||||||
|
@ -94,6 +93,7 @@
|
||||||
<ClInclude Include="md5_digest.h" />
|
<ClInclude Include="md5_digest.h" />
|
||||||
<ClInclude Include="null_audio_stream.h" />
|
<ClInclude Include="null_audio_stream.h" />
|
||||||
<ClInclude Include="pbp_types.h" />
|
<ClInclude Include="pbp_types.h" />
|
||||||
|
<ClInclude Include="platform.h" />
|
||||||
<ClInclude Include="progress_callback.h" />
|
<ClInclude Include="progress_callback.h" />
|
||||||
<ClInclude Include="memory_arena.h" />
|
<ClInclude Include="memory_arena.h" />
|
||||||
<ClInclude Include="page_fault_handler.h" />
|
<ClInclude Include="page_fault_handler.h" />
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
<ClInclude Include="file_system.h" />
|
<ClInclude Include="file_system.h" />
|
||||||
<ClInclude Include="string_util.h" />
|
<ClInclude Include="string_util.h" />
|
||||||
<ClInclude Include="md5_digest.h" />
|
<ClInclude Include="md5_digest.h" />
|
||||||
<ClInclude Include="cpu_detect.h" />
|
|
||||||
<ClInclude Include="d3d11\shader_cache.h">
|
<ClInclude Include="d3d11\shader_cache.h">
|
||||||
<Filter>d3d11</Filter>
|
<Filter>d3d11</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -112,6 +111,7 @@
|
||||||
<ClInclude Include="easing.h" />
|
<ClInclude Include="easing.h" />
|
||||||
<ClInclude Include="pbp_types.h" />
|
<ClInclude Include="pbp_types.h" />
|
||||||
<ClInclude Include="error.h" />
|
<ClInclude Include="error.h" />
|
||||||
|
<ClInclude Include="platform.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="jit_code_buffer.cpp" />
|
<ClCompile Include="jit_code_buffer.cpp" />
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
|
|
||||||
#if defined(_M_X64)
|
|
||||||
#define CPU_X64 1
|
|
||||||
#elif defined(_M_IX86)
|
|
||||||
#define CPU_X86 1
|
|
||||||
#elif defined(_M_ARM64)
|
|
||||||
#define CPU_AARCH64 1
|
|
||||||
#elif defined(_M_ARM)
|
|
||||||
#define CPU_AARCH32 1
|
|
||||||
#else
|
|
||||||
#error Unknown architecture.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__GNUC__) || defined(__clang__)
|
|
||||||
|
|
||||||
#if defined(__x86_64__)
|
|
||||||
#define CPU_X64 1
|
|
||||||
#elif defined(__i386__)
|
|
||||||
#define CPU_X86 1
|
|
||||||
#elif defined(__aarch64__)
|
|
||||||
#define CPU_AARCH64 1
|
|
||||||
#elif defined(__arm__)
|
|
||||||
#define CPU_AARCH32 1
|
|
||||||
#else
|
|
||||||
#error Unknown architecture.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#error Unknown compiler.
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "jit_code_buffer.h"
|
#include "jit_code_buffer.h"
|
||||||
#include "align.h"
|
#include "align.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "common/log.h"
|
#include "log.h"
|
||||||
#include "cpu_detect.h"
|
#include "platform.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
Log_SetChannel(JitCodeBuffer);
|
Log_SetChannel(JitCodeBuffer);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "page_fault_handler.h"
|
#include "page_fault_handler.h"
|
||||||
#include "common/cpu_detect.h"
|
#include "log.h"
|
||||||
#include "common/log.h"
|
#include "platform.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
Log_SetChannel(Common::PageFaultHandler);
|
Log_SetChannel(Common::PageFaultHandler);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
#include "common/windows_headers.h"
|
#include "windows_headers.h"
|
||||||
#elif defined(__linux__) || defined(__ANDROID__)
|
#elif defined(__linux__) || defined(__ANDROID__)
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
61
src/common/platform.h
Normal file
61
src/common/platform.h
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
|
#if defined(_M_X64)
|
||||||
|
#define CPU_X64 1
|
||||||
|
#elif defined(_M_IX86)
|
||||||
|
#define CPU_X86 1
|
||||||
|
#elif defined(_M_ARM64)
|
||||||
|
#define CPU_AARCH64 1
|
||||||
|
#elif defined(_M_ARM)
|
||||||
|
#define CPU_AARCH32 1
|
||||||
|
#else
|
||||||
|
#error Unknown architecture.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(__GNUC__) || defined(__clang__)
|
||||||
|
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
#define CPU_X64 1
|
||||||
|
#elif defined(__i386__)
|
||||||
|
#define CPU_X86 1
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define CPU_AARCH64 1
|
||||||
|
#elif defined(__arm__)
|
||||||
|
#define CPU_AARCH32 1
|
||||||
|
#else
|
||||||
|
#error Unknown architecture.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error Unknown compiler.
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CPU_X64)
|
||||||
|
#define CPU_ARCH_STR "x64"
|
||||||
|
#elif defined(CPU_X86)
|
||||||
|
#define CPU_ARCH_STR "x86"
|
||||||
|
#elif defined(CPU_AARCH32)
|
||||||
|
#define CPU_ARCH_STR "AArch32"
|
||||||
|
#elif defined(CPU_AARCH64)
|
||||||
|
#define CPU_ARCH_STR "AArch64"
|
||||||
|
#else
|
||||||
|
#define CPU_ARCH_STR "Unknown"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define SYSTEM_STR "Windows"
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
#define SYSTEM_STR "Android"
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#define SYSTEM_STR "Linux"
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
#define SYSTEM_STR "FreeBSD"
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#define SYSTEM_STR "macOS"
|
||||||
|
#else
|
||||||
|
#define SYSTEM_STR "Unknown"
|
||||||
|
#endif
|
|
@ -1,8 +1,8 @@
|
||||||
#include "cdrom.h"
|
#include "cdrom.h"
|
||||||
#include "common/align.h"
|
#include "common/align.h"
|
||||||
#include "common/cd_image.h"
|
#include "common/cd_image.h"
|
||||||
#include "common/cpu_detect.h"
|
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
#include "common/platform.h"
|
||||||
#include "common/state_wrapper.h"
|
#include "common/state_wrapper.h"
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
#include "interrupt_controller.h"
|
#include "interrupt_controller.h"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "common/cpu_detect.h"
|
#include "common/platform.h"
|
||||||
#include "cpu_types.h"
|
#include "cpu_types.h"
|
||||||
|
|
||||||
#if defined(CPU_X64)
|
#if defined(CPU_X64)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "gpu_sw.h"
|
#include "gpu_sw.h"
|
||||||
#include "common/align.h"
|
#include "common/align.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/cpu_detect.h"
|
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/make_array.h"
|
#include "common/make_array.h"
|
||||||
|
#include "common/platform.h"
|
||||||
#include "host_display.h"
|
#include "host_display.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "texture_replacements.h"
|
#include "texture_replacements.h"
|
||||||
#include "common/cpu_detect.h"
|
|
||||||
#include "common/file_system.h"
|
#include "common/file_system.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
#include "common/platform.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "common/timer.h"
|
#include "common/timer.h"
|
||||||
#include "host_interface.h"
|
#include "host_interface.h"
|
||||||
|
|
Loading…
Reference in a new issue