procon_bypass_man 0.1.16 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +86 -11
  3. data/.github/workflows/release.yml +2 -2
  4. data/.rubocop.yml +2 -0
  5. data/CHANGELOG.md +19 -1
  6. data/Gemfile +1 -0
  7. data/Gemfile.lock +7 -3
  8. data/README.md +39 -15
  9. data/Steepfile +31 -17
  10. data/docs/getting_started.md +60 -0
  11. data/docs/setting/left-analogstick-cap.md +60 -0
  12. data/docs/setting/splatoon2_macro_sokuwari_bubble.md +52 -0
  13. data/docs/setup_raspi.md +2 -0
  14. data/docs/setup_raspi.mitamae.rb +7 -8
  15. data/docs/setup_raspi_by_mitamae.md +37 -1
  16. data/docs/upgrade_pbm.md +56 -0
  17. data/lib/ext/module.rb +16 -0
  18. data/lib/procon_bypass_man/buttons_setting_configuration/layer.rb +33 -7
  19. data/lib/procon_bypass_man/buttons_setting_configuration/loader.rb +4 -1
  20. data/lib/procon_bypass_man/buttons_setting_configuration/validator.rb +36 -0
  21. data/lib/procon_bypass_man/buttons_setting_configuration.rb +34 -21
  22. data/lib/procon_bypass_man/bypass/usb_hid_logger.rb +6 -4
  23. data/lib/procon_bypass_man/commands/bypass_command.rb +2 -2
  24. data/lib/procon_bypass_man/configuration.rb +5 -1
  25. data/lib/procon_bypass_man/domains/binary/base.rb +14 -0
  26. data/lib/procon_bypass_man/domains/binary/inbound_procon_binary.rb +0 -14
  27. data/lib/procon_bypass_man/domains/binary/processing_procon_binary.rb +2 -16
  28. data/lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb +1 -1
  29. data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb +1 -1
  30. data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb +1 -1
  31. data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb +1 -1
  32. data/lib/procon_bypass_man/plugin/splatoon2/macro/sokuwari_for_splash_bomb.rb +22 -0
  33. data/lib/procon_bypass_man/plugin/splatoon2/version.rb +1 -1
  34. data/lib/procon_bypass_man/plugins.rb +1 -0
  35. data/lib/procon_bypass_man/procon/button.rb +1 -1
  36. data/lib/procon_bypass_man/procon/button_collection.rb +8 -0
  37. data/lib/procon_bypass_man/procon/macro.rb +89 -0
  38. data/lib/procon_bypass_man/procon/macro_builder.rb +123 -0
  39. data/lib/procon_bypass_man/procon/macro_registry.rb +9 -27
  40. data/lib/procon_bypass_man/procon/mode_registry.rb +4 -4
  41. data/lib/procon_bypass_man/procon/press_button_aware.rb +6 -5
  42. data/lib/procon_bypass_man/procon/user_operation.rb +16 -2
  43. data/lib/procon_bypass_man/procon/value_objects/analog_stick.rb +1 -1
  44. data/lib/procon_bypass_man/procon.rb +6 -4
  45. data/lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb +3 -3
  46. data/lib/procon_bypass_man/support/compress_array.rb +5 -0
  47. data/lib/procon_bypass_man/support/http_client.rb +4 -0
  48. data/lib/procon_bypass_man/support/on_memory_cache.rb +3 -1
  49. data/lib/procon_bypass_man/support/server_pool.rb +4 -0
  50. data/lib/procon_bypass_man/support/yaml_writer.rb +9 -0
  51. data/lib/procon_bypass_man/version.rb +1 -1
  52. data/lib/procon_bypass_man/websocket/pbm_job_client.rb +13 -2
  53. data/lib/procon_bypass_man.rb +2 -0
  54. data/procon_bypass_man.gemspec +1 -1
  55. data/project_template/README.md +10 -5
  56. data/project_template/app.rb +3 -2
  57. data/sig/main.rbs +213 -42
  58. data/sig/on_memory_cache.rbs +16 -0
  59. metadata +15 -5
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,44 +172,44 @@ end
166
172
 
167
173
  class ProconBypassMan::Configuration
168
174
  module ClassMethods
169
- def root: () -> untyped
175
+ def root: () -> String
170
176
 
171
- def logger: () -> untyped
177
+ def logger: () -> Logger
172
178
 
173
179
  def error_logger: () -> untyped
174
180
 
175
- def pid_path: () -> untyped
181
+ def pid_path: () -> String
176
182
 
177
- def digest_path: () -> untyped
183
+ def digest_path: () -> String
178
184
 
