summaryrefslogtreecommitdiff
path: root/src/shared/gameinfo.cpp
diff options
context:
space:
mode:
authorTannin <sherb@gmx.net>2015-12-07 21:00:22 +0100
committerTannin <sherb@gmx.net>2015-12-07 21:00:22 +0100
commite60e2858d8b6c40150ae0dee2ba267fecfa17979 (patch)
tree98f9645b57264524a00015d92cb1987b0802e238 /src/shared/gameinfo.cpp
parent495846534d560f825819b7ee391e8c461ce76e4f (diff)
parent752bed064c24593e04ad121c29d40a20bbfc679a (diff)
Merge branch 'master' into new_vfs_library
Conflicts: src/gameinfoimpl.cpp src/installationmanager.cpp src/mainwindow.cpp src/organizercore.cpp src/organizercore.h src/organizerproxy.cpp src/organizerproxy.h src/savegamegamebryo.cpp src/savegamegamebyro.h src/selfupdater.h src/shared/fallout3info.cpp src/shared/fallout3info.h src/shared/falloutnvinfo.cpp src/shared/falloutnvinfo.h src/shared/gameinfo.cpp src/shared/gameinfo.h src/shared/oblivioninfo.cpp src/shared/oblivioninfo.h src/shared/skyriminfo.cpp src/shared/skyriminfo.h src/spawn.cpp src/transfersavesdialog.cpp
Diffstat (limited to 'src/shared/gameinfo.cpp')
-rw-r--r--src/shared/gameinfo.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/src/shared/gameinfo.cpp b/src/shared/gameinfo.cpp
index d9dd9bb1..9b097053 100644
--- a/src/shared/gameinfo.cpp
+++ b/src/shared/gameinfo.cpp
@@ -41,8 +41,8 @@ namespace MOShared {
GameInfo* GameInfo::s_Instance = nullptr;
-GameInfo::GameInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory)
- : m_GameDirectory(gameDirectory), m_OrganizerDirectory(moDirectory), m_OrganizerDataDirectory(moDataDirectory)
+GameInfo::GameInfo(const std::wstring &gameDirectory)
+ : m_GameDirectory(gameDirectory)
{
atexit(&cleanup);
}
@@ -87,39 +87,38 @@ void GameInfo::identifyMyGamesDirectory(const std::wstring &file)
}
}
-
-bool GameInfo::identifyGame(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &searchPath)
+bool GameInfo::identifyGame(const std::wstring &searchPath)
{
if (OblivionInfo::identifyGame(searchPath)) {
- s_Instance = new OblivionInfo(moDirectory, moDataDirectory, searchPath);
+ s_Instance = new OblivionInfo(searchPath);
} else if (Fallout3Info::identifyGame(searchPath)) {
- s_Instance = new Fallout3Info(moDirectory, moDataDirectory, searchPath);
+ s_Instance = new Fallout3Info(searchPath);
} else if (FalloutNVInfo::identifyGame(searchPath)) {
- s_Instance = new FalloutNVInfo(moDirectory, moDataDirectory, searchPath);
+ s_Instance = new FalloutNVInfo(searchPath);
} else if (SkyrimInfo::identifyGame(searchPath)) {
- s_Instance = new SkyrimInfo(moDirectory, moDataDirectory, searchPath);
+ s_Instance = new SkyrimInfo(searchPath);
} else if (Fallout4Info::identifyGame(searchPath)) {
- s_Instance = new Fallout4Info(moDirectory, moDataDirectory, searchPath);
+ s_Instance = new Fallout4Info(searchPath);
}
return s_Instance != nullptr;
}
-bool GameInfo::init(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gamePath)
+bool GameInfo::init(const std::wstring &moDirectory, const std::wstring &gamePath)
{
if (s_Instance == nullptr) {
if (gamePath.length() == 0) {
// search upward in the directory until a recognized game-binary is found
std::wstring searchPath(moDirectory);
- while (!identifyGame(moDirectory, moDataDirectory, searchPath)) {
+ while (!identifyGame(searchPath)) {
size_t lastSep = searchPath.find_last_of(L"/\\");
if (lastSep == std::string::npos) {
return false;
}
searchPath.erase(lastSep);
}
- } else if (!identifyGame(moDirectory, moDataDirectory, gamePath)) {
+ } else if (!identifyGame(gamePath)) {
return false;
}
}
@@ -138,25 +137,6 @@ std::wstring GameInfo::getGameDirectory() const
return m_GameDirectory;
}
-bool GameInfo::requiresSteam() const
-{
- return FileExists(getGameDirectory() + L"\\steam_api.dll")
- || FileExists(getGameDirectory() + L"\\steam_api64.dll");
-}
-
-std::wstring GameInfo::getLocalAppFolder() const
-{
- wchar_t localAppFolder[MAX_PATH];
- memset(localAppFolder, '\0', MAX_PATH * sizeof(wchar_t));
-
- if (::SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, localAppFolder) == S_OK) {
- return localAppFolder;
- } else {
- // fallback: try the registry
- return getSpecialPath(L"Local AppData");
- }
-}
-
std::wstring GameInfo::getSpecialPath(LPCWSTR name) const
{
HKEY key;