FileIO_FileExists

This commit is contained in:
krystalgamer 2024-08-21 10:02:10 +01:00
parent cea681558e
commit a41e594c33
4 changed files with 21 additions and 6 deletions

View File

@ -1,6 +1,7 @@
#include "dcfileio.h"
#include "pcdcFile.h"
EXPORT volatile int gFileIOStatus;
EXPORT volatile i32 gFileIOStatus;
// @SMALLTODO
void DebugPrintfX(char *,...)
@ -8,10 +9,16 @@ void DebugPrintfX(char *,...)
printf("DebugPrintfX(char *,...)");
}
// @SMALLTODO
void FileIO_FileExists(char const *)
// @Ok
// @Matching
u8 FileIO_FileExists(const char* pFileName)
{
printf("FileIO_FileExists(char const *)");
print_if_false(gFileIOStatus == 0, "Previous file not finished loading");
HANDLE handle = gdFsOpen(pFileName, 0);
if (!handle)
return 0;
gdFsClose(handle);
return 1;
}
// @SMALLTODO

View File

@ -7,7 +7,7 @@
EXPORT void FileIO_Sync(void);
EXPORT void DebugPrintfX(char *,...);
EXPORT void FileIO_FileExists(char const *);
EXPORT u8 FileIO_FileExists(const char *);
EXPORT void FileIO_Init(void);
EXPORT void FileIO_Load(void *);
EXPORT i32 FileIO_Open(const char *);

View File

@ -17,6 +17,13 @@ EXPORT SGDOpenFile gOpenFiles[MAX_OPEN_FILE_COUNT];
EXPORT HANDLE gOpenFile;
// @SMALLTODO
HANDLE gdFsOpen(const char*, i32)
{
printf("HANDLE gdFsOpen(const char*)");
return reinterpret_cast<HANDLE>(0x21082024);
}
// @Ok
// @Matching
void gdFsClose(HANDLE handle)
@ -126,7 +133,7 @@ INLINE i32 nextFile(void)
return -1;
}
// @SMALLTODO
// @Ok
i32 openFilePKR(char * a1,const char* a2)
{
i32 nFile = nextFile();

View File

@ -30,6 +30,7 @@ EXPORT void seekFilePKR(i32,i32,i32);
EXPORT void tellFilePKR(i32);
EXPORT void gdFsClose(HANDLE);
EXPORT HANDLE gdFsOpen(const char*, i32);
EXPORT i32 gdFsInit(void);