summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp4
-rw-r--r--src/organizercore.cpp5
-rw-r--r--src/pluginlist.cpp11
-rw-r--r--src/pluginlist.h12
-rw-r--r--src/shared/gameinfo.h4
-rw-r--r--src/shared/skyriminfo.cpp18
-rw-r--r--src/shared/skyriminfo.h2
7 files changed, 25 insertions, 31 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c08993c1..1651d0c6 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -4527,12 +4527,12 @@ void MainWindow::on_bossButton_clicked()
// if the game specifies load order by file time, our own load order file needs to be removed because it's outdated.
// refreshESPList will then use the file time as the load order.
- if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) {
+ if (m_OrganizerCore.managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
qDebug("removing loadorder.txt");
QFile::remove(m_OrganizerCore.currentProfile()->getLoadOrderFileName());
}
m_OrganizerCore.refreshESPList();
- if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) {
+ if (m_OrganizerCore.managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
// the load order should have been retrieved from file time, now save it to our own format
m_OrganizerCore.savePluginList();
}
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index c81a473c..24077923 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -160,6 +160,7 @@ OrganizerCore::OrganizerCore(const QSettings &initSettings)
connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame*)), &m_Settings, SLOT(managedGameChanged(MOBase::IPluginGame*)));
connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame*)), &m_DownloadManager, SLOT(managedGameChanged(MOBase::IPluginGame*)));
+ connect(this, SIGNAL(managedGameChanged(MOBase::IPluginGame*)), &m_PluginList, SLOT(managedGameChanged(MOBase::IPluginGame*)));
connect(&m_PluginList, &PluginList::writePluginsList, &m_PluginListsWriter, &DelayedFileWriterBase::write);
@@ -920,12 +921,12 @@ void OrganizerCore::spawnBinary(const QFileInfo &binary, const QString &argument
refreshDirectoryStructure();
// need to remove our stored load order because it may be outdated if a foreign tool changed the
// file time. After removing that file, refreshESPList will use the file time as the order
- if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) {
+ if (managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
qDebug("removing loadorder.txt");
QFile::remove(m_CurrentProfile->getLoadOrderFileName());
}
refreshESPList();
- if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) {
+ if (managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
// the load order should have been retrieved from file time, now save it to our own format
savePluginList();
}
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index e7d493a7..6f883645 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -128,7 +128,7 @@ void PluginList::refresh(const QString &profileName
m_ESPsByPriority.clear();
m_ESPs.clear();
- QStringList primaryPlugins = qApp->property("managed_game").value<IPluginGame*>()->getPrimaryPlugins();
+ QStringList primaryPlugins = m_GamePlugin->getPrimaryPlugins();
m_CurrentProfile = profileName;
@@ -313,7 +313,7 @@ bool PluginList::readLoadOrder(const QString &fileName)
int priority = 0;
- QStringList primaryPlugins = qApp->property("managed_game").value<IPluginGame*>()->getPrimaryPlugins();
+ QStringList primaryPlugins = m_GamePlugin->getPrimaryPlugins();
for (const QString &plugin : primaryPlugins) {
if (availableESPs.find(plugin) != availableESPs.end()) {
m_ESPLoadOrder[plugin] = priority++;
@@ -504,7 +504,7 @@ void PluginList::saveTo(const QString &pluginFileName
bool PluginList::saveLoadOrder(DirectoryEntry &directoryStructure)
{
- if (GameInfo::instance().getLoadOrderMechanism() != GameInfo::TYPE_FILETIME) {
+ if (m_GamePlugin->getLoadOrderMechanism() != IPluginGame::LoadOrderMechanism::FileTime) {
// nothing to do
return true;
}
@@ -1210,3 +1210,8 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled,
m_IsDummy = false;
}
}
+
+void PluginList::managedGameChanged(IPluginGame *gamePlugin)
+{
+ m_GamePlugin = gamePlugin;
+}
diff --git a/src/pluginlist.h b/src/pluginlist.h
index f8972f05..01d4bfbe 100644
--- a/src/pluginlist.h
+++ b/src/pluginlist.h
@@ -22,16 +22,20 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <directoryentry.h>
#include <ipluginlist.h>
+namespace MOBase { class IPluginGame; }
+
#include <QString>
#include <QListWidget>
#include <QTimer>
#include <QTemporaryFile>
+
#pragma warning(push)
#pragma warning(disable: 4100)
#ifndef Q_MOC_RUN
#include <boost/signals2.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#endif
+
#include <vector>
#include <map>
@@ -253,6 +257,12 @@ public slots:
**/
void disableAll();
+ /**
+ * @brief The currently managed game has changed
+ * @param gamePlugin
+ */
+ void managedGameChanged(MOBase::IPluginGame *gamePlugin);
+
signals:
/**
@@ -337,6 +347,8 @@ private:
QTemporaryFile m_TempFile;
+ MOBase::IPluginGame *m_GamePlugin;
+
};
#pragma warning(pop)
diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h
index c3fec128..06b96d61 100644
--- a/src/shared/gameinfo.h
+++ b/src/shared/gameinfo.h
@@ -65,10 +65,6 @@ public:
//**Currently only used in a nasty mess at initialisation time.
virtual std::wstring getGameName() const = 0;
- /// determine the load order mechanism used by this game. this may throw an
- /// exception if the mechanism can't be determined
- virtual LoadOrderMechanism getLoadOrderMechanism() const { return TYPE_FILETIME; }
-
//**USED IN HOOKDLL
virtual std::wstring getGameDirectory() const;
diff --git a/src/shared/skyriminfo.cpp b/src/shared/skyriminfo.cpp
index 189d2ed0..f7fba7ab 100644
--- a/src/shared/skyriminfo.cpp
+++ b/src/shared/skyriminfo.cpp
@@ -73,24 +73,6 @@ std::wstring SkyrimInfo::getRegPathStatic()
}
}
-GameInfo::LoadOrderMechanism SkyrimInfo::getLoadOrderMechanism() const
-{
- std::wstring fileName = getGameDirectory() + L"\\TESV.exe";
-
- try {
- VS_FIXEDFILEINFO versionInfo = GetFileVersion(fileName);
- if ((versionInfo.dwFileVersionMS > 0x10004) || // version >= 1.5.x?
- ((versionInfo.dwFileVersionMS == 0x10004) && (versionInfo.dwFileVersionLS >= 0x1A0000))) { // version >= ?.4.26
- return TYPE_PLUGINSTXT;
- } else {
- return TYPE_FILETIME;
- }
- } catch (const std::exception &e) {
- log("TESV.exe is invalid: %s", e.what());
- return TYPE_FILETIME;
- }
-}
-
std::vector<std::wstring> SkyrimInfo::getSavegameAttachmentExtensions()
{
return boost::assign::list_of(L"skse");
diff --git a/src/shared/skyriminfo.h b/src/shared/skyriminfo.h
index 1bf67c11..13c82456 100644
--- a/src/shared/skyriminfo.h
+++ b/src/shared/skyriminfo.h
@@ -42,8 +42,6 @@ public:
virtual std::wstring getGameName() const { return L"Skyrim"; }
- virtual LoadOrderMechanism getLoadOrderMechanism() const;
-
virtual std::vector<std::wstring> getSavegameAttachmentExtensions();
// file name of this games ini (no path)