From 0632b43f3b478318d6425de447942eacfeae8c0a Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Fri, 7 May 2021 19:41:23 +0200 Subject: [PATCH] early-access version 1662 --- README.md | 2 +- src/core/hle/service/ldr/ldr.cpp | 8 +++----- src/core/hle/service/nvflinger/nvflinger.cpp | 11 ++++++----- src/core/hle/service/nvflinger/nvflinger.h | 6 +++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9d91fe543..aee4bc8d3 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1661. +This is the source code for early-access 1662. ## Legal Notice diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index 563916f29..c3948eb8e 100755 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp @@ -387,11 +387,9 @@ public: const VAddr bss_end_addr{ Common::AlignUp(bss_start + nro_header.bss_size, Kernel::PageSize)}; - auto CopyCode{[&](VAddr src_addr, VAddr dst_addr, u64 size) { - std::vector source_data(size); - system.Memory().ReadBlock(src_addr, source_data.data(), source_data.size()); - system.Memory().WriteBlock(dst_addr, source_data.data(), source_data.size()); - }}; + const auto CopyCode = [this, process](VAddr src_addr, VAddr dst_addr, u64 size) { + system.Memory().CopyBlock(*process, dst_addr, src_addr, size); + }; CopyCode(nro_addr + nro_header.segment_headers[TEXT_INDEX].memory_offset, text_start, nro_header.segment_headers[TEXT_INDEX].memory_size); CopyCode(nro_addr + nro_header.segment_headers[RO_INDEX].memory_offset, ro_start, diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 1484a50f2..dc802b1bd 100755 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -139,15 +139,15 @@ std::optional NVFlinger::CreateLayer(u64 display_id) { } const u64 layer_id = next_layer_id++; - CreateLayerAtId(display, layer_id); + CreateLayerAtId(*display, layer_id); return layer_id; } -void NVFlinger::CreateLayerAtId(VI::Display* display, u64 layer_id) { +void NVFlinger::CreateLayerAtId(VI::Display& display, u64 layer_id) { const u32 buffer_queue_id = next_buffer_queue_id++; buffer_queues.emplace_back( std::make_unique(system.Kernel(), buffer_queue_id, layer_id)); - display->CreateLayer(layer_id, *buffer_queues.back()); + display.CreateLayer(layer_id, *buffer_queues.back()); } void NVFlinger::CloseLayer(u64 layer_id) { @@ -236,7 +236,7 @@ const VI::Layer* NVFlinger::FindLayer(u64 display_id, u64 layer_id) const { return display->FindLayer(layer_id); } -VI::Layer* Service::NVFlinger::NVFlinger::FindOrCreateLayer(u64 display_id, u64 layer_id) { +VI::Layer* NVFlinger::FindOrCreateLayer(u64 display_id, u64 layer_id) { auto* const display = FindDisplay(display_id); if (display == nullptr) { @@ -247,9 +247,10 @@ VI::Layer* Service::NVFlinger::NVFlinger::FindOrCreateLayer(u64 display_id, u64 if (layer == nullptr) { LOG_DEBUG(Service, "Layer at id {} not found. Trying to create it.", layer_id); - CreateLayerAtId(display, layer_id); + CreateLayerAtId(*display, layer_id); return display->FindLayer(layer_id); } + return layer; } diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h index 403935be3..c04162590 100755 --- a/src/core/hle/service/nvflinger/nvflinger.h +++ b/src/core/hle/service/nvflinger/nvflinger.h @@ -61,9 +61,6 @@ public: /// If an invalid display ID is specified, then an empty optional is returned. [[nodiscard]] std::optional CreateLayer(u64 display_id); - /// Creates a layer with the specified layer ID in the desired display. - void CreateLayerAtId(VI::Display* display, u64 layer_id); - /// Closes a layer on all displays for the given layer ID. void CloseLayer(u64 layer_id); @@ -108,6 +105,9 @@ private: /// To be used when the system expects the specified ID to already exist. [[nodiscard]] VI::Layer* FindOrCreateLayer(u64 display_id, u64 layer_id); + /// Creates a layer with the specified layer ID in the desired display. + void CreateLayerAtId(VI::Display& display, u64 layer_id); + static void VSyncThread(NVFlinger& nv_flinger); void SplitVSync();