procon_bypass_man 0.1.20.2 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +9 -5
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +30 -1
- data/Gemfile.lock +4 -4
- data/README.md +4 -1
- data/docs/getting_started.md +81 -11
- data/docs/setting/left-analogstick-cap.md +1 -1
- data/docs/setting/splatoon2_macro_dasei_cancel.md +77 -0
- data/docs/setting/splatoon2_macro_sokuwari_bubble.md +4 -0
- data/docs/setting/splatoon2_shake_tansan.md +47 -0
- data/lib/procon_bypass_man/background/jobs/post_completed_remote_macro_job.rb +17 -0
- data/lib/procon_bypass_man/background.rb +1 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +155 -70
- data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +2 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button.rb +28 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list.rb +31 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/disable_macro_if_pressed.rb +28 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/flip_if_pressed.rb +31 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/force_neutral.rb +28 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed.rb +26 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed_allows_nil.rb +28 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/open_macro_steps.rb +26 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer.rb +17 -0
- data/lib/procon_bypass_man/buttons_setting_configuration.rb +6 -5
- data/lib/procon_bypass_man/bypass/usb_hid_logger.rb +4 -0
- data/lib/procon_bypass_man/bypass.rb +45 -23
- data/lib/procon_bypass_man/commands/bypass_command.rb +30 -10
- data/lib/procon_bypass_man/commands/print_boot_message_command.rb +1 -1
- data/lib/procon_bypass_man/configuration.rb +8 -1
- data/lib/procon_bypass_man/device_connector.rb +55 -174
- data/lib/procon_bypass_man/plugin/splatoon2/macro/charge_tansan_bomb.rb +21 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/dasei_cancel.rb +21 -0
- data/lib/procon_bypass_man/plugin/splatoon2/version.rb +1 -1
- data/lib/procon_bypass_man/plugins.rb +2 -0
- data/lib/procon_bypass_man/procon/analog_stick_cap.rb +4 -23
- data/lib/procon_bypass_man/procon/analog_stick_manipulator.rb +36 -0
- data/lib/procon_bypass_man/procon/button_collection.rb +0 -8
- data/lib/procon_bypass_man/procon/layer_changer.rb +4 -1
- data/lib/procon_bypass_man/procon/macro.rb +53 -25
- data/lib/procon_bypass_man/procon/macro_builder.rb +43 -35
- data/lib/procon_bypass_man/procon/macro_plugin_map.rb +23 -0
- data/lib/procon_bypass_man/procon/macro_registry.rb +26 -10
- data/lib/procon_bypass_man/procon/suppress_rumble.rb +13 -0
- data/lib/procon_bypass_man/procon/user_operation.rb +30 -16
- data/lib/procon_bypass_man/procon/value_objects/analog_stick.rb +9 -5
- data/lib/procon_bypass_man/procon/value_objects/analog_stick_position.rb +18 -0
- data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/base.rb +0 -0
- data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/has_immutable_binary.rb +0 -0
- data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/has_mutable_binary.rb +0 -0
- data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/inbound_procon_binary.rb +5 -0
- data/lib/procon_bypass_man/{domains → procon/value_objects}/binary/processing_procon_binary.rb +7 -2
- data/lib/procon_bypass_man/procon/value_objects/binary.rb +11 -0
- data/lib/procon_bypass_man/{bypass → procon/value_objects}/bypass_mode.rb +0 -0
- data/lib/procon_bypass_man/procon/value_objects/rumble_binary.rb +18 -0
- data/lib/procon_bypass_man/procon.rb +59 -17
- data/lib/procon_bypass_man/remote_macro/queue_over_process.rb +62 -0
- data/lib/procon_bypass_man/remote_macro/remote_macro_object.rb +30 -0
- data/lib/procon_bypass_man/remote_macro/remote_macro_receiver.rb +37 -0
- data/lib/procon_bypass_man/remote_macro/remote_macro_sender.rb +8 -0
- data/lib/procon_bypass_man/remote_macro/task.rb +6 -0
- data/lib/procon_bypass_man/remote_macro/task_queue.rb +13 -0
- data/lib/procon_bypass_man/remote_macro.rb +14 -0
- data/lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb +1 -1
- data/lib/procon_bypass_man/remote_pbm_action.rb +1 -0
- data/lib/procon_bypass_man/runner.rb +11 -7
- data/lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb +59 -0
- data/lib/procon_bypass_man/support/cycle_sleep.rb +22 -0
- data/lib/procon_bypass_man/support/device_mouse_finder.rb +60 -0
- data/lib/procon_bypass_man/{device_procon_finder.rb → support/device_procon_finder.rb} +0 -2
- data/lib/procon_bypass_man/{never_exit_accidentally.rb → support/never_exit_accidentally.rb} +0 -0
- data/lib/procon_bypass_man/support/remote_macro_http_client.rb +9 -0
- data/lib/procon_bypass_man/support/safe_timeout.rb +7 -1
- data/lib/procon_bypass_man/{usb_device_controller.rb → support/usb_device_controller.rb} +7 -4
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man/websocket/{pbm_job_client.rb → client.rb} +34 -12
- data/lib/procon_bypass_man/websocket/forever.rb +47 -0
- data/lib/procon_bypass_man/websocket/watchdog.rb +19 -0
- data/lib/procon_bypass_man.rb +25 -23
- data/procon_bypass_man.gemspec +1 -1
- data/project_template/app.rb +13 -4
- data/sig/main.rbs +21 -13
- metadata +46 -14
- data/lib/procon_bypass_man/domains.rb +0 -11
@@ -1,12 +1,13 @@
|
|
1
1
|
module ProconBypassMan
|
2
2
|
class ButtonsSettingConfiguration
|
3
3
|
class Layer
|
4
|
-
attr_accessor :mode, :flips, :macros, :remaps, :left_analog_stick_caps, :disables
|
4
|
+
attr_accessor :mode, :flips, :macros, :disable_macros, :remaps, :left_analog_stick_caps, :disables
|
5
5
|
|
6
6
|
def initialize(mode: :manual)
|
7
7
|
self.mode = mode
|
8
8
|
self.flips = {}
|
9
9
|
self.macros = {}
|
10
|
+
self.disable_macros = []
|
10
11
|
self.remaps = {}
|
11
12
|
self.left_analog_stick_caps = []
|
12
13
|
self.disables = []
|
@@ -14,31 +15,29 @@ module ProconBypassMan
|
|
14
15
|
|
15
16
|
# @param [Symbol] button
|
16
17
|
def flip(button, if_pressed: false, force_neutral: nil, flip_interval: nil)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
begin
|
19
|
+
button = ParamNormalizer::Button.new(button).to_value!
|
20
|
+
rescue ParamNormalizer::UnSupportValueError
|
21
|
+
Kernel.warn "設定ファイルに記述ミスがあります. flipの第一引数にはボタンを渡してください."
|
22
|
+
return
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
if_pressed = ParamNormalizer::FlipIfPressed.new(if_pressed, button: button).to_value!
|
27
|
+
rescue ParamNormalizer::UnSupportValueError
|
28
|
+
Kernel.warn "設定ファイルに記述ミスがあります. flipのif_pressedにはボタンを渡してください."
|
29
|
+
return
|
28
30
|
end
|
29
31
|
|
30
32
|
hash = { if_pressed: if_pressed }
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
# no-op
|
40
|
-
else
|
41
|
-
raise "not support value"
|
33
|
+
|
34
|
+
begin
|
35
|
+
if(force_neutral = ParamNormalizer::ForceNeutral.new(force_neutral).to_value!)
|
36
|
+
hash[:force_neutral] = force_neutral
|
37
|
+
end
|
38
|
+
rescue ParamNormalizer::UnSupportValueError
|
39
|
+
Kernel.warn "設定ファイルに記述ミスがあります. flipのforce_neutralにはボタンを渡してください."
|
40
|
+
return
|
42
41
|
end
|
43
42
|
|
44
43
|
if flip_interval
|
@@ -54,79 +53,165 @@ module ProconBypassMan
|
|
54
53
|
end
|
55
54
|
|
56
55
|
# @param [String, Class] プラグインのclass
|
57
|
-
def macro(name, if_pressed: )
|
56
|
+
def macro(name, if_pressed: nil, if_tilted_left_stick: nil, force_neutral: nil)
|
57
|
+
case if_tilted_left_stick
|
58
|
+
when Integer, String, Symbol, Array
|
59
|
+
warn "macro #{name}のif_tilted_left_stickで想定外の値です"
|
60
|
+
if_tilted_left_stick = nil
|
61
|
+
when TrueClass, NilClass, FalseClass
|
62
|
+
# OK
|
63
|
+
else
|
64
|
+
Kernel.warn "設定ファイルに記述ミスがあります. 未対応の値を受け取りました."
|
65
|
+
return
|
66
|
+
end
|
67
|
+
|
68
|
+
begin
|
69
|
+
if(fn = ParamNormalizer::ForceNeutral.new(force_neutral).to_value!)
|
70
|
+
force_neutral = fn
|
71
|
+
end
|
72
|
+
rescue ParamNormalizer::UnSupportValueError
|
73
|
+
Kernel.warn "設定ファイルに記述ミスがあります. macroのforce_neutralにはボタンを渡してください."
|
74
|
+
return
|
75
|
+
end
|
76
|
+
|
77
|
+
begin
|
78
|
+
if_pressed = ParamNormalizer::IfPressed.new(if_pressed).to_value!
|
79
|
+
rescue ParamNormalizer::UnSupportValueError
|
80
|
+
Kernel.warn "設定ファイルに記述ミスがあります. macroのif_pressedにはボタンを渡してください."
|
81
|
+
return
|
82
|
+
end
|
83
|
+
|
58
84
|
macro_name = name.to_s.to_sym
|
59
|
-
|
85
|
+
if ProconBypassMan::ButtonsSettingConfiguration.instance.macro_plugins[macro_name]
|
86
|
+
self.macros[macro_name] = { if_pressed: if_pressed, if_tilted_left_stick: if_tilted_left_stick, force_neutral: force_neutral }.compact
|
87
|
+
else
|
88
|
+
warn "#{macro_name}マクロがinstallされていません"
|
89
|
+
end
|
60
90
|
end
|
61
91
|
|
62
92
|
# 設定ファイルに直接マクロを打ち込める
|
63
93
|
# @param [String, Class] macroの識別子
|
64
94
|
# @paramh[Array<Symbol>] macroの本体. ボタンの配列
|
65
|
-
def open_macro(name, steps: , if_pressed: )
|
95
|
+
def open_macro(name, steps: [], if_pressed: nil, if_tilted_left_stick: nil, force_neutral: nil)
|
96
|
+
if name.nil?
|
97
|
+
Kernel.warn "設定ファイルに記述ミスがあります. open_macroのnameには一意になる名前を渡してください."
|
98
|
+
return
|
99
|
+
end
|
100
|
+
|
101
|
+
begin
|
102
|
+
steps = ParamNormalizer::OpenMacroSteps.new(steps).to_value!
|
103
|
+
rescue ParamNormalizer::UnSupportValueError
|
104
|
+
Kernel.warn "設定ファイルに記述ミスがあります. open_macroのstepsには文字列の配列を渡してください."
|
105
|
+
return
|
106
|
+
end
|
107
|
+
|
108
|
+
case if_tilted_left_stick
|
109
|
+
when Integer, String, Symbol, Array
|
110
|
+
warn "open_macro #{name}のif_tilted_left_stickで想定外の値です"
|
111
|
+
if_tilted_left_stick = nil
|
112
|
+
when TrueClass, NilClass, FalseClass, Hash
|
113
|
+
# OK
|
114
|
+
else
|
115
|
+
Kernel.warn "設定ファイルに記述ミスがあります. 未対応の値を受け取りました."
|
116
|
+
return
|
117
|
+
end
|
118
|
+
|
119
|
+
begin
|
120
|
+
force_neutral = ParamNormalizer::ForceNeutral.new(force_neutral).to_value!
|
121
|
+
rescue ParamNormalizer::UnSupportValueError
|
122
|
+
Kernel.warn "設定ファイルに記述ミスがあります. open_macroのforce_neutralにはボタンを渡してください."
|
123
|
+
return
|
124
|
+
end
|
125
|
+
|
126
|
+
begin
|
127
|
+
if_pressed = ParamNormalizer::IfPressed.new(if_pressed).to_value!
|
128
|
+
rescue ParamNormalizer::UnSupportValueError
|
129
|
+
Kernel.warn "設定ファイルに記述ミスがあります. open_macroのif_pressedにはボタンを渡してください."
|
130
|
+
return
|
131
|
+
end
|
132
|
+
|
66
133
|
macro_name = name || "OpenMacro-#{steps.join}".to_sym
|
67
134
|
ProconBypassMan::Procon::MacroRegistry.install_plugin(macro_name, steps: steps)
|
68
|
-
self.macros[macro_name] = { if_pressed: if_pressed }
|
135
|
+
self.macros[macro_name] = { if_pressed: if_pressed, if_tilted_left_stick: if_tilted_left_stick, force_neutral: force_neutral }.compact
|
69
136
|
end
|
70
137
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
when Symbol, String
|
76
|
-
self.remaps[button] = { to: [to] }
|
77
|
-
when Array
|
78
|
-
raise "ボタンを渡してください" if to.size.zero?
|
79
|
-
self.remaps[button] = { to: to }
|
138
|
+
def disable_macro(name, if_pressed: nil)
|
139
|
+
if name.nil?
|
140
|
+
Kernel.warn "設定ファイルに記述ミスがあります. disable_macroのnameにはmacro nameかクラス名の名前を渡してください."
|
141
|
+
return
|
80
142
|
end
|
143
|
+
|
144
|
+
hash = { name: name.to_s.to_sym, if_pressed: [] }
|
145
|
+
begin
|
146
|
+
if(if_pressed = ParamNormalizer::DisableMacroIfPressed.new(if_pressed).to_value!)
|
147
|
+
hash[:if_pressed] = if_pressed
|
148
|
+
end
|
149
|
+
rescue ParamNormalizer::UnSupportValueError
|
150
|
+
Kernel.warn "設定ファイルに記述ミスがあります. disable_macroのif_pressedにはボタンを渡してください."
|
151
|
+
return
|
152
|
+
end
|
153
|
+
|
154
|
+
disable_macros << hash
|
81
155
|
end
|
82
156
|
|
83
|
-
def
|
84
|
-
|
157
|
+
def remap(button, to: )
|
158
|
+
begin
|
159
|
+
button = ParamNormalizer::Button.new(button).to_value!
|
160
|
+
rescue ParamNormalizer::UnSupportValueError
|
161
|
+
Kernel.warn "設定ファイルに記述ミスがあります. remapにはボタンを渡してください."
|
162
|
+
return
|
163
|
+
end
|
164
|
+
|
165
|
+
begin
|
166
|
+
self.remaps[button] = { to: ParamNormalizer::ButtonList.new(to).to_value! }
|
167
|
+
rescue ParamNormalizer::UnSupportValueError
|
168
|
+
Kernel.warn "設定ファイルに記述ミスがあります. remapのtoにはボタンを渡してください."
|
169
|
+
return
|
170
|
+
end
|
171
|
+
end
|
85
172
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
# no-op
|
173
|
+
def left_analog_stick_cap(cap: nil, if_pressed: nil, force_neutral: nil)
|
174
|
+
case cap
|
175
|
+
when Integer
|
176
|
+
# OK
|
177
|
+
when Float
|
178
|
+
cap = cap.to_i
|
93
179
|
else
|
94
|
-
|
180
|
+
Kernel.warn "設定ファイルに記述ミスがあります. left_analog_stick_capのcapで未対応の値を受け取りました."
|
181
|
+
return
|
95
182
|
end
|
96
183
|
|
97
|
-
|
98
|
-
|
184
|
+
hash = { cap: cap }
|
185
|
+
|
186
|
+
begin
|
187
|
+
if(if_pressed = ParamNormalizer::IfPressedAllowsFalsy.new(if_pressed).to_value!)
|
188
|
+
hash[:if_pressed] = if_pressed
|
189
|
+
end
|
190
|
+
rescue ParamNormalizer::UnSupportValueError
|
191
|
+
Kernel.warn "設定ファイルに記述ミスがあります. left_analog_stick_capのif_pressedにはボタンを渡してください."
|
192
|
+
return
|
99
193
|
end
|
100
194
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
when FalseClass, NilClass
|
109
|
-
# no-op
|
110
|
-
else
|
111
|
-
raise "not support value"
|
195
|
+
begin
|
196
|
+
if(force_neutral = ParamNormalizer::ForceNeutral.new(force_neutral).to_value!)
|
197
|
+
hash[:force_neutral] = force_neutral
|
198
|
+
end
|
199
|
+
rescue ParamNormalizer::UnSupportValueError
|
200
|
+
Kernel.warn "設定ファイルに記述ミスがあります. left_analog_stick_capのforce_neutralにはボタンを渡してください."
|
201
|
+
return
|
112
202
|
end
|
113
203
|
|
114
204
|
left_analog_stick_caps << hash
|
115
205
|
end
|
116
206
|
|
117
207
|
def disable(button)
|
118
|
-
|
119
|
-
|
120
|
-
raise "not support class"
|
121
|
-
when Symbol
|
122
|
-
disables << button
|
123
|
-
when String
|
124
|
-
disables << button.to_sym
|
125
|
-
when Array
|
126
|
-
button.each { |b| disables << b }
|
127
|
-
else
|
128
|
-
raise "not support value"
|
208
|
+
ParamNormalizer::ButtonList.new(button).to_value!.each do |disable|
|
209
|
+
disables << disable
|
129
210
|
end
|
211
|
+
disables.uniq!
|
212
|
+
rescue ParamNormalizer::UnSupportValueError
|
213
|
+
Kernel.warn "設定ファイルに記述ミスがあります. disableにはボタンを渡してください."
|
214
|
+
return
|
130
215
|
end
|
131
216
|
|
132
217
|
# @return [Array]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ButtonsSettingConfiguration
|
3
|
+
module ParamNormalizer
|
4
|
+
class Button
|
5
|
+
attr_reader :button
|
6
|
+
|
7
|
+
def initialize(button)
|
8
|
+
@button = button
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_value!
|
12
|
+
case button
|
13
|
+
when TrueClass, FalseClass, NilClass, Array, Integer
|
14
|
+
raise UnSupportValueError
|
15
|
+
when Symbol, String
|
16
|
+
unless !!ProconBypassMan::Procon::ButtonCollection::BUTTONS_MAP[button.to_sym]
|
17
|
+
raise UnexpectedValueError
|
18
|
+
end
|
19
|
+
|
20
|
+
return button.to_sym
|
21
|
+
else
|
22
|
+
raise UnexpectedValueError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ButtonsSettingConfiguration
|
3
|
+
module ParamNormalizer
|
4
|
+
class ButtonList
|
5
|
+
attr_reader :button
|
6
|
+
|
7
|
+
def initialize(button)
|
8
|
+
@button = button
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Array]
|
12
|
+
# @raise [UnSupportValueError]
|
13
|
+
# @raise [UnexpectedValueError]
|
14
|
+
def to_value!
|
15
|
+
case button
|
16
|
+
when Integer, TrueClass, FalseClass, NilClass
|
17
|
+
raise UnSupportValueError
|
18
|
+
when Symbol
|
19
|
+
return [button]
|
20
|
+
when String
|
21
|
+
return [button.to_sym]
|
22
|
+
when Array
|
23
|
+
return button.map(&:to_sym).uniq
|
24
|
+
else
|
25
|
+
raise UnexpectedValueError
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ButtonsSettingConfiguration
|
3
|
+
module ParamNormalizer
|
4
|
+
class DisableMacroIfPressed
|
5
|
+
attr_reader :value
|
6
|
+
|
7
|
+
def initialize(value)
|
8
|
+
@value = value
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_value!
|
12
|
+
case value
|
13
|
+
when FalseClass, Integer, TrueClass
|
14
|
+
raise UnSupportValueError
|
15
|
+
when Symbol, String
|
16
|
+
return [value.to_sym]
|
17
|
+
when Array
|
18
|
+
return value.map(&:to_sym).uniq
|
19
|
+
when NilClass # 常に対象のmacroをdisableにする
|
20
|
+
return [true]
|
21
|
+
else
|
22
|
+
raise UnexpectedValueError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ButtonsSettingConfiguration
|
3
|
+
module ParamNormalizer
|
4
|
+
class FlipIfPressed
|
5
|
+
attr_reader :value
|
6
|
+
|
7
|
+
def initialize(value, button: )
|
8
|
+
@value = value
|
9
|
+
@button = button
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_value!
|
13
|
+
case value
|
14
|
+
when Integer
|
15
|
+
raise UnSupportValueError
|
16
|
+
when TrueClass
|
17
|
+
return [@button]
|
18
|
+
when Symbol, String
|
19
|
+
return [value.to_sym]
|
20
|
+
when Array
|
21
|
+
return value.map(&:to_sym).uniq
|
22
|
+
when FalseClass, NilClass
|
23
|
+
return false
|
24
|
+
else
|
25
|
+
raise UnexpectedValueError
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ButtonsSettingConfiguration
|
3
|
+
module ParamNormalizer
|
4
|
+
class ForceNeutral
|
5
|
+
attr_reader :force_neutral
|
6
|
+
|
7
|
+
def initialize(force_neutral)
|
8
|
+
@force_neutral = force_neutral
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_value!
|
12
|
+
case force_neutral
|
13
|
+
when Integer, TrueClass
|
14
|
+
raise UnSupportValueError
|
15
|
+
when Symbol, String
|
16
|
+
return [force_neutral.to_sym]
|
17
|
+
when Array
|
18
|
+
return force_neutral.map(&:to_sym).uniq
|
19
|
+
when FalseClass, NilClass
|
20
|
+
return nil
|
21
|
+
else
|
22
|
+
raise UnexpectedValueError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ButtonsSettingConfiguration
|
3
|
+
module ParamNormalizer
|
4
|
+
class IfPressed
|
5
|
+
attr_reader :value
|
6
|
+
|
7
|
+
def initialize(value)
|
8
|
+
@value = value
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_value!
|
12
|
+
case value
|
13
|
+
when Integer, TrueClass, FalseClass, NilClass
|
14
|
+
raise UnSupportValueError
|
15
|
+
when Symbol, String
|
16
|
+
return [value.to_sym]
|
17
|
+
when Array
|
18
|
+
return value.map(&:to_sym).uniq
|
19
|
+
else
|
20
|
+
raise UnexpectedValueError
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed_allows_nil.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ButtonsSettingConfiguration
|
3
|
+
module ParamNormalizer
|
4
|
+
class IfPressedAllowsFalsy
|
5
|
+
attr_reader :value
|
6
|
+
|
7
|
+
def initialize(value)
|
8
|
+
@value = value
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_value!
|
12
|
+
case value
|
13
|
+
when Integer, TrueClass
|
14
|
+
raise UnSupportValueError
|
15
|
+
when Symbol, String
|
16
|
+
return [value.to_sym]
|
17
|
+
when Array
|
18
|
+
return value.map(&:to_sym).uniq
|
19
|
+
when FalseClass, NilClass
|
20
|
+
# OK
|
21
|
+
else
|
22
|
+
raise UnexpectedValueError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ButtonsSettingConfiguration
|
3
|
+
module ParamNormalizer
|
4
|
+
class OpenMacroSteps
|
5
|
+
attr_reader :steps
|
6
|
+
|
7
|
+
def initialize(steps)
|
8
|
+
@steps = steps
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_value!
|
12
|
+
case steps
|
13
|
+
when Integer, TrueClass, FalseClass, NilClass
|
14
|
+
raise UnSupportValueError
|
15
|
+
when String, Symbol
|
16
|
+
return [steps.to_sym]
|
17
|
+
when Array
|
18
|
+
return steps.map(&:to_sym)
|
19
|
+
else
|
20
|
+
raise UnexpectedValueError
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "procon_bypass_man/buttons_setting_configuration/param_normalizer/button_list"
|
2
|
+
require "procon_bypass_man/buttons_setting_configuration/param_normalizer/button"
|
3
|
+
require "procon_bypass_man/buttons_setting_configuration/param_normalizer/force_neutral"
|
4
|
+
require "procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed_allows_nil"
|
5
|
+
require "procon_bypass_man/buttons_setting_configuration/param_normalizer/flip_if_pressed"
|
6
|
+
require "procon_bypass_man/buttons_setting_configuration/param_normalizer/disable_macro_if_pressed"
|
7
|
+
require "procon_bypass_man/buttons_setting_configuration/param_normalizer/if_pressed"
|
8
|
+
require "procon_bypass_man/buttons_setting_configuration/param_normalizer/open_macro_steps"
|
9
|
+
|
10
|
+
module ProconBypassMan
|
11
|
+
class ButtonsSettingConfiguration
|
12
|
+
module ParamNormalizer
|
13
|
+
class UnSupportValueError < StandardError; end
|
14
|
+
class UnexpectedValueError < UnSupportValueError; end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -3,7 +3,7 @@ require "procon_bypass_man/buttons_setting_configuration/loader"
|
|
3
3
|
require "procon_bypass_man/buttons_setting_configuration/layer"
|
4
4
|
|
5
5
|
module ProconBypassMan
|
6
|
-
class
|
6
|
+
class Position < Struct.new(:x, :y); end
|
7
7
|
|
8
8
|
class ButtonsSettingConfiguration
|
9
9
|
attr_accessor :layers,
|
@@ -65,7 +65,7 @@ module ProconBypassMan
|
|
65
65
|
end
|
66
66
|
|
67
67
|
unless ([ManualMode.name] + ProconBypassMan::Procon::ModeRegistry.plugins.keys).include?(mode_name)
|
68
|
-
|
68
|
+
warn "#{mode_name}モードがinstallされていません"
|
69
69
|
end
|
70
70
|
|
71
71
|
layer = Layer.new(mode: mode_name)
|
@@ -90,7 +90,7 @@ module ProconBypassMan
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def set_neutral_position(x, y)
|
93
|
-
self.neutral_position =
|
93
|
+
self.neutral_position = Position.new(x, y).freeze
|
94
94
|
self
|
95
95
|
end
|
96
96
|
|
@@ -103,14 +103,15 @@ module ProconBypassMan
|
|
103
103
|
self.mode_plugins = {}
|
104
104
|
# プロセスを一度起動するとsetting_pathは変わらない、という想定なので適当に扱う. resetでは初期化しない
|
105
105
|
# self.setting_path = nil
|
106
|
-
|
106
|
+
# どこかで初期化している気がするのでコメントアウト
|
107
|
+
self.macro_plugins = ProconBypassMan::Procon::MacroPluginMap.new # ProconBypassMan::Procon::MacroRegistry.reset!と重複している
|
107
108
|
self.layers = {
|
108
109
|
up: Layer.new,
|
109
110
|
down: Layer.new,
|
110
111
|
left: Layer.new,
|
111
112
|
right: Layer.new,
|
112
113
|
}
|
113
|
-
@neutral_position =
|
114
|
+
@neutral_position = Position.new(2124, 1808).freeze
|
114
115
|
end
|
115
116
|
end
|
116
117
|
end
|
@@ -10,6 +10,8 @@ class ProconBypassMan::Bypass
|
|
10
10
|
set_callback :send_procon_to_gadget, :after, :log_procon_to_gadget
|
11
11
|
|
12
12
|
def log_send_gadget_to_procon
|
13
|
+
return unless bypass_value.to_text
|
14
|
+
|
13
15
|
if ProconBypassMan.config.verbose_bypass_log
|
14
16
|
ProconBypassMan.logger.debug { ">>> #{bypass_value.to_text}" }
|
15
17
|
else
|
@@ -20,6 +22,8 @@ class ProconBypassMan::Bypass
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def log_procon_to_gadget
|
25
|
+
return unless bypass_value.to_text
|
26
|
+
|
23
27
|
if ProconBypassMan.config.verbose_bypass_log
|
24
28
|
ProconBypassMan.logger.debug { "<<< #{bypass_value.to_text}" }
|
25
29
|
else
|