openFilePkr

This commit is contained in:
krystalgamer 2024-08-21 09:51:31 +01:00
parent 2b9ce22eca
commit cea681558e
4 changed files with 32 additions and 3 deletions

View File

@ -103,6 +103,8 @@ i32 findFilePKR(
char buf[512];
if(PKR_GetLastError(buf))
error("PKR\t: %s%s - %s\r\n", a1, a2, buf);
return 0;
}
gOpenFiles[nFile].field_4 = fileInfo.fileOffset;
@ -125,9 +127,28 @@ INLINE i32 nextFile(void)
}
// @SMALLTODO
void openFilePKR(char * a1,const char* a2)
i32 openFilePKR(char * a1,const char* a2)
{
printf("openFilePKR(char *,char const *)");
i32 nFile = nextFile();
if (nFile == -1)
return 0;
if (!PKR_ReadFile(
gDataPkr,
a1,
a2,
&gOpenFiles[nFile].field_0,
&gOpenFiles[nFile].field_8))
{
char buf[512];
if (PKR_GetLastError(buf))
error("PKR\t: %s%s - %s\r\n", a1, a2, buf);
return 0;
}
gOpenFiles[nFile].field_4 = 0;
return (nFile + 1) ^ 0xFF;
}
// @Ok

View File

@ -23,7 +23,7 @@ EXPORT void closeFilePKR(i32);
EXPORT void closePKR(void);
EXPORT i32 findFilePKR(char *,const char *);
EXPORT i32 nextFile(void);
EXPORT void openFilePKR(char *,const char*);
EXPORT i32 openFilePKR(char *,const char*);
EXPORT void openPKR(void);
EXPORT void readFilePKR(i32,char *,i32);
EXPORT void seekFilePKR(i32,i32,i32);

View File

@ -13,6 +13,13 @@ 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
// @MEDIUMTODO
u8 PKR_ReadFile(LIBPKR_HANDLE*, const char*, const char*, void**, i32*)
{
printf("u8 PKR_ReadFile(LIBPKR_HANDLE*, const char*, const char*, i32*, i32*)");
return (u8)0x21082024;
}
// @MEDIUMTODO
u8 PKR_GetFileInfo(LIBPKR_HANDLE*, const char*, const char*, PKR_FILEINFO*)
{

1
pkr.h
View File

@ -75,6 +75,7 @@ EXPORT u8 PKR_GetLastError(char*);
EXPORT u8 PKR_LockFile(LIBPKR_HANDLE*);
EXPORT u8 PKR_Close(LIBPKR_HANDLE*);
EXPORT u8 PKR_GetFileInfo(LIBPKR_HANDLE*, const char*, const char*, PKR_FILEINFO*);
EXPORT u8 PKR_ReadFile(LIBPKR_HANDLE*, const char*, const char*, void**, i32*);
EXPORT u8 dirAddToPKR(LIBPKR_HANDLE*, PKR_DIRINFO);