mirror of
https://github.com/YimMenu/YimMenuV2.git
synced 2026-10-11 09:48:08 +08:00
feat(network): add more stuff
This commit is contained in:
1 parent
b4a83aac3b
commit
4b11be70ef
41 files changed
+557
-12
No files matched your search
@@ -2,7 +2,9 @@
|
||||
#include "game/pointers/Pointers.hpp"
|
||||
#include "types/rage/atArray.hpp"
|
||||
#include "types/rage/tlsContext.hpp"
|
||||
#include "types/script/scrThread.hpp"
|
||||
#include "types/script/GtaThread.hpp"
|
||||
#include "types/script/CGameScriptHandler.hpp"
|
||||
#include "types/script/CGameScriptId.hpp"
|
||||
|
||||
namespace YimMenu::Scripts
|
||||
{
|
||||
@@ -30,4 +32,31 @@ namespace YimMenu::Scripts
|
||||
rage::tlsContext::Get()->m_ScriptThreadActive = og_running_in_scrthread;
|
||||
rage::tlsContext::Get()->m_CurrentScriptThread = og_thread;
|
||||
}
|
||||
|
||||
void RunWithSpoofedThreadName(std::uint32_t name, std::function<void()> callback)
|
||||
{
|
||||
if (auto thread = reinterpret_cast<GtaThread*>(rage::tlsContext::Get()->m_CurrentScriptThread))
|
||||
{
|
||||
auto hash_1 = thread->m_Context.m_ScriptHash;
|
||||
auto hash_2 = thread->m_ScriptHash;
|
||||
auto hash_3 = thread->m_ScriptHash2;
|
||||
std::optional<std::uint32_t> hash_4;
|
||||
if (auto handler = thread->m_ScriptHandler)
|
||||
hash_4 = handler->GetId()->m_Hash;
|
||||
|
||||
thread->m_Context.m_ScriptHash = name;
|
||||
thread->m_ScriptHash = name;
|
||||
thread->m_ScriptHash2 = name;
|
||||
if (hash_4)
|
||||
thread->m_ScriptHandler->GetId()->m_Hash = name;
|
||||
|
||||
callback();
|
||||
|
||||
thread->m_Context.m_ScriptHash = hash_1;
|
||||
thread->m_ScriptHash = hash_2;
|
||||
thread->m_ScriptHash2 = hash_3;
|
||||
if (hash_4)
|
||||
thread->m_ScriptHandler->GetId()->m_Hash = *hash_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user