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
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
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
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
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
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
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
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)
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
def setrevision(self, number): if number > 255: return False self._data = pirstring.strsub(self._data, self._infoblock + 0x2B, chr(number)) return True
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
def setmaker(self, maker): if maker > 255 == True: return(False) self._data = pirstring.strsub(self._data, self._infoblock + 0x19, hex(maker)[2: ]) return(True)
def setname(self, name): name = name.ljust(0x14, " ") name = name[0:0x14] self._data = pirstring.strsub(self._data, self._infoblock, name) return(True)