Homebrew Handy VS2019 build batch file I made that I've decided to spread here.

EtiTheSpirit

Member
OP
Newcomer
Joined
Dec 4, 2019
Messages
8
Trophies
0
Age
23
XP
78
Country
United States
Hey folks!

I'm fairly new to the homebrew community and I was looking at all of the various tools that are necessary for making various homebrew apps. I have the template provided by devkitPro, but after some messing with it in Visual Studio 2019 (which, I may add, the ability to build from studio is quite nice), I thought to myself, "This isn't enough." Now I don't know if anything I'm doing here is extra or "useless" (chances are, it is. That's one of the caveats of being new after all). It's certainly helped me personally and I suppose that's what matters the most.

Naturally, after not really liking having to enter 3 different commands to first build my 3DSX/ELF/SMDH, then strip the ELF file, and then make a CIA (horrible, right?) I got cracking away at something new. What I've just designed has definitely streamlined the process of building all necessary files (3DSX, SMDH, ELF, and CIA) given that it mashes it down into one batch file that is modular in nature. I love it a lot!

Here's the setup:
1: Start off by placing the meta folder inside of your project directory as you might when making a banner or whatever (if you haven't already), and make it contain the following files:
EXAMPLE_META.PNG


author.txt, description.txt, and title.txt all pertain to the APP_AUTHOR, APP_DESCRIPTION, and APP_TITLE fields in the makefile respectively. They are single-line TXT files containing the entries for those fields. I mainly did this so that all of the metadata was in the ... well, metadata folder!

2: Edit Makefile so that the APP_AUTHOR, APP_DESCRIPTION, and APP_TITLE fields use ?= instead of :=
This is important as ?= says "Use whatever value is in the file here if it's not specified in the environment" (so if you forget your txt files, it has a fallback option). Personally I set it to this:

Code:
APP_TITLE        ?=    ERR_NO_APP_TITLE
APP_DESCRIPTION  ?=    ERR_NO_APP_DESCRIPTION
APP_AUTHOR       ?=    ERR_NO_APP_AUTHOR

3: Create a new batch file named buildwithcia.bat in the root project directory
NOTE: If you haven't already, either specify bannertool, makerom, and strip-elf in your environment, or put the EXE files in the same directory as the batch file.

This batch file should have the following contents:
Code:
@ECHO OFF
SET /p TITLE=<.\meta\title.txt
SET /p DESCRIPTION=<.\meta\description.txt
SET /p AUTHOR=<.\meta\author.txt

:BUILDMAIN
ECHO Building ELF, 3DSX, and SMDH...
MAKE APP_TITLE="%TITLE%" APP_DESCRIPTION="%DESCRIPTION%" APP_AUTHOR="%AUTHOR%"
IF "%1"=="NO_CIA" GOTO EOF

:MAKEBANNER
ECHO Making banner...
BANNERTOOL makebanner -i ".\meta\banner.png" -a ".\meta\banner.wav" -o ".\banner.bin"

:BUILDCIA
ECHO Building CIA...
STRIP-ELF YOUR_PROJECT_NAME.elf
MAKEROM -f cia -o YOUR_PROJECT_NAME.cia -rsf YOUR_PROJECT_NAME.rsf -target t -exefslogo -elf YOUR_PROJECT_NAME.elf -icon YOUR_PROJECT_NAME.smdh -banner banner.bin

:EOF

As you may be able to see, you can execute this batch with buildwithcia NO_CIA to only do a stock build operation.

4: In VS2019, edit the solution's build command line
EXAMPLE_BUILD.png




Any opinions on this? Stuff that I should change? I'm open to anything. Let me know if anything needs to be elaborated upon or if I'm being a complete idiot with how I'm doing something. Cheers.
 
Last edited by EtiTheSpirit,
  • Like
Reactions: Jmbenetti and Nutez

Jmbenetti

Member
Newcomer
Joined
May 14, 2019
Messages
16
Trophies
0
Age
41
XP
221
Country
Argentina
I installed Linux just to build Scummvm CIAs. I'd like to create CIAs of another systems with the games embedded. I think this might be useful to try un Windows, I believe I still have Visual Studio on my computer. Thanks!
 

MrHuu

Well-Known Member
Member
Joined
Sep 19, 2015
Messages
563
Trophies
0
Age
37
XP
1,619
Country
Netherlands
I don't quite understand why the tools and target needed for building the .cia format aren't included by DevkitPro by default.

As elhobbs already said, you could also add the .cia target to the Makefile itself.

As an other example: https://github.com/MrHuu/devilutionX-3ds/blob/7597da1c0ff285d67d63c795979ee7fa68462796/Makefile.3ds
- Makefile: Link
- Assets: Link
Used for the initial devilutionx build, but easily adjusted for other projects by just editing the Makefile and icon/banner.
A template.rsf file is used and mostly handled by the Makefile. No need to edit in most cases, as it can be done in the Makefile.

I installed Linux just to build Scummvm CIAs. I'd like to create CIAs of another systems with the games embedded. I think this might be useful to try un Windows, I believe I still have Visual Studio on my computer. Thanks!

To inlcude a romfs filesystem in a .cia, like done with scummvm, just edit the 'yourproject'.rsf file.

Uncomment or add:
Code:
RomFs:
  rootpath : path/to/include

Use the OP's build instructions and add 'romfsInit()' to your code.
Now you'll have the files available as 'romfs:/' in your .cia build.
 
  • Like
Reactions: Jmbenetti

Jmbenetti

Member
Newcomer
Joined
May 14, 2019
Messages
16
Trophies
0
Age
41
XP
221
Country
Argentina
I don't quite understand why the tools and target needed for building the .cia format aren't included by DevkitPro by default.

As elhobbs already said, you could also add the .cia target to the Makefile itself.

As an other example:
- Makefile: Link
- Assets: Link
Used for the initial devilutionx build, but easily adjusted for other projects by just editing the Makefile and icon/banner.
A template.rsf file is used and mostly handled by the Makefile. No need to edit in most cases, as it can be done in the Makefile.



To inlcude a romfs filesystem in a .cia, like done with scummvm, just edit the 'yourproject'.rsf file.

Uncomment or add:
Code:
RomFs:
  rootpath : path/to/include

Use the OP's build instructions and add 'romfsInit()' to your code.
Now you'll have the files available as 'romfs:/' in your .cia build.
I don't quite understand why the tools and target needed for building the .cia format aren't included by DevkitPro by default.

As elhobbs already said, you could also add the .cia target to the Makefile itself.

As an other example:
- Makefile: Link
- Assets: Link
Used for the initial devilutionx build, but easily adjusted for other projects by just editing the Makefile and icon/banner.
A template.rsf file is used and mostly handled by the Makefile. No need to edit in most cases, as it can be done in the Makefile.



To inlcude a romfs filesystem in a .cia, like done with scummvm, just edit the 'yourproject'.rsf file.

Uncomment or add:
Code:
RomFs:
  rootpath : path/to/include

Use the OP's build instructions and add 'romfsInit()' to your code.
Now you'll have the files available as 'romfs:/' in your .cia build.
I don't quite understand why the tools and target needed for building the .cia format aren't included by DevkitPro by default.

As elhobbs already said, you could also add the .cia target to the Makefile itself.

As an other example:
- Makefile: Link
- Assets: Link
Used for the initial devilutionx build, but easily adjusted for other projects by just editing the Makefile and icon/banner.
A template.rsf file is used and mostly handled by the Makefile. No need to edit in most cases, as it can be done in the Makefile.



To inlcude a romfs filesystem in a .cia, like done with scummvm, just edit the 'yourproject'.rsf file.

Uncomment or add:
Code:
RomFs:
  rootpath : path/to/include

Use the OP's build instructions and add 'romfsInit()' to your code.
Now you'll have the files available as 'romfs:/' in your .cia build.

Thanks a lot! I'll be trying this soon! ☺️
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,035
Country
United States
I don't quite understand why the tools and target needed for building the .cia format aren't included by DevkitPro by default.
I suspect it may have to do with the fact that 3dsx files don’t have the same piracy connotations as cia files.
 

EtiTheSpirit

Member
OP
Newcomer
Joined
Dec 4, 2019
Messages
8
Trophies
0
Age
23
XP
78
Country
United States
Why not just add a cia option to the makefile - so you can do make cia?

Quite a late response on my part, I read this and then entirely forgot to reply. Must've been occupied, my mistake.

To answer the question, primarily because I don't know how, to be honest! I've never dealt with the makefile format before so I have a very narrow understanding of what it can do and how it works. It'll certainly be worth it to learn though. I'll update my OP whenever I get around to designing a streamlined process. If anyone else throws it together before me, I can just link the reply.
 
  • Like
Reactions: Jmbenetti

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    AncientBoi @ AncientBoi: uh no