Skip to content

Commit

Permalink
Merge pull request #12718 from unknownbrackets/vpl-order
Browse files Browse the repository at this point in the history
Vpl: Correct allocation order when splitting block
hrydgard authored Mar 17, 2020
2 parents 0c17096 + 916ba4e commit b2c66a3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Core/HLE/sceKernelMemory.cpp
Original file line number Diff line number Diff line change
@@ -213,10 +213,6 @@ struct SceKernelVplHeader {
do {
auto b = prev->next;
if (b->sizeInBlocks > allocBlocks) {
if (nextFreeBlock_ == b) {
nextFreeBlock_ = prev;
}
prev = b;
b = SplitBlock(b, allocBlocks);
}

@@ -289,16 +285,13 @@ struct SceKernelVplHeader {
void UnlinkFreeBlock(PSPPointer<SceKernelVplBlock> b, PSPPointer<SceKernelVplBlock> prev) {
allocatedInBlocks_ += b->sizeInBlocks;
prev->next = b->next;
if (nextFreeBlock_ == b) {
nextFreeBlock_ = prev;
}
nextFreeBlock_ = prev;
b->next = SentinelPtr();
}

PSPPointer<SceKernelVplBlock> SplitBlock(PSPPointer<SceKernelVplBlock> b, u32 allocBlocks) {
u32 prev = b->next.ptr;
u32 prev = b.ptr;
b->sizeInBlocks -= allocBlocks;
b->next = b + b->sizeInBlocks;

b += b->sizeInBlocks;
b->sizeInBlocks = allocBlocks;

0 comments on commit b2c66a3

Please sign in to comment.