void CONFIG_Init(const CmdLineArgs& args) { TIMER(L"CONFIG_Init"); new CConfigDB; // Load the global, default config file g_ConfigDB.SetConfigFile(CFG_DEFAULT, L"config/default.cfg"); g_ConfigDB.Reload(CFG_DEFAULT); // 216ms // Try loading the local system config file (which doesn't exist by // default) - this is designed as a way of letting developers edit the // system config without accidentally committing their changes back to SVN. g_ConfigDB.SetConfigFile(CFG_SYSTEM, L"config/local.cfg"); g_ConfigDB.Reload(CFG_SYSTEM); g_ConfigDB.SetConfigFile(CFG_USER, L"config/user.cfg"); g_ConfigDB.Reload(CFG_USER); g_ConfigDB.SetConfigFile(CFG_MOD, L"config/mod.cfg"); // No point in reloading mod.cfg here - we haven't mounted mods yet ProcessCommandLineArgs(args); // Initialise console history file int max_history_lines = 200; CFG_GET_VAL("console.history.size", Int, max_history_lines); g_Console->UseHistoryFile(L"config/console.txt", max_history_lines); // Collect information from system.cfg, the profile file, // and any command-line overrides to fill in the globals. LoadGlobals(); // 64ms }
void Pdb::LoadModuleInfo() { fninfo_cache.Clear(); ModuleInfo f; dword cb = 1; HMODULE h; if(!EnumProcessModules(hProcess, &h, sizeof(HMODULE), &cb)) { Error(); return; } int n = cb / sizeof(HMODULE); Buffer<HMODULE> m(n); if(!EnumProcessModules(hProcess, m, cb, &cb)) { Error(); return; } Vector<ModuleInfo> nm; for (int i = 0; i < n; i++) { MODULEINFO mi; if(GetModuleInformation(hProcess, m[i], &mi, sizeof(mi))) { ModuleInfo& f = nm.Add(); f.base = (adr_t)mi.lpBaseOfDll; f.size = mi.SizeOfImage; int q = FindModuleIndex(f.base); if(q >= 0) { ModuleInfo& of = module[q]; f.path = of.path; f.symbols = of.symbols; of.symbols = false; LLOG("Stable " << Hex(f.base) << " (" << Hex(f.size) << "): " << f.path); } else { char name[MAX_PATH]; if(GetModuleFileNameEx(hProcess, m[i], name, MAX_PATH)) { f.path = name; if(FileExists(ForceExt(f.path, ".pdb"))) { adr_t w = (adr_t)SymLoadModule64(hProcess, NULL, name, 0, f.base, f.size); if(w) { LLOG("Loading symbols " << Hex(f.base) << '/' << hProcess << " returned base " << Hex(w)); f.symbols = true; LoadGlobals(w); } } } LLOG(Hex(f.base) << " (" << Hex(f.size) << "): " << f.path); } } } UnloadModuleSymbols(); module = pick(nm); refreshmodules = false; }
/* =============== GrabGlobals =============== */ void GrabGlobals( char *frame ){ char file1[1024]; char *framefile; frame_t *fr; framefile = FindFrameFile( frame ); sprintf( file1, "%s/%s", cdarchive, framefile ); ExpandPathAndArchive( file1 ); sprintf( file1, "%s/%s",cddir, framefile ); printf( "grabbing %s\n", file1 ); fr = &g_frames[model.num_frames - 1]; // last frame read in LoadGlobals( file1 ); }
ALERROR CUniverse::LoadDesignElement (SDesignLoadCtx &Ctx, CXMLElement *pElement) // LoadDesignElement // // Loads a design element { // If we're loading just an adventure description, then only // load certain elements if (Ctx.bLoadAdventureDesc) { // <Image> if (strEquals(pElement->GetTag(), IMAGE_TAG)) return LoadImage(Ctx, pElement); // <AdventureDesc> else if (strEquals(pElement->GetTag(), ADVENTURE_DESC_TAG)) return m_Design.LoadEntryFromXML(Ctx, pElement); // Ignore all other elements else return NOERROR; } // If we're loading an adventure, then load everything else else if (Ctx.pExtension && Ctx.pExtension->iType == extAdventure) { // <Image> already loaded if (strEquals(pElement->GetTag(), IMAGE_TAG)) return NOERROR; // <AdventureDesc> already loaded else if (strEquals(pElement->GetTag(), ADVENTURE_DESC_TAG)) return NOERROR; // <Sound> else if (strEquals(pElement->GetTag(), SOUND_TAG)) return LoadSound(Ctx, pElement); // <Globals> else if (strEquals(pElement->GetTag(), GLOBALS_TAG)) return LoadGlobals(Ctx, pElement); // Standard design element else return m_Design.LoadEntryFromXML(Ctx, pElement); } // Otherwise, load everything else { // <Image> if (strEquals(pElement->GetTag(), IMAGE_TAG)) return LoadImage(Ctx, pElement); // <Sound> else if (strEquals(pElement->GetTag(), SOUND_TAG)) return LoadSound(Ctx, pElement); // <Globals> else if (strEquals(pElement->GetTag(), GLOBALS_TAG)) return LoadGlobals(Ctx, pElement); #if 0 // <SystemNode> else if (strEquals(pElement->GetTag(), SYSTEM_NODE_TAG)) return LoadSystemNode(Ctx, pElement); #endif // Standard design element else return m_Design.LoadEntryFromXML(Ctx, pElement); } }