diff --git a/WhateverGreen/kern_igfx.cpp b/WhateverGreen/kern_igfx.cpp index c2e172f8..3221c9d5 100755 --- a/WhateverGreen/kern_igfx.cpp +++ b/WhateverGreen/kern_igfx.cpp @@ -197,10 +197,10 @@ void IGFX::processKernel(KernelPatcher &patcher, DeviceInfo *info) { uint32_t forceOnline = 0; if (PE_parse_boot_argn("igfxonln", &forceOnline, sizeof(forceOnline))) { forceOnlineDisplay.enable = forceOnline != 0; - DBGLOG("weg", "force online display overriden by boot-argument %d", forceOnline); + DBGLOG("weg", "force online overriden by boot-argument %u", forceOnline); } else if (WIOKit::getOSDataValue(info->videoBuiltin, "force-online", forceOnline)) { forceOnlineDisplay.enable = forceOnline != 0; - DBGLOG("weg", "force online display overriden by device property %d", forceOnline); + DBGLOG("weg", "force online overriden by device property %u", forceOnline); } if (forceOnlineDisplay.enable) { @@ -823,17 +823,17 @@ IOReturn IGFX::wrapFBClientDoAttribute(void *fbclient, uint32_t attribute, unsig return FunctionCast(wrapFBClientDoAttribute, callbackIGFX->orgFBClientDoAttribute)(fbclient, attribute, unk1, unk2, unk3, unk4, externalMethodArguments); } -bool IGFX::wrapGetDisplayStatus(IOService *framebuffer, void *displayPath) { - bool ret = FunctionCast(wrapGetDisplayStatus, callbackIGFX->orgGetDisplayStatus)(framebuffer, displayPath); - if (ret) - return true; - - if (callbackIGFX->forceOnlineDisplay.customised) - ret = callbackIGFX->forceCompleteModeset.inList(framebuffer); - else - ret = true; +uint32_t IGFX::wrapGetDisplayStatus(IOService *framebuffer, void *displayPath) { + // 0 - offline, 1 - online, 2 - empty dongle. + uint32_t ret = FunctionCast(wrapGetDisplayStatus, callbackIGFX->orgGetDisplayStatus)(framebuffer, displayPath); + if (ret != 1) { + if (callbackIGFX->forceOnlineDisplay.customised) + ret = callbackIGFX->forceOnlineDisplay.inList(framebuffer) ? 1 : ret; + else + ret = 1; + } - DBGLOG("igfx", "getDisplayStatus forces %d", ret); + DBGLOG("igfx", "getDisplayStatus forces %u", ret); return ret; } diff --git a/WhateverGreen/kern_igfx.hpp b/WhateverGreen/kern_igfx.hpp index ad142021..5045bcd6 100755 --- a/WhateverGreen/kern_igfx.hpp +++ b/WhateverGreen/kern_igfx.hpp @@ -1365,7 +1365,7 @@ class IGFX { /** * AppleIntelFramebuffer::getDisplayStatus to force display status on configured screens. */ - static bool wrapGetDisplayStatus(IOService *framebuffer, void *displayPath); + static uint32_t wrapGetDisplayStatus(IOService *framebuffer, void *displayPath); /** * Load GuC-specific patches and hooks diff --git a/WhateverGreen/kern_igfx_debug.cpp b/WhateverGreen/kern_igfx_debug.cpp index 6261af95..6a59545b 100644 --- a/WhateverGreen/kern_igfx_debug.cpp +++ b/WhateverGreen/kern_igfx_debug.cpp @@ -128,12 +128,12 @@ static IOReturn fbdebugWrapConnectionProbe(IOService *framebuffer, uint8_t unk1, return ret; } -static bool fbdebugWrapGetDisplayStatus(IOService *framebuffer, void *displayPath) { +static uint32_t fbdebugWrapGetDisplayStatus(IOService *framebuffer, void *displayPath) { auto idxnum = OSDynamicCast(OSNumber, framebuffer->getProperty("IOFBDependentIndex")); int idx = (idxnum != nullptr) ? (int) idxnum->unsigned32BitValue() : -1; SYSLOG("igfx", "getDisplayStatus %d start", idx); - bool ret = FunctionCast(fbdebugWrapGetDisplayStatus, fbdebugOrgGetDisplayStatus)(framebuffer, displayPath); - SYSLOG("igfx", "getDisplayStatus %d end - %d", idx, ret); + uint32_t ret = FunctionCast(fbdebugWrapGetDisplayStatus, fbdebugOrgGetDisplayStatus)(framebuffer, displayPath); + SYSLOG("igfx", "getDisplayStatus %d end - %u", idx, ret); //FIXME: This is just a hack. SYSLOG("igfx", "[HACK] forcing STATUS 1"); ret = 1;