|
16 | 16 | #include <sys/types.h> |
17 | 17 | #include <sys/sysctl.h> |
18 | 18 | #define HW_MEMSIZE HW_PHYSMEM |
| 19 | +#elif defined(PLATFORM_HAIKU) |
| 20 | +# include <OS.h> |
19 | 21 | #endif |
20 | 22 | #if defined(LINUX) |
21 | 23 | #include <unistd.h> |
@@ -464,7 +466,7 @@ void Sys_Error_Internal( bool bMinidump, const char *error, va_list argsList ) |
464 | 466 | // Doing this doesn't quite work the way we want because there is no "crashing" thread |
465 | 467 | // and we see "No thread was identified as the cause of the crash; No signature could be created because we do not know which thread crashed" on the back end |
466 | 468 | //SteamAPI_WriteMiniDump( 0, NULL, build_number() ); |
467 | | - printf("\n ##### Sys_Error: %s", text ); |
| 469 | + printf("\n ##### Sys_Error: %s\n", text ); |
468 | 470 | fflush(stdout ); |
469 | 471 |
|
470 | 472 | raise(SIGTRAP); |
@@ -677,6 +679,11 @@ void Sys_InitMemory( void ) |
677 | 679 | { |
678 | 680 | memsize = ONE_HUNDRED_TWENTY_EIGHT_MB; |
679 | 681 | } |
| 682 | +#elif defined(PLATFORM_HAIKU) |
| 683 | + system_info info; |
| 684 | + get_system_info(&info); |
| 685 | + |
| 686 | + memsize = (uint64_t)(info.max_pages * B_PAGE_SIZE); |
680 | 687 | #elif defined(LINUX) |
681 | 688 | const int fd = open("/proc/meminfo", O_RDONLY); |
682 | 689 | if (fd < 0) |
@@ -1586,14 +1593,14 @@ CON_COMMAND( star_memory, "Dump memory stats" ) |
1586 | 1593 | struct mstats memstats = mstats( ); |
1587 | 1594 | Msg( "Available %.2f MB, Used: %.2f MB, #mallocs = %lu\n", |
1588 | 1595 | memstats.bytes_free / ( 1024.0 * 1024.0), memstats.bytes_used / ( 1024.0 * 1024.0 ), memstats.chunks_used ); |
1589 | | -#elif PLATFORM_BSD |
1590 | | -# warning TODO: Implement memory stats (peace of sheet of course) |
1591 | | -#else // Win32 |
| 1596 | +#elif _WIN32 |
1592 | 1597 | MEMORYSTATUS stat; |
1593 | 1598 | GlobalMemoryStatus( &stat ); |
1594 | 1599 | Msg( "Available: %.2f MB, Used: %.2f MB, Free: %.2f MB\n", |
1595 | 1600 | stat.dwTotalPhys/( 1024.0f*1024.0f ) - 32.0f, |
1596 | 1601 | ( stat.dwTotalPhys - stat.dwAvailPhys )/( 1024.0f*1024.0f ) - 32.0f, |
1597 | 1602 | stat.dwAvailPhys/( 1024.0f*1024.0f ) ); |
| 1603 | +#else |
| 1604 | +# warning TODO: Implement memory stats (peace of sheet of course) |
1598 | 1605 | #endif |
1599 | 1606 | } |
0 commit comments