Ejemplo n.º 1
0
    def setUp(self):
        # Create a fifo for testing. We'll remove it in tearDown.
        self.fifo_path = os.getcwd() + '/fifo'
        os.mkfifo(self.fifo_path)

        self.pipe = os.open(self.fifo_path, os.O_RDONLY | os.O_NONBLOCK)
        self.pad = Pad(self.fifo_path)
Ejemplo n.º 2
0
        pad.tilt_stick(Stick.C, trunc(output[11]), trunc(output[12]))


if __name__ == '__main__':
    global acceptedInputs
    AddressObjects.init()

    if len(sys.argv) != 3:
        sys.exit('Usage: ' + sys.argv[0] + ' dolphin-home savepath')
    home = sys.argv[1]

    with open(home + '/MemoryWatcher/Locations.txt', 'w') as file:
        file.write(AddressObjects.locations_txt)

    acceptedInputs, nn = pickle.load(open(sys.argv[2], "rb"))

    nnGameState = [0 for i in acceptedInputs]

    # print()
    melee = Melee()

    mww = MemoryWatcher(home + '/MemoryWatcher/MemoryWatcher')
    pad = Pad(home + '/Pipes/pipe')
    try:
        melee.listen(
            mww,
            lambda x, y: listener(x, y, acceptedInputs, nnGameState, nn, pad))
    except KeyboardInterrupt:
        # Set controller to neutral
        clear(pad)
        sys.exit()