procon_bypass_man 0.1.20.2 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +9 -5
  3. data/.github/workflows/ruby.yml +1 -1
  4. data/.gitignore +1 -0
  5. data/.rspec +1 -0
  6. data/CHANGELOG.md +30 -1
  7. data/Gemfile.lock +4 -4
  8. data/README.md +4 -1
  9. data/docs/getting_started.md +81 -11
  10. data/docs/setting/left-analogstick-cap.md +1 -1
  11. data/docs/setting/splatoon2_macro_dasei_cancel.md +77 -0
  12. data/docs/setting/splatoon2_macro_sokuwari_bubble.md +4 -0
  13. data/docs/setting/splatoon2_shake_tansan.md +47 -0
  14. data/lib/procon_bypass_man/background/jobs/post_completed_remote_macro_job.rb +17 -0
  15. data/lib/procon_bypass_man/background.rb +1 -0
  16. data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +155 -70
  17. data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +2 -0
  18. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button.rb +28 -0
  19. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list.rb +31 -0
  20. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/disable_macro_if_pressed.rb +28 -0
  21. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/flip_if_pressed.rb +31 -0
  22. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/force_neutral.rb +28 -0
  23. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed.rb +26 -0
  24. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed_allows_nil.rb +28 -0
  25. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/open_macro_steps.rb +26 -0
  26. data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer.rb +17 -0
  27. data/lib/procon_bypass_man/buttons_setting_configuration.rb +6 -5
  28. data/lib/procon_bypass_man/bypass/usb_hid_logger.rb +4 -0
  29. data/lib/procon_bypass_man/bypass.rb +45 -23
  30. data/lib/procon_bypass_man/commands/bypass_command.rb +30 -10
  31. data/lib/procon_bypass_man/commands/print_boot_message_command.rb +1 -1
  32. data/lib/procon_bypass_man/configuration.rb +8 -1
  33. data/lib/procon_bypass_man/device_connector.rb +55 -174
  34. data/lib/procon_bypass_man/plugin/splatoon2/macro/charge_tansan_bomb.rb +21 -0
  35. data/lib/procon_bypass_man/plugin/splatoon2/macro/dasei_cancel.rb +21 -0
  36. data/lib/procon_bypass_man/plugin/splatoon2/version.rb +1 -1
  37. data/lib/procon_bypass_man/plugins.rb +2 -0
  38. data/lib/procon_bypass_man/procon/analog_stick_cap.rb +4 -23
  39. data/lib/procon_bypass_man/procon/analog_stick_manipulator.rb +36 -0
  40. data/lib/procon_bypass_man/procon/button_collection.rb +0 -8
  41. data/lib/procon_bypass_man/procon/layer_changer.rb +4 -1
  42. data/lib/procon_bypass_man/procon/macro.rb +53 -25
  43. data/lib/procon_bypass_man/procon/macro_builder.rb +43 -35
  44. data/lib/procon_bypass_man/procon/macro_plugin_map.rb +23 -0
  45. data/lib/procon_bypass_man/procon/macro_registry.rb +26 -10
  46. data/lib/procon_bypass_man/procon/suppress_rumble.rb +13 -0
  47. data/lib/procon_bypass_man/procon/user_operation.rb +30 -16
  48. data/lib/procon_bypass_man/procon/value_objects/analog_stick.rb +9 -5
  49. data/lib/procon_bypass_man/procon/value_objects/analog_stick_position.rb +18 -0
  50. data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/base.rb +0 -0
  51. data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/has_immutable_binary.rb +0 -0
  52. data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/has_mutable_binary.rb +0 -0
  53. data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/inbound_procon_binary.rb +5 -0
  54. data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/processing_procon_binary.rb +7 -2
  55. data/lib/procon_bypass_man/procon/value_objects/binary.rb +11 -0
  56. data/lib/procon_bypass_man/{bypass → procon/value_objects}/bypass_mode.rb +0 -0
  57. data/lib/procon_bypass_man/procon/value_objects/rumble_binary.rb +18 -0
  58. data/lib/procon_bypass_man/procon.rb +59 -17
  59. data/lib/procon_bypass_man/remote_macro/queue_over_process.rb +62 -0
  60. data/lib/procon_bypass_man/remote_macro/remote_macro_object.rb +30 -0
  61. data/lib/procon_bypass_man/remote_macro/remote_macro_receiver.rb +37 -0
  62. data/lib/procon_bypass_man/remote_macro/remote_macro_sender.rb +8 -0
  63. data/lib/procon_bypass_man/remote_macro/task.rb +6 -0
  64. data/lib/procon_bypass_man/remote_macro/task_queue.rb +13 -0
  65. data/lib/procon_bypass_man/remote_macro.rb +14 -0
  66. data/lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb +1 -1
  67. data/lib/procon_bypass_man/remote_pbm_action.rb +1 -0
  68. data/lib/procon_bypass_man/runner.rb +11 -7
  69. data/lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb +59 -0
  70. data/lib/procon_bypass_man/support/cycle_sleep.rb +22 -0
  71. data/lib/procon_bypass_man/support/device_mouse_finder.rb +60 -0
  72. data/lib/procon_bypass_man/{device_procon_finder.rb → support/device_procon_finder.rb} +0 -2
  73. data/lib/procon_bypass_man/{never_exit_accidentally.rb → support/never_exit_accidentally.rb} +0 -0
  74. data/lib/procon_bypass_man/support/remote_macro_http_client.rb +9 -0
  75. data/lib/procon_bypass_man/support/safe_timeout.rb +7 -1
  76. data/lib/procon_bypass_man/{usb_device_controller.rb → support/usb_device_controller.rb} +7 -4
  77. data/lib/procon_bypass_man/version.rb +1 -1
  78. data/lib/procon_bypass_man/websocket/{pbm_job_client.rb → client.rb} +34 -12
  79. data/lib/procon_bypass_man/websocket/forever.rb +47 -0
  80. data/lib/procon_bypass_man/websocket/watchdog.rb +19 -0
  81. data/lib/procon_bypass_man.rb +25 -23
  82. data/procon_bypass_man.gemspec +1 -1
  83. data/project_template/app.rb +13 -4
  84. data/sig/main.rbs +21 -13
  85. metadata +46 -14
  86. data/lib/procon_bypass_man/domains.rb +0 -11
