Tutorial  Updated

How to make your first Homebrew App!

I've learned the basics of making Homebrew so i wanna help some people out and make a tutorial on making Homebrew, so here it is!
BTW this tutorial is for Windows only'
If anything is incorrect, please correct me in the comments.
Although you could get the switch examples on their own, I would reccomend DevKitPro as it has msys2 built in and lets you run make from Command Prompt which is neccessary. You will also want Notepad++.
Step 1: Go to github.com/devkitPro/installer/releases/ and download the latest release as an *.exe file. On the installer, click Next then select "Remove Downloaded Files" as it saves space on storage. Click next and you should get to a screen where you can choose what to install. If your only going to be making Switch Homebrew (and want to save the most amount of storage) untick everything except "Switch Development" click Next and wait for it to install. When it's done click Next and Click Finish, although you could donate to them for their hard work.

Step 2: Unless you already have it installed, we are gonna want to install Notepad++. Go to notepad-plus-plus.org/download/v7.5.7.html. Get either "Notepad++ Installer 32-bit x86" or "Notepad++ Installer 64-bit x64" depending on what Bit you have. If you dont know what Bit you have, I would recommend getting the 32-Bit one. After downloading and running the Notepad++ installer. You'll wanna select your language and click Ok, then click Next and I Agree. Select an install location. I would recommend leaving it as default, then click Next. On choose components, I would recommend you keep "Auto-completion files", "Plugins", "Auto Updater", and "Context menu entry" although if your saving storage space, untick them all except "Context Menu Entry". On the next screen dont tick anything except "Create Desktop Shortcut" if you would like. Click Next and wait for it to install. When done, untick "Run Notepad++"and click Finish.
Now we can get onto making Homebrew!
Step 3: Go to where DevKitPro installed, most likely "C:\devkitPro" then go to "examples\switch\graphics\printing\hello-world". There should be a file named "Makefile" and another folder called "source". On Windows 7, hold Shift in the folder that has "Makefile" in it and right click, then select "Open Command Window Here". On Windows 10, click on this
upload_2018-7-7_9-12-45.png
then copy the link and open up CMD in start menu. You'll then want to type "CD " then right click and paste the link in. You should get something like this.
upload_2018-7-7_9-13-42.png
Now type the word "make" into cmd and it should create some files in the same place as "Makefile". Delet all the files it makes except for "source", "Makefile" and "hello-world.nro" copy "hello-world.nro" to your "switch" folder on your SD Card and run it using the Homebrew Launcher on your switch, or through an emulator. If it says "Hello world!" then CONGRATULATIONS! YOU JUST MADE (really you compiled) YOUR FIRST HOMEBREW!
Now you can add extra features and make it more in-depth.
Go into \source and right click on main.c and Open it Using Notepad++. Don't be scared of all the code, just find " printf("\x1b[16;20HHello world!");". the \x1b[16;20H is just telling the system where to place the text on the screen. You can delete that bit if you want to it will say printf("Hello world!"); if it makes you less confused. Change the words "Hello world!" to anything you want (but don't try emojis). If you go to the GitHub of my first app (github.com/lolicop123/fuck-u/releases/) and find the oldest version, you'll see that all I did was change the word "Hello World!" to "Fuck you". After changing the words "Hello World"to whatever you want, hit the save button ( The blue floppy disk (Not the one of 3 Floppy Disks)) and close Notepad++. Delete hello-world.nro and re-run "make", deleting all the files I said to delete before. and copy hello-world.nro to "\switch" on your SD Card and running it, or running it through an emulator. If everything went well it should display the text you wrote on the screen. CONGRATULATIONS! YOU MADE YOUR SECOND EVER HOMEBREW!
Open up main.c again. Scroll down until you find "u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);" and press enter underneath it for a new line. TYPE (dont copy+paste unless you HAVE to) this code out on the new line:
Code:
if(kDown & KEY_A)
        {
            printf(" INSERT TEXT HERE");
        }
