Upstream is dealing with this here : https://github.com/dolphin-emu/dolphin/pull/12065
Please find a minimal patch in attachement. On Fri, 14 Jul 2023 20:09:01 +0300 Adrian Bunk <b...@debian.org> wrote: > Source: dolphin-emu > Version: 5.0-19368+dfsg-2 > Severity: serious > Tags: ftbfs > > https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/dolphin-emu.html > > ... > In file included from /build/1st/dolphin-emu-5.0- 19368+dfsg/Externals/implot/implot/implot_internal.h:39, > from /build/1st/dolphin-emu-5.0- 19368+dfsg/Externals/implot/implot/implot_items.cpp:26: > /usr/include/imgui/imgui_internal.h:101:2: error: #error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h! > 101 | #error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h! > | ^~~~~ > In file included from /build/1st/dolphin-emu-5.0- 19368+dfsg/Externals/implot/implot/implot_internal.h:39, > from /build/1st/dolphin-emu-5.0- 19368+dfsg/Externals/implot/implot/implot.cpp:126: > /usr/include/imgui/imgui_internal.h:101:2: error: #error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h! > 101 | #error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h! > | ^~~~~ > ... > >
--- a/Externals/implot/implot/implot.cpp +++ b/Externals/implot/implot/implot.cpp @@ -122,6 +122,7 @@ */ +#define IMGUI_DEFINE_MATH_OPERATORS #include "implot.h" #include "implot_internal.h" --- a/Externals/implot/implot/implot_internal.h +++ b/Externals/implot/implot/implot_internal.h @@ -31,10 +31,6 @@ #pragma once -#ifndef IMGUI_DEFINE_MATH_OPERATORS -#define IMGUI_DEFINE_MATH_OPERATORS -#endif - #include <time.h> #include "imgui_internal.h" --- a/Externals/implot/implot/implot_items.cpp +++ b/Externals/implot/implot/implot_items.cpp @@ -22,6 +22,7 @@ // ImPlot v0.14 +#define IMGUI_DEFINE_MATH_OPERATORS #include "implot.h" #include "implot_internal.h" --- a/Source/Core/VideoCommon/OnScreenUI.cpp +++ b/Source/Core/VideoCommon/OnScreenUI.cpp @@ -356,35 +356,37 @@ } void OnScreenUI::SetKeyMap(const DolphinKeyMap& key_map) { - // Right now this is a 1:1 mapping. But might not be true later static constexpr DolphinKeyMap dolphin_to_imgui_map = { ImGuiKey_Tab, ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow, ImGuiKey_PageUp, ImGuiKey_PageDown, ImGuiKey_Home, ImGuiKey_End, ImGuiKey_Insert, ImGuiKey_Delete, ImGuiKey_Backspace, - ImGuiKey_Space, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_KeyPadEnter, + ImGuiKey_Space, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_KeypadEnter, ImGuiKey_A, ImGuiKey_C, ImGuiKey_V, ImGuiKey_X, ImGuiKey_Y, ImGuiKey_Z, }; - static_assert(dolphin_to_imgui_map.size() == ImGuiKey_COUNT); // Fail if ImGui adds keys auto lock = GetImGuiLock(); if (!ImGui::GetCurrentContext()) return; + m_dolphin_to_imgui_map.clear(); for (int dolphin_key = 0; dolphin_key <= static_cast<int>(DolphinKey::Z); dolphin_key++) { - int imgui_key = dolphin_to_imgui_map[DolphinKey(dolphin_key)]; + const int imgui_key = dolphin_to_imgui_map[DolphinKey(dolphin_key)]; if (imgui_key >= 0) - ImGui::GetIO().KeyMap[imgui_key] = (key_map[DolphinKey(dolphin_key)] & 0x1FF); + { + const int mapped_key = key_map[DolphinKey(dolphin_key)]; + m_dolphin_to_imgui_map[mapped_key & 0x1FF] = imgui_key; + } } } void OnScreenUI::SetKey(u32 key, bool is_down, const char* chars) { auto lock = GetImGuiLock(); - if (key < std::size(ImGui::GetIO().KeysDown)) - ImGui::GetIO().KeysDown[key] = is_down; + if (auto iter = m_dolphin_to_imgui_map.find(key); iter != m_dolphin_to_imgui_map.end()) + ImGui::GetIO().AddKeyEvent((ImGuiKey)iter->second, is_down); if (chars) ImGui::GetIO().AddInputCharactersUTF8(chars); --- a/Source/Core/VideoCommon/OnScreenUI.h +++ b/Source/Core/VideoCommon/OnScreenUI.h @@ -3,6 +3,7 @@ #pragma once +#include <map> #include <memory> #include <mutex> #include <span> @@ -65,6 +66,7 @@ std::unique_ptr<NativeVertexFormat> m_imgui_vertex_format; std::vector<std::unique_ptr<AbstractTexture>> m_imgui_textures; std::unique_ptr<AbstractPipeline> m_imgui_pipeline; + std::map<u32, int> m_dolphin_to_imgui_map; std::mutex m_imgui_mutex; u64 m_imgui_last_frame_time = 0;