Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tests/MetahookInstaller.FileTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,17 @@
Absent(fixture.Path("game/SteamAppsLocation.exe"));
Absent(fixture.Path("game/MetaHook.pdb"));
}),
("A payload without Steam API preserves the host runtime", fixture =>
{
var source = fixture.Payload();
var game = fixture.Game("valve");
File.Delete(fixture.Path("package/install/output/steam_api.dll"));
InstallPayload.Install(source, game, "valve", true, false);
Absent(fixture.Path("game/steam_api.dll"));
fixture.Write("game/steam_api.dll", "host Steam API");
InstallPayload.Install(source, game, "valve", true, false);
Equal("host Steam API", File.ReadAllText(fixture.Path("game/steam_api.dll")));
}),
("SDL is replaced only when required by a normal engine", fixture =>
{
var source = fixture.Payload();
Expand Down Expand Up @@ -410,14 +421,19 @@
{
using var fixture = new Fixture();
var game = fixture.Game(mod);
// Default aggregate packages leave Steam API to the game. Older/custom
// packages may still supply it, in which case normal DLL copying applies.
var hostSteamApi = fixture.Write("game/steam_api.dll", "host Steam API");
var payloadSteamApi = System.IO.Path.Combine(source, "steam_api.dll");
var expectedSteamApi = File.ReadAllBytes(File.Exists(payloadSteamApi) ? payloadSteamApi : hostSteamApi);
var launcher = InstallPayload.Install(source, game, mod, true, true);
Equal(Convert.ToHexString(System.Security.Cryptography.SHA256.HashData(File.ReadAllBytes(System.IO.Path.Combine(source, "MetaHook.exe")))),
Convert.ToHexString(System.Security.Cryptography.SHA256.HashData(File.ReadAllBytes(launcher))));
Exists(fixture.Path($"game/{mod}/metahook/plugins/BetterSpray.dll"));
Exists(fixture.Path($"game/{mod}/metahook/gamedata/betterspray/index.json"));
Exists(fixture.Path($"game/{mod}/metahook/configs/plugins.lst"));
Exists(fixture.Path("game/libcurl.dll"));
Exists(fixture.Path("game/steam_api.dll"));
Equal(Convert.ToHexString(expectedSteamApi), Convert.ToHexString(File.ReadAllBytes(hostSteamApi)));
Console.WriteLine($"PASS: installed the actual CMake payload into a simulated {mod} game");
}
}
Expand Down
Loading