summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/osd/modules/debugger/debugwin.cpp71
-rw-r--r--src/osd/modules/debugger/win/debugwin.h2
-rw-r--r--src/osd/modules/debugger/win/debugwininfo.cpp11
-rw-r--r--src/osd/modules/debugger/win/disasmwininfo.cpp6
-rw-r--r--src/osd/modules/debugger/win/logwininfo.cpp8
-rw-r--r--src/osd/modules/debugger/win/memorywininfo.cpp6
-rw-r--r--src/osd/modules/debugger/win/pointswininfo.cpp8
-rw-r--r--src/osd/modules/input/input_sdl.cpp30
8 files changed, 122 insertions, 20 deletions
diff --git a/src/osd/modules/debugger/debugwin.cpp b/src/osd/modules/debugger/debugwin.cpp
index 365f5206e86..2c4677f316d 100644
--- a/src/osd/modules/debugger/debugwin.cpp
+++ b/src/osd/modules/debugger/debugwin.cpp
@@ -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()
{
diff --git a/src/osd/modules/debugger/win/debugwin.h b/src/osd/modules/debugger/win/debugwin.h
index b123921a23f..52303eefc2c 100644
--- a/src/osd/modules/debugger/win/debugwin.h
+++ b/src/osd/modules/debugger/win/debugwin.h
@@ -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
diff --git a/src/osd/modules/debugger/win/debugwininfo.cpp b/src/osd/modules/debugger/win/debugwininfo.cpp
index 63d257b6529..473236fcd8d 100644
--- a/src/osd/modules/debugger/win/debugwininfo.cpp
+++ b/src/osd/modules/debugger/win/debugwininfo.cpp
@@ -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;
diff --git a/src/osd/modules/debugger/win/disasmwininfo.cpp b/src/osd/modules/debugger/win/disasmwininfo.cpp
index 709ff4faa59..6b38609ace8 100644
--- a/src/osd/modules/debugger/win/disasmwininfo.cpp
+++ b/src/osd/modules/debugger/win/disasmwininfo.cpp
@@ -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();
diff --git a/src/osd/modules/debugger/win/logwininfo.cpp b/src/osd/modules/debugger/win/logwininfo.cpp
index cd67e11fe8e..40515906bb1 100644
--- a/src/osd/modules/debugger/win/logwininfo.cpp
+++ b/src/osd/modules/debugger/win/logwininfo.cpp
@@ -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();
}
diff --git a/src/osd/modules/debugger/win/memorywininfo.cpp b/src/osd/modules/debugger/win/memorywininfo.cpp
index 59972cdde42..92078854e2e 100644
--- a/src/osd/modules/debugger/win/memorywininfo.cpp
+++ b/src/osd/modules/debugger/win/memorywininfo.cpp
@@ -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();
diff --git a/src/osd/modules/debugger/win/pointswininfo.cpp b/src/osd/modules/debugger/win/pointswininfo.cpp
index 9a4e52c3cf3..f8fb4f6ce8d 100644
--- a/src/osd/modules/debugger/win/pointswininfo.cpp
+++ b/src/osd/modules/debugger/win/pointswininfo.cpp
@@ -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();
}
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp
index a6ee013ce3c..0f7ece4bdf1 100644
--- a/src/osd/modules/input/input_sdl.cpp
+++ b/src/osd/modules/input/input_sdl.cpp
@@ -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: