diff --git a/BigBaseV2/src/gui/gui_main.cpp b/BigBaseV2/src/gui/gui_main.cpp index 7a9ef047..c3d3ff01 100644 --- a/BigBaseV2/src/gui/gui_main.cpp +++ b/BigBaseV2/src/gui/gui_main.cpp @@ -9,6 +9,8 @@ namespace big window::log(); + window::debug(); + window::main(); window::handling(); diff --git a/BigBaseV2/src/gui/window.hpp b/BigBaseV2/src/gui/window.hpp index 869752f5..a7abfd40 100644 --- a/BigBaseV2/src/gui/window.hpp +++ b/BigBaseV2/src/gui/window.hpp @@ -4,6 +4,7 @@ namespace big { class window { public: + static void debug(); static void top_bar(); static void handling(); static void log(); diff --git a/BigBaseV2/src/gui/window/dbg/debug_debug.cpp b/BigBaseV2/src/gui/window/dbg/debug_debug.cpp new file mode 100644 index 00000000..82fcb71c --- /dev/null +++ b/BigBaseV2/src/gui/window/dbg/debug_debug.cpp @@ -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(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/window/dbg/debug_globals.cpp b/BigBaseV2/src/gui/window/dbg/debug_globals.cpp new file mode 100644 index 00000000..866b59ef --- /dev/null +++ b/BigBaseV2/src/gui/window/dbg/debug_globals.cpp @@ -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(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/window/dbg/debug_script_events.cpp b/BigBaseV2/src/gui/window/dbg/debug_script_events.cpp new file mode 100644 index 00000000..c94a0137 --- /dev/null +++ b/BigBaseV2/src/gui/window/dbg/debug_script_events.cpp @@ -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(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/window/dbg/debug_tabs.hpp b/BigBaseV2/src/gui/window/dbg/debug_tabs.hpp new file mode 100644 index 00000000..344d3743 --- /dev/null +++ b/BigBaseV2/src/gui/window/dbg/debug_tabs.hpp @@ -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(); + }; +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/window/window_debug.cpp b/BigBaseV2/src/gui/window/window_debug.cpp new file mode 100644 index 00000000..cd3c028c --- /dev/null +++ b/BigBaseV2/src/gui/window/window_debug.cpp @@ -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(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/window/window_top_bar.cpp b/BigBaseV2/src/gui/window/window_top_bar.cpp index e035611b..7365aeb4 100644 --- a/BigBaseV2/src/gui/window/window_top_bar.cpp +++ b/BigBaseV2/src/gui/window/window_top_bar.cpp @@ -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(); }