From a9d7f2488438bb1e74d0007d29641d825b20f936 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Wed, 17 Nov 2010 04:57:45 +0000 Subject: [PATCH] Internal Iso: Only search for dual layer once. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4027 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/CDVD/CDVDisoReader.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pcsx2/CDVD/CDVDisoReader.cpp b/pcsx2/CDVD/CDVDisoReader.cpp index b7c106f736..ea69286364 100644 --- a/pcsx2/CDVD/CDVDisoReader.cpp +++ b/pcsx2/CDVD/CDVDisoReader.cpp @@ -35,6 +35,7 @@ static isoFile iso; static int psize, cdtype; static s32 layer1start = -1; +static bool layer1searched = false; void CALLBACK ISOclose() { @@ -77,7 +78,8 @@ s32 CALLBACK ISOopen(const char* pTitle) } layer1start = -1; - + layer1searched = false; + return 0; } @@ -145,11 +147,14 @@ static bool testForPartitionInfo( const u8 (&tempbuffer)[CD_FRAMESIZE_RAW] ) ); } -static bool FindLayer1Start() +static void FindLayer1Start() { - if( (layer1start != -1) || (iso.GetBlockCount() < 0x230540) ) return true; + if (iso.GetBlockCount() < 0x230540) return; + if (layer1start != -1) return; + if (layer1searched) return; Console.WriteLn("isoFile: searching for layer1..."); + layer1searched = true; int blockresult = -1; @@ -232,7 +237,6 @@ static bool FindLayer1Start() if( layer1start == -1 ) { Console.Error("isoFile: Couldn't find layer1... iso image is probably corrupt or incomplete."); - return false; } else { @@ -243,15 +247,14 @@ static bool FindLayer1Start() layerCacheIni.Write( cacheKey, layer1start ); } } - return true; } // Should return 0 if no error occurred, or -1 if layer detection FAILED. s32 CALLBACK ISOgetDualInfo(s32* dualType, u32* _layer1start) { - if( !FindLayer1Start() ) return -1; + FindLayer1Start(); - if(layer1start<0) + if (layer1start < 0) { *dualType = 0; *_layer1start = iso.GetBlockCount();