mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-01 12:41:09 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c09959f11 |
@@ -426,28 +426,30 @@ public:
|
|||||||
std::addressof(ro_size), std::addressof(rw_size),
|
std::addressof(ro_size), std::addressof(rw_size),
|
||||||
nro_info->base_address, nro_size, bss_size));
|
nro_info->base_address, nro_size, bss_size));
|
||||||
#ifdef HAS_NCE
|
#ifdef HAS_NCE
|
||||||
if (Settings::IsNceEnabled()) {
|
if (Settings::GetDebugKnobAt(1)) {
|
||||||
auto* process = context->GetProcess();
|
if (Settings::IsNceEnabled()) {
|
||||||
auto& memory = process->GetMemory();
|
auto* process = context->GetProcess();
|
||||||
|
auto& memory = process->GetMemory();
|
||||||
|
|
||||||
std::vector<u8> image(total_size);
|
std::vector<u8> image(total_size);
|
||||||
memory.ReadBlock(nro_info->base_address, image.data(), rx_size);
|
memory.ReadBlock(nro_info->base_address, image.data(), rx_size);
|
||||||
|
|
||||||
Kernel::CodeSet::Segment code{.size = static_cast<u32>(rx_size)};
|
Kernel::CodeSet::Segment code{.size = static_cast<u32>(rx_size)};
|
||||||
Core::NCE::Patcher patch;
|
Core::NCE::Patcher patch;
|
||||||
patch.PatchText(image, code);
|
patch.PatchText(image, code);
|
||||||
patch.RelocateAndCopy(nro_info->base_address, code, image, nullptr);
|
patch.RelocateAndCopy(nro_info->base_address, code, image, nullptr);
|
||||||
|
|
||||||
const u64 patch_address = nro_info->base_address + total_size;
|
const u64 patch_address = nro_info->base_address + total_size;
|
||||||
const size_t patch_size = patch.GetSectionSize();
|
const size_t patch_size = patch.GetSectionSize();
|
||||||
constexpr auto permission = Kernel::Svc::MemoryPermission::ReadExecute;
|
constexpr auto permission = Kernel::Svc::MemoryPermission::ReadExecute;
|
||||||
|
|
||||||
auto* patch_memory = Kernel::KSharedMemory::Create(kernel);
|
auto* patch_memory = Kernel::KSharedMemory::Create(kernel);
|
||||||
R_TRY(patch_memory->Initialize(kernel, kernel.System().DeviceMemory(), process, permission, permission, patch_size));
|
R_TRY(patch_memory->Initialize(kernel, kernel.System().DeviceMemory(), process, permission, permission, patch_size));
|
||||||
std::memcpy(patch_memory->GetPointer(), image.data() + total_size, patch_size);
|
std::memcpy(patch_memory->GetPointer(), image.data() + total_size, patch_size);
|
||||||
R_TRY(process->AddSharedMemory(kernel, patch_memory, patch_address, patch_size));
|
R_TRY(process->AddSharedMemory(kernel, patch_memory, patch_address, patch_size));
|
||||||
R_TRY(patch_memory->Map(*process, patch_address, patch_size, permission));
|
R_TRY(patch_memory->Map(*process, patch_address, patch_size, permission));
|
||||||
memory.WriteBlock(nro_info->base_address, image.data(), rx_size);
|
memory.WriteBlock(nro_info->base_address, image.data(), rx_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Set NRO perms.
|
// Set NRO perms.
|
||||||
|
|||||||
+11
-9
@@ -227,15 +227,17 @@ struct GPU::Impl {
|
|||||||
|
|
||||||
/// Notify rasterizer that any caches of the specified region should be invalidated
|
/// Notify rasterizer that any caches of the specified region should be invalidated
|
||||||
void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) {
|
void InvalidateRegion(DAddr addr, u64 size, bool preserve_gpu_writes) {
|
||||||
VideoCore::RasterizerInterface* rasterizer = renderer->ReadRasterizer();
|
if (Settings::GetDebugKnobAt(0)) {
|
||||||
if (preserve_gpu_writes && rasterizer->MustFlushRegion(addr, size, VideoCommon::CacheType::BufferCache)) {
|
VideoCore::RasterizerInterface* rasterizer = renderer->ReadRasterizer();
|
||||||
const u64 fence = RequestSyncOperation([rasterizer, addr, size] {
|
if (preserve_gpu_writes && rasterizer->MustFlushRegion(addr, size, VideoCommon::CacheType::BufferCache)) {
|
||||||
rasterizer->FlushRegion(addr, size, VideoCommon::CacheType::BufferCache);
|
const u64 fence = RequestSyncOperation([rasterizer, addr, size] {
|
||||||
rasterizer->OnCacheInvalidation(addr, size);
|
rasterizer->FlushRegion(addr, size, VideoCommon::CacheType::BufferCache);
|
||||||
});
|
rasterizer->OnCacheInvalidation(addr, size);
|
||||||
gpu_thread.TickGPU(is_async);
|
});
|
||||||
WaitForSyncOperation(fence);
|
gpu_thread.TickGPU(is_async);
|
||||||
return;
|
WaitForSyncOperation(fence);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gpu_thread.InvalidateRegion(addr, size);
|
gpu_thread.InvalidateRegion(addr, size);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user