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. IMovieSystem* pMovieSystem;
  489. #if defined(AZ_RESTRICTED_PLATFORM)
  490. #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_4
  491. #include AZ_RESTRICTED_FILE(ISystem_h)
  492. #endif
  493. threadID mMainThreadId; //The main thread ID is used in multiple systems so should be stored globally
  494. //////////////////////////////////////////////////////////////////////////
  495. // Used by CRY_ASSERT
  496. bool bIgnoreAllAsserts;
  497. bool bNoAssertDialog;
  498. //////////////////////////////////////////////////////////////////////////
  499. bool bToolMode;
  500. int retCode = 0;
  501. ILINE const bool IsDedicated() const
  502. {
  503. #if defined(CONSOLE)
  504. return false;
  505. #else
  506. return bDedicated;
  507. #endif
  508. }
  509. #if !defined(CONSOLE)
  510. ILINE void SetIsEditor(bool isEditor)
  511. {
  512. bEditor = isEditor;
  513. }
  514. ILINE void SetIsEditorGameMode(bool isEditorGameMode)
  515. {
  516. bEditorGameMode = isEditorGameMode;
  517. }
  518. ILINE void SetIsEditorSimulationMode(bool isEditorSimulationMode)
  519. {
  520. bEditorSimulationMode = isEditorSimulationMode;
  521. }
  522. ILINE void SetIsDedicated(bool isDedicated)
  523. {
  524. bDedicated = isDedicated;
  525. }
  526. #endif
  527. //this way the compiler can strip out code for consoles
  528. ILINE const bool IsEditor() const
  529. {
  530. #if defined(CONSOLE)
  531. return false;
  532. #else
  533. return bEditor;
  534. #endif
  535. }
  536. ILINE const bool IsEditorGameMode() const
  537. {
  538. #if defined(CONSOLE)
  539. return false;
  540. #else
  541. return bEditorGameMode;
  542. #endif
  543. }
  544. ILINE const bool IsEditorSimulationMode() const
  545. {
  546. #if defined(CONSOLE)
  547. return false;
  548. #else
  549. return bEditorSimulationMode;
  550. #endif
  551. }
  552. ILINE const bool IsEditing() const
  553. {
  554. #if defined(CONSOLE)
  555. return false;
  556. #else
  557. return bEditor && !bEditorGameMode;
  558. #endif
  559. }
  560. ILINE bool IsInToolMode() const
  561. {
  562. return bToolMode;
  563. }
  564. ILINE void SetToolMode(bool bNewToolMode)
  565. {
  566. bToolMode = bNewToolMode;
  567. }
  568. #if !defined(CONSOLE)
  569. private:
  570. bool bEditor; // Engine is running under editor.
  571. bool bEditorGameMode; // Engine is in editor game mode.
  572. bool bEditorSimulationMode; // Engine is in editor simulation mode.
  573. bool bDedicated; // Engine is in dedicated
  574. #endif
  575. public:
  576. SSystemGlobalEnvironment()
  577. : bToolMode(false)
  578. {
  579. };
  580. };
  581. // NOTE Nov 25, 2008: <pvl> the ISystem interface that follows has a member function
  582. // called 'GetUserName'. If we don't #undef'ine the same-named Win32 symbol here
  583. // ISystem wouldn't even compile.
  584. // TODO Nov 25, 2008: <pvl> there might be a better place for this?
  585. #ifdef GetUserName
  586. #undef GetUserName
  587. #endif
  588. ////////////////////////////////////////////////////////////////////////////////////////////////
  589. // Description:
  590. // Main Engine Interface.
  591. // Initialize and dispatch all engine's subsystems.
  592. struct ISystem
  593. {
  594. // <interfuscator:shuffle>
  595. virtual ~ISystem() {}
  596. // Summary:
  597. // Releases ISystem.
  598. virtual void Release() = 0;
  599. // Summary:
  600. // Returns pointer to the global environment structure.
  601. virtual SSystemGlobalEnvironment* GetGlobalEnvironment() = 0;
  602. // Summary:
  603. // Updates all subsystems (including the ScriptSink() )
  604. // Arguments:
  605. // flags - One or more flags from ESystemUpdateFlags structure.
  606. // nPauseMode - 0=normal(no pause), 1=menu/pause, 2=cutscene
  607. virtual bool UpdatePreTickBus(int updateFlags = 0, int nPauseMode = 0) = 0;
  608. // Summary:
  609. // Updates all subsystems (including the ScriptSink() )
  610. // Arguments:
  611. // flags - One or more flags from ESystemUpdateFlags structure.
  612. // nPauseMode - 0=normal(no pause), 1=menu/pause, 2=cutscene
  613. virtual bool UpdatePostTickBus(int updateFlags = 0, int nPauseMode = 0) = 0;
  614. // Summary:
  615. // Updates only require components during loading
  616. virtual bool UpdateLoadtime() = 0;
  617. // Summary:
  618. // Retrieve the name of the user currently logged in to the computer.
  619. virtual const char* GetUserName() = 0;
  620. // Summary:
  621. // Quits the application.
  622. virtual void Quit() = 0;
  623. // Summary:
  624. // Tells the system if it is relaunching or not.
  625. virtual void Relaunch(bool bRelaunch) = 0;
  626. // Summary:
  627. // Returns true if the application is in the shutdown phase.
  628. virtual bool IsQuitting() const = 0;
  629. // Summary:
  630. // Tells the system in which way we are using the serialization system.
  631. virtual void SerializingFile(int mode) = 0;
  632. virtual int IsSerializingFile() const = 0;
  633. virtual bool IsRelaunch() const = 0;
  634. // Description:
  635. // Displays error message.
  636. // Logs it to console and file and error message box then terminates execution.
  637. virtual void FatalError(const char* sFormat, ...) PRINTF_PARAMS(2, 3) = 0;
  638. // Description:
  639. // Reports a bug using the crash handler.
  640. // Logs an error to the console and launches the crash handler, then continues execution.
  641. virtual void ReportBug(const char* sFormat, ...) PRINTF_PARAMS(2, 3) = 0;
  642. // Description:
  643. // Report warning to current Validator object.
  644. // Doesn't terminate the execution.
  645. //##@{
  646. virtual void WarningV(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, va_list args) = 0;
  647. virtual void Warning(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, ...) = 0;
  648. //##@}
  649. // Description:
  650. // Report message by provider or by using CryMessageBox.
  651. // Doesn't terminate the execution.
  652. virtual void ShowMessage(const char* text, const char* caption, unsigned int uType) = 0;
  653. // Summary:
  654. // Compare specified verbosity level to the one currently set.
  655. virtual bool CheckLogVerbosity(int verbosity) = 0;
  656. // return the related subsystem interface
  657. virtual ILevelSystem* GetILevelSystem() = 0;
  658. virtual ICmdLine* GetICmdLine() = 0;
  659. virtual ILog* GetILog() = 0;
  660. virtual AZ::IO::IArchive* GetIPak() = 0;
  661. virtual ICryFont* GetICryFont() = 0;
  662. virtual IMovieSystem* GetIMovieSystem() = 0;
  663. virtual ::IConsole* GetIConsole() = 0;
  664. virtual IRemoteConsole* GetIRemoteConsole() = 0;
  665. virtual ISystemEventDispatcher* GetISystemEventDispatcher() = 0;
  666. virtual bool IsDevMode() const = 0;
  667. //////////////////////////////////////////////////////////////////////////
  668. //////////////////////////////////////////////////////////////////////////
  669. // IXmlNode interface.
  670. //////////////////////////////////////////////////////////////////////////
  671. // Summary:
  672. // Creates new xml node.
  673. virtual XmlNodeRef CreateXmlNode(const char* sNodeName = "", bool bReuseStrings = false, bool bIsProcessingInstruction = false) = 0;
  674. // Summary:
  675. // Loads xml from memory buffer, returns 0 if load failed.
  676. virtual XmlNodeRef LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings = false, bool bSuppressWarnings = false) = 0;
  677. // Summary:
  678. // Loads xml file, returns 0 if load failed.
  679. virtual XmlNodeRef LoadXmlFromFile(const char* sFilename, bool bReuseStrings = false) = 0;
  680. // Summary:
  681. // Retrieves access to XML utilities interface.
  682. virtual IXmlUtils* GetXmlUtils() = 0;
  683. // Description:
  684. // When ignore update sets to true, system will ignore and updates and render calls.
  685. virtual void IgnoreUpdates(bool bIgnore) = 0;
  686. // Return Value:
  687. // True if system running in Test mode.
  688. virtual bool IsTestMode() const = 0;
  689. //////////////////////////////////////////////////////////////////////////
  690. // File version.
  691. //////////////////////////////////////////////////////////////////////////
  692. // Summary:
  693. // Gets file version.
  694. virtual const SFileVersion& GetFileVersion() = 0;
  695. // Summary:
  696. // Gets product version.
  697. virtual const SFileVersion& GetProductVersion() = 0;
  698. // Summary:
  699. // Gets build version.
  700. virtual const SFileVersion& GetBuildVersion() = 0;
  701. //////////////////////////////////////////////////////////////////////////
  702. // Configuration.
  703. //////////////////////////////////////////////////////////////////////////
  704. // Summary:
  705. // Loads configurations from CVarGroup directory recursively
  706. // If m_GraphicsSettingsMap is defined (in Graphics Settings Dialog box), fills in mapping based on sys_spec_Full
  707. // Arguments:
  708. // sPath - e.g. "Game/Config/CVarGroups"
  709. virtual void AddCVarGroupDirectory(const AZStd::string& sPath) = 0;
  710. // Summary:
  711. // Saves system configuration.
  712. virtual void SaveConfiguration() = 0;
  713. // Summary:
  714. // Loads system configuration
  715. // Arguments:
  716. // pCallback - 0 means normal LoadConfigVar behaviour is used
  717. virtual void LoadConfiguration(const char* sFilename, ILoadConfigurationEntrySink* pSink = 0, bool warnIfMissing = true) = 0;
  718. //////////////////////////////////////////////////////////////////////////
  719. // Summary:
  720. // Retrieves current configuration platform
  721. virtual ESystemConfigPlatform GetConfigPlatform() const = 0;
  722. // Summary:
  723. // Changes current configuration platform.
  724. virtual void SetConfigPlatform(ESystemConfigPlatform platform) = 0;
  725. //////////////////////////////////////////////////////////////////////////
  726. // Summary:
  727. // Query if system is now paused.
  728. // Pause flag is set when calling system update with pause mode.
  729. virtual bool IsPaused() const = 0;
  730. // Summary:
  731. // Retrieves localized strings manager interface.
  732. virtual ILocalizationManager* GetLocalizationManager() = 0;
  733. //////////////////////////////////////////////////////////////////////////
  734. // Error callback handling
  735. // Summary:
  736. // Registers listeners to CryAssert and error messages. (may not be called if asserts are disabled)
  737. // Each pointer can be registered only once. (stl::push_back_unique)
  738. // It will return false if the pointer is already registered. Returns true, otherwise.
  739. virtual bool RegisterErrorObserver(IErrorObserver* errorObserver) = 0;
  740. // Summary:
  741. // Unregisters listeners to CryAssert and error messages.
  742. // It will return false if the pointer is not registered. Otherwise, returns true.
  743. virtual bool UnregisterErrorObserver(IErrorObserver* errorObserver) = 0;
  744. // Summary:
  745. // Called after the processing of the assert message box on some platforms.
  746. // It will be called even when asserts are disabled by the console variables.
  747. virtual void OnAssert(const char* condition, const char* message, const char* fileName, unsigned int fileLineNumber) = 0;
  748. // Summary:
  749. // Returns if the assert window from CryAssert is visible.
  750. // OBS1: needed by the editor, as in some cases it can freeze if during an assert engine it will handle
  751. // some events such as mouse movement in a CryPhysics assert.
  752. // OBS2: it will always return false, if asserts are disabled or ignored.
  753. virtual bool IsAssertDialogVisible() const = 0;
  754. // Summary:
  755. // Sets the AssertVisisble internal variable.
  756. // Typically it should only be called by CryAssert.
  757. virtual void SetAssertVisible(bool bAssertVisble) = 0;
  758. //////////////////////////////////////////////////////////////////////////
  759. // Summary:
  760. // Get the index of the currently running O3DE application. (0 = first instance, 1 = second instance, etc)
  761. virtual int GetApplicationInstance() = 0;
  762. // Summary:
  763. // Get log index of the currently running Open 3D Engine application. (0 = first instance, 1 = second instance, etc)
  764. virtual int GetApplicationLogInstance(const char* logFilePath) = 0;
  765. // Summary:
  766. // Clear all currently logged and drawn on screen error messages
  767. virtual void ClearErrorMessages() = 0;
  768. //////////////////////////////////////////////////////////////////////////
  769. // For debugging use only!, query current C++ call stack.
  770. //////////////////////////////////////////////////////////////////////////
  771. // Notes:
  772. // Pass nCount to indicate maximum number of functions to get.
  773. // For debugging use only, query current C++ call stack.
  774. // Description:
  775. // Fills array of function pointers, nCount return number of functions.
  776. virtual void debug_GetCallStack(const char** pFunctions, int& nCount) = 0;
  777. // Summary:
  778. // Logs current callstack.
  779. // Notes:
  780. // For debugging use only!, query current C++ call stack.
  781. virtual void debug_LogCallStack(int nMaxFuncs = 32, int nFlags = 0) = 0;
  782. // Description:
  783. // Execute command line arguments.
  784. // Should be after init game.
  785. // Example:
  786. // +g_gametype ASSAULT +LoadLevel "testy"
  787. virtual void ExecuteCommandLine(bool deferred=true) = 0;
  788. // Description:
  789. // GetSystemUpdate stats (all systems update without except console)
  790. // very useful on dedicated server as we throttle it to fixed frequency
  791. // returns zeroes if no updates happened yet
  792. virtual void GetUpdateStats(SSystemUpdateStats& stats) = 0;
  793. virtual ESystemGlobalState GetSystemGlobalState(void) = 0;
  794. virtual void SetSystemGlobalState(ESystemGlobalState systemGlobalState) = 0;
  795. #if !defined(_RELEASE)
  796. virtual bool IsSavingResourceList() const = 0;
  797. #endif
  798. // Summary:
  799. // Register a IWindowMessageHandler that will be informed about window messages
  800. // The delivered messages are platform-specific
  801. virtual void RegisterWindowMessageHandler(IWindowMessageHandler* pHandler) = 0;
  802. // Summary:
  803. // Unregister an IWindowMessageHandler that was previously registered using RegisterWindowMessageHandler
  804. virtual void UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler) = 0;
  805. ////////////////////////////////////////////////////////////////////////////////////////////////
  806. // EBus interface used to listen for cry system notifications
  807. class CrySystemNotifications : public AZ::EBusTraits
  808. {
  809. public:
  810. virtual ~CrySystemNotifications() = default;
  811. // Override to be notified right before the call to ISystem::Render
  812. virtual void OnPreRender() {}
  813. // Override to be notified right after the call to ISystem::Render (but before RenderEnd)
  814. virtual void OnPostRender() {}
  815. };
  816. using CrySystemNotificationBus = AZ::EBus<CrySystemNotifications>;
  817. };
  818. //////////////////////////////////////////////////////////////////////////
  819. // CrySystem DLL Exports.
  820. //////////////////////////////////////////////////////////////////////////
  821. typedef ISystem* (*PFNCREATESYSTEMINTERFACE)(SSystemInitParams& initParams);
  822. //////////////////////////////////////////////////////////////////////////
  823. // Global environment variable.
  824. //////////////////////////////////////////////////////////////////////////
  825. extern SSystemGlobalEnvironment* gEnv;
  826. // Summary:
  827. // Gets the system interface.
  828. inline ISystem* GetISystem()
  829. {
  830. // Some unit tests temporarily install and then uninstall ISystem* mocks.
  831. // It is generally okay for runtime and tool systems which call this function to cache the returned pointer,
  832. // because their lifetime is usually shorter than the lifetime of the ISystem* implementation.
  833. // It is NOT safe for this function to cache it as a static itself, though, as the static it would cache
  834. // it inside may outlive the the actual instance implementing ISystem* when unit tests are torn down and then restarted.
  835. ISystem* systemInterface = gEnv ? gEnv->pSystem : nullptr;
  836. if (!systemInterface)
  837. {
  838. CrySystemRequestBus::BroadcastResult(systemInterface, &CrySystemRequests::GetCrySystem);
  839. }
  840. return systemInterface;
  841. };
  842. //////////////////////////////////////////////////////////////////////////
  843. // Description:
  844. // This function must be called once by each module at the beginning, to setup global pointers.
  845. void ModuleInitISystem(ISystem* pSystem, const char* moduleName);
  846. void ModuleShutdownISystem(ISystem* pSystem);
  847. void* GetModuleInitISystemSymbol();
  848. void* GetModuleShutdownISystemSymbol();
  849. #define PREVENT_MODULE_AND_ENVIRONMENT_SYMBOL_STRIPPING \
  850. AZ_UNUSED(GetModuleInitISystemSymbol()); \
  851. AZ_UNUSED(GetModuleShutdownISystemSymbol());
  852. // Summary:
  853. // Interface of the DLL.
  854. extern "C"
  855. {
  856. #if !defined(AZ_MONOLITHIC_BUILD)
  857. CRYSYSTEM_API
  858. #endif
  859. ISystem* CreateSystemInterface(const SSystemInitParams& initParams);
  860. }
  861. // Description:
  862. // Displays error message.
  863. // Logs it to console and file and error message box.
  864. // Then terminates execution.
  865. void CryFatalError(const char*, ...) PRINTF_PARAMS(1, 2);
  866. inline void CryFatalError(const char* format, ...)
  867. {
  868. if (!gEnv || !gEnv->pSystem)
  869. {
  870. return;
  871. }
  872. va_list ArgList;
  873. char szBuffer[MAX_WARNING_LENGTH];
  874. va_start(ArgList, format);
  875. int count = azvsnprintf(szBuffer, sizeof(szBuffer), format, ArgList);
  876. if (count == -1 || count >= sizeof(szBuffer))
  877. {
  878. szBuffer[sizeof(szBuffer) - 1] = '\0';
  879. }
  880. va_end(ArgList);
  881. gEnv->pSystem->FatalError("%s", szBuffer);
  882. }
  883. //////////////////////////////////////////////////////////////////////////
  884. // Description:
  885. // Displays warning message.
  886. // Logs it to console and file and display a warning message box.
  887. // Doesn't terminate execution.
  888. void CryWarning(EValidatorModule, EValidatorSeverity, const char*, ...) PRINTF_PARAMS(3, 4);
  889. inline void CryWarning(EValidatorModule module, EValidatorSeverity severity, const char* format, ...)
  890. {
  891. if (!gEnv || !gEnv->pSystem || !format)
  892. {
  893. return;
  894. }
  895. va_list args;
  896. va_start(args, format);
  897. GetISystem()->WarningV(module, severity, 0, 0, format, args);
  898. va_end(args);
  899. }
  900. #ifdef EXCLUDE_CVARHELP
  901. #define CVARHELP(_comment) 0
  902. #else
  903. #define CVARHELP(_comment) _comment
  904. #endif
  905. //Provide macros for fixing cvars for release mode on consoles to enums to allow for code stripping
  906. //Do not enable for PC, apply VF_CHEAT there if required
  907. #if defined(CONSOLE)
  908. #define CONST_CVAR_FLAGS (VF_CHEAT)
  909. #else
  910. #define CONST_CVAR_FLAGS (VF_NULL)
  911. #endif
  912. #if defined(AZ_RESTRICTED_PLATFORM)
  913. #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_5
  914. #include AZ_RESTRICTED_FILE(ISystem_h)
  915. #endif
  916. #if defined(_RELEASE) && defined(IS_CONSOLE_PLATFORM)
  917. #ifndef LOG_CONST_CVAR_ACCESS
  918. #error LOG_CONST_CVAR_ACCESS should be defined in ProjectDefines.h
  919. #endif
  920. #include "IConsole.h"
  921. namespace Detail
  922. {
  923. template<typename T>
  924. struct SQueryTypeEnum;
  925. template<>
  926. struct SQueryTypeEnum<int>
  927. {
  928. static const int type = CVAR_INT;
  929. static int ParseString(const char* s) { return atoi(s); }
  930. };
  931. template<>
  932. struct SQueryTypeEnum<float>
  933. {
  934. static const int type = CVAR_FLOAT;
  935. static float ParseString(const char* s) { return (float)atof(s); }
  936. };
  937. template<typename T>
  938. struct SDummyCVar
  939. : ICVar
  940. {
  941. const T value;
  942. #if LOG_CONST_CVAR_ACCESS
  943. mutable bool bWasRead;
  944. mutable bool bWasChanged;
  945. SDummyCVar(T val)
  946. : value(val)
  947. , bWasChanged(false)
  948. , bWasRead(false) {}
  949. #else
  950. SDummyCVar(T val)
  951. : value(val) {}
  952. #endif
  953. void WarnUse() const
  954. {
  955. #if LOG_CONST_CVAR_ACCESS
  956. if (!bWasRead)
  957. {
  958. CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "[CVAR] Read from const CVar '%s' via name look-up, this is non-optimal", GetName());
  959. bWasRead = true;
  960. }
  961. #endif
  962. }
  963. void InvalidAccess() const
  964. {
  965. #if LOG_CONST_CVAR_ACCESS
  966. if (!bWasChanged)
  967. {
  968. 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());
  969. bWasChanged = true;
  970. }
  971. #endif
  972. }
  973. void Release() {}
  974. int GetIVal() const { WarnUse(); return static_cast<int>(value); }
  975. int64 GetI64Val() const { WarnUse(); return static_cast<int64>(value); }
  976. float GetFVal() const { WarnUse(); return static_cast<float>(value); }
  977. const char* GetString() const { return ""; }
  978. const char* GetDataProbeString() const { return ""; }
  979. void Set(const char* s)
  980. {
  981. if (SQueryTypeEnum<T>::ParseString(s) != value)
  982. {
  983. InvalidAccess();
  984. }
  985. }
  986. void ForceSet(const char* s) { Set(s); }
  987. void Set(const float f)
  988. {
  989. if (static_cast<T>(f) != value)
  990. {
  991. InvalidAccess();
  992. }
  993. }
  994. void Set(const int i)
  995. {
  996. if (static_cast<T>(i) != value)
  997. {
  998. InvalidAccess();
  999. }
  1000. }
  1001. void ClearFlags([[maybe_unused]] int flags) {}
  1002. int GetFlags() const { return VF_CONST_CVAR | VF_READONLY; }
  1003. int SetFlags([[maybe_unused]] int flags) { return 0; }
  1004. int GetType() { return SQueryTypeEnum<T>::type; }
  1005. const char* GetHelp() { return NULL; }
  1006. bool IsConstCVar() const { return true; }
  1007. void SetOnChangeCallback(ConsoleVarFunc pChangeFunc) { (void)pChangeFunc; }
  1008. bool AddOnChangeFunctor(AZ::Name, const AZStd::function<void()>&)
  1009. {
  1010. return false;
  1011. }
  1012. ConsoleVarFunc GetOnChangeCallback() const { InvalidAccess(); return NULL; }
  1013. int GetRealIVal() const { return GetIVal(); }
  1014. void SetLimits([[maybe_unused]] float min, [[maybe_unused]] float max) { return; }
  1015. void GetLimits([[maybe_unused]] float& min, [[maybe_unused]] float& max) { return; }
  1016. bool HasCustomLimits() { return false; }
  1017. void SetDataProbeString([[maybe_unused]] const char* pDataProbeString) { InvalidAccess(); }
  1018. };
  1019. }
  1020. #define REGISTER_DUMMY_CVAR(type, name, value) \
  1021. do { \
  1022. static struct DummyCVar \
  1023. : Detail::SDummyCVar<type> \
  1024. { \
  1025. DummyCVar() \
  1026. : Detail::SDummyCVar<type>(value) {} \
  1027. const char* GetName() const { return name; } \
  1028. } DummyStaticInstance; \
  1029. if (!(gEnv->pConsole != 0 ? gEnv->pConsole->Register(&DummyStaticInstance) : 0)) \
  1030. { \
  1031. AZ::Debug::Trace::Instance().Break(); \
  1032. CryFatalError("Can not register dummy CVar"); \
  1033. } \
  1034. } while (0)
  1035. # define CONSOLE_CONST_CVAR_MODE
  1036. # define DeclareConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
  1037. # define DeclareStaticConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
  1038. # define DefineConstIntCVarName(strname, name, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, strname, defaultValue); }
  1039. # define DefineConstIntCVar(name, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, (#name), defaultValue); }
  1040. // DefineConstIntCVar2 is deprecated, any such instance can be converted to the 3 variant by removing the quotes around the first parameter
  1041. # define DefineConstIntCVar3(name, _var_, defaultValue, flags, help) { static_assert((int)(defaultValue) == (int)(_var_)); REGISTER_DUMMY_CVAR(int, name, defaultValue); }
  1042. # define AllocateConstIntCVar(scope, name)
  1043. # define DefineConstFloatCVar(name, flags, help) { REGISTER_DUMMY_CVAR(float, (#name), name ## Default); }
  1044. # define DeclareConstFloatCVar(name)
  1045. # define DeclareStaticConstFloatCVar(name)
  1046. # define AllocateConstFloatCVar(scope, name)
  1047. # define IsCVarConstAccess(expr) expr
  1048. #else
  1049. # define DeclareConstIntCVar(name, defaultValue) int name { defaultValue }
  1050. # define DeclareStaticConstIntCVar(name, defaultValue) static int name
  1051. # define DefineConstIntCVarName(strname, name, defaultValue, flags, help) \
  1052. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(strname, &name, defaultValue, flags | CONST_CVAR_FLAGS, CVARHELP(help)))
  1053. # define DefineConstIntCVar(name, defaultValue, flags, help) \
  1054. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#name), &name, defaultValue, flags | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
  1055. // DefineConstIntCVar2 is deprecated, any such instance can be converted to the 3 variant by removing the quotes around the first parameter
  1056. # define DefineConstIntCVar3(_name, _var, _def_val, _flags, help) \
  1057. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, &(_var), (_def_val), (_flags) | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
  1058. # define AllocateConstIntCVar(scope, name) int scope:: name
  1059. # define DefineConstFloatCVar(name, flags, help) \
  1060. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#name), &name, name ## Default, flags | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
  1061. # define DeclareConstFloatCVar(name) float name
  1062. # define DeclareStaticConstFloatCVar(name) static float name
  1063. # define AllocateConstFloatCVar(scope, name) float scope:: name
  1064. # define IsCVarConstAccess(expr)
  1065. #endif
  1066. // the following macros allow the help text to be easily stripped out
  1067. // Summary:
  1068. // Preferred way to register a CVar
  1069. #define REGISTER_CVAR(_var, _def_val, _flags, _comment) \
  1070. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#_var), &(_var), (_def_val), (_flags), CVARHELP(_comment)))
  1071. // Summary:
  1072. // Preferred way to register a CVar with a callback
  1073. #define REGISTER_CVAR_CB(_var, _def_val, _flags, _comment, _onchangefunction) \
  1074. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#_var), &(_var), (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
  1075. // Summary:
  1076. // Preferred way to register a string CVar
  1077. #define REGISTER_STRING(_name, _def_val, _flags, _comment) \
  1078. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterString(_name, (_def_val), (_flags), CVARHELP(_comment)))
  1079. // Summary:
  1080. // Preferred way to register a string CVar with a callback
  1081. #define REGISTER_STRING_CB(_name, _def_val, _flags, _comment, _onchangefunction) \
  1082. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterString(_name, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
  1083. // Summary:
  1084. // Preferred way to register an int CVar
  1085. #define REGISTER_INT(_name, _def_val, _flags, _comment) \
  1086. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterInt(_name, (_def_val), (_flags), CVARHELP(_comment)))
  1087. // Summary:
  1088. // Preferred way to register an int CVar with a callback
  1089. #define REGISTER_INT_CB(_name, _def_val, _flags, _comment, _onchangefunction) \
  1090. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterInt(_name, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
  1091. // Summary:
  1092. // Preferred way to register a float CVar
  1093. #define REGISTER_FLOAT(_name, _def_val, _flags, _comment) \
  1094. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterFloat(_name, (_def_val), (_flags), CVARHELP(_comment)))
  1095. // Summary:
  1096. // Offers more flexibility but more code is required
  1097. #define REGISTER_CVAR2(_name, _var, _def_val, _flags, _comment) \
  1098. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, _var, (_def_val), (_flags), CVARHELP(_comment)))
  1099. // Summary:
  1100. // Offers more flexibility but more code is required
  1101. #define REGISTER_CVAR2_CB(_name, _var, _def_val, _flags, _comment, _onchangefunction) \
  1102. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, _var, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
  1103. // Summary:
  1104. // Offers more flexibility but more code is required, explicit address taking of destination variable
  1105. #define REGISTER_CVAR3(_name, _var, _def_val, _flags, _comment) \
  1106. (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, &(_var), (_def_val), (_flags), CVARHELP(_comment)))
  1107. // Summary:
  1108. // Preferred way to register a console command
  1109. #define REGISTER_COMMAND(_name, _func, _flags, _comment) \
  1110. (gEnv->pConsole == 0 ? false : gEnv->pConsole->AddCommand(_name, _func, (_flags), CVARHELP(_comment)))
  1111. // Summary:
  1112. // Preferred way to unregister a CVar
  1113. #define UNREGISTER_CVAR(_name) \
  1114. (gEnv->pConsole == 0 ? (void)0 : gEnv->pConsole->UnregisterVariable(_name))
  1115. // Summary:
  1116. // Preferred way to unregister a console command
  1117. #define UNREGISTER_COMMAND(_name) \
  1118. (gEnv->pConsole == 0 ? (void)0 : gEnv->pConsole->RemoveCommand(_name))
  1119. ////////////////////////////////////////////////////////////////////////////////
  1120. //
  1121. // Development only cvars
  1122. //
  1123. // N.B:
  1124. // (1) Registered as real cvars *in non release builds only*.
  1125. // (2) Can still be manipulated in release by the mapped variable, so not the same as const cvars.
  1126. // (3) Any 'OnChanged' callback will need guarding against in release builds since the cvar won't exist
  1127. // (4) Any code that tries to get ICVar* will need guarding against in release builds since the cvar won't exist
  1128. //
  1129. // ILLEGAL_DEV_FLAGS is a mask of all those flags which make no sense in a _DEV_ONLY or _DEDI_ONLY cvar since the
  1130. // cvar potentially won't exist in a release build.
  1131. //
  1132. #define ILLEGAL_DEV_FLAGS (VF_NET_SYNCED | VF_CHEAT | VF_CHEAT_ALWAYS_CHECK | VF_CHEAT_NOCHECK | VF_READONLY | VF_CONST_CVAR)
  1133. #if defined(_RELEASE)
  1134. #define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
  1135. #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 */
  1136. #define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
  1137. #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 */
  1138. #define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
  1139. #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 */
  1140. #define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
  1141. #define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
  1142. #define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
  1143. #define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; static_assert(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
  1144. #define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) /* consumed; command not available */
  1145. #else
  1146. #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)
  1147. #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)
  1148. #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)
  1149. #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)
  1150. #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)
  1151. #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)
  1152. #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)
  1153. #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)
  1154. #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)
  1155. #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)
  1156. #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)
  1157. #endif // defined(_RELEASE)
  1158. //
  1159. ////////////////////////////////////////////////////////////////////////////////
  1160. ////////////////////////////////////////////////////////////////////////////////
  1161. //
  1162. // Dedicated server only cvars
  1163. //
  1164. // N.B:
  1165. // (1) Registered as real cvars in all non release builds
  1166. // (2) Registered as real cvars in release on dedi servers only, otherwise treated as DEV_ONLY type cvars (see above)
  1167. //
  1168. // TODO Registering all cvars for Dedicated server as well. Currently CrySystems have no concept of Dedicated server with cmake.
  1169. // If we introduce server specific targets for CrySystems, we can add DEDICATED_SERVER flags to those and add the flag back in here.
  1170. #if defined(_RELEASE)
  1171. #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)
  1172. #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)
  1173. #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)
  1174. #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)
  1175. #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)
  1176. #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)
  1177. #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)
  1178. #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)
  1179. #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)
  1180. #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)
  1181. #else
  1182. #define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR_DEV_ONLY(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1183. #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)
  1184. #define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1185. #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)
  1186. #define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1187. #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)
  1188. #define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1189. #define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
  1190. #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)
  1191. #define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND_DEV_ONLY(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment)
  1192. #endif // defined(_RELEASE)
  1193. //
  1194. ////////////////////////////////////////////////////////////////////////////////
  1195. #ifdef EXCLUDE_NORMAL_LOG // setting this removes a lot of logging to reduced code size (useful for consoles)
  1196. #define CryLog(...) ((void)0)
  1197. #define CryComment(...) ((void)0)
  1198. #define CryLogAlways(...) ((void)0)
  1199. #define CryOutputToCallback(...) ((void)0)
  1200. #else // EXCLUDE_NORMAL_LOG
  1201. // Summary:
  1202. // Simple logs of data with low verbosity.
  1203. void CryLog(const char*, ...) PRINTF_PARAMS(1, 2);
  1204. inline void CryLog(const char* format, ...)
  1205. {
  1206. // Fran: we need these guards for the testing framework to work
  1207. if (gEnv && gEnv->pSystem && gEnv->pLog)
  1208. {
  1209. va_list args;
  1210. va_start(args, format);
  1211. gEnv->pLog->LogV(ILog::eMessage, format, args);
  1212. va_end(args);
  1213. }
  1214. }
  1215. // Notes:
  1216. // Very rarely used log comment.
  1217. void CryComment(const char*, ...) PRINTF_PARAMS(1, 2);
  1218. inline void CryComment(const char* format, ...)
  1219. {
  1220. // Fran: we need these guards for the testing framework to work
  1221. if (gEnv && gEnv->pSystem && gEnv->pLog)
  1222. {
  1223. va_list args;
  1224. va_start(args, format);
  1225. gEnv->pLog->LogV(ILog::eComment, format, args);
  1226. va_end(args);
  1227. }
  1228. }
  1229. // Summary:
  1230. // Logs important data that must be printed regardless verbosity.
  1231. void CryLogAlways(const char*, ...) PRINTF_PARAMS(1, 2);
  1232. inline void CryLogAlways(const char* format, ...)
  1233. {
  1234. // log should not be used before system is ready
  1235. // error before system init should be handled explicitly
  1236. // Fran: we need these guards for the testing framework to work
  1237. if (gEnv && gEnv->pSystem && gEnv->pLog)
  1238. {
  1239. // assert(gEnv);
  1240. // assert(gEnv->pSystem);
  1241. va_list args;
  1242. va_start(args, format);
  1243. gEnv->pLog->LogV(ILog::eAlways, format, args);
  1244. va_end(args);
  1245. }
  1246. }
  1247. //! Writes to CLog via a callback function
  1248. //! Any formatting is the responsiblity of the callback function
  1249. //! The callback function should write to the supplied stream argument
  1250. inline void CryOutputToCallback(ILog::ELogType logType, const ILog::LogWriteCallback& messageCallback)
  1251. {
  1252. // writes directly to the log without formatting
  1253. // This is able to bypase the format limits of 4096 + 32 characters for output
  1254. if (gEnv && gEnv->pLog)
  1255. {
  1256. gEnv->pLog->LogWithCallback(logType, messageCallback);
  1257. }
  1258. }
  1259. #endif // EXCLUDE_NORMAL_LOG