Mercurial > repos > blastem
changeset 1165:9fc680b35dbb
Fix crash regression for games with some kind of mapper functionality
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 10 Jan 2017 09:29:28 -0800 |
parents | 21df13266e6a |
children | 73e36dac5be7 |
files | genesis.c |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/genesis.c Tue Jan 10 09:19:58 2017 -0800 +++ b/genesis.c Tue Jan 10 09:29:28 2017 -0800 @@ -961,13 +961,12 @@ gen->save_storage = NULL; } + //This must happen before we generate memory access functions in init_m68k_opts for (int i = 0; i < rom->map_chunks; i++) { - if (rom->map[i].flags & MMAP_PTR_IDX) { - gen->m68k->mem_pointers[rom->map[i].ptr_index] = rom->map[i].buffer; - } if (rom->map[i].start == 0xE00000) { rom->map[i].buffer = gen->work_ram; + break; } } @@ -978,6 +977,14 @@ gen->m68k = init_68k_context(opts, NULL); gen->m68k->system = gen; opts->address_log = (system_opts & OPT_ADDRESS_LOG) ? fopen("address.log", "w") : NULL; + + //This must happen after the 68K context has been allocated + for (int i = 0; i < rom->map_chunks; i++) + { + if (rom->map[i].flags & MMAP_PTR_IDX) { + gen->m68k->mem_pointers[rom->map[i].ptr_index] = rom->map[i].buffer; + } + } return gen; }