Powerful software for playing games through text, supporting remote collaborative play.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

5.4 KiB

Building from source

  1. Clone the repo with git clone https://codeberg.org/kimimaru/TRBot.git
  2. Install the .NET 5.0 SDK and Runtime
  • Before installing, set the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 if you don't want dotnet CLI commands sending telemetry.

Once you have all the requirements, you can build TRBot using the provided .sln or through the CLI (instructions below). You can also use any code editor or IDE supporting .NET 5, such as VSCode/VSCodium, Visual Studio, or JetBrains Rider.

Provided in the root of the repository are build scripts that compile versions of the TRBot.Main and TRBotDataMigrationTool projects for both GNU/Linux and Windows. Run build.sh on GNU/Linux and build.bat on Windows. On Windows, make sure dotnet is installed in your PATH before running the script.

For manual builds, follow the instructions below.

Command line:

  • Main directory: cd TRBot.Main
  • Building: dotnet build
  • Publishing: dotnet publish -c (config) -o (dir) --self-contained --runtime (RID)
    • config = "Debug" or "Release"
    • dir = output directory
    • RID = usually "win-x64" or "linux-x64". See link for a full list of runtime identifiers.
    • Example: dotnet publish -c Debug -o ~/Desktop/TRBot --self-contained --runtime linux-x64

Note: TRBot runs on all major desktop operating systems, but virtual controller input works only on Windows (vJoy) and GNU/Linux (uinput) since virtual controllers are platform-specific. The virtual controller API is abstracted into an IVirtualController interface, making it possible to add new implementations. Please file an issue if your platform isn't supported.

If you want to build the other applications, such as the data migration tool, run the publish command in the application's directory or build its project in your IDE.

Native code

Some virtual controllers require native code. These will be in the "Native" folder of TRBot.VirtualControllers. Below are steps on how to compile them. Note that these components are pre-compiled in source and binary releases of TRBot.

Note: The pre-built uinput virtual controllers were compiled for Debian-based systems and may not work out of the box with your distribution.

uinput

The uinput virtual controller is implemented via libevdev. As a result, libevdev will need to be installed on your system before you can compile the code.

Prerequisite packages: -libevdev-dev -libudev-dev

Example installation for Debian-based systems:

sudo apt update
sudo apt install libevdev-dev libudev-dev

These package names may be different depending on your distribution.

After installing libevdev, the uinput virtual controller code, SetupVController.c, can be compiled with gcc as a shared library (gcc -fPIC -shared SetupVController.c $(pkg-config --cflags --libs libevdev) -o ../SetupVController.so). Use the newly compiled file in place of the old one.

The pkg-config section is very important, so be sure to include it. If it's absent, it won't include all the libevdev dependencies, causing the code to fail during compilation or runtime.

If you'd like to adjust the virtual controller's axes values and deadzones, modify the constants at the top of SetupVController.h and recompile.

vJoy Wrapper

The vJoy C# wrapper code can be found on the most up-to-date repository. While unconfirmed, you should be able to compile it with make.

Unfortunately, compiling the vJoy driver itself isn't very clear, but 64-bit versions of Windows will not load the driver unless it is signed. Doing this is out-of-scope for this guide, so in short, it's recommended to use the already-signed drivers provided through the official download.

Migrations

TRBot uses a SQLite database with Entity Framework Core to store and manage its data. If you make code changes to any entities or contexts that affects the database, such as adding/deleting/renaming a column, adding/removing a DbSet, or modifying entity relationships in OnModelCreating, you will need to add a new migration:

  • Go to the TRBot.Data project and run dotnet ef migrations list to list all migrations. Take note of the furthest one down, which is the most recent. If needed, you can verify the date prepended to the name of each migration.
  • Run dotnet ef migrations add (migrationhere), where "(migrationhere)" is the name of the migration.
    • Example: dotnet ef migrations add NewUserPermissions

Afterwards, simply run TRBot to apply the new migrations and update the database.

Running Tests

All unit tests are in the TRBot.Tests project. Some of these tests include parser tests for correctness.

Simply run dotnet test inside this directory to run the tests. Please add new tests for code when feasible.

Contributing

If you find any problems with TRBot, please file an issue. Pull requests are encouraged if you'd like to make contributions.

TRBot is free software; as such, you can run, study, modify, and distribute it for any purpose. See the License for more information.