Fix script patch signature causing crash (yubie-re) (#2523)

Redesigned the script patcher to assign the signatures names, so if they fail, it will print out its name.
This commit is contained in:
gir489
2023-12-12 17:37:31 -05:00
committed by GitHub
parent 5bf69531b5
commit efef962fe8
4 changed files with 48 additions and 26 deletions

View File

@ -9,51 +9,71 @@ namespace big
void register_script_patches() void register_script_patches()
{ {
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch(
{RAGE_JOAAT("freemode"), "2D 01 08 00 ? 38 00 5D ? ? ? 2A 06", 5, {0x71, 0x2E, 0x01, 0x01}, &g.session.decloak_players}); {RAGE_JOAAT("freemode"), "freemode1", "2D 01 08 00 ? 38 00 5D ? ? ? 2A 06", 5, {0x71, 0x2E, 0x01, 0x01}, &g.session.decloak_players});
g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "2D 01 04 00 ? 2C ? ? ? 5D ? ? ? 71 57 ? ? 2C", 5, {0x2E, 0x01, 0x00}, nullptr}); // script host kick g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "script host kick", "2D 01 04 00 ? 2C ? ? ? 5D ? ? ? 71 57 ? ? 2C", 5, {0x2E, 0x01, 0x00}, nullptr}); // script host kick
g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "5D ? ? ? 76 57 ? ? 5D ? ? ? 76", 0, {0x2E, 0x00, 0x00}, nullptr}); // end session kick protection g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "end session kick protection", "5D ? ? ? 76 57 ? ? 5D ? ? ? 76", 0, {0x2E, 0x00, 0x00}, nullptr}); // end session kick protection
g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "2D 01 09 00 00 5D ? ? ? 56 ? ? 2E", 5, {0x2E, 0x01, 0x00}, nullptr}); // disable death when undermap/spectating g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "disable death when undermap/spectating", "2D 01 09 00 00 5D ? ? ? 56 ? ? 3A", 5, {0x2E, 0x01, 0x00}, nullptr}); // disable death when undermap/spectating
g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "71 2E ? ? 55 ? ? 61 ? ? ? 47 ? ? 63", 0, {0x72}, nullptr}); // load island even if stranded animal IPL choice is not set g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "load island even if stranded animal IPL choice is not set", "71 2E ? ? 55 ? ? 61 ? ? ? 47 ? ? 63", 0, {0x72}, nullptr}); // load island even if stranded animal IPL choice is not set
g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "2D 00 07 00 00 7B", 5, {0x2E, 0x00, 0x00}, nullptr}); // disable population load balancing g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "disable population load balancing", "2D 00 07 00 00 7B", 5, {0x2E, 0x00, 0x00}, nullptr}); // disable population load balancing
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch(
{RAGE_JOAAT("freemode"), "2D 02 08 00 00 38 01 56", 5, {0x2E, 0x02, 0x00}, &g.session.block_muggers}); {RAGE_JOAAT("freemode"), "freemode7", "2D 02 08 00 00 38 01 56", 5, {0x2E, 0x02, 0x00}, &g.session.block_muggers});
g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), "2D 00 CF 00 00", 5, {0x2E, 0x00, 0x00}, &g.session.block_ceo_raids});
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch(
{RAGE_JOAAT("freemode"), "06 56 ? ? 38 02 2C ? ? ? 71 71", 0, {0x2B, 0x55}, &g.spoofing.spoof_blip}); // prevent normal blip update {RAGE_JOAAT("freemode"), "freemode8", "2D 00 CF 00 00", 5, {0x2E, 0x00, 0x00}, &g.session.block_ceo_raids});
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch(
{RAGE_JOAAT("freemode"), "2C ? ? ? 55 ? ? 71 2C ? ? ? 61", 7, std::vector<uint8_t>(16, 0x0), &g.spoofing.spoof_blip}); // prevent normal blip update 2 {RAGE_JOAAT("freemode"), "prevent normal blip update", "06 56 ? ? 38 02 2C ? ? ? 71 71", 0, {0x2B, 0x55}, &g.spoofing.spoof_blip}); // prevent normal blip update
g_script_patcher_service->add_patch({RAGE_JOAAT("shop_controller"), "2D 01 04 00 00 2C ? ? ? 56 ? ? 71", 5, {0x71, 0x2E, 0x01, 0x01}, nullptr}); // despawn bypass g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"),
g_script_patcher_service->add_patch({RAGE_JOAAT("shop_controller"), "2D 01 03 00 00 5D ? ? ? 06 56 ? ? 2E ? ? 2C", 5, {0x2E, 0x01, 0x00}, nullptr}); // godmode/invisibility detection bypass "prevent normal blip update 2",
"2C ? ? ? 55 ? ? 71 2C ? ? ? 61",
7,
std::vector<uint8_t>(16, 0x0),
&g.spoofing.spoof_blip}); // prevent normal blip update 2
g_script_patcher_service->add_patch({RAGE_JOAAT("shop_controller"), "despawn bypass", "2D 01 04 00 00 2C ? ? ? 56 ? ? 71", 5, {0x71, 0x2E, 0x01, 0x01}, nullptr}); // despawn bypass
g_script_patcher_service->add_patch({RAGE_JOAAT("shop_controller"), "godmode/invisibility detection bypass", "2D 01 03 00 00 5D ? ? ? 06 56 ? ? 2E ? ? 2C", 5, {0x2E, 0x01, 0x00}, nullptr}); // godmode/invisibility detection bypass
g_script_patcher_service->add_patch({RAGE_JOAAT("am_mp_nightclub"), g_script_patcher_service->add_patch({RAGE_JOAAT("am_mp_nightclub"),
"am_mp_nightclub1",
"2D 01 03 00 00 2C ? ? ? 56 ? ? 72 2E ? ? 38 00", "2D 01 03 00 00 2C ? ? ? 56 ? ? 72 2E ? ? 38 00",
5, 5,
{0x72, 0x2E, 0x01, 0x01}, {0x72, 0x2E, 0x01, 0x01},
&g.self.dance_mode}); &g.self.dance_mode});
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch({RAGE_JOAAT("am_mp_nightclub"),
{RAGE_JOAAT("am_mp_nightclub"), "20 56 ? ? 4F ? ? 46 ? ? 41 ? 71", 0, {0x2B, 0x55}, &g.self.dance_mode}); "am_mp_nightclub2",
"20 56 ? ? 4F ? ? 46 ? ? 41 ? 71",
0,
{0x2B, 0x55},
&g.self.dance_mode});
g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"),
"freemode9",
"5D ? ? ? 56 ? ? 72 39 05 38 04 2C ? ? ? 58", "5D ? ? ? 56 ? ? 72 39 05 38 04 2C ? ? ? 58",
0, 0,
{0x2B, 0x2B, 0x2B, 0x00, 0x55}, {0x2B, 0x2B, 0x2B, 0x00, 0x55},
&g.self.invisibility}); &g.self.invisibility});
g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"), g_script_patcher_service->add_patch({RAGE_JOAAT("freemode"),
"freemode10",
"2D 01 03 00 00 38 00 71 72 5D ? ? ? 06 56 ? ? 71 2E ? ? 2C ? ? ? 71", "2D 01 03 00 00 38 00 71 72 5D ? ? ? 06 56 ? ? 71 2E ? ? 2C ? ? ? 71",
5, 5,
{0x72, 0x2E, 0x01, 0x01}, {0x72, 0x2E, 0x01, 0x01},
&g.session.unhide_players_from_player_list}); &g.session.unhide_players_from_player_list});
g_script_patcher_service->add_patch({RAGE_JOAAT("carmod_shop"),
"disable camera",
"2D 01 0A 00 00 4F ? ? 40 ? 41 ? 39 03",
5,
{0x2E, 0x01, 0x00},
&g.vehicle.ls_customs}); // disable camera
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch(
{RAGE_JOAAT("carmod_shop"), "2D 01 0A 00 00 4F ? ? 40 ? 41 ? 39 03", 5, {0x2E, 0x01, 0x00}, &g.vehicle.ls_customs}); // disable camera {RAGE_JOAAT("carmod_shop"), "carmod_shop1", "2D 02 10 00 00 2C", 5, {0x71, 0x2E, 0x02, 0x01}, &g.vehicle.ls_customs});
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch(
{RAGE_JOAAT("carmod_shop"), "2D 02 10 00 00 2C", 5, {0x71, 0x2E, 0x02, 0x01}, &g.vehicle.ls_customs}); {RAGE_JOAAT("carmod_shop"), "carmod_shop2", "2D 00 B8 00 00", 5, {0x2E, 0x00, 0x00}, &g.vehicle.ls_customs});
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch(
{RAGE_JOAAT("carmod_shop"), "2D 00 B8 00 00", 5, {0x2E, 0x00, 0x00}, &g.vehicle.ls_customs}); {RAGE_JOAAT("carmod_shop"), "buy mods for free in SP", "06 1F 56 ? ? 62 ? ? ? 56", 0, {0x2B, 0x2B, 0x55}, &g.vehicle.ls_customs}); // buy mods for free in SP
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch(
{RAGE_JOAAT("carmod_shop"), "06 1F 56 ? ? 62 ? ? ? 56", 0, {0x2B, 0x2B, 0x55}, &g.vehicle.ls_customs}); // buy mods for free in SP {RAGE_JOAAT("carmod_shop"), "allow all vehicles", "2D 03 16 00 00 5D", 5, {0x72, 0x2E, 0x03, 0x01}, &g.vehicle.ls_customs}); // allow all vehicles
g_script_patcher_service->add_patch( g_script_patcher_service->add_patch({RAGE_JOAAT("carmod_shop"),
{RAGE_JOAAT("carmod_shop"), "2D 03 16 00 00 5D", 5, {0x72, 0x2E, 0x03, 0x01}, &g.vehicle.ls_customs}); // allow all vehicles "allow all vehicles 2",
g_script_patcher_service->add_patch( "2D 03 07 00 00 71 38 02",
{RAGE_JOAAT("carmod_shop"), "2D 03 07 00 00 71 38 02", 5, {0x72, 0x2E, 0x03, 0x01}, &g.vehicle.ls_customs}); // allow all vehicles 2 5,
{0x72, 0x2E, 0x03, 0x01},
&g.vehicle.ls_customs}); // allow all vehicles 2
for (auto& entry : *g_pointers->m_gta.m_script_program_table) for (auto& entry : *g_pointers->m_gta.m_script_program_table)
{ {

View File

@ -4,8 +4,9 @@
namespace big namespace big
{ {
script_patch::script_patch(rage::joaat_t script, const memory::pattern pattern, int32_t offset, std::vector<uint8_t> patch, bool* enable_bool) : script_patch::script_patch(rage::joaat_t script, std::string name, const memory::pattern pattern, int32_t offset, std::vector<uint8_t> patch, bool* enable_bool) :
m_script(script), m_script(script),
m_name(name),
m_pattern(pattern), m_pattern(pattern),
m_offset(offset), m_offset(offset),
m_patch(std::move(patch)), m_patch(std::move(patch)),
@ -53,7 +54,7 @@ namespace big
{ {
auto result = get_code_location_by_pattern(data, m_pattern); auto result = get_code_location_by_pattern(data, m_pattern);
if (!result.has_value()) if (!result.has_value())
LOG(FATAL) << "Failed to find pattern"; LOG(FATAL) << "Failed to find pattern: " << m_name;
m_ip = result.value() + m_offset; m_ip = result.value() + m_offset;

View File

@ -9,6 +9,7 @@ namespace big
{ {
rage::joaat_t m_script; rage::joaat_t m_script;
const memory::pattern m_pattern; const memory::pattern m_pattern;
std::string m_name;
int32_t m_offset; int32_t m_offset;
std::vector<uint8_t> m_patch; std::vector<uint8_t> m_patch;
std::vector<uint8_t> m_original; std::vector<uint8_t> m_original;
@ -26,7 +27,7 @@ namespace big
return m_script; return m_script;
} }
script_patch(rage::joaat_t script, const memory::pattern pattern, int32_t offset, std::vector<uint8_t> patch, bool* enable_bool); script_patch(rage::joaat_t script, std::string name, const memory::pattern pattern, int32_t offset, std::vector<uint8_t> patch, bool* enable_bool);
void update(script_data* data); void update(script_data* data);
}; };
} }

View File

@ -64,7 +64,7 @@ namespace big
SCRIPT::SET_SCRIPT_WITH_NAME_HASH_AS_NO_LONGER_NEEDED(RAGE_JOAAT("tuneables_processing")); SCRIPT::SET_SCRIPT_WITH_NAME_HASH_AS_NO_LONGER_NEEDED(RAGE_JOAAT("tuneables_processing"));
m_script_started = true; m_script_started = true;
g_script_patcher_service->add_patch({RAGE_JOAAT("tuneables_processing"), "2E ? ? 55 ? ? 38 06", 0, std::vector<uint8_t>(17, 0x0), &m_script_started}); // bool tunables registration hack g_script_patcher_service->add_patch({RAGE_JOAAT("tuneables_processing"), "tuneables_processing1", "2E ? ? 55 ? ? 38 06", 0, std::vector<uint8_t>(17, 0x0), &m_script_started}); // bool tunables registration hack
if (auto program = gta_util::find_script_program(RAGE_JOAAT("tuneables_processing"))) if (auto program = gta_util::find_script_program(RAGE_JOAAT("tuneables_processing")))
g_script_patcher_service->on_script_load(program); g_script_patcher_service->on_script_load(program);
} }