Image* TGAImageDecoder::Decode(DataStream* ds) { TGAHeader header; if (!LoadHeader(&header, ds)) return 0; ImageFormat fmt = IMAGE_FORMAT_UNKNOWN; if (header.bitsperpixel==32) fmt = IMAGE_FORMAT_RGBA; else if(header.bitsperpixel==24) fmt = IMAGE_FORMAT_RGB; else if (header.bitsperpixel==8) fmt = IMAGE_FORMAT_GRAY; bool rle = (header.datatypecode & 8)!=0; UInt32 width = header.width; UInt32 height = header.height; ImageImpl* img = new ImageImpl(width,height,fmt); bool res = rle ? LoadRLE(ds,img) : LoadRAW(ds,img); if (!res) { delete img; img = 0; } else { img->SwapChannelsRB(); if ( (header.imagedescriptor & 0x20 ) == 0) { img->FlipV(); } } return img; }
// イメージ読み込み指示 IBMP* BmpIO_Load( File::IResourceFile *infile ) { unsigned int ctsize; // カラーテーブルのエントリ数 int blen; // 1ピクセルあたりビット長 IBMP *pBmp; int w, h; BOOL r; // ファイルヘッダの入力、カラーテーブル長、 // pixelsの領域長、ピクセルあたりのビット長を取得 if ( !LoadHeader( infile, &ctsize, &blen, &w, &h ) ) return FALSE; // メモリ領域を確保 pBmp = BmpIO_CreateBitmap( w, h, blen ); if ( NULL == pBmp ) return NULL; // ピクセルあたりビット長別にファイルボディ部を読み込む if ( 24 != blen ) r = LoadBody1( infile, blen, pBmp ); else r = LoadBody24( infile, pBmp ); if ( !r ) { // 失敗 BmpIO_DeleteBitmap( pBmp ); return NULL; } return pBmp; }
/* ** load precompiled chunk */ Closure* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) { LoadState S; Closure* cl; if (*name=='@' || *name=='=') S.name=name+1; else if (*name==LUA_SIGNATURE[0]) S.name="binary string"; else S.name=name; S.L=L; S.Z=Z; S.b=buff; LoadHeader(&S); cl=luaF_newLclosure(L,1); setclLvalue(L,L->top,cl); incr_top(L); cl->l.p=luaF_newproto(L); LoadFunction(&S,cl->l.p); if (cl->l.p->sizeupvalues != 1) { Proto* p=cl->l.p; cl=luaF_newLclosure(L,cl->l.p->sizeupvalues); cl->l.p=p; setclLvalue(L,L->top-1,cl); } luai_verifycode(L,buff,cl->l.p); return cl; }
//---------------------------------------------------------------------------------------------------------------------- bool HoudiniGeo::Load( const std::string& _fName ) { // Open the stream and parse std::ifstream fileIn; fileIn.open(_fName.c_str()); if (!fileIn.is_open()) { std::cout <<"File : "<<_fName<<" Not founds "<<std::endl; return false; } // first we check the header to see if we have a valid file // if only OBJ's did this!! LoadHeader(fileIn); // check to see if we need to load any attribs if(m_nPointAttrib !=0) { LoadPointAttribDictionary(fileIn); } LoadPoints(fileIn); // set the center and BBox this->CalcDimensions(); fileIn.close(); return true; }
STDMETHODIMP CImpIPersistStream::Load(LPSTREAM pIStream) { ASSERT(pIStream); ebFILEHEADER Head; memset(&Head, 0, sizeof(Head)); HRESULT hr = LoadHeader (pIStream, &Head) ; if (FAILED (hr)) return hr; if(m_hCode) CoTaskMemFree(m_hCode); m_hCode = NULL; if (Head.dwCodeSz > 0 && Head.dwScriptSz > 0) hr = LoadCode_FromDB (pIStream, Head); else if (Head.dwScriptSz > 0) hr = LoadScript_FromDB (pIStream, Head); else ASSERT(0); if (FAILED(hr)) return hr; m_fIsDirty = false; return hr; }
BYTE MMXCore::CheckROM() { LoadHeader(); if (*(LPDWORD)(header->title+0) == 0x4147454D) if (*(LPDWORD)(header->title+4) == 0x204E414D) { switch(*(LPWORD)(header->title+8)) { case 0x2058: type = 0; break; case 0x3258: type = 1; break; case 0x3358: type = 2; break; default: type = 0xFF; return 0; } return type+1; } type = 0xFF; return 0; }
//================================================================================================= // Load metadata only from mesh (points) void Mesh::LoadMetadata(StreamReader& stream) { if(vb) return; LoadHeader(stream); stream.SetOffset(head.points_offset); LoadPoints(stream); }
//--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { Caption = "远程桌面连接管理器"; Application->Title = Caption; LoadHeader(); LoadDb(); Timer1->Enabled = true; }
void RSOView::LoadAll(u32 address) { LoadHeader(address); LoadSections(); LoadImports(); LoadExports(); LoadInternals(); LoadExternals(); }
void CWorkGrammar::VerifyHeader(TInputStream* input) { if (!LoadHeader(input)) { Stroka msg = "Failed to load tomita grammar: the binary is incompatible with your program. " "You should either re-compiler your .bin, or rebuild your program from corresponding version of sources.\n"; Cerr << msg << Endl; ythrow yexception() << msg; } }
bool PSFLoader::Load(bool show) { if(!psf_f.IsOpened()) return false; m_show_log = show; if(!LoadHeader()) return false; if(!LoadKeyTable()) return false; if(!LoadDataTable()) return false; return true; }
bool TGAImageDecoder::GetFileInfo(DataStream* ds, ImageInfo* info) { TGAHeader header; if (!LoadHeader(&header, ds)) return false; if (header.bitsperpixel==32) info->image_format = IMAGE_FORMAT_RGBA; else if(header.bitsperpixel==24) info->image_format = IMAGE_FORMAT_RGB; else if (header.bitsperpixel==8) info->image_format = IMAGE_FORMAT_GRAY; else return false; info->width = header.width; info->height = header.height; return true; }
/* ** load precompiled chunk */ killa_Proto* killaU_undump (killa_State* L, killa_ZIO* Z, killa_Mbuffer* buff, const char* name) { LoadState S; if (*name=='@' || *name=='=') S.name=name+1; else if (*name == KILLA_SIGNATURE[0]) S.name="binary string"; else S.name=name; S.L=L; S.Z=Z; S.b=buff; LoadHeader(&S); return killai_verifycode(L,buff,LoadFunction(&S)); }
/* ** load precompiled chunk */ Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) { LoadState S; if (*name=='@' || *name=='=') S.name=name+1; else if (*name==LUA_SIGNATURE[0]) S.name="binary string"; else S.name=name; S.L=L; S.Z=Z; S.b=buff; LoadHeader(&S); return LoadFunction(&S,luaS_newliteral(L,"=?")); }
int SWF::LoadSWF(const char* path) { m_pFile = new SWF_FILE; m_pFile->LoadSWF(path); if(!m_pFile->IsLoaded()) return -1; LoadHeader(m_pFile); while(!m_bIsEnd) LoadTag(m_pFile); return 0; }
bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configpath) { if (m_file) Close(); // TODO: This seems to be always true... A bug in ExistsFile() ? if (!Emu.GetVFS().ExistsFile(filepath)) Generate(filepath, configpath); m_file = Emu.GetVFS().OpenFile(filepath, vfsRead); LoadHeader(); LoadTableHeaders(); LoadTables(); Close(); return true; }
//------------------------------------------------------------------------------ // KK010111 //----------------------------------------------------------------------------- BOOL CKartenCtrl:: SetKVZCodes(void) { m_strKVZCodes.clear(); CPrjMapInputIter iter (&m_strDQ); while ( !iter.EndMarker()) { LoadHeader (iter.HProject()); ++iter; } // bricht ab, wenn ein Fehler auftritt (im Gegensatz zu for_each() //bool fResult = boolop_and(CPrjMapInputIter(&m_strDQ), CPrjMapInputIter(), operator ()); return true; }
void ReasoningKernel :: Load ( SaveLoadManager& m ) { TsProcTimer t; t.Start(); m.checkStream(); // releaseKB(); // we'll start a new one if necessary LoadHeader(m); m.checkStream(); LoadOptions(m); m.checkStream(); LoadKB(m); m.checkStream(); LoadIncremental(m); m.checkStream(); t.Stop(); std::cout << "Reasoner internal state loaded in " << t << " sec" << std::endl; }
//========================================== // 関数 : LoadBMPFromFilePointer // 目的 : 受け取ったファイルポインタが示すBMPファイルのロード // 戻り値: TImageInfo * ※読み込みに失敗した場合はNULLを返す // 引数 : FILE * pf ファイルポインタ //========================================== TImageInfo * LoadBMPFromFilePointer(FILE * pf) { TImageInfo * pBmp; // BMP用構造体のポインタ int nWidth; // 横幅情報受け取り用 int nHeight; // 縦幅情報受け取り用 unsigned short wBitCount; // ビット数情報受け取り用 unsigned long dwCompression; // 圧縮情報受け取り用 bool nResult; // 処理結果受け取り用 nResult = LoadHeader(pf); if (nResult == false) return NULL; // ファイルヘッダ部の読み込みに失敗した場合、処理を終了して関数から脱出する // 情報ヘッダ部の読み込みを行い、横幅・縦幅・ビット数・圧縮情報 のデータを受け取る nResult = LoadInfo(pf, &nWidth, &nHeight, &wBitCount, &dwCompression); if (nResult == false) return NULL; // 情報ヘッダ部の読み込みに失敗した場合、処理を終了して関数から脱出する pBmp = (TImageInfo *)malloc(sizeof(TImageInfo)); // TImageInfo型変数を動的確保する pBmp->nWidth = nWidth; // 先ほど取得した横幅情報を代入する pBmp->nHeight = nHeight; // 先ほど取得した縦幅情報を代入する pBmp->pbyPixels = NULL; // ピクセル情報を入れるポインタはNULLで初期化しておく if (wBitCount != 24) // 24bit形式でなかった場合 { pBmp->bEffective = false; // 対応できない形式であるため、フラグを折って関数から脱出する return pBmp; } if (dwCompression != 0) // 圧縮されている場合 { pBmp->bEffective = false; // 対応できない形式であるため、フラグを折って関数から脱出する return pBmp; } pBmp->bEffective = true; // 以上の条件をクリアしたということは対応できる形式であるため、フラグを立てておく pBmp->pbyPixels = LoadRGB(pf, pBmp->nWidth, pBmp->nHeight); // RGB情報を読み込む if (pBmp->pbyPixels == NULL) // RGB情報の読み込みに失敗した場合 { free(pBmp); // TImageInfo用に確保したメモリを解放する return NULL; } return pBmp; }
Loader::ResultStatus CIAContainer::Load(const std::vector<u8>& file_data) { Loader::ResultStatus result = LoadHeader(file_data); if (result != Loader::ResultStatus::Success) return result; // Load Title Metadata result = LoadTitleMetadata(file_data, GetTitleMetadataOffset()); if (result != Loader::ResultStatus::Success) return result; // Load CIA Metadata if (cia_header.meta_size) { result = LoadMetadata(file_data, GetMetadataOffset()); if (result != Loader::ResultStatus::Success) return result; } return Loader::ResultStatus::Success; }
/* ** load precompiled chunk */ Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name, size_t nameLength) { LoadState S; if (*name=='@' || *name=='=') { S.name=name+1; S.nameLength = nameLength -1; } else if (*name==LUA_SIGNATURE[0]) { S.name="binary string"; S.nameLength = strlen(S.name); } else { S.name=name; S.nameLength = nameLength; } S.L=L; S.Z=Z; S.b=buff; LoadHeader(&S); return LoadFunction(&S,luaS_newliteral(L,"=?")); }
bool REPLAY::StartPlaying(const std::string & replayfilename, std::ostream & error_output) { GetReadyToPlay(); //open the file std::ifstream replaystream(replayfilename.c_str(), std::ios::binary); if (!replaystream) { error_output << "Error loading replay file: " << replayfilename << std::endl; return false; } //load the header info from the file if (!LoadHeader(replaystream, error_output)) return false; //load all of the input/state frame chunks from the file until we hit the EOF while (Load(replaystream)); return true; }
// Starts replay bool _Replay::LoadReplay(const std::string &ReplayFile, bool HeaderOnly) { LevelName = ""; LevelVersion = 0; ReplayVersion = 0; // Get file name std::string FilePath = Save.GetReplayPath() + ReplayFile; // Open the replay if(!ReplayStream.OpenForRead(FilePath.c_str())) return false; // Read header LoadHeader(); // Read only the header if(HeaderOnly) ReplayStream.Close(); return true; }
bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configpath) { const std::string& path = vfs::get(filepath); if (!fs::is_file(path)) { Generate(filepath, configpath); } if (!m_file.open(path, fs::read)) { return false; } if (!LoadHeader() || !LoadTableHeaders() || !LoadTables()) { return false; } m_file.release(); return true; }
Loader::ResultStatus CIAContainer::Load(const std::string& filepath) { FileUtil::IOFile file(filepath, "rb"); if (!file.IsOpen()) return Loader::ResultStatus::Error; // Load CIA Header std::vector<u8> header_data(sizeof(Header)); if (file.ReadBytes(header_data.data(), sizeof(Header)) != sizeof(Header)) return Loader::ResultStatus::Error; Loader::ResultStatus result = LoadHeader(header_data); if (result != Loader::ResultStatus::Success) return result; // Load Title Metadata std::vector<u8> tmd_data(cia_header.tmd_size); file.Seek(GetTitleMetadataOffset(), SEEK_SET); if (file.ReadBytes(tmd_data.data(), cia_header.tmd_size) != cia_header.tmd_size) return Loader::ResultStatus::Error; result = LoadTitleMetadata(tmd_data); if (result != Loader::ResultStatus::Success) return result; // Load CIA Metadata if (cia_header.meta_size) { std::vector<u8> meta_data(sizeof(Metadata)); file.Seek(GetMetadataOffset(), SEEK_SET); if (file.ReadBytes(meta_data.data(), sizeof(Metadata)) != sizeof(Metadata)) return Loader::ResultStatus::Error; result = LoadMetadata(meta_data); if (result != Loader::ResultStatus::Success) return result; } return Loader::ResultStatus::Success; }
/* ** load precompiled chunk */ Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) { LoadState S; if (*name=='@' || *name=='=') S.name=name+1; else if (*name==LUA_SIGNATURE[0]) S.name="binary string"; else S.name=name; S.L=L; S.Z=Z; S.b=buff; LoadHeader(&S); #if LUA_REFCOUNT { Proto *proto = LoadFunction(&S,luaS_newliteral(L,"=?")); luarc_addrefproto(proto); return proto; } #else return LoadFunction(&S,luaS_newliteral(L,"=?")); #endif /* LUA_REFCOUNT */ }
A_STATUS set_patch_ram(AR3K_CONFIG_INFO *pConfig,A_UCHAR *patch_loc,A_UINT8 len) { A_UCHAR cmd[] = { 0x0B, 0xFC, 0x07, 0x0D, 0x00, 0x00, 0x00, /* Loc */0x00, 0x00, 0x00, 0x00 }; A_UCHAR i,j; unsigned char loc_byte[3]; A_UINT8 *event; A_UINT8 *bufferToFree = NULL; A_STATUS result = A_ERROR; A_UCHAR *loc_ptr = &cmd[7]; if(!patch_loc) return result; loc_byte[2] = '\0'; LoadHeader(cmd, 0x0D, 4, 0); for( i = 0,j = 3; i < 4; i++, j--) { loc_byte[0] = patch_loc[0]; loc_byte[1] = patch_loc[1]; loc_ptr[j] = A_STRTOL(loc_byte,NULL,16); patch_loc+=2; } Hci_log("Patch Ram Write -->",cmd, sizeof(cmd)); if(A_OK == SendHCICommandWaitCommandComplete(pConfig,cmd, sizeof(cmd), &event,&bufferToFree)) { result = ReadPSEvent(event); } if(bufferToFree != NULL) { A_FREE(bufferToFree); } return result; }
void MicromassRawData::Load(char *file) { if (strlen(file) < 4) { char message[512] ; // should end in .dat or .raw strcpy(message, "Invalid Masslynx 4 file name: ") ; strcat(message, file) ; strcat(message, " Should have a .raw in the path name") ; throw message ; } if (_strcmpi(&file[strlen(file)-4], ".raw")== 0) { strcpy(marr_filename, file) ; } else if (_strcmpi(&file[strlen(file)-4], ".dat")== 0) { //find index of .raw the file name or complain. char *ptr = strstr(file, ".raw") ; if (ptr == NULL) { char message[512] ; // should end in .dat or .raw strcpy(message, "Invalid Masslynx 4 file name: ") ; strcat(message, file) ; strcat(message, " Should have a .raw in the path name") ; throw message ; } strncpy(marr_filename, file, ptr - file+4) ; marr_filename[ptr-file+4] = '\0' ; } LoadHeader() ; }
Loader::ResultStatus CIAContainer::Load(const FileBackend& backend) { std::vector<u8> header_data(sizeof(Header)); // Load the CIA Header ResultVal<size_t> read_result = backend.Read(0, sizeof(Header), header_data.data()); if (read_result.Failed() || *read_result != sizeof(Header)) return Loader::ResultStatus::Error; Loader::ResultStatus result = LoadHeader(header_data); if (result != Loader::ResultStatus::Success) return result; // Load Title Metadata std::vector<u8> tmd_data(cia_header.tmd_size); read_result = backend.Read(GetTitleMetadataOffset(), cia_header.tmd_size, tmd_data.data()); if (read_result.Failed() || *read_result != cia_header.tmd_size) return Loader::ResultStatus::Error; result = LoadTitleMetadata(tmd_data); if (result != Loader::ResultStatus::Success) return result; // Load CIA Metadata if (cia_header.meta_size) { std::vector<u8> meta_data(sizeof(Metadata)); read_result = backend.Read(GetMetadataOffset(), sizeof(Metadata), meta_data.data()); if (read_result.Failed() || *read_result != sizeof(Metadata)) return Loader::ResultStatus::Error; result = LoadMetadata(meta_data); if (result != Loader::ResultStatus::Success) return result; } return Loader::ResultStatus::Success; }
/* ** load precompiled chunk */ Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) { LoadState S; // MTA Specific int bUnexpected = pUndumpHook && !pUndumpHook( Z->p, Z->n ); if (*name=='@' || *name=='=') S.name=name+1; else if (*name==LUA_SIGNATURE[0]) S.name="binary string"; else S.name=name; S.L=L; S.Z=Z; S.b=buff; LoadHeader(&S); // MTA Specific if ( bUnexpected ) error(&S,"unexpected"); return LoadFunction(&S,luaS_newliteral(L,"=?")); }