Internal Iso: Only search for dual layer once.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4027 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-11-17 04:57:45 +00:00
parent 2b0f47260a
commit a9d7f24884
1 changed files with 10 additions and 7 deletions

View File

@ -35,6 +35,7 @@ static isoFile iso;
static int psize, cdtype; static int psize, cdtype;
static s32 layer1start = -1; static s32 layer1start = -1;
static bool layer1searched = false;
void CALLBACK ISOclose() void CALLBACK ISOclose()
{ {
@ -77,6 +78,7 @@ s32 CALLBACK ISOopen(const char* pTitle)
} }
layer1start = -1; layer1start = -1;
layer1searched = false;
return 0; 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..."); Console.WriteLn("isoFile: searching for layer1...");
layer1searched = true;
int blockresult = -1; int blockresult = -1;
@ -232,7 +237,6 @@ static bool FindLayer1Start()
if( layer1start == -1 ) if( layer1start == -1 )
{ {
Console.Error("isoFile: Couldn't find layer1... iso image is probably corrupt or incomplete."); Console.Error("isoFile: Couldn't find layer1... iso image is probably corrupt or incomplete.");
return false;
} }
else else
{ {
@ -243,13 +247,12 @@ static bool FindLayer1Start()
layerCacheIni.Write( cacheKey, layer1start ); layerCacheIni.Write( cacheKey, layer1start );
} }
} }
return true;
} }
// Should return 0 if no error occurred, or -1 if layer detection FAILED. // Should return 0 if no error occurred, or -1 if layer detection FAILED.
s32 CALLBACK ISOgetDualInfo(s32* dualType, u32* _layer1start) s32 CALLBACK ISOgetDualInfo(s32* dualType, u32* _layer1start)
{ {
if( !FindLayer1Start() ) return -1; FindLayer1Start();
if (layer1start < 0) if (layer1start < 0)
{ {