diff options
| author | Tannin <devnull@localhost> | 2015-03-09 12:34:34 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-03-09 12:34:34 +0100 |
| commit | 7a1ae9b0f1560c9eda32e032796fbb3fd56ff236 (patch) | |
| tree | dea71435ac1042cb008fcd9f7b1ec57e6ea91227 /src/shared/skyriminfo.cpp | |
| parent | d45ebf134819e1559718681becca9c4139fb7151 (diff) | |
| parent | db2954e8eb41da715b9e7d79a72e225797401413 (diff) | |
Merge with branch1.2
Diffstat (limited to 'src/shared/skyriminfo.cpp')
| -rw-r--r-- | src/shared/skyriminfo.cpp | 179 |
1 files changed, 9 insertions, 170 deletions
diff --git a/src/shared/skyriminfo.cpp b/src/shared/skyriminfo.cpp index fc1401d8..f66fcef4 100644 --- a/src/shared/skyriminfo.cpp +++ b/src/shared/skyriminfo.cpp @@ -33,13 +33,13 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. namespace MOShared {
-SkyrimInfo::SkyrimInfo(const std::wstring &moDirectory, const std::wstring &gameDirectory)
- : GameInfo(moDirectory, gameDirectory)
+SkyrimInfo::SkyrimInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory)
+ : GameInfo(moDirectory, moDataDirectory, gameDirectory)
{
identifyMyGamesDirectory(L"skyrim");
wchar_t appDataPath[MAX_PATH];
- if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath))) {
+ if (SUCCEEDED(SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, appDataPath))) {
m_AppData = appDataPath;
}
}
@@ -50,10 +50,7 @@ bool SkyrimInfo::identifyGame(const std::wstring &searchPath) FileExists(searchPath, L"SkyrimLauncher.exe");
}
-unsigned long SkyrimInfo::getBSAVersion()
-{
- return 0x68;
-}
+
std::wstring SkyrimInfo::getRegPathStatic()
@@ -69,35 +66,16 @@ std::wstring SkyrimInfo::getRegPathStatic() WCHAR temp[MAX_PATH];
DWORD bufferSize = MAX_PATH;
- if (::RegQueryValueExW(key, L"Installed Path", NULL, NULL, (LPBYTE)temp, &bufferSize) == ERROR_SUCCESS) {
+ if (::RegQueryValueExW(key, L"Installed Path", nullptr, nullptr, (LPBYTE)temp, &bufferSize) == ERROR_SUCCESS) {
return std::wstring(temp);
} else {
return std::wstring();
}
}
-
-std::wstring SkyrimInfo::getInvalidationBSA()
-{
- return L"Skyrim - Invalidation.bsa";
-}
-
-bool SkyrimInfo::isInvalidationBSA(const std::wstring &bsaName)
-{
- static LPCWSTR invalidation[] = { L"Skyrim - Invalidation.bsa", NULL };
-
- for (int i = 0; invalidation[i] != NULL; ++i) {
- if (wcscmp(bsaName.c_str(), invalidation[i]) == 0) {
- return true;
- }
- }
- return false;
-}
-
-
GameInfo::LoadOrderMechanism SkyrimInfo::getLoadOrderMechanism() const
{
- std::wstring fileName = getGameDirectory().append(L"\\TESV.exe");
+ std::wstring fileName = getGameDirectory() + L"\\TESV.exe";
try {
VS_FIXEDFILEINFO versionInfo = GetFileVersion(fileName);
@@ -113,42 +91,6 @@ GameInfo::LoadOrderMechanism SkyrimInfo::getLoadOrderMechanism() const }
}
-std::wstring SkyrimInfo::getDocumentsDir()
-{
- std::wostringstream temp;
- temp << getMyGamesDirectory() << L"\\Skyrim";
-
- return temp.str();
-}
-
-std::wstring SkyrimInfo::getSaveGameDir()
-{
- std::wostringstream temp;
- temp << getDocumentsDir() << L"\\Saves";
- return temp.str();
-}
-
-std::vector<std::wstring> SkyrimInfo::getPrimaryPlugins()
-{
- return boost::assign::list_of(L"skyrim.esm")(L"update.esm");
-}
-
-std::vector<std::wstring> SkyrimInfo::getVanillaBSAs()
-{
- return boost::assign::list_of(L"Skyrim - Misc.bsa")
- (L"Skyrim - Shaders.bsa")
- (L"Skyrim - Textures.bsa")
- (L"HighResTexturePack01.bsa")
- (L"HighResTexturePack02.bsa")
- (L"HighResTexturePack03.bsa")
- (L"Skyrim - Interface.bsa")
- (L"Skyrim - Animations.bsa")
- (L"Skyrim - Meshes.bsa")
- (L"Skyrim - Sounds.bsa")
- (L"Skyrim - Voices.bsa")
- (L"Skyrim - VoicesExtra.bsa");
-}
-
std::vector<std::wstring> SkyrimInfo::getDLCPlugins()
{
return boost::assign::list_of (L"Dawnguard.esm")
@@ -170,35 +112,12 @@ std::vector<std::wstring> SkyrimInfo::getIniFileNames() return boost::assign::list_of(L"skyrim.ini")(L"skyrimprefs.ini");
}
-std::wstring SkyrimInfo::getSaveGameExtension()
-{
- return L"*.ess";
-}
-
std::wstring SkyrimInfo::getReferenceDataFile()
{
return L"Skyrim - Meshes.bsa";
}
-std::wstring SkyrimInfo::getOMODExt()
-{
- return L"fomod";
-}
-
-
-std::wstring SkyrimInfo::getSteamAPPId(int) const
-{
- return L"72850";
-}
-
-
-std::wstring SkyrimInfo::getSEName()
-{
- return L"skse";
-}
-
-
std::wstring SkyrimInfo::getNexusPage(bool nmmScheme)
{
if (nmmScheme) {
@@ -220,85 +139,18 @@ int SkyrimInfo::getNexusModIDStatic() return 1334;
}
-
-void SkyrimInfo::createProfile(const std::wstring &directory, bool useDefaults)
-{
- { // copy plugins.txt
- std::wstring target = directory + L"\\plugins.txt";
- if (!FileExists(target)) {
- std::wostringstream source;
- source << getLocalAppFolder() << "\\Skyrim\\plugins.txt";
- if (!::CopyFileW(source.str().c_str(), target.c_str(), true)) {
- HANDLE file = ::CreateFileW(target.c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- ::CloseHandle(file);
- }
- }
- target = directory + L"\\loadorder.txt";
- if (!FileExists(target)) {
- std::wstring source = getLocalAppFolder() + L"\\Skyrim\\loadorder.txt";
- if (!::CopyFileW(source.c_str(), target.c_str(), true)) {
- HANDLE file = ::CreateFileW(target.c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- ::CloseHandle(file);
- }
- }
- }
-
- { // copy skyrim.ini-file
- std::wstring target = directory + L"\\skyrim.ini";
- if (!FileExists(target)) {
- std::wstring source;
- if (useDefaults) {
- source = getGameDirectory() + L"\\skyrim_default.ini";
- } else {
- source = getMyGamesDirectory() + L"\\Skyrim";
- if (FileExists(source, L"skyrim.ini")) {
- source += L"\\skyrim.ini";
- } else {
- source = getGameDirectory() + L"\\skyrim_default.ini";
- }
- }
- if (!::CopyFileW(source.c_str(), target.c_str(), true)) {
- if (::GetLastError() != ERROR_FILE_EXISTS) {
- throw windows_error(std::string("failed to copy ini file: ") + ToString(source, false));
- }
- }
- }
- }
-
- { // copy skyrimprefs.ini-file
- std::wstring target = directory + L"\\skyrimprefs.ini";
- if (!FileExists(target)) {
- std::wstring source = getMyGamesDirectory() + L"\\Skyrim\\skyrimprefs.ini";
- if (!::CopyFileW(source.c_str(), target.c_str(), true)) {
- log("failed to copy ini file %ls", source.c_str());
- // create empty
- if (::CreateFileW(target.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) == INVALID_HANDLE_VALUE) {
- throw windows_error(std::string("failed to copy ini file: ") + ToString(source, false));
- }
- }
- }
- }
-}
-
-
-void SkyrimInfo::repairProfile(const std::wstring &directory)
-{
- createProfile(directory, false);
-}
-
-
bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath)
{
- static LPCWSTR profileFiles[] = { L"skyrim.ini", L"skyrimprefs.ini", L"loadorder.txt", NULL };
+ static LPCWSTR profileFiles[] = { L"skyrim.ini", L"skyrimprefs.ini", L"loadorder.txt", nullptr };
- for (int i = 0; profileFiles[i] != NULL; ++i) {
+ for (int i = 0; profileFiles[i] != nullptr; ++i) {
if (_wcsicmp(fileName, profileFiles[i]) == 0) {
return true;
}
}
if ((_wcsicmp(fileName, L"plugins.txt") == 0) &&
- (m_AppData.empty() || (StrStrIW(fullPath, m_AppData.c_str()) != NULL))) {
+ (m_AppData.empty() || (StrStrIW(fullPath, m_AppData.c_str()) != nullptr))) {
return true;
}
@@ -306,17 +158,4 @@ bool SkyrimInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPa }
-std::vector<ExecutableInfo> SkyrimInfo::getExecutables()
-{
- std::vector<ExecutableInfo> result;
- result.push_back(ExecutableInfo(L"SKSE", L"skse_loader.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"SBW", L"SBW.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"Skyrim", L"TESV.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"Skyrim Launcher", L"SkyrimLauncher.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"BOSS", L"BOSS/BOSS.exe", L"", L"", DEFAULT_STAY));
- result.push_back(ExecutableInfo(L"Creation Kit", L"CreationKit.exe", L"", L"", DEFAULT_STAY, L"202480"));
-
- return result;
-}
-
} // namespace MOShared
|
