mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-19 09:19:05 +02:00
Always use -1 for failed allocs in block allocator.
Before it used 0 and -1, confusing.
This commit is contained in:
1 parent
373f1f8655
commit
dcd3045cd5
4 files changed
+16
-8
No files matched your search
@@ -765,7 +765,7 @@ void SavedataParam::SetFileInfo(int idx, PSPFileInfo &info, std::string saveName
|
||||
u32 atlasPtr;
|
||||
if (success)
|
||||
atlasPtr = kernelMemory.Alloc(texSize, true, "SaveData Icon");
|
||||
if (success && atlasPtr > 0)
|
||||
if (success && atlasPtr != -1)
|
||||
{
|
||||
saveDataList[idx].textureData = atlasPtr;
|
||||
Memory::Memcpy(atlasPtr, textureData, texSize);
|
||||
|
||||
@@ -355,7 +355,7 @@ public:
|
||||
{
|
||||
stackBlock = userMemory.Alloc(stackSize, true, (std::string("stack/") + nt.name).c_str());
|
||||
}
|
||||
if (stackBlock == (u32)-1 || stackBlock == 0)
|
||||
if (stackBlock == (u32)-1)
|
||||
{
|
||||
stackBlock = 0;
|
||||
ERROR_LOG(HLE, "Failed to allocate stack for thread");
|
||||
|
||||
@@ -32,7 +32,7 @@ u32 BlockAllocator::Alloc(u32 &size, bool fromTop, const char *tag)
|
||||
// Sanity check
|
||||
if (size == 0 || size > rangeSize_) {
|
||||
ERROR_LOG(HLE, "Clearly bogus size: %08x - failing allocation", size);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// upalign size to grain
|
||||
@@ -104,7 +104,7 @@ u32 BlockAllocator::AllocAt(u32 position, u32 size, const char *tag)
|
||||
CheckBlocks();
|
||||
if (size > rangeSize_) {
|
||||
ERROR_LOG(HLE, "Clearly bogus size: %08x - failing allocation", size);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// upalign size to grain
|
||||
|
||||
+12
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user