Skip to content

Commit e15cc0d

Browse files
committed
Expand DISC_INTERFACE for future uses
1 parent 2537115 commit e15cc0d

8 files changed

Lines changed: 93 additions & 25 deletions

File tree

include/ogc/disc_io.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define FEATURE_GAMECUBE_PORT2 0x00000040
4343
#define FEATURE_GAMECUBE_PORT1 0x00000080
4444
#define FEATURE_GAMECUBE_DVD 0x00000100
45+
#define FEATURE_GAMECUBE_HSP 0x00000200
4546
#define FEATURE_WII_SD 0x00001000
4647
#define FEATURE_WII_USB 0x00002000
4748
#define FEATURE_WII_DVD 0x00004000
@@ -54,7 +55,8 @@ typedef bool (* FN_MEDIUM_STARTUP)(DISC_INTERFACE* disc) ;
5455
typedef bool (* FN_MEDIUM_ISINSERTED)(DISC_INTERFACE* disc) ;
5556
typedef bool (* FN_MEDIUM_READSECTORS)(DISC_INTERFACE* disc, sec_t sector, sec_t numSectors, void* buffer) ;
5657
typedef bool (* FN_MEDIUM_WRITESECTORS)(DISC_INTERFACE* disc, sec_t sector, sec_t numSectors, const void* buffer) ;
57-
typedef bool (* FN_MEDIUM_CLEARSTATUS)(DISC_INTERFACE* disc) ;
58+
typedef bool (* FN_MEDIUM_ERASESECTORS)(DISC_INTERFACE* disc, sec_t sector, sec_t numSectors) ;
59+
typedef bool (* FN_MEDIUM_FLUSH)(DISC_INTERFACE* disc) ;
5860
typedef bool (* FN_MEDIUM_SHUTDOWN)(DISC_INTERFACE* disc) ;
5961

6062
#ifdef LIBOGC_INTERNAL
@@ -70,9 +72,11 @@ struct DISC_INTERFACE_STRUCT {
7072
DISC_INTERFACE_CONST FN_MEDIUM_ISINSERTED isInserted ;
7173
DISC_INTERFACE_CONST FN_MEDIUM_READSECTORS readSectors ;
7274
DISC_INTERFACE_CONST FN_MEDIUM_WRITESECTORS writeSectors ;
73-
DISC_INTERFACE_CONST FN_MEDIUM_CLEARSTATUS clearStatus ;
75+
DISC_INTERFACE_CONST FN_MEDIUM_ERASESECTORS eraseSectors ;
76+
DISC_INTERFACE_CONST FN_MEDIUM_FLUSH flush ;
7477
DISC_INTERFACE_CONST FN_MEDIUM_SHUTDOWN shutdown ;
7578
DISC_INTERFACE_CONST sec_t numberOfSectors ;
79+
DISC_INTERFACE_CONST uint32_t sectorsPerBlock ;
7680
DISC_INTERFACE_CONST uint32_t bytesPerSector ;
7781
} ;
7882

libdi/di.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,12 @@ static bool diio_WriteSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSecto
971971
return false;
972972
}
973973

974-
static bool diio_ClearStatus(DISC_INTERFACE *disc)
974+
static bool diio_EraseSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors)
975+
{
976+
return false;
977+
}
978+
979+
static bool diio_Flush(DISC_INTERFACE *disc)
975980
{
976981
return true;
977982
}
@@ -989,8 +994,10 @@ DISC_INTERFACE __io_wiidvd = {
989994
diio_IsInserted,
990995
diio_ReadSectors,
991996
diio_WriteSectors,
992-
diio_ClearStatus,
997+
diio_EraseSectors,
998+
diio_Flush,
993999
diio_Shutdown,
9941000
~0,
1001+
16,
9951002
2048
9961003
};

libogc/aram.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,12 @@ static bool __aram_writeSectors(DISC_INTERFACE *disc,sec_t sector,sec_t numSecto
624624
return true;
625625
}
626626

627-
static bool __aram_clearStatus(DISC_INTERFACE *disc)
627+
static bool __aram_eraseSectors(DISC_INTERFACE *disc,sec_t sector,sec_t numSectors)
628+
{
629+
return false;
630+
}
631+
632+
static bool __aram_flush(DISC_INTERFACE *disc)
628633
{
629634
return true;
630635
}
@@ -640,13 +645,15 @@ static bool __aram_shutdown(DISC_INTERFACE *disc)
640645

