Skip to content

Commit eb55030

Browse files
committed
Adjusted for libogc-rice changes.
1 parent 9e7a466 commit eb55030

File tree

3 files changed

+46
-43
lines changed

3 files changed

+46
-43
lines changed

fileBrowser/fileBrowser-libfat.c

+13-16
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ extern int stop;
4242
#ifdef HW_RVL
4343
#include <sdcard/wiisd_io.h>
4444
#include <ogc/usbstorage.h>
45-
const DISC_INTERFACE* frontsd = &__io_wiisd;
46-
const DISC_INTERFACE* usb = &__io_usbstorage;
45+
static DISC_INTERFACE* frontsd = &__io_wiisd;
46+
static DISC_INTERFACE* usb = &__io_usbstorage;
4747
#else
4848
#include <ogc/dvd.h>
49-
const DISC_INTERFACE* gcloader = &__io_gcode;
49+
static DISC_INTERFACE* gcloader = &__io_gcode;
5050
#endif
51-
const DISC_INTERFACE* carda = &__io_gcsda;
52-
const DISC_INTERFACE* cardb = &__io_gcsdb;
53-
const DISC_INTERFACE* cardc = &__io_gcsd2;
54-
const DISC_INTERFACE* ideexia = &__io_ataa;
55-
const DISC_INTERFACE* ideexib = &__io_atab;
56-
const DISC_INTERFACE* ideexic = &__io_ata1;
51+
static DISC_INTERFACE* carda = &__io_gcsda;
52+
static DISC_INTERFACE* cardb = &__io_gcsdb;
53+
static DISC_INTERFACE* cardc = &__io_gcsd2;
54+
static DISC_INTERFACE* ideexia = &__io_ataa;
55+
static DISC_INTERFACE* ideexib = &__io_atab;
56+
static DISC_INTERFACE* ideexic = &__io_ata1;
5757