@@ -1,18 +1,13 @@
1
1
  module ProconBypassMan
2
2
  module Websocket
3
- module PbmJobClient
3
+ module Client
4
4
  CHANNEL = 'PbmJobChannel'
5
5
 
6
6
  def self.start!
7
7
  return unless ProconBypassMan.config.enable_ws?
8
8
 
9
9
  Thread.start do
10
- loop do
11
- run
12
- rescue => e
13
- ProconBypassMan.logger.error("websocket client: #{e.full_message}")
14
- retry
15
- end
10
+ Forever.run { run }
16
11
  end
17
12
  end
18
13
 
@@ -25,7 +20,7 @@ module ProconBypassMan
25
20
  )
26
21
 
27
22
  client.connected {
28
- ProconBypassMan.logger.info('websocket client: successfully connected in ProconBypassMan::Websocket::PbmJobClient')
23
+ ProconBypassMan.logger.info('websocket client: successfully connected in ProconBypassMan::Websocket::Client')
29
24
  }
30
25
  client.subscribed { |msg|
31
26
  ProconBypassMan.logger.info('websocket client: subscribed')
@@ -55,6 +50,8 @@ module ProconBypassMan
55
50
  sleep 2
56
51
  }
57
52
  client.pinged { |msg|
53
+ Watchdog.active!
54
+
58
55
  ProconBypassMan.cache.fetch key: 'ws_pinged', expires_in: 10 do
59
56
  ProconBypassMan.logger.info('websocket client: pinged!!')
60
57
  ProconBypassMan.logger.info(msg)
@@ -66,17 +63,22 @@ module ProconBypassMan
66
63
  # @param [Hash] data
67
64
  def self.dispatch(data: , client: )
68
65
  pbm_job_hash = data.dig("message")
69
- if pbm_job_hash['action'] == "ping"
66
+ case pbm_job_hash['action']
67
+ when "ping"
70
68
  client.perform('pong', { device_id: ProconBypassMan.device_id, message: 'hello from pbm' })
69
+ when ProconBypassMan::RemoteMacro::ACTION_KEY
70
+ validate_and_run_remote_macro(data: data)
71
+ when *ProconBypassMan::RemotePbmAction::ACTIONS
72
+ validate_and_run_remote_pbm_action(data: data)
71
73
  else
72
- validate_and_run(data: data)
74
+ ProconBypassMan.logger.error "unknown action"
73
75
  end
74
76
  end
75
77
 
76
78
  # @raise [ProconBypassMan::RemotePbmActionObject::ValidationError]
77
79
  # @param [Hash] data
78
80
  # @return [Void]
79
- def self.validate_and_run(data: )
81
+ def self.validate_and_run_remote_pbm_action(data: )
80
82
  pbm_job_hash = data.dig("message")
81
83
  begin
82
84
  pbm_job_object = ProconBypassMan::RemotePbmActionObject.new(action: pbm_job_hash["action"],
@@ -86,7 +88,8 @@ module ProconBypassMan
86
88
  job_args: pbm_job_hash["args"])
87
89
  pbm_job_object.validate!
88
90
  rescue ProconBypassMan::RemotePbmActionObject::ValidationError => e
89
- raise
91
+ ProconBypassMan::SendErrorCommand.execute(error: e)
92
+ return
90
93
  end
91
94
 
92
95
  ProconBypassMan::RunRemotePbmActionDispatchCommand.execute(
@@ -95,6 +98,25 @@ module ProconBypassMan
95
98
  job_args: pbm_job_object.job_args
96
99
  )
97
100
  end
101
+
102
+ def self.validate_and_run_remote_macro(data: )
103
+ pbm_job_hash = data.dig("message")
104
+ begin
105
+ remote_macro_object = ProconBypassMan::RemoteMacroObject.new(name: pbm_job_hash["name"],
106
+ uuid: pbm_job_hash["uuid"],
107
+ steps: pbm_job_hash["steps"])
108
+ remote_macro_object.validate!
109
+ rescue ProconBypassMan::RemoteMacroObject::ValidationError => e
110
+ ProconBypassMan::SendErrorCommand.execute(error: e)
111
+ return
112
+ end
113
+
114
+ ProconBypassMan::RemoteMacroSender.execute(
115
+ name: remote_macro_object.name,
116
+ uuid: remote_macro_object.uuid,
117
+ steps: remote_macro_object.steps,
118
+ )
119
+ end
98
120
  end
99
121
  end
100
122
  end
@@ -0,0 +1,47 @@
1
+ module ProconBypassMan
2
+ module Websocket
3
+ class Forever
4
+ # 動作確認方法
5
+ # - 10秒ごとにrefreshするのでタイムアウトは起きない
6
+ # - ProconBypassMan::Websocket::Forever.run { loop { puts(:hi); sleep(10); ProconBypassMan::Websocket::Watchdog.active! } }
7
+ # - タイムアウトが起きること
8
+ # - ProconBypassMan::Websocket::Forever.run { puts(:hi); sleep(3000); }
9
+ # - ブロックを1回評価するとThreadが死ぬので100秒後にタイムアウトが起きること
10
+ # - ProconBypassMan::Websocket::Forever.run { puts(:hi); sleep(10); ProconBypassMan::Websocket::Watchdog.active! }
11
+ def self.run(&block)
12
+ loop do
13
+ new.run(&block)
14
+ end
15
+ end
16
+
17
+ def run(&block)
18
+ raise("need a block") unless block_given?
19
+
20
+ ws_thread = work_one(callable: block)
21
+ wait_and_kill_if_outdated(ws_thread)
22
+ end
23
+
24
+ # @return [Thread]
25
+ def work_one(callable: )
26
+ Thread.start do
27
+ callable.call
28
+ rescue => e
29
+ ProconBypassMan.logger.error("websocket client with forever: #{e.full_message}")
30
+ end
31
+ end
32
+
33
+ def wait_and_kill_if_outdated(thread)
34
+ loop do
35
+ if Watchdog.outdated?
36
+ Watchdog.active!
37
+ ProconBypassMan.logger.error("watchdog timeout!!")
38
+ thread.kill
39
+ return
40
+ end
41
+
42
+ sleep(10)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,19 @@
1
+ module ProconBypassMan
2
+ module Websocket
3
+ class Watchdog
4
+ def self.outdated?
5
+ @@time < Time.now
6
+ end
7
+
8
+ def self.time
9
+ @@time
10
+ end
11
+
12
+ def self.active!
13
+ @@time = Time.now + 100
14
+ end
15
+
16
+ active!
17
+ end
18
+ end
19
+ end
@@ -13,6 +13,10 @@ require "pbmenv"
13
13
 
14
14
  require_relative "procon_bypass_man/version"
15
15
  require_relative "procon_bypass_man/remote_pbm_action"
16
+ require_relative "procon_bypass_man/remote_macro"
17
+ require_relative "procon_bypass_man/support/usb_device_controller"
18
+ require_relative "procon_bypass_man/support/device_procon_finder"
19
+ require_relative "procon_bypass_man/support/device_mouse_finder"
16
20
  require_relative "procon_bypass_man/support/signal_handler"
17
21
  require_relative "procon_bypass_man/support/callbacks"
18
22
  require_relative "procon_bypass_man/support/yaml_writer"
@@ -22,31 +26,32 @@ require_relative "procon_bypass_man/support/uptime"
22
26
  require_relative "procon_bypass_man/support/on_memory_cache"
23
27
  require_relative "procon_bypass_man/support/http_client"
24
28
  require_relative "procon_bypass_man/support/report_http_client"
29
+ require_relative "procon_bypass_man/support/remote_macro_http_client"
25
30
  require_relative "procon_bypass_man/support/update_remote_pbm_action_status_http_client"
26
31
  require_relative "procon_bypass_man/support/send_device_stats_http_client"
27
32
  require_relative "procon_bypass_man/support/server_pool"
33
+ require_relative "procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler"
34
+ require_relative "procon_bypass_man/support/never_exit_accidentally"
35
+ require_relative "procon_bypass_man/support/cycle_sleep"
28
36
  require_relative "procon_bypass_man/background"
29
37
  require_relative "procon_bypass_man/commands"
30
38
  require_relative "procon_bypass_man/bypass"
31
- require_relative "procon_bypass_man/domains"
32
- require_relative "procon_bypass_man/never_exit_accidentally"
33
39
  require_relative "procon_bypass_man/device_connector"
34
- require_relative "procon_bypass_man/device_procon_finder"
35
40
  require_relative "procon_bypass_man/device_status"
36
- require_relative "procon_bypass_man/usb_device_controller"
37
41
  require_relative "procon_bypass_man/runner"
38
42
  require_relative "procon_bypass_man/processor"
39
43
  require_relative "procon_bypass_man/configuration"
40
44
  require_relative "procon_bypass_man/buttons_setting_configuration"
41
45
  require_relative "procon_bypass_man/procon"
42
46
  require_relative "procon_bypass_man/procon/button"
43
- require_relative "procon_bypass_man/procon/value_objects/analog_stick"
44
- require_relative "procon_bypass_man/procon/value_objects/procon_reader"
45
47
  require_relative "procon_bypass_man/procon/analog_stick_cap"
48
+ require_relative "procon_bypass_man/procon/analog_stick_manipulator"
46
49
  require_relative "procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object"
47
50
  require_relative "procon_bypass_man/scheduler"
48
51
  require_relative "procon_bypass_man/plugins"
49
- require_relative "procon_bypass_man/websocket/pbm_job_client"
52
+ require_relative "procon_bypass_man/websocket/client"
53
+ require_relative "procon_bypass_man/websocket/watchdog"
54
+ require_relative "procon_bypass_man/websocket/forever"
50
55
 
51
56
  STDOUT.sync = true
52
57
  Thread.abort_on_exception = true
@@ -56,15 +61,14 @@ module ProconBypassMan
56
61
  extend ProconBypassMan::NeverExitAccidentally
57
62
 
58
63
  class CouldNotLoadConfigError < StandardError; end
59
- class ConnectionError < StandardError; end
60
- class FirstConnectionError < ConnectionError; end
61
- class EternalConnectionError < ConnectionError; end
64
+ class EternalConnectionError < StandardError; end
62
65
 
63
66
  # @return [void]
64
67
  def self.run(setting_path: nil)
65
68
  ProconBypassMan::Scheduler.start!
66
69
  ProconBypassMan::Background::JobRunner.start!
67
- ProconBypassMan::Websocket::PbmJobClient.start!
70
+ ProconBypassMan::Websocket::Client.start!
71
+ ProconBypassMan::QueueOverProcess.start!
68
72
 
69
73
  ProconBypassMan::PrintMessageCommand.execute(text: "PBMを起動しています")
70
74
  initialize_pbm
@@ -73,32 +77,30 @@ module ProconBypassMan
73
77
  Runner.new(gadget: gadget, procon: procon).run # ここでblockingする
74
78
  FileUtils.rm_rf(ProconBypassMan.pid_path)
75
79
  FileUtils.rm_rf(ProconBypassMan.digest_path)
80
+ ProconBypassMan::QueueOverProcess.shutdown
76
81
  rescue ProconBypassMan::CouldNotLoadConfigError
77
82
  ProconBypassMan::SendErrorCommand.execute(error: "設定ファイルが不正です。設定ファイルの読み込みに失敗しました")
78
83
  ProconBypassMan::DeviceStatus.change_to_setting_syntax_error_and_shutdown!
84
+ # TODO シグナルトラップをしていないのでUSR2を送ったときにプロセスが停止している. 明示的にハンドリングするべき.
79
85
  ProconBypassMan.exit_if_allow(1) do
80
86
  FileUtils.rm_rf(ProconBypassMan.pid_path)
81
87
  FileUtils.rm_rf(ProconBypassMan.digest_path)
88
+ ProconBypassMan::QueueOverProcess.shutdown
82
89
  end
83
90
  rescue ProconBypassMan::ConnectDeviceCommand::NotFoundProconError
84
91
  ProconBypassMan::SendErrorCommand.execute(error: "プロコンが見つかりませんでした。")
85
92
  ProconBypassMan::DeviceStatus.change_to_procon_not_found_error!
93
+ # TODO シグナルトラップをしていないのでUSR2を送ったときにプロセスが停止している. 明示的にハンドリングするべき.
86
94
  ProconBypassMan.exit_if_allow(1) do
87
95
  FileUtils.rm_rf(ProconBypassMan.pid_path)
88
96
  FileUtils.rm_rf(ProconBypassMan.digest_path)
97
+ ProconBypassMan::QueueOverProcess.shutdown
89
98
  end
90
- rescue ProconBypassMan::ConnectionError
91
- begin
92
- raise
93
- rescue ProconBypassMan::EternalConnectionError
94
- ProconBypassMan::SendErrorCommand.execute(error: "接続の見込みがないのでsleepしまくります")
95
- ProconBypassMan::DeviceStatus.change_to_connected_but_sleeping!
96
- FileUtils.rm_rf(ProconBypassMan.pid_path)
97
- eternal_sleep
98
- rescue ProconBypassMan::FirstConnectionError
99
- ProconBypassMan::SendErrorCommand.execute(error: "接続を確立できませんでした。やりなおします。")
100
- retry
101
- end
99
+ rescue ProconBypassMan::EternalConnectionError
100
+ ProconBypassMan::SendErrorCommand.execute(error: "接続の見込みがないのでsleepしまくります")
101
+ ProconBypassMan::DeviceStatus.change_to_connected_but_sleeping!
102
+ FileUtils.rm_rf(ProconBypassMan.pid_path)
103
+ eternal_sleep
102
104
  end
103
105
 
104
106
  def self.configure(&block)
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = spec.summary
13
13
  spec.homepage = "https://github.com/splaplapla/procon_bypass_man"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
@@ -2,10 +2,19 @@
2
2
 
3
3
  require 'bundler/inline'
4
4
 
5
- gemfile do
6
- source 'https://rubygems.org'
7
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
8
- gem 'procon_bypass_man', '0.1.20.2'
5
+ begin
6
+ gemfile do
7
+ source 'https://rubygems.org'
8
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
9
+ gem 'procon_bypass_man', '0.1.23'
10
+ end
11
+ rescue Bundler::Source::Git::GitCommandError => e
12
+ # install中に強制終了するとgitの管理ファイルが不正状態になり、次のエラーが起きるので発生したらcache directoryを削除する
13
+ #"Git error: command `git fetch --force --quiet --tags https://github.com/splaplapla/procon_bypass_man refs/heads/\\*:refs/heads/\\*` in directory /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/cache/bundler/git/procon_bypass_man-ae4c9016d76b667658c8ba66f3bbd2eebf2656af has failed.\n\nIf this error persists you could try removing the cache directory '/home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/cache/bundler/git/procon_bypass_man-ae4c9016d76b667658c8ba66f3bbd2eebf2656af'"
14
+ if /try removing the cache directory '([^']+)'/ =~ e.message
15
+ FileUtils.rm_rf($1)
16
+ retry
17
+ end
9
18
  end
