Implement SDL_GetSystemRAM and SDL_GetNumLogicalCPUCores for the 3ds (#12494)

This commit is contained in:
TheMode 2025-03-08 18:51:37 +01:00 committed by GitHub
parent 99336ea378
commit 5d804a39d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 1 deletions

View File

@ -85,7 +85,9 @@
#include <kernel.h>
#include <swis.h>
#endif
#ifdef SDL_PLATFORM_3DS
#include <3ds.h>
#endif
#ifdef SDL_PLATFORM_PS2
#include <kernel.h>
#endif
@ -642,6 +644,15 @@ int SDL_GetNumLogicalCPUCores(void)
GetSystemInfo(&info);
SDL_NumLogicalCPUCores = info.dwNumberOfProcessors;
}
#endif
#ifdef SDL_PLATFORM_3DS
if (SDL_NumLogicalCPUCores <= 0) {
bool isNew3DS = false;
APT_CheckNew3DS(&isNew3DS);
// 1 core is always dedicated to the OS
// Meaning that the New3DS has 3 available core, and the Old3DS only one.
SDL_NumLogicalCPUCores = isNew3DS ? 4 : 2;
}
#endif
// There has to be at least 1, right? :)
if (SDL_NumLogicalCPUCores <= 0) {
@ -1156,6 +1167,12 @@ int SDL_GetSystemRAM(void)
}
}
#endif
#ifdef SDL_PLATFORM_3DS
if (SDL_SystemRAM <= 0) {
// The New3DS has 255MiB, the Old3DS 127MiB
SDL_SystemRAM = (int)(osGetMemRegionSize(MEMREGION_ALL) / (1024 * 1024));
}
#endif
#ifdef SDL_PLATFORM_VITA
if (SDL_SystemRAM <= 0) {
/* Vita has 512MiB on SoC, that's split into 256MiB(+109MiB in extended memory mode) for app