-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJRESim_Dengo.py
59 lines (51 loc) · 2.07 KB
/
JRESim_Dengo.py
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
#coding: utf-8
import SwitchDenGo
import keyboard
import time
print("このソフトウェアは、JR東日本トレインシミュレータ(JR EAST Train Simulator)を")
print("ゲーム向けマスコンで操作できるようにするための、同人ソフトウェアです。")
print("JR東日本およびその関連会社、また音楽館とは一切関係がありません。")
print("製作者Twitter: @mipsparc , GitHub: https://github.com/mipsparc")
print("現在はZUIKIの1ハンSwitchマスコンとタイトーのPS2 Type2 2ハンドルマスコンに対応しています")
print()
print("JRESim_Dengo Version1.1")
print("使い方: シミュレータ起動前にこのプログラムを起動するだけです。")
print("運転画面になったら、一旦非常ブレーキ(EB)に入れてください。")
print("Xボタン:前位置、Bボタン:後位置、Aボタン:EBリセット")
print("終了時はこのウィンドウをそのまま閉じてください。")
dengo = SwitchDenGo.SwitchDenGo()
P = 0
B = 0
while True:
dengo.loadStatus()
plus_knotch = 0
if P > dengo.accel_knotch:
plus_knotch = P - dengo.accel_knotch
if B < dengo.brake_knotch:
plus_knotch = dengo.brake_knotch - B
for i in range(plus_knotch):
keyboard.press_and_release("q")
minus_knotch = 0
if P < dengo.accel_knotch:
minus_knotch = dengo.accel_knotch - P
if B > dengo.brake_knotch:
minus_knotch = B - dengo.brake_knotch
if dengo.brake_knotch == 9:
keyboard.press_and_release("1")
time.sleep(0.5)
else:
for i in range(minus_knotch):
keyboard.press_and_release("z")
P = dengo.accel_knotch
B = dengo.brake_knotch
if "SW_X" in dengo.buttons:
keyboard.send("up")
if "SW_B" in dengo.buttons:
keyboard.send("down")
if "SW_A" in dengo.buttons:
keyboard.press_and_release("e")
if "SW_HOME" in dengo.buttons:
keyboard.send("enter")
if "SW_CIRCLE" in dengo.buttons:
keyboard.send("backspace")
time.sleep(0.05)