Quantcast
Channel: Homebrew Archives - Wololo.net
Viewing all articles
Browse latest Browse all 1424

The Case of the 3DS Part 3: Weekend Warrior Workshop

$
0
0

It’s the moment we’ve been waiting for. It’s time to install some software and break some stuff!
This is where the fun happens. Now would be the time to go make yourself a coffee and shuffle into your chair.

Please note, this is not a “how to program” guide – this is a guide for setting up your development environment so that you can either start from scratch with the knowledge you already have – or start with someone elses code and learn by tinkering with it and applying your own knowledge.
For learning to code, you are going to want to start with a book like this one.

 

List of Ingredients [May contain trace amounts of nuts]

Let’s do a double check. You should now have the below prepared and ready to go, or easily at hand:

  • 3DS unit (or 3DS XL).
  • Gateway Red (Optional if you want to focus on ARM9 dev).
  • Gateway Blue or DS Mode Flash Cart of your choice.
  • Your computer.
  • A internet connection.
  • Patience.
  • Cappucino/Frappe/Mocha/Machiato/<coffee> (or juice for our caffeine independent friends)

Now you’ve checked your list (twice), let’s get up to some trouble.

to-do-list

 

Push Button; Receive Toolchain

I will try to keep this as streamlined as possible for the article, so I recommend you check out our forums at /talk and bookmark this post: [Guide] 3DS Homebrew Development Guide Index

Besides the threads (hopefully), your other ‘bookmarked’ sources of information should be your favourite book(s) on C++, the ARM website for links to the corresponding reference manuals, and 3DBrew wiki.

You may not see the immediate benefit behind the above, but you will once you decide to move beyond this tutorial type of learning.

This guide is geared around both Windows and Linux users, but kept vague enough to apply to both (and specific where necessary).

 

So without further ado, let’s begin:

ARM9 Development Setup (Step 1)

Download and install the following software:

  1. GCC ARM Embedded
  2. Python
  3. 3DS Python Tools by naehwert (extract this somewhere handy, like “C:\P3DS”)
  4. For Linux users, you will want to download this modified build.py as well:  (by Kane)
  5. Modified ROP Loader by Drenn

 

Optionally you can install devkitARM in place of GCC ARM Embedded. (We will be using devkitARM as the go to toolchain later for ARM11 coding)
Windows users should use the devkitPro updater to download along with all optional libraries (using this link).
For devkitARM, Linux users are best to refer to the guide put together by the devkitPro team if they have not installed it before: Here

Now, install away as preferred. Advanced users should feel free to install wherever they want. New users should install to the default path to make any troubleshooting they may need, easier.

Once you have done this, we need to add Python to our $PATH for Linux users, and our environment variables for Windows users.
Linux users are going to know how to do this easily (I hope!), Windows users you will need to do below:

Computer>Right Click>Properties>Advanced>Environment variables. (Several ways to get here)

You will be presented with a list. Look for and select “Path”. Click Edit/Modify.

Add:

;<python>;<ggcarmbin>

to the end of the entry, where <python> is your Python install path (e.g. C:\Python) and <gccarmbin> is your arm toolchain bin folder (e.g. C:\Program Files\GNU Tools ARM Embedded\4.9-2014-q4-major\bin)
So that it becomes something like this:

;C:\Python;C:\Program Files\GNU Tools ARM Embedded\4.9-2014-q4-major\bin

 

Now make a batch file in the build.py folder that you extracted with the below entry (open notepad, enter data, save as “pythonbuild.bat” for example):

python build.py
pause>nul

(the >nul discards the “Press key to continue” outputs from pause)

That’s pretty much it – you are ready to start bashing out some bits or grab some source and have a poke around.
This method gives you the tools required for preparing ARM9 compatable homebrew (i.e. no Gateway card required).

Check out these sources for a good head start to how to “make words do things”:

Mandlebrot by Aliakr18: https://github.com/Aliakr18/mandelbrot
Libraries and sample by nop90:https://github.com/nop90/3DS_Homebrew
Yeti3DS by smealum: https://github.com/smealum/yeti3DS

When you are ready to compile, execute your batch file (or ‘directly’ run the python script, depending on OS) and it will compile and spit out a “Launcher.dat”.
Then, take Launcher.dat on your 3DS SD Card.

Now, unzip the modified ROP loader and place it on your DS Mode Flash Cart microSD card.

To run your code, turn on your 3DS, launch your DS Mode card, and select the ROP Loader from it’s menu.
It will do it’s thing, and then prompt you to press “A” to exit. I have better stability using the Home button and closing the game, personally. I would recommend you do that instead.

Once you have done this, go into your system settings, select “Other Settings”, select “Profile”, select “Nintendo DS Profile”. This should now launch the homebrew (Launcher.dat).
It may also crash. This is a good sign still. It means that the ROP loader did work.

