draconisplusplus/src/os/macos.cpp

26 lines
396 B
C++
Raw Normal View History

2024-05-31 22:59:00 -04:00
#ifdef __APPLE__
#include <string>
2024-06-05 19:04:53 -04:00
#include <sys/sysctl.h>
#include "macos/NowPlayingBridge.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-05-29 00:28:54 -04:00
uint64_t mem = 0;
2024-06-05 19:04:53 -04:00
size_t 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-06 21:04:32 -04:00
if (const char* title = GetCurrentPlayingTitle())
return title;
return "No song playing";
2024-05-29 06:39:39 -04:00
}
2024-05-31 22:59:00 -04:00
#endif