| 33 |
|
|
| 34 |
|
#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations |
| 35 |
|
#include "boost/lexical_cast.hpp" //int -> string |
| 36 |
+ |
#include "boost/algorithm/string.hpp" |
| 37 |
|
#include "installer.h" |
| 38 |
|
|
| 39 |
|
#ifdef WIN32 |
| 43 |
|
#include <dirent.h> |
| 44 |
|
#endif |
| 45 |
|
|
| 46 |
< |
//const string strInstallerVersion = "1.0"; |
| 46 |
> |
|
| 47 |
|
const bool SPLIT = 1; |
| 48 |
|
const bool NOT_SPLIT = 0; |
| 49 |
|
bool splitInstances = SPLIT; |
| 65 |
|
using namespace std; |
| 66 |
|
|
| 67 |
|
|
| 68 |
+ |
vector<string> globalInstalledMods; |
| 69 |
+ |
vector<ModPackage> globalPackages; |
| 70 |
|
|
| 71 |
|
|
| 72 |
|
#include "boost/date_time/gregorian/gregorian.hpp" |
| 77 |
|
|
| 78 |
|
string output; |
| 79 |
|
string escape_me = "& ;()|<>\"'\\#*?$"; |
| 80 |
< |
for(int i = 0; i < input.size(); i++) { |
| 81 |
< |
for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\'; |
| 80 |
> |
for(unsigned int i = 0; i < input.size(); i++) { |
| 81 |
> |
for(unsigned int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\'; |
| 82 |
|
output += input[i]; |
| 83 |
|
} |
| 84 |
|
return output; |
| 124 |
|
path TRAM = Animations / "level0_TRAM"; |
| 125 |
|
|
| 126 |
|
vector<path> GDFPaths; |
| 127 |
< |
GDFPaths.push_back(Characters); |
| 127 |
> |
//GDFPaths.push_back(Characters); |
| 128 |
|
GDFPaths.push_back(Particles); |
| 129 |
|
GDFPaths.push_back(Textures); |
| 130 |
|
GDFPaths.push_back(Sounds); |
| 142 |
|
|
| 143 |
|
vector<path> VanillaPaths; |
| 144 |
|
|
| 145 |
< |
VanillaPaths.push_back(VanillaCharacters); |
| 145 |
> |
//VanillaPaths.push_back(VanillaCharacters); |
| 146 |
|
VanillaPaths.push_back(VanillaParticles); |
| 147 |
|
VanillaPaths.push_back(VanillaTextures); |
| 148 |
|
VanillaPaths.push_back(VanillaSounds); |
| 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 ) |
| 240 |
|
else remove(dir_itr->path()); |
| 241 |
|
} |
| 242 |
|
else if (dir_itr->path().filename().substr(0,4) == "TRAC" |
| 243 |
< |
|| dir_itr->path().filename().substr(0,4) == "ONVL") { |
| 243 |
> |
) { |
| 244 |
|
cout <<dir_itr->path().filename() << "\n"; |
| 245 |
|
if(!exists( TRAC / dir_itr->filename())) rename(dir_itr->path(), TRAC / dir_itr->filename()); |
| 246 |
|
else remove(dir_itr->path()); |
| 260 |
|
else if (dir_itr->path().filename().substr(0,4) == "ONCC" |
| 261 |
|
|| dir_itr->path().filename().substr(0,4) == "TRBS" |
| 262 |
|
|| dir_itr->path().filename().substr(0,4) == "ONCV" |
| 263 |
+ |
|| dir_itr->path().filename().substr(0,4) == "ONVL" |
| 264 |
|
|| dir_itr->path().filename().substr(0,4) == "TRMA" |
| 265 |
|
|| dir_itr->path().filename().substr(0,4) == "TRSC" |
| 266 |
|
|| dir_itr->path().filename().substr(0,4) == "TRAS") { |
| 301 |
|
if(!exists( "VanillaDats/level0_Final/level0_Final/" + dir_itr->filename())) rename(dir_itr->path(), "VanillaDats/level0_Final/level0_Final/" + dir_itr->filename()); |
| 302 |
|
else remove(dir_itr->path()); |
| 303 |
|
} |
| 304 |
+ |
|
| 305 |
|
if (exists(dir_itr->path())) { |
| 306 |
|
|
| 307 |
|
} |
| 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) )); |
| 339 |
|
logfile << (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final VanillaDats/level" + levels[i] + "_Final/level" |
| 340 |
|
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log").c_str() << '\n'; |
| 341 |
|
string sys_str = (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final VanillaDats/level" + levels[i] + "_Final/level" |
| 342 |
< |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log"); |
| 342 |
> |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni"); |
| 343 |
|
system(sys_str.c_str() ); |
| 344 |
|
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 345 |
|
parts_done++; |
| 346 |
|
} |
| 347 |
< |
create_directory( VanillaCharacters.parent_path() ); |
| 347 |
> |
//create_directory( VanillaCharacters.parent_path() ); |
| 348 |
|
create_directory( VanillaParticles.parent_path() ); |
| 349 |
|
create_directory( VanillaTextures.parent_path() ); |
| 350 |
|
create_directory( VanillaSounds.parent_path() ); |
| 351 |
|
create_directory( VanillaAnimations.remove_filename() ); |
| 352 |
|
|
| 353 |
< |
for(int j = 0; j < GDFPaths.size(); j++) { |
| 353 |
> |
for(unsigned int j = 0; j < GDFPaths.size(); j++) { |
| 354 |
|
logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n"; |
| 355 |
|
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() ); |
| 356 |
|
system((strOniSplit + " " + strImportOption + " " + GDFPaths[j].string() + " " + VanillaPaths[j].string()).c_str()); |
| 357 |
|
parts_done++; |
| 358 |
|
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 359 |
|
} |
| 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()); |
| 398 |
|
copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); |
| 399 |
|
setProgressBar( 1000 ); |
| 400 |
|
|
| 401 |
< |
if(!exists("../persist.dat")) |
| 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")) |
| 406 |
> |
if(exists("../../key_config.txt"))if(!exists("../key_config.txt")) |
| 407 |
|
copy("../../key_config.txt",".."); |
| 408 |
|
|
| 409 |
|
#ifndef WIN32 |
| 447 |
|
|
| 448 |
|
try |
| 449 |
|
{ |
| 450 |
< |
directory_iterator end_iter; |
| 407 |
< |
for (directory_iterator dir_itr("./packages"); dir_itr != end_iter; ++dir_itr) |
| 450 |
> |
for (directory_iterator dir_itr("./packages"), end_itr; dir_itr != end_itr; ++dir_itr) |
| 451 |
|
{ |
| 452 |
|
file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str()); |
| 453 |
|
//cout << filename << "\n"; |
| 526 |
|
} |
| 527 |
|
else if (!HasOnis.compare(*iter)) { |
| 528 |
|
iter++; iter++; |
| 529 |
< |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasOnis = 1; //Gotta love c++'s lack of a standard case-insensitive |
| 530 |
< |
else if (!HasBSL.compare(*iter)) { // string comparer...I know my implementation here sucks. I need to change it to check each character one by one. At the moment, |
| 531 |
< |
iter++; iter++;} // using "YFR" would probably set it off. :< |
| 532 |
< |
|
| 533 |
< |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasBSL = 1; |
| 529 |
> |
if ( boost::iequals(*iter, "Yes")) package.hasOnis = 1; |
| 530 |
> |
} |
| 531 |
> |
else if (!HasBSL.compare(*iter)) { // string comparer...I know my implementation here sucks. I need to change it to check each character one by one. At the moment, |
| 532 |
> |
iter++; iter++; // using "YFR" would probably set it off. :< |
| 533 |
> |
if ( boost::iequals(*iter, "Yes")) package.hasBSL = 1; |
| 534 |
> |
else if ( boost::iequals(*iter, "Addon")) package.hasAddon = 1; |
| 535 |
|
} |
| 536 |
|
else if (!HasDeltas.compare(*iter)) { |
| 537 |
|
iter++; iter++; |
| 557 |
|
//cout << " "; |
| 558 |
|
package.category += *iter + " "; |
| 559 |
|
} |
| 516 |
– |
} |
| 560 |
|
} |
| 561 |
< |
else if (!Creator.compare(*iter)) { //if it contains the name |
| 562 |
< |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 563 |
< |
if (ARROW.compare(*iter) && Creator.compare(*iter)) { //ignores "->" and "Category" |
| 564 |
< |
//cout << *iter; |
| 565 |
< |
//cout << " "; |
| 566 |
< |
package.creator += *iter + " "; |
| 567 |
< |
} |
| 561 |
> |
} |
| 562 |
> |
else if (!Creator.compare(*iter)) { //if it contains the name |
| 563 |
> |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 564 |
> |
if (ARROW.compare(*iter) && Creator.compare(*iter)) { //ignores "->" and "Category" |
| 565 |
> |
//cout << *iter; |
| 566 |
> |
//cout << " "; |
| 567 |
> |
package.creator += *iter + " "; |
| 568 |
|
} |
| 569 |
|
} |
| 570 |
< |
else if (!Readme.compare(*iter)) { //if it contains the name |
| 571 |
< |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 572 |
< |
if (ARROW.compare(*iter) && Readme.compare(*iter)) { //ignores "->" and "Category" |
| 573 |
< |
if(!(*iter).compare("\\n")) package.readme += '\n'; |
| 574 |
< |
else package.readme += *iter + " "; |
| 575 |
< |
} |
| 570 |
> |
} |
| 571 |
> |
else if (!Readme.compare(*iter)) { //if it contains the name |
| 572 |
> |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 573 |
> |
if (ARROW.compare(*iter) && Readme.compare(*iter)) { //ignores "->" and "Category" |
| 574 |
> |
if(!(*iter).compare("\\n")) package.readme += '\n'; |
| 575 |
> |
else package.readme += *iter + " "; |
| 576 |
|
} |
| 577 |
|
} |
| 578 |
|
} |
| 536 |
– |
|
| 579 |
|
} |
| 580 |
< |
package.doOutput(); |
| 581 |
< |
return package; |
| 580 |
> |
|
| 581 |
> |
} |
| 582 |
> |
package.doOutput(); |
| 583 |
> |
return package; |
| 584 |
|
} |
| 585 |
|
|
| 586 |
|
void recompileAll(vector<string> installedMods) |
| 587 |
< |
{ |
| 587 |
> |
{try { |
| 588 |
|
busy = 1; |
| 589 |
|
using namespace boost::gregorian; |
| 590 |
|
using namespace boost::posix_time; |
| 591 |
|
using boost::lexical_cast; |
| 592 |
|
using boost::bad_lexical_cast; |
| 593 |
< |
|
| 550 |
< |
setStatusArea("Importing levels..."); |
| 551 |
< |
//setStatusArea("Recompiling Data..."); |
| 552 |
< |
path vanilla_dir = "./VanillaDats/"; |
| 593 |
> |
path vanilla_dir = "./VanillaDats/"; |
| 594 |
|
string importCommand = ""; |
| 595 |
|
char statusString[128]; |
| 596 |
|
int numberOfDats = 0; |
| 597 |
|
int j = 1; |
| 598 |
|
string datString; |
| 599 |
+ |
|
| 600 |
+ |
|
| 601 |
+ |
setStatusArea("Importing levels..."); |
| 602 |
+ |
//setStatusArea("Recompiling Data..."); |
| 603 |
+ |
|
| 604 |
|
std::stringstream out; |
| 605 |
|
|
| 606 |
|
ptime start_time(second_clock::local_time()); |
| 607 |
|
clearOldDats(); |
| 608 |
< |
remove("Install.log"); |
| 608 |
> |
|
| 609 |
> |
if(exists("Install.log")) remove("Install.log"); |
| 610 |
|
ofstream logfile("Install.log"); |
| 611 |
|
logfile << "Mod Installation started " << to_simple_string(start_time) << endl; |
| 612 |
|
logfile.close(); |
| 613 |
+ |
|
| 614 |
+ |
|
| 615 |
|
if(splitInstances == SPLIT){ |
| 616 |
|
recursive_directory_iterator end_iter; |
| 617 |
|
|
| 625 |
|
numberOfDats++; |
| 626 |
|
} |
| 627 |
|
} |
| 628 |
< |
catch(exception ex) { |
| 628 |
> |
catch(exception & ex) { |
| 629 |
> |
remove("Install.log"); |
| 630 |
> |
ofstream logfile("Install.log"); |
| 631 |
> |
|
| 632 |
|
|
| 633 |
+ |
logfile << "Warning, exception " << ex.what() << "!"; |
| 634 |
+ |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 635 |
+ |
logfile.close(); |
| 636 |
|
} |
| 637 |
|
} |
| 638 |
|
try { |
| 639 |
|
//recursive_directory_iterator end_iter; |
| 640 |
< |
|
| 640 |
> |
|
| 641 |
|
|
| 642 |
|
out << numberOfDats; |
| 643 |
|
datString = out.str(); |
| 650 |
|
if ( is_directory( dir_itr->status() ) && dir_itr.level() == 1) |
| 651 |
|
{ |
| 652 |
|
importCommand = strOniSplit + " " + strImportOption + " " + dir_itr->path().parent_path().string() + '/' + dir_itr->path().filename(); |
| 653 |
< |
for (int i = 0; i < installedMods.size(); ++i) { |
| 653 |
> |
for (unsigned int i = 0; i < installedMods.size(); ++i) { |
| 654 |
|
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename() )) |
| 655 |
|
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename(); |
| 656 |
|
|
| 723 |
|
if ( is_directory( dir_itr->status() ) ) |
| 724 |
|
{ |
| 725 |
|
importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " "; |
| 726 |
< |
for (int i = 0; i < installedMods.size(); ++i) { |
| 726 |
> |
for (unsigned int i = 0; i < installedMods.size(); ++i) { |
| 727 |
|
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename() )) |
| 728 |
|
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename(); |
| 729 |
|
} |
| 750 |
|
logfile.close(); |
| 751 |
|
}} |
| 752 |
|
} |
| 753 |
+ |
|
| 754 |
+ |
|
| 755 |
+ |
|
| 756 |
+ |
|
| 757 |
+ |
|
| 758 |
+ |
|
| 759 |
+ |
|
| 760 |
+ |
|
| 761 |
+ |
|
| 762 |
+ |
|
| 763 |
+ |
vector<string> BSLfolders; |
| 764 |
+ |
vector<string> skippedfolders; |
| 765 |
+ |
|
| 766 |
+ |
|
| 767 |
+ |
ofstream BSLlog("BSL.log"); |
| 768 |
+ |
for ( directory_iterator dir_itr( "../GameDataFolder/IGMD/" ), end_itr; |
| 769 |
+ |
dir_itr != end_itr; |
| 770 |
+ |
++dir_itr ) { |
| 771 |
+ |
if( exists(dir_itr->path().string() + "/ignore.txt") ){ |
| 772 |
+ |
BSLfolders.push_back(dir_itr->path().filename()); |
| 773 |
+ |
skippedfolders.push_back(dir_itr->path().filename()); |
| 774 |
+ |
} |
| 775 |
+ |
} |
| 776 |
+ |
|
| 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" |
| 781 |
+ |
<< "HasBSL: " << globalPackages[j].hasBSL << "\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/" ) ) { |
| 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 |
+ |
|
| 800 |
+ |
|
| 801 |
|
logfile << "Writing config file"; |
| 802 |
|
writeInstalledMods(installedMods); |
| 803 |
|
setProgressBar(1000); |
| 804 |
< |
setStatusArea("Done! You can now play Oni."); |
| 804 |
> |
|
| 805 |
> |
string finallyDone = "Done! You can now play Oni."; |
| 806 |
> |
|
| 807 |
> |
|
| 808 |
> |
|
| 809 |
> |
setStatusArea(finallyDone); |
| 810 |
|
|
| 811 |
|
ptime end_time(second_clock::local_time()); |
| 812 |
|
time_period total_time (start_time, end_time); |
| 815 |
|
ofstream logfile2("Install.log", ios::app | ios::ate); |
| 816 |
|
string outstring = (string)"\n\nGlobalization ended " + to_simple_string(end_time) + "\nThe process took ";// + (string)total_time.length(); |
| 817 |
|
|
| 818 |
< |
logfile2 << "\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); |
| 818 |
> |
logfile2 << "\nInstallation ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); |
| 819 |
|
|
| 820 |
|
//logfile2.write(outstring.c_str(), outstring.length()); |
| 821 |
|
logfile2.close(); |
| 824 |
|
|
| 825 |
|
Sleep(1000); |
| 826 |
|
setProgressBar(0); |
| 827 |
+ |
|
| 828 |
+ |
} |
| 829 |
+ |
catch(exception & ex) { |
| 830 |
+ |
remove("Install.log"); //why did we do this? :| |
| 831 |
+ |
ofstream logfile("Install.log"); |
| 832 |
+ |
|
| 833 |
+ |
|
| 834 |
+ |
logfile << "Warning, exception " << ex.what() << "!"; |
| 835 |
+ |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 836 |
+ |
logfile.close(); |
| 837 |
+ |
} |
| 838 |
|
busy = 0; |
| 839 |
|
} |
| 840 |
|
|
| 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; |
| 858 |
+ |
BSLlog << "skipping " << BSLfolders[k] << " in " << pkg.modStringName << "\n"; |
| 859 |
+ |
break; |
| 860 |
+ |
} |
| 861 |
+ |
} |
| 862 |
+ |
if (!skip_folder && !exists("../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/ignore.txt")) { |
| 863 |
+ |
remove_all( "../GameDataFolder/IGMD/" + dir_itr->path().filename() ); |
| 864 |
+ |
Sleep(100); |
| 865 |
+ |
create_directory( "../GameDataFolder/IGMD/" + dir_itr->path().filename()); |
| 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++ ) { |
| 870 |
+ |
if ( bsl_itr->path().extension() == ".bsl" ) { |
| 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() ); //add back check for addon |
| 875 |
+ |
BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; |
| 876 |
+ |
} |
| 877 |
+ |
} |
| 878 |
+ |
} |
| 879 |
+ |
} |
| 880 |
+ |
catch ( const std::exception & ex ) |
| 881 |
+ |
{ |
| 882 |
+ |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 883 |
+ |
while(1) Sleep(1000); |
| 884 |
+ |
} |
| 885 |
+ |
BSLlog.close(); |
| 886 |
+ |
|
| 887 |
+ |
} |
| 888 |
+ |
|
| 889 |
+ |
|
| 890 |
|
void writeInstalledMods(vector<string> installedMods) |
| 891 |
|
{ |
| 892 |
|
|
| 968 |
|
|
| 969 |
|
} |
| 970 |
|
|
| 803 |
– |
vector<string> globalInstalledMods; |
| 804 |
– |
vector<ModPackage> globalPackages; |
| 971 |
|
#include "boost/thread.hpp" |
| 972 |
|
#include <boost/thread/mutex.hpp> |
| 973 |
|
|
| 1241 |
|
StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 ); |
| 1242 |
|
StatusArea->SetName(_T("StatusArea")); |
| 1243 |
|
StatusArea->SetFieldsCount(1); |
| 1244 |
< |
StatusArea->SetStatusText(_("AE Installer v1.0"), 0); |
| 1244 |
> |
StatusArea->SetStatusText(_("AE Installer v1.0.1"), 0); |
| 1245 |
|
itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0); |
| 1246 |
|
|
| 1247 |
|
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); |
| 1312 |
|
::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList); |
| 1313 |
|
#endif |
| 1314 |
|
|
| 1315 |
+ |
|
| 1316 |
|
/*if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) { |
| 1317 |
|
strImportOption = "-import:sep"; |
| 1318 |
|
splitInstances = NOT_SPLIT; |
| 1322 |
|
splitInstances = SPLIT; |
| 1323 |
|
}*/ |
| 1324 |
|
|
| 1325 |
+ |
|
| 1326 |
+ |
#ifndef WIN32 |
| 1327 |
+ |
strImportOption = "-import:sep"; |
| 1328 |
+ |
splitInstances = NOT_SPLIT; |
| 1329 |
+ |
#else |
| 1330 |
+ |
strImportOption = "-import:nosep"; |
| 1331 |
+ |
splitInstances = SPLIT; |
| 1332 |
+ |
#endif |
| 1333 |
+ |
|
| 1334 |
|
#ifndef WIN32 |
| 1335 |
|
strImportOption = "-import:sep"; |
| 1336 |
|
splitInstances = NOT_SPLIT; |
| 1341 |
|
|
| 1342 |
|
globalPackages = getPackages(); |
| 1343 |
|
globalInstalledMods = getInstallString(); |
| 1344 |
< |
for (int i = 0; i < globalPackages.size(); i++) { |
| 1344 |
> |
for (unsigned int i = 0; i < globalPackages.size(); i++) { |
| 1345 |
|
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 1346 |
|
if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 1347 |
|
} |
| 1380 |
|
{ |
| 1381 |
|
switch(SelectAll->Get3StateValue()) { |
| 1382 |
|
case wxCHK_UNCHECKED: |
| 1383 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1383 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1384 |
|
//SelectAll->Set3StateValue(wxCHK_CHECKED); |
| 1385 |
|
break; |
| 1386 |
|
case wxCHK_CHECKED: |
| 1387 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); |
| 1387 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); |
| 1388 |
|
//SelectAll->Set3StateValue(wxCHK_UNCHECKED); |
| 1389 |
|
break; |
| 1390 |
|
case wxCHK_UNDETERMINED: |
| 1391 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1391 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1392 |
|
//SelectAll->Set3StateValue(wxCHK_CHECKED); |
| 1393 |
|
break; |
| 1394 |
|
|
| 1552 |
|
TheInstallButton->Disable(); |
| 1553 |
|
recompileAll(thePackages); |
| 1554 |
|
TheInstallButton->Enable(); |
| 1555 |
+ |
|
| 1556 |
|
} |
| 1557 |
|
|
| 1558 |
|
vector<string> thePackages; |
| 1559 |
|
}; |
| 1560 |
|
|
| 1561 |
+ |
void globalize2(void) { |
| 1562 |
+ |
TheInstallButton->Disable(); |
| 1563 |
+ |
globalizeData(); |
| 1564 |
+ |
TheInstallButton->Enable(); |
| 1565 |
+ |
} |
| 1566 |
+ |
|
| 1567 |
+ |
|
| 1568 |
+ |
|
| 1569 |
|
void MainWindow::OnInstallButtonClick( wxCommandEvent& event ) |
| 1570 |
|
{ |
| 1571 |
|
|
| 1572 |
|
vector<string> localPackages; |
| 1573 |
< |
localPackages.push_back("Globalize"); |
| 1574 |
< |
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); |
| 1573 |
> |
localPackages.push_back("00000Globalize"); |
| 1574 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); |
| 1575 |
|
if ( !localPackages.empty() ) { |
| 1576 |
< |
|
| 1576 |
> |
sort(localPackages.begin(), localPackages.end()); |
| 1577 |
> |
localPackages[0] = "Globalize"; |
| 1578 |
|
//MainWindow::MainWindow().Hide(); |
| 1579 |
|
// boost::thread thrd2(recompileAll(localPackages) ); |
| 1580 |
|
//MainWindow::MainWindow().Show(); |
| 1713 |
|
|
| 1714 |
|
Mods_CheckboxList->Clear(); |
| 1715 |
|
//globalInstalledMods = getPackages(); |
| 1716 |
< |
for (int i = 0; i < globalPackages.size(); i++) { |
| 1716 |
> |
for (unsigned int i = 0; i < globalPackages.size(); i++) { |
| 1717 |
|
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 1718 |
|
if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 1719 |
|
//else Mods_CheckboxList->Check(i,0); |
| 1776 |
|
ofstream file(openFileDialog->GetPath().c_str()); |
| 1777 |
|
|
| 1778 |
|
vector<string>list; |
| 1779 |
< |
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); |
| 1779 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); |
| 1780 |
|
vector<string>::iterator begin_iter = list.begin(); |
| 1781 |
|
vector<string>::iterator end_iter = list.end(); |
| 1782 |
|
|