From 37e364b2c6cc7487a1c888d256a73e5337bb7189 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 14 Jun 2023 00:50:34 +0100 Subject: initial commit --- src/T2DLL/CFilePlugin.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/T2DLL/CFilePlugin.cpp (limited to 'src/T2DLL/CFilePlugin.cpp') diff --git a/src/T2DLL/CFilePlugin.cpp b/src/T2DLL/CFilePlugin.cpp new file mode 100644 index 0000000..aac286d --- /dev/null +++ b/src/T2DLL/CFilePlugin.cpp @@ -0,0 +1,52 @@ +#include "CFilePlugin.h" +#include "CPluginInfo.h" +#include "CResFile.h" + +CFilePlugin::CFilePlugin(DWORD type, T2PluginSpecifier& specifier) + : CPlugin(type, specifier) +{ + mAttrib = 0; + mGameLevel = 0; + + CResFile file; + int success = false; + if (specifier.mIsSubPlugin) { + success = file.OpenResource(specifier.mPath, 128, 'ATTR'); + specifier.mIsLoaded = true; + } else { + success = file.OpenResource(specifier.mInstance, 128, "ATTR"); + } + + if (success) { + file >> mID; + file >> mAttrib; + file >> mDependID; + file >> mGameLevel; + file >> mSecretItem; + file >> mItemType; + file >> mMustItem; + file >> mPluginName; + } +} + +/*virtual*/ CFilePlugin::~CFilePlugin() { + Unload(); +} + +/*virtual*/ void CFilePlugin::GetName(CString& outStr) { + outStr = mPluginName; +} + +/*virtual*/ BOOL CFilePlugin::Load() { + return true; +} + +/*virtual*/ BOOL CFilePlugin::Unload() { + return true; +} + +CPluginInfo* CFilePlugin::GetPluginInfo() { + char buf[500]; + GetModuleFileName(mModuleHandle, buf, sizeof(buf)); + return new CPluginInfo(mType, mID, mItemType, mMustItem, mPluginName, buf); +} -- cgit v1.2.3