Example #1
0
 def setmaker(self, maker):
     if maker > 255 or self.issufami() == True:
         return False
     if self.isrevised() == True:
         self._data = pirstring.strsub(self._data, self._infoblock, hex(maker)[2:])
     else:
         self._data = pirstring.strsub(self._data, self._infoblock + 0x2A, chr(maker))
     return True
Example #2
0
 def setcpu(self, cpu):
     if cpu < 2 or cpu > 3:
         return False
     if self.issatella() == True:
         code = ord(self._data[self._infoblock + 0x28]) % 0x10
     else:
         code = ord(self._data[self._infoblock + 0x25]) % 0x10
     if self.issatella() == True:
         self._data = pirstring.strsub(self._data, self._infoblock + 0x28, chr(cpu * 0x10 + code))
     else:
         self._data = pirstring.strsub(self._data, self._infoblock + 0x25, chr(cpu * 0x10 + code))
     return True
Example #3
0
 def setmap(self, map):
     if self.issatella() == True:
         code = ord(self._data[self._infoblock + 0x28]) / 0x10
     else:
         code = ord(self._data[self._infoblock + 0x25]) / 0x10
     if map < 20 or map > 29:
         return False
     map -= 20
     if self.issatella() == True:
         self._data = pirstring.strsub(self._data, self._infoblock + 0x28, chr(code * 0x10 + map))
     else:
         self._data = pirstring.strsub(self._data, self._infoblock + 0x25, chr(code * 0x10 + map))
     return True
Example #4
0
 def setchecksum(self, checksum):
     if checksum > 0xFFFF:
         return False
     self._data = pirstring.strsub(
         self._data, self._infoblock + 0x2C, pack("<H", 0xFFFF - checksum) + pack("<H", checksum)
     )
     return True
Example #5
0
 def setname(self, name):
     name = name.ljust(0x15, " ")
     if self.issatella():
         name = name[0:0x10]
     else:
         name = name[0:0x15]
     self._data = pirstring.strsub(self._data, self._infoblock + 0x10, name)
     return True
Example #6
0
 def setramsize(self, size):
     if self.issatella() == True:
         return False
     x = 0
     z = 0x400
     while size != z:
         z = z << 1
         x += 1
     self._data = pirstring.strsub(self._data, self._infoblock + 0x28, chr(x))
     return True
Example #7
0
 def setexram(self, size):
     if self.isrevised() == False:
         return False
     x = 0
     z = 0x400
     while size != z:
         z = z << 1
         x += 1
     self._data = pirstring.strsub(self._data, self._infoblock + 0x0D, chr(x))
     return True
Example #8
0
	def setcode(self, code):
		## Pad code to 4 and upper-case it
		if len(code) < 4:
			code = code.ljust(4, "0")
		code = code.upper()
		if re.compile("[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]").match(code) != None:
			self._data = pirstring.strsub(self._data, self._infoblock + 0x1b, code)
			return(True)
		else:
			return(False)
Example #9
0
 def setcode(self, code):
     if self.isrevised() == False:
         return False
         ## Pad code to 4 and upper-case it
     if len(code) < 4:
         code = code.ljust(4, " ")
     code = code.upper()
     if re.compile("[A-Z0-9 ][A-Z0-9 ][A-Z0-9 ][A-Z0-9 ]").match(code) != None:
         self._data = pirstring.strsub(self._data, self._infoblock + 0x02, code[0:4])
         return True
     else:
         return False
Example #10
0
 def setrevision(self, number):
     if number > 255:
         return False
     self._data = pirstring.strsub(self._data, self._infoblock + 0x2B, chr(number))
     return True
Example #11
0
 def setspecial(self, special):
     if self.isrevised() == False or special > 255:
         return False
     self._data = pirstring.strsub(self._data, self._infoblock + 0xE, chr(special))
     return True
Example #12
0
	def setmaker(self, maker):
		if maker > 255 == True:
			return(False)
		self._data = pirstring.strsub(self._data, self._infoblock + 0x19, hex(maker)[2: ])
		return(True)
Example #13
0
	def setname(self, name):
		name = name.ljust(0x14, " ")
		name = name[0:0x14]
		self._data = pirstring.strsub(self._data, self._infoblock, name)
		return(True)