yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #2951 from lioncash/global

core: Remove Core::CurrentProcess()
This commit is contained in:
Zach Hilman 2019-10-06 20:47:48 -04:00 committed by GitHub
commit 5326d3cb3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 87 additions and 65 deletions

View File

@ -111,7 +111,8 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
} }
struct System::Impl { struct System::Impl {
explicit Impl(System& system) explicit Impl(System& system)
: kernel{system}, cpu_core_manager{system}, applet_manager{system}, reporter{system} {} : kernel{system}, fs_controller{system}, cpu_core_manager{system},
applet_manager{system}, reporter{system} {}
Cpu& CurrentCpuCore() { Cpu& CurrentCpuCore() {
return cpu_core_manager.GetCurrentCore(); return cpu_core_manager.GetCurrentCore();
@ -641,11 +642,11 @@ bool System::GetExitLock() const {
return impl->exit_lock; return impl->exit_lock;
} }
void System::SetCurrentProcessBuildID(std::array<u8, 32> id) { void System::SetCurrentProcessBuildID(const CurrentBuildProcessID& id) {
impl->build_id = id; impl->build_id = id;
} }
const std::array<u8, 32>& System::GetCurrentProcessBuildID() const { const System::CurrentBuildProcessID& System::GetCurrentProcessBuildID() const {
return impl->build_id; return impl->build_id;
} }

View File

@ -8,7 +8,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <map>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/file_sys/vfs_types.h" #include "core/file_sys/vfs_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
@ -98,6 +97,8 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
class System { class System {
public: public:
using CurrentBuildProcessID = std::array<u8, 0x20>;
System(const System&) = delete; System(const System&) = delete;
System& operator=(const System&) = delete; System& operator=(const System&) = delete;
@ -330,9 +331,9 @@ public:
bool GetExitLock() const; bool GetExitLock() const;
void SetCurrentProcessBuildID(std::array<u8, 0x20> id); void SetCurrentProcessBuildID(const CurrentBuildProcessID& id);
const std::array<u8, 0x20>& GetCurrentProcessBuildID() const; const CurrentBuildProcessID& GetCurrentProcessBuildID() const;
private: private:
System(); System();
@ -357,8 +358,4 @@ private:
static System s_instance; static System s_instance;
}; };
inline Kernel::Process* CurrentProcess() {
return System::GetInstance().CurrentProcess();
}
} // namespace Core } // namespace Core

View File

@ -35,11 +35,11 @@ void RomFSFactory::SetPackedUpdate(VirtualFile update_raw) {
this->update_raw = std::move(update_raw); this->update_raw = std::move(update_raw);
} }
ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess() const { ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const {
if (!updatable) if (!updatable)
return MakeResult<VirtualFile>(file); return MakeResult<VirtualFile>(file);
const PatchManager patch_manager(Core::CurrentProcess()->GetTitleID()); const PatchManager patch_manager(current_process_title_id);
return MakeResult<VirtualFile>( return MakeResult<VirtualFile>(
patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw)); patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw));
} }

View File

@ -33,7 +33,7 @@ public:
~RomFSFactory(); ~RomFSFactory();
void SetPackedUpdate(VirtualFile update_raw); void SetPackedUpdate(VirtualFile update_raw);
ResultVal<VirtualFile> OpenCurrentProcess() const; ResultVal<VirtualFile> OpenCurrentProcess(u64 current_process_title_id) const;
ResultVal<VirtualFile> Open(u64 title_id, StorageId storage, ContentRecordType type) const; ResultVal<VirtualFile> Open(u64 title_id, StorageId storage, ContentRecordType type) const;
private: private:

View File

