summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/input/input_dinput.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-01-30 06:23:19 +1100
committer Vas Crabb <vas@vastheman.com>2023-02-01 04:00:44 +1100
commit2810c9d91bfaee4d833b3c6dc03672799053f702 (patch)
tree5f56c82559cf630785dcdcced145129923223152 /src/osd/modules/input/input_dinput.cpp
parent12e5fa39063ba0fdba6dc81a08fbb07811f2a611 (diff)
osd: Turned video modules into actual modules, fixed various issues.
Don't ignore the return status of OSD module initialisation. Attempt to fall back to an alternate module if the selected module fails to initialise. Log more useful diagnostic information at verbose level. Fixed BGFX crash on exit after toggling fullscreen. Also persist more settings than just the selected chains across toggling fullscreen. Turned video modules into OSD modules in the same sense as all the other OSD modules. They now use the same selection/fallback mechanism as all the other modules without special extra code in the OSD implementations. Untangled some object ownership mess. Windows own renderers, OSD objects own windows. Fixed a refrence loop that caused the first window object to always leak. Don't create renderer object until after underlying window has been created. Fixed issues with order of creation/destruction when toggling fullscreen or changing prescale in fullscreen with -switchres in SDL builds. Use more smart pointers in BGFX and Direct3D render modules. Most of the code now reutrns a smart pointer when handing over ownership or a naked pointer when retaining ownership. Fixed a few leaks and simplified cleanup code. Encapsulated various OSD modules better.
Diffstat (limited to 'src/osd/modules/input/input_dinput.cpp')
-rw-r--r--src/osd/modules/input/input_dinput.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp
index 93b1f233000..31a36fc841a 100644
--- a/src/osd/modules/input/input_dinput.cpp
+++ b/src/osd/modules/input/input_dinput.cpp
@@ -625,11 +625,11 @@ std::pair<Microsoft::WRL::ComPtr<IDirectInputDevice8>, LPCDIDATAFORMAT> dinput_a
HWND window_handle;
DWORD di_cooperative_level;
#if defined(OSD_WINDOWS)
- auto const window = std::static_pointer_cast<win_window_info>(osd_common_t::s_window_list.front());
- bool const standalone_window = window && !window->attached_mode();
+ auto const &window = dynamic_cast<win_window_info &>(*osd_common_t::window_list().front());
+ bool const standalone_window = !window.attached_mode();
#elif defined(SDLMAME_WIN32)
- auto const window = std::static_pointer_cast<sdl_window_info>(osd_common_t::s_window_list.front());
- bool const standalone_window = bool(window);
+ auto const &window = dynamic_cast<sdl_window_info &>(*osd_common_t::window_list().front());
+ bool const standalone_window = true;
#endif
if (!standalone_window)
{
@@ -640,12 +640,13 @@ std::pair<Microsoft::WRL::ComPtr<IDirectInputDevice8>, LPCDIDATAFORMAT> dinput_a
else
{
#if defined(OSD_WINDOWS)
- window_handle = window->platform_window();
+ window_handle = window.platform_window();
#elif defined(SDLMAME_WIN32)
- auto const sdlwindow = window->platform_window();
+ auto const sdlwindow = window.platform_window();
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
- SDL_GetWindowWMInfo(sdlwindow, &info);
+ if (!SDL_GetWindowWMInfo(sdlwindow, &info))
+ return std::make_pair(nullptr, nullptr);
window_handle = info.info.win.window;
#endif
switch (cooperative_level)