ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/Installer/trunk/source/main_window.cpp
(Generate patch)

Comparing AE/Installer/trunk/source/main_window.cpp (file contents):
Revision 357 by gumby, Fri Jun 19 21:32:17 2009 UTC vs.
Revision 379 by iritscen, Mon Jun 29 19:23:42 2009 UTC

# Line 1 | Line 1
1   /*
2 < AE/Mod Installer
3 < by Gumby and Iritscen
2 > AE/Mod Installer
3 > by Gumby and Iritscen
4   */
5  
6 < // To-do: -
6 > // To-do: - Load credits from text resource file
7   //                - Institute lots of checks into file-handling
8 < //                - Clear mod info fields when mod is de-selected ???
8 > //                - Clear mod info fields when mod is de-selected
9  
10   #define DEBUG
11   #include <stdio.h>
# Line 30 | Line 30 | by Gumby and Iritscen
30   #include <dirent.h>
31   #endif
32  
33 < const string strInstallerVersion = "1.0";
33 > //const string strInstallerVersion = "1.0";
34   const bool SPLIT = 1;
35   const bool NOT_SPLIT = 0;
36   bool splitInstances = SPLIT;
# Line 265 | Line 265 | int globalizeData(void)
265  
266                                                  }
267                                                  else {
268 <                                                        logfile << "\tMoved file: " << dir_itr->path().filename() << "\n";
268 >                                                        //logfile << "\tMoved file: " << dir_itr->path().filename() << "\n";
269                                                  }
270                                          }
271  
# Line 288 | Line 288 | int globalizeData(void)
288                          //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");
289                          setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " reimporting level" + levels[i]+"_Final.oni");
290                          system( (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level"
291 <                                + levels[i] + "_Final/level" + levels[i] + "_Final.oni > Globalize.oni").c_str());
291 >                                + levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log").c_str());
292                          setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) ));
293                          parts_done++;
294                  }
# Line 300 | Line 300 | int globalizeData(void)
300  
301                  for(int j = 0; j < GDFPaths.size(); j++) {
302                          logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n";
303 <                        setStatusArea("Step" + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() );
303 >                        setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() );
304                          system((strOniSplit + " " + strImportOption + " " + GDFPaths[j].string() + " " + VanillaPaths[j].string()).c_str());
305                          parts_done++;
306                          setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) ));
# Line 323 | Line 323 | int globalizeData(void)
323                  if (exists("../GameDataFolder/IGMD")) remove_all("../GameDataFolder/IGMD");
324                  */
325                  create_directory((path)"../GameDataFolder/IGMD");
326 <                copy((path)"packages/VanillaBSL/", (path)"../GameDataFolder");
327 <                setProgressBar( 1000 );
326 >                copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder");
327 >                setProgressBar( 1000 );
328 >                
329 >                // 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/
330 >                
331 >                // CIP:then copy persist.dat and keyconfig.txt into edition/ as well
332 >                
333 > #ifndef WIN32
334 >                /* 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).
335 >                   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,
336 >                   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 */
337 >                path fullAEpath = system_complete("."); // get full path for Installer
338 >                char prefsCommand[300] = "defaults write com.godgames.oni RetailInstallationPath -string '";
339 >                strcat(prefsCommand, fullAEpath.parent_path().parent_path().string().c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF)
340 >                strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters
341 >                system(prefsCommand);
342 >                
343 > #endif
344 >                
345                  setStatusArea((string)"Done! Now select your mod packages and click install.");
346                  //      while(1) Sleep(-1);
347  
# Line 1273 | Line 1290 | void MainWindow::OnModsCheckboxList1Togg
1290  
1291   void MainWindow::OnOptionsClick( wxCommandEvent& event )
1292   {
1276
1277
1278
1279
1293          if (!event.GetInt() ) {
1294                  OptionsPanel->Hide();
1295 <                MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());}
1295 >                this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());}
1296          else {
1297 <                //Uncomment this when we release, it gets annoying if you are testing globalization a lot ;)
1298 <                //wxMessageDialog* YesNoDialog = new wxMessageDialog(this,                      "WARNING: These options are for advanced users only, use with caution.", "AE Installer Alert",  wxOK | wxICON_EXCLAMATION       , wxDefaultPosition);
1299 <                //YesNoDialog->ShowModal();
1297 > //              Uncomment this when we release, it gets annoying if you are testing globalization a lot ;)
1298 >                wxMessageDialog* YesNoDialog = new wxMessageDialog(this,                        "WARNING: These options are for advanced users only, use with caution.",
1299 >                                                                                                                   "AE Installer Alert",  wxOK | wxICON_EXCLAMATION     , wxDefaultPosition);
1300 >                YesNoDialog->ShowModal();
1301                  OptionsPanel->Show();
1302 <                MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight());
1302 >                this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()+1);
1303 >                this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-1);
1304          }
1305   }
1306  
# Line 1547 | Line 1562 | void MainWindow::OnSaveClick( wxCommandE
1562  
1563   void MainWindow::OnReGlobalizeButtonClick( wxCommandEvent& event )
1564   {
1565 <        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);
1565 >        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);
1566  
1567          if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no...
1568  
# Line 1566 | Line 1581 | void MainWindow::OnReGlobalizeButtonClic
1581                  // Tg.create_thread( &globalizeData(), this );
1582   #else
1583                  globalizeData();
1569                setProgressBar(1000);
1570                setStatusArea("Done!");
1584   #endif
1585                  
1586                  this->InstallButton->Enable();

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)