From 1e8d70119b4ccb871db1e641bf201adee4752207 Mon Sep 17 00:00:00 2001 From: Maschell Date: Tue, 26 Jul 2022 16:27:20 +0200 Subject: [PATCH] Use libmocha insteads of libiosuhax --- Dockerfile.wiiu | 4 ++-- README.md | 6 +++--- include/ntfs.h | 3 ++- source/Makefile | 4 ++-- source/cache2.h | 3 ++- source/gekko_io.h | 3 ++- source/mem_allocate.h | 6 +++--- source/ntfsinternal.c | 6 ++---- source/ntfsinternal.h | 3 ++- source/types.h | 16 +++++++++++++++- 10 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Dockerfile.wiiu b/Dockerfile.wiiu index 3300cf0..9a78b7f 100644 --- a/Dockerfile.wiiu +++ b/Dockerfile.wiiu @@ -1,6 +1,6 @@ -FROM wiiuenv/devkitppc:20200810 +FROM wiiuenv/devkitppc:20220724 -COPY --from=wiiuenv/libiosuhax:20200812 /artifacts $DEVKITPRO +COPY --from=wiiuenv/libmocha:20220726 /artifacts $DEVKITPRO WORKDIR tmp_build COPY . . diff --git a/README.md b/README.md index f43ba4f..8f7f169 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,13 @@ ## Usage Link the application with: ``` --lntfs -liosuhax +-lntfs -libmocha ``` ## Dependencies To be able to use libntfs for the Wii u, you need to install the following dependencies: -- [libiosuhax](https://github.com/wiiu-env/libiosuhax) +- [libmocha](https://github.com/wiiu-env/libmocha) ## Building ``` @@ -21,5 +21,5 @@ The image `wiiuenv/libntfs` on [Docker Hub](https://hub.docker.com/r/wiiuenv/lib Example: ``` -COPY --from=wiiuenv/libntfs:20201210 /artifacts $DEVKITPRO +COPY --from=wiiuenv/libntfs:20220726 /artifacts $DEVKITPRO ``` diff --git a/include/ntfs.h b/include/ntfs.h index 5c42114..81fda80 100644 --- a/include/ntfs.h +++ b/include/ntfs.h @@ -32,7 +32,8 @@ extern "C" { #include #include #elif defined (__WIIU__) - #include + #include + #include typedef uint8_t u8; typedef uint16_t u16; typedef int32_t s32; diff --git a/source/Makefile b/source/Makefile index f899d54..bdc9fdd 100644 --- a/source/Makefile +++ b/source/Makefile @@ -56,14 +56,14 @@ endif #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := +LIBS := -lwut #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- ifeq ($(PLATFORM),wiiu) -LIBDIRS := $(WUT_ROOT)/usr +LIBDIRS := $(WUT_ROOT)/usr $(WUT_ROOT) endif #--------------------------------------------------------------------------------- diff --git a/source/cache2.h b/source/cache2.h index 0b2f8c2..d8271c1 100644 --- a/source/cache2.h +++ b/source/cache2.h @@ -44,7 +44,8 @@ #include #if defined (__WIIU__) - #include + #include + #include typedef uint8_t u8; typedef uint16_t u16; typedef int32_t s32; diff --git a/source/gekko_io.h b/source/gekko_io.h index f10e377..25d78bf 100644 --- a/source/gekko_io.h +++ b/source/gekko_io.h @@ -29,7 +29,8 @@ #include "cache2.h" #if defined (__WIIU__) - #include + #include + #include typedef uint8_t u8; typedef uint16_t u16; typedef int32_t s32; diff --git a/source/mem_allocate.h b/source/mem_allocate.h index 600e5a9..55c00c3 100644 --- a/source/mem_allocate.h +++ b/source/mem_allocate.h @@ -25,14 +25,14 @@ #include static inline void* ntfs_alloc (size_t size) { - return malloc(size); + return memalign(0x40, size); } static inline void* ntfs_align (size_t size) { #ifdef __wii__ - return memalign(32, size); + return memalign(0x40, size); #else - return malloc(size); + return memalign(0x40, size); #endif } diff --git a/source/ntfsinternal.c b/source/ntfsinternal.c index b660fa8..d3f246f 100644 --- a/source/ntfsinternal.c +++ b/source/ntfsinternal.c @@ -53,11 +53,9 @@ const INTERFACE_ID ntfs_disc_interfaces[] = { }; #elif defined (__WIIU__) - #include - const INTERFACE_ID ntfs_disc_interfaces[] = { - {"sd", &IOSUHAX_sdio_disc_interface}, - {"usb", &IOSUHAX_usb_disc_interface}, + {"sd", &Mocha_sdio_disc_interface}, + {"usb", &Mocha_usb_disc_interface}, {NULL, NULL} }; diff --git a/source/ntfsinternal.h b/source/ntfsinternal.h index cb3dd15..1f6727b 100644 --- a/source/ntfsinternal.h +++ b/source/ntfsinternal.h @@ -42,7 +42,8 @@ #include "unistr.h" #if defined (__WIIU__) - #include + #include + #include typedef uint8_t u8; typedef uint16_t u16; typedef int32_t s32; diff --git a/source/types.h b/source/types.h index fcd1360..31dd571 100644 --- a/source/types.h +++ b/source/types.h @@ -39,6 +39,18 @@ #include "compat.h" #else /* GEKKO */ +#ifdef __WIIU__ +typedef int32_t BOOL; + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif +#endif + typedef uint8_t u8; /* Unsigned types of an exact size */ typedef uint16_t u16; typedef uint32_t u32; @@ -87,7 +99,8 @@ typedef sle64 leLSN; * Cygwin has a collision between our BOOL and 's * As long as this file will be included after were fine. */ -#ifndef GEKKO +#ifndef GEKKO +#ifndef __WIIU__ #ifndef _WINDEF_H /** * enum BOOL - These are just to make the code more readable... @@ -113,6 +126,7 @@ typedef enum { #endif } BOOL; #endif /* defined _WINDEF_H */ +#endif /* defined __WIIU__ */ #endif /* defined GECKO */ /**