コード例 #1
0
ファイル: disasmwininfo.c プロジェクト: hstampfl/mame
disasmwin_info::disasmwin_info(debugger_windows_interface &debugger) :
    disasmbasewin_info(debugger, false, "Disassembly", NULL),
    m_combownd(NULL)
{
    if ((window() == NULL) || (m_views[0] == NULL))
        return;

    // set up the view to track the initial expression
    set_edit_defstr("curpc");
    set_editwnd_text("curpc");
    editwnd_select_all();

    // create a combo box
    m_combownd = m_views[0]->create_source_combobox(window(), (LONG_PTR)this);

    // set the caption
    update_caption();

    // recompute the children once to get the maxwidth
    recompute_children();

    // position the window and recompute children again
    SetWindowPos(window(), HWND_TOP, 100, 100, maxwidth(), 200, SWP_SHOWWINDOW);
    recompute_children();

    // mark the edit box as the default focus and set it
    set_default_focus();
}
コード例 #2
0
ファイル: pointswininfo.cpp プロジェクト: NULUSIOS/mame
bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
	switch (HIWORD(wparam))
	{
	// menu selections
	case 0:
		switch (LOWORD(wparam))
		{
		case ID_SHOW_BREAKPOINTS:
			m_views[0].reset();
			m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_BREAK_POINTS)));
			if (!m_views[0]->is_valid())
				m_views[0].reset();
			win_set_window_text_utf8(window(), "All Breakpoints");
			recompute_children();
			return true;

		case ID_SHOW_WATCHPOINTS:
			m_views[0].reset();
			m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_WATCH_POINTS)));
			if (!m_views[0]->is_valid())
				m_views[0].reset();
			win_set_window_text_utf8(window(), "All Watchpoints");
			recompute_children();
			return true;
		}
		break;
	}
	return debugwin_info::handle_command(wparam, lparam);
}
コード例 #3
0
ファイル: memorywininfo.c プロジェクト: MisterTea/MAMEHub
memorywin_info::memorywin_info(debugger_windows_interface &debugger) :
	editwin_info(debugger, false, "Memory", NULL),
	m_combownd(NULL)
{
	if (!window())
		return;

	m_views[0].reset(global_alloc(memoryview_info(debugger, *this, window())));
	if ((m_views[0] == NULL) || !m_views[0]->is_valid())
	{
		m_views[0].reset();
		return;
	}

	// create the options menu
	HMENU const optionsmenu = CreatePopupMenu();
	AppendMenu(optionsmenu, MF_ENABLED, ID_1_BYTE_CHUNKS, TEXT("1-byte chunks\tCtrl+1"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_2_BYTE_CHUNKS, TEXT("2-byte chunks\tCtrl+2"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_4_BYTE_CHUNKS, TEXT("4-byte chunks\tCtrl+4"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_8_BYTE_CHUNKS, TEXT("8-byte chunks\tCtrl+8"));
	AppendMenu(optionsmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT(""));
	AppendMenu(optionsmenu, MF_ENABLED, ID_LOGICAL_ADDRESSES, TEXT("Logical Addresses\tCtrl+L"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_PHYSICAL_ADDRESSES, TEXT("Physical Addresses\tCtrl+Y"));
	AppendMenu(optionsmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT(""));
	AppendMenu(optionsmenu, MF_ENABLED, ID_REVERSE_VIEW, TEXT("Reverse View\tCtrl+R"));
	AppendMenu(optionsmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT(""));
	AppendMenu(optionsmenu, MF_ENABLED, ID_INCREASE_MEM_WIDTH, TEXT("Increase bytes per line\tCtrl+P"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_DECREASE_MEM_WIDTH, TEXT("Decrease bytes per line\tCtrl+O"));
	AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)optionsmenu, TEXT("Options"));

	// set up the view to track the initial expression
	downcast<memoryview_info *>(m_views[0].get())->set_expression("0");
	set_edit_defstr("0");
	set_editwnd_text("0");
	editwnd_select_all();

	// create a combo box
	m_views[0]->set_source_for_visible_cpu();
	m_combownd = m_views[0]->create_source_combobox(window(), (LONG_PTR)this);

	// set the caption
	update_caption();

	// recompute the children once to get the maxwidth
	recompute_children();

	// position the window and recompute children again
	SetWindowPos(window(), HWND_TOP, 100, 100, maxwidth(), 200, SWP_SHOWWINDOW);
	recompute_children();

	// mark the edit box as the default focus and set it
	set_default_focus();
}
コード例 #4
0
ファイル: pointswininfo.c プロジェクト: relimited/mame
pointswin_info::pointswin_info(debugger_windows_interface &debugger) :
	debugwin_info(debugger, false, astring("All Breakpoints").c_str(), NULL)
{
	if (!window())
		return;

	m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_BREAK_POINTS)));
	if ((m_views[0] == NULL) || !m_views[0]->is_valid())
	{
		m_views[0].reset();
		return;
	}

	// create the options menu
	HMENU const optionsmenu = CreatePopupMenu();
	AppendMenu(optionsmenu, MF_ENABLED, ID_SHOW_BREAKPOINTS, TEXT("Breakpoints\tCtrl+1"));
	AppendMenu(optionsmenu, MF_ENABLED, ID_SHOW_WATCHPOINTS, TEXT("Watchpoints\tCtrl+2"));
	AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)optionsmenu, TEXT("Options"));

	// compute a client rect
	RECT bounds;
	bounds.top = bounds.left = 0;
	bounds.right = m_views[0]->maxwidth() + (2 * EDGE_WIDTH);
	bounds.bottom = 200;
	AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX);

	// clamp the min/max size
	set_maxwidth(bounds.right - bounds.left);

	// position the window at the bottom-right
	SetWindowPos(window(), HWND_TOP, 100, 100, bounds.right - bounds.left, bounds.bottom - bounds.top, SWP_SHOWWINDOW);

	// recompute the children
	recompute_children();
}
コード例 #5
0
ファイル: consolewininfo.cpp プロジェクト: goofwear/mame
void consolewin_info::set_cpu(device_t &device)
{
	// first set all the views to the new cpu number
	m_views[0]->set_source_for_device(device);
	m_views[1]->set_source_for_device(device);

	// then update the caption
	std::string title = string_format("Debug: %s - %s '%s'", device.machine().system().name, device.name(), device.tag());
	std::string curtitle = win_get_window_text_utf8(window());
	if (title != curtitle)
		win_set_window_text_utf8(window(), title.c_str());

	// and recompute the children
	recompute_children();
}
コード例 #6
0
ファイル: consolewininfo.c プロジェクト: relimited/mame
void consolewin_info::set_cpu(device_t &device)
{
	// first set all the views to the new cpu number
	m_views[0]->set_source_for_device(device);
	m_views[1]->set_source_for_device(device);

	// then update the caption
	char curtitle[256];
	astring title;

	title.printf("Debug: %s - %s '%s'", device.machine().system().name, device.name(), device.tag());
	win_get_window_text_utf8(window(), curtitle, ARRAY_LENGTH(curtitle));
	if (title.cmp(curtitle) != 0)
		win_set_window_text_utf8(window(), title.c_str());

	// and recompute the children
	recompute_children();
}
コード例 #7
0
ファイル: memorywininfo.c プロジェクト: MisterTea/MAMEHub
bool memorywin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
	memoryview_info *const memview = downcast<memoryview_info *>(m_views[0].get());
	switch (HIWORD(wparam))
	{
	// combo box selection changed
	case CBN_SELCHANGE:
		{
			int const sel = SendMessage((HWND)lparam, CB_GETCURSEL, 0, 0);
			if (sel != CB_ERR)
			{
				memview->set_source_index(sel);
				update_caption();

				// reset the focus
				set_default_focus();
				return true;
			}
			break;
		}

	// menu selections
	case 0:
		switch (LOWORD(wparam))
		{
		case ID_1_BYTE_CHUNKS:
			memview->set_bytes_per_chunk(1);
			return true;

		case ID_2_BYTE_CHUNKS:
			memview->set_bytes_per_chunk(2);
			return true;

		case ID_4_BYTE_CHUNKS:
			memview->set_bytes_per_chunk(4);
			return true;

		case ID_8_BYTE_CHUNKS:
			memview->set_bytes_per_chunk(8);
			return true;

		case ID_LOGICAL_ADDRESSES:
			memview->set_physical(false);
			return true;

		case ID_PHYSICAL_ADDRESSES:
			memview->set_physical(true);
			return true;

		case ID_REVERSE_VIEW:
			memview->set_reverse(!memview->reverse());
			return true;

		case ID_INCREASE_MEM_WIDTH:
			memview->set_chunks_per_row(memview->chunks_per_row() + 1);
			recompute_children();
			return true;

		case ID_DECREASE_MEM_WIDTH:
			memview->set_chunks_per_row(memview->chunks_per_row() - 1);
			recompute_children();
			return true;
		}
		break;
	}
	return editwin_info::handle_command(wparam, lparam);
}
コード例 #8
0
ファイル: debugwininfo.cpp プロジェクト: robsonfr/mame
LRESULT debugwin_info::window_proc(UINT message, WPARAM wparam, LPARAM lparam)
{
	// handle a few messages
	switch (message)
	{
	// paint: draw bezels as necessary
	case WM_PAINT:
		{
			PAINTSTRUCT pstruct;
			HDC dc = BeginPaint(m_wnd, &pstruct);
			draw_contents(dc);
			EndPaint(m_wnd, &pstruct);
			break;
		}

	// keydown: handle debugger keys
	case WM_KEYDOWN:
		if (handle_key(wparam, lparam))
			set_ignore_char_lparam(lparam);
		break;

	// char: ignore chars associated with keys we've handled
	case WM_CHAR:
		if (check_ignore_char_lparam(lparam))
		{
			if (waiting_for_debugger() || !seq_pressed())
				return DefWindowProc(m_wnd, message, wparam, lparam);
		}
		break;

	// activate: set the focus
	case WM_ACTIVATE:
		if (wparam != WA_INACTIVE)
			set_default_focus();
		break;

	// get min/max info: set the minimum window size
	case WM_GETMINMAXINFO:
		{
			MINMAXINFO *minmax = (MINMAXINFO *)lparam;
			minmax->ptMinTrackSize.x = m_minwidth;
			minmax->ptMinTrackSize.y = m_minheight;
			minmax->ptMaxSize.x = minmax->ptMaxTrackSize.x = m_maxwidth;
			minmax->ptMaxSize.y = minmax->ptMaxTrackSize.y = m_maxheight;
			break;
		}

	// sizing: recompute child window locations
	case WM_SIZE:
	case WM_SIZING:
		recompute_children();
		InvalidateRect(m_wnd, NULL, FALSE);
		break;

	// mouse wheel: forward to the first view
	case WM_MOUSEWHEEL:
		{
			static int units_carryover = 0;

			UINT lines_per_click;
			if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &lines_per_click, 0))
				lines_per_click = 3;

			int const units = GET_WHEEL_DELTA_WPARAM(wparam) + units_carryover;
			int const clicks = units / WHEEL_DELTA;
			units_carryover = units % WHEEL_DELTA;

			int const delta = clicks * lines_per_click;
			int viewnum = 0;
			POINT point;

			// figure out which view we are hovering over
			GetCursorPos(&point);
			ScreenToClient(m_wnd, &point);
			HWND const child = ChildWindowFromPoint(m_wnd, point);
			if (child)
			{
				for (viewnum = 0; viewnum < MAX_VIEWS; viewnum++)
				{
					if ((m_views[viewnum] != NULL) && m_views[viewnum]->owns_window(child))
						break;
				}
				if (viewnum == MAX_VIEWS)
					break;
			}

			// send the appropriate message to this view's scrollbar
			if (m_views[viewnum] != NULL)
				m_views[viewnum]->send_vscroll(delta);

			break;
		}

	// activate: set the focus
	case WM_INITMENU:
		update_menu();
		break;

	// command: handle a comment
	case WM_COMMAND:
		if (!handle_command(wparam, lparam))
			return DefWindowProc(m_wnd, message, wparam, lparam);
		break;

	// close: close the window if it's not the main console
	case WM_CLOSE:
		if (m_is_main_console)
		{
			debugger().hide_all();
			debug_cpu_get_visible_cpu(machine())->debug()->go();
		}
		else
		{
			destroy();
		}
		break;

	// destroy: close down the window
	case WM_NCDESTROY:
		m_wnd = NULL;
		debugger().remove_window(*this);
		break;

	// everything else: defaults
	default:
		return DefWindowProc(m_wnd, message, wparam, lparam);
	}

	return 0;
}
コード例 #9
0
ファイル: disasmbasewininfo.c プロジェクト: MisterTea/MAMEHub
bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
	disasmview_info *const dasmview = downcast<disasmview_info *>(m_views[0].get());

	switch (HIWORD(wparam))
	{
	// menu selections
	case 0:
		switch (LOWORD(wparam))
		{
		case ID_TOGGLE_BREAKPOINT:
			if (dasmview->cursor_visible())
			{
				offs_t const address = dasmview->selected_address();
				device_debug *const debug = dasmview->source_device()->debug();
				INT32 bpindex = -1;

				// first find an existing breakpoint at this address
				for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next())
				{
					if (address == bp->address())
					{
						bpindex = bp->index();
						break;
					}
				}

				// if it doesn't exist, add a new one
				if (!is_main_console())
				{
					if (bpindex == -1)
					{
						bpindex = debug->breakpoint_set(address, NULL, NULL);
						debug_console_printf(machine(), "Breakpoint %X set\n", bpindex);
					}
					else
					{
						debug->breakpoint_clear(bpindex);
						debug_console_printf(machine(), "Breakpoint %X cleared\n", bpindex);
					}
					machine().debug_view().update_all();
					debugger_refresh_display(machine());
				}
				else if (dasmview->source_is_visible_cpu())
				{
					astring command;
					if (bpindex == -1)
						command.printf("bpset 0x%X", address);
					else
						command.printf("bpclear 0x%X", bpindex);
					debug_console_execute_command(machine(), command, 1);
				}
			}
			return true;

		case ID_DISABLE_BREAKPOINT:
			if (dasmview->cursor_visible())
			{
				offs_t const address = dasmview->selected_address();
				device_debug *const debug = dasmview->source_device()->debug();

				// first find an existing breakpoint at this address
				device_debug::breakpoint *bp = debug->breakpoint_first();
				while ((bp != NULL) && (bp->address() != address))
					bp = bp->next();

				// if it doesn't exist, add a new one
				if (bp != NULL)
				{
					if (!is_main_console())
					{
						debug->breakpoint_enable(bp->index(), !bp->enabled());
						debug_console_printf(machine(), "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled");
						machine().debug_view().update_all();
						debugger_refresh_display(machine());
					}
					else if (dasmview->source_is_visible_cpu())
					{
						astring command;
						command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index());
						debug_console_execute_command(machine(), command, 1);
					}
				}
			}
			return true;

		case ID_RUN_TO_CURSOR:
			if (dasmview->cursor_visible())
			{
				offs_t const address = dasmview->selected_address();
				if (dasmview->source_is_visible_cpu())
				{
					astring command;
					command.printf("go 0x%X", address);
					debug_console_execute_command(machine(), command, 1);
				}
				else
				{
					dasmview->source_device()->debug()->go(address);
				}
			}
			return true;

		case ID_SHOW_RAW:
			dasmview->set_right_column(DASM_RIGHTCOL_RAW);
			recompute_children();
			return true;

		case ID_SHOW_ENCRYPTED:
			dasmview->set_right_column(DASM_RIGHTCOL_ENCRYPTED);
			recompute_children();
			return true;

		case ID_SHOW_COMMENTS:
			dasmview->set_right_column(DASM_RIGHTCOL_COMMENTS);
			recompute_children();
			return true;
		}
		break;
	}
	return editwin_info::handle_command(wparam, lparam);
}