coreinit: Return correct size from MEMResizeForMBlockExpHeap - #2022
Merged
Conversation
…ize equals block size
Member
|
Just in case we're not patching out an intentional replication of the real console, did you test this same thing on the Wii U? But other then that, this seems very nice! |
Contributor
Author
I tested on the console and on Cemu with this program #include <coreinit/memdefaultheap.h>
#include <coreinit/memexpheap.h>
#include <coreinit/memheap.h>
#include <whb/proc.h>
#include <coreinit/debug.h>
#include <cstddef>
static constinit std::byte ExpHeap[65536] = {};
int main()
{
WHBProcInit();
auto expHeap = MEMCreateExpHeapEx(ExpHeap, sizeof(ExpHeap), MEM_HEAP_FLAG_USE_LOCK);
auto allocation = MEMAllocFromExpHeapEx(expHeap, 128, 128);
auto const size = MEMGetSizeForMBlockExpHeap(allocation);
OSReport("Allocation size is %d\n", size);
auto resize = MEMResizeForMBlockExpHeap(expHeap, allocation, 128);
OSReport("Resized to %d\n", resize);
resize = MEMResizeForMBlockExpHeap(expHeap, allocation, 256);
OSReport("Resized to %d\n", resize);
while (WHBProcIsRunning()) {}
MEMDestroyExpHeap(expHeap);
WHBProcShutdown();
return 0;
} |
Member
|
good catch, thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When block size equalled the requested size, 0 was returned