Compare commits
3 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7631dca9ab | ||
|
|
b66a125823 | ||
|
|
8b8bef57e5 |
2
externals/cubeb
vendored
2
externals/cubeb
vendored
Submodule externals/cubeb updated: 1d66483ad2...616d773441
@@ -132,9 +132,9 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,
|
||||
}
|
||||
}
|
||||
|
||||
void CoreTiming::AddTicks(u64 ticks) {
|
||||
this->ticks += ticks;
|
||||
downcount -= static_cast<s64>(ticks);
|
||||
void CoreTiming::AddTicks(u64 ticks_) {
|
||||
ticks += ticks_;
|
||||
downcount -= static_cast<s64>(ticks_);
|
||||
}
|
||||
|
||||
void CoreTiming::Idle() {
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
CpuManager& operator=(CpuManager&&) = delete;
|
||||
|
||||
/// Sets if emulation is multicore or single core, must be set before Initialize
|
||||
void SetMulticore(bool is_multicore) {
|
||||
this->is_multicore = is_multicore;
|
||||
void SetMulticore(bool multicore_state) {
|
||||
is_multicore = multicore_state;
|
||||
}
|
||||
|
||||
/// Sets if emulation is using an asynchronous GPU.
|
||||
void SetAsyncGpu(bool is_async_gpu) {
|
||||
this->is_async_gpu = is_async_gpu;
|
||||
void SetAsyncGpu(bool async_gpu_state) {
|
||||
is_async_gpu = async_gpu_state;
|
||||
}
|
||||
|
||||
void Initialize();
|
||||
|
||||
@@ -179,8 +179,8 @@ u32 XCI::GetSystemUpdateVersion() {
|
||||
if (update == nullptr)
|
||||
return 0;
|
||||
|
||||
for (const auto& file : update->GetFiles()) {
|
||||
NCA nca{file, nullptr, 0};
|
||||
for (const auto& update_file : update->GetFiles()) {
|
||||
NCA nca{update_file, nullptr, 0};
|
||||
|
||||
if (nca.GetStatus() != Loader::ResultStatus::Success)
|
||||
continue;
|
||||
@@ -262,8 +262,8 @@ VirtualDir XCI::ConcatenatedPseudoDirectory() {
|
||||
if (part == nullptr)
|
||||
continue;
|
||||
|
||||
for (const auto& file : part->GetFiles())
|
||||
out->AddFile(file);
|
||||
for (const auto& xci_file : part->GetFiles())
|
||||
out->AddFile(xci_file);
|
||||
}
|
||||
|
||||
return out;
|
||||
@@ -283,12 +283,12 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) {
|
||||
return Loader::ResultStatus::ErrorXCIMissingPartition;
|
||||
}
|
||||
|
||||
for (const VirtualFile& file : partition->GetFiles()) {
|
||||
if (file->GetExtension() != "nca") {
|
||||
for (const VirtualFile& part_file : partition->GetFiles()) {
|
||||
if (part_file->GetExtension() != "nca") {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto nca = std::make_shared<NCA>(file, nullptr, 0);
|
||||
auto nca = std::make_shared<NCA>(part_file, nullptr, 0);
|
||||
if (nca->IsUpdate()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ static u64 romfs_get_hash_table_count(u64 num_entries) {
|
||||
return count;
|
||||
}
|
||||
|
||||
void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir extension,
|
||||
std::shared_ptr<RomFSBuildDirectoryContext> parent) {
|
||||
std::vector<std::shared_ptr<RomFSBuildDirectoryContext>> child_dirs;
|
||||
|
||||
@@ -147,7 +147,8 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
|
||||
child->path = parent->path + "/" + kv.first;
|
||||
|
||||
if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr)
|
||||
if (extension != nullptr &&
|
||||
extension->GetFileRelative(child->path + ".stub") != nullptr)
|
||||
continue;
|
||||
|
||||
// Sanity check on path_len
|
||||
@@ -163,7 +164,8 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
child->path_len = child->cur_path_ofs + static_cast<u32>(kv.first.size());
|
||||
child->path = parent->path + "/" + kv.first;
|
||||
|
||||
if (ext != nullptr && ext->GetFileRelative(child->path + ".stub") != nullptr)
|
||||
if (extension != nullptr &&
|
||||
extension->GetFileRelative(child->path + ".stub") != nullptr)
|
||||
continue;
|
||||
|
||||
// Sanity check on path_len
|
||||
@@ -171,8 +173,8 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
|
||||
child->source = root_romfs->GetFileRelative(child->path);
|
||||
|
||||
if (ext != nullptr) {
|
||||
const auto ips = ext->GetFileRelative(child->path + ".ips");
|
||||
if (extension != nullptr) {
|
||||
const auto ips = extension->GetFileRelative(child->path + ".ips");
|
||||
|
||||
if (ips != nullptr) {
|
||||
auto patched = PatchIPS(child->source, ips);
|
||||
@@ -188,7 +190,7 @@ void RomFSBuildContext::VisitDirectory(VirtualDir root_romfs, VirtualDir ext,
|
||||
}
|
||||
|
||||
for (auto& child : child_dirs) {
|
||||
this->VisitDirectory(root_romfs, ext, child);
|
||||
this->VisitDirectory(root_romfs, extension, child);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,10 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {
|
||||
// Read out of bounds.
|
||||
if (offset >= relocation.size)
|
||||
return 0;
|
||||
const auto relocation = GetRelocationEntry(offset);
|
||||
const auto section_offset = offset - relocation.address_patch + relocation.address_source;
|
||||
const auto bktr_read = relocation.from_patch;
|
||||
const auto relocation_entry = GetRelocationEntry(offset);
|
||||
const auto section_offset =
|
||||
offset - relocation_entry.address_patch + relocation_entry.address_source;
|
||||
const auto bktr_read = relocation_entry.from_patch;
|
||||
|
||||
const auto next_relocation = GetNextRelocationEntry(offset);
|
||||
|
||||
@@ -106,12 +107,12 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {
|
||||
return bktr_romfs->Read(data, length, section_offset);
|
||||
}
|
||||
|
||||
const auto subsection = GetSubsectionEntry(section_offset);
|
||||
const auto subsection_entry = GetSubsectionEntry(section_offset);
|
||||
Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(key, Core::Crypto::Mode::CTR);
|
||||
|
||||
// Calculate AES IV
|
||||
std::array<u8, 16> iv{};
|
||||
auto subsection_ctr = subsection.ctr;
|
||||
auto subsection_ctr = subsection_entry.ctr;
|
||||
auto offset_iv = section_offset + base_offset;
|
||||
for (std::size_t i = 0; i < section_ctr.size(); ++i)
|
||||
iv[i] = section_ctr[0x8 - i - 1];
|
||||
|
||||
@@ -280,14 +280,14 @@ NcaID PlaceholderCache::Generate() {
|
||||
return out;
|
||||
}
|
||||
|
||||
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& dir,
|
||||
VirtualFile RegisteredCache::OpenFileOrDirectoryConcat(const VirtualDir& directory,
|
||||
std::string_view path) const {
|
||||
const auto file = dir->GetFileRelative(path);
|
||||
const auto file = directory->GetFileRelative(path);
|
||||
if (file != nullptr) {
|
||||
return file;
|
||||
}
|
||||
|
||||
const auto nca_dir = dir->GetDirectoryRelative(path);
|
||||
const auto nca_dir = directory->GetDirectoryRelative(path);
|
||||
if (nca_dir == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -430,11 +430,11 @@ void RegisteredCache::ProcessFiles(const std::vector<NcaID>& ids) {
|
||||
}
|
||||
|
||||
void RegisteredCache::AccumulateYuzuMeta() {
|
||||
const auto dir = this->dir->GetSubdirectory("yuzu_meta");
|
||||
if (dir == nullptr)
|
||||
const auto directory = dir->GetSubdirectory("yuzu_meta");
|
||||
if (directory == nullptr)
|
||||
return;
|
||||
|
||||
for (const auto& file : dir->GetFiles()) {
|
||||
for (const auto& file : directory->GetFiles()) {
|
||||
if (file->GetExtension() != "cnmt")
|
||||
continue;
|
||||
|
||||
@@ -565,7 +565,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
|
||||
}
|
||||
|
||||
const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32);
|
||||
const auto meta_id = Common::HexStringToArray<16>(meta_id_raw);
|
||||
const auto hex_meta_id = Common::HexStringToArray<16>(meta_id_raw);
|
||||
|
||||
if ((*meta_iter)->GetSubdirectories().empty()) {
|
||||
LOG_ERROR(Loader,
|
||||
@@ -590,7 +590,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
|
||||
const auto result = RemoveExistingEntry(title_id);
|
||||
|
||||
// Install Metadata File
|
||||
const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, meta_id);
|
||||
const auto res = RawInstallNCA(**meta_iter, copy, overwrite_if_exists, hex_meta_id);
|
||||
if (res != InstallResult::Success) {
|
||||
return res;
|
||||
}
|
||||
@@ -740,15 +740,15 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
|
||||
|
||||
bool RegisteredCache::RawInstallYuzuMeta(const CNMT& cnmt) {
|
||||
// Reasoning behind this method can be found in the comment for InstallEntry, NCA overload.
|
||||
const auto dir = this->dir->CreateDirectoryRelative("yuzu_meta");
|
||||
const auto directory = dir->CreateDirectoryRelative("yuzu_meta");
|
||||
const auto filename = GetCNMTName(cnmt.GetType(), cnmt.GetTitleID());
|
||||
if (dir->GetFile(filename) == nullptr) {
|
||||
auto out = dir->CreateFile(filename);
|
||||
if (directory->GetFile(filename) == nullptr) {
|
||||
auto out = directory->CreateFile(filename);
|
||||
const auto buffer = cnmt.Serialize();
|
||||
out->Resize(buffer.size());
|
||||
out->WriteBytes(buffer);
|
||||
} else {
|
||||
auto out = dir->GetFile(filename);
|
||||
auto out = directory->GetFile(filename);
|
||||
CNMT old_cnmt(out);
|
||||
// Returns true on change
|
||||
if (old_cnmt.UnionRecords(cnmt)) {
|
||||
|
||||
@@ -33,8 +33,8 @@ RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader, ContentProvider& provi
|
||||
|
||||
RomFSFactory::~RomFSFactory() = default;
|
||||
|
||||
void RomFSFactory::SetPackedUpdate(VirtualFile update_raw) {
|
||||
this->update_raw = std::move(update_raw);
|
||||
void RomFSFactory::SetPackedUpdate(VirtualFile update_raw_) {
|
||||
update_raw = std::move(update_raw_);
|
||||
}
|
||||
|
||||
ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const {
|
||||
|
||||
@@ -170,9 +170,9 @@ std::string SaveDataFactory::GetFullPath(Core::System& system, SaveDataSpaceId s
|
||||
SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,
|
||||
u128 user_id) const {
|
||||
const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);
|
||||
const auto dir = GetOrCreateDirectoryRelative(this->dir, path);
|
||||
const auto directory = GetOrCreateDirectoryRelative(dir, path);
|
||||
|
||||
const auto size_file = dir->GetFile(SAVE_DATA_SIZE_FILENAME);
|
||||
const auto size_file = directory->GetFile(SAVE_DATA_SIZE_FILENAME);
|
||||
if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize))
|
||||
return {0, 0};
|
||||
|
||||
@@ -185,9 +185,9 @@ SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id,
|
||||
void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,
|
||||
SaveDataSize new_value) const {
|
||||
const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0);
|
||||
const auto dir = GetOrCreateDirectoryRelative(this->dir, path);
|
||||
const auto directory = GetOrCreateDirectoryRelative(dir, path);
|
||||
|
||||
const auto size_file = dir->CreateFile(SAVE_DATA_SIZE_FILENAME);
|
||||
const auto size_file = directory->CreateFile(SAVE_DATA_SIZE_FILENAME);
|
||||
if (size_file == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ std::size_t ConcatenatedVfsFile::Write(const u8* data, std::size_t length, std::
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ConcatenatedVfsFile::Rename(std::string_view name) {
|
||||
bool ConcatenatedVfsFile::Rename(std::string_view name_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ VirtualDir LayeredVfsDirectory::GetDirectoryRelative(std::string_view path) cons
|
||||
return MakeLayeredDirectory(std::move(out));
|
||||
}
|
||||
|
||||
VirtualFile LayeredVfsDirectory::GetFile(std::string_view name) const {
|
||||
return GetFileRelative(name);
|
||||
VirtualFile LayeredVfsDirectory::GetFile(std::string_view name_) const {
|
||||
return GetFileRelative(name_);
|
||||
}
|
||||
|
||||
VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view name) const {
|
||||
return GetDirectoryRelative(name);
|
||||
VirtualDir LayeredVfsDirectory::GetSubdirectory(std::string_view name_) const {
|
||||
return GetDirectoryRelative(name_);
|
||||
}
|
||||
|
||||
std::string LayeredVfsDirectory::GetFullPath() const {
|
||||
@@ -105,19 +105,19 @@ VirtualDir LayeredVfsDirectory::GetParentDirectory() const {
|
||||
return dirs[0]->GetParentDirectory();
|
||||
}
|
||||
|
||||
VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view name) {
|
||||
VirtualDir LayeredVfsDirectory::CreateSubdirectory(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VirtualFile LayeredVfsDirectory::CreateFile(std::string_view name) {
|
||||
VirtualFile LayeredVfsDirectory::CreateFile(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view name) {
|
||||
bool LayeredVfsDirectory::DeleteSubdirectory(std::string_view name_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayeredVfsDirectory::DeleteFile(std::string_view name) {
|
||||
bool LayeredVfsDirectory::DeleteFile(std::string_view name_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ std::size_t OffsetVfsFile::WriteBytes(const std::vector<u8>& data, std::size_t r
|
||||
return file->Write(data.data(), TrimToFit(data.size(), r_offset), offset + r_offset);
|
||||
}
|
||||
|
||||
bool OffsetVfsFile::Rename(std::string_view name) {
|
||||
return file->Rename(name);
|
||||
bool OffsetVfsFile::Rename(std::string_view name_) {
|
||||
return file->Rename(name_);
|
||||
}
|
||||
|
||||
std::size_t OffsetVfsFile::GetOffset() const {
|
||||
|
||||
@@ -352,16 +352,16 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string&
|
||||
|
||||
RealVfsDirectory::~RealVfsDirectory() = default;
|
||||
|
||||
VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path) const {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
|
||||
VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path_) const {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(path_));
|
||||
if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) {
|
||||
return nullptr;
|
||||
}
|
||||
return base.OpenFile(full_path, perms);
|
||||
}
|
||||
|
||||
VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path) const {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
|
||||
VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path_) const {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(path_));
|
||||
if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -376,18 +376,23 @@ VirtualDir RealVfsDirectory::GetSubdirectory(std::string_view name) const {
|
||||
return GetDirectoryRelative(name);
|
||||
}
|
||||
|
||||
VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path) {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
|
||||
VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path_) {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path_));
|
||||
return base.CreateFile(full_path, perms);
|
||||
}
|
||||
|
||||
VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view path) {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path));
|
||||
std::shared_ptr<VfsFile> RealVfsDirectory::CreateFileRelative(std::string_view file_path) {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(file_path));
|
||||
return base.CreateFile(full_path, perms);
|
||||
}
|
||||
|
||||
std::shared_ptr<VfsDirectory> RealVfsDirectory::CreateDirectoryRelative(std::string_view dir_path_) {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(dir_path_));
|
||||
return base.CreateDirectory(full_path, perms);
|
||||
}
|
||||
|
||||
bool RealVfsDirectory::DeleteSubdirectoryRecursive(std::string_view name) {
|
||||
const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(name));
|
||||
bool RealVfsDirectory::DeleteSubdirectoryRecursive(std::string_view dir_path) {
|
||||
const auto full_path = FS::SanitizePath(path + DIR_SEP + std::string(dir_path));
|
||||
return base.DeleteDirectory(full_path);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,12 +103,12 @@ static bool FindAndRemoveVectorElement(std::vector<T>& vec, std::string_view nam
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VectorVfsDirectory::DeleteSubdirectory(std::string_view name) {
|
||||
return FindAndRemoveVectorElement(dirs, name);
|
||||
bool VectorVfsDirectory::DeleteSubdirectory(std::string_view name_) {
|
||||
return FindAndRemoveVectorElement(dirs, name_);
|
||||
}
|
||||
|
||||
bool VectorVfsDirectory::DeleteFile(std::string_view name) {
|
||||
return FindAndRemoveVectorElement(files, name);
|
||||
bool VectorVfsDirectory::DeleteFile(std::string_view name_) {
|
||||
return FindAndRemoveVectorElement(files, name_);
|
||||
}
|
||||
|
||||
bool VectorVfsDirectory::Rename(std::string_view name_) {
|
||||
@@ -116,11 +116,15 @@ bool VectorVfsDirectory::Rename(std::string_view name_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view name) {
|
||||
VirtualDir VectorVfsDirectory::CreateSubdirectory(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VirtualFile VectorVfsDirectory::CreateFile(std::string_view name) {
|
||||
std::shared_ptr<VfsDirectory> VectorVfsDirectory::CreateSubdirectory(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<VfsFile> VectorVfsDirectory::CreateFile(std::string_view name_) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -219,12 +219,12 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const HandleTabl
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) {
|
||||
auto& owner_process = *thread.GetOwnerProcess();
|
||||
ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& cur_thread) {
|
||||
auto& owner_process = *cur_thread.GetOwnerProcess();
|
||||
auto& handle_table = owner_process.GetHandleTable();
|
||||
|
||||
std::array<u32, IPC::COMMAND_BUFFER_LENGTH> dst_cmdbuf;
|
||||
memory.ReadBlock(owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(),
|
||||
memory.ReadBlock(owner_process, cur_thread.GetTLSAddress(), dst_cmdbuf.data(),
|
||||
dst_cmdbuf.size() * sizeof(u32));
|
||||
|
||||
// The header was already built in the internal command buffer. Attempt to parse it to verify
|
||||
@@ -281,7 +281,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) {
|
||||
}
|
||||
|
||||
// Copy the translated command buffer back into the thread's command buffer area.
|
||||
memory.WriteBlock(owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(),
|
||||
memory.WriteBlock(owner_process, cur_thread.GetTLSAddress(), dst_cmdbuf.data(),
|
||||
dst_cmdbuf.size() * sizeof(u32));
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
|
||||
@@ -52,8 +52,8 @@ struct KernelCore::Impl {
|
||||
: synchronization{system}, time_manager{system}, global_handle_table{kernel}, system{
|
||||
system} {}
|
||||
|
||||
void SetMulticore(bool is_multicore) {
|
||||
this->is_multicore = is_multicore;
|
||||
void SetMulticore(bool multicore_state) {
|
||||
is_multicore = multicore_state;
|
||||
}
|
||||
|
||||
void Initialize(KernelCore& kernel) {
|
||||
|
||||
@@ -17,8 +17,8 @@ MemoryBlockManager::MemoryBlockManager(VAddr start_addr, VAddr end_addr)
|
||||
MemoryBlockManager::iterator MemoryBlockManager::FindIterator(VAddr addr) {
|
||||
auto node{memory_block_tree.begin()};
|
||||
while (node != end()) {
|
||||
const VAddr end_addr{node->GetNumPages() * PageSize + node->GetAddress()};
|
||||
if (node->GetAddress() <= addr && end_addr - 1 >= addr) {
|
||||
const VAddr node_end_addr{node->GetNumPages() * PageSize + node->GetAddress()};
|
||||
if (node->GetAddress() <= addr && node_end_addr - 1 >= addr) {
|
||||
return node;
|
||||
}
|
||||
node = std::next(node);
|
||||
@@ -67,7 +67,7 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState p
|
||||
MemoryPermission prev_perm, MemoryAttribute prev_attribute,
|
||||
MemoryState state, MemoryPermission perm,
|
||||
MemoryAttribute attribute) {
|
||||
const VAddr end_addr{addr + num_pages * PageSize};
|
||||
const VAddr block_end_addr{addr + num_pages * PageSize};
|
||||
iterator node{memory_block_tree.begin()};
|
||||
|
||||
prev_attribute |= MemoryAttribute::IpcAndDeviceMapped;
|
||||
@@ -78,7 +78,7 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState p
|
||||
const VAddr cur_addr{block->GetAddress()};
|
||||
const VAddr cur_end_addr{block->GetNumPages() * PageSize + cur_addr};
|
||||
|
||||
if (addr < cur_end_addr && cur_addr < end_addr) {
|
||||
if (addr < cur_end_addr && cur_addr < block_end_addr) {
|
||||
if (!block->HasProperties(prev_state, prev_perm, prev_attribute)) {
|
||||
node = next_node;
|
||||
continue;
|
||||
@@ -89,8 +89,8 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState p
|
||||
memory_block_tree.insert(node, block->Split(addr));
|
||||
}
|
||||
|
||||
if (end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(end_addr));
|
||||
if (block_end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(block_end_addr));
|
||||
}
|
||||
|
||||
new_node->Update(state, perm, attribute);
|
||||
@@ -98,7 +98,7 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState p
|
||||
MergeAdjacent(new_node, next_node);
|
||||
}
|
||||
|
||||
if (cur_end_addr - 1 >= end_addr - 1) {
|
||||
if (cur_end_addr - 1 >= block_end_addr - 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState p
|
||||
|
||||
void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState state,
|
||||
MemoryPermission perm, MemoryAttribute attribute) {
|
||||
const VAddr end_addr{addr + num_pages * PageSize};
|
||||
const VAddr block_end_addr{addr + num_pages * PageSize};
|
||||
iterator node{memory_block_tree.begin()};
|
||||
|
||||
while (node != memory_block_tree.end()) {
|
||||
@@ -117,15 +117,15 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState s
|
||||
const VAddr cur_addr{block->GetAddress()};
|
||||
const VAddr cur_end_addr{block->GetNumPages() * PageSize + cur_addr};
|
||||
|
||||
if (addr < cur_end_addr && cur_addr < end_addr) {
|
||||
if (addr < cur_end_addr && cur_addr < block_end_addr) {
|
||||
iterator new_node{node};
|
||||
|
||||
if (addr > cur_addr) {
|
||||
memory_block_tree.insert(node, block->Split(addr));
|
||||
}
|
||||
|
||||
if (end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(end_addr));
|
||||
if (block_end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(block_end_addr));
|
||||
}
|
||||
|
||||
new_node->Update(state, perm, attribute);
|
||||
@@ -133,7 +133,7 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState s
|
||||
MergeAdjacent(new_node, next_node);
|
||||
}
|
||||
|
||||
if (cur_end_addr - 1 >= end_addr - 1) {
|
||||
if (cur_end_addr - 1 >= block_end_addr - 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void MemoryBlockManager::Update(VAddr addr, std::size_t num_pages, MemoryState s
|
||||
|
||||
void MemoryBlockManager::UpdateLock(VAddr addr, std::size_t num_pages, LockFunc&& lock_func,
|
||||
MemoryPermission perm) {
|
||||
const VAddr end_addr{addr + num_pages * PageSize};
|
||||
const VAddr block_end_addr{addr + num_pages * PageSize};
|
||||
iterator node{memory_block_tree.begin()};
|
||||
|
||||
while (node != memory_block_tree.end()) {
|
||||
@@ -152,15 +152,15 @@ void MemoryBlockManager::UpdateLock(VAddr addr, std::size_t num_pages, LockFunc&
|
||||
const VAddr cur_addr{block->GetAddress()};
|
||||
const VAddr cur_end_addr{block->GetNumPages() * PageSize + cur_addr};
|
||||
|
||||
if (addr < cur_end_addr && cur_addr < end_addr) {
|
||||
if (addr < cur_end_addr && cur_addr < block_end_addr) {
|
||||
iterator new_node{node};
|
||||
|
||||
if (addr > cur_addr) {
|
||||
memory_block_tree.insert(node, block->Split(addr));
|
||||
}
|
||||
|
||||
if (end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(end_addr));
|
||||
if (block_end_addr < cur_end_addr) {
|
||||
new_node = memory_block_tree.insert(node, block->Split(block_end_addr));
|
||||
}
|
||||
|
||||
lock_func(new_node, perm);
|
||||
@@ -168,7 +168,7 @@ void MemoryBlockManager::UpdateLock(VAddr addr, std::size_t num_pages, LockFunc&
|
||||
MergeAdjacent(new_node, next_node);
|
||||
}
|
||||
|
||||
if (cur_end_addr - 1 >= end_addr - 1) {
|
||||
if (cur_end_addr - 1 >= block_end_addr - 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,27 +164,27 @@ u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const {
|
||||
|
||||
void Process::InsertConditionVariableThread(std::shared_ptr<Thread> thread) {
|
||||
VAddr cond_var_addr = thread->GetCondVarWaitAddress();
|
||||
std::list<std::shared_ptr<Thread>>& thread_list = cond_var_threads[cond_var_addr];
|
||||
auto it = thread_list.begin();
|
||||
while (it != thread_list.end()) {
|
||||
std::list<std::shared_ptr<Thread>>& condvar_thread_list = cond_var_threads[cond_var_addr];
|
||||
auto it = condvar_thread_list.begin();
|
||||
while (it != condvar_thread_list.end()) {
|
||||
const std::shared_ptr<Thread> current_thread = *it;
|
||||
if (current_thread->GetPriority() > thread->GetPriority()) {
|
||||
thread_list.insert(it, thread);
|
||||
condvar_thread_list.insert(it, thread);
|
||||
return;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
thread_list.push_back(thread);
|
||||
condvar_thread_list.push_back(thread);
|
||||
}
|
||||
|
||||
void Process::RemoveConditionVariableThread(std::shared_ptr<Thread> thread) {
|
||||
VAddr cond_var_addr = thread->GetCondVarWaitAddress();
|
||||
std::list<std::shared_ptr<Thread>>& thread_list = cond_var_threads[cond_var_addr];
|
||||
auto it = thread_list.begin();
|
||||
while (it != thread_list.end()) {
|
||||
std::list<std::shared_ptr<Thread>>& convar_thread_list = cond_var_threads[cond_var_addr];
|
||||
auto it = convar_thread_list.begin();
|
||||
while (it != convar_thread_list.end()) {
|
||||
const std::shared_ptr<Thread> current_thread = *it;
|
||||
if (current_thread.get() == thread.get()) {
|
||||
thread_list.erase(it);
|
||||
convar_thread_list.erase(it);
|
||||
return;
|
||||
}
|
||||
++it;
|
||||
@@ -194,9 +194,9 @@ void Process::RemoveConditionVariableThread(std::shared_ptr<Thread> thread) {
|
||||
std::vector<std::shared_ptr<Thread>> Process::GetConditionVariableThreads(
|
||||
const VAddr cond_var_addr) {
|
||||
std::vector<std::shared_ptr<Thread>> result{};
|
||||
std::list<std::shared_ptr<Thread>>& thread_list = cond_var_threads[cond_var_addr];
|
||||
auto it = thread_list.begin();
|
||||
while (it != thread_list.end()) {
|
||||
std::list<std::shared_ptr<Thread>>& convar_thread_list = cond_var_threads[cond_var_addr];
|
||||
auto it = convar_thread_list.begin();
|
||||
while (it != convar_thread_list.end()) {
|
||||
std::shared_ptr<Thread> current_thread = *it;
|
||||
result.push_back(current_thread);
|
||||
++it;
|
||||
|
||||
@@ -106,23 +106,23 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con
|
||||
|
||||
// If there is a DomainMessageHeader, then this is CommandType "Request"
|
||||
const auto& domain_message_header = context.GetDomainMessageHeader();
|
||||
const u32 object_id{domain_message_header.object_id};
|
||||
const u32 domain_object_id{domain_message_header.object_id};
|
||||
switch (domain_message_header.command) {
|
||||
case IPC::DomainMessageHeader::CommandType::SendMessage:
|
||||
if (object_id > domain_request_handlers.size()) {
|
||||
if (domain_object_id > domain_request_handlers.size()) {
|
||||
LOG_CRITICAL(IPC,
|
||||
"object_id {} is too big! This probably means a recent service call "
|
||||
"to {} needed to return a new interface!",
|
||||
object_id, name);
|
||||
domain_object_id, name);
|
||||
UNREACHABLE();
|
||||
return RESULT_SUCCESS; // Ignore error if asserts are off
|
||||
}
|
||||
return domain_request_handlers[object_id - 1]->HandleSyncRequest(context);
|
||||
return domain_request_handlers[domain_object_id - 1]->HandleSyncRequest(context);
|
||||
|
||||
case IPC::DomainMessageHeader::CommandType::CloseVirtualHandle: {
|
||||
LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", object_id);
|
||||
LOG_DEBUG(IPC, "CloseVirtualHandle, object_id=0x{:08X}", domain_object_id);
|
||||
|
||||
domain_request_handlers[object_id - 1] = nullptr;
|
||||
domain_request_handlers[domain_object_id - 1] = nullptr;
|
||||
|
||||
IPC::ResponseBuilder rb{context, 2};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
||||
@@ -35,9 +35,9 @@ std::shared_ptr<SharedMemory> SharedMemory::Create(
|
||||
return shared_memory;
|
||||
}
|
||||
|
||||
ResultCode SharedMemory::Map(Process& target_process, VAddr address, std::size_t size,
|
||||
ResultCode SharedMemory::Map(Process& target_process, VAddr address, std::size_t map_size,
|
||||
Memory::MemoryPermission permissions) {
|
||||
const u64 page_count{(size + Memory::PageSize - 1) / Memory::PageSize};
|
||||
const u64 page_count{(map_size + Memory::PageSize - 1) / Memory::PageSize};
|
||||
|
||||
if (page_list.GetNumPages() != page_count) {
|
||||
UNIMPLEMENTED_MSG("Page count does not match");
|
||||
|
||||
@@ -157,11 +157,11 @@ void Error::Execute() {
|
||||
break;
|
||||
case ErrorAppletMode::ShowSystemError:
|
||||
case ErrorAppletMode::ShowApplicationError: {
|
||||
const auto system = mode == ErrorAppletMode::ShowSystemError;
|
||||
const auto is_system = mode == ErrorAppletMode::ShowSystemError;
|
||||
const auto& main_text =
|
||||
system ? args->system_error.main_text : args->application_error.main_text;
|
||||
is_system ? args->system_error.main_text : args->application_error.main_text;
|
||||
const auto& detail_text =
|
||||
system ? args->system_error.detail_text : args->application_error.detail_text;
|
||||
is_system ? args->system_error.detail_text : args->application_error.detail_text;
|
||||
|
||||
const auto main_text_string =
|
||||
Common::StringFromFixedZeroTerminatedBuffer(main_text.data(), main_text.size());
|
||||
|
||||
@@ -457,7 +457,7 @@ void WebBrowser::InitializeOffline() {
|
||||
Common::FS::DirectorySeparator::PlatformDefault);
|
||||
Common::FS::DeleteDirRecursively(temporary_dir);
|
||||
|
||||
u64 title_id = 0; // 0 corresponds to current process
|
||||
u64 tid = 0; // 0 corresponds to current process
|
||||
ASSERT(args[WebArgTLVType::ApplicationID].size() >= 0x8);
|
||||
std::memcpy(&title_id, args[WebArgTLVType::ApplicationID].data(), sizeof(u64));
|
||||
FileSys::ContentRecordType type = FileSys::ContentRecordType::Data;
|
||||
@@ -465,7 +465,7 @@ void WebBrowser::InitializeOffline() {
|
||||
switch (source) {
|
||||
case OfflineWebSource::OfflineHtmlPage:
|
||||
// While there is an AppID TLV field, in official SW this is always ignored.
|
||||
title_id = 0;
|
||||
tid = 0;
|
||||
type = FileSys::ContentRecordType::HtmlDocument;
|
||||
break;
|
||||
case OfflineWebSource::ApplicationLegalInformation:
|
||||
@@ -476,11 +476,11 @@ void WebBrowser::InitializeOffline() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (title_id == 0) {
|
||||
title_id = system.CurrentProcess()->GetTitleID();
|
||||
if (tid == 0) {
|
||||
tid = system.CurrentProcess()->GetTitleID();
|
||||
}
|
||||
|
||||
offline_romfs = GetApplicationRomFS(system, title_id, type);
|
||||
offline_romfs = GetApplicationRomFS(system, tid, type);
|
||||
if (offline_romfs == nullptr) {
|
||||
status = RESULT_UNKNOWN;
|
||||
LOG_ERROR(Service_AM, "Failed to find offline data for request!");
|
||||
|
||||
@@ -415,9 +415,9 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
|
||||
if (Settings::values.bcat_boxcat_local) {
|
||||
LOG_INFO(Service_BCAT, "Boxcat using local data by override, skipping download.");
|
||||
} else {
|
||||
Boxcat::Client client{path, title.title_id, title.build_id};
|
||||
Boxcat::Client bcat_client{path, title.title_id, title.build_id};
|
||||
|
||||
const auto res = client.DownloadLaunchParam();
|
||||
const auto res = bcat_client.DownloadLaunchParam();
|
||||
if (res != DownloadResult::Success) {
|
||||
LOG_ERROR(Service_BCAT, "Boxcat synchronization failed with error '{}'!", res);
|
||||
|
||||
|
||||
@@ -172,9 +172,9 @@ private:
|
||||
};
|
||||
|
||||
std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) {
|
||||
auto& backend{progress.at(static_cast<std::size_t>(type))};
|
||||
return std::make_shared<IDeliveryCacheProgressService>(system, backend.GetEvent(),
|
||||
backend.GetImpl());
|
||||
auto& bcat_backend{progress.at(static_cast<std::size_t>(type))};
|
||||
return std::make_shared<IDeliveryCacheProgressService>(system, bcat_backend.GetEvent(),
|
||||
bcat_backend.GetImpl());
|
||||
}
|
||||
|
||||
void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
@@ -334,12 +334,12 @@ public:
|
||||
const std::string name = Common::StringFromBuffer(file_buffer);
|
||||
|
||||
const u64 mode = rp.Pop<u64>();
|
||||
const u32 size = rp.Pop<u32>();
|
||||
const u32 file_size = rp.Pop<u32>();
|
||||
|
||||
LOG_DEBUG(Service_FS, "called. file={}, mode=0x{:X}, size=0x{:08X}", name, mode, size);
|
||||
LOG_DEBUG(Service_FS, "called. file={}, mode=0x{:X}, size=0x{:08X}", name, mode, file_size);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(backend.CreateFile(name, size));
|
||||
rb.Push(backend.CreateFile(name, file_size));
|
||||
}
|
||||
|
||||
void DeleteFile(Kernel::HLERequestContext& ctx) {
|
||||
@@ -926,8 +926,8 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(
|
||||
void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_FS, "called");
|
||||
|
||||
auto romfs = fsc.OpenRomFSCurrentProcess();
|
||||
if (romfs.Failed()) {
|
||||
auto cur_romfs = fsc.OpenRomFSCurrentProcess();
|
||||
if (cur_romfs.Failed()) {
|
||||
// TODO (bunnei): Find the right error code to use here
|
||||
LOG_CRITICAL(Service_FS, "no file system interface available!");
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
@@ -935,7 +935,7 @@ void FSP_SRV::OpenDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto storage = std::make_shared<IStorage>(system, std::move(romfs.Unwrap()));
|
||||
auto storage = std::make_shared<IStorage>(system, std::move(cur_romfs.Unwrap()));
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
||||
@@ -95,12 +95,12 @@ Manager::Manager(Core::Reporter& reporter) : reporter(reporter) {}
|
||||
|
||||
Manager::~Manager() = default;
|
||||
|
||||
void Manager::SetEnabled(bool enabled) {
|
||||
this->enabled = enabled;
|
||||
void Manager::SetEnabled(bool is_enabled) {
|
||||
enabled = is_enabled;
|
||||
}
|
||||
|
||||
void Manager::SetDestination(DestinationFlag destination) {
|
||||
this->destination = destination;
|
||||
void Manager::SetDestination(DestinationFlag destination_flag) {
|
||||
destination = destination_flag;
|
||||
}
|
||||
|
||||
void Manager::Log(LogMessage message) {
|
||||
|
||||
@@ -24,14 +24,14 @@ public:
|
||||
}
|
||||
|
||||
bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) const {
|
||||
SystemClockContext context{};
|
||||
if (GetClockContext(system, context) != RESULT_SUCCESS) {
|
||||
SystemClockContext ctx{};
|
||||
if (GetClockContext(system, ctx) != RESULT_SUCCESS) {
|
||||
return {};
|
||||
}
|
||||
|
||||
s64 span{};
|
||||
if (context.steady_time_point.GetSpanBetween(
|
||||
GetSteadyClockCore().GetCurrentTimePoint(system), span) != RESULT_SUCCESS) {
|
||||
if (ctx.steady_time_point.GetSpanBetween(GetSteadyClockCore().GetCurrentTimePoint(system),
|
||||
span) != RESULT_SUCCESS) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -34,21 +34,21 @@ ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::Syst
|
||||
}
|
||||
|
||||
ResultCode StandardUserSystemClockCore::GetClockContext(Core::System& system,
|
||||
SystemClockContext& context) const {
|
||||
SystemClockContext& ctx) const {
|
||||
if (const ResultCode result{ApplyAutomaticCorrection(system, false)};
|
||||
result != RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return local_system_clock_core.GetClockContext(system, context);
|
||||
return local_system_clock_core.GetClockContext(system, ctx);
|
||||
}
|
||||
|
||||
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext& context) {
|
||||
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext& ctx) {
|
||||
UNREACHABLE();
|
||||
return ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ResultCode StandardUserSystemClockCore::SetClockContext(const SystemClockContext& context) {
|
||||
ResultCode StandardUserSystemClockCore::SetClockContext(const SystemClockContext& ctx) {
|
||||
UNREACHABLE();
|
||||
return ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@@ -63,13 +63,13 @@ ResultCode StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& s
|
||||
return ERROR_UNINITIALIZED_CLOCK;
|
||||
}
|
||||
|
||||
SystemClockContext context{};
|
||||
if (const ResultCode result{network_system_clock_core.GetClockContext(system, context)};
|
||||
SystemClockContext ctx{};
|
||||
if (const ResultCode result{network_system_clock_core.GetClockContext(system, ctx)};
|
||||
result != RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
local_system_clock_core.SetClockContext(context);
|
||||
local_system_clock_core.SetClockContext(ctx);
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -45,18 +45,18 @@ ResultCode SystemClockCore::SetCurrentTime(Core::System& system, s64 posix_time)
|
||||
return Flush(clock_context);
|
||||
}
|
||||
|
||||
ResultCode SystemClockCore::Flush(const SystemClockContext& context) {
|
||||
ResultCode SystemClockCore::Flush(const SystemClockContext& ctx) {
|
||||
if (!system_clock_context_update_callback) {
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
return system_clock_context_update_callback->Update(context);
|
||||
return system_clock_context_update_callback->Update(ctx);
|
||||
}
|
||||
|
||||
ResultCode SystemClockCore::SetSystemClockContext(const SystemClockContext& context) {
|
||||
if (const ResultCode result{SetClockContext(context)}; result != RESULT_SUCCESS) {
|
||||
ResultCode SystemClockCore::SetSystemClockContext(const SystemClockContext& ctx) {
|
||||
if (const ResultCode result{SetClockContext(ctx)}; result != RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
return Flush(context);
|
||||
return Flush(ctx);
|
||||
}
|
||||
|
||||
bool SystemClockCore::IsClockSetup(Core::System& system) const {
|
||||
|
||||
@@ -26,11 +26,11 @@ std::shared_ptr<Kernel::SharedMemory> SharedMemory::GetSharedMemoryHolder() cons
|
||||
return shared_memory_holder;
|
||||
}
|
||||
|
||||
void SharedMemory::SetupStandardSteadyClock(Core::System& system,
|
||||
void SharedMemory::SetupStandardSteadyClock(Core::System& system_,
|
||||
const Common::UUID& clock_source_id,
|
||||
Clock::TimeSpanType current_time_point) {
|
||||
const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks(
|
||||
system.CoreTiming().GetClockTicks(), Core::Hardware::CNTFREQ)};
|
||||
system_.CoreTiming().GetClockTicks(), Core::Hardware::CNTFREQ)};
|
||||
const Clock::SteadyClockContext context{
|
||||
static_cast<u64>(current_time_point.nanoseconds - ticks_time_span.nanoseconds),
|
||||
clock_source_id};
|
||||
|
||||
@@ -39,24 +39,26 @@ void Display::SignalVSyncEvent() {
|
||||
vsync_event.writable->Signal();
|
||||
}
|
||||
|
||||
void Display::CreateLayer(u64 id, NVFlinger::BufferQueue& buffer_queue) {
|
||||
void Display::CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue) {
|
||||
// TODO(Subv): Support more than 1 layer.
|
||||
ASSERT_MSG(layers.empty(), "Only one layer is supported per display at the moment");
|
||||
|
||||
layers.emplace_back(std::make_shared<Layer>(id, buffer_queue));
|
||||
layers.emplace_back(std::make_shared<Layer>(layer_id, buffer_queue));
|
||||
}
|
||||
|
||||
void Display::CloseLayer(u64 id) {
|
||||
layers.erase(
|
||||
std::remove_if(layers.begin(), layers.end(),
|
||||
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; }),
|
||||
layers.end());
|
||||
void Display::CloseLayer(u64 layer_id) {
|
||||
layers.erase(std::remove_if(layers.begin(), layers.end(),
|
||||
[layer_id](const std::shared_ptr<Layer>& layer) {
|
||||
return layer->GetID() == layer_id;
|
||||
}),
|
||||
layers.end());
|
||||
}
|
||||
|
||||
Layer* Display::FindLayer(u64 id) {
|
||||
Layer* Display::FindLayer(u64 layer_id) {
|
||||
const auto itr =
|
||||
std::find_if(layers.begin(), layers.end(),
|
||||
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; });
|
||||
std::find_if(layers.begin(), layers.end(), [layer_id](const std::shared_ptr<Layer>& layer) {
|
||||
return layer->GetID() == layer_id;
|
||||
});
|
||||
|
||||
if (itr == layers.end()) {
|
||||
return nullptr;
|
||||
@@ -65,10 +67,11 @@ Layer* Display::FindLayer(u64 id) {
|
||||
return itr->get();
|
||||
}
|
||||
|
||||
const Layer* Display::FindLayer(u64 id) const {
|
||||
const Layer* Display::FindLayer(u64 layer_id) const {
|
||||
const auto itr =
|
||||
std::find_if(layers.begin(), layers.end(),
|
||||
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; });
|
||||
std::find_if(layers.begin(), layers.end(), [layer_id](const std::shared_ptr<Layer>& layer) {
|
||||
return layer->GetID() == layer_id;
|
||||
});
|
||||
|
||||
if (itr == layers.end()) {
|
||||
return nullptr;
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace Loader {
|
||||
AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_,
|
||||
bool override_update)
|
||||
: AppLoader(std::move(file_)), override_update(override_update) {
|
||||
const auto dir = file->GetContainingDirectory();
|
||||
const auto file_dir = file->GetContainingDirectory();
|
||||
|
||||
// Title ID
|
||||
const auto npdm = dir->GetFile("main.npdm");
|
||||
const auto npdm = file_dir->GetFile("main.npdm");
|
||||
if (npdm != nullptr) {
|
||||
const auto res = metadata.Load(npdm);
|
||||
if (res == ResultStatus::Success)
|
||||
@@ -37,7 +37,7 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
|
||||
// Icon
|
||||
FileSys::VirtualFile icon_file = nullptr;
|
||||
for (const auto& language : FileSys::LANGUAGE_NAMES) {
|
||||
icon_file = dir->GetFile("icon_" + std::string(language) + ".dat");
|
||||
icon_file = file_dir->GetFile("icon_" + std::string(language) + ".dat");
|
||||
if (icon_file != nullptr) {
|
||||
icon_data = icon_file->ReadAllBytes();
|
||||
break;
|
||||
@@ -46,24 +46,23 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys
|
||||
|
||||
if (icon_data.empty()) {
|
||||
// Any png, jpeg, or bmp file
|
||||
const auto& files = dir->GetFiles();
|
||||
const auto& files = file_dir->GetFiles();
|
||||
const auto icon_iter =
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
||||
return file->GetExtension() == "png" || file->GetExtension() == "jpg" ||
|
||||
file->GetExtension() == "bmp" || file->GetExtension() == "jpeg";
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& f) {
|
||||
return f->GetExtension() == "png" || f->GetExtension() == "jpg" ||
|
||||
f->GetExtension() == "bmp" || f->GetExtension() == "jpeg";
|
||||
});
|
||||
if (icon_iter != files.end())
|
||||
icon_data = (*icon_iter)->ReadAllBytes();
|
||||
}
|
||||
|
||||
// Metadata
|
||||
FileSys::VirtualFile nacp_file = dir->GetFile("control.nacp");
|
||||
FileSys::VirtualFile nacp_file = file_dir->GetFile("control.nacp");
|
||||
if (nacp_file == nullptr) {
|
||||
const auto& files = dir->GetFiles();
|
||||
const auto& files = file_dir->GetFiles();
|
||||
const auto nacp_iter =
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
||||
return file->GetExtension() == "nacp";
|
||||
});
|
||||
std::find_if(files.begin(), files.end(),
|
||||
[](const FileSys::VirtualFile& f) { return f->GetExtension() == "nacp"; });
|
||||
if (nacp_iter != files.end())
|
||||
nacp_file = *nacp_iter;
|
||||
}
|
||||
@@ -184,8 +183,8 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
||||
// Find the RomFS by searching for a ".romfs" file in this directory
|
||||
const auto& files = dir->GetFiles();
|
||||
const auto romfs_iter =
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) {
|
||||
return file->GetName().find(".romfs") != std::string::npos;
|
||||
std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& f) {
|
||||
return f->GetName().find(".romfs") != std::string::npos;
|
||||
});
|
||||
|
||||
// Register the RomFS if a ".romfs" file was found
|
||||
@@ -200,10 +199,10 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
||||
LoadParameters{metadata.GetMainThreadPriority(), metadata.GetMainThreadStackSize()}};
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(FileSys::VirtualFile& dir) {
|
||||
ResultStatus AppLoader_DeconstructedRomDirectory::ReadRomFS(FileSys::VirtualFile& romfs_dir) {
|
||||
if (romfs == nullptr)
|
||||
return ResultStatus::ErrorNoRomFS;
|
||||
dir = romfs;
|
||||
romfs_dir = romfs;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
@@ -230,12 +229,12 @@ bool AppLoader_DeconstructedRomDirectory::IsRomFSUpdatable() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_DeconstructedRomDirectory::ReadNSOModules(Modules& modules) {
|
||||
ResultStatus AppLoader_DeconstructedRomDirectory::ReadNSOModules(Modules& modules_) {
|
||||
if (!is_loaded) {
|
||||
return ResultStatus::ErrorNotInitialized;
|
||||
}
|
||||
|
||||
modules = this->modules;
|
||||
modules_ = modules;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
* @param file The directory containing the RomFS
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadRomFS(FileSys::VirtualFile& file) {
|
||||
virtual ResultStatus ReadRomFS(FileSys::VirtualFile& file_) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
* @param file The raw update NCA file (Program-type
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
virtual ResultStatus ReadUpdateRaw(FileSys::VirtualFile& file_) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public:
|
||||
* @param file The raw manual RomFS of the game
|
||||
* @return ResultStatus result of function
|
||||
*/
|
||||
virtual ResultStatus ReadManualRomFS(FileSys::VirtualFile& file) {
|
||||
virtual ResultStatus ReadManualRomFS(FileSys::VirtualFile& file_) {
|
||||
return ResultStatus::ErrorNotImplemented;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& file) {
|
||||
return LoadNroImpl(process, file.ReadAllBytes(), file.GetName());
|
||||
bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& nro_file) {
|
||||
return LoadNroImpl(process, nro_file.ReadAllBytes(), nro_file.GetName());
|
||||
}
|
||||
|
||||
AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process, Core::System& system) {
|
||||
|
||||
@@ -183,8 +183,8 @@ AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process, Core::Sy
|
||||
LoadParameters{Kernel::THREADPRIO_DEFAULT, Core::Memory::DEFAULT_STACK_SIZE}};
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules) {
|
||||
modules = this->modules;
|
||||
ResultStatus AppLoader_NSO::ReadNSOModules(Modules& modules_) {
|
||||
modules_ = modules;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,15 +121,15 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process, Core::Sy
|
||||
return result;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& file) {
|
||||
return secondary_loader->ReadRomFS(file);
|
||||
ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& nsp_file) {
|
||||
return secondary_loader->ReadRomFS(nsp_file);
|
||||
}
|
||||
|
||||
u64 AppLoader_NSP::ReadRomFSIVFCOffset() const {
|
||||
return secondary_loader->ReadRomFSIVFCOffset();
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& nsp_file) {
|
||||
if (nsp->IsExtractedType())
|
||||
return ResultStatus::ErrorNoPackedUpdate;
|
||||
|
||||
@@ -143,7 +143,7 @@ ResultStatus AppLoader_NSP::ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
if (nca_test->GetStatus() != ResultStatus::ErrorMissingBKTRBaseRomFS)
|
||||
return nca_test->GetStatus();
|
||||
|
||||
file = read;
|
||||
nsp_file = read;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
@@ -175,13 +175,13 @@ ResultStatus AppLoader_NSP::ReadControlData(FileSys::NACP& nacp) {
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSP::ReadManualRomFS(FileSys::VirtualFile& file) {
|
||||
ResultStatus AppLoader_NSP::ReadManualRomFS(FileSys::VirtualFile& romfs_file) {
|
||||
const auto nca =
|
||||
nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::HtmlDocument);
|
||||
if (nsp->GetStatus() != ResultStatus::Success || nca == nullptr)
|
||||
return ResultStatus::ErrorNoRomFS;
|
||||
file = nca->GetRomFS();
|
||||
return file == nullptr ? ResultStatus::ErrorNoRomFS : ResultStatus::Success;
|
||||
romfs_file = nca->GetRomFS();
|
||||
return romfs_file == nullptr ? ResultStatus::ErrorNoRomFS : ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NSP::ReadBanner(std::vector<u8>& buffer) {
|
||||
|
||||
@@ -87,15 +87,15 @@ AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::Process& process, Core::Sy
|
||||
return result;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& file) {
|
||||
return nca_loader->ReadRomFS(file);
|
||||
ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& xci_file) {
|
||||
return nca_loader->ReadRomFS(xci_file);
|
||||
}
|
||||
|
||||
u64 AppLoader_XCI::ReadRomFSIVFCOffset() const {
|
||||
return nca_loader->ReadRomFSIVFCOffset();
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_XCI::ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
ResultStatus AppLoader_XCI::ReadUpdateRaw(FileSys::VirtualFile& xci_update) {
|
||||
u64 program_id{};
|
||||
nca_loader->ReadProgramId(program_id);
|
||||
if (program_id == 0)
|
||||
@@ -111,7 +111,7 @@ ResultStatus AppLoader_XCI::ReadUpdateRaw(FileSys::VirtualFile& file) {
|
||||
if (nca_test->GetStatus() != ResultStatus::ErrorMissingBKTRBaseRomFS)
|
||||
return nca_test->GetStatus();
|
||||
|
||||
file = read;
|
||||
xci_update = read;
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
@@ -140,13 +140,13 @@ ResultStatus AppLoader_XCI::ReadControlData(FileSys::NACP& control) {
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& file) {
|
||||
ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& xci_manual) {
|
||||
const auto nca = xci->GetSecurePartitionNSP()->GetNCA(xci->GetProgramTitleID(),
|
||||
FileSys::ContentRecordType::HtmlDocument);
|
||||
if (xci->GetStatus() != ResultStatus::Success || nca == nullptr)
|
||||
return ResultStatus::ErrorXCIMissingPartition;
|
||||
file = nca->GetRomFS();
|
||||
return file == nullptr ? ResultStatus::ErrorNoRomFS : ResultStatus::Success;
|
||||
xci_manual = nca->GetRomFS();
|
||||
return xci_manual == nullptr ? ResultStatus::ErrorNoRomFS : ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_XCI::ReadBanner(std::vector<u8>& buffer) {
|
||||
|
||||
@@ -222,8 +222,8 @@ void CheatEngine::SetMainMemoryParameters(VAddr main_region_begin, u64 main_regi
|
||||
};
|
||||
}
|
||||
|
||||
void CheatEngine::Reload(std::vector<CheatEntry> cheats) {
|
||||
this->cheats = std::move(cheats);
|
||||
void CheatEngine::Reload(std::vector<CheatEntry> cheats_) {
|
||||
cheats = std::move(cheats_);
|
||||
is_pending_reload.exchange(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ Freezer::~Freezer() {
|
||||
core_timing.UnscheduleEvent(event, 0);
|
||||
}
|
||||
|
||||
void Freezer::SetActive(bool active) {
|
||||
if (!this->active.exchange(active)) {
|
||||
void Freezer::SetActive(bool is_active) {
|
||||
if (!active.exchange(is_active)) {
|
||||
FillEntryReads();
|
||||
core_timing.ScheduleEvent(memory_freezer_ns, event);
|
||||
LOG_DEBUG(Common_Memory, "Memory freezer activated!");
|
||||
|
||||
Reference in New Issue
Block a user