Вопрос Config - Legendware

Начинающий
Статус
Оффлайн
Регистрация
15 Янв 2022
Сообщения
17
Реакции[?]
0
Поинты[?]
0
В общем, создаю я 2 конфига(Не важно сколько)
Инжекчу 1 конфиг, но лоадится всегда последний конфиг, не знаю в чём дело.
Помогите пожалуйста!

Код:
void open_config()
{
    std::string folder;

    auto get_dir = [&folder]() -> void
    {
        static TCHAR path[MAX_PATH];

        if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, NULL, path)))
            folder = std::string(path) + m_xor_str("\\my cheat\\");

        CreateDirectory(folder.c_str(), NULL);
    };

    get_dir();
    ShellExecute(NULL, m_xor_str("open"), folder.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
Код:
void load_config()
{
    if (cfg_manager->files.empty())
        return;

    cfg_manager->load(cfg_manager->files.at(g_cfg.selected_config), false);
    c_lua::get().unload_all_scripts();

    for (auto& script : g_cfg.scripts.scripts)
        c_lua::get().load_script(c_lua::get().get_script_id(script));

    scripts = c_lua::get().scripts;

    if (selected_script >= scripts.size())
        selected_script = scripts.size() - 1; //-V103

    for (auto& current : scripts)
    {
        if (current.size() >= 5 && current.at(current.size() - 1) == 'c')
            current.erase(current.size() - 5, 5);
        else if (current.size() >= 4)
            current.erase(current.size() - 4, 4);
    }

    for (auto i = 0; i < g_cfg.skins.skinChanger.size(); ++i)
        all_skins[i] = nullptr;

    g_cfg.scripts.scripts.clear();

    cfg_manager->load(cfg_manager->files.at(g_cfg.selected_config), true);
    cfg_manager->config_files();

    eventlogs::get().add(m_xor_str("Loaded ") + files.at(g_cfg.selected_config) + m_xor_str(" config"), false);
}
Код:
bool draw_config_button(const char* label, const char* label_id, bool load, bool save, int curr_config, bool create = false)
{
    bool pressed = false;
    ImGui::SetCursorPosX(8);
    if (ImGui::PlusButton(label, 0, ImVec2(274, 26), label_id, ImColor(77, 125, 253)))g_cfg.selected_config = curr_config;

    static char config_name[36] = "\0";
    ImGui::PushStyleVar(ImGuiStyleVar_::ImGuiStyleVar_PopupBorderSize, 0);
    ImGui::PushStyleVar(ImGuiStyleVar_::ImGuiStyleVar_PopupRounding, 4);
    ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(33 / 255.f, 33 / 255.f, 33 / 255.f, g_ctx.gui.pop_anim * 0.85f));
    if (ImGui::BeginPopup(label_id, ImGuiWindowFlags_NoMove))
    {

        ImGui::SetNextItemWidth((g_ctx.gui.pop_anim, 0.01f) * ImGui::GetFrameHeight() * 1.0f);
        ImGui::PushStyleVar(ImGuiStyleVar_Alpha, g_ctx.gui.pop_anim);
        auto clicked = false;
        bool one, ones, two, lo = false;
        if (!create) {
            if (LabelClick2(m_xor_str("Load"), &one, label_id))
            {
                load_config();
            }
            if (LabelClick2(m_xor_str("Save"), &two, label_id))
            {
                save_config();
            }
            if (LabelClick2(m_xor_str("Delete"), &ones, label_id))
            {
                remove_config();
            }
            if (LabelClick2(m_xor_str("Open config"), &lo, label_id))
            {
                open_config();
            }
        }
        else
        {
            ImGui::SetCursorPosX(8);
            ImGui::Text("Input new config name");
            ImGui::SetCursorPosX(8);
            ImGui::PushItemWidth(254);
            ImGui::InputText(m_xor_str("##configname"), config_name, sizeof(config_name));
            ImGui::PopItemWidth();

            ImGui::SetCursorPosX(8);
            auto new_label = std::string("Add " + std::string(config_name) + "");
            if (ImGui::CustomButton(new_label.c_str(), m_xor_str("##CONFIG__CREATE"), ImVec2(248, 26 * 1)))
            {
                g_cfg.new_config_name = config_name;
                add_config();
            }
        }
        ImGui::PopStyleVar();
        ImGui::EndPopup();
    }
    ImGui::PopStyleVar(2);    ImGui::PopStyleColor(1);
    return pressed;
}
 
