diff options
Diffstat (limited to 'src/T2DLL/T2MovieParamArray.cpp')
-rw-r--r-- | src/T2DLL/T2MovieParamArray.cpp | 72 |
1 files changed, 65 insertions, 7 deletions
diff --git a/src/T2DLL/T2MovieParamArray.cpp b/src/T2DLL/T2MovieParamArray.cpp index 325b4cd..787301d 100644 --- a/src/T2DLL/T2MovieParamArray.cpp +++ b/src/T2DLL/T2MovieParamArray.cpp @@ -1,25 +1,83 @@ +#include "T2Archive.h" #include "T2MovieParamArray.h" -T2MovieParamArray::T2MovieParamArray() { +// unknown name +struct MovieParam { + DWORD code; + int value; +}; + +T2MovieParamArray::T2MovieParamArray() + : LArray(sizeof(MovieParam)) +{ } /*virtual*/ T2MovieParamArray::~T2MovieParamArray() { } -int T2MovieParamArray::Regist(unsigned long, int) { +BOOL T2MovieParamArray::Regist(DWORD inCode, int inValue) { + LArrayIterator iterator(*this); + MovieParam entry; + + while (iterator.Next(&entry)) { + if (entry.code == inCode) + return false; + } + + entry.code = inCode; + entry.value = inValue; + InsertItemsAt(1, mItemCount + 1, &entry); + return true; } -int T2MovieParamArray::GetParam(unsigned long) { +int T2MovieParamArray::GetParam(DWORD inCode) { + LArrayIterator iterator(*this); + MovieParam entry; + + while (iterator.Next(&entry)) { + if (entry.code == inCode) + return entry.value; + } + + return 0; } -/*static*/ T2MovieParamArray* T2MovieParamArray::ReadMovieParamArray(T2Archive&) { +/*static*/ T2MovieParamArray* T2MovieParamArray::ReadMovieParamArray(T2Archive& inArchive) { + T2MovieParamArray *theArray = NULL; + + DWORD code; + inArchive >> code; + + if (code == 'mvPA') + theArray = new T2MovieParamArray; + + if (theArray) + theArray->Read(inArchive); + + return theArray; } -/*static*/ void T2MovieParamArray::WriteMovieParamArray(T2MovieParamArray*, T2Archive&) { +/*static*/ void T2MovieParamArray::WriteMovieParamArray(T2MovieParamArray* inArray, T2Archive& inArchive) { + DWORD code; + + if (!inArray) { + code = 'xmPA'; + inArchive << code; + } else { + code = 'mvPA'; + inArchive << code; + inArray->Write(inArchive); + } } -/*virtual*/ void T2MovieParamArray::Read(T2Archive&) { +/*virtual*/ void T2MovieParamArray::Read(T2Archive& inArchive) { + inArchive >> mItemSize; + inArchive >> mItemCount; + inArchive.Read(mBuffer, mItemSize * mItemCount); } -/*virtual*/ void T2MovieParamArray::Write(T2Archive&) { +/*virtual*/ void T2MovieParamArray::Write(T2Archive& inArchive) { + inArchive << mItemSize; + inArchive << mItemCount; + inArchive.Write(mBuffer, mItemSize * mItemCount); } |