From 6c22fd690290ae5701e69123b0454376db58a28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 7 Feb 2023 14:16:53 +0800 Subject: [PATCH] Host: update newest product name data (macOS) --- CHANGELOG.md | 1 + src/detection/host/host_apple.c | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a9f1a7a..d41113244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Other: * Simplified wmtheme output format (Windows) * Improved GPU detection performance on Windows 11 +* Lastest Mac model identifier support (macOS) # 1.9.1 diff --git a/src/detection/host/host_apple.c b/src/detection/host/host_apple.c index d768d83e4..4f739276b 100644 --- a/src/detection/host/host_apple.c +++ b/src/detection/host/host_apple.c @@ -8,7 +8,13 @@ static inline bool strEqual(const char* a, const char* b) static const char* getProductName(const FFstrbuf* hwModel) { - //https://github.com/hykilpikonna/hyfetch/blob/master/neofetch#L1386 + // Macbook Pro: https://support.apple.com/en-us/HT201300 + // Macbook Air: https://support.apple.com/en-us/HT201862 + // Mac mini: https://support.apple.com/en-us/HT201894 + // iMac: https://support.apple.com/en-us/HT201634 + // Mac Pro: https://support.apple.com/en-us/HT202888 + // Mac Studio: https://support.apple.com/en-us/HT213073 + if(ffStrbufStartsWithS(hwModel, "MacBookPro")) { const char* version = hwModel->chars + strlen("MacBookPro"); @@ -106,20 +112,26 @@ static const char* getProductName(const FFstrbuf* hwModel) else if(ffStrbufStartsWithS(hwModel, "Mac")) { const char* version = hwModel->chars + strlen("Mac"); + if(strEqual(version, "14,6") || + strEqual(version, "14,10")) return "MacBook Pro (16-inch, 2023)"; + if(strEqual(version, "14,5") || + strEqual(version, "14,9")) return "MacBook Pro (14-inch, 2023)"; + if(strEqual(version, "14,3")) return "Mac mini (M2, 2023, Two Thunderbolt 4 ports)"; + if(strEqual(version, "14,12")) return "Mac mini (M2, 2023, Four Thunderbolt 4 ports)"; if(strEqual(version, "14,7")) return "MacBook Pro (13-inch, M2, 2022)"; if(strEqual(version, "14,2")) return "MacBook Air (M2, 2022)"; - if(strEqual(version, "13,1")) return "Mac Studio (2022, Two USB-C front ports)"; - if(strEqual(version, "13,2")) return "Mac Studio (2022, Two Thunderbolt 4 front ports)"; + if(strEqual(version, "13,1")) return "Mac Studio (M1 Max, 2022, Two USB-C front ports)"; + if(strEqual(version, "13,2")) return "Mac Studio (M1 Ultra, 2022, Two Thunderbolt 4 front ports)"; } else if(ffStrbufStartsWithS(hwModel, "iMac")) { const char* version = hwModel->chars + strlen("iMac"); - if(strEqual(version, "21,1") || - strEqual(version, "21,2")) return "iMac (24-inch, M1, 2021)"; + if(strEqual(version, "21,1")) return "iMac (24-inch, M1, 2021, Two Thunderbolt / USB 4 ports, Two USB 3 ports)"; + if(strEqual(version, "21,2")) return "iMac (24-inch, M1, 2021, Two Thunderbolt / USB 4 ports)"; if(strEqual(version, "20,1") || strEqual(version, "20,2")) return "iMac (Retina 5K, 27-inch, 2020)"; - if(strEqual(version, "19,1") || - strEqual(version, "19,2")) return "iMac (Retina 4K, 21.5-inch, 2019)"; + if(strEqual(version, "19,1")) return "iMac (Retina 5K, 27-inch, 2019)"; + if(strEqual(version, "19,2")) return "iMac (Retina 4K, 21.5-inch, 2019)"; if(strEqual(version, "Pro1,1")) return "iMac Pro (2017)"; if(strEqual(version, "18,3")) return "iMac (Retina 5K, 27-inch, 2017)"; if(strEqual(version, "18,2")) return "iMac (Retina 4K, 21.5-inch, 2017)";