| 1 |
< |
/* |
| 2 |
< |
AE/Mod Installer |
| 3 |
< |
by Gumby and Iritscen |
| 4 |
< |
*/ |
| 5 |
< |
|
| 6 |
< |
// To-do: - Load credits from text resource file |
| 7 |
< |
// - Institute lots of checks into file-handling |
| 8 |
< |
// - Clear mod info fields when mod is de-selected |
| 9 |
< |
|
| 10 |
< |
#define DEBUG |
| 11 |
< |
#include <stdio.h> |
| 12 |
< |
//#include <conio.h> |
| 13 |
< |
//#include <process.h> |
| 14 |
< |
#include <string> |
| 15 |
< |
#include <iostream> |
| 16 |
< |
#include <cctype> |
| 17 |
< |
#include <vector> |
| 18 |
< |
#include <fstream> |
| 19 |
< |
#include <errno.h> |
| 20 |
< |
#include <sstream> |
| 21 |
< |
|
| 22 |
< |
#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations |
| 23 |
< |
#include "boost/lexical_cast.hpp" //int -> string |
| 24 |
< |
#include "installer.h" |
| 1 |
> |
/***************************************************************************\ |
| 2 |
> |
| Project: AE Installer | |
| 3 |
> |
| By: Gumby & Iritscen | |
| 4 |
> |
| File: Main_Window.cpp | |
| 5 |
> |
| Function: Handles the GUI. | |
| 6 |
> |
| Created: 07/05/2009 20:38:25 | |
| 7 |
> |
\***************************************************************************/ |
| 8 |
|
|
| 9 |
< |
#ifdef WIN32 |
| 10 |
< |
#include <windows.h> |
| 28 |
< |
#else // assume we're on Mac |
| 29 |
< |
#include <stdlib.h> |
| 30 |
< |
#include <dirent.h> |
| 9 |
> |
#ifndef NTDDI_VERSION |
| 10 |
> |
#define NTDDI_VERSION NTDDI_WIN7 |
| 11 |
|
#endif |
| 32 |
– |
|
| 33 |
– |
//const string strInstallerVersion = "1.0"; |
| 34 |
– |
const bool SPLIT = 1; |
| 35 |
– |
const bool NOT_SPLIT = 0; |
| 36 |
– |
bool splitInstances = SPLIT; |
| 37 |
– |
bool busy = 0; |
| 12 |
|
#ifdef WIN32 |
| 13 |
< |
const string strOniSplit = "Onisplit.exe"; |
| 14 |
< |
string strImportOption = "-import:nosep"; |
| 15 |
< |
const char* strClsCmd = "cls"; |
| 16 |
< |
const char* strPauseCmd = "PAUSE"; |
| 17 |
< |
#else // set up Mac equivalents since we're in Mac OS |
| 44 |
< |
const string strOniSplit = "mono Onisplit.exe"; |
| 45 |
< |
string strImportOption = "-import:sep"; |
| 46 |
< |
const char* strClsCmd = "clear"; |
| 47 |
< |
const char* strPauseCmd = "read -n 1 -p \"Press any key to continue\""; |
| 48 |
< |
void Sleep(int ms) { sleep( ms / 1000 ); } |
| 49 |
< |
#endif |
| 50 |
< |
|
| 51 |
< |
using namespace boost::filesystem; |
| 52 |
< |
using namespace std; |
| 53 |
< |
|
| 54 |
< |
|
| 55 |
< |
|
| 56 |
< |
|
| 57 |
< |
#include "boost/date_time/gregorian/gregorian.hpp" |
| 58 |
< |
#include "boost/date_time/date_parsing.hpp" |
| 59 |
< |
#include "boost/date_time/posix_time/posix_time.hpp" |
| 60 |
< |
|
| 61 |
< |
int globalizeData(void) |
| 62 |
< |
{ |
| 63 |
< |
busy = 1; |
| 64 |
< |
using boost::lexical_cast; |
| 65 |
< |
using boost::bad_lexical_cast; |
| 66 |
< |
// using namespace boost::posix_time; |
| 67 |
< |
using namespace boost::gregorian; |
| 68 |
< |
using namespace boost::posix_time; |
| 69 |
< |
ptime start_time(second_clock::local_time()); |
| 70 |
< |
|
| 71 |
< |
setStatusArea("Globalizing!"); |
| 72 |
< |
int err = 0; |
| 73 |
< |
int parts_done = 0; |
| 74 |
< |
char Step_x_x[300]; |
| 75 |
< |
//char levels[i][5]; |
| 76 |
< |
remove("Globalize.log"); |
| 77 |
< |
ofstream logfile("Globalize.log"); |
| 78 |
< |
logfile << "Globalization started " << to_simple_string(start_time) << endl; |
| 79 |
< |
try { |
| 80 |
< |
|
| 81 |
< |
char levels_cstr[15][3] = {"0", "1", "2", "3", "4", "6", "8", "9", "10", "11", "12", "13", "14", "18", "19"}; // the levels Oni has...probably should have made a string array. Oops. |
| 82 |
< |
//const vector<double> ck(cv, &cv[CvSize]); |
| 83 |
< |
vector<string> levels; |
| 84 |
< |
for (int f = 0; f < 15; f++) { |
| 85 |
< |
levels.push_back(levels_cstr[f]); |
| 86 |
< |
} |
| 87 |
< |
char choice = 0; |
| 88 |
< |
|
| 89 |
< |
//SetCurrentDirectory("C:/Program Files/Oni/edition/install"); |
| 90 |
< |
///char levels[i][3]; |
| 91 |
< |
path Characters = "../GameDataFolder/level0_Characters"; |
| 92 |
< |
path Particles = "../GameDataFolder/level0_Particles"; |
| 93 |
< |
path Archive = "../GameDataFolder/Archive"; |
| 94 |
< |
path Textures = "../GameDataFolder/level0_Textures"; |
| 95 |
< |
path Sounds = "../GameDataFolder/level0_Sounds"; |
| 96 |
< |
path Animations = "../GameDataFolder/level0_Animations"; |
| 97 |
< |
path TRAC = Animations / "level0_TRAC"; |
| 98 |
< |
path TRAM = Animations / "level0_TRAM"; |
| 99 |
< |
|
| 100 |
< |
vector<path> GDFPaths; |
| 101 |
< |
GDFPaths.push_back(Characters); |
| 102 |
< |
GDFPaths.push_back(Particles); |
| 103 |
< |
GDFPaths.push_back(Textures); |
| 104 |
< |
GDFPaths.push_back(Sounds); |
| 105 |
< |
GDFPaths.push_back(TRAC); |
| 106 |
< |
GDFPaths.push_back(TRAM); |
| 107 |
< |
|
| 108 |
< |
|
| 109 |
< |
path VanillaCharacters = "packages/VanillaDats/level0_Final/level0_Characters/level0_Characters.oni"; |
| 110 |
< |
path VanillaParticles = "packages/VanillaDats/level0_Final/level0_Particles/level0_Particles.oni"; |
| 111 |
< |
path VanillaTextures = "packages/VanillaDats/level0_Final/level0_Textures/level0_Textures.oni"; |
| 112 |
< |
path VanillaSounds = "packages/VanillaDats/level0_Final/level0_Sounds/level0_Sounds.oni"; |
| 113 |
< |
path VanillaAnimations = "packages/VanillaDats/level0_Final/level0_Animations/level0_Animations.oni"; |
| 114 |
< |
path VanillaTRAC = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAC.oni"; |
| 115 |
< |
path VanillaTRAM = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAM.oni"; |
| 116 |
< |
|
| 117 |
< |
vector<path> VanillaPaths; |
| 118 |
< |
|
| 119 |
< |
VanillaPaths.push_back(VanillaCharacters); |
| 120 |
< |
VanillaPaths.push_back(VanillaParticles); |
| 121 |
< |
VanillaPaths.push_back(VanillaTextures); |
| 122 |
< |
VanillaPaths.push_back(VanillaSounds); |
| 123 |
< |
VanillaPaths.push_back(VanillaTRAC); |
| 124 |
< |
VanillaPaths.push_back(VanillaTRAM); |
| 125 |
< |
|
| 126 |
< |
/* |
| 127 |
< |
if (exists("../GameDataFolder/")) |
| 128 |
< |
{ |
| 129 |
< |
//cout << "\nIt looks like you've already globalized Oni's data.\nDo you want to re-globalize?\n(This will erase existing mods installed to the AE's game data.)" |
| 130 |
< |
// << "\n1. Re-globalize" |
| 131 |
< |
// << "\n2. Return to main menu\n"; |
| 132 |
< |
//choice = cin.get(); |
| 133 |
< |
cin.ignore(128, '\n'); |
| 134 |
< |
if (choice == '1') |
| 135 |
< |
remove_all("../GameDataFolder"); // remove AE GDF |
| 136 |
< |
if (choice == '2') |
| 137 |
< |
return 0; |
| 138 |
< |
} |
| 139 |
< |
*/ |
| 140 |
< |
setStatusArea("Removing old GameDataFolder...\n"); |
| 141 |
< |
logfile << "Removing old GameDataFolder...\n"; |
| 142 |
< |
remove_all( "../GameDataFolder/" ); |
| 143 |
< |
setStatusArea("Creating needed directories..."); |
| 144 |
< |
logfile << "Creating needed directories...\n"; |
| 145 |
< |
create_directory( "../GameDataFolder/" ); |
| 146 |
< |
|
| 147 |
< |
create_directory( "packages" ); |
| 148 |
< |
|
| 149 |
< |
if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats"); |
| 150 |
< |
create_directory( "packages/VanillaDats" ); |
| 151 |
< |
|
| 152 |
< |
create_directory( "packages/VanillaDats/level0_Final/" ); |
| 153 |
< |
//blah blah finish this. |
| 154 |
< |
//logfile << "packages/VanillaDats/level0_Final/ created"; |
| 155 |
< |
create_directory( Characters ); |
| 156 |
< |
create_directory( Particles ); |
| 157 |
< |
create_directory( Archive ); |
| 158 |
< |
create_directory( Textures ); |
| 159 |
< |
create_directory( Sounds ); |
| 160 |
< |
create_directory( Animations ); |
| 161 |
< |
create_directory( TRAC ); |
| 162 |
< |
create_directory( TRAM ); |
| 163 |
< |
int num_levels = 0; |
| 164 |
< |
for(int i = 1; i < 15; i++) |
| 165 |
< |
{ |
| 166 |
< |
if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) { |
| 167 |
< |
num_levels++; |
| 168 |
< |
|
| 169 |
< |
} |
| 170 |
< |
} |
| 171 |
< |
logfile << "Exporting and moving...\n\n"; |
| 172 |
< |
int total_steps = 8 + 2 * num_levels; |
| 173 |
< |
for(int i = 0; i < 15; i++) |
| 174 |
< |
{ |
| 175 |
< |
|
| 176 |
< |
//printf(levels[i],"%d",levels[i]); // int to char array |
| 177 |
< |
|
| 178 |
< |
if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) { |
| 179 |
< |
logfile << "level" << levels[i] << "_Final\n"; |
| 180 |
< |
logfile << "\tExporting level" << levels[i] << "_Final.dat\n"; |
| 181 |
< |
//printf(Step_x_x,"Step %d/%d: exporting level%d_final.dat", parts_done + 1,, levels[i]); setStatusArea((string)Step_x_x); |
| 182 |
< |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " exporting level" + levels[i]+"_Final.dat"); |
| 183 |
< |
create_directory( "../GameDataFolder/level" + levels[i] + "_Final" ); |
| 184 |
< |
// setStatusArea(strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat"); |
| 185 |
< |
system((strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat").c_str()); |
| 186 |
< |
create_directory( "packages/VanillaDats/level" + levels[i] + "_Final" ); |
| 187 |
< |
create_directory( "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final" ); |
| 188 |
< |
|
| 189 |
< |
directory_iterator end_iter; |
| 190 |
< |
for ( directory_iterator dir_itr( "../GameDataFolder/level" + levels[i] + "_Final" ); dir_itr != end_iter; ++dir_itr ) |
| 191 |
< |
{ |
| 192 |
< |
//cout << dir_itr->path().filename(); |
| 193 |
< |
if ( is_regular_file( dir_itr->status() ) ) |
| 194 |
< |
{ |
| 195 |
< |
if ( dir_itr->path().filename().substr(0,8) == "TXMPfail" || |
| 196 |
< |
dir_itr->path().filename().substr(0,9) == "TXMPlevel" || |
| 197 |
< |
( dir_itr->path().filename().substr(0,4) == "TXMP" && dir_itr->path().filename().find("intro")!=string::npos) || |
| 198 |
< |
dir_itr->path().filename().substr(0,4) == "TXMB" || |
| 199 |
< |
dir_itr->path().filename() == "M3GMpowerup_lsi.oni" || |
| 200 |
< |
dir_itr->path().filename() == "TXMPlsi_icon.oni" || |
| 201 |
< |
( dir_itr->path().filename().substr(0,4) == "TXMB" && dir_itr->path().filename().find("splash_screen.oni")!=string::npos) ) |
| 202 |
< |
{ |
| 203 |
< |
cout <<dir_itr->path().filename() << "\n"; |
| 204 |
< |
create_directory( dir_itr->path().parent_path() / "NoGlobal"); |
| 205 |
< |
if(!exists( dir_itr->path().parent_path() / "NoGlobal" / dir_itr->filename())) rename(dir_itr->path(), dir_itr->path().parent_path() / "NoGlobal" / |
| 206 |
< |
dir_itr->filename()); |
| 207 |
< |
else remove(dir_itr->path()); |
| 208 |
< |
} |
| 209 |
< |
else if (dir_itr->path().filename().substr(0,4) == "TRAC" |
| 210 |
< |
|| dir_itr->path().filename().substr(0,4) == "ONVL") { |
| 211 |
< |
cout <<dir_itr->path().filename() << "\n"; |
| 212 |
< |
if(!exists( TRAC / dir_itr->filename())) rename(dir_itr->path(), TRAC / dir_itr->filename()); |
| 213 |
< |
else remove(dir_itr->path()); |
| 214 |
< |
} |
| 215 |
< |
else if (dir_itr->path().filename().substr(0,4) == "TRAM") { |
| 216 |
< |
cout <<dir_itr->path().filename() << "\n"; |
| 217 |
< |
if(!exists( TRAM / dir_itr->filename())) rename(dir_itr->path(), TRAM / dir_itr->filename()); |
| 218 |
< |
else remove(dir_itr->path()); |
| 219 |
< |
} |
| 220 |
< |
else if (dir_itr->path().filename().substr(0,4) == "ONSK" || |
| 221 |
< |
dir_itr->path().filename().substr(0,4) == "TXMP") { |
| 222 |
< |
cout <<dir_itr->path().filename() << "\n";\ |
| 223 |
< |
create_directory( dir_itr->path().parent_path() / "TexFix"); |
| 224 |
< |
if(!exists( Textures / dir_itr->filename())) rename(dir_itr->path(), Textures / dir_itr->filename()); |
| 225 |
< |
//rename(dir_itr->path(), dir_itr->path().parent_path() / "TexFix" / dir_itr->filename()); |
| 226 |
< |
} |
| 227 |
< |
else if (dir_itr->path().filename().substr(0,4) == "ONCC" |
| 228 |
< |
|| dir_itr->path().filename().substr(0,4) == "TRBS" |
| 229 |
< |
|| dir_itr->path().filename().substr(0,4) == "ONCV" |
| 230 |
< |
|| dir_itr->path().filename().substr(0,4) == "TRMA" |
| 231 |
< |
|| dir_itr->path().filename().substr(0,4) == "TRSC" |
| 232 |
< |
|| dir_itr->path().filename().substr(0,4) == "TRAS") { |
| 233 |
< |
cout <<dir_itr->path().filename() << "\n"; |
| 234 |
< |
if(!exists( Characters / dir_itr->filename())) rename(dir_itr->path(), Characters / dir_itr->filename()); |
| 235 |
< |
else remove(dir_itr->path()); |
| 236 |
< |
} |
| 237 |
< |
else if (dir_itr->path().filename().substr(0,4) == "OSBD" |
| 238 |
< |
|| dir_itr->path().filename().substr(0,4) == "SNDD") { |
| 239 |
< |
cout << dir_itr->path().filename() << "\n"; |
| 240 |
< |
if(!exists( Sounds / dir_itr->filename())) rename(dir_itr->path(), Sounds / dir_itr->filename()); |
| 241 |
< |
else remove(dir_itr->path()); |
| 242 |
< |
} |
| 243 |
< |
else if (dir_itr->path().filename().substr(0,5) == "BINA3" |
| 244 |
< |
|| dir_itr->path().filename().substr(0,10) == "M3GMdebris" |
| 245 |
< |
|| dir_itr->path().filename() == "M3GMtoxic_bubble.oni" |
| 246 |
< |
|| dir_itr->path().filename().substr(0,8) == "M3GMelec" |
| 247 |
< |
|| dir_itr->path().filename().substr(0,7) == "M3GMrat" |
| 248 |
< |
|| dir_itr->path().filename().substr(0,7) == "M3GMjet" |
| 249 |
< |
|| dir_itr->path().filename().substr(0,9) == "M3GMbomb_" |
| 250 |
< |
|| dir_itr->path().filename() == "M3GMbarab_swave.oni" |
| 251 |
< |
|| dir_itr->path().filename() == "M3GMbloodyfoot.oni" |
| 252 |
< |
){ |
| 253 |
< |
cout <<dir_itr->path().filename() << "\n"; |
| 254 |
< |
if(!exists( Particles / dir_itr->filename())) rename(dir_itr->path(), Particles / dir_itr->filename()); |
| 255 |
< |
else remove(dir_itr->path()); |
| 256 |
< |
} |
| 257 |
< |
else if (dir_itr->path().filename().substr(0,4) == "AGDB" |
| 258 |
< |
|| dir_itr->path().filename().substr(0,4) == "TRCM") { |
| 259 |
< |
cout <<dir_itr->path().filename() << "\n"; |
| 260 |
< |
|
| 261 |
< |
if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename()); |
| 262 |
< |
else remove(dir_itr->path()); |
| 263 |
< |
} |
| 264 |
< |
if (exists(dir_itr->path())) { |
| 265 |
< |
|
| 266 |
< |
} |
| 267 |
< |
else { |
| 268 |
< |
//logfile << "\tMoved file: " << dir_itr->path().filename() << "\n"; |
| 269 |
< |
} |
| 270 |
< |
} |
| 271 |
< |
|
| 272 |
< |
|
| 273 |
< |
|
| 274 |
< |
} |
| 275 |
< |
logfile << "\tCleaning up TXMPs...\n"; |
| 276 |
< |
system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + levels[i] + "_Final/TXMP*.oni").c_str()); |
| 277 |
< |
parts_done++; |
| 278 |
< |
|
| 279 |
< |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 280 |
< |
|
| 281 |
< |
} |
| 282 |
< |
} |
| 283 |
< |
logfile << "Reimporting levels\n"; |
| 284 |
< |
for (int i = 0; i < 15; i++) |
| 285 |
< |
{ |
| 286 |
< |
logfile << "\tReimporting level" << levels[i] << "_Final.oni\n"; |
| 287 |
< |
//printf(levels[i],"%d",levels[i]); |
| 288 |
< |
//printf(Step_x_x,"Step %d/%d: reimporting level", parts_done + 1, 7 + 2 * num_levels); setStatusArea((string)Step_x_x + levels[i] + (string)"_Final.dat"); |
| 289 |
< |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " reimporting level" + levels[i]+"_Final.oni"); |
| 290 |
< |
logfile << (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level" |
| 291 |
< |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log").c_str() << '\n'; |
| 292 |
< |
string sys_str = (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level" |
| 293 |
< |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize2.log"); |
| 294 |
< |
system(sys_str.c_str() ); |
| 295 |
< |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 296 |
< |
parts_done++; |
| 297 |
< |
} |
| 298 |
< |
create_directory( VanillaCharacters.parent_path() ); |
| 299 |
< |
create_directory( VanillaParticles.parent_path() ); |
| 300 |
< |
create_directory( VanillaTextures.parent_path() ); |
| 301 |
< |
create_directory( VanillaSounds.parent_path() ); |
| 302 |
< |
create_directory( VanillaAnimations.remove_filename() ); |
| 303 |
< |
|
| 304 |
< |
for(int j = 0; j < GDFPaths.size(); j++) { |
| 305 |
< |
logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n"; |
| 306 |
< |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() ); |
| 307 |
< |
system((strOniSplit + " " + strImportOption + " " + GDFPaths[j].string() + " " + VanillaPaths[j].string()).c_str()); |
| 308 |
< |
parts_done++; |
| 309 |
< |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 310 |
< |
} |
| 311 |
< |
/* |
| 312 |
< |
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) )); |
| 313 |
< |
system((strOniSplit + " " + strImportOption + " " + Characters.string() + " " + VanillaCharacters.string()).c_str()); |
| 314 |
< |
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) )); |
| 315 |
< |
system((strOniSplit + " " + strImportOption + " " + Particles.string() + " " + VanillaParticles.string()).c_str()); |
| 316 |
< |
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) )); |
| 317 |
< |
system((strOniSplit + " " + strImportOption + " " + Textures.string() + " " + VanillaTextures.string()).c_str()); |
| 318 |
< |
//system((strOniSplit + " " + strImportOption + (string)" " + Animations.string() + (string)" " + VanillaAnimations.string()).c_str()); |
| 319 |
< |
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) )); |
| 320 |
< |
system((strOniSplit + " " + strImportOption + " " + TRAC.string() + " " + VanillaTRAC.string()).c_str()); |
| 321 |
< |
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) )); |
| 322 |
< |
system((strOniSplit + " " + strImportOption + " " + Sounds.string() + " " + VanillaSounds.string()).c_str()); |
| 323 |
< |
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) )); |
| 324 |
< |
system((strOniSplit + " " + strImportOption + " " + TRAM.string() + " " + VanillaTRAM.string()).c_str()); |
| 325 |
< |
//parts_done++; setStatusArea((string)"Copying level scripts...");setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 326 |
< |
if (exists("../GameDataFolder/IGMD")) remove_all("../GameDataFolder/IGMD"); |
| 327 |
< |
*/ |
| 328 |
< |
create_directory((path)"../GameDataFolder/IGMD"); |
| 329 |
< |
copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); |
| 330 |
< |
setProgressBar( 1000 ); |
| 331 |
< |
|
| 332 |
< |
// CIP:last of all, set up the edition folder as a playable Oni installation by placing the latest application (+ Daodan DLL on Windows) in edition/ |
| 333 |
< |
|
| 334 |
< |
// CIP:then copy persist.dat and keyconfig.txt into edition/ as well |
| 335 |
< |
|
| 336 |
< |
#ifndef WIN32 |
| 337 |
< |
/* On Mac only, set the current GDF to the AE GDF by writing to Oni's global preferences file (thankfully a standard OS X ".plist" XML file). |
| 338 |
< |
If there are no Oni prefs (only possible if Oni has not been run even once), then the above line will fail silently, no harm done, |
| 339 |
< |
and when the user does run Oni for the first time, using the copy of the app in the AE GDF, Oni will set the prefs to use that GDF at that point */ |
| 340 |
< |
path fullAEpath = system_complete("."); // get full path for Installer |
| 341 |
< |
char prefsCommand[300] = "defaults write com.godgames.oni RetailInstallationPath -string '"; |
| 342 |
< |
strcat(prefsCommand, fullAEpath.parent_path().parent_path().string().c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF) |
| 343 |
< |
strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters |
| 344 |
< |
system(prefsCommand); |
| 345 |
< |
|
| 13 |
> |
#include <windows.h> |
| 14 |
> |
#include <shobjidl.h> |
| 15 |
> |
HWND Handle; |
| 16 |
> |
ITaskbarList *pTaskbarList; |
| 17 |
> |
ITaskbarList3 *pTaskbarList3; |
| 18 |
|
#endif |
| 347 |
– |
|
| 348 |
– |
setStatusArea((string)"Done! Now select your mod packages and click install."); |
| 349 |
– |
// while(1) Sleep(-1); |
| 350 |
– |
|
| 351 |
– |
} |
| 352 |
– |
catch (exception ex) { |
| 353 |
– |
setStatusArea("Warning, handled exception: " + (string)ex.what()); |
| 354 |
– |
} |
| 355 |
– |
|
| 356 |
– |
ptime end_time(second_clock::local_time()); |
| 357 |
– |
time_period total_time (start_time, end_time); |
| 358 |
– |
logfile << "\n\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); |
| 359 |
– |
//total_time.length().hours(); |
| 360 |
– |
logfile.close(); |
| 361 |
– |
busy = 0; |
| 362 |
– |
return err; |
| 363 |
– |
} |
| 364 |
– |
|
| 365 |
– |
|
| 366 |
– |
vector<ModPackage> getPackages(void) |
| 367 |
– |
{ |
| 368 |
– |
vector<ModPackage> packages; |
| 369 |
– |
packages.reserve(65536); // come on, we shouldn't need this much space...right?! |
| 370 |
– |
fstream file; |
| 371 |
– |
string filename = "\0"; |
| 372 |
– |
string MODINFO_CFG = "Mod_Info.cfg"; |
| 373 |
– |
|
| 374 |
– |
try |
| 375 |
– |
{ |
| 376 |
– |
directory_iterator end_iter; |
| 377 |
– |
for (directory_iterator dir_itr("./packages"); dir_itr != end_iter; ++dir_itr) |
| 378 |
– |
{ |
| 379 |
– |
file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str()); |
| 380 |
– |
//cout << filename << "\n"; |
| 381 |
– |
|
| 382 |
– |
if(!file.fail()) |
| 383 |
– |
{ |
| 384 |
– |
//cout << dir_itr->path().string() + MODINFO_CFG; |
| 385 |
– |
//would prefer to push a pointer to a package, but this will do for now |
| 386 |
– |
packages.push_back(fileToModPackage(file)); |
| 387 |
– |
} |
| 388 |
– |
file.close(); |
| 389 |
– |
file.clear(); |
| 390 |
– |
} |
| 391 |
– |
sort(packages.begin(), packages.end()); |
| 392 |
– |
} |
| 393 |
– |
catch (const std::exception & ex) |
| 394 |
– |
{ |
| 395 |
– |
cout << "Warning, something odd happened!\n"; |
| 396 |
– |
} |
| 397 |
– |
|
| 398 |
– |
return packages; |
| 399 |
– |
} |
| 400 |
– |
|
| 401 |
– |
ModPackage fileToModPackage(fstream &file) |
| 402 |
– |
{ |
| 403 |
– |
/* |
| 404 |
– |
This converts a file to a ModPackage struct. |
| 405 |
– |
|
| 406 |
– |
A few notes... |
| 407 |
– |
"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. |
| 408 |
– |
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 |
| 409 |
– |
slower than reading a variable. |
| 410 |
– |
*/ |
| 411 |
– |
ModPackage package; |
| 412 |
– |
string line; |
| 413 |
– |
static string NameOfMod = "NameOfMod"; //used for comparing to the current token... |
| 414 |
– |
//I could have done it in reverse (*iter).compare("ModString") or |
| 415 |
– |
static string ARROW = "->"; //did something like "ModString".compare(*iter), and it would have been |
| 416 |
– |
static string ModString = "ModString"; //functionably the same. |
| 417 |
– |
static string HasOnis = "HasOnis"; |
| 418 |
– |
static string HasDeltas = "HasDeltas"; |
| 419 |
– |
static string HasBSL = "HasBSL"; |
| 420 |
– |
static string HasDats = "HasDats"; |
| 421 |
– |
static string IsEngine = "IsEngine"; |
| 422 |
– |
static string Readme = "Readme"; |
| 423 |
– |
static string GlobalNeeded = "GlobalNeeded"; |
| 424 |
– |
static string Category = "Category"; |
| 425 |
– |
static string Creator = "Creator"; |
| 426 |
– |
while (! file.eof() ) |
| 427 |
– |
{ |
| 428 |
– |
getline (file,line); |
| 429 |
– |
vector<string> tokens; |
| 430 |
– |
vector<string>::iterator iter; |
| 431 |
– |
tokenize(line, tokens); //string to vector of "words" |
| 432 |
– |
if (tokens.capacity() >= 2) { //make sure they are using enough stuff |
| 433 |
– |
iter = tokens.begin(); //what word we are on, starts at first word |
| 434 |
– |
/* |
| 435 |
– |
if (!AEInstallVersion.compare(*iter)) |
| 436 |
– |
If mod is too old, skip this mod. |
| 437 |
– |
*/ |
| 438 |
– |
/*else*/if (!NameOfMod.compare(*iter)) { //if it contains the name |
| 439 |
– |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 440 |
– |
if (ARROW.compare(*iter) && NameOfMod.compare(*iter)) { //ignores "->" and "NameOfMod" |
| 441 |
– |
//cout << *iter; |
| 442 |
– |
//cout << " "; |
| 443 |
– |
package.name += *iter + " "; |
| 444 |
– |
} |
| 445 |
– |
} |
| 446 |
– |
|
| 447 |
– |
} |
| 448 |
– |
else if (!ModString.compare(*iter)) { |
| 449 |
– |
iter++; iter++; |
| 450 |
– |
package.modStringName = *iter; |
| 451 |
– |
iter++; |
| 452 |
– |
package.modStringVersion = atoi((*iter).c_str()); |
| 453 |
– |
} |
| 454 |
– |
else if (!HasOnis.compare(*iter)) { |
| 455 |
– |
iter++; iter++; |
| 456 |
– |
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 |
| 457 |
– |
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, |
| 458 |
– |
iter++; iter++;} // using "YFR" would probably set it off. :< |
| 459 |
– |
|
| 460 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasBSL = 1; |
| 461 |
– |
} |
| 462 |
– |
else if (!HasDeltas.compare(*iter)) { |
| 463 |
– |
iter++; iter++; |
| 464 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasDeltas = 1; |
| 465 |
– |
} |
| 466 |
– |
else if (!HasDats.compare(*iter)) { |
| 467 |
– |
iter++; iter++; |
| 468 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasDats = 1; |
| 469 |
– |
} |
| 470 |
– |
else if (!IsEngine.compare(*iter)) { |
| 471 |
– |
iter++; iter++; |
| 472 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.isEngine = 1; |
| 473 |
– |
} |
| 474 |
– |
else if (!GlobalNeeded.compare(*iter)) { |
| 475 |
– |
iter++; iter++; |
| 476 |
– |
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.globalNeeded = 1; |
| 477 |
– |
else if (toupper((*iter)[0]) + toupper((*iter)[1]) == 'N' + 'O') package.globalNeeded = 1; //Really the only place where checking for "No" is important atm. |
| 478 |
– |
} |
| 479 |
– |
else if (!Category.compare(*iter)) { |
| 480 |
– |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 481 |
– |
if (ARROW.compare(*iter) && Category.compare(*iter)) { //ignores "->" and "Category" |
| 482 |
– |
//cout << *iter; |
| 483 |
– |
//cout << " "; |
| 484 |
– |
package.category += *iter + " "; |
| 485 |
– |
} |
| 486 |
– |
} |
| 487 |
– |
} |
| 488 |
– |
else if (!Creator.compare(*iter)) { //if it contains the name |
| 489 |
– |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 490 |
– |
if (ARROW.compare(*iter) && Creator.compare(*iter)) { //ignores "->" and "Category" |
| 491 |
– |
//cout << *iter; |
| 492 |
– |
//cout << " "; |
| 493 |
– |
package.creator += *iter + " "; |
| 494 |
– |
} |
| 495 |
– |
} |
| 496 |
– |
} |
| 497 |
– |
else if (!Readme.compare(*iter)) { //if it contains the name |
| 498 |
– |
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 499 |
– |
if (ARROW.compare(*iter) && Readme.compare(*iter)) { //ignores "->" and "Category" |
| 500 |
– |
if(!(*iter).compare("\\n")) package.readme += '\n'; |
| 501 |
– |
else package.readme += *iter + " "; |
| 502 |
– |
} |
| 503 |
– |
} |
| 504 |
– |
} |
| 505 |
– |
} |
| 506 |
– |
|
| 507 |
– |
} |
| 508 |
– |
package.doOutput(); |
| 509 |
– |
return package; |
| 510 |
– |
} |
| 511 |
– |
|
| 512 |
– |
void recompileAll(vector<string> installedMods) |
| 513 |
– |
{ |
| 514 |
– |
busy = 1; |
| 515 |
– |
using namespace boost::gregorian; |
| 516 |
– |
using namespace boost::posix_time; |
| 517 |
– |
using boost::lexical_cast; |
| 518 |
– |
using boost::bad_lexical_cast; |
| 519 |
– |
|
| 520 |
– |
setStatusArea("Importing levels..."); |
| 521 |
– |
//setStatusArea("Recompiling Data..."); |
| 522 |
– |
path vanilla_dir = "./packages/VanillaDats/"; |
| 523 |
– |
string importCommand = ""; |
| 524 |
– |
char statusString[128]; |
| 525 |
– |
int numberOfDats = 0; |
| 526 |
– |
int j = 1; |
| 527 |
– |
string datString; |
| 528 |
– |
std::stringstream out; |
| 529 |
– |
|
| 530 |
– |
ptime start_time(second_clock::local_time()); |
| 531 |
– |
clearOldDats(); |
| 532 |
– |
remove("Install.log"); |
| 533 |
– |
ofstream logfile("Install.log"); |
| 534 |
– |
logfile << "Mod Installation started " << to_simple_string(start_time) << endl; |
| 535 |
– |
logfile.close(); |
| 536 |
– |
if(splitInstances == SPLIT){ |
| 537 |
– |
recursive_directory_iterator end_iter; |
| 538 |
– |
|
| 539 |
– |
for ( recursive_directory_iterator dir_itr( vanilla_dir ); |
| 540 |
– |
dir_itr != end_iter; |
| 541 |
– |
++dir_itr ) |
| 542 |
– |
{ |
| 543 |
– |
try{ |
| 544 |
– |
if ( is_directory( dir_itr->status() ) && dir_itr.level() == 1) |
| 545 |
– |
{ |
| 546 |
– |
numberOfDats++; |
| 547 |
– |
} |
| 548 |
– |
} |
| 549 |
– |
catch(exception ex) { |
| 550 |
– |
|
| 551 |
– |
} |
| 552 |
– |
} |
| 553 |
– |
|
| 554 |
– |
//recursive_directory_iterator end_iter; |
| 555 |
– |
|
| 556 |
– |
|
| 557 |
– |
out << numberOfDats; |
| 558 |
– |
datString = out.str(); |
| 559 |
– |
try { |
| 560 |
– |
for ( recursive_directory_iterator dir_itr( vanilla_dir ); |
| 561 |
– |
dir_itr != end_iter; |
| 562 |
– |
++dir_itr ) |
| 563 |
– |
{ |
| 564 |
– |
try |
| 565 |
– |
{ |
| 566 |
– |
if ( is_directory( dir_itr->status() ) && dir_itr.level() == 1) |
| 567 |
– |
{ |
| 568 |
– |
importCommand = strOniSplit + " " + strImportOption + " " + dir_itr->path().parent_path().string() + '/' + dir_itr->path().filename(); |
| 569 |
– |
for (int i = 0; i < installedMods.size(); ++i) { |
| 570 |
– |
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename() )) |
| 571 |
– |
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename(); |
| 572 |
– |
|
| 573 |
– |
//else cout << " packages/VanillaDats/" + installedMods[i] + "/oni/"; |
| 574 |
– |
} |
| 575 |
– |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log"; |
| 576 |
– |
|
| 577 |
– |
|
| 578 |
– |
setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats |
| 579 |
– |
setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " + dir_itr->path().filename() + " "); |
| 580 |
– |
|
| 581 |
– |
system(importCommand.c_str()); |
| 582 |
– |
//Sleep(1000); |
| 583 |
– |
//cout << importCommand << "\n"; |
| 584 |
– |
j++; |
| 585 |
– |
|
| 586 |
– |
} |
| 587 |
– |
} |
| 588 |
– |
catch ( const std::exception & ex ) |
| 589 |
– |
{ |
| 590 |
– |
|
| 591 |
– |
remove("Install.log"); |
| 592 |
– |
ofstream logfile("Install.log"); |
| 593 |
– |
|
| 594 |
– |
|
| 595 |
– |
logfile << "Warning, exception " << ex.what() << "!"; |
| 596 |
– |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 597 |
– |
logfile.close(); |
| 598 |
– |
} |
| 599 |
– |
} |
| 600 |
– |
|
| 601 |
– |
} |
| 602 |
– |
catch( const std::exception & ex ) { |
| 603 |
– |
|
| 604 |
– |
remove("Install.log"); |
| 605 |
– |
ofstream logfile("Install.log"); |
| 606 |
– |
|
| 607 |
– |
|
| 608 |
– |
logfile << "Warning, exception " << ex.what() << "!"; |
| 609 |
– |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 610 |
– |
logfile.close(); |
| 611 |
– |
} |
| 612 |
– |
|
| 613 |
– |
} |
| 614 |
– |
else if(splitInstances == NOT_SPLIT){ |
| 615 |
– |
directory_iterator end_iter; |
| 616 |
– |
|
| 617 |
– |
for ( directory_iterator dir_itr( vanilla_dir ); |
| 618 |
– |
dir_itr != end_iter; |
| 619 |
– |
++dir_itr ) |
| 620 |
– |
{ |
| 621 |
– |
|
| 622 |
– |
if ( is_directory( dir_itr->status() ) ) |
| 623 |
– |
{ |
| 624 |
– |
numberOfDats++; |
| 625 |
– |
} |
| 626 |
– |
|
| 627 |
– |
|
| 628 |
– |
} |
| 629 |
– |
|
| 630 |
– |
out << numberOfDats; |
| 631 |
– |
datString = out.str(); |
| 632 |
– |
|
| 633 |
– |
for ( directory_iterator dir_itr( vanilla_dir ); |
| 634 |
– |
dir_itr != end_iter; |
| 635 |
– |
++dir_itr ) |
| 636 |
– |
{ |
| 637 |
– |
try |
| 638 |
– |
{ |
| 639 |
– |
if ( is_directory( dir_itr->status() ) ) |
| 640 |
– |
{ |
| 641 |
– |
importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " "; |
| 642 |
– |
for (int i = 0; i < installedMods.size(); ++i) { |
| 643 |
– |
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename() )) |
| 644 |
– |
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename(); |
| 645 |
– |
} |
| 646 |
– |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log"; |
| 647 |
– |
|
| 648 |
– |
|
| 649 |
– |
setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats |
| 650 |
– |
setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " + dir_itr->path().filename() + " "); |
| 651 |
– |
|
| 652 |
– |
system(importCommand.c_str()); |
| 653 |
– |
|
| 654 |
– |
j++; |
| 655 |
– |
} |
| 656 |
– |
} |
| 657 |
– |
catch ( const std::exception & ex ) |
| 658 |
– |
{ |
| 659 |
– |
|
| 660 |
– |
remove("Install.log"); |
| 661 |
– |
ofstream logfile("Install.log"); |
| 662 |
– |
|
| 663 |
– |
|
| 664 |
– |
logfile << "Warning, exception " << ex.what() << "!"; |
| 665 |
– |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 666 |
– |
logfile.close(); |
| 667 |
– |
}} |
| 668 |
– |
} |
| 669 |
– |
logfile << "Writing config file"; |
| 670 |
– |
writeInstalledMods(installedMods); |
| 671 |
– |
setProgressBar(1000); |
| 672 |
– |
setStatusArea("Done! You can now play Oni."); |
| 673 |
– |
|
| 674 |
– |
ptime end_time(second_clock::local_time()); |
| 675 |
– |
time_period total_time (start_time, end_time); |
| 676 |
– |
|
| 677 |
– |
|
| 678 |
– |
ofstream logfile2("Install.log", ios::app | ios::ate); |
| 679 |
– |
string outstring = (string)"\n\nGlobalization ended " + to_simple_string(end_time) + "\nThe process took ";// + (string)total_time.length(); |
| 680 |
– |
|
| 681 |
– |
logfile2 << "\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); |
| 682 |
– |
|
| 683 |
– |
//logfile2.write(outstring.c_str(), outstring.length()); |
| 684 |
– |
logfile2.close(); |
| 685 |
– |
|
| 686 |
– |
//total_time.length().hours(); |
| 687 |
– |
|
| 688 |
– |
Sleep(1000); |
| 689 |
– |
setProgressBar(0); |
| 690 |
– |
busy = 0; |
| 691 |
– |
} |
| 692 |
– |
|
| 693 |
– |
void writeInstalledMods(vector<string> installedMods) |
| 694 |
– |
{ |
| 695 |
– |
|
| 696 |
– |
if ( exists( strInstallCfg ) ) |
| 697 |
– |
{ |
| 698 |
– |
remove( strInstallCfg ); |
| 699 |
– |
} |
| 700 |
– |
|
| 701 |
– |
ofstream file(strInstallCfg.c_str()); |
| 702 |
– |
|
| 703 |
– |
vector<string>list = installedMods; |
| 704 |
– |
vector<string>::iterator begin_iter = list.begin(); |
| 705 |
– |
vector<string>::iterator end_iter = list.end(); |
| 706 |
– |
|
| 707 |
– |
sort( list.begin(), list.end() ); |
| 708 |
– |
|
| 709 |
– |
for( ; begin_iter != end_iter; ++begin_iter) { |
| 710 |
– |
file << *begin_iter << " "; |
| 711 |
– |
} |
| 712 |
– |
|
| 713 |
– |
file.close(); |
| 714 |
– |
file.clear(); |
| 715 |
– |
|
| 716 |
– |
} |
| 717 |
– |
|
| 718 |
– |
vector<string> getInstallString(string Cfg) |
| 719 |
– |
{ |
| 720 |
– |
//system(strPauseCmd); |
| 721 |
– |
vector<string> returnval; |
| 722 |
– |
|
| 723 |
– |
string line; |
| 724 |
– |
fstream file; |
| 725 |
– |
|
| 726 |
– |
if (exists( Cfg )) |
| 727 |
– |
{ |
| 728 |
– |
file.open(Cfg.c_str()); |
| 729 |
– |
getline(file, line); |
| 730 |
– |
tokenize(line, returnval); |
| 731 |
– |
file.close(); |
| 732 |
– |
file.clear(); |
| 733 |
– |
sort(returnval.begin(), returnval.end()); |
| 734 |
– |
} |
| 735 |
– |
else cout << "fail"; |
| 736 |
– |
|
| 737 |
– |
return returnval; |
| 738 |
– |
} |
| 739 |
– |
|
| 740 |
– |
//stolen token function... |
| 741 |
– |
void tokenize(const string& str, vector<string>& tokens, const string& delimiters) |
| 742 |
– |
{ |
| 743 |
– |
// Skip delimiters at beginning. |
| 744 |
– |
string::size_type lastPos = str.find_first_not_of(delimiters, 0); |
| 745 |
– |
// Find first "non-delimiter". |
| 746 |
– |
string::size_type pos = str.find_first_of(delimiters, lastPos); |
| 747 |
– |
|
| 748 |
– |
while (string::npos != pos || string::npos != lastPos) |
| 749 |
– |
{ |
| 750 |
– |
// Found a token, add it to the vector. |
| 751 |
– |
tokens.push_back(str.substr(lastPos, pos - lastPos)); |
| 752 |
– |
// Skip delimiters. Note the "not_of" |
| 753 |
– |
lastPos = str.find_first_not_of(delimiters, pos); |
| 754 |
– |
// Find next "non-delimiter" |
| 755 |
– |
pos = str.find_first_of(delimiters, lastPos); |
| 756 |
– |
} |
| 757 |
– |
} |
| 758 |
– |
|
| 759 |
– |
void clearOldDats(void) { |
| 760 |
– |
directory_iterator end_iter_gdf; |
| 761 |
– |
for ( directory_iterator dir_itr_gdf( "../GameDataFolder" ); |
| 762 |
– |
dir_itr_gdf != end_iter_gdf; |
| 763 |
– |
++dir_itr_gdf ) |
| 764 |
– |
{ |
| 765 |
– |
//cout << dir_itr_gdf->path().extension() << "\n"; |
| 766 |
– |
if ( dir_itr_gdf->path().extension() == ".dat" || dir_itr_gdf->path().extension() == ".raw" || dir_itr_gdf->path().extension() == ".sep" ) { |
| 767 |
– |
remove( dir_itr_gdf->path() ); |
| 768 |
– |
} |
| 19 |
|
|
| 770 |
– |
} |
| 771 |
– |
|
| 772 |
– |
} |
| 773 |
– |
|
| 774 |
– |
vector<string> globalInstalledMods; |
| 775 |
– |
vector<ModPackage> globalPackages; |
| 776 |
– |
#include "boost/thread.hpp" |
| 20 |
|
#include <boost/thread/mutex.hpp> |
| 778 |
– |
|
| 779 |
– |
///////////////////////////////////////////////////////////////////////////// |
| 780 |
– |
// Name: main_window.cpp |
| 781 |
– |
// Purpose: |
| 782 |
– |
// Author: |
| 783 |
– |
// Modified by: |
| 784 |
– |
// Created: 07/05/2009 20:38:25 |
| 785 |
– |
// RCS-ID: |
| 786 |
– |
// Copyright: |
| 787 |
– |
// Licence: |
| 788 |
– |
///////////////////////////////////////////////////////////////////////////// |
| 789 |
– |
|
| 21 |
|
// For compilers that support precompilation, includes "wx/wx.h". |
| 22 |
|
#include "wx/wxprec.h" |
| 23 |
|
|
| 31 |
|
|
| 32 |
|
////@begin includes |
| 33 |
|
#include "about.h" |
| 803 |
– |
////@end includes |
| 804 |
– |
|
| 34 |
|
#include "main_window.h" |
| 35 |
+ |
#include "installer.h" |
| 36 |
+ |
////@end includes |
| 37 |
|
|
| 38 |
|
////@begin XPM images |
| 39 |
|
#include "aelogosmall.xpm" |
| 43 |
|
#include "quit.xpm" |
| 44 |
|
////@end XPM images |
| 45 |
|
|
| 46 |
< |
//#define wxDebug 1; |
| 47 |
< |
//#define wxUSE_UNICODE 1; |
| 46 |
> |
bool busy = false; |
| 47 |
> |
int updateStatus; |
| 48 |
> |
bool installerJustUpdated = false; |
| 49 |
> |
vector<string> globalInstalledMods; |
| 50 |
> |
vector<ModPackage> globalPackages; |
| 51 |
> |
// Variable declarations |
| 52 |
> |
#ifdef WIN32 |
| 53 |
> |
bool splitInstances = false; |
| 54 |
> |
string strImportOption = "-import:nosep"; |
| 55 |
> |
string strOniSplit = "Onisplit.exe"; |
| 56 |
> |
#else |
| 57 |
> |
bool splitInstances = false; |
| 58 |
> |
string strImportOption = "-import:sep"; |
| 59 |
> |
string strOniSplit = "mono Onisplit.exe"; |
| 60 |
> |
#endif |
| 61 |
|
|
| 62 |
|
/* |
| 63 |
|
* MainWindow type definition |
| 104 |
|
|
| 105 |
|
EVT_MENU( wxID_ABOUT, MainWindow::OnAboutClick ) |
| 106 |
|
|
| 107 |
+ |
EVT_BUTTON( Dir_Button, MainWindow::OnDirButtonClick ) |
| 108 |
|
////@end MainWindow event table entries |
| 109 |
|
|
| 110 |
|
END_EVENT_TABLE() |
| 115 |
|
*/ |
| 116 |
|
|
| 117 |
|
MainWindow::MainWindow() |
| 118 |
< |
{ |
| 118 |
> |
{ |
| 119 |
|
Init(); |
| 120 |
|
} |
| 121 |
|
|
| 142 |
|
return true; |
| 143 |
|
} |
| 144 |
|
|
| 900 |
– |
|
| 145 |
|
/* |
| 146 |
|
* MainWindow destructor |
| 147 |
|
*/ |
| 152 |
|
////@end MainWindow destruction |
| 153 |
|
} |
| 154 |
|
|
| 911 |
– |
|
| 155 |
|
/* |
| 156 |
|
* Member initialisation |
| 157 |
|
*/ |
| 175 |
|
SeperatedRadio = NULL; |
| 176 |
|
CompleteRadio = NULL; |
| 177 |
|
ReglobalizeButton = NULL; |
| 935 |
– |
////@end MainWindow member initialisation |
| 178 |
|
|
| 179 |
+ |
ChangeDirectoryButton = NULL; |
| 180 |
+ |
////@end MainWindow member initialisation |
| 181 |
|
} |
| 182 |
|
|
| 939 |
– |
|
| 183 |
|
/* |
| 184 |
|
* Control creation for MainWindow |
| 185 |
|
*/ |
| 216 |
|
wxMenu* itemMenu42 = new wxMenu; |
| 217 |
|
itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK); |
| 218 |
|
menuBar->Append(itemMenu42, _("Options")); |
| 219 |
< |
wxMenu* itemMenu44 = new wxMenu; |
| 220 |
< |
itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 221 |
< |
menuBar->Append(itemMenu44, _("Help")); |
| 219 |
> |
//#ifdef WIN32 |
| 220 |
> |
// itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 221 |
> |
// menuBar->Append(itemMenu44, _("Help")); |
| 222 |
> |
//#else |
| 223 |
> |
itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 224 |
> |
//#endif |
| 225 |
> |
|
| 226 |
|
itemFrame1->SetMenuBar(menuBar); |
| 227 |
|
|
| 228 |
|
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); |
| 288 |
|
StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 ); |
| 289 |
|
StatusArea->SetName(_T("StatusArea")); |
| 290 |
|
StatusArea->SetFieldsCount(1); |
| 291 |
< |
StatusArea->SetStatusText(_("AE Installer v1.0"), 0); |
| 291 |
> |
string versionText = "AE Installer v" + gInstallerVersion; |
| 292 |
> |
StatusArea->SetStatusText(versionText.c_str(), 0); |
| 293 |
|
itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0); |
| 294 |
|
|
| 295 |
|
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); |
| 352 |
|
ReglobalizeButton->SetName(_T("Reglobalize_Button")); |
| 353 |
|
itemBoxSizer34->Add(ReglobalizeButton, 0, wxGROW|wxALL, 5); |
| 354 |
|
|
| 355 |
< |
// Connect events and objects |
| 355 |
> |
wxStaticLine* itemStaticLine100 = new wxStaticLine( OptionsPanel, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); |
| 356 |
> |
itemBoxSizer25->Add(itemStaticLine100, 0, wxGROW|wxALL, 5); |
| 357 |
> |
|
| 358 |
> |
ChangeDirectoryButton = new wxButton( OptionsPanel, Dir_Button, _("Change Dir"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 359 |
> |
ChangeDirectoryButton->SetName(_T("Dir_Button")); |
| 360 |
> |
itemBoxSizer34->Add(ChangeDirectoryButton, 0, wxGROW|wxALL, 5); |
| 361 |
> |
|
| 362 |
> |
// Connect events and objects |
| 363 |
|
Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this); |
| 364 |
|
////@end MainWindow content construction |
| 365 |
+ |
#ifdef WIN32 |
| 366 |
+ |
Handle = (HWND)GetHWND(); |
| 367 |
+ |
::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList); |
| 368 |
+ |
#endif |
| 369 |
|
|
| 370 |
< |
if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) { |
| 371 |
< |
strImportOption = "-import:sep"; |
| 1113 |
< |
splitInstances = NOT_SPLIT; |
| 1114 |
< |
} |
| 1115 |
< |
else { |
| 1116 |
< |
strImportOption = "-import:nosep"; |
| 1117 |
< |
splitInstances = SPLIT; |
| 1118 |
< |
} |
| 1119 |
< |
|
| 370 |
> |
updateStatus = GetUpdateStatus(¤tAE, &updateAE, &installerJustUpdated); |
| 371 |
> |
|
| 372 |
|
globalPackages = getPackages(); |
| 373 |
|
globalInstalledMods = getInstallString(); |
| 374 |
< |
for (int i = 0; i < globalPackages.size(); i++) { |
| 374 |
> |
for (unsigned int i = 0; i < globalPackages.size(); i++) |
| 375 |
> |
{ |
| 376 |
|
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 377 |
< |
if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 377 |
> |
if (binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName)) Mods_CheckboxList->Check(i); |
| 378 |
|
} |
| 379 |
|
|
| 380 |
|
TheStatusBar = &StatusArea; |
| 381 |
|
TheInstallButton = InstallButton; |
| 382 |
|
TheProgressBar = ProgressBar; |
| 383 |
|
OptionsPanel->Hide(); |
| 384 |
< |
if(splitInstances == SPLIT) SeperatedRadio->SetValue(true); |
| 384 |
> |
|
| 385 |
> |
if(splitInstances) SeperatedRadio->SetValue(true); |
| 386 |
|
else CompleteRadio->SetValue(true); |
| 1133 |
– |
|
| 1134 |
– |
|
| 1135 |
– |
|
| 387 |
|
if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true); |
| 388 |
|
else SepRadio->SetValue(true); |
| 389 |
|
|
| 1139 |
– |
|
| 390 |
|
#ifdef WIN32 |
| 391 |
|
RedirectIOToConsole(); |
| 392 |
|
HWND hWnd = GetConsoleWindow(); |
| 393 |
|
ShowWindow( hWnd, SW_HIDE ); |
| 394 |
|
#endif |
| 1145 |
– |
|
| 1146 |
– |
//MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight() ); |
| 395 |
|
} |
| 396 |
|
|
| 1149 |
– |
|
| 397 |
|
/* |
| 398 |
|
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for SelectAll_Checkbox |
| 399 |
|
*/ |
| 402 |
|
{ |
| 403 |
|
switch(SelectAll->Get3StateValue()) { |
| 404 |
|
case wxCHK_UNCHECKED: |
| 405 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1159 |
< |
//SelectAll->Set3StateValue(wxCHK_CHECKED); |
| 405 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 406 |
|
break; |
| 407 |
|
case wxCHK_CHECKED: |
| 408 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); |
| 1163 |
< |
//SelectAll->Set3StateValue(wxCHK_UNCHECKED); |
| 408 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true); |
| 409 |
|
break; |
| 410 |
|
case wxCHK_UNDETERMINED: |
| 411 |
< |
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1167 |
< |
//SelectAll->Set3StateValue(wxCHK_CHECKED); |
| 411 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 412 |
|
break; |
| 1169 |
– |
|
| 413 |
|
} |
| 1171 |
– |
|
| 414 |
|
} |
| 415 |
|
|
| 1174 |
– |
|
| 416 |
|
/* |
| 417 |
|
* wxEVT_CREATE event handler for Mods_CheckboxList |
| 418 |
|
*/ |
| 420 |
|
void MainWindow::ModList_OnCreate( wxWindowCreateEvent& event ) |
| 421 |
|
{ |
| 422 |
|
|
| 1182 |
– |
|
| 423 |
|
} |
| 424 |
|
|
| 425 |
|
|
| 471 |
|
|
| 472 |
|
wxIcon MainWindow::GetIconResource( const wxString& name ) |
| 473 |
|
{ |
| 1234 |
– |
|
| 474 |
|
// Icon retrieval |
| 475 |
|
////@begin MainWindow icon retrieval |
| 476 |
|
wxUnusedVar(name); |
| 483 |
|
////@end MainWindow icon retrieval |
| 484 |
|
} |
| 485 |
|
|
| 1247 |
– |
|
| 486 |
|
/* |
| 487 |
|
* wxEVT_COMMAND_LISTBOX_SELECTED event handler for Mods_CheckboxList1 |
| 488 |
|
*/ |
| 489 |
|
|
| 490 |
|
void MainWindow::OnModsCheckboxList1Selected( wxCommandEvent& event ) |
| 491 |
|
{ |
| 1254 |
– |
//event.GetSelection |
| 492 |
|
titleText->SetValue(globalPackages[event.GetSelection()].name.c_str()); |
| 493 |
|
creatorText->SetValue(globalPackages[event.GetSelection()].creator.c_str()); |
| 494 |
|
descriptionText->SetValue(globalPackages[event.GetSelection()].readme.c_str()); |
| 1258 |
– |
|
| 1259 |
– |
//creatorText->Refresh(); |
| 495 |
|
} |
| 496 |
|
|
| 1262 |
– |
|
| 497 |
|
/* |
| 498 |
|
* wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event handler for Mods_CheckboxList1 |
| 499 |
|
*/ |
| 527 |
|
|
| 528 |
|
this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());} |
| 529 |
|
else { |
| 530 |
< |
// Uncomment this when we release, it gets annoying if you are testing globalization a lot ;) |
| 1297 |
< |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.", |
| 530 |
> |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.", |
| 531 |
|
"AE Installer Alert", wxOK | wxICON_EXCLAMATION , wxDefaultPosition); |
| 532 |
|
YesNoDialog->ShowModal(); |
| 533 |
|
OptionsPanel->Show(); |
| 536 |
|
} |
| 537 |
|
} |
| 538 |
|
|
| 1306 |
– |
|
| 539 |
|
/* |
| 540 |
|
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT |
| 541 |
|
*/ |
| 545 |
|
exit(0); |
| 546 |
|
} |
| 547 |
|
|
| 1316 |
– |
|
| 548 |
|
/* |
| 549 |
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for Install_Button |
| 550 |
|
*/ |
| 551 |
|
|
| 1321 |
– |
|
| 552 |
|
struct recompile |
| 553 |
|
{ |
| 554 |
|
recompile(vector<string> localPackages) : thePackages(localPackages) { } |
| 557 |
|
TheInstallButton->Disable(); |
| 558 |
|
recompileAll(thePackages); |
| 559 |
|
TheInstallButton->Enable(); |
| 560 |
+ |
|
| 561 |
|
} |
| 1331 |
– |
|
| 562 |
|
vector<string> thePackages; |
| 563 |
|
}; |
| 564 |
|
|
| 565 |
+ |
void globalize2(void) { |
| 566 |
+ |
TheInstallButton->Disable(); |
| 567 |
+ |
globalizeData(); |
| 568 |
+ |
TheInstallButton->Enable(); |
| 569 |
+ |
} |
| 570 |
+ |
|
| 571 |
|
void MainWindow::OnInstallButtonClick( wxCommandEvent& event ) |
| 572 |
|
{ |
| 1337 |
– |
|
| 573 |
|
vector<string> localPackages; |
| 574 |
< |
localPackages.push_back("Globalize"); |
| 575 |
< |
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); |
| 574 |
> |
localPackages.push_back("00000Globalize"); |
| 575 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); |
| 576 |
|
if ( !localPackages.empty() ) { |
| 577 |
< |
|
| 578 |
< |
//MainWindow::MainWindow().Hide(); |
| 1344 |
< |
// boost::thread thrd2(recompileAll(localPackages) ); |
| 1345 |
< |
//MainWindow::MainWindow().Show(); |
| 577 |
> |
sort(localPackages.begin(), localPackages.end()); |
| 578 |
> |
localPackages[0] = "Globalize"; |
| 579 |
|
this->InstallButton->Disable(); |
| 580 |
|
this->ReglobalizeButton->Disable(); |
| 581 |
|
#ifdef WIN32 |
| 584 |
|
#else |
| 585 |
|
recompileAll(localPackages); |
| 586 |
|
#endif |
| 1354 |
– |
|
| 587 |
|
this->InstallButton->Enable(); |
| 588 |
|
this->ReglobalizeButton->Enable(); |
| 589 |
|
} |
| 1358 |
– |
|
| 1359 |
– |
|
| 590 |
|
} |
| 591 |
|
|
| 592 |
< |
/*void setStatusArea( string s ) { |
| 593 |
< |
//TheStatusBar = MainWindow::StatusArea; |
| 594 |
< |
(**TheStatusBar).SetStatusText(_(s.c_str()), 0); |
| 595 |
< |
|
| 596 |
< |
//MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1); |
| 597 |
< |
|
| 598 |
< |
//MainWindow::StatusBar->SetLabel("Importing Files..."); |
| 599 |
< |
//StatusBar->SetLabel(s); |
| 600 |
< |
//->SetLabel(s); |
| 601 |
< |
|
| 602 |
< |
}*/ |
| 603 |
< |
|
| 1374 |
< |
void setProgressBar( int i ) { |
| 1375 |
< |
//TheProgressBar->SetValue( |
| 1376 |
< |
|
| 592 |
> |
void setProgressBar( int i ) |
| 593 |
> |
{ |
| 594 |
> |
#ifdef WIN32 |
| 595 |
> |
if (SUCCEEDED(pTaskbarList->QueryInterface(IID_ITaskbarList3, (void **)&pTaskbarList3))) |
| 596 |
> |
{ |
| 597 |
> |
pTaskbarList3->SetProgressValue(Handle,i, 1000); |
| 598 |
> |
if ( i == 0 ) |
| 599 |
> |
{ |
| 600 |
> |
pTaskbarList3->SetProgressState(Handle,TBPF_NOPROGRESS); |
| 601 |
> |
} |
| 602 |
> |
} |
| 603 |
> |
#endif |
| 604 |
|
TheProgressBar->SetValue(i); |
| 1378 |
– |
|
| 605 |
|
} |
| 606 |
|
|
| 1381 |
– |
|
| 607 |
|
/* |
| 608 |
|
* wxEVT_UPDATE_UI event handler for ID_STATUSBAR |
| 609 |
|
*/ |
| 616 |
|
////@end wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. |
| 617 |
|
} |
| 618 |
|
|
| 1394 |
– |
|
| 619 |
|
/* |
| 620 |
|
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT |
| 621 |
|
*/ |
| 625 |
|
////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. |
| 626 |
|
// Before editing this code, remove the block markers. |
| 627 |
|
About* window = new About(this); |
| 628 |
< |
int returnValue = window->ShowModal(); |
| 628 |
> |
window->ShowModal(); |
| 629 |
|
window->Destroy(); |
| 630 |
|
////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. |
| 631 |
|
} |
| 632 |
|
|
| 1409 |
– |
|
| 633 |
|
/* |
| 634 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton |
| 635 |
|
*/ |
| 636 |
< |
|
| 636 |
> |
|
| 637 |
|
void MainWindow::OnNoSepRadioButtonSelected( wxCommandEvent& event ) |
| 638 |
|
{ |
| 639 |
|
static_cast<string>("-import:nosep"); |
| 640 |
|
} |
| 641 |
|
|
| 1419 |
– |
|
| 642 |
|
/* |
| 643 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Sep_RadioButton |
| 644 |
|
*/ |
| 648 |
|
static_cast<string>("-import:sep"); |
| 649 |
|
} |
| 650 |
|
|
| 1429 |
– |
|
| 651 |
|
/* |
| 652 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton |
| 653 |
|
*/ |
| 658 |
|
|
| 659 |
|
void MainWindow::OnCompleteRadioButtonSelected( wxCommandEvent& event ) |
| 660 |
|
{ |
| 661 |
< |
splitInstances = NOT_SPLIT; |
| 1441 |
< |
|
| 661 |
> |
splitInstances = false; |
| 662 |
|
} |
| 663 |
|
|
| 1444 |
– |
|
| 664 |
|
/* |
| 665 |
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON |
| 666 |
|
*/ |
| 667 |
|
|
| 668 |
|
void MainWindow::OnRefreshButtonClick( wxCommandEvent& event ) |
| 669 |
|
{ |
| 670 |
+ |
globalPackages = getPackages(); |
| 671 |
|
refreshMods(globalInstalledMods); |
| 672 |
|
} |
| 673 |
|
|
| 1454 |
– |
|
| 674 |
|
/* |
| 675 |
|
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD |
| 676 |
|
*/ |
| 677 |
|
|
| 678 |
< |
|
| 679 |
< |
|
| 1461 |
< |
|
| 1462 |
< |
void MainWindow::refreshMods (vector<string> s) { |
| 1463 |
< |
|
| 678 |
> |
void MainWindow::refreshMods (vector<string> s) |
| 679 |
> |
{ |
| 680 |
|
Mods_CheckboxList->Clear(); |
| 681 |
< |
//globalInstalledMods = getPackages(); |
| 1466 |
< |
for (int i = 0; i < globalPackages.size(); i++) { |
| 681 |
> |
for (unsigned int i = 0; i < globalPackages.size(); i++) { |
| 682 |
|
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 683 |
< |
if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 684 |
< |
//else Mods_CheckboxList->Check(i,0); |
| 1470 |
< |
|
| 683 |
> |
if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) |
| 684 |
> |
Mods_CheckboxList->Check(i); |
| 685 |
|
} |
| 686 |
|
} |
| 687 |
|
|
| 701 |
|
{ |
| 702 |
|
refreshMods(getInstallString( string(openFileDialog->GetPath()) )); |
| 703 |
|
} |
| 1490 |
– |
|
| 1491 |
– |
|
| 704 |
|
} |
| 705 |
|
|
| 1494 |
– |
|
| 706 |
|
/* |
| 707 |
|
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE |
| 708 |
|
*/ |
| 721 |
|
|
| 722 |
|
if ( openFileDialog->ShowModal() == wxID_OK ) |
| 723 |
|
{ |
| 1513 |
– |
|
| 1514 |
– |
|
| 1515 |
– |
//Mods_CheckboxList-> |
| 1516 |
– |
|
| 1517 |
– |
|
| 1518 |
– |
|
| 1519 |
– |
// |
| 1520 |
– |
|
| 724 |
|
if ( exists( openFileDialog->GetPath().c_str() ) ) |
| 725 |
|
{ |
| 726 |
|
remove( openFileDialog->GetPath().c_str() ); |
| 729 |
|
ofstream file(openFileDialog->GetPath().c_str()); |
| 730 |
|
|
| 731 |
|
vector<string>list; |
| 732 |
< |
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); |
| 732 |
> |
for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); |
| 733 |
|
vector<string>::iterator begin_iter = list.begin(); |
| 734 |
|
vector<string>::iterator end_iter = list.end(); |
| 735 |
|
|
| 741 |
|
|
| 742 |
|
file.close(); |
| 743 |
|
file.clear(); |
| 1541 |
– |
|
| 1542 |
– |
//SetCurrentFilename(openFileDialog->GetFilename()); |
| 1543 |
– |
//theText->LoadFile(openFileDialog->GetFilename()); |
| 1544 |
– |
//SetStatusText(GetCurrentFilename(), 0); |
| 1545 |
– |
//SetStatusText(openFileDialog->GetDirectory(),1); |
| 744 |
|
} |
| 745 |
|
} |
| 746 |
|
|
| 1549 |
– |
|
| 1550 |
– |
|
| 747 |
|
/* |
| 748 |
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ReGlobalize_Button |
| 749 |
|
*/ |
| 750 |
|
|
| 751 |
|
void MainWindow::OnReGlobalizeButtonClick( wxCommandEvent& event ) |
| 752 |
|
{ |
| 753 |
< |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: This will DELETE the Edition's GameDataFolder and recreate it from the vanilla Oni game data. \n Are you SURE you want to do this? ", "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition); |
| 754 |
< |
|
| 755 |
< |
if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no... |
| 753 |
> |
string YesNoMsg = "WARNING: This will DELETE the Edition's GameDataFolder and recreate it from the vanilla Oni game data.\n"; |
| 754 |
> |
YesNoMsg = YesNoMsg + "Are you SURE you want to do this?"; |
| 755 |
> |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, YesNoMsg.c_str(), "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION , wxDefaultPosition); |
| 756 |
|
|
| 757 |
+ |
if (YesNoDialog->ShowModal() == wxID_NO) |
| 758 |
+ |
{ |
| 759 |
+ |
//if the user said no... |
| 760 |
|
} |
| 761 |
< |
else { |
| 762 |
< |
|
| 761 |
> |
else |
| 762 |
> |
{ |
| 763 |
|
this->InstallButton->Disable(); |
| 764 |
|
this->ReglobalizeButton->Disable(); |
| 1566 |
– |
|
| 765 |
|
#ifdef WIN32 |
| 1568 |
– |
|
| 766 |
|
boost::thread thrd2(globalizeData); |
| 767 |
|
//globalizeData(); |
| 768 |
|
//boost::thread::create_thread(&globalizeData); |
| 771 |
|
#else |
| 772 |
|
globalizeData(); |
| 773 |
|
#endif |
| 1577 |
– |
|
| 774 |
|
this->InstallButton->Enable(); |
| 775 |
|
this->ReglobalizeButton->Enable(); |
| 776 |
|
} |
| 1581 |
– |
|
| 777 |
|
} |
| 778 |
|
/* |
| 779 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton |
| 780 |
|
*/ |
| 781 |
|
|
| 1587 |
– |
/*void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event ) |
| 1588 |
– |
{ |
| 1589 |
– |
////@begin wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. |
| 1590 |
– |
// Before editing this code, remove the block markers. |
| 1591 |
– |
event.Skip(); |
| 1592 |
– |
////@end wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. |
| 1593 |
– |
}*/ |
| 1594 |
– |
|
| 1595 |
– |
|
| 782 |
|
/* |
| 783 |
|
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Seperated_RadioButton |
| 784 |
|
*/ |
| 785 |
|
|
| 786 |
|
void MainWindow::OnSeperatedRadioButtonSelected( wxCommandEvent& event ) |
| 787 |
|
{ |
| 788 |
< |
splitInstances = SPLIT; |
| 788 |
> |
splitInstances = true; |
| 789 |
|
} |
| 790 |
|
|
| 791 |
+ |
void MainWindow::OnDirButtonClick( wxCommandEvent& event ) |
| 792 |
+ |
{ |
| 793 |
+ |
wxDirDialog* newDir = new wxDirDialog(this, "Set current directory", "", wxDD_DEFAULT_STYLE, |
| 794 |
+ |
wxDefaultPosition, wxDefaultSize, "wxDirCtrl"); |
| 795 |
+ |
newDir->ShowModal(); |
| 796 |
+ |
if(newDir->GetPath()[0]) current_path( (path)newDir->GetPath() ); |
| 797 |
+ |
OnRefreshButtonClick(event); |
| 798 |
+ |
} |