It should compile now!

This commit is contained in:
dborth 2008-09-14 21:03:59 +00:00
parent 9644c251ef
commit 5aa3368a51
8 changed files with 2902 additions and 2955 deletions

190
Makefile
View File

@ -1,183 +1,23 @@
#--------------------------------------------------------------------------------- .PHONY = all wii gc wii-clean gc-clean wii-run gc-run
# Generic makefile for Gamecube projects
#
# Tab stops set to 4
# | | | |
# 0 1 2 3
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
HAVEDIST := $(wildcard w) all: wii gc
#--------------------------------------------------------------------------------- clean: wii-clean gc-clean
# TARGET is the name of the output
# 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
#---------------------------------------------------------------------------------
TARGET := vba172
BUILD := build
SOURCES := src/gb src src/fileio src/ngc
INCLUDES = -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libfat/libogc/include src/gb src src/fileio src/ngc
LIBPATHS = -L$(DEVKITPRO)/libogc/lib/wii -L$(DEVKITPRO)/libfat/libogc/lib/wii
#--------------------------------------------------------------------------------- wii:
# options for code generation $(MAKE) -f Makefile.wii
#---------------------------------------------------------------------------------
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -meabi \
-DWORDS_BIGENDIAN -DPACKAGE=\"VisualBoyAdvance\" \
-DVERSION=\"1.7.2\" -DC_CORE -DHAVE_ZUTIL_H \
-DCHANFFS -DSDL -DWII_BUILD
LDFLAGS = $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map -Wl,--cref
PREFIX := powerpc-gekko-
#export PATH:=/c/devkitPPC_r11/bin:/bin wii-clean:
$(MAKE) -f Makefile.wii clean
#--------------------------------------------------------------------------------- wii-run:
# any extra libraries we wish to link with $(MAKE) -f Makefile.wii run
#---------------------------------------------------------------------------------
LIBS := -lm -lz -lfat -ldb -lwiiuse -lbte -logc
#--------------------------------------------------------------------------------- gc:
# no real need to edit anything past this point unless you need to add additional $(MAKE) -f Makefile.gc
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export CC := $(PREFIX)gcc gc-clean:
export CXX := $(PREFIX)g++ $(MAKE) -f Makefile.gc clean
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
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)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) gc-run:
$(MAKE) -f Makefile.gc run
#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) *.elf
#---------------------------------------------------------------------------------
run:
psoload $(TARGET).dol
#---------------------------------------------------------------------------------
reload:
psoload -r $(TARGET).dol
#---------------------------------------------------------------------------------
dist:
@echo Files : $(HAVEDIST)
ifeq ($(strip $(HAVEDIST)),)
rule:
@echo "No file"
else
rule2: A
@echo "Have File"
endif
bindist:
@[ -f $(TARGET).7z ] || rm $(TARGET).7z 2>/dev/null
@7z a -mx=9 -m0=lzma $(TARGET).7z $(TARGET).dol
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
@echo "Output ... "$(notdir $@)
@$(OBJCOPY) -O binary $< $@
#---------------------------------------------------------------------------------
$(OUTPUT).elf: $(OFILES)
@echo "Linking ... "$(notdir $@)
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
#---------------------------------------------------------------------------------
# Compile Targets for C/C++
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
%.o : %.cpp
@echo Compiling ... $(notdir $<)
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
#---------------------------------------------------------------------------------
%.o : %.c
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
#---------------------------------------------------------------------------------
%.o : %.S
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
#---------------------------------------------------------------------------------
%.o : %.s
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
#---------------------------------------------------------------------------------
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
cp $(<) $(*).tmp
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
--rename-section .data=.rodata,readonly,data,contents,alloc \
--redefine-sym _binary_$*_tmp_start=$*\
--redefine-sym _binary_$*_tmp_end=$*_end\
--redefine-sym _binary_$*_tmp_size=$*_size\
$(*).tmp $(@)
echo "extern const u8" $(*)"[];" > $(*).h
echo "extern const u32" $(*)_size[]";" >> $(*).h
rm $(*).tmp
endef
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

View File

