mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-17 14:57:27 +08:00

Updated natives for 1.50. Added settings JSON implementation. Refactored spawn vehicle bypass to not crash. (removed VMT hook)
46 lines
1002 B
C++
46 lines
1002 B
C++
#include "common.hpp"
|
|
#include "crossmap.hpp"
|
|
#include "invoker.hpp"
|
|
#include "logger.hpp"
|
|
#include "pointers.hpp"
|
|
|
|
namespace big
|
|
{
|
|
native_call_context::native_call_context()
|
|
{
|
|
m_return_value = &m_return_stack[0];
|
|
m_args = &m_arg_stack[0];
|
|
}
|
|
|
|
void native_invoker::cache_handlers()
|
|
{
|
|
for (const rage::scrNativeMapping& mapping : g_crossmap)
|
|
{
|
|
rage::scrNativeHandler handler = g_pointers->m_get_native_handler(
|
|
g_pointers->m_native_registration_table, mapping.second);
|
|
|
|
m_handler_cache.emplace(mapping.first, handler);
|
|
}
|
|
}
|
|
|
|
void native_invoker::begin_call()
|
|
{
|
|
m_call_context.reset();
|
|
}
|
|
|
|
void native_invoker::end_call(rage::scrNativeHash hash)
|
|
{
|
|
if (auto it = m_handler_cache.find(hash); it != m_handler_cache.end())
|
|
{
|
|
rage::scrNativeHandler handler = it->second;
|
|
|
|
handler(&m_call_context);
|
|
g_pointers->m_fix_vectors(&m_call_context);
|
|
}
|
|
else
|
|
{
|
|
[hash]() { LOG(WARNING) << "Failed to find " << HEX_TO_UPPER(hash) << " native's handler."; }();
|
|
}
|
|
}
|
|
}
|