procon_bypass_man 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/docs/setting/splatoon2_macro_forward_ikarole.md +34 -0
- data/docs/setup_raspi.md +12 -15
- data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +1 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +2 -1
- data/lib/procon_bypass_man/buttons_setting_configuration.rb +11 -0
- data/lib/procon_bypass_man/bypass/bypass_command.rb +1 -1
- data/lib/procon_bypass_man/bypass/procon_to_switch.rb +13 -2
- data/lib/procon_bypass_man/configuration.rb +1 -0
- data/lib/procon_bypass_man/device_connection/procon_setting_overrider.rb +0 -3
- data/lib/procon_bypass_man/ephemeral_configuration.rb +9 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/{dasei_cancel.rb → forward_ikarole.rb} +4 -4
- data/lib/procon_bypass_man/plugins.rb +1 -1
- data/lib/procon_bypass_man/procon/analog_stick_manipulator.rb +16 -4
- data/lib/procon_bypass_man/procon/macro_builder.rb +11 -0
- data/lib/procon_bypass_man/procon/performance_measurement.rb +1 -1
- data/lib/procon_bypass_man/procon/rumbler.rb +18 -0
- data/lib/procon_bypass_man/procon/user_operation.rb +1 -1
- data/lib/procon_bypass_man/procon.rb +5 -13
- data/lib/procon_bypass_man/runner.rb +0 -1
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man.rb +6 -1
- data/project_template/app.rb +1 -1
- data/project_template/app.rb.erb +1 -1
- data/project_template/setting.yml +3 -0
- metadata +6 -5
- data/docs/setting/splatoon2_macro_dasei_cancel.md +0 -77
- data/lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d7e6a739dbaf4be4022b97c591828d5ccca8d947c0c3bc0a0a8ffa8097a2b95
|
4
|
+
data.tar.gz: f7ad824a4e34d051c3f3514d18f6c6ab4b3e23b0cf6d9c574af1038afe9118b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ab67436d5d4dbca83ec68d42b0621d6737370388e10d5d86738914506dd6261aa6f495b7074f36ec685d1392b433ec1d7070f9417c2dfe4e7927b6840829633
|
7
|
+
data.tar.gz: 4c0034304beda74a99126b4dfd1cd35b2f0ac00b78c200dea9f6bfd64a19b0c39407a4e24afcd0914764e9899058a328e4a1c18130efc83421eb7202b2543e1c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.3.1] - 2022-10-07
|
2
|
+
* レイヤーを変更しているときにコントローラーを振動できるようになりました
|
3
|
+
* setting.yml で `enable(:rumble_on_layer_change)` と記述してください
|
4
|
+
* イカロールをするマクロを追加しました
|
5
|
+
* 詳しい設定方法については docs/setting/splatoon2_macro_forward_ikarole.md を参照してください
|
6
|
+
* スプラ用マクロ、惰性キャンセルを削除しました
|
7
|
+
|
1
8
|
## [0.3.0] - 2022-9-9
|
2
9
|
* 表示入力機能を一時的に削除しました #185
|
3
10
|
* バイパス処理中の小さなラグがほぼなくなりました #185
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
# スプラトゥーン2: イカロール マクロの設定方法
|
2
|
+
|
3
|
+
* procon_bypass_man: 0.3.1以上が必要です
|
4
|
+
* このマクロは、右から上へ高速にスティックを入れることでイカロールを行います
|
5
|
+
* 後述する設定例では、左スティックを押し込むことでイカロールを発動してます
|
6
|
+
|
7
|
+
https://user-images.githubusercontent.com/1664497/193837089-1c56af8d-2c1b-436a-b2a7-89c083a408d7.mov
|
8
|
+
|
9
|
+
|
10
|
+
## 設定例1
|
11
|
+
```yaml
|
12
|
+
version: 1.0
|
13
|
+
setting: |-
|
14
|
+
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
15
|
+
|
16
|
+
layer :up do
|
17
|
+
open_macro :forward_ikarole, steps: [:forward_ikarole1], if_pressed: [:thumbl], force_neutral: []
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
## 設定例2
|
22
|
+
pluginとして登録してあるので、 `macro` を使っても同じことができます。
|
23
|
+
|
24
|
+
```yaml
|
25
|
+
version: 1.0
|
26
|
+
setting: |-
|
27
|
+
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
28
|
+
|
29
|
+
install_macro_plugin(ProconBypassMan::Plugin::Splatoon2::Macro::ForwardIkarole)
|
30
|
+
|
31
|
+
layer :up do
|
32
|
+
macro ProconBypassMan::Plugin::Splatoon2::Macro::ForwardIkarole, if_pressed: [:thumbl], force_neutral: []
|
33
|
+
end
|
34
|
+
```
|
data/docs/setup_raspi.md
CHANGED
@@ -1,41 +1,38 @@
|
|
1
1
|
https://github.com/splaplapla/procon_bypass_man/blob/master/docs/setup_raspi_by_mitamae.md に半自動化した手順があります
|
2
2
|
|
3
3
|
# Raspberry Pi4のセットアップ手順
|
4
|
-
* SDカードにRaspberry Pi OS (32-bit)を焼く
|
4
|
+
* SDカードにRaspberry Pi OS (32 or 64-bit)を焼く
|
5
5
|
* SDカードをRaspberry Pi4本体に挿して起動する
|
6
6
|
* ラズパイGUI
|
7
7
|
* 無線LANに接続する
|
8
8
|
* sshdを許可する
|
9
9
|
* macからsshする
|
10
|
+
* sudo apt-get update
|
10
11
|
* sudo apt-get dist-upgrade
|
11
|
-
* hostnameを変える
|
12
|
-
* sudo hostnamectl set-hostname raspizero
|
13
|
-
* /etc/hosts に追記する
|
14
|
-
* 仮想メモリを増やす(optional)
|
15
|
-
* /etc/dphys-swapfile を CONF_SWAPSIZE=1024 にする
|
16
|
-
* sudo /etc/init.d/dphys-swapfile restart && swapon -s
|
17
|
-
* tailscale をインストールする(optional)
|
18
12
|
* sudo apt-get install vim rbenv git -y
|
19
13
|
* rbenvでrubyを入れる
|
20
14
|
* git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
|
21
15
|
* rbenv install 3.0.1
|
22
16
|
* rbenv local 3.0.1
|
23
17
|
* gem i bundler
|
24
|
-
* sshkeyを作成する
|
25
|
-
* github に鍵を登録する
|
26
|
-
* ~/.ssh/authorized_keys に鍵を登録する
|
27
18
|
* ガジェットモードで起動する
|
28
19
|
* /boot/config.txtに、dtoverlay=dwc2を追記
|
29
20
|
* echo "dwc2" | sudo tee -a /etc/modules
|
30
21
|
* echo "libcomposite" | sudo tee -a /etc/modules
|
31
22
|
* sudo cat /etc/modules
|
32
|
-
* cd ~ && wget https://gist.githubusercontent.com/jiikko/3f9fb3194c0cc7685e31fbfcb5b5f9ff/raw/23ddee29d94350be80b79d290ac3c8ce8400bd88/add_procon_gadget.sh
|
33
|
-
* chmod 755 ~/add_procon_gadget.sh
|
34
23
|
* sudo reboot
|
35
|
-
* sudo sh ~/add_procon_gadget.sh の実行に成功させる
|
36
24
|
* cd ~ && mkdir -p src && cd ~/src && git clone https://github.com/jiikko/procon_bypass_man_sample && cd procon_bypass_man_sample
|
37
25
|
|
38
|
-
|
26
|
+
おわりです.
|
27
|
+
|
28
|
+
起動する時は下記を確認の上、`sudo /home/pi/.rbenv/versions/3.0.1/bin/ruby app.rb` を実行してください。
|
29
|
+
|
30
|
+
* 「ラズパイとSwitch」と「ラズパイとプロコン」を **データ通信可能なケーブル** で接続する
|
31
|
+
* **Proコントローラーの有線通信** をONにする
|
32
|
+
|
33
|
+
|
34
|
+
![image](https://user-images.githubusercontent.com/1664497/193258615-1da27049-6d1f-4bfc-af1d-2f894f9c610e.png)
|
35
|
+
|
39
36
|
|
40
37
|
## 参考
|
41
38
|
* https://mtosak-tech.hatenablog.jp/entry/2020/08/22/114622
|
@@ -53,6 +53,7 @@ module ProconBypassMan
|
|
53
53
|
end
|
54
54
|
|
55
55
|
# @param [String, Class] プラグインのclass
|
56
|
+
# @param [Hash, NilClass] if_tilted_left_stick 非推奨
|
56
57
|
def macro(name, if_pressed: nil, if_tilted_left_stick: nil, force_neutral: nil)
|
57
58
|
case if_tilted_left_stick
|
58
59
|
when Integer, String, Symbol, Array
|
@@ -21,7 +21,7 @@ module ProconBypassMan
|
|
21
21
|
rescue SyntaxError
|
22
22
|
fallback_setting_if_has_backup(current_setting_path: setting_path)
|
23
23
|
raise ProconBypassMan::CouldNotLoadConfigError, "Rubyスクリプトのシンタックスエラーです"
|
24
|
-
rescue
|
24
|
+
rescue NameError
|
25
25
|
fallback_setting_if_has_backup(current_setting_path: setting_path)
|
26
26
|
raise ProconBypassMan::CouldNotLoadConfigError, "Rubyスクリプトに未定義の定数・変数があります"
|
27
27
|
rescue Psych::SyntaxError
|
@@ -52,6 +52,7 @@ module ProconBypassMan
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.reload_setting
|
55
|
+
ProconBypassMan.ephemeral_config.reset!
|
55
56
|
self.load(setting_path: ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path)
|
56
57
|
end
|
57
58
|
|
@@ -98,6 +98,17 @@ module ProconBypassMan
|
|
98
98
|
@prefix_keys_for_changing_layer
|
99
99
|
end
|
100
100
|
|
101
|
+
# @param [Symbol, String] setting_name
|
102
|
+
# @return [void]
|
103
|
+
def enable(setting_name)
|
104
|
+
case setting_name.to_sym
|
105
|
+
when :rumble_on_layer_change
|
106
|
+
ProconBypassMan.ephemeral_config.enable_rumble_on_layer_change = true
|
107
|
+
else
|
108
|
+
warn "存在しないenable(#{setting_name.to_sym})が呼び出されました。"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
101
112
|
def reset!
|
102
113
|
@prefix_keys_for_changing_layer = []
|
103
114
|
self.mode_plugins = {}
|
@@ -53,9 +53,20 @@ class ProconBypassMan::Bypass::ProconToSwitch
|
|
53
53
|
begin
|
54
54
|
# 終了処理を希望されているのでブロックを無視してメソッドを抜けてOK
|
55
55
|
return(false) if $will_terminate_token # rubocop:disable Lint/NoReturnInBeginEndBlocks
|
56
|
-
|
56
|
+
binary = ::ProconBypassMan::Procon::Rumbler.monitor do
|
57
57
|
ProconBypassMan::Processor.new(bypass_value.binary).process
|
58
|
-
|
58
|
+
end
|
59
|
+
self.gadget.write_nonblock(binary)
|
60
|
+
|
61
|
+
if ProconBypassMan.ephemeral_config.enable_rumble_on_layer_change && ProconBypassMan::Procon::Rumbler.must_rumble?
|
62
|
+
begin
|
63
|
+
self.procon.write_nonblock(ProconBypassMan::Procon::Rumbler.binary)
|
64
|
+
ProconBypassMan.logger.debug { ProconBypassMan::Procon::Rumbler.binary.unpack('H*').first }
|
65
|
+
rescue => e
|
66
|
+
ProconBypassMan::SendErrorCommand.execute(error: e)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
59
70
|
next(true)
|
60
71
|
rescue IO::EAGAINWaitReadable
|
61
72
|
return(false) if $will_terminate_token # rubocop:disable Lint/NoReturnInBeginEndBlocks
|
@@ -5,17 +5,14 @@ class ProconBypassMan::DeviceConnection::ProconSettingOverrider
|
|
5
5
|
SUB_COMMAND_VIBRATION = "48"
|
6
6
|
|
7
7
|
SUB_COMMAND_ARG_HOME_LED_ON = "1FF0FF"
|
8
|
-
SUB_COMMAND_ARG_VIBRATION_OFF = "00"
|
9
8
|
|
10
9
|
ALL_SETTINGS = {
|
11
10
|
home_led_on: [SUB_COMMAND_HOME_LED_ON, SUB_COMMAND_ARG_HOME_LED_ON],
|
12
|
-
vibration_off: [SUB_COMMAND_VIBRATION, SUB_COMMAND_ARG_VIBRATION_OFF],
|
13
11
|
}
|
14
12
|
|
15
13
|
# TODO 自動生成する
|
16
14
|
SPECIAL_SUB_COMMAND_ARGS = {
|
17
15
|
SUB_COMMAND_HOME_LED_ON => SUB_COMMAND_ARG_HOME_LED_ON,
|
18
|
-
SUB_COMMAND_VIBRATION => SUB_COMMAND_ARG_VIBRATION_OFF,
|
19
16
|
}
|
20
17
|
|
21
18
|
def initialize(procon: )
|
@@ -2,17 +2,17 @@ module ProconBypassMan
|
|
2
2
|
module Plugin
|
3
3
|
module Splatoon2
|
4
4
|
module Macro
|
5
|
-
module
|
5
|
+
module ForwardIkarole
|
6
6
|
def self.display_name
|
7
|
-
:
|
7
|
+
:forward_ikarole
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.steps
|
11
|
-
[:
|
11
|
+
[:forward_ikarole1].freeze
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.description
|
15
|
-
'
|
15
|
+
'前方にイカロールをします'
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -4,7 +4,7 @@ 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/
|
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
|
|
@@ -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
|
-
|
24
|
-
|
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(
|
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
|
-
|
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
|
data/lib/procon_bypass_man.rb
CHANGED
@@ -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!
|
data/project_template/app.rb
CHANGED
@@ -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.
|
15
|
+
gem 'procon_bypass_man', '0.3.1'
|
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
|
data/project_template/app.rb.erb
CHANGED
@@ -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.
|
15
|
+
gem 'procon_bypass_man', '0.3.1'
|
16
16
|
end
|
17
17
|
rescue Bundler::Source::Git::GitCommandError => e
|
18
18
|
retry_count_on_git_command_error = retry_count_on_git_command_error + 1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: procon_bypass_man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pbmenv
|
@@ -95,7 +95,7 @@ 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/
|
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
|
@@ -161,9 +161,10 @@ files:
|
|
161
161
|
- lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
|
162
162
|
- lib/procon_bypass_man/device_model.rb
|
163
163
|
- lib/procon_bypass_man/device_status.rb
|
164
|
+
- lib/procon_bypass_man/ephemeral_configuration.rb
|
164
165
|
- lib/procon_bypass_man/plugin/splatoon2/macro/charge_tansan_bomb.rb
|
165
|
-
- lib/procon_bypass_man/plugin/splatoon2/macro/dasei_cancel.rb
|
166
166
|
- lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb
|
167
|
+
- lib/procon_bypass_man/plugin/splatoon2/macro/forward_ikarole.rb
|
167
168
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
|
168
169
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb
|
169
170
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb
|
@@ -194,6 +195,7 @@ files:
|
|
194
195
|
- lib/procon_bypass_man/procon/performance_measurement/span_queue.rb
|
195
196
|
- lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
|
196
197
|
- lib/procon_bypass_man/procon/press_button_aware.rb
|
198
|
+
- lib/procon_bypass_man/procon/rumbler.rb
|
197
199
|
- lib/procon_bypass_man/procon/suppress_rumble.rb
|
198
200
|
- lib/procon_bypass_man/procon/user_operation.rb
|
199
201
|
- lib/procon_bypass_man/procon/value_objects/analog_stick.rb
|
@@ -232,7 +234,6 @@ files:
|
|
232
234
|
- lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb
|
233
235
|
- lib/procon_bypass_man/runner.rb
|
234
236
|
- lib/procon_bypass_man/scheduler.rb
|
235
|
-
- lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
|
236
237
|
- lib/procon_bypass_man/support/callbacks.rb
|
237
238
|
- lib/procon_bypass_man/support/can_over_process.rb
|
238
239
|
- 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,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
|