Permalink
Browse files

Actually enabled NES save extraction.

  • Loading branch information...
1 parent cdece31 commit f52f714d4f7943c879aae50cd85df782ada00c9b @Plombo committed Jan 28, 2011
Showing with 19 additions and 17 deletions.
  1. +19 −17 wiimetadata.py
View
@@ -81,23 +81,25 @@ def extractrom(self, u8path):
# FIXME: use string instead of StringIO
def extractrom_nes(self, u8path, filename):
- if os.path.exists(u8path):
- f = open(u8path, 'rb')
- rom = extract_nes_rom(f)
- f.close()
- if rom:
- # make sure save flag is set if the game has save data
- if os.path.exists(os.path.join(self.nand.path, 'title', '00010001', self.id, 'data', 'savedata.bin')):
- if not (ord(rom.getvalue()[6]) & 2):
- rom = list(rom.getvalue())
- rom[6] = chr(ord(rom[6]) | 2)
- rom = StringIO(''.join(rom))
- print 'Set the save flag to true'
-
- print 'Got ROM: %s' % filename
- writerom(rom, filename)
- return True
- else: return False
+ if not os.path.exists(u8path): return False
+
+ f = open(u8path, 'rb')
+ rom = extract_nes_rom(f)
+ f.close()
+
+ if not rom: return False
+
+ # make sure save flag is set if the game has save data
+ if self.extractsave():
+ if not (ord(rom.getvalue()[6]) & 2):
+ rom = list(rom.getvalue())
+ rom[6] = chr(ord(rom[6]) | 2)
+ rom = StringIO(''.join(rom))
+ print 'Set the save flag to true'
+
+ print 'Got ROM: %s' % filename
+ writerom(rom, filename)
+ return True
def extractrom_n64(self, arc, filename):
if arc.hasfile('rom'):

0 comments on commit f52f714

Please sign in to comment.