procon_bypass_man 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +1 -1
  5. data/docs/setting/splatoon2_macro_forward_ikarole.md +3 -0
  6. data/docs/setting/splatoon3_macro_forward_ikarole.md +34 -0
  7. data/docs/setting/splatoon3_recommended_setting.md +136 -0
  8. data/docs/setup_raspi.md +12 -15
  9. data/lib/procon_bypass_man/background/jobs/base_job.rb +3 -2
  10. data/lib/procon_bypass_man/background/jobs/post_completed_remote_macro_job.rb +4 -0
  11. data/lib/procon_bypass_man/background.rb +0 -1
  12. data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +1 -0
  13. data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +2 -1
  14. data/lib/procon_bypass_man/buttons_setting_configuration.rb +11 -0
  15. data/lib/procon_bypass_man/bypass/bypass_command.rb +1 -1
  16. data/lib/procon_bypass_man/bypass/procon_to_switch.rb +13 -2
  17. data/lib/procon_bypass_man/configuration.rb +1 -0
  18. data/lib/procon_bypass_man/device_connection/procon_setting_overrider.rb +0 -3
  19. data/lib/procon_bypass_man/ephemeral_configuration.rb +9 -0
  20. data/lib/procon_bypass_man/plugin/splatoon2/macro/{dasei_cancel.rb → forward_ikarole.rb} +4 -4
  21. data/lib/procon_bypass_man/plugin/splatoon3/macro/charge_tansan_bomb.rb +21 -0
  22. data/lib/procon_bypass_man/plugin/splatoon3/macro/fast_return.rb +21 -0
  23. data/lib/procon_bypass_man/plugin/splatoon3/macro/forward_ikarole.rb +21 -0
  24. data/lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_left_key.rb +21 -0
  25. data/lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_right_key.rb +21 -0
  26. data/lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_up_key.rb +21 -0
  27. data/lib/procon_bypass_man/plugin/splatoon3/macro/sokuwari_for_splash_bomb.rb +26 -0
  28. data/lib/procon_bypass_man/plugin/splatoon3/mode/guruguru.rb +63 -0
  29. data/lib/procon_bypass_man/plugin/splatoon3/version.rb +9 -0
  30. data/lib/procon_bypass_man/plugins.rb +11 -1
  31. data/lib/procon_bypass_man/procon/analog_stick_manipulator.rb +16 -4
  32. data/lib/procon_bypass_man/procon/macro_builder.rb +11 -0
  33. data/lib/procon_bypass_man/procon/performance_measurement.rb +1 -1
  34. data/lib/procon_bypass_man/procon/rumbler.rb +18 -0
  35. data/lib/procon_bypass_man/procon/user_operation.rb +1 -1
  36. data/lib/procon_bypass_man/procon.rb +5 -13
  37. data/lib/procon_bypass_man/runner.rb +0 -1
  38. data/lib/procon_bypass_man/support/http_client.rb +3 -2
  39. data/lib/procon_bypass_man/support/remote_macro_http_client.rb +4 -0
  40. data/lib/procon_bypass_man/version.rb +1 -1
  41. data/lib/procon_bypass_man/worker.rb +16 -8
  42. data/lib/procon_bypass_man.rb +6 -1
  43. data/project_template/app.rb +1 -1
  44. data/project_template/app.rb.erb +1 -1
  45. data/project_template/setting.yml +3 -0
  46. metadata +17 -6
  47. data/docs/setting/splatoon2_macro_dasei_cancel.md +0 -77
  48. data/lib/procon_bypass_man/background/job_performer.rb +0 -15
  49. data/lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb +0 -59
