Clean up the memory partition ID enum

This commit is contained in:
Henrik Rydgård committed 2026-07-25 14:53:02 +02:00
1 parent ca34a14fd8
commit 8cb1732564
3 files changed
+17 -9

No files matched your search

+6 -6
View File
@@ -391,14 +391,14 @@ void __KernelMemoryShutdown()
BlockAllocator *BlockAllocatorFromID(int id) {
switch (id) {
case 1:
case KERNEL_PARTITION_ID:
case 3:
case 4:
if (hleIsKernelMode())
return &kernelMemory;
return nullptr;
case 2:
case USER_PARTITION_ID:
case 6:
return &userMemory;
@@ -408,7 +408,7 @@ BlockAllocator *BlockAllocatorFromID(int id) {
return &userMemory;
return nullptr;
case 5:
case VSHELL_PARTITION_ID:
return &volatileMemory;
default:
@@ -420,11 +420,11 @@ BlockAllocator *BlockAllocatorFromID(int id) {
int BlockAllocatorToID(const BlockAllocator *alloc) {
if (alloc == &kernelMemory)
return 1;
return KERNEL_PARTITION_ID;
if (alloc == &userMemory)
return 2;
return USER_PARTITION_ID;
if (alloc == &volatileMemory)
return 5;
return VSHELL_PARTITION_ID;
return 0;
}
+10
View File
@@ -32,6 +32,16 @@ enum MemblockType {
PSP_SMEM_HighAligned = 4,
};
// Memory partition IDs, as passed to sceKernelAllocPartitionMemory() and friends.
// Per TyRaNiD: 1 = kernel, 2 = user, 3 = me, 4 = kernel mirror. 5 is the "volatile"
// partition also used by sceKernelVolatileMemLock() - the VSH uses this partition
// for its own private allocations while it's running.
enum {
KERNEL_PARTITION_ID = 1,
USER_PARTITION_ID = 2,
VSHELL_PARTITION_ID = 5,
};
extern BlockAllocator userMemory;
extern BlockAllocator kernelMemory;
+1 -3
View File
@@ -1907,10 +1907,8 @@ int NetAdhocMatching_Start(int matchingId, int evthPri, int evthPartitionId, int
return hleLogDebug(Log::sceNet, 0);
}
#define KERNEL_PARTITION_ID 1
#define USER_PARTITION_ID 2
#define VSHELL_PARTITION_ID 5
// This should be similar with sceNetAdhocMatchingStart2 but using USER_PARTITION_ID (2) for PartitionId params
// (KERNEL_PARTITION_ID/USER_PARTITION_ID/VSHELL_PARTITION_ID come from Core/HLE/sceKernelMemory.h)
static int sceNetAdhocMatchingStart(int matchingId, int evthPri, int evthStack, int inthPri, int inthStack, int optLen, u32 optDataAddr) {
WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %08x) at %08x", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr, currentMIPS->pc);
if (!g_Config.bEnableWlan) {