diff options
| author | 2019-03-23 13:48:29 -0400 | |
|---|---|---|
| committer | 2019-03-23 13:48:29 -0400 | |
| commit | 1665b70cc6f3b75982c454b04e827df1da2f0a76 (patch) | |
| tree | 304222297999c1c01d840f2549d7a29394269186 /src/core/file_sys | |
| parent | Merge pull request #2253 from lioncash/flags (diff) | |
| parent | set_sys: Move constants to anonymous namespace (diff) | |
| download | yuzu-1665b70cc6f3b75982c454b04e827df1da2f0a76.tar.gz yuzu-1665b70cc6f3b75982c454b04e827df1da2f0a76.tar.xz yuzu-1665b70cc6f3b75982c454b04e827df1da2f0a76.zip | |
Merge pull request #2221 from DarkLordZach/firmware-version
set_sys: Implement GetFirmwareVersion(2) for libnx hosversion
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/errors.h | 3 | ||||
| -rw-r--r-- | src/core/file_sys/system_archive/system_archive.cpp | 3 | ||||
| -rw-r--r-- | src/core/file_sys/system_archive/system_version.cpp | 52 | ||||
| -rw-r--r-- | src/core/file_sys/system_archive/system_version.h | 16 |
4 files changed, 73 insertions, 1 deletions
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index e4a4ee4ab..bb4654366 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h | |||
| @@ -11,6 +11,9 @@ namespace FileSys { | |||
| 11 | constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1}; | 11 | constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1}; |
| 12 | constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002}; | 12 | constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002}; |
| 13 | constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001}; | 13 | constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001}; |
| 14 | constexpr ResultCode ERROR_OUT_OF_BOUNDS{ErrorModule::FS, 3005}; | ||
| 15 | constexpr ResultCode ERROR_FAILED_MOUNT_ARCHIVE{ErrorModule::FS, 3223}; | ||
| 16 | constexpr ResultCode ERROR_INVALID_ARGUMENT{ErrorModule::FS, 6001}; | ||
| 14 | constexpr ResultCode ERROR_INVALID_OFFSET{ErrorModule::FS, 6061}; | 17 | constexpr ResultCode ERROR_INVALID_OFFSET{ErrorModule::FS, 6061}; |
| 15 | constexpr ResultCode ERROR_INVALID_SIZE{ErrorModule::FS, 6062}; | 18 | constexpr ResultCode ERROR_INVALID_SIZE{ErrorModule::FS, 6062}; |
| 16 | 19 | ||
diff --git a/src/core/file_sys/system_archive/system_archive.cpp b/src/core/file_sys/system_archive/system_archive.cpp index e3e79f40a..c9722ed77 100644 --- a/src/core/file_sys/system_archive/system_archive.cpp +++ b/src/core/file_sys/system_archive/system_archive.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include "core/file_sys/romfs.h" | 6 | #include "core/file_sys/romfs.h" |
| 7 | #include "core/file_sys/system_archive/ng_word.h" | 7 | #include "core/file_sys/system_archive/ng_word.h" |
| 8 | #include "core/file_sys/system_archive/system_archive.h" | 8 | #include "core/file_sys/system_archive/system_archive.h" |
| 9 | #include "core/file_sys/system_archive/system_version.h" | ||
| 9 | 10 | ||
| 10 | namespace FileSys::SystemArchive { | 11 | namespace FileSys::SystemArchive { |
| 11 | 12 | ||
| @@ -30,7 +31,7 @@ constexpr std::array<SystemArchiveDescriptor, SYSTEM_ARCHIVE_COUNT> SYSTEM_ARCHI | |||
| 30 | {0x0100000000000806, "NgWord", &NgWord1}, | 31 | {0x0100000000000806, "NgWord", &NgWord1}, |
| 31 | {0x0100000000000807, "SsidList", nullptr}, | 32 | {0x0100000000000807, "SsidList", nullptr}, |
| 32 | {0x0100000000000808, "Dictionary", nullptr}, | 33 | {0x0100000000000808, "Dictionary", nullptr}, |
| 33 | {0x0100000000000809, "SystemVersion", nullptr}, | 34 | {0x0100000000000809, "SystemVersion", &SystemVersion}, |
| 34 | {0x010000000000080A, "AvatarImage", nullptr}, | 35 | {0x010000000000080A, "AvatarImage", nullptr}, |
| 35 | {0x010000000000080B, "LocalNews", nullptr}, | 36 | {0x010000000000080B, "LocalNews", nullptr}, |
| 36 | {0x010000000000080C, "Eula", nullptr}, | 37 | {0x010000000000080C, "Eula", nullptr}, |
diff --git a/src/core/file_sys/system_archive/system_version.cpp b/src/core/file_sys/system_archive/system_version.cpp new file mode 100644 index 000000000..6e22f97b0 --- /dev/null +++ b/src/core/file_sys/system_archive/system_version.cpp | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/file_sys/system_archive/system_version.h" | ||
| 6 | #include "core/file_sys/vfs_vector.h" | ||
| 7 | |||
| 8 | namespace FileSys::SystemArchive { | ||
| 9 | |||
| 10 | namespace SystemVersionData { | ||
| 11 | |||
| 12 | // This section should reflect the best system version to describe yuzu's HLE api. | ||
| 13 | // TODO(DarkLordZach): Update when HLE gets better. | ||
| 14 | |||
| 15 | constexpr u8 VERSION_MAJOR = 5; | ||
| 16 | constexpr u8 VERSION_MINOR = 1; | ||
| 17 | constexpr u8 VERSION_MICRO = 0; | ||
| 18 | |||
| 19 | constexpr u8 REVISION_MAJOR = 3; | ||
| 20 | constexpr u8 REVISION_MINOR = 0; | ||
| 21 | |||
| 22 | constexpr char PLATFORM_STRING[] = "NX"; | ||
| 23 | constexpr char VERSION_HASH[] = "23f9df53e25709d756e0c76effcb2473bd3447dd"; | ||
| 24 | constexpr char DISPLAY_VERSION[] = "5.1.0"; | ||
| 25 | constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 5.1.0-3.0"; | ||
| 26 | |||
| 27 | } // namespace SystemVersionData | ||
| 28 | |||
| 29 | std::string GetLongDisplayVersion() { | ||
| 30 | return SystemVersionData::DISPLAY_TITLE; | ||
| 31 | } | ||
| 32 | |||
| 33 | VirtualDir SystemVersion() { | ||
| 34 | VirtualFile file = std::make_shared<VectorVfsFile>(std::vector<u8>(0x100), "file"); | ||
| 35 | file->WriteObject(SystemVersionData::VERSION_MAJOR, 0); | ||
| 36 | file->WriteObject(SystemVersionData::VERSION_MINOR, 1); | ||
| 37 | file->WriteObject(SystemVersionData::VERSION_MICRO, 2); | ||
| 38 | file->WriteObject(SystemVersionData::REVISION_MAJOR, 4); | ||
| 39 | file->WriteObject(SystemVersionData::REVISION_MINOR, 5); | ||
| 40 | file->WriteArray(SystemVersionData::PLATFORM_STRING, | ||
| 41 | std::min<u64>(sizeof(SystemVersionData::PLATFORM_STRING), 0x20ULL), 0x8); | ||
| 42 | file->WriteArray(SystemVersionData::VERSION_HASH, | ||
| 43 | std::min<u64>(sizeof(SystemVersionData::VERSION_HASH), 0x40ULL), 0x28); | ||
| 44 | file->WriteArray(SystemVersionData::DISPLAY_VERSION, | ||
| 45 | std::min<u64>(sizeof(SystemVersionData::DISPLAY_VERSION), 0x18ULL), 0x68); | ||
| 46 | file->WriteArray(SystemVersionData::DISPLAY_TITLE, | ||
| 47 | std::min<u64>(sizeof(SystemVersionData::DISPLAY_TITLE), 0x80ULL), 0x80); | ||
| 48 | return std::make_shared<VectorVfsDirectory>(std::vector<VirtualFile>{file}, | ||
| 49 | std::vector<VirtualDir>{}, "data"); | ||
| 50 | } | ||
| 51 | |||
| 52 | } // namespace FileSys::SystemArchive | ||
diff --git a/src/core/file_sys/system_archive/system_version.h b/src/core/file_sys/system_archive/system_version.h new file mode 100644 index 000000000..deed79b26 --- /dev/null +++ b/src/core/file_sys/system_archive/system_version.h | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <string> | ||
| 8 | #include "core/file_sys/vfs_types.h" | ||
| 9 | |||
| 10 | namespace FileSys::SystemArchive { | ||
| 11 | |||
| 12 | std::string GetLongDisplayVersion(); | ||
| 13 | |||
| 14 | VirtualDir SystemVersion(); | ||
| 15 | |||
| 16 | } // namespace FileSys::SystemArchive | ||