123
This commit is contained in:
164
CryFont/CryPakIO.cpp
Normal file
164
CryFont/CryPakIO.cpp
Normal file
@@ -0,0 +1,164 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#include "stdafx.h"
|
||||
#include <stdio.h>
|
||||
#include "CryPakIO.h"
|
||||
|
||||
// needed for crypak
|
||||
#include <ISystem.h>
|
||||
#include <ICryPak.h>
|
||||
|
||||
#ifndef _XBOX
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
FILE *CryPakOpen(const char *szFile,const char *szMode)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FOpen(szFile,szMode);
|
||||
#else
|
||||
return (fopen(szFile,szMode));
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CryPakClose(FILE *fp)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
pPak->FClose(fp);
|
||||
#else
|
||||
fclose(fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryPakFFlush(FILE *fp)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FFlush(fp);
|
||||
#else
|
||||
return fflush(fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
char *CryPakFGets(char *str, int n, FILE *handle)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FGets(str, n, handle);
|
||||
#else
|
||||
return fgets(str, n, handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryPakUngetc(int c, FILE *handle)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->Ungetc(c, handle);
|
||||
#else
|
||||
return(ungetc(c,handle));
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryPakGetc(FILE *handle)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->Getc(handle);
|
||||
#else
|
||||
return(getc(handle));
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryPakFScanf(FILE *handle, const char *format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
va_start(arglist, format);
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FScanf(handle, format, arglist);
|
||||
#else
|
||||
return fscanf(handle, format, arglist);
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryPakFSeek(FILE *handle, long seek, int mode)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FSeek(handle, seek, mode);
|
||||
#else
|
||||
return fseek(handle, seek, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryPakFPrintf(FILE *handle, const char *format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
va_start(arglist, format);
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FPrintf(handle, format, arglist);
|
||||
#else
|
||||
return fprintf(handle, format, arglist);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
size_t CryPakFRead(void *data, size_t length, size_t elems, FILE *handle)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FRead(data, length, elems, handle);
|
||||
#else
|
||||
return fread(data, length, elems, handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
size_t CryPakFWrite(void *data, size_t length, size_t elems, FILE *handle)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FWrite(data, length, elems, handle);
|
||||
#else
|
||||
return fwrite(data, length, elems, handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryPakFEof(FILE *handle)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FEof(handle);
|
||||
#else
|
||||
return (feof(handle));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif // _XBOX
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CryPakFTell(FILE *fp)
|
||||
{
|
||||
#ifdef USE_CRYPAK
|
||||
ICryPak *pPak=GetISystem()->GetIPak();
|
||||
return pPak->FTell(fp);
|
||||
#else
|
||||
return ftell(fp);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user