解密完成

This commit is contained in:
Yosin-Lenheart
2022-02-17 13:17:46 +08:00
parent b2d797c480
commit 765d63c28d
7 changed files with 71 additions and 24 deletions

View File

@@ -285,29 +285,31 @@ static int SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
default: SQfseek(file, 0, 2); break; // ascii
}
char* nstr = (char*)"IIIAAAB <- 6648";
//SQwrite(&add, 1, sizeof(add), file);
SQwrite(nstr, sizeof(nstr), strlen(nstr), file);
SQfseek(file, 0, 1);
int length = SQftell(file);
SQfseek(file, 0, 2);
std::cout << "lenth:" << length << std::endl;
//char temp[256];
char* temp = new char[length];
//SQwrite(&add, 1, sizeof(add), file);
SQfread(temp, sizeof(temp), length, file);
temp[length] = '\0';
printf(temp);
printf("\n");
//std::cout << temp << std::endl;
//char* temp = new char[16 * 4];
SQfseek(file, 0, 1);//定位到尾
int length = SQftell(file);//得到文件长度
SQfseek(file, 0, 2);//定位到头
SQfseek(file, 0, 2);
if (SQ_Compile(v, func, file, filename, printerror) >= 0)
char* temp = new char[length+4];//new一个新的字符串
SQfread(temp, sizeof(temp), length, file);//把文件读到字符串里
temp[length] = '\0';//给结尾添加结束符号
int key[] = { 5,2,3,5,0 };//定义解密数组
Cutecode(temp, key);//解密
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"wb+");//定义新的文件流
SQwrite(temp, sizeof(temp), strlen(temp), newfile);//写入
SQfseek(file, 0, 2);//定位到头
SQfseek(newfile, 0, 2);//定位到头
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
{
SQ__Fclose(file);
SQ__Fclose(file);//关闭文件流
SQ__Fclose(newfile);//关闭文件流
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
return SQ_OK;
}
}