Pages: 1
Posted on 08-31-18, 11:48 am (rev. 2 by RicBent on 03-09-19, 01:19 pm)
Administrator

Karma: 7479
Posts: 1341/1527
Since: 06-09-12
Magikoopa is a tool that allows compiling custom code and inserting it into NSMB2 and all other 3ds applications.


#1 Installing devkitPro and devkitARM:

Follow https://devkitpro.org/wiki/Getting_Started this tutorial.
You may disable devkitPPC, devkitPSP and Programmer's Notepad in the Windows Installer.

Test the installation by running this command in a console:
  • Linux: echo $DEVKITARM
  • Windows: SET DEVKITARM

If it prints the path to the devkitARM install directory you probably have a successful install.


#2 Aquire neccessary game files

You will need a code.bin and an exheader.bin file. Follow this to get them.


#3 Setting up the Patch Environment:

Download the Patch template from here and extract it.

Important: The path to the template folder may not include any special chars or spaces!
  • Wrong: C:\Users\ricbent\3ds Projects\fancyH@ck\
  • Correct: C:\Users\ricbent\Projects\testHacks\

From the generated files from step 2 copy "exheader.bin" and "exefs/code.bin" into the template folder.

The folder structure should look like this:
PatchTemplate ├ loader │ ├ source │ │ ├ hooks.hks │ │ ├ loader.c │ │ └ svc.s │ └ Makefile ├ source ├ code.bin ├ exheader.bin └ Makefile



#4 Inserting custom code

All custom code goes into the source folder.
  • C source files have the .c extension
  • C++ source files have the .cpp extension
  • ARM assembly source files have the .s extension
  • Hook files have the .hks extension and can also be placed in a folder called "hooks"

A tutorial on how to write your own hacks might be added in the future. For now stick with existing hacks.


#5 Compile

Download or build Magikoopa.
Open your set up template folder in Magikoopa (File -> Set working directory). If you have made mistakes setting up the template folder Magikoopa will give a error message on what files are missing.
Press "Make and Insert". That will first compile and link the code, compile and link the loader, insert the new code into the existing code and finally create hooks from the existing code into the new code.

If the compilation and linking was successful Magikoopa will report "All done" in the bottom right corner.
Otherwise it will show an appropriate status and you can get info about what went wrong in the output window. Obvious issues will be displayed nicely on the "Issues" tab. If you have setup an text editor in Magikoopa (Settings -> Set text editor...) you can double click on the issues to directly jump to the source of the issue.


#6 There you go!

The code.bin and exheader.bin files should now be fully patched.
If you have Luma3ds you can directly copy the two files onto your SD card to the correct location to test the hacks.
Alternatively you can rebuild a cxi file to test the hacks in Citra.
_________________________
GitHub - Kuribo64 - YouTube
Posted on 12-22-19, 04:02 pm
Administrator

Karma: 7479
Posts: 1514/1527
Since: 06-09-12
#6.2 Testing on Citra

Citra now supports loading external exefs files and exheader files.

Place your files like this. Of course replace "smbnext.cxi" with the name of your cxi file.

├── smbnext.cxi ├── smbnext.cxi.exefsdir │   └── code.bin └── smbnext.cxi.exheader

_________________________
GitHub - Kuribo64 - YouTube
Pages: 1