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

Comparing AE/Installer/trunk/source/main_window.cpp (file contents):
Revision 353 by iritscen, Sun Jun 14 23:28:58 2009 UTC vs.
Revision 355 by gumby, Thu Jun 18 22:30:30 2009 UTC

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

Diff Legend

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