diff options
author | 2016-07-19 02:07:06 +1000 | |
---|---|---|
committer | 2016-07-19 02:07:06 +1000 | |
commit | 1c363eeff0322f64d446f616d686a14a6a266ece (patch) | |
tree | 37c4bfd0d137e0b84c37f8a0f32af5a6126fa5ef /src | |
parent | cc22c75313f9710687c49fe4a2ac3a8d5c54c22b (diff) | |
parent | 14f5329fd4e1a8c09893864a495af55d82368068 (diff) |
Merge pull request #1119 from GiuseppeGorgoglione/master
BGFX: fix crash when bgfx effect folder is not present or incomplete
Diffstat (limited to 'src')
-rw-r--r-- | src/osd/modules/render/drawbgfx.cpp | 20 | ||||
-rw-r--r-- | src/osd/modules/render/drawbgfx.h | 2 | ||||
-rw-r--r-- | src/osd/windows/window.cpp | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index aaf47eb344e..4a3d6711c7c 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -235,6 +235,12 @@ int renderer_bgfx::create() m_screen_effect[2] = m_effects->effect("screen_multiply"); m_screen_effect[3] = m_effects->effect("screen_add"); + if ( m_gui_effect[0] == nullptr || m_gui_effect[1] == nullptr || m_gui_effect[2] == nullptr || m_gui_effect[3] == nullptr || + m_screen_effect[0] == nullptr || m_screen_effect[1] == nullptr || m_screen_effect[2] == nullptr || m_screen_effect[3] == nullptr) + { + fatalerror("BGFX: Unable to load required shaders. Please check and reinstall the %s folder\n", m_options.bgfx_path()); + } + m_chains = new chain_manager(win->machine(), m_options, *m_textures, *m_targets, *m_effects, win->m_index, *this); m_sliders_dirty = true; @@ -283,6 +289,20 @@ void renderer_bgfx::record() } } +bool renderer_bgfx::init(running_machine &machine) +{ + const char *bgfx_path = downcast<osd_options &>(machine.options()).bgfx_path(); + + osd::directory::ptr directory = osd::directory::open(bgfx_path); + if (directory == nullptr) + { + osd_printf_verbose("Unable to find the %s folder. Please reinstall it to use the BGFX renderer\n", bgfx_path); + return true; + } + + return false; +} + void renderer_bgfx::exit() { imguiDestroy(); diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h index 91dcfae03c2..af7c9dd47e4 100644 --- a/src/osd/modules/render/drawbgfx.h +++ b/src/osd/modules/render/drawbgfx.h @@ -36,7 +36,7 @@ public: renderer_bgfx(std::shared_ptr<osd_window> w); virtual ~renderer_bgfx(); - static void init(running_machine &machine) { } + static bool init(running_machine &machine); static void exit(); virtual int create() override; diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index cda1adb7562..b1cc369c0af 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -172,7 +172,7 @@ bool windows_osd_interface::window_init() error = renderer_gdi::init(machine()); break; case VIDEO_MODE_BGFX: - renderer_bgfx::init(machine()); + error = renderer_bgfx::init(machine()); break; #if (USE_OPENGL) case VIDEO_MODE_OPENGL: |