10
19
 
11
20
  ProconBypassMan.configure do |config|
data/sig/main.rbs CHANGED
@@ -11,9 +11,6 @@ module ProconBypassMan
11
11
  class CouldNotLoadConfigError < StandardError
12
12
  end
13
13
 
14
- class FirstConnectionError < StandardError
15
- end
16
-
17
14
  class EternalConnectionError < StandardError
18
15
  end
19
16
 
@@ -255,21 +252,12 @@ class ProconBypassMan::DeviceConnector
255
252
 
256
253
  def self.connect: () -> ::Array[untyped]
257
254
 
258
- def initialize: (?throw_error_if_timeout: bool throw_error_if_timeout, ?throw_error_if_mismatch: bool throw_error_if_mismatch, ?enable_at_exit: bool enable_at_exit) -> untyped
255
+ def initialize: (?throw_error_if_timeout: bool throw_error_if_timeout, ?throw_error_if_mismatch: bool throw_error_if_mismatch) -> untyped
259
256
 
260
257
  def add: (untyped values, read_from: untyped read_from) -> untyped
261
258
 
262
259
  def drain_all: () -> untyped
263
260
 
264
- # switchに任意の命令を入力して、switchから読み取る
265
- def write_switch: (untyped data, ?only_write: bool only_write) -> untyped
266
-
267
- def write_procon: (untyped data, ?only_write: bool only_write) -> untyped
268
-
269
- def read_procon: (?only_read: bool only_read) -> untyped
270
-
271
- def read_switch: (?only_read: bool only_read) -> untyped
272
-
273
261
  def from_device: (untyped item) -> untyped
