From 9d96b1da4738cff16b84e37a6c5513c2f3e291c6 Mon Sep 17 00:00:00 2001 From: maybegreat48 <96936658+maybegreat48@users.noreply.github.com> Date: Wed, 9 Apr 2025 15:18:02 -0400 Subject: [PATCH] feat: play all missions solo (untested) --- .../features/recovery/PlayAllMissionsSolo.cpp | 79 +++++++++++++++++++ src/game/frontend/submenus/Recovery.cpp | 17 ++-- src/game/pointers/Pointers.cpp | 2 +- 3 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 src/game/features/recovery/PlayAllMissionsSolo.cpp diff --git a/src/game/features/recovery/PlayAllMissionsSolo.cpp b/src/game/features/recovery/PlayAllMissionsSolo.cpp new file mode 100644 index 0000000..742fe60 --- /dev/null +++ b/src/game/features/recovery/PlayAllMissionsSolo.cpp @@ -0,0 +1,79 @@ +#include "core/commands/BoolCommand.hpp" +#include "game/backend/ScriptPatches.hpp" + +namespace YimMenu::Features +{ + class PlayAllMissionsSolo : public BoolCommand + { + using BoolCommand::BoolCommand; + + ScriptPatch m_CanLaunchJobPatch{}; + ScriptPatch m_MissionRequestPatch1{}; // TODO: do we need these patches? + ScriptPatch m_MissionRequestPatch2{}; + ScriptPatch m_MissionRequestPatch3{}; + ScriptPatch m_MissionRequestPatch4{}; + + virtual void OnEnable() override + { + if (!m_CanLaunchJobPatch) + { + m_CanLaunchJobPatch = ScriptPatches::AddPatch("fmmc_launcher"_J, "2D 05 0C 00 00 71", 5, {0x72, 0x2E, 0x05, 0x01}); + } + m_CanLaunchJobPatch->Enable(); + + if (!m_MissionRequestPatch1) + { + m_MissionRequestPatch1 = ScriptPatches::AddPatch("freemode"_J, "38 00 72 5D ? ? ? 38 00 5D ? ? ? 2E 02 00 38 00 38 01", 0, std::vector(14, 0x0)); + } + m_MissionRequestPatch1->Enable(); + + if (!m_MissionRequestPatch2) + { + m_MissionRequestPatch2 = ScriptPatches::AddPatch("freemode"_J, "25 ? 37 07 33 37 07 5D ? ? ? 39 11", 20, {0x48}); + } + m_MissionRequestPatch2->Enable(); + + if (!m_MissionRequestPatch3) + { + m_MissionRequestPatch3 = ScriptPatches::AddPatch("freemode"_J, "2D 03 1A 00 00 38 00 5D ? ? ? 39 05", 5, {0x72, 0x2E, 0x03, 0x01}); + } + m_MissionRequestPatch3->Enable(); + + if (!m_MissionRequestPatch4) + { + m_MissionRequestPatch4 = ScriptPatches::AddPatch("freemode"_J, "5D ? ? ? 39 06 38 01 5D ? ? ? 25", 0, {0x72, 0x2E, 0x04, 0x01}); + } + m_MissionRequestPatch4->Enable(); + } + + virtual void OnDisable() override + { + if (m_CanLaunchJobPatch) + { + m_CanLaunchJobPatch->Disable(); + } + + if (m_MissionRequestPatch1) + { + m_MissionRequestPatch1->Disable(); + } + + if (m_MissionRequestPatch2) + { + m_MissionRequestPatch2->Disable(); + } + + if (m_MissionRequestPatch3) + { + m_MissionRequestPatch3->Disable(); + } + + if (m_MissionRequestPatch4) + { + m_MissionRequestPatch4->Disable(); + } + } + }; + + static PlayAllMissionsSolo _PlayAllMissionsSolo{"playallmissionssolo", "Play All Missions Solo", "Allows you to play any mission solo. Note that some missions might break if there aren't enough players"}; +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Recovery.cpp b/src/game/frontend/submenus/Recovery.cpp index 5cd591e..9e3ee23 100644 --- a/src/game/frontend/submenus/Recovery.cpp +++ b/src/game/frontend/submenus/Recovery.cpp @@ -10,9 +10,10 @@ namespace YimMenu::Submenus Submenu::Submenu("Recovery") { auto shopping = std::make_shared("Shopping"); - auto heist = std::make_shared("Heists"); + auto missions = std::make_shared("Missions"); auto vehiclesGroup = std::make_shared("Vehicles"); - auto heistGroup = std::make_shared("Heist"); + auto generalGroup = std::make_shared("General"); + auto cayoPericoGroup = std::make_shared("Cayo Perico"); vehiclesGroup->AddItem(std::make_shared("dlcvehicles"_J)); @@ -25,13 +26,17 @@ namespace YimMenu::Submenus } } })); - heistGroup->AddItem(std::make_shared("skipcayosetup"_J)); - heistGroup->AddItem(std::make_shared("skipcayocooldown"_J)); + + generalGroup->AddItem(std::make_shared("playallmissionssolo"_J)); + + cayoPericoGroup->AddItem(std::make_shared("skipcayosetup"_J)); + cayoPericoGroup->AddItem(std::make_shared("skipcayocooldown"_J)); shopping->AddItem(vehiclesGroup); - heist->AddItem(heistGroup); + missions->AddItem(generalGroup); + missions->AddItem(cayoPericoGroup); AddCategory(std::move(shopping)); - AddCategory(std::move(heist)); + AddCategory(std::move(missions)); AddCategory(BuildStatEditorMenu()); AddCategory(BuildTransactionsMenu()); } diff --git a/src/game/pointers/Pointers.cpp b/src/game/pointers/Pointers.cpp index cab287e..96d56a2 100644 --- a/src/game/pointers/Pointers.cpp +++ b/src/game/pointers/Pointers.cpp @@ -352,7 +352,7 @@ namespace YimMenu BytePatches::Add(ptr.As(), std::vector{0xB0, 0x01})->Apply(); }); - constexpr auto getAvatarsPtrn = Pattern<"89 4E 7C 48 8B CE E8 ? ? ? ? 84 C0">("GetAvatars"); + constexpr auto getAvatarsPtrn = Pattern<"89 4B 7C 48 8B CB E8 ? ? ? ? 84 C0">("GetAvatars"); scanner.Add(getAvatarsPtrn, [this](PointerCalculator ptr) { GetAvatars = ptr.Add(6).Add(1).Rip().As(); });