0.10.22 • Published 5 months ago

brs-emu v0.10.22

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

BRS-EMU: BrightScript 2D API Emulator

An emulator for the Roku BrightScript language that runs on Firefox or Chrome browsers and Electron applications.

NPM Version

The Library

This library extends brs, a command line interpreter for BrightScript language, by implementing the Draw 2D API components (roScreen, roCompositor, roRegion, etc.) and several other BrightScript components allowing a full channel execution over an HTML5 Canvas, including emulation of the Roku remote control.

Note: Although brs-emu runs channels with user interface, it has no intention of emulating the full Roku OS user interface, see Current Limitations page for full details on what is out of scope.

Technology and Compatibility

This emulator is bundled as a couple of Webpack Javascript libraries:

  • brsEmu.js the emulator API to be used by the application.
  • brsEmu.worker.js the Web Worker that runs the language interpreter.

It uses features like SharedArrayBuffer and OffScreenCanvas, that are bleeding edge in the browser engines implementation, because of that, at this moment, it can only be executed in Firefox (version 105 or higher) or Chromium based browsers, like Chrome, Brave, Opera, Edge. The emulator can also be embedded on an Electron application. The BrightScript 2D API Emulator is a full client-side library, nothing is sent or processed in the server side.

How to use it

If you just want to try the emulator, not installing or downloading anything, then simply go to the web application at: https://lvcabral.com/brs

Desktop Application

You can also run the emulator as a multi-platform desktop application (Windows, Linux & macOS) that uses the same library generated by this project, download and install the specific OS package from the latest release. For the app source and documentation check the app repository. The desktop app, introduces several aditional features, such as the ECP (External Control Protocol) and Remote Console servers to allow integration with 3rd party development tools like the VSCode BrightScript Extension. It also allows you to control the device configuration like screen resolution, localization, among others.

Installation

The brs-emu project is published as a node package, so use npm:

$ npm install brs-emu

or yarn if that's your preference:

$ yarn add brs-emu

Documentation

Contributing

There are many ways in which you can participate in the project, read documents below to know the details:

Note for BrightScript Developers

You can see the debug messages from print statements in your code using the browser or desktop app console, just make sure you open the Developer Tools (Ctrl+Shift+i) before loading your channel package or brs file. Exceptions from the emulator will be shown there too. If your code does show an error in some scenario not listed on the limitations documentation, feel free to open an issue.

Games and Demos

You can try the emulator by running one of the demonstration channels included in the repository, these are pre-configured as clickable icons on index.html. In addition to those, you can load your own code, either as a single .brs file or a channel .zip package. Below there is a list of tested games that are publicly available with source code, download the zip files and have fun!

Author Links

License

Copyright © Marcelo Lv Cabral. All rights reserved.

Licensed under the MIT license.