From bb25ce1c6a19d81f939dc4a4d63afc5a56893781 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Wed, 16 Nov 2016 20:50:36 +0000 Subject: [PATCH] cdvdgigaherz: Add cache entry check function Useful when you don't actually want the cached data. --- plugins/cdvdGigaherz/src/ReadThread.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/cdvdGigaherz/src/ReadThread.cpp b/plugins/cdvdGigaherz/src/ReadThread.cpp index 63cbc43bee..35508936c5 100644 --- a/plugins/cdvdGigaherz/src/ReadThread.cpp +++ b/plugins/cdvdGigaherz/src/ReadThread.cpp @@ -77,6 +77,14 @@ void cdvdCacheUpdate(u32 lsn, s32 mode, u8 *data) Cache[entry].mode = mode; } +bool cdvdCacheCheck(u32 lsn, s32 mode) +{ + std::lock_guard guard(s_cache_lock); + u32 entry = cdvdSectorHash(lsn, mode); + + return Cache[entry].lsn == lsn && Cache[entry].mode == mode; +} + bool cdvdCacheFetch(u32 lsn, s32 mode, u8 *data) { std::lock_guard guard(s_cache_lock);