From e4318a191457f5e46eca20060c8ebcab3e6758eb Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 15 Jun 2021 03:35:43 -0400 Subject: hle: api_version: Add HLE API version constants --- src/core/CMakeLists.txt | 1 + .../file_sys/system_archive/system_version.cpp | 48 +++++++--------------- src/core/hle/api_version.h | 38 +++++++++++++++++ 3 files changed, 54 insertions(+), 33 deletions(-) create mode 100644 src/core/hle/api_version.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ab60841d5..83b5b7676 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -139,6 +139,7 @@ add_library(core STATIC frontend/input.h hardware_interrupt_manager.cpp hardware_interrupt_manager.h + hle/api_version.h hle/ipc.h hle/ipc_helpers.h hle/kernel/board/nintendo/nx/k_system_control.cpp diff --git a/src/core/file_sys/system_archive/system_version.cpp b/src/core/file_sys/system_archive/system_version.cpp index 54704105b..9b76d007e 100644 --- a/src/core/file_sys/system_archive/system_version.cpp +++ b/src/core/file_sys/system_archive/system_version.cpp @@ -4,47 +4,29 @@ #include "core/file_sys/system_archive/system_version.h" #include "core/file_sys/vfs_vector.h" +#include "core/hle/api_version.h" namespace FileSys::SystemArchive { -namespace SystemVersionData { - -// This section should reflect the best system version to describe yuzu's HLE api. -// TODO(DarkLordZach): Update when HLE gets better. - -constexpr u8 VERSION_MAJOR = 11; -constexpr u8 VERSION_MINOR = 0; -constexpr u8 VERSION_MICRO = 1; - -constexpr u8 REVISION_MAJOR = 1; -constexpr u8 REVISION_MINOR = 0; - -constexpr char PLATFORM_STRING[] = "NX"; -constexpr char VERSION_HASH[] = "69103fcb2004dace877094c2f8c29e6113be5dbf"; -constexpr char DISPLAY_VERSION[] = "11.0.1"; -constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 11.0.1-1.0"; - -} // namespace SystemVersionData - std::string GetLongDisplayVersion() { - return SystemVersionData::DISPLAY_TITLE; + return HLE::ApiVersion::DISPLAY_TITLE; } VirtualDir SystemVersion() { VirtualFile file = std::make_shared(std::vector(0x100), "file"); - file->WriteObject(SystemVersionData::VERSION_MAJOR, 0); - file->WriteObject(SystemVersionData::VERSION_MINOR, 1); - file->WriteObject(SystemVersionData::VERSION_MICRO, 2); - file->WriteObject(SystemVersionData::REVISION_MAJOR, 4); - file->WriteObject(SystemVersionData::REVISION_MINOR, 5); - file->WriteArray(SystemVersionData::PLATFORM_STRING, - std::min(sizeof(SystemVersionData::PLATFORM_STRING), 0x20ULL), 0x8); - file->WriteArray(SystemVersionData::VERSION_HASH, - std::min(sizeof(SystemVersionData::VERSION_HASH), 0x40ULL), 0x28); - file->WriteArray(SystemVersionData::DISPLAY_VERSION, - std::min(sizeof(SystemVersionData::DISPLAY_VERSION), 0x18ULL), 0x68); - file->WriteArray(SystemVersionData::DISPLAY_TITLE, - std::min(sizeof(SystemVersionData::DISPLAY_TITLE), 0x80ULL), 0x80); + file->WriteObject(HLE::ApiVersion::HOS_VERSION_MAJOR, 0); + file->WriteObject(HLE::ApiVersion::HOS_VERSION_MINOR, 1); + file->WriteObject(HLE::ApiVersion::HOS_VERSION_MICRO, 2); + file->WriteObject(HLE::ApiVersion::SDK_REVISION_MAJOR, 4); + file->WriteObject(HLE::ApiVersion::SDK_REVISION_MINOR, 5); + file->WriteArray(HLE::ApiVersion::PLATFORM_STRING, + std::min(sizeof(HLE::ApiVersion::PLATFORM_STRING), 0x20ULL), 0x8); + file->WriteArray(HLE::ApiVersion::VERSION_HASH, + std::min(sizeof(HLE::ApiVersion::VERSION_HASH), 0x40ULL), 0x28); + file->WriteArray(HLE::ApiVersion::DISPLAY_VERSION, + std::min(sizeof(HLE::ApiVersion::DISPLAY_VERSION), 0x18ULL), 0x68); + file->WriteArray(HLE::ApiVersion::DISPLAY_TITLE, + std::min(sizeof(HLE::ApiVersion::DISPLAY_TITLE), 0x80ULL), 0x80); return std::make_shared(std::vector{file}, std::vector{}, "data"); } diff --git a/src/core/hle/api_version.h b/src/core/hle/api_version.h new file mode 100644 index 000000000..811732179 --- /dev/null +++ b/src/core/hle/api_version.h @@ -0,0 +1,38 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/common_types.h" + +// This file contains yuzu's HLE API version constants. + +namespace HLE::ApiVersion { + +// Horizon OS version constants. + +constexpr u8 HOS_VERSION_MAJOR = 11; +constexpr u8 HOS_VERSION_MINOR = 0; +constexpr u8 HOS_VERSION_MICRO = 1; + +// NintendoSDK version constants. + +constexpr u8 SDK_REVISION_MAJOR = 1; +constexpr u8 SDK_REVISION_MINOR = 0; + +constexpr char PLATFORM_STRING[] = "NX"; +constexpr char VERSION_HASH[] = "69103fcb2004dace877094c2f8c29e6113be5dbf"; +constexpr char DISPLAY_VERSION[] = "11.0.1"; +constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 11.0.1-1.0"; + +// Atmosphere version constants. + +constexpr u8 ATMOSPHERE_RELEASE_VERSION_MAJOR = 0; +constexpr u8 ATMOSPHERE_RELEASE_VERSION_MINOR = 19; +constexpr u8 ATMOSPHERE_RELEASE_VERSION_MICRO = 4; + +constexpr u32 GetTargetFirmware() { + return u32{HOS_VERSION_MAJOR} << 24 | u32{HOS_VERSION_MINOR} << 16 | + u32{HOS_VERSION_MICRO} << 8 | 0U; +} + +} // namespace HLE::ApiVersion -- cgit v1.2.3