-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
25 lines (18 loc) · 707 Bytes
/
main.py
File metadata and controls
25 lines (18 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import asyncio
from emulator import GameBoyEmulator
from websocket_server import WebSocketServer
from screen_converter import ScreenConverter
import config
async def main():
ScreenConverter.initialize()
emulator = GameBoyEmulator(rom_path=f"{config.ROM_PATH}/{config.ROM_FILE}", fps=config.EMULATION_FPS)
server = WebSocketServer(emulator, host=config.WEBSOCKET_HOST, port=config.WEBSOCKET_PORT)
emulator_task = asyncio.create_task(emulator.run())
server_task = asyncio.create_task(server.start())
try:
await asyncio.gather(emulator_task, server_task)
finally:
emulator.stop()
await server.stop()
if __name__ == "__main__":
asyncio.run(main())