diff options
Diffstat (limited to 'src/osd')
46 files changed, 374 insertions, 394 deletions
diff --git a/src/osd/modules/debugger/debuggdbstub.cpp b/src/osd/modules/debugger/debuggdbstub.cpp index b8c0bbe7b80..80e808ed38f 100644 --- a/src/osd/modules/debugger/debuggdbstub.cpp +++ b/src/osd/modules/debugger/debuggdbstub.cpp @@ -889,7 +889,7 @@ debug_gdbstub::cmd_reply debug_gdbstub::handle_q(const char *buf) if ( !hex_decode(&data, buf, strlen(buf) / 2) ) return REPLY_ENN; std::string command(data.begin(), data.end()); - text_buffer *textbuf = m_debugger_console->get_console_textbuf(); + text_buffer &textbuf = m_debugger_console->get_console_textbuf(); text_buffer_clear(textbuf); m_debugger_console->execute_command(command, false); uint32_t nlines = text_buffer_num_lines(textbuf); diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 296b148c5db..5e1e7f5c080 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -225,11 +225,7 @@ static void view_list_remove(debug_area* item) static debug_area *dview_alloc(running_machine &machine, debug_view_type type) { - debug_area *dv; - - dv = global_alloc(debug_area(machine, type)); - - return dv; + return new debug_area(machine, type); } static inline void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg) @@ -357,7 +353,7 @@ void debug_imgui::handle_keys() { switch (event.event_type) { - case ui_event::IME_CHAR: + case ui_event::type::IME_CHAR: m_key_char = event.ch; if(focus_view != nullptr) focus_view->view->process_char(m_key_char); @@ -1406,7 +1402,7 @@ void debug_imgui::update() if(to_delete != nullptr) { view_list_remove(to_delete); - global_free(to_delete); + delete to_delete; } ImGui::PopStyleColor(12); diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp index e6ad4c0986f..5589a48018a 100644 --- a/src/osd/modules/debugger/win/consolewininfo.cpp +++ b/src/osd/modules/debugger/win/consolewininfo.cpp @@ -30,10 +30,10 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) : goto cleanup; // create the views - m_views[1].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_STATE))); + m_views[1].reset(new debugview_info(debugger, *this, window(), DVT_STATE)); if (!m_views[1]->is_valid()) goto cleanup; - m_views[2].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_CONSOLE))); + m_views[2].reset(new debugview_info(debugger, *this, window(), DVT_CONSOLE)); if (!m_views[2]->is_valid()) goto cleanup; diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp index 800443b47c1..f68a7652c77 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp +++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp @@ -26,7 +26,7 @@ disasmbasewin_info::disasmbasewin_info(debugger_windows_interface &debugger, boo if (!window()) return; - m_views[0].reset(global_alloc(disasmview_info(debugger, *this, window()))); + m_views[0].reset(new disasmview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/logwininfo.cpp b/src/osd/modules/debugger/win/logwininfo.cpp index 6d2cd59b554..88b6022aa9a 100644 --- a/src/osd/modules/debugger/win/logwininfo.cpp +++ b/src/osd/modules/debugger/win/logwininfo.cpp @@ -19,7 +19,7 @@ logwin_info::logwin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(logview_info(debugger, *this, window()))); + m_views[0].reset(new logview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/memorywininfo.cpp b/src/osd/modules/debugger/win/memorywininfo.cpp index 93151cc018d..18f28252f12 100644 --- a/src/osd/modules/debugger/win/memorywininfo.cpp +++ b/src/osd/modules/debugger/win/memorywininfo.cpp @@ -23,7 +23,7 @@ memorywin_info::memorywin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(memoryview_info(debugger, *this, window()))); + m_views[0].reset(new memoryview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/pointswininfo.cpp b/src/osd/modules/debugger/win/pointswininfo.cpp index 24a8f865e6f..eb2ca1875e2 100644 --- a/src/osd/modules/debugger/win/pointswininfo.cpp +++ b/src/osd/modules/debugger/win/pointswininfo.cpp @@ -20,7 +20,7 @@ pointswin_info::pointswin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_BREAK_POINTS))); + m_views[0].reset(new debugview_info(debugger, *this, window(), DVT_BREAK_POINTS)); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); @@ -96,7 +96,7 @@ bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam) { case ID_SHOW_BREAKPOINTS: m_views[0].reset(); - m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_BREAK_POINTS))); + m_views[0].reset(new 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"); @@ -105,7 +105,7 @@ bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam) case ID_SHOW_WATCHPOINTS: m_views[0].reset(); - m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_WATCH_POINTS))); + m_views[0].reset(new 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"); diff --git a/src/osd/modules/file/posixptty.cpp b/src/osd/modules/file/posixptty.cpp index 5b38acc750a..5ecb37057ad 100644 --- a/src/osd/modules/file/posixptty.cpp +++ b/src/osd/modules/file/posixptty.cpp @@ -19,7 +19,7 @@ #include <unistd.h> #include <cstdlib> -#if defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) #include <termios.h> #include <libutil.h> #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp index 82f70c17672..b8a60aee200 100644 --- a/src/osd/modules/font/font_dwrite.cpp +++ b/src/osd/modules/font/font_dwrite.cpp @@ -146,7 +146,7 @@ HRESULT SaveBitmap2(bitmap_argb32 &bitmap, const WCHAR *filename) uint32_t* pRow = pBitmap.get() + (y * bitmap.width()); for (int x = 0; x < bitmap.width(); x++) { - uint32_t pixel = bitmap.pix32(y, x); + uint32_t pixel = bitmap.pix(y, x); pRow[x] = (pixel == 0xFFFFFFFF) ? rgb_t(0xFF, 0x00, 0x00, 0x00) : rgb_t(0xFF, 0xFF, 0xFF, 0xFF); } } @@ -570,7 +570,7 @@ public: // copy the bits into it for (int y = 0; y < bitmap.height(); y++) { - uint32_t *dstrow = &bitmap.pix32(y); + uint32_t *dstrow = &bitmap.pix(y); uint8_t *srcrow = &pixels[(y + actbounds.min_y) * bmwidth]; for (int x = 0; x < bitmap.width(); x++) { diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp index a473b71b35a..08c1f076970 100644 --- a/src/osd/modules/font/font_sdl.cpp +++ b/src/osd/modules/font/font_sdl.cpp @@ -174,7 +174,7 @@ bool osd_font_sdl::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_ // copy the rendered character image into it for (int y = 0; y < bitmap.height(); y++) { - std::uint32_t *const dstrow = &bitmap.pix32(y); + std::uint32_t *const dstrow = &bitmap.pix(y); std::uint8_t const *const srcrow = reinterpret_cast<std::uint8_t const *>(drawsurf->pixels) + (y * drawsurf->pitch); for (int x = 0; x < drawsurf->w; x++) diff --git a/src/osd/modules/font/font_windows.cpp b/src/osd/modules/font/font_windows.cpp index 95f10c0a051..4cb286c9deb 100644 --- a/src/osd/modules/font/font_windows.cpp +++ b/src/osd/modules/font/font_windows.cpp @@ -28,6 +28,7 @@ namespace { + class osd_font_windows : public osd_font { public: @@ -260,7 +261,7 @@ bool osd_font_windows::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, int32_t // copy the bits into it for (int y = 0; y < bitmap.height(); y++) { - uint32_t *dstrow = &bitmap.pix32(y); + uint32_t *dstrow = &bitmap.pix(y); uint8_t *srcrow = &bits[(y + actbounds.min_y) * rowbytes]; for (int x = 0; x < bitmap.width(); x++) { diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 25d4b979e87..a04952bcdbc 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -290,42 +290,42 @@ void osd_common_t::register_options() int num; std::vector<const char *> dnames; - m_mod_man.get_module_names(OSD_MONITOR_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MONITOR_PROVIDER, 20, num, names); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_MONITOR_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_FONT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_KEYBOARDINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_KEYBOARDINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_KEYBOARDINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_MOUSEINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MOUSEINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_MOUSEINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_LIGHTGUNINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_LIGHTGUNINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_LIGHTGUNINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_JOYSTICKINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_JOYSTICKINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_JOYSTICKINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); @@ -333,7 +333,7 @@ void osd_common_t::register_options() #if 0 // Register midi options and update options - m_mod_man.get_module_names(OSD_MIDI_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MIDI_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); @@ -341,13 +341,13 @@ void osd_common_t::register_options() #endif // Register debugger options and update options - m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_DEBUG_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 9fb1b1eef6b..2df6a91b827 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -216,7 +216,7 @@ public: virtual osd_font::ptr font_alloc() override { return m_font_module->font_alloc(); } virtual bool get_font_families(std::string const &font_path, std::vector<std::pair<std::string, std::string> > &result) override { return m_font_module->get_font_families(font_path, result); } - virtual osd_midi_device *create_midi_device() override { return m_midi->create_midi_device(); } + virtual std::unique_ptr<osd_midi_device> create_midi_device() override { return m_midi->create_midi_device(); } // FIXME: everything below seems to be osd specific and not part of // this INTERFACE but part of the osd IMPLEMENTATION @@ -311,10 +311,10 @@ private: // this template function creates a stub which constructs a debugger -template<class _DeviceClass> +template<class DeviceClass> debug_module *osd_debugger_creator() { - return global_alloc(_DeviceClass()); + return new DeviceClass(); } #endif // MAME_OSD_LIB_OSDOBJ_COMMON_H diff --git a/src/osd/modules/midi/midi_module.h b/src/osd/modules/midi/midi_module.h index 6c50cdd3edc..8e64800622e 100644 --- a/src/osd/modules/midi/midi_module.h +++ b/src/osd/modules/midi/midi_module.h @@ -4,13 +4,17 @@ * midi_module.h * */ +#ifndef MAME_OSD_MODULES_MIDI_MIDI_MODULE_H +#define MAME_OSD_MODULES_MIDI_MIDI_MODULE_H -#ifndef MIDI_MODULE_H_ -#define MIDI_MODULE_H_ +#pragma once #include "osdepend.h" #include "modules/osdmodule.h" +#include <memory> + + //============================================================ // CONSTANTS //============================================================ @@ -23,10 +27,9 @@ public: virtual ~midi_module() { } // specific routines - virtual osd_midi_device *create_midi_device() = 0; + virtual std::unique_ptr<osd_midi_device> create_midi_device() = 0; // FIXME: should return a list of strings ... - virtual void list_midi_devices(void) = 0; + virtual void list_midi_devices() = 0; }; - -#endif /* MIDI_MODULE_H_ */ +#endif // MAME_OSD_MODULES_MIDI_MIDI_MODULE_H diff --git a/src/osd/modules/midi/none.cpp b/src/osd/modules/midi/none.cpp index 822de79bd08..25f83b45fbe 100644 --- a/src/osd/modules/midi/none.cpp +++ b/src/osd/modules/midi/none.cpp @@ -17,8 +17,7 @@ class none_module : public osd_module, public midi_module { public: - none_module() - : osd_module(OSD_MIDI_PROVIDER, "pm"), midi_module() + none_module() : osd_module(OSD_MIDI_PROVIDER, "pm"), midi_module() { } virtual ~none_module() { } @@ -26,7 +25,7 @@ public: virtual int init(const osd_options &options) override; virtual void exit() override; - virtual osd_midi_device *create_midi_device() override; + virtual std::unique_ptr<osd_midi_device> create_midi_device() override; virtual void list_midi_devices() override; }; @@ -43,9 +42,9 @@ public: virtual void write(uint8_t data) override; }; -osd_midi_device *none_module::create_midi_device() +std::unique_ptr<osd_midi_device> none_module::create_midi_device() { - return global_alloc(osd_midi_device_none()); + return std::make_unique<osd_midi_device_none>(); } diff --git a/src/osd/modules/midi/portmidi.cpp b/src/osd/modules/midi/portmidi.cpp index 64f71ca6689..9deca98ea2d 100644 --- a/src/osd/modules/midi/portmidi.cpp +++ b/src/osd/modules/midi/portmidi.cpp @@ -29,7 +29,7 @@ public: virtual int init(const osd_options &options)override; virtual void exit()override; - virtual osd_midi_device *create_midi_device() override; + virtual std::unique_ptr<osd_midi_device> create_midi_device() override; virtual void list_midi_devices() override; }; @@ -60,9 +60,9 @@ private: bool rx_sysex; }; -osd_midi_device *pm_module::create_midi_device() +std::unique_ptr<osd_midi_device> pm_module::create_midi_device() { - return global_alloc(osd_midi_device_pm()); + return std::make_unique<osd_midi_device_pm>(); } diff --git a/src/osd/modules/netdev/pcap.cpp b/src/osd/modules/netdev/pcap.cpp index 799cff9ec0e..2ae32df0f3b 100644 --- a/src/osd/modules/netdev/pcap.cpp +++ b/src/osd/modules/netdev/pcap.cpp @@ -250,7 +250,7 @@ netdev_pcap::~netdev_pcap() static CREATE_NETDEV(create_pcap) { - auto *dev = global_alloc(netdev_pcap(ifname, ifdev, rate)); + auto *dev = new netdev_pcap(ifname, ifdev, rate); return dynamic_cast<osd_netdev *>(dev); } diff --git a/src/osd/modules/netdev/taptun.cpp b/src/osd/modules/netdev/taptun.cpp index 1b549f5b3b2..baa45da0d5d 100644 --- a/src/osd/modules/netdev/taptun.cpp +++ b/src/osd/modules/netdev/taptun.cpp @@ -337,7 +337,7 @@ int netdev_tap::recv_dev(uint8_t **buf) static CREATE_NETDEV(create_tap) { - auto *dev = global_alloc(netdev_tap(ifname, ifdev, rate)); + auto *dev = new netdev_tap(ifname, ifdev, rate); return dynamic_cast<osd_netdev *>(dev); } diff --git a/src/osd/modules/opengl/osd_opengl.h b/src/osd/modules/opengl/osd_opengl.h index 47d0b3c429c..d3e2a758d73 100644 --- a/src/osd/modules/opengl/osd_opengl.h +++ b/src/osd/modules/opengl/osd_opengl.h @@ -21,7 +21,7 @@ #ifdef _MSC_VER #include <windows.h> #include "GL/GL.h" - #include "bgfx/3rdparty/khronos/gl/glext.h " + #include "bgfx/3rdparty/khronos/gl/glext.h" #ifndef USE_DISPATCH_GL #include "bgfx/3rdparty/khronos/wgl/wglext.h" #endif diff --git a/src/osd/modules/osdmodule.cpp b/src/osd/modules/osdmodule.cpp index 75adc5c75bb..fec18ac5335 100644 --- a/src/osd/modules/osdmodule.cpp +++ b/src/osd/modules/osdmodule.cpp @@ -12,36 +12,23 @@ osd_module_manager::osd_module_manager() { - for (int i=0; i<MAX_MODULES; i++) - { - m_modules[i] = nullptr; - m_selected[i] = nullptr; - } } + osd_module_manager::~osd_module_manager() { - for (int i = 0; m_modules[i] != nullptr; i++) - { - global_free(m_modules[i]); - } } void osd_module_manager::register_module(const module_type &mod_type) { - auto const slot = std::find(std::begin(m_modules), std::end(m_modules), nullptr); - if (std::end(m_modules) == slot) - throw emu_fatalerror("osd_module_manager::register_module: Module registration beyond MAX_MODULES!"); - - osd_module *module = mod_type(); + std::unique_ptr<osd_module> module = mod_type(); if (module->probe()) { osd_printf_verbose("===> registered module %s %s\n", module->name(), module->type()); - *slot = module; + m_modules.emplace_back(std::move(module)); } else { osd_printf_verbose("===> not supported %s %s\n", module->name(), module->type()); - global_free(module); } } @@ -54,7 +41,7 @@ osd_module *osd_module_manager::get_module_generic(const char *type, const char { int const i = get_module_index(type, name); if (i >= 0) - return m_modules[i]; + return m_modules[i].get(); else return nullptr; } @@ -64,54 +51,43 @@ osd_module *osd_module_manager::select_module(const char *type, const char *name osd_module *m = get_module_generic(type, name); // FIXME: check if already exists! - int i; - for (i = 0; m_selected[i] != nullptr; i++) - ; - m_selected[i] = m; + if (m) + m_selected.emplace_back(*m); return m; } void osd_module_manager::init(const osd_options &options) { - for (int i = 0; m_selected[i] != nullptr; i++) - { - m_selected[i]->init(options); - } + for (osd_module &m : m_selected) + m.init(options); } void osd_module_manager::exit() { // Find count - int cnt; - for (cnt = 0; m_selected[cnt] != nullptr; cnt++) - ; - for (int i = cnt - 1; i >= 0; i--) + while (!m_selected.empty()) { - m_selected[i]->exit(); - m_selected[i] = nullptr; + m_selected.back().get().exit(); + m_selected.pop_back(); } } int osd_module_manager::get_module_index(const char *type, const char *name) const { - for (int i = 0; m_modules[i] != nullptr; i++) + for (int i = 0; m_modules.size() > i; i++) { - if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0))) + if ((m_modules[i]->type() == type) && (!name[0] || (m_modules[i]->name() == name))) return i; } return -1; } -void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[]) const +void osd_module_manager::get_module_names(const char *type, const int max, int &num, const char *names[]) const { - *num = 0; - for (int i = 0; m_modules[i] != nullptr; i++) + num = 0; + for (int i = 0; (m_modules.size() > i) && (max > num); i++) { - if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max)) - { - names[*num] = m_modules[i]->name(); - *num = *num + 1; - } - + if (m_modules[i]->type() == type) + names[num++] = m_modules[i]->name().c_str(); } } diff --git a/src/osd/modules/osdmodule.h b/src/osd/modules/osdmodule.h index 95178b27f70..cd72ad2c480 100644 --- a/src/osd/modules/osdmodule.h +++ b/src/osd/modules/osdmodule.h @@ -7,62 +7,63 @@ OSD module management *******************************************************************c********/ - -//#pragma once - #ifndef MAME_OSD_MODULES_OSDMODULE_H #define MAME_OSD_MODULES_OSDMODULE_H +#pragma once + #include "osdcore.h" #include "osdepend.h" +#include <functional> +#include <memory> +#include <string> +#include <vector> + + //============================================================ // TYPE DEFINITIONS //============================================================ class osd_options; -class osd_module; // ======================> osd_module class osd_module { public: - - osd_module(const char *type, const char *name) - : m_name(name), m_type(type) - {} virtual ~osd_module() { } - const char * name() const { return m_name.c_str(); } - const char * type() const { return m_type.c_str(); } + std::string const &name() const { return m_name; } + std::string const &type() const { return m_type; } virtual bool probe() { return true; } virtual int init(const osd_options &options) = 0; virtual void exit() { } +protected: + osd_module(const char *type, const char *name) : m_name(name), m_type(type) { } + osd_module(osd_module const &) = delete; + private: - std::string m_name; - std::string m_type; + std::string const m_name; + std::string const m_type; }; // a module_type is simply a pointer to its alloc function -typedef osd_module *(*module_type)(); +typedef std::unique_ptr<osd_module> (*module_type)(); // this template function creates a stub which constructs a module -template<class ModuleClass> -osd_module *module_creator() +template <class ModuleClass> +std::unique_ptr<osd_module> module_creator() { - return global_alloc(ModuleClass()); + return std::unique_ptr<osd_module>(new ModuleClass); } class osd_module_manager { public: - - static const int MAX_MODULES = 64; - osd_module_manager(); ~osd_module_manager(); @@ -79,7 +80,7 @@ public: osd_module *select_module(const char *type, const char *name = ""); - void get_module_names(const char *type, const int max, int *num, const char *names[]) const; + void get_module_names(const char *type, const int max, int &num, const char *names[]) const; void init(const osd_options &options); @@ -88,8 +89,8 @@ public: private: int get_module_index(const char *type, const char *name) const; - osd_module *m_modules[MAX_MODULES]; - osd_module *m_selected[MAX_MODULES]; + std::vector<std::unique_ptr<osd_module> > m_modules; + std::vector<std::reference_wrapper<osd_module> > m_selected; }; #define MODULE_DEFINITION(mod_id, mod_class) \ diff --git a/src/osd/modules/output/win32_output.cpp b/src/osd/modules/output/win32_output.cpp index f01c46b735d..98731b32164 100644 --- a/src/osd/modules/output/win32_output.cpp +++ b/src/osd/modules/output/win32_output.cpp @@ -162,7 +162,7 @@ void output_win32::exit() { registered_client *temp = m_clientlist; m_clientlist = temp->next; - global_free(temp); + delete temp; } // broadcast a shutdown message @@ -266,7 +266,7 @@ LRESULT output_win32::register_client(HWND hwnd, LPARAM id) } // add us to the end - *client = global_alloc(registered_client); + *client = new registered_client; (*client)->next = nullptr; (*client)->id = id; (*client)->hwnd = hwnd; @@ -293,7 +293,7 @@ LRESULT output_win32::unregister_client(HWND hwnd, LPARAM id) { registered_client *temp = *client; *client = (*client)->next; - global_free(temp); + delete temp; found = true; break; } diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp index 297d7686837..0efea9b6622 100644 --- a/src/osd/modules/render/bgfx/chain.cpp +++ b/src/osd/modules/render/bgfx/chain.cpp @@ -81,7 +81,7 @@ void bgfx_chain::process(chain_manager::screen_prim &prim, int view, int screen, screen_device_iterator screen_iterator(window.machine().root_device()); screen_device* screen_device = screen_iterator.byindex(screen); - uint16_t screen_count(window.target()->current_view().screen_count()); + uint16_t screen_count(window.target()->current_view().visible_screen_count()); uint16_t screen_width = prim.m_quad_width; uint16_t screen_height = prim.m_quad_height; uint32_t rotation_type = diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index 6c22a640913..fb3c52e1fb0 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -405,7 +405,7 @@ void chain_manager::create_selection_slider(uint32_t screen_index) return; } - std::unique_ptr<slider_state> state = make_unique_clear<slider_state>(); + std::unique_ptr<slider_state> state = std::make_unique<slider_state>(); state->minval = 0; state->defval = m_current_chain[screen_index]; diff --git a/src/osd/modules/render/bgfx/inputpair.cpp b/src/osd/modules/render/bgfx/inputpair.cpp index 9fd2b0e6855..60d3c8791fe 100644 --- a/src/osd/modules/render/bgfx/inputpair.cpp +++ b/src/osd/modules/render/bgfx/inputpair.cpp @@ -111,7 +111,7 @@ int32_t bgfx_input_pair::texture_changed(int32_t id, std::string *str, int32_t n void bgfx_input_pair::create_selection_slider(uint32_t screen_index) { - m_slider_state = make_unique_clear<slider_state>(); + m_slider_state = std::make_unique<slider_state>(); m_slider_state->minval = 0; m_slider_state->defval = m_current_texture; diff --git a/src/osd/modules/render/bgfx/slider.cpp b/src/osd/modules/render/bgfx/slider.cpp index 4d51edfc0c4..927898be5a5 100644 --- a/src/osd/modules/render/bgfx/slider.cpp +++ b/src/osd/modules/render/bgfx/slider.cpp @@ -54,7 +54,7 @@ void bgfx_slider::import(float val) std::unique_ptr<slider_state> bgfx_slider::create_core_slider() { - auto state = make_unique_clear<slider_state>(); + auto state = std::make_unique<slider_state>(); state->minval = int32_t(floor(m_min / m_step + 0.5f)); state->defval = int32_t(floor(m_default / m_step + 0.5f)); diff --git a/src/osd/modules/render/bgfx/texturemanager.cpp b/src/osd/modules/render/bgfx/texturemanager.cpp index a03a6b46125..d539d1aae46 100644 --- a/src/osd/modules/render/bgfx/texturemanager.cpp +++ b/src/osd/modules/render/bgfx/texturemanager.cpp @@ -59,7 +59,11 @@ bgfx_texture* texture_manager::create_png_texture(std::string path, std::string { bitmap_argb32 bitmap; emu_file file(path.c_str(), OPEN_FLAG_READ); - render_load_png(bitmap, file, nullptr, file_name.c_str()); + if (file.open(file_name) == osd_file::error::NONE) + { + render_load_png(bitmap, file); + file.close(); + } if (bitmap.width() == 0 || bitmap.height() == 0) { diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 78e3e2f226f..57ab4943adb 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -115,7 +115,7 @@ public: for (int y = 0; y < m_height; y++) { auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch); - uint32_t *dst = &m_frame.pix32(y); + uint32_t *dst = &m_frame.pix(y); for (int x = 0; x < m_width; x++) { @@ -223,7 +223,7 @@ shaders::~shaders() if (options != nullptr) { - global_free(options); + delete options; options = nullptr; } } @@ -343,7 +343,7 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface) for (int y = 0; y < height; y++) { auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch); - uint32_t *dst = &snapshot.pix32(y); + uint32_t *dst = &snapshot.pix(y); for (int x = 0; x < width; x++) { @@ -359,14 +359,14 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface) // add two text entries describing the image std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(emulator_info::get_build_version()); std::string text2 = std::string(machine->system().manufacturer).append(" ").append(machine->system().type.fullname()); - png_info pnginfo; + util::png_info pnginfo; pnginfo.add_text("Software", text1.c_str()); pnginfo.add_text("System", text2.c_str()); // now do the actual work - png_error error = png_write_bitmap(file, &pnginfo, snapshot, 1 << 24, nullptr); - if (error != PNGERR_NONE) - osd_printf_error("Error generating PNG for HLSL snapshot: png_error = %d\n", error); + util::png_error error = util::png_write_bitmap(file, &pnginfo, snapshot, 1 << 24, nullptr); + if (error != util::png_error::NONE) + osd_printf_error("Error generating PNG for HLSL snapshot: png_error = %d\n", std::underlying_type_t<util::png_error>(error)); result = snap_copy_target->UnlockRect(); if (FAILED(result)) @@ -499,7 +499,7 @@ bool shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r snap_width = winoptions.d3d_snap_width(); snap_height = winoptions.d3d_snap_height(); - this->options = (hlsl_options*)global_alloc_clear<hlsl_options>(); + this->options = make_unique_clear<hlsl_options>().release(); this->options->params_init = false; // copy last options if initialized @@ -721,7 +721,11 @@ int shaders::create_resources() osd_printf_verbose("Direct3D: Error %08lX during device SetRenderTarget call\n", result); emu_file file(machine->options().art_path(), OPEN_FLAG_READ); - render_load_png(shadow_bitmap, file, nullptr, options->shadow_mask_texture); + if (file.open(options->shadow_mask_texture) == osd_file::error::NONE) + { + render_load_png(shadow_bitmap, file); + file.close(); + } // experimental: if we have a shadow bitmap, create a texture for it if (shadow_bitmap.valid()) @@ -742,7 +746,11 @@ int shaders::create_resources() d3d->get_texture_manager()->m_texture_list.push_back(std::move(tex)); } - render_load_png(lut_bitmap, file, nullptr, options->lut_texture); + if (file.open(options->lut_texture) == osd_file::error::NONE) + { + render_load_png(lut_bitmap, file); + file.close(); + } if (lut_bitmap.valid()) { render_texinfo texture; @@ -761,7 +769,11 @@ int shaders::create_resources() d3d->get_texture_manager()->m_texture_list.push_back(std::move(tex)); } - render_load_png(ui_lut_bitmap, file, nullptr, options->ui_lut_texture); + if (file.open(options->ui_lut_texture) == osd_file::error::NONE) + { + render_load_png(ui_lut_bitmap, file); + file.close(); + } if (ui_lut_bitmap.valid()) { render_texinfo texture; @@ -1976,7 +1988,7 @@ static void get_vector(const char *data, int count, float *out, bool report_erro std::unique_ptr<slider_state> shaders::slider_alloc(int id, const char *title, int32_t minval, int32_t defval, int32_t maxval, int32_t incval, void *arg) { - auto state = make_unique_clear<slider_state>(); + auto state = std::make_unique<slider_state>(); state->minval = minval; state->defval = defval; @@ -2431,7 +2443,7 @@ void uniform::update() } case CU_SCREEN_COUNT: { - int screen_count = win->target()->current_view().screen_count(); + int screen_count = win->target()->current_view().visible_screen_count(); m_shader->set_int("ScreenCount", screen_count); break; } diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 96b04efc3d9..af7c8559ca0 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -335,7 +335,7 @@ int renderer_sdl2::RendererSupportsFormat(Uint32 format, Uint32 access, const ch void renderer_sdl2::add_list(copy_info_t **head, const copy_info_t *element, Uint32 bm) { - copy_info_t *newci = global_alloc(copy_info_t); + copy_info_t *newci = new copy_info_t; *newci = *element; newci->bm_mask = bm; @@ -917,7 +917,7 @@ void renderer_sdl2::exit() (int) bi->perf); copy_info_t *freeme = bi; bi = bi->next; - global_free(freeme); + delete freeme; } s_blit_info[i] = nullptr; } @@ -942,7 +942,7 @@ texture_info * renderer_sdl2::texture_update(const render_primitive &prim) // if we didn't find one, create a new texture if (texture == nullptr && prim.texture.base != nullptr) { - texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags)); + texture = new texture_info(this, prim.texture, setup, prim.flags); /* add us to the texture list */ m_texlist.prepend(*texture); } diff --git a/src/osd/modules/render/draw13.h b/src/osd/modules/render/draw13.h index 26a6bb565bf..21126e8d76a 100644 --- a/src/osd/modules/render/draw13.h +++ b/src/osd/modules/render/draw13.h @@ -8,10 +8,10 @@ // //============================================================ -#pragma once +#ifndef MAME_OSD_MODULES_RENDER_DRAW13_H +#define MAME_OSD_MODULES_RENDER_DRAW13_H -#ifndef __DRAW20__ -#define __DRAW20__ +#pragma once // OSD headers #ifndef OSD_WINDOWS @@ -210,4 +210,4 @@ private: static const copy_info_t s_blit_info_default[]; }; -#endif // __DRAW20__ +#endif // MAME_OSD_MODULES_RENDER_DRAW13_H diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 3052d5fcbca..39f11a26d37 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -957,7 +957,7 @@ void renderer_bgfx::update_recording() int i = 0; for (int y = 0; y < m_avi_bitmap.height(); y++) { - uint32_t *dst = &m_avi_bitmap.pix32(y); + uint32_t *dst = &m_avi_bitmap.pix(y); for (int x = 0; x < m_avi_bitmap.width(); x++) { diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index df1e31a0c25..ee5dffdeaf0 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -118,7 +118,7 @@ static inline uint32_t ycc_to_rgb(uint8_t y, uint8_t cb, uint8_t cr) // drawd3d_init //============================================================ -static d3d_base * d3dintf; // FIX ME +static d3d_base *d3dintf = nullptr; // FIX ME //============================================================ @@ -202,14 +202,15 @@ render_primitive_list *renderer_d3d9::get_primitives() bool renderer_d3d9::init(running_machine &machine) { - d3dintf = global_alloc(d3d_base); + d3dintf = new d3d_base; d3dintf->d3d9_dll = osd::dynamic_module::open({ "d3d9.dll" }); d3d9_create_fn d3d9_create_ptr = d3dintf->d3d9_dll->bind<d3d9_create_fn>("Direct3DCreate9"); if (d3d9_create_ptr == nullptr) { - global_free(d3dintf); + delete d3dintf; + d3dintf = nullptr; osd_printf_verbose("Direct3D: Unable to find Direct3D 9 runtime library\n"); return true; } @@ -217,7 +218,8 @@ bool renderer_d3d9::init(running_machine &machine) d3dintf->d3dobj = (*d3d9_create_ptr)(D3D_SDK_VERSION); if (d3dintf->d3dobj == nullptr) { - global_free(d3dintf); + delete d3dintf; + d3dintf = nullptr; osd_printf_verbose("Direct3D: Unable to initialize Direct3D 9\n"); return true; } @@ -462,7 +464,7 @@ void d3d_texture_manager::create_resources() void d3d_texture_manager::delete_resources() { // is part of m_texlist and will be free'd there - //global_free(m_default_texture); + //delete m_default_texture; m_default_texture = nullptr; // free all textures @@ -505,7 +507,7 @@ renderer_d3d9::renderer_d3d9(std::shared_ptr<osd_window> window) : osd_renderer(window, FLAG_NONE), m_adapter(0), m_width(0), m_height(0), m_refresh(0), m_create_error_count(0), m_device(nullptr), m_gamma_supported(0), m_pixformat(), m_vertexbuf(nullptr), m_lockedbuf(nullptr), m_numverts(0), m_vectorbatch(nullptr), m_batchindex(0), m_numpolys(0), m_toggle(false), m_screen_format(), m_last_texture(nullptr), m_last_texture_flags(0), m_last_blendenable(0), m_last_blendop(0), m_last_blendsrc(0), m_last_blenddst(0), m_last_filter(0), - m_last_wrap(), m_last_modmode(0), m_shaders(nullptr), m_texture_manager(nullptr) + m_last_wrap(), m_last_modmode(0), m_shaders(nullptr), m_texture_manager() { } @@ -811,7 +813,7 @@ int renderer_d3d9::device_create(HWND hwnd) return 1; } - m_texture_manager = global_alloc(d3d_texture_manager(this)); + m_texture_manager = std::make_unique<d3d_texture_manager>(this); // try for XRGB first m_screen_format = D3DFMT_X8R8G8B8; @@ -871,7 +873,7 @@ int renderer_d3d9::device_create_resources() // create shaders only once if (m_shaders == nullptr) { - m_shaders = (shaders*)global_alloc_clear<shaders>(); + m_shaders = new shaders; } if (m_shaders->init(d3dintf, &win->machine(), this)) @@ -962,7 +964,7 @@ renderer_d3d9::~renderer_d3d9() //if (m_shaders != nullptr) //{ // // delete the HLSL interface - // global_free(m_shaders); + // delete m_shaders; // m_shaders = nullptr; //} } @@ -972,7 +974,7 @@ void renderer_d3d9::exit() if (d3dintf != nullptr) { d3dintf->d3dobj->Release(); - global_free(d3dintf); + delete d3dintf; d3dintf = nullptr; } } @@ -984,11 +986,7 @@ void renderer_d3d9::device_delete() // we do not delete the HLSL interface here - if (m_texture_manager != nullptr) - { - global_free(m_texture_manager); - m_texture_manager = nullptr; - } + m_texture_manager.reset(); // free the device itself if (m_device != nullptr) diff --git a/src/osd/modules/render/drawd3d.h b/src/osd/modules/render/drawd3d.h index 03527d7374e..2fa4a30873c 100644 --- a/src/osd/modules/render/drawd3d.h +++ b/src/osd/modules/render/drawd3d.h @@ -5,11 +5,11 @@ // drawd3d.h - Win32 Direct3D header // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWD3D_H +#define MAME_OSD_MODULES_RENDER_DRAWD3D_H #pragma once -#ifndef __WIN_DRAWD3D__ -#define __WIN_DRAWD3D__ #ifdef OSD_WINDOWS @@ -127,7 +127,7 @@ public: uint32_t get_last_texture_flags() const { return m_last_texture_flags; } - d3d_texture_manager * get_texture_manager() const { return m_texture_manager; } + d3d_texture_manager * get_texture_manager() const { return m_texture_manager.get(); } texture_info * get_default_texture(); shaders * get_shaders() const { return m_shaders; } @@ -171,9 +171,9 @@ private: shaders * m_shaders; // HLSL interface - d3d_texture_manager * m_texture_manager; // texture manager + std::unique_ptr<d3d_texture_manager> m_texture_manager; // texture manager }; #endif // OSD_WINDOWS -#endif // __WIN_DRAWD3D__ +#endif // MAME_OSD_MODULES_RENDER_DRAWD3D_H diff --git a/src/osd/modules/render/drawgdi.cpp b/src/osd/modules/render/drawgdi.cpp index bd0e6425b6e..32dac94c24a 100644 --- a/src/osd/modules/render/drawgdi.cpp +++ b/src/osd/modules/render/drawgdi.cpp @@ -16,9 +16,6 @@ renderer_gdi::~renderer_gdi() { - // free the bitmap memory - if (m_bmdata != nullptr) - global_free_array(m_bmdata); } //============================================================ @@ -83,13 +80,13 @@ int renderer_gdi::draw(const int update) if (pitch * height * 4 > m_bmsize) { m_bmsize = pitch * height * 4 * 2; - global_free_array(m_bmdata); - m_bmdata = global_alloc_array(uint8_t, m_bmsize); + m_bmdata.reset(); + m_bmdata = std::make_unique<uint8_t []>(m_bmsize); } // draw the primitives to the bitmap win->m_primlist->acquire_lock(); - software_renderer<uint32_t, 0,0,0, 16,8,0>::draw_primitives(*win->m_primlist, m_bmdata, width, height, pitch); + software_renderer<uint32_t, 0,0,0, 16,8,0>::draw_primitives(*win->m_primlist, m_bmdata.get(), width, height, pitch); win->m_primlist->release_lock(); // fill in bitmap-specific info @@ -97,8 +94,9 @@ int renderer_gdi::draw(const int update) m_bminfo.bmiHeader.biHeight = -height; // blit to the screen - StretchDIBits(win->m_dc, 0, 0, width, height, - 0, 0, width, height, - m_bmdata, &m_bminfo, DIB_RGB_COLORS, SRCCOPY); + StretchDIBits( + win->m_dc, 0, 0, width, height, + 0, 0, width, height, + m_bmdata.get(), &m_bminfo, DIB_RGB_COLORS, SRCCOPY); return 0; } diff --git a/src/osd/modules/render/drawgdi.h b/src/osd/modules/render/drawgdi.h index 49d05c18daa..7984998f4bc 100644 --- a/src/osd/modules/render/drawgdi.h +++ b/src/osd/modules/render/drawgdi.h @@ -5,11 +5,11 @@ // drawgdi.h - Win32 GDI drawing // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWGDI_H +#define MAME_OSD_MODULES_RENDER_DRAWGDI_H #pragma once -#ifndef __DRAWGDI__ -#define __DRAWGDI__ // standard windows headers #include <windows.h> @@ -47,9 +47,9 @@ public: virtual void toggle_fsfx() override {}; private: - BITMAPINFO m_bminfo; - uint8_t * m_bmdata; - size_t m_bmsize; + BITMAPINFO m_bminfo; + std::unique_ptr<uint8_t []> m_bmdata; + size_t m_bmsize; }; -#endif // __DRAWGDI__ +#endif // MAME_OSD_MODULES_RENDER_DRAWGDI_H diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index ae030224e74..6d3eae1e8ad 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -307,7 +307,7 @@ renderer_ogl::~renderer_ogl() // free the memory in the window destroy_all_textures(); - global_free(m_gl_context); + delete m_gl_context; m_gl_context = nullptr; } @@ -366,7 +366,7 @@ static void loadgl_functions(osd_gl_context *context) //============================================================ #ifdef USE_DISPATCH_GL -osd_gl_dispatch *gl_dispatch; +osd_gl_dispatch *gl_dispatch = nullptr; #endif void renderer_ogl::load_gl_lib(running_machine &machine) @@ -394,7 +394,7 @@ void renderer_ogl::load_gl_lib(running_machine &machine) #endif #endif #ifdef USE_DISPATCH_GL - gl_dispatch = global_alloc(osd_gl_dispatch); + gl_dispatch = new osd_gl_dispatch; #endif s_dll_loaded = true; } @@ -566,12 +566,12 @@ int renderer_ogl::create() // create renderer #if defined(OSD_WINDOWS) - m_gl_context = global_alloc(win_gl_context(std::static_pointer_cast<win_window_info>(win)->platform_window())); + m_gl_context = new win_gl_context(std::static_pointer_cast<win_window_info>(win)->platform_window()); #elif defined(OSD_MAC) // TODO -// m_gl_context = global_alloc(mac_gl_context(std::static_pointer_cast<mac_window_info>(win)->platform_window())); +// m_gl_context = new mac_gl_context(std::static_pointer_cast<mac_window_info>(win)->platform_window()); #else - m_gl_context = global_alloc(sdl_gl_context(std::static_pointer_cast<sdl_window_info>(win)->platform_window())); + m_gl_context = new sdl_gl_context(std::static_pointer_cast<sdl_window_info>(win)->platform_window()); #endif if (m_gl_context->LastErrorMsg() != nullptr) { @@ -696,7 +696,7 @@ void renderer_ogl::destroy_all_textures() texture->data=nullptr; texture->data_own=false; } - global_free(texture); + delete texture; } i++; } @@ -1907,7 +1907,7 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, ogl_texture_info *texture; // allocate a new texture - texture = global_alloc(ogl_texture_info); + texture = new ogl_texture_info; // fill in the core data texture->hash = texture_compute_hash(texsource, flags); @@ -1979,7 +1979,7 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, { if ( texture_shader_create(texsource, texture, flags) ) { - global_free(texture); + delete texture; return nullptr; } } diff --git a/src/osd/modules/render/drawogl.h b/src/osd/modules/render/drawogl.h index 525ba0c3ffa..891c5cec814 100644 --- a/src/osd/modules/render/drawogl.h +++ b/src/osd/modules/render/drawogl.h @@ -7,12 +7,11 @@ // SDLMAME by Olivier Galibert and R. Belmont // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWOGL_H +#define MAME_OSD_MODULES_RENDER_DRAWOGL_H #pragma once -#ifndef __DRAWOGL__ -#define __DRAWOGL__ - // OSD headers #ifndef OSD_WINDOWS #ifdef OSD_MAC @@ -239,4 +238,4 @@ private: static bool s_dll_loaded; }; -#endif // __DRAWOGL__ +#endif // MAME_OSD_MODULES_RENDER_DRAWOGL_H diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index 76dc1375e5b..1797c5be597 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -111,11 +111,7 @@ void renderer_sdl1::setup_texture(const osd_dim &size) // Determine preferred pixelformat and set up yuv if necessary SDL_GetCurrentDisplayMode(win->monitor()->oshandle(), &mode); - if (m_yuv_bitmap) - { - global_free_array(m_yuv_bitmap); - m_yuv_bitmap = nullptr; - } + m_yuv_bitmap.reset(); fmt = (sdl_sm->pixel_format ? sdl_sm->pixel_format : mode.format); @@ -134,7 +130,7 @@ void renderer_sdl1::setup_texture(const osd_dim &size) m_hw_scale_width = (m_hw_scale_width + 1) & ~1; } if (sdl_sm->is_yuv) - m_yuv_bitmap = global_alloc_array(uint16_t, m_hw_scale_width * m_hw_scale_height); + m_yuv_bitmap = std::make_unique<uint16_t []>(m_hw_scale_width * m_hw_scale_height); int w = m_hw_scale_width * sdl_sm->mult_w; int h = m_hw_scale_height * sdl_sm->mult_h; @@ -257,16 +253,6 @@ renderer_sdl1::~renderer_sdl1() { destroy_all_textures(); - if (m_yuv_lookup != nullptr) - { - global_free_array(m_yuv_lookup); - m_yuv_lookup = nullptr; - } - if (m_yuv_bitmap != nullptr) - { - global_free_array(m_yuv_bitmap); - m_yuv_bitmap = nullptr; - } SDL_DestroyRenderer(m_sdl_renderer); } @@ -448,8 +434,8 @@ int renderer_sdl1::draw(int update) { assert (m_yuv_bitmap != nullptr); assert (surfptr != nullptr); - software_renderer<uint16_t, 3,3,3, 10,5,0>::draw_primitives(*win->m_primlist, m_yuv_bitmap, mamewidth, mameheight, mamewidth); - sm->yuv_blit((uint16_t *)m_yuv_bitmap, surfptr, pitch, m_yuv_lookup, mamewidth, mameheight); + software_renderer<uint16_t, 3,3,3, 10,5,0>::draw_primitives(*win->m_primlist, m_yuv_bitmap.get(), mamewidth, mameheight, mamewidth); + sm->yuv_blit(m_yuv_bitmap.get(), surfptr, pitch, m_yuv_lookup.get(), mamewidth, mameheight); } win->m_primlist->release_lock(); @@ -525,12 +511,11 @@ void renderer_sdl1::yuv_lookup_set(unsigned int pen, unsigned char red, void renderer_sdl1::yuv_init() { - unsigned char r,g,b; - if (m_yuv_lookup == nullptr) - m_yuv_lookup = global_alloc_array(uint32_t, 65536); - for (r = 0; r < 32; r++) - for (g = 0; g < 32; g++) - for (b = 0; b < 32; b++) + if (!m_yuv_lookup) + m_yuv_lookup = std::make_unique<uint32_t []>(65536); + for (unsigned char r = 0; r < 32; r++) + for (unsigned char g = 0; g < 32; g++) + for (unsigned char b = 0; b < 32; b++) { int idx = (r << 10) | (g << 5) | b; yuv_lookup_set(idx, diff --git a/src/osd/modules/render/drawsdl.h b/src/osd/modules/render/drawsdl.h index 6c0b51c0663..bc8246a632d 100644 --- a/src/osd/modules/render/drawsdl.h +++ b/src/osd/modules/render/drawsdl.h @@ -10,10 +10,10 @@ // //============================================================ -#pragma once +#ifndef MAME_OSD_MODULES_RENDER_DRAWSDL_H +#define MAME_OSD_MODULES_RENDER_DRAWSDL_H -#ifndef __DRAWSDL1__ -#define __DRAWSDL1__ +#pragma once #include <SDL2/SDL.h> @@ -26,8 +26,8 @@ public: : osd_renderer(w, FLAG_NEEDS_OPENGL | extra_flags) , m_sdl_renderer(nullptr) , m_texture_id(nullptr) - , m_yuv_lookup(nullptr) - , m_yuv_bitmap(nullptr) + , m_yuv_lookup() + , m_yuv_bitmap() //, m_hw_scale_width(0) //, m_hw_scale_height(0) , m_last_hofs(0) @@ -61,8 +61,8 @@ private: SDL_Texture *m_texture_id; // YUV overlay - uint32_t *m_yuv_lookup; - uint16_t *m_yuv_bitmap; + std::unique_ptr<uint32_t []> m_yuv_lookup; + std::unique_ptr<uint16_t []> m_yuv_bitmap; // if we leave scaling to SDL and the underlying driver, this // is the render_target_width/height to use @@ -85,4 +85,4 @@ struct sdl_scale_mode void (*yuv_blit)(const uint16_t *bitmap, uint8_t *ptr, const int pitch, const uint32_t *lookup, const int width, const int height); }; -#endif // __DRAWSDL1__ +#endif // MAME_OSD_MODULES_RENDER_DRAWSDL_H diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index f2c4e36c0e5..ad7b52049a6 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -91,7 +91,7 @@ public: virtual bool execute_command(const char *command) = 0; // midi interface - virtual osd_midi_device *create_midi_device() = 0; + virtual std::unique_ptr<osd_midi_device> create_midi_device() = 0; protected: virtual ~osd_interface() { } diff --git a/src/osd/osdnet.cpp b/src/osd/osdnet.cpp index 070b4e96a2d..b90a139731c 100644 --- a/src/osd/osdnet.cpp +++ b/src/osd/osdnet.cpp @@ -7,7 +7,7 @@ static class std::vector<std::unique_ptr<osd_netdev::entry_t>> netdev_list; void add_netdev(const char *name, const char *description, create_netdev func) { - auto entry = make_unique_clear<osd_netdev::entry_t>(); + auto entry = std::make_unique<osd_netdev::entry_t>(); entry->id = netdev_list.size(); strncpy(entry->name, name, 255); entry->name[255] = '\0'; diff --git a/src/osd/osdnet.h b/src/osd/osdnet.h index 226ae2319a9..32e41663dcc 100644 --- a/src/osd/osdnet.h +++ b/src/osd/osdnet.h @@ -5,6 +5,8 @@ #pragma once +#include <algorithm> + class osd_netdev; #define CREATE_NETDEV(name) class osd_netdev *name(const char *ifname, class device_network_interface *ifdev, int rate) @@ -15,10 +17,16 @@ class osd_netdev public: struct entry_t { - int id; + entry_t() + { + std::fill(std::begin(name), std::end(name), 0); + std::fill(std::begin(description), std::end(description), 0); + } + + int id = 0; char name[256]; char description[256]; - create_netdev func; + create_netdev func = nullptr; }; osd_netdev(class device_network_interface *ifdev, int rate); virtual ~osd_netdev(); diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 70886d76a73..9f07ce7cd49 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -1137,12 +1137,11 @@ sdl_window_info::sdl_window_info( m_prescale = video_config.prescale; m_windowed_dim = osd_dim(config->width, config->height); - m_original_mode = global_alloc(SDL_DM_Wrapper); + m_original_mode = std::make_unique<SDL_DM_Wrapper>(); } sdl_window_info::~sdl_window_info() { - global_free(m_original_mode); } diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index d6010e91ed2..bfe32e6e8a0 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -8,8 +8,8 @@ // //============================================================ -#ifndef __SDLWINDOW__ -#define __SDLWINDOW__ +#ifndef MAME_OSD_SDL_WINDOW_H +#define MAME_OSD_SDL_WINDOW_H #include "osdsdl.h" #include "video.h" @@ -87,7 +87,7 @@ private: render_target * m_target; // Original display_mode - SDL_DM_Wrapper *m_original_mode; + std::unique_ptr<SDL_DM_Wrapper> m_original_mode; int m_extra_flags; @@ -152,4 +152,4 @@ int drawsdl2_init(running_machine &machine, osd_draw_callbacks *callbacks); int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks); -#endif /* __SDLWINDOW__ */ +#endif // MAME_OSD_SDL_WINDOW_H diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 6f8dc3671c9..5a292f78ff6 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -14,11 +14,9 @@ // standard C headers #include <process.h> +#include <algorithm> #include <atomic> #include <cstring> -#include <chrono> -#include <list> -#include <memory> // MAME headers #include "emu.h" @@ -96,7 +94,7 @@ static DWORD main_threadid; //============================================================ // event handling -static std::chrono::system_clock::time_point last_event_check; +static std::chrono::steady_clock::time_point last_event_check; static int ui_temp_pause; static int ui_temp_was_paused; @@ -295,29 +293,31 @@ void windows_osd_interface::window_exit() CloseHandle(ui_pause_event); } + win_window_info::win_window_info( - running_machine &machine, - int index, - std::shared_ptr<osd_monitor_info> monitor, - const osd_window_config *config) : osd_window_t(*config), - m_next(nullptr), - m_init_state(0), - m_startmaximized(0), - m_isminimized(0), - m_ismaximized(0), - m_monitor(monitor), - m_fullscreen(!video_config.windowed), - m_fullscreen_safe(0), - m_aspect(0), - m_target(nullptr), - m_targetview(0), - m_targetorient(0), - m_targetvismask(0), - m_lastclicktime(std::chrono::system_clock::time_point::min()), - m_lastclickx(0), - m_lastclicky(0), - m_machine(machine), - m_attached_mode(false) + running_machine &machine, + int index, + std::shared_ptr<osd_monitor_info> monitor, + const osd_window_config *config) + : osd_window_t(*config) + , m_next(nullptr) + , m_init_state(0) + , m_startmaximized(0) + , m_isminimized(0) + , m_ismaximized(0) + , m_monitor(monitor) + , m_fullscreen(!video_config.windowed) + , m_fullscreen_safe(0) + , m_aspect(0) + , m_target(nullptr) + , m_targetview(0) + , m_targetorient(0) + , m_targetvismask(0) + , m_lastclicktime(std::chrono::steady_clock::time_point::min()) + , m_lastclickx(0) + , m_lastclicky(0) + , m_machine(machine) + , m_attached_mode(false) { memset(m_title,0,sizeof(m_title)); m_non_fullscreen_bounds.left = 0; @@ -350,7 +350,7 @@ void win_window_info::hide_pointer() { GetCursorPos(&s_saved_cursor_pos); - while (ShowCursor(FALSE) >= -1) {}; + while (ShowCursor(FALSE) >= -1) { } ShowCursor(TRUE); } @@ -402,7 +402,7 @@ void win_window_info::show_pointer() void winwindow_process_events_periodic(running_machine &machine) { - auto currticks = std::chrono::system_clock::now(); + auto currticks = std::chrono::steady_clock::now(); assert(GetCurrentThreadId() == main_threadid); @@ -465,7 +465,7 @@ void winwindow_process_events(running_machine &machine, bool ingame, bool nodisp assert(GetCurrentThreadId() == main_threadid); // remember the last time we did this - last_event_check = std::chrono::system_clock::now(); + last_event_check = std::chrono::steady_clock::now(); do { @@ -1185,7 +1185,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR auto *window = (win_window_info *)ptr; // we may get called before SetWindowLongPtr is called - if (window != nullptr) + if (window) { assert(GetCurrentThreadId() == window_threadid); window->update_minmax_state(); @@ -1194,8 +1194,8 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR // handle a few messages switch (message) { - // paint: redraw the last bitmap - case WM_PAINT: + // paint: redraw the last bitmap + case WM_PAINT: { PAINTSTRUCT pstruct; HDC hdc = BeginPaint(wnd, &pstruct); @@ -1203,37 +1203,37 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR if (window->win_has_menu()) DrawMenuBar(window->platform_window()); EndPaint(wnd, &pstruct); - break; } + break; - // non-client paint: punt if full screen - case WM_NCPAINT: - if (!window->fullscreen() || window->win_has_menu()) - return DefWindowProc(wnd, message, wparam, lparam); - break; + // non-client paint: punt if full screen + case WM_NCPAINT: + if (!window->fullscreen() || window->win_has_menu()) + return DefWindowProc(wnd, message, wparam, lparam); + break; - // input: handle the raw input - case WM_INPUT: - downcast<windows_osd_interface&>(window->machine().osd()).handle_input_event(INPUT_EVENT_RAWINPUT, &lparam); - break; + // input: handle the raw input + case WM_INPUT: + downcast<windows_osd_interface&>(window->machine().osd()).handle_input_event(INPUT_EVENT_RAWINPUT, &lparam); + break; - // syskeys - ignore - case WM_SYSKEYUP: - case WM_SYSKEYDOWN: - break; + // syskeys - ignore + case WM_SYSKEYUP: + case WM_SYSKEYDOWN: + break; - // input events - case WM_MOUSEMOVE: - window->machine().ui_input().push_mouse_move_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); - break; + // input events + case WM_MOUSEMOVE: + window->machine().ui_input().push_mouse_move_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + break; - case WM_MOUSELEAVE: - window->machine().ui_input().push_mouse_leave_event(window->m_target); - break; + case WM_MOUSELEAVE: + window->machine().ui_input().push_mouse_leave_event(window->m_target); + break; - case WM_LBUTTONDOWN: + case WM_LBUTTONDOWN: { - auto ticks = std::chrono::system_clock::now(); + auto const ticks = std::chrono::steady_clock::now(); window->machine().ui_input().push_mouse_down_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); // check for a double-click @@ -1241,7 +1241,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR GET_X_LPARAM(lparam) >= window->m_lastclickx - 4 && GET_X_LPARAM(lparam) <= window->m_lastclickx + 4 && GET_Y_LPARAM(lparam) >= window->m_lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->m_lastclicky + 4) { - window->m_lastclicktime = std::chrono::system_clock::time_point::min(); + window->m_lastclicktime = std::chrono::steady_clock::time_point::min(); window->machine().ui_input().push_mouse_double_click_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); } else @@ -1250,26 +1250,26 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->m_lastclickx = GET_X_LPARAM(lparam); window->m_lastclicky = GET_Y_LPARAM(lparam); } - break; } + break; - case WM_LBUTTONUP: - window->machine().ui_input().push_mouse_up_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); - break; + case WM_LBUTTONUP: + window->machine().ui_input().push_mouse_up_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + break; - case WM_RBUTTONDOWN: - window->machine().ui_input().push_mouse_rdown_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); - break; + case WM_RBUTTONDOWN: + window->machine().ui_input().push_mouse_rdown_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + break; - case WM_RBUTTONUP: - window->machine().ui_input().push_mouse_rup_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); - break; + case WM_RBUTTONUP: + window->machine().ui_input().push_mouse_rup_event(window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)); + break; - case WM_CHAR: - window->machine().ui_input().push_char_event(window->m_target, (char32_t) wparam); - break; + case WM_CHAR: + window->machine().ui_input().push_char_event(window->m_target, (char32_t) wparam); + break; - case WM_MOUSEWHEEL: + case WM_MOUSEWHEEL: { UINT ucNumLines = 3; // default SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &ucNumLines, 0); @@ -1277,32 +1277,33 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR break; } - // pause the system when we start a menu or resize - case WM_ENTERSIZEMOVE: - window->m_resize_state = RESIZE_STATE_RESIZING; - case WM_ENTERMENULOOP: - winwindow_ui_pause(window->machine(), TRUE); - break; - - // unpause the system when we stop a menu or resize and force a redraw - case WM_EXITSIZEMOVE: - window->m_resize_state = RESIZE_STATE_PENDING; - case WM_EXITMENULOOP: - winwindow_ui_pause(window->machine(), FALSE); - InvalidateRect(wnd, nullptr, FALSE); - break; - - // get min/max info: set the minimum window size - case WM_GETMINMAXINFO: + // pause the system when we start a menu or resize + case WM_ENTERSIZEMOVE: + window->m_resize_state = RESIZE_STATE_RESIZING; + case WM_ENTERMENULOOP: + winwindow_ui_pause(window->machine(), TRUE); + break; + + // unpause the system when we stop a menu or resize and force a redraw + case WM_EXITSIZEMOVE: + window->m_resize_state = RESIZE_STATE_PENDING; + case WM_EXITMENULOOP: + winwindow_ui_pause(window->machine(), FALSE); + InvalidateRect(wnd, nullptr, FALSE); + break; + + // get min/max info: set the minimum window size + case WM_GETMINMAXINFO: { auto *minmax = (MINMAXINFO *)lparam; minmax->ptMinTrackSize.x = MIN_WINDOW_DIMX; minmax->ptMinTrackSize.y = MIN_WINDOW_DIMY; break; } + break; - // sizing: constrain to the aspect ratio unless control key is held down - case WM_SIZING: + // sizing: constrain to the aspect ratio unless control key is held down + case WM_SIZING: { RECT *rect = (RECT *)lparam; if (video_config.keepaspect && !(GetAsyncKeyState(VK_CONTROL) & 0x8000)) @@ -1314,11 +1315,11 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR rect->right = r.right(); } InvalidateRect(wnd, nullptr, FALSE); - break; } + break; - // syscommands: catch win_start_maximized - case WM_SYSCOMMAND: + // syscommands: catch win_start_maximized + case WM_SYSCOMMAND: { uint16_t cmd = wparam & 0xfff0; @@ -1339,22 +1340,22 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->maximize_window(); break; } - return DefWindowProc(wnd, message, wparam, lparam); } + return DefWindowProc(wnd, message, wparam, lparam); - // close: cause MAME to exit - case WM_CLOSE: - window->machine().schedule_exit(); - break; + // close: cause MAME to exit + case WM_CLOSE: + window->machine().schedule_exit(); + break; - // destroy: clean up all attached rendering bits and nullptr out our hwnd - case WM_DESTROY: - window->renderer_reset(); - window->set_platform_window(nullptr); - return DefWindowProc(wnd, message, wparam, lparam); + // destroy: clean up all attached rendering bits and nullptr out our hwnd + case WM_DESTROY: + window->renderer_reset(); + window->set_platform_window(nullptr); + return DefWindowProc(wnd, message, wparam, lparam); - // self redraw: draw ourself in a non-painty way - case WM_USER_REDRAW: + // self redraw: draw ourself in a non-painty way + case WM_USER_REDRAW: { HDC hdc = GetDC(wnd); @@ -1362,46 +1363,46 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->draw_video_contents(hdc, false); ReleaseDC(wnd, hdc); - break; } - - // fullscreen set - case WM_USER_SET_FULLSCREEN: - window->set_fullscreen(wparam); - break; - - // minimum size set - case WM_USER_SET_MINSIZE: - window->minimize_window(); - break; - - // maximum size set - case WM_USER_SET_MAXSIZE: - window->maximize_window(); - break; - - // maximum size set - case WM_DISPLAYCHANGE: - /* FIXME: The current codebase has an issue with setting aspect - * ratios correctly after display change. set_aspect should - * be set_forced_aspect and on a refresh this forced aspect should - * be preserved if set. If not, the standard aspect calculation - * should be used. - */ - window->m_monitor->refresh(); - window->m_monitor->update_resolution(LOWORD(lparam), HIWORD(lparam)); - break; - - // set focus: if we're not the primary window, switch back - // commented out ATM because this prevents us from resizing secondary windows -// case WM_SETFOCUS: -// if (window != osd_common_t::s_window_list && osd_common_t::s_window_list != nullptr) -// SetFocus(osd_common_t::s_window_list->m_hwnd); -// break; - - // everything else: defaults - default: - return DefWindowProc(wnd, message, wparam, lparam); + break; + + // fullscreen set + case WM_USER_SET_FULLSCREEN: + window->set_fullscreen(wparam); + break; + + // minimum size set + case WM_USER_SET_MINSIZE: + window->minimize_window(); + break; + + // maximum size set + case WM_USER_SET_MAXSIZE: + window->maximize_window(); + break; + + // maximum size set + case WM_DISPLAYCHANGE: + /* FIXME: The current codebase has an issue with setting aspect + * ratios correctly after display change. set_aspect should + * be set_forced_aspect and on a refresh this forced aspect should + * be preserved if set. If not, the standard aspect calculation + * should be used. + */ + window->m_monitor->refresh(); + window->m_monitor->update_resolution(LOWORD(lparam), HIWORD(lparam)); + break; + + // set focus: if we're not the primary window, switch back + // commented out ATM because this prevents us from resizing secondary windows +// case WM_SETFOCUS: +// if (window != osd_common_t::s_window_list && osd_common_t::s_window_list != nullptr) +// SetFocus(osd_common_t::s_window_list->m_hwnd); +// break; + + // everything else: defaults + default: + return DefWindowProc(wnd, message, wparam, lparam); } return 0; diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index 3dccc520a83..22065135efe 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -5,27 +5,27 @@ // window.h - Win32 window handling // //============================================================ +#ifndef MAME_OSD_WINDOWS_WINDOW_H +#define MAME_OSD_WINDOWS_WINDOW_H -#ifndef __WIN_WINDOW__ -#define __WIN_WINDOW__ - -// standard windows headers -#include <windows.h> -#include <windowsx.h> -#include <mmsystem.h> - -#include <chrono> -#include <mutex> -#include <memory> -#include <list> +#pragma once #include "render.h" #include "modules/osdwindow.h" +#include "modules/lib/osdlib.h" -//============================================================ -// PARAMETERS -//============================================================ +#include <chrono> +#include <list> +#include <memory> +#include <mutex> +#include <utility> +#include <vector> + +// standard windows headers +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> //============================================================ @@ -128,7 +128,7 @@ public: u32 m_targetvismask; // input info - std::chrono::system_clock::time_point m_lastclicktime; + std::chrono::steady_clock::time_point m_lastclicktime; int m_lastclickx; int m_lastclicky; @@ -206,4 +206,4 @@ static inline int rect_height(const RECT *rect) return rect->bottom - rect->top; } -#endif +#endif // MAME_OSD_WINDOWS_WINDOW_H |