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/T2SubPlugin.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/T2DLL/T2SubPlugin.cpp (limited to 'src/T2DLL/T2SubPlugin.cpp') diff --git a/src/T2DLL/T2SubPlugin.cpp b/src/T2DLL/T2SubPlugin.cpp new file mode 100644 index 0000000..fbdbe01 --- /dev/null +++ b/src/T2DLL/T2SubPlugin.cpp @@ -0,0 +1,68 @@ +#include "CResFile.h" +#include "T2BitImage.h" +#include "T2ImageObj.h" +#include "T2SubPlugin.h" + +T2SubPlugin::T2SubPlugin(DWORD type, T2PluginSpecifier& specifier) + : CResourcePlugin(type, specifier) +{ + mDupCustomerTableDefRes = false; + mTieup = 0; + mTitle[0] = 0; + mTieup = NULL; + mOpenTime = 0; + mCloseTime = 0; + mBitImage = NULL; + mImageObj = NULL; +} + +/*virtual*/ T2SubPlugin::~T2SubPlugin() { + if (mTieup) + delete mTieup; + if (mBitImage) + delete mBitImage; + if (mImageObj) + delete mImageObj; +} + +int T2SubPlugin::IsTieupFinish() { + int result = false; + + if (mTieup) { + CTime now = CTime::GetTickCount(); + if (*mTieup < now) + result = true; + } + + return result; +} + +/*virtual*/ void T2SubPlugin::GetTitle(CString& outStr) { + outStr = mTitle; +} + +/*virtual*/ void T2SubPlugin::LoadRsrcFromStream(CResFile& resFile) { + resFile >> mTitle; + + unsigned int t; + resFile >> t; + if (t != 0) { + int year = (t >> 28) & 0xF; + year *= 10; + year += (t >> 24) & 0xF; + year *= 10; + year += (t >> 20) & 0xF; + year *= 10; + year += (t >> 16) & 0xF; + + int month = (t >> 12) & 0xF; + month *= 10; + month += (t >> 8) & 0xF; + + int day = (t >> 4) & 0xF; + day *= 10; + day += (t & 0xF) + 1; + + mTieup = new CTime(year, month, day, 0, 0, 0); + } +} -- cgit v1.2.3