From WikiTemp, the GBAtemp wiki
Revision as of 14:43, 23 August 2015 by tj_cool (talk | contribs) (Split off from the main page)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

3dsx homebrew

Development environment

If you want to created homebrew in 3dsx format to be launched from Ninjhax exploit you will need to install DevkitPro with the 3DS User Library (CTRULib).

  • Install DevkitPro + DevkitARM + CTRULib by following this guide if you are using Linux or Mac.
  • If you are using Windows, use the automated-installer. Install in C:\devkitPro\ and it will install all the latest versions of the required programs (you can disable DevKit PSP, but be sure to enable CTRULib in DevkitARM menu). It will create the environment variables automatically.

Examples

You can find ctruLib homebrew examples here: https://github.com/smealum/ctrulib/tree/master/examples

To compile, open a command line window and browse to the homebrew folder and type make, or create a batch file in the same folder with the "make" command in it.

Launcher.dat and .3ds homebrew

If you don't need Kernel access, prefer developing homebrew in 3dsx format. Remember that the .dat format works only on 4.1.x-4.5.x consoles.

The guide to setup a 3ds homebrew environment is old and need to be rewritten.

Please rewrite a guide here.

Development environment

If you already installed Devkit ARM with CTRuLib, you don't need to follow the installations steps, unless you want to compile using Python instead of Makefile.

Install Python 2.7.x

Note: You can skip this step if you want. Go to step 2. directly if you don't want to use Python to compile your homebrew.

  • Download the latest version of Python 2.7.x
  • Install Python on your computer.
  • If you are on Linux, add Python to your environment variable $PATH
  • If you are on Windows, install it in C:\Python27\, and it should edit the environment variable "Path" automatically.

If you need to do it manually, follow these steps:

  • Go to My Computer > Right-click > Properties > Advanced tab > Environment variables > System variables
  • In the list search for "Path", select it and press Edit/Modify
  • At the end of the line, add this:
;C:\Python27

It will allow you to call the Python program from any place by typing "Python" in a command line window.

Install a compiler

  • Install DevkitPro + DevkitARM + CTRULib by following this guide if you are using Linux or Mac.
  • If you are using Windows, use the automated-installer. Install in C:\devkitPro\ and it will install all the latest versions of the required programs (you can disable DevKit PSP, but be sure to enable CTRULib in DevkitARM menu). It will create the environment variables automatically.

You can install and use GNU Tools for ARM Embedded Processors as alternate compiler, but it will not be enough to develop ARM11 homebrew as you will need additional libraries provided by DevkitPro. If you use this compiler for ARM9 homebrew, you will also need to add the ARM binaries path to your environment variables. Follow the previous Python steps to add this path:

;C:\Program Files\GNU Tools ARM Embedded\4.8 2013q4\bin

Attention, change the version in the path, do not keep 4.8 2013q but use the one you installed instead.

Build script

To compile your homebrew sources to an executable binary file you can use either a Python script or a Makefile script. Makefile is easier, but this guide will also detail how the Python package is created to cover and understand all installation steps.

There are two packages ready to download: One for Python and one for Makefile, both made by Snailface. Just download the one you want and extract it in any folder. This will become your homebrew working folder. Create one copy per homebrew you are developing.

This is how the Python package has been created:

  • Download the files from Kane49's github, and extract to a folder of your choice.
  • Download the files from Naehrwert's gitHub, and extract the files and the folder into the p3ds folder from the previous download.
  • For Linux users, download the modified build.py file from Tomiga to replace the one you downloaded from Kane49's repository.
  • Open build.by and replace both instances of:
"-mcpu=mpcore -march=armv6k"

to

"-mcpu=arm946e-s -march=armv5te". 
  • Comment the lines:
#run("copy Launcher.dat E:\\Launcher.dat > NUL")
#upload("Launcher.dat")
#run("del payload.bin")

Compiling .dat format

ARM9

If you are using Python to compile your homebrew:

  • In your development folder, open a command line and type "Python build.py"
  • You can also run Build.bat

If you are using makefile:

  • In your development folder, open a command line and type "make"
  • You can also run Build.bat

Your homebrew will be compiled as a Payload.bin and will be encapsulated into a Launcher.dat file ready to launch using a ROP exploit. You can provide both the .bin and .dat file when you share your homebrew.

ARM11

  • Open a command line window and navigate to your homebrew folder and type "make".

It will create a <folder name of your project>.elf file.

To convert the elf file to .3ds format:

converting .elf to .3ds format

  • If you want to make the .3ds file working on Gateway 3DS flashcart homebrew menu, download the Gateway Card Homebrew Files, by 3DSGuy, and extract its content into the Makerom folder.
  • Open a command line window and navigate to the MakeROM folder.
  • type
build <elf file> <output 3ds file>

where <elf.file> is the name of your homebrew.elf, and <output 3ds file> is the name of the .3ds file

example

build myproject.elf AwesomeGame.3ds

Making your own Homebrew Icon and Banner

If you want to create your own banner and icon for ARM11 homebrew, you can use 3DS Banner Maker, by Snailface, to convert png pictures to the correct format used by MakeROM. It requires Python 2 and PIL (Python Image Library).