feat(menu): add invoker and some basic commands

This commit is contained in:
maybegreat48
2025-03-14 23:42:21 -04:00
parent aa3746462b
commit c3604ca819
50 changed files with 24853 additions and 6753 deletions
+33
View File
@@ -0,0 +1,33 @@
#include "Scripts.hpp"
#include "game/pointers/Pointers.hpp"
#include "types/rage/atArray.hpp"
#include "types/rage/tlsContext.hpp"
#include "types/script/scrThread.hpp"
namespace YimMenu::Scripts
{
rage::scrThread* FindScriptThread(joaat_t hash)
{
for (auto& thread : *Pointers.ScriptThreads)
{
if (thread && thread->m_Context.m_ThreadId && thread->m_ScriptHash == hash)
{
return thread;
}
}
return nullptr;
}
void RunAsScript(rage::scrThread* thread, std::function<void()> callback)
{
auto og_thread = rage::tlsContext::Get()->m_CurrentScriptThread;
auto og_running_in_scrthread = rage::tlsContext::Get()->m_ScriptThreadActive;
rage::tlsContext::Get()->m_CurrentScriptThread = thread;
rage::tlsContext::Get()->m_ScriptThreadActive = true;
callback();
rage::tlsContext::Get()->m_ScriptThreadActive = og_running_in_scrthread;
rage::tlsContext::Get()->m_CurrentScriptThread = og_thread;
}
}