Page 1 of 1

Game Icon/Logo problem...

Posted: Tue Apr 14, 2009 2:20 pm
by PeeterCZ
Hello, i am starting with devkitpro because i want to create my own homebrew applications or games.
I started with a simpler application - color mixer which is controlled with buttons (L/R for red, Left/Right for green and Y/B for blue).
I wanted to add an icon for my project so i pasted this line into my Makefile

Code: Select all

ICON 	:= -b $(CURDIR)/../logo.bmp
However, it seems that the icon (though it is in the root dir of project - next to makefile) isn't added to the NDS file. The icon is 32x32 pixels 16 color BMP i created in Paint.
I don't know if it matters, but here is the source code:

Code: Select all

#include <nds.h>
#include <stdio.h>

int main(void)
{
	int i;
	int r;
	int g;
	int b;
	r = 0;
	g = 0;
	b = 0;
	irqInit();
	irqEnable(IRQ_VBLANK);
 consoleDemoInit();
	videoSetMode(MODE_FB0);
	vramSetBankA(VRAM_A_LCD);
	 	lcdMainOnBottom();
 
	while(1)
	{
	 consoleClear();
	iprintf("RGB: %i,%i,%i\n", r, g, b);
	printf("Michatko vytvoril\nPeeter dne 13.4. 2009");
    scanKeys();
		int held = keysHeld();
 
		if(held & KEY_R)
			if(r < 31) r++;
		if(held & KEY_L)
			if(r > 0) r--;
		if(held & KEY_RIGHT)
			if(g < 31) g++;
    if(held & KEY_LEFT)
			if(g > 0) g--;
		if(held & KEY_A)
			if(b < 31) b++;
    if(held & KEY_Y)
			if(b > 0) b--;

		swiWaitForVBlank();
		for(i = 0; i < 256*192; i++)
      VRAM_A[i] = RGB15(r,g,b);
	}
	return 0;
}
And this is my makefile (i grabbed it from one of the examples and added the ICON line)

Code: Select all

#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/ds_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET		:=	$(shell basename $(CURDIR))
BUILD		:=	build
SOURCES		:=	source
DATA		:=	data
INCLUDES	:=	include
ICON 	:= -b $(CURDIR)/../logo.bmp

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH	:=	-mthumb -mthumb-interwork

CFLAGS	:=	-g -Wall -O2\
 			-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\
			-ffast-math \
			$(ARCH)

CFLAGS	+=	$(INCLUDE) -DARM9
CXXFLAGS	:= $(CFLAGS) -fno-rtti -fno-exceptions

ASFLAGS	:=	-g $(ARCH)
LDFLAGS	=	-specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS	:= -lnds9


#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS	:=	$(LIBNDS)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT	:=	$(CURDIR)/$(TARGET)

export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
			$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR	:=	$(CURDIR)/$(BUILD)

CFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES	:=	$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
	export LD	:=	$(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
	export LD	:=	$(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

export OFILES	:=	$(addsuffix .o,$(BINFILES)) \
			$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

export INCLUDE	:=	$(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
			$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
			-I$(CURDIR)/$(BUILD)

export LIBPATHS	:=	$(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean all

#---------------------------------------------------------------------------------
all: $(BUILD)

$(BUILD):
	@[ -d $@ ] || mkdir -p $@
	@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
	@echo clean ...
	@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba

run:
	wmb -data $(OUTPUT).nds


#---------------------------------------------------------------------------------
else

DEPENDS	:=	$(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds	: 	$(OUTPUT).arm9
$(OUTPUT).arm9	:	$(OUTPUT).elf
$(OUTPUT).elf	:	$(OFILES)

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


-include $(DEPENDS)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
And finally, this is the icon i use:
Image

Sorry for the long post, but i really don't know what am i doing wrong, the icon just won't show up on my DSTT (icons of other homebrew games are completely okay)

Re: Game Icon/Logo problem...

Posted: Wed Apr 15, 2009 5:53 am
by Sylus101
Building off of examples from the current libnds I've been using GAME_ICON to specify the logo's location.

Re: Game Icon/Logo problem...

Posted: Wed Apr 15, 2009 2:13 pm
by PeeterCZ
It still doesn't work :( Tried putting it in various places, copying the icon to all possible folders but it looks like it just ignores that line :(

Re: Game Icon/Logo problem...

Posted: Wed Apr 15, 2009 2:42 pm
by eKid
Here add this to your makefile underneath "export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)"

Code: Select all

icons = $(wildcard *.bmp)

ifneq (,$(findstring $(TARGET).bmp,$(icons)))
	export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
	ifneq (,$(findstring icon.bmp,$(icons)))
		export GAME_ICON := $(CURDIR)/icon.bmp
	endif
endif
call your bmp file "icon.bmp", and try again!

nice icon btw ;)

Re: Game Icon/Logo problem...

Posted: Wed Apr 15, 2009 4:28 pm
by PeeterCZ
Seriously, f**k this, still doesn't work, jeez. I am getting really sad right now :(.Why is this happening?

EDIT: In the console after i typed make, nothing like icon.bmp showed up (and i think it should)

Code: Select all

C:\devkitPro\NDS\skicak>make clean
clean ...

C:\devkitPro\NDS\skicak>make
main.c
arm-eabi-gcc -MMD -MP -MF /c/devkitPro/NDS/skicak/build/main.d -g -Wall -O2 -mar
ch=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-int
erwork -I/c/devkitPro/NDS/skicak/include -I/c/devkitPro/libnds/include -I/c/devk
itPro/NDS/skicak/build -DARM9 -c /c/devkitPro/NDS/skicak/source/main.c -o main.o

linking skicak.elf
built ... skicak.arm9
Nintendo DS rom tool 1.36 - Oct 22 2007 04:04:50
by Rafael Vuijk, Dave Murphy, Alexei Karpenko
built ... skicak.nds

Skicak (Skicák) is in czech language something like sketchbook ;)

Re: Game Icon/Logo problem...

Posted: Wed Apr 15, 2009 6:51 pm
by Sylus101
NOTE to Admins... I'm not suggesting modifying anything here...

Open up your ds_rules file in your devkitarm directory.

How does the line that calls ndstool read?

Re: Game Icon/Logo problem...

Posted: Wed Apr 15, 2009 8:09 pm
by PeeterCZ
I wasn't sure what to exactly post so here is complete ds_rules

Code: Select all

ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif

include $(DEVKITARM)/base_rules

LIBNDS	:=	$(DEVKITPRO)/libnds

#---------------------------------------------------------------------------------
%.ds.gba: %.nds
	@dsbuild $<
	@echo built ... $(notdir $@)

#---------------------------------------------------------------------------------
%.nds: %.arm9
	@ndstool -c $@ -9 $<
	@echo built ... $(notdir $@)

#---------------------------------------------------------------------------------
%.arm9: %.elf
	@$(OBJCOPY) -O binary $< $@
	@echo built ... $(notdir $@)
 
#---------------------------------------------------------------------------------
%.arm7: %.elf
	@$(OBJCOPY) -O binary $< $@
	@echo built ... $(notdir $@)

#---------------------------------------------------------------------------------
%.elf:
	@echo linking $(notdir $@)
	@$(LD)  $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@


Re: Game Icon/Logo problem...

Posted: Wed Apr 15, 2009 9:21 pm
by PeeterCZ
Solved the problem... you wouldn't believe me, it helped when i swapped the makefile for the one from palib :D (i needed to use palib libraries) Yay i am so happy right now

Re: Game Icon/Logo problem...

Posted: Wed Apr 15, 2009 10:46 pm
by WinterMute
It's highly recommended that you *don't* use PAlib - in fact your problem here was actually caused by using PAlib in the first place.

The current ds_rules file looks like this :-

Code: Select all

ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif

include $(DEVKITARM)/base_rules

LIBNDS	:=	$(DEVKITPRO)/libnds

ifeq ($(strip $(GAME_TITLE)),)
GAME_TITLE	:=	$(notdir $(OUTPUT))
endif

ifeq ($(strip $(GAME_SUBTITLE1)),)
GAME_SUBTITLE1	:=	www.devkitpro.org
endif

ifeq ($(strip $(GAME_SUBTITLE2)),)
GAME_SUBTITLE2	:=	www.drunkencoders.com
endif

ifeq ($(strip $(GAME_ICON)),)
GAME_ICON      :=      $(DEVKITPRO)/libnds/icon.bmp
endif

ifneq ($(strip $(NITRO_FILES)),)
_ADDFILES	:=	-d $(NITRO_FILES)
endif

#---------------------------------------------------------------------------------
%.nds: %.arm9
	@echo $(_ADDFILES)
	ndstool -c $@ -9 $< -b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" $(_ADDFILES)
	@echo built ... $(notdir $@)

#---------------------------------------------------------------------------------
%.arm9: %.elf
	@$(OBJCOPY) -O binary $< $@
	@echo built ... $(notdir $@)
 
#---------------------------------------------------------------------------------
%.arm7: %.elf
	@$(OBJCOPY) -O binary $< $@
	@echo built ... $(notdir $@)

#---------------------------------------------------------------------------------
%.elf:
	@echo linking $(notdir $@)
	@$(LD)  $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@