From c23439852e6e0292a4293eb2b0dc6910de66bc54 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Fri, 21 Apr 2017 01:19:40 -0700 Subject: Minor optimization to avoid invalidating translated code when the bank has not actually changed. Makes a nasty edge case in the 68K debugger slightly less severe when dealing with code that uses banking --- romdb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'romdb.c') diff --git a/romdb.c b/romdb.c index 48a76a7..c603521 100644 --- a/romdb.c +++ b/romdb.c @@ -296,8 +296,11 @@ m68k_context * write_bank_reg_w(uint32_t address, m68k_context * context, uint16 } } } else { - m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000); - context->mem_pointers[gen->mapper_start_index + address] = gen->cart + 0x40000*value; + void *new_ptr = gen->cart + 0x40000*value; + if (context->mem_pointers[gen->mapper_start_index + address] != new_ptr) { + m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000); + context->mem_pointers[gen->mapper_start_index + address] = new_ptr; + } } return context; } -- cgit v1.2.3