diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-01-28 21:02:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-28 21:02:22 +0100 |
commit | 5561a08d59f816b61ed6fab2131ee5d40cc51db7 (patch) | |
tree | b518bb8b995747b83508eeb0f74acd5a1a5c287a /src/audio_core/renderer | |
parent | Merge pull request #12833 from merryhime/vsync-crash (diff) | |
parent | Use the input process handle to get the correct application's memory (diff) | |
download | yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.gz yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.bz2 yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.lz yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.xz yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.tar.zst yuzu-5561a08d59f816b61ed6fab2131ee5d40cc51db7.zip |
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/renderer/audio_renderer.cpp | 6 | ||||
-rw-r--r-- | src/audio_core/renderer/audio_renderer.h | 6 | ||||
-rw-r--r-- | src/audio_core/renderer/system.cpp | 10 | ||||
-rw-r--r-- | src/audio_core/renderer/system.h | 6 |
4 files changed, 20 insertions, 8 deletions
diff --git a/src/audio_core/renderer/audio_renderer.cpp b/src/audio_core/renderer/audio_renderer.cpp index 09efe9be9..df03d03aa 100644 --- a/src/audio_core/renderer/audio_renderer.cpp +++ b/src/audio_core/renderer/audio_renderer.cpp @@ -6,6 +6,7 @@ #include "audio_core/renderer/audio_renderer.h" #include "audio_core/renderer/system_manager.h" #include "core/core.h" +#include "core/hle/kernel/k_process.h" #include "core/hle/kernel/k_transfer_memory.h" #include "core/hle/service/audio/errors.h" @@ -17,7 +18,8 @@ Renderer::Renderer(Core::System& system_, Manager& manager_, Kernel::KEvent* ren Result Renderer::Initialize(const AudioRendererParameterInternal& params, Kernel::KTransferMemory* transfer_memory, const u64 transfer_memory_size, const u32 process_handle, - const u64 applet_resource_user_id, const s32 session_id) { + Kernel::KProcess& process, const u64 applet_resource_user_id, + const s32 session_id) { if (params.execution_mode == ExecutionMode::Auto) { if (!manager.AddSystem(system)) { LOG_ERROR(Service_Audio, @@ -28,7 +30,7 @@ Result Renderer::Initialize(const AudioRendererParameterInternal& params, } initialized = true; - system.Initialize(params, transfer_memory, transfer_memory_size, process_handle, + system.Initialize(params, transfer_memory, transfer_memory_size, process_handle, process, applet_resource_user_id, session_id); return ResultSuccess; diff --git a/src/audio_core/renderer/audio_renderer.h b/src/audio_core/renderer/audio_renderer.h index 24650278b..1219f74ca 100644 --- a/src/audio_core/renderer/audio_renderer.h +++ b/src/audio_core/renderer/audio_renderer.h @@ -14,7 +14,8 @@ class System; namespace Kernel { class KTransferMemory; -} +class KProcess; +} // namespace Kernel namespace AudioCore { struct AudioRendererParameterInternal; @@ -44,7 +45,8 @@ public: */ Result Initialize(const AudioRendererParameterInternal& params, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, - u32 process_handle, u64 applet_resource_user_id, s32 session_id); + u32 process_handle, Kernel::KProcess& process, u64 applet_resource_user_id, + s32 session_id); /** * Finalize the renderer for shutdown. diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index 31f92087c..ca656edae 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp @@ -32,6 +32,7 @@ #include "core/core.h" #include "core/core_timing.h" #include "core/hle/kernel/k_event.h" +#include "core/hle/kernel/k_process.h" #include "core/hle/kernel/k_transfer_memory.h" #include "core/memory.h" @@ -101,7 +102,8 @@ System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_) Result System::Initialize(const AudioRendererParameterInternal& params, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, - u32 process_handle_, u64 applet_resource_user_id_, s32 session_id_) { + u32 process_handle_, Kernel::KProcess& process_, + u64 applet_resource_user_id_, s32 session_id_) { if (!CheckValidRevision(params.revision)) { return Service::Audio::ResultInvalidRevision; } @@ -117,6 +119,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params, behavior.SetUserLibRevision(params.revision); process_handle = process_handle_; + process = &process_; applet_resource_user_id = applet_resource_user_id_; session_id = session_id_; @@ -129,7 +132,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params, render_device = params.rendering_device; execution_mode = params.execution_mode; - core.ApplicationMemory().ZeroBlock(transfer_memory->GetSourceAddress(), transfer_memory_size); + process->GetMemory().ZeroBlock(transfer_memory->GetSourceAddress(), transfer_memory_size); // Note: We're not actually using the transfer memory because it's a pain to code for. // Allocate the memory normally instead and hope the game doesn't try to read anything back @@ -613,7 +616,8 @@ void System::SendCommandToDsp() { static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * (static_cast<f32>(render_time_limit_percent) / 100.0f))}; audio_renderer.SetCommandBuffer(session_id, translated_addr, command_size, time_limit, - applet_resource_user_id, reset_command_buffers); + applet_resource_user_id, process, + reset_command_buffers); reset_command_buffers = false; command_buffer_size = command_size; if (remaining_command_count == 0) { diff --git a/src/audio_core/renderer/system.h b/src/audio_core/renderer/system.h index 8a8341710..753a0b796 100644 --- a/src/audio_core/renderer/system.h +++ b/src/audio_core/renderer/system.h @@ -29,6 +29,7 @@ class System; namespace Kernel { class KEvent; +class KProcess; class KTransferMemory; } // namespace Kernel @@ -80,7 +81,8 @@ public: */ Result Initialize(const AudioRendererParameterInternal& params, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, - u32 process_handle, u64 applet_resource_user_id, s32 session_id); + u32 process_handle, Kernel::KProcess& process, u64 applet_resource_user_id, + s32 session_id); /** * Finalize the system. @@ -275,6 +277,8 @@ private: Common::Event terminate_event{}; /// Does what locks do std::mutex lock{}; + /// Process this audio render is operating within, used for memory reads/writes. + Kernel::KProcess* process{}; /// Handle for the process for this system, unused u32 process_handle{}; /// Applet resource id for this system, unused |