mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-28 13:28:03 +03:00
sceKernelAllocateDirectMemory hotfixes (#2838)
* Update memory.cpp * Clean logic FindDmemArea guarantees that the first dmem area we check contains search_start. Any dmem areas beyond the first one will be entirely past search_start, so checking against it in the loop is unnecessary.
This commit is contained in:
parent
ce3aded3e5
commit
a12d447bd6
1 changed files with 3 additions and 5 deletions
|
@ -142,7 +142,7 @@ PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size,
|
|||
auto mapping_start = search_start > dmem_area->second.base
|
||||
? Common::AlignUp(search_start, alignment)
|
||||
: Common::AlignUp(dmem_area->second.base, alignment);
|
||||
auto mapping_end = Common::AlignUp(mapping_start + size, alignment);
|
||||
auto mapping_end = mapping_start + size;
|
||||
|
||||
// Find the first free, large enough dmem area in the range.
|
||||
while ((!dmem_area->second.is_free || dmem_area->second.GetEnd() < mapping_end) &&
|
||||
|
@ -151,10 +151,8 @@ PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size,
|
|||
dmem_area++;
|
||||
|
||||
// Update local variables based on the new dmem_area
|
||||
mapping_start = search_start > dmem_area->second.base
|
||||
? Common::AlignUp(search_start, alignment)
|
||||
: Common::AlignUp(dmem_area->second.base, alignment);
|
||||
mapping_end = Common::AlignUp(mapping_start + size, alignment);
|
||||
mapping_start = Common::AlignUp(dmem_area->second.base, alignment);
|
||||
mapping_end = mapping_start + size;
|
||||
}
|
||||
|
||||
if (dmem_area == dmem_map.end()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue