mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	Implement SDL_GetSystemRAM and SDL_GetNumLogicalCPUCores for the 3ds (#12494)
(cherry picked from commit 5d804a39d9)
			
			
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 TheMode
					TheMode