Skip to content

Commit

Permalink
Expose sector count and size through DISC_INTERFACE
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Nov 16, 2024
1 parent d964fc5 commit 57d7be8
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
6 changes: 4 additions & 2 deletions gc/ogc/disc_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,16 @@ typedef bool (* FN_MEDIUM_SHUTDOWN)(DISC_INTERFACE* disc) ;
#endif

struct DISC_INTERFACE_STRUCT {
DISC_INTERFACE_CONST unsigned long ioType ;
DISC_INTERFACE_CONST unsigned long features ;
DISC_INTERFACE_CONST uint32_t ioType ;
DISC_INTERFACE_CONST uint32_t features ;
DISC_INTERFACE_CONST FN_MEDIUM_STARTUP startup ;
DISC_INTERFACE_CONST FN_MEDIUM_ISINSERTED isInserted ;
DISC_INTERFACE_CONST FN_MEDIUM_READSECTORS readSectors ;
DISC_INTERFACE_CONST FN_MEDIUM_WRITESECTORS writeSectors ;
DISC_INTERFACE_CONST FN_MEDIUM_CLEARSTATUS clearStatus ;
DISC_INTERFACE_CONST FN_MEDIUM_SHUTDOWN shutdown ;
DISC_INTERFACE_CONST sec_t numberOfSectors ;
DISC_INTERFACE_CONST uint32_t bytesPerSector ;
} ;

#endif // define OGC_DISC_IO_INCLUDE
4 changes: 3 additions & 1 deletion libdi/di.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,5 +990,7 @@ DISC_INTERFACE __io_wiidvd = {
diio_ReadSectors,
diio_WriteSectors,
diio_ClearStatus,
diio_Shutdown
diio_Shutdown,
(u32)~0,
2048
};
8 changes: 6 additions & 2 deletions libogc/dvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3693,7 +3693,9 @@ DISC_INTERFACE __io_gcdvd = {
__gcdvd_ReadSectors,
__gcdvd_WriteSectors,
__gcdvd_ClearStatus,
__gcdvd_Shutdown
__gcdvd_Shutdown,
0x7fffff,
2048
};

DISC_INTERFACE __io_gcode = {
Expand All @@ -3704,5 +3706,7 @@ DISC_INTERFACE __io_gcode = {
__gcode_ReadSectors,
__gcode_WriteSectors,
__gcode_ClearStatus,
__gcode_Shutdown
__gcode_Shutdown,
(u32)~0,
512
};
12 changes: 9 additions & 3 deletions libogc/gcsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ DISC_INTERFACE __io_gcsda = {
__gcsda_readSectors,
__gcsda_writeSectors,
__gcsda_clearStatus,
__gcsda_shutdown
__gcsda_shutdown,
(u32)~0,
512
};

DISC_INTERFACE __io_gcsdb = {
Expand All @@ -248,7 +250,9 @@ DISC_INTERFACE __io_gcsdb = {
__gcsdb_readSectors,
__gcsdb_writeSectors,
__gcsdb_clearStatus,
__gcsdb_shutdown
__gcsdb_shutdown,
(u32)~0,
512
};

DISC_INTERFACE __io_gcsd2 = {
Expand All @@ -259,5 +263,7 @@ DISC_INTERFACE __io_gcsd2 = {
__gcsd2_readSectors,
__gcsd2_writeSectors,
__gcsd2_clearStatus,
__gcsd2_shutdown
__gcsd2_shutdown,
(u32)~0,
512
};
8 changes: 7 additions & 1 deletion libogc/usbstorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,11 @@ static bool __usbstorage_IsInserted(DISC_INTERFACE *disc)
}

if (__mounted)
{
disc->numberOfSectors = __usbfd.n_sectors[__lun];
disc->bytesPerSector = __usbfd.sector_size[__lun];
break;
}

USBStorage_Close(&__usbfd);
}
Expand Down Expand Up @@ -1051,7 +1055,9 @@ DISC_INTERFACE __io_usbstorage = {
__usbstorage_ReadSectors,
__usbstorage_WriteSectors,
__usbstorage_ClearStatus,
__usbstorage_Shutdown
__usbstorage_Shutdown,
(u64)~0,
512
};

#endif /* HW_RVL */
4 changes: 3 additions & 1 deletion libogc/wiisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@ DISC_INTERFACE __io_wiisd = {
sdio_ReadSectors,
sdio_WriteSectors,
sdio_ClearStatus,
sdio_Shutdown
sdio_Shutdown,
(u32)~0,
512
};

#endif

0 comments on commit 57d7be8

Please sign in to comment.