bool decryptLua_Mhxy(string strFilePath, string strSaveDir)
{
bool bResult = false;
char *szBuffer = NULL;
int nBufferSize = 0;
CCFileUtils *utils = CCFileUtils::sharedFileUtils();
unsigned long ulFileSize = 0;
char *szFileData = (char*)utils->getFileData(strFilePath.c_str(), "rb", &ulFileSize);
if (strncmp(szFileData, "L:grxx", 6))
{
if (!strncmp(szFileData, "__sign_of_g18_enc__", 0x13))
{
szBuffer = szFileData + 0x13;
nBufferSize = ulFileSize - 0x13;
bResult = decrypt((unsigned char*)szBuffer, nBufferSize);
}
}
else if (!strncmp(szFileData + 6, "__sign_of_g18_enc__", 0x13))
{
unsigned char *pData = (unsigned char *)szFileData + 0x19;
int nLen = ulFileSize - 0x19;
bResult = decrypt(pData, nLen);
if (ZipUtils::isGZipBuffer(pData, nLen))
{
nBufferSize = ZipUtils::ccInflateMemory(pData, nLen, (unsigned char**)&szBuffer);
}
else if (ZipUtils::isCCZBuffer(pData, nLen))
{
nBufferSize = ZipUtils::inflateCCZBuffer(pData, nLen, (unsigned char**)&szBuffer);
}
else if (LzmaUtils::isLzmaBuffer(pData, nLen))
{
nBufferSize = LzmaUtils::inflateLzmaBuffer(pData, nLen, (unsigned char**)&szBuffer);
}
else
{
bResult = false;
}
}
if(bResult)
saveLuaData(szBuffer, nBufferSize, strSaveDir);
return bResult;
}