procon_bypass_man 0.2.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +4 -2
- data/README.md +11 -33
- data/docs/getting_started.md +8 -0
- data/docs/setting/splatoon2_macro_forward_ikarole.md +34 -0
- data/docs/setup_raspi.md +12 -15
- data/docs/setup_raspi_by_mitamae.md +0 -1
- data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +1 -0
- data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +2 -1
- data/lib/procon_bypass_man/buttons_setting_configuration.rb +11 -0
- data/lib/procon_bypass_man/bypass/bypass_command.rb +11 -6
- data/lib/procon_bypass_man/bypass/procon_to_switch.rb +44 -41
- data/lib/procon_bypass_man/bypass/switch_to_procon.rb +2 -0
- data/lib/procon_bypass_man/commands/print_boot_message_command.rb +0 -2
- data/lib/procon_bypass_man/configuration.rb +4 -0
- data/lib/procon_bypass_man/device_connection/procon_setting_overrider.rb +0 -3
- data/lib/procon_bypass_man/ephemeral_configuration.rb +9 -0
- data/lib/procon_bypass_man/plugin/splatoon2/macro/{dasei_cancel.rb → forward_ikarole.rb} +4 -4
- data/lib/procon_bypass_man/plugins.rb +1 -1
- data/lib/procon_bypass_man/procon/analog_stick_manipulator.rb +18 -4
- data/lib/procon_bypass_man/procon/layer_changer.rb +2 -0
- data/lib/procon_bypass_man/procon/macro.rb +2 -0
- data/lib/procon_bypass_man/procon/macro_builder.rb +13 -0
- data/lib/procon_bypass_man/procon/macro_registry.rb +2 -0
- data/lib/procon_bypass_man/procon/performance_measurement/measurements_summarizer.rb +41 -24
- data/lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb +1 -1
- data/lib/procon_bypass_man/procon/performance_measurement.rb +12 -5
- data/lib/procon_bypass_man/procon/rumbler.rb +18 -0
- data/lib/procon_bypass_man/procon/suppress_rumble.rb +2 -0
- data/lib/procon_bypass_man/procon/user_operation.rb +3 -1
- data/lib/procon_bypass_man/procon/value_objects/analog_stick.rb +2 -0
- data/lib/procon_bypass_man/procon/value_objects/binary/inbound_procon_binary.rb +2 -0
- data/lib/procon_bypass_man/procon/value_objects/binary/processing_procon_binary.rb +2 -0
- data/lib/procon_bypass_man/procon/value_objects/rumble_binary.rb +2 -0
- data/lib/procon_bypass_man/procon.rb +28 -18
- data/lib/procon_bypass_man/remote_macro.rb +2 -0
- data/lib/procon_bypass_man/remote_pbm_action.rb +2 -0
- data/lib/procon_bypass_man/runner.rb +0 -1
- data/lib/procon_bypass_man/support/callbacks.rb +10 -3
- data/lib/procon_bypass_man/support/http_client.rb +3 -0
- data/lib/procon_bypass_man/support/renice_command.rb +17 -0
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man.rb +24 -6
- data/procon_bypass_man.gemspec +3 -1
- data/project_template/app.rb +1 -4
- data/project_template/app.rb.erb +1 -4
- data/project_template/setting.yml +3 -0
- metadata +21 -5
- data/docs/setting/splatoon2_macro_dasei_cancel.md +0 -77
- data/lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb +0 -59
@@ -20,37 +20,54 @@ class ProconBypassMan::Procon::PerformanceMeasurement::MeasurementsSummarizer
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# @return [PerformanceMetric]
|
23
|
+
# NOTE 中央値の表示価値が低いのでコメントアウト
|
23
24
|
def summarize
|
24
|
-
sorted_write_time = @spans.map(&:write_time).sort
|
25
|
-
sorted_read_time = @spans.map(&:read_time).sort
|
26
|
-
gc_count = @spans.map(&:gc_count).sum
|
27
|
-
gc_time = @spans.map(&:gc_time).sum
|
28
25
|
|
29
|
-
|
30
|
-
|
26
|
+
write_time_max = 0
|
27
|
+
read_time_max = 0
|
28
|
+
time_taken_max = 0
|
29
|
+
interval_from_previous_succeed_max = 0
|
30
|
+
@spans.each do |span|
|
31
|
+
# NOTE @spans.map(&:write_time).sort.last と同じことだけど、処理コストを軽くするためにループを共通化する
|
32
|
+
write_time_max = span.write_time if write_time_max < span.write_time
|
33
|
+
read_time_max = span.read_time if write_time_max < span.read_time
|
34
|
+
time_taken_max = span.time_taken if span.succeed && time_taken_max < span.time_taken
|
35
|
+
interval_from_previous_succeed_max = span.interval_from_previous_succeed if span.succeed && interval_from_previous_succeed_max < span.interval_from_previous_succeed
|
36
|
+
end
|
31
37
|
|
32
|
-
|
33
|
-
|
38
|
+
# NOTE 今はGCを無効にしており、集計するまでもないのでコメントアウトにする. 今後GCを有効にしたバイパスをするかもしれないので残しておく
|
39
|
+
gc_count = 0 # @spans.map(&:gc_count).sum
|
40
|
+
gc_time = 0 # @spans.map(&:gc_time).sum
|
34
41
|
|
35
|
-
|
36
|
-
|
42
|
+
# sorted_interval_from_previous_succeed = @spans.select(&:succeed).map(&:interval_from_previous_succeed).sort
|
43
|
+
# interval_from_previous_succeed_max = sorted_interval_from_previous_succeed.last || 0
|
44
|
+
interval_from_previous_succeed_p50 = 0 # percentile(sorted_list: sorted_interval_from_previous_succeed , percentile: 0.50)
|
37
45
|
|
38
|
-
|
39
|
-
read_time_p50 = percentile(sorted_list: sorted_read_time , percentile: 0.50)
|
46
|
+
# sorted_read_time = @spans.map(&:read_time).sort
|
47
|
+
read_time_p50 = 0 # percentile(sorted_list: sorted_read_time , percentile: 0.50)
|
48
|
+
# read_time_max = sorted_read_time.last || 0
|
40
49
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
time_taken_max = sorted_time_taken.last || 0
|
50
|
+
# sorted_write_time = @spans.map(&:write_time).sort
|
51
|
+
write_time_p50 = 0 # percentile(sorted_list: sorted_write_time , percentile: 0.50)
|
52
|
+
# write_time_max = sorted_write_time.last || 0
|
45
53
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
+
# sorted_time_taken = @spans.select(&:succeed).map(&:time_taken).sort
|
55
|
+
time_taken_p50 = 0 # percentile(sorted_list: sorted_time_taken, percentile: 0.50)
|
56
|
+
time_taken_p95 = 0 # percentile(sorted_list: sorted_time_taken, percentile: 0.95)
|
57
|
+
time_taken_p99 = 0 # percentile(sorted_list: sorted_time_taken, percentile: 0.99)
|
58
|
+
# time_taken_max = sorted_time_taken.last || 0
|
59
|
+
|
60
|
+
# NOTE webに表示していないのでコメントアウト. デバッグ時に見ることがあるので残しておく
|
61
|
+
total_read_error_count = 0 # @spans.map(&:read_error_count).sum
|
62
|
+
total_write_error_count = 0 # @spans.map(&:write_error_count).sum
|
63
|
+
|
64
|
+
# succeed_rate =
|
65
|
+
# if @spans.length.zero?
|
66
|
+
# 0
|
67
|
+
# else
|
68
|
+
# succeed_rate = (sorted_time_taken.length / @spans.length.to_f).floor(3)
|
69
|
+
# end
|
70
|
+
succeed_rate = 1 # Switchへの書き込みに失敗した時にretryしているので100%になるようになってる. succeedの個数をカウントコストを減らすためにハードコード
|
54
71
|
|
55
72
|
PerformanceMetric.new(interval_from_previous_succeed_max,
|
56
73
|
interval_from_previous_succeed_p50,
|
@@ -45,6 +45,13 @@ module ProconBypassMan::Procon::PerformanceMeasurement
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
# 全部送ると負荷になるので適当にまびく
|
49
|
+
def self.is_not_measure_with_random_or_if_fast(span: )
|
50
|
+
return false if span.time_taken > 0.1
|
51
|
+
return true if rand(100) != 0 # 99/100は捨てる
|
52
|
+
return false
|
53
|
+
end
|
54
|
+
|
48
55
|
# measureをして、measureの結果をためる
|
49
56
|
# @return [Boolean] 成功したか. テスト時に戻り値を使いたい
|
50
57
|
def self.measure(&bypass_process_block)
|
@@ -63,6 +70,8 @@ module ProconBypassMan::Procon::PerformanceMeasurement
|
|
63
70
|
span.succeed = bypass_process_block.call(span)
|
64
71
|
}.floor(3)
|
65
72
|
|
73
|
+
return if is_not_measure_with_random_or_if_fast(span: span)
|
74
|
+
|
66
75
|
if span.succeed
|
67
76
|
ProconBypassMan::Procon::PerformanceMeasurement::LastBypassAt.touch do |interval_from_previous_succeed|
|
68
77
|
span.interval_from_previous_succeed = interval_from_previous_succeed.floor(3)
|
@@ -79,11 +88,9 @@ module ProconBypassMan::Procon::PerformanceMeasurement
|
|
79
88
|
end
|
80
89
|
end
|
81
90
|
|
82
|
-
|
83
|
-
|
84
|
-
ProconBypassMan::
|
85
|
-
ProconBypassMan::ProconPerformanceSpanTransferJob.perform_async(spans.dup)
|
86
|
-
end
|
91
|
+
# measureするたびにperform_asyncしているとjob queueが詰まるのでbufferingしている
|
92
|
+
ProconBypassMan::Procon::PerformanceMeasurement::SpanTransferBuffer.instance.push_and_run_block_if_buffer_over(span) do |spans|
|
93
|
+
ProconBypassMan::ProconPerformanceSpanTransferJob.perform_async(spans)
|
87
94
|
end
|
88
95
|
return span.succeed
|
89
96
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class ProconBypassMan::Procon::Rumbler
|
2
|
+
def self.monitor
|
3
|
+
@@must_rumble = false
|
4
|
+
return yield
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.rumble!
|
8
|
+
@@must_rumble = true
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.must_rumble?
|
12
|
+
@@must_rumble
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.binary
|
16
|
+
["100c00000000" + "00001010"].pack("H*")
|
17
|
+
end
|
18
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# ボタンを押しているか判断するクラス。バイナリの書き換えはしない
|
2
4
|
class ProconBypassMan::Procon::UserOperation
|
3
5
|
attr_reader :binary
|
@@ -36,7 +38,7 @@ class ProconBypassMan::Procon::UserOperation
|
|
36
38
|
# @param [Symbol, Array<Symbol>] macro_step
|
37
39
|
def press_button_only_or_tilt_sticks(macro_step)
|
38
40
|
macro_step = [macro_step] if not macro_step.is_a?(Array)
|
39
|
-
#
|
41
|
+
# スティック操作を含む時はボタン入力を通す
|
40
42
|
binary.set_no_action! if is_button?(macro_step)
|
41
43
|
|
42
44
|
macro_step.uniq.each do |ms|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "procon_bypass_man/procon/macro_plugin_map"
|
2
4
|
|
3
5
|
class ProconBypassMan::Procon
|
@@ -20,17 +22,17 @@ class ProconBypassMan::Procon
|
|
20
22
|
require "procon_bypass_man/procon/flip_cache"
|
21
23
|
require "procon_bypass_man/procon/press_button_aware"
|
22
24
|
require "procon_bypass_man/procon/suppress_rumble"
|
25
|
+
require "procon_bypass_man/procon/rumbler"
|
23
26
|
|
24
27
|
attr_accessor :user_operation
|
25
28
|
|
26
29
|
def self.reset!
|
27
30
|
@@status = {
|
28
|
-
buttons: {},
|
29
|
-
current_layer_key: :up,
|
30
31
|
ongoing_macro: MacroRegistry.load(:null),
|
31
|
-
ongoing_mode: ModeRegistry.load(:manual),
|
32
|
+
ongoing_mode: ModeRegistry.load(:manual), # 削除予定
|
32
33
|
}
|
33
|
-
|
34
|
+
BlueGreenProcess::SharedVariable.instance.data["buttons"] = {}
|
35
|
+
BlueGreenProcess::SharedVariable.instance.data["current_layer_key"] = :up
|
34
36
|
end
|
35
37
|
reset!
|
36
38
|
|
@@ -41,10 +43,20 @@ class ProconBypassMan::Procon
|
|
41
43
|
)
|
42
44
|
end
|
43
45
|
|
44
|
-
def status
|
46
|
+
def status
|
47
|
+
BlueGreenProcess::SharedVariable.instance.data["buttons"]
|
48
|
+
end
|
49
|
+
|
50
|
+
def current_layer_key
|
51
|
+
BlueGreenProcess::SharedVariable.instance.data["current_layer_key"].to_sym
|
52
|
+
end
|
53
|
+
|
54
|
+
def current_layer_key=(layer)
|
55
|
+
BlueGreenProcess::SharedVariable.instance.data["current_layer_key"] = layer
|
56
|
+
end
|
57
|
+
|
45
58
|
def ongoing_macro; @@status[:ongoing_macro]; end
|
46
59
|
def ongoing_mode; @@status[:ongoing_mode]; end
|
47
|
-
def current_layer_key; @@status[:current_layer_key]; end
|
48
60
|
|
49
61
|
def current_layer
|
50
62
|
ProconBypassMan::ButtonsSettingConfiguration.instance.layers[current_layer_key]
|
@@ -54,13 +66,15 @@ class ProconBypassMan::Procon
|
|
54
66
|
def apply!
|
55
67
|
layer_changer = ProconBypassMan::Procon::LayerChanger.new(binary: user_operation.binary)
|
56
68
|
if layer_changer.change_layer?
|
57
|
-
|
69
|
+
if layer_changer.pressed_next_layer?
|
70
|
+
self.current_layer_key = layer_changer.next_layer_key
|
71
|
+
ProconBypassMan::Procon::Rumbler.rumble!
|
72
|
+
end
|
58
73
|
user_operation.set_no_action!
|
59
74
|
return
|
60
75
|
end
|
61
76
|
|
62
77
|
analog_stick = ProconBypassMan::Procon::AnalogStick.new(binary: user_operation.binary.raw)
|
63
|
-
dumped_tilting_power = @@left_stick_tilting_power_scaler.add_sample(analog_stick.relative_hypotenuse)
|
64
78
|
|
65
79
|
enable_all_macro = true
|
66
80
|
enable_macro_map = Hash.new {|h,k| h[k] = true }
|
@@ -78,16 +92,6 @@ class ProconBypassMan::Procon
|
|
78
92
|
current_layer.macros.each do |macro_name, options|
|
79
93
|
next unless enable_macro_map[macro_name]
|
80
94
|
|
81
|
-
if(if_tilted_left_stick_value = options[:if_tilted_left_stick])
|
82
|
-
threshold = (if_tilted_left_stick_value.is_a?(Hash) && if_tilted_left_stick_value[:threshold]) || ProconBypassMan::AnalogStickTiltingPowerScaler::DEFAULT_THRESHOLD
|
83
|
-
if dumped_tilting_power&.tilting?(threshold: threshold, current_position_x: analog_stick.relative_x, current_position_y: analog_stick.relative_y) && user_operation.pressing_all_buttons?(options[:if_pressed])
|
84
|
-
@@status[:ongoing_macro] = MacroRegistry.load(macro_name)
|
85
|
-
break
|
86
|
-
end
|
87
|
-
|
88
|
-
next
|
89
|
-
end
|
90
|
-
|
91
95
|
if user_operation.pressing_all_buttons?(options[:if_pressed])
|
92
96
|
@@status[:ongoing_macro] = MacroRegistry.load(macro_name, force_neutral_buttons: options[:force_neutral])
|
93
97
|
break
|
@@ -97,10 +101,14 @@ class ProconBypassMan::Procon
|
|
97
101
|
|
98
102
|
# remote macro
|
99
103
|
if task = ProconBypassMan::RemoteMacro::TaskQueueInProcess.non_blocking_shift
|
104
|
+
no_op_step = :wait_for_0_3 # マクロの最後に固まって最後の入力をし続けるので、無の状態を最後に注入する
|
105
|
+
BlueGreenProcess::SharedVariable.extend_run_on_this_process = true
|
100
106
|
ProconBypassMan::Procon::MacroRegistry.cleanup_remote_macros!
|
101
107
|
macro_name = task.name || "RemoteMacro-#{task.steps.join}".to_sym
|
108
|
+
task.steps << no_op_step
|
102
109
|
ProconBypassMan::Procon::MacroRegistry.install_plugin(macro_name, steps: task.steps, macro_type: :remote)
|
103
110
|
@@status[:ongoing_macro] = MacroRegistry.load(macro_name, macro_type: :remote) do
|
111
|
+
GC.start # NOTE: extend_run_on_this_process = true するとGCされなくなるので手動で呼び出す
|
104
112
|
ProconBypassMan::PostCompletedRemoteMacroJob.perform_async(task.uuid)
|
105
113
|
end
|
106
114
|
end
|
@@ -110,6 +118,7 @@ class ProconBypassMan::Procon
|
|
110
118
|
@@status[:ongoing_mode] = ModeRegistry.load(:manual)
|
111
119
|
current_layer.flip_buttons.each do |button, options|
|
112
120
|
if !options[:if_pressed]
|
121
|
+
# FIXME マルチプロセス化したので、クラス変数に状態を保持するFlipCacheは意図した挙動にならない. BlueGreenProcess.shared_variables を使って状態をプロセス間で共有すれば動く
|
113
122
|
FlipCache.fetch(key: button, expires_in: options[:flip_interval]) do
|
114
123
|
status[button] = !status[button]
|
115
124
|
end
|
@@ -146,6 +155,7 @@ class ProconBypassMan::Procon
|
|
146
155
|
end
|
147
156
|
|
148
157
|
if ongoing_macro.ongoing? && (step = ongoing_macro.next_step)
|
158
|
+
BlueGreenProcess::SharedVariable.extend_run_on_this_process = true
|
149
159
|
ongoing_macro.force_neutral_buttons&.each do |force_neutral_button|
|
150
160
|
user_operation.unpress_button(force_neutral_button)
|
151
161
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ProconBypassMan
|
2
4
|
module CallbacksRegisterable
|
3
5
|
attr_accessor :callbacks
|
@@ -93,9 +95,14 @@ module ProconBypassMan
|
|
93
95
|
return self.class.__callbacks[kind.to_sym]
|
94
96
|
end
|
95
97
|
|
96
|
-
list =
|
97
|
-
|
98
|
-
|
98
|
+
list =
|
99
|
+
if self.class.callbacks.nil?
|
100
|
+
[]
|
101
|
+
else
|
102
|
+
self.class.callbacks.flat_map { |callback_mod|
|
103
|
+
callback_mod.__callbacks && callback_mod.__callbacks[kind.to_sym]
|
104
|
+
}.compact
|
105
|
+
end
|
99
106
|
if(self.class.respond_to?(:__callbacks) && chain = self.class.__callbacks[kind.to_sym])
|
100
107
|
list << chain
|
101
108
|
end
|
@@ -34,6 +34,7 @@ module ProconBypassMan
|
|
34
34
|
|
35
35
|
def get
|
36
36
|
handle_request do
|
37
|
+
ProconBypassMan.logger.info "[HTTP] GET #{@uri}"
|
37
38
|
response = HttpRequest::Get.request!(
|
38
39
|
uri: @uri,
|
39
40
|
)
|
@@ -44,6 +45,7 @@ module ProconBypassMan
|
|
44
45
|
def post(request_body: )
|
45
46
|
handle_request do
|
46
47
|
body = {}.merge!(request_body)
|
48
|
+
ProconBypassMan.logger.info "[HTTP] POST #{@uri}"
|
47
49
|
response = HttpRequest::Post.request!(
|
48
50
|
uri: @uri,
|
49
51
|
request_body: body,
|
@@ -57,6 +59,7 @@ module ProconBypassMan
|
|
57
59
|
body = {
|
58
60
|
hostname: `hostname`.chomp,
|
59
61
|
}.merge!(request_body)
|
62
|
+
ProconBypassMan.logger.info "[HTTP] PUT #{@uri}"
|
60
63
|
response = HttpRequest::Put.request!(
|
61
64
|
uri: @uri,
|
62
65
|
request_body: body,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ProconBypassMan
|
2
|
+
class ReniceCommand
|
3
|
+
def self.change_priority(to: , pid: )
|
4
|
+
cmd =
|
5
|
+
case to
|
6
|
+
when :high
|
7
|
+
"renice -n -20 -p #{pid}"
|
8
|
+
when :low
|
9
|
+
"renice -n 20 -p #{pid}"
|
10
|
+
else
|
11
|
+
raise "unknown priority"
|
12
|
+
end
|
13
|
+
ProconBypassMan.logger.debug { "[SHELL] #{cmd}" }
|
14
|
+
`#{cmd}`
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/procon_bypass_man.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "logger"
|
2
4
|
require 'yaml'
|
3
5
|
require "json"
|
@@ -10,6 +12,7 @@ require "ext/em_pure_ruby"
|
|
10
12
|
require "ext/module"
|
11
13
|
require "resolv-replace"
|
12
14
|
require "pbmenv"
|
15
|
+
require "blue_green_process"
|
13
16
|
|
14
17
|
require_relative "procon_bypass_man/version"
|
15
18
|
|
@@ -32,12 +35,12 @@ require_relative "procon_bypass_man/support/remote_macro_http_client"
|
|
32
35
|
require_relative "procon_bypass_man/support/update_remote_pbm_action_status_http_client"
|
33
36
|
require_relative "procon_bypass_man/support/send_device_stats_http_client"
|
34
37
|
require_relative "procon_bypass_man/support/procon_performance_http_client"
|
35
|
-
require_relative "procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler"
|
36
38
|
require_relative "procon_bypass_man/support/never_exit_accidentally"
|
37
39
|
require_relative "procon_bypass_man/support/cycle_sleep"
|
38
40
|
require_relative "procon_bypass_man/support/can_over_process"
|
39
41
|
require_relative "procon_bypass_man/support/gc"
|
40
42
|
require_relative "procon_bypass_man/support/retryable"
|
43
|
+
require_relative "procon_bypass_man/support/renice_command"
|
41
44
|
require_relative "procon_bypass_man/procon_display"
|
42
45
|
require_relative "procon_bypass_man/background"
|
43
46
|
require_relative "procon_bypass_man/commands"
|
@@ -46,6 +49,7 @@ require_relative "procon_bypass_man/device_status"
|
|
46
49
|
require_relative "procon_bypass_man/runner"
|
47
50
|
require_relative "procon_bypass_man/processor"
|
48
51
|
require_relative "procon_bypass_man/configuration"
|
52
|
+
require_relative "procon_bypass_man/ephemeral_configuration"
|
49
53
|
require_relative "procon_bypass_man/buttons_setting_configuration"
|
50
54
|
require_relative "procon_bypass_man/procon"
|
51
55
|
require_relative "procon_bypass_man/device_model"
|
@@ -139,6 +143,11 @@ module ProconBypassMan
|
|
139
143
|
@@configuration ||= ProconBypassMan::Configuration.new
|
140
144
|
end
|
141
145
|
|
146
|
+
# @return [ProconBypassMan::EphemeralConfiguration]
|
147
|
+
def self.ephemeral_config
|
148
|
+
@@ephemeral_configuration ||= ProconBypassMan::EphemeralConfiguration.new
|
149
|
+
end
|
150
|
+
|
142
151
|
# @return [void]
|
143
152
|
def self.reset!
|
144
153
|
ProconBypassMan::Procon::MacroRegistry.reset!
|
@@ -149,7 +158,7 @@ module ProconBypassMan
|
|
149
158
|
|
150
159
|
# @return [void]
|
151
160
|
def self.initialize_pbm
|
152
|
-
|
161
|
+
ProconBypassMan::ReniceCommand.change_priority(to: :low, pid: $$)
|
153
162
|
ProconBypassMan::Background::JobQueue.start!
|
154
163
|
ProconBypassMan::Websocket::Client.start!
|
155
164
|
# TODO ProconBypassMan::DrbObjects.start_all! みたいな感じで書きたい
|
@@ -173,18 +182,27 @@ module ProconBypassMan
|
|
173
182
|
|
174
183
|
# @return [void]
|
175
184
|
def self.after_fork_on_bypass_process
|
176
|
-
|
185
|
+
ProconBypassMan::ReniceCommand.change_priority(to: :high, pid: $$)
|
177
186
|
::GC.start
|
178
187
|
DRb.start_service if defined?(DRb)
|
179
|
-
|
180
|
-
ProconBypassMan::ProconDisplay::Server.start!
|
188
|
+
# GC対策することによって一時的に削除した機能
|
189
|
+
# ProconBypassMan::ProconDisplay::Server.start!
|
190
|
+
|
191
|
+
DRb.start_service if defined?(DRb)
|
192
|
+
BlueGreenProcess.configure do |config|
|
193
|
+
config.after_fork = -> {
|
194
|
+
DRb.start_service if defined?(DRb)
|
195
|
+
ProconBypassMan::RemoteMacroReceiver.start!
|
196
|
+
BlueGreenProcess.config.logger = ProconBypassMan.logger
|
197
|
+
}
|
198
|
+
config.shared_variables = [:buttons, :current_layer_key]
|
199
|
+
end
|
181
200
|
end
|
182
201
|
|
183
202
|
# @return [void]
|
184
203
|
def self.terminate_pbm
|
185
204
|
FileUtils.rm_rf(ProconBypassMan.pid_path)
|
186
205
|
FileUtils.rm_rf(ProconBypassMan.digest_path)
|
187
|
-
ProconBypassMan::Background::JobQueue.shutdown
|
188
206
|
ProconBypassMan::RemoteMacro::QueueOverProcess.shutdown
|
189
207
|
ProconBypassMan::Procon::PerformanceMeasurement::QueueOverProcess.shutdown
|
190
208
|
self.worker&.shutdown
|
data/procon_bypass_man.gemspec
CHANGED
@@ -28,9 +28,11 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
# Uncomment to register a new dependency of your gem
|
31
|
-
spec.add_dependency "pbmenv", ">= 0.1.9" # Pbmenv.install
|
31
|
+
spec.add_dependency "pbmenv", ">= 0.1.9" # enable_pbm_cloud連携機能でPbmenv.installを使っている.
|
32
32
|
spec.add_dependency "action_cable_client"
|
33
33
|
spec.add_dependency "sorted_set"
|
34
|
+
spec.add_dependency "blue_green_process"
|
35
|
+
# spec.add_dependency "blue_green_process"
|
34
36
|
|
35
37
|
# For more information and examples about making a new gem, checkout our
|
36
38
|
# guide at: https://bundler.io/guides/creating_gem.html
|
data/project_template/app.rb
CHANGED
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
gemfile do
|
13
13
|
source 'https://rubygems.org'
|
14
14
|
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
15
|
-
gem 'procon_bypass_man', '0.
|
15
|
+
gem 'procon_bypass_man', '0.3.1'
|
16
16
|
end
|
17
17
|
rescue Bundler::Source::Git::GitCommandError => e
|
18
18
|
retry_count_on_git_command_error = retry_count_on_git_command_error + 1
|
@@ -49,9 +49,6 @@ ProconBypassMan.configure do |config|
|
|
49
49
|
|
50
50
|
# 接続に成功したらコントローラーのHOME LEDを光らせるか
|
51
51
|
config.enable_home_led_on_connect = true
|
52
|
-
|
53
|
-
# 操作が高頻度で固まるときは、 gadget_to_procon_interval の数値を大きくしてください
|
54
|
-
config.bypass_mode = { mode: :normal, gadget_to_procon_interval: 10 }
|
55
52
|
end
|
56
53
|
|
57
54
|
ProconBypassMan.run(setting_path: "/usr/share/pbm/current/setting.yml")
|
data/project_template/app.rb.erb
CHANGED
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
gemfile do
|
13
13
|
source 'https://rubygems.org'
|
14
14
|
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
15
|
-
gem 'procon_bypass_man', '0.
|
15
|
+
gem 'procon_bypass_man', '0.3.1'
|
16
16
|
end
|
17
17
|
rescue Bundler::Source::Git::GitCommandError => e
|
18
18
|
retry_count_on_git_command_error = retry_count_on_git_command_error + 1
|
@@ -54,9 +54,6 @@ ProconBypassMan.configure do |config|
|
|
54
54
|
|
55
55
|
# 接続に成功したらコントローラーのHOME LEDを光らせるか
|
56
56
|
config.enable_home_led_on_connect = true
|
57
|
-
|
58
|
-
# 操作が高頻度で固まるときは、 gadget_to_procon_interval の数値を大きくしてください
|
59
|
-
config.bypass_mode = { mode: :normal, gadget_to_procon_interval: 10 }
|
60
57
|
end
|
61
58
|
|
62
59
|
ProconBypassMan.run(setting_path: "/usr/share/pbm/current/setting.yml")
|
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.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pbmenv
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: blue_green_process
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: A programmable converter for Nintendo Switch Pro Controller
|
56
70
|
email:
|
57
71
|
- n905i.1214@gmail.com
|
@@ -81,7 +95,7 @@ files:
|
|
81
95
|
- docs/getting_started.md
|
82
96
|
- docs/how_to_connect_procon.md
|
83
97
|
- docs/setting/left-analogstick-cap.md
|
84
|
-
- docs/setting/
|
98
|
+
- docs/setting/splatoon2_macro_forward_ikarole.md
|
85
99
|
- docs/setting/splatoon2_macro_sokuwari_bubble.md
|
86
100
|
- docs/setting/splatoon2_recommended_setting.md
|
87
101
|
- docs/setting/splatoon2_shake_tansan.md
|
@@ -147,9 +161,10 @@ files:
|
|
147
161
|
- lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
|
148
162
|
- lib/procon_bypass_man/device_model.rb
|
149
163
|
- lib/procon_bypass_man/device_status.rb
|
164
|
+
- lib/procon_bypass_man/ephemeral_configuration.rb
|
150
165
|
- lib/procon_bypass_man/plugin/splatoon2/macro/charge_tansan_bomb.rb
|
151
|
-
- lib/procon_bypass_man/plugin/splatoon2/macro/dasei_cancel.rb
|
152
166
|
- lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb
|
167
|
+
- lib/procon_bypass_man/plugin/splatoon2/macro/forward_ikarole.rb
|
153
168
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
|
154
169
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb
|
155
170
|
- lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb
|
@@ -180,6 +195,7 @@ files:
|
|
180
195
|
- lib/procon_bypass_man/procon/performance_measurement/span_queue.rb
|
181
196
|
- lib/procon_bypass_man/procon/performance_measurement/span_transfer_buffer.rb
|
182
197
|
- lib/procon_bypass_man/procon/press_button_aware.rb
|
198
|
+
- lib/procon_bypass_man/procon/rumbler.rb
|
183
199
|
- lib/procon_bypass_man/procon/suppress_rumble.rb
|
184
200
|
- lib/procon_bypass_man/procon/user_operation.rb
|
185
201
|
- lib/procon_bypass_man/procon/value_objects/analog_stick.rb
|
@@ -218,7 +234,6 @@ files:
|
|
218
234
|
- lib/procon_bypass_man/remote_pbm_action/value_objects/remote_pbm_action_object.rb
|
219
235
|
- lib/procon_bypass_man/runner.rb
|
220
236
|
- lib/procon_bypass_man/scheduler.rb
|
221
|
-
- lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
|
222
237
|
- lib/procon_bypass_man/support/callbacks.rb
|
223
238
|
- lib/procon_bypass_man/support/can_over_process.rb
|
224
239
|
- lib/procon_bypass_man/support/compress_array.rb
|
@@ -232,6 +247,7 @@ files:
|
|
232
247
|
- lib/procon_bypass_man/support/on_memory_cache.rb
|
233
248
|
- lib/procon_bypass_man/support/procon_performance_http_client.rb
|
234
249
|
- lib/procon_bypass_man/support/remote_macro_http_client.rb
|
250
|
+
- lib/procon_bypass_man/support/renice_command.rb
|
235
251
|
- lib/procon_bypass_man/support/report_http_client.rb
|
236
252
|
- lib/procon_bypass_man/support/retryable.rb
|
237
253
|
- lib/procon_bypass_man/support/safe_timeout.rb
|