diff options
| author | TanninOne <seppleviathan@gmx.de> | 2015-09-26 19:54:31 +0200 |
|---|---|---|
| committer | TanninOne <seppleviathan@gmx.de> | 2015-09-26 19:54:31 +0200 |
| commit | de98fe64a3ef23be8124e69614d4ec79aac5c637 (patch) | |
| tree | 48083f2b8d9e914fcb96ed0e0857ac79a34994f8 | |
| parent | 462c549f7725810e55131a62f731357c6b2396ae (diff) | |
| parent | 364c385f1a5f71c3eb6a80b44c26ddd7af012ec8 (diff) | |
Merge pull request #1 from ThosRTanner/master
Small cleanups
| -rw-r--r-- | .gitignore | 4 | ||||
| -rw-r--r-- | src/ModOrganizer.pro | 4 | ||||
| -rw-r--r-- | src/baincomplexinstallerdialog.ui | 113 | ||||
| -rw-r--r-- | src/fomodinstallerdialog.ui | 200 | ||||
| -rw-r--r-- | src/installationmanager.cpp | 5 | ||||
| -rw-r--r-- | src/organizer.pro | 20 | ||||
| -rw-r--r-- | src/pdll.h | 402 | ||||
| -rw-r--r-- | src/pluginlist.h | 1 |
8 files changed, 17 insertions, 732 deletions
@@ -1,4 +1,6 @@ +*.user +Thumbs.db src/moc_*.cpp src/ui_*.h src/*.qrc.depends -src/Modorganizer.*
\ No newline at end of file +src/Modorganizer.* diff --git a/src/ModOrganizer.pro b/src/ModOrganizer.pro index 0ff8b6c5..fc679a01 100644 --- a/src/ModOrganizer.pro +++ b/src/ModOrganizer.pro @@ -3,6 +3,7 @@ TEMPLATE = subdirs SUBDIRS = bsatk \
shared \
uibase \
+ esptk \
organizer \
hookdll \
archive \
@@ -11,8 +12,7 @@ SUBDIRS = bsatk \ nxmhandler \
BossDummy \
pythonRunner \
- loot_cli \
- esptk
+ loot_cli
pythonRunner.depends = uibase
plugins.depends = pythonRunner uibase
diff --git a/src/baincomplexinstallerdialog.ui b/src/baincomplexinstallerdialog.ui deleted file mode 100644 index d290aa58..00000000 --- a/src/baincomplexinstallerdialog.ui +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>BainComplexInstallerDialog</class>
- <widget class="QDialog" name="BainComplexInstallerDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>398</width>
- <height>365</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>BAIN Package Installer</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Name</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="nameEdit"/>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>This looks like a Package prepared for Installation through BAIN. You can select options from the list below. If there is a package.txt file, it should contain detailed information about the options.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QListWidget" name="optionsList">
- <property name="toolTip">
- <string>Components of this package.</string>
- </property>
- <property name="whatsThis">
- <string>Components of this package.
-If there is a component called "00 Core" it is usually required. Options are ordered by priority as set up by the author.</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QPushButton" name="packageBtn">
- <property name="toolTip">
- <string>The package.txt is often part of BAIN packages and contains details about the options available.</string>
- </property>
- <property name="whatsThis">
- <string>The package.txt is often part of BAIN packages and contains details about the options available.</string>
- </property>
- <property name="text">
- <string>Package.txt</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="manualBtn">
- <property name="toolTip">
- <string>Opens a Dialog that allows custom modifications.</string>
- </property>
- <property name="whatsThis">
- <string>Opens a Dialog that allows custom modifications.</string>
- </property>
- <property name="text">
- <string>Manual</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="okBtn">
- <property name="text">
- <string>Ok</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="cancelBtn">
- <property name="text">
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/fomodinstallerdialog.ui b/src/fomodinstallerdialog.ui deleted file mode 100644 index 270ae64b..00000000 --- a/src/fomodinstallerdialog.ui +++ /dev/null @@ -1,200 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>FomodInstallerDialog</class>
- <widget class="QDialog" name="FomodInstallerDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>662</width>
- <height>501</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>FOMOD Installation Dialog</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Name</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="nameEdit"/>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
- <property name="horizontalSpacing">
- <number>15</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Author</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="authorLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Version</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="versionLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Website</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="websiteLabel">
- <property name="text">
- <string><a href="#">Link</a></string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTextEdit" name="descriptionText">
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="screenshotLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QStackedWidget" name="stepsStack">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="manualBtn">
- <property name="text">
- <string>Manual</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="prevBtn">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Back</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="nextBtn">
- <property name="text">
- <string>Next</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="cancelBtn">
- <property name="text">
- <string>Cancel</string>
- </property>
- <property name="default">
- <bool>false</bool>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 0f66a7e8..75abd750 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -676,6 +676,11 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString> }
qDebug("using mod name \"%s\" (id %d) -> %s", modName->toUtf8().constData(), modID, qPrintable(m_CurrentFile));
+ //If there's an archive already open, close it. This happens with the bundle
+ //installer when it uncompresses a split archive, then finds it has a real archive
+ //to deal with.
+ m_CurrentArchive->close();
+
// open the archive and construct the directory tree the installers work on
bool archiveOpen = m_CurrentArchive->open(ToWString(QDir::toNativeSeparators(fileName)).c_str(),
new MethodCallback<InstallationManager, void, LPSTR>(this, &InstallationManager::queryPassword));
diff --git a/src/organizer.pro b/src/organizer.pro index c02ac3df..808fdeb5 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -77,9 +77,6 @@ SOURCES += \ modlistview.cpp \
problemsdialog.cpp \
serverinfo.cpp \
- ../esptk/record.cpp \
- ../esptk/espfile.cpp \
- ../esptk/subrecord.cpp \
browserview.cpp \
browserdialog.cpp \
persistentcookiejar.cpp \
@@ -155,10 +152,6 @@ HEADERS += \ modlistview.h \
problemsdialog.h \
serverinfo.h \
- ../esptk/record.h \
- ../esptk/espfile.h \
- ../esptk/subrecord.h \
- ../esptk/espexceptions.h \
browserview.h \
browserdialog.h \
persistentcookiejar.h \
@@ -168,7 +161,6 @@ HEADERS += \ aboutdialog.h \
json.h \
safewritefile.h\
- pdll.h \
modflagicondelegate.h \
genericicondelegate.h \
organizerproxy.h \
@@ -193,14 +185,12 @@ FORMS += \ mainwindow.ui \
lockeddialog.ui \
installdialog.ui \
- fomodinstallerdialog.ui \
finddialog.ui \
editexecutablesdialog.ui \
downloadlistwidgetcompact.ui \
downloadlistwidget.ui \
credentialsdialog.ui \
categoriesdialog.ui \
- baincomplexinstallerdialog.ui \
activatemodsdialog.ui \
profileinputdialog.ui \
savetextasdialog.ui \
@@ -260,22 +250,26 @@ LIBS += -L"$${BOOSTPATH}/stage/lib" CONFIG(debug, debug|release) {
LIBS += -L$$OUT_PWD/../shared/debug
LIBS += -L$$OUT_PWD/../bsatk/debug
+ LIBS += -L$$OUT_PWD/../esptk/debug
LIBS += -L$$OUT_PWD/../uibase/debug
LIBS += -L$$OUT_PWD/../boss_modified/debug
LIBS += -lDbgHelp
PRE_TARGETDEPS += \
$$OUT_PWD/../shared/debug/mo_shared.lib \
- $$OUT_PWD/../bsatk/debug/bsatk.lib
+ $$OUT_PWD/../bsatk/debug/bsatk.lib \
+ $$OUT_PWD/../esptk/debug/esptk.lib
} else {
LIBS += -L$$OUT_PWD/../shared/release
LIBS += -L$$OUT_PWD/../bsatk/release
+ LIBS += -L$$OUT_PWD/../esptk/release
LIBS += -L$$OUT_PWD/../uibase/release
LIBS += -L$$OUT_PWD/../boss_modified/release
QMAKE_CXXFLAGS += /Zi /GL
QMAKE_LFLAGS += /DEBUG /LTCG /OPT:REF /OPT:ICF
PRE_TARGETDEPS += \
$$OUT_PWD/../shared/release/mo_shared.lib \
- $$OUT_PWD/../bsatk/release/bsatk.lib
+ $$OUT_PWD/../bsatk/release/bsatk.lib \
+ $$OUT_PWD/../esptk/release/esptk.lib
}
#QMAKE_CXXFLAGS_WARN_ON -= -W3
@@ -307,7 +301,7 @@ TRANSLATIONS = organizer_en.ts # PRE_TARGETDEPS += compiler_TSQM_make_all
#} else:message(No translation files in project)
-LIBS += -lmo_shared -luibase -lshell32 -lole32 -luser32 -ladvapi32 -lgdi32 -lPsapi -lVersion -lbsatk -lshlwapi
+LIBS += -lmo_shared -luibase -lshell32 -lole32 -luser32 -ladvapi32 -lgdi32 -lPsapi -lVersion -lbsatk -lesptk -lshlwapi
LIBS += -L"$${ZLIBPATH}/build" -lzlibstatic
diff --git a/src/pdll.h b/src/pdll.h deleted file mode 100644 index 22d74557..00000000 --- a/src/pdll.h +++ /dev/null @@ -1,402 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////
-// Class: PDll //
-// Authors: MicHael Galkovsky //
-// Date: April 14, 1998 //
-// Company: Pervasive Software //
-// Purpose: Base class to wrap dynamic use of dll //
-//////////////////////////////////////////////////////////////////////////////////////////////
-
-#if !defined (_PDLL_H_)
-#define _PDLL_H_
-
-#include <windows.h>
-#include <winbase.h>
-
-#include <windows_error.h>
-#include <tchar.h>
-#include <sstream>
-
-
-#define FUNC_LOADED 3456
-
-//function declarations according to the number of parameters
-//define the type
-//declare a variable of that type
-//declare a member function by the same name as the dll function
-//check for dll handle
-//if this is the first call to the function then try to load it
-//if not then if the function was loaded successfully make a call to it
-//otherwise return a nullptr cast to the return parameter.
-
-#define DECLARE_FUNCTION0(CallType, retVal, FuncName) \
- typedef retVal (CallType* TYPE_##FuncName)(); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName; \
- retVal FuncName() \
- { \
- if (m_dllHandle) \
- { \
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(); \
- else \
- return (retVal)nullptr; \
- } \
- else \
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION1(CallType,retVal, FuncName, Param1) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName;\
- retVal FuncName(Param1 p1) \
- { \
- if (m_dllHandle) \
- { \
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1); \
- else \
- return (retVal)nullptr; \
- } \
- else \
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION2(CallType,retVal, FuncName, Param1, Param2) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1, Param2); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName;\
- retVal FuncName (Param1 p1, Param2 p2) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2); \
- else \
- return (retVal)nullptr; \
- } \
- else\
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION3(CallType,retVal, FuncName, Param1, Param2, Param3) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1, Param2, Param3); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName;\
- retVal FuncName (Param1 p1, Param2 p2, Param3 p3) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED; \
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2, p3);\
- else \
- return (retVal)nullptr; \
- } \
- else\
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION4(CallType,retVal, FuncName, Param1, Param2, Param3, Param4) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1, Param2, Param3, Param4); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName;\
- retVal FuncName (Param1 p1, Param2 p2, Param3 p3, Param4 p4) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2, p3, p4);\
- else \
- return (retVal)nullptr; \
- } \
- else\
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION5(CallType,retVal, FuncName, Param1, Param2, Param3, Param4, Param5) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1, Param2, Param3, Param4, Param5); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName; \
- retVal FuncName (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2, p3, p4, p5);\
- else \
- return (retVal)nullptr; \
- } \
- else\
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION6(CallType,retVal, FuncName, Param1, Param2, Param3, Param4, Param5, Param6) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1, Param2, Param3, Param4, Param5, Param6); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName;\
- retVal FuncName (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2, p3, p4, p5, p6);\
- else \
- return (retVal)nullptr; \
- } \
- else\
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION7(CallType,retVal, FuncName, Param1, Param2, Param3, Param4, Param5, Param6, Param7) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1, Param2, Param3, Param4, Param5, Param6, Param7); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName;\
- retVal FuncName (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2, p3, p4, p5, p6, p7);\
- else \
- return (retVal)nullptr; \
- } \
- else\
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION8(CallType,retVal, FuncName, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName;\
- retVal FuncName (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2, p3, p4, p5, p6, p7, p8);\
- else \
- return (retVal)nullptr; \
- }\
- else\
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION9(CallType,retVal, FuncName, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9) \
- typedef retVal (CallType* TYPE_##FuncName)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName; \
- retVal FuncName (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_NAME != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2, p3, p4, p5, p6, p7, p8, p9);\
- else \
- return (retVal)nullptr; \
- }\
- else\
- return (retVal)nullptr; \
- }
-
-#define DECLARE_FUNCTION10(CallType,retVal, FuncName, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10) \
- typedef retVal (CallType* TYPE_##FuncName)FuncName(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10); \
- TYPE_##FuncName m_##FuncName; \
- short m_is##FuncName;\
- retVal FuncName (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10) \
- {\
- if (m_dllHandle)\
- {\
- if (FUNC_LOADED != m_is##FuncName) \
- {\
- m_##FuncName = nullptr; \
- m_##FuncName = (TYPE_##FuncName)GetProcAddress(m_dllHandle, #FuncName); \
- m_is##FuncName = FUNC_LOADED;\
- }\
- if (nullptr != m_##FuncName) \
- return m_##FuncName(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);\
- else \
- return (retVal)nullptr; \
- }\
- else \
- return (retVal)nullptr;\
- }
-
-//declare constructors and LoadFunctions
-#define DECLARE_CLASS(ClassName) \
- public: \
- ClassName (LPCTSTR name){LoadDll(name);} \
- ClassName () {PDLL();}
-
-class PDLL
-{
-protected:
- HINSTANCE m_dllHandle;
-private:
- LPTSTR m_dllName;
- int m_refCount;
-
-public:
-
- PDLL()
- {
- m_dllHandle = nullptr;
- m_dllName = nullptr;
- m_refCount = 0;
- }
-
- //A nullptr here means the name has already been set
- void LoadDll(LPCTSTR name, bool showMsg = true)
- {
- if (name)
- SetDllName(name);
-
- //try to load
- m_dllHandle = LoadLibrary(m_dllName);
-
- if (m_dllHandle == nullptr && showMsg)
- {
- std::ostringstream message;
- message << "failed to load dll: " << ::GetLastError();
- throw std::runtime_error(message.str().c_str());
- }
- }
-
- bool SetDllName(LPCTSTR newName)
- {
- bool retVal = false;
-
- //we allow name resets only if the current DLL handle is invalid
- //once they've hooked into a DLL, the name cannot be changed
- if (!m_dllHandle)
- {
- if (m_dllName)
- {
- delete []m_dllName;
- m_dllName = nullptr;
- }
-
- //They may be setting this null (e.g., uninitialize)
- if (newName)
- {
- m_dllName = new TCHAR[_tcslen(newName) + 1];
- _tcscpy(m_dllName, newName);
- }
- retVal = true;
- }
- return retVal;
- }
-
- virtual bool Initialize(short showMsg = 1)
- {
-
- bool retVal = false;
-
- //Add one to our internal reference counter
- m_refCount++;
-
- if (m_refCount == 1 && m_dllName) //if this is first time, load the DLL
- {
- //we are assuming the name is already set
- LoadDll(nullptr, showMsg);
- retVal = (m_dllHandle != nullptr);
- }
- return retVal;
- }
-
- virtual void Uninitialize(void)
- {
- //If we're already completely unintialized, early exit
- if (!m_refCount)
- return;
- //if this is the last time this instance has been unitialized,
- //then do a full uninitialization
- m_refCount--;
-
- if (m_refCount < 1)
- {
- if (m_dllHandle)
- {
- FreeLibrary(m_dllHandle);
- m_dllHandle = nullptr;
- }
-
- SetDllName(nullptr); //clear out the name & free memory
- }
- }
-
- virtual ~PDLL()
- {
- //force this to be a true uninitialize
- m_refCount = 1;
- Uninitialize();
-
- //free name
- if (m_dllName)
- {
- delete [] m_dllName;
- m_dllName = nullptr;
- }
- }
-
-};
-#endif
diff --git a/src/pluginlist.h b/src/pluginlist.h index 79066165..f8972f05 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -34,7 +34,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #endif
#include <vector>
#include <map>
-#include "pdll.h"
template <class C>
|