@@ -0,0 +1,63 @@
1
+ module ProconBypassMan
2
+ module Plugin
3
+ module Splatoon3
4
+ module Mode
5
+ module Guruguru
6
+ def self.description
7
+ '適当に動きます'
8
+ end
9
+
10
+ def self.binaries
11
+ [ "309481408000362d684658750968f71cfe2c0e51000001480053f71ffedf0d4b000a013d00caf6ecfd4c0d480003011c00000000000000000000000000000000",
12
+ "30978140800037dd6748687509fdf6adfded0d6d0081005d00eef68dfdef0d6d00830059001bf791fd140e720090005400000000000000000000000000000000",
13
+ "309a8140800038cd67495875099af821fe120e40006400880042f8fcfdfd0d470067008900d4f7e0fdf20d4e006a008c00000000000000000000000000000000",
14
+ "309c8140800036ed67466875099bf878fe4a0e35005b004c00c1f875fe400e35005d004c00c4f856fe2d0e390063006c00000000000000000000000000000000",
15
+ "30a081408000371d6847587509b9f71bfee70d22002c002300e3f73afe150e2b003500280014f854fe300e2d0038002900000000000000000000000000000000",
16
+ "30a38140800039fd6743587509def70ffea10d1a0031001f00d1f70ffeb10d19002c002200c5f711feb80d18002c002500000000000000000000000000000000",
17
+ "30a58140800037dd6746687509d8f70bfe980d270035001200ddf70dfe980d240038001900dff70ffe9b0d1f0035001a00000000000000000000000000000000",
18
+ "30a98140800037ed67484875099cf7edfdb00d310020000d009ef7eefda30d310022000c00adf7f2fd980d300028000a00000000000000000000000000000000",
19
+ "30ac8140800036ed67484875099cf709fed40d3a002400160097f7fafdd30d39002200150096f7f0fdc80d380022001400000000000000000000000000000000",
20
+ "30ae8140800038fd674558750987f72efed40d360021001c0089f729fed50d39002400180092f715fed10d390022001800000000000000000000000000000000",
21
+ "30b18140800037dd6747487509b8f705fea90d19001d002000c5f70dfeb00d210019002200bff71efec20d280018002400000000000000000000000000000000",
22
+ "30b48140800038fd684868750980f7e9fdd40d0200080024007df7f1fdba0d060011001e0084f7f8fdaa0d12001a001a00000000000000000000000000000000",
23
+ "30b7814080003fdd694958750918f6a9fd510f0d00d1ff370024f7b0fda90e0100ecff30006cf7d1fd210efffff5ff2c00000000000000000000000000000000",
24
+ "30ba81408080482d744768750963f71ffe190f5e00d9fea100ccf62dfe650f510009ff980015f702fe580f4b002eff8400000000000000000000000000000000",
25
+ "30bd814080802f7d864758750974f70efe4c0f5e00c0fea000d1f726fe1c0f5d00c5fea30028f859fe0e0f5c00cafea800000000000000000000000000000000",
26
+ "30bf8140808057cc984758750961f73afe630f99009dfeae0050f738fe710f7500adfea40050f721fe720f6e00b2fea300000000000000000000000000000000",
27
+ "30c281408080f479bd483875092ef8b6feab0f0a0180feba00f1f798fe900f000181febd00c2f77dfe7c0fdb008efebd00000000000000000000000000000000",
28
+ "30c581408080ad87d846487509e1f80000a6107e0178fea2004ef88dff54106c0185fea70063f826ffe60f520182feae00000000000000000000000000000000",
29
+ "30c8810080800797d84868750995f8e1fe4b0f7a0161fe88000df96dffd00f700149fe990035f9cdff361088016afea000000000000000000000000000000000",
30
+ "30cb810080804586d848487509cef672fe8a0f6d0217ff42002df63cfe280f1d0219ff410059f61cfe070fed01f5fe4a00000000000000000000000000000000",
31
+ "30d08100808002c5d745687509d8f5aaff830f5e03e6fe3e01fbf55bffc30f3f03e4fe100158f600ff3e102903e5fee700000000000000000000000000000000",
32
+ "30d3810080807b94d14838750991f6cd00690f9903f0fff10147f6e200560f7e038fffc60101f6c900560f71033bffa901000000000000000000000000000000",
33
+ "30d681008080b743ca475875095af7f2009c0fca03a400320242f7ca00950fb503820028020af7b000820fa4034e001a02000000000000000000000000000000",
34
+ "30d9810080805be3c047587509e7f77a03c70f0e04bb00410258f79801940f0004b800410251f74401910fd803b3003602000000000000000000000000000000",
35
+ "30dc810080808a02b245587509c0fbd5086a10710475020a03b0fb8d085d106c042102e8027efb660876106a04bc01af02000000000000000000000000000000",
36
+ "30de8100808036d2a14568750970fbbf09ad103704af038003a9fb600989105c0459036103c2fb2a097210690412034603000000000000000000000000000000",
37
+ "30e281008000cbb18d4738750989f8b40b2812380341044c0429f99e0bef11510340043704f2f93c0b7911b0033704f003000000000000000000000000000000",
38
+ "30e581008000c9c18945587509a5f7ca0a2e13e400c6024c0547f7fd0a941264011703270578f74a0b6012e40168030205000000000000000000000000000000",
39
+ "30e781008000c6618948687509acf86909e813d0fe2801a1057cf8cf09ed130fff6301990516f8710aaa13ccff13028205000000000000000000000000000000",
40
+ "30ea81008000c77189475875093af93b0762136efbaeff19060cf90107b113a9fb99ff0906e1f85b07b113bafc9fffcd05000000000000000000000000000000",
41
+ "30ed81008000c791894568750950f9ce047c1432f900026007a5f9a6051f146ef9bb013707bff99206a813fef9ce00c606000000000000000000000000000000",
42
+ "30ef81008000c6d1894558750944f8ad0358143ef81c02f10780f8b403841484f84102d107ccf801049314bcf84202ad07000000000000000000000000000000",
43
+ "30f381008000c761884868750914f72105e4134cf6d001c00743f71a05f11391f6bf01e407a0f7c904fa13faf6b3011008000000000000000000000000000000",
44
+ "30f681008000c7718344587509eaf54a04c812a6f40002500627f66d041313f2f40d02940682f6a60468133ef51a02d806000000000000000000000000000000",
45
+ "30f881008000c4e1814668750b5cf5f803b51125f3b5000d0560f50f04e8118cf33c015d057df525042c1210f4b101cc05000000000000000000000000000000",
46
+ "30fb81008000c5e1814458750b19f65a02a410acf29effb804e2f5db02df10b7f2c0ffbf04a9f55c032011dcf22400d804000000000000000000000000000000",
47
+ "30fe8100800035e2814858750b81f65c00f80f8df231fe940471f6e6001f1088f2a6fe92044ef6b1015a1092f21fffa004000000000000000000000000000000",
48
+ "3001810080004b03814868750b69f6e6fdad0ffef20efdd40479f678feb40fd9f249fdc40484f6f4fec00fb0f29ffdad04000000000000000000000000000000",
49
+ "30048100800079e47d4858750b17f64cfb5f0f46f46afb430529f6c4fb710ff1f3d4fb300538f64bfc830fbbf315fc1d05000000000000000000000000000000",
50
+ "300781008000a7057e4668750bb1f5d3f9fb0e8ef5ccf96405cdf5fcf90c0f44f52dfa6505e1f52dfa210f29f550fa6305000000000000000000000000000000",
51
+ "30098100800041f67d4668750bcdf4b0f9ab0e21f602f955057ef5adf9d00ee1f559f95f05b1f5d3f9fb0e8ef5ccf96405000000000000000000000000000000",
52
+ "300d810080003d877c4838750b84f458f7dd0c89f6d0f8fc0436f4e2f7620d83f614f8430526f4c0f8a00e71f666f85c05000000000000000000000000000000",
53
+ "30108100800058e77a4668750bf7f2c3f57c0c9cf6abfa0a0470f30ef6790c89f65dfa420414f476f67e0c80f6d0f98a04000000000000000000000000000000",
54
+ "30128100800059f77a4658750b7ef249f5580cd9f69bfaa40389f269f56c0cd1f6a9fab503a3f286f5760cacf6c9faeb03000000000000000000000000000000",
55
+ "3016810080005b177b4868750ba9f298f4450b2cf774fa3102b8f2a5f47a0b24f765fa6e02b8f2b8f4b10b1df755faac02000000000000000000000000000000",
56
+ "30198100800057777a4558750b39f258f4480a80f73efaf40016f26af4940a5ef76bfa37014ef275f4d40a46f780fa8401000000000000000000000000000000",
57
+ ].map(&:freeze).freeze
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ProconBypassMan
4
+ module Plugin
5
+ module Splatoon3
6
+ VERSION = "0.1.0"
7
+ end
8
+ end
9
+ end
@@ -4,10 +4,20 @@ require_relative "plugin/splatoon2/macro/jump_to_right_key"
4
4
  require_relative "plugin/splatoon2/macro/jump_to_up_key"
