Skip to content

Commit

Permalink
V2.2: Support Lilu 1.2.0 and macOS High Sierra 10.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFireWolf committed Oct 14, 2017
1 parent 84f4b6e commit 0af4327
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 11 deletions.
18 changes: 15 additions & 3 deletions NightShiftUnlocker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
D51ED55F1ECDF7F10084868D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = FireWolf;
TargetAttributes = {
D51ED5671ECDF7F10084868D = {
Expand Down Expand Up @@ -231,19 +231,25 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -279,19 +285,25 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
6 changes: 3 additions & 3 deletions NightShiftUnlocker/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<string>2.2</string>
<key>CFBundleVersion</key>
<string>2.1</string>
<string>2.2</string>
<key>IOKitPersonalities</key>
<dict>
<key>science.firewolf.NightShiftUnlocker</key>
Expand All @@ -39,7 +39,7 @@
<key>OSBundleLibraries</key>
<dict>
<key>as.vit9696.Lilu</key>
<string>1.1.5</string>
<string>1.2.0</string>
<key>com.apple.kpi.bsd</key>
<string>16.6</string>
<key>com.apple.kpi.dsep</key>
Expand Down
21 changes: 17 additions & 4 deletions NightShiftUnlocker/kern_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ static uint8_t* readBytes(const char* fromPath, off_t atOffset, size_t numBytes)
return buffer;
}

static void lmemcpy(void* dst, const void* src, size_t length)
{
for (int index = 0; index < length; index++)
{
((uint8_t*) dst)[index] = ((uint8_t*) src)[index];
}
}

// MARK: Boot Arguments
static const char* bootArgDisable[] = {"-nsuoff"};

Expand All @@ -69,13 +77,15 @@ static const char* symbolAA = "_CBU_IsNightShiftSupported";

static const size_t numProcessesAA = 3;

using ProcFlags = UserPatcher::ProcInfo::ProcFlags;

static UserPatcher::ProcInfo processesAA[] =
{
{"/usr/libexec/corebrightnessd", 28, SectionActive},
{"/usr/libexec/corebrightnessd", 28, SectionActive, UserPatcher::ProcInfo::ProcFlags::MatchExact},

{"/System/Library/CoreServices/NotificationCenter.app/Contents/MacOS/NotificationCenter", 85, SectionActive},
{"/System/Library/CoreServices/NotificationCenter.app/Contents/MacOS/NotificationCenter", 85, SectionActive, UserPatcher::ProcInfo::ProcFlags::MatchExact},

{"/Applications/System Preferences.app/Contents/MacOS/System Preferences", 70, SectionActive}
{"/Applications/System Preferences.app/Contents/MacOS/System Preferences", 70, SectionActive, UserPatcher::ProcInfo::ProcFlags::MatchExact}
};

static const size_t numBytesBufferAA = 32;
Expand All @@ -84,6 +94,7 @@ static const size_t numBytesPatchAA = 5;

static uint8_t findBytesAA[numBytesBufferAA] = {};

// TODO: MORE TEST REQUIRED
static uint8_t replBytesAA[numBytesBufferAA] =
{
0x31, 0xC0, // xor eax, eax
Expand Down Expand Up @@ -258,6 +269,8 @@ PluginConfiguration ADDPR(config) =

parseModuleVersion(xStringify(MODULE_VERSION)),

LiluAPI::Requirements::AllowNormal,

bootArgDisable,

1,
Expand All @@ -270,7 +283,7 @@ PluginConfiguration ADDPR(config) =

1,

KernelVersion::Sierra,
KernelVersion::HighSierra,

KernelVersion::HighSierra,

Expand Down

0 comments on commit 0af4327

Please sign in to comment.