Skip to content

Commit

Permalink
OC Version UNK-000-0000-00-00 now detected as Clover
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaker76 committed Dec 18, 2021
1 parent 1af235c commit e5a15e4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Hackintool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0378;
CURRENT_PROJECT_VERSION = 0379;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -736,7 +736,7 @@
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MARKETING_VERSION = 3.7.8;
MARKETING_VERSION = 3.7.9;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -757,7 +757,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0378;
CURRENT_PROJECT_VERSION = 0379;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -772,7 +772,7 @@
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
MARKETING_VERSION = 3.7.8;
MARKETING_VERSION = 3.7.9;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions Hackintool/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -10938,8 +10938,8 @@ - (BOOL)createWindowsBluetoothRegistryFile
}
else
{
[self parseBluetoothLinkKeys:BluetoothPath1 outputString:outputString];
[self parseBluetoothLinkKeys:BluetoothPath2 outputString:outputString];
if (![self parseBluetoothLinkKeys:BluetoothPath1 outputString:outputString])
[self parseBluetoothLinkKeys:BluetoothPath2 outputString:outputString];
}

NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES);
Expand Down
40 changes: 27 additions & 13 deletions Hackintool/OpenCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,39 @@ + (bool)tryGetVersionInfo:(NSString **)bootedVersion
CFTypeRef property = nil;

// NPT-001-2019-05-03
if (getIORegProperty(@"IODeviceTree:/options", @"4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:opencore-version", &property))
if (!getIORegProperty(@"IODeviceTree:/options", @"4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:opencore-version", &property))
return false;

NSData *valueData = (__bridge NSData *)property;

if (valueData.length >= 18)
{
NSData *valueData = (__bridge NSData *)property;
NSString *valueString = [[[NSString alloc] initWithData:valueData encoding:NSASCIIStringEncoding] autorelease];

NSString *openCoreTarget = [valueString substringWithRange:NSMakeRange(0, 3)];
NSString *openCoreVersion = [valueString substringWithRange:NSMakeRange(4, 3)];
NSString *openCoreYear = [valueString substringWithRange:NSMakeRange(8, 4)];
NSString *openCoreMonth = [valueString substringWithRange:NSMakeRange(13, 2)];
NSString *openCoreDay = [valueString substringWithRange:NSMakeRange(16, 2)];

if (valueData.length >= 18)
*bootedVersion = [NSString stringWithFormat:@"%@.%@.%@", [openCoreVersion substringWithRange:NSMakeRange(0, 1)], [openCoreVersion substringWithRange:NSMakeRange(1, 1)], [openCoreVersion substringWithRange:NSMakeRange(2, 1)]];

if ([openCoreTarget isEqualToString:@"UNK"] &&
[openCoreVersion isEqualToString:@"000"] &&
[openCoreYear isEqualToString:@"0000"] &&
[openCoreMonth isEqualToString:@"00"] &&
[openCoreDay isEqualToString:@"00"])
{
// Clover injects UNK-000-0000-00-00
result = false;
}
else
{
NSString *valueString = [[[NSString alloc] initWithData:valueData encoding:NSASCIIStringEncoding] autorelease];
//NSString *openCoreTarget = [valueString substringWithRange:NSMakeRange(0, 3)];
NSString *openCoreVersion = [valueString substringWithRange:NSMakeRange(4, 3)];
//NSString *openCoreYear = [valueString substringWithRange:NSMakeRange(8, 4)];
//NSString *openCoreMonth = [valueString substringWithRange:NSMakeRange(13, 2)];
//NSString *openCoreDay = [valueString substringWithRange:NSMakeRange(16, 2)];
*bootedVersion = [NSString stringWithFormat:@"%@.%@.%@", [openCoreVersion substringWithRange:NSMakeRange(0, 1)], [openCoreVersion substringWithRange:NSMakeRange(1, 1)], [openCoreVersion substringWithRange:NSMakeRange(2, 1)]];

result = true;
}

CFRelease(property);
}

CFRelease(property);

return result;
}
Expand Down

0 comments on commit e5a15e4

Please sign in to comment.