CommonLibSSE NG
GFxMovieDef.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/G/GFxResource.h"
4 #include "RE/G/GFxResourceID.h"
5 #include "RE/G/GFxStateBag.h"
6 #include "RE/G/GMemoryHeap.h"
7 #include "RE/G/GRect.h"
8 #include "RE/G/GStats.h"
9 
10 namespace RE
11 {
12  class GASRefCountCollector;
13  class GASStringManager;
14  class GFxExporterInfo;
15  class GFxMovieView;
16 
17  // Represents loaded shared data for an SWF movie file. These objects are normally created by Loader::CreateMovie and are shared by all movie instances.
18  class GFxMovieDef :
19  public GFxResource, // 00
20  public GFxStateBag // 18
21  {
22  public:
23  // SWF 8 file attributes, returned by GetFileAttributes. These attributes are configured in Publish Settings and Document Properties dialogs of the Flash studio.
24  enum FileAttrFlags : std::uint32_t
25  {
26  kUseNetwork = 1 << 0, // - Indicates that "Access Network only" was selected for an SWF file in publish settings for local playback security
27  kHasMetadata = 1 << 4 // - Indicates that the file has embedded metadata, available through the GetMetadata method
28  };
29 
30  // VisitResourceMask defines a set of resource mask flag bits passed as a visitMask argument to VisitResources. If a given flag bit is included in the visitMask, the corresponding resource types are included in the enumeration, otherwise they are ignored.
31  enum VisitResourceMask : std::uint32_t
32  {
33  kNestedMovies = 1 << 15, // Indicates that resources in the imported movies should also be enumerated.
34 
35  // Types of resources to visit
36  kFonts = 1 << 0, // Font resources should be enumerated.
37  kBitmaps = 1 << 1, // Image resources with GFxResource::ResourceUse::kBitmap should be enumerated (See GFxResource::ResourceUse). These resources correspond to image shape fills used in the SWF/FLA files.
38  kGradientImages = 1 << 2, // Image resources with GFxResource::ResourceUse::kGradientBitmaps should be enumerated (See GFxResource::ResourceUse). These resources are created based on GradientParams during loading.
39  kEditTextFields = 1 << 3, // Edit text field resources should be enumerated.
40  kSounds = 1 << 4, // Sound resources should be enumerated.
41  kSprite = 1 << 5, // Sprite resources should be enumerated.
42 
43  // Combined flags
44  kAllLocalImages = (kBitmaps | kGradientImages), // Combines kBitmaps and kGradientImages.
45  kAllImages = (kBitmaps | kGradientImages | kNestedMovies) // Combines kBitmaps, kGradientImages and kNestedMovies.
46  };
47 
48  struct MemoryParams
49  {
50  MemoryParams(UPInt a_memoryArena = 0);
51 
52  // members
54  float heapLimitMultiplier; // 40
55  std::uint32_t maxCollectionRoots; // 44
56  std::uint32_t framesBetweenCollections; // 48
57  std::uint32_t pad4C; // 4C
58  };
59  static_assert(sizeof(MemoryParams) == 0x50);
60 
61  class MemoryContext : public GRefCountBase<MemoryContext, GStatGroups::kGStat_Default_Mem>
62  {
63  public:
64  MemoryContext() = delete;
65  ~MemoryContext() override; // 00
66  };
67  static_assert(sizeof(MemoryContext) == 0x10);
68 
70  {
71  public:
73  {
74  public:
75  ~HeapLimit() override;
76 
77  // override (GMemoryHeap::LimitHandler)
78  bool OnExceedLimit(GMemoryHeap* a_heap, UPInt a_overLimit) override; // 01
79  void OnFreeSegment(GMemoryHeap* a_heap, UPInt a_freeingSize) override; // 02
80 
81  // members
82  std::uint64_t unk08; // 08
83  std::uint64_t unk10; // 10
84  std::uint64_t unk18; // 18
85  std::uint64_t unk20; // 20
86  std::uint64_t unk28; // 28
87  };
88  static_assert(sizeof(HeapLimit) == 0x30);
89 
90  // members
91  GMemoryHeap* heap; // 10
94  std::uint64_t unk28; // 28
96  };
97  static_assert(sizeof(MemoryContextImpl) == 0x60);
98 
100  {
101  virtual ~ImportVisitor(); // 00
102 
103  // add
104  virtual void Visit(GFxMovieDef* a_parentDef, GFxMovieDef* a_importDef, const char* a_importedMovieFilename) = 0; // 01
105  };
106  static_assert(sizeof(ImportVisitor) == 0x8);
107 
109  {
110  virtual ~ResourceVisitor(); // 00
111 
112  // add
113  virtual void Visit(GFxMovieDef* a_movieDef, GFxResource* a_resource, GFxResourceID a_id, const char* a_exportName) = 0; // 01
114  };
115  static_assert(sizeof(ResourceVisitor) == 0x8);
116 
117  // add
118  [[nodiscard]] virtual std::uint32_t GetVersion() const = 0; // 04
119  [[nodiscard]] virtual std::uint32_t GetLoadingFrame() const = 0; // 05
120  [[nodiscard]] virtual float GetWidth() const = 0; // 06
121  [[nodiscard]] virtual float GetHeight() const = 0; // 07
122  [[nodiscard]] virtual std::uint32_t GetFrameCount() const = 0; // 08
123  [[nodiscard]] virtual float GetFrameRate() const = 0; // 09
124  [[nodiscard]] virtual GRectF GetFrameRect() const = 0; // 0A
125  [[nodiscard]] virtual std::uint32_t GetSWFFlags() const = 0; // 0B
126  [[nodiscard]] virtual const char* GetFileURL() const = 0; // 0C
127  virtual void WaitForLoadFinish(bool a_cancel = false) const = 0; // 0D
128  virtual void WaitForFrame(std::uint32_t a_frame) const = 0; // 0E
129  [[nodiscard]] virtual std::uint32_t GetFileAttributes() const = 0; // 0F
130  virtual std::uint32_t GetMetadata(char* a_buff, std::uint32_t a_buffSize) const = 0; // 10
131  [[nodiscard]] virtual GMemoryHeap* GetLoadDataHeap() const = 0; // 11
132  [[nodiscard]] virtual GMemoryHeap* GetBindDataHeap() const = 0; // 12
133  [[nodiscard]] virtual GMemoryHeap* GetImageHeap() const = 0; // 13
134  [[nodiscard]] virtual GFxResource* GetMovieDataResource() const = 0; // 14
135  [[nodiscard]] virtual const GFxExporterInfo* GetExporterInfo() const = 0; // 15
136  virtual MemoryContext* CreateMemoryContext(const char* a_heapName, const MemoryParams& a_memParams, bool a_debugHeap) = 0; // 16
137  virtual GFxMovieView* CreateInstance(const MemoryParams& a_memParams, bool a_initFirstFrame = true) = 0; // 17
138  virtual GFxMovieView* CreateInstance(MemoryContext* a_memContext, bool a_initFirstFrame = true) = 0; // 18
139  virtual void VisitImportedMovies(ImportVisitor* a_visitor) = 0; // 19
140  virtual void VisitResources(ResourceVisitor* a_visitor, VisitResourceMask a_visitMask = VisitResourceMask::kAllImages) = 0; // 1A
141  virtual GFxResource* GetResource(const char* a_exportName) const = 0; // 1B
142 
143  GFxMovieView* CreateInstance(bool a_initFirstFrame = true, UPInt a_memoryArena = 0);
144  };
145  static_assert(sizeof(GFxMovieDef) == 0x20);
146 }
Definition: GFxFileConstants.h:6
std::uint64_t unk20
Definition: GFxMovieDef.h:85
std::uint64_t unk28
Definition: GFxMovieDef.h:86
bool OnExceedLimit(GMemoryHeap *a_heap, UPInt a_overLimit) override
void OnFreeSegment(GMemoryHeap *a_heap, UPInt a_freeingSize) override
std::uint64_t unk18
Definition: GFxMovieDef.h:84
std::uint64_t unk08
Definition: GFxMovieDef.h:82
std::uint64_t unk10
Definition: GFxMovieDef.h:83
Definition: GFxMovieDef.h:70
std::uint64_t unk28
Definition: GFxMovieDef.h:94
GMemoryHeap * heap
Definition: GFxMovieDef.h:88
GPtr< GASRefCountCollector > refCountCollector
Definition: GFxMovieDef.h:92
HeapLimit heapLimit
Definition: GFxMovieDef.h:95
GPtr< GASStringManager > stringManager
Definition: GFxMovieDef.h:93
Definition: GFxMovieDef.h:62
Definition: GFxMovieDef.h:21
virtual void WaitForFrame(std::uint32_t a_frame) const =0
virtual GFxResource * GetMovieDataResource() const =0
virtual void WaitForLoadFinish(bool a_cancel=false) const =0
virtual std::uint32_t GetLoadingFrame() const =0
virtual std::uint32_t GetMetadata(char *a_buff, std::uint32_t a_buffSize) const =0
virtual GMemoryHeap * GetBindDataHeap() const =0
virtual GFxMovieView * CreateInstance(const MemoryParams &a_memParams, bool a_initFirstFrame=true)=0
virtual MemoryContext * CreateMemoryContext(const char *a_heapName, const MemoryParams &a_memParams, bool a_debugHeap)=0
virtual const GFxExporterInfo * GetExporterInfo() const =0
virtual float GetWidth() const =0
virtual GRectF GetFrameRect() const =0
virtual GMemoryHeap * GetLoadDataHeap() const =0
virtual const char * GetFileURL() const =0
virtual GFxMovieView * CreateInstance(MemoryContext *a_memContext, bool a_initFirstFrame=true)=0
virtual void VisitImportedMovies(ImportVisitor *a_visitor)=0
GFxMovieView * CreateInstance(bool a_initFirstFrame=true, UPInt a_memoryArena=0)
virtual std::uint32_t GetVersion() const =0
virtual std::uint32_t GetFrameCount() const =0
virtual float GetHeight() const =0
virtual GMemoryHeap * GetImageHeap() const =0
virtual std::uint32_t GetSWFFlags() const =0
virtual void VisitResources(ResourceVisitor *a_visitor, VisitResourceMask a_visitMask=VisitResourceMask::kAllImages)=0
virtual std::uint32_t GetFileAttributes() const =0
VisitResourceMask
Definition: GFxMovieDef.h:32
@ kGradientImages
Definition: GFxMovieDef.h:38
@ kEditTextFields
Definition: GFxMovieDef.h:39
@ kBitmaps
Definition: GFxMovieDef.h:37
@ kAllLocalImages
Definition: GFxMovieDef.h:44
@ kSounds
Definition: GFxMovieDef.h:40
@ kAllImages
Definition: GFxMovieDef.h:45
@ kNestedMovies
Definition: GFxMovieDef.h:33
@ kFonts
Definition: GFxMovieDef.h:36
@ kSprite
Definition: GFxMovieDef.h:41
FileAttrFlags
Definition: GFxMovieDef.h:25
@ kHasMetadata
Definition: GFxMovieDef.h:27
@ kUseNetwork
Definition: GFxMovieDef.h:26
virtual float GetFrameRate() const =0
virtual GFxResource * GetResource(const char *a_exportName) const =0
Definition: GFxMovieView.h:24
Definition: GFxResourceID.h:6
Definition: GFxResource.h:15
Definition: GFxStateBag.h:11
Definition: GMemoryHeap.h:16
Definition: GRefCountBase.h:12
Definition: AbsorbEffect.h:6
std::size_t UPInt
Definition: SFTypes.h:5
Definition: GFxMovieDef.h:100
virtual void Visit(GFxMovieDef *a_parentDef, GFxMovieDef *a_importDef, const char *a_importedMovieFilename)=0
Definition: GFxMovieDef.h:49
MemoryParams(UPInt a_memoryArena=0)
float heapLimitMultiplier
Definition: GFxMovieDef.h:54
GMemoryHeap::HeapDesc desc
Definition: GFxMovieDef.h:53
std::uint32_t pad4C
Definition: GFxMovieDef.h:57
std::uint32_t maxCollectionRoots
Definition: GFxMovieDef.h:55
std::uint32_t framesBetweenCollections
Definition: GFxMovieDef.h:56
Definition: GFxMovieDef.h:109
virtual void Visit(GFxMovieDef *a_movieDef, GFxResource *a_resource, GFxResourceID a_id, const char *a_exportName)=0
Definition: GMemoryHeap.h:60
Definition: GMemoryHeap.h:114