diff --git a/SConstruct b/SConstruct index 3e2aabebb7..60ebc3c41e 100644 --- a/SConstruct +++ b/SConstruct @@ -31,7 +31,7 @@ compileFlags = [ '-fno-strict-aliasing', '-msse2', '-fvisibility=hidden', - '-mstackrealign', +# '-mstackrealign', #'-fomit-frame-pointer' ] diff --git a/Source/TestSuite/Devices/Controllers/GC/Makefile b/Source/TestSuite/Devices/Controllers/GC/Makefile new file mode 100644 index 0000000000..cddbbb1275 --- /dev/null +++ b/Source/TestSuite/Devices/Controllers/GC/Makefile @@ -0,0 +1,131 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_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 := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -logc + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := + +#--------------------------------------------------------------------------------- +# 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)/$(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)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(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 +#--------------------------------------------------------------------------------- diff --git a/Source/TestSuite/Devices/Controllers/GC/source/GC.cpp b/Source/TestSuite/Devices/Controllers/GC/source/GC.cpp new file mode 100644 index 0000000000..7a056f2351 --- /dev/null +++ b/Source/TestSuite/Devices/Controllers/GC/source/GC.cpp @@ -0,0 +1,84 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +static u32* xfb = NULL; + +u32 first_frame = 1; +GXRModeObj *rmode; +vu16 oldstate; +vu16 keystate; +vu16 keydown; +vu16 keyup; +PADStatus pad[4]; + +int main() { + + VIDEO_Init(); + + rmode = VIDEO_GetPreferredMode(NULL); + + PAD_Init(); + + + xfb = (u32*)MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); + + VIDEO_Configure(rmode); + + VIDEO_SetNextFramebuffer(xfb); + + VIDEO_SetBlack(FALSE); + VIDEO_Flush(); + VIDEO_WaitVSync(); + if(rmode->viTVMode&VI_NON_INTERLACE) + VIDEO_WaitVSync(); + + + console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*2); + + + time_t gc_time; + gc_time = time(NULL); + + srand(gc_time); + + while(1) { + + gc_time = time(NULL); + VIDEO_ClearFrameBuffer(rmode, xfb, 0); + DrawPixel(0,0, 255, 0, 0); + PAD_Read(pad); + for(int a = 0; a < 4;a ++) + { + if(pad[a].err & PAD_ERR_NO_CONTROLLER) + continue; // Controller not connected + printf("pad[%d] Sticks, Main[ %d, %d ] Sub[ %d, %d ]\n", a, pad[a].stickX, pad[a].stickY, pad[a].substickX, pad[a].substickY); + printf("pad[%d] LTrigger is %s, LTrigger Analog %d\n", a, pad[a].button & PAD_TRIGGER_L ? "pressed" : "not pressed", pad[a].triggerL); + printf("pad[%d] RTrigger is %s, RTrigger Analog %d\n", a, pad[a].button & PAD_TRIGGER_R ? "pressed" : "not pressed", pad[a].triggerR); + printf("pad[%d] Trigger Z is %s\n", a, pad[a].button & PAD_TRIGGER_Z ? "pressed" : "not pressed"); + printf("pad[%d] Button A %s, Analog A %d\n", a, pad[a].button & PAD_BUTTON_A ? "pressed" : "not pressed", pad[a].analogA); + printf("pad[%d] Button B %s, Analog B %d\n", a, pad[a].button & PAD_BUTTON_B ? "pressed" : "not pressed", pad[a].analogB); + printf("pad[%d] Button X is %s\n", a, pad[a].button & PAD_BUTTON_X ? "pressed" : "not pressed"); + printf("pad[%d] Button Y is %s\n", a, pad[a].button & PAD_BUTTON_Y ? "pressed" : "not pressed"); + printf("pad[%d] Button Start is %s\n", a, pad[a].button & PAD_BUTTON_START ? "pressed" : "not pressed"); + printf("pad[%d] DPad is [up, down, left, right](%d, %d, %d, %d)\n", a, pad[a].button & PAD_BUTTON_UP ? 1 : 0, pad[a].button & PAD_BUTTON_DOWN ? 1 : 0, pad[a].button & PAD_BUTTON_LEFT ? 1 : 0, pad[a].button & PAD_BUTTON_RIGHT ? 1 : 0); + } + VIDEO_WaitVSync(); + + int buttonsDown = PAD_ButtonsDown(0); + + if (buttonsDown & PAD_BUTTON_START) { + exit(0); + } + } + +} diff --git a/Source/TestSuite/Devices/Controllers/GC/template.pnproj b/Source/TestSuite/Devices/Controllers/GC/template.pnproj new file mode 100644 index 0000000000..c22af0293b --- /dev/null +++ b/Source/TestSuite/Devices/Controllers/GC/template.pnproj @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Source/TestSuite/Devices/Controllers/GC/template.pnps b/Source/TestSuite/Devices/Controllers/GC/template.pnps new file mode 100644 index 0000000000..6450388d77 --- /dev/null +++ b/Source/TestSuite/Devices/Controllers/GC/template.pnps @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Source/TestSuite/Devices/Controllers/Makefile b/Source/TestSuite/Devices/Controllers/Makefile new file mode 100644 index 0000000000..3a6fe744eb --- /dev/null +++ b/Source/TestSuite/Devices/Controllers/Makefile @@ -0,0 +1,8 @@ +SUBDIRS:= `ls | egrep -v '^(CVS)$$'` + +all: + @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done; + +clean: + @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done; + diff --git a/Source/TestSuite/Devices/Makefile b/Source/TestSuite/Devices/Makefile index cddbbb1275..3a6fe744eb 100644 --- a/Source/TestSuite/Devices/Makefile +++ b/Source/TestSuite/Devices/Makefile @@ -1,131 +1,8 @@ -#--------------------------------------------------------------------------------- -# Clear the implicit built in rules -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- -ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif - -include $(DEVKITPPC)/gamecube_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 := $(notdir $(CURDIR)) -BUILD := build -SOURCES := source -DATA := data -INCLUDES := - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- - -CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -CXXFLAGS = $(CFLAGS) - -LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map - -#--------------------------------------------------------------------------------- -# any extra libraries we wish to link with the project -#--------------------------------------------------------------------------------- -LIBS := -logc - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := - -#--------------------------------------------------------------------------------- -# 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)/$(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)/$(TARGET) -.PHONY: $(BUILD) clean - -#--------------------------------------------------------------------------------- -$(BUILD): - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile - -#--------------------------------------------------------------------------------- -clean: - @echo clean ... - @rm -fr $(BUILD) $(OUTPUT).elf $(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 -#--------------------------------------------------------------------------------- +SUBDIRS:= `ls | egrep -v '^(CVS)$$'` + +all: + @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done; + +clean: + @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done; + diff --git a/Source/TestSuite/Devices/MemCard/Makefile b/Source/TestSuite/Devices/MemCard/Makefile new file mode 100644 index 0000000000..cddbbb1275 --- /dev/null +++ b/Source/TestSuite/Devices/MemCard/Makefile @@ -0,0 +1,131 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_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 := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -logc + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := + +#--------------------------------------------------------------------------------- +# 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)/$(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)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(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 +#--------------------------------------------------------------------------------- diff --git a/Source/TestSuite/Devices/source/First.cpp b/Source/TestSuite/Devices/MemCard/source/First.cpp similarity index 100% rename from Source/TestSuite/Devices/source/First.cpp rename to Source/TestSuite/Devices/MemCard/source/First.cpp diff --git a/Source/TestSuite/Devices/MemCard/template.pnproj b/Source/TestSuite/Devices/MemCard/template.pnproj new file mode 100644 index 0000000000..c22af0293b --- /dev/null +++ b/Source/TestSuite/Devices/MemCard/template.pnproj @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Source/TestSuite/Devices/MemCard/template.pnps b/Source/TestSuite/Devices/MemCard/template.pnps new file mode 100644 index 0000000000..6450388d77 --- /dev/null +++ b/Source/TestSuite/Devices/MemCard/template.pnps @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Source/TestSuite/Misc/Time/Makefile b/Source/TestSuite/Misc/Time/Makefile new file mode 100644 index 0000000000..8cde430ac6 --- /dev/null +++ b/Source/TestSuite/Misc/Time/Makefile @@ -0,0 +1,130 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_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 := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := + +#--------------------------------------------------------------------------------- +# 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)/$(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)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(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 +#--------------------------------------------------------------------------------- diff --git a/Source/TestSuite/Misc/Time/source/Time.cpp b/Source/TestSuite/Misc/Time/source/Time.cpp new file mode 100644 index 0000000000..046fcc6a4c --- /dev/null +++ b/Source/TestSuite/Misc/Time/source/Time.cpp @@ -0,0 +1,55 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +static void *xfb = NULL; + +u32 first_frame = 1; +GXRModeObj *rmode; + + +int main() { + + VIDEO_Init(); + + rmode = VIDEO_GetPreferredMode(NULL); + + + xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); + + VIDEO_Configure(rmode); + + VIDEO_SetNextFramebuffer(xfb); + + VIDEO_SetBlack(FALSE); + VIDEO_Flush(); + VIDEO_WaitVSync(); + if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); + + + console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*2); + + + time_t gc_time; + gc_time = time(NULL); + + srand(gc_time); + + while(1) { + + gc_time = time(NULL); + printf("\x1b[10;0HRTC time is %s ",ctime(&gc_time)); + + VIDEO_WaitVSync(); + } + +} diff --git a/Source/TestSuite/Misc/Time/template.pnproj b/Source/TestSuite/Misc/Time/template.pnproj new file mode 100644 index 0000000000..c22af0293b --- /dev/null +++ b/Source/TestSuite/Misc/Time/template.pnproj @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Source/TestSuite/Misc/Time/template.pnps b/Source/TestSuite/Misc/Time/template.pnps new file mode 100644 index 0000000000..6450388d77 --- /dev/null +++ b/Source/TestSuite/Misc/Time/template.pnps @@ -0,0 +1 @@ + \ No newline at end of file