mirror of
https://github.com/araxiaonline/WoW-Launcher.git
synced 2026-06-13 01:22:21 -04:00
Some QoL improvements:
- Disable dev mode on IPv6 or unreachable game portal host names. - Print the client build and path on launcher start. - Disable anti crash feature when dev/custom file/static auth seed modes are disabled. This restores the original client side security features when using external hosts.
This commit is contained in:
@@ -152,6 +152,14 @@ static class Launcher
|
||||
|
||||
// Build the version URL from the game binary build.
|
||||
var clientVersion = GetVersionValueFromClient(appPath);
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"Client Build {clientVersion}");
|
||||
Console.WriteLine($"Client Path '{appPath}'");
|
||||
Console.WriteLine();
|
||||
Console.ResetColor();
|
||||
|
||||
byte[] versionPatch = Patches.Common.GetVersionUrl(clientVersion.Build);
|
||||
|
||||
// Refresh the client data before patching.
|
||||
@@ -187,7 +195,17 @@ static class Launcher
|
||||
|
||||
NativeWindows.NtResumeProcess(processInfo.ProcessHandle);
|
||||
|
||||
WaitForUnpack(ref processInfo, memory, ref mbi, gameAppData);
|
||||
var antiCrash = false;
|
||||
|
||||
// Enable anti crash in dev mode, custom file mode or static auth seed mode.
|
||||
#if CUSTOM_FILES
|
||||
antiCrash = true;
|
||||
#else
|
||||
antiCrash = commandLineResult.HasOption(LaunchOptions.UseStaticAuthSeed) ||
|
||||
commandLineResult.GetValueForOption(LaunchOptions.DevMode) && LaunchOptions.IsDevModeAllowed;
|
||||
#endif
|
||||
|
||||
WaitForUnpack(ref processInfo, memory, ref mbi, gameAppData, antiCrash);
|
||||
|
||||
#if x64
|
||||
if (clientVersion is (1, >= 14, _, _) or (3, 4, <= 1, _) or (9, _, _, _) or (10, <= 1, _, _) and not (10, 1, 5, _))
|
||||
@@ -321,7 +339,7 @@ static class Launcher
|
||||
#endif
|
||||
}
|
||||
|
||||
static void WaitForUnpack(ref ProcessInformation processInfo, WinMemory memory, ref MemoryBasicInformation mbi, Stream gameAppData)
|
||||
static void WaitForUnpack(ref ProcessInformation processInfo, WinMemory memory, ref MemoryBasicInformation mbi, Stream gameAppData, bool antiCrash)
|
||||
{
|
||||
#if x64
|
||||
// Wait for client initialization.
|
||||
@@ -356,7 +374,8 @@ static class Launcher
|
||||
while (memory?.Read(virtualTextSectionEnd, 1)?[0] == null || memory?.Read(virtualTextSectionEnd, 1)?[0] == textSectionEndValue)
|
||||
Thread.Sleep(100);
|
||||
#endif
|
||||
PrepareAntiCrash(memory, ref mbi, ref processInfo);
|
||||
if (antiCrash)
|
||||
PrepareAntiCrash(memory, ref mbi, ref processInfo);
|
||||
|
||||
memory.RefreshMemoryData((int)mbi.RegionSize);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Arctium.WoW.Launcher.Misc;
|
||||
|
||||
@@ -69,14 +70,23 @@ static class Helpers
|
||||
var ipSpan = colonIndex != -1 ? portalSpan[..colonIndex] : portalSpan;
|
||||
var portalString = ipSpan.ToString().Trim();
|
||||
|
||||
if (IPAddress.TryParse(portalString, out var ipAddress))
|
||||
return ipAddress.ToString().AsSpan();
|
||||
try
|
||||
{
|
||||
if (IPAddress.TryParse(portalString, out var ipAddress))
|
||||
return ipAddress.ToString().AsSpan();
|
||||
|
||||
var ipv4Address = Dns.GetHostAddresses(portalString).FirstOrDefault(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);
|
||||
var ipv4Address = Dns.GetHostAddresses(portalString).FirstOrDefault(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);
|
||||
|
||||
if (ipv4Address == null)
|
||||
throw new Exception("No IPv4 address found for the provided hostname.");
|
||||
if (ipv4Address == null)
|
||||
throw new Exception("No IPv4 address found for the provided hostname.");
|
||||
|
||||
return ipv4Address.ToString().AsSpan();
|
||||
return ipv4Address.ToString().AsSpan();
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
Console.WriteLine("No valid portal found. Dev (Local) mode disabled.");
|
||||
|
||||
return string.Empty.AsSpan();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ LaunchOptions.RootCommand.SetHandler(context =>
|
||||
{
|
||||
CreateDevIPFilter(out var ipFilter);
|
||||
|
||||
var appPath = Launcher.PrepareGameLaunch(context.ParseResult, ipFilter);
|
||||
// Prefer / instead of \ for the client path.
|
||||
var appPath = Launcher.PrepareGameLaunch(context.ParseResult, ipFilter).Replace("\\", "/");
|
||||
var gameCommandLine = string.Join(" ", context.ParseResult.UnmatchedTokens);
|
||||
|
||||
// Add config parameter to the game command line.
|
||||
|
||||
Reference in New Issue
Block a user