-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathscript_local.cpp
More file actions
66 lines (56 loc) · 1.96 KB
/
Copy pathscript_local.cpp
File metadata and controls
66 lines (56 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* @file script_local.cpp
*
* @copyright GNU General Public License Version 2.
* This file is part of YimMenu.
* YimMenu is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
* YimMenu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with YimMenu. If not, see <https://www.gnu.org/licenses/>.
*/
#include "script_local.hpp"
#include "gta_util.hpp"
// clang-format off
#include "util/header_wrappers/include_as_enhaced.hpp"
#include "gta/script_thread.hpp"
#include "util/header_wrappers/include_as_legacy.hpp"
#include "gta/script_thread.hpp"
#include "util/header_wrappers/clear_include.hpp"
// clang-format on
namespace big
{
script_local::script_local(rage::scrThread* thread, std::size_t index) :
m_index(index)
{
m_stack = AUTO_CROSS_ACCESS(rage::scrThread, thread, ->m_stack);
}
script_local::script_local(PVOID stack, std::size_t index) :
m_index(index),
m_stack(stack)
{
}
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);
}
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));
}
void* script_local::get()
{
return reinterpret_cast<uintptr_t*>((uintptr_t)m_stack + (m_index * sizeof(uintptr_t)));
}
}