mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 08:25:18 +01:00
DVD is FIXED! YAY!
This commit is contained in:
parent
5c7fbaec11
commit
b827c54d19
@ -52,20 +52,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;
|
||||||
@ -73,23 +69,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;
|
||||||
@ -476,6 +470,7 @@ LoadDVDFile ()
|
|||||||
{
|
{
|
||||||
return UnZipFile (rbuffer, discoffset); // unzip from dvd
|
return UnZipFile (rbuffer, discoffset); // unzip from dvd
|
||||||
}
|
}
|
||||||
|
|
||||||
return dvddirlength;
|
return dvddirlength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +235,15 @@ LoadSMBFile ()
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Write savebuffer to SMB file
|
* Write savebuffer to SMB file
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
// no buffer specified, use savebuffer
|
||||||
int
|
int
|
||||||
SaveBufferToSMB (char *filepath, int datasize, bool silent)
|
SaveBufferToSMB (char *filepath, int datasize, bool silent)
|
||||||
|
{
|
||||||
|
return SaveBufferToSMB((char *)savebuffer, filepath, datasize, silent);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SaveBufferToSMB (char * sbuffer, char *filepath, int datasize, bool silent)
|
||||||
{
|
{
|
||||||
if(!ConnectShare (NOTSILENT))
|
if(!ConnectShare (NOTSILENT))
|
||||||
return 0;
|
return 0;
|
||||||
@ -256,10 +263,10 @@ SaveBufferToSMB (char *filepath, int datasize, bool silent)
|
|||||||
{
|
{
|
||||||
if (dsize > 1024)
|
if (dsize > 1024)
|
||||||
wrote =
|
wrote =
|
||||||
SMB_WriteFile ((char *) savebuffer + boffset, 1024, boffset, smbfile);
|
SMB_WriteFile ((char *) sbuffer + boffset, 1024, boffset, smbfile);
|
||||||
else
|
else
|
||||||
wrote =
|
wrote =
|
||||||
SMB_WriteFile ((char *) savebuffer + boffset, dsize, boffset, smbfile);
|
SMB_WriteFile ((char *) sbuffer + boffset, dsize, boffset, smbfile);
|
||||||
|
|
||||||
boffset += wrote;
|
boffset += wrote;
|
||||||
dsize -= wrote;
|
dsize -= wrote;
|
||||||
|
@ -23,5 +23,5 @@ int LoadSMBFile ();
|
|||||||
int LoadBufferFromSMB (char *filepath, bool silent);
|
int LoadBufferFromSMB (char *filepath, bool silent);
|
||||||
int LoadBufferFromSMB (char * sbuffer, char *filepath, bool silent);
|
int LoadBufferFromSMB (char * sbuffer, char *filepath, bool silent);
|
||||||
int SaveBufferToSMB (char *filepath, int datasize, bool silent);
|
int SaveBufferToSMB (char *filepath, int datasize, bool silent);
|
||||||
|
int SaveBufferToSMB (char * sbuffer, char *filepath, int datasize, bool silent);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user