draconisplusplus/src/os/macos.cpp

28 lines
539 B
C++
Raw Normal View History

2024-05-31 22:59:00 -04:00
#ifdef __APPLE__
2024-06-05 19:04:53 -04:00
#include <sys/sysctl.h>
2024-06-08 14:10:59 -04:00
#include "macos/bridge.h"
2024-05-31 22:59:00 -04:00
#include "os.h"
2024-05-29 00:28:54 -04:00
2024-06-07 04:23:11 -04:00
u64 GetMemInfo() {
2024-06-08 15:53:06 -04:00
u64 mem = 0;
2024-06-08 04:57:32 -04:00
usize size = sizeof(mem);
2024-05-29 00:28:54 -04:00
sysctlbyname("hw.memsize", &mem, &size, nullptr, 0);
return mem;
}
2024-05-29 06:39:39 -04:00
2024-06-01 06:59:01 -04:00
std::string GetNowPlaying() {
2024-06-08 04:57:32 -04:00
if (const char* title = GetCurrentPlayingTitle();
const char* artist = GetCurrentPlayingArtist())
return "Now Playing: " + std::string(artist) + " - " + std::string(title);
2024-06-06 21:04:32 -04:00
return "No song playing";
2024-05-29 06:39:39 -04:00
}
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
const char* GetOSVersion() { return GetMacOSVersion(); };
2024-05-31 22:59:00 -04:00
#endif