Added DEBUG_FLAG_OSD_ENABLED to allow coexistence of debuggers going forward.

Replaced all occurrences of OPTION_DEBUG in src/osd/* by checking machine->debug_flags
Replaced all occurrences of DEBUG_FLAG_ENABLED in src/osd/* by DEBUG_FLAG_OSD_ENABLED 
For the time being, DEBUG_FLAG_OSD_ENABLED is default (set in mame.c)
Debugger: avoid clearing DEBUG_FLAG_OSD_ENABLED
This commit is contained in:
Couriersud 2010-02-05 01:35:52 +00:00
parent 7b3fa34c6a
commit 88946d721a
10 changed files with 20 additions and 17 deletions

View File

@ -2000,8 +2000,9 @@ static void compute_debug_flags(running_device *device)
running_machine *machine = device->machine;
debugcpu_private *global = machine->debugcpu_data;
/* clear out all global flags by default */
machine->debug_flags = DEBUG_FLAG_ENABLED;
/* clear out global flags by default, keep DEBUG_FLAG_OSD_ENABLED */
machine->debug_flags &= DEBUG_FLAG_OSD_ENABLED;
machine->debug_flags |= DEBUG_FLAG_ENABLED;
/* if we are ignoring this CPU, or if events are pending, we're done */
if ((info->flags & DEBUG_FLAG_OBSERVING) == 0 || mame_is_scheduled_event_pending(machine) || mame_is_save_or_load_pending(machine))

View File

@ -1317,7 +1317,7 @@ running_machine::running_machine(const game_driver *driver)
/* fetch core options */
sample_rate = options_get_int(mame_options(), OPTION_SAMPLERATE);
debug_flags = options_get_bool(mame_options(), OPTION_DEBUG) ? (DEBUG_FLAG_ENABLED | DEBUG_FLAG_CALL_HOOK) : 0;
debug_flags = options_get_bool(mame_options(), OPTION_DEBUG) ? (DEBUG_FLAG_ENABLED | DEBUG_FLAG_OSD_ENABLED | DEBUG_FLAG_CALL_HOOK) : 0;
}
catch (std::bad_alloc &)
{

View File

@ -62,6 +62,7 @@ enum
#define DEBUG_FLAG_WPW_PROGRAM 0x00000100 /* watchpoints are enabled for PROGRAM memory writes */
#define DEBUG_FLAG_WPW_DATA 0x00000200 /* watchpoints are enabled for DATA memory writes */
#define DEBUG_FLAG_WPW_IO 0x00000400 /* watchpoints are enabled for IO memory writes */
#define DEBUG_FLAG_OSD_ENABLED 0x00001000 /* The OSD debugger is enabled */
/* MESS vs. MAME abstractions */

View File

@ -1118,7 +1118,7 @@ void sdlinput_init(running_machine *machine)
// register the mice
sdlinput_register_mice(machine);
if (machine->debug_flags & DEBUG_FLAG_ENABLED)
if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
{
mame_printf_warning("Debug Build: Disabling input grab for -debug\n");
mouse_enabled = 0;

View File

@ -541,7 +541,7 @@ void osd_init(running_machine *machine)
defines_verbose();
if (!SDLMAME_HAS_DEBUGGER)
if (options_get_bool(mame_options(), OPTION_DEBUG))
if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
{
mame_printf_error("sdlmame: -debug not supported on X11-less builds\n\n");
osd_exit(machine);

View File

@ -354,7 +354,7 @@ void osd_update(running_machine *machine, int skip_redraw)
sdlinput_poll(machine);
check_osd_inputs(machine);
if (machine->debug_flags & DEBUG_FLAG_ENABLED)
if ((machine->debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
debugwin_update_during_game(machine);
}
@ -635,7 +635,7 @@ static void extract_video_config(running_machine *machine)
#endif
if (options_get_bool(mame_options(), OPTION_DEBUG))
if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
video_config.windowed = TRUE;
stemp = options_get_string(mame_options(), SDLOPTION_EFFECT);

View File

@ -510,7 +510,7 @@ static OSDWORK_CALLBACK( sdlwindow_toggle_full_screen_wt )
ASSERT_WINDOW_THREAD();
// if we are in debug mode, never go full screen
if (options_get_bool(mame_options(), OPTION_DEBUG))
if (window->machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
return NULL;
// If we are going fullscreen (leaving windowed) remember our windowed size
@ -642,7 +642,7 @@ static void sdlwindow_update_cursor_state(running_machine *machine, sdl_window_i
#if (SDL_VERSION_ATLEAST(1,3,0))
// do not do mouse capture if the debugger's enabled to avoid
// the possibility of losing control
if (!options_get_bool(mame_options(), OPTION_DEBUG))
if (!(machine->debug_flags & DEBUG_FLAG_OSD_ENABLED))
{
//FIXME: SDL1.3: really broken: the whole SDL code
// will only work correct with relative mouse movements ...
@ -665,7 +665,7 @@ static void sdlwindow_update_cursor_state(running_machine *machine, sdl_window_i
#else
// do not do mouse capture if the debugger's enabled to avoid
// the possibility of losing control
if (!options_get_bool(mame_options(), OPTION_DEBUG))
if (!(machine->debug_flags & DEBUG_FLAG_OSD_ENABLED))
{
if ( window->fullscreen || sdlinput_should_hide_mouse(machine) )
{

View File

@ -137,7 +137,7 @@ void winvideo_init(running_machine *machine)
SetForegroundWindow(win_window_list->hwnd);
// possibly create the debug window, but don't show it yet
if (options_get_bool(mame_options(), OPTION_DEBUG))
if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
debugwin_init_windows();
}
@ -406,7 +406,7 @@ static void extract_video_config(running_machine *machine)
video_config.numscreens = options_get_int(mame_options(), WINOPTION_NUMSCREENS);
// if we are in debug mode, never go full screen
if (options_get_bool(mame_options(), OPTION_DEBUG))
if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
video_config.windowed = TRUE;
stemp = options_get_string(mame_options(), WINOPTION_EFFECT);
if (strcmp(stemp, "none") != 0)

View File

@ -301,7 +301,7 @@ static void winwindow_exit(running_machine *machine)
assert(GetCurrentThreadId() == main_threadid);
// possibly kill the debug window
if (options_get_bool(mame_options(), OPTION_DEBUG))
if (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
debugwin_destroy_windows();
// free all the windows
@ -386,7 +386,7 @@ void winwindow_process_events(running_machine *machine, int ingame)
assert(GetCurrentThreadId() == main_threadid);
// if we're running, disable some parts of the debugger
if (ingame && (machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
if (ingame && (machine->debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
debugwin_update_during_game(machine);
// remember the last time we did this
@ -514,8 +514,9 @@ void winwindow_toggle_full_screen(void)
assert(GetCurrentThreadId() == main_threadid);
// if we are in debug mode, never go full screen
if (options_get_bool(mame_options(), OPTION_DEBUG))
return;
for (window = win_window_list; window != NULL; window = window->next)
if (window->machine->debug_flags & DEBUG_FLAG_OSD_ENABLED)
return;
// toggle the window mode
video_config.windowed = !video_config.windowed;

View File

@ -339,7 +339,7 @@ void osd_init(running_machine *machine)
const char *stemp;
// thread priority
if (!options_get_bool(mame_options(), OPTION_DEBUG))
if (!(machine->debug_flags & DEBUG_FLAG_OSD_ENABLED))
SetThreadPriority(GetCurrentThread(), options_get_int(mame_options(), WINOPTION_PRIORITY));
// ensure we get called on the way out