procon_bypass_man 0.1.14 → 0.1.17
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 +1 -0
- data/.github/workflows/release.yml +33 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +28 -7
- data/README.md +26 -3
- data/Steepfile +31 -17
- data/docs/setting/left-analogstick-cap.md +60 -0
- data/docs/setup_raspi.md +2 -0
- data/docs/setup_raspi.mitamae.rb +7 -8
- data/docs/setup_raspi_by_mitamae.md +37 -1
- data/lib/ext/em_pure_ruby.rb +25 -0
- data/lib/procon_bypass_man/background.rb +0 -1
- data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +35 -13
- 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/bypass/usb_hid_logger.rb +6 -4
- data/lib/procon_bypass_man/bypass.rb +13 -6
- data/lib/procon_bypass_man/commands/print_boot_message_command.rb +50 -1
- data/lib/procon_bypass_man/commands/print_message_command.rb +8 -0
- data/lib/procon_bypass_man/commands/run_remote_pbm_action_dispatch_command.rb +3 -1
- data/lib/procon_bypass_man/commands/send_reload_config_event_command.rb +1 -2
- data/lib/procon_bypass_man/commands.rb +1 -0
- data/lib/procon_bypass_man/configuration.rb +32 -1
- data/lib/procon_bypass_man/domains/binary/base.rb +25 -0
- data/lib/procon_bypass_man/domains/binary/has_immutable_binary.rb +5 -0
- data/lib/procon_bypass_man/domains/binary/has_mutable_binary.rb +5 -0
- data/lib/procon_bypass_man/domains/binary/inbound_procon_binary.rb +9 -0
- data/lib/procon_bypass_man/domains/binary/processing_procon_binary.rb +66 -0
- data/lib/procon_bypass_man/domains.rb +11 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb +17 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb +17 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb +17 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb +17 -0
- data/lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb +59 -0
- data/lib/procon_bypass_man/plugin/splatoon2/version.rb +9 -0
- data/lib/procon_bypass_man/plugins.rb +11 -0
- data/lib/procon_bypass_man/processor.rb +4 -5
- data/lib/procon_bypass_man/procon/button.rb +11 -0
- data/lib/procon_bypass_man/procon/button_collection.rb +9 -11
- data/lib/procon_bypass_man/procon/layer_changer.rb +3 -2
- 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 +9 -7
- data/lib/procon_bypass_man/procon/user_operation.rb +46 -63
- data/lib/procon_bypass_man/procon/{analog_stick.rb → value_objects/analog_stick.rb} +3 -4
- data/lib/procon_bypass_man/procon/value_objects/procon_reader.rb +34 -0
- data/lib/procon_bypass_man/procon.rb +18 -16
- data/lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb +4 -0
- data/lib/procon_bypass_man/remote_pbm_action/{lib → commands}/update_remote_pbm_action_status_command.rb +0 -0
- data/lib/procon_bypass_man/remote_pbm_action/reboot_os_action.rb +4 -0
- data/lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb +28 -0
- data/lib/procon_bypass_man/remote_pbm_action/stop_pbm_action.rb +4 -0
- data/lib/procon_bypass_man/{value_objects → remote_pbm_action/value_objects}/remote_pbm_action_object.rb +0 -0
- data/lib/procon_bypass_man/remote_pbm_action.rb +3 -2
- data/lib/procon_bypass_man/runner.rb +4 -4
- data/lib/procon_bypass_man/scheduler.rb +0 -7
- 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/report_http_client.rb +3 -3
- 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 +90 -0
- data/lib/procon_bypass_man.rb +50 -33
- data/procon_bypass_man.gemspec +2 -0
- data/project_template/README.md +10 -5
- data/project_template/app.rb +1 -1
- data/project_template/setting.yml +8 -8
- data/sig/main.rbs +226 -41
- data/sig/on_memory_cache.rbs +16 -0
- metadata +59 -20
- data/lib/procon_bypass_man/background/jobs/fetch_and_run_remote_pbm_action_job.rb +0 -29
- data/lib/procon_bypass_man/boot_message.rb +0 -48
- data/lib/procon_bypass_man/commands/run_local_shell_command.rb +0 -6
- data/lib/procon_bypass_man/procon_reader.rb +0 -31
- data/lib/procon_bypass_man/splatoon2/macro/fast_return.rb +0 -15
- data/lib/procon_bypass_man/splatoon2/macro/jump_to_left_key.rb +0 -15
- data/lib/procon_bypass_man/splatoon2/macro/jump_to_right_key.rb +0 -15
- data/lib/procon_bypass_man/splatoon2/macro/jump_to_up_key.rb +0 -15
- data/lib/procon_bypass_man/splatoon2/mode/guruguru.rb +0 -57
- data/lib/procon_bypass_man/splatoon2/version.rb +0 -7
- data/lib/procon_bypass_man/splatoon2.rb +0 -11
data/lib/procon_bypass_man.rb
CHANGED
@@ -4,6 +4,9 @@ require "json"
|
|
4
4
|
require "net/http"
|
5
5
|
require "fileutils"
|
6
6
|
require "securerandom"
|
7
|
+
require 'em/pure_ruby'
|
8
|
+
require "action_cable_client"
|
9
|
+
require "ext/em_pure_ruby"
|
7
10
|
|
8
11
|
require_relative "procon_bypass_man/version"
|
9
12
|
require_relative "procon_bypass_man/remote_pbm_action"
|
@@ -21,6 +24,7 @@ require_relative "procon_bypass_man/support/server_pool"
|
|
21
24
|
require_relative "procon_bypass_man/background"
|
22
25
|
require_relative "procon_bypass_man/commands"
|
23
26
|
require_relative "procon_bypass_man/bypass"
|
27
|
+
require_relative "procon_bypass_man/domains"
|
24
28
|
require_relative "procon_bypass_man/device_connector"
|
25
29
|
require_relative "procon_bypass_man/device_status"
|
26
30
|
require_relative "procon_bypass_man/runner"
|
@@ -28,49 +32,50 @@ require_relative "procon_bypass_man/processor"
|
|
28
32
|
require_relative "procon_bypass_man/configuration"
|
29
33
|
require_relative "procon_bypass_man/buttons_setting_configuration"
|
30
34
|
require_relative "procon_bypass_man/procon"
|
31
|
-
require_relative "procon_bypass_man/
|
32
|
-
require_relative "procon_bypass_man/procon/analog_stick"
|
35
|
+
require_relative "procon_bypass_man/procon/button"
|
36
|
+
require_relative "procon_bypass_man/procon/value_objects/analog_stick"
|
37
|
+
require_relative "procon_bypass_man/procon/value_objects/procon_reader"
|
33
38
|
require_relative "procon_bypass_man/procon/analog_stick_cap"
|
34
|
-
require_relative "procon_bypass_man/value_objects/remote_pbm_action_object"
|
39
|
+
require_relative "procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object"
|
35
40
|
require_relative "procon_bypass_man/scheduler"
|
36
|
-
require_relative "procon_bypass_man/
|
41
|
+
require_relative "procon_bypass_man/plugins"
|
42
|
+
require_relative "procon_bypass_man/websocket/pbm_job_client"
|
37
43
|
|
38
44
|
STDOUT.sync = true
|
39
45
|
Thread.abort_on_exception = true
|
40
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
|
+
|
41
60
|
module ProconBypassMan
|
42
61
|
extend ProconBypassMan::Configuration::ClassMethods
|
43
62
|
|
44
63
|
class CouldNotLoadConfigError < StandardError; end
|
45
|
-
class FirstConnectionError < StandardError; end
|
46
64
|
class NotFoundProconError < StandardError; end
|
47
|
-
class
|
48
|
-
|
49
|
-
|
50
|
-
unless setting_path
|
51
|
-
logger.warn "setting_pathが未設定です。設定ファイルのライブリロードが使えません。"
|
52
|
-
end
|
53
|
-
|
54
|
-
if block_given?
|
55
|
-
ProconBypassMan::ButtonsSettingConfiguration.instance.instance_eval(&block)
|
56
|
-
else
|
57
|
-
ProconBypassMan::ButtonsSettingConfiguration::Loader.load(setting_path: setting_path)
|
58
|
-
end
|
59
|
-
end
|
65
|
+
class ConnectionError < StandardError; end
|
66
|
+
class FirstConnectionError < ConnectionError; end
|
67
|
+
class EternalConnectionError < ConnectionError; end
|
60
68
|
|
61
69
|
# @return [void]
|
62
|
-
def self.run(setting_path: nil
|
70
|
+
def self.run(setting_path: nil)
|
63
71
|
ProconBypassMan::Scheduler.start!
|
64
72
|
ProconBypassMan::Background::JobRunner.start!
|
73
|
+
ProconBypassMan::Websocket::PbmJobClient.start!
|
65
74
|
|
66
|
-
ProconBypassMan.
|
67
|
-
|
68
|
-
buttons_setting_configure(setting_path: setting_path, &block)
|
75
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "PBMを起動しています")
|
76
|
+
ProconBypassMan::ButtonsSettingConfiguration::Loader.load(setting_path: setting_path)
|
69
77
|
initialize_pbm
|
70
|
-
File.write(pid_path, $$)
|
71
|
-
ProconBypassMan::WriteSessionIdCommand.execute
|
72
78
|
gadget, procon = ProconBypassMan::ConnectDeviceCommand.execute!
|
73
|
-
ProconBypassMan::DeviceStatus.change_to_running!
|
74
79
|
Runner.new(gadget: gadget, procon: procon).run
|
75
80
|
rescue ProconBypassMan::CouldNotLoadConfigError
|
76
81
|
ProconBypassMan::SendErrorCommand.execute(error: "設定ファイルが不正です。設定ファイルの読み込みに失敗しました")
|
@@ -84,14 +89,18 @@ module ProconBypassMan
|
|
84
89
|
FileUtils.rm_rf(ProconBypassMan.pid_path)
|
85
90
|
FileUtils.rm_rf(ProconBypassMan.digest_path)
|
86
91
|
exit 1
|
87
|
-
rescue ProconBypassMan::
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
rescue ProconBypassMan::ConnectionError
|
93
|
+
begin
|
94
|
+
raise
|
95
|
+
rescue ProconBypassMan::EternalConnectionError
|
96
|
+
ProconBypassMan::SendErrorCommand.execute(error: "接続の見込みがないのでsleepしまくります")
|
97
|
+
ProconBypassMan::DeviceStatus.change_to_connected_but_sleeping!
|
98
|
+
FileUtils.rm_rf(ProconBypassMan.pid_path)
|
99
|
+
eternal_sleep
|
100
|
+
rescue ProconBypassMan::FirstConnectionError
|
101
|
+
ProconBypassMan::SendErrorCommand.execute(error: "接続を確立できませんでした。やりなおします。")
|
102
|
+
retry
|
103
|
+
end
|
95
104
|
end
|
96
105
|
|
97
106
|
def self.configure(&block)
|
@@ -116,9 +125,17 @@ module ProconBypassMan
|
|
116
125
|
|
117
126
|
def self.initialize_pbm
|
118
127
|
ProconBypassMan::WriteDeviceIdCommand.execute
|
128
|
+
ProconBypassMan::WriteSessionIdCommand.execute
|
129
|
+
File.write(pid_path, $$)
|
130
|
+
ProconBypassMan::DeviceStatus.change_to_running!
|
119
131
|
end
|
120
132
|
|
121
133
|
def self.eternal_sleep
|
122
134
|
sleep(999999999)
|
123
135
|
end
|
136
|
+
|
137
|
+
# @return [Void]
|
138
|
+
def self.hot_reload!
|
139
|
+
Process.kill(:USR2, pid)
|
140
|
+
end
|
124
141
|
end
|
data/procon_bypass_man.gemspec
CHANGED
@@ -29,6 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
# Uncomment to register a new dependency of your gem
|
31
31
|
spec.add_dependency "pbmenv"
|
32
|
+
spec.add_dependency "action_cable_client"
|
33
|
+
spec.add_dependency "sorted_set"
|
32
34
|
|
33
35
|
# For more information and examples about making a new gem, checkout our
|
34
36
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/project_template/README.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
# Project Template
|
2
|
-
これらは https://github.com/splaplapla/pbmenv がinstallするときに配備するファイルです
|
2
|
+
* これらは https://github.com/splaplapla/pbmenv がinstallするときに配備するファイルです
|
3
|
+
* pbm_webはオプショナルです
|
3
4
|
|
4
5
|
## systemdを使ってサービスに登録する方法
|
5
|
-
|
6
|
-
|
7
|
-
*
|
8
|
-
* sudo systemctl
|
6
|
+
systemctl enableした後は、次回のOS起動時にserviceも自動起動します
|
7
|
+
|
8
|
+
* pbm
|
9
|
+
* sudo systemctl link /usr/share/pbm/current/systemd_units/pbm.service
|
10
|
+
* sudo systemctl enable pbm.service
|
11
|
+
* pbm_web
|
12
|
+
* sudo systemctl link /usr/share/pbm/current/systemd_units/pbm_web.service
|
13
|
+
* sudo systemctl enable pbm_web.service
|
9
14
|
|
10
15
|
## systemdを使ってサービスから解除する方法
|
11
16
|
* sudo systemctl disable pbm.service
|
data/project_template/app.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
version: 1.0
|
2
2
|
setting: |-
|
3
|
-
fast_return = ProconBypassMan::Splatoon2::Macro::FastReturn
|
4
|
-
guruguru = ProconBypassMan::Splatoon2::Mode::Guruguru
|
3
|
+
fast_return = ProconBypassMan::Plugin::Splatoon2::Macro::FastReturn
|
4
|
+
guruguru = ProconBypassMan::Plugin::Splatoon2::Mode::Guruguru
|
5
5
|
|
6
6
|
install_macro_plugin fast_return
|
7
|
-
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToUpKey
|
8
|
-
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToRightKey
|
9
|
-
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToLeftKey
|
7
|
+
install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToUpKey
|
8
|
+
install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToRightKey
|
9
|
+
install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToLeftKey
|
10
10
|
install_mode_plugin guruguru
|
11
11
|
|
12
12
|
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
@@ -18,9 +18,9 @@ setting: |-
|
|
18
18
|
flip :a, if_pressed: [:a]
|
19
19
|
flip :down, if_pressed: :down
|
20
20
|
macro fast_return.name, if_pressed: [:y, :b, :down]
|
21
|
-
macro ProconBypassMan::Splatoon2::Macro::JumpToUpKey, if_pressed: [:y, :b, :up]
|
22
|
-
macro ProconBypassMan::Splatoon2::Macro::JumpToRightKey, if_pressed: [:y, :b, :right]
|
23
|
-
macro ProconBypassMan::Splatoon2::Macro::JumpToLeftKey, if_pressed: [:y, :b, :left]
|
21
|
+
macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToUpKey, if_pressed: [:y, :b, :up]
|
22
|
+
macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToRightKey, if_pressed: [:y, :b, :right]
|
23
|
+
macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToLeftKey, if_pressed: [:y, :b, :left]
|
24
24
|
remap :l, to: :zr
|
25
25
|
end
|
26
26
|
layer :right, mode: guruguru.name
|
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,42 +172,60 @@ 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
|
210
|
+
def current_server: () -> String
|
211
|
+
|
212
|
+
def current_ws_server: () -> (String | nil)
|
213
|
+
|
214
|
+
def current_ws_server_url: () -> ::String
|
215
|
+
|
216
|
+
def enable_ws?: () -> bool
|
217
|
+
|
218
|
+
def server_pool: () -> untyped
|
219
|
+
|
220
|
+
def internal_server_pool: () -> untyped
|
221
|
+
|
222
|
+
def internal_servers: () -> ::Array[string | nil]
|
223
|
+
|
224
|
+
def internal_api_servers: () -> ::Array[untyped]
|
225
|
+
|
226
|
+
def raw_setting: () -> untyped
|
227
|
+
|
228
|
+
def verbose_bypass_log: () -> bool
|
205
229
|
end
|
206
230
|
|
207
231
|
|
@@ -373,41 +397,41 @@ end
|
|
373
397
|
|
374
398
|
class ProconBypassMan::Procon::MacroRegistry
|
375
399
|
class Macro
|
376
|
-
attr_accessor name:
|
400
|
+
attr_accessor name: Symbol
|
377
401
|
|
378
402
|
attr_accessor steps: untyped
|
379
403
|
|
380
|
-
def initialize: (name: untyped
|
404
|
+
def initialize: (name: untyped Symbol, steps: Symbol) -> void
|
381
405
|
|
382
|
-
def next_step: () ->
|
406
|
+
def next_step: () -> Symbol
|
383
407
|
|
384
|
-
def finished?: () ->
|
408
|
+
def finished?: () -> bool
|
385
409
|
|
386
|
-
def ongoing?: () ->
|
410
|
+
def ongoing?: () -> bool
|
387
411
|
end
|
388
412
|
|
389
|
-
PRESETS: ::Hash[
|
413
|
+
PRESETS: ::Hash[Symbol, Array[Symbol]]
|
390
414
|
|
391
415
|
def self.install_plugin: (untyped klass) -> untyped
|
392
416
|
|
393
|
-
def self.load: (
|
417
|
+
def self.load: (Symbol name) -> untyped
|
394
418
|
|
395
|
-
def self.reset!: () ->
|
419
|
+
def self.reset!: () -> void
|
396
420
|
|
397
|
-
def self.plugins: () ->
|
421
|
+
def self.plugins: () -> ::Hash[Symbol, Array[Symbol]]
|
398
422
|
end
|
399
423
|
|
400
424
|
class ProconBypassMan::Procon::ModeRegistry
|
401
425
|
class Mode
|
402
|
-
attr_accessor name:
|
426
|
+
attr_accessor name: Symbol
|
403
427
|
|
404
|
-
attr_accessor binaries:
|
428
|
+
attr_accessor binaries: Array[String]
|
405
429
|
|
406
|
-
attr_accessor source_binaries:
|
430
|
+
attr_accessor source_binaries: Array[String]
|
407
431
|
|
408
|
-
def initialize: (name:
|
432
|
+
def initialize: (name: Symbol, binaries: Array[String]) -> void
|
409
433
|
|
410
|
-
def next_binary: () ->
|
434
|
+
def next_binary: () -> String
|
411
435
|
end
|
412
436
|
|
413
437
|
PRESETS: ::Hash[untyped, untyped]
|
@@ -421,30 +445,20 @@ class ProconBypassMan::Procon::ModeRegistry
|
|
421
445
|
def self.plugins: () -> untyped
|
422
446
|
end
|
423
447
|
|
424
|
-
module ProconBypassMan::Procon::PressedButtonHelper
|
425
|
-
module Static
|
426
|
-
def pressed_button?: (untyped button) -> untyped
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
448
|
class ProconBypassMan::Procon
|
431
449
|
class UserOperation
|
432
450
|
include LayerChangeable
|
433
451
|
|
434
|
-
include PressedButtonHelper::Static
|
435
|
-
|
436
452
|
attr_reader binary: untyped
|
437
453
|
|
438
454
|
def initialize: (untyped binary) -> untyped
|
439
455
|
|
440
|
-
ZERO_BIT: untyped
|
441
|
-
|
442
456
|
ASCII_ENCODING: ::String
|
443
457
|
|
444
458
|
# @depilicate
|
445
459
|
def binary=: (untyped binary) -> untyped
|
446
460
|
|
447
|
-
def set_no_action!: () ->
|
461
|
+
def set_no_action!: () -> void
|
448
462
|
|
449
463
|
def unpress_button: (untyped button) -> untyped
|
450
464
|
|
@@ -482,7 +496,7 @@ module ProconBypassMan
|
|
482
496
|
end
|
483
497
|
|
484
498
|
# 5秒後がタイムアウト
|
485
|
-
def initialize: (?timeout: untyped timeout) ->
|
499
|
+
def initialize: (?timeout: untyped timeout) -> void
|
486
500
|
|
487
501
|
def throw_if_timeout!: () -> untyped
|
488
502
|
end
|
@@ -494,7 +508,7 @@ module ProconBypassMan
|
|
494
508
|
def self.from_boot: () -> Integer
|
495
509
|
|
496
510
|
# @param [String] uptime_cmd_result
|
497
|
-
def initialize: (uptime_cmd_result: String
|
511
|
+
def initialize: (uptime_cmd_result: String) -> void
|
498
512
|
|
499
513
|
# @return [Integer]
|
500
514
|
def from_boot: () -> Integer
|
@@ -504,3 +518,174 @@ end
|
|
504
518
|
module ProconBypassMan
|
505
519
|
VERSION: ::String
|
506
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
|