diff --git a/OWML.Patcher/VR/cacc71fcb141d936f1b59e57bf10dc52e8edb3481988379f7d95ecb65c4d3c90 b/OWML.Patcher/VR/cacc71fcb141d936f1b59e57bf10dc52e8edb3481988379f7d95ecb65c4d3c90 new file mode 100644 index 000000000..37d3ed87b Binary files /dev/null and b/OWML.Patcher/VR/cacc71fcb141d936f1b59e57bf10dc52e8edb3481988379f7d95ecb65c4d3c90 differ diff --git a/OWML.Patcher/VR/patch b/OWML.Patcher/VR/d3979abb3b0d2468c3e03e2ee862d5297f5885bd9fc8f3b16cb16805e010d097 similarity index 100% rename from OWML.Patcher/VR/patch rename to OWML.Patcher/VR/d3979abb3b0d2468c3e03e2ee862d5297f5885bd9fc8f3b16cb16805e010d097 diff --git a/OWML.Patcher/VrPatcher.cs b/OWML.Patcher/VrPatcher.cs index b46c5627b..34408b1b4 100644 --- a/OWML.Patcher/VrPatcher.cs +++ b/OWML.Patcher/VrPatcher.cs @@ -9,8 +9,6 @@ namespace OWML.Patcher { public class VRPatcher { - private const string TargetChecksum = "d3979abb3b0d2468c3e03e2ee862d5297f5885bd9fc8f3b16cb16805e010d097"; - private readonly IOwmlConfig _owmlConfig; private readonly IModConsole _writer; private readonly SHA256 _sha; @@ -49,17 +47,18 @@ private void CopyFiles() private void PatchGlobalManager(bool enableVR) { var originalPath = _owmlConfig.DataPath + "/globalgamemanagers"; - var backupPath = _owmlConfig.DataPath + "/globalgamemanagers.bak"; - var vrPath = _owmlConfig.DataPath + "/globalgamemanagers.vr"; - var patchPath = _owmlConfig.OWMLPath + "VR/patch"; - if (!File.Exists(originalPath)) { _writer.WriteLine("Error: can't find " + originalPath); return; } - if (!File.Exists(backupPath) || !OriginalIsSameSizeAsBackupOrVrVersion(originalPath, backupPath, vrPath)) + var checksum = CalculateChecksum(originalPath); + var backupPath = $"{_owmlConfig.DataPath}/globalgamemanagers.{checksum}.bak"; + var vrPath = $"{_owmlConfig.DataPath}/globalgamemanagers.{checksum}.vr"; + + + if (!File.Exists(backupPath)) { _writer.WriteLine("Taking backup of globalgamemanagers."); File.Copy(originalPath, backupPath, true); @@ -68,14 +67,14 @@ private void PatchGlobalManager(bool enableVR) if (enableVR && !File.Exists(vrPath)) { _writer.WriteLine("Patching globalgamemanagers for VR..."); - var checksum = CalculateChecksum(originalPath); - if (checksum == TargetChecksum) + var patchPath = $"{_owmlConfig.OWMLPath}VR/{checksum}"; + if (File.Exists(patchPath)) { ApplyPatch(originalPath, vrPath, patchPath); } else { - _writer.WriteLine($"Error: invalid checksum: {checksum}. Only Outer Wilds v1.0.4 is supported."); + _writer.WriteLine($"Error: invalid checksum: {checksum}. VR patch for this version of Outer Wilds is not yet supported by OWML."); return; } } @@ -84,19 +83,6 @@ private void PatchGlobalManager(bool enableVR) File.Copy(copyFrom, originalPath, true); } - private bool OriginalIsSameSizeAsBackupOrVrVersion(string originalPath, string backupPath, string vrPath) - { - var originalSize = File.ReadAllBytes(originalPath).Length; - var backupSize = File.ReadAllBytes(backupPath).Length; - var vrSize = File.Exists(vrPath) ? File.ReadAllBytes(vrPath).Length : 0; - var isSameSize = originalSize == backupSize || originalSize == vrSize; - if (!isSameSize) - { - _writer.WriteLine("Looks like new game version!"); - } - return isSameSize; - } - private string CalculateChecksum(string filePath) { var bytes = File.ReadAllBytes(filePath); diff --git a/createrelease.bat b/createrelease.bat index 53fbd9f25..602c37455 100644 --- a/createrelease.bat +++ b/createrelease.bat @@ -10,9 +10,7 @@ copy "OWML.Launcher\bin\Debug\OWML.Launcher.exe" "Release\OWML.Launcher.exe" copy "OWML.Launcher\bin\Debug\OWML.Config.json" "Release\OWML.Config.json" copy "OWML.Patcher\dnpatch\dnpatch.dll" "Release\dnpatch.dll" copy "OWML.Patcher\dnpatch\dnlib.dll" "Release\dnlib.dll" -copy "OWML.Patcher\VR\openvr_api.dll" "Release\VR\openvr_api.dll" -copy "OWML.Patcher\VR\OVRPlugin.dll" "Release\VR\OVRPlugin.dll" -copy "OWML.Patcher\VR\patch" "Release\VR\patch" +copy "OWML.Patcher\VR\*" "Release\VR\" copy "OWML.Patcher\VR\BsPatch.dll" "Release\BsPatch.dll" copy "OWML.Patcher\VR\ICSharpCode.SharpZipLib.dll" "Release\ICSharpCode.SharpZipLib.dll" copy "OWML.Launcher\bin\Debug\System.Runtime.Serialization.dll" "Release\System.Runtime.Serialization.dll"