comparison multi_game.c @ 1416:11ac0b511cff

Support a couple of bootleg X-in-1 carts
author Michael Pavone <pavone@retrodev.com>
date Sat, 24 Jun 2017 13:55:54 -0700
parents
children 14a2834d010c
comparison
equal deleted inserted replaced
1415:f7d653bb8899 1416:11ac0b511cff
1 #include "genesis.h"
2
3 void *write_multi_game_b(uint32_t address, void *vcontext, uint8_t value)
4 {
5 m68k_context *context = vcontext;
6 genesis_context *gen = context->system;
7 uint32_t base = (address & 0x3F) << 16, start = 0, end = 0x400000;
8 //find the memmap chunk, so we can properly mask the base value
9 for (int i = 0; i < context->options->gen.memmap_chunks; i++)
10 {
11 if (context->options->gen.memmap[i].flags & MMAP_PTR_IDX) {
12 base &= context->options->gen.memmap[i].mask;
13 start = context->options->gen.memmap[i].start;
14 end = context->options->gen.memmap[i].end;
15 break;
16 }
17 }
18 context->mem_pointers[gen->mapper_start_index] = gen->cart + base/2;
19 m68k_invalidate_code_range(context, start, end);
20 return vcontext;
21 }
22
23 void *write_multi_game_w(uint32_t address, void *context, uint16_t value)
24 {
25 return write_multi_game_b(address, context, value);
26 }