mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-03 16:13:36 +08:00
Added filtering system to prepare_metric_for_sending. (#3139)
This commit is contained in:
parent
e29928ef46
commit
95b99c2a11
@ -94,7 +94,7 @@ namespace big
|
|||||||
{
|
{
|
||||||
struct logs
|
struct logs
|
||||||
{
|
{
|
||||||
bool metric_logs{};
|
int metric_logs{};
|
||||||
int packet_logs{};
|
int packet_logs{};
|
||||||
|
|
||||||
bool script_hook_logs{};
|
bool script_hook_logs{};
|
||||||
@ -170,7 +170,9 @@ namespace big
|
|||||||
pair out_of_allowed_range_sync_type{};
|
pair out_of_allowed_range_sync_type{};
|
||||||
pair invalid_sync{};
|
pair invalid_sync{};
|
||||||
|
|
||||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(notifications, gta_thread_kill, gta_thread_start, network_player_mgr_init, network_player_mgr_shutdown, player_join, player_leave, send_net_info_to_lobby, transaction_rate_limit, mismatch_sync_type, out_of_allowed_range_sync_type, invalid_sync)
|
bool warn_metric = false;
|
||||||
|
|
||||||
|
NLOHMANN_DEFINE_TYPE_INTRUSIVE(notifications, gta_thread_kill, gta_thread_start, network_player_mgr_init, network_player_mgr_shutdown, player_join, player_leave, send_net_info_to_lobby, transaction_rate_limit, mismatch_sync_type, out_of_allowed_range_sync_type, invalid_sync, warn_metric)
|
||||||
} notifications{};
|
} notifications{};
|
||||||
|
|
||||||
struct reactions
|
struct reactions
|
||||||
|
@ -4,49 +4,51 @@
|
|||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
const auto bad_metrics = std::unordered_set<std::string_view>({
|
const auto warn_bad_metrics = std::unordered_set<std::string_view>({
|
||||||
"REPORTER",
|
"REPORTER",
|
||||||
"REPORT_INVALIDMODEL",
|
"REPORT_INVALIDMODEL",
|
||||||
"MEM_NEW",
|
"MEM_NEW",
|
||||||
"DEBUGGER_ATTACH",
|
"DEBUGGER_ATTACH",
|
||||||
|
"XP_LOSS",
|
||||||
|
"CF",
|
||||||
|
"CC",
|
||||||
|
"CNR",
|
||||||
|
"SCRIPT",
|
||||||
|
"CHEAT",
|
||||||
|
"AUX_DEUX",
|
||||||
|
"HARDWARE_OS",
|
||||||
|
"HARDWARE_GPU",
|
||||||
|
"HARDWARE_MOBO",
|
||||||
|
"HARDWARE_MEM",
|
||||||
|
"HARDWARE_CPU",
|
||||||
|
"PCSETTINGS",
|
||||||
|
"CASH_CREATED",
|
||||||
|
"DR_PS",
|
||||||
|
"IDLEKICK",
|
||||||
|
"GSCB",
|
||||||
|
"GSINV",
|
||||||
|
"GSCW",
|
||||||
|
"GSINT",
|
||||||
|
"GARAGE_TAMPER",
|
||||||
|
"DUPE_DETECT",
|
||||||
|
"LAST_VEH",
|
||||||
|
"FAIL_SERV",
|
||||||
|
"CCF_UPDATE",
|
||||||
|
"CODE_CRC",
|
||||||
|
"MM",
|
||||||
|
"RDEV",
|
||||||
|
"RQA",
|
||||||
|
});
|
||||||
|
const auto filtered_bad_metrics = std::unordered_set<std::string_view>({
|
||||||
"DIG",
|
"DIG",
|
||||||
"XP_LOSS",
|
|
||||||
"AWARD_XP",
|
"AWARD_XP",
|
||||||
"CF",
|
|
||||||
"CC",
|
|
||||||
"CNR",
|
|
||||||
"SCRIPT",
|
|
||||||
"CHEAT",
|
|
||||||
"AUX_DEUX",
|
|
||||||
"WEATHER",
|
"WEATHER",
|
||||||
"HARDWARE_OS",
|
|
||||||
"HARDWARE_GPU",
|
|
||||||
"HARDWARE_MOBO",
|
|
||||||
"HARDWARE_MEM",
|
|
||||||
"HARDWARE_CPU",
|
|
||||||
"PCSETTINGS",
|
|
||||||
"CASH_CREATED",
|
|
||||||
"DR_PS",
|
|
||||||
"UVC",
|
"UVC",
|
||||||
"W_L",
|
"W_L",
|
||||||
"ESVCS",
|
"ESVCS",
|
||||||
"IDLEKICK",
|
|
||||||
"GSCB",
|
|
||||||
"GSINV",
|
|
||||||
"GSCW",
|
|
||||||
"GSINT",
|
|
||||||
"EARN",
|
"EARN",
|
||||||
"GARAGE_TAMPER",
|
|
||||||
"DUPE_DETECT",
|
|
||||||
"LAST_VEH",
|
|
||||||
"FAIL_SERV",
|
|
||||||
"CCF_UPDATE",
|
|
||||||
"CODE_CRC",
|
|
||||||
"COLLECTIBLE",
|
"COLLECTIBLE",
|
||||||
"FIRST_VEH",
|
"FIRST_VEH",
|
||||||
"MM",
|
|
||||||
"RDEV",
|
|
||||||
"RQA",
|
|
||||||
"RANK_UP",
|
"RANK_UP",
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -87,28 +89,39 @@ namespace big
|
|||||||
char metric_json_buffer [256] {};
|
char metric_json_buffer [256] {};
|
||||||
rage::json_serializer yim_serializer(metric_json_buffer, sizeof(metric_json_buffer));
|
rage::json_serializer yim_serializer(metric_json_buffer, sizeof(metric_json_buffer));
|
||||||
metric->serialize(&yim_serializer);
|
metric->serialize(&yim_serializer);
|
||||||
const bool is_bad_metric = bad_metrics.contains(metric->get_name());
|
auto metric_name = metric->get_name();
|
||||||
|
auto is_warn_bad_metrics = warn_bad_metrics.contains(metric_name);
|
||||||
|
auto is_filtered_bad_metrics = filtered_bad_metrics.contains(metric_name);
|
||||||
|
auto is_bad_metric = is_warn_bad_metrics || is_filtered_bad_metrics;
|
||||||
|
|
||||||
if (is_bad_metric)
|
if (is_bad_metric)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "BAD METRIC: " << metric->get_name() << "; DATA: " << yim_serializer.get_string();
|
if (g.debug.logs.metric_logs || is_warn_bad_metrics)
|
||||||
if(strcmp(metric->get_name(), "MM") == 0)
|
{
|
||||||
|
LOG(WARNING) << "BAD METRIC: " << metric_name << "; DATA: " << yim_serializer.get_string();
|
||||||
|
}
|
||||||
|
if (g.notifications.warn_metric && is_warn_bad_metrics)
|
||||||
|
{
|
||||||
|
g_notification_service.push_warning("METRIC"_T.data(),
|
||||||
|
std::format("{} {}", "METRIC_WARNING_MESSAGE"_T, metric_name).c_str());
|
||||||
|
}
|
||||||
|
if (!strcmp(metric_name, "MM"))
|
||||||
{
|
{
|
||||||
std::string data = std::string(reinterpret_cast<char*>(metric) + 0x18);
|
std::string data = std::string(reinterpret_cast<char*>(metric) + 0x18);
|
||||||
char module_name[MAX_PATH];
|
char module_name[MAX_PATH];
|
||||||
GetModuleFileNameA(g_hmodule, module_name, sizeof(module_name));
|
GetModuleFileNameA(g_hmodule, module_name, sizeof(module_name));
|
||||||
std::string encoded_module_name = hex_encode(std::filesystem::path(module_name).filename().string());
|
std::string encoded_module_name = hex_encode(std::filesystem::path(module_name).filename().string());
|
||||||
std::string result = remove_module_from_mmlist(data, encoded_module_name + "00");
|
std::string result = remove_module_from_mmlist(data, encoded_module_name + "00");
|
||||||
if(result.size() != data.size())
|
if (result.size() != data.size())
|
||||||
LOG(INFO) << "Removed YimMenu DLL from MM metric";
|
LOG(INFO) << "Removed YimMenu DLL from MM metric";
|
||||||
strncpy(reinterpret_cast<char*>(metric) + 0x18, result.c_str(), 0x900);
|
strncpy(reinterpret_cast<char*>(metric) + 0x18, result.c_str(), 0x900);
|
||||||
return g_hooking->get_original<prepare_metric_for_sending>()(serializer, unk, time, metric);
|
return g_hooking->get_original<prepare_metric_for_sending>()(serializer, unk, time, metric);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (g.debug.logs.metric_logs == 1)
|
||||||
if (!is_bad_metric && g.debug.logs.metric_logs)
|
|
||||||
{
|
{
|
||||||
LOG(INFO) << "METRIC: " << metric->get_name() << "; DATA: " << yim_serializer.get_string();
|
LOG(INFO) << "METRIC: " << metric_name << "; DATA: " << yim_serializer.get_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_hooking->get_original<prepare_metric_for_sending>()(serializer, unk, time, metric);
|
return g_hooking->get_original<prepare_metric_for_sending>()(serializer, unk, time, metric);
|
||||||
|
@ -8,8 +8,8 @@ namespace big
|
|||||||
{
|
{
|
||||||
if (ImGui::BeginTabItem("DEBUG_TABS_LOGS"_T.data()))
|
if (ImGui::BeginTabItem("DEBUG_TABS_LOGS"_T.data()))
|
||||||
{
|
{
|
||||||
ImGui::Checkbox("DEBUG_LOG_METRICS"_T.data(), &g.debug.logs.metric_logs);
|
|
||||||
static const char* options[]{"OFF"_T.data(), "ALL"_T.data(), "FILTERS"_T.data()};
|
static const char* options[]{"OFF"_T.data(), "ALL"_T.data(), "FILTERS"_T.data()};
|
||||||
|
ImGui::Combo("DEBUG_LOG_METRICS"_T.data(), (int*)&g.debug.logs.metric_logs, options, IM_ARRAYSIZE(options));
|
||||||
ImGui::Combo("VIEW_DEBUG_LOGS_LOG_PACKETS"_T.data(), (int*)&g.debug.logs.packet_logs, options, IM_ARRAYSIZE(options));
|
ImGui::Combo("VIEW_DEBUG_LOGS_LOG_PACKETS"_T.data(), (int*)&g.debug.logs.packet_logs, options, IM_ARRAYSIZE(options));
|
||||||
ImGui::Checkbox("DEBUG_LOG_NATIVE_SCRIPT_HOOKS"_T.data(), &g.debug.logs.script_hook_logs);
|
ImGui::Checkbox("DEBUG_LOG_NATIVE_SCRIPT_HOOKS"_T.data(), &g.debug.logs.script_hook_logs);
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ namespace big
|
|||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
ImGui::Checkbox("VIEW_GUI_FORMAT_MONEY"_T.data(), &g.window.gui.format_money);
|
ImGui::Checkbox("VIEW_GUI_FORMAT_MONEY"_T.data(), &g.window.gui.format_money);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Checkbox("METRIC_WARNING"_T.data(), &g.notifications.warn_metric);
|
||||||
|
|
||||||
if (g.window.ingame_overlay.show_indicators)
|
if (g.window.ingame_overlay.show_indicators)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user