Add support for Apple Silicon

-Update classes to read correct Apple Silicon CPU sensor
-Update project to compile a Universal 2 binary. Upgraded Sparkle to 2.1.0 as that was the latest and supports ARM64.
-Add MacBookPro18,1 to Machines.plist
This commit is contained in:
Raafat Akkad
2022-04-05 20:41:55 +01:00
parent ad374ffb1d
commit 618c22ea89
291 changed files with 6800 additions and 663 deletions

View File

@ -29,6 +29,7 @@
#import <Security/AuthorizationTags.h>
#import <Sparkle/SUUpdater.h>
#import "SystemVersion.h"
#include "TargetConditionals.h"
@interface FanControl ()
+ (void)copyMachinesIfNecessary;
@ -150,7 +151,11 @@ NSUserDefaults *defaults;
@0, PREF_AC_SELECTION,
@0, PREF_CHARGING_SELECTION,
@0, PREF_MENU_DISPLAYMODE,
#if TARGET_CPU_ARM64
@"Tp0D",PREF_TEMPERATURE_SENSOR,
#else
@"TC0D",PREF_TEMPERATURE_SENSOR,
#endif
@0, PREF_NUMBEROF_LAUNCHES,
@NO,PREF_DONATIONMESSAGE_DISPLAY,
[NSArchiver archivedDataWithRootObject:[NSColor blackColor]],PREF_MENU_TEXTCOLOR,

View File

@ -22,6 +22,7 @@
*/
#import "smcWrapper.h"
#include "TargetConditionals.h"
#import <CommonCrypto/CommonDigest.h>
NSString * const smc_checksum=@"4fc00a0979970ee8b55f078a0c793c4d";
@ -70,7 +71,11 @@ NSArray *allSensors;
NSString *sensor = [[NSUserDefaults standardUserDefaults] objectForKey:PREF_TEMPERATURE_SENSOR];
SMCReadKey2((char*)[sensor UTF8String], &val,conn);
retValue = [self convertToNumber:val];
#if TARGET_CPU_ARM64
allSensors = [NSArray arrayWithObjects:@"Tp0D",@"Tp0P",nil];
#else
allSensors = [NSArray arrayWithObjects:@"TC0D",@"TC0P",@"TCAD",@"TC0H",@"TC0F",@"TCAH",@"TCBH",nil];
#endif
if (retValue<=0 || floor(retValue) == 129 ) { //workaround for some iMac Models
for (NSString *sensor in allSensors) {
SMCReadKey2((char*)[sensor UTF8String], &val,conn);