From f3a62891ed83b6c1beb306eda4af57fc819b225e Mon Sep 17 00:00:00 2001 From: Stephen Miller Date: Sun, 1 Sep 2024 22:39:22 -0500 Subject: [PATCH] Fix VirtualQuery Found this issue while looking at code from fpPS4. VirtualQuery was setting is_commited to true when the queried region was reserved. Also sets the protection value in the VirtualQueryInfo, as I'd assume not storing that could cause issues in games. This fixes all games currently hanging on the sceKernelmprotect stub. --- src/core/memory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 2722c68a9..0ee8e4498 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -305,9 +305,10 @@ int MemoryManager::VirtualQuery(VAddr addr, int flags, const auto& vma = it->second; info->start = vma.base; info->end = vma.base + vma.size; + info->protection = static_cast(vma.prot); info->is_flexible.Assign(vma.type == VMAType::Flexible); info->is_direct.Assign(vma.type == VMAType::Direct); - info->is_commited.Assign(vma.type != VMAType::Free); + info->is_commited.Assign(vma.type != VMAType::Free && vma.type != VMAType::Reserved); vma.name.copy(info->name.data(), std::min(info->name.size(), vma.name.size())); if (vma.type == VMAType::Direct) { const auto dmem_it = FindDmemArea(vma.phys_base);