Mercurial > repos > blastem
annotate realtec.c @ 2386:9f178feb3cb0
Prefix most hex-formatted values output by debugger with $ for consistency with number literal parsing
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 21 Nov 2023 21:35:14 -0800 |
parents | adb62000d296 |
children |
rev | line source |
---|---|
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #include <stdint.h> |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #include <stdlib.h> |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 #include <string.h> |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #include "romdb.h" |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 #include "genesis.h" |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 #include "util.h" |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 typedef struct { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 uint8_t rom_space[512*1024]; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 uint8_t regs[3]; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 } realtec; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 uint8_t realtec_detect(uint8_t *rom, uint32_t rom_size) |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 //All Realtec mapper games are 512KB total |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 if (rom_size != 512*1024) { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 return 0; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 return memcmp(rom + 0x7E100, "SEGA", 4) == 0; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 |
1444
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
23 static realtec *get_realtec(genesis_context *gen) |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
24 { |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
25 if (!gen->extra) { |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
26 gen->extra = gen->m68k->mem_pointers[0]; |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
27 } |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
28 return gen->extra; |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
29 } |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
30 |
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 static void *realtec_write_b(uint32_t address, void *context, uint8_t value) |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 if (address & 1) { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 return context; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 m68k_context *m68k = context; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 genesis_context *gen = m68k->system; |
1444
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
38 realtec *r = get_realtec(gen); |
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 uint32_t offset = address >> 13; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 if (offset < 3 && r->regs[offset] != value) { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 r->regs[offset] = value; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 //other regs are only 3 bits, so assume 3 for this one too |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 uint32_t size = (r->regs[1] & 0x7) << 17; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 uint32_t start = (r->regs[2] & 7) << 17 | (r->regs[0] & 6) << 19; |
1446
adb62000d296
Pass the correct context pointer to write handlers in mapper deserialize functions
Michael Pavone <pavone@retrodev.com>
parents:
1444
diff
changeset
|
45 if (!size || size > 512*1024) { |
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 size = 512*1024; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 for(uint32_t cur = 0; cur < 512*1024; cur += size) |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 if (start + size > 512*1024) { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 memcpy(r->rom_space + cur, gen->cart + start/2, 512*1024-start); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 //assume it wraps |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 memcpy(r->rom_space + cur + 512*1024-start, gen->cart, size - (512*1024-start)); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 } else { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 memcpy(r->rom_space + cur, gen->cart + start/2, size); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 m68k_invalidate_code_range(gen->m68k, 0, 0x400000); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
59 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 return context; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 static void *realtec_write_w(uint32_t address, void *context, uint16_t value) |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 return realtec_write_b(address, context, value >> 8); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 |
1444
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
68 void realtec_serialize(genesis_context *gen, serialize_buffer *buf) |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
69 { |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
70 realtec *r = get_realtec(gen); |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
71 save_buffer8(buf, r->regs, sizeof(r->regs)); |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
72 } |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
73 |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
74 void realtec_deserialize(deserialize_buffer *buf, genesis_context *gen) |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
75 { |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
76 realtec *r = get_realtec(gen); |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
77 for (int i = 0; i < sizeof(r->regs); i++) |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
78 { |
1446
adb62000d296
Pass the correct context pointer to write handlers in mapper deserialize functions
Michael Pavone <pavone@retrodev.com>
parents:
1444
diff
changeset
|
79 realtec_write_b(i << 13, gen->m68k, load_int8(buf)); |
1444
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
80 } |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
81 } |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
82 |
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
83 rom_info realtec_configure_rom(uint8_t *rom, uint32_t rom_size, memmap_chunk const *base_map, uint32_t base_chunks) |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
84 { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 rom_info info; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 realtec *r = calloc(sizeof(realtec), 1); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 for (uint32_t i = 0; i < 512*1024; i += 8*1024) |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
88 { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
89 memcpy(r->rom_space + i, rom + 0x7E000, 8*1024); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
90 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
91 byteswap_rom(512*1024, (uint16_t *)r->rom_space); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
92 |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
93 uint8_t *name_start = NULL, *name_end = NULL; |
1261
f13f51e9f9f2
Improve hacky name parsing code to handle Whac a Critter/Mallet Legend
Michael Pavone <pavone@retrodev.com>
parents:
1259
diff
changeset
|
94 for (int i = 0x94; i < 0xE0; i++) |
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
95 { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
96 if (name_start) { |
1261
f13f51e9f9f2
Improve hacky name parsing code to handle Whac a Critter/Mallet Legend
Michael Pavone <pavone@retrodev.com>
parents:
1259
diff
changeset
|
97 if (rom[i] < ' ' || rom[i] > 0x80 || !memcmp(rom+i, "ARE", 3) || !memcmp(rom+i, "are", 3)) { |
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
98 name_end = rom+i; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
99 break; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
100 } |
1261
f13f51e9f9f2
Improve hacky name parsing code to handle Whac a Critter/Mallet Legend
Michael Pavone <pavone@retrodev.com>
parents:
1259
diff
changeset
|
101 } else if (rom[i] > ' ' && rom[i] < 0x80 && rom[i] != ':') { |
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
102 name_start = rom + i; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
103 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
104 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
105 if (name_start && !name_end) { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
106 name_end = rom + 0xE0; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
107 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
108 if (name_end) { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
109 while (name_end > name_start && name_end[-1] == ' ') |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
110 { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
111 name_end--; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
112 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
113 info.name = malloc(name_end-name_start+1); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
114 memcpy(info.name, name_start, name_end-name_start); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
115 info.name[name_end-name_start] = 0; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
116 } else { |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
117 info.name = strdup("Realtec Game"); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
118 } |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
119 info.save_type = SAVE_NONE; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
120 info.save_size = 0; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
121 info.save_buffer = NULL; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
122 info.num_eeprom = 0; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
123 info.eeprom_map = NULL; |
1416
11ac0b511cff
Support a couple of bootleg X-in-1 carts
Michael Pavone <pavone@retrodev.com>
parents:
1261
diff
changeset
|
124 info.rom = rom; |
11ac0b511cff
Support a couple of bootleg X-in-1 carts
Michael Pavone <pavone@retrodev.com>
parents:
1261
diff
changeset
|
125 info.rom_size = rom_size; |
1444
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1416
diff
changeset
|
126 info.mapper_type = MAPPER_REALTEC; |
1416
11ac0b511cff
Support a couple of bootleg X-in-1 carts
Michael Pavone <pavone@retrodev.com>
parents:
1261
diff
changeset
|
127 info.is_save_lock_on = 0; |
1259
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
128 info.port1_override = info.port2_override = info.ext_override = info.mouse_mode = NULL; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
129 info.map_chunks = base_chunks + 2; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
130 info.map = calloc(sizeof(memmap_chunk), info.map_chunks); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
131 info.map[0].mask = sizeof(r->rom_space)-1; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
132 info.map[0].flags = MMAP_READ|MMAP_CODE|MMAP_PTR_IDX; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
133 info.map[0].start = 0; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
134 info.map[0].end = 0x400000; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
135 info.map[0].buffer = r->rom_space; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
136 info.map[0].write_16 = NULL; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
137 info.map[0].read_16 = NULL; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
138 info.map[0].write_8 = NULL; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
139 info.map[0].read_8 = NULL; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
140 info.map[1].mask = 0x7FFF; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
141 info.map[1].flags = 0; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
142 info.map[1].start = 0x400000; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
143 info.map[1].end = 0x800000; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
144 info.map[1].write_16 = realtec_write_w; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
145 info.map[1].write_8 = realtec_write_b; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
146 info.map[1].read_16 = NULL; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
147 info.map[1].read_8 = NULL; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
148 memcpy(info.map + 2, base_map, base_chunks * sizeof(memmap_chunk)); |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
149 |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
150 return info; |
23c94f5266d1
Support for the Realtec mapper. Needs testing with games besides The Earth Defend
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
151 } |