procon_bypass_man 0.3.3.1 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +2 -1
- data/CHANGELOG.md +6 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +6 -4
- data/README.md +1 -1
- data/benchmarks/README.md +6 -0
- data/benchmarks/bypass.rb +11 -0
- data/docs/setting/left-analogstick-cap.md +1 -1
- data/docs/setting/splatoon3_macro_forward_ikarole.md +1 -1
- data/docs/setting/splatoon3_rotation_forward_stick.md +20 -0
- data/lib/procon_bypass_man/bypass/bypass_command.rb +31 -8
- data/lib/procon_bypass_man/bypass/procon_to_switch.rb +12 -7
- data/lib/procon_bypass_man/bypass/switch_to_procon.rb +3 -3
- data/lib/procon_bypass_man/plugin/splatoon3/macro/rotation_left_stick.rb +21 -0
- data/lib/procon_bypass_man/plugins.rb +1 -0
- data/lib/procon_bypass_man/procon/macro_builder.rb +6 -1
- data/lib/procon_bypass_man/runner.rb +16 -7
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man.rb +6 -6
- data/procon_bypass_man.gemspec +1 -2
- data/project_template/app.rb +1 -1
- data/project_template/app.rb.erb +1 -1
- metadata +10 -8
- data/lib/procon_bypass_man/support/gc.rb +0 -8
- data/lib/procon_bypass_man/support/signal_handler.rb +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '019476402097b5b57976cd88c61d41b23c9eb7e6195a0f49240d4d89db9622a6'
|
|
4
|
+
data.tar.gz: '0590db283b885d28994ab318393876c2fc1acc3082960dbe7adaaec5c7080d21'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0e858601e6a4d98c5e7cd6eafafccf3e123c3ea956f70398d3382c6239aef888b84210a028b18b763cf8865b4b645181fa9c5f3d9f29047cd639a706979b0eb
|
|
7
|
+
data.tar.gz: 455638d194448fa0a535915e585519486b423828251de66f345e3888269b15f34c459cb55266ec08f271aa114a92f927195b1ef0e9621422695cfea356548a35
|
data/.circleci/config.yml
CHANGED
|
@@ -27,7 +27,8 @@ commands:
|
|
|
27
27
|
- gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
|
|
28
28
|
- gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }}
|
|
29
29
|
- gem-cache-v1
|
|
30
|
-
|
|
30
|
+
# NOTE: ruby2.5だとbundler2.4系に対応していないのでバージョンを固定する
|
|
31
|
+
- run: gem i bundler -v 2.3.26 && bundle install --path vendor/bundle --jobs 100 && bundle clean
|
|
31
32
|
- save_cache:
|
|
32
33
|
key: gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
|
|
33
34
|
paths:
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [0.3.4] - 2022-12-26
|
|
2
|
+
* 左スティックを1回転するマクロを追加しました
|
|
3
|
+
* 詳しい設定方法については docs/setting/splatoon3_rotation_forward_stick.md を参照してください
|
|
4
|
+
* プログラムの停止時・再読み込み時に時間がかかってた不具合を修正しました
|
|
5
|
+
|
|
1
6
|
## [0.3.3.1] - 2022-11-13
|
|
2
7
|
* setting.ymlにmacroを使って「スプラ用マクロ、惰性キャンセル」の閾値を設定できない不具合を修正しました
|
|
3
8
|
|
|
@@ -14,7 +19,7 @@
|
|
|
14
19
|
* レイヤーを変更しているときにコントローラーを振動できるようになりました
|
|
15
20
|
* setting.yml で `enable(:rumble_on_layer_change)` と記述してください
|
|
16
21
|
* イカロールをするマクロを追加しました
|
|
17
|
-
* 詳しい設定方法については docs/setting/
|
|
22
|
+
* 詳しい設定方法については docs/setting/splatoon3_macro_forward_ikarole.md を参照してください
|
|
18
23
|
* スプラ用マクロ、惰性キャンセルを削除しました
|
|
19
24
|
|
|
20
25
|
## [0.3.0] - 2022-9-9
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
procon_bypass_man (0.3.
|
|
4
|
+
procon_bypass_man (0.3.4)
|
|
5
5
|
action_cable_client
|
|
6
|
-
blue_green_process
|
|
6
|
+
blue_green_process (= 0.1.4.2)
|
|
7
7
|
pbmenv (>= 0.1.9)
|
|
8
8
|
sorted_set
|
|
9
9
|
|
|
@@ -19,7 +19,7 @@ GEM
|
|
|
19
19
|
tzinfo (~> 2.0)
|
|
20
20
|
zeitwerk (~> 2.3)
|
|
21
21
|
ast (2.4.2)
|
|
22
|
-
blue_green_process (0.1.
|
|
22
|
+
blue_green_process (0.1.4.2)
|
|
23
23
|
coderay (1.1.3)
|
|
24
24
|
concurrent-ruby (1.1.9)
|
|
25
25
|
diff-lcs (1.4.4)
|
|
@@ -51,7 +51,7 @@ GEM
|
|
|
51
51
|
rb-inotify (0.10.1)
|
|
52
52
|
ffi (~> 1.0)
|
|
53
53
|
rbs (1.7.1)
|
|
54
|
-
rbtree (0.4.
|
|
54
|
+
rbtree (0.4.6)
|
|
55
55
|
regexp_parser (2.2.0)
|
|
56
56
|
rexml (3.2.5)
|
|
57
57
|
rspec (3.10.0)
|
|
@@ -89,6 +89,7 @@ GEM
|
|
|
89
89
|
sorted_set (1.0.3)
|
|
90
90
|
rbtree
|
|
91
91
|
set (~> 1.0)
|
|
92
|
+
stackprof (0.2.22)
|
|
92
93
|
steep (0.47.0)
|
|
93
94
|
activesupport (>= 5.1)
|
|
94
95
|
language_server-protocol (>= 3.15, < 4.0)
|
|
@@ -134,6 +135,7 @@ DEPENDENCIES
|
|
|
134
135
|
rspec
|
|
135
136
|
rubocop
|
|
136
137
|
sinatra
|
|
138
|
+
stackprof
|
|
137
139
|
steep
|
|
138
140
|
timecop
|
|
139
141
|
typeprof
|
data/README.md
CHANGED
|
@@ -52,7 +52,7 @@ https://user-images.githubusercontent.com/1664497/171327108-f12f56a5-fc36-48da-9
|
|
|
52
52
|
* 日を跨ぐ24時ちょうどになった瞬間はLinuxのcronが起動などがするようで、この時間は数秒間バイパスが激しく遅延します
|
|
53
53
|
* ログファイルのローテションが少なくとも走るはずなので、不要なデーモンを停止するなどで影響を小さくすることはできると思いますが、完全に抑制することは難しいと思います
|
|
54
54
|
* コントローラーから読み取ってSwitchに書き込む時間は、少なくとも0.02秒はかかります
|
|
55
|
-
*
|
|
55
|
+
* 遅延は動かしているRaspberry Piの負荷に依存します
|
|
56
56
|
|
|
57
57
|
<!--
|
|
58
58
|
## TODO
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "stackprof"
|
|
2
|
+
require "procon_bypass_man"
|
|
3
|
+
|
|
4
|
+
# no action
|
|
5
|
+
raw_binary = ["30f28100800078c77448287509550274ff131029001b0022005a0271ff191028001e00210064027cff1410280020002100000000000000000000000000000000"].pack("H*")
|
|
6
|
+
binary = ProconBypassMan::Domains::InboundProconBinary.new(binary: raw_binary)
|
|
7
|
+
StackProf.run(mode: :cpu, out: 'tmp/stackprof.dump') do
|
|
8
|
+
10000.times do
|
|
9
|
+
ProconBypassMan::Processor.new(binary).process
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -26,7 +26,7 @@ version: 1.0
|
|
|
26
26
|
setting: |-
|
|
27
27
|
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
|
28
28
|
|
|
29
|
-
install_macro_plugin(ProconBypassMan::Plugin::
|
|
29
|
+
install_macro_plugin(ProconBypassMan::Plugin::Splatoon3::Macro::ForwardIkarole)
|
|
30
30
|
|
|
31
31
|
layer :up do
|
|
32
32
|
macro ProconBypassMan::Plugin::Splatoon3::Macro::ForwardIkarole, if_pressed: [:thumbl], force_neutral: []
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# スプラトゥーン3: 左スティック1回転 マクロの設定方法
|
|
2
|
+
|
|
3
|
+
* procon_bypass_man: 0.3.4以上が必要です
|
|
4
|
+
* このマクロは、左スティックを高速に1回転をします
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
https://user-images.githubusercontent.com/1664497/205416889-d458668e-ab46-4867-890c-ce32ff467128.mp4
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 設定例
|
|
11
|
+
```yaml
|
|
12
|
+
version: 1.0
|
|
13
|
+
setting: |-
|
|
14
|
+
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
|
15
|
+
install_macro_plugin(ProconBypassMan::Plugin::Splatoon2::Macro::RotationLeftStick)
|
|
16
|
+
|
|
17
|
+
layer :up do
|
|
18
|
+
macro ProconBypassMan::Plugin::Splatoon3::Macro::RotationLeftStick, if_pressed: [:left]
|
|
19
|
+
end
|
|
20
|
+
```
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
# 子プロセスで実行する
|
|
1
2
|
class ProconBypassMan::BypassCommand
|
|
2
|
-
include ProconBypassMan::SignalHandler
|
|
3
|
-
|
|
4
3
|
module WILL_TERMINATE_TOKEN
|
|
5
4
|
TERMINATE = :terminate
|
|
6
5
|
RESTART = :restart
|
|
@@ -25,7 +24,7 @@ class ProconBypassMan::BypassCommand
|
|
|
25
24
|
|
|
26
25
|
# gadget => procon
|
|
27
26
|
# 遅くていい
|
|
28
|
-
ProconBypassMan.logger.info "Thread1を起動します"
|
|
27
|
+
ProconBypassMan.logger.info "[BYPASS] Thread1を起動します"
|
|
29
28
|
|
|
30
29
|
cycle_sleep = ProconBypassMan::CycleSleep.new(cycle_interval: 1, execution_cycle: ProconBypassMan.config.bypass_mode.gadget_to_procon_interval)
|
|
31
30
|
|
|
@@ -46,14 +45,14 @@ class ProconBypassMan::BypassCommand
|
|
|
46
45
|
Process.kill "TERM", Process.ppid
|
|
47
46
|
end
|
|
48
47
|
|
|
49
|
-
ProconBypassMan.logger.info "Thread1を終了します"
|
|
48
|
+
ProconBypassMan.logger.info "[BYPASS] Thread1を終了します"
|
|
50
49
|
end
|
|
51
50
|
|
|
52
51
|
# procon => gadget
|
|
53
52
|
# シビア
|
|
54
53
|
t2 = Thread.new do
|
|
55
54
|
bypass = ProconBypassMan::Bypass::ProconToSwitch.new(gadget: @gadget, procon: @procon)
|
|
56
|
-
process = BlueGreenProcess.new(worker_instance: bypass, max_work:
|
|
55
|
+
process = BlueGreenProcess.new(worker_instance: bypass, max_work: 1000)
|
|
57
56
|
loop do
|
|
58
57
|
if $will_terminate_token
|
|
59
58
|
if $will_terminate_token == WILL_TERMINATE_TOKEN::TERMINATE
|
|
@@ -67,7 +66,7 @@ class ProconBypassMan::BypassCommand
|
|
|
67
66
|
|
|
68
67
|
process_switching_time_before_work = BlueGreenProcess.performance.process_switching_time_before_work
|
|
69
68
|
if process_switching_time_before_work > 0.1
|
|
70
|
-
ProconBypassMan.
|
|
69
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "slow process_switching_time_before_work: #{process_switching_time_before_work}")
|
|
71
70
|
end
|
|
72
71
|
|
|
73
72
|
rescue EOFError => e
|
|
@@ -81,25 +80,49 @@ class ProconBypassMan::BypassCommand
|
|
|
81
80
|
process.shutdown
|
|
82
81
|
break
|
|
83
82
|
end
|
|
83
|
+
|
|
84
|
+
ProconBypassMan.logger.info "[BYPASS] Thread2を終了します"
|
|
84
85
|
end
|
|
85
86
|
|
|
86
|
-
ProconBypassMan.logger.info "
|
|
87
|
+
ProconBypassMan.logger.info "BYPASSプロセスでgraceful shutdownの準備ができました"
|
|
87
88
|
begin
|
|
89
|
+
# TODO: 本当はいらないんだけど、なぜか反映されないのでここでも設定する
|
|
90
|
+
BlueGreenProcess.config.logger = ProconBypassMan.logger
|
|
91
|
+
|
|
88
92
|
while(readable_io = IO.select([self_read]))
|
|
89
93
|
signal = readable_io.first[0].gets.strip
|
|
90
|
-
|
|
94
|
+
case signal
|
|
95
|
+
when 'USR2'
|
|
96
|
+
ProconBypassMan.logger.debug "[BYPASS] BYPASSプロセスでUSR2シグナルを受け取りました"
|
|
97
|
+
raise ProconBypassMan::InterruptForRestart
|
|
98
|
+
when 'TERM'
|
|
99
|
+
ProconBypassMan.logger.debug "[BYPASS] BYPASSプロセスでTERMシグナルを受け取りました"
|
|
100
|
+
raise Interrupt
|
|
101
|
+
when 'INT'
|
|
102
|
+
ProconBypassMan.logger.debug "[BYPASS] BYPASSプロセスでINTシグナルを無視します"
|
|
103
|
+
end
|
|
91
104
|
end
|
|
92
105
|
rescue ProconBypassMan::InterruptForRestart
|
|
106
|
+
ProconBypassMan.logger.info "[BYPASS] BYPASSプロセスの終了処理を開始します"
|
|
93
107
|
$will_terminate_token = WILL_TERMINATE_TOKEN::RESTART
|
|
108
|
+
BlueGreenProcess.terminate_workers_immediately
|
|
94
109
|
[t1, t2].each(&:join)
|
|
110
|
+
ProconBypassMan.logger.info "[BYPASS] BYPASSプロセス内のThreadsが停止しました"
|
|
95
111
|
@gadget&.close
|
|
96
112
|
@procon&.close
|
|
113
|
+
ProconBypassMan.logger.info "[BYPASS] BYPASSプロセスを終了します"
|
|
114
|
+
DRb.stop_service if defined?(DRb)
|
|
97
115
|
exit! 1 # child processなのでexitしていい
|
|
98
116
|
rescue Interrupt
|
|
117
|
+
ProconBypassMan.logger.info "[BYPASS] BYPASSプロセスの終了処理を開始します"
|
|
99
118
|
$will_terminate_token = WILL_TERMINATE_TOKEN::TERMINATE
|
|
119
|
+
BlueGreenProcess.terminate_workers_immediately
|
|
100
120
|
[t1, t2].each(&:join)
|
|
121
|
+
ProconBypassMan.logger.info "[BYPASS] BYPASSプロセス内のThreadsが停止しました"
|
|
101
122
|
@gadget&.close
|
|
102
123
|
@procon&.close
|
|
124
|
+
ProconBypassMan.logger.info "[BYPASS] BYPASSプロセスを終了します"
|
|
125
|
+
DRb.stop_service if defined?(DRb)
|
|
103
126
|
exit! 1 # child processなのでexitしていい
|
|
104
127
|
end
|
|
105
128
|
end
|
|
@@ -29,18 +29,18 @@ class ProconBypassMan::Bypass::ProconToSwitch
|
|
|
29
29
|
self.bypass_value = ProconBypassMan::Bypass::BypassValue.new(nil)
|
|
30
30
|
|
|
31
31
|
next(run_callbacks(:work) {
|
|
32
|
-
next(false) if
|
|
32
|
+
next(false) if will_terminate?
|
|
33
33
|
|
|
34
34
|
raw_output = nil
|
|
35
35
|
measurement.record_read_time do
|
|
36
36
|
begin
|
|
37
|
-
return(false) if
|
|
37
|
+
return(false) if will_terminate?
|
|
38
38
|
raw_output = self.procon.read_nonblock(64)
|
|
39
39
|
rescue IO::EAGAINWaitReadable
|
|
40
40
|
sleep(0.002)
|
|
41
41
|
retry
|
|
42
42
|
rescue Errno::EIO, Errno::ENODEV, Errno::EPROTO, IOError, Errno::ESHUTDOWN, Errno::ETIMEDOUT => e
|
|
43
|
-
return(false) if
|
|
43
|
+
return(false) if will_terminate?
|
|
44
44
|
raise
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -52,7 +52,7 @@ class ProconBypassMan::Bypass::ProconToSwitch
|
|
|
52
52
|
ProconBypassMan::Retryable.retryable(tries: 5, on_no_retry: [Errno::EIO, Errno::ENODEV, Errno::EPROTO, IOError, Errno::ESHUTDOWN, Errno::ETIMEDOUT]) do
|
|
53
53
|
begin
|
|
54
54
|
# 終了処理を希望されているのでブロックを無視してメソッドを抜けてOK
|
|
55
|
-
return(false) if
|
|
55
|
+
return(false) if will_terminate? # rubocop:disable Lint/NoReturnInBeginEndBlocks
|
|
56
56
|
binary = ::ProconBypassMan::Procon::Rumbler.monitor do
|
|
57
57
|
ProconBypassMan::Processor.new(bypass_value.binary).process
|
|
58
58
|
end
|
|
@@ -69,11 +69,11 @@ class ProconBypassMan::Bypass::ProconToSwitch
|
|
|
69
69
|
|
|
70
70
|
next(true)
|
|
71
71
|
rescue IO::EAGAINWaitReadable
|
|
72
|
-
return(false) if
|
|
72
|
+
return(false) if will_terminate? # rubocop:disable Lint/NoReturnInBeginEndBlocks
|
|
73
73
|
measurement.record_write_error
|
|
74
74
|
raise CouldNotWriteToSwitchError
|
|
75
75
|
rescue Errno::EIO, Errno::ENODEV, Errno::EPROTO, IOError, Errno::ESHUTDOWN, Errno::ETIMEDOUT => e
|
|
76
|
-
return(false) if
|
|
76
|
+
return(false) if will_terminate? # rubocop:disable Lint/NoReturnInBeginEndBlocks
|
|
77
77
|
raise
|
|
78
78
|
end
|
|
79
79
|
end
|
|
@@ -89,7 +89,7 @@ class ProconBypassMan::Bypass::ProconToSwitch
|
|
|
89
89
|
|
|
90
90
|
# @return [void]
|
|
91
91
|
def direct_connect_switch_via_bluetooth
|
|
92
|
-
ProconBypassMan.logger.debug { "
|
|
92
|
+
ProconBypassMan.logger.debug { "[BYPASS] プロコンとSwitchを無線接続へ切り替えます" }
|
|
93
93
|
self.procon.write_nonblock(["010500000000000000003800"].pack("H*")) # home led off
|
|
94
94
|
self.procon.write_nonblock(["010600000000000000003800"].pack("H*")) # home led off
|
|
95
95
|
self.procon.write_nonblock(["010700000000000000003800"].pack("H*")) # home led off
|
|
@@ -107,4 +107,9 @@ class ProconBypassMan::Bypass::ProconToSwitch
|
|
|
107
107
|
|
|
108
108
|
ProconBypassMan.logger.debug { "<<< #{bypass_value.to_text}" }
|
|
109
109
|
end
|
|
110
|
+
|
|
111
|
+
# @return [Boolean]
|
|
112
|
+
def will_terminate?
|
|
113
|
+
$will_terminate_token
|
|
114
|
+
end
|
|
110
115
|
end
|
|
@@ -58,9 +58,9 @@ class ProconBypassMan::Bypass::SwitchToProcon
|
|
|
58
58
|
if ProconBypassMan.config.verbose_bypass_log
|
|
59
59
|
ProconBypassMan.logger.debug { ">>> #{bypass_value.to_text}" }
|
|
60
60
|
else
|
|
61
|
-
ProconBypassMan.cache.fetch key: 'bypass_log', expires_in: 1 do
|
|
62
|
-
|
|
63
|
-
end
|
|
61
|
+
# ProconBypassMan.cache.fetch key: 'bypass_log', expires_in: 1 do
|
|
62
|
+
# ProconBypassMan.logger.debug { ">>> #{bypass_value.to_text}" }
|
|
63
|
+
# end
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module ProconBypassMan
|
|
2
|
+
module Plugin
|
|
3
|
+
module Splatoon3
|
|
4
|
+
module Macro
|
|
5
|
+
module RotationLeftStick
|
|
6
|
+
def self.display_name
|
|
7
|
+
:rotation_left_stick
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.steps
|
|
11
|
+
[:rotation_left_stick]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.description
|
|
15
|
+
'左スティックを1回転します'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -18,6 +18,7 @@ require_relative "plugin/splatoon3/macro/sokuwari_for_splash_bomb"
|
|
|
18
18
|
require_relative "plugin/splatoon3/macro/forward_ikarole"
|
|
19
19
|
require_relative "plugin/splatoon3/macro/charge_tansan_bomb"
|
|
20
20
|
require_relative "plugin/splatoon3/macro/dasei_cancel"
|
|
21
|
+
require_relative "plugin/splatoon3/macro/rotation_left_stick"
|
|
21
22
|
require_relative "plugin/splatoon3/mode/guruguru"
|
|
22
23
|
|
|
23
24
|
module ProconBypassMan
|
|
@@ -95,7 +95,7 @@ class ProconBypassMan::Procon::MacroBuilder
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
# NOTE: マクロ構文で生成したいけど、スティックとボタン同時押しの構文が思いつかないので、ハードコードする
|
|
98
|
-
if
|
|
98
|
+
if /^forward_ikarole1/ =~ step
|
|
99
99
|
# NOTE: 0degはx: 1, y: 0, 90degはx: 0, y: 1, 180degはx: -1, y: 0.
|
|
100
100
|
# NOTE: スティックを前方に倒している状態で270度回転させる
|
|
101
101
|
for_forward_ikarole_steps = [
|
|
@@ -105,6 +105,11 @@ class ProconBypassMan::Procon::MacroBuilder
|
|
|
105
105
|
return { steps: for_forward_ikarole_steps }
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
if /^rotation_left_stick/ =~ step
|
|
109
|
+
roll_left_stick_steps = 0.step(359, 17).map { |x| ["tilt_left_stick_completely_to_#{x}deg".to_sym] }
|
|
110
|
+
return { steps: roll_left_stick_steps }
|
|
111
|
+
end
|
|
112
|
+
|
|
108
113
|
if %r!^(pressing_|toggle_|shake_left_stick_)! =~ step && (subjects = step.scan(%r!pressing_[^_]+|shake_left_stick|toggle_[^_]+!)) && (match = step.match(%r!_for_([\d_]+)(sec)?\z!))
|
|
109
114
|
if sec = match[1]
|
|
110
115
|
return {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
# フォアグラウンドで実行する
|
|
1
2
|
class ProconBypassMan::Runner
|
|
2
|
-
include ProconBypassMan::SignalHandler
|
|
3
|
-
|
|
4
3
|
def initialize(gadget: , procon: )
|
|
5
4
|
@gadget = gadget
|
|
6
5
|
@procon = procon
|
|
@@ -20,8 +19,9 @@ class ProconBypassMan::Runner
|
|
|
20
19
|
|
|
21
20
|
loop do
|
|
22
21
|
child_pid = Kernel.fork do
|
|
22
|
+
ProconBypassMan.logger.info "[BYPASS] BYPASSプロセスを起動します"
|
|
23
23
|
$will_terminate_token = false
|
|
24
|
-
ProconBypassMan.
|
|
24
|
+
ProconBypassMan.run_on_after_fork_of_bypass_process
|
|
25
25
|
ProconBypassMan::BypassCommand.new(gadget: @gadget, procon: @procon).execute # ここでblockingする
|
|
26
26
|
next
|
|
27
27
|
end
|
|
@@ -30,7 +30,13 @@ class ProconBypassMan::Runner
|
|
|
30
30
|
# TODO 子プロセスが消滅した時に、メインプロセスは生き続けてしまい、何もできなくなる問題がある
|
|
31
31
|
while(readable_io = IO.select([self_read]))
|
|
32
32
|
signal = readable_io.first[0].gets.strip
|
|
33
|
-
|
|
33
|
+
ProconBypassMan.logger.debug "[BYPASS] MASTERプロセスで#{signal}シグナルを受け取りました"
|
|
34
|
+
case signal
|
|
35
|
+
when 'USR2'
|
|
36
|
+
raise ProconBypassMan::InterruptForRestart
|
|
37
|
+
when 'INT', 'TERM'
|
|
38
|
+
raise Interrupt
|
|
39
|
+
end
|
|
34
40
|
end
|
|
35
41
|
rescue ProconBypassMan::InterruptForRestart
|
|
36
42
|
ProconBypassMan::PrintMessageCommand.execute(text: "設定ファイルの再読み込みを開始します")
|
|
@@ -40,17 +46,20 @@ class ProconBypassMan::Runner
|
|
|
40
46
|
ProconBypassMan::ButtonsSettingConfiguration::Loader.reload_setting
|
|
41
47
|
ProconBypassMan::SendReloadConfigEventCommand.execute
|
|
42
48
|
rescue ProconBypassMan::CouldNotLoadConfigError => error
|
|
43
|
-
ProconBypassMan::SendErrorCommand.execute(error: "設定ファイルが不正です。再読み込みができませんでした")
|
|
49
|
+
ProconBypassMan::SendErrorCommand.execute(error: "[MASTER] 設定ファイルが不正です。再読み込みができませんでした")
|
|
44
50
|
ProconBypassMan::ReportErrorReloadConfigJob.perform_async(error.message)
|
|
45
51
|
end
|
|
46
|
-
ProconBypassMan::PrintMessageCommand.execute(text: "バイパス処理を再開します")
|
|
52
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "[MASTER] バイパス処理を再開します")
|
|
47
53
|
rescue Interrupt
|
|
48
54
|
puts
|
|
49
|
-
ProconBypassMan::PrintMessageCommand.execute(text: "
|
|
55
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "[MASTER] BYPASSプロセスにTERMシグナルを送信します")
|
|
50
56
|
Process.kill("TERM", child_pid)
|
|
57
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "[MASTER] BYPASSプロセスの終了を待ちます")
|
|
51
58
|
Process.wait
|
|
52
59
|
break
|
|
53
60
|
end
|
|
54
61
|
end
|
|
62
|
+
|
|
63
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "[MASTER] メインプロセスを終了します")
|
|
55
64
|
end
|
|
56
65
|
end
|
data/lib/procon_bypass_man.rb
CHANGED
|
@@ -20,7 +20,6 @@ require_relative "procon_bypass_man/device_connection"
|
|
|
20
20
|
require_relative "procon_bypass_man/support/usb_device_controller"
|
|
21
21
|
require_relative "procon_bypass_man/support/device_procon_finder"
|
|
22
22
|
require_relative "procon_bypass_man/support/device_mouse_finder"
|
|
23
|
-
require_relative "procon_bypass_man/support/signal_handler"
|
|
24
23
|
require_relative "procon_bypass_man/support/callbacks"
|
|
25
24
|
require_relative "procon_bypass_man/support/yaml_loader"
|
|
26
25
|
require_relative "procon_bypass_man/support/yaml_writer"
|
|
@@ -39,7 +38,6 @@ require_relative "procon_bypass_man/support/analog_stick_hypotenuse_tilting_powe
|
|
|
39
38
|
require_relative "procon_bypass_man/support/never_exit_accidentally"
|
|
40
39
|
require_relative "procon_bypass_man/support/cycle_sleep"
|
|
41
40
|
require_relative "procon_bypass_man/support/can_over_process"
|
|
42
|
-
require_relative "procon_bypass_man/support/gc"
|
|
43
41
|
require_relative "procon_bypass_man/support/retryable"
|
|
44
42
|
require_relative "procon_bypass_man/support/renice_command"
|
|
45
43
|
require_relative "procon_bypass_man/procon_display"
|
|
@@ -182,14 +180,16 @@ module ProconBypassMan
|
|
|
182
180
|
end
|
|
183
181
|
|
|
184
182
|
# @return [void]
|
|
185
|
-
def self.
|
|
183
|
+
def self.run_on_after_fork_of_bypass_process
|
|
186
184
|
ProconBypassMan::ReniceCommand.change_priority(to: :high, pid: $$)
|
|
187
185
|
::GC.start
|
|
188
|
-
|
|
189
|
-
# GC対策することによって一時的に削除した機能
|
|
186
|
+
# GC対策することによって一時的に削除した機能. 後で有効にしたい
|
|
190
187
|
# ProconBypassMan::ProconDisplay::Server.start!
|
|
191
|
-
|
|
192
188
|
DRb.start_service if defined?(DRb)
|
|
189
|
+
|
|
190
|
+
# for libs setting
|
|
191
|
+
BlueGreenProcess.config.logger = ProconBypassMan.logger
|
|
192
|
+
|
|
193
193
|
BlueGreenProcess.configure do |config|
|
|
194
194
|
config.after_fork = -> {
|
|
195
195
|
DRb.start_service if defined?(DRb)
|
data/procon_bypass_man.gemspec
CHANGED
|
@@ -31,8 +31,7 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_dependency "pbmenv", ">= 0.1.9" # enable_pbm_cloud連携機能でPbmenv.installを使っている.
|
|
32
32
|
spec.add_dependency "action_cable_client"
|
|
33
33
|
spec.add_dependency "sorted_set"
|
|
34
|
-
spec.add_dependency "blue_green_process"
|
|
35
|
-
# spec.add_dependency "blue_green_process"
|
|
34
|
+
spec.add_dependency "blue_green_process", '0.1.4.2'
|
|
36
35
|
|
|
37
36
|
# For more information and examples about making a new gem, checkout our
|
|
38
37
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/project_template/app.rb
CHANGED
|
@@ -12,7 +12,7 @@ begin
|
|
|
12
12
|
gemfile do
|
|
13
13
|
source 'https://rubygems.org'
|
|
14
14
|
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
15
|
-
gem 'procon_bypass_man', '0.3.
|
|
15
|
+
gem 'procon_bypass_man', '0.3.4'
|
|
16
16
|
end
|
|
17
17
|
rescue Bundler::Source::Git::GitCommandError => e
|
|
18
18
|
retry_count_on_git_command_error = retry_count_on_git_command_error + 1
|
data/project_template/app.rb.erb
CHANGED
|
@@ -12,7 +12,7 @@ begin
|
|
|
12
12
|
gemfile do
|
|
13
13
|
source 'https://rubygems.org'
|
|
14
14
|
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
15
|
-
gem 'procon_bypass_man', '0.3.
|
|
15
|
+
gem 'procon_bypass_man', '0.3.4'
|
|
16
16
|
end
|
|
17
17
|
rescue Bundler::Source::Git::GitCommandError => e
|
|
18
18
|
retry_count_on_git_command_error = retry_count_on_git_command_error + 1
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: procon_bypass_man
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- jiikko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-12-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pbmenv
|
|
@@ -56,16 +56,16 @@ dependencies:
|
|
|
56
56
|
name: blue_green_process
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- -
|
|
59
|
+
- - '='
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
61
|
+
version: 0.1.4.2
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- -
|
|
66
|
+
- - '='
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
68
|
+
version: 0.1.4.2
|
|
69
69
|
description: A programmable converter for Nintendo Switch Pro Controller
|
|
70
70
|
email:
|
|
71
71
|
- n905i.1214@gmail.com
|
|
@@ -88,6 +88,8 @@ files:
|
|
|
88
88
|
- README.md
|
|
89
89
|
- Rakefile
|
|
90
90
|
- Steepfile
|
|
91
|
+
- benchmarks/README.md
|
|
92
|
+
- benchmarks/bypass.rb
|
|
91
93
|
- bin/console
|
|
92
94
|
- bin/dev_api_server.rb
|
|
93
95
|
- bin/generate_default_app
|
|
@@ -104,6 +106,7 @@ files:
|
|
|
104
106
|
- docs/setting/splatoon3_macro_dasei_cancel.md
|
|
105
107
|
- docs/setting/splatoon3_macro_forward_ikarole.md
|
|
106
108
|
- docs/setting/splatoon3_recommended_setting.md
|
|
109
|
+
- docs/setting/splatoon3_rotation_forward_stick.md
|
|
107
110
|
- docs/setup_raspi.md
|
|
108
111
|
- docs/setup_raspi.mitamae.rb
|
|
109
112
|
- docs/setup_raspi_by_mitamae.md
|
|
@@ -183,6 +186,7 @@ files:
|
|
|
183
186
|
- lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_left_key.rb
|
|
184
187
|
- lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_right_key.rb
|
|
185
188
|
- lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_up_key.rb
|
|
189
|
+
- lib/procon_bypass_man/plugin/splatoon3/macro/rotation_left_stick.rb
|
|
186
190
|
- lib/procon_bypass_man/plugin/splatoon3/macro/sokuwari_for_splash_bomb.rb
|
|
187
191
|
- lib/procon_bypass_man/plugin/splatoon3/mode/guruguru.rb
|
|
188
192
|
- lib/procon_bypass_man/plugin/splatoon3/version.rb
|
|
@@ -256,7 +260,6 @@ files:
|
|
|
256
260
|
- lib/procon_bypass_man/support/cycle_sleep.rb
|
|
257
261
|
- lib/procon_bypass_man/support/device_mouse_finder.rb
|
|
258
262
|
- lib/procon_bypass_man/support/device_procon_finder.rb
|
|
259
|
-
- lib/procon_bypass_man/support/gc.rb
|
|
260
263
|
- lib/procon_bypass_man/support/http_client.rb
|
|
261
264
|
- lib/procon_bypass_man/support/load_agv.rb
|
|
262
265
|
- lib/procon_bypass_man/support/never_exit_accidentally.rb
|
|
@@ -268,7 +271,6 @@ files:
|
|
|
268
271
|
- lib/procon_bypass_man/support/retryable.rb
|
|
269
272
|
- lib/procon_bypass_man/support/safe_timeout.rb
|
|
270
273
|
- lib/procon_bypass_man/support/send_device_stats_http_client.rb
|
|
271
|
-
- lib/procon_bypass_man/support/signal_handler.rb
|
|
272
274
|
- lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb
|
|
273
275
|
- lib/procon_bypass_man/support/uptime.rb
|
|
274
276
|
- lib/procon_bypass_man/support/usb_device_controller.rb
|