@ -1,15 +1,13 @@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Generic makefile for Gamecube projects
#
# Tab stops set to 4
# | | | |
# 0 1 2 3
#---------------------------------------------------------------------------------
# Clear the implicit built in rules # Clear the implicit built in rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
HAVEDIST := $(wildcard w) include $(DEVKITPPC)/gamecube_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output
@ -17,29 +15,33 @@ HAVEDIST := $(wildcard w)
# SOURCES is a list of directories containing source code # SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files # INCLUDES is a list of directories containing extra header files
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
TARGET := vba172 TARGET := vba172_gc
BUILD := build TARGETDIR := executables
BUILD := build_gc
SOURCES := src/gb src src/fileio src/ngc SOURCES := src/gb src src/fileio src/ngc
INCLUDES = -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libfat/libogc/include src/gb src src/fileio src/ngc INCLUDES := src/gb src src/fileio src/ngc
LIBPATHS = -L$(DEVKITPRO)/libogc/lib/cube -L$(DEVKITPRO)/libfat/libogc/lib/cube
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -meabi \ CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) -meabi \
-DWORDS_BIGENDIAN -DPACKAGE=\"VisualBoyAdvance\" \ -DNGC -DWORDS_BIGENDIAN -DPACKAGE=\"VisualBoyAdvance\" \
-DVERSION=\"1.7.2\" -DC_CORE -DHAVE_ZUTIL_H \ -DVERSION=\"1.7.2\" -DC_CORE \
-DCHANFFS -DSDL -DGC_BUILD -DCHANFFS -DSDL -DNO_DEFLATE
LDFLAGS = $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map -Wl,--cref CXXFLAGS = $(CFLAGS)
PREFIX := powerpc-gekko- LDFLAGS = $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map -Wl,--cref
#export PATH:=/c/devkitPPC_r11/bin:/bin
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# any extra libraries we wish to link with # any extra libraries we wish to link with
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
LIBS := -logc -lz -lm -lfat -logc -lz -lm LIBS := -lm -lz -lfat -ldb -logc
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional # no real need to edit anything past this point unless you need to add additional
@ -47,13 +49,14 @@ LIBS := -logc -lz -lm -lfat -logc -lz -lm
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR))) ifneq ($(BUILD),$(notdir $(CURDIR)))
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export CC := $(PREFIX)gcc export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export OBJCOPY := $(PREFIX)objcopy $(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# automatically build a list of object files for our project # automatically build a list of object files for our project
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -61,6 +64,8 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C # use CXX for linking C++ projects, CC for standard C
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@ -70,54 +75,47 @@ else
export LD := $(CXX) export LD := $(CXX)
endif endif
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# build a list of include paths # build a list of include paths
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) -I$(CURDIR)/$(BUILD) \
-I$(LIBOGC_INC)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# build a list of library paths # build a list of library paths
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET) export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
.PHONY: $(BUILD) clean .PHONY: $(BUILD) clean
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
$(BUILD): $(BUILD):
@[ -d $@ ] || mkdir $@ @[ -d $@ ] || mkdir -p $@
@[ -d $(TARGETDIR) ] || mkdir -p $(TARGETDIR)
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.gc @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.gc
@rm -fr $(OUTPUT).elf
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
clean: clean:
@echo clean ... @echo clean ...
@rm -fr $(BUILD) *.elf @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
run: run:
psoload $(TARGET).dol psoload $(OUTPUT).dol
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
reload: reload:
psoload -r $(TARGET).dol psoload -r $(OUTPUT).dol
#---------------------------------------------------------------------------------
dist:
@echo Files : $(HAVEDIST)
ifeq ($(strip $(HAVEDIST)),)
rule:
@echo "No file"
else
rule2: A
@echo "Have File"
endif
bindist:
@[ -f $(TARGET).7z ] || rm $(TARGET).7z 2>/dev/null
@7z a -mx=9 -m0=lzma $(TARGET).7z $(TARGET).dol
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
else else
@ -128,53 +126,15 @@ DEPENDS := $(OFILES:.o=.d)
# main targets # main targets
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).dol: $(OUTPUT).elf
@echo "Output ... "$(notdir $@)
@$(OBJCOPY) -O binary $< $@
#---------------------------------------------------------------------------------
$(OUTPUT).elf: $(OFILES) $(OUTPUT).elf: $(OFILES)
@echo "Linking ... "$(notdir $@)
@$(LD) $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Compile Targets for C/C++ # This rule links in binary data with the .jpg extension
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
%.jpg.o : %.jpg
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
%.o : %.cpp @echo $(notdir $<)
@echo Compiling ... $(notdir $<) $(bin2o)
@$(CXX) -MMD $(CFLAGS) -o $@ -c $<
#---------------------------------------------------------------------------------
%.o : %.c
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -o $@ -c $<
#---------------------------------------------------------------------------------
%.o : %.S
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
#---------------------------------------------------------------------------------
%.o : %.s
@echo Compiling ... $(notdir $<)
@$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@
#---------------------------------------------------------------------------------
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
cp $(<) $(*).tmp
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
--rename-section .data=.rodata,readonly,data,contents,alloc \
--redefine-sym _binary_$*_tmp_start=$*\
--redefine-sym _binary_$*_tmp_end=$*_end\
--redefine-sym _binary_$*_tmp_size=$*_size\
$(*).tmp $(@)
echo "extern const u8" $(*)"[];" > $(*).h
echo "extern const u32" $(*)_size[]";" >> $(*).h
rm $(*).tmp
endef
-include $(DEPENDS) -include $(DEPENDS)

