static void set_default_paths(void) { MAKE_PATH(Config.Mcd1, MEMCARD_DIR, "card1.mcd"); MAKE_PATH(Config.Mcd2, MEMCARD_DIR, "card2.mcd"); strcpy(Config.BiosDir, "bios"); strcpy(Config.PluginsDir, "plugins"); strcpy(Config.Gpu, "builtin_gpu"); strcpy(Config.Spu, "builtin_spu"); strcpy(Config.Cdr, "builtin_cdr"); strcpy(Config.Pad1, "builtin_pad"); strcpy(Config.Pad2, "builtin_pad"); strcpy(Config.Net, "Disabled"); snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "." PATCHES_DIR); }
int main(int argc, char * argv[]) { int nError = ERROR_SUCCESS; // Keep compiler happy argc = argc; argv = argv; #if defined(_MSC_VER) && defined(_DEBUG) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif // defined(_MSC_VER) && defined(_DEBUG) // Test open CASC storage for HOTS // if(nError == ERROR_SUCCESS) // nError = TestOpenStorage_OpenFile(MAKE_PATH("2014 - Heroes of the Storm/29049/BNTData"), "mods/heroes.stormmod/base.stormmaps/maps/heroes/builtin/startingexperience/practicemode01.stormmap/dede.stormdata/localizeddata/gamestrings.txt"); // List all files in CASC storage with MNDX info // if(nError == ERROR_SUCCESS) // nError = TestOpenStorage_EnumFiles(MAKE_PATH("2014 - Heroes of the Storm/30509/HeroesData")); // if(nError == ERROR_SUCCESS) // nError = TestOpenStorage_EnumFiles(MAKE_PATH("2014 - Heroes of the Storm/30414/HeroesData")); // if(nError == ERROR_SUCCESS) // nError = TestOpenStorage_OpenFile(MAKE_PATH("2014 - WoW/18125/Data"), "Interface\\Glues\\MODELS\\UI_MainMenu_Warlords\\Caustic_MedFreq.blp"); if(nError == ERROR_SUCCESS) nError = TestOpenStorage_EnumFiles(MAKE_PATH("2014 - WoW/18865/Data"), _T("e:\\Ladik\\AppDir\\CascLib\\listfile\\listfile-wow6.txt")); // Extracting the complete storage // if(nError == ERROR_SUCCESS && argc == 3) // nError = TestOpenStorage_ExtractFilesArgs(argv[1], argv[2]); // Test extracting the complete storage // if(nError == ERROR_SUCCESS) // nError = TestOpenStorage_ExtractFiles(MAKE_PATH("2014 - Heroes of the Storm/31726/HeroesData"), MAKE_PATH("Work"), NULL); #ifdef _MSC_VER _CrtDumpMemoryLeaks(); #endif // _MSC_VER return nError; }
static int _OpenPlugins(void) { int ret; GPU_clearDynarec(clearDynarec); ret = CDR_open(); if (ret < 0) { SysMessage(_("Error opening CD-ROM plugin!")); return -1; } ret = SPU_open(); if (ret < 0) { SysMessage(_("Error opening SPU plugin!")); return -1; } SPU_registerCallback(SPUirq); SPU_registerScheduleCb(SPUschedule); ret = PAD1_open(&gpuDisp); if (ret < 0) { SysMessage(_("Error opening Controller 1 plugin!")); return -1; } ret = PAD2_open(&gpuDisp); if (ret < 0) { SysMessage(_("Error opening Controller 2 plugin!")); return -1; } if (Config.UseNet && !NetOpened) { netInfo info; char path[MAXPATHLEN]; char dotdir[MAXPATHLEN]; MAKE_PATH(dotdir, "/.pcsx/plugins/", NULL); strcpy(info.EmuName, "PCSX"); strncpy(info.CdromID, CdromId, 9); strncpy(info.CdromLabel, CdromLabel, 9); info.psxMem = psxM; info.GPU_showScreenPic = GPU_showScreenPic; info.GPU_displayText = GPU_displayText; info.GPU_showScreenPic = GPU_showScreenPic; info.PAD_setSensitive = PAD1_setSensitive; sprintf(path, "%s%s", Config.BiosDir, Config.Bios); strcpy(info.BIOSpath, path); strcpy(info.MCD1path, Config.Mcd1); strcpy(info.MCD2path, Config.Mcd2); sprintf(path, "%s%s", dotdir, Config.Gpu); strcpy(info.GPUpath, path); sprintf(path, "%s%s", dotdir, Config.Spu); strcpy(info.SPUpath, path); sprintf(path, "%s%s", dotdir, Config.Cdr); strcpy(info.CDRpath, path); NET_setInfo(&info); ret = NET_open(&gpuDisp); if (ret < 0) { if (ret == -2) { // -2 is returned when something in the info // changed and needs to be synced char *ptr; PARSEPATH(Config.Bios, info.BIOSpath); PARSEPATH(Config.Gpu, info.GPUpath); PARSEPATH(Config.Spu, info.SPUpath); PARSEPATH(Config.Cdr, info.CDRpath); strcpy(Config.Mcd1, info.MCD1path); strcpy(Config.Mcd2, info.MCD2path); return -2; } else { Config.UseNet = FALSE; } } else { if (NET_queryPlayer() == 1) { if (SendPcsxInfo() == -1) Config.UseNet = FALSE; } else { if (RecvPcsxInfo() == -1) Config.UseNet = FALSE; } } NetOpened = TRUE; } else if (Config.UseNet) { NET_resume(); } return 0; }
static void create_profile_dir(const char *directory) { char path[MAXPATHLEN]; MAKE_PATH(path, directory, NULL); mkdir(path, S_IRWXU | S_IRWXG); }
// initialize and parse the command line parameters bool Initialize(size_t argc, LPCTSTR* argv) { // initialize log and console OPEN_LOG(); OPEN_LOGCONSOLE(); // group of options allowed only on command line boost::program_options::options_description generic("Generic options"); generic.add_options() ("help,h", "produce this help message") ("working-folder,w", boost::program_options::value<std::string>(&WORKING_FOLDER), "working directory (default current directory)") ("config-file,c", boost::program_options::value<std::string>(&OPT::strConfigFileName)->default_value(APPNAME _T(".cfg")), "file name containing program options") ("archive-type", boost::program_options::value<unsigned>(&OPT::nArchiveType)->default_value(2), "project archive type: 0-text, 1-binary, 2-compressed binary") ("process-priority", boost::program_options::value<int>(&OPT::nProcessPriority)->default_value(-1), "process priority (below normal by default)") ("max-threads", boost::program_options::value<unsigned>(&OPT::nMaxThreads)->default_value(0), "maximum number of threads (0 for using all available cores)") #if TD_VERBOSE != TD_VERBOSE_OFF ("verbosity,v", boost::program_options::value<int>(&g_nVerbosityLevel)->default_value( #if TD_VERBOSE == TD_VERBOSE_DEBUG 3 #else 2 #endif ), "verbosity level") #endif ; // group of options allowed both on command line and in config file boost::program_options::options_description config("Main options"); config.add_options() ("input-file,i", boost::program_options::value<std::string>(&OPT::strInputFileName), "input filename containing camera poses and image list") ("output-file,o", boost::program_options::value<std::string>(&OPT::strOutputFileName), "output filename for storing the mesh") ("output-image-folder", boost::program_options::value<std::string>(&OPT::strOutputImageFolder)->default_value("undistorted_images"), "output folder to store undistorted images") ; boost::program_options::options_description cmdline_options; cmdline_options.add(generic).add(config); boost::program_options::options_description config_file_options; config_file_options.add(config); boost::program_options::positional_options_description p; p.add("input-file", -1); try { // parse command line options boost::program_options::store(boost::program_options::command_line_parser((int)argc, argv).options(cmdline_options).positional(p).run(), OPT::vm); boost::program_options::notify(OPT::vm); INIT_WORKING_FOLDER; // parse configuration file std::ifstream ifs(MAKE_PATH_SAFE(OPT::strConfigFileName)); if (ifs) { boost::program_options::store(parse_config_file(ifs, config_file_options), OPT::vm); boost::program_options::notify(OPT::vm); } } catch (const std::exception& e) { LOG(e.what()); return false; } // initialize the log file OPEN_LOGFILE(MAKE_PATH(APPNAME _T("-")+Util::getUniqueName(0)+_T(".log")).c_str()); // print application details: version and command line Util::LogBuild(); LOG(_T("Command line:%s"), Util::CommandLineToString(argc, argv).c_str()); // validate input Util::ensureValidPath(OPT::strInputFileName); Util::ensureUnifySlash(OPT::strInputFileName); if (OPT::vm.count("help") || OPT::strInputFileName.IsEmpty()) { boost::program_options::options_description visible("Available options"); visible.add(generic).add(config); GET_LOG() << visible; } if (OPT::strInputFileName.IsEmpty()) return false; // initialize optional options if (OPT::strInputFileName.IsEmpty()) return false; Util::ensureValidPath(OPT::strOutputFileName); Util::ensureUnifySlash(OPT::strOutputFileName); Util::ensureUnifySlash(OPT::strOutputImageFolder); Util::ensureDirectorySlash(OPT::strOutputImageFolder); if (OPT::strOutputFileName.IsEmpty()) OPT::strOutputFileName = Util::getFullFileName(OPT::strInputFileName) + MVS_EXT; // initialize global options Process::setCurrentProcessPriority((Process::Priority)OPT::nProcessPriority); #ifdef _USE_OPENMP if (OPT::nMaxThreads != 0) omp_set_num_threads(OPT::nMaxThreads); #endif #ifdef _USE_BREAKPAD // start memory dumper MiniDumper::Create(APPNAME, WORKING_FOLDER); #endif return true; }