//----------MAIN---------// int main(int argc, char *argv[]) { /*create table for rewriting from first data*/ char **data1 = NULL; data1 = makeMemory(data1); /*create table for rewriting from second data*/ char **data2 = NULL; data2 = makeMemory(data2); /*rewrite from data1 in table data1*/ fileRead(argv[1], data1, &length1); /*rewrite from data2 in table data2*/ fileRead(argv[2], data2, &length2); Compare(data1, data2, argv[3]); //----TEST FILES-------// /* int i; puts("PRVI"); for(i = 0; i < strlen(data1); i++) printf("Data 1 :%s\n", data1[i]); puts("DRUGI"); for(i = 0; i < strlen(data2); i++) printf("Data 2 :%s\n", data2[i]); */ return 0; }
bool loadSplash(void) { const char *topSplashFile = "splash.bin", *bottomSplashFile = "splashbottom.bin"; bool isTopSplashValid = getFileSize(topSplashFile) == SCREEN_TOP_FBSIZE, isBottomSplashValid = getFileSize(bottomSplashFile) == SCREEN_BOTTOM_FBSIZE, ret; //Don't delay boot nor init the screens if no splash images or invalid splash images are on the SD if(!isTopSplashValid && !isBottomSplashValid) ret = false; else { initScreens(); clearScreens(true, true, true); if(isTopSplashValid) isTopSplashValid = fileRead(fbs[1].top_left, topSplashFile, SCREEN_TOP_FBSIZE) == SCREEN_TOP_FBSIZE; if(isBottomSplashValid) isBottomSplashValid = fileRead(fbs[1].bottom, bottomSplashFile, SCREEN_BOTTOM_FBSIZE) == SCREEN_BOTTOM_FBSIZE; if(!isTopSplashValid && !isBottomSplashValid) ret = false; else { swapFramebuffers(true); chrono(3); ret = true; } } return ret; }
void patchFirm(void){ //Part1: Add emunand parsing code u32 offset = 0; u32 header = 0; if(getEmunand(&offset, &header) == 1){ fileRead((u8*)emuCode, "/rei/emunand/emunand.bin", 0); u32 *pos_offset = memsearch((u8*)emuCode, "NAND", 0x218, 4); u32 *pos_header = memsearch((u8*)emuCode, "NCSD", 0x218, 4); memcpy((void *)pos_offset, (void *)offset, 4); memcpy((void *)pos_header, (void *)header, 4); } //Part2: Add emunand hooks memcpy((u8*)emuHook1, eh1, sizeof(eh1)); memcpy((u8*)emuHook2, eh2, sizeof(eh2)); memcpy((u8*)emuHook3, eh3, sizeof(eh3)); memcpy((u8*)emuHook4, eh4, sizeof(eh4)); //Part3: Disable signature checks memcpy((u8*)patch1, p1, sizeof(p1)); memcpy((u8*)patch2, p2, sizeof(p2)); //Part4: Create arm9 thread fileRead((u8*)threadCode, "/rei/thread/arm9.bin", 0); memcpy((u8*)threadHook1, th1, sizeof(th1)); memcpy((u8*)threadHook2, th2, sizeof(th2)); }
void loadLinux(void){ u32 size = fileSize(LINUXIMAGE_FILENAME); if(!size){ shutdown(); } fileRead((u8 *)ZIMAGE_ADDR, LINUXIMAGE_FILENAME, size); size = fileSize(DTB_FILENAME); if(!size){ shutdown(); } fileRead((u8 *)PARAMS_ADDR, DTB_FILENAME, size); }
/* ** Decode a freelist trunk page. */ static void decode_trunk_page( int pgno, /* The page number */ int detail, /* Show leaf pages if true */ int recursive /* Follow the trunk change if true */ ){ int n, i; unsigned char *a; while( pgno>0 ){ a = fileRead((pgno-1)*g.pagesize, g.pagesize); printf("Decode of freelist trunk page %d:\n", pgno); print_decode_line(a, 0, 4, "Next freelist trunk page"); print_decode_line(a, 4, 4, "Number of entries on this page"); if( detail ){ n = (int)decodeInt32(&a[4]); for(i=0; i<n; i++){ unsigned int x = decodeInt32(&a[8+4*i]); char zIdx[10]; sprintf(zIdx, "[%d]", i); printf(" %5s %7u", zIdx, x); if( i%5==4 ) printf("\n"); } if( i%5!=0 ) printf("\n"); } if( !recursive ){ pgno = 0; }else{ pgno = (int)decodeInt32(&a[0]); } sqlite3_free(a); } }
uint16_t FileStream::readMemoryBlock(char* data, int bufSize) { int len = min(bufSize, size - pos); int available = fileRead(handle, data, len); fileSeek(handle, pos, eSO_FileStart); // Don't move cursor now (waiting seek) return available; }
void GalFile::readFile(const QString &fileName) { QFile file(fileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; QTextStream in(&file); QString line = in.readLine().simplified(); if (line.toUpper().startsWith("ATF")) _metaData.insert("version",line.split(QRegExp("[,\\s+]")).last()); else qDebug() << "no Gal file"; QStringList headndata = in.readLine().simplified().split(QRegExp("\\s+")); int headCount = headndata.first().toInt(); _colCount = headndata.last().toInt(); QRegExp blockRx("Block[0-9]+"); QRegExpValidator blockV(blockRx, 0); int pos=0; while (!in.atEnd() && headCount > 0) { QStringList headline = in.readLine().simplified().split('='); if(blockV.validate(headline.first(),pos)) newBlock(headline.first().mid(5).toInt(),headline.last()); else _metaData.insert(headline.first(),headline.last()); headCount--; } qDebug() << _blocks.count(); setColumnHeader(in.readLine().simplified()); while (!in.atEnd()) { setSpotData(in.readLine().simplified().remove("\"")); } emit fileRead(); }
void status_temp(GlobalData *g, char *title, char *sysfile) { StatusItem s; char text[16] = { 0 }; char stline[16]; ssize_t stlen; statusitem_init(&s); s.text = text; stlen = fileRead(stline, sizeof(stline), sysfile); if (stlen <= 0) { return; } /* * Read a valid value? * Sometimes we get garbage from sysfs... */ if (stlen < 6 || stlen > 7) { s.color = "#FF0000"; // red snprintf(text, sizeof(text), "%sERROR", title); } else { stline[stlen - 4] = '\0'; s.color = "#FF33FF"; snprintf(text, sizeof(text), "%s%s C", title, stline); } line_append_item(g, &s); }
int main(void) { fileRead(); return 0; }
void loadSplash(void){ //Check if it's a no-screen-init A9LH boot via PDN_GPU_CNT if (*((u8*)0x10141200) == 0x1) return; clearScreen(); if(fileRead(fb->top_left, "/rei/splash.bin", 0x46500) != 0) return; u64 i = 0xFFFFFF; while(--i) __asm("mov r0, r0"); //Less Ghetto sleep func }
int usersFileRead(char* path) { char *p; File *file; Fsys *fsys; int len, r; uvlong size; if((fsys = fsysGet("main")) == nil) return 0; fsysFsRlock(fsys); if(path == nil) path = "/active/adm/users"; r = 0; if((file = fileOpen(fsysGetFs(fsys), path)) != nil){ if(fileGetSize(file, &size)){ len = size; p = vtMemAlloc(size+1); if(fileRead(file, p, len, 0) == len){ p[len] = '\0'; r = uboxInit(p, len); } } fileDecRef(file); } fsysFsRUnlock(fsys); fsysPut(fsys); return r; }
void Functionality::loadVectorsFromFile() { EventStorage tempEvent; ifstream fileRead("EventStorage.txt"); string eventStore; string tempPriority; while(getline(fileRead, eventStore)) { if(eventStore.size() > 0) { if(eventStore[0] == '#') { loadEvent(tempEvent, eventStore.substr(1, eventStore.size() - 1)); tempPriority = tempEvent.getPriority(); if(tempPriority[0] == '1') highPriority.push_back(tempEvent); else if(tempPriority[0] == '2') normalPriority.push_back(tempEvent); } } } fileRead.close(); if(highPriority.size() != 0) undoHighVector.push_back(highPriority); if(normalPriority.size() != 0) undoNormalVector.push_back(normalPriority); }
int main(int argc, char** argv) { width = atoi(argv[1]); height = atoi(argv[2]); Scale_X = width / 120; Scale_Y = height / 90; glutInit(&argc, argv); glutInitWindowSize(width, height); glutInitWindowPosition(100, 50); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE); glutCreateWindow("Ceng477 Fall 2010 - Warmup Prototype [e1560176]"); glutDisplayFunc(displayHandle); glutKeyboardFunc(keyboardNormal); glutMouseFunc(mouseHandle); glutSpecialFunc(keyboardSpecial); glutMotionFunc(mouseMove); glutCreateMenu(menu); glutAddMenuEntry("3-5-2", 'a'); glutAddMenuEntry("4-3-3", 'b'); glutAddMenuEntry("4-4-2", 'c'); glutAttachMenu(GLUT_RIGHT_BUTTON); init(); fileRead(); glutMainLoop(); return 0; }
//Load firm into FCRAM void loadFirm(void){ //Read FIRM from SD card and write to FCRAM const char firmPath[] = "/rei/firmware.bin"; firmSize = fileSize(firmPath); fileRead((u8*)firmLocation, firmPath, firmSize); section = firmLocation->section; arm9loader((u8*)firmLocation + section[2].offset); }
// default constructor for G appendix File::File() { std::cout << "\nFile::File(), Succesfully called, initiating. Now." << std::endl; m_fN = "..\\..\\..\\..\\ProgramResources\\G Appendix\\G A - Z.txt"; fileRead(); }
uint16_t FileStream::getDataPointer(char** data) { int len = min(NETWORK_SEND_BUFFER_SIZE, size - pos); int available = fileRead(handle, buffer, len); fileSeek(handle, pos, eSO_FileStart); // Don't move cursor now *data = buffer; return available; }
/* ** Try to figure out how every page in the database file is being used. */ static void page_usage_report(const char *zPrg, const char *zDbName){ int i, j; int rc; sqlite3 *db; sqlite3_stmt *pStmt; unsigned char *a; char zQuery[200]; /* Avoid the pathological case */ if( g.mxPage<1 ){ printf("empty database\n"); return; } /* Open the database file */ db = openDatabase(zPrg, zDbName); /* Set up global variables zPageUse[] and g.mxPage to record page ** usages */ zPageUse = sqlite3_malloc( sizeof(zPageUse[0])*(g.mxPage+1) ); if( zPageUse==0 ) out_of_memory(); memset(zPageUse, 0, sizeof(zPageUse[0])*(g.mxPage+1)); /* Discover the usage of each page */ a = fileRead(0, 100); page_usage_freelist(decodeInt32(a+32)); page_usage_ptrmap(a); sqlite3_free(a); page_usage_btree(1, 0, 0, "sqlite_master"); sqlite3_exec(db, "PRAGMA writable_schema=ON", 0, 0, 0); for(j=0; j<2; j++){ sqlite3_snprintf(sizeof(zQuery), zQuery, "SELECT type, name, rootpage FROM SQLITE_MASTER WHERE rootpage" " ORDER BY rowid %s", j?"DESC":""); rc = sqlite3_prepare_v2(db, zQuery, -1, &pStmt, 0); if( rc==SQLITE_OK ){ while( sqlite3_step(pStmt)==SQLITE_ROW ){ int pgno = sqlite3_column_int(pStmt, 2); page_usage_btree(pgno, 0, 0, (const char*)sqlite3_column_text(pStmt,1)); } }else{ printf("ERROR: cannot query database: %s\n", sqlite3_errmsg(db)); } rc = sqlite3_finalize(pStmt); if( rc==SQLITE_OK ) break; } sqlite3_close(db); /* Print the report and free memory used */ for(i=1; i<=g.mxPage; i++){ printf("%5d: %s\n", i, zPageUse[i] ? zPageUse[i] : "???"); sqlite3_free(zPageUse[i]); } sqlite3_free(zPageUse); zPageUse = 0; }
int main(int argc, char** argv) { DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE)); for(int i = 1; i < argc; i++) { fileRead(argv[i]); } FreeImage_DeInitialise(); return 0; };
/* ** Try to figure out how every page in the database file is being used. */ static void ptrmap_coverage_report(const char *zDbName){ int pgno; unsigned char *aHdr; unsigned char *a; int usable; int perPage; int i; /* Avoid the pathological case */ if( g.mxPage<1 ){ printf("empty database\n"); return; } /* Make sure PTRMAPs are used in this database */ aHdr = fileRead(0, 100); if( aHdr[55]==0 ){ printf("database does not use PTRMAP pages\n"); return; } usable = g.pagesize - aHdr[20]; perPage = usable/5; sqlite3_free(aHdr); printf("%5d: root of sqlite_master\n", 1); for(pgno=2; pgno<=g.mxPage; pgno += perPage+1){ printf("%5d: PTRMAP page covering %d..%d\n", pgno, pgno+1, pgno+perPage); a = fileRead((pgno-1)*g.pagesize, usable); for(i=0; i+5<=usable && pgno+1+i/5<=g.mxPage; i+=5){ const char *zType = "???"; unsigned int iFrom = decodeInt32(&a[i+1]); switch( a[i] ){ case 1: zType = "b-tree root page"; break; case 2: zType = "freelist page"; break; case 3: zType = "first page of overflow"; break; case 4: zType = "later page of overflow"; break; case 5: zType = "b-tree non-root page"; break; } printf("%5d: %s, parent=%u\n", pgno+1+i/5, zType, iFrom); } sqlite3_free(a); } }
static inline void copySection0AndInjectSystemModules(FirmwareType firmType, bool loadFromStorage) { u32 maxModuleSize = firmType == NATIVE_FIRM ? 0x80000 : 0x600000, srcModuleSize, dstModuleSize; const char *extModuleSizeError = "The external FIRM modules are too large."; for(u8 *src = (u8 *)firm + firm->section[0].offset, *srcEnd = src + firm->section[0].size, *dst = firm->section[0].address; src < srcEnd; src += srcModuleSize, dst += dstModuleSize, maxModuleSize -= dstModuleSize) { srcModuleSize = ((Cxi *)src)->ncch.contentSize * 0x200; const char *moduleName = ((Cxi *)src)->exHeader.systemControlInfo.appTitle; if(loadFromStorage) { char fileName[24] = "sysmodules/"; //Read modules from files if they exist concatenateStrings(fileName, moduleName); concatenateStrings(fileName, ".cxi"); dstModuleSize = getFileSize(fileName); if(dstModuleSize != 0) { if(dstModuleSize > maxModuleSize) error(extModuleSizeError); if(dstModuleSize <= sizeof(Cxi) + 0x200 || fileRead(dst, fileName, dstModuleSize) != dstModuleSize || memcmp(((Cxi *)dst)->ncch.magic, "NCCH", 4) != 0 || memcmp(moduleName, ((Cxi *)dst)->exHeader.systemControlInfo.appTitle, sizeof(((Cxi *)dst)->exHeader.systemControlInfo.appTitle)) != 0) error("An external FIRM module is invalid or corrupted."); continue; } } const u8 *module; if(firmType == NATIVE_FIRM && memcmp(moduleName, "loader", 6) == 0) { module = injector_bin; dstModuleSize = injector_bin_size; } else { module = src; dstModuleSize = srcModuleSize; } if(dstModuleSize > maxModuleSize) error(extModuleSizeError); memcpy(dst, module, dstModuleSize); } }
//Patches void patchFirm(){ //Disable signature checks memcpy((u8*)sigPatch(1), sigPat1, sizeof(sigPat1)); memcpy((u8*)sigPatch(2), sigPat2, sizeof(sigPat2)); //Create arm9 thread fileRead((u8*)threadCode(), "/rei/thread/arm9.bin", 0); memcpy((u8*)threadHook(1), th1, sizeof(th1)); memcpy((u8*)threadHook(2), th2, sizeof(th2)); }
/** * Read current packet from current file. Pad the packet with PAD_CHAR if the * file has less than PACKET_SIZE bytes left to read. * * @return the number of bytes read from the file */ size_t Xmodem::readPacket() { size_t bytesRead = fileRead(_packet, PACKET_SIZE); for (size_t i = bytesRead; i < PACKET_SIZE; i++) { _packet[i] = PAD_CHAR; } _crc = crc_init(); _crc = crc_update(_crc, _packet, PACKET_SIZE); _crc = crc_finalize(_crc); return bytesRead; }
bool FileOut::done() { Q_ASSERT(!isDone); if (name.isEmpty()) return false; isDone = true; bool fileEqual = false; QFile fileRead(name); QFileInfo info(fileRead); stream.flush(); QByteArray original; if (info.exists() && (diff || (info.size() == tmp.size()))) { if (!fileRead.open(QIODevice::ReadOnly)) { ReportHandler::warning(QString("failed to open file '%1' for reading") .arg(fileRead.fileName())); return false; } original = fileRead.readAll(); fileRead.close(); fileEqual = (original == tmp); } if (!fileEqual) { if (!FileOut::dummy) { QDir dir(info.absolutePath()); if (!dir.mkpath(dir.absolutePath())) { ReportHandler::warning(QString("unable to create directory '%1'") .arg(dir.absolutePath())); return false; } QFile fileWrite(name); if (!fileWrite.open(QIODevice::WriteOnly)) { ReportHandler::warning(QString("failed to open file '%1' for writing") .arg(fileWrite.fileName())); return false; } QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); stream.setDevice(&fileWrite); stream << tmp; } if (diff) { std::printf("%sFile: %s%s\n", colorInfo, qPrintable(name), colorReset); ::diff(original.split('\n'), tmp.split('\n')); std::printf("\n"); } return true; } return false; }
/* ** Describe the usages of a b-tree page */ static void page_usage_btree( int pgno, /* Page to describe */ int parent, /* Parent of this page. 0 for root pages */ int idx, /* Which child of the parent */ const char *zName /* Name of the table */ ){ unsigned char *a; const char *zType = "corrupt node"; int nCell; int i; int hdr = pgno==1 ? 100 : 0; if( pgno<=0 || pgno>g.mxPage ) return; a = fileRead((pgno-1)*g.pagesize, g.pagesize); switch( a[hdr] ){ case 2: zType = "interior node of index"; break; case 5: zType = "interior node of table"; break; case 10: zType = "leaf of index"; break; case 13: zType = "leaf of table"; break; } if( parent ){ page_usage_msg(pgno, "%s [%s], child %d of page %d", zType, zName, idx, parent); }else{ page_usage_msg(pgno, "root %s [%s]", zType, zName); } nCell = a[hdr+3]*256 + a[hdr+4]; if( a[hdr]==2 || a[hdr]==5 ){ int cellstart = hdr+12; unsigned int child; for(i=0; i<nCell; i++){ int ofst; ofst = cellstart + i*2; ofst = a[ofst]*256 + a[ofst+1]; child = decodeInt32(a+ofst); page_usage_btree(child, pgno, i, zName); } child = decodeInt32(a+cellstart-4); page_usage_btree(child, pgno, i, zName); } if( a[hdr]==2 || a[hdr]==10 || a[hdr]==13 ){ int cellstart = hdr + 8 + 4*(a[hdr]<=5); for(i=0; i<nCell; i++){ int ofst; ofst = cellstart + i*2; ofst = a[ofst]*256 + a[ofst+1]; page_usage_cell(a[hdr], a+ofst, pgno, i); } } sqlite3_free(a); }
char treeReader::getCharacter(int pos){ void *buf = malloc(32); char *returnVal, returnChar; fileSetCurrentPointer(descriptor, pos); if(!fileRead(descriptor, buf, 1)) { return 0; //EOF } fileSetCurrentPointer(descriptor, pos); //don't increment returnVal = (char*)buf; returnChar = returnVal[0]; free((char*)buf); return returnChar; }
bool copyDir(const char* dirSrcName, const char* dirDstName) { PHYSFS_Stat stat; if (PHYSFS_stat(dirSrcName, &stat) == 0 || stat.filetype != PHYSFS_FILETYPE_DIRECTORY) { return false; } if (PHYSFS_stat(dirDstName, &stat) != 0 && stat.filetype != PHYSFS_FILETYPE_DIRECTORY) { return false; } createDir(dirDstName); auto paths = PHYSFS_enumerateFiles(dirSrcName); if (paths != nullptr) { for (char** path = paths; *path != nullptr; path++) { auto fullSrcPath = std::string(dirSrcName) + '/' + *path; auto fullDstPath = std::string(dirDstName) + '/' + *path; if (PHYSFS_stat(fullSrcPath.c_str(), &stat) == 0) { continue; } if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY) { copyDir(fullSrcPath.c_str(), fullDstPath.c_str()); } else { // copy file (read source file and write destination) sf::PhysFSStream fileRead(fullSrcPath); auto fileWrite = PHYSFS_openWrite(fullDstPath.c_str()); if (fileRead.hasError() == false && fileWrite != nullptr) { std::vector<uint8_t> data((size_t)fileRead.getSize()); fileRead.read(data.data(), fileRead.getSize()); PHYSFS_writeBytes(fileWrite, data.data(), data.size()); PHYSFS_close(fileWrite); } } } PHYSFS_freeList(paths); return true; } return false; }
static inline bool loadFirmFromStorage(FirmwareType firmType) { const char *firmwareFiles[] = { "firmware.bin", "firmware_twl.bin", "firmware_agb.bin", "firmware_safe.bin", "firmware_sysupdater.bin" }, *cetkFiles[] = { "cetk", "cetk_twl", "cetk_agb", "cetk_safe", "cetk_sysupdater" }; u32 firmSize = fileRead(firm, firmType == NATIVE_FIRM1X2X ? firmwareFiles[0] : firmwareFiles[(u32)firmType], 0x400000 + sizeof(Cxi) + 0x200); if(!firmSize) return false; if(firmSize <= sizeof(Cxi) + 0x200) error("The FIRM in /luma is not valid."); if(memcmp(firm, "FIRM", 4) != 0) { u8 cetk[0xA50]; if(fileRead(cetk, firmType == NATIVE_FIRM1X2X ? cetkFiles[0] : cetkFiles[(u32)firmType], sizeof(cetk)) != sizeof(cetk) || !decryptNusFirm((Ticket *)(cetk + 0x140), (Cxi *)firm, firmSize)) error("The FIRM in /luma is encrypted or corrupted."); } //Check that the FIRM is right for the console from the ARM9 section address if((firm->section[3].offset != 0 ? firm->section[3].address : firm->section[2].address) != (ISN3DS ? (u8 *)0x8006000 : (u8 *)0x8006800)) error("The FIRM in /luma is not for this console."); return true; }
int _rsFileGet (rsComm_t *rsComm, fileOpenInp_t *fileGetInp, bytesBuf_t *fileGetOutBBuf) { int status; int fd; int len; len = fileGetInp->dataSize; if (len <= 0) return (0); fd = _rsFileOpen (rsComm, fileGetInp); if (fd < 0) { rodsLog (LOG_NOTICE, "_rsFileGet: fileGet for %s, status = %d", fileGetInp->fileName, fd); return (fd); } if (fileGetOutBBuf->buf == NULL) { fileGetOutBBuf->buf = malloc (len); } status = fileRead (fileGetInp->fileType, rsComm, fd, fileGetOutBBuf->buf, len); if (status != len) { if (status >= 0) { #if 0 /* XXXXXXXX take this out for now so that on the fly convert works */ rodsLog (LOG_NOTICE, "_rsFileGet: fileRead for %s, toread %d, read %d", fileGetInp->fileName, len, status); status = SYS_COPY_LEN_ERR; #else fileGetOutBBuf->len = status; #endif } else { rodsLog (LOG_NOTICE, "_rsFileGet: fileRead for %s, status = %d", fileGetInp->fileName, status); } } else { fileGetOutBBuf->len = status; } fileClose (fileGetInp->fileType, rsComm, fd); return (status); }
//Patches void patchFirm(){ //Part1: Set MPU for payload area memcpy((u8*)mpuCode(), mpu, sizeof(mpu)); //Part2: Disable signature checks memcpy((u8*)sigPatch(1), sigPat1, sizeof(sigPat1)); memcpy((u8*)sigPatch(2), sigPat2, sizeof(sigPat2)); //Part3: Create arm9 thread fileRead((u8*)threadCode(), "/rei/thread/arm9.bin", 0); memcpy((u8*)threadHook(1), th1, sizeof(th1)); memcpy((u8*)threadHook(2), th2, sizeof(th2)); }
Shader::Shader(std::string vertName, std::string fragName, std::string geomName, std::string tessControlName, std::string tessEvalName) : m_sVertPath(vertName), m_sFragPath(fragName), m_sGeomPath(geomName), m_sTessControlPath(tessControlName), m_sTessEvalPath(tessEvalName) { m_nProgId = m_nVertId = m_nFragId = m_nTessControlId = m_nTessEvalId = m_nGeomId = 0; m_nProgId = glCreateProgram(); if(!vertName.empty()) { m_nVertId = compile(GL_VERTEX_SHADER, fileRead(vertName.c_str())); glAttachShader(m_nProgId, m_nVertId); } if(!tessControlName.empty()) { m_nTessControlId = compile(GL_TESS_CONTROL_SHADER, fileRead(tessControlName.c_str())); glAttachShader(m_nProgId, m_nTessControlId); } if(!tessEvalName.empty()) { m_nTessEvalId = compile(GL_TESS_EVALUATION_SHADER, fileRead(tessEvalName.c_str())); glAttachShader(m_nProgId, m_nTessEvalId); } if(!geomName.empty()) { m_nGeomId = compile(GL_GEOMETRY_SHADER, fileRead(geomName.c_str())); glAttachShader(m_nProgId, m_nGeomId); } if(!fragName.empty()) { m_nFragId = compile(GL_FRAGMENT_SHADER, fileRead(fragName.c_str())); glAttachShader(m_nProgId, m_nFragId); } glLinkProgram(m_nProgId); }