root/rarfile.patch

Revision 1, 1.3 kB (checked in by jmoiron, 2 years ago)

Initial commit. Some things are working quite nice
at this stage, in particular:

  • datfile.py basically supports romcenter and clrmamepro
  • ndsencrypt supports arm9 encryption for secure area crcs
  • ndsheader supports *most* of the output of ndstool -i

In addition, rarfile.patch is included here. It contains
the changes made on the rarfile.py library (which is a
standalone file and is encluded in romutil, but unfortunately
is linux only.. looking into a replacement but not sure
if one is possible or exists)

  • rarfile.py

    old new  
    389389    # put file compressed data into temporary .rar archive, and run 
    390390    # unrar on that, thus avoiding unrar going over whole archive 
    391391    def _extract_hack(self, inf): 
     392        from tempfile import mkstemp 
    392393        BSIZE = 32*1024 
    393394 
    394395        size = inf.compress_size + inf.header_size 
    395396        rf = open(self.rarfile, "rb") 
    396397        rf.seek(inf.header_offset) 
    397         tmpname = os.tempnam() + ".rar" 
    398         tmpf = open(tmpname, "wb") 
     398        tmpfd,tmpname = mkstemp(suffix='.rar') 
     399        tmpf = os.fdopen(tmpfd, "wb") 
    399400 
    400401        # create main header: crc, type, flags, size, res1, res2 
    401402        mh = pack("<HBHHHL", 0x90CF, 0x73, 0, 13, 0, 0) 
     
    409410            tmpf.write(buf) 
    410411            size -= len(buf) 
    411412        tmpf.close() 
    412  
     413         
    413414        buf = self._extract_unrar(tmpname, inf) 
    414415        os.unlink(tmpname) 
    415416        return buf 
     
    478479                        self.put(self.std_byte(), 0) 
    479480        return self.buf.getvalue().decode("utf-16le", "replace") 
    480481 
    481 # ignore os.tempnam() warning 
    482 try: 
    483     import warnings 
    484     warnings.filterwarnings(action = 'ignore', category = RuntimeWarning, 
    485                             module = 'rarfile') 
    486 except Exception, det: 
    487     pass 
    488  
Note: See TracBrowser for help on using the browser.