-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJRESim_Type2.py
64 lines (57 loc) · 2.46 KB
/
JRESim_Type2.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
60
61
62
63
64
#coding: utf-8
import DENSYA_CON_T01
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_Type2 Version1.1")
print("使い方: シミュレータ起動前にこのプログラムを起動するだけです。")
print("運転画面になったら、一旦マスコンは切、ブレーキは非常ブレーキに入れてください。")
print("上ボタン:前位置、下ボタン:後位置、Aボタン:EBリセット、Bボタンまたはペダル:ホーン")
print("終了時はこのウィンドウをそのまま閉じてください。")
dengo = DENSYA_CON_T01.DENSYA_CON_T01()
P = 0
B = 0
while True:
dengo.loadStatus()
if dengo.accel_knotch is not None:
plus_p = 0
minus_p = 0
if P > dengo.accel_knotch:
minus_p = P - dengo.accel_knotch
if P < dengo.accel_knotch:
plus_p = dengo.accel_knotch - P
for i in range(plus_p):
keyboard.press_and_release("z")
for i in range(minus_p):
keyboard.press_and_release("a")
P = dengo.accel_knotch
if dengo.brake_knotch is not None:
if dengo.brake_knotch == 9:
keyboard.press_and_release("/")
time.sleep(0.5)
else:
plus_b = 0
minus_b = 0
if B > dengo.brake_knotch:
minus_b = B - dengo.brake_knotch
if B < dengo.brake_knotch:
plus_b = dengo.brake_knotch - B
for i in range(plus_b):
keyboard.press_and_release(".")
for i in range(minus_b):
keyboard.press_and_release(",")
B = dengo.brake_knotch
if "TYPE2_UP" in dengo.buttons:
keyboard.send("up")
if "TYPE2_DOWN" in dengo.buttons:
keyboard.send("down")
if "TYPE2_A" in dengo.buttons:
keyboard.press_and_release("e")
if "HONE" in dengo.buttons or "TYPE2_B" in dengo.buttons:
keyboard.send("backspace")
time.sleep(0.02)