def extractrom_sega(self, arc, filename): if arc.hasfile('data.ccf'): ccf = CCFArchive(arc.getfile('data.ccf')) if ccf.hasfile('config'): for line in ccf.getfile('config'): if line.startswith('romfile='): romname = line[len('romfile='):].strip('/\\\"\0\r\n') else: print('config not found') return False if romname: print('Found ROM: %s' % romname) rom = ccf.find(romname) writerom(rom, filename) print('Got ROM: %s' % filename) if self.extractsave(): print('Extracted save to %s.srm' % self.name) else: print('No save file found') return True else: print('ROM filename not specified in config') return False
def extractrom_sega(self, arc, outputPath, filenameWithoutExtension): filename = os.path.join( outputPath, filenameWithoutExtension + self.extensions[self.channeltype]) if arc.hasfile('data.ccf'): ccf = CCFArchive(arc.getfile('data.ccf')) if ccf.hasfile('config'): romfilename = getConfiguration(ccf.getfile('config'), 'romfile') else: return False if romfilename: rom = ccf.find(romfilename) writerom(rom, filename) print('Got ROM: %s' % filename) if self.extractsave(outputPath): print('Extracted save to %s.srm' % self.name) else: print('No save file found') return True else: print('ROM filename not specified in config') return False
def extractrom_arcade(self, appFilePath, outputPath, filenameWithoutExtension): foundRom = False #print("file in app:" + appFilePath) u8arc = self.tryGetU8Archive(appFilePath) if not u8arc: #print("It is NOT a U8 archive! First bytes:") inFile = open(appFilePath, 'rb') inFile.seek(0) if (inFile.read(1))[0] == 0x11: #print("The first byte is 11 so it is probably compressed LZ77") data = lz77.decompress_nonN64(inFile) inFile.close() #!!! NOTE !!! This will be done multiple time for each game, overwriting the previous one # For ghosts n goblins, this is the only file that might contain the roms! outFile = open( os.path.join(outputPath, "TODO_DECOMPRESSED.BIN"), 'wb') outFile.write(data) outFile.close() #else: #print("The first byte is unknown, don't know what to do with this file, dumping it as DERP") #inFile.seek(0) #outFile = open(os.path.join(outputPath, "DERP_output" + appFilePath[(len(appFilePath)-7):]), 'wb') #outFile.write(inFile.read()) #outFile.close() else: #print("It IS a U8 archive! Content:") #for file in u8arc.files: # print(file.path) if u8arc.hasfile('data.ccf'): ccf = CCFArchive(u8arc.getfile('data.ccf')) if ccf.hasfile('config'): foundRom = extract_arcade(ccf, outputPath) if foundRom: print("Got ROMs") return foundRom
def extractrom_sega(self, arc, filename): if arc.hasfile('data.ccf'): ccf = CCFArchive(arc.getfile('data.ccf')) if ccf.hasfile('config'): for line in ccf.getfile('config'): if line.startswith('romfile='): romname = line[len('romfile='):].strip('/\\\"\0\r\n') else: print 'config not found' return False if romname: print 'Found ROM: %s' % romname rom = ccf.find(romname) writerom(rom, filename) print 'Got ROM: %s' % filename if self.extractsave(): print 'Extracted save to %s.srm' % self.name else: print 'No save file found' return True else: print 'ROM filename not specified in config' return False