274
262
 
275
263
  # fromの対になる
@@ -531,6 +519,26 @@ module ProconBypassMan
531
519
  end
532
520
  end
533
521
 
522
+ class ProconBypassMan::BypassMode
523
+ TYPE_NORMAL: ::Symbol
524
+
525
+ TYPE_AGGRESSIVE: ::Symbol
526
+
527
+ TYPES: ::Array[::Symbol]
528
+
529
+ DEFAULT_GADGET_TO_PROCON_INTERVAL: ::Float
530
+
531
+ attr_accessor mode: ::Symbol
532
+
533
+ attr_accessor gadget_to_procon_interval: ::Float
534
+
535
+ def self.default_value: () -> ::ProconBypassMan::BypassMode
536
+
537
+ def initialize: (mode: ::Symbol mode, gadget_to_procon_interval: ::Float gadget_to_procon_interval) -> void
538
+
539
+ def to_s: () -> ::String
540
+ end
541
+
534
542
  class ProconBypassMan::Domains::Binary::Base
535
543
  # @param [String] binary
536
544
  def initialize: (binary: untyped binary) -> void
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.1.20.2
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-19 00:00:00.000000000 Z
11
+ date: 2022-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pbmenv
@@ -79,8 +79,10 @@ files:
79
79
  - docs/getting_started.md
