procon_bypass_man 0.1.18 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae61096a07d9982a4a88fd64c0ba41039d351b5925ff2953ca4b44c546d92715
4
- data.tar.gz: 1c969b841734cd26e0d8ee58e182e8cfda86f69a40a57e4a88fb6f0d8e92e201
3
+ metadata.gz: 7db95a3b559da58846417c4c1130c20c1fdfabae51f0b089660c3fa0d9ac9f30
4
+ data.tar.gz: 397b20e751282f15fd65bc22dc81be62cde78e8a765abc5185c4bc45a63b3e5e
5
5
  SHA512:
6
- metadata.gz: 64507342d85810c8b92a3ed8b0098055ce984fd959d070c7259a04097bb295e4720ebe6c0e615493e233d04957783e259fc20fa78b5f2d0bbbd73d624c6154c5
7
- data.tar.gz: a7ac7c9073422240e6f80d1d3aff3fc606dc6b718f3922cb05769783b5cfae62acb449bdba5b2282a922f1cf7a42f34e26e0818251ec89812f875b0c50dab46f
6
+ metadata.gz: d83e34d63afbd6e46da32f00cc0a79330d55dfea6c9ae1451c0ed12c14607b5c9623b96c036b6ad2ec8668047212ecf21aa6d6dd80c9b300633d514e4f4c1a0a
7
+ data.tar.gz: c518539e4d905ccf1754b49ecf9de1a3ff0ed3ce1c71c9e262a6e468126647b415dbfe87d0e99cb468bfd8c3f5267ef4204622b3134831f1ab2600bf3d8dffd4
data/.circleci/config.yml CHANGED
@@ -15,34 +15,108 @@ executors:
15
15
  BUNDLE_JOBS: 4
16
16
  working_directory: ~/app
17
17
 
18
+ commands: &commands
19
+ bundle_install:
20
+ parameters:
21
+ ruby-version:
22
+ type: string
23
+ steps:
24
+ - checkout
25
+ - restore_cache:
26
+ keys:
27
+ - gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
28
+ - gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }}
29
+ - gem-cache-v1
30
+ - run: gem i bundler && bundle install --path vendor/bundle --jobs 100 && bundle clean
31
+ - save_cache:
32
+ key: gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
33
+ paths:
34
+ - vendor/bundle
35
+
18
36
  jobs:
37
+ bundle_install:
38
+ parameters:
39
+ ruby-version:
40
+ type: string
41
+ executor:
42
+ name: ruby
43
+ tag: << parameters.ruby-version >>
44
+ steps:
45
+ - bundle_install:
46
+ ruby-version: << parameters.ruby-version >>
47
+ lint:
48
+ parameters:
49
+ ruby-version:
50
+ type: string
51
+ executor:
52
+ name: ruby
53
+ tag: << parameters.ruby-version >>
54
+ steps:
55
+ - bundle_install:
56
+ ruby-version: << parameters.ruby-version >>
57
+ - run: bundle exec rubocop -P
58
+ type_check:
59
+ parameters:
60
+ ruby-version:
61
+ type: string
62
+ executor:
63
+ name: ruby
64
+ tag: << parameters.ruby-version >>
65
+ steps:
66
+ - bundle_install:
67
+ ruby-version: << parameters.ruby-version >>
68
+ - run: bundle exec steep check
19
69
  rspec:
20
70
  parameters:
21
- version:
71
+ ruby-version:
22
72
  type: string
23
73
  executor:
24
74
  name: ruby
25
- tag: << parameters.version >>
75
+ tag: << parameters.ruby-version >>
26
76
  steps:
27
- - checkout
28
- - run: ruby --version
29
- - run: bundle --version
30
- - run: gem --version
31
- - run: gem install bundler
32
- - run: bundle install --jobs 4
33
- - run: bundle exec rubocop
77
+ - bundle_install:
78
+ ruby-version: << parameters.ruby-version >>
34
79
  - run: bundle exec rspec
35
- - run: bundle exec steep check
36
80
 
37
81
  build_jobs: &build_jobs
