diff --git a/Makefile.gc b/Makefile.gc index ccb4b91..8b21554 100644 --- a/Makefile.gc +++ b/Makefile.gc @@ -4,7 +4,7 @@ .SUFFIXES: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") endif include $(DEVKITPPC)/gamecube_rules @@ -17,11 +17,10 @@ DKV := $(shell $(DEVKITPPC)/bin/$(CC) --version | sed 's/^.*(devkitPPC release # SOURCES is a list of directories containing source code # INCLUDES is a list of directories containing extra header files #--------------------------------------------------------------------------------- -#TARGET := $(notdir $(CURDIR)) TARGET := gcmm_GC BUILD := build_GC SOURCES := source -DATA := data +DATA := data INCLUDES := #--------------------------------------------------------------------------------- @@ -36,7 +35,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lfat -logc -lm -lfreetype -lz +LIBS := -lfat -logc `freetype-config --libs` -lz -lm #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing @@ -76,24 +75,25 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC) \ - -I$(PORTLIBS)/include/freetype2 + `freetype-config --cflags` #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(LIBOGC_LIB) +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean @@ -101,7 +101,7 @@ export OUTPUT := $(CURDIR)/$(TARGET) #--------------------------------------------------------------------------------- $(BUILD): @[ -d $@ ] || mkdir -p $@ - @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.gc + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.gc #--------------------------------------------------------------------------------- clean: @@ -128,10 +128,12 @@ DEPENDS := $(OFILES:.o=.d) $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension #--------------------------------------------------------------------------------- -%.jpg.o : %.jpg +%.jpg.o %_jpg.h : %.jpg #--------------------------------------------------------------------------------- @echo $(notdir $<) $(bin2o) diff --git a/Makefile.wii b/Makefile.wii index 20e40a2..6c86edc 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -4,7 +4,7 @@ .SUFFIXES: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") endif include $(DEVKITPPC)/wii_rules @@ -17,11 +17,10 @@ DKV := $(shell $(DEVKITPPC)/bin/$(CC) --version | sed 's/^.*(devkitPPC release # SOURCES is a list of directories containing source code # INCLUDES is a list of directories containing extra header files #--------------------------------------------------------------------------------- -#TARGET := $(notdir $(CURDIR)) TARGET := gcmm_WII BUILD := build_WII SOURCES := source -DATA := data +DATA := data INCLUDES := #--------------------------------------------------------------------------------- @@ -36,7 +35,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwiiuse -lbte -lfat -logc -lm -lfreetype -lz +LIBS := -lwiiuse -lbte -lfat -logc `freetype-config --libs` -lz -lm #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing @@ -76,24 +75,25 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC) \ - -I$(PORTLIBS)/include/freetype2 + `freetype-config --cflags` #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(LIBOGC_LIB) +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean @@ -101,7 +101,7 @@ export OUTPUT := $(CURDIR)/$(TARGET) #--------------------------------------------------------------------------------- $(BUILD): @[ -d $@ ] || mkdir -p $@ - @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.wii + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.wii #--------------------------------------------------------------------------------- clean: @@ -112,6 +112,7 @@ clean: run: wiiload $(TARGET).dol + #--------------------------------------------------------------------------------- else @@ -123,10 +124,12 @@ DEPENDS := $(OFILES:.o=.d) $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension #--------------------------------------------------------------------------------- -%.jpg.o : %.jpg +%.jpg.o %_jpg.h : %.jpg #--------------------------------------------------------------------------------- @echo $(notdir $<) $(bin2o) diff --git a/source/mcard.c b/source/mcard.c index ef50ae4..5132681 100644 --- a/source/mcard.c +++ b/source/mcard.c @@ -959,7 +959,7 @@ s32 FZEROGX_MakeSaveGameValid(s32 chn) u32 serial1,serial2; u16 chksum = 0xFFFF; - if(stricmp(&FileBuffer[0x08],"f_zero.dat")!=0) return CARD_ERROR_READY; // check for F-Zero GX system file + if(strcasecmp(&FileBuffer[0x08],"f_zero.dat")!=0) return CARD_ERROR_READY; // check for F-Zero GX system file if((ret=CARD_GetSerialNo(chn,&serial1,&serial2))<0) return ret; // get encrypted destination memory card serial numbers *(u16*)&FileBuffer[0x2066+MCDATAOFFSET] = serial1 >> 16; // set new serial numbers @@ -998,12 +998,12 @@ s32 PSO_MakeSaveGameValid(s32 chn) u32 serial1,serial2; u32 pso3offset; - if(stricmp(&FileBuffer[0x08],"PSO_SYSTEM")==0) { // check for PSO1&2 system file + if(strcasecmp(&FileBuffer[0x08],"PSO_SYSTEM")==0) { // check for PSO1&2 system file pso3offset = 0x00; goto exit; } - if(stricmp(&FileBuffer[0x08],"PSO3_SYSTEM")==0) { // check for PSO3 system file + if(strcasecmp(&FileBuffer[0x08],"PSO3_SYSTEM")==0) { // check for PSO3 system file pso3offset = 0x10; // PSO3 data block size adjustment goto exit; }