summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appveyor.yml2
m---------externals/dynarmic0
-rw-r--r--src/common/telemetry.cpp65
-rw-r--r--src/common/telemetry.h12
-rw-r--r--src/core/file_sys/content_archive.h1
-rw-r--r--src/core/file_sys/registered_cache.cpp3
-rw-r--r--src/core/file_sys/romfs_factory.cpp38
-rw-r--r--src/core/file_sys/romfs_factory.h12
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp19
-rw-r--r--src/core/hle/service/filesystem/filesystem.h4
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp42
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.h1
-rw-r--r--src/core/telemetry_session.cpp69
13 files changed, 185 insertions, 83 deletions
diff --git a/appveyor.yml b/appveyor.yml
index 436d98fa1..a6f12b267 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -53,7 +53,7 @@ build_script:
# https://www.appveyor.com/docs/build-phase
msbuild msvc_build/yuzu.sln /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
} else {
- C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -j4 -C mingw_build/ 2>&1'
+ C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -C mingw_build/ 2>&1'
}
after_build:
diff --git a/externals/dynarmic b/externals/dynarmic
-Subproject 550d662f0ece868209f0f760dddc8b2ad4698b1
+Subproject a42f301c28832bb2b4ffaf4fe7b84b9765542f4
diff --git a/src/common/telemetry.cpp b/src/common/telemetry.cpp
index bf1f54886..f53a8d193 100644
--- a/src/common/telemetry.cpp
+++ b/src/common/telemetry.cpp
@@ -3,8 +3,15 @@
// Refer to the license.txt file included.
#include <algorithm>
+#include <cstring>
+#include "common/assert.h"
+#include "common/scm_rev.h"
#include "common/telemetry.h"
+#ifdef ARCHITECTURE_x86_64
+#include "common/x64/cpu_detect.h"
+#endif
+
namespace Telemetry {
void FieldCollection::Accept(VisitorInterface& visitor) const {
@@ -37,4 +44,62 @@ template class Field<std::string>;
template class Field<const char*>;
template class Field<std::chrono::microseconds>;
+#ifdef ARCHITECTURE_x86_64
+static const char* CpuVendorToStr(Common::CPUVendor vendor) {
+ switch (vendor) {
+ case Common::CPUVendor::INTEL:
+ return "Intel";
+ case Common::CPUVendor::AMD:
+ return "Amd";
+ case Common::CPUVendor::OTHER:
+ return "Other";
+ }
+ UNREACHABLE();
+}
+#endif
+
+void AppendBuildInfo(FieldCollection& fc) {
+ const bool is_git_dirty{std::strstr(Common::g_scm_desc, "dirty") != nullptr};
+ fc.AddField(FieldType::App, "Git_IsDirty", is_git_dirty);
+ fc.AddField(FieldType::App, "Git_Branch", Common::g_scm_branch);
+ fc.AddField(FieldType::App, "Git_Revision", Common::g_scm_rev);
+ fc.AddField(FieldType::App, "BuildDate", Common::g_build_date);
+ fc.AddField(FieldType::App, "BuildName", Common::g_build_name);
+}
+
+void AppendCPUInfo(FieldCollection& fc) {
+#ifdef ARCHITECTURE_x86_64
+ fc.AddField(FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string);
+ fc.AddField(FieldType::UserSystem, "CPU_BrandString", Common::GetCPUCaps().brand_string);
+ fc.AddField(FieldType::UserSystem, "CPU_Vendor", CpuVendorToStr(Common::GetCPUCaps().vendor));
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX", Common::GetCPUCaps().avx);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AVX2", Common::GetCPUCaps().avx2);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI1", Common::GetCPUCaps().bmi1);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_BMI2", Common::GetCPUCaps().bmi2);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_FMA", Common::GetCPUCaps().fma);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_FMA4", Common::GetCPUCaps().fma4);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_SSE", Common::GetCPUCaps().sse);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_SSE2", Common::GetCPUCaps().sse2);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_SSE3", Common::GetCPUCaps().sse3);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_SSSE3", Common::GetCPUCaps().ssse3);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_SSE41", Common::GetCPUCaps().sse4_1);
+ fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_SSE42", Common::GetCPUCaps().sse4_2);
+#else
+ fc.AddField(FieldType::UserSystem, "CPU_Model", "Other");
+#endif
+}
+
+void AppendOSInfo(FieldCollection& fc) {
+#ifdef __APPLE__
+ fc.AddField(FieldType::UserSystem, "OsPlatform", "Apple");
+#elif defined(_WIN32)
+ fc.AddField(FieldType::UserSystem, "OsPlatform", "Windows");
+#elif defined(__linux__) || defined(linux) || defined(__linux)
+ fc.AddField(FieldType::UserSystem, "OsPlatform", "Linux");
+#else
+ fc.AddField(FieldType::UserSystem, "OsPlatform", "Unknown");
+#endif
+}
+
} // namespace Telemetry
diff --git a/src/common/telemetry.h b/src/common/telemetry.h
index 3bab75b59..8d6ab986b 100644
--- a/src/common/telemetry.h
+++ b/src/common/telemetry.h
@@ -180,4 +180,16 @@ struct NullVisitor : public VisitorInterface {
void Complete() override {}
};
+/// Appends build-specific information to the given FieldCollection,
+/// such as branch name, revision hash, etc.
+void AppendBuildInfo(FieldCollection& fc);
+
+/// Appends CPU-specific information to the given FieldCollection,
+/// such as instruction set extensions, etc.
+void AppendCPUInfo(FieldCollection& fc);
+
+/// Appends OS-specific information to the given FieldCollection,
+/// such as platform name, etc.
+void AppendOSInfo(FieldCollection& fc);
+
} // namespace Telemetry
diff --git a/src/core/file_sys/content_archive.h b/src/core/file_sys/content_archive.h
index b82e65ad5..4b74c54ec 100644
--- a/src/core/file_sys/content_archive.h
+++ b/src/core/file_sys/content_archive.h
@@ -27,6 +27,7 @@ enum class NCAContentType : u8 {
Control = 2,
Manual = 3,
Data = 4,
+ Data_Unknown5 = 5, ///< Seems to be used on some system archives
};
enum class NCASectionCryptoType : u8 {
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index d25eeee34..e90dc6695 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -77,12 +77,13 @@ static ContentRecordType GetCRTypeFromNCAType(NCAContentType type) {
case NCAContentType::Control:
return ContentRecordType::Control;
case NCAContentType::Data:
+ case NCAContentType::Data_Unknown5:
return ContentRecordType::Data;
case NCAContentType::Manual:
// TODO(DarkLordZach): Peek at NCA contents to differentiate Manual and Legal.
return ContentRecordType::Manual;
default:
- UNREACHABLE();
+ UNREACHABLE_MSG("Invalid NCAContentType={:02X}", static_cast<u8>(type));
}
}
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
index 54fbd3267..1b3824a61 100644
--- a/src/core/file_sys/romfs_factory.cpp
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -6,7 +6,9 @@
#include <memory>
#include "common/common_types.h"
#include "common/logging/log.h"
+#include "core/core.h"
#include "core/file_sys/romfs_factory.h"
+#include "core/hle/kernel/process.h"
namespace FileSys {
@@ -17,9 +19,41 @@ RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader) {
}
}
-ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id) {
- // TODO(DarkLordZach): Use title id.
+ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess() {
return MakeResult<VirtualFile>(file);
}
+ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) {
+ switch (storage) {
+ case StorageId::NandSystem: {
+ const auto res = Service::FileSystem::GetSystemNANDContents()->GetEntry(title_id, type);
+ if (res == nullptr) {
+ // TODO(DarkLordZach): Find the right error code to use here
+ return ResultCode(-1);
+ }
+ const auto romfs = res->GetRomFS();
+ if (romfs == nullptr) {
+ // TODO(DarkLordZach): Find the right error code to use here
+ return ResultCode(-1);
+ }
+ return MakeResult<VirtualFile>(romfs);
+ }
+ case StorageId::NandUser: {
+ const auto res = Service::FileSystem::GetUserNANDContents()->GetEntry(title_id, type);
+ if (res == nullptr) {
+ // TODO(DarkLordZach): Find the right error code to use here
+ return ResultCode(-1);
+ }
+ const auto romfs = res->GetRomFS();
+ if (romfs == nullptr) {
+ // TODO(DarkLordZach): Find the right error code to use here
+ return ResultCode(-1);
+ }
+ return MakeResult<VirtualFile>(romfs);
+ }
+ default:
+ UNIMPLEMENTED_MSG("Unimplemented storage_id={:02X}", static_cast<u8>(storage));
+ }
+}
+
} // namespace FileSys
diff --git a/src/core/file_sys/romfs_factory.h b/src/core/file_sys/romfs_factory.h
index c19787cd4..455cd4159 100644
--- a/src/core/file_sys/romfs_factory.h
+++ b/src/core/file_sys/romfs_factory.h
@@ -11,12 +11,22 @@
namespace FileSys {
+enum class StorageId : u8 {
+ None = 0,
+ Host = 1,
+ GameCard = 2,
+ NandSystem = 3,
+ NandUser = 4,
+ SdCard = 5,
+};
+
/// File system interface to the RomFS archive
class RomFSFactory {
public:
explicit RomFSFactory(Loader::AppLoader& app_loader);
- ResultVal<VirtualFile> Open(u64 title_id);
+ ResultVal<VirtualFile> OpenCurrentProcess();
+ ResultVal<VirtualFile> Open(u64 title_id, StorageId storage, ContentRecordType type);
private:
VirtualFile file;
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index da658cbe6..f374111c1 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -256,15 +256,28 @@ ResultCode RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory) {
return RESULT_SUCCESS;
}
-ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id) {
- LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}", title_id);
+ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess() {
+ LOG_TRACE(Service_FS, "Opening RomFS for current process");
if (romfs_factory == nullptr) {
// TODO(bunnei): Find a better error code for this
return ResultCode(-1);
}
- return romfs_factory->Open(title_id);
+ return romfs_factory->OpenCurrentProcess();
+}
+
+ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id, FileSys::StorageId storage_id,
+ FileSys::ContentRecordType type) {
+ LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}, storage_id={:02X}, type={:02X}",
+ title_id, static_cast<u8>(storage_id), static_cast<u8>(type));
+
+ if (romfs_factory == nullptr) {
+ // TODO(bunnei): Find a better error code for this
+ return ResultCode(-1);
+ }
+
+ return romfs_factory->Open(title_id, storage_id, type);
}
ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space,
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index 1d6f922dd..37a2878b0 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -27,7 +27,9 @@ ResultCode RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory)
ResultCode RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory);
ResultCode RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory);
-ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id);
+ResultVal<FileSys::VirtualFile> OpenRomFSCurrentProcess();
+ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id, FileSys::StorageId storage_id,
+ FileSys::ContentRecordType type);
ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space,
FileSys::SaveDataDescriptor save_struct);
ResultVal<FileSys::VirtualDir> OpenSDMC();
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 1470f9017..2f8a7a3c1 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -23,15 +23,6 @@
namespace Service::FileSystem {
-enum class StorageId : u8 {
- None = 0,
- Host = 1,
- GameCard = 2,
- NandSystem = 3,
- NandUser = 4,
- SdCard = 5,
-};
-
class IStorage final : public ServiceFramework<IStorage> {
public:
explicit IStorage(FileSys::VirtualFile backend_)
@@ -467,7 +458,7 @@ FSP_SRV::FSP_SRV() : ServiceFramework("fsp-srv") {
{110, nullptr, "OpenContentStorageFileSystem"},
{200, &FSP_SRV::OpenDataStorageByCurrentProcess, "OpenDataStorageByCurrentProcess"},
{201, nullptr, "OpenDataStorageByProgramId"},
- {202, nullptr, "OpenDataStorageByDataId"},
+ {202, &FSP_SRV::OpenDataStorageByDataId, "OpenDataStorageByDataId"},
{203, &FSP_SRV::OpenRomStorage, "OpenRomStorage"},
{400, nullptr, "OpenDeviceOperator"},
{500, nullptr, "OpenSdCardDetectionEventNotifier"},
@@ -580,7 +571,7 @@ void FSP_SRV::GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx) {
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_FS, "called");
- auto romfs = OpenRomFS(Core::System::GetInstance().CurrentProcess()->program_id);
+ auto romfs = OpenRomFSCurrentProcess();
if (romfs.Failed()) {
// TODO (bunnei): Find the right error code to use here
LOG_CRITICAL(Service_FS, "no file system interface available!");
@@ -596,10 +587,37 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
rb.PushIpcInterface<IStorage>(std::move(storage));
}
+void FSP_SRV::OpenDataStorageByDataId(Kernel::HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ const auto storage_id = rp.PopRaw<FileSys::StorageId>();
+ const auto unknown = rp.PopRaw<u32>();
+ const auto title_id = rp.PopRaw<u64>();
+
+ LOG_DEBUG(Service_FS, "called with storage_id={:02X}, unknown={:08X}, title_id={:016X}",
+ static_cast<u8>(storage_id), unknown, title_id);
+
+ auto data = OpenRomFS(title_id, storage_id, FileSys::ContentRecordType::Data);
+ if (data.Failed()) {
+ // TODO(DarkLordZach): Find the right error code to use here
+ LOG_ERROR(Service_FS,
+ "could not open data storage with title_id={:016X}, storage_id={:02X}", title_id,
+ static_cast<u8>(storage_id));
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultCode(-1));
+ return;
+ }
+
+ IStorage storage(std::move(data.Unwrap()));
+
+ IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushIpcInterface<IStorage>(std::move(storage));
+}
+
void FSP_SRV::OpenRomStorage(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
- auto storage_id = rp.PopRaw<StorageId>();
+ auto storage_id = rp.PopRaw<FileSys::StorageId>();
auto title_id = rp.PopRaw<u64>();
LOG_DEBUG(Service_FS, "called with storage_id={:02X}, title_id={:016X}",
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h
index 07f99c93d..f073ac523 100644
--- a/src/core/hle/service/filesystem/fsp_srv.h
+++ b/src/core/hle/service/filesystem/fsp_srv.h
@@ -25,6 +25,7 @@ private:
void MountSaveData(Kernel::HLERequestContext& ctx);
void GetGlobalAccessLogMode(Kernel::HLERequestContext& ctx);
void OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx);
+ void OpenDataStorageByDataId(Kernel::HLERequestContext& ctx);
void OpenRomStorage(Kernel::HLERequestContext& ctx);
FileSys::VirtualFile romfs;
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index 69aa7a7be..7e4584fc2 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -2,34 +2,16 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include <cstring>
-
#include "common/assert.h"
+#include "common/common_types.h"
#include "common/file_util.h"
-#include "common/scm_rev.h"
-#ifdef ARCHITECTURE_x86_64
-#include "common/x64/cpu_detect.h"
-#endif
+
#include "core/core.h"
#include "core/settings.h"
#include "core/telemetry_session.h"
namespace Core {
-#ifdef ARCHITECTURE_x86_64
-static const char* CpuVendorToStr(Common::CPUVendor vendor) {
- switch (vendor) {
- case Common::CPUVendor::INTEL:
- return "Intel";
- case Common::CPUVendor::AMD:
- return "Amd";
- case Common::CPUVendor::OTHER:
- return "Other";
- }
- UNREACHABLE();
-}
-#endif
-
static u64 GenerateTelemetryId() {
u64 telemetry_id{};
return telemetry_id;
@@ -112,48 +94,11 @@ TelemetrySession::TelemetrySession() {
}
// Log application information
- const bool is_git_dirty{std::strstr(Common::g_scm_desc, "dirty") != nullptr};
- AddField(Telemetry::FieldType::App, "Git_IsDirty", is_git_dirty);
- AddField(Telemetry::FieldType::App, "Git_Branch", Common::g_scm_branch);
- AddField(Telemetry::FieldType::App, "Git_Revision", Common::g_scm_rev);
- AddField(Telemetry::FieldType::App, "BuildDate", Common::g_build_date);
- AddField(Telemetry::FieldType::App, "BuildName", Common::g_build_name);
-
-// Log user system information
-#ifdef ARCHITECTURE_x86_64
- AddField(Telemetry::FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string);
- AddField(Telemetry::FieldType::UserSystem, "CPU_BrandString",
- Common::GetCPUCaps().brand_string);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Vendor",
- CpuVendorToStr(Common::GetCPUCaps().vendor));
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_AVX", Common::GetCPUCaps().avx);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_AVX2", Common::GetCPUCaps().avx2);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_BMI1", Common::GetCPUCaps().bmi1);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_BMI2", Common::GetCPUCaps().bmi2);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_FMA", Common::GetCPUCaps().fma);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_FMA4", Common::GetCPUCaps().fma4);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE", Common::GetCPUCaps().sse);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE2", Common::GetCPUCaps().sse2);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE3", Common::GetCPUCaps().sse3);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSSE3",
- Common::GetCPUCaps().ssse3);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE41",
- Common::GetCPUCaps().sse4_1);
- AddField(Telemetry::FieldType::UserSystem, "CPU_Extension_x64_SSE42",
- Common::GetCPUCaps().sse4_2);
-#else
- AddField(Telemetry::FieldType::UserSystem, "CPU_Model", "Other");
-#endif
-#ifdef __APPLE__
- AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Apple");
-#elif defined(_WIN32)
- AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Windows");
-#elif defined(__linux__) || defined(linux) || defined(__linux)
- AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Linux");
-#else
- AddField(Telemetry::FieldType::UserSystem, "OsPlatform", "Unknown");
-#endif
+ Telemetry::AppendBuildInfo(field_collection);
+
+ // Log user system information
+ Telemetry::AppendCPUInfo(field_collection);
+ Telemetry::AppendOSInfo(field_collection);
// Log user configuration information
AddField(Telemetry::FieldType::UserConfig, "Core_UseCpuJit", Settings::values.use_cpu_jit);