Homebrew Best guide to get into programming switch homebrew?

PixelatedIvan

Well-Known Member
OP
Newcomer
Joined
Sep 24, 2017
Messages
49
Trophies
0
Age
24
Location
Canada
XP
225
Country
Canada
Especially since Switch homebrew is in it's infancy stage, programming for it seems fun to do.

I already know a bit of JS and C#, is there any guide or documentation about developing Switch Homebrew apps?
 

Quantumcat

Dead and alive
Member
Joined
Nov 23, 2014
Messages
15,144
Trophies
0
Location
Canberra, Australia
Website
boot9strap.com
XP
11,094
Country
Australia
  • You'll need C/C++.
  • Look at open source apps that have already been written
  • Make sure you can compile and run it on your Switch
  • Make changes and see what happens
  • When you understand how it works and the structure of it
  • Create your own new app
 

Enovale

Hey. I exist. Woo
Member
Joined
Jul 12, 2016
Messages
833
Trophies
0
Location
Narnia
XP
946
Country
United States
I tried to find documentation too, but it's essentially non-existent. Just think of a feature that exists in an existing app that you want it your app, and find the source code and try to implement it into your app. For some basic things, check out the Switch Examples repo and you'll learn a lot there.

Also learn C :P C# Ain't gonna help ya, and unless you're willing to use the new Brew.js exclusively, JS won't either.
 
  • Like
Reactions: Quantumcat

rock88

Well-Known Member
Newcomer
Joined
May 19, 2018
Messages
81
Trophies
0
Age
35
XP
900
Country
Russia
Hi, I'm newbie in switch dev, and have few questions:
  • How connect to switch over ssh/telnet/ftp/etc (on 5.0.2)
  • How see switch debug log in my pc over usb
  • How connect to app over gdb (or some else, for debug purpose)
Currently I builded few examples, but I can't quick upload binary to switch (each time eject sd card/mount to pc/copy binary/insert sd card to switch/enter to rcm/enter to cfm it a very long time) and see log.
 

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
just look at already written apps. Like I did,I will never release any of it,but it was fun doing
 
  • Like
Reactions: -----a

rock88

Well-Known Member
Newcomer
Joined
May 19, 2018
Messages
81
Trophies
0
Age
35
XP
900
Country
Russia
How connect to switch over ssh/telnet/ftp/etc (on 5.0.2)
Ok, I found ftp server - ftpd (available in the appstore) and it's perfect work on 5.0.2.

What about log and debug? Anyway I can write log into a file and read it over ftp xD
 

delete12345

Well-Known Member
Member
Joined
Feb 27, 2010
Messages
695
Trophies
1
Age
32
Location
Taipei, Taiwan
XP
1,276
Country
United States
1. Install devkitPro's devkitARM from Github.
2. Upon finished installation, navigate to installation folder.
3. Run msys2.
4. Type "pacman -Sl" (That's an lowercase L, not uppercase I)
5. Install all the packages you need using "pacman -Syyu [package 1 name] [package 2 name] [package 3 name] ...", with whitespaces in between each package name. All names must be fully matching the one shown in the list above.
6. Navigate to the devkitARM installation root folder.
7. Open templates folder.
8. Copy the "switch/templates/application/Makefile". You need this.
9. Paste your copied Makefile to a destination folder, the folder that you'll be working Switch homebrew apps with. We'll call this folder, [DESTINATION] for now.
10. In that same destination folder, create a new folder called "source".
11. In your "source" folder, this is where you put your C++ and C codes in.
12. Open Makefile. Use whatever text editing software you want to use. I preferably use Visual Studio 2017, because it supports a lot of things, and Linux libraries now, but all other editors are fine. Stick with it.
13. Edit the Makefile contents by following the instructions.
14. Open up a terminal / console.
15. Navigate to your modified Makefile through the terminal / console.
16. Type "make".
17. If all is successful, you should see 5 types of generated files with your destination folder as the names. You need your [DESTINATION].nro.
18. Power on your Switch.
19. Do whatever you need to do to get into Homebrew Launcher.
20. In the Homebrew Launcher, execute NXLink. It should now freeze, and is attempting to wait on you to send your NRO files over to the Switch.
21. Back to the terminal / console, run/launch "nxlink -ip [YOUR SWITCH'S IP ADDRESS, WITHOUT PORT NUMBER] [DESTINATION].nro".
22. See your NRO file booting and running.
23. Rinse and repeat. Total setup should take about 30 minutes to 1 hour, depending on how fast you access your Homebrew Launcher.
 
Last edited by delete12345,

YugamiSekai

Mr. Picross
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
22
XP
2,286
Country
United States
1. Install devkitPro's devkitARM from Github.
2. Upon finished installation, navigate to installation folder.
3. Run msys2.
4. Type "pacman -Sl" (That's an lowercase L, not uppercase I)
5. Install all the packages you need using "pacman -Syyu [package 1 name] [package 2 name] [package 3 name] ...", with whitespaces in between each package name. All names must be fully matching the one shown in the list above.
6. Navigate to the devkitARM installation root folder.
7. Open templates folder.
8. Copy the "switch/templates/application/Makefile". You need this.
9. Paste your copied Makefile to a destination folder, the folder that you'll be working Switch homebrew apps with. We'll call this folder, [DESTINATION] for now.
10. In that same destination folder, create a new folder called "source".
11. In your "source" folder, this is where you put your C++ and C codes in.
12. Open Makefile. Use whatever text editing software you want to use. I preferably use Visual Studio 2017, because it supports a lot of things, and Linux libraries now, but all other editors are fine. Stick with it.
13. Edit the Makefile contents by following the instructions.
14. Open up a terminal / console.
15. Navigate to your modified Makefile through the terminal / console.
16. Type "make".
17. If all is successful, you should see 5 types of generated files with your destination folder as the names. You need your [DESTINATION].nro.
18. Power on your Switch.
19. Do whatever you need to do to get into Homebrew Launcher.
20. In the Homebrew Launcher, execute NXLink. It should now freeze, and is attempting to wait on you to send your NRO files over to the Switch.
21. Back to the terminal / console, run/launch "nxlink -ip [YOUR SWITCH'S IP ADDRESS, WITHOUT PORT NUMBER] [DESTINATION].nro".
22. See your NRO file booting and running.
23. Rinse and repeat. Total setup should take about 30 minutes to 1 hour, depending on how fast you access your Homebrew Launcher.
Where do I find the nxlink nro for Switch?
 

rock88

Well-Known Member
Newcomer
Joined
May 19, 2018
Messages
81
Trophies
0
Age
35
XP
900
Country
Russia
Use "nxlink" to send your nro with "-s" flag, then use "nxlinkStdio" to redirect stdout/stderr (printf, ...)
Thanks, also I found a new example in switchbrew/switch-examples - nxlink_stdio, in the app needs use
Code:
socketInitializeDefault();
nxlinkStdio();
after this "printf" appear in terminal.
 
  • Like
Reactions: hippy dave

2Siralv

Well-Known Member
Member
Joined
May 12, 2018
Messages
103
Trophies
0
Age
28
XP
531
Country
Canada
Ive installed devkitpro on win10 and where is the output folder or folder to add source code and then run the make file and for the makefile do i nees to make my own or can i usw the makefile.switch and makefile.libnx
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/watch?v=izAMt9iehrE