Skip to content

Commit f84c45b

Browse files
committed
release: Detect if DLL is loadable or not.
1 parent 930098a commit f84c45b

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

src/Flarial.Launcher.Runtime/Client/FlarialClient.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ public bool Launch(bool initialized)
4141
}
4242
return false;
4343
}
44-
return Injector.Launch(initialized, new(FileName)) is { };
44+
45+
Library library = new(FileName);
46+
if (!library.IsLoadable) return false;
47+
48+
return Injector.Launch(initialized, library) is { };
4549
}
4650

4751
static readonly object _lock = new();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Flarial.Launcher.Interface.Dialogs;
2+
3+
sealed class ClientInjectionFailureDialog : MainDialog
4+
{
5+
protected override string PrimaryButtonText => "Back";
6+
protected override string Title => "⚠️ Client Injection Failure";
7+
protected override string Content => @"The launcher couldn't inject the client into the game.
8+
9+
• Ensure no security software is blocking the launcher & client.
10+
• Add the launcher & client as exclusions in installed security software.
11+
12+
If you need help, join our Discord.";
13+
}

src/Flarial.Launcher/Interface/MainDialog.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ internal async Task<ContentDialogResult> PromptAsync()
4949
internal static UnpackagedInstallDialog UnpackagedInstall => field ??= new();
5050
internal static ClientUpdateFailureDialog ClientUpdateFailure => field ??= new();
5151
internal static GamingServicesMissingDialog GamingServicesMissing => field ??= new();
52+
internal static ClientInjectionFailureDialog ClientInjectionFailure => field ??= new();
5253
internal static LauncherUpdateAvailableDialog LauncherUpdateAvailable => field ??= new();
5354
}

src/Flarial.Launcher/Pages/HomePage.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,15 @@ async void OnButtonClick(object sender, RoutedEventArgs args)
177177
}
178178

179179
_button.Content = "Launching...";
180-
if (!await Task.Run(() => FlarialClient.Current.Launch(initialized)))
180+
switch (await Task.Run(() => FlarialClient.Current.Launch(initialized)))
181181
{
182-
await MainDialog.LaunchFailure.ShowAsync();
183-
return;
182+
case false:
183+
await MainDialog.LaunchFailure.ShowAsync();
184+
break;
185+
186+
case null:
187+
await MainDialog.ClientInjectionFailure.ShowAsync();
188+
break;
184189
}
185190
}
186191
finally

0 commit comments

Comments
 (0)