| 1 |
+ |
#ifndef NTDDI_VERSION |
| 2 |
+ |
#define NTDDI_VERSION NTDDI_WIN7 |
| 3 |
+ |
#endif |
| 4 |
+ |
#ifdef WIN32 |
| 5 |
+ |
#include <windows.h> |
| 6 |
+ |
#include <shobjidl.h> |
| 7 |
+ |
HWND Handle; |
| 8 |
+ |
|
| 9 |
+ |
ITaskbarList *pTaskbarList; |
| 10 |
+ |
ITaskbarList3 *pTaskbarList3; |
| 11 |
+ |
#endif |
| 12 |
+ |
|
| 13 |
|
/* |
| 14 |
|
AE/Mod Installer |
| 15 |
|
by Gumby and Iritscen |
| 70 |
|
#include "boost/date_time/date_parsing.hpp" |
| 71 |
|
#include "boost/date_time/posix_time/posix_time.hpp" |
| 72 |
|
|
| 73 |
+ |
string escapePath(string input) { |
| 74 |
+ |
|
| 75 |
+ |
string output; |
| 76 |
+ |
string escape_me = "& ;()|<>\"'\\#*?$"; |
| 77 |
+ |
for(int i = 0; i < input.size(); i++) { |
| 78 |
+ |
for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\'; |
| 79 |
+ |
output += input[i]; |
| 80 |
+ |
} |
| 81 |
+ |
return output; |
| 82 |
+ |
} |
| 83 |
+ |
|
| 84 |
|
int globalizeData(void) |
| 85 |
|
{ |
| 86 |
|
busy = 1; |
| 171 |
|
|
| 172 |
|
if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats"); |
| 173 |
|
create_directory( "packages/VanillaDats" ); |
| 151 |
– |
|
| 174 |
|
create_directory( "packages/VanillaDats/level0_Final/" ); |
| 175 |
|
//blah blah finish this. |
| 176 |
|
//logfile << "packages/VanillaDats/level0_Final/ created"; |
| 283 |
|
if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename()); |
| 284 |
|
else remove(dir_itr->path()); |
| 285 |
|
} |
| 286 |
+ |
else if (dir_itr->path().filename().substr(0,4) == "ONWC") { //fix for buggy ONWC overriding |
| 287 |
+ |
cout <<dir_itr->path().filename() << "\n"; |
| 288 |
+ |
|
| 289 |
+ |
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()); |
| 290 |
+ |
else remove(dir_itr->path()); |
| 291 |
+ |
} |
| 292 |
|
if (exists(dir_itr->path())) { |
| 293 |
|
|
| 294 |
|
} |
| 318 |
|
logfile << (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level" |
| 319 |
|
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log").c_str() << '\n'; |
| 320 |
|
string sys_str = (strOniSplit + " " + strImportOption + " ../GameDataFolder/level" + levels[i] + "_Final packages/VanillaDats/level" + levels[i] + "_Final/level" |
| 321 |
< |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize2.log"); |
| 321 |
> |
+ levels[i] + "_Final/level" + levels[i] + "_Final.oni >> Globalize.log"); |
| 322 |
|
system(sys_str.c_str() ); |
| 323 |
|
setProgressBar( (int)(1000 * (float)(parts_done) / (float)(total_steps) )); |
| 324 |
|
parts_done++; |
| 356 |
|
create_directory((path)"../GameDataFolder/IGMD"); |
| 357 |
|
copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); |
| 358 |
|
setProgressBar( 1000 ); |
| 359 |
< |
|
| 360 |
< |
// 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/ |
| 361 |
< |
|
| 334 |
< |
// CIP:then copy persist.dat and keyconfig.txt into edition/ as well |
| 359 |
> |
|
| 360 |
> |
copy("../../persist.dat","../persist.dat"); |
| 361 |
> |
copy("../../key_config.txt","../key_config.txt"); |
| 362 |
|
|
| 363 |
|
#ifndef WIN32 |
| 364 |
|
/* 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). |
| 365 |
< |
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, |
| 366 |
< |
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 */ |
| 367 |
< |
path fullAEpath = system_complete("."); // get full path for Installer |
| 368 |
< |
char prefsCommand[300] = "defaults write com.godgames.oni RetailInstallationPath -string '"; |
| 369 |
< |
strcat(prefsCommand, fullAEpath.parent_path().parent_path().string().c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF) |
| 365 |
> |
Tests for presence of prefs with [ -f ] before doing anything so it doesn't create a partial prefs file -- just in case user has never |
| 366 |
> |
run Oni before :-p */ |
| 367 |
> |
string fullAEpath = escapePath(system_complete(".").parent_path().parent_path().string()); // get full path for edition/ |
| 368 |
> |
char prefsCommand[300] = "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '"; |
| 369 |
> |
strcat(prefsCommand, fullAEpath.c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF) |
| 370 |
|
strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters |
| 371 |
|
system(prefsCommand); |
| 372 |
|
|
| 373 |
|
#endif |
| 374 |
|
|
| 375 |
+ |
|
| 376 |
|
setStatusArea((string)"Done! Now select your mod packages and click install."); |
| 377 |
|
// while(1) Sleep(-1); |
| 378 |
|
|
| 1002 |
|
itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK); |
| 1003 |
|
menuBar->Append(itemMenu42, _("Options")); |
| 1004 |
|
wxMenu* itemMenu44 = new wxMenu; |
| 1005 |
< |
itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 1006 |
< |
menuBar->Append(itemMenu44, _("Help")); |
| 1005 |
> |
#ifdef WIN32 |
| 1006 |
> |
itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 1007 |
> |
menuBar->Append(itemMenu44, _("Help")); |
| 1008 |
> |
#else |
| 1009 |
> |
itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 1010 |
> |
#endif |
| 1011 |
> |
|
| 1012 |
|
itemFrame1->SetMenuBar(menuBar); |
| 1013 |
|
|
| 1014 |
|
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); |
| 1141 |
|
Mods_CheckboxList->Connect(Mods_CheckboxList1, wxEVT_CREATE, wxWindowCreateEventHandler(MainWindow::ModList_OnCreate), NULL, this); |
| 1142 |
|
////@end MainWindow content construction |
| 1143 |
|
|
| 1144 |
+ |
Handle = (HWND)GetHWND(); |
| 1145 |
+ |
::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList); |
| 1146 |
+ |
|
| 1147 |
+ |
|
| 1148 |
|
if ( exists( "../../GameDataFolder/level0_Final.sep" ) ) { |
| 1149 |
|
strImportOption = "-import:sep"; |
| 1150 |
|
splitInstances = NOT_SPLIT; |
| 1153 |
|
strImportOption = "-import:nosep"; |
| 1154 |
|
splitInstances = SPLIT; |
| 1155 |
|
} |
| 1156 |
< |
|
| 1156 |
> |
|
| 1157 |
|
globalPackages = getPackages(); |
| 1158 |
|
globalInstalledMods = getInstallString(); |
| 1159 |
|
for (int i = 0; i < globalPackages.size(); i++) { |
| 1165 |
|
TheInstallButton = InstallButton; |
| 1166 |
|
TheProgressBar = ProgressBar; |
| 1167 |
|
OptionsPanel->Hide(); |
| 1168 |
+ |
|
| 1169 |
+ |
//#ifndef WIN32 |
| 1170 |
+ |
// itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); |
| 1171 |
+ |
|
| 1172 |
+ |
//#endif |
| 1173 |
+ |
|
| 1174 |
|
if(splitInstances == SPLIT) SeperatedRadio->SetValue(true); |
| 1175 |
|
else CompleteRadio->SetValue(true); |
| 1133 |
– |
|
| 1134 |
– |
|
| 1135 |
– |
|
| 1176 |
|
if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true); |
| 1177 |
|
else SepRadio->SetValue(true); |
| 1178 |
|
|
| 1413 |
|
|
| 1414 |
|
void setProgressBar( int i ) { |
| 1415 |
|
//TheProgressBar->SetValue( |
| 1416 |
+ |
#ifdef WIN32 |
| 1417 |
+ |
|
| 1418 |
+ |
|
| 1419 |
+ |
|
| 1420 |
+ |
if (SUCCEEDED(pTaskbarList->QueryInterface(IID_ITaskbarList3, (void **)&pTaskbarList3))) |
| 1421 |
+ |
{ |
| 1422 |
+ |
|
| 1423 |
+ |
pTaskbarList3->SetProgressValue(Handle,i, 1000); |
| 1424 |
+ |
if ( i == 0 ) { |
| 1425 |
|
|
| 1426 |
+ |
pTaskbarList3->SetProgressState(Handle,TBPF_NOPROGRESS); |
| 1427 |
+ |
} |
| 1428 |
+ |
} |
| 1429 |
+ |
|
| 1430 |
+ |
|
| 1431 |
+ |
#endif |
| 1432 |
|
TheProgressBar->SetValue(i); |
| 1433 |
|
|
| 1434 |
|
} |