fileCRCCheck

This commit is contained in:
krystalgamer 2024-08-18 14:10:40 +01:00
parent 9561fd1092
commit 7558dbbd02
2 changed files with 18 additions and 3 deletions

18
pkr.cpp
View File

@ -1,8 +1,22 @@
#include "pkr.h"
#include "zlib.h"
i32 fileCRCCheck(u8* buf, i32 size, u32 expected)
// @BIGTODO
void PKR_ReportError(const char*, ...)
{
u32 res = crc32(0,0 ,0);
printf("void PKR_ReportError(const char*, ...)");
}
// @Ok
u8 fileCRCCheck(u8* buf, i32 size, u32 expected)
{
u32 res = crc32(crc32(0,0,0), buf, size);
if (res != expected)
{
PKR_ReportError("fileCRCCheck: Bad CRC. %08X bad. %08X correct. File is Damaged.", res, expected);
return 0;
}
return 1;
}

3
pkr.h
View File

@ -6,7 +6,8 @@
#include "export.h"
EXPORT i32 fileCRCCheck(u8*, i32, u32);
EXPORT u8 fileCRCCheck(u8*, i32, u32);
EXPORT void PKR_ReportError(const char*, ...);
#endif