2020-02-22 20:47:17 -05:00
|
|
|
#include "script_local.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
|
|
|
|
#include "common.hpp"
|
2022-12-08 13:35:41 +01:00
|
|
|
#include "gta/script_thread.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "pointers.hpp"
|
2020-02-22 20:47:17 -05:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
script_local::script_local(rage::scrThread* thread, std::size_t index) :
|
2023-03-01 21:27:15 +00:00
|
|
|
m_index(index),
|
|
|
|
m_stack(thread->m_stack)
|
2020-02-22 20:47:17 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
script_local::script_local(PVOID stack, std::size_t index) :
|
2023-03-01 21:27:15 +00:00
|
|
|
m_index(index),
|
|
|
|
m_stack(stack)
|
2020-02-22 20:47:17 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-07-11 23:53:15 +02:00
|
|
|
script_local::script_local(std::size_t index) :
|
|
|
|
m_index(index),
|
|
|
|
m_stack(nullptr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
script_local script_local::set(rage::scrThread* thread)
|
|
|
|
{
|
|
|
|
return script_local(thread, m_index);
|
|
|
|
}
|
|
|
|
|
|
|
|
script_local script_local::set(void* stack)
|
|
|
|
{
|
|
|
|
return script_local(stack, m_index);
|
|
|
|
}
|
|
|
|
|
2020-02-22 20:47:17 -05:00
|
|
|
script_local script_local::at(std::ptrdiff_t index)
|
|
|
|
{
|
|
|
|
return script_local(m_stack, m_index + index);
|
|
|
|
}
|
|
|
|
|
|
|
|
script_local script_local::at(std::ptrdiff_t index, std::size_t size)
|
|
|
|
{
|
|
|
|
return script_local(m_stack, m_index + 1 + (index * size));
|
|
|
|
}
|
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
void* script_local::get()
|
2020-02-22 20:47:17 -05:00
|
|
|
{
|
|
|
|
return reinterpret_cast<uintptr_t*>((uintptr_t)m_stack + (m_index * sizeof(uintptr_t)));
|
|
|
|
}
|
|
|
|
}
|