From cb8b72069fd398f8ed118ce5ffb0e205ae19fc32 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 27 May 2020 11:21:59 -0400 Subject: [PATCH] Fix macOS code and change "Swapfile" to "Swap" --- src/citra_qt/main.cpp | 1 + src/common/memory_detect.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index b677ddba0..00196d102 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -65,6 +65,7 @@ #include "common/logging/filter.h" #include "common/logging/log.h" #include "common/logging/text_formatter.h" +#include "common/memory_detect.h" #include "common/microprofile.h" #include "common/scm_rev.h" #include "common/scope_exit.h" diff --git a/src/common/memory_detect.cpp b/src/common/memory_detect.cpp index b59a45d55..3fdc309a2 100644 --- a/src/common/memory_detect.cpp +++ b/src/common/memory_detect.cpp @@ -33,10 +33,13 @@ static MemoryInfo Detect() { #elif defined(__APPLE__) u64 ramsize; struct xsw_usage vmusage; + std::size_t sizeof_ramsize = sizeof(ramsize); + std::size_t sizeof_vmusage = sizeof(vmusage); // hw and vm are defined in sysctl.h // https://github.com/apple/darwin-xnu/blob/master/bsd/sys/sysctl.h#L471 - sysctlbyname(hw.memsize, &ramsize, sizeof(ramsize), NULL, 0); - sysctlbyname(vm.swapusage, &vmusage, sizeof(vmusage), NULL, 0); + // sysctlbyname(const char *, void *, size_t *, void *, size_t); + sysctlbyname("hw.memsize", &ramsize, &sizeof_ramsize, NULL, 0); + sysctlbyname("vm.swapusage", &vmusage, &sizeof_vmusage, NULL, 0); mem_info.TotalPhysicalMemory = ramsize; mem_info.TotalSwapMemory = vmusage.xsu_total; #else