Files
sbox-public/engine/Tools/SboxBuild/Steps/NvPatch.cs
Lorenz Junglas 8bb48bac56 Move Pipelines out of SboxBuild into GitHub yml
Allows us to get rid of a ton of abstraction in SboxBuild, and gets rid of a lot of GitHub API plumbing.
I feel like now that our workflows are more complex it's nicer to just use GitHub directly rather than having our own pipeline abstraction in SboxBuild.
This way we get nicer logging and error reporting, which we can\t achieve through GitHub API.
2026-06-19 13:49:41 +01:00

52 lines
1.4 KiB
C#

using static Facepunch.Constants;
namespace Facepunch.Steps;
internal class NvPatch
{
internal ExitCode Run()
{
string rootDir = Directory.GetCurrentDirectory();
string nvpatchPath = Path.Combine( rootDir, "engine", "ThirdParty", "nvpatch", "nvpatch.exe" );
try
{
if ( !File.Exists( nvpatchPath ) )
{
Log.Error( $"Error: NVPatch executable not found at {nvpatchPath}" );
return ExitCode.Failure;
}
Log.Info( "Step 1: Running nvpatch on sbox.exe" );
string sboxPath = Path.Combine( rootDir, "game", "sbox.exe" );
if ( !RunNvPatch( nvpatchPath, sboxPath ) )
return ExitCode.Failure;
Log.Info( "Step 2: Running nvpatch on sbox-dev.exe" );
string sboxDevPath = Path.Combine( rootDir, "game", "sbox-dev.exe" );
if ( !RunNvPatch( nvpatchPath, sboxDevPath ) )
return ExitCode.Failure;
Console.WriteLine( "NVPatch operations completed successfully!" );
return ExitCode.Success;
}
catch ( Exception ex )
{
Log.Error( $"NVPatch operations failed with error: {ex}" );
return ExitCode.Failure;
}
}
static bool RunNvPatch( string nvpatchPath, string targetExePath )
{
if ( !File.Exists( targetExePath ) )
{
Log.Warning( $"Warning: Target executable not found at {targetExePath}" );
Log.Warning( "Skipping this nvpatch operation." );
return true;
}
return Utility.RunProcess( nvpatchPath, $"--enable \"{targetExePath}\"", null );
}
}