179
- def cache: () -> untyped
185
+ def cache: () -> ProconBypassMan::OnMemoryCache
180
186
 
181
- def config: () -> untyped
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: untyped
193
+ attr_accessor enable_critical_error_logging: bool
188
194
 
189
- def root=: (untyped path) -> untyped
195
+ def root=: (String path) -> ProconBypassMan::Configuration
190
196
 
191
- def root: () -> untyped
197
+ def root: () -> String
192
198
 
193
199
  def api_server=: (untyped api_server) -> untyped
194
200
 
195
- def logger=: (untyped logger) -> untyped
201
+ def logger=: (Logger logger) -> ProconBypassMan::Configuration
196
202
 
197
- def logger: () -> untyped
203
+ def logger: () -> Logger
198
204
 
199
- def error_logger: () -> untyped
205
+ def error_logger: () -> Logger
200
206
 
201
- def digest_path: () -> ::String
207
+ def digest_path: () -> String
202
208
 
203
209
  # @return [String] pbm-webの接続先
204
- def current_server: () -> ::String
210
+ def current_server: () -> String
205
211
 
206
- def current_ws_server: () -> (::String | nil)
212
+ def current_ws_server: () -> (String | nil)
207
213
 
208
214
  def current_ws_server_url: () -> ::String
209
215
 
@@ -216,6 +222,10 @@ class ProconBypassMan::Configuration
216
222
  def internal_servers: () -> ::Array[string | nil]
217
223
 
218
224
  def internal_api_servers: () -> ::Array[untyped]
225
+
226
+ def raw_setting: () -> untyped
227
+
228
+ def verbose_bypass_log: () -> bool
219
229
  end
220
230
 
221
231
 
@@ -387,41 +397,41 @@ end
387
397
 
388
398
  class ProconBypassMan::Procon::MacroRegistry
389
399
  class Macro
390
- attr_accessor name: untyped
400
+ attr_accessor name: Symbol
391
401
 
392
402
  attr_accessor steps: untyped
393
403
 
394
- def initialize: (name: untyped name, steps: untyped steps) -> untyped
404
+ def initialize: (name: untyped Symbol, steps: Symbol) -> void
395
405
 
396
- def next_step: () -> untyped
406
+ def next_step: () -> Symbol
397
407
 
398
- def finished?: () -> untyped
408
+ def finished?: () -> bool
399
409
 
400
- def ongoing?: () -> untyped
410
+ def ongoing?: () -> bool
401
411
  end
402
412
 
403
- PRESETS: ::Hash[untyped, untyped]
413
+ PRESETS: ::Hash[Symbol, Array[Symbol]]
404
414
 
405
415
  def self.install_plugin: (untyped klass) -> untyped
406
416
 
407
- def self.load: (untyped name) -> untyped
417
+ def self.load: (Symbol name) -> untyped
408
418
 
409
- def self.reset!: () -> untyped
419
+ def self.reset!: () -> void
410
420
 
411
- def self.plugins: () -> untyped
421
+ def self.plugins: () -> ::Hash[Symbol, Array[Symbol]]
412
422
  end
413
423
 
414
424
  class ProconBypassMan::Procon::ModeRegistry
415
425
  class Mode
416
- attr_accessor name: untyped
426
+ attr_accessor name: Symbol
417
427
 
418
- attr_accessor binaries: untyped
428
+ attr_accessor binaries: Array[String]
419
429
 
420
- attr_accessor source_binaries: untyped
430
+ attr_accessor source_binaries: Array[String]
421
431
 
422
- def initialize: (name: untyped name, binaries: untyped binaries) -> untyped
432
+ def initialize: (name: Symbol, binaries: Array[String]) -> void
423
433
 
424
- def next_binary: () -> untyped
434
+ def next_binary: () -> String
425
435
  end
426
436
 
427
437
  PRESETS: ::Hash[untyped, untyped]
@@ -435,30 +445,20 @@ class ProconBypassMan::Procon::ModeRegistry
435
445
  def self.plugins: () -> untyped
436
446
  end
437
447
 
438
- module ProconBypassMan::Procon::PressedButtonHelper
439
- module Static
440
- def pressed_button?: (untyped button) -> untyped
441
- end
442
- end
443
-
444
448
  class ProconBypassMan::Procon
445
449
  class UserOperation
446
450
  include LayerChangeable
447
451
 
448
- include PressedButtonHelper::Static
449
-
450
452
  attr_reader binary: untyped
451
453
 
452
454
  def initialize: (untyped binary) -> untyped
453
455
 
454
- ZERO_BIT: untyped
455
-
456
456
  ASCII_ENCODING: ::String
457
457
 
458
458
  # @depilicate
459
459
  def binary=: (untyped binary) -> untyped
