From 9a88a190eb31c12aa391b1142461a09b1a32215d Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sun, 29 Nov 2015 12:55:49 +0000 Subject: Another cleanup and make the program not crash when looking at saves for the nonce --- src/main.cpp | 22 +++++++++++++--------- src/shared/gameinfo.h | 10 +++++----- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 78145a74..e9351c97 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,21 +26,16 @@ along with Mod Organizer. If not, see . #define WIN32_LEAN_AND_MEAN #include #include -#include + #include #include #include #include -#include #include "mainwindow.h" #include #include "modlist.h" #include "profile.h" #include "gameinfo.h" -#include "fallout3info.h" -#include "falloutnvinfo.h" -#include "oblivioninfo.h" -#include "skyriminfo.h" #include "spawn.h" #include "executableslist.h" #include "singleinstance.h" @@ -51,11 +46,9 @@ along with Mod Organizer. If not, see . #include "moapplication.h" #include "tutorialmanager.h" #include "nxmaccessmanager.h" -#include -#include #include #include -#include + #include #include #include @@ -77,6 +70,14 @@ along with Mod Organizer. If not, see . #include #include +#include + +#include + +#include +#include +#include + #pragma comment(linker, "/manifestDependency:\"name='dlls' processorArchitecture='x86' version='1.0.0.0' type='win32' \"") @@ -566,6 +567,9 @@ int main(int argc, char *argv[]) organizer.setManagedGame(game); + //*sigh just for making it work + GameInfo::init(application.applicationDirPath().toStdWString(), game->gameDirectory().absolutePath().toStdWString()); + organizer.createDefaultProfile(); //See the pragma - we apparently don't use this so not sure why we check it diff --git a/src/shared/gameinfo.h b/src/shared/gameinfo.h index 55161952..01d51f8a 100644 --- a/src/shared/gameinfo.h +++ b/src/shared/gameinfo.h @@ -51,6 +51,9 @@ public: virtual ~GameInfo() {} + //**USED IN HOOKDLL and savegame code + static GameInfo& instance(); + //**Used only in savegame which needs refactoring a lot. virtual GameInfo::Type getType() = 0; @@ -58,10 +61,10 @@ public: // get a list of file extensions for additional files belonging to a save game virtual std::vector getSavegameAttachmentExtensions() = 0; - //**USED IN HOOKDLL + //**USED ONLY IN HOOKDLL virtual std::wstring getGameDirectory() const; - //**USED IN HOOKDLL + //**USED ONLY 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""); @@ -79,9 +82,6 @@ public: //**USED ONLY IN HOOKDLL virtual bool rerouteToProfile(const wchar_t *fileName, const wchar_t *fullPath) = 0; - //**USED IN HOOKDLL and everywhere that uses GameInfo - static GameInfo& instance(); - protected: GameInfo(const std::wstring &gameDirectory); -- cgit v1.3.1