Skip to content

Commit

Permalink
Initial MacKernelSDK and Xcode 12 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Sep 20, 2020
1 parent 65fc496 commit f31896e
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Tools/HookMac/libHookMac.dylib
Tools/WhateverName/WhateverName.app/Contents/MacOS/libWhateverName.dylib
.svace-dir
cov-int
/MacKernelSDK
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ matrix:
compiler: clang

script:
- git clone https://github.com/acidanthera/MacKernelSDK
- src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/bootstrap.sh) && eval "$src" || exit 1
- xcodebuild -configuration Debug
- xcodebuild -configuration Release
Expand All @@ -32,6 +33,7 @@ matrix:
compiler: clang

script:
- git clone https://github.com/acidanthera/MacKernelSDK
- src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/bootstrap.sh) && eval "$src" || exit 1
- xcodebuild analyze -quiet -scheme WhateverGreen -configuration Debug CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ]
- xcodebuild analyze -quiet -scheme WhateverGreen -configuration Release CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR="$(pwd)/clang-analyze" && [ "$(find clang-analyze -name "*.html")" = "" ]
Expand All @@ -42,6 +44,7 @@ matrix:
compiler: clang

before_install:
- git clone https://github.com/acidanthera/MacKernelSDK
- curl -Ls https://entrust.com/root-certificates/entrust_l1k.cer -o ~/entrust_l1k.crt || exit 1
- curl -LS https://curl.haxx.se/ca/cacert.pem -o ~/cacert.pem || exit 1
- cat ~/entrust_l1k.crt >> ~/cacert.pem || exit 1
Expand Down
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ WhateverGreen Changelog
=======================
#### v1.4.3
- Added CFL and CML P630
- Added MacKernelSDK with Xcode 12 compatibility
- Fixed loading on macOS 10.11 and earlier

