comparison blastem.c @ 1113:45db303fc705

Restore 68K address logging functionality
author Michael Pavone <pavone@retrodev.com>
date Mon, 19 Dec 2016 13:58:51 -0800
parents 2eb54e24914e
children 093c19f34dfd
comparison
equal deleted inserted replaced
1112:7ab7c8fb34ba 1113:45db303fc705
173 set_exe_str(argv[0]); 173 set_exe_str(argv[0]);
174 config = load_config(); 174 config = load_config();
175 int width = -1; 175 int width = -1;
176 int height = -1; 176 int height = -1;
177 int debug = 0; 177 int debug = 0;
178 int ym_log = 0; 178 uint32_t opts = 0;
179 int loaded = 0; 179 int loaded = 0;
180 system_type stype; 180 system_type stype;
181 uint8_t force_region = 0; 181 uint8_t force_region = 0;
182 char * romfname = NULL; 182 char * romfname = NULL;
183 FILE *address_log = NULL;
184 char * statefile = NULL; 183 char * statefile = NULL;
185 int rom_size, lock_on_size; 184 int rom_size, lock_on_size;
186 uint16_t *cart = NULL, *lock_on = NULL; 185 uint16_t *cart = NULL, *lock_on = NULL;
187 debugger_type dtype = DEBUGGER_NATIVE; 186 debugger_type dtype = DEBUGGER_NATIVE;
188 uint8_t start_in_debugger = 0; 187 uint8_t start_in_debugger = 0;
215 break; 214 break;
216 case 'g': 215 case 'g':
217 use_gl = 0; 216 use_gl = 0;
218 break; 217 break;
219 case 'l': 218 case 'l':
220 address_log = fopen("address.log", "w"); 219 opts |= OPT_ADDRESS_LOG;
221 break; 220 break;
222 case 'v': 221 case 'v':
223 info_message("blastem %s\n", BLASTEM_VERSION); 222 info_message("blastem %s\n", BLASTEM_VERSION);
224 return 0; 223 return 0;
225 break; 224 break;
245 break; 244 break;
246 case 't': 245 case 't':
247 force_no_terminal(); 246 force_no_terminal();
248 break; 247 break;
249 case 'y': 248 case 'y':
250 ym_log = 1; 249 opts |= YM_OPT_WAVE_LOG;
251 break; 250 break;
252 case 'o': { 251 case 'o': {
253 i++; 252 i++;
254 if (i >= argc) { 253 if (i >= argc) {
255 fatal_error("-o must be followed by a lock on cartridge filename\n"); 254 fatal_error("-o must be followed by a lock on cartridge filename\n");
337 if (!headless) { 336 if (!headless) {
338 render_init(width, height, "BlastEm", fullscreen); 337 render_init(width, height, "BlastEm", fullscreen);
339 } 338 }
340 339
341 rom_info info; 340 rom_info info;
342 uint32_t ym_opts = (ym_log && !menu) ? YM_OPT_WAVE_LOG : 0; 341 current_system = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, menu ? 0 : opts, force_region, &info);
343 current_system = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, ym_opts, force_region, &info);
344 setup_saves(romfname, &info, current_system); 342 setup_saves(romfname, &info, current_system);
345 update_title(info.name); 343 update_title(info.name);
346 if (menu) { 344 if (menu) {
347 menu_context = current_system; 345 menu_context = current_system;
348 } else { 346 } else {
349 //TODO: make this an option flag
350 //genesis->m68k->options->address_log = address_log;
351 game_context = current_system; 347 game_context = current_system;
352 } 348 }
353 349
354 current_system->debugger_type = dtype; 350 current_system->debugger_type = dtype;
355 current_system->enter_debugger = start_in_debugger && menu == debug_target; 351 current_system->enter_debugger = start_in_debugger && menu == debug_target;
372 } 368 }
373 if (!(rom_size = load_rom(menu_context->next_rom, &cart, &stype))) { 369 if (!(rom_size = load_rom(menu_context->next_rom, &cart, &stype))) {
374 fatal_error("Failed to open %s for reading\n", menu_context->next_rom); 370 fatal_error("Failed to open %s for reading\n", menu_context->next_rom);
375 } 371 }
376 //allocate new genesis context 372 //allocate new genesis context
377 game_context = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, ym_opts,force_region, &info); 373 game_context = alloc_config_system(stype, cart, rom_size, lock_on, lock_on_size, opts,force_region, &info);
378 menu_context->next_context = game_context; 374 menu_context->next_context = game_context;
379 game_context->next_context = menu_context; 375 game_context->next_context = menu_context;
380 setup_saves(menu_context->next_rom, &info, game_context); 376 setup_saves(menu_context->next_rom, &info, game_context);
381 update_title(info.name); 377 update_title(info.name);
382 free(menu_context->next_rom); 378 free(menu_context->next_rom);
383 menu_context->next_rom = NULL; 379 menu_context->next_rom = NULL;
384 menu = 0; 380 menu = 0;
385 current_system = game_context; 381 current_system = game_context;
386 //TODO: make this an option flag
387 //genesis->m68k->options->address_log = address_log;
388 current_system->debugger_type = dtype; 382 current_system->debugger_type = dtype;
389 current_system->enter_debugger = start_in_debugger && menu == debug_target; 383 current_system->enter_debugger = start_in_debugger && menu == debug_target;
390 current_system->start_context(current_system, statefile); 384 current_system->start_context(current_system, statefile);
391 } else if (menu && game_context) { 385 } else if (menu && game_context) {
392 current_system->arena = set_current_arena(game_context->arena); 386 current_system->arena = set_current_arena(game_context->arena);