mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2024-11-04 18:05:08 +01:00
[General] Moving the FS-wrapper into an own lib, no more macro madness
The library now needs to be build with "make" and installed with "make install". Make sure to include the -lwups into the plugin projecs. If you call "WUPS_InitFS(args);" in the INITIALIZE method, the plugin has full SD/USB access.
This commit is contained in:
parent
1cfa474ca9
commit
797e58f576
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ plugins/*/bin/*
|
||||
plugins/*/build/*
|
||||
loader/WiiUPluginLoader.cscope_file_list
|
||||
loader/WiiUPluginLoader.layout
|
||||
release/*
|
||||
|
||||
*.mod
|
||||
*.cbp
|
||||
|
@ -52,7 +52,7 @@ install:
|
||||
- (cd controller_patcher-master && make -j8 && make install)
|
||||
|
||||
script:
|
||||
- make
|
||||
- make && make install
|
||||
- (cd loader && make)
|
||||
- (cd plugins && make)
|
||||
|
||||
|
127
Makefile
127
Makefile
@ -1,15 +1,101 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
DO_LOGGING := 0
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
|
||||
endif
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
|
||||
|
||||
include $(DEVKITPPC)/wii_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
|
||||
# LIBDIR is where the built library will be placed
|
||||
# all directories are relative to this makefile
|
||||
#---------------------------------------------------------------------------------
|
||||
BUILD ?= release
|
||||
SOURCES := src
|
||||
|
||||
INCLUDES := src \
|
||||
wups_include
|
||||
DATA :=
|
||||
LIB := lib
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS = -g -Os -Wall -D__wiiu__ -D_GNU_SOURCE $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
ifeq ($(DO_LOGGING), 1)
|
||||
CFLAGS += -D__LOGGING__
|
||||
CXXFLAGS += -D__LOGGING__
|
||||
endif
|
||||
|
||||
ASFLAGS := -mregnames
|
||||
|
||||
export WIIUBIN := $(LIB)/libwups.a
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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 :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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 INCLUDEDIR := $(PORTLIBS)/include/libgui
|
||||
|
||||
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)))
|
||||
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) $(sFILES:.s=.o)
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include)
|
||||
|
||||
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)
|
||||
|
||||
WUPSDIR := $(DEVKITPRO)/wups
|
||||
|
||||
# Rule to install wups.
|
||||
@ -17,11 +103,32 @@ PHONY += install
|
||||
install : wups.ld wups_elf.ld
|
||||
$(addprefix $Qrm -rf ,$(wildcard $(WUPSDIR)))
|
||||
$Qmkdir $(WUPSDIR)
|
||||
$Qmkdir $(WUPSDIR)/lib/
|
||||
$Qcp -r wups_include $(WUPSDIR)/include
|
||||
$Qcp -r wups.ld $(WUPSDIR)
|
||||
$Qcp -r wups_elf.ld $(WUPSDIR)
|
||||
|
||||
# Rule to install wups.
|
||||
PHONY += uninstall
|
||||
uninstall :
|
||||
$(addprefix $Qrm -rf ,$(wildcard $(WUPSDIR)))
|
||||
@cp $(BUILD)/lib/libwups.a $(WUPSDIR)/lib/
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
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
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -96,7 +96,7 @@ MAKEFLAGS += --no-print-directory
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lutils -ldynamiclibs
|
||||
LIBS := -lwups -lutils -ldynamiclibs
|
||||
#
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -153,7 +153,8 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(PORTLIBS)/lib
|
||||
-L$(PORTLIBS)/lib \
|
||||
-L$(WUPSDIR)/lib
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean install
|
||||
|
@ -99,7 +99,7 @@ MAKEFLAGS += --no-print-directory
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lcontrollerpatcher -lutils -ldynamiclibs
|
||||
LIBS := -lwups -lcontrollerpatcher -lutils -ldynamiclibs
|
||||
#
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -156,7 +156,8 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(PORTLIBS)/lib
|
||||
-L$(PORTLIBS)/lib \
|
||||
-L$(WUPSDIR)/lib
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean install
|
||||
|
@ -97,7 +97,7 @@ MAKEFLAGS += --no-print-directory
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lutils -ldynamiclibs
|
||||
LIBS := -lwups -lutils -ldynamiclibs
|
||||
#
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -154,7 +154,8 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(PORTLIBS)/lib
|
||||
-L$(PORTLIBS)/lib \
|
||||
-L$(WUPSDIR)/lib
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean install
|
||||
|
@ -100,7 +100,7 @@ MAKEFLAGS += --no-print-directory
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -liosuhax -lfswrapper -lutils -ldynamiclibs
|
||||
LIBS := -lwups -liosuhax -lfswrapper -lutils -ldynamiclibs
|
||||
#
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -152,13 +152,14 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include \
|
||||
-I$(PORTLIBS)/include/libutils -I$(PORTLIBS)/include/libfswrapper \
|
||||
-I$(WUPSDIR)/include
|
||||
-I$(WUPSDIR)/include
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(PORTLIBS)/lib
|
||||
-L$(PORTLIBS)/lib \
|
||||
-L$(WUPSDIR)/lib
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: all $(BUILD) clean install
|
||||
|
@ -20,6 +20,7 @@ WUPS_MODULE_AUTHOR("Maschell");
|
||||
WUPS_MODULE_LICENSE("GPL");
|
||||
|
||||
INITIALIZE(args){
|
||||
WUPS_InitFS(args);
|
||||
InitOSFunctionPointers();
|
||||
InitSocketFunctionPointers(); //For logging
|
||||
InitVPadFunctionPointers(); //For logging
|
||||
|
@ -99,7 +99,7 @@ MAKEFLAGS += --no-print-directory
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lutils -ldynamiclibs
|
||||
LIBS := -lwups -lutils -ldynamiclibs
|
||||
#
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -156,7 +156,8 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(PORTLIBS)/lib
|
||||
-L$(PORTLIBS)/lib \
|
||||
-L$(WUPSDIR)/lib
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean install
|
||||
|
92
src/fs_function_wrapper.c
Normal file
92
src/fs_function_wrapper.c
Normal file
@ -0,0 +1,92 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <wups.h>
|
||||
|
||||
static void * new_open_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_close_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_write_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_read_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_lseek_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_stat_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_fstat_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_opendir_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_closedir_ptr __attribute__((section(".data"))) = NULL;
|
||||
static void * new_readdir_ptr __attribute__((section(".data"))) = NULL;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void WUPS_InitFS(wups_loader_init_args_t* args){
|
||||
if(args != NULL){
|
||||
new_open_ptr = (void*) args->fs_wrapper.open_repl;
|
||||
new_close_ptr = (void*) args->fs_wrapper.close_repl;
|
||||
new_write_ptr = (void*) args->fs_wrapper.write_repl;
|
||||
new_read_ptr = (void*) args->fs_wrapper.read_repl;
|
||||
new_lseek_ptr = (void*) args->fs_wrapper.lseek_repl;
|
||||
new_stat_ptr = (void*) args->fs_wrapper.stat_repl;
|
||||
new_fstat_ptr = (void*) args->fs_wrapper.fstat_repl;
|
||||
new_opendir_ptr = (void*) args->fs_wrapper.opendir_repl;
|
||||
new_closedir_ptr = (void*) args->fs_wrapper.closedir_repl;
|
||||
new_readdir_ptr = (void*) args->fs_wrapper.readdir_repl;
|
||||
}
|
||||
}
|
||||
|
||||
int __real_open(const char *pathname, int flags);
|
||||
int __wrap_open(const char *pathname, int flags){
|
||||
if(new_open_ptr == NULL) return __real_open(pathname,flags);
|
||||
return ( (int (*)(const char *,int))((unsigned int*)new_open_ptr) )(pathname,flags);
|
||||
}
|
||||
int __real_close(int fd);
|
||||
int __wrap_close(int fd){
|
||||
if(new_close_ptr == NULL) return __real_close(fd);
|
||||
return ( (int (*)(int))((unsigned int*)new_close_ptr) )(fd);
|
||||
}
|
||||
ssize_t __real_write(int fd, const void *buf, size_t count);
|
||||
ssize_t __wrap_write(int fd, const void *buf, size_t count){
|
||||
if(new_write_ptr == NULL) return __real_write(fd,buf,count);
|
||||
return ( (ssize_t (*)(int, const void *, size_t))((unsigned int*)new_write_ptr) )(fd,buf,count);
|
||||
}
|
||||
ssize_t __real_read(int fd, const void *buf, size_t count);
|
||||
ssize_t __wrap_read(int fd, const void *buf, size_t count){
|
||||
if(new_read_ptr == NULL) return __real_read(fd,buf,count);
|
||||
return ( (ssize_t (*)(int, const void *, size_t))((unsigned int*)new_read_ptr) )(fd,buf,count);
|
||||
}
|
||||
off_t __real_lseek(int fd, off_t offset, int whence);
|
||||
off_t __wrap_lseek(int fd, off_t offset, int whence){
|
||||
if(new_lseek_ptr == NULL) return __real_lseek(fd, offset, whence);
|
||||
return ( (off_t (*)(int, off_t, int))((unsigned int*)new_lseek_ptr) )(fd, offset, whence);
|
||||
}
|
||||
int __real_stat(const char *pathname, struct stat *statbuf);
|
||||
int __wrap_stat(const char *pathname, struct stat *statbuf){
|
||||
if(new_stat_ptr == NULL) return __real_stat(pathname,statbuf);
|
||||
return ( (int (*)(const char *, struct stat *))((unsigned int*)new_stat_ptr) )(pathname,statbuf);
|
||||
}
|
||||
int __real_fstat(int fd, struct stat *statbuf);
|
||||
int __wrap_fstat(int fd, struct stat *statbuf){
|
||||
if(new_fstat_ptr == NULL) return __real_fstat(fd,statbuf);
|
||||
return ( (int (*)(int, struct stat *))((unsigned int*)new_fstat_ptr) )(fd,statbuf);
|
||||
}
|
||||
DIR* __real_opendir(const char * arg);
|
||||
DIR* __wrap_opendir(const char * arg){
|
||||
if(new_opendir_ptr == NULL) return __real_opendir(arg);
|
||||
return ( (DIR* (*)(const char *))((unsigned int*)new_opendir_ptr) )(arg);
|
||||
}
|
||||
int __real_closedir(DIR *dirp);
|
||||
int __wrap_closedir(DIR *dirp){
|
||||
if(new_closedir_ptr == NULL) return __real_closedir(dirp);
|
||||
return ( (int (*)(DIR *))((unsigned int*)new_closedir_ptr) )(dirp);
|
||||
}
|
||||
struct dirent * __real_readdir(DIR *dirp);
|
||||
struct dirent * __wrap_readdir(DIR *dirp){
|
||||
if(new_readdir_ptr == NULL) return __real_readdir(dirp);
|
||||
return ( (struct dirent * (*)(DIR *))((unsigned int*)new_readdir_ptr) )(dirp);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -113,8 +113,6 @@ typedef enum wups_loader_library_type_t {
|
||||
WUPS_LOADER_LIBRARY_ZLIB125,
|
||||
} wups_loader_library_type_t;
|
||||
|
||||
|
||||
|
||||
typedef enum wups_loader_hook_type_t {
|
||||
WUPS_LOADER_HOOK_INIT_FUNCTION
|
||||
} wups_loader_hook_type_t;
|
||||
@ -173,86 +171,11 @@ typedef struct wups_loader_init_args_t {
|
||||
void init(wups_loader_init_args_t*);\
|
||||
void myInit(wups_loader_init_args_t*);\
|
||||
WUPS_HOOK_INIT(init); \
|
||||
static void * new_open_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_close_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_write_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_read_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_lseek_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_stat_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_fstat_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_opendir_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_closedir_ptr __attribute__((section(".data"))) = NULL; \
|
||||
static void * new_readdir_ptr __attribute__((section(".data"))) = NULL; \
|
||||
void init(wups_loader_init_args_t* args){ \
|
||||
if(args != NULL){\
|
||||
new_open_ptr = (void*) args->fs_wrapper.open_repl; \
|
||||
new_close_ptr = (void*) args->fs_wrapper.close_repl; \
|
||||
new_write_ptr = (void*) args->fs_wrapper.write_repl; \
|
||||
new_read_ptr = (void*) args->fs_wrapper.read_repl; \
|
||||
new_lseek_ptr = (void*) args->fs_wrapper.lseek_repl; \
|
||||
new_stat_ptr = (void*) args->fs_wrapper.stat_repl; \
|
||||
new_fstat_ptr = (void*) args->fs_wrapper.fstat_repl; \
|
||||
new_opendir_ptr = (void*) args->fs_wrapper.opendir_repl; \
|
||||
new_closedir_ptr = (void*) args->fs_wrapper.closedir_repl; \
|
||||
new_readdir_ptr = (void*) args->fs_wrapper.readdir_repl; \
|
||||
}\
|
||||
myInit(args);\
|
||||
} \
|
||||
\
|
||||
EXTERN_C_START \
|
||||
\
|
||||
int __real_open(const char *pathname, int flags);\
|
||||
int __wrap_open(const char *pathname, int flags){\
|
||||
if(new_open_ptr == NULL) return __real_open(pathname,flags); \
|
||||
return ( (int (*)(const char *,int))((unsigned int*)new_open_ptr) )(pathname,flags);\
|
||||
}\
|
||||
int __real_close(int fd);\
|
||||
int __wrap_close(int fd){\
|
||||
if(new_close_ptr == NULL) return __real_close(fd); \
|
||||
return ( (int (*)(int))((unsigned int*)new_close_ptr) )(fd);\
|
||||
}\
|
||||
ssize_t __real_write(int fd, const void *buf, size_t count);\
|
||||
ssize_t __wrap_write(int fd, const void *buf, size_t count){\
|
||||
if(new_write_ptr == NULL) return __real_write(fd,buf,count); \
|
||||
return ( (ssize_t (*)(int, const void *, size_t))((unsigned int*)new_write_ptr) )(fd,buf,count);\
|
||||
}\
|
||||
ssize_t __real_read(int fd, const void *buf, size_t count);\
|
||||
ssize_t __wrap_read(int fd, const void *buf, size_t count){\
|
||||
if(new_read_ptr == NULL) return __real_read(fd,buf,count); \
|
||||
return ( (ssize_t (*)(int, const void *, size_t))((unsigned int*)new_read_ptr) )(fd,buf,count);\
|
||||
}\
|
||||
off_t __real_lseek(int fd, off_t offset, int whence);\
|
||||
off_t __wrap_lseek(int fd, off_t offset, int whence){\
|
||||
if(new_lseek_ptr == NULL) return __real_lseek(fd, offset, whence); \
|
||||
return ( (off_t (*)(int, off_t, int))((unsigned int*)new_lseek_ptr) )(fd, offset, whence);\
|
||||
}\
|
||||
int __real_stat(const char *pathname, struct stat *statbuf);\
|
||||
int __wrap_stat(const char *pathname, struct stat *statbuf){\
|
||||
if(new_stat_ptr == NULL) return __real_stat(pathname,statbuf); \
|
||||
return ( (int (*)(const char *, struct stat *))((unsigned int*)new_stat_ptr) )(pathname,statbuf);\
|
||||
}\
|
||||
int __real_fstat(int fd, struct stat *statbuf);\
|
||||
int __wrap_fstat(int fd, struct stat *statbuf){\
|
||||
if(new_fstat_ptr == NULL) return __real_fstat(fd,statbuf); \
|
||||
return ( (int (*)(int, struct stat *))((unsigned int*)new_fstat_ptr) )(fd,statbuf);\
|
||||
}\
|
||||
DIR* __real_opendir(const char * arg);\
|
||||
DIR* __wrap_opendir(const char * arg){\
|
||||
if(new_opendir_ptr == NULL) return __real_opendir(arg); \
|
||||
return ( (DIR* (*)(const char *))((unsigned int*)new_opendir_ptr) )(arg);\
|
||||
}\
|
||||
int __real_closedir(DIR *dirp);\
|
||||
int __wrap_closedir(DIR *dirp){\
|
||||
if(new_closedir_ptr == NULL) return __real_closedir(dirp); \
|
||||
return ( (int (*)(DIR *))((unsigned int*)new_closedir_ptr) )(dirp);\
|
||||
}\
|
||||
struct dirent * __real_readdir(DIR *dirp);\
|
||||
struct dirent * __wrap_readdir(DIR *dirp){\
|
||||
if(new_readdir_ptr == NULL) return __real_readdir(dirp); \
|
||||
return ( (struct dirent * (*)(DIR *))((unsigned int*)new_readdir_ptr) )(dirp);\
|
||||
}\
|
||||
\
|
||||
EXTERN_C_END\
|
||||
void myInit(wups_loader_init_args_t* my_args)
|
||||
|
||||
typedef enum wups_loader_entry_type_t {
|
||||
@ -297,6 +220,8 @@ typedef struct wups_loader_entry_t {
|
||||
#define WUPS_MODULE_VERSION(x) WUPS_META(version, x)
|
||||
#define WUPS_MODULE_LICENSE(x) WUPS_META(license, x)
|
||||
|
||||
void WUPS_InitFS(wups_loader_init_args_t* args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user