From c55d313d72616e7f38ad4aef5f63fb8f9947b1d7 Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Mon, 7 Jun 2021 22:55:17 +0200 Subject: [PATCH] feat: removed the SMC plugin from the Kit framework. Compile from SMC where needed. --- Kit/plugins/SMC.swift | 444 ------------------ .../updater.swift => plugins/Updater.swift} | 2 +- i18n.py => Kit/scripts/i18n.py | 0 Kit/{updater => scripts}/updater.sh | 0 SMC/main.swift | 34 ++ SMC/smc.swift | 147 +++++- SMC/types.swift | 188 -------- Stats.xcodeproj/project.pbxproj | 72 +-- 8 files changed, 214 insertions(+), 673 deletions(-) delete mode 100644 Kit/plugins/SMC.swift rename Kit/{updater/updater.swift => plugins/Updater.swift} (99%) rename i18n.py => Kit/scripts/i18n.py (100%) rename Kit/{updater => scripts}/updater.sh (100%) delete mode 100644 SMC/types.swift diff --git a/Kit/plugins/SMC.swift b/Kit/plugins/SMC.swift deleted file mode 100644 index 4ee1a9f7..00000000 --- a/Kit/plugins/SMC.swift +++ /dev/null @@ -1,444 +0,0 @@ -// -// SMC.swift -// Kit -// -// Created by Serhiy Mytrovtsiy on 05/04/2020. -// Using Swift 5.0. -// Running on macOS 10.15. -// -// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved. -// - -import IOKit - -internal enum SMCDataType: String { - case UI8 = "ui8 " - case UI16 = "ui16" - case UI32 = "ui32" - case SP1E = "sp1e" - case SP3C = "sp3c" - case SP4B = "sp5b" - case SP5A = "sp5a" - case SP69 = "sp669" - case SP78 = "sp78" - case SP87 = "sp87" - case SP96 = "sp96" - case SPB4 = "spb4" - case SPF0 = "spf0" - case FLT = "flt " - case FPE2 = "fpe2" - case FP2E = "fp2e" - case FDS = "{fds" -} - -// swiftlint:disable identifier_name -internal enum SMCKeys: UInt8 { - case KERNEL_INDEX = 2 - case READ_BYTES = 5 - case WRITE_BYTES = 6 - case READ_INDEX = 8 - case READ_KEYINFO = 9 - case READ_PLIMIT = 11 - case READ_VERS = 12 -} - -public enum FanMode: Int { - case automatic = 0 - case forced = 1 -} - -internal struct SMCKeyData_t { - typealias SMCBytes_t = (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, - UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, - UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, - UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, - UInt8, UInt8, UInt8, UInt8) - - struct vers_t { - var major: CUnsignedChar = 0 - var minor: CUnsignedChar = 0 - var build: CUnsignedChar = 0 - var reserved: CUnsignedChar = 0 - var release: CUnsignedShort = 0 - } - - struct LimitData_t { - var version: UInt16 = 0 - var length: UInt16 = 0 - var cpuPLimit: UInt32 = 0 - var gpuPLimit: UInt32 = 0 - var memPLimit: UInt32 = 0 - } - - struct keyInfo_t { - var dataSize: IOByteCount = 0 - var dataType: UInt32 = 0 - var dataAttributes: UInt8 = 0 - } - - var key: UInt32 = 0 - var vers = vers_t() - var pLimitData = LimitData_t() - var keyInfo = keyInfo_t() - var padding: UInt16 = 0 - var result: UInt8 = 0 - var status: UInt8 = 0 - var data8: UInt8 = 0 - var data32: UInt32 = 0 - - var bytes: SMCBytes_t = (UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0)) -} - -internal struct SMCVal_t { - var key: String - var dataSize: UInt32 = 0 - var dataType: String = "" - var bytes: [UInt8] = Array(repeating: 0, count: 32) - - init(_ key: String) { - self.key = key - } -} - -public class SMC { - public static let shared = SMC() - - private var conn: io_connect_t = 0 - - public init() { - var result: kern_return_t - var iterator: io_iterator_t = 0 - let device: io_object_t - - let matchingDictionary: CFMutableDictionary = IOServiceMatching("AppleSMC") - result = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &iterator) - if result != kIOReturnSuccess { - print("Error IOServiceGetMatchingServices(): " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return - } - - device = IOIteratorNext(iterator) - IOObjectRelease(iterator) - if device == 0 { - print("Error IOIteratorNext(): " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return - } - - result = IOServiceOpen(device, mach_task_self_, 0, &conn) - IOObjectRelease(device) - if result != kIOReturnSuccess { - print("Error IOServiceOpen(): " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return - } - } - - deinit { - let result = self.close() - if result != kIOReturnSuccess { - print("error close smc connection: " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - } - } - - public func close() -> kern_return_t{ - return IOServiceClose(conn) - } - - public func getValue(_ key: String) -> Double? { - var result: kern_return_t = 0 - var val: SMCVal_t = SMCVal_t(key) - - result = read(&val) - if result != kIOReturnSuccess { - print("Error read(): " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return nil - } - - if val.dataSize > 0 { - if val.bytes.first(where: { $0 != 0}) == nil && val.key != "FS! " { - return nil - } - - switch val.dataType { - case SMCDataType.UI8.rawValue: - return Double(val.bytes[0]) - case SMCDataType.UI16.rawValue: - return Double(UInt16(bytes: (val.bytes[0], val.bytes[1]))) - case SMCDataType.UI32.rawValue: - return Double(UInt32(bytes: (val.bytes[0], val.bytes[1], val.bytes[2], val.bytes[3]))) - case SMCDataType.SP1E.rawValue: - let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1])) - return Double(result / 16384) - case SMCDataType.SP3C.rawValue: - let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1])) - return Double(result / 4096) - case SMCDataType.SP4B.rawValue: - let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1])) - return Double(result / 2048) - case SMCDataType.SP5A.rawValue: - let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1])) - return Double(result / 1024) - case SMCDataType.SP69.rawValue: - let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1])) - return Double(result / 512) - case SMCDataType.SP78.rawValue: - let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1])) - return Double(intValue / 256) - case SMCDataType.SP87.rawValue: - let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1])) - return Double(intValue / 128) - case SMCDataType.SP96.rawValue: - let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1])) - return Double(intValue / 64) - case SMCDataType.SPB4.rawValue: - let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1])) - return Double(intValue / 16) - case SMCDataType.SPF0.rawValue: - let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1])) - return intValue - case SMCDataType.FLT.rawValue: - let value: Float? = Float(val.bytes) - if value != nil { - return Double(value!) - } - return nil - case SMCDataType.FPE2.rawValue: - return Double(Int(fromFPE2: (val.bytes[0], val.bytes[1]))) - default: - print("unsupported data type \(val.dataType) for key: \(key)") - return nil - } - } - - return nil - } - - public func getStringValue(_ key: String) -> String? { - var result: kern_return_t = 0 - var val: SMCVal_t = SMCVal_t(key) - - result = read(&val) - if result != kIOReturnSuccess { - print("Error read(): " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return nil - } - - if val.dataSize > 0 { - if val.bytes.first(where: { $0 != 0}) == nil { - return nil - } - - switch val.dataType { - case SMCDataType.FDS.rawValue: - let c1 = String(UnicodeScalar(val.bytes[4])) - let c2 = String(UnicodeScalar(val.bytes[5])) - let c3 = String(UnicodeScalar(val.bytes[6])) - let c4 = String(UnicodeScalar(val.bytes[7])) - let c5 = String(UnicodeScalar(val.bytes[8])) - let c6 = String(UnicodeScalar(val.bytes[9])) - let c7 = String(UnicodeScalar(val.bytes[10])) - let c8 = String(UnicodeScalar(val.bytes[11])) - let c9 = String(UnicodeScalar(val.bytes[12])) - let c10 = String(UnicodeScalar(val.bytes[13])) - let c11 = String(UnicodeScalar(val.bytes[14])) - let c12 = String(UnicodeScalar(val.bytes[15])) - - return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12).trimmingCharacters(in: .whitespaces) - default: - print("unsupported data type \(val.dataType) for key: \(key)") - return nil - } - } - - return nil - } - - private func read(_ value: UnsafeMutablePointer) -> kern_return_t { - var result: kern_return_t = 0 - var input = SMCKeyData_t() - var output = SMCKeyData_t() - - input.key = FourCharCode(fromString: value.pointee.key) - input.data8 = SMCKeys.READ_KEYINFO.rawValue - - result = call(SMCKeys.KERNEL_INDEX.rawValue, input: &input, output: &output) - if result != kIOReturnSuccess { - print("Error call(READ_KEYINFO): " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return result - } - - value.pointee.dataSize = UInt32(output.keyInfo.dataSize) - value.pointee.dataType = output.keyInfo.dataType.toString() - input.keyInfo.dataSize = output.keyInfo.dataSize - input.data8 = SMCKeys.READ_BYTES.rawValue - - result = call(SMCKeys.KERNEL_INDEX.rawValue, input: &input, output: &output) - if result != kIOReturnSuccess { - print("Error call(READ_BYTES): " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return result - } - - memcpy(&value.pointee.bytes, &output.bytes, Int(value.pointee.dataSize)) - - return kIOReturnSuccess - } - - private func write(_ value: SMCVal_t) -> kern_return_t { - var input = SMCKeyData_t() - var output = SMCKeyData_t() - - input.key = FourCharCode(fromString: value.key) - input.data8 = SMCKeys.WRITE_BYTES.rawValue - input.keyInfo.dataSize = IOByteCount(value.dataSize) - input.bytes = (value.bytes[0], value.bytes[1], value.bytes[2], value.bytes[3], value.bytes[4], value.bytes[5], - value.bytes[6], value.bytes[7], value.bytes[8], value.bytes[9], value.bytes[10], value.bytes[11], - value.bytes[12], value.bytes[13], value.bytes[14], value.bytes[15], value.bytes[16], value.bytes[17], - value.bytes[18], value.bytes[19], value.bytes[20], value.bytes[21], value.bytes[22], value.bytes[23], - value.bytes[24], value.bytes[25], value.bytes[26], value.bytes[27], value.bytes[28], value.bytes[29], - value.bytes[30], value.bytes[31]) - - let result = self.call(SMCKeys.KERNEL_INDEX.rawValue, input: &input, output: &output) - if result != kIOReturnSuccess { - print("Error call(WRITE_BYTES): " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return result - } - - return kIOReturnSuccess - } - - private func call(_ index: UInt8, input: inout SMCKeyData_t, output: inout SMCKeyData_t) -> kern_return_t { - let inputSize = MemoryLayout.stride - var outputSize = MemoryLayout.stride - - return IOConnectCallStructMethod( - conn, - UInt32(index), - &input, - inputSize, - &output, - &outputSize - ) - } - - public func getAllKeys() -> [String] { - var list: [String] = [] - - let keysNum: Double? = self.getValue("#KEY") - if keysNum == nil { - print("ERROR no keys count found") - return list - } - - var result: kern_return_t = 0 - var input: SMCKeyData_t = SMCKeyData_t() - var output: SMCKeyData_t = SMCKeyData_t() - - for i in 0...Int(keysNum!) { - input = SMCKeyData_t() - output = SMCKeyData_t() - - input.data8 = SMCKeys.READ_INDEX.rawValue - input.data32 = UInt32(i) - - result = call(SMCKeys.KERNEL_INDEX.rawValue, input: &input, output: &output) - if result != kIOReturnSuccess { - continue - } - - list.append(output.key.toString()) - } - - return list - } - - public func setFanMode(_ id: Int, mode: FanMode) { - let fansMode = Int(self.getValue("FS! ") ?? 0) - var newMode: UInt8 = 0 - - if fansMode == 0 && id == 0 && mode == .forced { - newMode = 1 - } else if fansMode == 0 && id == 1 && mode == .forced { - newMode = 2 - } else if fansMode == 1 && id == 0 && mode == .automatic { - newMode = 0 - } else if fansMode == 1 && id == 1 && mode == .forced { - newMode = 3 - } else if fansMode == 2 && id == 1 && mode == .automatic { - newMode = 0 - } else if fansMode == 2 && id == 0 && mode == .forced { - newMode = 3 - } else if fansMode == 3 && id == 0 && mode == .automatic { - newMode = 2 - } else if fansMode == 3 && id == 1 && mode == .automatic { - newMode = 1 - } - - if fansMode == newMode { - return - } - - var result: kern_return_t = 0 - var value = SMCVal_t("FS! ") - - result = read(&value) - if result != kIOReturnSuccess { - print("Error read fan mode: " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return - } - - value.bytes = [0, newMode, UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0)] - - result = write(value) - if result != kIOReturnSuccess { - print("Error write: " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return - } - } - - public func resetFans() { - var value = SMCVal_t("FS! ") - value.dataSize = 2 - - let result = write(value) - if result != kIOReturnSuccess { - print("Error write: " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - } - } - - public func setFanSpeed(_ id: Int, speed: Int) { - let minSpeed = Int(self.getValue("F\(id)Mn") ?? 2500) - let maxSpeed = Int(self.getValue("F\(id)Mx") ?? 4000) - - if speed < minSpeed { - print("new fan speed (\(speed)) is less than minimum speed (\(minSpeed))") - return - } else if speed > maxSpeed { - print("new fan speed (\(speed)) is more than maximum speed (\(maxSpeed))") - return - } - - var value = SMCVal_t("F\(id)Tg") - value.dataSize = 2 - value.bytes = [UInt8(speed >> 6), UInt8((speed << 2) ^ ((speed >> 6) << 8)), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0)] - - let result = write(value) - if result != kIOReturnSuccess { - print("Error write: " + (String(cString: mach_error_string(result), encoding: String.Encoding.ascii) ?? "unknown error")) - return - } - } -} diff --git a/Kit/updater/updater.swift b/Kit/plugins/Updater.swift similarity index 99% rename from Kit/updater/updater.swift rename to Kit/plugins/Updater.swift index 6f1878bc..1ff1c5c3 100644 --- a/Kit/updater/updater.swift +++ b/Kit/plugins/Updater.swift @@ -1,5 +1,5 @@ // -// updater.swift +// Updater.swift // Kit // // Created by Serhiy Mytrovtsiy on 14/04/2020. diff --git a/i18n.py b/Kit/scripts/i18n.py similarity index 100% rename from i18n.py rename to Kit/scripts/i18n.py diff --git a/Kit/updater/updater.sh b/Kit/scripts/updater.sh similarity index 100% rename from Kit/updater/updater.sh rename to Kit/scripts/updater.sh diff --git a/SMC/main.swift b/SMC/main.swift index 52a93145..b24cbe9e 100644 --- a/SMC/main.swift +++ b/SMC/main.swift @@ -11,6 +11,40 @@ import Foundation +enum CMDType: String { + case list + case set + case help + case unknown + + init(value: String) { + switch value { + case "list": self = .list + case "set": self = .set + case "help": self = .help + default: self = .unknown + } + } +} + +enum FlagsType: String { + case temperature = "T" + case voltage = "V" + case power = "P" + case fans = "F" + case all + + init(value: String) { + switch value { + case "-t": self = .temperature + case "-v": self = .voltage + case "-p": self = .power + case "-f": self = .fans + default: self = .all + } + } +} + func main() { var args = CommandLine.arguments.dropFirst() let cmd = CMDType(value: args.first ?? "") diff --git a/SMC/smc.swift b/SMC/smc.swift index f64e09e4..be683cf0 100644 --- a/SMC/smc.swift +++ b/SMC/smc.swift @@ -12,9 +12,145 @@ import Foundation import IOKit +internal enum SMCDataType: String { + case UI8 = "ui8 " + case UI16 = "ui16" + case UI32 = "ui32" + case SP1E = "sp1e" + case SP3C = "sp3c" + case SP4B = "sp5b" + case SP5A = "sp5a" + case SP69 = "sp669" + case SP78 = "sp78" + case SP87 = "sp87" + case SP96 = "sp96" + case SPB4 = "spb4" + case SPF0 = "spf0" + case FLT = "flt " + case FPE2 = "fpe2" + case FP2E = "fp2e" + case FDS = "{fds" +} + +// swiftlint:disable identifier_name +internal enum SMCKeys: UInt8 { + case KERNEL_INDEX = 2 + case READ_BYTES = 5 + case WRITE_BYTES = 6 + case READ_INDEX = 8 + case READ_KEYINFO = 9 + case READ_PLIMIT = 11 + case READ_VERS = 12 +} + +public enum FanMode: Int { + case automatic = 0 + case forced = 1 +} + +internal struct SMCKeyData_t { + typealias SMCBytes_t = (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, + UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, + UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, + UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, + UInt8, UInt8, UInt8, UInt8) + + struct vers_t { + var major: CUnsignedChar = 0 + var minor: CUnsignedChar = 0 + var build: CUnsignedChar = 0 + var reserved: CUnsignedChar = 0 + var release: CUnsignedShort = 0 + } + + struct LimitData_t { + var version: UInt16 = 0 + var length: UInt16 = 0 + var cpuPLimit: UInt32 = 0 + var gpuPLimit: UInt32 = 0 + var memPLimit: UInt32 = 0 + } + + struct keyInfo_t { + var dataSize: IOByteCount = 0 + var dataType: UInt32 = 0 + var dataAttributes: UInt8 = 0 + } + + var key: UInt32 = 0 + var vers = vers_t() + var pLimitData = LimitData_t() + var keyInfo = keyInfo_t() + var padding: UInt16 = 0 + var result: UInt8 = 0 + var status: UInt8 = 0 + var data8: UInt8 = 0 + var data32: UInt32 = 0 + var bytes: SMCBytes_t = (UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), + UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), + UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), + UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), + UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), + UInt8(0), UInt8(0)) +} + +internal struct SMCVal_t { + var key: String + var dataSize: UInt32 = 0 + var dataType: String = "" + var bytes: [UInt8] = Array(repeating: 0, count: 32) + + init(_ key: String) { + self.key = key + } +} + +extension FourCharCode { + init(fromString str: String) { + precondition(str.count == 4) + + self = str.utf8.reduce(0) { sum, character in + return sum << 8 | UInt32(character) + } + } + + func toString() -> String { + return String(describing: UnicodeScalar(self >> 24 & 0xff)!) + + String(describing: UnicodeScalar(self >> 16 & 0xff)!) + + String(describing: UnicodeScalar(self >> 8 & 0xff)!) + + String(describing: UnicodeScalar(self & 0xff)!) + } +} + +extension UInt16 { + init(bytes: (UInt8, UInt8)) { + self = UInt16(bytes.0) << 8 | UInt16(bytes.1) + } +} + +// swiftlint:disable large_tuple +extension UInt32 { + init(bytes: (UInt8, UInt8, UInt8, UInt8)) { + self = UInt32(bytes.0) << 24 | UInt32(bytes.1) << 16 | UInt32(bytes.2) << 8 | UInt32(bytes.3) + } +} + +extension Int { + init(fromFPE2 bytes: (UInt8, UInt8)) { + self = (Int(bytes.0) << 6) + (Int(bytes.1) >> 2) + } +} + +extension Float { + init?(_ bytes: [UInt8]) { + self = bytes.withUnsafeBytes { + return $0.load(fromByteOffset: 0, as: Self.self) + } + } +} + public class SMC { public static let shared = SMC() - private var conn: io_connect_t = 0 public init() { @@ -352,13 +488,6 @@ public class SMC { let inputSize = MemoryLayout.stride var outputSize = MemoryLayout.stride - return IOConnectCallStructMethod( - conn, - UInt32(index), - &input, - inputSize, - &output, - &outputSize - ) + return IOConnectCallStructMethod(conn, UInt32(index), &input, inputSize, &output, &outputSize) } } diff --git a/SMC/types.swift b/SMC/types.swift deleted file mode 100644 index b1bc2778..00000000 --- a/SMC/types.swift +++ /dev/null @@ -1,188 +0,0 @@ -// -// types.swift -// SMC -// -// Created by Serhiy Mytrovtsiy on 25/05/2021. -// Using Swift 5.0. -// Running on macOS 10.15. -// -// Copyright © 2021 Serhiy Mytrovtsiy. All rights reserved. -// - -import Foundation - -enum CMDType: String { - case list - case set - case help - case unknown - - init(value: String) { - switch value { - case "list": self = .list - case "set": self = .set - case "help": self = .help - default: self = .unknown - } - } -} - -enum FlagsType: String { - case temperature = "T" - case voltage = "V" - case power = "P" - case fans = "F" - case all - - init(value: String) { - switch value { - case "-t": self = .temperature - case "-v": self = .voltage - case "-p": self = .power - case "-f": self = .fans - default: self = .all - } - } -} - -// MARK: - smc - -internal enum SMCDataType: String { - case UI8 = "ui8 " - case UI16 = "ui16" - case UI32 = "ui32" - case SP1E = "sp1e" - case SP3C = "sp3c" - case SP4B = "sp5b" - case SP5A = "sp5a" - case SP69 = "sp669" - case SP78 = "sp78" - case SP87 = "sp87" - case SP96 = "sp96" - case SPB4 = "spb4" - case SPF0 = "spf0" - case FLT = "flt " - case FPE2 = "fpe2" - case FP2E = "fp2e" - case FDS = "{fds" -} - -// swiftlint:disable identifier_name -internal enum SMCKeys: UInt8 { - case KERNEL_INDEX = 2 - case READ_BYTES = 5 - case WRITE_BYTES = 6 - case READ_INDEX = 8 - case READ_KEYINFO = 9 - case READ_PLIMIT = 11 - case READ_VERS = 12 -} - -public enum FanMode: Int { - case automatic = 0 - case forced = 1 -} - -internal struct SMCKeyData_t { - typealias SMCBytes_t = (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, - UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, - UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, - UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, - UInt8, UInt8, UInt8, UInt8) - - struct vers_t { - var major: CUnsignedChar = 0 - var minor: CUnsignedChar = 0 - var build: CUnsignedChar = 0 - var reserved: CUnsignedChar = 0 - var release: CUnsignedShort = 0 - } - - struct LimitData_t { - var version: UInt16 = 0 - var length: UInt16 = 0 - var cpuPLimit: UInt32 = 0 - var gpuPLimit: UInt32 = 0 - var memPLimit: UInt32 = 0 - } - - struct keyInfo_t { - var dataSize: IOByteCount = 0 - var dataType: UInt32 = 0 - var dataAttributes: UInt8 = 0 - } - - var key: UInt32 = 0 - var vers = vers_t() - var pLimitData = LimitData_t() - var keyInfo = keyInfo_t() - var padding: UInt16 = 0 - var result: UInt8 = 0 - var status: UInt8 = 0 - var data8: UInt8 = 0 - var data32: UInt32 = 0 - - var bytes: SMCBytes_t = (UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), - UInt8(0), UInt8(0)) -} - -internal struct SMCVal_t { - var key: String - var dataSize: UInt32 = 0 - var dataType: String = "" - var bytes: [UInt8] = Array(repeating: 0, count: 32) - - init(_ key: String) { - self.key = key - } -} - -// MARK: - extensions - -extension FourCharCode { - init(fromString str: String) { - precondition(str.count == 4) - - self = str.utf8.reduce(0) { sum, character in - return sum << 8 | UInt32(character) - } - } - - func toString() -> String { - return String(describing: UnicodeScalar(self >> 24 & 0xff)!) + - String(describing: UnicodeScalar(self >> 16 & 0xff)!) + - String(describing: UnicodeScalar(self >> 8 & 0xff)!) + - String(describing: UnicodeScalar(self & 0xff)!) - } -} - -extension UInt16 { - init(bytes: (UInt8, UInt8)) { - self = UInt16(bytes.0) << 8 | UInt16(bytes.1) - } -} - -// swiftlint:disable large_tuple -extension UInt32 { - init(bytes: (UInt8, UInt8, UInt8, UInt8)) { - self = UInt32(bytes.0) << 24 | UInt32(bytes.1) << 16 | UInt32(bytes.2) << 8 | UInt32(bytes.3) - } -} - -extension Int { - init(fromFPE2 bytes: (UInt8, UInt8)) { - self = (Int(bytes.0) << 6) + (Int(bytes.1) >> 2) - } -} - -extension Float { - init?(_ bytes: [UInt8]) { - self = bytes.withUnsafeBytes { - return $0.load(fromByteOffset: 0, as: Self.self) - } - } -} diff --git a/Stats.xcodeproj/project.pbxproj b/Stats.xcodeproj/project.pbxproj index 777d736e..648bd1d8 100644 --- a/Stats.xcodeproj/project.pbxproj +++ b/Stats.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ 9A045EB72594F8D100ED58F2 /* Dashboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A045EB62594F8D100ED58F2 /* Dashboard.swift */; }; 9A27D5352538A456001BB651 /* Reachability in Frameworks */ = {isa = PBXBuildFile; productRef = 9A27D5342538A456001BB651 /* Reachability */; }; - 9A2843E52666959B00EC1F6D /* smc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9ADE6FD8265D032100D2FBA8 /* smc */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 9A2846FE2666A9CC00EC1F6D /* Kit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A2846F72666A9CC00EC1F6D /* Kit.framework */; }; 9A2846FF2666A9CC00EC1F6D /* Kit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9A2846F72666A9CC00EC1F6D /* Kit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9A28475F2666AA2700EC1F6D /* LineChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2847552666AA2700EC1F6D /* LineChart.swift */; }; @@ -40,8 +39,7 @@ 9A2848092666AB3000EC1F6D /* Store.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2848022666AB2F00EC1F6D /* Store.swift */; }; 9A28480A2666AB3000EC1F6D /* SystemKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2848032666AB2F00EC1F6D /* SystemKit.swift */; }; 9A28480B2666AB3000EC1F6D /* Charts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2848042666AB2F00EC1F6D /* Charts.swift */; }; - 9A28480C2666AB3000EC1F6D /* SMC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2848052666AB3000EC1F6D /* SMC.swift */; }; - 9A28480E2666AB3000EC1F6D /* updater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2848072666AB3000EC1F6D /* updater.swift */; }; + 9A28480E2666AB3000EC1F6D /* Updater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2848072666AB3000EC1F6D /* Updater.swift */; }; 9A28481E2666AB3600EC1F6D /* extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A28481A2666AB3500EC1F6D /* extensions.swift */; }; 9A28481F2666AB3600EC1F6D /* constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A28481B2666AB3500EC1F6D /* constants.swift */; }; 9A2848202666AB3600EC1F6D /* types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A28481C2666AB3500EC1F6D /* types.swift */; }; @@ -54,6 +52,12 @@ 9A3E17D9247A94B500449CD1 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3E17D8247A94B500449CD1 /* main.swift */; }; 9A3E17DB247A94BC00449CD1 /* readers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3E17DA247A94BC00449CD1 /* readers.swift */; }; 9A3E17EA247B07BF00449CD1 /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3E17E9247B07BF00449CD1 /* popup.swift */; }; + 9A46BF36266D6E17001A1117 /* i18n.py in Resources */ = {isa = PBXBuildFile; fileRef = 9A46BF35266D6E17001A1117 /* i18n.py */; }; + 9A46BF8A266D7D00001A1117 /* smc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9ADE6FD8265D032100D2FBA8 /* smc */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 9A46C047266D85DE001A1117 /* smc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADE7038265D059000D2FBA8 /* smc.swift */; }; + 9A46C05F266D85F8001A1117 /* smc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADE7038265D059000D2FBA8 /* smc.swift */; }; + 9A46C06B266D8602001A1117 /* smc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADE7038265D059000D2FBA8 /* smc.swift */; }; + 9A46C077266D8606001A1117 /* smc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADE7038265D059000D2FBA8 /* smc.swift */; }; 9A53EBF924EAFA5200648841 /* settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A53EBF824EAFA5200648841 /* settings.swift */; }; 9A53EBFB24EB041E00648841 /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A53EBFA24EB041E00648841 /* popup.swift */; }; 9A58DE9E24B363D800716A9F /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A58DE9D24B363D800716A9F /* popup.swift */; }; @@ -109,7 +113,6 @@ 9ADE6FDB265D032100D2FBA8 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADE6FDA265D032100D2FBA8 /* main.swift */; }; 9ADE702B265D03D100D2FBA8 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9ADE7005265D039300D2FBA8 /* IOKit.framework */; }; 9ADE7039265D059000D2FBA8 /* smc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADE7038265D059000D2FBA8 /* smc.swift */; }; - 9ADE7053265D542C00D2FBA8 /* types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ADE7052265D542C00D2FBA8 /* types.swift */; }; 9AE29ADC249A50350071B02D /* Sensors.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AE29AD5249A50350071B02D /* Sensors.framework */; }; 9AE29ADD249A50350071B02D /* Sensors.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9AE29AD5249A50350071B02D /* Sensors.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9AE29AF3249A51D70071B02D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AE29AF1249A50CD0071B02D /* main.swift */; }; @@ -245,13 +248,13 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 9A2843E42666959600EC1F6D /* CopyFiles */ = { + 9A46BF89266D7CFA001A1117 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 7; files = ( - 9A2843E52666959B00EC1F6D /* smc in CopyFiles */, + 9A46BF8A266D7D00001A1117 /* smc in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -333,8 +336,7 @@ 9A2848022666AB2F00EC1F6D /* Store.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Store.swift; sourceTree = ""; }; 9A2848032666AB2F00EC1F6D /* SystemKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemKit.swift; sourceTree = ""; }; 9A2848042666AB2F00EC1F6D /* Charts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Charts.swift; sourceTree = ""; }; - 9A2848052666AB3000EC1F6D /* SMC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SMC.swift; sourceTree = ""; }; - 9A2848072666AB3000EC1F6D /* updater.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = updater.swift; sourceTree = ""; }; + 9A2848072666AB3000EC1F6D /* Updater.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Updater.swift; sourceTree = ""; }; 9A28481A2666AB3500EC1F6D /* extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = extensions.swift; sourceTree = ""; }; 9A28481B2666AB3500EC1F6D /* constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = constants.swift; sourceTree = ""; }; 9A28481C2666AB3500EC1F6D /* types.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = types.swift; sourceTree = ""; }; @@ -352,6 +354,7 @@ 9A3E17DA247A94BC00449CD1 /* readers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = readers.swift; sourceTree = ""; }; 9A3E17DC247A94C300449CD1 /* config.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = config.plist; sourceTree = ""; }; 9A3E17E9247B07BF00449CD1 /* popup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = popup.swift; sourceTree = ""; }; + 9A46BF35266D6E17001A1117 /* i18n.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = i18n.py; sourceTree = ""; }; 9A49EC7B261CDF3E0055267E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; 9A520DF624FBF01F00133EC6 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = ""; }; 9A53EBF824EAFA5200648841 /* settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settings.swift; sourceTree = ""; }; @@ -412,7 +415,6 @@ 9ADE6FDA265D032100D2FBA8 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; 9ADE7005265D039300D2FBA8 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 9ADE7038265D059000D2FBA8 /* smc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = smc.swift; sourceTree = ""; }; - 9ADE7052265D542C00D2FBA8 /* types.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = types.swift; sourceTree = ""; }; 9AE29AD5249A50350071B02D /* Sensors.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sensors.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9AE29AEC249A50960071B02D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = Info.plist; path = Modules/Sensors/Info.plist; sourceTree = SOURCE_ROOT; }; 9AE29AF1249A50CD0071B02D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = main.swift; path = Modules/Sensors/main.swift; sourceTree = SOURCE_ROOT; }; @@ -591,7 +593,7 @@ 9A2848642666ABA500EC1F6D /* Supporting Files */, 9A28498D2666AE3400EC1F6D /* module */, 9AA81547266A9ACA008C01D0 /* plugins */, - 9AA81548266A9AFE008C01D0 /* updater */, + 9A46BF1E266D6DD0001A1117 /* scripts */, 9A28481B2666AB3500EC1F6D /* constants.swift */, 9A28481A2666AB3500EC1F6D /* extensions.swift */, 9A28481D2666AB3600EC1F6D /* helpers.swift */, @@ -661,6 +663,15 @@ path = Net; sourceTree = ""; }; + 9A46BF1E266D6DD0001A1117 /* scripts */ = { + isa = PBXGroup; + children = ( + 9A2848012666AB2F00EC1F6D /* updater.sh */, + 9A46BF35266D6E17001A1117 /* i18n.py */, + ); + path = scripts; + sourceTree = ""; + }; 9A5B1CB3229E72A7008B9D3C /* Supporting Files */ = { isa = PBXGroup; children = ( @@ -750,23 +761,14 @@ 9AA81547266A9ACA008C01D0 /* plugins */ = { isa = PBXGroup; children = ( - 9A2848052666AB3000EC1F6D /* SMC.swift */, 9A2848022666AB2F00EC1F6D /* Store.swift */, 9A2848042666AB2F00EC1F6D /* Charts.swift */, 9A2848032666AB2F00EC1F6D /* SystemKit.swift */, + 9A2848072666AB3000EC1F6D /* Updater.swift */, ); path = plugins; sourceTree = ""; }; - 9AA81548266A9AFE008C01D0 /* updater */ = { - isa = PBXGroup; - children = ( - 9A2848012666AB2F00EC1F6D /* updater.sh */, - 9A2848072666AB3000EC1F6D /* updater.swift */, - ); - path = updater; - sourceTree = ""; - }; 9AB14B75248CEEC600DC6731 /* Modules */ = { isa = PBXGroup; children = ( @@ -800,7 +802,6 @@ children = ( 9ADE6FDA265D032100D2FBA8 /* main.swift */, 9ADE7038265D059000D2FBA8 /* smc.swift */, - 9ADE7052265D542C00D2FBA8 /* types.swift */, ); path = SMC; sourceTree = ""; @@ -914,7 +915,7 @@ 9A6698E72326AB16001D00E1 /* Embed Frameworks */, 9AECEF3D24ACF98800DB95D4 /* Copy Files */, 9A88E2672659002E00E2B7B0 /* ShellScript */, - 9A2843E42666959600EC1F6D /* CopyFiles */, + 9A46BF89266D7CFA001A1117 /* CopyFiles */, ); buildRules = ( ); @@ -1282,6 +1283,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9A46BF36266D6E17001A1117 /* i18n.py in Resources */, 9A2848892666AC0100EC1F6D /* Assets.xcassets in Resources */, 9A2848082666AB3000EC1F6D /* updater.sh in Resources */, ); @@ -1411,12 +1413,11 @@ 9A2848212666AB3600EC1F6D /* helpers.swift in Sources */, 9A28477A2666AA5000EC1F6D /* settings.swift in Sources */, 9A28475F2666AA2700EC1F6D /* LineChart.swift in Sources */, - 9A28480E2666AB3000EC1F6D /* updater.swift in Sources */, + 9A28480E2666AB3000EC1F6D /* Updater.swift in Sources */, 9A2847622666AA2700EC1F6D /* Label.swift in Sources */, 9A28477C2666AA5000EC1F6D /* reader.swift in Sources */, 9A2847652666AA2700EC1F6D /* Memory.swift in Sources */, 9A2847642666AA2700EC1F6D /* Battery.swift in Sources */, - 9A28480C2666AB3000EC1F6D /* SMC.swift in Sources */, 9A28480B2666AB3000EC1F6D /* Charts.swift in Sources */, 9A2847632666AA2700EC1F6D /* Mini.swift in Sources */, 9A2847602666AA2700EC1F6D /* NetworkChart.swift in Sources */, @@ -1460,6 +1461,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9A46C047266D85DE001A1117 /* smc.swift in Sources */, 9A8DE609253DF740006A748F /* readers.swift in Sources */, 9A8DE5E4253DF4E2006A748F /* main.swift in Sources */, 9A656562253F788A0096B607 /* popup.swift in Sources */, @@ -1471,6 +1473,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9A46C06B266D8602001A1117 /* smc.swift in Sources */, 9A90E1A324EAD66600471E9A /* reader.swift in Sources */, 9A90E19624EAD35F00471E9A /* main.swift in Sources */, 9A53EBFB24EB041E00648841 /* popup.swift in Sources */, @@ -1482,6 +1485,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9A46C077266D8606001A1117 /* smc.swift in Sources */, 9A97CEF1253733D200742D8F /* readers.swift in Sources */, 9A97CEF6253733E400742D8F /* popup.swift in Sources */, 9A97CEFB253733F300742D8F /* settings.swift in Sources */, @@ -1504,7 +1508,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9ADE7053265D542C00D2FBA8 /* types.swift in Sources */, 9ADE6FDB265D032100D2FBA8 /* main.swift in Sources */, 9ADE7039265D059000D2FBA8 /* smc.swift in Sources */, ); @@ -1514,6 +1517,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9A46C05F266D85F8001A1117 /* smc.swift in Sources */, 9AB6D03926447CAA003215A5 /* reader.m in Sources */, 9AE29AFB249A53DC0071B02D /* readers.swift in Sources */, 9AE29AFC249A53DC0071B02D /* values.swift in Sources */, @@ -1790,7 +1794,7 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "Stats/Supporting Files/Stats.entitlements"; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 180; @@ -1823,7 +1827,7 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "Stats/Supporting Files/Stats.entitlements"; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 180; @@ -1918,7 +1922,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = LaunchAtLogin/LaunchAtLogin.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_ASSET_PATHS = ""; @@ -1943,7 +1947,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = LaunchAtLogin/LaunchAtLogin.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_ASSET_PATHS = ""; @@ -2347,12 +2351,15 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_ENTITLEMENTS = ""; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = RP2S87B72W; ENABLE_HARDENED_RUNTIME = NO; INFOPLIST_FILE = "$(SRCROOT)/SMC/Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0.0; + OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats.SMC; PRODUCT_NAME = smc; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2365,12 +2372,15 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_ENTITLEMENTS = ""; - CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = RP2S87B72W; ENABLE_HARDENED_RUNTIME = NO; INFOPLIST_FILE = "$(SRCROOT)/SMC/Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0.0; + OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats.SMC; PRODUCT_NAME = smc; PROVISIONING_PROFILE_SPECIFIER = "";