cdvdGigaherz: Change the order in which the different reading modes are attempted. Seems to fix some CD-Rom games. While at it, renamed a rude variable with a better name. ;P

This commit is contained in:
gigaherz 2014-05-16 22:36:16 +02:00
parent 0bf7a35a53
commit 1fb3de2960
2 changed files with 6 additions and 6 deletions

View File

@ -243,7 +243,7 @@ s32 CALLBACK CDVDgetDualInfo(s32* dualType, u32* _layer1start)
} }
int lastReadInNewDiskCB=0; int lastReadInNewDiskCB=0;
char fuckThisSector[2352]; char directReadSectorBuffer[2448];
s32 CALLBACK CDVDreadSector(u8* buffer, s32 lsn, int mode) s32 CALLBACK CDVDreadSector(u8* buffer, s32 lsn, int mode)
{ {
@ -257,7 +257,7 @@ s32 CALLBACK CDVDreadTrack(u32 lsn, int mode)
if(weAreInNewDiskCB) if(weAreInNewDiskCB)
{ {
int ret = cdvdDirectReadSector(lsn,mode,fuckThisSector); int ret = cdvdDirectReadSector(lsn,mode,directReadSectorBuffer);
if(ret==0) lastReadInNewDiskCB=1; if(ret==0) lastReadInNewDiskCB=1;
return ret; return ret;
} }
@ -276,7 +276,7 @@ u8* CALLBACK CDVDgetBuffer()
if(lastReadInNewDiskCB) if(lastReadInNewDiskCB)
{ {
lastReadInNewDiskCB=0; lastReadInNewDiskCB=0;
return (u8*)fuckThisSector; return (u8*)directReadSectorBuffer;
} }
u8 *s = (u8*)cdvdGetSector(csector,cmode); u8 *s = (u8*)cdvdGetSector(csector,cmode);
@ -299,7 +299,7 @@ int CALLBACK CDVDgetBuffer2(u8* dest)
{ {
lastReadInNewDiskCB=0; lastReadInNewDiskCB=0;
memcpy(dest, fuckThisSector, csize); memcpy(dest, directReadSectorBuffer, csize);
return 0; return 0;
} }

View File

@ -626,13 +626,13 @@ s32 IOCtlSrc::ReadSectors2352(u32 sector, u32 count, char *buffer)
rri.TrackMode=(TRACK_MODE_TYPE)last_read_mode; rri.TrackMode=(TRACK_MODE_TYPE)last_read_mode;
if(DeviceIoControl(device,IOCTL_CDROM_RAW_READ,&rri,sizeof(rri),buffer, 2352*count, &size, NULL)==0) if(DeviceIoControl(device,IOCTL_CDROM_RAW_READ,&rri,sizeof(rri),buffer, 2352*count, &size, NULL)==0)
{ {
rri.TrackMode=CDDA; rri.TrackMode=YellowMode2;
if(DeviceIoControl(device,IOCTL_CDROM_RAW_READ,&rri,sizeof(rri),buffer, 2352*count, &size, NULL)==0) if(DeviceIoControl(device,IOCTL_CDROM_RAW_READ,&rri,sizeof(rri),buffer, 2352*count, &size, NULL)==0)
{ {
rri.TrackMode=XAForm2; rri.TrackMode=XAForm2;
if(DeviceIoControl(device,IOCTL_CDROM_RAW_READ,&rri,sizeof(rri),buffer, 2352*count, &size, NULL)==0) if(DeviceIoControl(device,IOCTL_CDROM_RAW_READ,&rri,sizeof(rri),buffer, 2352*count, &size, NULL)==0)
{ {
rri.TrackMode=YellowMode2; rri.TrackMode=CDDA;
if(DeviceIoControl(device,IOCTL_CDROM_RAW_READ,&rri,sizeof(rri),buffer, 2352*count, &size, NULL)==0) if(DeviceIoControl(device,IOCTL_CDROM_RAW_READ,&rri,sizeof(rri),buffer, 2352*count, &size, NULL)==0)
{ {
return -1; return -1;