Hacking Making Cheat Codes with C/C++

  • Thread starter Thread starter BullyWiiPlaza
  • Start date Start date
  • Views Views 4,531
  • Replies Replies 2
  • Likes Likes 5

BullyWiiPlaza

Nintendo Hacking <3
Member
Joined
Aug 2, 2014
Messages
1,932
Reaction score
1,584
Trophies
0
XP
2,522
Country
Germany
Motivation
You don't like to learn PowerPC assembly, you're too lazy to write it or you don't like the restrictiveness or tediousness of the code types? Try to write your cheat codes in C or C++ instead. This tutorial will show you how. Even with little to no programming knowledge you can follow this decently successfully. :D

Setup
  • You need to download and install devkitPro so you can compile the C/C++ code for PowerPC
  • You may start your own project or better, clone mine from here since it already contains templates you will most likely find useful/time-saving
  • As editor I recommend you to download CLion but you can use anything else you want
  • My recommended utility for copying machine code from ELF files can be downloaded here
  • Download JGecko U for generating execute assembly codes and sending them to the Wii U
Workflow
In your editor/IDE write the C/C++ functions you want to use as cheat codes. Take note that some templates exist already so you can edit their inputs to your liking. Quite a few restrictions apply for the functions you may write so make sure you respect them all:
  • Do not use any library functions (As a work-around, you can implement them yourself or find existing implementations online)
  • Mark as sub functions as static inline so that they are merged into the base function (it must be self-contained)
  • Mark the base function as __attribute__((noinline)) so that the compiler generates a single stand-alone function only. This is necessary for grabbing the machine code properly
  • All arrays (and structs?) must be declared as static const so that they are placed in the .text section instead of .rodata
  • At the end of a base function you need to call the address 0x010F6AE0 (because of how the C0 code type works). For more information, check the template project from above
  • ... more?
Once you're done, open up a Terminal and run make to compile as usual. Now you have a debug (and regular) ELF file. You may validate the results using a disassembler like IDA Pro by opening the debug ELF to see if everything looks good. Now start ELF Function Utility to select your function and copy the machine code to the system clipboard. If that succeeded, start JGecko U, go to the "Codes" tab -> "Add Code" -> "Code Wizard" -> "Execute Assembly". Paste the machine code and click on "Generate". Now the code is generated and you can paste it into the code field, add the code and send it to the Wii U to try it out.

Example(s)
Here is a post of correcting mistakes that have been made.

Video Tutorial
 
Last edited by BullyWiiPlaza,
I thought it replaced the "code type" and I was wondering how you generated them.
until I read "execute assembly" ;)
I didn't know it was an option of your program, that's a great tool.
 
  • Like
Reactions: BullyWiiPlaza
I thought it replaced the "code type" and I was wondering how you generated them.
until I read "execute assembly" ;)
I didn't know it was an option of your program, that's a great tool.
Yeah, you can generate a code to execute assembly repeatedly by CosmoCortney's code handler or execute assembly just once by the TCP Gecko Installer server. ;)
 

Site & Scene News

Popular threads in this forum