--- AE/Installer/trunk/source/main_window.cpp 2009/06/19 21:32:17 357 +++ AE/Installer/trunk/source/main_window.cpp 2009/06/29 19:23:42 379 @@ -1,11 +1,11 @@ /* -AE/Mod Installer -by Gumby and Iritscen + AE/Mod Installer + by Gumby and Iritscen */ -// To-do: - +// To-do: - Load credits from text resource file // - Institute lots of checks into file-handling -// - Clear mod info fields when mod is de-selected ??? +// - Clear mod info fields when mod is de-selected #define DEBUG #include @@ -30,7 +30,7 @@ by Gumby and Iritscen #include #endif -const string strInstallerVersion = "1.0"; +//const string strInstallerVersion = "1.0"; const bool SPLIT = 1; const bool NOT_SPLIT = 0; bool splitInstances = SPLIT; @@ -265,7 +265,7 @@ int globalizeData(void) } else { - logfile << "\tMoved file: " << dir_itr->path().filename() << "\n"; + //logfile << "\tMoved file: " << dir_itr->path().filename() << "\n"; } } @@ -288,7 +288,7 @@ int globalizeData(void) //printf(Step_x_x,"Step %d/%d: reimporting level", parts_done + 1, 7 + 2 * num_levels); setStatusArea((string)Step_x_x + levels[i] + (string)"_Final.dat"); setStatusArea("Step " + lexical_cast(parts_done + 1) + "/" + lexical_cast(total_steps) + " reimporting level" + levels[i]+"_Final.oni"); system( (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level" - + levels[i] + "_Final/level" + levels[i] + "_Final.oni > Globalize.oni").c_str()); + + levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log").c_str()); setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); parts_done++; } @@ -300,7 +300,7 @@ int globalizeData(void) for(int j = 0; j < GDFPaths.size(); j++) { logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n"; - setStatusArea("Step" + lexical_cast(parts_done + 1) + "/" + lexical_cast(total_steps) + ": reimporting " + GDFPaths[j].filename() ); + setStatusArea("Step " + lexical_cast(parts_done + 1) + "/" + lexical_cast(total_steps) + ": reimporting " + GDFPaths[j].filename() ); system((strOniSplit + " " + strImportOption + " " + GDFPaths[j].string() + " " + VanillaPaths[j].string()).c_str()); parts_done++; setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); @@ -323,8 +323,25 @@ int globalizeData(void) if (exists("../GameDataFolder/IGMD")) remove_all("../GameDataFolder/IGMD"); */ create_directory((path)"../GameDataFolder/IGMD"); - copy((path)"packages/VanillaBSL/", (path)"../GameDataFolder"); - setProgressBar( 1000 ); + copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); + setProgressBar( 1000 ); + + // CIP:last of all, set up the edition folder as a playable Oni installation by placing the latest application (+ Daodan DLL on Windows) in edition/ + + // CIP:then copy persist.dat and keyconfig.txt into edition/ as well + +#ifndef WIN32 + /* On Mac only, set the current GDF to the AE GDF by writing to Oni's global preferences file (thankfully a standard OS X ".plist" XML file). + If there are no Oni prefs (only possible if Oni has not been run even once), then the above line will fail silently, no harm done, + and when the user does run Oni for the first time, using the copy of the app in the AE GDF, Oni will set the prefs to use that GDF at that point */ + path fullAEpath = system_complete("."); // get full path for Installer + char prefsCommand[300] = "defaults write com.godgames.oni RetailInstallationPath -string '"; + strcat(prefsCommand, fullAEpath.parent_path().parent_path().string().c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF) + strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters + system(prefsCommand); + +#endif + setStatusArea((string)"Done! Now select your mod packages and click install."); // while(1) Sleep(-1); @@ -1273,19 +1290,17 @@ void MainWindow::OnModsCheckboxList1Togg void MainWindow::OnOptionsClick( wxCommandEvent& event ) { - - - - if (!event.GetInt() ) { OptionsPanel->Hide(); - MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());} + this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());} else { - //Uncomment this when we release, it gets annoying if you are testing globalization a lot ;) - //wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.", "AE Installer Alert", wxOK | wxICON_EXCLAMATION , wxDefaultPosition); - //YesNoDialog->ShowModal(); +// Uncomment this when we release, it gets annoying if you are testing globalization a lot ;) + wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.", + "AE Installer Alert", wxOK | wxICON_EXCLAMATION , wxDefaultPosition); + YesNoDialog->ShowModal(); OptionsPanel->Show(); - MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()); + this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()+1); + this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-1); } } @@ -1547,7 +1562,7 @@ void MainWindow::OnSaveClick( wxCommandE void MainWindow::OnReGlobalizeButtonClick( wxCommandEvent& event ) { - wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: This will DELETE the Edition's GameDataFolder and reglobalize all of your data. \n Are you SURE you want to do this? ", "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition); + wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: This will DELETE the Edition's GameDataFolder and recreate it from the vanilla Oni game data. \n Are you SURE you want to do this? ", "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition); if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no... @@ -1566,8 +1581,6 @@ void MainWindow::OnReGlobalizeButtonClic // Tg.create_thread( &globalizeData(), this ); #else globalizeData(); - setProgressBar(1000); - setStatusArea("Done!"); #endif this->InstallButton->Enable();