procon_bypass_man 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b58b7076f8ae670534f5de02a4d4f08ce85b0e8f32942146c156cbd86e0f6c9f
4
- data.tar.gz: 47a0d06e49d43c5d9add37212b63a14dcf28016738a34219b6b33534e71bb0af
3
+ metadata.gz: '019476402097b5b57976cd88c61d41b23c9eb7e6195a0f49240d4d89db9622a6'
4
+ data.tar.gz: '0590db283b885d28994ab318393876c2fc1acc3082960dbe7adaaec5c7080d21'
5
5
  SHA512:
6
- metadata.gz: 7007fe181dffb3d6357d73e1b5f8880647d92e54216ca65d24573c9cadde2bd40bfed977ec5cff8344570d468298b196becd8d7ed36d1ecac9fa54d8250817a4
7
- data.tar.gz: 490791b8522adc71b10354dc4628bc8e51988ef04e11e82dd9b5ed2a40112dc71e6bc93f9fb9116efd03a3ba1dbb16a67b05ce6e466ef8be26ae27021cd51eba
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
- - run: gem i bundler && bundle install --path vendor/bundle --jobs 100 && bundle clean
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,11 @@
1
+ ## [0.3.4] - 2022-12-26
2
+ * 左スティックを1回転するマクロを追加しました
3
+ * 詳しい設定方法については docs/setting/splatoon3_rotation_forward_stick.md を参照してください
4
+ * プログラムの停止時・再読み込み時に時間がかかってた不具合を修正しました
5
+
6
+ ## [0.3.3.1] - 2022-11-13
7
+ * setting.ymlにmacroを使って「スプラ用マクロ、惰性キャンセル」の閾値を設定できない不具合を修正しました
8
+
1
9
  ## [0.3.3] - 2022-11-13
2
10
  * 以前に削除した「スプラ用マクロ、惰性キャンセル」を使えるようにしました
3
11
  * docs/setting/splatoon2_macro_dasei_cancel.md, docs/setting/splatoon3_macro_dasei_cancel.md を参照してください
@@ -11,7 +19,7 @@
11
19
  * レイヤーを変更しているときにコントローラーを振動できるようになりました
12
20
  * setting.yml で `enable(:rumble_on_layer_change)` と記述してください
13
21
  * イカロールをするマクロを追加しました
14
- * 詳しい設定方法については docs/setting/splatoon2_macro_forward_ikarole.md を参照してください
22
+ * 詳しい設定方法については docs/setting/splatoon3_macro_forward_ikarole.md を参照してください
15
23
  * スプラ用マクロ、惰性キャンセルを削除しました
16
24
 
17
25
  ## [0.3.0] - 2022-9-9
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ gem "timecop"
12
12
  gem "rubocop", require: false
13
13
  gem "sinatra", require: false
14
14
  gem "webrick", require: false
15
+ gem "stackprof", require: false
15
16
 
16
17
  if Gem::Version.new(RUBY_VERSION) > Gem::Version.new("2.6.0")
17
18
  gem 'typeprof', require: false
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- procon_bypass_man (0.3.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.3)
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.5)
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
- * 動かしているRaspberry Piの負荷に依存するこの限りではありません
55
+ * 遅延は動かしているRaspberry Piの負荷に依存します
56
56
 
57
57
  <!--
58
58
  ## TODO
@@ -0,0 +1,6 @@
1
+ # benchmark
2
+ ## Processing
3
+ プロコンから読み取ったバイナリを加工する処理
4
+
5
+ * `ruby benchmarks/bypass.rb`
6
+ * `bundle execc stackprof tmp/stackprof.dump`
@@ -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
@@ -54,7 +54,7 @@ setting: |-
54
54
  prefix_keys_for_changing_layer [:zr, :zl, :l]
55
55
  set_neutral_position 2100, 2000
56
56
 
57
- layer :up, mode: :manual do
57
+ layer :up do
58
58
  left_analog_stick_cap cap: 1100, if_pressed: [:zl, :a], force_neutral: :a
59
59
  end
60
60
  ```
@@ -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::Splatoon2::Macro::ForwardIkarole)
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
+ ```
@@ -53,13 +53,13 @@ module ProconBypassMan
53
53
  end
54
54
 
55
55
  # @param [String, Class] プラグインのclass
56
- # @param [Hash, NilClass] if_tilted_left_stick
56
+ # @param [Hash, Boolean, NilClass] if_tilted_left_stick
57
57
  def macro(name, if_pressed: nil, if_tilted_left_stick: nil, force_neutral: nil)
58
58
  case if_tilted_left_stick
59
59
  when Integer, String, Symbol, Array
60
60
  warn "macro #{name}のif_tilted_left_stickで想定外の値です"
61
61
  if_tilted_left_stick = nil
62
- when TrueClass, NilClass, FalseClass
62
+ when TrueClass, NilClass, FalseClass, Hash
63
63
  # OK
64
64
  else
65
65
  Kernel.warn "設定ファイルに記述ミスがあります. 未対応の値を受け取りました."
@@ -91,6 +91,7 @@ module ProconBypassMan
91
91
  end
92
92
 
93
93
  # 設定ファイルに直接マクロを打ち込める
94
+ # @param [Hash, Boolean, NilClass] if_tilted_left_stick
94
95
  # @param [String, Class] macroの識別子
95
96
  # @paramh[Array<Symbol>] macroの本体. ボタンの配列
96
97
  def open_macro(name, steps: [], if_pressed: nil, if_tilted_left_stick: nil, force_neutral: nil)
@@ -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: 550)
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.logger.info("slow process_switching_time_before_work: #{process_switching_time_before_work}")
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 "子プロセスでgraceful shutdownの準備ができました"
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
- handle_signal(signal)
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 $will_terminate_token
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 $will_terminate_token
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 $will_terminate_token
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 $will_terminate_token # rubocop:disable Lint/NoReturnInBeginEndBlocks
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 $will_terminate_token # rubocop:disable Lint/NoReturnInBeginEndBlocks
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 $will_terminate_token # rubocop:disable Lint/NoReturnInBeginEndBlocks
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 { "direct_connect_switch_via_bluetooth!" }
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
- ProconBypassMan.logger.debug { ">>> #{bypass_value.to_text}" }
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 /forward_ikarole1/ =~ step
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.after_fork_on_bypass_process
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
- handle_signal(signal)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProconBypassMan
4
- VERSION = "0.3.3"
4
+ VERSION = "0.3.4"
5
5
  end
@@ -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.after_fork_on_bypass_process
183
+ def self.run_on_after_fork_of_bypass_process
186
184
  ProconBypassMan::ReniceCommand.change_priority(to: :high, pid: $$)
187
185
  ::GC.start
188
- DRb.start_service if defined?(DRb)
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)
@@ -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
@@ -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.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
@@ -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.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.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-13 00:00:00.000000000 Z
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: '0'
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: '0'
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
@@ -1,8 +0,0 @@
1
- class ProconBypassMan::GC
2
- def self.stop_gc_in(&block)
3
- ::GC.disable
4
- result = block.call
5
- ::GC.enable
6
- return result
7
- end
8
- end
@@ -1,11 +0,0 @@
1
- module ProconBypassMan::SignalHandler
2
- def handle_signal(sig)
3
- ProconBypassMan.logger.info "#{$$}で#{sig}を受け取りました"
4
- case sig
5
- when 'USR2'
6
- raise ProconBypassMan::InterruptForRestart
7
- when 'INT', 'TERM'
8
- raise Interrupt
9
- end
10
- end
11
- end