-slightly modified the makefile to hopefully get the default

theme images to work properly again
This commit is contained in:
fix94.1 2012-10-10 17:09:23 +00:00
parent 3d2363bd78
commit cca5f4559e
8 changed files with 246 additions and 294 deletions

View File

@ -24,7 +24,6 @@ SOURCES := source \
source/config \
source/data \
source/devicemounter \
source/devicemounter/libwbfs \
source/fileOps \
source/gc \
source/gecko \
@ -55,10 +54,10 @@ ios := 249
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -Wall -Wextra -Wno-multichar $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
CXXFLAGS = $(CFLAGS)
CFLAGS := -g -O2 -Wall -Wextra $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
CXXFLAGS := $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size
LDFLAGS := -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
@ -86,28 +85,11 @@ export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
SVNREV := $(shell bash ./scripts/svnrev.sh)
export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
TXTFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.txt)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf)))
PNGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.png)))
JPGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.jpg)))
MP3FILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.mp3)))
OGGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ogg)))
PCMFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.pcm)))
WAVFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.wav)))
DOLFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.dol)))
ELFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.elf)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
@ -120,10 +102,8 @@ endif
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o) \
$(JPGFILES:.jpg=.jpg.o) $(PNGFILES:.png=.png.o) $(DOLFILES:.dol=.dol.o) \
$(OGGFILES:.ogg=.ogg.o) $(WAVFILES:.wav=.wav.o) $(MP3FILES:.mp3=.mp3.o) \
$(ELFFILES:.elf=.elf.o) $(BINFILES:.bin=.bin.o) $(TXTFILES:.txt=.txt.o) \
$(CURDIR)/data/magic_patcher.o
$(addsuffix .o,$(BINFILES)) \
$(CURDIR)/data/binary/magic_patcher.o
#---------------------------------------------------------------------------------
# build a list of include paths
@ -146,8 +126,9 @@ export OUTPUT := $(CURDIR)/$(TARGET)
#---------------------------------------------------------------------------------
$(BUILD):
@echo Building for IOS $(ios).
@bash ./scripts/buildtype.sh $(ios)
@[ -d $@ ] || mkdir -p $@
@bash $(CURDIR)/scripts/svnrev.sh
@bash $(CURDIR)/scripts/buildtype.sh $(ios)
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.main
#---------------------------------------------------------------------------------
@ -181,66 +162,56 @@ DEPENDS := $(OFILES:.o=.d)
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES) alt_ios_gen.o
#---------------------------------------------------------------------------------
$(BUILD)/alt_ios_gen.o: alt_ios_gen.c
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .txt extension
#---------------------------------------------------------------------------------
%.txt.o: %.txt
@echo $(notdir $<)
@bin2s $< | $(AS) -o $(@)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o : %.jpg
@echo $(notdir $<)
@bin2s $< | $(AS) -o $(@)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o : %.png
@echo $(notdir $<)
@bin2s $< | $(AS) -o $(@)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .ogg extension
#---------------------------------------------------------------------------------
%.ogg.o : %.ogg
@echo $(notdir $<)
@bin2s $< | $(AS) -o $(@)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .wav extension
#---------------------------------------------------------------------------------
%.wav.o : %.wav
@echo $(notdir $<)
@bin2s $< | $(AS) -o $(@)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .bin extension
#---------------------------------------------------------------------------------
%.bin.o : %.bin
@echo $(notdir $<)
@bin2s $< | $(AS) -o $(@)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .dol extension
#---------------------------------------------------------------------------------
%.dol.o : %.dol
@echo $(notdir $<)
@bin2s $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .elf extension
#---------------------------------------------------------------------------------
%.elf.o : %.elf
@echo $(notdir $<)
@bin2s $< | $(AS) -o $(@)
@$(bin2o)
-include $(DEPENDS)

View File

