# Source Generated with Decompyle++ # File: Fusion_Graph.pyc (Python 3.8) import struct import sys class Game: def __init__(self, vanillaGame, randoSettings = (None,)): self.graph = dict() self.areaConnections = dict() self.areaConnectionOffsets = dict() self.doorConnections = dict() self.rooms = dict() self.requirements = dict() self.visited = list() self.queue = list() self.majorItemLocations = list() self.minorItemLocations = list() self.itemLocations = list() self.patcher = dict() self.graph.clear() self.areaConnections.clear() self.areaConnectionOffsets.clear() self.doorConnections.clear() self.rooms.clear() self.requirements.clear() self.visited.clear() self.queue.clear() self.majorItemLocations.clear() self.minorItemLocations.clear() self.itemLocations.clear() self.patcher.clear() print('DEBUG: Opening ROM to pick stuff') try: with open(vanillaGame, 'rb') as sourceRom: sourceRom.seek(3967888, 0) sourceArea = int.from_bytes(sourceRom.read(1), 'little') sourceDoor = int.from_bytes(sourceRom.read(1), 'little') targetOffset = sourceRom.tell() targetArea = int.from_bytes(sourceRom.read(1), 'little') if sourceArea != 255: self.areaConnections.update({ 'S{}-{:02X}'.format(sourceArea, sourceDoor): targetArea }) self.areaConnectionOffsets.update({ 'S{}-{:02X}'.format(sourceArea, sourceDoor): targetOffset }) sourceArea = int.from_bytes(sourceRom.read(1), 'little') sourceDoor = int.from_bytes(sourceRom.read(1), 'little') targetOffset = sourceRom.tell() targetArea = int.from_bytes(sourceRom.read(1), 'little') for currentArea in range(7): sourceRom.seek(7977108 + currentArea * 4, 0) data = sourceRom.read(4) unpacked = struct.unpack('= depth: if path >= depth: return None for point in None.graph[start]: if point in self.itemLocations and point not in end: continue if point in path: continue if LimitArea: for area in range(0, 7): if 'S{}'.format(area) in start and 'S{}'.format(area) not in point: return None edge = (start, point) self.queue.append(edge) if self.queue: edge = self.queue.pop() if edge not in self.visited: self.visited.append(edge) node = edge[1] pathReqs = self.get_requirements(start, node) if pathReqs == None: newpath = self.get_path(node, end, LimitArea, path, depth) if newpath: path = path + [ node] return newpath if pathReqs == True: newpath = self.get_path(node, end, LimitArea, path, depth) if newpath: path = path + [ node] return newpath