From 86d2ce34f3bfb8b8dae84dce2630ba37b2835ad7 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 8 Nov 2015 23:15:55 +0000 Subject: [PATCH 01/15] Fix compilation issues with clang, requires adding widgets to build --- src/runner/SConscript | 2 +- src/runner/proxypluginwrappers.cpp | 1 + src/runner/pythonRunner.pro | 1 + src/runner/pythonrunner.cpp | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runner/SConscript b/src/runner/SConscript index 5d2eab3..0f25b4e 100644 --- a/src/runner/SConscript +++ b/src/runner/SConscript @@ -2,7 +2,7 @@ Import('qt_env') env = qt_env.Clone() -env.EnableQtModules('Core', 'Gui') +env.EnableQtModules('Core', 'Gui', 'Widgets') env.AppendUnique(CPPDEFINES = 'PYTHONRUNNER_LIBRARY') diff --git a/src/runner/proxypluginwrappers.cpp b/src/runner/proxypluginwrappers.cpp index b5d3b6a..49d458c 100644 --- a/src/runner/proxypluginwrappers.cpp +++ b/src/runner/proxypluginwrappers.cpp @@ -2,6 +2,7 @@ #include #include "error.h" #include "gilock.h" +#include namespace bpy = boost::python; diff --git a/src/runner/pythonRunner.pro b/src/runner/pythonRunner.pro index 34c26b7..e1409e5 100644 --- a/src/runner/pythonRunner.pro +++ b/src/runner/pythonRunner.pro @@ -9,6 +9,7 @@ TEMPLATE = lib CONFIG += dll CONFIG += warn_on +QT += widgets DEFINES += PYTHONRUNNER_LIBRARY diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index bdc85f0..47b3881 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -11,6 +11,7 @@ #include #include #include +#include // sip and qt slots seems to conflict #include @@ -905,7 +906,7 @@ bool handled_exec_file(bpy::str filename, bpy::object globals = bpy::object(), b #define TRY_PLUGIN_TYPE(type, var) do { \ - bpy::extract extr(var); \ + bpy::extract extr(var); \ if (extr.check()) { \ QObject *res = extr; \ return res; \ From 07798f2e23b35e0963c760a247b96518cfc34ea9 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Mon, 9 Nov 2015 18:14:57 +0000 Subject: [PATCH 02/15] More changes suggested by compiling with clang --- src/runner/pythonrunner.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 47b3881..52fe60f 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -243,7 +243,9 @@ struct QVariant_from_python_obj } else if (PyBool_Check(objPtr)) { result = (objPtr == Py_True); } else if (PyInt_Check(objPtr)) { - result = PyInt_AsLong(objPtr); + //QVariant doesn't have long. It has int or long long. Given that on m/s, + //long is 32 bits for 32- and 64- bit code... + result = static_cast(PyInt_AsLong(objPtr)); } else { PyErr_SetString(PyExc_TypeError, "type unsupported"); throw bpy::error_already_set(); @@ -267,7 +269,9 @@ struct QVariant_from_python_obj bool value = (objPtr == Py_True); constructVariant(value, data); } else if (PyInt_Check(objPtr)) { - long value = PyInt_AsLong(objPtr); + //QVariant doesn't have long. It has int or long long. Given that on m/s, + //long is 32 bits for 32- and 64- bit code... + int value = static_cast(PyInt_AsLong(objPtr)); constructVariant(value, data); } else { PyErr_SetString(PyExc_TypeError, "type unsupported"); From 542ef73a30bef580cffcc15f69e5c0273e9f73ab Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 21 Nov 2015 12:28:48 +0000 Subject: [PATCH 03/15] Removal of (get)BinaryName. Note in pythonrunner this is a bit commented out so I can think about how to deal with it. --- src/runner/pythonrunner.cpp | 5 ++++- src/runner/uibasewrappers.h | 13 +++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 52fe60f..ae22889 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -3,10 +3,12 @@ #pragma warning( disable : 4100 ) #pragma warning( disable : 4996 ) +#include "iplugingame.h" #include #include "uibasewrappers.h" #include "pythonpluginwrapper.h" #include "proxypluginwrappers.h" + #include #include #include @@ -706,7 +708,7 @@ BOOST_PYTHON_MODULE(mobase) bpy::class_("GameInfo") .def("type", bpy::pure_virtual(&IGameInfo::type)) .def("path", bpy::pure_virtual(&IGameInfo::path)) - .def("binaryName", bpy::pure_virtual(&IGameInfo::binaryName)) +// .def("binaryName", bpy::pure_virtual(&IGameInfo::binaryName)) ; bpy::class_("IOrganizer") @@ -735,6 +737,7 @@ BOOST_PYTHON_MODULE(mobase) .def("onFinishedRun", bpy::pure_virtual(&IOrganizer::onFinishedRun)) .def("onModInstalled", bpy::pure_virtual(&IOrganizer::onModInstalled)) .def("refreshModList", bpy::pure_virtual(&IOrganizer::refreshModList)) + .def("managedGame", bpy::pure_virtual(&IOrganizer::managedGame), bpy::return_value_policy()) ; bpy::class_("ModRepositoryBridge") diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 7c0edd2..7c820cc 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -21,7 +21,7 @@ #include "error.h" #include "gilock.h" - +namespace MOBase { class IPluginGame; } extern MOBase::IOrganizer *s_Organizer; @@ -208,7 +208,7 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapperget_override("downloadsPath")(); } virtual QString overwritePath() const { return this->get_override("overwritePath")(); } virtual MOBase::VersionInfo appVersion() const { return this->get_override("appVersion")(); } - virtual MOBase::IModInterface *getMod(const QString &name) { return this->get_override("getMod")(name); } + virtual MOBase::IModInterface *getMod(const QString &name) const { return this->get_override("getMod")(name); } virtual MOBase::IModInterface *createMod(MOBase::GuessedValue &name) { return this->get_override("createMod")(name); } virtual bool removeMod(MOBase::IModInterface *mod) { return this->get_override("removeMod")(mod); } virtual void modDataChanged(MOBase::IModInterface *mod) { this->get_override("modDataChanged")(mod); } @@ -218,9 +218,9 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapperget_override("setPersistent")(pluginName, key, value, sync); } virtual QString pluginDataPath() const { return this->get_override("pluginDataPath")(); } virtual MOBase::IModInterface *installMod(const QString &fileName, const QString &nameSuggestion = QString()) { return this->get_override("installMod")(fileName, nameSuggestion); } - virtual MOBase::IDownloadManager *downloadManager() { return this->get_override("downloadManager")(); } - virtual MOBase::IPluginList *pluginList() { return this->get_override("pluginList")(); } - virtual MOBase::IModList *modList() { return this->get_override("modList")(); } + virtual MOBase::IDownloadManager *downloadManager() const { return this->get_override("downloadManager")(); } + virtual MOBase::IPluginList *pluginList() const { return this->get_override("pluginList")(); } + virtual MOBase::IModList *modList() const { return this->get_override("modList")(); } virtual QString resolvePath(const QString &fileName) const { return this->get_override("resolvePath")(fileName); } virtual QStringList listDirectories(const QString &directoryName) const { return this->get_override("listDirectories")(directoryName); } virtual QStringList findFiles(const QString &path, const std::function &filter) const { return this->get_override("findFiles")(path, filter); } @@ -232,6 +232,7 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper &func) { return this->get_override("onAboutToRun")(func); } virtual bool onFinishedRun(const std::function &func) { return this->get_override("onFinishedRun")(func); } virtual bool onModInstalled(const std::function &func) { return this->get_override("onModInstalled")(func); } + virtual MOBase::IPluginGame *managedGame() const { return this->get_override("managedGame")(); } }; struct IDownloadManagerWrapper: MOBase::IDownloadManager, boost::python::wrapper @@ -261,7 +262,7 @@ struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapperget_override("type")(); } virtual QString path() const { return this->get_override("path")(); } - virtual QString binaryName() const { return this->get_override("binaryName")(); } +// virtual QString binaryName() const { return this->get_override("binaryName")(); } }; struct IModInterfaceWrapper: MOBase::IModInterface, boost::python::wrapper From cb5d3b4e62cdd343c31ea9b18b54663fc7c42329 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 21 Nov 2015 16:41:28 +0000 Subject: [PATCH 04/15] Replace GameInfo::path with iPluginGame::gameDirectory (or dataDirectory where applicable) Note: this isn''t ideal as it's not backward compatible --- src/runner/pythonrunner.cpp | 2 +- src/runner/uibasewrappers.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index ae22889..b4cd29a 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -707,7 +707,7 @@ BOOST_PYTHON_MODULE(mobase) bpy::class_("GameInfo") .def("type", bpy::pure_virtual(&IGameInfo::type)) - .def("path", bpy::pure_virtual(&IGameInfo::path)) +// .def("path", bpy::pure_virtual(&IGameInfo::path)) // .def("binaryName", bpy::pure_virtual(&IGameInfo::binaryName)) ; diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 7c820cc..b17ea0b 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -261,7 +261,7 @@ struct IInstallationManagerWrapper: MOBase::IInstallationManager, boost::python: struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapper { virtual Type type() const { return this->get_override("type")(); } - virtual QString path() const { return this->get_override("path")(); } +// virtual QString path() const { return this->get_override("path")(); } // virtual QString binaryName() const { return this->get_override("binaryName")(); } }; From 47e25da95e6344248df745477ee0f13535c2451f Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 22 Nov 2015 08:42:42 +0000 Subject: [PATCH 05/15] Removes igameinfo.h from everywhere apart from (sort of) the pythonrunner plugin. --- src/runner/pythonrunner.cpp | 2 +- src/runner/uibasewrappers.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index b4cd29a..e85d23b 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -706,7 +706,7 @@ BOOST_PYTHON_MODULE(mobase) bpy::class_("PluginSetting", bpy::init()); bpy::class_("GameInfo") - .def("type", bpy::pure_virtual(&IGameInfo::type)) +// .def("type", bpy::pure_virtual(&IGameInfo::type)) // .def("path", bpy::pure_virtual(&IGameInfo::path)) // .def("binaryName", bpy::pure_virtual(&IGameInfo::binaryName)) ; diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index b17ea0b..92b7786 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -260,7 +260,7 @@ struct IInstallationManagerWrapper: MOBase::IInstallationManager, boost::python: struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapper { - virtual Type type() const { return this->get_override("type")(); } +// virtual Type type() const { return this->get_override("type")(); } // virtual QString path() const { return this->get_override("path")(); } // virtual QString binaryName() const { return this->get_override("binaryName")(); } }; From 55e9c9c7b6acff1f4ae6f31e3e07a189f1d4f5a8 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 22 Nov 2015 21:18:12 +0000 Subject: [PATCH 06/15] Final eradication of igameinfo and adding python wrappers for IPluginGame --- src/runner/pythonRunner.pro | 3 +- src/runner/pythonrunner.cpp | 60 ++++++++++++++++++++++++++++--------- src/runner/uibasewrappers.h | 54 ++++++++++++++++++++++++--------- 3 files changed, 88 insertions(+), 29 deletions(-) diff --git a/src/runner/pythonRunner.pro b/src/runner/pythonRunner.pro index e1409e5..55c509b 100644 --- a/src/runner/pythonRunner.pro +++ b/src/runner/pythonRunner.pro @@ -62,4 +62,5 @@ QMAKE_POST_LINK += xcopy /y /s /i $$quote($$SRCDIR\\$${TARGET}*.dll) $$quote($$D QMAKE_POST_LINK += xcopy /y /I $$quote($$SRCDIR\\$${TARGET}*.pdb) $$quote($$DSTDIR)\\plugins $$escape_expand(\\n) OTHER_FILES += \ - SConscript + SConscript\ + CMakeLists.txt diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index e85d23b..33c82e9 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -687,13 +687,6 @@ BOOST_PYTHON_MODULE(mobase) .value("notAttempted", MOBase::IPluginInstaller::RESULT_NOTATTEMPTED) ; - bpy::enum_("GameType") - .value("oblivion", MOBase::IGameInfo::TYPE_OBLIVION) - .value("fallout3", MOBase::IGameInfo::TYPE_FALLOUT3) - .value("falloutnv", MOBase::IGameInfo::TYPE_FALLOUTNV) - .value("skyrim", MOBase::IGameInfo::TYPE_SKYRIM) - ; - bpy::class_("VersionInfo") .def(bpy::init()) .def(bpy::init()) @@ -705,14 +698,7 @@ BOOST_PYTHON_MODULE(mobase) bpy::class_("PluginSetting", bpy::init()); - bpy::class_("GameInfo") -// .def("type", bpy::pure_virtual(&IGameInfo::type)) -// .def("path", bpy::pure_virtual(&IGameInfo::path)) -// .def("binaryName", bpy::pure_virtual(&IGameInfo::binaryName)) - ; - bpy::class_("IOrganizer") - .def("gameInfo", bpy::pure_virtual(&IOrganizer::gameInfo), bpy::return_value_policy()) .def("createNexusBridge", bpy::pure_virtual(&IOrganizer::createNexusBridge), bpy::return_value_policy()) .def("profileName", bpy::pure_virtual(&IOrganizer::profileName)) .def("profilePath", bpy::pure_virtual(&IOrganizer::profilePath)) @@ -812,6 +798,7 @@ BOOST_PYTHON_MODULE(mobase) ; Functor0_converter(); // converter for the onRefreshed-callback + bpy::class_("IPluginList") .def("state", bpy::pure_virtual(&MOBase::IPluginList::state)) .def("priority", bpy::pure_virtual(&MOBase::IPluginList::priority)) @@ -825,6 +812,7 @@ BOOST_PYTHON_MODULE(mobase) bpy::to_python_converter>(); Functor2_converter(); // converter for the onModStateChanged-callback + bpy::class_("IModList") .def("displayName", bpy::pure_virtual(&MOBase::IModList::displayName)) .def("allMods", bpy::pure_virtual(&MOBase::IModList::allMods)) @@ -836,6 +824,50 @@ BOOST_PYTHON_MODULE(mobase) .def("onModMoved", bpy::pure_virtual(&MOBase::IModList::onModMoved)) ; + bpy::enum_("LoadOrderMechanism") + .value("FileTime", MOBase::IPluginGame::LoadOrderMechanism::FileTime) + .value("PluginsTxt", MOBase::IPluginGame::LoadOrderMechanism::PluginsTxt) + ; + + bpy::enum_("ProfileSetting") + .value("mods", MOBase::IPluginGame::MODS) + .value("configuration", MOBase::IPluginGame::CONFIGURATION) + .value("savegames", MOBase::IPluginGame::SAVEGAMES) + .value("preferDefaults", MOBase::IPluginGame::PREFER_DEFAULTS) + ; + + + bpy::class_("IPluginGame") + .def("gameName", bpy::pure_virtual(&MOBase::IPluginGame::gameName)) + .def("initializeProfile", bpy::pure_virtual(&MOBase::IPluginGame::initializeProfile)) + .def("savegameExtension", bpy::pure_virtual(&MOBase::IPluginGame::savegameExtension)) + .def("isInstalled", bpy::pure_virtual(&MOBase::IPluginGame::isInstalled)) + .def("gameIcon", bpy::pure_virtual(&MOBase::IPluginGame::gameIcon)) + .def("gameDirectory", bpy::pure_virtual(&MOBase::IPluginGame::gameDirectory)) + .def("dataDirectory", bpy::pure_virtual(&MOBase::IPluginGame::dataDirectory)) + .def("setGamePath", bpy::pure_virtual(&MOBase::IPluginGame::setGamePath)) + .def("documentsDirectory", bpy::pure_virtual(&MOBase::IPluginGame::documentsDirectory)) + .def("savesDirectory", bpy::pure_virtual(&MOBase::IPluginGame::savesDirectory)) + .def("executables", bpy::pure_virtual(&MOBase::IPluginGame::executables)) + .def("steamAPPId", bpy::pure_virtual(&MOBase::IPluginGame::steamAPPId)) + .def("getPrimaryPlugins", bpy::pure_virtual(&MOBase::IPluginGame::getPrimaryPlugins)) + .def("gameVariants", bpy::pure_virtual(&MOBase::IPluginGame::gameVariants)) + .def("setGameVariant", bpy::pure_virtual(&MOBase::IPluginGame::setGameVariant)) + .def("getBinaryName", bpy::pure_virtual(&MOBase::IPluginGame::getBinaryName)) + .def("getNexusName", bpy::pure_virtual(&MOBase::IPluginGame::getNexusName)) + .def("getIniFiles", bpy::pure_virtual(&MOBase::IPluginGame::getIniFiles)) + + //Plugin interface. + .def("init", bpy::pure_virtual(&MOBase::IPluginGame::init)) + .def("name", bpy::pure_virtual(&MOBase::IPluginGame::name)) + .def("author", bpy::pure_virtual(&MOBase::IPluginGame::author)) + .def("description", bpy::pure_virtual(&MOBase::IPluginGame::description)) + .def("version", bpy::pure_virtual(&MOBase::IPluginGame::version)) + .def("isActive", bpy::pure_virtual(&MOBase::IPluginGame::isActive)) + .def("settings", bpy::pure_virtual(&MOBase::IPluginGame::settings)) + + ; + GuessedValue_converters(); bpy::to_python_converter(); diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 92b7786..7244bc3 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -8,10 +8,11 @@ #pragma warning (pop) #endif +#include #include +#include "iplugingame.h" #include -#include #include #include #include @@ -21,8 +22,6 @@ #include "error.h" #include "gilock.h" -namespace MOBase { class IPluginGame; } - extern MOBase::IOrganizer *s_Organizer; using MOBase::ModRepositoryFileInfo; @@ -198,10 +197,6 @@ private: struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper { - virtual MOBase::IGameInfo &gameInfo() const { - MOBase::IGameInfo *result = this->get_override("gameInfo")(); - return *result; - } virtual MOBase::IModRepositoryBridge *createNexusBridge() const { return this->get_override("createNexusBridge")(); } virtual QString profileName() const { return this->get_override("profileName")(); } virtual QString profilePath() const { return this->get_override("profilePath")(); } @@ -258,13 +253,6 @@ struct IInstallationManagerWrapper: MOBase::IInstallationManager, boost::python: virtual MOBase::IPluginInstaller::EInstallResult installArchive(MOBase::GuessedValue &modName, const QString &archiveFile) { return this->get_override("installArchive")(modName, archiveFile); } }; -struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapper -{ -// virtual Type type() const { return this->get_override("type")(); } -// virtual QString path() const { return this->get_override("path")(); } -// virtual QString binaryName() const { return this->get_override("binaryName")(); } -}; - struct IModInterfaceWrapper: MOBase::IModInterface, boost::python::wrapper { virtual QString name() const override { return this->get_override("name")(); } @@ -307,4 +295,42 @@ struct IModListWrapper: MOBase::IModList, boost::python::wrapper &func) override { return this->get_override("onModMoved")(func); } }; + +struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapper { + virtual QString gameName() const override { return this->get_override("gameName")(); } + virtual void initializeProfile(const QDir &directory, ProfileSettings settings) const override { + this->get_override("initializeProfile")(directory, settings); + } + virtual QString savegameExtension() const override { return this->get_override("savegameExtension")(); } + virtual bool isInstalled() const override { return this->get_override("isInstalled")(); } + virtual QIcon gameIcon() const override { return this->get_override("gameIcon")(); } + virtual QDir gameDirectory() const override { return this->get_override("gameDirectory")(); } + virtual QDir dataDirectory() const override { return this->get_override("dataDirectory")(); } + virtual void setGamePath(const QString &path) override { this->get_override("setGamePath")(path); } + virtual QDir documentsDirectory() const override { return this->get_override("documentsDirectory")(); } + virtual QDir savesDirectory() const override { return this->get_override("savesDirectory")(); } + virtual QList executables() const override { return this->get_override("executables")(); } + virtual QString steamAPPId() const override { return this->get_override("steamAPPId")(); } + virtual QStringList getPrimaryPlugins() const override { return this->get_override("getPrimaryPlugins")(); } + virtual QStringList gameVariants() const override { return this->get_override("gameVariants")(); } + virtual void setGameVariant(const QString &variant) override { this->get_override("setGameVariant")(variant); } + virtual QString getBinaryName() const override { return this->get_override("getBinaryName")(); } + virtual QString getNexusName() const override { return this->get_override("getNexusName")(); } + virtual QStringList getIniFiles() const override { return this->get_override("getIniFiles")(); } + + //Plugin interface. Could this bit be implemented just once? + virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); } + virtual QString name() const override { return this->get_override("name")(); } + virtual QString author() const override { return this->get_override("author")(); } + virtual QString description() const override { return this->get_override("description")(); } + virtual MOBase::VersionInfo version() const override { return this->get_override("version")(); } + virtual bool isActive() const override { return this->get_override("isActive")(); } + virtual QList settings() const override { return this->get_override("settings")(); } + +protected: + + virtual std::map featureList() const override { return this->get_override("featureList")(); } + +}; + #endif // UIBASEWRAPPERS_H From fc8f6c77bccb0cfa0674f7af432ecdf237327fdb Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Mon, 23 Nov 2015 18:34:04 +0000 Subject: [PATCH 07/15] Remove most instances of GameInfo::getname, and transfer getDLCPlugins to the plugingame interface Also removed startDownloadNextFile as it doesn't appear to be used anywhere --- src/runner/pythonrunner.cpp | 4 +++- src/runner/uibasewrappers.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 33c82e9..0859548 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -749,7 +749,8 @@ BOOST_PYTHON_MODULE(mobase) bpy::class_("IDownloadManager") .def("startDownloadURLs", bpy::pure_virtual(&IDownloadManager::startDownloadURLs)) - .def("startDownloadNexusFile", bpy::pure_virtual(&IDownloadManager::startDownloadNexusFile)) + //not used? + //.def("startDownloadNexusFile", bpy::pure_virtual(&IDownloadManager::startDownloadNexusFile)) .def("downloadPath", bpy::pure_virtual(&IDownloadManager::downloadPath)) ; @@ -856,6 +857,7 @@ BOOST_PYTHON_MODULE(mobase) .def("getBinaryName", bpy::pure_virtual(&MOBase::IPluginGame::getBinaryName)) .def("getNexusName", bpy::pure_virtual(&MOBase::IPluginGame::getNexusName)) .def("getIniFiles", bpy::pure_virtual(&MOBase::IPluginGame::getIniFiles)) + .def("getDLCPlugins", bpy::pure_virtual(&MOBase::IPluginGame::getDLCPlugins)) //Plugin interface. .def("init", bpy::pure_virtual(&MOBase::IPluginGame::init)) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 7244bc3..fe2841c 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -233,7 +233,8 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper { virtual int startDownloadURLs(const QStringList &urls) { return this->get_override("downloadURLs")(urls); } - virtual int startDownloadNexusFile(int modID, int fileID) { return this->get_override("downloadNexusFile")(modID, fileID); } + //not used + //virtual int startDownloadNexusFile(int modID, int fileID) { return this->get_override("downloadNexusFile")(modID, fileID); } virtual QString downloadPath(int id) { return this->get_override("downloadPath")(id); } }; @@ -317,6 +318,7 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("getBinaryName")(); } virtual QString getNexusName() const override { return this->get_override("getNexusName")(); } virtual QStringList getIniFiles() const override { return this->get_override("getIniFiles")(); } + virtual QStringList getDLCPlugins() const override { return this->get_override("getDLCPlugins")(); } //Plugin interface. Could this bit be implemented just once? virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); } From 0b9a56fa7a90c3474e156027af853634c827af1b Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Tue, 24 Nov 2015 14:20:47 +0000 Subject: [PATCH 08/15] Replace GameInfo::getLoadorderMechanism with IPluginGame::getLoadOrderMechanism --- src/runner/pythonrunner.cpp | 1 + src/runner/uibasewrappers.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 0859548..bbec9c9 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -858,6 +858,7 @@ BOOST_PYTHON_MODULE(mobase) .def("getNexusName", bpy::pure_virtual(&MOBase::IPluginGame::getNexusName)) .def("getIniFiles", bpy::pure_virtual(&MOBase::IPluginGame::getIniFiles)) .def("getDLCPlugins", bpy::pure_virtual(&MOBase::IPluginGame::getDLCPlugins)) + .def("getLoadOrderMechanism", bpy::pure_virtual(&MOBase::IPluginGame::getLoadOrderMechanism)) //Plugin interface. .def("init", bpy::pure_virtual(&MOBase::IPluginGame::init)) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index fe2841c..7df66b0 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -319,6 +319,7 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("getNexusName")(); } virtual QStringList getIniFiles() const override { return this->get_override("getIniFiles")(); } virtual QStringList getDLCPlugins() const override { return this->get_override("getDLCPlugins")(); } + virtual LoadOrderMechanism getLoadOrderMechanism() const override { return this->get_override("getLoadorderMechanism")(); } //Plugin interface. Could this bit be implemented just once? virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); } From cc62f15cc8a629c3a14b924f979a1fc841cdb8aa Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Tue, 24 Nov 2015 16:16:10 +0000 Subject: [PATCH 09/15] Replace GameInfo::getNexusModID with IPluginGame::getNexusModOrganizerID() Also implement IPluginGame::getNexusGameID() but not hooked it in yet. --- src/runner/pythonrunner.cpp | 2 ++ src/runner/uibasewrappers.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index bbec9c9..52fe857 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -859,6 +859,8 @@ BOOST_PYTHON_MODULE(mobase) .def("getIniFiles", bpy::pure_virtual(&MOBase::IPluginGame::getIniFiles)) .def("getDLCPlugins", bpy::pure_virtual(&MOBase::IPluginGame::getDLCPlugins)) .def("getLoadOrderMechanism", bpy::pure_virtual(&MOBase::IPluginGame::getLoadOrderMechanism)) + .def("getNexusModOrganizerID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusModOrganizerID)) + .def("getNexusGameID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusGameID)) //Plugin interface. .def("init", bpy::pure_virtual(&MOBase::IPluginGame::init)) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 7df66b0..a4aca85 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -320,6 +320,8 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("getIniFiles")(); } virtual QStringList getDLCPlugins() const override { return this->get_override("getDLCPlugins")(); } virtual LoadOrderMechanism getLoadOrderMechanism() const override { return this->get_override("getLoadorderMechanism")(); } + virtual int getNexusModOrganizerID() const override { return this->get_override("getNexusModOrganizerID")(); } + virtual int getNexusGameID() const override { return this->get_override("getNexusGameID")(); } //Plugin interface. Could this bit be implemented just once? virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); } From 1455bda2f849f1385369c78c4315d9433167a5ca Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 26 Nov 2015 07:40:53 +0000 Subject: [PATCH 10/15] Sigh - python wrapper version of the 2 URL fetch functions --- src/runner/pythonrunner.cpp | 2 ++ src/runner/uibasewrappers.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 52fe857..ba7bf01 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -861,6 +861,8 @@ BOOST_PYTHON_MODULE(mobase) .def("getLoadOrderMechanism", bpy::pure_virtual(&MOBase::IPluginGame::getLoadOrderMechanism)) .def("getNexusModOrganizerID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusModOrganizerID)) .def("getNexusGameID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusGameID)) + .def("getNexusManagementURL", bpy::pure_virtual(&MOBase::IPluginGame::getNexusManagementURL)) + .def("getNexusDisplayURL", bpy::pure_virtual(&MOBase::IPluginGame::getNexusDisplayURL)) //Plugin interface. .def("init", bpy::pure_virtual(&MOBase::IPluginGame::init)) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index a4aca85..742806e 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -227,7 +227,7 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper &func) { return this->get_override("onAboutToRun")(func); } virtual bool onFinishedRun(const std::function &func) { return this->get_override("onFinishedRun")(func); } virtual bool onModInstalled(const std::function &func) { return this->get_override("onModInstalled")(func); } - virtual MOBase::IPluginGame *managedGame() const { return this->get_override("managedGame")(); } + virtual MOBase::IPluginGame const *managedGame() const { return this->get_override("managedGame")(); } }; struct IDownloadManagerWrapper: MOBase::IDownloadManager, boost::python::wrapper @@ -331,6 +331,8 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("version")(); } virtual bool isActive() const override { return this->get_override("isActive")(); } virtual QList settings() const override { return this->get_override("settings")(); } + virtual QString getNexusManagementURL() const override { return this->get_override("getNexusManagementURL")(); } + virtual QString getNexusDisplayURL() const override { return this->get_override("getNexusDisplayURL")(); } protected: From 9ba337ef17d463d2f7c8bb08ef7f07b4921a56e5 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 26 Nov 2015 17:45:30 +0000 Subject: [PATCH 11/15] Remove the getNexusManagementURL as it is a property of how you talk to nexus, not the game --- src/runner/pythonrunner.cpp | 2 +- src/runner/uibasewrappers.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index ba7bf01..eb26db6 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -861,8 +861,8 @@ BOOST_PYTHON_MODULE(mobase) .def("getLoadOrderMechanism", bpy::pure_virtual(&MOBase::IPluginGame::getLoadOrderMechanism)) .def("getNexusModOrganizerID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusModOrganizerID)) .def("getNexusGameID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusGameID)) - .def("getNexusManagementURL", bpy::pure_virtual(&MOBase::IPluginGame::getNexusManagementURL)) .def("getNexusDisplayURL", bpy::pure_virtual(&MOBase::IPluginGame::getNexusDisplayURL)) + .def("isRelatedURL", bpy::pure_virtual(&MOBase::IPluginGame::isRelatedURL)) //Plugin interface. .def("init", bpy::pure_virtual(&MOBase::IPluginGame::init)) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 742806e..e7429dd 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -10,6 +10,7 @@ #include #include +#include #include "iplugingame.h" #include @@ -322,6 +323,7 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("getLoadorderMechanism")(); } virtual int getNexusModOrganizerID() const override { return this->get_override("getNexusModOrganizerID")(); } virtual int getNexusGameID() const override { return this->get_override("getNexusGameID")(); } + virtual bool isRelatedURL(QUrl const &url) const override { return this->get_override("isRelatedURL")(url); } //Plugin interface. Could this bit be implemented just once? virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); } @@ -331,7 +333,6 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("version")(); } virtual bool isActive() const override { return this->get_override("isActive")(); } virtual QList settings() const override { return this->get_override("settings")(); } - virtual QString getNexusManagementURL() const override { return this->get_override("getNexusManagementURL")(); } virtual QString getNexusDisplayURL() const override { return this->get_override("getNexusDisplayURL")(); } protected: From 7f7a3fb1ca4cf8da9d635b858e63bfaa1b51b0f6 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 26 Nov 2015 21:03:23 +0000 Subject: [PATCH 12/15] Replaced the IPluginGame getNexusDisplayURL with some APIs in NexusInterface It makes more sense to have them here as they have very little to do with the game, more to do with the origin of the mod. --- src/runner/pythonrunner.cpp | 2 -- src/runner/uibasewrappers.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index eb26db6..52fe857 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -861,8 +861,6 @@ BOOST_PYTHON_MODULE(mobase) .def("getLoadOrderMechanism", bpy::pure_virtual(&MOBase::IPluginGame::getLoadOrderMechanism)) .def("getNexusModOrganizerID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusModOrganizerID)) .def("getNexusGameID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusGameID)) - .def("getNexusDisplayURL", bpy::pure_virtual(&MOBase::IPluginGame::getNexusDisplayURL)) - .def("isRelatedURL", bpy::pure_virtual(&MOBase::IPluginGame::isRelatedURL)) //Plugin interface. .def("init", bpy::pure_virtual(&MOBase::IPluginGame::init)) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index e7429dd..611e01b 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -323,7 +323,6 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("getLoadorderMechanism")(); } virtual int getNexusModOrganizerID() const override { return this->get_override("getNexusModOrganizerID")(); } virtual int getNexusGameID() const override { return this->get_override("getNexusGameID")(); } - virtual bool isRelatedURL(QUrl const &url) const override { return this->get_override("isRelatedURL")(url); } //Plugin interface. Could this bit be implemented just once? virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); } @@ -333,7 +332,6 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("version")(); } virtual bool isActive() const override { return this->get_override("isActive")(); } virtual QList settings() const override { return this->get_override("settings")(); } - virtual QString getNexusDisplayURL() const override { return this->get_override("getNexusDisplayURL")(); } protected: From e60121b21fa91c20247e0175b67281e52149c796 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Thu, 26 Nov 2015 21:17:06 +0000 Subject: [PATCH 13/15] Renamed getNexusName to getGameShortName as previously because it hopefully isn't too nexus related. --- src/runner/pythonrunner.cpp | 2 +- src/runner/uibasewrappers.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 52fe857..b7671e0 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -855,7 +855,7 @@ BOOST_PYTHON_MODULE(mobase) .def("gameVariants", bpy::pure_virtual(&MOBase::IPluginGame::gameVariants)) .def("setGameVariant", bpy::pure_virtual(&MOBase::IPluginGame::setGameVariant)) .def("getBinaryName", bpy::pure_virtual(&MOBase::IPluginGame::getBinaryName)) - .def("getNexusName", bpy::pure_virtual(&MOBase::IPluginGame::getNexusName)) + .def("getGameShortName", bpy::pure_virtual(&MOBase::IPluginGame::getGameShortName)) .def("getIniFiles", bpy::pure_virtual(&MOBase::IPluginGame::getIniFiles)) .def("getDLCPlugins", bpy::pure_virtual(&MOBase::IPluginGame::getDLCPlugins)) .def("getLoadOrderMechanism", bpy::pure_virtual(&MOBase::IPluginGame::getLoadOrderMechanism)) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 611e01b..4a7672c 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -317,7 +317,7 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("gameVariants")(); } virtual void setGameVariant(const QString &variant) override { this->get_override("setGameVariant")(variant); } virtual QString getBinaryName() const override { return this->get_override("getBinaryName")(); } - virtual QString getNexusName() const override { return this->get_override("getNexusName")(); } + virtual QString getGameShortName() const override { return this->get_override("getGameShortName")(); } virtual QStringList getIniFiles() const override { return this->get_override("getIniFiles")(); } virtual QStringList getDLCPlugins() const override { return this->get_override("getDLCPlugins")(); } virtual LoadOrderMechanism getLoadOrderMechanism() const override { return this->get_override("getLoadorderMechanism")(); } From c9299bb6233cb68f98b06544922aa045a1b759ab Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 28 Nov 2015 14:48:28 +0000 Subject: [PATCH 14/15] Addition of directory validity check to IPluginGame API --- src/runner/pythonrunner.cpp | 1 + src/runner/uibasewrappers.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index b7671e0..36f679a 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -861,6 +861,7 @@ BOOST_PYTHON_MODULE(mobase) .def("getLoadOrderMechanism", bpy::pure_virtual(&MOBase::IPluginGame::getLoadOrderMechanism)) .def("getNexusModOrganizerID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusModOrganizerID)) .def("getNexusGameID", bpy::pure_virtual(&MOBase::IPluginGame::getNexusGameID)) + .def("looksValid", bpy::pure_virtual(&MOBase::IPluginGame::looksValid)) //Plugin interface. .def("init", bpy::pure_virtual(&MOBase::IPluginGame::init)) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 4a7672c..aee6537 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -323,6 +323,7 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("getLoadorderMechanism")(); } virtual int getNexusModOrganizerID() const override { return this->get_override("getNexusModOrganizerID")(); } virtual int getNexusGameID() const override { return this->get_override("getNexusGameID")(); } + virtual bool looksValid(const QDir &dir) const override { return this->get_override("looksValid")(dir); } //Plugin interface. Could this bit be implemented just once? virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); } From 287a82ed488591511fb8e45996f195c821efb901 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 5 Dec 2015 06:51:41 +0000 Subject: [PATCH 15/15] Most of work for savegame --- src/runner/uibasewrappers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index aee6537..611ea18 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -323,7 +323,7 @@ struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapperget_override("getLoadorderMechanism")(); } virtual int getNexusModOrganizerID() const override { return this->get_override("getNexusModOrganizerID")(); } virtual int getNexusGameID() const override { return this->get_override("getNexusGameID")(); } - virtual bool looksValid(const QDir &dir) const override { return this->get_override("looksValid")(dir); } + virtual bool looksValid(QDir const &dir) const override { return this->get_override("looksValid")(dir); } //Plugin interface. Could this bit be implemented just once? virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); }