mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-07-01 12:02:55 +08:00
feat: Translation Service (#844)
Co-authored-by: mrwoowoo <github@hiqaq.com> Co-authored-by: LiamD-Flop <40887493+LiamD-Flop@users.noreply.github.com>
This commit is contained in:
@ -8,7 +8,7 @@ namespace big
|
||||
if (strcmp(g_gui_service->get_selected()->name, "Debug"))
|
||||
return;
|
||||
|
||||
if (ImGui::Begin("Debug"))
|
||||
if (ImGui::Begin("DEBUG_WINDOW"_T.data()))
|
||||
{
|
||||
ImGui::BeginTabBar("debug_tabbar");
|
||||
misc();
|
||||
@ -16,6 +16,7 @@ namespace big
|
||||
globals();
|
||||
locals();
|
||||
script_events();
|
||||
scripts();
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
ImGui::End();
|
||||
|
@ -7,6 +7,7 @@ namespace big::debug
|
||||
extern void logs();
|
||||
extern void misc();
|
||||
extern void script_events();
|
||||
extern void scripts();
|
||||
|
||||
extern void main();
|
||||
}
|
@ -7,25 +7,25 @@ namespace big
|
||||
{
|
||||
void debug::globals()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Globals"))
|
||||
if (ImGui::BeginTabItem("DEBUG_TAB_GLOBALS"_T.data()))
|
||||
{
|
||||
if (ImGui::Checkbox("Enable Freezing", &g_globals_service->m_running) && g_globals_service->m_running)
|
||||
if (ImGui::Checkbox("DEBUG_GLOBALS_ENABLE_FREEZING"_T.data(), &g_globals_service->m_running) && g_globals_service->m_running)
|
||||
g_thread_pool->push([&]() { g_globals_service->loop(); });
|
||||
|
||||
if (components::button("Load"))
|
||||
if (components::button("LOAD"_T))
|
||||
g_globals_service->load();
|
||||
ImGui::SameLine();
|
||||
if (components::button("Save"))
|
||||
if (components::button("SAVE"_T))
|
||||
g_globals_service->save();
|
||||
|
||||
|
||||
ImGui::SameLine();
|
||||
if (components::button("Add Global"))
|
||||
if (components::button("DEBUG_GLOBALS_ADD"_T))
|
||||
{
|
||||
ImGui::OpenPopup("New Global");
|
||||
ImGui::OpenPopup("DEBUG_GLOBALS_NEW"_T.data());
|
||||
}
|
||||
|
||||
if (ImGui::BeginPopupModal("New Global"))
|
||||
if (ImGui::BeginPopupModal("DEBUG_GLOBALS_NEW"_T.data()))
|
||||
{
|
||||
static int base_address = 0;
|
||||
static bool freeze = false;
|
||||
@ -34,13 +34,13 @@ namespace big
|
||||
static int offset_count = 0;
|
||||
static int previous_offset_count = 0;
|
||||
|
||||
ImGui::Text("Name:");
|
||||
ImGui::Text("DEBUG_GLOBALS_NAME"_T.data());
|
||||
components::input_text_with_hint("##global_name", "Name", name, sizeof(name));
|
||||
ImGui::Text("Base Address:");
|
||||
ImGui::Text("DEBUG_GLOBALS_BASE_ADDRESS"_T.data());
|
||||
ImGui::InputInt("##modal_global_base_addr", &base_address);
|
||||
ImGui::Text("Freeze:");
|
||||
ImGui::Text("DEBUG_GLOBAL_FREEZE"_T.data());
|
||||
ImGui::Checkbox("##modal_global_freeze", &freeze);
|
||||
ImGui::Text("Number of Offsets:");
|
||||
ImGui::Text("DEBUG_GLOBAL_OFFSET_COUNT"_T.data());
|
||||
ImGui::InputInt("##modal_offset_count", &offset_count);
|
||||
|
||||
if (offset_count < 0) offset_count = 0;
|
||||
@ -64,10 +64,10 @@ namespace big
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Offset: %d", i + 1);
|
||||
ImGui::Text("DEBUG_GLOBAL_OFFSET"_T.data(), i + 1);
|
||||
ImGui::InputInt("##offset", &offsets[i][0]);
|
||||
|
||||
ImGui::Text("Size:");
|
||||
ImGui::Text("DEBUG_GLOBAL_SIZE"_T.data());
|
||||
ImGui::SameLine();
|
||||
ImGui::InputInt("##size", &offsets[i][1]);
|
||||
|
||||
@ -75,7 +75,7 @@ namespace big
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
if (components::button("Cancel"))
|
||||
if (components::button("CANCEL"_T))
|
||||
{
|
||||
strcpy(name, "");
|
||||
freeze = false;
|
||||
@ -87,7 +87,7 @@ namespace big
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (components::button("Save"))
|
||||
if (components::button("SAVE"_T))
|
||||
{
|
||||
auto new_global = global(name, base_address, freeze, offsets, offset_count);
|
||||
new_global.build_cache();
|
||||
@ -114,12 +114,12 @@ namespace big
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::PushID(global.get_id());
|
||||
ImGui::Checkbox("Freeze", &global.m_freeze);
|
||||
ImGui::Checkbox("DEBUG_GLOBAL_FREEZE_TOGGLE"_T.data(), &global.m_freeze);
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Text("Name:");
|
||||
ImGui::Text("Value:");
|
||||
ImGui::Text("DEBUG_GLOBALS_NAME"_T.data());
|
||||
ImGui::Text("DEBUG_GLOBALS_VALUE"_T.data());
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
@ -139,7 +139,7 @@ namespace big
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
if (components::button("Delete"))
|
||||
if (components::button("DELETE"_T))
|
||||
{
|
||||
for (int i = 0; i < g_globals_service->m_globals.size(); i++)
|
||||
if (auto& it = g_globals_service->m_globals.at(i); it.get_id() == global.get_id())
|
||||
@ -148,7 +148,7 @@ namespace big
|
||||
break;
|
||||
}
|
||||
|
||||
if (components::button("Write"))
|
||||
if (components::button("WRITE"_T))
|
||||
global.write();
|
||||
|
||||
ImGui::PopID();
|
||||
|
@ -4,7 +4,7 @@ namespace big
|
||||
{
|
||||
void debug::locals()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Locals"))
|
||||
if (ImGui::BeginTabItem("DEBUG_TAB_LOCALS"_T.data()))
|
||||
{
|
||||
|
||||
ImGui::EndTabItem();
|
||||
|
@ -13,7 +13,7 @@ namespace big
|
||||
{
|
||||
void debug::misc()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Misc"))
|
||||
if (ImGui::BeginTabItem("DEBUG_TAB_MISC"_T.data()))
|
||||
{
|
||||
if (components::button("Dump entrypoints"))
|
||||
{
|
||||
@ -25,7 +25,7 @@ namespace big
|
||||
NETWORK::NETWORK_BAIL(16, 0, 0);
|
||||
});
|
||||
|
||||
components::button("Remove from Bad Sport", []
|
||||
components::button("DEBUG_REMOVE_FROM_BAD_SPORT"_T, []
|
||||
{
|
||||
STATS::STAT_SET_FLOAT(RAGE_JOAAT("mpply_overall_badsport"), 0.0f, TRUE);
|
||||
STATS::STAT_SET_BOOL(RAGE_JOAAT("mpply_was_i_bad_sport"), FALSE, TRUE);
|
||||
|
@ -6,7 +6,7 @@ namespace big
|
||||
{
|
||||
void debug::script_events()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Script Events"))
|
||||
if (ImGui::BeginTabItem("DEBUG_TAB_SCRIPT_EVENTS"_T.data()))
|
||||
{
|
||||
static int64_t* args;
|
||||
static int event_arg_count = 3;
|
||||
@ -14,7 +14,7 @@ namespace big
|
||||
static int event_player_bits;
|
||||
static bool event_everyone = false;
|
||||
|
||||
ImGui::Text("Script Argument Count:");
|
||||
ImGui::Text("DEBUG_SCRIPT_EVENT_ARG_COUNT"_T.data());
|
||||
ImGui::InputInt("###script_event_arg_count", &event_arg_count);
|
||||
if (event_arg_count > 32)
|
||||
event_arg_count = 32;
|
||||
@ -37,7 +37,7 @@ namespace big
|
||||
for (int i = 0; i < event_arg_count; i++)
|
||||
{
|
||||
ImGui::PushID(i);
|
||||
ImGui::Text("Arg[%d]", i);
|
||||
ImGui::Text("DEBUG_SCRIPT_EVENT_ARG"_T.data(), i);
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::InputScalar("###input_dynamic_arg", ImGuiDataType_S64, &args[i]);
|
||||
@ -47,14 +47,14 @@ namespace big
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Send to everyone", &event_everyone);
|
||||
ImGui::Checkbox("DEBUG_SCRIPT_EVENT_EVERYONE"_T.data(), &event_everyone);
|
||||
if (!event_everyone)
|
||||
{
|
||||
ImGui::Text("Player ID:");
|
||||
ImGui::Text("DEBUG_SCRIPT_EVENT_PLAYER_ID"_T.data());
|
||||
ImGui::InputInt("###player_bits", &event_player_bits);
|
||||
}
|
||||
|
||||
components::button("Send Event", []
|
||||
components::button("DEBUG_SCRIPT_EVENT_SEND_EVENT"_T, []
|
||||
{
|
||||
args[1] = self::id; // prevent detection from AC
|
||||
g_pointers->m_trigger_script_event(1, args, event_arg_count, event_everyone ? -1 : 1 << event_player_bits);
|
||||
|
26
src/views/debug/view_debug_scripts.cpp
Normal file
26
src/views/debug/view_debug_scripts.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "view_debug.hpp"
|
||||
#include "gui/components/components.hpp"
|
||||
#include "script_mgr.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void debug::scripts()
|
||||
{
|
||||
if (ImGui::BeginTabItem("DEBUG_TAB_SCRIPTS"_T.data()))
|
||||
{
|
||||
components::sub_title("DEBUG_SCRIPTS_SUB_TITLE"_T);
|
||||
|
||||
for (const auto& script : g_script_mgr.scripts())
|
||||
{
|
||||
if (script->is_toggleable())
|
||||
{
|
||||
if (ImGui::Checkbox(script->name(), script->toggle_ptr()))
|
||||
{
|
||||
g_notification_service->push(std::string(script->name()).append(" script"), script->is_enabled() ? "Resumed" : "Halted");
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
@ -6,18 +6,18 @@ namespace big
|
||||
{
|
||||
void debug::logs()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Logs"))
|
||||
if (ImGui::BeginTabItem("DEBUG_TABS_LOGS"_T.data()))
|
||||
{
|
||||
ImGui::Checkbox("Log Metrics", &g.debug.logs.metric_logs);
|
||||
ImGui::Checkbox("Log Packets", &g.debug.logs.packet_logs);
|
||||
ImGui::Checkbox("Native Script Hooks", &g.debug.logs.script_hook_logs);
|
||||
ImGui::Checkbox("DEBUG_LOG_METRICS"_T.data(), &g.debug.logs.metric_logs);
|
||||
ImGui::Checkbox("Log Packets", &g.debug.logs.packet_logs); // TODO: translate
|
||||
ImGui::Checkbox("DEBUG_LOG_NATIVE_SCRIPT_HOOKS"_T.data(), &g.debug.logs.script_hook_logs);
|
||||
|
||||
if (ImGui::TreeNode("Script Event Logging"))
|
||||
if (ImGui::TreeNode("DEBUG_LOG_TREE_SCRIPT_EVENT"_T.data()))
|
||||
{
|
||||
ImGui::Checkbox("Enable Script Event Logging", &g.debug.logs.script_event.logs);
|
||||
ImGui::Checkbox("DEBUG_LOG_SCRIPT_EVENT"_T.data(), &g.debug.logs.script_event.logs);
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Filter by Player", &g.debug.logs.script_event.filter_player);
|
||||
ImGui::Checkbox("DEBUG_LOG_SCRIPT_EVENT_FILTER_BY_PLAYER"_T.data(), &g.debug.logs.script_event.filter_player);
|
||||
|
||||
if (g.debug.logs.script_event.filter_player)
|
||||
{
|
||||
|
Reference in New Issue
Block a user