| 195 |
|
} |
| 196 |
|
logfile << "Exporting and moving...\n\n"; |
| 197 |
|
int total_steps = 8 + 2 * num_levels; |
| 198 |
+ |
|
| 199 |
|
for(int i = 0; i < 15; i++) |
| 200 |
|
{ |
| 201 |
|
|
| 211 |
|
system((strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat").c_str()); |
| 212 |
|
create_directory( "VanillaDats/level" + levels[i] + "_Final" ); |
| 213 |
|
create_directory( "VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final" ); |
| 214 |
+ |
|
| 215 |
+ |
//Moves the AKEV and other files into a safe directory so that level specific textures are not globalized... |
| 216 |
+ |
if ( strcmp(levels[i].c_str(), "0") ){ |
| 217 |
+ |
create_directory( "../GameDataFolder/level" + levels[i] + "_Final/AKEV" ); |
| 218 |
+ |
system((strOniSplit + " -move:overwrite ../GameDataFolder/level" + levels[i] + "_Final/AKEV ../GameDataFolder/level" + levels[i] + "_Final/AKEV*.oni").c_str()); |
| 219 |
+ |
|
| 220 |
+ |
} |
| 221 |
|
|
| 222 |
|
directory_iterator end_iter; |
| 223 |
|
for ( directory_iterator dir_itr( "../GameDataFolder/level" + levels[i] + "_Final" ); dir_itr != end_iter; ++dir_itr ) |
| 313 |
|
|
| 314 |
|
|
| 315 |
|
} |
| 316 |
+ |
|
| 317 |
|
logfile << "\tCleaning up TXMPs...\n"; |
| 318 |
|
system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + levels[i] + "_Final/TXMP*.oni").c_str()); |
| 319 |
+ |
|
| 320 |
+ |
|
| 321 |
+ |
if ( strcmp(levels[i].c_str(), "0") ){ |
| 322 |
+ |
system((strOniSplit + " -move:overwrite ../GameDataFolder/level" + levels[i] + "_Final ../GameDataFolder/level" + levels[i] + "_Final/AKEV/AKEV*.oni").c_str()); |
| 323 |
+ |
remove( "../GameDataFolder/level" + levels[i] + "_Final/AKEV" ); |
| 324 |
+ |
} |
| 325 |
+ |
|
| 326 |
|
parts_done++; |
| 327 |
|
|
| 328 |
|
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 360 |
|
logfile << "\nMoving level0_Characters\n"; |
| 361 |
|
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": moving level0_Characters" ); |
| 362 |
|
copy((path)"../GameDataFolder/level0_Characters", (path)("VanillaDats/level0_Final")); |
| 363 |
+ |
GDFPaths.push_back( Characters ); |
| 364 |
+ |
for(int i = 0; i < GDFPaths.size(); i++) |
| 365 |
+ |
{ |
| 366 |
+ |
directory_iterator end_iter; |
| 367 |
+ |
for ( directory_iterator dir_itr( GDFPaths[i] ); dir_itr != end_iter; ++dir_itr ) |
| 368 |
+ |
{ |
| 369 |
+ |
try |
| 370 |
+ |
{ |
| 371 |
+ |
|
| 372 |
+ |
|
| 373 |
+ |
rename(dir_itr->path(), "../GameDataFolder/level0_Final/" + dir_itr->path().filename() ); |
| 374 |
+ |
} |
| 375 |
+ |
catch(exception &ex) { |
| 376 |
+ |
|
| 377 |
+ |
} |
| 378 |
+ |
} |
| 379 |
+ |
} |
| 380 |
|
/* |
| 381 |
|
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) )); |
| 382 |
|
system((strOniSplit + " " + strImportOption + " " + Characters.string() + " " + VanillaCharacters.string()).c_str()); |
| 399 |
|
setProgressBar( 1000 ); |
| 400 |
|
|
| 401 |
|
if(exists("../../persist.dat")) if(!exists("../persist.dat")) |
| 402 |
+ |
|
| 403 |
+ |
//TODO: Concactate level0 Dirs. |
| 404 |
+ |
|
| 405 |
|
copy("../../persist.dat",".."); |
| 406 |
|
if(exists("../../key_config.txt"))if(!exists("../key_config.txt")) |
| 407 |
|
copy("../../key_config.txt",".."); |
| 758 |
|
|
| 759 |
|
|
| 760 |
|
|
| 761 |
< |
ofstream BSLlog("BSL.log"); |
| 761 |
> |
|
| 762 |
|
|
| 763 |
|
vector<string> BSLfolders; |
| 764 |
|
vector<string> skippedfolders; |
| 765 |
|
|
| 766 |
|
|
| 767 |
< |
|
| 767 |
> |
ofstream BSLlog("BSL.log"); |
| 768 |
|
for ( directory_iterator dir_itr( "../GameDataFolder/IGMD/" ), end_itr; |
| 769 |
|
dir_itr != end_itr; |
| 770 |
|
++dir_itr ) { |
| 777 |
|
for (int i = installedMods.size() - 1; i >= 0; i--) { //Iterates through the installed mods (backwards :P) |
| 778 |
|
for (unsigned int j = 0; j < globalPackages.size(); ++j) { //looking in the global packages |
| 779 |
|
if (globalPackages[j].modStringName == installedMods[i]) { //for a mod that has BSL in it |
| 780 |
< |
BSLlog << "Testing " << globalPackages[j].modStringName << "\n" |
| 780 |
> |
/*BSLlog << "Testing " << globalPackages[j].modStringName << "\n" |
| 781 |
|
<< "HasBSL: " << globalPackages[j].hasBSL << "\n" |
| 782 |
< |
<< "HasAddon: " << globalPackages[j].hasAddon << "\n"; |
| 782 |
> |
<< "HasAddon: " << globalPackages[j].hasAddon << "\n";*/ |
| 783 |
|
if(!(globalPackages[j].hasAddon || globalPackages[j].hasBSL)) break; //skip non-BSL |
| 784 |
< |
if( exists( "packages/" + globalPackages[j].modStringName + "/BSL" ) ) |
| 784 |
> |
if( exists( "packages/" + globalPackages[j].modStringName + "/BSL/" ) ) { |
| 785 |
|
copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); |
| 786 |
+ |
BSLlog << "Copied " << globalPackages[j].modStringName << "!\n"; |
| 787 |
+ |
} |
| 788 |
+ |
|
| 789 |
|
} |
| 790 |
|
|
| 791 |
|
} |
| 792 |
|
} |
| 793 |
|
|
| 794 |
|
ModPackage emptyPackage; |
| 795 |
+ |
emptyPackage.modStringName = "VanillaBSL"; |
| 796 |
+ |
emptyPackage.hasBSL = 1; |
| 797 |
|
copyBSL("packages/VanillaBSL/IGMD", BSLfolders, emptyPackage); |
| 798 |
|
BSLlog.close(); |
| 799 |
|
|
| 804 |
|
|
| 805 |
|
string finallyDone = "Done! You can now play Oni."; |
| 806 |
|
|
| 807 |
< |
a |
| 807 |
> |
|
| 808 |
|
|
| 809 |
|
setStatusArea(finallyDone); |
| 810 |
|
|
| 838 |
|
busy = 0; |
| 839 |
|
} |
| 840 |
|
|
| 841 |
< |
void copyBSL(string copypath, vector<string> BSLfolders, ModPackage pkg) { |
| 841 |
> |
void copyBSL(string copypath, vector<string>& BSLfolders, ModPackage pkg) { |
| 842 |
> |
|
| 843 |
> |
ofstream BSLlog("BSL2.log", ios::app ); |
| 844 |
> |
|
| 845 |
|
try { |
| 846 |
|
for ( directory_iterator dir_itr( copypath ), end_itr; |
| 847 |
|
dir_itr != end_itr; |
| 848 |
|
++dir_itr ) { |
| 849 |
|
|
| 850 |
|
if ( is_directory( dir_itr->path() ) && dir_itr->path().string() != ".svn" ) { |
| 851 |
+ |
BSLlog << "Testing " << dir_itr->path().string() << " HasBSL: " << pkg.hasBSL << " HasAddon: " << pkg.hasAddon << "\n"; |
| 852 |
|
int skip_folder = 0; |
| 853 |
+ |
|
| 854 |
|
for(unsigned int k = 0; k < BSLfolders.size(); k++) {//iterate through already found BSL folders |
| 855 |
+ |
BSLlog << "testing " << dir_itr->path().filename() << " vs " << BSLfolders[k] << "\n"; |
| 856 |
|
if(dir_itr->path().filename() == BSLfolders[k]) { |
| 857 |
< |
skip_folder = 1; |
| 857 |
> |
skip_folder = 1; |
| 858 |
> |
BSLlog << "skipping " << BSLfolders[k] << " in " << pkg.modStringName << "\n"; |
| 859 |
|
break; |
| 860 |
|
} |
| 861 |
|
} |
| 863 |
|
remove_all( "../GameDataFolder/IGMD/" + dir_itr->path().filename() ); |
| 864 |
|
Sleep(100); |
| 865 |
|
create_directory( "../GameDataFolder/IGMD/" + dir_itr->path().filename()); |
| 866 |
< |
|
| 866 |
> |
BSLlog << "Copied " << dir_itr->path().string() << " in " << pkg.modStringName << "!\n"; |
| 867 |
|
for ( directory_iterator bsl_itr( dir_itr->path() ); |
| 868 |
|
bsl_itr != end_itr; |
| 869 |
|
bsl_itr++ ) { |
| 871 |
|
copy_file(bsl_itr->path(), "../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/" + bsl_itr->path().filename()); |
| 872 |
|
} |
| 873 |
|
} |
| 874 |
< |
BSLfolders.push_back( dir_itr->path().filename() ); |
| 874 |
> |
BSLfolders.push_back( dir_itr->path().filename() ); //add back check for addon |
| 875 |
> |
BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; |
| 876 |
|
} |
| 877 |
|
} |
| 878 |
|
} |
| 882 |
|
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 883 |
|
while(1) Sleep(1000); |
| 884 |
|
} |
| 885 |
< |
|
| 885 |
> |
BSLlog.close(); |
| 886 |
> |
|
| 887 |
|
} |
| 888 |
< |
|
| 889 |
< |
|
| 888 |
> |
|
| 889 |
> |
|
| 890 |
|
void writeInstalledMods(vector<string> installedMods) |
| 891 |
|
{ |
| 892 |
|
|