641646
DISC_INTERFACE __io_aram = {
642647
DEVICE_TYPE_GAMECUBE_ARAM,
643-
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE,
648+
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_HSP,
644649
__aram_startup,
645650
__aram_isInserted,
646651
__aram_readSectors,
647652
__aram_writeSectors,
648-
__aram_clearStatus,
653+
__aram_eraseSectors,
654+
__aram_flush,
649655
__aram_shutdown,
650656
0,
657+
1,
651658
512
652659
};

libogc/dvd.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3618,7 +3618,12 @@ static bool __gcdvd_WriteSectors(DISC_INTERFACE *disc,sec_t sector,sec_t numSect
36183618
return false;
36193619
}
36203620

3621-
static bool __gcdvd_ClearStatus(DISC_INTERFACE *disc)
3621+
static bool __gcdvd_EraseSectors(DISC_INTERFACE *disc,sec_t sector,sec_t numSectors)
3622+
{
3623+
return false;
3624+
}
3625+
3626+
static bool __gcdvd_Flush(DISC_INTERFACE *disc)
36223627
{
36233628
return true;
36243629
}
@@ -3711,7 +3716,12 @@ static bool __gcode_WriteSectors(DISC_INTERFACE *disc,sec_t sector,sec_t numSect
37113716
return true;
37123717
}
37133718

3714-
static bool __gcode_ClearStatus(DISC_INTERFACE *disc)
3719+
static bool __gcode_EraseSectors(DISC_INTERFACE *disc,sec_t sector,sec_t numSectors)
3720+
{
3721+
return false;
3722+
}
3723+
3724+
static bool __gcode_Flush(DISC_INTERFACE *disc)
37153725
{
37163726
return true;
37173727
}
@@ -3728,9 +3738,11 @@ DISC_INTERFACE __io_gcdvd = {
37283738
__gcdvd_IsInserted,
37293739
__gcdvd_ReadSectors,
37303740
__gcdvd_WriteSectors,
3731-
__gcdvd_ClearStatus,
3741+
__gcdvd_EraseSectors,
3742+
__gcdvd_Flush,
37323743
__gcdvd_Shutdown,
37333744
~0,
3745+
16,
37343746
2048
37353747
};
37363748

@@ -3741,8 +3753,10 @@ DISC_INTERFACE __io_gcode = {
37413753
__gcode_IsInserted,
37423754
__gcode_ReadSectors,
37433755
__gcode_WriteSectors,
3744-
__gcode_ClearStatus,
3756+
__gcode_EraseSectors,
3757+
__gcode_Flush,
37453758
__gcode_Shutdown,
37463759
~0,
3760+
1,
37473761
512
37483762
};

libogc/gcsd.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ static bool __gcsd_writeSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSec
164164
return false;
165165
}
166166

167-
static bool __gcsd_clearStatus(DISC_INTERFACE *disc)
167+
static bool __gcsd_eraseSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors)
168+
{
169+
return false;
170+
}
171+
172+
static bool __gcsd_flush(DISC_INTERFACE *disc)
168173
{
169174
return true;
170175
}
@@ -188,9 +193,11 @@ DISC_INTERFACE __io_gcsda = {
188193
__gcsd_isInserted,
189194
__gcsd_readSectors,
190195
__gcsd_writeSectors,
191-
__gcsd_clearStatus,
196+
__gcsd_eraseSectors,
197+
__gcsd_flush,
192198
__gcsd_shutdown,
193199
0,
200+
1,
194201
PAGE_SIZE512
195202
};
196203

@@ -201,9 +208,11 @@ DISC_INTERFACE __io_gcsdb = {
201208
__gcsd_isInserted,
202209
__gcsd_readSectors,
203210
__gcsd_writeSectors,
204-
__gcsd_clearStatus,
211+
__gcsd_eraseSectors,
212+
__gcsd_flush,
205213
__gcsd_shutdown,
206214
0,
215+
1,
207216
PAGE_SIZE512
208217
};
209218

@@ -214,9 +223,11 @@ DISC_INTERFACE __io_gcsd2 = {
214223
__gcsd_isInserted,
215224
__gcsd_readSectors,
216225
__gcsd_writeSectors,
217-
__gcsd_clearStatus,
226+
__gcsd_eraseSectors,
227+
__gcsd_flush,
218228
__gcsd_shutdown,
219229
0,
230+
1,
220231
PAGE_SIZE512
221232
};
222233

