1111
This commit is contained in:
@@ -12,7 +12,7 @@ int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
|
||||
DNFTOOL::UnicodeToAnsi(filename, fname, size);
|
||||
|
||||
FILE* file;
|
||||
file = fopen(fname, "rb+");
|
||||
file = fopen(fname, "rb");
|
||||
LSQLEXREADFUNC func = SQ_io_file_lexfeed_ASCII;
|
||||
if (file)
|
||||
{
|
||||
@@ -22,13 +22,14 @@ int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
|
||||
rewind(file);
|
||||
|
||||
//申请一块能装下整个文件的空间
|
||||
char* ar = (char*)malloc(sizeof(char) * size);
|
||||
char* ar = (char*)malloc(sizeof(char) * size + 256);
|
||||
//读文件,每次读一个,共读size次
|
||||
fread(ar, 1, size, file);
|
||||
|
||||
int skey[] = { 5,2,3,5,0 };//定义解密数组
|
||||
ar[size] = '\0';
|
||||
int skey[] = Skey;//定义解密数组
|
||||
|
||||
Cutecode(ar, skey);//解密
|
||||
fclose(file);//关闭文件
|
||||
|
||||
FILE* outfile;
|
||||
outfile = fopen("ImagePacks2/sprite_interface_teart_zero.npk", "wb+");
|
||||
@@ -38,12 +39,11 @@ int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
|
||||
fclose(outfile);//关闭文件
|
||||
free(ar);//释放内存
|
||||
|
||||
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"rb+");//定义新的文件流
|
||||
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"rb");//定义新的文件流
|
||||
|
||||
SQfseek(newfile, 0, 2);//定位到头
|
||||
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
|
||||
{
|
||||
fclose(file);//关闭文件
|
||||
SQ__Fclose(newfile);//关闭文件
|
||||
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user