ISystem.h 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/PlatformDef.h>
  10. #ifdef CRYSYSTEM_EXPORTS
  11. #define CRYSYSTEM_API AZ_DLL_EXPORT
  12. #else
  13. #define CRYSYSTEM_API AZ_DLL_IMPORT
  14. #endif
  15. #include <AzCore/IO/SystemFile.h>
  16. #include "CryAssert.h"
  17. #include <CryCommon/IValidator.h>
  18. #if defined(AZ_RESTRICTED_PLATFORM)
  19. #undef AZ_RESTRICTED_SECTION
  20. #define ISYSTEM_H_SECTION_1 1
  21. #define ISYSTEM_H_SECTION_2 2
  22. #define ISYSTEM_H_SECTION_3 3
  23. #define ISYSTEM_H_SECTION_4 4
  24. #define ISYSTEM_H_SECTION_5 5
  25. #endif
  26. ////////////////////////////////////////////////////////////////////////////////////////////////
  27. // Forward declarations
  28. ////////////////////////////////////////////////////////////////////////////////////////////////
  29. #include <IXml.h> // <> required for Interfuscator
  30. #include <ILog.h> // <> required for Interfuscator
  31. #include "CryVersion.h"
  32. #include "smartptr.h"
  33. #include <memory> // shared_ptr
  34. #include <CrySystemBus.h>
  35. struct ISystem;
  36. struct ILog;
  37. namespace AZ::IO
  38. {
  39. struct IArchive;
  40. }
  41. struct IConsole;
  42. struct IRemoteConsole;
  43. struct IRenderer;
  44. struct ICryFont;
  45. struct IMovieSystem;
  46. struct SFileVersion;
  47. struct INameTable;
  48. struct ILevelSystem;
  49. class IXMLBinarySerializer;
  50. struct IAVI_Reader;
  51. struct ILocalizationManager;
  52. struct IOutputPrintSink;
  53. struct IWindowMessageHandler;
  54. namespace AZ
  55. {
  56. namespace IO
  57. {
  58. class FileIOBase;
  59. }
  60. }
  61. typedef void* WIN_HWND;
  62. struct CLoadingTimeProfiler;
  63. class ICmdLine;
  64. class ILyShine;
  65. enum EValidatorModule : int;
  66. enum EValidatorSeverity : int;
  67. enum ESystemUpdateFlags
  68. {
  69. // Summary:
  70. // Special update mode for editor.
  71. ESYSUPDATE_EDITOR = 0x0004
  72. };
  73. // Description:
  74. // Configuration platform. Autodetected at start, can be modified through the editor.
  75. enum ESystemConfigPlatform
  76. {
  77. CONFIG_INVALID_PLATFORM = 0,
  78. CONFIG_PC = 1,
  79. CONFIG_MAC = 2,
  80. CONFIG_OSX_METAL = 3,
  81. CONFIG_ANDROID = 4,
  82. CONFIG_IOS = 5,
  83. CONFIG_PROVO = 7,
  84. CONFIG_SALEM = 8,
  85. CONFIG_JASPER = 9,
  86. END_CONFIG_PLATFORM_ENUM, // MUST BE LAST VALUE. USED FOR ERROR CHECKING.
  87. };
  88. enum ESystemGlobalState
  89. {
  90. ESYSTEM_GLOBAL_STATE_UNKNOWN,
  91. ESYSTEM_GLOBAL_STATE_INIT,
  92. ESYSTEM_GLOBAL_STATE_RUNNING,
  93. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PREPARE,
  94. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START,
  95. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_MATERIALS,
  96. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_OBJECTS,
  97. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_STATIC_WORLD,
  98. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PRECACHE,
  99. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_TEXTURES,
  100. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_END,
  101. ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_COMPLETE
  102. };
  103. // Summary:
  104. // System wide events.
  105. enum ESystemEvent
  106. {
  107. // Description:
  108. // Seeds all random number generators to the same seed number, WParam will hold seed value.
  109. //##@{
  110. ESYSTEM_EVENT_RANDOM_SEED = 1,
  111. ESYSTEM_EVENT_RANDOM_ENABLE,
  112. ESYSTEM_EVENT_RANDOM_DISABLE,
  113. //##@}
  114. // Description:
  115. // Changes to main window focus.
  116. // wparam is not 0 is focused, 0 if not focused
  117. ESYSTEM_EVENT_CHANGE_FOCUS = 10,
  118. // Description:
  119. // Moves of the main window.
  120. // wparam=x, lparam=y
  121. ESYSTEM_EVENT_MOVE = 11,
  122. // Description:
  123. // Resizes of the main window.
  124. // wparam=width, lparam=height
  125. ESYSTEM_EVENT_RESIZE = 12,
  126. // Description:
  127. // Activation of the main window.
  128. // wparam=1/0, 1=active 0=inactive
  129. ESYSTEM_EVENT_ACTIVATE = 13,
  130. // Description:
  131. // Main window position changed.
  132. ESYSTEM_EVENT_POS_CHANGED = 14,
  133. // Description:
  134. // Main window style changed.
  135. ESYSTEM_EVENT_STYLE_CHANGED = 15,
  136. // Description:
  137. // Sent before the loading movie is begun
  138. ESYSTEM_EVENT_LEVEL_LOAD_START_PRELOADINGSCREEN,
  139. // Description:
  140. // Sent before the loading last save
  141. ESYSTEM_EVENT_LEVEL_LOAD_RESUME_GAME,
  142. // Description:
  143. // Sent before starting level, before game rules initialization and before ESYSTEM_EVENT_LEVEL_LOAD_START event
  144. // Used mostly for level loading profiling
  145. ESYSTEM_EVENT_LEVEL_LOAD_PREPARE,
  146. // Description:
  147. // Sent to start the active loading screen rendering.
  148. ESYSTEM_EVENT_LEVEL_LOAD_START_LOADINGSCREEN,
  149. // Description:
  150. // Sent when loading screen is active
  151. ESYSTEM_EVENT_LEVEL_LOAD_LOADINGSCREEN_ACTIVE,
  152. // Description:
  153. // Sent before starting loading a new level.
  154. // Used for a more efficient resource management.
  155. ESYSTEM_EVENT_LEVEL_LOAD_START,
  156. // Description:
  157. // Sent after loading a level finished.
  158. // Used for a more efficient resource management.
  159. ESYSTEM_EVENT_LEVEL_LOAD_END,
  160. // Description:
  161. // Sent after trying to load a level failed.
  162. // Used for resetting the front end.
  163. ESYSTEM_EVENT_LEVEL_LOAD_ERROR,
  164. // Description:
  165. // Sent in case the level was requested to load, but it's not ready
  166. // Used in streaming install scenario for notifying the front end.
  167. ESYSTEM_EVENT_LEVEL_NOT_READY,
  168. // Description:
  169. // Sent after precaching of the streaming system has been done
  170. ESYSTEM_EVENT_LEVEL_PRECACHE_START,
  171. // Description:
  172. // Sent before object/texture precache stream requests are submitted
  173. ESYSTEM_EVENT_LEVEL_PRECACHE_FIRST_FRAME,
  174. // Description:
  175. // Sent when level loading is completely finished with no more onscreen
  176. // movie or info rendering, and when actual gameplay can start
  177. ESYSTEM_EVENT_LEVEL_GAMEPLAY_START,
  178. // Level is unloading.
  179. ESYSTEM_EVENT_LEVEL_UNLOAD,
  180. // Summary:
  181. // Sent after level have been unloaded. For cleanup code.
  182. ESYSTEM_EVENT_LEVEL_POST_UNLOAD,
  183. // Summary:
  184. // Called when the game framework has been initialized.
  185. ESYSTEM_EVENT_GAME_POST_INIT,
  186. // Summary:
  187. // Called when the game framework has been initialized, not loading should happen in this event.
  188. ESYSTEM_EVENT_GAME_POST_INIT_DONE,
  189. // Summary:
  190. // Sent when the system is doing a full shutdown.
  191. ESYSTEM_EVENT_FULL_SHUTDOWN,
  192. // Summary:
  193. // Sent when the system is doing a fast shutdown.
  194. ESYSTEM_EVENT_FAST_SHUTDOWN,
  195. // Summary:
  196. // When keyboard layout changed.
  197. ESYSTEM_EVENT_LANGUAGE_CHANGE,
  198. // Description:
  199. // Toggled fullscreen.
  200. // wparam is 1 means we switched to fullscreen, 0 if for windowed
  201. ESYSTEM_EVENT_TOGGLE_FULLSCREEN,
  202. ESYSTEM_EVENT_SHARE_SHADER_COMBINATIONS,
  203. // Summary:
  204. // Start 3D post rendering
  205. ESYSTEM_EVENT_3D_POST_RENDERING_START,
  206. // Summary:
  207. // End 3D post rendering
  208. ESYSTEM_EVENT_3D_POST_RENDERING_END,
  209. // Summary:
  210. // Called before switching to level memory heap
  211. ESYSTEM_EVENT_SWITCHING_TO_LEVEL_HEAP_DEPRECATED,
  212. // Summary:
  213. // Called after switching to level memory heap
  214. ESYSTEM_EVENT_SWITCHED_TO_LEVEL_HEAP_DEPRECATED,
  215. // Summary:
  216. // Called before switching to global memory heap
  217. ESYSTEM_EVENT_SWITCHING_TO_GLOBAL_HEAP_DEPRECATED,
  218. // Summary:
  219. // Called after switching to global memory heap
  220. ESYSTEM_EVENT_SWITCHED_TO_GLOBAL_HEAP_DEPRECATED,
  221. // Description:
  222. // Sent after precaching of the streaming system has been done
  223. ESYSTEM_EVENT_LEVEL_PRECACHE_END,
  224. // Description:
  225. // Sent when game mode switch begins
  226. ESYSTEM_EVENT_GAME_MODE_SWITCH_START,
  227. // Description:
  228. // Sent when game mode switch ends
  229. ESYSTEM_EVENT_GAME_MODE_SWITCH_END,
  230. // Description:
  231. // Video notifications
  232. // wparam=[0/1/2/3] : [stop/play/pause/resume]
  233. ESYSTEM_EVENT_VIDEO,
  234. // Description:
  235. // Sent if the game is paused
  236. ESYSTEM_EVENT_GAME_PAUSED,
  237. // Description:
  238. // Sent if the game is resumed
  239. ESYSTEM_EVENT_GAME_RESUMED,
  240. // Description:
  241. // Sent when time of day is set
  242. ESYSTEM_EVENT_TIME_OF_DAY_SET,
  243. // Description:
  244. // Sent once the Editor finished initialization.
  245. ESYSTEM_EVENT_EDITOR_ON_INIT,
  246. // Description:
  247. // Sent when frontend is initialised
  248. ESYSTEM_EVENT_FRONTEND_INITIALISED,
  249. // Description:
  250. // Sent once the Editor switches between in-game and editing mode.
  251. ESYSTEM_EVENT_EDITOR_GAME_MODE_CHANGED,
  252. // Description:
  253. // Sent once the Editor switches simulation mode (AI/Physics).
  254. ESYSTEM_EVENT_EDITOR_SIMULATION_MODE_CHANGED,
  255. // Description:
  256. // Sent when frontend is reloaded
  257. ESYSTEM_EVENT_FRONTEND_RELOADED,
  258. #if defined(AZ_RESTRICTED_PLATFORM)
  259. #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_1
  260. #include AZ_RESTRICTED_FILE(ISystem_h)
  261. #endif
  262. #if defined(AZ_RESTRICTED_PLATFORM)
  263. #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_2
  264. #include AZ_RESTRICTED_FILE(ISystem_h)
  265. #endif
  266. ESYSTEM_EVENT_STREAMING_INSTALL_ERROR,
  267. // Description:
  268. // Sent when the online services are initialized.
  269. ESYSTEM_EVENT_ONLINE_SERVICES_INITIALISED,
  270. // Description:
  271. // Sent when a new audio implementation is loaded
  272. ESYSTEM_EVENT_AUDIO_IMPLEMENTATION_LOADED,
  273. // Description:
  274. // Sent when simulation mode switch begins
  275. ESYSTEM_EVENT_EDITOR_SIMULATION_MODE_SWITCH_START,
  276. // Description:
  277. // Sent when simluation mode switch ends
  278. ESYSTEM_EVENT_EDITOR_SIMULATION_MODE_SWITCH_END,
  279. ESYSTEM_EVENT_USER = 0x1000,
  280. ESYSTEM_BEAM_PLAYER_TO_CAMERA_POS
  281. };
  282. // Description:
  283. // User defined callback, which can be passed to ISystem.
  284. struct ISystemUserCallback
  285. {
  286. // <interfuscator:shuffle>
  287. virtual ~ISystemUserCallback() {}
  288. // Description:
  289. // This method is called at the earliest point the ISystem pointer can be used
  290. // the log might not be yet there.
  291. virtual void OnSystemConnect([[maybe_unused]] ISystem* pSystem) {}
  292. // Summary:
  293. // Signals to User that engine error occurred.
  294. // Return Value:
  295. // True to Halt execution or false to ignore this error
  296. virtual bool OnError(const char* szErrorString) = 0;
  297. // Notes:
  298. // If working in Editor environment notify user that engine want to Save current document.
  299. // This happens if critical error have occurred and engine gives a user way to save data and not lose it
  300. // due to crash.
  301. virtual bool OnSaveDocument() = 0;
  302. // Notes:
  303. // If working in Editor environment and a critical error occurs notify the user to backup
  304. // the current document to prevent data loss due to crash.
  305. virtual bool OnBackupDocument() = 0;
  306. // Description:
  307. // Notifies user that system wants to switch out of current process.
  308. // Example:
  309. // Called when pressing ESC in game mode to go to Menu.
  310. virtual void OnProcessSwitch() = 0;
  311. // Description:
  312. // Notifies user, usually editor, about initialization progress in system.
  313. virtual void OnInitProgress(const char* sProgressMsg) = 0;
  314. // Description:
  315. // Initialization callback. This is called early in CSystem::Init(), before
  316. // any of the other callback methods is called.
  317. // See also:
  318. // CSystem::Init()
  319. virtual void OnInit(ISystem*) { }
  320. // Summary:
  321. // Shutdown callback.
  322. virtual void OnShutdown() { }
  323. // Summary:
  324. // Quit callback.
  325. // See also:
  326. // CSystem::Quit()
  327. virtual void OnQuit() { }
  328. // Description:
  329. // Notify user of an update iteration. Called in the update loop.
  330. virtual void OnUpdate() { }
  331. // Description:
  332. // Show message by provider.
  333. virtual void ShowMessage(const char* text, const char* caption, unsigned int uType) { CryMessageBox(text, caption, uType); }
  334. // </interfuscator:shuffle>
  335. // Post console load, for cvar setting
  336. virtual void OnConsoleCreated([[maybe_unused]] ::IConsole* pConsole) {}
  337. };
  338. // Description:
  339. // Interface used for getting notified when a system event occurs.
  340. struct ISystemEventListener
  341. {
  342. // <interfuscator:shuffle>
  343. virtual ~ISystemEventListener() {}
  344. virtual void OnSystemEventAnyThread([[maybe_unused]] ESystemEvent event, [[maybe_unused]] UINT_PTR wparam, [[maybe_unused]] UINT_PTR lparam) {}
  345. virtual void OnSystemEvent([[maybe_unused]] ESystemEvent event, [[maybe_unused]] UINT_PTR wparam, [[maybe_unused]] UINT_PTR lparam) { }
  346. // </interfuscator:shuffle>
  347. };
  348. // Description:
  349. // Structure used for getting notified when a system event occurs.
  350. struct ISystemEventDispatcher
  351. {
  352. // <interfuscator:shuffle>
  353. virtual ~ISystemEventDispatcher() {}
  354. virtual bool RegisterListener(ISystemEventListener* pListener) = 0;
  355. virtual bool RemoveListener(ISystemEventListener* pListener) = 0;
  356. virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) = 0;
  357. virtual void Update() = 0;
  358. //virtual void OnLocaleChange() = 0;
  359. // </interfuscator:shuffle>
  360. };
  361. struct IErrorObserver
  362. {
  363. // <interfuscator:shuffle>
  364. virtual ~IErrorObserver() {}
  365. virtual void OnAssert(const char* condition, const char* message, const char* fileName, unsigned int fileLineNumber) = 0;
  366. virtual void OnFatalError(const char* message) = 0;
  367. // </interfuscator:shuffle>
  368. };
  369. #if defined(AZ_RESTRICTED_PLATFORM)
  370. #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_3
  371. #include AZ_RESTRICTED_FILE(ISystem_h)
  372. #endif
  373. namespace AZ
  374. {
  375. namespace Internal
  376. {
  377. class EnvironmentInterface;
  378. } // namespace Internal
  379. } // namespace AZ
  380. // Description:
  381. // Structure passed to Init method of ISystem interface.
  382. struct SSystemInitParams
  383. {
  384. void* hInstance; //
  385. void* hWnd; //
  386. ILog* pLog; // You can specify your own ILog to be used by System.
  387. ILogCallback* pLogCallback; // You can specify your own ILogCallback to be added on log creation (used by Editor).
  388. ISystemUserCallback* pUserCallback;
  389. const char* sLogFileName; // File name to use for log.
  390. bool autoBackupLogs; // if true, logs will be automatically backed up each startup
  391. IOutputPrintSink* pPrintSync; // Print Sync which can be used to catch all output from engine
  392. char szSystemCmdLine[2048]; // Command line.
  393. bool bEditor; // When running in Editor mode.
  394. bool bPreview; // When running in Preview mode (Minimal initialization).
  395. bool bTestMode; // When running in Automated testing mode.
  396. bool bDedicatedServer; // When running a dedicated server.
  397. bool bSkipConsole; // Don't create console
  398. bool bUnattendedMode; // When running as part of a build on build-machines: Prevent popping up of any dialog
  399. bool bSkipMovie; // Don't load movie
  400. bool bToolMode; // System is running inside a tool. Will not create USER directory or anything else that the game needs to do
  401. ISystem* pSystem; // Pointer to existing ISystem interface, it will be reused if not NULL.
  402. // Summary:
  403. // Initialization defaults.
  404. SSystemInitParams()
  405. {
  406. hInstance = NULL;
  407. hWnd = NULL;
  408. pLog = NULL;
  409. pLogCallback = NULL;
  410. pUserCallback = NULL;
  411. sLogFileName = NULL;
  412. autoBackupLogs = true;
  413. pPrintSync = NULL;
  414. memset(szSystemCmdLine, 0, sizeof(szSystemCmdLine));
  415. bEditor = false;
  416. bPreview = false;
  417. bTestMode = false;
  418. bDedicatedServer = false;
  419. bSkipConsole = false;
  420. bUnattendedMode = false;
  421. bSkipMovie = false;
  422. bToolMode = false;
  423. pSystem = NULL;
  424. }
  425. };
  426. // Notes:
  427. // Can be used for LoadConfiguration().
  428. // See also:
  429. // LoadConfiguration()
  430. struct ILoadConfigurationEntrySink
  431. {
  432. // <interfuscator:shuffle>
  433. virtual ~ILoadConfigurationEntrySink() {}
  434. virtual void OnLoadConfigurationEntry(const char* szKey, const char* szValue, const char* szGroup) = 0;
  435. virtual void OnLoadConfigurationEntry_End() {}
  436. // </interfuscator:shuffle>
  437. };
  438. struct SPlatformInfo
  439. {
  440. unsigned int numCoresAvailableToProcess;
  441. unsigned int numLogicalProcessors;
  442. #if defined(WIN32) || defined(WIN64)
  443. enum EWinVersion
  444. {
  445. WinUndetected,
  446. Win2000,
  447. WinXP,
  448. WinSrv2003,
  449. WinVista,
  450. Win7,
  451. Win8,
  452. Win81,
  453. Win10
  454. };
  455. EWinVersion winVer;
  456. bool win64Bit;
  457. bool vistaKB940105Required;
  458. #endif
  459. };
  460. // Description:
  461. // Holds info about system update stats over perior of time (cvar-tweakable)
  462. struct SSystemUpdateStats
  463. {
  464. SSystemUpdateStats()
  465. : avgUpdateTime(0.0f)
  466. , minUpdateTime(0.0f)
  467. , maxUpdateTime(0.0f) {}
  468. float avgUpdateTime;
  469. float minUpdateTime;
  470. float maxUpdateTime;
  471. };
  472. // Description:
  473. // Global environment.
  474. // Contains pointers to all global often needed interfaces.
  475. // This is a faster way to get interface pointer then calling ISystem interface to retrieve one.
  476. // Notes:
  477. // Some pointers can be NULL, use with care.
  478. // See also:
  479. // ISystem
  480. struct SSystemGlobalEnvironment
  481. {
  482. AZ::IO::IArchive* pCryPak;
  483. AZ::IO::FileIOBase* pFileIO;
  484. ICryFont* pCryFont;
  485. ::IConsole* pConsole;
  486. ISystem* pSystem = nullptr;
  487. ILog* pLog;
  488. #if defined(AZ_RESTRICTED_PLATFORM)
  489. #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_4
  490. #include AZ_RESTRICTED_FILE(ISystem_h)
  491. #endif
  492. threadID mMainThreadId; //The main thread ID is used in multiple systems so should be stored globally
  493. //////////////////////////////////////////////////////////////////////////
  494. // Used by CRY_ASSERT
  495. bool bIgnoreAllAsserts;
  496. bool bNoAssertDialog;
  497. //////////////////////////////////////////////////////////////////////////
  498. bool bToolMode;
  499. int retCode = 0;
  500. ILINE const bool IsDedicated() const
  501. {
  502. #if defined(CONSOLE)
  503. return false;
  504. #else
  505. return bDedicated;
  506. #endif
  507. }
  508. #if !defined(CONSOLE)
  509. ILINE void SetIsEditor(bool isEditor)
  510. {
  511. bEditor = isEditor;
  512. }
  513. ILINE void SetIsEditorGameMode(bool isEditorGameMode)
  514. {
  515. bEditorGameMode = isEditorGameMode;
  516. }
  517. ILINE void SetIsEditorSimulationMode(bool isEditorSimulationMode)
  518. {
  519. bEditorSimulationMode = isEditorSimulationMode;
  520. }
  521. ILINE void SetIsDedicated(bool isDedicated)
  522. {
  523. bDedicated = isDedicated;
  524. }
  525. #endif
  526. //this way the compiler can strip out code for consoles
  527. ILINE const bool IsEditor() const
  528. {
  529. #if defined(CONSOLE)
  530. return false;
  531. #else
  532. return bEditor;
  533. #endif
  534. }
  535. ILINE const bool IsEditorGameMode() const
  536. {
  537. #if defined(CONSOLE)
  538. return false;
  539. #else
  540. return bEditorGameMode;
  541. #endif
  542. }
  543. ILINE const bool IsEditorSimulationMode() const
  544. {
  545. #if defined(CONSOLE)
  546. return false;
  547. #else
  548. return bEditorSimulationMode;
  549. #endif
  550. }
  551. ILINE const bool IsEditing() const
  552. {
  553. #if defined(CONSOLE)
  554. return false;
  555. #else
  556. return bEditor && !bEditorGameMode;
  557. #endif
  558. }
  559. ILINE bool IsInToolMode() const
  560. {
  561. return bToolMode;
  562. }
  563. ILINE void SetToolMode(bool bNewToolMode)
  564. {
  565. bToolMode = bNewToolMode;
  566. }
  567. #if !defined(CONSOLE)
  568. private:
  569. bool bEditor; // Engine is running under editor.
  570. bool bEditorGameMode; // Engine is in editor game mode.
  571. bool bEditorSimulationMode; // Engine is in editor simulation mode.
  572. bool bDedicated; // Engine is in dedicated
  573. #endif
  574. public:
  575. SSystemGlobalEnvironment()
  576. : bToolMode(false)
  577. {
  578. };
  579. };
  580. // NOTE Nov 25, 2008: <pvl> the ISystem interface that follows has a member function
  581. // called 'GetUserName'. If we don't #undef'ine the same-named Win32 symbol here
  582. // ISystem wouldn't even compile.
  583. // TODO Nov 25, 2008: <pvl> there might be a better place for this?
  584. #ifdef GetUserName
  585. #undef GetUserName
  586. #endif
  587. ////////////////////////////////////////////////////////////////////////////////////////////////
  588. // Description:
  589. // Main Engine Interface.
  590. // Initialize and dispatch all engine's subsystems.
  591. struct ISystem
  592. {
  593. // <interfuscator:shuffle>
  594. virtual ~ISystem() {}
  595. // Summary:
  596. // Releases ISystem.
  597. virtual void Release() = 0;
  598. // Summary:
  599. // Returns pointer to the global environment structure.
  600. virtual SSystemGlobalEnvironment* GetGlobalEnvironment() = 0;
  601. // Summary:
  602. // Updates all subsystems (including the ScriptSink() )
  603. // Arguments:
  604. // flags - One or more flags from ESystemUpdateFlags structure.
  605. // nPauseMode - 0=normal(no pause), 1=menu/pause, 2=cutscene
  606. virtual bool UpdatePreTickBus(int updateFlags = 0, int nPauseMode = 0) = 0;
  607. // Summary:
  608. // Updates all subsystems (including the ScriptSink() )
  609. // Arguments:
  610. // flags - One or more flags from ESystemUpdateFlags structure.
  611. // nPauseMode - 0=normal(no pause), 1=menu/pause, 2=cutscene
  612. virtual bool UpdatePostTickBus(int updateFlags = 0, int nPauseMode = 0) = 0;
  613. // Summary:
  614. // Updates only require components during loading
  615. virtual bool UpdateLoadtime() = 0;
  616. // Summary:
  617. // Retrieve the name of the user currently logged in to the computer.
  618. virtual const char* GetUserName() = 0;
  619. // Summary:
  620. // Quits the application.
  621. virtual void Quit() = 0;
  622. // Summary:
  623. // Tells the system if it is relaunching or not.
  624. virtual void Relaunch(bool bRelaunch) = 0;
  625. // Summary:
  626. // Returns true if the application is in the shutdown phase.
  627. virtual bool IsQuitting() const = 0;
  628. // Summary:
  629. // Tells the system in which way we are using the serialization system.
  630. virtual void SerializingFile(int mode) = 0;
  631. virtual int IsSerializingFile() const = 0;
  632. virtual bool IsRelaunch() const = 0;
  633. // Description:
  634. // Displays error message.
  635. // Logs it to console and file and error message box then terminates execution.
  636. virtual void FatalError(const char* sFormat, ...) PRINTF_PARAMS(2, 3) = 0;
  637. // Description:
  638. // Reports a bug using the crash handler.
  639. // Logs an error to the console and launches the crash handler, then continues execution.
  640. virtual void ReportBug(const char* sFormat, ...) PRINTF_PARAMS(2, 3) = 0;
  641. // Description:
  642. // Report warning to current Validator object.
  643. // Doesn't terminate the execution.
  644. //##@{
  645. virtual void WarningV(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, va_list args) = 0;
  646. virtual void Warning(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, ...) = 0;
  647. //##@}
  648. // Description:
  649. // Report message by provider or by using CryMessageBox.
  650. // Doesn't terminate the execution.
  651. virtual void ShowMessage(const char* text, const char* caption, unsigned int uType) = 0;
  652. // Summary:
  653. // Compare specified verbosity level to the one currently set.
  654. virtual bool CheckLogVerbosity(int verbosity) = 0;
  655. // return the related subsystem interface
  656. virtual ILevelSystem* GetILevelSystem() = 0;
  657. virtual ICmdLine* GetICmdLine() = 0;
  658. virtual ILog* GetILog() = 0;
  659. virtual AZ::IO::IArchive* GetIPak() = 0;
  660. virtual ICryFont* GetICryFont() = 0;
  661. virtual IMovieSystem* GetIMovieSystem() = 0;
  662. virtual ::IConsole* GetIConsole() = 0;
  663. virtual IRemoteConsole* GetIRemoteConsole() = 0;
  664. virtual ISystemEventDispatcher* GetISystemEventDispatcher() = 0;
  665. virtual bool IsDevMode() const = 0;
  666. //////////////////////////////////////////////////////////////////////////
  667. //////////////////////////////////////////////////////////////////////////
  668. // IXmlNode interface.
  669. //////////////////////////////////////////////////////////////////////////
  670. // Summary:
  671. // Creates new xml node.
  672. virtual XmlNodeRef CreateXmlNode(const char* sNodeName = "", bool bReuseStrings = false, bool bIsProcessingInstruction = false) = 0;
  673. // Summary:
  674. // Loads xml from memory buffer, returns 0 if load failed.
  675. virtual XmlNodeRef LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings = false, bool bSuppressWarnings = false) = 0;
  676. // Summary:
  677. // Loads xml file, returns 0 if load failed.
  678. virtual XmlNodeRef LoadXmlFromFile(const char* sFilename, bool bReuseStrings = false) = 0;
  679. // Summary:
  680. // Retrieves access to XML utilities interface.
  681. virtual IXmlUtils* GetXmlUtils() = 0;
  682. // Description:
  683. // When ignore update sets to true, system will ignore and updates and render calls.
  684. virtual void IgnoreUpdates(bool bIgnore) = 0;
  685. // Return Value:
  686. // True if system running in Test mode.
  687. virtual bool IsTestMode() const = 0;
  688. //////////////////////////////////////////////////////////////////////////
  689. // File version.
  690. //////////////////////////////////////////////////////////////////////////
  691. // Summary:
  692. // Gets file version.
  693. virtual const SFileVersion& GetFileVersion() = 0;
  694. // Summary:
  695. // Gets product version.
  696. virtual const SFileVersion& GetProductVersion() = 0;
  697. // Summary:
  698. // Gets build version.
  699. virtual const SFileVersion& GetBuildVersion() = 0;
  700. //////////////////////////////////////////////////////////////////////////
  701. // Configuration.
  702. //////////////////////////////////////////////////////////////////////////
  703. // Summary:
  704. // Loads configurations from CVarGroup directory recursively
  705. // If m_GraphicsSettingsMap is defined (in Graphics Settings Dialog box), fills in mapping based on sys_spec_Full
  706. // Arguments:
  707. // sPath - e.g. "Game/Config/CVarGroups"
  708. virtual void AddCVarGroupDirectory(const AZStd::string& sPath) = 0;
  709. // Summary:
  710. // Saves system configuration.
  711. virtual void SaveConfiguration() = 0;
  712. // Summary:
  713. // Loads system configuration
  714. // Arguments:
  715. // pCallback - 0 means normal LoadConfigVar behaviour is used
  716. virtual void LoadConfiguration(const char* sFilename, ILoadConfigurationEntrySink* pSink = 0, bool warnIfMissing = true) = 0;
  717. //////////////////////////////////////////////////////////////////////////
  718. // Summary:
  719. // Retrieves current configuration platform
  720. virtual ESystemConfigPlatform GetConfigPlatform() const = 0;
  721. // Summary:
  722. // Changes current configuration platform.
  723. virtual void SetConfigPlatform(ESystemConfigPlatform platform) = 0;
  724. //////////////////////////////////////////////////////////////////////////
  725. // Summary:
  726. // Query if system is now paused.
  727. // Pause flag is set when calling system update with pause mode.
  728. virtual bool IsPaused() const = 0;
  729. // Summary:
  730. // Retrieves localized strings manager interface.
  731. virtual ILocalizationManager* GetLocalizationManager() = 0;
  732. //////////////////////////////////////////////////////////////////////////
  733. // Error callback handling
  734. // Summary:
  735. // Registers listeners to CryAssert and error messages. (may not be called if asserts are disabled)
  736. // Each pointer can be registered only once. (stl::push_back_unique)
  737. // It will return false if the pointer is already registered. Returns true, otherwise.
  738. virtual bool RegisterErrorObserver(IErrorObserver* errorObserver) = 0;
  739. // Summary:
  740. // Unregisters listeners to CryAssert and error messages.
  741. // It will return false if the pointer is not registered. Otherwise, returns true.
  742. virtual bool UnregisterErrorObserver(IErrorObserver* errorObserver) = 0;
  743. // Summary:
  744. // Called after the processing of the assert message box on some platforms.
  745. // It will be called even when asserts are disabled by the console variables.
  746. virtual void OnAssert(const char* condition, const char* message, const char* fileName, unsigned int fileLineNumber) = 0;
  747. // Summary:
  748. // Returns if the assert window from CryAssert is visible.
  749. // OBS1: needed by the editor, as in some cases it can freeze if during an assert engine it will handle
  750. // some events such as mouse movement in a CryPhysics assert.
  751. // OBS2: it will always return false, if asserts are disabled or ignored.
  752. virtual bool IsAssertDialogVisible() const = 0;
  753. // Summary:
  754. // Sets the AssertVisisble internal variable.
  755. // Typically it should only be called by CryAssert.
  756. virtual void SetAssertVisible(bool bAssertVisble) = 0;
  757. //////////////////////////////////////////////////////////////////////////
  758. // Summary:
  759. // Get the index of the currently running O3DE application. (0 = first instance, 1 = second instance, etc)
  760. virtual int GetApplicationInstance() = 0;
  761. // Summary:
  762. // Get log index of the currently running Open 3D Engine application. (0 = first instance, 1 = second instance, etc)
  763. virtual int GetApplicationLogInstance(const char* logFilePath) = 0;
  764. // Summary:
  765. // Clear all currently logged and drawn on screen error messages
  766. virtual void ClearErrorMessages() = 0;
  767. //////////////////////////////////////////////////////////////////////////
  768. // For debugging use only!, query current C++ call stack.
  769. //////////////////////////////////////////////////////////////////////////
  770. // Notes:
  771. // Pass nCount to indicate maximum number of functions to get.
  772. // For debugging use only, query current C++ call stack.
  773. // Description:
  774. // Fills array of function pointers, nCount return number of functions.
  775. virtual void debug_GetCallStack(const char** pFunctions, int& nCount) = 0;
  776. // Summary:
  777. // Logs current callstack.
  778. // Notes:
  779. // For debugging use only!, query current C++ call stack.
  780. virtual void debug_LogCallStack(int nMaxFuncs = 32, int nFlags = 0) = 0;
  781. // Description:
  782. // Execute command line arguments.
  783. // Should be after init game.
  784. // Example:
  785. // +g_gametype ASSAULT +LoadLevel "testy"
  786. virtual void ExecuteCommandLine(bool deferred=true) = 0;
  787. // Description:
  788. // GetSystemUpdate stats (all systems update without except console)
  789. // very useful on dedicated server as we throttle it to fixed frequency
  790. // returns zeroes if no updates happened yet
  791. virtual void GetUpdateStats(SSystemUpdateStats& stats) = 0;
  792. virtual ESystemGlobalState GetSystemGlobalState(void) = 0;
  793. virtual void SetSystemGlobalState(ESystemGlobalState systemGlobalState) = 0;
  794. #if !defined(_RELEASE)
  795. virtual bool IsSavingResourceList() const = 0;
  796. #endif
  797. // Summary:
  798. // Register a IWindowMessageHandler that will be informed about window messages
  799. // The delivered messages are platform-specific
  800. virtual void RegisterWindowMessageHandler(IWindowMessageHandler* pHandler) = 0;
  801. // Summary:
  802. // Unregister an IWindowMessageHandler that was previously registered using RegisterWindowMessageHandler
  803. virtual void UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler) = 0;
  804. ////////////////////////////////////////////////////////////////////////////////////////////////
  805. // EBus interface used to listen for cry system notifications
  806. class CrySystemNotifications : public AZ::EBusTraits
  807. {
  808. public:
  809. virtual ~CrySystemNotifications() = default;
  810. // Override to be notified right before the call to ISystem::Render
  811. virtual void OnPreRender() {}
  812. // Override to be notified right after the call to ISystem::Render (but before RenderEnd)
  813. virtual void OnPostRender() {}
  814. };
  815. using CrySystemNotificationBus = AZ::EBus<CrySystemNotifications>;
  816. };
  817. //////////////////////////////////////////////////////////////////////////
  818. // CrySystem DLL Exports.
  819. //////////////////////////////////////////////////////////////////////////
  820. typedef ISystem* (*PFNCREATESYSTEMINTERFACE)(SSystemInitParams& initParams);
  821. //////////////////////////////////////////////////////////////////////////
  822. // Global environment variable.
  823. //////////////////////////////////////////////////////////////////////////
  824. extern SSystemGlobalEnvironment* gEnv;
  825. // Summary:
  826. // Gets the system interface.
  827. inline ISystem* GetISystem()
  828. {
  829. // Some unit tests temporarily install and then uninstall ISystem* mocks.
  830. // It is generally okay for runtime and tool systems which call this function to cache the returned pointer,
  831. // because their lifetime is usually shorter than the lifetime of the ISystem* implementation.
  832. // It is NOT safe for this function to cache it as a static itself, though, as the static it would cache
  833. // it inside may outlive the the actual instance implementing ISystem* when unit tests are torn down and then restarted.
  834. ISystem* systemInterface = gEnv ? gEnv->pSystem : nullptr;
  835. if (!systemInterface)
  836. {
  837. CrySystemRequestBus::BroadcastResult(systemInterface, &CrySystemRequests::GetCrySystem);
  838. }
  839. return systemInterface;
  840. };
  841. //////////////////////////////////////////////////////////////////////////
  842. // Description:
  843. // This function must be called once by each module at the beginning, to setup global pointers.
  844. void ModuleInitISystem(ISystem* pSystem, const char* moduleName);
  845. void ModuleShutdownISystem(ISystem* pSystem);
  846. void* GetModuleInitISystemSymbol();
  847. void* GetModuleShutdownISystemSymbol();
  848. #define PREVENT_MODULE_AND_ENVIRONMENT_SYMBOL_STRIPPING \
  849. AZ_UNUSED(GetModuleInitISystemSymbol()); \
  850. AZ_UNUSED(GetModuleShutdownISystemSymbol());
  851. // Summary:
  852. // Interface of the DLL.
  853. extern "C"
  854. {
  855. #if !defined(AZ_MONOLITHIC_BUILD)
  856. CRYSYSTEM_API
  857. #endif
  858. ISystem* CreateSystemInterface(const SSystemInitParams& initParams);
  859. }
  860. // Description:
  861. // Displays error message.
  862. // Logs it to console and file and error message box.
  863. // Then terminates execution.
  864. void CryFatalError(const char*, ...) PRINTF_PARAMS(1, 2);
  865. inline void CryFatalError(const char* format, ...)
  866. {
  867. if (!gEnv || !gEnv->pSystem)
  868. {
  869. return;
  870. }
  871. va_list ArgList;
  872. char szBuffer[MAX_WARNING_LENGTH];
  873. va_start(ArgList, format);
  874. int count = azvsnprintf(szBuffer, sizeof(szBuffer), format, ArgList);
  875. if (count == -1 || count >= sizeof(szBuffer))
  876. {
  877. szBuffer[sizeof(szBuffer) - 1] = '\0';
  878. }
  879. va_end(ArgList);
  880. gEnv->pSystem->FatalError("%s", szBuffer);
  881. }
  882. //////////////////////////////////////////////////////////////////////////
  883. // Description:
  884. // Displays warning message.
  885. // Logs it to console and file and display a warning message box.
  886. // Doesn't terminate execution.
  887. void CryWarning(EValidatorModule, EValidatorSeverity, const char*, ...) PRINTF_PARAMS(3, 4);
  888. inline void CryWarning(EValidatorModule module, EValidatorSeverity severity, const char* format, ...)
  889. {
  890. if (!gEnv || !gEnv->pSystem || !format)
  891. {
  892. return;
  893. }
  894. va_list args;
  895. va_start(args, format);
  896. GetISystem()->WarningV(module, severity, 0, 0, format, args);
  897. va_end(args);
  898. }
  899. #ifdef EXCLUDE_CVARHELP
  900. #define CVARHELP(_comment) 0
  901. #else
  902. #define CVARHELP(_comment) _comment
  903. #endif
  904. //Provide macros for fixing cvars for release mode on consoles to enums to allow for code stripping
  905. //Do not enable for PC, apply VF_CHEAT there if required
  906. #if defined(CONSOLE)
  907. #define CONST_CVAR_FLAGS (VF_CHEAT)
  908. #else
  909. #define CONST_CVAR_FLAGS (VF_NULL)
  910. #endif
  911. #if defined(AZ_RESTRICTED_PLATFORM)
  912. #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_5
  913. #include AZ_RESTRICTED_FILE(ISystem_h)
  914. #endif
  915. #if defined(_RELEASE) && defined(IS_CONSOLE_PLATFORM)
  916. #ifndef LOG_CONST_CVAR_ACCESS
  917. #error LOG_CONST_CVAR_ACCESS should be defined in ProjectDefines.h
  918. #endif
  919. #include "IConsole.h"
  920. namespace Detail
  921. {
  922. template<typename T>
  923. struct SQueryTypeEnum;
  924. template<>
  925. struct SQueryTypeEnum<int>
  926. {
  927. static const int type = CVAR_INT;
  928. static int ParseString(const char* s) { return atoi(s); }
  929. };
  930. template<>
  931. struct SQueryTypeEnum<float>
  932. {
  933. static const int type = CVAR_FLOAT;
  934. static float ParseString(const char* s) { return (float)atof(s); }
  935. };
  936. template<typename T>
  937. struct SDummyCVar
  938. : ICVar
  939. {
  940. const T value;
  941. #if LOG_CONST_CVAR_ACCESS
  942. mutable bool bWasRead;
  943. mutable bool bWasChanged;
  944. SDummyCVar(T val)
  945. : value(val)
  946. , bWasChanged(false)
  947. , bWasRead(false) {}
  948. #else
  949. SDummyCVar(T val)
  950. : value(val) {}
  951. #endif
  952. void WarnUse() const
  953. {
  954. #if LOG_CONST_CVAR_ACCESS
  955. if (!bWasRead)
  956. {
  957. CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "[CVAR] Read from const CVar '%s' via name look-up, this is non-optimal", GetName());
  958. bWasRead = true;
  959. }
  960. #endif
  961. }
  962. void InvalidAccess() const
  963. {
  964. #if LOG_CONST_CVAR_ACCESS
  965. if (!bWasChanged)
  966. {
  967. CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, "[CVAR] Write to const CVar '%s' with wrong value '%f' was ignored. This indicates a bug in code or a config file", GetName(), GetFVal());
  968. bWasChanged = true;
  969. }
  970. #endif
  971. }
  972. void Release() {}
  973. int GetIVal() const { WarnUse(); return static_cast<int>(value); }
  974. int64 GetI64Val() const { WarnUse(); return static_cast<int64>(value); }
  975. float GetFVal() const { WarnUse(); return static_cast<float>(value); }
  976. const char* GetString() const { return ""; }
  977. const char* GetDataProbeString() const { return ""; }
  978. void Set(const char* s)
  979. {
  980. if (SQueryTypeEnum<T>::ParseString(s) != value)
  981. {
  982. InvalidAccess();
  983. }
  984. }
  985. void ForceSet(const char* s) { Set(s); }
  986. void Set(const float f)
  987. {
  988. if (static_cast<T>(f) != value)
  989. {
  990. InvalidAccess();
  991. }
  992. }
  993. void Set(const int i)
  994. {
  995. if (static_cast<T>(i) != value)
  996. {
  997. InvalidAccess();
  998. }
  999. }
  1000. void ClearFlags([[maybe_unused]] int flags) {}
  1001. int GetFlags() const { return VF_CONST_CVAR | VF_READONLY; }
  1002. int SetFlags([[maybe_unused]] int flags) { return 0; }
  1003. int GetType() { return SQueryTypeEnum<T>::type; }
  1004. const char* GetHelp() { return NULL; }
  1005. bool IsConstCVar() const { return true; }
  1006. void SetOnChangeCallback(ConsoleVarFunc pChangeFunc) { (void)pChangeFunc; }
  1007. bool AddOnChangeFunctor(AZ::Name, const AZStd::function<void()>&)
  1008. {
  1009. return false;
  1010. }
  1011. ConsoleVarFunc GetOnChangeCallback() const { InvalidAccess(); return NULL; }
  1012. int GetRealIVal() const { return GetIVal(); }
  1013. void SetLimits([[maybe_unused]] float min, [[maybe_unused]] float max) { return; }
  1014. void GetLimits([[maybe_unused]] float& min, [[maybe_unused]] float& max) { return; }
  1015. bool HasCustomLimits() { return false; }
  1016. void SetDataProbeString([[maybe_unused]] const char* pDataProbeString) { InvalidAccess(); }
  1017. };
  1018. }
  1019. #define REGISTER_DUMMY_CVAR(type, name, value) \
  1020. do { \
  1021. static struct DummyCVar \
  1022. : Detail::SDummyCVar<type> \
  1023. { \
  1024. DummyCVar() \
  1025. : Detail::SDummyCVar<type>(value) {} \
  1026. const char* GetName() const { return name; } \
  1027. } DummyStaticInstance; \
  1028. if (!(gEnv->pConsole != 0 ? gEnv->pConsole->Register(&DummyStaticInstance) : 0)) \
  1029. { \
  1030. AZ::Debug::Trace::Instance().Break(); \
  1031. CryFatalError("Can not register dummy CVar"); \
  1032. } \
  1033. } while (0)
  1034. # define CONSOLE_CONST_CVAR_MODE
  1035. # define DeclareConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
  1036. # define DeclareStaticConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
  1037. # define DefineConstIntCVarName(strname, name, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, strname, defaultValue); }
  1038. # define DefineConstIntCVar(name, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, (#name), defaultValue); }
  1039. // DefineConstIntCVar2 is deprecated, any such instance can be converted to the 3 variant by removing the quotes around the first parameter
  1040. # define DefineConstIntCVar3(name, _var_, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(_var_)); REGISTER_DUMMY_CVAR(int, name, defaultValue); }
  1041. # define AllocateConstIntCVar(scope, name)
  1042. # define DefineConstFloatCVar(name, flags, help) { REGISTER_DUMMY_CVAR(float, (#name), name ## Default); }
  1043. # define DeclareConstFloatCVar(name)
  1044. # define DeclareStaticConstFloatCVar(name)
  1045. # define AllocateConstFloatCVar(scope, name)
  1046. # define IsCVarConstAccess(expr) expr
  1047. #else
  1048. # define DeclareConstIntCVar(name, defaultValue) int name { defaultValue }
  1049. # define DeclareStaticConstIntCVar(name, defaultValue) static int name
  1050. # define DefineConstIntCVarName(strname, name, defaultValue, flags, help) \
  1051. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(strname, &name, defaultValue, flags | CONST_CVAR_FLAGS, CVARHELP(help)))
  1052. # define DefineConstIntCVar(name, defaultValue, flags, help) \
  1053. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#name), &name, defaultValue, flags | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
  1054. // DefineConstIntCVar2 is deprecated, any such instance can be converted to the 3 variant by removing the quotes around the first parameter
  1055. # define DefineConstIntCVar3(_name, _var, _def_val, _flags, help) \
  1056. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, &(_var), (_def_val), (_flags) | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
  1057. # define AllocateConstIntCVar(scope, name) int scope:: name
  1058. # define DefineConstFloatCVar(name, flags, help) \
  1059. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#name), &name, name ## Default, flags | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
  1060. # define DeclareConstFloatCVar(name) float name
  1061. # define DeclareStaticConstFloatCVar(name) static float name
  1062. # define AllocateConstFloatCVar(scope, name) float scope:: name
  1063. # define IsCVarConstAccess(expr)
  1064. #endif
  1065. // the following macros allow the help text to be easily stripped out
  1066. // Summary:
  1067. // Preferred way to register a CVar
  1068. #define REGISTER_CVAR(_var, _def_val, _flags, _comment) \
  1069. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#_var), &(_var), (_def_val), (_flags), CVARHELP(_comment)))
  1070. // Summary:
  1071. // Preferred way to register a CVar with a callback
  1072. #define REGISTER_CVAR_CB(_var, _def_val, _flags, _comment, _onchangefunction) \
  1073. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#_var), &(_var), (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
  1074. // Summary:
  1075. // Preferred way to register a string CVar
  1076. #define REGISTER_STRING(_name, _def_val, _flags, _comment) \
  1077. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterString(_name, (_def_val), (_flags), CVARHELP(_comment)))
  1078. // Summary:
  1079. // Preferred way to register a string CVar with a callback
  1080. #define REGISTER_STRING_CB(_name, _def_val, _flags, _comment, _onchangefunction) \
  1081. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterString(_name, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
  1082. // Summary:
  1083. // Preferred way to register an int CVar
  1084. #define REGISTER_INT(_name, _def_val, _flags, _comment) \
  1085. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterInt(_name, (_def_val), (_flags), CVARHELP(_comment)))
  1086. // Summary:
  1087. // Preferred way to register an int CVar with a callback
  1088. #define REGISTER_INT_CB(_name, _def_val, _flags, _comment, _onchangefunction) \
  1089. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterInt(_name, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
  1090. // Summary:
  1091. // Preferred way to register a float CVar
  1092. #define REGISTER_FLOAT(_name, _def_val, _flags, _comment) \
  1093. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterFloat(_name, (_def_val), (_flags), CVARHELP(_comment)))
  1094. // Summary:
  1095. // Offers more flexibility but more code is required
  1096. #define REGISTER_CVAR2(_name, _var, _def_val, _flags, _comment) \
  1097. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, _var, (_def_val), (_flags), CVARHELP(_comment)))
  1098. // Summary:
  1099. // Offers more flexibility but more code is required
  1100. #define REGISTER_CVAR2_CB(_name, _var, _def_val, _flags, _comment, _onchangefunction) \
  1101. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, _var, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
  1102. // Summary:
  1103. // Offers more flexibility but more code is required, explicit address taking of destination variable
  1104. #define REGISTER_CVAR3(_name, _var, _def_val, _flags, _comment) \
  1105. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, &(_var), (_def_val), (_flags), CVARHELP(_comment)))
  1106. // Summary:
  1107. // Preferred way to register a console command
  1108. #define REGISTER_COMMAND(_name, _func, _flags, _comment) \
  1109. (gEnv->pConsole == 0 ? false : gEnv->pConsole->AddCommand(_name, _func, (_flags), CVARHELP(_comment)))
  1110. // Summary:
  1111. // Preferred way to unregister a CVar
  1112. #define UNREGISTER_CVAR(_name) \
  1113. (gEnv->pConsole == 0 ? (void)0 : gEnv->pConsole->UnregisterVariable(_name))
  1114. // Summary:
  1115. // Preferred way to unregister a console command
  1116. #define UNREGISTER_COMMAND(_name) \
  1117. (gEnv->pConsole == 0 ? (void)0 : gEnv->pConsole->RemoveCommand(_name))
  1118. ////////////////////////////////////////////////////////////////////////////////
  1119. //
  1120. // Development only cvars
  1121. //
  1122. // N.B:
  1123. // (1) Registered as real cvars *in non release builds only*.
  1124. // (2) Can still be manipulated in release by the mapped variable, so not the same as const cvars.
  1125. // (3) Any 'OnChanged' callback will need guarding against in release builds since the cvar won't exist
  1126. // (4) Any code that tries to get ICVar* will need guarding against in release builds since the cvar won't exist
  1127. //
  1128. // ILLEGAL_DEV_FLAGS is a mask of all those flags which make no sense in a _DEV_ONLY or _DEDI_ONLY cvar since the
  1129. // cvar potentially won't exist in a release build.
  1130. //
  1131. #define ILLEGAL_DEV_FLAGS (VF_NET_SYNCED | VF_CHEAT | VF_CHEAT_ALWAYS_CHECK | VF_CHEAT_NOCHECK | VF_READONLY | VF_CONST_CVAR)
  1132. #if defined(_RELEASE)
  1133. #define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
  1134. #define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val /* _onchangefunction consumed; callback not available */
  1135. #define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
  1136. #define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
  1137. #define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
  1138. #define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
  1139. #define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
  1140. #define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
  1141. #define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
  1142. #define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
  1143. #define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) /* consumed; command not available */
  1144. #else
  1145. #define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1146. #define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1147. #define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1148. #define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1149. #define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1150. #define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1151. #define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1152. #define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1153. #define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1154. #define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1155. #define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEV_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1156. #endif // defined(_RELEASE)
  1157. //
  1158. ////////////////////////////////////////////////////////////////////////////////
  1159. ////////////////////////////////////////////////////////////////////////////////
  1160. //
  1161. // Dedicated server only cvars
  1162. //
  1163. // N.B:
  1164. // (1) Registered as real cvars in all non release builds
  1165. // (2) Registered as real cvars in release on dedi servers only, otherwise treated as DEV_ONLY type cvars (see above)
  1166. //
  1167. // TODO Registering all cvars for Dedicated server as well. Currently CrySystems have no concept of Dedicated server with cmake.
  1168. // If we introduce server specific targets for CrySystems, we can add DEDICATED_SERVER flags to those and add the flag back in here.
  1169. #if defined(_RELEASE)
  1170. #define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1171. #define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1172. #define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1173. #define REGISTER_STRING_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1174. #define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1175. #define REGISTER_INT_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1176. #define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1177. #define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1178. #define REGISTER_CVAR2_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1179. #define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment); static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
  1180. #else
  1181. #define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR_DEV_ONLY(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1182. #define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction)
  1183. #define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1184. #define REGISTER_STRING_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction)
  1185. #define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1186. #define REGISTER_INT_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction)
  1187. #define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1188. #define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1189. #define REGISTER_CVAR2_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction)
  1190. #define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND_DEV_ONLY(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment)
  1191. #endif // defined(_RELEASE)
  1192. //
  1193. ////////////////////////////////////////////////////////////////////////////////
  1194. #ifdef EXCLUDE_NORMAL_LOG // setting this removes a lot of logging to reduced code size (useful for consoles)
  1195. #define CryLog(...) ((void)0)
  1196. #define CryComment(...) ((void)0)
  1197. #define CryLogAlways(...) ((void)0)
  1198. #define CryOutputToCallback(...) ((void)0)
  1199. #else // EXCLUDE_NORMAL_LOG
  1200. // Summary:
  1201. // Simple logs of data with low verbosity.
  1202. void CryLog(const char*, ...) PRINTF_PARAMS(1, 2);
  1203. inline void CryLog(const char* format, ...)
  1204. {
  1205. // Fran: we need these guards for the testing framework to work
  1206. if (gEnv && gEnv->pSystem && gEnv->pLog)
  1207. {
  1208. va_list args;
  1209. va_start(args, format);
  1210. gEnv->pLog->LogV(ILog::eMessage, format, args);
  1211. va_end(args);
  1212. }
  1213. }
  1214. // Notes:
  1215. // Very rarely used log comment.
  1216. void CryComment(const char*, ...) PRINTF_PARAMS(1, 2);
  1217. inline void CryComment(const char* format, ...)
  1218. {
  1219. // Fran: we need these guards for the testing framework to work
  1220. if (gEnv && gEnv->pSystem && gEnv->pLog)
  1221. {
  1222. va_list args;
  1223. va_start(args, format);
  1224. gEnv->pLog->LogV(ILog::eComment, format, args);
  1225. va_end(args);
  1226. }
  1227. }
  1228. // Summary:
  1229. // Logs important data that must be printed regardless verbosity.
  1230. void CryLogAlways(const char*, ...) PRINTF_PARAMS(1, 2);
  1231. inline void CryLogAlways(const char* format, ...)
  1232. {
  1233. // log should not be used before system is ready
  1234. // error before system init should be handled explicitly
  1235. // Fran: we need these guards for the testing framework to work
  1236. if (gEnv && gEnv->pSystem && gEnv->pLog)
  1237. {
  1238. // assert(gEnv);
  1239. // assert(gEnv->pSystem);
  1240. va_list args;
  1241. va_start(args, format);
  1242. gEnv->pLog->LogV(ILog::eAlways, format, args);
  1243. va_end(args);
  1244. }
  1245. }
  1246. //! Writes to CLog via a callback function
  1247. //! Any formatting is the responsiblity of the callback function
  1248. //! The callback function should write to the supplied stream argument
  1249. inline void CryOutputToCallback(ILog::ELogType logType, const ILog::LogWriteCallback& messageCallback)
  1250. {
  1251. // writes directly to the log without formatting
  1252. // This is able to bypase the format limits of 4096 + 32 characters for output
  1253. if (gEnv && gEnv->pLog)
  1254. {
  1255. gEnv->pLog->LogWithCallback(logType, messageCallback);
  1256. }
  1257. }
  1258. #endif // EXCLUDE_NORMAL_LOG