Take a look at this code. KEY_A corresponds to the A button. You could change this to B, X, Y or whatever other button, heres a button list: witchbrew.github.io/libnx/hid_8h.html#ae829d22473d2e99ee1157f6e2d526b95 printf obviously corresponds to printing on the screen, you should know that already though. Obviously, change INSERT TEXT HERE to whatever text you want, although i will need to show you a cheat. Always put a space after the printf(" so it looks likle this printf"( <-- theres a space there") otherwise your words wont be separated if you press A twice once you've got the code and changed the INSERT TEXT HERE thing, save, run "make", delete the stuff and run hello-world.nro on your switch/emulator. Now try pressing A and if it says what you want it to CONGRATULATIONS!
If you want to add more button prompts, take a look at my latest release of "Fuck you".
(GBATemp wont let me insert pics anymore so https://ibb.co/h5jtwo )
I'll add more stuff as time goes by, but for now this is just the bare bones of making Homebrew for the Switch, for any new Homebrew creators that need help!

If you want to make some C++ apps wich use console, make sure to check this out: https://gist.github.com/XorTroll/94b542e3d5a8164a10742df0ca4f052b (Thanks @XorTroll )
 
Last edited by xXxSwagnemitexXx,

jimmyj

Official founder of altariaism. Copyright jimmyj
Member
Joined
May 26, 2017
Messages
1,485
Trophies
1
Location
Hyrule
XP
1,632
Country
United Kingdom
Okay, here is my review. 2/10, no joke though.

* Doesn't explain anything about C programming at all, doesn't even tell me that the program starts at the "main" function.
* Doesn't explain the printf position markup at all, or even how to do format strings.
* Tells you to manually delete files instead of doing "make clean"
* Doesn't explain how the makefile works at all, or even that "make" executes the makefile.
* Doesn't explain how the & operator works.
* Most of the links can't be clicked because they don't start with "http(s)://".
* Tells me to install Notepad++ so I can write Hello World.

Things it does well:
* How to type "make"
* How to use the DevkitPro installer
* Links to the list of button constants.

Anybody following this guide will be very, very confused when they try to do anything but make Hello World. At least give a link where people can learn more.
10/10 was sarcasm. the parts after the no joke is what people usally do when they get their hands on compiling and stuffs.
 

xXxSwagnemitexXx

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
OP
Member
Joined
Dec 7, 2016
Messages
674
Trophies
0
Age
27
Location
New Donk City
XP
1,003
Country
United Kingdom
10/10. No joke though. I have a basic knowledge of programming and this is basically all you do when you're learing stuff
thanks
okay I made a thing that just says hello world, now how do I do an image
i might add a bit for images later

--------------------- MERGED ---------------------------

and i know this guide is not good its only very small and minimal, if people want to learn more they can go find out themselves
 
  • Like
Reactions: jimmyj

xXxSwagnemitexXx

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
OP
Member
Joined
Dec 7, 2016
Messages
674
Trophies
0
Age
27
Location
New Donk City
XP
1,003
Country
United Kingdom
I doubt the guy meant to do anything but show how to get your code working on the Switch. This isn't supposed to be a guide that learns you C, you should probably have a basic knowledge of that before doing anything on Switch.
YES, finally someone who understands, thanks!
 

RHOPKINS13

Geek
Member
Joined
Jan 31, 2009
Messages
1,353
Trophies
2
XP
2,614
Country
United States
Definitely a good start. Obviously to do anything useful you're going to have to learn or have some previous experience coding with C. I'd love to see some more links added where noobs can learn more about the SDK and it's functions.

Even better, a multi-page tutorial with examples that progress in difficulty, you already have "Hello World" and basic button input. Add examples that respond to the touchscreen, display an image, or play a sound.
 

xXxSwagnemitexXx

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
OP
Member
Joined
Dec 7, 2016
Messages
674
Trophies
0
Age
27
Location
New Donk City
XP
1,003
Country
United Kingdom
Definitely a good start. Obviously to do anything useful you're going to have to learn or have some previous experience coding with C. I'd love to see some more links added where noobs can learn more about the SDK and it's functions.

Even better, a multi-page tutorial with examples that progress in difficulty, you already have "Hello World" and basic button input. Add examples that respond to the touchscreen, display an image, or play a sound.
thanks, i will definitely be adding links soon and i will be considering adding more things to do that get more difficult
 

gnilwob

Well-Known Member
Member
Joined
Mar 16, 2008
Messages
204
Trophies
1
XP
644
Country
Hong Kong
It is good to be able to compile and have an executable file to test on the switch.
Thanks for your guide, I will try it :)
 

