Skip to content

Commit

Permalink
Merge pull request #8 from ModOrganizer2/variant_consolidate
Browse files Browse the repository at this point in the history
Consolidate game search code in Gamebryo
  • Loading branch information
Silarn authored Sep 29, 2023
2 parents 791efe2 + 13ecd58 commit 88e6346
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 768 deletions.
30 changes: 1 addition & 29 deletions src/gamestarfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <memory>

#include "scopeguard.h"
#include "vdf_parser.h"

using namespace MOBase;

Expand Down Expand Up @@ -67,34 +66,7 @@ void GameStarfield::detectGame()

QString GameStarfield::identifyGamePath() const
{
QString path = "Software\\Valve\\Steam";
QString steamLocation =
findInRegistry(HKEY_CURRENT_USER, path.toStdWString().c_str(), L"SteamPath");
if (!steamLocation.isEmpty()) {
QString steamLibraryLocation;
QString steamLibraries(steamLocation + "\\" + "config" + "\\" +
"libraryfolders.vdf");
if (QFile(steamLibraries).exists()) {
std::ifstream file(steamLibraries.toStdString());
auto root = tyti::vdf::read(file);
for (auto child : root.childs) {
tyti::vdf::object* library = child.second.get();
auto apps = library->childs["apps"];
if (apps->attribs.contains(steamAPPId().toStdString())) {
steamLibraryLocation = QString::fromStdString(library->attribs["path"]);
break;
}
}
}
if (!steamLibraryLocation.isEmpty()) {
QString gameLocation = steamLibraryLocation + "\\" + "steamapps" + "\\" +
"common" + "\\" + "Starfield";
if (QDir(gameLocation).exists() &&
QFile(gameLocation + "\\" + "Starfield.exe").exists())
return gameLocation;
}
}
return "";
return parseSteamLocation(steamAPPId(), gameName());
}

QDir GameStarfield::dataDirectory() const
Expand Down
Loading

0 comments on commit 88e6346

Please sign in to comment.