1- using Mono . Cecil ;
1+ using Microsoft . Win32 ;
2+ using Mono . Cecil ;
23using Mono . Cecil . Cil ;
34using System ;
45using System . Diagnostics ;
@@ -12,8 +13,13 @@ class Program
1213 {
1314 static void Main ( )
1415 {
15- Console . Title = "Overwolf patcher by Decode 1.1" ;
16-
16+ Console . Title = "Overwolf patcher by Decode 1.2" ;
17+
18+ const string outplayedId = "cghphpbjeabdkomiphingnegihoigeggcfphdofo" ;
19+
20+ string overwolfPath = "" ;
21+ string overwolfDataPath = "" ;
22+ string overwolfExtensionsPath = "" ;
1723 string overwolfCorePath = "" ;
1824 string overwolfCoreCUPath = "" ;
1925
@@ -44,10 +50,18 @@ static void Main()
4450 Environment . Exit ( 0 ) ;
4551 }
4652
53+ RegistryKey registryKey = Registry . LocalMachine ;
54+ registryKey = registryKey . OpenSubKey ( @"SOFTWARE\WOW6432Node\Overwolf" ) ;
55+ overwolfPath = registryKey . GetValue ( "InstallFolder" ) . ToString ( ) ;
56+
57+ registryKey = Registry . CurrentUser ;
58+ registryKey = registryKey . OpenSubKey ( @"Software\Overwolf\Overwolf" ) ;
59+ overwolfDataPath = registryKey . GetValue ( "UserDataFolder" ) . ToString ( ) ;
60+ overwolfExtensionsPath = overwolfDataPath + @"\Extensions\" ;
61+
4762
48- string winDir = Path . GetPathRoot ( Environment . SystemDirectory ) ;
4963 Console . WriteLine ( ) ;
50- string [ ] directories = Directory . GetDirectories ( winDir + "Program Files (x86) \\ Overwolf" ) ;
64+ string [ ] directories = Directory . GetDirectories ( overwolfPath ) ;
5165 foreach ( string dir in directories )
5266 {
5367 if ( File . Exists ( dir + "\\ OverWolf.Client.Core.dll" ) )
@@ -93,24 +107,25 @@ static void Main()
93107 {
94108 Console . WriteLine ( ) ;
95109 Console . WriteLine ( ) ;
96- Console . WriteLine ( "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" ) ;
97- Console . WriteLine ( "|| OverWolf.Client.Core.dll ||" ) ;
110+ Console . WriteLine ( "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" ) ;
111+ Console . WriteLine ( "|| OverWolf.Client.Core.dll ||" ) ;
112+ Console . WriteLine ( "|| ||" ) ;
98113 var resolver = new DefaultAssemblyResolver ( ) ;
99114 resolver . AddSearchDirectory ( Path . GetDirectoryName ( overwolfCorePath ) ) ;
100115 ReaderParameters reader = new ReaderParameters { AssemblyResolver = resolver , ReadWrite = true , ReadingMode = ReadingMode . Immediate , InMemory = true } ;
101116 AssemblyDefinition overwolfCore = AssemblyDefinition . ReadAssembly ( overwolfCorePath , reader ) ;
102117 TypeDefinition overwolfCoreWManager = overwolfCore . MainModule . GetType ( "OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper" ) ;
103118 if ( overwolfCoreWManager != null )
104119 {
105- Console . WriteLine ( "|| OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper type found! ||" ) ;
120+ Console . WriteLine ( "|| OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper type found! ||" ) ;
106121 MethodDefinition showInsiderBlockMessageMethod = overwolfCoreWManager . Methods . SingleOrDefault ( x => x . Name == "ShowInsiderBlockMessage" ) ;
107122 if ( showInsiderBlockMessageMethod != null )
108123 {
109- Console . WriteLine ( "|| -- ShowInsiderBlockMessage method found! ||" ) ;
124+ Console . WriteLine ( "|| -- ShowInsiderBlockMessage method found! ||" ) ;
110125 showInsiderBlockMessageMethod . Body . Instructions . Clear ( ) ;
111126 showInsiderBlockMessageMethod . Body . Instructions . Add ( Instruction . Create ( OpCodes . Ldc_I4_0 ) ) ;
112127 showInsiderBlockMessageMethod . Body . Instructions . Add ( Instruction . Create ( OpCodes . Ret ) ) ;
113- Console . WriteLine ( "|| ---- ShowInsiderBlockMessage method patched! ||" ) ;
128+ Console . WriteLine ( "|| ---- ShowInsiderBlockMessage method patched! ||" ) ;
114129
115130 TypeDefinition overwolfCoreIU = overwolfCore . MainModule . GetType ( "OverWolf.Client.Core.ODKv2.OverwolfInternalUtils" ) ;
116131 if ( overwolfCoreIU != null )
@@ -135,7 +150,7 @@ static void Main()
135150 File . Delete ( backupFilePath ) ;
136151 File . Copy ( overwolfCorePath , backupFilePath ) ;
137152 overwolfCore . Write ( overwolfCorePath ) ;
138- Console . WriteLine ( "|| ------ Patched successfully ||" ) ;
153+ Console . WriteLine ( "|| ------ Patched successfully ||" ) ;
139154 }
140155 catch ( System . UnauthorizedAccessException )
141156 {
@@ -156,7 +171,7 @@ static void Main()
156171 {
157172 Console . WriteLine ( "OverWolf.Client.Core.Managers.WindowsInsiderSupportHelper type not found!" ) ;
158173 }
159- Console . WriteLine ( "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" ) ;
174+ Console . WriteLine ( "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| " ) ;
160175 }
161176
162177 if ( File . Exists ( overwolfCoreCUPath ) )
@@ -165,6 +180,7 @@ static void Main()
165180 Console . WriteLine ( ) ;
166181 Console . WriteLine ( "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" ) ;
167182 Console . WriteLine ( "|| OverWolf.Client.CommonUtils.dll ||" ) ;
183+ Console . WriteLine ( "|| ||" ) ;
168184 var resolver = new DefaultAssemblyResolver ( ) ;
169185 resolver . AddSearchDirectory ( Path . GetDirectoryName ( overwolfCoreCUPath ) ) ;
170186 ReaderParameters reader = new ReaderParameters { AssemblyResolver = resolver , ReadWrite = true , ReadingMode = ReadingMode . Immediate , InMemory = true } ;
@@ -215,6 +231,33 @@ static void Main()
215231 Console . WriteLine ( "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" ) ;
216232 }
217233
234+ if ( Directory . Exists ( overwolfExtensionsPath + outplayedId ) )
235+ {
236+ Console . WriteLine ( ) ;
237+ Console . WriteLine ( ) ;
238+ Console . WriteLine ( "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" ) ;
239+ Console . WriteLine ( "|| Outplayed ||" ) ;
240+ Console . WriteLine ( "|| ||" ) ;
241+ string [ ] outplayedVersionsPath = Directory . GetDirectories ( overwolfExtensionsPath + outplayedId ) ;
242+ string outplayedPath = outplayedVersionsPath . LastOrDefault ( ) ;
243+ if ( String . IsNullOrEmpty ( outplayedPath ) == false )
244+ {
245+ string indexScripts = File . ReadAllText ( outplayedPath + "\\ indexScripts.js" ) ;
246+ indexScripts = indexScripts . Replace ( "null !== (e = null == t ? void 0 : t.includes(this._subscriptionPlan)) && void 0 !== e && e" , "true" ) ; // Делает "premium"
247+ indexScripts = indexScripts . Replace ( "className: \" app-aside\" " , "className: \" app-aside1\" " ) ; // Удаляет на главной странице пустое место от рекламы
248+ File . WriteAllText ( outplayedPath + "\\ indexScripts.js" , indexScripts ) ;
249+ Console . WriteLine ( "|| -- [indexScripts.js] Patched successfully ||" ) ;
250+
251+ string backgroundScripts = File . ReadAllText ( outplayedPath + "\\ backgroundScripts.js" ) ;
252+ backgroundScripts = backgroundScripts . Replace ( "return 0 !== t.length;" , "return true;" ) ; // Делает "premium"
253+ File . WriteAllText ( outplayedPath + "\\ backgroundScripts.js" , backgroundScripts ) ;
254+ Console . WriteLine ( "|| -- [backgroundScripts.js] Patched successfully ||" ) ;
255+ Console . WriteLine ( "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" ) ;
256+ }
257+ }
258+
259+
260+
218261
219262 Console . WriteLine ( ) ;
220263 Console . WriteLine ( ) ;
0 commit comments