@@ -21,9 +21,11 @@ public partial class Main : MetroFramework.Forms.MetroForm
2121 public string HookDLL = "CLHook.dll" ;
2222 public bool AllStarted = false ;
2323 public bool DX9Allowed = false ;
24+ public bool CustomDLLs = false ;
2425 public Main ( )
2526 {
2627 InitializeComponent ( ) ;
28+ CLTheme . MainForm = this ;
2729 CLTheme . MainControls = this . Controls ;
2830 this . Resizable = false ;
2931 this . Theme = MetroFramework . MetroThemeStyle . Light ;
@@ -32,6 +34,7 @@ public Main()
3234 {
3335 btnSettings . Enabled = false ;
3436 }
37+ CustomDLLs = LoaderConfig . UseCustomDLLs ;
3538 Core . LoadControlTranslations ( Controls ) ;
3639 LoaderEvents . LauncherLoaded += LoaderEvents_LauncherLoaded ;
3740 LoaderEvents . ConquerLaunched += LoaderEvents_ConquerLaunched ;
@@ -393,9 +396,12 @@ private void Worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs
393396 if ( SelectedServer . ServerVersion >= 6371 && SelectedServer . ServerVersion <= Constants . MaxVersionUseServerDat )
394397 {
395398 RebuildServerDat ( ) ;
396- Core . LogWritter . Write ( "Generating required files for use Custom Server.dat... (Using DX8)" ) ;
397399 SafeIO . TryWriteAllBytes ( Path . Combine ( WorkingDir , "TQAnp.dll" ) , Properties . Resources . TQAnp , ex => Core . LogWritter . Write ( ex . ToString ( ) ) ) ;
398- SafeIO . TryWriteAllBytes ( Path . Combine ( Application . StartupPath , HookDLL ) , Properties . Resources . COHook6371 , ex => Core . LogWritter . Write ( ex . ToString ( ) ) ) ;
400+ if ( ! CustomDLLs )
401+ {
402+ Core . LogWritter . Write ( "Generating required files for use Custom Server.dat... (Using DX8)" ) ;
403+ SafeIO . TryWriteAllBytes ( Path . Combine ( Application . StartupPath , HookDLL ) , Properties . Resources . COHook6371 , ex => Core . LogWritter . Write ( ex . ToString ( ) ) ) ;
404+ }
399405 }
400406 }
401407 NoUseDX8_DX9 = false ;
@@ -418,34 +424,41 @@ private void Worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs
418424 if ( SelectedServer . ServerVersion >= 6600 )
419425 {
420426 RebuildServerDat ( ) ;
421- Core . LogWritter . Write ( "Generating required files for use Custom Server.dat... (Using DX9)" ) ;
422427 SafeIO . TryWriteAllBytes ( Path . Combine ( WorkingDir , "TQAnp.dll" ) , Properties . Resources . TQAnp , ex => Core . LogWritter . Write ( ex . ToString ( ) ) ) ;
423- SafeIO . TryWriteAllBytes ( Path . Combine ( Application . StartupPath , HookDLL ) , Properties . Resources . COHook6371 , ex => Core . LogWritter . Write ( ex . ToString ( ) ) ) ;
428+ if ( ! CustomDLLs )
429+ {
430+ Core . LogWritter . Write ( "Generating required files for use Custom Server.dat... (Using DX9)" ) ;
431+ SafeIO . TryWriteAllBytes ( Path . Combine ( Application . StartupPath , HookDLL ) , Properties . Resources . COHook6371 , ex => Core . LogWritter . Write ( ex . ToString ( ) ) ) ;
432+ }
424433 }
425434 }
426435 NoUseDX8_DX9 = false ;
427436 }
428437 }
429438 if ( NoUseDX8_DX9 && UseDecryptedServerDat && SelectedServer . ServerVersion >= Constants . MinVersionUseServerDat )
430439 {
431- if ( ! AlreadyUsingLoader )
432- {
433- File . WriteAllBytes ( Path . Combine ( WorkingDir , "COFlashFixer.dll" ) , Properties . Resources . COFlashFixer_DLL ) ; // Fix for flash
434- }
435- if ( SelectedServer . ServerVersion >= 6176 && SelectedServer . ServerVersion <= 6370 )
440+ if ( ! CustomDLLs )
436441 {
437442 if ( ! AlreadyUsingLoader )
438443 {
439- File . WriteAllBytes ( Path . Combine ( WorkingDir , HookDLL ) , Properties . Resources . COHook6176 ) ; // 6176 TO 6370 Hook
444+ File . WriteAllBytes ( Path . Combine ( WorkingDir , "COFlashFixer.dll" ) , Properties . Resources . COFlashFixer_DLL ) ; // Fix for flash
440445 }
441- } else
442- {
443- if ( ! AlreadyUsingLoader )
446+ if ( SelectedServer . ServerVersion >= 6176 && SelectedServer . ServerVersion <= 6370 )
447+ {
448+ if ( ! AlreadyUsingLoader )
449+ {
450+ File . WriteAllBytes ( Path . Combine ( WorkingDir , HookDLL ) , Properties . Resources . COHook6176 ) ; // 6176 TO 6370 Hook
451+ }
452+ }
453+ else
444454 {
445- File . WriteAllBytes ( Path . Combine ( WorkingDir , HookDLL ) , Properties . Resources . COHook6022 ) ; // V5717 TO V6175 Hook
455+ if ( ! AlreadyUsingLoader )
456+ {
457+ File . WriteAllBytes ( Path . Combine ( WorkingDir , HookDLL ) , Properties . Resources . COHook6022 ) ; // V5717 TO V6175 Hook
458+ }
446459 }
460+ Core . LogWritter . Write ( "Generating required files for use Custom Server.dat..." ) ;
447461 }
448- Core . LogWritter . Write ( "Generating required files for use Custom Server.dat..." ) ;
449462 RebuildServerDat ( ) ;
450463 }
451464 Process conquerProc = Process . Start ( new ProcessStartInfo ( ) { FileName = PathToConquerExe , WorkingDirectory = WorkingDir , Arguments = "blacknull" } ) ;
0 commit comments