Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shawwwn committed May 14, 2014
0 parents commit 349ff41
Show file tree
Hide file tree
Showing 16 changed files with 544 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#OS junk files
[Tt]humbs.db
*.DS_Store

#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad

#MonoDevelop
*.pidb
*.userprefs

#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
*.sass-cache

#Project files
[Bb]uild/

#Subversion files
.svn

# Office Temp Files
~$*

# vim Temp Files
*~

#NuGet
packages/
*.nupkg

#ncrunch
*ncrunch*
*crunch*.local.xml

# visual studio database projects
*.dbmdl

#Test files
*.testsettings

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

*.opt
*.plg
*.dep
*.pch
*.ncb
*.exp
156 changes: 156 additions & 0 deletions H2OExtractor.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions H2OExtractor.dsw
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# ����: ���ܱ༭��ɾ���ù������ļ���

###############################################################################

Project: "H2OExtractor"=".\H2OExtractor.dsp" - Package Owner=<4>

Package=<5>
{{{
}}}

Package=<4>
{{{
}}}

###############################################################################

Global:

Package=<5>
{{{
}}}

Package=<3>
{{{
}}}

###############################################################################

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
H2OExtractor
=======

A .h2o archive extractor, has the ability to read and manipulate archives of WOTR that were previously unreadable.
Binary file added Sample/Cursors.H2O
Binary file not shown.
85 changes: 85 additions & 0 deletions Source/Archive.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* Archive.cpp */
#include "Archive.h"

Archive::Archive()
{
init();
}

Archive::Archive(char* szFilePath)
{
init();
open(szFilePath);
}

Archive::~Archive()
{
close();
}

uint64_t Archive::readComment(uint64_t streamPos)
{
m_hH2O.seekg(streamPos, std::ios::beg);

// Read Header
m_hH2O.read(m_Comment.szHeader, 8);
DB::debugLog("- ArchiveHeader: ", m_Comment.szHeader, NULL);

// Read VersionInfo
m_hH2O.read((char*)&m_Comment.VersionInfo, 4);
DB::debugLog("- VersionInfo: ", m_Comment.VersionInfo, NULL);

// Read Comments
uint64_t beg = m_hH2O.tellg();
char curByte = 0x0;
while (!m_hH2O.eof() && curByte!=H2O_COMMENT_TERMINATOR)
{
m_hH2O.read(&curByte, 1);
}
uint64_t end = m_hH2O.tellg();
m_hH2O.seekg(beg);
uint64_t length = end-beg;
m_Comment.szComments = new char[length];
memset(m_Comment.szComments, 0, length);
m_hH2O.read(m_Comment.szComments, length-1);
DB::debugLog("- Comments: ", m_Comment.szComments, NULL);
return end;
}

uint64_t Archive::readHeader(uint64_t streamPos)
{
m_hH2O.seekg(streamPos, std::ios::beg);
m_hH2O.read((char*)&m_Header, sizeof(ArchiveHeader));
DB::debugLog("size: ", sizeof(m_Header.CompressedSize), NULL);
DB::debugLog("- Version: ", m_Header.Version, NULL);
DB::debugLog("- FileCount: ", m_Header.FileCount, NULL);
DB::debugLog("- CompressedSize: ", m_Header.CompressedSize, NULL);
DB::debugLog("- RawSize: ", m_Header.RawSize, NULL);
return 0;
}

void Archive::open(char* szFilePath)
{
m_hH2O.open("Cursors.H2O", std::ifstream::binary);

uint64_t curPos = 0;
DB::debugLog("Comment Section: ", "", NULL);
curPos = readComment(curPos);
DB::debugLog("Header Section: ", "", NULL);
curPos = readHeader(curPos);
}

void Archive::close()
{
m_hH2O.close();
}


//
// Private
//
void Archive::init()
{
memset(&m_Comment, 0, sizeof(m_Comment));
memset(&m_Header, 0, sizeof(m_Header));
}
Loading

0 comments on commit 349ff41

Please sign in to comment.