More changes to the denotch map converter

git-svn-id: http://mc-server.googlecode.com/svn/trunk@25 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
admin@omencraft.com 2011-10-30 08:04:40 +00:00
parent 87a7bfa9aa
commit 5134805bd7
4 changed files with 42 additions and 34 deletions

View File

@ -177,6 +177,12 @@ int main () {
//NBTData->m_bDecompressed = true;
NBTData->ParseData();
NBTData->PrintData();
//Char* Blocks =
//NBTData->GetByteArray("Blocks");
//for(unsigned int i = 0; i < 111; i++) {//re
//printf("Blocks?: %i\n", NBTData->cNBTCompound::GetByteArray("Blocks")[0]);
//}
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 );

View File

@ -551,18 +551,20 @@ void cNBTData::ParseByteArray( bool a_bNamed )
int Length = ReadInt();
std::string String;
char* ByteArray = new char[ Length ];
if( Length > 0 )
{
for(int i = 0; i < Length; i++, m_Index++)
{
String.push_back( m_Buffer[m_Index] );
ByteArray[i] = m_Buffer[ m_Index ];
//ByteArray[i].push_back( m_Buffer[m_Index] );
//String.push_back( m_Buffer[m_Index] );
}
}
PutByteArray( Name, String );
PutByteArray( Name, ByteArray );
printf("VALUE: %s (%s)\n", Name.c_str(), String.c_str() );//re
printf("VALUE: %s First 5 Chars: (%i,%i,%i,%i,%i)\n", Name.c_str(), ByteArray[0],ByteArray[1],ByteArray[2],ByteArray[3],ByteArray[4] );//re
}
std::string cNBTData::ReadName()

View File

@ -38,7 +38,7 @@ public:
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 PutByteArray( std::string Name, char* ByteArray ) { m_ByteArrays[Name] = ByteArray; }
void PutCompound( std::string Name );
void PutList( std::string Name, ENUM_TAG Type );
@ -47,7 +47,7 @@ public:
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]; }
char* GetByteArray( std::string Name ) { return m_ByteArrays[Name]; }
cNBTCompound* GetCompound( std::string Name );
cNBTList* GetList( std::string Name ) { return m_Lists[Name]; }
@ -72,7 +72,7 @@ private:
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, char*> ByteArrayMap;
typedef std::map<std::string, cNBTCompound*> CompoundMap;
typedef std::map<std::string, cNBTList*> ListMap;
ByteMap m_Bytes;
@ -131,14 +131,14 @@ public:
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 PutByteArray( std::string Name, char* ByteArray ) { m_CurrentCompound->PutByteArray( Name, ByteArray ); }
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); }
char* 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); }

Binary file not shown.