libogc/mmce.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,12 @@ static bool __mmce_writeSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSec
620620
return MMCE_WriteSectors(chan, sector, numSectors, buffer) == MMCE_RESULT_READY;
621621
}
622622

623-
static bool __mmce_clearStatus(DISC_INTERFACE *disc)
623+
static bool __mmce_eraseSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors)
624+
{
625+
return false;
626+
}
627+
628+
static bool __mmce_flush(DISC_INTERFACE *disc)
624629
{
625630
return true;
626631
}
@@ -654,9 +659,11 @@ DISC_INTERFACE __io_mmcea = {
654659
__mmce_isInserted,
655660
__mmce_readSectors,
656661
__mmce_writeSectors,
657-
__mmce_clearStatus,
662+
__mmce_eraseSectors,
663+
__mmce_flush,
658664
__mmce_shutdown,
659665
~0,
666+
1,
660667
512
661668
};
662669

@@ -667,9 +674,11 @@ DISC_INTERFACE __io_mmceb = {
667674
__mmce_isInserted,
668675
__mmce_readSectors,
669676
__mmce_writeSectors,
670-
__mmce_clearStatus,
677+
__mmce_eraseSectors,
678+
__mmce_flush,
671679
__mmce_shutdown,
672680
~0,
681+
1,
673682
512
674683
};
675684

@@ -680,8 +689,10 @@ DISC_INTERFACE __io_mmce2 = {
680689
__mmce_isInserted,
681690
__mmce_readSectors,
682691
__mmce_writeSectors,
683-
__mmce_clearStatus,
692+
__mmce_eraseSectors,
693+
__mmce_flush,
684694
__mmce_shutdown,
685695
~0,
696+
1,
686697
512
687698
};

libogc/usbstorage.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
usbstorage.c -- Bulk-only USB mass storage support
44
5-
Copyright (C) 2008 - 2025
5+
Copyright (C) 2008 - 2026
66
Sven Peter (svpe) <svpe@gmx.net>
77
Michael Wiedenbauer (shagkur)
88
Dave Murphy (WinterMute)
@@ -1000,7 +1000,12 @@ static bool __usbstorage_WriteSectors(DISC_INTERFACE *disc, sec_t sector, sec_t
10001000
return retval >= 0;
10011001
}
10021002

1003-
static bool __usbstorage_ClearStatus(DISC_INTERFACE *disc)
1003+
static bool __usbstorage_EraseSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors)
1004+
{
1005+
return false;
1006+
}
1007+
1008+
static bool __usbstorage_Flush(DISC_INTERFACE *disc)
10041009
{
10051010
return true;
10061011
}
@@ -1057,9 +1062,11 @@ DISC_INTERFACE __io_usbstorage = {
10571062
__usbstorage_IsInserted,
10581063
__usbstorage_ReadSectors,
10591064
__usbstorage_WriteSectors,
1060-
__usbstorage_ClearStatus,
1065+
__usbstorage_EraseSectors,
1066+
__usbstorage_Flush,
10611067
__usbstorage_Shutdown,
10621068
0,
1069+
1,
10631070
0
10641071
};
10651072

libogc/wiisd.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Hardware routines for reading and writing to the Wii's internal
66
SD slot.
77
8-
Copyright (C) 2008 - 2025
8+
Copyright (C) 2008 - 2026
99
Michael Wiedenbauer (shagkur)
1010
Dave Murphy (WinterMute)
1111
Sven Peter (svpe) <svpe@gmx.net>
@@ -688,7 +688,12 @@ static bool sdio_WriteSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSecto
688688
return (ret>=0);
689689
}
690690

691-
static bool sdio_ClearStatus(DISC_INTERFACE *disc)
691+
static bool sdio_EraseSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors)
692+
{
693+
return false;
694+
}
695+
696+
static bool sdio_Flush(DISC_INTERFACE *disc)
692697
{
693698
return true;
694699
}
@@ -717,9 +722,11 @@ DISC_INTERFACE __io_wiisd = {
717722
sdio_IsInserted,
718723
sdio_ReadSectors,
719724
sdio_WriteSectors,
720-
sdio_ClearStatus,
725+
sdio_EraseSectors,
726+
sdio_Flush,
721727
sdio_Shutdown,
722728
0,
729+
1,
723730
PAGE_SIZE512
724731
};
725732

0 commit comments

Comments
 (0)