mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-22 03:39:45 +02:00
Merge pull request #5049 from Laserlicht/reg_check
fix registry check for systems with WOW6432Node
This commit is contained in:
commit
a0514819e1
@ -295,13 +295,21 @@ bool FirstLaunchView::heroesDataDetect()
|
||||
QString FirstLaunchView::getHeroesInstallDir()
|
||||
{
|
||||
#ifdef VCMI_WINDOWS
|
||||
QString gogPath = QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\GOG.com\\Games\\1207658787", QSettings::NativeFormat).value("path").toString();
|
||||
if(!gogPath.isEmpty())
|
||||
return gogPath;
|
||||
QVector<QPair<QString, QString>> regKeys = {
|
||||
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\GOG.com\\Games\\1207658787", "path" }, // Gog on x86 system
|
||||
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\GOG.com\\Games\\1207658787", "path" }, // Gog on x64 system
|
||||
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\New World Computing\\Heroes of Might and Magic® III\\1.0", "AppPath" }, // H3 Complete on x86 system
|
||||
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\New World Computing\\Heroes of Might and Magic® III\\1.0", "AppPath" }, // H3 Complete on x64 system
|
||||
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\New World Computing\\Heroes of Might and Magic III\\1.0", "AppPath" }, // some localized H3 on x86 system
|
||||
{ "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\New World Computing\\Heroes of Might and Magic III\\1.0", "AppPath" }, // some localized H3 on x64 system
|
||||
};
|
||||
|
||||
QString cdPath = QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\New World Computing\\Heroes of Might and Magic® III\\1.0", QSettings::NativeFormat).value("AppPath").toString();
|
||||
if(!cdPath.isEmpty())
|
||||
return cdPath;
|
||||
for(auto & regKey : regKeys)
|
||||
{
|
||||
QString path = QSettings(regKey.first, QSettings::NativeFormat).value(regKey.second).toString();
|
||||
if(!path.isEmpty())
|
||||
return path;
|
||||
}
|
||||
#endif
|
||||
return QString{};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user