set_sys: Use official nintendo version string

This commit is contained in:
Zach Hilman 2019-03-10 19:54:13 -04:00
parent 73f2ee5484
commit debc7442f2
4 changed files with 25 additions and 19 deletions

View file

@ -11,6 +11,9 @@ namespace FileSys {
constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1}; constexpr ResultCode ERROR_PATH_NOT_FOUND{ErrorModule::FS, 1};
constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002}; constexpr ResultCode ERROR_ENTITY_NOT_FOUND{ErrorModule::FS, 1002};
constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001}; constexpr ResultCode ERROR_SD_CARD_NOT_FOUND{ErrorModule::FS, 2001};
constexpr ResultCode ERROR_OUT_OF_BOUNDS{ErrorModule::FS, 3005};
constexpr ResultCode ERROR_FAILED_MOUNT_ARCHIVE{ErrorModule::FS, 3223};
constexpr ResultCode ERROR_INVALID_ARGUMENT{ErrorModule::FS, 6001};
constexpr ResultCode ERROR_INVALID_OFFSET{ErrorModule::FS, 6061}; constexpr ResultCode ERROR_INVALID_OFFSET{ErrorModule::FS, 6061};
constexpr ResultCode ERROR_INVALID_SIZE{ErrorModule::FS, 6062}; constexpr ResultCode ERROR_INVALID_SIZE{ErrorModule::FS, 6062};

View file