80
80
  - docs/how_to_connect_procon.md
81
81
  - docs/setting/left-analogstick-cap.md
82
+ - docs/setting/splatoon2_macro_dasei_cancel.md
82
83
  - docs/setting/splatoon2_macro_sokuwari_bubble.md
83
84
  - docs/setting/splatoon2_recommended_setting.md
85
+ - docs/setting/splatoon2_shake_tansan.md
84
86
  - docs/setup_raspi.md
85
87
  - docs/setup_raspi.mitamae.rb
86
88
  - docs/setup_raspi_by_mitamae.md
@@ -95,6 +97,7 @@ files:
95
97
  - lib/procon_bypass_man/background/jobs/concerns/has_external_api_setting.rb
96
98
  - lib/procon_bypass_man/background/jobs/concerns/has_internal_api_setting.rb
97
99
  - lib/procon_bypass_man/background/jobs/concerns/job_runnable.rb
100
+ - lib/procon_bypass_man/background/jobs/post_completed_remote_macro_job.rb
98
101
  - lib/procon_bypass_man/background/jobs/report_boot_job.rb
99
102
  - lib/procon_bypass_man/background/jobs/report_completed_upgrade_pbm_job.rb
100
103
  - lib/procon_bypass_man/background/jobs/report_error_job.rb
