def saveandrepoint(self, offset_old, newstring): offset_new = self.save(offset_old, newstring, force=False) writedata = BBlock() writedata.addPointer(offset_new) pointers = self.rom.findall(offsetToGBA(offset_old)) for pointer in pointers: self.rom.write(pointer, writedata) return offset_new
def search(self, string): #String to bytes, strip the END OF STRING byte. searchbytes = PokeString(string).bytestring()[:-1] results = self.rom.findall(searchbytes) results_list = [] for offset in results: thestr = self.rom.getRM().get(PokeString, offset) occ_count = len(self.rom.findall(array('B', offsetToGBA(offset)))) results_list.append((offset, occ_count, thestr)) self.mainview.setResults(results_list)
def findStartpoint(self, offset): while offset >= 0: if self.rom.readByte(offset)[1] == 0xff: break offset -= 1 if self.rom.find(array('B', offsetToGBA(offset)), 0) > -1: self.selectString(offset) showInfo(self.view, "Start of text found at offset 0x%X!"%offset) return #Very unlike to be seen. showInfo(self.view, "There was no valid startpoint found for the given text.")
def findStartpoint(self, offset): while offset >= 0: if self.rom.readByte(offset)[1] == 0xff: break offset -= 1 if self.rom.find(array('B', offsetToGBA(offset)), 0) > -1: self.selectString(offset) showInfo(self.view, "Start of text found at offset 0x%X!" % offset) return #Very unlike to be seen. showInfo(self.view, "There was no valid startpoint found for the given text.")
def getNumberOfPointers(self, offset): return len(self.rom.findall(array('B', offsetToGBA(offset))))