--- AE/Installer/trunk/source/main_window.cpp 2009/10/09 03:22:08 461 +++ AE/Installer/trunk/source/main_window.cpp 2009/10/20 22:55:16 469 @@ -195,6 +195,7 @@ int globalizeData(void) } logfile << "Exporting and moving...\n\n"; int total_steps = 8 + 2 * num_levels; + for(int i = 0; i < 15; i++) { @@ -210,6 +211,13 @@ int globalizeData(void) system((strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat").c_str()); create_directory( "VanillaDats/level" + levels[i] + "_Final" ); create_directory( "VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final" ); + + //Moves the AKEV and other files into a safe directory so that level specific textures are not globalized... + if ( strcmp(levels[i].c_str(), "0") ){ + create_directory( "../GameDataFolder/level" + levels[i] + "_Final/AKEV" ); + system((strOniSplit + " -move:overwrite ../GameDataFolder/level" + levels[i] + "_Final/AKEV ../GameDataFolder/level" + levels[i] + "_Final/AKEV*.oni").c_str()); + + } directory_iterator end_iter; for ( directory_iterator dir_itr( "../GameDataFolder/level" + levels[i] + "_Final" ); dir_itr != end_iter; ++dir_itr ) @@ -305,8 +313,16 @@ int globalizeData(void) } + logfile << "\tCleaning up TXMPs...\n"; system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + levels[i] + "_Final/TXMP*.oni").c_str()); + + + if ( strcmp(levels[i].c_str(), "0") ){ + system((strOniSplit + " -move:overwrite ../GameDataFolder/level" + levels[i] + "_Final ../GameDataFolder/level" + levels[i] + "_Final/AKEV/AKEV*.oni").c_str()); + remove( "../GameDataFolder/level" + levels[i] + "_Final/AKEV" ); + } + parts_done++; setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); @@ -344,6 +360,23 @@ int globalizeData(void) logfile << "\nMoving level0_Characters\n"; setStatusArea("Step " + lexical_cast(parts_done + 1) + "/" + lexical_cast(total_steps) + ": moving level0_Characters" ); copy((path)"../GameDataFolder/level0_Characters", (path)("VanillaDats/level0_Final")); + GDFPaths.push_back( Characters ); + for(int i = 0; i < GDFPaths.size(); i++) + { + directory_iterator end_iter; + for ( directory_iterator dir_itr( GDFPaths[i] ); dir_itr != end_iter; ++dir_itr ) + { + try + { + + + rename(dir_itr->path(), "../GameDataFolder/level0_Final/" + dir_itr->path().filename() ); + } + catch(exception &ex) { + + } + } + } /* printf(Step_x_x,"Step %d/%d: reimporting level0_Characters", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); system((strOniSplit + " " + strImportOption + " " + Characters.string() + " " + VanillaCharacters.string()).c_str()); @@ -366,6 +399,9 @@ int globalizeData(void) setProgressBar( 1000 ); if(exists("../../persist.dat")) if(!exists("../persist.dat")) + + //TODO: Concactate level0 Dirs. + copy("../../persist.dat",".."); if(exists("../../key_config.txt"))if(!exists("../key_config.txt")) copy("../../key_config.txt",".."); @@ -722,13 +758,13 @@ void recompileAll(vector install - ofstream BSLlog("BSL.log"); + vector BSLfolders; vector skippedfolders; - +ofstream BSLlog("BSL.log"); for ( directory_iterator dir_itr( "../GameDataFolder/IGMD/" ), end_itr; dir_itr != end_itr; ++dir_itr ) { @@ -741,18 +777,23 @@ void recompileAll(vector install for (int i = installedMods.size() - 1; i >= 0; i--) { //Iterates through the installed mods (backwards :P) for (unsigned int j = 0; j < globalPackages.size(); ++j) { //looking in the global packages if (globalPackages[j].modStringName == installedMods[i]) { //for a mod that has BSL in it - BSLlog << "Testing " << globalPackages[j].modStringName << "\n" + /*BSLlog << "Testing " << globalPackages[j].modStringName << "\n" << "HasBSL: " << globalPackages[j].hasBSL << "\n" - << "HasAddon: " << globalPackages[j].hasAddon << "\n"; + << "HasAddon: " << globalPackages[j].hasAddon << "\n";*/ if(!(globalPackages[j].hasAddon || globalPackages[j].hasBSL)) break; //skip non-BSL - if( exists( "packages/" + globalPackages[j].modStringName + "/BSL" ) ) + if( exists( "packages/" + globalPackages[j].modStringName + "/BSL/" ) ) { copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); + BSLlog << "Copied " << globalPackages[j].modStringName << "!\n"; + } + } } } ModPackage emptyPackage; + emptyPackage.modStringName = "VanillaBSL"; + emptyPackage.hasBSL = 1; copyBSL("packages/VanillaBSL/IGMD", BSLfolders, emptyPackage); BSLlog.close(); @@ -763,7 +804,7 @@ void recompileAll(vector install string finallyDone = "Done! You can now play Oni."; -a + setStatusArea(finallyDone); @@ -797,17 +838,24 @@ a busy = 0; } -void copyBSL(string copypath, vector BSLfolders, ModPackage pkg) { +void copyBSL(string copypath, vector& BSLfolders, ModPackage pkg) { + + ofstream BSLlog("BSL2.log", ios::app ); + try { for ( directory_iterator dir_itr( copypath ), end_itr; dir_itr != end_itr; ++dir_itr ) { if ( is_directory( dir_itr->path() ) && dir_itr->path().string() != ".svn" ) { + BSLlog << "Testing " << dir_itr->path().string() << " HasBSL: " << pkg.hasBSL << " HasAddon: " << pkg.hasAddon << "\n"; int skip_folder = 0; + for(unsigned int k = 0; k < BSLfolders.size(); k++) {//iterate through already found BSL folders + BSLlog << "testing " << dir_itr->path().filename() << " vs " << BSLfolders[k] << "\n"; if(dir_itr->path().filename() == BSLfolders[k]) { - skip_folder = 1; + skip_folder = 1; + BSLlog << "skipping " << BSLfolders[k] << " in " << pkg.modStringName << "\n"; break; } } @@ -815,7 +863,7 @@ void copyBSL(string copypath, vectorpath().filename() ); Sleep(100); create_directory( "../GameDataFolder/IGMD/" + dir_itr->path().filename()); - + BSLlog << "Copied " << dir_itr->path().string() << " in " << pkg.modStringName << "!\n"; for ( directory_iterator bsl_itr( dir_itr->path() ); bsl_itr != end_itr; bsl_itr++ ) { @@ -823,7 +871,8 @@ void copyBSL(string copypath, vectorpath(), "../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/" + bsl_itr->path().filename()); } } - BSLfolders.push_back( dir_itr->path().filename() ); + BSLfolders.push_back( dir_itr->path().filename() ); //add back check for addon + BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; } } } @@ -833,10 +882,11 @@ void copyBSL(string copypath, vector installedMods) {