Skip to content

Commit

Permalink
Rename DVD_Read/SeekPrio to DVD_Read/SeekAbsPrio
Browse files Browse the repository at this point in the history
Define DVD_Read/SeekAbs
Add magic number to disc ID structure
  • Loading branch information
Extrems committed Dec 19, 2023
1 parent 02a4e72 commit 3d52b23
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
18 changes: 14 additions & 4 deletions gc/ogc/dvd.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ typedef struct _dvddiskid dvddiskid;
* \param gamever version of game
* \param streaming flag to control audio streaming
* \param streambufsize size of buffer used for audio streaming
* \param pad[22] padding
* \param pad[18] padding
* \param magic magic number
*/
struct _dvddiskid {
s8 gamename[4];
Expand All @@ -133,7 +134,8 @@ struct _dvddiskid {
u8 gamever;
u8 streaming;
u8 streambufsize;
u8 pad[22];
u8 pad[18];
u32 magic;
};

/*!
Expand Down Expand Up @@ -352,10 +354,18 @@ s32 DVD_Inquiry(dvdcmdblk *block,dvddrvinfo *info);
s32 DVD_InquiryAsync(dvdcmdblk *block,dvddrvinfo *info,dvdcbcallback cb);
s32 DVD_StopMotor(dvdcmdblk *block);
s32 DVD_StopMotorAsync(dvdcmdblk *block,dvdcbcallback cb);
s32 DVD_ReadPrio(dvdcmdblk *block,void *buf,u32 len,s64 offset,s32 prio);
#define DVD_ReadAbs(block,buf,len,offset) \
DVD_ReadAbsPrio(block,buf,len,offset,2)
s32 DVD_ReadAbsPrio(dvdcmdblk *block,void *buf,u32 len,s64 offset,s32 prio);
#define DVD_ReadAbsAsync(block,buf,len,offset,cb) \
DVD_ReadAbsAsyncPrio(block,buf,len,offset,cb,2)
s32 DVD_ReadAbsAsyncPrio(dvdcmdblk *block,void *buf,u32 len,s64 offset,dvdcbcallback cb,s32 prio);
s32 DVD_ReadAbsAsyncForBS(dvdcmdblk *block,void *buf,u32 len,s64 offset,dvdcbcallback cb);
s32 DVD_SeekPrio(dvdcmdblk *block,s64 offset,s32 prio);
#define DVD_SeekAbs(block,offset) \
DVD_SeekAbsPrio(block,offset,2)
s32 DVD_SeekAbsPrio(dvdcmdblk *block,s64 offset,s32 prio);
#define DVD_SeekAbsAsync(block,offset,cb) \
DVD_SeekAbsAsyncPrio(block,offset,cb,2)
s32 DVD_SeekAbsAsyncPrio(dvdcmdblk *block,s64 offset,dvdcbcallback cb,s32 prio);
s32 DVD_CancelAllAsync(dvdcbcallback cb);
s32 DVD_PrepareStreamAbsAsync(dvdcmdblk *block,u32 len,s64 offset,dvdcbcallback cb);
Expand Down
10 changes: 5 additions & 5 deletions libogc/dvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2453,12 +2453,12 @@ s32 DVD_Inquiry(dvdcmdblk *block,dvddrvinfo *info)
return ret;
}

s32 DVD_ReadPrio(dvdcmdblk *block,void *buf,u32 len,s64 offset,s32 prio)
s32 DVD_ReadAbsPrio(dvdcmdblk *block,void *buf,u32 len,s64 offset,s32 prio)
{
s32 ret,state;
u32 level;
#ifdef _DVD_DEBUG
printf("DVD_ReadPrio(%p,%p,%d,%d,%d)\n",block,buf,len,offset,prio);
printf("DVD_ReadAbsPrio(%p,%p,%d,%d,%d)\n",block,buf,len,offset,prio);
#endif
if(offset>=0 && offset<8511160320LL) {
ret = DVD_ReadAbsAsyncPrio(block,buf,len,offset,__dvd_synccb,prio);
Expand All @@ -2479,12 +2479,12 @@ s32 DVD_ReadPrio(dvdcmdblk *block,void *buf,u32 len,s64 offset,s32 prio)
return DVD_ERROR_FATAL;
}

s32 DVD_SeekPrio(dvdcmdblk *block,s64 offset,s32 prio)
s32 DVD_SeekAbsPrio(dvdcmdblk *block,s64 offset,s32 prio)
{
s32 ret,state;
u32 level;
#ifdef _DVD_DEBUG
printf("DVD_SeekPrio(%p,%d,%d)\n",block,offset,prio);
printf("DVD_SeekAbsPrio(%p,%d,%d)\n",block,offset,prio);
#endif
if(offset>=0 && offset<8511160320LL) {
ret = DVD_SeekAbsAsyncPrio(block,offset,__dvd_synccb,prio);
Expand Down Expand Up @@ -3007,7 +3007,7 @@ static bool __gcdvd_ReadSectors(sec_t sector,sec_t numSectors,void *buffer)
if(numSectors & ~0x1fffff) return false;
if((u32)buffer & 0x1f) return false;

if(DVD_ReadPrio(&blk, buffer, numSectors << 11, sector << 11, 2) < 0)
if(DVD_ReadAbs(&blk, buffer, numSectors << 11, sector << 11) < 0)
return false;

return true;
Expand Down

0 comments on commit 3d52b23

Please sign in to comment.