--- AE/Installer/trunk/source/main_window.cpp 2009/07/07 12:48:37 409 +++ AE/Installer/trunk/source/main_window.cpp 2009/07/17 01:55:31 436 @@ -42,7 +42,7 @@ ITaskbarList3 *pTaskbarList3; #include #endif -//const string strInstallerVersion = "1.0"; + const bool SPLIT = 1; const bool NOT_SPLIT = 0; bool splitInstances = SPLIT; @@ -121,7 +121,7 @@ int globalizeData(void) path TRAM = Animations / "level0_TRAM"; vector GDFPaths; - GDFPaths.push_back(Characters); + //GDFPaths.push_back(Characters); GDFPaths.push_back(Particles); GDFPaths.push_back(Textures); GDFPaths.push_back(Sounds); @@ -139,7 +139,7 @@ int globalizeData(void) vector VanillaPaths; - VanillaPaths.push_back(VanillaCharacters); + //VanillaPaths.push_back(VanillaCharacters); VanillaPaths.push_back(VanillaParticles); VanillaPaths.push_back(VanillaTextures); VanillaPaths.push_back(VanillaSounds); @@ -229,7 +229,7 @@ int globalizeData(void) else remove(dir_itr->path()); } else if (dir_itr->path().filename().substr(0,4) == "TRAC" - || dir_itr->path().filename().substr(0,4) == "ONVL") { + ) { cout <path().filename() << "\n"; if(!exists( TRAC / dir_itr->filename())) rename(dir_itr->path(), TRAC / dir_itr->filename()); else remove(dir_itr->path()); @@ -249,6 +249,7 @@ int globalizeData(void) else if (dir_itr->path().filename().substr(0,4) == "ONCC" || dir_itr->path().filename().substr(0,4) == "TRBS" || dir_itr->path().filename().substr(0,4) == "ONCV" + || dir_itr->path().filename().substr(0,4) == "ONVL" || dir_itr->path().filename().substr(0,4) == "TRMA" || dir_itr->path().filename().substr(0,4) == "TRSC" || dir_itr->path().filename().substr(0,4) == "TRAS") { @@ -289,6 +290,7 @@ int globalizeData(void) if(!exists( "VanillaDats/level0_Final/level0_Final/" + dir_itr->filename())) rename(dir_itr->path(), "VanillaDats/level0_Final/level0_Final/" + dir_itr->filename()); else remove(dir_itr->path()); } + if (exists(dir_itr->path())) { } @@ -318,12 +320,12 @@ int globalizeData(void) logfile << (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log").c_str() << '\n'; string sys_str = (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final VanillaDats/level" + levels[i] + "_Final/level" - + levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log"); + + levels[i] + "_Final/level" + levels[i] + "_Final.oni"); system(sys_str.c_str() ); setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); parts_done++; } - create_directory( VanillaCharacters.parent_path() ); + //create_directory( VanillaCharacters.parent_path() ); create_directory( VanillaParticles.parent_path() ); create_directory( VanillaTextures.parent_path() ); create_directory( VanillaSounds.parent_path() ); @@ -336,6 +338,9 @@ int globalizeData(void) parts_done++; setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); } + 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")); /* 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()); @@ -357,9 +362,9 @@ int globalizeData(void) copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); setProgressBar( 1000 ); - if(!exists("../persist.dat")) + if(exists("../../persist.dat")) if(!exists("../persist.dat")) copy("../../persist.dat",".."); - if(!exists("../key_config.txt")) + if(exists("../../key_config.txt"))if(!exists("../key_config.txt")) copy("../../key_config.txt",".."); #ifndef WIN32 @@ -540,29 +545,34 @@ ModPackage fileToModPackage(fstream &fil } void recompileAll(vector installedMods) -{ +{try { busy = 1; using namespace boost::gregorian; using namespace boost::posix_time; using boost::lexical_cast; using boost::bad_lexical_cast; - - setStatusArea("Importing levels..."); - //setStatusArea("Recompiling Data..."); - path vanilla_dir = "./VanillaDats/"; + path vanilla_dir = "./VanillaDats/"; string importCommand = ""; char statusString[128]; int numberOfDats = 0; int j = 1; string datString; + + + setStatusArea("Importing levels..."); + //setStatusArea("Recompiling Data..."); + std::stringstream out; ptime start_time(second_clock::local_time()); clearOldDats(); - remove("Install.log"); + + if(exists("Install.log")) remove("Install.log"); ofstream logfile("Install.log"); logfile << "Mod Installation started " << to_simple_string(start_time) << endl; logfile.close(); + + if(splitInstances == SPLIT){ recursive_directory_iterator end_iter; @@ -576,13 +586,19 @@ void recompileAll(vector install numberOfDats++; } } - catch(exception ex) { + catch(exception & ex) { + remove("Install.log"); + ofstream logfile("Install.log"); + + logfile << "Warning, exception " << ex.what() << "!"; + setStatusArea("Warning, exception " + (string)ex.what() + "!"); + logfile.close(); } } try { //recursive_directory_iterator end_iter; - + out << numberOfDats; datString = out.str(); @@ -716,9 +732,21 @@ void recompileAll(vector install Sleep(1000); setProgressBar(0); - busy = 0; + +} + catch(exception & ex) { + remove("Install.log"); + ofstream logfile("Install.log"); + + + logfile << "Warning, exception " << ex.what() << "!"; + setStatusArea("Warning, exception " + (string)ex.what() + "!"); + logfile.close(); + } + busy = 0; } + void writeInstalledMods(vector installedMods) { @@ -1075,7 +1103,7 @@ void MainWindow::CreateControls() StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 ); StatusArea->SetName(_T("StatusArea")); StatusArea->SetFieldsCount(1); - StatusArea->SetStatusText(_("AE Installer v1.0"), 0); + StatusArea->SetStatusText(_("AE Installer v1.0.1"), 0); itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0); wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); @@ -1146,6 +1174,7 @@ void MainWindow::CreateControls() ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList); #endif + /*if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) { strImportOption = "-import:sep"; splitInstances = NOT_SPLIT; @@ -1155,6 +1184,15 @@ void MainWindow::CreateControls() splitInstances = SPLIT; }*/ + +#ifndef WIN32 + strImportOption = "-import:sep"; + splitInstances = NOT_SPLIT; +#else + strImportOption = "-import:nosep"; + splitInstances = SPLIT; +#endif + #ifndef WIN32 strImportOption = "-import:sep"; splitInstances = NOT_SPLIT; @@ -1376,19 +1414,29 @@ struct recompile TheInstallButton->Disable(); recompileAll(thePackages); TheInstallButton->Enable(); + } vector thePackages; }; +void globalize2(void) { + TheInstallButton->Disable(); + globalizeData(); + TheInstallButton->Enable(); +} + + + void MainWindow::OnInstallButtonClick( wxCommandEvent& event ) { vector localPackages; - localPackages.push_back("Globalize"); + localPackages.push_back("00000Globalize"); for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); if ( !localPackages.empty() ) { - + sort(localPackages.begin(), localPackages.end()); + localPackages[0] = "Globalize"; //MainWindow::MainWindow().Hide(); // boost::thread thrd2(recompileAll(localPackages) ); //MainWindow::MainWindow().Show();