mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-26 12:34:17 +01:00
Whoops, now it's fixed
This commit is contained in:
parent
05446c5203
commit
9faeed4c70
@ -48,20 +48,16 @@ unsigned char dvdbuffer[2048];
|
|||||||
int
|
int
|
||||||
dvd_read (void *dst, unsigned int len, u64 offset)
|
dvd_read (void *dst, unsigned int len, u64 offset)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned char *buffer = (unsigned char *) (unsigned int) DVDreadbuffer;
|
|
||||||
|
|
||||||
if (len > 2048)
|
if (len > 2048)
|
||||||
return 0; /*** We only allow 2k reads **/
|
return 0; /*** We only allow 2k reads **/
|
||||||
|
|
||||||
|
// don't read past the end of the DVD (1.5 GB for GC DVD, 4.7 GB for DVD)
|
||||||
|
if((offset < 0x57057C00) || (isWii && (offset < 0x118244F00LL)))
|
||||||
|
{
|
||||||
|
unsigned char *buffer = (unsigned char *) (unsigned int) DVDreadbuffer;
|
||||||
DCInvalidateRange ((void *) buffer, len);
|
DCInvalidateRange ((void *) buffer, len);
|
||||||
|
|
||||||
// don't read past the end of the DVD (1.5 GB for GC DVD, 4.7 GB for DVD)
|
|
||||||
if(offset < 0x57057C00 || (isWii && offset < 0x118244F00LL))
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
|
|
||||||
dvd[0] = 0x2E;
|
dvd[0] = 0x2E;
|
||||||
dvd[1] = 0;
|
dvd[1] = 0;
|
||||||
dvd[2] = 0xA8000000;
|
dvd[2] = 0xA8000000;
|
||||||
@ -69,23 +65,21 @@ dvd_read (void *dst, unsigned int len, u64 offset)
|
|||||||
dvd[4] = len;
|
dvd[4] = len;
|
||||||
dvd[5] = (u32) buffer;
|
dvd[5] = (u32) buffer;
|
||||||
dvd[6] = len;
|
dvd[6] = len;
|
||||||
dvd[7] = 3; /*** Enable reading with DMA ***/
|
dvd[7] = 3;
|
||||||
|
|
||||||
|
// Enable reading with DMA
|
||||||
while (dvd[7] & 1);
|
while (dvd[7] & 1);
|
||||||
memcpy (dst, buffer, len);
|
|
||||||
|
|
||||||
if (dvd[0] & 0x4) /* Ensure it has completed */
|
// Ensure it has completed
|
||||||
|
if (dvd[0] & 0x4)
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
return 1;
|
if (DI_ReadDVD(buffer, len >> 11, (u32)(offset >> 11)))
|
||||||
|
|
||||||
#elif WII_DVD
|
|
||||||
int ret = 1;
|
|
||||||
ret = DI_ReadDVD(dst, len >> 11, (u32)(offset >> 11));
|
|
||||||
if (ret==0)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
memcpy (dst, buffer, len);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user