procon_bypass_man 0.1.12 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +33 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +35 -15
- data/README.md +19 -8
- data/lib/ext/em_pure_ruby.rb +25 -0
- data/lib/procon_bypass_man/background/job_runner.rb +6 -5
- data/lib/procon_bypass_man/background/jobs/base_job.rb +1 -6
- data/lib/procon_bypass_man/background/jobs/concerns/has_external_api_setting.rb +5 -0
- data/lib/procon_bypass_man/background/jobs/concerns/has_internal_api_setting.rb +5 -0
- data/lib/procon_bypass_man/background/{job_runnable.rb → jobs/concerns/job_runnable.rb} +0 -0
- data/lib/procon_bypass_man/background/jobs/report_boot_job.rb +5 -3
- data/lib/procon_bypass_man/background/jobs/report_error_job.rb +6 -5
- data/lib/procon_bypass_man/background/jobs/report_event_base_job.rb +5 -0
- data/lib/procon_bypass_man/background/jobs/report_load_config_job.rb +11 -0
- data/lib/procon_bypass_man/background/jobs/report_pressed_buttons_job.rb +7 -10
- data/lib/procon_bypass_man/background/jobs/report_reload_config_job.rb +5 -4
- data/lib/procon_bypass_man/background/jobs/sync_device_stats_job.rb +16 -0
- data/lib/procon_bypass_man/background.rb +7 -4
- data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +36 -35
- data/lib/procon_bypass_man/buttons_setting_configuration.rb +2 -2
- data/lib/procon_bypass_man/bypass/usb_hid_logger.rb +8 -6
- data/lib/procon_bypass_man/bypass.rb +13 -6
- data/lib/procon_bypass_man/commands/bypass_command.rb +86 -0
- data/lib/procon_bypass_man/commands/connect_device_command.rb +7 -2
- data/lib/procon_bypass_man/commands/print_boot_message_command.rb +51 -2
- 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 +21 -0
- data/lib/procon_bypass_man/commands/send_error_command.rb +2 -1
- data/lib/procon_bypass_man/commands/send_reload_config_event_command.rb +2 -2
- data/lib/procon_bypass_man/commands/write_device_id_command.rb +1 -0
- data/lib/procon_bypass_man/commands/write_session_id_command.rb +1 -7
- data/lib/procon_bypass_man/commands.rb +3 -0
- data/lib/procon_bypass_man/configuration.rb +51 -5
- data/lib/procon_bypass_man/device_connector.rb +32 -24
- data/lib/procon_bypass_man/device_status.rb +44 -0
- data/lib/procon_bypass_man/domains/binary/base.rb +11 -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 +23 -0
- data/lib/procon_bypass_man/domains/binary/processing_procon_binary.rb +80 -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/analog_stick_cap.rb +1 -1
- data/lib/procon_bypass_man/procon/button.rb +11 -0
- data/lib/procon_bypass_man/procon/button_collection.rb +2 -12
- data/lib/procon_bypass_man/procon/layer_changer.rb +3 -2
- data/lib/procon_bypass_man/procon/press_button_aware.rb +5 -4
- 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 +16 -14
- data/lib/procon_bypass_man/remote_pbm_action/base_action.rb +53 -0
- data/lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb +25 -0
- data/lib/procon_bypass_man/remote_pbm_action/commands/update_remote_pbm_action_status_command.rb +24 -0
- data/lib/procon_bypass_man/remote_pbm_action/reboot_os_action.rb +21 -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 +21 -0
- data/lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb +38 -0
- data/lib/procon_bypass_man/remote_pbm_action.rb +32 -0
- data/lib/procon_bypass_man/runner.rb +8 -97
- data/lib/procon_bypass_man/scheduler.rb +85 -0
- data/lib/procon_bypass_man/{callbacks.rb → support/callbacks.rb} +0 -0
- data/lib/procon_bypass_man/support/compress_array.rb +56 -0
- data/lib/procon_bypass_man/support/http_client.rb +102 -0
- data/lib/procon_bypass_man/{on_memory_cache.rb → support/on_memory_cache.rb} +0 -0
- data/lib/procon_bypass_man/support/report_http_client.rb +19 -0
- data/lib/procon_bypass_man/{timer.rb → support/safe_timeout.rb} +1 -1
- data/lib/procon_bypass_man/support/send_device_stats_http_client.rb +9 -0
- data/lib/procon_bypass_man/{background/has_server_pool.rb → support/server_pool.rb} +3 -15
- data/lib/procon_bypass_man/support/signal_handler.rb +11 -0
- data/lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb +9 -0
- data/lib/procon_bypass_man/{uptime.rb → support/uptime.rb} +0 -0
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man/websocket/pbm_job_client.rb +79 -0
- data/lib/procon_bypass_man.rb +68 -34
- data/procon_bypass_man.gemspec +5 -3
- data/project_template/README.md +18 -11
- data/project_template/app.rb +1 -2
- data/project_template/setting.yml +8 -8
- data/sig/{README.rb → README.md} +0 -0
- data/sig/main.rbs +16 -1
- metadata +102 -21
- data/lib/procon_bypass_man/background/http_client.rb +0 -70
- data/lib/procon_bypass_man/background/jobs/report_heartbeat_job.rb +0 -10
- data/lib/procon_bypass_man/boot_message.rb +0 -42
- data/lib/procon_bypass_man/procon_reader.rb +0 -31
metadata
CHANGED
@@ -1,16 +1,58 @@
|
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
12
|
-
dependencies:
|
13
|
-
|
11
|
+
date: 2021-12-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pbmenv
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: action_cable_client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sorted_set
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: An extension for Nintendo Switch Pro Controller
|
14
56
|
email:
|
15
57
|
- n905i.1214@gmail.com
|
16
58
|
executables: []
|
@@ -18,6 +60,7 @@ extensions: []
|
|
18
60
|
extra_rdoc_files: []
|
19
61
|
files:
|
20
62
|
- ".circleci/config.yml"
|
63
|
+
- ".github/workflows/release.yml"
|
21
64
|
- ".github/workflows/ruby.yml"
|
22
65
|
- ".gitignore"
|
23
66
|
- ".rspec"
|
@@ -37,42 +80,59 @@ files:
|
|
37
80
|
- docs/setup_raspi.md
|
38
81
|
- docs/setup_raspi.mitamae.rb
|
39
82
|
- docs/setup_raspi_by_mitamae.md
|
83
|
+
- lib/ext/em_pure_ruby.rb
|
40
84
|
- lib/procon_bypass_man.rb
|
41
85
|
- lib/procon_bypass_man/background.rb
|
42
|
-
- lib/procon_bypass_man/background/has_server_pool.rb
|
43
|
-
- lib/procon_bypass_man/background/http_client.rb
|
44
86
|
- lib/procon_bypass_man/background/job_performer.rb
|
45
|
-
- lib/procon_bypass_man/background/job_runnable.rb
|
46
87
|
- lib/procon_bypass_man/background/job_runner.rb
|
47
88
|
- lib/procon_bypass_man/background/jobs/base_job.rb
|
89
|
+
- lib/procon_bypass_man/background/jobs/concerns/has_external_api_setting.rb
|
90
|
+
- lib/procon_bypass_man/background/jobs/concerns/has_internal_api_setting.rb
|
91
|
+
- lib/procon_bypass_man/background/jobs/concerns/job_runnable.rb
|
48
92
|
- lib/procon_bypass_man/background/jobs/report_boot_job.rb
|
49
93
|
- lib/procon_bypass_man/background/jobs/report_error_job.rb
|
50
|
-
- lib/procon_bypass_man/background/jobs/
|
94
|
+
- lib/procon_bypass_man/background/jobs/report_event_base_job.rb
|
95
|
+
- lib/procon_bypass_man/background/jobs/report_load_config_job.rb
|
51
96
|
- lib/procon_bypass_man/background/jobs/report_pressed_buttons_job.rb
|
52
97
|
- lib/procon_bypass_man/background/jobs/report_reload_config_job.rb
|
53
|
-
- lib/procon_bypass_man/
|
98
|
+
- lib/procon_bypass_man/background/jobs/sync_device_stats_job.rb
|
54
99
|
- lib/procon_bypass_man/buttons_setting_configuration.rb
|
55
100
|
- lib/procon_bypass_man/buttons_setting_configuration/layer.rb
|
56
101
|
- lib/procon_bypass_man/buttons_setting_configuration/loader.rb
|
57
102
|
- lib/procon_bypass_man/buttons_setting_configuration/validator.rb
|
58
103
|
- lib/procon_bypass_man/bypass.rb
|
59
104
|
- lib/procon_bypass_man/bypass/usb_hid_logger.rb
|
60
|
-
- lib/procon_bypass_man/callbacks.rb
|
61
105
|
- lib/procon_bypass_man/commands.rb
|
106
|
+
- lib/procon_bypass_man/commands/bypass_command.rb
|
62
107
|
- lib/procon_bypass_man/commands/connect_device_command.rb
|
63
108
|
- lib/procon_bypass_man/commands/print_boot_message_command.rb
|
109
|
+
- lib/procon_bypass_man/commands/print_message_command.rb
|
110
|
+
- lib/procon_bypass_man/commands/run_remote_pbm_action_dispatch_command.rb
|
64
111
|
- lib/procon_bypass_man/commands/send_error_command.rb
|
65
112
|
- lib/procon_bypass_man/commands/send_reload_config_event_command.rb
|
66
113
|
- lib/procon_bypass_man/commands/write_device_id_command.rb
|
67
114
|
- lib/procon_bypass_man/commands/write_session_id_command.rb
|
68
115
|
- lib/procon_bypass_man/configuration.rb
|
69
116
|
- lib/procon_bypass_man/device_connector.rb
|
117
|
+
- lib/procon_bypass_man/device_status.rb
|
118
|
+
- lib/procon_bypass_man/domains.rb
|
119
|
+
- lib/procon_bypass_man/domains/binary/base.rb
|
120
|
+
- lib/procon_bypass_man/domains/binary/has_immutable_binary.rb
|
121
|
+
- lib/procon_bypass_man/domains/binary/has_mutable_binary.rb
|
122
|
+
- lib/procon_bypass_man/domains/binary/inbound_procon_binary.rb
|
123
|
+
- lib/procon_bypass_man/domains/binary/processing_procon_binary.rb
|
70
124
|
- lib/procon_bypass_man/io_monitor.rb
|
71
|
-
- lib/procon_bypass_man/
|
125
|
+
- lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb
|
126
|
+
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
|
127
|
+
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb
|
128
|
+
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb
|
129
|
+
- lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb
|
130
|
+
- lib/procon_bypass_man/plugin/splatoon2/version.rb
|
131
|
+
- lib/procon_bypass_man/plugins.rb
|
72
132
|
- lib/procon_bypass_man/processor.rb
|
73
133
|
- lib/procon_bypass_man/procon.rb
|
74
|
-
- lib/procon_bypass_man/procon/analog_stick.rb
|
75
134
|
- lib/procon_bypass_man/procon/analog_stick_cap.rb
|
135
|
+
- lib/procon_bypass_man/procon/button.rb
|
76
136
|
- lib/procon_bypass_man/procon/button_collection.rb
|
77
137
|
- lib/procon_bypass_man/procon/consts.rb
|
78
138
|
- lib/procon_bypass_man/procon/flip_cache.rb
|
@@ -81,11 +141,31 @@ files:
|
|
81
141
|
- lib/procon_bypass_man/procon/mode_registry.rb
|
82
142
|
- lib/procon_bypass_man/procon/press_button_aware.rb
|
83
143
|
- lib/procon_bypass_man/procon/user_operation.rb
|
84
|
-
- lib/procon_bypass_man/
|
144
|
+
- lib/procon_bypass_man/procon/value_objects/analog_stick.rb
|
145
|
+
- lib/procon_bypass_man/procon/value_objects/procon_reader.rb
|
146
|
+
- lib/procon_bypass_man/remote_pbm_action.rb
|
147
|
+
- lib/procon_bypass_man/remote_pbm_action/base_action.rb
|
148
|
+
- lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb
|
149
|
+
- lib/procon_bypass_man/remote_pbm_action/commands/update_remote_pbm_action_status_command.rb
|
150
|
+
- lib/procon_bypass_man/remote_pbm_action/reboot_os_action.rb
|
151
|
+
- lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb
|
152
|
+
- lib/procon_bypass_man/remote_pbm_action/stop_pbm_action.rb
|
153
|
+
- lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb
|
85
154
|
- lib/procon_bypass_man/runner.rb
|
86
|
-
- lib/procon_bypass_man/
|
87
|
-
- lib/procon_bypass_man/
|
155
|
+
- lib/procon_bypass_man/scheduler.rb
|
156
|
+
- lib/procon_bypass_man/support/callbacks.rb
|
157
|
+
- lib/procon_bypass_man/support/compress_array.rb
|
158
|
+
- lib/procon_bypass_man/support/http_client.rb
|
159
|
+
- lib/procon_bypass_man/support/on_memory_cache.rb
|
160
|
+
- lib/procon_bypass_man/support/report_http_client.rb
|
161
|
+
- lib/procon_bypass_man/support/safe_timeout.rb
|
162
|
+
- lib/procon_bypass_man/support/send_device_stats_http_client.rb
|
163
|
+
- lib/procon_bypass_man/support/server_pool.rb
|
164
|
+
- lib/procon_bypass_man/support/signal_handler.rb
|
165
|
+
- lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb
|
166
|
+
- lib/procon_bypass_man/support/uptime.rb
|
88
167
|
- lib/procon_bypass_man/version.rb
|
168
|
+
- lib/procon_bypass_man/websocket/pbm_job_client.rb
|
89
169
|
- procon_bypass_man.gemspec
|
90
170
|
- project_template/README.md
|
91
171
|
- project_template/app.rb
|
@@ -93,7 +173,7 @@ files:
|
|
93
173
|
- project_template/systemd_units/pbm.service
|
94
174
|
- project_template/systemd_units/pbm_web.service
|
95
175
|
- project_template/web.rb
|
96
|
-
- sig/README.
|
176
|
+
- sig/README.md
|
97
177
|
- sig/main.rbs
|
98
178
|
homepage: https://github.com/splaplapla/procon_bypass_man
|
99
179
|
licenses:
|
@@ -101,7 +181,8 @@ licenses:
|
|
101
181
|
metadata:
|
102
182
|
homepage_uri: https://github.com/splaplapla/procon_bypass_man
|
103
183
|
source_code_uri: https://github.com/splaplapla/procon_bypass_man
|
104
|
-
|
184
|
+
changelog_uri: https://github.com/splaplapla/procon_bypass_man/blob/master/CHANGELOG.md
|
185
|
+
post_install_message:
|
105
186
|
rdoc_options: []
|
106
187
|
require_paths:
|
107
188
|
- lib
|
@@ -116,8 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
197
|
- !ruby/object:Gem::Version
|
117
198
|
version: '0'
|
118
199
|
requirements: []
|
119
|
-
rubygems_version: 3.
|
120
|
-
signing_key:
|
200
|
+
rubygems_version: 3.0.3.1
|
201
|
+
signing_key:
|
121
202
|
specification_version: 4
|
122
|
-
summary: extension for Nintendo Switch Pro Controller
|
203
|
+
summary: An extension for Nintendo Switch Pro Controller
|
123
204
|
test_files: []
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module ProconBypassMan
|
2
|
-
module Background
|
3
|
-
class HttpClient
|
4
|
-
class HttpRequest
|
5
|
-
def self.request!(uri: , hostname: , body: , device_id: , session_id: nil, event_type: )
|
6
|
-
@uri = uri
|
7
|
-
@http = Net::HTTP.new(uri.host, uri.port)
|
8
|
-
@http.use_ssl = uri.scheme === "https"
|
9
|
-
@params = {
|
10
|
-
hostname: hostname,
|
11
|
-
event_type: event_type,
|
12
|
-
session_id: session_id,
|
13
|
-
device_id: device_id,
|
14
|
-
}.merge(body)
|
15
|
-
@http.post(
|
16
|
-
@uri.path,
|
17
|
-
@params.to_json,
|
18
|
-
{ "Content-Type" => "application/json" },
|
19
|
-
)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(path: , pool_server: , retry_on_connection_error: false)
|
24
|
-
@path = path
|
25
|
-
@pool_server = pool_server
|
26
|
-
@hostname = `hostname`.chomp
|
27
|
-
@retry_on_connection_error = retry_on_connection_error
|
28
|
-
end
|
29
|
-
|
30
|
-
def post(body: , event_type: )
|
31
|
-
if @pool_server.server.nil?
|
32
|
-
ProconBypassMan.logger.info('送信先が未設定なのでスキップしました')
|
33
|
-
return
|
34
|
-
end
|
35
|
-
if body.is_a?(Hash)
|
36
|
-
body = { body: body, event_type: event_type }
|
37
|
-
else
|
38
|
-
body = { body: { value: body, event_type: event_type } }
|
39
|
-
end
|
40
|
-
session_id = ProconBypassMan.session_id
|
41
|
-
device_id = ProconBypassMan.device_id
|
42
|
-
|
43
|
-
response = HttpRequest.request!(
|
44
|
-
uri: URI.parse("#{@pool_server.server}#{@path}"),
|
45
|
-
hostname: @hostname,
|
46
|
-
device_id: device_id,
|
47
|
-
session_id: session_id,
|
48
|
-
body: body,
|
49
|
-
event_type: event_type,
|
50
|
-
)
|
51
|
-
case response.code
|
52
|
-
when /^200/
|
53
|
-
return
|
54
|
-
else
|
55
|
-
@pool_server.next!
|
56
|
-
ProconBypassMan.logger.error("200以外(#{response.code})が帰ってきました. #{response.body}")
|
57
|
-
end
|
58
|
-
rescue SocketError => e
|
59
|
-
ProconBypassMan.logger.error("error in outbound module: #{e}")
|
60
|
-
if @retry_on_connection_error
|
61
|
-
sleep(10)
|
62
|
-
retry
|
63
|
-
end
|
64
|
-
rescue => e
|
65
|
-
puts e
|
66
|
-
ProconBypassMan.logger.error("error in outbound module: #{e}")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
class ProconBypassMan::ReportHeartbeatJob < ProconBypassMan::BaseJob
|
2
|
-
# @param [String] body
|
3
|
-
def self.perform(body)
|
4
|
-
ProconBypassMan::Background::HttpClient.new(
|
5
|
-
path: path,
|
6
|
-
pool_server: pool_server,
|
7
|
-
retry_on_connection_error: false,
|
8
|
-
).post(body: body, event_type: :heartbeat)
|
9
|
-
end
|
10
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
class ProconBypassMan::BootMessage
|
2
|
-
def initialize
|
3
|
-
@table = {}
|
4
|
-
@table[:ruby_version] = RUBY_VERSION
|
5
|
-
@table[:pbm_version] = ProconBypassMan::VERSION
|
6
|
-
@table[:pid] = $$
|
7
|
-
@table[:root_path] = ProconBypassMan.root
|
8
|
-
@table[:pid_path] = ProconBypassMan.pid_path
|
9
|
-
@table[:setting_path] = ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path
|
10
|
-
@table[:uptime_from_boot] = ProconBypassMan::Uptime.from_boot
|
11
|
-
|
12
|
-
# 開発中のHEADを取りたかったけど、Gem::Specification経由から取得する必要がありそう
|
13
|
-
# build_version = `git rev-parse --short HEAD`.chomp
|
14
|
-
# if build_version.empty?
|
15
|
-
# @table[:build_version] = 'release version'
|
16
|
-
# else
|
17
|
-
# @table[:build_version] = build_version
|
18
|
-
# end
|
19
|
-
|
20
|
-
# build version: #{@table[:build_version]}
|
21
|
-
end
|
22
|
-
|
23
|
-
# @return [String]
|
24
|
-
def to_s
|
25
|
-
booted_message = <<~EOF
|
26
|
-
----
|
27
|
-
RUBY_VERSION: #{@table[:ruby_version]}
|
28
|
-
ProconBypassMan: #{@table[:pbm_version]}
|
29
|
-
pid: #{@table[:pid]}
|
30
|
-
root: #{@table[:root_path]}
|
31
|
-
pid_path: #{@table[:pid_path]}
|
32
|
-
setting_path: #{@table[:setting_path]}
|
33
|
-
uptime from boot: #{@table[:uptime_from_boot]} sec
|
34
|
-
----
|
35
|
-
EOF
|
36
|
-
end
|
37
|
-
|
38
|
-
# @return [Hash]
|
39
|
-
def to_hash
|
40
|
-
@table
|
41
|
-
end
|
42
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class ProconBypassMan::ProconReader
|
2
|
-
def initialize(binary: )
|
3
|
-
@binary = binary
|
4
|
-
@analog_stick = ProconBypassMan::Procon::AnalogStick.new(binary: binary)
|
5
|
-
end
|
6
|
-
|
7
|
-
# @return [Array<Symbol>]
|
8
|
-
def pressed
|
9
|
-
aware = ProconBypassMan::PpressButtonAware.new(@binary)
|
10
|
-
pressed_table = ::ProconBypassMan::Procon::ButtonCollection::BUTTONS.reduce({}) do |acc, button|
|
11
|
-
acc[button] = aware.pressed_button?(button)
|
12
|
-
acc
|
13
|
-
end
|
14
|
-
pressed_table.select { |_key, value| value }.keys
|
15
|
-
end
|
16
|
-
|
17
|
-
def left_analog_stick
|
18
|
-
{ x: @analog_stick.relative_x, y: @analog_stick.relative_y }
|
19
|
-
end
|
20
|
-
|
21
|
-
def left_analog_stick_by_abs
|
22
|
-
{ x: @analog_stick.abs_x, y: @analog_stick.abs_y }
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_hash
|
26
|
-
{ left_analog_stick: left_analog_stick,
|
27
|
-
left_analog_stick_by_abs: left_analog_stick_by_abs,
|
28
|
-
buttons: pressed,
|
29
|
-
}
|
30
|
-
end
|
31
|
-
end
|