|
| 1 | +# joycontrol-pluginloader |
| 2 | + |
| 3 | +[English](./README.md) / [日本語](./README_ja.md) |
| 4 | + |
| 5 | +Bluetooth 経由で Nintendo Switch コントローラのエミュレートが行える joycontrol 用のプラグインローダです。 |
| 6 | +[GitHub - mart1nro/joycontrol](https://github.com/mart1nro/joycontrol) |
| 7 | + |
| 8 | +## インストール |
| 9 | + |
| 10 | +- joycontrol のインストール |
| 11 | + 詳細: [GitHub - mart1nro/joycontrol - README.md](https://github.com/mart1nro/joycontrol/blob/master/README.md) |
| 12 | + |
| 13 | + ```sh |
| 14 | + $ sudo apt install python3-dbus libhidapi-hidraw0 |
| 15 | + $ git clone https://github.com/mart1nro/joycontrol.git |
| 16 | + $ sudo pip3 install joycontrol/ |
| 17 | + ``` |
| 18 | + |
| 19 | +- joycontrol-pluginloader のインストール |
| 20 | + |
| 21 | + ```sh |
| 22 | + $ git clone https://github.com/Almtr/joycontrol-pluginloader |
| 23 | + $ sudo pip3 install joycontrol-pluginloader/ |
| 24 | + ``` |
| 25 | + |
| 26 | +## joycontrol の Proコントローラをペアリングする |
| 27 | + |
| 28 | +1. Open the "Change Grip/Order" menu of the Nintendo Switch |
| 29 | + |
| 30 | + Home > Controllers > Change Grip/Order |
| 31 | + |
| 32 | +1. Run the script |
| 33 | + |
| 34 | + ```sh |
| 35 | + $ sudo python3 joycontrol/run_controller_cli.py PRO_CONTROLLER |
| 36 | + ``` |
| 37 | + |
| 38 | +## 使い方 |
| 39 | + |
| 40 | +- 基本的な使い方 |
| 41 | + |
| 42 | + ``` |
| 43 | + $ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> <Joycontrol Plugin path> |
| 44 | + ``` |
| 45 | + |
| 46 | +- オプション |
| 47 | + |
| 48 | + ``` |
| 49 | + usage: joycontrol-pluginloader.py [-h] [-d DEVICE_ID] [-r RECONNECT_BT_ADDR] |
| 50 | + [-v] |
| 51 | + plugin [options [options ...]] |
| 52 | + |
| 53 | + positional arguments: |
| 54 | + plugin joycontrol plugin path |
| 55 | + options joycontrol plugin options |
| 56 | + |
| 57 | + optional arguments: |
| 58 | + -h, --help show this help message and exit |
| 59 | + -d DEVICE_ID, --device_id DEVICE_ID |
| 60 | + -r RECONNECT_BT_ADDR, --reconnect_bt_addr RECONNECT_BT_ADDR |
| 61 | + The Switch console Bluetooth address, for reconnecting |
| 62 | + as an already paired controller |
| 63 | + -v, --verbose |
| 64 | + ``` |
| 65 | +
|
| 66 | +## プラグインの作り方 |
| 67 | +
|
| 68 | +- ファイルを作成する (e.g. ``SamplePlugin.py``) |
| 69 | +
|
| 70 | + ```python |
| 71 | + import logging |
| 72 | + from JoycontrolPlugin import JoycontrolPlugin |
| 73 | + |
| 74 | + logger = logging.getLogger(__name__) |
| 75 | + |
| 76 | + class SamplePlugin(JoycontrolPlugin): |
| 77 | + async def run(self): |
| 78 | + logger.info('This is sample joycontrol plugin!') |
| 79 | + |
| 80 | + logger.info(f'Plugin Options: {self.options}') |
| 81 | + |
| 82 | + logger.info('Push the A Button') |
| 83 | + await self.button_push('a') |
| 84 | + await self.wait(0.3) |
| 85 | + |
| 86 | + logger.info('Tilt the left stick down') |
| 87 | + await self.left_stick('down') |
| 88 | + await self.wait(0.3) |
| 89 | + ``` |
| 90 | +
|
| 91 | +- ``SamplePlugin.py`` をロードし、実行する |
| 92 | +
|
| 93 | + ```sh |
| 94 | + $ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/SamplePlugin.py arg1 arg2 |
| 95 | + |
| 96 | + <snip> |
| 97 | + |
| 98 | + [13:30:00] JoycontrolPlugin.loader load_plugin::9 INFO - Loading: plugins/samples/SamplePlugin.py |
| 99 | + [13:30:00] plugins/samples/SamplePlugin.py run::8 INFO - This is sample joycontrol plugin! |
| 100 | + [13:30:00] plugins/samples/SamplePlugin.py run::10 INFO - Plugin Options: ['arg1', 'arg2'] |
| 101 | + [13:30:00] plugins/samples/SamplePlugin.py run::12 INFO - Push the A Button |
| 102 | + [13:30:01] plugins/samples/SamplePlugin.py run::16 INFO - Tilt the left stick down |
| 103 | + [13:30:01] __main__ _main::45 INFO - Stopping communication... |
| 104 | + ``` |
| 105 | +
|
| 106 | +## サンプルプラグイン |
| 107 | +
|
| 108 | +### TestControllerButotns |
| 109 | +
|
| 110 | +コントローラのボタンが正常に動作ししているかを確認する。 |
| 111 | +
|
| 112 | +1. 「ボタンの動作チェック」メニューを開く |
| 113 | +
|
| 114 | + HOME > 設定 > コントローラーとセンサー > 入力デバイスの動作チェック > ボタンの動作チェック |
| 115 | +
|
| 116 | +1. joycontrol-pluginloader で TestControllerButtons.py を実行する |
| 117 | +
|
| 118 | + ``` |
| 119 | + $ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/TestControllerButtons.py |
| 120 | + ``` |
| 121 | +
|
| 122 | +### TestControllerSticks |
| 123 | +
|
| 124 | +コントローラのスティックが正常に動作ししているかを確認する。 |
| 125 | +
|
| 126 | +1. 「スティックの補正」メニューを開く |
| 127 | +
|
| 128 | + HOME > 設定 > コントローラーとセンサー > スティックの補正 |
| 129 | +
|
| 130 | +1. joycontrol-pluginloader で TestControllerSticks.py を実行する |
| 131 | +
|
| 132 | + ``` |
| 133 | + $ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/TestControllerSticks.py |
| 134 | + ``` |
| 135 | +
|
| 136 | +### RepeatA |
| 137 | +
|
| 138 | +Aボタンを繰り返し押す。 |
| 139 | +
|
| 140 | +- joycontrol-pluginloader で RepeatA.py を実行する |
| 141 | +
|
| 142 | + ``` |
| 143 | + $ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/RepeatA.py |
| 144 | + ``` |
| 145 | +
|
| 146 | +### SimpleMacro |
| 147 | +
|
| 148 | +指定されたボタンを順番に押す。 |
| 149 | +
|
| 150 | +- joycontrol-pluginloader で SimpleMacro.py を実行する |
| 151 | +
|
| 152 | + ``` |
| 153 | + $ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/SimpleMacro.py a b x y up down left right |
| 154 | + ``` |
| 155 | +
|
| 156 | +## 参考 |
| 157 | +
|
| 158 | +- [GitHub - mart1nro/joycontrol](https://github.com/mart1nro/joycontrol) |
| 159 | +- [Discord - Joy-Con Droid](https://discord.com/invite/SQNEx9v) |
| 160 | +- [GitHub Gist - colemickens/amiibo-emulation-with-linux-vm.md](https://gist.github.com/colemickens/b08d1a339f4483c6b3c08e739d6cf5d0) |
0 commit comments