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
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
def extractrom_n64(self, arc, filename): if arc.hasfile('rom'): rom = arc.getfile('rom') print('Got ROM: %s' % filename) writerom(rom, filename) elif arc.hasfile('romc'): rom = arc.getfile('romc') print('Decompressing ROM: %s (this could take a minute or two)' % filename) try: romdata = romc.decompress(rom) outfile = open(filename, 'wb') outfile.write(romdata) outfile.close() print('Got ROM: %s' % filename) except IndexError: # unknown compression - something besides LZSS and romchu? print('Decompression failed: unknown compression type') outfile.close() os.remove(filename) return False else: return False # extract save file savepath = self.extractsave() if savepath: print('Extracted save file(s)') else: print('Failed to extract save file(s)') return True
def extractrom_n64(self, arc, filename): if arc.hasfile('rom'): rom = arc.getfile('rom') print 'Got ROM: %s' % filename writerom(rom, filename) elif arc.hasfile('romc'): rom = arc.getfile('romc') print 'Decompressing ROM: %s (this could take a minute or two)' % filename try: romdata = romc.decompress(rom) outfile = open(filename, 'wb') outfile.write(romdata) outfile.close() print 'Got ROM: %s' % filename except IndexError: # unknown compression - something besides LZSS and romchu? print 'Decompression failed: unknown compression type' outfile.close() os.remove(filename) return False else: return False # extract save file savepath = self.extractsave() if savepath: print 'Extracted save file(s)' else: print 'Failed to extract save file(s)' return True