aboutsummaryrefslogtreecommitdiff
path: root/backends/ps2/fileio.h
blob: 8b9fd431fdcdbbee0e51c1cfaa3ac53be1c72764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2005 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header$
 *
 */

#ifndef __PS2FILE_IO__
#define __PS2FILE_IO__

#include "scummsys.h"

class AccessFio {
public:
	AccessFio(void);
	virtual ~AccessFio(void);
	virtual bool open(const char *name, int mode);
	virtual void read(void *dest, uint32 size);
	virtual void write(const void *src, uint32 size);
	virtual int seek(int32 offset, int whence);
	virtual int32 sync(void);
	virtual bool poll(void);
	virtual bool fioAvail(void);
protected:
	int _handle;
};

class File;

FILE *ps2_fopen(const char *fname, const char *mode);
int ps2_fclose(FILE *stream);
int ps2_fflush(FILE *stream);
int ps2_fseek(FILE *stream, long offset, int origin);
long ps2_ftell(FILE *stream);
int ps2_feof(FILE *stream); 
long ps2_fsize(FILE *stream);

size_t ps2_fread(void *buf, size_t r, size_t n, FILE *stream);
int ps2_fgetc(FILE *stream);
char *ps2_fgets(char *buf, int n, FILE *stream);

size_t ps2_fwrite(const void *buf, size_t r, size_t n, FILE *stream);
int ps2_fputc(int c, FILE *stream);
int ps2_fputs(const char *s, FILE *stream);
int ps2_fprintf(FILE *pOut, const char *zFormat, ...);

AccessFio *fetchHandle(File *file);

#endif // __PS2FILE_IO__