CPath::CPath(DIR_MODULE_DIRECTORY /*sdt*/, const char * NameExten) { // The directory where the executable of this app is Init(); ModuleDirectory(); if (NameExten) { SetNameExtension(NameExten); } }
void SaveConfig(void) { FILE *f; debug(D_NORMAL, "begin\n"); f = fopen(GetConfigFilePath("options.cnf"), "w"); if (f) { fprintf(f, "%d %d %d %d %d %d %d %d %d\n", gOptions.displayFPS, gOptions.displayTime, gOptions.playersHurt, gOptions.copyMode, gOptions.brightness, gOptions.swapButtonsJoy1, gOptions.swapButtonsJoy2, gOptions.xSplit, gOptions.ySplit); fprintf(f, "%d\n%d %d %d %d %d %d\n", gPlayer1Data.controls, gPlayer1Data.keys[0], gPlayer1Data.keys[1], gPlayer1Data.keys[2], gPlayer1Data.keys[3], gPlayer1Data.keys[4], gPlayer1Data.keys[5]); fprintf(f, "%d\n%d %d %d %d %d %d\n", gPlayer2Data.controls, gPlayer2Data.keys[0], gPlayer2Data.keys[1], gPlayer2Data.keys[2], gPlayer2Data.keys[3], gPlayer2Data.keys[4], gPlayer2Data.keys[5]); fprintf(f, "%d\n", gOptions.mapKey); fprintf(f, "%d %d %d %d\n", FXVolume(), MusicVolume(), FXChannels(), MinMusicChannels()); fprintf(f, "%d\n", 0); // DynamicInterrupts fprintf(f, "%s\n", ModuleDirectory()); fprintf(f, "%u\n", gCampaign.seed); fprintf(f, "%d %d\n", gOptions.difficulty, gOptions.slowmotion); fprintf(f, "%d\n", gOptions.density); fprintf(f, "%d\n", gOptions.npcHp); fprintf(f, "%d\n", gOptions.playerHp); fprintf(f, "%dx%d:%d:%d\n", Gfx_GetHint(HINT_WIDTH), Gfx_GetHint(HINT_HEIGHT), Gfx_GetHint(HINT_FULLSCREEN), Gfx_GetHint(HINT_SCALEFACTOR) ); fclose(f); debug(D_NORMAL, "saved config\n"); } return; }
HMODULE LoadLibraryCurrent(const std::wstring& library_name, std::wstring* out_path) { std::wstring lib_path; ModuleDirectory(&lib_path); StringPathAppend(&lib_path, library_name); if (out_path) *out_path = lib_path; return LoadLibraryW(lib_path.c_str()); }