runtimeContainer.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #pragma once
  2. #include <pikaConfig.h>
  3. #include <string>
  4. #include <baseContainer.h>
  5. #include <memoryArena/memoryArena.h>
  6. #include <pikaAllocator/freeListAllocator.h>
  7. #include <IconsForkAwesome.h>
  8. namespace pika
  9. {
  10. struct RuntimeContainer
  11. {
  12. //this is the base adress of the runtime container. here is the beginning of all the allocated memory
  13. void *getBaseAdress() { return arena.containerStructMemory.block; };
  14. char baseContainerName[50] = {};
  15. //std::string name = {};
  16. //this is the pointer to the container virtual class
  17. Container *pointer = {};
  18. //this is the container memory arena. here we have all the static data of the container
  19. pika::memory::MemoryArena arena = {};
  20. //this is the allocator of the arena.
  21. pika::memory::FreeListAllocator allocator = {};
  22. size_t totalSize = 0;
  23. //bonus allocators
  24. pika::StaticVector<pika::memory::FreeListAllocator, MaxAllocatorsCount> bonusAllocators = {};
  25. RequestedContainerInfo requestedContainerInfo = {};
  26. int imguiWindowId = 0;
  27. unsigned int frameCounter = 0;
  28. float frameTimer = 0;
  29. float currentMs = 0;
  30. bool lastFrameFocus = 0;
  31. //passed from container static info
  32. bool andInputWithWindowHasFocus = 0;
  33. bool andInputWithWindowHasFocusLastFrame = 0;
  34. struct FLAGS
  35. {
  36. enum
  37. {
  38. STATUS_PAUSE = 0,
  39. STATUS_RUNNING = 1,
  40. STATUS_BEING_RECORDED = 2,
  41. STATUS_BEING_PLAYBACK = 3,
  42. };
  43. int status = STATUS_RUNNING;
  44. bool shouldCallReaload = 0; //if the container happens to be on pause when the dll reloads we mark this to true
  45. char recordingName[256] = {};
  46. int frameNumber = 0;
  47. const char *getStatusName()
  48. {
  49. if (status == STATUS_RUNNING)
  50. {
  51. return "running.";
  52. }
  53. else if(status == STATUS_PAUSE)
  54. {
  55. if (shouldCallReaload)
  56. {
  57. return "paused, waiting reload.";
  58. }
  59. else
  60. {
  61. return "paused.";
  62. }
  63. }
  64. else if (status == STATUS_BEING_RECORDED)
  65. {
  66. return "on recording";
  67. }
  68. else if (status == STATUS_BEING_PLAYBACK)
  69. {
  70. return "on input playback";
  71. }
  72. }
  73. const char *getStatusIcon()
  74. {
  75. if (status == STATUS_RUNNING)
  76. {
  77. return ICON_FK_BOLT;
  78. }
  79. else if (status == STATUS_PAUSE)
  80. {
  81. return ICON_FK_PAUSE_CIRCLE_O;
  82. }
  83. else if (status == STATUS_BEING_RECORDED)
  84. {
  85. return ICON_FK_VIDEO_CAMERA;
  86. }
  87. else if (status == STATUS_BEING_PLAYBACK)
  88. {
  89. return ICON_FK_REPEAT;
  90. }
  91. }
  92. }flags;
  93. };
  94. }