diff options
author | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-30 08:10:22 +0100 |
---|---|---|
committer | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-30 08:10:22 +0100 |
commit | 87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf (patch) | |
tree | 5f4aacc1eab10d69e75f7c145990f8676fc8e1f0 /converter | |
parent | I think I got Tag 7 working, now I need to add tag 4 for the deNotch map converter. (diff) | |
download | cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.gz cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.bz2 cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.lz cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.xz cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.tar.zst cuberite-87a7bfa9aa1edd0d4ba467b341147fcaab3be7cf.zip |
Diffstat (limited to 'converter')
-rw-r--r-- | converter/cConvert.cpp | 2 | ||||
-rw-r--r-- | converter/cNBTData.cpp | 21 | ||||
-rw-r--r-- | converter/cNBTData.h | 17 | ||||
-rwxr-xr-x | converter/denotch | bin | 148086 -> 154788 bytes |
4 files changed, 35 insertions, 5 deletions
diff --git a/converter/cConvert.cpp b/converter/cConvert.cpp index 0906a646e..876d1a009 100644 --- a/converter/cConvert.cpp +++ b/converter/cConvert.cpp @@ -176,7 +176,7 @@ int main () { cNBTData* NBTData = new cNBTData::cNBTData(BlockData, (testr)); //NBTData->m_bDecompressed = true; NBTData->ParseData(); - //NBTData->PrintData(); + NBTData->PrintData(); return 1; fwrite( BlockData, DestSize, 1, wf ); //write contents of uncompressed block data to file to check to see if it's valid... It is! :D //fwrite( &temparr, compdlength, sizeof(unsigned char), wf ); diff --git a/converter/cNBTData.cpp b/converter/cNBTData.cpp index a492f847c..845e8382b 100644 --- a/converter/cNBTData.cpp +++ b/converter/cNBTData.cpp @@ -30,6 +30,7 @@ cNBTData::cNBTData( char* a_Buffer, unsigned int a_BufferSize ) m_ParseFunctions[TAG_Byte] = &cNBTData::ParseByte; m_ParseFunctions[TAG_Short] = &cNBTData::ParseShort; m_ParseFunctions[TAG_Int] = &cNBTData::ParseInt; + m_ParseFunctions[TAG_Long] = &cNBTData::ParseLong; m_ParseFunctions[TAG_String] = &cNBTData::ParseString; m_ParseFunctions[TAG_List] = &cNBTData::ParseList; m_ParseFunctions[TAG_Compound] = &cNBTData::ParseCompound; @@ -519,6 +520,17 @@ void cNBTData::ParseInt( bool a_bNamed ) printf("INT: %s %i\n", Name.c_str(), Value );//re } +void cNBTData::ParseLong( bool a_bNamed ) +{ + std::string Name; + if( a_bNamed ) Name = ReadName(); + long Value = ReadLong(); + + PutInteger( Name, Value ); + + printf("LONG: %s %li\n", Name.c_str(), Value );//re +} + void cNBTData::ParseString( bool a_bNamed ) { std::string Name; @@ -593,6 +605,15 @@ int cNBTData::ReadInt() return ntohl( Value ); } +long cNBTData::ReadLong() +{ + long Value = 0; + memcpy( &Value, m_Buffer+m_Index, sizeof(long) ); + m_Index+=sizeof(long); + + return ntohl( Value ); +} + void cNBTCompound::PutList( std::string Name, ENUM_TAG Type ) { m_Lists[Name] = new cNBTList( m_CurrentList, Type ); diff --git a/converter/cNBTData.h b/converter/cNBTData.h index 77d0ff256..4de9822d3 100644 --- a/converter/cNBTData.h +++ b/converter/cNBTData.h @@ -23,6 +23,7 @@ public: TAG_Byte, TAG_Short, TAG_Int, + TAG_Long, TAG_ByteArray = 7, TAG_String, TAG_List, @@ -32,10 +33,11 @@ public: void Clear(); - void PutByte( std::string Name, char Value ) { m_Bytes[Name] = Value; } - 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 PutByte( std::string Name, char Value ) { m_Bytes[Name] = Value; } + void PutShort( std::string Name, short Value ) { m_Shorts[Name] = Value; } + void PutInteger( std::string Name, int Value ) { m_Integers[Name] = Value; } + void PutLong( std::string Name, long Value ) { m_Longs[Name] = Value; } + void PutString( std::string Name, std::string Value ) { m_Strings[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 ); @@ -43,6 +45,7 @@ public: char GetByte( std::string Name ) { return m_Bytes[Name]; } short GetShort( std::string Name ) { return m_Shorts[Name]; } int GetInteger( std::string Name ) { return m_Integers[Name]; } + long GetLong( std::string Name ) { return m_Longs[Name]; } std::string GetString( std::string Name ) { return m_Strings[Name]; } std::string GetByteArray( std::string Name ) { return m_ByteArrays[Name]; } cNBTCompound* GetCompound( std::string Name ); @@ -67,6 +70,7 @@ private: typedef std::map<std::string, char> ByteMap; typedef std::map<std::string, short> ShortMap; typedef std::map<std::string, int> IntegerMap; + typedef std::map<std::string, long> LongMap; typedef std::map<std::string, std::string> StringMap; typedef std::map<std::string, std::string> ByteArrayMap; typedef std::map<std::string, cNBTCompound*> CompoundMap; @@ -74,6 +78,7 @@ private: ByteMap m_Bytes; ShortMap m_Shorts; IntegerMap m_Integers; + LongMap m_Longs; StringMap m_Strings; ByteArrayMap m_ByteArrays; CompoundMap m_Compounds; @@ -124,12 +129,14 @@ public: 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 PutLong( std::string Name, long Value ) { m_CurrentCompound->PutLong( 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); } + long GetLong( std::string Name ) { return m_CurrentCompound->GetLong(Name); } std::string GetString( std::string Name ) { return m_CurrentCompound->GetString(Name); } std::string GetByteArray( std::string Name ) { return m_CurrentCompound->GetByteArray(Name); } cNBTCompound* GetCompound( std::string Name ) { return m_CurrentCompound->GetCompound(Name); } @@ -153,12 +160,14 @@ private: void ParseByte( bool a_bNamed ); void ParseByteArray( bool a_bNamed ); void ParseInt( bool a_bNamed ); + void ParseLong( bool a_bNamed ); void ParseShort( bool a_bNamed ); short ReadShort(); std::string ReadName(); char ReadByte(); int ReadInt(); + long ReadLong(); cNBTCompound* m_CurrentCompound; diff --git a/converter/denotch b/converter/denotch Binary files differindex 82715249d..840178cc1 100755 --- a/converter/denotch +++ b/converter/denotch |