Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/backend/ScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ namespace YimMenu
std::lock_guard lock(m_Mutex);
m_Scripts.push_back(std::move(script));
}
}
}
5 changes: 4 additions & 1 deletion src/core/hooking/DetourHook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ namespace YimMenu
template<typename T>
inline DetourHook<T>::~DetourHook()
{
DisableNow();
if (m_OriginalFunc)
{
MH_RemoveHook(m_TargetFunc);
}
}

template<typename T>
Expand Down
2 changes: 1 addition & 1 deletion src/core/hooking/Hooking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace YimMenu
{
BaseHook::DisableAll();
m_MinHook.ApplyQueued();

for (auto it : BaseHook::Hooks())
{
delete it;
Expand Down
2 changes: 1 addition & 1 deletion src/game/backend/AnticheatBypass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ namespace YimMenu
ScriptMgr::Yield();
}
}
}
}
2 changes: 1 addition & 1 deletion src/game/backend/NativeHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ namespace YimMenu
for (auto& [_, program] : m_RegisteredPrograms)
program->Cleanup();
}
}
}
19 changes: 19 additions & 0 deletions src/game/features/settings/UnloadMenu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "core/commands/Command.hpp"
#include "game/backend/Self.hpp"
#include "core/commands/Commands.hpp"

namespace YimMenu::Features
{
class UnloadMenu : public Command
{
using Command::Command;

virtual void OnCall() override
{
Commands::Shutdown();
g_Running = false;
}
};

static UnloadMenu _UnloadMenu{"unloadmenu", "Unload", "Unload YimMenuV2."};
}
3 changes: 2 additions & 1 deletion src/game/frontend/submenus/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace YimMenu::Submenus
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();

// this assumes we can't add new commands in runtime, but a lot of other subsystems assume that too
static std::map<std::string, CommandLink*> sortedCommands;
static bool commandsSorted = []() {
Expand Down Expand Up @@ -101,6 +101,7 @@ namespace YimMenu::Submenus

chat->AddItem(std::make_shared<BoolCommandItem>("clearchat"_J));

gui->AddItem(std::make_shared<CommandItem>("unloadmenu"_J));
game->AddItem(playerEsp);
game->AddItem(pedEsp);
game->AddItem(objectEsp);
Expand Down
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,19 @@ namespace YimMenu
}

LOG(INFO) << "Unloading";

ScriptMgr::Destroy();

NativeHooks::Destroy();

FiberPool::Destroy();
ScriptMgr::Destroy();

Hooking::Destroy();
CallSiteHook::Destroy();

EARLY_UNLOAD:
g_Running = false;

Renderer::Destroy();
LogHelper::Destroy();

Expand Down