#### v1.4.2
- Fixed `disable-external-gpu` (`-wegnoegpu`) on some systems
Expand Down
30 changes: 21 additions & 9 deletions WhateverGreen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
CE1970FF21C380DF00B02AB4 /* kern_nvhda.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE1970FD21C380DF00B02AB4 /* kern_nvhda.cpp */; };
CE19710021C380DF00B02AB4 /* kern_nvhda.hpp in Headers */ = {isa = PBXBuildFile; fileRef = CE1970FE21C380DF00B02AB4 /* kern_nvhda.hpp */; };
CE1F61B92432DEE800201DF4 /* kern_igfx_debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE1F61B82432DEE800201DF4 /* kern_igfx_debug.cpp */; };
CE405EC91E49DD9700AA0B3D /* libkmod.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CE405EC71E49DD7100AA0B3D /* libkmod.a */; };
CE405ED91E4A080700AA0B3D /* plugin_start.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE405ED81E4A080700AA0B3D /* plugin_start.cpp */; };
CE766ED6210763B200A84567 /* kern_guc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE766ED4210763B200A84567 /* kern_guc.cpp */; };
CE766ED7210763B200A84567 /* kern_guc.hpp in Headers */ = {isa = PBXBuildFile; fileRef = CE766ED5210763B200A84567 /* kern_guc.hpp */; };
Expand All @@ -29,6 +28,7 @@
CE7FC0CA20F682A300138088 /* kern_resources.hpp in Headers */ = {isa = PBXBuildFile; fileRef = CE7FC0C820F682A200138088 /* kern_resources.hpp */; };
CE7FC0CB20F682A300138088 /* kern_resources.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE7FC0C920F682A200138088 /* kern_resources.cpp */; };
CE8190A21F1E3ECE00DE95F4 /* kern_model.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE8190A11F1E3ECE00DE95F4 /* kern_model.cpp */; };
CE8DA0832517C41A008C44E8 /* libkmod.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CE8DA0822517C41A008C44E8 /* libkmod.a */; };
CEA03B5E20EE825A00BA842F /* kern_weg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEA03B5C20EE825A00BA842F /* kern_weg.cpp */; };
CEA03B5F20EE825A00BA842F /* kern_weg.hpp in Headers */ = {isa = PBXBuildFile; fileRef = CEA03B5D20EE825A00BA842F /* kern_weg.hpp */; };
CEB402A61F17F5C400716912 /* kern_con.hpp in Headers */ = {isa = PBXBuildFile; fileRef = CEB402A41F17F5C400716912 /* kern_con.hpp */; };
Expand Down Expand Up @@ -94,8 +94,6 @@
CE405EC01E49DD7100AA0B3D /* kern_policy.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = kern_policy.hpp; sourceTree = "<group>"; };
CE405EC31E49DD7100AA0B3D /* kern_user.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = kern_user.hpp; sourceTree = "<group>"; };
CE405EC41E49DD7100AA0B3D /* kern_util.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = kern_util.hpp; sourceTree = "<group>"; };
CE405EC61E49DD7100AA0B3D /* LegacyIOService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LegacyIOService.h; sourceTree = "<group>"; };
CE405EC71E49DD7100AA0B3D /* libkmod.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libkmod.a; sourceTree = "<group>"; };
CE405ECF1E49EC9100AA0B3D /* kern_config.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = kern_config.hpp; sourceTree = "<group>"; };
CE405ED21E49F9FC00AA0B3D /* kern_api.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = kern_api.hpp; sourceTree = "<group>"; };
CE405ED81E4A080700AA0B3D /* plugin_start.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = plugin_start.cpp; sourceTree = "<group>"; };
Expand All @@ -120,6 +118,7 @@
CE7FC0CF20F6882400138088 /* FAQ.Shiki.ru.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = FAQ.Shiki.ru.md; sourceTree = "<group>"; };
CE7FC0D020F6882400138088 /* FAQ.Shiki.zh_CN.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = FAQ.Shiki.zh_CN.md; sourceTree = "<group>"; };
CE8190A11F1E3ECE00DE95F4 /* kern_model.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = kern_model.cpp; sourceTree = "<group>"; };
CE8DA0822517C41A008C44E8 /* libkmod.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libkmod.a; path = ../Lilu/MacKernelSDK/Library/x86_64/libkmod.a; sourceTree = "<group>"; };
CEA03B5C20EE825A00BA842F /* kern_weg.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = kern_weg.cpp; sourceTree = "<group>"; };
CEA03B5D20EE825A00BA842F /* kern_weg.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = kern_weg.hpp; sourceTree = "<group>"; };
CEAEA1171F26905A00918651 /* FAQ.Radeon.en.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = FAQ.Radeon.en.md; sourceTree = "<group>"; };
Expand All @@ -140,7 +139,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CE405EC91E49DD9700AA0B3D /* libkmod.a in Frameworks */,
CE8DA0832517C41A008C44E8 /* libkmod.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -163,6 +162,7 @@
CE7FC0B620F681D600138088 /* ResourceConverter */,
CE405EC81E49DD7B00AA0B3D /* SDK */,
1C748C281C21952C0024EED2 /* Products */,
CE8DA0812517C41A008C44E8 /* Frameworks */,
);
sourceTree = "<group>";
usesTabs = 1;
Expand Down Expand Up @@ -247,8 +247,6 @@
CE405EC51E49DD7100AA0B3D /* Library */ = {
isa = PBXGroup;
children = (
CE405EC61E49DD7100AA0B3D /* LegacyIOService.h */,
CE405EC71E49DD7100AA0B3D /* libkmod.a */,
CE405ED81E4A080700AA0B3D /* plugin_start.cpp */,
);
name = Library;
Expand Down Expand Up @@ -281,6 +279,14 @@
path = Resources;
sourceTree = "<group>";
};
CE8DA0812517C41A008C44E8 /* Frameworks */ = {
isa = PBXGroup;
children = (
CE8DA0822517C41A008C44E8 /* libkmod.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
CEAEA1151F26905A00918651 /* Manual */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -517,6 +523,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
KERNEL_EXTENSION_HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/MacKernelSDK/Headers";
KERNEL_FRAMEWORK_HEADERS = "$(PROJECT_DIR)/MacKernelSDK/Headers";
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
Expand Down Expand Up @@ -562,6 +570,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
KERNEL_EXTENSION_HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/MacKernelSDK/Headers";
KERNEL_FRAMEWORK_HEADERS = "$(PROJECT_DIR)/MacKernelSDK/Headers";
SDKROOT = macosx;
};
name = Release;
Expand All @@ -586,7 +596,7 @@
INFOPLIST_FILE = WhateverGreen/Info.plist;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Lilu.kext/Contents/Resources/Library",
"$(PROJECT_DIR)/MacKernelSDK/Library/x86_64",
);
MACOSX_DEPLOYMENT_TARGET = 10.8;
MODULE_NAME = as.vit9696.WhateverGreen;
Expand Down Expand Up @@ -633,7 +643,7 @@
INFOPLIST_FILE = WhateverGreen/Info.plist;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Lilu.kext/Contents/Resources/Library",
"$(PROJECT_DIR)/MacKernelSDK/Library/x86_64",
);
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
Expand Down Expand Up @@ -744,6 +754,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
KERNEL_EXTENSION_HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/MacKernelSDK/Headers";
KERNEL_FRAMEWORK_HEADERS = "$(PROJECT_DIR)/MacKernelSDK/Headers";
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
Expand All @@ -769,7 +781,7 @@
INFOPLIST_FILE = WhateverGreen/Info.plist;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Lilu.kext/Contents/Resources/Library",
"$(PROJECT_DIR)/MacKernelSDK/Library/x86_64",
);
MACOSX_DEPLOYMENT_TARGET = 10.8;
MODULE_NAME = as.vit9696.WhateverGreen;
Expand Down
2 changes: 1 addition & 1 deletion WhateverGreen/kern_igfx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Headers/kern_patcher.hpp>
#include <Headers/kern_devinfo.hpp>
#include <Headers/kern_cpu.hpp>
#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>
#include <IOKit/IOLocks.h>

