FileIO_Init

This commit is contained in:
krystalgamer 2024-09-14 17:52:33 +02:00
parent 427267eb83
commit 2c74dd09ca
4 changed files with 47 additions and 2 deletions

View File

@ -1,7 +1,12 @@
#include "dcfileio.h"
#include "ps2funcs.h"
#include "stubs.h"
#include "pcdcFile.h"
EXPORT void* gFileIoMemory;
EXPORT volatile i32 gFileIOStatus;
EXPORT u8 gFileIoInit;
// @SMALLTODO
void DebugPrintfX(char *,...)
@ -21,10 +26,34 @@ u8 FileIO_FileExists(const char* pFileName)
return 1;
}
// @SMALLTODO
// @Ok
void FileIO_Init(void)
{
printf("FileIO_Init(void)");
if (!gFileIoInit)
{
gFileIoInit = 1;
gFileIOStatus = 1;
i32 iter = 8;
i32 v1;
do
{
v1 = gdFsInit();
if (v1 == -29)
{
DebugPrintfX("GD Not ready.");
}
if (v1 != -23 && v1 != -33 && iter-- != 0 )
continue;
DCSetFatalError(2);
}
while (v1);
gFileIoMemory = syMalloc(0x2000);
print_if_false(gFileIoMemory != 0, "Out of system memory.");
}
}
// @MEDIUMTODO

View File

@ -32,4 +32,8 @@ static void error(const char *message, ...) {
printf("static void error(const char *message, ...)");
}
static void DebugPrintfX(const char *message, ...)
{
}
#endif

View File

@ -5,6 +5,8 @@
#include "ob.h"
#include "m3dcolij.h"
#include <cstdlib>
i32 gClutRelatedOne;
i32 gClutRelatedTwo;
@ -576,3 +578,10 @@ i32 GetFree16Slot(void)
// @BIGTODO
void M3dAsm_LineColijPreprocessItems(CItem*, i32, SLineInfo*, u16)
{}
// @SMALLTODO
void DCSetFatalError(i32)
{
printf("void DCSetFatalError(i32)");
exit(0);
}

View File

@ -104,6 +104,9 @@ EXPORT void TransMatrix(MATRIX*, VECTOR*);
EXPORT void setPolyGT4(void);
EXPORT void MTC2(i32*, GTREGType);
EXPORT void DCSetFatalError(i32);
// @Ok
INLINE static void DrawSync(void)
{