@@ -47,6 +47,7 @@ import net.rsprox.proxy.config.registerConnection
47
47
import net.rsprox.proxy.connection.ClientTypeDictionary
48
48
import net.rsprox.proxy.connection.ProxyConnectionContainer
49
49
import net.rsprox.proxy.downloader.JagexNativeClientDownloader
50
+ import net.rsprox.proxy.exceptions.MissingLibraryException
50
51
import net.rsprox.proxy.filters.DefaultPropertyFilterSetStore
51
52
import net.rsprox.proxy.futures.asCompletableFuture
52
53
import net.rsprox.proxy.http.GamePackProvider
@@ -514,6 +515,8 @@ public class ProxyService(
514
515
path = null ,
515
516
port = port,
516
517
character,
518
+ operatingSystem,
519
+ ClientType .RuneLite ,
517
520
)
518
521
logger.debug { " Waiting for client to connect to the server socket..." }
519
522
gamePackProvider.prefetch()
@@ -554,22 +557,46 @@ public class ProxyService(
554
557
OperatingSystem .WINDOWS -> {
555
558
val directory = path.parent.toFile()
556
559
val absolutePath = path.absolutePathString()
557
- createProcess(listOf (absolutePath), directory, path, port, character)
560
+ createProcess(
561
+ listOf (absolutePath),
562
+ directory,
563
+ path,
564
+ port,
565
+ character,
566
+ operatingSystem,
567
+ ClientType .Native ,
568
+ )
558
569
}
559
570
560
571
OperatingSystem .MAC -> {
561
572
// The patched file is at /.rsprox/clients/osclient.app/Contents/MacOS/osclient-patched
562
573
// We need to however execute the /.rsprox/clients/osclient.app "file"
563
574
val rootDirection = path.parent.parent.parent
564
575
val absolutePath = " ${File .separator}${rootDirection.absolutePathString()} "
565
- createProcess(listOf (" open" , absolutePath), null , path, port, character)
576
+ createProcess(
577
+ listOf (" open" , absolutePath),
578
+ null ,
579
+ path,
580
+ port,
581
+ character,
582
+ operatingSystem,
583
+ ClientType .Native ,
584
+ )
566
585
}
567
586
568
587
OperatingSystem .UNIX -> {
569
588
try {
570
589
val directory = path.parent.toFile()
571
590
val absolutePath = path.absolutePathString()
572
- createProcess(listOf (" wine" , absolutePath), directory, path, port, character)
591
+ createProcess(
592
+ listOf (" wine" , absolutePath),
593
+ directory,
594
+ path,
595
+ port,
596
+ character,
597
+ operatingSystem,
598
+ ClientType .Native ,
599
+ )
573
600
} catch (e: IOException ) {
574
601
throw RuntimeException (" wine is required to run the enhanced client on unix" , e)
575
602
}
@@ -585,6 +612,8 @@ public class ProxyService(
585
612
path : Path ? ,
586
613
port : Int ,
587
614
character : JagexCharacter ? ,
615
+ operatingSystem : OperatingSystem ,
616
+ clientType : ClientType ,
588
617
) {
589
618
logger.debug { " Attempting to create process $command " }
590
619
val builder =
@@ -629,12 +658,27 @@ public class ProxyService(
629
658
// case will be hit here. The 500 millisecond wait time is a requirement to hit it, otherwise it'll still
630
659
// be alive by the time it hits that.
631
660
if (! process.isAlive) {
661
+ if (operatingSystem == OperatingSystem .WINDOWS && clientType == ClientType .Native ) {
662
+ checkVisualCPlusPlusRedistributable()
663
+ }
632
664
throw IllegalStateException (" Unable to launch process: $path , error code: ${process.waitFor()} " )
633
665
}
634
666
if (path != null ) logger.debug { " Successfully launched $path " }
635
667
processes[port] = process.children().toList() + process.toHandle()
636
668
}
637
669
670
+ private fun checkVisualCPlusPlusRedistributable () {
671
+ val rootPath = Path (System .getenv(" SYSTEMROOT" ) ? : return )
672
+ val vcomp140 = rootPath.resolve(" System32" ).resolve(" vcomp140.dll" )
673
+ if (vcomp140.notExists()) {
674
+ throw MissingLibraryException (
675
+ " VCOMP140.dll is missing. " +
676
+ " Install Visual C++ Redistributable to obtain the necessary libraries via " +
677
+ " https://www.microsoft.com/en-ca/download/details.aspx?id=48145" ,
678
+ )
679
+ }
680
+ }
681
+
638
682
private fun createConfigurationDirectories (path : Path ) {
639
683
runCatching(" Unable to create configuration directory: $path " ) {
640
684
Files .createDirectories(path)
0 commit comments