virtual void loadRawDataContainer (const CEGUI::String &filename, CEGUI::RawDataContainer &output, const CEGUI::String &resourceGroup) { ZFile file; if (file.Open(filename.c_str())) { int fn = file.GetSize(); char *ptr = new char [fn+1]; file.Read(ptr, fn); ptr[fn] = 0; output.setData((CEGUI::uint8*)ptr); output.setSize(fn); } }
//--------------------------------------------------------------------------------- // resolve includes // to avoid accessing the run time compiler calling filesystem functions (not supported on debug) // we must manually replace the includes directives by the file referenced. // this is weird but I can't see other alternative except to load precompile the shaders offline. //--------------------------------------------------------------------------------- char* resolveIncludes(char * src) { const char* pInclude; int srcSize = (int)strlen(src); int offset = 0; while ((pInclude = strstr(src+offset, "#include"))) { char* fstart; char* fend; if ((fstart = strchr((char*)pInclude, '\"')) && (fend = strchr(fstart+1, '\"')) ) { chdir("ZenithDatas"); int includePos = int(pInclude - src); tstring fname(fstart+1, (fend-fstart-1)); ZFile file; if (!file.Open(fname.c_str())) { LOG("can't open include file '%s'\n", fname.c_str()); break; } int includeSize = file.GetSize(); int newSize = srcSize + includeSize - (fend - pInclude); char* newSrc = (char*) new char [newSize]; memcpy(newSrc, src, includePos); file.Read(newSrc + includePos, includeSize); memcpy(newSrc + includePos + includeSize, fend+1, newSize - (includePos + includeSize)); newSrc[newSize-1] = 0; delete [] src; src = newSrc; srcSize = newSize; offset = includePos+1; chdir(".."); } } return src; }
void GuiProgress::Show(const char *szImgName) { // preventive mGUI->mMessageboxGui.Hide(); // build rect tstring backimg = szImgName; backimg.Replace(".track",".dds"); /* blocking texture loading */ ZTexture *tex = GDD->NewTexture(); ZFile file; if (file.Open(backimg.c_str(), ZOPEN_READ, false)) { unsigned char *tmpTex = new unsigned char [file.GetSize()]; file.Read(tmpTex, file.GetSize()); tex->LoadDDSFromMemory(tmpTex, file.GetSize() ); delete [] tmpTex; } // -- backimg.Replace(".dds","\0"); backimg.ToLower(); trckNfo->setText(backimg.c_str()); mLoadingRect = AddRect(0.f, 0.f, 1.f, 1.f, 0.f, 1.f, 1.f, 0.f); mLoadingRectTransform = mLoadingRect->GetTransform(); ZMaterial *mat = mLoadingRect->GetMaterial(0); mat->setEffect(guifx); mat->addTexture(tex); mat->connectEffect(true, false); FFxSetParam *paramcolor = mat->getNamedParam("col"); if (paramcolor) paramcolor->setVector(vector4(1.f)); mLoadingRect->SetVisible(true); //mLoadingRect->AddRef(); // Show GUI mLoadingfrm->show(); IncStackCount(); // transition /* GDD->ApplyRandomTransition(); // reset post process things GDD->SetPPfocalFactor(0.f); GDD->SetSepiaStrength(0.f); */ }