mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-25 20:56:53 +01:00
* Added SDHC support (issue 672)
* Added support for larget WBFS drives, as found by Wiimm (http://gbatemp.net/index.php?showtopic=185428).
This commit is contained in:
parent
62163b6512
commit
a976c4e530
@ -6,12 +6,15 @@
|
|||||||
#include <ogc/usbstorage.h>
|
#include <ogc/usbstorage.h>
|
||||||
#include <sdcard/wiisd_io.h>
|
#include <sdcard/wiisd_io.h>
|
||||||
|
|
||||||
|
#include "usbloader/sdhc.h"
|
||||||
#include "usbloader/usbstorage.h"
|
#include "usbloader/usbstorage.h"
|
||||||
|
|
||||||
//these are the only stable and speed is good
|
//these are the only stable and speed is good
|
||||||
#define CACHE 8
|
#define CACHE 8
|
||||||
#define SECTORS 64
|
#define SECTORS 64
|
||||||
|
|
||||||
|
extern DISC_INTERFACE __io_sdhc;
|
||||||
|
|
||||||
int USBDevice_Init() {
|
int USBDevice_Init() {
|
||||||
//closing all open Files write back the cache and then shutdown em!
|
//closing all open Files write back the cache and then shutdown em!
|
||||||
fatUnmount("USB:/");
|
fatUnmount("USB:/");
|
||||||
@ -32,20 +35,22 @@ void USBDevice_deInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int isSdInserted() {
|
int isSdInserted() {
|
||||||
return __io_wiisd.isInserted();
|
return __io_sdhc.isInserted() || __io_wiisd.isInserted();
|
||||||
}
|
}
|
||||||
|
|
||||||
int isInserted(const char *path) {
|
int isInserted(const char *path) {
|
||||||
if (!strncmp(path, "USB:", 4))
|
if (!strncmp(path, "USB:", 4))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return __io_wiisd.isInserted();
|
return __io_sdhc.isInserted() || __io_wiisd.isInserted();
|
||||||
}
|
}
|
||||||
int SDCard_Init() {
|
int SDCard_Init() {
|
||||||
//closing all open Files write back the cache and then shutdown em!
|
//closing all open Files write back the cache and then shutdown em!
|
||||||
fatUnmount("SD:/");
|
fatUnmount("SD:/");
|
||||||
//right now mounts first FAT-partition
|
//right now mounts first FAT-partition
|
||||||
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
|
if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE))
|
||||||
|
return 1;
|
||||||
|
else if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
|
||||||
return 1;
|
return 1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,9 @@ wbfs_t*wbfs_open_hd(rw_sector_callback_t read_hdsector,
|
|||||||
// verify there is the magic.
|
// verify there is the magic.
|
||||||
if (head->magic == wbfs_htonl(WBFS_MAGIC))
|
if (head->magic == wbfs_htonl(WBFS_MAGIC))
|
||||||
{
|
{
|
||||||
|
// Override the sector size by the sector size in the wbfs header...
|
||||||
|
hd_sector_size = 1 << head->hd_sec_sz_s;
|
||||||
|
|
||||||
wbfs_t*p = wbfs_open_partition(read_hdsector,write_hdsector,
|
wbfs_t*p = wbfs_open_partition(read_hdsector,write_hdsector,
|
||||||
callback_data,hd_sector_size,0,part_lba,reset);
|
callback_data,hd_sector_size,0,part_lba,reset);
|
||||||
return p;
|
return p;
|
||||||
|
@ -313,6 +313,9 @@ s32 WBFS_Open(void) {
|
|||||||
if (!hdd)
|
if (!hdd)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
// Save the new sector size, so it will be used in read and write calls
|
||||||
|
sector_size = hdd->head->hd_sec_sz_s;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user