CIniFile* CAniKeyFrameCfg::GetAniKeyFrameCfg(const TCHAR* szName) { MapAniKeyFrameCfg::iterator it = ms_mapAniKeyFrameCfg.find(szName); if (it == ms_mapAniKeyFrameCfg.end()) { MapNpcName2AniFileName::iterator it = m_mapNpcName2AniFileName.find(szName); if (it != m_mapNpcName2AniFileName.end()) { string strAniFileName = (*it).first; string strAniFile = "server/keyframeinfo/" + (*it).second + ".fky"; CIniFile* pIniFile = new CIniFile; if (pIniFile->Open(GAME_PATH_ALIAS_RES.c_str(), utf8_to_utf16(strAniFile).c_str())) { ms_mapAniKeyFrameCfg.insert(make_pair(strAniFileName, pIniFile)); return pIniFile; } else { SafeDelete(pIniFile); return NULL; } } else { return NULL; } } return it->second; }
CGameStatusPage::CGameStatusPage (HWND hParent, const RECT & rcDispay ) { if (!Create(hParent,rcDispay)) { return; } CIniFile RomIniFile (g_Settings->LoadString(SupportFile_RomDatabase).c_str()); strlist Keys; RomIniFile.GetKeyList("Rom Status",Keys); stdstr Status = g_Settings->LoadString(Rdb_Status); CModifiedComboBoxTxt * ComboBox; ComboBox = AddModComboBoxTxt(GetDlgItem(IDC_STATUS_TYPE),Rdb_Status); if (ComboBox) { for (strlist::iterator item = Keys.begin(); item != Keys.end(); item++ ) { if (strstr(item->c_str(),".Sel") != NULL) { continue; } if (strstr(item->c_str(),".Auto") != NULL) { continue; } ComboBox->AddItem(item->c_str(), item->c_str()); } ComboBox->SetTextField(GetDlgItem(IDC_STATUS_TEXT)); } CModifiedEditBox * TxtBox; TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_CORE),Rdb_NotesCore,true); TxtBox->SetTextField(GetDlgItem(IDC_NOTES_CORE_TEXT)); TxtBox = AddModTextBox(GetDlgItem(IDC_NOTES_PLUGIN),Rdb_NotesPlugin,true); TxtBox->SetTextField(GetDlgItem(IDC_NOTES_PLUGIN_TEXT)); UpdatePageSettings(); }
bool CAniKeyFrameCfg::LoadAniKeyFrameConfig(const string& szFileName) { using namespace CfgChk; CTxtTableFile TabFile; if (!TabFile.Load(PATH_ALIAS_CFG.c_str(), szFileName.c_str())) return false; SetTabFile(TabFile, "¶¯×÷¹Ø¼üÖ¡±í"); ClearMap(ms_mapAniKeyFrameCfg); for( int32 i = 1; i < TabFile.GetHeight(); ++i ) { SetLineNo(i); string strAniFileName; ReadItem(strAniFileName, szNT_Name); string strAniFile = "server/keyframeinfo/" + strAniFileName; CIniFile* pIniFile = new CIniFile; if (pIniFile->Open(GAME_PATH_ALIAS_RES.c_str(), utf8_to_utf16(strAniFile).c_str())) { ms_mapAniKeyFrameCfg.insert(make_pair(strAniFileName, pIniFile)); } else { SafeDelete(pIniFile); } } return true; }
/************************************************* Function: SetPathSave Description: 设置在ini文件中的存储路径值 Table Accessed: Table Updated: Input: 在ini文件中的存储路径值 Output: Return: Others: History: <Date> <Version> <Author> <Modification> 1.2015/11/05 1.0.0 ZCQ 创建 ****************************************************/ void CSysCfg::SetPathSave(CString strPath) { CString strFilePath = m_strInstancePath + _T("SysCfg.ini"); CIniFile fileCfg; fileCfg.SetFileName(strFilePath); fileCfg.SaveValue(_T("SysCfg"),_T("Path"),strPath); }
/************************************************* Function: GetPictrueDPI Description: 获取在ini文件中的DPI值 Table Accessed: Table Updated: Input: Output: Return: 在ini文件中的DPI值 Others: History: <Date> <Version> <Author> <Modification> 1.2015/11/05 1.0.0 ZCQ 创建 ****************************************************/ int CSysCfg::GetPictrueDPI() { CString strFilePath = m_strInstancePath + _T("SysCfg.ini"); CIniFile fileCfg; fileCfg.SetFileName(strFilePath); int nDPI = fileCfg.LoadInt(_T("SysCfg"),_T("DPI"),0); return nDPI; }
/************************************************* Function: GetPathSave Description: 获取在ini文件中的存储路径值 Table Accessed: Table Updated: Input: Output: Return: 在ini文件中的存储路径值 Others: History: <Date> <Version> <Author> <Modification> 1.2015/11/05 1.0.0 ZCQ 创建 ****************************************************/ CString CSysCfg::GetPathSave() { CString strFilePath = m_strInstancePath + _T("SysCfg.ini"); CIniFile fileCfg; fileCfg.SetFileName(strFilePath); CString strPath = fileCfg.LoadString(_T("SysCfg"),_T("Path"),0); return strPath; }
void CGuide::LoadIni() { // 从单独文件中读取需要展示的图片数,方便新版特性时CGuide类不需要改变,图片命名格式固定 // 可以根据需要自行更改 CIniFile tmpIni; tmpIni.SetPathName(m_strApp + _T("\\bin\\guide.ini")); m_nCount = tmpIni.GetInt(_T("GUIDE"), _T("count"), 0); }
uint32 CAniKeyFrameCfg::GetNPCAniKeyFrame(const TCHAR* szNPCName, const TCHAR* szAniName, const TCHAR* szKeyName) { if (szNPCName == "" || szAniName == "") return 0; CIniFile* pIniFile = GetAniKeyFrameCfg(szNPCName); if (pIniFile) return pIniFile->GetValue(szAniName, szKeyName, 0); return 0; }
BOOL CNWNXResources::OnCreate(const char* LogDir){ //Max path char log[MAX_PATH]; //Set logfile sprintf (log, "%s\\nwnx_resources.txt", LogDir); //Call the base class to make the log if (!CNWNXBase::OnCreate(log)) return false; Log( 0, "NWNX Resources v0.1 (Written by Terra_777)\n\n" ); idLookup=NULL; extLookup=NULL; ResTable=NULL; ResTLen=NULL; WIN32_FIND_DATA fileData; HANDLE hSearch = FindFirstFile( "nwnx_resman.dll", &fileData ); if (hSearch != INVALID_HANDLE_VALUE){ Log( 0, "This plugin isnt compatible with nwnx_resman.dll!\n" ); FindClose( hSearch ); return false; } FindClose( hSearch ); //open the inifile CIniFile iniFile ("nwnx.ini"); iniFile.ReadString( "RESOURCEMANAGER", "SourcePath", ResFolder, 260, "\0" ); priority = iniFile.ReadInteger( "RESOURCEMANAGER", "LogLevel", 1 ); BaseRes = iniFile.ReadBool( "RESOURCEMANAGER", "BaseOnly", true ); Behavior = iniFile.ReadInteger( "RESOURCEMANAGER", "Behavior", 0 ); //Set our nwnx memory funcs nwnx_malloc = (void *(__cdecl *)(size_t))0x0040D550; //nwns free routine nwnx_free = (void (__cdecl *)(void *))0x0040D560; extSubFldr=NULL; ExtLen=0; //Call the function to hook what we want HookCNWRES( ); SetPathRepository( &iniFile ); return true; }
void COnlineProgramConfirmStart::OnOK() { CIniFile IniFile; CString csFileName; Util::GetWindowsDirectory(csFileName); csFileName += "\\ConnMgr.ini"; IniFile.Name(csFileName); UpdateData(TRUE); // Update Member variables IniFile.WriteInteger("Configuration", "ShowOnlineConfirm", !m_bDontShowMe); CDialog::OnOK(); }
int main(int argc, char *argv[]) { LoadCfg(); // load the configuration file // Initialize defaults, video and audio if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE) == -1) { fprintf(stderr, "FATAL ERROR: Could not initialize SDL: %s.\n", SDL_GetError()); exit(1); } // Initialize the display in a 640x480 24-bit mode int f = (atoi(cfg.Get("OPTIONS", "FullScreen", "0")) > 0); if (f) { f = SDL_FULLSCREEN; } gpScreen = SDL_SetVideoMode(640, 480, 24, SDL_HWSURFACE | f); if (gpScreen == NULL) { gpScreen = SDL_SetVideoMode(640, 480, 24, SDL_SWSURFACE | f); } if (gpScreen == NULL) { fprintf(stderr, "FATAL ERROR: Could not set video mode: %s\n", SDL_GetError()); exit(1); } SDL_WM_SetCaption("Dou Di Zhu", NULL); g_fNoSound = (atoi(cfg.Get("OPTIONS", "NoSound", "0")) > 0); // Open the audio device if (SOUND_OpenAudio(22050, AUDIO_S16, 1, 1024) < 0) { fprintf(stderr, "WARNING: Couldn't open audio device: %s\n", SDL_GetError()); g_fNoSound = true; } InitTextMessage(); SDL_SetEventFilter(EventFilter); gpGeneral = new CGeneral; gpGame = new CGame; g_UI.OpeningUI(); UserQuit(); return 255; }
CIniFile* CIniFile::NewL(const TDesC& aName) /** * Factory function for CIniFile. * * @param aName The name of the ini file to be used, e.g. "GPRSBTT.INI". */ { OstTraceFunctionEntry0( CINIFILE_NEWL_TDESC_ENTRY ); CIniFile* self = new(ELeave) CIniFile; CleanupStack::PushL(self); self->ConstructL(aName, KDefaultIniFileDir); CleanupStack::Pop(self); OstTraceFunctionExit0( CINIFILE_NEWL_TDESC_EXIT ); return self; }
bool CAniKeyFrameCfg::CheckNpcMapAniKeyFrameCfg() { uint64 uBeginTime = GetProcessTime(); map<string, string> mAniLostMap; //map<骨骼名,错误信息> MapAniKeyFrameCfg::iterator iter = ms_mapAniKeyFrameCfg.begin(); for (; iter != ms_mapAniKeyFrameCfg.end(); iter++) { string sName = (*iter).first; const CNpcFightBaseData* pFighterData = CNpcFightBaseDataMgr::GetInst()->GetEntity(sName); if (!pFighterData || pFighterData->m_fAttackScope >= 3.0f) //攻击距离大于3表明是远程的,这里只检查近程怪物 continue; MapNpcName2AniFileName::iterator iter2 = m_mapNpcName2AniFileName.find(sName); //目前只检测Npc的 if (iter2 != m_mapNpcName2AniFileName.end() && NpcInfoMgr::BeFightNpc(sName.c_str())) { string sAniName = (*iter2).second; CIniFile* pIniFile = (*iter).second; string sAniLostInfo = ""; if (pIniFile->GetValue("attack01", "k", 0) == 0) { sAniLostInfo = "缺少攻击关键帧信息!"; } if (pIniFile->GetValue("attack01", "e", 0) == 0) { sAniLostInfo = sAniLostInfo + "缺少攻击全帧信息!"; } map<string, string>::iterator iter3 = mAniLostMap.find(sAniName); if (sAniLostInfo != "" && iter3 == mAniLostMap.end() ) { mAniLostMap[sAniName] = sAniLostInfo; } } } //输出错误信息到美术的错误log里面去 map<string, string>::iterator iter3 = mAniLostMap.begin(); //cout<<"总共有:【"<<mAniLostMap.size()<<"】个错误"<<endl; for (; iter3 != mAniLostMap.end(); iter3++) { string sErrorInfo = "keyframeinfo: 【" + (*iter3).first + "】 " + (*iter3).second; //ArtErr(sErrorInfo.c_str()); } uint64 uEndTime = GetProcessTime(); cout << "关联检测Npc模型边和美术关建帧信息完毕!耗时:" << (uEndTime - uBeginTime) << " 毫秒!\n"; return true; }
BOOL CTerminalConfig::SaveMileage(DWORD dwMileage) { if( GetFileAttributes(PATH_CONFIG_INI) == 0xFFFFFFFF ) return FALSE; CIniFile IniFile; //加载文件失败 if( !IniFile.Load( PATH_CONFIG_INI ) ) return FALSE; IniFile.SetInt(_T("TerminalParam"), _T("VEHICLE_ODOMETER"), dwMileage); IniFile.Flush(); // IniFile.Release(); return TRUE; }
CIniFile* CIniFile::NewL(const TDesC& aName, const TDesC& aPath) /** * Factory function for CIniFile that allows the user to specify both filename * and path * * @param aName The name of the ini file to be used, e.g. "GPRSBTT.INI". * @param aPath The location of the file e.g. "\\system\\data\\". */ { OstTraceFunctionEntry0( CINIFILE_NEWL_TDESC_TDESC_ENTRY ); CIniFile* self = new(ELeave) CIniFile; CleanupStack::PushL(self); self->ConstructL(aName, aPath); CleanupStack::Pop(self); OstTraceFunctionExit0( CINIFILE_NEWL_TDESC_TDESC_EXIT ); return self; }
BOOL CNWNXFuncs::OnCreate(const char* LogDir) { // call the base class function char __log[MAX_PATH]; sprintf (__log, "%s\\nwnx_funcs.txt", LogDir); if (!CNWNXBase::OnCreate(__log)) return false; CIniFile iniFile ("nwnx.ini"); int debugLevel = iniFile.ReadInteger("FUNCS", "DebugLevel", 0); LogFile::SetDebugLevel(debugLevel); nSkill = iniFile.ReadInteger("FUNCS", "Number_of_Skills", 28); bHookCreateGeometry = iniFile.ReadInteger("FUNCS", "HOOK_CustomTrapGeometry", 0); bOverrideMaximumDexMod = iniFile.ReadInteger("FUNCS", "HOOK_OverrideMaximumDexMod", 0); if ((bHookRemovePCFromWorld = iniFile.ReadInteger("FUNCS", "HOOK_OnPlayerLeaving", 0))) { iniFile.ReadString("FUNCS", "OnPlayerLeavingScript", OnPlayerLeavingScript, 17, "onplayerleaving"); } if ((bHookTimeOfDayChange = iniFile.ReadInteger("FUNCS", "HOOK_TimeOfDayChange", 0))) { iniFile.ReadString("FUNCS", "OnTimeOfDayChangeScript", OnTimeOfDayChangeScript, 17, "mod_timechanged"); } WriteLogHeader(debugLevel); FunctionHooks = new CHookFunctions(); NssLocalVariables = new CNssLocalVariables; NssAreas = new CNssAreas; NssUtility = new CNssUtility; NssItems = new CNssItems; NssEffects = new CNssEffects; NssCreatureStats = new CNssCreatureStats(nSkill); Visibility = new CVisibility; NssCustomTrigger = new CNssCustomTrigger; NssCreature = new CNssCreature; NssFeats = new CNssFeats; NssSpells = new CNssSpells; NssObject = new CNssObject; NssLock = new CNssLock; NssPlayer = new CNssPlayer; NssServer = new CNssServer; NssTransition = new CNssTransition; NssItemProperty = new CNssItemProperty; NssModule = new CNssModule; MainLookup = NssLocalVariables; return true; }
void AxisSettings::SendConfig(MyDevice* d) { //Send acceleration CIniFile ini; unsigned char buffer[64] = {0}; buffer[0] = 1; buffer[1] = RECEIVER_CONFIG; buffer[2] = CONFIG_REC_AXIS; buffer[3] = CONFIG_AXIS_ACCELERATION; *((float*)(buffer + 4)) = StringToFloat(ini.GetValue("maxLinearAcceleration", "axis", iniFile)); d->SendRawData(buffer, sizeof(buffer)); //Send update period buffer[3] = CONFIG_AXIS_UPDATE_PERIOD; *((uint32_t*)(buffer + 4)) = StringToInt(ini.GetValue("updatePeriod", "axis", iniFile)); d->SendRawData(buffer, sizeof(buffer)); //Send jerk buffer[3] = CONFIG_AXIS_JERK; *((float*)(buffer + 4)) = StringToFloat(ini.GetValue("maxLinearJerk", "axis", iniFile)); d->SendRawData(buffer, sizeof(buffer)); }
BOOL COnlineProgramConfirmStart::OnInitDialog() { CString csFileName; CIniFile IniFile; CDialog::OnInitDialog(); CenterWindow(); // TODO-replace with registry functions Util::GetWindowsDirectory(csFileName); csFileName += "\\ConnMgr.ini"; IniFile.Name(csFileName); BOOL bShowMe = (BOOL)IniFile.GetInteger("Configuration", "ShowOnlineConfirm", 1); if(!bShowMe) EndDialog(IDOK); m_bDontShowMe = FALSE; UpdateData(FALSE); // Send Member variables to dialog return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
// load the buy priority configuration file void CCSBuyManager::LoadBuyPriority() { // load the ini file CIniFile ini; // try to load the map specific buy configuration file ini.Load(g_General.BuildFileName(va("buy_cs(%s).ini", g_pServer->GetMapName()))); // if the map specific buy configuration file doesn't exist, // load the general buy configuration file. if (!ini.Valid()) ini.Load(g_General.BuildFileName("buy_cs.ini")); #define PARSE_PRIORITY(szString, vecTable) \ { \ char *pszStart = (char *)szString; \ \ while (pszStart && *pszStart) { \ char *pszEnd = strchr(pszStart, ','); \ vecTable.push_back(atoi(pszStart)); \ \ if (pszEnd == NULL) \ break; \ \ pszStart = pszEnd + 1; \ } \ } // parse each line in the file... PARSE_PRIORITY(ini.Get("CT", "Aggressive"), aggressive_ct); PARSE_PRIORITY(ini.Get("CT", "Normal"), normal_ct); PARSE_PRIORITY(ini.Get("CT", "Defensive"), defensive_ct); PARSE_PRIORITY(ini.Get("T", "Aggressive"), aggressive_t); PARSE_PRIORITY(ini.Get("T", "Normal"), normal_t); PARSE_PRIORITY(ini.Get("T", "Defensive"), defensive_t); }
PreviewWindow::PreviewWindow(wxWindow *parent, int x, int y, int w, int h, long style, const wxString &name): wxPanel(parent, x, y, w, h, style, name), wheelPosition(0), zoomFactor(0.2f), drawTrajectory(true) { Connect(this->GetId(), wxEVT_PAINT, wxPaintEventHandler(PreviewWindow::OnPaint)); Connect(this->GetId(), wxEVT_MOTION, wxMouseEventHandler(PreviewWindow::OnMouseMove)); Connect(this->GetId(), wxEVT_MOUSEWHEEL, wxMouseEventHandler(PreviewWindow::OnWheelMoved)); SetBackgroundStyle(wxBG_STYLE_CUSTOM); CIniFile ini; originSize = StringToFloat(ini.GetValue("originSize", "UI", iniFile)); zoomFactor = StringToFloat(ini.GetValue("zoomCoefficient", "UI", iniFile)); lineWidth = StringToFloat(ini.GetValue("lineWidth", "UI", iniFile)); rapidColour = ParseColour(ini.GetValue("rapidColour", "UI", iniFile)); normalColour = ParseColour(ini.GetValue("normalColour", "UI", iniFile)); cCWColour = ParseColour(ini.GetValue("CWColour", "UI", iniFile)); cCCWColour = ParseColour(ini.GetValue("CCWColour", "UI", iniFile)); trajectoryColour = ParseColour(ini.GetValue("trajectoryColour", "UI", iniFile)); backgroundColour = ParseColour(ini.GetValue("backgroundColour", "UI", iniFile)); }
void HCVTreatment_TwoDrug::process_ini_file(CIniFile& INIFile) { const string Directories_Name = "Directories"; const string InputDir_Name = "InputDir"; const string HCVTreatment_TwoDrugs_Name = "HCVTreatment_TwoDrugs"; const string rate_mort_Tx_Name = "rate_mort_Tx"; const string rate_quit_Tx_Name = "rate_quit_Tx"; const string Effectiveness_Name = "Effectiveness"; const string cost_Tx_wk_Name = "cost_Tx_wk"; const string cost_Tx_sideeffects_Name = "cost_Tx_sideeffects"; const string qol_Tx_decrement_wk_Name = "qol_Tx_decrement_wk"; rate_mort_Tx = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, rate_mort_Tx_Name); rate_quit_Tx = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, rate_quit_Tx_Name); cost_Tx_wk = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, cost_Tx_wk_Name); cost_Tx_sideeffects = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, cost_Tx_sideeffects_Name); qol_Tx_decrement_wk = INIFile.GetValueF(HCVTreatment_TwoDrugs_Name, qol_Tx_decrement_wk_Name); string InputDir = INIFile.GetValue(Directories_Name, InputDir_Name); string Effectiveness_File = INIFile.GetValue(HCVTreatment_TwoDrugs_Name, Effectiveness_Name); string effectiveness_path(InputDir); effectiveness_path.append(Effectiveness_File); ifstream effectiveness_data; effectiveness_data.open(effectiveness_path.c_str() ); if (!effectiveness_data) { // Check that the file was opened cerr << "Unable to open file " << effectiveness_path << endl; exit(1); // call system to stop } EffectivenessTable.loadData(effectiveness_data); effectiveness_data.close(); }
static void LoadSettings() { CIniFile ini; ini.OpenDefault(); Settings.lVersion = 0; // general section CIniSection* sctn = ini.GetSection( g_szGeneralSection ); Settings.dwSnapshot = sctn->GetValueInt( g_szSnapshot, ED_MINI_DUMP ); LPCTSTR str = sctn->GetValueString( g_szDumpPath, _T("") ); _tcsncpy( Settings.szDumpPath, str, _countof(Settings.szDumpPath) ); Settings.szDumpPath[_countof(Settings.szDumpPath) - 1] = 0; // crash section sctn = ini.GetSection( g_szCrashSection ); Settings.dwFirstChance = sctn->GetValueInt( g_szFirstChance, ED_DONT_DUMP ); Settings.dwSecondChance = sctn->GetValueInt(g_szSecondChance, ED_MINI_DUMP); Settings.bAutoDelete = sctn->GetValueBool( g_szAutoDelete, true ); // user exception list sctn = ini.GetSection( g_szUserExceptionSection ); size_t pos = sctn->GetFirstKeyPosition(); while( pos != 0xffffffff ) { CIniKey* key = sctn->GetNextKey( pos ); CExceptionInfo ei; ei.bUser = true; ei.bFiltered = false; ei.dwCode = _tcstoul( key->GetName(), NULL, 0 ); _tcsncpy( ei.szName, key->GetValueString(), _countof(ei.szName) ); ei.szName[_countof(ei.szName) - 1] = 0; g_aException.Add( ei ); } // filter section sctn = ini.GetSection( g_szFilterSection ); pos = sctn->GetFirstKeyPosition(); while( pos != 0xffffffff ) { CIniKey* key = sctn->GetNextKey( pos ); DWORD code = _tcstoul( key->GetName(), NULL, 0 ); CExceptionInfo* pei = GetExceptionInfoByCode( code ); if( pei != NULL ) pei->bFiltered = key->GetValueBool(); } }
static void SaveSettings() { CIniFile ini; // general section CIniSection* sctn = ini.GetSection( g_szGeneralSection ); sctn->SetValueInt( g_szSnapshot, Settings.dwSnapshot ); sctn->SetValueString( g_szDumpPath, Settings.szDumpPath ); // crash section sctn = ini.GetSection( g_szCrashSection ); sctn->SetValueInt( g_szFirstChance, Settings.dwFirstChance ); sctn->SetValueInt( g_szSecondChance, Settings.dwSecondChance ); sctn->SetValueBool( g_szAutoDelete, !!Settings.bAutoDelete ); // user exception list sctn = ini.GetSection( g_szUserExceptionSection ); for( size_t i = 0; i < g_aException.GetCount(); ++i ) { if( !g_aException[i].bUser ) continue; TCHAR buf[16]; _sntprintf( buf, _countof(buf), _T("0x%08X"), g_aException[i].dwCode ); sctn->SetValueString( buf, g_aException[i].szName ); } // filter section sctn = ini.GetSection( g_szFilterSection ); for( size_t i = 0; i < g_aException.GetCount(); ++i ) { TCHAR buf[16]; _sntprintf( buf, _countof(buf), _T("0x%08X"), g_aException[i].dwCode ); sctn->SetValueBool( buf, g_aException[i].bFiltered ); } ini.SaveToDefault(); }
void GCodeInterpreter::LoadConfiguration() { CIniFile ini; rapidFeed=StringToFloat(ini.GetValue("defaultRapidFeed", "gcode", iniFile)); standardFeed=StringToFloat(ini.GetValue("defaultStandardFeed", "gcode", iniFile)); maxAcceleration=StringToFloat(ini.GetValue("maxLinearAcceleration", "axis", iniFile)); maxJerk=StringToFloat(ini.GetValue("maxLinearJerk", "axis", iniFile)); maxRapidTollerance=StringToFloat(ini.GetValue("maxRapidTollerance", "gcode", iniFile)); maxStandardTollerance=StringToFloat(ini.GetValue("maxStandardTollerance", "gcode", iniFile)); unitMultiply=StringToFloat(ini.GetValue("defaultUnits", "gcode", iniFile)); string temp = ini.GetValue("defaultWorkingPlane", "gcode", iniFile); if(temp == "XY") workingPlane = XY; else if(temp == "YZ") workingPlane = YZ; else if(temp == "XY") workingPlane = XY; else { wxString text = wxT("Špatnì nastavená pracovní rovina v ini souboru. Použít XY a pokraèovat?"); if(wxMessageBox(text, wxT("Chyba!"), wxYES_NO | wxICON_EXCLAMATION) == wxNO) throw(exception("Operace ukonèena")); workingPlane = XY; } temp = ini.GetValue("defaultCoordType", "gcode", iniFile); if(temp == "absolute" || temp == "abs" || temp == "ABS") coordType = ABS; else if(temp == "relative" || temp == "rel" || temp == "REL" || temp == "incremental" || temp == "inc" || temp == "INC") coordType = INC; else { wxString text = wxT("Špatnì nastavený typ souøadnic v ini souboru. Použít absolutní a pokraèovat?"); if(wxMessageBox(text, wxT("Chyba!"), wxYES_NO | wxICON_EXCLAMATION) == wxNO) throw(exception("Operace ukonèena")); coordType = ABS; } temp = ini.GetValue("defaultArcCoordType", "gcode", iniFile); if(temp == "absolute" || temp == "abs" || temp == "ABS") arcCoordType = ABS; else if(temp == "relative" || temp == "rel" || temp == "REL" || temp == "incremental" || temp == "inc" || temp == "INC") arcCoordType = INC; else { wxString text = wxT("Špatnì nastavený typ souøadnic pro oblouky v ini souboru. Použít absolutní a pokraèovat?"); if(wxMessageBox(text, wxT("Chyba!"), wxYES_NO | wxICON_EXCLAMATION) == wxNO) throw(exception("Operace ukonèena")); arcCoordType = ABS; } }
void Simulation::init(CIniFile& Master) { // Section names (keys for Master) const string InputDataFiles_Name = "InputDataFiles"; const string OutputDataFiles_Name = "OutputDataFiles"; const string DataValues_Name = "DataValues"; const string Directories_Name = "Directories"; // Input data Files const string Mortality_Name = "Mortality"; const string Fibrosis_Name = "Fibrosis"; const string IL28B_Name = "IL28B"; const string HighRisk_Name = "HighRisk"; const string HCV_Name = "HCV"; const string Genotype_Name = "Genotype"; const string FibrosisProgression_Name = "FibrosisProgression"; const string AgeCostsUtilities_Name = "AgeCostsUtilities"; const string HCVStateCosts_Name = "HCVStateCosts"; const string HCVStateUtilities_Name = "HCVStateUtilities"; // Output data files const string Output_BaselinePrev_Name = "Output_BaselinePrev"; const string Output_LE_Name = "Output_LE"; const string Output_MarkovTrace_Name = "Output_MarkovTrace"; const string Output_CEA_Name = "Output_CEA"; // Data values const string sim_size_Name = "sim_size"; const string start_age_yrs_Name = "start_age_yrs"; const string prop_male_Name = "prop_male"; const string prop_white_Name = "prop_white"; const string prop_nonprogress_Name = "prop_nonprogress"; const string prop_aware_Name = "prop_aware"; const string rate_remission_Name = "rate_remission"; const string rate_F4_DC_Name = "rate_F4_DC"; const string rate_F4DC_HCC_Name = "rate_F4DC_HCC"; const string rate_F4TX_HCC_Name = "rate_F4TX_HCC"; const string rate_DC_LT_Name = "rate_DC_LT"; const string rate_HCC_LT_Name = "rate_HCC_LT"; const string rate_mort_LT_Name = "rate_mort_LT"; const string rate_mort_postLT_Name = "rate_mort_postLT"; const string rate_mort_DC_Name = "rate_mort_DC"; const string rate_mort_HCCfirstyear_Name = "rate_mort_HCCfirstyear"; const string rate_mort_HCC2plusyears_Name = "rate_mort_HCC2plusyears"; const string rate_mort_Tx_Name = "rate_mort_Tx"; const string factor_redux_Cure_Name = "factor_redux_Cure"; const string prob_mort_liverbiopsy_Name = "prob_mort_liverbiopsy"; const string limit_maxLTage_yrs_Name = "limit_maxLTage_yrs"; const string annual_discount_rate_Name = "annual_discount_rate"; const string qol_hcvaware_decrement_Name = "qol_hcvaware_decrement"; const string qol_LT_decrement_Name = "qol_LT_decrement"; const string qol_SVR_F0_Name = "qol_SVR_F0"; const string qol_SVR_F1_Name = "qol_SVR_F1"; const string qol_SVR_F2_Name = "qol_SVR_F2"; const string qol_SVR_F3_Name = "qol_SVR_F3"; const string qol_SVR_F4_Name = "qol_SVR_F4"; const string cost_recover_F0F3_Name = "cost_recover_F0F3"; const string cost_recover_F4_Name = "cost_recover_F4"; const string treatment_strategy_Name = "treatment_strategy"; // Directories const string InputDir_Name = "InputDir"; const string OutputDir_Name = "OutputDir"; // Read names for directories string InputDir = Master.GetValue(Directories_Name, InputDir_Name); string OutputDir = Master.GetValue(Directories_Name, OutputDir_Name); // Number of People to Simulate and other Simulation Parameters sim_size = Master.GetValueF(DataValues_Name, sim_size_Name); int start_age_yrs = Master.GetValueF(DataValues_Name, start_age_yrs_Name); // Setup Random Number Generator System RandGen = new RandomBin; // Create an instance of RandomBin called RandGen RandGen->seed(); // Seed RandGen // Mortality Risks string Mortality_File = Master.GetValue(InputDataFiles_Name, Mortality_Name); mortality = new Mortality; string mortality_path(InputDir); mortality_path.append(Mortality_File); mortality->init(mortality_path); // Baseline Values string Fibrosis_File = Master.GetValue(InputDataFiles_Name, Fibrosis_Name); string IL28B_File = Master.GetValue(InputDataFiles_Name, IL28B_Name); string HighRisk_File = Master.GetValue(InputDataFiles_Name, HighRisk_Name); string HCV_File = Master.GetValue(InputDataFiles_Name, HCV_Name); string Genotype_File = Master.GetValue(InputDataFiles_Name, Genotype_Name); double prop_male = Master.GetValueF(DataValues_Name, prop_male_Name); double prop_white = Master.GetValueF(DataValues_Name, prop_white_Name); double prop_nonprogress = Master.GetValueF(DataValues_Name, prop_nonprogress_Name); double prop_aware = Master.GetValueF(DataValues_Name, prop_aware_Name); baseline = new Baseline; string fibrosis_path(InputDir); string il28b_path(InputDir); string highrisk_path(InputDir); string hcv_path(InputDir); string genotype_path(InputDir); fibrosis_path.append(Fibrosis_File); il28b_path.append(IL28B_File); highrisk_path.append(HighRisk_File); hcv_path.append(HCV_File); genotype_path.append(Genotype_File); baseline->init(fibrosis_path, il28b_path, highrisk_path, hcv_path, genotype_path, prop_male, prop_white, prop_nonprogress, prop_aware, start_age_yrs); // Costs and Utility Weights string AgeCostsUtilities_File = Master.GetValue(InputDataFiles_Name, AgeCostsUtilities_Name); string HCVStateCosts_File = Master.GetValue(InputDataFiles_Name, HCVStateCosts_Name); string HCVStateUtilities_File = Master.GetValue(InputDataFiles_Name, HCVStateUtilities_Name); string age_costs_utilities_path(InputDir); string hcv_state_costs_path(InputDir); string hcv_state_utilities_path(InputDir); age_costs_utilities_path.append(AgeCostsUtilities_File); hcv_state_costs_path.append(HCVStateCosts_File); hcv_state_utilities_path.append(HCVStateUtilities_File); double annual_discount_rate = Master.GetValueF(DataValues_Name, annual_discount_rate_Name); double qol_hcvaware_decrement = Master.GetValueF(DataValues_Name, qol_hcvaware_decrement_Name); double qol_LT_decrement = Master.GetValueF(DataValues_Name, qol_LT_decrement_Name); double qol_SVR_F0 = Master.GetValueF(DataValues_Name, qol_SVR_F0_Name); double qol_SVR_F1 = Master.GetValueF(DataValues_Name, qol_SVR_F1_Name); double qol_SVR_F2 = Master.GetValueF(DataValues_Name, qol_SVR_F2_Name); double qol_SVR_F3 = Master.GetValueF(DataValues_Name, qol_SVR_F3_Name); double qol_SVR_F4 = Master.GetValueF(DataValues_Name, qol_SVR_F4_Name); double cost_recover_F0F3 = Master.GetValueF(DataValues_Name, cost_recover_F0F3_Name); double cost_recover_F4 = Master.GetValueF(DataValues_Name, cost_recover_F4_Name); hcvcea = new HCVCEA(); hcvcea->init(annual_discount_rate, start_age_yrs, age_costs_utilities_path, hcv_state_costs_path, hcv_state_utilities_path, qol_hcvaware_decrement, qol_LT_decrement, cost_recover_F0F3, cost_recover_F4, qol_SVR_F0, qol_SVR_F1, qol_SVR_F2, qol_SVR_F3, qol_SVR_F4); // Progression Values string FibrosisProgression_File = Master.GetValue(InputDataFiles_Name, FibrosisProgression_Name); string fibrosisprogression_path(InputDir); fibrosisprogression_path.append(FibrosisProgression_File); HCVProgression::HCVProgressionData progdata; progdata.rate_remission = Master.GetValueF(DataValues_Name, rate_remission_Name); progdata.rate_F4_DC = Master.GetValueF(DataValues_Name, rate_F4_DC_Name); progdata.rate_F4DC_HCC = Master.GetValueF(DataValues_Name, rate_F4DC_HCC_Name); progdata.rate_F4TX_HCC = Master.GetValueF(DataValues_Name, rate_F4TX_HCC_Name); progdata.rate_DC_LT = Master.GetValueF(DataValues_Name, rate_DC_LT_Name); progdata.rate_HCC_LT = Master.GetValueF(DataValues_Name, rate_HCC_LT_Name); progdata.rate_mort_LT = Master.GetValueF(DataValues_Name, rate_mort_LT_Name); progdata.rate_mort_postLT = Master.GetValueF(DataValues_Name, rate_mort_postLT_Name); progdata.rate_mort_DC = Master.GetValueF(DataValues_Name, rate_mort_DC_Name); progdata.rate_mort_HCCfirstyear = Master.GetValueF(DataValues_Name, rate_mort_HCCfirstyear_Name); progdata.rate_mort_HCC2plusyears = Master.GetValueF(DataValues_Name, rate_mort_HCC2plusyears_Name); progdata.rate_mort_Tx = Master.GetValueF(DataValues_Name, rate_mort_Tx_Name); progdata.factor_redux_Cure = Master.GetValueF(DataValues_Name, factor_redux_Cure_Name); progdata.prob_mort_liverbiopsy = Master.GetValueF(DataValues_Name, prob_mort_liverbiopsy_Name); progdata.limit_maxLTage_yrs = Master.GetValueF(DataValues_Name, limit_maxLTage_yrs_Name); hcvprogression = new HCVProgression(); hcvprogression->init(fibrosisprogression_path, progdata, hcvcea); // Treatment Strategy string treatment_strategy = Master.GetValue(DataValues_Name, treatment_strategy_Name); hcvtreatment = get_treatment_strategy(treatment_strategy, &Master, hcvcea); hcvtreatment_status = hcvtreatment->get_treatment_status(); // Setup Population for Output of Simulation Information string BaselinePrev_File = Master.GetValue(OutputDataFiles_Name, Output_BaselinePrev_Name); string LE_File = Master.GetValue(OutputDataFiles_Name, Output_LE_Name); string MarkovTrace_File = Master.GetValue(OutputDataFiles_Name, Output_MarkovTrace_Name); string CEA_File = Master.GetValue(OutputDataFiles_Name, Output_CEA_Name); string baselineprev_path(OutputDir); string le_path(OutputDir); string markovtrace_path(OutputDir); string cea_path(OutputDir); baselineprev_path.append(BaselinePrev_File); le_path.append(LE_File); markovtrace_path.append(MarkovTrace_File); cea_path.append(CEA_File); population = new Population(); population->init(hcvcea, baselineprev_path, le_path, markovtrace_path, cea_path); }
ResourceId CResourceManager::loadShader(const std::string& file) { // Check if shader exists auto entry = m_shaderFiles.find(file); if (entry != m_shaderFiles.end()) { return entry->second; } LOG_DEBUG("Loading shader from file %s.", file.c_str()); // Load shader ini CIniFile ini; if (!ini.load(file)) { LOG_ERROR("Failed to load shader program file %s", file.c_str()); return -1; } // Requires vertex and fragment shader files if (!ini.hasKey("vertex", "file") || !ini.hasKey("fragment", "file")) { LOG_ERROR( "The shader program file %s is missing a vertex and/or fragment shader source file " "specifier.", file.c_str()); return -1; } ResourceId vertexId = loadString(ini.getValue("vertex", "file", "error"), true); if (vertexId == -1) { LOG_ERROR( "The vertex shader source file %s, specified in the shader program file %s could not " "be loaded.", ini.getValue("vertex", "file", "error").c_str(), file.c_str()); return -1; } ResourceId fragmentId = loadString(ini.getValue("fragment", "file", "error"), true); if (fragmentId == -1) { LOG_ERROR( "The fragment shader source file %s, specified in the shader program file %s could not " "be loaded.", ini.getValue("fragment", "file", "error").c_str(), file.c_str()); return -1; } ResourceId tessCtrlId = -1; // Check for and load tessellation control shader source if (ini.hasKey("tessellation_control", "file")) { tessCtrlId = loadString(ini.getValue("tessellation_control", "file", "error"), true); if (tessCtrlId == -1) { LOG_ERROR( "The tessellation control shader source file %s, specified in the shader program " "file %s could not be loaded.", ini.getValue("tessellation_control", "file", "error").c_str(), file.c_str()); return -1; } } ResourceId tessEvalId = -1; // Check for and load tessellation evaluation shader source if (ini.hasKey("tessellation_evaluation", "file")) { tessEvalId = loadString(ini.getValue("tessellation_evaluation", "file", "error"), true); if (tessEvalId == -1) { LOG_ERROR( "The tessellation evaluation shader source file %s, specified in the shader " "program file %s could not be loaded.", ini.getValue("tessellation_evaluation", "file", "error").c_str(), file.c_str()); return -1; } } ResourceId geometryId = -1; // Check for and load geometry shader source if (ini.hasKey("geometry", "file")) { geometryId = loadString(ini.getValue("geometry", "file", "error"), true); if (geometryId == -1) { LOG_ERROR( "The geometry shader source file %s, specified in the shader program file %s could " "not be loaded.", ini.getValue("geometry", "file", "error").c_str(), file.c_str()); return -1; } } ResourceId shaderId = -1; // Create new entry shaderId = createShader(vertexId, tessCtrlId, tessEvalId, geometryId, fragmentId); if (shaderId == -1) { LOG_ERROR("Failed to create reasource id for shader file %s.", file.c_str()); return -1; } m_shaderFiles[file] = shaderId; return shaderId; }
ResourceId CResourceManager::loadMaterial(const std::string& file) { auto entry = m_materialFiles.find(file); if (entry != m_materialFiles.end()) { return entry->second; } LOG_DEBUG("Loading material from file %s.", file.c_str()); CIniFile ini; if (!ini.load(file)) { LOG_ERROR("Failed to load material file %s as ini file.", file.c_str()); return -1; } ResourceId diffuseId = -1; if (ini.hasKey("diffuse", "file")) { // Diffuse texture is RGB format, ignore alpha diffuseId = loadImage(ini.getValue("diffuse", "file", "error"), EColorFormat::RGB24); if (diffuseId == -1) { LOG_ERROR("Failed to load diffuse texture specified in material file %s.", file.c_str()); return -1; } } ResourceId normalId = -1; if (ini.hasKey("normal", "file")) { // Normal texture is RGB format normalId = loadImage(ini.getValue("normal", "file", "error"), EColorFormat::RGB24); if (normalId == -1) { LOG_ERROR("Failed to load normal texture specified in material file %s.", file.c_str()); return -1; } } ResourceId specularId = -1; if (ini.hasKey("specular", "file")) { // Specular texture is grey-scale format specularId = loadImage(ini.getValue("specular", "file", "error"), EColorFormat::GreyScale8); if (specularId == -1) { LOG_ERROR("Failed to load specular texture specified in material file %s.", file.c_str()); return -1; } } ResourceId glowId = -1; if (ini.hasKey("glow", "file")) { // Glow texture is grey-scale format glowId = loadImage(ini.getValue("glow", "file", "error"), EColorFormat::GreyScale8); if (glowId == -1) { LOG_ERROR("Failed to load glow texture specified in material file %s.", file.c_str()); return -1; } } ResourceId alphaId = -1; if (ini.hasKey("alpha", "file")) { // Alpha texture is grey-scale format alphaId = loadImage(ini.getValue("alpha", "file", "error"), EColorFormat::GreyScale8); if (alphaId == -1) { LOG_ERROR("Failed to load alpha texture specified in material file %s.", file.c_str()); return -1; } } ResourceId customShaderId = -1; if (ini.hasKey("shader", "file")) { // Has custom shader file specified customShaderId = loadShader(ini.getValue("shader", "file", "error")); if (customShaderId == -1) { LOG_ERROR("Failed to load custom shader file specified in material file %s.", file.c_str()); return -1; } } ResourceId materialId = createMaterial(diffuseId, normalId, specularId, glowId, alphaId, customShaderId); if (materialId == -1) { LOG_ERROR("Failed to create material resource id for material file %s.", file.c_str()); return -1; } m_materialFiles[file] = materialId; return materialId; }
bool CNWNXODBC::LoadConfiguration () { char buffer[256]; CIniFile iniFile ("nwnx.ini"); memset (&p, 0, sizeof (PARAMETERS)); // read log file parameters m_maxLogSizeKB = 1024 * iniFile.ReadLong("ODBC2", "MaxLogSize", 1024); if (m_maxLogSizeKB < 1024) m_maxLogSizeKB = 1024; logLevel = iniFile.ReadLong("ODBC2", "LogLevel", 2); if ((logLevel < 0) || (logLevel > 2)) logLevel = 2; // see what mode should be used iniFile.ReadString ("ODBC2", "source", buffer, 256, "ODBC"); if (_stricmp (buffer, "ODBC") == 0) { iniFile.ReadString ("ODBC2", "dsn", buffer, 256, "nwn"); p.server = _strdup (buffer); dbType = dbODBC; } else if (_stricmp (buffer, "MYSQL") == 0) { // load in the settings for a direct mysql connection iniFile.ReadString ("ODBC2", "server", buffer, 256, "localhost"); p.server = _strdup (buffer); iniFile.ReadString ("ODBC2", "user", buffer, 256, ""); p.user = _strdup (buffer); iniFile.ReadString ("ODBC2", "pwd", buffer, 256, ""); p.pass = _strdup (buffer); iniFile.ReadString ("ODBC2", "db", buffer, 256, ""); p.db = _strdup (buffer); dbType = dbMYSQL; } else if (_stricmp (buffer, "SQLITE") == 0) { // load in the settings for the internal database dbType = dbSQLITE; iniFile.ReadString ("ODBC2", "file", buffer, 256, ""); p.db = _strdup (buffer); } else { Log ("o Critical Error: Datasource must be MySQL, ODBC, or SQLite.\n"); dbType = dbNONE; return false; } // check if scorco should be hooked iniFile.ReadString ("ODBC2", "hookscorco", buffer, 256, ""); if (_stricmp (buffer, "false") == 0) hookScorco = false; return true; }
CSkyDomeImage::CSkyDomeImage (double distance) { int i, j; // Add default Perez parameters SPerezParameters *pDefault = new SPerezParameters; memcpy (pDefault, &DefaultPerezParameters, sizeof(SPerezParameters)); perez[DefaultPerezParameters.name] = pDefault; // // Load Perez parameter sets from SKIES.INI // CIniFile *inisky = new CIniFile; if (inisky->Load ("System/Skies.ini") != 0) { // SKIES.INI could be read; parse parameters from INI settings int nSkies = inisky->GetNumSections(); for (i=0; i<nSkies; i++) { SPerezParameters *p = new SPerezParameters; memcpy (p, &DefaultPerezParameters, sizeof(SPerezParameters)); char* skyname = inisky->GetSectionName (i); InitPerezParameters (p, inisky, skyname); perez[skyname] = p; } } delete inisky; // Get default sky name from INI settings perezCurrent = &DefaultPerezParameters; char skyname[64]; strcpy (skyname, ""); GetIniString ("Graphics", "skyDefaultName", skyname, 64); if (strlen (skyname) > 0) { // Parameter was specified, search available skies for the default std::map<string,SPerezParameters*>::iterator i = perez.find(skyname); if (i != perez.end()) { perezCurrent = i->second; } } // // Generate raw vertex data // // The sky dome vertex raw data is made up of a single zenith vertex, plus // SKYDOME_STACKS "rings" of SKYDOME_SLICES vertices in each ring. The top of // the sky dome is constructed of a triangle fan between the zenith // vertex and each of the vertices in the top ring. The remainder of the // dome is constructed of triangle strips spanning each successive vertex ring. // // Allocate array for dome vertices // This array is used for both the zenith triangle fan, and for the triangle strips // for the remainder of the dome. // Array size is 1 (for zenith) + strips of SKYDOME_SLICES vertices to define the // top and bottom of each strip, i.e. (SKYDOME_STACKS + 1) nDomeVertices = ((SKYDOME_STACKS + 1) * SKYDOME_SLICES) + 1; domeVertex = new GLfloat[3 * nDomeVertices]; // First vertex is the zenith domeVertex[0] = 0; domeVertex[1] = 0; domeVertex[2] = 1.0f; // Iterate over all vertices of all rings double thetaExtent = (SGD_PI / 2.0) * SKYDOME_HEMISPHERE_SCALE; double dTheta = thetaExtent / SKYDOME_STACKS; double dPhi = (SGD_PI * 2.0) / SKYDOME_SLICES; int iVertex = 1; for (i=0; i<SKYDOME_STACKS+1; i++) { // Calculate zenith angle theta for all vertices in this ring double theta = (i+1) * dTheta; for (j=0; j<SKYDOME_SLICES; j++) { // Calculate azimuth angle phi for this vertex, in radians E of N double phi = (j * dPhi); // Save zenith angle and azimuth at this point sgSetVec2 (vtx_ring_angles[i][j], (float)theta, (float)phi); // Calculate vertex coordinates domeVertex[iVertex*3] = (float)(sin(phi) * sin(theta)); // X-coordinate domeVertex[iVertex*3+1] = (float)(cos(phi) * sin(theta)); // Y-coordinate domeVertex[iVertex*3+2] = (float)(cos(theta)); // Z-coordinate iVertex++; } } // Create colour array and initialize as if it were full night; first call to // Repaint() will set vertex colours appropriately domeColour = new GLfloat[3 * nDomeVertices]; memset (domeColour, 0, 3 * nDomeVertices * sizeof(float)); night = true; // Create element array for rendering zenith fan nFanElements = SKYDOME_SLICES + 2; fanElements = new GLuint[nFanElements]; fanElements[0] = 0; for (int i=0; i<SKYDOME_SLICES; i++) { fanElements[i+1] = i+1; } fanElements[SKYDOME_SLICES+1] = 1; // Create element array for rendering remainder of dome nDomeElements = SKYDOME_STACKS * 2 * (SKYDOME_SLICES + 1) + 2 * (SKYDOME_STACKS - 1); domeElements = new GLuint[nDomeElements]; int iNext = 0; for (i=0; i<SKYDOME_STACKS; i++) { // Calculate base vertex indices for the upper and lower bounds of this stack GLuint upperBase = i * SKYDOME_SLICES + 1; GLuint lowerBase = (i+1) * SKYDOME_SLICES + 1; // If not the first stack, duplicate first element to concatenate with previous if (i != 0) { domeElements[iNext++] = upperBase; } // Send upper-left and lower-left vertices for (j=0; j<SKYDOME_SLICES; j++) { domeElements[iNext++] = upperBase + j; domeElements[iNext++] = lowerBase + j; } domeElements[iNext++] = upperBase; domeElements[iNext++] = lowerBase; // If not the last stack, duplicate last element to concatenate with next if (i != SKYDOME_STACKS-1) { domeElements[iNext++] = lowerBase + (SKYDOME_SLICES-1); } } // Initialize repaint solar zenith angle this->distance = distance; prevTheta = 0; prevPhi = 0; }
bool CGbaLoader::LoadInternal(bool nor,bool force) { bool load=false; expansion().SoftReset(); std::string oldFile,oldFileNOR; CIniFile f; oldFile=f.LoadIniFile(SFN_LAST_GBA_SAVEINFO)?f.GetString("Save Info","lastLoaded",""):""; oldFileNOR=f.LoadIniFile(SFN_LAST_GBA_SAVEINFO)?f.GetString("Save Info","lastLoadedNOR",""):""; if(StoreOldSave(oldFile)) { oldFile=""; f.SetString("Save Info","lastLoaded",""); f.SaveIniFile(SFN_LAST_GBA_SAVEINFO); } u32 state=0; if(nor) state|=1; if(oldFile==iFileName) state|=2; if(oldFileNOR==iFileName) state|=4; if(force) state|=8; switch(state) { case 0: if(oldFile!="") cSram::SaveSramToFile(oldFile.c_str(),cExpansion::EPsramPage); cSram::LoadSramFromFile(iFileName.c_str(),cExpansion::EPsramPage); f.SetString("Save Info","lastLoaded",iFileName); f.SaveIniFile(SFN_LAST_GBA_SAVEINFO); load=LoadPSRAM(); InitPSRAM(); break; case 10: case 11: if(oldFile!="") cSram::SaveSramToFile(oldFile.c_str(),cExpansion::EPsramPage); f.SetString("Save Info","lastLoaded",""); case 1: case 8: case 9: if(oldFileNOR!="") cSram::SaveSramToFile(oldFileNOR.c_str(),cExpansion::ENorPage); cSram::LoadSramFromFile(iFileName.c_str(),cExpansion::ENorPage); f.SetString("Save Info","lastLoadedNOR",iFileName); f.SaveIniFile(SFN_LAST_GBA_SAVEINFO); load=LoadNor(); InitNor(); break; case 2: case 3: load=LoadPSRAM(); InitPSRAM(); break; case 4: case 5: case 6: case 7: case 12: case 13: case 14: case 15: load=true; InitNor(); break; default: expansion().SoftReset(); break; } return load; }