summaryrefslogtreecommitdiffstats
path: root/converter
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-31 23:02:04 +0100
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-31 23:02:04 +0100
commitdda41a040696c8dcc3f6189c5650befec200cf0e (patch)
tree59657d723e4de5a894faa93252ae706154bfd4ef /converter
parentPlayer data is saved and loaded as human readable JSON now. (diff)
downloadcuberite-dda41a040696c8dcc3f6189c5650befec200cf0e.tar
cuberite-dda41a040696c8dcc3f6189c5650befec200cf0e.tar.gz
cuberite-dda41a040696c8dcc3f6189c5650befec200cf0e.tar.bz2
cuberite-dda41a040696c8dcc3f6189c5650befec200cf0e.tar.lz
cuberite-dda41a040696c8dcc3f6189c5650befec200cf0e.tar.xz
cuberite-dda41a040696c8dcc3f6189c5650befec200cf0e.tar.zst
cuberite-dda41a040696c8dcc3f6189c5650befec200cf0e.zip
Diffstat (limited to 'converter')
-rw-r--r--converter/cConvert.cpp53
-rwxr-xr-xconverter/denotchbin216850 -> 221817 bytes
2 files changed, 47 insertions, 6 deletions
diff --git a/converter/cConvert.cpp b/converter/cConvert.cpp
index a608d6a61..4ee5b6b74 100644
--- a/converter/cConvert.cpp
+++ b/converter/cConvert.cpp
@@ -2,18 +2,51 @@
#include <fstream>
#include <string>
#include <stdio.h>
-#include <string.h>
+//#include <string.h>
#include <ctype.h>
#include "zlib.h"
#include "cNBTData.h"
#include "timer.h"
#include "quicksort.h"
+#include <dirent.h>
+//#include "dircont.h"
using namespace std;
int main () {
+ string dir;
+ DIR* dp;
+ struct dirent *entry;
+ int found;
+ string entrys;
+ string str2;
+ string str3;
+ string filexPos;
+ string filezPos;
+ string pak_name;
+ //string* dir_array;
+ int dir_num_files = 0;
+ int ctr = 0;
+
+ if(dp = opendir("region/")){
+ while(entry = readdir(dp)){
+ entrys = entry->d_name;
+ found = entrys.find(".mcr");
+ if ( (found!=string::npos) && (entry->d_type==8) ) {
+ str2 = entrys.substr (2,sizeof(entrys));
+ filexPos = str2.substr (0,(int)str2.find("."));
+ str3 = str2.substr ((int)str2.find(".")+1, sizeof(str2));
+ filezPos = str3.substr (0,(int)str3.find("."));
+ pak_name = "X" + filexPos + "_Z" + filezPos + ".pak";
+ //printf ("pak_name: %s\n", pak_name.c_str());
+
+ // } //moving down to test
+ // } //mvong down to test
+ // closedir(dp); //moving down to test
+ //} //moving down to test
+
char SourceFile[128];
char OutputFile[128];
//ifstream file ("region/r.0.0.mcr", ios::in|ios::binary|ios::ate);
@@ -25,16 +58,17 @@ int main () {
FILE* f = 0;
FILE* wf = 0;
#ifdef _WIN32
- sprintf_s(SourceFile, 128, "region/%s","r.0.0.mcr"); //replace hard coded file with file array variable
- sprintf_s(OutputFile, 128, "world/%s","X0_Z0.pak"); //parce x and z from file array variable and place into pak file format
+ sprintf_s(SourceFile, 128, "region/%s",entrys.c_str()); //replace hard coded file with file array variable
+ sprintf_s(OutputFile, 128, "world/%s",pak_name.c_str()); //parce x and z from file array variable and place into pak file format
if( fopen_s(&wf, OutputFile, "wb" ) == 0 ) {} else { cout << "uhoh!" << endl; return 0; } //open new pak file for writing
#else
- sprintf(SourceFile, "region/%s","r.0.0.mcr"); //same as above but for linux
- sprintf(OutputFile, "world/%s","X0_Z0.pak");
+ sprintf(SourceFile, "region/%s",entrys.c_str()); //same as above but for linux
+ sprintf(OutputFile, "world/%s",pak_name.c_str());
if( (wf = fopen(OutputFile, "wb" )) != 0 ) {} else { cout << "uhoh!" << endl; return 0; }
#endif
+ printf ("Now Converting %s to %s\n", entrys.c_str(), pak_name.c_str() );
if( (f = fopen(SourceFile, "rb" )) != 0 ) { // no error
char* t_FakeHeader;
@@ -222,7 +256,7 @@ int main () {
}
- printf("Coord(X,Z):ChunkSize: %i,%i:%i\n", NBTData->GetInteger("xPos"), NBTData->GetInteger("zPos"), (int)CompressedSize );
+ //printf("Coord(X,Z):ChunkSize: %i,%i:%i\n", NBTData->GetInteger("xPos"), NBTData->GetInteger("zPos"), (int)CompressedSize );
NBTData->CloseCompound();// Close the compounds after you're done
NBTData->CloseCompound();
@@ -257,6 +291,13 @@ int main () {
clock_t end=clock();
cout << "Time elapsed: " << double(diffclock(end,begin)) << " ms"<< endl;
+
+
+ } //moving down to test
+ } //mvong down to test
+ closedir(dp); //moving down to test
+ } //moving down to test
+
return 0;
diff --git a/converter/denotch b/converter/denotch
index 7637b9d6c..afef48860 100755
--- a/converter/denotch
+++ b/converter/denotch
Binary files differ