summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.cpp3
-rw-r--r--src/core/crypto/key_manager.cpp8
-rw-r--r--src/core/file_sys/registered_cache.cpp18
-rw-r--r--src/core/hle/service/am/am.cpp13
-rw-r--r--src/core/hle/service/am/am.h1
-rw-r--r--src/core/loader/nca.cpp14
-rw-r--r--src/core/loader/nca.h17
-rw-r--r--src/core/loader/xci.cpp14
-rw-r--r--src/core/loader/xci.h12
9 files changed, 52 insertions, 48 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp
index 20e5200a8..2c817d7d1 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic.cpp
@@ -134,6 +134,9 @@ std::unique_ptr<Dynarmic::A64::Jit> ARM_Dynarmic::MakeJit() const {
config.dczid_el0 = 4;
config.ctr_el0 = 0x8444c004;
+ // Unpredictable instructions
+ config.define_unpredictable_behaviour = true;
+
return std::make_unique<Dynarmic::A64::Jit>(config);
}
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index 94d92579f..db8b22c85 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -52,20 +52,20 @@ void KeyManager::LoadFromFile(const std::string& filename, bool is_title_keys) {
out[1].erase(std::remove(out[1].begin(), out[1].end(), ' '), out[1].end());
if (is_title_keys) {
- auto rights_id_raw = HexStringToArray<16>(out[0]);
+ auto rights_id_raw = Common::HexStringToArray<16>(out[0]);
u128 rights_id{};
std::memcpy(rights_id.data(), rights_id_raw.data(), rights_id_raw.size());
- Key128 key = HexStringToArray<16>(out[1]);
+ Key128 key = Common::HexStringToArray<16>(out[1]);
SetKey(S128KeyType::Titlekey, key, rights_id[1], rights_id[0]);
} else {
std::transform(out[0].begin(), out[0].end(), out[0].begin(), ::tolower);
if (s128_file_id.find(out[0]) != s128_file_id.end()) {
const auto index = s128_file_id.at(out[0]);
- Key128 key = HexStringToArray<16>(out[1]);
+ Key128 key = Common::HexStringToArray<16>(out[1]);
SetKey(index.type, key, index.field1, index.field2);
} else if (s256_file_id.find(out[0]) != s256_file_id.end()) {
const auto index = s256_file_id.at(out[0]);
- Key256 key = HexStringToArray<32>(out[1]);
+ Key256 key = Common::HexStringToArray<32>(out[1]);
SetKey(index.type, key, index.field1, index.field2);
}
}
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index a5e935f64..d25eeee34 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -37,11 +37,12 @@ static bool FollowsNcaIdFormat(std::string_view name) {
static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bool second_hex_upper,
bool within_two_digit) {
if (!within_two_digit)
- return fmt::format("/{}.nca", HexArrayToString(nca_id, second_hex_upper));
+ return fmt::format("/{}.nca", Common::HexArrayToString(nca_id, second_hex_upper));
Core::Crypto::SHA256Hash hash{};
mbedtls_sha256(nca_id.data(), nca_id.size(), hash.data(), 0);
- return fmt::format("/000000{:02X}/{}.nca", hash[0], HexArrayToString(nca_id, second_hex_upper));
+ return fmt::format("/000000{:02X}/{}.nca", hash[0],
+ Common::HexArrayToString(nca_id, second_hex_upper));
}
static std::string GetCNMTName(TitleType type, u64 title_id) {
@@ -170,7 +171,7 @@ std::vector<NcaID> RegisteredCache::AccumulateFiles() const {
std::vector<NcaID> ids;
for (const auto& d2_dir : dir->GetSubdirectories()) {
if (FollowsNcaIdFormat(d2_dir->GetName())) {
- ids.push_back(HexStringToArray<0x10, true>(d2_dir->GetName().substr(0, 0x20)));
+ ids.push_back(Common::HexStringToArray<0x10, true>(d2_dir->GetName().substr(0, 0x20)));
continue;
}
@@ -181,20 +182,21 @@ std::vector<NcaID> RegisteredCache::AccumulateFiles() const {
if (!FollowsNcaIdFormat(nca_dir->GetName()))
continue;
- ids.push_back(HexStringToArray<0x10, true>(nca_dir->GetName().substr(0, 0x20)));
+ ids.push_back(Common::HexStringToArray<0x10, true>(nca_dir->GetName().substr(0, 0x20)));
}
for (const auto& nca_file : d2_dir->GetFiles()) {
if (!FollowsNcaIdFormat(nca_file->GetName()))
continue;
- ids.push_back(HexStringToArray<0x10, true>(nca_file->GetName().substr(0, 0x20)));
+ ids.push_back(
+ Common::HexStringToArray<0x10, true>(nca_file->GetName().substr(0, 0x20)));
}
}
for (const auto& d2_file : dir->GetFiles()) {
if (FollowsNcaIdFormat(d2_file->GetName()))
- ids.push_back(HexStringToArray<0x10, true>(d2_file->GetName().substr(0, 0x20)));
+ ids.push_back(Common::HexStringToArray<0x10, true>(d2_file->GetName().substr(0, 0x20)));
}
return ids;
}
@@ -339,7 +341,7 @@ std::vector<RegisteredCacheEntry> RegisteredCache::ListEntriesFilter(
}
static std::shared_ptr<NCA> GetNCAFromXCIForID(std::shared_ptr<XCI> xci, const NcaID& id) {
- const auto filename = fmt::format("{}.nca", HexArrayToString(id, false));
+ const auto filename = fmt::format("{}.nca", Common::HexArrayToString(id, false));
const auto iter =
std::find_if(xci->GetNCAs().begin(), xci->GetNCAs().end(),
[&filename](std::shared_ptr<NCA> nca) { return nca->GetName() == filename; });
@@ -361,7 +363,7 @@ InstallResult RegisteredCache::InstallEntry(std::shared_ptr<XCI> xci, bool overw
// Install Metadata File
const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32);
- const auto meta_id = HexStringToArray<16>(meta_id_raw);
+ const auto meta_id = Common::HexStringToArray<16>(meta_id_raw);
const auto res = RawInstallNCA(*meta_iter, copy, overwrite_if_exists, meta_id);
if (res != InstallResult::Success)
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 762763463..966602b31 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -306,7 +306,8 @@ ICommonStateGetter::ICommonStateGetter() : ServiceFramework("ICommonStateGetter"
{52, nullptr, "SwitchLcdBacklight"},
{55, nullptr, "IsInControllerFirmwareUpdateSection"},
{60, nullptr, "GetDefaultDisplayResolution"},
- {61, nullptr, "GetDefaultDisplayResolutionChangeEvent"},
+ {61, &ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent,
+ "GetDefaultDisplayResolutionChangeEvent"},
{62, nullptr, "GetHdcpAuthenticationState"},
{63, nullptr, "GetHdcpAuthenticationStateChangeEvent"},
};
@@ -341,6 +342,16 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
}
+void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx) {
+ event->Signal();
+
+ IPC::ResponseBuilder rb{ctx, 2, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushCopyObjects(event);
+
+ LOG_WARNING(Service_AM, "(STUBBED) called");
+}
+
void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) {
const bool use_docked_mode{Settings::values.use_docked_mode};
IPC::ResponseBuilder rb{ctx, 3};
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 862f338ac..5de1857d8 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -110,6 +110,7 @@ private:
void GetEventHandle(Kernel::HLERequestContext& ctx);
void ReceiveMessage(Kernel::HLERequestContext& ctx);
void GetCurrentFocusState(Kernel::HLERequestContext& ctx);
+ void GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx);
void GetOperationMode(Kernel::HLERequestContext& ctx);
void GetPerformanceMode(Kernel::HLERequestContext& ctx);
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp
index 8498cc94b..9d50c7d42 100644
--- a/src/core/loader/nca.cpp
+++ b/src/core/loader/nca.cpp
@@ -3,28 +3,22 @@
// Refer to the license.txt file included.
#include <utility>
-#include <vector>
#include "common/file_util.h"
#include "common/logging/log.h"
-#include "common/string_util.h"
-#include "common/swap.h"
-#include "core/core.h"
#include "core/file_sys/content_archive.h"
-#include "core/file_sys/program_metadata.h"
-#include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/process.h"
-#include "core/hle/kernel/resource_limit.h"
#include "core/hle/service/filesystem/filesystem.h"
+#include "core/loader/deconstructed_rom_directory.h"
#include "core/loader/nca.h"
-#include "core/loader/nso.h"
-#include "core/memory.h"
namespace Loader {
AppLoader_NCA::AppLoader_NCA(FileSys::VirtualFile file_)
: AppLoader(std::move(file_)), nca(std::make_unique<FileSys::NCA>(file)) {}
+AppLoader_NCA::~AppLoader_NCA() = default;
+
FileType AppLoader_NCA::IdentifyType(const FileSys::VirtualFile& file) {
FileSys::NCA nca(file);
@@ -83,6 +77,4 @@ ResultStatus AppLoader_NCA::ReadProgramId(u64& out_program_id) {
return ResultStatus::Success;
}
-AppLoader_NCA::~AppLoader_NCA() = default;
-
} // namespace Loader
diff --git a/src/core/loader/nca.h b/src/core/loader/nca.h
index 7f7d8ea0b..326f84857 100644
--- a/src/core/loader/nca.h
+++ b/src/core/loader/nca.h
@@ -4,20 +4,24 @@
#pragma once
-#include <string>
#include "common/common_types.h"
-#include "core/file_sys/content_archive.h"
-#include "core/file_sys/program_metadata.h"
+#include "core/file_sys/vfs.h"
#include "core/hle/kernel/object.h"
#include "core/loader/loader.h"
-#include "deconstructed_rom_directory.h"
+
+namespace FileSys {
+class NCA;
+}
namespace Loader {
+class AppLoader_DeconstructedRomDirectory;
+
/// Loads an NCA file
class AppLoader_NCA final : public AppLoader {
public:
explicit AppLoader_NCA(FileSys::VirtualFile file);
+ ~AppLoader_NCA() override;
/**
* Returns the type of the file
@@ -35,12 +39,7 @@ public:
ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override;
ResultStatus ReadProgramId(u64& out_program_id) override;
- ~AppLoader_NCA();
-
private:
- FileSys::ProgramMetadata metadata;
-
- FileSys::NCAHeader header;
std::unique_ptr<FileSys::NCA> nca;
std::unique_ptr<AppLoader_DeconstructedRomDirectory> directory_loader;
};
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
index 5d67fb186..4c4979545 100644
--- a/src/core/loader/xci.cpp
+++ b/src/core/loader/xci.cpp
@@ -4,22 +4,14 @@
#include <vector>
-#include "common/file_util.h"
-#include "common/logging/log.h"
-#include "common/string_util.h"
-#include "common/swap.h"
-#include "core/core.h"
+#include "common/common_types.h"
+#include "core/file_sys/card_image.h"
#include "core/file_sys/content_archive.h"
#include "core/file_sys/control_metadata.h"
-#include "core/file_sys/program_metadata.h"
#include "core/file_sys/romfs.h"
-#include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/process.h"
-#include "core/hle/kernel/resource_limit.h"
-#include "core/hle/service/filesystem/filesystem.h"
-#include "core/loader/nso.h"
+#include "core/loader/nca.h"
#include "core/loader/xci.h"
-#include "core/memory.h"
namespace Loader {
diff --git a/src/core/loader/xci.h b/src/core/loader/xci.h
index 973833050..cc4287e17 100644
--- a/src/core/loader/xci.h
+++ b/src/core/loader/xci.h
@@ -6,12 +6,18 @@
#include <memory>
#include "common/common_types.h"
-#include "core/file_sys/card_image.h"
+#include "core/file_sys/vfs.h"
#include "core/loader/loader.h"
-#include "core/loader/nca.h"
+
+namespace FileSys {
+class NACP;
+class XCI;
+} // namespace FileSys
namespace Loader {
+class AppLoader_NCA;
+
/// Loads an XCI file
class AppLoader_XCI final : public AppLoader {
public:
@@ -37,8 +43,6 @@ public:
ResultStatus ReadTitle(std::string& title) override;
private:
- FileSys::ProgramMetadata metadata;
-
std::unique_ptr<FileSys::XCI> xci;
std::unique_ptr<AppLoader_NCA> nca_loader;