5
5
  require_relative "plugin/splatoon2/macro/jump_to_left_key"
6
6
  require_relative "plugin/splatoon2/macro/sokuwari_for_splash_bomb"
7
- require_relative "plugin/splatoon2/macro/dasei_cancel"
7
+ require_relative "plugin/splatoon2/macro/forward_ikarole"
8
8
  require_relative "plugin/splatoon2/macro/charge_tansan_bomb"
9
9
  require_relative "plugin/splatoon2/mode/guruguru"
10
10
 
11
+ require_relative "plugin/splatoon3/version"
12
+ require_relative "plugin/splatoon3/macro/fast_return"
13
+ require_relative "plugin/splatoon3/macro/jump_to_right_key"
14
+ require_relative "plugin/splatoon3/macro/jump_to_up_key"
15
+ require_relative "plugin/splatoon3/macro/jump_to_left_key"
16
+ require_relative "plugin/splatoon3/macro/sokuwari_for_splash_bomb"
17
+ require_relative "plugin/splatoon3/macro/forward_ikarole"
18
+ require_relative "plugin/splatoon3/macro/charge_tansan_bomb"
19
+ require_relative "plugin/splatoon3/mode/guruguru"
20
+
11
21
  module ProconBypassMan
12
22
  module Plugin
13
23
  end
