Skip to content

Commit

Permalink
Add fake IGPU if not present
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaker76 committed Apr 19, 2020
1 parent f35d38f commit 5b1fd70
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 22 deletions.
8 changes: 4 additions & 4 deletions Hackintool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0338;
CURRENT_PROJECT_VERSION = 0339;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = NO;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -728,7 +728,7 @@
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
MARKETING_VERSION = 3.3.8;
MARKETING_VERSION = 3.3.9;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -748,7 +748,7 @@
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0338;
CURRENT_PROJECT_VERSION = 0339;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = NO;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -762,7 +762,7 @@
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
MARKETING_VERSION = 3.3.8;
MARKETING_VERSION = 3.3.9;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions Hackintool/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ typedef struct
- (bool)isConnectorHeadless;
- (NSString *)getIORegName:(NSString *)ioregName;
- (bool)tryGetACPIPath:(NSString *)ioregName acpiPath:(NSString **)acpiPath;
- (void)getGPUDeviceDictionary:(NSMutableDictionary **)pciDeviceDictionary;
- (bool)tryGetPCIDeviceDictionaryFromIORegName:(NSString *)name pciDeviceDictionary:(NSMutableDictionary **)pciDeviceDictionary;
- (bool)tryGetPCIDeviceDictionaryFromClassCode:(NSNumber *)code pciDeviceDictionary:(NSMutableDictionary **)pciDeviceDictionary;
- (bool)tryGetAudioController:(NSNumber *)deviceID vendorID:(NSNumber *)vendorID audioDevice:(AudioDevice *)foundAudioDevice;
Expand Down
43 changes: 40 additions & 3 deletions Hackintool/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,41 @@ - (NSString *)getIORegName:(NSString *)ioregName
return ioregName;
}

- (void)getFakeGPUDeviceDictionary:(NSMutableDictionary **)pciDeviceDictionary
{
*pciDeviceDictionary = [NSMutableDictionary dictionary];

[*pciDeviceDictionary setObject:@"Disabled" forKey:@"ASPM"];
[*pciDeviceDictionary setObject:@(0x20000) forKey:@"Address"];
[*pciDeviceDictionary setObject:@"com.apple.driver.AppleIntelCFLGraphicsFramebuffer" forKey:@"BundleID"];
[*pciDeviceDictionary setObject:@(0x30000) forKey:@"ClassCode"];
[*pciDeviceDictionary setObject:@"Display controller" forKey:@"ClassName"];
[*pciDeviceDictionary setObject:@(0x0000) forKey:@"DeviceID"];
[*pciDeviceDictionary setObject:@"Intel Graphics (Unknown)" forKey:@"DeviceName"];
[*pciDeviceDictionary setObject:@"PciRoot(0x0)/Pci(0x2,0x0)" forKey:@"DevicePath"];
[*pciDeviceDictionary setObject:@"display" forKey:@"IORegIOName"];
[*pciDeviceDictionary setObject:@"/PCI0@0/IGPU@2" forKey:@"IORegName"];
[*pciDeviceDictionary setObject:@"IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/IGPU@2" forKey:@"IORegPath"];
[*pciDeviceDictionary setObject:@"Intel Graphics (Unknown)" forKey:@"Model"];
[*pciDeviceDictionary setObject:@"00:02.0" forKey:@"PCIDebug"];
[*pciDeviceDictionary setObject:@(0x0000) forKey:@"ShadowDevice"];
[*pciDeviceDictionary setObject:@(0x8086) forKey:@"ShadowVendor"];
[*pciDeviceDictionary setObject:@"Internal@0,2,0" forKey:@"SlotName"];
[*pciDeviceDictionary setObject:@"VGA compatible controller" forKey:@"SubClassName"];
[*pciDeviceDictionary setObject:@(0x0000) forKey:@"SubDeviceID"];
[*pciDeviceDictionary setObject:@(0x0000) forKey:@"SubVendorID"];
[*pciDeviceDictionary setObject:@(0x8086) forKey:@"VendorID"];
[*pciDeviceDictionary setObject:@"Intel Corporation" forKey:@"VendorName"];
}

- (void)getGPUDeviceDictionary:(NSMutableDictionary **)pciDeviceDictionary
{
if ([self tryGetPCIDeviceDictionaryFromIORegName:@"IGPU" pciDeviceDictionary:pciDeviceDictionary])
return;

return [self getFakeGPUDeviceDictionary:pciDeviceDictionary];
}

- (bool)tryGetPCIDeviceDictionaryFromIORegName:(NSString *)name pciDeviceDictionary:(NSMutableDictionary **)pciDeviceDictionary
{
for (int i = 0; i < [_pciDevicesArray count]; i++)
Expand Down Expand Up @@ -5173,8 +5208,11 @@ - (void) populateFramebufferList
if (_macOS_10_13_6_MenuItem.state)
{
NSBundle *mainBundle = [NSBundle mainBundle];

_fileName = [mainBundle pathForResource:intelGenString ofType:@"bin" inDirectory:@"Framebuffer/macOS 10.13.6"];

if (intelGen > IGCoffeeLake)
_fileName = nil;
}
else if (_macOS_10_14_MenuItem.state)
{
Expand Down Expand Up @@ -8345,8 +8383,7 @@ - (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
NSMutableDictionary *propertyDictionary = ([self isBootloaderOpenCore] ? [OpenCore getDevicePropertiesDictionaryWith:configDictionary typeName:@"Add"] : [Clover getDevicesPropertiesDictionaryWith:configDictionary]);
NSMutableDictionary *pciDeviceDictionary;

if (![self tryGetPCIDeviceDictionaryFromIORegName:@"IGPU" pciDeviceDictionary:&pciDeviceDictionary])
return NO;
[self getGPUDeviceDictionary:&pciDeviceDictionary];

NSString *devicePath = [pciDeviceDictionary objectForKey:@"DevicePath"];
NSMutableDictionary *gpuProperties = [propertyDictionary objectForKey:devicePath];
Expand Down
3 changes: 1 addition & 2 deletions Hackintool/FBUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,7 @@ void getIGPUProperties(AppDelegate *appDelegate, NSMutableDictionary *configDict
NSMutableDictionary *devicesPropertiesDictionary = ([appDelegate isBootloaderOpenCore] ? [OpenCore getDevicePropertiesDictionaryWith:configDictionary typeName:@"Add"] : [Clover getDevicesPropertiesDictionaryWith:configDictionary]);
NSMutableDictionary *pciDeviceDictionary;

if (![appDelegate tryGetPCIDeviceDictionaryFromIORegName:@"IGPU" pciDeviceDictionary:&pciDeviceDictionary])
return;
[appDelegate getGPUDeviceDictionary:&pciDeviceDictionary];

NSString *deviceName = [pciDeviceDictionary objectForKey:@"DeviceName"];
NSString *className = [pciDeviceDictionary objectForKey:@"ClassName"];
Expand Down
20 changes: 9 additions & 11 deletions Hackintool/FBUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,17 @@ void injectUseIntelHDMI(AppDelegate *appDelegate, NSMutableDictionary *configDic
Settings settings = [appDelegate settings];

NSMutableDictionary *devicesPropertiesDictionary = ([appDelegate isBootloaderOpenCore] ? [OpenCore getDevicePropertiesDictionaryWith:configDictionary typeName:@"Add"] : [Clover getDevicesPropertiesDictionaryWith:configDictionary]);

NSMutableDictionary *igpuDeviceDictionary;

if ([appDelegate tryGetPCIDeviceDictionaryFromIORegName:@"IGPU" pciDeviceDictionary:&igpuDeviceDictionary])
{
NSString *devicePath = [igpuDeviceDictionary objectForKey:@"DevicePath"];
NSMutableDictionary *deviceDictionary = [devicesPropertiesDictionary objectForKey:devicePath];

if (settings.UseIntelHDMI)
[deviceDictionary setObject:@"onboard-1" forKey:@"hda-gfx"];
else if ([appDelegate hasGFX0])
[deviceDictionary setObject:@"onboard-2" forKey:@"hda-gfx"];
}
[appDelegate getGPUDeviceDictionary:&igpuDeviceDictionary];

NSString *devicePath = [igpuDeviceDictionary objectForKey:@"DevicePath"];
NSMutableDictionary *deviceDictionary = [devicesPropertiesDictionary objectForKey:devicePath];

if (settings.UseIntelHDMI)
[deviceDictionary setObject:@"onboard-1" forKey:@"hda-gfx"];
else if ([appDelegate hasGFX0])
[deviceDictionary setObject:@"onboard-2" forKey:@"hda-gfx"];

NSMutableDictionary *hdefDeviceDictionary;

Expand Down
2 changes: 1 addition & 1 deletion Resources/Framebuffer/macOS 10.13.6/PlatformIDs.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>Cannon Lake</key>
<string>0x5A510009 0x5A400009 0x5A410009 0x5A590009 0x5A490009 0x5A500009 0x5A510000 0x5A400000 0x5A410000 0x5A590000 0x5A490000 0x5A500000 0x5A520000 0x0A010000</string>
<key>Ice Lake (LP)</key>
<string>0xFF050000 0x8A700000 0x8A510000 0x8A5C0000 0x8A5D0000 0x8A520000 0x8A5A0000 0x8A5B0000</string>
<string>0xFF058086 0x8A708086 0x8A518086 0x8A5C8086 0x8A5D8086 0x8A528086 0x8A5A8086 0x8A5B8086</string>
<key>Ice Lake (HP)</key>
<string>0xFF050000 0x8A510000 0x8A520000</string>
<key>Tiger Lake</key>
Expand Down
2 changes: 1 addition & 1 deletion Resources/Framebuffer/macOS 10.14/PlatformIDs.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>Cannon Lake</key>
<string></string>
<key>Ice Lake (LP)</key>
<string></string>
<string>0xFF058086 0x8A708086 0x8A718086 0x8A518086 0x8A5C8086 0x8A5D8086 0x8A528086 0x8A538086 0x8A5A8086 0x8A5B8086</string>
<key>Ice Lake (HP)</key>
<string></string>
<key>Tiger Lake</key>
Expand Down

0 comments on commit 5b1fd70

Please sign in to comment.