https://www.youtube.com/watch?v=2ds2p3mJtXc
-
Автор темы
- #1
Скрин дебага, краш происходит когда захожу в конфиги [code\
con:
void configs_tab()
{
static std::string szCurrentConfig = { };
ImGui::SetCursorPos(ImVec2(210, 120));
ImGui::MenuChild("Configs", ImVec2(320, 500));
{
ImGui::PushItemWidth(-1);
ImGui::ListBox(XorStr("##config.list"), &T::iSelectedConfig, [](int nIndex)
{
// return current displaying configuration name
return C::vecFileNames.at(nIndex).c_str();
}, C::vecFileNames.size(), 5);
szCurrentConfig = !C::vecFileNames.empty() ? C::vecFileNames.at(T::iSelectedConfig) : "";
if (ImGui::InputTextWithHint(XorStr("##config.file"), XorStr("create new..."), &T::szConfigFile, ImGuiInputTextFlags_EnterReturnsTrue))
{
if (!C::Save(T::szConfigFile))
{
L::PushConsoleColor(FOREGROUND_RED);
L::Print(XorStr("[error] failed to create \"{}\" config"), T::szConfigFile);
L::PopConsoleColor();
}
T::szConfigFile.clear();
C::Refresh();
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip(XorStr("press enter to create new configuration"));
if (ImGui::Button(XorStr("save"), ImVec2(-1, 15)))
{
if (!C::Save(szCurrentConfig))
{
L::PushConsoleColor(FOREGROUND_RED);
L::Print(XorStr("[error] failed to save \"{}\" config"), szCurrentConfig);
L::PopConsoleColor();
}
}
if (ImGui::Button(XorStr("load"), ImVec2(-1, 15)))
{
I::ClientState->full_update();
if (!C::Load(szCurrentConfig))
{
L::PushConsoleColor(FOREGROUND_RED);
L::Print(XorStr("[error] failed to load \"{}\" config"), szCurrentConfig);
L::PopConsoleColor();
}
}
if (ImGui::Button(XorStr("remove"), ImVec2(-1, 15)))
ImGui::OpenPopup(XorStr("confirmation##config.remove"));
if (ImGui::Button(XorStr("refresh"), ImVec2(-1, 15)))
C::Refresh();
ImGui::PopItemWidth();
}
if (ImGui::BeginPopupModal(XorStr("confirmation##config.remove"), nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize))
{
ImGui::Text(XorStr("are you sure you want to remove \"%s\" configuration?"), szCurrentConfig.c_str());
ImGui::Spacing();
if (ImGui::Button(XorStr("no"), ImVec2(30, 0)))
ImGui::CloseCurrentPopup();
ImGui::SameLine();
if (ImGui::Button(XorStr("yes"), ImVec2(30, 0)))
{
C::Remove(T::iSelectedConfig);
// reset current configuration
T::iSelectedConfig = 0;
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
ImGui::EndChild();
}