Homebrew Maxmod hates me

loco365

Well-Known Member
OP
Member
Joined
Sep 1, 2010
Messages
5,457
Trophies
0
XP
2,927
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:

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;
}
Here's the makefile:
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
#---------------------------------------------------------------------------------------
Here's my build log:
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?
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
29,832
Trophies
3
Location
Gaming Grotto
XP
28,215
Country
Poland
It would probably work if you included the music into your project. :P

Is the song called mainmenu in your Data folder? If it's not, you're calling for something that doesn't exist. But even before that...

Code:
1>c:/Users/Jordan/DS/game/game/arm9/source/template.c(4):49: fatal error: soundbank.h: No such file or directory

Where's the soundbank.h file, huh? ;)
 

LeRodeur

Well-Known Member
Member
Joined
Dec 12, 2009
Messages
162
Trophies
0
Age
29
XP
180
Country
France
the odd part is :
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 | Set output file. |
1>| -h | 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>`-----------------------------------------------------------------'

Shouldn't be here if mmutils call was successful, and the command line in the makefile seems ok, did you place your sound files in arm9/audio?
 

Foxi4

Endless Trash
Global Moderator
Joined
Sep 13, 2009
Messages
29,832
Trophies
3
Location
Gaming Grotto
XP
28,215
Country
Poland
It would be best if he just zips up his entire compile folder and hosts it somewhere for others to review, that way we can simultainously look for bugs.
 

loco365

Well-Known Member
OP
Member
Joined
Sep 1, 2010
Messages
5,457
Trophies
0
XP
2,927
It would probably work if you included the music into your project. :P

Is the song called mainmenu in your Data folder? If it's not, you're calling for something that doesn't exist. But even before that...
I have it in my audio folder, but I tried copying it to Data, and it still didn't work.

Code:
1>c:/Users/Jordan/DS/game/game/arm9/source/template.c(4):49: fatal error: soundbank.h: No such file or directory

Where's the soundbank.h file, huh? ;)
I can't find it, although I thought I had seen it earlier.

If you want to see it, here's the project: https://dl.dropbox.com/u/34957059/game.zip

After, I tried moving the audio folder into arm9, and now it's making soundbank.bin, but still isn't successful. Try doing it when you download my package.
 

LeRodeur

Well-Known Member
Member
Joined
Dec 12, 2009
Messages
162
Trophies
0
Age
29
XP
180
Country
France
As said before, place the audio folder in your arm9 folder and maxmod uses defines for sounds such as MOD_*MYMODNAME* for mod files and SFX_*MYSFXNAME* for the sounds samples.
They are all defined in the soundbank.h file (located in your arm9/build directory after compilation)
Note that you could convert sounds and music without compiling using mmutils without makefile and then include the .h files in your souce and soundbank.bin in data folder

Note : I don't really like tue idea of compiling arm7 by yourself, creators of devkitpro and libnds said it many times, you should use the precompiled version of the arm7 core, and use the examples as your templates. Unless you know what you are doing, which doesn't really sound to be the case
 

LeRodeur

Well-Known Member
Member
Joined
Dec 12, 2009
Messages
162
Trophies
0
Age
29
XP
180
Country
France
I was thinking that the best blank project would be arm7 + arm9, but I guess that's wrong.

*request close*
It is suggested not to compile ARM7 by yourself so that you avoid problems with maxmod libwifi etc, using both processors isnt as easy as it seems, and arm7 have specific work and abilities in NDS mode
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • SylverReZ @ SylverReZ:
    @Sonic Angel Knight, He do be shitting.
  • K3N1 @ K3N1:
    I don't have your fetish sorry
  • Psionic Roshambo @ Psionic Roshambo:
    A new fetish has entered the arena!!!
  • K3N1 @ K3N1:
    Chatroom*
  • Julie_Pilgrim @ Julie_Pilgrim:
    oh mygod
  • Julie_Pilgrim @ Julie_Pilgrim:
    is it just me or has the EOF hit an absolute low?
  • Julie_Pilgrim @ Julie_Pilgrim:
    like it always sux yeah but oh my god it REALLY REALLY sux now
  • K3N1 @ K3N1:
    Things tend to kind of get that way when people are allowed to do the same thing over and over again
  • Sonic Angel Knight @ Sonic Angel Knight:
    @Psionic Roshambo Tell us more about this new fetish? :blink:
  • K3N1 @ K3N1:
    He's got an entire bibles on fetishes
  • The Real Jdbye @ The Real Jdbye:
    @Julie_Pilgrim always has been
  • S @ SeniorFuego:
    So why is it that we're not allowed to talk about somebody shooting up a school if that person happens to be trans, even when not expressing a personal opinion???
  • Veho @ Veho:
    Who are you?
    +1
  • S @ SeniorFuego:
    A concerned citizen
  • S @ SeniorFuego:
    Here's a neat trick... if you have the edit post page open,, you can edit your post, even after the thread is locked. :D
  • S @ SeniorFuego:
    And knowing is half the battle. So why aren't the people allowed to know about the school shooting that happened the other day? People sure are free to talk about every other divisive topic in the politics section. And it usually swings in favor of the anti-republican types if a thread is allowed to stay up. Funny, that...
  • Veho @ Veho:
    But not really "ha ha" funny.
  • S @ SeniorFuego:
    I thought you people were supposed to be against authoritarianism.
  • Maximumbeans @ Maximumbeans:
    Lmao muh rights
  • Maximumbeans @ Maximumbeans:
    Everybody already knows about it, you know that your thread was taken down for your own idiotic statement and not because of the content. Take two minutes to browse the politics forum and you'll see that the admins definitely aren't authoritarian.
  • sombrerosonic @ sombrerosonic:
    pol is funni, i cause people to get pissed
    sombrerosonic @ sombrerosonic: pol is funni, i cause people to get pissed