summaryrefslogtreecommitdiff
path: root/src/shared/oblivioninfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/oblivioninfo.cpp')
-rw-r--r--src/shared/oblivioninfo.cpp155
1 files changed, 5 insertions, 150 deletions
diff --git a/src/shared/oblivioninfo.cpp b/src/shared/oblivioninfo.cpp
index 288ab17f..16748f58 100644
--- a/src/shared/oblivioninfo.cpp
+++ b/src/shared/oblivioninfo.cpp
@@ -31,8 +31,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
namespace MOShared {
-OblivionInfo::OblivionInfo(const std::wstring &omoDirectory, const std::wstring &gameDirectory)
- : GameInfo(omoDirectory, gameDirectory)
+OblivionInfo::OblivionInfo(const std::wstring &moDirectory, const std::wstring &moDataDirectory, const std::wstring &gameDirectory)
+ : GameInfo(moDirectory, moDataDirectory, gameDirectory)
{
identifyMyGamesDirectory(L"oblivion");
}
@@ -43,11 +43,6 @@ bool OblivionInfo::identifyGame(const std::wstring &searchPath)
FileExists(searchPath, L"OblivionLauncher.exe");
}
-unsigned long OblivionInfo::getBSAVersion()
-{
- return 0x67;
-}
-
std::wstring OblivionInfo::getRegPathStatic()
{
HKEY key;
@@ -61,63 +56,22 @@ std::wstring OblivionInfo::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 OblivionInfo::getInvalidationBSA()
-{
- return L"Oblivion - Invalidation.bsa";
-}
-bool OblivionInfo::isInvalidationBSA(const std::wstring &bsaName)
-{
- static LPCWSTR invalidation[] = { L"Oblivion - Invalidation.bsa", L"ArchiveInvalidationInvalidated!.bsa",
- L"BSARedirection.bsa", NULL };
- for (int i = 0; invalidation[i] != NULL; ++i) {
- if (wcscmp(bsaName.c_str(), invalidation[i]) == 0) {
- return true;
- }
- }
- return false;
-}
-std::wstring OblivionInfo::getDocumentsDir()
-{
- std::wostringstream temp;
- temp << getMyGamesDirectory() << L"\\Oblivion";
- return temp.str();
-}
-std::wstring OblivionInfo::getSaveGameDir()
-{
- std::wostringstream temp;
- temp << getDocumentsDir() << L"\\Saves";
- return temp.str();
-}
-std::vector<std::wstring> OblivionInfo::getPrimaryPlugins()
-{
- return boost::assign::list_of(L"oblivion.esm");
-}
-std::vector<std::wstring> OblivionInfo::getVanillaBSAs()
-{
- return boost::assign::list_of(L"Oblivion - Meshes.bsa")
- (L"Oblivion - Textures - Compressed.bsa")
- (L"Oblivion - Sounds.bsa")
- (L"Oblivion - Voices1.bsa")
- (L"Oblivion - Voices2.bsa")
- (L"Oblivion - Misc.bsa");
-}
-
std::vector<std::wstring> OblivionInfo::getDLCPlugins()
{
@@ -147,67 +101,7 @@ std::vector<std::wstring> OblivionInfo::getIniFileNames()
}
-void OblivionInfo::createProfile(const std::wstring &directory, bool useDefaults)
-{
- std::wostringstream target;
-
- // copy plugins.txt
- target << directory << "\\plugins.txt";
-
- if (!FileExists(target.str())) {
- std::wostringstream source;
- source << getLocalAppFolder() << "\\Oblivion\\plugins.txt";
- if (!::CopyFileW(source.str().c_str(), target.str().c_str(), true)) {
- HANDLE file = ::CreateFileW(target.str().c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- ::CloseHandle(file);
- }
- }
-
- // copy ini-file
- target.str(L""); target.clear();
- target << directory << L"\\oblivion.ini";
-
- if (!FileExists(target.str())) {
- std::wostringstream source;
- if (useDefaults) {
- source << getGameDirectory() << L"\\oblivion_default.ini";
- } else {
- source << getMyGamesDirectory() << L"Oblivion";
- if (FileExists(source.str(), L"oblivion.ini")) {
- source << L"\\oblivion.ini";
- } else {
- source.str(L"");
- source << getGameDirectory() << L"\\oblivion_default.ini";
- }
- }
- if (!::CopyFileW(source.str().c_str(), target.str().c_str(), true)) {
- if (::GetLastError() != ERROR_FILE_EXISTS) {
- std::ostringstream stream;
- stream << "failed to copy ini file: " << ToString(source.str(), false);
- throw windows_error(stream.str());
- }
- }
- }
-
- { // copy oblivionprefs.ini-file
- std::wstring target = directory + L"\\oblivionprefs.ini";
- if (!FileExists(target)) {
- std::wstring source = getMyGamesDirectory() + L"\\Oblivion\\oblivionprefs.ini";
- if (!::CopyFileW(source.c_str(), target.c_str(), true)) {
- if ((::CreateFileW(target.c_str(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL) == INVALID_HANDLE_VALUE) &&
- (::GetLastError() != ERROR_FILE_EXISTS)) {
- throw windows_error(std::string("failed to create ini file: ") + ToString(target, false));
- }
- }
- }
- }
-}
-
-std::wstring OblivionInfo::getSEName()
-{
- return L"obse";
-}
std::wstring OblivionInfo::getNexusPage(bool nmmScheme)
@@ -231,18 +125,11 @@ int OblivionInfo::getNexusModIDStatic()
return 38277;
}
-
-void OblivionInfo::repairProfile(const std::wstring &directory)
-{
- createProfile(directory, false);
-}
-
-
bool OblivionInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*)
{
- static LPCWSTR profileFiles[] = { L"oblivion.ini", L"oblivionprefs.ini", L"plugins.txt", NULL };
+ static LPCWSTR profileFiles[] = { L"oblivion.ini", L"oblivionprefs.ini", L"plugins.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;
}
@@ -250,41 +137,9 @@ bool OblivionInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*)
return false;
}
-
-std::wstring OblivionInfo::getSaveGameExtension()
-{
- return L"*.ess";
-}
-
std::wstring OblivionInfo::getReferenceDataFile()
{
return L"Oblivion - Meshes.bsa";
}
-
-std::wstring OblivionInfo::getOMODExt()
-{
- return L"omod";
-}
-
-
-std::wstring OblivionInfo::getSteamAPPId(int) const
-{
- return L"22330";
-}
-
-
-std::vector<ExecutableInfo> OblivionInfo::getExecutables()
-{
- std::vector<ExecutableInfo> result;
- result.push_back(ExecutableInfo(L"OBSE", L"obse_loader.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"Oblivion", L"oblivion.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"Oblivion Mod Manager", L"OblivionModManager.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"Construction Set", L"TESConstructionSet.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"Oblivion Launcher", L"OblivionLauncher.exe", L"", L"", DEFAULT_CLOSE));
- result.push_back(ExecutableInfo(L"BOSS", L"BOSS/BOSS.exe", L"", L"", NEVER_CLOSE));
- result.push_back(ExecutableInfo(L"BOSS (old)", L"Data/BOSS.exe", L"", L"", NEVER_CLOSE));
-
- return result;
-}
} // namespace MOShared