summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/ioprocs.h
blob: cf91ab39bd786eba35b4e7e3edf711f751bc1d6b (plain) (blame)
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
64
65
66
67
68
69
/*********************************************************************

    ioprocs.h

    File IO abstraction layer

*********************************************************************/

#ifndef IOPROCS_H
#define IOPROCS_H

#include <stdlib.h>
#include "emu.h"



/***************************************************************************

    Type definitions

***************************************************************************/

struct io_procs
{
	void (*closeproc)(void *file);
	int (*seekproc)(void *file, INT64 offset, int whence);
	size_t (*readproc)(void *file, void *buffer, size_t length);
	size_t (*writeproc)(void *file, const void *buffer, size_t length);
	UINT64 (*filesizeproc)(void *file);
};



struct io_generic
{
	const struct io_procs *procs;
	void *file;
	UINT8 filler;
};


/***************************************************************************

    Globals

***************************************************************************/

extern const struct io_procs stdio_ioprocs;
extern const struct io_procs stdio_ioprocs_noclose;



/***************************************************************************

    Prototypes

***************************************************************************/



void io_generic_close(struct io_generic *generic);
void io_generic_read(struct io_generic *generic, void *buffer, UINT64 offset, size_t length);
void io_generic_write(struct io_generic *generic, const void *buffer, UINT64 offset, size_t length);
void io_generic_write_filler(struct io_generic *generic, UINT8 filler, UINT64 offset, size_t length);
UINT64 io_generic_size(struct io_generic *generic);



#endif /* IOPROCS_H */