1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-17 20:58:07 +02:00

add registy entry for localized variant of H3

This commit is contained in:
Laserlicht 2024-12-08 12:41:15 +01:00
parent 74a511c1aa
commit 47427df767

View File

@ -295,19 +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;
gogPath = QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\GOG.com\\Games\\1207658787", QSettings::NativeFormat).value("path").toString();
if(!gogPath.isEmpty())
return gogPath;
std::map<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;
cdPath = QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\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{};
}