@ -16,16 +16,20 @@ constexpr u8 VERSION_MAJOR = 5;
constexpr u8 VERSION_MINOR = 1; constexpr u8 VERSION_MINOR = 1;
constexpr u8 VERSION_MICRO = 0; constexpr u8 VERSION_MICRO = 0;
constexpr u8 REVISION_MAJOR = 0; constexpr u8 REVISION_MAJOR = 3;
constexpr u8 REVISION_MINOR = 0; constexpr u8 REVISION_MINOR = 0;
constexpr char PLATFORM_STRING[] = "YUZU"; constexpr char PLATFORM_STRING[] = "NX";
constexpr char VERSION_HASH[] = ""; constexpr char VERSION_HASH[] = "23f9df53e25709d756e0c76effcb2473bd3447dd";
constexpr char DISPLAY_VERSION[] = "5.1.0"; constexpr char DISPLAY_VERSION[] = "5.1.0";
constexpr char DISPLAY_TITLE[] = "YuzuEmulated Firmware for NX 5.1.0-0.0"; constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 5.1.0-3.0";
} // namespace SystemVersionData } // namespace SystemVersionData
std::string GetLongDisplayVersion() {
return SystemVersionData::DISPLAY_TITLE;
}
VirtualDir SystemVersion() { VirtualDir SystemVersion() {
VirtualFile file = std::make_shared<VectorVfsFile>(std::vector<u8>(0x100), "file"); VirtualFile file = std::make_shared<VectorVfsFile>(std::vector<u8>(0x100), "file");
file->WriteObject(SystemVersionData::VERSION_MAJOR, 0); file->WriteObject(SystemVersionData::VERSION_MAJOR, 0);
@ -34,13 +38,13 @@ VirtualDir SystemVersion() {
file->WriteObject(SystemVersionData::REVISION_MAJOR, 4); file->WriteObject(SystemVersionData::REVISION_MAJOR, 4);
file->WriteObject(SystemVersionData::REVISION_MINOR, 5); file->WriteObject(SystemVersionData::REVISION_MINOR, 5);
file->WriteArray(SystemVersionData::PLATFORM_STRING, file->WriteArray(SystemVersionData::PLATFORM_STRING,
std::min<u64>(sizeof(SystemVersionData::PLATFORM_STRING), 0x20ull), 0x8); std::min<u64>(sizeof(SystemVersionData::PLATFORM_STRING), 0x20ULL), 0x8);
file->WriteArray(SystemVersionData::VERSION_HASH, file->WriteArray(SystemVersionData::VERSION_HASH,
std::min<u64>(sizeof(SystemVersionData::VERSION_HASH), 0x40ull), 0x28); std::min<u64>(sizeof(SystemVersionData::VERSION_HASH), 0x40ULL), 0x28);
file->WriteArray(SystemVersionData::DISPLAY_VERSION, file->WriteArray(SystemVersionData::DISPLAY_VERSION,
std::min<u64>(sizeof(SystemVersionData::DISPLAY_VERSION), 0x18ull), 0x68); std::min<u64>(sizeof(SystemVersionData::DISPLAY_VERSION), 0x18ULL), 0x68);
file->WriteArray(SystemVersionData::DISPLAY_TITLE, file->WriteArray(SystemVersionData::DISPLAY_TITLE,
std::min<u64>(sizeof(SystemVersionData::DISPLAY_TITLE), 0x80ull), 0x80); std::min<u64>(sizeof(SystemVersionData::DISPLAY_TITLE), 0x80ULL), 0x80);
return std::make_shared<VectorVfsDirectory>(std::vector<VirtualFile>{file}, return std::make_shared<VectorVfsDirectory>(std::vector<VirtualFile>{file},
std::vector<VirtualDir>{}, "data"); std::vector<VirtualDir>{}, "data");
} }

View file

@ -4,10 +4,13 @@
#pragma once #pragma once
#include <string>
#include "core/file_sys/vfs_types.h" #include "core/file_sys/vfs_types.h"
namespace FileSys::SystemArchive { namespace FileSys::SystemArchive {
std::string GetLongDisplayVersion();
VirtualDir SystemVersion(); VirtualDir SystemVersion();
} // namespace FileSys::SystemArchive } // namespace FileSys::SystemArchive

View file

@ -4,6 +4,7 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/file_sys/errors.h"
#include "core/file_sys/system_archive/system_version.h" #include "core/file_sys/system_archive/system_version.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
@ -14,10 +15,6 @@ namespace Service::Set {
constexpr u64 SYSTEM_VERSION_FILE_MINOR_REVISION_OFFSET = 0x05; constexpr u64 SYSTEM_VERSION_FILE_MINOR_REVISION_OFFSET = 0x05;
constexpr ResultCode ERROR_FAILED_MOUNT_ARCHIVE(ErrorModule::FS, 3223);
constexpr ResultCode ERROR_READ_TOO_LARGE(ErrorModule::FS, 3005);
constexpr ResultCode ERROR_INVALID_NAME(ErrorModule::FS, 6001);
enum class GetFirmwareVersionType { enum class GetFirmwareVersionType {
Version1, Version1,
Version2, Version2,
@ -25,9 +22,8 @@ enum class GetFirmwareVersionType {
namespace { namespace {
void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionType type) { void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionType type) {
LOG_WARNING( LOG_WARNING(Service_SET, "called - Using hardcoded firmware version '{}'",
Service_SET, FileSys::SystemArchive::GetLongDisplayVersion());
"called - Using hardcoded firmware version 'YuzuEmulated Firmware for NX 5.1.0-0.0'");
ASSERT_MSG(ctx.GetWriteBufferSize() == 0x100, ASSERT_MSG(ctx.GetWriteBufferSize() == 0x100,
"FirmwareVersion output buffer must be 0x100 bytes in size!"); "FirmwareVersion output buffer must be 0x100 bytes in size!");
@ -47,21 +43,21 @@ void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionTy
if (archive == nullptr) { if (archive == nullptr) {
early_exit_failure("The system version archive couldn't be synthesized.", early_exit_failure("The system version archive couldn't be synthesized.",
ERROR_FAILED_MOUNT_ARCHIVE); FileSys::ERROR_FAILED_MOUNT_ARCHIVE);
return; return;
} }
const auto ver_file = archive->GetFile("file"); const auto ver_file = archive->GetFile("file");
if (ver_file == nullptr) { if (ver_file == nullptr) {
early_exit_failure("The system version archive didn't contain the file 'file'.", early_exit_failure("The system version archive didn't contain the file 'file'.",
ERROR_INVALID_NAME); FileSys::ERROR_INVALID_ARGUMENT);
return; return;
} }
auto data = ver_file->ReadAllBytes(); auto data = ver_file->ReadAllBytes();
if (data.size() != 0x100) { if (data.size() != 0x100) {
early_exit_failure("The system version file 'file' was not the correct size.", early_exit_failure("The system version file 'file' was not the correct size.",
ERROR_READ_TOO_LARGE); FileSys::ERROR_OUT_OF_BOUNDS);
return; return;
} }
@ -76,7 +72,7 @@ void GetFirmwareVersionImpl(Kernel::HLERequestContext& ctx, GetFirmwareVersionTy
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
} // namespace } // Anonymous namespace
void SET_SYS::GetFirmwareVersion(Kernel::HLERequestContext& ctx) { void SET_SYS::GetFirmwareVersion(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called"); LOG_DEBUG(Service_SET, "called");