82
+ - bundle_install:
83
+ matrix:
84
+ parameters:
85
+ ruby-version:
86
+ - "2.7"
87
+ - "3.0.1"
88
+ - "3.0.2"
89
+ - "3.1.0"
90
+ - lint:
91
+ matrix:
92
+ parameters:
93
+ ruby-version:
94
+ - "2.7"
95
+ - "3.0.1"
96
+ - "3.0.2"
97
+ - "3.1.0"
98
+ requires:
99
+ - bundle_install
100
+ - type_check:
101
+ matrix:
102
+ parameters:
103
+ ruby-version:
104
+ - "2.7"
105
+ # - "3.0.1" # たまにSEGVするので
106
+ - "3.0.2"
107
+ - "3.1.0"
108
+ requires:
109
+ - bundle_install
38
110
  - rspec:
39
111
  matrix:
40
112
  parameters:
41
- version:
113
+ ruby-version:
42
114
  - "2.7"
43
115
  - "3.0.1"
44
116
  - "3.0.2"
45
117
  - "3.1.0"
118
+ requires:
119
+ - bundle_install
46
120
  workflows:
47
121
  version: 2
48
122
  build:
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## [0.1.18] - 2022-0
1
+ ## [0.1.19] - 2022-02-09
2
+ - 設定ファイルを再読み込みするときに構文がエラーがあると、接続が切れる不具合を修正しました
3
+ - 設定ファイルをpbm-cloudから復元するときに設定ファイルの改行コードが消える不具合を修正しました
4
+
5
+ ## [0.1.18] - 2022-02-05
2
6
  - macroでできることが増えました
3
7
  - 1ステップで複数のボタン入力と継続時間を指定ができるようになりました
4
8
  - スプラトゥーン2用のバブル即割マクロ(SokuwariForSplashBomb)が使えるようになりました
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- procon_bypass_man (0.1.18)
4
+ procon_bypass_man (0.1.19)
5
5
  action_cable_client
6
6
  pbmenv
7
7
  sorted_set
@@ -49,7 +49,7 @@ GEM
49
49
  rb-inotify (0.10.1)
50
50
  ffi (~> 1.0)
51
51
  rbs (1.7.1)
52
- rbtree (0.4.4)
52
+ rbtree (0.4.5)
53
53
  regexp_parser (2.2.0)
54
54
  rexml (3.2.5)
55
55
  rspec (3.10.0)
data/README.md CHANGED
@@ -3,18 +3,22 @@
3
3
 
