Always use -1 for failed allocs in block allocator.

Before it used 0 and -1, confusing.
This commit is contained in:
Unknown W. Brackets committed 2013-01-18 01:38:12 -08:00
1 parent 373f1f8655
commit dcd3045cd5
4 files changed
+16 -8

No files matched your search

+12 -4
View File
@@ -97,6 +97,14 @@ static void EndVertexDataAndDraw(int prim) {
WriteCmd(GE_CMD_PRIM, (prim << 16) | vertexCount);
}
static u32 __PPGeDoAlloc(u32 &size, bool fromTop, const char *name) {
u32 ptr = kernelMemory.Alloc(size, fromTop, name);
// Didn't get it.
if (ptr == -1)
return 0;
return ptr;
}
void __PPGeInit()
{
if (PSP_CoreParameter().gpuCore == GPU_NULL) {
@@ -117,10 +125,10 @@ void __PPGeInit()
u32 atlasSize = height * width * 2; // it's a 4444 texture
atlasWidth = width;
atlasHeight = height;
dlPtr = kernelMemory.Alloc(dlSize, false, "PPGe Display List");
dataPtr = kernelMemory.Alloc(dataSize, false, "PPGe Vertex Data");
atlasPtr = kernelMemory.Alloc(atlasSize, false, "PPGe Atlas Texture");
savedContextPtr = kernelMemory.Alloc(savedContextSize, false, "PPGe Saved Context");
dlPtr = __PPGeDoAlloc(dlSize, false, "PPGe Display List");
dataPtr = __PPGeDoAlloc(dataSize, false, "PPGe Vertex Data");
atlasPtr = __PPGeDoAlloc(atlasSize, false, "PPGe Atlas Texture");
savedContextPtr = __PPGeDoAlloc(savedContextSize, false, "PPGe Saved Context");
u16 *imagePtr = (u16 *)imageData;
// component order change