mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-09 03:16:26 +00:00
SDL_GetSystemRAM completion for Haiku system.
using native system_info's api.
This commit is contained in:

committed by
Sam Lantinga

parent
d5775f6708
commit
8d24381e7e
@@ -83,6 +83,10 @@
|
|||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
#include <kernel/OS.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CPU_HAS_RDTSC (1 << 0)
|
#define CPU_HAS_RDTSC (1 << 0)
|
||||||
#define CPU_HAS_ALTIVEC (1 << 1)
|
#define CPU_HAS_ALTIVEC (1 << 1)
|
||||||
#define CPU_HAS_MMX (1 << 2)
|
#define CPU_HAS_MMX (1 << 2)
|
||||||
@@ -1080,6 +1084,16 @@ int SDL_GetSystemRAM(void)
|
|||||||
SDL_SystemRAM = GetMemorySize();
|
SDL_SystemRAM = GetMemorySize();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
if (SDL_SystemRAM <= 0) {
|
||||||
|
system_info info;
|
||||||
|
if (get_system_info(&info) == B_OK) {
|
||||||
|
/* To have an accurate amount, we also take in account the inaccessible pages (aka ignored)
|
||||||
|
which is a bit handier compared to the legacy system's api (i.e. used_pages).*/
|
||||||
|
SDL_SystemRAM = (int)round((info.max_pages + info.ignored_pages > 0 ? info.ignored_pages : 0) * B_PAGE_SIZE / 1048576.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return SDL_SystemRAM;
|
return SDL_SystemRAM;
|
||||||
|
Reference in New Issue
Block a user