procon_bypass_man 0.3.2 → 0.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f48f74b2d080a695b673df7fead87e9c97a8fad14c8afc6c03027490e798f22
4
- data.tar.gz: b1711feb8433cd8dc47e9a5eb05dc8b989ef0a3e95d33c292ab664b94b05ddda
3
+ metadata.gz: b58b7076f8ae670534f5de02a4d4f08ce85b0e8f32942146c156cbd86e0f6c9f
4
+ data.tar.gz: 47a0d06e49d43c5d9add37212b63a14dcf28016738a34219b6b33534e71bb0af
5
5
  SHA512:
6
- metadata.gz: ff4071d2a2bdb9c3f3a26e2f27c659ef1e080b683286998fe129f7bcac72dea9e0f97e23769da495f024bd55f55b54b952accf89f3118373cf46343f2a2dc4b2
7
- data.tar.gz: bd0faface2c631886156850b67e1480c04a05b214fddffa277c9fd9ff7d4561c3991e34baca27da001a8444797f8ade1aa00d57a1c263166ff82c3b5d2c436fa
6
+ metadata.gz: 7007fe181dffb3d6357d73e1b5f8880647d92e54216ca65d24573c9cadde2bd40bfed977ec5cff8344570d468298b196becd8d7ed36d1ecac9fa54d8250817a4
7
+ data.tar.gz: 490791b8522adc71b10354dc4628bc8e51988ef04e11e82dd9b5ed2a40112dc71e6bc93f9fb9116efd03a3ba1dbb16a67b05ce6e466ef8be26ae27021cd51eba
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.3.3] - 2022-11-13
2
+ * 以前に削除した「スプラ用マクロ、惰性キャンセル」を使えるようにしました
3
+ * docs/setting/splatoon2_macro_dasei_cancel.md, docs/setting/splatoon3_macro_dasei_cancel.md を参照してください
4
+
1
5
  ## [0.3.2] - 2022-10-13
2
6
  * スプラトゥーン3に対応したプラグインを追加しました
3
7
  * 詳しい設定方法については docs/setting/splatoon3_recommended_setting.md を参照してください
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- procon_bypass_man (0.3.2)
4
+ procon_bypass_man (0.3.3)
5
5
  action_cable_client
6
6
  blue_green_process
7
7
  pbmenv (>= 0.1.9)
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  * Nintendo Switch Proコントローラーを連射機などにするRaspberry Pi上で動かすコンバータです
7
7
  * ドキュメントは [getting_started.md](docs/getting_started.md) にまとめています
8
- * https://pbm-cloud.herokuapp.com を使うと、webだけで運用が可能です
8
+ * https://pbm-cloud.jiikko.com を使うと、webだけで運用が可能です
9
9
 
10
10
  <img width="880" alt="スクリーンショット 2022-04-02 9 10 38" src="https://user-images.githubusercontent.com/1664497/161356057-71e4bc2a-0217-4434-9bf1-0002b9fb261a.png">
11
11
 
@@ -46,7 +46,7 @@ https://user-images.githubusercontent.com/1664497/171327108-f12f56a5-fc36-48da-9
46
46
  * 市販されているサードパーティ製連射機との違いは?
47
47
  * サードパーティ製のコントローラーは、設定方法や形状が特殊で買い換えるたびに学習・設定コストが発生します。本ツールを使えば、設定内容はテキストで管理することができ、使い慣れたプロコンで同等のことができます
48
48
  * sshなしで運用は可能ですか?
49
- * https://pbm-cloud.herokuapp.com を使えば、sshを使わずに運用が可能です
49
+ * https://pbm-cloud.jiikko.com を使えば、sshを使わずに運用が可能です
50
50
 
51
51
  ## 仕様・制約
52
52
  * 日を跨ぐ24時ちょうどになった瞬間はLinuxのcronが起動などがするようで、この時間は数秒間バイパスが激しく遅延します
@@ -82,7 +82,7 @@ sudo kill -USR2 `cat ./pbm_pid`
82
82
 
83
83
  ## Raspberry Pi4のセットアップを代行します
84
84
  * Raspberry Pi4を開発者である私の家に配送してくれれば、セットアップを代行します。セットアップが終わり次第送り返します
85
- * 使い方に関しては、https://pbm-cloud.herokuapp.com ですべて完結するので、Linuxの知識は不要です
85
+ * 使い方に関しては、https://pbm-cloud.jiikko.com ですべて完結するので、Linuxの知識は不要です
86
86
  * 何か問題が起きた時はリモートログインでサポート可能です
87
87
  * 希望者はDiscordの `kawagu#7684` にDMを送ってください
88
88
  * お金はかかりません
@@ -48,7 +48,7 @@
48
48
 
49
49
  ## セットアップを代行できます
50
50
  * Raspberry Pi4を開発者である私の家に配送してくれれば、セットアップを代行します。セットアップが終わり次第送り返します
51
- * 使い方に関しては、https://pbm-cloud.herokuapp.com ですべて完結するので、Linuxの知識は不要です
51
+ * 使い方に関しては、https://pbm-cloud.jiikko.com ですべて完結するので、Linuxの知識は不要です
52
52
  * 何か問題が起きた時はリモートログインでサポート可能です
53
53
  * 希望者はDiscordの `kawagu#7684` にDMを送ってください
54
54
  * お金はかかりません
@@ -60,7 +60,7 @@
60
60
 
61
61
  ### procon_bypass_manのインストール
62
62
 
63
- pbmenvを使うと https://pbm-cloud.herokuapp.com と連携ができるのでおすすめですが、pbmenvを使わなくてもprocon_bypass_manをインストールすることは可能です。
63
+ pbmenvを使うと https://pbm-cloud.jiikko.com と連携ができるのでおすすめですが、pbmenvを使わなくてもprocon_bypass_manをインストールすることは可能です。
64
64
  次の4つからインストール方法を1つ選んでください。
65
65
 
66
66
  * pbmenvを使う方法
@@ -239,13 +239,13 @@ discordで質問してみてください。
239
239
  [procon_bypass_manのアップグレード方法](/docs/upgrade_pbm.md)
240
240
 
241
241
  ## procon_bypass_man_cloudについて
242
- https://pbm-cloud.herokuapp.com/
242
+ https://pbm-cloud.jiikko.com/
243
243
  procon_bypass_man_cloudの運用をWEBで完結できるようになる無料のWEBサービスです。
244
244
 
245
245
  procon_bypass_man_cloudとの接続が完了後、Raspberry Piを起動時にprocon_bypass_manが自動で立ち上がるように設定すれば、Raspberry Piへのログインが不要で設定ファイルの変更やprocon_bypass_man自体のアップグレードができます。
246
246
  セットアップ方法などでわからないことがあればdiscordで質問してみてください。
247
247
 
248
- セットアップ方法は https://pbm-cloud.herokuapp.com/faq に書いています。
248
+ セットアップ方法は https://pbm-cloud.jiikko.com/faq に書いています。
249
249
 
250
250
  ## 最適化について
251
251
  本稿では、Rubyの最適化について書きます。上級者向けです。適用しなくても普通に動きますが、逆に適用したことで何らかのケースで遅くなる場合があるかもしれません。
@@ -0,0 +1,13 @@
1
+ # forkしたリポジトリのPBMを動かす方法
2
+
3
+ forkしたリポジトリのPBMを動かす場合には、`app.rb` にある `gem 'procon_bypass_man'` を次のように変更する必要があります。
4
+
5
+ ```diff
6
+ - gem 'procon_bypass_man', '0.3.2'
7
+ + gem 'procon_bypass_man', github: 'splaplapla/procon_bypass_man', branch: "dev"
8
+ ```
9
+
10
+ `github: xxx/procon_bypass_man', branch: "xxx"` の部分にあなたのリポジトリとブランチ名を入力してください。
11
+ 変更する行はここだけです。
12
+
13
+ あとは通常通りに起動してください。
@@ -0,0 +1,77 @@
1
+ # スプラトゥーン2: 惰性キャンセル マクロの設定方法
2
+
3
+ * 本マクロは実験段階で、オプション名などの仕様が変更される可能性が高いです
4
+ * procon_bypass_man: 0.3.3以上が必要です
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
+ ```
@@ -0,0 +1,77 @@
1
+ # スプラトゥーン3: 惰性キャンセル マクロの設定方法
2
+
3
+ * 本マクロは実験段階で、オプション名などの仕様が変更される可能性が高いです
4
+ * procon_bypass_man: 0.3.3以上が必要です
5
+
6
+ ## 1. install_macro_pluginでマクロを有効化します
7
+ * `setting.yml` に`install_macro_plugin ProconBypassMan::Plugin::Splatoon3::Macro::DaseiCancel` と書きます
8
+ * これを記述することで、layer内でmacroを呼び出せるようになります
9
+
10
+ ```ruby
11
+ install_macro_plugin ProconBypassMan::Plugin::Splatoon3::Macro::DaseiCancel
12
+ ```
13
+
14
+ ## 2. どのlayerで発動するかを宣言します
15
+ * `setting.yml` のlayer内に`macro ProconBypassMan::Plugin::Splatoon3::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::Splatoon3::Macro::DaseiCancel, if_tilted_left_stick: true, if_pressed: [:zl]
26
+ end
27
+ ```
28
+ ```ruby
29
+ layer :up do
30
+ macro ProconBypassMan::Plugin::Splatoon3::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::Splatoon3::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::Splatoon3::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::Splatoon3::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
+ ```
@@ -91,7 +91,6 @@ setting: |-
91
91
  * YボタンとBボタンと十字キーの左を同時に押したときに、マップ開いた時の←に設定されている味方にスーパージャンプ
92
92
  * YボタンとBボタンと十字キーの右を同時に押したときに、マップ開いた時の→に設定されている味方にスーパージャンプ
93
93
  * YボタンとBボタンと十字キーの下を同時に押したときに、リスポーンにスーパージャンプ
94
- * ZLボタンと十字キーの右ボタンを同時に、バブル即割を発動
95
94
  * 筆ダッシュをするためにLボタンをZRボタンに変更
96
95
  * ZLボタンとAボタンを同時に押したときに移動するとスニーキング
97
96
  * イカロール
@@ -103,7 +102,6 @@ setting: |-
103
102
  install_macro_plugin ProconBypassMan::Plugin::Splatoon3::Macro::JumpToUpKey
104
103
  install_macro_plugin ProconBypassMan::Plugin::Splatoon3::Macro::JumpToRightKey
105
104
  install_macro_plugin ProconBypassMan::Plugin::Splatoon3::Macro::JumpToLeftKey
106
- install_macro_plugin ProconBypassMan::Plugin::Splatoon3::Macro::SokuwariForSplashBomb
107
105
 
108
106
  prefix_keys_for_changing_layer [:zr, :zl, :l]
109
107
  set_neutral_position 2100, 2000
@@ -117,7 +115,6 @@ setting: |-
117
115
  macro ProconBypassMan::Plugin::Splatoon3::Macro::JumpToUpKey, if_pressed: [:y, :b, :up]
118
116
  macro ProconBypassMan::Plugin::Splatoon3::Macro::JumpToRightKey, if_pressed: [:y, :b, :right]
119
117
  macro ProconBypassMan::Plugin::Splatoon3::Macro::JumpToLeftKey, if_pressed: [:y, :b, :left]
120
- macro ProconBypassMan::Plugin::Splatoon3::Macro::SokuwariForSplashBomb, if_pressed: [:zl, :right]
121
118
 
122
119
  remap :l, to: :zr
123
120
  left_analog_stick_cap cap: 1100, if_pressed: [:zl, :a], force_neutral: :a
data/docs/upgrade_pbm.md CHANGED
@@ -2,7 +2,7 @@
2
2
  * pbm-cloudを使う方法、pbmenvを使う方法、pbmenvを使わない方法があります
3
3
 
4
4
  ## pbm-cloudを使う方法
5
- * https://pbm-cloud.herokuapp.com からデバイス詳細画面を開いてください
5
+ * https://pbm-cloud.jiikko.com からデバイス詳細画面を開いてください
6
6
  * `デバイスの設定` => `PBMのバージョンアップ`を選択して、表示されるモーダルからインストールしたいバージョンを選択し、 `このバージョンでバージョンアップする` をクリックしてください
7
7
  * クリックするとRaspberry Piが再起動するのでしばらく待ってください
8
8
  * 設定ファイルが初期状態に戻っているので適宜復元してください
@@ -53,7 +53,7 @@ module ProconBypassMan
53
53
  end
54
54
 
55
55
  # @param [String, Class] プラグインのclass
56
- # @param [Hash, NilClass] if_tilted_left_stick 非推奨
56
+ # @param [Hash, 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
@@ -53,7 +53,7 @@ class ProconBypassMan::BypassCommand
53
53
  # シビア
54
54
  t2 = Thread.new do
55
55
  bypass = ProconBypassMan::Bypass::ProconToSwitch.new(gadget: @gadget, procon: @procon)
56
- process = BlueGreenProcess.new(worker_instance: bypass, max_work: 200)
56
+ process = BlueGreenProcess.new(worker_instance: bypass, max_work: 550)
57
57
  loop do
58
58
  if $will_terminate_token
59
59
  if $will_terminate_token == WILL_TERMINATE_TOKEN::TERMINATE
@@ -0,0 +1,21 @@
1
+ module ProconBypassMan
2
+ module Plugin
3
+ module Splatoon2
4
+ module Macro
5
+ module DaseiCancel
6
+ def self.display_name
7
+ :dasei_cancel
8
+ end
9
+
10
+ def self.steps
11
+ [:pressing_r_for_0_03sec, :pressing_r_and_pressing_zl_for_0_2sec].freeze
12
+ end
13
+
14
+ def self.description
15
+ '惰性キャンセル'
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ module ProconBypassMan
2
+ module Plugin
3
+ module Splatoon3
4
+ module Macro
5
+ module DaseiCancel
6
+ def self.display_name
7
+ :dasei_cancel
8
+ end
9
+
10
+ def self.steps
11
+ [:pressing_r_for_0_03sec, :pressing_r_and_pressing_zl_for_0_2sec].freeze
12
+ end
13
+
14
+ def self.descrition
15
+ '惰性キャンセル'
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+
@@ -1,3 +1,4 @@
1
+ # 3にはないので削除予定
1
2
  module ProconBypassMan
2
3
  module Plugin
3
4
  module Splatoon3
@@ -6,6 +6,7 @@ require_relative "plugin/splatoon2/macro/jump_to_left_key"
6
6
  require_relative "plugin/splatoon2/macro/sokuwari_for_splash_bomb"
7
7
  require_relative "plugin/splatoon2/macro/forward_ikarole"
8
8
  require_relative "plugin/splatoon2/macro/charge_tansan_bomb"
9
+ require_relative "plugin/splatoon2/macro/dasei_cancel"
9
10
  require_relative "plugin/splatoon2/mode/guruguru"
10
11
 
11
12
  require_relative "plugin/splatoon3/version"
@@ -16,6 +17,7 @@ require_relative "plugin/splatoon3/macro/jump_to_left_key"
16
17
  require_relative "plugin/splatoon3/macro/sokuwari_for_splash_bomb"
17
18
  require_relative "plugin/splatoon3/macro/forward_ikarole"
18
19
  require_relative "plugin/splatoon3/macro/charge_tansan_bomb"
20
+ require_relative "plugin/splatoon3/macro/dasei_cancel"
19
21
  require_relative "plugin/splatoon3/mode/guruguru"
20
22
 
21
23
  module ProconBypassMan
@@ -30,6 +30,7 @@ class ProconBypassMan::Procon::AnalogStick
30
30
  @bin_y.to_i(2) - neutral_position.y
31
31
  end
32
32
 
33
+ # @return [Float]
33
34
  def relative_hypotenuse
34
35
  Math.sqrt((relative_x**2) + (relative_y**2)).floor(6)
35
36
  end
@@ -33,6 +33,7 @@ class ProconBypassMan::Procon
33
33
  }
34
34
  BlueGreenProcess::SharedVariable.instance.data["buttons"] = {}
35
35
  BlueGreenProcess::SharedVariable.instance.data["current_layer_key"] = :up
36
+ BlueGreenProcess::SharedVariable.instance.data["recent_left_stick_hypotenuses"] = []
36
37
  end
37
38
  reset!
38
39
 
@@ -41,6 +42,7 @@ class ProconBypassMan::Procon
41
42
  self.user_operation = ProconBypassMan::Procon::UserOperation.new(
42
43
  binary.dup
43
44
  )
45
+ @left_stick_tilting_power_scaler = ProconBypassMan::AnalogStickTiltingPowerScaler.new
44
46
  end
45
47
 
46
48
  def status
@@ -55,6 +57,20 @@ class ProconBypassMan::Procon
55
57
  BlueGreenProcess::SharedVariable.instance.data["current_layer_key"] = layer
56
58
  end
57
59
 
60
+ RECENT_LEFT_STICK_POSITIONS_LIMIT = 5
61
+ # @param [Float] left_stick_hypotenuses
62
+ # @return [void]
63
+ def add_recent_left_stick_hypotenuses(left_stick_hypotenuses)
64
+ if (overflowed_size = recent_left_stick_hypotenuses.size - RECENT_LEFT_STICK_POSITIONS_LIMIT)
65
+ overflowed_size.times { recent_left_stick_hypotenuses.shift }
66
+ end
67
+ recent_left_stick_hypotenuses << left_stick_hypotenuses
68
+ end
69
+
70
+ def recent_left_stick_hypotenuses
71
+ BlueGreenProcess::SharedVariable.instance.data["recent_left_stick_hypotenuses"]
72
+ end
73
+
58
74
  def ongoing_macro; @@status[:ongoing_macro]; end
59
75
  def ongoing_mode; @@status[:ongoing_mode]; end
60
76
 
@@ -75,6 +91,8 @@ class ProconBypassMan::Procon
75
91
  end
76
92
 
77
93
  analog_stick = ProconBypassMan::Procon::AnalogStick.new(binary: user_operation.binary.raw)
94
+ add_recent_left_stick_hypotenuses(analog_stick.relative_hypotenuse)
95
+ dumped_tilting_power = @left_stick_tilting_power_scaler.calculate(recent_left_stick_hypotenuses)
78
96
 
79
97
  enable_all_macro = true
80
98
  enable_macro_map = Hash.new {|h,k| h[k] = true }
@@ -92,6 +110,16 @@ class ProconBypassMan::Procon
92
110
  current_layer.macros.each do |macro_name, options|
93
111
  next unless enable_macro_map[macro_name]
94
112
 
113
+ if(if_tilted_left_stick_value = options[:if_tilted_left_stick])
114
+ threshold = (if_tilted_left_stick_value.is_a?(Hash) && if_tilted_left_stick_value[:threshold]) || ProconBypassMan::AnalogStickTiltingPowerScaler::DEFAULT_THRESHOLD
115
+ 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])
116
+ @@status[:ongoing_macro] = MacroRegistry.load(macro_name)
117
+ break
118
+ end
119
+
120
+ next
121
+ end
122
+
95
123
  if user_operation.pressing_all_buttons?(options[:if_pressed])
96
124
  @@status[:ongoing_macro] = MacroRegistry.load(macro_name, force_neutral_buttons: options[:force_neutral])
97
125
  break
@@ -0,0 +1,31 @@
1
+ class ProconBypassMan::AnalogStickTiltingPowerScaler
2
+ DEFAULT_THRESHOLD = 500
3
+
4
+ class PowerChunk
5
+ def initialize(hypotenuses)
6
+ @hypotenuses = hypotenuses
7
+ end
8
+
9
+ def moving_power
10
+ max = @hypotenuses.max
11
+ min = @hypotenuses.min
12
+ moving_power = (max - min).abs
13
+ end
14
+
15
+ # @return [Boolean]
16
+ def tilting?(threshold: DEFAULT_THRESHOLD, current_position_x: , current_position_y: )
17
+ # スティックがニュートラルな時
18
+ if (-200..200).include?(current_position_x) && (-200..200).include?(current_position_y)
19
+ return false
20
+ end
21
+
22
+ moving_power >= threshold
23
+ end
24
+ end
25
+
26
+ # @param [Array<Float>] hypotenuses
27
+ # @return [PowerChunk]
28
+ def calculate(hypotenuses)
29
+ PowerChunk.new(hypotenuses)
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProconBypassMan
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
@@ -35,6 +35,7 @@ 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"
38
39
  require_relative "procon_bypass_man/support/never_exit_accidentally"
39
40
  require_relative "procon_bypass_man/support/cycle_sleep"
40
41
  require_relative "procon_bypass_man/support/can_over_process"
@@ -195,7 +196,7 @@ module ProconBypassMan
195
196
  ProconBypassMan::RemoteMacroReceiver.start!
196
197
  BlueGreenProcess.config.logger = ProconBypassMan.logger
197
198
  }
198
- config.shared_variables = [:buttons, :current_layer_key]
199
+ config.shared_variables = [:buttons, :current_layer_key, :recent_left_stick_hypotenuses]
199
200
  end
200
201
  end
201
202
 
@@ -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.2'
15
+ gem 'procon_bypass_man', '0.3.3'
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
@@ -39,7 +39,7 @@ ProconBypassMan.configure do |config|
39
39
 
40
40
  # webからProconBypassManを操作できるwebサービスと連携します
41
41
  # 連携中はエラーログ、パフォーマンスに関するメトリクスを送信します
42
- # config.api_servers = 'https://pbm-cloud.herokuapp.com'
42
+ # config.api_servers = 'https://pbm-cloud.jiikko.com'
43
43
 
44
44
  # エラーが起きたらerror.logに書き込みます
45
45
  config.enable_critical_error_logging = true
@@ -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.2'
15
+ gem 'procon_bypass_man', '0.3.3'
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
@@ -39,7 +39,7 @@ ProconBypassMan.configure do |config|
39
39
 
40
40
  # webからProconBypassManを操作できるwebサービスと連携します
41
41
  # 連携中はエラーログ、パフォーマンスに関するメトリクスを送信します
42
- <%- api_server_config = "config.api_servers = 'https://pbm-cloud.herokuapp.com'" -%>
42
+ <%- api_server_config = "config.api_servers = 'https://pbm-cloud.jiikko.com'" -%>
43
43
  <%- if enable_integration_with_pbm_cloud -%>
44
44
  <%= api_server_config %>
45
45
  <%- else -%>
@@ -15,7 +15,11 @@ class AppGenerator
15
15
  def generate
16
16
  erb = File.read(template_path)
17
17
  enable_integration_with_pbm_cloud = @enable_integration_with_pbm_cloud
18
- app_rb = ERB.new(erb, nil, '-').result(binding)
18
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
19
+ app_rb = ERB.new(erb, trim_mode: '-').result(binding)
20
+ else
21
+ app_rb = ERB.new(erb, nil, '-').result(binding)
22
+ end
19
23
  File.write(output_path, app_rb)
20
24
  end
21
25
 
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.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-13 00:00:00.000000000 Z
11
+ date: 2022-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pbmenv
@@ -94,11 +94,14 @@ files:
94
94
  - bin/setup
95
95
  - docs/getting_started.md
96
96
  - docs/how_to_connect_procon.md
97
+ - docs/run_pbm_on_my_branch.md
97
98
  - docs/setting/left-analogstick-cap.md
99
+ - docs/setting/splatoon2_macro_dasei_cancel.md
98
100
  - docs/setting/splatoon2_macro_forward_ikarole.md
99
101
  - docs/setting/splatoon2_macro_sokuwari_bubble.md
100
102
  - docs/setting/splatoon2_recommended_setting.md
101
103
  - docs/setting/splatoon2_shake_tansan.md
104
+ - docs/setting/splatoon3_macro_dasei_cancel.md
102
105
  - docs/setting/splatoon3_macro_forward_ikarole.md
103
106
  - docs/setting/splatoon3_recommended_setting.md
104
107
  - docs/setup_raspi.md
@@ -164,6 +167,7 @@ files:
164
167
  - lib/procon_bypass_man/device_status.rb
165
168
  - lib/procon_bypass_man/ephemeral_configuration.rb
166
169
  - lib/procon_bypass_man/plugin/splatoon2/macro/charge_tansan_bomb.rb
170
+ - lib/procon_bypass_man/plugin/splatoon2/macro/dasei_cancel.rb
167
171
  - lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb
168
172
  - lib/procon_bypass_man/plugin/splatoon2/macro/forward_ikarole.rb
169
173
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
@@ -173,6 +177,7 @@ files:
173
177
  - lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb
174
178
  - lib/procon_bypass_man/plugin/splatoon2/version.rb
175
179
  - lib/procon_bypass_man/plugin/splatoon3/macro/charge_tansan_bomb.rb
180
+ - lib/procon_bypass_man/plugin/splatoon3/macro/dasei_cancel.rb
176
181
  - lib/procon_bypass_man/plugin/splatoon3/macro/fast_return.rb
177
182
  - lib/procon_bypass_man/plugin/splatoon3/macro/forward_ikarole.rb
178
183
  - lib/procon_bypass_man/plugin/splatoon3/macro/jump_to_left_key.rb
@@ -244,6 +249,7 @@ files:
244
249
  - lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb
245
250
  - lib/procon_bypass_man/runner.rb
246
251
  - lib/procon_bypass_man/scheduler.rb
252
+ - lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
247
253
  - lib/procon_bypass_man/support/callbacks.rb
248
254
  - lib/procon_bypass_man/support/can_over_process.rb
249
255
  - lib/procon_bypass_man/support/compress_array.rb