@ -127,8 +127,9 @@ std::string SaveDataFactory::GetFullPath(SaveDataSpaceId space, SaveDataType typ
u128 user_id, u64 save_id) { u128 user_id, u64 save_id) {
// According to switchbrew, if a save is of type SaveData and the title id field is 0, it should // According to switchbrew, if a save is of type SaveData and the title id field is 0, it should
// be interpreted as the title id of the current process. // be interpreted as the title id of the current process.
if (type == SaveDataType::SaveData && title_id == 0) if (type == SaveDataType::SaveData && title_id == 0) {
title_id = Core::CurrentProcess()->GetTitleID(); title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
}
std::string out = GetSaveDataSpaceIdPath(space); std::string out = GetSaveDataSpaceIdPath(space);

View File

@ -641,7 +641,8 @@ static void HandleQuery() {
strlen("Xfer:features:read:target.xml:")) == 0) { strlen("Xfer:features:read:target.xml:")) == 0) {
SendReply(target_xml); SendReply(target_xml);
} else if (strncmp(query, "Offsets", strlen("Offsets")) == 0) { } else if (strncmp(query, "Offsets", strlen("Offsets")) == 0) {
const VAddr base_address = Core::CurrentProcess()->VMManager().GetCodeRegionBaseAddress(); const VAddr base_address =
Core::System::GetInstance().CurrentProcess()->VMManager().GetCodeRegionBaseAddress();
std::string buffer = fmt::format("TextSeg={:0x}", base_address); std::string buffer = fmt::format("TextSeg={:0x}", base_address);
SendReply(buffer.c_str()); SendReply(buffer.c_str());
} else if (strncmp(query, "fThreadInfo", strlen("fThreadInfo")) == 0) { } else if (strncmp(query, "fThreadInfo", strlen("fThreadInfo")) == 0) {

View File

@ -103,7 +103,7 @@ SharedPtr<Object> HandleTable::GetGeneric(Handle handle) const {
if (handle == CurrentThread) { if (handle == CurrentThread) {
return GetCurrentThread(); return GetCurrentThread();
} else if (handle == CurrentProcess) { } else if (handle == CurrentProcess) {
return Core::CurrentProcess(); return Core::System::GetInstance().CurrentProcess();
} }
if (!IsValid(handle)) { if (!IsValid(handle)) {

View File

@ -1142,12 +1142,12 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
if (kind == LaunchParameterKind::ApplicationSpecific && !launch_popped_application_specific) { if (kind == LaunchParameterKind::ApplicationSpecific && !launch_popped_application_specific) {
const auto backend = BCAT::CreateBackendFromSettings( const auto backend = BCAT::CreateBackendFromSettings(
[this](u64 tid) { return system.GetFileSystemController().GetBCATDirectory(tid); }); [this](u64 tid) { return system.GetFileSystemController().GetBCATDirectory(tid); });
const auto build_id_full = Core::System::GetInstance().GetCurrentProcessBuildID(); const auto build_id_full = system.GetCurrentProcessBuildID();
u64 build_id{}; u64 build_id{};
std::memcpy(&build_id, build_id_full.data(), sizeof(u64)); std::memcpy(&build_id, build_id_full.data(), sizeof(u64));
const auto data = const auto data =
backend->GetLaunchParameter({Core::CurrentProcess()->GetTitleID(), build_id}); backend->GetLaunchParameter({system.CurrentProcess()->GetTitleID(), build_id});
if (data.has_value()) { if (data.has_value()) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@ -1200,7 +1200,7 @@ void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]); LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]);
FileSys::SaveDataDescriptor descriptor{}; FileSys::SaveDataDescriptor descriptor{};
descriptor.title_id = Core::CurrentProcess()->GetTitleID(); descriptor.title_id = system.CurrentProcess()->GetTitleID();
descriptor.user_id = user_id; descriptor.user_id = user_id;
descriptor.type = FileSys::SaveDataType::SaveData; descriptor.type = FileSys::SaveDataType::SaveData;
const auto res = system.GetFileSystemController().CreateSaveData( const auto res = system.GetFileSystemController().CreateSaveData(

View File

@ -6,8 +6,9 @@
namespace Service::BCAT { namespace Service::BCAT {
BCAT::BCAT(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, const char* name) BCAT::BCAT(Core::System& system, std::shared_ptr<Module> module,
: Module::Interface(std::move(module), fsc, name) { FileSystem::FileSystemController& fsc, const char* name)
: Interface(system, std::move(module), fsc, name) {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &BCAT::CreateBcatService, "CreateBcatService"}, {0, &BCAT::CreateBcatService, "CreateBcatService"},

View File

@ -6,12 +6,16 @@
#include "core/hle/service/bcat/module.h" #include "core/hle/service/bcat/module.h"
namespace Core {
class System;
}
namespace Service::BCAT { namespace Service::BCAT {
class BCAT final : public Module::Interface { class BCAT final : public Module::Interface {
public: public:
explicit BCAT(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, explicit BCAT(Core::System& system, std::shared_ptr<Module> module,
const char* name); FileSystem::FileSystemController& fsc, const char* name);
~BCAT() override; ~BCAT() override;
}; };

View File

@ -35,8 +35,7 @@ using BCATDigest = std::array<u8, 0x10>;
namespace { namespace {
u64 GetCurrentBuildID() { u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) {
const auto& id = Core::System::GetInstance().GetCurrentProcessBuildID();
u64 out{}; u64 out{};
std::memcpy(&out, id.data(), sizeof(u64)); std::memcpy(&out, id.data(), sizeof(u64));
return out; return out;
@ -125,7 +124,8 @@ private:
class IBcatService final : public ServiceFramework<IBcatService> { class IBcatService final : public ServiceFramework<IBcatService> {
public: public:
IBcatService(Backend& backend) : ServiceFramework("IBcatService"), backend(backend) { explicit IBcatService(Core::System& system_, Backend& backend_)
: ServiceFramework("IBcatService"), system{system_}, backend{backend_} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{10100, &IBcatService::RequestSyncDeliveryCache, "RequestSyncDeliveryCache"}, {10100, &IBcatService::RequestSyncDeliveryCache, "RequestSyncDeliveryCache"},
@ -163,7 +163,8 @@ private:
void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) { void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_BCAT, "called"); LOG_DEBUG(Service_BCAT, "called");
backend.Synchronize({Core::CurrentProcess()->GetTitleID(), GetCurrentBuildID()}, backend.Synchronize({system.CurrentProcess()->GetTitleID(),
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
progress.at(static_cast<std::size_t>(SyncType::Normal))); progress.at(static_cast<std::size_t>(SyncType::Normal)));
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@ -179,7 +180,8 @@ private:
LOG_DEBUG(Service_BCAT, "called, name={}", name); LOG_DEBUG(Service_BCAT, "called, name={}", name);
backend.SynchronizeDirectory({Core::CurrentProcess()->GetTitleID(), GetCurrentBuildID()}, backend.SynchronizeDirectory({system.CurrentProcess()->GetTitleID(),
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
name, name,
progress.at(static_cast<std::size_t>(SyncType::Directory))); progress.at(static_cast<std::size_t>(SyncType::Directory)));
@ -244,6 +246,7 @@ private:
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
} }
Core::System& system;
Backend& backend; Backend& backend;
std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress{ std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress{
@ -257,7 +260,7 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IBcatService>(*backend); rb.PushIpcInterface<IBcatService>(system, *backend);
} }
class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> { class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> {
@ -539,7 +542,7 @@ void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestCont
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IDeliveryCacheStorageService>( rb.PushIpcInterface<IDeliveryCacheStorageService>(
fsc.GetBCATDirectory(Core::CurrentProcess()->GetTitleID())); fsc.GetBCATDirectory(system.CurrentProcess()->GetTitleID()));
} }
void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
@ -565,22 +568,23 @@ std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
return std::make_unique<NullBackend>(std::move(getter)); return std::make_unique<NullBackend>(std::move(getter));
} }
Module::Interface::Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_,
const char* name) FileSystem::FileSystemController& fsc_, const char* name)
: ServiceFramework(name), fsc(fsc), module(std::move(module)), : ServiceFramework(name), fsc{fsc_}, module{std::move(module_)},
backend(CreateBackendFromSettings([&fsc](u64 tid) { return fsc.GetBCATDirectory(tid); })) {} backend{CreateBackendFromSettings([&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })},
system{system_} {}
Module::Interface::~Interface() = default; Module::Interface::~Interface() = default;
void InstallInterfaces(Core::System& system) { void InstallInterfaces(Core::System& system) {
auto module = std::make_shared<Module>(); auto module = std::make_shared<Module>();
std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:a") std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:a")
->InstallAsService(system.ServiceManager()); ->InstallAsService(system.ServiceManager());
std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:m") std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:m")
->InstallAsService(system.ServiceManager()); ->InstallAsService(system.ServiceManager());
std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:u") std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:u")
->InstallAsService(system.ServiceManager()); ->InstallAsService(system.ServiceManager());
std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:s") std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:s")
->InstallAsService(system.ServiceManager()); ->InstallAsService(system.ServiceManager());
} }

View File

@ -6,6 +6,10 @@
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service { namespace Service {
namespace FileSystem { namespace FileSystem {
@ -20,8 +24,8 @@ class Module final {
public: public:
class Interface : public ServiceFramework<Interface> { class Interface : public ServiceFramework<Interface> {
public: public:
explicit Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, explicit Interface(Core::System& system_, std::shared_ptr<Module> module_,
const char* name); FileSystem::FileSystemController& fsc_, const char* name);
~Interface() override; ~Interface() override;
void CreateBcatService(Kernel::HLERequestContext& ctx); void CreateBcatService(Kernel::HLERequestContext& ctx);
@ -33,6 +37,9 @@ public:
std::shared_ptr<Module> module; std::shared_ptr<Module> module;
std::unique_ptr<Backend> backend; std::unique_ptr<Backend> backend;
private:
Core::System& system;
}; };
}; };

View File

@ -66,7 +66,7 @@ enum class FatalType : u32 {
static void GenerateErrorReport(Core::System& system, ResultCode error_code, static void GenerateErrorReport(Core::System& system, ResultCode error_code,
const FatalInfo& info) { const FatalInfo& info) {
const auto title_id = Core::CurrentProcess()->GetTitleID(); const auto title_id = system.CurrentProcess()->GetTitleID();
std::string crash_report = fmt::format( std::string crash_report = fmt::format(
"Yuzu {}-{} crash report\n" "Yuzu {}-{} crash report\n"
"Title ID: {:016x}\n" "Title ID: {:016x}\n"

View File

@ -241,7 +241,7 @@ ResultVal<FileSys::EntryType> VfsDirectoryServiceWrapper::GetEntryType(
return FileSys::ERROR_PATH_NOT_FOUND; return FileSys::ERROR_PATH_NOT_FOUND;
} }
FileSystemController::FileSystemController() = default; FileSystemController::FileSystemController(Core::System& system_) : system{system_} {}
FileSystemController::~FileSystemController() = default; FileSystemController::~FileSystemController() = default;
@ -290,7 +290,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess()
return ResultCode(-1); return ResultCode(-1);
} }
return romfs_factory->OpenCurrentProcess(); return romfs_factory->OpenCurrentProcess(system.CurrentProcess()->GetTitleID());
} }
ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS( ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFS(
@ -447,10 +447,10 @@ FileSys::SaveDataSize FileSystemController::ReadSaveDataSize(FileSys::SaveDataTy
FileSys::SaveDataSize new_size{SUFFICIENT_SAVE_DATA_SIZE, SUFFICIENT_SAVE_DATA_SIZE}; FileSys::SaveDataSize new_size{SUFFICIENT_SAVE_DATA_SIZE, SUFFICIENT_SAVE_DATA_SIZE};
FileSys::NACP nacp; FileSys::NACP nacp;
const auto res = Core::System::GetInstance().GetAppLoader().ReadControlData(nacp); const auto res = system.GetAppLoader().ReadControlData(nacp);
if (res != Loader::ResultStatus::Success) { if (res != Loader::ResultStatus::Success) {
FileSys::PatchManager pm{Core::CurrentProcess()->GetTitleID()}; FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()};
auto [nacp_unique, discard] = pm.GetControlMetadata(); auto [nacp_unique, discard] = pm.GetControlMetadata();
if (nacp_unique != nullptr) { if (nacp_unique != nullptr) {
@ -702,10 +702,10 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove
if (bis_factory == nullptr) { if (bis_factory == nullptr) {
bis_factory = bis_factory =
std::make_unique<FileSys::BISFactory>(nand_directory, load_directory, dump_directory); std::make_unique<FileSys::BISFactory>(nand_directory, load_directory, dump_directory);
Core::System::GetInstance().RegisterContentProvider( system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::SysNAND,
FileSys::ContentProviderUnionSlot::SysNAND, bis_factory->GetSystemNANDContents()); bis_factory->GetSystemNANDContents());
Core::System::GetInstance().RegisterContentProvider( system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::UserNAND,
FileSys::ContentProviderUnionSlot::UserNAND, bis_factory->GetUserNANDContents()); bis_factory->GetUserNANDContents());
} }
if (save_data_factory == nullptr) { if (save_data_factory == nullptr) {
@ -714,7 +714,7 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove
if (sdmc_factory == nullptr) { if (sdmc_factory == nullptr) {
sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory)); sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory));
Core::System::GetInstance().RegisterContentProvider(FileSys::ContentProviderUnionSlot::SDMC, system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::SDMC,
sdmc_factory->GetSDMCContents()); sdmc_factory->GetSDMCContents());
} }
} }

View File

@ -10,6 +10,10 @@
#include "core/file_sys/vfs.h" #include "core/file_sys/vfs.h"
#include "core/hle/result.h" #include "core/hle/result.h"
namespace Core {
class System;
}
namespace FileSys { namespace FileSys {
class BISFactory; class BISFactory;
class RegisteredCache; class RegisteredCache;
@ -52,7 +56,7 @@ enum class ImageDirectoryId : u32 {
class FileSystemController { class FileSystemController {
public: public:
FileSystemController(); explicit FileSystemController(Core::System& system_);
~FileSystemController(); ~FileSystemController();
ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory); ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory);
@ -125,6 +129,8 @@ private:
std::unique_ptr<FileSys::XCI> gamecard; std::unique_ptr<FileSys::XCI> gamecard;
std::unique_ptr<FileSys::RegisteredCache> gamecard_registered; std::unique_ptr<FileSys::RegisteredCache> gamecard_registered;
std::unique_ptr<FileSys::PlaceholderCache> gamecard_placeholder; std::unique_ptr<FileSys::PlaceholderCache> gamecard_placeholder;
Core::System& system;
}; };
void InstallInterfaces(Core::System& system); void InstallInterfaces(Core::System& system);

View File

@ -163,7 +163,7 @@ public:
return; return;
} }
if (Core::CurrentProcess()->GetTitleID() != header.title_id) { if (system.CurrentProcess()->GetTitleID() != header.title_id) {
LOG_ERROR(Service_LDR, LOG_ERROR(Service_LDR,
"Attempting to load NRR with title ID other than current process. (actual " "Attempting to load NRR with title ID other than current process. (actual "
"{:016X})!", "{:016X})!",
@ -327,7 +327,7 @@ public:
} }
// Load NRO as new executable module // Load NRO as new executable module
auto* process = Core::CurrentProcess(); auto* process = system.CurrentProcess();
auto& vm_manager = process->VMManager(); auto& vm_manager = process->VMManager();
auto map_address = vm_manager.FindFreeRegion(nro_size + bss_size); auto map_address = vm_manager.FindFreeRegion(nro_size + bss_size);
@ -411,7 +411,7 @@ public:
return; return;
} }
auto& vm_manager = Core::CurrentProcess()->VMManager(); auto& vm_manager = system.CurrentProcess()->VMManager();
const auto& nro_info = iter->second; const auto& nro_info = iter->second;
// Unmap the mirrored memory // Unmap the mirrored memory

View File

@ -324,14 +324,14 @@ void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
// Map backing memory for the font data // Map backing memory for the font data
LOG_DEBUG(Service_NS, "called"); LOG_DEBUG(Service_NS, "called");
Core::CurrentProcess()->VMManager().MapMemoryBlock(SHARED_FONT_MEM_VADDR, impl->shared_font, 0, system.CurrentProcess()->VMManager().MapMemoryBlock(SHARED_FONT_MEM_VADDR, impl->shared_font, 0,
SHARED_FONT_MEM_SIZE, SHARED_FONT_MEM_SIZE,
Kernel::MemoryState::Shared); Kernel::MemoryState::Shared);
// Create shared font memory object // Create shared font memory object
auto& kernel = system.Kernel(); auto& kernel = system.Kernel();
impl->shared_font_mem = Kernel::SharedMemory::Create( impl->shared_font_mem = Kernel::SharedMemory::Create(
kernel, Core::CurrentProcess(), SHARED_FONT_MEM_SIZE, Kernel::MemoryPermission::ReadWrite, kernel, system.CurrentProcess(), SHARED_FONT_MEM_SIZE, Kernel::MemoryPermission::ReadWrite,
Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE, Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE,
"PL_U:shared_font_mem"); "PL_U:shared_font_mem");

View File

@ -146,7 +146,7 @@ static u8* GetPointerFromVMA(const Kernel::Process& process, VAddr vaddr) {
* using a VMA from the current process. * using a VMA from the current process.
*/ */
static u8* GetPointerFromVMA(VAddr vaddr) { static u8* GetPointerFromVMA(VAddr vaddr) {
return GetPointerFromVMA(*Core::CurrentProcess(), vaddr); return GetPointerFromVMA(*Core::System::GetInstance().CurrentProcess(), vaddr);
} }
template <typename T> template <typename T>
@ -226,7 +226,7 @@ bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) {
} }
bool IsValidVirtualAddress(const VAddr vaddr) { bool IsValidVirtualAddress(const VAddr vaddr) {
return IsValidVirtualAddress(*Core::CurrentProcess(), vaddr); return IsValidVirtualAddress(*Core::System::GetInstance().CurrentProcess(), vaddr);
} }
bool IsKernelVirtualAddress(const VAddr vaddr) { bool IsKernelVirtualAddress(const VAddr vaddr) {
@ -387,7 +387,7 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_
} }
void ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_t size) { void ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_t size) {
ReadBlock(*Core::CurrentProcess(), src_addr, dest_buffer, size); ReadBlock(*Core::System::GetInstance().CurrentProcess(), src_addr, dest_buffer, size);
} }
void Write8(const VAddr addr, const u8 data) { void Write8(const VAddr addr, const u8 data) {
@ -450,7 +450,7 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi
} }
void WriteBlock(const VAddr dest_addr, const void* src_buffer, const std::size_t size) { void WriteBlock(const VAddr dest_addr, const void* src_buffer, const std::size_t size) {
WriteBlock(*Core::CurrentProcess(), dest_addr, src_buffer, size); WriteBlock(*Core::System::GetInstance().CurrentProcess(), dest_addr, src_buffer, size);
} }
void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const std::size_t size) { void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const std::size_t size) {
@ -539,7 +539,7 @@ void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
} }
void CopyBlock(VAddr dest_addr, VAddr src_addr, std::size_t size) { void CopyBlock(VAddr dest_addr, VAddr src_addr, std::size_t size) {
CopyBlock(*Core::CurrentProcess(), dest_addr, src_addr, size); CopyBlock(*Core::System::GetInstance().CurrentProcess(), dest_addr, src_addr, size);
} }
} // namespace Memory } // namespace Memory