(\ /) _ ($ __ $ ) _ (\ /)
Пользователь
Статус
Оффлайн
Регистрация
22 Окт 2021
Сообщения
361
Реакции[?]
92
Поинты[?]
24K
Ты бы еще скинуть код ButtonEx
Код:
bool draw_config_button(const char* label, const char* label_id, bool load, bool save, int curr_config, bool create = false)
{
    bool pressed = false;
    ImGui::SetCursorPosX(8);
    if (ImGui::PlusButton(label, 0, ImVec2(274, 26), label_id, ImColor(77, 125, 253)))g_cfg.selected_config = curr_config;

    static char config_name[36] = "\0";
    ImGui::PushStyleVar(ImGuiStyleVar_::ImGuiStyleVar_PopupBorderSize, 0);
    ImGui::PushStyleVar(ImGuiStyleVar_::ImGuiStyleVar_PopupRounding, 4);
    ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(33 / 255.f, 33 / 255.f, 33 / 255.f, g_ctx.gui.pop_anim * 0.85f));
    if (ImGui::BeginPopup(label_id, ImGuiWindowFlags_NoMove))
    {

        ImGui::SetNextItemWidth((g_ctx.gui.pop_anim, 0.01f) * ImGui::GetFrameHeight() * 1.0f);
        ImGui::PushStyleVar(ImGuiStyleVar_Alpha, g_ctx.gui.pop_anim);
        auto clicked = false;
        bool one, ones, two, lo = false;
        if (!create) {
            if (LabelClick2(m_xor_str("Load"), &one, label_id))
            {
                load_config();
            }
            if (LabelClick2(m_xor_str("Save"), &two, label_id))
            {
                save_config();
            }
            if (LabelClick2(m_xor_str("Delete"), &ones, label_id))
            {
                remove_config();
            }
            if (LabelClick2(m_xor_str("Open config"), &lo, label_id))
            {
                open_config();
            }
        }
        else
        {
            ImGui::SetCursorPosX(8);
            ImGui::Text("Input new config name");
            ImGui::SetCursorPosX(8);
            ImGui::PushItemWidth(254);
            ImGui::InputText(m_xor_str("##configname"), config_name, sizeof(config_name));
            ImGui::PopItemWidth();

            ImGui::SetCursorPosX(8);
            auto new_label = std::string("Add " + std::string(config_name) + "");
            if (ImGui::CustomButton(new_label.c_str(), m_xor_str("##CONFIG__CREATE"), ImVec2(248, 26 * 1)))
            {
                g_cfg.new_config_name = config_name;
                add_config();
            }
        }
        ImGui::PopStyleVar();
        ImGui::EndPopup();
    }
    ImGui::PopStyleVar(2);    ImGui::PopStyleColor(1);
    return pressed;
}
 
(\ /) _ ($ __ $ ) _ (\ /)
Пользователь
Статус
Оффлайн
Регистрация
22 Окт 2021
Сообщения
361
Реакции[?]
92
Поинты[?]
24K
Начинающий
Статус
Оффлайн
Регистрация
15 Янв 2022
Сообщения
17
Реакции[?]
0
Поинты[?]
0
get good get legendware
Участник
Статус
Оффлайн
Регистрация
22 Сен 2020
Сообщения
435
Реакции[?]
200
Поинты[?]
47K
load config function seems fine, the problem most likely is in the load button on the menu
 
Сверху Снизу