@@ -108,9 +111,17 @@ files:
108
111
  - lib/procon_bypass_man/buttons_setting_configuration.rb
109
112
  - lib/procon_bypass_man/buttons_setting_configuration/layer.rb
110
113
  - lib/procon_bypass_man/buttons_setting_configuration/loader.rb
114
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer.rb
115
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button.rb
116
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list.rb
117
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/disable_macro_if_pressed.rb
118
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/flip_if_pressed.rb
119
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/force_neutral.rb
120
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed.rb
121
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed_allows_nil.rb
122
+ - lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/open_macro_steps.rb
111
123
  - lib/procon_bypass_man/buttons_setting_configuration/validator.rb
112
124
  - lib/procon_bypass_man/bypass.rb
113
- - lib/procon_bypass_man/bypass/bypass_mode.rb
114
125
  - lib/procon_bypass_man/bypass/usb_hid_logger.rb
115
126
  - lib/procon_bypass_man/commands.rb
116
127
  - lib/procon_bypass_man/commands/bypass_command.rb
@@ -124,16 +135,10 @@ files:
124
135
  - lib/procon_bypass_man/commands/write_session_id_command.rb
125
136
  - lib/procon_bypass_man/configuration.rb
126
137
  - lib/procon_bypass_man/device_connector.rb
