Added filtering system to prepare_metric_for_sending. (#3139)
This commit is contained in:
parent
00f5c34e2a
commit
254f64f1af
@ -94,7 +94,7 @@ namespace big
|
||||
{
|
||||
struct logs
|
||||
{
|
||||
bool metric_logs{};
|
||||
int metric_logs{};
|
||||
int packet_logs{};
|
||||
|
||||
bool script_hook_logs{};
|
||||
@ -170,7 +170,9 @@ namespace big
|
||||
pair out_of_allowed_range_sync_type{};
|
||||
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{};
|
||||
|
||||
struct reactions
|
||||
|
@ -4,49 +4,51 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
const auto bad_metrics = std::unordered_set<std::string_view>({
|
||||
"REPORTER",
|
||||
"REPORT_INVALIDMODEL",
|
||||
"MEM_NEW",
|
||||
"DEBUGGER_ATTACH",
|
||||
const auto warn_bad_metrics = std::unordered_set<std::string_view>({
|
||||
"REPORTER",
|
||||
"REPORT_INVALIDMODEL",
|
||||
"MEM_NEW",
|
||||
"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",
|
||||
"XP_LOSS",
|
||||
"AWARD_XP",
|
||||
"CF",
|
||||
"CC",
|
||||
"CNR",
|
||||
"SCRIPT",
|
||||
"CHEAT",
|
||||
"AUX_DEUX",
|
||||
"WEATHER",
|
||||
"HARDWARE_OS",
|
||||
"HARDWARE_GPU",
|
||||
"HARDWARE_MOBO",
|
||||
"HARDWARE_MEM",
|
||||
"HARDWARE_CPU",
|
||||
"PCSETTINGS",
|
||||
"CASH_CREATED",
|
||||
"DR_PS",
|
||||
"UVC",
|
||||
"W_L",
|
||||
"ESVCS",
|
||||
"IDLEKICK",
|
||||
"GSCB",
|
||||
"GSINV",
|
||||
"GSCW",
|
||||
"GSINT",
|
||||
"EARN",
|
||||
"GARAGE_TAMPER",
|
||||
"DUPE_DETECT",
|
||||
"LAST_VEH",
|
||||
"FAIL_SERV",
|
||||
"CCF_UPDATE",
|
||||
"CODE_CRC",
|
||||
"COLLECTIBLE",
|
||||
"FIRST_VEH",
|
||||
"MM",
|
||||
"RDEV",
|
||||
"RQA",
|
||||
"RANK_UP",
|
||||
});
|
||||
|
||||
@ -87,28 +89,39 @@ namespace big
|
||||
char metric_json_buffer [256] {};
|
||||
rage::json_serializer yim_serializer(metric_json_buffer, sizeof(metric_json_buffer));
|
||||
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)
|
||||
{
|
||||
LOG(WARNING) << "BAD METRIC: " << metric->get_name() << "; DATA: " << yim_serializer.get_string();
|
||||
if(strcmp(metric->get_name(), "MM") == 0)
|
||||
if (g.debug.logs.metric_logs || is_warn_bad_metrics)
|
||||
{
|
||||
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);
|
||||
char module_name[MAX_PATH];
|
||||
GetModuleFileNameA(g_hmodule, module_name, sizeof(module_name));
|
||||
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");
|
||||
if(result.size() != data.size())
|
||||
std::string result = remove_module_from_mmlist(data, encoded_module_name + "00");
|
||||
if (result.size() != data.size())
|
||||
LOG(INFO) << "Removed YimMenu DLL from MM metric";
|
||||
strncpy(reinterpret_cast<char*>(metric) + 0x18, result.c_str(), 0x900);
|
||||
return g_hooking->get_original<prepare_metric_for_sending>()(serializer, unk, time, metric);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_bad_metric && g.debug.logs.metric_logs)
|
||||
else if (g.debug.logs.metric_logs == 1)
|
||||
{
|
||||
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);
|
||||
|
@ -8,8 +8,8 @@ namespace big
|
||||
{
|
||||
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()};
|
||||
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::Checkbox("DEBUG_LOG_NATIVE_SCRIPT_HOOKS"_T.data(), &g.debug.logs.script_hook_logs);
|
||||
|
||||
|
@ -60,6 +60,8 @@ namespace big
|
||||
ImGui::EndGroup();
|
||||
|
||||
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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user