summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar liamwhite2023-02-15 17:42:45 -0500
committerGravatar GitHub2023-02-15 17:42:45 -0500
commit6d77de96dae4763ef78fdea1918b582e5e181653 (patch)
tree0c131de68a68c23f62a8a253b3cf69d3bfc91ee7 /src
parentMerge pull request #9782 from arades79/fix-consexpr-value-declaration-usage (diff)
parentgeneral: rename CurrentProcess to ApplicationProcess (diff)
downloadyuzu-6d77de96dae4763ef78fdea1918b582e5e181653.tar.gz
yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.tar.xz
yuzu-6d77de96dae4763ef78fdea1918b582e5e181653.zip
Merge pull request #9796 from liamwhite/current
general: rename CurrentProcess to ApplicationProcess
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/renderer/system.cpp2
-rw-r--r--src/audio_core/sink/sink_stream.cpp4
-rw-r--r--src/core/arm/arm_interface.cpp6
-rw-r--r--src/core/core.cpp42
-rw-r--r--src/core/core.h18
-rw-r--r--src/core/debugger/gdbstub.cpp28
-rw-r--r--src/core/file_sys/savedata_factory.cpp2
-rw-r--r--src/core/hle/ipc_helpers.h2
-rw-r--r--src/core/hle/kernel/k_client_port.cpp3
-rw-r--r--src/core/hle/kernel/k_code_memory.cpp8
-rw-r--r--src/core/hle/kernel/k_condition_variable.cpp8
-rw-r--r--src/core/hle/kernel/k_handle_table.h3
-rw-r--r--src/core/hle/kernel/k_interrupt_manager.cpp2
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp14
-rw-r--r--src/core/hle/kernel/k_session.cpp3
-rw-r--r--src/core/hle/kernel/k_thread.cpp8
-rw-r--r--src/core/hle/kernel/k_thread.h2
-rw-r--r--src/core/hle/kernel/k_transfer_memory.cpp2
-rw-r--r--src/core/hle/kernel/kernel.cpp46
-rw-r--r--src/core/hle/kernel/kernel.h24
-rw-r--r--src/core/hle/kernel/svc.cpp2
-rw-r--r--src/core/hle/kernel/svc/svc_activity.cpp5
-rw-r--r--src/core/hle/kernel/svc/svc_address_arbiter.cpp6
-rw-r--r--src/core/hle/kernel/svc/svc_cache.cpp2
-rw-r--r--src/core/hle/kernel/svc/svc_code_memory.cpp23
-rw-r--r--src/core/hle/kernel/svc/svc_condition_variable.cpp8
-rw-r--r--src/core/hle/kernel/svc/svc_device_address_space.cpp33
-rw-r--r--src/core/hle/kernel/svc/svc_event.cpp10
-rw-r--r--src/core/hle/kernel/svc/svc_info.cpp14
-rw-r--r--src/core/hle/kernel/svc/svc_ipc.cpp6
-rw-r--r--src/core/hle/kernel/svc/svc_lock.cpp4
-rw-r--r--src/core/hle/kernel/svc/svc_memory.cpp8
-rw-r--r--src/core/hle/kernel/svc/svc_physical_memory.cpp6
-rw-r--r--src/core/hle/kernel/svc/svc_port.cpp2
-rw-r--r--src/core/hle/kernel/svc/svc_process.cpp14
-rw-r--r--src/core/hle/kernel/svc/svc_process_memory.cpp10
-rw-r--r--src/core/hle/kernel/svc/svc_query_memory.cpp2
-rw-r--r--src/core/hle/kernel/svc/svc_resource_limit.cpp20
-rw-r--r--src/core/hle/kernel/svc/svc_session.cpp2
-rw-r--r--src/core/hle/kernel/svc/svc_shared_memory.cpp4
-rw-r--r--src/core/hle/kernel/svc/svc_synchronization.cpp10
-rw-r--r--src/core/hle/kernel/svc/svc_thread.cpp30
-rw-r--r--src/core/hle/kernel/svc/svc_transfer_memory.cpp4
-rw-r--r--src/core/hle/kernel/svc_generator.py2
-rw-r--r--src/core/hle/service/acc/acc.cpp4
-rw-r--r--src/core/hle/service/am/am.cpp22
-rw-r--r--src/core/hle/service/am/applets/applet_error.cpp2
-rw-r--r--src/core/hle/service/am/applets/applet_general_backend.cpp2
-rw-r--r--src/core/hle/service/am/applets/applet_web_browser.cpp2
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp6
-rw-r--r--src/core/hle/service/audio/audren_u.cpp2
-rw-r--r--src/core/hle/service/bcat/bcat_module.cpp10
-rw-r--r--src/core/hle/service/fatal/fatal.cpp2
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp4
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp5
-rw-r--r--src/core/hle/service/hid/hid.cpp8
-rw-r--r--src/core/hle/service/hid/hidbus.cpp4
-rw-r--r--src/core/hle/service/hid/irs.cpp8
-rw-r--r--src/core/hle/service/jit/jit.cpp4
-rw-r--r--src/core/hle/service/ldr/ldr.cpp13
-rw-r--r--src/core/hle/service/nfp/nfp_device.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp4
-rw-r--r--src/core/hle/service/nvdrv/devices/nvmap.cpp4
-rw-r--r--src/core/hle/service/pctl/pctl_module.cpp2
-rw-r--r--src/core/hle/service/prepo/prepo.cpp4
-rw-r--r--src/core/loader/nso.cpp2
-rw-r--r--src/core/memory.cpp10
-rw-r--r--src/core/memory/cheat_engine.cpp6
-rw-r--r--src/core/reporter.cpp10
-rw-r--r--src/yuzu/bootmanager.cpp2
-rw-r--r--src/yuzu/main.cpp6
-rw-r--r--src/yuzu_cmd/yuzu.cpp2
72 files changed, 315 insertions, 291 deletions
diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp
index 4fac30c7c..31cbee282 100644
--- a/src/audio_core/renderer/system.cpp
+++ b/src/audio_core/renderer/system.cpp
@@ -127,7 +127,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
127 render_device = params.rendering_device; 127 render_device = params.rendering_device;
128 execution_mode = params.execution_mode; 128 execution_mode = params.execution_mode;
129 129
130 core.Memory().ZeroBlock(*core.Kernel().CurrentProcess(), transfer_memory->GetSourceAddress(), 130 core.Memory().ZeroBlock(*core.ApplicationProcess(), transfer_memory->GetSourceAddress(),
131 transfer_memory_size); 131 transfer_memory_size);
132 132
133 // Note: We're not actually using the transfer memory because it's a pain to code for. 133 // Note: We're not actually using the transfer memory because it's a pain to code for.
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index 2fb5f9758..39a21b0f0 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -270,7 +270,7 @@ void SinkStream::Stall() {
270 if (stalled_lock) { 270 if (stalled_lock) {
271 return; 271 return;
272 } 272 }
273 stalled_lock = system.StallProcesses(); 273 stalled_lock = system.StallApplication();
274} 274}
275 275
276void SinkStream::Unstall() { 276void SinkStream::Unstall() {
@@ -278,7 +278,7 @@ void SinkStream::Unstall() {
278 if (!stalled_lock) { 278 if (!stalled_lock) {
279 return; 279 return;
280 } 280 }
281 system.UnstallProcesses(); 281 system.UnstallApplication();
282 stalled_lock.unlock(); 282 stalled_lock.unlock();
283} 283}
284 284
diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp
index 8aa7b9641..4a331d4c1 100644
--- a/src/core/arm/arm_interface.cpp
+++ b/src/core/arm/arm_interface.cpp
@@ -43,9 +43,9 @@ void ARM_Interface::SymbolicateBacktrace(Core::System& system, std::vector<Backt
43 43
44 std::map<std::string, Symbols::Symbols> symbols; 44 std::map<std::string, Symbols::Symbols> symbols;
45 for (const auto& module : modules) { 45 for (const auto& module : modules) {
46 symbols.insert_or_assign(module.second, 46 symbols.insert_or_assign(
47 Symbols::GetSymbols(module.first, system.Memory(), 47 module.second, Symbols::GetSymbols(module.first, system.Memory(),
48 system.CurrentProcess()->Is64BitProcess())); 48 system.ApplicationProcess()->Is64BitProcess()));
49 } 49 }
50 50
51 for (auto& entry : out) { 51 for (auto& entry : out) {
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 47292cd78..fb9b25d12 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -186,7 +186,7 @@ struct System::Impl {
186 void Run() { 186 void Run() {
187 std::unique_lock<std::mutex> lk(suspend_guard); 187 std::unique_lock<std::mutex> lk(suspend_guard);
188 188
189 kernel.Suspend(false); 189 kernel.SuspendApplication(false);
190 core_timing.SyncPause(false); 190 core_timing.SyncPause(false);
191 is_paused.store(false, std::memory_order_relaxed); 191 is_paused.store(false, std::memory_order_relaxed);
192 } 192 }
@@ -195,7 +195,7 @@ struct System::Impl {
195 std::unique_lock<std::mutex> lk(suspend_guard); 195 std::unique_lock<std::mutex> lk(suspend_guard);
196 196
197 core_timing.SyncPause(true); 197 core_timing.SyncPause(true);
198 kernel.Suspend(true); 198 kernel.SuspendApplication(true);
199 is_paused.store(true, std::memory_order_relaxed); 199 is_paused.store(true, std::memory_order_relaxed);
200 } 200 }
201 201
@@ -203,17 +203,17 @@ struct System::Impl {
203 return is_paused.load(std::memory_order_relaxed); 203 return is_paused.load(std::memory_order_relaxed);
204 } 204 }
205 205
206 std::unique_lock<std::mutex> StallProcesses() { 206 std::unique_lock<std::mutex> StallApplication() {
207 std::unique_lock<std::mutex> lk(suspend_guard); 207 std::unique_lock<std::mutex> lk(suspend_guard);
208 kernel.Suspend(true); 208 kernel.SuspendApplication(true);
209 core_timing.SyncPause(true); 209 core_timing.SyncPause(true);
210 return lk; 210 return lk;
211 } 211 }
212 212
213 void UnstallProcesses() { 213 void UnstallApplication() {
214 if (!IsPaused()) { 214 if (!IsPaused()) {
215 core_timing.SyncPause(false); 215 core_timing.SyncPause(false);
216 kernel.Suspend(false); 216 kernel.SuspendApplication(false);
217 } 217 }
218 } 218 }
219 219
@@ -221,7 +221,7 @@ struct System::Impl {
221 debugger = std::make_unique<Debugger>(system, port); 221 debugger = std::make_unique<Debugger>(system, port);
222 } 222 }
223 223
224 SystemResultStatus SetupForMainProcess(System& system, Frontend::EmuWindow& emu_window) { 224 SystemResultStatus SetupForApplicationProcess(System& system, Frontend::EmuWindow& emu_window) {
225 LOG_DEBUG(Core, "initialized OK"); 225 LOG_DEBUG(Core, "initialized OK");
226 226
227 // Setting changes may require a full system reinitialization (e.g., disabling multicore). 227 // Setting changes may require a full system reinitialization (e.g., disabling multicore).
@@ -273,7 +273,7 @@ struct System::Impl {
273 return SystemResultStatus::ErrorGetLoader; 273 return SystemResultStatus::ErrorGetLoader;
274 } 274 }
275 275
276 SystemResultStatus init_result{SetupForMainProcess(system, emu_window)}; 276 SystemResultStatus init_result{SetupForApplicationProcess(system, emu_window)};
277 if (init_result != SystemResultStatus::Success) { 277 if (init_result != SystemResultStatus::Success) {
278 LOG_CRITICAL(Core, "Failed to initialize system (Error {})!", 278 LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
279 static_cast<int>(init_result)); 279 static_cast<int>(init_result));
@@ -302,7 +302,7 @@ struct System::Impl {
302 static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result)); 302 static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
303 } 303 }
304 AddGlueRegistrationForProcess(*app_loader, *main_process); 304 AddGlueRegistrationForProcess(*app_loader, *main_process);
305 kernel.MakeCurrentProcess(main_process); 305 kernel.MakeApplicationProcess(main_process);
306 kernel.InitializeCores(); 306 kernel.InitializeCores();
307 307
308 // Initialize cheat engine 308 // Initialize cheat engine
@@ -585,12 +585,12 @@ void System::DetachDebugger() {
585 } 585 }
586} 586}
587 587
588std::unique_lock<std::mutex> System::StallProcesses() { 588std::unique_lock<std::mutex> System::StallApplication() {
589 return impl->StallProcesses(); 589 return impl->StallApplication();
590} 590}
591 591
592void System::UnstallProcesses() { 592void System::UnstallApplication() {
593 impl->UnstallProcesses(); 593 impl->UnstallApplication();
594} 594}
595 595
596void System::InitializeDebugger() { 596void System::InitializeDebugger() {
@@ -648,8 +648,8 @@ const Kernel::GlobalSchedulerContext& System::GlobalSchedulerContext() const {
648 return impl->kernel.GlobalSchedulerContext(); 648 return impl->kernel.GlobalSchedulerContext();
649} 649}
650 650
651Kernel::KProcess* System::CurrentProcess() { 651Kernel::KProcess* System::ApplicationProcess() {
652 return impl->kernel.CurrentProcess(); 652 return impl->kernel.ApplicationProcess();
653} 653}
654 654
655Core::DeviceMemory& System::DeviceMemory() { 655Core::DeviceMemory& System::DeviceMemory() {
@@ -660,8 +660,8 @@ const Core::DeviceMemory& System::DeviceMemory() const {
660 return *impl->device_memory; 660 return *impl->device_memory;
661} 661}
662 662
663const Kernel::KProcess* System::CurrentProcess() const { 663const Kernel::KProcess* System::ApplicationProcess() const {
664 return impl->kernel.CurrentProcess(); 664 return impl->kernel.ApplicationProcess();
665} 665}
666 666
667ARM_Interface& System::ArmInterface(std::size_t core_index) { 667ARM_Interface& System::ArmInterface(std::size_t core_index) {
@@ -760,8 +760,8 @@ const Core::SpeedLimiter& System::SpeedLimiter() const {
760 return impl->speed_limiter; 760 return impl->speed_limiter;
761} 761}
762 762
763u64 System::GetCurrentProcessProgramID() const { 763u64 System::GetApplicationProcessProgramID() const {
764 return impl->kernel.CurrentProcess()->GetProgramID(); 764 return impl->kernel.ApplicationProcess()->GetProgramID();
765} 765}
766 766
767Loader::ResultStatus System::GetGameName(std::string& out) const { 767Loader::ResultStatus System::GetGameName(std::string& out) const {
@@ -880,11 +880,11 @@ bool System::GetExitLock() const {
880 return impl->exit_lock; 880 return impl->exit_lock;
881} 881}
882 882
883void System::SetCurrentProcessBuildID(const CurrentBuildProcessID& id) { 883void System::SetApplicationProcessBuildID(const CurrentBuildProcessID& id) {
884 impl->build_id = id; 884 impl->build_id = id;
885} 885}
886 886
887const System::CurrentBuildProcessID& System::GetCurrentProcessBuildID() const { 887const System::CurrentBuildProcessID& System::GetApplicationProcessBuildID() const {
888 return impl->build_id; 888 return impl->build_id;
889} 889}
890 890
diff --git a/src/core/core.h b/src/core/core.h
index fb5cda2f5..0042ac170 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -184,8 +184,8 @@ public:
184 /// Forcibly detach the debugger if it is running. 184 /// Forcibly detach the debugger if it is running.
185 void DetachDebugger(); 185 void DetachDebugger();
186 186
187 std::unique_lock<std::mutex> StallProcesses(); 187 std::unique_lock<std::mutex> StallApplication();
188 void UnstallProcesses(); 188 void UnstallApplication();
189 189
190 /** 190 /**
191 * Initialize the debugger. 191 * Initialize the debugger.
@@ -295,11 +295,11 @@ public:
295 /// Gets the manager for the guest device memory 295 /// Gets the manager for the guest device memory
296 [[nodiscard]] const Core::DeviceMemory& DeviceMemory() const; 296 [[nodiscard]] const Core::DeviceMemory& DeviceMemory() const;
297 297
298 /// Provides a pointer to the current process 298 /// Provides a pointer to the application process
299 [[nodiscard]] Kernel::KProcess* CurrentProcess(); 299 [[nodiscard]] Kernel::KProcess* ApplicationProcess();
300 300
301 /// Provides a constant pointer to the current process. 301 /// Provides a constant pointer to the application process.
302 [[nodiscard]] const Kernel::KProcess* CurrentProcess() const; 302 [[nodiscard]] const Kernel::KProcess* ApplicationProcess() const;
303 303
304 /// Provides a reference to the core timing instance. 304 /// Provides a reference to the core timing instance.
305 [[nodiscard]] Timing::CoreTiming& CoreTiming(); 305 [[nodiscard]] Timing::CoreTiming& CoreTiming();
@@ -331,7 +331,7 @@ public:
331 /// Provides a constant reference to the speed limiter 331 /// Provides a constant reference to the speed limiter
332 [[nodiscard]] const Core::SpeedLimiter& SpeedLimiter() const; 332 [[nodiscard]] const Core::SpeedLimiter& SpeedLimiter() const;
333 333
334 [[nodiscard]] u64 GetCurrentProcessProgramID() const; 334 [[nodiscard]] u64 GetApplicationProcessProgramID() const;
335 335
336 /// Gets the name of the current game 336 /// Gets the name of the current game
337 [[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const; 337 [[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const;
@@ -396,8 +396,8 @@ public:
396 void SetExitLock(bool locked); 396 void SetExitLock(bool locked);
397 [[nodiscard]] bool GetExitLock() const; 397 [[nodiscard]] bool GetExitLock() const;
398 398
399 void SetCurrentProcessBuildID(const CurrentBuildProcessID& id); 399 void SetApplicationProcessBuildID(const CurrentBuildProcessID& id);
400 [[nodiscard]] const CurrentBuildProcessID& GetCurrentProcessBuildID() const; 400 [[nodiscard]] const CurrentBuildProcessID& GetApplicationProcessBuildID() const;
401 401
402 /// Register a host thread as an emulated CPU Core. 402 /// Register a host thread as an emulated CPU Core.
403 void RegisterCoreThread(std::size_t id); 403 void RegisterCoreThread(std::size_t id);
diff --git a/src/core/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp
index 9c02b7b31..945ec528e 100644
--- a/src/core/debugger/gdbstub.cpp
+++ b/src/core/debugger/gdbstub.cpp
@@ -96,7 +96,7 @@ static std::string EscapeXML(std::string_view data) {
96 96
97GDBStub::GDBStub(DebuggerBackend& backend_, Core::System& system_) 97GDBStub::GDBStub(DebuggerBackend& backend_, Core::System& system_)
98 : DebuggerFrontend(backend_), system{system_} { 98 : DebuggerFrontend(backend_), system{system_} {
99 if (system.CurrentProcess()->Is64BitProcess()) { 99 if (system.ApplicationProcess()->Is64BitProcess()) {
100 arch = std::make_unique<GDBStubA64>(); 100 arch = std::make_unique<GDBStubA64>();
101 } else { 101 } else {
102 arch = std::make_unique<GDBStubA32>(); 102 arch = std::make_unique<GDBStubA32>();
@@ -340,15 +340,15 @@ void GDBStub::HandleBreakpointInsert(std::string_view command) {
340 success = true; 340 success = true;
341 break; 341 break;
342 case BreakpointType::WriteWatch: 342 case BreakpointType::WriteWatch:
343 success = system.CurrentProcess()->InsertWatchpoint(system, addr, size, 343 success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size,
344 Kernel::DebugWatchpointType::Write); 344 Kernel::DebugWatchpointType::Write);
345 break; 345 break;
346 case BreakpointType::ReadWatch: 346 case BreakpointType::ReadWatch:
347 success = system.CurrentProcess()->InsertWatchpoint(system, addr, size, 347 success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size,
348 Kernel::DebugWatchpointType::Read); 348 Kernel::DebugWatchpointType::Read);
349 break; 349 break;
350 case BreakpointType::AccessWatch: 350 case BreakpointType::AccessWatch:
351 success = system.CurrentProcess()->InsertWatchpoint( 351 success = system.ApplicationProcess()->InsertWatchpoint(
352 system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite); 352 system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
353 break; 353 break;
354 case BreakpointType::Hardware: 354 case BreakpointType::Hardware:
@@ -391,15 +391,15 @@ void GDBStub::HandleBreakpointRemove(std::string_view command) {
391 break; 391 break;
392 } 392 }
393 case BreakpointType::WriteWatch: 393 case BreakpointType::WriteWatch:
394 success = system.CurrentProcess()->RemoveWatchpoint(system, addr, size, 394 success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size,
395 Kernel::DebugWatchpointType::Write); 395 Kernel::DebugWatchpointType::Write);
396 break; 396 break;
397 case BreakpointType::ReadWatch: 397 case BreakpointType::ReadWatch:
398 success = system.CurrentProcess()->RemoveWatchpoint(system, addr, size, 398 success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size,
399 Kernel::DebugWatchpointType::Read); 399 Kernel::DebugWatchpointType::Read);
400 break; 400 break;
401 case BreakpointType::AccessWatch: 401 case BreakpointType::AccessWatch:
402 success = system.CurrentProcess()->RemoveWatchpoint( 402 success = system.ApplicationProcess()->RemoveWatchpoint(
403 system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite); 403 system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
404 break; 404 break;
405 case BreakpointType::Hardware: 405 case BreakpointType::Hardware:
@@ -482,7 +482,7 @@ static std::optional<std::string> GetNameFromThreadType64(Core::Memory::Memory&
482 482
483static std::optional<std::string> GetThreadName(Core::System& system, 483static std::optional<std::string> GetThreadName(Core::System& system,
484 const Kernel::KThread* thread) { 484 const Kernel::KThread* thread) {
485 if (system.CurrentProcess()->Is64BitProcess()) { 485 if (system.ApplicationProcess()->Is64BitProcess()) {
486 return GetNameFromThreadType64(system.Memory(), thread); 486 return GetNameFromThreadType64(system.Memory(), thread);
487 } else { 487 } else {
488 return GetNameFromThreadType32(system.Memory(), thread); 488 return GetNameFromThreadType32(system.Memory(), thread);
@@ -555,7 +555,7 @@ void GDBStub::HandleQuery(std::string_view command) {
555 SendReply(fmt::format("TextSeg={:x}", main->first)); 555 SendReply(fmt::format("TextSeg={:x}", main->first));
556 } else { 556 } else {
557 SendReply(fmt::format("TextSeg={:x}", 557 SendReply(fmt::format("TextSeg={:x}",
558 system.CurrentProcess()->PageTable().GetCodeRegionStart())); 558 system.ApplicationProcess()->PageTable().GetCodeRegionStart()));
559 } 559 }
560 } else if (command.starts_with("Xfer:libraries:read::")) { 560 } else if (command.starts_with("Xfer:libraries:read::")) {
561 Loader::AppLoader::Modules modules; 561 Loader::AppLoader::Modules modules;
@@ -729,7 +729,7 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
729 std::string_view command_str{reinterpret_cast<const char*>(&command[0]), command.size()}; 729 std::string_view command_str{reinterpret_cast<const char*>(&command[0]), command.size()};
730 std::string reply; 730 std::string reply;
731 731
732 auto* process = system.CurrentProcess(); 732 auto* process = system.ApplicationProcess();
733 auto& page_table = process->PageTable(); 733 auto& page_table = process->PageTable();
734 734
735 const char* commands = "Commands:\n" 735 const char* commands = "Commands:\n"
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp
index 1567da231..769065b6f 100644
--- a/src/core/file_sys/savedata_factory.cpp
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -172,7 +172,7 @@ std::string SaveDataFactory::GetFullPath(Core::System& system, VirtualDir dir,
172 // be interpreted as the title id of the current process. 172 // be interpreted as the title id of the current process.
173 if (type == SaveDataType::SaveData || type == SaveDataType::DeviceSaveData) { 173 if (type == SaveDataType::SaveData || type == SaveDataType::DeviceSaveData) {
174 if (title_id == 0) { 174 if (title_id == 0) {
175 title_id = system.GetCurrentProcessProgramID(); 175 title_id = system.GetApplicationProcessProgramID();
176 } 176 }
177 } 177 }
178 178
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index a86bec252..38d6cfaff 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -148,7 +148,7 @@ public:
148 if (context->GetManager()->IsDomain()) { 148 if (context->GetManager()->IsDomain()) {
149 context->AddDomainObject(std::move(iface)); 149 context->AddDomainObject(std::move(iface));
150 } else { 150 } else {
151 kernel.CurrentProcess()->GetResourceLimit()->Reserve( 151 kernel.ApplicationProcess()->GetResourceLimit()->Reserve(
152 Kernel::LimitableResource::SessionCountMax, 1); 152 Kernel::LimitableResource::SessionCountMax, 1);
153 153
154 auto* session = Kernel::KSession::Create(kernel); 154 auto* session = Kernel::KSession::Create(kernel);
diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp
index 2ec623a58..c72a91a76 100644
--- a/src/core/hle/kernel/k_client_port.cpp
+++ b/src/core/hle/kernel/k_client_port.cpp
@@ -60,7 +60,8 @@ bool KClientPort::IsSignaled() const {
60 60
61Result KClientPort::CreateSession(KClientSession** out) { 61Result KClientPort::CreateSession(KClientSession** out) {
62 // Reserve a new session from the resource limit. 62 // Reserve a new session from the resource limit.
63 KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(), 63 //! FIXME: we are reserving this from the wrong resource limit!
64 KScopedResourceReservation session_reservation(kernel.ApplicationProcess()->GetResourceLimit(),
64 LimitableResource::SessionCountMax); 65 LimitableResource::SessionCountMax);
65 R_UNLESS(session_reservation.Succeeded(), ResultLimitReached); 66 R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
66 67
diff --git a/src/core/hle/kernel/k_code_memory.cpp b/src/core/hle/kernel/k_code_memory.cpp
index 884eba001..6c44a9e99 100644
--- a/src/core/hle/kernel/k_code_memory.cpp
+++ b/src/core/hle/kernel/k_code_memory.cpp
@@ -21,7 +21,7 @@ KCodeMemory::KCodeMemory(KernelCore& kernel_)
21 21
22Result KCodeMemory::Initialize(Core::DeviceMemory& device_memory, VAddr addr, size_t size) { 22Result KCodeMemory::Initialize(Core::DeviceMemory& device_memory, VAddr addr, size_t size) {
23 // Set members. 23 // Set members.
24 m_owner = kernel.CurrentProcess(); 24 m_owner = GetCurrentProcessPointer(kernel);
25 25
26 // Get the owner page table. 26 // Get the owner page table.
27 auto& page_table = m_owner->PageTable(); 27 auto& page_table = m_owner->PageTable();
@@ -74,7 +74,7 @@ Result KCodeMemory::Map(VAddr address, size_t size) {
74 R_UNLESS(!m_is_mapped, ResultInvalidState); 74 R_UNLESS(!m_is_mapped, ResultInvalidState);
75 75
76 // Map the memory. 76 // Map the memory.
77 R_TRY(kernel.CurrentProcess()->PageTable().MapPageGroup( 77 R_TRY(GetCurrentProcess(kernel).PageTable().MapPageGroup(
78 address, *m_page_group, KMemoryState::CodeOut, KMemoryPermission::UserReadWrite)); 78 address, *m_page_group, KMemoryState::CodeOut, KMemoryPermission::UserReadWrite));
79 79
80 // Mark ourselves as mapped. 80 // Mark ourselves as mapped.
@@ -91,8 +91,8 @@ Result KCodeMemory::Unmap(VAddr address, size_t size) {
91 KScopedLightLock lk(m_lock); 91 KScopedLightLock lk(m_lock);
92 92
93 // Unmap the memory. 93 // Unmap the memory.
94 R_TRY(kernel.CurrentProcess()->PageTable().UnmapPageGroup(address, *m_page_group, 94 R_TRY(GetCurrentProcess(kernel).PageTable().UnmapPageGroup(address, *m_page_group,
95 KMemoryState::CodeOut)); 95 KMemoryState::CodeOut));
96 96
97 // Mark ourselves as unmapped. 97 // Mark ourselves as unmapped.
98 m_is_mapped = false; 98 m_is_mapped = false;
diff --git a/src/core/hle/kernel/k_condition_variable.cpp b/src/core/hle/kernel/k_condition_variable.cpp
index 0c6b20db3..3f0be1c3f 100644
--- a/src/core/hle/kernel/k_condition_variable.cpp
+++ b/src/core/hle/kernel/k_condition_variable.cpp
@@ -164,8 +164,8 @@ Result KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 value)
164 R_SUCCEED_IF(test_tag != (handle | Svc::HandleWaitMask)); 164 R_SUCCEED_IF(test_tag != (handle | Svc::HandleWaitMask));
165 165
166 // Get the lock owner thread. 166 // Get the lock owner thread.
167 owner_thread = kernel.CurrentProcess() 167 owner_thread = GetCurrentProcess(kernel)
168 ->GetHandleTable() 168 .GetHandleTable()
169 .GetObjectWithoutPseudoHandle<KThread>(handle) 169 .GetObjectWithoutPseudoHandle<KThread>(handle)
170 .ReleasePointerUnsafe(); 170 .ReleasePointerUnsafe();
171 R_UNLESS(owner_thread != nullptr, ResultInvalidHandle); 171 R_UNLESS(owner_thread != nullptr, ResultInvalidHandle);
@@ -213,8 +213,8 @@ void KConditionVariable::SignalImpl(KThread* thread) {
213 thread->EndWait(ResultSuccess); 213 thread->EndWait(ResultSuccess);
214 } else { 214 } else {
215 // Get the previous owner. 215 // Get the previous owner.
216 KThread* owner_thread = kernel.CurrentProcess() 216 KThread* owner_thread = GetCurrentProcess(kernel)
217 ->GetHandleTable() 217 .GetHandleTable()
218 .GetObjectWithoutPseudoHandle<KThread>( 218 .GetObjectWithoutPseudoHandle<KThread>(
219 static_cast<Handle>(prev_tag & ~Svc::HandleWaitMask)) 219 static_cast<Handle>(prev_tag & ~Svc::HandleWaitMask))
220 .ReleasePointerUnsafe(); 220 .ReleasePointerUnsafe();
diff --git a/src/core/hle/kernel/k_handle_table.h b/src/core/hle/kernel/k_handle_table.h
index 37a24e7d9..d7660630c 100644
--- a/src/core/hle/kernel/k_handle_table.h
+++ b/src/core/hle/kernel/k_handle_table.h
@@ -90,7 +90,8 @@ public:
90 // Handle pseudo-handles. 90 // Handle pseudo-handles.
91 if constexpr (std::derived_from<KProcess, T>) { 91 if constexpr (std::derived_from<KProcess, T>) {
92 if (handle == Svc::PseudoHandle::CurrentProcess) { 92 if (handle == Svc::PseudoHandle::CurrentProcess) {
93 auto* const cur_process = m_kernel.CurrentProcess(); 93 //! FIXME: this is the wrong process!
94 auto* const cur_process = m_kernel.ApplicationProcess();
94 ASSERT(cur_process != nullptr); 95 ASSERT(cur_process != nullptr);
95 return cur_process; 96 return cur_process;
96 } 97 }
diff --git a/src/core/hle/kernel/k_interrupt_manager.cpp b/src/core/hle/kernel/k_interrupt_manager.cpp
index 4a6b60d26..fe6a20168 100644
--- a/src/core/hle/kernel/k_interrupt_manager.cpp
+++ b/src/core/hle/kernel/k_interrupt_manager.cpp
@@ -16,7 +16,7 @@ void HandleInterrupt(KernelCore& kernel, s32 core_id) {
16 16
17 auto& current_thread = GetCurrentThread(kernel); 17 auto& current_thread = GetCurrentThread(kernel);
18 18
19 if (auto* process = kernel.CurrentProcess(); process) { 19 if (auto* process = GetCurrentProcessPointer(kernel); process) {
20 // If the user disable count is set, we may need to pin the current thread. 20 // If the user disable count is set, we may need to pin the current thread.
21 if (current_thread.GetUserDisableCount() && !process->GetPinnedThread(core_id)) { 21 if (current_thread.GetUserDisableCount() && !process->GetPinnedThread(core_id)) {
22 KScopedSchedulerLock sl{kernel}; 22 KScopedSchedulerLock sl{kernel};
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp
index d6676904b..d6c214237 100644
--- a/src/core/hle/kernel/k_scheduler.cpp
+++ b/src/core/hle/kernel/k_scheduler.cpp
@@ -328,7 +328,7 @@ u64 KScheduler::UpdateHighestPriorityThreadsImpl(KernelCore& kernel) {
328} 328}
329 329
330void KScheduler::SwitchThread(KThread* next_thread) { 330void KScheduler::SwitchThread(KThread* next_thread) {
331 KProcess* const cur_process = kernel.CurrentProcess(); 331 KProcess* const cur_process = GetCurrentProcessPointer(kernel);
332 KThread* const cur_thread = GetCurrentThreadPointer(kernel); 332 KThread* const cur_thread = GetCurrentThreadPointer(kernel);
333 333
334 // We never want to schedule a null thread, so use the idle thread if we don't have a next. 334 // We never want to schedule a null thread, so use the idle thread if we don't have a next.
@@ -689,11 +689,11 @@ void KScheduler::RotateScheduledQueue(KernelCore& kernel, s32 core_id, s32 prior
689void KScheduler::YieldWithoutCoreMigration(KernelCore& kernel) { 689void KScheduler::YieldWithoutCoreMigration(KernelCore& kernel) {
690 // Validate preconditions. 690 // Validate preconditions.
691 ASSERT(CanSchedule(kernel)); 691 ASSERT(CanSchedule(kernel));
692 ASSERT(kernel.CurrentProcess() != nullptr); 692 ASSERT(GetCurrentProcessPointer(kernel) != nullptr);
693 693
694 // Get the current thread and process. 694 // Get the current thread and process.
695 KThread& cur_thread = GetCurrentThread(kernel); 695 KThread& cur_thread = GetCurrentThread(kernel);
696 KProcess& cur_process = *kernel.CurrentProcess(); 696 KProcess& cur_process = GetCurrentProcess(kernel);
697 697
698 // If the thread's yield count matches, there's nothing for us to do. 698 // If the thread's yield count matches, there's nothing for us to do.
699 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { 699 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
@@ -728,11 +728,11 @@ void KScheduler::YieldWithoutCoreMigration(KernelCore& kernel) {
728void KScheduler::YieldWithCoreMigration(KernelCore& kernel) { 728void KScheduler::YieldWithCoreMigration(KernelCore& kernel) {
729 // Validate preconditions. 729 // Validate preconditions.
730 ASSERT(CanSchedule(kernel)); 730 ASSERT(CanSchedule(kernel));
731 ASSERT(kernel.CurrentProcess() != nullptr); 731 ASSERT(GetCurrentProcessPointer(kernel) != nullptr);
732 732
733 // Get the current thread and process. 733 // Get the current thread and process.
734 KThread& cur_thread = GetCurrentThread(kernel); 734 KThread& cur_thread = GetCurrentThread(kernel);
735 KProcess& cur_process = *kernel.CurrentProcess(); 735 KProcess& cur_process = GetCurrentProcess(kernel);
736 736
737 // If the thread's yield count matches, there's nothing for us to do. 737 // If the thread's yield count matches, there's nothing for us to do.
738 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { 738 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
@@ -816,11 +816,11 @@ void KScheduler::YieldWithCoreMigration(KernelCore& kernel) {
816void KScheduler::YieldToAnyThread(KernelCore& kernel) { 816void KScheduler::YieldToAnyThread(KernelCore& kernel) {
817 // Validate preconditions. 817 // Validate preconditions.
818 ASSERT(CanSchedule(kernel)); 818 ASSERT(CanSchedule(kernel));
819 ASSERT(kernel.CurrentProcess() != nullptr); 819 ASSERT(GetCurrentProcessPointer(kernel) != nullptr);
820 820
821 // Get the current thread and process. 821 // Get the current thread and process.
822 KThread& cur_thread = GetCurrentThread(kernel); 822 KThread& cur_thread = GetCurrentThread(kernel);
823 KProcess& cur_process = *kernel.CurrentProcess(); 823 KProcess& cur_process = GetCurrentProcess(kernel);
824 824
825 // If the thread's yield count matches, there's nothing for us to do. 825 // If the thread's yield count matches, there's nothing for us to do.
826 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { 826 if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
diff --git a/src/core/hle/kernel/k_session.cpp b/src/core/hle/kernel/k_session.cpp
index b6f6fe9d9..7e677c028 100644
--- a/src/core/hle/kernel/k_session.cpp
+++ b/src/core/hle/kernel/k_session.cpp
@@ -33,7 +33,8 @@ void KSession::Initialize(KClientPort* port_, const std::string& name_) {
33 name = name_; 33 name = name_;
34 34
35 // Set our owner process. 35 // Set our owner process.
36 process = kernel.CurrentProcess(); 36 //! FIXME: this is the wrong process!
37 process = kernel.ApplicationProcess();
37 process->Open(); 38 process->Open();
38 39
39 // Set our port. 40 // Set our port.
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index 84ff3c64b..2d3da9d66 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -1266,6 +1266,14 @@ KThread& GetCurrentThread(KernelCore& kernel) {
1266 return *GetCurrentThreadPointer(kernel); 1266 return *GetCurrentThreadPointer(kernel);
1267} 1267}
1268 1268
1269KProcess* GetCurrentProcessPointer(KernelCore& kernel) {
1270 return GetCurrentThread(kernel).GetOwnerProcess();
1271}
1272
1273KProcess& GetCurrentProcess(KernelCore& kernel) {
1274 return *GetCurrentProcessPointer(kernel);
1275}
1276
1269s32 GetCurrentCoreId(KernelCore& kernel) { 1277s32 GetCurrentCoreId(KernelCore& kernel) {
1270 return GetCurrentThread(kernel).GetCurrentCore(); 1278 return GetCurrentThread(kernel).GetCurrentCore();
1271} 1279}
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h
index 8b8dc51be..ca82ce3b6 100644
--- a/src/core/hle/kernel/k_thread.h
+++ b/src/core/hle/kernel/k_thread.h
@@ -110,6 +110,8 @@ enum class StepState : u32 {
110void SetCurrentThread(KernelCore& kernel, KThread* thread); 110void SetCurrentThread(KernelCore& kernel, KThread* thread);
111[[nodiscard]] KThread* GetCurrentThreadPointer(KernelCore& kernel); 111[[nodiscard]] KThread* GetCurrentThreadPointer(KernelCore& kernel);
112[[nodiscard]] KThread& GetCurrentThread(KernelCore& kernel); 112[[nodiscard]] KThread& GetCurrentThread(KernelCore& kernel);
113[[nodiscard]] KProcess* GetCurrentProcessPointer(KernelCore& kernel);
114[[nodiscard]] KProcess& GetCurrentProcess(KernelCore& kernel);
113[[nodiscard]] s32 GetCurrentCoreId(KernelCore& kernel); 115[[nodiscard]] s32 GetCurrentCoreId(KernelCore& kernel);
114 116
115class KThread final : public KAutoObjectWithSlabHeapAndContainer<KThread, KWorkerTask>, 117class KThread final : public KAutoObjectWithSlabHeapAndContainer<KThread, KWorkerTask>,
diff --git a/src/core/hle/kernel/k_transfer_memory.cpp b/src/core/hle/kernel/k_transfer_memory.cpp
index 9f34c2d46..faa5c73b5 100644
--- a/src/core/hle/kernel/k_transfer_memory.cpp
+++ b/src/core/hle/kernel/k_transfer_memory.cpp
@@ -16,7 +16,7 @@ KTransferMemory::~KTransferMemory() = default;
16Result KTransferMemory::Initialize(VAddr address_, std::size_t size_, 16Result KTransferMemory::Initialize(VAddr address_, std::size_t size_,
17 Svc::MemoryPermission owner_perm_) { 17 Svc::MemoryPermission owner_perm_) {
18 // Set members. 18 // Set members.
19 owner = kernel.CurrentProcess(); 19 owner = GetCurrentProcessPointer(kernel);
20 20
21 // TODO(bunnei): Lock for transfer memory 21 // TODO(bunnei): Lock for transfer memory
22 22
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 5b72eaaa1..b1922659d 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -102,13 +102,13 @@ struct KernelCore::Impl {
102 102
103 void InitializeCores() { 103 void InitializeCores() {
104 for (u32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) { 104 for (u32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) {
105 cores[core_id]->Initialize((*current_process).Is64BitProcess()); 105 cores[core_id]->Initialize((*application_process).Is64BitProcess());
106 system.Memory().SetCurrentPageTable(*current_process, core_id); 106 system.Memory().SetCurrentPageTable(*application_process, core_id);
107 } 107 }
108 } 108 }
109 109
110 void CloseCurrentProcess() { 110 void CloseApplicationProcess() {
111 KProcess* old_process = current_process.exchange(nullptr); 111 KProcess* old_process = application_process.exchange(nullptr);
112 if (old_process == nullptr) { 112 if (old_process == nullptr) {
113 return; 113 return;
114 } 114 }
@@ -182,7 +182,7 @@ struct KernelCore::Impl {
182 } 182 }
183 } 183 }
184 184
185 CloseCurrentProcess(); 185 CloseApplicationProcess();
186 186
187 // Track kernel objects that were not freed on shutdown 187 // Track kernel objects that were not freed on shutdown
188 { 188 {
@@ -363,8 +363,8 @@ struct KernelCore::Impl {
363 } 363 }
364 } 364 }
365 365
366 void MakeCurrentProcess(KProcess* process) { 366 void MakeApplicationProcess(KProcess* process) {
367 current_process = process; 367 application_process = process;
368 } 368 }
369 369
370 static inline thread_local u32 host_thread_id = UINT32_MAX; 370 static inline thread_local u32 host_thread_id = UINT32_MAX;
@@ -821,7 +821,7 @@ struct KernelCore::Impl {
821 821
822 // Lists all processes that exist in the current session. 822 // Lists all processes that exist in the current session.
823 std::vector<KProcess*> process_list; 823 std::vector<KProcess*> process_list;
824 std::atomic<KProcess*> current_process{}; 824 std::atomic<KProcess*> application_process{};
825 std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context; 825 std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context;
826 std::unique_ptr<Kernel::KHardwareTimer> hardware_timer; 826 std::unique_ptr<Kernel::KHardwareTimer> hardware_timer;
827 827
@@ -941,20 +941,20 @@ void KernelCore::AppendNewProcess(KProcess* process) {
941 impl->process_list.push_back(process); 941 impl->process_list.push_back(process);
942} 942}
943 943
944void KernelCore::MakeCurrentProcess(KProcess* process) { 944void KernelCore::MakeApplicationProcess(KProcess* process) {
945 impl->MakeCurrentProcess(process); 945 impl->MakeApplicationProcess(process);
946} 946}
947 947
948KProcess* KernelCore::CurrentProcess() { 948KProcess* KernelCore::ApplicationProcess() {
949 return impl->current_process; 949 return impl->application_process;
950} 950}
951 951
952const KProcess* KernelCore::CurrentProcess() const { 952const KProcess* KernelCore::ApplicationProcess() const {
953 return impl->current_process; 953 return impl->application_process;
954} 954}
955 955
956void KernelCore::CloseCurrentProcess() { 956void KernelCore::CloseApplicationProcess() {
957 impl->CloseCurrentProcess(); 957 impl->CloseApplicationProcess();
958} 958}
959 959
960const std::vector<KProcess*>& KernelCore::GetProcessList() const { 960const std::vector<KProcess*>& KernelCore::GetProcessList() const {
@@ -1202,12 +1202,12 @@ const Kernel::KSharedMemory& KernelCore::GetHidBusSharedMem() const {
1202 return *impl->hidbus_shared_mem; 1202 return *impl->hidbus_shared_mem;
1203} 1203}
1204 1204
1205void KernelCore::Suspend(bool suspended) { 1205void KernelCore::SuspendApplication(bool suspended) {
1206 const bool should_suspend{exception_exited || suspended}; 1206 const bool should_suspend{exception_exited || suspended};
1207 const auto activity = should_suspend ? ProcessActivity::Paused : ProcessActivity::Runnable; 1207 const auto activity = should_suspend ? ProcessActivity::Paused : ProcessActivity::Runnable;
1208 1208
1209 //! This refers to the application process, not the current process. 1209 // Get the application process.
1210 KScopedAutoObject<KProcess> process = CurrentProcess(); 1210 KScopedAutoObject<KProcess> process = ApplicationProcess();
1211 if (process.IsNull()) { 1211 if (process.IsNull()) {
1212 return; 1212 return;
1213 } 1213 }
@@ -1218,8 +1218,8 @@ void KernelCore::Suspend(bool suspended) {
1218 // Wait for process execution to stop. 1218 // Wait for process execution to stop.
1219 bool must_wait{should_suspend}; 1219 bool must_wait{should_suspend};
1220 1220
1221 // KernelCore::Suspend must be called from locked context, or we 1221 // KernelCore::SuspendApplication must be called from locked context,
1222 // could race another call to SetActivity, interfering with waiting. 1222 // or we could race another call to SetActivity, interfering with waiting.
1223 while (must_wait) { 1223 while (must_wait) {
1224 KScopedSchedulerLock sl{*this}; 1224 KScopedSchedulerLock sl{*this};
1225 1225
@@ -1253,9 +1253,9 @@ bool KernelCore::IsShuttingDown() const {
1253 return impl->IsShuttingDown(); 1253 return impl->IsShuttingDown();
1254} 1254}
1255 1255
1256void KernelCore::ExceptionalExit() { 1256void KernelCore::ExceptionalExitApplication() {
1257 exception_exited = true; 1257 exception_exited = true;
1258 Suspend(true); 1258 SuspendApplication(true);
1259} 1259}
1260 1260
1261void KernelCore::EnterSVCProfile() { 1261void KernelCore::EnterSVCProfile() {
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index af0ae0e98..a236e6b42 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -131,17 +131,17 @@ public:
131 /// Adds the given shared pointer to an internal list of active processes. 131 /// Adds the given shared pointer to an internal list of active processes.
132 void AppendNewProcess(KProcess* process); 132 void AppendNewProcess(KProcess* process);
133 133
134 /// Makes the given process the new current process. 134 /// Makes the given process the new application process.
135 void MakeCurrentProcess(KProcess* process); 135 void MakeApplicationProcess(KProcess* process);
136 136
137 /// Retrieves a pointer to the current process. 137 /// Retrieves a pointer to the application process.
138 KProcess* CurrentProcess(); 138 KProcess* ApplicationProcess();
139 139
140 /// Retrieves a const pointer to the current process. 140 /// Retrieves a const pointer to the application process.
141 const KProcess* CurrentProcess() const; 141 const KProcess* ApplicationProcess() const;
142 142
143 /// Closes the current process. 143 /// Closes the application process.
144 void CloseCurrentProcess(); 144 void CloseApplicationProcess();
145 145
146 /// Retrieves the list of processes. 146 /// Retrieves the list of processes.
147 const std::vector<KProcess*>& GetProcessList() const; 147 const std::vector<KProcess*>& GetProcessList() const;
@@ -288,11 +288,11 @@ public:
288 /// Gets the shared memory object for HIDBus services. 288 /// Gets the shared memory object for HIDBus services.
289 const Kernel::KSharedMemory& GetHidBusSharedMem() const; 289 const Kernel::KSharedMemory& GetHidBusSharedMem() const;
290 290
291 /// Suspend/unsuspend all processes. 291 /// Suspend/unsuspend application process.
292 void Suspend(bool suspend); 292 void SuspendApplication(bool suspend);
293 293
294 /// Exceptional exit all processes. 294 /// Exceptional exit application process.
295 void ExceptionalExit(); 295 void ExceptionalExitApplication();
296 296
297 /// Notify emulated CPU cores to shut down. 297 /// Notify emulated CPU cores to shut down.
298 void ShutdownCores(); 298 void ShutdownCores();
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 4ef57356e..1072da8cc 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -4426,7 +4426,7 @@ void Call(Core::System& system, u32 imm) {
4426 auto& kernel = system.Kernel(); 4426 auto& kernel = system.Kernel();
4427 kernel.EnterSVCProfile(); 4427 kernel.EnterSVCProfile();
4428 4428
4429 if (system.CurrentProcess()->Is64BitProcess()) { 4429 if (GetCurrentProcess(system.Kernel()).Is64BitProcess()) {
4430 Call64(system, imm); 4430 Call64(system, imm);
4431 } else { 4431 } else {
4432 Call32(system, imm); 4432 Call32(system, imm);
diff --git a/src/core/hle/kernel/svc/svc_activity.cpp b/src/core/hle/kernel/svc/svc_activity.cpp
index baafefaeb..63bc08555 100644
--- a/src/core/hle/kernel/svc/svc_activity.cpp
+++ b/src/core/hle/kernel/svc/svc_activity.cpp
@@ -23,11 +23,12 @@ Result SetThreadActivity(Core::System& system, Handle thread_handle,
23 23
24 // Get the thread from its handle. 24 // Get the thread from its handle.
25 KScopedAutoObject thread = 25 KScopedAutoObject thread =
26 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle); 26 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
27 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); 27 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
28 28
29 // Check that the activity is being set on a non-current thread for the current process. 29 // Check that the activity is being set on a non-current thread for the current process.
30 R_UNLESS(thread->GetOwnerProcess() == system.Kernel().CurrentProcess(), ResultInvalidHandle); 30 R_UNLESS(thread->GetOwnerProcess() == GetCurrentProcessPointer(system.Kernel()),
31 ResultInvalidHandle);
31 R_UNLESS(thread.GetPointerUnsafe() != GetCurrentThreadPointer(system.Kernel()), ResultBusy); 32 R_UNLESS(thread.GetPointerUnsafe() != GetCurrentThreadPointer(system.Kernel()), ResultBusy);
32 33
33 // Set the activity. 34 // Set the activity.
diff --git a/src/core/hle/kernel/svc/svc_address_arbiter.cpp b/src/core/hle/kernel/svc/svc_address_arbiter.cpp
index e6a5d2ae5..998bd3f22 100644
--- a/src/core/hle/kernel/svc/svc_address_arbiter.cpp
+++ b/src/core/hle/kernel/svc/svc_address_arbiter.cpp
@@ -72,7 +72,7 @@ Result WaitForAddress(Core::System& system, VAddr address, ArbitrationType arb_t
72 timeout = timeout_ns; 72 timeout = timeout_ns;
73 } 73 }
74 74
75 return system.Kernel().CurrentProcess()->WaitAddressArbiter(address, arb_type, value, timeout); 75 return GetCurrentProcess(system.Kernel()).WaitAddressArbiter(address, arb_type, value, timeout);
76} 76}
77 77
78// Signals to an address (via Address Arbiter) 78// Signals to an address (via Address Arbiter)
@@ -95,8 +95,8 @@ Result SignalToAddress(Core::System& system, VAddr address, SignalType signal_ty
95 return ResultInvalidEnumValue; 95 return ResultInvalidEnumValue;
96 } 96 }
97 97
98 return system.Kernel().CurrentProcess()->SignalAddressArbiter(address, signal_type, value, 98 return GetCurrentProcess(system.Kernel())
99 count); 99 .SignalAddressArbiter(address, signal_type, value, count);
100} 100}
101 101
102Result WaitForAddress64(Core::System& system, VAddr address, ArbitrationType arb_type, s32 value, 102Result WaitForAddress64(Core::System& system, VAddr address, ArbitrationType arb_type, s32 value,
diff --git a/src/core/hle/kernel/svc/svc_cache.cpp b/src/core/hle/kernel/svc/svc_cache.cpp
index b5404760e..598b71da5 100644
--- a/src/core/hle/kernel/svc/svc_cache.cpp
+++ b/src/core/hle/kernel/svc/svc_cache.cpp
@@ -38,7 +38,7 @@ Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 ad
38 38
39 // Get the process from its handle. 39 // Get the process from its handle.
40 KScopedAutoObject process = 40 KScopedAutoObject process =
41 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle); 41 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
42 R_UNLESS(process.IsNotNull(), ResultInvalidHandle); 42 R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
43 43
44 // Verify the region is within range. 44 // Verify the region is within range.
diff --git a/src/core/hle/kernel/svc/svc_code_memory.cpp b/src/core/hle/kernel/svc/svc_code_memory.cpp
index ec256b757..538ff1c71 100644
--- a/src/core/hle/kernel/svc/svc_code_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_code_memory.cpp
@@ -46,7 +46,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t
46 R_UNLESS(code_mem != nullptr, ResultOutOfResource); 46 R_UNLESS(code_mem != nullptr, ResultOutOfResource);
47 47
48 // Verify that the region is in range. 48 // Verify that the region is in range.
49 R_UNLESS(system.CurrentProcess()->PageTable().Contains(address, size), 49 R_UNLESS(GetCurrentProcess(system.Kernel()).PageTable().Contains(address, size),
50 ResultInvalidCurrentMemory); 50 ResultInvalidCurrentMemory);
51 51
52 // Initialize the code memory. 52 // Initialize the code memory.
@@ -56,7 +56,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t
56 KCodeMemory::Register(kernel, code_mem); 56 KCodeMemory::Register(kernel, code_mem);
57 57
58 // Add the code memory to the handle table. 58 // Add the code memory to the handle table.
59 R_TRY(system.CurrentProcess()->GetHandleTable().Add(out, code_mem)); 59 R_TRY(GetCurrentProcess(system.Kernel()).GetHandleTable().Add(out, code_mem));
60 60
61 code_mem->Close(); 61 code_mem->Close();
62 62
@@ -79,8 +79,9 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle,
79 R_UNLESS((address < address + size), ResultInvalidCurrentMemory); 79 R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
80 80
81 // Get the code memory from its handle. 81 // Get the code memory from its handle.
82 KScopedAutoObject code_mem = 82 KScopedAutoObject code_mem = GetCurrentProcess(system.Kernel())
83 system.CurrentProcess()->GetHandleTable().GetObject<KCodeMemory>(code_memory_handle); 83 .GetHandleTable()
84 .GetObject<KCodeMemory>(code_memory_handle);
84 R_UNLESS(code_mem.IsNotNull(), ResultInvalidHandle); 85 R_UNLESS(code_mem.IsNotNull(), ResultInvalidHandle);
85 86
86 // NOTE: Here, Atmosphere extends the SVC to allow code memory operations on one's own process. 87 // NOTE: Here, Atmosphere extends the SVC to allow code memory operations on one's own process.
@@ -90,9 +91,10 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle,
90 switch (operation) { 91 switch (operation) {
91 case CodeMemoryOperation::Map: { 92 case CodeMemoryOperation::Map: {
92 // Check that the region is in range. 93 // Check that the region is in range.
93 R_UNLESS( 94 R_UNLESS(GetCurrentProcess(system.Kernel())
94 system.CurrentProcess()->PageTable().CanContain(address, size, KMemoryState::CodeOut), 95 .PageTable()
95 ResultInvalidMemoryRegion); 96 .CanContain(address, size, KMemoryState::CodeOut),
97 ResultInvalidMemoryRegion);
96 98
97 // Check the memory permission. 99 // Check the memory permission.
98 R_UNLESS(IsValidMapCodeMemoryPermission(perm), ResultInvalidNewMemoryPermission); 100 R_UNLESS(IsValidMapCodeMemoryPermission(perm), ResultInvalidNewMemoryPermission);
@@ -102,9 +104,10 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle,
102 } break; 104 } break;
103 case CodeMemoryOperation::Unmap: { 105 case CodeMemoryOperation::Unmap: {
104 // Check that the region is in range. 106 // Check that the region is in range.
105 R_UNLESS( 107 R_UNLESS(GetCurrentProcess(system.Kernel())
106 system.CurrentProcess()->PageTable().CanContain(address, size, KMemoryState::CodeOut), 108 .PageTable()
107 ResultInvalidMemoryRegion); 109 .CanContain(address, size, KMemoryState::CodeOut),
110 ResultInvalidMemoryRegion);
108 111
109 // Check the memory permission. 112 // Check the memory permission.
110 R_UNLESS(IsValidUnmapCodeMemoryPermission(perm), ResultInvalidNewMemoryPermission); 113 R_UNLESS(IsValidUnmapCodeMemoryPermission(perm), ResultInvalidNewMemoryPermission);
diff --git a/src/core/hle/kernel/svc/svc_condition_variable.cpp b/src/core/hle/kernel/svc/svc_condition_variable.cpp
index b59a33e68..8ad1a0b8f 100644
--- a/src/core/hle/kernel/svc/svc_condition_variable.cpp
+++ b/src/core/hle/kernel/svc/svc_condition_variable.cpp
@@ -43,8 +43,8 @@ Result WaitProcessWideKeyAtomic(Core::System& system, VAddr address, VAddr cv_ke
43 } 43 }
44 44
45 // Wait on the condition variable. 45 // Wait on the condition variable.
46 return system.Kernel().CurrentProcess()->WaitConditionVariable( 46 return GetCurrentProcess(system.Kernel())
47 address, Common::AlignDown(cv_key, sizeof(u32)), tag, timeout); 47 .WaitConditionVariable(address, Common::AlignDown(cv_key, sizeof(u32)), tag, timeout);
48} 48}
49 49
50/// Signal process wide key 50/// Signal process wide key
@@ -52,8 +52,8 @@ void SignalProcessWideKey(Core::System& system, VAddr cv_key, s32 count) {
52 LOG_TRACE(Kernel_SVC, "called, cv_key=0x{:X}, count=0x{:08X}", cv_key, count); 52 LOG_TRACE(Kernel_SVC, "called, cv_key=0x{:X}, count=0x{:08X}", cv_key, count);
53 53
54 // Signal the condition variable. 54 // Signal the condition variable.
55 return system.Kernel().CurrentProcess()->SignalConditionVariable( 55 return GetCurrentProcess(system.Kernel())
56 Common::AlignDown(cv_key, sizeof(u32)), count); 56 .SignalConditionVariable(Common::AlignDown(cv_key, sizeof(u32)), count);
57} 57}
58 58
59Result WaitProcessWideKeyAtomic64(Core::System& system, uint64_t address, uint64_t cv_key, 59Result WaitProcessWideKeyAtomic64(Core::System& system, uint64_t address, uint64_t cv_key,
diff --git a/src/core/hle/kernel/svc/svc_device_address_space.cpp b/src/core/hle/kernel/svc/svc_device_address_space.cpp
index cdc453c35..f68c0e6a9 100644
--- a/src/core/hle/kernel/svc/svc_device_address_space.cpp
+++ b/src/core/hle/kernel/svc/svc_device_address_space.cpp
@@ -37,15 +37,16 @@ Result CreateDeviceAddressSpace(Core::System& system, Handle* out, uint64_t das_
37 KDeviceAddressSpace::Register(system.Kernel(), das); 37 KDeviceAddressSpace::Register(system.Kernel(), das);
38 38
39 // Add to the handle table. 39 // Add to the handle table.
40 R_TRY(system.CurrentProcess()->GetHandleTable().Add(out, das)); 40 R_TRY(GetCurrentProcess(system.Kernel()).GetHandleTable().Add(out, das));
41 41
42 R_SUCCEED(); 42 R_SUCCEED();
43} 43}
44 44
45Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle) { 45Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle) {
46 // Get the device address space. 46 // Get the device address space.
47 KScopedAutoObject das = 47 KScopedAutoObject das = GetCurrentProcess(system.Kernel())
48 system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle); 48 .GetHandleTable()
49 .GetObject<KDeviceAddressSpace>(das_handle);
49 R_UNLESS(das.IsNotNull(), ResultInvalidHandle); 50 R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
50 51
51 // Attach. 52 // Attach.
@@ -54,8 +55,9 @@ Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Ha
54 55
55Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle) { 56Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle) {
56 // Get the device address space. 57 // Get the device address space.
57 KScopedAutoObject das = 58 KScopedAutoObject das = GetCurrentProcess(system.Kernel())
58 system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle); 59 .GetHandleTable()
60 .GetObject<KDeviceAddressSpace>(das_handle);
59 R_UNLESS(das.IsNotNull(), ResultInvalidHandle); 61 R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
60 62
61 // Detach. 63 // Detach.
@@ -94,13 +96,14 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han
94 R_UNLESS(reserved == 0, ResultInvalidEnumValue); 96 R_UNLESS(reserved == 0, ResultInvalidEnumValue);
95 97
96 // Get the device address space. 98 // Get the device address space.
97 KScopedAutoObject das = 99 KScopedAutoObject das = GetCurrentProcess(system.Kernel())
98 system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle); 100 .GetHandleTable()
101 .GetObject<KDeviceAddressSpace>(das_handle);
99 R_UNLESS(das.IsNotNull(), ResultInvalidHandle); 102 R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
100 103
101 // Get the process. 104 // Get the process.
102 KScopedAutoObject process = 105 KScopedAutoObject process =
103 system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle); 106 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
104 R_UNLESS(process.IsNotNull(), ResultInvalidHandle); 107 R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
105 108
106 // Validate that the process address is within range. 109 // Validate that the process address is within range.
@@ -134,13 +137,14 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han
134 R_UNLESS(reserved == 0, ResultInvalidEnumValue); 137 R_UNLESS(reserved == 0, ResultInvalidEnumValue);
135 138
136 // Get the device address space. 139 // Get the device address space.
137 KScopedAutoObject das = 140 KScopedAutoObject das = GetCurrentProcess(system.Kernel())
138 system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle); 141 .GetHandleTable()
142 .GetObject<KDeviceAddressSpace>(das_handle);
139 R_UNLESS(das.IsNotNull(), ResultInvalidHandle); 143 R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
140 144
141 // Get the process. 145 // Get the process.
142 KScopedAutoObject process = 146 KScopedAutoObject process =
143 system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle); 147 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
144 R_UNLESS(process.IsNotNull(), ResultInvalidHandle); 148 R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
145 149
146 // Validate that the process address is within range. 150 // Validate that the process address is within range.
@@ -165,13 +169,14 @@ Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle p
165 ResultInvalidCurrentMemory); 169 ResultInvalidCurrentMemory);
166 170
167 // Get the device address space. 171 // Get the device address space.
168 KScopedAutoObject das = 172 KScopedAutoObject das = GetCurrentProcess(system.Kernel())
169 system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle); 173 .GetHandleTable()
174 .GetObject<KDeviceAddressSpace>(das_handle);
170 R_UNLESS(das.IsNotNull(), ResultInvalidHandle); 175 R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
171 176
172 // Get the process. 177 // Get the process.
173 KScopedAutoObject process = 178 KScopedAutoObject process =
174 system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle); 179 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
175 R_UNLESS(process.IsNotNull(), ResultInvalidHandle); 180 R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
176 181
177 // Validate that the process address is within range. 182 // Validate that the process address is within range.
diff --git a/src/core/hle/kernel/svc/svc_event.cpp b/src/core/hle/kernel/svc/svc_event.cpp
index e8fb9efbc..a948493e8 100644
--- a/src/core/hle/kernel/svc/svc_event.cpp
+++ b/src/core/hle/kernel/svc/svc_event.cpp
@@ -15,7 +15,7 @@ Result SignalEvent(Core::System& system, Handle event_handle) {
15 LOG_DEBUG(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle); 15 LOG_DEBUG(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle);
16 16
17 // Get the current handle table. 17 // Get the current handle table.
18 const KHandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 18 const KHandleTable& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
19 19
20 // Get the event. 20 // Get the event.
21 KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle); 21 KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle);
@@ -28,7 +28,7 @@ Result ClearEvent(Core::System& system, Handle event_handle) {
28 LOG_TRACE(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle); 28 LOG_TRACE(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle);
29 29
30 // Get the current handle table. 30 // Get the current handle table.
31 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 31 const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
32 32
33 // Try to clear the writable event. 33 // Try to clear the writable event.
34 { 34 {
@@ -56,10 +56,10 @@ Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_read) {
56 56
57 // Get the kernel reference and handle table. 57 // Get the kernel reference and handle table.
58 auto& kernel = system.Kernel(); 58 auto& kernel = system.Kernel();
59 auto& handle_table = kernel.CurrentProcess()->GetHandleTable(); 59 auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
60 60
61 // Reserve a new event from the process resource limit 61 // Reserve a new event from the process resource limit
62 KScopedResourceReservation event_reservation(kernel.CurrentProcess(), 62 KScopedResourceReservation event_reservation(GetCurrentProcessPointer(kernel),
63 LimitableResource::EventCountMax); 63 LimitableResource::EventCountMax);
64 R_UNLESS(event_reservation.Succeeded(), ResultLimitReached); 64 R_UNLESS(event_reservation.Succeeded(), ResultLimitReached);
65 65
@@ -68,7 +68,7 @@ Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_read) {
68 R_UNLESS(event != nullptr, ResultOutOfResource); 68 R_UNLESS(event != nullptr, ResultOutOfResource);
69 69
70 // Initialize the event. 70 // Initialize the event.
71 event->Initialize(kernel.CurrentProcess()); 71 event->Initialize(GetCurrentProcessPointer(kernel));
72 72
73 // Commit the thread reservation. 73 // Commit the thread reservation.
74 event_reservation.Commit(); 74 event_reservation.Commit();
diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp
index ad56e2fe6..58dc47508 100644
--- a/src/core/hle/kernel/svc/svc_info.cpp
+++ b/src/core/hle/kernel/svc/svc_info.cpp
@@ -44,7 +44,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
44 return ResultInvalidEnumValue; 44 return ResultInvalidEnumValue;
45 } 45 }
46 46
47 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 47 const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
48 KScopedAutoObject process = handle_table.GetObject<KProcess>(handle); 48 KScopedAutoObject process = handle_table.GetObject<KProcess>(handle);
49 if (process.IsNull()) { 49 if (process.IsNull()) {
50 LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}", 50 LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}",
@@ -154,7 +154,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
154 return ResultInvalidCombination; 154 return ResultInvalidCombination;
155 } 155 }
156 156
157 KProcess* const current_process = system.Kernel().CurrentProcess(); 157 KProcess* const current_process = GetCurrentProcessPointer(system.Kernel());
158 KHandleTable& handle_table = current_process->GetHandleTable(); 158 KHandleTable& handle_table = current_process->GetHandleTable();
159 const auto resource_limit = current_process->GetResourceLimit(); 159 const auto resource_limit = current_process->GetResourceLimit();
160 if (!resource_limit) { 160 if (!resource_limit) {
@@ -183,7 +183,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
183 return ResultInvalidCombination; 183 return ResultInvalidCombination;
184 } 184 }
185 185
186 *result = system.Kernel().CurrentProcess()->GetRandomEntropy(info_sub_id); 186 *result = GetCurrentProcess(system.Kernel()).GetRandomEntropy(info_sub_id);
187 return ResultSuccess; 187 return ResultSuccess;
188 188
189 case InfoType::InitialProcessIdRange: 189 case InfoType::InitialProcessIdRange:
@@ -200,9 +200,9 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
200 return ResultInvalidCombination; 200 return ResultInvalidCombination;
201 } 201 }
202 202
203 KScopedAutoObject thread = 203 KScopedAutoObject thread = GetCurrentProcess(system.Kernel())
204 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>( 204 .GetHandleTable()
205 static_cast<Handle>(handle)); 205 .GetObject<KThread>(static_cast<Handle>(handle));
206 if (thread.IsNull()) { 206 if (thread.IsNull()) {
207 LOG_ERROR(Kernel_SVC, "Thread handle does not exist, handle=0x{:08X}", 207 LOG_ERROR(Kernel_SVC, "Thread handle does not exist, handle=0x{:08X}",
208 static_cast<Handle>(handle)); 208 static_cast<Handle>(handle));
@@ -249,7 +249,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
249 R_UNLESS(info_sub_id == 0, ResultInvalidCombination); 249 R_UNLESS(info_sub_id == 0, ResultInvalidCombination);
250 250
251 // Get the handle table. 251 // Get the handle table.
252 KProcess* current_process = system.Kernel().CurrentProcess(); 252 KProcess* current_process = GetCurrentProcessPointer(system.Kernel());
253 KHandleTable& handle_table = current_process->GetHandleTable(); 253 KHandleTable& handle_table = current_process->GetHandleTable();
254 254
255 // Get a new handle for the current process. 255 // Get a new handle for the current process.
diff --git a/src/core/hle/kernel/svc/svc_ipc.cpp b/src/core/hle/kernel/svc/svc_ipc.cpp
index 97ce49dde..a7a2c3b92 100644
--- a/src/core/hle/kernel/svc/svc_ipc.cpp
+++ b/src/core/hle/kernel/svc/svc_ipc.cpp
@@ -12,11 +12,9 @@ namespace Kernel::Svc {
12 12
13/// Makes a blocking IPC call to a service. 13/// Makes a blocking IPC call to a service.
14Result SendSyncRequest(Core::System& system, Handle handle) { 14Result SendSyncRequest(Core::System& system, Handle handle) {
15 auto& kernel = system.Kernel();
16
17 // Get the client session from its handle. 15 // Get the client session from its handle.
18 KScopedAutoObject session = 16 KScopedAutoObject session =
19 kernel.CurrentProcess()->GetHandleTable().GetObject<KClientSession>(handle); 17 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KClientSession>(handle);
20 R_UNLESS(session.IsNotNull(), ResultInvalidHandle); 18 R_UNLESS(session.IsNotNull(), ResultInvalidHandle);
21 19
22 LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName()); 20 LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
@@ -40,7 +38,7 @@ Result SendAsyncRequestWithUserBuffer(Core::System& system, Handle* out_event_ha
40Result ReplyAndReceive(Core::System& system, s32* out_index, uint64_t handles_addr, s32 num_handles, 38Result ReplyAndReceive(Core::System& system, s32* out_index, uint64_t handles_addr, s32 num_handles,
41 Handle reply_target, s64 timeout_ns) { 39 Handle reply_target, s64 timeout_ns) {
42 auto& kernel = system.Kernel(); 40 auto& kernel = system.Kernel();
43 auto& handle_table = GetCurrentThread(kernel).GetOwnerProcess()->GetHandleTable(); 41 auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
44 42
45 R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange); 43 R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange);
46 R_UNLESS(system.Memory().IsValidVirtualAddressRange( 44 R_UNLESS(system.Memory().IsValidVirtualAddressRange(
diff --git a/src/core/hle/kernel/svc/svc_lock.cpp b/src/core/hle/kernel/svc/svc_lock.cpp
index 7005ac30b..f3d3e140b 100644
--- a/src/core/hle/kernel/svc/svc_lock.cpp
+++ b/src/core/hle/kernel/svc/svc_lock.cpp
@@ -24,7 +24,7 @@ Result ArbitrateLock(Core::System& system, Handle thread_handle, VAddr address,
24 return ResultInvalidAddress; 24 return ResultInvalidAddress;
25 } 25 }
26 26
27 return system.Kernel().CurrentProcess()->WaitForAddress(thread_handle, address, tag); 27 return GetCurrentProcess(system.Kernel()).WaitForAddress(thread_handle, address, tag);
28} 28}
29 29
30/// Unlock a mutex 30/// Unlock a mutex
@@ -43,7 +43,7 @@ Result ArbitrateUnlock(Core::System& system, VAddr address) {
43 return ResultInvalidAddress; 43 return ResultInvalidAddress;
44 } 44 }
45 45
46 return system.Kernel().CurrentProcess()->SignalToAddress(address); 46 return GetCurrentProcess(system.Kernel()).SignalToAddress(address);
47} 47}
48 48
49Result ArbitrateLock64(Core::System& system, Handle thread_handle, uint64_t address, uint32_t tag) { 49Result ArbitrateLock64(Core::System& system, Handle thread_handle, uint64_t address, uint32_t tag) {
diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp
index 21f818da6..214bcd073 100644
--- a/src/core/hle/kernel/svc/svc_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_memory.cpp
@@ -113,7 +113,7 @@ Result SetMemoryPermission(Core::System& system, VAddr address, u64 size, Memory
113 R_UNLESS(IsValidSetMemoryPermission(perm), ResultInvalidNewMemoryPermission); 113 R_UNLESS(IsValidSetMemoryPermission(perm), ResultInvalidNewMemoryPermission);
114 114
115 // Validate that the region is in range for the current process. 115 // Validate that the region is in range for the current process.
116 auto& page_table = system.Kernel().CurrentProcess()->PageTable(); 116 auto& page_table = GetCurrentProcess(system.Kernel()).PageTable();
117 R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); 117 R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory);
118 118
119 // Set the memory attribute. 119 // Set the memory attribute.
@@ -137,7 +137,7 @@ Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mas
137 R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); 137 R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination);
138 138
139 // Validate that the region is in range for the current process. 139 // Validate that the region is in range for the current process.
140 auto& page_table{system.Kernel().CurrentProcess()->PageTable()}; 140 auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()};
141 R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); 141 R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory);
142 142
143 // Set the memory attribute. 143 // Set the memory attribute.
@@ -149,7 +149,7 @@ Result MapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size)
149 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, 149 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
150 src_addr, size); 150 src_addr, size);
151 151
152 auto& page_table{system.Kernel().CurrentProcess()->PageTable()}; 152 auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()};
153 153
154 if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; 154 if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)};
155 result.IsError()) { 155 result.IsError()) {
@@ -164,7 +164,7 @@ Result UnmapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 siz
164 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, 164 LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
165 src_addr, size); 165 src_addr, size);
166 166
167 auto& page_table{system.Kernel().CurrentProcess()->PageTable()}; 167 auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()};
168 168
169 if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; 169 if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)};
170 result.IsError()) { 170 result.IsError()) {
diff --git a/src/core/hle/kernel/svc/svc_physical_memory.cpp b/src/core/hle/kernel/svc/svc_physical_memory.cpp
index 8d00e1fc3..a1f534454 100644
--- a/src/core/hle/kernel/svc/svc_physical_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_physical_memory.cpp
@@ -16,7 +16,7 @@ Result SetHeapSize(Core::System& system, VAddr* out_address, u64 size) {
16 R_UNLESS(size < MainMemorySizeMax, ResultInvalidSize); 16 R_UNLESS(size < MainMemorySizeMax, ResultInvalidSize);
17 17
18 // Set the heap size. 18 // Set the heap size.
19 R_TRY(system.Kernel().CurrentProcess()->PageTable().SetHeapSize(out_address, size)); 19 R_TRY(GetCurrentProcess(system.Kernel()).PageTable().SetHeapSize(out_address, size));
20 20
21 return ResultSuccess; 21 return ResultSuccess;
22} 22}
@@ -45,7 +45,7 @@ Result MapPhysicalMemory(Core::System& system, VAddr addr, u64 size) {
45 return ResultInvalidMemoryRegion; 45 return ResultInvalidMemoryRegion;
46 } 46 }
47 47
48 KProcess* const current_process{system.Kernel().CurrentProcess()}; 48 KProcess* const current_process{GetCurrentProcessPointer(system.Kernel())};
49 auto& page_table{current_process->PageTable()}; 49 auto& page_table{current_process->PageTable()};
50 50
51 if (current_process->GetSystemResourceSize() == 0) { 51 if (current_process->GetSystemResourceSize() == 0) {
@@ -94,7 +94,7 @@ Result UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size) {
94 return ResultInvalidMemoryRegion; 94 return ResultInvalidMemoryRegion;
95 } 95 }
96 96
97 KProcess* const current_process{system.Kernel().CurrentProcess()}; 97 KProcess* const current_process{GetCurrentProcessPointer(system.Kernel())};
98 auto& page_table{current_process->PageTable()}; 98 auto& page_table{current_process->PageTable()};
99 99
100 if (current_process->GetSystemResourceSize() == 0) { 100 if (current_process->GetSystemResourceSize() == 0) {
diff --git a/src/core/hle/kernel/svc/svc_port.cpp b/src/core/hle/kernel/svc/svc_port.cpp
index 2e5d228bb..2b7cebde5 100644
--- a/src/core/hle/kernel/svc/svc_port.cpp
+++ b/src/core/hle/kernel/svc/svc_port.cpp
@@ -34,7 +34,7 @@ Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr port_name_add
34 34
35 // Get the current handle table. 35 // Get the current handle table.
36 auto& kernel = system.Kernel(); 36 auto& kernel = system.Kernel();
37 auto& handle_table = kernel.CurrentProcess()->GetHandleTable(); 37 auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
38 38
39 // Find the client port. 39 // Find the client port.
40 auto port = kernel.CreateNamedServicePort(port_name); 40 auto port = kernel.CreateNamedServicePort(port_name);
diff --git a/src/core/hle/kernel/svc/svc_process.cpp b/src/core/hle/kernel/svc/svc_process.cpp
index d2c20aad2..c35d2be76 100644
--- a/src/core/hle/kernel/svc/svc_process.cpp
+++ b/src/core/hle/kernel/svc/svc_process.cpp
@@ -9,7 +9,7 @@ namespace Kernel::Svc {
9 9
10/// Exits the current process 10/// Exits the current process
11void ExitProcess(Core::System& system) { 11void ExitProcess(Core::System& system) {
12 auto* current_process = system.Kernel().CurrentProcess(); 12 auto* current_process = GetCurrentProcessPointer(system.Kernel());
13 13
14 LOG_INFO(Kernel_SVC, "Process {} exiting", current_process->GetProcessID()); 14 LOG_INFO(Kernel_SVC, "Process {} exiting", current_process->GetProcessID());
15 ASSERT_MSG(current_process->GetState() == KProcess::State::Running, 15 ASSERT_MSG(current_process->GetState() == KProcess::State::Running,
@@ -23,9 +23,9 @@ Result GetProcessId(Core::System& system, u64* out_process_id, Handle handle) {
23 LOG_DEBUG(Kernel_SVC, "called handle=0x{:08X}", handle); 23 LOG_DEBUG(Kernel_SVC, "called handle=0x{:08X}", handle);
24 24
25 // Get the object from the handle table. 25 // Get the object from the handle table.
26 KScopedAutoObject obj = 26 KScopedAutoObject obj = GetCurrentProcess(system.Kernel())
27 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KAutoObject>( 27 .GetHandleTable()
28 static_cast<Handle>(handle)); 28 .GetObject<KAutoObject>(static_cast<Handle>(handle));
29 R_UNLESS(obj.IsNotNull(), ResultInvalidHandle); 29 R_UNLESS(obj.IsNotNull(), ResultInvalidHandle);
30 30
31 // Get the process from the object. 31 // Get the process from the object.
@@ -63,10 +63,10 @@ Result GetProcessList(Core::System& system, s32* out_num_processes, VAddr out_pr
63 return ResultOutOfRange; 63 return ResultOutOfRange;
64 } 64 }
65 65
66 const auto& kernel = system.Kernel(); 66 auto& kernel = system.Kernel();
67 const auto total_copy_size = out_process_ids_size * sizeof(u64); 67 const auto total_copy_size = out_process_ids_size * sizeof(u64);
68 68
69 if (out_process_ids_size > 0 && !kernel.CurrentProcess()->PageTable().IsInsideAddressSpace( 69 if (out_process_ids_size > 0 && !GetCurrentProcess(kernel).PageTable().IsInsideAddressSpace(
70 out_process_ids, total_copy_size)) { 70 out_process_ids, total_copy_size)) {
71 LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}", 71 LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}",
72 out_process_ids, out_process_ids + total_copy_size); 72 out_process_ids, out_process_ids + total_copy_size);
@@ -92,7 +92,7 @@ Result GetProcessInfo(Core::System& system, s64* out, Handle process_handle,
92 ProcessInfoType info_type) { 92 ProcessInfoType info_type) {
93 LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, type=0x{:X}", process_handle, info_type); 93 LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, type=0x{:X}", process_handle, info_type);
94 94
95 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 95 const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
96 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); 96 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
97 if (process.IsNull()) { 97 if (process.IsNull()) {
98 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", 98 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}",
diff --git a/src/core/hle/kernel/svc/svc_process_memory.cpp b/src/core/hle/kernel/svc/svc_process_memory.cpp
index dbe24e139..4dfd9e5bb 100644
--- a/src/core/hle/kernel/svc/svc_process_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_process_memory.cpp
@@ -45,7 +45,7 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, V
45 45
46 // Get the process from its handle. 46 // Get the process from its handle.
47 KScopedAutoObject process = 47 KScopedAutoObject process =
48 system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle); 48 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
49 R_UNLESS(process.IsNotNull(), ResultInvalidHandle); 49 R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
50 50
51 // Validate that the address is in range. 51 // Validate that the address is in range.
@@ -71,7 +71,7 @@ Result MapProcessMemory(Core::System& system, VAddr dst_address, Handle process_
71 R_UNLESS((src_address < src_address + size), ResultInvalidCurrentMemory); 71 R_UNLESS((src_address < src_address + size), ResultInvalidCurrentMemory);
72 72
73 // Get the processes. 73 // Get the processes.
74 KProcess* dst_process = system.CurrentProcess(); 74 KProcess* dst_process = GetCurrentProcessPointer(system.Kernel());
75 KScopedAutoObject src_process = 75 KScopedAutoObject src_process =
76 dst_process->GetHandleTable().GetObjectWithoutPseudoHandle<KProcess>(process_handle); 76 dst_process->GetHandleTable().GetObjectWithoutPseudoHandle<KProcess>(process_handle);
77 R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle); 77 R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle);
@@ -114,7 +114,7 @@ Result UnmapProcessMemory(Core::System& system, VAddr dst_address, Handle proces
114 R_UNLESS((src_address < src_address + size), ResultInvalidCurrentMemory); 114 R_UNLESS((src_address < src_address + size), ResultInvalidCurrentMemory);
115 115
116 // Get the processes. 116 // Get the processes.
117 KProcess* dst_process = system.CurrentProcess(); 117 KProcess* dst_process = GetCurrentProcessPointer(system.Kernel());
118 KScopedAutoObject src_process = 118 KScopedAutoObject src_process =
119 dst_process->GetHandleTable().GetObjectWithoutPseudoHandle<KProcess>(process_handle); 119 dst_process->GetHandleTable().GetObjectWithoutPseudoHandle<KProcess>(process_handle);
120 R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle); 120 R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle);
@@ -174,7 +174,7 @@ Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst
174 return ResultInvalidCurrentMemory; 174 return ResultInvalidCurrentMemory;
175 } 175 }
176 176
177 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 177 const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
178 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); 178 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
179 if (process.IsNull()) { 179 if (process.IsNull()) {
180 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", 180 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).",
@@ -242,7 +242,7 @@ Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, u64 d
242 return ResultInvalidCurrentMemory; 242 return ResultInvalidCurrentMemory;
243 } 243 }
244 244
245 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 245 const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
246 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); 246 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
247 if (process.IsNull()) { 247 if (process.IsNull()) {
248 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", 248 LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).",
diff --git a/src/core/hle/kernel/svc/svc_query_memory.cpp b/src/core/hle/kernel/svc/svc_query_memory.cpp
index db140a341..ee75ad370 100644
--- a/src/core/hle/kernel/svc/svc_query_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_query_memory.cpp
@@ -22,7 +22,7 @@ Result QueryMemory(Core::System& system, uint64_t out_memory_info, PageInfo* out
22Result QueryProcessMemory(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info, 22Result QueryProcessMemory(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info,
23 Handle process_handle, uint64_t address) { 23 Handle process_handle, uint64_t address) {
24 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address); 24 LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address);
25 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 25 const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
26 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); 26 KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
27 if (process.IsNull()) { 27 if (process.IsNull()) {
28 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", 28 LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}",
diff --git a/src/core/hle/kernel/svc/svc_resource_limit.cpp b/src/core/hle/kernel/svc/svc_resource_limit.cpp
index ebc886028..88166299e 100644
--- a/src/core/hle/kernel/svc/svc_resource_limit.cpp
+++ b/src/core/hle/kernel/svc/svc_resource_limit.cpp
@@ -27,7 +27,7 @@ Result CreateResourceLimit(Core::System& system, Handle* out_handle) {
27 KResourceLimit::Register(kernel, resource_limit); 27 KResourceLimit::Register(kernel, resource_limit);
28 28
29 // Add the limit to the handle table. 29 // Add the limit to the handle table.
30 R_TRY(kernel.CurrentProcess()->GetHandleTable().Add(out_handle, resource_limit)); 30 R_TRY(GetCurrentProcess(kernel).GetHandleTable().Add(out_handle, resource_limit));
31 31
32 return ResultSuccess; 32 return ResultSuccess;
33} 33}
@@ -41,9 +41,9 @@ Result GetResourceLimitLimitValue(Core::System& system, s64* out_limit_value,
41 R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue); 41 R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue);
42 42
43 // Get the resource limit. 43 // Get the resource limit.
44 auto& kernel = system.Kernel(); 44 KScopedAutoObject resource_limit = GetCurrentProcess(system.Kernel())
45 KScopedAutoObject resource_limit = 45 .GetHandleTable()
46 kernel.CurrentProcess()->GetHandleTable().GetObject<KResourceLimit>(resource_limit_handle); 46 .GetObject<KResourceLimit>(resource_limit_handle);
47 R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle); 47 R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle);
48 48
49 // Get the limit value. 49 // Get the limit value.
@@ -61,9 +61,9 @@ Result GetResourceLimitCurrentValue(Core::System& system, s64* out_current_value
61 R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue); 61 R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue);
62 62
63 // Get the resource limit. 63 // Get the resource limit.
64 auto& kernel = system.Kernel(); 64 KScopedAutoObject resource_limit = GetCurrentProcess(system.Kernel())
65 KScopedAutoObject resource_limit = 65 .GetHandleTable()
66 kernel.CurrentProcess()->GetHandleTable().GetObject<KResourceLimit>(resource_limit_handle); 66 .GetObject<KResourceLimit>(resource_limit_handle);
67 R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle); 67 R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle);
68 68
69 // Get the current value. 69 // Get the current value.
@@ -81,9 +81,9 @@ Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_ha
81 R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue); 81 R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue);
82 82
83 // Get the resource limit. 83 // Get the resource limit.
84 auto& kernel = system.Kernel(); 84 KScopedAutoObject resource_limit = GetCurrentProcess(system.Kernel())
85 KScopedAutoObject resource_limit = 85 .GetHandleTable()
86 kernel.CurrentProcess()->GetHandleTable().GetObject<KResourceLimit>(resource_limit_handle); 86 .GetObject<KResourceLimit>(resource_limit_handle);
87 R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle); 87 R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle);
88 88
89 // Set the limit value. 89 // Set the limit value.
diff --git a/src/core/hle/kernel/svc/svc_session.cpp b/src/core/hle/kernel/svc/svc_session.cpp
index 0deb61b62..00fd1605e 100644
--- a/src/core/hle/kernel/svc/svc_session.cpp
+++ b/src/core/hle/kernel/svc/svc_session.cpp
@@ -13,7 +13,7 @@ namespace {
13 13
14template <typename T> 14template <typename T>
15Result CreateSession(Core::System& system, Handle* out_server, Handle* out_client, u64 name) { 15Result CreateSession(Core::System& system, Handle* out_server, Handle* out_client, u64 name) {
16 auto& process = *system.CurrentProcess(); 16 auto& process = GetCurrentProcess(system.Kernel());
17 auto& handle_table = process.GetHandleTable(); 17 auto& handle_table = process.GetHandleTable();
18 18
19 // Declare the session we're going to allocate. 19 // Declare the session we're going to allocate.
diff --git a/src/core/hle/kernel/svc/svc_shared_memory.cpp b/src/core/hle/kernel/svc/svc_shared_memory.cpp
index 40d6260e3..18e0dc904 100644
--- a/src/core/hle/kernel/svc/svc_shared_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_shared_memory.cpp
@@ -42,7 +42,7 @@ Result MapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address,
42 R_UNLESS(IsValidSharedMemoryPermission(map_perm), ResultInvalidNewMemoryPermission); 42 R_UNLESS(IsValidSharedMemoryPermission(map_perm), ResultInvalidNewMemoryPermission);
43 43
44 // Get the current process. 44 // Get the current process.
45 auto& process = *system.Kernel().CurrentProcess(); 45 auto& process = GetCurrentProcess(system.Kernel());
46 auto& page_table = process.PageTable(); 46 auto& page_table = process.PageTable();
47 47
48 // Get the shared memory. 48 // Get the shared memory.
@@ -75,7 +75,7 @@ Result UnmapSharedMemory(Core::System& system, Handle shmem_handle, VAddr addres
75 R_UNLESS((address < address + size), ResultInvalidCurrentMemory); 75 R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
76 76
77 // Get the current process. 77 // Get the current process.
78 auto& process = *system.Kernel().CurrentProcess(); 78 auto& process = GetCurrentProcess(system.Kernel());
79 auto& page_table = process.PageTable(); 79 auto& page_table = process.PageTable();
80 80
81 // Get the shared memory. 81 // Get the shared memory.
diff --git a/src/core/hle/kernel/svc/svc_synchronization.cpp b/src/core/hle/kernel/svc/svc_synchronization.cpp
index e516a3800..1a8f7e191 100644
--- a/src/core/hle/kernel/svc/svc_synchronization.cpp
+++ b/src/core/hle/kernel/svc/svc_synchronization.cpp
@@ -14,7 +14,7 @@ Result CloseHandle(Core::System& system, Handle handle) {
14 LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); 14 LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle);
15 15
16 // Remove the handle. 16 // Remove the handle.
17 R_UNLESS(system.Kernel().CurrentProcess()->GetHandleTable().Remove(handle), 17 R_UNLESS(GetCurrentProcess(system.Kernel()).GetHandleTable().Remove(handle),
18 ResultInvalidHandle); 18 ResultInvalidHandle);
19 19
20 return ResultSuccess; 20 return ResultSuccess;
@@ -25,7 +25,7 @@ Result ResetSignal(Core::System& system, Handle handle) {
25 LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle); 25 LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
26 26
27 // Get the current handle table. 27 // Get the current handle table.
28 const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); 28 const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
29 29
30 // Try to reset as readable event. 30 // Try to reset as readable event.
31 { 31 {
@@ -59,7 +59,7 @@ Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_addre
59 59
60 auto& kernel = system.Kernel(); 60 auto& kernel = system.Kernel();
61 std::vector<KSynchronizationObject*> objs(num_handles); 61 std::vector<KSynchronizationObject*> objs(num_handles);
62 const auto& handle_table = kernel.CurrentProcess()->GetHandleTable(); 62 const auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
63 Handle* handles = system.Memory().GetPointer<Handle>(handles_address); 63 Handle* handles = system.Memory().GetPointer<Handle>(handles_address);
64 64
65 // Copy user handles. 65 // Copy user handles.
@@ -91,7 +91,7 @@ Result CancelSynchronization(Core::System& system, Handle handle) {
91 91
92 // Get the thread from its handle. 92 // Get the thread from its handle.
93 KScopedAutoObject thread = 93 KScopedAutoObject thread =
94 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle); 94 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(handle);
95 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); 95 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
96 96
97 // Cancel the thread's wait. 97 // Cancel the thread's wait.
@@ -106,7 +106,7 @@ void SynchronizePreemptionState(Core::System& system) {
106 KScopedSchedulerLock sl{kernel}; 106 KScopedSchedulerLock sl{kernel};
107 107
108 // If the current thread is pinned, unpin it. 108 // If the current thread is pinned, unpin it.
109 KProcess* cur_process = system.Kernel().CurrentProcess(); 109 KProcess* cur_process = GetCurrentProcessPointer(kernel);
110 const auto core_id = GetCurrentCoreId(kernel); 110 const auto core_id = GetCurrentCoreId(kernel);
111 111
112 if (cur_process->GetPinnedThread(core_id) == GetCurrentThreadPointer(kernel)) { 112 if (cur_process->GetPinnedThread(core_id) == GetCurrentThreadPointer(kernel)) {
diff --git a/src/core/hle/kernel/svc/svc_thread.cpp b/src/core/hle/kernel/svc/svc_thread.cpp
index 3e325c998..b39807841 100644
--- a/src/core/hle/kernel/svc/svc_thread.cpp
+++ b/src/core/hle/kernel/svc/svc_thread.cpp
@@ -28,7 +28,7 @@ Result CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point,
28 28
29 // Adjust core id, if it's the default magic. 29 // Adjust core id, if it's the default magic.
30 auto& kernel = system.Kernel(); 30 auto& kernel = system.Kernel();
31 auto& process = *kernel.CurrentProcess(); 31 auto& process = GetCurrentProcess(kernel);
32 if (core_id == IdealCoreUseProcessValue) { 32 if (core_id == IdealCoreUseProcessValue) {
33 core_id = process.GetIdealCoreId(); 33 core_id = process.GetIdealCoreId();
34 } 34 }
@@ -53,9 +53,9 @@ Result CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point,
53 } 53 }
54 54
55 // Reserve a new thread from the process resource limit (waiting up to 100ms). 55 // Reserve a new thread from the process resource limit (waiting up to 100ms).
56 KScopedResourceReservation thread_reservation( 56 KScopedResourceReservation thread_reservation(&process, LimitableResource::ThreadCountMax, 1,
57 kernel.CurrentProcess(), LimitableResource::ThreadCountMax, 1, 57 system.CoreTiming().GetGlobalTimeNs().count() +
58 system.CoreTiming().GetGlobalTimeNs().count() + 100000000); 58 100000000);
59 if (!thread_reservation.Succeeded()) { 59 if (!thread_reservation.Succeeded()) {
60 LOG_ERROR(Kernel_SVC, "Could not reserve a new thread"); 60 LOG_ERROR(Kernel_SVC, "Could not reserve a new thread");
61 return ResultLimitReached; 61 return ResultLimitReached;
@@ -97,7 +97,7 @@ Result StartThread(Core::System& system, Handle thread_handle) {
97 97
98 // Get the thread from its handle. 98 // Get the thread from its handle.
99 KScopedAutoObject thread = 99 KScopedAutoObject thread =
100 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle); 100 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
101 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); 101 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
102 102
103 // Try to start the thread. 103 // Try to start the thread.
@@ -156,11 +156,11 @@ Result GetThreadContext3(Core::System& system, VAddr out_context, Handle thread_
156 156
157 // Get the thread from its handle. 157 // Get the thread from its handle.
158 KScopedAutoObject thread = 158 KScopedAutoObject thread =
159 kernel.CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle); 159 GetCurrentProcess(kernel).GetHandleTable().GetObject<KThread>(thread_handle);
160 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); 160 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
161 161
162 // Require the handle be to a non-current thread in the current process. 162 // Require the handle be to a non-current thread in the current process.
163 const auto* current_process = kernel.CurrentProcess(); 163 const auto* current_process = GetCurrentProcessPointer(kernel);
164 R_UNLESS(current_process == thread->GetOwnerProcess(), ResultInvalidId); 164 R_UNLESS(current_process == thread->GetOwnerProcess(), ResultInvalidId);
165 165
166 // Verify that the thread isn't terminated. 166 // Verify that the thread isn't terminated.
@@ -211,7 +211,7 @@ Result GetThreadPriority(Core::System& system, s32* out_priority, Handle handle)
211 211
212 // Get the thread from its handle. 212 // Get the thread from its handle.
213 KScopedAutoObject thread = 213 KScopedAutoObject thread =
214 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle); 214 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(handle);
215 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); 215 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
216 216
217 // Get the thread's priority. 217 // Get the thread's priority.
@@ -222,7 +222,7 @@ Result GetThreadPriority(Core::System& system, s32* out_priority, Handle handle)
222/// Sets the priority for the specified thread 222/// Sets the priority for the specified thread
223Result SetThreadPriority(Core::System& system, Handle thread_handle, s32 priority) { 223Result SetThreadPriority(Core::System& system, Handle thread_handle, s32 priority) {
224 // Get the current process. 224 // Get the current process.
225 KProcess& process = *system.Kernel().CurrentProcess(); 225 KProcess& process = GetCurrentProcess(system.Kernel());
226 226
227 // Validate the priority. 227 // Validate the priority.
228 R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority, 228 R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority,
@@ -253,7 +253,7 @@ Result GetThreadList(Core::System& system, s32* out_num_threads, VAddr out_threa
253 return ResultOutOfRange; 253 return ResultOutOfRange;
254 } 254 }
255 255
256 auto* const current_process = system.Kernel().CurrentProcess(); 256 auto* const current_process = GetCurrentProcessPointer(system.Kernel());
257 const auto total_copy_size = out_thread_ids_size * sizeof(u64); 257 const auto total_copy_size = out_thread_ids_size * sizeof(u64);
258 258
259 if (out_thread_ids_size > 0 && 259 if (out_thread_ids_size > 0 &&
@@ -284,7 +284,7 @@ Result GetThreadCoreMask(Core::System& system, s32* out_core_id, u64* out_affini
284 284
285 // Get the thread from its handle. 285 // Get the thread from its handle.
286 KScopedAutoObject thread = 286 KScopedAutoObject thread =
287 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle); 287 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
288 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); 288 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
289 289
290 // Get the core mask. 290 // Get the core mask.
@@ -297,11 +297,11 @@ Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id
297 u64 affinity_mask) { 297 u64 affinity_mask) {
298 // Determine the core id/affinity mask. 298 // Determine the core id/affinity mask.
299 if (core_id == IdealCoreUseProcessValue) { 299 if (core_id == IdealCoreUseProcessValue) {
300 core_id = system.Kernel().CurrentProcess()->GetIdealCoreId(); 300 core_id = GetCurrentProcess(system.Kernel()).GetIdealCoreId();
301 affinity_mask = (1ULL << core_id); 301 affinity_mask = (1ULL << core_id);
302 } else { 302 } else {
303 // Validate the affinity mask. 303 // Validate the affinity mask.
304 const u64 process_core_mask = system.Kernel().CurrentProcess()->GetCoreMask(); 304 const u64 process_core_mask = GetCurrentProcess(system.Kernel()).GetCoreMask();
305 R_UNLESS((affinity_mask | process_core_mask) == process_core_mask, ResultInvalidCoreId); 305 R_UNLESS((affinity_mask | process_core_mask) == process_core_mask, ResultInvalidCoreId);
306 R_UNLESS(affinity_mask != 0, ResultInvalidCombination); 306 R_UNLESS(affinity_mask != 0, ResultInvalidCombination);
307 307
@@ -316,7 +316,7 @@ Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id
316 316
317 // Get the thread from its handle. 317 // Get the thread from its handle.
318 KScopedAutoObject thread = 318 KScopedAutoObject thread =
319 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle); 319 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
320 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); 320 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
321 321
322 // Set the core mask. 322 // Set the core mask.
@@ -329,7 +329,7 @@ Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id
329Result GetThreadId(Core::System& system, u64* out_thread_id, Handle thread_handle) { 329Result GetThreadId(Core::System& system, u64* out_thread_id, Handle thread_handle) {
330 // Get the thread from its handle. 330 // Get the thread from its handle.
331 KScopedAutoObject thread = 331 KScopedAutoObject thread =
332 system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle); 332 GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
333 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle); 333 R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
334 334
335 // Get the thread's id. 335 // Get the thread's id.
diff --git a/src/core/hle/kernel/svc/svc_transfer_memory.cpp b/src/core/hle/kernel/svc/svc_transfer_memory.cpp
index a4c040e49..7ffc24adf 100644
--- a/src/core/hle/kernel/svc/svc_transfer_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_transfer_memory.cpp
@@ -39,11 +39,11 @@ Result CreateTransferMemory(Core::System& system, Handle* out, VAddr address, u6
39 R_UNLESS(IsValidTransferMemoryPermission(map_perm), ResultInvalidNewMemoryPermission); 39 R_UNLESS(IsValidTransferMemoryPermission(map_perm), ResultInvalidNewMemoryPermission);
40 40
41 // Get the current process and handle table. 41 // Get the current process and handle table.
42 auto& process = *kernel.CurrentProcess(); 42 auto& process = GetCurrentProcess(kernel);
43 auto& handle_table = process.GetHandleTable(); 43 auto& handle_table = process.GetHandleTable();
44 44
45 // Reserve a new transfer memory from the process resource limit. 45 // Reserve a new transfer memory from the process resource limit.
46 KScopedResourceReservation trmem_reservation(kernel.CurrentProcess(), 46 KScopedResourceReservation trmem_reservation(&process,
47 LimitableResource::TransferMemoryCountMax); 47 LimitableResource::TransferMemoryCountMax);
48 R_UNLESS(trmem_reservation.Succeeded(), ResultLimitReached); 48 R_UNLESS(trmem_reservation.Succeeded(), ResultLimitReached);
49 49
diff --git a/src/core/hle/kernel/svc_generator.py b/src/core/hle/kernel/svc_generator.py
index b0a5707ec..34d2ac659 100644
--- a/src/core/hle/kernel/svc_generator.py
+++ b/src/core/hle/kernel/svc_generator.py
@@ -592,7 +592,7 @@ void Call(Core::System& system, u32 imm) {
592 auto& kernel = system.Kernel(); 592 auto& kernel = system.Kernel();
593 kernel.EnterSVCProfile(); 593 kernel.EnterSVCProfile();
594 594
595 if (system.CurrentProcess()->Is64BitProcess()) { 595 if (GetCurrentProcess(system.Kernel()).Is64BitProcess()) {
596 Call64(system, imm); 596 Call64(system, imm);
597 } else { 597 } else {
598 Call32(system, imm); 598 Call32(system, imm);
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 6d1084fd1..1495d64de 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -762,7 +762,7 @@ Result Module::Interface::InitializeApplicationInfoBase() {
762 // processes emulated. As we don't actually have pid support we should assume we're just using 762 // processes emulated. As we don't actually have pid support we should assume we're just using
763 // our own process 763 // our own process
764 const auto launch_property = 764 const auto launch_property =
765 system.GetARPManager().GetLaunchProperty(system.GetCurrentProcessProgramID()); 765 system.GetARPManager().GetLaunchProperty(system.GetApplicationProcessProgramID());
766 766
767 if (launch_property.Failed()) { 767 if (launch_property.Failed()) {
768 LOG_ERROR(Service_ACC, "Failed to get launch property"); 768 LOG_ERROR(Service_ACC, "Failed to get launch property");
@@ -806,7 +806,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx
806 bool is_locked = false; 806 bool is_locked = false;
807 807
808 if (res != Loader::ResultStatus::Success) { 808 if (res != Loader::ResultStatus::Success) {
809 const FileSys::PatchManager pm{system.GetCurrentProcessProgramID(), 809 const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(),
810 system.GetFileSystemController(), 810 system.GetFileSystemController(),
811 system.GetContentProvider()}; 811 system.GetContentProvider()};
812 const auto nacp_unique = pm.GetControlMetadata().first; 812 const auto nacp_unique = pm.GetControlMetadata().first;
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 83c862b4d..beb2da06e 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -78,7 +78,7 @@ IWindowController::IWindowController(Core::System& system_)
78IWindowController::~IWindowController() = default; 78IWindowController::~IWindowController() = default;
79 79
80void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) { 80void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) {
81 const u64 process_id = system.CurrentProcess()->GetProcessID(); 81 const u64 process_id = system.ApplicationProcess()->GetProcessID();
82 82
83 LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id); 83 LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id);
84 84
@@ -1251,7 +1251,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
1251 } 1251 }
1252 1252
1253 auto transfer_mem = 1253 auto transfer_mem =
1254 system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle); 1254 system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle);
1255 1255
1256 if (transfer_mem.IsNull()) { 1256 if (transfer_mem.IsNull()) {
1257 LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); 1257 LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle);
@@ -1285,7 +1285,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx)
1285 } 1285 }
1286 1286
1287 auto transfer_mem = 1287 auto transfer_mem =
1288 system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle); 1288 system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle);
1289 1289
1290 if (transfer_mem.IsNull()) { 1290 if (transfer_mem.IsNull()) {
1291 LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); 1291 LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle);
@@ -1464,11 +1464,12 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
1464 const auto backend = BCAT::CreateBackendFromSettings(system, [this](u64 tid) { 1464 const auto backend = BCAT::CreateBackendFromSettings(system, [this](u64 tid) {
1465 return system.GetFileSystemController().GetBCATDirectory(tid); 1465 return system.GetFileSystemController().GetBCATDirectory(tid);
1466 }); 1466 });
1467 const auto build_id_full = system.GetCurrentProcessBuildID(); 1467 const auto build_id_full = system.GetApplicationProcessBuildID();
1468 u64 build_id{}; 1468 u64 build_id{};
1469 std::memcpy(&build_id, build_id_full.data(), sizeof(u64)); 1469 std::memcpy(&build_id, build_id_full.data(), sizeof(u64));
1470 1470
1471 auto data = backend->GetLaunchParameter({system.GetCurrentProcessProgramID(), build_id}); 1471 auto data =
1472 backend->GetLaunchParameter({system.GetApplicationProcessProgramID(), build_id});
1472 if (data.has_value()) { 1473 if (data.has_value()) {
1473 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 1474 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
1474 rb.Push(ResultSuccess); 1475 rb.Push(ResultSuccess);
@@ -1520,7 +1521,7 @@ void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
1520 LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]); 1521 LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]);
1521 1522
1522 FileSys::SaveDataAttribute attribute{}; 1523 FileSys::SaveDataAttribute attribute{};
1523 attribute.title_id = system.GetCurrentProcessProgramID(); 1524 attribute.title_id = system.GetApplicationProcessProgramID();
1524 attribute.user_id = user_id; 1525 attribute.user_id = user_id;
1525 attribute.type = FileSys::SaveDataType::SaveData; 1526 attribute.type = FileSys::SaveDataType::SaveData;
1526 const auto res = system.GetFileSystemController().CreateSaveData( 1527 const auto res = system.GetFileSystemController().CreateSaveData(
@@ -1550,7 +1551,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
1550 std::array<u8, 0x10> version_string{}; 1551 std::array<u8, 0x10> version_string{};
1551 1552
1552 const auto res = [this] { 1553 const auto res = [this] {
1553 const auto title_id = system.GetCurrentProcessProgramID(); 1554 const auto title_id = system.GetApplicationProcessProgramID();
1554 1555
1555 const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), 1556 const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
1556 system.GetContentProvider()}; 1557 system.GetContentProvider()};
@@ -1587,7 +1588,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
1587 u32 supported_languages = 0; 1588 u32 supported_languages = 0;
1588 1589
1589 const auto res = [this] { 1590 const auto res = [this] {
1590 const auto title_id = system.GetCurrentProcessProgramID(); 1591 const auto title_id = system.GetApplicationProcessProgramID();
1591 1592
1592 const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), 1593 const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
1593 system.GetContentProvider()}; 1594 system.GetContentProvider()};
@@ -1695,7 +1696,8 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) {
1695 static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size); 1696 static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size);
1696 1697
1697 system.GetFileSystemController().WriteSaveDataSize( 1698 system.GetFileSystemController().WriteSaveDataSize(
1698 type, system.GetCurrentProcessProgramID(), user_id, {new_normal_size, new_journal_size}); 1699 type, system.GetApplicationProcessProgramID(), user_id,
1700 {new_normal_size, new_journal_size});
1699 1701
1700 IPC::ResponseBuilder rb{ctx, 4}; 1702 IPC::ResponseBuilder rb{ctx, 4};
1701 rb.Push(ResultSuccess); 1703 rb.Push(ResultSuccess);
@@ -1719,7 +1721,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
1719 user_id[0]); 1721 user_id[0]);
1720 1722
1721 const auto size = system.GetFileSystemController().ReadSaveDataSize( 1723 const auto size = system.GetFileSystemController().ReadSaveDataSize(
1722 type, system.GetCurrentProcessProgramID(), user_id); 1724 type, system.GetApplicationProcessProgramID(), user_id);
1723 1725
1724 IPC::ResponseBuilder rb{ctx, 6}; 1726 IPC::ResponseBuilder rb{ctx, 6};
1725 rb.Push(ResultSuccess); 1727 rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/am/applets/applet_error.cpp b/src/core/hle/service/am/applets/applet_error.cpp
index bae0d99a6..b013896b4 100644
--- a/src/core/hle/service/am/applets/applet_error.cpp
+++ b/src/core/hle/service/am/applets/applet_error.cpp
@@ -166,7 +166,7 @@ void Error::Execute() {
166 } 166 }
167 167
168 const auto callback = [this] { DisplayCompleted(); }; 168 const auto callback = [this] { DisplayCompleted(); };
169 const auto title_id = system.GetCurrentProcessProgramID(); 169 const auto title_id = system.GetApplicationProcessProgramID();
170 const auto& reporter{system.GetReporter()}; 170 const auto& reporter{system.GetReporter()};
171 171
172 switch (mode) { 172 switch (mode) {
diff --git a/src/core/hle/service/am/applets/applet_general_backend.cpp b/src/core/hle/service/am/applets/applet_general_backend.cpp
index e50acdaf6..1eefa85e3 100644
--- a/src/core/hle/service/am/applets/applet_general_backend.cpp
+++ b/src/core/hle/service/am/applets/applet_general_backend.cpp
@@ -186,7 +186,7 @@ void PhotoViewer::Execute() {
186 const auto callback = [this] { ViewFinished(); }; 186 const auto callback = [this] { ViewFinished(); };
187 switch (mode) { 187 switch (mode) {
188 case PhotoViewerAppletMode::CurrentApp: 188 case PhotoViewerAppletMode::CurrentApp:
189 frontend.ShowPhotosForApplication(system.GetCurrentProcessProgramID(), callback); 189 frontend.ShowPhotosForApplication(system.GetApplicationProcessProgramID(), callback);
190 break; 190 break;
191 case PhotoViewerAppletMode::AllApps: 191 case PhotoViewerAppletMode::AllApps:
192 frontend.ShowAllPhotos(callback); 192 frontend.ShowAllPhotos(callback);
diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp
index 14aa6f69e..f061bae80 100644
--- a/src/core/hle/service/am/applets/applet_web_browser.cpp
+++ b/src/core/hle/service/am/applets/applet_web_browser.cpp
@@ -393,7 +393,7 @@ void WebBrowser::InitializeOffline() {
393 switch (document_kind) { 393 switch (document_kind) {
394 case DocumentKind::OfflineHtmlPage: 394 case DocumentKind::OfflineHtmlPage:
395 default: 395 default:
396 title_id = system.GetCurrentProcessProgramID(); 396 title_id = system.GetApplicationProcessProgramID();
397 nca_type = FileSys::ContentRecordType::HtmlDocument; 397 nca_type = FileSys::ContentRecordType::HtmlDocument;
398 additional_paths = "html-document"; 398 additional_paths = "html-document";
399 break; 399 break;
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index 368ccd52f..7264f23f9 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -155,7 +155,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
155 IPC::ResponseBuilder rb{ctx, 3}; 155 IPC::ResponseBuilder rb{ctx, 3};
156 rb.Push(ResultSuccess); 156 rb.Push(ResultSuccess);
157 157
158 const auto current = system.GetCurrentProcessProgramID(); 158 const auto current = system.GetApplicationProcessProgramID();
159 159
160 const auto& disabled = Settings::values.disabled_addons[current]; 160 const auto& disabled = Settings::values.disabled_addons[current];
161 if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) { 161 if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) {
@@ -182,7 +182,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
182 LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, 182 LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count,
183 process_id); 183 process_id);
184 184
185 const auto current = system.GetCurrentProcessProgramID(); 185 const auto current = system.GetApplicationProcessProgramID();
186 186
187 std::vector<u32> out; 187 std::vector<u32> out;
188 const auto& disabled = Settings::values.disabled_addons[current]; 188 const auto& disabled = Settings::values.disabled_addons[current];
@@ -228,7 +228,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
228 IPC::ResponseBuilder rb{ctx, 4}; 228 IPC::ResponseBuilder rb{ctx, 4};
229 rb.Push(ResultSuccess); 229 rb.Push(ResultSuccess);
230 230
231 const auto title_id = system.GetCurrentProcessProgramID(); 231 const auto title_id = system.GetApplicationProcessProgramID();
232 const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), 232 const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
233 system.GetContentProvider()}; 233 system.GetContentProvider()};
234 234
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 0ee28752c..7d730421d 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -455,7 +455,7 @@ void AudRenU::OpenAudioRenderer(Kernel::HLERequestContext& ctx) {
455 return; 455 return;
456 } 456 }
457 457
458 const auto& handle_table{system.CurrentProcess()->GetHandleTable()}; 458 const auto& handle_table{system.ApplicationProcess()->GetHandleTable()};
459 auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)}; 459 auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)};
460 auto transfer_memory{ 460 auto transfer_memory{
461 process->GetHandleTable().GetObject<Kernel::KTransferMemory>(transfer_memory_handle)}; 461 process->GetHandleTable().GetObject<Kernel::KTransferMemory>(transfer_memory_handle)};
diff --git a/src/core/hle/service/bcat/bcat_module.cpp b/src/core/hle/service/bcat/bcat_module.cpp
index cbe690a5d..6e6fed227 100644
--- a/src/core/hle/service/bcat/bcat_module.cpp
+++ b/src/core/hle/service/bcat/bcat_module.cpp
@@ -176,8 +176,8 @@ private:
176 void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) { 176 void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
177 LOG_DEBUG(Service_BCAT, "called"); 177 LOG_DEBUG(Service_BCAT, "called");
178 178
179 backend.Synchronize({system.GetCurrentProcessProgramID(), 179 backend.Synchronize({system.GetApplicationProcessProgramID(),
180 GetCurrentBuildID(system.GetCurrentProcessBuildID())}, 180 GetCurrentBuildID(system.GetApplicationProcessBuildID())},
181 GetProgressBackend(SyncType::Normal)); 181 GetProgressBackend(SyncType::Normal));
182 182
183 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 183 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -193,8 +193,8 @@ private:
193 193
194 LOG_DEBUG(Service_BCAT, "called, name={}", name); 194 LOG_DEBUG(Service_BCAT, "called, name={}", name);
195 195
196 backend.SynchronizeDirectory({system.GetCurrentProcessProgramID(), 196 backend.SynchronizeDirectory({system.GetApplicationProcessProgramID(),
197 GetCurrentBuildID(system.GetCurrentProcessBuildID())}, 197 GetCurrentBuildID(system.GetApplicationProcessBuildID())},
198 name, GetProgressBackend(SyncType::Directory)); 198 name, GetProgressBackend(SyncType::Directory));
199 199
200 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 200 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -554,7 +554,7 @@ private:
554void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) { 554void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) {
555 LOG_DEBUG(Service_BCAT, "called"); 555 LOG_DEBUG(Service_BCAT, "called");
556 556
557 const auto title_id = system.GetCurrentProcessProgramID(); 557 const auto title_id = system.GetApplicationProcessProgramID();
558 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 558 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
559 rb.Push(ResultSuccess); 559 rb.Push(ResultSuccess);
560 rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id)); 560 rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id));
diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp
index 27675615b..2e5919330 100644
--- a/src/core/hle/service/fatal/fatal.cpp
+++ b/src/core/hle/service/fatal/fatal.cpp
@@ -63,7 +63,7 @@ enum class FatalType : u32 {
63}; 63};
64 64
65static void GenerateErrorReport(Core::System& system, Result error_code, const FatalInfo& info) { 65static void GenerateErrorReport(Core::System& system, Result error_code, const FatalInfo& info) {
66 const auto title_id = system.GetCurrentProcessProgramID(); 66 const auto title_id = system.GetApplicationProcessProgramID();
67 std::string crash_report = fmt::format( 67 std::string crash_report = fmt::format(
68 "Yuzu {}-{} crash report\n" 68 "Yuzu {}-{} crash report\n"
69 "Title ID: {:016x}\n" 69 "Title ID: {:016x}\n"
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 11c604a0f..177447bc1 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -317,7 +317,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenRomFSCurrentProcess()
317 return ResultUnknown; 317 return ResultUnknown;
318 } 318 }
319 319
320 return romfs_factory->OpenCurrentProcess(system.GetCurrentProcessProgramID()); 320 return romfs_factory->OpenCurrentProcess(system.GetApplicationProcessProgramID());
321} 321}
322 322
323ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFS( 323ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFS(
@@ -502,7 +502,7 @@ FileSys::SaveDataSize FileSystemController::ReadSaveDataSize(FileSys::SaveDataTy
502 const auto res = system.GetAppLoader().ReadControlData(nacp); 502 const auto res = system.GetAppLoader().ReadControlData(nacp);
503 503
504 if (res != Loader::ResultStatus::Success) { 504 if (res != Loader::ResultStatus::Success) {
505 const FileSys::PatchManager pm{system.GetCurrentProcessProgramID(), 505 const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(),
506 system.GetFileSystemController(), 506 system.GetFileSystemController(),
507 system.GetContentProvider()}; 507 system.GetContentProvider()};
508 const auto metadata = pm.GetControlMetadata(); 508 const auto metadata = pm.GetControlMetadata();
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 447d624e1..e76346ca9 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -1036,8 +1036,9 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) {
1036 1036
1037 LOG_DEBUG(Service_FS, "called, program_index={}", program_index); 1037 LOG_DEBUG(Service_FS, "called, program_index={}", program_index);
1038 1038
1039 auto patched_romfs = fsc.OpenPatchedRomFSWithProgramIndex( 1039 auto patched_romfs =
1040 system.GetCurrentProcessProgramID(), program_index, FileSys::ContentRecordType::Program); 1040 fsc.OpenPatchedRomFSWithProgramIndex(system.GetApplicationProcessProgramID(), program_index,
1041 FileSys::ContentRecordType::Program);
1041 1042
1042 if (patched_romfs.Failed()) { 1043 if (patched_romfs.Failed()) {
1043 // TODO: Find the right error code to use here 1044 // TODO: Find the right error code to use here
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index cd6d000ef..eb3c45a58 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -1830,7 +1830,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1830 ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes"); 1830 ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes");
1831 ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes"); 1831 ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes");
1832 1832
1833 auto t_mem_1 = system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( 1833 auto t_mem_1 = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
1834 t_mem_1_handle); 1834 t_mem_1_handle);
1835 1835
1836 if (t_mem_1.IsNull()) { 1836 if (t_mem_1.IsNull()) {
@@ -1840,7 +1840,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
1840 return; 1840 return;
1841 } 1841 }
1842 1842
1843 auto t_mem_2 = system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>( 1843 auto t_mem_2 = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
1844 t_mem_2_handle); 1844 t_mem_2_handle);
1845 1845
1846 if (t_mem_2.IsNull()) { 1846 if (t_mem_2.IsNull()) {
@@ -2127,8 +2127,8 @@ void Hid::WritePalmaWaveEntry(Kernel::HLERequestContext& ctx) {
2127 2127
2128 ASSERT_MSG(t_mem_size == 0x3000, "t_mem_size is not 0x3000 bytes"); 2128 ASSERT_MSG(t_mem_size == 0x3000, "t_mem_size is not 0x3000 bytes");
2129 2129
2130 auto t_mem = 2130 auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
2131 system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle); 2131 t_mem_handle);
2132 2132
2133 if (t_mem.IsNull()) { 2133 if (t_mem.IsNull()) {
2134 LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); 2134 LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle);
diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp
index 17252a84a..bd94e8f3d 100644
--- a/src/core/hle/service/hid/hidbus.cpp
+++ b/src/core/hle/service/hid/hidbus.cpp
@@ -449,8 +449,8 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) {
449 449
450 ASSERT_MSG(t_mem_size == 0x1000, "t_mem_size is not 0x1000 bytes"); 450 ASSERT_MSG(t_mem_size == 0x1000, "t_mem_size is not 0x1000 bytes");
451 451
452 auto t_mem = 452 auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
453 system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle); 453 t_mem_handle);
454 454
455 if (t_mem.IsNull()) { 455 if (t_mem.IsNull()) {
456 LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); 456 LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle);
diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp
index 52f402c56..3bd418e92 100644
--- a/src/core/hle/service/hid/irs.cpp
+++ b/src/core/hle/service/hid/irs.cpp
@@ -196,8 +196,8 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) {
196 const auto parameters{rp.PopRaw<Parameters>()}; 196 const auto parameters{rp.PopRaw<Parameters>()};
197 const auto t_mem_handle{ctx.GetCopyHandle(0)}; 197 const auto t_mem_handle{ctx.GetCopyHandle(0)};
198 198
199 auto t_mem = 199 auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
200 system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle); 200 t_mem_handle);
201 201
202 if (t_mem.IsNull()) { 202 if (t_mem.IsNull()) {
203 LOG_ERROR(Service_IRS, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); 203 LOG_ERROR(Service_IRS, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle);
@@ -445,8 +445,8 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) {
445 const auto parameters{rp.PopRaw<Parameters>()}; 445 const auto parameters{rp.PopRaw<Parameters>()};
446 const auto t_mem_handle{ctx.GetCopyHandle(0)}; 446 const auto t_mem_handle{ctx.GetCopyHandle(0)};
447 447
448 auto t_mem = 448 auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
449 system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle); 449 t_mem_handle);
450 450
451 u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress()); 451 u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress());
452 452
diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp
index 1295a44c7..47a1277ea 100644
--- a/src/core/hle/service/jit/jit.cpp
+++ b/src/core/hle/service/jit/jit.cpp
@@ -353,9 +353,9 @@ public:
353 return; 353 return;
354 } 354 }
355 355
356 // Fetch using the handle table for the current process here, 356 // Fetch using the handle table for the application process here,
357 // since we are not multiprocess yet. 357 // since we are not multiprocess yet.
358 const auto& handle_table{system.CurrentProcess()->GetHandleTable()}; 358 const auto& handle_table{system.ApplicationProcess()->GetHandleTable()};
359 359
360 auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)}; 360 auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)};
361 if (process.IsNull()) { 361 if (process.IsNull()) {
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp
index 652441bc2..2d4d6fe3e 100644
--- a/src/core/hle/service/ldr/ldr.cpp
+++ b/src/core/hle/service/ldr/ldr.cpp
@@ -246,7 +246,7 @@ public:
246 return; 246 return;
247 } 247 }
248 248
249 if (system.GetCurrentProcessProgramID() != header.application_id) { 249 if (system.GetApplicationProcessProgramID() != header.application_id) {
250 LOG_ERROR(Service_LDR, 250 LOG_ERROR(Service_LDR,
251 "Attempting to load NRR with title ID other than current process. (actual " 251 "Attempting to load NRR with title ID other than current process. (actual "
252 "{:016X})!", 252 "{:016X})!",
@@ -542,15 +542,16 @@ public:
542 } 542 }
543 543
544 // Map memory for the NRO 544 // Map memory for the NRO
545 const auto map_result{MapNro(system.CurrentProcess(), nro_address, nro_size, bss_address, 545 const auto map_result{MapNro(system.ApplicationProcess(), nro_address, nro_size,
546 bss_size, nro_size + bss_size)}; 546 bss_address, bss_size, nro_size + bss_size)};
547 if (map_result.Failed()) { 547 if (map_result.Failed()) {
548 IPC::ResponseBuilder rb{ctx, 2}; 548 IPC::ResponseBuilder rb{ctx, 2};
549 rb.Push(map_result.Code()); 549 rb.Push(map_result.Code());
550 } 550 }
551 551
552 // Load the NRO into the mapped memory 552 // Load the NRO into the mapped memory
553 if (const auto result{LoadNro(system.CurrentProcess(), header, nro_address, *map_result)}; 553 if (const auto result{
554 LoadNro(system.ApplicationProcess(), header, nro_address, *map_result)};
554 result.IsError()) { 555 result.IsError()) {
555 IPC::ResponseBuilder rb{ctx, 2}; 556 IPC::ResponseBuilder rb{ctx, 2};
556 rb.Push(map_result.Code()); 557 rb.Push(map_result.Code());
@@ -570,7 +571,7 @@ public:
570 571
571 Result UnmapNro(const NROInfo& info) { 572 Result UnmapNro(const NROInfo& info) {
572 // Each region must be unmapped separately to validate memory state 573 // Each region must be unmapped separately to validate memory state
573 auto& page_table{system.CurrentProcess()->PageTable()}; 574 auto& page_table{system.ApplicationProcess()->PageTable()};
574 575
575 if (info.bss_size != 0) { 576 if (info.bss_size != 0) {
576 CASCADE_CODE(page_table.UnmapCodeMemory( 577 CASCADE_CODE(page_table.UnmapCodeMemory(
@@ -641,7 +642,7 @@ public:
641 LOG_WARNING(Service_LDR, "(STUBBED) called"); 642 LOG_WARNING(Service_LDR, "(STUBBED) called");
642 643
643 initialized = true; 644 initialized = true;
644 current_map_addr = system.CurrentProcess()->PageTable().GetAliasCodeRegionStart(); 645 current_map_addr = system.ApplicationProcess()->PageTable().GetAliasCodeRegionStart();
645 646
646 IPC::ResponseBuilder rb{ctx, 2}; 647 IPC::ResponseBuilder rb{ctx, 2};
647 rb.Push(ResultSuccess); 648 rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp
index e67a76f55..7a6bbbba7 100644
--- a/src/core/hle/service/nfp/nfp_device.cpp
+++ b/src/core/hle/service/nfp/nfp_device.cpp
@@ -618,7 +618,7 @@ Result NfpDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> dat
618 sizeof(ApplicationArea) - data.size()); 618 sizeof(ApplicationArea) - data.size());
619 619
620 // TODO: Investigate why the title id needs to be moddified 620 // TODO: Investigate why the title id needs to be moddified
621 tag_data.title_id = system.GetCurrentProcessProgramID(); 621 tag_data.title_id = system.GetApplicationProcessProgramID();
622 tag_data.title_id = tag_data.title_id | 0x30000000ULL; 622 tag_data.title_id = tag_data.title_id | 0x30000000ULL;
623 tag_data.settings.settings.appdata_initialized.Assign(1); 623 tag_data.settings.settings.appdata_initialized.Assign(1);
624 tag_data.application_area_id = access_id; 624 tag_data.application_area_id = access_id;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index 0cdde82a7..e12025560 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -150,9 +150,9 @@ NvResult nvhost_ctrl::IocCtrlEventWait(std::span<const u8> input, std::vector<u8
150 const auto check_failing = [&]() { 150 const auto check_failing = [&]() {
151 if (events[slot].fails > 2) { 151 if (events[slot].fails > 2) {
152 { 152 {
153 auto lk = system.StallProcesses(); 153 auto lk = system.StallApplication();
154 host1x_syncpoint_manager.WaitHost(fence_id, target_value); 154 host1x_syncpoint_manager.WaitHost(fence_id, target_value);
155 system.UnstallProcesses(); 155 system.UnstallApplication();
156 } 156 }
157 params.value.raw = target_value; 157 params.value.raw = target_value;
158 return true; 158 return true;
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp
index 29c1e0f01..277afe0b4 100644
--- a/src/core/hle/service/nvdrv/devices/nvmap.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp
@@ -127,7 +127,7 @@ NvResult nvmap::IocAlloc(std::span<const u8> input, std::vector<u8>& output) {
127 return result; 127 return result;
128 } 128 }
129 bool is_out_io{}; 129 bool is_out_io{};
130 ASSERT(system.CurrentProcess() 130 ASSERT(system.ApplicationProcess()
131 ->PageTable() 131 ->PageTable()
132 .LockForMapDeviceAddressSpace(&is_out_io, handle_description->address, 132 .LockForMapDeviceAddressSpace(&is_out_io, handle_description->address,
133 handle_description->size, 133 handle_description->size,
@@ -254,7 +254,7 @@ NvResult nvmap::IocFree(std::span<const u8> input, std::vector<u8>& output) {
254 254
255 if (auto freeInfo{file.FreeHandle(params.handle, false)}) { 255 if (auto freeInfo{file.FreeHandle(params.handle, false)}) {
256 if (freeInfo->can_unlock) { 256 if (freeInfo->can_unlock) {
257 ASSERT(system.CurrentProcess() 257 ASSERT(system.ApplicationProcess()
258 ->PageTable() 258 ->PageTable()
259 .UnlockForDeviceAddressSpace(freeInfo->address, freeInfo->size) 259 .UnlockForDeviceAddressSpace(freeInfo->address, freeInfo->size)
260 .IsSuccess()); 260 .IsSuccess());
diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp
index 2a123b42d..083609b34 100644
--- a/src/core/hle/service/pctl/pctl_module.cpp
+++ b/src/core/hle/service/pctl/pctl_module.cpp
@@ -187,7 +187,7 @@ private:
187 187
188 // TODO(ogniK): Recovery flag initialization for pctl:r 188 // TODO(ogniK): Recovery flag initialization for pctl:r
189 189
190 const auto tid = system.GetCurrentProcessProgramID(); 190 const auto tid = system.GetApplicationProcessProgramID();
191 if (tid != 0) { 191 if (tid != 0) {
192 const FileSys::PatchManager pm{tid, system.GetFileSystemController(), 192 const FileSys::PatchManager pm{tid, system.GetFileSystemController(),
193 system.GetContentProvider()}; 193 system.GetContentProvider()};
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp
index 01040b32a..90c5f8756 100644
--- a/src/core/hle/service/prepo/prepo.cpp
+++ b/src/core/hle/service/prepo/prepo.cpp
@@ -71,7 +71,7 @@ private:
71 Type, process_id, data1.size(), data2.size()); 71 Type, process_id, data1.size(), data2.size());
72 72
73 const auto& reporter{system.GetReporter()}; 73 const auto& reporter{system.GetReporter()};
74 reporter.SavePlayReport(Type, system.GetCurrentProcessProgramID(), {data1, data2}, 74 reporter.SavePlayReport(Type, system.GetApplicationProcessProgramID(), {data1, data2},
75 process_id); 75 process_id);
76 76
77 IPC::ResponseBuilder rb{ctx, 2}; 77 IPC::ResponseBuilder rb{ctx, 2};
@@ -99,7 +99,7 @@ private:
99 Type, user_id[1], user_id[0], process_id, data1.size(), data2.size()); 99 Type, user_id[1], user_id[0], process_id, data1.size(), data2.size());
100 100
101 const auto& reporter{system.GetReporter()}; 101 const auto& reporter{system.GetReporter()};
102 reporter.SavePlayReport(Type, system.GetCurrentProcessProgramID(), {data1, data2}, 102 reporter.SavePlayReport(Type, system.GetApplicationProcessProgramID(), {data1, data2},
103 process_id, user_id); 103 process_id, user_id);
104 104
105 IPC::ResponseBuilder rb{ctx, 2}; 105 IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 4c3b3c655..a5c384fb5 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -145,7 +145,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core::
145 145
146 // Apply cheats if they exist and the program has a valid title ID 146 // Apply cheats if they exist and the program has a valid title ID
147 if (pm) { 147 if (pm) {
148 system.SetCurrentProcessBuildID(nso_header.build_id); 148 system.SetApplicationProcessBuildID(nso_header.build_id);
149 const auto cheats = pm->CreateCheatList(nso_header.build_id); 149 const auto cheats = pm->CreateCheatList(nso_header.build_id);
150 if (!cheats.empty()) { 150 if (!cheats.empty()) {
151 system.RegisterCheatList(cheats, nso_header.build_id, load_base, image_size); 151 system.RegisterCheatList(cheats, nso_header.build_id, load_base, image_size);
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index af9660b55..4397fcfb1 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -247,11 +247,11 @@ struct Memory::Impl {
247 } 247 }
248 248
249 void ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_t size) { 249 void ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_t size) {
250 ReadBlockImpl<false>(*system.CurrentProcess(), src_addr, dest_buffer, size); 250 ReadBlockImpl<false>(*system.ApplicationProcess(), src_addr, dest_buffer, size);
251 } 251 }
252 252
253 void ReadBlockUnsafe(const VAddr src_addr, void* dest_buffer, const std::size_t size) { 253 void ReadBlockUnsafe(const VAddr src_addr, void* dest_buffer, const std::size_t size) {
254 ReadBlockImpl<true>(*system.CurrentProcess(), src_addr, dest_buffer, size); 254 ReadBlockImpl<true>(*system.ApplicationProcess(), src_addr, dest_buffer, size);
255 } 255 }
256 256
257 template <bool UNSAFE> 257 template <bool UNSAFE>
@@ -279,11 +279,11 @@ struct Memory::Impl {
279 } 279 }
280 280
281 void WriteBlock(const VAddr dest_addr, const void* src_buffer, const std::size_t size) { 281 void WriteBlock(const VAddr dest_addr, const void* src_buffer, const std::size_t size) {
282 WriteBlockImpl<false>(*system.CurrentProcess(), dest_addr, src_buffer, size); 282 WriteBlockImpl<false>(*system.ApplicationProcess(), dest_addr, src_buffer, size);
283 } 283 }
284 284
285 void WriteBlockUnsafe(const VAddr dest_addr, const void* src_buffer, const std::size_t size) { 285 void WriteBlockUnsafe(const VAddr dest_addr, const void* src_buffer, const std::size_t size) {
286 WriteBlockImpl<true>(*system.CurrentProcess(), dest_addr, src_buffer, size); 286 WriteBlockImpl<true>(*system.ApplicationProcess(), dest_addr, src_buffer, size);
287 } 287 }
288 288
289 void ZeroBlock(const Kernel::KProcess& process, const VAddr dest_addr, const std::size_t size) { 289 void ZeroBlock(const Kernel::KProcess& process, const VAddr dest_addr, const std::size_t size) {
@@ -711,7 +711,7 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) {
711} 711}
712 712
713bool Memory::IsValidVirtualAddress(const VAddr vaddr) const { 713bool Memory::IsValidVirtualAddress(const VAddr vaddr) const {
714 const Kernel::KProcess& process = *system.CurrentProcess(); 714 const Kernel::KProcess& process = *system.ApplicationProcess();
715 const auto& page_table = process.PageTable().PageTableImpl(); 715 const auto& page_table = process.PageTable().PageTableImpl();
716 const size_t page = vaddr >> YUZU_PAGEBITS; 716 const size_t page = vaddr >> YUZU_PAGEBITS;
717 if (page >= page_table.pointers.size()) { 717 if (page >= page_table.pointers.size()) {
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp
index ffdbacc18..44ee39648 100644
--- a/src/core/memory/cheat_engine.cpp
+++ b/src/core/memory/cheat_engine.cpp
@@ -191,10 +191,10 @@ void CheatEngine::Initialize() {
191 }); 191 });
192 core_timing.ScheduleLoopingEvent(CHEAT_ENGINE_NS, CHEAT_ENGINE_NS, event); 192 core_timing.ScheduleLoopingEvent(CHEAT_ENGINE_NS, CHEAT_ENGINE_NS, event);
193 193
194 metadata.process_id = system.CurrentProcess()->GetProcessID(); 194 metadata.process_id = system.ApplicationProcess()->GetProcessID();
195 metadata.title_id = system.GetCurrentProcessProgramID(); 195 metadata.title_id = system.GetApplicationProcessProgramID();
196 196
197 const auto& page_table = system.CurrentProcess()->PageTable(); 197 const auto& page_table = system.ApplicationProcess()->PageTable();
198 metadata.heap_extents = { 198 metadata.heap_extents = {
199 .base = page_table.GetHeapRegionStart(), 199 .base = page_table.GetHeapRegionStart(),
200 .size = page_table.GetHeapRegionSize(), 200 .size = page_table.GetHeapRegionSize(),
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp
index 59dfb8767..708ae17aa 100644
--- a/src/core/reporter.cpp
+++ b/src/core/reporter.cpp
@@ -110,7 +110,7 @@ json GetProcessorStateData(const std::string& architecture, u64 entry_point, u64
110} 110}
111 111
112json GetProcessorStateDataAuto(Core::System& system) { 112json GetProcessorStateDataAuto(Core::System& system) {
113 const auto* process{system.CurrentProcess()}; 113 const auto* process{system.ApplicationProcess()};
114 auto& arm{system.CurrentArmInterface()}; 114 auto& arm{system.CurrentArmInterface()};
115 115
116 Core::ARM_Interface::ThreadContext64 context{}; 116 Core::ARM_Interface::ThreadContext64 context{};
@@ -234,7 +234,7 @@ void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64
234 } 234 }
235 235
236 const auto timestamp = GetTimestamp(); 236 const auto timestamp = GetTimestamp();
237 const auto title_id = system.GetCurrentProcessProgramID(); 237 const auto title_id = system.GetApplicationProcessProgramID();
238 auto out = GetFullDataAuto(timestamp, title_id, system); 238 auto out = GetFullDataAuto(timestamp, title_id, system);
239 239
240 auto break_out = json{ 240 auto break_out = json{
@@ -261,7 +261,7 @@ void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u
261 } 261 }
262 262
263 const auto timestamp = GetTimestamp(); 263 const auto timestamp = GetTimestamp();
264 const auto title_id = system.GetCurrentProcessProgramID(); 264 const auto title_id = system.GetApplicationProcessProgramID();
265 auto out = GetFullDataAuto(timestamp, title_id, system); 265 auto out = GetFullDataAuto(timestamp, title_id, system);
266 266
267 auto function_out = GetHLERequestContextData(ctx, system.Memory()); 267 auto function_out = GetHLERequestContextData(ctx, system.Memory());
@@ -283,7 +283,7 @@ void Reporter::SaveUnimplementedAppletReport(
283 } 283 }
284 284
285 const auto timestamp = GetTimestamp(); 285 const auto timestamp = GetTimestamp();
286 const auto title_id = system.GetCurrentProcessProgramID(); 286 const auto title_id = system.GetApplicationProcessProgramID();
287 auto out = GetFullDataAuto(timestamp, title_id, system); 287 auto out = GetFullDataAuto(timestamp, title_id, system);
288 288
289 out["applet_common_args"] = { 289 out["applet_common_args"] = {
@@ -376,7 +376,7 @@ void Reporter::SaveUserReport() const {
376 } 376 }
377 377
378 const auto timestamp = GetTimestamp(); 378 const auto timestamp = GetTimestamp();
379 const auto title_id = system.GetCurrentProcessProgramID(); 379 const auto title_id = system.GetApplicationProcessProgramID();
380 380
381 SaveToFile(GetFullDataAuto(timestamp, title_id, system), 381 SaveToFile(GetFullDataAuto(timestamp, title_id, system),
382 GetPath("user_report", title_id, timestamp)); 382 GetPath("user_report", title_id, timestamp));
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index d65991734..352300e88 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -67,7 +67,7 @@ void EmuThread::run() {
67 emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0); 67 emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
68 if (Settings::values.use_disk_shader_cache.GetValue()) { 68 if (Settings::values.use_disk_shader_cache.GetValue()) {
69 m_system.Renderer().ReadRasterizer()->LoadDiskResources( 69 m_system.Renderer().ReadRasterizer()->LoadDiskResources(
70 m_system.GetCurrentProcessProgramID(), stop_token, 70 m_system.GetApplicationProcessProgramID(), stop_token,
71 [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) { 71 [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
72 emit LoadProgress(stage, value, total); 72 emit LoadProgress(stage, value, total);
73 }); 73 });
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 7629904b3..a1c18ff90 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1779,7 +1779,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1779 std::filesystem::path{Common::U16StringFromBuffer(filename.utf16(), filename.size())} 1779 std::filesystem::path{Common::U16StringFromBuffer(filename.utf16(), filename.size())}
1780 .filename()); 1780 .filename());
1781 } 1781 }
1782 const bool is_64bit = system->Kernel().CurrentProcess()->Is64BitProcess(); 1782 const bool is_64bit = system->Kernel().ApplicationProcess()->Is64BitProcess();
1783 const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)"); 1783 const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)");
1784 title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit") 1784 title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit")
1785 .arg(QString::fromStdString(title_name), instruction_set_suffix) 1785 .arg(QString::fromStdString(title_name), instruction_set_suffix)
@@ -3532,7 +3532,7 @@ void GMainWindow::OnToggleGraphicsAPI() {
3532} 3532}
3533 3533
3534void GMainWindow::OnConfigurePerGame() { 3534void GMainWindow::OnConfigurePerGame() {
3535 const u64 title_id = system->GetCurrentProcessProgramID(); 3535 const u64 title_id = system->GetApplicationProcessProgramID();
3536 OpenPerGameConfiguration(title_id, current_game_path.toStdString()); 3536 OpenPerGameConfiguration(title_id, current_game_path.toStdString());
3537} 3537}
3538 3538
@@ -3691,7 +3691,7 @@ void GMainWindow::OnCaptureScreenshot() {
3691 return; 3691 return;
3692 } 3692 }
3693 3693
3694 const u64 title_id = system->GetCurrentProcessProgramID(); 3694 const u64 title_id = system->GetApplicationProcessProgramID();
3695 const auto screenshot_path = 3695 const auto screenshot_path =
3696 QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); 3696 QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir));
3697 const auto date = 3697 const auto date =
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index d1f7b1d49..77edd58ca 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -405,7 +405,7 @@ int main(int argc, char** argv) {
405 405
406 if (Settings::values.use_disk_shader_cache.GetValue()) { 406 if (Settings::values.use_disk_shader_cache.GetValue()) {
407 system.Renderer().ReadRasterizer()->LoadDiskResources( 407 system.Renderer().ReadRasterizer()->LoadDiskResources(
408 system.GetCurrentProcessProgramID(), std::stop_token{}, 408 system.GetApplicationProcessProgramID(), std::stop_token{},
409 [](VideoCore::LoadCallbackStage, size_t value, size_t total) {}); 409 [](VideoCore::LoadCallbackStage, size_t value, size_t total) {});
410 } 410 }
411 411