From 3659284ab6bdbf0845cf846600a26db688584d6f Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Mon, 23 Nov 2015 18:32:30 +0000 Subject: Remove most instances of GameInfo::getname, and transfer getDLCPlugins to the plugingame interface Also commented out startDownloadNexusFile as it doesn't appear to be used anywhere --- src/modinfo.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/modinfo.cpp b/src/modinfo.cpp index e0d888e6..59205b12 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -203,7 +203,7 @@ unsigned int ModInfo::findMod(const boost::function &filter } -void ModInfo::updateFromDisc(const QString &modDirectory, DirectoryEntry **directoryStructure, bool displayForeign) +void ModInfo::updateFromDisc(const QString &modDirectory, DirectoryEntry **directoryStructure, bool displayForeign, MOBase::IPluginGame const *game) { QMutexLocker lock(&s_Mutex); s_Collection.clear(); @@ -219,19 +219,25 @@ void ModInfo::updateFromDisc(const QString &modDirectory, DirectoryEntry **direc } { // list plugins in the data directory and make a foreign-managed mod out of each - std::vector dlcPlugins = GameInfo::instance().getDLCPlugins(); - QDir dataDir(QDir::fromNativeSeparators(ToQString(GameInfo::instance().getGameDirectory())) + "/data"); - foreach (const QFileInfo &file, dataDir.entryInfoList(QStringList() << "*.esp" << "*.esm")) { - if ((file.baseName() != "Update") // hide update - && (file.baseName() != ToQString(GameInfo::instance().getGameName())) // hide the game esp + QStringList dlcPlugins = game->getDLCPlugins(); + QStringList mainPlugins = game->getPrimaryPlugins(); + QDir dataDir(game->dataDirectory()); + for (const QString &file : dataDir.entryList({ "*.esp", "*.esm" })) { + if (std::find_if(mainPlugins.begin(), mainPlugins.end(), + [&file](QString const &p) { + return p.compare(file, Qt::CaseInsensitive) == 0; }) == mainPlugins.end() && (displayForeign // show non-dlc bundles only if the user wants them - || std::find(dlcPlugins.begin(), dlcPlugins.end(), ToWString(file.fileName())) != dlcPlugins.end())) { + || std::find_if(dlcPlugins.begin(), dlcPlugins.end(), + [&file](QString const &p) { + return p.compare(file, Qt::CaseInsensitive) == 0; }) != dlcPlugins.end())) { + + QFileInfo f(file); //Just so I can get a basename... QStringList archives; - foreach (const QString archiveName, dataDir.entryList(QStringList() << file.baseName() + "*.bsa")) { + for (const QString &archiveName : dataDir.entryList({ f.baseName() + "*.bsa" })) { archives.append(dataDir.absoluteFilePath(archiveName)); } - createFromPlugin(file.fileName(), archives, directoryStructure); + createFromPlugin(file, archives, directoryStructure); } } } -- cgit v1.3.1 From 42a68689fe60ba29367dc0c8f65083d9bde93e1f Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Tue, 24 Nov 2015 16:16:57 +0000 Subject: Replace GameInfo::getNexusModID with IPluginGame::getNexusModOrganizerID() Also implement IPluginGame::getNexusGameID() but not hooked it in yet. --- src/mainwindow.cpp | 5 +++-- src/modinfo.cpp | 5 ++++- src/shared/fallout3info.cpp | 5 ----- src/shared/fallout3info.h | 2 -- src/shared/falloutnvinfo.cpp | 6 ------ src/shared/falloutnvinfo.h | 2 -- src/shared/gameinfo.h | 2 +- src/shared/oblivioninfo.cpp | 5 ----- src/shared/oblivioninfo.h | 2 -- src/shared/skyriminfo.h | 1 - 10 files changed, 8 insertions(+), 27 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1651d0c6..5856f57f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3813,7 +3813,8 @@ void MainWindow::on_actionEndorseMO_triggered() if (QMessageBox::question(this, tr("Endorse Mod Organizer"), tr("Do you want to endorse Mod Organizer on %1 now?").arg(ToQString(GameInfo::instance().getNexusPage())), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - NexusInterface::instance()->requestToggleEndorsement(GameInfo::instance().getNexusModID(), true, this, QVariant(), QString()); + NexusInterface::instance()->requestToggleEndorsement( + m_OrganizerCore.managedGame()->getNexusModOrganizerID(), true, this, QVariant(), QString()); } } @@ -3877,7 +3878,7 @@ void MainWindow::nxmUpdatesAvailable(const std::vector &modIDs, QVariant us QVariantList resultList = resultData.toList(); for (auto iter = resultList.begin(); iter != resultList.end(); ++iter) { QVariantMap result = iter->toMap(); - if (result["id"].toInt() == GameInfo::instance().getNexusModID()) { + if (result["id"].toInt() == m_OrganizerCore.managedGame()->getNexusModOrganizerID()) { if (!result["voted_by_user"].toBool()) { ui->actionEndorseMO->setVisible(true); } diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 59205b12..a0628bd8 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -287,7 +287,10 @@ int ModInfo::checkAllForUpdate(QObject *receiver) int result = 0; std::vector modIDs; - modIDs.push_back(GameInfo::instance().getNexusModID()); + //I ought to store this, it's used elsewhere + IPluginGame *game = qApp->property("managed_game").value(); + + modIDs.push_back(game->getNexusModOrganizerID()); for (const ModInfo::Ptr &mod : s_Collection) { if (mod->canBeUpdated()) { diff --git a/src/shared/fallout3info.cpp b/src/shared/fallout3info.cpp index 95d1d299..67dc85e0 100644 --- a/src/shared/fallout3info.cpp +++ b/src/shared/fallout3info.cpp @@ -92,11 +92,6 @@ std::wstring Fallout3Info::getNexusInfoUrlStatic() return L"http://nmm.nexusmods.com/fallout3"; } -int Fallout3Info::getNexusModIDStatic() -{ - return 16348; -} - bool Fallout3Info::rerouteToProfile(const wchar_t *fileName, const wchar_t*) { static LPCWSTR profileFiles[] = { L"fallout.ini", L"falloutprefs.ini", L"plugins.txt", nullptr }; diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index ed130e53..3688bc2e 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -52,8 +52,6 @@ public: virtual std::wstring getNexusPage(bool nmmScheme = true); static std::wstring getNexusInfoUrlStatic(); virtual std::wstring getNexusInfoUrl() { return getNexusInfoUrlStatic(); } - static int getNexusModIDStatic(); - virtual int getNexusModID() { return getNexusModIDStatic(); } virtual int getNexusGameID() { return 120; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/falloutnvinfo.cpp b/src/shared/falloutnvinfo.cpp index b5fb4f04..c1eea4da 100644 --- a/src/shared/falloutnvinfo.cpp +++ b/src/shared/falloutnvinfo.cpp @@ -94,12 +94,6 @@ std::wstring FalloutNVInfo::getNexusInfoUrlStatic() } -int FalloutNVInfo::getNexusModIDStatic() -{ - return 42572; -} - - bool FalloutNVInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) { static LPCWSTR profileFiles[] = { L"fallout.ini", L"falloutprefs.ini", L"plugins.txt", nullptr }; diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index 75febd4c..024ad9aa 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -52,8 +52,6 @@ public: virtual std::wstring getNexusPage(bool nmmScheme = true); static std::wstring getNexusInfoUrlStatic(); virtual std::wstring getNexusInfoUrl() { return getNexusInfoUrlStatic(); } - static int getNexusModIDStatic(); - virtual int getNexusModID() { return getNexusModIDStatic(); } virtual int getNexusGameID() { return 130; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index 06b96d61..da6fb3dc 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -80,8 +80,8 @@ public: virtual std::wstring getNexusPage(bool nmmScheme = true) = 0; virtual std::wstring getNexusInfoUrl() = 0; - virtual int getNexusModID() = 0; virtual int getNexusGameID() = 0; + //**Still used: SkyrimInfo::getNexusModIDStatic //**USED ONLY IN HOOKDLL virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) = 0; diff --git a/src/shared/oblivioninfo.cpp b/src/shared/oblivioninfo.cpp index 27de1275..4cd03ae8 100644 --- a/src/shared/oblivioninfo.cpp +++ b/src/shared/oblivioninfo.cpp @@ -97,11 +97,6 @@ std::wstring OblivionInfo::getNexusInfoUrlStatic() } -int OblivionInfo::getNexusModIDStatic() -{ - return 38277; -} - bool OblivionInfo::rerouteToProfile(const wchar_t *fileName, const wchar_t*) { static LPCWSTR profileFiles[] = { L"oblivion.ini", L"oblivionprefs.ini", L"plugins.txt", nullptr }; diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index a9808d77..b298ed0a 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -50,8 +50,6 @@ public: virtual std::wstring getNexusPage(bool nmmScheme = true); static std::wstring getNexusInfoUrlStatic(); virtual std::wstring getNexusInfoUrl() { return getNexusInfoUrlStatic(); } - static int getNexusModIDStatic(); - virtual int getNexusModID() { return getNexusModIDStatic(); } virtual int getNexusGameID() { return 101; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index 13c82456..93e2a948 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -54,7 +54,6 @@ public: static std::wstring getNexusInfoUrlStatic(); virtual std::wstring getNexusInfoUrl() { return getNexusInfoUrlStatic(); } static int getNexusModIDStatic(); - virtual int getNexusModID() { return getNexusModIDStatic(); } static int getNexusGameIDStatic() { return 110; } virtual int getNexusGameID() { return getNexusGameIDStatic(); } -- cgit v1.3.1 From 78b686b2bc507a5606bc7c673745b02346bc667a Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Wed, 25 Nov 2015 08:22:40 +0000 Subject: Removes all references to GameInfo::getGameDirectory apart from one during startup Did some const correctness improvements Also may have fixed a potential crash as the Profile copy constructor didn't copy the m_GamePlugin membber --- src/directoryrefresher.cpp | 8 +++++++- src/loadmechanism.cpp | 1 + src/mainwindow.cpp | 23 ++++++++++++----------- src/mainwindow.h | 4 ---- src/modinfo.cpp | 5 +++-- src/organizercore.cpp | 2 +- src/profile.cpp | 8 +++++--- src/profile.h | 8 ++++---- src/profilesdialog.cpp | 12 ++++++------ src/profilesdialog.h | 4 ++-- src/settingsdialog.cpp | 11 +++++++++-- src/shared/gameinfo.h | 2 +- src/transfersavesdialog.cpp | 2 +- src/transfersavesdialog.h | 4 ++-- 14 files changed, 54 insertions(+), 40 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index c253f384..f4ad2a7d 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -18,10 +18,14 @@ along with Mod Organizer. If not, see . */ #include "directoryrefresher.h" + +#include "iplugingame.h" #include "utility.h" #include "report.h" #include "modinfo.h" #include + +#include #include #include @@ -141,7 +145,9 @@ void DirectoryRefresher::refresh() m_DirectoryStructure = new DirectoryEntry(L"data", nullptr, 0); - std::wstring dataDirectory = GameInfo::instance().getGameDirectory() + L"\\data"; + IPluginGame *game = qApp->property("managed_game").value(); + + std::wstring dataDirectory = QDir::toNativeSeparators(game->dataDirectory().absolutePath()).toStdWString(); m_DirectoryStructure->addFromOrigin(L"data", dataDirectory, 0); // TODO what was the point of having the priority in this tuple? the list is already sorted by priority diff --git a/src/loadmechanism.cpp b/src/loadmechanism.cpp index 4d06bea9..0d95c51c 100644 --- a/src/loadmechanism.cpp +++ b/src/loadmechanism.cpp @@ -64,6 +64,7 @@ void LoadMechanism::removeHintFile(QDir &targetDirectory) bool LoadMechanism::isDirectLoadingSupported() { + //FIXME: Seriously? isn't there a 'do i need steam' thing? IPluginGame *game = qApp->property("managed_game").value(); if (game->gameName().compare("oblivion", Qt::CaseInsensitive) == 0) { // oblivion can be loaded directly if it's not the steam variant diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5856f57f..05650219 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -153,7 +153,6 @@ MainWindow::MainWindow(const QString &exeName , m_ModListGroupingProxy(nullptr) , m_ModListSortProxy(nullptr) , m_OldExecutableIndex(-1) - , m_GamePath(ToQString(GameInfo::instance().getGameDirectory())) , m_CategoryFactory(CategoryFactory::instance()) , m_ContextItem(nullptr) , m_ContextAction(nullptr) @@ -1031,9 +1030,9 @@ void MainWindow::on_profileBox_currentIndexChanged(int index) if (ui->profileBox->currentIndex() == 0) { ui->profileBox->setCurrentIndex(previousIndex); - ProfilesDialog(ui->profileBox->currentText(), this).exec(); + ProfilesDialog(ui->profileBox->currentText(), m_OrganizerCore.managedGame(), this).exec(); while (!refreshProfiles()) { - ProfilesDialog(ui->profileBox->currentText(), this).exec(); + ProfilesDialog(ui->profileBox->currentText(), m_OrganizerCore.managedGame(), this).exec(); } } else { activateSelectedProfile(); @@ -1819,16 +1818,18 @@ void MainWindow::on_actionInstallMod_triggered() void MainWindow::on_actionAdd_Profile_triggered() { - bool repeat = true; - while (repeat) { - ProfilesDialog profilesDialog(m_GamePath, this); + for (;;) { + //Note: Calling this with an invalid profile name. Not quite sure why + ProfilesDialog profilesDialog(m_OrganizerCore.managedGame()->gameDirectory().absolutePath(), + m_OrganizerCore.managedGame(), + this); // workaround: need to disable monitoring of the saves directory, otherwise the active // profile directory is locked stopMonitorSaves(); profilesDialog.exec(); refreshSaveList(); // since the save list may now be outdated we have to refresh it completely if (refreshProfiles() && !profilesDialog.failed()) { - repeat = false; + break; } } // addProfile(); @@ -3225,9 +3226,9 @@ void MainWindow::fixMods_clicked() // search in data { - QDir dataDir(m_GamePath + "/data"); + QDir dataDir(m_OrganizerCore.managedGame()->dataDirectory()); QStringList esps = dataDir.entryList(espFilter); - foreach (const QString &esp, esps) { + for (const QString &esp : esps) { std::map >::iterator iter = missingPlugins.find(esp); if (iter != missingPlugins.end()) { iter->second.push_back(""); @@ -3241,7 +3242,7 @@ void MainWindow::fixMods_clicked() ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex); QStringList esps = QDir(modInfo->absolutePath()).entryList(espFilter); - foreach (const QString &esp, esps) { + for (const QString &esp : esps) { std::map >::iterator iter = missingPlugins.find(esp); if (iter != missingPlugins.end()) { iter->second.push_back(modInfo->name()); @@ -3253,7 +3254,7 @@ void MainWindow::fixMods_clicked() { QDir overwriteDir(qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::overwritePath())); QStringList esps = overwriteDir.entryList(espFilter); - foreach (const QString &esp, esps) { + for (const QString &esp : esps) { std::map >::iterator iter = missingPlugins.find(esp); if (iter != missingPlugins.end()) { iter->second.push_back(""); diff --git a/src/mainwindow.h b/src/mainwindow.h index 55ae40b9..b97a728e 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -285,15 +285,11 @@ private: int m_OldExecutableIndex; - QString m_GamePath; - int m_ContextRow; QPersistentModelIndex m_ContextIdx; QTreeWidgetItem *m_ContextItem; QAction *m_ContextAction; - //int m_SelectedSaveGame; - CategoryFactory &m_CategoryFactory; int m_ModsToUpdate; diff --git a/src/modinfo.cpp b/src/modinfo.cpp index a0628bd8..d79a7919 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -1134,14 +1134,15 @@ QDateTime ModInfoForeign::creationTime() const QString ModInfoForeign::absolutePath() const { - return QDir::fromNativeSeparators(ToQString(GameInfo::instance().getGameDirectory())) + "/data"; + //I ought to store this, it's used elsewhere + IPluginGame *game = qApp->property("managed_game").value(); + return game->dataDirectory().absolutePath(); } std::vector ModInfoForeign::getFlags() const { std::vector result = ModInfoWithConflictInfo::getFlags(); result.push_back(FLAG_FOREIGN); - return result; } diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 24077923..c3e10d37 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1011,7 +1011,7 @@ HANDLE OrganizerCore::startApplication(const QString &executable, const QStringL binary = QFileInfo(executable); if (binary.isRelative()) { // relative path, should be relative to game directory - binary = QFileInfo(QDir::fromNativeSeparators(ToQString(GameInfo::instance().getGameDirectory())) + "/" + executable); + binary = QFileInfo(managedGame()->gameDirectory().absoluteFilePath(executable)); } if (cwd.length() == 0) { currentDirectory = binary.absolutePath(); diff --git a/src/profile.cpp b/src/profile.cpp index 42dc56d1..77f6ebd1 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -54,7 +54,7 @@ void Profile::touchFile(QString fileName) } } -Profile::Profile(const QString &name, IPluginGame *gamePlugin, bool useDefaultSettings) +Profile::Profile(const QString &name, IPluginGame const *gamePlugin, bool useDefaultSettings) : m_ModListWriter(std::bind(&Profile::writeModlistNow, this)) , m_GamePlugin(gamePlugin) { @@ -95,7 +95,7 @@ Profile::Profile(const QString &name, IPluginGame *gamePlugin, bool useDefaultSe } -Profile::Profile(const QDir &directory, IPluginGame *gamePlugin) +Profile::Profile(const QDir &directory, IPluginGame const *gamePlugin) : m_Directory(directory) , m_GamePlugin(gamePlugin) , m_ModListWriter(std::bind(&Profile::writeModlistNow, this)) @@ -122,6 +122,8 @@ Profile::Profile(const QDir &directory, IPluginGame *gamePlugin) Profile::Profile(const Profile &reference) : m_Directory(reference.m_Directory) , m_ModListWriter(std::bind(&Profile::writeModlistNow, this)) + , m_GamePlugin(reference.m_GamePlugin) + { refreshModStatus(); } @@ -483,7 +485,7 @@ void Profile::setModPriority(unsigned int index, int &newPriority) m_ModListWriter.write(); } -Profile *Profile::createPtrFrom(const QString &name, const Profile &reference, MOBase::IPluginGame *gamePlugin) +Profile *Profile::createPtrFrom(const QString &name, const Profile &reference, MOBase::IPluginGame const *gamePlugin) { QString profileDirectory = qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::profilesPath()) + "/" + name; reference.copyFilesTo(profileDirectory); diff --git a/src/profile.h b/src/profile.h index e9edca56..b306e0c5 100644 --- a/src/profile.h +++ b/src/profile.h @@ -57,7 +57,7 @@ public: * @param name name of the new profile * @param filter save game filter. Defaults to <no filter>. **/ - Profile(const QString &name, MOBase::IPluginGame *gamePlugin, bool useDefaultSettings); + Profile(const QString &name, MOBase::IPluginGame const *gamePlugin, bool useDefaultSettings); /** * @brief constructor @@ -67,7 +67,7 @@ public: * invoking this should always produce a working profile * @param directory directory to read the profile from **/ - Profile(const QDir &directory, MOBase::IPluginGame *gamePlugin); + Profile(const QDir &directory, MOBase::IPluginGame const *gamePlugin); Profile(const Profile &reference); @@ -82,7 +82,7 @@ public: * @param name of the new profile * @param reference profile to copy from **/ - static Profile *createPtrFrom(const QString &name, const Profile &reference, MOBase::IPluginGame *gamePlugin); + static Profile *createPtrFrom(const QString &name, const Profile &reference, MOBase::IPluginGame const *gamePlugin); MOBase::DelayedFileWriter &modlistWriter() { return m_ModListWriter; } @@ -302,7 +302,7 @@ private: QDir m_Directory; - MOBase::IPluginGame *m_GamePlugin; + MOBase::IPluginGame const * const m_GamePlugin; mutable QByteArray m_LastModlistHash; std::vector m_ModStatus; diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp index 58be5448..b21aee53 100644 --- a/src/profilesdialog.cpp +++ b/src/profilesdialog.cpp @@ -42,10 +42,11 @@ using namespace MOShared; Q_DECLARE_METATYPE(Profile::Ptr) -ProfilesDialog::ProfilesDialog(const QString &profileName, QWidget *parent) +ProfilesDialog::ProfilesDialog(const QString &profileName, MOBase::IPluginGame const *game, QWidget *parent) : TutorableDialog("Profiles", parent) , ui(new Ui::ProfilesDialog) , m_FailState(false) + , m_Game(game) { ui->setupUi(this); @@ -65,7 +66,6 @@ ProfilesDialog::ProfilesDialog(const QString &profileName, QWidget *parent) QCheckBox *invalidationBox = findChild("invalidationBox"); - IPluginGame *game = qApp->property("managed_game").value(); BSAInvalidation *invalidation = game->feature(); if (invalidation == nullptr) { @@ -104,7 +104,7 @@ QListWidgetItem *ProfilesDialog::addItem(const QString &name) QDir profileDir(name); QListWidgetItem *newItem = new QListWidgetItem(profileDir.dirName(), m_ProfilesList); try { - newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(new Profile(profileDir, qApp->property("managed_game").value())))); + newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(new Profile(profileDir, m_Game)))); m_FailState = false; } catch (const std::exception& e) { reportError(tr("failed to create profile: %1").arg(e.what())); @@ -117,7 +117,7 @@ void ProfilesDialog::createProfile(const QString &name, bool useDefaultSettings) try { QListWidget *profilesList = findChild("profilesList"); QListWidgetItem *newItem = new QListWidgetItem(name, profilesList); - newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(new Profile(name, qApp->property("managed_game").value(), useDefaultSettings)))); + newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(new Profile(name, m_Game, useDefaultSettings)))); profilesList->addItem(newItem); m_FailState = false; } catch (const std::exception&) { @@ -131,7 +131,7 @@ void ProfilesDialog::createProfile(const QString &name, const Profile &reference try { QListWidget *profilesList = findChild("profilesList"); QListWidgetItem *newItem = new QListWidgetItem(name, profilesList); - newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(Profile::createPtrFrom(name, reference, qApp->property("managed_game").value())))); + newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(Profile::createPtrFrom(name, reference, m_Game)))); profilesList->addItem(newItem); m_FailState = false; } catch (const std::exception&) { @@ -324,6 +324,6 @@ void ProfilesDialog::on_localSavesBox_stateChanged(int state) void ProfilesDialog::on_transferButton_clicked() { const Profile::Ptr currentProfile = m_ProfilesList->currentItem()->data(Qt::UserRole).value(); - TransferSavesDialog transferDialog(*currentProfile, qApp->property("managed_game").value(), this); + TransferSavesDialog transferDialog(*currentProfile, m_Game, this); transferDialog.exec(); } diff --git a/src/profilesdialog.h b/src/profilesdialog.h index 6dd0c1d4..26476883 100644 --- a/src/profilesdialog.h +++ b/src/profilesdialog.h @@ -50,7 +50,7 @@ public: * @param parent parent widget * @todo the game path could be retrieved from GameInfo just as easily **/ - explicit ProfilesDialog(const QString &profileName, QWidget *parent = 0); + explicit ProfilesDialog(const QString &profileName, MOBase::IPluginGame const *game, QWidget *parent = 0); ~ProfilesDialog(); /** @@ -93,7 +93,7 @@ private: Ui::ProfilesDialog *ui; QListWidget *m_ProfilesList; bool m_FailState; - + MOBase::IPluginGame const *m_Game; }; #endif // PROFILESDIALOG_H diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index f2160719..36e177ab 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -18,18 +18,21 @@ along with Mod Organizer. If not, see . */ #include "settingsdialog.h" + #include "ui_settingsdialog.h" #include "categoriesdialog.h" #include "helper.h" #include "noeditdelegate.h" +#include "iplugingame.h" #include +#include "settings.h" + #include #include #include #include #define WIN32_LEAN_AND_MEAN #include -#include "settings.h" using namespace MOBase; @@ -87,7 +90,11 @@ void SettingsDialog::on_categoriesBtn_clicked() void SettingsDialog::on_bsaDateBtn_clicked() { - Helper::backdateBSAs(qApp->property("dataPath").toString().toStdWString(), GameInfo::instance().getGameDirectory().append(L"\\data")); + IPluginGame *game = qApp->property("managed_game").value(); + QDir dir = game->dataDirectory(); + + Helper::backdateBSAs(qApp->property("dataPath").toString().toStdWString(), + dir.absolutePath().toStdWString()); } void SettingsDialog::on_browseDownloadDirBtn_clicked() diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index da6fb3dc..49b3133b 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -65,7 +65,7 @@ public: //**Currently only used in a nasty mess at initialisation time. virtual std::wstring getGameName() const = 0; - //**USED IN HOOKDLL + //**USED IN HOOKDLL and in initialisation virtual std::wstring getGameDirectory() const; // get a list of file extensions for additional files belonging to a save game diff --git a/src/transfersavesdialog.cpp b/src/transfersavesdialog.cpp index 73267f75..d47d2bb0 100644 --- a/src/transfersavesdialog.cpp +++ b/src/transfersavesdialog.cpp @@ -32,7 +32,7 @@ using namespace MOBase; using namespace MOShared; -TransferSavesDialog::TransferSavesDialog(const Profile &profile, IPluginGame *gamePlugin, QWidget *parent) +TransferSavesDialog::TransferSavesDialog(const Profile &profile, IPluginGame const *gamePlugin, QWidget *parent) : TutorableDialog("TransferSaves", parent) , ui(new Ui::TransferSavesDialog) , m_Profile(profile) diff --git a/src/transfersavesdialog.h b/src/transfersavesdialog.h index b9265b6a..d9ea5b29 100644 --- a/src/transfersavesdialog.h +++ b/src/transfersavesdialog.h @@ -35,7 +35,7 @@ class TransferSavesDialog : public MOBase::TutorableDialog Q_OBJECT public: - explicit TransferSavesDialog(const Profile &profile, MOBase::IPluginGame *gamePlugin, QWidget *parent = 0); + explicit TransferSavesDialog(const Profile &profile, MOBase::IPluginGame const *gamePlugin, QWidget *parent = 0); ~TransferSavesDialog(); private slots: @@ -76,7 +76,7 @@ private: Profile m_Profile; - MOBase::IPluginGame *m_GamePlugin; + MOBase::IPluginGame const *m_GamePlugin; std::vector m_GlobalSaves; std::vector m_LocalSaves; -- cgit v1.3.1 From b9b12ca765d1703ac2e3852746e7acc3a20949a9 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Wed, 25 Nov 2015 14:23:58 +0000 Subject: Bunch of const correctness changes. There shouldn't be any update of plugin games once MO has started --- src/downloadmanager.cpp | 2 +- src/downloadmanager.h | 4 ++-- src/executableslist.cpp | 2 +- src/executableslist.h | 2 +- src/modinfo.cpp | 5 ++++- src/modinfo.h | 5 ++++- src/organizercore.h | 2 +- src/organizerproxy.cpp | 2 +- src/organizerproxy.h | 2 +- src/pluginlist.cpp | 2 +- src/pluginlist.h | 4 ++-- src/settings.cpp | 2 +- src/settings.h | 4 ++-- 13 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 588b8bb9..4a6769b1 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1465,7 +1465,7 @@ void DownloadManager::directoryChanged(const QString&) refreshList(); } -void DownloadManager::managedGameChanged(MOBase::IPluginGame *managedGame) +void DownloadManager::managedGameChanged(MOBase::IPluginGame const *managedGame) { m_ManagedGame = managedGame; } diff --git a/src/downloadmanager.h b/src/downloadmanager.h index faa4267e..54db4648 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -417,7 +417,7 @@ public slots: void nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString); - void managedGameChanged(MOBase::IPluginGame *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const *gamePlugin); private slots: @@ -506,7 +506,7 @@ private: QRegExp m_DateExpression; - MOBase::IPluginGame *m_ManagedGame; + MOBase::IPluginGame const *m_ManagedGame; }; diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 12e3d7aa..2182a425 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -38,7 +38,7 @@ ExecutablesList::~ExecutablesList() { } -void ExecutablesList::init(IPluginGame *game) +void ExecutablesList::init(IPluginGame const *game) { Q_ASSERT(game != nullptr); m_Executables.clear(); diff --git a/src/executableslist.h b/src/executableslist.h index b4054bcc..833829c8 100644 --- a/src/executableslist.h +++ b/src/executableslist.h @@ -78,7 +78,7 @@ public: /** * @brief initialise the list with the executables preconfigured for this game **/ - void init(MOBase::IPluginGame *game); + void init(MOBase::IPluginGame const *game); /** * @brief find an executable by its name diff --git a/src/modinfo.cpp b/src/modinfo.cpp index d79a7919..df34c00f 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -203,7 +203,10 @@ unsigned int ModInfo::findMod(const boost::function &filter } -void ModInfo::updateFromDisc(const QString &modDirectory, DirectoryEntry **directoryStructure, bool displayForeign, MOBase::IPluginGame const *game) +void ModInfo::updateFromDisc(const QString &modDirectory, + DirectoryEntry **directoryStructure, + bool displayForeign, + MOBase::IPluginGame const *game) { QMutexLocker lock(&s_Mutex); s_Collection.clear(); diff --git a/src/modinfo.h b/src/modinfo.h index 6de4123b..f6484707 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -107,7 +107,10 @@ public: /** * @brief read the mod directory and Mod ModInfo objects for all subdirectories **/ - static void updateFromDisc(const QString &modDirectory, MOShared::DirectoryEntry **directoryStructure, bool displayForeign, const MOBase::IPluginGame *game); + static void updateFromDisc(const QString &modDirectory, + MOShared::DirectoryEntry **directoryStructure, + bool displayForeign, + MOBase::IPluginGame const *game); static void clear() { s_Collection.clear(); s_ModsByName.clear(); s_ModsByModID.clear(); } diff --git a/src/organizercore.h b/src/organizercore.h index 6075eb18..a673065a 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -193,7 +193,7 @@ signals: */ void modInstalled(const QString &modName); - void managedGameChanged(MOBase::IPluginGame *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const *gamePlugin); private: diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 3c103ff0..fdc60a27 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -167,7 +167,7 @@ MOBase::IModList *OrganizerProxy::modList() const return m_Proxied->modList(); } -MOBase::IPluginGame *OrganizerProxy::managedGame() const +MOBase::IPluginGame const *OrganizerProxy::managedGame() const { return m_Proxied->managedGame(); } diff --git a/src/organizerproxy.h b/src/organizerproxy.h index 2f5e0970..62a35498 100644 --- a/src/organizerproxy.h +++ b/src/organizerproxy.h @@ -45,7 +45,7 @@ public: virtual bool onFinishedRun(const std::function &func); virtual bool onModInstalled(const std::function &func); - virtual MOBase::IPluginGame *managedGame() const; + virtual MOBase::IPluginGame const *managedGame() const; private: diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 6f883645..48b27f05 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -1211,7 +1211,7 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, } } -void PluginList::managedGameChanged(IPluginGame *gamePlugin) +void PluginList::managedGameChanged(IPluginGame const *gamePlugin) { m_GamePlugin = gamePlugin; } diff --git a/src/pluginlist.h b/src/pluginlist.h index 01d4bfbe..9fe6eeac 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -261,7 +261,7 @@ public slots: * @brief The currently managed game has changed * @param gamePlugin */ - void managedGameChanged(MOBase::IPluginGame *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const *gamePlugin); signals: @@ -347,7 +347,7 @@ private: QTemporaryFile m_TempFile; - MOBase::IPluginGame *m_GamePlugin; + MOBase::IPluginGame const *m_GamePlugin; }; diff --git a/src/settings.cpp b/src/settings.cpp index 61d6aaa3..95462c82 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -116,7 +116,7 @@ void Settings::registerAsNXMHandler(bool force) } } -void Settings::managedGameChanged(IPluginGame *gamePlugin) +void Settings::managedGameChanged(IPluginGame const *gamePlugin) { m_GamePlugin = gamePlugin; } diff --git a/src/settings.h b/src/settings.h index def1dc5c..b6f25a6d 100644 --- a/src/settings.h +++ b/src/settings.h @@ -299,7 +299,7 @@ public: public slots: - void managedGameChanged(MOBase::IPluginGame *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const *gamePlugin); private: @@ -420,7 +420,7 @@ private: static Settings *s_Instance; - MOBase::IPluginGame *m_GamePlugin; + MOBase::IPluginGame const *m_GamePlugin; QSettings m_Settings; -- cgit v1.3.1 From 82e6c98043bd18f5329e8b6d0a6f99c4d28cc0a2 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 26 Nov 2015 07:39:35 +0000 Subject: Replace last occurrence of GameInfo::getNexusGameID and remove a whole load of gameinfo.h includes --- src/browserdialog.cpp | 6 ++---- src/categories.cpp | 4 ++-- src/directoryrefresher.cpp | 1 - src/executableslist.cpp | 8 +++++--- src/executableslist.h | 5 +++-- src/installationmanager.cpp | 7 +++++-- src/mainwindow.cpp | 2 ++ src/modinfo.cpp | 1 - src/modlist.cpp | 5 +++-- src/nexusinterface.cpp | 1 + src/nexusinterface.h | 1 - src/nxmaccessmanager.cpp | 15 +++++++++++++-- src/nxmaccessmanager.h | 7 ++++++- src/organizercore.cpp | 1 + src/organizerproxy.cpp | 1 - src/pluginlist.cpp | 1 - src/settingsdialog.cpp | 3 +-- src/shared/fallout3info.h | 1 - src/shared/falloutnvinfo.h | 1 - src/shared/gameinfo.h | 33 +++++++++++++-------------------- src/shared/oblivioninfo.h | 1 - src/shared/skyriminfo.h | 1 - src/spawn.cpp | 8 +++++--- src/syncoverwritedialog.cpp | 3 ++- src/transfersavesdialog.cpp | 5 ++++- src/transfersavesdialog.h | 6 ++---- 26 files changed, 70 insertions(+), 58 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/browserdialog.cpp b/src/browserdialog.cpp index c382c112..bbdf95c5 100644 --- a/src/browserdialog.cpp +++ b/src/browserdialog.cpp @@ -18,18 +18,16 @@ along with Mod Organizer. If not, see . */ #include "browserdialog.h" + #include "ui_browserdialog.h" #include "browserview.h" - #include "messagedialog.h" #include "report.h" #include "persistentcookiejar.h" - #include "json.h" - #include -#include #include "settings.h" + #include #include #include diff --git a/src/categories.cpp b/src/categories.cpp index 400cc74b..59291a49 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -18,9 +18,10 @@ along with Mod Organizer. If not, see . */ #include "categories.h" + #include #include -#include + #include #include #include @@ -29,7 +30,6 @@ along with Mod Organizer. If not, see . using namespace MOBase; -using namespace MOShared; CategoryFactory* CategoryFactory::s_Instance = nullptr; diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index f4ad2a7d..4eac4103 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -23,7 +23,6 @@ along with Mod Organizer. If not, see . #include "utility.h" #include "report.h" #include "modinfo.h" -#include #include #include diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 2182a425..a4511ade 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -18,16 +18,18 @@ along with Mod Organizer. If not, see . */ #include "executableslist.h" -#include + +#include "iplugingame.h" +#include "utility.h" + #include #include #include -#include "utility.h" + #include using namespace MOBase; -using namespace MOShared; ExecutablesList::ExecutablesList() diff --git a/src/executableslist.h b/src/executableslist.h index 833829c8..3d5ba0ed 100644 --- a/src/executableslist.h +++ b/src/executableslist.h @@ -20,13 +20,14 @@ along with Mod Organizer. If not, see . #ifndef EXECUTABLESLIST_H #define EXECUTABLESLIST_H +#include "executableinfo.h" #include + #include #include -#include -#include +namespace MOBase { class IPluginGame; } /*! * @brief Information about an executable diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index a6af1a7f..4b3722b8 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -18,6 +18,7 @@ along with Mod Organizer. If not, see . */ #include "installationmanager.h" + #include "utility.h" #include "report.h" #include "categories.h" @@ -32,9 +33,9 @@ along with Mod Organizer. If not, see . #include "modinfo.h" #include #include -#include #include #include + #include #include #include @@ -42,11 +43,13 @@ along with Mod Organizer. If not, see . #include #include #include -#include #include #include #include #include + +#include + #include #include diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2d90d5b8..3a2da562 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -68,6 +68,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include "gameinfo.h" #include #include @@ -113,6 +114,7 @@ along with Mod Organizer. If not, see . #include #include #include + #ifndef Q_MOC_RUN #include #include diff --git a/src/modinfo.cpp b/src/modinfo.cpp index df34c00f..ef195bea 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -29,7 +29,6 @@ along with Mod Organizer. If not, see . #include "messagedialog.h" #include "filenamestring.h" -#include #include #include #include diff --git a/src/modlist.cpp b/src/modlist.cpp index 197250a3..9d7f32c8 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -24,15 +24,14 @@ along with Mod Organizer. If not, see . #include "qtgroupingproxy.h" #include "viewmarkingscrollbar.h" #include "modlistsortproxy.h" -#include #include #include #include + #include #include #include #include -#include #include #include #include @@ -44,7 +43,9 @@ along with Mod Organizer. If not, see . #include #include #include + #include +#include #include diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 078ca29d..8a7c88b6 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -555,6 +555,7 @@ void NexusInterface::requestTimeout() void NexusInterface::managedGameChanged(IPluginGame const *game) { m_Game = game; + m_AccessManager->managedGameChanged(game); } diff --git a/src/nexusinterface.h b/src/nexusinterface.h index 091b5446..807d0aec 100644 --- a/src/nexusinterface.h +++ b/src/nexusinterface.h @@ -21,7 +21,6 @@ along with Mod Organizer. If not, see . #define NEXUSINTERFACE_H #include -#include #include #include diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp index 0763bb71..08572d50 100644 --- a/src/nxmaccessmanager.cpp +++ b/src/nxmaccessmanager.cpp @@ -18,6 +18,8 @@ along with Mod Organizer. If not, see . */ #include "nxmaccessmanager.h" + +#include "iplugingame.h" #include "nxmurl.h" #include "report.h" #include "utility.h" @@ -26,6 +28,7 @@ along with Mod Organizer. If not, see . #include "settings.h" #include #include + #include #include #include @@ -127,9 +130,13 @@ void NXMAccessManager::startLoginCheck() void NXMAccessManager::retrieveCredentials() { qDebug("retrieving credentials"); - QNetworkRequest request(ToQString(GameInfo::instance().getNexusPage()) + + //This may be overkill as + //www.nexusmods.com/Core/Libs/Flamework/Entities/User?GetCredentials + //seems to work fine. + QNetworkRequest request(m_Game->getNexusManagementURL() + QString("/Core/Libs/Flamework/Entities/User?GetCredentials&game_id=%1" - ).arg(GameInfo::instance().getNexusGameID())); + ).arg(m_Game->getNexusGameID())); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setRawHeader("User-Agent", userAgent().toUtf8()); @@ -339,3 +346,7 @@ void NXMAccessManager::loginChecked() m_LoginReply = nullptr; } +void NXMAccessManager::managedGameChanged(MOBase::IPluginGame const *game) +{ + m_Game = game; +} diff --git a/src/nxmaccessmanager.h b/src/nxmaccessmanager.h index a03dbe36..2a016cad 100644 --- a/src/nxmaccessmanager.h +++ b/src/nxmaccessmanager.h @@ -27,6 +27,7 @@ along with Mod Organizer. If not, see . #include #include +namespace MOBase { class IPluginGame; } /** * @brief access manager extended to handle nxm links @@ -84,7 +85,9 @@ private slots: void loginError(QNetworkReply::NetworkError errorCode); void loginTimeout(); -public slots: +public: + //This would be a slot but the NexusInterface code calls this + void managedGameChanged(MOBase::IPluginGame const *game); protected: @@ -127,6 +130,8 @@ private: LOGIN_VALID } m_LoginState = LOGIN_NOT_CHECKED; + MOBase::IPluginGame const *m_Game; + }; #endif // NXMACCESSMANAGER_H diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 7473ec3e..66a3799a 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -162,6 +162,7 @@ OrganizerCore::OrganizerCore(const QSettings &initSettings) connect(NexusInterface::instance()->getAccessManager(), SIGNAL(loginSuccessful(bool)), this, SLOT(loginSuccessful(bool))); connect(NexusInterface::instance()->getAccessManager(), SIGNAL(loginFailed(QString)), this, SLOT(loginFailed(QString))); + //This seems awfully imperative connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame const *)), &m_Settings, SLOT(managedGameChanged(MOBase::IPluginGame const *))); connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame const *)), &m_DownloadManager, SLOT(managedGameChanged(MOBase::IPluginGame const *))); connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame const *)), &m_PluginList, SLOT(managedGameChanged(MOBase::IPluginGame const *))); diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index fdc60a27..ba07c154 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -1,6 +1,5 @@ #include "organizerproxy.h" -#include #include #include diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 48b27f05..7a609374 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -24,7 +24,6 @@ along with Mod Organizer. If not, see . #include "scopeguard.h" #include "modinfo.h" #include -#include #include #include #include diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 36e177ab..c7f15dc9 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -24,19 +24,18 @@ along with Mod Organizer. If not, see . #include "helper.h" #include "noeditdelegate.h" #include "iplugingame.h" -#include #include "settings.h" #include #include #include #include + #define WIN32_LEAN_AND_MEAN #include using namespace MOBase; -using namespace MOShared; SettingsDialog::SettingsDialog(QWidget *parent) diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index b5585eaf..e6064825 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -50,7 +50,6 @@ public: virtual std::wstring getReferenceDataFile(); virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual int getNexusGameID() { return 120; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index 40e11720..aa187fb3 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -50,7 +50,6 @@ public: virtual std::wstring getReferenceDataFile(); virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual int getNexusGameID() { return 130; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index 45069165..b6a4f142 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -47,29 +47,30 @@ public: TYPE_SKYRIM }; - enum LoadOrderMechanism { - TYPE_FILETIME, - TYPE_PLUGINSTXT - }; - public: virtual ~GameInfo() {} - //**USED ONLY IN HOOKDLL - virtual std::wstring getRegPath() = 0; - //**Used only in savegame which needs refactoring a lot. virtual GameInfo::Type getType() = 0; + //**Used only in savegame which needs refactoring a lot. + // get a list of file extensions for additional files belonging to a save game + virtual std::vector getSavegameAttachmentExtensions() = 0; + //**Currently only used in a nasty mess at initialisation time. virtual std::wstring getGameName() const = 0; //**USED IN HOOKDLL and in initialisation virtual std::wstring getGameDirectory() const; - // get a list of file extensions for additional files belonging to a save game - virtual std::vector getSavegameAttachmentExtensions() = 0; + //**USED IN HOOKDLL and initialisation + // initialise with the path to the mo directory (needs to be where hook.dll is stored). This + // needs to be called before the instance can be retrieved + static bool init(const std::wstring &moDirectory, const std::wstring &gamePath = L""); + + //**USED ONLY IN HOOKDLL + virtual std::wstring getRegPath() = 0; //**USED ONLY IN HOOKDLL // file name of this games ini file(s) @@ -78,20 +79,12 @@ public: //**USED ONLY IN HOOKDLL virtual std::wstring getReferenceDataFile() = 0; - virtual std::wstring getNexusPage(bool nmmScheme = true) = 0; - virtual int getNexusGameID() = 0; - //**USED ONLY IN HOOKDLL virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) = 0; -public: - - //**USED IN HOOKDLL - // initialise with the path to the mo directory (needs to be where hook.dll is stored). This - // needs to be called before the instance can be retrieved - static bool init(const std::wstring &moDirectory, const std::wstring &gamePath = L""); + virtual std::wstring getNexusPage(bool nmmScheme = true) = 0; - //**USED IN HOOKDLL + //**USED IN HOOKDLL and everywhere that uses GameInfo static GameInfo& instance(); protected: diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index b6b3d867..f9045703 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -48,7 +48,6 @@ public: virtual std::wstring getReferenceDataFile(); virtual std::wstring getNexusPage(bool nmmScheme = true); - virtual int getNexusGameID() { return 101; } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index ee81ace3..47a35b3e 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -52,7 +52,6 @@ public: virtual std::wstring getNexusPage(bool nmmScheme = true); static int getNexusGameIDStatic() { return 110; } - virtual int getNexusGameID() { return getNexusGameIDStatic(); } virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath); diff --git a/src/spawn.cpp b/src/spawn.cpp index c79714bb..49e89a8b 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -18,18 +18,20 @@ along with Mod Organizer. If not, see . */ #include "spawn.h" + #include "report.h" #include "utility.h" -#include -#include #include #include -#include #include #include + #include #include +#include + +#include using namespace MOBase; using namespace MOShared; diff --git a/src/syncoverwritedialog.cpp b/src/syncoverwritedialog.cpp index 0e3e98d7..aeed0a55 100644 --- a/src/syncoverwritedialog.cpp +++ b/src/syncoverwritedialog.cpp @@ -18,10 +18,11 @@ along with Mod Organizer. If not, see . */ #include "syncoverwritedialog.h" + #include "ui_syncoverwritedialog.h" #include #include -#include + #include #include #include diff --git a/src/transfersavesdialog.cpp b/src/transfersavesdialog.cpp index d47d2bb0..4cb20944 100644 --- a/src/transfersavesdialog.cpp +++ b/src/transfersavesdialog.cpp @@ -18,12 +18,15 @@ along with Mod Organizer. If not, see . */ #include "transfersavesdialog.h" + #include "ui_transfersavesdialog.h" +#include "iplugingame.h" #include "savegamegamebyro.h" #include "utility.h" -#include + #include #include + #include #include diff --git a/src/transfersavesdialog.h b/src/transfersavesdialog.h index d9ea5b29..e2c556b4 100644 --- a/src/transfersavesdialog.h +++ b/src/transfersavesdialog.h @@ -22,11 +22,9 @@ along with Mod Organizer. If not, see . #include "tutorabledialog.h" #include "profile.h" -#include -namespace Ui { -class TransferSavesDialog; -} +namespace Ui { class TransferSavesDialog; } +namespace MOBase { class IPluginGame; } class SaveGame; -- cgit v1.3.1 From 9e2bcffc32157b99a2d7364b869a4423ba827a32 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 28 Nov 2015 14:53:32 +0000 Subject: Reworked startup considerably so now no longer dependant on GameInfo Did some const correctness to the "managed_game" property as you shouldn't really be altering the plugin details whilst MO is running --- src/directoryrefresher.cpp | 2 +- src/loadmechanism.cpp | 14 ++-- src/main.cpp | 204 ++++++++++++++++++++++++++++++--------------- src/modinfo.cpp | 6 +- src/organizercore.cpp | 18 ++-- src/organizercore.h | 5 +- src/settingsdialog.cpp | 2 +- src/shared/fallout3info.h | 2 - src/shared/falloutnvinfo.h | 2 - src/shared/gameinfo.h | 7 +- src/shared/oblivioninfo.h | 2 - src/shared/skyriminfo.h | 2 - 12 files changed, 156 insertions(+), 110 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index 4eac4103..f50a717e 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -144,7 +144,7 @@ void DirectoryRefresher::refresh() m_DirectoryStructure = new DirectoryEntry(L"data", nullptr, 0); - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); std::wstring dataDirectory = QDir::toNativeSeparators(game->dataDirectory().absolutePath()).toStdWString(); m_DirectoryStructure->addFromOrigin(L"data", dataDirectory, 0); diff --git a/src/loadmechanism.cpp b/src/loadmechanism.cpp index 0d95c51c..521473b0 100644 --- a/src/loadmechanism.cpp +++ b/src/loadmechanism.cpp @@ -65,7 +65,7 @@ void LoadMechanism::removeHintFile(QDir &targetDirectory) bool LoadMechanism::isDirectLoadingSupported() { //FIXME: Seriously? isn't there a 'do i need steam' thing? - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); if (game->gameName().compare("oblivion", Qt::CaseInsensitive) == 0) { // oblivion can be loaded directly if it's not the steam variant return !game->gameDirectory().exists("steam_api.dll"); @@ -77,7 +77,7 @@ bool LoadMechanism::isDirectLoadingSupported() bool LoadMechanism::isScriptExtenderSupported() { - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); ScriptExtender *extender = game->feature(); // test if there even is an extender for the managed game and if so whether it's installed @@ -93,7 +93,7 @@ bool LoadMechanism::isProxyDLLSupported() // plus: the proxy dll hasn't been working for at least the whole 1.12.x versions of MO and // noone reported it so why maintain an unused feature? return false; -/* IPluginGame *game = qApp->property("managed_game").value(); +/* IPluginGame const *game = qApp->property("managed_game").value(); return game->gameDirectory().exists(QString::fromStdWString(AppConfig::proxyDLLTarget()));*/ } @@ -125,7 +125,7 @@ bool LoadMechanism::hashIdentical(const QString &fileNameLHS, const QString &fil void LoadMechanism::deactivateScriptExtender() { try { - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); ScriptExtender *extender = game->feature(); if (extender == nullptr) { throw MyException(QObject::tr("game doesn't support a script extender")); @@ -151,7 +151,7 @@ void LoadMechanism::deactivateScriptExtender() void LoadMechanism::deactivateProxyDLL() { try { - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); QString targetPath = game->gameDirectory().absoluteFilePath(QString::fromStdWString(AppConfig::proxyDLLTarget())); @@ -180,7 +180,7 @@ void LoadMechanism::deactivateProxyDLL() void LoadMechanism::activateScriptExtender() { try { - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); ScriptExtender *extender = game->feature(); if (extender == nullptr) { throw MyException(QObject::tr("game doesn't support a script extender")); @@ -220,7 +220,7 @@ void LoadMechanism::activateScriptExtender() void LoadMechanism::activateProxyDLL() { try { - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); QString targetPath = game->gameDirectory().absoluteFilePath(QString::fromStdWString(AppConfig::proxyDLLTarget())); diff --git a/src/main.cpp b/src/main.cpp index 72a63dc6..78145a74 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -330,6 +330,122 @@ QString determineProfile(QStringList &arguments, const QSettings &settings) return selectedProfileName; } +MOBase::IPluginGame *selectGame(QSettings &settings, QDir const &gamePath, MOBase::IPluginGame *game) +{ + settings.setValue("gameName", game->gameName()); + if (gamePath == game->gameDirectory()) { + settings.remove("gamePath"); + } else { + QString gameDir = gamePath.absolutePath(); + game->setGamePath(gameDir); + settings.setValue("gamePath", QDir::toNativeSeparators(gameDir).toUtf8().constData()); + } + return game; //Woot +} + + +MOBase::IPluginGame *determineCurrentGame(QString const &moPath, QSettings &settings, PluginContainer const &plugins) +{ + //Determine what game we are running where. Be very paranoid in case the + //user has done something odd. + //If the game name has been set up, use that. + QString gameName = settings.value("gameName", "").toString(); + if (!gameName.isEmpty()) { + MOBase::IPluginGame *game = plugins.managedGame(gameName); + if (game == nullptr) { + reportError(QObject::tr("Plugin to handle %1 no longer installed").arg(gameName)); + return nullptr; + } + QString gamePath = QString::fromUtf8(settings.value("gamePath", "").toByteArray()); + if (gamePath == "") { + gamePath = game->gameDirectory().absolutePath(); + } + QDir gameDir(gamePath); + if (game->looksValid(gameDir)) { + return selectGame(settings, gameDir, game); + } + } + + //gameName wasn't set, or otherwise can't be found. Try looking through all + //the plugins using the gamePath + QString gamePath = QString::fromUtf8(settings.value("gamePath", "").toByteArray()); + if (!gamePath.isEmpty()) { + QDir gameDir(gamePath); + //Look to see if one of the installed games binary file exists in the current + //game directory. + for (IPluginGame * const game : plugins.plugins()) { + if (game->looksValid(gameDir)) { + return selectGame(settings, gameDir, game); + } + } + } + + //OK, we are in a new setup or existing info is useless. + //See if MO has been installed inside a game directory + for (IPluginGame * const game : plugins.plugins()) { + if (game->isInstalled() && moPath.startsWith(game->gameDirectory().absolutePath())) { + //Found it. + return selectGame(settings, game->gameDirectory(), game); + } + } + + //Try walking up the directory tree to see if MO has been installed inside a game + { + QDir gameDir(moPath); + do { + //Look to see if one of the installed games binary file exists in the current + //directory. + for (IPluginGame * const game : plugins.plugins()) { + if (game->looksValid(gameDir)) { + return selectGame(settings, gameDir, game); + } + } + //OK, chop off the last directory and try again + } while (gameDir.cdUp()); + } + + //Then try a selection dialogue. + if (!gamePath.isEmpty() || !gameName.isEmpty()) { + reportError(QObject::tr("Could not use configuration settings for game \"%1\", path \"%2\"."). + arg(gameName).arg(gamePath)); + } + + SelectionDialog selection(QObject::tr("Please select the game to manage"), nullptr, QSize(32, 32)); + + for (IPluginGame *game : plugins.plugins()) { + if (game->isInstalled()) { + QString path = game->gameDirectory().absolutePath(); + selection.addChoice(game->gameIcon(), game->gameName(), path, QVariant::fromValue(game)); + } + } + + selection.addChoice(QString("Browse..."), QString(), QVariant::fromValue(static_cast(nullptr))); + + while (selection.exec() != QDialog::Rejected) { + IPluginGame * game = selection.getChoiceData().value(); + if (game != nullptr) { + return selectGame(settings, game->gameDirectory(), game); + } + + gamePath = QFileDialog::getExistingDirectory( + nullptr, QObject::tr("Please select the game to manage"), QString(), + QFileDialog::ShowDirsOnly); + + if (!gamePath.isEmpty()) { + QDir gameDir(gamePath); + for (IPluginGame * const game : plugins.plugins()) { + if (game->looksValid(gameDir)) { + return selectGame(settings, gameDir, game); + } + } + reportError(QObject::tr("No game identified in \"%1\". The directory is required to contain " + "the game binary and its launcher.").arg(gamePath)); + } + } + + return nullptr; +} + int main(int argc, char *argv[]) { MOApplication application(argc, argv); @@ -443,86 +559,36 @@ int main(int argc, char *argv[]) PluginContainer pluginContainer(&organizer); pluginContainer.loadPlugins(); - QString gamePath = QString::fromUtf8(settings.value("gamePath", "").toByteArray()); - bool done = false; - while (!done) { - if (!GameInfo::init(ToWString(application.applicationDirPath()), ToWString(QDir::toNativeSeparators(gamePath)))) { - if (!gamePath.isEmpty()) { - reportError(QObject::tr("No game identified in \"%1\". The directory is required to contain " - "the game binary and its launcher.").arg(gamePath)); - } - SelectionDialog selection(QObject::tr("Please select the game to manage"), nullptr, QSize(32, 32)); - - for (const IPluginGame * const game : pluginContainer.plugins()) { - if (game->isInstalled()) { - QString path = game->gameDirectory().absolutePath(); - selection.addChoice(game->gameIcon(), game->gameName(), path, path); - } - } - - selection.addChoice(QString("Browse..."), QString(), QString()); - - if (selection.exec() == QDialog::Rejected) { - gamePath = ""; - done = true; - } else { - gamePath = QDir::cleanPath(selection.getChoiceData().toString()); - if (gamePath.isEmpty()) { - gamePath = QFileDialog::getExistingDirectory( - nullptr, QObject::tr("Please select the game to manage"), QString(), - QFileDialog::ShowDirsOnly); - qDebug() << "manually selected path " << gamePath; - } - } - } else { - done = true; - gamePath = ToQString(GameInfo::instance().getGameDirectory()); - } - } - - if (gamePath.isEmpty()) { - // game not found and user canceled - return -1; - } else if (gamePath.length() != 0) { - // user selected a folder and game was initialised with it - qDebug("game path: %s", qPrintable(gamePath)); - settings.setValue("gamePath", gamePath.toUtf8().constData()); + MOBase::IPluginGame *game = determineCurrentGame(application.applicationDirPath(), settings, pluginContainer); + if (game == nullptr) { + return 1; } - organizer.setManagedGame(ToQString(GameInfo::instance().getGameName()), gamePath); + organizer.setManagedGame(game); organizer.createDefaultProfile(); - if (pluginContainer.managedGame(ToQString(GameInfo::instance().getGameName())) == nullptr) { - reportError(QObject::tr("Plugin to handle %1 not installed").arg(ToQString(GameInfo::instance().getGameName()))); - return 1; - } - - //This is probably wrong too - { - IPluginGame *game = organizer.managedGameForUpdate(); - - if (!settings.contains("game_edition")) { - QStringList editions = game->gameVariants(); - if (editions.size() > 1) { - SelectionDialog selection(QObject::tr("Please select the game edition you have (MO can't start the game correctly if this is set incorrectly!)"), nullptr); - int index = 0; - for (const QString &edition : editions) { - selection.addChoice(edition, "", index++); - } - if (selection.exec() == QDialog::Rejected) { - return -1; - } else { - settings.setValue("game_edition", selection.getChoiceString()); - } + //See the pragma - we apparently don't use this so not sure why we check it + if (!settings.contains("game_edition")) { + QStringList editions = game->gameVariants(); + if (editions.size() > 1) { + SelectionDialog selection(QObject::tr("Please select the game edition you have (MO can't start the game correctly if this is set incorrectly!)"), nullptr); + int index = 0; + for (const QString &edition : editions) { + selection.addChoice(edition, "", index++); + } + if (selection.exec() == QDialog::Rejected) { + return -1; + } else { + settings.setValue("game_edition", selection.getChoiceString()); } } - game->setGameVariant(settings.value("game_edition").toString()); } + game->setGameVariant(settings.value("game_edition").toString()); #pragma message("edition isn't used?") - qDebug("managing game at %s", qPrintable(QDir::toNativeSeparators(gamePath))); + qDebug("managing game at %s", qPrintable(QDir::toNativeSeparators(game->gameDirectory().absolutePath()))); organizer.updateExecutablesList(settings); diff --git a/src/modinfo.cpp b/src/modinfo.cpp index ef195bea..03ab9a95 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -290,7 +290,7 @@ int ModInfo::checkAllForUpdate(QObject *receiver) std::vector modIDs; //I ought to store this, it's used elsewhere - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); modIDs.push_back(game->getNexusModOrganizerID()); @@ -935,7 +935,7 @@ std::vector ModInfoRegular::getContents() const m_CachedContent.push_back(CONTENT_BSA); } - ScriptExtender *extender = qApp->property("managed_game").value()->feature(); + ScriptExtender *extender = qApp->property("managed_game").value()->feature(); if (extender != nullptr) { QString sePluginPath = extender->name() + "/plugins"; @@ -1137,7 +1137,7 @@ QDateTime ModInfoForeign::creationTime() const QString ModInfoForeign::absolutePath() const { //I ought to store this, it's used elsewhere - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); return game->dataDirectory().absolutePath(); } diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 042a9f1e..06a6dba4 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -422,15 +422,12 @@ void OrganizerCore::disconnectPlugins() m_PluginContainer = nullptr; } -void OrganizerCore::setManagedGame(const QString &gameName, const QString &gamePath) +void OrganizerCore::setManagedGame(MOBase::IPluginGame const *game) { - m_GameName = gameName; - if (m_PluginContainer != nullptr) { - m_GamePlugin = m_PluginContainer->managedGame(m_GameName); - m_GamePlugin->setGamePath(gamePath); - qApp->setProperty("managed_game", QVariant::fromValue(m_GamePlugin)); - emit managedGameChanged(m_GamePlugin); - } + m_GameName = game->gameName(); + m_GamePlugin = game; + qApp->setProperty("managed_game", QVariant::fromValue(m_GamePlugin)); + emit managedGameChanged(m_GamePlugin); } Settings &OrganizerCore::settings() @@ -1327,11 +1324,6 @@ IPluginGame const *OrganizerCore::managedGame() const return m_GamePlugin; } -IPluginGame *OrganizerCore::managedGameForUpdate() const -{ - return m_GamePlugin; -} - std::vector OrganizerCore::enabledArchives() { std::vector result; diff --git a/src/organizercore.h b/src/organizercore.h index c206e5e7..5cfbaca4 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -73,7 +73,7 @@ public: void connectPlugins(PluginContainer *container); void disconnectPlugins(); - void setManagedGame(const QString &gameName, const QString &gamePath); + void setManagedGame(const MOBase::IPluginGame *game); void updateExecutablesList(QSettings &settings); @@ -100,7 +100,6 @@ public: PluginListSortProxy *createPluginListProxyModel(); MOBase::IPluginGame const *managedGame() const; - MOBase::IPluginGame *managedGameForUpdate() const; bool isArchivesInit() const { return m_ArchivesInit; } @@ -234,7 +233,7 @@ private: IUserInterface *m_UserInterface; PluginContainer *m_PluginContainer; QString m_GameName; - MOBase::IPluginGame *m_GamePlugin; + MOBase::IPluginGame const *m_GamePlugin; Profile *m_CurrentProfile; diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index c7f15dc9..8bc1dbc6 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -89,7 +89,7 @@ void SettingsDialog::on_categoriesBtn_clicked() void SettingsDialog::on_bsaDateBtn_clicked() { - IPluginGame *game = qApp->property("managed_game").value(); + IPluginGame const *game = qApp->property("managed_game").value(); QDir dir = game->dataDirectory(); Helper::backdateBSAs(qApp->property("dataPath").toString().toStdWString(), diff --git a/src/shared/fallout3info.h b/src/shared/fallout3info.h index ed525588..69eb9c45 100644 --- a/src/shared/fallout3info.h +++ b/src/shared/fallout3info.h @@ -40,8 +40,6 @@ public: virtual GameInfo::Type getType() { return TYPE_FALLOUT3; } - virtual std::wstring getGameName() const { return L"Fallout 3"; } - virtual std::vector getSavegameAttachmentExtensions(); // file name of this games ini (no path) diff --git a/src/shared/falloutnvinfo.h b/src/shared/falloutnvinfo.h index ee67ac17..a7ee089e 100644 --- a/src/shared/falloutnvinfo.h +++ b/src/shared/falloutnvinfo.h @@ -40,8 +40,6 @@ public: virtual GameInfo::Type getType() { return TYPE_FALLOUTNV; } - virtual std::wstring getGameName() const { return L"New Vegas"; } - virtual std::vector getSavegameAttachmentExtensions(); // file name of this games ini (no path) diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index de3af8b4..55161952 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -58,13 +58,10 @@ public: // get a list of file extensions for additional files belonging to a save game virtual std::vector getSavegameAttachmentExtensions() = 0; - //**Currently only used in a nasty mess at initialisation time. - virtual std::wstring getGameName() const = 0; - - //**USED IN HOOKDLL and in initialisation + //**USED IN HOOKDLL virtual std::wstring getGameDirectory() const; - //**USED IN HOOKDLL and initialisation + //**USED IN HOOKDLL // initialise with the path to the mo directory (needs to be where hook.dll is stored). This // needs to be called before the instance can be retrieved static bool init(const std::wstring &moDirectory, const std::wstring &gamePath = L""); diff --git a/src/shared/oblivioninfo.h b/src/shared/oblivioninfo.h index 00048930..e0a861bf 100644 --- a/src/shared/oblivioninfo.h +++ b/src/shared/oblivioninfo.h @@ -38,8 +38,6 @@ public: virtual GameInfo::Type getType() { return TYPE_OBLIVION; } - virtual std::wstring getGameName() const { return L"Oblivion"; } - virtual std::vector getSavegameAttachmentExtensions(); // file name of this games ini (no path) diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h index afba1974..17b542ab 100644 --- a/src/shared/skyriminfo.h +++ b/src/shared/skyriminfo.h @@ -40,8 +40,6 @@ public: virtual GameInfo::Type getType() { return TYPE_SKYRIM; } - virtual std::wstring getGameName() const { return L"Skyrim"; } - virtual std::vector getSavegameAttachmentExtensions(); // file name of this games ini (no path) -- cgit v1.3.1