gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Grafix help

#138311 - ubercatch22 - Wed Aug 22, 2007 9:06 pm

Can someone help my?

i acnt seem to get the compiler to compile my code i aways get error

***no specific target and no make file found

can anyone help


Last edited by ubercatch22 on Thu Aug 23, 2007 3:27 am; edited 1 time in total

#138322 - tepples - Wed Aug 22, 2007 11:16 pm

How are you running make? Are you trying to double-click make.exe?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#138327 - ubercatch22 - Wed Aug 22, 2007 11:32 pm

I guess since im using devkitpro i open programmers note pad 2 and write my file and thne click on tools make or hit alt + 1 for short cut

the examples that comewith it work but mine do not

but i have bypassed this by copying a example in to another folder and then over writing the ds code file

it seems to work for know

#138340 - tepples - Thu Aug 23, 2007 2:27 am

ubercatch22 wrote:
but i have bypassed this by copying a example in to another folder and then over writing the ds code file

Good job. This is how most people start a libnds project: by copying the hello world project into a new folder and going from there.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#138342 - ubercatch22 - Thu Aug 23, 2007 2:52 am

yep i got it to work and did that but how do i get images on the ds i have been reading and it seems it needs to be in a .bin file formate.

if someone could help that would be great

#138361 - Dood77 - Thu Aug 23, 2007 8:14 am

http://filext.com/file-extension/BIN
_________________
If I use a term wrong or something then feel free to correct, I?m not much of a programmer.

Original DS Phat obtained on day of release + flashme v7
Supercard: miniSD, Kingston 1GB, Kingston 2GB
Ralink chipset PCI NIC

#138384 - Risine - Thu Aug 23, 2007 2:05 pm

In your makefile, you probably have that lines to include bin files.
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

You can add that for pcx image files. ( they must be 256 indexed coloured images. )
#---------------------------------------------------------------------------------
%.pcx.o : %.pcx
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

And then you just need to load the pcx file in your code using gbfs :
----------
#include"gbfs.h"
...
char *data;
sImage Img;
WAIT_CR&=~0x80;
GBFS_FILE const *gbfs_file=find_first_gbfs_file((void*)0x08000000);
data=(char *)gbfs_get_obj(gbfs_file,str_files[i],(u32 *)&length);
loadPCX((u8 *)data,&Img);
--------------
---->>> str_files[i] is the "case sensitive" name of the file.

You can do the same with all you data files ( just replace loadpcx with your own data reading functions ).
Just read a little more things about gbfs, that's not that complicated to get in.
These links are quite useful for beginners :
http://www.double.co.nz/nintendo_ds/
http://www.dev-scene.com/NDS/Tutorials

#138393 - tepples - Thu Aug 23, 2007 4:08 pm

Risine wrote:
GBFS_FILE const *gbfs_file=find_first_gbfs_file((void*)0x08000000);

The find_first_gbfs_file function works only on ds.gba (aka sc.nds), not on the original GBA Movie Player or on SLOT-1 cards. But you can malloc() some space and load a GBFS file using libfat.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#138394 - wintermute - Thu Aug 23, 2007 4:21 pm

tepples wrote:
Risine wrote:
GBFS_FILE const *gbfs_file=find_first_gbfs_file((void*)0x08000000);

The find_first_gbfs_file function works only on ds.gba (aka sc.nds), not on the original GBA Movie Player or on SLOT-1 cards. But you can malloc() some space and load a GBFS file using libfat.


gbfs will work fine if it's embedded in the arm9 binary. One of the libnds examples does just this.

Image files do *not* need to be in a bin format, there are several ways to approach adding graphics to a ds binary.

First you can link the image file directly using the bin2o macro in the makefile - this will involve writing code on the DS to decode the image and convert to a DS native format.

In the default arm9 template all files place in any directory referred to by the DATA variable will be automatically added to the project as a binary file.

Code:

DATA      :=   data


This names directories within the project folder at the same level as the makefile.

For each extension you want to use you should copy the .bin rule & change the name to match.

Code:

#---------------------------------------------------------------------------------
%.bin.o   :   %.bin
#---------------------------------------------------------------------------------
   @echo $(notdir $<)
   @$(bin2o)



so, for .pcx files we add

Code:

#---------------------------------------------------------------------------------
%.pcx.o   :   %.pcx
#---------------------------------------------------------------------------------
   @echo $(notdir $<)
   @$(bin2o)



and for .bmp files

Code:

#---------------------------------------------------------------------------------
%.bmp.o   :   %.bmp
#---------------------------------------------------------------------------------
   @echo $(notdir $<)
   @$(bin2o)



The bin2o rule creates a header which we can use to access this data which will take the form <name>_<extension>.h. This file will define <name>_<extension> and <name>_<extension>_size

Code:

// for test.bmp
#include "test_bmp.h"

int test_size = test_bmp_size;
char *test = test_bmp;

//for splash.pcx
#include "splash_pcx.h"

int splash_size = splash_pcx_size;
char *splash = splash_pcx;


You could also use libfat to load the graphics from your media device at runtime.

By far the simplest way is to use grit to convert your graphics to a DS native format at compile time. The current version of devkitARM includes a n earlier version of grit which is called git - the name was changed to avoid confusion with a linux application of the same name. Several of the examples use this approach to embed graphics.

Hopefully this all helps a bit but we can give more specific advice if you tell us exactly what you want to achieve. For instance "I want to use a file called logo.bmp and display it as a splash screen at startup"
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog