mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-26 15:53:35 +01:00
Assorted fixes (build and crash)
This commit is contained in:
1 parent
e0614b7ce2
commit
e3aa2f5e4c
4 files changed
+15
-18
No files matched your search
@@ -40,6 +40,7 @@
|
||||
#include "sceJpeg.h"
|
||||
#include "sceKernel.h"
|
||||
#include "sceKernelEventFlag.h"
|
||||
#include "sceKernelHeap.h"
|
||||
#include "sceKernelMemory.h"
|
||||
#include "sceKernelInterrupt.h"
|
||||
#include "sceKernelModule.h"
|
||||
|
||||
+13
-12
@@ -1,5 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
@@ -26,7 +24,7 @@ struct Heap : public KernelObject {
|
||||
static int GetStaticIDType() { return PPSSPP_KERNEL_TMID_Heap; }
|
||||
int GetIDType() const override { return PPSSPP_KERNEL_TMID_Heap; }
|
||||
|
||||
void DoState(PointerWrap &p) {
|
||||
void DoState(PointerWrap &p) override {
|
||||
p.Do(uid);
|
||||
p.Do(partitionId);
|
||||
p.Do(size);
|
||||
@@ -38,19 +36,22 @@ struct Heap : public KernelObject {
|
||||
};
|
||||
|
||||
static int sceKernelCreateHeap(int partitionId, int size, int flags, const char *Name) {
|
||||
u32 allocSize = (size + 3) & ~3;
|
||||
|
||||
// TODO: partitionId should probably decide if we allocate from userMemory or kernel or whatever...
|
||||
u32 addr = userMemory.Alloc(allocSize, frombottom, "SysMemForKernel-Heap");
|
||||
if (addr == (u32)-1) {
|
||||
ERROR_LOG(HLE, "sceKernelCreateHeap(partitionId=%d): Failed to allocate %d bytes memory", partitionId, size);
|
||||
return SCE_KERNEL_ERROR_NO_MEMORY; // Blind guess
|
||||
}
|
||||
|
||||
Heap *heap = new Heap();
|
||||
SceUID uid = kernelObjects.Create(heap);
|
||||
|
||||
heap->partitionId = partitionId;
|
||||
heap->flags = flags;
|
||||
heap->name = *Name;
|
||||
int allocSize = (size + 3) & ~3;
|
||||
heap->size = allocSize;
|
||||
u32 addr = userMemory.Alloc(heap->size, frombottom, "SysMemForKernel-Heap");
|
||||
if (addr == (u32)-1) {
|
||||
ERROR_LOG(HLE, "sceKernelCreateHeap(): Failed to allocate %i bytes memory", size);
|
||||
heap->uid = -1;
|
||||
delete heap;
|
||||
}
|
||||
heap->address = addr;
|
||||
heap->alloc.Init(heap->address + 128, heap->size - 128);
|
||||
heap->uid = uid;
|
||||
@@ -66,7 +67,7 @@ static int sceKernelAllocHeapMemory(int heapId, int size) {
|
||||
u32 addr = heap->alloc.Alloc(memSize, true);
|
||||
return hleLogSuccessInfoX(SCEKERNEL, addr, "");
|
||||
} else {
|
||||
ERROR_LOG(HLE, "sceKernelAllocHeapMemory cannot find heapId", heapId);
|
||||
ERROR_LOG(HLE, "sceKernelAllocHeapMemory(%d): cannot find heapId", heapId);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +80,7 @@ static int sceKernelDeleteHeap(int heapId) {
|
||||
kernelObjects.Destroy<Heap>(heap->uid);
|
||||
return hleLogSuccessInfoX(SCEKERNEL, 0, "");
|
||||
} else {
|
||||
ERROR_LOG(HLE, "sceKernelDeleteHeap(%i): invalid heapId", heapId);
|
||||
ERROR_LOG(HLE, "sceKernelDeleteHeap(%d): invalid heapId", heapId);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
|
||||
int sceKernelCreateHeap(int partitionId, int size, int flags, const char *Name);
|
||||
int sceKernelAllocHeapMemory(int heapId, int size);
|
||||
int sceKernelDeleteHeap(int heapId);
|
||||
void Register_SysMemForKernel();
|
||||
@@ -66,5 +66,4 @@ int sceKernelGetTlsAddr(SceUID uid);
|
||||
int sceKernelFreeTlspl(SceUID uid);
|
||||
int sceKernelReferTlsplStatus(SceUID uid, u32 infoPtr);
|
||||
|
||||
void Register_SysMemForKernel();
|
||||
void Register_SysMemUserForUser();
|
||||
Reference in new issue
Block a user