diff options
author | Michael Pavone <pavone@retrodev.com> | 2016-12-19 13:58:51 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2016-12-19 13:58:51 -0800 |
commit | 0d3870235c38e40fda2722471ceb4f706454a5f1 (patch) | |
tree | 48adfb6cfdd5cdb7e53f9f6142910bf1011ced49 | |
parent | 4c010e5cddadb5e65c71f9296b9f2f3eef69003b (diff) |
Restore 68K address logging functionality
-rw-r--r-- | blastem.c | 16 | ||||
-rw-r--r-- | genesis.c | 5 | ||||
-rw-r--r-- | genesis.h | 2 | ||||
-rw-r--r-- | system.h | 2 |
4 files changed, 11 insertions, 14 deletions
@@ -175,12 +175,11 @@ int main(int argc, char ** argv) int width = -1; int height = -1; int debug = 0; - int ym_log = 0; + uint32_t opts = 0; int loaded = 0; system_type stype; uint8_t force_region = 0; char * romfname = NULL; - FILE *address_log = NULL; char * statefile = NULL; int rom_size, lock_on_size; uint16_t *cart = NULL, *lock_on = NULL; @@ -217,7 +216,7 @@ int main(int argc, char ** argv) use_gl = 0; break; case 'l': - address_log = fopen("address.log", "w"); + opts |= OPT_ADDRESS_LOG; break; case 'v': info_message("blastem %s\n", BLASTEM_VERSION); @@ -247,7 +246,7 @@ int main(int argc, char ** argv) force_no_terminal(); break; case 'y': - ym_log = 1; + opts |= YM_OPT_WAVE_LOG; break; case 'o': { i++; @@ -339,15 +338,12 @@ int main(int argc, char ** argv) } rom_info info; - uint32_t ym_opts = (ym_log && !menu) ? YM_OPT_WAVE_LOG : 0; - current_system = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, ym_opts, force_region, &info); + current_system = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, menu ? 0 : opts, force_region, &info); setup_saves(romfname, &info, current_system); update_title(info.name); if (menu) { menu_context = current_system; } else { - //TODO: make this an option flag - //genesis->m68k->options->address_log = address_log; game_context = current_system; } @@ -374,7 +370,7 @@ int main(int argc, char ** argv) fatal_error("Failed to open %s for reading\n", menu_context->next_rom); } //allocate new genesis context - game_context = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, ym_opts,force_region, &info); + game_context = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, opts,force_region, &info); menu_context->next_context = game_context; game_context->next_context = menu_context; setup_saves(menu_context->next_rom, &info, game_context); @@ -383,8 +379,6 @@ int main(int argc, char ** argv) menu_context->next_rom = NULL; menu = 0; current_system = game_context; - //TODO: make this an option flag - //genesis->m68k->options->address_log = address_log; current_system->debugger_type = dtype; current_system->enter_debugger = start_in_debugger && menu == debug_target; current_system->start_context(current_system, statefile); @@ -882,7 +882,7 @@ static void free_genesis(system_header *system) free(gen->lock_on); } -genesis_context *alloc_init_genesis(rom_info *rom, void *main_rom, void *lock_on, uint32_t ym_opts, uint8_t force_region) +genesis_context *alloc_init_genesis(rom_info *rom, void *main_rom, void *lock_on, uint32_t system_opts, uint8_t force_region) { static memmap_chunk z80_map[] = { { 0x0000, 0x4000, 0x1FFF, 0, 0, MMAP_READ | MMAP_WRITE | MMAP_CODE, NULL, NULL, NULL, NULL, NULL }, @@ -913,7 +913,7 @@ genesis_context *alloc_init_genesis(rom_info *rom, void *main_rom, void *lock_on uint32_t lowpass_cutoff = lowpass_cutoff_str ? atoi(lowpass_cutoff_str) : DEFAULT_LOWPASS_CUTOFF; gen->ym = malloc(sizeof(ym2612_context)); - ym_init(gen->ym, render_sample_rate(), gen->master_clock, MCLKS_PER_YM, render_audio_buffer(), ym_opts, lowpass_cutoff); + ym_init(gen->ym, render_sample_rate(), gen->master_clock, MCLKS_PER_YM, render_audio_buffer(), system_opts, lowpass_cutoff); gen->psg = malloc(sizeof(psg_context)); psg_init(gen->psg, render_sample_rate(), gen->master_clock, MCLKS_PER_PSG, render_audio_buffer(), lowpass_cutoff); @@ -968,6 +968,7 @@ genesis_context *alloc_init_genesis(rom_info *rom, void *main_rom, void *lock_on opts->gen.flags |= M68K_OPT_BROKEN_READ_MODIFY; gen->m68k = init_68k_context(opts, NULL); gen->m68k->system = gen; + opts->address_log = (system_opts & OPT_ADDRESS_LOG) ? fopen("address.log", "w") : NULL; return gen; } @@ -55,7 +55,7 @@ struct genesis_context { uint16_t read_dma_value(uint32_t address); uint16_t get_open_bus_value(); m68k_context * sync_components(m68k_context *context, uint32_t address); -genesis_context *alloc_config_genesis(void *rom, uint32_t rom_size, void *lock_on, uint32_t lock_on_size, uint32_t ym_opts, uint8_t force_region, rom_info *info_out); +genesis_context *alloc_config_genesis(void *rom, uint32_t rom_size, void *lock_on, uint32_t lock_on_size, uint32_t system_opts, uint8_t force_region, rom_info *info_out); #endif //GENESIS_H_ @@ -43,6 +43,8 @@ struct system_header { system_type type; }; +#define OPT_ADDRESS_LOG (1U << 31U) + system_type detect_system_type(uint8_t *rom, long filesize); system_header *alloc_config_system(system_type stype, void *rom, uint32_t rom_size, void *lock_on, uint32_t lock_on_size, uint32_t opts, uint8_t force_region, rom_info *info_out); |