mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 12:35:23 +00:00
deps/libiosuhax: Update to wiiu-env/libiosuhax@69532cf
This commit is contained in:
parent
e5bbd9488f
commit
5887016db3
@ -2377,10 +2377,10 @@ endif
|
||||
|
||||
ifeq ($(WANT_IOSUHAX), 1)
|
||||
DEFINES += -DHAVE_IOSUHAX
|
||||
INCLUDE_DIRS += -I$(DEPS_DIR)/libiosuhax
|
||||
OBJ += $(DEPS_DIR)/libiosuhax/iosuhax.o \
|
||||
$(DEPS_DIR)/libiosuhax/iosuhax_devoptab.o \
|
||||
$(DEPS_DIR)/libiosuhax/iosuhax_disc_interface.o
|
||||
INCLUDE_DIRS += -I$(DEPS_DIR)/libiosuhax/include
|
||||
OBJ += $(DEPS_DIR)/libiosuhax/source/iosuhax.o \
|
||||
$(DEPS_DIR)/libiosuhax/source/iosuhax_devoptab.o \
|
||||
$(DEPS_DIR)/libiosuhax/source/iosuhax_disc_interface.o
|
||||
endif
|
||||
|
||||
ifeq ($(WANT_LIBFAT), 1)
|
||||
|
@ -102,7 +102,7 @@ endif
|
||||
|
||||
INCDIRS += -Ilibretro-common/include/compat/zlib
|
||||
# for stb, libfat, iosuhax
|
||||
INCDIRS += -Ideps -Ideps/libfat/include -Ideps/libiosuhax
|
||||
INCDIRS += -Ideps -Ideps/libfat/include -Ideps/libiosuhax/include
|
||||
# pad_functions uses wiiu/input.h
|
||||
INCDIRS += -Iinput/include
|
||||
INCDIRS += -Ideps/SPIRV-Cross
|
||||
|
25
deps/libiosuhax/.github/workflows/push_image.yml
vendored
Normal file
25
deps/libiosuhax/.github/workflows/push_image.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
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 }}"
|
5
deps/libiosuhax/.gitignore
vendored
Normal file
5
deps/libiosuhax/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/*.a
|
||||
/build
|
||||
*.bz2
|
||||
release/
|
||||
lib/
|
29
deps/libiosuhax/.travis.yml
vendored
Normal file
29
deps/libiosuhax/.travis.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
language: cpp
|
||||
|
||||
os: linux
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
env:
|
||||
global:
|
||||
- DEVKITPRO=/opt/devkitpro
|
||||
- DEVKITPPC=/opt/devkitpro/devkitPPC
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.local"
|
||||
- "$DEVKITPRO"
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- p7zip-full
|
||||
|
||||
before_install:
|
||||
- mkdir -p "${DEVKITPRO}"
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb -O /tmp/devkitpro-pacman.deb; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo dpkg -i /tmp/devkitpro-pacman.deb; fi
|
||||
- yes | sudo dkp-pacman -Syu devkitPPC --needed
|
||||
|
||||
script:
|
||||
- make && make install
|
9
deps/libiosuhax/Dockerfile
vendored
Normal file
9
deps/libiosuhax/Dockerfile
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
FROM wiiuenv/devkitppc:20210101
|
||||
|
||||
WORKDIR tmp_build
|
||||
COPY . .
|
||||
RUN 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
|
157
deps/libiosuhax/Makefile
vendored
Normal file
157
deps/libiosuhax/Makefile
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
||||
endif
|
||||
|
||||
TOPDIR ?= $(CURDIR)
|
||||
|
||||
include $(DEVKITPRO)/wut/share/wut_rules
|
||||
|
||||
export VER_MAJOR := 1
|
||||
export VER_MINOR := 0
|
||||
export VER_PATCH := 0
|
||||
|
||||
VERSION := $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# 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
|
||||
# DATA is a list of directories containing data files
|
||||
# INCLUDES is a list of directories containing header files
|
||||
#-------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
DATA := data
|
||||
INCLUDES := source \
|
||||
include \
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS := -Wall -Werror -save-temps \
|
||||
-ffunction-sections -fdata-sections \
|
||||
$(MACHDEP) \
|
||||
$(BUILD_CFLAGS)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -std=gnu++17
|
||||
|
||||
ASFLAGS := $(MACHDEP)
|
||||
|
||||
LDFLAGS = $(ARCH) -Wl,--gc-sections
|
||||
|
||||
|
||||
LIBS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(PORTLIBS) $(WUT_ROOT)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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 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)))
|
||||
DEFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.def)))
|
||||
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_BIN := $(addsuffix .o,$(BINFILES))
|
||||
export OFILES_SRC := $(DEFFILES:.def=.o) $(SFILES:.s=.o) $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
|
||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I.
|
||||
|
||||
.PHONY: all dist-bin dist-src dist install clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: lib/libiosuhax.a
|
||||
|
||||
dist-bin: all
|
||||
@tar --exclude=*~ -cjf libiosuhax-$(VERSION).tar.bz2 include lib
|
||||
|
||||
dist-src:
|
||||
@tar --exclude=*~ -cjf libiosuhax-src-$(VERSION).tar.bz2 include source Makefile
|
||||
|
||||
dist: dist-src dist-bin
|
||||
|
||||
install: dist-bin
|
||||
mkdir -p $(DESTDIR)$(DEVKITPRO)/wut/usr
|
||||
bzip2 -cd libiosuhax-$(VERSION).tar.bz2 | tar -xf - -C $(DESTDIR)$(DEVKITPRO)/wut/usr
|
||||
|
||||
lib:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
release:
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
|
||||
lib/libiosuhax.a :$(SOURCES) $(INCLUDES) | lib release
|
||||
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
|
||||
BUILD_CFLAGS="-DNDEBUG=1 -O2 -s" \
|
||||
DEPSDIR=$(CURDIR)/release \
|
||||
--no-print-directory -C release \
|
||||
-f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -rf release lib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT) : $(OFILES)
|
||||
|
||||
$(OFILES_SRC) : $(HFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%_bin.h %.bin.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
@$(bin2o)
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
10
deps/libiosuhax/README.md
vendored
Normal file
10
deps/libiosuhax/README.md
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
[![Build Status](https://travis-ci.org/dimok789/libiosuhax.svg)](https://travis-ci.org/dimok789/libiosuhax)
|
||||
# libiosuhax
|
||||
A PPC library to access IOSUHAX from PPC and a devoptab for any device or path.
|
||||
It's only compatible to RPX-Files.
|
||||
|
||||
## Building
|
||||
Make you to have [wut](https://github.com/devkitPro/wut/) installed and use the following command for build:
|
||||
```
|
||||
make install
|
||||
```
|
@ -1,109 +1,112 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2016
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#ifndef _LIB_IOSUHAX_H_
|
||||
#define _LIB_IOSUHAX_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IOS_ERROR_UNKNOWN_VALUE 0xFFFFFFD6
|
||||
#define IOS_ERROR_INVALID_ARG 0xFFFFFFE3
|
||||
#define IOS_ERROR_INVALID_SIZE 0xFFFFFFE9
|
||||
#define IOS_ERROR_UNKNOWN 0xFFFFFFF7
|
||||
#define IOS_ERROR_NOEXISTS 0xFFFFFFFA
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t flag;
|
||||
uint32_t permission;
|
||||
uint32_t owner_id;
|
||||
uint32_t group_id;
|
||||
uint32_t size; // size in bytes
|
||||
uint32_t physsize; // physical size on disk in bytes
|
||||
uint32_t unk[3];
|
||||
uint32_t id;
|
||||
uint32_t ctime;
|
||||
uint32_t mtime;
|
||||
uint32_t unk2[0x0D];
|
||||
}fileStat_s;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fileStat_s stat;
|
||||
char name[0x100];
|
||||
}directoryEntry_s;
|
||||
|
||||
#define DIR_ENTRY_IS_DIRECTORY 0x80000000
|
||||
|
||||
#define FSA_MOUNTFLAGS_BINDMOUNT (1 << 0)
|
||||
#define FSA_MOUNTFLAGS_GLOBAL (1 << 1)
|
||||
|
||||
int IOSUHAX_Open(const char *dev); // if dev == NULL the default path /dev/iosuhax will be used
|
||||
int IOSUHAX_Close(void);
|
||||
|
||||
int IOSUHAX_memwrite(uint32_t address, const uint8_t * buffer, uint32_t size); // IOSU external input
|
||||
int IOSUHAX_memread(uint32_t address, uint8_t * out_buffer, uint32_t size); // IOSU external output
|
||||
int IOSUHAX_memcpy(uint32_t dst, uint32_t src, uint32_t size); // IOSU internal memcpy only
|
||||
|
||||
int IOSUHAX_SVC(uint32_t svc_id, uint32_t * args, uint32_t arg_cnt);
|
||||
|
||||
int IOSUHAX_FSA_Open();
|
||||
int IOSUHAX_FSA_Close(int fsaFd);
|
||||
|
||||
int IOSUHAX_FSA_Mount(int fsaFd, const char* device_path, const char* volume_path, uint32_t flags, const char* arg_string, int arg_string_len);
|
||||
int IOSUHAX_FSA_Unmount(int fsaFd, const char* path, uint32_t flags);
|
||||
int IOSUHAX_FSA_FlushVolume(int fsaFd, const char* volume_path);
|
||||
|
||||
int IOSUHAX_FSA_GetDeviceInfo(int fsaFd, const char* device_path, int type, uint32_t* out_data);
|
||||
|
||||
int IOSUHAX_FSA_MakeDir(int fsaFd, const char* path, uint32_t flags);
|
||||
int IOSUHAX_FSA_OpenDir(int fsaFd, const char* path, int* outHandle);
|
||||
int IOSUHAX_FSA_ReadDir(int fsaFd, int handle, directoryEntry_s* out_data);
|
||||
int IOSUHAX_FSA_RewindDir(int fsaFd, int dirHandle);
|
||||
int IOSUHAX_FSA_CloseDir(int fsaFd, int handle);
|
||||
int IOSUHAX_FSA_ChangeDir(int fsaFd, const char *path);
|
||||
|
||||
int IOSUHAX_FSA_OpenFile(int fsaFd, const char* path, const char* mode, int* outHandle);
|
||||
int IOSUHAX_FSA_ReadFile(int fsaFd, void* data, uint32_t size, uint32_t cnt, int fileHandle, uint32_t flags);
|
||||
int IOSUHAX_FSA_WriteFile(int fsaFd, const void* data, uint32_t size, uint32_t cnt, int fileHandle, uint32_t flags);
|
||||
int IOSUHAX_FSA_StatFile(int fsaFd, int fileHandle, fileStat_s* out_data);
|
||||
int IOSUHAX_FSA_CloseFile(int fsaFd, int fileHandle);
|
||||
int IOSUHAX_FSA_SetFilePos(int fsaFd, int fileHandle, uint32_t position);
|
||||
int IOSUHAX_FSA_GetStat(int fsaFd, const char *path, fileStat_s* out_data);
|
||||
int IOSUHAX_FSA_Remove(int fsaFd, const char *path);
|
||||
int IOSUHAX_FSA_ChangeMode(int fsaFd, const char* path, int mode);
|
||||
|
||||
int IOSUHAX_FSA_RawOpen(int fsaFd, const char* device_path, int* outHandle);
|
||||
int IOSUHAX_FSA_RawRead(int fsaFd, void* data, uint32_t block_size, uint32_t block_cnt, uint64_t sector_offset, int device_handle);
|
||||
int IOSUHAX_FSA_RawWrite(int fsaFd, const void* data, uint32_t block_size, uint32_t block_cnt, uint64_t sector_offset, int device_handle);
|
||||
int IOSUHAX_FSA_RawClose(int fsaFd, int device_handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2016
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#ifndef _LIB_IOSUHAX_H_
|
||||
#define _LIB_IOSUHAX_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IOS_ERROR_UNKNOWN_VALUE 0xFFFFFFD6
|
||||
#define IOS_ERROR_INVALID_ARG 0xFFFFFFE3
|
||||
#define IOS_ERROR_INVALID_SIZE 0xFFFFFFE9
|
||||
#define IOS_ERROR_UNKNOWN 0xFFFFFFF7
|
||||
#define IOS_ERROR_NOEXISTS 0xFFFFFFFA
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t flag;
|
||||
uint32_t permission;
|
||||
uint32_t owner_id;
|
||||
uint32_t group_id;
|
||||
uint32_t size; // size in bytes
|
||||
uint32_t physsize; // physical size on disk in bytes
|
||||
uint32_t unk[3];
|
||||
uint32_t id;
|
||||
uint32_t ctime;
|
||||
uint32_t mtime;
|
||||
uint32_t unk2[0x0D];
|
||||
}fileStat_s;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fileStat_s stat;
|
||||
char name[0x100];
|
||||
}directoryEntry_s;
|
||||
|
||||
#define DIR_ENTRY_IS_DIRECTORY 0x80000000
|
||||
|
||||
#define FSA_MOUNTFLAGS_BINDMOUNT (1 << 0)
|
||||
#define FSA_MOUNTFLAGS_GLOBAL (1 << 1)
|
||||
|
||||
int IOSUHAX_Open(const char *dev); // if dev == NULL the default path /dev/iosuhax will be used
|
||||
int IOSUHAX_Close(void);
|
||||
|
||||
int IOSUHAX_memwrite(uint32_t address, const uint8_t * buffer, uint32_t size); // IOSU external input
|
||||
int IOSUHAX_memread(uint32_t address, uint8_t * out_buffer, uint32_t size); // IOSU external output
|
||||
int IOSUHAX_memcpy(uint32_t dst, uint32_t src, uint32_t size); // IOSU internal memcpy only
|
||||
|
||||
int IOSUHAX_kern_write32(uint32_t address, uint32_t value);
|
||||
int IOSUHAX_kern_read32(uint32_t address, uint32_t* out_buffer, uint32_t count);
|
||||
|
||||
int IOSUHAX_SVC(uint32_t svc_id, uint32_t * args, uint32_t arg_cnt);
|
||||
|
||||
int IOSUHAX_FSA_Open();
|
||||
int IOSUHAX_FSA_Close(int fsaFd);
|
||||
|
||||
int IOSUHAX_FSA_Mount(int fsaFd, const char* device_path, const char* volume_path, uint32_t flags, const char* arg_string, int arg_string_len);
|
||||
int IOSUHAX_FSA_Unmount(int fsaFd, const char* path, uint32_t flags);
|
||||
int IOSUHAX_FSA_FlushVolume(int fsaFd, const char* volume_path);
|
||||
|
||||
int IOSUHAX_FSA_GetDeviceInfo(int fsaFd, const char* device_path, int type, uint32_t* out_data);
|
||||
|
||||
int IOSUHAX_FSA_MakeDir(int fsaFd, const char* path, uint32_t flags);
|
||||
int IOSUHAX_FSA_OpenDir(int fsaFd, const char* path, int* outHandle);
|
||||
int IOSUHAX_FSA_ReadDir(int fsaFd, int handle, directoryEntry_s* out_data);
|
||||
int IOSUHAX_FSA_RewindDir(int fsaFd, int dirHandle);
|
||||
int IOSUHAX_FSA_CloseDir(int fsaFd, int handle);
|
||||
int IOSUHAX_FSA_ChangeDir(int fsaFd, const char *path);
|
||||
|
||||
int IOSUHAX_FSA_OpenFile(int fsaFd, const char* path, const char* mode, int* outHandle);
|
||||
int IOSUHAX_FSA_ReadFile(int fsaFd, void* data, uint32_t size, uint32_t cnt, int fileHandle, uint32_t flags);
|
||||
int IOSUHAX_FSA_WriteFile(int fsaFd, const void* data, uint32_t size, uint32_t cnt, int fileHandle, uint32_t flags);
|
||||
int IOSUHAX_FSA_StatFile(int fsaFd, int fileHandle, fileStat_s* out_data);
|
||||
int IOSUHAX_FSA_CloseFile(int fsaFd, int fileHandle);
|
||||
int IOSUHAX_FSA_SetFilePos(int fsaFd, int fileHandle, uint32_t position);
|
||||
int IOSUHAX_FSA_GetStat(int fsaFd, const char *path, fileStat_s* out_data);
|
||||
int IOSUHAX_FSA_Remove(int fsaFd, const char *path);
|
||||
int IOSUHAX_FSA_ChangeMode(int fsaFd, const char* path, int mode);
|
||||
|
||||
int IOSUHAX_FSA_RawOpen(int fsaFd, const char* device_path, int* outHandle);
|
||||
int IOSUHAX_FSA_RawRead(int fsaFd, void* data, uint32_t block_size, uint32_t block_cnt, uint64_t sector_offset, int device_handle);
|
||||
int IOSUHAX_FSA_RawWrite(int fsaFd, const void* data, uint32_t block_size, uint32_t block_cnt, uint64_t sector_offset, int device_handle);
|
||||
int IOSUHAX_FSA_RawClose(int fsaFd, int device_handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,42 +1,42 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2015
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#ifndef __IOSUHAX_DEVOPTAB_H_
|
||||
#define __IOSUHAX_DEVOPTAB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//! virtual name example: sd or odd (for sd:/ or odd:/ access)
|
||||
//! fsaFd: fd received by IOSUHAX_FSA_Open();
|
||||
//! dev_path: (optional) if a device should be mounted to the mount_path. If NULL no IOSUHAX_FSA_Mount is not executed.
|
||||
//! mount_path: path to map to virtual device name
|
||||
int mount_fs(const char *virt_name, int fsaFd, const char *dev_path, const char *mount_path);
|
||||
int unmount_fs(const char *virt_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __IOSUHAX_DEVOPTAB_H_
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2015
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#ifndef __IOSUHAX_DEVOPTAB_H_
|
||||
#define __IOSUHAX_DEVOPTAB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//! virtual name example: sd or odd (for sd:/ or odd:/ access)
|
||||
//! fsaFd: fd received by IOSUHAX_FSA_Open();
|
||||
//! dev_path: (optional) if a device should be mounted to the mount_path. If NULL no IOSUHAX_FSA_Mount is not executed.
|
||||
//! mount_path: path to map to virtual device name
|
||||
int mount_fs(const char *virt_name, int fsaFd, const char *dev_path, const char *mount_path);
|
||||
int unmount_fs(const char *virt_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __IOSUHAX_DEVOPTAB_H_
|
@ -1,73 +1,73 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2016
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#ifndef _IOSUHAX_DISC_INTERFACE_H_
|
||||
#define _IOSUHAX_DISC_INTERFACE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DEVICE_TYPE_WII_U_SD (('W'<<24)|('U'<<16)|('S'<<8)|'D')
|
||||
#define DEVICE_TYPE_WII_U_USB (('W'<<24)|('U'<<16)|('S'<<8)|'B')
|
||||
#define FEATURE_WII_U_SD 0x00001000
|
||||
#define FEATURE_WII_U_USB 0x00002000
|
||||
|
||||
#ifndef OGC_DISC_IO_INCLUDE
|
||||
typedef uint32_t sec_t;
|
||||
|
||||
#define FEATURE_MEDIUM_CANREAD 0x00000001
|
||||
#define FEATURE_MEDIUM_CANWRITE 0x00000002
|
||||
|
||||
typedef bool (* FN_MEDIUM_STARTUP)(void) ;
|
||||
typedef bool (* FN_MEDIUM_ISINSERTED)(void) ;
|
||||
typedef bool (* FN_MEDIUM_READSECTORS)(uint32_t sector, uint32_t numSectors, void* buffer) ;
|
||||
typedef bool (* FN_MEDIUM_WRITESECTORS)(uint32_t sector, uint32_t numSectors, const void* buffer) ;
|
||||
typedef bool (* FN_MEDIUM_CLEARSTATUS)(void) ;
|
||||
typedef bool (* FN_MEDIUM_SHUTDOWN)(void) ;
|
||||
|
||||
struct DISC_INTERFACE_STRUCT {
|
||||
unsigned long ioType ;
|
||||
unsigned long features ;
|
||||
FN_MEDIUM_STARTUP startup ;
|
||||
FN_MEDIUM_ISINSERTED isInserted ;
|
||||
FN_MEDIUM_READSECTORS readSectors ;
|
||||
FN_MEDIUM_WRITESECTORS writeSectors ;
|
||||
FN_MEDIUM_CLEARSTATUS clearStatus ;
|
||||
FN_MEDIUM_SHUTDOWN shutdown ;
|
||||
} ;
|
||||
|
||||
typedef struct DISC_INTERFACE_STRUCT DISC_INTERFACE ;
|
||||
#endif
|
||||
|
||||
extern const DISC_INTERFACE IOSUHAX_sdio_disc_interface;
|
||||
extern const DISC_INTERFACE IOSUHAX_usb_disc_interface;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2016
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#ifndef _IOSUHAX_DISC_INTERFACE_H_
|
||||
#define _IOSUHAX_DISC_INTERFACE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DEVICE_TYPE_WII_U_SD (('W'<<24)|('U'<<16)|('S'<<8)|'D')
|
||||
#define DEVICE_TYPE_WII_U_USB (('W'<<24)|('U'<<16)|('S'<<8)|'B')
|
||||
#define FEATURE_WII_U_SD 0x00001000
|
||||
#define FEATURE_WII_U_USB 0x00002000
|
||||
|
||||
#ifndef OGC_DISC_IO_INCLUDE
|
||||
typedef uint32_t sec_t;
|
||||
|
||||
#define FEATURE_MEDIUM_CANREAD 0x00000001
|
||||
#define FEATURE_MEDIUM_CANWRITE 0x00000002
|
||||
|
||||
typedef bool (* FN_MEDIUM_STARTUP)(void) ;
|
||||
typedef bool (* FN_MEDIUM_ISINSERTED)(void) ;
|
||||
typedef bool (* FN_MEDIUM_READSECTORS)(uint32_t sector, uint32_t numSectors, void* buffer) ;
|
||||
typedef bool (* FN_MEDIUM_WRITESECTORS)(uint32_t sector, uint32_t numSectors, const void* buffer) ;
|
||||
typedef bool (* FN_MEDIUM_CLEARSTATUS)(void) ;
|
||||
typedef bool (* FN_MEDIUM_SHUTDOWN)(void) ;
|
||||
|
||||
struct DISC_INTERFACE_STRUCT {
|
||||
unsigned long ioType ;
|
||||
unsigned long features ;
|
||||
FN_MEDIUM_STARTUP startup ;
|
||||
FN_MEDIUM_ISINSERTED isInserted ;
|
||||
FN_MEDIUM_READSECTORS readSectors ;
|
||||
FN_MEDIUM_WRITESECTORS writeSectors ;
|
||||
FN_MEDIUM_CLEARSTATUS clearStatus ;
|
||||
FN_MEDIUM_SHUTDOWN shutdown ;
|
||||
} ;
|
||||
|
||||
typedef struct DISC_INTERFACE_STRUCT DISC_INTERFACE ;
|
||||
#endif
|
||||
|
||||
extern const DISC_INTERFACE IOSUHAX_sdio_disc_interface;
|
||||
extern const DISC_INTERFACE IOSUHAX_usb_disc_interface;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
51
deps/libiosuhax/os_functions.h
vendored
51
deps/libiosuhax/os_functions.h
vendored
@ -1,51 +0,0 @@
|
||||
#ifndef __OS_FUNCTIONS_H_
|
||||
#define __OS_FUNCTIONS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OS_MUTEX_SIZE 44
|
||||
|
||||
// RetroArch mod: use existing headers; prevents conflicts in griffin
|
||||
#include <wiiu/os.h>
|
||||
#include <wiiu/ios.h>
|
||||
#if 0
|
||||
|
||||
#ifndef __WUT__
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Mutex functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern void (* OSInitMutex)(void* mutex);
|
||||
extern void (* OSLockMutex)(void* mutex);
|
||||
extern void (* OSUnlockMutex)(void* mutex);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! IOS function
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern int (*IOS_Ioctl)(int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len);
|
||||
extern int (*IOS_Open)(char *path, unsigned int mode);
|
||||
extern int (*IOS_Close)(int fd);
|
||||
#else
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Mutex functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern void OSInitMutex(void* mutex);
|
||||
extern void OSLockMutex(void* mutex);
|
||||
extern void OSUnlockMutex(void* mutex);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! IOS function
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern int IOS_Ioctl(int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len);
|
||||
extern int IOS_Open(char *path, unsigned int mode);
|
||||
extern int IOS_Close(int fd);
|
||||
#endif // __WUT__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // 0
|
||||
|
||||
#endif // __OS_FUNCTIONS_H_
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,262 +1,262 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2016
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include "iosuhax.h"
|
||||
#include "iosuhax_disc_interface.h"
|
||||
|
||||
#define FSA_REF_SD 0x01
|
||||
#define FSA_REF_USB 0x02
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
static int fsaFdSd = 0;
|
||||
static int fsaFdUsb = 0;
|
||||
static int sdioFd = 0;
|
||||
static int usbFd = 0;
|
||||
|
||||
static void IOSUHAX_disc_io_initialize(void)
|
||||
{
|
||||
if(initialized == 0)
|
||||
{
|
||||
initialized = 1;
|
||||
fsaFdSd = -1;
|
||||
fsaFdUsb = -1;
|
||||
sdioFd = -1;
|
||||
usbFd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static bool IOSUHAX_disc_io_fsa_open(int fsaFd)
|
||||
{
|
||||
IOSUHAX_disc_io_initialize();
|
||||
|
||||
if(IOSUHAX_Open(NULL) < 0)
|
||||
return false;
|
||||
|
||||
if(fsaFd == FSA_REF_SD)
|
||||
{
|
||||
if(fsaFdSd < 0)
|
||||
{
|
||||
fsaFdSd = IOSUHAX_FSA_Open();
|
||||
}
|
||||
|
||||
if(fsaFdSd >= 0)
|
||||
return true;
|
||||
}
|
||||
else if(fsaFd == FSA_REF_USB)
|
||||
{
|
||||
if(fsaFdUsb < 0)
|
||||
{
|
||||
fsaFdUsb = IOSUHAX_FSA_Open();
|
||||
}
|
||||
|
||||
if(fsaFdUsb >= 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void IOSUHAX_disc_io_fsa_close(int fsaFd)
|
||||
{
|
||||
if(fsaFd == FSA_REF_SD)
|
||||
{
|
||||
if(fsaFdSd >= 0)
|
||||
{
|
||||
IOSUHAX_FSA_Close(fsaFdSd);
|
||||
fsaFdSd = -1;
|
||||
}
|
||||
}
|
||||
else if(fsaFd == FSA_REF_USB)
|
||||
{
|
||||
if(fsaFdUsb >= 0)
|
||||
{
|
||||
IOSUHAX_FSA_Close(fsaFdUsb);
|
||||
fsaFdUsb = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_startup(void)
|
||||
{
|
||||
if(!IOSUHAX_disc_io_fsa_open(FSA_REF_SD))
|
||||
return false;
|
||||
|
||||
if(sdioFd < 0)
|
||||
{
|
||||
int res = IOSUHAX_FSA_RawOpen(fsaFdSd, "/dev/sdcard01", &sdioFd);
|
||||
if(res < 0)
|
||||
{
|
||||
IOSUHAX_disc_io_fsa_close(FSA_REF_SD);
|
||||
sdioFd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return (sdioFd >= 0);
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_isInserted(void)
|
||||
{
|
||||
//! TODO: check for SD card inserted with IOSUHAX_FSA_GetDeviceInfo()
|
||||
return initialized && (fsaFdSd >= 0) && (sdioFd >= 0);
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_clearStatus(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_shutdown(void)
|
||||
{
|
||||
if(!IOSUHAX_sdio_isInserted())
|
||||
return false;
|
||||
|
||||
IOSUHAX_FSA_RawClose(fsaFdSd, sdioFd);
|
||||
IOSUHAX_disc_io_fsa_close(FSA_REF_SD);
|
||||
sdioFd = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_readSectors(uint32_t sector, uint32_t numSectors, void* buffer)
|
||||
{
|
||||
if(!IOSUHAX_sdio_isInserted() || !buffer)
|
||||
return false;
|
||||
|
||||
int res = IOSUHAX_FSA_RawRead(fsaFdSd, buffer, 512, numSectors, sector, sdioFd);
|
||||
if(res < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_writeSectors(uint32_t sector, uint32_t numSectors, const void* buffer)
|
||||
{
|
||||
if(!IOSUHAX_sdio_isInserted() || !buffer)
|
||||
return false;
|
||||
|
||||
int res = IOSUHAX_FSA_RawWrite(fsaFdSd, buffer, 512, numSectors, sector, sdioFd);
|
||||
if(res < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const DISC_INTERFACE IOSUHAX_sdio_disc_interface =
|
||||
{
|
||||
DEVICE_TYPE_WII_U_SD,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_U_SD,
|
||||
IOSUHAX_sdio_startup,
|
||||
IOSUHAX_sdio_isInserted,
|
||||
IOSUHAX_sdio_readSectors,
|
||||
IOSUHAX_sdio_writeSectors,
|
||||
IOSUHAX_sdio_clearStatus,
|
||||
IOSUHAX_sdio_shutdown
|
||||
};
|
||||
|
||||
static bool IOSUHAX_usb_startup(void)
|
||||
{
|
||||
if(!IOSUHAX_disc_io_fsa_open(FSA_REF_USB))
|
||||
return false;
|
||||
|
||||
if(usbFd < 0)
|
||||
{
|
||||
int res = IOSUHAX_FSA_RawOpen(fsaFdUsb, "/dev/usb01", &usbFd);
|
||||
if(res < 0)
|
||||
{
|
||||
res = IOSUHAX_FSA_RawOpen(fsaFdUsb, "/dev/usb02", &usbFd);
|
||||
if(res < 0)
|
||||
{
|
||||
IOSUHAX_disc_io_fsa_close(FSA_REF_USB);
|
||||
usbFd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (usbFd >= 0);
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_isInserted(void)
|
||||
{
|
||||
return initialized && (fsaFdUsb >= 0) && (usbFd >= 0);
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_clearStatus(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_shutdown(void)
|
||||
{
|
||||
if(!IOSUHAX_usb_isInserted())
|
||||
return false;
|
||||
|
||||
IOSUHAX_FSA_RawClose(fsaFdUsb, usbFd);
|
||||
IOSUHAX_disc_io_fsa_close(FSA_REF_USB);
|
||||
usbFd = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_readSectors(uint32_t sector, uint32_t numSectors, void* buffer)
|
||||
{
|
||||
if(!IOSUHAX_usb_isInserted() || !buffer)
|
||||
return false;
|
||||
|
||||
int res = IOSUHAX_FSA_RawRead(fsaFdUsb, buffer, 512, numSectors, sector, usbFd);
|
||||
if(res < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_writeSectors(uint32_t sector, uint32_t numSectors, const void* buffer)
|
||||
{
|
||||
if(!IOSUHAX_usb_isInserted() || !buffer)
|
||||
return false;
|
||||
|
||||
int res = IOSUHAX_FSA_RawWrite(fsaFdUsb, buffer, 512, numSectors, sector, usbFd);
|
||||
if(res < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const DISC_INTERFACE IOSUHAX_usb_disc_interface =
|
||||
{
|
||||
DEVICE_TYPE_WII_U_USB,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_U_USB,
|
||||
IOSUHAX_usb_startup,
|
||||
IOSUHAX_usb_isInserted,
|
||||
IOSUHAX_usb_readSectors,
|
||||
IOSUHAX_usb_writeSectors,
|
||||
IOSUHAX_usb_clearStatus,
|
||||
IOSUHAX_usb_shutdown
|
||||
};
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2016
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include "iosuhax.h"
|
||||
#include "iosuhax_disc_interface.h"
|
||||
|
||||
#define FSA_REF_SD 0x01
|
||||
#define FSA_REF_USB 0x02
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
static int fsaFdSd = 0;
|
||||
static int fsaFdUsb = 0;
|
||||
static int sdioFd = 0;
|
||||
static int usbFd = 0;
|
||||
|
||||
static void IOSUHAX_disc_io_initialize(void)
|
||||
{
|
||||
if(initialized == 0)
|
||||
{
|
||||
initialized = 1;
|
||||
fsaFdSd = -1;
|
||||
fsaFdUsb = -1;
|
||||
sdioFd = -1;
|
||||
usbFd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static bool IOSUHAX_disc_io_fsa_open(int fsaFd)
|
||||
{
|
||||
IOSUHAX_disc_io_initialize();
|
||||
|
||||
if(IOSUHAX_Open(NULL) < 0)
|
||||
return false;
|
||||
|
||||
if(fsaFd == FSA_REF_SD)
|
||||
{
|
||||
if(fsaFdSd < 0)
|
||||
{
|
||||
fsaFdSd = IOSUHAX_FSA_Open();
|
||||
}
|
||||
|
||||
if(fsaFdSd >= 0)
|
||||
return true;
|
||||
}
|
||||
else if(fsaFd == FSA_REF_USB)
|
||||
{
|
||||
if(fsaFdUsb < 0)
|
||||
{
|
||||
fsaFdUsb = IOSUHAX_FSA_Open();
|
||||
}
|
||||
|
||||
if(fsaFdUsb >= 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void IOSUHAX_disc_io_fsa_close(int fsaFd)
|
||||
{
|
||||
if(fsaFd == FSA_REF_SD)
|
||||
{
|
||||
if(fsaFdSd >= 0)
|
||||
{
|
||||
IOSUHAX_FSA_Close(fsaFdSd);
|
||||
fsaFdSd = -1;
|
||||
}
|
||||
}
|
||||
else if(fsaFd == FSA_REF_USB)
|
||||
{
|
||||
if(fsaFdUsb >= 0)
|
||||
{
|
||||
IOSUHAX_FSA_Close(fsaFdUsb);
|
||||
fsaFdUsb = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_startup(void)
|
||||
{
|
||||
if(!IOSUHAX_disc_io_fsa_open(FSA_REF_SD))
|
||||
return false;
|
||||
|
||||
if(sdioFd < 0)
|
||||
{
|
||||
int res = IOSUHAX_FSA_RawOpen(fsaFdSd, "/dev/sdcard01", &sdioFd);
|
||||
if(res < 0)
|
||||
{
|
||||
IOSUHAX_disc_io_fsa_close(FSA_REF_SD);
|
||||
sdioFd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return (sdioFd >= 0);
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_isInserted(void)
|
||||
{
|
||||
//! TODO: check for SD card inserted with IOSUHAX_FSA_GetDeviceInfo()
|
||||
return initialized && (fsaFdSd >= 0) && (sdioFd >= 0);
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_clearStatus(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_shutdown(void)
|
||||
{
|
||||
if(!IOSUHAX_sdio_isInserted())
|
||||
return false;
|
||||
|
||||
IOSUHAX_FSA_RawClose(fsaFdSd, sdioFd);
|
||||
IOSUHAX_disc_io_fsa_close(FSA_REF_SD);
|
||||
sdioFd = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_readSectors(uint32_t sector, uint32_t numSectors, void* buffer)
|
||||
{
|
||||
if(!IOSUHAX_sdio_isInserted())
|
||||
return false;
|
||||
|
||||
int res = IOSUHAX_FSA_RawRead(fsaFdSd, buffer, 512, numSectors, sector, sdioFd);
|
||||
if(res < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_sdio_writeSectors(uint32_t sector, uint32_t numSectors, const void* buffer)
|
||||
{
|
||||
if(!IOSUHAX_sdio_isInserted())
|
||||
return false;
|
||||
|
||||
int res = IOSUHAX_FSA_RawWrite(fsaFdSd, buffer, 512, numSectors, sector, sdioFd);
|
||||
if(res < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const DISC_INTERFACE IOSUHAX_sdio_disc_interface =
|
||||
{
|
||||
DEVICE_TYPE_WII_U_SD,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_U_SD,
|
||||
IOSUHAX_sdio_startup,
|
||||
IOSUHAX_sdio_isInserted,
|
||||
IOSUHAX_sdio_readSectors,
|
||||
IOSUHAX_sdio_writeSectors,
|
||||
IOSUHAX_sdio_clearStatus,
|
||||
IOSUHAX_sdio_shutdown
|
||||
};
|
||||
|
||||
static bool IOSUHAX_usb_startup(void)
|
||||
{
|
||||
if(!IOSUHAX_disc_io_fsa_open(FSA_REF_USB))
|
||||
return false;
|
||||
|
||||
if(usbFd < 0)
|
||||
{
|
||||
int res = IOSUHAX_FSA_RawOpen(fsaFdUsb, "/dev/usb01", &usbFd);
|
||||
if(res < 0)
|
||||
{
|
||||
res = IOSUHAX_FSA_RawOpen(fsaFdUsb, "/dev/usb02", &usbFd);
|
||||
if(res < 0)
|
||||
{
|
||||
IOSUHAX_disc_io_fsa_close(FSA_REF_USB);
|
||||
usbFd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (usbFd >= 0);
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_isInserted(void)
|
||||
{
|
||||
return initialized && (fsaFdUsb >= 0) && (usbFd >= 0);
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_clearStatus(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_shutdown(void)
|
||||
{
|
||||
if(!IOSUHAX_usb_isInserted())
|
||||
return false;
|
||||
|
||||
IOSUHAX_FSA_RawClose(fsaFdUsb, usbFd);
|
||||
IOSUHAX_disc_io_fsa_close(FSA_REF_USB);
|
||||
usbFd = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_readSectors(uint32_t sector, uint32_t numSectors, void* buffer)
|
||||
{
|
||||
if(!IOSUHAX_usb_isInserted())
|
||||
return false;
|
||||
|
||||
int res = IOSUHAX_FSA_RawRead(fsaFdUsb, buffer, 512, numSectors, sector, usbFd);
|
||||
if(res < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IOSUHAX_usb_writeSectors(uint32_t sector, uint32_t numSectors, const void* buffer)
|
||||
{
|
||||
if(!IOSUHAX_usb_isInserted())
|
||||
return false;
|
||||
|
||||
int res = IOSUHAX_FSA_RawWrite(fsaFdUsb, buffer, 512, numSectors, sector, usbFd);
|
||||
if(res < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const DISC_INTERFACE IOSUHAX_usb_disc_interface =
|
||||
{
|
||||
DEVICE_TYPE_WII_U_USB,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_U_USB,
|
||||
IOSUHAX_usb_startup,
|
||||
IOSUHAX_usb_isInserted,
|
||||
IOSUHAX_usb_readSectors,
|
||||
IOSUHAX_usb_writeSectors,
|
||||
IOSUHAX_usb_clearStatus,
|
||||
IOSUHAX_usb_shutdown
|
||||
};
|
28
deps/libiosuhax/source/os_functions.h
vendored
Normal file
28
deps/libiosuhax/source/os_functions.h
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef __OS_FUNCTIONS_H_
|
||||
#define __OS_FUNCTIONS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OS_MUTEX_SIZE 44
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Mutex functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern void OSInitMutex(void* mutex);
|
||||
extern void OSLockMutex(void* mutex);
|
||||
extern void OSUnlockMutex(void* mutex);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! IOS function
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern int IOS_Ioctl(int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len);
|
||||
extern int IOS_Open(char *path, unsigned int mode);
|
||||
extern int IOS_Close(int fd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __OS_FUNCTIONS_H_
|
@ -1515,9 +1515,9 @@ DEPENDENCIES
|
||||
#endif
|
||||
|
||||
#ifdef WANT_IOSUHAX
|
||||
#include "../deps/libiosuhax/iosuhax.c"
|
||||
#include "../deps/libiosuhax/iosuhax_devoptab.c"
|
||||
#include "../deps/libiosuhax/iosuhax_disc_interface.c"
|
||||
#include "../deps/libiosuhax/source/iosuhax.c"
|
||||
#include "../deps/libiosuhax/source/iosuhax_devoptab.c"
|
||||
#include "../deps/libiosuhax/source/iosuhax_disc_interface.c"
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user