mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 01:09:16 +01:00
*Fixed support for drives >= 1TB size (and probably some others as well)
*Reworked the USB handle read/write functions *Fixed crash on deleting games *Updated NTFS3G of libntfs to Version 2010.10.02
This commit is contained in:
parent
777e0394d0
commit
71c47c23bb
File diff suppressed because one or more lines are too long
@ -33,8 +33,8 @@
|
|||||||
#ifndef GEKKO
|
#ifndef GEKKO
|
||||||
/* Not on Cygwin; use standard Unix style low level device operations. */
|
/* Not on Cygwin; use standard Unix style low level device operations. */
|
||||||
#define ntfs_device_default_io_ops ntfs_device_unix_io_ops
|
#define ntfs_device_default_io_ops ntfs_device_unix_io_ops
|
||||||
#else /* GEKKO */
|
#else
|
||||||
/* On Nintendo GameCube/Wii; use Gekko low level device operations. */
|
/* Wii i/o device. */
|
||||||
#define ntfs_device_default_io_ops ntfs_device_gekko_io_ops
|
#define ntfs_device_default_io_ops ntfs_device_gekko_io_ops
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -79,3 +79,4 @@ extern struct ntfs_device_operations ntfs_device_default_io_ops;
|
|||||||
#endif /* NO_NTFS_DEVICE_DEFAULT_IO_OPS */
|
#endif /* NO_NTFS_DEVICE_DEFAULT_IO_OPS */
|
||||||
|
|
||||||
#endif /* defined _NTFS_DEVICE_IO_H */
|
#endif /* defined _NTFS_DEVICE_IO_H */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* This program/include file is free software; you can redistribute it and/or
|
* This program/include file is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License as published
|
* modify it under the terms of the GNU General Public License as published
|
||||||
* by the Free Software Foundation; either version 2 of the License, or
|
* by the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program/include file is distributed in the hope that it will be
|
* This program/include file is distributed in the hope that it will be
|
||||||
@ -43,9 +43,7 @@ typedef struct _ntfs_file_state {
|
|||||||
bool compressed; /* True if file data is compressed */
|
bool compressed; /* True if file data is compressed */
|
||||||
bool encrypted; /* True if file data is encryted */
|
bool encrypted; /* True if file data is encryted */
|
||||||
off_t pos; /* Current position within the file (in bytes) */
|
off_t pos; /* Current position within the file (in bytes) */
|
||||||
//size_t len; /* Total length of the file (in bytes) */
|
u64 len; /* Total length of the file (in bytes) */
|
||||||
//size_t is 32 bit, off_t is signed, so use u64 for len!
|
|
||||||
u64 len;
|
|
||||||
struct _ntfs_file_state *prevOpenFile; /* The previous entry in a double-linked FILO list of open files */
|
struct _ntfs_file_state *prevOpenFile; /* The previous entry in a double-linked FILO list of open files */
|
||||||
struct _ntfs_file_state *nextOpenFile; /* The next entry in a double-linked FILO list of open files */
|
struct _ntfs_file_state *nextOpenFile; /* The next entry in a double-linked FILO list of open files */
|
||||||
} ntfs_file_state;
|
} ntfs_file_state;
|
||||||
|
@ -2995,7 +2995,9 @@ int ntfs_set_posix_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
|
|||||||
count = 0;
|
count = 0;
|
||||||
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) != const_cpu_to_le16(0);
|
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) != const_cpu_to_le16(0);
|
||||||
newpxdesc = (struct POSIX_SECURITY*)NULL;
|
newpxdesc = (struct POSIX_SECURITY*)NULL;
|
||||||
if (!deflt || isdir || !size) {
|
if ((!value
|
||||||
|
|| (((const struct POSIX_ACL*)value)->version == POSIX_VERSION))
|
||||||
|
&& (!deflt || isdir || (!size && !value))) {
|
||||||
cached = fetch_cache(scx, ni);
|
cached = fetch_cache(scx, ni);
|
||||||
if (cached) {
|
if (cached) {
|
||||||
uid = cached->uid;
|
uid = cached->uid;
|
||||||
|
@ -166,14 +166,14 @@ struct POSIX_ACE {
|
|||||||
u16 tag;
|
u16 tag;
|
||||||
u16 perms;
|
u16 perms;
|
||||||
s32 id;
|
s32 id;
|
||||||
} ;
|
} __attribute__((__packed__));
|
||||||
|
|
||||||
struct POSIX_ACL {
|
struct POSIX_ACL {
|
||||||
u8 version;
|
u8 version;
|
||||||
u8 flags;
|
u8 flags;
|
||||||
u16 filler;
|
u16 filler;
|
||||||
struct POSIX_ACE ace[0];
|
struct POSIX_ACE ace[0];
|
||||||
} ;
|
} __attribute__((__packed__));
|
||||||
|
|
||||||
struct POSIX_SECURITY {
|
struct POSIX_SECURITY {
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
@ -830,12 +830,15 @@ int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs,
|
|||||||
int outs_len)
|
int outs_len)
|
||||||
{
|
{
|
||||||
char *mbs;
|
char *mbs;
|
||||||
|
int mbs_len;
|
||||||
|
#ifdef MB_CUR_MAX
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
int i, o, mbs_len;
|
int i, o;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
#ifdef HAVE_MBSINIT
|
#ifdef HAVE_MBSINIT
|
||||||
mbstate_t mbstate;
|
mbstate_t mbstate;
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* MB_CUR_MAX */
|
||||||
|
|
||||||
if (!ins || !outs) {
|
if (!ins || !outs) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@ -849,6 +852,7 @@ int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs,
|
|||||||
}
|
}
|
||||||
if (use_utf8)
|
if (use_utf8)
|
||||||
return ntfs_utf16_to_utf8(ins, ins_len, outs, outs_len);
|
return ntfs_utf16_to_utf8(ins, ins_len, outs, outs_len);
|
||||||
|
#ifdef MB_CUR_MAX
|
||||||
if (!mbs) {
|
if (!mbs) {
|
||||||
mbs_len = (ins_len + 1) * MB_CUR_MAX;
|
mbs_len = (ins_len + 1) * MB_CUR_MAX;
|
||||||
mbs = ntfs_malloc(mbs_len);
|
mbs = ntfs_malloc(mbs_len);
|
||||||
@ -914,6 +918,9 @@ err_out:
|
|||||||
free(mbs);
|
free(mbs);
|
||||||
errno = eo;
|
errno = eo;
|
||||||
}
|
}
|
||||||
|
#else /* MB_CUR_MAX */
|
||||||
|
errno = EILSEQ;
|
||||||
|
#endif /* MB_CUR_MAX */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,6 +949,7 @@ err_out:
|
|||||||
*/
|
*/
|
||||||
int ntfs_mbstoucs(const char *ins, ntfschar **outs)
|
int ntfs_mbstoucs(const char *ins, ntfschar **outs)
|
||||||
{
|
{
|
||||||
|
#ifdef MB_CUR_MAX
|
||||||
ntfschar *ucs;
|
ntfschar *ucs;
|
||||||
const char *s;
|
const char *s;
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
@ -949,6 +957,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs)
|
|||||||
#ifdef HAVE_MBSINIT
|
#ifdef HAVE_MBSINIT
|
||||||
mbstate_t mbstate;
|
mbstate_t mbstate;
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* MB_CUR_MAX */
|
||||||
|
|
||||||
if (!ins || !outs) {
|
if (!ins || !outs) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@ -958,6 +967,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs)
|
|||||||
if (use_utf8)
|
if (use_utf8)
|
||||||
return ntfs_utf8_to_utf16(ins, outs);
|
return ntfs_utf8_to_utf16(ins, outs);
|
||||||
|
|
||||||
|
#ifdef MB_CUR_MAX
|
||||||
/* Determine the size of the multi-byte string in bytes. */
|
/* Determine the size of the multi-byte string in bytes. */
|
||||||
ins_size = strlen(ins);
|
ins_size = strlen(ins);
|
||||||
/* Determine the length of the multi-byte string. */
|
/* Determine the length of the multi-byte string. */
|
||||||
@ -1047,6 +1057,9 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs)
|
|||||||
return o;
|
return o;
|
||||||
err_out:
|
err_out:
|
||||||
free(ucs);
|
free(ucs);
|
||||||
|
#else /* MB_CUR_MAX */
|
||||||
|
errno = EILSEQ;
|
||||||
|
#endif /* MB_CUR_MAX */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,12 +103,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Loading now the cios setup in the settings
|
// Loading now the cios setup in the settings
|
||||||
IosLoader::LoadAppCios();
|
IosLoader::LoadAppCios();
|
||||||
printf("\tLoaded cIOS = %u (Rev %u)\n", IOS_GetVersion(), IOS_GetRevision());
|
|
||||||
|
|
||||||
// Remount devices after reloading IOS.
|
// Remount devices after reloading IOS.
|
||||||
SDCard_Init();
|
SDCard_Init();
|
||||||
USBDevice_Init_Loop();
|
USBDevice_Init_Loop();
|
||||||
}
|
}
|
||||||
|
printf("\tLoaded cIOS = %u (Rev %u)\n", IOS_GetVersion(), IOS_GetRevision());
|
||||||
|
|
||||||
//if a ID was passed via args copy it and try to boot it after the partition is mounted
|
//if a ID was passed via args copy it and try to boot it after the partition is mounted
|
||||||
//its not really a headless mode. more like hairless.
|
//its not really a headless mode. more like hairless.
|
||||||
|
@ -1510,7 +1510,7 @@ int MenuDiscList()
|
|||||||
else if (Settings.gameDisplay == CAROUSEL_MODE) mainWindow->Append(gameCarousel);
|
else if (Settings.gameDisplay == CAROUSEL_MODE) mainWindow->Append(gameCarousel);
|
||||||
mainWindow->Append(&w);
|
mainWindow->Append(&w);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
if (settret == 1) //if deleted
|
if (settret == MENU_DISCLIST) //if deleted
|
||||||
{
|
{
|
||||||
menu = MENU_DISCLIST;
|
menu = MENU_DISCLIST;
|
||||||
break;
|
break;
|
||||||
|
@ -41,6 +41,7 @@ FlyingButtonsMenu::FlyingButtonsMenu(const char * menu_title)
|
|||||||
{
|
{
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
returnMenu = MENU_NONE;
|
returnMenu = MENU_NONE;
|
||||||
|
ParentMenu = MENU_DISCLIST;
|
||||||
CurrentMenu = NULL;
|
CurrentMenu = NULL;
|
||||||
titleTxt = NULL;
|
titleTxt = NULL;
|
||||||
GoLeftImg = NULL;
|
GoLeftImg = NULL;
|
||||||
@ -390,7 +391,7 @@ int FlyingButtonsMenu::MainLoop()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return MENU_DISCLIST;
|
return ParentMenu;
|
||||||
}
|
}
|
||||||
backBtn->ResetState();
|
backBtn->ResetState();
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,7 @@ class FlyingButtonsMenu : public GuiWindow
|
|||||||
|
|
||||||
int currentPage;
|
int currentPage;
|
||||||
int returnMenu;
|
int returnMenu;
|
||||||
|
int ParentMenu;
|
||||||
std::string MenuTitle;
|
std::string MenuTitle;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,8 @@ GameSettingsMenu::GameSettingsMenu(struct discHdr * header)
|
|||||||
: FlyingButtonsMenu(GameTitles.GetTitle(header))
|
: FlyingButtonsMenu(GameTitles.GetTitle(header))
|
||||||
{
|
{
|
||||||
DiscHeader = header;
|
DiscHeader = header;
|
||||||
|
//! Don't switch menu's by default but return to disc window.
|
||||||
|
ParentMenu = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameSettingsMenu::~GameSettingsMenu()
|
GameSettingsMenu::~GameSettingsMenu()
|
||||||
|
@ -72,7 +72,6 @@ void UninstallSM::SetOptionValues()
|
|||||||
|
|
||||||
//! Settings: Delete Cheat GCT
|
//! Settings: Delete Cheat GCT
|
||||||
Options->SetValue(Idx++, " ");
|
Options->SetValue(Idx++, " ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int UninstallSM::GetMenuInternal()
|
int UninstallSM::GetMenuInternal()
|
||||||
@ -90,6 +89,7 @@ int UninstallSM::GetMenuInternal()
|
|||||||
int choice = WindowPrompt(tr( "Do you really want to delete:" ), GameTitles.GetTitle(DiscHeader), tr( "Yes" ), tr( "Cancel" ));
|
int choice = WindowPrompt(tr( "Do you really want to delete:" ), GameTitles.GetTitle(DiscHeader), tr( "Yes" ), tr( "Cancel" ));
|
||||||
if (choice == 1)
|
if (choice == 1)
|
||||||
{
|
{
|
||||||
|
std::string Title = GameTitles.GetTitle(DiscHeader);
|
||||||
GameSettings.Remove(DiscHeader->id);
|
GameSettings.Remove(DiscHeader->id);
|
||||||
GameSettings.Save();
|
GameSettings.Save();
|
||||||
GameStatistics.Remove(DiscHeader->id);
|
GameStatistics.Remove(DiscHeader->id);
|
||||||
@ -98,9 +98,9 @@ int UninstallSM::GetMenuInternal()
|
|||||||
if(!mountMethod)
|
if(!mountMethod)
|
||||||
ret = WBFS_RemoveGame(DiscHeader->id);
|
ret = WBFS_RemoveGame(DiscHeader->id);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
WindowPrompt(tr( "Can't delete:" ), GameTitles.GetTitle(DiscHeader), tr( "OK" ));
|
WindowPrompt(tr( "Can't delete:" ), Title.c_str(), tr( "OK" ));
|
||||||
else
|
else
|
||||||
WindowPrompt(tr( "Successfully deleted:" ), GameTitles.GetTitle(DiscHeader), tr( "OK" ));
|
WindowPrompt(tr( "Successfully deleted:" ), Title.c_str(), tr( "OK" ));
|
||||||
|
|
||||||
return MENU_DISCLIST;
|
return MENU_DISCLIST;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
#define isMEM2Buffer(p) (((u32) p & 0x10000000) != 0)
|
#define isMEM2Buffer(p) (((u32) p & 0x10000000) != 0)
|
||||||
|
|
||||||
#define MAX_BUFFER_SECTORS 256
|
#define MAX_BUFFER_SECTORS 256
|
||||||
#define UMS_HEAPSIZE 0x8000
|
#define UMS_HEAPSIZE 0x1000
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
static char fs[] ATTRIBUTE_ALIGN(32) = "/dev/usb2";
|
static char fs[] ATTRIBUTE_ALIGN(32) = "/dev/usb2";
|
||||||
@ -93,8 +93,11 @@ s32 USBStorage2_Init(void)
|
|||||||
if (ret < 0) goto err;
|
if (ret < 0) goto err;
|
||||||
|
|
||||||
/* Get device capacity */
|
/* Get device capacity */
|
||||||
ret = USBStorage2_GetCapacity(§or_size);
|
if (USBStorage2_GetCapacity(§or_size) == 0 || sector_size != 512)
|
||||||
if (ret < 0) goto err;
|
{
|
||||||
|
ret = IPC_ENOENT;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
return ret; // 0->HDD, 1->DVD
|
return ret; // 0->HDD, 1->DVD
|
||||||
|
|
||||||
@ -153,8 +156,6 @@ s32 USBStorage2_GetCapacity(u32 *_sector_size)
|
|||||||
s32 USBStorage2_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
s32 USBStorage2_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
||||||
{
|
{
|
||||||
u8 *buf = (u8 *) buffer;
|
u8 *buf = (u8 *) buffer;
|
||||||
u32 len = (sector_size * numSectors);
|
|
||||||
|
|
||||||
s32 ret = -1;
|
s32 ret = -1;
|
||||||
|
|
||||||
/* Device not opened */
|
/* Device not opened */
|
||||||
@ -163,33 +164,34 @@ s32 USBStorage2_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
|||||||
if (!mem2_ptr)
|
if (!mem2_ptr)
|
||||||
mem2_ptr = (u8 *) MEM2_alloc(sector_size * MAX_BUFFER_SECTORS);
|
mem2_ptr = (u8 *) MEM2_alloc(sector_size * MAX_BUFFER_SECTORS);
|
||||||
|
|
||||||
// Do not read more than MAX_BUFFER_SECTORS sectors at once and create a mem overflow!
|
s32 read_secs, read_size;
|
||||||
if (!isMEM2Buffer(buffer))
|
|
||||||
|
while(numSectors > 0)
|
||||||
{
|
{
|
||||||
buf = mem2_ptr;
|
read_secs = numSectors > MAX_BUFFER_SECTORS ? MAX_BUFFER_SECTORS : numSectors;
|
||||||
s32 read_size;
|
read_size = read_secs*sector_size;
|
||||||
s32 sectors_done = 0;
|
|
||||||
|
|
||||||
while(sectors_done < numSectors)
|
// Do not read more than MAX_BUFFER_SECTORS sectors at once and create a mem overflow!
|
||||||
|
if (!isMEM2Buffer(buffer))
|
||||||
{
|
{
|
||||||
read_size = numSectors-sectors_done < MAX_BUFFER_SECTORS ? numSectors-sectors_done : MAX_BUFFER_SECTORS;
|
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_READ_SECTORS, "ii:d", sector, read_secs, mem2_ptr, read_size);
|
||||||
|
|
||||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_READ_SECTORS, "ii:d", sector+sectors_done, read_size, buf, read_size*sector_size);
|
|
||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
memcpy(((u8 *) buffer) + sectors_done*sector_size, buf, read_size*sector_size);
|
memcpy(buf, mem2_ptr, read_size);
|
||||||
|
}
|
||||||
sectors_done += read_size;
|
else
|
||||||
|
{
|
||||||
|
/* Read data */
|
||||||
|
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_READ_SECTORS, "ii:d", sector, read_secs, buf, read_size);
|
||||||
|
if(ret < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Read data */
|
|
||||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_READ_SECTORS, "ii:d", sector, numSectors, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy data */
|
sector += read_secs;
|
||||||
|
numSectors -= read_secs;
|
||||||
|
buf += read_size;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -197,8 +199,6 @@ s32 USBStorage2_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
|||||||
s32 USBStorage2_WriteSectors(u32 sector, u32 numSectors, const void *buffer)
|
s32 USBStorage2_WriteSectors(u32 sector, u32 numSectors, const void *buffer)
|
||||||
{
|
{
|
||||||
u8 *buf = (u8 *) buffer;
|
u8 *buf = (u8 *) buffer;
|
||||||
u32 len = (sector_size * numSectors);
|
|
||||||
|
|
||||||
s32 ret = -1;
|
s32 ret = -1;
|
||||||
|
|
||||||
/* Device not opened */
|
/* Device not opened */
|
||||||
@ -208,31 +208,34 @@ s32 USBStorage2_WriteSectors(u32 sector, u32 numSectors, const void *buffer)
|
|||||||
if (!mem2_ptr)
|
if (!mem2_ptr)
|
||||||
mem2_ptr = (u8 *) MEM2_alloc(sector_size * MAX_BUFFER_SECTORS);
|
mem2_ptr = (u8 *) MEM2_alloc(sector_size * MAX_BUFFER_SECTORS);
|
||||||
|
|
||||||
/* MEM1 buffer */
|
s32 write_size, write_secs;
|
||||||
if (!isMEM2Buffer(buffer))
|
|
||||||
|
while(numSectors > 0)
|
||||||
{
|
{
|
||||||
// Do not read more than MAX_BUFFER_SECTORS sectors at once and create a mem overflow!
|
write_secs = numSectors > MAX_BUFFER_SECTORS ? MAX_BUFFER_SECTORS : numSectors;
|
||||||
buf = mem2_ptr;
|
write_size = write_secs*sector_size;
|
||||||
s32 write_size;
|
|
||||||
s32 sectors_done = 0;
|
|
||||||
|
|
||||||
while(sectors_done < numSectors)
|
/* MEM1 buffer */
|
||||||
|
if (!isMEM2Buffer(buffer))
|
||||||
{
|
{
|
||||||
write_size = numSectors-sectors_done < MAX_BUFFER_SECTORS ? numSectors-sectors_done : MAX_BUFFER_SECTORS;
|
// Do not read more than MAX_BUFFER_SECTORS sectors at once and create a mem overflow!
|
||||||
|
memcpy(mem2_ptr, buf, write_size);
|
||||||
|
|
||||||
memcpy(buf, ((u8 *) buffer) + sectors_done*sector_size, write_size*sector_size);
|
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector, write_secs, mem2_ptr, write_size);
|
||||||
|
|
||||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector+sectors_done, write_size, buf, write_size*sector_size);
|
|
||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
sectors_done += write_size;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
/* Write data */
|
||||||
/* Write data */
|
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector, write_secs, buf, write_size);
|
||||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector, numSectors, buf, len);
|
if(ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sector += write_secs;
|
||||||
|
numSectors -= write_secs;
|
||||||
|
buf += write_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -245,7 +248,7 @@ static bool __usbstorage_Startup(void)
|
|||||||
|
|
||||||
static bool __usbstorage_IsInserted(void)
|
static bool __usbstorage_IsInserted(void)
|
||||||
{
|
{
|
||||||
return (USBStorage2_GetCapacity(NULL) >= 0);
|
return (USBStorage2_GetCapacity(NULL) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool __usbstorage_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
static bool __usbstorage_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
||||||
|
Loading…
Reference in New Issue
Block a user