Try to fix gpu_apple

#222
This commit is contained in:
Linus Dierheimer
2022-09-07 06:37:35 -07:00
parent 8be4921bd0
commit 47d1f2e673
2 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/env sh
#!/usr/bin/env sh
# make the script exit if any of the commands fail,
# making fastfetch not run if the build failed.
+7 -5
View File
@@ -14,10 +14,10 @@ void ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
FF_LIBRARY_LOAD_SYMBOL(iokit, IOServiceMatching, )
FF_LIBRARY_LOAD_SYMBOL(iokit, IOServiceGetMatchingServices, )
FF_LIBRARY_LOAD_SYMBOL(iokit, kIOMasterPortDefault, )
FF_LIBRARY_LOAD_SYMBOL(iokit, IOIteratorNext, )
FF_LIBRARY_LOAD_SYMBOL(iokit, IORegistryEntryCreateCFProperties, )
FF_LIBRARY_LOAD_SYMBOL(iokit, kCFAllocatorDefault, )
FF_LIBRARY_LOAD_SYMBOL(iokit, kCFAllocatorNull, )
FF_LIBRARY_LOAD_SYMBOL(iokit, CFDictionaryGetValue, )
FF_LIBRARY_LOAD_SYMBOL(iokit, CFGetTypeID, )
FF_LIBRARY_LOAD_SYMBOL(iokit, CFStringCreateWithCStringNoCopy, )
@@ -29,7 +29,7 @@ void ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
CFMutableDictionaryRef matchDict = ffIOServiceMatching(kIOAcceleratorClassName);
io_iterator_t iterator;
if(ffIOServiceGetMatchingServices(*ffkIOMasterPortDefault, matchDict, &iterator) != kIOReturnSuccess)
if(ffIOServiceGetMatchingServices(0, matchDict, &iterator) != kIOReturnSuccess)
{
dlclose(iokit);
return;
@@ -45,7 +45,7 @@ void ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
continue;
}
CFStringRef key = ffCFStringCreateWithCStringNoCopy(NULL, "model", kCFStringEncodingUTF8, NULL);
CFStringRef key = ffCFStringCreateWithCStringNoCopy(NULL, "model", kCFStringEncodingUTF8, *ffkCFAllocatorNull);
CFStringRef model = ffCFDictionaryGetValue(properties, key);
if(model == NULL || ffCFGetTypeID(model) != ffCFDataGetTypeID())
{
@@ -56,8 +56,10 @@ void ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
FFGPUResult* gpu = ffListAdd(gpus);
ffStrbufInitA(&gpu->name, (uint32_t) (ffCFStringGetLength(model) + 1));
ffCFStringGetCString(model, gpu->name.chars, ffStrbufGetFree(&gpu->name), kCFStringEncodingUTF8);
uint32_t modelLength = (uint32_t) ffCFStringGetLength(model);
ffStrbufInitA(&gpu->name, modelLength + 1);
ffCFStringGetCString(model, gpu->name.chars, modelLength + 1, kCFStringEncodingUTF8);
gpu->name.chars[modelLength] = '\0';
ffStrbufInitA(&gpu->vendor, 0);
ffStrbufInitA(&gpu->driver, 0);