@@ -20,11 +20,23 @@ class ProconBypassMan::Procon::AnalogStickManipulator
20
20
  self.manipulated_abs_x = 3400
21
21
  self.manipulated_abs_y = 1808
22
22
  end
23
- else
24
- warn "error stick manipulator"
25
- self.manipulated_abs_x = analog_stick.abs_x
26
- self.manipulated_abs_y = analog_stick.abs_y
23
+
24
+ return
27
25
  end
26
+
27
+ if method =~ /tilt_left_stick_(completely)_to_(\d+)deg/
28
+ power_level = $1
29
+ arc_degree = $2.to_i
30
+ syahen = 1800 # 最大まで傾けた状態
31
+ neutral_position = ProconBypassMan::ButtonsSettingConfiguration.instance.neutral_position
32
+ self.manipulated_abs_x = (syahen * Math.cos(arc_degree * Math::PI / 180)).to_i - neutral_position.x
33
+ self.manipulated_abs_y = (syahen * Math.sin(arc_degree * Math::PI / 180)).to_i - neutral_position.y
34
+ return
35
+ end
36
+
37
+ warn "error stick manipulator"
38
+ self.manipulated_abs_x = analog_stick.abs_x
39
+ self.manipulated_abs_y = analog_stick.abs_y
28
40
  end
29
41
 
30
42
 
@@ -94,6 +94,17 @@ class ProconBypassMan::Procon::MacroBuilder
94
94
  ]
95
95
  end
96
96
 
97
+ # NOTE: マクロ構文で生成したいけど、スティックとボタン同時押しの構文が思いつかないので、ハードコードする
98
+ if /forward_ikarole1/ =~ step
99
+ # NOTE: 0degはx: 1, y: 0, 90degはx: 0, y: 1, 180degはx: -1, y: 0.
100
+ # NOTE: スティックを前方に倒している状態で270度回転させる
101
+ for_forward_ikarole_steps = [
102
+ [:tilt_left_stick_completely_to_0deg, :b],
103
+ [:tilt_left_stick_completely_to_90deg],
104
+ ]
105
+ return { steps: for_forward_ikarole_steps }
106
+ end
107
+
97
108
  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!))
98
109
  if sec = match[1]
99
110
  return {
@@ -48,7 +48,7 @@ module ProconBypassMan::Procon::PerformanceMeasurement
48
48
  # 全部送ると負荷になるので適当にまびく
49
49
  def self.is_not_measure_with_random_or_if_fast(span: )
50
50
  return false if span.time_taken > 0.1
51
- return true if rand(20) != 0 # 19/20は捨てる
51
+ return true if rand(100) != 0 # 99/100は捨てる
52
52
  return false
53
53
  end
54
54
 
@@ -0,0 +1,18 @@
1
+ class ProconBypassMan::Procon::Rumbler
2
+ def self.monitor
3
+ @@must_rumble = false
4
+ return yield
5
+ end
6
+
7
+ def self.rumble!
8
+ @@must_rumble = true
9
+ end
10
+
11
+ def self.must_rumble?
12
+ @@must_rumble
13
+ end
14
+
15
+ def self.binary
16
+ ["100c00000000" + "00001010"].pack("H*")
17
+ end
18
+ end
@@ -38,7 +38,7 @@ class ProconBypassMan::Procon::UserOperation
38
38
  # @param [Symbol, Array<Symbol>] macro_step
39
39
  def press_button_only_or_tilt_sticks(macro_step)
40
40
  macro_step = [macro_step] if not macro_step.is_a?(Array)
41
- # スティック操作の時はボタン入力を通す
41
+ # スティック操作を含む時はボタン入力を通す
42
42
  binary.set_no_action! if is_button?(macro_step)
43
43
 
44
44
  macro_step.uniq.each do |ms|
@@ -22,6 +22,7 @@ class ProconBypassMan::Procon
22
22
  require "procon_bypass_man/procon/flip_cache"
23
23
  require "procon_bypass_man/procon/press_button_aware"
24
24
  require "procon_bypass_man/procon/suppress_rumble"
25
+ require "procon_bypass_man/procon/rumbler"
25
26
 
26
27
  attr_accessor :user_operation
27
28
 
@@ -32,7 +33,6 @@ class ProconBypassMan::Procon
32
33
  }
