Mercurial > repos > blastem
annotate romdb.h @ 1008:51885857c019
Removed assumptions that path separators are Unix style outside of Unix-only verions of functions
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 01 May 2016 21:39:43 -0700 |
parents | f5550cdffe49 |
children | 5fb64487b6e1 |
rev | line source |
---|---|
764
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #ifndef ROMDB_H_ |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #define ROMDB_H_ |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #define REGION_J 1 |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 #define REGION_U 2 |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 #define REGION_E 4 |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 |
766
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
8 #define RAM_FLAG_ODD 0x18 |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
9 #define RAM_FLAG_EVEN 0x10 |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
10 #define RAM_FLAG_BOTH 0x00 |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
11 #define RAM_FLAG_MASK RAM_FLAG_ODD |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
12 #define SAVE_I2C 0x01 |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
13 #define SAVE_NONE 0xFF |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
14 |
764
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 #include "tern.h" |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 #include "backend.h" |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 typedef struct { |
769
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
19 uint32_t start; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
20 uint32_t end; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
21 uint16_t sda_write_mask; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
22 uint16_t scl_mask; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
23 uint8_t sda_read_bit; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
24 } eeprom_map; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
25 |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
26 typedef struct { |
770 | 27 char *buffer; |
28 uint32_t size; | |
29 uint16_t address; | |
769
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
30 uint8_t host_sda; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
31 uint8_t slave_sda; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
32 uint8_t scl; |
770 | 33 uint8_t state; |
34 uint8_t counter; | |
35 uint8_t latch; | |
769
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
36 } eeprom_state; |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
37 |
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
38 typedef struct { |
766
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
39 char *name; |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
40 memmap_chunk *map; |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
41 uint8_t *save_buffer; |
769
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
42 eeprom_map *eeprom_map; |
913
a5a51465f8b0
Allow IO device config to be overriden by ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
776
diff
changeset
|
43 char *port1_override; |
a5a51465f8b0
Allow IO device config to be overriden by ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
776
diff
changeset
|
44 char *port2_override; |
a5a51465f8b0
Allow IO device config to be overriden by ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
776
diff
changeset
|
45 char *ext_override; |
915
9e882eca717e
Initial support for relative mouse mode and skeleton of support for capture mode. Avoid mouse position overflow in absolute mode. Allow absolute mode to be set by ROM DB.
Michael Pavone <pavone@retrodev.com>
parents:
913
diff
changeset
|
46 char *mouse_mode; |
769
4638b88bc72d
Initial work on I2C EEPROM implementation
Michael Pavone <pavone@retrodev.com>
parents:
767
diff
changeset
|
47 uint32_t num_eeprom; |
766
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
48 uint32_t map_chunks; |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
49 uint32_t save_size; |
767
ea525f600b1d
SRAM detection from ROM header is no working correctly again
Michael Pavone <pavone@retrodev.com>
parents:
766
diff
changeset
|
50 uint32_t save_mask; |
776
cbf97d335444
Full support for Sega mapper when it comes to data. Code in remapped sections may not work reliably. SSF2 now works.
Michael Pavone <pavone@retrodev.com>
parents:
770
diff
changeset
|
51 uint16_t mapper_start_index; |
766
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
52 uint8_t save_type; |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
53 uint8_t regions; |
764
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 } rom_info; |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 tern_node *load_rom_db(); |
766
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
57 rom_info configure_rom(tern_node *rom_db, void *vrom, uint32_t rom_size, memmap_chunk const *base_map, uint32_t base_chunks); |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
765
diff
changeset
|
58 rom_info configure_rom_heuristics(uint8_t *rom, uint32_t rom_size, memmap_chunk const *base_map, uint32_t base_chunks); |
765
dc54387ee1cd
Allow regions to be set in ROM DB. Prefer default region if it is one of the valid regions for the ROM.
Michael Pavone <pavone@retrodev.com>
parents:
764
diff
changeset
|
59 uint8_t translate_region_char(uint8_t c); |
770 | 60 void eeprom_init(eeprom_state *state, uint8_t *buffer, uint32_t size); |
764
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 |
bb60259e8edf
Initial work on ROM database
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 #endif //ROMDB_H_ |