Storage::Loader Storage::loader(std::string const& name) { if(name.empty()) return Loader(this, loaderByName_.begin()); return Loader(this, loaderByName_.find(name)); }
Storage::Loader Storage::Loader::next() const { if(storage_ && it_ != storage_->loaderByName_.end()) { auto nextIt = it_; return Loader(storage_, ++nextIt); } return Loader(); }
Storage::Loader Storage::createLoader(const std::string& name, const std::string& path) { auto it = loaderByName_.find(name); if(it != loaderByName_.end()) return Loader(); auto result = loaderByName_.emplace(name, path); isChanged_ = true; return Loader(this, result.first); }
bool ScreenGameplay7K::LoadChartData() { uint8_t index = 0; if (!Preloaded) { // The difficulty details are destroyed; which means we should load this from its original file. SongLoader Loader(GameState::GetInstance().GetSongDatabase()); Directory FN; Log::Printf("Loading Chart..."); LoadedSong = Loader.LoadFromMeta(MySong.get(), CurrentDiff, &FN, index); if (LoadedSong == nullptr) { Log::Printf("Failure to load chart. (Filename: %s)\n", FN.path().c_str()); return false; } MySong = LoadedSong; /* At this point, MySong == LoadedSong, which means it's not a metadata-only Song* Instance. The old copy is preserved; but this new one (LoadedSong) will be removed by the end of ScreenGameplay7K. */ } BGA = BackgroundAnimation::CreateBGAFromSong(index, *MySong, this); return true; }
void Kernel(tf_t *tf_p) // kernel begins its control upon/after interrupt { int pid; pcbs[ cur_pid ].tf_p = tf_p; // save for cur_pid which may change switch( tf_p->intr_id ) { case TIMER_INTR: TimerISR(); break; case IRQ7_INTR: IRQ7ISR(); // service parallel printer port event break; case GETPID_INTR: tf_p->eax = cur_pid; break; case SLEEP_INTR: SleepISR(); break; case SPAWN_INTR: pid = DeQ( &avail_q ); // get pid and put in ebx can be in Kernel() pcbs[ cur_pid ].tf_p->ebx = pid; // child PID, could be -1 if( pid == -1 ) break; // no more process SpawnISR(pid, (func_ptr_t) pcbs[ cur_pid ].tf_p->eax); break; case SEMINIT_INTR: SemInitISR(); break; case SEMWAIT_INTR: SemWaitISR(tf_p->eax); break; case SEMPOST_INTR: SemPostISR(tf_p->eax); break; case MSGSND_INTR: MsgSndISR(); break; case MSGRCV_INTR: MsgRcvISR(); break; case IRQ3_INTR: case IRQ4_INTR: IRQ34ISR(); break; case FORK_INTR: pid = DeQ( &avail_q ); ForkISR(pid); pcbs[ cur_pid ].tf_p->ebx = pid; break; case WAIT_INTR: //cons_printf("Wait Intr\n"); WaitISR(); break; case EXIT_INTR: //cons_printf("Exit Intr\n"); ExitISR(); break; } Scheduler(); // find same/new process to run Loader(pcbs[ cur_pid ].tf_p); // load it to run } // Kernel()
SearchWidget::SearchWidget(QWidget *parent) : QWidget(parent), m_addrLookup(0), m_cityCoordinates(), m_loaded(false), m_city(new QLineEdit(this)), m_cityList(new QListWidget(this)), m_street(new QLineEdit(this)), m_streetList(new QListWidget(this)) { QGridLayout *layout = new QGridLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_city, 0, 0, 1, 2); connect(m_city, SIGNAL(textEdited(QString)), this, SLOT(cityChanged(QString))); connect(m_city, SIGNAL(editingFinished()), this, SLOT(cityEntered())); layout->addWidget(m_cityList, 1, 0, 1, 2); connect(m_cityList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(citySelected(QListWidgetItem*))); #if QT_VERSION >= 0x040700 m_city->setPlaceholderText("Enter city name"); m_street->setPlaceholderText("Enter street name"); #endif layout->addWidget(m_street, 2, 0, 1, 2); connect(m_street, SIGNAL(textEdited(QString)), this, SLOT(streetChanged(QString))); layout->addWidget(m_streetList, 3, 0, 1, 2); connect(m_streetList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(streetSelected(QListWidgetItem*))); QPushButton *back = new QPushButton("&Back", this); back->setIcon(QIcon(":cancel.png")); layout->addWidget(back, 4, 1); connect(back, SIGNAL(clicked()), this, SIGNAL(back())); QSettings set(QDir::homePath()+"/Maps/nanomap.conf", QSettings::NativeFormat); set.beginGroup("monav"); QString dataDir = set.value("datadir").toString(); QString addrLookupLib = set.value("addresslookup", "/usr/lib/monav/libunicodetournamenttrieclient.so").toString(); set.endGroup(); QSettings pluginSettings(dataDir+"/plugins.ini", QSettings::IniFormat); QString addrLookupName = pluginSettings.value("addressLookup").toString(); QPluginLoader Loader(addrLookupLib); QObject *plugin = Loader.instance(); if (plugin) { m_addrLookup = qobject_cast<IAddressLookup*>(plugin); if (m_addrLookup) { m_addrLookup->SetInputDirectory(dataDir); m_loaded = m_addrLookup->LoadData(); } } resize(320, 240); }
FModel* FResourceGroup::LoadModel(const std::string& Name, IArchive* Archive) { FModel* Model = new FModel(); FBinaryModelLoader Loader(MaterialManager, GraphicsContext, this); Loader.LoadModel(Archive, *Model); Models.AddResource(Name, Model); return Model; }
void main() { InitData(); // initialize needed data for kernel InitControl(); SpawnISR(0, IdleProc); // create IdleProc to run if no user processes SpawnISR(1, Init); // create IdleProc to run if no user processes cur_pid = 1; Loader(pcbs[1].tf_p); }
void GameObjectLoader::loadMenu(Game * game) { Menu* menu = new Menu(game, game->getSettings()->font); manager->addObject(menu); //MenuOptionButton * button = new MenuOptionButton(&Loader(), settings->font, glm::fvec3(1.0f, 1.0f, 1.0f), string("HEYYY")); //MenuOptionButton * button1 = new MenuOptionButton(&Loader(), settings->font, glm::fvec3(1.0f, 1.0f, 1.0f), string("HEYYY1")); NewGameMenuOption* newGame = new NewGameMenuOption(&Loader(), game->getSettings()->font, glm::fvec3(1.0f, 1.0f, 1.0f)); ExitMenuOption* buttonExit = new ExitMenuOption(&Loader(), game->getSettings()->font, glm::fvec3(1.0f, 1.0f, 1.0f)); HighScore * highButton = new HighScore(&Loader(), game->getSettings()->font, glm::fvec3(1.0f, 1.0f, 1.0f)); GameDescriptionButton * buttonDescr = new GameDescriptionButton(&Loader(), game->getSettings()->font, glm::fvec3(1.0f, 1.0f, 1.0f)); menu->addMenuOption(newGame); menu->addMenuOption(buttonDescr); menu->addMenuOption(highButton); //menu->addMenuOption(button); //menu->addMenuOption(button1); menu->addMenuOption(buttonExit); }
void main() { InitData(); // initialize needed data for kernel InitControl(); SpawnISR(0); // create IdleProc for OS to run if no user processes cur_pid = 0; EI(); Loader(pcbs[0].tf_p); }
Resource<Data> get(const Key& key) { auto it = m_resources.find(key); if (it != m_resources.end()) { return it->second; } else { Resource<Data> res = Resource<Data>(Loader(key)); m_resources[key] = res; return res; } }
void Kernel(tf_t *tf_p) // kernel directly enters here when interrupt occurs { // Save "tf_p" to pcbs[cur_pid].tf_p for future resume of process runtime pcbs[cur_pid].tf_p = tf_p; // tf_p->intr_id tells what intr made CPU get here, pushed in entry.S switch(tf_p->intr_id) { case TIMER_INTR: TimerISR(); // this must include dismissal of timer interrupt break; case IRQ7_INTR: IRQ7ISR(); break; case SLEEP_INTR: SleepISR(tf_p->eax); break; case GETPID_INTR: tf_p->eax = cur_pid; break; case SPAWN_INTR: if (EmptyQ(&avail_q)) { cons_printf("No more available PIDs!\n"); tf_p->ebx = -1; } else { tf_p->ebx = DeQ(&avail_q); SpawnISR((int) tf_p->ebx, (func_ptr_t) tf_p->eax); } break; case SEMINIT_INTR: tf_p->ebx = SemInitISR(tf_p->eax); break; case SEMWAIT_INTR: SemWaitISR(tf_p->eax); break; case SEMPOST_INTR: SemPostISR(tf_p->eax); break; case MSGSND_INTR: MsgSndISR(); break; case MSGRCV_INTR: MsgRcvISR(); break; } Scheduler(); // select a process to run Loader(pcbs[cur_pid].tf_p); // run the process selected }
void Kernel(tf_t *tf_p) // kernel begins its control upon/after interrupt { int pid, sid; pcbs[cur_pid].tf_p = tf_p; // save for cur_pid which may change switch(tf_p->intr_id) { case TIMER_INTR: TimerISR(); // service the simulated timer interrupt break; case GETPID_INTR: tf_p->eax = cur_pid; break; case SLEEP_INTR: SleepISR(); break; case SPAWN_INTR: if(EmptyQ(&avail_q)) { cons_printf("No more processes\n"); tf_p->eax = -1; } else { pid = DeQ(&avail_q); pcbs[pid].state = READY; SpawnISR(pid, (func_ptr_t) tf_p->eax); tf_p->eax = pid; } break; case SEMINIT_INTR: sid = SemInitISR(tf_p->eax); tf_p->eax = sid; break; case SEMWAIT_INTR: SemWaitISR(); break; case SEMPOST_INTR: SemPostISR(); break; } Scheduler(); // find same/new process to run Loader(pcbs[cur_pid].tf_p); // load it to run } // Kernel()
void Kernel(tf_t *tf_p) // kernel directly enters here when interrupt occurs { // Save "tf_p" to pcbs[cur_pid].tf_p for future resume of process runtime pcbs[cur_pid].tf_p = tf_p; // tf_p->intr_id tells what intr made CPU get here, pushed in entry.S switch(tf_p->intr_id) { case TIMER_INTR: TimerISR(); // this must include dismissal of timer interrupt break; case SLEEP_INTR: SleepISR(tf_p->eax); break; case GETPID_INTR: tf_p->eax = cur_pid; break; } // still handles other keyboard-generated simulated events if(cons_kbhit()) // check if a key was pressed (returns non zero) { char key = cons_getchar(); // get the pressed key switch(key) // see if it's one of the following for service { case 'n': if(EmptyQ(&avail_q)) cons_printf("No more available PIDs!\n"); else { SpawnISR(DeQ(&avail_q), SimpleProc); } break; case 'k': KillISR(); break; // non-functional in phase 2 case 's': ShowStatusISR(); break; case 'b': breakpoint(); break; // this stops when run in GDB mode case 'q': exit(0); } // switch(key) } // if(cons_kbhit()) Scheduler(); // select a process to run Loader(pcbs[cur_pid].tf_p); // run the process selected }
void DTerrain::Load( void* Buffer, dword Size ) { DMemoryReader Loader( Buffer, Size ); Loader.SetBinary(); Serialize( Loader ); //hjk DTerrainSector *pSector = NULL; int nMaxNum = m_aSectors.Num(); for( int i = 0; i < nMaxNum; i++) { pSector = &m_aSectors[i]; if( pSector->m_aSectorLayers.Num() == 0 ) continue; pSector->InitLOD(s_fDistOfNearPlane, s_fDistOfFarPlane, s_fFOV, m_vScale); } //hjk end // Size Confirm // Size = TileSize * TileNum * SectorNum m_vDrawSize.X = m_vScale.X * TC_SectorResolution * m_iSectorsX; m_vDrawSize.Y = m_vScale.Y * TC_SectorResolution * m_iSectorsY; m_vDrawSize.Z = 0.0f; m_fDrawRadius = m_vDrawSize.X*m_vDrawSize.X + m_vDrawSize.Y*m_vDrawSize.Y; }
bool MyApp::OnInit( void ) { try { SetAppName( APP_NAME ); SetVendorName( APP_VENDOR ); respath = wxFindAppPath( argv[0], wxGetCwd(), _T("FNPATH"), _T("fn") ); #ifdef __WXMSW__ if (respath.Last() != '\\') respath += '\\'; shaderPath = respath + _T("GLSL\\"); iconsPath = respath + _T("icons\\"); int fd; FILE *fp; AllocConsole(); fd = _open_osfhandle( (long)GetStdHandle( STD_OUTPUT_HANDLE ), 0); fp = _fdopen( fd, "w" ); *stdout = *fp; setvbuf( stdout, NULL, _IONBF, 0 ); // TODO fix may not work. #elif __WXMAC__ // If we use the above code to get the same on OSX, I get a segfault somewhere // therefore I use the OSX native code here: // OSX only: Try to find the resource path... CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef resourcesURL = CFBundleCopyBundleURL( mainBundle ); CFStringRef str = CFURLCopyFileSystemPath( resourcesURL, kCFURLPOSIXPathStyle ); CFRelease( resourcesURL ); char path[ PATH_MAX ]; CFStringGetCString( str, path, FILENAME_MAX, kCFStringEncodingASCII ); CFRelease( str ); fprintf( stderr, "%s", path ); respath = wxString::FromAscii( path ); respath += _T( "/Contents/Resources/" ); shaderPath = respath + _T( "GLSL/" ); iconsPath = respath + _T( "icons/" ); std::cout << std::endl << iconsPath << std::endl; #else if ( respath.Last() != '/' ) respath += '/'; shaderPath = respath + _T("GLSL/"); iconsPath = respath + _T("icons/"); #endif Logger::getInstance()->print( wxT( "Warning: This version of Fibernavigator is debug compiled." ), LOGLEVEL_DEBUG ); Logger::getInstance()->print( wxT( "For better performance please compile a Release version."), LOGLEVEL_DEBUG ); Logger::getInstance()->print( wxString::Format( wxT( "respath: %s" ), respath.c_str() ), LOGLEVEL_DEBUG ); Logger::getInstance()->print( wxString::Format( wxT( "shader: %s" ), shaderPath.c_str() ), LOGLEVEL_DEBUG ); // Create the main frame window frame = new MainFrame( wxT("Fiber Navigator"), wxPoint( 50, 50 ), wxSize( 800, 600 ) ); SceneManager::getInstance()->setMainFrame( frame ); SceneManager::getInstance()->setTreeCtrl( frame->m_pTreeWidget ); #ifdef __WXMSW__ // Give it an icon (this is ignored in MDI mode: uses resources) frame->SetIcon( wxIcon( _T( "sashtest_icn" ) ) ); #endif frame->SetMinSize( wxSize( 800, 600 ) ); frame->SetSize( wxSize( 1024, 768 ) ); frame->Show( true ); SetTopWindow( frame ); wxString cmd; wxString cmdFileName; wxCmdLineParser cmdParser( desc, argc, argv ); cmdParser.Parse( false ); if ( cmdParser.GetParamCount() > 0 ) { Loader loader = Loader(frame, frame->m_pListCtrl ); for ( size_t i = 0; i < cmdParser.GetParamCount(); ++i ) { cmd = cmdParser.GetParam( i ); wxFileName fName( cmd ); fName.Normalize( wxPATH_NORM_LONG | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_ABSOLUTE ); cmdFileName = fName.GetFullPath(); if ( cmdParser.Found(_T("d")) && ( i == 0 ) ) { loader( cmdFileName ); frame->createDistanceMapAndIso(); } else if ( cmdParser.Found( _T( "p" ) ) && ( i == cmdParser.GetParamCount() -1 ) ) { frame->screenshot( wxT( "" ), cmdFileName ); } else { loader( cmdFileName ); } } } if ( cmdParser.Found( _T( "e" ) ) ) { exit( 0 ); } return true; } catch ( ... ) { Logger::getInstance()->print( wxT( "Something went wrong, terribly wrong" ), LOGLEVEL_ERROR ); return false; } Logger::getInstance()->print( wxT( "End on init main" ), LOGLEVEL_DEBUG ); wxFrame *the_frame = new wxFrame(NULL, 1, argv[0]); the_frame->Show(true); return true; }
Toolbar::Toolbar(Vector2f Position,Vector2f Size,Color BackColor,Vector2f MiniViewSize) :mPosition(Position),mSize(Size),mBackground(BackColor),mViewSize(MiniViewSize) ,mCurrUnit(),mCurrPlayer(),mNewPos(false),mChange(false),mDelete(false) { UIDrop<bool>*Solid=new UIDrop<bool>("Solid",Color(255,255,255,255),Color(0,0,0,255),15); Solid->addOption("Yes",true); Solid->addOption("No",false); UIDrop<bool>*Behined=new UIDrop<bool>("Behind Player",Color(255,255,255,255),Color(0,0,0,255),15); Behined->addOption("Yes",true); Behined->addOption("No",false); UIDrop<bool>*Fade=new UIDrop<bool>("Fade In",Color(255,255,255,255),Color(0,0,0,255),15); Fade->addOption("Yes",true); Fade->addOption("No",false); UIDrop<bool>*Visible=new UIDrop<bool>("Visible",Color(255,255,255,255),Color(0,0,0,255),15); Visible->addOption("Yes",true); Visible->addOption("No",false); UIDrop<bool>*Active=new UIDrop<bool>("Active",Color(255,255,255,255),Color(0,0,0,255),15); Active->addOption("Yes",true); Active->addOption("No",false); UIDrop<string>*color=new UIDrop<string>("Color",Color(255,255,255,255),Color(0,0,0,255),15); color->addOption("Red","Red"); color->addOption("Yellow","Yellow"); color->addOption("Blue","Blue"); color->addOption("White","White"); UIDrop<int>*Rotation=new UIDrop<int>("Rotation",Color(255,255,255,255),Color(0,0,0,255),15); Rotation->addOption("Down",0); Rotation->addOption("Left",90); Rotation->addOption("Up",180); Rotation->addOption("Right",270); UIDrop<Unit*>*UTargets=new UIDrop<Unit*>("UnitTarget",Color(255,255,255,255),Color(0,0,0,255),15); UIDrop<Unit*>*LTargets=new UIDrop<Unit*>("LaserTarget",Color(255,255,255,255),Color(0,0,0,255),15); mUIItems.accessInactive().insert(Solid); mUIItems.accessInactive().insert(Behined); mUIItems.accessInactive().insert(Fade); mUIItems.accessInactive().insert(Visible); mUIItems.accessInactive().insert(Rotation); mUIItems.accessInactive().insert(Active); mUIItems.accessInactive().insert(color); mUIItems.accessInactive().insert(UTargets); mUIItems.accessInactive().insert(LTargets); mUIItems.accessInactive().insert(new UIButton("Update",15)); mUIItems.accessInactive().insert(new UIButton("Clear",15)); mUIItems.accessInactive().insert(new UIButton("Delete",15)); mUIItems.accessInactive().insert(new UIText("Name","",false,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("Sprite","",false,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("Lives","",true,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("Position x","",true,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("Position y","",true,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("Target Id","",true,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("Sound","",true,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("Length","",true,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("Range of visibility","",true,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("SpriteOn","",false,Color(255,255,255,255),Color(0,0,0,255),15)); mUIItems.accessInactive().insert(new UIText("SpriteOff","",false,Color(255,255,255,255),Color(0,0,0,255),15)); //Adds the menus ObjectLoader Loader("Load/OtherMenu.xml"); UIObjectMenu *meny=Loader.getObject(this); mUIItems.accessActive().insert(meny); //All platforms Loader.loadFile("Load/PlatformMenu.xml"); meny=Loader.getObject(this); mUIItems.accessActive().insert(meny); mUIItems.getActivated("zOther")->setSelect(true); //64x64 tiles Loader.loadFile("Load/PlatformNormalMenu.xml"); meny=Loader.getObject(this); mUIItems.accessActive().insert(meny); //64x32 and 32x64 tiles Loader.loadFile("Load/PlatformWideMenu.xml"); meny=Loader.getObject(this); mUIItems.accessActive().insert(meny); //32x32 tiles Loader.loadFile("Load/PlatformSmallMenu.xml"); meny=Loader.getObject(this); mUIItems.accessActive().insert(meny); //Large platforms Loader.loadFile("Load/PlatformBigMenu.xml"); meny=Loader.getObject(this); mUIItems.accessActive().insert(meny); //Frame Parts Loader.loadFile("Load/FrameMenu.xml"); meny=Loader.getObject(this); mUIItems.accessActive().insert(meny); }
bool GlobalPrivate::loadPlugin( const QString &pFileName ) { QFileInfo FileInfo( pFileName ); QString BaseName = FileInfo.baseName(); if( !mEnabledPlugins.isEmpty() ) { bool PluginFound = false; for( QString S : mEnabledPlugins ) { if( BaseName.contains( S ) ) { PluginFound = true; break; } } if( !PluginFound ) { return( false ); } } for( QString S : mDisabledPlugins ) { if( BaseName.contains( S ) ) { qInfo() << "Skipping" << pFileName; return( false ); } } QPluginLoader Loader( pFileName ); if( !Loader.load() ) { qWarning() << pFileName << ":" << Loader.errorString(); return( false ); } QObject *PluginInstance = Loader.instance(); if( !PluginInstance ) { qWarning() << pFileName << ":" << Loader.errorString(); return( false ); } fugio::PluginInterface *Plugin = qobject_cast<fugio::PluginInterface *>( PluginInstance ); if( !Plugin ) { qWarning() << pFileName << "No PluginInterface"; delete PluginInstance; return( false ); } qDebug() << "Loading plugin:" << pFileName; registerPlugin( PluginInstance ); mLoadedPlugins << FileInfo.baseName(); return( true ); }