33
34
  BlueGreenProcess::SharedVariable.instance.data["buttons"] = {}
34
35
  BlueGreenProcess::SharedVariable.instance.data["current_layer_key"] = :up
35
- @@left_stick_tilting_power_scaler = ProconBypassMan::AnalogStickTiltingPowerScaler.new
36
36
  end
37
37
  reset!
38
38
 
@@ -66,13 +66,15 @@ class ProconBypassMan::Procon
66
66
  def apply!
67
67
  layer_changer = ProconBypassMan::Procon::LayerChanger.new(binary: user_operation.binary)
68
68
  if layer_changer.change_layer?
69
- self.current_layer_key = layer_changer.next_layer_key if layer_changer.pressed_next_layer?
69
+ if layer_changer.pressed_next_layer?
70
+ self.current_layer_key = layer_changer.next_layer_key
71
+ ProconBypassMan::Procon::Rumbler.rumble!
72
+ end
70
73
  user_operation.set_no_action!
71
74
  return
72
75
  end
73
76
 
74
77
  analog_stick = ProconBypassMan::Procon::AnalogStick.new(binary: user_operation.binary.raw)
75
- dumped_tilting_power = @@left_stick_tilting_power_scaler.add_sample(analog_stick.relative_hypotenuse)
76
78
 
77
79
  enable_all_macro = true
78
80
  enable_macro_map = Hash.new {|h,k| h[k] = true }
@@ -90,16 +92,6 @@ class ProconBypassMan::Procon
90
92
  current_layer.macros.each do |macro_name, options|
91
93
  next unless enable_macro_map[macro_name]
92
94
 
93
- if(if_tilted_left_stick_value = options[:if_tilted_left_stick])
94
- threshold = (if_tilted_left_stick_value.is_a?(Hash) && if_tilted_left_stick_value[:threshold]) || ProconBypassMan::AnalogStickTiltingPowerScaler::DEFAULT_THRESHOLD
95
- if dumped_tilting_power&.tilting?(threshold: threshold, current_position_x: analog_stick.relative_x, current_position_y: analog_stick.relative_y) && user_operation.pressing_all_buttons?(options[:if_pressed])
96
- @@status[:ongoing_macro] = MacroRegistry.load(macro_name)
97
- break
98
- end
99
-
100
- next
101
- end
102
-
103
95
  if user_operation.pressing_all_buttons?(options[:if_pressed])
104
96
  @@status[:ongoing_macro] = MacroRegistry.load(macro_name, force_neutral_buttons: options[:force_neutral])
105
97
  break
@@ -19,7 +19,6 @@ class ProconBypassMan::Runner
19
19
  end
20
20
 
21
21
  loop do
22
- # NOTE メインプロセスではThreadをいくつか起動しているので念のためパフォーマンスを優先するためにforkしていく
23
22
  child_pid = Kernel.fork do
24
23
  $will_terminate_token = false
25
24
  ProconBypassMan.after_fork_on_bypass_process
@@ -96,13 +96,14 @@ module ProconBypassMan
96
96
  sleep(10)
97
97
  retry
98
98
  end
99
+ raise if respond_to?(:raise_if_failed) && raise_if_failed
99
100
  rescue Timeout::Error
100
101
  ProconBypassMan.logger.error(e)
101
102
  sleep(10)
102
- retry
103
+ raise if respond_to?(:raise_if_failed) && raise_if_failed
103
104
  rescue => e
104
- puts e
105
105
  ProconBypassMan.logger.error(e)
106
+ raise if respond_to?(:raise_if_failed) && raise_if_failed
106
107
  end
107
108
  end
108
109
  end
@@ -5,5 +5,9 @@ module ProconBypassMan
5
5
  job_id: job_id,
6
6
  })
7
7
  end
8
+
9
+ def raise_if_failed
10
+ true
11
+ end
8
12
  end
9
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProconBypassMan
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.2"
5
5
  end
@@ -6,24 +6,32 @@ module ProconBypassMan
6
6
  new.run
7
7
  end
8
8
 
9
- # @param [Boolean]
9
+ # @return [Worker]
10
10
  def run
11
11
  return self if @thread
12
12
  @thread = Thread.new do
