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 355 by gumby, Thu Jun 18 22:30:30 2009 UTC vs.
Revision 500 by iritscen, Sun Mar 14 23:31:14 2010 UTC

# Line 1 | Line 1
1 < /*
2 < AE/Mod Installer
3 < by Gumby and Iritscen
4 < */
5 <
6 < // To-do: -
7 < //                - Institute lots of checks into file-handling
8 < //                - Clear mod info fields when mod is de-selected ???
9 <
10 < #define DEBUG
11 < #include <stdio.h>
12 < //#include <conio.h>
13 < //#include <process.h>
14 < #include <string>
15 < #include <iostream>
16 < #include <cctype>
17 < #include <vector>
18 < #include <fstream>
19 < #include <errno.h>
20 < #include <sstream>
21 <
22 < #include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
23 < #include "boost/lexical_cast.hpp" //int -> string
24 < #include "installer.h"
1 > /***************************************************************************\
2 > | Project: AE Installer                                                                                                         |
3 > | By: Gumby & Iritscen                                                                                                          |
4 > | File: Main_Window.cpp                                                                                                         |
5 > | Function: Handles the GUI.                                                                                            |
6 > | Created: 07/05/2009 20:38:25                                                                                          |
7 > \***************************************************************************/
8  
9 < #ifdef WIN32
10 < #include <windows.h>
28 < #else // assume we're on Mac
29 < #include <stdlib.h>
30 < #include <dirent.h>
9 > #ifndef NTDDI_VERSION          
10 > #define NTDDI_VERSION NTDDI_WIN7
11   #endif
32
33 const string strInstallerVersion = "1.0";
34 const bool SPLIT = 1;
35 const bool NOT_SPLIT = 0;
36 bool splitInstances = SPLIT;
37
12   #ifdef WIN32
13 < const string strOniSplit = "Onisplit.exe";
14 < string strImportOption = "-import:nosep";
15 < const char* strClsCmd = "cls";
16 < const char* strPauseCmd = "PAUSE";
17 < #else // set up Mac equivalents since we're in Mac OS
44 < const string strOniSplit = "mono Onisplit.exe";
45 < string strImportOption = "-import:sep";
46 < const char* strClsCmd = "clear";
47 < const char* strPauseCmd = "read -n 1 -p \"Press any key to continue\"";
48 < void Sleep(int ms) { sleep( ms / 1000 ); }
13 > #include <windows.h>
14 > #include <shobjidl.h>
15 > HWND Handle;
16 > ITaskbarList *pTaskbarList;
17 > ITaskbarList3 *pTaskbarList3;
18   #endif
19  
51 using namespace boost::filesystem;
52 using namespace std;
53
54
55
56
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            using boost::lexical_cast;
64    using boost::bad_lexical_cast;
65 // using namespace boost::posix_time;
66        using namespace boost::gregorian;
67        using namespace boost::posix_time;
68        ptime start_time(second_clock::local_time());
69
70        setStatusArea("Globalizing!");
71        int err = 0;
72        int parts_done = 0;
73        char Step_x_x[300];
74        //char levels[i][5];
75        remove("Globalize.log");
76        ofstream logfile("Globalize.log");
77        logfile << "Globalization started " << to_simple_string(start_time) << endl;
78        try {
79                
80                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.
81                //const vector<double> ck(cv, &cv[CvSize]);
82                vector<string> levels;
83                for (int f = 0; f < 15; f++) {
84                        levels.push_back(levels_cstr[f]);
85                }
86                char choice = 0;
87
88                //SetCurrentDirectory("C:/Program Files/Oni/edition/install");
89                ///char levels[i][3];
90                path Characters = "../GameDataFolder/level0_Characters";
91                path Particles = "../GameDataFolder/level0_Particles";
92                path Archive = "../GameDataFolder/Archive";
93                path Textures  = "../GameDataFolder/level0_Textures";
94                path Sounds = "../GameDataFolder/level0_Sounds";
95                path Animations = "../GameDataFolder/level0_Animations";
96                path TRAC = Animations / "level0_TRAC";
97                path TRAM = Animations / "level0_TRAM";
98                
99                vector<path> GDFPaths;
100                GDFPaths.push_back(Characters);
101                GDFPaths.push_back(Particles);
102                GDFPaths.push_back(Textures);
103                GDFPaths.push_back(Sounds);
104                GDFPaths.push_back(TRAC);
105                GDFPaths.push_back(TRAM);
106                
107                        
108                path VanillaCharacters = "packages/VanillaDats/level0_Final/level0_Characters/level0_Characters.oni";
109                path VanillaParticles = "packages/VanillaDats/level0_Final/level0_Particles/level0_Particles.oni";
110                path VanillaTextures  = "packages/VanillaDats/level0_Final/level0_Textures/level0_Textures.oni";
111                path VanillaSounds = "packages/VanillaDats/level0_Final/level0_Sounds/level0_Sounds.oni";
112                path VanillaAnimations = "packages/VanillaDats/level0_Final/level0_Animations/level0_Animations.oni";
113                path VanillaTRAC = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAC.oni";
114                path VanillaTRAM = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAM.oni";
115
116                vector<path> VanillaPaths;
117                
118                VanillaPaths.push_back(VanillaCharacters);
119                VanillaPaths.push_back(VanillaParticles);
120                VanillaPaths.push_back(VanillaTextures);
121                VanillaPaths.push_back(VanillaSounds);
122                VanillaPaths.push_back(VanillaTRAC);
123                VanillaPaths.push_back(VanillaTRAM);
124                
125                /*
126                if (exists("../GameDataFolder/"))
127                {
128                //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.)"
129                //       << "\n1. Re-globalize"
130                //       << "\n2. Return to main menu\n";
131                //choice = cin.get();
132                cin.ignore(128, '\n');
133                if (choice == '1')
134                remove_all("../GameDataFolder"); // remove AE GDF
135                if (choice == '2')
136                return 0;
137                }
138                */
139                setStatusArea("Removing old GameDataFolder...\n");
140                logfile <<  "Removing old GameDataFolder...\n";
141                remove_all( "../GameDataFolder/" );
142                setStatusArea("Creating needed directories...");
143                logfile <<  "Creating needed directories...\n";
144                create_directory( "../GameDataFolder/" );
145                
146                create_directory( "packages" );
147                
148                if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats");
149                create_directory( "packages/VanillaDats" );
150                
151                create_directory( "packages/VanillaDats/level0_Final/" );
152                //blah blah finish this.
153                //logfile <<  "packages/VanillaDats/level0_Final/ created";
154                create_directory( Characters );
155                create_directory( Particles );
156                create_directory( Archive );
157                create_directory( Textures );
158                create_directory( Sounds );
159                create_directory( Animations );
160                create_directory( TRAC );
161                create_directory( TRAM );
162                int num_levels = 0;
163                for(int i = 1; i < 15; i++)
164                {
165                                if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) {
166                                num_levels++;
167
168                        }
169                }
170                logfile << "Exporting and moving...\n\n";
171                int total_steps =  8 + 2 * num_levels;
172                for(int i = 0; i < 15; i++)
173                {
174                        
175                        //printf(levels[i],"%d",levels[i]); // int to char array
176                        
177                        if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) {
178                                logfile << "level" << levels[i] << "_Final\n";
179                                logfile << "\tExporting level" << levels[i] << "_Final.dat\n";
180                                //printf(Step_x_x,"Step %d/%d: exporting level%d_final.dat", parts_done + 1,, levels[i]); setStatusArea((string)Step_x_x);
181                                setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " exporting level" + levels[i]+"_Final.dat");
182                                create_directory( "../GameDataFolder/level" + levels[i] + "_Final" );
183 //                              setStatusArea(strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat");
184                                system((strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat").c_str());
185                                create_directory( "packages/VanillaDats/level" + levels[i] + "_Final" );
186                                create_directory( "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final" );
187
188                                directory_iterator end_iter;
189                                for ( directory_iterator dir_itr( "../GameDataFolder/level" + levels[i] + "_Final" ); dir_itr != end_iter; ++dir_itr )
190                                {
191                                        //cout << dir_itr->path().filename();
192                                        if ( is_regular_file( dir_itr->status() ) )
193                                        {
194                                                if ( dir_itr->path().filename().substr(0,8) == "TXMPfail" ||
195                                                        dir_itr->path().filename().substr(0,9) == "TXMPlevel" ||
196                                                        ( dir_itr->path().filename().substr(0,4) == "TXMP" && dir_itr->path().filename().find("intro")!=string::npos) ||
197                                                        dir_itr->path().filename().substr(0,4) == "TXMB" ||
198                                                        dir_itr->path().filename() == "M3GMpowerup_lsi.oni" ||
199                                                        dir_itr->path().filename() == "TXMPlsi_icon.oni" ||
200                                                        ( dir_itr->path().filename().substr(0,4) == "TXMB" && dir_itr->path().filename().find("splash_screen.oni")!=string::npos)       )
201                                                {
202                                                        cout <<dir_itr->path().filename() << "\n";
203                                                        create_directory( dir_itr->path().parent_path() / "NoGlobal");  
204                                                        if(!exists( dir_itr->path().parent_path() / "NoGlobal" / dir_itr->filename())) rename(dir_itr->path(), dir_itr->path().parent_path() / "NoGlobal" /
205                                                                dir_itr->filename());
206                                                        else remove(dir_itr->path());
207                                                }
208                                                else if (dir_itr->path().filename().substr(0,4) == "TRAC"
209                                                        || dir_itr->path().filename().substr(0,4) == "ONVL") {
210                                                                cout <<dir_itr->path().filename() << "\n";
211                                                                if(!exists( TRAC / dir_itr->filename())) rename(dir_itr->path(), TRAC / dir_itr->filename());
212                                                                else remove(dir_itr->path());
213                                                }
214                                                else if (dir_itr->path().filename().substr(0,4) == "TRAM") {
215                                                        cout <<dir_itr->path().filename() << "\n";
216                                                        if(!exists( TRAM / dir_itr->filename())) rename(dir_itr->path(), TRAM / dir_itr->filename());
217                                                        else remove(dir_itr->path());
218                                                }
219                                                else if (dir_itr->path().filename().substr(0,4) == "ONSK" ||
220                                                        dir_itr->path().filename().substr(0,4) == "TXMP") {
221                                                                cout <<dir_itr->path().filename() << "\n";\
222                                                                        create_directory( dir_itr->path().parent_path() / "TexFix");    
223                                                                if(!exists( Textures / dir_itr->filename())) rename(dir_itr->path(), Textures / dir_itr->filename());
224                                                                //rename(dir_itr->path(), dir_itr->path().parent_path() / "TexFix" / dir_itr->filename());
225                                                }
226                                                else if (dir_itr->path().filename().substr(0,4) == "ONCC"
227                                                        || dir_itr->path().filename().substr(0,4) == "TRBS"
228                                                        || dir_itr->path().filename().substr(0,4) == "ONCV"
229                                                        || dir_itr->path().filename().substr(0,4) == "TRMA"
230                                                        || dir_itr->path().filename().substr(0,4) == "TRSC"
231                                                        || dir_itr->path().filename().substr(0,4) == "TRAS") {
232                                                                cout <<dir_itr->path().filename() << "\n";
233                                                                if(!exists( Characters / dir_itr->filename())) rename(dir_itr->path(), Characters / dir_itr->filename());
234                                                                else remove(dir_itr->path());
235                                                }
236                                                else if (dir_itr->path().filename().substr(0,4) == "OSBD"
237                                                        || dir_itr->path().filename().substr(0,4) == "SNDD") {
238                                                                cout << dir_itr->path().filename() << "\n";
239                                                                if(!exists( Sounds / dir_itr->filename())) rename(dir_itr->path(), Sounds / dir_itr->filename());
240                                                                else remove(dir_itr->path());
241                                                }
242                                                else if (dir_itr->path().filename().substr(0,5) == "BINA3"
243                                                        || dir_itr->path().filename().substr(0,10) == "M3GMdebris"
244                                                        || dir_itr->path().filename() == "M3GMtoxic_bubble.oni"
245                                                        || dir_itr->path().filename().substr(0,8) == "M3GMelec"
246                                                        || dir_itr->path().filename().substr(0,7) == "M3GMrat"
247                                                        || dir_itr->path().filename().substr(0,7) == "M3GMjet"
248                                                        || dir_itr->path().filename().substr(0,9) == "M3GMbomb_"
249                                                        || dir_itr->path().filename() == "M3GMbarab_swave.oni"
250                                                        || dir_itr->path().filename() == "M3GMbloodyfoot.oni"
251                                                        ){
252                                                                cout <<dir_itr->path().filename() << "\n";
253                                                                if(!exists( Particles / dir_itr->filename())) rename(dir_itr->path(), Particles / dir_itr->filename());
254                                                                else remove(dir_itr->path());
255                                                }
256                                                else if (dir_itr->path().filename().substr(0,4) == "AGDB"
257                                                        || dir_itr->path().filename().substr(0,4) == "TRCM") {
258                                                                cout <<dir_itr->path().filename() << "\n";
259                                        
260                                                                if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename());
261                                                                else remove(dir_itr->path());
262                                                }
263                                                if (exists(dir_itr->path())) {
264
265                                                }
266                                                else {
267                                                        logfile << "\tMoved file: " << dir_itr->path().filename() << "\n";
268                                                }
269                                        }
270
271
272                                                
273                                }
274                                logfile << "\tCleaning up TXMPs...\n";
275                                system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + levels[i] + "_Final/TXMP*.oni").c_str());
276                                parts_done++;
277
278                                setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) ));
279                                
280                        }
281                }
282                logfile << "Reimporting levels\n";
283                for (int i = 0; i < 15; i++)
284                {
285                        logfile << "\tReimporting level" << levels[i] << "_Final.oni\n";
286                        //printf(levels[i],"%d",levels[i]);
287                        //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");
288                        setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " reimporting level" + levels[i]+"_Final.oni");
289                        system( (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level"
290                                + levels[i] + "_Final/level" + levels[i] + "_Final.oni > Globalize.oni").c_str());
291                        setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) ));
292                                parts_done++;
293                }
294                create_directory( VanillaCharacters.parent_path() );
295                create_directory( VanillaParticles.parent_path() );
296                create_directory( VanillaTextures.parent_path() );
297                create_directory( VanillaSounds.parent_path() );
298                create_directory( VanillaAnimations.remove_filename() );
299                
300                for(int j = 0; j < GDFPaths.size(); j++) {
301                        logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n";
302                        setStatusArea("Step" + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() );
303                        system((strOniSplit + " " + strImportOption + " " + GDFPaths[j].string() + " " + VanillaPaths[j].string()).c_str());
304                        parts_done++;
305                        setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) ));
306                }
307 /*
308                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) ));
309                system((strOniSplit + " " + strImportOption + " " + Characters.string() + " " + VanillaCharacters.string()).c_str());
310                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) ));
311                system((strOniSplit + " " + strImportOption + " " + Particles.string() + " " + VanillaParticles.string()).c_str());
312                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) ));
313                system((strOniSplit + " " + strImportOption + " " + Textures.string() + " " + VanillaTextures.string()).c_str());
314                //system((strOniSplit   + " " + strImportOption + (string)" " + Animations.string() + (string)" " + VanillaAnimations.string()).c_str());
315                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) ));
316                system((strOniSplit + " " + strImportOption + " " + TRAC.string() + " " + VanillaTRAC.string()).c_str());
317                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) ));
318                system((strOniSplit + " " + strImportOption + " " + Sounds.string() + " " + VanillaSounds.string()).c_str());
319                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) ));
320                system((strOniSplit + " " + strImportOption + " " + TRAM.string() + " " + VanillaTRAM.string()).c_str());
321                //parts_done++; setStatusArea((string)"Copying level scripts...");setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) ));
322                if (exists("../GameDataFolder/IGMD")) remove_all("../GameDataFolder/IGMD");
323 */
324                create_directory((path)"../GameDataFolder/IGMD");
325                copy((path)"packages/VanillaBSL/", (path)"../GameDataFolder");
326                setProgressBar( 1000 );
327                setStatusArea((string)"Done! Now select your mod packages and click install.");
328        //      while(1) Sleep(-1);
329                
330        }
331        catch (exception ex) {
332                setStatusArea("Warning, handled exception: " + (string)ex.what());
333        }
334        
335                ptime end_time(second_clock::local_time());
336                time_period total_time (start_time, end_time);
337                logfile << "\n\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length();
338                //total_time.length().hours();
339        logfile.close();
340
341        return err;
342 }
343
344
345 vector<ModPackage> getPackages(void)
346 {
347        vector<ModPackage> packages;
348        packages.reserve(65536); // come on, we shouldn't need this much space...right?!
349        fstream file;
350        string filename = "\0";
351        string MODINFO_CFG = "Mod_Info.cfg";
352
353        try
354        {
355                directory_iterator end_iter;
356                for (directory_iterator dir_itr("./packages"); dir_itr != end_iter; ++dir_itr)
357                {
358                        file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str());
359                        //cout << filename << "\n";
360
361                        if(!file.fail())
362                        {
363                                //cout << dir_itr->path().string() + MODINFO_CFG;
364                                //would prefer to push a pointer to a package, but this will do for now
365                                packages.push_back(fileToModPackage(file));
366                        }      
367                        file.close();
368                        file.clear();
369                }
370                sort(packages.begin(), packages.end());
371        }
372        catch (const std::exception & ex)
373        {
374                cout << "Warning, something odd happened!\n";
375        }
376
377        return packages;
378 }
379
380 ModPackage fileToModPackage(fstream &file)
381 {
382        /*
383        This converts a file to a ModPackage struct.
384
385        A few notes...
386        "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.
387        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
388        slower than reading a variable.
389        */
390        ModPackage package;
391        string line;
392        static string NameOfMod = "NameOfMod";  //used for comparing to the current token...
393        //I could have done it in reverse (*iter).compare("ModString") or  
394        static string ARROW = "->";                             //did something like "ModString".compare(*iter), and it would have been
395        static string ModString = "ModString";  //functionably the same.
396        static string HasOnis = "HasOnis";
397        static string HasDeltas = "HasDeltas";
398        static string HasBSL = "HasBSL";
399        static string HasDats = "HasDats";
400        static string IsEngine = "IsEngine";
401        static string Readme = "Readme";
402        static string GlobalNeeded = "GlobalNeeded";
403        static string Category = "Category";
404        static string Creator = "Creator";
405        while (! file.eof() )
406        {
407                getline (file,line);
408                vector<string> tokens;
409                vector<string>::iterator iter;
410                tokenize(line, tokens);                                 //string to vector of "words"
411                if (tokens.capacity() >= 2) {                   //make sure they are using enough stuff
412                        iter = tokens.begin();                          //what word we are on, starts at first word
413                        /*
414                        if (!AEInstallVersion.compare(*iter))
415                        If mod is too old, skip this mod.
416                        */
417                        /*else*/if (!NameOfMod.compare(*iter))  {       //if it contains the name
418                                for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment
419                                        if (ARROW.compare(*iter) && NameOfMod.compare(*iter)) {                 //ignores "->" and "NameOfMod"
420                                                //cout << *iter;
421                                                //cout << " ";
422                                                package.name += *iter + " ";
423                                        }
424                                }
425
426                        }
427                        else if (!ModString.compare(*iter)) {
428                                iter++; iter++;
429                                package.modStringName = *iter;
430                                iter++;
431                                package.modStringVersion = atoi((*iter).c_str());
432                        }
433                        else if (!HasOnis.compare(*iter)) {
434                                iter++; iter++;  
435                                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
436                                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,
437                                        iter++; iter++;}  // using "YFR" would probably set it off. :<
438
439                                if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasBSL = 1;
440                        }
441                        else if (!HasDeltas.compare(*iter)) {
442                                iter++; iter++;  
443                                if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasDeltas = 1;
444                        }
445                        else if (!HasDats.compare(*iter)) {
446                                iter++; iter++;  
447                                if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasDats = 1;
448                        }
449                        else if (!IsEngine.compare(*iter)) {
450                                iter++; iter++;  
451                                if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.isEngine = 1;
452                        }
453                        else if (!GlobalNeeded.compare(*iter)) {
454                                iter++; iter++;  
455                                if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.globalNeeded = 1;
456                                else if (toupper((*iter)[0]) + toupper((*iter)[1]) == 'N' + 'O') package.globalNeeded = 1; //Really the only place where checking for "No" is important atm.
457                        }
458                        else if (!Category.compare(*iter))  {  
459                                for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment
460                                        if (ARROW.compare(*iter) && Category.compare(*iter)) {                  //ignores "->" and "Category"
461                                                //cout << *iter;
462                                                //cout << " ";
463                                                package.category += *iter + " ";
464                                        }
465                                }
466                        }
467                        else if (!Creator.compare(*iter))  {    //if it contains the name
468                                for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment
469                                        if (ARROW.compare(*iter) && Creator.compare(*iter)) {                   //ignores "->" and "Category"
470                                                //cout << *iter;
471                                                //cout << " ";
472                                                package.creator += *iter + " ";
473                                        }
474                                }
475                        }
476                        else if (!Readme.compare(*iter))  {     //if it contains the name
477                                for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {     //interates through the words, ends if it reaches the end of the line or a "//" comment
478                                        if (ARROW.compare(*iter) && Readme.compare(*iter)) {                    //ignores "->" and "Category"
479                                                if(!(*iter).compare("\\n")) package.readme += '\n';
480                                                else package.readme += *iter + " ";
481                                        }
482                                }
483                        }
484                }
485
486        }
487        package.doOutput();
488        return package;
489 }
490
491 void recompileAll(vector<string> installedMods)
492 {
493        using namespace boost::gregorian;
494        using namespace boost::posix_time;
495        
496        setStatusArea("Importing levels...");
497        //setStatusArea("Recompiling Data...");
498        path vanilla_dir = "./packages/VanillaDats/";
499        string importCommand = "";
500        char statusString[128];
501        int numberOfDats = 0;
502        int j = 1;
503        string datString;
504        std::stringstream out;
505
506        ptime start_time(second_clock::local_time());
507        clearOldDats();
508        remove("Install.log");
509        ofstream logfile("Install.log");
510        logfile << "Mod Installation started " << to_simple_string(start_time) << endl;
511        logfile.close();
512        if(splitInstances == SPLIT){
513                recursive_directory_iterator end_iter;
514
515                for ( recursive_directory_iterator dir_itr( vanilla_dir );
516                        dir_itr != end_iter;
517                        ++dir_itr )
518                {
519                        try{
520                                if ( is_directory( dir_itr->status() ) &&  dir_itr.level() == 1)
521                                {
522                                        numberOfDats++;
523                                }
524                        }
525                        catch(exception ex) {
526
527                        }
528                }
529
530                //recursive_directory_iterator end_iter;
531
532
533                out << numberOfDats;
534                datString = out.str();
535                try {
536                        for ( recursive_directory_iterator dir_itr( vanilla_dir );
537                                dir_itr != end_iter;
538                                ++dir_itr )
539                        {
540                                try
541                                {
542                                        if ( is_directory( dir_itr->status() ) &&  dir_itr.level() == 1)
543                                        {
544                                                importCommand = strOniSplit + " " + strImportOption + " " + dir_itr->path().parent_path().string() + '/' + dir_itr->path().filename();
545                                                for (int i = 0; i < installedMods.size(); ++i) {
546                                                        if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename()  ))
547                                                                importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename();
548
549                                                        //else cout << " packages/VanillaDats/" + installedMods[i] + "/oni/";
550                                                }
551                                                importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log";
552
553                                                printf(statusString,"%d/%i\0",j,numberOfDats);  
554                                                setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats
555                                                setStatusArea("Importing " +  dir_itr->path().filename() + " " + statusString);
556
557                                                system(importCommand.c_str());
558                                                //Sleep(1000);
559                                                //cout << importCommand << "\n";
560                                                j++;
561
562                                        }
563                                }
564                                catch ( const std::exception & ex )
565                                {
566                                        
567        remove("Install.log");
568        ofstream logfile("Install.log");
569        
570        
571                                        logfile << "Warning, exception " << ex.what() << "!";
572                                        setStatusArea("Warning, exception " + (string)ex.what() + "!");
573 logfile.close();        
574                                }
575                        }
576
577                }
578                catch( const std::exception & ex ) {
579        
580        remove("Install.log");
581        ofstream logfile("Install.log");
582        
583        
584                                        logfile << "Warning, exception " << ex.what() << "!";
585                                        setStatusArea("Warning, exception " + (string)ex.what() + "!");
586 logfile.close();
587                }
588
589        }
590        else if(splitInstances == NOT_SPLIT){
591                directory_iterator end_iter;
592
593                for ( directory_iterator dir_itr( vanilla_dir );
594                        dir_itr != end_iter;
595                        ++dir_itr )
596                {
597
598                        if ( is_directory( dir_itr->status() ) )
599                        {
600                                numberOfDats++;
601                        }
602
603
604                }
605
606                out << numberOfDats;
607                datString = out.str();
608
609                for ( directory_iterator dir_itr( vanilla_dir );
610                        dir_itr != end_iter;
611                        ++dir_itr )
612                {
613                        try
614                        {
615                                if ( is_directory( dir_itr->status() ) )
616                                {
617                                        importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " " + "../GameDataFolder/" + dir_itr->path().filename()
618                                                + ".dat";
619                                        for (int i = 0; i < installedMods.size(); ++i) {
620                                                if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename()  ))
621                                                        importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename();
622                                        }
623                                        importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log";
624
625                                        printf(statusString,"%d/%i\0",j,numberOfDats);  
626                                        setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats
627                                        setStatusArea("Importing " +  dir_itr->path().filename() + " " + statusString);
628
629                                        system(importCommand.c_str());
630
631                                        j++;
632                                }
633                        }
634                        catch ( const std::exception & ex )
635                        {
636        
637        remove("Install.log");
638        ofstream logfile("Install.log");
639        
640        
641                                        logfile << "Warning, exception " << ex.what() << "!";
642                                        setStatusArea("Warning, exception " + (string)ex.what() + "!");
643 logfile.close();
644                        }}
645        }
646        logfile << "Writing config file";
647        writeInstalledMods(installedMods);
648        setProgressBar(1000);
649        setStatusArea("Done! You can now play Oni.");
650        
651                ptime end_time(second_clock::local_time());
652                time_period total_time (start_time, end_time);
653                        
654        
655                ofstream logfile2("Install.log", ios::app | ios::ate);
656                string outstring = (string)"\n\nGlobalization ended " + to_simple_string(end_time) + "\nThe process took ";// + (string)total_time.length();
657                
658                logfile2 << "\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length();
659                
660                //logfile2.write(outstring.c_str(), outstring.length());
661 logfile2.close();
662
663                //total_time.length().hours();
664        
665        Sleep(1000);
666        setProgressBar(0);
667 }
668
669 void writeInstalledMods(vector<string> installedMods)
670 {
671
672        if ( exists( strInstallCfg ) )
673        {
674                remove( strInstallCfg );
675        }
676
677        ofstream file(strInstallCfg.c_str());
678
679        vector<string>list = installedMods;
680        vector<string>::iterator begin_iter = list.begin();
681        vector<string>::iterator end_iter = list.end();
682
683        sort( list.begin(), list.end() );
684
685        for( ; begin_iter != end_iter; ++begin_iter) {
686                file << *begin_iter << " ";
687        }
688
689        file.close();
690        file.clear();
691
692 }
693
694 vector<string> getInstallString(string Cfg)
695 {
696        //system(strPauseCmd);
697        vector<string> returnval;
698
699        string line;
700        fstream file;
701
702        if (exists( Cfg ))
703        {
704                file.open(Cfg.c_str());
705                getline(file, line);
706                tokenize(line, returnval);
707                file.close();
708                file.clear();
709                sort(returnval.begin(), returnval.end());
710        }
711        else cout << "fail";
712
713        return returnval;
714 }
715
716 //stolen token function...
717 void tokenize(const string& str, vector<string>& tokens, const string& delimiters)
718 {
719        // Skip delimiters at beginning.
720        string::size_type lastPos = str.find_first_not_of(delimiters, 0);
721        // Find first "non-delimiter".
722        string::size_type pos     = str.find_first_of(delimiters, lastPos);
723
724        while (string::npos != pos || string::npos != lastPos)
725        {
726                // Found a token, add it to the vector.
727                tokens.push_back(str.substr(lastPos, pos - lastPos));
728                // Skip delimiters.  Note the "not_of"
729                lastPos = str.find_first_not_of(delimiters, pos);
730                // Find next "non-delimiter"
731                pos = str.find_first_of(delimiters, lastPos);
732        }
733 }
734
735 void clearOldDats(void) {
736        directory_iterator end_iter_gdf;
737        for ( directory_iterator dir_itr_gdf( "../GameDataFolder" );
738                dir_itr_gdf != end_iter_gdf;
739                ++dir_itr_gdf )
740        {
741                //cout << dir_itr_gdf->path().extension() << "\n";
742                if ( dir_itr_gdf->path().extension() == ".dat" || dir_itr_gdf->path().extension() == ".raw" || dir_itr_gdf->path().extension() == ".sep" ) {
743                        remove( dir_itr_gdf->path() );
744                }
745
746        }
747
748 }
749
750 vector<string> globalInstalledMods;
751 vector<ModPackage> globalPackages;
752 #include "boost/thread.hpp"
20   #include <boost/thread/mutex.hpp>
754
755 /////////////////////////////////////////////////////////////////////////////
756 // Name:        main_window.cpp
757 // Purpose:    
758 // Author:      
759 // Modified by:
760 // Created:     07/05/2009 20:38:25
761 // RCS-ID:      
762 // Copyright:  
763 // Licence:    
764 /////////////////////////////////////////////////////////////////////////////
765
21   // For compilers that support precompilation, includes "wx/wx.h".
22   #include "wx/wxprec.h"
23  
# Line 775 | Line 30 | vector<ModPackage> globalPackages;
30   #endif
31  
32   ////@begin includes
33 < #include "about_window.h"
779 < ////@end includes
780 <
33 > #include "about.h"
34   #include "main_window.h"
35 + #include "installer.h"
36 + ////@end includes
37  
38   ////@begin XPM images
39 < #include "redo.xpm"
39 > #include "aelogosmall.xpm"
40 > #include "undo.xpm"
41   #include "fileopen.xpm"
42   #include "filesaveas.xpm"
43   #include "quit.xpm"
44   ////@end XPM images
45  
46 < //#define wxDebug 1;
47 < //#define wxUSE_UNICODE 1;
46 > bool busy = false;
47 > int updateStatus;
48 > bool installerJustUpdated = false;
49 > vector<string> globalInstalledMods;
50 > vector<ModPackage> globalPackages;
51 > // Variable declarations
52 > #ifdef WIN32
53 > bool splitInstances = true;
54 > string strImportOption = "-import:nosep";
55 > string strOniSplit = "Onisplit.exe";
56 > #else
57 > bool splitInstances = false;
58 > string strImportOption = "-import:sep";
59 > string strOniSplit = "mono Onisplit.exe";
60 > #endif
61  
62   /*
63   * MainWindow type definition
# Line 804 | Line 73 | IMPLEMENT_CLASS( MainWindow, wxFrame )
73   BEGIN_EVENT_TABLE( MainWindow, wxFrame )
74  
75   ////@begin MainWindow event table entries
76 < EVT_CHECKBOX( SelectAll_Checkbox, MainWindow::OnSelectAllCheckboxClick )
76 >    EVT_CHECKBOX( SelectAll_Checkbox, MainWindow::OnSelectAllCheckboxClick )
77  
78 < EVT_BUTTON( Refresh_Button, MainWindow::OnRefreshButtonClick )
78 >    EVT_BUTTON( Refresh_Button, MainWindow::OnRefreshButtonClick )
79  
80 < EVT_LISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Selected )
81 < EVT_CHECKLISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Toggled )
80 >    EVT_LISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Selected )
81 >    EVT_CHECKLISTBOX( Mods_CheckboxList1, MainWindow::OnModsCheckboxList1Toggled )
82  
83 < EVT_UPDATE_UI( ID_STATUSBAR, MainWindow::OnStatusbarUpdate )
83 >    EVT_UPDATE_UI( ID_STATUSBAR, MainWindow::OnStatusbarUpdate )
84  
85 < EVT_BUTTON( Install_Button, MainWindow::OnInstallButtonClick )
85 >    EVT_BUTTON( Install_Button, MainWindow::OnInstallButtonClick )
86  
87 < EVT_RADIOBUTTON( Sep_RadioButton, MainWindow::OnSepRadioButtonSelected )
87 >    EVT_RADIOBUTTON( Sep_RadioButton, MainWindow::OnSepRadioButtonSelected )
88  
89 < EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected )
89 >    EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected )
90  
91 < EVT_RADIOBUTTON( Separated_RadioButton, MainWindow::OnSeparatedRadioButtonSelected )
91 >    EVT_RADIOBUTTON( Seperated_RadioButton, MainWindow::OnSeperatedRadioButtonSelected )
92  
93 < EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected )
93 >    EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected )
94  
95 < EVT_BUTTON( ReGlobalize_Button, MainWindow::OnReGlobalizeButtonClick )
95 >    EVT_BUTTON( ReGlobalize_Button, MainWindow::OnReGlobalizeButtonClick )
96  
97 < EVT_MENU( wxID_LOAD, MainWindow::OnLoadClick )
97 >    EVT_MENU( wxID_LOAD, MainWindow::OnLoadClick )
98  
99 < EVT_MENU( wxID_SAVE, MainWindow::OnSaveClick )
99 >    EVT_MENU( wxID_SAVE, MainWindow::OnSaveClick )
100  
101 < EVT_MENU( wxID_EXIT, MainWindow::OnExitClick )
101 >    EVT_MENU( wxID_EXIT, MainWindow::OnExitClick )
102  
103 < EVT_MENU( wxID_OPTIONS, MainWindow::OnOptionsClick )
103 >    EVT_MENU( wxID_OPTIONS, MainWindow::OnOptionsClick )
104  
105 < EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick )
105 >    EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick )
106  
107   ////@end MainWindow event table entries
108  
# Line 863 | Line 132 | MainWindow::MainWindow( wxWindow* parent
132   bool MainWindow::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
133   {
134          ////@begin MainWindow creation
135 <        wxFrame::Create( parent, id, caption, pos, size, style );
135 >    wxFrame::Create( parent, id, caption, pos, size, style );
136  
137 <        CreateControls();
138 <        SetIcon(GetIconResource(wxT("oni_special.ico")));
139 <        Centre();
871 <        
872 <        
137 >    CreateControls();
138 >    SetIcon(GetIconResource(wxT("aelogosmall.png")));
139 >    Centre();
140          ////@end MainWindow creation
141          return true;
142   }
143  
877
144   /*
145   * MainWindow destructor
146   */
# Line 885 | Line 151 | MainWindow::~MainWindow()
151          ////@end MainWindow destruction
152   }
153  
888
154   /*
155   * Member initialisation
156   */
# Line 893 | Line 158 | MainWindow::~MainWindow()
158   void MainWindow::Init()
159   {
160          ////@begin MainWindow member initialisation
161 <        MainSplitter = NULL;
162 <        SelectAll = NULL;
163 <        RefreshButton = NULL;
164 <        Mods_CheckboxList = NULL;
165 <        titleText = NULL;
166 <        creatorText = NULL;
167 <        descriptionText = NULL;
168 <        StatusArea = NULL;
169 <        ProgressBar = NULL;
170 <        InstallButton = NULL;
171 <        OptionsPanel = NULL;
172 <        SepRadio = NULL;
173 <        NoSepRadio = NULL;
174 <        SeparatedRadio = NULL;
175 <        CompleteRadio = NULL;
176 <        ReglobalizeButton = NULL;
161 >    MainSplitter = NULL;
162 >    SelectAll = NULL;
163 >    RefreshButton = NULL;
164 >    Mods_CheckboxList = NULL;
165 >    titleText = NULL;
166 >    creatorText = NULL;
167 >    descriptionText = NULL;
168 >    StatusArea = NULL;
169 >    ProgressBar = NULL;
170 >    InstallButton = NULL;
171 >    OptionsPanel = NULL;
172 >    SepRadio = NULL;
173 >    NoSepRadio = NULL;
174 >    SeperatedRadio = NULL;
175 >    CompleteRadio = NULL;
176 >    ReglobalizeButton = NULL;
177          ////@end MainWindow member initialisation
913
178   }
179  
916
180   /*
181   * Control creation for MainWindow
182   */
# Line 923 | Line 186 | wxGauge* TheProgressBar;
186   void MainWindow::CreateControls()
187   {    
188          ////@begin MainWindow content construction
189 <        // Generated by DialogBlocks, 31/05/2009 19:03:55 (unregistered)
927 <
928 <        MainWindow* itemFrame1 = this;
189 >    MainWindow* itemFrame1 = this;
190  
191 <        wxMenuBar* menuBar = new wxMenuBar;
192 <        wxMenu* itemMenu37 = new wxMenu;
193 <        {
194 <                wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_LOAD, _("&Load Configuration..."), wxEmptyString, wxITEM_NORMAL);
195 <                wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("fileopen.xpm")));
196 <                menuItem->SetBitmap(bitmap);
197 <                itemMenu37->Append(menuItem);
198 <        }
199 <        {
200 <                wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_SAVE, _("&Save Configuration..."), wxEmptyString, wxITEM_NORMAL);
201 <                wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("filesaveas.xpm")));
202 <                menuItem->SetBitmap(bitmap);
203 <                itemMenu37->Append(menuItem);
204 <        }
205 <        itemMenu37->AppendSeparator();
206 <        {
207 <                wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL);
208 <                wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("quit.xpm")));
209 <                menuItem->SetBitmap(bitmap);
210 <                itemMenu37->Append(menuItem);
211 <        }
212 <        menuBar->Append(itemMenu37, _("&File"));
213 <        wxMenu* itemMenu42 = new wxMenu;
214 <        itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK);
215 <        menuBar->Append(itemMenu42, _("Options"));
216 <        wxMenu* itemMenu44 = new wxMenu;
217 <        itemMenu44->Append(wxID_HELP, _("Help"), wxEmptyString, wxITEM_NORMAL);
218 <        itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
219 <        menuBar->Append(itemMenu44, _("Help"));
220 <        itemFrame1->SetMenuBar(menuBar);
221 <
222 <        wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
223 <        itemFrame1->SetSizer(itemBoxSizer2);
224 <
225 <        MainSplitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_LIVE_UPDATE|wxNO_BORDER );
226 <        MainSplitter->SetMinimumPaneSize(150);
227 <        MainSplitter->SetName(_T("MainSplitter"));
228 <
229 <        wxPanel* itemPanel4 = new wxPanel( MainSplitter, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
230 <        wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
231 <        itemPanel4->SetSizer(itemBoxSizer5);
232 <
233 <        wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
234 <        itemBoxSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0);
235 <        SelectAll = new wxCheckBox( itemPanel4, SelectAll_Checkbox, _("Select All/None"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
236 <        SelectAll->SetValue(false);
237 <        SelectAll->SetName(_T("SelectAll_Checkbox"));
238 <        itemBoxSizer6->Add(SelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
239 <
240 <        RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("redo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
241 <        RefreshButton->SetName(_T("RefreshButton"));
242 <        itemBoxSizer6->Add(RefreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
243 <
244 <        wxArrayString Mods_CheckboxListStrings;
245 <        Mods_CheckboxList = new wxCheckListBox( itemPanel4, Mods_CheckboxList1, wxDefaultPosition, wxDefaultSize, Mods_CheckboxListStrings, wxLB_HSCROLL );
246 <        Mods_CheckboxList->SetName(_T("Mods_CheckboxList"));
247 <        itemBoxSizer5->Add(Mods_CheckboxList, 1, wxGROW|wxALL, 0);
248 <
249 <        wxPanel* itemPanel10 = new wxPanel( MainSplitter, DescriptionHolder_Panel, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
250 <        itemPanel10->SetName(_T("DescriptionHolder_Panel"));
251 <        wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
252 <        itemPanel10->SetSizer(itemBoxSizer11);
253 <
254 <        wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
255 <        itemBoxSizer11->Add(itemBoxSizer12, 0, wxGROW|wxALL, 0);
256 <        wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL);
257 <        itemBoxSizer12->Add(itemBoxSizer13, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0);
258 <        titleText = new wxTextCtrl( itemPanel10, Title_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
259 <        titleText->SetName(_T("Title_Text"));
260 <        titleText->SetBackgroundColour(wxColour(240, 240, 240));
261 <        itemBoxSizer13->Add(titleText, 1, wxGROW|wxLEFT, 5);
262 <
263 <        wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL);
264 <        itemBoxSizer12->Add(itemBoxSizer15, 1, wxGROW|wxALL, 0);
265 <        creatorText = new wxTextCtrl( itemPanel10, Author_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RIGHT );
266 <        creatorText->SetName(_T("Author_Text"));
267 <        creatorText->SetBackgroundColour(wxColour(240, 240, 240));
268 <        itemBoxSizer15->Add(creatorText, 1, wxGROW|wxRIGHT, 5);
269 <
270 <        wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
271 <        itemStaticLine17->Show(false);
272 <        itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5);
273 <
274 <        descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_AUTO_URL );
275 <        descriptionText->SetName(_T("DescriptionName"));
276 <        descriptionText->SetBackgroundColour(wxColour(240, 240, 240));
277 <        itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5);
278 <
279 <        MainSplitter->SplitVertically(itemPanel4, itemPanel10, 150);
280 <        itemBoxSizer2->Add(MainSplitter, 1, wxGROW|wxALL, 0);
281 <
282 <        StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 );
283 <        StatusArea->SetName(_T("StatusArea"));
284 <        StatusArea->SetFieldsCount(1);
285 <        StatusArea->SetStatusText(_("Status Area"), 0);
286 <        itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0);
287 <
288 <        wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
289 <        itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0);
290 <
291 <        ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxSize(-1, 30), wxGA_SMOOTH );
292 <        ProgressBar->SetValue(0);
293 <        itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0);
294 <
295 <        InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxSize(-1, 30), 0 );
296 <        itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0);
297 <
298 <        wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL);
299 <        itemBoxSizer2->Add(itemBoxSizer23, 0, wxGROW|wxALL, 0);
300 <
301 <        OptionsPanel = new wxPanel( itemFrame1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
302 <        itemBoxSizer2->Add(OptionsPanel, 0, wxGROW, 0);
303 <
304 <        wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL);
305 <        OptionsPanel->SetSizer(itemBoxSizer25);
306 <
307 <        wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL);
308 <        itemBoxSizer25->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5);
309 <
310 <        SepRadio = new wxRadioButton( OptionsPanel, Sep_RadioButton, _("Sep"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
311 <        SepRadio->SetValue(false);
312 <        if (MainWindow::ShowToolTips())
313 <                SepRadio->SetToolTip(_("For PC Demo and Mac"));
314 <        itemBoxSizer26->Add(SepRadio, 0, wxALIGN_LEFT|wxALL, 5);
315 <
316 <        NoSepRadio = new wxRadioButton( OptionsPanel, NoSep_RadioButton, _("NoSep"), wxDefaultPosition, wxDefaultSize, 0 );
317 <        NoSepRadio->SetValue(false);
318 <        if (MainWindow::ShowToolTips())
319 <                NoSepRadio->SetToolTip(_("For PC Retail"));
320 <        itemBoxSizer26->Add(NoSepRadio, 0, wxALIGN_LEFT|wxALL, 5);
321 <
322 <        wxStaticLine* itemStaticLine29 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
323 <        itemBoxSizer25->Add(itemStaticLine29, 0, wxGROW|wxALL, 5);
324 <
325 <        wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL);
326 <        itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5);
327 <
328 <        SeparatedRadio = new wxRadioButton( OptionsPanel, Separated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
329 <        SeparatedRadio->SetValue(false);
330 <        SeparatedRadio->SetName(_T("Separated_RadioButton"));
331 <        itemBoxSizer30->Add(SeparatedRadio, 0, wxALIGN_LEFT|wxALL, 5);
332 <
333 <        CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 );
334 <        CompleteRadio->SetValue(false);
335 <        CompleteRadio->SetName(_T("Complete_RadioButton"));
336 <        itemBoxSizer30->Add(CompleteRadio, 0, wxALIGN_LEFT|wxALL, 5);
337 <
338 <        wxStaticLine* itemStaticLine33 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
339 <        itemBoxSizer25->Add(itemStaticLine33, 0, wxGROW|wxALL, 5);
340 <
341 <        wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL);
342 <        itemBoxSizer25->Add(itemBoxSizer34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
343 <
344 <        ReglobalizeButton = new wxButton( OptionsPanel, ReGlobalize_Button, _("Reglobalize"), wxDefaultPosition, wxDefaultSize, 0 );
345 <        ReglobalizeButton->SetName(_T("Reglobalize_Button"));
346 <        itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5);
191 >    wxMenuBar* menuBar = new wxMenuBar;
192 >    wxMenu* itemMenu37 = new wxMenu;
193 >    {
194 >        wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_LOAD, _("&Load Configuration..."), wxEmptyString, wxITEM_NORMAL);
195 >        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("fileopen.xpm")));
196 >        menuItem->SetBitmap(bitmap);
197 >        itemMenu37->Append(menuItem);
198 >    }
199 >    {
200 >        wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_SAVE, _("&Save Configuration..."), wxEmptyString, wxITEM_NORMAL);
201 >        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("filesaveas.xpm")));
202 >        menuItem->SetBitmap(bitmap);
203 >        itemMenu37->Append(menuItem);
204 >    }
205 >    itemMenu37->AppendSeparator();
206 >    {
207 >        wxMenuItem* menuItem = new wxMenuItem(itemMenu37, wxID_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL);
208 >        wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("quit.xpm")));
209 >        menuItem->SetBitmap(bitmap);
210 >        itemMenu37->Append(menuItem);
211 >    }
212 >    menuBar->Append(itemMenu37, _("&File"));
213 >    wxMenu* itemMenu42 = new wxMenu;
214 >    itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK);
215 >    menuBar->Append(itemMenu42, _("Options"));
216 > //#ifdef WIN32
217 > //      itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
218 > //      menuBar->Append(itemMenu44, _("Help"));
219 > //#else
220 >        itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL);
221 > //#endif        
222 >
223 >    itemFrame1->SetMenuBar(menuBar);
224 >
225 >    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
226 >    itemFrame1->SetSizer(itemBoxSizer2);
227 >
228 >    MainSplitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_LIVE_UPDATE|wxNO_BORDER );
229 >    MainSplitter->SetMinimumPaneSize(1);
230 >    MainSplitter->SetName(_T("MainSplitter"));
231 >
232 >    wxPanel* itemPanel4 = new wxPanel( MainSplitter, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
233 >    wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
234 >    itemPanel4->SetSizer(itemBoxSizer5);
235 >
236 >    wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
237 >    itemBoxSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0);
238 >    SelectAll = new wxCheckBox( itemPanel4, SelectAll_Checkbox, _("Select All/None"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE );
239 >    SelectAll->SetValue(false);
240 >    SelectAll->SetName(_T("SelectAll_Checkbox"));
241 >    itemBoxSizer6->Add(SelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
242 >
243 >    RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("undo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
244 >    RefreshButton->SetName(_T("RefreshButton"));
245 >    itemBoxSizer6->Add(RefreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
246 >
247 >    wxArrayString Mods_CheckboxListStrings;
248 >    Mods_CheckboxList = new wxCheckListBox( itemPanel4, Mods_CheckboxList1, wxDefaultPosition, wxDefaultSize, Mods_CheckboxListStrings, wxLB_HSCROLL );
249 >    Mods_CheckboxList->SetName(_T("Mods_CheckboxList"));
250 >    itemBoxSizer5->Add(Mods_CheckboxList, 1, wxGROW|wxALL, 0);
251 >
252 >    wxPanel* itemPanel10 = new wxPanel( MainSplitter, DescriptionHolder_Panel, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
253 >    itemPanel10->SetName(_T("DescriptionHolder_Panel"));
254 >    wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
255 >    itemPanel10->SetSizer(itemBoxSizer11);
256 >
257 >    wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
258 >    itemBoxSizer11->Add(itemBoxSizer12, 0, wxGROW|wxALL, 0);
259 >    wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL);
260 >    itemBoxSizer12->Add(itemBoxSizer13, 1, wxALIGN_CENTER_VERTICAL|wxALL, 0);
261 >    titleText = new wxTextCtrl( itemPanel10, Title_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
262 >    titleText->SetName(_T("Title_Text"));
263 >    titleText->SetBackgroundColour(wxColour(240, 240, 240));
264 >    itemBoxSizer13->Add(titleText, 1, wxGROW|wxLEFT, 5);
265 >
266 >    wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL);
267 >    itemBoxSizer12->Add(itemBoxSizer15, 1, wxGROW|wxALL, 0);
268 >    creatorText = new wxTextCtrl( itemPanel10, Author_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RIGHT );
269 >    creatorText->SetName(_T("Author_Text"));
270 >    creatorText->SetBackgroundColour(wxColour(240, 240, 240));
271 >    itemBoxSizer15->Add(creatorText, 1, wxGROW|wxRIGHT, 5);
272 >
273 >    wxStaticLine* itemStaticLine17 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
274 >    itemStaticLine17->Show(false);
275 >    itemBoxSizer11->Add(itemStaticLine17, 0, wxGROW|wxALL, 5);
276 >
277 >    descriptionText = new wxTextCtrl( itemPanel10, Description_Text, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxTE_RICH2 );
278 >    descriptionText->SetName(_T("DescriptionName"));
279 >    descriptionText->SetBackgroundColour(wxColour(240, 240, 240));
280 >    itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5);
281 >
282 >    MainSplitter->SplitVertically(itemPanel4, itemPanel10, 200);
283 >    itemBoxSizer2->Add(MainSplitter, 1, wxGROW|wxALL, 0);
284 >
285 >    StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 );
286 >    StatusArea->SetName(_T("StatusArea"));
287 >    StatusArea->SetFieldsCount(1);
288 >        string versionText = "AE Installer v" + (string)INSTALLER_VERSION;
289 >    StatusArea->SetStatusText(versionText.c_str(), 0);
290 >    itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0);
291 >
292 >    wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
293 >    itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 0);
294 >
295 >    ProgressBar = new wxGauge( itemFrame1, ProgressBar_Gauge, 1000, wxDefaultPosition, wxDefaultSize, wxGA_SMOOTH );
296 >    ProgressBar->SetValue(0);
297 >    itemBoxSizer20->Add(ProgressBar, 1, wxGROW|wxALL, 0);
298 >
299 >    InstallButton = new wxButton( itemFrame1, Install_Button, _("Install!"), wxDefaultPosition, wxDefaultSize, 0 );
300 >    itemBoxSizer20->Add(InstallButton, 0, wxGROW|wxALL, 0);
301 >
302 >    wxBoxSizer* itemBoxSizer23 = new wxBoxSizer(wxVERTICAL);
303 >    itemBoxSizer2->Add(itemBoxSizer23, 0, wxGROW|wxALL, 0);
304 >
305 >    OptionsPanel = new wxPanel( itemFrame1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
306 >    itemBoxSizer2->Add(OptionsPanel, 0, wxGROW, 0);
307 >
308 >    wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL);
309 >    OptionsPanel->SetSizer(itemBoxSizer25);
310 >
311 >    wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL);
312 >    itemBoxSizer25->Add(itemBoxSizer26, 0, wxGROW|wxALL, 5);
313 >
314 >    SepRadio = new wxRadioButton( OptionsPanel, Sep_RadioButton, _("Sep"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
315 >    SepRadio->SetValue(false);
316 >    if (MainWindow::ShowToolTips())
317 >        SepRadio->SetToolTip(_("For PC Demo and Mac"));
318 >    itemBoxSizer26->Add(SepRadio, 0, wxALIGN_LEFT|wxALL, 5);
319 >
320 >    NoSepRadio = new wxRadioButton( OptionsPanel, NoSep_RadioButton, _("NoSep"), wxDefaultPosition, wxDefaultSize, 0 );
321 >    NoSepRadio->SetValue(false);
322 >    if (MainWindow::ShowToolTips())
323 >        NoSepRadio->SetToolTip(_("For PC Retail"));
324 >    itemBoxSizer26->Add(NoSepRadio, 0, wxALIGN_LEFT|wxALL, 5);
325 >
326 >    wxStaticLine* itemStaticLine29 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
327 >    itemBoxSizer25->Add(itemStaticLine29, 0, wxGROW|wxALL, 5);
328 >
329 >    wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL);
330 >    itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5);
331 >
332 >    SeperatedRadio = new wxRadioButton( OptionsPanel, Seperated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
333 >    SeperatedRadio->SetValue(false);
334 >    SeperatedRadio->SetName(_T("Seperated_RadioButton"));
335 >    itemBoxSizer30->Add(SeperatedRadio, 0, wxALIGN_LEFT|wxALL, 5);
336 >
337 >    CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 );
338 >    CompleteRadio->SetValue(false);
339 >    CompleteRadio->SetName(_T("Complete_RadioButton"));
340 >    itemBoxSizer30->Add(CompleteRadio, 0, wxALIGN_LEFT|wxALL, 5);
341 >
342 >    wxStaticLine* itemStaticLine33 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
343 >    itemBoxSizer25->Add(itemStaticLine33, 0, wxGROW|wxALL, 5);
344 >
345 >    wxBoxSizer* itemBoxSizer34 = new wxBoxSizer(wxVERTICAL);
346 >    itemBoxSizer25->Add(itemBoxSizer34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
347 >
348 >    ReglobalizeButton = new wxButton( OptionsPanel, ReGlobalize_Button, _("Reglobalize"), wxDefaultPosition, wxDefaultSize, 0 );
349 >    ReglobalizeButton->SetName(_T("Reglobalize_Button"));
350 >    itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5);
351  
352 <        // Connect events and objects
353 <        Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this);
352 >    // Connect events and objects
353 >    Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this);
354          ////@end MainWindow content construction
355 + #ifdef WIN32
356 +        Handle = (HWND)GetHWND();
357 +        ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList);
358 + #endif
359  
360 <        if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) {
361 <                static_cast<string>("-import:sep");
1093 <                splitInstances = NOT_SPLIT;
1094 <        }
1095 <        else {
1096 <                static_cast<string>("-import:nosep");
1097 <                splitInstances = SPLIT;
1098 <        }
1099 <
360 >        updateStatus = GetUpdateStatus(&currentAE, &updateAE, &installerJustUpdated);
361 >        
362          globalPackages = getPackages();
363          globalInstalledMods = getInstallString();
364 <        for (int i = 0; i < globalPackages.size(); i++) {
364 >        for (unsigned int i = 0; i < globalPackages.size(); i++)
365 >        {
366                  Mods_CheckboxList->Append(globalPackages[i].name.c_str());
367 <                if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i);
367 >                if (binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName)) Mods_CheckboxList->Check(i);
368          }
369  
370          TheStatusBar = &StatusArea;
371          TheInstallButton = InstallButton;
372          TheProgressBar = ProgressBar;
373          OptionsPanel->Hide();
374 <        if(splitInstances == SPLIT) SeparatedRadio->SetValue(true);
374 >        
375 >        if(splitInstances) SeperatedRadio->SetValue(true);
376          else CompleteRadio->SetValue(true);
1113
1114
1115
377          if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true);
378          else SepRadio->SetValue(true);
379 <        
1119 <        
379 >
380   #ifdef WIN32
381          RedirectIOToConsole();
382          HWND hWnd = GetConsoleWindow();
383          ShowWindow( hWnd, SW_HIDE );
384   #endif
1125        
1126                //MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight() );
385   }
386  
1129
387   /*
388   * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for SelectAll_Checkbox
389   */
# Line 1135 | Line 392 | void MainWindow::OnSelectAllCheckboxClic
392   {
393          switch(SelectAll->Get3StateValue()) {
394          case wxCHK_UNCHECKED:
395 <                for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
1139 <                //SelectAll->Set3StateValue(wxCHK_CHECKED);
395 >                for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
396                  break;
397          case wxCHK_CHECKED:
398 <                for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true);
1143 <                //SelectAll->Set3StateValue(wxCHK_UNCHECKED);
398 >                for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true);
399                  break;
400          case wxCHK_UNDETERMINED:
401 <                for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
1147 <                //SelectAll->Set3StateValue(wxCHK_CHECKED);
401 >                for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
402                  break;
1149
403          }
1151
404   }
405  
1154
406   /*
407   * wxEVT_CREATE event handler for Mods_CheckboxList
408   */
# Line 1159 | Line 410 | void MainWindow::OnSelectAllCheckboxClic
410   void MainWindow::ModList_OnCreate( wxWindowCreateEvent& event )
411   {
412  
1162
413   }
414  
415  
# Line 1180 | Line 430 | wxBitmap MainWindow::GetBitmapResource(
430   {
431          // Bitmap retrieval
432          ////@begin MainWindow bitmap retrieval
433 <        wxUnusedVar(name);
434 <        if (name == _T("redo.xpm"))
435 <        {
436 <                wxBitmap bitmap(redo_xpm);
437 <                return bitmap;
438 <        }
439 <        else if (name == _T("fileopen.xpm"))
440 <        {
441 <                wxBitmap bitmap( fileopen_xpm);
442 <                return bitmap;
443 <        }
444 <        else if (name == _T("filesaveas.xpm"))
445 <        {
446 <                wxBitmap bitmap( filesaveas_xpm);
447 <                return bitmap;
448 <        }
449 <        else if (name == _T("quit.xpm"))
450 <        {
451 <                wxBitmap bitmap( quit_xpm);
452 <                return bitmap;
453 <        }
454 <        return wxNullBitmap;
433 >    wxUnusedVar(name);
434 >    if (name == _T("undo.xpm"))
435 >    {
436 >        wxBitmap bitmap( undo_xpm);
437 >        return bitmap;
438 >    }
439 >    else if (name == _T("fileopen.xpm"))
440 >    {
441 >        wxBitmap bitmap( fileopen_xpm);
442 >        return bitmap;
443 >    }
444 >    else if (name == _T("filesaveas.xpm"))
445 >    {
446 >        wxBitmap bitmap( filesaveas_xpm);
447 >        return bitmap;
448 >    }
449 >    else if (name == _T("quit.xpm"))
450 >    {
451 >        wxBitmap bitmap( quit_xpm);
452 >        return bitmap;
453 >    }
454 >    return wxNullBitmap;
455          ////@end MainWindow bitmap retrieval
456   }
457  
# Line 1211 | Line 461 | wxBitmap MainWindow::GetBitmapResource(
461  
462   wxIcon MainWindow::GetIconResource( const wxString& name )
463   {
1214
464          // Icon retrieval
465          ////@begin MainWindow icon retrieval
466 <        wxUnusedVar(name);
467 <        if (name == _T("oni_special.ico"))
468 <        {
469 <        //      wxIcon icon(_T("oni_special.ico"), wxBITMAP_TYPE_ICO);
470 <        //      return icon;
471 <        }
472 <        return wxNullIcon;
466 >    wxUnusedVar(name);
467 >    if (name == _T("aelogosmall.png"))
468 >    {
469 >        wxIcon icon(aelogosmall_xpm);
470 >        return icon;
471 >    }
472 >    return wxNullIcon;
473          ////@end MainWindow icon retrieval
474   }
475  
1227
476   /*
477   * wxEVT_COMMAND_LISTBOX_SELECTED event handler for Mods_CheckboxList1
478   */
479  
480   void MainWindow::OnModsCheckboxList1Selected( wxCommandEvent& event )
481   {
1234        //event.GetSelection
482          titleText->SetValue(globalPackages[event.GetSelection()].name.c_str());
483          creatorText->SetValue(globalPackages[event.GetSelection()].creator.c_str());
484          descriptionText->SetValue(globalPackages[event.GetSelection()].readme.c_str());
1238
1239        //creatorText->Refresh();
485   }
486  
1242
487   /*
488   * wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event handler for Mods_CheckboxList1
489   */
# Line 1268 | Line 512 | void MainWindow::OnModsCheckboxList1Togg
512  
513   void MainWindow::OnOptionsClick( wxCommandEvent& event )
514   {
1271
1272
1273        
1274
515          if (!event.GetInt() ) {
516                  OptionsPanel->Hide();
517 <                MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());}
517 >                
518 >                this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());}
519          else {
520 <                //Uncomment this when we release, it gets annoying if you are testing globalization a lot ;)
521 <                //wxMessageDialog* YesNoDialog = new wxMessageDialog(this,                      "WARNING: These options are for advanced users only, use with caution.", "AE Installer Alert",  wxOK | wxICON_EXCLAMATION       , wxDefaultPosition);
522 <                //YesNoDialog->ShowModal();
520 >                wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.",
521 >                                                                                                                   "AE Installer Alert",  wxOK | wxICON_EXCLAMATION     , wxDefaultPosition);
522 >                YesNoDialog->ShowModal();
523                  OptionsPanel->Show();
524 <                MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight());
524 >                this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()+1);
525 >                this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-1);
526          }
527   }
528  
1287
529   /*
530   * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT
531   */
# Line 1294 | Line 535 | void MainWindow::OnExitClick( wxCommandE
535          exit(0);
536   }
537  
1297
538   /*
539   * wxEVT_COMMAND_BUTTON_CLICKED event handler for Install_Button
540   */
541  
1302
542   struct recompile
543   {
544          recompile(vector<string> localPackages) : thePackages(localPackages) { }
# Line 1308 | Line 547 | struct recompile
547                  TheInstallButton->Disable();
548                  recompileAll(thePackages);
549                  TheInstallButton->Enable();
550 +                
551          }
1312
552          vector<string> thePackages;
553   };
554  
555 + void globalize2(void) {
556 +                TheInstallButton->Disable();
557 +                globalizeData();
558 +                TheInstallButton->Enable();
559 + }
560 +
561   void MainWindow::OnInstallButtonClick( wxCommandEvent& event )
562   {
1318
563          vector<string> localPackages;
564 <        localPackages.push_back("Globalize");
565 <        for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName );
564 >        localPackages.push_back("00000Globalize");
565 >        for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName );
566          if ( !localPackages.empty() )   {
567 <
568 <                //MainWindow::MainWindow().Hide();      
569 <                //      boost::thread thrd2(recompileAll(localPackages) );
570 <                //MainWindow::MainWindow().Show();
567 >                sort(localPackages.begin(), localPackages.end());
568 >                localPackages[0] = "Globalize";
569 >                this->InstallButton->Disable();
570 >                this->ReglobalizeButton->Disable();
571   #ifdef WIN32
572                  recompile packages(localPackages);
573                  boost::thread thrd(packages);
574   #else
1331                this->Disable();
575                  recompileAll(localPackages);
1333                this->Enable();
576   #endif
577 <
577 >                this->InstallButton->Enable();
578 >                this->ReglobalizeButton->Enable();
579          }
1337
1338
580   }
581  
582 < /*void setStatusArea( string s ) {
583 < //TheStatusBar = MainWindow::StatusArea;
584 < (**TheStatusBar).SetStatusText(_(s.c_str()), 0);
585 <
586 < //MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1);
587 <
588 < //MainWindow::StatusBar->SetLabel("Importing Files...");
589 < //StatusBar->SetLabel(s);
590 < //->SetLabel(s);
591 <
592 < }*/
593 <
1353 < void setProgressBar( int i ) {
1354 <        //TheProgressBar->SetValue(
1355 <
582 > void setProgressBar( int i )
583 > {
584 > #ifdef WIN32
585 > if (SUCCEEDED(pTaskbarList->QueryInterface(IID_ITaskbarList3, (void **)&pTaskbarList3)))
586 > {
587 >        pTaskbarList3->SetProgressValue(Handle,i, 1000);
588 >        if ( i == 0 )
589 >        {
590 >                pTaskbarList3->SetProgressState(Handle,TBPF_NOPROGRESS);
591 >        }
592 > }
593 > #endif
594          TheProgressBar->SetValue(i);
1357
595   }
596  
1360
597   /*
598   * wxEVT_UPDATE_UI event handler for ID_STATUSBAR
599   */
# Line 1365 | Line 601 | void setProgressBar( int i ) {
601   void MainWindow::OnStatusbarUpdate( wxUpdateUIEvent& event )
602   {
603          ////@begin wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow.
604 <        // Before editing this code, remove the block markers.
605 <        event.Skip();
604 >    // Before editing this code, remove the block markers.
605 >    event.Skip();
606          ////@end wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow.
607   }
608  
1373
609   /*
610   * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT
611   */
# Line 1378 | Line 613 | void MainWindow::OnStatusbarUpdate( wxUp
613   void MainWindow::OnAboutClick( wxCommandEvent& event )
614   {
615          ////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow.
616 <        // Before editing this code, remove the block markers.
617 <        About* window = new About(this);
618 <        int returnValue = window->ShowModal();
619 <        window->Destroy();
616 >    // Before editing this code, remove the block markers.
617 >        // TODO: Make About window work again!
618 >    About* window = new About(this);
619 >    window->Destroy();
620          ////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow.
621   }
622  
1388
623   /*
624   * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton
625   */
# Line 1395 | Line 629 | void MainWindow::OnNoSepRadioButtonSelec
629          static_cast<string>("-import:nosep");
630   }
631  
1398
632   /*
633   * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Sep_RadioButton
634   */
# Line 1405 | Line 638 | void MainWindow::OnSepRadioButtonSelecte
638          static_cast<string>("-import:sep");
639   }
640  
1408
641   /*
642   * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton
643   */
644  
1413 void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event )
1414 {
1415        splitInstances = SPLIT;
1416
1417 }
1418
1419
645   /*
646   * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Complete_RadioButton
647   */
648  
649   void MainWindow::OnCompleteRadioButtonSelected( wxCommandEvent& event )
650   {
651 <        splitInstances = NOT_SPLIT;
1427 <
651 >        splitInstances = false;
652   }
653  
1430
654   /*
655   * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON
656   */
# Line 1437 | Line 660 | void MainWindow::OnRefreshButtonClick( w
660          refreshMods(globalInstalledMods);
661   }
662  
1440
663   /*
664   * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD
665   */
666  
667 <
668 <
669 <
1448 < void MainWindow::refreshMods (vector<string> s) {
1449 <
667 > // TODO: Make refreshMods actually refresh the list in the window of available mods so we can see any new package info and deleted mods are removed from the list
668 > void MainWindow::refreshMods (vector<string> s)
669 > {
670          Mods_CheckboxList->Clear();
671 <        //globalInstalledMods = getPackages();
1452 <        for (int i = 0; i < globalPackages.size(); i++) {
671 >        for (unsigned int i = 0; i < globalPackages.size(); i++) {
672                  Mods_CheckboxList->Append(globalPackages[i].name.c_str());
673 <                if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i);
674 <                //else Mods_CheckboxList->Check(i,0);
1456 <
673 >                if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) )
674 >                        Mods_CheckboxList->Check(i);
675          }
676   }
677  
678   void MainWindow::OnLoadClick( wxCommandEvent& event )
679   {
680 +        if (busy == 1) return;
681          static const wxChar *FILETYPES = _T(
682                  "Mod Loadouts (*.cfg)|*.cfg|"
683                  "All files (*.*)|*.*"
# Line 1472 | Line 691 | void MainWindow::OnLoadClick( wxCommandE
691          {
692                  refreshMods(getInstallString( string(openFileDialog->GetPath()) ));
693          }
1475
1476
694   }
695  
1479
696   /*
697   * wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE
698   */
699  
700   void MainWindow::OnSaveClick( wxCommandEvent& event )
701   {
702 +        if (busy == 1) return;
703          static const wxChar *FILETYPES = _T(
704                  "Mod Loadouts (*.cfg)|*.cfg|"
705                  "All files (*.*)|*.*"
# Line 1494 | Line 711 | void MainWindow::OnSaveClick( wxCommandE
711  
712          if ( openFileDialog->ShowModal() == wxID_OK )
713          {
1497
1498
1499                //Mods_CheckboxList->
1500
1501
1502
1503                //
1504
714                  if ( exists( openFileDialog->GetPath().c_str() ) )
715                  {
716                          remove( openFileDialog->GetPath().c_str() );
# Line 1510 | Line 719 | void MainWindow::OnSaveClick( wxCommandE
719                  ofstream file(openFileDialog->GetPath().c_str());
720  
721                  vector<string>list;
722 <                for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName );
722 >                for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName );
723                  vector<string>::iterator begin_iter = list.begin();
724                  vector<string>::iterator end_iter = list.end();
725  
# Line 1522 | Line 731 | void MainWindow::OnSaveClick( wxCommandE
731  
732                  file.close();
733                  file.clear();
1525
1526                //SetCurrentFilename(openFileDialog->GetFilename());
1527                //theText->LoadFile(openFileDialog->GetFilename());
1528                //SetStatusText(GetCurrentFilename(), 0);
1529                //SetStatusText(openFileDialog->GetDirectory(),1);
734          }
735   }
736  
1533
1534
737   /*
738   * wxEVT_COMMAND_BUTTON_CLICKED event handler for ReGlobalize_Button
739   */
740  
741   void MainWindow::OnReGlobalizeButtonClick( wxCommandEvent& event )
742   {
743 <        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);
743 >        string YesNoMsg = "WARNING: This will DELETE the Edition's GameDataFolder and recreate it from the vanilla Oni game data.\n";
744 >        YesNoMsg = YesNoMsg + "Are you SURE you want to do this?";
745 >        wxMessageDialog* YesNoDialog = new wxMessageDialog(this, YesNoMsg.c_str(), "AE Installer Alert",  wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition);
746  
747 <        if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no...
748 <                
747 >        if (YesNoDialog->ShowModal() == wxID_NO)
748 >        {
749 >                //if the user said no...
750          }
751 <        else {
752 <                
753 <        
754 <
751 >        else
752 >        {
753 >                this->InstallButton->Disable();
754 >                this->ReglobalizeButton->Disable();
755   #ifdef WIN32
756 <
757 <        boost::thread thrd2(globalizeData);
758 <        //globalizeData();
759 <        //boost::thread::create_thread(&globalizeData);
760 <        //       boost::thread_group Tg;
1556 <        // Tg.create_thread( &globalizeData(), this );
756 >                boost::thread thrd2(globalizeData);
757 >                //globalizeData();
758 >                //boost::thread::create_thread(&globalizeData);
759 >                //       boost::thread_group Tg;
760 >                // Tg.create_thread( &globalizeData(), this );
761   #else
762 <        globalizeData();
1559 <        setProgressBar(1000);
1560 <        setStatusArea("Done!");
762 >                globalizeData();
763   #endif
764 < }
765 <
764 >                this->InstallButton->Enable();
765 >                this->ReglobalizeButton->Enable();
766 >        }
767   }
768   /*
769   * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton
770   */
771  
772 < /*void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event )
773 < {
774 < ////@begin wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow.
1572 < // Before editing this code, remove the block markers.
1573 < event.Skip();
1574 < ////@end wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow.
1575 < }*/
772 > /*
773 > * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Seperated_RadioButton
774 > */
775  
776 + void MainWindow::OnSeperatedRadioButtonSelected( wxCommandEvent& event )
777 + {
778 +        splitInstances = true;
779 + }

Diff Legend

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