From 3a22803f0acd87f1c4e65adb13401e294f92f041 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sat, 12 Feb 2022 07:27:44 +0100 Subject: [PATCH] early-access version 2488 --- README.md | 2 +- src/common/uuid.cpp | 10 ++++----- src/core/hle/kernel/svc.cpp | 22 +++++++++++++++---- src/core/hle/kernel/svc_wrap.h | 22 +++++++++++++++++++ .../renderer_vulkan/vk_rasterizer.cpp | 4 ++-- 5 files changed, 48 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1b01161b0..2205c31c7 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2486. +This is the source code for early-access 2488. ## Legal Notice diff --git a/src/common/uuid.cpp b/src/common/uuid.cpp index 4aab10e08..2b6a530e3 100755 --- a/src/common/uuid.cpp +++ b/src/common/uuid.cpp @@ -160,13 +160,13 @@ std::string UUID::FormattedString() const { } size_t UUID::Hash() const noexcept { - u64 hash; - u64 temp; + u64 upper_hash; + u64 lower_hash; - std::memcpy(&hash, uuid.data(), sizeof(u64)); - std::memcpy(&temp, uuid.data() + 8, sizeof(u64)); + std::memcpy(&upper_hash, uuid.data(), sizeof(u64)); + std::memcpy(&lower_hash, uuid.data() + sizeof(u64), sizeof(u64)); - return hash ^ std::rotl(temp, 1); + return upper_hash ^ std::rotl(lower_hash, 1); } u128 UUID::AsU128() const { diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 9387373c1..43a2e29d4 100755 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -645,6 +645,10 @@ static void OutputDebugString(Core::System& system, VAddr address, u64 len) { LOG_DEBUG(Debug_Emulated, "{}", str); } +static void OutputDebugString32(Core::System& system, u32 address, u32 len) { + OutputDebugString(system, address, len); +} + /// Gets system/memory information for the current process static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle handle, u64 info_sub_id) { @@ -1404,7 +1408,7 @@ static ResultCode UnmapProcessMemory(Core::System& system, VAddr dst_address, Ha } static ResultCode CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { - LOG_TRACE(Kernel_SVC, "called, handle_out=0x{:X}, address=0x{:X}, size=0x{:X}", + LOG_TRACE(Kernel_SVC, "called, handle_out={}, address=0x{:X}, size=0x{:X}", static_cast(out), address, size); // Get kernel instance. auto& kernel = system.Kernel(); @@ -1438,6 +1442,10 @@ static ResultCode CreateCodeMemory(Core::System& system, Handle* out, VAddr addr return ResultSuccess; } +static ResultCode CreateCodeMemory32(Core::System& system, Handle* out, u32 address, u32 size) { + return CreateCodeMemory(system, out, address, size); +} + static ResultCode ControlCodeMemory(Core::System& system, Handle code_memory_handle, u32 operation, VAddr address, size_t size, Svc::MemoryPermission perm) { @@ -1517,6 +1525,12 @@ static ResultCode ControlCodeMemory(Core::System& system, Handle code_memory_han return ResultSuccess; } +static ResultCode ControlCodeMemory32(Core::System& system, Handle code_memory_handle, + u32 operation, u64 address, u64 size, + Svc::MemoryPermission perm) { + return ControlCodeMemory(system, code_memory_handle, operation, address, size, perm); +} + static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_address, VAddr page_info_address, Handle process_handle, VAddr address) { @@ -2598,7 +2612,7 @@ static const FunctionDef SVC_Table_32[] = { {0x24, SvcWrap32, "GetProcessId32"}, {0x25, SvcWrap32, "GetThreadId32"}, {0x26, SvcWrap32, "Break32"}, - {0x27, nullptr, "OutputDebugString32"}, + {0x27, SvcWrap32, "OutputDebugString32"}, {0x28, nullptr, "Unknown"}, {0x29, SvcWrap32, "GetInfo32"}, {0x2a, nullptr, "Unknown"}, @@ -2634,8 +2648,8 @@ static const FunctionDef SVC_Table_32[] = { {0x48, nullptr, "Unknown"}, {0x49, nullptr, "Unknown"}, {0x4a, nullptr, "Unknown"}, - {0x4b, nullptr, "Unknown"}, - {0x4c, nullptr, "Unknown"}, + {0x4b, SvcWrap32, "CreateCodeMemory32"}, + {0x4c, SvcWrap32, "ControlCodeMemory32"}, {0x4d, nullptr, "Unknown"}, {0x4e, nullptr, "Unknown"}, {0x4f, nullptr, "Unknown"}, diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h index a60adfcab..d309f166c 100755 --- a/src/core/hle/kernel/svc_wrap.h +++ b/src/core/hle/kernel/svc_wrap.h @@ -669,4 +669,26 @@ void SvcWrap32(Core::System& system) { FuncReturn(system, retval); } +// Used by CreateCodeMemory32 +template +void SvcWrap32(Core::System& system) { + Handle handle = 0; + + const u32 retval = func(system, &handle, Param32(system, 1), Param32(system, 2)).raw; + + system.CurrentArmInterface().SetReg(1, handle); + FuncReturn(system, retval); +} + +// Used by ControlCodeMemory32 +template +void SvcWrap32(Core::System& system) { + const u32 retval = + func(system, Param32(system, 0), Param32(system, 1), Param(system, 2), Param(system, 4), + static_cast(Param32(system, 6))) + .raw; + + FuncReturn(system, retval); +} + } // namespace Kernel diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 2227d9197..23422d4c9 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -183,8 +183,6 @@ void RasterizerVulkan::Draw(bool is_indexed, bool is_instanced) { SCOPE_EXIT({ gpu.TickWork(); }); FlushWork(); - query_cache.UpdateCounters(); - GraphicsPipeline* const pipeline{pipeline_cache.CurrentGraphicsPipeline()}; if (!pipeline) { return; @@ -196,6 +194,8 @@ void RasterizerVulkan::Draw(bool is_indexed, bool is_instanced) { UpdateDynamicStates(); + query_cache.UpdateCounters(); + const auto& regs{maxwell3d.regs}; const u32 num_instances{maxwell3d.mme_draw.instance_count}; const DrawParams draw_params{MakeDrawParams(regs, num_instances, is_instanced, is_indexed)};