127
- - lib/procon_bypass_man/device_procon_finder.rb
128
138
  - lib/procon_bypass_man/device_status.rb
129
- - lib/procon_bypass_man/domains.rb
130
- - lib/procon_bypass_man/domains/binary/base.rb
131
- - lib/procon_bypass_man/domains/binary/has_immutable_binary.rb
132
- - lib/procon_bypass_man/domains/binary/has_mutable_binary.rb
133
- - lib/procon_bypass_man/domains/binary/inbound_procon_binary.rb
134
- - lib/procon_bypass_man/domains/binary/processing_procon_binary.rb
135
139
  - lib/procon_bypass_man/io_monitor.rb
136
- - lib/procon_bypass_man/never_exit_accidentally.rb
140
+ - lib/procon_bypass_man/plugin/splatoon2/macro/charge_tansan_bomb.rb
141
+ - lib/procon_bypass_man/plugin/splatoon2/macro/dasei_cancel.rb
137
142
  - lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb
138
143
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
139
144
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb
@@ -145,6 +150,7 @@ files:
145
150
  - lib/procon_bypass_man/processor.rb
146
151
  - lib/procon_bypass_man/procon.rb
147
152
  - lib/procon_bypass_man/procon/analog_stick_cap.rb
153
+ - lib/procon_bypass_man/procon/analog_stick_manipulator.rb
148
154
  - lib/procon_bypass_man/procon/button.rb
149
155
  - lib/procon_bypass_man/procon/button_collection.rb
150
156
  - lib/procon_bypass_man/procon/consts.rb
@@ -152,12 +158,30 @@ files:
152
158
  - lib/procon_bypass_man/procon/layer_changer.rb
153
159
  - lib/procon_bypass_man/procon/macro.rb
154
160
  - lib/procon_bypass_man/procon/macro_builder.rb
161
+ - lib/procon_bypass_man/procon/macro_plugin_map.rb
155
162
  - lib/procon_bypass_man/procon/macro_registry.rb
156
163
  - lib/procon_bypass_man/procon/mode_registry.rb
157
164
  - lib/procon_bypass_man/procon/press_button_aware.rb
165
+ - lib/procon_bypass_man/procon/suppress_rumble.rb
158
166
  - lib/procon_bypass_man/procon/user_operation.rb
159
167
  - lib/procon_bypass_man/procon/value_objects/analog_stick.rb
