From 66a8ae719eb2cb51018a6059917af6f9ed732eec Mon Sep 17 00:00:00 2001 From: Shawwwn Date: Wed, 14 May 2014 19:51:08 -0700 Subject: [PATCH] Added ArchiveFile type --- H2OExtractor.dsp | 20 ++++++++++++++++++++ Source/Archive.h | 7 +++++++ Source/ArchiveComment.h | 3 ++- Source/ArchiveFile.cpp | 2 ++ Source/ArchiveFile.h | 19 +++++++++++++++++++ Source/ArchiveFileName.cpp | 2 ++ Source/ArchiveFileName.h | 12 ++++++++++++ Source/ArchiveFileNameChunk.cpp | 2 ++ Source/ArchiveFileNameChunk.h | 12 ++++++++++++ Source/ArchiveFileNameDesc.cpp | 2 ++ Source/ArchiveFileNameDesc.h | 14 ++++++++++++++ Source/ArchiveHeader.h | 1 + 12 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 Source/ArchiveFile.cpp create mode 100644 Source/ArchiveFile.h create mode 100644 Source/ArchiveFileName.cpp create mode 100644 Source/ArchiveFileName.h create mode 100644 Source/ArchiveFileNameChunk.cpp create mode 100644 Source/ArchiveFileNameChunk.h create mode 100644 Source/ArchiveFileNameDesc.cpp create mode 100644 Source/ArchiveFileNameDesc.h diff --git a/H2OExtractor.dsp b/H2OExtractor.dsp index 02076a4..85b1b4d 100644 --- a/H2OExtractor.dsp +++ b/H2OExtractor.dsp @@ -104,6 +104,14 @@ SOURCE=.\Source\ArchiveComment.h # End Source File # Begin Source File +SOURCE=.\Source\ArchiveFile.h +# End Source File +# Begin Source File + +SOURCE=.\Source\ArchiveFileNameDesc.h +# End Source File +# Begin Source File + SOURCE=.\Source\ArchiveHeader.h # End Source File # End Group @@ -120,6 +128,14 @@ SOURCE=.\Source\ArchiveComment.cpp # End Source File # Begin Source File +SOURCE=.\Source\ArchiveFile.cpp +# End Source File +# Begin Source File + +SOURCE=.\Source\ArchiveFileNameDesc.cpp +# End Source File +# Begin Source File + SOURCE=.\Source\ArchiveHeader.cpp # End Source File # End Group @@ -152,5 +168,9 @@ SOURCE=.\Source\DebugUtils.h SOURCE=.\Source\Types.h # End Source File # End Group +# Begin Source File + +SOURCE=.\README.md +# End Source File # End Target # End Project diff --git a/Source/Archive.h b/Source/Archive.h index 2894785..bb7be5d 100644 --- a/Source/Archive.h +++ b/Source/Archive.h @@ -4,11 +4,16 @@ #include #include #include +#include #include "Types.h" #include "DebugUtils.h" #include "ArchiveComment.h" #include "ArchiveHeader.h" +#include "ArchiveFile.h" +#include "ArchiveFileNameDesc.h" +#include "ArchiveFileNameChunk.h" +#include "ArchiveFileName.h" class Archive { @@ -26,6 +31,8 @@ class Archive ArchiveComment m_Comment; ArchiveHeader m_Header; + + protected: std::ifstream m_hH2O; private: diff --git a/Source/ArchiveComment.h b/Source/ArchiveComment.h index fe42b5f..5a0116f 100644 --- a/Source/ArchiveComment.h +++ b/Source/ArchiveComment.h @@ -1,5 +1,6 @@ /* ArchiveComment.h */ #pragma once + #include "Types.h" #define H2O_COMMENT_TERMINATOR 0x1A @@ -7,7 +8,7 @@ #pragma pack(push, 1) struct ArchiveComment { - char szHeader[9]; + char szHeader[8]; float VersionInfo; char* szComments; }; diff --git a/Source/ArchiveFile.cpp b/Source/ArchiveFile.cpp new file mode 100644 index 0000000..0c7dbc2 --- /dev/null +++ b/Source/ArchiveFile.cpp @@ -0,0 +1,2 @@ +/* ArchiveFile.cpp */ +#include "ArchiveFile.h" diff --git a/Source/ArchiveFile.h b/Source/ArchiveFile.h new file mode 100644 index 0000000..5b1b799 --- /dev/null +++ b/Source/ArchiveFile.h @@ -0,0 +1,19 @@ +/* ArchiveFile.h */ +#pragma once + +#include "Types.h" + +#pragma pack(push, 1) +struct ArchiveFile +{ + uint32_t CompressionTag; + int32_t FolderNameIndex; + int32_t FileNameIndex; + uint32_t FileId; + uint32_t RawSize; + uint32_t CompressedSize; + uint32_t Offest; + char CRC32[4]; + uint32_t UnknownConstant; +}; +#pragma pack(pop) \ No newline at end of file diff --git a/Source/ArchiveFileName.cpp b/Source/ArchiveFileName.cpp new file mode 100644 index 0000000..ab5e27f --- /dev/null +++ b/Source/ArchiveFileName.cpp @@ -0,0 +1,2 @@ +/* ArchiveFileName.cpp */ +#include "ArchiveFileName.h" diff --git a/Source/ArchiveFileName.h b/Source/ArchiveFileName.h new file mode 100644 index 0000000..158fb76 --- /dev/null +++ b/Source/ArchiveFileName.h @@ -0,0 +1,12 @@ +/* ArchiveFileName.h */ +#pragma once + +#include "Types.h" + +#pragma pack(push, 1) +struct ArchiveFileName +{ + char* FileName; + uint16_t NullTerminator; +}; +#pragma pack(pop) diff --git a/Source/ArchiveFileNameChunk.cpp b/Source/ArchiveFileNameChunk.cpp new file mode 100644 index 0000000..7bb75e5 --- /dev/null +++ b/Source/ArchiveFileNameChunk.cpp @@ -0,0 +1,2 @@ +/* ArchiveFileNameChunk.cpp */ +#include "ArchiveFileNameChunk.h" \ No newline at end of file diff --git a/Source/ArchiveFileNameChunk.h b/Source/ArchiveFileNameChunk.h new file mode 100644 index 0000000..ec31c12 --- /dev/null +++ b/Source/ArchiveFileNameChunk.h @@ -0,0 +1,12 @@ +/* ArchiveFileNameChunk.h */ +#pragma once + +#include "Types.h" + +#pragma pack(push, 1) +struct ArchiveFileNameChunk +{ + uint32_t FileNameCount; + uint32_t FileNameSize; +}; +#pragma pack(pop) \ No newline at end of file diff --git a/Source/ArchiveFileNameDesc.cpp b/Source/ArchiveFileNameDesc.cpp new file mode 100644 index 0000000..8622a4a --- /dev/null +++ b/Source/ArchiveFileNameDesc.cpp @@ -0,0 +1,2 @@ +/* ArchiveFileNameDesc.cpp */ +#include "ArchiveFileNameDesc.h" \ No newline at end of file diff --git a/Source/ArchiveFileNameDesc.h b/Source/ArchiveFileNameDesc.h new file mode 100644 index 0000000..a4e05b3 --- /dev/null +++ b/Source/ArchiveFileNameDesc.h @@ -0,0 +1,14 @@ +/* ArchiveFileNameDesc.h */ +#pragma once + +#include "Types.h" + +#pragma pack(push, 1) +struct ArchiveFileNameDesc +{ + uint32_t CompressedSize; + uint32_t RawSize; + char CRC32[4]; + char* CompressedChunk; +}; +#pragma pack(pop) \ No newline at end of file diff --git a/Source/ArchiveHeader.h b/Source/ArchiveHeader.h index d1baa11..fedf43d 100644 --- a/Source/ArchiveHeader.h +++ b/Source/ArchiveHeader.h @@ -1,5 +1,6 @@ /* ArchiveHeader.h */ #pragma once + #include "Types.h" #pragma pack(push, 1)