All Projects → XorTroll → Brew.js

XorTroll / Brew.js

Licence: other
[WIP] C++ high-level JavaScript API for Nintendo 3DS/Switch

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Brew.js

Nx Shell
A multi-purpose file manager for the Nintendo Switch.
Stars: ✭ 639 (+369.85%)
Mutual labels:  switch, nintendo-switch, homebrew
Vba M Nx
WIP full featured port of VBA-M for Nintendo Switch
Stars: ✭ 11 (-91.91%)
Mutual labels:  switch, nintendo-switch, homebrew
Hydrosphere
Ocean beyond the Horizon
Stars: ✭ 17 (-87.5%)
Mutual labels:  switch, nintendo-switch, homebrew
Goldleaf
🍂 Multipurpose homebrew tool for Nintendo Switch
Stars: ✭ 2,026 (+1389.71%)
Mutual labels:  switch, homebrew, nintendo-switch
sys-clk-Overlay
Editor for your sys-clk configuration using ovl-loader!
Stars: ✭ 53 (-61.03%)
Mutual labels:  homebrew, switch, nintendo-switch
Homebrew-Guide
Guide for getting CFW setup on your Nintendo Switch (And Wii U)
Stars: ✭ 104 (-23.53%)
Mutual labels:  homebrew, switch, nintendo-switch
Sysdvr
Stream switch games to your PC via USB or network
Stars: ✭ 523 (+284.56%)
Mutual labels:  switch, nintendo-switch, homebrew
NSW-Custom-Game-Icons
Nintendo Switch custom game icons, icon repo for NX-GiC
Stars: ✭ 33 (-75.74%)
Mutual labels:  homebrew, switch, nintendo-switch
switch-cmake
CMake toolchain for Nintendo Switch homebrew development
Stars: ✭ 38 (-72.06%)
Mutual labels:  homebrew, switch, nintendo-switch
nx
Userland library for Nintendo Switch homebrew (and other potential purposes), written in pure Rust and some assembly bits
Stars: ✭ 67 (-50.74%)
Mutual labels:  homebrew, switch, nintendo-switch
Switchthemeinjector
Create custom themes for the nintendo switch !
Stars: ✭ 436 (+220.59%)
Mutual labels:  switch, nintendo-switch, homebrew
Edizon
💡 A homebrew save management, editing tool and memory trainer for Horizon (Nintendo Switch)
Stars: ✭ 706 (+419.12%)
Mutual labels:  switch, homebrew
Splatoon 2 Meme Mod
Splatoon 2 mod about memes.
Stars: ✭ 11 (-91.91%)
Mutual labels:  switch, nintendo-switch
Twili
Homebrew debug monitor for the Nintendo Switch.
Stars: ✭ 131 (-3.68%)
Mutual labels:  nintendo-switch, homebrew
Hbupdater
A simple python app for keeping your switch apps up-to-date using the github api.
Stars: ✭ 37 (-72.79%)
Mutual labels:  nintendo-switch, homebrew
Tegrarcmgui
C++ GUI for TegraRcmSmash (Fusée Gelée exploit for Nintendo Switch)
Stars: ✭ 965 (+609.56%)
Mutual labels:  switch, nintendo-switch
Deepsea
The new All-in-One CFW package for the Nintendo Switch.
Stars: ✭ 488 (+258.82%)
Mutual labels:  switch, nintendo-switch
Libnx
Library for Switch Homebrew
Stars: ✭ 908 (+567.65%)
Mutual labels:  switch, homebrew
Switchpresence
A Nintendo Switch custom sysmodule for Discord Rich Presence.
Stars: ✭ 75 (-44.85%)
Mutual labels:  nintendo-switch, homebrew
Sys Clk Editor
Editor for your sys-clk configuration!
Stars: ✭ 89 (-34.56%)
Mutual labels:  nintendo-switch, homebrew

Brew.js - C++ high-level JavaScript API for Nintendo 3DS/Switch

  • Development version: 2.0 (only commits, still not released)

  • Latest released version: 1.0, very outdated, highly recommended to wait until 2.0 release

The engine: duktape

  • Duktape is an embeddable JavaScript engine, with a focus on portability and compact footprint, as it's described on its GitHub page.

  • It supports ES5 almost entirely, and a few elements of ES6. It has Node.js Buffer bindings and TypedArray from ES2015, plus a partial support of ECMAScript E6 and E7.

  • You can use duktape's functions from the code along with Brew.js API, but it's very unstable and it could fuck up the execution, so be sure to know what you're doing.

Platform support

  • Brew.js supports Nintendo 3DS (via libcrtu) and Nintendo Switch (libnx)

  • Originally, more platforms were going to be supported, but I've reached the conclusion that it's better yo focus and add more support on currently most important platforms.

  • That's why Nintendo DS support was deleted.

Basic examples of API usage

  • If you just want to evaluate JavaScript without messing up with the C++ API, that's easy to do:

  • First of all, include Brew.js's main header to use it. It may look like a JS file, but it is not:

#include <bjs/brew.js>
  • Then, create a environment and the native context to use within the environment:
bjs::js::NativeContext context = bjs::js::CreateContext();
bjs::Environment myenv(context);
  • There are 3 possibilities of evaluating JS source code:

    • From a std::string
    • From an external file
    • From a Node-like project (a folder with a package.json file)

    All of them return a execution result, which has information about the result of the execution (result string, original result type, whether it succeeded or failed...)

bjs::EvaluationResult res1 = myenv.EvaluateSourceCode("var num = 9;");
bjs::EvaluationResult res2 = myenv.EvaluateFile("sdmc:/test.js");
std::vector<bjs::Project> projects = myenv.GetProjectList("sdmc:/Projects");
bjs::EvaluationResult res3 = myenv.EvaluateProject(projects[0]);

Used extra libraries

  • duktape - lightweight C JavaScript engine, by svaarala
  • bitmap_image - C++ BMP image decoding and encoding, by ArashPartow
  • jsoncpp - modern JSON for C++, by nlohmann
  • nanojpeg - C JPEG image decoding and encoding, by Martin J. Fiedler
  • upng, C PNG image decoding and encoding, by elanthis
  • sf2dlib, C 3DS GPU rendering libraried (using citro3d), by xerpi
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].