示例#1
0
    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
示例#2
0
    def extractmanual(self, u8path):
        try:
            arc = U8Archive(u8path)
            if not arc: return False
        except AssertionError:
            return False

        man = None
        try:
            if arc.findfile('emanual.arc'):
                man = U8Archive(arc.getfile(arc.findfile('emanual.arc')))
            elif arc.findfile('html.arc'):
                man = U8Archive(arc.getfile(arc.findfile('html.arc')))
            elif arc.findfile('man.arc'):
                man = U8Archive(arc.getfile(arc.findfile('man.arc')))
            elif arc.findfile('data.ccf'):
                ccf = CCFArchive(arc.getfile(arc.findfile('data.ccf')))
                man = U8Archive(ccf.getfile('man.arc'))
            elif arc.findfile('htmlc.arc'):
                manc = arc.getfile(arc.findfile('htmlc.arc'))
                print('Decompressing manual: htmlc.arc')
                man = U8Archive(StringIO(romc.decompress(manc)))
        except AssertionError:
            pass

        if man:
            man.extract(os.path.join('manuals', self.name))
            print('Extracted manual to ' + os.path.join('manuals', self.name))
            return True

        return False
示例#3
0
    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
示例#4
0
	def extractmanual(self, u8path):
		try:
			arc = U8Archive(u8path)
			if not arc: return False
		except AssertionError: 
			return False
	
		man = None
		try:
			if arc.findfile('emanual.arc'):
				man = U8Archive(arc.getfile(arc.findfile('emanual.arc')))
			elif arc.findfile('html.arc'):
				man = U8Archive(arc.getfile(arc.findfile('html.arc')))
			elif arc.findfile('man.arc'):
				man = U8Archive(arc.getfile(arc.findfile('man.arc')))
			elif arc.findfile('data.ccf'):
				ccf = CCFArchive(arc.getfile(arc.findfile('data.ccf')))
				man = U8Archive(ccf.getfile('man.arc'))
			elif arc.findfile('htmlc.arc'):
				manc = arc.getfile(arc.findfile('htmlc.arc'))
				print 'Decompressing manual: htmlc.arc'
				man = U8Archive(StringIO(romc.decompress(manc)))
		except AssertionError: pass
	
		if man:
			man.extract(os.path.join('manuals', self.name))
			print 'Extracted manual to ' + os.path.join('manuals', self.name)
			return True
	
		return False
示例#5
0
    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
示例#6
0
    def extractmanual(self, u8path, manualOutputPath):
        try:
            u8arc = U8Archive(u8path)
            if not u8arc: return False
        except AssertionError:
            return False

        man = None
        try:
            if u8arc.findfile('emanual.arc'):
                man = U8Archive(u8arc.getfile(u8arc.findfile('emanual.arc')))
            elif u8arc.findfile('html.arc'):
                man = U8Archive(u8arc.getfile(u8arc.findfile('html.arc')))
            elif u8arc.findfile('man.arc'):
                man = U8Archive(u8arc.getfile(u8arc.findfile('man.arc')))
            elif u8arc.findfile('data.ccf'):
                ccf = CCFArchive(u8arc.getfile(u8arc.findfile('data.ccf')))
                man = U8Archive(ccf.getfile('man.arc'))
            elif u8arc.findfile('htmlc.arc'):
                manc = u8arc.getfile(u8arc.findfile('htmlc.arc'))
                print('Decompressing manual: htmlc.arc')
                man = U8Archive(BytesIO(lz77.decompress_n64(manc)))
            elif u8arc.findfilebyregex('.+_manual_.+\\.arc\\.lz77$'):
                # E.g. makaimura_manual_usa.arc.lz77 (Arcade Ghosts n Goblins)
                manc = u8arc.getfile(
                    u8arc.findfilebyregex('.+_manual_.+\\.arc\\.lz77$'))
                man = U8Archive(BytesIO(lz77.decompress_nonN64(manc)))
                manc.close()
        except AssertionError:
            pass

        if man:
            self.ensure_folder_exists(manualOutputPath)
            man.extract(manualOutputPath)
            print('Extracted manual to ' + manualOutputPath)
            return True

        return False
示例#7
0
	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