Cheat System: Fix a couple bugs with CheatDBFile::LoadGameList() when reading the entire database's game list.

- Fix a bug where loading all database game entries from an encrypted database would result in reading gobbledygook.
- Fix a bug where calling CheatDBFile::LoadGameList() for all database game entries would always return 0 entries rather than the actual number of found entries.
This commit is contained in:
rogerman 2023-07-24 13:46:05 -07:00
parent 9bf090b309
commit 4e6a7f0424
1 changed files with 7 additions and 0 deletions

View File

@ -2352,6 +2352,12 @@ u32 CheatDBFile::LoadGameList(const char *gameCode, const u32 gameDatabaseCRC, C
if ((pos >> 9) > t)
{
t++;
if ( (t << 9) > this->_size)
{
break;
}
fseek(this->_fp, t << 9, SEEK_SET);
fread(fatBuffer, 1, 512, this->_fp);
CheatDBFile::R4Decrypt(fatBuffer, 512, t);
}
@ -2421,6 +2427,7 @@ u32 CheatDBFile::LoadGameList(const char *gameCode, const u32 gameDatabaseCRC, C
else
{
outList.push_back( this->_ReadGame(encryptOffset, fatEntryCurrent, dataSize, gameEntryBuffer) );
entryCount++;
}
} while (fatEntryNext.addr > 0);