Extract the directory if the registry value points to a filename.

This commit is contained in:
Matthias Mailänder
2020-12-12 15:20:38 +01:00
committed by reaperrr
parent 1f6e0f582a
commit e13fd4816e
6 changed files with 12 additions and 9 deletions

View File

@@ -17,7 +17,7 @@ namespace OpenRA
{
public class ModContent : IGlobalModData
{
public enum SourceType { Disc, Install }
public enum SourceType { Disc, RegistryDirectory, RegistryDirectoryFromFile }
public class ModPackage
{
public readonly string Title;

View File

@@ -175,7 +175,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (Platform.CurrentPlatform == PlatformType.Windows)
{
var installations = missingSources
.Where(s => s.Type == ModContent.SourceType.Install)
.Where(s => s.Type == ModContent.SourceType.RegistryDirectory || s.Type == ModContent.SourceType.RegistryDirectoryFromFile)
.Select(s => s.Title)
.Distinct();
@@ -464,7 +464,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
string FindSourcePath(ModContent.ModSource source, IEnumerable<string> volumes)
{
if (source.Type == ModContent.SourceType.Install)
if (source.Type == ModContent.SourceType.RegistryDirectory || source.Type == ModContent.SourceType.RegistryDirectoryFromFile)
{
if (source.RegistryKey == null)
return null;
@@ -478,6 +478,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (path == null)
continue;
if (source.Type == ModContent.SourceType.RegistryDirectoryFromFile)
path = Path.GetDirectoryName(path);
return IsValidSourcePath(path, source) ? path : null;
}

View File

@@ -1,5 +1,5 @@
origin: C&C The Ultimate Collection (Origin version, English)
Type: Install
Type: RegistryDirectory
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
RegistryKey: EA Games\CNC and The Covert Operations
RegistryValue: Install Dir

View File

@@ -1,5 +1,5 @@
gruntmods: Dune 2000: GruntMods Edition
Type: Install
Type: RegistryDirectory
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
RegistryKey: Dune 2000: Gruntmods Edition
IDFiles:

View File

@@ -1,5 +1,5 @@
ra-origin: C&C The Ultimate Collection (Origin version, English)
Type: Install
Type: RegistryDirectory
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
RegistryKey: EA Games\Command and Conquer Red Alert
RegistryValue: Install Dir
@@ -457,7 +457,7 @@ ra-origin: C&C The Ultimate Collection (Origin version, English)
Length: 9073
cnc-origin: Command & Conquer (Origin version, English)
Type: Install
Type: RegistryDirectory
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
RegistryKey: EA Games\CNC and The Covert Operations
RegistryValue: Install Dir
@@ -465,4 +465,4 @@ cnc-origin: Command & Conquer (Origin version, English)
CONQUER.MIX: 833e02a09aae694659eb312d3838367f681d1b30
Install:
copy: .
^SupportDir|Content/ra/v2/cnc/desert.mix: DESERT.MIX
^SupportDir|Content/ra/v2/cnc/desert.mix: DESERT.MIX

View File

@@ -1,5 +1,5 @@
origin: C&C The Ultimate Collection (Origin version, English)
Type: Install
Type: RegistryDirectory
RegistryPrefixes: HKEY_LOCAL_MACHINE\Software\, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\
RegistryKey: EA Games\Command and Conquer Tiberian Sun
RegistryValue: Install Dir