CommonLibVR
Stack.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/B/BSTArray.h"
5 #include "RE/B/BSTSmartPointer.h"
6 #include "RE/M/MemoryPage.h"
7 #include "RE/V/Variable.h"
8 
9 namespace RE
10 {
11  namespace BSScript
12  {
13  namespace Internal
14  {
15  class CodeTasklet;
16  }
17 
18  class IProfilePolicy;
19  class IStackCallbackFunctor;
20  class StackFrame;
21  class Variable;
22  struct IMemoryPagePolicy;
23 
25  {
26  public:
27  enum class State
28  {
29  kRunning = 0,
30  kFinished = 1,
31  kWaitingOnMemory = 2,
37  kRetryCall = 8
38  };
39 
40  enum class FreezeState
41  {
42  kUnfrozen = 0,
43  kFreezing = 1,
44  kFrozen = 2
45  };
46 
47  enum class StackType
48  {
49  kNormal,
52  };
53 
55  {
56  public:
57  // members
59  std::uint32_t availableMemoryInBytes; // 08 - e.g. a function with 1 arg will have 3 unused args, so this will be 0x30, a function with 6 args will have 0 unused args, so this will be 0x0
60  std::uint32_t pad0C; // 0C
61  };
62  static_assert(sizeof(MemoryPageData) == 0x10);
63 
64  ~Stack();
65 
66  std::uint32_t GetPageForFrame(const StackFrame* a_frame) const;
67  Variable& GetStackFrameVariable(const StackFrame* a_frame, std::uint32_t a_index, std::uint32_t a_pageHint);
68 
69  // members
70  std::uint32_t pad04; // 04
74  std::uint32_t frames; // 58
75  std::uint32_t pad5C; // 5C
76  StackFrame* top; // 60
85 
86  private:
87  void Dtor();
88  };
89  static_assert(sizeof(Stack) == 0xA0);
90  }
91 }
Definition: IProfilePolicy.h:18
Definition: StackFrame.h:15
Definition: Stack.h:25
std::uint32_t pad5C
Definition: Stack.h:75
StackFrame * top
Definition: Stack.h:76
stl::enumeration< State, std::uint32_t > state
Definition: Stack.h:77
VMStackID stackID
Definition: Stack.h:80
StackType
Definition: Stack.h:48
BSTSmartPointer< IStackCallbackFunctor > callback
Definition: Stack.h:83
Variable returnValue
Definition: Stack.h:79
std::uint32_t pad04
Definition: Stack.h:70
std::uint32_t frames
Definition: Stack.h:74
BSTSmartPointer< Stack > nextStack
Definition: Stack.h:84
State
Definition: Stack.h:28
Variable & GetStackFrameVariable(const StackFrame *a_frame, std::uint32_t a_index, std::uint32_t a_pageHint)
std::uint32_t GetPageForFrame(const StackFrame *a_frame) const
stl::enumeration< FreezeState, std::uint32_t > freezeState
Definition: Stack.h:78
FreezeState
Definition: Stack.h:41
IMemoryPagePolicy * policy
Definition: Stack.h:71
IProfilePolicy * profilePolicy
Definition: Stack.h:72
BSTSmartPointer< Internal::CodeTasklet > owningTasklet
Definition: Stack.h:82
BSTSmallArray< MemoryPageData, 3 > pages
Definition: Stack.h:73
stl::enumeration< StackType, std::uint32_t > stackType
Definition: Stack.h:81
Definition: Variable.h:15
Definition: BSTArray.h:378
Definition: BSTSmartPointer.h:37
Definition: AbsorbEffect.h:6
std::uint32_t VMStackID
Definition: BSCoreTypes.h:8
Definition: BSIntrusiveRefCounted.h:8
Definition: IMemoryPagePolicy.h:8
std::uint32_t pad0C
Definition: Stack.h:60
BSTAutoPointer< MemoryPage > page
Definition: Stack.h:58
std::uint32_t availableMemoryInBytes
Definition: Stack.h:59