Advertisement
expired6978

ScaleformTypes.h

Apr 12th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.14 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include "skse/Utilities.h"
  4. #include "skse/ScaleformAPI.h"
  5.  
  6. // not sure why they nest it like this, but whatever
  7. class GRefCountImplCore
  8. {
  9. public:
  10.     GRefCountImplCore() :refCount(1) { }
  11.     virtual ~GRefCountImplCore() { }
  12.  
  13. //  void    ** _vtbl;           // 00
  14.     volatile SInt32 refCount;   // 04
  15.  
  16.     // redirect new/delete to the scaleform heap
  17.     static void * operator new(std::size_t size)
  18.     {
  19.         return ScaleformHeap_Allocate(size);
  20.     }
  21.  
  22.     static void * operator new(std::size_t size, const std::nothrow_t &)
  23.     {
  24.         return ScaleformHeap_Allocate(size);
  25.     }
  26.  
  27.     // placement new
  28.     static void * operator new(std::size_t size, void * ptr)
  29.     {
  30.         return ptr;
  31.     }
  32.  
  33.     static void operator delete(void * ptr)
  34.     {
  35.         ScaleformHeap_Free(ptr);
  36.     }
  37.  
  38.     // placement delete
  39.     static void operator delete(void *, void *)
  40.     {
  41.         //
  42.     }
  43.  
  44.     void    AddRef(void)
  45.     {
  46.         InterlockedIncrement(&refCount);
  47.     }
  48.  
  49.     void    Release(void)
  50.     {
  51.         if(InterlockedDecrement(&refCount) == 0)
  52.         {
  53.             delete this;
  54.         }
  55.     }
  56. };
  57.  
  58. class GRefCountImpl : public GRefCountImplCore
  59. {
  60. public:
  61.     GRefCountImpl() { }
  62.     virtual ~GRefCountImpl() { }
  63. };
  64.  
  65. class GRefCountBaseStatImpl : public GRefCountImpl
  66. {
  67. public:
  68.     GRefCountBaseStatImpl() { }
  69.     virtual ~GRefCountBaseStatImpl() { }
  70. };
  71.  
  72. class GRefCountBase : public GRefCountBaseStatImpl
  73. {
  74. public:
  75.     GRefCountBase() { }
  76.     virtual ~GRefCountBase() { }
  77. };
  78.  
  79. #pragma warning (push)
  80. #pragma warning (disable : 4200)
  81.  
  82. class GString
  83. {
  84. public:
  85.     GString()   { }
  86.     GString(const char * string)    { CALL_MEMBER_FN(this, ctor)(string); }
  87.     ~GString()  { }
  88.  
  89.     enum
  90.     {
  91.         kHeapInfoMask = 3,
  92.     };
  93.  
  94.     struct Data
  95.     {
  96.         UInt32  len;
  97.         SInt32  refCount;
  98.         char    data[0];
  99.  
  100.         void    IncRef(void);
  101.         void    Release(void);
  102.     };
  103.  
  104.     union
  105.     {
  106.         Data    * ptr;      // do not use directly, clear lower 3 bits first
  107.         UInt32  heapInfo;
  108.     } data;
  109.  
  110.     Data *  GetData(void);
  111.     UInt32  GetHeapInfo(void);
  112.  
  113.     void    Destroy(void);
  114.  
  115.     MEMBER_FN_PREFIX(GString);
  116.     DEFINE_MEMBER_FN(ctor, GString *, 0x009259D0, const char * string);
  117.    
  118. };
  119.  
  120. #pragma warning (pop)
  121.  
  122. template <typename T>
  123. class GRect
  124. {
  125. public:
  126.     T   left;
  127.     T   top;
  128.     T   right;
  129.     T   bottom;
  130. };
  131.  
  132. class GMatrix3D
  133. {
  134. public:
  135.     float   m[4][4];
  136. };
  137.  
  138. typedef GRect<float>    GRectF;
  139.  
  140. template <typename T>
  141. class GArray
  142. {
  143. public:
  144.     // ### todo
  145. };
  146.  
  147. class GViewport
  148. {
  149. public:
  150.     enum
  151.     {
  152.         kFlags_IsRenderTexture    = 1 << 0,
  153.         kFlags_AlphaComposite     = 1 << 1,
  154.         kFlags_UseScissorRect     = 1 << 2,
  155.         kFlags_NoSetState         = 1 << 3,
  156.         kFlags_RenderTextureAlpha = kFlags_IsRenderTexture|kFlags_AlphaComposite
  157.     };
  158.  
  159.     SInt32  bufferWidth;
  160.     SInt32  bufferHeight;
  161.     SInt32  left;
  162.     SInt32  top;
  163.     SInt32  width;
  164.     SInt32  height;
  165.     SInt32  scissorLeft;
  166.     SInt32  scissorTop;
  167.     SInt32  scissorWidth;
  168.     SInt32  scissorHeight;
  169.     float   scale;
  170.     float   aspectRatio;
  171.     UInt32  flags;
  172. };
  173.  
  174. class GSysAllocBase
  175. {
  176. public:
  177.     virtual ~GSysAllocBase();
  178.  
  179.     virtual void Unk_01(void);
  180.     virtual void Unk_02(void);
  181. };
  182.  
  183. class GSysAlloc : public GSysAllocBase
  184. {
  185. public:
  186.     virtual ~GSysAlloc();
  187. };
  188.  
  189. class ScaleformAllocator : public GSysAlloc
  190. {
  191. public:
  192.     virtual ~ScaleformAllocator();
  193.  
  194.     virtual void Unk_03(void);
  195.     virtual void Unk_04(void);
  196. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement