mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-07 18:03:34 +08:00
feat(GUI): Added debug window
This commit is contained in:
parent
28773c63b1
commit
0856f3eab5
@ -9,6 +9,8 @@ namespace big
|
||||
|
||||
window::log();
|
||||
|
||||
window::debug();
|
||||
|
||||
window::main();
|
||||
window::handling();
|
||||
|
||||
|
@ -4,6 +4,7 @@ namespace big
|
||||
{
|
||||
class window {
|
||||
public:
|
||||
static void debug();
|
||||
static void top_bar();
|
||||
static void handling();
|
||||
static void log();
|
||||
|
18
BigBaseV2/src/gui/window/dbg/debug_debug.cpp
Normal file
18
BigBaseV2/src/gui/window/dbg/debug_debug.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "debug_tabs.hpp"
|
||||
#include "util/system.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void tab_debug::_tab_debug()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Debug"))
|
||||
{
|
||||
if (ImGui::Button("Dump entrypoints"))
|
||||
{
|
||||
system::dump_entry_points();
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
14
BigBaseV2/src/gui/window/dbg/debug_globals.cpp
Normal file
14
BigBaseV2/src/gui/window/dbg/debug_globals.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "debug_tabs.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void tab_debug::tab_globals()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Globals"))
|
||||
{
|
||||
ImGui::Text("Coming soon...");
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
68
BigBaseV2/src/gui/window/dbg/debug_script_events.cpp
Normal file
68
BigBaseV2/src/gui/window/dbg/debug_script_events.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include "debug_tabs.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "script.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void tab_debug::tab_script_events()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Script Events"))
|
||||
{
|
||||
static int* args;
|
||||
static int event_arg_count = 1;
|
||||
static int previous_arg_count;
|
||||
static int event_player_bits;
|
||||
static bool event_everyone = false;
|
||||
|
||||
ImGui::Text("Script Argument Count:");
|
||||
ImGui::InputInt("###script_event_arg_count", &event_arg_count);
|
||||
if (event_arg_count > 32)
|
||||
event_arg_count = 32;
|
||||
else if (event_arg_count < 1)
|
||||
event_arg_count = 1;
|
||||
|
||||
if (event_arg_count != previous_arg_count)
|
||||
{
|
||||
int* temp_args = new int[event_arg_count] {0};
|
||||
memcpy(temp_args, args, sizeof(int) * std::min(event_arg_count, previous_arg_count));
|
||||
|
||||
delete[] args;
|
||||
args = temp_args;
|
||||
|
||||
previous_arg_count = event_arg_count;
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
for (int i = 0; i < event_arg_count; i++)
|
||||
{
|
||||
ImGui::Text("Arg[%d]", i);
|
||||
ImGui::SameLine();
|
||||
|
||||
char input_arg_name[20];
|
||||
sprintf(input_arg_name, "###input_dynamic_arg_%d", i);
|
||||
ImGui::InputInt(input_arg_name, &args[i]);
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Send to everyone", &event_everyone);
|
||||
if (!event_everyone)
|
||||
{
|
||||
ImGui::Text("Player ID:");
|
||||
ImGui::InputInt("###player_bits", &event_player_bits);
|
||||
}
|
||||
|
||||
if (ImGui::Button("Send Event"))
|
||||
{
|
||||
QUEUE_JOB_BEGIN_CLAUSE()
|
||||
{
|
||||
g_pointers->m_trigger_script_event(1, args, event_arg_count, event_everyone ? -1 : 1 << event_player_bits);
|
||||
}QUEUE_JOB_END_CLAUSE
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
13
BigBaseV2/src/gui/window/dbg/debug_tabs.hpp
Normal file
13
BigBaseV2/src/gui/window/dbg/debug_tabs.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "common.hpp"
|
||||
#include "imgui.h"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class tab_debug {
|
||||
public:
|
||||
static void tab_globals();
|
||||
static void tab_script_events();
|
||||
static void _tab_debug();
|
||||
};
|
||||
}
|
19
BigBaseV2/src/gui/window/window_debug.cpp
Normal file
19
BigBaseV2/src/gui/window/window_debug.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "gui/window.hpp"
|
||||
#include "dbg/debug_tabs.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void window::debug()
|
||||
{
|
||||
if (g.window.debug && ImGui::Begin("Dev"))
|
||||
{
|
||||
ImGui::BeginTabBar("dev_tabbar");
|
||||
tab_debug::_tab_debug();
|
||||
tab_debug::tab_globals();
|
||||
tab_debug::tab_script_events();
|
||||
ImGui::EndTabBar();
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
}
|
@ -54,6 +54,7 @@ namespace big
|
||||
ImGui::MenuItem("Main", nullptr, &g.window.main);
|
||||
ImGui::MenuItem("Players", nullptr, &g.window.users);
|
||||
ImGui::MenuItem("Logs", nullptr, &g.window.log);
|
||||
ImGui::MenuItem("Debug", nullptr, &g.window.debug);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user