diff --git a/src/game/features/world/EnableCreatorDevMode.cpp b/src/game/features/world/EnableCreatorDevMode.cpp new file mode 100644 index 0000000..a26d273 --- /dev/null +++ b/src/game/features/world/EnableCreatorDevMode.cpp @@ -0,0 +1,42 @@ +#include "core/commands/BoolCommand.hpp" +#include "game/backend/ScriptPatches.hpp" + +namespace YimMenu +{ + static constexpr auto creatorScripts = std::to_array({ + "fm_race_creator"_J, + "fm_survival_creator"_J, + "fm_lts_creator"_J, + "fm_deathmatch_creator"_J, + "fm_capture_creator"_J, + }); + + class EnableCreatorDevMode : public BoolCommand + { + using BoolCommand::BoolCommand; + + std::vector m_IsDevModeEnabledPatches; + + virtual void OnEnable() override + { + if (m_IsDevModeEnabledPatches.empty()) + { + for (int i = 0; i < creatorScripts.size(); i++) + { + m_IsDevModeEnabledPatches.push_back(ScriptPatches::AddPatch(creatorScripts[i], ScriptPointer("IsDevModeEnabledPatch", "5D ? ? ? 56 ? ? 38 00 46 F0 0B").Add(1).Rip(), {0x2D, 0x00, 0x02, 0x00, 0x00, 0x72, 0x2E, 0x00, 0x01})); + } + } + + for (auto& patch : m_IsDevModeEnabledPatches) + patch->Enable(); + } + + virtual void OnDisable() override + { + for (auto& patch : m_IsDevModeEnabledPatches) + patch->Disable(); + } + }; + + static EnableCreatorDevMode _EnableCreatorDevMode{"enablecreatordevmode", "Enable Creator Dev Mode", "Enables the developer mode in Creator."}; +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Debug/Globals.cpp b/src/game/frontend/submenus/Debug/Globals.cpp index 145c679..4b6f730 100644 --- a/src/game/frontend/submenus/Debug/Globals.cpp +++ b/src/game/frontend/submenus/Debug/Globals.cpp @@ -67,7 +67,10 @@ namespace YimMenu::Submenus { for (auto& var : SavedVariables::GetSavedGlobals()) { - DrawSavedVariablePreview(var, var.Read()); + const auto& value = var.Read(); + ImGui::PushID(value); + DrawSavedVariablePreview(var, value); + ImGui::PopID(); } ImGui::EndListBox(); } diff --git a/src/game/frontend/submenus/World.cpp b/src/game/frontend/submenus/World.cpp index 080ad5f..1b957e1 100644 --- a/src/game/frontend/submenus/World.cpp +++ b/src/game/frontend/submenus/World.cpp @@ -42,6 +42,7 @@ namespace YimMenu::Submenus otherOpts->AddItem(std::make_shared("pedsignore"_J)); otherOpts->AddItem(std::make_shared("PedRiotMode"_J)); otherOpts->AddItem(std::make_shared("CopsDispatch"_J)); + otherOpts->AddItem(std::make_shared("enablecreatordevmode"_J)); main->AddItem(std::move(killPeds)); main->AddItem(std::move(deleteOpts));