So I'm trying to get Maxmod working in some sample code I'm working with. I'm writing the code in Visual C++ 2008, as mentioned in this tutorial. However, I'm sure I've added it correctly, and it still fails to make an NDS image. Here's my code:
Here's the makefile:
Here's my build log:
If I copy/paste the code into the Hello World blank project in Programmer's Notepad, I have to rename my modules to numbers to get it to compile, but I don't have any audio at all. Names don't work or anything. Could someone get me on the right track and get my code to compile properly?
Code:
#include <nds.h>
#include <stdio.h>
#include <maxmod9.h> // Maxmod definitions for ARM9
#include "soundbank.h" // Soundbank definitions
#include "soundbank_bin.h"
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
consoleDemoInit(); //setup the sub screen for printing
mmInitDefaultMem((mm_addr)soundbank_bin);
mmLoad( mainmenu );
iprintf("\n\tYou should hear music.\n\n\tFinal Fantasy VII Demo\n\tPrelude Remix");
mmStart( mainmenu, MM_PLAY_LOOP );
while(1) {
swiWaitForVBlank();
}
return 0;
}
Code:
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files
# all directories are relative to this makefile
#---------------------------------------------------------------------------------
BUILD := build
SOURCES := source
INCLUDES := include
DATA :=
AUDIO := audio
#---------------------------------------------------------------------------------
# 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) -march=armv5te -mtune=arm946e-s
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
GAME_TITLE := Sample Game Title
GAME_SUBTITLE1 := Team Fail
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lmm9 -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 ARM9ELF := $(CURDIR)/$(TARGET).elf
export DEPSDIR := $(CURDIR)/$(BUILD)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
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)/*.bin))) soundbank.bin
# build audio file list, include full path
export AUDIOFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(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
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d [email protected] ] || mkdir -p [email protected]
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@Echo clean ...
@rm -fr $(BUILD) *.elf *.nds* *.bin
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(ARM9ELF) : $(OFILES)
@Echo linking $(notdir [email protected])
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o [email protected]
#-------------------------------------------------------------
# rule for generating soundbank file from audio files
#-------------------------------------------------------------
soundbank.bin: $(AUDIOFILES)
#-------------------------------------------------------------
@mmutil $^ -osoundbank.bin -hsoundbank.h -d
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@Echo $(notdir $<)
@$(bin2o)
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
Code:
1>------ Build started: Project: game, Configuration: Debug Win32 ------
1>Performing Makefile project actions
1>make -C arm7
1>make[1]: Entering directory `/c/Users/Jordan/DS/game/game/arm7'
1>make[2]: `/c/Users/Jordan/DS/game/game/arm7/game.elf' is up to date.
1>make[1]: Leaving directory `/c/Users/Jordan/DS/game/game/arm7'
1>make -C arm9
1>make[1]: Entering directory `/c/Users/Jordan/DS/game/game/arm9'
1>************************
1>* Maxmod Utility 1.8.6 *
1>************************
1>Usage:
1> mmutil [options] input files ...
1> Input may be MOD, S3M, XM, IT, and/or WAV
1>.------------.----------------------------------------------------.
1>| Option | Description |
1>|------------|----------------------------------------------------|
1>| -o<output> | Set output file. |
1>| -h<header> | Set header output file. |
1>| -m | Output MAS file rather than soundbank. |
1>| -d | Use for NDS projects. |
1>| -b | Create test ROM. (use -d for .nds, otherwise .gba) |
1>| -i | Ignore sample flags. |
1>| -v | Enable verbose output. |
1>| -p | Set initial panning separation for MOD/S3M. |
1>`-----------------------------------------------------------------'
1>.-----------------------------------------------------------------.
1>| Examples: |
1>|-----------------------------------------------------------------|
1>| Create DS soundbank file (soundbank.bin) from input1.xm |
1>| and input2.it Also output header file (soundbank.h) |
1>| |
1>| mmutil -d input1.xm input2.it -osoundbank.bin -hsoundbank.h |
1>|-----------------------------------------------------------------|
1>| Create test GBA ROM from two inputs |
1>| |
1>| mmutil -b input1.mod input2.s3m -oTEST.gba |
1>|-----------------------------------------------------------------|
1>| Create test NDS ROM from three inputs |
1>| |
1>| mmutil -d -b input1.xm input2.s3m testsound.wav |
1>`-----------------------------------------------------------------'
1> www.maxmod.org
1>soundbank.bin
1>soundbank.bin: No such file or directory
1>bin2s: could not open template.c
1>arm-eabi-gcc -MMD -MP -MF /c/Users/Jordan/DS/game/game/arm9/build/template.d -g -Wall -O2 -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -I/c/Users/Jordan/DS/game/game/arm9/include -I/c/devkitPro/libnds/include -I/c/Users/Jordan/DS/game/game/arm9/build -DARM9 -c /c/Users/Jordan/DS/game/game/arm9/source/template.c -o template.o 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):/\1(\2):/g'
1>c:/Users/Jordan/DS/game/game/arm9/source/template.c(4):49: fatal error: soundbank.h: No such file or directory
1>compilation terminated.
1>linking game.elf
1>arm-eabi-gcc.exe: error: template.o: No such file or directory
1>make[2]: *** [/c/Users/Jordan/DS/game/game/arm9/game.elf] Error 1
1>make[1]: *** [build] Error 2
1>make[1]: Leaving directory `/c/Users/Jordan/DS/game/game/arm9'
1>make: *** [arm9/game.elf] Error 2
1>Build log was saved at "file://c:\Users\Jordan\DS\game\game\Debug\BuildLog.htm"
1>game - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
If I copy/paste the code into the Hello World blank project in Programmer's Notepad, I have to rename my modules to numbers to get it to compile, but I don't have any audio at all. Names don't work or anything. Could someone get me on the right track and get my code to compile properly?