Added more TSE crash protections and fixed some TSE notifications (#302)

This commit is contained in:
aa15032261 2022-07-02 03:35:36 +08:00 committed by GitHub
parent dba617ae9f
commit 38519a169e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 340 additions and 193 deletions

View File

@ -157,7 +157,20 @@ namespace big
Unknown3 = 1757755807,
Unknown4 = 436475575,
Unknown5 = 990606644,
Unknown6 = 69874647
Unknown6 = 69874647,
SEC3 = -2113023004,
SEC6 = 704979198,
SEC7 = -1715193475,
SEC8 = 1258808115,
SEC9 = 2112408256,
SEC10 = 998716537,
SEC11 = 163598572,
SEC12 = -1970125962,
SEC13 = -1056683619,
Spaghettios = -393294520,
ForceMission2 = -1525161016,
SHKick = -786546101
};
enum class eSessionType

View File

@ -6,7 +6,7 @@ namespace big
void format_string(std::string_view player_name, std::string_view protection_type, bool should_log, bool should_notify)
{
if (should_log)
LOG(WARNING) << "BLOCKED_SCRIPT_EVENT";
LOG(WARNING) << "BLOCKED_SCRIPT_EVENT From: " << player_name << " Event Type: " << protection_type;
if (should_notify)
g_notification_service->push_warning("Script Event Protection",
@ -153,12 +153,14 @@ namespace big
return true;
}
break;
}
else
{
format_string(player_name, "TSE Freeze", notify.tse_freeze.log, notify.tse_freeze.notify);
return true;
}
break;
case eRemoteEvent::SendToCutscene:
if (g->protections.script_events.send_to_cutscene)
{
@ -217,36 +219,168 @@ namespace big
break;
case eRemoteEvent::Unknown1:
if (g->protections.script_events.crash && args[2] >= 32) {
format_string(player_name, "Crash - #" + args[0], notify.crash.log, notify.crash.notify);
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Unknown2:
if (g->protections.script_events.crash && (args[2] >= 62 || args[3] >= 32)) {
format_string(player_name, "Crash - #" + args[0], notify.crash.log, notify.crash.notify);
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Unknown3:
if (g->protections.script_events.crash && args[2] >= 62) {
format_string(player_name, "Crash - #" + args[0], notify.crash.log, notify.crash.notify);
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Unknown4:
case eRemoteEvent::Unknown5:
if (g->protections.script_events.crash && args[2] >= 20) {
format_string(player_name, "Crash - #" + args[0], notify.crash.log, notify.crash.notify);
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Unknown6:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + args[0], notify.crash.log, notify.crash.notify);
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC3:
if (
g->protections.script_events.crash &&
(
(args[2] <= 115831 || args[2] >= 9999449) ||
(args[3] <= -1 || args[3] >= 1) ||
(args[4] <= -1 || args[4] >= 3) ||
(args[5] <= -1 || args[5] >= 101) ||
(args[6] <= -1 || args[6] >= 3) ||
(args[7] <= -1 || args[7] >= 1)
)
) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC6:
if (
g->protections.script_events.crash &&
(
(args[2] <= -1 || args[2] >= 1) ||
(args[3] <= -2 || args[3] >= 0) ||
(args[4] <= 3 || args[4] >= 5) ||
(args[5] <= 172 || args[5] >= 174) ||
(args[6] <= 20 || args[6] >= 510) ||
(args[7] <= 62 || args[7] >= 64) ||
(args[11] <= -1 || args[11] >= 1) ||
(args[12] <= -1 || args[12] >= 1) ||
(args[13] <= -1 || args[13] >= 1)
)
) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC7:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC8:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC9:
if (
g->protections.script_events.crash &&
(
(args[2] <= -1986324736 || args[2] >= 1747413822) ||
(args[2] > -9999999 || args[2] < 77777777) ||
(args[3] <= -1986324736 || args[3] >= 1777712108) ||
(args[3] > -9999999 || args[3] < 77777777) ||
(args[4] <= -1673857408 || args[4] >= 1780088064) ||
(args[4] > -9999999 || args[4] < 77777777) ||
(args[6] <= (0LL - 2588888790LL) || args[6] >= 2100146067)
)
) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC10:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC11:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC12:
if (
g->protections.script_events.crash &&
(
(args[2] <= -1 || args[2] >= 50) ||
(args[3] <= -1 || args[3] >= 50)
)
) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::SEC13:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::Spaghettios:
if (g->protections.script_events.crash) {
format_string(player_name, "Crash - #" + std::to_string(args[0]), notify.crash.log, notify.crash.notify);
return true;
}
break;
case eRemoteEvent::ForceMission2:
if (g->protections.script_events.force_mission)
{
format_string(player_name, "Force Mission", notify.force_mission.log, notify.force_mission.notify);
return true;
}
break;
case eRemoteEvent::SHKick:
if (g->protections.script_events.network_bail)
{
format_string(player_name, "Network Bail", notify.network_bail.log, notify.network_bail.notify);
return true;
}
}
if (g->debug.script_event_logging)
{
LOG(INFO) << "== Begin of Script Event ==";