コード例 #1
0
ファイル: zoxx.py プロジェクト: jabdownsmash/mda
def start(setup):

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

    state = State()
    sm = StateManager(state)

    # state.players[0].hitlag_counter_changed.append(listener)

    locationsTxt = ''
    for i in sm.locations():
        locationsTxt += i + '\n'

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

    done = False

    def exitHandler():
        nonlocal done
        done = True

    app = QtGui.QApplication(sys.argv)

    board = Melee()

    fi = FrameIndicator()
    fi.center = 0
    state.players[0].vertical_velocity_changed.append(
        lambda x: listener(x, fi))

    cont = Container(board, exitHandler, fi)
    cont.show()
    setup(state, board, cont)
    # board.texts.append((200,350,"hello"))

    mww = MemoryWatcher(home + '/MemoryWatcher/MemoryWatcher')
    for returnValue in mww:
        if returnValue is not None:
            address, value = returnValue
            sm.handle(address, value)
        app.processEvents()
        if done:
            break
コード例 #2
0
 def setUp(self):
     self.state = State()
     self.state_manager = StateManager(self.state)