Merge pull request #12484 from pchote/installer-fixes
Fix asset installation on 32 bit windows and with original RA CDs.
This commit is contained in:
@@ -43,17 +43,23 @@ namespace OpenRA
|
|||||||
public readonly SourceType Type = SourceType.Disc;
|
public readonly SourceType Type = SourceType.Disc;
|
||||||
|
|
||||||
// Used to find installation locations for SourceType.Install
|
// Used to find installation locations for SourceType.Install
|
||||||
|
public readonly string[] RegistryPrefixes = { string.Empty };
|
||||||
public readonly string RegistryKey;
|
public readonly string RegistryKey;
|
||||||
public readonly string RegistryValue;
|
public readonly string RegistryValue;
|
||||||
|
|
||||||
public readonly string Title;
|
public readonly string Title;
|
||||||
public readonly Dictionary<string, string> IDFiles;
|
|
||||||
|
|
||||||
|
[FieldLoader.Ignore] public readonly MiniYaml IDFiles;
|
||||||
[FieldLoader.Ignore] public readonly List<MiniYamlNode> Install;
|
[FieldLoader.Ignore] public readonly List<MiniYamlNode> Install;
|
||||||
|
|
||||||
public ModSource(MiniYaml yaml)
|
public ModSource(MiniYaml yaml)
|
||||||
{
|
{
|
||||||
Title = yaml.Value;
|
Title = yaml.Value;
|
||||||
|
|
||||||
|
var idFiles = yaml.Nodes.FirstOrDefault(n => n.Key == "IDFiles");
|
||||||
|
if (idFiles != null)
|
||||||
|
IDFiles = idFiles.Value;
|
||||||
|
|
||||||
var installNode = yaml.Nodes.FirstOrDefault(n => n.Key == "Install");
|
var installNode = yaml.Nodes.FirstOrDefault(n => n.Key == "Install");
|
||||||
if (installNode != null)
|
if (installNode != null)
|
||||||
Install = installNode.Value.Nodes;
|
Install = installNode.Value.Nodes;
|
||||||
|
|||||||
@@ -481,13 +481,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (Platform.CurrentPlatform != PlatformType.Windows)
|
if (Platform.CurrentPlatform != PlatformType.Windows)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var path = Microsoft.Win32.Registry.GetValue(source.RegistryKey, source.RegistryValue, null) as string;
|
foreach (var prefix in source.RegistryPrefixes)
|
||||||
|
{
|
||||||
|
var path = Microsoft.Win32.Registry.GetValue(prefix + source.RegistryKey, source.RegistryValue, null) as string;
|
||||||
if (path == null)
|
if (path == null)
|
||||||
return null;
|
continue;
|
||||||
|
|
||||||
return IsValidSourcePath(path, source) ? path : null;
|
return IsValidSourcePath(path, source) ? path : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (source.Type == ModContent.SourceType.Disc)
|
if (source.Type == ModContent.SourceType.Disc)
|
||||||
foreach (var volume in volumes)
|
foreach (var volume in volumes)
|
||||||
if (IsValidSourcePath(volume, source))
|
if (IsValidSourcePath(volume, source))
|
||||||
@@ -500,16 +505,35 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var kv in source.IDFiles)
|
foreach (var kv in source.IDFiles.Nodes)
|
||||||
{
|
{
|
||||||
var filePath = Path.Combine(path, kv.Key);
|
var filePath = Path.Combine(path, kv.Key);
|
||||||
if (!File.Exists(filePath))
|
if (!File.Exists(filePath))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
using (var fileStream = File.OpenRead(filePath))
|
using (var fileStream = File.OpenRead(filePath))
|
||||||
if (CryptoUtil.SHA1Hash(fileStream) != kv.Value)
|
{
|
||||||
|
var offsetNode = kv.Value.Nodes.FirstOrDefault(n => n.Key == "Offset");
|
||||||
|
var lengthNode = kv.Value.Nodes.FirstOrDefault(n => n.Key == "Length");
|
||||||
|
if (offsetNode != null || lengthNode != null)
|
||||||
|
{
|
||||||
|
var offset = 0L;
|
||||||
|
if (offsetNode != null)
|
||||||
|
offset = FieldLoader.GetValue<long>("Offset", offsetNode.Value.Value);
|
||||||
|
|
||||||
|
var length = fileStream.Length - offset;
|
||||||
|
if (lengthNode != null)
|
||||||
|
length = FieldLoader.GetValue<long>("Length", lengthNode.Value.Value);
|
||||||
|
|
||||||
|
fileStream.Position = offset;
|
||||||
|
var data = fileStream.ReadBytes((int)length);
|
||||||
|
if (CryptoUtil.SHA1Hash(data) != kv.Value.Value)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (CryptoUtil.SHA1Hash(fileStream) != kv.Value.Value)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
origin: C&C The Ultimate Collection (Origin version, English)
|
origin: C&C The Ultimate Collection (Origin version, English)
|
||||||
Type: Install
|
Type: Install
|
||||||
RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\EA Games\CNC and The Covert Operations
|
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
|
||||||
|
RegistryKey: EA Games\CNC and The Covert Operations
|
||||||
RegistryValue: Install Dir
|
RegistryValue: Install Dir
|
||||||
IDFiles:
|
IDFiles:
|
||||||
CNC95Launcher.exe: 1d711adf09ac08738b2599b3092a1b448169b32a
|
CNC95Launcher.exe: 1d711adf09ac08738b2599b3092a1b448169b32a
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
gruntmods: Dune 2000: GruntMods Edition
|
gruntmods: Dune 2000: GruntMods Edition
|
||||||
Type: Install
|
Type: Install
|
||||||
RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Dune 2000: Gruntmods Edition
|
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
|
||||||
|
RegistryKey: Dune 2000: Gruntmods Edition
|
||||||
IDFiles:
|
IDFiles:
|
||||||
Dune 2000/data/BLOXXMAS.R8: afc818feda44f5873e3af07bd2191573ba9965db
|
Dune 2000/data/BLOXXMAS.R8: afc818feda44f5873e3af07bd2191573ba9965db
|
||||||
Dune 2000/data/DATA.R8: 2b229cf4be47104a6214237039a55329f6c45bc9
|
Dune 2000/data/DATA.R8: 2b229cf4be47104a6214237039a55329f6c45bc9
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
allied: Red Alert 95 (Allied Disc, English)
|
allied: Red Alert 95 (Allied Disc, English)
|
||||||
IDFiles:
|
IDFiles:
|
||||||
eahelp.GID: 13a8a4a1e7d9d6d893c38df5a39262c4689aeba5
|
MAIN.MIX: 20ebe16f91ff79be2d672f1db5bae9048ff9357c
|
||||||
|
Length: 4096
|
||||||
INSTALL/REDALERT.MIX: 0e58f4b54f44f6cd29fecf8cf379d33cf2d4caef
|
INSTALL/REDALERT.MIX: 0e58f4b54f44f6cd29fecf8cf379d33cf2d4caef
|
||||||
Install:
|
Install:
|
||||||
extract-raw: INSTALL/REDALERT.MIX
|
extract-raw: INSTALL/REDALERT.MIX
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
ra-origin: C&C The Ultimate Collection (Origin version, English)
|
ra-origin: C&C The Ultimate Collection (Origin version, English)
|
||||||
Type: Install
|
Type: Install
|
||||||
RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\EA Games\Command and Conquer Red Alert
|
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
|
||||||
|
RegistryKey: EA Games\Command and Conquer Red Alert
|
||||||
RegistryValue: Install Dir
|
RegistryValue: Install Dir
|
||||||
IDFiles:
|
IDFiles:
|
||||||
RA95Launcher.exe: 22bf7a1f9f1c2498823e3216541e6012f291c2c0
|
RA95Launcher.exe: 22bf7a1f9f1c2498823e3216541e6012f291c2c0
|
||||||
@@ -455,9 +456,11 @@ ra-origin: C&C The Ultimate Collection (Origin version, English)
|
|||||||
^Content/ra/v2/expand/myes1.aud:
|
^Content/ra/v2/expand/myes1.aud:
|
||||||
Offset: 844509702
|
Offset: 844509702
|
||||||
Length: 9073
|
Length: 9073
|
||||||
|
|
||||||
cnc-origin: Command & Conquer (Origin version, English)
|
cnc-origin: Command & Conquer (Origin version, English)
|
||||||
Type: Install
|
Type: Install
|
||||||
RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\EA Games\CNC and The Covert Operations
|
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
|
||||||
|
RegistryKey: EA Games\CNC and The Covert Operations
|
||||||
RegistryValue: Install Dir
|
RegistryValue: Install Dir
|
||||||
IDFiles:
|
IDFiles:
|
||||||
CNC95Launcher.exe: 1d711adf09ac08738b2599b3092a1b448169b32a
|
CNC95Launcher.exe: 1d711adf09ac08738b2599b3092a1b448169b32a
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
soviet: Red Alert 95 (Soviet Disc, English)
|
soviet: Red Alert 95 (Soviet Disc, English)
|
||||||
IDFiles:
|
IDFiles:
|
||||||
automenu.apm: bb61132a492bfb37069a0139f95671da3655d916
|
MAIN.MIX: 9d108f18560716b684ab8b1da42cc7f3d1b52519
|
||||||
|
Length: 4096
|
||||||
INSTALL/REDALERT.MIX: 0e58f4b54f44f6cd29fecf8cf379d33cf2d4caef
|
INSTALL/REDALERT.MIX: 0e58f4b54f44f6cd29fecf8cf379d33cf2d4caef
|
||||||
Install:
|
Install:
|
||||||
extract-raw: INSTALL/REDALERT.MIX
|
extract-raw: INSTALL/REDALERT.MIX
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
origin: C&C The Ultimate Collection (Origin version, English)
|
origin: C&C The Ultimate Collection (Origin version, English)
|
||||||
Type: Install
|
Type: Install
|
||||||
RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\EA Games\Command and Conquer Tiberian Sun
|
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
|
||||||
|
RegistryKey: EA Games\Command and Conquer Tiberian Sun
|
||||||
RegistryValue: Install Dir
|
RegistryValue: Install Dir
|
||||||
IDFiles:
|
IDFiles:
|
||||||
TSLauncher.exe: 0b3e8dfd7cb701868eccef3ba3717a1ced802707
|
TSLauncher.exe: 0b3e8dfd7cb701868eccef3ba3717a1ced802707
|
||||||
|
|||||||
Reference in New Issue
Block a user