Skip to content

Commit

Permalink
Merge pull request #147 from PhantomGamers/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomGamers authored Jul 14, 2023
2 parents 470938c + 7fff034 commit e1e7f77
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 232 deletions.
10 changes: 5 additions & 5 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<NoWarn>NU1507</NoWarn>
<AvaloniaVersion>11.0-rc1.1</AvaloniaVersion>
<AvaloniaVersion>11.0.0</AvaloniaVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
Expand All @@ -12,11 +12,11 @@
<PackageVersion Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" />
<PackageVersion Include="Flurl.Http" Version="4.0.0-pre3" />
<PackageVersion Include="PuppeteerSharp" Version="6.2.0" />
<PackageVersion Include="ReactiveUI.Fody" Version="19.2.1" />
<PackageVersion Include="ReactiveUI.Fody" Version="19.4.1" />
<PackageVersion Include="Semver" Version="2.3.0" />
<PackageVersion Include="PortableJsonSettingsProvider" Version="0.2.1" />
<PackageVersion Include="PortableJsonSettingsProvider" Version="0.2.2" />
<PackageVersion Include="Gameloop.Vdf" Version="0.6.2" />
<PackageVersion Include="NLog" Version="5.2.0" />
<PackageVersion Include="NLog" Version="5.2.2" />
<PackageVersion Include="MinVer" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand All @@ -30,7 +30,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
<PackageVersion Include="FileWatcherEx" Version="2.5.0" />
<PackageVersion Include="FluentAvaloniaUI" Version="2.0.0-rc1" />
<PackageVersion Include="FluentAvaloniaUI" Version="2.0.0" />
<PackageVersion Include="WindowsShortcutFactory" Version="1.1.0" />
<PackageVersion Include="WmiLight" Version="4.0.0" />
</ItemGroup>
Expand Down
10 changes: 8 additions & 2 deletions SFP/Models/Injection/Injector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ private static async Task ProcessFrame(Frame frame)
return;
}

if (frame.Url.StartsWith("devtools://"))
{
title = frame.Url;
}

await DumpFrame(frame, title);

foreach (var patch in patches)
Expand Down Expand Up @@ -301,7 +306,8 @@ private static async Task DumpFrame(Frame frame, string? fileName)
{
Directory.CreateDirectory("dumps");
var content = await frame.GetContentAsync();
await File.WriteAllTextAsync(Path.Join("dumps", fileName + ".html"), content);
var dumpsPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "dumps");
await File.WriteAllTextAsync(Path.Join(dumpsPath, fileName + ".html"), content);
}
catch (PuppeteerException e)
{
Expand Down Expand Up @@ -420,7 +426,7 @@ private static async Task InjectResourceAsync(Frame frame, string fileRelativePa

private static bool IsFrameWebkit(Frame frame)
{
return !frame.Url.StartsWith("https://steamloopback.host");
return !frame.Url.StartsWith("https://steamloopback.host") && !frame.Url.StartsWith("devtools://");
}

private static async Task UpdateColorInPage(Page page)
Expand Down
29 changes: 22 additions & 7 deletions SFP/Models/Steam.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#region

using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using FileWatcherEx;
Expand Down Expand Up @@ -239,11 +240,20 @@ private static async Task RestartSteam(string? args = null)
{
if (IsSteamRunning)
{
s_steamProcess = SteamProcess;
s_steamProcess!.EnableRaisingEvents = true;
s_steamProcess.Exited -= OnSteamExited;
s_steamProcess.Exited += OnSteamExited;
ShutDownSteam(s_steamProcess);
try
{
s_steamProcess = SteamProcess;
s_steamProcess!.EnableRaisingEvents = true;
s_steamProcess.Exited -= OnSteamExited;
s_steamProcess.Exited += OnSteamExited;
ShutDownSteam(s_steamProcess);
}
catch (Win32Exception e)
{
Log.Logger.Error("Could not shut down Steam, SFP does not have permission to interact with the Steam process.");
Log.Logger.Error("Make sure Steam is not running as admin");
Log.Logger.Debug(e);
}
}
else
{
Expand Down Expand Up @@ -375,8 +385,13 @@ private static async Task<bool> CheckForMissingArgumentsAsync()
var cmdLine = GetCommandLine();
if (!cmdLine.Any())
{
Log.Logger.Error("Arguments are empty, cannot check arguments");
return false;
await Task.Delay(TimeSpan.FromMilliseconds(100));
cmdLine = GetCommandLine();
if (!cmdLine.Any())
{
Log.Logger.Error("Cannot check arguments. Steam process does not exist or is running with elevated permissions");
return false;
}
}

var args = Settings.Default.SteamLaunchArgs.Trim().ToLower();
Expand Down
Loading

0 comments on commit e1e7f77

Please sign in to comment.