Wii U support
This commit is contained in:
parent
968dee4aef
commit
f8705b2c39
|
@ -0,0 +1,26 @@
|
|||
name: Publish Docker Image
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
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
|
|
@ -0,0 +1,5 @@
|
|||
source/wiiu_release/*
|
||||
source/wii_release/*
|
||||
source/cube_release/*
|
||||
lib/*
|
||||
.idea/*
|
|
@ -0,0 +1,11 @@
|
|||
FROM wiiuenv/devkitppc:20200810
|
||||
|
||||
COPY --from=wiiuenv/libiosuhax:20200812 /artifacts $DEVKITPRO
|
||||
|
||||
WORKDIR tmp_build
|
||||
COPY . .
|
||||
RUN make clean && make wiiu-release && 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
|
17
Makefile
17
Makefile
|
@ -1,11 +1,11 @@
|
|||
|
||||
default: cube-release wii-release
|
||||
default: cube-release wii-release wiiu-release
|
||||
|
||||
all: debug release
|
||||
|
||||
debug: cube-debug wii-debug
|
||||
debug: cube-debug wii-debug wiiu-debug
|
||||
|
||||
release: cube-release wii-release
|
||||
release: cube-release wii-release wiiu-release
|
||||
|
||||
cube-debug:
|
||||
$(MAKE) -C source PLATFORM=cube BUILD=cube_debug
|
||||
|
@ -13,12 +13,18 @@ cube-debug:
|
|||
wii-debug:
|
||||
$(MAKE) -C source PLATFORM=wii BUILD=wii_debug
|
||||
|
||||
wiiu-debug:
|
||||
$(MAKE) -C source PLATFORM=wiiu BUILD=wiiu_debug
|
||||
|
||||
cube-release:
|
||||
$(MAKE) -C source PLATFORM=cube BUILD=cube_release
|
||||
|
||||
wii-release:
|
||||
$(MAKE) -C source PLATFORM=wii BUILD=wii_release
|
||||
|
||||
wiiu-release:
|
||||
$(MAKE) -C source PLATFORM=wiiu BUILD=wiiu_release
|
||||
|
||||
clean:
|
||||
$(MAKE) -C source clean
|
||||
|
||||
|
@ -28,7 +34,10 @@ cube-install: cube-release
|
|||
wii-install: wii-release
|
||||
$(MAKE) -C source wii-install PLATFORM=wii
|
||||
|
||||
install: wii-install
|
||||
wiiu-install: wiiu-release
|
||||
$(MAKE) -C source wiiu-install PLATFORM=wiiu
|
||||
|
||||
install: wiiu-install
|
||||
|
||||
run: install
|
||||
$(MAKE) -C example
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# libntfs for the Wii U [![Build Status](https://travis-ci.org/Maschell/libntfs-wiiu.svg)](https://travis-ci.org/Maschell/libntfs-wiiu)
|
||||
|
||||
## Usage
|
||||
Link the application with:
|
||||
```
|
||||
-lntfs -liosuhax
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
To be able to use libntfs for the Wii u, you need to install the following dependencies:
|
||||
|
||||
- [libiosuhax](https://github.com/dimok789/libiosuhax)
|
||||
|
||||
# Use the prebuilt files from a Docker image.
|
||||
The image `wiiulegacy/libntfs` on [Docker Hub](https://hub.docker.com/r/wiiulegacy/libntfs/) provides a prebuilt library in the `/artifacts` directory. Copy it into your DevkitPPC portlibs folder.
|
||||
|
||||
Example:
|
||||
```
|
||||
COPY --from=wiiulegacy/libntfs:2013.1.13 /artifacts $DEVKITPRO/portlibs
|
||||
```
|
|
@ -27,9 +27,18 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <gctypes.h>
|
||||
#include <gccore.h>
|
||||
#include <ogc/disc_io.h>
|
||||
#if defined(__gamecube__) || defined (__wii__)
|
||||
#include <gctypes.h>
|
||||
#include <ogc/disc_io.h>
|
||||
#include <gccore.h>
|
||||
#elif defined (__WIIU__)
|
||||
#include <iosuhax_disc_interface.h>
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef int32_t s32;
|
||||
typedef uint32_t u32;
|
||||
typedef int mutex_t;
|
||||
#endif
|
||||
|
||||
/* NTFS errno values */
|
||||
#define ENOPART 3000 /* No partition was found */
|
||||
|
|
|
@ -7,12 +7,17 @@ ifeq ($(strip $(DEVKITPPC)),)
|
|||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),wiiu)
|
||||
include $(DEVKITPRO)/wut/share/wut_rules
|
||||
MACHDEP += -D__WIIU__
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),wii)
|
||||
include $(DEVKITPPC)/wii_rules
|
||||
include $(DEVKITPPC)/wii_rules
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),cube)
|
||||
include $(DEVKITPPC)/gamecube_rules
|
||||
include $(DEVKITPPC)/gamecube_rules
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -20,7 +25,7 @@ endif
|
|||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD ?= wii_release
|
||||
BUILD ?= wiiu_release
|
||||
SOURCES := .
|
||||
INCLUDES := ../include
|
||||
LIBDIR := ../lib
|
||||
|
@ -28,7 +33,7 @@ LIBDIR := ../lib
|
|||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS = -Os -Wall -ffast-math -pipe $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
|
||||
CFLAGS = -Wall -ffast-math -pipe $(MACHDEP) $(INCLUDE) -ffunction-sections -DHAVE_CONFIG_H
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
ASFLAGS := -g
|
||||
export NTFSBIN := $(LIBDIR)/$(PLATFORM)/libntfs.a
|
||||
|
@ -37,11 +42,17 @@ ifeq ($(BUILD),cube_debug)
|
|||
CFLAGS += -DDEBUG
|
||||
CXXFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD),wii_debug)
|
||||
CFLAGS += -DDEBUG
|
||||
CXXFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD),wiiu_debug)
|
||||
CFLAGS += -DDEBUG
|
||||
CXXFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -51,7 +62,9 @@ LIBS :=
|
|||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
ifeq ($(PLATFORM),wiiu)
|
||||
LIBDIRS := $(WUT_ROOT)/usr
|
||||
endif
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
|
@ -77,11 +90,9 @@ export OFILES := $(addsuffix .o,$(BINFILES)) \
|
|||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
-I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(LIBOGC_LIB)
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) $(PORTLIBS)/lib
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
|
@ -93,7 +104,7 @@ $(BUILD):
|
|||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr wii_debug wii_release cube_debug cube_release $(LIBDIR)
|
||||
@rm -fr wii_debug wii_release wiiu_release cube_debug cube_release $(LIBDIR)
|
||||
|
||||
all: $(NTFSBIN)
|
||||
|
||||
|
@ -105,6 +116,10 @@ wii-install:
|
|||
cp ../include/ntfs.h $(PORTLIBS)/include
|
||||
cp ../lib/wii/libntfs.a $(PORTLIBS)/lib
|
||||
|
||||
wiiu-install:
|
||||
cp ../include/ntfs.h $(WUT_ROOT)/usr/include
|
||||
cp ../lib/wiiu/libntfs.a $(WUT_ROOT)/usr/lib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b)
|
|||
i = (u32)le16_to_cpu(b->bpb.bytes_per_sector) *
|
||||
b->bpb.sectors_per_cluster;
|
||||
if (i > 65536) {
|
||||
ntfs_log_error("Unexpected cluster size (%d).\n", i);
|
||||
ntfs_log_error("Unexpected cluster size (%d).\n", (int)i);
|
||||
goto not_ntfs;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b)
|
|||
le16_to_cpu(b->bpb.root_entries),
|
||||
le16_to_cpu(b->bpb.sectors),
|
||||
le16_to_cpu(b->bpb.sectors_per_fat),
|
||||
le32_to_cpu(b->bpb.large_sectors),
|
||||
(int)le32_to_cpu(b->bpb.large_sectors),
|
||||
b->bpb.fats);
|
||||
goto not_ntfs;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs)
|
|||
vol->cluster_size = sectors_per_cluster * vol->sector_size;
|
||||
if (vol->cluster_size & (vol->cluster_size - 1)) {
|
||||
ntfs_log_error("cluster_size (%d) is not a power of 2.\n",
|
||||
vol->cluster_size);
|
||||
(int)vol->cluster_size);
|
||||
return -1;
|
||||
}
|
||||
vol->cluster_size_bits = ffs(vol->cluster_size) - 1;
|
||||
|
@ -252,7 +252,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs)
|
|||
vol->mft_record_size = c << vol->cluster_size_bits;
|
||||
if (vol->mft_record_size & (vol->mft_record_size - 1)) {
|
||||
ntfs_log_error("mft_record_size (%d) is not a power of 2.\n",
|
||||
vol->mft_record_size);
|
||||
(int)vol->mft_record_size);
|
||||
return -1;
|
||||
}
|
||||
vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1;
|
||||
|
|
|
@ -35,7 +35,11 @@
|
|||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#if defined (__WIIU__)
|
||||
|
||||
#elif defined(__gamecube__) || defined (__wii__)
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
|
|
@ -42,9 +42,21 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <gctypes.h>
|
||||
#include <ogc/disc_io.h>
|
||||
#include <gccore.h>
|
||||
|
||||
#if defined (__WIIU__)
|
||||
#include <iosuhax_disc_interface.h>
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef int32_t s32;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
typedef uint32_t sec_t;
|
||||
typedef int mutex_t;
|
||||
#elif defined(__gamecube__) || defined (__wii__)
|
||||
#include <gctypes.h>
|
||||
#include <ogc/disc_io.h>
|
||||
#include <gccore.h>
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
sec_t sector;
|
||||
|
@ -54,7 +66,7 @@ typedef struct {
|
|||
u8* cache;
|
||||
} NTFS_CACHE_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
typedef struct NTFS_CACHE_{
|
||||
const DISC_INTERFACE* disc;
|
||||
sec_t endOfPartition;
|
||||
unsigned int numberOfPages;
|
||||
|
|
|
@ -69,7 +69,7 @@ extern char *strsep(char **stringp, const char *delim);
|
|||
#define O_BINARY 0 /* unix is binary by default */
|
||||
#endif
|
||||
|
||||
#ifdef GEKKO
|
||||
#if defined(GEKKO) || defined (__WIIU__)
|
||||
|
||||
#include "mem_allocate.h"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#ifndef __CYGWIN32__
|
||||
|
||||
/* Not on Cygwin; use standard Unix style low level device operations. */
|
||||
#include "unix_io.c"
|
||||
//#include "unix_io.c"
|
||||
|
||||
#else /* __CYGWIN32__ */
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@
|
|||
|
||||
#ifndef __CYGWIN32__
|
||||
|
||||
#ifndef GEKKO
|
||||
/* Not on Cygwin; use standard Unix style low level device operations. */
|
||||
#define ntfs_device_default_io_ops ntfs_device_unix_io_ops
|
||||
#if defined(GEKKO) || defined (__WIIU__)
|
||||
/* Wii i/o device. */
|
||||
#define ntfs_device_default_io_ops ntfs_device_gekko_io_ops
|
||||
#else
|
||||
/* Wii i/o device. */
|
||||
#define ntfs_device_default_io_ops ntfs_device_gekko_io_ops
|
||||
/* Not on Cygwin; use standard Unix style low level device operations. */
|
||||
#define ntfs_device_default_io_ops ntfs_device_unix_io_ops
|
||||
#endif
|
||||
|
||||
#else /* __CYGWIN32__ */
|
||||
|
|
|
@ -66,6 +66,11 @@
|
|||
#include <sys/xattr.h>
|
||||
#endif
|
||||
|
||||
#if defined(__WIIU__)
|
||||
#define major(dev) ((int)(((unsigned int) (dev) >> 8) & 0xff))
|
||||
#define minor(dev) ((int)((dev) & 0xff))
|
||||
#endif // defined
|
||||
|
||||
/*
|
||||
* The little endian Unicode strings "$I30", "$SII", "$SDH", "$O"
|
||||
* and "$Q" as global constants.
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
typedef double f64;
|
||||
|
||||
#include "ntfs.h"
|
||||
#include "types.h"
|
||||
#include "logging.h"
|
||||
|
@ -62,6 +64,7 @@
|
|||
#include "cache.h"
|
||||
#include "device.h"
|
||||
#include "bootsect.h"
|
||||
#include "mem_allocate.h"
|
||||
|
||||
#define DEV_FD(dev) ((gekko_fd *)dev->d_private)
|
||||
|
||||
|
@ -119,7 +122,7 @@ static int ntfs_device_gekko_io_open(struct ntfs_device *dev, int flags)
|
|||
}
|
||||
|
||||
if (!interface->readSectors(fd->startSector, 1, boot)) {
|
||||
ntfs_log_perror("read failure @ sector %d\n", fd->startSector);
|
||||
ntfs_log_perror("read failure @ sector %d\n", (int)fd->startSector);
|
||||
errno = EIO;
|
||||
ntfs_free(boot);
|
||||
return -1;
|
||||
|
@ -318,7 +321,7 @@ static s64 ntfs_device_gekko_io_readbytes(struct ntfs_device *dev, s64 offset, s
|
|||
// Read from the device
|
||||
ntfs_log_trace("direct read from sector %d (%d sector(s) long)\n", sec_start, sec_count);
|
||||
if (!ntfs_device_gekko_io_readsectors(dev, sec_start, sec_count, buf)) {
|
||||
ntfs_log_perror("direct read failure @ sector %d (%d sector(s) long)\n", sec_start, sec_count);
|
||||
ntfs_log_perror("direct read failure @ sector %d (%d sector(s) long)\n", (int)sec_start, (int)sec_count);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
@ -336,10 +339,10 @@ static s64 ntfs_device_gekko_io_readbytes(struct ntfs_device *dev, s64 offset, s
|
|||
}
|
||||
|
||||
// Read from the device
|
||||
ntfs_log_trace("buffered read from sector %d (%d sector(s) long)\n", sec_start, sec_count);
|
||||
ntfs_log_trace("buffered read from sector %d (%d sector(s) long)\n", (int)sec_start, (int)sec_count);
|
||||
ntfs_log_trace("count: %d sec_count:%d fd->sectorSize: %d )\n", (u32)count, (u32)sec_count,(u32)fd->sectorSize);
|
||||
if (!ntfs_device_gekko_io_readsectors(dev, sec_start, sec_count, buffer)) {
|
||||
ntfs_log_perror("buffered read failure @ sector %d (%d sector(s) long)\n", sec_start, sec_count);
|
||||
ntfs_log_perror("buffered read failure @ sector %d (%d sector(s) long)\n", (int)sec_start, (int)sec_count);
|
||||
ntfs_free(buffer);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
|
@ -406,9 +409,9 @@ static s64 ntfs_device_gekko_io_writebytes(struct ntfs_device *dev, s64 offset,
|
|||
if((buffer_offset == 0) && (count % fd->sectorSize == 0))
|
||||
{
|
||||
// Write to the device
|
||||
ntfs_log_trace("direct write to sector %d (%d sector(s) long)\n", sec_start, sec_count);
|
||||
ntfs_log_trace("direct write to sector %d (%d sector(s) long)\n", (int)sec_start, (int)sec_count);
|
||||
if (!ntfs_device_gekko_io_writesectors(dev, sec_start, sec_count, buf)) {
|
||||
ntfs_log_perror("direct write failure @ sector %d (%d sector(s) long)\n", sec_start, sec_count);
|
||||
ntfs_log_perror("direct write failure @ sector %d (%d sector(s) long)\n", (int)sec_start, (int)sec_count);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
@ -428,7 +431,7 @@ static s64 ntfs_device_gekko_io_writebytes(struct ntfs_device *dev, s64 offset,
|
|||
if(buffer_offset != 0)
|
||||
{
|
||||
if (!ntfs_device_gekko_io_readsectors(dev, sec_start, 1, buffer)) {
|
||||
ntfs_log_perror("read failure @ sector %d\n", sec_start);
|
||||
ntfs_log_perror("read failure @ sector %d\n", (int)sec_start);
|
||||
ntfs_free(buffer);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
|
@ -437,7 +440,7 @@ static s64 ntfs_device_gekko_io_writebytes(struct ntfs_device *dev, s64 offset,
|
|||
if((buffer_offset+count) % fd->sectorSize != 0)
|
||||
{
|
||||
if (!ntfs_device_gekko_io_readsectors(dev, sec_start + sec_count - 1, 1, buffer + ((sec_count-1) * fd->sectorSize))) {
|
||||
ntfs_log_perror("read failure @ sector %d\n", sec_start + sec_count - 1);
|
||||
ntfs_log_perror("read failure @ sector %d\n", (int)sec_start + (int)sec_count - 1);
|
||||
ntfs_free(buffer);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
|
@ -450,7 +453,7 @@ static s64 ntfs_device_gekko_io_writebytes(struct ntfs_device *dev, s64 offset,
|
|||
// Write to the device
|
||||
ntfs_log_trace("buffered write to sector %d (%d sector(s) long)\n", sec_start, sec_count);
|
||||
if (!ntfs_device_gekko_io_writesectors(dev, sec_start, sec_count, buffer)) {
|
||||
ntfs_log_perror("buffered write failure @ sector %d\n", sec_start);
|
||||
ntfs_log_perror("buffered write failure @ sector %d\n", (int)sec_start);
|
||||
ntfs_free(buffer);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
|
|
|
@ -27,8 +27,18 @@
|
|||
|
||||
#include "types.h"
|
||||
#include "cache2.h"
|
||||
#include <gccore.h>
|
||||
#include <ogc/disc_io.h>
|
||||
|
||||
#if defined (__WIIU__)
|
||||
#include <iosuhax_disc_interface.h>
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef int32_t s32;
|
||||
typedef uint32_t u32;
|
||||
typedef int mutex_t;
|
||||
#elif defined(__gamecube__) || defined (__wii__)
|
||||
#include <ogc/disc_io.h>
|
||||
#include <gccore.h>
|
||||
#endif
|
||||
|
||||
#define MAX_SECTOR_SIZE 4096
|
||||
|
||||
|
@ -49,6 +59,7 @@ typedef struct _gekko_fd {
|
|||
u32 cachePageSize; /* The number of sectors per cache page */
|
||||
} gekko_fd;
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
struct ntfs_device_operations;
|
||||
|
||||
|
|
|
@ -417,8 +417,8 @@ static int ntfs_ia_check(ntfs_index_context *icx, INDEX_BLOCK *ib, VCN vcn)
|
|||
ntfs_log_error("Corrupt index block : VCN (%lld) of inode %llu "
|
||||
"has a size (%u) differing from the index "
|
||||
"specified size (%u)\n", (long long)vcn,
|
||||
(unsigned long long)icx->ni->mft_no, ib_size,
|
||||
icx->block_size);
|
||||
(unsigned long long)icx->ni->mft_no, (unsigned int) ib_size,
|
||||
(unsigned int) icx->block_size);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -694,7 +694,7 @@ int ntfs_index_lookup(const void *key, const int key_len, ntfs_index_context *ic
|
|||
if (icx->block_size < NTFS_BLOCK_SIZE) {
|
||||
errno = EINVAL;
|
||||
ntfs_log_perror("Index block size (%d) is smaller than the "
|
||||
"sector size (%d)", icx->block_size, NTFS_BLOCK_SIZE);
|
||||
"sector size (%d)", (int) icx->block_size, NTFS_BLOCK_SIZE);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ static ntfs_inode *ntfs_inode_real_open(ntfs_volume *vol, const MFT_REF mref)
|
|||
if (l != ni->attr_list_size) {
|
||||
errno = EIO;
|
||||
ntfs_log_perror("Unexpected attrlist size (%lld <> %u), inode "
|
||||
"%lld", (long long)l, ni->attr_list_size,
|
||||
"%lld", (long long)l, (unsigned int) ni->attr_list_size,
|
||||
(long long)MREF(mref));
|
||||
goto put_err_out;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
#ifndef USE_LWP_LOCK
|
||||
|
||||
#ifndef mutex_t
|
||||
typedef int mutex_t;
|
||||
#endif
|
||||
|
||||
void __attribute__ ((weak)) _NTFS_lock_init(mutex_t *mutex, int unkwn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void __attribute__ ((weak)) _NTFS_lock_deinit(mutex_t *mutex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void __attribute__ ((weak)) _NTFS_lock(mutex_t *mutex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void __attribute__ ((weak)) _NTFS_unlock(mutex_t *mutex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // USE_LWP_LOCK
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
lock.h
|
||||
|
||||
Copyright (c) 2008 Sven Peter <svpe@gmx.net>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
3. The name of the author may not be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _LOCK_H
|
||||
#define _LOCK_H
|
||||
|
||||
|
||||
#ifdef USE_LWP_LOCK
|
||||
|
||||
static inline void _NTFS_lock_init(mutex_t *mutex, int unkwn)
|
||||
{
|
||||
LWP_MutexInit(mutex, false);
|
||||
}
|
||||
|
||||
static inline void _NTFS_lock_deinit(mutex_t *mutex)
|
||||
{
|
||||
LWP_MutexDestroy(*mutex);
|
||||
}
|
||||
|
||||
static inline void _NTFS_lock(mutex_t *mutex)
|
||||
{
|
||||
LWP_MutexLock(*mutex);
|
||||
}
|
||||
|
||||
static inline void _NTFS_unlock(mutex_t *mutex)
|
||||
{
|
||||
LWP_MutexUnlock(*mutex);
|
||||
}
|
||||
/* //not working.
|
||||
#elif defined(__WIIU__)
|
||||
#ifndef mutex_t
|
||||
typedef int mutex_t;
|
||||
#endif
|
||||
|
||||
#define OS_MUTEX_SIZE 44
|
||||
|
||||
extern void (* OSInitMutex)(void* mutex);
|
||||
extern void (* OSLockMutex)(void* mutex);
|
||||
extern void (* OSUnlockMutex)(void* mutex);
|
||||
extern void (* OSFatal)(const char *msg);
|
||||
|
||||
static inline void _NTFS_lock_init(mutex_t *mutex,int unkwn){
|
||||
void* new_mutex = malloc(OS_MUTEX_SIZE);
|
||||
if(new_mutex == NULL){
|
||||
OSFatal("_NTFS_lock_init malloc fail");
|
||||
}
|
||||
|
||||
*mutex = (mutex_t) new_mutex;
|
||||
OSInitMutex(new_mutex);
|
||||
}
|
||||
|
||||
static inline void _NTFS_lock_deinit(mutex_t *mutex){
|
||||
free((void*)(*mutex));
|
||||
*mutex = 0;
|
||||
}
|
||||
|
||||
static inline void _NTFS_lock(mutex_t *mutex)
|
||||
{
|
||||
OSLockMutex((void*)*mutex);
|
||||
}
|
||||
|
||||
static inline void _NTFS_unlock(mutex_t *mutex)
|
||||
{
|
||||
OSUnlockMutex((void*)*mutex);
|
||||
}*/
|
||||
|
||||
#else
|
||||
|
||||
// We still need a blank lock type
|
||||
#ifndef mutex_t
|
||||
typedef int mutex_t;
|
||||
#endif
|
||||
|
||||
void _NTFS_lock_init(mutex_t *mutex,int unkwn);
|
||||
void _NTFS_lock_deinit(mutex_t *mutex);
|
||||
void _NTFS_lock(mutex_t *mutex);
|
||||
void _NTFS_unlock(mutex_t *mutex);
|
||||
|
||||
#endif // USE_LWP_LOCK
|
||||
|
||||
|
||||
#endif // _LOCK_H
|
||||
|
|
@ -226,8 +226,8 @@ int ntfs_mft_record_check(const ntfs_volume *vol, const MFT_REF mref,
|
|||
if (le32_to_cpu(m->bytes_allocated) != vol->mft_record_size) {
|
||||
ntfs_log_error("Record %llu has corrupt allocation size "
|
||||
"(%u <> %u)\n", (unsigned long long)MREF(mref),
|
||||
vol->mft_record_size,
|
||||
le32_to_cpu(m->bytes_allocated));
|
||||
(unsigned int) vol->mft_record_size,
|
||||
(unsigned int) le32_to_cpu(m->bytes_allocated));
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ int ntfs_mst_post_read_fixup_warn(NTFS_RECORD *b, const u32 size,
|
|||
errno = EIO;
|
||||
ntfs_log_perror("Incomplete multi-sector transfer: "
|
||||
"magic: 0x%08x size: %d usa_ofs: %d usa_count:"
|
||||
" %d data: %d usn: %d", *(le32 *)b, size,
|
||||
" %d data: %d usn: %d", (unsigned int)*(le32 *)b, (int)size,
|
||||
usa_ofs, usa_count, *data_pos, usn);
|
||||
b->magic = magic_BAAD;
|
||||
return -1;
|
||||
|
|
|
@ -37,9 +37,12 @@
|
|||
#include "ntfsinternal.h"
|
||||
#include "ntfsfile.h"
|
||||
#include "ntfsdir.h"
|
||||
|
||||
#include "gekko_io.h"
|
||||
|
||||
#include "cache.h"
|
||||
|
||||
|
||||
// NTFS device driver devoptab
|
||||
static const devoptab_t devops_ntfs = {
|
||||
NULL, /* Device name */
|
||||
|
@ -197,7 +200,7 @@ int ntfsFindPartitions (const DISC_INTERFACE *interface, sec_t **partitions)
|
|||
if (sector.boot.oem_id == NTFS_OEM_ID) {
|
||||
ntfs_log_debug("Logical Partition @ %d: Valid NTFS boot sector found\n", part_lba);
|
||||
if(sector.ebr.partition.type != PARTITION_TYPE_NTFS) {
|
||||
ntfs_log_warning("Logical Partition @ %d: Is NTFS but type is 0x%x; 0x%x was expected\n", part_lba, sector.ebr.partition.type, PARTITION_TYPE_NTFS);
|
||||
ntfs_log_warning("Logical Partition @ %d: Is NTFS but type is 0x%x; 0x%x was expected\n", (int) part_lba, sector.ebr.partition.type, PARTITION_TYPE_NTFS);
|
||||
}
|
||||
if (partition_count < NTFS_MAX_PARTITIONS) {
|
||||
partition_starts[partition_count] = part_lba;
|
||||
|
@ -317,6 +320,27 @@ int ntfsMountAll (ntfs_md **mounts, u32 flags)
|
|||
|
||||
}
|
||||
ntfs_free(partitions);
|
||||
}else if(partition_count == 0){
|
||||
int k = 0;
|
||||
// Find the next unused mount name
|
||||
do {
|
||||
sprintf(name, "%s%i", NTFS_MOUNT_PREFIX, k++);
|
||||
if (k >= NTFS_MAX_MOUNTS) {
|
||||
ntfs_free(partitions);
|
||||
errno = EADDRNOTAVAIL;
|
||||
return -1;
|
||||
}
|
||||
} while (ntfsGetDevice(name, false));
|
||||
|
||||
// Mount the partition
|
||||
if (mount_count < NTFS_MAX_MOUNTS) {
|
||||
if (ntfsMount(name, disc->interface, 0, CACHE_DEFAULT_PAGE_SIZE, CACHE_DEFAULT_PAGE_COUNT, flags)) {
|
||||
strcpy(mount_points[mount_count].name, name);
|
||||
mount_points[mount_count].interface = disc->interface;
|
||||
mount_points[mount_count].startSector = 0;
|
||||
mount_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ int ntfs_open_r (struct _reent *r, void *fileStruct, const char *path, int flags
|
|||
return (int)fileStruct;
|
||||
}
|
||||
|
||||
int ntfs_close_r (struct _reent *r, int fd)
|
||||
int ntfs_close_r (struct _reent *r, void * fd)
|
||||
{
|
||||
ntfs_log_trace("fd %p\n", (void *) fd);
|
||||
|
||||
|
@ -253,7 +253,7 @@ int ntfs_close_r (struct _reent *r, int fd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ssize_t ntfs_write_r (struct _reent *r, int fd, const char *ptr, size_t len)
|
||||
ssize_t ntfs_write_r (struct _reent *r, void * fd, const char *ptr, size_t len)
|
||||
{
|
||||
ntfs_log_trace("fd %p, ptr %p, len %u\n", (void *) fd, ptr, len);
|
||||
|
||||
|
@ -319,7 +319,7 @@ ssize_t ntfs_write_r (struct _reent *r, int fd, const char *ptr, size_t len)
|
|||
return written;
|
||||
}
|
||||
|
||||
ssize_t ntfs_read_r (struct _reent *r, int fd, char *ptr, size_t len)
|
||||
ssize_t ntfs_read_r (struct _reent *r, void * fd, char *ptr, size_t len)
|
||||
{
|
||||
ntfs_log_trace("fd %p, ptr %p, len %u\n", (void *) fd, ptr, len);
|
||||
|
||||
|
@ -378,7 +378,7 @@ ssize_t ntfs_read_r (struct _reent *r, int fd, char *ptr, size_t len)
|
|||
return read;
|
||||
}
|
||||
|
||||
off_t ntfs_seek_r (struct _reent *r, int fd, off_t pos, int dir)
|
||||
off_t ntfs_seek_r (struct _reent *r, void * fd, off_t pos, int dir)
|
||||
{
|
||||
ntfs_log_trace("fd %p, pos %llu, dir %i\n", (void *) fd, pos, dir);
|
||||
|
||||
|
@ -406,7 +406,7 @@ off_t ntfs_seek_r (struct _reent *r, int fd, off_t pos, int dir)
|
|||
|
||||
return position;
|
||||
}
|
||||
int ntfs_fstat_r (struct _reent *r, int fd, struct stat *st)
|
||||
int ntfs_fstat_r (struct _reent *r, void * fd, struct stat *st)
|
||||
{
|
||||
ntfs_log_trace("fd %p\n", (void *) fd);
|
||||
|
||||
|
@ -431,7 +431,7 @@ int ntfs_fstat_r (struct _reent *r, int fd, struct stat *st)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int ntfs_ftruncate_r (struct _reent *r, int fd, off_t len)
|
||||
int ntfs_ftruncate_r (struct _reent *r, void * fd, off_t len)
|
||||
{
|
||||
ntfs_log_trace("fd %p, len %llu\n", (void *) fd, (u64) len);
|
||||
|
||||
|
@ -498,7 +498,7 @@ int ntfs_ftruncate_r (struct _reent *r, int fd, off_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ntfs_fsync_r (struct _reent *r, int fd)
|
||||
int ntfs_fsync_r (struct _reent *r, void * fd)
|
||||
{
|
||||
ntfs_log_trace("fd %p\n", (void *) fd);
|
||||
|
||||
|
|
|
@ -53,13 +53,13 @@ void ntfsCloseFile (ntfs_file_state *file);
|
|||
|
||||
/* Gekko devoptab file routines for NTFS-based devices */
|
||||
extern int ntfs_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
|
||||
extern int ntfs_close_r (struct _reent *r, int fd);
|
||||
extern ssize_t ntfs_write_r (struct _reent *r, int fd, const char *ptr, size_t len);
|
||||
extern ssize_t ntfs_read_r (struct _reent *r, int fd, char *ptr, size_t len);
|
||||
extern off_t ntfs_seek_r (struct _reent *r, int fd, off_t pos, int dir);
|
||||
extern int ntfs_fstat_r (struct _reent *r, int fd, struct stat *st);
|
||||
extern int ntfs_ftruncate_r (struct _reent *r, int fd, off_t len);
|
||||
extern int ntfs_fsync_r (struct _reent *r, int fd);
|
||||
extern int ntfs_close_r (struct _reent *r, void *fd);
|
||||
extern ssize_t ntfs_write_r (struct _reent *r, void * fd, const char *ptr, size_t len);
|
||||
extern ssize_t ntfs_read_r (struct _reent *r, void * fd, char *ptr, size_t len);
|
||||
extern off_t ntfs_seek_r (struct _reent *r, void * fd, off_t pos, int dir);
|
||||
extern int ntfs_fstat_r (struct _reent *r, void * fd, struct stat *st);
|
||||
extern int ntfs_ftruncate_r (struct _reent *r, void * fd, off_t len);
|
||||
extern int ntfs_fsync_r (struct _reent *r, void * fd);
|
||||
|
||||
#endif /* _NTFSFILE_H */
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "ntfsinternal.h"
|
||||
#include "ntfsdir.h"
|
||||
#include "ntfsfile.h"
|
||||
#include "lock.h"
|
||||
|
||||
#if defined(__wii__)
|
||||
#include <sdcard/wiisd_io.h>
|
||||
|
@ -51,6 +52,15 @@ const INTERFACE_ID ntfs_disc_interfaces[] = {
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
#elif defined (__WIIU__)
|
||||
#include <iosuhax_disc_interface.h>
|
||||
|
||||
const INTERFACE_ID ntfs_disc_interfaces[] = {
|
||||
{"sd", &IOSUHAX_sdio_disc_interface},
|
||||
{"usb", &IOSUHAX_usb_disc_interface},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
#elif defined(__gamecube__)
|
||||
#include <sdcard/gcsd.h>
|
||||
|
||||
|
@ -190,7 +200,7 @@ int ntfsInitVolume (ntfs_vd *vd)
|
|||
}
|
||||
|
||||
// Initialise the volume lock
|
||||
LWP_MutexInit(&vd->lock, false);
|
||||
_NTFS_lock_init(&vd->lock, false);
|
||||
|
||||
// Reset the volumes name cache
|
||||
vd->name[0] = '\0';
|
||||
|
@ -253,7 +263,7 @@ void ntfsDeinitVolume (ntfs_vd *vd)
|
|||
ntfsUnlock(vd);
|
||||
|
||||
// Deinitialise the volume lock
|
||||
LWP_MutexDestroy(vd->lock);
|
||||
_NTFS_lock_deinit((mutex_t *)vd->lock);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -38,10 +38,21 @@
|
|||
#include "reparse.h"
|
||||
#include "security.h"
|
||||
#include "efs.h"
|
||||
#include "lock.h"
|
||||
#include "unistr.h"
|
||||
|
||||
#include <gccore.h>
|
||||
#include <ogc/disc_io.h>
|
||||
#if defined (__WIIU__)
|
||||
#include <iosuhax_disc_interface.h>
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef int32_t s32;
|
||||
typedef uint32_t u32;
|
||||
typedef int mutex_t;
|
||||
#elif defined(__gamecube__) || defined (__wii__)
|
||||
#include <ogc/disc_io.h>
|
||||
#include <gccore.h>
|
||||
#endif
|
||||
|
||||
#include <sys/iosupport.h>
|
||||
|
||||
#define NTFS_MOUNT_PREFIX "ntfs" /* Device name prefix to use when auto-mounting */
|
||||
|
@ -141,13 +152,13 @@ typedef struct _ntfs_vd {
|
|||
/* Lock volume */
|
||||
static inline void ntfsLock (ntfs_vd *vd)
|
||||
{
|
||||
LWP_MutexLock(vd->lock);
|
||||
_NTFS_lock((mutex_t *)&vd->lock);
|
||||
}
|
||||
|
||||
/* Unlock volume */
|
||||
static inline void ntfsUnlock (ntfs_vd *vd)
|
||||
{
|
||||
LWP_MutexUnlock(vd->lock);
|
||||
_NTFS_unlock((mutex_t *)&vd->lock);
|
||||
}
|
||||
|
||||
/* Gekko device related routines */
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
/*
|
||||
* assume "struct timespec" is not defined if st_mtime is not defined
|
||||
*/
|
||||
#if !defined(st_mtime) & !defined(__timespec_defined)
|
||||
#if !defined(st_mtime) & !defined(__timespec_defined) & !defined(__WIIU__)
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
|
|
|
@ -297,7 +297,7 @@ static int ntfs_mft_load(ntfs_volume *vol)
|
|||
if (l != vol->mft_ni->attr_list_size) {
|
||||
ntfs_log_error("Partial read of $MFT/$ATTR_LIST (%lld != "
|
||||
"%u).\n", (long long)l,
|
||||
vol->mft_ni->attr_list_size);
|
||||
(unsigned int) vol->mft_ni->attr_list_size);
|
||||
goto io_error_exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue