-changed optimize level from -O2 to -O1 to fix some broken PNG

images
-changed list stuff a bit again, it'll take more mem now but
therefore it shouldnt slowdown when having alot of folders
@devs
-added crc32buffer, if you wanna know if the content is OK just
crc32 it :P
This commit is contained in:
fix94.1 2012-10-08 12:44:31 +00:00
parent 07bcbe3c1f
commit fb7cdc4d75
4 changed files with 27 additions and 17 deletions

View File

@ -55,7 +55,7 @@ ios := 249
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -Wall -Wextra -Wno-multichar $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
CFLAGS = -g -O1 -Wall -Wextra -Wno-multichar $(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
@ -191,56 +191,56 @@ $(BUILD)/alt_ios_gen.o: alt_ios_gen.c
#---------------------------------------------------------------------------------
%.txt.o: %.txt
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@bin2s $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o : %.jpg
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@bin2s $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o : %.png
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@bin2s $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .ogg extension
#---------------------------------------------------------------------------------
%.ogg.o : %.ogg
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@bin2s $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .wav extension
#---------------------------------------------------------------------------------
%.wav.o : %.wav
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@bin2s $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .bin extension
#---------------------------------------------------------------------------------
%.bin.o : %.bin
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@bin2s $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .dol extension
#---------------------------------------------------------------------------------
%.dol.o : %.dol
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@bin2s $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .elf extension
#---------------------------------------------------------------------------------
%.elf.o : %.elf
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@bin2s $< | $(AS) -o $(@)
-include $(DEPENDS)

View File

@ -269,6 +269,7 @@ void GetFiles(const char *Path, const vector<string>& FileTypes,
static const char *NewFileName = NULL;
static dirent *pent = NULL;
static DIR *pdir = NULL;
vector<string> SubPaths;
pdir = opendir(Path);
if(pdir == NULL)
@ -289,14 +290,8 @@ void GetFiles(const char *Path, const vector<string>& FileTypes,
AddFile(FullPathChar);
continue;
}
else if(depth < max_depth)
{
u64 currentPos = telldir(pdir);
closedir(pdir); //thanks libntfs
GetFiles(FullPathChar, FileTypes, AddFile, CompareFolders, max_depth, depth + 1);
pdir = opendir(Path);
seekdir(pdir, currentPos);
}
else if(depth < max_depth) //thanks libntfs (fail opendir) and thanks seekdir (slowass speed)
SubPaths.push_back(FullPathChar);
}
else if(pent->d_type == DT_REG)
{
@ -310,4 +305,7 @@ void GetFiles(const char *Path, const vector<string>& FileTypes,
}
}
closedir(pdir);
for(vector<string>::const_iterator p = SubPaths.begin(); p != SubPaths.end(); ++p)
GetFiles(p->c_str(), FileTypes, AddFile, CompareFolders, max_depth, depth + 1);
SubPaths.clear();
}

View File

@ -125,3 +125,14 @@ u32 crc32file(char *name)
u32 crc32 = oldcrc32 = ~oldcrc32;
return crc32;
}
u32 crc32buffer(const u8 *buffer, const u32 len)
{
u32 i;
u32 oldcrc32 = 0xFFFFFFFF;
for(i = 0; i < len; i++)
oldcrc32 = UPDC32(buffer[i], oldcrc32);
u32 crc32 = oldcrc32 = ~oldcrc32;
return crc32;
}

View File

@ -11,6 +11,7 @@ extern "C"
^ (octet)) & 0xff] ^ ((crc) >> 8))
u32 crc32file(char *name);
u32 crc32buffer(const u8 *s, const u32 len);
#ifdef __cplusplus
}