Homebrew Misc BlocksDS with an IDE on Windows?

  • Thread starter Thread starter andreixl5
  • Start date Start date
  • Views Views 1,019
  • Replies Replies 1

andreixl5

Member
Newcomer
Joined
Aug 19, 2024
Messages
10
Reaction score
8
Trophies
0
Age
26
XP
75
Country
Romania
Hello, I am new on this site!

Recently I bought a DS Lite and after enjoying some games on it I decided to learn to make my own games for it because it is a really cool platform and I have some experience developing games for uni projects and my bachelor's degree. I found the DS Programming for Newbies tutorial here and I followed it, but unfortunately I haven't been able to compile anything that works because nflib and devkitPro seem to dislike each other on my machine. So, I installed BlocksDS instead.

The problem is that outside of setup there is no documentation/tutorial at all for integrating BlocksDS support into an IDE, whether it its VS Code, the full fat VS or any other C/C++ IDE available out there. Has anyone tried so far to include BlocksDS functions inside an IDE and compile a program with it in a terminal? I am sorry if this topic exists already.
 
Hey, I've been dealing with the same thing and managed to get a pretty good VSCode setup going. I'm by no means an expert in C or Linux, so there might be better ways to do what I've done, but this is what has worked for me.
I'm using Windows 11, no$gba as my emulator, and my physical console is a DSi.

Intellisense

1. Install the official C/C++ extension in VSCode.
2. Add this to your workspace or global VSCode settings.json (assuming the default msys2 installation location):
Code:
"C_Cpp.default.compilerPath": "c:\\msys64\\opt\\wonderful\\toolchain\\gcc-arm-none-eabi\\bin\\arm-none-eabi-gcc.exe",
"C_Cpp.default.includePath": [
    "C:\\msys64\\opt\\wonderful\\toolchain\\gcc-arm-none-eabi\\**",
    "C:\\msys64\\opt\\wonderful\\thirdparty\\blocksds\\core\\libs\\**",
    "C:\\msys64\\opt\\wonderful\\thirdparty\\blocksds\\external\\**"
]

You should now get autocomplete and even see documentation when hovering over sdk functions, if you include the necessary header files. If you #include <nds.h>, make sure to also write #define ARM9 somewhere above it, so that intellisense works for all the header files that are in nds.h.

Building and running the game

For quickly building the game and testing it in an emulator, or on the DS itself, you can use VSCode tasks.
I've personally created my project inside the folder "C:\msys64\home\janmi\dsi\" so that I can access it from the wonderful toolchain shell easily.

1. Create a folder called .vscode inside your project root, and inside it create a file called tasks.json
2. Paste the following code in, and make sure to change any absolute paths or the .nds file name (in my case template_arm9.nds) to match your actual project. You could also use environment variables, but I just used absolute paths.
Code:
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build with WFT",
            "type": "shell",
            "command": "C:/msys64/opt/wonderful/wonderful_shell.cmd -defterm -no-start -c \"cd dsi/tutorial && make\"",
            "presentation": {
                "reveal": "silent",
                "panel": "shared"
            },
            "problemMatcher": []
        },
        {
            "label": "Launch in no$gba",
            "type": "shell",
            "command": "taskkill /F /IM NO$GBA.EXE 2>nul & start /B C:/Users/janmi/Documents/no$gba-win/NO$GBA.EXE",
            "args": ["${workspaceFolder}/template_arm9.nds"],
            "presentation": {
                "reveal": "silent",
                "panel": "shared"
            },
            "problemMatcher": []
        },
        {
            "label": "Deploy via FTP",
            "type": "shell",
            "command": "curl -T ${workspaceFolder}/template_arm9.nds ftp://192.168.0.155:5000//roms/Software/",
            "presentation": {
                "reveal": "silent",
                "panel": "shared"
            },
            "problemMatcher": []
        },
        {
            "label": "Build and launch in no$gba",
            "dependsOn": ["Build with WFT", "Launch in no$gba"],
            "dependsOrder": "sequence",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": []
        },
        {
            "label": "Build and deploy via FTP",
            "dependsOn": ["Build with WFT", "Deploy via FTP"],
            "dependsOrder": "sequence",
            "group": {
                "kind": "test",
                "isDefault": true
            },
            "problemMatcher": []
        }
    ]
}
3. Setup a shortcut in VSCode for "Run build task" (build + launch in no$gba) and optionally also for "Run test task" (build + deploy over ftp). I've bound these to F5 and F6.

You should now be able to use the shortcuts and quickly test the game as you develop.

Deploying to the DS over FTP

You can manually copy the compiled game to your DS SD card each time you want to test it on your actual console, but it's possible to copy the game over FTP, which is in my opinion much faster to do if you want to rapidly test changes.

1. Setup a WiFi connection on your DS (needs a unpassworded or WEP protected access point - I wouldn't bother with WEP, just make an unpassworded guest network and hide the SSID to prevent casual freeloaders). You have to connect to the same network your computer is on.
2. Install ftpd on your DS. Go to GitHub and search for mtheall/ftpd. Go to the releases tab and copy the ftpd.nds file to your console like you would any other .nds game.
3. Open ftpd.nds on your DS: if you have a wifi connection setup correctly, it should print out "Started server at...". Make sure to use the IP and port it prints out inside your tasks.json "Deploy via FTP" task.
4. Optionally modify the task to choose which folder the game gets copied to. I like having it in a separate folder together with ftpd.nds so I can quickly switch between these two applications without having to search around.
5. Now you can call your default test task with a shortcut and the game should be built and copied over to the dsi pretty quickly.

On the DS, you will at this point have to restart and open the game manually. I'm using AKMenu-Next as my cfw of choice, as it starts / restarts in like 3 seconds, which is way faster than twilight menu from my experience. After you are done testing your game, restart again, open ftpd.dsi and repeat step 5 :)

Hope this is of some use to you or anyone looking for a basic DS homebrew setup.
 
Last edited by losi47,

Site & Scene News

Popular threads in this forum