| 1 |
|
/* |
| 2 |
|
AE/Mod Installer |
| 3 |
– |
v1.0 |
| 3 |
|
by Gumby and Iritscen |
| 4 |
< |
*/ |
| 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> |
| 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 |
| 30 |
|
#include <dirent.h> |
| 31 |
|
#endif |
| 32 |
|
|
| 33 |
< |
const string strInstallerVersion = "1.0"; |
| 33 |
> |
//const string strInstallerVersion = "1.0"; |
| 34 |
|
const bool SPLIT = 1; |
| 35 |
|
const bool NOT_SPLIT = 0; |
| 36 |
|
bool splitInstances = SPLIT; |
| 37 |
< |
|
| 37 |
> |
bool busy = 0; |
| 38 |
|
#ifdef WIN32 |
| 39 |
|
const string strOniSplit = "Onisplit.exe"; |
| 40 |
|
string strImportOption = "-import:nosep"; |
| 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 |
|
|
| 51 |
– |
/* |
| 52 |
– |
int main(void) |
| 53 |
– |
{ |
| 54 |
– |
if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) splitInstances = NOT_SPLIT; |
| 55 |
– |
else splitInstances = NOT_SPLIT; |
| 56 |
– |
// SetConsoleTitle("AE Installer"); windows junk, convert to SDL |
| 57 |
– |
#ifdef WIN32 |
| 58 |
– |
system("color 0A"); |
| 59 |
– |
#endif |
| 60 |
– |
cout << "\nWelcome to the AE installer!\n"; |
| 61 |
– |
cout << "\nWhat would you like to do?\n"; |
| 62 |
– |
|
| 63 |
– |
return mainMenu(); |
| 64 |
– |
} |
| 65 |
– |
*/ |
| 66 |
– |
|
| 55 |
|
|
| 56 |
|
|
| 57 |
< |
int mainMenu(void) |
| 58 |
< |
{ |
| 59 |
< |
char choice = '0'; |
| 72 |
< |
bool exit = false; |
| 73 |
< |
int err = 0; |
| 74 |
< |
do |
| 75 |
< |
{ |
| 76 |
< |
if( exists( "../GameDataFolder" ) ) { |
| 77 |
< |
cout << "\n1. Add new packages\n"; |
| 78 |
< |
cout << "2. Remove packages\n"; |
| 79 |
< |
cout << "3. See what is installed\n"; |
| 80 |
< |
cout << "4. Globalize data\n"; |
| 81 |
< |
cout << "5. About AE\n"; |
| 82 |
< |
cout << "6. Quit\n\n"; |
| 83 |
< |
|
| 84 |
< |
choice = cin.get(); |
| 85 |
< |
cin.ignore(128, '\n'); |
| 86 |
< |
switch(choice) |
| 87 |
< |
{ |
| 88 |
< |
case '1': |
| 89 |
< |
err = installPackages(); |
| 90 |
< |
break; |
| 91 |
< |
case '2': |
| 92 |
< |
err = uninstallPackages(); |
| 93 |
< |
break; |
| 94 |
< |
case '3': |
| 95 |
< |
err = listInstalledPackages(); |
| 96 |
< |
break; |
| 97 |
< |
case '4': |
| 98 |
< |
err = globalizeData(); |
| 99 |
< |
break; |
| 100 |
< |
case '5': |
| 101 |
< |
err = printInstallerInfo(); |
| 102 |
< |
break; |
| 103 |
< |
case '6': |
| 104 |
< |
exit = true; |
| 105 |
< |
break; |
| 106 |
< |
default: |
| 107 |
< |
cout << "Please choose one of the above numbers, and press Enter.\n\n"; |
| 108 |
< |
} |
| 109 |
< |
if (err) // if something fatal happened |
| 110 |
< |
exit = true; |
| 111 |
< |
} |
| 112 |
< |
else { |
| 113 |
< |
cout << "\n1. Globalize data\n"; |
| 114 |
< |
cout << "2. About AE\n"; |
| 115 |
< |
cout << "3. Quit\n\n"; |
| 116 |
< |
|
| 117 |
< |
choice = cin.get(); |
| 118 |
< |
cin.ignore(128, '\n'); |
| 119 |
< |
switch(choice) |
| 120 |
< |
{ |
| 121 |
< |
case '1': |
| 122 |
< |
err = globalizeData(); |
| 123 |
< |
break; |
| 124 |
< |
case '2': |
| 125 |
< |
err = printInstallerInfo(); |
| 126 |
< |
break; |
| 127 |
< |
case '3': |
| 128 |
< |
exit = true; |
| 129 |
< |
break; |
| 130 |
< |
default: |
| 131 |
< |
cout << "Please choose one of the above numbers, and press Enter.\n\n"; |
| 132 |
< |
} |
| 133 |
< |
if (err) // if something fatal happened |
| 134 |
< |
exit = true; |
| 135 |
< |
} |
| 136 |
< |
} while(!exit); |
| 137 |
< |
|
| 138 |
< |
return err; |
| 139 |
< |
} |
| 57 |
> |
#include "boost/date_time/gregorian/gregorian.hpp" |
| 58 |
> |
#include "boost/date_time/date_parsing.hpp" |
| 59 |
> |
#include "boost/date_time/posix_time/posix_time.hpp" |
| 60 |
|
|
| 61 |
|
int globalizeData(void) |
| 62 |
|
{ |
| 63 |
+ |
busy = 1; |
| 64 |
+ |
using boost::lexical_cast; |
| 65 |
+ |
using boost::bad_lexical_cast; |
| 66 |
+ |
// using namespace boost::posix_time; |
| 67 |
+ |
using namespace boost::gregorian; |
| 68 |
+ |
using namespace boost::posix_time; |
| 69 |
+ |
ptime start_time(second_clock::local_time()); |
| 70 |
+ |
|
| 71 |
+ |
setStatusArea("Globalizing!"); |
| 72 |
|
int err = 0; |
| 73 |
< |
|
| 73 |
> |
int parts_done = 0; |
| 74 |
> |
char Step_x_x[300]; |
| 75 |
> |
//char levels[i][5]; |
| 76 |
> |
remove("Globalize.log"); |
| 77 |
> |
ofstream logfile("Globalize.log"); |
| 78 |
> |
logfile << "Globalization started " << to_simple_string(start_time) << endl; |
| 79 |
|
try { |
| 80 |
< |
int levels[15] = {0, 1, 2, 3, 4, 6, 8, 9, 10, 11, 12, 13, 14, 18, 19}; // the levels Oni has |
| 80 |
> |
|
| 81 |
> |
char levels_cstr[15][3] = {"0", "1", "2", "3", "4", "6", "8", "9", "10", "11", "12", "13", "14", "18", "19"}; // the levels Oni has...probably should have made a string array. Oops. |
| 82 |
> |
//const vector<double> ck(cv, &cv[CvSize]); |
| 83 |
> |
vector<string> levels; |
| 84 |
> |
for (int f = 0; f < 15; f++) { |
| 85 |
> |
levels.push_back(levels_cstr[f]); |
| 86 |
> |
} |
| 87 |
|
char choice = 0; |
| 88 |
< |
|
| 88 |
> |
|
| 89 |
|
//SetCurrentDirectory("C:/Program Files/Oni/edition/install"); |
| 90 |
< |
char levelnum[3]; |
| 90 |
> |
///char levels[i][3]; |
| 91 |
|
path Characters = "../GameDataFolder/level0_Characters"; |
| 92 |
|
path Particles = "../GameDataFolder/level0_Particles"; |
| 93 |
|
path Archive = "../GameDataFolder/Archive"; |
| 96 |
|
path Animations = "../GameDataFolder/level0_Animations"; |
| 97 |
|
path TRAC = Animations / "level0_TRAC"; |
| 98 |
|
path TRAM = Animations / "level0_TRAM"; |
| 99 |
+ |
|
| 100 |
+ |
vector<path> GDFPaths; |
| 101 |
+ |
GDFPaths.push_back(Characters); |
| 102 |
+ |
GDFPaths.push_back(Particles); |
| 103 |
+ |
GDFPaths.push_back(Textures); |
| 104 |
+ |
GDFPaths.push_back(Sounds); |
| 105 |
+ |
GDFPaths.push_back(TRAC); |
| 106 |
+ |
GDFPaths.push_back(TRAM); |
| 107 |
+ |
|
| 108 |
+ |
|
| 109 |
+ |
path VanillaCharacters = "packages/VanillaDats/level0_Final/level0_Characters/level0_Characters.oni"; |
| 110 |
+ |
path VanillaParticles = "packages/VanillaDats/level0_Final/level0_Particles/level0_Particles.oni"; |
| 111 |
+ |
path VanillaTextures = "packages/VanillaDats/level0_Final/level0_Textures/level0_Textures.oni"; |
| 112 |
+ |
path VanillaSounds = "packages/VanillaDats/level0_Final/level0_Sounds/level0_Sounds.oni"; |
| 113 |
+ |
path VanillaAnimations = "packages/VanillaDats/level0_Final/level0_Animations/level0_Animations.oni"; |
| 114 |
+ |
path VanillaTRAC = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAC.oni"; |
| 115 |
+ |
path VanillaTRAM = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAM.oni"; |
| 116 |
+ |
|
| 117 |
+ |
vector<path> VanillaPaths; |
| 118 |
+ |
|
| 119 |
+ |
VanillaPaths.push_back(VanillaCharacters); |
| 120 |
+ |
VanillaPaths.push_back(VanillaParticles); |
| 121 |
+ |
VanillaPaths.push_back(VanillaTextures); |
| 122 |
+ |
VanillaPaths.push_back(VanillaSounds); |
| 123 |
+ |
VanillaPaths.push_back(VanillaTRAC); |
| 124 |
+ |
VanillaPaths.push_back(VanillaTRAM); |
| 125 |
+ |
|
| 126 |
|
/* |
| 127 |
< |
if (exists("../GameDataFolder/")) |
| 128 |
< |
{ |
| 129 |
< |
//cout << "\nIt looks like you've already globalized Oni's data.\nDo you want to re-globalize?\n(This will erase existing mods installed to the AE's game data.)" |
| 130 |
< |
// << "\n1. Re-globalize" |
| 131 |
< |
// << "\n2. Return to main menu\n"; |
| 132 |
< |
//choice = cin.get(); |
| 133 |
< |
cin.ignore(128, '\n'); |
| 134 |
< |
if (choice == '1') |
| 135 |
< |
remove_all("../GameDataFolder"); // remove AE GDF |
| 136 |
< |
if (choice == '2') |
| 137 |
< |
return 0; |
| 138 |
< |
} |
| 139 |
< |
*/ |
| 127 |
> |
if (exists("../GameDataFolder/")) |
| 128 |
> |
{ |
| 129 |
> |
//cout << "\nIt looks like you've already globalized Oni's data.\nDo you want to re-globalize?\n(This will erase existing mods installed to the AE's game data.)" |
| 130 |
> |
// << "\n1. Re-globalize" |
| 131 |
> |
// << "\n2. Return to main menu\n"; |
| 132 |
> |
//choice = cin.get(); |
| 133 |
> |
cin.ignore(128, '\n'); |
| 134 |
> |
if (choice == '1') |
| 135 |
> |
remove_all("../GameDataFolder"); // remove AE GDF |
| 136 |
> |
if (choice == '2') |
| 137 |
> |
return 0; |
| 138 |
> |
} |
| 139 |
> |
*/ |
| 140 |
> |
setStatusArea("Removing old GameDataFolder...\n"); |
| 141 |
> |
logfile << "Removing old GameDataFolder...\n"; |
| 142 |
> |
remove_all( "../GameDataFolder/" ); |
| 143 |
> |
setStatusArea("Creating needed directories..."); |
| 144 |
> |
logfile << "Creating needed directories...\n"; |
| 145 |
|
create_directory( "../GameDataFolder/" ); |
| 146 |
+ |
|
| 147 |
|
create_directory( "packages" ); |
| 148 |
< |
if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats"); |
| 148 |
> |
|
| 149 |
> |
if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats"); |
| 150 |
|
create_directory( "packages/VanillaDats" ); |
| 177 |
– |
|
| 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 ); |
| 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 |
|
{ |
| 174 |
< |
sprintf(levelnum,"%d",levels[i]); // int to char array |
| 175 |
< |
exists("../../GameDataFolder/level" + (string)levelnum + "_Final"); |
| 176 |
< |
system((strOniSplit + " -export ../GameDataFolder/level" + (string)levelnum + "_Final ../../GameDataFolder/level" + (string)levelnum + "_Final.dat").c_str()); |
| 177 |
< |
|
| 178 |
< |
create_directory( "packages/VanillaDats/level" + (string)levelnum + "_Final" ); //remember to cast your arrays as strings :) |
| 179 |
< |
create_directory( "packages/VanillaDats/level" + (string)levelnum + "_Final/level" + (string)levelnum + "_Final" ); |
| 180 |
< |
|
| 181 |
< |
directory_iterator end_iter; |
| 182 |
< |
for ( directory_iterator dir_itr( "../GameDataFolder/level" + (string)levelnum + "_Final" ); dir_itr != end_iter; ++dir_itr ) |
| 183 |
< |
{ |
| 184 |
< |
//cout << dir_itr->path().filename(); |
| 185 |
< |
if ( is_regular_file( dir_itr->status() ) ) |
| 174 |
> |
|
| 175 |
> |
//printf(levels[i],"%d",levels[i]); // int to char array |
| 176 |
> |
|
| 177 |
> |
if (exists("../../GameDataFolder/level" + levels[i] + "_Final.dat")) { |
| 178 |
> |
logfile << "level" << levels[i] << "_Final\n"; |
| 179 |
> |
logfile << "\tExporting level" << levels[i] << "_Final.dat\n"; |
| 180 |
> |
//printf(Step_x_x,"Step %d/%d: exporting level%d_final.dat", parts_done + 1,, levels[i]); setStatusArea((string)Step_x_x); |
| 181 |
> |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " exporting level" + levels[i]+"_Final.dat"); |
| 182 |
> |
create_directory( "../GameDataFolder/level" + levels[i] + "_Final" ); |
| 183 |
> |
// setStatusArea(strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat"); |
| 184 |
> |
system((strOniSplit + " -export ../GameDataFolder/level" + levels[i] + "_Final ../../GameDataFolder/level" + levels[i] + "_Final.dat").c_str()); |
| 185 |
> |
create_directory( "packages/VanillaDats/level" + levels[i] + "_Final" ); |
| 186 |
> |
create_directory( "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final" ); |
| 187 |
> |
|
| 188 |
> |
directory_iterator end_iter; |
| 189 |
> |
for ( directory_iterator dir_itr( "../GameDataFolder/level" + levels[i] + "_Final" ); dir_itr != end_iter; ++dir_itr ) |
| 190 |
|
{ |
| 191 |
< |
|
| 192 |
< |
if ( dir_itr->path().filename().substr(0,8) == "TXMPfail" || |
| 205 |
< |
dir_itr->path().filename().substr(0,9) == "TXMPlevel" || |
| 206 |
< |
( dir_itr->path().filename().substr(0,4) == "TXMP" && dir_itr->path().filename().find("intro")!=string::npos) || |
| 207 |
< |
dir_itr->path().filename().substr(0,4) == "TXMB" || |
| 208 |
< |
dir_itr->path().filename() == "M3GMpowerup_lsi.oni" || |
| 209 |
< |
dir_itr->path().filename() == "TXMPlsi_icon.oni" || |
| 210 |
< |
( 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()); |
| 245 |
< |
} |
| 246 |
< |
else if (dir_itr->path().filename().substr(0,4) == "AGDB" |
| 247 |
< |
|| dir_itr->path().filename().substr(0,4) == "TRCM") { |
| 248 |
< |
cout <<dir_itr->path().filename() << "\n"; |
| 249 |
< |
|
| 250 |
< |
if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename()); |
| 251 |
< |
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 |
> |
else if (dir_itr->path().filename().substr(0,4) == "ONWC") { //fix for buggy ONWC overriding |
| 264 |
> |
cout <<dir_itr->path().filename() << "\n"; |
| 265 |
> |
|
| 266 |
> |
if(!exists( "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final/" + dir_itr->filename())) rename(dir_itr->path(), "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final/" + dir_itr->filename()); |
| 267 |
> |
else remove(dir_itr->path()); |
| 268 |
> |
} |
| 269 |
> |
if (exists(dir_itr->path())) { |
| 270 |
> |
|
| 271 |
> |
} |
| 272 |
> |
else { |
| 273 |
> |
//logfile << "\tMoved file: " << dir_itr->path().filename() << "\n"; |
| 274 |
> |
} |
| 275 |
|
} |
| 276 |
+ |
|
| 277 |
+ |
|
| 278 |
+ |
|
| 279 |
|
} |
| 280 |
< |
|
| 281 |
< |
|
| 280 |
> |
logfile << "\tCleaning up TXMPs...\n"; |
| 281 |
> |
system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + levels[i] + "_Final/TXMP*.oni").c_str()); |
| 282 |
> |
parts_done++; |
| 283 |
> |
|
| 284 |
> |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 285 |
> |
|
| 286 |
|
} |
| 275 |
– |
system( (strOniSplit + " -move:delete " + Textures.string() + " ../GameDataFolder/level" + (string)levelnum + "_Final/TXMP*.oni").c_str()); |
| 276 |
– |
|
| 287 |
|
} |
| 288 |
< |
|
| 288 |
> |
logfile << "Reimporting levels\n"; |
| 289 |
|
for (int i = 0; i < 15; i++) |
| 290 |
|
{ |
| 291 |
< |
sprintf(levelnum,"%d",levels[i]); |
| 292 |
< |
system( (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levelnum + "_Final packages/VanillaDats/level" + levelnum + "_Final/level" |
| 293 |
< |
+ levelnum + "_Final/level" + levelnum + "_Final.oni").c_str()); |
| 291 |
> |
logfile << "\tReimporting level" << levels[i] << "_Final.oni\n"; |
| 292 |
> |
//printf(levels[i],"%d",levels[i]); |
| 293 |
> |
//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"); |
| 294 |
> |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + " reimporting level" + levels[i]+"_Final.oni"); |
| 295 |
> |
logfile << (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level" |
| 296 |
> |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log").c_str() << '\n'; |
| 297 |
> |
string sys_str = (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level" |
| 298 |
> |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize2.log"); |
| 299 |
> |
system(sys_str.c_str() ); |
| 300 |
> |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 301 |
> |
parts_done++; |
| 302 |
|
} |
| 285 |
– |
path VanillaCharacters = "packages/VanillaDats/level0_Final/level0_Characters/level0_Characters.oni"; |
| 286 |
– |
path VanillaParticles = "packages/VanillaDats/level0_Final/level0_Particles/level0_Particles.oni"; |
| 287 |
– |
path VanillaTextures = "packages/VanillaDats/level0_Final/level0_Textures/level0_Textures.oni"; |
| 288 |
– |
path VanillaSounds = "packages/VanillaDats/level0_Final/level0_Sounds/level0_Sounds.oni"; |
| 289 |
– |
path VanillaAnimations = "packages/VanillaDats/level0_Final/level0_Animations/level0_Animations.oni"; |
| 290 |
– |
path VanillaTRAC = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAC.oni"; |
| 291 |
– |
path VanillaTRAM = "packages/VanillaDats/level0_Final/level0_Animations/level0_TRAM.oni"; |
| 303 |
|
create_directory( VanillaCharacters.parent_path() ); |
| 304 |
|
create_directory( VanillaParticles.parent_path() ); |
| 305 |
|
create_directory( VanillaTextures.parent_path() ); |
| 306 |
|
create_directory( VanillaSounds.parent_path() ); |
| 307 |
|
create_directory( VanillaAnimations.remove_filename() ); |
| 308 |
+ |
|
| 309 |
+ |
for(int j = 0; j < GDFPaths.size(); j++) { |
| 310 |
+ |
logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n"; |
| 311 |
+ |
setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() ); |
| 312 |
+ |
system((strOniSplit + " " + strImportOption + " " + GDFPaths[j].string() + " " + VanillaPaths[j].string()).c_str()); |
| 313 |
+ |
parts_done++; |
| 314 |
+ |
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 315 |
+ |
} |
| 316 |
+ |
/* |
| 317 |
+ |
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) )); |
| 318 |
|
system((strOniSplit + " " + strImportOption + " " + Characters.string() + " " + VanillaCharacters.string()).c_str()); |
| 319 |
+ |
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) )); |
| 320 |
|
system((strOniSplit + " " + strImportOption + " " + Particles.string() + " " + VanillaParticles.string()).c_str()); |
| 321 |
+ |
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) )); |
| 322 |
|
system((strOniSplit + " " + strImportOption + " " + Textures.string() + " " + VanillaTextures.string()).c_str()); |
| 323 |
|
//system((strOniSplit + " " + strImportOption + (string)" " + Animations.string() + (string)" " + VanillaAnimations.string()).c_str()); |
| 324 |
+ |
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) )); |
| 325 |
|
system((strOniSplit + " " + strImportOption + " " + TRAC.string() + " " + VanillaTRAC.string()).c_str()); |
| 326 |
+ |
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) )); |
| 327 |
|
system((strOniSplit + " " + strImportOption + " " + Sounds.string() + " " + VanillaSounds.string()).c_str()); |
| 328 |
< |
system((strOniSplit + " " + strImportOption + " " + TRAM.string() + " " + VanillaTRAM.string()).c_str()); |
| 329 |
< |
|
| 330 |
< |
create_directory("../GameDataFolder/IGMD"); |
| 328 |
> |
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) )); |
| 329 |
> |
system((strOniSplit + " " + strImportOption + " " + TRAM.string() + " " + VanillaTRAM.string()).c_str()); |
| 330 |
> |
//parts_done++; setStatusArea((string)"Copying level scripts...");setProgressBar( (int)(1000 * (float)(parts_done) / (float)(7 + 2 * num_levels) )); |
| 331 |
> |
if (exists("../GameDataFolder/IGMD")) remove_all("../GameDataFolder/IGMD"); |
| 332 |
> |
*/ |
| 333 |
> |
create_directory((path)"../GameDataFolder/IGMD"); |
| 334 |
|
copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); |
| 335 |
< |
} |
| 336 |
< |
catch (exception ex) { |
| 337 |
< |
cout << ex.what(); |
| 338 |
< |
} |
| 311 |
< |
return err; |
| 312 |
< |
} |
| 335 |
> |
setProgressBar( 1000 ); |
| 336 |
> |
|
| 337 |
> |
// 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/ |
| 338 |
> |
// or we could just include it in the zip in the proper place already. |
| 339 |
|
|
| 340 |
< |
int installPackages(void) |
| 341 |
< |
{ |
| 342 |
< |
bool installed_something = 0; |
| 343 |
< |
int err = 0; |
| 344 |
< |
ModPackage package; |
| 345 |
< |
vector<string> installed_packages; |
| 346 |
< |
vector<ModPackage> packages; |
| 347 |
< |
vector<ModPackage>::iterator iter; |
| 348 |
< |
vector<string> installString; |
| 349 |
< |
|
| 350 |
< |
iter = packages.begin(); |
| 351 |
< |
packages = getPackages(); |
| 352 |
< |
vector<string> installedMods = getInstallString(); |
| 353 |
< |
|
| 354 |
< |
if (packages.empty()) |
| 355 |
< |
{ |
| 356 |
< |
cout << "Error: You have no packages!\n"; |
| 331 |
< |
return 0; |
| 332 |
< |
} |
| 333 |
< |
|
| 334 |
< |
cout << "Detecting installed packages...\n"; |
| 335 |
< |
|
| 336 |
< |
int index = 1; |
| 337 |
< |
char choice = '0'; |
| 338 |
< |
|
| 339 |
< |
for (vector<ModPackage>::iterator package_iter = packages.begin(); package_iter != packages.end(); ++package_iter) |
| 340 |
< |
{ |
| 341 |
< |
if (!binary_search(installedMods.begin(), installedMods.end(), package_iter->modStringName)) |
| 342 |
< |
{ //package_iter->isInstalled :< I forgot about this... |
| 343 |
< |
//cout << index << " "; |
| 344 |
< |
system(strClsCmd); |
| 345 |
< |
cout << (*package_iter).name << "\n"; |
| 346 |
< |
for (int character = 1; character <= (*package_iter).name.length() - 1; character++) cout << '-'; |
| 347 |
< |
cout << "\n" |
| 348 |
< |
<< (*package_iter).readme << "\n\n" |
| 349 |
< |
<< "Please enter a number choice\n" |
| 350 |
< |
<< " 1. Add\n" |
| 351 |
< |
<< " 2. Don't Add\n" |
| 352 |
< |
<< ""; |
| 353 |
< |
index++; |
| 354 |
< |
choice = 0; |
| 355 |
< |
|
| 356 |
< |
do |
| 357 |
< |
{ |
| 358 |
< |
choice = cin.get(); |
| 359 |
< |
cin.ignore(1280, '\n'); |
| 360 |
< |
} while(choice == 0); |
| 361 |
< |
|
| 362 |
< |
if (choice == '1') |
| 363 |
< |
{ |
| 364 |
< |
cout << "\nInstalling...\n\n"; |
| 365 |
< |
if (package_iter->hasOnis || (package_iter->hasDeltas /*(*package_iter).isUnpacked */ )) |
| 366 |
< |
{ |
| 367 |
< |
installed_something = 1; |
| 368 |
< |
installedMods.push_back(package_iter->modStringName); |
| 369 |
< |
system(strPauseCmd); |
| 370 |
< |
} |
| 371 |
< |
} |
| 372 |
< |
} |
| 373 |
< |
} |
| 374 |
< |
if (index == 1) |
| 375 |
< |
{ |
| 376 |
< |
cout << "Warning: All packages are already installed\n"; |
| 377 |
< |
//would you like to recombine your data? |
| 378 |
< |
return 0; |
| 379 |
< |
} |
| 380 |
< |
if (installed_something == 0) |
| 381 |
< |
{ |
| 382 |
< |
cout << "Warning: You didn't add anything!\n"; |
| 383 |
< |
//would you like to recombine your data? |
| 384 |
< |
return 0; |
| 385 |
< |
} |
| 386 |
< |
|
| 387 |
< |
sort(installedMods.begin(), installedMods.end()); |
| 388 |
< |
//system(Onisplit.c_str()); |
| 389 |
< |
recompileAll(installedMods); |
| 390 |
< |
system(strPauseCmd); |
| 391 |
< |
|
| 392 |
< |
return err; |
| 393 |
< |
} |
| 340 |
> |
copy("../../persist.dat","../persist.dat"); |
| 341 |
> |
copy("../../keyconfig.txt","../keyconfig.txt"); |
| 342 |
> |
#ifndef WIN32 |
| 343 |
> |
/* 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). |
| 344 |
> |
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, |
| 345 |
> |
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 */ |
| 346 |
> |
path fullAEpath = system_complete("."); // get full path for Installer |
| 347 |
> |
char prefsCommand[300] = "defaults write com.godgames.oni RetailInstallationPath -string '"; |
| 348 |
> |
strcat(prefsCommand, fullAEpath.parent_path().parent_path().string().c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF) |
| 349 |
> |
strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters |
| 350 |
> |
system(prefsCommand); |
| 351 |
> |
|
| 352 |
> |
#endif |
| 353 |
> |
|
| 354 |
> |
|
| 355 |
> |
setStatusArea((string)"Done! Now select your mod packages and click install."); |
| 356 |
> |
// while(1) Sleep(-1); |
| 357 |
|
|
| 395 |
– |
int uninstallPackages(void) |
| 396 |
– |
{ |
| 397 |
– |
int err = 0; |
| 398 |
– |
ModPackage package; |
| 399 |
– |
vector<string> installed_packages; |
| 400 |
– |
vector<ModPackage> packages; |
| 401 |
– |
vector<ModPackage>::iterator iter; |
| 402 |
– |
vector<string> installString; |
| 403 |
– |
|
| 404 |
– |
iter = packages.begin(); |
| 405 |
– |
packages = getPackages(); |
| 406 |
– |
|
| 407 |
– |
|
| 408 |
– |
cout << "Detecting installed packages...\n"; |
| 409 |
– |
|
| 410 |
– |
vector<string> installedMods = getInstallString(); |
| 411 |
– |
|
| 412 |
– |
if (packages.empty()) |
| 413 |
– |
{ |
| 414 |
– |
cout << "Error: You have no packages!\n"; |
| 415 |
– |
return 0; |
| 358 |
|
} |
| 359 |
< |
|
| 360 |
< |
int index = 0; |
| 419 |
< |
int uninstalled_something = 0; |
| 420 |
< |
char choice = '0'; |
| 421 |
< |
|
| 422 |
< |
for (vector<ModPackage>::iterator package_iter = packages.begin(); package_iter != packages.end(); ++package_iter) |
| 423 |
< |
{ |
| 424 |
< |
if (binary_search(installedMods.begin(), installedMods.end(), package_iter->modStringName)) |
| 425 |
< |
{ //package_iter->isInstalled :< I forgot about this... |
| 426 |
< |
//cout << index << " "; |
| 427 |
< |
system(strClsCmd); |
| 428 |
< |
cout << (*package_iter).name << "\n"; |
| 429 |
< |
for (int character = 1; character <= (*package_iter).name.length() - 1; character++) cout << '-'; |
| 430 |
< |
cout << "\n" |
| 431 |
< |
<< (*package_iter).readme << "\n\n" |
| 432 |
< |
<< "Please enter a number choice\n" |
| 433 |
< |
<< " 1. Remove\n" |
| 434 |
< |
<< " 2. Don't Remove\n" |
| 435 |
< |
<< ""; |
| 436 |
< |
|
| 437 |
< |
choice = 0; |
| 438 |
< |
|
| 439 |
< |
do |
| 440 |
< |
{ |
| 441 |
< |
choice = cin.get(); |
| 442 |
< |
cin.ignore(1280, '\n'); |
| 443 |
< |
} while(choice == 0); |
| 444 |
< |
|
| 445 |
< |
if (choice == '1') |
| 446 |
< |
{ |
| 447 |
< |
cout << "\nUninstalling...\n\n"; |
| 448 |
< |
installedMods.erase( installedMods.begin() + (index) ); |
| 449 |
< |
system(strPauseCmd); |
| 450 |
< |
uninstalled_something = 1; |
| 451 |
< |
|
| 452 |
< |
} |
| 453 |
< |
else { |
| 454 |
< |
index++; |
| 455 |
< |
} |
| 456 |
< |
} |
| 359 |
> |
catch (exception ex) { |
| 360 |
> |
setStatusArea("Warning, handled exception: " + (string)ex.what()); |
| 361 |
|
} |
| 458 |
– |
if ( uninstalled_something == 0 ) |
| 459 |
– |
{ |
| 460 |
– |
if (index == 0) //bad practice, I need to implement a second vector or something. Meh. |
| 461 |
– |
{ |
| 462 |
– |
cout << "\nWarning: You have no installed packages!"; |
| 463 |
– |
} |
| 464 |
– |
else |
| 465 |
– |
{ |
| 466 |
– |
cout << "\nWarning: You didn't remove anything!"; |
| 467 |
– |
} |
| 468 |
– |
//would you like to recombine your data? |
| 469 |
– |
return 0; |
| 470 |
– |
|
| 471 |
– |
} |
| 472 |
– |
sort(installedMods.begin(), installedMods.end()); |
| 473 |
– |
//system(Onisplit.c_str()); |
| 474 |
– |
recompileAll(installedMods); |
| 475 |
– |
system(strPauseCmd); |
| 476 |
– |
|
| 477 |
– |
return err; |
| 478 |
– |
} |
| 362 |
|
|
| 363 |
< |
int listInstalledPackages(void) |
| 364 |
< |
{ |
| 365 |
< |
cout << "\nThis feature not yet implemented.\n\n"; |
| 366 |
< |
|
| 367 |
< |
return 0; |
| 363 |
> |
ptime end_time(second_clock::local_time()); |
| 364 |
> |
time_period total_time (start_time, end_time); |
| 365 |
> |
logfile << "\n\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); |
| 366 |
> |
//total_time.length().hours(); |
| 367 |
> |
logfile.close(); |
| 368 |
> |
busy = 0; |
| 369 |
> |
return err; |
| 370 |
|
} |
| 371 |
|
|
| 487 |
– |
int printInstallerInfo(void) |
| 488 |
– |
{ |
| 489 |
– |
cout << "\nAE/Mod Installer\n"; |
| 490 |
– |
cout << "version " << strInstallerVersion << "\n"; |
| 491 |
– |
cout << "by Gumby & Iritscen\n"; |
| 492 |
– |
cout << "see http://oni.bungie.org/community/forums for more info\n\n"; |
| 493 |
– |
|
| 494 |
– |
return 0; |
| 495 |
– |
} |
| 372 |
|
|
| 373 |
|
vector<ModPackage> getPackages(void) |
| 374 |
|
{ |
| 377 |
|
fstream file; |
| 378 |
|
string filename = "\0"; |
| 379 |
|
string MODINFO_CFG = "Mod_Info.cfg"; |
| 380 |
< |
|
| 380 |
> |
|
| 381 |
|
try |
| 382 |
|
{ |
| 383 |
|
directory_iterator end_iter; |
| 385 |
|
{ |
| 386 |
|
file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str()); |
| 387 |
|
//cout << filename << "\n"; |
| 388 |
< |
|
| 388 |
> |
|
| 389 |
|
if(!file.fail()) |
| 390 |
|
{ |
| 391 |
|
//cout << dir_itr->path().string() + MODINFO_CFG; |
| 395 |
|
file.close(); |
| 396 |
|
file.clear(); |
| 397 |
|
} |
| 398 |
+ |
sort(packages.begin(), packages.end()); |
| 399 |
|
} |
| 400 |
|
catch (const std::exception & ex) |
| 401 |
|
{ |
| 402 |
|
cout << "Warning, something odd happened!\n"; |
| 403 |
|
} |
| 404 |
< |
|
| 404 |
> |
|
| 405 |
|
return packages; |
| 406 |
|
} |
| 407 |
|
|
| 408 |
|
ModPackage fileToModPackage(fstream &file) |
| 409 |
|
{ |
| 410 |
|
/* |
| 411 |
< |
This converts a file to a ModPackage struct. |
| 412 |
< |
|
| 413 |
< |
A few notes... |
| 414 |
< |
"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. |
| 415 |
< |
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 |
| 416 |
< |
slower than reading a variable. |
| 417 |
< |
*/ |
| 411 |
> |
This converts a file to a ModPackage struct. |
| 412 |
> |
|
| 413 |
> |
A few notes... |
| 414 |
> |
"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. |
| 415 |
> |
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 |
| 416 |
> |
slower than reading a variable. |
| 417 |
> |
*/ |
| 418 |
|
ModPackage package; |
| 419 |
|
string line; |
| 420 |
|
static string NameOfMod = "NameOfMod"; //used for comparing to the current token... |
| 439 |
|
if (tokens.capacity() >= 2) { //make sure they are using enough stuff |
| 440 |
|
iter = tokens.begin(); //what word we are on, starts at first word |
| 441 |
|
/* |
| 442 |
< |
if (!AEInstallVersion.compare(*iter)) |
| 443 |
< |
If mod is too old, skip this mod. |
| 444 |
< |
*/ |
| 442 |
> |
if (!AEInstallVersion.compare(*iter)) |
| 443 |
> |
If mod is too old, skip this mod. |
| 444 |
> |
*/ |
| 445 |
|
/*else*/if (!NameOfMod.compare(*iter)) { //if it contains the name |
| 446 |
|
for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { //interates through the words, ends if it reaches the end of the line or a "//" comment |
| 447 |
|
if (ARROW.compare(*iter) && NameOfMod.compare(*iter)) { //ignores "->" and "NameOfMod" |
| 450 |
|
package.name += *iter + " "; |
| 451 |
|
} |
| 452 |
|
} |
| 453 |
< |
|
| 453 |
> |
|
| 454 |
|
} |
| 455 |
|
else if (!ModString.compare(*iter)) { |
| 456 |
|
iter++; iter++; |
| 462 |
|
iter++; iter++; |
| 463 |
|
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 |
| 464 |
|
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, |
| 465 |
< |
iter++; iter++;} // using "YFR" would probably set it off. :< |
| 466 |
< |
|
| 465 |
> |
iter++; iter++;} // using "YFR" would probably set it off. :< |
| 466 |
> |
|
| 467 |
|
if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasBSL = 1; |
| 468 |
|
} |
| 469 |
|
else if (!HasDeltas.compare(*iter)) { |
| 510 |
|
} |
| 511 |
|
} |
| 512 |
|
} |
| 513 |
< |
|
| 513 |
> |
|
| 514 |
|
} |
| 515 |
|
package.doOutput(); |
| 516 |
|
return package; |
| 518 |
|
|
| 519 |
|
void recompileAll(vector<string> installedMods) |
| 520 |
|
{ |
| 521 |
< |
#ifdef WIN32 |
| 522 |
< |
RedirectIOToConsole(); |
| 523 |
< |
HWND hWnd = GetConsoleWindow(); |
| 524 |
< |
ShowWindow( hWnd, SW_HIDE ); |
| 525 |
< |
#endif |
| 521 |
> |
busy = 1; |
| 522 |
> |
using namespace boost::gregorian; |
| 523 |
> |
using namespace boost::posix_time; |
| 524 |
> |
using boost::lexical_cast; |
| 525 |
> |
using boost::bad_lexical_cast; |
| 526 |
> |
|
| 527 |
|
setStatusArea("Importing levels..."); |
| 528 |
|
//setStatusArea("Recompiling Data..."); |
| 529 |
|
path vanilla_dir = "./packages/VanillaDats/"; |
| 533 |
|
int j = 1; |
| 534 |
|
string datString; |
| 535 |
|
std::stringstream out; |
| 536 |
< |
|
| 537 |
< |
|
| 536 |
> |
|
| 537 |
> |
ptime start_time(second_clock::local_time()); |
| 538 |
|
clearOldDats(); |
| 539 |
< |
remove("Onisplit.log"); |
| 539 |
> |
remove("Install.log"); |
| 540 |
> |
ofstream logfile("Install.log"); |
| 541 |
> |
logfile << "Mod Installation started " << to_simple_string(start_time) << endl; |
| 542 |
> |
logfile.close(); |
| 543 |
|
if(splitInstances == SPLIT){ |
| 544 |
|
recursive_directory_iterator end_iter; |
| 545 |
< |
|
| 545 |
> |
|
| 546 |
|
for ( recursive_directory_iterator dir_itr( vanilla_dir ); |
| 547 |
< |
dir_itr != end_iter; |
| 548 |
< |
++dir_itr ) |
| 547 |
> |
dir_itr != end_iter; |
| 548 |
> |
++dir_itr ) |
| 549 |
|
{ |
| 550 |
|
try{ |
| 551 |
|
if ( is_directory( dir_itr->status() ) && dir_itr.level() == 1) |
| 554 |
|
} |
| 555 |
|
} |
| 556 |
|
catch(exception ex) { |
| 557 |
< |
|
| 557 |
> |
|
| 558 |
|
} |
| 559 |
|
} |
| 560 |
< |
|
| 560 |
> |
|
| 561 |
|
//recursive_directory_iterator end_iter; |
| 562 |
< |
|
| 563 |
< |
|
| 562 |
> |
|
| 563 |
> |
|
| 564 |
|
out << numberOfDats; |
| 565 |
|
datString = out.str(); |
| 566 |
|
try { |
| 567 |
|
for ( recursive_directory_iterator dir_itr( vanilla_dir ); |
| 568 |
< |
dir_itr != end_iter; |
| 569 |
< |
++dir_itr ) |
| 568 |
> |
dir_itr != end_iter; |
| 569 |
> |
++dir_itr ) |
| 570 |
|
{ |
| 571 |
|
try |
| 572 |
|
{ |
| 576 |
|
for (int i = 0; i < installedMods.size(); ++i) { |
| 577 |
|
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename() )) |
| 578 |
|
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename(); |
| 579 |
< |
|
| 579 |
> |
|
| 580 |
|
//else cout << " packages/VanillaDats/" + installedMods[i] + "/oni/"; |
| 581 |
|
} |
| 582 |
< |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Onisplit.log"; |
| 582 |
> |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log"; |
| 583 |
> |
|
| 584 |
|
|
| 703 |
– |
sprintf(statusString,"%d/%i\0",j,numberOfDats); |
| 585 |
|
setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats |
| 586 |
< |
setStatusArea("Importing " + dir_itr->path().filename() + " " + statusString); |
| 587 |
< |
|
| 586 |
> |
setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " + dir_itr->path().filename() + " "); |
| 587 |
> |
|
| 588 |
|
system(importCommand.c_str()); |
| 589 |
|
//Sleep(1000); |
| 590 |
|
//cout << importCommand << "\n"; |
| 591 |
|
j++; |
| 592 |
< |
|
| 592 |
> |
|
| 593 |
|
} |
| 594 |
|
} |
| 595 |
|
catch ( const std::exception & ex ) |
| 596 |
|
{ |
| 597 |
< |
cout << "Warning, exception " << ex.what() << "!"; |
| 597 |
> |
|
| 598 |
> |
remove("Install.log"); |
| 599 |
> |
ofstream logfile("Install.log"); |
| 600 |
> |
|
| 601 |
> |
|
| 602 |
> |
logfile << "Warning, exception " << ex.what() << "!"; |
| 603 |
> |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 604 |
> |
logfile.close(); |
| 605 |
|
} |
| 606 |
|
} |
| 607 |
< |
|
| 607 |
> |
|
| 608 |
|
} |
| 609 |
|
catch( const std::exception & ex ) { |
| 610 |
< |
cout << "Warning, exception " << ex.what() << "!\n" |
| 611 |
< |
<< "You probably need to re-globalize."; |
| 612 |
< |
//create_directory( "./packages/VanillaDats" ); |
| 610 |
> |
|
| 611 |
> |
remove("Install.log"); |
| 612 |
> |
ofstream logfile("Install.log"); |
| 613 |
> |
|
| 614 |
> |
|
| 615 |
> |
logfile << "Warning, exception " << ex.what() << "!"; |
| 616 |
> |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 617 |
> |
logfile.close(); |
| 618 |
|
} |
| 619 |
< |
|
| 619 |
> |
|
| 620 |
|
} |
| 621 |
|
else if(splitInstances == NOT_SPLIT){ |
| 622 |
|
directory_iterator end_iter; |
| 623 |
< |
|
| 623 |
> |
|
| 624 |
|
for ( directory_iterator dir_itr( vanilla_dir ); |
| 625 |
< |
dir_itr != end_iter; |
| 626 |
< |
++dir_itr ) |
| 625 |
> |
dir_itr != end_iter; |
| 626 |
> |
++dir_itr ) |
| 627 |
|
{ |
| 628 |
< |
|
| 628 |
> |
|
| 629 |
|
if ( is_directory( dir_itr->status() ) ) |
| 630 |
|
{ |
| 631 |
|
numberOfDats++; |
| 632 |
|
} |
| 633 |
< |
|
| 634 |
< |
|
| 633 |
> |
|
| 634 |
> |
|
| 635 |
|
} |
| 636 |
< |
|
| 636 |
> |
|
| 637 |
|
out << numberOfDats; |
| 638 |
|
datString = out.str(); |
| 639 |
< |
|
| 639 |
> |
|
| 640 |
|
for ( directory_iterator dir_itr( vanilla_dir ); |
| 641 |
< |
dir_itr != end_iter; |
| 642 |
< |
++dir_itr ) |
| 641 |
> |
dir_itr != end_iter; |
| 642 |
> |
++dir_itr ) |
| 643 |
|
{ |
| 644 |
|
try |
| 645 |
|
{ |
| 646 |
|
if ( is_directory( dir_itr->status() ) ) |
| 647 |
|
{ |
| 648 |
< |
importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " " + "../GameDataFolder/" + dir_itr->path().filename() |
| 756 |
< |
+ ".dat"; |
| 648 |
> |
importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " "; |
| 649 |
|
for (int i = 0; i < installedMods.size(); ++i) { |
| 650 |
|
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename() )) |
| 651 |
|
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename(); |
| 652 |
|
} |
| 653 |
< |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat"; |
| 654 |
< |
|
| 655 |
< |
sprintf(statusString,"%d/%i\0",j,numberOfDats); |
| 653 |
> |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log"; |
| 654 |
> |
|
| 655 |
> |
|
| 656 |
|
setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats |
| 657 |
< |
setStatusArea("Importing " + dir_itr->path().filename() + " " + statusString); |
| 658 |
< |
|
| 657 |
> |
setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " + dir_itr->path().filename() + " "); |
| 658 |
> |
|
| 659 |
|
system(importCommand.c_str()); |
| 660 |
< |
|
| 660 |
> |
|
| 661 |
|
j++; |
| 662 |
|
} |
| 663 |
|
} |
| 664 |
|
catch ( const std::exception & ex ) |
| 665 |
|
{ |
| 666 |
< |
cout << "Warning, something odd happened!\n"; |
| 667 |
< |
} |
| 668 |
< |
} |
| 666 |
> |
|
| 667 |
> |
remove("Install.log"); |
| 668 |
> |
ofstream logfile("Install.log"); |
| 669 |
> |
|
| 670 |
> |
|
| 671 |
> |
logfile << "Warning, exception " << ex.what() << "!"; |
| 672 |
> |
setStatusArea("Warning, exception " + (string)ex.what() + "!"); |
| 673 |
> |
logfile.close(); |
| 674 |
> |
}} |
| 675 |
|
} |
| 676 |
+ |
logfile << "Writing config file"; |
| 677 |
|
writeInstalledMods(installedMods); |
| 678 |
|
setProgressBar(1000); |
| 679 |
< |
setStatusArea("Done!"); |
| 680 |
< |
sleep(1000); |
| 679 |
> |
setStatusArea("Done! You can now play Oni."); |
| 680 |
> |
|
| 681 |
> |
ptime end_time(second_clock::local_time()); |
| 682 |
> |
time_period total_time (start_time, end_time); |
| 683 |
> |
|
| 684 |
> |
|
| 685 |
> |
ofstream logfile2("Install.log", ios::app | ios::ate); |
| 686 |
> |
string outstring = (string)"\n\nGlobalization ended " + to_simple_string(end_time) + "\nThe process took ";// + (string)total_time.length(); |
| 687 |
> |
|
| 688 |
> |
logfile2 << "\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length(); |
| 689 |
> |
|
| 690 |
> |
//logfile2.write(outstring.c_str(), outstring.length()); |
| 691 |
> |
logfile2.close(); |
| 692 |
> |
|
| 693 |
> |
//total_time.length().hours(); |
| 694 |
> |
|
| 695 |
> |
Sleep(1000); |
| 696 |
|
setProgressBar(0); |
| 697 |
< |
|
| 697 |
> |
busy = 0; |
| 698 |
|
} |
| 699 |
|
|
| 700 |
|
void writeInstalledMods(vector<string> installedMods) |
| 701 |
|
{ |
| 702 |
< |
|
| 702 |
> |
|
| 703 |
|
if ( exists( strInstallCfg ) ) |
| 704 |
|
{ |
| 705 |
|
remove( strInstallCfg ); |
| 706 |
|
} |
| 707 |
< |
|
| 707 |
> |
|
| 708 |
|
ofstream file(strInstallCfg.c_str()); |
| 709 |
< |
|
| 709 |
> |
|
| 710 |
|
vector<string>list = installedMods; |
| 711 |
|
vector<string>::iterator begin_iter = list.begin(); |
| 712 |
|
vector<string>::iterator end_iter = list.end(); |
| 713 |
< |
|
| 713 |
> |
|
| 714 |
|
sort( list.begin(), list.end() ); |
| 715 |
< |
|
| 715 |
> |
|
| 716 |
|
for( ; begin_iter != end_iter; ++begin_iter) { |
| 717 |
|
file << *begin_iter << " "; |
| 718 |
|
} |
| 719 |
< |
|
| 719 |
> |
|
| 720 |
|
file.close(); |
| 721 |
|
file.clear(); |
| 722 |
< |
|
| 722 |
> |
|
| 723 |
|
} |
| 724 |
|
|
| 725 |
|
vector<string> getInstallString(string Cfg) |
| 726 |
|
{ |
| 727 |
|
//system(strPauseCmd); |
| 728 |
|
vector<string> returnval; |
| 729 |
< |
|
| 729 |
> |
|
| 730 |
|
string line; |
| 731 |
|
fstream file; |
| 732 |
< |
|
| 732 |
> |
|
| 733 |
|
if (exists( Cfg )) |
| 734 |
|
{ |
| 735 |
|
file.open(Cfg.c_str()); |
| 740 |
|
sort(returnval.begin(), returnval.end()); |
| 741 |
|
} |
| 742 |
|
else cout << "fail"; |
| 743 |
< |
|
| 743 |
> |
|
| 744 |
|
return returnval; |
| 745 |
|
} |
| 746 |
|
|
| 751 |
|
string::size_type lastPos = str.find_first_not_of(delimiters, 0); |
| 752 |
|
// Find first "non-delimiter". |
| 753 |
|
string::size_type pos = str.find_first_of(delimiters, lastPos); |
| 754 |
< |
|
| 754 |
> |
|
| 755 |
|
while (string::npos != pos || string::npos != lastPos) |
| 756 |
|
{ |
| 757 |
|
// Found a token, add it to the vector. |
| 766 |
|
void clearOldDats(void) { |
| 767 |
|
directory_iterator end_iter_gdf; |
| 768 |
|
for ( directory_iterator dir_itr_gdf( "../GameDataFolder" ); |
| 769 |
< |
dir_itr_gdf != end_iter_gdf; |
| 770 |
< |
++dir_itr_gdf ) |
| 769 |
> |
dir_itr_gdf != end_iter_gdf; |
| 770 |
> |
++dir_itr_gdf ) |
| 771 |
|
{ |
| 772 |
|
//cout << dir_itr_gdf->path().extension() << "\n"; |
| 773 |
|
if ( dir_itr_gdf->path().extension() == ".dat" || dir_itr_gdf->path().extension() == ".raw" || dir_itr_gdf->path().extension() == ".sep" ) { |
| 774 |
|
remove( dir_itr_gdf->path() ); |
| 775 |
|
} |
| 776 |
< |
|
| 776 |
> |
|
| 777 |
|
} |
| 778 |
< |
|
| 778 |
> |
|
| 779 |
|
} |
| 780 |
|
|
| 781 |
|
vector<string> globalInstalledMods; |
| 806 |
|
#endif |
| 807 |
|
|
| 808 |
|
////@begin includes |
| 809 |
< |
#include "about_window.h" |
| 809 |
> |
#include "about.h" |
| 810 |
|
////@end includes |
| 811 |
|
|
| 812 |
|
#include "main_window.h" |
| 813 |
|
|
| 814 |
|
////@begin XPM images |
| 815 |
< |
#include "redo.xpm" |
| 815 |
> |
#include "aelogosmall.xpm" |
| 816 |
> |
#include "undo.xpm" |
| 817 |
|
#include "fileopen.xpm" |
| 818 |
|
#include "filesaveas.xpm" |
| 819 |
|
#include "quit.xpm" |
| 823 |
|
//#define wxUSE_UNICODE 1; |
| 824 |
|
|
| 825 |
|
/* |
| 826 |
< |
* MainWindow type definition |
| 827 |
< |
*/ |
| 826 |
> |
* MainWindow type definition |
| 827 |
> |
*/ |
| 828 |
|
|
| 829 |
|
IMPLEMENT_CLASS( MainWindow, wxFrame ) |
| 830 |
|
|
| 831 |
|
|
| 832 |
|
/* |
| 833 |
< |
* MainWindow event table definition |
| 834 |
< |
*/ |
| 833 |
> |
* MainWindow event table definition |
| 834 |
> |
*/ |
| 835 |
|
|
| 836 |
|
BEGIN_EVENT_TABLE( MainWindow, wxFrame ) |
| 837 |
|
|
| 851 |
|
|
| 852 |
|
EVT_RADIOBUTTON( NoSep_RadioButton, MainWindow::OnNoSepRadioButtonSelected ) |
| 853 |
|
|
| 854 |
< |
EVT_RADIOBUTTON( Separated_RadioButton, MainWindow::OnSeparatedRadioButtonSelected ) |
| 854 |
> |
EVT_RADIOBUTTON( Seperated_RadioButton, MainWindow::OnSeperatedRadioButtonSelected ) |
| 855 |
|
|
| 856 |
|
EVT_RADIOBUTTON( Complete_RadioButton, MainWindow::OnCompleteRadioButtonSelected ) |
| 857 |
|
|
| 873 |
|
|
| 874 |
|
|
| 875 |
|
/* |
| 876 |
< |
* MainWindow constructors |
| 877 |
< |
*/ |
| 876 |
> |
* MainWindow constructors |
| 877 |
> |
*/ |
| 878 |
|
|
| 879 |
|
MainWindow::MainWindow() |
| 880 |
|
{ |
| 881 |
< |
Init(); |
| 881 |
> |
Init(); |
| 882 |
|
} |
| 883 |
|
|
| 884 |
|
MainWindow::MainWindow( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) |
| 885 |
|
{ |
| 886 |
< |
Init(); |
| 887 |
< |
Create( parent, id, caption, pos, size, style ); |
| 886 |
> |
Init(); |
| 887 |
> |
Create( parent, id, caption, pos, size, style ); |
| 888 |
|
} |
| 889 |
|
|
| 890 |
|
|
| 891 |
|
/* |
| 892 |
< |
* MainWindow creator |
| 893 |
< |
*/ |
| 892 |
> |
* MainWindow creator |
| 893 |
> |
*/ |
| 894 |
|
|
| 895 |
|
bool MainWindow::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) |
| 896 |
|
{ |
| 897 |
< |
////@begin MainWindow creation |
| 897 |
> |
////@begin MainWindow creation |
| 898 |
|
wxFrame::Create( parent, id, caption, pos, size, style ); |
| 899 |
|
|
| 900 |
|
CreateControls(); |
| 901 |
< |
SetIcon(GetIconResource(wxT("oni_special.ico"))); |
| 901 |
> |
SetIcon(GetIconResource(wxT("aelogosmall.png"))); |
| 902 |
|
Centre(); |
| 903 |
< |
////@end MainWindow creation |
| 904 |
< |
return true; |
| 903 |
> |
////@end MainWindow creation |
| 904 |
> |
return true; |
| 905 |
|
} |
| 906 |
|
|
| 907 |
|
|
| 908 |
|
/* |
| 909 |
< |
* MainWindow destructor |
| 910 |
< |
*/ |
| 909 |
> |
* MainWindow destructor |
| 910 |
> |
*/ |
| 911 |
|
|
| 912 |
|
MainWindow::~MainWindow() |
| 913 |
|
{ |
| 914 |
< |
////@begin MainWindow destruction |
| 915 |
< |
////@end MainWindow destruction |
| 914 |
> |
////@begin MainWindow destruction |
| 915 |
> |
////@end MainWindow destruction |
| 916 |
|
} |
| 917 |
|
|
| 918 |
|
|
| 919 |
|
/* |
| 920 |
< |
* Member initialisation |
| 921 |
< |
*/ |
| 920 |
> |
* Member initialisation |
| 921 |
> |
*/ |
| 922 |
|
|
| 923 |
|
void MainWindow::Init() |
| 924 |
|
{ |
| 925 |
< |
////@begin MainWindow member initialisation |
| 925 |
> |
////@begin MainWindow member initialisation |
| 926 |
|
MainSplitter = NULL; |
| 927 |
|
SelectAll = NULL; |
| 928 |
|
RefreshButton = NULL; |
| 936 |
|
OptionsPanel = NULL; |
| 937 |
|
SepRadio = NULL; |
| 938 |
|
NoSepRadio = NULL; |
| 939 |
< |
SeparatedRadio = NULL; |
| 939 |
> |
SeperatedRadio = NULL; |
| 940 |
|
CompleteRadio = NULL; |
| 941 |
|
ReglobalizeButton = NULL; |
| 942 |
< |
////@end MainWindow member initialisation |
| 942 |
> |
////@end MainWindow member initialisation |
| 943 |
|
|
| 944 |
|
} |
| 945 |
|
|
| 946 |
|
|
| 947 |
|
/* |
| 948 |
< |
* Control creation for MainWindow |
| 949 |
< |
*/ |
| 950 |
< |
wxStatusBar* TheStatusBar; |
| 948 |
> |
* Control creation for MainWindow |
| 949 |
> |
*/ |
| 950 |
> |
wxStatusBar **TheStatusBar; |
| 951 |
|
wxButton* TheInstallButton; |
| 952 |
|
wxGauge* TheProgressBar; |
| 953 |
|
void MainWindow::CreateControls() |
| 954 |
|
{ |
| 955 |
< |
////@begin MainWindow content construction |
| 955 |
> |
////@begin MainWindow content construction |
| 956 |
|
MainWindow* itemFrame1 = this; |
| 957 |
|
|
| 958 |
|
wxMenuBar* menuBar = new wxMenuBar; |
| 981 |
|
itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK); |
| 982 |
|
menuBar->Append(itemMenu42, _("Options")); |
| 983 |
|
wxMenu* itemMenu44 = new wxMenu; |
| 984 |
< |
itemMenu44->Append(wxID_HELP, _("Help"), wxEmptyString, wxITEM_NORMAL); |
| 985 |
< |
itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 986 |
< |
menuBar->Append(itemMenu44, _("Help")); |
| 984 |
> |
#ifdef WIN32 |
| 985 |
> |
itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 986 |
> |
menuBar->Append(itemMenu44, _("Help")); |
| 987 |
> |
#else |
| 988 |
> |
itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 989 |
> |
#endif |
| 990 |
> |
|
| 991 |
|
itemFrame1->SetMenuBar(menuBar); |
| 992 |
|
|
| 993 |
|
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); |
| 994 |
|
itemFrame1->SetSizer(itemBoxSizer2); |
| 995 |
|
|
| 996 |
|
MainSplitter = new wxSplitterWindow( itemFrame1, ID_SPLITTERWINDOW, wxDefaultPosition, wxSize(100, 100), wxSP_LIVE_UPDATE|wxNO_BORDER ); |
| 997 |
< |
MainSplitter->SetMinimumPaneSize(150); |
| 997 |
> |
MainSplitter->SetMinimumPaneSize(1); |
| 998 |
|
MainSplitter->SetName(_T("MainSplitter")); |
| 999 |
|
|
| 1000 |
|
wxPanel* itemPanel4 = new wxPanel( MainSplitter, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); |
| 1008 |
|
SelectAll->SetName(_T("SelectAll_Checkbox")); |
| 1009 |
|
itemBoxSizer6->Add(SelectAll, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); |
| 1010 |
|
|
| 1011 |
< |
RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("redo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); |
| 1011 |
> |
RefreshButton = new wxBitmapButton( itemPanel4, Refresh_Button, itemFrame1->GetBitmapResource(wxT("undo.xpm")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); |
| 1012 |
|
RefreshButton->SetName(_T("RefreshButton")); |
| 1013 |
|
itemBoxSizer6->Add(RefreshButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); |
| 1014 |
|
|
| 1047 |
|
descriptionText->SetBackgroundColour(wxColour(240, 240, 240)); |
| 1048 |
|
itemBoxSizer11->Add(descriptionText, 1, wxGROW|wxLEFT|wxRIGHT, 5); |
| 1049 |
|
|
| 1050 |
< |
MainSplitter->SplitVertically(itemPanel4, itemPanel10, 150); |
| 1050 |
> |
MainSplitter->SplitVertically(itemPanel4, itemPanel10, 200); |
| 1051 |
|
itemBoxSizer2->Add(MainSplitter, 1, wxGROW|wxALL, 0); |
| 1052 |
|
|
| 1053 |
|
StatusArea = new wxStatusBar( itemFrame1, ID_STATUSBAR, 0 ); |
| 1054 |
|
StatusArea->SetName(_T("StatusArea")); |
| 1055 |
|
StatusArea->SetFieldsCount(1); |
| 1056 |
< |
StatusArea->SetStatusText(_("Status Area"), 0); |
| 1056 |
> |
StatusArea->SetStatusText(_("AE Installer v1.0"), 0); |
| 1057 |
|
itemBoxSizer2->Add(StatusArea, 0, wxGROW|wxALL, 0); |
| 1058 |
|
|
| 1059 |
|
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); |
| 1096 |
|
wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxVERTICAL); |
| 1097 |
|
itemBoxSizer25->Add(itemBoxSizer30, 0, wxGROW|wxALL, 5); |
| 1098 |
|
|
| 1099 |
< |
SeparatedRadio = new wxRadioButton( OptionsPanel, Separated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); |
| 1100 |
< |
SeparatedRadio->SetValue(false); |
| 1101 |
< |
SeparatedRadio->SetName(_T("Separated_RadioButton")); |
| 1102 |
< |
itemBoxSizer30->Add(SeparatedRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 1099 |
> |
SeperatedRadio = new wxRadioButton( OptionsPanel, Seperated_RadioButton, _("Separated Level0"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); |
| 1100 |
> |
SeperatedRadio->SetValue(false); |
| 1101 |
> |
SeperatedRadio->SetName(_T("Seperated_RadioButton")); |
| 1102 |
> |
itemBoxSizer30->Add(SeperatedRadio, 0, wxALIGN_LEFT|wxALL, 5); |
| 1103 |
|
|
| 1104 |
|
CompleteRadio = new wxRadioButton( OptionsPanel, Complete_RadioButton, _("Complete Level0"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 1105 |
|
CompleteRadio->SetValue(false); |
| 1118 |
|
|
| 1119 |
|
// Connect events and objects |
| 1120 |
|
Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this); |
| 1121 |
< |
////@end MainWindow content construction |
| 1122 |
< |
|
| 1121 |
> |
////@end MainWindow content construction |
| 1122 |
> |
|
| 1123 |
|
if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) { |
| 1124 |
< |
static_cast<string>("-import:sep"); |
| 1124 |
> |
strImportOption = "-import:sep"; |
| 1125 |
|
splitInstances = NOT_SPLIT; |
| 1126 |
|
} |
| 1127 |
|
else { |
| 1128 |
< |
static_cast<string>("-import:nosep"); |
| 1128 |
> |
strImportOption = "-import:nosep"; |
| 1129 |
|
splitInstances = SPLIT; |
| 1130 |
|
} |
| 1131 |
< |
|
| 1131 |
> |
|
| 1132 |
|
globalPackages = getPackages(); |
| 1133 |
|
globalInstalledMods = getInstallString(); |
| 1134 |
< |
for (int i = 0; i < globalPackages.size(); i++) { |
| 1135 |
< |
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 1136 |
< |
if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 1137 |
< |
} |
| 1219 |
< |
TheStatusBar = StatusArea; |
| 1220 |
< |
TheInstallButton = InstallButton; |
| 1221 |
< |
TheProgressBar = ProgressBar; |
| 1222 |
< |
OptionsPanel->Hide(); |
| 1223 |
< |
if(splitInstances == SPLIT) SeparatedRadio->SetValue(true); |
| 1224 |
< |
else CompleteRadio->SetValue(true); |
| 1225 |
< |
|
| 1226 |
< |
|
| 1227 |
< |
|
| 1228 |
< |
if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true); |
| 1229 |
< |
else SepRadio->SetValue(true); |
| 1134 |
> |
for (int i = 0; i < globalPackages.size(); i++) { |
| 1135 |
> |
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 1136 |
> |
if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 1137 |
> |
} |
| 1138 |
|
|
| 1139 |
< |
//MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight() ); |
| 1139 |
> |
TheStatusBar = &StatusArea; |
| 1140 |
> |
TheInstallButton = InstallButton; |
| 1141 |
> |
TheProgressBar = ProgressBar; |
| 1142 |
> |
OptionsPanel->Hide(); |
| 1143 |
> |
|
| 1144 |
> |
//#ifndef WIN32 |
| 1145 |
> |
// itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 1146 |
> |
|
| 1147 |
> |
//#endif |
| 1148 |
> |
|
| 1149 |
> |
if(splitInstances == SPLIT) SeperatedRadio->SetValue(true); |
| 1150 |
> |
else CompleteRadio->SetValue(true); |
| 1151 |
> |
if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true); |
| 1152 |
> |
else SepRadio->SetValue(true); |
| 1153 |
> |
|
| 1154 |
> |
|
| 1155 |
> |
#ifdef WIN32 |
| 1156 |
> |
RedirectIOToConsole(); |
| 1157 |
> |
HWND hWnd = GetConsoleWindow(); |
| 1158 |
> |
ShowWindow( hWnd, SW_HIDE ); |
| 1159 |
> |
#endif |
| 1160 |
> |
|
| 1161 |
> |
//MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight() ); |
| 1162 |
|
} |
| 1163 |
|
|
| 1164 |
< |
|
| 1164 |
> |
|
| 1165 |
|
/* |
| 1166 |
< |
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for SelectAll_Checkbox |
| 1167 |
< |
*/ |
| 1166 |
> |
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for SelectAll_Checkbox |
| 1167 |
> |
*/ |
| 1168 |
|
|
| 1169 |
|
void MainWindow::OnSelectAllCheckboxClick( wxCommandEvent& event ) |
| 1170 |
|
{ |
| 1171 |
< |
switch(SelectAll->Get3StateValue()) { |
| 1171 |
> |
switch(SelectAll->Get3StateValue()) { |
| 1172 |
|
case wxCHK_UNCHECKED: |
| 1173 |
|
for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false); |
| 1174 |
|
//SelectAll->Set3StateValue(wxCHK_CHECKED); |
| 1183 |
|
break; |
| 1184 |
|
|
| 1185 |
|
} |
| 1186 |
< |
|
| 1186 |
> |
|
| 1187 |
|
} |
| 1188 |
|
|
| 1189 |
|
|
| 1190 |
|
/* |
| 1191 |
< |
* wxEVT_CREATE event handler for Mods_CheckboxList |
| 1192 |
< |
*/ |
| 1191 |
> |
* wxEVT_CREATE event handler for Mods_CheckboxList |
| 1192 |
> |
*/ |
| 1193 |
|
|
| 1194 |
|
void MainWindow::ModList_OnCreate( wxWindowCreateEvent& event ) |
| 1195 |
|
{ |
| 1199 |
|
|
| 1200 |
|
|
| 1201 |
|
/* |
| 1202 |
< |
* Should we show tooltips? |
| 1203 |
< |
*/ |
| 1202 |
> |
* Should we show tooltips? |
| 1203 |
> |
*/ |
| 1204 |
|
|
| 1205 |
|
bool MainWindow::ShowToolTips() |
| 1206 |
|
{ |
| 1207 |
< |
return true; |
| 1207 |
> |
return true; |
| 1208 |
|
} |
| 1209 |
|
|
| 1210 |
|
/* |
| 1211 |
< |
* Get bitmap resources |
| 1212 |
< |
*/ |
| 1211 |
> |
* Get bitmap resources |
| 1212 |
> |
*/ |
| 1213 |
|
|
| 1214 |
|
wxBitmap MainWindow::GetBitmapResource( const wxString& name ) |
| 1215 |
|
{ |
| 1216 |
< |
// Bitmap retrieval |
| 1217 |
< |
////@begin MainWindow bitmap retrieval |
| 1216 |
> |
// Bitmap retrieval |
| 1217 |
> |
////@begin MainWindow bitmap retrieval |
| 1218 |
|
wxUnusedVar(name); |
| 1219 |
< |
if (name == _T("redo.xpm")) |
| 1219 |
> |
if (name == _T("undo.xpm")) |
| 1220 |
|
{ |
| 1221 |
< |
wxBitmap bitmap(redo_xpm); |
| 1221 |
> |
wxBitmap bitmap( undo_xpm); |
| 1222 |
|
return bitmap; |
| 1223 |
|
} |
| 1224 |
|
else if (name == _T("fileopen.xpm")) |
| 1237 |
|
return bitmap; |
| 1238 |
|
} |
| 1239 |
|
return wxNullBitmap; |
| 1240 |
< |
////@end MainWindow bitmap retrieval |
| 1240 |
> |
////@end MainWindow bitmap retrieval |
| 1241 |
|
} |
| 1242 |
|
|
| 1243 |
|
/* |
| 1244 |
< |
* Get icon resources |
| 1245 |
< |
*/ |
| 1244 |
> |
* Get icon resources |
| 1245 |
> |
*/ |
| 1246 |
|
|
| 1247 |
|
wxIcon MainWindow::GetIconResource( const wxString& name ) |
| 1248 |
|
{ |
| 1249 |
< |
// Icon retrieval |
| 1250 |
< |
////@begin MainWindow icon retrieval |
| 1249 |
> |
|
| 1250 |
> |
// Icon retrieval |
| 1251 |
> |
////@begin MainWindow icon retrieval |
| 1252 |
|
wxUnusedVar(name); |
| 1253 |
< |
if (name == _T("oni_special.ico")) |
| 1253 |
> |
if (name == _T("aelogosmall.png")) |
| 1254 |
|
{ |
| 1255 |
< |
wxIcon icon(_T("oni_special.ico"), wxBITMAP_TYPE_ICO); |
| 1255 |
> |
wxIcon icon(aelogosmall_xpm); |
| 1256 |
|
return icon; |
| 1257 |
|
} |
| 1258 |
|
return wxNullIcon; |
| 1259 |
< |
////@end MainWindow icon retrieval |
| 1259 |
> |
////@end MainWindow icon retrieval |
| 1260 |
|
} |
| 1261 |
|
|
| 1262 |
|
|
| 1263 |
|
/* |
| 1264 |
< |
* wxEVT_COMMAND_LISTBOX_SELECTED event handler for Mods_CheckboxList1 |
| 1265 |
< |
*/ |
| 1264 |
> |
* wxEVT_COMMAND_LISTBOX_SELECTED event handler for Mods_CheckboxList1 |
| 1265 |
> |
*/ |
| 1266 |
|
|
| 1267 |
|
void MainWindow::OnModsCheckboxList1Selected( wxCommandEvent& event ) |
| 1268 |
|
{ |
| 1269 |
|
//event.GetSelection |
| 1270 |
< |
titleText->SetLabel(wxT(globalPackages[event.GetSelection()].name.c_str())); |
| 1271 |
< |
creatorText->SetLabel(globalPackages[event.GetSelection()].creator.c_str()); |
| 1272 |
< |
descriptionText->SetLabel(globalPackages[event.GetSelection()].readme.c_str()); |
| 1270 |
> |
titleText->SetValue(globalPackages[event.GetSelection()].name.c_str()); |
| 1271 |
> |
creatorText->SetValue(globalPackages[event.GetSelection()].creator.c_str()); |
| 1272 |
> |
descriptionText->SetValue(globalPackages[event.GetSelection()].readme.c_str()); |
| 1273 |
|
|
| 1274 |
< |
creatorText->Refresh(); |
| 1274 |
> |
//creatorText->Refresh(); |
| 1275 |
|
} |
| 1276 |
|
|
| 1277 |
|
|
| 1278 |
|
/* |
| 1279 |
< |
* wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event handler for Mods_CheckboxList1 |
| 1280 |
< |
*/ |
| 1279 |
> |
* wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event handler for Mods_CheckboxList1 |
| 1280 |
> |
*/ |
| 1281 |
|
|
| 1282 |
|
void MainWindow::OnModsCheckboxList1Toggled( wxCommandEvent& event ) |
| 1283 |
|
{ |
| 1284 |
|
SelectAll->Set3StateValue(wxCHK_UNDETERMINED); |
| 1285 |
|
if(event.GetInt()) { |
| 1286 |
< |
/* |
| 1286 |
> |
/* |
| 1287 |
|
switch(SelectAll->Get3StateValue()) { |
| 1288 |
< |
case wxCHK_UNCHECKED: |
| 1288 |
> |
case wxCHK_UNCHECKED: |
| 1289 |
|
break; |
| 1290 |
< |
case wxCHK_CHECKED: |
| 1290 |
> |
case wxCHK_CHECKED: |
| 1291 |
|
break; |
| 1292 |
< |
case wxCHK_UNDETERMINED : |
| 1292 |
> |
case wxCHK_UNDETERMINED : |
| 1293 |
|
break; |
| 1294 |
< |
} |
| 1295 |
< |
*/ |
| 1294 |
> |
} |
| 1295 |
> |
*/ |
| 1296 |
|
} |
| 1297 |
|
} |
| 1298 |
|
|
| 1299 |
|
|
| 1300 |
|
/* |
| 1301 |
< |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_OPTIONS |
| 1302 |
< |
*/ |
| 1301 |
> |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_OPTIONS |
| 1302 |
> |
*/ |
| 1303 |
|
|
| 1304 |
|
void MainWindow::OnOptionsClick( wxCommandEvent& event ) |
| 1305 |
|
{ |
| 1375 |
– |
|
| 1306 |
|
if (!event.GetInt() ) { |
| 1307 |
|
OptionsPanel->Hide(); |
| 1308 |
< |
MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());} |
| 1308 |
> |
|
| 1309 |
> |
this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-OptionsPanel->GetRect().GetHeight());} |
| 1310 |
|
else { |
| 1311 |
+ |
// Uncomment this when we release, it gets annoying if you are testing globalization a lot ;) |
| 1312 |
+ |
wxMessageDialog* YesNoDialog = new wxMessageDialog(this, "WARNING: These options are for advanced users only, use with caution.", |
| 1313 |
+ |
"AE Installer Alert", wxOK | wxICON_EXCLAMATION , wxDefaultPosition); |
| 1314 |
+ |
YesNoDialog->ShowModal(); |
| 1315 |
|
OptionsPanel->Show(); |
| 1316 |
< |
MainWindow::SetSize(MainWindow::GetRect().GetWidth(), MainWindow::GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()); |
| 1316 |
> |
this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()+OptionsPanel->GetRect().GetHeight()+1); |
| 1317 |
> |
this->SetSize(this->GetRect().GetWidth(), this->GetRect().GetHeight()-1); |
| 1318 |
|
} |
| 1319 |
|
} |
| 1320 |
|
|
| 1321 |
|
|
| 1322 |
|
/* |
| 1323 |
< |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT |
| 1324 |
< |
*/ |
| 1323 |
> |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_EXIT |
| 1324 |
> |
*/ |
| 1325 |
|
|
| 1326 |
|
void MainWindow::OnExitClick( wxCommandEvent& event ) |
| 1327 |
|
{ |
| 1328 |
< |
exit(0); |
| 1328 |
> |
exit(0); |
| 1329 |
|
} |
| 1330 |
|
|
| 1331 |
|
|
| 1332 |
|
/* |
| 1333 |
< |
* wxEVT_COMMAND_BUTTON_CLICKED event handler for Install_Button |
| 1334 |
< |
*/ |
| 1333 |
> |
* wxEVT_COMMAND_BUTTON_CLICKED event handler for Install_Button |
| 1334 |
> |
*/ |
| 1335 |
|
|
| 1336 |
|
|
| 1337 |
|
struct recompile |
| 1338 |
|
{ |
| 1339 |
< |
recompile(vector<string> localPackages) : thePackages(localPackages) { } |
| 1340 |
< |
void operator()() |
| 1341 |
< |
{ |
| 1339 |
> |
recompile(vector<string> localPackages) : thePackages(localPackages) { } |
| 1340 |
> |
void operator()() |
| 1341 |
> |
{ |
| 1342 |
|
TheInstallButton->Disable(); |
| 1343 |
< |
recompileAll(thePackages); |
| 1344 |
< |
TheInstallButton->Enable(); |
| 1345 |
< |
} |
| 1343 |
> |
recompileAll(thePackages); |
| 1344 |
> |
TheInstallButton->Enable(); |
| 1345 |
> |
} |
| 1346 |
|
|
| 1347 |
< |
vector<string> thePackages; |
| 1347 |
> |
vector<string> thePackages; |
| 1348 |
|
}; |
| 1349 |
|
|
| 1350 |
|
void MainWindow::OnInstallButtonClick( wxCommandEvent& event ) |
| 1351 |
|
{ |
| 1352 |
< |
|
| 1352 |
> |
|
| 1353 |
|
vector<string> localPackages; |
| 1354 |
|
localPackages.push_back("Globalize"); |
| 1355 |
|
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName ); |
| 1356 |
|
if ( !localPackages.empty() ) { |
| 1357 |
< |
|
| 1357 |
> |
|
| 1358 |
|
//MainWindow::MainWindow().Hide(); |
| 1359 |
< |
// boost::thread thrd2(recompileAll(localPackages) ); |
| 1359 |
> |
// boost::thread thrd2(recompileAll(localPackages) ); |
| 1360 |
|
//MainWindow::MainWindow().Show(); |
| 1361 |
< |
recompile packages(localPackages); |
| 1362 |
< |
boost::thread thrd(packages); |
| 1361 |
> |
this->InstallButton->Disable(); |
| 1362 |
> |
this->ReglobalizeButton->Disable(); |
| 1363 |
> |
#ifdef WIN32 |
| 1364 |
> |
recompile packages(localPackages); |
| 1365 |
> |
boost::thread thrd(packages); |
| 1366 |
> |
#else |
| 1367 |
> |
recompileAll(localPackages); |
| 1368 |
> |
#endif |
| 1369 |
|
|
| 1370 |
+ |
this->InstallButton->Enable(); |
| 1371 |
+ |
this->ReglobalizeButton->Enable(); |
| 1372 |
|
} |
| 1373 |
< |
|
| 1374 |
< |
|
| 1373 |
> |
|
| 1374 |
> |
|
| 1375 |
|
} |
| 1376 |
|
|
| 1377 |
< |
void setStatusArea( string s ) { |
| 1378 |
< |
TheStatusBar->SetStatusText(_(s.c_str())); |
| 1379 |
< |
|
| 1380 |
< |
//MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1); |
| 1381 |
< |
|
| 1382 |
< |
//MainWindow::StatusBar->SetLabel("Importing Files..."); |
| 1383 |
< |
//StatusBar->SetLabel(s); |
| 1377 |
> |
/*void setStatusArea( string s ) { |
| 1378 |
> |
//TheStatusBar = MainWindow::StatusArea; |
| 1379 |
> |
(**TheStatusBar).SetStatusText(_(s.c_str()), 0); |
| 1380 |
> |
|
| 1381 |
> |
//MainWindow::MainWindow().SetSize(MainWindow::MainWindow().GetRect().GetWidth(), MainWindow::MainWindow().GetRect().GetHeight()+1); |
| 1382 |
> |
|
| 1383 |
> |
//MainWindow::StatusBar->SetLabel("Importing Files..."); |
| 1384 |
> |
//StatusBar->SetLabel(s); |
| 1385 |
|
//->SetLabel(s); |
| 1386 |
< |
|
| 1387 |
< |
} |
| 1386 |
> |
|
| 1387 |
> |
}*/ |
| 1388 |
|
|
| 1389 |
|
void setProgressBar( int i ) { |
| 1390 |
< |
//TheProgressBar->SetValue( |
| 1390 |
> |
//TheProgressBar->SetValue( |
| 1391 |
|
|
| 1392 |
|
TheProgressBar->SetValue(i); |
| 1393 |
|
|
| 1395 |
|
|
| 1396 |
|
|
| 1397 |
|
/* |
| 1398 |
< |
* wxEVT_UPDATE_UI event handler for ID_STATUSBAR |
| 1399 |
< |
*/ |
| 1398 |
> |
* wxEVT_UPDATE_UI event handler for ID_STATUSBAR |
| 1399 |
> |
*/ |
| 1400 |
|
|
| 1401 |
|
void MainWindow::OnStatusbarUpdate( wxUpdateUIEvent& event ) |
| 1402 |
|
{ |
| 1403 |
< |
////@begin wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. |
| 1403 |
> |
////@begin wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. |
| 1404 |
|
// Before editing this code, remove the block markers. |
| 1405 |
|
event.Skip(); |
| 1406 |
< |
////@end wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. |
| 1406 |
> |
////@end wxEVT_UPDATE_UI event handler for ID_STATUSBAR in MainWindow. |
| 1407 |
|
} |
| 1408 |
|
|
| 1409 |
|
|
| 1410 |
|
/* |
| 1411 |
< |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT |
| 1412 |
< |
*/ |
| 1411 |
> |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT |
| 1412 |
> |
*/ |
| 1413 |
|
|
| 1414 |
|
void MainWindow::OnAboutClick( wxCommandEvent& event ) |
| 1415 |
|
{ |
| 1416 |
< |
////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. |
| 1416 |
> |
////@begin wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. |
| 1417 |
|
// Before editing this code, remove the block markers. |
| 1418 |
|
About* window = new About(this); |
| 1419 |
|
int returnValue = window->ShowModal(); |
| 1420 |
|
window->Destroy(); |
| 1421 |
< |
////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. |
| 1421 |
> |
////@end wxEVT_COMMAND_MENU_SELECTED event handler for wxID_ABOUT in MainWindow. |
| 1422 |
|
} |
| 1423 |
|
|
| 1424 |
|
|
| 1425 |
|
/* |
| 1426 |
< |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton |
| 1427 |
< |
*/ |
| 1426 |
> |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for NoSep_RadioButton |
| 1427 |
> |
*/ |
| 1428 |
|
|
| 1429 |
|
void MainWindow::OnNoSepRadioButtonSelected( wxCommandEvent& event ) |
| 1430 |
|
{ |
| 1433 |
|
|
| 1434 |
|
|
| 1435 |
|
/* |
| 1436 |
< |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Sep_RadioButton |
| 1437 |
< |
*/ |
| 1436 |
> |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Sep_RadioButton |
| 1437 |
> |
*/ |
| 1438 |
|
|
| 1439 |
|
void MainWindow::OnSepRadioButtonSelected( wxCommandEvent& event ) |
| 1440 |
|
{ |
| 1443 |
|
|
| 1444 |
|
|
| 1445 |
|
/* |
| 1446 |
< |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton |
| 1447 |
< |
*/ |
| 1503 |
< |
|
| 1504 |
< |
void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event ) |
| 1505 |
< |
{ |
| 1506 |
< |
splitInstances = SPLIT; |
| 1507 |
< |
|
| 1508 |
< |
} |
| 1509 |
< |
|
| 1446 |
> |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton |
| 1447 |
> |
*/ |
| 1448 |
|
|
| 1449 |
|
/* |
| 1450 |
< |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Complete_RadioButton |
| 1451 |
< |
*/ |
| 1450 |
> |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Complete_RadioButton |
| 1451 |
> |
*/ |
| 1452 |
|
|
| 1453 |
|
void MainWindow::OnCompleteRadioButtonSelected( wxCommandEvent& event ) |
| 1454 |
|
{ |
| 1455 |
< |
splitInstances = NOT_SPLIT; |
| 1455 |
> |
splitInstances = NOT_SPLIT; |
| 1456 |
|
|
| 1457 |
|
} |
| 1458 |
|
|
| 1459 |
|
|
| 1460 |
|
/* |
| 1461 |
< |
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON |
| 1462 |
< |
*/ |
| 1461 |
> |
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BITMAPBUTTON |
| 1462 |
> |
*/ |
| 1463 |
|
|
| 1464 |
|
void MainWindow::OnRefreshButtonClick( wxCommandEvent& event ) |
| 1465 |
|
{ |
| 1468 |
|
|
| 1469 |
|
|
| 1470 |
|
/* |
| 1471 |
< |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD |
| 1472 |
< |
*/ |
| 1471 |
> |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_LOAD |
| 1472 |
> |
*/ |
| 1473 |
|
|
| 1474 |
|
|
| 1475 |
|
|
| 1476 |
|
|
| 1477 |
|
void MainWindow::refreshMods (vector<string> s) { |
| 1478 |
< |
|
| 1478 |
> |
|
| 1479 |
|
Mods_CheckboxList->Clear(); |
| 1480 |
< |
//globalInstalledMods = getPackages(); |
| 1481 |
< |
for (int i = 0; i < globalPackages.size(); i++) { |
| 1482 |
< |
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 1483 |
< |
if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 1484 |
< |
//else Mods_CheckboxList->Check(i,0); |
| 1485 |
< |
|
| 1486 |
< |
} |
| 1480 |
> |
//globalInstalledMods = getPackages(); |
| 1481 |
> |
for (int i = 0; i < globalPackages.size(); i++) { |
| 1482 |
> |
Mods_CheckboxList->Append(globalPackages[i].name.c_str()); |
| 1483 |
> |
if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i); |
| 1484 |
> |
//else Mods_CheckboxList->Check(i,0); |
| 1485 |
> |
|
| 1486 |
> |
} |
| 1487 |
|
} |
| 1488 |
|
|
| 1489 |
|
void MainWindow::OnLoadClick( wxCommandEvent& event ) |
| 1490 |
|
{ |
| 1491 |
+ |
if (busy == 1) return; |
| 1492 |
|
static const wxChar *FILETYPES = _T( |
| 1493 |
|
"Mod Loadouts (*.cfg)|*.cfg|" |
| 1494 |
|
"All files (*.*)|*.*" |
| 1495 |
< |
); |
| 1496 |
< |
|
| 1495 |
> |
); |
| 1496 |
> |
|
| 1497 |
|
wxFileDialog* openFileDialog = |
| 1498 |
|
new wxFileDialog( this, _("Open Mod Loadout"), "", "", FILETYPES, |
| 1499 |
< |
wxOPEN, wxDefaultPosition); |
| 1500 |
< |
|
| 1499 |
> |
wxOPEN, wxDefaultPosition); |
| 1500 |
> |
|
| 1501 |
|
if ( openFileDialog->ShowModal() == wxID_OK ) |
| 1502 |
|
{ |
| 1503 |
|
refreshMods(getInstallString( string(openFileDialog->GetPath()) )); |
| 1508 |
|
|
| 1509 |
|
|
| 1510 |
|
/* |
| 1511 |
< |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE |
| 1512 |
< |
*/ |
| 1511 |
> |
* wxEVT_COMMAND_MENU_SELECTED event handler for wxID_SAVE |
| 1512 |
> |
*/ |
| 1513 |
|
|
| 1514 |
|
void MainWindow::OnSaveClick( wxCommandEvent& event ) |
| 1515 |
|
{ |
| 1516 |
+ |
if (busy == 1) return; |
| 1517 |
|
static const wxChar *FILETYPES = _T( |
| 1518 |
|
"Mod Loadouts (*.cfg)|*.cfg|" |
| 1519 |
|
"All files (*.*)|*.*" |
| 1520 |
< |
); |
| 1520 |
> |
); |
| 1521 |
|
|
| 1522 |
< |
wxFileDialog* openFileDialog = |
| 1522 |
> |
wxFileDialog* openFileDialog = |
| 1523 |
|
new wxFileDialog( this, _("Open file"), "", "", FILETYPES, |
| 1524 |
|
wxSAVE, wxDefaultPosition); |
| 1525 |
|
|
| 1526 |
|
if ( openFileDialog->ShowModal() == wxID_OK ) |
| 1527 |
|
{ |
| 1528 |
|
|
| 1529 |
< |
|
| 1530 |
< |
//Mods_CheckboxList-> |
| 1529 |
> |
|
| 1530 |
> |
//Mods_CheckboxList-> |
| 1531 |
|
|
| 1532 |
|
|
| 1533 |
|
|
| 1534 |
|
// |
| 1535 |
< |
|
| 1535 |
> |
|
| 1536 |
|
if ( exists( openFileDialog->GetPath().c_str() ) ) |
| 1537 |
< |
{ |
| 1538 |
< |
remove( openFileDialog->GetPath().c_str() ); |
| 1539 |
< |
} |
| 1537 |
> |
{ |
| 1538 |
> |
remove( openFileDialog->GetPath().c_str() ); |
| 1539 |
> |
} |
| 1540 |
|
|
| 1541 |
< |
ofstream file(openFileDialog->GetPath().c_str()); |
| 1602 |
< |
|
| 1603 |
< |
vector<string>list; |
| 1604 |
< |
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); |
| 1605 |
< |
vector<string>::iterator begin_iter = list.begin(); |
| 1606 |
< |
vector<string>::iterator end_iter = list.end(); |
| 1541 |
> |
ofstream file(openFileDialog->GetPath().c_str()); |
| 1542 |
|
|
| 1543 |
< |
sort( list.begin(), list.end() ); |
| 1543 |
> |
vector<string>list; |
| 1544 |
> |
for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName ); |
| 1545 |
> |
vector<string>::iterator begin_iter = list.begin(); |
| 1546 |
> |
vector<string>::iterator end_iter = list.end(); |
| 1547 |
|
|
| 1548 |
< |
for( ; begin_iter != end_iter; ++begin_iter) { |
| 1549 |
< |
file << *begin_iter << " "; |
| 1550 |
< |
} |
| 1551 |
< |
|
| 1552 |
< |
file.close(); |
| 1553 |
< |
file.clear(); |
| 1548 |
> |
sort( list.begin(), list.end() ); |
| 1549 |
> |
|
| 1550 |
> |
for( ; begin_iter != end_iter; ++begin_iter) { |
| 1551 |
> |
file << *begin_iter << " "; |
| 1552 |
> |
} |
| 1553 |
> |
|
| 1554 |
> |
file.close(); |
| 1555 |
> |
file.clear(); |
| 1556 |
|
|
| 1557 |
|
//SetCurrentFilename(openFileDialog->GetFilename()); |
| 1558 |
|
//theText->LoadFile(openFileDialog->GetFilename()); |
| 1562 |
|
} |
| 1563 |
|
|
| 1564 |
|
|
| 1565 |
+ |
|
| 1566 |
|
/* |
| 1567 |
< |
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ReGlobalize_Button |
| 1568 |
< |
*/ |
| 1567 |
> |
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ReGlobalize_Button |
| 1568 |
> |
*/ |
| 1569 |
|
|
| 1570 |
|
void MainWindow::OnReGlobalizeButtonClick( wxCommandEvent& event ) |
| 1571 |
|
{ |
| 1572 |
< |
globalizeData(); |
| 1573 |
< |
setProgressBar(1000); |
| 1574 |
< |
setStatusArea("Done!"); |
| 1572 |
> |
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); |
| 1573 |
> |
|
| 1574 |
> |
if (YesNoDialog->ShowModal() == wxID_NO) { //if the user said no... |
| 1575 |
> |
|
| 1576 |
> |
} |
| 1577 |
> |
else { |
| 1578 |
> |
|
| 1579 |
> |
this->InstallButton->Disable(); |
| 1580 |
> |
this->ReglobalizeButton->Disable(); |
| 1581 |
> |
|
| 1582 |
> |
#ifdef WIN32 |
| 1583 |
> |
|
| 1584 |
> |
boost::thread thrd2(globalizeData); |
| 1585 |
> |
//globalizeData(); |
| 1586 |
> |
//boost::thread::create_thread(&globalizeData); |
| 1587 |
> |
// boost::thread_group Tg; |
| 1588 |
> |
// Tg.create_thread( &globalizeData(), this ); |
| 1589 |
> |
#else |
| 1590 |
> |
globalizeData(); |
| 1591 |
> |
#endif |
| 1592 |
> |
|
| 1593 |
> |
this->InstallButton->Enable(); |
| 1594 |
> |
this->ReglobalizeButton->Enable(); |
| 1595 |
> |
} |
| 1596 |
> |
|
| 1597 |
> |
} |
| 1598 |
> |
/* |
| 1599 |
> |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton |
| 1600 |
> |
*/ |
| 1601 |
> |
|
| 1602 |
> |
/*void MainWindow::OnSeparatedRadioButtonSelected( wxCommandEvent& event ) |
| 1603 |
> |
{ |
| 1604 |
> |
////@begin wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. |
| 1605 |
> |
// Before editing this code, remove the block markers. |
| 1606 |
> |
event.Skip(); |
| 1607 |
> |
////@end wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Separated_RadioButton in MainWindow. |
| 1608 |
> |
}*/ |
| 1609 |
> |
|
| 1610 |
> |
|
| 1611 |
> |
/* |
| 1612 |
> |
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for Seperated_RadioButton |
| 1613 |
> |
*/ |
| 1614 |
> |
|
| 1615 |
> |
void MainWindow::OnSeperatedRadioButtonSelected( wxCommandEvent& event ) |
| 1616 |
> |
{ |
| 1617 |
> |
splitInstances = SPLIT; |
| 1618 |
|
} |
| 1619 |
|
|