feat(TabSettings): Added disable logging to settings

This commit is contained in:
Yimura 2021-01-02 23:42:43 +01:00
parent 3bbe770095
commit 6b0d9c0e21
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78
4 changed files with 32 additions and 9 deletions

View File

@ -6,6 +6,21 @@ namespace big
{
if (ImGui::BeginTabItem("Settings"))
{
if (ImGui::TreeNode("Dev Logging"))
{
auto& logging = g_settings.options["settings"]["logging"];
if (ImGui::Checkbox("Get Event Data", logging["get_event_data"].get<bool*>()))
g_settings.save();
if (ImGui::Checkbox("Script Events", logging["script_events"].get<bool*>()))
g_settings.save();
ImGui::TreePop();
}
ImGui::Separator();
if (ImGui::TreeNode("Protections"))
{
auto &protections = g_settings.options["settings"]["protections"];

View File

@ -143,6 +143,8 @@ namespace big
return false;
}
if (g_settings.options["settings"]["logging"]["get_event_data"])
{
const char* sender = g_pointers->m_get_player_name(player);
LOG(INFO) << "Player: " << sender;
LOG(INFO) << "Script hash: " << args[0];
@ -152,6 +154,7 @@ namespace big
for (std::uint32_t i = 0; i < argCount; i++)
LOG(INFO) << "Script event args[" << i << "] : " << args[i];
}
}
return result;
}

View File

@ -10,6 +10,7 @@ namespace big
const auto ScriptEventHash = args[0];
if (g_settings.options["settings"]["logging"]["script_events"])
LOG(INFO) << "Received Script Event " << ScriptEventHash << " from Player " << PLAYER::GET_PLAYER_NAME(SenderID);
return g_hooking->m_script_event_hook.get_original<decltype(&script_event_handler)>()(NetEventStruct, CNetGamePlayer);

View File

@ -53,6 +53,10 @@ namespace big
"force_teleport": false,
"transaction_error": false,
"vehicle_kick": false
},
"logging": {
"get_event_data": false,
"script_events": false
}
}
})"_json;