5858
// Threaded insertion/removal detection
5959
#define THREAD_SLEEP 100
@@ -149,12 +149,12 @@ static void *removalCallback (void *arg)
149149
{
150150
#ifdef HW_RVL
151151
if(sdMounted==FRONTSD)
152-
if(!frontsd->isInserted()) {
152+
if(!frontsd->isInserted(frontsd)) {
153153
sdNeedsUnmount=FRONTSD;
154154
sdMounted=0;
155155
}
156156
if(fatMounted==USB)
157-
if(!usb->isInserted()) {
157+
if(!usb->isInserted(usb)) {
158158
fatNeedsUnmount=USB;
159159
fatMounted = 0;
160160
}
@@ -204,15 +204,14 @@ int fileBrowser_libfat_readDir(fileBrowser_file* file, fileBrowser_file** dir){
204204
stat((*dir)[i].name, &fstat);
205205
(*dir)[i].offset = 0;
206206
(*dir)[i].size = fstat.st_size;
207-
(*dir)[i].attr = S_ISDIR(fstat.st_mode) ?
208-
FILE_BROWSER_ATTR_DIR : 0;
207+
(*dir)[i].attr = S_ISDIR(fstat.st_mode) ? FILE_BROWSER_ATTR_DIR : 0;
209208
++i;
210209
}
211210

212211
closedir(dp);
213212
continueRemovalThread();
214213

215-
return num_entries;
214+
return i;
216215
}
217216

218217
int fileBrowser_libfat_seekFile(fileBrowser_file* file, unsigned int where, unsigned int type){
@@ -266,7 +265,6 @@ int fileBrowser_libfat_init(fileBrowser_file* f){
266265
pauseRemovalThread();
267266
if(sdNeedsUnmount==FRONTSD) {
268267
fatUnmount(f->name);
269-
frontsd->shutdown();
270268
sdNeedsUnmount = 0;
271269
}
272270
if(fatMountSimple("sd", frontsd)) {
@@ -293,7 +291,6 @@ int fileBrowser_libfat_init(fileBrowser_file* f){
293291
pauseRemovalThread();
294292
if(fatNeedsUnmount==USB) {
295293
fatUnmount(f->name);
296-
usb->shutdown();
297294
fatNeedsUnmount=0;
298295
}
299296
usleep(devsleep);

main/ata.c

+30-24
Original file line numberDiff line numberDiff line change
@@ -505,123 +505,129 @@ int ataShutdown(int chn) {
505505
}
506506

507507

508-
static bool __ataa_startup(void)
508+
static bool __ataa_startup(DISC_INTERFACE *disc)
509509
{
510510
return ataIsInserted(0);
511511
}
512512

513-
static bool __ataa_isInserted(void)
513+
static bool __ataa_isInserted(DISC_INTERFACE *disc)
514514
{
515515
return ataIsInserted(0);
516516
}
517517

518-
static bool __ataa_readSectors(sec_t sector, sec_t numSectors, void *buffer)
518+
static bool __ataa_readSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
519519
{
520520
return !ataReadSectors(0, (u64)sector, numSectors, buffer);
521521
}
522522

523-
static bool __ataa_writeSectors(sec_t sector, sec_t numSectors, void *buffer)
523+
static bool __ataa_writeSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
524524
{
525525
return !ataWriteSectors(0, (u64)sector, numSectors, buffer);
526526
}
527527

528-
static bool __ataa_clearStatus(void)
528+
static bool __ataa_clearStatus(DISC_INTERFACE *disc)
529529
{
530530
return true;
531531
}
532532

533-
static bool __ataa_shutdown(void)
533+
static bool __ataa_shutdown(DISC_INTERFACE *disc)
534534
{
535535
return true;
536536
}
537537

538-
static bool __atab_startup(void)
538+
static bool __atab_startup(DISC_INTERFACE *disc)
539539
{
540540
return ataIsInserted(1);
541541
}
542542

543-
static bool __atab_isInserted(void)
543+
static bool __atab_isInserted(DISC_INTERFACE *disc)
544544
{
545545
return ataIsInserted(1);
546546
}
547547

548-
static bool __atab_readSectors(sec_t sector, sec_t numSectors, void *buffer)
548+
static bool __atab_readSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
549549
{
550550
return !ataReadSectors(1, (u64)sector, numSectors, buffer);
551551
}
552552

553-
static bool __atab_writeSectors(sec_t sector, sec_t numSectors, void *buffer)
553+
static bool __atab_writeSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
554554
{
555555
return !ataWriteSectors(1, (u64)sector, numSectors, buffer);
556556
}
557557

558-
static bool __atab_clearStatus(void)
558+
static bool __atab_clearStatus(DISC_INTERFACE *disc)
559559
{
560560
return true;
561561
}
562562

563-
static bool __atab_shutdown(void)
563+
static bool __atab_shutdown(DISC_INTERFACE *disc)
564564
{
565565
return true;
566566
}
567567

568-
static bool __ata1_startup(void)
568+
static bool __ata1_startup(DISC_INTERFACE *disc)
569569
{
570570
return ataIsInserted(2);
571571
}
572572

573-
static bool __ata1_isInserted(void)
573+
static bool __ata1_isInserted(DISC_INTERFACE *disc)
574574
{
575575
return ataIsInserted(2);
576576
}
577577

578-
static bool __ata1_readSectors(sec_t sector, sec_t numSectors, void *buffer)
578+
static bool __ata1_readSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
579579
{
580580
return !ataReadSectors(2, (u64)sector, numSectors, buffer);
581581
}
582582

583-
static bool __ata1_writeSectors(sec_t sector, sec_t numSectors, void *buffer)
583+
static bool __ata1_writeSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
584584
{
585585
return !ataWriteSectors(2, (u64)sector, numSectors, buffer);
586586
}
587587

588-
static bool __ata1_clearStatus(void)
588+
static bool __ata1_clearStatus(DISC_INTERFACE *disc)
589589
{
590590
return true;
591591
}
592592

593-
static bool __ata1_shutdown(void)
593+
static bool __ata1_shutdown(DISC_INTERFACE *disc)
594594
{
595595
return true;
596596
}
597597

598-
const DISC_INTERFACE __io_ataa = {
598+
DISC_INTERFACE __io_ataa = {
599599
DEVICE_TYPE_GC_ATA,
600600
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_SLOTA,
601601
(FN_MEDIUM_STARTUP)&__ataa_startup,
602602
(FN_MEDIUM_ISINSERTED)&__ataa_isInserted,
603603
(FN_MEDIUM_READSECTORS)&__ataa_readSectors,
604604
(FN_MEDIUM_WRITESECTORS)&__ataa_writeSectors,
605605
(FN_MEDIUM_CLEARSTATUS)&__ataa_clearStatus,
606-
(FN_MEDIUM_SHUTDOWN)&__ataa_shutdown
606+
(FN_MEDIUM_SHUTDOWN)&__ataa_shutdown,
607+
0x1000000000000,
608+
512
607609
} ;
608-
const DISC_INTERFACE __io_atab = {
610+
DISC_INTERFACE __io_atab = {
609611
DEVICE_TYPE_GC_ATA,
610612
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_SLOTB,
611613
(FN_MEDIUM_STARTUP)&__atab_startup,
612614
(FN_MEDIUM_ISINSERTED)&__atab_isInserted,
613615
(FN_MEDIUM_READSECTORS)&__atab_readSectors,
614616
(FN_MEDIUM_WRITESECTORS)&__atab_writeSectors,
615617
(FN_MEDIUM_CLEARSTATUS)&__atab_clearStatus,
616-
(FN_MEDIUM_SHUTDOWN)&__atab_shutdown
618+
(FN_MEDIUM_SHUTDOWN)&__atab_shutdown,
619+
0x1000000000000,
620+
512
617621
} ;
618-
const DISC_INTERFACE __io_ata1 = {
622+
DISC_INTERFACE __io_ata1 = {
619623
DEVICE_TYPE_GC_ATA,
620624
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_PORT1,
621625
(FN_MEDIUM_STARTUP)&__ata1_startup,
622626
(FN_MEDIUM_ISINSERTED)&__ata1_isInserted,
623627
(FN_MEDIUM_READSECTORS)&__ata1_readSectors,
624628
(FN_MEDIUM_WRITESECTORS)&__ata1_writeSectors,
625629
(FN_MEDIUM_CLEARSTATUS)&__ata1_clearStatus,
626-
(FN_MEDIUM_SHUTDOWN)&__ata1_shutdown
630+
(FN_MEDIUM_SHUTDOWN)&__ata1_shutdown,
631+
0x1000000000000,
632+
512
627633
} ;

main/ata.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
#define DEVICE_TYPE_GC_ATA (('G'<<24)|('A'<<16)|('T'<<8)|'A')
1818

19-
extern const DISC_INTERFACE __io_ataa;
20-
extern const DISC_INTERFACE __io_atab;
21-
extern const DISC_INTERFACE __io_ata1;
19+
extern DISC_INTERFACE __io_ataa;
20+
extern DISC_INTERFACE __io_atab;
21+
extern DISC_INTERFACE __io_ata1;
2222

2323
// ATA status register bits
2424
#define ATA_SR_BSY 0x80

0 commit comments

Comments
 (0)