diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-14 00:50:34 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-14 00:50:34 +0100 |
commit | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (patch) | |
tree | eaf6e857382eef16c2dd940eb4125536fbe068bd /src/T2DLL/T2PluginSpecifier.cpp | |
download | t2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.tar.gz t2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.zip |
initial commit
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2PluginSpecifier.cpp | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/src/T2DLL/T2PluginSpecifier.cpp b/src/T2DLL/T2PluginSpecifier.cpp new file mode 100644 index 0000000..5e8c16b --- /dev/null +++ b/src/T2DLL/T2PluginSpecifier.cpp @@ -0,0 +1,114 @@ +#include "T2PluginSpecifier.h" +#include "CResFile.h" +#include "GlobalFunc.h" + +T2PluginSpecifier::T2PluginSpecifier() { + mInstance = NULL; + mPluginName = "Not loaded"; + mPath = "Not loaded"; + mIsSubPlugin = false; + mType = 0; + mID = 0; + mSecretItem = 0; + m28 = -1; + mIsLoaded = 0; +} + +/*virtual*/ void T2PluginSpecifier::operator=(T2PluginSpecifier& other) { + mInstance = other.mInstance; + mPluginName = other.mPluginName; + mPath = other.mPath; + mIsSubPlugin = other.mIsSubPlugin; + mType = other.mType; + mID = other.mID; + mAttrib = other.mAttrib; + mGameLevel = other.mGameLevel; + mSecretItem = other.mSecretItem; + m28 = other.m28; + mIsLoaded = other.mIsLoaded; + mTime = other.mTime; +} + +void T2PluginSpecifier::Initialize(HINSTANCE inst, const char* path) { + CResFile resFile; + + if (inst) { + if (!resFile.OpenResource(inst, 128, "ATTR")) { +#line 45 + __Rep1(__FILE__, __LINE__, "�v���O�C�������Ă��邩�A�ȑO��The Tower�U���ُ�I���������߂ɁA�v���O�C�����g���Ȃ��Ȃ��Ă��܂��B\nWindows���ċN�����Ă݂Ă��������B\n�v���O�C�� �F %s", (DWORD) path); + } + } else { + if (!resFile.OpenResource(path, 128, 'ATTR')) { +#line 50 + __Rep1(__FILE__, __LINE__, "�v���O�C�������Ă��邩�A�ȑO��The Tower�U���ُ�I���������߂ɁA�v���O�C�����g���Ȃ��Ȃ��Ă��܂��B\nWindows���ċN�����Ă݂Ă��������B\n�v���O�C�� �F %s", (DWORD) path); + } + } + + int a; + + resFile >> mID; + resFile >> mAttrib; + resFile >> a; // mDependID + resFile >> mGameLevel; + resFile >> mSecretItem; + resFile >> a; // mItemType + resFile >> a; // mMustItem + resFile >> mPluginName; + + mIsSubPlugin = resFile.IsSubPlugin(); + mPath = path; + mInstance = inst; + mIsLoaded = true; + + if (inst) { + if (!resFile.OpenResource(inst, 128, "DESC")) { +#line 68 + __Rep1(__FILE__, __LINE__, "�v���O�C�������Ă��邩�A�ȑO��The Tower�U���ُ�I���������߂ɁA�v���O�C�����g���Ȃ��Ȃ��Ă��܂��B\nWindows���ċN�����Ă݂Ă��������B\n�v���O�C�� �F %s", (DWORD) path); + } + } else { + if (!resFile.OpenResource(path, 128, 'DESC')) { +#line 73 + __Rep1(__FILE__, __LINE__, "�v���O�C�������Ă��邩�A�ȑO��The Tower�U���ُ�I���������߂ɁA�v���O�C�����g���Ȃ��Ȃ��Ă��܂��B\nWindows���ċN�����Ă݂Ă��������B\n�v���O�C�� �F %s", (DWORD) path); + } + } + + resFile >> mType; + resFile >> m28; + + CFileStatus fileStatus; + CFile::GetStatus(path, fileStatus); + mTime = fileStatus.m_mtime; +} + +void T2PluginSpecifier::Read(CArchive& archive) { + DWORD inst; + archive >> inst; + mInstance = (HINSTANCE) inst; + archive >> mPluginName; + archive >> mPath; + archive >> mIsSubPlugin; + archive >> mType; + archive >> mID; + archive >> mAttrib; + archive >> mGameLevel; + archive >> mSecretItem; + archive >> m28; + archive >> mIsLoaded; + archive >> mTime; +} + +void T2PluginSpecifier::Write(CArchive& archive) { + DWORD inst = (DWORD) mInstance; + archive << inst; + archive << mPluginName; + archive << mPath; + archive << mIsSubPlugin; + archive << mType; + archive << mID; + archive << mAttrib; + archive << mGameLevel; + archive << mSecretItem; + archive << m28; + archive << mIsLoaded; + archive << mTime; +} |