Port citra #3352 to yuzu (#103)

* Port citra #3352 to yuzu

This change allows non x86_64 architectures to compile yuzu by skipping the building of dynarmic

* Fixed clang-format errors

* fixes more clang-format errors
This commit is contained in:
River City Ransomware 2018-01-19 19:36:09 -05:00 committed by bunnei
parent 0b6da0c1ab
commit c8a094e164
4 changed files with 36 additions and 12 deletions

View File

@ -54,6 +54,7 @@ function(detect_architecture symbol arch)
endif() endif()
endfunction() endfunction()
if (NOT ENABLE_GENERIC)
if (MSVC) if (MSVC)
detect_architecture("_M_AMD64" x86_64) detect_architecture("_M_AMD64" x86_64)
detect_architecture("_M_IX86" x86) detect_architecture("_M_IX86" x86)
@ -63,6 +64,8 @@ else()
detect_architecture("__i386__" x86) detect_architecture("__i386__" x86)
detect_architecture("__arm__" ARM) detect_architecture("__arm__" ARM)
endif() endif()
endif()
if (NOT DEFINED ARCHITECTURE) if (NOT DEFINED ARCHITECTURE)
set(ARCHITECTURE "GENERIC") set(ARCHITECTURE "GENERIC")
set(ARCHITECTURE_GENERIC 1) set(ARCHITECTURE_GENERIC 1)

View File

@ -1,7 +1,5 @@
add_library(core STATIC add_library(core STATIC
arm/arm_interface.h arm/arm_interface.h
arm/dynarmic/arm_dynarmic.cpp
arm/dynarmic/arm_dynarmic.h
arm/unicorn/arm_unicorn.cpp arm/unicorn/arm_unicorn.cpp
arm/unicorn/arm_unicorn.h arm/unicorn/arm_unicorn.h
core.cpp core.cpp
@ -178,5 +176,13 @@ add_library(core STATIC
create_target_directory_groups(core) create_target_directory_groups(core)
target_link_libraries(core PUBLIC common PRIVATE dynarmic video_core) target_link_libraries(core PUBLIC common PRIVATE video_core)
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt lz4_static unicorn) target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt lz4_static unicorn)
if (ARCHITECTURE_x86_64)
target_sources(core PRIVATE
arm/dynarmic/arm_dynarmic.cpp
arm/dynarmic/arm_dynarmic.h
)
target_link_libraries(core PRIVATE dynarmic)
endif()

View File

@ -5,7 +5,9 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "common/logging/log.h" #include "common/logging/log.h"
#ifdef ARCHITECTURE_x86_64
#include "core/arm/dynarmic/arm_dynarmic.h" #include "core/arm/dynarmic/arm_dynarmic.h"
#endif
#include "core/arm/unicorn/arm_unicorn.h" #include "core/arm/unicorn/arm_unicorn.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
@ -144,7 +146,12 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
break; break;
case Settings::CpuCore::Dynarmic: case Settings::CpuCore::Dynarmic:
default: default:
#ifdef ARCHITECTURE_x86_64
cpu_core = std::make_unique<ARM_Dynarmic>(); cpu_core = std::make_unique<ARM_Dynarmic>();
#else
cpu_core = std::make_unique<ARM_Unicorn>();
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
#endif
break; break;
} }

View File

@ -7,13 +7,16 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/scm_rev.h" #include "common/scm_rev.h"
#ifdef ARCHITECTURE_x86_64
#include "common/x64/cpu_detect.h" #include "common/x64/cpu_detect.h"
#endif
#include "core/core.h" #include "core/core.h"
#include "core/settings.h" #include "core/settings.h"
#include "core/telemetry_session.h" #include "core/telemetry_session.h"
namespace Core { namespace Core {
#ifdef ARCHITECTURE_x86_64
static const char* CpuVendorToStr(Common::CPUVendor vendor) { static const char* CpuVendorToStr(Common::CPUVendor vendor) {
switch (vendor) { switch (vendor) {
case Common::CPUVendor::INTEL: case Common::CPUVendor::INTEL:
@ -25,6 +28,7 @@ static const char* CpuVendorToStr(Common::CPUVendor vendor) {
} }
UNREACHABLE(); UNREACHABLE();
} }
#endif
static u64 GenerateTelemetryId() { static u64 GenerateTelemetryId() {
u64 telemetry_id{}; u64 telemetry_id{};
@ -114,6 +118,7 @@ TelemetrySession::TelemetrySession() {
AddField(Telemetry::FieldType::App, "BuildName", Common::g_build_name); AddField(Telemetry::FieldType::App, "BuildName", Common::g_build_name);
// Log user system information // Log user system information
#ifdef ARCHITECTURE_x86_64
AddField(Telemetry::FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string); AddField(Telemetry::FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string);
AddField(Telemetry::FieldType::UserSystem, "CPU_BrandString", AddField(Telemetry::FieldType::UserSystem, "CPU_BrandString",
Common::GetCPUCaps().brand_string); Common::GetCPUCaps().brand_string);
@ -135,6 +140,9 @@ TelemetrySession::TelemetrySession() {
Common::GetCPUCaps().sse4_1); Common::GetCPUCaps().sse4_1);
AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE42", AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE42",
Common::GetCPUCaps().sse4_2); Common::GetCPUCaps().sse4_2);
#else
AddField(Telemetry::FieldType::UserSystem, "CPU_Model", "Other");
#endif
#ifdef __APPLE__ #ifdef __APPLE__
AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Apple"); AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Apple");
#elif defined(_WIN32) #elif defined(_WIN32)