From c1160f40d0b0f48c78e6b768fe7bb678e782afc5 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sat, 17 Dec 2016 14:18:10 +0000 Subject: [PATCH] cdvdgigaherz: Rename variables/parameters in cdvdDirectReadSector s/sector/sector_block s/first/sector --- plugins/cdvdGigaherz/src/CDVD.h | 2 +- plugins/cdvdGigaherz/src/ReadThread.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/cdvdGigaherz/src/CDVD.h b/plugins/cdvdGigaherz/src/CDVD.h index 41856aeef6..904e05bc9e 100644 --- a/plugins/cdvdGigaherz/src/CDVD.h +++ b/plugins/cdvdGigaherz/src/CDVD.h @@ -115,7 +115,7 @@ bool cdvdStartThread(); void cdvdStopThread(); s32 cdvdRequestSector(u32 sector, s32 mode); u8 *cdvdGetSector(u32 sector, s32 mode); -s32 cdvdDirectReadSector(u32 first, s32 mode, u8 *buffer); +s32 cdvdDirectReadSector(u32 sector, s32 mode, u8 *buffer); s32 cdvdGetMediaType(); s32 cdvdRefreshData(); void cdvdParseTOC(); diff --git a/plugins/cdvdGigaherz/src/ReadThread.cpp b/plugins/cdvdGigaherz/src/ReadThread.cpp index 914a2ec35f..b84892e297 100644 --- a/plugins/cdvdGigaherz/src/ReadThread.cpp +++ b/plugins/cdvdGigaherz/src/ReadThread.cpp @@ -297,28 +297,28 @@ u8 *cdvdGetSector(u32 sector, s32 mode) return data; } -s32 cdvdDirectReadSector(u32 first, s32 mode, u8 *buffer) +s32 cdvdDirectReadSector(u32 sector, s32 mode, u8 *buffer) { static u8 data[2352 * sectors_per_read]; - if (first >= src->GetSectorCount()) + if (sector >= src->GetSectorCount()) return -1; // Align to cache block - u32 sector = first & ~(sectors_per_read - 1); + u32 sector_block = sector & ~(sectors_per_read - 1); - if (!cdvdCacheFetch(sector, mode, data)) { - if (cdvdReadBlockOfSectors(sector, mode, data)) - cdvdCacheUpdate(sector, mode, data); + if (!cdvdCacheFetch(sector_block, mode, data)) { + if (cdvdReadBlockOfSectors(sector_block, mode, data)) + cdvdCacheUpdate(sector_block, mode, data); } if (mode == CDVD_MODE_2048) { - u32 offset = 2048 * (first - sector); + u32 offset = 2048 * (sector - sector_block); memcpy(buffer, data + offset, 2048); return 0; } - u32 offset = 2352 * (first - sector); + u32 offset = 2352 * (sector - sector_block); u8 *bfr = data + offset; switch (mode) {