mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 04:11:36 +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"]
|
||||
path = thirdparty/json
|
||||
url = https://github.com/nlohmann/json
|
||||
[submodule "thirdparty/cpuid"]
|
||||
path = thirdparty/cpuid
|
||||
url = https://github.com/steinwurf/cpuid.git
|
||||
|
|
|
|||
|
|
@ -97,7 +97,19 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||
"os/linux/user_linux.cpp"
|
||||
"os/linux/version_linux.cpp"
|
||||
)
|
||||
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
|
||||
"cpu/guest_thread.cpp"
|
||||
|
|
@ -204,6 +216,7 @@ set(UNLEASHED_RECOMP_THIRDPARTY_SOURCES
|
|||
|
||||
set(UNLEASHED_RECOMP_THIRDPARTY_INCLUDES
|
||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/concurrentqueue"
|
||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/cpuid"
|
||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/ddspp"
|
||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/imgui"
|
||||
"${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/implot"
|
||||
|
|
@ -222,7 +235,8 @@ if (UNLEASHED_RECOMP_D3D12)
|
|||
list(APPEND UNLEASHED_RECOMP_THIRDPARTY_INCLUDES "${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/D3D12MemoryAllocator/include")
|
||||
list(APPEND UNLEASHED_RECOMP_THIRDPARTY_SOURCES "${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/D3D12MemoryAllocator/src/D3D12MemAlloc.cpp")
|
||||
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(UNLEASHED_RECOMP_CXX_SOURCES
|
||||
|
|
@ -354,6 +368,8 @@ if (WIN32)
|
|||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/cpuid" cpuid)
|
||||
|
||||
target_link_libraries(UnleashedRecomp PRIVATE
|
||||
fmt::fmt
|
||||
libzstd_static
|
||||
|
|
@ -366,7 +382,8 @@ target_link_libraries(UnleashedRecomp PRIVATE
|
|||
tomlplusplus::tomlplusplus
|
||||
UnleashedRecompLib
|
||||
xxHash::xxhash
|
||||
CURL::libcurl
|
||||
CURL::libcurl
|
||||
steinwurf::cpuid
|
||||
)
|
||||
|
||||
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." }
|
||||
}
|
||||
},
|
||||
{
|
||||
"System_UnsupportedCPU",
|
||||
{
|
||||
{ ELanguage::English, "Your CPU does not meet the minimum system requirements." }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Common_On",
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include <kernel/xdbf.h>
|
||||
#include <install/installer.h>
|
||||
#include <install/update_checker.h>
|
||||
#include <os/host.h>
|
||||
#include <os/logger.h>
|
||||
#include <os/process.h>
|
||||
#include <os/registry.h>
|
||||
|
|
@ -156,18 +157,20 @@ int main(int argc, char *argv[])
|
|||
os::process::CheckConsole();
|
||||
|
||||
if (!os::registry::Init())
|
||||
LOGN_WARNING("OS doesn't support registry");
|
||||
LOGN_WARNING("OS does not support registry.");
|
||||
|
||||
os::logger::Init();
|
||||
|
||||
bool forceInstaller = false;
|
||||
bool forceDLCInstaller = false;
|
||||
bool bypassCPURequirements = false;
|
||||
const char *sdlVideoDriver = nullptr;
|
||||
|
||||
for (uint32_t i = 1; i < argc; i++)
|
||||
{
|
||||
forceInstaller = forceInstaller || (strcmp(argv[i], "--install") == 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)
|
||||
{
|
||||
|
|
@ -180,6 +183,12 @@ int main(int argc, char *argv[])
|
|||
|
||||
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.
|
||||
constexpr double TimeBetweenUpdateChecksInSeconds = 6 * 60 * 60;
|
||||
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