REDRIVER2/src_rebuild/EMULATOR/LIBSN.C
Ilya Shurumov 5b8e0dfe1d - OT to use OTTYPE instead of just u_long for EMU
- latest emulator
- emulator polygon drawing improvements
- fixed bugs regarding to render frontend in D2
2020-04-01 03:04:08 +06:00

70 lines
1.1 KiB
C

#include "EMULATOR.H"
#include "LIBSN.H"
#include <stdio.h>
uintptr_t fileHandle = 0;
#define INVALID_FILE_HANDLE (-1)
int PCinit()
{
//UNIMPLEMENTED();
return 0;
}
uintptr_t PCopen(char* name, int flags, int perms)
{
//TOMB5 hack for CUTSEQ.JIZ
if (name[0] == '\\')
{
++name;
}
#if defined(__ANDROID__)
char buff[64];
sprintf(&buff[0], "/storage/emulated/0/TOMB5/%s", name);
name = &buff[0];
#endif
switch (flags)
{
case 0:
fileHandle = (uintptr_t)fopen(name, "rb");
break;
case 1:
fileHandle = (uintptr_t)fopen(name, "wb");
break;
case 2:
fileHandle = (uintptr_t)fopen(name, "rwb");
break;
}
return fileHandle == 0 ? INVALID_FILE_HANDLE : fileHandle;
}
int PCcreat(char* name, int perms)
{
//UNIMPLEMENTED();
return 0;
}
int PClseek(uintptr_t fd, int offset, int mode)
{
fseek((FILE*)fd, offset, mode);
return ftell((FILE*)fd);
}
int PCread(uintptr_t fd, char* buff, int len)
{
return fread(buff, len, 1, (FILE*)fd);
}
int PCwrite(uintptr_t fd, char* buff, int len)
{
return fwrite(buff, len, 1, (FILE*)fd);
}
int PCclose(uintptr_t fd)
{
return fclose((FILE*)fd);
}