int UpdateTagsFile(const char* file) { TagFileInfo *fi=NULL; int i; String filename=file; filename.ToLower(); for(i=0;i<files.Count();i++) { if(files[i]->filename==filename) { fi=files[i]; break; } } if(!fi) { struct stat st; if(stat(filename,&st)==-1)return 0; TagFileInfo tfi; tfi.filename=filename; tfi.modtm=st.st_mtime; if(!FindIdx(&tfi))return 0; if(Load(filename,"")!=1)return 0; } StrList sl; if(!CheckChangedFiles(filename,sl))return 0; if(sl.Count()==0)return 1; sl.SaveToFile("tags.changes"); String cmd=config.exe+" "; String opt=config.opt; opt.Replace("-R",""); RegExp re("/\\*(\\.\\S*)?/"); SMatch m[4]; int n=4; while(re.Search(opt,m,n)) { opt.Delete(m[0].start,m[0].end-m[0].start); } cmd+=opt; cmd+=" -f tags.update -L tags.changes"; //extern int Msg(const char* err); //Msg(cmd); if(!Execute(cmd)) { remove("tags.changes"); return 0; } MergeFiles(file,"tags.update"); remove("tags.changes"); remove("tags.update"); Load(file,""); return 1; }
/* Patch IPS file with original roms */ void ApplyPatch(void) { int i = 0; /* first do graphics roms */ for (i = 0; i < NumGfxRoms; i ++) { MergeFiles(GfxRoms[i].ROMName, GfxRoms[i].Size); } #if 0 /* are there any map roms to create patch files for? */ if (numDataRoms != 0) { for (i = 0; i < numDataRoms; i ++) { MergeFiles(Drivers[DataRoms[i].ROMName, Drivers[DataRoms[i].Size); } } #endif }
int main(int argc, char **argv) { if(!argv[1]) { printf("%s [mu] <merged file> <file to merge1> <file to merge2> ..\n", argv[0]); exit(1); } if(strcmp(argv[1], "m") == 0) { MergeFiles(argv[2], argv + 3); } else if(strcmp(argv[1], "u") == 0) { UnmergeFiles(argv[2]); } else { printf("ERROR\n"); } return(0); }
int main(int argc, char* argv[]) { Init init; try { nParameter_Init((uint32_t)argc, argv); nCheck_Switches(); if (parameters.merging) { MergeFiles(); } else { if (!openWavIO()) { lossyWAVError("Error initialising wavIO unit.", 0x11); } if (Global.Codec_Block.Size == 0) { lossyWAVError("Error initialising wavIO unit.", 0x11); } nInitial_Setup(); nProcess_Init(); nSpreading_Init(); nFillFFT_Init(); // dependent on Codec_Block_Size. nRemoveBits_Init(); // bitdepth and samplerate dependent. nOutput_Init(); if (!readNextNextCodecBlock()) { lossyWAVError("Error reading from input file.", 0x21); } Global.blocks_processed = 0; //========================================================================== // Main processing loop. //========================================================================== while (AudioData.Size.Next > 0) { Shift_Codec_Blocks(); readNextNextCodecBlock(); Process_This_Codec_Block(); if (!writeNextBTRDcodecblock()) { lossyWAVError("Error writing to output file.", 0x21); } if (parameters.correction) { if (!writeNextCORRcodecblock()) { lossyWAVError("Error writing to correction file.", 0x22); } } } if (!closeWavIO()) { lossyWAVError("Error closing wavIO unit.", 0x11); } write_cleanup(); } } catch (int32_t ret) { switch (ret) { case 0: return 0; case 1: return 1; default: return -1; } return -1; } }