jint EXPORT_ME JAVA_FUNC(init)(JNIEnv* env, jobject thiz, jobject act, jobjectArray argsArray, jstring game_path_, jstring lib_path_, jstring app_path_, jstring abi, jstring abi_alt) { // getGlobalClasses(env); //set_check_len(3840538); activity_ = &act; env_ = env; argv[0] = "quake"; int argCount = (env)->GetArrayLength(argsArray); LOGI("argCount = %d", argCount); for (int i = 0; i < argCount; i++) { jstring string = (jstring)(env)->GetObjectArrayElement(argsArray, i); argv[argc] = (char *) (env)->GetStringUTFChars(string, 0); LOGI("arg = %s", argv[argc]); argc++; } game_path = (char *) (env)->GetStringUTFChars(game_path_, 0); lib_path = (char *) (env)->GetStringUTFChars(lib_path_, 0); app_path = (char *) (env)->GetStringUTFChars(app_path_, 0); android_abi = (char *) (env)->GetStringUTFChars(abi, 0); android_abi_alt = (char *) (env)->GetStringUTFChars(abi_alt, 0); LOGI("game_path = %s", getGamePath()); LOGI("lib_path = %s", getLibPath()); LOGI("app_path = %s", getAppPath()); LOGI("android_abi = %s", getAndroidAbi()); LOGI("android_abi_alt = %s", getAndroidAbiAlt()); chdir(getGamePath()); //self_crc_check((string(getLibPath()) + "/libjk3.so").c_str()); PortableInit(argc, argv); /* const char * p = env->GetStringUTFChars(graphics_dir,NULL); graphicpath = std::string(p); initControls(640,-480,graphicpath.c_str(),(graphicpath + "/game_controls.xml").c_str());*/ return 0; }
jint EXPORT_ME JAVA_FUNC(init) ( JNIEnv* env, jobject thiz,jstring graphics_dir,jint mem_mb,jobjectArray argsArray,jint lowRes,jstring game_path_ ) { #ifdef ANTI_HACK getGlobalClasses(env); #endif env_ = env; /* if (lowRes) Android_SetGameResolution(320,240); else Android_SetGameResolution(640,400); */ //Android_SetGameResolution(320,200); Android_SetGameResolution(320,240); //Android_SetGameResolution(640,480); argv[0] = "quake"; int argCount = (env)->GetArrayLength( argsArray); LOGI("argCount = %d",argCount); for (int i=0; i<argCount; i++) { jstring string = (jstring) (env)->GetObjectArrayElement( argsArray, i); argv[argc] = (char *)(env)->GetStringUTFChars( string, 0); LOGI("arg = %s",argv[argc]); argc++; } game_path = (char *)(env)->GetStringUTFChars( game_path_, 0); LOGI("game_path = %s",getGamePath()); //Needed for ecwolf to run //home_env = "HOME=/" + game_path; //putenv(home_env.c_str()); setenv("HOME", getGamePath(),1); putenv("TIMIDITY_CFG=../timidity.cfg"); chdir(getGamePath()); const char * p = env->GetStringUTFChars(graphics_dir,NULL); graphicpath = std::string(p); initControls(android_screen_width,-android_screen_height,graphicpath.c_str()); SDL_SetSwapBufferCallBack(frameControls); //Now done in java to keep context etc SDL_SwapBufferPerformsSwap(false); PortableInit(argc,argv); //Never returns!! return 0; }
bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames) { if(!hasInputPathParam) getGamePath(); printf("\nGame path: %s\n", input_path); char path[512]; // open expansion and common files printf("Opening data files from data directory.\n"); sprintf(path, "%sterrain.MPQ", input_path); pArchiveNames.push_back(path); sprintf(path, "%smodel.MPQ", input_path); pArchiveNames.push_back(path); sprintf(path, "%stexture.MPQ", input_path); pArchiveNames.push_back(path); sprintf(path, "%swmo.MPQ", input_path); pArchiveNames.push_back(path); sprintf(path, "%sbase.MPQ", input_path); pArchiveNames.push_back(path); sprintf(path, "%smisc.MPQ", input_path); // now, scan for the patch levels in the core dir printf("Scanning patch levels from data directory.\n"); sprintf(path, "%spatch", input_path); if (!scan_patches(path, pArchiveNames)) return(false); printf("\n"); return true; }
int main(int argc, char *argv[]) { RWGame game( getGamePath(), argc, argv ); return game.run(); }
bool processArgv(int argc, char ** argv, const char *versionString) { bool result = true; bool hasInputPathParam = false; preciseVectorData = false; for(int i = 1; i < argc; ++i) { if(strcmp("-s",argv[i]) == 0) { preciseVectorData = false; } else if(strcmp("-d",argv[i]) == 0) { if((i+1)<argc) { hasInputPathParam = true; strncpy(input_path, argv[i + 1], sizeof(input_path)); input_path[sizeof(input_path) - 1] = '\0'; if (input_path[strlen(input_path) - 1] != '\\' && input_path[strlen(input_path) - 1] != '/') strcat(input_path, "/"); ++i; } else { result = false; } } else if(strcmp("-?",argv[1]) == 0) { result = false; } else if(strcmp("-l",argv[i]) == 0) { preciseVectorData = true; } else { result = false; break; } } if (!result) { printf("Extract %s.\n",versionString); printf("%s [-?][-s][-l][-d <path>]\n", argv[0]); printf(" -s : (default) small size (data size optimization), ~500MB less vmap data.\n"); printf(" -l : large size, ~500MB more vmap data. (might contain more details)\n"); printf(" -d <path>: Path to the vector data source folder.\n"); printf(" -? : This message.\n"); } if(!hasInputPathParam) getGamePath(); return result; }
Global() { wnd.create(sf::VideoMode(640, 360), "Testing"); glewExperimental = GL_TRUE; glewInit(); d = new GameData(&log, &work, getGamePath()); e = new GameWorld(&log, &work, d); e->data->loadIMG("/models/gta3"); e->data->loadIMG("/anim/cuts"); e->data->load(); for(std::map<std::string, std::string>::iterator it = e->data->ideLocations.begin(); it != e->data->ideLocations.end(); ++it) { d->loadObjects(it->second); } e->dynamicsWorld->setGravity(btVector3(0.f, 0.f, 0.f)); while( ! e->_work->isEmpty() ) { std::this_thread::yield(); } }
bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames) { if (!hasInputPathParam) getGamePath(); printf("\nGame path: %s\n", input_path); char path[512]; string in_path(input_path); std::vector<std::string> locales, searchLocales; searchLocales.push_back("enGB"); searchLocales.push_back("enUS"); searchLocales.push_back("deDE"); searchLocales.push_back("esES"); searchLocales.push_back("frFR"); searchLocales.push_back("koKR"); searchLocales.push_back("zhCN"); searchLocales.push_back("zhTW"); searchLocales.push_back("enCN"); searchLocales.push_back("enTW"); searchLocales.push_back("esMX"); searchLocales.push_back("ruRU"); for (std::vector<std::string>::iterator i = searchLocales.begin(); i != searchLocales.end(); ++i) { std::string localePath = in_path + *i; // check if locale exists: struct stat status; if (stat(localePath.c_str(), &status)) continue; if ((status.st_mode & S_IFDIR) == 0) continue; printf("Found locale '%s'\n", i->c_str()); locales.push_back(*i); } printf("\n"); // open locale expansion and common files printf("Adding data files from locale directories.\n"); for (std::vector<std::string>::iterator i = locales.begin(); i != locales.end(); ++i) { pArchiveNames.push_back(in_path + *i + "/locale-" + *i + ".MPQ"); pArchiveNames.push_back(in_path + *i + "/expansion-locale-" + *i + ".MPQ"); } // open expansion and common files pArchiveNames.push_back(input_path + string("common.MPQ")); pArchiveNames.push_back(input_path + string("expansion.MPQ")); // now, scan for the patch levels in the core dir printf("Scanning patch levels from data directory.\n"); sprintf(path, "%spatch", input_path); if (!scan_patches(path, pArchiveNames)) return(false); // now, scan for the patch levels in locale dirs printf("Scanning patch levels from locale directories.\n"); bool foundOne = false; for (std::vector<std::string>::iterator i = locales.begin(); i != locales.end(); ++i) { printf("Locale: %s\n", i->c_str()); sprintf(path, "%s%s/patch-%s", input_path, i->c_str(), i->c_str()); if (scan_patches(path, pArchiveNames)) foundOne = true; } printf("\n"); if (!foundOne) { printf("no locale found\n"); return false; } return true; }
bool processArgv(int argc, char** argv) { bool result = true; bool hasInputPathParam = false; bool preciseVectorData = false; for (int i = 1; i < argc; ++i) { if (strcmp("-s", argv[i]) == 0) { preciseVectorData = false; } else if (strcmp("-d", argv[i]) == 0) { if ((i + 1) < argc) { hasInputPathParam = true; strcpy(input_path, argv[i + 1]); if (input_path[strlen(input_path) - 1] != '\\' || input_path[strlen(input_path) - 1] != '/') strcat(input_path, "/"); ++i; } else { result = false; } } else if (strcmp("-?", argv[1]) == 0) { result = false; } else if (strcmp("-l", argv[i]) == 0) { preciseVectorData = true; } else if (strcmp("-b", argv[i]) == 0) { if (i + 1 < argc) // all ok CONF_TargetBuild = atoi(argv[i++ + 1]); } else { result = false; break; } } if (!result) { printf("Extract for %s.\n", szRawVMAPMagic); printf("%s [-?][-s][-l][-d <path>]\n", argv[0]); printf(" -s : (default) small size (data size optimization), ~500MB less vmap data.\n"); printf(" -l : large size, ~500MB more vmap data. (might contain more details)\n"); printf(" -d <path>: Path to the vector data source folder.\n"); printf(" -b : target build (default %u)", CONF_TargetBuild); printf(" -? : This message.\n"); } if (!hasInputPathParam) getGamePath(); return result; }
bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames) { //srand((unsigned int)time(0)); if(!hasInputPathParam) getGamePath(); printf("\nGame path: %s\n", input_path); char path[512]; std::vector<std::string> locales; // scan game directories WIN32_FIND_DATA ffData; HANDLE hFind; DWORD dwError; // first, scan for locales (4-letter directories) printf("Scanning for locales.\n"); sprintf(path, "%s*.*", input_path); hFind = INVALID_HANDLE_VALUE; hFind = FindFirstFile(path, &ffData); if (hFind == INVALID_HANDLE_VALUE) { printf("\nCould not open data directory for reading. Aborting.\n"); return(false); } do { if (ffData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (ffData.cFileName[0] != '.') { if (strlen(ffData.cFileName) == 4) { printf("Found locale: %s\n", ffData.cFileName); locales.push_back(ffData.cFileName); } } } } while (FindNextFile(hFind, &ffData) != 0); dwError = GetLastError(); FindClose(hFind); if (dwError != ERROR_NO_MORE_FILES) { printf("\nError reading data directory while scanning locales. Aborting.\n"); return(false); } printf("\n"); if (locales.size() == 0) { printf("Sorry, no locales found. Aborting.\n"); return(false); } // now, scan for the patch levels in the core dir printf("Loading patch levels from data directory.\n"); sprintf(path, "%spatch", input_path); if (!scan_patches(path, pArchiveNames)) return(false); // now, scan for the patch levels in locale dirs printf("Loading patch levels from locale directories.\n"); for (std::vector<std::string>::iterator i = locales.begin(); i != locales.end(); i++) { printf("Locale: %s\n", i->c_str()); sprintf(path, "%s%s\\patch-%s", input_path, i->c_str(), i->c_str()); if (!scan_patches(path, pArchiveNames)) return(false); } // open expansion and common files printf("Opening data files from data directory.\n"); sprintf(path, "%sexpansion.mpq", input_path); pArchiveNames.push_back(path); sprintf(path, "%scommon.mpq", input_path); pArchiveNames.push_back(path); printf("\n"); // open locale expansion and common files printf("Opening data files from locale directories.\n"); for (std::vector<std::string>::iterator i = locales.begin(); i != locales.end(); i++) { printf("Locale: %s\n", i->c_str()); sprintf(path, "%s%s\\expansion-locale-%s.mpq", input_path, i->c_str(), i->c_str()); pArchiveNames.push_back(path); sprintf(path, "%s%s\\locale-%s.mpq", input_path, i->c_str(), i->c_str()); pArchiveNames.push_back(path); printf("\n"); } return true; }
int main(int argc, char* argv[]) { srand((unsigned int)time(0)); int xres = 1024; int yres = 768; bool usePatch = true; for(int i = 1; i < argc; ++i) { if(!strcmp(argv[i], "-f")) fullscreen = 1; else if(!strcmp(argv[i], "-w")) fullscreen = 0; else if(!strcmp(argv[i], "-1024") || !strcmp(argv[i], "-1024x768")) { xres = 1024; yres = 768; } else if(!strcmp(argv[i], "-1280") || !strcmp(argv[i], "-1280x1024")) { xres = 1280; yres = 1024; } else if(!strcmp(argv[i], "-1280x960")) { xres = 1280; yres = 960; } else if(!strcmp(argv[i], "-1400") || !strcmp(argv[i], "-1400x1050")) { xres = 1400; yres = 1050; } else if(!strcmp(argv[i], "-1280x800")) { xres = 1280; yres = 800; } else if(!strcmp(argv[i], "-1600") || !strcmp(argv[i], "-1600x1200")) { xres = 1600; yres = 1200; } else if(!strcmp(argv[i], "-1920") || !strcmp(argv[i], "-1920x1200")) { xres = 1920; yres = 1200; } else if(!strcmp(argv[i], "-2048") || !strcmp(argv[i], "-2048x1536")) { xres = 2048; yres = 1536; } else if(!strcmp(argv[i], "-p")) usePatch = true; else if(!strcmp(argv[i], "-np")) usePatch = false; } checkConfig(); /*if(!loadPath()) { getGamePath(); } else { getGamePath() = loadPath(); }*/ getGamePath(); CreateStrips(); gLog("[World of Warcraft Studio - Editor] - " APP_TITLE " : " APP_VERSION "\n[World of Warcraft Studio - Editor] - Game path: %s\n[World of Warcraft Studio - Editor] - Game Version: %d\n", gamepath, loadGameVersion()); GraphicCard(); // Send to Log info about Graphic Card checkConfig2(); vector<string> archiveNames; fillArchiveNameVector(archiveNames); for(size_t i = 0; i < archiveNames.size(); ++i) MPQArchive *archive = new MPQArchive(archiveNames[i].c_str()); if(gOpenArchives.empty()) { gLog("[World of Warcraft Studio - Editor] - ERROR: No one archive found"); return 1; } gAreaDB.open(); video.init(xres, yres, fullscreen != 0); gLog("[World of Warcraft Studio - Editor] - Initializing Ground Effects\n"); InitGroundEffects(); gLog("[World of Warcraft Studio - Editor] - Initializing Fonts\n"); InitFonts(); gLog("[World of Warcraft Studio - Editor] - Main Initializing complete\n"); float ftime; uint32 t, last_t, frames = 0, time = 0, fcount = 0, ft = 0; AppState* as; gFPS = 0; gLog("[World of Warcraft Studio - Editor] - Creating Menu\n"); Menu* m = new Menu(); as = m; gStates.push_back(as); if(glExtGetGLProcs_VertexProgram_1_0_ARB() == 0) { gLog("[World of Warcraft Studio - Editor] - Unable to load ARB Vertex Program Code\n"); return 0; } loadWaterShader(); bool done = false; t = SDL_GetTicks(); gLog("[World of Warcraft Studio - Editor] - Entering Main Loop\n"); while(gStates.size() > 0 && !done) { last_t = t; t = SDL_GetTicks(); Uint32 dt = t - last_t; time += dt; ftime = time / 1000.0f; as = gStates[gStates.size()-1]; SDL_Event event; while(SDL_PollEvent(&event)) { if(event.type == SDL_QUIT) done = true; else if(event.type == SDL_MOUSEMOTION) { if(SDL_GetAppState()&SDL_APPMOUSEFOCUS) as->mousemove(&event.motion); } else if((event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_MOUSEBUTTONUP) && (SDL_GetAppState()&SDL_APPINPUTFOCUS)) { if(event.button.type == SDL_MOUSEBUTTONUP) as->mouseclick(&event.button); else if(SDL_GetAppState()&SDL_APPMOUSEFOCUS) as->mouseclick(&event.button); } else if(event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) { if(SDL_GetAppState()&SDL_APPINPUTFOCUS) as->keypressed(&event.key); } else if(event.type == SDL_VIDEORESIZE) video.resize(event.resize.w, event.resize.h); } if(SDL_GetAppState()&SDL_APPACTIVE) { as->tick(ftime, dt / 1000.0f); as->display(ftime, dt / 1000.0f); } if(gPop) { gPop = false; gStates.pop_back(); delete as; } frames++; fcount++; ft += dt; if(ft >= 1000) { float fps = (float)fcount / (float)ft * 1000.0f; gFPS = fps; char buf[32]; sprintf_s(buf, APP_TITLE " - %.2f fps", fps); SDL_WM_SetCaption(buf, NULL); ft = 0; fcount = 0; } video.flip(); } gLog("[World of Warcraft Studio - Editor] - Exited Main Loop\n"); deleteFonts(); video.close(); for(deque<MPQArchive*>::iterator it = archives.begin(); it != archives.end(); ++it) (*it)->close(); archives.clear(); gLog("\n[World of Warcraft Studio - Editor] - Exiting.\n"); return 0; }
bool fillArchiveNameVector(vector<string>& pArchiveNames) { if(!hasInputPath) getGamePath(); vector<string> locales, languageLocales; languageLocales.push_back("enGB"); languageLocales.push_back("enUS"); languageLocales.push_back("deDE"); languageLocales.push_back("esES"); languageLocales.push_back("frFR"); languageLocales.push_back("ruRU"); for(vector<string>::iterator i = languageLocales.begin(); i != languageLocales.end(); ++i) { string localePath = gamepath + *i; struct stat status; if(stat(localePath.c_str(), &status)) continue; if((status.st_mode & S_IFDIR) == 0) continue; gLog("[World of Warcraft Studio - Editor] - Found locales '%s'\n", i->c_str()); locales.push_back(*i); } gLog("[World of Warcraft Studio - Editor] - Addind data files from locale dir.\n"); for(vector<string>::iterator i = locales.begin(); i != locales.end(); ++i) { switch(loadExpansion()) { case 1: // TBC { pArchiveNames.push_back(gamepath + string("common.MPQ")); pArchiveNames.push_back(gamepath + string("expansion.MPQ")); pArchiveNames.push_back(gamepath + string("patch.MPQ")); pArchiveNames.push_back(gamepath + string("patch-2.MPQ")); pArchiveNames.push_back(gamepath + *i + "\\locale-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\expansion-locale-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\patch-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\patch-" + *i + "-2.MPQ"); break; } case 2: // WotLK { pArchiveNames.push_back(gamepath + string("common.MPQ")); pArchiveNames.push_back(gamepath + string("common-2.MPQ")); pArchiveNames.push_back(gamepath + string("expansion.MPQ")); pArchiveNames.push_back(gamepath + string("lichking.MPQ")); pArchiveNames.push_back(gamepath + string("patch.MPQ")); pArchiveNames.push_back(gamepath + string("patch-2.MPQ")); pArchiveNames.push_back(gamepath + *i + "\\locale-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\expansion-locale-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\lichking-locale-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\patch-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\patch-" + *i + "-2.MPQ"); break; } case 3: // Cataclysm { pArchiveNames.push_back(gamepath + string("art.MPQ")); pArchiveNames.push_back(gamepath + string("expansion1.MPQ")); pArchiveNames.push_back(gamepath + string("expansion2.MPQ")); pArchiveNames.push_back(gamepath + string("expansion3.MPQ")); pArchiveNames.push_back(gamepath + string("sound.MPQ")); pArchiveNames.push_back(gamepath + string("world.MPQ")); pArchiveNames.push_back(gamepath + *i + "\\locale-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\expansion1-locale-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\expansion2-locale-" + *i + ".MPQ"); pArchiveNames.push_back(gamepath + *i + "\\expansion3-locale-" + *i + ".MPQ"); break; } default: // ERROR { gLog("[World of Warcraft Studio - Editor] - Can't load GameVersion.\n"); exit(1); break; } } } gLog("[World of Warcraft Studio - Editor] - Scanning patch levels from data dir.\n"); sprintf(path, "%spatch", gamepath); if(!scan_patches(path, pArchiveNames)) return(false); gLog("[World of Warcraft Studio - Editor] - Scanning patch levels from locale dir.\n"); bool foundOne = false; for(vector<string>::iterator i = locales.begin(); i != locales.end(); ++i) { sprintf(path, "%s%s/patch-%s", InputPath, i->c_str(), i->c_str()); if(scan_patches(path, pArchiveNames)) foundOne = true; } if(!foundOne) { gLog("[World of Warcraft Studio - Editor] - Locales not found\n"); return false; } return true; }