This repository has been archived by the owner on Apr 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPatchSkyLight.zsh
163 lines (139 loc) · 3.71 KB
/
PatchSkyLight.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/zsh
clear
echo "#############\n# Build For #\n#############"
select opt in "Big Sur" "Monterey"; do
case $opt in
"Big Sur")
version="RamDisk_BS"
OS="11"
break
;;
"Monterey")
version="RamDisk_Monterey"
OS="12"
break
;;
"Exit")
exit
;;
*)
echo "This is not an option, please try again"
;;
esac
done
clear
echo "####################\n# SkyLight Flavors #\n####################"
select opt in "SkyLight Pro" "SkyLite" "SkyLight"; do
case $opt in
"SkyLight Pro")
cursor="# spin cursor hack
# TODO: proper fix
#symbol _CGXHWCursorIsAllowed
#return 0x0"
backdrop="# WSBackdropGetCorrectedColor remove 0x17 (MenuBarDark) material background
#set 0x26ef70
#write 0x00000000000000000000000000000000"
break
;;
"SkyLite")
cursor="# spin cursor hack
# TODO: proper fix
#symbol _CGXHWCursorIsAllowed
#return 0x0"
backdrop="# WSBackdropGetCorrectedColor remove 0x17 (MenuBarDark) material background
set 0x26ef70
write 0x00000000000000000000000000000000"
break
;;
"SkyLight")
cursor="# spin cursor hack
# TODO: proper fix
symbol _CGXHWCursorIsAllowed
return 0x0"
backdrop="# WSBackdropGetCorrectedColor remove 0x17 (MenuBarDark) material background
set 0x26ef70
write 0x00000000000000000000000000000000"
break
;;
"Exit")
exit
;;
*)
echo "This is not an option, please try again"
;;
esac
done
lipo -thin x86_64 "./SkyLight" -output "./SkyLightPatched"
./Renamer "SkyLightPatched" "SkyLightPatched" _SLSNewWindowWithOpaqueShape _SLSSetMenuBars _SLSCopyDevicesDictionary _SLSCopyCoordinatedDistributedNotificationContinuationBlock _SLSShapeWindowInWindowCoordinates _SLSEventTapCreate _SLSWindowSetShadowProperties
./Binpatcher "SkyLightPatched" "SkyLightPatched" "
# the transparency hack
set 0x216c60
nop 0x4
$cursor
# menubar height (22.0 --> 24.0)
set 0xb949c
write 0x38
$backdrop
# force 0x17 for light, inactive
set 0xb6db6
write 0x17
set 0xb6da3
write 0x17
set 0xb6db0
write 0x17
# override blend mode
# 0: works
# 1: invisible light
# 2: invisible dark
# 3+: corrupt
set 0xb6e4a
write 0x00
set +0x3
nop 0x4
# hide backstop (Mojave Shadows)
# TODO: weird
set 0xb88b6
nop 0x2
set 0xb8861
nop 0x2
set 0xb8877
nop 0x8
# prevent prefpane crash
# TODO: shim SLSInstallRemoteContextNotificationHandlerV2 instead
symbol ___SLSRemoveRemoteContextNotificationHandler_block_invoke
return 0x0"
if test -e "$code/Stuff/anti-thing.txt"
then
./Binpatcher "SkyLight" "SkyLight" "$(cat "$code/Stuff/anti-thing.txt")"
fi
################
## Build Wrappers
##################
set -e
folderOut="Wrapped"
rm -rf "$folderOut"
mkdir "$folderOut"
function build
{
oldIn="$1"
newIn="$2"
mainInstall="$3"
prefixOut="Wrapped/$4"
mkdir -p "$prefixOut"
name="$(basename "$mainInstall")"
mainNameOut="$name"
oldNameOut="${name}Old.dylib"
prefixInstall="$(dirname "$mainInstall")"
oldInstall="$prefixInstall/$oldNameOut"
mainOut="$prefixOut/$mainNameOut"
oldOut="$prefixOut/$oldNameOut"
cp "$oldIn" "$oldOut"
install_name_tool -id "$oldInstall" "$oldOut"
mainIn="$prefixOut/${name}Wrapper.m"
shimsIn="$PWD/Shims"
./Stubber "$oldIn" "$newIn" "$shimsIn" "$mainIn"
clang -fmodules -I "./Utils" -Wno-unused-getter-return-value -Wno-objc-missing-super-calls -mmacosx-version-min="$OS" -DMAJOR="$OS" -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 -install_name "$mainInstall" -Xlinker -reexport_library "$oldOut" -I "$PWD/Shims" "$mainIn" -o "$mainOut" "${@:5}"
codesign -f -s - "$oldOut"
codesign -f -s - "$mainOut"
}
build "SkyLightPatched" "./$version/SkyLight" "/System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/SkyLight" "Common" -F "/System/Library/PrivateFrameworks" -framework AppleSystemInfo -framework CoreBrightness