diff --git a/.github/workflows/push_image.yml b/.github/workflows/push_image.yml new file mode 100644 index 0000000..c6f2f7e --- /dev/null +++ b/.github/workflows/push_image.yml @@ -0,0 +1,26 @@ +name: Publish Docker Image +on: + push: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Get release version + id: get_release_tag + run: | + echo RELEASE_VERSION=$(echo $(date '+%Y%m%d')) >> $GITHUB_ENV + echo REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV + echo REPOSITORY_OWNER=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}' | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: ${{ env.REPOSITORY_OWNER }}/${{ env.REPOSITORY_NAME }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + snapshot: true + cache: true + tags: "latest, ${{ env.RELEASE_VERSION }}" + dockerfile: Dockerfile.wiiu \ No newline at end of file diff --git a/.gitignore b/.gitignore index c71294d..1538e10 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ distribute gba/include libogc/include nds/include -gp2x/include \ No newline at end of file +gp2x/include +wiiu/wiiu_release +wiiu/lib diff --git a/Dockerfile.wiiu b/Dockerfile.wiiu new file mode 100644 index 0000000..d922d90 --- /dev/null +++ b/Dockerfile.wiiu @@ -0,0 +1,11 @@ +FROM wiiuenv/devkitppc:20200810 + +COPY --from=wiiuenv/libiosuhax:20200812 /artifacts $DEVKITPRO + +WORKDIR tmp_build +COPY . . +RUN make include/libfatversion.h && cd wiiu && make clean && make && mkdir -p /artifacts/wut/usr && cp -r lib /artifacts/wut/usr && cp -r ../include /artifacts/wut/usr +WORKDIR /artifacts + +FROM scratch +COPY --from=0 /artifacts /artifacts \ No newline at end of file diff --git a/Makefile b/Makefile index 2fa5f7a..ea04585 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,9 @@ cube-release: include/libfatversion.h wii-release: include/libfatversion.h $(MAKE) -C libogc PLATFORM=wii BUILD=wii_release + +wiiu-release: include/libfatversion.h + $(MAKE) -C wiiu BUILD=wiiu_release gp2x-release: include/libfatversion.h $(MAKE) -C gp2x PLATFORM=gp2x BUILD=gp2x_release @@ -50,6 +53,9 @@ cube-debug: include/libfatversion.h wii-debug: include/libfatversion.h $(MAKE) -C libogc PLATFORM=wii BUILD=cube_debug + +wiiu-debug: include/libfatversion.h + $(MAKE) -C wiiu BUILD=wiiu_debug gp2x-debug: include/libfatversion.h $(MAKE) -C gp2x BUILD=debug @@ -67,6 +73,9 @@ ogc-clean: gp2x-clean: $(MAKE) -C gp2x clean + +wiiu-clean: + $(MAKE) -C wiiu clean dist-bin: nds-dist-bin gba-dist-bin ogc-dist-bin gp2x-dist-bin @@ -120,3 +129,6 @@ ogc-install: cube-release wii-release gp2x-install: gp2x-release $(MAKE) -C gp2x install + +wiiu-install: wiiu-release + $(MAKE) -C wiiu install diff --git a/include/fat.h b/include/fat.h index 7d828f6..68761d8 100644 --- a/include/fat.h +++ b/include/fat.h @@ -52,6 +52,8 @@ extern "C" { #else # ifdef NDS # include +# elif defined(__WIIU__) +# include # else # include # endif diff --git a/source/common.h b/source/common.h index d5a58f6..e1cb946 100644 --- a/source/common.h +++ b/source/common.h @@ -55,6 +55,12 @@ #elif defined(GP2X) #include #include +#elif defined(__WIIU__) + #include + typedef uint8_t u8; + typedef uint16_t u16; + typedef int32_t s32; + typedef uint32_t u32; #endif // Platform specific options @@ -79,6 +85,9 @@ #elif defined (GP2X) #define DEFAULT_CACHE_PAGES 16 #define DEFAULT_SECTORS_PAGE 8 +#elif defined (__WIIU__) + #define DEFAULT_CACHE_PAGES 4 + #define DEFAULT_SECTORS_PAGE 64 #endif #endif // _COMMON_H diff --git a/source/disc.c b/source/disc.c index f923fd0..a69b872 100755 --- a/source/disc.c +++ b/source/disc.c @@ -38,8 +38,25 @@ is available, wrapper functions are used. The list is terminated by a NULL/NULL entry. */ +/* ====================== Wii U ====================== */ +#if defined (__WIIU__) +#include + +static const DISC_INTERFACE* get_io_wiiu_sd (void) { + return &IOSUHAX_sdio_disc_interface; +} + +static const DISC_INTERFACE* get_io_wiiu_usb (void) { + return &IOSUHAX_usb_disc_interface; +} + +const INTERFACE_ID _FAT_disc_interfaces[] = { + {"sd", get_io_wiiu_sd}, + {"usb", get_io_wiiu_usb}, + {NULL, NULL} +}; /* ====================== Wii ====================== */ -#if defined (__wii__) +#elif defined (__wii__) #include #include #include diff --git a/wiiu/.gitignore b/wiiu/.gitignore new file mode 100644 index 0000000..b46a74d --- /dev/null +++ b/wiiu/.gitignore @@ -0,0 +1 @@ +release/* \ No newline at end of file diff --git a/wiiu/Makefile b/wiiu/Makefile new file mode 100644 index 0000000..0bd25d2 --- /dev/null +++ b/wiiu/Makefile @@ -0,0 +1,133 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") +endif + +include $(DEVKITPRO)/wut/share/wut_rules + +#--------------------------------------------------------------------------------- +# 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 +# DATA is a list of directories containing binary files +# LIB is where the built library will be placed +# all directories are relative to this makefile +#--------------------------------------------------------------------------------- +BUILD ?= release +SOURCES := ../source source +INCLUDES := ../include +DATA := +LIB := $(TOPDIR)/wiiu/lib + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +CFLAGS := -g -Wall -O2 -ffunction-sections \ + $(MACHDEP) + +CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ + +CXXFLAGS := $(CFLAGS) + +ASFLAGS := -g $(ARCH) +LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) + +ifneq ($(BUILD),debug) +export WIIUBIN := $(LIB)/libfat.a +else +export WIIUBIN := $(LIB)/libfatd.a +CFLAGS += -DFAT_DEBUG +endif + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(WUT_ROOT)/usr + +#--------------------------------------------------------------------------------- +# 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 TOPDIR ?= $(CURDIR)/.. + + +export DEPSDIR := $(CURDIR)/$(BUILD) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + + +export OFILES := $(addsuffix .o,$(BINFILES)) \ + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr debug release $(LIB) include + +all: $(WIIUBIN) + +dist-bin: + @mkdir -p include + @cp $(TOPDIR)/include/fat.h $(TOPDIR)/include/libfatversion.h include + @tar --exclude=.svn --exclude=*CVS* -cvjf $(TOPDIR)/distribute/$(VERSTRING)/libfat-nds-$(VERSTRING).tar.bz2 include lib + +install: + @mkdir -p $(DESTDIR)$(WUT_ROOT)/usr/lib + @mkdir -p $(DESTDIR)$(WUT_ROOT)/usr/include + @cp -v lib/libfat.a $(DESTDIR)$(WUT_ROOT)/usr/lib + @cp -v $(TOPDIR)/include/fat.h $(TOPDIR)/include/libfatversion.h $(DESTDIR)$(WUT_ROOT)/usr/include + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(WIIUBIN) : $(OFILES) $(LIB) + @rm -f "$(WIIUBIN)" + @$(AR) rcs "$(WIIUBIN)" $(OFILES) + @echo built ... $(notdir $@) + +$(LIB): + mkdir $(LIB) + + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- +