void global_slots_data:: Load ( ) { // Load .details // copy //if() IReader* R = FS.r_open ( "$level$", "build.details" ); R->r_chunk ( 0, &dtH ); R->seek ( 0 ); u32 check_sum = crc32( R-> pointer(), R->length()); recalculation_data.load( check_sum ); if( !recalculation_data.recalculating() ) { IWriter* W = FS.w_open ( "$level$", "level.details" ); W->w ( R->pointer(), R->length() ); FS.w_close ( W ); } FS.r_close ( R ); // re-open string_path N; FS.update_path ( N, "$level$", "level.details" ); dtFS = xr_new<CVirtualFileRW> ( N ); R_ASSERT ( dtH.version()==DETAIL_VERSION ); dtFS->find_chunk ( 2 ); dtS = (DetailSlot*)dtFS->pointer(); }
void CResourceManager::OnDeviceCreate (IReader* F) { if (!RDEVICE.b_is_Ready) return; string256 name; #ifndef _EDITOR // scripting LS_Load (); #endif IReader* fs = 0; // Load constants fs = F->open_chunk (0); if (fs){ while (!fs->eof()) { fs->r_stringZ (name,sizeof(name)); CConstant* C = _CreateConstant (name); C->Load (fs); } fs->close (); } // Load matrices fs = F->open_chunk(1); if (fs){ while (!fs->eof()) { fs->r_stringZ (name,sizeof(name)); CMatrix* M = _CreateMatrix (name); M->Load (fs); } fs->close (); } // Load blenders fs = F->open_chunk (2); if (fs){ IReader* chunk = NULL; int chunk_id= 0; while ((chunk=fs->open_chunk(chunk_id))!=NULL){ CBlender_DESC desc; chunk->r (&desc,sizeof(desc)); IBlender* B = IBlender::Create(desc.CLS); if (0==B) { Msg ("! Renderer doesn't support blender '%s'",desc.cName); } else { if (B->getDescription().version != desc.version) { Msg ("! Version conflict in shader '%s'",desc.cName); } chunk->seek (0); B->Load (*chunk,desc.version); std::pair<map_BlenderIt, bool> I = m_blenders.insert (mk_pair(xr_strdup(desc.cName),B)); R_ASSERT2 (I.second,"shader.xr - found duplicate name!!!"); } chunk->close (); chunk_id += 1; } fs->close(); } m_textures_description.Load (); }