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 353 by iritscen, Sun Jun 14 23:28:58 2009 UTC vs.
Revision 361 by gumby, Fri Jun 19 22:46:57 2009 UTC

# Line 1 | Line 1
1   /*
2 < AE/Mod Installer
3 < by Gumby and Iritscen
4 < */
2 > AE/Mod Installer
3 > by Gumby and Iritscen
4 > */
5  
6 < // To-do: - Disable Install button when nothing (new) is selected
6 > // To-do: -
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 20 | Line 20
20   #include <sstream>
21  
22   #include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
23 <
23 > #include "boost/lexical_cast.hpp" //int -> string
24   #include "installer.h"
25  
26   #ifdef WIN32
# Line 34 | Line 34 | const string strInstallerVersion = "1.0"
34   const bool SPLIT = 1;
35   const bool NOT_SPLIT = 0;
36   bool splitInstances = SPLIT;
37 <
37 > bool busy = 0;
38   #ifdef WIN32
39   const string strOniSplit = "Onisplit.exe";
40   string strImportOption = "-import:nosep";
# Line 52 | Line 52 | using namespace boost::filesystem;
52   using namespace std;
53  
54  
55 /*
56 int main(void)
57 {
58 if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) splitInstances = NOT_SPLIT;
59 else splitInstances = NOT_SPLIT;
60 //     SetConsoleTitle("AE Installer"); windows junk, convert to SDL
61 #ifdef WIN32  
62 system("color 0A");
63 #endif
64 cout << "\nWelcome to the AE installer!\n";
65 cout << "\nWhat would you like to do?\n";
66
67 return mainMenu();
68 }
69 */
55  
56  
57 <
58 < int mainMenu(void)
59 < {
75 <        char choice = '0';
76 <        bool exit = false;
77 <        int err = 0;
78 <        do
79 <        {
80 <                if( exists( "../GameDataFolder" ) ) {
81 <                        cout << "\n1. Add new packages\n";
82 <                        cout << "2. Remove packages\n";
83 <                        cout << "3. See what is installed\n";
84 <                        cout << "4. Globalize data\n";
85 <                        cout << "5. About AE\n";
86 <                        cout << "6. Quit\n\n";
87 <                        
88 <                        choice = cin.get();
89 <                        cin.ignore(128, '\n');
90 <                        switch(choice)
91 <                        {
92 <                                case '1':
93 <                                        err = installPackages();
94 <                                        break;
95 <                                case '2':
96 <                                        err = uninstallPackages();
97 <                                        break;
98 <                                case '3':
99 <                                        err = listInstalledPackages();
100 <                                        break;
101 <                                case '4':
102 <                                        err = globalizeData();
103 <                                        break;
104 <                                case '5':
105 <                                        err = printInstallerInfo();
106 <                                        break;
107 <                                case '6':
108 <                                        exit = true;
109 <                                        break;
110 <                                default:
111 <                                        cout << "Please choose one of the above numbers, and press Enter.\n\n";
112 <                        }
113 <                        if (err) // if something fatal happened
114 <                                exit = true;
115 <                }
116 <                else {
117 <                        cout << "\n1. Globalize data\n";
118 <                        cout << "2. About AE\n";
119 <                        cout << "3. Quit\n\n";
120 <                        
121 <                        choice = cin.get();
122 <                        cin.ignore(128, '\n');
123 <                        switch(choice)
124 <                        {
125 <                                case '1':
126 <                                        err = globalizeData();
127 <                                        break;
128 <                                case '2':
129 <                                        err = printInstallerInfo();
130 <                                        break;
131 <                                case '3':
132 <                                        exit = true;
133 <                                        break;
134 <                                default:
135 <                                        cout << "Please choose one of the above numbers, and press Enter.\n\n";
136 <                        }
137 <                        if (err) // if something fatal happened
138 <                                exit = true;
139 <                }
140 <        } while(!exit);
141 <        
142 <        return err;
143 < }
57 > #include "boost/date_time/gregorian/gregorian.hpp"
58 > #include "boost/date_time/date_parsing.hpp"
59 > #include "boost/date_time/posix_time/posix_time.hpp"
60  
61   int globalizeData(void)
62   {
63 +        busy = 1;
64 +        using boost::lexical_cast;
65 +        using boost::bad_lexical_cast;
66 +        // using namespace boost::posix_time;
67 +        using namespace boost::gregorian;
68 +        using namespace boost::posix_time;
69 +        ptime start_time(second_clock::local_time());
70 +
71 +        setStatusArea("Globalizing!");
72          int err = 0;
73 <        
73 >        int parts_done = 0;
74 >        char Step_x_x[300];
75 >        //char levels[i][5];
76 >        remove("Globalize.log");
77 >        ofstream logfile("Globalize.log");
78 >        logfile << "Globalization started " << to_simple_string(start_time) << endl;
79          try {
80 <                int levels[15] = {0, 1, 2, 3, 4, 6, 8, 9, 10, 11, 12, 13, 14, 18, 19}; // the levels Oni has
80 >
81 >                char levels_cstr[15][3] = {"0", "1", "2", "3", "4", "6", "8", "9", "10", "11", "12", "13", "14", "18", "19"}; // the levels Oni has...probably should have made a string array. Oops.
82 >                //const vector<double> ck(cv, &cv[CvSize]);
83 >                vector<string> levels;
84 >                for (int f = 0; f < 15; f++) {
85 >                        levels.push_back(levels_cstr[f]);
86 >                }
87                  char choice = 0;
88 <                
88 >
89                  //SetCurrentDirectory("C:/Program Files/Oni/edition/install");
90 <                char levelnum[3];
90 >                ///char levels[i][3];
91                  path Characters = "../GameDataFolder/level0_Characters";
92                  path Particles = "../GameDataFolder/level0_Particles";
93                  path Archive = "../GameDataFolder/Archive";
# Line 160 | Line 96 | int globalizeData(void)
96                  path Animations = "../GameDataFolder/level0_Animations";
97                  path TRAC = Animations / "level0_TRAC";
98                  path TRAM = Animations / "level0_TRAM";
99 +
100 +                vector<path> GDFPaths;
101 +                GDFPaths.push_back(Characters);
102 +                GDFPaths.push_back(Particles);
103 +                GDFPaths.push_back(Textures);
104 +                GDFPaths.push_back(Sounds);
105 +                GDFPaths.push_back(TRAC);
106 +                GDFPaths.push_back(TRAM);
107 +
108 +
109 +                path VanillaCharacters = "packages/VanillaDats/level0_Final/level0_Characters/level0_Characters.oni";
110 +                path VanillaParticles = "packages/VanillaDats/level0_Final/level0_Particles/level0_Particles.oni";
111 +                path VanillaTextures  = "packages/VanillaDats/level0_Final/level0_Textures/level0_Textures.oni";
112 +                path VanillaSounds = "packages/VanillaDats/level0_Final/level0_Sounds/level0_Sounds.oni";
113 +                path VanillaAnimations = "packages/VanillaDats/level0_Final/level0_Animations/level0_Animations.oni";
114 +                path VanillaTRAC = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAC.oni";
115 +                path VanillaTRAM = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAM.oni";
116 +
117 +                vector<path> VanillaPaths;
118 +
119 +                VanillaPaths.push_back(VanillaCharacters);
120 +                VanillaPaths.push_back(VanillaParticles);
121 +                VanillaPaths.push_back(VanillaTextures);
122 +                VanillaPaths.push_back(VanillaSounds);
123 +                VanillaPaths.push_back(VanillaTRAC);
124 +                VanillaPaths.push_back(VanillaTRAM);
125 +
126                  /*
127 <                 if (exists("../GameDataFolder/"))
128 <                 {
129 <                 //cout << "\nIt looks like you've already globalized Oni's data.\nDo you want to re-globalize?\n(This will erase existing mods installed to the AE's game data.)"
130 <                 //      << "\n1. Re-globalize"
131 <                 //      << "\n2. Return to main menu\n";
132 <                 //choice = cin.get();
133 <                 cin.ignore(128, '\n');
134 <                 if (choice == '1')
135 <                 remove_all("../GameDataFolder"); // remove AE GDF
136 <                 if (choice == '2')
137 <                 return 0;
138 <                 }
139 <                 */
127 >                if (exists("../GameDataFolder/"))
128 >                {
129 >                //cout << "\nIt looks like you've already globalized Oni's data.\nDo you want to re-globalize?\n(This will erase existing mods installed to the AE's game data.)"
130 >                //       << "\n1. Re-globalize"
131 >                //       << "\n2. Return to main menu\n";
132 >                //choice = cin.get();
133 >                cin.ignore(128, '\n');
134 >                if (choice == '1')
135 >                remove_all("../GameDataFolder"); // remove AE GDF
136 >                if (choice == '2')
137 >                return 0;
138 >                }
139 >                */
140 >                setStatusArea("Removing old GameDataFolder...\n");
141 >                logfile <<  "Removing old GameDataFolder...\n";
142 >                remove_all( "../GameDataFolder/" );
143 >                setStatusArea("Creating needed directories...");
144 >                logfile <<  "Creating needed directories...\n";
145                  create_directory( "../GameDataFolder/" );
146 +
147                  create_directory( "packages" );
148 <                if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats");
148 >
149 >                if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats");
150                  create_directory( "packages/VanillaDats" );
151 <                
151 >
152                  create_directory( "packages/VanillaDats/level0_Final/" );
153 +                //blah blah finish this.
154 +                //logfile <<  "packages/VanillaDats/level0_Final/ created";
155                  create_directory( Characters );
156                  create_directory( Particles );
157                  create_directory( Archive );
# Line 188 | Line 160 | int globalizeData(void)
160                  create_directory( Animations );
161                  create_directory( TRAC );
162                  create_directory( TRAM );
163 <                
163 >                int num_levels = 0;
164 >                for(int i = 1; i < 15; i++)
165 >                {
166 >                        if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) {
167 >                                num_levels++;
168 >
169 >                        }
170 >                }
171 >                logfile << "Exporting and moving...\n\n";
172 >                int total_steps =  8 + 2 * num_levels;
173                  for(int i = 0; i < 15; i++)
174                  {
175 <                        sprintf(levelnum,"%d",levels[i]); // int to char array
176 <                        exists("../../GameDataFolder/level" + (string)levelnum + "_Final");
177 <                        system((strOniSplit + " -export ../GameDataFolder/level" + (string)levelnum + "_Final ../../GameDataFolder/level" + (string)levelnum + "_Final.dat").c_str());
178 <                        
179 <                        create_directory( "packages/VanillaDats/level" + (string)levelnum + "_Final" ); //remember to cast your arrays as strings :)
180 <                        create_directory( "packages/VanillaDats/level" + (string)levelnum + "_Final/level" + (string)levelnum + "_Final" );
181 <                        
182 <                        directory_iterator end_iter;
183 <                        for ( directory_iterator dir_itr( "../GameDataFolder/level" + (string)levelnum + "_Final" ); dir_itr != end_iter; ++dir_itr )
184 <                        {
185 <                                //cout << dir_itr->path().filename();
186 <                                if ( is_regular_file( dir_itr->status() ) )
175 >
176 >                        //printf(levels[i],"%d",levels[i]); // int to char array
177 >
178 >                        if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) {
179 >                                logfile << "level" << levels[i] << "_Final\n";
180 >                                logfile << "\tExporting level" << levels[i] << "_Final.dat\n";
181 >                                //printf(Step_x_x,"Step %d/%d: exporting level%d_final.dat", parts_done + 1,, levels[i]); setStatusArea((string)Step_x_x);
182 >                                setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " exporting level" + levels[i]+"_Final.dat");
183 >                                create_directory( "../GameDataFolder/level" + levels[i] + "_Final" );
184 >                                //                              setStatusArea(strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat");
185 >                                system((strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat").c_str());
186 >                                create_directory( "packages/VanillaDats/level" + levels[i] + "_Final" );
187 >                                create_directory( "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final" );
188 >
189 >                                directory_iterator end_iter;
190 >                                for ( directory_iterator dir_itr( "../GameDataFolder/level" + levels[i] + "_Final" ); dir_itr != end_iter; ++dir_itr )
191                                  {
192 <                                        
193 <                                        if ( dir_itr->path().filename().substr(0,8) == "TXMPfail" ||
209 <                                                dir_itr->path().filename().substr(0,9) == "TXMPlevel" ||
210 <                                                ( dir_itr->path().filename().substr(0,4) == "TXMP" && dir_itr->path().filename().find("intro")!=string::npos) ||
211 <                                                dir_itr->path().filename().substr(0,4) == "TXMB" ||
212 <                                                dir_itr->path().filename() == "M3GMpowerup_lsi.oni" ||
213 <                                                dir_itr->path().filename() == "TXMPlsi_icon.oni" ||
214 <                                                ( dir_itr->path().filename().substr(0,4) == "TXMB" && dir_itr->path().filename().find("splash_screen.oni")!=string::npos)       )
192 >                                        //cout << dir_itr->path().filename();
193 >                                        if ( is_regular_file( dir_itr->status() ) )
194                                          {
195 <                                                cout <<dir_itr->path().filename() << "\n";
196 <                                                create_directory( dir_itr->path().parent_path() / "NoGlobal");  
197 <                                                if(!exists( dir_itr->path().parent_path() / "NoGlobal" / dir_itr->filename())) rename(dir_itr->path(), dir_itr->path().parent_path() / "NoGlobal" /
198 <                                                                                                                                                                                                                          dir_itr->filename());
199 <                                                else remove(dir_itr->path());
200 <                                        }
201 <                                        else if (dir_itr->path().filename().substr(0,4) == "TRAC") {
202 <                                                cout <<dir_itr->path().filename() << "\n";
203 <                                                if(!exists( TRAC / dir_itr->filename())) rename(dir_itr->path(), TRAC / dir_itr->filename());
204 <                                                else remove(dir_itr->path());
205 <                                        }
206 <                                        else if (dir_itr->path().filename().substr(0,4) == "TRAM") {
207 <                                                cout <<dir_itr->path().filename() << "\n";
208 <                                                if(!exists( TRAM / dir_itr->filename())) rename(dir_itr->path(), TRAM / dir_itr->filename());
209 <                                                else remove(dir_itr->path());
210 <                                        }
211 <                                        else if (dir_itr->path().filename().substr(0,4) == "ONSK" ||
212 <                                                         dir_itr->path().filename().substr(0,4) == "TXMP") {
213 <                                                cout <<dir_itr->path().filename() << "\n";\
214 <                                                create_directory( dir_itr->path().parent_path() / "TexFix");    
215 <                                                if(!exists( Textures / dir_itr->filename())) rename(dir_itr->path(), Textures / dir_itr->filename());
216 <                                                //rename(dir_itr->path(), dir_itr->path().parent_path() / "TexFix" / dir_itr->filename());
217 <                                        }
218 <                                        else if (dir_itr->path().filename().substr(0,4) == "ONCC"
219 <                                                         || dir_itr->path().filename().substr(0,4) == "TRBS"
220 <                                                         || dir_itr->path().filename().substr(0,4) == "TRMA"
221 <                                                         || dir_itr->path().filename().substr(0,4) == "TRSC"
222 <                                                         || dir_itr->path().filename().substr(0,4) == "TRAS") {
223 <                                                cout <<dir_itr->path().filename() << "\n";
224 <                                                if(!exists( Characters / dir_itr->filename())) rename(dir_itr->path(), Characters / dir_itr->filename());
225 <                                                else remove(dir_itr->path());
226 <                                        }
227 <                                        else if (dir_itr->path().filename().substr(0,4) == "OSBD"
228 <                                                         || dir_itr->path().filename().substr(0,4) == "SNDD") {
229 <                                                cout << dir_itr->path().filename() << "\n";
230 <                                                if(!exists( Sounds / dir_itr->filename())) rename(dir_itr->path(), Sounds / dir_itr->filename());
231 <                                                else remove(dir_itr->path());
232 <                                        }
233 <                                        else if (dir_itr->path().filename().substr(0,5) == "BINA3"
234 <                                                         || dir_itr->path().filename().substr(0,10) == "M3GMdebris"
235 <                                                         || dir_itr->path().filename() == "M3GMtoxic_bubble.oni"
236 <                                                         || dir_itr->path().filename().substr(0,8) == "M3GMelec"
237 <                                                         || dir_itr->path().filename().substr(0,7) == "M3GMrat"
238 <                                                         || dir_itr->path().filename().substr(0,7) == "M3GMjet"
239 <                                                         || dir_itr->path().filename().substr(0,9) == "M3GMbomb_"
240 <                                                         || dir_itr->path().filename() == "M3GMbarab_swave.oni"
241 <                                                         || dir_itr->path().filename() == "M3GMbloodyfoot.oni"
242 <                                                         ){
243 <                                                cout <<dir_itr->path().filename() << "\n";
244 <                                                if(!exists( Particles / dir_itr->filename())) rename(dir_itr->path(), Particles / dir_itr->filename());
245 <                                                else remove(dir_itr->path());
246 <                                        }
247 <                                        else if (dir_itr->path().filename().substr(0,4) == "AGDB"
248 <                                                         || dir_itr->path().filename().substr(0,4) == "TRCM") {
249 <                                                cout <<dir_itr->path().filename() << "\n";
250 <                                                
251 <                                                if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename());
252 <                                                else remove(dir_itr->path());
195 >                                                if ( dir_itr->path().filename().substr(0,8) == "TXMPfail" ||
196 >                                                        dir_itr->path().filename().substr(0,9) == "TXMPlevel" ||
197 >                                                        ( dir_itr->path().filename().substr(0,4) == "TXMP" && dir_itr->path().filename().find("intro")!=string::npos) ||
198 >                                                        dir_itr->path().filename().substr(0,4) == "TXMB" ||
199 >                                                        dir_itr->path().filename() == "M3GMpowerup_lsi.oni" ||
200 >                                                        dir_itr->path().filename() == "TXMPlsi_icon.oni" ||
201 >                                                        ( dir_itr->path().filename().substr(0,4) == "TXMB" && dir_itr->path().filename().find("splash_screen.oni")!=string::npos)       )
202 >                                                {
203 >                                                        cout <<dir_itr->path().filename() << "\n";
204 >                                                        create_directory( dir_itr->path().parent_path() / "NoGlobal");  
205 >                                                        if(!exists( dir_itr->path().parent_path() / "NoGlobal" / dir_itr->filename())) rename(dir_itr->path(), dir_itr->path().parent_path() / "NoGlobal" /
206 >                                                                dir_itr->filename());
207 >                                                        else remove(dir_itr->path());
208 >                                                }
209 >                                                else if (dir_itr->path().filename().substr(0,4) == "TRAC"
210 >                                                        || dir_itr->path().filename().substr(0,4) == "ONVL") {
211 >                                                                cout <<dir_itr->path().filename() << "\n";
212 >                                                                if(!exists( TRAC / dir_itr->filename())) rename(dir_itr->path(), TRAC / dir_itr->filename());
213 >                                                                else remove(dir_itr->path());
214 >                                                }
215 >                                                else if (dir_itr->path().filename().substr(0,4) == "TRAM") {
216 >                                                        cout <<dir_itr->path().filename() << "\n";
217 >                                                        if(!exists( TRAM / dir_itr->filename())) rename(dir_itr->path(), TRAM / dir_itr->filename());
218 >                                                        else remove(dir_itr->path());
219 >                                                }
220 >                                                else if (dir_itr->path().filename().substr(0,4) == "ONSK" ||
221 >                                                        dir_itr->path().filename().substr(0,4) == "TXMP") {
222 >                                                                cout <<dir_itr->path().filename() << "\n";\
223 >                                                                        create_directory( dir_itr->path().parent_path() / "TexFix");    
224 >                                                                if(!exists( Textures / dir_itr->filename())) rename(dir_itr->path(), Textures / dir_itr->filename());
225 >                                                                //rename(dir_itr->path(), dir_itr->path().parent_path() / "TexFix" / dir_itr->filename());
226 >                                                }
227 >                                                else if (dir_itr->path().filename().substr(0,4) == "ONCC"
228 >                                                        || dir_itr->path().filename().substr(0,4) == "TRBS"
229 >                                                        || dir_itr->path().filename().substr(0,4) == "ONCV"
230 >                                                        || dir_itr->path().filename().substr(0,4) == "TRMA"
231 >                                                        || dir_itr->path().filename().substr(0,4) == "TRSC"
232 >                                                        || dir_itr->path().filename().substr(0,4) == "TRAS") {
233 >                                                                cout <<dir_itr->path().filename() << "\n";
234 >                                                                if(!exists( Characters / dir_itr->filename())) rename(dir_itr->path(), Characters / dir_itr->filename());
235 >                                                                else remove(dir_itr->path());
236 >                                                }
237 >                                                else if (dir_itr->path().filename().substr(0,4) == "OSBD"
238 >                                                        || dir_itr->path().filename().substr(0,4) == "SNDD") {
239 >                                                                cout << dir_itr->path().filename() << "\n";
240 >                                                                if(!exists( Sounds / dir_itr->filename())) rename(dir_itr->path(), Sounds / dir_itr->filename());
241 >                                                                else remove(dir_itr->path());
242 >                                                }
243 >                                                else if (dir_itr->path().filename().substr(0,5) == "BINA3"
244 >                                                        || dir_itr->path().filename().substr(0,10) == "M3GMdebris"
245 >                                                        || dir_itr->path().filename() == "M3GMtoxic_bubble.oni"
246 >                                                        || dir_itr->path().filename().substr(0,8) == "M3GMelec"
247 >                                                        || dir_itr->path().filename().substr(0,7) == "M3GMrat"
248 >                                                        || dir_itr->path().filename().substr(0,7) == "M3GMjet"
249 >                                                        || dir_itr->path().filename().substr(0,9) == "M3GMbomb_"
250 >                                                        || dir_itr->path().filename() == "M3GMbarab_swave.oni"
251 >                                                        || dir_itr->path().filename() == "M3GMbloodyfoot.oni"
252 >                                                        ){
253 >                                                                cout <<dir_itr->path().filename() << "\n";
254 >                                                                if(!exists( Particles / dir_itr->filename())) rename(dir_itr->path(), Particles / dir_itr->filename());
255 >                                                                else remove(dir_itr->path());
256 >                                                }
257 >                                                else if (dir_itr->path().filename().substr(0,4) == "AGDB"
258 >                                                        || dir_itr->path().filename().substr(0,4) == "TRCM") {
259 >                                                                cout <<dir_itr->path().filename() << "\n";
260 >
261 >                                                                if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename());
262 >                                                                else remove(dir_itr->path());
263 >                                                }
264 >                                                if (exists(dir_itr->path())) {
265 >
266 >                                                }
267 >                                                else {
268 >                                                        logfile << "\tMoved file: " << dir_itr->path().filename() << "\n";
269 >                                                }
270                                          }
271 +
272 +
273 +
274                                  }
275 <                                
276 <                                
275 >                                logfile << "\tCleaning up TXMPs...\n";
276 >                                system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + levels[i] + "_Final/TXMP*.oni").c_str());
277 >                                parts_done++;
278 >
279 >                                setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) ));
280 >
281                          }
279                        system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + (string)levelnum + "_Final/TXMP*.oni").c_str());
280                        
282                  }
283 <                
283 >                logfile << "Reimporting levels\n";
284                  for (int i = 0; i < 15; i++)
285                  {
286 <                        sprintf(levelnum,"%d",levels[i]);
287 <                        system( (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levelnum + "_Final packages/VanillaDats/level" + levelnum + "_Final/level"
288 <                                         + levelnum + "_Final/level" + levelnum + "_Final.oni").c_str());
286 >                        logfile << "\tReimporting level" << levels[i] << "_Final.oni\n";
287 >                        //printf(levels[i],"%d",levels[i]);
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());
292 >                        setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) ));
293 >                        parts_done++;
294                  }
289                path VanillaCharacters = "packages/VanillaDats/level0_Final/level0_Characters/level0_Characters.oni";
290                path VanillaParticles = "packages/VanillaDats/level0_Final/level0_Particles/level0_Particles.oni";
291                path VanillaTextures  = "packages/VanillaDats/level0_Final/level0_Textures/level0_Textures.oni";
292                path VanillaSounds = "packages/VanillaDats/level0_Final/level0_Sounds/level0_Sounds.oni";
293                path VanillaAnimations = "packages/VanillaDats/level0_Final/level0_Animations/level0_Animations.oni";
294                path VanillaTRAC = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAC.oni";
295                path VanillaTRAM = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAM.oni";
295                  create_directory( VanillaCharacters.parent_path() );
296                  create_directory( VanillaParticles.parent_path() );
297                  create_directory( VanillaTextures.parent_path() );
298                  create_directory( VanillaSounds.parent_path() );
299                  create_directory( VanillaAnimations.remove_filename() );
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() );
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) ));
307 +                }
308 +                /*
309 +                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) ));
310                  system((strOniSplit + " " + strImportOption + " " + Characters.string() + " " + VanillaCharacters.string()).c_str());
311 +                parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_Particles", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) ));
312                  system((strOniSplit + " " + strImportOption + " " + Particles.string() + " " + VanillaParticles.string()).c_str());
313 +                parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_Textures", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) ));
314                  system((strOniSplit + " " + strImportOption + " " + Textures.string() + " " + VanillaTextures.string()).c_str());
315                  //system((strOniSplit   + " " + strImportOption + (string)" " + Animations.string() + (string)" " + VanillaAnimations.string()).c_str());
316 +                parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_TRAC", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) ));
317                  system((strOniSplit + " " + strImportOption + " " + TRAC.string() + " " + VanillaTRAC.string()).c_str());
318 +                parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_Sounds", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) ));
319                  system((strOniSplit + " " + strImportOption + " " + Sounds.string() + " " + VanillaSounds.string()).c_str());
320 <                system((strOniSplit + " " + strImportOption + " " + TRAM.string() + " " + VanillaTRAM.string()).c_str());
321 <                
322 <                create_directory("../GameDataFolder/IGMD");
320 >                parts_done++; printf(Step_x_x,"Step %d/%d: reimporting level0_TRAM", parts_done,7 + 2 * num_levels); setStatusArea((string)Step_x_x);setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) ));
321 >                system((strOniSplit + " " + strImportOption + " " + TRAM.string() + " " + VanillaTRAM.string()).c_str());
322 >                //parts_done++; setStatusArea((string)"Copying level scripts...");setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) ));
323 >                if (exists("../GameDataFolder/IGMD")) remove_all("../GameDataFolder/IGMD");
324 >                */
325 >                create_directory((path)"../GameDataFolder/IGMD");
326                  copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder");
327 <        }
328 <        catch (exception ex) {
329 <                cout << ex.what();
314 <        }
315 <        return err;
316 < }
327 >                setProgressBar( 1000 );
328 >                setStatusArea((string)"Done! Now select your mod packages and click install.");
329 >                //      while(1) Sleep(-1);
330  
318 int installPackages(void)
319 {
320        bool installed_something = 0;
321        int err = 0;
322        ModPackage package;
323        vector<string> installed_packages;
324        vector<ModPackage> packages;
325        vector<ModPackage>::iterator iter;
326        vector<string> installString;
327        
328        iter = packages.begin();
329        packages = getPackages();
330        vector<string> installedMods = getInstallString();
331        
332        if (packages.empty())
333        {
334                cout << "Error: You have no packages!\n";
335                return 0;
331          }
332 <        
333 <        cout << "Detecting installed packages...\n";
339 <        
340 <        int index = 1;
341 <        char choice = '0';
342 <        
343 <        for (vector<ModPackage>::iterator package_iter = packages.begin(); package_iter != packages.end(); ++package_iter)
344 <        {
345 <                if (!binary_search(installedMods.begin(), installedMods.end(), package_iter->modStringName))
346 <                { //package_iter->isInstalled :< I forgot about this...
347 <                        //cout << index << " ";
348 <                        system(strClsCmd);
349 <                        cout << (*package_iter).name << "\n";
350 <                        for (int character = 1; character <= (*package_iter).name.length() - 1; character++) cout << '-';
351 <                        cout << "\n"
352 <                        << (*package_iter).readme << "\n\n"
353 <                        << "Please enter a number choice\n"
354 <                        << " 1. Add\n"
355 <                        << " 2. Don't Add\n"
356 <                        << "";
357 <                        index++;
358 <                        choice = 0;
359 <                        
360 <                        do
361 <                        {
362 <                                choice = cin.get();
363 <                                cin.ignore(1280, '\n');
364 <                        } while(choice == 0);
365 <                        
366 <                        if (choice == '1')
367 <                        {
368 <                                cout << "\nInstalling...\n\n";
369 <                                if (package_iter->hasOnis || (package_iter->hasDeltas /*(*package_iter).isUnpacked */ ))
370 <                                {
371 <                                        installed_something = 1;
372 <                                        installedMods.push_back(package_iter->modStringName);
373 <                                        system(strPauseCmd);
374 <                                }
375 <                        }
376 <                }
377 <        }
378 <        if (index == 1)
379 <        {
380 <                cout << "Warning: All packages are already installed\n";
381 <                //would you like to recombine your data?
382 <                return 0;
383 <        }
384 <        if (installed_something == 0)
385 <        {
386 <                cout << "Warning: You didn't add anything!\n";
387 <                //would you like to recombine your data?
388 <                return 0;
332 >        catch (exception ex) {
333 >                setStatusArea("Warning, handled exception: " + (string)ex.what());
334          }
390        
391        sort(installedMods.begin(), installedMods.end());
392        //system(Onisplit.c_str());
393        recompileAll(installedMods);
394        system(strPauseCmd);
395        
396        return err;
397 }
335  
336 < int uninstallPackages(void)
337 < {
338 <        int err = 0;
339 <        ModPackage package;
340 <        vector<string> installed_packages;
341 <        vector<ModPackage> packages;
405 <        vector<ModPackage>::iterator iter;
406 <        vector<string> installString;
407 <        
408 <        iter = packages.begin();
409 <        packages = getPackages();
410 <        
411 <        
412 <        cout << "Detecting installed packages...\n";
413 <        
414 <        vector<string> installedMods = getInstallString();
415 <        
416 <        if (packages.empty())
417 <        {
418 <                cout << "Error: You have no packages!\n";
419 <                return 0;
420 <        }
421 <        
422 <        int index = 0;
423 <        int uninstalled_something = 0;
424 <        char choice = '0';
425 <        
426 <        for (vector<ModPackage>::iterator package_iter = packages.begin(); package_iter != packages.end(); ++package_iter)
427 <        {
428 <                if (binary_search(installedMods.begin(), installedMods.end(), package_iter->modStringName))
429 <                { //package_iter->isInstalled :< I forgot about this...
430 <                        //cout << index << " ";
431 <                        system(strClsCmd);
432 <                        cout << (*package_iter).name << "\n";
433 <                        for (int character = 1; character <= (*package_iter).name.length() - 1; character++) cout << '-';
434 <                        cout << "\n"
435 <                        << (*package_iter).readme << "\n\n"
436 <                        << "Please enter a number choice\n"
437 <                        << " 1. Remove\n"
438 <                        << " 2. Don't Remove\n"
439 <                        << "";
440 <                        
441 <                        choice = 0;
442 <                        
443 <                        do
444 <                        {
445 <                                choice = cin.get();
446 <                                cin.ignore(1280, '\n');
447 <                        } while(choice == 0);
448 <                        
449 <                        if (choice == '1')
450 <                        {
451 <                                cout << "\nUninstalling...\n\n";
452 <                                installedMods.erase( installedMods.begin() + (index) );
453 <                                system(strPauseCmd);
454 <                                uninstalled_something = 1;
455 <                                
456 <                        }
457 <                        else {
458 <                                index++;
459 <                        }
460 <                }
461 <        }
462 <        if ( uninstalled_something == 0 )
463 <        {
464 <                if (index == 0) //bad practice, I need to implement a second vector or something. Meh.
465 <                {
466 <                        cout << "\nWarning: You have no installed packages!";
467 <                }
468 <                else
469 <                {
470 <                        cout << "\nWarning: You didn't remove anything!";
471 <                }
472 <                //would you like to recombine your data?
473 <                return 0;
474 <                
475 <        }      
476 <        sort(installedMods.begin(), installedMods.end());
477 <        //system(Onisplit.c_str());
478 <        recompileAll(installedMods);
479 <        system(strPauseCmd);
480 <        
336 >        ptime end_time(second_clock::local_time());
337 >        time_period total_time (start_time, end_time);
338 >        logfile << "\n\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length();
339 >        //total_time.length().hours();
340 >        logfile.close();
341 >        busy = 0;
342          return err;
343   }
344  
484 int listInstalledPackages(void)
485 {
486        cout << "\nThis feature not yet implemented.\n\n";
487        
488        return 0;
489 }
490
491 int printInstallerInfo(void)
492 {
493        cout << "\nAE/Mod Installer\n";
494        cout << "version " << strInstallerVersion << "\n";
495        cout << "by Gumby & Iritscen\n";
496        cout << "see http://oni.bungie.org/community/forums for more info\n\n";
497        
498        return 0;
499 }
345  
346   vector<ModPackage> getPackages(void)
347   {
# Line 505 | Line 350 | vector<ModPackage> getPackages(void)
350          fstream file;
351          string filename = "\0";
352          string MODINFO_CFG = "Mod_Info.cfg";
353 <        
353 >
354          try
355          {
356                  directory_iterator end_iter;
# Line 513 | Line 358 | vector<ModPackage> getPackages(void)
358                  {
359                          file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str());
360                          //cout << filename << "\n";
361 <                        
361 >
362                          if(!file.fail())
363                          {
364                                  //cout << dir_itr->path().string() + MODINFO_CFG;
# Line 523 | Line 368 | vector<ModPackage> getPackages(void)
368                          file.close();
369                          file.clear();
370                  }
371 +                sort(packages.begin(), packages.end());
372          }
373          catch (const std::exception & ex)
374          {
375                  cout << "Warning, something odd happened!\n";
376          }
377 <        
377 >
378          return packages;
379   }
380  
381   ModPackage fileToModPackage(fstream &file)
382   {
383          /*
384 <         This converts a file to a ModPackage struct.
385 <        
386 <         A few notes...
387 <         "iter" is the current word we are on. I should have named it "token" or something, but I don't have multiple iterators, so its ok.
388 <         I refer to (*iter) at the beginning of each if statement block. I could probably store it as a variable, but I'm pretty sure that dereferencing a pointer\iterator isn't much
389 <         slower than reading a variable.
390 <         */
384 >        This converts a file to a ModPackage struct.
385 >
386 >        A few notes...
387 >        "iter" is the current word we are on. I should have named it "token" or something, but I don't have multiple iterators, so its ok.
388 >        I refer to (*iter) at the beginning of each if statement block. I could probably store it as a variable, but I'm pretty sure that dereferencing a pointer\iterator isn't much
389 >        slower than reading a variable.
390 >        */
391          ModPackage package;
392          string line;
393          static string NameOfMod = "NameOfMod";  //used for comparing to the current token...
# Line 566 | Line 412 | ModPackage fileToModPackage(fstream &fil
412                  if (tokens.capacity() >= 2) {                   //make sure they are using enough stuff
413                          iter = tokens.begin();                          //what word we are on, starts at first word
414                          /*
415 <                         if (!AEInstallVersion.compare(*iter))
416 <                         If mod is too old, skip this mod.
417 <                         */
415 >                        if (!AEInstallVersion.compare(*iter))
416 >                        If mod is too old, skip this mod.
417 >                        */
418                          /*else*/if (!NameOfMod.compare(*iter))  {       //if it contains the name
419                                  for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment
420                                          if (ARROW.compare(*iter) && NameOfMod.compare(*iter)) {                 //ignores "->" and "NameOfMod"
# Line 577 | Line 423 | ModPackage fileToModPackage(fstream &fil
423                                                  package.name += *iter + " ";
424                                          }
425                                  }
426 <                                
426 >
427                          }
428                          else if (!ModString.compare(*iter)) {
429                                  iter++; iter++;
# Line 589 | Line 435 | ModPackage fileToModPackage(fstream &fil
435                                  iter++; iter++;  
436                                  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
437                                  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,
438 <                                iter++; iter++;}  // using "YFR" would probably set it off. :<
439 <                                
438 >                                        iter++; iter++;}  // using "YFR" would probably set it off. :<
439 >
440                                  if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasBSL = 1;
441                          }
442                          else if (!HasDeltas.compare(*iter)) {
# Line 637 | Line 483 | ModPackage fileToModPackage(fstream &fil
483                                  }
484                          }
485                  }
486 <                
486 >
487          }
488          package.doOutput();
489          return package;
# Line 645 | Line 491 | ModPackage fileToModPackage(fstream &fil
491  
492   void recompileAll(vector<string> installedMods)
493   {
494 < #ifdef WIN32
495 <        RedirectIOToConsole();
496 <        HWND hWnd = GetConsoleWindow();
497 <        ShowWindow( hWnd, SW_HIDE );
498 < #endif
494 >        busy = 1;
495 >        using namespace boost::gregorian;
496 >        using namespace boost::posix_time;
497 >        using boost::lexical_cast;
498 >        using boost::bad_lexical_cast;
499 >        
500          setStatusArea("Importing levels...");
501          //setStatusArea("Recompiling Data...");
502          path vanilla_dir = "./packages/VanillaDats/";
# Line 659 | Line 506 | void recompileAll(vector<string> install
506          int j = 1;
507          string datString;
508          std::stringstream out;
509 <        
510 <        
509 >
510 >        ptime start_time(second_clock::local_time());
511          clearOldDats();
512 <        remove("Onisplit.log");
512 >        remove("Install.log");
513 >        ofstream logfile("Install.log");
514 >        logfile << "Mod Installation started " << to_simple_string(start_time) << endl;
515 >        logfile.close();
516          if(splitInstances == SPLIT){
517                  recursive_directory_iterator end_iter;
518 <                
518 >
519                  for ( recursive_directory_iterator dir_itr( vanilla_dir );
520 <                         dir_itr != end_iter;
521 <                         ++dir_itr )
520 >                        dir_itr != end_iter;
521 >                        ++dir_itr )
522                  {
523                          try{
524                                  if ( is_directory( dir_itr->status() ) &&  dir_itr.level() == 1)
# Line 677 | Line 527 | void recompileAll(vector<string> install
527                                  }
528                          }
529                          catch(exception ex) {
530 <                                
530 >
531                          }
532                  }
533 <                
533 >
534                  //recursive_directory_iterator end_iter;
535 <                
536 <                
535 >
536 >
537                  out << numberOfDats;
538                  datString = out.str();
539                  try {
540                          for ( recursive_directory_iterator dir_itr( vanilla_dir );
541 <                                 dir_itr != end_iter;
542 <                                 ++dir_itr )
541 >                                dir_itr != end_iter;
542 >                                ++dir_itr )
543                          {
544                                  try
545                                  {
# Line 699 | Line 549 | void recompileAll(vector<string> install
549                                                  for (int i = 0; i < installedMods.size(); ++i) {
550                                                          if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename()  ))
551                                                                  importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename();
552 <                                                        
552 >
553                                                          //else cout << " packages/VanillaDats/" + installedMods[i] + "/oni/";
554                                                  }
555 <                                                importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Onisplit.log";
555 >                                                importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log";
556 >
557                                                  
707                                                sprintf(statusString,"%d/%i\0",j,numberOfDats);
558                                                  setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats
559 <                                                setStatusArea("Importing " +  dir_itr->path().filename() + " " + statusString);
560 <                                                
559 >                                                setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " +  dir_itr->path().filename() + " ");
560 >
561                                                  system(importCommand.c_str());
562                                                  //Sleep(1000);
563                                                  //cout << importCommand << "\n";
564                                                  j++;
565 <                                                
565 >
566                                          }
567                                  }
568                                  catch ( const std::exception & ex )
569                                  {
570 <                                        cout << "Warning, exception " << ex.what() << "!";
570 >
571 >                                        remove("Install.log");
572 >                                        ofstream logfile("Install.log");
573 >
574 >
575 >                                        logfile << "Warning, exception " << ex.what() << "!";
576 >                                        setStatusArea("Warning, exception " + (string)ex.what() + "!");
577 >                                        logfile.close();        
578                                  }
579                          }
580 <                        
580 >
581                  }
582                  catch( const std::exception & ex ) {
583 <                        cout << "Warning, exception " << ex.what() << "!\n"
584 <                        << "You probably need to re-globalize.";
585 <                        //create_directory( "./packages/VanillaDats" );
583 >
584 >                        remove("Install.log");
585 >                        ofstream logfile("Install.log");
586 >
587 >
588 >                        logfile << "Warning, exception " << ex.what() << "!";
589 >                        setStatusArea("Warning, exception " + (string)ex.what() + "!");
590 >                        logfile.close();
591                  }
592 <                
592 >
593          }
594          else if(splitInstances == NOT_SPLIT){
595                  directory_iterator end_iter;
596 <                
596 >
597                  for ( directory_iterator dir_itr( vanilla_dir );
598 <                         dir_itr != end_iter;
599 <                         ++dir_itr )
598 >                        dir_itr != end_iter;
599 >                        ++dir_itr )
600                  {
601 <                        
601 >
602                          if ( is_directory( dir_itr->status() ) )
603                          {
604                                  numberOfDats++;
605                          }
606 <                        
607 <                        
606 >
607 >
608                  }
609 <                
609 >
610                  out << numberOfDats;
611                  datString = out.str();
612 <                
612 >
613                  for ( directory_iterator dir_itr( vanilla_dir );
614 <                         dir_itr != end_iter;
615 <                         ++dir_itr )
614 >                        dir_itr != end_iter;
615 >                        ++dir_itr )
616                  {
617                          try
618                          {
619                                  if ( is_directory( dir_itr->status() ) )
620                                  {
621                                          importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " " + "../GameDataFolder/" + dir_itr->path().filename()
622 <                                        + ".dat";
622 >                                                + ".dat";
623                                          for (int i = 0; i < installedMods.size(); ++i) {
624                                                  if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename()  ))
625                                                          importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename();
626                                          }
627 <                                        importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat";
628 <                                        
629 <                                        sprintf(statusString,"%d/%i\0",j,numberOfDats);
627 >                                        importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log";
628 >
629 >
630                                          setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats
631 <                                        setStatusArea("Importing " +  dir_itr->path().filename() + " " + statusString);
632 <                                        
631 >                                        setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " +  dir_itr->path().filename() + " ");
632 >
633                                          system(importCommand.c_str());
634 <                                        
634 >
635                                          j++;
636                                  }
637                          }
638                          catch ( const std::exception & ex )
639                          {
640 <                                cout << "Warning, something odd happened!\n";
641 <                        }
642 <                }
640 >
641 >                                remove("Install.log");
642 >                                ofstream logfile("Install.log");
643 >
644 >
645 >                                logfile << "Warning, exception " << ex.what() << "!";
646 >                                setStatusArea("Warning, exception " + (string)ex.what() + "!");
647 >                                logfile.close();
648 >                        }}
649          }
650 +        logfile << "Writing config file";
651          writeInstalledMods(installedMods);
652          setProgressBar(1000);
653 <        setStatusArea("Done!");
653 >        setStatusArea("Done! You can now play Oni.");
654 >
655 >        ptime end_time(second_clock::local_time());
656 >        time_period total_time (start_time, end_time);
657 >
658 >
659 >        ofstream logfile2("Install.log", ios::app | ios::ate);
660 >        string outstring = (string)"\n\nGlobalization ended " + to_simple_string(end_time) + "\nThe process took ";// + (string)total_time.length();
661 >
662 >        logfile2 << "\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length();
663 >
664 >        //logfile2.write(outstring.c_str(), outstring.length());
665 >        logfile2.close();
666 >
667 >        //total_time.length().hours();
668 >
669          Sleep(1000);
670          setProgressBar(0);
671 +        busy = 0;
672   }
673  
674   void writeInstalledMods(vector<string> installedMods)
675   {
676 <        
676 >
677          if ( exists( strInstallCfg ) )
678          {
679                  remove( strInstallCfg );
680          }
681 <        
681 >
682          ofstream file(strInstallCfg.c_str());
683 <        
683 >
684          vector<string>list = installedMods;
685          vector<string>::iterator begin_iter = list.begin();
686          vector<string>::iterator end_iter = list.end();
687 <        
687 >
688          sort( list.begin(), list.end() );
689 <        
689 >
690          for( ; begin_iter != end_iter; ++begin_iter) {
691                  file << *begin_iter << " ";
692          }
693 <        
693 >
694          file.close();
695          file.clear();
696 <        
696 >
697   }
698  
699   vector<string> getInstallString(string Cfg)
700   {
701          //system(strPauseCmd);
702          vector<string> returnval;
703 <        
703 >
704          string line;
705          fstream file;
706 <        
706 >
707          if (exists( Cfg ))
708          {
709                  file.open(Cfg.c_str());
# Line 829 | Line 714 | vector<string> getInstallString(string C
714                  sort(returnval.begin(), returnval.end());
715          }
716          else cout << "fail";
717 <        
717 >
718          return returnval;
719   }
720  
# Line 840 | Line 725 | void tokenize(const string& str, vector<
725          string::size_type lastPos = str.find_first_not_of(delimiters, 0);
726          // Find first "non-delimiter".
727          string::size_type pos     = str.find_first_of(delimiters, lastPos);
728 <        
728 >
729          while (string::npos != pos || string::npos != lastPos)
730          {
731                  // Found a token, add it to the vector.
# Line 855 | Line 740 | void tokenize(const string& str, vector<
740   void clearOldDats(void) {
741          directory_iterator end_iter_gdf;
742          for ( directory_iterator dir_itr_gdf( "../GameDataFolder" );
743 <                 dir_itr_gdf != end_iter_gdf;
744 <                 ++dir_itr_gdf )
743 >                dir_itr_gdf != end_iter_gdf;
744 >                ++dir_itr_gdf )
745          {
746                  //cout << dir_itr_gdf->path().extension() << "\n";
747                  if ( dir_itr_gdf->path().extension() == ".dat" || dir_itr_gdf->path().extension() == ".raw" || dir_itr_gdf->path().extension() == ".sep" ) {
748                          remove( dir_itr_gdf->path() );
749                  }
750 <                
750 >
751          }
752 <        
752 >
753   }
754  
755   vector<string> globalInstalledMods;
# Line 911 | Line 796 | vector<ModPackage> globalPackages;
796   //#define wxUSE_UNICODE 1;
797  
798   /*
799 < * MainWindow type definition
800 < */
799 > * MainWindow type definition
800 > */
801  
802   IMPLEMENT_CLASS( MainWindow, wxFrame )
803  
804  
805   /*
806 < * MainWindow event table definition
807 < */
806 > * MainWindow event table definition
807 > */
808  
809   BEGIN_EVENT_TABLE( MainWindow, wxFrame )
810  
811   ////@begin MainWindow event table entries
812 <    EVT_CHECKBOX( SelectAll_Checkbox, MainWindow::OnSelectAllCheckboxClick )
812 > EVT_CHECKBOX( SelectAll_Checkbox, MainWindow::OnSelectAllCheckboxClick )
813  
814 <    EVT_BUTTON( Refresh_Button, MainWindow::OnRefreshButtonClick )
814 > EVT_BUTTON( Refresh_Button, MainWindow::OnRefreshButtonClick )
815  
816 <    EVT_LISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Selected )
817 <    EVT_CHECKLISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Toggled )
816 > EVT_LISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Selected )
817 > EVT_CHECKLISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Toggled )
818  
819 <    EVT_UPDATE_UI( ID_STATUSBAR, MainWindow::OnStatusbarUpdate )
819 > EVT_UPDATE_UI( ID_STATUSBAR, MainWindow::OnStatusbarUpdate )
820  
821 <    EVT_BUTTON( Install_Button, MainWindow::OnInstallButtonClick )
821 > EVT_BUTTON( Install_Button, MainWindow::OnInstallButtonClick )
822  
823 <    EVT_RADIOBUTTON( Sep_RadioButton, MainWindow::OnSepRadioButtonSelected )
823 > EVT_RADIOBUTTON( Sep_RadioButton, MainWindow::OnSepRadioButtonSelected )
824  
825 <    EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected )
825 > EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected )
826  
827 <    EVT_RADIOBUTTON( Separated_RadioButton, MainWindow::OnSeparatedRadioButtonSelected )
827 > EVT_RADIOBUTTON( Separated_RadioButton, MainWindow::OnSeparatedRadioButtonSelected )
828  
829 <    EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected )
829 > EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected )
830  
831 <    EVT_BUTTON( ReGlobalize_Button, MainWindow::OnReGlobalizeButtonClick )
831 > EVT_BUTTON( ReGlobalize_Button, MainWindow::OnReGlobalizeButtonClick )
832  
833 <    EVT_MENU( wxID_LOAD, MainWindow::OnLoadClick )
833 > EVT_MENU( wxID_LOAD, MainWindow::OnLoadClick )
834  
835 <    EVT_MENU( wxID_SAVE, MainWindow::OnSaveClick )
835 > EVT_MENU( wxID_SAVE, MainWindow::OnSaveClick )
836  
837 <    EVT_MENU( wxID_EXIT, MainWindow::OnExitClick )
837 > EVT_MENU( wxID_EXIT, MainWindow::OnExitClick )
838  
839 <    EVT_MENU( wxID_OPTIONS, MainWindow::OnOptionsClick )
839 > EVT_MENU( wxID_OPTIONS, MainWindow::OnOptionsClick )
840  
841 <    EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick )
841 > EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick )
842  
843   ////@end MainWindow event table entries
844  
# Line 961 | Line 846 | END_EVENT_TABLE()
846  
847  
848   /*
849 < * MainWindow constructors
850 < */
849 > * MainWindow constructors
850 > */
851  
852   MainWindow::MainWindow()
853   {
854 <    Init();
854 >        Init();
855   }
856  
857   MainWindow::MainWindow( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
858   {
859 <    Init();
860 <    Create( parent, id, caption, pos, size, style );
859 >        Init();
860 >        Create( parent, id, caption, pos, size, style );
861   }
862  
863  
864   /*
865 < * MainWindow creator
866 < */
865 > * MainWindow creator
866 > */
867  
868   bool MainWindow::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
869   {
870 < ////@begin MainWindow creation
871 <    wxFrame::Create( parent, id, caption, pos, size, style );
870 >        ////@begin MainWindow creation
871 >        wxFrame::Create( parent, id, caption, pos, size, style );
872 >
873 >        CreateControls();
874 >        SetIcon(GetIconResource(wxT("oni_special.ico")));
875 >        Centre();
876 >
877  
878 <    CreateControls();
879 <    SetIcon(GetIconResource(wxT("oni_special.ico")));
990 <    Centre();
991 < ////@end MainWindow creation
992 <    return true;
878 >        ////@end MainWindow creation
879 >        return true;
880   }
881  
882  
883   /*
884 < * MainWindow destructor
885 < */
884 > * MainWindow destructor
885 > */
886  
887   MainWindow::~MainWindow()
888   {
889 < ////@begin MainWindow destruction
890 < ////@end MainWindow destruction
889 >        ////@begin MainWindow destruction
890 >        ////@end MainWindow destruction
891   }
892  
893  
894   /*
895 < * Member initialisation
896 < */
895 > * Member initialisation
896 > */
897  
898   void MainWindow::Init()
899   {
900 < ////@begin MainWindow member initialisation
901 <    MainSplitter = NULL;
902 <    SelectAll = NULL;
903 <    RefreshButton = NULL;
904 <    Mods_CheckboxList = NULL;
905 <    titleText = NULL;
906 <    creatorText = NULL;
907 <    descriptionText = NULL;
908 <    StatusArea = NULL;
909 <    ProgressBar = NULL;
910 <    InstallButton = NULL;
911 <    OptionsPanel = NULL;
912 <    SepRadio = NULL;
913 <    NoSepRadio = NULL;
914 <    SeparatedRadio = NULL;
915 <    CompleteRadio = NULL;
916 <    ReglobalizeButton = NULL;
917 < ////@end MainWindow member initialisation
900 >        ////@begin MainWindow member initialisation
901 >        MainSplitter = NULL;
902 >        SelectAll = NULL;
903 >        RefreshButton = NULL;
904 >        Mods_CheckboxList = NULL;
905 >        titleText = NULL;
906 >        creatorText = NULL;
907 >        descriptionText = NULL;
908 >        StatusArea = NULL;
909 >        ProgressBar = NULL;
910 >        InstallButton = NULL;
911 >        OptionsPanel = NULL;
912 >        SepRadio = NULL;
913 >        NoSepRadio = NULL;
914 >        SeparatedRadio = NULL;
915 >        CompleteRadio = NULL;
916 >        ReglobalizeButton = NULL;
917 >        ////@end MainWindow member initialisation
918  
919   }
920  
921  
922   /*
923 < * Control creation for MainWindow
924 < */
923 > * Control creation for MainWindow
924 > */
925   wxStatusBar **TheStatusBar;
926   wxButton* TheInstallButton;
927   wxGauge* TheProgressBar;
928   void MainWindow::CreateControls()
929   {    
930 < ////@begin MainWindow content construction
931 <    // Generated by DialogBlocks, 31/05/2009 19:03:55 (unregistered)
930 >        ////@begin MainWindow content construction
931 >        // Generated by DialogBlocks, 31/05/2009 19:03:55 (unregistered)
932  
933 <    MainWindow* itemFrame1 = this;
933 >        MainWindow* itemFrame1 = this;
934 >
935 >        wxMenuBar* menuBar = new wxMenuBar;
936 >        wxMenu* itemMenu37 = new wxMenu;
937 >        {
938 >                wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_LOAD, _("&Load Configuration..."), wxEmptyString, wxITEM_NORMAL);
939 >                wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("fileopen.xpm")));
940 >                menuItem->SetBitmap(bitmap);
941 >                itemMenu37->Append(menuItem);
942 >        }
943 >        {
944 >                wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_SAVE, _("&Save Configuration..."), wxEmptyString, wxITEM_NORMAL);
945 >                wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("filesaveas.xpm")));
946 >                menuItem->SetBitmap(bitmap);
947 >                itemMenu37->Append(menuItem);
948 >        }
949 >        itemMenu37->AppendSeparator();
950 >        {
951 >                wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL);
952 >                wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("quit.xpm")));
953 >                menuItem->SetBitmap(bitmap);
954 >                itemMenu37->Append(menuItem);
955 >        }
956 >        menuBar->Append(itemMenu37, _("&File"));
957 >        wxMenu* itemMenu42 = new wxMenu;
958 >        itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK);
959 >        menuBar->Append(itemMenu42, _("Options"));
960 >        wxMenu* itemMenu44 = new wxMenu;
961 >        itemMenu44->Append(wxID_HELP, _("Help"), wxEmptyString, wxITEM_NORMAL);
962 >        itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
963 >        menuBar->Append(itemMenu44, _("Help"));
964 >        itemFrame1->SetMenuBar(menuBar);
965 >        
966 >        wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
967 >        itemFrame1->SetSizer(itemBoxSizer2);
968 >
969 >        MainSplitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_LIVE_UPDATE|wxNO_BORDER );
970 >        MainSplitter->SetMinimumPaneSize(150);
971 >        MainSplitter->SetName(_T("MainSplitter"));
972 >
973 >        wxPanel* itemPanel4 = new wxPanel( MainSplitter, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
974 >        wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
975 >        itemPanel4->SetSizer(itemBoxSizer5);
976 >
977 >        wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
978 >        itemBoxSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0);
979 >        SelectAll = new wxCheckBox( itemPanel4, SelectAll_Checkbox, _("Select All/None"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
980 >        SelectAll->SetValue(false);
981 >        SelectAll->SetName(_T("SelectAll_Checkbox"));
982 >        itemBoxSizer6->Add(SelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
983 >
984 >        RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("redo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
985 >        RefreshButton->SetName(_T("RefreshButton"));
986 >        itemBoxSizer6->Add(RefreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
987 >
988 >        wxArrayString Mods_CheckboxListStrings;
989 >        Mods_CheckboxList = new wxCheckListBox( itemPanel4, Mods_CheckboxList1, wxDefaultPosition, wxDefaultSize, Mods_CheckboxListStrings, wxLB_HSCROLL );
990 >        Mods_CheckboxList->SetName(_T("Mods_CheckboxList"));
991 >        itemBoxSizer5->Add(Mods_CheckboxList, 1, wxGROW|wxALL, 0);
992 >
993 >        wxPanel* itemPanel10 = new wxPanel( MainSplitter, DescriptionHolder_Panel, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
994 >        itemPanel10->SetName(_T("DescriptionHolder_Panel"));
995 >        wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
996 >        itemPanel10->SetSizer(itemBoxSizer11);
997 >
998 >        wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
999 >        itemBoxSizer11->Add(itemBoxSizer12, 0, wxGROW|wxALL, 0);
1000 >        wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL);
1001 >        itemBoxSizer12->Add(itemBoxSizer13, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0);
1002 >        titleText = new wxTextCtrl( itemPanel10, Title_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
1003 >        titleText->SetName(_T("Title_Text"));
1004 >        titleText->SetBackgroundColour(wxColour(240, 240, 240));
1005 >        itemBoxSizer13->Add(titleText, 1, wxGROW|wxLEFT, 5);
1006 >
1007 >        wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL);
1008 >        itemBoxSizer12->Add(itemBoxSizer15, 1, wxGROW|wxALL, 0);
1009 >        creatorText = new wxTextCtrl( itemPanel10, Author_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RIGHT );
1010 >        creatorText->SetName(_T("Author_Text"));
1011 >        creatorText->SetBackgroundColour(wxColour(240, 240, 240));
1012 >        itemBoxSizer15->Add(creatorText, 1, wxGROW|wxRIGHT, 5);
1013 >
1014 >        wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
1015 >        itemStaticLine17->Show(false);
1016 >        itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5);
1017 >
1018 >        descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_AUTO_URL );
1019 >        descriptionText->SetName(_T("DescriptionName"));
1020 >        descriptionText->SetBackgroundColour(wxColour(240, 240, 240));
1021 >        itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5);
1022 >
1023 >        MainSplitter->SplitVertically(itemPanel4, itemPanel10, 150);
1024 >        itemBoxSizer2->Add(MainSplitter, 1, wxGROW|wxALL, 0);
1025 >
1026 >        StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 );
1027 >        StatusArea->SetName(_T("StatusArea"));
1028 >        StatusArea->SetFieldsCount(1);
1029 >        StatusArea->SetStatusText(_("Status Area"), 0);
1030 >        itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0);
1031 >
1032 >        wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
1033 >        itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0);
1034 >
1035 >        ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxSize(-1, 30), wxGA_SMOOTH );
1036 >        ProgressBar->SetValue(0);
1037 >        itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0);
1038 >
1039 >        InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxSize(-1, 30), 0 );
1040 >        itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0);
1041 >
1042 >        wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL);
1043 >        itemBoxSizer2->Add(itemBoxSizer23, 0, wxGROW|wxALL, 0);
1044 >
1045 >        OptionsPanel = new wxPanel( itemFrame1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
1046 >        itemBoxSizer2->Add(OptionsPanel, 0, wxGROW, 0);
1047 >
1048 >        wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL);
1049 >        OptionsPanel->SetSizer(itemBoxSizer25);
1050 >
1051 >        wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL);
1052 >        itemBoxSizer25->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5);
1053 >
1054 >        SepRadio = new wxRadioButton( OptionsPanel, Sep_RadioButton, _("Sep"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
1055 >        SepRadio->SetValue(false);
1056 >        if (MainWindow::ShowToolTips())
1057 >                SepRadio->SetToolTip(_("For PC Demo and Mac"));
1058 >        itemBoxSizer26->Add(SepRadio, 0, wxALIGN_LEFT|wxALL, 5);
1059 >
1060 >        NoSepRadio = new wxRadioButton( OptionsPanel, NoSep_RadioButton, _("NoSep"), wxDefaultPosition, wxDefaultSize, 0 );
1061 >        NoSepRadio->SetValue(false);
1062 >        if (MainWindow::ShowToolTips())
1063 >                NoSepRadio->SetToolTip(_("For PC Retail"));
1064 >        itemBoxSizer26->Add(NoSepRadio, 0, wxALIGN_LEFT|wxALL, 5);
1065 >
1066 >        wxStaticLine* itemStaticLine29 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
1067 >        itemBoxSizer25->Add(itemStaticLine29, 0, wxGROW|wxALL, 5);
1068 >
1069 >        wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL);
1070 >        itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5);
1071 >
1072 >        SeparatedRadio = new wxRadioButton( OptionsPanel, Separated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
1073 >        SeparatedRadio->SetValue(false);
1074 >        SeparatedRadio->SetName(_T("Separated_RadioButton"));
1075 >        itemBoxSizer30->Add(SeparatedRadio, 0, wxALIGN_LEFT|wxALL, 5);
1076 >
1077 >        CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 );
1078 >        CompleteRadio->SetValue(false);
1079 >        CompleteRadio->SetName(_T("Complete_RadioButton"));
1080 >        itemBoxSizer30->Add(CompleteRadio, 0, wxALIGN_LEFT|wxALL, 5);
1081 >
1082 >        wxStaticLine* itemStaticLine33 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
1083 >        itemBoxSizer25->Add(itemStaticLine33, 0, wxGROW|wxALL, 5);
1084 >
1085 >        wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL);
1086 >        itemBoxSizer25->Add(itemBoxSizer34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1087 >
1088 >        ReglobalizeButton = new wxButton( OptionsPanel, ReGlobalize_Button, _("Reglobalize"), wxDefaultPosition, wxDefaultSize, 0 );
1089 >        ReglobalizeButton->SetName(_T("Reglobalize_Button"));
1090 >        itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5);
1091 >
1092 >        // Connect events and objects
1093 >        Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this);
1094 >        ////@end MainWindow content construction
1095  
1048    wxMenuBar* menuBar = new wxMenuBar;
1049    wxMenu* itemMenu37 = new wxMenu;
1050    {
1051        wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_LOAD, _("&Load Configuration..."), wxEmptyString, wxITEM_NORMAL);
1052        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("fileopen.xpm")));
1053        menuItem->SetBitmap(bitmap);
1054        itemMenu37->Append(menuItem);
1055    }
1056    {
1057        wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_SAVE, _("&Save Configuration..."), wxEmptyString, wxITEM_NORMAL);
1058        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("filesaveas.xpm")));
1059        menuItem->SetBitmap(bitmap);
1060        itemMenu37->Append(menuItem);
1061    }
1062    itemMenu37->AppendSeparator();
1063    {
1064        wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL);
1065        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("quit.xpm")));
1066        menuItem->SetBitmap(bitmap);
1067        itemMenu37->Append(menuItem);
1068    }
1069    menuBar->Append(itemMenu37, _("&File"));
1070    wxMenu* itemMenu42 = new wxMenu;
1071    itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK);
1072    menuBar->Append(itemMenu42, _("Options"));
1073    wxMenu* itemMenu44 = new wxMenu;
1074    itemMenu44->Append(wxID_HELP, _("Help"), wxEmptyString, wxITEM_NORMAL);
1075    itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
1076    menuBar->Append(itemMenu44, _("Help"));
1077    itemFrame1->SetMenuBar(menuBar);
1078
1079    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
1080    itemFrame1->SetSizer(itemBoxSizer2);
1081
1082    MainSplitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_LIVE_UPDATE|wxNO_BORDER );
1083    MainSplitter->SetMinimumPaneSize(150);
1084    MainSplitter->SetName(_T("MainSplitter"));
1085
1086    wxPanel* itemPanel4 = new wxPanel( MainSplitter, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
1087    wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
1088    itemPanel4->SetSizer(itemBoxSizer5);
1089
1090    wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
1091    itemBoxSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0);
1092    SelectAll = new wxCheckBox( itemPanel4, SelectAll_Checkbox, _("Select All/None"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
1093    SelectAll->SetValue(false);
1094    SelectAll->SetName(_T("SelectAll_Checkbox"));
1095    itemBoxSizer6->Add(SelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1096
1097    RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("redo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
1098    RefreshButton->SetName(_T("RefreshButton"));
1099    itemBoxSizer6->Add(RefreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
1100
1101    wxArrayString Mods_CheckboxListStrings;
1102    Mods_CheckboxList = new wxCheckListBox( itemPanel4, Mods_CheckboxList1, wxDefaultPosition, wxDefaultSize, Mods_CheckboxListStrings, wxLB_HSCROLL );
1103    Mods_CheckboxList->SetName(_T("Mods_CheckboxList"));
1104    itemBoxSizer5->Add(Mods_CheckboxList, 1, wxGROW|wxALL, 0);
1105
1106    wxPanel* itemPanel10 = new wxPanel( MainSplitter, DescriptionHolder_Panel, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
1107    itemPanel10->SetName(_T("DescriptionHolder_Panel"));
1108    wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
1109    itemPanel10->SetSizer(itemBoxSizer11);
1110
1111    wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
1112    itemBoxSizer11->Add(itemBoxSizer12, 0, wxGROW|wxALL, 0);
1113    wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL);
1114    itemBoxSizer12->Add(itemBoxSizer13, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0);
1115    titleText = new wxTextCtrl( itemPanel10, Title_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
1116    titleText->SetName(_T("Title_Text"));
1117    titleText->SetBackgroundColour(wxColour(240, 240, 240));
1118    itemBoxSizer13->Add(titleText, 1, wxGROW|wxLEFT, 5);
1119
1120    wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL);
1121    itemBoxSizer12->Add(itemBoxSizer15, 1, wxGROW|wxALL, 0);
1122    creatorText = new wxTextCtrl( itemPanel10, Author_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RIGHT );
1123    creatorText->SetName(_T("Author_Text"));
1124    creatorText->SetBackgroundColour(wxColour(240, 240, 240));
1125    itemBoxSizer15->Add(creatorText, 1, wxGROW|wxRIGHT, 5);
1126
1127    wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
1128    itemStaticLine17->Show(false);
1129    itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5);
1130
1131    descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_AUTO_URL );
1132    descriptionText->SetName(_T("DescriptionName"));
1133    descriptionText->SetBackgroundColour(wxColour(240, 240, 240));
1134    itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5);
1135
1136    MainSplitter->SplitVertically(itemPanel4, itemPanel10, 150);
1137    itemBoxSizer2->Add(MainSplitter, 1, wxGROW|wxALL, 0);
1138
1139    StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 );
1140    StatusArea->SetName(_T("StatusArea"));
1141    StatusArea->SetFieldsCount(1);
1142    StatusArea->SetStatusText(_("Status Area"), 0);
1143    itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0);
1144
1145    wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
1146    itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0);
1147
1148    ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxSize(-1, 30), wxGA_SMOOTH );
1149    ProgressBar->SetValue(0);
1150    itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0);
1151
1152    InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxSize(-1, 30), 0 );
1153    itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0);
1154
1155    wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL);
1156    itemBoxSizer2->Add(itemBoxSizer23, 0, wxGROW|wxALL, 0);
1157
1158    OptionsPanel = new wxPanel( itemFrame1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
1159    itemBoxSizer2->Add(OptionsPanel, 0, wxGROW, 0);
1160
1161    wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL);
1162    OptionsPanel->SetSizer(itemBoxSizer25);
1163
1164    wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL);
1165    itemBoxSizer25->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5);
1166
1167    SepRadio = new wxRadioButton( OptionsPanel, Sep_RadioButton, _("Sep"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
1168    SepRadio->SetValue(false);
1169    if (MainWindow::ShowToolTips())
1170        SepRadio->SetToolTip(_("For PC Demo and Mac"));
1171    itemBoxSizer26->Add(SepRadio, 0, wxALIGN_LEFT|wxALL, 5);
1172
1173    NoSepRadio = new wxRadioButton( OptionsPanel, NoSep_RadioButton, _("NoSep"), wxDefaultPosition, wxDefaultSize, 0 );
1174    NoSepRadio->SetValue(false);
1175    if (MainWindow::ShowToolTips())
1176        NoSepRadio->SetToolTip(_("For PC Retail"));
1177    itemBoxSizer26->Add(NoSepRadio, 0, wxALIGN_LEFT|wxALL, 5);
1178
1179    wxStaticLine* itemStaticLine29 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
1180    itemBoxSizer25->Add(itemStaticLine29, 0, wxGROW|wxALL, 5);
1181
1182    wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL);
1183    itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5);
1184
1185    SeparatedRadio = new wxRadioButton( OptionsPanel, Separated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
1186    SeparatedRadio->SetValue(false);
1187    SeparatedRadio->SetName(_T("Separated_RadioButton"));
1188    itemBoxSizer30->Add(SeparatedRadio, 0, wxALIGN_LEFT|wxALL, 5);
1189
1190    CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 );
1191    CompleteRadio->SetValue(false);
1192    CompleteRadio->SetName(_T("Complete_RadioButton"));
1193    itemBoxSizer30->Add(CompleteRadio, 0, wxALIGN_LEFT|wxALL, 5);
1194
1195    wxStaticLine* itemStaticLine33 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
1196    itemBoxSizer25->Add(itemStaticLine33, 0, wxGROW|wxALL, 5);
1197
1198    wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL);
1199    itemBoxSizer25->Add(itemBoxSizer34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
1200
1201    ReglobalizeButton = new wxButton( OptionsPanel, ReGlobalize_Button, _("Reglobalize"), wxDefaultPosition, wxDefaultSize, 0 );
1202    ReglobalizeButton->SetName(_T("Reglobalize_Button"));
1203    itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5);
1204
1205    // Connect events and objects
1206    Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this);
1207 ////@end MainWindow content construction
1208        
1096          if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) {
1097                  static_cast<string>("-import:sep");
1098                  splitInstances = NOT_SPLIT;
# Line 1217 | Line 1104 | void MainWindow::CreateControls()
1104  
1105          globalPackages = getPackages();
1106          globalInstalledMods = getInstallString();
1107 <                for (int i = 0; i < globalPackages.size(); i++) {
1108 <                        Mods_CheckboxList->Append(globalPackages[i].name.c_str());
1109 <                        if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i);
1110 <        }
1111 <                TheStatusBar = &StatusArea;
1112 <                TheInstallButton = InstallButton;
1113 <                TheProgressBar = ProgressBar;
1114 <                OptionsPanel->Hide();
1115 <                if(splitInstances == SPLIT) SeparatedRadio->SetValue(true);
1116 <                else CompleteRadio->SetValue(true);
1117 <                
1231 <                
1232 <                
1233 <                if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true);
1234 <                else SepRadio->SetValue(true);
1107 >        for (int i = 0; i < globalPackages.size(); i++) {
1108 >                Mods_CheckboxList->Append(globalPackages[i].name.c_str());
1109 >                if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i);
1110 >        }
1111 >
1112 >        TheStatusBar = &StatusArea;
1113 >        TheInstallButton = InstallButton;
1114 >        TheProgressBar = ProgressBar;
1115 >        OptionsPanel->Hide();
1116 >        if(splitInstances == SPLIT) SeparatedRadio->SetValue(true);
1117 >        else CompleteRadio->SetValue(true);
1118  
1119 <                        //MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight() );
1119 >
1120 >
1121 >        if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true);
1122 >        else SepRadio->SetValue(true);
1123 >
1124 >
1125 > #ifdef WIN32
1126 >        RedirectIOToConsole();
1127 >        HWND hWnd = GetConsoleWindow();
1128 >        ShowWindow( hWnd, SW_HIDE );
1129 > #endif
1130 >
1131 >        //MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight() );
1132   }
1133  
1134 <                
1134 >
1135   /*
1136 < * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for SelectAll_Checkbox
1137 < */
1136 > * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for SelectAll_Checkbox
1137 > */
1138  
1139   void MainWindow::OnSelectAllCheckboxClick( wxCommandEvent& event )
1140   {
1141 <                switch(SelectAll->Get3StateValue()) {
1141 >        switch(SelectAll->Get3StateValue()) {
1142          case wxCHK_UNCHECKED:
1143                  for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
1144                  //SelectAll->Set3StateValue(wxCHK_CHECKED);
# Line 1258 | Line 1153 | void MainWindow::OnSelectAllCheckboxClic
1153                  break;
1154  
1155          }
1156 <        
1156 >
1157   }
1158  
1159  
1160   /*
1161 < * wxEVT_CREATE event handler for Mods_CheckboxList
1162 < */
1161 > * wxEVT_CREATE event handler for Mods_CheckboxList
1162 > */
1163  
1164   void MainWindow::ModList_OnCreate( wxWindowCreateEvent& event )
1165   {
# Line 1274 | Line 1169 | void MainWindow::ModList_OnCreate( wxWin
1169  
1170  
1171   /*
1172 < * Should we show tooltips?
1173 < */
1172 > * Should we show tooltips?
1173 > */
1174  
1175   bool MainWindow::ShowToolTips()
1176   {
1177 <    return true;
1177 >        return true;
1178   }
1179  
1180   /*
1181 < * Get bitmap resources
1182 < */
1181 > * Get bitmap resources
1182 > */
1183  
1184   wxBitmap MainWindow::GetBitmapResource( const wxString& name )
1185   {
1186 <    // Bitmap retrieval
1187 < ////@begin MainWindow bitmap retrieval
1188 <    wxUnusedVar(name);
1189 <    if (name == _T("redo.xpm"))
1190 <    {
1191 <        wxBitmap bitmap(redo_xpm);
1192 <        return bitmap;
1193 <    }
1194 <    else if (name == _T("fileopen.xpm"))
1195 <    {
1196 <        wxBitmap bitmap( fileopen_xpm);
1197 <        return bitmap;
1198 <    }
1199 <    else if (name == _T("filesaveas.xpm"))
1200 <    {
1201 <        wxBitmap bitmap( filesaveas_xpm);
1202 <        return bitmap;
1203 <    }
1204 <    else if (name == _T("quit.xpm"))
1205 <    {
1206 <        wxBitmap bitmap( quit_xpm);
1207 <        return bitmap;
1208 <    }
1209 <    return wxNullBitmap;
1210 < ////@end MainWindow bitmap retrieval
1186 >        // Bitmap retrieval
1187 >        ////@begin MainWindow bitmap retrieval
1188 >        wxUnusedVar(name);
1189 >        if (name == _T("redo.xpm"))
1190 >        {
1191 >                wxBitmap bitmap(redo_xpm);
1192 >                return bitmap;
1193 >        }
1194 >        else if (name == _T("fileopen.xpm"))
1195 >        {
1196 >                wxBitmap bitmap( fileopen_xpm);
1197 >                return bitmap;
1198 >        }
1199 >        else if (name == _T("filesaveas.xpm"))
1200 >        {
1201 >                wxBitmap bitmap( filesaveas_xpm);
1202 >                return bitmap;
1203 >        }
1204 >        else if (name == _T("quit.xpm"))
1205 >        {
1206 >                wxBitmap bitmap( quit_xpm);
1207 >                return bitmap;
1208 >        }
1209 >        return wxNullBitmap;
1210 >        ////@end MainWindow bitmap retrieval
1211   }
1212  
1213   /*
1214 < * Get icon resources
1215 < */
1214 > * Get icon resources
1215 > */
1216  
1217   wxIcon MainWindow::GetIconResource( const wxString& name )
1218   {
1219 <    // Icon retrieval
1220 < ////@begin MainWindow icon retrieval
1221 <    wxUnusedVar(name);
1222 <    if (name == _T("oni_special.ico"))
1223 <    {
1224 <        wxIcon icon(_T("oni_special.ico"), wxBITMAP_TYPE_ICO);
1225 <        return icon;
1226 <    }
1227 <    return wxNullIcon;
1228 < ////@end MainWindow icon retrieval
1219 >
1220 >        // Icon retrieval
1221 >        ////@begin MainWindow icon retrieval
1222 >        wxUnusedVar(name);
1223 >        if (name == _T("oni_special.ico"))
1224 >        {
1225 >                //      wxIcon icon(_T("oni_special.ico"), wxBITMAP_TYPE_ICO);
1226 >                //      return icon;
1227 >        }
1228 >        return wxNullIcon;
1229 >        ////@end MainWindow icon retrieval
1230   }
1231  
1232  
1233   /*
1234 < * wxEVT_COMMAND_LISTBOX_SELECTED event handler for Mods_CheckboxList1
1235 < */
1234 > * wxEVT_COMMAND_LISTBOX_SELECTED event handler for Mods_CheckboxList1
1235 > */
1236  
1237   void MainWindow::OnModsCheckboxList1Selected( wxCommandEvent& event )
1238   {
# Line 1350 | Line 1246 | void MainWindow::OnModsCheckboxList1Sele
1246  
1247  
1248   /*
1249 < * wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event handler for Mods_CheckboxList1
1250 < */
1249 > * wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event handler for Mods_CheckboxList1
1250 > */
1251  
1252   void MainWindow::OnModsCheckboxList1Toggled( wxCommandEvent& event )
1253   {
1254          SelectAll->Set3StateValue(wxCHK_UNDETERMINED);
1255          if(event.GetInt()) {
1256 <        /*
1256 >                /*
1257                  switch(SelectAll->Get3StateValue()) {
1258 <        case wxCHK_UNCHECKED:
1258 >                case wxCHK_UNCHECKED:
1259                  break;
1260 <        case wxCHK_CHECKED:
1260 >                case wxCHK_CHECKED:
1261                  break;
1262 <        case wxCHK_UNDETERMINED :
1262 >                case wxCHK_UNDETERMINED :
1263                  break;
1264 <        }
1265 <        */
1264 >                }
1265 >                */
1266          }
1267   }
1268  
1269  
1270   /*
1271 < * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_OPTIONS
1272 < */
1271 > * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_OPTIONS
1272 > */
1273  
1274   void MainWindow::OnOptionsClick( wxCommandEvent& event )
1275   {
1276 <        
1276 >
1277 >
1278 >
1279 >
1280          if (!event.GetInt() ) {
1281                  OptionsPanel->Hide();
1282 <                MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());}
1282 >                this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());}
1283          else {
1284 + //              Uncomment this when we release, it gets annoying if you are testing globalization a lot ;)
1285 +                wxMessageDialog* YesNoDialog = new wxMessageDialog(this,                        "WARNING: These options are for advanced users only, use with caution.", "AE Installer Alert",  wxOK | wxICON_EXCLAMATION       , wxDefaultPosition);
1286 +                YesNoDialog->ShowModal();
1287                  OptionsPanel->Show();
1288 <                MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight());
1288 >                this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight());
1289          }
1290 +        
1291   }
1292  
1293  
1294   /*
1295 < * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT
1296 < */
1295 > * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT
1296 > */
1297  
1298   void MainWindow::OnExitClick( wxCommandEvent& event )
1299   {
1300 < exit(0);
1300 >        exit(0);
1301   }
1302  
1303  
1304   /*
1305 < * wxEVT_COMMAND_BUTTON_CLICKED event handler for Install_Button
1306 < */
1305 > * wxEVT_COMMAND_BUTTON_CLICKED event handler for Install_Button
1306 > */
1307  
1308  
1309   struct recompile
1310   {
1311 <    recompile(vector<string> localPackages) : thePackages(localPackages) { }
1312 <    void operator()()
1313 <    {
1311 >        recompile(vector<string> localPackages) : thePackages(localPackages) { }
1312 >        void operator()()
1313 >        {
1314                  TheInstallButton->Disable();
1315 <       recompileAll(thePackages);
1316 <           TheInstallButton->Enable();
1317 <    }
1315 >                recompileAll(thePackages);
1316 >                TheInstallButton->Enable();
1317 >        }
1318  
1319 <    vector<string> thePackages;
1319 >        vector<string> thePackages;
1320   };
1321  
1322   void MainWindow::OnInstallButtonClick( wxCommandEvent& event )
1323   {
1324 <        
1324 >
1325          vector<string> localPackages;
1326          localPackages.push_back("Globalize");
1327          for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName );
1328          if ( !localPackages.empty() )   {
1329 <                
1329 >        
1330                  //MainWindow::MainWindow().Hide();      
1331 <        //      boost::thread thrd2(recompileAll(localPackages) );
1331 >                //      boost::thread thrd2(recompileAll(localPackages) );
1332                  //MainWindow::MainWindow().Show();
1333 +                this->InstallButton->Disable();
1334 +                this->ReglobalizeButton->Disable();
1335   #ifdef WIN32
1336                  recompile packages(localPackages);
1337                  boost::thread thrd(packages);
1338   #else
1434                this->Disable();
1339                  recompileAll(localPackages);
1436                this->Enable();
1340   #endif
1341  
1342 +                this->InstallButton->Enable();
1343 +                this->ReglobalizeButton->Enable();
1344          }
1345 <        
1346 <        
1345 >
1346 >
1347   }
1348  
1349   /*void setStatusArea( string s ) {
1350 <        //TheStatusBar = MainWindow::StatusArea;
1351 <        (**TheStatusBar).SetStatusText(_(s.c_str()), 0);
1352 <        
1353 <                //MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1);
1354 <                                                
1355 <        //MainWindow::StatusBar->SetLabel("Importing Files...");
1356 <        //StatusBar->SetLabel(s);
1350 > //TheStatusBar = MainWindow::StatusArea;
1351 > (**TheStatusBar).SetStatusText(_(s.c_str()), 0);
1352 >
1353 > //MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1);
1354 >
1355 > //MainWindow::StatusBar->SetLabel("Importing Files...");
1356 > //StatusBar->SetLabel(s);
1357   //->SetLabel(s);
1358 <        
1358 >
1359   }*/
1360  
1361   void setProgressBar( int i ) {
1362 < //TheProgressBar->SetValue(
1362 >        //TheProgressBar->SetValue(
1363  
1364          TheProgressBar->SetValue(i);
1365  
# Line 1462 | Line 1367 | void setProgressBar( int i ) {
1367  
1368  
1369   /*
1370 < * wxEVT_UPDATE_UI event handler for ID_STATUSBAR
1371 < */
1370 > * wxEVT_UPDATE_UI event handler for ID_STATUSBAR
1371 > */
1372  
1373   void MainWindow::OnStatusbarUpdate( wxUpdateUIEvent& event )
1374   {
1375 < ////@begin wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow.
1376 <    // Before editing this code, remove the block markers.
1377 <    event.Skip();
1378 < ////@end wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow.
1375 >        ////@begin wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow.
1376 >        // Before editing this code, remove the block markers.
1377 >        event.Skip();
1378 >        ////@end wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow.
1379   }
1380  
1381  
1382   /*
1383 < * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT
1384 < */
1383 > * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT
1384 > */
1385  
1386   void MainWindow::OnAboutClick( wxCommandEvent& event )
1387   {
1388 < ////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow.
1389 <    // Before editing this code, remove the block markers.
1390 <    About* window = new About(this);
1391 <    int returnValue = window->ShowModal();
1392 <    window->Destroy();
1393 < ////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow.
1388 >        ////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow.
1389 >        // Before editing this code, remove the block markers.
1390 >        About* window = new About(this);
1391 >        int returnValue = window->ShowModal();
1392 >        window->Destroy();
1393 >        ////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow.
1394   }
1395  
1396  
1397   /*
1398 < * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton
1399 < */
1398 > * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton
1399 > */
1400  
1401   void MainWindow::OnNoSepRadioButtonSelected( wxCommandEvent& event )
1402   {
# Line 1500 | Line 1405 | void MainWindow::OnNoSepRadioButtonSelec
1405  
1406  
1407   /*
1408 < * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Sep_RadioButton
1409 < */
1408 > * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Sep_RadioButton
1409 > */
1410  
1411   void MainWindow::OnSepRadioButtonSelected( wxCommandEvent& event )
1412   {
# Line 1510 | Line 1415 | void MainWindow::OnSepRadioButtonSelecte
1415  
1416  
1417   /*
1418 < * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton
1419 < */
1418 > * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton
1419 > */
1420  
1421   void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event )
1422   {
1423 < splitInstances = SPLIT;
1423 >        splitInstances = SPLIT;
1424  
1425   }
1426  
1427  
1428   /*
1429 < * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Complete_RadioButton
1430 < */
1429 > * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Complete_RadioButton
1430 > */
1431  
1432   void MainWindow::OnCompleteRadioButtonSelected( wxCommandEvent& event )
1433   {
1434 < splitInstances = NOT_SPLIT;
1434 >        splitInstances = NOT_SPLIT;
1435  
1436   }
1437  
1438  
1439   /*
1440 < * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON
1441 < */
1440 > * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON
1441 > */
1442  
1443   void MainWindow::OnRefreshButtonClick( wxCommandEvent& event )
1444   {
# Line 1542 | Line 1447 | void MainWindow::OnRefreshButtonClick( w
1447  
1448  
1449   /*
1450 < * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD
1451 < */
1450 > * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD
1451 > */
1452  
1453  
1454  
1455  
1456   void MainWindow::refreshMods (vector<string> s) {
1457 <        
1457 >
1458          Mods_CheckboxList->Clear();
1459 <                                           //globalInstalledMods = getPackages();
1460 <                for (int i = 0; i < globalPackages.size(); i++) {
1461 <                        Mods_CheckboxList->Append(globalPackages[i].name.c_str());
1462 <                        if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i);
1463 <                        //else Mods_CheckboxList->Check(i,0);
1464 <                
1465 <                }
1459 >        //globalInstalledMods = getPackages();
1460 >        for (int i = 0; i < globalPackages.size(); i++) {
1461 >                Mods_CheckboxList->Append(globalPackages[i].name.c_str());
1462 >                if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i);
1463 >                //else Mods_CheckboxList->Check(i,0);
1464 >
1465 >        }
1466   }
1467  
1468   void MainWindow::OnLoadClick( wxCommandEvent& event )
1469   {
1470 +        if (busy == 1) return;
1471          static const wxChar *FILETYPES = _T(
1472                  "Mod Loadouts (*.cfg)|*.cfg|"
1473                  "All files (*.*)|*.*"
1474 <        );
1475 <        
1474 >                );
1475 >
1476          wxFileDialog* openFileDialog =
1477                  new wxFileDialog( this, _("Open Mod Loadout"), "", "", FILETYPES,
1478 <                                  wxOPEN, wxDefaultPosition);
1479 <
1478 >                wxOPEN, wxDefaultPosition);
1479 >
1480          if ( openFileDialog->ShowModal() == wxID_OK )
1481          {
1482                  refreshMods(getInstallString( string(openFileDialog->GetPath()) ));
# Line 1581 | Line 1487 | void MainWindow::OnLoadClick( wxCommandE
1487  
1488  
1489   /*
1490 < * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE
1491 < */
1490 > * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE
1491 > */
1492  
1493   void MainWindow::OnSaveClick( wxCommandEvent& event )
1494   {
1495 +        if (busy == 1) return;
1496          static const wxChar *FILETYPES = _T(
1497                  "Mod Loadouts (*.cfg)|*.cfg|"
1498                  "All files (*.*)|*.*"
1499 <        );
1499 >                );
1500  
1501 <                wxFileDialog* openFileDialog =
1501 >        wxFileDialog* openFileDialog =
1502                  new wxFileDialog( this, _("Open file"), "", "", FILETYPES,
1503                  wxSAVE, wxDefaultPosition);
1504  
1505          if ( openFileDialog->ShowModal() == wxID_OK )
1506          {
1507  
1508 <                
1509 <                        //Mods_CheckboxList->
1508 >
1509 >                //Mods_CheckboxList->
1510  
1511  
1512  
1513                  //
1514 <                
1514 >
1515                  if ( exists( openFileDialog->GetPath().c_str() ) )
1516 <        {
1517 <                remove( openFileDialog->GetPath().c_str() );
1518 <        }
1516 >                {
1517 >                        remove( openFileDialog->GetPath().c_str() );
1518 >                }
1519  
1520 <        ofstream file(openFileDialog->GetPath().c_str());
1614 <        
1615 <        vector<string>list;
1616 <        for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName );
1617 <        vector<string>::iterator begin_iter = list.begin();
1618 <        vector<string>::iterator end_iter = list.end();
1520 >                ofstream file(openFileDialog->GetPath().c_str());
1521  
1522 <        sort( list.begin(), list.end() );
1522 >                vector<string>list;
1523 >                for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName );
1524 >                vector<string>::iterator begin_iter = list.begin();
1525 >                vector<string>::iterator end_iter = list.end();
1526  
1527 <        for( ; begin_iter != end_iter; ++begin_iter) {
1528 <                file << *begin_iter << " ";
1529 <        }
1530 <        
1531 <        file.close();
1532 <        file.clear();
1527 >                sort( list.begin(), list.end() );
1528 >
1529 >                for( ; begin_iter != end_iter; ++begin_iter) {
1530 >                        file << *begin_iter << " ";
1531 >                }
1532 >
1533 >                file.close();
1534 >                file.clear();
1535  
1536                  //SetCurrentFilename(openFileDialog->GetFilename());
1537                  //theText->LoadFile(openFileDialog->GetFilename());
# Line 1634 | Line 1541 | void MainWindow::OnSaveClick( wxCommandE
1541   }
1542  
1543  
1544 +
1545   /*
1546 < * wxEVT_COMMAND_BUTTON_CLICKED event handler for ReGlobalize_Button
1547 < */
1546 > * wxEVT_COMMAND_BUTTON_CLICKED event handler for ReGlobalize_Button
1547 > */
1548  
1549   void MainWindow::OnReGlobalizeButtonClick( wxCommandEvent& event )
1550   {
1551 < globalizeData();
1552 <                setProgressBar(1000);
1553 <                setStatusArea("Done!");
1646 < }
1551 >        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);
1552 >
1553 >        if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no...
1554  
1555 +        }
1556 +        else {
1557 +        
1558 +                this->InstallButton->Disable();
1559 +                this->ReglobalizeButton->Disable();
1560  
1561 + #ifdef WIN32
1562 +
1563 +                boost::thread thrd2(globalizeData);
1564 +                //globalizeData();
1565 +                //boost::thread::create_thread(&globalizeData);
1566 +                //       boost::thread_group Tg;
1567 +                // Tg.create_thread( &globalizeData(), this );
1568 + #else
1569 +                globalizeData();
1570 + #endif
1571 +                
1572 +                this->InstallButton->Enable();
1573 +                this->ReglobalizeButton->Enable();
1574 +        }
1575 +
1576 + }
1577   /*
1578 < * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton
1579 < */
1578 > * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton
1579 > */
1580  
1581   /*void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event )
1582   {
1583   ////@begin wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow.
1584 <    // Before editing this code, remove the block markers.
1585 <    event.Skip();
1584 > // Before editing this code, remove the block markers.
1585 > event.Skip();
1586   ////@end wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow.
1587   }*/
1588  

Diff Legend

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