annotate memmap.h @ 1691:e96d0d3bec7f

Don't leak a system context when a game is unloaded
author Mike Pavone <pavone@retrodev.com>
date Sun, 20 Jan 2019 22:48:16 -0800
parents 360d5bab199f
children 9caebcfeac72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1595
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef MEMMAP_H_
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define MEMMAP_H_
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 typedef enum {
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 READ_16,
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 READ_8,
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 WRITE_16,
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 WRITE_8
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 } ftype;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 #define MMAP_READ 0x01
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 #define MMAP_WRITE 0x02
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 #define MMAP_CODE 0x04
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 #define MMAP_PTR_IDX 0x08
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 #define MMAP_ONLY_ODD 0x10
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 #define MMAP_ONLY_EVEN 0x20
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 #define MMAP_FUNC_NULL 0x40
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 #define MMAP_BYTESWAP 0x80
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 #define MMAP_AUX_BUFF 0x100
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 #define MMAP_READ_CODE 0x200
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 typedef uint16_t (*read_16_fun)(uint32_t address, void * context);
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23 typedef uint8_t (*read_8_fun)(uint32_t address, void * context);
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24 typedef void * (*write_16_fun)(uint32_t address, void * context, uint16_t value);
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 typedef void * (*write_8_fun)(uint32_t address, void * context, uint8_t value);
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 typedef struct {
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 uint32_t start;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29 uint32_t end;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 uint32_t mask;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 uint32_t aux_mask;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 uint16_t ptr_index;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 uint16_t flags;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 void * buffer;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 read_16_fun read_16;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 write_16_fun write_16;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 read_8_fun read_8;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 write_8_fun write_8;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39 } memmap_chunk;
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41 #endif //MEMMAP_H_