procon_bypass_man 0.1.15 → 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/CHANGELOG.md +3 -0
- data/Gemfile.lock +24 -6
- data/README.md +8 -0
- 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 +2 -6
- data/lib/procon_bypass_man/bypass/usb_hid_logger.rb +1 -1
- 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 +1 -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 +27 -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.rb → plugins.rb} +0 -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 +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/{lib → commands}/update_remote_pbm_action_status_command.rb +0 -0
- data/lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb +1 -1
- 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 +1 -1
- data/lib/procon_bypass_man/runner.rb +3 -3
- data/lib/procon_bypass_man/scheduler.rb +0 -7
- 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 +12 -6
- data/procon_bypass_man.gemspec +2 -0
- data/project_template/app.rb +1 -1
- data/sig/main.rbs +15 -1
- metadata +45 -10
- 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
@@ -1,77 +1,60 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# ボタンを押しているか判断するクラス。バイナリの書き換えはしない
|
2
|
+
class ProconBypassMan::Procon::UserOperation
|
3
|
+
attr_reader :binary
|
4
4
|
|
5
|
-
|
6
|
-
define_method "pressed_#{button}?" do
|
7
|
-
pressed_button?(button)
|
8
|
-
end
|
9
|
-
end
|
5
|
+
ASCII_ENCODING = "ASCII-8BIT"
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@binary = binary
|
7
|
+
# @param [String] binary
|
8
|
+
def initialize(binary)
|
9
|
+
unless binary.encoding.name == ASCII_ENCODING
|
10
|
+
raise "おかしいです"
|
16
11
|
end
|
17
12
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
def set_no_action!
|
22
|
-
binary[3] = ZERO_BIT
|
23
|
-
binary[4] = ZERO_BIT
|
24
|
-
binary[5] = ZERO_BIT
|
25
|
-
end
|
13
|
+
@binary = ProconBypassMan::Domains::ProcessingProconBinary.new(binary: binary)
|
14
|
+
end
|
26
15
|
|
27
|
-
|
28
|
-
|
29
|
-
|
16
|
+
def set_no_action!
|
17
|
+
binary.set_no_action!
|
18
|
+
end
|
30
19
|
|
31
|
-
|
32
|
-
|
20
|
+
def apply_left_analog_stick_cap(cap: )
|
21
|
+
binary.write_as_apply_left_analog_stick_cap(cap: cap)
|
22
|
+
end
|
33
23
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
24
|
+
# @param [Symbol] button
|
25
|
+
def unpress_button(button)
|
26
|
+
return if not pressing_button?(button)
|
27
|
+
binary.write_as_unpress_button(button)
|
28
|
+
end
|
38
29
|
|
39
|
-
|
40
|
-
|
30
|
+
# @param [Symbol] button
|
31
|
+
def press_button(button)
|
32
|
+
return if pressing_button?(button)
|
33
|
+
binary.write_as_press_button(button)
|
34
|
+
end
|
41
35
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
# @param [Symbol] button
|
37
|
+
def press_button_only(button)
|
38
|
+
binary.write_as_press_button_only(button)
|
39
|
+
end
|
46
40
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
binary[3] = no_action_binary[3]
|
54
|
-
binary[4] = no_action_binary[4]
|
55
|
-
binary[5] = no_action_binary[5]
|
56
|
-
end
|
57
|
-
end
|
41
|
+
# @return [void]
|
42
|
+
def merge(target_binary)
|
43
|
+
binary.write_as_merge!(
|
44
|
+
ProconBypassMan::Domains::ProcessingProconBinary.new(binary: target_binary)
|
45
|
+
)
|
46
|
+
end
|
58
47
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
binary[6] = tb[6]
|
65
|
-
binary[7] = tb[7]
|
66
|
-
binary[8] = tb[8]
|
67
|
-
binary[9] = tb[9]
|
68
|
-
binary[10] = tb[10]
|
69
|
-
binary[11] = tb[11]
|
70
|
-
self.binary
|
71
|
-
end
|
48
|
+
# @param [Symbol] button
|
49
|
+
# @return [Boolean]
|
50
|
+
def pressing_button?(button)
|
51
|
+
ProconBypassMan::PressButtonAware.new(@binary.raw).pressing_button?(button)
|
52
|
+
end
|
72
53
|
|
73
|
-
|
74
|
-
|
75
|
-
|
54
|
+
# @param [Array<Symbol>] buttons
|
55
|
+
# @return [Boolean]
|
56
|
+
def pressing_all_buttons?(buttons)
|
57
|
+
aware = ProconBypassMan::PressButtonAware.new(@binary.raw)
|
58
|
+
buttons.all? { |b| aware.pressing_button?(b) }
|
76
59
|
end
|
77
60
|
end
|
@@ -4,13 +4,12 @@ class ProconBypassMan::Procon::AnalogStick
|
|
4
4
|
|
5
5
|
def initialize(binary: )
|
6
6
|
@neutral_position = ProconBypassMan::ButtonsSettingConfiguration.instance.neutral_position
|
7
|
-
|
8
|
-
byte6 =
|
9
|
-
byte7 = binary[7].unpack("H*").first.to_i(16).to_s(2).rjust(8, "0")
|
10
|
-
byte8 = binary[8].unpack("H*").first.to_i(16).to_s(2).rjust(8, "0")
|
7
|
+
bytes = binary[ProconBypassMan::Procon::ButtonCollection::LEFT_ANALOG_STICK.fetch(:byte_position)]
|
8
|
+
byte6, byte7, byte8 = bytes.each_char.map { |x| x.unpack("H*").first.to_i(16).to_s(2).rjust(8, "0") }
|
11
9
|
|
12
10
|
self.bin_x = "#{byte7[4..7]}#{byte6}"
|
13
11
|
self.bin_y = "#{byte8}#{byte7[0..3]}"
|
12
|
+
freeze
|
14
13
|
end
|
15
14
|
|
16
15
|
def abs_x
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ProconReader
|
3
|
+
def initialize(binary: )
|
4
|
+
@binary = binary
|
5
|
+
@analog_stick = ProconBypassMan::Procon::AnalogStick.new(binary: binary)
|
6
|
+
freeze
|
7
|
+
end
|
8
|
+
|
9
|
+
# @return [Array<Symbol>]
|
10
|
+
def pressing
|
11
|
+
aware = ProconBypassMan::PressButtonAware.new(@binary)
|
12
|
+
pressed_table = ::ProconBypassMan::Procon::ButtonCollection::BUTTONS.reduce({}) do |acc, button|
|
13
|
+
acc[button] = aware.pressing_button?(button)
|
14
|
+
acc
|
15
|
+
end
|
16
|
+
pressed_table.select { |_key, value| value }.keys
|
17
|
+
end
|
18
|
+
|
19
|
+
def left_analog_stick
|
20
|
+
{ x: @analog_stick.relative_x, y: @analog_stick.relative_y }
|
21
|
+
end
|
22
|
+
|
23
|
+
def left_analog_stick_by_abs
|
24
|
+
{ x: @analog_stick.abs_x, y: @analog_stick.abs_y }
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_hash
|
28
|
+
{ left_analog_stick: left_analog_stick,
|
29
|
+
left_analog_stick_by_abs: left_analog_stick_by_abs,
|
30
|
+
buttons: pressing,
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -20,8 +20,11 @@ class ProconBypassMan::Procon
|
|
20
20
|
end
|
21
21
|
reset!
|
22
22
|
|
23
|
+
# @param [string] binary
|
23
24
|
def initialize(binary)
|
24
|
-
self.user_operation = ProconBypassMan::Procon::UserOperation.new(
|
25
|
+
self.user_operation = ProconBypassMan::Procon::UserOperation.new(
|
26
|
+
binary.dup
|
27
|
+
)
|
25
28
|
end
|
26
29
|
|
27
30
|
def status; @@status[:buttons]; end
|
@@ -43,7 +46,7 @@ class ProconBypassMan::Procon
|
|
43
46
|
|
44
47
|
if ongoing_macro.finished?
|
45
48
|
current_layer.macros.each do |macro_name, options|
|
46
|
-
if options[:if_pressed]
|
49
|
+
if user_operation.pressing_all_buttons?(options[:if_pressed])
|
47
50
|
@@status[:ongoing_macro] = MacroRegistry.load(macro_name)
|
48
51
|
end
|
49
52
|
end
|
@@ -60,7 +63,7 @@ class ProconBypassMan::Procon
|
|
60
63
|
next
|
61
64
|
end
|
62
65
|
|
63
|
-
if options[:if_pressed] && options[:if_pressed]
|
66
|
+
if options[:if_pressed] && user_operation.pressing_all_buttons?(options[:if_pressed])
|
64
67
|
FlipCache.fetch(key: button, expires_in: options[:flip_interval]) do
|
65
68
|
status[button] = !status[button]
|
66
69
|
end
|
@@ -75,7 +78,7 @@ class ProconBypassMan::Procon
|
|
75
78
|
@@status[:ongoing_mode] = ProconBypassMan::Procon::ModeRegistry.load(current_layer.mode)
|
76
79
|
end
|
77
80
|
if(binary = ongoing_mode.next_binary)
|
78
|
-
self.user_operation.merge(
|
81
|
+
self.user_operation.merge([binary].pack("H*"))
|
79
82
|
end
|
80
83
|
return
|
81
84
|
end
|
@@ -83,24 +86,24 @@ class ProconBypassMan::Procon
|
|
83
86
|
status
|
84
87
|
end
|
85
88
|
|
86
|
-
# @return [
|
89
|
+
# @return [ProconBypassMan::Domains::ProcessingProconBinary]
|
87
90
|
def to_binary
|
88
91
|
if ongoing_mode.name != :manual
|
89
|
-
return user_operation.binary
|
92
|
+
return user_operation.binary.raw
|
90
93
|
end
|
91
94
|
|
92
95
|
if ongoing_macro.ongoing?
|
93
|
-
step = ongoing_macro.next_step or return(user_operation.binary)
|
96
|
+
step = ongoing_macro.next_step or return(user_operation.binary.raw)
|
94
97
|
user_operation.press_button_only(step)
|
95
|
-
return user_operation.binary
|
98
|
+
return user_operation.binary.raw
|
96
99
|
end
|
97
100
|
|
98
101
|
current_layer.disables.each do |button|
|
99
102
|
user_operation.unpress_button(button)
|
100
103
|
end
|
101
104
|
|
102
|
-
current_layer.left_analog_stick_caps.each do |
|
103
|
-
if
|
105
|
+
current_layer.left_analog_stick_caps.each do |buttons, options|
|
106
|
+
if buttons.nil? || user_operation.pressing_all_buttons?(buttons)
|
104
107
|
options[:force_neutral]&.each do |force_neutral_button|
|
105
108
|
user_operation.unpress_button(force_neutral_button)
|
106
109
|
end
|
@@ -116,7 +119,7 @@ class ProconBypassMan::Procon
|
|
116
119
|
end
|
117
120
|
|
118
121
|
# 押している時だけ連打
|
119
|
-
if options[:if_pressed] && options[:if_pressed]
|
122
|
+
if options[:if_pressed] && user_operation.pressing_all_buttons?(options[:if_pressed])
|
120
123
|
if !status[button]
|
121
124
|
user_operation.unpress_button(button)
|
122
125
|
end
|
@@ -128,16 +131,15 @@ class ProconBypassMan::Procon
|
|
128
131
|
end
|
129
132
|
|
130
133
|
current_layer.remaps.each do |from_button, to_buttons|
|
131
|
-
if user_operation.
|
134
|
+
if user_operation.pressing_button?(from_button)
|
132
135
|
user_operation.unpress_button(from_button)
|
133
|
-
# TODO 2重でpressしないようにしたい
|
134
136
|
to_buttons[:to].each do |to_button|
|
135
137
|
user_operation.press_button(to_button)
|
136
138
|
end
|
137
139
|
end
|
138
140
|
end
|
139
141
|
|
140
|
-
user_operation.binary
|
142
|
+
user_operation.binary.raw
|
141
143
|
end
|
142
144
|
|
143
145
|
private
|
File without changes
|
@@ -5,7 +5,7 @@ module ProconBypassMan
|
|
5
5
|
def action_content(args: )
|
6
6
|
require "pbmenv"
|
7
7
|
ProconBypassMan.logger.info "execute RestorePbmSettingAction!"
|
8
|
-
setting = args
|
8
|
+
setting = args.dig("setting") or raise(ProconBypassMan::RemotePbmAction::NeedPbmVersionError, "settingが必要です, #{args.inspect}")
|
9
9
|
File.write(
|
10
10
|
ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path,
|
11
11
|
setting.to_yaml,
|
File without changes
|
@@ -5,7 +5,7 @@ module ProconBypassMan
|
|
5
5
|
require "procon_bypass_man/remote_pbm_action/reboot_os_action"
|
6
6
|
require "procon_bypass_man/remote_pbm_action/stop_pbm_action"
|
7
7
|
require "procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb"
|
8
|
-
require "procon_bypass_man/remote_pbm_action/
|
8
|
+
require "procon_bypass_man/remote_pbm_action/commands/update_remote_pbm_action_status_command"
|
9
9
|
|
10
10
|
ACTION_CHANGE_PBM_VERSION = "change_pbm_version"
|
11
11
|
ACTION_REBOOT_OS = "reboot_os"
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative "io_monitor"
|
2
|
-
require_relative "boot_message"
|
3
2
|
|
4
3
|
class ProconBypassMan::Runner
|
5
4
|
class InterruptForRestart < StandardError; end
|
@@ -31,6 +30,7 @@ class ProconBypassMan::Runner
|
|
31
30
|
main_loop_pid = Kernel.fork { ProconBypassMan::BypassCommand.new(gadget: @gadget, procon: @procon).execute }
|
32
31
|
|
33
32
|
begin
|
33
|
+
# TODO 小プロセスが消滅した時に、メインプロセスは生き続けてしまい、何もできなくなる問題がある
|
34
34
|
while(readable_io = IO.select([self_read]))
|
35
35
|
signal = readable_io.first[0].gets.strip
|
36
36
|
handle_signal(signal)
|
@@ -39,14 +39,14 @@ class ProconBypassMan::Runner
|
|
39
39
|
$will_terminate_token = true
|
40
40
|
Process.kill("TERM", main_loop_pid)
|
41
41
|
Process.wait
|
42
|
-
ProconBypassMan.
|
42
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "Reloading config file")
|
43
43
|
begin
|
44
44
|
ProconBypassMan::ButtonsSettingConfiguration::Loader.reload_setting
|
45
45
|
ProconBypassMan::SendReloadConfigEventCommand.execute
|
46
46
|
rescue ProconBypassMan::CouldNotLoadConfigError
|
47
47
|
ProconBypassMan::SendErrorCommand.execute(error: "設定ファイルが不正です。再読み込みができませんでした")
|
48
48
|
end
|
49
|
-
ProconBypassMan.
|
49
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "バイパス処理を再開します")
|
50
50
|
rescue Interrupt
|
51
51
|
$will_terminate_token = true
|
52
52
|
Process.kill("TERM", main_loop_pid)
|
@@ -68,13 +68,6 @@ module ProconBypassMan
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def self.register_schedules
|
71
|
-
register(
|
72
|
-
schedule: Schedule.new(
|
73
|
-
klass: ProconBypassMan::FetchAndRunRemotePbmActionJob,
|
74
|
-
args: [],
|
75
|
-
interval: 3,
|
76
|
-
)
|
77
|
-
)
|
78
71
|
register(
|
79
72
|
schedule: Schedule.new(
|
80
73
|
klass: ProconBypassMan::SyncDeviceStatsJob,
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
module Websocket
|
3
|
+
module PbmJobClient
|
4
|
+
CHANNEL = 'PbmJobChannel'
|
5
|
+
|
6
|
+
def self.start!
|
7
|
+
return unless ProconBypassMan.config.enable_ws?
|
8
|
+
|
9
|
+
Thread.start do
|
10
|
+
loop do
|
11
|
+
run
|
12
|
+
rescue
|
13
|
+
retry
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.run
|
19
|
+
EventMachine.run do
|
20
|
+
client = ActionCableClient.new(
|
21
|
+
ProconBypassMan.config.current_ws_server_url, {
|
22
|
+
channel: CHANNEL, device_id: ProconBypassMan.device_id,
|
23
|
+
}
|
24
|
+
)
|
25
|
+
|
26
|
+
client.connected {
|
27
|
+
ProconBypassMan.logger.info('successfully connected in ProconBypassMan::Websocket::PbmJobClient')
|
28
|
+
}
|
29
|
+
client.subscribed { |msg|
|
30
|
+
puts({ event: :subscribed, msg: msg })
|
31
|
+
ProconBypassMan::SyncDeviceStatsJob.perform(ProconBypassMan::DeviceStatus.current)
|
32
|
+
}
|
33
|
+
|
34
|
+
client.received do |data|
|
35
|
+
validate_and_run(data: data)
|
36
|
+
rescue => e
|
37
|
+
ProconBypassMan::SendErrorCommand.execute(error: e)
|
38
|
+
end
|
39
|
+
|
40
|
+
client.disconnected {
|
41
|
+
puts :disconnected
|
42
|
+
client.reconnect!
|
43
|
+
sleep 2
|
44
|
+
}
|
45
|
+
client.errored { |msg| puts :errored; puts msg }
|
46
|
+
client.pinged { |msg|
|
47
|
+
ProconBypassMan.cache.fetch key: 'ws_pinged', expires_in: 10 do
|
48
|
+
ProconBypassMan.logger.info(msg)
|
49
|
+
end
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# @raise [ProconBypassMan::RemotePbmActionObject::ValidationError]
|
55
|
+
# @param [Hash] data
|
56
|
+
# @return [Void]
|
57
|
+
def self.validate_and_run(data: )
|
58
|
+
ProconBypassMan.logger.debug { data }
|
59
|
+
pbm_job_hash = data.dig("message")
|
60
|
+
begin
|
61
|
+
pbm_job_object = ProconBypassMan::RemotePbmActionObject.new(action: pbm_job_hash["action"],
|
62
|
+
status: pbm_job_hash["status"],
|
63
|
+
uuid: pbm_job_hash["uuid"],
|
64
|
+
created_at: pbm_job_hash["created_at"],
|
65
|
+
job_args: pbm_job_hash["args"])
|
66
|
+
pbm_job_object.validate!
|
67
|
+
rescue ProconBypassMan::RemotePbmActionObject::ValidationError => e
|
68
|
+
raise
|
69
|
+
end
|
70
|
+
|
71
|
+
ProconBypassMan::RunRemotePbmActionDispatchCommand.execute(
|
72
|
+
action: pbm_job_object.action,
|
73
|
+
uuid: pbm_job_object.uuid,
|
74
|
+
job_args: pbm_job_object.job_args
|
75
|
+
)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
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,12 +32,14 @@ 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
|
@@ -51,9 +57,9 @@ module ProconBypassMan
|
|
51
57
|
def self.run(setting_path: nil)
|
52
58
|
ProconBypassMan::Scheduler.start!
|
53
59
|
ProconBypassMan::Background::JobRunner.start!
|
60
|
+
ProconBypassMan::Websocket::PbmJobClient.start!
|
54
61
|
|
55
|
-
ProconBypassMan.
|
56
|
-
puts "PBMを起動しています"
|
62
|
+
ProconBypassMan::PrintMessageCommand.execute(text: "PBMを起動しています")
|
57
63
|
ProconBypassMan::ButtonsSettingConfiguration::Loader.load(setting_path: setting_path)
|
58
64
|
initialize_pbm
|
59
65
|
gadget, procon = ProconBypassMan::ConnectDeviceCommand.execute!
|
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/app.rb
CHANGED
data/sig/main.rbs
CHANGED
@@ -201,7 +201,21 @@ class ProconBypassMan::Configuration
|
|
201
201
|
def digest_path: () -> ::String
|
202
202
|
|
203
203
|
# @return [String] pbm-webの接続先
|
204
|
-
def
|
204
|
+
def current_server: () -> ::String
|
205
|
+
|
206
|
+
def current_ws_server: () -> (::String | nil)
|
207
|
+
|
208
|
+
def current_ws_server_url: () -> ::String
|
209
|
+
|
210
|
+
def enable_ws?: () -> bool
|
211
|
+
|
212
|
+
def server_pool: () -> untyped
|
213
|
+
|
214
|
+
def internal_server_pool: () -> untyped
|
215
|
+
|
216
|
+
def internal_servers: () -> ::Array[string | nil]
|
217
|
+
|
218
|
+
def internal_api_servers: () -> ::Array[untyped]
|
205
219
|
end
|
206
220
|
|
207
221
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: procon_bypass_man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pbmenv
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
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'
|
27
55
|
description: An extension for Nintendo Switch Pro Controller
|
28
56
|
email:
|
29
57
|
- n905i.1214@gmail.com
|
@@ -52,6 +80,7 @@ files:
|
|
52
80
|
- docs/setup_raspi.md
|
53
81
|
- docs/setup_raspi.mitamae.rb
|
54
82
|
- docs/setup_raspi_by_mitamae.md
|
83
|
+
- lib/ext/em_pure_ruby.rb
|
55
84
|
- lib/procon_bypass_man.rb
|
56
85
|
- lib/procon_bypass_man/background.rb
|
57
86
|
- lib/procon_bypass_man/background/job_performer.rb
|
@@ -60,7 +89,6 @@ files:
|
|
60
89
|
- lib/procon_bypass_man/background/jobs/concerns/has_external_api_setting.rb
|
61
90
|
- lib/procon_bypass_man/background/jobs/concerns/has_internal_api_setting.rb
|
62
91
|
- lib/procon_bypass_man/background/jobs/concerns/job_runnable.rb
|
63
|
-
- lib/procon_bypass_man/background/jobs/fetch_and_run_remote_pbm_action_job.rb
|
64
92
|
- lib/procon_bypass_man/background/jobs/report_boot_job.rb
|
65
93
|
- lib/procon_bypass_man/background/jobs/report_error_job.rb
|
66
94
|
- lib/procon_bypass_man/background/jobs/report_event_base_job.rb
|
@@ -68,7 +96,6 @@ files:
|
|
68
96
|
- lib/procon_bypass_man/background/jobs/report_pressed_buttons_job.rb
|
69
97
|
- lib/procon_bypass_man/background/jobs/report_reload_config_job.rb
|
70
98
|
- lib/procon_bypass_man/background/jobs/sync_device_stats_job.rb
|
71
|
-
- lib/procon_bypass_man/boot_message.rb
|
72
99
|
- lib/procon_bypass_man/buttons_setting_configuration.rb
|
73
100
|
- lib/procon_bypass_man/buttons_setting_configuration/layer.rb
|
74
101
|
- lib/procon_bypass_man/buttons_setting_configuration/loader.rb
|
@@ -79,7 +106,7 @@ files:
|
|
79
106
|
- lib/procon_bypass_man/commands/bypass_command.rb
|
80
107
|
- lib/procon_bypass_man/commands/connect_device_command.rb
|
81
108
|
- lib/procon_bypass_man/commands/print_boot_message_command.rb
|
82
|
-
- lib/procon_bypass_man/commands/
|
109
|
+
- lib/procon_bypass_man/commands/print_message_command.rb
|
83
110
|
- lib/procon_bypass_man/commands/run_remote_pbm_action_dispatch_command.rb
|
84
111
|
- lib/procon_bypass_man/commands/send_error_command.rb
|
85
112
|
- lib/procon_bypass_man/commands/send_reload_config_event_command.rb
|
@@ -88,18 +115,24 @@ files:
|
|
88
115
|
- lib/procon_bypass_man/configuration.rb
|
89
116
|
- lib/procon_bypass_man/device_connector.rb
|
90
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
|
91
124
|
- lib/procon_bypass_man/io_monitor.rb
|
92
|
-
- lib/procon_bypass_man/plugin.rb
|
93
125
|
- lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb
|
94
126
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
|
95
127
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb
|
96
128
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb
|
97
129
|
- lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb
|
98
130
|
- lib/procon_bypass_man/plugin/splatoon2/version.rb
|
131
|
+
- lib/procon_bypass_man/plugins.rb
|
99
132
|
- lib/procon_bypass_man/processor.rb
|
100
133
|
- lib/procon_bypass_man/procon.rb
|
101
|
-
- lib/procon_bypass_man/procon/analog_stick.rb
|
102
134
|
- lib/procon_bypass_man/procon/analog_stick_cap.rb
|
135
|
+
- lib/procon_bypass_man/procon/button.rb
|
103
136
|
- lib/procon_bypass_man/procon/button_collection.rb
|
104
137
|
- lib/procon_bypass_man/procon/consts.rb
|
105
138
|
- lib/procon_bypass_man/procon/flip_cache.rb
|
@@ -108,14 +141,16 @@ files:
|
|
108
141
|
- lib/procon_bypass_man/procon/mode_registry.rb
|
109
142
|
- lib/procon_bypass_man/procon/press_button_aware.rb
|
110
143
|
- lib/procon_bypass_man/procon/user_operation.rb
|
111
|
-
- 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
|
112
146
|
- lib/procon_bypass_man/remote_pbm_action.rb
|
113
147
|
- lib/procon_bypass_man/remote_pbm_action/base_action.rb
|
114
148
|
- lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb
|
115
|
-
- lib/procon_bypass_man/remote_pbm_action/
|
149
|
+
- lib/procon_bypass_man/remote_pbm_action/commands/update_remote_pbm_action_status_command.rb
|
116
150
|
- lib/procon_bypass_man/remote_pbm_action/reboot_os_action.rb
|
117
151
|
- lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb
|
118
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
|
119
154
|
- lib/procon_bypass_man/runner.rb
|
120
155
|
- lib/procon_bypass_man/scheduler.rb
|
121
156
|
- lib/procon_bypass_man/support/callbacks.rb
|
@@ -129,8 +164,8 @@ files:
|
|
129
164
|
- lib/procon_bypass_man/support/signal_handler.rb
|
130
165
|
- lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb
|
131
166
|
- lib/procon_bypass_man/support/uptime.rb
|
132
|
-
- lib/procon_bypass_man/value_objects/remote_pbm_action_object.rb
|
133
167
|
- lib/procon_bypass_man/version.rb
|
168
|
+
- lib/procon_bypass_man/websocket/pbm_job_client.rb
|
134
169
|
- procon_bypass_man.gemspec
|
135
170
|
- project_template/README.md
|
136
171
|
- project_template/app.rb
|