nn_fp: Multiple fixes

This commit is contained in:
Exzap 2023-10-19 05:55:52 +02:00
parent b0a7fd4e07
commit f3c95f72e7
3 changed files with 18 additions and 8 deletions

View file

@ -489,6 +489,11 @@ private:
bool _alloc(uint32 size, uint32 alignment, uint32& allocOffsetOut)
{
if(size == 0)
{
size = 1; // zero-sized allocations are not supported
cemu_assert_suspicious();
}
// find smallest bucket to scan
uint32 alignmentM1 = alignment - 1;
uint32 bucketIndex = ulog2(size);
@ -521,7 +526,10 @@ private:
{
auto it = map_allocatedRange.find(addrOffset);
if (it == map_allocatedRange.end())
assert_dbg();
{
cemuLog_log(LogType::Force, "VHeap internal error");
cemu_assert(false);
}
allocRange_t* range = it->second;
map_allocatedRange.erase(it);
m_statsMemAllocated -= range->size;