@ -1616,7 +1616,7 @@ void CMenu::_gameSoundThread(CMenu *m)
delete banner;
if(soundBin != NULL)
{
if(((IMD5Header *)soundBin)->fcc == 'IMD5')
if(memcmp(&((IMD5Header *)soundBin)->fcc, "IMD5", 4) == 0)
{
u32 newSize = 0;
u8 *newSound = DecompressCopy(soundBin, sndSize, &newSize);

View File

@ -122,12 +122,12 @@ void AifDecoder::OpenFile()
SWaveHdr Header;
file_fd->read((u8 *) &Header, sizeof(SWaveHdr));
if (Header.magicRIFF != 'FORM')
if(memcmp(&Header.magicRIFF, "FORM", 4) != 0)
{
CloseFile();
return;
}
else if(Header.magicWAVE != 'AIFF')
else if(memcmp(&Header.magicWAVE, "AIFF", 4) != 0)
{
CloseFile();
return;
@ -144,7 +144,7 @@ void AifDecoder::OpenFile()
return;
}
if(magic == 'COMM')
if(memcmp(&magic, "COMM", 4) == 0)
break;
else
file_fd->seek(-3, SEEK_CUR);
@ -156,7 +156,7 @@ void AifDecoder::OpenFile()
SAIFFCommChunk CommHdr;
file_fd->read((u8 *) &CommHdr, sizeof(SAIFFCommChunk));
if(CommHdr.fccCOMM != 'COMM')
if(memcmp(&CommHdr.fccCOMM, "COMM", 4) != 0)
{
CloseFile();
return;
@ -175,7 +175,7 @@ void AifDecoder::OpenFile()
file_fd->seek(chunkHdr.size, SEEK_CUR);
ret = file_fd->read((u8 *) &chunkHdr, sizeof(SWaveChunk));
}
while(ret > 0 && chunkHdr.magicDATA != 'SSND');
while(ret > 0 && memcmp(&chunkHdr.magicDATA, "SSND", 4) != 0);
// Seek back to start of SSND chunk
file_fd->seek(-sizeof(SWaveChunk), SEEK_CUR);
@ -183,7 +183,7 @@ void AifDecoder::OpenFile()
SAIFFSSndChunk SSndChunk;
file_fd->read((u8 *) &SSndChunk, sizeof(SAIFFSSndChunk));
if(SSndChunk.fccSSND != 'SSND')
if(memcmp(&SSndChunk.fccSSND, "SSND", 4) != 0)
{
CloseFile();
return;

View File

@ -313,9 +313,9 @@ SoundBlock DecodefromBNS(const u8 *buffer, u32 size)
memset(&OutBlock, 0, sizeof(SoundBlock));
const BNSHeader &hdr = *(BNSHeader *)buffer;
if (size < sizeof hdr)
if(size < sizeof hdr)
return OutBlock;
if (hdr.fccBNS != 'BNS ')
if(memcmp(&hdr.fccBNS, "BNS ", 4) != 0)
return OutBlock;
// Find info and data
BNSInfo infoChunk;

View File

@ -203,26 +203,16 @@ SoundDecoder * SoundHandler::GetSoundDecoder(const char * filepath)
/* gprintf("SHND: Searching decoder for magic\n");
ghexdump((u8 *) &magic, 4); */
if(magic == 'OggS')
{
if(memcmp(&magic, "OggS", 4) == 0)
return new OggDecoder(filepath);
}
else if(magic == 'RIFF')
{
else if(memcmp(&magic, "RIFF", 4) == 0)
return new WavDecoder(filepath);
}
else if(magic == 'BNS ')
{
else if(memcmp(&magic, "BNS ", 4) == 0)
return new BNSDecoder(filepath);
}
else if(magic == 'FORM')
{
else if(memcmp(&magic, "FORM", 4) == 0)
return new AifDecoder(filepath);
}
else if(CheckMP3Signature((u8 *) &magic) == true)
{
return new Mp3Decoder(filepath);
}
return new SoundDecoder(filepath);
}
@ -241,28 +231,18 @@ SoundDecoder * SoundHandler::GetSoundDecoder(const u8 * sound, int length)
if(counter >= length)
return NULL;
u32 * magic = (u32 *) check;
u32 * magic = (u32 *)check;
if(magic[0] == 'OggS')
{
if(memcmp(&magic[0], "OggS", 4) == 0)
return new OggDecoder(sound, length);
}
else if(magic[0] == 'RIFF')
{
else if(memcmp(&magic[0], "RIFF", 4) == 0)
return new WavDecoder(sound, length);
}
else if(magic[0] == 'BNS ')
{
else if(memcmp(&magic[0], "BNS ", 4) == 0)
return new BNSDecoder(sound, length);
}
else if(magic[0] == 'FORM')
{
else if(memcmp(&magic[0], "FORM", 4) == 0)
return new AifDecoder(sound, length);
}
else if(CheckMP3Signature(check) == true)
{
return new Mp3Decoder(sound, length);
}
return new SoundDecoder(sound, length);
}

View File

@ -68,23 +68,24 @@ void WavDecoder::OpenFile()
file_fd->read((u8 *) &Header, sizeof(SWaveHdr));
file_fd->read((u8 *) &FmtChunk, sizeof(SWaveFmtChunk));
if(Header.magicRIFF != 'RIFF')
if(memcmp(&Header.magicRIFF, "RIFF", 4) != 0)
{
CloseFile();
return;
}
else if(Header.magicWAVE != 'WAVE')
else if(memcmp(&Header.magicWAVE, "WAVE", 4) != 0)
{
CloseFile();
return;
}
if(FmtChunk.magicFMT == 'bext') //Stupid metadata
if(memcmp(&FmtChunk.magicFMT, "bext", 4) == 0) //Stupid metadata
{
DataOffset += le32(FmtChunk.size) + 8;
file_fd->seek(sizeof(SWaveHdr) + le32(FmtChunk.size) + 8, SEEK_SET);
file_fd->read((u8 *)&FmtChunk, sizeof(SWaveFmtChunk));
}
if(FmtChunk.magicFMT != 'fmt ')
if(memcmp(&FmtChunk.magicFMT, "fmt ", 4) != 0)
{
CloseFile();
return;
@ -95,7 +96,7 @@ void WavDecoder::OpenFile()
SWaveChunk DataChunk;
file_fd->read((u8 *) &DataChunk, sizeof(SWaveChunk));
while(DataChunk.magicDATA != 'data')
while(memcmp(&DataChunk.magicDATA, "data", 4) != 0)
{
DataOffset += 8+le32(DataChunk.size);
file_fd->seek(DataOffset, SEEK_SET);
@ -128,7 +129,7 @@ void WavDecoder::OpenFile()
file_fd->seek(DataOffset + DataSize, SEEK_SET);
while(file_fd->read((u8 *)&LoopChunk, sizeof(SWaveChunk)) == sizeof(SWaveChunk))
{
if(LoopChunk.magicDATA == 'smpl')
if(memcmp(&LoopChunk.magicDATA, "smpl", 4) == 0)
{
file_fd->seek(-8, SEEK_CUR);
file_fd->read((u8*)&SmplChunk, sizeof(SWaveSmplChunk));

View File

@ -202,7 +202,7 @@ bool GuiSound::Load(const u8 * snd, u32 len, bool isallocated)
if(!snd)
return false;
if(!isallocated && *((u32 *) snd) == 'RIFF')
if(!isallocated && memcmp(snd, "RIFF", 4) == 0)
return LoadSoundEffect(snd, len);
sound = (u8*)snd;