Some fixes and cleanups for FAT_R4
- Use typedef in struct definition - Fix zeroing of struct, {0} is not enough need memset - Fix english and size specifier in printf: u64 wants ll
This commit is contained in:
parent
3bfdea87a1
commit
56ea49a9e3
|
@ -1094,9 +1094,10 @@ bool CHEATSEXPORT::search()
|
|||
if (!fp) return false;
|
||||
|
||||
u32 pos = 0x0100;
|
||||
FAT_R4 fat_empty = {0};
|
||||
FAT_R4 fat_empty;
|
||||
|
||||
memset(&fat, 0, sizeof(FAT_R4));
|
||||
memset(&fat_empty, 0, sizeof(FAT_R4));
|
||||
|
||||
fseek(fp, pos, SEEK_SET);
|
||||
while (pos < fsize)
|
||||
|
@ -1105,7 +1106,9 @@ bool CHEATSEXPORT::search()
|
|||
if (memcmp(&fat, &fat_empty, sizeof(FAT_R4)) == 0) break;
|
||||
if (memcmp(gameInfo.header.gameCode, &fat.serial[0], 4) == 0)
|
||||
{
|
||||
FAT_R4 fat_tmp = {0};
|
||||
FAT_R4 fat_tmp;
|
||||
|
||||
memset(&fat_tmp, 0, sizeof(FAT_R4));
|
||||
fread(&fat_tmp, sizeof(FAT_R4), 1, fp);
|
||||
if (memcmp(&fat_tmp, &fat_empty, sizeof(FAT_R4)) == 0)
|
||||
{
|
||||
|
@ -1118,7 +1121,7 @@ bool CHEATSEXPORT::search()
|
|||
}
|
||||
char buf[5] = {0};
|
||||
memcpy(&buf, &fat.serial[0], 4);
|
||||
printf("Founded %s CRC %08X at 0x%08X (size %i)\n", buf, fat.CRC, fat.addr, dataSize);
|
||||
printf("Found %s CRC %08X at 0x%08llX (size %i)\n", buf, fat.CRC, fat.addr, dataSize);
|
||||
return true;
|
||||
}
|
||||
pos += sizeof(FAT_R4);
|
||||
|
@ -1227,4 +1230,4 @@ CHEATS_LIST *CHEATSEXPORT::getCheats()
|
|||
u32 CHEATSEXPORT::getCheatsNum()
|
||||
{
|
||||
return numCheats;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,12 +115,12 @@ enum CHEATS_DB_TYPE
|
|||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
struct FAT_R4
|
||||
typedef struct FAT_R4
|
||||
{
|
||||
u8 serial[4];
|
||||
u32 CRC;
|
||||
u64 addr;
|
||||
};
|
||||
} FAT_R4;
|
||||
#pragma pack(pop)
|
||||
|
||||
class CHEATSEXPORT
|
||||
|
|
Loading…
Reference in New Issue