143
Makefile.wii Normal file
View File

@ -0,0 +1,143 @@
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
include $(DEVKITPPC)/wii_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# 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
#---------------------------------------------------------------------------------
TARGET := vba172_wii
TARGETDIR := executables
BUILD := build_wii
SOURCES := src/gb src src/fileio src/ngc
INCLUDES := src/gb src src/fileio src/ngc
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
MACHDEP = -DGEKKO -mcpu=750 -meabi -mhard-float
CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) -meabi \
-DNGC -DWORDS_BIGENDIAN -DPACKAGE=\"VisualBoyAdvance\" \
-DVERSION=\"1.7.2\" -DC_CORE \
-DCHANFFS -DSDL -DWII_BUILD -DNO_DEFLATE
CXXFLAGS = $(CFLAGS)
LDFLAGS = $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map -Wl,--cref
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with
#---------------------------------------------------------------------------------
LIBS := -lm -lz -lfat -ldb -lwiiuse -lbte -logc
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR)
#---------------------------------------------------------------------------------
# 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 OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
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)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(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) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) \
-I$(LIBOGC_INC)
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@[ -d $(TARGETDIR) ] || mkdir -p $(TARGETDIR)
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.wii
@rm -fr $(OUTPUT).elf
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
run:
wiiload $(OUTPUT).dol
#---------------------------------------------------------------------------------
reload:
wiiload -r $(OUTPUT).dol
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o : %.jpg
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

View File