460
460
 
461
- def set_no_action!: () -> untyped
461
+ def set_no_action!: () -> void
462
462
 
463
463
  def unpress_button: (untyped button) -> untyped
464
464
 
@@ -496,7 +496,7 @@ module ProconBypassMan
496
496
  end
497
497
 
498
498
  # 5秒後がタイムアウト
499
- def initialize: (?timeout: untyped timeout) -> untyped
499
+ def initialize: (?timeout: untyped timeout) -> void
500
500
 
501
501
  def throw_if_timeout!: () -> untyped
502
502
  end
@@ -508,7 +508,7 @@ module ProconBypassMan
508
508
  def self.from_boot: () -> Integer
509
509
 
510
510
  # @param [String] uptime_cmd_result
511
- def initialize: (uptime_cmd_result: String uptime_cmd_result) -> void
511
+ def initialize: (uptime_cmd_result: String) -> void
512
512
 
513
513
  # @return [Integer]
514
514
  def from_boot: () -> Integer
@@ -518,3 +518,174 @@ end
518
518
  module ProconBypassMan
519
519
  VERSION: ::String
520
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
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.16
4
+ version: 0.1.19
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-26 00:00:00.000000000 Z
11
+ date: 2022-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pbmenv
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: An extension for Nintendo Switch Pro Controller
55
+ description: A programmable converter for Nintendo Switch Pro Controller
56
56
  email:
57
57
  - n905i.1214@gmail.com
58
58
  executables: []
@@ -76,11 +76,16 @@ files:
76
76
  - bin/console
77
77
  - bin/dev_api_server.rb
78
78
  - bin/setup
79
+ - docs/getting_started.md
79
80
  - docs/how_to_connect_procon.md
81
+ - docs/setting/left-analogstick-cap.md
82
+ - docs/setting/splatoon2_macro_sokuwari_bubble.md
80
83
  - docs/setup_raspi.md
81
84
  - docs/setup_raspi.mitamae.rb
82
85
  - docs/setup_raspi_by_mitamae.md
86
+ - docs/upgrade_pbm.md
83
87
  - lib/ext/em_pure_ruby.rb
88
+ - lib/ext/module.rb
84
89
  - lib/procon_bypass_man.rb
85
90
  - lib/procon_bypass_man/background.rb
86
91
  - lib/procon_bypass_man/background/job_performer.rb
@@ -126,6 +131,7 @@ files:
126
131
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
127
132
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb
128
133
  - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb
134
+ - lib/procon_bypass_man/plugin/splatoon2/macro/sokuwari_for_splash_bomb.rb
129
135
  - lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb
130
136
  - lib/procon_bypass_man/plugin/splatoon2/version.rb
131
137
  - lib/procon_bypass_man/plugins.rb
@@ -137,6 +143,8 @@ files:
137
143
  - lib/procon_bypass_man/procon/consts.rb
138
144
  - lib/procon_bypass_man/procon/flip_cache.rb
139
145
  - lib/procon_bypass_man/procon/layer_changer.rb
146
+ - lib/procon_bypass_man/procon/macro.rb
147
+ - lib/procon_bypass_man/procon/macro_builder.rb
140
148
  - lib/procon_bypass_man/procon/macro_registry.rb
141
149
  - lib/procon_bypass_man/procon/mode_registry.rb
142
150
  - lib/procon_bypass_man/procon/press_button_aware.rb
@@ -164,6 +172,7 @@ files:
164
172
  - lib/procon_bypass_man/support/signal_handler.rb
165
173
  - lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb
166
174
  - lib/procon_bypass_man/support/uptime.rb
175
+ - lib/procon_bypass_man/support/yaml_writer.rb
167
176
  - lib/procon_bypass_man/version.rb
168
177
  - lib/procon_bypass_man/websocket/pbm_job_client.rb
169
178
  - procon_bypass_man.gemspec
@@ -175,6 +184,7 @@ files:
175
184
  - project_template/web.rb
176
185
  - sig/README.md
177
186
  - sig/main.rbs
187
+ - sig/on_memory_cache.rbs
178
188
  homepage: https://github.com/splaplapla/procon_bypass_man
179
189
  licenses:
180
190
  - MIT
@@ -197,8 +207,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
207
  - !ruby/object:Gem::Version
198
208
  version: '0'
199
209
  requirements: []
200
- rubygems_version: 3.0.3.1
210
+ rubygems_version: 3.2.15
201
211
  signing_key:
202
212
  specification_version: 4
203
- summary: An extension for Nintendo Switch Pro Controller
213
+ summary: A programmable converter for Nintendo Switch Pro Controller
204
214
  test_files: []