From c2e96a081fae96a7ad4c886eb15ddcf38aad503d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 15 Jul 2014 17:06:49 -0400 Subject: [PATCH 1/2] cdvdGigaherz: Use booleans instead of ints to represent conditionals in CDVD.cpp --- plugins/cdvdGigaherz/src/CDVD.cpp | 10 ++++------ plugins/cdvdGigaherz/src/CDVD.h | 9 ++++----- plugins/cdvdGigaherz/src/ReadThread.cpp | 16 ++++++++-------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/plugins/cdvdGigaherz/src/CDVD.cpp b/plugins/cdvdGigaherz/src/CDVD.cpp index 34b1ec9681..750b60d3e6 100644 --- a/plugins/cdvdGigaherz/src/CDVD.cpp +++ b/plugins/cdvdGigaherz/src/CDVD.cpp @@ -132,15 +132,13 @@ void __inline lba_to_msf(s32 lba, u8* m, u8* s, u8* f) { char csrc[20]; -BOOL cdvd_is_open=FALSE; -BOOL cdvdKeepAlive_is_open = false; +bool cdvd_is_open = false; +bool cdvdKeepAlive_is_open = false; +bool disc_has_changed = false; +bool weAreInNewDiskCB = false; Source *src; -s32 disc_has_changed=0; - -int weAreInNewDiskCB=0; - char bfr[2352]; char throwaway[2352]; extern s32 prefetch_last_lba; diff --git a/plugins/cdvdGigaherz/src/CDVD.h b/plugins/cdvdGigaherz/src/CDVD.h index 1ad568bff8..5f80274426 100644 --- a/plugins/cdvdGigaherz/src/CDVD.h +++ b/plugins/cdvdGigaherz/src/CDVD.h @@ -160,14 +160,13 @@ void WriteSettings(); void CfgSetSettingsDir( const char* dir ); extern char csrc[]; -extern BOOL cdvd_is_open; -extern BOOL cdvdKeepAlive_is_open; -extern int weAreInNewDiskCB; +extern bool cdvd_is_open; +extern bool cdvdKeepAlive_is_open; +extern bool disc_has_changed; +extern bool weAreInNewDiskCB; extern void (*newDiscCB)(); -extern s32 disc_has_changed; - s32 cdvdStartThread(); void cdvdStopThread(); s32 cdvdRequestSector(u32 sector, s32 mode); diff --git a/plugins/cdvdGigaherz/src/ReadThread.cpp b/plugins/cdvdGigaherz/src/ReadThread.cpp index 4613616726..ae2370b91f 100644 --- a/plugins/cdvdGigaherz/src/ReadThread.cpp +++ b/plugins/cdvdGigaherz/src/ReadThread.cpp @@ -110,9 +110,9 @@ void cdvdCacheReset() void cdvdCallNewDiscCB() { - weAreInNewDiskCB=1; + weAreInNewDiskCB = true; newDiscCB(); - weAreInNewDiskCB=0; + weAreInNewDiskCB = false; } bool cdvdUpdateDiscStatus() @@ -140,9 +140,9 @@ bool cdvdUpdateDiscStatus() { if(!disc_has_changed) { - disc_has_changed=1; - curDiskType=CDVD_TYPE_NODISC; - curTrayStatus=CDVD_TRAY_OPEN; + disc_has_changed = true; + curDiskType = CDVD_TYPE_NODISC; + curTrayStatus = CDVD_TRAY_OPEN; cdvdCallNewDiscCB(); } } @@ -150,13 +150,13 @@ bool cdvdUpdateDiscStatus() { if(disc_has_changed) { - curDiskType=CDVD_TYPE_NODISC; - curTrayStatus=CDVD_TRAY_CLOSE; + curDiskType = CDVD_TYPE_NODISC; + curTrayStatus = CDVD_TRAY_CLOSE; // just a test src->Reopen(); - disc_has_changed=0; + disc_has_changed = false; cdvdRefreshData(); cdvdCallNewDiscCB(); } From 54c21b30c93d478d9061fc5fa639ddd6981419b0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 15 Jul 2014 17:28:09 -0400 Subject: [PATCH 2/2] cdvdGigaherz: Fix the seek function in FileStream. Prior to this, it would have ignored any kind of reference position. --- plugins/cdvdGigaherz/src/FileStream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cdvdGigaherz/src/FileStream.cpp b/plugins/cdvdGigaherz/src/FileStream.cpp index ddf3b196aa..26288dfea1 100644 --- a/plugins/cdvdGigaherz/src/FileStream.cpp +++ b/plugins/cdvdGigaherz/src/FileStream.cpp @@ -35,7 +35,7 @@ void FileStream::seek(s64 offset) void FileStream::seek(s64 offset, int ref_position) { - int ret = _fseeki64(handle, offset, SEEK_SET); + int ret = _fseeki64(handle, offset, ref_position); #ifdef __LINUX__ if (ret) throw "Seek offset out of bounds."; #else