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.
This commit is contained in:
Stephen Miller 2024-09-01 22:39:22 -05:00
parent 63d78aee0a
commit f3a62891ed

View file

@ -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<s32>(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);