PKR_LockFile

This commit is contained in:
krystalgamer 2024-08-20 22:00:52 +01:00
parent 816d950ae9
commit 056bb46b5e
2 changed files with 15 additions and 0 deletions

14
pkr.cpp
View File

@ -13,6 +13,20 @@ LIBPKR_HANDLE* gDataPkr;
// @NB: the original was built as library and built in debug mode, I won't do the same
// too much hassle for little gain
// @Ok
u8 PKR_LockFile(LIBPKR_HANDLE* pHandle)
{
if (pHandle->fp)
return 1;
pHandle->fp = fopen(pHandle->name, "rb+");
if (pHandle->fp)
return 1;
PKR_ReportError("PKR_UnlockFile: Error cannot open %s", &pHandle->name);
return 0;
}
// @SMALLTODO
u8 fileAddToPKR(LIBPKR_HANDLE*, PKR_FILEINFO, PKR_DIRINFO*, char*)
{

1
pkr.h
View File

@ -67,6 +67,7 @@ EXPORT u8* PKRComp_DecompressFile(PKR_FILEINFO*, u8*, i32);
EXPORT u8 PKR_UnlockFile(LIBPKR_HANDLE* fp);
EXPORT u8 PKR_Open(LIBPKR_HANDLE**, const char*, i32);
EXPORT u8 PKR_GetLastError(char*);
EXPORT u8 PKR_LockFile(LIBPKR_HANDLE*);
EXPORT u8 dirAddToPKR(LIBPKR_HANDLE*, PKR_DIRINFO);
EXPORT u8 fileAddToPKR(LIBPKR_HANDLE*, PKR_FILEINFO, PKR_DIRINFO*, char*);