summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.cpp2
-rw-r--r--src/audio_core/renderer/command/command_buffer.cpp4
-rw-r--r--src/audio_core/renderer/command/command_generator.cpp2
-rw-r--r--src/audio_core/renderer/command/effect/aux_.cpp130
-rw-r--r--src/audio_core/renderer/command/effect/i3dl2_reverb.cpp8
-rw-r--r--src/audio_core/renderer/command/effect/reverb.cpp8
-rw-r--r--src/audio_core/renderer/command/resample/upsample.cpp12
-rw-r--r--src/audio_core/renderer/system.cpp2
-rw-r--r--src/audio_core/renderer/system_manager.cpp2
-rw-r--r--src/audio_core/sink/sink_stream.cpp8
-rw-r--r--src/core/CMakeLists.txt16
-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/core_timing.cpp2
-rw-r--r--src/core/debugger/gdbstub.cpp28
-rw-r--r--src/core/debugger/gdbstub_arch.cpp14
-rw-r--r--src/core/debugger/gdbstub_arch.h6
-rw-r--r--src/core/file_sys/ips_layer.cpp8
-rw-r--r--src/core/file_sys/registered_cache.cpp2
-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.cpp7
-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.cpp26
-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/am/tcap.cpp22
-rw-r--r--src/core/hle/service/am/tcap.h20
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp6
-rw-r--r--src/core/hle/service/apm/apm.cpp2
-rw-r--r--src/core/hle/service/apm/apm_controller.cpp2
-rw-r--r--src/core/hle/service/audio/auddbg.cpp21
-rw-r--r--src/core/hle/service/audio/auddbg.h20
-rw-r--r--src/core/hle/service/audio/audin_a.cpp23
-rw-r--r--src/core/hle/service/audio/audin_a.h20
-rw-r--r--src/core/hle/service/audio/audio.cpp14
-rw-r--r--src/core/hle/service/audio/audout_a.cpp25
-rw-r--r--src/core/hle/service/audio/audout_a.h20
-rw-r--r--src/core/hle/service/audio/audren_a.cpp27
-rw-r--r--src/core/hle/service/audio/audren_a.h20
-rw-r--r--src/core/hle/service/audio/audren_u.cpp2
-rw-r--r--src/core/hle/service/audio/codecctl.cpp29
-rw-r--r--src/core/hle/service/audio/codecctl.h20
-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.cpp22
-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/core/syncpoint_manager.h2
-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/pcv/pcv.cpp28
-rw-r--r--src/core/hle/service/prepo/prepo.cpp4
-rw-r--r--src/core/hle/service/service.cpp2
-rw-r--r--src/core/hle/service/sockets/ethc.cpp42
-rw-r--r--src/core/hle/service/sockets/ethc.h26
-rw-r--r--src/core/hle/service/sockets/sockets.cpp4
-rw-r--r--src/core/hle/service/time/time_zone_manager.cpp2
-rw-r--r--src/core/hle/service/wlan/wlan.cpp186
-rw-r--r--src/core/hle/service/wlan/wlan.h18
-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/core/telemetry_session.cpp2
-rw-r--r--src/input_common/drivers/joycon.cpp2
-rw-r--r--src/input_common/drivers/sdl_driver.cpp4
-rw-r--r--src/video_core/engines/maxwell_3d.cpp6
-rw-r--r--src/video_core/memory_manager.h2
-rw-r--r--src/video_core/renderer_vulkan/vk_smaa.cpp14
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.h2
-rw-r--r--src/video_core/renderer_vulkan/vk_turbo_mode.cpp4
-rw-r--r--src/video_core/textures/decoders.cpp2
-rw-r--r--src/yuzu/bootmanager.cpp2
-rw-r--r--src/yuzu/configuration/config.cpp1
-rw-r--r--src/yuzu/game_list.cpp1
-rw-r--r--src/yuzu/game_list.h1
-rw-r--r--src/yuzu/main.cpp18
-rw-r--r--src/yuzu_cmd/yuzu.cpp2
122 files changed, 478 insertions, 1016 deletions
diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp
index d982ef630..78c15629b 100644
--- a/src/audio_core/renderer/adsp/audio_renderer.cpp
+++ b/src/audio_core/renderer/adsp/audio_renderer.cpp
@@ -132,7 +132,7 @@ void AudioRenderer::CreateSinkStreams() {
}
void AudioRenderer::ThreadFunc() {
- constexpr char name[]{"AudioRenderer"};
+ static constexpr char name[]{"AudioRenderer"};
MicroProfileOnThreadCreate(name);
Common::SetCurrentThreadName(name);
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
diff --git a/src/audio_core/renderer/command/command_buffer.cpp b/src/audio_core/renderer/command/command_buffer.cpp
index 8c6fe97e7..0bd418306 100644
--- a/src/audio_core/renderer/command/command_buffer.cpp
+++ b/src/audio_core/renderer/command/command_buffer.cpp
@@ -251,8 +251,8 @@ void CommandBuffer::GenerateBiquadFilterCommand(const s32 node_id, EffectInfoBas
const auto& parameter{
*reinterpret_cast<BiquadFilterInfo::ParameterVersion1*>(effect_info.GetParameter())};
- const auto state{
- reinterpret_cast<VoiceState::BiquadFilterState*>(effect_info.GetStateBuffer())};
+ const auto state{reinterpret_cast<VoiceState::BiquadFilterState*>(
+ effect_info.GetStateBuffer() + channel * sizeof(VoiceState::BiquadFilterState))};
cmd.input = buffer_offset + parameter.inputs[channel];
cmd.output = buffer_offset + parameter.outputs[channel];
diff --git a/src/audio_core/renderer/command/command_generator.cpp b/src/audio_core/renderer/command/command_generator.cpp
index 2ea50d128..fba84c7bd 100644
--- a/src/audio_core/renderer/command/command_generator.cpp
+++ b/src/audio_core/renderer/command/command_generator.cpp
@@ -46,7 +46,7 @@ void CommandGenerator::GenerateDataSourceCommand(VoiceInfo& voice_info,
while (destination != nullptr) {
if (destination->IsConfigured()) {
auto mix_id{destination->GetMixId()};
- if (mix_id < mix_context.GetCount()) {
+ if (mix_id < mix_context.GetCount() && mix_id != UnusedSplitterId) {
auto mix_info{mix_context.GetInfo(mix_id)};
command_buffer.GenerateDepopPrepareCommand(
voice_info.node_id, voice_state, render_context.depop_buffer,
diff --git a/src/audio_core/renderer/command/effect/aux_.cpp b/src/audio_core/renderer/command/effect/aux_.cpp
index e76db893f..c5650effa 100644
--- a/src/audio_core/renderer/command/effect/aux_.cpp
+++ b/src/audio_core/renderer/command/effect/aux_.cpp
@@ -4,6 +4,7 @@
#include "audio_core/renderer/adsp/command_list_processor.h"
#include "audio_core/renderer/command/effect/aux_.h"
#include "audio_core/renderer/effect/aux_.h"
+#include "core/core.h"
#include "core/memory.h"
namespace AudioCore::AudioRenderer {
@@ -19,10 +20,24 @@ static void ResetAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr aux_in
return;
}
- auto info{reinterpret_cast<AuxInfo::AuxInfoDsp*>(memory.GetPointer(aux_info))};
- info->read_offset = 0;
- info->write_offset = 0;
- info->total_sample_count = 0;
+ AuxInfo::AuxInfoDsp info{};
+ auto info_ptr{&info};
+ bool host_safe{(aux_info & Core::Memory::YUZU_PAGEMASK) <=
+ (Core::Memory::YUZU_PAGESIZE - sizeof(AuxInfo::AuxInfoDsp))};
+
+ if (host_safe) [[likely]] {
+ info_ptr = memory.GetPointer<AuxInfo::AuxInfoDsp>(aux_info);
+ } else {
+ memory.ReadBlockUnsafe(aux_info, info_ptr, sizeof(AuxInfo::AuxInfoDsp));
+ }
+
+ info_ptr->read_offset = 0;
+ info_ptr->write_offset = 0;
+ info_ptr->total_sample_count = 0;
+
+ if (!host_safe) [[unlikely]] {
+ memory.WriteBlockUnsafe(aux_info, info_ptr, sizeof(AuxInfo::AuxInfoDsp));
+ }
}
/**
@@ -40,11 +55,10 @@ static void ResetAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr aux_in
* @param update_count - If non-zero, send_info_ will be updated.
* @return Number of samples written.
*/
-static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_info_,
- [[maybe_unused]] u32 sample_count, const CpuAddr send_buffer,
- const u32 count_max, std::span<const s32> input,
- const u32 write_count_, const u32 write_offset,
- const u32 update_count) {
+static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr send_info_,
+ [[maybe_unused]] u32 sample_count, CpuAddr send_buffer, u32 count_max,
+ std::span<const s32> input, u32 write_count_, u32 write_offset,
+ u32 update_count) {
if (write_count_ > count_max) {
LOG_ERROR(Service_Audio,
"write_count must be smaller than count_max! write_count {}, count_max {}",
@@ -52,6 +66,11 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
return 0;
}
+ if (send_info_ == 0) {
+ LOG_ERROR(Service_Audio, "send_info_ is 0!");
+ return 0;
+ }
+
if (input.empty()) {
LOG_ERROR(Service_Audio, "input buffer is empty!");
return 0;
@@ -67,33 +86,47 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
}
AuxInfo::AuxInfoDsp send_info{};
- memory.ReadBlockUnsafe(send_info_, &send_info, sizeof(AuxInfo::AuxInfoDsp));
+ auto send_ptr = &send_info;
+ bool host_safe = (send_info_ & Core::Memory::YUZU_PAGEMASK) <=
+ (Core::Memory::YUZU_PAGESIZE - sizeof(AuxInfo::AuxInfoDsp));
- u32 target_write_offset{send_info.write_offset + write_offset};
- if (target_write_offset > count_max || write_count_ == 0) {
+ if (host_safe) [[likely]] {
+ send_ptr = memory.GetPointer<AuxInfo::AuxInfoDsp>(send_info_);
+ } else {
+ memory.ReadBlockUnsafe(send_info_, send_ptr, sizeof(AuxInfo::AuxInfoDsp));
+ }
+
+ u32 target_write_offset{send_ptr->write_offset + write_offset};
+ if (target_write_offset > count_max) {
return 0;
}
u32 write_count{write_count_};
- u32 write_pos{0};
+ u32 read_pos{0};
while (write_count > 0) {
u32 to_write{std::min(count_max - target_write_offset, write_count)};
-
- if (to_write > 0) {
+ const auto write_addr = send_buffer + target_write_offset * sizeof(s32);
+ bool write_safe{(write_addr & Core::Memory::YUZU_PAGEMASK) <=
+ (Core::Memory::YUZU_PAGESIZE - (write_addr + to_write * sizeof(s32)))};
+ if (write_safe) [[likely]] {
+ auto ptr = memory.GetPointer(write_addr);
+ std::memcpy(ptr, &input[read_pos], to_write * sizeof(s32));
+ } else {
memory.WriteBlockUnsafe(send_buffer + target_write_offset * sizeof(s32),
- &input[write_pos], to_write * sizeof(s32));
+ &input[read_pos], to_write * sizeof(s32));
}
-
target_write_offset = (target_write_offset + to_write) % count_max;
write_count -= to_write;
- write_pos += to_write;
+ read_pos += to_write;
}
if (update_count) {
- send_info.write_offset = (send_info.write_offset + update_count) % count_max;
+ send_ptr->write_offset = (send_ptr->write_offset + update_count) % count_max;
}
- memory.WriteBlockUnsafe(send_info_, &send_info, sizeof(AuxInfo::AuxInfoDsp));
+ if (!host_safe) [[unlikely]] {
+ memory.WriteBlockUnsafe(send_info_, send_ptr, sizeof(AuxInfo::AuxInfoDsp));
+ }
return write_count_;
}
@@ -102,7 +135,7 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
* Read the given memory at return_buffer into the output mix buffer, and update return_info_ if
* update_count is set, to notify the game that an update happened.
*
- * @param memory - Core memory for writing.
+ * @param memory - Core memory for reading.
* @param return_info_ - Meta information for where to read the mix buffer.
* @param return_buffer - Memory address to read the samples from.
* @param count_max - Maximum number of samples in the receiving buffer.
@@ -112,16 +145,21 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
* @param update_count - If non-zero, send_info_ will be updated.
* @return Number of samples read.
*/
-static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr return_info_,
- const CpuAddr return_buffer, const u32 count_max, std::span<s32> output,
- const u32 count_, const u32 read_offset, const u32 update_count) {
+static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr return_info_,
+ CpuAddr return_buffer, u32 count_max, std::span<s32> output,
+ u32 read_count_, u32 read_offset, u32 update_count) {
if (count_max == 0) {
return 0;
}
- if (count_ > count_max) {
+ if (read_count_ > count_max) {
LOG_ERROR(Service_Audio, "count must be smaller than count_max! count {}, count_max {}",
- count_, count_max);
+ read_count_, count_max);
+ return 0;
+ }
+
+ if (return_info_ == 0) {
+ LOG_ERROR(Service_Audio, "return_info_ is 0!");
return 0;
}
@@ -136,35 +174,49 @@ static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr return_i
}
AuxInfo::AuxInfoDsp return_info{};
- memory.ReadBlockUnsafe(return_info_, &return_info, sizeof(AuxInfo::AuxInfoDsp));
+ auto return_ptr = &return_info;
+ bool host_safe = (return_info_ & Core::Memory::YUZU_PAGEMASK) <=
+ (Core::Memory::YUZU_PAGESIZE - sizeof(AuxInfo::AuxInfoDsp));
+
+ if (host_safe) [[likely]] {
+ return_ptr = memory.GetPointer<AuxInfo::AuxInfoDsp>(return_info_);
+ } else {
+ memory.ReadBlockUnsafe(return_info_, return_ptr, sizeof(AuxInfo::AuxInfoDsp));
+ }
- u32 target_read_offset{return_info.read_offset + read_offset};
+ u32 target_read_offset{return_ptr->read_offset + read_offset};
if (target_read_offset > count_max) {
return 0;
}
- u32 read_count{count_};
- u32 read_pos{0};
+ u32 read_count{read_count_};
+ u32 write_pos{0};
while (read_count > 0) {
u32 to_read{std::min(count_max - target_read_offset, read_count)};
-
- if (to_read > 0) {
+ const auto read_addr = return_buffer + target_read_offset * sizeof(s32);
+ bool read_safe{(read_addr & Core::Memory::YUZU_PAGEMASK) <=
+ (Core::Memory::YUZU_PAGESIZE - (read_addr + to_read * sizeof(s32)))};
+ if (read_safe) [[likely]] {
+ auto ptr = memory.GetPointer(read_addr);
+ std::memcpy(&output[write_pos], ptr, to_read * sizeof(s32));
+ } else {
memory.ReadBlockUnsafe(return_buffer + target_read_offset * sizeof(s32),
- &output[read_pos], to_read * sizeof(s32));
+ &output[write_pos], to_read * sizeof(s32));
}
-
target_read_offset = (target_read_offset + to_read) % count_max;
read_count -= to_read;
- read_pos += to_read;
+ write_pos += to_read;
}
if (update_count) {
- return_info.read_offset = (return_info.read_offset + update_count) % count_max;
+ return_ptr->read_offset = (return_ptr->read_offset + update_count) % count_max;
}
- memory.WriteBlockUnsafe(return_info_, &return_info, sizeof(AuxInfo::AuxInfoDsp));
+ if (!host_safe) [[unlikely]] {
+ memory.WriteBlockUnsafe(return_info_, return_ptr, sizeof(AuxInfo::AuxInfoDsp));
+ }
- return count_;
+ return read_count_;
}
void AuxCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor,
@@ -189,7 +241,7 @@ void AuxCommand::Process(const ADSP::CommandListProcessor& processor) {
update_count)};
if (read != processor.sample_count) {
- std::memset(&output_buffer[read], 0, processor.sample_count - read);
+ std::memset(&output_buffer[read], 0, (processor.sample_count - read) * sizeof(s32));
}
} else {
ResetAuxBufferDsp(*processor.memory, send_buffer_info);
diff --git a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp
index 2187d8a65..27d8b9844 100644
--- a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp
+++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp
@@ -244,16 +244,16 @@ template <size_t NumChannels>
static void ApplyI3dl2ReverbEffect(I3dl2ReverbInfo::State& state,
std::span<std::span<const s32>> inputs,
std::span<std::span<s32>> outputs, const u32 sample_count) {
- constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
+ static constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
- constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
+ static constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1,
};
- constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
+ static constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 3,
};
- constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
+ static constexpr std::array<u8, I3dl2ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
2, 0, 0, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 0, 0, 0, 0, 5, 5, 5,
};
diff --git a/src/audio_core/renderer/command/effect/reverb.cpp b/src/audio_core/renderer/command/effect/reverb.cpp
index 427489214..6fe844ff0 100644
--- a/src/audio_core/renderer/command/effect/reverb.cpp
+++ b/src/audio_core/renderer/command/effect/reverb.cpp
@@ -252,16 +252,16 @@ template <size_t NumChannels>
static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, ReverbInfo::State& state,
std::vector<std::span<const s32>>& inputs,
std::vector<std::span<s32>>& outputs, const u32 sample_count) {
- constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
+ static constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes1Ch{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
- constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
+ static constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes2Ch{
0, 0, 1, 1, 0, 1, 0, 0, 1, 1,
};
- constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
+ static constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes4Ch{
0, 0, 1, 1, 0, 1, 2, 2, 3, 3,
};
- constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
+ static constexpr std::array<u8, ReverbInfo::MaxDelayTaps> OutTapIndexes6Ch{
0, 0, 1, 1, 2, 2, 4, 4, 5, 5,
};
diff --git a/src/audio_core/renderer/command/resample/upsample.cpp b/src/audio_core/renderer/command/resample/upsample.cpp
index 5f7db12ca..86ddee1a4 100644
--- a/src/audio_core/renderer/command/resample/upsample.cpp
+++ b/src/audio_core/renderer/command/resample/upsample.cpp
@@ -19,24 +19,24 @@ namespace AudioCore::AudioRenderer {
static void SrcProcessFrame(std::span<s32> output, std::span<const s32> input,
const u32 target_sample_count, const u32 source_sample_count,
UpsamplerState* state) {
- constexpr u32 WindowSize = 10;
- constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc1{
+ static constexpr u32 WindowSize = 10;
+ static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc1{
0.95376587f, -0.12872314f, 0.060028076f, -0.032470703f, 0.017669678f,
-0.009124756f, 0.004272461f, -0.001739502f, 0.000579834f, -0.000091552734f,
};
- constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc2{
+ static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc2{
0.8230896f, -0.19161987f, 0.093444824f, -0.05090332f, 0.027557373f,
-0.014038086f, 0.0064697266f, -0.002532959f, 0.00079345703f, -0.00012207031f,
};
- constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc3{
+ static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc3{
0.6298828f, -0.19274902f, 0.09725952f, -0.05319214f, 0.028625488f,
-0.014373779f, 0.006500244f, -0.0024719238f, 0.0007324219f, -0.000091552734f,
};
- constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc4{
+ static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc4{
0.4057312f, -0.1468811f, 0.07601929f, -0.041656494f, 0.022216797f,
-0.011016846f, 0.004852295f, -0.0017700195f, 0.00048828125f, -0.000030517578f,
};
- constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc5{
+ static constexpr std::array<Common::FixedPoint<17, 15>, WindowSize> WindowedSinc5{
0.1854248f, -0.075164795f, 0.03967285f, -0.021728516f, 0.011474609f,
-0.005584717f, 0.0024108887f, -0.0008239746f, 0.00021362305f, 0.0f,
};
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,
render_device = params.rendering_device;
execution_mode = params.execution_mode;
- core.Memory().ZeroBlock(*core.Kernel().CurrentProcess(), transfer_memory->GetSourceAddress(),
+ core.Memory().ZeroBlock(*core.ApplicationProcess(), transfer_memory->GetSourceAddress(),
transfer_memory_size);
// Note: We're not actually using the transfer memory because it's a pain to code for.
diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp
index f66b2b890..ce631f810 100644
--- a/src/audio_core/renderer/system_manager.cpp
+++ b/src/audio_core/renderer/system_manager.cpp
@@ -94,7 +94,7 @@ bool SystemManager::Remove(System& system_) {
}
void SystemManager::ThreadFunc() {
- constexpr char name[]{"AudioRenderSystemManager"};
+ static constexpr char name[]{"AudioRenderSystemManager"};
MicroProfileOnThreadCreate(name);
Common::SetCurrentThreadName(name);
Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index 06c2a876e..39a21b0f0 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -35,7 +35,7 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector<s16>& samples) {
if (system_channels == 6 && device_channels == 2) {
// We're given 6 channels, but our device only outputs 2, so downmix.
- constexpr std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f};
+ static constexpr std::array<f32, 4> down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f};
for (u32 read_index = 0, write_index = 0; read_index < samples.size();
read_index += system_channels, write_index += device_channels) {
@@ -202,7 +202,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
// If we're paused or going to shut down, we don't want to consume buffers as coretiming is
// paused and we'll desync, so just play silence.
if (system.IsPaused() || system.IsShuttingDown()) {
- constexpr std::array<s16, 6> silence{};
+ static constexpr std::array<s16, 6> silence{};
for (size_t i = frames_written; i < num_frames; i++) {
std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes);
}
@@ -270,7 +270,7 @@ void SinkStream::Stall() {
if (stalled_lock) {
return;
}
- stalled_lock = system.StallProcesses();
+ stalled_lock = system.StallApplication();
}
void SinkStream::Unstall() {
@@ -278,7 +278,7 @@ void SinkStream::Unstall() {
if (!stalled_lock) {
return;
}
- system.UnstallProcesses();
+ system.UnstallApplication();
stalled_lock.unlock();
}
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 8ef1fcaa8..16ced4595 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -384,8 +384,6 @@ add_library(core STATIC
hle/service/am/omm.h
hle/service/am/spsm.cpp
hle/service/am/spsm.h
- hle/service/am/tcap.cpp
- hle/service/am/tcap.h
hle/service/aoc/aoc_u.cpp
hle/service/aoc/aoc_u.h
hle/service/apm/apm.cpp
@@ -396,28 +394,18 @@ add_library(core STATIC
hle/service/apm/apm_interface.h
hle/service/audio/audctl.cpp
hle/service/audio/audctl.h
- hle/service/audio/auddbg.cpp
- hle/service/audio/auddbg.h
- hle/service/audio/audin_a.cpp
- hle/service/audio/audin_a.h
hle/service/audio/audin_u.cpp
hle/service/audio/audin_u.h
hle/service/audio/audio.cpp
hle/service/audio/audio.h
- hle/service/audio/audout_a.cpp
- hle/service/audio/audout_a.h
hle/service/audio/audout_u.cpp
hle/service/audio/audout_u.h
hle/service/audio/audrec_a.cpp
hle/service/audio/audrec_a.h
hle/service/audio/audrec_u.cpp
hle/service/audio/audrec_u.h
- hle/service/audio/audren_a.cpp
- hle/service/audio/audren_a.h
hle/service/audio/audren_u.cpp
hle/service/audio/audren_u.h
- hle/service/audio/codecctl.cpp
- hle/service/audio/codecctl.h
hle/service/audio/errors.h
hle/service/audio/hwopus.cpp
hle/service/audio/hwopus.h
@@ -712,8 +700,6 @@ add_library(core STATIC
hle/service/sm/sm_controller.h
hle/service/sockets/bsd.cpp
hle/service/sockets/bsd.h
- hle/service/sockets/ethc.cpp
- hle/service/sockets/ethc.h
hle/service/sockets/nsd.cpp
hle/service/sockets/nsd.h
hle/service/sockets/sfdnsres.cpp
@@ -780,8 +766,6 @@ add_library(core STATIC
hle/service/vi/vi_s.h
hle/service/vi/vi_u.cpp
hle/service/vi/vi_u.h
- hle/service/wlan/wlan.cpp
- hle/service/wlan/wlan.h
internal_network/network.cpp
internal_network/network.h
internal_network/network_interface.cpp
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
std::map<std::string, Symbols::Symbols> symbols;
for (const auto& module : modules) {
- symbols.insert_or_assign(module.second,
- Symbols::GetSymbols(module.first, system.Memory(),
- system.CurrentProcess()->Is64BitProcess()));
+ symbols.insert_or_assign(
+ module.second, Symbols::GetSymbols(module.first, system.Memory(),
+ system.ApplicationProcess()->Is64BitProcess()));
}
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 {
void Run() {
std::unique_lock<std::mutex> lk(suspend_guard);
- kernel.Suspend(false);
+ kernel.SuspendApplication(false);
core_timing.SyncPause(false);
is_paused.store(false, std::memory_order_relaxed);
}
@@ -195,7 +195,7 @@ struct System::Impl {
std::unique_lock<std::mutex> lk(suspend_guard);
core_timing.SyncPause(true);
- kernel.Suspend(true);
+ kernel.SuspendApplication(true);
is_paused.store(true, std::memory_order_relaxed);
}
@@ -203,17 +203,17 @@ struct System::Impl {
return is_paused.load(std::memory_order_relaxed);
}
- std::unique_lock<std::mutex> StallProcesses() {
+ std::unique_lock<std::mutex> StallApplication() {
std::unique_lock<std::mutex> lk(suspend_guard);
- kernel.Suspend(true);
+ kernel.SuspendApplication(true);
core_timing.SyncPause(true);
return lk;
}
- void UnstallProcesses() {
+ void UnstallApplication() {
if (!IsPaused()) {
core_timing.SyncPause(false);
- kernel.Suspend(false);
+ kernel.SuspendApplication(false);
}
}
@@ -221,7 +221,7 @@ struct System::Impl {
debugger = std::make_unique<Debugger>(system, port);
}
- SystemResultStatus SetupForMainProcess(System& system, Frontend::EmuWindow& emu_window) {
+ SystemResultStatus SetupForApplicationProcess(System& system, Frontend::EmuWindow& emu_window) {
LOG_DEBUG(Core, "initialized OK");
// Setting changes may require a full system reinitialization (e.g., disabling multicore).
@@ -273,7 +273,7 @@ struct System::Impl {
return SystemResultStatus::ErrorGetLoader;
}
- SystemResultStatus init_result{SetupForMainProcess(system, emu_window)};
+ SystemResultStatus init_result{SetupForApplicationProcess(system, emu_window)};
if (init_result != SystemResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
static_cast<int>(init_result));
@@ -302,7 +302,7 @@ struct System::Impl {
static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
}
AddGlueRegistrationForProcess(*app_loader, *main_process);
- kernel.MakeCurrentProcess(main_process);
+ kernel.MakeApplicationProcess(main_process);
kernel.InitializeCores();
// Initialize cheat engine
@@ -585,12 +585,12 @@ void System::DetachDebugger() {
}
}
-std::unique_lock<std::mutex> System::StallProcesses() {
- return impl->StallProcesses();
+std::unique_lock<std::mutex> System::StallApplication() {
+ return impl->StallApplication();
}
-void System::UnstallProcesses() {
- impl->UnstallProcesses();
+void System::UnstallApplication() {
+ impl->UnstallApplication();
}
void System::InitializeDebugger() {
@@ -648,8 +648,8 @@ const Kernel::GlobalSchedulerContext& System::GlobalSchedulerContext() const {
return impl->kernel.GlobalSchedulerContext();
}
-Kernel::KProcess* System::CurrentProcess() {
- return impl->kernel.CurrentProcess();
+Kernel::KProcess* System::ApplicationProcess() {
+ return impl->kernel.ApplicationProcess();
}
Core::DeviceMemory& System::DeviceMemory() {
@@ -660,8 +660,8 @@ const Core::DeviceMemory& System::DeviceMemory() const {
return *impl->device_memory;
}
-const Kernel::KProcess* System::CurrentProcess() const {
- return impl->kernel.CurrentProcess();
+const Kernel::KProcess* System::ApplicationProcess() const {
+ return impl->kernel.ApplicationProcess();
}
ARM_Interface& System::ArmInterface(std::size_t core_index) {
@@ -760,8 +760,8 @@ const Core::SpeedLimiter& System::SpeedLimiter() const {
return impl->speed_limiter;
}
-u64 System::GetCurrentProcessProgramID() const {
- return impl->kernel.CurrentProcess()->GetProgramID();
+u64 System::GetApplicationProcessProgramID() const {
+ return impl->kernel.ApplicationProcess()->GetProgramID();
}
Loader::ResultStatus System::GetGameName(std::string& out) const {
@@ -880,11 +880,11 @@ bool System::GetExitLock() const {
return impl->exit_lock;
}
-void System::SetCurrentProcessBuildID(const CurrentBuildProcessID& id) {
+void System::SetApplicationProcessBuildID(const CurrentBuildProcessID& id) {
impl->build_id = id;
}
-const System::CurrentBuildProcessID& System::GetCurrentProcessBuildID() const {
+const System::CurrentBuildProcessID& System::GetApplicationProcessBuildID() const {
return impl->build_id;
}
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:
/// Forcibly detach the debugger if it is running.
void DetachDebugger();
- std::unique_lock<std::mutex> StallProcesses();
- void UnstallProcesses();
+ std::unique_lock<std::mutex> StallApplication();
+ void UnstallApplication();
/**
* Initialize the debugger.
@@ -295,11 +295,11 @@ public:
/// Gets the manager for the guest device memory
[[nodiscard]] const Core::DeviceMemory& DeviceMemory() const;
- /// Provides a pointer to the current process
- [[nodiscard]] Kernel::KProcess* CurrentProcess();
+ /// Provides a pointer to the application process
+ [[nodiscard]] Kernel::KProcess* ApplicationProcess();
- /// Provides a constant pointer to the current process.
- [[nodiscard]] const Kernel::KProcess* CurrentProcess() const;
+ /// Provides a constant pointer to the application process.
+ [[nodiscard]] const Kernel::KProcess* ApplicationProcess() const;
/// Provides a reference to the core timing instance.
[[nodiscard]] Timing::CoreTiming& CoreTiming();
@@ -331,7 +331,7 @@ public:
/// Provides a constant reference to the speed limiter
[[nodiscard]] const Core::SpeedLimiter& SpeedLimiter() const;
- [[nodiscard]] u64 GetCurrentProcessProgramID() const;
+ [[nodiscard]] u64 GetApplicationProcessProgramID() const;
/// Gets the name of the current game
[[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const;
@@ -396,8 +396,8 @@ public:
void SetExitLock(bool locked);
[[nodiscard]] bool GetExitLock() const;
- void SetCurrentProcessBuildID(const CurrentBuildProcessID& id);
- [[nodiscard]] const CurrentBuildProcessID& GetCurrentProcessBuildID() const;
+ void SetApplicationProcessBuildID(const CurrentBuildProcessID& id);
+ [[nodiscard]] const CurrentBuildProcessID& GetApplicationProcessBuildID() const;
/// Register a host thread as an emulated CPU Core.
void RegisterCoreThread(std::size_t id);
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 6bac6722f..3a63b52e3 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -45,7 +45,7 @@ CoreTiming::~CoreTiming() {
}
void CoreTiming::ThreadEntry(CoreTiming& instance) {
- constexpr char name[] = "HostTiming";
+ static constexpr char name[] = "HostTiming";
MicroProfileOnThreadCreate(name);
Common::SetCurrentThreadName(name);
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
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) {
GDBStub::GDBStub(DebuggerBackend& backend_, Core::System& system_)
: DebuggerFrontend(backend_), system{system_} {
- if (system.CurrentProcess()->Is64BitProcess()) {
+ if (system.ApplicationProcess()->Is64BitProcess()) {
arch = std::make_unique<GDBStubA64>();
} else {
arch = std::make_unique<GDBStubA32>();
@@ -340,15 +340,15 @@ void GDBStub::HandleBreakpointInsert(std::string_view command) {
success = true;
break;
case BreakpointType::WriteWatch:
- success = system.CurrentProcess()->InsertWatchpoint(system, addr, size,
- Kernel::DebugWatchpointType::Write);
+ success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size,
+ Kernel::DebugWatchpointType::Write);
break;
case BreakpointType::ReadWatch:
- success = system.CurrentProcess()->InsertWatchpoint(system, addr, size,
- Kernel::DebugWatchpointType::Read);
+ success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size,
+ Kernel::DebugWatchpointType::Read);
break;
case BreakpointType::AccessWatch:
- success = system.CurrentProcess()->InsertWatchpoint(
+ success = system.ApplicationProcess()->InsertWatchpoint(
system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
break;
case BreakpointType::Hardware:
@@ -391,15 +391,15 @@ void GDBStub::HandleBreakpointRemove(std::string_view command) {
break;
}
case BreakpointType::WriteWatch:
- success = system.CurrentProcess()->RemoveWatchpoint(system, addr, size,
- Kernel::DebugWatchpointType::Write);
+ success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size,
+ Kernel::DebugWatchpointType::Write);
break;
case BreakpointType::ReadWatch:
- success = system.CurrentProcess()->RemoveWatchpoint(system, addr, size,
- Kernel::DebugWatchpointType::Read);
+ success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size,
+ Kernel::DebugWatchpointType::Read);
break;
case BreakpointType::AccessWatch:
- success = system.CurrentProcess()->RemoveWatchpoint(
+ success = system.ApplicationProcess()->RemoveWatchpoint(
system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
break;
case BreakpointType::Hardware:
@@ -482,7 +482,7 @@ static std::optional<std::string> GetNameFromThreadType64(Core::Memory::Memory&
static std::optional<std::string> GetThreadName(Core::System& system,
const Kernel::KThread* thread) {
- if (system.CurrentProcess()->Is64BitProcess()) {
+ if (system.ApplicationProcess()->Is64BitProcess()) {
return GetNameFromThreadType64(system.Memory(), thread);
} else {
return GetNameFromThreadType32(system.Memory(), thread);
@@ -555,7 +555,7 @@ void GDBStub::HandleQuery(std::string_view command) {
SendReply(fmt::format("TextSeg={:x}", main->first));
} else {
SendReply(fmt::format("TextSeg={:x}",
- system.CurrentProcess()->PageTable().GetCodeRegionStart()));
+ system.ApplicationProcess()->PageTable().GetCodeRegionStart()));
}
} else if (command.starts_with("Xfer:libraries:read::")) {
Loader::AppLoader::Modules modules;
@@ -729,7 +729,7 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
std::string_view command_str{reinterpret_cast<const char*>(&command[0]), command.size()};
std::string reply;
- auto* process = system.CurrentProcess();
+ auto* process = system.ApplicationProcess();
auto& page_table = process->PageTable();
const char* commands = "Commands:\n"
diff --git a/src/core/debugger/gdbstub_arch.cpp b/src/core/debugger/gdbstub_arch.cpp
index 4bef09bd7..831c48513 100644
--- a/src/core/debugger/gdbstub_arch.cpp
+++ b/src/core/debugger/gdbstub_arch.cpp
@@ -41,9 +41,8 @@ static void PutSIMDRegister(std::array<u32, 64>& simd_regs, size_t offset, const
// For sample XML files see the GDB source /gdb/features
// This XML defines what the registers are for this specific ARM device
-std::string GDBStubA64::GetTargetXML() const {
- constexpr const char* target_xml =
- R"(<?xml version="1.0"?>
+std::string_view GDBStubA64::GetTargetXML() const {
+ return R"(<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target version="1.0">
<architecture>aarch64</architecture>
@@ -178,8 +177,6 @@ std::string GDBStubA64::GetTargetXML() const {
<reg name="fpcr" bitsize="32"/>
</feature>
</target>)";
-
- return target_xml;
}
std::string GDBStubA64::RegRead(const Kernel::KThread* thread, size_t id) const {
@@ -270,9 +267,8 @@ u32 GDBStubA64::BreakpointInstruction() const {
return 0xd4200000;
}
-std::string GDBStubA32::GetTargetXML() const {
- constexpr const char* target_xml =
- R"(<?xml version="1.0"?>
+std::string_view GDBStubA32::GetTargetXML() const {
+ return R"(<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target version="1.0">
<architecture>arm</architecture>
@@ -378,8 +374,6 @@ std::string GDBStubA32::GetTargetXML() const {
<reg name="fpscr" bitsize="32" type="int" group="float" regnum="80"/>
</feature>
</target>)";
-
- return target_xml;
}
std::string GDBStubA32::RegRead(const Kernel::KThread* thread, size_t id) const {
diff --git a/src/core/debugger/gdbstub_arch.h b/src/core/debugger/gdbstub_arch.h
index 2540d6456..34530c788 100644
--- a/src/core/debugger/gdbstub_arch.h
+++ b/src/core/debugger/gdbstub_arch.h
@@ -16,7 +16,7 @@ namespace Core {
class GDBStubArch {
public:
virtual ~GDBStubArch() = default;
- virtual std::string GetTargetXML() const = 0;
+ virtual std::string_view GetTargetXML() const = 0;
virtual std::string RegRead(const Kernel::KThread* thread, size_t id) const = 0;
virtual void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const = 0;
virtual std::string ReadRegisters(const Kernel::KThread* thread) const = 0;
@@ -27,7 +27,7 @@ public:
class GDBStubA64 final : public GDBStubArch {
public:
- std::string GetTargetXML() const override;
+ std::string_view GetTargetXML() const override;
std::string RegRead(const Kernel::KThread* thread, size_t id) const override;
void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override;
std::string ReadRegisters(const Kernel::KThread* thread) const override;
@@ -47,7 +47,7 @@ private:
class GDBStubA32 final : public GDBStubArch {
public:
- std::string GetTargetXML() const override;
+ std::string_view GetTargetXML() const override;
std::string RegRead(const Kernel::KThread* thread, size_t id) const override;
void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override;
std::string ReadRegisters(const Kernel::KThread* thread) const override;
diff --git a/src/core/file_sys/ips_layer.cpp b/src/core/file_sys/ips_layer.cpp
index 5aab428bb..efdf18cee 100644
--- a/src/core/file_sys/ips_layer.cpp
+++ b/src/core/file_sys/ips_layer.cpp
@@ -41,12 +41,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) {
return IPSFileType::Error;
}
- constexpr std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}};
+ static constexpr std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}};
if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) {
return IPSFileType::IPS;
}
- constexpr std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}};
+ static constexpr std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}};
if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) {
return IPSFileType::IPS32;
}
@@ -55,12 +55,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) {
}
static bool IsEOF(IPSFileType type, const std::vector<u8>& data) {
- constexpr std::array<u8, 3> eof{{'E', 'O', 'F'}};
+ static constexpr std::array<u8, 3> eof{{'E', 'O', 'F'}};
if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) {
return true;
}
- constexpr std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}};
+ static constexpr std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}};
return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin());
}
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index 878d832c2..a6960170c 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -71,7 +71,7 @@ static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bo
}
static std::string GetCNMTName(TitleType type, u64 title_id) {
- constexpr std::array<const char*, 9> TITLE_TYPE_NAMES{
+ static constexpr std::array<const char*, 9> TITLE_TYPE_NAMES{
"SystemProgram",
"SystemData",
"SystemUpdate",
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,
// be interpreted as the title id of the current process.
if (type == SaveDataType::SaveData || type == SaveDataType::DeviceSaveData) {
if (title_id == 0) {
- title_id = system.GetCurrentProcessProgramID();
+ title_id = system.GetApplicationProcessProgramID();
}
}
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:
if (context->GetManager()->IsDomain()) {
context->AddDomainObject(std::move(iface));
} else {
- kernel.CurrentProcess()->GetResourceLimit()->Reserve(
+ kernel.ApplicationProcess()->GetResourceLimit()->Reserve(
Kernel::LimitableResource::SessionCountMax, 1);
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 {
Result KClientPort::CreateSession(KClientSession** out) {
// Reserve a new session from the resource limit.
- KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(),
+ //! FIXME: we are reserving this from the wrong resource limit!
+ KScopedResourceReservation session_reservation(kernel.ApplicationProcess()->GetResourceLimit(),
LimitableResource::SessionCountMax);
R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
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_)
Result KCodeMemory::Initialize(Core::DeviceMemory& device_memory, VAddr addr, size_t size) {
// Set members.
- m_owner = kernel.CurrentProcess();
+ m_owner = GetCurrentProcessPointer(kernel);
// Get the owner page table.
auto& page_table = m_owner->PageTable();
@@ -74,7 +74,7 @@ Result KCodeMemory::Map(VAddr address, size_t size) {
R_UNLESS(!m_is_mapped, ResultInvalidState);
// Map the memory.
- R_TRY(kernel.CurrentProcess()->PageTable().MapPageGroup(
+ R_TRY(GetCurrentProcess(kernel).PageTable().MapPageGroup(
address, *m_page_group, KMemoryState::CodeOut, KMemoryPermission::UserReadWrite));
// Mark ourselves as mapped.
@@ -91,8 +91,8 @@ Result KCodeMemory::Unmap(VAddr address, size_t size) {
KScopedLightLock lk(m_lock);
// Unmap the memory.
- R_TRY(kernel.CurrentProcess()->PageTable().UnmapPageGroup(address, *m_page_group,
- KMemoryState::CodeOut));
+ R_TRY(GetCurrentProcess(kernel).PageTable().UnmapPageGroup(address, *m_page_group,
+ KMemoryState::CodeOut));
// Mark ourselves as unmapped.
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)
R_SUCCEED_IF(test_tag != (handle | Svc::HandleWaitMask));
// Get the lock owner thread.
- owner_thread = kernel.CurrentProcess()
- ->GetHandleTable()
+ owner_thread = GetCurrentProcess(kernel)
+ .GetHandleTable()
.GetObjectWithoutPseudoHandle<KThread>(handle)
.ReleasePointerUnsafe();
R_UNLESS(owner_thread != nullptr, ResultInvalidHandle);
@@ -213,8 +213,8 @@ void KConditionVariable::SignalImpl(KThread* thread) {
thread->EndWait(ResultSuccess);
} else {
// Get the previous owner.
- KThread* owner_thread = kernel.CurrentProcess()
- ->GetHandleTable()
+ KThread* owner_thread = GetCurrentProcess(kernel)
+ .GetHandleTable()
.GetObjectWithoutPseudoHandle<KThread>(
static_cast<Handle>(prev_tag & ~Svc::HandleWaitMask))
.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:
// Handle pseudo-handles.
if constexpr (std::derived_from<KProcess, T>) {
if (handle == Svc::PseudoHandle::CurrentProcess) {
- auto* const cur_process = m_kernel.CurrentProcess();
+ //! FIXME: this is the wrong process!
+ auto* const cur_process = m_kernel.ApplicationProcess();
ASSERT(cur_process != nullptr);
return cur_process;
}
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) {
auto& current_thread = GetCurrentThread(kernel);
- if (auto* process = kernel.CurrentProcess(); process) {
+ if (auto* process = GetCurrentProcessPointer(kernel); process) {
// If the user disable count is set, we may need to pin the current thread.
if (current_thread.GetUserDisableCount() && !process->GetPinnedThread(core_id)) {
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) {
}
void KScheduler::SwitchThread(KThread* next_thread) {
- KProcess* const cur_process = kernel.CurrentProcess();
+ KProcess* const cur_process = GetCurrentProcessPointer(kernel);
KThread* const cur_thread = GetCurrentThreadPointer(kernel);
// 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
void KScheduler::YieldWithoutCoreMigration(KernelCore& kernel) {
// Validate preconditions.
ASSERT(CanSchedule(kernel));
- ASSERT(kernel.CurrentProcess() != nullptr);
+ ASSERT(GetCurrentProcessPointer(kernel) != nullptr);
// Get the current thread and process.
KThread& cur_thread = GetCurrentThread(kernel);
- KProcess& cur_process = *kernel.CurrentProcess();
+ KProcess& cur_process = GetCurrentProcess(kernel);
// If the thread's yield count matches, there's nothing for us to do.
if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
@@ -728,11 +728,11 @@ void KScheduler::YieldWithoutCoreMigration(KernelCore& kernel) {
void KScheduler::YieldWithCoreMigration(KernelCore& kernel) {
// Validate preconditions.
ASSERT(CanSchedule(kernel));
- ASSERT(kernel.CurrentProcess() != nullptr);
+ ASSERT(GetCurrentProcessPointer(kernel) != nullptr);
// Get the current thread and process.
KThread& cur_thread = GetCurrentThread(kernel);
- KProcess& cur_process = *kernel.CurrentProcess();
+ KProcess& cur_process = GetCurrentProcess(kernel);
// If the thread's yield count matches, there's nothing for us to do.
if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
@@ -816,11 +816,11 @@ void KScheduler::YieldWithCoreMigration(KernelCore& kernel) {
void KScheduler::YieldToAnyThread(KernelCore& kernel) {
// Validate preconditions.
ASSERT(CanSchedule(kernel));
- ASSERT(kernel.CurrentProcess() != nullptr);
+ ASSERT(GetCurrentProcessPointer(kernel) != nullptr);
// Get the current thread and process.
KThread& cur_thread = GetCurrentThread(kernel);
- KProcess& cur_process = *kernel.CurrentProcess();
+ KProcess& cur_process = GetCurrentProcess(kernel);
// If the thread's yield count matches, there's nothing for us to do.
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_) {
name = name_;
// Set our owner process.
- process = kernel.CurrentProcess();
+ //! FIXME: this is the wrong process!
+ process = kernel.ApplicationProcess();
process->Open();
// 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) {
return *GetCurrentThreadPointer(kernel);
}
+KProcess* GetCurrentProcessPointer(KernelCore& kernel) {
+ return GetCurrentThread(kernel).GetOwnerProcess();
+}
+
+KProcess& GetCurrentProcess(KernelCore& kernel) {
+ return *GetCurrentProcessPointer(kernel);
+}
+
s32 GetCurrentCoreId(KernelCore& kernel) {
return GetCurrentThread(kernel).GetCurrentCore();
}
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 {
void SetCurrentThread(KernelCore& kernel, KThread* thread);
[[nodiscard]] KThread* GetCurrentThreadPointer(KernelCore& kernel);
[[nodiscard]] KThread& GetCurrentThread(KernelCore& kernel);
+[[nodiscard]] KProcess* GetCurrentProcessPointer(KernelCore& kernel);
+[[nodiscard]] KProcess& GetCurrentProcess(KernelCore& kernel);
[[nodiscard]] s32 GetCurrentCoreId(KernelCore& kernel);
class 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;
Result KTransferMemory::Initialize(VAddr address_, std::size_t size_,
Svc::MemoryPermission owner_perm_) {
// Set members.
- owner = kernel.CurrentProcess();
+ owner = GetCurrentProcessPointer(kernel);
// TODO(bunnei): Lock for transfer memory
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 {
void InitializeCores() {
for (u32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) {
- cores[core_id]->Initialize((*current_process).Is64BitProcess());
- system.Memory().SetCurrentPageTable(*current_process, core_id);
+ cores[core_id]->Initialize((*application_process).Is64BitProcess());
+ system.Memory().SetCurrentPageTable(*application_process, core_id);
}
}
- void CloseCurrentProcess() {
- KProcess* old_process = current_process.exchange(nullptr);
+ void CloseApplicationProcess() {
+ KProcess* old_process = application_process.exchange(nullptr);
if (old_process == nullptr) {
return;
}
@@ -182,7 +182,7 @@ struct KernelCore::Impl {
}
}
- CloseCurrentProcess();
+ CloseApplicationProcess();
// Track kernel objects that were not freed on shutdown
{
@@ -363,8 +363,8 @@ struct KernelCore::Impl {
}
}
- void MakeCurrentProcess(KProcess* process) {
- current_process = process;
+ void MakeApplicationProcess(KProcess* process) {
+ application_process = process;
}
static inline thread_local u32 host_thread_id = UINT32_MAX;
@@ -821,7 +821,7 @@ struct KernelCore::Impl {
// Lists all processes that exist in the current session.
std::vector<KProcess*> process_list;
- std::atomic<KProcess*> current_process{};
+ std::atomic<KProcess*> application_process{};
std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context;
std::unique_ptr<Kernel::KHardwareTimer> hardware_timer;
@@ -941,20 +941,20 @@ void KernelCore::AppendNewProcess(KProcess* process) {
impl->process_list.push_back(process);
}
-void KernelCore::MakeCurrentProcess(KProcess* process) {
- impl->MakeCurrentProcess(process);
+void KernelCore::MakeApplicationProcess(KProcess* process) {
+ impl->MakeApplicationProcess(process);
}
-KProcess* KernelCore::CurrentProcess() {
- return impl->current_process;
+KProcess* KernelCore::ApplicationProcess() {
+ return impl->application_process;
}
-const KProcess* KernelCore::CurrentProcess() const {
- return impl->current_process;
+const KProcess* KernelCore::ApplicationProcess() const {
+ return impl->application_process;
}
-void KernelCore::CloseCurrentProcess() {
- impl->CloseCurrentProcess();
+void KernelCore::CloseApplicationProcess() {
+ impl->CloseApplicationProcess();
}
const std::vector<KProcess*>& KernelCore::GetProcessList() const {
@@ -1202,12 +1202,12 @@ const Kernel::KSharedMemory& KernelCore::GetHidBusSharedMem() const {
return *impl->hidbus_shared_mem;
}
-void KernelCore::Suspend(bool suspended) {
+void KernelCore::SuspendApplication(bool suspended) {
const bool should_suspend{exception_exited || suspended};
const auto activity = should_suspend ? ProcessActivity::Paused : ProcessActivity::Runnable;
- //! This refers to the application process, not the current process.
- KScopedAutoObject<KProcess> process = CurrentProcess();
+ // Get the application process.
+ KScopedAutoObject<KProcess> process = ApplicationProcess();
if (process.IsNull()) {
return;
}
@@ -1218,8 +1218,8 @@ void KernelCore::Suspend(bool suspended) {
// Wait for process execution to stop.
bool must_wait{should_suspend};
- // KernelCore::Suspend must be called from locked context, or we
- // could race another call to SetActivity, interfering with waiting.
+ // KernelCore::SuspendApplication must be called from locked context,
+ // or we could race another call to SetActivity, interfering with waiting.
while (must_wait) {
KScopedSchedulerLock sl{*this};
@@ -1253,9 +1253,9 @@ bool KernelCore::IsShuttingDown() const {
return impl->IsShuttingDown();
}
-void KernelCore::ExceptionalExit() {
+void KernelCore::ExceptionalExitApplication() {
exception_exited = true;
- Suspend(true);
+ SuspendApplication(true);
}
void 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:
/// Adds the given shared pointer to an internal list of active processes.
void AppendNewProcess(KProcess* process);
- /// Makes the given process the new current process.
- void MakeCurrentProcess(KProcess* process);
+ /// Makes the given process the new application process.
+ void MakeApplicationProcess(KProcess* process);
- /// Retrieves a pointer to the current process.
- KProcess* CurrentProcess();
+ /// Retrieves a pointer to the application process.
+ KProcess* ApplicationProcess();
- /// Retrieves a const pointer to the current process.
- const KProcess* CurrentProcess() const;
+ /// Retrieves a const pointer to the application process.
+ const KProcess* ApplicationProcess() const;
- /// Closes the current process.
- void CloseCurrentProcess();
+ /// Closes the application process.
+ void CloseApplicationProcess();
/// Retrieves the list of processes.
const std::vector<KProcess*>& GetProcessList() const;
@@ -288,11 +288,11 @@ public:
/// Gets the shared memory object for HIDBus services.
const Kernel::KSharedMemory& GetHidBusSharedMem() const;
- /// Suspend/unsuspend all processes.
- void Suspend(bool suspend);
+ /// Suspend/unsuspend application process.
+ void SuspendApplication(bool suspend);
- /// Exceptional exit all processes.
- void ExceptionalExit();
+ /// Exceptional exit application process.
+ void ExceptionalExitApplication();
/// Notify emulated CPU cores to shut down.
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) {
auto& kernel = system.Kernel();
kernel.EnterSVCProfile();
- if (system.CurrentProcess()->Is64BitProcess()) {
+ if (GetCurrentProcess(system.Kernel()).Is64BitProcess()) {
Call64(system, imm);
} else {
Call32(system, imm);
diff --git a/src/core/hle/kernel/svc/svc_activity.cpp b/src/core/hle/kernel/svc/svc_activity.cpp
index 1dcdb7a15..63bc08555 100644
--- a/src/core/hle/kernel/svc/svc_activity.cpp
+++ b/src/core/hle/kernel/svc/svc_activity.cpp
@@ -16,18 +16,19 @@ Result SetThreadActivity(Core::System& system, Handle thread_handle,
thread_activity);
// Validate the activity.
- constexpr auto IsValidThreadActivity = [](ThreadActivity activity) {
+ static constexpr auto IsValidThreadActivity = [](ThreadActivity activity) {
return activity == ThreadActivity::Runnable || activity == ThreadActivity::Paused;
};
R_UNLESS(IsValidThreadActivity(thread_activity), ResultInvalidEnumValue);
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Check that the activity is being set on a non-current thread for the current process.
- R_UNLESS(thread->GetOwnerProcess() == system.Kernel().CurrentProcess(), ResultInvalidHandle);
+ R_UNLESS(thread->GetOwnerProcess() == GetCurrentProcessPointer(system.Kernel()),
+ ResultInvalidHandle);
R_UNLESS(thread.GetPointerUnsafe() != GetCurrentThreadPointer(system.Kernel()), ResultBusy);
// 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
timeout = timeout_ns;
}
- return system.Kernel().CurrentProcess()->WaitAddressArbiter(address, arb_type, value, timeout);
+ return GetCurrentProcess(system.Kernel()).WaitAddressArbiter(address, arb_type, value, timeout);
}
// Signals to an address (via Address Arbiter)
@@ -95,8 +95,8 @@ Result SignalToAddress(Core::System& system, VAddr address, SignalType signal_ty
return ResultInvalidEnumValue;
}
- return system.Kernel().CurrentProcess()->SignalAddressArbiter(address, signal_type, value,
- count);
+ return GetCurrentProcess(system.Kernel())
+ .SignalAddressArbiter(address, signal_type, value, count);
}
Result 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
// Get the process from its handle.
KScopedAutoObject process =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
// 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
R_UNLESS(code_mem != nullptr, ResultOutOfResource);
// Verify that the region is in range.
- R_UNLESS(system.CurrentProcess()->PageTable().Contains(address, size),
+ R_UNLESS(GetCurrentProcess(system.Kernel()).PageTable().Contains(address, size),
ResultInvalidCurrentMemory);
// Initialize the code memory.
@@ -56,7 +56,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t
KCodeMemory::Register(kernel, code_mem);
// Add the code memory to the handle table.
- R_TRY(system.CurrentProcess()->GetHandleTable().Add(out, code_mem));
+ R_TRY(GetCurrentProcess(system.Kernel()).GetHandleTable().Add(out, code_mem));
code_mem->Close();
@@ -79,8 +79,9 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle,
R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
// Get the code memory from its handle.
- KScopedAutoObject code_mem =
- system.CurrentProcess()->GetHandleTable().GetObject<KCodeMemory>(code_memory_handle);
+ KScopedAutoObject code_mem = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KCodeMemory>(code_memory_handle);
R_UNLESS(code_mem.IsNotNull(), ResultInvalidHandle);
// 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,
switch (operation) {
case CodeMemoryOperation::Map: {
// Check that the region is in range.
- R_UNLESS(
- system.CurrentProcess()->PageTable().CanContain(address, size, KMemoryState::CodeOut),
- ResultInvalidMemoryRegion);
+ R_UNLESS(GetCurrentProcess(system.Kernel())
+ .PageTable()
+ .CanContain(address, size, KMemoryState::CodeOut),
+ ResultInvalidMemoryRegion);
// Check the memory permission.
R_UNLESS(IsValidMapCodeMemoryPermission(perm), ResultInvalidNewMemoryPermission);
@@ -102,9 +104,10 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle,
} break;
case CodeMemoryOperation::Unmap: {
// Check that the region is in range.
- R_UNLESS(
- system.CurrentProcess()->PageTable().CanContain(address, size, KMemoryState::CodeOut),
- ResultInvalidMemoryRegion);
+ R_UNLESS(GetCurrentProcess(system.Kernel())
+ .PageTable()
+ .CanContain(address, size, KMemoryState::CodeOut),
+ ResultInvalidMemoryRegion);
// Check the memory permission.
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
}
// Wait on the condition variable.
- return system.Kernel().CurrentProcess()->WaitConditionVariable(
- address, Common::AlignDown(cv_key, sizeof(u32)), tag, timeout);
+ return GetCurrentProcess(system.Kernel())
+ .WaitConditionVariable(address, Common::AlignDown(cv_key, sizeof(u32)), tag, timeout);
}
/// Signal process wide key
@@ -52,8 +52,8 @@ void SignalProcessWideKey(Core::System& system, VAddr cv_key, s32 count) {
LOG_TRACE(Kernel_SVC, "called, cv_key=0x{:X}, count=0x{:08X}", cv_key, count);
// Signal the condition variable.
- return system.Kernel().CurrentProcess()->SignalConditionVariable(
- Common::AlignDown(cv_key, sizeof(u32)), count);
+ return GetCurrentProcess(system.Kernel())
+ .SignalConditionVariable(Common::AlignDown(cv_key, sizeof(u32)), count);
}
Result 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_
KDeviceAddressSpace::Register(system.Kernel(), das);
// Add to the handle table.
- R_TRY(system.CurrentProcess()->GetHandleTable().Add(out, das));
+ R_TRY(GetCurrentProcess(system.Kernel()).GetHandleTable().Add(out, das));
R_SUCCEED();
}
Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle) {
// Get the device address space.
- KScopedAutoObject das =
- system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
+ KScopedAutoObject das = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KDeviceAddressSpace>(das_handle);
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
// Attach.
@@ -54,8 +55,9 @@ Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Ha
Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle) {
// Get the device address space.
- KScopedAutoObject das =
- system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
+ KScopedAutoObject das = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KDeviceAddressSpace>(das_handle);
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
// Detach.
@@ -94,13 +96,14 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han
R_UNLESS(reserved == 0, ResultInvalidEnumValue);
// Get the device address space.
- KScopedAutoObject das =
- system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
+ KScopedAutoObject das = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KDeviceAddressSpace>(das_handle);
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
// Get the process.
KScopedAutoObject process =
- system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
// Validate that the process address is within range.
@@ -134,13 +137,14 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han
R_UNLESS(reserved == 0, ResultInvalidEnumValue);
// Get the device address space.
- KScopedAutoObject das =
- system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
+ KScopedAutoObject das = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KDeviceAddressSpace>(das_handle);
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
// Get the process.
KScopedAutoObject process =
- system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
// Validate that the process address is within range.
@@ -165,13 +169,14 @@ Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle p
ResultInvalidCurrentMemory);
// Get the device address space.
- KScopedAutoObject das =
- system.CurrentProcess()->GetHandleTable().GetObject<KDeviceAddressSpace>(das_handle);
+ KScopedAutoObject das = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KDeviceAddressSpace>(das_handle);
R_UNLESS(das.IsNotNull(), ResultInvalidHandle);
// Get the process.
KScopedAutoObject process =
- system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
// 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) {
LOG_DEBUG(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle);
// Get the current handle table.
- const KHandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const KHandleTable& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
// Get the event.
KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle);
@@ -28,7 +28,7 @@ Result ClearEvent(Core::System& system, Handle event_handle) {
LOG_TRACE(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle);
// Get the current handle table.
- const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
// Try to clear the writable event.
{
@@ -56,10 +56,10 @@ Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_read) {
// Get the kernel reference and handle table.
auto& kernel = system.Kernel();
- auto& handle_table = kernel.CurrentProcess()->GetHandleTable();
+ auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
// Reserve a new event from the process resource limit
- KScopedResourceReservation event_reservation(kernel.CurrentProcess(),
+ KScopedResourceReservation event_reservation(GetCurrentProcessPointer(kernel),
LimitableResource::EventCountMax);
R_UNLESS(event_reservation.Succeeded(), ResultLimitReached);
@@ -68,7 +68,7 @@ Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_read) {
R_UNLESS(event != nullptr, ResultOutOfResource);
// Initialize the event.
- event->Initialize(kernel.CurrentProcess());
+ event->Initialize(GetCurrentProcessPointer(kernel));
// Commit the thread reservation.
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
return ResultInvalidEnumValue;
}
- const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
KScopedAutoObject process = handle_table.GetObject<KProcess>(handle);
if (process.IsNull()) {
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
return ResultInvalidCombination;
}
- KProcess* const current_process = system.Kernel().CurrentProcess();
+ KProcess* const current_process = GetCurrentProcessPointer(system.Kernel());
KHandleTable& handle_table = current_process->GetHandleTable();
const auto resource_limit = current_process->GetResourceLimit();
if (!resource_limit) {
@@ -183,7 +183,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
return ResultInvalidCombination;
}
- *result = system.Kernel().CurrentProcess()->GetRandomEntropy(info_sub_id);
+ *result = GetCurrentProcess(system.Kernel()).GetRandomEntropy(info_sub_id);
return ResultSuccess;
case InfoType::InitialProcessIdRange:
@@ -200,9 +200,9 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
return ResultInvalidCombination;
}
- KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(
- static_cast<Handle>(handle));
+ KScopedAutoObject thread = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KThread>(static_cast<Handle>(handle));
if (thread.IsNull()) {
LOG_ERROR(Kernel_SVC, "Thread handle does not exist, handle=0x{:08X}",
static_cast<Handle>(handle));
@@ -249,7 +249,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
R_UNLESS(info_sub_id == 0, ResultInvalidCombination);
// Get the handle table.
- KProcess* current_process = system.Kernel().CurrentProcess();
+ KProcess* current_process = GetCurrentProcessPointer(system.Kernel());
KHandleTable& handle_table = current_process->GetHandleTable();
// 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 {
/// Makes a blocking IPC call to a service.
Result SendSyncRequest(Core::System& system, Handle handle) {
- auto& kernel = system.Kernel();
-
// Get the client session from its handle.
KScopedAutoObject session =
- kernel.CurrentProcess()->GetHandleTable().GetObject<KClientSession>(handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KClientSession>(handle);
R_UNLESS(session.IsNotNull(), ResultInvalidHandle);
LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({})", handle, session->GetName());
@@ -40,7 +38,7 @@ Result SendAsyncRequestWithUserBuffer(Core::System& system, Handle* out_event_ha
Result ReplyAndReceive(Core::System& system, s32* out_index, uint64_t handles_addr, s32 num_handles,
Handle reply_target, s64 timeout_ns) {
auto& kernel = system.Kernel();
- auto& handle_table = GetCurrentThread(kernel).GetOwnerProcess()->GetHandleTable();
+ auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange);
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,
return ResultInvalidAddress;
}
- return system.Kernel().CurrentProcess()->WaitForAddress(thread_handle, address, tag);
+ return GetCurrentProcess(system.Kernel()).WaitForAddress(thread_handle, address, tag);
}
/// Unlock a mutex
@@ -43,7 +43,7 @@ Result ArbitrateUnlock(Core::System& system, VAddr address) {
return ResultInvalidAddress;
}
- return system.Kernel().CurrentProcess()->SignalToAddress(address);
+ return GetCurrentProcess(system.Kernel()).SignalToAddress(address);
}
Result 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
R_UNLESS(IsValidSetMemoryPermission(perm), ResultInvalidNewMemoryPermission);
// Validate that the region is in range for the current process.
- auto& page_table = system.Kernel().CurrentProcess()->PageTable();
+ auto& page_table = GetCurrentProcess(system.Kernel()).PageTable();
R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory);
// Set the memory attribute.
@@ -137,7 +137,7 @@ Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mas
R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination);
// Validate that the region is in range for the current process.
- auto& page_table{system.Kernel().CurrentProcess()->PageTable()};
+ auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()};
R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory);
// Set the memory attribute.
@@ -149,7 +149,7 @@ Result MapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size)
LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
src_addr, size);
- auto& page_table{system.Kernel().CurrentProcess()->PageTable()};
+ auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()};
if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)};
result.IsError()) {
@@ -164,7 +164,7 @@ Result UnmapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 siz
LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
src_addr, size);
- auto& page_table{system.Kernel().CurrentProcess()->PageTable()};
+ auto& page_table{GetCurrentProcess(system.Kernel()).PageTable()};
if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)};
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) {
R_UNLESS(size < MainMemorySizeMax, ResultInvalidSize);
// Set the heap size.
- R_TRY(system.Kernel().CurrentProcess()->PageTable().SetHeapSize(out_address, size));
+ R_TRY(GetCurrentProcess(system.Kernel()).PageTable().SetHeapSize(out_address, size));
return ResultSuccess;
}
@@ -45,7 +45,7 @@ Result MapPhysicalMemory(Core::System& system, VAddr addr, u64 size) {
return ResultInvalidMemoryRegion;
}
- KProcess* const current_process{system.Kernel().CurrentProcess()};
+ KProcess* const current_process{GetCurrentProcessPointer(system.Kernel())};
auto& page_table{current_process->PageTable()};
if (current_process->GetSystemResourceSize() == 0) {
@@ -94,7 +94,7 @@ Result UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size) {
return ResultInvalidMemoryRegion;
}
- KProcess* const current_process{system.Kernel().CurrentProcess()};
+ KProcess* const current_process{GetCurrentProcessPointer(system.Kernel())};
auto& page_table{current_process->PageTable()};
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
// Get the current handle table.
auto& kernel = system.Kernel();
- auto& handle_table = kernel.CurrentProcess()->GetHandleTable();
+ auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
// Find the client port.
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 {
/// Exits the current process
void ExitProcess(Core::System& system) {
- auto* current_process = system.Kernel().CurrentProcess();
+ auto* current_process = GetCurrentProcessPointer(system.Kernel());
LOG_INFO(Kernel_SVC, "Process {} exiting", current_process->GetProcessID());
ASSERT_MSG(current_process->GetState() == KProcess::State::Running,
@@ -23,9 +23,9 @@ Result GetProcessId(Core::System& system, u64* out_process_id, Handle handle) {
LOG_DEBUG(Kernel_SVC, "called handle=0x{:08X}", handle);
// Get the object from the handle table.
- KScopedAutoObject obj =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KAutoObject>(
- static_cast<Handle>(handle));
+ KScopedAutoObject obj = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KAutoObject>(static_cast<Handle>(handle));
R_UNLESS(obj.IsNotNull(), ResultInvalidHandle);
// Get the process from the object.
@@ -63,10 +63,10 @@ Result GetProcessList(Core::System& system, s32* out_num_processes, VAddr out_pr
return ResultOutOfRange;
}
- const auto& kernel = system.Kernel();
+ auto& kernel = system.Kernel();
const auto total_copy_size = out_process_ids_size * sizeof(u64);
- if (out_process_ids_size > 0 && !kernel.CurrentProcess()->PageTable().IsInsideAddressSpace(
+ if (out_process_ids_size > 0 && !GetCurrentProcess(kernel).PageTable().IsInsideAddressSpace(
out_process_ids, total_copy_size)) {
LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}",
out_process_ids, out_process_ids + total_copy_size);
@@ -92,7 +92,7 @@ Result GetProcessInfo(Core::System& system, s64* out, Handle process_handle,
ProcessInfoType info_type) {
LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, type=0x{:X}", process_handle, info_type);
- const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
if (process.IsNull()) {
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
// Get the process from its handle.
KScopedAutoObject process =
- system.CurrentProcess()->GetHandleTable().GetObject<KProcess>(process_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KProcess>(process_handle);
R_UNLESS(process.IsNotNull(), ResultInvalidHandle);
// Validate that the address is in range.
@@ -71,7 +71,7 @@ Result MapProcessMemory(Core::System& system, VAddr dst_address, Handle process_
R_UNLESS((src_address < src_address + size), ResultInvalidCurrentMemory);
// Get the processes.
- KProcess* dst_process = system.CurrentProcess();
+ KProcess* dst_process = GetCurrentProcessPointer(system.Kernel());
KScopedAutoObject src_process =
dst_process->GetHandleTable().GetObjectWithoutPseudoHandle<KProcess>(process_handle);
R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle);
@@ -114,7 +114,7 @@ Result UnmapProcessMemory(Core::System& system, VAddr dst_address, Handle proces
R_UNLESS((src_address < src_address + size), ResultInvalidCurrentMemory);
// Get the processes.
- KProcess* dst_process = system.CurrentProcess();
+ KProcess* dst_process = GetCurrentProcessPointer(system.Kernel());
KScopedAutoObject src_process =
dst_process->GetHandleTable().GetObjectWithoutPseudoHandle<KProcess>(process_handle);
R_UNLESS(src_process.IsNotNull(), ResultInvalidHandle);
@@ -174,7 +174,7 @@ Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst
return ResultInvalidCurrentMemory;
}
- const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
if (process.IsNull()) {
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
return ResultInvalidCurrentMemory;
}
- const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
if (process.IsNull()) {
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
Result QueryProcessMemory(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info,
Handle process_handle, uint64_t address) {
LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address);
- const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
if (process.IsNull()) {
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) {
KResourceLimit::Register(kernel, resource_limit);
// Add the limit to the handle table.
- R_TRY(kernel.CurrentProcess()->GetHandleTable().Add(out_handle, resource_limit));
+ R_TRY(GetCurrentProcess(kernel).GetHandleTable().Add(out_handle, resource_limit));
return ResultSuccess;
}
@@ -41,9 +41,9 @@ Result GetResourceLimitLimitValue(Core::System& system, s64* out_limit_value,
R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue);
// Get the resource limit.
- auto& kernel = system.Kernel();
- KScopedAutoObject resource_limit =
- kernel.CurrentProcess()->GetHandleTable().GetObject<KResourceLimit>(resource_limit_handle);
+ KScopedAutoObject resource_limit = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KResourceLimit>(resource_limit_handle);
R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle);
// Get the limit value.
@@ -61,9 +61,9 @@ Result GetResourceLimitCurrentValue(Core::System& system, s64* out_current_value
R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue);
// Get the resource limit.
- auto& kernel = system.Kernel();
- KScopedAutoObject resource_limit =
- kernel.CurrentProcess()->GetHandleTable().GetObject<KResourceLimit>(resource_limit_handle);
+ KScopedAutoObject resource_limit = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KResourceLimit>(resource_limit_handle);
R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle);
// Get the current value.
@@ -81,9 +81,9 @@ Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_ha
R_UNLESS(IsValidResourceType(which), ResultInvalidEnumValue);
// Get the resource limit.
- auto& kernel = system.Kernel();
- KScopedAutoObject resource_limit =
- kernel.CurrentProcess()->GetHandleTable().GetObject<KResourceLimit>(resource_limit_handle);
+ KScopedAutoObject resource_limit = GetCurrentProcess(system.Kernel())
+ .GetHandleTable()
+ .GetObject<KResourceLimit>(resource_limit_handle);
R_UNLESS(resource_limit.IsNotNull(), ResultInvalidHandle);
// 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 {
template <typename T>
Result CreateSession(Core::System& system, Handle* out_server, Handle* out_client, u64 name) {
- auto& process = *system.CurrentProcess();
+ auto& process = GetCurrentProcess(system.Kernel());
auto& handle_table = process.GetHandleTable();
// 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,
R_UNLESS(IsValidSharedMemoryPermission(map_perm), ResultInvalidNewMemoryPermission);
// Get the current process.
- auto& process = *system.Kernel().CurrentProcess();
+ auto& process = GetCurrentProcess(system.Kernel());
auto& page_table = process.PageTable();
// Get the shared memory.
@@ -75,7 +75,7 @@ Result UnmapSharedMemory(Core::System& system, Handle shmem_handle, VAddr addres
R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
// Get the current process.
- auto& process = *system.Kernel().CurrentProcess();
+ auto& process = GetCurrentProcess(system.Kernel());
auto& page_table = process.PageTable();
// 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) {
LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle);
// Remove the handle.
- R_UNLESS(system.Kernel().CurrentProcess()->GetHandleTable().Remove(handle),
+ R_UNLESS(GetCurrentProcess(system.Kernel()).GetHandleTable().Remove(handle),
ResultInvalidHandle);
return ResultSuccess;
@@ -25,7 +25,7 @@ Result ResetSignal(Core::System& system, Handle handle) {
LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
// Get the current handle table.
- const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
// Try to reset as readable event.
{
@@ -59,7 +59,7 @@ Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_addre
auto& kernel = system.Kernel();
std::vector<KSynchronizationObject*> objs(num_handles);
- const auto& handle_table = kernel.CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
Handle* handles = system.Memory().GetPointer<Handle>(handles_address);
// Copy user handles.
@@ -91,7 +91,7 @@ Result CancelSynchronization(Core::System& system, Handle handle) {
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Cancel the thread's wait.
@@ -106,7 +106,7 @@ void SynchronizePreemptionState(Core::System& system) {
KScopedSchedulerLock sl{kernel};
// If the current thread is pinned, unpin it.
- KProcess* cur_process = system.Kernel().CurrentProcess();
+ KProcess* cur_process = GetCurrentProcessPointer(kernel);
const auto core_id = GetCurrentCoreId(kernel);
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,
// Adjust core id, if it's the default magic.
auto& kernel = system.Kernel();
- auto& process = *kernel.CurrentProcess();
+ auto& process = GetCurrentProcess(kernel);
if (core_id == IdealCoreUseProcessValue) {
core_id = process.GetIdealCoreId();
}
@@ -53,9 +53,9 @@ Result CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point,
}
// Reserve a new thread from the process resource limit (waiting up to 100ms).
- KScopedResourceReservation thread_reservation(
- kernel.CurrentProcess(), LimitableResource::ThreadCountMax, 1,
- system.CoreTiming().GetGlobalTimeNs().count() + 100000000);
+ KScopedResourceReservation thread_reservation(&process, LimitableResource::ThreadCountMax, 1,
+ system.CoreTiming().GetGlobalTimeNs().count() +
+ 100000000);
if (!thread_reservation.Succeeded()) {
LOG_ERROR(Kernel_SVC, "Could not reserve a new thread");
return ResultLimitReached;
@@ -97,7 +97,7 @@ Result StartThread(Core::System& system, Handle thread_handle) {
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Try to start the thread.
@@ -156,11 +156,11 @@ Result GetThreadContext3(Core::System& system, VAddr out_context, Handle thread_
// Get the thread from its handle.
KScopedAutoObject thread =
- kernel.CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle);
+ GetCurrentProcess(kernel).GetHandleTable().GetObject<KThread>(thread_handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Require the handle be to a non-current thread in the current process.
- const auto* current_process = kernel.CurrentProcess();
+ const auto* current_process = GetCurrentProcessPointer(kernel);
R_UNLESS(current_process == thread->GetOwnerProcess(), ResultInvalidId);
// Verify that the thread isn't terminated.
@@ -211,7 +211,7 @@ Result GetThreadPriority(Core::System& system, s32* out_priority, Handle handle)
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Get the thread's priority.
@@ -222,7 +222,7 @@ Result GetThreadPriority(Core::System& system, s32* out_priority, Handle handle)
/// Sets the priority for the specified thread
Result SetThreadPriority(Core::System& system, Handle thread_handle, s32 priority) {
// Get the current process.
- KProcess& process = *system.Kernel().CurrentProcess();
+ KProcess& process = GetCurrentProcess(system.Kernel());
// Validate the priority.
R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority,
@@ -253,7 +253,7 @@ Result GetThreadList(Core::System& system, s32* out_num_threads, VAddr out_threa
return ResultOutOfRange;
}
- auto* const current_process = system.Kernel().CurrentProcess();
+ auto* const current_process = GetCurrentProcessPointer(system.Kernel());
const auto total_copy_size = out_thread_ids_size * sizeof(u64);
if (out_thread_ids_size > 0 &&
@@ -284,7 +284,7 @@ Result GetThreadCoreMask(Core::System& system, s32* out_core_id, u64* out_affini
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Get the core mask.
@@ -297,11 +297,11 @@ Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id
u64 affinity_mask) {
// Determine the core id/affinity mask.
if (core_id == IdealCoreUseProcessValue) {
- core_id = system.Kernel().CurrentProcess()->GetIdealCoreId();
+ core_id = GetCurrentProcess(system.Kernel()).GetIdealCoreId();
affinity_mask = (1ULL << core_id);
} else {
// Validate the affinity mask.
- const u64 process_core_mask = system.Kernel().CurrentProcess()->GetCoreMask();
+ const u64 process_core_mask = GetCurrentProcess(system.Kernel()).GetCoreMask();
R_UNLESS((affinity_mask | process_core_mask) == process_core_mask, ResultInvalidCoreId);
R_UNLESS(affinity_mask != 0, ResultInvalidCombination);
@@ -316,7 +316,7 @@ Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Set the core mask.
@@ -329,7 +329,7 @@ Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id
Result GetThreadId(Core::System& system, u64* out_thread_id, Handle thread_handle) {
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(thread_handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// 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
R_UNLESS(IsValidTransferMemoryPermission(map_perm), ResultInvalidNewMemoryPermission);
// Get the current process and handle table.
- auto& process = *kernel.CurrentProcess();
+ auto& process = GetCurrentProcess(kernel);
auto& handle_table = process.GetHandleTable();
// Reserve a new transfer memory from the process resource limit.
- KScopedResourceReservation trmem_reservation(kernel.CurrentProcess(),
+ KScopedResourceReservation trmem_reservation(&process,
LimitableResource::TransferMemoryCountMax);
R_UNLESS(trmem_reservation.Succeeded(), ResultLimitReached);
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) {
auto& kernel = system.Kernel();
kernel.EnterSVCProfile();
- if (system.CurrentProcess()->Is64BitProcess()) {
+ if (GetCurrentProcess(system.Kernel()).Is64BitProcess()) {
Call64(system, imm);
} else {
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() {
// processes emulated. As we don't actually have pid support we should assume we're just using
// our own process
const auto launch_property =
- system.GetARPManager().GetLaunchProperty(system.GetCurrentProcessProgramID());
+ system.GetARPManager().GetLaunchProperty(system.GetApplicationProcessProgramID());
if (launch_property.Failed()) {
LOG_ERROR(Service_ACC, "Failed to get launch property");
@@ -806,7 +806,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx
bool is_locked = false;
if (res != Loader::ResultStatus::Success) {
- const FileSys::PatchManager pm{system.GetCurrentProcessProgramID(),
+ const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(),
system.GetFileSystemController(),
system.GetContentProvider()};
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 ebcf6e164..beb2da06e 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -24,7 +24,6 @@
#include "core/hle/service/am/idle.h"
#include "core/hle/service/am/omm.h"
#include "core/hle/service/am/spsm.h"
-#include "core/hle/service/am/tcap.h"
#include "core/hle/service/apm/apm_controller.h"
#include "core/hle/service/apm/apm_interface.h"
#include "core/hle/service/bcat/backend/backend.h"
@@ -79,7 +78,7 @@ IWindowController::IWindowController(Core::System& system_)
IWindowController::~IWindowController() = default;
void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) {
- const u64 process_id = system.CurrentProcess()->GetProcessID();
+ const u64 process_id = system.ApplicationProcess()->GetProcessID();
LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id);
@@ -1252,7 +1251,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex
}
auto transfer_mem =
- system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle);
+ system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle);
if (transfer_mem.IsNull()) {
LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle);
@@ -1286,7 +1285,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx)
}
auto transfer_mem =
- system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle);
+ system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle);
if (transfer_mem.IsNull()) {
LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle);
@@ -1465,11 +1464,12 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
const auto backend = BCAT::CreateBackendFromSettings(system, [this](u64 tid) {
return system.GetFileSystemController().GetBCATDirectory(tid);
});
- const auto build_id_full = system.GetCurrentProcessBuildID();
+ const auto build_id_full = system.GetApplicationProcessBuildID();
u64 build_id{};
std::memcpy(&build_id, build_id_full.data(), sizeof(u64));
- auto data = backend->GetLaunchParameter({system.GetCurrentProcessProgramID(), build_id});
+ auto data =
+ backend->GetLaunchParameter({system.GetApplicationProcessProgramID(), build_id});
if (data.has_value()) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
@@ -1521,7 +1521,7 @@ void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]);
FileSys::SaveDataAttribute attribute{};
- attribute.title_id = system.GetCurrentProcessProgramID();
+ attribute.title_id = system.GetApplicationProcessProgramID();
attribute.user_id = user_id;
attribute.type = FileSys::SaveDataType::SaveData;
const auto res = system.GetFileSystemController().CreateSaveData(
@@ -1551,7 +1551,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
std::array<u8, 0x10> version_string{};
const auto res = [this] {
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
@@ -1570,7 +1570,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
const auto& version = res.first->GetVersionString();
std::copy(version.begin(), version.end(), version_string.begin());
} else {
- constexpr char default_version[]{"1.0.0"};
+ static constexpr char default_version[]{"1.0.0"};
std::memcpy(version_string.data(), default_version, sizeof(default_version));
}
@@ -1588,7 +1588,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
u32 supported_languages = 0;
const auto res = [this] {
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
@@ -1696,7 +1696,8 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) {
static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size);
system.GetFileSystemController().WriteSaveDataSize(
- type, system.GetCurrentProcessProgramID(), user_id, {new_normal_size, new_journal_size});
+ type, system.GetApplicationProcessProgramID(), user_id,
+ {new_normal_size, new_journal_size});
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
@@ -1720,7 +1721,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) {
user_id[0]);
const auto size = system.GetFileSystemController().ReadSaveDataSize(
- type, system.GetCurrentProcessProgramID(), user_id);
+ type, system.GetApplicationProcessProgramID(), user_id);
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(ResultSuccess);
@@ -1838,7 +1839,6 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger
std::make_shared<IdleSys>(system)->InstallAsService(service_manager);
std::make_shared<OMM>(system)->InstallAsService(service_manager);
std::make_shared<SPSM>(system)->InstallAsService(service_manager);
- std::make_shared<TCAP>(system)->InstallAsService(service_manager);
}
IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_)
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() {
}
const auto callback = [this] { DisplayCompleted(); };
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
const auto& reporter{system.GetReporter()};
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() {
const auto callback = [this] { ViewFinished(); };
switch (mode) {
case PhotoViewerAppletMode::CurrentApp:
- frontend.ShowPhotosForApplication(system.GetCurrentProcessProgramID(), callback);
+ frontend.ShowPhotosForApplication(system.GetApplicationProcessProgramID(), callback);
break;
case PhotoViewerAppletMode::AllApps:
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() {
switch (document_kind) {
case DocumentKind::OfflineHtmlPage:
default:
- title_id = system.GetCurrentProcessProgramID();
+ title_id = system.GetApplicationProcessProgramID();
nca_type = FileSys::ContentRecordType::HtmlDocument;
additional_paths = "html-document";
break;
diff --git a/src/core/hle/service/am/tcap.cpp b/src/core/hle/service/am/tcap.cpp
deleted file mode 100644
index 818420e22..000000000
--- a/src/core/hle/service/am/tcap.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/am/tcap.h"
-
-namespace Service::AM {
-
-TCAP::TCAP(Core::System& system_) : ServiceFramework{system_, "tcap"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "GetContinuousHighSkinTemperatureEvent"},
- {1, nullptr, "SetOperationMode"},
- {2, nullptr, "LoadAndApplySettings"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-TCAP::~TCAP() = default;
-
-} // namespace Service::AM
diff --git a/src/core/hle/service/am/tcap.h b/src/core/hle/service/am/tcap.h
deleted file mode 100644
index 6b2148c29..000000000
--- a/src/core/hle/service/am/tcap.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Core {
-class System;
-}
-
-namespace Service::AM {
-
-class TCAP final : public ServiceFramework<TCAP> {
-public:
- explicit TCAP(Core::System& system_);
- ~TCAP() override;
-};
-
-} // namespace Service::AM
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) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- const auto current = system.GetCurrentProcessProgramID();
+ const auto current = system.GetApplicationProcessProgramID();
const auto& disabled = Settings::values.disabled_addons[current];
if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) {
@@ -182,7 +182,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count,
process_id);
- const auto current = system.GetCurrentProcessProgramID();
+ const auto current = system.GetApplicationProcessProgramID();
std::vector<u32> out;
const auto& disabled = Settings::values.disabled_addons[current];
@@ -228,7 +228,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess);
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
diff --git a/src/core/hle/service/apm/apm.cpp b/src/core/hle/service/apm/apm.cpp
index 8a338d9b1..44b2927a6 100644
--- a/src/core/hle/service/apm/apm.cpp
+++ b/src/core/hle/service/apm/apm.cpp
@@ -14,8 +14,6 @@ void InstallInterfaces(Core::System& system) {
auto module_ = std::make_shared<Module>();
std::make_shared<APM>(system, module_, system.GetAPMController(), "apm")
->InstallAsService(system.ServiceManager());
- std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:p")
- ->InstallAsService(system.ServiceManager());
std::make_shared<APM>(system, module_, system.GetAPMController(), "apm:am")
->InstallAsService(system.ServiceManager());
std::make_shared<APM_Sys>(system, system.GetAPMController())
diff --git a/src/core/hle/service/apm/apm_controller.cpp b/src/core/hle/service/apm/apm_controller.cpp
index d6de84066..227fdd0cf 100644
--- a/src/core/hle/service/apm/apm_controller.cpp
+++ b/src/core/hle/service/apm/apm_controller.cpp
@@ -56,7 +56,7 @@ void Controller::SetPerformanceConfiguration(PerformanceMode mode,
}
void Controller::SetFromCpuBoostMode(CpuBoostMode mode) {
- constexpr std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{
+ static constexpr std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{
PerformanceConfiguration::Config7,
PerformanceConfiguration::Config13,
PerformanceConfiguration::Config15,
diff --git a/src/core/hle/service/audio/auddbg.cpp b/src/core/hle/service/audio/auddbg.cpp
deleted file mode 100644
index 5541af300..000000000
--- a/src/core/hle/service/audio/auddbg.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/audio/auddbg.h"
-
-namespace Service::Audio {
-
-AudDbg::AudDbg(Core::System& system_, const char* name) : ServiceFramework{system_, name} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "RequestSuspendForDebug"},
- {1, nullptr, "RequestResumeForDebug"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-AudDbg::~AudDbg() = default;
-
-} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/auddbg.h b/src/core/hle/service/audio/auddbg.h
deleted file mode 100644
index 8f26be5dc..000000000
--- a/src/core/hle/service/audio/auddbg.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Core {
-class System;
-}
-
-namespace Service::Audio {
-
-class AudDbg final : public ServiceFramework<AudDbg> {
-public:
- explicit AudDbg(Core::System& system_, const char* name);
- ~AudDbg() override;
-};
-
-} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audin_a.cpp b/src/core/hle/service/audio/audin_a.cpp
deleted file mode 100644
index 98f4a6048..000000000
--- a/src/core/hle/service/audio/audin_a.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/audio/audin_a.h"
-
-namespace Service::Audio {
-
-AudInA::AudInA(Core::System& system_) : ServiceFramework{system_, "audin:a"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "RequestSuspend"},
- {1, nullptr, "RequestResume"},
- {2, nullptr, "GetProcessMasterVolume"},
- {3, nullptr, "SetProcessMasterVolume"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-AudInA::~AudInA() = default;
-
-} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audin_a.h b/src/core/hle/service/audio/audin_a.h
deleted file mode 100644
index 19a927de5..000000000
--- a/src/core/hle/service/audio/audin_a.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Core {
-class System;
-}
-
-namespace Service::Audio {
-
-class AudInA final : public ServiceFramework<AudInA> {
-public:
- explicit AudInA(Core::System& system_);
- ~AudInA() override;
-};
-
-} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audio.cpp b/src/core/hle/service/audio/audio.cpp
index 97da71dfa..ed36e3448 100644
--- a/src/core/hle/service/audio/audio.cpp
+++ b/src/core/hle/service/audio/audio.cpp
@@ -2,17 +2,12 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/audio/audctl.h"
-#include "core/hle/service/audio/auddbg.h"
-#include "core/hle/service/audio/audin_a.h"
#include "core/hle/service/audio/audin_u.h"
#include "core/hle/service/audio/audio.h"
-#include "core/hle/service/audio/audout_a.h"
#include "core/hle/service/audio/audout_u.h"
#include "core/hle/service/audio/audrec_a.h"
#include "core/hle/service/audio/audrec_u.h"
-#include "core/hle/service/audio/audren_a.h"
#include "core/hle/service/audio/audren_u.h"
-#include "core/hle/service/audio/codecctl.h"
#include "core/hle/service/audio/hwopus.h"
#include "core/hle/service/service.h"
@@ -20,21 +15,12 @@ namespace Service::Audio {
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
std::make_shared<AudCtl>(system)->InstallAsService(service_manager);
- std::make_shared<AudOutA>(system)->InstallAsService(service_manager);
std::make_shared<AudOutU>(system)->InstallAsService(service_manager);
- std::make_shared<AudInA>(system)->InstallAsService(service_manager);
std::make_shared<AudInU>(system)->InstallAsService(service_manager);
std::make_shared<AudRecA>(system)->InstallAsService(service_manager);
std::make_shared<AudRecU>(system)->InstallAsService(service_manager);
- std::make_shared<AudRenA>(system)->InstallAsService(service_manager);
std::make_shared<AudRenU>(system)->InstallAsService(service_manager);
- std::make_shared<CodecCtl>(system)->InstallAsService(service_manager);
std::make_shared<HwOpus>(system)->InstallAsService(service_manager);
-
- std::make_shared<AudDbg>(system, "audin:d")->InstallAsService(service_manager);
- std::make_shared<AudDbg>(system, "audout:d")->InstallAsService(service_manager);
- std::make_shared<AudDbg>(system, "audrec:d")->InstallAsService(service_manager);
- std::make_shared<AudDbg>(system, "audren:d")->InstallAsService(service_manager);
}
} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audout_a.cpp b/src/core/hle/service/audio/audout_a.cpp
deleted file mode 100644
index 5ecb99236..000000000
--- a/src/core/hle/service/audio/audout_a.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/audio/audout_a.h"
-
-namespace Service::Audio {
-
-AudOutA::AudOutA(Core::System& system_) : ServiceFramework{system_, "audout:a"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "RequestSuspend"},
- {1, nullptr, "RequestResume"},
- {2, nullptr, "GetProcessMasterVolume"},
- {3, nullptr, "SetProcessMasterVolume"},
- {4, nullptr, "GetProcessRecordVolume"},
- {5, nullptr, "SetProcessRecordVolume"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-AudOutA::~AudOutA() = default;
-
-} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audout_a.h b/src/core/hle/service/audio/audout_a.h
deleted file mode 100644
index f641cffeb..000000000
--- a/src/core/hle/service/audio/audout_a.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Core {
-class System;
-}
-
-namespace Service::Audio {
-
-class AudOutA final : public ServiceFramework<AudOutA> {
-public:
- explicit AudOutA(Core::System& system_);
- ~AudOutA() override;
-};
-
-} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audren_a.cpp b/src/core/hle/service/audio/audren_a.cpp
deleted file mode 100644
index e775ac3bf..000000000
--- a/src/core/hle/service/audio/audren_a.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/audio/audren_a.h"
-
-namespace Service::Audio {
-
-AudRenA::AudRenA(Core::System& system_) : ServiceFramework{system_, "audren:a"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "RequestSuspend"},
- {1, nullptr, "RequestResume"},
- {2, nullptr, "GetProcessMasterVolume"},
- {3, nullptr, "SetProcessMasterVolume"},
- {4, nullptr, "RegisterAppletResourceUserId"},
- {5, nullptr, "UnregisterAppletResourceUserId"},
- {6, nullptr, "GetProcessRecordVolume"},
- {7, nullptr, "SetProcessRecordVolume"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-AudRenA::~AudRenA() = default;
-
-} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/audren_a.h b/src/core/hle/service/audio/audren_a.h
deleted file mode 100644
index 9e08b4245..000000000
--- a/src/core/hle/service/audio/audren_a.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Core {
-class System;
-}
-
-namespace Service::Audio {
-
-class AudRenA final : public ServiceFramework<AudRenA> {
-public:
- explicit AudRenA(Core::System& system_);
- ~AudRenA() override;
-};
-
-} // namespace Service::Audio
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) {
return;
}
- const auto& handle_table{system.CurrentProcess()->GetHandleTable()};
+ const auto& handle_table{system.ApplicationProcess()->GetHandleTable()};
auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)};
auto transfer_memory{
process->GetHandleTable().GetObject<Kernel::KTransferMemory>(transfer_memory_handle)};
diff --git a/src/core/hle/service/audio/codecctl.cpp b/src/core/hle/service/audio/codecctl.cpp
deleted file mode 100644
index 81b956d7e..000000000
--- a/src/core/hle/service/audio/codecctl.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/audio/codecctl.h"
-
-namespace Service::Audio {
-
-CodecCtl::CodecCtl(Core::System& system_) : ServiceFramework{system_, "codecctl"} {
- static const FunctionInfo functions[] = {
- {0, nullptr, "Initialize"},
- {1, nullptr, "Finalize"},
- {2, nullptr, "Sleep"},
- {3, nullptr, "Wake"},
- {4, nullptr, "SetVolume"},
- {5, nullptr, "GetVolumeMax"},
- {6, nullptr, "GetVolumeMin"},
- {7, nullptr, "SetActiveTarget"},
- {8, nullptr, "GetActiveTarget"},
- {9, nullptr, "BindHeadphoneMicJackInterrupt"},
- {10, nullptr, "IsHeadphoneMicJackInserted"},
- {11, nullptr, "ClearHeadphoneMicJackInterrupt"},
- {12, nullptr, "IsRequested"},
- };
- RegisterHandlers(functions);
-}
-
-CodecCtl::~CodecCtl() = default;
-
-} // namespace Service::Audio
diff --git a/src/core/hle/service/audio/codecctl.h b/src/core/hle/service/audio/codecctl.h
deleted file mode 100644
index 34da98212..000000000
--- a/src/core/hle/service/audio/codecctl.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Core {
-class System;
-}
-
-namespace Service::Audio {
-
-class CodecCtl final : public ServiceFramework<CodecCtl> {
-public:
- explicit CodecCtl(Core::System& system_);
- ~CodecCtl() override;
-};
-
-} // namespace Service::Audio
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:
void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_BCAT, "called");
- backend.Synchronize({system.GetCurrentProcessProgramID(),
- GetCurrentBuildID(system.GetCurrentProcessBuildID())},
+ backend.Synchronize({system.GetApplicationProcessProgramID(),
+ GetCurrentBuildID(system.GetApplicationProcessBuildID())},
GetProgressBackend(SyncType::Normal));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -193,8 +193,8 @@ private:
LOG_DEBUG(Service_BCAT, "called, name={}", name);
- backend.SynchronizeDirectory({system.GetCurrentProcessProgramID(),
- GetCurrentBuildID(system.GetCurrentProcessBuildID())},
+ backend.SynchronizeDirectory({system.GetApplicationProcessProgramID(),
+ GetCurrentBuildID(system.GetApplicationProcessBuildID())},
name, GetProgressBackend(SyncType::Directory));
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -554,7 +554,7 @@ private:
void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_BCAT, "called");
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess);
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 {
};
static void GenerateErrorReport(Core::System& system, Result error_code, const FatalInfo& info) {
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
std::string crash_report = fmt::format(
"Yuzu {}-{} crash report\n"
"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()
return ResultUnknown;
}
- return romfs_factory->OpenCurrentProcess(system.GetCurrentProcessProgramID());
+ return romfs_factory->OpenCurrentProcess(system.GetApplicationProcessProgramID());
}
ResultVal<FileSys::VirtualFile> FileSystemController::OpenPatchedRomFS(
@@ -502,7 +502,7 @@ FileSys::SaveDataSize FileSystemController::ReadSaveDataSize(FileSys::SaveDataTy
const auto res = system.GetAppLoader().ReadControlData(nacp);
if (res != Loader::ResultStatus::Success) {
- const FileSys::PatchManager pm{system.GetCurrentProcessProgramID(),
+ const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(),
system.GetFileSystemController(),
system.GetContentProvider()};
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) {
LOG_DEBUG(Service_FS, "called, program_index={}", program_index);
- auto patched_romfs = fsc.OpenPatchedRomFSWithProgramIndex(
- system.GetCurrentProcessProgramID(), program_index, FileSys::ContentRecordType::Program);
+ auto patched_romfs =
+ fsc.OpenPatchedRomFSWithProgramIndex(system.GetApplicationProcessProgramID(), program_index,
+ FileSys::ContentRecordType::Program);
if (patched_romfs.Failed()) {
// 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 5a1aa0903..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) {
ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes");
ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes");
- auto t_mem_1 = system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
+ auto t_mem_1 = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
t_mem_1_handle);
if (t_mem_1.IsNull()) {
@@ -1840,7 +1840,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) {
return;
}
- auto t_mem_2 = system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
+ auto t_mem_2 = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
t_mem_2_handle);
if (t_mem_2.IsNull()) {
@@ -2127,8 +2127,8 @@ void Hid::WritePalmaWaveEntry(Kernel::HLERequestContext& ctx) {
ASSERT_MSG(t_mem_size == 0x3000, "t_mem_size is not 0x3000 bytes");
- auto t_mem =
- system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle);
+ auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
+ t_mem_handle);
if (t_mem.IsNull()) {
LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle);
@@ -2734,25 +2734,11 @@ private:
}
};
-class HidTmp final : public ServiceFramework<HidTmp> {
-public:
- explicit HidTmp(Core::System& system_) : ServiceFramework{system_, "hid:tmp"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "GetConsoleSixAxisSensorCalibrationValues"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
- }
-};
-
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
std::make_shared<Hid>(system)->InstallAsService(service_manager);
std::make_shared<HidBus>(system)->InstallAsService(service_manager);
std::make_shared<HidDbg>(system)->InstallAsService(service_manager);
std::make_shared<HidSys>(system)->InstallAsService(service_manager);
- std::make_shared<HidTmp>(system)->InstallAsService(service_manager);
std::make_shared<Service::IRS::IRS>(system)->InstallAsService(service_manager);
std::make_shared<Service::IRS::IRS_SYS>(system)->InstallAsService(service_manager);
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) {
ASSERT_MSG(t_mem_size == 0x1000, "t_mem_size is not 0x1000 bytes");
- auto t_mem =
- system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle);
+ auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
+ t_mem_handle);
if (t_mem.IsNull()) {
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) {
const auto parameters{rp.PopRaw<Parameters>()};
const auto t_mem_handle{ctx.GetCopyHandle(0)};
- auto t_mem =
- system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle);
+ auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
+ t_mem_handle);
if (t_mem.IsNull()) {
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) {
const auto parameters{rp.PopRaw<Parameters>()};
const auto t_mem_handle{ctx.GetCopyHandle(0)};
- auto t_mem =
- system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(t_mem_handle);
+ auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(
+ t_mem_handle);
u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress());
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:
return;
}
- // Fetch using the handle table for the current process here,
+ // Fetch using the handle table for the application process here,
// since we are not multiprocess yet.
- const auto& handle_table{system.CurrentProcess()->GetHandleTable()};
+ const auto& handle_table{system.ApplicationProcess()->GetHandleTable()};
auto process{handle_table.GetObject<Kernel::KProcess>(process_handle)};
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:
return;
}
- if (system.GetCurrentProcessProgramID() != header.application_id) {
+ if (system.GetApplicationProcessProgramID() != header.application_id) {
LOG_ERROR(Service_LDR,
"Attempting to load NRR with title ID other than current process. (actual "
"{:016X})!",
@@ -542,15 +542,16 @@ public:
}
// Map memory for the NRO
- const auto map_result{MapNro(system.CurrentProcess(), nro_address, nro_size, bss_address,
- bss_size, nro_size + bss_size)};
+ const auto map_result{MapNro(system.ApplicationProcess(), nro_address, nro_size,
+ bss_address, bss_size, nro_size + bss_size)};
if (map_result.Failed()) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(map_result.Code());
}
// Load the NRO into the mapped memory
- if (const auto result{LoadNro(system.CurrentProcess(), header, nro_address, *map_result)};
+ if (const auto result{
+ LoadNro(system.ApplicationProcess(), header, nro_address, *map_result)};
result.IsError()) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(map_result.Code());
@@ -570,7 +571,7 @@ public:
Result UnmapNro(const NROInfo& info) {
// Each region must be unmapped separately to validate memory state
- auto& page_table{system.CurrentProcess()->PageTable()};
+ auto& page_table{system.ApplicationProcess()->PageTable()};
if (info.bss_size != 0) {
CASCADE_CODE(page_table.UnmapCodeMemory(
@@ -641,7 +642,7 @@ public:
LOG_WARNING(Service_LDR, "(STUBBED) called");
initialized = true;
- current_map_addr = system.CurrentProcess()->PageTable().GetAliasCodeRegionStart();
+ current_map_addr = system.ApplicationProcess()->PageTable().GetAliasCodeRegionStart();
IPC::ResponseBuilder rb{ctx, 2};
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
sizeof(ApplicationArea) - data.size());
// TODO: Investigate why the title id needs to be moddified
- tag_data.title_id = system.GetCurrentProcessProgramID();
+ tag_data.title_id = system.GetApplicationProcessProgramID();
tag_data.title_id = tag_data.title_id | 0x30000000ULL;
tag_data.settings.settings.appdata_initialized.Assign(1);
tag_data.application_area_id = access_id;
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.h b/src/core/hle/service/nvdrv/core/syncpoint_manager.h
index 4f2cefae5..7728ff596 100644
--- a/src/core/hle/service/nvdrv/core/syncpoint_manager.h
+++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.h
@@ -124,7 +124,7 @@ private:
//!< value
};
- constexpr static std::size_t SyncpointCount{192};
+ static constexpr std::size_t SyncpointCount{192};
std::array<SyncpointInfo, SyncpointCount> syncpoints{};
std::mutex reservation_lock;
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
const auto check_failing = [&]() {
if (events[slot].fails > 2) {
{
- auto lk = system.StallProcesses();
+ auto lk = system.StallApplication();
host1x_syncpoint_manager.WaitHost(fence_id, target_value);
- system.UnstallProcesses();
+ system.UnstallApplication();
}
params.value.raw = target_value;
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) {
return result;
}
bool is_out_io{};
- ASSERT(system.CurrentProcess()
+ ASSERT(system.ApplicationProcess()
->PageTable()
.LockForMapDeviceAddressSpace(&is_out_io, handle_description->address,
handle_description->size,
@@ -254,7 +254,7 @@ NvResult nvmap::IocFree(std::span<const u8> input, std::vector<u8>& output) {
if (auto freeInfo{file.FreeHandle(params.handle, false)}) {
if (freeInfo->can_unlock) {
- ASSERT(system.CurrentProcess()
+ ASSERT(system.ApplicationProcess()
->PageTable()
.UnlockForDeviceAddressSpace(freeInfo->address, freeInfo->size)
.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:
// TODO(ogniK): Recovery flag initialization for pctl:r
- const auto tid = system.GetCurrentProcessProgramID();
+ const auto tid = system.GetApplicationProcessProgramID();
if (tid != 0) {
const FileSys::PatchManager pm{tid, system.GetFileSystemController(),
system.GetContentProvider()};
diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp
index f7a497a14..98037a8d4 100644
--- a/src/core/hle/service/pcv/pcv.cpp
+++ b/src/core/hle/service/pcv/pcv.cpp
@@ -52,32 +52,6 @@ public:
}
};
-class PCV_ARB final : public ServiceFramework<PCV_ARB> {
-public:
- explicit PCV_ARB(Core::System& system_) : ServiceFramework{system_, "pcv:arb"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "ReleaseControl"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
- }
-};
-
-class PCV_IMM final : public ServiceFramework<PCV_IMM> {
-public:
- explicit PCV_IMM(Core::System& system_) : ServiceFramework{system_, "pcv:imm"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "SetClockRate"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
- }
-};
-
class IClkrstSession final : public ServiceFramework<IClkrstSession> {
public:
explicit IClkrstSession(Core::System& system_, DeviceCode deivce_code_)
@@ -169,8 +143,6 @@ public:
void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<PCV>(system)->InstallAsService(sm);
- std::make_shared<PCV_ARB>(system)->InstallAsService(sm);
- std::make_shared<PCV_IMM>(system)->InstallAsService(sm);
std::make_shared<CLKRST>(system, "clkrst")->InstallAsService(sm);
std::make_shared<CLKRST>(system, "clkrst:i")->InstallAsService(sm);
std::make_shared<CLKRST_A>(system)->InstallAsService(sm);
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:
Type, process_id, data1.size(), data2.size());
const auto& reporter{system.GetReporter()};
- reporter.SavePlayReport(Type, system.GetCurrentProcessProgramID(), {data1, data2},
+ reporter.SavePlayReport(Type, system.GetApplicationProcessProgramID(), {data1, data2},
process_id);
IPC::ResponseBuilder rb{ctx, 2};
@@ -99,7 +99,7 @@ private:
Type, user_id[1], user_id[0], process_id, data1.size(), data2.size());
const auto& reporter{system.GetReporter()};
- reporter.SavePlayReport(Type, system.GetCurrentProcessProgramID(), {data1, data2},
+ reporter.SavePlayReport(Type, system.GetApplicationProcessProgramID(), {data1, data2},
process_id, user_id);
IPC::ResponseBuilder rb{ctx, 2};
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 0de67f1e1..1ffc1c694 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -68,7 +68,6 @@
#include "core/hle/service/time/time.h"
#include "core/hle/service/usb/usb.h"
#include "core/hle/service/vi/vi.h"
-#include "core/hle/service/wlan/wlan.h"
#include "core/reporter.h"
namespace Service {
@@ -306,7 +305,6 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
Time::InstallInterfaces(system);
USB::InstallInterfaces(*sm, system);
VI::InstallInterfaces(*sm, system, *nv_flinger, *hos_binder_driver_server);
- WLAN::InstallInterfaces(*sm, system);
}
Services::~Services() = default;
diff --git a/src/core/hle/service/sockets/ethc.cpp b/src/core/hle/service/sockets/ethc.cpp
deleted file mode 100644
index c12ea999b..000000000
--- a/src/core/hle/service/sockets/ethc.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include "core/hle/service/sockets/ethc.h"
-
-namespace Service::Sockets {
-
-ETHC_C::ETHC_C(Core::System& system_) : ServiceFramework{system_, "ethc:c"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "Initialize"},
- {1, nullptr, "Cancel"},
- {2, nullptr, "GetResult"},
- {3, nullptr, "GetMediaList"},
- {4, nullptr, "SetMediaType"},
- {5, nullptr, "GetMediaType"},
- {6, nullptr, "Unknown6"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-ETHC_C::~ETHC_C() = default;
-
-ETHC_I::ETHC_I(Core::System& system_) : ServiceFramework{system_, "ethc:i"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "GetReadableHandle"},
- {1, nullptr, "Cancel"},
- {2, nullptr, "GetResult"},
- {3, nullptr, "GetInterfaceList"},
- {4, nullptr, "GetInterfaceCount"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
-}
-
-ETHC_I::~ETHC_I() = default;
-
-} // namespace Service::Sockets
diff --git a/src/core/hle/service/sockets/ethc.h b/src/core/hle/service/sockets/ethc.h
deleted file mode 100644
index 7c5759a96..000000000
--- a/src/core/hle/service/sockets/ethc.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Core {
-class System;
-}
-
-namespace Service::Sockets {
-
-class ETHC_C final : public ServiceFramework<ETHC_C> {
-public:
- explicit ETHC_C(Core::System& system_);
- ~ETHC_C() override;
-};
-
-class ETHC_I final : public ServiceFramework<ETHC_I> {
-public:
- explicit ETHC_I(Core::System& system_);
- ~ETHC_I() override;
-};
-
-} // namespace Service::Sockets
diff --git a/src/core/hle/service/sockets/sockets.cpp b/src/core/hle/service/sockets/sockets.cpp
index 8d3ba6f96..b191b5cf5 100644
--- a/src/core/hle/service/sockets/sockets.cpp
+++ b/src/core/hle/service/sockets/sockets.cpp
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/sockets/bsd.h"
-#include "core/hle/service/sockets/ethc.h"
#include "core/hle/service/sockets/nsd.h"
#include "core/hle/service/sockets/sfdnsres.h"
#include "core/hle/service/sockets/sockets.h"
@@ -14,9 +13,6 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
std::make_shared<BSD>(system, "bsd:u")->InstallAsService(service_manager);
std::make_shared<BSDCFG>(system)->InstallAsService(service_manager);
- std::make_shared<ETHC_C>(system)->InstallAsService(service_manager);
- std::make_shared<ETHC_I>(system)->InstallAsService(service_manager);
-
std::make_shared<NSD>(system, "nsd:a")->InstallAsService(service_manager);
std::make_shared<NSD>(system, "nsd:u")->InstallAsService(service_manager);
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp
index f9ada7c93..973f7837a 100644
--- a/src/core/hle/service/time/time_zone_manager.cpp
+++ b/src/core/hle/service/time/time_zone_manager.cpp
@@ -286,7 +286,7 @@ static constexpr int TransitionTime(int year, Rule rule, int offset) {
}
static bool ParsePosixName(const char* name, TimeZoneRule& rule) {
- constexpr char default_rule[]{",M4.1.0,M10.5.0"};
+ static constexpr char default_rule[]{",M4.1.0,M10.5.0"};
const char* std_name{name};
int std_len{};
int offset{};
diff --git a/src/core/hle/service/wlan/wlan.cpp b/src/core/hle/service/wlan/wlan.cpp
deleted file mode 100644
index 226e3034c..000000000
--- a/src/core/hle/service/wlan/wlan.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#include <memory>
-
-#include "core/hle/service/service.h"
-#include "core/hle/service/sm/sm.h"
-#include "core/hle/service/wlan/wlan.h"
-
-namespace Service::WLAN {
-
-class WLANInfra final : public ServiceFramework<WLANInfra> {
-public:
- explicit WLANInfra(Core::System& system_) : ServiceFramework{system_, "wlan:inf"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "OpenMode"},
- {1, nullptr, "CloseMode"},
- {2, nullptr, "GetMacAddress"},
- {3, nullptr, "StartScan"},
- {4, nullptr, "StopScan"},
- {5, nullptr, "Connect"},
- {6, nullptr, "CancelConnect"},
- {7, nullptr, "Disconnect"},
- {8, nullptr, "GetConnectionEvent"},
- {9, nullptr, "GetConnectionStatus"},
- {10, nullptr, "GetState"},
- {11, nullptr, "GetScanResult"},
- {12, nullptr, "GetRssi"},
- {13, nullptr, "ChangeRxAntenna"},
- {14, nullptr, "GetFwVersion"},
- {15, nullptr, "RequestSleep"},
- {16, nullptr, "RequestWakeUp"},
- {17, nullptr, "RequestIfUpDown"},
- {18, nullptr, "Unknown18"},
- {19, nullptr, "Unknown19"},
- {20, nullptr, "Unknown20"},
- {21, nullptr, "Unknown21"},
- {22, nullptr, "Unknown22"},
- {23, nullptr, "Unknown23"},
- {24, nullptr, "Unknown24"},
- {25, nullptr, "Unknown25"},
- {26, nullptr, "Unknown26"},
- {27, nullptr, "Unknown27"},
- {28, nullptr, "Unknown28"},
- {29, nullptr, "Unknown29"},
- {30, nullptr, "Unknown30"},
- {31, nullptr, "Unknown31"},
- {32, nullptr, "Unknown32"},
- {33, nullptr, "Unknown33"},
- {34, nullptr, "Unknown34"},
- {35, nullptr, "Unknown35"},
- {36, nullptr, "Unknown36"},
- {37, nullptr, "Unknown37"},
- {38, nullptr, "Unknown38"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
- }
-};
-
-class WLANLocal final : public ServiceFramework<WLANLocal> {
-public:
- explicit WLANLocal(Core::System& system_) : ServiceFramework{system_, "wlan:lcl"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "Unknown0"},
- {1, nullptr, "Unknown1"},
- {2, nullptr, "Unknown2"},
- {3, nullptr, "Unknown3"},
- {4, nullptr, "Unknown4"},
- {5, nullptr, "Unknown5"},
- {6, nullptr, "GetMacAddress"},
- {7, nullptr, "CreateBss"},
- {8, nullptr, "DestroyBss"},
- {9, nullptr, "StartScan"},
- {10, nullptr, "StopScan"},
- {11, nullptr, "Connect"},
- {12, nullptr, "CancelConnect"},
- {13, nullptr, "Join"},
- {14, nullptr, "CancelJoin"},
- {15, nullptr, "Disconnect"},
- {16, nullptr, "SetBeaconLostCount"},
- {17, nullptr, "Unknown17"},
- {18, nullptr, "Unknown18"},
- {19, nullptr, "Unknown19"},
- {20, nullptr, "GetBssIndicationEvent"},
- {21, nullptr, "GetBssIndicationInfo"},
- {22, nullptr, "GetState"},
- {23, nullptr, "GetAllowedChannels"},
- {24, nullptr, "AddIe"},
- {25, nullptr, "DeleteIe"},
- {26, nullptr, "Unknown26"},
- {27, nullptr, "Unknown27"},
- {28, nullptr, "CreateRxEntry"},
- {29, nullptr, "DeleteRxEntry"},
- {30, nullptr, "Unknown30"},
- {31, nullptr, "Unknown31"},
- {32, nullptr, "AddMatchingDataToRxEntry"},
- {33, nullptr, "RemoveMatchingDataFromRxEntry"},
- {34, nullptr, "GetScanResult"},
- {35, nullptr, "Unknown35"},
- {36, nullptr, "SetActionFrameWithBeacon"},
- {37, nullptr, "CancelActionFrameWithBeacon"},
- {38, nullptr, "CreateRxEntryForActionFrame"},
- {39, nullptr, "DeleteRxEntryForActionFrame"},
- {40, nullptr, "Unknown40"},
- {41, nullptr, "Unknown41"},
- {42, nullptr, "CancelGetActionFrame"},
- {43, nullptr, "GetRssi"},
- {44, nullptr, "Unknown44"},
- {45, nullptr, "Unknown45"},
- {46, nullptr, "Unknown46"},
- {47, nullptr, "Unknown47"},
- {48, nullptr, "Unknown48"},
- {49, nullptr, "Unknown49"},
- {50, nullptr, "Unknown50"},
- {51, nullptr, "Unknown51"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
- }
-};
-
-class WLANLocalGetFrame final : public ServiceFramework<WLANLocalGetFrame> {
-public:
- explicit WLANLocalGetFrame(Core::System& system_) : ServiceFramework{system_, "wlan:lg"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "Unknown"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
- }
-};
-
-class WLANSocketGetFrame final : public ServiceFramework<WLANSocketGetFrame> {
-public:
- explicit WLANSocketGetFrame(Core::System& system_) : ServiceFramework{system_, "wlan:sg"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "Unknown"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
- }
-};
-
-class WLANSocketManager final : public ServiceFramework<WLANSocketManager> {
-public:
- explicit WLANSocketManager(Core::System& system_) : ServiceFramework{system_, "wlan:soc"} {
- // clang-format off
- static const FunctionInfo functions[] = {
- {0, nullptr, "Unknown0"},
- {1, nullptr, "Unknown1"},
- {2, nullptr, "Unknown2"},
- {3, nullptr, "Unknown3"},
- {4, nullptr, "Unknown4"},
- {5, nullptr, "Unknown5"},
- {6, nullptr, "GetMacAddress"},
- {7, nullptr, "SwitchTsfTimerFunction"},
- {8, nullptr, "Unknown8"},
- {9, nullptr, "Unknown9"},
- {10, nullptr, "Unknown10"},
- {11, nullptr, "Unknown11"},
- {12, nullptr, "Unknown12"},
- };
- // clang-format on
-
- RegisterHandlers(functions);
- }
-};
-
-void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
- std::make_shared<WLANInfra>(system)->InstallAsService(sm);
- std::make_shared<WLANLocal>(system)->InstallAsService(sm);
- std::make_shared<WLANLocalGetFrame>(system)->InstallAsService(sm);
- std::make_shared<WLANSocketGetFrame>(system)->InstallAsService(sm);
- std::make_shared<WLANSocketManager>(system)->InstallAsService(sm);
-}
-
-} // namespace Service::WLAN
diff --git a/src/core/hle/service/wlan/wlan.h b/src/core/hle/service/wlan/wlan.h
deleted file mode 100644
index 535c3bf0d..000000000
--- a/src/core/hle/service/wlan/wlan.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-#pragma once
-
-namespace Core {
-class System;
-}
-
-namespace Service::SM {
-class ServiceManager;
-}
-
-namespace Service::WLAN {
-
-void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
-
-} // namespace Service::WLAN
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::
// Apply cheats if they exist and the program has a valid title ID
if (pm) {
- system.SetCurrentProcessBuildID(nso_header.build_id);
+ system.SetApplicationProcessBuildID(nso_header.build_id);
const auto cheats = pm->CreateCheatList(nso_header.build_id);
if (!cheats.empty()) {
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 {
}
void ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_t size) {
- ReadBlockImpl<false>(*system.CurrentProcess(), src_addr, dest_buffer, size);
+ ReadBlockImpl<false>(*system.ApplicationProcess(), src_addr, dest_buffer, size);
}
void ReadBlockUnsafe(const VAddr src_addr, void* dest_buffer, const std::size_t size) {
- ReadBlockImpl<true>(*system.CurrentProcess(), src_addr, dest_buffer, size);
+ ReadBlockImpl<true>(*system.ApplicationProcess(), src_addr, dest_buffer, size);
}
template <bool UNSAFE>
@@ -279,11 +279,11 @@ struct Memory::Impl {
}
void WriteBlock(const VAddr dest_addr, const void* src_buffer, const std::size_t size) {
- WriteBlockImpl<false>(*system.CurrentProcess(), dest_addr, src_buffer, size);
+ WriteBlockImpl<false>(*system.ApplicationProcess(), dest_addr, src_buffer, size);
}
void WriteBlockUnsafe(const VAddr dest_addr, const void* src_buffer, const std::size_t size) {
- WriteBlockImpl<true>(*system.CurrentProcess(), dest_addr, src_buffer, size);
+ WriteBlockImpl<true>(*system.ApplicationProcess(), dest_addr, src_buffer, size);
}
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) {
}
bool Memory::IsValidVirtualAddress(const VAddr vaddr) const {
- const Kernel::KProcess& process = *system.CurrentProcess();
+ const Kernel::KProcess& process = *system.ApplicationProcess();
const auto& page_table = process.PageTable().PageTableImpl();
const size_t page = vaddr >> YUZU_PAGEBITS;
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() {
});
core_timing.ScheduleLoopingEvent(CHEAT_ENGINE_NS, CHEAT_ENGINE_NS, event);
- metadata.process_id = system.CurrentProcess()->GetProcessID();
- metadata.title_id = system.GetCurrentProcessProgramID();
+ metadata.process_id = system.ApplicationProcess()->GetProcessID();
+ metadata.title_id = system.GetApplicationProcessProgramID();
- const auto& page_table = system.CurrentProcess()->PageTable();
+ const auto& page_table = system.ApplicationProcess()->PageTable();
metadata.heap_extents = {
.base = page_table.GetHeapRegionStart(),
.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
}
json GetProcessorStateDataAuto(Core::System& system) {
- const auto* process{system.CurrentProcess()};
+ const auto* process{system.ApplicationProcess()};
auto& arm{system.CurrentArmInterface()};
Core::ARM_Interface::ThreadContext64 context{};
@@ -234,7 +234,7 @@ void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64
}
const auto timestamp = GetTimestamp();
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
auto out = GetFullDataAuto(timestamp, title_id, system);
auto break_out = json{
@@ -261,7 +261,7 @@ void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u
}
const auto timestamp = GetTimestamp();
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
auto out = GetFullDataAuto(timestamp, title_id, system);
auto function_out = GetHLERequestContextData(ctx, system.Memory());
@@ -283,7 +283,7 @@ void Reporter::SaveUnimplementedAppletReport(
}
const auto timestamp = GetTimestamp();
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
auto out = GetFullDataAuto(timestamp, title_id, system);
out["applet_common_args"] = {
@@ -376,7 +376,7 @@ void Reporter::SaveUserReport() const {
}
const auto timestamp = GetTimestamp();
- const auto title_id = system.GetCurrentProcessProgramID();
+ const auto title_id = system.GetApplicationProcessProgramID();
SaveToFile(GetFullDataAuto(timestamp, title_id, system),
GetPath("user_report", title_id, timestamp));
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index 8d5f2be2f..9178b00ca 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -34,7 +34,7 @@ static u64 GenerateTelemetryId() {
mbedtls_entropy_context entropy;
mbedtls_entropy_init(&entropy);
mbedtls_ctr_drbg_context ctr_drbg;
- constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
+ static constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
mbedtls_ctr_drbg_init(&ctr_drbg);
ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp
index afc33db57..b4cd39a20 100644
--- a/src/input_common/drivers/joycon.cpp
+++ b/src/input_common/drivers/joycon.cpp
@@ -390,7 +390,7 @@ void Joycons::OnMotionUpdate(std::size_t port, Joycon::ControllerType type, int
void Joycons::OnRingConUpdate(f32 ring_data) {
// To simplify ring detection it will always be mapped to an empty identifier for all
// controllers
- constexpr PadIdentifier identifier = {
+ static constexpr PadIdentifier identifier = {
.guid = Common::UUID{},
.port = 0,
.pad = 0,
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index 88cacd615..5c20b3426 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -616,7 +616,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {
const auto joystick =
GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port));
- constexpr Common::Input::VibrationStatus test_vibration{
+ static constexpr Common::Input::VibrationStatus test_vibration{
.low_amplitude = 1,
.low_frequency = 160.0f,
.high_amplitude = 1,
@@ -624,7 +624,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) {
.type = Common::Input::VibrationAmplificationType::Exponential,
};
- constexpr Common::Input::VibrationStatus zero_vibration{
+ static constexpr Common::Input::VibrationStatus zero_vibration{
.low_amplitude = 0,
.low_frequency = 160.0f,
.high_amplitude = 0,
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index ae9da6290..614d61db4 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -186,6 +186,7 @@ bool Maxwell3D::IsMethodExecutable(u32 method) {
case MAXWELL3D_REG_INDEX(launch_dma):
case MAXWELL3D_REG_INDEX(inline_data):
case MAXWELL3D_REG_INDEX(fragment_barrier):
+ case MAXWELL3D_REG_INDEX(invalidate_texture_data_cache):
case MAXWELL3D_REG_INDEX(tiled_cache_barrier):
return true;
default:
@@ -258,7 +259,7 @@ u32 Maxwell3D::GetMaxCurrentVertices() {
size_t Maxwell3D::EstimateIndexBufferSize() {
GPUVAddr start_address = regs.index_buffer.StartAddress();
GPUVAddr end_address = regs.index_buffer.EndAddress();
- constexpr std::array<size_t, 4> max_sizes = {
+ static constexpr std::array<size_t, 4> max_sizes = {
std::numeric_limits<u8>::max(), std::numeric_limits<u16>::max(),
std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()};
const size_t byte_size = regs.index_buffer.FormatSizeInBytes();
@@ -375,6 +376,9 @@ void Maxwell3D::ProcessMethodCall(u32 method, u32 argument, u32 nonshadow_argume
return;
case MAXWELL3D_REG_INDEX(fragment_barrier):
return rasterizer->FragmentBarrier();
+ case MAXWELL3D_REG_INDEX(invalidate_texture_data_cache):
+ rasterizer->InvalidateGPUCache();
+ return rasterizer->WaitForIdle();
case MAXWELL3D_REG_INDEX(tiled_cache_barrier):
return rasterizer->TiledCacheBarrier();
default:
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h
index 9ebfb6179..cf56392ef 100644
--- a/src/video_core/memory_manager.h
+++ b/src/video_core/memory_manager.h
@@ -216,7 +216,7 @@ private:
std::vector<u64> big_page_continous;
std::vector<std::pair<VAddr, std::size_t>> page_stash{};
- constexpr static size_t continous_bits = 64;
+ static constexpr size_t continous_bits = 64;
const size_t unique_identifier;
std::unique_ptr<VideoCommon::InvalidationAccumulator> accumulator;
diff --git a/src/video_core/renderer_vulkan/vk_smaa.cpp b/src/video_core/renderer_vulkan/vk_smaa.cpp
index 8eb735489..f8735189d 100644
--- a/src/video_core/renderer_vulkan/vk_smaa.cpp
+++ b/src/video_core/renderer_vulkan/vk_smaa.cpp
@@ -468,7 +468,7 @@ VkWriteDescriptorSet CreateWriteDescriptorSet(std::vector<VkDescriptorImageInfo>
}
void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) {
- constexpr std::array<VkImageSubresourceRange, 1> subresources{{{
+ static constexpr std::array<VkImageSubresourceRange, 1> subresources{{{
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0,
.levelCount = 1,
@@ -528,8 +528,8 @@ SMAA::SMAA(const Device& device, MemoryAllocator& allocator, size_t image_count,
}
void SMAA::CreateImages() {
- constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
- constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
+ static constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
+ static constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
std::tie(m_static_images[Area], m_static_buffer_commits[Area]) =
CreateWrappedImage(m_device, m_allocator, area_extent, VK_FORMAT_R8G8_UNORM);
@@ -586,12 +586,12 @@ void SMAA::CreateSampler() {
void SMAA::CreateShaders() {
// These match the order of the SMAAStage enum
- constexpr std::array vert_shader_sources{
+ static constexpr std::array vert_shader_sources{
ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_VERT_SPV),
ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_VERT_SPV),
ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_VERT_SPV),
};
- constexpr std::array frag_shader_sources{
+ static constexpr std::array frag_shader_sources{
ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_FRAG_SPV),
ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_FRAG_SPV),
ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_FRAG_SPV),
@@ -675,8 +675,8 @@ void SMAA::UploadImages(Scheduler& scheduler) {
return;
}
- constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
- constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
+ static constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT};
+ static constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT};
UploadImage(m_device, m_allocator, scheduler, m_static_images[Area], area_extent,
VK_FORMAT_R8G8_UNORM, ARRAY_TO_SPAN(areaTexBytes));
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h
index b9ee83de7..0ce39616f 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.h
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.h
@@ -113,7 +113,7 @@ public:
std::optional<ASTCDecoderPass> astc_decoder_pass;
const Settings::ResolutionScalingInfo& resolution;
- constexpr static size_t indexing_slots = 8 * sizeof(size_t);
+ static constexpr size_t indexing_slots = 8 * sizeof(size_t);
std::array<vk::Buffer, indexing_slots> buffers{};
std::array<std::unique_ptr<MemoryCommit>, indexing_slots> buffer_commits{};
};
diff --git a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp
index c42594149..db04943eb 100644
--- a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp
+++ b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp
@@ -48,7 +48,7 @@ void TurboMode::Run(std::stop_token stop_token) {
auto commit = m_allocator.Commit(buffer, MemoryUsage::DeviceLocal);
// Create the descriptor pool to contain our descriptor.
- constexpr VkDescriptorPoolSize pool_size{
+ static constexpr VkDescriptorPoolSize pool_size{
.type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
.descriptorCount = 1,
};
@@ -63,7 +63,7 @@ void TurboMode::Run(std::stop_token stop_token) {
});
// Create the descriptor set layout from the pool.
- constexpr VkDescriptorSetLayoutBinding layout_binding{
+ static constexpr VkDescriptorSetLayoutBinding layout_binding{
.binding = 0,
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
.descriptorCount = 1,
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 59120cd09..95bcdd37b 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -29,7 +29,7 @@ constexpr u32 pdep(u32 value) {
template <u32 mask, u32 incr_amount>
void incrpdep(u32& value) {
- constexpr u32 swizzled_incr = pdep<mask>(incr_amount);
+ static constexpr u32 swizzled_incr = pdep<mask>(incr_amount);
value = ((value | ~mask) + swizzled_incr) & mask;
}
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() {
emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
if (Settings::values.use_disk_shader_cache.GetValue()) {
m_system.Renderer().ReadRasterizer()->LoadDiskResources(
- m_system.GetCurrentProcessProgramID(), stop_token,
+ m_system.GetApplicationProcessProgramID(), stop_token,
[this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
emit LoadProgress(stage, value, total);
});
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 31209fb2e..db68ed259 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -1103,6 +1103,7 @@ void Config::SaveValues() {
SaveRendererValues();
SaveAudioValues();
SaveSystemValues();
+ qt_config->sync();
}
void Config::SaveAudioValues() {
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 22aa19c56..c21828b1d 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -870,6 +870,7 @@ void GameList::ToggleFavorite(u64 program_id) {
tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(), true);
}
}
+ SaveConfig();
}
void GameList::AddFavorite(u64 program_id) {
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index f7ff93ed9..64e5af4c1 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -122,6 +122,7 @@ signals:
void AddDirectory();
void ShowList(bool show);
void PopulatingCompleted();
+ void SaveConfig();
private slots:
void OnItemExpanded(const QModelIndex& item);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c278d8dab..5560a30bd 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -219,7 +219,7 @@ static void LogRuntimes() {
#ifdef _MSC_VER
// It is possible that the name of the dll will change.
// vcruntime140.dll is for 2015 and onwards
- constexpr char runtime_dll_name[] = "vcruntime140.dll";
+ static constexpr char runtime_dll_name[] = "vcruntime140.dll";
UINT sz = GetFileVersionInfoSizeA(runtime_dll_name, nullptr);
bool runtime_version_inspection_worked = false;
if (sz > 0) {
@@ -1271,6 +1271,7 @@ void GMainWindow::ConnectWidgetEvents() {
connect(game_list, &GameList::ShowList, this, &GMainWindow::OnGameListShowList);
connect(game_list, &GameList::PopulatingCompleted,
[this] { multiplayer_state->UpdateGameList(game_list->GetModel()); });
+ connect(game_list, &GameList::SaveConfig, this, &GMainWindow::OnSaveConfig);
connect(game_list, &GameList::OpenPerGameGeneralRequested, this,
&GMainWindow::OnGameListOpenPerGameProperties);
@@ -1779,7 +1780,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
std::filesystem::path{Common::U16StringFromBuffer(filename.utf16(), filename.size())}
.filename());
}
- const bool is_64bit = system->Kernel().CurrentProcess()->Is64BitProcess();
+ const bool is_64bit = system->Kernel().ApplicationProcess()->Is64BitProcess();
const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)");
title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit")
.arg(QString::fromStdString(title_name), instruction_set_suffix)
@@ -2654,6 +2655,8 @@ void GMainWindow::OnGameListAddDirectory() {
} else {
LOG_WARNING(Frontend, "Selected directory is already in the game list");
}
+
+ OnSaveConfig();
}
void GMainWindow::OnGameListShowList(bool show) {
@@ -3015,8 +3018,10 @@ void GMainWindow::OnRestartGame() {
if (!system->IsPoweredOn()) {
return;
}
- // Make a copy since BootGame edits game_path
- BootGame(QString(current_game_path));
+ // Make a copy since ShutdownGame edits game_path
+ const auto current_game = QString(current_game_path);
+ ShutdownGame();
+ BootGame(current_game);
}
void GMainWindow::OnPauseGame() {
@@ -3380,6 +3385,7 @@ void GMainWindow::OnConfigureTas() {
return;
} else if (result == QDialog::Accepted) {
dialog.ApplyConfiguration();
+ OnSaveConfig();
}
}
@@ -3532,7 +3538,7 @@ void GMainWindow::OnToggleGraphicsAPI() {
}
void GMainWindow::OnConfigurePerGame() {
- const u64 title_id = system->GetCurrentProcessProgramID();
+ const u64 title_id = system->GetApplicationProcessProgramID();
OpenPerGameConfiguration(title_id, current_game_path.toStdString());
}
@@ -3691,7 +3697,7 @@ void GMainWindow::OnCaptureScreenshot() {
return;
}
- const u64 title_id = system->GetCurrentProcessProgramID();
+ const u64 title_id = system->GetApplicationProcessProgramID();
const auto screenshot_path =
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir));
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) {
if (Settings::values.use_disk_shader_cache.GetValue()) {
system.Renderer().ReadRasterizer()->LoadDiskResources(
- system.GetCurrentProcessProgramID(), std::stop_token{},
+ system.GetApplicationProcessProgramID(), std::stop_token{},
[](VideoCore::LoadCallbackStage, size_t value, size_t total) {});
}