In order to get quickly to template folder you can make an alias.
$ cd ~/
$ vi .bashrc
- go to end of file
- press “a”
- add following lines:
alias gotemp=’cd /devkitpro/examples/gba/template’
alias gosrc=’cd /devkitpro/examples/gba/template/source’
alias rungba=’/usr/bin/VisualBoyAdvance /devkitpro/examples/gba/template/template_mb.gba’
alias vb=’/usr/bin/VisualBoyAdvance’
- press “Esc” and “ZZ” to save and quick file
If during editing file something goes wrong, press “Esc” and “:quit” to quit without saving.
“gotemp”, “gosrc” and “rungba” are names of yours aliases and can be replace by anything else.
Now $ exit and run termina again. $ gosrc to take yourself to source folder where file template.c is located.
$ gedit template.c
This is the file where you’ll put your program code.
Now, you’ll make a script that automatic does make clean, make, rungba in this order.
- $ cd ~/Documents
- $ mkdir scripts
- $ gedit gbscr
Write these and save the file:
cd /devkitpro/examples/gba/template
echo "Deleting template_mb.gba and template_mb.elf"
make clean
echo "Compiling code ..."
make
echo "Running template_mb.gba in emulator"
/usr/bin/VisualBoyAdvance /devkitpro/examples/gba/template/template_mb.gba
Now, add scripts folder to $PATH environmental variable
- $ cd ~/
- gedit .bashrc
Add
export PATH=$PATH:$HOME/scripts
to the end of the file.
- $ exit
- Run terminal again
- $ gbscr
Last command should compile your template project and open it in emulator.