diff options
Diffstat (limited to 'src/osd')
46 files changed, 581 insertions, 583 deletions
diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index c8f6554b476..87ee61f8d19 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -79,16 +79,16 @@ class debug_imgui : public osd_module, public debug_module public: debug_imgui() : osd_module(OSD_DEBUG_PROVIDER, "imgui"), debug_module(), - m_machine(nullptr), - m_mouse_x(0), - m_mouse_y(0), - m_mouse_button(false), - m_prev_mouse_button(false), - m_running(false), - font_name(nullptr), - font_size(0), + m_machine(nullptr), + m_mouse_x(0), + m_mouse_y(0), + m_mouse_button(false), + m_prev_mouse_button(false), + m_running(false), + font_name(nullptr), + font_size(0), m_key_char(0), - m_hide(false), + m_hide(false), m_win_count(0) { } @@ -154,7 +154,7 @@ static void view_list_remove(debug_area* item) return; it = std::find(view_list.begin(),view_list.end(),item); view_list.erase(it); - + } static debug_area *dview_alloc(running_machine &machine, debug_view_type type) @@ -245,7 +245,7 @@ void debug_imgui::handle_mouse_views() void debug_imgui::handle_keys() { - ImGuiIO& io = ImGui::GetIO(); + ImGuiIO& io = ImGui::GetIO(); ui_event event; // global keys @@ -289,35 +289,35 @@ void debug_imgui::handle_keys() m_hide = true; } -/* if(m_machine->input().code_pressed_once(KEYCODE_UP)) - io.KeysDown[ImGuiKey_UpArrow] = true; - if(m_machine->input().code_pressed_once(KEYCODE_DOWN)) - io.KeysDown[ImGuiKey_DownArrow] = true; - if(m_machine->input().code_pressed_once(KEYCODE_LEFT)) - io.KeysDown[ImGuiKey_LeftArrow] = true; - if(m_machine->input().code_pressed_once(KEYCODE_RIGHT)) - io.KeysDown[ImGuiKey_RightArrow] = true; - - if(m_machine->input().code_pressed(KEYCODE_TAB)) - io.KeysDown[ImGuiKey_Tab] = true; - - if(m_machine->input().code_pressed_once(KEYCODE_PGUP)) - { - io.KeysDown[ImGuiKey_PageUp] = true; - } - if(m_machine->input().code_pressed_once(KEYCODE_PGDN)) - { - io.KeysDown[ImGuiKey_PageDown] = true; - } - - if(m_machine->input().code_pressed_once(KEYCODE_HOME)) - { - io.KeysDown[ImGuiKey_Home] = true; - } - if(m_machine->input().code_pressed_once(KEYCODE_END)) - { - io.KeysDown[ImGuiKey_End] = true; - }*/ +/* if(m_machine->input().code_pressed_once(KEYCODE_UP)) + io.KeysDown[ImGuiKey_UpArrow] = true; + if(m_machine->input().code_pressed_once(KEYCODE_DOWN)) + io.KeysDown[ImGuiKey_DownArrow] = true; + if(m_machine->input().code_pressed_once(KEYCODE_LEFT)) + io.KeysDown[ImGuiKey_LeftArrow] = true; + if(m_machine->input().code_pressed_once(KEYCODE_RIGHT)) + io.KeysDown[ImGuiKey_RightArrow] = true; + + if(m_machine->input().code_pressed(KEYCODE_TAB)) + io.KeysDown[ImGuiKey_Tab] = true; + + if(m_machine->input().code_pressed_once(KEYCODE_PGUP)) + { + io.KeysDown[ImGuiKey_PageUp] = true; + } + if(m_machine->input().code_pressed_once(KEYCODE_PGDN)) + { + io.KeysDown[ImGuiKey_PageDown] = true; + } + + if(m_machine->input().code_pressed_once(KEYCODE_HOME)) + { + io.KeysDown[ImGuiKey_Home] = true; + } + if(m_machine->input().code_pressed_once(KEYCODE_END)) + { + io.KeysDown[ImGuiKey_End] = true; + }*/ if(m_machine->input().code_pressed(KEYCODE_LCONTROL)) io.KeyCtrl = true; else @@ -351,7 +351,7 @@ void debug_imgui::handle_keys() break; } } - + if(ImGui::IsKeyPressed(ITEM_ID_D) && ImGui::IsKeyDown(ITEM_ID_LCONTROL)) add_disasm(++m_win_count); if(ImGui::IsKeyPressed(ITEM_ID_M) && ImGui::IsKeyDown(ITEM_ID_LCONTROL)) @@ -380,7 +380,7 @@ void debug_imgui::handle_keys_views() // if no view has focus, then there's nothing to do if(focus_view == nullptr) return; - + // pass keypresses to debug view with focus if(m_machine->input().code_pressed_once(KEYCODE_UP)) focus_view->view->process_char(DCH_UP); @@ -489,7 +489,7 @@ void debug_imgui::draw_bpoints(debug_area* view_ptr, bool* opened) totalsize = view_ptr->view->total_size(); view_ptr->view->set_visible_size(totalsize); vsize = view_ptr->view->visible_size(); - + ImGui::BeginChild("##break_output", ImVec2(ImGui::GetWindowWidth() - 16,ImGui::GetWindowHeight() - ImGui::GetTextLineHeight() - ImGui::GetCursorPosY())); // account for title bar and widgets already drawn ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); @@ -587,7 +587,7 @@ void debug_imgui::draw_log(debug_area* view_ptr, bool* opened) totalsize.y = 100; view_ptr->view->set_visible_size(totalsize); vsize = view_ptr->view->visible_size(); - + ImGui::BeginChild("##log_output", ImVec2(ImGui::GetWindowWidth() - 16,ImGui::GetWindowHeight() - ImGui::GetTextLineHeight() - ImGui::GetCursorPosY())); // account for title bar and widgets already drawn ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); @@ -644,7 +644,7 @@ void debug_imgui::draw_disasm(debug_area* view_ptr, bool* opened) std::string cpu_list = ""; const debug_view_source* src = view_ptr->view->first_source(); - // build source CPU list + // build source CPU list while(src != nullptr) { cpu_list += src->name(); @@ -682,7 +682,7 @@ void debug_imgui::draw_disasm(debug_area* view_ptr, bool* opened) disasm->set_right_column(DASM_RIGHTCOL_NONE); if(ImGui::MenuItem("Comments", nullptr,(rightcol == DASM_RIGHTCOL_COMMENTS) ? true : false)) disasm->set_right_column(DASM_RIGHTCOL_COMMENTS); - + ImGui::EndMenu(); } ImGui::EndMenuBar(); @@ -705,7 +705,7 @@ void debug_imgui::draw_disasm(debug_area* view_ptr, bool* opened) totalsize.y = 50; view_ptr->view->set_visible_size(totalsize); vsize = view_ptr->view->visible_size(); - + ImGui::BeginChild("##disasm_output", ImVec2(ImGui::GetWindowWidth() - 16,ImGui::GetWindowHeight() - ImGui::GetTextLineHeight() - ImGui::GetCursorPosY())); // account for title bar and widgets already drawn src = view_ptr->view->first_source(); idx = 0; @@ -801,7 +801,7 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened) ImVec2 xy1,xy2; ImVec2 fsize = ImGui::CalcTextSize("A"); // any character will do, we should be using a monospaced font ImDrawList* drawlist; - + if(ImGui::BeginMenuBar()) { if(ImGui::BeginMenu("Options")) @@ -811,7 +811,7 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened) bool rev = mem->reverse(); int format = mem->get_data_format(); UINT32 chunks = mem->chunks_per_row(); - + if(ImGui::MenuItem("1-byte chunks", nullptr,(format == 1) ? true : false)) mem->set_data_format(1); if(ImGui::MenuItem("2-byte chunks", nullptr,(format == 2) ? true : false)) @@ -844,12 +844,12 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened) } ImGui::EndMenuBar(); } - + ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue; ImGui::PushItemWidth(100.0f); if(m_running) flags |= ImGuiInputTextFlags_ReadOnly; - // build source CPU list + // build source CPU list while(src != nullptr) { region_list += src->name(); @@ -865,7 +865,7 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened) ImGui::Combo("##region",&view_ptr->src_sel,region_list.c_str()); ImGui::PopItemWidth(); ImGui::Separator(); - + // memory editor portion viewdata = view_ptr->view->viewdata(); totalsize = view_ptr->view->total_size(); @@ -873,7 +873,7 @@ void debug_imgui::draw_memory(debug_area* view_ptr, bool* opened) totalsize.y = 256; view_ptr->view->set_visible_size(totalsize); vsize = view_ptr->view->visible_size(); - + ImGui::BeginChild("##memory_output", ImVec2(ImGui::GetWindowWidth() - 16,ImGui::GetWindowHeight() - ImGui::GetTextLineHeight() - ImGui::GetCursorPosY())); // account for title bar and widgets already drawn src = view_ptr->view->first_source(); idx = 0; @@ -975,13 +975,13 @@ void debug_imgui::draw_console() { if(ImGui::MenuItem("New disassembly window", "Ctrl+D")) add_disasm(++m_win_count); - if(ImGui::MenuItem("New memory window", "Ctrl+M")) + if(ImGui::MenuItem("New memory window", "Ctrl+M")) add_memory(++m_win_count); - if(ImGui::MenuItem("New breakpoints window", "Ctrl+B")) + if(ImGui::MenuItem("New breakpoints window", "Ctrl+B")) add_bpoints(++m_win_count); - if(ImGui::MenuItem("New watchpoints window", "Ctrl+W")) + if(ImGui::MenuItem("New watchpoints window", "Ctrl+W")) add_wpoints(++m_win_count); - if(ImGui::MenuItem("New log window", "Ctrl+L")) + if(ImGui::MenuItem("New log window", "Ctrl+L")) add_log(++m_win_count); ImGui::Separator(); if(ImGui::MenuItem("Run", "F5")) @@ -1013,7 +1013,7 @@ void debug_imgui::draw_console() debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_over(); if(ImGui::MenuItem("Step out", "F9")) debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_out(); - + ImGui::EndMenu(); } if(ImGui::BeginMenu("Window")) @@ -1046,13 +1046,13 @@ void debug_imgui::draw_console() } ImGui::EndMenuBar(); } - + // CPU state portion viewdata = view_main_regs->view->viewdata(); totalsize = view_main_regs->view->total_size(); view_main_regs->view->set_visible_size(totalsize); vsize = view_main_regs->view->visible_size(); - + ImGui::BeginChild("##state_output", ImVec2(180,ImGui::GetWindowHeight() - ImGui::GetTextLineHeight()*2)); // account for title bar and menu ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); @@ -1092,9 +1092,9 @@ void debug_imgui::draw_console() totalsize = view_main_disasm->view->total_size(); totalsize.y = 20; view_main_disasm->view->set_visible_size(totalsize); -// height = ImGui::GetTextLineHeight(); +// height = ImGui::GetTextLineHeight(); vsize = view_main_disasm->view->visible_size(); - + ImGui::BeginChild("##disasm_output", ImVec2(ImGui::GetWindowWidth() - ImGui::GetCursorPosX() - 8,(ImGui::GetWindowHeight() - ImGui::GetTextLineHeight()*4)/2)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); @@ -1147,7 +1147,7 @@ void debug_imgui::draw_console() if(totalsize.y > 100) totalsize.y = 100; view_main_console->view->set_visible_size(totalsize); -// height = ImGui::GetTextLineHeight(); +// height = ImGui::GetTextLineHeight(); vsize = view_main_console->view->visible_size(); ImGui::BeginChild("##console_output", ImVec2(ImGui::GetWindowWidth() - ImGui::GetCursorPosX() - 8,(ImGui::GetWindowHeight() - ImGui::GetTextLineHeight()*4)/2 - ImGui::GetTextLineHeight())); @@ -1180,7 +1180,7 @@ void debug_imgui::draw_console() ImGui::EndChild(); ImGui::Separator(); //if(ImGui::IsWindowFocused()) - // ImGui::SetKeyboardFocusHere(); + // ImGui::SetKeyboardFocusHere(); ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue; if(m_running) flags |= ImGuiInputTextFlags_ReadOnly; @@ -1254,7 +1254,7 @@ void debug_imgui::update() void debug_imgui::init_debugger(running_machine &machine) { - ImGuiIO& io = ImGui::GetIO(); + ImGuiIO& io = ImGui::GetIO(); m_machine = &machine; m_mouse_button = false; if(strcmp(downcast<osd_options &>(m_machine->options()).video(),"bgfx") != 0) @@ -1314,12 +1314,12 @@ void debug_imgui::wait_for_debugger(device_t &device, bool firststop) } if(firststop) { -// debug_show_all(); +// debug_show_all(); device.machine().ui_input().reset(); m_running = false; } m_hide = false; -// m_machine->ui_input().frame_update(); +// m_machine->ui_input().frame_update(); handle_mouse(); handle_keys(); handle_console(m_machine); diff --git a/src/osd/modules/diagnostics/diagnostics_module.h b/src/osd/modules/diagnostics/diagnostics_module.h index 5e92178d492..2f2c64b672b 100644 --- a/src/osd/modules/diagnostics/diagnostics_module.h +++ b/src/osd/modules/diagnostics/diagnostics_module.h @@ -28,7 +28,7 @@ public: // starts the profiler virtual void start_profiler(std::uint32_t max_seconds, std::uint8_t stack_depth) = 0; - + // stops the currently active profiler virtual void stop_profiler() = 0; @@ -39,4 +39,4 @@ public: static diagnostics_module* get_instance(); }; -#endif
\ No newline at end of file +#endif diff --git a/src/osd/modules/diagnostics/diagnostics_win32.cpp b/src/osd/modules/diagnostics/diagnostics_win32.cpp index 2b6d182d844..d24bffe75a7 100644 --- a/src/osd/modules/diagnostics/diagnostics_win32.cpp +++ b/src/osd/modules/diagnostics/diagnostics_win32.cpp @@ -1083,4 +1083,3 @@ diagnostics_module * diagnostics_module::get_instance() #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #endif - diff --git a/src/osd/modules/diagnostics/none.cpp b/src/osd/modules/diagnostics/none.cpp index 502a919a7e1..8a731fe9009 100644 --- a/src/osd/modules/diagnostics/none.cpp +++ b/src/osd/modules/diagnostics/none.cpp @@ -52,4 +52,4 @@ diagnostics_module* diagnostics_module::get_instance() static diagnostics_none s_instance; return &s_instance; } -#endif
\ No newline at end of file +#endif diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp index 5aa925edefe..d8400a8346c 100644 --- a/src/osd/modules/input/input_dinput.cpp +++ b/src/osd/modules/input/input_dinput.cpp @@ -128,8 +128,8 @@ void dinput_keyboard_device::reset() dinput_api_helper::dinput_api_helper(int version) : m_dinput(nullptr), - m_dinput_version(version), - m_pfn_DirectInputCreate("DirectInputCreateW", L"dinput.dll") + m_dinput_version(version), + m_pfn_DirectInputCreate("DirectInputCreateW", L"dinput.dll") { } @@ -200,7 +200,7 @@ protected: public: dinput_module(const char* type, const char* name) : wininput_module(type, name), - m_dinput_helper(nullptr) + m_dinput_helper(nullptr) { } diff --git a/src/osd/modules/input/input_dinput.h b/src/osd/modules/input/input_dinput.h index f06520cb285..3d3cf7e6544 100644 --- a/src/osd/modules/input/input_dinput.h +++ b/src/osd/modules/input/input_dinput.h @@ -23,7 +23,7 @@ public: struct dinput_callback_context { device_enum_interface * self; - void * state; + void * state; }; virtual ~device_enum_interface() diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index f91d083371d..50ddf09cf33 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -702,24 +702,24 @@ public: : sdl_input_module(OSD_JOYSTICKINPUT_PROVIDER), m_sixaxis_mode(false) { } - + virtual void exit() override { sdl_input_module::exit(); - + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); - } - + } + virtual void input_init(running_machine &machine) override { - SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); + SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); if (SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { osd_printf_error("Could not initialize SDL Joystick: %s.\n", SDL_GetError()); return; } - + sdl_input_module::input_init(machine); char tempname[512]; diff --git a/src/osd/modules/input/input_sdlcommon.h b/src/osd/modules/input/input_sdlcommon.h index abdc4ddf4ed..cfc5a647793 100644 --- a/src/osd/modules/input/input_sdlcommon.h +++ b/src/osd/modules/input/input_sdlcommon.h @@ -63,7 +63,7 @@ class sdl_event_subscriber { public: virtual ~sdl_event_subscriber() {} - virtual void handle_event(SDL_Event &sdlevent) = 0; + virtual void handle_event(SDL_Event &sdlevent) = 0; }; template <class TSubscriber> diff --git a/src/osd/modules/input/input_winhybrid.cpp b/src/osd/modules/input/input_winhybrid.cpp index 22534b75453..60418f2f023 100644 --- a/src/osd/modules/input/input_winhybrid.cpp +++ b/src/osd/modules/input/input_winhybrid.cpp @@ -275,10 +275,10 @@ private: } //----------------------------------------------------------------------------- - // Enum each PNP device using WMI and check each device ID to see if it contains + // Enum each PNP device using WMI and check each device ID to see if it contains // "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device // Unfortunately this information can not be found by just using DirectInput. - // Checking against a VID/PID of 0x028E/0x045E won't find 3rd party or future + // Checking against a VID/PID of 0x028E/0x045E won't find 3rd party or future // XInput devices. //----------------------------------------------------------------------------- HRESULT get_xinput_devices(std::list<DWORD> &xinput_id_list) const @@ -317,7 +317,7 @@ private: bstrDeviceID = bstr_ptr(SysAllocString(L"DeviceID")); bstrClassName = bstr_ptr(SysAllocString(L"Win32_PNPEntity")); - // Connect to WMI + // Connect to WMI hr = pIWbemLocator->ConnectServer( bstrNamespace.get(), nullptr, @@ -377,7 +377,7 @@ private: if (SUCCEEDED(hr) && var.vt == VT_BSTR && var.bstrVal != nullptr) { // Check if the device ID contains "IG_". If it does, then it's an XInput device - // Unfortunately this information can not be found by just using DirectInput + // Unfortunately this information can not be found by just using DirectInput if (wcsstr(var.bstrVal, L"IG_")) { // If it does, then get the VID/PID from var.bstrVal diff --git a/src/osd/modules/input/input_xinput.cpp b/src/osd/modules/input/input_xinput.cpp index c3725ffbf08..9226011c273 100644 --- a/src/osd/modules/input/input_xinput.cpp +++ b/src/osd/modules/input/input_xinput.cpp @@ -115,7 +115,7 @@ xinput_joystick_device::xinput_joystick_device(running_machine &machine, const c gamepad({{0}}), xinput_state({0}), m_xinput_helper(helper), - m_configured(false) + m_configured(false) { } diff --git a/src/osd/modules/input/input_xinput.h b/src/osd/modules/input/input_xinput.h index 4474a3f58f7..791fc36f310 100644 --- a/src/osd/modules/input/input_xinput.h +++ b/src/osd/modules/input/input_xinput.h @@ -131,7 +131,7 @@ private: public: xinput_joystick_device(running_machine &machine, const char *name, input_module &module, std::shared_ptr<xinput_api_helper> helper); - + void poll() override; void reset() override; void configure(); diff --git a/src/osd/modules/ipc/rtc_tcp_connection.cpp b/src/osd/modules/ipc/rtc_tcp_connection.cpp index 1cc800b7d77..861eaa8d247 100644 --- a/src/osd/modules/ipc/rtc_tcp_connection.cpp +++ b/src/osd/modules/ipc/rtc_tcp_connection.cpp @@ -100,7 +100,7 @@ void rtc_tcp_connection::user_on_tcp_connection_read() { break; } - } + } else // Incomplete packet. { // Check if the buffer is full. diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index fc0d2f7a925..5c26b55a6d5 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -84,7 +84,7 @@ class ui_menu_item; #define OSDOPTION_BGFX_DEBUG "bgfx_debug" #define OSDOPTION_BGFX_SCREEN_CHAINS "bgfx_screen_chains" #define OSDOPTION_BGFX_SHADOW_MASK "bgfx_shadow_mask" -#define OSDOPTION_BGFX_AVI_NAME "bgfx_avi_name" +#define OSDOPTION_BGFX_AVI_NAME "bgfx_avi_name" //============================================================ // TYPE DEFINITIONS diff --git a/src/osd/modules/osdwindow.cpp b/src/osd/modules/osdwindow.cpp index b9afc8047cd..3868f83e6ea 100644 --- a/src/osd/modules/osdwindow.cpp +++ b/src/osd/modules/osdwindow.cpp @@ -22,7 +22,7 @@ #endif osd_window::~osd_window() -{ +{ } std::unique_ptr<osd_renderer> osd_renderer::make_for_type(int mode, std::shared_ptr<osd_window> window, int extra_flags) diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index 072924693d8..a2ab9228454 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -162,7 +162,7 @@ public: m_platform_window = window; } - std::shared_ptr<osd_window> main_window() const { return m_main; } + std::shared_ptr<osd_window> main_window() const { return m_main; } void set_main_window(std::shared_ptr<osd_window> main) { m_main = main; } // Clips the pointer to the bounds of this window @@ -187,7 +187,7 @@ public: render_primitive_list *m_primlist; osd_window_config m_win_config; - int m_index; + int m_index; protected: int m_prescale; private: @@ -253,8 +253,8 @@ protected: /* Internal flags */ static const int FI_CHANGED = 0x010000; - bool m_sliders_dirty; - std::vector<ui_menu_item> m_sliders; + bool m_sliders_dirty; + std::vector<ui_menu_item> m_sliders; private: std::weak_ptr<osd_window> m_window; diff --git a/src/osd/modules/output/network.cpp b/src/osd/modules/output/network.cpp index 95f898fbf41..081e721ae19 100644 --- a/src/osd/modules/output/network.cpp +++ b/src/osd/modules/output/network.cpp @@ -21,7 +21,6 @@ class output_network_server : public raw_tcp_server::listener, public raw_tcp_connection::listener { - public: output_network_server(uv_loop_t* loop) { m_tcp_server = new raw_tcp_server(loop, "0.0.0.0", 8000, 256, this, this); } @@ -48,17 +47,17 @@ public: virtual ~output_network() { } - virtual int init(const osd_options &options) override { + virtual int init(const osd_options &options) override { m_loop = new uv_loop_t; int err = uv_loop_init(m_loop); if (err) { return 1; } m_working_thread = std::thread([](output_network* self) { self->process_output(); }, this); - return 0; + return 0; } - virtual void exit() override { + virtual void exit() override { m_server->terminate_all(); m_working_thread.join(); uv_loop_close(m_loop); @@ -76,7 +75,7 @@ public: m_server = new output_network_server(m_loop); uv_run(m_loop, UV_RUN_DEFAULT); } - + private: std::thread m_working_thread; uv_loop_t* m_loop; diff --git a/src/osd/modules/render/aviwrite.cpp b/src/osd/modules/render/aviwrite.cpp index 6a27c567a43..9ff7c5ab17d 100644 --- a/src/osd/modules/render/aviwrite.cpp +++ b/src/osd/modules/render/aviwrite.cpp @@ -112,7 +112,7 @@ void avi_write::end_avi_recording() m_output_file.reset(); } - m_recording = false; + m_recording = false; m_output_file = nullptr; m_frame = 0; } @@ -158,4 +158,4 @@ void avi_write::audio_frame(const INT16 *buffer, int samples_this_frame) end_avi_recording(); } } -}
\ No newline at end of file +} diff --git a/src/osd/modules/render/aviwrite.h b/src/osd/modules/render/aviwrite.h index 2a948964eb8..ce6325d6815 100644 --- a/src/osd/modules/render/aviwrite.h +++ b/src/osd/modules/render/aviwrite.h @@ -34,12 +34,12 @@ private: void begin_avi_recording(std::string name); void end_avi_recording(); - running_machine& m_machine; + running_machine& m_machine; - bool m_recording; + bool m_recording; - uint32_t m_width; - uint32_t m_height; + uint32_t m_width; + uint32_t m_height; avi_file::ptr m_output_file; @@ -48,4 +48,4 @@ private: attotime m_next_frame_time; }; -#endif // __RENDER_AVIWRITE__
\ No newline at end of file +#endif // __RENDER_AVIWRITE__ diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp index 8c517c8dc2f..9e399fef255 100644 --- a/src/osd/modules/render/bgfx/chain.cpp +++ b/src/osd/modules/render/bgfx/chain.cpp @@ -63,13 +63,13 @@ bgfx_chain::~bgfx_chain() void bgfx_chain::process(render_primitive* prim, int view, int screen, texture_manager& textures, osd_window& window, uint64_t blend) { screen_device_iterator screen_iterator(window.machine().root_device()); - screen_device* screen_device = screen_iterator.byindex(screen); + screen_device* screen_device = screen_iterator.byindex(screen); render_container &screen_container = screen_device->container(); int current_view = view; uint16_t screen_width(floor((prim->bounds.x1 - prim->bounds.x0) + 0.5f)); uint16_t screen_height(floor((prim->bounds.y1 - prim->bounds.y0) + 0.5f)); - uint32_t rotation_type = + uint32_t rotation_type = (window.target()->orientation() & ROT90) == ROT90 ? 1 : (window.target()->orientation() & ROT180) == ROT180 ? 2 : (window.target()->orientation() & ROT270) == ROT270 ? 3 : 0; diff --git a/src/osd/modules/render/bgfx/chain.h b/src/osd/modules/render/bgfx/chain.h index 4e7a0587cd9..eff50f2aedb 100644 --- a/src/osd/modules/render/bgfx/chain.h +++ b/src/osd/modules/render/bgfx/chain.h @@ -42,15 +42,15 @@ public: private: std::string m_name; std::string m_author; - bool m_transform; - target_manager& m_targets; + bool m_transform; + target_manager& m_targets; std::vector<bgfx_slider*> m_sliders; std::vector<bgfx_parameter*> m_params; std::vector<bgfx_chain_entry*> m_entries; - std::vector<bgfx_target*> m_target_list; + std::vector<bgfx_target*> m_target_list; std::map<std::string, bgfx_slider*> m_slider_map; int64_t m_current_time; - uint32_t m_screen_index; + uint32_t m_screen_index; }; #endif // __DRAWBGFX_CHAIN__ diff --git a/src/osd/modules/render/bgfx/chainentry.h b/src/osd/modules/render/bgfx/chainentry.h index 271941537a7..4f4bede5327 100644 --- a/src/osd/modules/render/bgfx/chainentry.h +++ b/src/osd/modules/render/bgfx/chainentry.h @@ -61,7 +61,7 @@ private: std::string m_name; bgfx_effect* m_effect; - clear_state* m_clear; + clear_state* m_clear; std::vector<bgfx_suppressor*> m_suppressors; std::vector<bgfx_input_pair*> m_inputs; std::vector<bgfx_entry_uniform*> m_uniforms; diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index f1f530271f5..8614149b7eb 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -38,22 +38,22 @@ using namespace rapidjson; const uint32_t chain_manager::CHAIN_NONE = 0; chain_manager::chain_manager(running_machine& machine, osd_options& options, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t window_index, slider_dirty_notifier& slider_notifier) - : m_machine(machine) - , m_options(options) - , m_textures(textures) - , m_targets(targets) - , m_effects(effects) - , m_window_index(window_index) - , m_slider_notifier(slider_notifier) - , m_screen_count(0) + : m_machine(machine) + , m_options(options) + , m_textures(textures) + , m_targets(targets) + , m_effects(effects) + , m_window_index(window_index) + , m_slider_notifier(slider_notifier) + , m_screen_count(0) { refresh_available_chains(); - parse_chain_selections(options.bgfx_screen_chains()); + parse_chain_selections(options.bgfx_screen_chains()); } chain_manager::~chain_manager() { - destroy_chains(); + destroy_chains(); } void chain_manager::refresh_available_chains() @@ -181,280 +181,280 @@ bgfx_chain* chain_manager::load_chain(std::string name, uint32_t screen_index) void chain_manager::parse_chain_selections(std::string chain_str) { - std::vector<std::string> chain_names = split_option_string(chain_str); - - while (m_current_chain.size() != chain_names.size()) - { - m_screen_chains.push_back(nullptr); - m_chain_names.push_back(""); - m_current_chain.push_back(CHAIN_NONE); - } - - for (size_t index = 0; index < chain_names.size(); index++) - { - size_t chain_index = 0; - for (chain_index = 0; chain_index < m_available_chains.size(); chain_index++) - { - if (m_available_chains[chain_index].m_name == chain_names[index]) - { - break; - } - } - - if (chain_index < m_available_chains.size()) - { - m_current_chain[index] = chain_index; - m_chain_names[index] = m_available_chains[chain_index].m_name; - } - else - { - m_current_chain[index] = CHAIN_NONE; - m_chain_names[index] = ""; - } - } + std::vector<std::string> chain_names = split_option_string(chain_str); + + while (m_current_chain.size() != chain_names.size()) + { + m_screen_chains.push_back(nullptr); + m_chain_names.push_back(""); + m_current_chain.push_back(CHAIN_NONE); + } + + for (size_t index = 0; index < chain_names.size(); index++) + { + size_t chain_index = 0; + for (chain_index = 0; chain_index < m_available_chains.size(); chain_index++) + { + if (m_available_chains[chain_index].m_name == chain_names[index]) + { + break; + } + } + + if (chain_index < m_available_chains.size()) + { + m_current_chain[index] = chain_index; + m_chain_names[index] = m_available_chains[chain_index].m_name; + } + else + { + m_current_chain[index] = CHAIN_NONE; + m_chain_names[index] = ""; + } + } } std::vector<std::string> chain_manager::split_option_string(std::string chain_str) const { - std::vector<std::string> chain_names; - - uint32_t length = chain_str.length(); - uint32_t win = 0; - uint32_t last_start = 0; - for (uint32_t i = 0; i < length + 1; i++) - { - if (i == length || chain_str[i] == ',' || chain_str[i] == ':') - { - if (win == m_window_index) - { - chain_names.push_back(chain_str.substr(last_start, i - last_start)); - } - last_start = i + 1; - if (chain_str[i] == ':') - { - win++; - } - } - } - - return chain_names; + std::vector<std::string> chain_names; + + uint32_t length = chain_str.length(); + uint32_t win = 0; + uint32_t last_start = 0; + for (uint32_t i = 0; i < length + 1; i++) + { + if (i == length || chain_str[i] == ',' || chain_str[i] == ':') + { + if (win == m_window_index) + { + chain_names.push_back(chain_str.substr(last_start, i - last_start)); + } + last_start = i + 1; + if (chain_str[i] == ':') + { + win++; + } + } + } + + return chain_names; } void chain_manager::load_chains() { - for (size_t chain = 0; chain < m_current_chain.size() && chain < m_screen_chains.size(); chain++) - { - if (m_current_chain[chain] != CHAIN_NONE) - { + for (size_t chain = 0; chain < m_current_chain.size() && chain < m_screen_chains.size(); chain++) + { + if (m_current_chain[chain] != CHAIN_NONE) + { chain_desc& desc = m_available_chains[m_current_chain[chain]]; m_chain_names[chain] = desc.m_name; - m_screen_chains[chain] = load_chain(desc.m_path + "/" + desc.m_name, uint32_t(chain)); - } - } + m_screen_chains[chain] = load_chain(desc.m_path + "/" + desc.m_name, uint32_t(chain)); + } + } } void chain_manager::destroy_chains() { - for (size_t index = 0; index < m_screen_chains.size(); index++) - { - if (m_screen_chains[index] != nullptr) - { - delete m_screen_chains[index]; - m_screen_chains[index] = nullptr; - } - } + for (size_t index = 0; index < m_screen_chains.size(); index++) + { + if (m_screen_chains[index] != nullptr) + { + delete m_screen_chains[index]; + m_screen_chains[index] = nullptr; + } + } } void chain_manager::reload_chains() { - destroy_chains(); - load_chains(); + destroy_chains(); + load_chains(); } bgfx_chain* chain_manager::screen_chain(uint32_t screen) { - if (screen >= m_screen_chains.size()) - { - return m_screen_chains[m_screen_chains.size() - 1]; - } - else - { - return m_screen_chains[screen]; - } + if (screen >= m_screen_chains.size()) + { + return m_screen_chains[m_screen_chains.size() - 1]; + } + else + { + return m_screen_chains[screen]; + } } void chain_manager::process_screen_quad(uint32_t view, uint32_t screen, render_primitive* prim, osd_window &window) { - uint16_t tex_width(prim->texture.width); - uint16_t tex_height(prim->texture.height); + uint16_t tex_width(prim->texture.width); + uint16_t tex_height(prim->texture.height); - const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK, - tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base); + const bgfx::Memory* mem = bgfx_util::mame_texture_data_to_bgfx_texture_data(prim->flags & PRIMFLAG_TEXFORMAT_MASK, + tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base); - std::string full_name = "screen" + std::to_string(screen); - bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); - m_textures.add_provider(full_name, texture); + std::string full_name = "screen" + std::to_string(screen); + bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); + m_textures.add_provider(full_name, texture); - m_targets.update_target_sizes(screen, tex_width, tex_height, TARGET_STYLE_GUEST); + m_targets.update_target_sizes(screen, tex_width, tex_height, TARGET_STYLE_GUEST); - bgfx_chain* chain = screen_chain(screen); - chain->process(prim, view, screen, m_textures, window, bgfx_util::get_blend_state(PRIMFLAG_GET_BLENDMODE(prim->flags))); - view += chain->applicable_passes(); + bgfx_chain* chain = screen_chain(screen); + chain->process(prim, view, screen, m_textures, window, bgfx_util::get_blend_state(PRIMFLAG_GET_BLENDMODE(prim->flags))); + view += chain->applicable_passes(); - m_textures.add_provider(full_name, nullptr); - delete texture; + m_textures.add_provider(full_name, nullptr); + delete texture; } std::vector<render_primitive*> chain_manager::count_screens(render_primitive* prim) { - std::vector<render_primitive*> screens; + std::vector<render_primitive*> screens; - int screen_count = 0; - while (prim != nullptr) - { - if (PRIMFLAG_GET_SCREENTEX(prim->flags)) - { + int screen_count = 0; + while (prim != nullptr) + { + if (PRIMFLAG_GET_SCREENTEX(prim->flags)) + { screen_count++; screens.push_back(prim); - } - prim = prim->next(); - } + } + prim = prim->next(); + } - if (screen_count > 0) - { + if (screen_count > 0) + { update_screen_count(screen_count); - m_targets.update_screen_count(screen_count); - } + m_targets.update_screen_count(screen_count); + } - return screens; + return screens; } void chain_manager::update_screen_count(uint32_t screen_count) { if (screen_count != m_screen_count) { - m_slider_notifier.set_sliders_dirty(); + m_slider_notifier.set_sliders_dirty(); m_screen_count = screen_count; - // Ensure we have one screen chain entry per screen - while (m_screen_chains.size() < m_screen_count) - { - m_screen_chains.push_back(nullptr); - m_chain_names.push_back(""); - m_current_chain.push_back(CHAIN_NONE); - } - - // Ensure we have a screen chain selection slider per screen - while (m_selection_sliders.size() < m_screen_count) - { - create_selection_slider(m_selection_sliders.size()); - } - - load_chains(); + // Ensure we have one screen chain entry per screen + while (m_screen_chains.size() < m_screen_count) + { + m_screen_chains.push_back(nullptr); + m_chain_names.push_back(""); + m_current_chain.push_back(CHAIN_NONE); + } + + // Ensure we have a screen chain selection slider per screen + while (m_selection_sliders.size() < m_screen_count) + { + create_selection_slider(m_selection_sliders.size()); + } + + load_chains(); } } static INT32 update_trampoline(running_machine &machine, void *arg, int id, std::string *str, INT32 newval) { - if (arg != nullptr) - { - return reinterpret_cast<chain_manager*>(arg)->chain_changed(id, str, newval); - } - return 0; + if (arg != nullptr) + { + return reinterpret_cast<chain_manager*>(arg)->chain_changed(id, str, newval); + } + return 0; } int32_t chain_manager::chain_changed(int32_t id, std::string *str, int32_t newval) { - if (newval != SLIDER_NOCHANGE) - { - m_current_chain[id] = newval; + if (newval != SLIDER_NOCHANGE) + { + m_current_chain[id] = newval; std::vector<std::vector<float>> settings = slider_settings(); - reload_chains(); - restore_slider_settings(id, settings); + reload_chains(); + restore_slider_settings(id, settings); - m_slider_notifier.set_sliders_dirty(); - } + m_slider_notifier.set_sliders_dirty(); + } - if (str != nullptr) - { - *str = string_format("%s", m_available_chains[m_current_chain[id]].m_name.c_str()); - } + if (str != nullptr) + { + *str = string_format("%s", m_available_chains[m_current_chain[id]].m_name.c_str()); + } - return m_current_chain[id]; + return m_current_chain[id]; } void chain_manager::create_selection_slider(uint32_t screen_index) { - if (screen_index < m_selection_sliders.size()) - { - return; - } - - std::string description = "Window " + std::to_string(m_window_index) + ", Screen " + std::to_string(screen_index) + " Effect:"; - size_t size = sizeof(slider_state) + description.length(); - slider_state *state = reinterpret_cast<slider_state *>(auto_alloc_array_clear(m_machine, UINT8, size)); - - state->minval = 0; - state->defval = m_current_chain[screen_index]; - state->maxval = m_available_chains.size() - 1; - state->incval = 1; - state->update = update_trampoline; - state->arg = this; - state->id = screen_index; - strcpy(state->description, description.c_str()); - - ui_menu_item item; - item.text = state->description; - item.subtext = ""; - item.flags = 0; - item.ref = state; - item.type = ui_menu_item_type::SLIDER; - m_selection_sliders.push_back(item); + if (screen_index < m_selection_sliders.size()) + { + return; + } + + std::string description = "Window " + std::to_string(m_window_index) + ", Screen " + std::to_string(screen_index) + " Effect:"; + size_t size = sizeof(slider_state) + description.length(); + slider_state *state = reinterpret_cast<slider_state *>(auto_alloc_array_clear(m_machine, UINT8, size)); + + state->minval = 0; + state->defval = m_current_chain[screen_index]; + state->maxval = m_available_chains.size() - 1; + state->incval = 1; + state->update = update_trampoline; + state->arg = this; + state->id = screen_index; + strcpy(state->description, description.c_str()); + + ui_menu_item item; + item.text = state->description; + item.subtext = ""; + item.flags = 0; + item.ref = state; + item.type = ui_menu_item_type::SLIDER; + m_selection_sliders.push_back(item); } uint32_t chain_manager::handle_screen_chains(uint32_t view, render_primitive *starting_prim, osd_window& window) { - std::vector<render_primitive*> screens = count_screens(starting_prim); - - if (screens.size() == 0) - { - return 0; - } - - // Process each screen as necessary - uint32_t used_views = 0; - uint32_t screen_index = 0; - for (render_primitive* prim : screens) - { - if (m_current_chain[screen_index] == CHAIN_NONE || screen_chain(screen_index) == nullptr) - { + std::vector<render_primitive*> screens = count_screens(starting_prim); + + if (screens.size() == 0) + { + return 0; + } + + // Process each screen as necessary + uint32_t used_views = 0; + uint32_t screen_index = 0; + for (render_primitive* prim : screens) + { + if (m_current_chain[screen_index] == CHAIN_NONE || screen_chain(screen_index) == nullptr) + { screen_index++; - continue; - } + continue; + } - uint16_t screen_width(floor((prim->bounds.x1 - prim->bounds.x0) + 0.5f)); - uint16_t screen_height(floor((prim->bounds.y1 - prim->bounds.y0) + 0.5f)); - if (window.swap_xy()) - { - std::swap(screen_width, screen_height); - } + uint16_t screen_width(floor((prim->bounds.x1 - prim->bounds.x0) + 0.5f)); + uint16_t screen_height(floor((prim->bounds.y1 - prim->bounds.y0) + 0.5f)); + if (window.swap_xy()) + { + std::swap(screen_width, screen_height); + } - m_targets.update_target_sizes(screen_index, screen_width, screen_height, TARGET_STYLE_NATIVE); - process_screen_quad(view + used_views, screen_index, prim, window); - used_views += screen_chain(screen_index)->applicable_passes(); + m_targets.update_target_sizes(screen_index, screen_width, screen_height, TARGET_STYLE_NATIVE); + process_screen_quad(view + used_views, screen_index, prim, window); + used_views += screen_chain(screen_index)->applicable_passes(); - screen_index++; - } + screen_index++; + } - bgfx::setViewFrameBuffer(view + used_views, BGFX_INVALID_HANDLE); + bgfx::setViewFrameBuffer(view + used_views, BGFX_INVALID_HANDLE); - return used_views; + return used_views; } bool chain_manager::has_applicable_chain(uint32_t screen) { - return screen < m_screen_count && m_current_chain[screen] != CHAIN_NONE && m_screen_chains[screen] != nullptr; + return screen < m_screen_count && m_current_chain[screen] != CHAIN_NONE && m_screen_chains[screen] != nullptr; } bool chain_manager::needs_sliders() @@ -464,79 +464,79 @@ bool chain_manager::needs_sliders() void chain_manager::restore_slider_settings(int32_t id, std::vector<std::vector<float>>& settings) { - if (!needs_sliders()) - { - return; - } + if (!needs_sliders()) + { + return; + } - for (size_t index = 0; index < m_screen_chains.size() && index < m_screen_count; index++) - { + for (size_t index = 0; index < m_screen_chains.size() && index < m_screen_count; index++) + { if (index == id) { continue; } - bgfx_chain* chain = m_screen_chains[index]; - if (chain == nullptr) - { - continue; - } + bgfx_chain* chain = m_screen_chains[index]; + if (chain == nullptr) + { + continue; + } - std::vector<bgfx_slider*> chain_sliders = chain->sliders(); + std::vector<bgfx_slider*> chain_sliders = chain->sliders(); for (size_t slider = 0; slider < chain_sliders.size(); slider++) { chain_sliders[slider]->import(settings[index][slider]); } - } + } } std::vector<std::vector<float>> chain_manager::slider_settings() { std::vector<std::vector<float>> curr; - if (!needs_sliders()) - { - return curr; - } + if (!needs_sliders()) + { + return curr; + } - for (size_t index = 0; index < m_screen_chains.size() && index < m_screen_count; index++) - { + for (size_t index = 0; index < m_screen_chains.size() && index < m_screen_count; index++) + { curr.push_back(std::vector<float>()); - bgfx_chain* chain = m_screen_chains[index]; - if (chain == nullptr) - { - continue; - } + bgfx_chain* chain = m_screen_chains[index]; + if (chain == nullptr) + { + continue; + } - std::vector<bgfx_slider*> chain_sliders = chain->sliders(); - for (bgfx_slider* slider : chain_sliders) - { + std::vector<bgfx_slider*> chain_sliders = chain->sliders(); + for (bgfx_slider* slider : chain_sliders) + { curr[index].push_back(slider->value()); - } - } + } + } - return curr; + return curr; } std::vector<ui_menu_item> chain_manager::get_slider_list() { std::vector<ui_menu_item> sliders; - if (!needs_sliders()) - { - return sliders; - } + if (!needs_sliders()) + { + return sliders; + } - for (size_t index = 0; index < m_screen_chains.size() && index < m_screen_count; index++) - { - bgfx_chain* chain = m_screen_chains[index]; + for (size_t index = 0; index < m_screen_chains.size() && index < m_screen_count; index++) + { + bgfx_chain* chain = m_screen_chains[index]; sliders.push_back(m_selection_sliders[index]); - if (chain == nullptr) - { - continue; - } + if (chain == nullptr) + { + continue; + } std::vector<bgfx_chain_entry*> chain_entries = chain->entries(); for (bgfx_chain_entry* entry : chain_entries) @@ -552,34 +552,34 @@ std::vector<ui_menu_item> chain_manager::get_slider_list() } } - std::vector<bgfx_slider*> chain_sliders = chain->sliders(); - for (bgfx_slider* slider : chain_sliders) - { - slider_state* core_slider = slider->core_slider(); - - ui_menu_item item; - item.text = core_slider->description; - item.subtext = ""; - item.flags = 0; - item.ref = core_slider; - item.type = ui_menu_item_type::SLIDER; - m_selection_sliders.push_back(item); - - sliders.push_back(item); - } - - if (chain_sliders.size() > 0) - { - ui_menu_item item; - item.text = MENU_SEPARATOR_ITEM; - item.subtext = ""; - item.flags = 0; - item.ref = nullptr; - item.type = ui_menu_item_type::SEPARATOR; - - sliders.push_back(item); + std::vector<bgfx_slider*> chain_sliders = chain->sliders(); + for (bgfx_slider* slider : chain_sliders) + { + slider_state* core_slider = slider->core_slider(); + + ui_menu_item item; + item.text = core_slider->description; + item.subtext = ""; + item.flags = 0; + item.ref = core_slider; + item.type = ui_menu_item_type::SLIDER; + m_selection_sliders.push_back(item); + + sliders.push_back(item); + } + + if (chain_sliders.size() > 0) + { + ui_menu_item item; + item.text = MENU_SEPARATOR_ITEM; + item.subtext = ""; + item.flags = 0; + item.ref = nullptr; + item.type = ui_menu_item_type::SEPARATOR; + + sliders.push_back(item); } - } + } - return sliders; + return sliders; } diff --git a/src/osd/modules/render/bgfx/chainmanager.h b/src/osd/modules/render/bgfx/chainmanager.h index 0907cd27f57..979c487a237 100644 --- a/src/osd/modules/render/bgfx/chainmanager.h +++ b/src/osd/modules/render/bgfx/chainmanager.h @@ -49,10 +49,10 @@ public: chain_manager(running_machine& machine, osd_options& options, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t window_index, slider_dirty_notifier& slider_notifier); ~chain_manager(); - uint32_t handle_screen_chains(uint32_t view, render_primitive *starting_prim, osd_window& window); - int32_t chain_changed(int32_t index, std::string *str, int32_t newval); + uint32_t handle_screen_chains(uint32_t view, render_primitive *starting_prim, osd_window& window); + int32_t chain_changed(int32_t index, std::string *str, int32_t newval); - // Getters + // Getters running_machine& machine() { return m_machine; } osd_options& options() { return m_options; } texture_manager& textures() { return m_textures; } @@ -61,48 +61,48 @@ public: slider_dirty_notifier& slider_notifier() { return m_slider_notifier; } uint32_t window_index() { return m_window_index; } uint32_t screen_count() { return m_screen_count; } - bgfx_chain* screen_chain(uint32_t screen); - bgfx_chain* load_chain(std::string name, uint32_t screen_index); - bool has_applicable_chain(uint32_t screen); - std::vector<ui_menu_item> get_slider_list(); - std::vector<std::vector<float>> slider_settings(); + bgfx_chain* screen_chain(uint32_t screen); + bgfx_chain* load_chain(std::string name, uint32_t screen_index); + bool has_applicable_chain(uint32_t screen); + std::vector<ui_menu_item> get_slider_list(); + std::vector<std::vector<float>> slider_settings(); - // Setters - void restore_slider_settings(int32_t id, std::vector<std::vector<float>>& settings); + // Setters + void restore_slider_settings(int32_t id, std::vector<std::vector<float>>& settings); private: - void load_chains(); - void destroy_chains(); - void reload_chains(); + void load_chains(); + void destroy_chains(); + void reload_chains(); void refresh_available_chains(); void destroy_unloaded_chains(); - void find_available_chains(std::string root, std::string path); - void parse_chain_selections(std::string chain_str); - std::vector<std::string> split_option_string(std::string chain_str) const; + void find_available_chains(std::string root, std::string path); + void parse_chain_selections(std::string chain_str); + std::vector<std::string> split_option_string(std::string chain_str) const; void update_screen_count(uint32_t screen_count); - void create_selection_slider(uint32_t screen_index); - bool needs_sliders(); + void create_selection_slider(uint32_t screen_index); + bool needs_sliders(); - std::vector<render_primitive*> count_screens(render_primitive* prim); - void process_screen_quad(uint32_t view, uint32_t screen, render_primitive* prim, osd_window &window); + std::vector<render_primitive*> count_screens(render_primitive* prim); + void process_screen_quad(uint32_t view, uint32_t screen, render_primitive* prim, osd_window &window); - running_machine& m_machine; + running_machine& m_machine; osd_options& m_options; texture_manager& m_textures; target_manager& m_targets; effect_manager& m_effects; - uint32_t m_window_index; - slider_dirty_notifier& m_slider_notifier; - uint32_t m_screen_count; - std::vector<chain_desc> m_available_chains; - std::vector<bgfx_chain*> m_screen_chains; - std::vector<std::string> m_chain_names; - std::vector<ui_menu_item> m_selection_sliders; - std::vector<int32_t> m_current_chain; - - static const uint32_t CHAIN_NONE; + uint32_t m_window_index; + slider_dirty_notifier& m_slider_notifier; + uint32_t m_screen_count; + std::vector<chain_desc> m_available_chains; + std::vector<bgfx_chain*> m_screen_chains; + std::vector<std::string> m_chain_names; + std::vector<ui_menu_item> m_selection_sliders; + std::vector<int32_t> m_current_chain; + + static const uint32_t CHAIN_NONE; }; #endif // __DRAWBGFX_CHAIN_MANAGER__ diff --git a/src/osd/modules/render/bgfx/clear.h b/src/osd/modules/render/bgfx/clear.h index 3d45f9a7d62..01849a2cd90 100644 --- a/src/osd/modules/render/bgfx/clear.h +++ b/src/osd/modules/render/bgfx/clear.h @@ -21,10 +21,10 @@ public: void bind(int view) const; private: - const uint64_t m_flags; - const uint32_t m_color; - const float m_depth; - const uint8_t m_stencil; + const uint64_t m_flags; + const uint32_t m_color; + const float m_depth; + const uint8_t m_stencil; }; #endif // __DRAWBGFX_CLEAR__ diff --git a/src/osd/modules/render/bgfx/target.h b/src/osd/modules/render/bgfx/target.h index 17527f189a7..53fd70dd46b 100644 --- a/src/osd/modules/render/bgfx/target.h +++ b/src/osd/modules/render/bgfx/target.h @@ -52,7 +52,7 @@ public: private: std::string m_name; bgfx::TextureFormat::Enum m_format; - //bool m_readback; + //bool m_readback; bgfx::FrameBufferHandle* m_targets; bgfx::TextureHandle* m_textures; diff --git a/src/osd/modules/render/bgfx/targetmanager.cpp b/src/osd/modules/render/bgfx/targetmanager.cpp index 40895727437..4d56e33fc3e 100644 --- a/src/osd/modules/render/bgfx/targetmanager.cpp +++ b/src/osd/modules/render/bgfx/targetmanager.cpp @@ -176,12 +176,12 @@ void target_manager::create_target_if_nonexistent(uint32_t screen, std::string n uint16_t target_manager::width(uint32_t style, uint32_t screen) { - std::vector<osd_dim>& sizes = style == TARGET_STYLE_GUEST ? m_guest_dims : m_native_dims; - return screen < sizes.size() ? sizes[screen].width() : 0; + std::vector<osd_dim>& sizes = style == TARGET_STYLE_GUEST ? m_guest_dims : m_native_dims; + return screen < sizes.size() ? sizes[screen].width() : 0; } uint16_t target_manager::height(uint32_t style, uint32_t screen) { - std::vector<osd_dim>& sizes = style == TARGET_STYLE_GUEST ? m_guest_dims : m_native_dims; - return screen < sizes.size() ? sizes[screen].height() : 0; + std::vector<osd_dim>& sizes = style == TARGET_STYLE_GUEST ? m_guest_dims : m_native_dims; + return screen < sizes.size() ? sizes[screen].height() : 0; } diff --git a/src/osd/modules/render/bgfx/targetmanager.h b/src/osd/modules/render/bgfx/targetmanager.h index 0ab45e638d1..58007084080 100644 --- a/src/osd/modules/render/bgfx/targetmanager.h +++ b/src/osd/modules/render/bgfx/targetmanager.h @@ -39,8 +39,8 @@ public: // Getters bgfx_target* target(uint32_t screen, std::string name); - uint16_t width(uint32_t style, uint32_t screen); - uint16_t height(uint32_t style, uint32_t screen); + uint16_t width(uint32_t style, uint32_t screen); + uint16_t height(uint32_t style, uint32_t screen); private: void rebuild_targets(uint32_t screen, uint32_t style); diff --git a/src/osd/modules/render/bgfx/targetreader.cpp b/src/osd/modules/render/bgfx/targetreader.cpp index 9a8d6aebb63..71b82383a59 100644 --- a/src/osd/modules/render/bgfx/targetreader.cpp +++ b/src/osd/modules/render/bgfx/targetreader.cpp @@ -43,13 +43,13 @@ bgfx_target* target_reader::read_from_value(const Value& value, std::string pref switch (mode) { case TARGET_STYLE_GUEST: - width = chains.targets().width(TARGET_STYLE_GUEST, screen_index); - height = chains.targets().height(TARGET_STYLE_GUEST, screen_index); - break; + width = chains.targets().width(TARGET_STYLE_GUEST, screen_index); + height = chains.targets().height(TARGET_STYLE_GUEST, screen_index); + break; case TARGET_STYLE_NATIVE: - width = chains.targets().width(TARGET_STYLE_NATIVE, screen_index); - height = chains.targets().height(TARGET_STYLE_NATIVE, screen_index); - break; + width = chains.targets().width(TARGET_STYLE_NATIVE, screen_index); + height = chains.targets().height(TARGET_STYLE_NATIVE, screen_index); + break; case TARGET_STYLE_CUSTOM: if (!READER_CHECK(value.HasMember("width"), (prefix + "Target '" + target_name + "': Must have numeric value 'width'\n").c_str())) return nullptr; if (!READER_CHECK(value["width"].IsNumber(), (prefix + "Target '" + target_name + "': Value 'width' must be a number\n").c_str())) return nullptr; diff --git a/src/osd/modules/render/bgfx/texturemanager.cpp b/src/osd/modules/render/bgfx/texturemanager.cpp index 0b2d0bb9969..2a637d3992d 100644 --- a/src/osd/modules/render/bgfx/texturemanager.cpp +++ b/src/osd/modules/render/bgfx/texturemanager.cpp @@ -120,4 +120,3 @@ void texture_manager::remove_provider(std::string name, bool delete_provider) m_textures[name] = nullptr; } } - diff --git a/src/osd/modules/render/bgfxutil.cpp b/src/osd/modules/render/bgfxutil.cpp index a5099534220..91b64ac60ce 100644 --- a/src/osd/modules/render/bgfxutil.cpp +++ b/src/osd/modules/render/bgfxutil.cpp @@ -17,15 +17,15 @@ const bgfx::Memory* bgfx_util::mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base) { const bgfx::Memory* mem = bgfx::alloc(width * height * 4); - UINT32* data = reinterpret_cast<UINT32*>(mem->data); - UINT16* src16 = reinterpret_cast<UINT16*>(base); - UINT32* src32 = reinterpret_cast<UINT32*>(base); + UINT32* data = reinterpret_cast<UINT32*>(mem->data); + UINT16* src16 = reinterpret_cast<UINT16*>(base); + UINT32* src32 = reinterpret_cast<UINT32*>(base); - for (int y = 0; y < height; y++) + for (int y = 0; y < height; y++) { - UINT32* dst_line = data + y * width; - UINT16* src_line16 = src16 + y * rowpixels; - UINT32* src_line32 = src32 + y * rowpixels; + UINT32* dst_line = data + y * width; + UINT16* src_line16 = src16 + y * rowpixels; + UINT32* src_line32 = src32 + y * rowpixels; switch (format) { case PRIMFLAG_TEXFORMAT(TEXFORMAT_PALETTE16): diff --git a/src/osd/modules/render/bgfxutil.h b/src/osd/modules/render/bgfxutil.h index 0a776755dbf..4234165c12a 100644 --- a/src/osd/modules/render/bgfxutil.h +++ b/src/osd/modules/render/bgfxutil.h @@ -11,8 +11,8 @@ class bgfx_util { public: - static const bgfx::Memory* mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base); - static uint64_t get_blend_state(UINT32 blend); + static const bgfx::Memory* mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base); + static uint64_t get_blend_state(UINT32 blend); }; -#endif // __RENDER_BGFX_UTIL__
\ No newline at end of file +#endif // __RENDER_BGFX_UTIL__ diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 329706a9877..fef873f4309 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -2550,15 +2550,15 @@ std::vector<ui_menu_item> shaders::init_slider_list() break; } - slider_state* core_slider = slider_alloc(*machine, desc->id, name.c_str(), desc->minval, desc->defval, desc->maxval, desc->step, slider_update_trampoline, slider_arg); - - ui_menu_item item; - item.text = core_slider->description; - item.subtext = ""; - item.flags = 0; - item.ref = core_slider; - item.type = ui_menu_item_type::SLIDER; - sliders.push_back(item); + slider_state* core_slider = slider_alloc(*machine, desc->id, name.c_str(), desc->minval, desc->defval, desc->maxval, desc->step, slider_update_trampoline, slider_arg); + + ui_menu_item item; + item.text = core_slider->description; + item.subtext = ""; + item.flags = 0; + item.ref = core_slider; + item.type = ui_menu_item_type::SLIDER; + sliders.push_back(item); } } } diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 84f1ff0bd6f..7b43ac48331 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -94,16 +94,19 @@ renderer_bgfx::renderer_bgfx(std::shared_ptr<osd_window> w) renderer_bgfx::~renderer_bgfx() { + bgfx::reset(0, 0, BGFX_RESET_NONE); + bgfx::touch(0); + bgfx::frame(); if (m_avi_writer != nullptr && m_avi_writer->recording()) { m_avi_writer->stop(); - m_targets->destroy_target("avibuffer0"); - m_avi_target = nullptr; + m_targets->destroy_target("avibuffer0"); + m_avi_target = nullptr; - bgfx::destroyTexture(m_avi_texture); + bgfx::destroyTexture(m_avi_texture); - delete m_avi_writer; + delete m_avi_writer; delete [] m_avi_data; } @@ -263,13 +266,13 @@ void renderer_bgfx::record() m_avi_writer->stop(); m_targets->destroy_target("avibuffer0"); m_avi_target = nullptr; - bgfx::destroyTexture(m_avi_texture); + bgfx::destroyTexture(m_avi_texture); } else { m_avi_writer->record(m_options.bgfx_avi_name()); - m_avi_target = m_targets->create_target("avibuffer", bgfx::TextureFormat::RGBA8, m_width[0], m_height[0], TARGET_STYLE_CUSTOM, false, true, 1, 0); - m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK); + m_avi_target = m_targets->create_target("avibuffer", bgfx::TextureFormat::RGBA8, m_width[0], m_height[0], TARGET_STYLE_CUSTOM, false, true, 1, 0); + m_avi_texture = bgfx::createTexture2D(m_width[0], m_height[0], 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK); } } @@ -307,7 +310,7 @@ bgfx::VertexDecl ScreenVertex::ms_decl; void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, ScreenVertex* vertices) { rectangle_packer::packed_rectangle& rect = m_hash_to_entry[hash]; - float size = float(CACHE_SIZE); + float size = float(CACHE_SIZE); float u0 = (float(rect.x()) + 0.5f) / size; float v0 = (float(rect.y()) + 0.5f) / size; float u1 = u0 + (float(rect.width()) - 1.0f) / size; @@ -341,22 +344,22 @@ void renderer_bgfx::put_packed_quad(render_primitive *prim, UINT32 hash, ScreenV std::swap(v[1], v[3]); } - vertex(&vertices[0], x[0], y[0], 0, rgba, u[0], v[0]); - vertex(&vertices[1], x[1], y[1], 0, rgba, u[1], v[1]); - vertex(&vertices[2], x[3], y[3], 0, rgba, u[3], v[3]); - vertex(&vertices[3], x[3], y[3], 0, rgba, u[3], v[3]); - vertex(&vertices[4], x[2], y[2], 0, rgba, u[2], v[2]); - vertex(&vertices[5], x[0], y[0], 0, rgba, u[0], v[0]); + vertex(&vertices[0], x[0], y[0], 0, rgba, u[0], v[0]); + vertex(&vertices[1], x[1], y[1], 0, rgba, u[1], v[1]); + vertex(&vertices[2], x[3], y[3], 0, rgba, u[3], v[3]); + vertex(&vertices[3], x[3], y[3], 0, rgba, u[3], v[3]); + vertex(&vertices[4], x[2], y[2], 0, rgba, u[2], v[2]); + vertex(&vertices[5], x[0], y[0], 0, rgba, u[0], v[0]); } void renderer_bgfx::vertex(ScreenVertex* vertex, float x, float y, float z, uint32_t rgba, float u, float v) { - vertex->m_x = x; - vertex->m_y = y; - vertex->m_z = z; - vertex->m_rgba = rgba; - vertex->m_u = u; - vertex->m_v = v; + vertex->m_x = x; + vertex->m_y = y; + vertex->m_z = z; + vertex->m_rgba = rgba; + vertex->m_u = u; + vertex->m_v = v; } void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bgfx::TransientVertexBuffer* buffer, int32_t screen) @@ -368,12 +371,12 @@ void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bg float u[4] = { prim->texcoords.tl.u, prim->texcoords.tr.u, prim->texcoords.bl.u, prim->texcoords.br.u }; float v[4] = { prim->texcoords.tl.v, prim->texcoords.tr.v, prim->texcoords.bl.v, prim->texcoords.br.v }; - vertex(&vertices[0], x[0], y[0], 0, 0xffffffff, u[0], v[0]); - vertex(&vertices[1], x[1], y[1], 0, 0xffffffff, u[1], v[1]); - vertex(&vertices[2], x[3], y[3], 0, 0xffffffff, u[3], v[3]); - vertex(&vertices[3], x[3], y[3], 0, 0xffffffff, u[3], v[3]); - vertex(&vertices[4], x[2], y[2], 0, 0xffffffff, u[2], v[2]); - vertex(&vertices[5], x[0], y[0], 0, 0xffffffff, u[0], v[0]); + vertex(&vertices[0], x[0], y[0], 0, 0xffffffff, u[0], v[0]); + vertex(&vertices[1], x[1], y[1], 0, 0xffffffff, u[1], v[1]); + vertex(&vertices[2], x[3], y[3], 0, 0xffffffff, u[3], v[3]); + vertex(&vertices[3], x[3], y[3], 0, 0xffffffff, u[3], v[3]); + vertex(&vertices[4], x[2], y[2], 0, 0xffffffff, u[2], v[2]); + vertex(&vertices[5], x[0], y[0], 0, 0xffffffff, u[0], v[0]); uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; if (video_config.filter == 0) @@ -389,33 +392,33 @@ void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bg void renderer_bgfx::render_avi_quad() { - bgfx::setViewSeq(s_current_view, true); - bgfx::setViewRect(s_current_view, 0, 0, m_width[0], m_height[0]); - bgfx::setViewClear(s_current_view, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x00000000, 1.0f, 0); - - setup_matrices(s_current_view, false); - - bgfx::TransientVertexBuffer buffer; - bgfx::allocTransientVertexBuffer(&buffer, 6, ScreenVertex::ms_decl); - ScreenVertex* vertices = reinterpret_cast<ScreenVertex*>(buffer.data); - - float x[4] = { 0.0f, float(m_width[0]), 0.0f, float(m_width[0]) }; - float y[4] = { 0.0f, 0.0f, float(m_height[0]), float(m_height[0]) }; - float u[4] = { 0.0f, 1.0f, 0.0f, 1.0f }; - float v[4] = { 0.0f, 0.0f, 1.0f, 1.0f }; - UINT32 rgba = 0xffffffff; - - vertex(&vertices[0], x[0], y[0], 0, rgba, u[0], v[0]); - vertex(&vertices[1], x[1], y[1], 0, rgba, u[1], v[1]); - vertex(&vertices[2], x[3], y[3], 0, rgba, u[3], v[3]); - vertex(&vertices[3], x[3], y[3], 0, rgba, u[3], v[3]); - vertex(&vertices[4], x[2], y[2], 0, rgba, u[2], v[2]); - vertex(&vertices[5], x[0], y[0], 0, rgba, u[0], v[0]); - - bgfx::setVertexBuffer(&buffer); - bgfx::setTexture(0, m_gui_effect[PRIMFLAG_GET_BLENDMODE(BLENDMODE_NONE)]->uniform("s_tex")->handle(), m_avi_target->texture()); - m_gui_effect[PRIMFLAG_GET_BLENDMODE(BLENDMODE_NONE)]->submit(s_current_view); - s_current_view++; + bgfx::setViewSeq(s_current_view, true); + bgfx::setViewRect(s_current_view, 0, 0, m_width[0], m_height[0]); + bgfx::setViewClear(s_current_view, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x00000000, 1.0f, 0); + + setup_matrices(s_current_view, false); + + bgfx::TransientVertexBuffer buffer; + bgfx::allocTransientVertexBuffer(&buffer, 6, ScreenVertex::ms_decl); + ScreenVertex* vertices = reinterpret_cast<ScreenVertex*>(buffer.data); + + float x[4] = { 0.0f, float(m_width[0]), 0.0f, float(m_width[0]) }; + float y[4] = { 0.0f, 0.0f, float(m_height[0]), float(m_height[0]) }; + float u[4] = { 0.0f, 1.0f, 0.0f, 1.0f }; + float v[4] = { 0.0f, 0.0f, 1.0f, 1.0f }; + UINT32 rgba = 0xffffffff; + + vertex(&vertices[0], x[0], y[0], 0, rgba, u[0], v[0]); + vertex(&vertices[1], x[1], y[1], 0, rgba, u[1], v[1]); + vertex(&vertices[2], x[3], y[3], 0, rgba, u[3], v[3]); + vertex(&vertices[3], x[3], y[3], 0, rgba, u[3], v[3]); + vertex(&vertices[4], x[2], y[2], 0, rgba, u[2], v[2]); + vertex(&vertices[5], x[0], y[0], 0, rgba, u[0], v[0]); + + bgfx::setVertexBuffer(&buffer); + bgfx::setTexture(0, m_gui_effect[PRIMFLAG_GET_BLENDMODE(BLENDMODE_NONE)]->uniform("s_tex")->handle(), m_avi_target->texture()); + m_gui_effect[PRIMFLAG_GET_BLENDMODE(BLENDMODE_NONE)]->submit(s_current_view); + s_current_view++; } void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::TransientVertexBuffer* buffer) @@ -423,17 +426,17 @@ void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::Transient ScreenVertex* vertices = reinterpret_cast<ScreenVertex*>(buffer->data); UINT32 rgba = u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255); - float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 }; - float y[4] = { prim->bounds.y0, prim->bounds.y0, prim->bounds.y1, prim->bounds.y1 }; - float u[4] = { prim->texcoords.tl.u, prim->texcoords.tr.u, prim->texcoords.bl.u, prim->texcoords.br.u }; - float v[4] = { prim->texcoords.tl.v, prim->texcoords.tr.v, prim->texcoords.bl.v, prim->texcoords.br.v }; + float x[4] = { prim->bounds.x0, prim->bounds.x1, prim->bounds.x0, prim->bounds.x1 }; + float y[4] = { prim->bounds.y0, prim->bounds.y0, prim->bounds.y1, prim->bounds.y1 }; + float u[4] = { prim->texcoords.tl.u, prim->texcoords.tr.u, prim->texcoords.bl.u, prim->texcoords.br.u }; + float v[4] = { prim->texcoords.tl.v, prim->texcoords.tr.v, prim->texcoords.bl.v, prim->texcoords.br.v }; - vertex(&vertices[0], x[0], y[0], 0, rgba, u[0], v[0]); - vertex(&vertices[1], x[1], y[1], 0, rgba, u[1], v[1]); - vertex(&vertices[2], x[3], y[3], 0, rgba, u[3], v[3]); - vertex(&vertices[3], x[3], y[3], 0, rgba, u[3], v[3]); - vertex(&vertices[4], x[2], y[2], 0, rgba, u[2], v[2]); - vertex(&vertices[5], x[0], y[0], 0, rgba, u[0], v[0]); + vertex(&vertices[0], x[0], y[0], 0, rgba, u[0], v[0]); + vertex(&vertices[1], x[1], y[1], 0, rgba, u[1], v[1]); + vertex(&vertices[2], x[3], y[3], 0, rgba, u[3], v[3]); + vertex(&vertices[3], x[3], y[3], 0, rgba, u[3], v[3]); + vertex(&vertices[4], x[2], y[2], 0, rgba, u[2], v[2]); + vertex(&vertices[5], x[0], y[0], 0, rgba, u[0], v[0]); uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; if (video_config.filter == 0) @@ -657,11 +660,11 @@ int renderer_bgfx::draw(int update) s_current_view = 0; if (m_avi_writer == nullptr) { - uint32_t width = win->get_size().width(); - uint32_t height = win->get_size().height(); - m_avi_writer = new avi_write(win->machine(), width, height); + uint32_t width = win->get_size().width(); + uint32_t height = win->get_size().height(); + m_avi_writer = new avi_write(win->machine(), width, height); m_avi_data = new uint8_t[width * height * 4]; - m_avi_bitmap.allocate(width, height); + m_avi_bitmap.allocate(width, height); } } @@ -674,7 +677,7 @@ int renderer_bgfx::draw(int update) m_height[window_index] = wdim.height(); win->m_primlist->acquire_lock(); - s_current_view += m_chains->handle_screen_chains(s_current_view, win->m_primlist->first(), *win.get()); + s_current_view += m_chains->handle_screen_chains(s_current_view, win->m_primlist->first(), *win.get()); win->m_primlist->release_lock(); bool skip_frame = update_dimensions(); @@ -739,20 +742,20 @@ int renderer_bgfx::draw(int update) win->m_primlist->release_lock(); - // This dummy draw call is here to make sure that view 0 is cleared - // if no other draw calls are submitted to view 0. - bgfx::touch(s_current_view > 0 ? s_current_view - 1 : 0); + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to view 0. + bgfx::touch(s_current_view > 0 ? s_current_view - 1 : 0); - // Advance to next frame. Rendering thread will be kicked to + // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. if (window_index == 0) { if (m_avi_writer != nullptr && m_avi_writer->recording() && window_index == 0) { - render_avi_quad(); - bgfx::touch(s_current_view); - update_recording(); - } + render_avi_quad(); + bgfx::touch(s_current_view); + update_recording(); + } bgfx::frame(); } @@ -762,17 +765,17 @@ int renderer_bgfx::draw(int update) void renderer_bgfx::update_recording() { - bgfx::blit(s_current_view > 0 ? s_current_view - 1 : 0, m_avi_texture, 0, 0, m_avi_target->target()); - bgfx::readTexture(m_avi_texture, m_avi_data); + bgfx::blit(s_current_view > 0 ? s_current_view - 1 : 0, m_avi_texture, 0, 0, m_avi_target->target()); + bgfx::readTexture(m_avi_texture, m_avi_data); - UINT32* start = &m_avi_bitmap.pix32(0); - // loop over Y - for (int i = 0; i < m_width[0] * m_height[0] * 4; i += 4) - { - *start++ = 0xff000000 | (m_avi_data[i + 0] << 16) | (m_avi_data[i + 1] << 8) | m_avi_data[i + 2]; - } + UINT32* start = &m_avi_bitmap.pix32(0); + // loop over Y + for (int i = 0; i < m_width[0] * m_height[0] * 4; i += 4) + { + *start++ = 0xff000000 | (m_avi_data[i + 0] << 16) | (m_avi_data[i + 1] << 8) | m_avi_data[i + 2]; + } - m_avi_writer->video_frame(m_avi_bitmap); + m_avi_writer->video_frame(m_avi_bitmap); } void renderer_bgfx::add_audio_to_recording(const INT16 *buffer, int samples_this_frame) @@ -857,7 +860,7 @@ void renderer_bgfx::setup_view(uint32_t view_index, bool screen) { bgfx::setViewFrameBuffer(view_index, m_avi_target->target()); } - bgfx::setViewClear(view_index, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x00000000, 1.0f, 0); + bgfx::setViewClear(view_index, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x00000000, 1.0f, 0); } setup_matrices(view_index, screen); @@ -1157,11 +1160,11 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx:: std::vector<ui_menu_item> renderer_bgfx::get_slider_list() { - m_sliders_dirty = false; - return m_chains->get_slider_list(); + m_sliders_dirty = false; + return m_chains->get_slider_list(); } void renderer_bgfx::set_sliders_dirty() { - m_sliders_dirty = true; -}
\ No newline at end of file + m_sliders_dirty = true; +} diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h index 7cc3bab9e47..5e500fedb1e 100644 --- a/src/osd/modules/render/drawbgfx.h +++ b/src/osd/modules/render/drawbgfx.h @@ -39,11 +39,11 @@ public: static void exit(); virtual int create() override; - virtual int draw(const int update) override; + virtual int draw(const int update) override; virtual void add_audio_to_recording(const INT16 *buffer, int samples_this_frame) override; - virtual std::vector<ui_menu_item> get_slider_list() override; - virtual void set_sliders_dirty() override; + virtual std::vector<ui_menu_item> get_slider_list() override; + virtual void set_sliders_dirty() override; #ifdef OSD_SDL virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; @@ -75,19 +75,19 @@ public: return &win->target()->get_primitives(); } - static const char* WINDOW_PREFIX; + static const char* WINDOW_PREFIX; private: - void vertex(ScreenVertex* vertex, float x, float y, float z, uint32_t rgba, float u, float v); - void render_avi_quad(); - void update_recording(); + void vertex(ScreenVertex* vertex, float x, float y, float z, uint32_t rgba, float u, float v); + void render_avi_quad(); + void update_recording(); - bool update_dimensions(); + bool update_dimensions(); - void setup_view(uint32_t view_index, bool screen); + void setup_view(uint32_t view_index, bool screen); void init_ui_view(); - void setup_matrices(uint32_t view_index, bool screen); + void setup_matrices(uint32_t view_index, bool screen); void allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::TransientVertexBuffer *buffer); enum buffer_status @@ -146,8 +146,8 @@ private: avi_write* m_avi_writer; bgfx_target* m_avi_target; - bgfx::TextureHandle m_avi_texture; - bitmap_rgb32 m_avi_bitmap; + bgfx::TextureHandle m_avi_texture; + bitmap_rgb32 m_avi_bitmap; uint8_t* m_avi_data; static const uint16_t CACHE_SIZE; diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index 01d8085efd7..cf8dff7bd2d 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -631,7 +631,7 @@ void renderer_ogl::destroy_all_textures() auto win = try_getwindow(); - // During destroy this can get called + // During destroy this can get called // and the window is no longer available if (win == nullptr) return; diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index 622c360df7e..81943bf9165 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -679,7 +679,7 @@ render_primitive_list *renderer_sdl1::get_primitives() auto win = try_getwindow(); if (win == nullptr) return nullptr; - + osd_dim nd = win->get_size(); if (nd != m_blit_dim) { diff --git a/src/osd/modules/render/sliderdirtynotifier.h b/src/osd/modules/render/sliderdirtynotifier.h index bf9f645b894..aa95bb8fa82 100644 --- a/src/osd/modules/render/sliderdirtynotifier.h +++ b/src/osd/modules/render/sliderdirtynotifier.h @@ -19,4 +19,4 @@ public: virtual void set_sliders_dirty() = 0; }; -#endif // __RENDER_SLIDER_DIRTY_NOTIFIER__
\ No newline at end of file +#endif // __RENDER_SLIDER_DIRTY_NOTIFIER__ diff --git a/src/osd/osdcore.cpp b/src/osd/osdcore.cpp index badda762e16..58bb1157674 100644 --- a/src/osd/osdcore.cpp +++ b/src/osd/osdcore.cpp @@ -63,7 +63,7 @@ void CLIB_DECL osd_printf_error(const char *format, ...) va_start(argptr, format); #if defined(SDLMAME_ANDROID) SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, format, argptr); -#else +#else if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_ERROR, format, argptr); #endif va_end(argptr); @@ -83,7 +83,7 @@ void CLIB_DECL osd_printf_warning(const char *format, ...) va_start(argptr, format); #if defined(SDLMAME_ANDROID) SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, format, argptr); -#else +#else if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_WARNING, format, argptr); #endif va_end(argptr); @@ -103,7 +103,7 @@ void CLIB_DECL osd_printf_info(const char *format, ...) va_start(argptr, format); #if defined(SDLMAME_ANDROID) SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, format, argptr); -#else +#else if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_INFO, format, argptr); #endif va_end(argptr); @@ -123,7 +123,7 @@ void CLIB_DECL osd_printf_verbose(const char *format, ...) va_start(argptr, format); #if defined(SDLMAME_ANDROID) SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, format, argptr); -#else +#else if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_VERBOSE, format, argptr); #endif va_end(argptr); @@ -143,7 +143,7 @@ void CLIB_DECL osd_printf_debug(const char *format, ...) va_start(argptr, format); #if defined(SDLMAME_ANDROID) SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, format, argptr); -#else +#else if (m_ptr >= 0) m_stack[m_ptr]->output_callback(OSD_OUTPUT_CHANNEL_DEBUG, format, argptr); #endif va_end(argptr); @@ -194,4 +194,3 @@ void osd_sleep(osd_ticks_t duration) { std::this_thread::sleep_for(std::chrono::high_resolution_clock::duration(duration)); } - diff --git a/src/osd/osdsync.cpp b/src/osd/osdsync.cpp index 20d5151c8a6..9fdbc306d38 100644 --- a/src/osd/osdsync.cpp +++ b/src/osd/osdsync.cpp @@ -117,7 +117,7 @@ struct work_thread_info std::thread * handle; // handle to the thread osd_event wakeevent; // wake event for the thread std::atomic<INT32> active; // are we actively processing work? - UINT32 id; + UINT32 id; #if KEEP_STATISTICS INT32 itemsdone; @@ -149,7 +149,6 @@ struct osd_work_queue , spinloops(0) #endif { - } std::mutex lock; // lock for protecting the queue @@ -182,7 +181,7 @@ struct osd_work_item , callback(nullptr) , param(nullptr) , result(nullptr) - , event(nullptr) // manual reset, not signalled + , event(nullptr) // manual reset, not signalled , flags(0) , done(FALSE) { diff --git a/src/osd/osdsync.h b/src/osd/osdsync.h index a0eb8d36682..07b1d9fd82d 100644 --- a/src/osd/osdsync.h +++ b/src/osd/osdsync.h @@ -52,8 +52,8 @@ public: } /*----------------------------------------------------------------------------- - wait: wait for an event to be signalled - If the event is in signalled state, the + wait: wait for an event to be signalled + If the event is in signalled state, the function returns immediately. If not it will wait for the event to become signalled. diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp index 5112b3a3628..2f2cec699a2 100644 --- a/src/osd/sdl/sdlmain.cpp +++ b/src/osd/sdl/sdlmain.cpp @@ -203,7 +203,7 @@ int main(int argc, char *argv[]) /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE); #endif - + // FIXME: this should be done differently #ifdef SDLMAME_UNIX diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 8c10d72e076..b7b1bee8f7b 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -311,7 +311,7 @@ void sdl_osd_interface::window_exit() while (!sdl_window_list.empty()) { auto window = sdl_window_list.front(); - + // Part of destroy removes the window from the list window->destroy(); } @@ -364,7 +364,7 @@ void sdl_window_info::hide_pointer() void sdl_window_info::show_pointer() { SDL_ShowCursor(SDL_ENABLE); - + } @@ -1325,11 +1325,11 @@ osd_dim sdl_window_info::get_max_bounds(int constrain) sdl_window_info::sdl_window_info(running_machine &a_machine, int index, osd_monitor_info *a_monitor, const osd_window_config *config) : osd_window(), m_next(nullptr), m_startmaximized(0), - // Following three are used by input code to defer resizes + // Following three are used by input code to defer resizes m_minimum_dim(0,0), m_windowed_dim(0,0), m_rendered_event(0, 1), m_target(nullptr), m_extra_flags(0), - m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0) + m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0) { m_win_config = *config; m_index = index; diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index 403c12a8e46..527c587764e 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -85,7 +85,7 @@ private: render_target * m_target; // Original display_mode - SDL_DM_Wrapper *m_original_mode; + SDL_DM_Wrapper *m_original_mode; int m_extra_flags; diff --git a/src/osd/watchdog.h b/src/osd/watchdog.h index 415c1269882..77cf3c77c7c 100644 --- a/src/osd/watchdog.h +++ b/src/osd/watchdog.h @@ -27,7 +27,7 @@ public: osd_ticks_t getTimeout(void) const { return m_timeout; } void setTimeout(int timeout); private: - osd_event m_event; + osd_event m_event; std::thread* m_thread; std::atomic<INT32> m_do_exit; diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 8141dfc9a32..931af490f0f 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -378,7 +378,7 @@ win_window_info::win_window_info( m_non_fullscreen_bounds.bottom = 0; m_prescale = video_config.prescale; - + } win_window_info::~win_window_info() @@ -719,7 +719,7 @@ void winwindow_toggle_full_screen(void) // iterate over windows and toggle their fullscreen state for (auto window : win_window_list) SendMessage(window->platform_window<HWND>(), WM_USER_SET_FULLSCREEN, !video_config.windowed, 0); - + // Set the first window as foreground SetForegroundWindow(win_window_list.front()->platform_window<HWND>()); } @@ -1292,7 +1292,7 @@ int win_window_info::complete_create() menu, GetModuleHandleUni(), nullptr); - + if (hwnd == nullptr) return 1; diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 136daea0636..8b30e0f9812 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -390,8 +390,8 @@ void MameMainApp::Run() // Required for IFrameworkView. void MameMainApp::Uninitialize() { - // Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView - // class is torn down while the app is in the foreground. + // Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView + // class is torn down while the app is in the foreground. } IFrameworkView^ MameViewSource::CreateView() @@ -589,4 +589,4 @@ static int is_double_click_start(int argc) return (argc <= 1 && startup_info.dwFlags && !(startup_info.dwFlags & STARTF_USESTDHANDLES)); } -#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
\ No newline at end of file +#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) |