mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-01-12 11:59:08 +01:00
-added correct crc32 generation of 7z files
This commit is contained in:
parent
1bcd0ce2c0
commit
cc330fccf7
@ -304,24 +304,36 @@ string Plugin::GenerateCoverLink(dir_discHdr gameHeader, string url, Config &Che
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gprintf("Generating CRC32 for %s\n", gamePath);
|
gprintf("Generating CRC32 for %s\n", gamePath);
|
||||||
if(strstr(gameHeader.path, ".zip") == NULL)
|
u32 buffer;
|
||||||
|
ifstream infile;
|
||||||
|
if(strstr(gameHeader.path, ".zip") != NULL)
|
||||||
{
|
{
|
||||||
snprintf(crc_string, sizeof(crc_string), "%08x", crc32file(gameHeader.path));
|
|
||||||
Checksums.setString("CHECKSUMS", gamePath, crc_string);
|
|
||||||
Checksums.save();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
u32 crc_buffer;
|
|
||||||
ifstream infile;
|
|
||||||
infile.open(gameHeader.path, ios::binary);
|
infile.open(gameHeader.path, ios::binary);
|
||||||
infile.seekg(0x0e, ios::beg);
|
infile.seekg(0x0e, ios::beg);
|
||||||
infile.read((char*)&crc_buffer, 8);
|
infile.read((char*)&buffer, 8);
|
||||||
infile.close();
|
infile.close();
|
||||||
snprintf(crc_string, sizeof(crc_string), "%08x", SWAP32(crc_buffer));
|
snprintf(crc_string, sizeof(crc_string), "%08x", SWAP32(buffer));
|
||||||
Checksums.setString("CHECKSUMS", gamePath, crc_string);
|
|
||||||
Checksums.save();
|
|
||||||
}
|
}
|
||||||
|
else if(strstr(gameHeader.path, ".7z") != NULL)
|
||||||
|
{
|
||||||
|
infile.open(gameHeader.path, ios::binary);
|
||||||
|
infile.seekg(-8, ios::end);
|
||||||
|
while(infile.tellg())
|
||||||
|
{
|
||||||
|
infile.read((char*)&buffer, 8);
|
||||||
|
if(buffer == 0x00050111)
|
||||||
|
break;
|
||||||
|
infile.seekg(-9, ios::cur);
|
||||||
|
}
|
||||||
|
infile.seekg(-13, ios::cur);
|
||||||
|
infile.read((char*)&buffer, 8);
|
||||||
|
infile.close();
|
||||||
|
snprintf(crc_string, sizeof(crc_string), "%08x", SWAP32(buffer));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snprintf(crc_string, sizeof(crc_string), "%08x", crc32file(gameHeader.path));
|
||||||
|
Checksums.setString("CHECKSUMS", gamePath, crc_string);
|
||||||
|
Checksums.save();
|
||||||
}
|
}
|
||||||
url.replace(url.find(TAG_GAME_ID), strlen(TAG_GAME_ID), upperCase(crc_string).c_str());
|
url.replace(url.find(TAG_GAME_ID), strlen(TAG_GAME_ID), upperCase(crc_string).c_str());
|
||||||
gprintf("URL: %s\n", url.c_str());
|
gprintf("URL: %s\n", url.c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user