Garou

Well-Known Member
Member
Joined
Jan 13, 2015
Messages
1,213
Trophies
0
XP
1,667
Country
now how to build your app, sideload the nro to the switch and run it in 1 command? better yet, with the ability to debug as well
haven't got into developing any homebrew apps for any console simply because I couldn't find how to do this easily

good read though, making me interested to start developing app for switch
 

xXxSwagnemitexXx

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
OP
Member
Joined
Dec 7, 2016
Messages
674
Trophies
0
Age
27
Location
New Donk City
XP
1,003
Country
United Kingdom
now how to build your app, sideload the nro to the switch and run it in 1 command? better yet, with the ability to debug as well
haven't got into developing any homebrew apps for any console simply because I couldn't find how to do this easily

good read though, making me interested to start developing app for switch
to sideload you just run it through cfw, its not to hard to find that out so i wont add it.
 

Garou

Well-Known Member
Member
Joined
Jan 13, 2015
Messages
1,213
Trophies
0
XP
1,667
Country
to sideload you just run it through cfw, its not to hard to find that out so i wont add it.
care to elaborate?
if you mean to copy the .nro manually to the sdcard or using ftp, then that's not what I meant
I was thinking something like when you do android dev, just plug the phone using usb cable and run it directly from the ide
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • AncientBoi @ AncientBoi:
    LEOtck? Who's he? Never 'erd of the las. :)
  • LeoTCK @ LeoTCK:
    I only show the mirror to people and you all can't stand what you're seeing
  • LeoTCK @ LeoTCK:
    bunch of bullies
  • RedColoredStars @ RedColoredStars:
    Narcissistic Personality Disorder 101
  • LeoTCK @ LeoTCK:
    I think that's what you have
  • RedColoredStars @ RedColoredStars:
    Thanks for providing further evidence of my claim in a single comment. lol.
  • LeoTCK @ LeoTCK:
    pff\
  • RedColoredStars @ RedColoredStars:
    You're a gaslighting narcissist. Everyone out to get you. You wont get professional help because you'll just chalk up their diagnosis as another conspiracy out to get you.
  • LeoTCK @ LeoTCK:
    leave me alone, I'm not going to engage with you anymore, bye
  • LeoTCK @ LeoTCK:
    Motherfucker I was checked by a psychiatrist and there's nothing wrong with me
  • RedColoredStars @ RedColoredStars:
    okay. Bye. Thought you were leaving anyway. Why are you still around? You already said goodbye to everyone here.
  • LeoTCK @ LeoTCK:
    so stop spurting your nonsense
  • RedColoredStars @ RedColoredStars:
    lol. liar.
  • DinohScene @ DinohScene:
    knock it off now, both of you
  • LeoTCK @ LeoTCK:
    yea you're just a mean bully
  • LeoTCK @ LeoTCK:
    he SHOULD
  • LeoTCK @ LeoTCK:
    and NOW
  • RedColoredStars @ RedColoredStars:
    liar, loudmouth, cussing and swearing, all angry
  • RedColoredStars @ RedColoredStars:
    ok. sorry. ill stop now. promise
  • RedColoredStars @ RedColoredStars:
    Sooo. How about Dune part 1 & 2? The cinematography is fantastic, but thats some of the most boring ass sci-fi Ive seen in my life.
  • DinohScene @ DinohScene:
    haven't seen both
  • RedColoredStars @ RedColoredStars:
    Im going to see the new Godzilla next week. Sure they aren't some cinematic masterpieces but the last few were all really great and fun popcorn flicks to see on the big screen.
  • DinohScene @ DinohScene:
    can't remember the last time I went to the cinemas
  • RedColoredStars @ RedColoredStars:
    Me neither, not precisely. I think the last one I went to was Top Gun Maverick
  • RedColoredStars @ RedColoredStars:
    Oh. Wait. I took my mom to see Elvis. I think that was the last time I went. I'll most likely see the new Planet of the Apes in a theater too.
    RedColoredStars @ RedColoredStars: Oh. Wait. I took my mom to see Elvis. I think that was the last time I went. I'll most likely...