diff options
author | 2023-01-05 15:32:40 +0100 | |
---|---|---|
committer | 2023-01-05 09:32:40 -0500 | |
commit | 812e6094f47bb8d1da5a6b421aa4c724cf2035c0 (patch) | |
tree | 0f5bab2fe9393d1f629e9bf63e76cecca74ec0c9 /src | |
parent | 4a1b41854bba8fc2567906b88bab8ca81e75d187 (diff) |
Update BGFX, BX and BIMG (#10789)
* Update to bgfx a93a714632b79b5ddbf5c86ac323fa9b76ed3433
Co-authored-by: Бранимир Караџић <branimirkaradzic@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/osd/modules/debugger/debugimgui.cpp | 119 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/chainmanager.cpp | 3 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/effectmanager.cpp | 3 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/shadermanager.cpp | 6 |
4 files changed, 76 insertions, 55 deletions
diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 5f087f70a2e..6221b435f2f 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -203,6 +203,7 @@ private: file_entry* m_selected_file; int m_format_sel; char m_path[1024]; // path text field buffer + std::unordered_map<input_item_id,ImGuiKey> m_mapping; }; // globals @@ -350,10 +351,11 @@ void debug_imgui::handle_keys() for(input_item_id id = ITEM_ID_A; id <= ITEM_ID_CANCEL; ++id) { - if(m_machine->input().code_pressed(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id))) - io.KeysDown[id] = true; - else - io.KeysDown[id] = false; + if(m_machine->input().code_pressed(input_code(DEVICE_CLASS_KEYBOARD, 0, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, id))) { + if (m_mapping.count(id)) io.AddKeyEvent(m_mapping[id], true); + } else { + if (m_mapping.count(id)) io.AddKeyEvent(m_mapping[id], false); + } } m_key_char = 0; @@ -372,9 +374,9 @@ void debug_imgui::handle_keys() } // global keys - if(ImGui::IsKeyPressed(ITEM_ID_F3,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F3,false)) { - if(ImGui::IsKeyDown(ITEM_ID_LSHIFT)) + if(ImGui::IsKeyDown(ImGuiKey_LeftShift)) m_machine->schedule_hard_reset(); else { @@ -383,44 +385,44 @@ void debug_imgui::handle_keys() } } - if(ImGui::IsKeyPressed(ITEM_ID_F5,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F5,false)) { m_machine->debugger().console().get_visible_cpu()->debug()->go(); m_running = true; } - if(ImGui::IsKeyPressed(ITEM_ID_F6,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F6,false)) { m_machine->debugger().console().get_visible_cpu()->debug()->go_next_device(); m_running = true; } - if(ImGui::IsKeyPressed(ITEM_ID_F7,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F7,false)) { m_machine->debugger().console().get_visible_cpu()->debug()->go_interrupt(); m_running = true; } - if(ImGui::IsKeyPressed(ITEM_ID_F8,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F8,false)) m_machine->debugger().console().get_visible_cpu()->debug()->go_vblank(); - if(ImGui::IsKeyPressed(ITEM_ID_F9,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F9,false)) m_machine->debugger().console().get_visible_cpu()->debug()->single_step_out(); - if(ImGui::IsKeyPressed(ITEM_ID_F10,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F10,false)) m_machine->debugger().console().get_visible_cpu()->debug()->single_step_over(); - if(ImGui::IsKeyPressed(ITEM_ID_F11,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F11,false)) m_machine->debugger().console().get_visible_cpu()->debug()->single_step(); - if(ImGui::IsKeyPressed(ITEM_ID_F12,false)) + if(ImGui::IsKeyPressed(ImGuiKey_F12,false)) { m_machine->debugger().console().get_visible_cpu()->debug()->go(); m_hide = true; } - if(ImGui::IsKeyPressed(ITEM_ID_D,false) && ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyPressed(ImGuiKey_D,false) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) add_disasm(++m_win_count); - if(ImGui::IsKeyPressed(ITEM_ID_M,false) && ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyPressed(ImGuiKey_M,false) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) add_memory(++m_win_count); - if(ImGui::IsKeyPressed(ITEM_ID_B,false) && ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyPressed(ImGuiKey_B,false) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) add_bpoints(++m_win_count); - if(ImGui::IsKeyPressed(ITEM_ID_W,false) && ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyPressed(ImGuiKey_W,false) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) add_wpoints(++m_win_count); - if(ImGui::IsKeyPressed(ITEM_ID_L,false) && ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyPressed(ImGuiKey_L,false) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) add_log(++m_win_count); } @@ -443,38 +445,38 @@ void debug_imgui::handle_keys_views() return; // pass keypresses to debug view with focus - if(ImGui::IsKeyPressed(ITEM_ID_UP)) + if(ImGui::IsKeyPressed(ImGuiKey_UpArrow)) focus_view->view->process_char(DCH_UP); - if(ImGui::IsKeyPressed(ITEM_ID_DOWN)) + if(ImGui::IsKeyPressed(ImGuiKey_DownArrow)) focus_view->view->process_char(DCH_DOWN); - if(ImGui::IsKeyPressed(ITEM_ID_LEFT)) + if(ImGui::IsKeyPressed(ImGuiKey_LeftArrow)) { - if(ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) focus_view->view->process_char(DCH_CTRLLEFT); else focus_view->view->process_char(DCH_LEFT); } - if(ImGui::IsKeyPressed(ITEM_ID_RIGHT)) + if(ImGui::IsKeyPressed(ImGuiKey_RightArrow)) { - if(ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) focus_view->view->process_char(DCH_CTRLRIGHT); else focus_view->view->process_char(DCH_RIGHT); } - if(ImGui::IsKeyPressed(ITEM_ID_PGUP)) + if(ImGui::IsKeyPressed(ImGuiKey_PageUp)) focus_view->view->process_char(DCH_PUP); - if(ImGui::IsKeyPressed(ITEM_ID_PGDN)) + if(ImGui::IsKeyPressed(ImGuiKey_PageDown)) focus_view->view->process_char(DCH_PDOWN); - if(ImGui::IsKeyPressed(ITEM_ID_HOME)) + if(ImGui::IsKeyPressed(ImGuiKey_Home)) { - if(ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) focus_view->view->process_char(DCH_CTRLHOME); else focus_view->view->process_char(DCH_HOME); } - if(ImGui::IsKeyPressed(ITEM_ID_END)) + if(ImGui::IsKeyPressed(ImGuiKey_End)) { - if(ImGui::IsKeyDown(ITEM_ID_LCONTROL)) + if(ImGui::IsKeyDown(ImGuiKey_LeftCtrl)) focus_view->view->process_char(DCH_CTRLEND); else focus_view->view->process_char(DCH_END); @@ -551,6 +553,8 @@ int debug_imgui::history_set(ImGuiInputTextCallbackData* data) if(history_pos < view_main_console->console_history.size()) history_pos++; break; + default: + break; } if(history_pos == view_main_console->console_history.size()) @@ -1464,26 +1468,39 @@ void debug_imgui::init_debugger(running_machine &machine) m_has_images = true; // map keys to ImGui inputs - io.KeyMap[ImGuiKey_A] = ITEM_ID_A; - io.KeyMap[ImGuiKey_C] = ITEM_ID_C; - io.KeyMap[ImGuiKey_V] = ITEM_ID_V; - io.KeyMap[ImGuiKey_X] = ITEM_ID_X; - io.KeyMap[ImGuiKey_C] = ITEM_ID_C; - io.KeyMap[ImGuiKey_Y] = ITEM_ID_Y; - io.KeyMap[ImGuiKey_Z] = ITEM_ID_Z; - io.KeyMap[ImGuiKey_Backspace] = ITEM_ID_BACKSPACE; - io.KeyMap[ImGuiKey_Delete] = ITEM_ID_DEL; - io.KeyMap[ImGuiKey_Tab] = ITEM_ID_TAB; - io.KeyMap[ImGuiKey_PageUp] = ITEM_ID_PGUP; - io.KeyMap[ImGuiKey_PageDown] = ITEM_ID_PGDN; - io.KeyMap[ImGuiKey_Home] = ITEM_ID_HOME; - io.KeyMap[ImGuiKey_End] = ITEM_ID_END; - io.KeyMap[ImGuiKey_Escape] = ITEM_ID_ESC; - io.KeyMap[ImGuiKey_Enter] = ITEM_ID_ENTER; - io.KeyMap[ImGuiKey_LeftArrow] = ITEM_ID_LEFT; - io.KeyMap[ImGuiKey_RightArrow] = ITEM_ID_RIGHT; - io.KeyMap[ImGuiKey_UpArrow] = ITEM_ID_UP; - io.KeyMap[ImGuiKey_DownArrow] = ITEM_ID_DOWN; + m_mapping[ITEM_ID_A] = ImGuiKey_A; + m_mapping[ITEM_ID_C] = ImGuiKey_C; + m_mapping[ITEM_ID_V] = ImGuiKey_V; + m_mapping[ITEM_ID_X] = ImGuiKey_X; + m_mapping[ITEM_ID_Y] = ImGuiKey_Y; + m_mapping[ITEM_ID_Z] = ImGuiKey_Z; + m_mapping[ITEM_ID_D] = ImGuiKey_D; + m_mapping[ITEM_ID_M] = ImGuiKey_M; + m_mapping[ITEM_ID_B] = ImGuiKey_B; + m_mapping[ITEM_ID_W] = ImGuiKey_W; + m_mapping[ITEM_ID_L] = ImGuiKey_L; + m_mapping[ITEM_ID_BACKSPACE] = ImGuiKey_Backspace; + m_mapping[ITEM_ID_DEL] = ImGuiKey_Delete; + m_mapping[ITEM_ID_TAB] = ImGuiKey_Tab; + m_mapping[ITEM_ID_PGUP] = ImGuiKey_PageUp; + m_mapping[ITEM_ID_PGDN] = ImGuiKey_PageDown; + m_mapping[ITEM_ID_HOME] = ImGuiKey_Home; + m_mapping[ITEM_ID_END] = ImGuiKey_End; + m_mapping[ITEM_ID_ESC] = ImGuiKey_Escape; + m_mapping[ITEM_ID_ENTER] = ImGuiKey_Enter; + m_mapping[ITEM_ID_LEFT] = ImGuiKey_LeftArrow; + m_mapping[ITEM_ID_RIGHT] = ImGuiKey_RightArrow; + m_mapping[ITEM_ID_UP] = ImGuiKey_UpArrow; + m_mapping[ITEM_ID_DOWN] = ImGuiKey_DownArrow; + m_mapping[ITEM_ID_F3] = ImGuiKey_F3; + m_mapping[ITEM_ID_F5] = ImGuiKey_F5; + m_mapping[ITEM_ID_F6] = ImGuiKey_F6; + m_mapping[ITEM_ID_F7] = ImGuiKey_F7; + m_mapping[ITEM_ID_F8] = ImGuiKey_F8; + m_mapping[ITEM_ID_F9] = ImGuiKey_F9; + m_mapping[ITEM_ID_F10] = ImGuiKey_F10; + m_mapping[ITEM_ID_F11] = ImGuiKey_F11; + m_mapping[ITEM_ID_F12] = ImGuiKey_F12; // set key delay and repeat rates io.KeyRepeatDelay = 0.400f; diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index 2ae3d9a3daf..3d5e3f6a482 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -181,8 +181,9 @@ bgfx_chain* chain_manager::load_chain(std::string name, uint32_t screen_index) int32_t size(bx::getSize(&reader)); + bx::ErrorAssert err; char* data = new char[size + 1]; - bx::read(&reader, reinterpret_cast<void*>(data), size); + bx::read(&reader, reinterpret_cast<void*>(data), size, &err); bx::close(&reader); data[size] = 0; diff --git a/src/osd/modules/render/bgfx/effectmanager.cpp b/src/osd/modules/render/bgfx/effectmanager.cpp index 33e056b45fe..ba86e00adf0 100644 --- a/src/osd/modules/render/bgfx/effectmanager.cpp +++ b/src/osd/modules/render/bgfx/effectmanager.cpp @@ -43,9 +43,10 @@ static bool prepare_effect_document(std::string &name, osd_options &options, rap return false; } + bx::ErrorAssert err; int32_t size (bx::getSize(&reader)); char* data = new char[size + 1]; - bx::read(&reader, reinterpret_cast<void*>(data), size); + bx::read(&reader, reinterpret_cast<void*>(data), size, &err); bx::close(&reader); data[size] = 0; diff --git a/src/osd/modules/render/bgfx/shadermanager.cpp b/src/osd/modules/render/bgfx/shadermanager.cpp index 11e298a4e7a..aafd704a30c 100644 --- a/src/osd/modules/render/bgfx/shadermanager.cpp +++ b/src/osd/modules/render/bgfx/shadermanager.cpp @@ -65,11 +65,12 @@ bool shader_manager::is_shader_present(osd_options &options, std::string name) std::string shader_path = make_path_string(options, name); std::string file_name = shader_path + name + ".bin"; bx::FileReader reader; + bx::ErrorAssert err; if (bx::open(&reader, file_name.c_str())) { uint32_t expected_size(bx::getSize(&reader)); uint8_t *data = new uint8_t[expected_size]; - uint32_t read_size = (uint32_t)bx::read(&reader, data, expected_size); + uint32_t read_size = (uint32_t)bx::read(&reader, data, expected_size, &err); delete [] data; bx::close(&reader); @@ -127,9 +128,10 @@ const bgfx::Memory* shader_manager::load_mem(std::string name) bx::FileReader reader; if (bx::open(&reader, name.c_str())) { + bx::ErrorAssert err; uint32_t size(bx::getSize(&reader)); const bgfx::Memory* mem = bgfx::alloc(size + 1); - bx::read(&reader, mem->data, size); + bx::read(&reader, mem->data, size, &err); bx::close(&reader); mem->data[mem->size - 1] = '\0'; |