/MiraDeck

Enables Steam Deck to cast to a wireless Miracast-enabled display (this is pretty much just a plugin template fork for now...)

Primary LanguagePythonOtherNOASSERTION

React-Frontend Plugin Template Chat

Reference example for using decky-frontend-lib in a decky-loader plugin.

Please also refer to the wiki for important information on plugin development and submissions/updates. currently documentation is split between this README and the wiki which is something we are hoping to rectify in the future.

ENG

Developers

Dependencies

This template relies on the user having pnpm installed on their system.
This can be downloaded from npm itself which is recommended.

Linux

sudo npm i -g pnpm

Making your own plugin

  1. You can fork this repo or utilize the "Use this template" button on Github.
  2. In your local fork/own plugin-repository run these commands:
    1. pnpm i
    2. pnpm run build
    • These setup pnpm and build the frontend code for testing.
  3. Consult the decky-frontend-lib repository for ways to accomplish your tasks.
    • Documentation and examples are still rough,
    • While decky-loader primarily targets Steam Deck hardware so keep this in mind when developing your plugin.
  4. If you want an all encompassing demonstration of decky-frontend-lib's capabilities check out decky-playground. It shows off almost all of decky-frontend-lib's features.

Other important information

Everytime you change the frontend code (index.tsx etc) you will need to rebuild using the commands from step 2 above or the build task if you're using vscode or a derivative.

Note: If you are receiving build errors due to an out of date library, you should run this command inside of your repository:

pnpm update decky-frontend-lib --latest

Backend support

If you are developing with a backend for a plugin and would like to submit it to the decky-plugin-database you will need to have all backend code located in backend/src, with backend being located in the root of your git repository. When building your plugin, the source code will be built and any finished binary or binaries will be output to backend/out (which is created during CI.) If your buildscript, makefile or any other build method does not place the binary files in the backend/out directory they will not be properly picked up during CI and your plugin will not have the required binaries included for distribution.

Example:
In our makefile used to demonstrate the CI process of building and distributing a plugin backend, note that the makefile explicitly creates the out folder (backend/out) and then compiles the binary into that folder. Here's the relevant snippet.

hello:
	mkdir -p ./out
	gcc -o ./out/hello ./src/main.c

The CI does create the out folder itself but we recommend creating it yourself if possible during your build process to ensure the build process goes smoothly.

The out folder is not sent to the final plugin, but is then put into a bin folder which is found at the root of the plugin's directory.
More information on the bin folder can be found below in the distribution section below.

Distribution

We recommend following the instructions found in the decky-plugin-database on how to get your plugin up on the plugin store. This is the best way to get your plugin in front of users. You can also choose to do distribution via a zip file containing the needed files, if that zip file is uploaded to a URL it can then be downloaded and installed via decky-loader.

NOTE: We do not currently have a method to install from a downloaded zip file in "game-mode" due to lack of a usable file-picking dialog.

Layout of a plugin zip ready for distribution:

pluginname-v1.0.0.zip (version number is optional but recommended for users sake)
   |
   pluginname/ <directory>
   |  |  |
   |  |  bin/ <directory> (optional)
   |  |     |
   |  |     binary (optional)
   |  |
   |  dist/ <directory> [required]
   |      |
   |      index.js [required]
   | 
   package.json [required]
   plugin.json [required]
   main.py {required if you are using the python backend of decky-loader: serverAPI}
   README.md (optional but recommended)
   LICENSE(.md) [required, filename should be roughly similar, suffix not needed]

Note regarding licenses: Including a license is required for the plugin store if your chosen license requires the license to be included alongside usage of source-code/binaries!

Standard procedure for licenses is to have your chosen license at the top of the file, and to leave the original license for the plugin-template at the bottom. If this is not the case on submission to the plugin database, you will be asked to fix this discrepancy.

We cannot and will not distribute your plugin on the Plugin Store if it's license requires it's inclusion but you have not included a license to be re-distributed with your plugin in the root of your git repository.

RUS

Разработчикам

Зависимости

Данный шаблон можно собрать с помощью pnpm. Сам же pnpm можно установить с помощью npm.

Linux

sudo npm i -g pnpm

Разработка собственного плагина

  1. Для начала необходимо произвести разветвление репозитория шаблона (Можно использовать кнопку "Use this template")
  2. После клонирования разветвленного репозитория шаблона необходимо в директории репозитория запустить следующие команды:
    1. pnpm i
    2. pnpm run build
    • Данные команды настроят и подготовят код внешнего интерфейса для тестирования
  3. Ознакомьтесь с decky-frontend-lib для решения поставленных задач
    • Документация еще не доработана
    • При разработке не забывайте, что целевая платформа - Steam Deck
  4. Если вам необходима обширная демонстрация способностей decky-frontend-lib, обратитесь к decky-playground. В данном репозитории рассмотрены практически все особенности decky-frontend-lib.

Дополнительно

Всякий раз, когда вы меняете код внешнего интерфейса (например, в index.tsx), вам понадобится пересобрать проект, воспользовавшись командами из пункта 2 выше.

На заметку: Если у вас при сборке появляются ошибки из-за устаревших библиотек, вам понадобится запустить следующую команду в директории репозитория:

pnpm update decky-frontend-lib --latest

Поддержка бэкэнда

Если разрабатываемому вами плагину необходим бэкэнд и вы хотите загрузить плагин в базу данных decky-plugin-database, вам необходимо убедиться, что весь код бэкэнда расположен в backend/src, а сам бэкэнд - в корневой директории репозитория. При сборке плагина исходный код будет собран и все бинарные файлы файлы появятся в backend/out. Если ваш скрипт сборки, makefile или любой иной метод сборки не выгружает бинарные файлы в backend/out, то они не будут обнаружены при выгрузке в базу данных.

Распространение

Рекомендуется следовать инструкции в decky-plugin-database по размещению плагина в магазин плагинов. Это лучший способ распространить свой плагин. Плагин также можно распространять посредством загрузки zip файла в облако с последующей его загрузкой по URL в decky-loader.

Внимание: На данный момент нет способа устанавливать скачанные плагины в zip в игровом режиме Steam Deck, так как в нем нет подходящего диалогового окна выбора файлов

Примерная структура файлов плагина:

имяплагина-v1.0.0.zip (номер версии указывать не обязательно, но рекомендуется)
|
   имяплагина/ <каталог>
   |  |  |
   |  |  bin/ <каталог> (не обязательно)
   |  |     |
   |  |     binary (не обязательно)
   |  |
   |  dist/ <каталог> [обязательно]
   |      |
   |      index.js [обязательно]
   | 
   package.json [обязательно]
   plugin.json [обязательно]
   main.py {необходимо если вы используете бэкэнд decky-loader: serverAPI}
   README.md (не обязательно но рекомендуется)
   LICENSE(.md) [обязательно, название файла должно быть схожим, расширение файла не обязательно]

По поводу лицензий: Обязательно прилагайте лицензию к плагину если используемый плагином код имеет лицензию, обязывающую вас её прилагать.

Обычно достаточно просто добавить лицензии использованного кода к лицензии шаблона плагина. Если при загрузке в магазин плагинов обнаружится несоответствие лицензий, вас попросят это исправить.

Decky Loader не может распространять ваш плагин в магазине плагинов если лицензия вашего плагина не включает в себя лицензии, включение которых обязательно.