int NeuralNet::Load(char *pWeightFile, char *pNormFile, int bunchSize) { // cut off suffix and add '.nbin' char pbin_file[1024]; strcpy(pbin_file, pWeightFile); char *pdot = strrchr(pbin_file, '.'); char *pslash = strrchr(pbin_file, NN_SLASH); if(pdot != 0 && (pslash == 0 || pdot > pslash)) { *pdot = '\0'; } strcat(pbin_file, ".nbin"); // load binary if the file exists if(LoadBinary(pbin_file, bunchSize) == NN_OK) { return NN_OK; } // load ascii otherwise and save it binary int ret = LoadAscii(pWeightFile, pNormFile, bunchSize); if(ret == NN_OK) { SaveBinary(pbin_file); } return ret; }
djresult DJDynamicEffectDesc::OnResourceReload() { // TODO: Release first before reloading const char * szName = GetResourceFileName(); DJTagFile file; if (file.Load(szName)) { DJWarning("Failed to load effect tagfile!"); return DJ_FAILURE; } if (LoadAscii(file, &file.m_root)) { DJWarning("Failed to parse effect from ASCII tagfile!"); return DJ_FAILURE; } SetName(szName); return DJ_SUCCESS; }