Add more spoofing options and added clang-format (#1020)

* feat(Spoofing): add spoofing
* feat(Spoofing): prepare code for player attach
* remove(PlayerAttach): isn't going to work due to netsync architecture
* fix(GUI): fix scaling
* feat(Project): add clang-format file
* feat(Classes): update classes
* fix(BlackHole): remove unnecessary cleanup
* fix(Formatting): fix formatting for initializer lists
* feat(clang-format): Set tab width and 1 space before comment

Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
This commit is contained in:
maybegreat48
2023-03-01 21:27:15 +00:00
committed by GitHub
parent 92aea20cd6
commit 97a8c5d60b
466 changed files with 55224 additions and 35596 deletions

View File

@ -1,6 +1,7 @@
#include "services/gui/gui_service.hpp"
#include "view_debug.hpp"
#include "services/gui/gui_service.hpp"
namespace big
{
void debug::main()

View File

@ -9,8 +9,11 @@ namespace big
{
if (ImGui::BeginTabItem("DEBUG_TAB_GLOBALS"_T.data()))
{
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 (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"_T))
g_globals_service->load();
@ -27,11 +30,11 @@ namespace big
if (ImGui::BeginPopupModal("DEBUG_GLOBALS_NEW"_T.data()))
{
static int base_address = 0;
static bool freeze = false;
static char name[32] = "";
static int(*offsets)[2] = nullptr;
static int offset_count = 0;
static int base_address = 0;
static bool freeze = false;
static char name[32] = "";
static int(*offsets)[2] = nullptr;
static int offset_count = 0;
static int previous_offset_count = 0;
ImGui::Text("DEBUG_GLOBALS_NAME"_T.data());
@ -43,12 +46,14 @@ namespace big
ImGui::Text("DEBUG_GLOBAL_OFFSET_COUNT"_T.data());
ImGui::InputInt("##modal_offset_count", &offset_count);
if (offset_count < 0) offset_count = 0;
else if (offset_count > 10) offset_count = 10;
if (offset_count < 0)
offset_count = 0;
else if (offset_count > 10)
offset_count = 10;
if (offset_count != previous_offset_count)
{
int(*new_offsets)[2] = new int[offset_count][2]{ 0 };
int(*new_offsets)[2] = new int[offset_count][2]{0};
memcpy(new_offsets, offsets, sizeof(int) * std::min(offset_count, previous_offset_count) * 2);
delete[] offsets;
@ -80,8 +85,8 @@ namespace big
strcpy(name, "");
freeze = false;
delete[] offsets;
offsets = nullptr;
offset_count = 0;
offsets = nullptr;
offset_count = 0;
previous_offset_count = 0;
ImGui::CloseCurrentPopup();
@ -97,8 +102,8 @@ namespace big
strcpy(name, "");
freeze = false;
delete[] offsets;
offsets = nullptr;
offset_count = 0;
offsets = nullptr;
offset_count = 0;
previous_offset_count = 0;
ImGui::CloseCurrentPopup();

View File

@ -6,7 +6,6 @@ namespace big
{
if (ImGui::BeginTabItem("DEBUG_TAB_LOCALS"_T.data()))
{
ImGui::EndTabItem();
}
}

View File

@ -1,13 +1,13 @@
#include "gta/joaat.hpp"
#include "gta_util.hpp"
#include "gui/components/components.hpp"
#include "natives.hpp"
#include "util/system.hpp"
#include "util/misc.hpp"
#include "view_debug.hpp"
#include "network/Network.hpp"
#include "script.hpp"
#include "gta/joaat.hpp"
#include "script_global.hpp"
#include "gta_util.hpp"
#include "util/misc.hpp"
#include "util/system.hpp"
#include "view_debug.hpp"
namespace big
{
@ -18,7 +18,7 @@ namespace big
if (components::button("MOV QWORD"))
{
*static_cast<uint64_t*>(nullptr) = 0;
uint64_t i = *static_cast<uint64_t*>(nullptr);
uint64_t i = *static_cast<uint64_t*>(nullptr);
}
if (components::button("MOV 0xdead"))
@ -31,39 +31,39 @@ namespace big
system::dump_entry_points();
}
components::button("Network Bail", []
{
components::button("Network Bail", [] {
NETWORK::NETWORK_BAIL(16, 0, 0);
});
components::button("DEBUG_REMOVE_FROM_BAD_SPORT"_T, []
{
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);
});
components::button("Load MP Map", [] { DLC::ON_ENTER_MP(); });
components::button("Load MP Map", [] {
DLC::ON_ENTER_MP();
});
ImGui::SameLine();
components::button("Load SP Map", [] { DLC::ON_ENTER_SP(); });
components::button("Skip Cutscene", [] { CUTSCENE::STOP_CUTSCENE_IMMEDIATELY(); });
components::button("Load SP Map", [] {
DLC::ON_ENTER_SP();
});
components::button("Refresh Interior", []\
{
components::button("Skip Cutscene", [] {
CUTSCENE::STOP_CUTSCENE_IMMEDIATELY();
});
components::button("Refresh Interior", [] {
Interior interior = INTERIOR::GET_INTERIOR_AT_COORDS(self::pos.x, self::pos.y, self::pos.z);
INTERIOR::REFRESH_INTERIOR(interior);
});
if (ImGui::IsItemHovered())
ImGui::SetTooltip("You Will Have To Refresh Again When Exiting Interior.\n SPAMMING WILL CRASH GAME");
components::button("Network Shutdown And Launch Single Player Game", []\
{
components::button("Network Shutdown And Launch Single Player Game", [] {
NETWORK::SHUTDOWN_AND_LAUNCH_SINGLE_PLAYER_GAME();
});
components::button("Network Shutdown And Load Most Recent Save", []\
{
components::button("Network Shutdown And Load Most Recent Save", [] {
NETWORK::SHUTDOWN_AND_LOAD_MOST_RECENT_SAVE();
});

View File

@ -23,7 +23,7 @@ namespace big
if (event_arg_count != previous_arg_count)
{
int64_t* temp_args = new int64_t[event_arg_count]{ 0 };
int64_t* temp_args = new int64_t[event_arg_count]{0};
memcpy(temp_args, args, sizeof(int64_t) * std::min(event_arg_count, previous_arg_count));
delete[] args;
@ -54,9 +54,8 @@ namespace big
ImGui::InputInt("###player_bits", &event_player_bits);
}
components::button("DEBUG_SCRIPT_EVENT_SEND_EVENT"_T, []
{
args[1] = self::id; // prevent detection from AC
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);
});

View File

@ -1,6 +1,6 @@
#include "view_debug.hpp"
#include "gui/components/components.hpp"
#include "script_mgr.hpp"
#include "view_debug.hpp"
namespace big
{
@ -8,18 +8,18 @@ namespace big
{
if (ImGui::BeginTabItem("DEBUG_TAB_SCRIPTS"_T.data()))
{
components::sub_title("DEBUG_SCRIPTS_SUB_TITLE"_T);
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");
}
}
}
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();
}
}

View File

@ -1,25 +1,23 @@
#include "gui/components/components.hpp"
#include "natives.hpp"
#include "util/system.hpp"
#include "util/misc.hpp"
#include "view_debug.hpp"
#include "network/Network.hpp"
#include "script.hpp"
#include "gta/joaat.hpp"
#include "script_global.hpp"
#include "gta_util.hpp"
#include "core/data/all_script_names.hpp"
#include "core/data/stack_sizes.hpp"
#include "fiber_pool.hpp"
#include "gta/joaat.hpp"
#include "gta_util.hpp"
#include "gui/components/components.hpp"
#include "natives.hpp"
#include "network/Network.hpp"
#include "script.hpp"
#include "script_global.hpp"
#include "util/misc.hpp"
#include "util/system.hpp"
#include "view_debug.hpp"
static rage::scrThread* selected_thread;
static int selected_stack_size = 128;
static int free_stacks = -1;
static int selected_stack_size = 128;
static int free_stacks = -1;
static const char* selected_stack_size_str = "MULTIPLAYER_MISSION";
static const char* selected_script = "<SELECT>";
static const char* selected_script = "<SELECT>";
static std::chrono::high_resolution_clock::time_point last_stack_update_time{};
@ -82,7 +80,9 @@ namespace big
{
ImGui::Combo("State", (int*)&selected_thread->m_context.m_state, "RUNNING\0WAITING\0KILLED\0PAUSED\0STATE_4");
ImGui::Text("Stack Pointer / Stack Size %d/%d", selected_thread->m_context.m_stack_pointer, selected_thread->m_context.m_stack_size);
ImGui::Text("Stack Pointer / Stack Size %d/%d",
selected_thread->m_context.m_stack_pointer,
selected_thread->m_context.m_stack_size);
ImGui::Text("IP: %X", selected_thread->m_context.m_instruction_pointer);
if (selected_thread->m_context.m_state == rage::eThreadState::killed)
ImGui::Text("Exit Reason: %s", selected_thread->m_exit_message);
@ -105,7 +105,6 @@ namespace big
if (ImGui::Selectable(script, script == selected_script))
{
selected_script = script;
}
if (script == selected_script)
@ -121,10 +120,9 @@ namespace big
if (ImGui::Selectable(std::format("{} ({})", p.first, p.second).data(), selected_stack_size == p.second))
{
selected_stack_size_str = p.first;
selected_stack_size = p.second;
selected_stack_size = p.second;
g_fiber_pool->queue_job([]
{
g_fiber_pool->queue_job([] {
update_free_stacks_count();
});
}
@ -137,8 +135,7 @@ namespace big
ImGui::Text("Free Stacks: %d", free_stacks);
components::button("Start", []
{
components::button("Start", [] {
auto hash = rage::joaat(selected_script);
if (!SCRIPT::DOES_SCRIPT_WITH_NAME_HASH_EXIST(hash))
@ -167,8 +164,7 @@ namespace big
if (*g_pointers->m_game_state != eGameState::Invalid && std::chrono::high_resolution_clock::now() - last_stack_update_time > 100ms)
{
last_stack_update_time = std::chrono::high_resolution_clock::now();
g_fiber_pool->queue_job([]
{
g_fiber_pool->queue_job([] {
update_free_stacks_count();
});
}

View File

@ -9,7 +9,7 @@ namespace big
if (ImGui::BeginTabItem("DEBUG_TABS_LOGS"_T.data()))
{
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("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("DEBUG_LOG_TREE_SCRIPT_EVENT"_T.data()))