mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-08-20 17:09:19 +08:00
Added detection of OIV path for increased conversion
This commit is contained in:
parent
b74016bba4
commit
644733a8d0
@ -103,18 +103,18 @@ namespace CodeWalker
|
|||||||
|
|
||||||
public static string GetCurrentGTAFolderWithTrailingSlash() =>CurrentGTAFolder.EndsWith(@"\") ? CurrentGTAFolder : CurrentGTAFolder + @"\";
|
public static string GetCurrentGTAFolderWithTrailingSlash() =>CurrentGTAFolder.EndsWith(@"\") ? CurrentGTAFolder : CurrentGTAFolder + @"\";
|
||||||
|
|
||||||
public static bool AutoDetectFolder(out string steamPath, out string retailPath)
|
public static bool AutoDetectFolder(out string steamPath, out string retailPath, out string oivPath)
|
||||||
{
|
{
|
||||||
retailPath = null;
|
retailPath = null;
|
||||||
steamPath = null;
|
steamPath = null;
|
||||||
|
oivPath = null;
|
||||||
|
|
||||||
RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
|
RegistryKey baseKey32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
|
||||||
string steamPathValue = baseKey.OpenSubKey(@"Software\Rockstar Games\GTAV")?.GetValue("InstallFolderSteam") as string;
|
string steamPathValue = baseKey32.OpenSubKey(@"Software\Rockstar Games\GTAV")?.GetValue("InstallFolderSteam") as string;
|
||||||
string retailPathValue = baseKey.OpenSubKey(@"Software\Rockstar Games\Grand Theft Auto V")?.GetValue("InstallFolder") as string;
|
string retailPathValue = baseKey32.OpenSubKey(@"Software\Rockstar Games\Grand Theft Auto V")?.GetValue("InstallFolder") as string;
|
||||||
|
string oivPathValue = Registry.CurrentUser.OpenSubKey(@"Software\NewTechnologyStudio\OpenIV.exe\BrowseForFolder")?.GetValue("game_path_Five_pc") as string;
|
||||||
|
|
||||||
if(steamPathValue != null)
|
if(steamPathValue?.EndsWith("\\GTAV") == true)
|
||||||
{
|
|
||||||
if(steamPathValue.EndsWith("\\GTAV"))
|
|
||||||
{
|
{
|
||||||
steamPathValue = steamPathValue.Substring(0, steamPathValue.LastIndexOf("\\GTAV"));
|
steamPathValue = steamPathValue.Substring(0, steamPathValue.LastIndexOf("\\GTAV"));
|
||||||
}
|
}
|
||||||
@ -123,20 +123,28 @@ namespace CodeWalker
|
|||||||
{
|
{
|
||||||
steamPath = steamPathValue;
|
steamPath = steamPathValue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(retailPathValue != null && ValidateGTAFolder(retailPathValue))
|
if(ValidateGTAFolder(retailPathValue))
|
||||||
{
|
{
|
||||||
retailPath = retailPathValue;
|
retailPath = retailPathValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return steamPath != null || retailPath != null;
|
if(ValidateGTAFolder(oivPathValue))
|
||||||
|
{
|
||||||
|
oivPath = oivPathValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return steamPath != null || retailPath != null || oivPath != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string AutoDetectFolder()
|
public static string AutoDetectFolder()
|
||||||
{
|
{
|
||||||
if(AutoDetectFolder(out string steam, out string retail))
|
if(AutoDetectFolder(out string steam, out string retail, out string oiv))
|
||||||
{
|
{
|
||||||
|
if(oiv != null)
|
||||||
|
{
|
||||||
|
return oiv;
|
||||||
|
}
|
||||||
if(steam != null)
|
if(steam != null)
|
||||||
{
|
{
|
||||||
return steam;
|
return steam;
|
||||||
|
Loading…
Reference in New Issue
Block a user