- added support for libfat

- changed to mount sd with libfat which is way faster on writing
- added mount of FAT32 USB devices
This commit is contained in:
dimok789 2016-11-28 18:03:30 +01:00
parent 872da4d912
commit db44c67206
4 changed files with 45 additions and 23 deletions

View File

@ -44,9 +44,9 @@ INCLUDES := src
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
-O3 -D__wiiu__ -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
-O3 -D__wiiu__ -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
ASFLAGS := -mregnames
LDFLAGS := -nostartfiles -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,--gc-sections
@ -56,7 +56,7 @@ MAKEFLAGS += --no-print-directory
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lgcc -lgd -lpng -lz -lfreetype -lvorbisidec -liosuhax
LIBS := -lgcc -lgd -lpng -lz -lfreetype -lvorbisidec -lfat -liosuhax
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
@ -115,7 +115,7 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB) -L$(PORTLIBS)/lib
-L$(PORTLIBS)/lib
export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean install

View File

@ -3,8 +3,10 @@
#include <stdlib.h>
#include <malloc.h>
#include <gctypes.h>
#include <fat.h>
#include <iosuhax.h>
#include <iosuhax_devoptab.h>
#include <iosuhax_disc_interface.h>
#include "dynamic_libs/os_functions.h"
#include "dynamic_libs/fs_functions.h"
#include "dynamic_libs/gx2_functions.h"
@ -110,18 +112,26 @@ int Menu_Main(void)
//! Initialize FS *
//!*******************************************************************
log_printf("Mount SD partition\n");
mount_sd_fat("sd");
int res = IOSUHAX_Open();
int fsaFd = -1;
int iosuhaxMount = 0;
int res = IOSUHAX_Open(NULL);
if(res < 0)
{
log_printf("IOSUHAX_open failed\n");
mount_sd_fat("sd");
}
int fsaFd = IOSUHAX_FSA_Open();
if(fsaFd < 0)
else
{
log_printf("IOSUHAX_FSA_Open failed\n");
iosuhaxMount = 1;
fatInitDefault();
fsaFd = IOSUHAX_FSA_Open();
if(fsaFd < 0)
{
log_printf("IOSUHAX_FSA_Open failed\n");
}
}
mount_fs("slccmpt01", fsaFd, "/dev/slccmpt01", "/vol/storage_slccmpt01");
@ -217,18 +227,29 @@ int Menu_Main(void)
//!*******************************************************************
log_printf("Unmount SD\n");
unmount_sd_fat("sd");
unmount_fs("slccmpt01");
unmount_fs("storage_odd_tickets");
unmount_fs("storage_odd_updates");
unmount_fs("storage_odd_content");
unmount_fs("storage_odd_content2");
unmount_fs("storage_slc");
unmount_fs("storage_mlc");
unmount_fs("storage_usb");
IOSUHAX_FSA_Close(fsaFd);
IOSUHAX_Close();
if(iosuhaxMount)
{
fatUnmount("sd");
fatUnmount("usb");
IOSUHAX_sdio_disc_interface.shutdown();
IOSUHAX_usb_disc_interface.shutdown();
unmount_fs("slccmpt01");
unmount_fs("storage_odd_tickets");
unmount_fs("storage_odd_updates");
unmount_fs("storage_odd_content");
unmount_fs("storage_odd_content2");
unmount_fs("storage_slc");
unmount_fs("storage_mlc");
unmount_fs("storage_usb");
IOSUHAX_FSA_Close(fsaFd);
IOSUHAX_Close();
}
else
{
unmount_sd_fat("sd:/");
}
log_printf("Release memory\n");
//memoryRelease();

View File

@ -34,9 +34,9 @@ misrepresented as being the original software.
#include "dynamic_libs/socket_functions.h"
#include "net.h"
#define MAX_NET_BUFFER_SIZE (60*1024)
#define MAX_NET_BUFFER_SIZE (64*1024)
#define MIN_NET_BUFFER_SIZE 4096
#define FREAD_BUFFER_SIZE (60*1024)
#define FREAD_BUFFER_SIZE (64*1024)
extern u32 hostIpAddress;

View File

@ -102,6 +102,7 @@ void MountVirtualDevices()
VirtualMountDevice("storage_slc:/");
VirtualMountDevice("storage_mlc:/");
VirtualMountDevice("storage_usb:/");
VirtualMountDevice("usb:/");
}
void UnmountVirtualPaths()