-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path_frontend_ssh_server.py
More file actions
60 lines (49 loc) · 1.44 KB
/
Copy path_frontend_ssh_server.py
File metadata and controls
60 lines (49 loc) · 1.44 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import sys
import argparse
import asyncio
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
import gambaterm.ssh as gambaterm_ssh
from gambaterm.console import GameboyColor
from gambaterm.main import AppConfig
from gambaterm.remote_terminal import RemoteTerminal, KeyboardSupportDetection
rom = Path(sys.argv[1])
def test_frontend(
terminal: RemoteTerminal,
app_config: AppConfig,
keyboard_support_detection: KeyboardSupportDetection,
) -> AppConfig:
terminal.stream.write("TEST_FRONTEND_ACTIVE\n")
terminal.stream.flush()
return app_config
namespace = argparse.Namespace(
romfile=rom,
input_file=Path(sys.argv[2]),
skip_inputs=188,
color_mode=None,
frame_advance=1,
break_after=10,
speed=1.0,
cpr_sync=False,
save_directory=None,
force_gameboy=False,
)
async def main() -> None:
with ThreadPoolExecutor(max_workers=4) as executor:
async with gambaterm_ssh.run_ssh_server(
bind="127.0.0.1",
port=8022,
authentication=gambaterm_ssh.NoAuthentication(),
robot_check=False,
console_cls=GameboyColor,
namespace=namespace,
command_parser=lambda cmd, ns, write: ns,
users_directory=Path("."),
executor=executor,
frontend=test_frontend,
):
await asyncio.Future()
try:
asyncio.run(main())
except KeyboardInterrupt:
pass