GithubHelp home page GithubHelp logo

azo234 / libtransistor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reswitched/libtransistor

0.0 1.0 0.0 8.32 MB

Open source toolchain for Switch development

License: ISC License

Makefile 1.53% C 89.80% C++ 7.21% Assembly 0.87% Ruby 0.10% Objective-C 0.50%

libtransistor's Introduction

libtransistor

Build Status Chat on Discord

Libtransistor is a userland library for the Nintendo Switch. Binaries should run under Mephisto, Yuzu, Ryujinx, or on hardware with any firmware version via Atmosphère.

Documentation

The documentation is automatically built and can be found here: https://reswitched.github.io/libtransistor

Installation

For a more in-depth explanation, see The Guide.

Download our latest release. Choose either libtransistor_vX.X.X.tar.gz or libtransistor_vX.X.X.zip, and extract it. The recommended place to extract these archives is into /opt/libtransistor/. Next, set the LIBTRANSISTOR_HOME environment variable to wherever you extracted the archive.

The tests_{nro,nso}.{tar.gz,zip} archives contain builds of all of the tests included with libtransistor.

Usage

If you're using a Makefile-based build system, include $(LIBTRANSISTOR_HOME)/libtransistor.mk. You will also need to provide custom linking rules. See projects/example/ for an example of how to do this.

Otherwise, specify CC_FLAGS and LD_FLAGS and such based off of libtransistor.mk.

Building

For a more in-depth explanation, see The Guide.

First, clone the repo with

git clone --recursive https://github.com/reswitched/libtransistor

Next, get a copy of libtransistor-base. You can either build it yourself, or download a pre-built release. Pick a release with a version number equal to the version of libtransistor that you are building, or the next lowest if no such version exists. If you build it yourself, copy the dist/ folder from libtransistor-base to the root of this repository's contents, so it's in the same place as this README.md and lib and include. If you download a release, extract it into a new folder called dist.

You will need Python 3 and the python packages listed in dist/requirements.txt. You'll also need clang and lld >=5.0 (llvm linker).

You should just be able to run make. If that doesn't work, submit an issue (or pull request). This will produce a number of nro and nso files in build/test/. These are binaries for the Nintendo Switch. NRO files are relocatable shared objects suitable for use with ROhan, the Homebrew Launcher, or any other loader taking NROs. Both NRO and NSO binaries can be run under Mephisto.

Building on Fedora

Fedora does not ship recent enough clang and lld binaries. However, pre-built clang binaries from llvm.org can be used.

Example:

wget -c http://releases.llvm.org/5.0.1/clang+llvm-5.0.1-x86_64-linux-gnu-Fedora27.tar.xz
tar xpf clang+llvm-5.0.1-x86_64-linux-gnu-Fedora27.tar.xz
export PATH=`pwd`/clang+llvm-5.0.1-x86_64-linux-gnu-Fedora27/bin:$PATH
cd libtransistor
make

If some of the cmake CXX tests fail, you may need to install the necessary dependencies.

sudo dnf -y install libstdc++-devel gcc-c++.x86_64

Building on Arch Linux

You'll need to install some packages.

sudo pacman -S llvm clang lld python python-pip squashfs-tools base-devel git cmake

and you'll also need to install some python dependencies via pip.

pip install --user -r requirements.txt

Building on OSX

You will need to install squashfs:

brew install squashfs

Running

$ ./ctu --load-nro <path-to-libtransistor>/build/test/<binary>.nro

For running the bsd test, you may want to also pass --enable-sockets. Don't pass that for anything you don't want phoning home, though.

Debugging

Because Mephisto comes with a GDB stub and we produce standard ELF files before converting to NSO/NRO, we can debug libtransistor binaries very easily.

$ ./ctu --load-nro <path-to-libtransistor>/build/test/<binary>.nro --enable-gdb
[GdbStub] INFO: Starting GDB server on port 24689...
[GdbStub] INFO: Waiting for gdb to connect...
$ aarch64-none-elf-gdb 
(gdb) target remote localhost:24689
Remote debugging using localhost:24689
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x0000007100000080 in ?? ()
(gdb) add-symbol-file <path-to-libtransistor>/build/test/<binary>.nro.so 0x7100000000 -s .bss 0x7100000000
add symbol table from file "<path-to-libtransistor>/build/test/<binary>.nro.so" at
	.text_addr = 0x7100000000
	.bss_addr = 0x7100000000
(y or n) y
Reading symbols from <path-to-libtransistor>/build/test/<binary>.nro.so...done.
(gdb) 

libtransistor's People

Contributors

3daniel avatar awernick avatar balika011 avatar comex avatar corenting avatar d3m3vilurr avatar daeken avatar davidbuchanan314 avatar dvdfreitag avatar endrift avatar hcorion avatar hurbdurb avatar kbhomes avatar kentaromiura avatar kgsws avatar lubosz avatar maci0 avatar misson20000 avatar pathway27 avatar pokemod97 avatar roblabla avatar someoneweird avatar vgmoose avatar xyzz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.