summaryrefslogtreecommitdiffstats
path: root/converter
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--converter/cConvert.cpp2
-rw-r--r--converter/cNBTData.cpp55
-rw-r--r--converter/cNBTData.h22
-rwxr-xr-xconverter/denotchbin147969 -> 148086 bytes
4 files changed, 52 insertions, 27 deletions
diff --git a/converter/cConvert.cpp b/converter/cConvert.cpp
index f2e05614c..0906a646e 100644
--- a/converter/cConvert.cpp
+++ b/converter/cConvert.cpp
@@ -173,7 +173,7 @@ int main () {
//testing of nbtparser.
- cNBTData* NBTData = new cNBTData::cNBTData(BlockData, testr*2);
+ cNBTData* NBTData = new cNBTData::cNBTData(BlockData, (testr));
//NBTData->m_bDecompressed = true;
NBTData->ParseData();
//NBTData->PrintData();
diff --git a/converter/cNBTData.cpp b/converter/cNBTData.cpp
index 33df10f15..a492f847c 100644
--- a/converter/cNBTData.cpp
+++ b/converter/cNBTData.cpp
@@ -102,7 +102,7 @@ bool cNBTData::CloseList()
void cNBTData::Compress()
{
- printf("Before Compress size: %i\n", m_BufferSize );//re
+ //printf("Before Compress size: %i\n", m_BufferSize );//re
const int MAXNBTSIZE = 1024 * 1024 * 120;
int ret;
@@ -153,7 +153,7 @@ void cNBTData::Compress()
m_Buffer = 0;
}
- printf("Compressed size: %i\n", have );//re
+ //printf("Compressed size: %i\n", have );//re
m_BufferSize = have;
m_Buffer = new char[ m_BufferSize ];
@@ -179,7 +179,7 @@ bool cNBTData::Decompress()
return false;
}
- printf("Before Decompress size: %i\n", m_BufferSize );//re
+ //printf("Before Decompress size: %i\n", m_BufferSize );//re
const int MAXNBTSIZE = 1024 * 1024 * 120 ;
@@ -229,7 +229,7 @@ bool cNBTData::Decompress()
printf("WARNING: NBT Data received was too big! (More than %i bytes)\n", MAXNBTSIZE);
}
- printf("Decompressed Size: %i\n", UncompressedSize );//re
+ //printf("Decompressed Size: %i\n", UncompressedSize );//re
m_bDecompressed = true;
return (ret == Z_STREAM_END) ? true : false;
}
@@ -377,10 +377,12 @@ void cNBTData::Serialize()
memcpy( m_Buffer, Buffer.c_str(), Buffer.size() );
m_BufferSize = Buffer.size();
- for(unsigned int i = 0; i < m_BufferSize; i++)//re
- {//re
- printf("%02i %02x %3i %c\n", i, (unsigned char)m_Buffer[i], (unsigned char)m_Buffer[i], m_Buffer[i] );//re
- }//re
+printf("m_BufferSize1: %i\n", m_BufferSize);//re
+
+ //for(unsigned int i = 0; i < m_BufferSize; i++)//re
+ //{//re
+ // printf("%02i %02x %3i %c\n", i, (unsigned char)m_Buffer[i], (unsigned char)m_Buffer[i], m_Buffer[i] );//re
+ //}//re
}
void cNBTData::ParseData()
@@ -391,15 +393,19 @@ void cNBTData::ParseData()
return;
}
- m_Index = 0;
- printf("cNBTData::ParseData()\n");//re
- for(unsigned int i = 0; i < m_BufferSize; i++)//re
+ m_Index = 0;
+ printf("m_BufferSize2: %i\n", m_BufferSize);//re
+ printf("cNBTData::ParseData()\n");//re
+ //for(unsigned int i = 0; i < m_BufferSize; i++)//re
+ for(unsigned int i = 0; i < 70; i++)//re
{//re
- printf("%02i %02x %3i %c\n", i, (unsigned char)m_Buffer[i], (unsigned char)m_Buffer[i], m_Buffer[i] );//re
+ printf("echo%02i %02x %3i %c\n", i, (unsigned char)m_Buffer[i], (unsigned char)m_Buffer[i], m_Buffer[i] );//re
}//re
while( m_Index < m_BufferSize )
{
+ printf("m_BufferSize3: %i\n", m_BufferSize);
+ printf("m_Index: %i\n", m_Index);
ParseTags();
}
}
@@ -412,11 +418,16 @@ void cNBTData::ParseTags()
unsigned char Tag = m_Buffer[m_Index];
if( Tag > 0 && m_ParseFunctions[ Tag ] )
{
+ printf("m_BufferSize4: %i\n", m_BufferSize);
+ printf("m_Index1: %i\n\n\n\n", m_Index);
+
m_Index++;
+ printf("Tag: %i\n", Tag);
(*this.*m_ParseFunctions[ Tag ])(true);
}
else if( Tag == TAG_End )
{
+ printf("Tag End");
m_Index++;
}
else
@@ -521,19 +532,33 @@ void cNBTData::ParseString( bool a_bNamed )
void cNBTData::ParseByteArray( bool a_bNamed )
{
+
std::string Name;
if( a_bNamed ) Name = ReadName();
- std::string String = ReadName();
- PutString( Name, String );
+ int Length = ReadInt();
+ std::string String;
- printf("STRING: %s (%s)\n", Name.c_str(), String.c_str() );//re
+
+ if( Length > 0 )
+ {
+ for(int i = 0; i < Length; i++, m_Index++)
+ {
+ String.push_back( m_Buffer[m_Index] );
+ }
+ }
+
+ PutByteArray( Name, String );
+
+ printf("VALUE: %s (%s)\n", Name.c_str(), String.c_str() );//re
}
std::string cNBTData::ReadName()
{
+printf("crui1 \n");
short Length = ReadShort();
+printf("crui Length: %i\n", Length);
std::string Name;
if( Length > 0 )
{
diff --git a/converter/cNBTData.h b/converter/cNBTData.h
index 66ec31b03..77d0ff256 100644
--- a/converter/cNBTData.h
+++ b/converter/cNBTData.h
@@ -36,7 +36,7 @@ public:
void PutShort( std::string Name, short Value ) { m_Shorts[Name] = Value; }
void PutInteger( std::string Name, int Value ) { m_Integers[Name] = Value; }
void PutString( std::string Name, std::string Value ) { m_Strings[Name] = Value; }
- void PutByteArray( std::string Name, char Value ) { m_ByteArrays[Name] = Value; }
+ void PutByteArray( std::string Name, std::string Value ) { m_ByteArrays[Name] = Value; }
void PutCompound( std::string Name );
void PutList( std::string Name, ENUM_TAG Type );
@@ -44,7 +44,7 @@ public:
short GetShort( std::string Name ) { return m_Shorts[Name]; }
int GetInteger( std::string Name ) { return m_Integers[Name]; }
std::string GetString( std::string Name ) { return m_Strings[Name]; }
- char GetByteArray( std::string Name ) { return m_ByteArrays[Name]; }
+ std::string GetByteArray( std::string Name ) { return m_ByteArrays[Name]; }
cNBTCompound* GetCompound( std::string Name );
cNBTList* GetList( std::string Name ) { return m_Lists[Name]; }
@@ -68,7 +68,7 @@ private:
typedef std::map<std::string, short> ShortMap;
typedef std::map<std::string, int> IntegerMap;
typedef std::map<std::string, std::string> StringMap;
- typedef std::map<std::string, char> ByteArrayMap;
+ typedef std::map<std::string, std::string> ByteArrayMap;
typedef std::map<std::string, cNBTCompound*> CompoundMap;
typedef std::map<std::string, cNBTList*> ListMap;
ByteMap m_Bytes;
@@ -121,17 +121,17 @@ public:
bool OpenList( std::string a_Name );
bool CloseList();
- void PutByte( std::string Name, char Value ) { m_CurrentCompound->PutByte( Name, Value ); }
- void PutShort( std::string Name, short Value ) { m_CurrentCompound->PutShort( Name, Value ); }
- void PutInteger( std::string Name, int Value ) { m_CurrentCompound->PutInteger( Name, Value ); }
- void PutString( std::string Name, std::string Value ) { m_CurrentCompound->PutString(Name, Value); }
- void PutByteArray( std::string Name, char Value ) { m_CurrentCompound->PutByteArray( Name, Value ); }
- void PutCompound( std::string Name ) { m_CurrentCompound->PutCompound( Name ); }
- void PutList( std::string Name, ENUM_TAG Type ) { m_CurrentCompound->PutList( Name, Type ); }
+ void PutByte( std::string Name, char Value ) { m_CurrentCompound->PutByte( Name, Value ); }
+ void PutShort( std::string Name, short Value ) { m_CurrentCompound->PutShort( Name, Value ); }
+ void PutInteger( std::string Name, int Value ) { m_CurrentCompound->PutInteger( Name, Value ); }
+ void PutString( std::string Name, std::string Value ) { m_CurrentCompound->PutString(Name, Value); }
+ void PutByteArray( std::string Name, std::string Value ) { m_CurrentCompound->PutByteArray( Name, Value ); }
+ void PutCompound( std::string Name ) { m_CurrentCompound->PutCompound( Name ); }
+ void PutList( std::string Name, ENUM_TAG Type ) { m_CurrentCompound->PutList( Name, Type ); }
int GetInteger( std::string Name ) { return m_CurrentCompound->GetInteger(Name); }
std::string GetString( std::string Name ) { return m_CurrentCompound->GetString(Name); }
- char GetByteArray( std::string Name ) { return m_CurrentCompound->GetByteArray(Name); }
+ std::string GetByteArray( std::string Name ) { return m_CurrentCompound->GetByteArray(Name); }
cNBTCompound* GetCompound( std::string Name ) { return m_CurrentCompound->GetCompound(Name); }
cNBTList* GetList( std::string Name ) { return m_CurrentCompound->GetList(Name); }
diff --git a/converter/denotch b/converter/denotch
index 4b2ace7f5..82715249d 100755
--- a/converter/denotch
+++ b/converter/denotch
Binary files differ