Congratulations, you’ve got the concept of ARM9 development for the 3DS (I hope!).

I recommend that you search github for other bits and bobs to look at as well. Most importantly, keep bashing away until you get something simple to run!

smash on

 

 

ARM11 Development Setup (Step 2)

So, if you setup devkitARM as your toolchain of choice, you are good to go.
If you didn’t (and my guide caters for those that have), you will want to install it now.(You will want to re-edit your $PATH/env variables to point to the new toolchain when it is installed)
Please note: this guide is geared around compiling homebrew with CTRULIB for Gateway hardware as the launch target and will be depreciated once we have easily accessible ways to launch ARM11 code without it.

Additional Tools Required:

  1. Makerom: Here
  2. ctr_homebrew (ccd00.ld): Here (by 3DSGuy)
  3. Gateway homebrew files: Here
  4. Last but not least, grab ctrulib: Here (by Smealum)

Download these and unpack them. Store makerom and the gateway card work around files in a dev directory of your choice for later use. Rename ctr_homebrew.ld to ccd00.ld and place it in the arm11u folder in the root directory of ctrulib.
It should be self explanatory, but ctrulib will require you to leave the directory structure as is. Elsewise, you will have a hard time when you go to use makefile etc.

Now we are going to compile ctrulib.

Open your command line tool (cmd, terminal, whatever) and navigate in to the ctrulib root directory then, use the make command.
If this fails, check your makefile has the correct directories etc. for your compilers/toolchain.

Now you should have have ctrulib compiled ready to go.

 

Now Let’s Compile Samples (Yum, free samples!)

This will compile the arm11u example within ctrulib, to kick you off on your way exploring ARM11 homebrew coding.
Open your command line tool again (or use your same session preferably) and navigate in to the arm11u directory within ctrulib directory. Now run make again (Windows users will not need to do this).
Your make output will produce an ELF file, which is the compiled example executable.

We will then have to convert the ELF file to a 3DS file. To do this, navigate to the dev directory you placed makerom and the work around files in.
Copy your ELF file into this folder so that you can make your 3DS file.

Linux users should open the build.bat file with your text editor of choice (Windows users should not edit build.bat). Change target 1 (“%1″) to “arm11u.elf” and target 2 (“%2″) to “arm11u.3ds” in the build line, then copy it to your clipboard.
Open your command line tool again (or use your same session preferably) and navigate in to your dev directory above that has the ELF and makerom etc. within it, now paste the command you copied above and run it.

Windows users need only type the command “build.bat arm11u.elf arm11u.3ds” and run that command.
You now have a piece of 3DS ARM11 compiled code in a 3DS format. Load this on to your microSD card and test it out.

As before, I recommend you check out github and around the web for some projects and code snippets to digest. This will help to get you on track and fiddling nice and quick.

 

Now pat yourself on the back! You have done well!

 

 

Extra Credits: NAND Dumping/Backup

For another weekend project, or for a project for the hardware inclined, check out this nicely done video stepping you through the process:

Part 1 & 2:

 

 

I was way too lazy to open my 3DS XL up and take pictures myself (yup). But if you let me know in the comments whether you would like me to write a detailed article (like this one) with all of the required parts, links to purchase them, and detailed pictures (+ schematics) please sound off below and I will put some time aside!

 

Extra Credits: DIY Streetpass Relay

And out final extra credits project for today is creating a StreetPass Relay.
A StreetPass Relay is an original (major?) feature of the Nintendo 3DS. It allows your Mii to be transferred from your system, to someone else and, obviously from theirs to yours so that they can be used in the Streetpass Plaza Games. Not only that, but it also has in game benefits with certain titles, such as Bravely Default, Fire Emblem, Pokemon, etc.

It’s a pretty cool concept, but unless you live in a densely populated area (I do, and still get minimal hits), or you don’t take your console out wandering in the city – then you can’t enjoy the benefits (especially in games) which is a bit of a bummer.

So, there have been several version and iterations of hardware/software projects that are designed to ‘emulate’ official Streetpass relays. One of our forum members, TheSpillmonkey has his own elegant take on the Raspberry Pi based relay solution. You should check out his post here: SpillPass Pi – Unlimited 3DS Streetpassing in your own home!

It is a very elegant solution to the problem, and a fun project for the weekend.

Do you have a neat method or tip? Sound off in the comments below and let us know!

 

That’s Cool. What About This?

Do you have a specific query or questions, topic or project that you would like covered in 3DS land? I’d love for you to let me know by leaving a comment or sending me a tweet.

 

TWITTER_ICON_SMALL

TWITTER_ICON_SMALL

 


Viewing all articles
Browse latest Browse all 1424

Trending Articles