diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index 7aaf77cde5..939fbe0fe9 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -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; } diff --git a/Core/HLE/sceKernelMemory.h b/Core/HLE/sceKernelMemory.h index 2dff1dfe38..a65db34604 100644 --- a/Core/HLE/sceKernelMemory.h +++ b/Core/HLE/sceKernelMemory.h @@ -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; diff --git a/Core/HLE/sceNetAdhocMatching.cpp b/Core/HLE/sceNetAdhocMatching.cpp index b3e0eea6f2..14ee4c73fc 100644 --- a/Core/HLE/sceNetAdhocMatching.cpp +++ b/Core/HLE/sceNetAdhocMatching.cpp @@ -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) {