@ -40,7 +40,6 @@ extern "C"
#include "RTC.h" #include "RTC.h"
#include "Port.h" #include "Port.h"
extern "C" extern "C"
{ {
#include "memgzio.h" #include "memgzio.h"
@ -1104,7 +1103,7 @@ gzFile utilGzOpen(const char *file, const char *mode)
gzFile utilMemGzOpen(char *memory, int available, char *mode) gzFile utilMemGzOpen(char *memory, int available, char *mode)
{ {
utilGzWriteFunc = memgzwrite; // utilGzWriteFunc = memgzwrite;
utilGzReadFunc = memgzread; utilGzReadFunc = memgzread;
utilGzCloseFunc = memgzclose; utilGzCloseFunc = memgzclose;

View File

@ -10,7 +10,7 @@
*/ */
/* @(#) $Id: memgzio.c,v 1.3 2004/01/17 23:07:32 kxu Exp $ */ /* @(#) $Id: memgzio.c,v 1.3 2004/01/17 23:07:32 kxu Exp $ */
#include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
@ -70,15 +70,15 @@ typedef struct mem_stream
mem_stream; mem_stream;
local gzFile gz_open OF((char *memory, const int available, const char *mode)); gzFile gz_open OF((char *memory, const int available, const char *mode));
local int do_flush OF((gzFile file, int flush)); int do_flush OF((gzFile file, int flush));
local int get_byte OF((mem_stream *s)); int get_byte OF((mem_stream *s));
local void check_header OF((mem_stream *s)); void check_header OF((mem_stream *s));
local int destroy OF((mem_stream *s)); int destroy OF((mem_stream *s));
local void putLong OF((MEMFILE *file, uLong x)); void putLong OF((MEMFILE *file, uLong x));
local uLong getLong OF((mem_stream *s)); uLong getLong OF((mem_stream *s));
local MEMFILE *memOpen(char *memory, int available, char mode) MEMFILE *memOpen(char *memory, int available, char mode)
{ {
MEMFILE *f; MEMFILE *f;
@ -119,7 +119,7 @@ local MEMFILE *memOpen(char *memory, int available, char mode)
return f; return f;
} }
local size_t memWrite(const void *buffer, size_t size, size_t count, size_t memWrite(const void *buffer, size_t size, size_t count,
MEMFILE *file) MEMFILE *file)
{ {
size_t total = size*count; size_t total = size*count;
@ -140,7 +140,7 @@ local size_t memWrite(const void *buffer, size_t size, size_t count,
return total; return total;
} }
local size_t memRead(void *buffer, size_t size, size_t count, size_t memRead(void *buffer, size_t size, size_t count,
MEMFILE *file) MEMFILE *file)
{ {
size_t total = size*count; size_t total = size*count;
@ -164,7 +164,7 @@ local size_t memRead(void *buffer, size_t size, size_t count,
return total; return total;
} }
local int memPutc(int c, MEMFILE *file) int memPutc(int c, MEMFILE *file)
{ {
if(file->mode != 'w') if(file->mode != 'w')
{ {
@ -183,17 +183,17 @@ local int memPutc(int c, MEMFILE *file)
return c; return c;
} }
local long memTell(MEMFILE *f) long memTell(MEMFILE *f)
{ {
return (f->next - f->memory) - 8; return (f->next - f->memory) - 8;
} }
local int memError(MEMFILE *f) int memError(MEMFILE *f)
{ {
return f->error; return f->error;
} }
local int memClose(MEMFILE *f) int memClose(MEMFILE *f)
{ {
if(f->mode == 'w') if(f->mode == 'w')
{ {
@ -203,7 +203,7 @@ local int memClose(MEMFILE *f)
return 0; return 0;
} }
local int memPrintf(MEMFILE *f, const char *format, ...) int memPrintf(MEMFILE *f, const char *format, ...)
{ {
char buffer[80]; char buffer[80];
va_list list; va_list list;
@ -225,7 +225,7 @@ local int memPrintf(MEMFILE *f, const char *format, ...)
can be checked to distinguish the two cases (if errno is zero, the can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR). zlib error is Z_MEM_ERROR).
*/ */
local gzFile gz_open (memory, available, mode) gzFile gz_open (memory, available, mode)
char *memory; char *memory;
const int available; const int available;
const char *mode; const char *mode;
@ -313,7 +313,7 @@ const char *mode;
} }
s->stream.avail_out = Z_BUFSIZE; s->stream.avail_out = Z_BUFSIZE;
errno = 0; //errno = 0;
s->file = memOpen(memory, available, s->mode); s->file = memOpen(memory, available, s->mode);
if (s->file == NULL) if (s->file == NULL)
@ -325,8 +325,8 @@ const char *mode;
{ {
/* Write a very simple .gz header: /* Write a very simple .gz header:
*/ */
memPrintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], //memPrintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); // Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
s->startpos = 10L; s->startpos = 10L;
/* We use 10L instead of ftell(s->file) to because ftell causes an /* We use 10L instead of ftell(s->file) to because ftell causes an
* fflush on some systems. This version of the library doesn't use * fflush on some systems. This version of the library doesn't use
@ -359,13 +359,13 @@ const char *mode;
for end of file. for end of file.
IN assertion: the stream s has been sucessfully opened for reading. IN assertion: the stream s has been sucessfully opened for reading.
*/ */
local int get_byte(s) int get_byte(s)
mem_stream *s; mem_stream *s;
{ {
if (s->z_eof) return EOF; if (s->z_eof) return EOF;
if (s->stream.avail_in == 0) if (s->stream.avail_in == 0)
{ {
errno = 0; // errno = 0;
s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file); s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) if (s->stream.avail_in == 0)
{ {
@ -388,7 +388,7 @@ mem_stream *s;
s->stream.avail_in is zero for the first time, but may be non-zero s->stream.avail_in is zero for the first time, but may be non-zero
for concatenated .gz files. for concatenated .gz files.
*/ */
local void check_header(s) void check_header(s)
mem_stream *s; mem_stream *s;
{ {
int method; /* method byte */ int method; /* method byte */
@ -449,7 +449,7 @@ mem_stream *s;
* Cleanup then free the given mem_stream. Return a zlib error code. * Cleanup then free the given mem_stream. Return a zlib error code.
Try freeing in the reverse order of allocations. Try freeing in the reverse order of allocations.
*/ */
local int destroy (s) int destroy (s)
mem_stream *s; mem_stream *s;
{ {
int err = Z_OK; int err = Z_OK;
@ -520,7 +520,7 @@ unsigned len;
if (n > s->stream.avail_out) n = s->stream.avail_out; if (n > s->stream.avail_out) n = s->stream.avail_out;
if (n > 0) if (n > 0)
{ {
zmemcpy(s->stream.next_out, s->stream.next_in, n); // zmemcpy(s->stream.next_out, s->stream.next_in, n);
next_out += n; next_out += n;
s->stream.next_out = next_out; s->stream.next_out = next_out;
s->stream.next_in += n; s->stream.next_in += n;
@ -541,7 +541,7 @@ unsigned len;
if (s->stream.avail_in == 0 && !s->z_eof) if (s->stream.avail_in == 0 && !s->z_eof)
{ {
errno = 0; // errno = 0;
s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file); s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) if (s->stream.avail_in == 0)
{ {
@ -637,7 +637,7 @@ unsigned len;
Flushes all pending output into the compressed file. The parameter Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function. flush is as in the deflate() function.
*/ */
local int do_flush (file, flush) int do_flush (file, flush)
gzFile file; gzFile file;
int flush; int flush;
{ {
@ -682,7 +682,7 @@ int flush;
/* =========================================================================== /* ===========================================================================
Outputs a long in LSB order to the given file Outputs a long in LSB order to the given file
*/ */
local void putLong (file, x) void putLong (file, x)
MEMFILE *file; MEMFILE *file;
uLong x; uLong x;
{ {
@ -698,7 +698,7 @@ uLong x;
Reads a long in LSB order from the given mem_stream. Sets z_err in case Reads a long in LSB order from the given mem_stream. Sets z_err in case
of error. of error.
*/ */
local uLong getLong (s) uLong getLong (s)
mem_stream *s; mem_stream *s;
{ {
uLong x = (uLong)get_byte(s); uLong x = (uLong)get_byte(s);
@ -719,7 +719,7 @@ mem_stream *s;
int ZEXPORT memgzclose (file) int ZEXPORT memgzclose (file)
gzFile file; gzFile file;
{ {
int err; // int err;
mem_stream *s = (mem_stream*)file; mem_stream *s = (mem_stream*)file;
if (s == NULL) return Z_STREAM_ERROR; if (s == NULL) return Z_STREAM_ERROR;

View File

@ -8,14 +8,19 @@
/* memgzio.c - IO on .gz files in memory /* memgzio.c - IO on .gz files in memory
* Adapted from original gzio.c from zlib library by Forgotten * Adapted from original gzio.c from zlib library by Forgotten
*/ */
/*
#ifndef HAVE_ZUTIL_H #ifndef HAVE_ZUTIL_H
#include "../win32/include/zlib/zutil.h" #include "../win32/include/zlib/zutil.h"
#else #else
#include <zutil.h> #include <zutil.h>
#endif #endif
*/
#include <zlib.h>
gzFile ZEXPORT memgzopen(char *memory, int, const char *); gzFile ZEXPORT memgzopen(char *memory, int, const char *);
int ZEXPORT memgzread(gzFile, voidp, unsigned); int ZEXPORT memgzread(gzFile, voidp, unsigned);
int ZEXPORT memgzwrite(gzFile, const voidp, unsigned); int ZEXPORT memgzwrite(gzFile, const voidp, unsigned);
int ZEXPORT memgzclose(gzFile); int ZEXPORT memgzclose(gzFile);
long ZEXPORT memtell(gzFile); long ZEXPORT memtell(gzFile);

View File

@ -66,7 +66,7 @@ extern "C"
#endif #endif
#ifndef _ZLIB_H #ifndef _ZLIB_H
#include "zlib.h" #include <zlib.h>
#endif #endif
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)