class IGFX {
Expand Down
2 changes: 1 addition & 1 deletion WhateverGreen/kern_igfx_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <Headers/kern_patcher.hpp>
#include <Headers/kern_devinfo.hpp>
#include <Headers/kern_cpu.hpp>
#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>
#include <IOKit/graphics/IOFramebuffer.h>
#include "kern_agdc.hpp"
#include "kern_igfx.hpp"
Expand Down
2 changes: 1 addition & 1 deletion WhateverGreen/kern_igfx_pm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* IN THE SOFTWARE.
*/

#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>
#include <Headers/kern_patcher.hpp>
#include <Headers/kern_devinfo.hpp>
#include <Headers/kern_cpu.hpp>
Expand Down
4 changes: 2 additions & 2 deletions WhateverGreen/kern_ngfx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#ifndef kern_ngfx_hpp
#define kern_ngfx_hpp

#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>

#include <Headers/kern_patcher.hpp>
#include <Headers/kern_devinfo.hpp>
#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>

// Assembly exports for restoreLegacyOptimisations
extern "C" bool wrapVaddrPreSubmitTrampoline(void *that);
Expand Down
3 changes: 0 additions & 3 deletions WhateverGreen/kern_nvhda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

#include <Headers/kern_util.hpp>
#include <libkern/libkern.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
#include <IOKit/pci/IOPCIDevice.h>
#pragma clang diagnostic pop
#include <IOKit/IODeviceTreeSupport.h>

// Workaround for systems with BIOSes that default-disable the HD Audio function on their NVIDIA GPUs.
Expand Down
2 changes: 1 addition & 1 deletion WhateverGreen/kern_nvhda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define kern_nvhda_hpp

#include <Headers/kern_util.hpp>
#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>

class EXPORT NVHDAEnabler : public IOService {
OSDeclareDefaultStructors(NVHDAEnabler);
Expand Down
2 changes: 1 addition & 1 deletion WhateverGreen/kern_rad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <Headers/kern_api.hpp>
#include <Headers/kern_iokit.hpp>
#include <Headers/kern_devinfo.hpp>
#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>

#include <Availability.h>
#include <IOKit/IOPlatformExpert.h>
Expand Down
2 changes: 1 addition & 1 deletion WhateverGreen/kern_rad.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <Headers/kern_patcher.hpp>
#include <Headers/kern_devinfo.hpp>
#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>
#include "kern_agdc.hpp"
#include "kern_atom.hpp"
#include "kern_con.hpp"
Expand Down
2 changes: 1 addition & 1 deletion WhateverGreen/kern_shiki.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "kern_shiki.hpp"

#include <Library/LegacyIOService.h>
#include <IOKit/IOService.h>
#include <Headers/plugin_start.hpp>
#include <Headers/kern_api.hpp>
#include <Headers/kern_cpu.hpp>
Expand Down
8 changes: 0 additions & 8 deletions WhateverGreen/kern_weg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,12 @@
#include <Headers/kern_cpu.hpp>
#include "kern_weg.hpp"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winconsistent-missing-override"
#include <IOKit/graphics/IOFramebuffer.h>
#pragma clang diagnostic pop

// This is a hack to let us access protected properties.
struct FramebufferViewer : public IOFramebuffer {
static IOMemoryMap *&getVramMap(IOFramebuffer *fb) {
// This is a hack to fix old Xcode compilation.
#ifdef __MAC_10_13
return static_cast<FramebufferViewer *>(fb)->fVramMap;
#else
return static_cast<FramebufferViewer *>(fb)->vramMap;
#endif
}
};

Expand Down

0 comments on commit f31896e

Please sign in to comment.