mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
30c883bcfc
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1438 8ced0084-cf51-0410-be5f-012b33b47a6e
61 lines
1.1 KiB
C++
61 lines
1.1 KiB
C++
#ifndef __LAMEFILE_H__
|
|
#define __LAMEFILE_H__
|
|
|
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
|
#include <windows.h>
|
|
|
|
namespace W32Util
|
|
{
|
|
|
|
enum eFileMode
|
|
{
|
|
FILE_READ=5,
|
|
FILE_WRITE=6,
|
|
FILE_ERROR=0xff
|
|
};
|
|
|
|
class File
|
|
{
|
|
HANDLE fileHandle;
|
|
eFileMode mode;
|
|
bool isOpen;
|
|
public:
|
|
File();
|
|
virtual ~File();
|
|
|
|
bool Open(const TCHAR *filename, eFileMode mode);
|
|
void Adopt(HANDLE h) { fileHandle = h;}
|
|
void Close();
|
|
|
|
void WriteInt(int i);
|
|
void WriteChar(char i);
|
|
int Write(void *data, int size);
|
|
|
|
|
|
int ReadInt();
|
|
char ReadChar();
|
|
int Read(void *data, int size);
|
|
|
|
int WR(void *data, int size); //write or read depending on open mode
|
|
bool MagicCookie(int cookie);
|
|
|
|
int GetSize();
|
|
eFileMode GetMode() {return mode;}
|
|
void SeekBeg(int pos)
|
|
{
|
|
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN);
|
|
}
|
|
void SeekEnd(int pos)
|
|
{
|
|
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END);
|
|
}
|
|
void SeekCurrent(int pos)
|
|
{
|
|
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT);
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
|
|
#endif //__LAMEFILE_H__
|