comparison blastem.c @ 885:e3f5ec336432

Allow menu ROM to be debugged
author Michael Pavone <pavone@retrodev.com>
date Sat, 14 Nov 2015 09:49:39 -0800
parents 252dfd29831d
children 2d1122123fe9
comparison
equal deleted inserted replaced
884:252dfd29831d 885:e3f5ec336432
967 FILE *address_log = NULL; 967 FILE *address_log = NULL;
968 char * statefile = NULL; 968 char * statefile = NULL;
969 int rom_size; 969 int rom_size;
970 uint8_t * debuggerfun = NULL; 970 uint8_t * debuggerfun = NULL;
971 uint8_t fullscreen = FULLSCREEN_DEFAULT, use_gl = 1; 971 uint8_t fullscreen = FULLSCREEN_DEFAULT, use_gl = 1;
972 uint8_t debug_target = 0;
972 for (int i = 1; i < argc; i++) { 973 for (int i = 1; i < argc; i++) {
973 if (argv[i][0] == '-') { 974 if (argv[i][0] == '-') {
974 switch(argv[i][1]) { 975 switch(argv[i][1]) {
975 case 'b': 976 case 'b':
976 i++; 977 i++;
980 headless = 1; 981 headless = 1;
981 exit_after = atoi(argv[i]); 982 exit_after = atoi(argv[i]);
982 break; 983 break;
983 case 'd': 984 case 'd':
984 debuggerfun = (uint8_t *)debugger; 985 debuggerfun = (uint8_t *)debugger;
986 //allow debugging the menu
987 if (argv[i][2] == 'm') {
988 debug_target = 1;
989 }
985 break; 990 break;
986 case 'D': 991 case 'D':
987 gdb_remote_init(); 992 gdb_remote_init();
988 debuggerfun = (uint8_t *)gdb_debug_enter; 993 debuggerfun = (uint8_t *)gdb_debug_enter;
989 break; 994 break;
1139 genesis->m68k->options->address_log = address_log; 1144 genesis->m68k->options->address_log = address_log;
1140 game_context = genesis; 1145 game_context = genesis;
1141 } 1146 }
1142 1147
1143 set_keybindings(genesis->ports); 1148 set_keybindings(genesis->ports);
1144 start_genesis(genesis, menu ? NULL : statefile, menu ? NULL : debuggerfun); 1149 start_genesis(genesis, menu ? NULL : statefile, menu == debug_target ? debuggerfun : NULL);
1145 for(;;) 1150 for(;;)
1146 { 1151 {
1147 if (menu && menu_context->next_rom) { 1152 if (menu && menu_context->next_rom) {
1148 if (game_context) { 1153 if (game_context) {
1149 if (game_context->save_type != SAVE_NONE) { 1154 if (game_context->save_type != SAVE_NONE) {
1191 menu_context->next_rom = NULL; 1196 menu_context->next_rom = NULL;
1192 menu = 0; 1197 menu = 0;
1193 genesis = game_context; 1198 genesis = game_context;
1194 genesis->m68k->options->address_log = address_log; 1199 genesis->m68k->options->address_log = address_log;
1195 map_all_bindings(genesis->ports); 1200 map_all_bindings(genesis->ports);
1196 start_genesis(genesis, statefile, debuggerfun); 1201 start_genesis(genesis, statefile, menu == debug_target ? debuggerfun : NULL);
1197 } 1202 }
1198 else if (menu && game_context) { 1203 else if (menu && game_context) {
1199 genesis->arena = set_current_arena(game_context->arena); 1204 genesis->arena = set_current_arena(game_context->arena);
1200 genesis = game_context; 1205 genesis = game_context;
1201 cart = genesis->cart; 1206 cart = genesis->cart;