13
13
  while(item = ProconBypassMan::Background::JobQueue.pop)
14
- begin
15
- # プロセスを越えるので、文字列でenqueueしてくれる前提. evalしてクラスにする
16
- ProconBypassMan::Background::JobPerformer.new(klass: eval(item[:job_class]), args: item[:args]).perform
17
- rescue => e
18
- ProconBypassMan.logger.error(e)
19
- sleep(0.2) # busy loopしないように
20
- end
14
+ # プロセスを越えるので文字列になっている. evalしてクラスにする
15
+ work(job_class: eval(item[:job_class]), args: item[:args])
16
+ sleep(0.2) # busy loopしないように
21
17
  end
22
18
  end
23
19
 
24
20
  return self
25
21
  end
26
22
 
23
+ def work(job_class: , args: )
24
+ begin
25
+ job_class.perform(*args)
26
+ rescue => e
27
+ ProconBypassMan.logger.error(e)
28
+ if job_class.respond_to?(:re_enqueue_if_failed) && job_class.re_enqueue_if_failed
29
+ job_class.perform_async(args)
30
+ ProconBypassMan.logger.error("エラーが起きたので#{job_class}を積み直しました。")
31
+ end
32
+ end
33
+ end
34
+
27
35
  # 重要な非同期ジョブは存在しないのでqueueが捌けるのを待たずにkill
28
36
  def shutdown
29
37
  @thread&.kill
@@ -35,7 +35,6 @@ require_relative "procon_bypass_man/support/remote_macro_http_client"
35
35
  require_relative "procon_bypass_man/support/update_remote_pbm_action_status_http_client"
36
36
  require_relative "procon_bypass_man/support/send_device_stats_http_client"
37
37
  require_relative "procon_bypass_man/support/procon_performance_http_client"
38
- require_relative "procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler"
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"
@@ -50,6 +49,7 @@ require_relative "procon_bypass_man/device_status"
50
49
  require_relative "procon_bypass_man/runner"
51
50
  require_relative "procon_bypass_man/processor"
52
51
  require_relative "procon_bypass_man/configuration"
52
+ require_relative "procon_bypass_man/ephemeral_configuration"
53
53
  require_relative "procon_bypass_man/buttons_setting_configuration"
54
54
  require_relative "procon_bypass_man/procon"
55
55
  require_relative "procon_bypass_man/device_model"
@@ -143,6 +143,11 @@ module ProconBypassMan
143
143
  @@configuration ||= ProconBypassMan::Configuration.new
144
144
  end
145
145
 
146
+ # @return [ProconBypassMan::EphemeralConfiguration]
147
+ def self.ephemeral_config
148
+ @@ephemeral_configuration ||= ProconBypassMan::EphemeralConfiguration.new
149
+ end
150
+
146
151
  # @return [void]
147
152
  def self.reset!
148
153
  ProconBypassMan::Procon::MacroRegistry.reset!
@@ -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.0'
15
+ gem 'procon_bypass_man', '0.3.2'
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.0'
15
+ gem 'procon_bypass_man', '0.3.2'
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
@@ -1,5 +1,8 @@
1
1
  version: 1.0
2
2
  setting: |-
3
+ # レイヤー変更時にコントローラーが振動する。有効にすると稀に、コントローラーが数秒間固まることがあります。
4
+ # enable(:rumble_on_layer_change)
5
+
3
6
  prefix_keys_for_changing_layer [:zr, :zl, :l]
4
7
 
5
8
  layer :up do
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.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-08 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pbmenv
@@ -95,10 +95,12 @@ files:
95
95
  - docs/getting_started.md
96
96
  - docs/how_to_connect_procon.md
97
97
  - docs/setting/left-analogstick-cap.md
98
- - docs/setting/splatoon2_macro_dasei_cancel.md
98
+ - docs/setting/splatoon2_macro_forward_ikarole.md
99
99
  - docs/setting/splatoon2_macro_sokuwari_bubble.md
100
100
  - docs/setting/splatoon2_recommended_setting.md
101
101
  - docs/setting/splatoon2_shake_tansan.md
102
+ - docs/setting/splatoon3_macro_forward_ikarole.md
103
+ - docs/setting/splatoon3_recommended_setting.md
102
104
  - docs/setup_raspi.md
103
105
  - docs/setup_raspi.mitamae.rb
104
106
  - docs/setup_raspi_by_mitamae.md
@@ -107,7 +109,6 @@ files:
107
109
  - lib/ext/module.rb
108
110
  - lib/procon_bypass_man.rb
109
111
  - lib/procon_bypass_man/background.rb
110
- - lib/procon_bypass_man/background/job_performer.rb
111
112
  - lib/procon_bypass_man/background/job_queue.rb
112
113
  - lib/procon_bypass_man/background/jobs/base_job.rb
113
114
  - lib/procon_bypass_man/background/jobs/concerns/has_external_api_setting.rb
@@ -161,15 +162,25 @@ files:
161
162
  - lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
162
163
  - lib/procon_bypass_man/device_model.rb
163
164
  - lib/procon_bypass_man/device_status.rb
165
+ - lib/procon_bypass_man/ephemeral_configuration.rb
164
166
  - lib/procon_bypass_man/plugin/splatoon2/macro/charge_tansan_bomb.rb
165
- - lib/procon_bypass_man/plugin/splatoon2/macro/dasei_cancel.rb
166
167
  - lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb
168
+ - lib/procon_bypass_man/plugin/splatoon2/macro/forward_ikarole.rb
167
169
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
168
170
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb
169
171
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb
170
172
  - lib/procon_bypass_man/plugin/splatoon2/macro/sokuwari_for_splash_bomb.rb
171
173
  - lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb
172
174
  - lib/procon_bypass_man/plugin/splatoon2/version.rb
175
+ - lib/procon_bypass_man/plugin/splatoon3/macro/charge_tansan_bomb.rb
176
+ - lib/procon_bypass_man/plugin/splatoon3/macro/fast_return.rb
177
+ - lib/procon_bypass_man/plugin/splatoon3/macro/forward_ikarole.rb
178
+ - lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_left_key.rb
179
+ - lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_right_key.rb
180
+ - lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_up_key.rb
181
+ - lib/procon_bypass_man/plugin/splatoon3/macro/sokuwari_for_splash_bomb.rb
182
+ - lib/procon_bypass_man/plugin/splatoon3/mode/guruguru.rb
183
+ - lib/procon_bypass_man/plugin/splatoon3/version.rb
173
184
  - lib/procon_bypass_man/plugins.rb
174
185
  - lib/procon_bypass_man/processor.rb
175
186
  - lib/procon_bypass_man/procon.rb
@@ -194,6 +205,7 @@ files:
194
205
  - lib/procon_bypass_man/procon/performance_measurement/span_queue.rb
195
206
  - lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
196
207
  - lib/procon_bypass_man/procon/press_button_aware.rb
208
+ - lib/procon_bypass_man/procon/rumbler.rb
197
209
  - lib/procon_bypass_man/procon/suppress_rumble.rb
198
210
  - lib/procon_bypass_man/procon/user_operation.rb
199
211
  - lib/procon_bypass_man/procon/value_objects/analog_stick.rb
@@ -232,7 +244,6 @@ files:
232
244
  - lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb
233
245
  - lib/procon_bypass_man/runner.rb
234
246
  - lib/procon_bypass_man/scheduler.rb
235
- - lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
236
247
  - lib/procon_bypass_man/support/callbacks.rb
237
248
  - lib/procon_bypass_man/support/can_over_process.rb
238
249
  - lib/procon_bypass_man/support/compress_array.rb
@@ -1,77 +0,0 @@
1
- # スプラトゥーン2: 惰性キャンセル マクロの設定方法
2
-
3
- * 本マクロは実験段階で、オプション名などの仕様が変更される可能性が高いです
4
- * procon_bypass_man: 0.1.21以上が必要です
5
-
6
- ## 1. install_macro_pluginでマクロを有効化します
7
- * `setting.yml` に`install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel` と書きます
8
- * これを記述することで、layer内でmacroを呼び出せるようになります
9
-
10
- ```ruby
11
- install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel
12
- ```
13
-
14
- ## 2. どのlayerで発動するかを宣言します
15
- * `setting.yml` のlayer内に`macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_pressed: [:zl]` と書きます
16
- * `if_pressed` がどのボタンを押したときにこのマクロが発動するかの設定です
17
- * 惰性キャンセルなのでイカ状態になるためにzlを押します
18
- * `if_tilted_left_stick` がスティックを倒した時に発動するオプションで、trueを渡すと有効になります
19
- * また、傾けた時の閾値を変更することができて、trueの代わりに `{ threshold: 500 }` と書くことができます
20
- * デフォルトが500で、ここの数値を上げると、スティックを倒した判定がより厳しくなります。最大1400くらいです。
21
- * 連打中に、マクロの発動を無効にしたい場合は `disable_macro` で無効にできます
22
-
23
- ```ruby
24
- layer :up do
25
- macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_tilted_left_stick: true, if_pressed: [:zl]
26
- end
27
- ```
28
- ```ruby
29
- layer :up do
30
- macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_tilted_left_stick: { threshold: 500 }, if_pressed: [:zl]
31
- end
32
- ```
33
- ```ruby
34
- layer :up do
35
- disable_macro :all, if_pressed: :a
36
- disable_macro :all, if_pressed: :zr
37
- macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_tilted_left_stick: true, if_pressed: [:zl]
38
- end
39
- ```
40
-
41
- ## 3. 設定を反映させる
42
- * 上記の記述を加えたsetting.ymlを起動中のprocon_bypass_manプロセスで読み込むには、プロセスにその旨を伝える必要があります
43
- * ラズベリーパイを再起動して、プロセスを立ち上げ直す、でも目的は達成できますが、もっと簡単にsetting.ymlを再読み込みする必要があります
44
- * 書き換えたsetting.ymlを、起動中のprocon_bypass_manプロセスへ即時反映するには、procon_bypass_manプロセスを動かしたまま、別のshellから 以下をを実行してください
45
- * setting.ymlのシンタックスが正しければ、switchとの接続が継続したままsetting.ymlの内容を読み込んでいるはずです
46
-
47
- ```shell
48
- sudo kill -USR2 `cat ./pbm_pid`
49
- ```
50
-
51
- ## 設定例1
52
- ```yaml
53
- version: 1.0
54
- setting: |-
55
- prefix_keys_for_changing_layer [:zr, :zl, :l]
56
- install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel
57
-
58
- layer :up do
59
- disable_macro :all, if_pressed: :a
60
- disable_macro :all, if_pressed: :zr
61
- macro ProconBypassMan::Plugin::Splatoon2::Macro::DaseiCancel, if_tilted_left_stick: true, if_pressed: [:zl]
62
- end
63
- ```
64
-
65
- ## 設定例2
66
- * `open_macro` キーワードを使っても同じことが実行可能です。
67
- * この場合は、 `install_macro_plugin` が不要です。
68
-
69
- ```yaml
70
- version: 1.0
71
- setting: |-
72
- prefix_keys_for_changing_layer [:zr, :zl, :l]
73
-
74
- layer :up do
75
- open_macro :dacan, steps: [:pressing_r_for_0_03sec, :pressing_r_and_pressing_zl_for_0_2sec], if_tilted_left_stick: true, if_pressed: [:zl]
76
- end
77
- ```
@@ -1,15 +0,0 @@
1
- module ProconBypassMan
2
- module Background
3
- class JobPerformer
4
- def initialize(klass: , args: )
5
- @klass = klass
6
- @args = args
7
- end
8
-
9
- # @raise [any]
10
- def perform
11
- @klass.perform(*@args)
12
- end
13
- end
14
- end
15
- end
@@ -1,59 +0,0 @@
1
- class ProconBypassMan::AnalogStickTiltingPowerScaler
2
- DEFAULT_THRESHOLD = 500
3
-
4
- class PowerChunk
5
- def initialize(list)
6
- @list = list
7
- end
8
-
9
- def moving_power
10
- max = @list.max
11
- min = @list.min
12
- moving_power = (max - min).abs
13
- end
14
-
15
- def tilting?(threshold: DEFAULT_THRESHOLD, current_position_x: , current_position_y: )
16
- # スティックがニュートラルな時
17
- if (-200..200).include?(current_position_x) && (-200..200).include?(current_position_y)
18
- return false
19
- end
20
-
21
- moving_power >= threshold
22
- end
23
- end
24
-
25
- def initialize
26
- @map = {}
27
- end
28
-
29
- # @return [NilClass, Chunk] ローテトしたらvalueを返す
30
- def add_sample(value)
31
- rotated = nil
32
- current_key = key
33
- if @map[current_key].nil?
34
- rotated = rotate
35
- @map = { current_key => [] } # renew or initialize
36
- end
37
-
38
- @map[current_key] << value
39
- rotated
40
- end
41
-
42
- private
43
-
44
- # 0.1sec刻みで進行する
45
- def key
46
- time = Time.now
47
- m1 = time.strftime('%L')[0]
48
- [time.to_i, m1].join.to_i
49
- end
50
-
51
- def rotate
52
- list = @map.values.first
53
- if list
54
- return PowerChunk.new(list)
55
- else
56
- return nil
57
- end
58
- end
59
- end