mirror of
https://github.com/holub/mame
synced 2025-04-22 00:11:58 +03:00
-debugger/win: Cascade positions of new debugger windows.
-osd: Better button names for NVIDIA Shield and Xbox One controllers with SDL game controller module.
This commit is contained in:
parent
e7e7af0a80
commit
c239bc33bd
@ -49,6 +49,7 @@ public:
|
||||
m_waiting_for_debugger(false),
|
||||
m_window_list(),
|
||||
m_main_console(nullptr),
|
||||
m_next_window_pos{ 0, 0 },
|
||||
m_config(),
|
||||
m_save_windows(true)
|
||||
{
|
||||
@ -83,6 +84,8 @@ protected:
|
||||
virtual void show_all() override;
|
||||
virtual void hide_all() override;
|
||||
|
||||
virtual void stagger_window(HWND window, int width, int height) override;
|
||||
|
||||
private:
|
||||
template <typename T> T *create_window();
|
||||
|
||||
@ -97,6 +100,9 @@ private:
|
||||
std::vector<std::unique_ptr<osd::debugger::win::debugwin_info> > m_window_list;
|
||||
osd::debugger::win::consolewin_info *m_main_console;
|
||||
|
||||
POINT m_next_window_pos;
|
||||
LONG m_window_start_x;
|
||||
|
||||
util::xml::file::ptr m_config;
|
||||
bool m_save_windows;
|
||||
};
|
||||
@ -129,8 +135,27 @@ void debugger_windows::wait_for_debugger(device_t &device, bool firststop)
|
||||
{
|
||||
// create a console window
|
||||
if (!m_main_console)
|
||||
{
|
||||
m_main_console = create_window<osd::debugger::win::consolewin_info>();
|
||||
|
||||
// set the starting position for new auxiliary windows
|
||||
HMONITOR const nearest_monitor = MonitorFromWindow(
|
||||
std::static_pointer_cast<win_window_info>(osd_common_t::s_window_list.front())->platform_window(),
|
||||
MONITOR_DEFAULTTONEAREST);
|
||||
if (nearest_monitor)
|
||||
{
|
||||
MONITORINFO info;
|
||||
std::memset(&info, 0, sizeof(info));
|
||||
info.cbSize = sizeof(info);
|
||||
if (GetMonitorInfo(nearest_monitor, &info))
|
||||
{
|
||||
m_next_window_pos.x = info.rcWork.left + 100;
|
||||
m_next_window_pos.y = info.rcWork.top + 100;
|
||||
m_window_start_x = m_next_window_pos.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update the views in the console to reflect the current CPU
|
||||
if (m_main_console)
|
||||
m_main_console->set_cpu(device);
|
||||
@ -286,6 +311,52 @@ void debugger_windows::hide_all()
|
||||
}
|
||||
|
||||
|
||||
void debugger_windows::stagger_window(HWND window, int width, int height)
|
||||
{
|
||||
// get width/height for client size
|
||||
RECT target;
|
||||
target.left = 0;
|
||||
target.top = 0;
|
||||
target.right = width;
|
||||
target.bottom = height;
|
||||
if (!AdjustWindowRectEx(&target, GetWindowLong(window, GWL_STYLE), GetMenu(window) ? TRUE : FALSE,GetWindowLong(window, GWL_EXSTYLE)))
|
||||
{
|
||||
// really shouldn't end up here, but have to do something
|
||||
SetWindowPos(window, HWND_TOP, m_next_window_pos.x, m_next_window_pos.y, width, height, SWP_SHOWWINDOW);
|
||||
return;
|
||||
}
|
||||
target.right -= target.left;
|
||||
target.bottom -= target.top;
|
||||
target.left = target.top = 0;
|
||||
|
||||
// get the work area for the nearest monitor to the target position
|
||||
HMONITOR const mon = MonitorFromPoint(m_next_window_pos, MONITOR_DEFAULTTONEAREST);
|
||||
if (mon)
|
||||
{
|
||||
MONITORINFO info;
|
||||
std::memset(&info, 0, sizeof(info));
|
||||
info.cbSize = sizeof(info);
|
||||
if (GetMonitorInfo(mon, &info))
|
||||
{
|
||||
// restart cascade if necessary
|
||||
if (((m_next_window_pos.x + target.right) > info.rcWork.right) || ((m_next_window_pos.y + target.bottom) > info.rcWork.bottom))
|
||||
{
|
||||
m_next_window_pos.x = m_window_start_x += 16;
|
||||
m_next_window_pos.y = info.rcWork.top + 100;
|
||||
if ((m_next_window_pos.x + target.right) > info.rcWork.right)
|
||||
m_next_window_pos.x = m_window_start_x = info.rcWork.left + 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// move the window and adjust the next position
|
||||
MoveWindow(window, m_next_window_pos.x, m_next_window_pos.y, target.right, target.bottom, FALSE);
|
||||
SetWindowPos(window, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
|
||||
m_next_window_pos.x += 16;
|
||||
m_next_window_pos.y += 16;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
T *debugger_windows::create_window()
|
||||
{
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
|
||||
virtual void show_all() = 0;
|
||||
virtual void hide_all() = 0;
|
||||
|
||||
virtual void stagger_window(HWND window, int width, int height) = 0;
|
||||
};
|
||||
|
||||
} // namespace osd::debugger::win
|
||||
|
@ -44,9 +44,14 @@ debugwin_info::debugwin_info(debugger_windows_interface &debugger, bool is_main_
|
||||
{
|
||||
register_window_class();
|
||||
|
||||
m_wnd = win_create_window_ex_utf8(DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE,
|
||||
0, 0, 100, 100, std::static_pointer_cast<win_window_info>(osd_common_t::s_window_list.front())->platform_window(), create_standard_menubar(), GetModuleHandleUni(), this);
|
||||
if (m_wnd == nullptr)
|
||||
m_wnd = win_create_window_ex_utf8(
|
||||
DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE,
|
||||
0, 0, 100, 100,
|
||||
std::static_pointer_cast<win_window_info>(osd_common_t::s_window_list.front())->platform_window(),
|
||||
create_standard_menubar(),
|
||||
GetModuleHandleUni(),
|
||||
this);
|
||||
if (!m_wnd)
|
||||
return;
|
||||
|
||||
RECT work_bounds;
|
||||
|
@ -39,11 +39,11 @@ disasmwin_info::disasmwin_info(debugger_windows_interface &debugger) :
|
||||
update_caption();
|
||||
|
||||
// recompute the children once to get the maxwidth
|
||||
disasmwin_info::recompute_children();
|
||||
recompute_children();
|
||||
|
||||
// position the window and recompute children again
|
||||
SetWindowPos(window(), HWND_TOP, 100, 100, maxwidth(), 200, SWP_SHOWWINDOW);
|
||||
disasmwin_info::recompute_children();
|
||||
debugger.stagger_window(window(), maxwidth(), 200);
|
||||
recompute_children();
|
||||
|
||||
// mark the edit box as the default focus and set it
|
||||
editwin_info::set_default_focus();
|
||||
|
@ -45,11 +45,9 @@ logwin_info::logwin_info(debugger_windows_interface &debugger) :
|
||||
// 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
|
||||
debugwin_info::recompute_children();
|
||||
// position the window and recompute children
|
||||
debugger.stagger_window(window(), bounds.right - bounds.left, bounds.bottom - bounds.top);
|
||||
recompute_children();
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,11 +75,11 @@ memorywin_info::memorywin_info(debugger_windows_interface &debugger) :
|
||||
update_caption();
|
||||
|
||||
// recompute the children once to get the maxwidth
|
||||
memorywin_info::recompute_children();
|
||||
recompute_children();
|
||||
|
||||
// position the window and recompute children again
|
||||
SetWindowPos(window(), HWND_TOP, 100, 100, maxwidth(), 200, SWP_SHOWWINDOW);
|
||||
memorywin_info::recompute_children();
|
||||
debugger.stagger_window(window(), maxwidth(), 200);
|
||||
recompute_children();
|
||||
|
||||
// mark the edit box as the default focus and set it
|
||||
editwin_info::set_default_focus();
|
||||
|
@ -48,11 +48,9 @@ pointswin_info::pointswin_info(debugger_windows_interface &debugger) :
|
||||
// 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
|
||||
debugwin_info::recompute_children();
|
||||
// position the window and recompute children
|
||||
debugger.stagger_window(window(), bounds.right - bounds.left, bounds.bottom - bounds.top);
|
||||
recompute_children();
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,7 +106,7 @@ char const *const CONTROLLER_BUTTON_XBOX360[]{
|
||||
"X",
|
||||
"Y",
|
||||
"View",
|
||||
"Guide",
|
||||
"Logo",
|
||||
"Menu",
|
||||
"LSB",
|
||||
"RSB",
|
||||
@ -238,6 +238,29 @@ char const *const CONTROLLER_BUTTON_XBOX360[]{
|
||||
"P4",
|
||||
"Touchpad" };
|
||||
|
||||
[[maybe_unused]] char const *const CONTROLLER_BUTTON_SHIELD[]{
|
||||
"A",
|
||||
"B",
|
||||
"X",
|
||||
"Y",
|
||||
"Back",
|
||||
"Logo",
|
||||
"Start",
|
||||
"LSB",
|
||||
"RSB",
|
||||
"LB",
|
||||
"RB",
|
||||
"D-pad Up",
|
||||
"D-pad Down",
|
||||
"D-pad Left",
|
||||
"D-pad Right",
|
||||
"Share",
|
||||
"P1",
|
||||
"P2",
|
||||
"P3",
|
||||
"P4",
|
||||
"Touchpad" };
|
||||
|
||||
struct key_lookup_table
|
||||
{
|
||||
int code;
|
||||
@ -1215,6 +1238,11 @@ public:
|
||||
break;
|
||||
#endif
|
||||
#if SDL_VERSION_ATLEAST(2, 24, 0)
|
||||
case SDL_CONTROLLER_TYPE_NVIDIA_SHIELD:
|
||||
osd_printf_verbose("Game Controller: ... NVIDIA Shield type\n");
|
||||
axisnames = CONTROLLER_AXIS_XBOX;
|
||||
buttonnames = CONTROLLER_BUTTON_SHIELD;
|
||||
break;
|
||||
//case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT:
|
||||
//case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT:
|
||||
case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR:
|
||||
|
Loading…
Reference in New Issue
Block a user