mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 21:01:37 +00:00
Added check for AVX on boot
This commit is contained in:
parent
da5db2a05a
commit
ea905f357b
8 changed files with 76 additions and 4 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -58,3 +58,6 @@
|
||||||
[submodule "thirdparty/json"]
|
[submodule "thirdparty/json"]
|
||||||
path = thirdparty/json
|
path = thirdparty/json
|
||||||
url = https://github.com/nlohmann/json
|
url = https://github.com/nlohmann/json
|
||||||
|
[submodule "thirdparty/cpuid"]
|
||||||
|
path = thirdparty/cpuid
|
||||||
|
url = https://github.com/steinwurf/cpuid.git
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,18 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
set(UNLEASHED_RECOMP_OS_CXX_SOURCES_NO_AVX
|
||||||
|
"os/win32/host_win32.cpp"
|
||||||
|
)
|
||||||
|
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
set(UNLEASHED_RECOMP_OS_CXX_SOURCES_NO_AVX
|
||||||
|
"os/linux/host_linux.cpp"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND UNLEASHED_RECOMP_OS_CXX_SOURCES ${UNLEASHED_RECOMP_OS_CXX_SOURCES_NO_AVX})
|
||||||
|
|
||||||
set(UNLEASHED_RECOMP_CPU_CXX_SOURCES
|
set(UNLEASHED_RECOMP_CPU_CXX_SOURCES
|
||||||
"cpu/guest_thread.cpp"
|
"cpu/guest_thread.cpp"
|
||||||
)
|
)
|
||||||
|
|
@ -204,6 +216,7 @@ set(UNLEASHED_RECOMP_THIRDPARTY_SOURCES
|
||||||
|
|
||||||
set(UNLEASHED_RECOMP_THIRDPARTY_INCLUDES
|
set(UNLEASHED_RECOMP_THIRDPARTY_INCLUDES
|
||||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/concurrentqueue"
|
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/concurrentqueue"
|
||||||
|
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/cpuid"
|
||||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/ddspp"
|
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/ddspp"
|
||||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/imgui"
|
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/imgui"
|
||||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/implot"
|
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/implot"
|
||||||
|
|
@ -223,6 +236,7 @@ if (UNLEASHED_RECOMP_D3D12)
|
||||||
list(APPEND UNLEASHED_RECOMP_THIRDPARTY_SOURCES "${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/D3D12MemoryAllocator/src/D3D12MemAlloc.cpp")
|
list(APPEND UNLEASHED_RECOMP_THIRDPARTY_SOURCES "${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/D3D12MemoryAllocator/src/D3D12MemAlloc.cpp")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set_source_files_properties(${UNLEASHED_RECOMP_OS_CXX_SOURCES_NO_AVX} PROPERTIES COMPILE_FLAGS "-mno-avx" SKIP_PRECOMPILE_HEADERS ON)
|
||||||
set_source_files_properties(${UNLEASHED_RECOMP_THIRDPARTY_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
set_source_files_properties(${UNLEASHED_RECOMP_THIRDPARTY_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
||||||
|
|
||||||
set(UNLEASHED_RECOMP_CXX_SOURCES
|
set(UNLEASHED_RECOMP_CXX_SOURCES
|
||||||
|
|
@ -354,6 +368,8 @@ if (WIN32)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/cpuid" cpuid)
|
||||||
|
|
||||||
target_link_libraries(UnleashedRecomp PRIVATE
|
target_link_libraries(UnleashedRecomp PRIVATE
|
||||||
fmt::fmt
|
fmt::fmt
|
||||||
libzstd_static
|
libzstd_static
|
||||||
|
|
@ -367,6 +383,7 @@ target_link_libraries(UnleashedRecomp PRIVATE
|
||||||
UnleashedRecompLib
|
UnleashedRecompLib
|
||||||
xxHash::xxhash
|
xxHash::xxhash
|
||||||
CURL::libcurl
|
CURL::libcurl
|
||||||
|
steinwurf::cpuid
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(UnleashedRecomp PRIVATE
|
target_include_directories(UnleashedRecomp PRIVATE
|
||||||
|
|
|
||||||
|
|
@ -692,6 +692,12 @@ std::unordered_map<std::string_view, std::unordered_map<ELanguage, std::string>>
|
||||||
{ ELanguage::Italian, "Impossibile creare un backend D3D12 (Windows) o Vulkan.\n\nAssicurati che:\n\n- Il tuo sistema soddisfi i requisiti minimi.\n- I driver della scheda grafica siano aggiornati.\n- Il tuo sistema operativo sia aggiornato." }
|
{ ELanguage::Italian, "Impossibile creare un backend D3D12 (Windows) o Vulkan.\n\nAssicurati che:\n\n- Il tuo sistema soddisfi i requisiti minimi.\n- I driver della scheda grafica siano aggiornati.\n- Il tuo sistema operativo sia aggiornato." }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"System_UnsupportedCPU",
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Your CPU does not meet the minimum system requirements." }
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Common_On",
|
"Common_On",
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
#include <kernel/xdbf.h>
|
#include <kernel/xdbf.h>
|
||||||
#include <install/installer.h>
|
#include <install/installer.h>
|
||||||
#include <install/update_checker.h>
|
#include <install/update_checker.h>
|
||||||
|
#include <os/host.h>
|
||||||
#include <os/logger.h>
|
#include <os/logger.h>
|
||||||
#include <os/process.h>
|
#include <os/process.h>
|
||||||
#include <os/registry.h>
|
#include <os/registry.h>
|
||||||
|
|
@ -156,18 +157,20 @@ int main(int argc, char *argv[])
|
||||||
os::process::CheckConsole();
|
os::process::CheckConsole();
|
||||||
|
|
||||||
if (!os::registry::Init())
|
if (!os::registry::Init())
|
||||||
LOGN_WARNING("OS doesn't support registry");
|
LOGN_WARNING("OS does not support registry.");
|
||||||
|
|
||||||
os::logger::Init();
|
os::logger::Init();
|
||||||
|
|
||||||
bool forceInstaller = false;
|
bool forceInstaller = false;
|
||||||
bool forceDLCInstaller = false;
|
bool forceDLCInstaller = false;
|
||||||
|
bool bypassCPURequirements = false;
|
||||||
const char *sdlVideoDriver = nullptr;
|
const char *sdlVideoDriver = nullptr;
|
||||||
|
|
||||||
for (uint32_t i = 1; i < argc; i++)
|
for (uint32_t i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
forceInstaller = forceInstaller || (strcmp(argv[i], "--install") == 0);
|
forceInstaller = forceInstaller || (strcmp(argv[i], "--install") == 0);
|
||||||
forceDLCInstaller = forceDLCInstaller || (strcmp(argv[i], "--install-dlc") == 0);
|
forceDLCInstaller = forceDLCInstaller || (strcmp(argv[i], "--install-dlc") == 0);
|
||||||
|
bypassCPURequirements = bypassCPURequirements || (strcmp(argv[i], "--bypass-cpu-requirements") == 0);
|
||||||
|
|
||||||
if (strcmp(argv[i], "--sdl-video-driver") == 0)
|
if (strcmp(argv[i], "--sdl-video-driver") == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -180,6 +183,12 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
Config::Load();
|
Config::Load();
|
||||||
|
|
||||||
|
if (!bypassCPURequirements && !os::host::IsCapableCPU())
|
||||||
|
{
|
||||||
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, GameWindow::GetTitle(), Localise("System_UnsupportedCPU").c_str(), GameWindow::s_pWindow);
|
||||||
|
std::_Exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Check the time since the last time an update was checked. Store the new time if the difference is more than six hours.
|
// Check the time since the last time an update was checked. Store the new time if the difference is more than six hours.
|
||||||
constexpr double TimeBetweenUpdateChecksInSeconds = 6 * 60 * 60;
|
constexpr double TimeBetweenUpdateChecksInSeconds = 6 * 60 * 60;
|
||||||
time_t timeNow = std::time(nullptr);
|
time_t timeNow = std::time(nullptr);
|
||||||
|
|
|
||||||
6
UnleashedRecomp/os/host.h
Normal file
6
UnleashedRecomp/os/host.h
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace os::host
|
||||||
|
{
|
||||||
|
bool IsCapableCPU();
|
||||||
|
};
|
||||||
15
UnleashedRecomp/os/linux/host_linux.cpp
Normal file
15
UnleashedRecomp/os/linux/host_linux.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <os/host.h>
|
||||||
|
|
||||||
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
|
#include <cpuid/cpuinfo.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool os::host::IsCapableCPU()
|
||||||
|
{
|
||||||
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
|
cpuid::cpuinfo cpuid;
|
||||||
|
return cpuid.has_avx();
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
15
UnleashedRecomp/os/win32/host_win32.cpp
Normal file
15
UnleashedRecomp/os/win32/host_win32.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <os/host.h>
|
||||||
|
|
||||||
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
|
#include <cpuid/cpuinfo.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool os::host::IsCapableCPU()
|
||||||
|
{
|
||||||
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
|
cpuid::cpuinfo cpuid;
|
||||||
|
return cpuid.has_avx();
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
1
thirdparty/cpuid
vendored
Submodule
1
thirdparty/cpuid
vendored
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 3d0b3b5bae4f352c68e8c67fd6894b4d74d1c984
|
||||||
Loading…
Add table
Reference in a new issue