123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220 |
- /*
- * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
- * its licensors.
- *
- * For complete copyright and license terms please see the LICENSE at the root of this
- * distribution (the "License"). All use of this software is governed by the License,
- * or, if provided, by the license below or the license accompanying this file. Do not
- * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- */
- // Original file Copyright Crytek GMBH or its affiliates, used under license.
- // In Mac, including ISystem without including platform.h first fails because platform.h
- // includes CryThread.h which includes CryThread_pthreads.h which uses ISystem (gEnv).
- // So plaform.h needs the contents of ISystem.h.
- // By including platform.h outside of the guard, we give platform.h the right include order
- #include <platform.h> // Needed for LARGE_INTEGER (for consoles).
- #ifndef CRYINCLUDE_CRYCOMMON_ISYSTEM_H
- #define CRYINCLUDE_CRYCOMMON_ISYSTEM_H
- #pragma once
- #ifdef CRYSYSTEM_EXPORTS
- #define CRYSYSTEM_API DLL_EXPORT
- #else
- #define CRYSYSTEM_API DLL_IMPORT
- #endif
- #include "CryAssert.h"
- #include "CompileTimeAssert.h"
- #include <AzCore/IO/SystemFile.h>
- #if defined(AZ_RESTRICTED_PLATFORM)
- #undef AZ_RESTRICTED_SECTION
- #define ISYSTEM_H_SECTION_1 1
- #define ISYSTEM_H_SECTION_2 2
- #define ISYSTEM_H_SECTION_3 3
- #define ISYSTEM_H_SECTION_4 4
- #define ISYSTEM_H_SECTION_5 5
- #endif
- ////////////////////////////////////////////////////////////////////////////////////////////////
- // Forward declarations
- ////////////////////////////////////////////////////////////////////////////////////////////////
- #include <IXml.h> // <> required for Interfuscator
- #include "IValidator.h" // <> required for Interfuscator
- #include <ILog.h> // <> required for Interfuscator
- #include "CryVersion.h"
- #include "smartptr.h"
- #include <ISystemScheduler.h> // <> required for Interfuscator
- #include <memory> // shared_ptr
- #include <CrySystemBus.h>
- struct ISystem;
- struct ILog;
- struct IProfileLogSystem;
- namespace AZ::IO
- {
- struct IArchive;
- }
- struct IKeyboard;
- struct IMouse;
- struct IConsole;
- struct IRemoteConsole;
- struct IRenderer;
- struct IProcess;
- struct I3DEngine;
- struct ITimer;
- struct ICryFont;
- struct IMovieSystem;
- struct IMemoryManager;
- namespace Audio
- {
- struct IAudioSystem;
- } // namespace Audio
- struct IStreamEngine;
- struct SFileVersion;
- struct INameTable;
- struct ILevelSystem;
- struct IViewSystem;
- struct IMaterialEffects;
- class IOpticsManager;
- class ICrySizer;
- class IXMLBinarySerializer;
- struct IReadWriteXMLSink;
- struct IThreadTaskManager;
- struct IResourceManager;
- struct ITextModeConsole;
- struct IAVI_Reader;
- class CPNoise3;
- struct IFileChangeMonitor;
- struct IVisualLog;
- struct ILocalizationManager;
- struct ICryFactoryRegistry;
- struct ISoftCodeMgr;
- struct IZLibCompressor;
- struct IZLibDecompressor;
- struct ILZ4Decompressor;
- class IZStdDecompressor;
- struct IOutputPrintSink;
- struct IOverloadSceneManager;
- struct IThreadManager;
- struct IServiceNetwork;
- struct IRemoteCommandManager;
- struct IWindowMessageHandler;
- struct IImageHandler;
- class IResourceCompilerHelper;
- class ILmbrAWS;
- namespace AZ
- {
- namespace IO
- {
- class FileIOBase;
- }
- }
- class IResourceCompilerHelper;
- namespace Serialization {
- struct IArchiveHost;
- }
- struct ILocalMemoryUsage;
- typedef void* WIN_HWND;
- class CCamera;
- struct CLoadingTimeProfiler;
- class ICmdLine;
- struct INotificationNetwork;
- struct ICryPerfHUD;
- class ILyShine;
- namespace JobManager {
- struct IJobManager;
- }
- #define PROC_MENU 1
- #define PROC_3DENGINE 2
- // Summary:
- // IDs for script userdata typing.
- // Remarks:
- // Maybe they should be moved into the game.dll .
- //##@{
- #define USER_DATA_SOUND 1
- #define USER_DATA_TEXTURE 2
- #define USER_DATA_OBJECT 3
- #define USER_DATA_LIGHT 4
- #define USER_DATA_BONEHANDLER 5
- #define USER_DATA_POINTER 6
- //##@}
- enum ESystemUpdateFlags
- {
- ESYSUPDATE_IGNORE_PHYSICS = 0x0002,
- // Summary:
- // Special update mode for editor.
- ESYSUPDATE_EDITOR = 0x0004,
- ESYSUPDATE_MULTIPLAYER = 0x0008,
- ESYSUPDATE_EDITOR_AI_PHYSICS = 0x0010,
- ESYSUPDATE_EDITOR_ONLY = 0x0020,
- ESYSUPDATE_UPDATE_VIEW_ONLY = 0x0040
- };
- // Description:
- // Configuration specification, depends on user selected machine specification.
- enum ESystemConfigSpec
- {
- CONFIG_AUTO_SPEC = 0,
- CONFIG_LOW_SPEC = 1,
- CONFIG_MEDIUM_SPEC = 2,
- CONFIG_HIGH_SPEC = 3,
- CONFIG_VERYHIGH_SPEC = 4,
- END_CONFIG_SPEC_ENUM, // MUST BE LAST VALUE. USED FOR ERROR CHECKING.
- };
- // Description:
- // Configuration platform. Autodetected at start, can be modified through the editor.
- enum ESystemConfigPlatform
- {
- CONFIG_INVALID_PLATFORM = 0,
- CONFIG_PC = 1,
- CONFIG_OSX_GL = 2,
- CONFIG_OSX_METAL = 3,
- CONFIG_ANDROID = 4,
- CONFIG_IOS = 5,
- CONFIG_PROVO = 7,
- CONFIG_SALEM = 8,
- CONFIG_JASPER = 9,
- END_CONFIG_PLATFORM_ENUM, // MUST BE LAST VALUE. USED FOR ERROR CHECKING.
- };
- enum ESubsystem
- {
- ESubsys_3DEngine = 0,
- ESubsys_AI = 1,
- ESubsys_Physics = 2,
- ESubsys_Renderer = 3,
- ESubsys_Script = 4
- };
- // Summary:
- // Collates cycles taken per update.
- struct sUpdateTimes
- {
- uint32 PhysYields;
- uint64 SysUpdateTime;
- uint64 PhysStepTime;
- uint64 RenderTime;
- //extended yimes info
- uint64 physWaitTime;
- uint64 streamingWaitTime;
- uint64 animationWaitTime;
- };
- enum ESystemGlobalState
- {
- ESYSTEM_GLOBAL_STATE_UNKNOWN,
- ESYSTEM_GLOBAL_STATE_INIT,
- ESYSTEM_GLOBAL_STATE_RUNNING,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PREPARE,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_MATERIALS,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_OBJECTS,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_STATIC_WORLD,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_PRECACHE,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_START_TEXTURES,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_END,
- ESYSTEM_GLOBAL_STATE_LEVEL_LOAD_COMPLETE
- };
- // Summary:
- // System wide events.
- enum ESystemEvent
- {
- // Description:
- // Seeds all random number generators to the same seed number, WParam will hold seed value.
- //##@{
- ESYSTEM_EVENT_RANDOM_SEED = 1,
- ESYSTEM_EVENT_RANDOM_ENABLE,
- ESYSTEM_EVENT_RANDOM_DISABLE,
- //##@}
- // Description:
- // Changes to main window focus.
- // wparam is not 0 is focused, 0 if not focused
- ESYSTEM_EVENT_CHANGE_FOCUS = 10,
- // Description:
- // Moves of the main window.
- // wparam=x, lparam=y
- ESYSTEM_EVENT_MOVE = 11,
- // Description:
- // Resizes of the main window.
- // wparam=width, lparam=height
- ESYSTEM_EVENT_RESIZE = 12,
- // Description:
- // Activation of the main window.
- // wparam=1/0, 1=active 0=inactive
- ESYSTEM_EVENT_ACTIVATE = 13,
- // Description:
- // Main window position changed.
- ESYSTEM_EVENT_POS_CHANGED = 14,
- // Description:
- // Main window style changed.
- ESYSTEM_EVENT_STYLE_CHANGED = 15,
- // Description:
- // Sent before the loading movie is begun
- ESYSTEM_EVENT_LEVEL_LOAD_START_PRELOADINGSCREEN,
- // Description:
- // Sent before the loading last save
- ESYSTEM_EVENT_LEVEL_LOAD_RESUME_GAME,
- // Description:
- // Sent before starting level, before game rules initialization and before ESYSTEM_EVENT_LEVEL_LOAD_START event
- // Used mostly for level loading profiling
- ESYSTEM_EVENT_LEVEL_LOAD_PREPARE,
- // Description:
- // Sent to start the active loading screen rendering.
- ESYSTEM_EVENT_LEVEL_LOAD_START_LOADINGSCREEN,
- // Description:
- // Sent when loading screen is active
- ESYSTEM_EVENT_LEVEL_LOAD_LOADINGSCREEN_ACTIVE,
- // Description:
- // Sent before starting loading a new level.
- // Used for a more efficient resource management.
- ESYSTEM_EVENT_LEVEL_LOAD_START,
- // Description:
- // Sent after loading a level finished.
- // Used for a more efficient resource management.
- ESYSTEM_EVENT_LEVEL_LOAD_END,
- // Description:
- // Sent after trying to load a level failed.
- // Used for resetting the front end.
- ESYSTEM_EVENT_LEVEL_LOAD_ERROR,
- // Description:
- // Sent in case the level was requested to load, but it's not ready
- // Used in streaming install scenario for notifying the front end.
- ESYSTEM_EVENT_LEVEL_NOT_READY,
- // Description:
- // Sent after precaching of the streaming system has been done
- ESYSTEM_EVENT_LEVEL_PRECACHE_START,
- // Description:
- // Sent before object/texture precache stream requests are submitted
- ESYSTEM_EVENT_LEVEL_PRECACHE_FIRST_FRAME,
- // Description:
- // Sent when level loading is completely finished with no more onscreen
- // movie or info rendering, and when actual gameplay can start
- ESYSTEM_EVENT_LEVEL_GAMEPLAY_START,
- // Level is unloading.
- ESYSTEM_EVENT_LEVEL_UNLOAD,
- // Summary:
- // Sent after level have been unloaded. For cleanup code.
- ESYSTEM_EVENT_LEVEL_POST_UNLOAD,
- // Summary:
- // Called when the game framework has been initialized.
- ESYSTEM_EVENT_GAME_POST_INIT,
- // Summary:
- // Called when the game framework has been initialized, not loading should happen in this event.
- ESYSTEM_EVENT_GAME_POST_INIT_DONE,
- // Summary:
- // Sent when the system is doing a full shutdown.
- ESYSTEM_EVENT_FULL_SHUTDOWN,
- // Summary:
- // Sent when the system is doing a fast shutdown.
- ESYSTEM_EVENT_FAST_SHUTDOWN,
- // Summary:
- // When keyboard layout changed.
- ESYSTEM_EVENT_LANGUAGE_CHANGE,
- // Description:
- // Toggled fullscreen.
- // wparam is 1 means we switched to fullscreen, 0 if for windowed
- ESYSTEM_EVENT_TOGGLE_FULLSCREEN,
- ESYSTEM_EVENT_SHARE_SHADER_COMBINATIONS,
- // Summary:
- // Start 3D post rendering
- ESYSTEM_EVENT_3D_POST_RENDERING_START,
- // Summary:
- // End 3D post rendering
- ESYSTEM_EVENT_3D_POST_RENDERING_END,
- // Summary:
- // Called before switching to level memory heap
- ESYSTEM_EVENT_SWITCHING_TO_LEVEL_HEAP_DEPRECATED,
- // Summary:
- // Called after switching to level memory heap
- ESYSTEM_EVENT_SWITCHED_TO_LEVEL_HEAP_DEPRECATED,
- // Summary:
- // Called before switching to global memory heap
- ESYSTEM_EVENT_SWITCHING_TO_GLOBAL_HEAP_DEPRECATED,
- // Summary:
- // Called after switching to global memory heap
- ESYSTEM_EVENT_SWITCHED_TO_GLOBAL_HEAP_DEPRECATED,
- // Description:
- // Sent after precaching of the streaming system has been done
- ESYSTEM_EVENT_LEVEL_PRECACHE_END,
- // Description:
- // Sent when game mode switch begins
- ESYSTEM_EVENT_GAME_MODE_SWITCH_START,
- // Description:
- // Sent when game mode switch ends
- ESYSTEM_EVENT_GAME_MODE_SWITCH_END,
- // Description:
- // Video notifications
- // wparam=[0/1/2/3] : [stop/play/pause/resume]
- ESYSTEM_EVENT_VIDEO,
- // Description:
- // Sent if the game is paused
- ESYSTEM_EVENT_GAME_PAUSED,
- // Description:
- // Sent if the game is resumed
- ESYSTEM_EVENT_GAME_RESUMED,
- // Description:
- // Sent when time of day is set
- ESYSTEM_EVENT_TIME_OF_DAY_SET,
- // Description:
- // Sent once the Editor finished initialization.
- ESYSTEM_EVENT_EDITOR_ON_INIT,
- // Description:
- // Sent when frontend is initialised
- ESYSTEM_EVENT_FRONTEND_INITIALISED,
- // Description:
- // Sent once the Editor switches between in-game and editing mode.
- ESYSTEM_EVENT_EDITOR_GAME_MODE_CHANGED,
- // Description:
- // Sent once the Editor switches simulation mode (AI/Physics).
- ESYSTEM_EVENT_EDITOR_SIMULATION_MODE_CHANGED,
- // Description:
- // Sent when frontend is reloaded
- ESYSTEM_EVENT_FRONTEND_RELOADED,
- #if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_1
- #include AZ_RESTRICTED_FILE(ISystem_h)
- #endif
- #if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_2
- #include AZ_RESTRICTED_FILE(ISystem_h)
- #endif
- ESYSTEM_EVENT_STREAMING_INSTALL_ERROR,
- // Description:
- // Sent when the online services are initialized.
- ESYSTEM_EVENT_ONLINE_SERVICES_INITIALISED,
- // Description:
- // Sent when a new audio implementation is loaded
- ESYSTEM_EVENT_AUDIO_IMPLEMENTATION_LOADED,
- // Description:
- // Sent when simulation mode switch begins
- ESYSTEM_EVENT_EDITOR_SIMULATION_MODE_SWITCH_START,
- // Description:
- // Sent when simluation mode switch ends
- ESYSTEM_EVENT_EDITOR_SIMULATION_MODE_SWITCH_END,
- ESYSTEM_EVENT_USER = 0x1000,
- ESYSTEM_BEAM_PLAYER_TO_CAMERA_POS
- };
- // Description:
- // User defined callback, which can be passed to ISystem.
- struct ISystemUserCallback
- {
- // <interfuscator:shuffle>
- virtual ~ISystemUserCallback() {}
- // Description:
- // This method is called at the earliest point the ISystem pointer can be used
- // the log might not be yet there.
- virtual void OnSystemConnect([[maybe_unused]] ISystem* pSystem) {}
- // Summary:
- // Signals to User that engine error occurred.
- // Return Value:
- // True to Halt execution or false to ignore this error
- virtual bool OnError(const char* szErrorString) = 0;
- // Notes:
- // If working in Editor environment notify user that engine want to Save current document.
- // This happens if critical error have occurred and engine gives a user way to save data and not lose it
- // due to crash.
- virtual bool OnSaveDocument() = 0;
- // Notes:
- // If working in Editor environment and a critical error occurs notify the user to backup
- // the current document to prevent data loss due to crash.
- virtual bool OnBackupDocument() = 0;
- // Description:
- // Notifies user that system wants to switch out of current process.
- // Example:
- // Called when pressing ESC in game mode to go to Menu.
- virtual void OnProcessSwitch() = 0;
- // Description:
- // Notifies user, usually editor, about initialization progress in system.
- virtual void OnInitProgress(const char* sProgressMsg) = 0;
- // Description:
- // Initialization callback. This is called early in CSystem::Init(), before
- // any of the other callback methods is called.
- // See also:
- // CSystem::Init()
- virtual void OnInit(ISystem*) { }
- // Summary:
- // Shutdown callback.
- virtual void OnShutdown() { }
- // Summary:
- // Quit callback.
- // See also:
- // CSystem::Quit()
- virtual void OnQuit() { }
- // Description:
- // Notify user of an update iteration. Called in the update loop.
- virtual void OnUpdate() { }
- // Description:
- // Show message by provider.
- virtual int ShowMessage(const char* text, const char* caption, unsigned int uType) { return CryMessageBox(text, caption, uType); }
- // Description:
- // Collects the memory information in the user program/application.
- virtual void GetMemoryUsage(ICrySizer* pSizer) = 0;
- // </interfuscator:shuffle>
- // Post console load, for cvar setting
- virtual void OnConsoleCreated([[maybe_unused]] ::IConsole* pConsole) {}
- };
- // Description:
- // Interface used for getting notified when a system event occurs.
- struct ISystemEventListener
- {
- // <interfuscator:shuffle>
- virtual ~ISystemEventListener() {}
- virtual void OnSystemEventAnyThread([[maybe_unused]] ESystemEvent event, [[maybe_unused]] UINT_PTR wparam, [[maybe_unused]] UINT_PTR lparam) {}
- virtual void OnSystemEvent([[maybe_unused]] ESystemEvent event, [[maybe_unused]] UINT_PTR wparam, [[maybe_unused]] UINT_PTR lparam) { }
- // </interfuscator:shuffle>
- };
- // Description:
- // Structure used for getting notified when a system event occurs.
- struct ISystemEventDispatcher
- {
- // <interfuscator:shuffle>
- virtual ~ISystemEventDispatcher() {}
- virtual bool RegisterListener(ISystemEventListener* pListener) = 0;
- virtual bool RemoveListener(ISystemEventListener* pListener) = 0;
- virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) = 0;
- virtual void Update() = 0;
- //virtual void OnLocaleChange() = 0;
- // </interfuscator:shuffle>
- };
- struct IErrorObserver
- {
- // <interfuscator:shuffle>
- virtual ~IErrorObserver() {}
- virtual void OnAssert(const char* condition, const char* message, const char* fileName, unsigned int fileLineNumber) = 0;
- virtual void OnFatalError(const char* message) = 0;
- // </interfuscator:shuffle>
- };
- enum ESystemProtectedFunctions
- {
- eProtectedFunc_Save = 0,
- eProtectedFunc_Load = 1,
- eProtectedFuncsLast = 10,
- };
- struct SCvarsDefault
- {
- SCvarsDefault()
- {
- sz_r_DriverDef = NULL;
- }
- const char* sz_r_DriverDef;
- };
- #if defined(CVARS_WHITELIST)
- struct ICVarsWhitelist
- {
- // <interfuscator:shuffle>
- virtual ~ICVarsWhitelist() {};
- virtual bool IsWhiteListed(const string& command, bool silent) = 0;
- // </interfuscator:shuffle>
- };
- #endif // defined(CVARS_WHITELIST)
- #if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_3
- #include AZ_RESTRICTED_FILE(ISystem_h)
- #endif
- namespace AZ
- {
- namespace Internal
- {
- class EnvironmentInterface;
- } // namespace Internal
- } // namespace AZ
- typedef AZ::Internal::EnvironmentInterface SharedEnvironmentInstance;
- // Description:
- // Structure passed to Init method of ISystem interface.
- struct SSystemInitParams
- {
- void* hInstance; //
- void* hWnd; //
- void* hWndForInputSystem; // the HWND for the input devices, distinct from the hWnd, which the rendering system overrides anyways
- bool remoteResourceCompiler;
- ILog* pLog; // You can specify your own ILog to be used by System.
- ILogCallback* pLogCallback; // You can specify your own ILogCallback to be added on log creation (used by Editor).
- ISystemUserCallback* pUserCallback;
- const char* sLogFileName; // File name to use for log.
- bool autoBackupLogs; // if true, logs will be automatically backed up each startup
- IValidator* pValidator; // You can specify different validator object to use by System.
- IOutputPrintSink* pPrintSync; // Print Sync which can be used to catch all output from engine
- char szSystemCmdLine[2048]; // Command line.
- bool bEditor; // When running in Editor mode.
- bool bPreview; // When running in Preview mode (Minimal initialization).
- bool bTestMode; // When running in Automated testing mode.
- bool bDedicatedServer; // When running a dedicated server.
- bool bExecuteCommandLine; // can be switched of to suppress the feature or do it later during the initialization.
- bool bSkipFont; // Don't load CryFont.dll
- bool bSkipRenderer; // Don't load Renderer
- bool bSkipConsole; // Don't create console
- bool bSkipNetwork; // Don't create Network
- bool bSkipWebsocketServer; // Don't create the WebSocket server
- bool bMinimal; // Don't load banks
- bool bTesting; // CryUnit
- bool bNoRandom; //use fixed generator init/seed
- bool bShaderCacheGen; // When running in shadercache gen mode
- bool bUnattendedMode; // When running as part of a build on build-machines: Prevent popping up of any dialog
- bool bSkipMovie; // Don't load movie
- bool bSkipAnimation; // Don't load animation
- bool bToolMode; // System is running inside a tool. Will not create USER directory or anything else that the game needs to do
- bool bSkipPhysics; // Don't initialize CryPhysics.
- ISystem* pSystem; // Pointer to existing ISystem interface, it will be reused if not NULL.
- typedef void* (*ProtectedFunction)(void* param1, void* param2);
- ProtectedFunction pProtectedFunctions[eProtectedFuncsLast]; // Protected functions.
- SCvarsDefault* pCvarsDefault; // to override the default value of some cvar
- #if defined(CVARS_WHITELIST)
- ICVarsWhitelist* pCVarsWhitelist; // CVars whitelist callback
- #endif // defined(CVARS_WHITELIST)
- SharedEnvironmentInstance* pSharedEnvironment;
- // Summary:
- // Initialization defaults.
- SSystemInitParams()
- {
- hInstance = NULL;
- hWnd = NULL;
- hWndForInputSystem = NULL;
- remoteResourceCompiler = false;
- pLog = NULL;
- pLogCallback = NULL;
- pUserCallback = NULL;
- #if defined(CVARS_WHITELIST)
- pCVarsWhitelist = NULL;
- #endif // defined(CVARS_WHITELIST)
- sLogFileName = NULL;
- autoBackupLogs = true;
- pValidator = NULL;
- pPrintSync = NULL;
- memset(szSystemCmdLine, 0, sizeof(szSystemCmdLine));
- bEditor = false;
- bPreview = false;
- bTestMode = false;
- bDedicatedServer = false;
- bExecuteCommandLine = true;
- bExecuteCommandLine = true;
- bSkipFont = false;
- bSkipRenderer = false;
- bSkipConsole = false;
- bSkipNetwork = false;
- #if defined(WIN32) || defined(WIN64)
- // create websocket server by default. bear in mind that USE_HTTP_WEBSOCKETS is not defined in release.
- bSkipWebsocketServer = false;
- #else
- // CTCPStreamSocket only seems to fully support Win32 and 64
- bSkipWebsocketServer = true;
- #endif
- bMinimal = false;
- bTesting = false;
- bNoRandom = false;
- bShaderCacheGen = false;
- bUnattendedMode = false;
- bSkipMovie = false;
- bSkipAnimation = false;
- bToolMode = false;
- bSkipPhysics = false;
- pSystem = NULL;
- memset(pProtectedFunctions, 0, sizeof(pProtectedFunctions));
- pCvarsDefault = NULL;
- pSharedEnvironment = nullptr;
- }
- };
- // Notes:
- // Can be used for LoadConfiguration().
- // See also:
- // LoadConfiguration()
- struct ILoadConfigurationEntrySink
- {
- // <interfuscator:shuffle>
- virtual ~ILoadConfigurationEntrySink() {}
- virtual void OnLoadConfigurationEntry(const char* szKey, const char* szValue, const char* szGroup) = 0;
- virtual void OnLoadConfigurationEntry_End() {}
- // </interfuscator:shuffle>
- };
- struct SPlatformInfo
- {
- unsigned int numCoresAvailableToProcess;
- unsigned int numLogicalProcessors;
- #if defined(WIN32) || defined(WIN64)
- enum EWinVersion
- {
- WinUndetected,
- Win2000,
- WinXP,
- WinSrv2003,
- WinVista,
- Win7,
- Win8,
- Win81,
- Win10
- };
- EWinVersion winVer;
- bool win64Bit;
- bool vistaKB940105Required;
- #endif
- };
- // Description:
- // Holds info about system update stats over perior of time (cvar-tweakable)
- struct SSystemUpdateStats
- {
- SSystemUpdateStats()
- : avgUpdateTime(0.0f)
- , minUpdateTime(0.0f)
- , maxUpdateTime(0.0f) {}
- float avgUpdateTime;
- float minUpdateTime;
- float maxUpdateTime;
- };
- // Description:
- // Global environment.
- // Contains pointers to all global often needed interfaces.
- // This is a faster way to get interface pointer then calling ISystem interface to retrieve one.
- // Notes:
- // Some pointers can be NULL, use with care.
- // See also:
- // ISystem
- struct SSystemGlobalEnvironment
- {
- I3DEngine* p3DEngine;
- AZ::IO::IArchive* pCryPak;
- AZ::IO::FileIOBase* pFileIO;
- IFileChangeMonitor* pFileChangeMonitor;
- IProfileLogSystem* pProfileLogSystem;
- IOpticsManager* pOpticsManager;
- ITimer* pTimer;
- ICryFont* pCryFont;
- ILocalMemoryUsage* pLocalMemoryUsage;
- ::IConsole* pConsole;
- ISystem* pSystem = nullptr;
- ILog* pLog;
- IMovieSystem* pMovieSystem;
- INameTable* pNameTable;
- IVisualLog* pVisualLog;
- IRenderer* pRenderer;
- IMaterialEffects* pMaterialEffects;
- ISoftCodeMgr* pSoftCodeMgr;
- IOverloadSceneManager* pOverloadSceneManager;
- IServiceNetwork* pServiceNetwork;
- IRemoteCommandManager* pRemoteCommandManager;
- ILyShine* pLyShine;
- IResourceCompilerHelper* pResourceCompilerHelper;
- SharedEnvironmentInstance* pSharedEnvironment;
- IThreadManager* pThreadManager;
- #if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_4
- #include AZ_RESTRICTED_FILE(ISystem_h)
- #endif
- ISystemScheduler* pSystemScheduler;
- threadID mMainThreadId; //The main thread ID is used in multiple systems so should be stored globally
- //////////////////////////////////////////////////////////////////////////
- uint32 nMainFrameID;
- //////////////////////////////////////////////////////////////////////////
- const char* szCmdLine; // Startup command line.
- //////////////////////////////////////////////////////////////////////////
- // Generic debug string which can be easily updated by any system and output by the debug handler
- enum
- {
- MAX_DEBUG_STRING_LENGTH = 128
- };
- char szDebugStatus[MAX_DEBUG_STRING_LENGTH];
- //////////////////////////////////////////////////////////////////////////
- // Used to tell if this is a server/multiplayer instance
- bool bServer;
- bool bMultiplayer;
- bool bHostMigrating;
- //////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- // Indicate Editor status.
- //////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- // Used by CRY_ASSERT
- bool bIgnoreAllAsserts;
- bool bNoAssertDialog;
- bool bTesting;
- //////////////////////////////////////////////////////////////////////////
- bool bNoRandomSeed;
- SPlatformInfo pi;
- // Protected functions.
- SSystemInitParams::ProtectedFunction pProtectedFunctions[eProtectedFuncsLast]; // Protected functions.
- //////////////////////////////////////////////////////////////////////////
- // Flag to able to print out of memory conditon
- bool bIsOutOfMemory;
- bool bIsOutOfVideoMemory;
- bool bToolMode;
- int retCode = 0;
- ILINE const bool IsClient() const
- {
- #if defined(CONSOLE)
- return true;
- #else
- return bClient;
- #endif
- }
- ILINE const bool IsDedicated() const
- {
- #if defined(CONSOLE)
- return false;
- #else
- return bDedicated;
- #endif
- }
- #if !defined(CONSOLE)
- ILINE void SetIsEditor(bool isEditor)
- {
- bEditor = isEditor;
- }
- ILINE void SetIsEditorGameMode(bool isEditorGameMode)
- {
- bEditorGameMode = isEditorGameMode;
- }
- ILINE void SetIsEditorSimulationMode(bool isEditorSimulationMode)
- {
- bEditorSimulationMode = isEditorSimulationMode;
- }
- ILINE void SetIsDedicated(bool isDedicated)
- {
- bDedicated = isDedicated;
- }
- ILINE void SetIsClient(bool isClient)
- {
- bClient = isClient;
- }
- #endif
- //this way the compiler can strip out code for consoles
- ILINE const bool IsEditor() const
- {
- #if defined(CONSOLE)
- return false;
- #else
- return bEditor;
- #endif
- }
- ILINE const bool IsEditorGameMode() const
- {
- #if defined(CONSOLE)
- return false;
- #else
- return bEditorGameMode;
- #endif
- }
- ILINE const bool IsEditorSimulationMode() const
- {
- #if defined(CONSOLE)
- return false;
- #else
- return bEditorSimulationMode;
- #endif
- }
- ILINE const bool IsEditing() const
- {
- #if defined(CONSOLE)
- return false;
- #else
- return bEditor && !bEditorGameMode;
- #endif
- }
- ILINE const bool IsFMVPlaying() const
- {
- return m_isFMVPlaying;
- }
- ILINE void SetFMVIsPlaying(const bool isPlaying)
- {
- m_isFMVPlaying = isPlaying;
- }
- ILINE const bool IsCutscenePlaying() const
- {
- return m_isCutscenePlaying;
- }
- ILINE void SetCutsceneIsPlaying(const bool isPlaying)
- {
- m_isCutscenePlaying = isPlaying;
- }
- ILINE bool IsInToolMode() const
- {
- return bToolMode;
- }
- ILINE void SetToolMode(bool bNewToolMode)
- {
- bToolMode = bNewToolMode;
- }
- ILINE void SetDynamicMergedMeshGenerationEnabled(bool mmgenEnable)
- {
- m_bDynamicMergedMeshGenerationEnabled = mmgenEnable;
- }
- ILINE const bool IsDynamicMergedMeshGenerationEnabled() const
- {
- return m_bDynamicMergedMeshGenerationEnabled;
- }
- #if !defined(CONSOLE)
- private:
- bool bClient;
- bool bEditor; // Engine is running under editor.
- bool bEditorGameMode; // Engine is in editor game mode.
- bool bEditorSimulationMode; // Engine is in editor simulation mode.
- bool bDedicated; // Engine is in dedicated
- #endif
- bool m_isFMVPlaying;
- bool m_isCutscenePlaying;
- bool m_bDynamicMergedMeshGenerationEnabled;
- public:
- SSystemGlobalEnvironment()
- : pSystemScheduler(nullptr)
- , szCmdLine("")
- , bToolMode(false)
- , m_bDynamicMergedMeshGenerationEnabled(false)
- {
- };
- };
- // NOTE Nov 25, 2008: <pvl> the ISystem interface that follows has a member function
- // called 'GetUserName'. If we don't #undef'ine the same-named Win32 symbol here
- // ISystem wouldn't even compile.
- // TODO Nov 25, 2008: <pvl> there might be a better place for this?
- #ifdef GetUserName
- #undef GetUserName
- #endif
- struct IProfilingSystem
- {
- // <interfuscator:shuffle>
- virtual ~IProfilingSystem() {}
- //////////////////////////////////////////////////////////////////////////
- // VTune Profiling interface.
- // Summary:
- // Resumes vtune data collection.
- virtual void VTuneResume() = 0;
- // Summary:
- // Pauses vtune data collection.
- virtual void VTunePause() = 0;
- //////////////////////////////////////////////////////////////////////////
- // </interfuscator:shuffle>
- };
- ////////////////////////////////////////////////////////////////////////////////////////////////
- // Description:
- // Main Engine Interface.
- // Initialize and dispatch all engine's subsystems.
- struct ISystem
- {
- struct ILoadingProgressListener
- {
- // <interfuscator:shuffle>
- virtual ~ILoadingProgressListener() {}
- virtual void OnLoadingProgress(int steps) = 0;
- // </interfuscator:shuffle>
- };
- #ifndef _RELEASE
- enum LevelLoadOrigin
- {
- eLLO_Unknown,
- eLLO_NewLevel,
- eLLO_Level2Level,
- eLLO_Resumed,
- eLLO_MapCmd,
- };
- struct ICheckpointData
- {
- int m_totalLoads;
- LevelLoadOrigin m_loadOrigin;
- };
- #endif
- // <interfuscator:shuffle>
- virtual ~ISystem() {}
- // Summary:
- // Releases ISystem.
- virtual void Release() = 0;
- virtual ILoadConfigurationEntrySink* GetCVarsWhiteListConfigSink() const = 0; // will return NULL if no whitelisting
- // Summary:
- // Returns pointer to the global environment structure.
- virtual SSystemGlobalEnvironment* GetGlobalEnvironment() = 0;
- // Summary:
- // Updates all subsystems (including the ScriptSink() )
- // Arguments:
- // flags - One or more flags from ESystemUpdateFlags structure.
- // nPauseMode - 0=normal(no pause), 1=menu/pause, 2=cutscene
- virtual bool UpdatePreTickBus(int updateFlags = 0, int nPauseMode = 0) = 0;
- // Summary:
- // Updates all subsystems (including the ScriptSink() )
- // Arguments:
- // flags - One or more flags from ESystemUpdateFlags structure.
- // nPauseMode - 0=normal(no pause), 1=menu/pause, 2=cutscene
- virtual bool UpdatePostTickBus(int updateFlags = 0, int nPauseMode = 0) = 0;
- // Summary:
- // Updates only require components during loading
- virtual bool UpdateLoadtime() = 0;
- // Summary:
- // Optimisation: do part of the update while waiting for occlusion queries to complete
- virtual void DoWorkDuringOcclusionChecks() = 0;
- virtual bool NeedDoWorkDuringOcclusionChecks() = 0;
- // Summary:
- // Renders subsystems.
- virtual void Render() = 0;
- // Summary:
- // Begins rendering frame.
- virtual void RenderBegin() = 0;
- // Summary:
- // Ends rendering frame and swap back buffer.
- virtual void RenderEnd(bool bRenderStats = true, bool bMainWindow = true) = 0;
- //! Update screen and call some important tick functions during loading.
- virtual void SynchronousLoadingTick(const char* pFunc, int line) = 0;
- // Description:
- // Renders the statistics; this is called from RenderEnd, but if the
- // Host application (Editor) doesn't employ the Render cycle in ISystem,
- // it may call this method to render the essential statistics.
- virtual void RenderStatistics() = 0;
- // Summary:
- // Returns the current used memory.
- virtual uint32 GetUsedMemory() = 0;
- // Summary:
- // Retrieve the name of the user currently logged in to the computer.
- virtual const char* GetUserName() = 0;
- // Summary:
- // Gets current supported CPU features flags. (CPUF_SSE, CPUF_SSE2, CPUF_3DNOW, CPUF_MMX)
- virtual int GetCPUFlags() = 0;
- // Summary:
- // Gets number of CPUs
- virtual int GetLogicalCPUCount() = 0;
- // Summary:
- // Return the rendering driver name. GL or Metal
- virtual const char* GetRenderingDriverName() const = 0;
- // Summary:
- // Dumps the memory usage statistics to the logging default MB. (can be KB)
- virtual void DumpMemoryUsageStatistics(bool bUseKB = false) = 0;
- // Summary:
- // Quits the application.
- virtual void Quit() = 0;
- // Summary:
- // Tells the system if it is relaunching or not.
- virtual void Relaunch(bool bRelaunch) = 0;
- // Summary:
- // Returns true if the application is in the shutdown phase.
- virtual bool IsQuitting() const = 0;
- // Summary:
- // Returns true if the application was initialized to generate the shader cache.
- virtual bool IsShaderCacheGenMode() const = 0;
- // Summary:
- // Tells the system in which way we are using the serialization system.
- virtual void SerializingFile(int mode) = 0;
- virtual int IsSerializingFile() const = 0;
- virtual bool IsRelaunch() const = 0;
- // Summary:
- // Displays an error message to display info for certain time
- // Arguments:
- // acMessage - Message to show
- // fTime - Amount of seconds to show onscreen
- virtual void DisplayErrorMessage(const char* acMessage, float fTime, const float* pfColor = 0, bool bHardError = true) = 0;
- // Description:
- // Displays error message.
- // Logs it to console and file and error message box then terminates execution.
- virtual void FatalError(const char* sFormat, ...) PRINTF_PARAMS(2, 3) = 0;
- // Description:
- // Reports a bug using the crash handler.
- // Logs an error to the console and launches the crash handler, then continues execution.
- virtual void ReportBug(const char* sFormat, ...) PRINTF_PARAMS(2, 3) = 0;
- // Description:
- // Report warning to current Validator object.
- // Doesn't terminate the execution.
- //##@{
- virtual void WarningV(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, va_list args) = 0;
- virtual void Warning(EValidatorModule module, EValidatorSeverity severity, int flags, const char* file, const char* format, ...) = 0;
- //##@}
- // Description:
- // Report message by provider or by using CryMessageBox.
- // Doesn't terminate the execution.
- virtual int ShowMessage(const char* text, const char* caption, unsigned int uType) = 0;
- // Summary:
- // Compare specified verbosity level to the one currently set.
- virtual bool CheckLogVerbosity(int verbosity) = 0;
- // return the related subsystem interface
- //
- virtual IZLibCompressor* GetIZLibCompressor() = 0;
- virtual IZLibDecompressor* GetIZLibDecompressor() = 0;
- virtual ILZ4Decompressor* GetLZ4Decompressor() = 0;
- virtual IZStdDecompressor* GetZStdDecompressor() = 0;
- virtual ICryPerfHUD* GetPerfHUD() = 0;
- virtual INotificationNetwork* GetINotificationNetwork() = 0;
- virtual IViewSystem* GetIViewSystem() = 0;
- virtual ILevelSystem* GetILevelSystem() = 0;
- virtual INameTable* GetINameTable() = 0;
- virtual IValidator* GetIValidator() = 0;
- virtual IStreamEngine* GetStreamEngine() = 0;
- virtual ICmdLine* GetICmdLine() = 0;
- virtual ILog* GetILog() = 0;
- virtual AZ::IO::IArchive* GetIPak() = 0;
- virtual ICryFont* GetICryFont() = 0;
- virtual IMemoryManager* GetIMemoryManager() = 0;
- virtual IMovieSystem* GetIMovieSystem() = 0;
- virtual I3DEngine* GetI3DEngine() = 0;
- virtual ::IConsole* GetIConsole() = 0;
- virtual IRemoteConsole* GetIRemoteConsole() = 0;
- // Returns:
- // Can be NULL, because it only exists when running through the editor, not in pure game mode.
- virtual IResourceManager* GetIResourceManager() = 0;
- virtual IThreadTaskManager* GetIThreadTaskManager() = 0;
- virtual IProfilingSystem* GetIProfilingSystem() = 0;
- virtual ISystemEventDispatcher* GetISystemEventDispatcher() = 0;
- virtual IVisualLog* GetIVisualLog() = 0;
- virtual IFileChangeMonitor* GetIFileChangeMonitor() = 0;
- virtual WIN_HWND GetHWND() = 0;
- virtual IRenderer* GetIRenderer() = 0;
- virtual ITimer* GetITimer() = 0;
- virtual IThreadManager* GetIThreadManager() = 0;
- //irtual IThreadManager* GetIThreadManager() = 0;
- virtual void SetLoadingProgressListener(ILoadingProgressListener* pListener) = 0;
- virtual ISystem::ILoadingProgressListener* GetLoadingProgressListener() const = 0;
- // Summary:
- // Game is created after System init, so has to be set explicitly.
- virtual void SetIMaterialEffects(IMaterialEffects* pMaterialEffects) = 0;
- virtual void SetIOpticsManager(IOpticsManager* pOpticsManager) = 0;
- virtual void SetIFileChangeMonitor(IFileChangeMonitor* pFileChangeMonitor) = 0;
- virtual void SetIVisualLog(IVisualLog* pVisualLog) = 0;
- //virtual const char *GetGamePath()=0;
- virtual void DebugStats(bool checkpoint, bool leaks) = 0;
- virtual void DumpWinHeaps() = 0;
- virtual int DumpMMStats(bool log) = 0;
- // Arguments:
- // bValue - Set to true when running on a cheat protected server or a client that is connected to it (not used in singleplayer).
- virtual void SetForceNonDevMode(const bool bValue) = 0;
- // Return Value:
- // True when running on a cheat protected server or a client that is connected to it (not used in singleplayer).
- virtual bool GetForceNonDevMode() const = 0;
- virtual bool WasInDevMode() const = 0;
- virtual bool IsDevMode() const = 0;
- virtual bool IsMODValid(const char* szMODName) const = 0;
- virtual bool IsMinimalMode() const = 0;
- //////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- // IXmlNode interface.
- //////////////////////////////////////////////////////////////////////////
- // Summary:
- // Creates new xml node.
- virtual XmlNodeRef CreateXmlNode(const char* sNodeName = "", bool bReuseStrings = false, bool bIsProcessingInstruction = false) = 0;
- // Summary:
- // Loads xml from memory buffer, returns 0 if load failed.
- virtual XmlNodeRef LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings = false, bool bSuppressWarnings = false) = 0;
- // Summary:
- // Loads xml file, returns 0 if load failed.
- virtual XmlNodeRef LoadXmlFromFile(const char* sFilename, bool bReuseStrings = false) = 0;
- // Summary:
- // Retrieves access to XML utilities interface.
- virtual IXmlUtils* GetXmlUtils() = 0;
- // Summary:
- // Interface to access different implementations of Serialization::IArchive in a centralized way.
- virtual Serialization::IArchiveHost* GetArchiveHost() const = 0;
- virtual void SetViewCamera(CCamera& Camera) = 0;
- virtual CCamera& GetViewCamera() = 0;
- // Description:
- // When ignore update sets to true, system will ignore and updates and render calls.
- virtual void IgnoreUpdates(bool bIgnore) = 0;
- // Summary:
- // Sets the active process
- // Arguments:
- // process - A pointer to a class that implement the IProcess interface.
- virtual void SetIProcess(IProcess* process) = 0;
- // Summary:
- // Gets the active process.
- // Return Value:
- // A pointer to the current active process.
- virtual IProcess* GetIProcess() = 0;
- // Return Value:
- // True if system running in Test mode.
- virtual bool IsTestMode() const = 0;
- //////////////////////////////////////////////////////////////////////////
- // File version.
- //////////////////////////////////////////////////////////////////////////
- // Summary:
- // Gets file version.
- virtual const SFileVersion& GetFileVersion() = 0;
- // Summary:
- // Gets product version.
- virtual const SFileVersion& GetProductVersion() = 0;
- // Summary:
- // Gets build version.
- virtual const SFileVersion& GetBuildVersion() = 0;
- // Summary:
- // Data compression
- //##@{
- virtual bool CompressDataBlock(const void* input, size_t inputSize, void* output, size_t& outputSize, int level = 3) = 0;
- virtual bool DecompressDataBlock(const void* input, size_t inputSize, void* output, size_t& outputSize) = 0;
- //##@}
- //////////////////////////////////////////////////////////////////////////
- // Configuration.
- //////////////////////////////////////////////////////////////////////////
- // Summary:
- // Loads configurations from CVarGroup directory recursively
- // If m_GraphicsSettingsMap is defined (in Graphics Settings Dialog box), fills in mapping based on sys_spec_Full
- // Arguments:
- // sPath - e.g. "Game/Config/CVarGroups"
- virtual void AddCVarGroupDirectory(const string& sPath) = 0;
- // Summary:
- // Saves system configuration.
- virtual void SaveConfiguration() = 0;
- // Summary:
- // Loads system configuration
- // Arguments:
- // pCallback - 0 means normal LoadConfigVar behaviour is used
- virtual void LoadConfiguration(const char* sFilename, ILoadConfigurationEntrySink* pSink = 0, bool warnIfMissing = true) = 0;
- // Summary:
- // Retrieves current configuration specification for client or server.
- // Arguments:
- // bClient - If true returns local client config spec, if false returns server config spec.
- virtual ESystemConfigSpec GetConfigSpec(bool bClient = true) = 0;
- virtual ESystemConfigSpec GetMaxConfigSpec() const = 0;
- // Summary:
- // Changes current configuration specification for client or server.
- // Arguments:
- // bClient - If true changes client config spec (sys_spec variable changed),
- // if false changes only server config spec (as known on the client).
- virtual void SetConfigSpec(ESystemConfigSpec spec, ESystemConfigPlatform platform, bool bClient) = 0;
- //////////////////////////////////////////////////////////////////////////
- // Summary:
- // Retrieves current configuration platform
- virtual ESystemConfigPlatform GetConfigPlatform() const = 0;
- // Summary:
- // Changes current configuration platform.
- virtual void SetConfigPlatform(const ESystemConfigPlatform platform) = 0;
- //////////////////////////////////////////////////////////////////////////
- // Summary:
- // Detects and set optimal spec.
- virtual void AutoDetectSpec(const bool detectResolution) = 0;
- // Summary:
- // Thread management for subsystems
- // Return Value:
- // Non-0 if the state was indeed changed, 0 if already in that state.
- virtual int SetThreadState(ESubsystem subsys, bool bActive) = 0;
- // Summary:
- // Creates and returns a usable object implementing ICrySizer interface.
- virtual ICrySizer* CreateSizer() = 0;
- // Summary:
- // Query if system is now paused.
- // Pause flag is set when calling system update with pause mode.
- virtual bool IsPaused() const = 0;
- // Summary:
- // Retrieves localized strings manager interface.
- virtual ILocalizationManager* GetLocalizationManager() = 0;
- virtual ITextModeConsole* GetITextModeConsole() = 0;
- // Summary:
- // Retrieves the perlin noise singleton instance.
- virtual CPNoise3* GetNoiseGen() = 0;
- // Summary:
- // Retrieves system update counter.
- virtual uint64 GetUpdateCounter() = 0;
- // Summary:
- // Gets access to all registered factories.
- virtual ICryFactoryRegistry* GetCryFactoryRegistry() const = 0;
- //////////////////////////////////////////////////////////////////////////
- // Error callback handling
- // Summary:
- // Registers listeners to CryAssert and error messages. (may not be called if asserts are disabled)
- // Each pointer can be registered only once. (stl::push_back_unique)
- // It will return false if the pointer is already registered. Returns true, otherwise.
- virtual bool RegisterErrorObserver(IErrorObserver* errorObserver) = 0;
- // Summary:
- // Unregisters listeners to CryAssert and error messages.
- // It will return false if the pointer is not registered. Otherwise, returns true.
- virtual bool UnregisterErrorObserver(IErrorObserver* errorObserver) = 0;
- // Summary:
- // Called after the processing of the assert message box on some platforms.
- // It will be called even when asserts are disabled by the console variables.
- virtual void OnAssert(const char* condition, const char* message, const char* fileName, unsigned int fileLineNumber) = 0;
- // Summary:
- // Returns if the assert window from CryAssert is visible.
- // OBS1: needed by the editor, as in some cases it can freeze if during an assert engine it will handle
- // some events such as mouse movement in a CryPhysics assert.
- // OBS2: it will always return false, if asserts are disabled or ignored.
- virtual bool IsAssertDialogVisible() const = 0;
- // Summary:
- // Sets the AssertVisisble internal variable.
- // Typically it should only be called by CryAssert.
- virtual void SetAssertVisible(bool bAssertVisble) = 0;
- //////////////////////////////////////////////////////////////////////////
- // Summary:
- // Enable/Disable drawing the console
- virtual void SetConsoleDrawEnabled(bool enabled) = 0;
- // Enable/Disable drawing the UI
- virtual void SetUIDrawEnabled(bool enabled) = 0;
- // Summary:
- // Get the index of the currently running Crytek application. (0 = first instance, 1 = second instance, etc)
- virtual int GetApplicationInstance() = 0;
- // Summary:
- // Get log index of the currently running lumberyard application. (0 = first instance, 1 = second instance, etc)
- virtual int GetApplicationLogInstance(const char* logFilePath) = 0;
- // Summary:
- // Retrieves the current stats for systems to update the respective time taken
- virtual sUpdateTimes& GetCurrentUpdateTimeStats() = 0;
- // Summary:
- // Retrieves the array of update times and the number of entries
- virtual const sUpdateTimes* GetUpdateTimeStats(uint32&, uint32&) = 0;
- // Summary:
- // Clear all currently logged and drawn on screen error messages
- virtual void ClearErrorMessages() = 0;
- //////////////////////////////////////////////////////////////////////////
- // For debugging use only!, query current C++ call stack.
- //////////////////////////////////////////////////////////////////////////
- // Notes:
- // Pass nCount to indicate maximum number of functions to get.
- // For debugging use only, query current C++ call stack.
- // Description:
- // Fills array of function pointers, nCount return number of functions.
- virtual void debug_GetCallStack(const char** pFunctions, int& nCount) = 0;
- // Summary:
- // Logs current callstack.
- // Notes:
- // For debugging use only!, query current C++ call stack.
- virtual void debug_LogCallStack(int nMaxFuncs = 32, int nFlags = 0) = 0;
- // Description:
- // Execute command line arguments.
- // Should be after init game.
- // Example:
- // +g_gametype ASSAULT +map "testy"
- virtual void ExecuteCommandLine(bool deferred=true) = 0;
- // Description:
- // GetSystemUpdate stats (all systems update without except console)
- // very useful on dedicated server as we throttle it to fixed frequency
- // returns zeroes if no updates happened yet
- virtual void GetUpdateStats(SSystemUpdateStats& stats) = 0;
- // Description:
- // Useful to investigate memory fragmentation.
- // Every time you call this from the console: #System.DumpMemoryCoverage()
- // it adds a line to "MemoryCoverage.bmp" (generated the first time, there is a max line count).
- virtual void DumpMemoryCoverage() = 0;
- virtual ESystemGlobalState GetSystemGlobalState(void) = 0;
- virtual void SetSystemGlobalState(const ESystemGlobalState systemGlobalState) = 0;
- // Summary:
- // Asynchronous memcpy
- // Note sync variable will be incremented (in calling thread) before job starts
- // and decremented when job finishes. Multiple async copies can therefore be
- // tied to the same sync variable, therefore it's advised to wait for completion with
- // while(*sync) (yield());
- virtual void AsyncMemcpy(void* dst, const void* src, size_t size, int nFlags, volatile int* sync) = 0;
- // </interfuscator:shuffle>
- #if defined(CVARS_WHITELIST)
- virtual ICVarsWhitelist* GetCVarsWhiteList() const = 0;
- #endif // defined(CVARS_WHITELIST)
- #ifndef _RELEASE
- virtual void GetCheckpointData(ICheckpointData& data) = 0;
- virtual void IncreaseCheckpointLoadCount() = 0;
- virtual void SetLoadOrigin(LevelLoadOrigin origin) = 0;
- #endif
- #if !defined(_RELEASE)
- virtual bool IsSavingResourceList() const = 0;
- #endif
- // Initializes Steam if needed and returns if it was successful
- virtual bool SteamInit() = 0;
- virtual const IImageHandler* GetImageHandler() const = 0;
- // Summary:
- // Loads a dynamic library, creates and initializes an instance of the module class
- virtual bool InitializeEngineModule(const char* dllName, const char* moduleClassName, const SSystemInitParams& initParams) = 0;
- // Summary:
- // Unloads a dynamic library as well as the corresponding instance of the module class
- virtual bool UnloadEngineModule(const char* dllName, const char* moduleClassName) = 0;
- // Summary:
- // Gets the root window message handler function
- // The returned pointer is platform-specific:
- // For Windows OS, the pointer is of type WNDPROC
- virtual void* GetRootWindowMessageHandler() = 0;
- // Summary:
- // Register a IWindowMessageHandler that will be informed about window messages
- // The delivered messages are platform-specific
- virtual void RegisterWindowMessageHandler(IWindowMessageHandler* pHandler) = 0;
- // Summary:
- // Unregister an IWindowMessageHandler that was previously registered using RegisterWindowMessageHandler
- virtual void UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler) = 0;
- // Create an instance of a Local File IO object (which reads directly off the local filesystem, instead of,
- // for example, reading from the network or a pack or USB or such.
- virtual std::shared_ptr<AZ::IO::FileIOBase> CreateLocalFileIO() = 0;
- ////////////////////////////////////////////////////////////////////////////////////////////////
- // EBus interface used to listen for cry system notifications
- class CrySystemNotifications : public AZ::EBusTraits
- {
- public:
- virtual ~CrySystemNotifications() = default;
- // Override to be notified right before the call to ISystem::Render
- virtual void OnPreRender() {}
- // Override to be notified right after the call to ISystem::Render (but before RenderEnd)
- virtual void OnPostRender() {}
- };
- using CrySystemNotificationBus = AZ::EBus<CrySystemNotifications>;
- };
- //JAT - this is a very important function for the dedicated server - it lets us run >1000 players per piece of server hardware
- //JAT - this saves us lots of money on the dedicated server hardware
- #define SYNCHRONOUS_LOADING_TICK() do { if (gEnv && gEnv->pSystem) {gEnv->pSystem->SynchronousLoadingTick(__FUNC__, __LINE__); } \
- } while (0)
- #if defined(USE_DISK_PROFILER)
- struct DiskOperationInfo
- {
- DiskOperationInfo()
- : m_nSeeksCount(0)
- , m_nFileOpenCount(0)
- , m_nFileReadCount(0)
- , m_dOperationSize(0.)
- , m_dOperationTime(0.) {}
- int m_nSeeksCount;
- int m_nFileOpenCount;
- int m_nFileReadCount;
- double m_dOperationTime;
- double m_dOperationSize;
- DiskOperationInfo& operator -= (const DiskOperationInfo& rv)
- {
- m_nSeeksCount -= rv.m_nSeeksCount;
- m_nFileOpenCount -= rv.m_nFileOpenCount;
- m_nFileReadCount -= rv.m_nFileReadCount;
- m_dOperationSize -= rv.m_dOperationSize;
- m_dOperationTime -= rv.m_dOperationTime;
- return *this;
- }
- DiskOperationInfo& operator += (const DiskOperationInfo& rv)
- {
- m_nSeeksCount += rv.m_nSeeksCount;
- m_nFileOpenCount += rv.m_nFileOpenCount;
- m_nFileReadCount += rv.m_nFileReadCount;
- m_dOperationSize += rv.m_dOperationSize;
- m_dOperationTime += rv.m_dOperationTime;
- return *this;
- }
- DiskOperationInfo& operator - (const DiskOperationInfo& rv)
- {
- DiskOperationInfo res(*this);
- return res -= rv;
- }
- DiskOperationInfo& operator + (const DiskOperationInfo& rv)
- {
- DiskOperationInfo res(*this);
- return res += rv;
- }
- };
- #endif
- #if defined(ENABLE_LOADING_PROFILER) && AZ_PROFILE_TELEMETRY
- #define LOADING_TIME_PROFILE_SECTION AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzCore)
- #define LOADING_TIME_PROFILE_SECTION_ARGS(...) AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, __VA_ARGS__)
- #define LOADING_TIME_PROFILE_SECTION_NAMED(sectionName) AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::AzCore, sectionName)
- #define LOADING_TIME_PROFILE_SECTION_NAMED_ARGS(sectionName, ...) AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::AzCore, sectionName, __VA_ARGS__)
- #else
- #define LOADING_TIME_PROFILE_SECTION
- #define LOADING_TIME_PROFILE_SECTION_ARGS(...)
- #define LOADING_TIME_PROFILE_SECTION_NAMED(sectionName)
- #define LOADING_TIME_PROFILE_SECTION_NAMED_ARGS(sectionName, ...)
- #endif
- //////////////////////////////////////////////////////////////////////////
- // CrySystem DLL Exports.
- //////////////////////////////////////////////////////////////////////////
- typedef ISystem* (*PFNCREATESYSTEMINTERFACE)(SSystemInitParams& initParams);
- //////////////////////////////////////////////////////////////////////////
- // Global environment variable.
- //////////////////////////////////////////////////////////////////////////
- extern SC_API SSystemGlobalEnvironment* gEnv;
- // Summary:
- // Gets the system interface.
- inline ISystem* GetISystem()
- {
- // Some unit tests temporarily install and then uninstall ISystem* mocks.
- // It is generally okay for runtime and tool systems which call this function to cache the returned pointer,
- // because their lifetime is usually shorter than the lifetime of the ISystem* implementation.
- // It is NOT safe for this function to cache it as a static itself, though, as the static it would cache
- // it inside may outlive the the actual instance implementing ISystem* when unit tests are torn down and then restarted.
- ISystem* systemInterface = gEnv ? gEnv->pSystem : nullptr;
- if (!systemInterface)
- {
- CrySystemRequestBus::BroadcastResult(systemInterface, &CrySystemRequests::GetCrySystem);
- }
- return systemInterface;
- };
- inline ISystemScheduler* GetISystemScheduler(void)
- {
- return gEnv->pSystemScheduler;
- };
- //////////////////////////////////////////////////////////////////////////
- // Description:
- // This function must be called once by each module at the beginning, to setup global pointers.
- extern "C" AZ_DLL_EXPORT void ModuleInitISystem(ISystem* pSystem, const char* moduleName);
- extern "C" AZ_DLL_EXPORT void ModuleShutdownISystem(ISystem* pSystem);
- extern "C" AZ_DLL_EXPORT void InjectEnvironment(void* env);
- extern "C" AZ_DLL_EXPORT void DetachEnvironment();
- void* GetModuleInitISystemSymbol();
- void* GetModuleShutdownISystemSymbol();
- void* GetInjectEnvironmentSymbol();
- void* GetDetachEnvironmentSymbol();
- #define PREVENT_MODULE_AND_ENVIRONMENT_SYMBOL_STRIPPING \
- AZ_UNUSED(GetModuleInitISystemSymbol()); \
- AZ_UNUSED(GetModuleShutdownISystemSymbol()); \
- AZ_UNUSED(GetInjectEnvironmentSymbol()); \
- AZ_UNUSED(GetDetachEnvironmentSymbol());
- extern bool g_bProfilerEnabled;
- extern int g_iTraceAllocations;
- // Summary:
- // Interface of the DLL.
- extern "C"
- {
- CRYSYSTEM_API ISystem* CreateSystemInterface(const SSystemInitParams& initParams);
- }
- // Description:
- // Displays error message.
- // Logs it to console and file and error message box.
- // Then terminates execution.
- void CryFatalError(const char*, ...) PRINTF_PARAMS(1, 2);
- inline void CryFatalError(const char* format, ...)
- {
- if (!gEnv || !gEnv->pSystem)
- {
- return;
- }
- va_list ArgList;
- char szBuffer[MAX_WARNING_LENGTH];
- va_start(ArgList, format);
- int count = azvsnprintf(szBuffer, sizeof(szBuffer), format, ArgList);
- if (count == -1 || count >= sizeof(szBuffer))
- {
- szBuffer[sizeof(szBuffer) - 1] = '\0';
- }
- va_end(ArgList);
- gEnv->pSystem->FatalError("%s", szBuffer);
- }
- //////////////////////////////////////////////////////////////////////////
- // Description:
- // Displays warning message.
- // Logs it to console and file and display a warning message box.
- // Doesn't terminate execution.
- void CryWarning(EValidatorModule, EValidatorSeverity, const char*, ...) PRINTF_PARAMS(3, 4);
- inline void CryWarning(EValidatorModule module, EValidatorSeverity severity, const char* format, ...)
- {
- if (!gEnv || !gEnv->pSystem || !format)
- {
- return;
- }
- va_list args;
- va_start(args, format);
- GetISystem()->WarningV(module, severity, 0, 0, format, args);
- va_end(args);
- }
- #ifdef EXCLUDE_CVARHELP
- #define CVARHELP(_comment) 0
- #else
- #define CVARHELP(_comment) _comment
- #endif
- //Provide macros for fixing cvars for release mode on consoles to enums to allow for code stripping
- //Do not enable for PC, apply VF_CHEAT there if required
- #if defined(CONSOLE)
- #define CONST_CVAR_FLAGS (VF_CHEAT)
- #else
- #define CONST_CVAR_FLAGS (VF_NULL)
- #endif
- #if defined(AZ_RESTRICTED_PLATFORM)
- #define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_5
- #include AZ_RESTRICTED_FILE(ISystem_h)
- #endif
- #if defined(_RELEASE) && defined(IS_CONSOLE_PLATFORM)
- #ifndef LOG_CONST_CVAR_ACCESS
- #error LOG_CONST_CVAR_ACCESS should be defined in ProjectDefines.h
- #endif
- #include "IConsole.h"
- namespace Detail
- {
- template<typename T>
- struct SQueryTypeEnum;
- template<>
- struct SQueryTypeEnum<int>
- {
- static const int type = CVAR_INT;
- static int ParseString(const char* s) { return atoi(s); }
- };
- template<>
- struct SQueryTypeEnum<float>
- {
- static const int type = CVAR_FLOAT;
- static float ParseString(const char* s) { return (float)atof(s); }
- };
- template<typename T>
- struct SDummyCVar
- : ICVar
- {
- const T value;
- #if LOG_CONST_CVAR_ACCESS
- mutable bool bWasRead;
- mutable bool bWasChanged;
- SDummyCVar(T val)
- : value(val)
- , bWasChanged(false)
- , bWasRead(false) {}
- #else
- SDummyCVar(T val)
- : value(val) {}
- #endif
- void WarnUse() const
- {
- #if LOG_CONST_CVAR_ACCESS
- if (!bWasRead)
- {
- CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "[CVAR] Read from const CVar '%s' via name look-up, this is non-optimal", GetName());
- bWasRead = true;
- }
- #endif
- }
- void InvalidAccess() const
- {
- #if LOG_CONST_CVAR_ACCESS
- if (!bWasChanged)
- {
- 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());
- bWasChanged = true;
- }
- #endif
- }
- void Release() {}
- int GetIVal() const { WarnUse(); return static_cast<int>(value); }
- int64 GetI64Val() const { WarnUse(); return static_cast<int64>(value); }
- float GetFVal() const { WarnUse(); return static_cast<float>(value); }
- const char* GetString() const { return ""; }
- const char* GetDataProbeString() const { return ""; }
- void Set(const char* s)
- {
- if (SQueryTypeEnum<T>::ParseString(s) != value)
- {
- InvalidAccess();
- }
- }
- void ForceSet(const char* s) { Set(s); }
- void Set(const float f)
- {
- if (static_cast<T>(f) != value)
- {
- InvalidAccess();
- }
- }
- void Set(const int i)
- {
- if (static_cast<T>(i) != value)
- {
- InvalidAccess();
- }
- }
- void ClearFlags([[maybe_unused]] int flags) {}
- int GetFlags() const { return VF_CONST_CVAR | VF_READONLY; }
- int SetFlags([[maybe_unused]] int flags) { return 0; }
- int GetType() { return SQueryTypeEnum<T>::type; }
- const char* GetHelp() { return NULL; }
- bool IsConstCVar() const { return true; }
- void SetOnChangeCallback(ConsoleVarFunc pChangeFunc) { (void)pChangeFunc; }
- uint64 AddOnChangeFunctor(const SFunctor& pChangeFunctor) { (void)pChangeFunctor; return 0; }
- uint64 GetNumberOfOnChangeFunctors() const { return 0; }
- const SFunctor& GetOnChangeFunctor([[maybe_unused]] uint64 nFunctorIndex) const { InvalidAccess(); SFunctor* pNull = nullptr; return *pNull; }
- bool RemoveOnChangeFunctor([[maybe_unused]] const uint64 nElement) { return true; }
- ConsoleVarFunc GetOnChangeCallback() const { InvalidAccess(); return NULL; }
- void GetMemoryUsage([[maybe_unused]] class ICrySizer* pSizer) const {}
- int GetRealIVal() const { return GetIVal(); }
- void SetLimits([[maybe_unused]] float min, [[maybe_unused]] float max) { return; }
- void GetLimits([[maybe_unused]] float& min, [[maybe_unused]] float& max) { return; }
- bool HasCustomLimits() { return false; }
- void SetDataProbeString([[maybe_unused]] const char* pDataProbeString) { InvalidAccess(); }
- };
- }
- #define REGISTER_DUMMY_CVAR(type, name, value) \
- do { \
- static struct DummyCVar \
- : Detail::SDummyCVar<type> \
- { \
- DummyCVar() \
- : Detail::SDummyCVar<type>(value) {} \
- const char* GetName() const { return name; } \
- } DummyStaticInstance; \
- if (!(gEnv->pConsole != 0 ? gEnv->pConsole->Register(&DummyStaticInstance) : 0)) \
- { \
- DEBUG_BREAK; \
- CryFatalError("Can not register dummy CVar"); \
- } \
- } while (0)
- # define CONSOLE_CONST_CVAR_MODE
- # define DeclareConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
- # define DeclareStaticConstIntCVar(name, defaultValue) enum : int { name = (defaultValue) }
- # define DefineConstIntCVarName(strname, name, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, strname, defaultValue); }
- # define DefineConstIntCVar(name, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(name)); REGISTER_DUMMY_CVAR(int, (#name), defaultValue); }
- // DefineConstIntCVar2 is deprecated, any such instance can be converted to the 3 variant by removing the quotes around the first parameter
- # define DefineConstIntCVar3(name, _var_, defaultValue, flags, help) { COMPILE_TIME_ASSERT((int)(defaultValue) == (int)(_var_)); REGISTER_DUMMY_CVAR(int, name, defaultValue); }
- # define AllocateConstIntCVar(scope, name)
- # define DefineConstFloatCVar(name, flags, help) { REGISTER_DUMMY_CVAR(float, (#name), name ## Default); }
- # define DeclareConstFloatCVar(name)
- # define DeclareStaticConstFloatCVar(name)
- # define AllocateConstFloatCVar(scope, name)
- # define IsCVarConstAccess(expr) expr
- #else
- # define DeclareConstIntCVar(name, defaultValue) int name { defaultValue }
- # define DeclareStaticConstIntCVar(name, defaultValue) static int name
- # define DefineConstIntCVarName(strname, name, defaultValue, flags, help) \
- (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(strname, &name, defaultValue, flags | CONST_CVAR_FLAGS, CVARHELP(help)))
- # define DefineConstIntCVar(name, defaultValue, flags, help) \
- (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#name), &name, defaultValue, flags | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
- // DefineConstIntCVar2 is deprecated, any such instance can be converted to the 3 variant by removing the quotes around the first parameter
- # define DefineConstIntCVar3(_name, _var, _def_val, _flags, help) \
- (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, &(_var), (_def_val), (_flags) | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
- # define AllocateConstIntCVar(scope, name) int scope:: name
- # define DefineConstFloatCVar(name, flags, help) \
- (gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#name), &name, name ## Default, flags | CONST_CVAR_FLAGS, CVARHELP(help), 0, false))
- # define DeclareConstFloatCVar(name) float name
- # define DeclareStaticConstFloatCVar(name) static float name
- # define AllocateConstFloatCVar(scope, name) float scope:: name
- # define IsCVarConstAccess(expr)
- #endif
- #if defined(USE_CRY_ASSERT)
- static void AssertConsoleExists(void)
- {
- CRY_ASSERT(gEnv->pConsole != NULL);
- }
- #define ASSERT_CONSOLE_EXISTS AssertConsoleExists()
- #else
- #define ASSERT_CONSOLE_EXISTS 0
- #endif // defined(USE_CRY_ASSERT)
- // the following macros allow the help text to be easily stripped out
- // Summary:
- // Preferred way to register a CVar
- #define REGISTER_CVAR(_var, _def_val, _flags, _comment) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#_var), &(_var), (_def_val), (_flags), CVARHELP(_comment)))
- // Summary:
- // Preferred way to register a CVar with a callback
- #define REGISTER_CVAR_CB(_var, _def_val, _flags, _comment, _onchangefunction) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register((#_var), &(_var), (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
- // Summary:
- // Preferred way to register a string CVar
- #define REGISTER_STRING(_name, _def_val, _flags, _comment) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterString(_name, (_def_val), (_flags), CVARHELP(_comment)))
- // Summary:
- // Preferred way to register a string CVar with a callback
- #define REGISTER_STRING_CB(_name, _def_val, _flags, _comment, _onchangefunction) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterString(_name, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
- // Summary:
- // Preferred way to register an int CVar
- #define REGISTER_INT(_name, _def_val, _flags, _comment) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterInt(_name, (_def_val), (_flags), CVARHELP(_comment)))
- // Summary:
- // Preferred way to register an int CVar with a callback
- #define REGISTER_INT_CB(_name, _def_val, _flags, _comment, _onchangefunction) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterInt(_name, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
- // Summary:
- // Preferred way to register an int64 CVar
- #define REGISTER_INT64(_name, _def_val, _flags, _comment) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterInt64(_name, (_def_val), (_flags), CVARHELP(_comment)))
- // Summary:
- // Preferred way to register an int64 CVar with a callback
- #define REGISTER_INT64_CB(_name, _def_val, _flags, _comment, _onchangefunction) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterInt64(_name, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
- // Summary:
- // Preferred way to register a float CVar
- #define REGISTER_FLOAT(_name, _def_val, _flags, _comment) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterFloat(_name, (_def_val), (_flags), CVARHELP(_comment)))
- // Summary:
- // Preferred way to register a float CVar with a callback
- #define REGISTER_FLOAT_CB(_name, _def_val, _flags, _comment, _onchangefunction) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->RegisterFloat(_name, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
- // Summary:
- // Offers more flexibility but more code is required
- #define REGISTER_CVAR2(_name, _var, _def_val, _flags, _comment) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, _var, (_def_val), (_flags), CVARHELP(_comment)))
- // Summary:
- // Offers more flexibility but more code is required
- #define REGISTER_CVAR2_CB(_name, _var, _def_val, _flags, _comment, _onchangefunction) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, _var, (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
- // Summary:
- // Offers more flexibility but more code is required, explicit address taking of destination variable
- #define REGISTER_CVAR3(_name, _var, _def_val, _flags, _comment) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, &(_var), (_def_val), (_flags), CVARHELP(_comment)))
- // Summary:
- // Offers more flexibility but more code is required, explicit address taking of destination variable
- #define REGISTER_CVAR3_CB(_name, _var, _def_val, _flags, _comment, _onchangefunction) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? 0 : gEnv->pConsole->Register(_name, &(_var), (_def_val), (_flags), CVARHELP(_comment), _onchangefunction))
- // Summary:
- // Preferred way to register a console command
- #define REGISTER_COMMAND(_name, _func, _flags, _comment) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? false : gEnv->pConsole->AddCommand(_name, _func, (_flags), CVARHELP(_comment)))
- // Summary:
- // Preferred way to unregister a CVar
- #define UNREGISTER_CVAR(_name) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? (void)0 : gEnv->pConsole->UnregisterVariable(_name))
- // Preferred way to unregister a console command
- #define UNREGISTER_COMMAND(_name) (ASSERT_CONSOLE_EXISTS, gEnv->pConsole == 0 ? (void)0 : gEnv->pConsole->RemoveCommand(_name))
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Development only cvars
- //
- // N.B:
- // (1) Registered as real cvars *in non release builds only*.
- // (2) Can still be manipulated in release by the mapped variable, so not the same as const cvars.
- // (3) Any 'OnChanged' callback will need guarding against in release builds since the cvar won't exist
- // (4) Any code that tries to get ICVar* will need guarding against in release builds since the cvar won't exist
- //
- // ILLEGAL_DEV_FLAGS is a mask of all those flags which make no sense in a _DEV_ONLY or _DEDI_ONLY cvar since the
- // cvar potentially won't exist in a release build.
- //
- #define ILLEGAL_DEV_FLAGS (VF_NET_SYNCED | VF_CHEAT | VF_CHEAT_ALWAYS_CHECK | VF_CHEAT_NOCHECK | VF_READONLY | VF_CONST_CVAR)
- #if defined(_RELEASE)
- #define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
- #define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val /* _onchangefunction consumed; callback not available */
- #define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
- #define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
- #define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
- #define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
- #define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
- #define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0) /* consumed; pure cvar not available */
- #define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
- #define REGISTER_CVAR2_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); *(_var) = _def_val
- #define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
- #define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) NULL; COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0); _var = _def_val
- #define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) /* consumed; command not available */
- #else
- #define REGISTER_CVAR_DEV_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_CVAR_CB_DEV_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_STRING_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_STRING_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_INT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_INT_CB_DEV_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_INT64_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_FLOAT_DEV_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #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); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEV_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_COMMAND_DEV_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEV_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #endif // defined(_RELEASE)
- //
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Dedicated server only cvars
- //
- // N.B:
- // (1) Registered as real cvars in all non release builds
- // (2) Registered as real cvars in release on dedi servers only, otherwise treated as DEV_ONLY type cvars (see above)
- //
- // TODO Registering all cvars for Dedicated server as well. Currently CrySystems have no concept of Dedicated server with cmake.
- // If we introduce server specific targets for CrySystems, we can add DEDICATED_SERVER flags to those and add the flag back in here.
- #if defined(_RELEASE)
- #define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_CVAR_CB_DEDI_ONLY(_var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR_CB(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_STRING_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_STRING_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_INT_CB_DEDI_ONLY(_name, _def_val, _flags, _comment, _onchangefunction) REGISTER_INT_CB(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_INT64_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #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); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_CVAR3_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_CVAR3_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment); COMPILE_TIME_ASSERT(((_flags) & ILLEGAL_DEV_FLAGS) == 0)
- #else
- #define REGISTER_CVAR_DEDI_ONLY(_var, _def_val, _flags, _comment) REGISTER_CVAR_DEV_ONLY(_var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
- #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)
- #define REGISTER_STRING_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_STRING_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
- #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)
- #define REGISTER_INT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
- #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)
- #define REGISTER_INT64_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_INT64_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
- #define REGISTER_FLOAT_DEDI_ONLY(_name, _def_val, _flags, _comment) REGISTER_FLOAT_DEV_ONLY(_name, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
- #define REGISTER_CVAR2_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR2_DEV_ONLY(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
- #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)
- #define REGISTER_CVAR3_DEDI_ONLY(_name, _var, _def_val, _flags, _comment) REGISTER_CVAR3_DEV_ONLY(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment)
- #define REGISTER_CVAR3_CB_DEDI_ONLY(_name, _var, _def_val, _flags, _comment, _onchangefunction) REGISTER_CVAR3_CB_DEV_ONLY(_name, _var, _def_val, ((_flags) | VF_DEDI_ONLY), _comment, _onchangefunction)
- #define REGISTER_COMMAND_DEDI_ONLY(_name, _func, _flags, _comment) REGISTER_COMMAND_DEV_ONLY(_name, _func, ((_flags) | VF_DEDI_ONLY), _comment)
- #endif // defined(_RELEASE)
- //
- ////////////////////////////////////////////////////////////////////////////////
- #ifdef EXCLUDE_NORMAL_LOG // setting this removes a lot of logging to reduced code size (useful for consoles)
- #define CryLog(...) ((void)0)
- #define CryComment(...) ((void)0)
- #define CryLogAlways(...) ((void)0)
- #else // EXCLUDE_NORMAL_LOG
- // Summary:
- // Simple logs of data with low verbosity.
- void CryLog(const char*, ...) PRINTF_PARAMS(1, 2);
- inline void CryLog(const char* format, ...)
- {
- // Fran: we need these guards for the testing framework to work
- if (gEnv && gEnv->pSystem && gEnv->pLog)
- {
- va_list args;
- va_start(args, format);
- gEnv->pLog->LogV(ILog::eMessage, format, args);
- va_end(args);
- }
- }
- // Notes:
- // Very rarely used log comment.
- void CryComment(const char*, ...) PRINTF_PARAMS(1, 2);
- inline void CryComment(const char* format, ...)
- {
- // Fran: we need these guards for the testing framework to work
- if (gEnv && gEnv->pSystem && gEnv->pLog)
- {
- va_list args;
- va_start(args, format);
- gEnv->pLog->LogV(ILog::eComment, format, args);
- va_end(args);
- }
- }
- // Summary:
- // Logs important data that must be printed regardless verbosity.
- void CryLogAlways(const char*, ...) PRINTF_PARAMS(1, 2);
- inline void CryLogAlways(const char* format, ...)
- {
- // log should not be used before system is ready
- // error before system init should be handled explicitly
- // Fran: we need these guards for the testing framework to work
- if (gEnv && gEnv->pSystem && gEnv->pLog)
- {
- // assert(gEnv);
- // assert(gEnv->pSystem);
- va_list args;
- va_start(args, format);
- gEnv->pLog->LogV(ILog::eAlways, format, args);
- va_end(args);
- }
- }
- #endif // EXCLUDE_NORMAL_LOG
- /*****************************************************
- ASYNC MEMCPY FUNCTIONS
- *****************************************************/
- // Complex delegation required because it is not really easy to
- // export a external standalone symbol like a memcpy function when
- // building with modules. Dll pay an extra indirection cost for calling this
- // function.
- #if !defined(AZ_MONOLITHIC_BUILD)
- # define CRY_ASYNC_MEMCPY_DELEGATE_TO_CRYSYSTEM
- #endif
- #define CRY_ASYNC_MEMCPY_API extern "C"
- // Note sync variable will be incremented (in calling thread) before job starts
- // and decremented when job finishes. Multiple async copies can therefore be
- // tied to the same sync variable, therefore wait for completion with
- // while(*sync) (yield());
- #if defined(CRY_ASYNC_MEMCPY_DELEGATE_TO_CRYSYSTEM)
- inline void cryAsyncMemcpy(
- void* dst
- , const void* src
- , size_t size
- , int nFlags
- , volatile int* sync)
- {
- GetISystem()->AsyncMemcpy(dst, src, size, nFlags, sync);
- }
- # else
- CRY_ASYNC_MEMCPY_API void cryAsyncMemcpy(
- void* dst
- , const void* src
- , size_t size
- , int nFlags
- , volatile int* sync);
- #endif
- //////////////////////////////////////////////////////////////////////////
- // Additional headers.
- //////////////////////////////////////////////////////////////////////////
- #include <FrameProfiler.h>
- #endif // CRYINCLUDE_CRYCOMMON_ISYSTEM_H
|