diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 742b22f49f3..511b3198403 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -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)) diff --git a/src/emu/mame.c b/src/emu/mame.c index 69aa08b0790..6d679764d65 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -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 &) { diff --git a/src/emu/mame.h b/src/emu/mame.h index 2936c7a7e1c..e680846465c 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -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 */ diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c index 97fadf0c44e..f1271586406 100644 --- a/src/osd/sdl/input.c +++ b/src/osd/sdl/input.c @@ -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; diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index a0d45555363..2538b5b1eb3 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -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); diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c index 3bf06c33fcb..94bff57aae0 100644 --- a/src/osd/sdl/video.c +++ b/src/osd/sdl/video.c @@ -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); diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c index 5ce119b21b6..0087e82ba13 100644 --- a/src/osd/sdl/window.c +++ b/src/osd/sdl/window.c @@ -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) ) { diff --git a/src/osd/windows/video.c b/src/osd/windows/video.c index db9cfb012e6..48c99b378f3 100644 --- a/src/osd/windows/video.c +++ b/src/osd/windows/video.c @@ -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) diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c index 70dc43ee43d..61d75e5ec34 100644 --- a/src/osd/windows/window.c +++ b/src/osd/windows/window.c @@ -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; diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 8e3176dc034..ee5b3c4ce8f 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -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