add patcher

This commit is contained in:
Mister_Nebula 2022-01-16 20:08:59 +00:00
parent 5256b8a726
commit 7b7f8fe48e
6 changed files with 72 additions and 0 deletions

View File

@ -18,6 +18,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MirrorWeaver", "MirrorWeave
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FizzyFacepunch", "FizzyFacepunch\FizzyFacepunch.csproj", "{C533C95D-F634-4221-99F6-3E59C2A45F90}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QSBPatcher", "QSBPatcher\QSBPatcher.csproj", "{86CE49AB-487A-466A-98F3-3DCAF9BE66D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -40,6 +42,10 @@ Global
{C533C95D-F634-4221-99F6-3E59C2A45F90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C533C95D-F634-4221-99F6-3E59C2A45F90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C533C95D-F634-4221-99F6-3E59C2A45F90}.Release|Any CPU.Build.0 = Release|Any CPU
{86CE49AB-487A-466A-98F3-3DCAF9BE66D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86CE49AB-487A-466A-98F3-3DCAF9BE66D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86CE49AB-487A-466A-98F3-3DCAF9BE66D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86CE49AB-487A-466A-98F3-3DCAF9BE66D3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,5 +1,6 @@
{
"filename": "QSB.dll",
"patcher": "QSBPatcher.dll",
"author": "Nebula, John, Alek, & Rai",
"name": "Quantum Space Buddies",
"warning": {

View File

@ -0,0 +1,49 @@
using System;
using System.IO;
namespace QSBPatcher
{
public static class PatchSteamFiles
{
public static void Main(string[] args)
{
var basePath = args.Length > 0 ? args[0] : ".";
var gamePath = AppDomain.CurrentDomain.BaseDirectory;
var dataPath = GetDataPath(gamePath);
var pluginsPath = Path.Combine(dataPath, @"Plugins\x86_64");
var dir = new DirectoryInfo(Path.Combine(basePath, "SteamAPI"));
var files = dir.GetFiles();
foreach (var file in files)
{
var tempPath = Path.Combine(pluginsPath, file.Name);
file.CopyTo(tempPath, true);
}
}
private static string GetExecutableName(string gamePath)
{
var executableNames = new[] { "Outer Wilds.exe", "OuterWilds.exe" };
foreach (var executableName in executableNames)
{
var executablePath = Path.Combine(gamePath, executableName);
if (File.Exists(executablePath))
{
return Path.GetFileNameWithoutExtension(executablePath);
}
}
throw new FileNotFoundException($"Outer Wilds exe file not found in {gamePath}");
}
private static string GetDataDirectoryName()
{
var gamePath = AppDomain.CurrentDomain.BaseDirectory;
return $"{GetExecutableName(gamePath)}_Data";
}
private static string GetDataPath(string gamePath)
=> Path.Combine(gamePath, $"{GetDataDirectoryName()}");
}
}

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
</PropertyGroup>
<ItemGroup>
<None Update="SteamAPI\steam_api64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="SteamAPI\steam_api64.lib">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /y &quot;$(TargetPath)&quot; &quot;$(OwmlDir)\Mods\QSB\$(TargetName).dll&quot;&#xD;&#xA;md &quot;$(OwmlDir)\Mods\QSB\SteamAPI&quot;&#xD;&#xA;copy /y &quot;$(ProjectDir)\SteamAPI\steam_api64.dll&quot; &quot;$(OwmlDir)\Mods\QSB\SteamAPI&quot;&#xD;&#xA;copy /y &quot;$(ProjectDir)\SteamAPI\steam_api64.lib&quot; &quot;$(OwmlDir)\Mods\QSB\SteamAPI&quot;" />
</Target>
</Project>

Binary file not shown.

Binary file not shown.