168
+ - lib/procon_bypass_man/procon/value_objects/analog_stick_position.rb
169
+ - lib/procon_bypass_man/procon/value_objects/binary.rb
170
+ - lib/procon_bypass_man/procon/value_objects/binary/base.rb
171
+ - lib/procon_bypass_man/procon/value_objects/binary/has_immutable_binary.rb
172
+ - lib/procon_bypass_man/procon/value_objects/binary/has_mutable_binary.rb
173
+ - lib/procon_bypass_man/procon/value_objects/binary/inbound_procon_binary.rb
174
+ - lib/procon_bypass_man/procon/value_objects/binary/processing_procon_binary.rb
175
+ - lib/procon_bypass_man/procon/value_objects/bypass_mode.rb
160
176
  - lib/procon_bypass_man/procon/value_objects/procon_reader.rb
177
+ - lib/procon_bypass_man/procon/value_objects/rumble_binary.rb
178
+ - lib/procon_bypass_man/remote_macro.rb
179
+ - lib/procon_bypass_man/remote_macro/queue_over_process.rb
180
+ - lib/procon_bypass_man/remote_macro/remote_macro_object.rb
181
+ - lib/procon_bypass_man/remote_macro/remote_macro_receiver.rb
182
+ - lib/procon_bypass_man/remote_macro/remote_macro_sender.rb
183
+ - lib/procon_bypass_man/remote_macro/task.rb
184
+ - lib/procon_bypass_man/remote_macro/task_queue.rb
161
185
  - lib/procon_bypass_man/remote_pbm_action.rb
162
186
  - lib/procon_bypass_man/remote_pbm_action/base_action.rb
163
187
  - lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb
@@ -168,10 +192,16 @@ files:
168
192
  - lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb
169
193
  - lib/procon_bypass_man/runner.rb
170
194
  - lib/procon_bypass_man/scheduler.rb
195
+ - lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
171
196
  - lib/procon_bypass_man/support/callbacks.rb
172
197
  - lib/procon_bypass_man/support/compress_array.rb
198
+ - lib/procon_bypass_man/support/cycle_sleep.rb
199
+ - lib/procon_bypass_man/support/device_mouse_finder.rb
200
+ - lib/procon_bypass_man/support/device_procon_finder.rb
173
201
  - lib/procon_bypass_man/support/http_client.rb
202
+ - lib/procon_bypass_man/support/never_exit_accidentally.rb
174
203
  - lib/procon_bypass_man/support/on_memory_cache.rb
204
+ - lib/procon_bypass_man/support/remote_macro_http_client.rb
175
205
  - lib/procon_bypass_man/support/report_http_client.rb
176
206
  - lib/procon_bypass_man/support/safe_timeout.rb
177
207
  - lib/procon_bypass_man/support/send_device_stats_http_client.rb
@@ -179,10 +209,12 @@ files:
179
209
  - lib/procon_bypass_man/support/signal_handler.rb
180
210
  - lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb
181
211
  - lib/procon_bypass_man/support/uptime.rb
212
+ - lib/procon_bypass_man/support/usb_device_controller.rb
182
213
  - lib/procon_bypass_man/support/yaml_writer.rb
183
- - lib/procon_bypass_man/usb_device_controller.rb
184
214
  - lib/procon_bypass_man/version.rb
185
- - lib/procon_bypass_man/websocket/pbm_job_client.rb
215
+ - lib/procon_bypass_man/websocket/client.rb
216
+ - lib/procon_bypass_man/websocket/forever.rb
217
+ - lib/procon_bypass_man/websocket/watchdog.rb
186
218
  - procon_bypass_man.gemspec
187
219
  - project_template/README.md
188
220
  - project_template/app.rb
@@ -208,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
240
  requirements:
209
241
  - - ">="
210
242
  - !ruby/object:Gem::Version
211
- version: 2.4.0
243
+ version: 3.0.0
212
244
  required_rubygems_version: !ruby/object:Gem::Requirement
213
245
  requirements:
214
246
  - - ">="
@@ -1,11 +0,0 @@
1
- module ProconBypassMan
2
- module Domains
3
- module Binary; end
4
- end
5
- end
6
-
7
- require_relative "domains/binary/base"
8
- require_relative "domains/binary/has_mutable_binary"
9
- require_relative "domains/binary/has_immutable_binary"
10
- require_relative "domains/binary/inbound_procon_binary"
11
- require_relative "domains/binary/processing_procon_binary"