4
4
  [![Ruby](https://github.com/splaplapla/procon_bypass_man/actions/workflows/ruby.yml/badge.svg?branch=master)](https://github.com/splaplapla/procon_bypass_man/actions/workflows/ruby.yml)
5
5
 
6
- * Switchに繋いだプロコンを連射機にしたり、キーのリマップをしたり、マクロを実行できるツールです
6
+ * Switchに繋いだプロコンを連射機にしたり、ボタンのリマップをしたり、マクロを実行できる、Raspberry Pi上で動かすツールです
7
7
  * 設定ファイルはrubyスクリプトで記述します
8
8
  * 特定のタイトルに特化した振る舞いにしたい時は各プラグインを使ってください
9
+ * ドキュメントは [getting_started.md](docs/getting_started.md) にまとめています
9
10
 
10
11
  ![image](https://user-images.githubusercontent.com/1664497/123414210-942f6980-d5ee-11eb-8192-955bd9e37e0b.png)
11
12
 
13
+
14
+ <!--
12
15
  ```
13
16
  @startuml
14
- ProController --> (PBM): ZR押しっぱなし
17
+ ProController \-\-> (PBM): ZR押しっぱなし
15
18
  Switch <-- (PBM): ZR連打
16
19
  @enduml
17
20
  ```
21
+ -->
18
22
 
19
23
  ## 使うハードウェア
20
24
  * プロコン
@@ -35,7 +39,7 @@ Switch <-- (PBM): ZR連打
35
39
  * sudo apt-get install rbenv
36
40
  * git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
37
41
  * rbenv install 3.0.1
38
- * sudo gem install pbmenv
42
+ * gem install pbmenv
39
43
  * sudo [pbmenv](https://github.com/splaplapla/pbmenv) install latest
40
44
  * Raspberry Pi4 でprocon_bypass_manを実行する
41
45
  * cd /usr/share/pbm/current
@@ -65,10 +69,11 @@ Switch <-- (PBM): ZR連打
65
69
  * ラズベリーパイ4のセットアップ方法は?
66
70
  * https://github.com/splaplapla/procon_bypass_man/tree/master/docs/setup_raspi.md
67
71
  * モード, マクロの違いは?
68
- * modeはProconの入力をそのまま再現するため機能。レイヤーを切り替えるまで繰り返し続ける
69
- * マクロは特定のキーを順番に入れていく機能。キーの入力が終わったらマクロは終了する
72
+ * modeはProconの入力をそのまま再現するため機能。レイヤーを切り替えるまで繰り返し続けます
73
+ * マクロは特定のキーを順番に入れていく機能。キーの入力が終わったらマクロは終了します
70
74
  * レイヤーとは?
71
- * 自作キーボードみたいな感じでレイヤー毎に設定内容を記述して切り替えれる
75
+ * 自作キーボードみたいな感じでレイヤー毎に設定内容を記述して切り替えれます
76
+ * レイヤーは4つあって、up, down, left, rightです。十字キーに対応しています
72
77
  * レイヤーを切り替える方法は?
73
78
  * 設定ファイルに記述している `prefix_keys_for_changing_layer`の後ろにあるキーを同時押しながら、十字キーのどれかを押すことで任意のレイヤーに切り替わります
74
79
  * このツールでできることは?
@@ -76,16 +81,15 @@ Switch <-- (PBM): ZR連打
76
81
  * リマップは1つのキーを別のキーに割り当てます
77
82
  * 連射中には特定のキーの入力を無視したり、複数のキーをトリガーに連射することができます
78
83
  * どうしてsudoが必要なの?
79
- * 操作するdeviceファイルの所有者がrootだから
84
+ * 操作するdeviceファイルの所有者がrootだからです
80
85
  * 市販されているサードパーティ製連射機との違いは?
81
- * サードパーティ製のコントローラーは、設定方法や形状が特殊で買い換えるたびに学習・設定コストが発生します。本ツールを使えば、設定内容はテキストで管理することができ、使い慣れたプロコンで同等のことができます。
86
+ * サードパーティ製のコントローラーは、設定方法や形状が特殊で買い換えるたびに学習・設定コストが発生します。本ツールを使えば、設定内容はテキストで管理することができ、使い慣れたプロコンで同等のことができます
82
87
  * sshなしで運用は可能ですか?
83
- * 後述するWEBアプリケーションを使えば、sshを使わずに運用が可能です
84
- * https://github.com/splaplapla/procon_bypass_man_cloud
85
- * 機能開発中ですが、使ってくれる人を探しているのでdiscordからお問合せください
88
+ * https://pbm-cloud.herokuapp.com を使えば、sshを使わずに運用が可能です
86
89
 
87
90
  ## TODO
88
91
  * レコーディング機能(プロコンの入力をマクロとして登録ができる)
92
+ * ドキュメントを書く(doing)
89
93
 
90
94
  ## 開発系
91
95
  ### プロコンとの接続を維持したまま、現在の設定ファイルをPBMに反映する
@@ -0,0 +1,60 @@
1
+ # GETTING STARTED
2
+ ## 目次
3
+ * [はじめに](#はじめに)
4
+ * [procon_bypass_manで解決したいこと](#procon_bypass_manで解決したいこと)
5
+ * [procon_bypass_manでできること](#procon_bypass_manでできること)
6
+ * [セットアップ](#セットアップ)
7
+ * ラズベリーパイのセットアップ
8
+ * procon_bypass_manのインストール
9
+ * pbmenvを使う方法
10
+ * pbmenvを使わない方法
11
+ * とりあえず動かす方法
12
+ * [普段使いをするためのセットアップ](#普段使いをするためのセットアップ)
13
+ * レイヤー
14
+ * モード
15
+ * マクロ
16
+ * 左スティックの感度調整
17
+ * 設定ファイルの書き方
18
+ * layer
19
+ * プラグインの書き方
20
+ * 設定ファイルの書き方がわからない、エラーが起きるとき
21
+ * procon_bypass_man_cloudについて
22
+
23
+ ## はじめに
24
+ ### procon_bypass_manで解決したいこと
25
+
26
+ 通常、ボタン連射をするには、市販されているサードパーティー製のコントローラーを使う必要があるのですが、ボタンの押した感覚や各種設定方法は各社の独自仕様であるため、それらを手に馴染ませるのがとても大変です。
27
+ 特に「説明書を熟読してコントローラーの設定方法を覚えること、設定されている状態を思い出す」がつらい。
28
+
29
+ このツールを使うことで、使い慣れたコントローラーを使ってボタン連射ができます。また、設定内容はテキストで管理しているため一目瞭然です。
30
+
31
+ ### procon_bypass_manでできること
32
+ * 設定内容を即時に入れ替え(レイヤー管理)
33
+ * 連射
34
+ * 連射中は特定のキーの入力を無視したり、複数のキーをトリガーに連射することもできます
35
+ * マクロ
36
+ * [活用例](/docs/setting/splatoon2_macro_sokuwari_bubble.md)
37
+ * 特定の同じ操作の繰り返し(モード)
38
+ * 左スティックの感度調整
39
+ * [設定方法](/docs/setting/left-analogstick-cap.md)
40
+ * WEBから設定状態の閲覧・反映
41
+ * ボタンリマップ
42
+
43
+ ## セットアップ
44
+ * 後で書きます
45
+
46
+ ## 普段使いをするためのセットアップ
47
+
48
+ procon_bypass_manを起動するだけでプロコンと接続ができるようになったら、Raspberry Piを起動したときにprocon_bypass_manも自動起動するように設定しましょう。
49
+ これを設定すると、Switch本体の電源ボタンを押すだけで使えるようになります。(実際には、Raspberry Piが起動して、procon_bypass_manが動き始めるまでに30秒くらいかかります。)
50
+
51
+ 自動起動方法は、pbmenvを使っているなら以下の2行をshellで実行すれば完了です。
52
+
53
+ ```
54
+ sudo systemctl link /usr/share/pbm/current/systemd_units/pbm.service
55
+ sudo systemctl enable pbm.service
56
+ ```
57
+
58
+ pbmenvを使っていない場合は、 https://github.com/splaplapla/procon_bypass_man/blob/master/project_template/systemd_units/pbm.service をダウンロードして、 `systemctl link` をしてください。
59
+
60
+ ゲームをやめたくなったらSwitchはそのままスリープに入って問題ないです。このときにRaspberry Piも一緒に電源が切れてしまいますが故障することはありません。
data/docs/upgrade_pbm.md CHANGED
@@ -1,7 +1,31 @@
1
1
  # procon_bypass_man のアップグレード方法
2
+ * pbm-cloudを使う方法、pbmenvを使う方法、pbmenvを使わない方法があります
3
+
4
+ ## pbm-cloudを使う方法
5
+ * https://pbm-cloud.herokuapp.com からデバイス詳細画面を開いてください
6
+ * `デバイスの設定` => `PBMのバージョンアップ`を選択して、表示されるモーダルからインストールしたいバージョンを選択し、 `このバージョンでバージョンアップする` をクリックしてください
7
+ * クリックするとRaspberry Piが再起動するのでしばらく待ってください
8
+ * 設定ファイルが初期状態に戻っているので適宜復元してください
9
+ * デバイス詳細画面からバージョンが上がっていることを確認してください
10
+
11
+ ## pbmenvを使う方法
12
+ * sshをして、以下の3行を実行してください
13
+
14
+ ```
15
+ sudo gem i pbmenv
16
+ sudo pbmenv install latest
17
+ sudo pbmenv use latest
18
+ ```
19
+
20
+ * `sudo pbmenv use latest` を実行すると、 `/usr/share/pbm/current/` に新しいバージョンのprocon_bypass_manを配備します
21
+ * `/usr/share/pbm/current/setting.yml` が初期状態になっているので適宜変更してください
22
+ * 前バージョンのsetting.ymlは消していないので残っています
23
+ * 変更後は、プログラムを起動し直してください
24
+
25
+ ## pbmenvを使わない方法
2
26
  * rbファイル内にある `gem 'procon_bypass_man', ` の後ろの番号を変更することで、procon_bypass_manのバージョンを変更できます
3
27
  * 最新バージョンは https://rubygems.org/gems/procon_bypass_man を参照してください
4
- * 変更後は、プログラムを実行し直してください。プログラムを起動中であればraspberry piを再起動後にプログラムを起動してください
28
+ * 変更後は、プログラムを起動し直してください
5
29
  * バージョンを変更後、エラーになる場合はサポートするので、discordやissueに報告をお願いします
6
30
 
7
31
  ```ruby
@@ -100,7 +100,7 @@ module ProconBypassMan
100
100
  end
101
101
 
102
102
  if(const = Module.const_get(key.to_s))
103
- if not const.respond_to?(:binaries) && mode.call
103
+ if not (const.respond_to?(:binaries) && mode.call)
104
104
  @errors[:mode] << "モード #{key}を読み込めませんでした。"
105
105
  end
106
106
  end
@@ -116,7 +116,7 @@ module ProconBypassMan
116
116
  end
117
117
 
118
118
  if(const = Module.const_get(key.to_s))
119
- if not const.respond_to?(:steps) && macro.call
119
+ if not (const.respond_to?(:steps) && macro.call)
120
120
  @errors[:macro] << "マクロ #{key}を読み込めませんでした。"
121
121
  end
122
122
  end
@@ -10,8 +10,6 @@ module ProconBypassMan
10
10
  :setting_path,
11
11
  :mode_plugins,
12
12
  :macro_plugins,
13
- :context,
14
- :current_context_key,
15
13
  :neutral_position
16
14
 
17
15
  def self.instance
@@ -27,22 +25,22 @@ module ProconBypassMan
27
25
  @@context[current_context_key] = val
28
26
  end
29
27
 
30
- def self.switch_new_context(key)
31
- @@context[key] = new
28
+ def self.switch_new_context(new_context_key)
29
+ @@context[new_context_key] = new
32
30
  previous_key = current_context_key
33
31
  if block_given?
34
- @@current_context_key = key
35
- value = yield(@@context[key])
36
- @@current_context_key = previous_key
32
+ @@current_context_key = new_context_key
33
+ value = yield(@@context[new_context_key])
37
34
  return value
38
35
  else
39
- @@current_context_key = key
36
+ @@current_context_key = new_context_key
40
37
  end
38
+ ensure
39
+ @@current_context_key = previous_key
41
40
  end
42
41
 
43
42
  def initialize
44
43
  reset!
45
- self.class.instance = self
46
44
  end
47
45
 
48
46
  module ManualMode
@@ -6,9 +6,9 @@ module ProconBypassMan
6
6
  require "pbmenv"
7
7
  ProconBypassMan.logger.info "execute RestorePbmSettingAction!"
8
8
  setting = args.dig("setting") or raise(ProconBypassMan::RemotePbmAction::NeedPbmVersionError, "settingが必要です, #{args.inspect}")
9
- File.write(
10
- ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path,
11
- setting.to_yaml,
9
+ ProconBypassMan::YamlWriter.execute(
10
+ path: ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path,
11
+ content: setting,
12
12
  )
13
13
  ProconBypassMan.hot_reload!
14
14
  end
@@ -0,0 +1,9 @@
1
+ class ProconBypassMan::YamlWriter
2
+ # @return [void]
3
+ def self.write(path: , content: )
4
+ File.write(
5
+ path,
6
+ content.gsub("\r\n", "\n").to_yaml,
7
+ )
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProconBypassMan
4
- VERSION = "0.1.18"
4
+ VERSION = "0.1.19"
5
5
  end
@@ -13,6 +13,7 @@ require_relative "procon_bypass_man/version"
13
13
  require_relative "procon_bypass_man/remote_pbm_action"
14
14
  require_relative "procon_bypass_man/support/signal_handler"
15
15
  require_relative "procon_bypass_man/support/callbacks"
16
+ require_relative "procon_bypass_man/support/yaml_writer"
16
17
  require_relative "procon_bypass_man/support/safe_timeout"
17
18
  require_relative "procon_bypass_man/support/compress_array"
18
19
  require_relative "procon_bypass_man/support/uptime"
@@ -5,7 +5,7 @@ require 'bundler/inline'
5
5
  gemfile do
6
6
  source 'https://rubygems.org'
7
7
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
8
- gem 'procon_bypass_man', '0.1.18'
8
+ gem 'procon_bypass_man', '0.1.19'
9
9
  end
10
10
 
11
11
  ProconBypassMan.configure do |config|
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.18
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: 2022-02-05 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
@@ -76,6 +76,7 @@ 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
80
81
  - docs/setting/left-analogstick-cap.md
81
82
  - docs/setting/splatoon2_macro_sokuwari_bubble.md
@@ -171,6 +172,7 @@ files:
171
172
  - lib/procon_bypass_man/support/signal_handler.rb
172
173
  - lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb
173
174
  - lib/procon_bypass_man/support/uptime.rb
175
+ - lib/procon_bypass_man/support/yaml_writer.rb
174
176
  - lib/procon_bypass_man/version.rb
175
177
  - lib/procon_bypass_man/websocket/pbm_job_client.rb
176
178
  - procon_bypass_man.gemspec