Skip to content

Commit

Permalink
fixed assert crash on Imgui library when using xbox controller
Browse files Browse the repository at this point in the history
  • Loading branch information
JulioJerez committed Dec 30, 2022
1 parent d66b062 commit d8fb1d9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions newton-4.00/thirdParty/imgui/imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,9 @@ ImGuiIO::ImGuiIO()
MouseDoubleClickTime = 0.30f;
MouseDoubleClickMaxDist = 6.0f;
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
for (int i = 0; i < ImGuiKey_COUNT; i++)
// newton dynamic modification: this chases on xbox controllers
//for (int i = 0; i < ImGuiKey_COUNT; i++)
for (int i = 0; i < ImGuiKey_COUNT-1; i++)
KeyMap[i] = -1;
#endif
KeyRepeatDelay = 0.275f;
Expand Down Expand Up @@ -7979,7 +7981,9 @@ static void ImGui::ErrorCheckNewFrameSanityChecks()
IM_ASSERT(g.Style.WindowMenuButtonPosition == ImGuiDir_None || g.Style.WindowMenuButtonPosition == ImGuiDir_Left || g.Style.WindowMenuButtonPosition == ImGuiDir_Right);
IM_ASSERT(g.Style.ColorButtonPosition == ImGuiDir_Left || g.Style.ColorButtonPosition == ImGuiDir_Right);
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_COUNT; n++)
// newton dynamic modification, this chases on xbox controllers
//for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_COUNT; n++)
for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_COUNT - 1; n++)
IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < ImGuiKey_LegacyNativeKey_END && "io.KeyMap[] contains an out of bound value (need to be 0..511, or -1 for unmapped key)");

// Check: required key mapping (we intentionally do NOT check all keys to not pressure user into setting up everything, but Space is required and was only added in 1.60 WIP)
Expand Down

0 comments on commit d8fb1d9

Please sign in to comment.