general: Get the current process program id directly from the system
This allows us to avoid including KProcess' header file in files that only need to get the current process' program id.
This commit is contained in:
parent
64275dfbf4
commit
a6e6a5ac38
21 changed files with 42 additions and 56 deletions
|
@ -16,7 +16,6 @@
|
|||
#include "core/file_sys/control_metadata.h"
|
||||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/service/acc/acc.h"
|
||||
#include "core/hle/service/acc/acc_aa.h"
|
||||
|
@ -759,9 +758,8 @@ ResultCode Module::Interface::InitializeApplicationInfoBase() {
|
|||
// TODO(ogniK): This should be changed to reflect the target process for when we have multiple
|
||||
// processes emulated. As we don't actually have pid support we should assume we're just using
|
||||
// our own process
|
||||
const auto& current_process = system.Kernel().CurrentProcess();
|
||||
const auto launch_property =
|
||||
system.GetARPManager().GetLaunchProperty(current_process->GetProgramID());
|
||||
system.GetARPManager().GetLaunchProperty(system.GetCurrentProcessProgramID());
|
||||
|
||||
if (launch_property.Failed()) {
|
||||
LOG_ERROR(Service_ACC, "Failed to get launch property");
|
||||
|
@ -805,7 +803,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx
|
|||
bool is_locked = false;
|
||||
|
||||
if (res != Loader::ResultStatus::Success) {
|
||||
const FileSys::PatchManager pm{system.CurrentProcess()->GetProgramID(),
|
||||
const FileSys::PatchManager pm{system.GetCurrentProcessProgramID(),
|
||||
system.GetFileSystemController(),
|
||||
system.GetContentProvider()};
|
||||
const auto nacp_unique = pm.GetControlMetadata().first;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "core/file_sys/savedata_factory.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_transfer_memory.h"
|
||||
#include "core/hle/service/acc/profile_manager.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
|
@ -1429,8 +1428,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
|
|||
u64 build_id{};
|
||||
std::memcpy(&build_id, build_id_full.data(), sizeof(u64));
|
||||
|
||||
auto data =
|
||||
backend->GetLaunchParameter({system.CurrentProcess()->GetProgramID(), build_id});
|
||||
auto data = backend->GetLaunchParameter({system.GetCurrentProcessProgramID(), build_id});
|
||||
if (data.has_value()) {
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
|
@ -1482,7 +1480,7 @@ void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
|
|||
LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]);
|
||||
|
||||
FileSys::SaveDataAttribute attribute{};
|
||||
attribute.title_id = system.CurrentProcess()->GetProgramID();
|
||||
attribute.title_id = system.GetCurrentProcessProgramID();
|
||||
attribute.user_id = user_id;
|
||||
attribute.type = FileSys::SaveDataType::SaveData;
|
||||
const auto res = system.GetFileSystemController().CreateSaveData(
|
||||
|
@ -1512,7 +1510,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
|
|||
std::array<u8, 0x10> version_string{};
|
||||
|
||||
const auto res = [this] {
|
||||
const auto title_id = system.CurrentProcess()->GetProgramID();
|
||||
const auto title_id = system.GetCurrentProcessProgramID();
|
||||
|
||||
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
|
||||
system.GetContentProvider()};
|
||||
|
@ -1549,7 +1547,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
|
|||
u32 supported_languages = 0;
|
||||
|
||||
const auto res = [this] {
|
||||
const auto title_id = system.CurrentProcess()->GetProgramID();
|
||||
const auto title_id = system.GetCurrentProcessProgramID();
|
||||
|
||||
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
|
||||
system.GetContentProvider()};
|
||||
|
@ -1657,8 +1655,7 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) {
|
|||
static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size);
|
||||
|
||||
system.GetFileSystemController().WriteSaveDataSize(
|
||||
type, system.CurrentProcess()->GetProgramID(), user_id,
|
||||
{new_normal_size, new_journal_size});
|
||||
type, system.GetCurrentProcessProgramID(), user_id, {new_normal_size, new_journal_size});
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
|
@ -1682,7 +1679,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
|
|||
user_id[0]);
|
||||
|
||||
const auto size = system.GetFileSystemController().ReadSaveDataSize(
|
||||
type, system.CurrentProcess()->GetProgramID(), user_id);
|
||||
type, system.GetCurrentProcessProgramID(), user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 6};
|
||||
rb.Push(ResultSuccess);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/frontend/applets/error.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applets/applet_error.h"
|
||||
#include "core/reporter.h"
|
||||
|
@ -167,7 +166,7 @@ void Error::Execute() {
|
|||
}
|
||||
|
||||
const auto callback = [this] { DisplayCompleted(); };
|
||||
const auto title_id = system.CurrentProcess()->GetProgramID();
|
||||
const auto title_id = system.GetCurrentProcessProgramID();
|
||||
const auto& reporter{system.GetReporter()};
|
||||
|
||||
switch (mode) {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/frontend/applets/general_frontend.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applets/applet_general_backend.h"
|
||||
|
@ -187,7 +186,7 @@ void PhotoViewer::Execute() {
|
|||
const auto callback = [this] { ViewFinished(); };
|
||||
switch (mode) {
|
||||
case PhotoViewerAppletMode::CurrentApp:
|
||||
frontend.ShowPhotosForApplication(system.CurrentProcess()->GetProgramID(), callback);
|
||||
frontend.ShowPhotosForApplication(system.GetCurrentProcessProgramID(), callback);
|
||||
break;
|
||||
case PhotoViewerAppletMode::AllApps:
|
||||
frontend.ShowAllPhotos(callback);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "core/file_sys/system_archive/system_archive.h"
|
||||
#include "core/file_sys/vfs_vector.h"
|
||||
#include "core/frontend/applets/web_browser.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applets/applet_web_browser.h"
|
||||
|
@ -395,7 +394,7 @@ void WebBrowser::InitializeOffline() {
|
|||
switch (document_kind) {
|
||||
case DocumentKind::OfflineHtmlPage:
|
||||
default:
|
||||
title_id = system.CurrentProcess()->GetProgramID();
|
||||
title_id = system.GetCurrentProcessProgramID();
|
||||
nca_type = FileSys::ContentRecordType::HtmlDocument;
|
||||
additional_paths = "html-document";
|
||||
break;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "core/file_sys/registered_cache.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/aoc/aoc_u.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
||||
|
@ -152,7 +151,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
|
|||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
const auto current = system.CurrentProcess()->GetProgramID();
|
||||
const auto current = system.GetCurrentProcessProgramID();
|
||||
|
||||
const auto& disabled = Settings::values.disabled_addons[current];
|
||||
if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) {
|
||||
|
@ -179,7 +178,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
|
|||
LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count,
|
||||
process_id);
|
||||
|
||||
const auto current = system.CurrentProcess()->GetProgramID();
|
||||
const auto current = system.GetCurrentProcessProgramID();
|
||||
|
||||
std::vector<u32> out;
|
||||
const auto& disabled = Settings::values.disabled_addons[current];
|
||||
|
@ -225,7 +224,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
|
|||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
|
||||
const auto title_id = system.CurrentProcess()->GetProgramID();
|
||||
const auto title_id = system.GetCurrentProcessProgramID();
|
||||
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
|
||||
system.GetContentProvider()};
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "core/core.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/service/bcat/backend/backend.h"
|
||||
#include "core/hle/service/bcat/bcat.h"
|
||||
|
@ -178,7 +177,7 @@ private:
|
|||
void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_BCAT, "called");
|
||||
|
||||
backend.Synchronize({system.CurrentProcess()->GetProgramID(),
|
||||
backend.Synchronize({system.GetCurrentProcessProgramID(),
|
||||
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
|
||||
GetProgressBackend(SyncType::Normal));
|
||||
|
||||
|
@ -195,7 +194,7 @@ private:
|
|||
|
||||
LOG_DEBUG(Service_BCAT, "called, name={}", name);
|
||||
|
||||
backend.SynchronizeDirectory({system.CurrentProcess()->GetProgramID(),
|
||||
backend.SynchronizeDirectory({system.GetCurrentProcessProgramID(),
|
||||
GetCurrentBuildID(system.GetCurrentProcessBuildID())},
|
||||
name, GetProgressBackend(SyncType::Directory));
|
||||
|
||||
|
@ -556,7 +555,7 @@ private:
|
|||
void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_BCAT, "called");
|
||||
|
||||
const auto title_id = system.CurrentProcess()->GetProgramID();
|
||||
const auto title_id = system.GetCurrentProcessProgramID();
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "common/swap.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/fatal/fatal.h"
|
||||
#include "core/hle/service/fatal/fatal_p.h"
|
||||
#include "core/hle/service/fatal/fatal_u.h"
|
||||
|
@ -66,7 +65,7 @@ enum class FatalType : u32 {
|
|||
|
||||
static void GenerateErrorReport(Core::System& system, ResultCode error_code,
|
||||
const FatalInfo& info) {
|
||||
const auto title_id = system.CurrentProcess()->GetProgramID();
|
||||
const auto title_id = system.GetCurrentProcessProgramID();
|
||||
std::string crash_report = fmt::format(
|
||||
"Yuzu {}-{} crash report\n"
|
||||
"Title ID: {:016x}\n"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "core/file_sys/sdmc_factory.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/file_sys/vfs_offset.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/filesystem/fsp_ldr.h"
|
||||
#include "core/hle/service/filesystem/fsp_pr.h"
|
||||
|
@ -320,7 +319,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess()
|
|||
return ResultUnknown;
|
||||
}
|
||||
|
||||
return romfs_factory->OpenCurrentProcess(system.CurrentProcess()->GetProgramID());
|
||||
return romfs_factory->OpenCurrentProcess(system.GetCurrentProcessProgramID());
|
||||
}
|
||||
|
||||
ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFS(
|
||||
|
@ -505,7 +504,7 @@ FileSys::SaveDataSize FileSystemController::ReadSaveDataSize(FileSys::SaveDataTy
|
|||
const auto res = system.GetAppLoader().ReadControlData(nacp);
|
||||
|
||||
if (res != Loader::ResultStatus::Success) {
|
||||
const FileSys::PatchManager pm{system.CurrentProcess()->GetProgramID(),
|
||||
const FileSys::PatchManager pm{system.GetCurrentProcessProgramID(),
|
||||
system.GetFileSystemController(),
|
||||
system.GetContentProvider()};
|
||||
const auto metadata = pm.GetControlMetadata();
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "core/file_sys/system_archive/system_archive.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/filesystem/fsp_srv.h"
|
||||
#include "core/reporter.h"
|
||||
|
@ -1034,9 +1033,8 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
LOG_DEBUG(Service_FS, "called, program_index={}", program_index);
|
||||
|
||||
auto patched_romfs =
|
||||
fsc.OpenPatchedRomFSWithProgramIndex(system.CurrentProcess()->GetProgramID(), program_index,
|
||||
FileSys::ContentRecordType::Program);
|
||||
auto patched_romfs = fsc.OpenPatchedRomFSWithProgramIndex(
|
||||
system.GetCurrentProcessProgramID(), program_index, FileSys::ContentRecordType::Program);
|
||||
|
||||
if (patched_romfs.Failed()) {
|
||||
// TODO: Find the right error code to use here
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_system_control.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/hle/service/ldr/ldr.h"
|
||||
|
@ -247,7 +246,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
if (system.CurrentProcess()->GetProgramID() != header.application_id) {
|
||||
if (system.GetCurrentProcessProgramID() != header.application_id) {
|
||||
LOG_ERROR(Service_LDR,
|
||||
"Attempting to load NRR with title ID other than current process. (actual "
|
||||
"{:016X})!",
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "core/file_sys/control_metadata.h"
|
||||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/pctl/pctl.h"
|
||||
#include "core/hle/service/pctl/pctl_module.h"
|
||||
|
||||
|
@ -189,7 +188,7 @@ private:
|
|||
|
||||
// TODO(ogniK): Recovery flag initialization for pctl:r
|
||||
|
||||
const auto tid = system.CurrentProcess()->GetProgramID();
|
||||
const auto tid = system.GetCurrentProcessProgramID();
|
||||
if (tid != 0) {
|
||||
const FileSys::PatchManager pm{tid, system.GetFileSystemController(),
|
||||
system.GetContentProvider()};
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/acc/profile_manager.h"
|
||||
#include "core/hle/service/prepo/prepo.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
@ -73,7 +72,7 @@ private:
|
|||
Type, process_id, data1.size(), data2.size());
|
||||
|
||||
const auto& reporter{system.GetReporter()};
|
||||
reporter.SavePlayReport(Type, system.CurrentProcess()->GetProgramID(), {data1, data2},
|
||||
reporter.SavePlayReport(Type, system.GetCurrentProcessProgramID(), {data1, data2},
|
||||
process_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
|
@ -101,7 +100,7 @@ private:
|
|||
Type, user_id[1], user_id[0], process_id, data1.size(), data2.size());
|
||||
|
||||
const auto& reporter{system.GetReporter()};
|
||||
reporter.SavePlayReport(Type, system.CurrentProcess()->GetProgramID(), {data1, data2},
|
||||
reporter.SavePlayReport(Type, system.GetCurrentProcessProgramID(), {data1, data2},
|
||||
process_id, user_id);
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue