procon_bypass_man 0.1.16.1 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -0
- data/.github/workflows/release.yml +2 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -1
- data/README.md +0 -1
- data/Steepfile +31 -17
- data/docs/setting/left-analogstick-cap.md +60 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +33 -7
- data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +1 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/validator.rb +36 -0
- data/lib/procon_bypass_man/buttons_setting_configuration.rb +28 -13
- data/lib/procon_bypass_man/domains/binary/base.rb +14 -0
- data/lib/procon_bypass_man/domains/binary/inbound_procon_binary.rb +0 -14
- data/lib/procon_bypass_man/domains/binary/processing_procon_binary.rb +2 -16
- data/lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb +1 -1
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb +1 -1
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb +1 -1
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb +1 -1
- data/lib/procon_bypass_man/plugin/splatoon2/version.rb +1 -1
- data/lib/procon_bypass_man/procon/button_collection.rb +8 -0
- data/lib/procon_bypass_man/procon/macro_registry.rb +8 -5
- data/lib/procon_bypass_man/procon/mode_registry.rb +4 -4
- data/lib/procon_bypass_man/procon/press_button_aware.rb +6 -5
- data/lib/procon_bypass_man/procon/value_objects/analog_stick.rb +1 -1
- data/lib/procon_bypass_man/procon.rb +4 -4
- data/lib/procon_bypass_man/support/compress_array.rb +5 -0
- data/lib/procon_bypass_man/support/http_client.rb +4 -0
- data/lib/procon_bypass_man/support/on_memory_cache.rb +3 -1
- data/lib/procon_bypass_man/support/server_pool.rb +4 -0
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man/websocket/pbm_job_client.rb +13 -2
- data/lib/procon_bypass_man.rb +13 -0
- data/project_template/app.rb +1 -1
- data/sig/main.rbs +213 -42
- data/sig/on_memory_cache.rbs +16 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93bbba4d48bc92fc4f9882a5708d5947fde2e52fc9dbba3df2db6fe7530c52ec
|
|
4
|
+
data.tar.gz: d963b6553736bdf606f63588c4664ec19153e0c9824dc52293c4f0bf99bbaeb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f36218eabf2625618182d45969cb5dd796fa3a9284d1921ab7a923062315f5302e422b7fe49a8d67fbef2e25de4fbd7b6ee378a29fa7f9eb2738de1b406a8c72
|
|
7
|
+
data.tar.gz: fe700aa1c024c3ae45ed57698dcdf35d898032c5a11954ffcf9b70fdcd2e5254bd947f2cb5b5e62d495bfad5e338337c109dafe5dd5bf7f1a1e543bc96ff54f2
|
data/.circleci/config.yml
CHANGED
|
@@ -13,10 +13,10 @@ jobs:
|
|
|
13
13
|
- uses: actions/checkout@v2
|
|
14
14
|
with:
|
|
15
15
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
16
|
-
- name: Set up Ruby
|
|
16
|
+
- name: Set up Ruby 3.0.1
|
|
17
17
|
uses: ruby/setup-ruby@v1
|
|
18
18
|
with:
|
|
19
|
-
ruby-version:
|
|
19
|
+
ruby-version: 3.0.1
|
|
20
20
|
bundler-cache: true
|
|
21
21
|
- name: Publish to RubyGems
|
|
22
22
|
run: |
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
procon_bypass_man (0.1.
|
|
4
|
+
procon_bypass_man (0.1.17)
|
|
5
5
|
action_cable_client
|
|
6
6
|
pbmenv
|
|
7
7
|
sorted_set
|
|
@@ -100,6 +100,8 @@ GEM
|
|
|
100
100
|
unicode-display_width (>= 1.1.1, < 3)
|
|
101
101
|
tilt (2.0.10)
|
|
102
102
|
timecop (0.9.4)
|
|
103
|
+
typeprof (0.20.4)
|
|
104
|
+
rbs (>= 1.6.2)
|
|
103
105
|
tzinfo (2.0.4)
|
|
104
106
|
concurrent-ruby (~> 1.0)
|
|
105
107
|
unicode-display_width (2.1.0)
|
|
@@ -131,6 +133,7 @@ DEPENDENCIES
|
|
|
131
133
|
sinatra
|
|
132
134
|
steep
|
|
133
135
|
timecop
|
|
136
|
+
typeprof
|
|
134
137
|
webrick
|
|
135
138
|
|
|
136
139
|
BUNDLED WITH
|
data/README.md
CHANGED
data/Steepfile
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# D = Steep::Diagnostic
|
|
2
2
|
#
|
|
3
3
|
# target :lib do
|
|
4
|
-
# signature
|
|
4
|
+
# signature 'sig'
|
|
5
5
|
#
|
|
6
|
-
# check
|
|
7
|
-
# check
|
|
8
|
-
# check
|
|
9
|
-
# # ignore
|
|
6
|
+
# check 'lib' # Directory name
|
|
7
|
+
# check 'Gemfile' # File name
|
|
8
|
+
# check 'app/models/**/*.rb' # Glob
|
|
9
|
+
# # ignore 'lib/templates/*.rb'
|
|
10
10
|
#
|
|
11
|
-
# # library
|
|
12
|
-
# # library
|
|
11
|
+
# # library 'pathname', 'set' # Standard libraries
|
|
12
|
+
# # library 'strong_json' # Gems
|
|
13
13
|
#
|
|
14
14
|
# # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
|
|
15
15
|
# # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
|
|
@@ -19,21 +19,35 @@
|
|
|
19
19
|
# end
|
|
20
20
|
|
|
21
21
|
# target :test do
|
|
22
|
-
# signature
|
|
22
|
+
# signature 'sig', 'sig-private'
|
|
23
23
|
#
|
|
24
|
-
# check
|
|
24
|
+
# check 'test'
|
|
25
25
|
#
|
|
26
|
-
# # library
|
|
26
|
+
# # library 'pathname', 'set' # Standard libraries
|
|
27
27
|
# end
|
|
28
28
|
|
|
29
29
|
target :lib do
|
|
30
|
-
check
|
|
31
|
-
check
|
|
32
|
-
check
|
|
30
|
+
check 'lib/procon_bypass_man/timer.rb'
|
|
31
|
+
check 'lib/procon_bypass_man/configuration.rb'
|
|
32
|
+
check 'lib/procon_bypass_man/processor'
|
|
33
|
+
check 'lib/procon_bypass_man/procon/macro_registry'
|
|
34
|
+
check 'lib/procon_bypass_man/procon/mode_registry'
|
|
35
|
+
check 'lib/procon_bypass_man/domains/*'
|
|
36
|
+
check 'lib/procon_bypass_man/domains'
|
|
37
|
+
check 'lib/procon_bypass_man/support/report_http_client'
|
|
38
|
+
check 'lib/procon_bypass_man/support/http_client'
|
|
39
|
+
check 'lib/procon_bypass_man/support/send_device_stats_http_client'
|
|
40
|
+
check 'lib/procon_bypass_man/support/on_memory_cache'
|
|
41
|
+
check 'lib/procon_bypass_man/support/server_pool'
|
|
42
|
+
check 'lib/procon_bypass_man/support/uptime.rb'
|
|
43
|
+
check 'lib/procon_bypass_man/support/safe_timeout'
|
|
44
|
+
check 'lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client'
|
|
45
|
+
check 'lib/procon_bypass_man/support/compress_array'
|
|
33
46
|
|
|
34
|
-
signature
|
|
47
|
+
signature 'sig'
|
|
35
48
|
|
|
36
|
-
library
|
|
37
|
-
library
|
|
38
|
-
library
|
|
49
|
+
library 'time'
|
|
50
|
+
library 'logger'
|
|
51
|
+
library 'monitor'
|
|
52
|
+
library 'uri'
|
|
39
53
|
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# 左アナログスティック感度調整の設定方法
|
|
2
|
+
https://user-images.githubusercontent.com/1664497/150636857-f3d40900-2713-41b8-856a-279c200d9ae7.mp4
|
|
3
|
+
|
|
4
|
+
* procon_bypass_man: 0.1.9以上が必要です
|
|
5
|
+
* PBMには、左アナログスティックの入力の最大値を書き換える機能があります。それをsetting.ymlに書く方法を説明します
|
|
6
|
+
* これを使うと、特定のボタンを押している間は、スティックを完全に倒している状態で、スプラトゥーンでいうところの `スニーキング` で移動ができるようになります
|
|
7
|
+
|
|
8
|
+
## 1. プロコンの左スティックのほぼニュートラルな状態の座標を記述する
|
|
9
|
+
* `set_neutral_position x, y`を使って、プロコンの左スティックのほぼニュートラルな状態の座標を記述します
|
|
10
|
+
* 完全にニュートラルな値を記述すると最速のスニーキングが出ないので微妙にずらします
|
|
11
|
+
* プロコンごとにニュートラルな状態の座標に個体差があって、最速のスニーキングを出すには本数値を調整する必要があります
|
|
12
|
+
* 実際に設定している座標の例
|
|
13
|
+
* `set_neutral_position 1906, 1886`
|
|
14
|
+
* `set_neutral_position 2100, 2000`
|
|
15
|
+
|
|
16
|
+
## 2. 左アナログスティックの入力の最大値を設定する
|
|
17
|
+
* ニュートラルな状態の座標が決まったら、次はどのボタンを押したときに、どれくらいスティック感度を書き換えるか、を設定します
|
|
18
|
+
* 設定には `left_analog_stick_cap` を使います
|
|
19
|
+
* 実際にパラメータを記述した例を用いると `left_analog_stick_cap cap: 1100, if_pressed: [:zl, :a], force_neutral: :a` のようになります
|
|
20
|
+
* パラメータは3つあります
|
|
21
|
+
* `cap: 1100`
|
|
22
|
+
* こちらはニュートラル座標からの最大距離をどのくらいにするか、を決めます
|
|
23
|
+
* 指定したボタンが押されている間は、ニュートラル座標から1100までの範囲に「現在の座標」を書き換える、という設定になります
|
|
24
|
+
* スプラトゥーンのスニーキング用途であれば、1100固定で問題ありません
|
|
25
|
+
* `if_pressed: [:zl, :a]`
|
|
26
|
+
* こちらは zlボタン, aボタンが両方押されている状態の時に本設定が発動する、という設定になります。トリガーです
|
|
27
|
+
* つまり、zlとaを同時押ししている時に、左アナログスティックの入力を書き換えます
|
|
28
|
+
* `force_neutral: :a`
|
|
29
|
+
* こちらは、左アナログスティックの入力を書き換えている時は、「強制的にaボタンを押していない状態にする」という設定になります
|
|
30
|
+
* つまり、zlボタンとaボタンを同時押ししている時には、左アナログスティックの入力を書き換えて、aボタンは押していない状態になります
|
|
31
|
+
* どうしてこれが必要かというと、ゲームタイトルによるのですが、スプラトゥーンの場合は、ガチアサリ中に、保有しているアサリを投げないために必要になっています
|
|
32
|
+
* force_neutralはoptionalです
|
|
33
|
+
|
|
34
|
+
## 3. 設定を反映させる
|
|
35
|
+
* 上記の記述を加えたsetting.ymlを起動中のprocon_bypass_manプロセスで読み込むには、プロセスにその旨を伝える必要があります
|
|
36
|
+
* ラズベリーパイを再起動して、プロセスを立ち上げ直す、でも目的は達成できますが、もっと簡単にsetting.ymlを再読み込みする必要があります
|
|
37
|
+
* 書き換えたsetting.ymlを、起動中のprocon_bypass_manプロセスへ即時反映するには、procon_bypass_manプロセスを動かしたまま、別のshellから 以下をを実行してください
|
|
38
|
+
* setting.ymlのシンタックスが正しければ、switchとの接続が継続したままsetting.ymlの内容を読み込んでいるはずです
|
|
39
|
+
|
|
40
|
+
```shell
|
|
41
|
+
sudo kill -USR2 `cat ./pbm_pid`
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## まとめ
|
|
45
|
+
* スティックの中央値を設定します
|
|
46
|
+
* スプラトゥーンでの最速スニーキングを出すには、set_neutral_positionの値を変更してください
|
|
47
|
+
* 発動するボタンを設定します
|
|
48
|
+
* setting.ymlを再読み込みします
|
|
49
|
+
|
|
50
|
+
## 設定例
|
|
51
|
+
```yaml
|
|
52
|
+
version: 1.0
|
|
53
|
+
setting: |-
|
|
54
|
+
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
|
55
|
+
set_neutral_position 2100, 2000
|
|
56
|
+
|
|
57
|
+
layer :up, mode: :manual do
|
|
58
|
+
left_analog_stick_cap cap: 1100, if_pressed: [:zl, :a], force_neutral: :a
|
|
59
|
+
end
|
|
60
|
+
```
|
|
@@ -8,7 +8,7 @@ module ProconBypassMan
|
|
|
8
8
|
self.flips = {}
|
|
9
9
|
self.macros = {}
|
|
10
10
|
self.remaps = {}
|
|
11
|
-
self.left_analog_stick_caps =
|
|
11
|
+
self.left_analog_stick_caps = []
|
|
12
12
|
self.disables = []
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -53,12 +53,18 @@ module ProconBypassMan
|
|
|
53
53
|
self.flips[button] = hash
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
# @param [String, Class] プラグインのclass
|
|
56
57
|
def macro(name, if_pressed: )
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
macro_name = name.to_s.to_sym
|
|
59
|
+
self.macros[macro_name] = { if_pressed: if_pressed }
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# 設定ファイルに直接マクロを打ち込める
|
|
63
|
+
# @param [String, Class] macroの識別子
|
|
64
|
+
# @paramh[Array<Symbol>] macroの本体. ボタンの配列
|
|
65
|
+
def open_macro(name, steps: , if_pressed: )
|
|
66
|
+
macro_name = name || "OpenMacro-#{steps.join}".to_sym
|
|
67
|
+
ProconBypassMan::Procon::MacroRegistry.install_plugin(macro_name, steps: steps)
|
|
62
68
|
self.macros[macro_name] = { if_pressed: if_pressed }
|
|
63
69
|
end
|
|
64
70
|
|
|
@@ -88,6 +94,10 @@ module ProconBypassMan
|
|
|
88
94
|
raise "not support value"
|
|
89
95
|
end
|
|
90
96
|
|
|
97
|
+
if if_pressed
|
|
98
|
+
hash[:if_pressed] = if_pressed
|
|
99
|
+
end
|
|
100
|
+
|
|
91
101
|
case force_neutral
|
|
92
102
|
when TrueClass
|
|
93
103
|
raise "ボタンを渡してください"
|
|
@@ -101,7 +111,7 @@ module ProconBypassMan
|
|
|
101
111
|
raise "not support value"
|
|
102
112
|
end
|
|
103
113
|
|
|
104
|
-
left_analog_stick_caps
|
|
114
|
+
left_analog_stick_caps << hash
|
|
105
115
|
end
|
|
106
116
|
|
|
107
117
|
def disable(button)
|
|
@@ -123,6 +133,22 @@ module ProconBypassMan
|
|
|
123
133
|
def flip_buttons
|
|
124
134
|
flips
|
|
125
135
|
end
|
|
136
|
+
|
|
137
|
+
# @return [String]
|
|
138
|
+
def to_json(*)
|
|
139
|
+
to_hash.to_json
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# @return [Hash]
|
|
143
|
+
def to_hash
|
|
144
|
+
{ mode: mode,
|
|
145
|
+
flips: flips,
|
|
146
|
+
macros: macros,
|
|
147
|
+
remaps: remaps,
|
|
148
|
+
disables: disables,
|
|
149
|
+
left_analog_stick_caps: left_analog_stick_caps,
|
|
150
|
+
}
|
|
151
|
+
end
|
|
126
152
|
end
|
|
127
153
|
end
|
|
128
154
|
end
|
|
@@ -3,6 +3,7 @@ module ProconBypassMan
|
|
|
3
3
|
module Loader
|
|
4
4
|
require 'digest/md5'
|
|
5
5
|
|
|
6
|
+
# @return [ProconBypassMan::ButtonsSettingConfiguration]
|
|
6
7
|
def self.load(setting_path: )
|
|
7
8
|
ProconBypassMan::ButtonsSettingConfiguration.switch_new_context(:validation) do |new_instance|
|
|
8
9
|
yaml = YAML.load_file(setting_path) or raise "読み込みに失敗しました"
|
|
@@ -2,6 +2,8 @@ module ProconBypassMan
|
|
|
2
2
|
class ButtonsSettingConfiguration
|
|
3
3
|
class Validator
|
|
4
4
|
def initialize(config)
|
|
5
|
+
@macro_plugins = config.macro_plugins
|
|
6
|
+
@mode_plugins = config.mode_plugins
|
|
5
7
|
@layers = config.layers
|
|
6
8
|
@prefix_keys = config.prefix_keys
|
|
7
9
|
end
|
|
@@ -14,6 +16,8 @@ module ProconBypassMan
|
|
|
14
16
|
validate_config_of_button_lonely
|
|
15
17
|
validate_verify_button_existence
|
|
16
18
|
validate_flip_and_remap_are_hate_each_other
|
|
19
|
+
validate_verify_mode_plugins
|
|
20
|
+
validate_verify_macro_plugins
|
|
17
21
|
|
|
18
22
|
@errors.empty?
|
|
19
23
|
end
|
|
@@ -86,6 +90,38 @@ module ProconBypassMan
|
|
|
86
90
|
end
|
|
87
91
|
end
|
|
88
92
|
end
|
|
93
|
+
|
|
94
|
+
def validate_verify_mode_plugins
|
|
95
|
+
@mode_plugins.each do |key, mode|
|
|
96
|
+
begin
|
|
97
|
+
Module.const_get(key.to_s)
|
|
98
|
+
rescue NameError
|
|
99
|
+
next
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if(const = Module.const_get(key.to_s))
|
|
103
|
+
if not const.respond_to?(:binaries) && mode.call
|
|
104
|
+
@errors[:mode] << "モード #{key}を読み込めませんでした。"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def validate_verify_macro_plugins
|
|
111
|
+
@macro_plugins.each do |key, macro|
|
|
112
|
+
begin
|
|
113
|
+
Module.const_get(key.to_s)
|
|
114
|
+
rescue NameError
|
|
115
|
+
next
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if(const = Module.const_get(key.to_s))
|
|
119
|
+
if not const.respond_to?(:steps) && macro.call
|
|
120
|
+
@errors[:macro] << "マクロ #{key}を読み込めませんでした。"
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
89
125
|
end
|
|
90
126
|
end
|
|
91
127
|
end
|
|
@@ -15,14 +15,21 @@ module ProconBypassMan
|
|
|
15
15
|
:neutral_position
|
|
16
16
|
|
|
17
17
|
def self.instance
|
|
18
|
-
@@current_context_key ||= :main
|
|
19
18
|
@@context ||= {}
|
|
20
|
-
@@context[
|
|
19
|
+
@@context[current_context_key] ||= new
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.current_context_key
|
|
23
|
+
@@current_context_key ||= :main
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.instance=(val)
|
|
27
|
+
@@context[current_context_key] = val
|
|
21
28
|
end
|
|
22
29
|
|
|
23
30
|
def self.switch_new_context(key)
|
|
24
31
|
@@context[key] = new
|
|
25
|
-
previous_key =
|
|
32
|
+
previous_key = current_context_key
|
|
26
33
|
if block_given?
|
|
27
34
|
@@current_context_key = key
|
|
28
35
|
value = yield(@@context[key])
|
|
@@ -35,23 +42,31 @@ module ProconBypassMan
|
|
|
35
42
|
|
|
36
43
|
def initialize
|
|
37
44
|
reset!
|
|
45
|
+
self.class.instance = self
|
|
38
46
|
end
|
|
39
47
|
|
|
40
48
|
module ManualMode
|
|
41
49
|
def self.name
|
|
42
|
-
|
|
50
|
+
:manual
|
|
43
51
|
end
|
|
44
52
|
end
|
|
45
53
|
def layer(direction, mode: ManualMode, &block)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
if ProconBypassMan::ButtonsSettingConfiguration::ManualMode == mode
|
|
55
|
+
mode_name = mode.name
|
|
56
|
+
else
|
|
57
|
+
mode_name = case mode
|
|
58
|
+
when ProconBypassMan::ButtonsSettingConfiguration::ManualMode
|
|
59
|
+
mode.name
|
|
60
|
+
when String
|
|
61
|
+
mode.to_sym
|
|
62
|
+
when Symbol
|
|
63
|
+
mode
|
|
64
|
+
else
|
|
65
|
+
mode.to_s.to_sym
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
unless ([ManualMode.name] + ProconBypassMan::Procon::ModeRegistry.plugins.keys).include?(mode_name)
|
|
55
70
|
raise("#{mode_name} mode is unknown")
|
|
56
71
|
end
|
|
57
72
|
|
|
@@ -8,4 +8,18 @@ class ProconBypassMan::Domains::Binary::Base
|
|
|
8
8
|
def binary
|
|
9
9
|
raise NotImplementedError
|
|
10
10
|
end
|
|
11
|
+
|
|
12
|
+
# @return [String]
|
|
13
|
+
def raw
|
|
14
|
+
binary
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def unpack
|
|
18
|
+
binary.unpack("H*")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# @return [ProconBypassMan::ProconReader]
|
|
22
|
+
def to_procon_reader
|
|
23
|
+
ProconBypassMan::ProconReader.new(binary: binary)
|
|
24
|
+
end
|
|
11
25
|
end
|
|
@@ -2,20 +2,6 @@
|
|
|
2
2
|
class ProconBypassMan::Domains::InboundProconBinary < ProconBypassMan::Domains::Binary::Base
|
|
3
3
|
include ProconBypassMan::Domains::HasImmutableBinary
|
|
4
4
|
|
|
5
|
-
# @return [String]
|
|
6
|
-
def raw
|
|
7
|
-
binary.dup
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def unpack
|
|
11
|
-
binary.unpack("H*")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# @return [ProconBypassMan::ProconReader]
|
|
15
|
-
def to_procon_reader
|
|
16
|
-
ProconBypassMan::ProconReader.new(binary: binary)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
5
|
# @return [Boolean]
|
|
20
6
|
def user_operation_data?
|
|
21
7
|
binary[0] == "\x30".b
|
|
@@ -4,15 +4,6 @@ class ProconBypassMan::Domains::ProcessingProconBinary < ProconBypassMan::Domain
|
|
|
4
4
|
|
|
5
5
|
ALL_ZERO_BIT = ["0"].pack("H*").freeze
|
|
6
6
|
|
|
7
|
-
# @return [String]
|
|
8
|
-
def raw
|
|
9
|
-
binary
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def unpack
|
|
13
|
-
binary.unpack("H*")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
7
|
def set_no_action!
|
|
17
8
|
binary[3] = ALL_ZERO_BIT
|
|
18
9
|
binary[4] = ALL_ZERO_BIT
|
|
@@ -48,7 +39,7 @@ class ProconBypassMan::Domains::ProcessingProconBinary < ProconBypassMan::Domain
|
|
|
48
39
|
raise "already pressing button(#{button})" if ProconBypassMan::PressButtonAware.new(binary).pressing_button?(button)
|
|
49
40
|
|
|
50
41
|
button_obj = ProconBypassMan::Procon::Button.new(button)
|
|
51
|
-
value = binary[button_obj.byte_position].unpack("
|
|
42
|
+
value = binary[button_obj.byte_position].unpack("C").first + (2**button_obj.bit_position)
|
|
52
43
|
binary[button_obj.byte_position] = ["%02X" % value.to_s].pack("H*")
|
|
53
44
|
end
|
|
54
45
|
|
|
@@ -57,7 +48,7 @@ class ProconBypassMan::Domains::ProcessingProconBinary < ProconBypassMan::Domain
|
|
|
57
48
|
raise "not press button(#{button}) yet" if not ProconBypassMan::PressButtonAware.new(binary).pressing_button?(button)
|
|
58
49
|
|
|
59
50
|
button_obj = ProconBypassMan::Procon::Button.new(button)
|
|
60
|
-
value = binary[button_obj.byte_position].unpack("
|
|
51
|
+
value = binary[button_obj.byte_position].unpack("C").first - (2**button_obj.bit_position)
|
|
61
52
|
binary[button_obj.byte_position] = ["%02X" % value.to_s].pack("H*")
|
|
62
53
|
end
|
|
63
54
|
|
|
@@ -72,9 +63,4 @@ class ProconBypassMan::Domains::ProcessingProconBinary < ProconBypassMan::Domain
|
|
|
72
63
|
analog_stick_cap = ProconBypassMan::Procon::AnalogStickCap.new(binary)
|
|
73
64
|
binary[6..8] = analog_stick_cap.capped_position(cap_hypotenuse: cap).to_binary
|
|
74
65
|
end
|
|
75
|
-
|
|
76
|
-
# @return [ProconBypassMan::ProconReader]
|
|
77
|
-
def to_procon_reader
|
|
78
|
-
ProconBypassMan::ProconReader.new(binary: binary)
|
|
79
|
-
end
|
|
80
66
|
end
|
|
@@ -37,4 +37,12 @@ class ProconBypassMan::Procon::ButtonCollection
|
|
|
37
37
|
BUTTONS = ProconBypassMan::Procon::ButtonCollection::BUTTONS_MAP.keys.freeze
|
|
38
38
|
|
|
39
39
|
LEFT_ANALOG_STICK = { byte_position: 6..8 }
|
|
40
|
+
|
|
41
|
+
# @param [Array<Symbol>] buttons
|
|
42
|
+
# @return [Array<Symbol>]
|
|
43
|
+
def self.normalize(buttons)
|
|
44
|
+
buttons.select { |x|
|
|
45
|
+
!!ProconBypassMan::Procon::ButtonCollection::BUTTONS_MAP[x]
|
|
46
|
+
}
|
|
47
|
+
end
|
|
40
48
|
end
|
|
@@ -24,15 +24,18 @@ class ProconBypassMan::Procon::MacroRegistry
|
|
|
24
24
|
null: [],
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
def self.install_plugin(klass)
|
|
28
|
-
if plugins[klass.
|
|
29
|
-
raise "
|
|
27
|
+
def self.install_plugin(klass, steps: nil)
|
|
28
|
+
if plugins[klass.to_s.to_sym]
|
|
29
|
+
raise "#{klass} macro is already registered"
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
plugins[klass.to_s.to_sym] = ->{
|
|
33
|
+
ProconBypassMan::Procon::ButtonCollection.normalize(steps || klass.steps)
|
|
34
|
+
}
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
def self.load(name)
|
|
35
|
-
steps = PRESETS[name] || plugins[name] || raise("unknown macro")
|
|
38
|
+
steps = PRESETS[name] || plugins[name].call || raise("unknown macro")
|
|
36
39
|
Macro.new(name: name, steps: steps.dup)
|
|
37
40
|
end
|
|
38
41
|
|
|
@@ -23,14 +23,14 @@ class ProconBypassMan::Procon::ModeRegistry
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
def self.install_plugin(klass)
|
|
26
|
-
if plugins[klass.
|
|
27
|
-
raise "
|
|
26
|
+
if plugins[klass.to_s.to_sym]
|
|
27
|
+
raise "#{klass} mode is already registered"
|
|
28
28
|
end
|
|
29
|
-
plugins[klass.
|
|
29
|
+
plugins[klass.to_s.to_sym] = ->{ klass.binaries }
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def self.load(name)
|
|
33
|
-
b = PRESETS[name] || plugins[name] || raise("unknown mode")
|
|
33
|
+
b = PRESETS[name] || plugins[name]&.call || raise("#{name} is unknown mode")
|
|
34
34
|
Mode.new(name: name, binaries: b.dup)
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
class ProconBypassMan::PressButtonAware
|
|
2
|
+
BIT_ON = '1'.freeze
|
|
3
|
+
|
|
2
4
|
def initialize(binary)
|
|
3
5
|
@binary = binary
|
|
4
6
|
end
|
|
5
7
|
|
|
8
|
+
# @param [Symbol]
|
|
9
|
+
# @return [Boolean]
|
|
6
10
|
def pressing_button?(button)
|
|
7
11
|
button_obj = ProconBypassMan::Procon::Button.new(button)
|
|
8
|
-
@binary[
|
|
9
|
-
|
|
10
|
-
].unpack("H*").first.to_i(16).to_s(2).reverse[
|
|
11
|
-
button_obj.bit_position
|
|
12
|
-
] == '1'
|
|
12
|
+
byte = @binary[button_obj.byte_position].unpack("C").first.to_s(2).reverse
|
|
13
|
+
byte[button_obj.bit_position] == BIT_ON
|
|
13
14
|
end
|
|
14
15
|
end
|
|
@@ -5,7 +5,7 @@ class ProconBypassMan::Procon::AnalogStick
|
|
|
5
5
|
def initialize(binary: )
|
|
6
6
|
@neutral_position = ProconBypassMan::ButtonsSettingConfiguration.instance.neutral_position
|
|
7
7
|
bytes = binary[ProconBypassMan::Procon::ButtonCollection::LEFT_ANALOG_STICK.fetch(:byte_position)]
|
|
8
|
-
byte6, byte7, byte8 = bytes.each_char.map { |x| x.unpack("
|
|
8
|
+
byte6, byte7, byte8 = bytes.each_char.map { |x| x.unpack("C").first.to_s(2).rjust(8, "0") }
|
|
9
9
|
|
|
10
10
|
self.bin_x = "#{byte7[4..7]}#{byte6}"
|
|
11
11
|
self.bin_y = "#{byte8}#{byte7[0..3]}"
|
|
@@ -102,12 +102,12 @@ class ProconBypassMan::Procon
|
|
|
102
102
|
user_operation.unpress_button(button)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
current_layer.left_analog_stick_caps.each do |
|
|
106
|
-
if
|
|
107
|
-
|
|
105
|
+
current_layer.left_analog_stick_caps.each do |config|
|
|
106
|
+
if config[:if_pressed].nil? || user_operation.pressing_all_buttons?(config[:if_pressed])
|
|
107
|
+
config[:force_neutral]&.each do |force_neutral_button|
|
|
108
108
|
user_operation.unpress_button(force_neutral_button)
|
|
109
109
|
end
|
|
110
|
-
user_operation.apply_left_analog_stick_cap(cap:
|
|
110
|
+
user_operation.apply_left_analog_stick_cap(cap: config[:cap])
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
|
|
@@ -32,7 +32,9 @@ module ProconBypassMan
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
client.received do |data|
|
|
35
|
-
|
|
35
|
+
ProconBypassMan.logger.info(data)
|
|
36
|
+
|
|
37
|
+
dispatch(data: data, client: client)
|
|
36
38
|
rescue => e
|
|
37
39
|
ProconBypassMan::SendErrorCommand.execute(error: e)
|
|
38
40
|
end
|
|
@@ -51,11 +53,20 @@ module ProconBypassMan
|
|
|
51
53
|
end
|
|
52
54
|
end
|
|
53
55
|
|
|
56
|
+
# @param [Hash] data
|
|
57
|
+
def self.dispatch(data: , client: )
|
|
58
|
+
pbm_job_hash = data.dig("message")
|
|
59
|
+
if pbm_job_hash['action'] == "ping"
|
|
60
|
+
client.perform('pong', { device_id: ProconBypassMan.device_id, message: 'hello from pbm' })
|
|
61
|
+
else
|
|
62
|
+
validate_and_run(data: data)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
54
66
|
# @raise [ProconBypassMan::RemotePbmActionObject::ValidationError]
|
|
55
67
|
# @param [Hash] data
|
|
56
68
|
# @return [Void]
|
|
57
69
|
def self.validate_and_run(data: )
|
|
58
|
-
ProconBypassMan.logger.debug { data }
|
|
59
70
|
pbm_job_hash = data.dig("message")
|
|
60
71
|
begin
|
|
61
72
|
pbm_job_object = ProconBypassMan::RemotePbmActionObject.new(action: pbm_job_hash["action"],
|
data/lib/procon_bypass_man.rb
CHANGED
|
@@ -44,6 +44,19 @@ require_relative "procon_bypass_man/websocket/pbm_job_client"
|
|
|
44
44
|
STDOUT.sync = true
|
|
45
45
|
Thread.abort_on_exception = true
|
|
46
46
|
|
|
47
|
+
# pluginの定数を握りつぶす
|
|
48
|
+
class Module
|
|
49
|
+
def const_missing(id)
|
|
50
|
+
if self.name =~ /^ProconBypassMan::Plugin/
|
|
51
|
+
parent_const = Object.const_get("#{self.name}")
|
|
52
|
+
parent_const.const_set(id, Module.new)
|
|
53
|
+
Object.const_get("#{self.name}::#{id}")
|
|
54
|
+
else
|
|
55
|
+
super
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
47
60
|
module ProconBypassMan
|
|
48
61
|
extend ProconBypassMan::Configuration::ClassMethods
|
|
49
62
|
|
data/project_template/app.rb
CHANGED
data/sig/main.rbs
CHANGED
|
@@ -34,7 +34,13 @@ module ProconBypassMan
|
|
|
34
34
|
|
|
35
35
|
def self.root=: (untyped path) -> untyped
|
|
36
36
|
|
|
37
|
+
def self.pid: () -> Integer
|
|
38
|
+
|
|
37
39
|
def self.digest_path: () -> ::String
|
|
40
|
+
|
|
41
|
+
def self.session_id: () -> ::String
|
|
42
|
+
|
|
43
|
+
def self.device_id: () -> ::String
|
|
38
44
|
end
|
|
39
45
|
|
|
40
46
|
class ProconBypassMan::Bypass
|
|
@@ -166,44 +172,44 @@ end
|
|
|
166
172
|
|
|
167
173
|
class ProconBypassMan::Configuration
|
|
168
174
|
module ClassMethods
|
|
169
|
-
def root: () ->
|
|
175
|
+
def root: () -> String
|
|
170
176
|
|
|
171
|
-
def logger: () ->
|
|
177
|
+
def logger: () -> Logger
|
|
172
178
|
|
|
173
179
|
def error_logger: () -> untyped
|
|
174
180
|
|
|
175
|
-
def pid_path: () ->
|
|
181
|
+
def pid_path: () -> String
|
|
176
182
|
|
|
177
|
-
def digest_path: () ->
|
|
183
|
+
def digest_path: () -> String
|
|
178
184
|
|
|
179
|
-
def cache: () ->
|
|
185
|
+
def cache: () -> ProconBypassMan::OnMemoryCache
|
|
180
186
|
|
|
181
|
-
def config: () ->
|
|
187
|
+
def config: () -> ProconBypassMan::Configuration
|
|
182
188
|
end
|
|
183
189
|
|
|
184
190
|
attr_reader api_server: untyped
|
|
185
191
|
attr_reader api_servers: untyped
|
|
186
192
|
|
|
187
|
-
attr_accessor enable_critical_error_logging:
|
|
193
|
+
attr_accessor enable_critical_error_logging: bool
|
|
188
194
|
|
|
189
|
-
def root=: (
|
|
195
|
+
def root=: (String path) -> ProconBypassMan::Configuration
|
|
190
196
|
|
|
191
|
-
def root: () ->
|
|
197
|
+
def root: () -> String
|
|
192
198
|
|
|
193
199
|
def api_server=: (untyped api_server) -> untyped
|
|
194
200
|
|
|
195
|
-
def logger=: (
|
|
201
|
+
def logger=: (Logger logger) -> ProconBypassMan::Configuration
|
|
196
202
|
|
|
197
|
-
def logger: () ->
|
|
203
|
+
def logger: () -> Logger
|
|
198
204
|
|
|
199
|
-
def error_logger: () ->
|
|
205
|
+
def error_logger: () -> Logger
|
|
200
206
|
|
|
201
|
-
def digest_path: () ->
|
|
207
|
+
def digest_path: () -> String
|
|
202
208
|
|
|
203
209
|
# @return [String] pbm-webの接続先
|
|
204
|
-
def current_server: () ->
|
|
210
|
+
def current_server: () -> String
|
|
205
211
|
|
|
206
|
-
def current_ws_server: () -> (
|
|
212
|
+
def current_ws_server: () -> (String | nil)
|
|
207
213
|
|
|
208
214
|
def current_ws_server_url: () -> ::String
|
|
209
215
|
|
|
@@ -216,6 +222,10 @@ class ProconBypassMan::Configuration
|
|
|
216
222
|
def internal_servers: () -> ::Array[string | nil]
|
|
217
223
|
|
|
218
224
|
def internal_api_servers: () -> ::Array[untyped]
|
|
225
|
+
|
|
226
|
+
def raw_setting: () -> untyped
|
|
227
|
+
|
|
228
|
+
def verbose_bypass_log: () -> bool
|
|
219
229
|
end
|
|
220
230
|
|
|
221
231
|
|
|
@@ -387,41 +397,41 @@ end
|
|
|
387
397
|
|
|
388
398
|
class ProconBypassMan::Procon::MacroRegistry
|
|
389
399
|
class Macro
|
|
390
|
-
attr_accessor name:
|
|
400
|
+
attr_accessor name: Symbol
|
|
391
401
|
|
|
392
402
|
attr_accessor steps: untyped
|
|
393
403
|
|
|
394
|
-
def initialize: (name: untyped
|
|
404
|
+
def initialize: (name: untyped Symbol, steps: Symbol) -> void
|
|
395
405
|
|
|
396
|
-
def next_step: () ->
|
|
406
|
+
def next_step: () -> Symbol
|
|
397
407
|
|
|
398
|
-
def finished?: () ->
|
|
408
|
+
def finished?: () -> bool
|
|
399
409
|
|
|
400
|
-
def ongoing?: () ->
|
|
410
|
+
def ongoing?: () -> bool
|
|
401
411
|
end
|
|
402
412
|
|
|
403
|
-
PRESETS: ::Hash[
|
|
413
|
+
PRESETS: ::Hash[Symbol, Array[Symbol]]
|
|
404
414
|
|
|
405
415
|
def self.install_plugin: (untyped klass) -> untyped
|
|
406
416
|
|
|
407
|
-
def self.load: (
|
|
417
|
+
def self.load: (Symbol name) -> untyped
|
|
408
418
|
|
|
409
|
-
def self.reset!: () ->
|
|
419
|
+
def self.reset!: () -> void
|
|
410
420
|
|
|
411
|
-
def self.plugins: () ->
|
|
421
|
+
def self.plugins: () -> ::Hash[Symbol, Array[Symbol]]
|
|
412
422
|
end
|
|
413
423
|
|
|
414
424
|
class ProconBypassMan::Procon::ModeRegistry
|
|
415
425
|
class Mode
|
|
416
|
-
attr_accessor name:
|
|
426
|
+
attr_accessor name: Symbol
|
|
417
427
|
|
|
418
|
-
attr_accessor binaries:
|
|
428
|
+
attr_accessor binaries: Array[String]
|
|
419
429
|
|
|
420
|
-
attr_accessor source_binaries:
|
|
430
|
+
attr_accessor source_binaries: Array[String]
|
|
421
431
|
|
|
422
|
-
def initialize: (name:
|
|
432
|
+
def initialize: (name: Symbol, binaries: Array[String]) -> void
|
|
423
433
|
|
|
424
|
-
def next_binary: () ->
|
|
434
|
+
def next_binary: () -> String
|
|
425
435
|
end
|
|
426
436
|
|
|
427
437
|
PRESETS: ::Hash[untyped, untyped]
|
|
@@ -435,30 +445,20 @@ class ProconBypassMan::Procon::ModeRegistry
|
|
|
435
445
|
def self.plugins: () -> untyped
|
|
436
446
|
end
|
|
437
447
|
|
|
438
|
-
module ProconBypassMan::Procon::PressedButtonHelper
|
|
439
|
-
module Static
|
|
440
|
-
def pressed_button?: (untyped button) -> untyped
|
|
441
|
-
end
|
|
442
|
-
end
|
|
443
|
-
|
|
444
448
|
class ProconBypassMan::Procon
|
|
445
449
|
class UserOperation
|
|
446
450
|
include LayerChangeable
|
|
447
451
|
|
|
448
|
-
include PressedButtonHelper::Static
|
|
449
|
-
|
|
450
452
|
attr_reader binary: untyped
|
|
451
453
|
|
|
452
454
|
def initialize: (untyped binary) -> untyped
|
|
453
455
|
|
|
454
|
-
ZERO_BIT: untyped
|
|
455
|
-
|
|
456
456
|
ASCII_ENCODING: ::String
|
|
457
457
|
|
|
458
458
|
# @depilicate
|
|
459
459
|
def binary=: (untyped binary) -> untyped
|
|
460
460
|
|
|
461
|
-
def set_no_action!: () ->
|
|
461
|
+
def set_no_action!: () -> void
|
|
462
462
|
|
|
463
463
|
def unpress_button: (untyped button) -> untyped
|
|
464
464
|
|
|
@@ -496,7 +496,7 @@ module ProconBypassMan
|
|
|
496
496
|
end
|
|
497
497
|
|
|
498
498
|
# 5秒後がタイムアウト
|
|
499
|
-
def initialize: (?timeout: untyped timeout) ->
|
|
499
|
+
def initialize: (?timeout: untyped timeout) -> void
|
|
500
500
|
|
|
501
501
|
def throw_if_timeout!: () -> untyped
|
|
502
502
|
end
|
|
@@ -508,7 +508,7 @@ module ProconBypassMan
|
|
|
508
508
|
def self.from_boot: () -> Integer
|
|
509
509
|
|
|
510
510
|
# @param [String] uptime_cmd_result
|
|
511
|
-
def initialize: (uptime_cmd_result: String
|
|
511
|
+
def initialize: (uptime_cmd_result: String) -> void
|
|
512
512
|
|
|
513
513
|
# @return [Integer]
|
|
514
514
|
def from_boot: () -> Integer
|
|
@@ -518,3 +518,174 @@ end
|
|
|
518
518
|
module ProconBypassMan
|
|
519
519
|
VERSION: ::String
|
|
520
520
|
end
|
|
521
|
+
|
|
522
|
+
module ProconBypassMan
|
|
523
|
+
module Domains
|
|
524
|
+
module Binary
|
|
525
|
+
end
|
|
526
|
+
end
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
class ProconBypassMan::Domains::Binary::Base
|
|
530
|
+
# @param [String] binary
|
|
531
|
+
def initialize: (binary: untyped binary) -> void
|
|
532
|
+
|
|
533
|
+
# @return [String] バイナリ
|
|
534
|
+
def binary: () -> untyped
|
|
535
|
+
|
|
536
|
+
# @return [String]
|
|
537
|
+
def raw: () -> ::String
|
|
538
|
+
|
|
539
|
+
def unpack: () -> Array[::String]
|
|
540
|
+
|
|
541
|
+
# @return [ProconBypassMan::ProconReader]
|
|
542
|
+
def to_procon_reader: () -> untyped
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
module ProconBypassMan::Domains::HasImmutableBinary
|
|
546
|
+
def binary: () -> untyped
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
module ProconBypassMan::Domains::HasMutableBinary
|
|
550
|
+
def binary: () -> untyped
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
class ProconBypassMan::Domains::InboundProconBinary < ProconBypassMan::Domains::Binary::Base
|
|
554
|
+
include ProconBypassMan::Domains::HasImmutableBinary
|
|
555
|
+
|
|
556
|
+
# @return [Boolean]
|
|
557
|
+
def user_operation_data?: () -> bool
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
# バイナリの書き換えのみをする
|
|
561
|
+
class ProconBypassMan::Domains::ProcessingProconBinary < ProconBypassMan::Domains::Binary::Base
|
|
562
|
+
include ProconBypassMan::Domains::HasMutableBinary
|
|
563
|
+
|
|
564
|
+
ALL_ZERO_BIT: ::String
|
|
565
|
+
|
|
566
|
+
def set_no_action!: () -> untyped
|
|
567
|
+
|
|
568
|
+
# @param [ProconBypassMan::Domains::ProcessingProconBinary]
|
|
569
|
+
# @return [ProconBypassMan::Domains::ProcessingProconBinary]
|
|
570
|
+
# アナログスティックは上書きし、ボタンだけマージする
|
|
571
|
+
def write_as_merge!: (untyped target_binary) -> ProconBypassMan::Domains::ProcessingProconBinary
|
|
572
|
+
|
|
573
|
+
# @param [Symbol] button
|
|
574
|
+
def write_as_press_button: (Symbol button) -> void
|
|
575
|
+
|
|
576
|
+
# @param [Symbol] button
|
|
577
|
+
def write_as_unpress_button: (Symbol button) -> void
|
|
578
|
+
|
|
579
|
+
# @param [Symbol] button
|
|
580
|
+
def write_as_press_button_only: (Symbol button) -> void
|
|
581
|
+
|
|
582
|
+
# @param [Integer] cap
|
|
583
|
+
def write_as_apply_left_analog_stick_cap: (cap: Integer cap) -> void
|
|
584
|
+
end
|
|
585
|
+
|
|
586
|
+
module ProconBypassMan
|
|
587
|
+
class HttpClient
|
|
588
|
+
@server_pool: untyped
|
|
589
|
+
@uri: ::URI
|
|
590
|
+
@retry_on_connection_error: false
|
|
591
|
+
|
|
592
|
+
def initialize: (path: String, server_pool: untyped, ?retry_on_connection_error: false) -> void
|
|
593
|
+
def get: -> nil
|
|
594
|
+
def post: (request_body: untyped) -> nil
|
|
595
|
+
def put: (request_body: untyped) -> nil
|
|
596
|
+
|
|
597
|
+
private
|
|
598
|
+
def process_response: (untyped response) -> untyped
|
|
599
|
+
def handle_request: { -> bot } -> nil
|
|
600
|
+
|
|
601
|
+
class HttpRequest
|
|
602
|
+
class Get
|
|
603
|
+
def self.request!: (uri: ::URI) -> untyped
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
class Post
|
|
607
|
+
def self.request!: (uri: ::URI, ?request_body: Hash[untyped, untyped]) -> untyped
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
class Put
|
|
611
|
+
def self.request!: (uri: ::URI, ?request_body: {hostname: String}) -> untyped
|
|
612
|
+
end
|
|
613
|
+
end
|
|
614
|
+
end
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
module ProconBypassMan
|
|
618
|
+
class SendDeviceStatsHttpClient
|
|
619
|
+
def post: (status: ::Symbol, pbm_session_id: String) -> untyped
|
|
620
|
+
end
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
module ProconBypassMan
|
|
624
|
+
class ReportHttpClient
|
|
625
|
+
def post: (body: Hash[untyped, untyped] | String, event_type: ::Symbol) -> untyped
|
|
626
|
+
end
|
|
627
|
+
end
|
|
628
|
+
|
|
629
|
+
module ProconBypassMan
|
|
630
|
+
class UpdateRemotePbmActionStatusHttpClient
|
|
631
|
+
def post: (to_status: ::Symbol) -> untyped
|
|
632
|
+
end
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
module ProconBypassMan
|
|
636
|
+
class ServerPool
|
|
637
|
+
@servers: Array[String]
|
|
638
|
+
@index: Integer?
|
|
639
|
+
|
|
640
|
+
def initialize: (servers: Array[String]) -> void
|
|
641
|
+
def pick: -> String?
|
|
642
|
+
def server: -> String?
|
|
643
|
+
def next!: -> nil
|
|
644
|
+
|
|
645
|
+
private
|
|
646
|
+
def reset: -> Integer
|
|
647
|
+
def inc_index: -> Integer
|
|
648
|
+
end
|
|
649
|
+
end
|
|
650
|
+
|
|
651
|
+
module ProconBypassMan
|
|
652
|
+
class CompressArray
|
|
653
|
+
@array: [String]
|
|
654
|
+
|
|
655
|
+
def initialize: ([String] array) -> void
|
|
656
|
+
def compress: -> Array[String?]
|
|
657
|
+
|
|
658
|
+
class CompressibleValue
|
|
659
|
+
@prev: String?
|
|
660
|
+
@current: String
|
|
661
|
+
|
|
662
|
+
def initialize: (String? prev, String current) -> void
|
|
663
|
+
def compress?: -> bool
|
|
664
|
+
def to_s_with_mark: -> String?
|
|
665
|
+
end
|
|
666
|
+
end
|
|
667
|
+
end
|
|
668
|
+
|
|
669
|
+
module ProconBypassMan
|
|
670
|
+
module Callbacks
|
|
671
|
+
def run_callbacks: (untyped kind) -> untyped
|
|
672
|
+
def get_callbacks: (untyped kind) -> untyped
|
|
673
|
+
def set_callbacks: (untyped name, untyped callbacks) -> untyped
|
|
674
|
+
|
|
675
|
+
class CallbacksChain
|
|
676
|
+
@block: nil
|
|
677
|
+
|
|
678
|
+
attr_accessor filter: untyped
|
|
679
|
+
attr_accessor chain_method: untyped
|
|
680
|
+
def initialize: (filter: untyped, chain_method: untyped, block: nil) -> void
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
module M
|
|
684
|
+
end
|
|
685
|
+
|
|
686
|
+
module ClassMethods
|
|
687
|
+
def define_callbacks: (untyped name) -> untyped
|
|
688
|
+
def set_callback: (untyped kind, untyped filter, untyped chain_method) -> CallbacksChain
|
|
689
|
+
end
|
|
690
|
+
end
|
|
691
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class ProconBypassMan::OnMemoryCache
|
|
2
|
+
class CacheValue
|
|
3
|
+
# @param [Time]
|
|
4
|
+
attr_accessor expired_at: Time
|
|
5
|
+
|
|
6
|
+
attr_accessor value: untyped
|
|
7
|
+
|
|
8
|
+
def initialize: (expired_at: Time, value: untyped) -> void
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize: () -> void
|
|
12
|
+
|
|
13
|
+
# @param [Integer] expires_in 秒数
|
|
14
|
+
# @param [String] key
|
|
15
|
+
def fetch: (key: string, expires_in: Time) { () -> untyped } -> untyped
|
|
16
|
+
end
|
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.
|
|
4
|
+
version: 0.1.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- jiikko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-01-
|
|
11
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pbmenv
|
|
@@ -77,6 +77,7 @@ files:
|
|
|
77
77
|
- bin/dev_api_server.rb
|
|
78
78
|
- bin/setup
|
|
79
79
|
- docs/how_to_connect_procon.md
|
|
80
|
+
- docs/setting/left-analogstick-cap.md
|
|
80
81
|
- docs/setup_raspi.md
|
|
81
82
|
- docs/setup_raspi.mitamae.rb
|
|
82
83
|
- docs/setup_raspi_by_mitamae.md
|
|
@@ -175,6 +176,7 @@ files:
|
|
|
175
176
|
- project_template/web.rb
|
|
176
177
|
- sig/README.md
|
|
177
178
|
- sig/main.rbs
|
|
179
|
+
- sig/on_memory_cache.rbs
|
|
178
180
|
homepage: https://github.com/splaplapla/procon_bypass_man
|
|
179
181
|
licenses:
|
|
180
182
|
- MIT
|
|
@@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
197
199
|
- !ruby/object:Gem::Version
|
|
198
200
|
version: '0'
|
|
199
201
|
requirements: []
|
|
200
|
-
rubygems_version: 3.
|
|
202
|
+
rubygems_version: 3.2.15
|
|
201
203
|
signing_key:
|
|
202
204
|
specification_version: 4
|
|
203
205
|
summary: An extension for Nintendo Switch Pro Controller
|