Remove more unused things from CryCommon and CrySystem. (#709)

Lots of unrelated removals, I basically tried to remove everything exposed via gEnv that isn't used anymore, and following the threads found a few other things to remove also.
This commit is contained in:
bosnichd
2021-05-12 08:30:15 -06:00
committed by GitHub
parent f9fb61cc5d
commit 7cec2d8b07
198 changed files with 29 additions and 28558 deletions
+3 -324
View File
@@ -49,19 +49,15 @@
#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;
@@ -79,29 +75,21 @@ 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 IVisualLog;
struct ILocalizationManager;
struct ISoftCodeMgr;
struct IZLibCompressor;
struct IZLibDecompressor;
struct ILZ4Decompressor;
class IZStdDecompressor;
struct IOutputPrintSink;
struct IThreadManager;
struct IWindowMessageHandler;
struct IImageHandler;
class IResourceCompilerHelper;
class ILmbrAWS;
namespace AZ
{
@@ -111,12 +99,6 @@ namespace AZ
}
}
class IResourceCompilerHelper;
namespace Serialization {
struct IArchiveHost;
}
typedef void* WIN_HWND;
class CCamera;
@@ -124,39 +106,13 @@ struct CLoadingTimeProfiler;
class ICmdLine;
struct INotificationNetwork;
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
ESYSUPDATE_EDITOR = 0x0004
};
// Description:
@@ -189,29 +145,6 @@ enum ESystemConfigPlatform
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,
@@ -568,33 +501,6 @@ struct IErrorObserver
// </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)
@@ -616,9 +522,6 @@ 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).
@@ -633,33 +536,14 @@ struct SSystemInitParams
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 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 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:
@@ -668,16 +552,10 @@ struct 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;
@@ -688,32 +566,13 @@ struct SSystemInitParams
bPreview = false;
bTestMode = false;
bDedicatedServer = false;
bExecuteCommandLine = true;
bExecuteCommandLine = true;
bSkipFont = 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;
bUnattendedMode = false;
bSkipMovie = false;
bSkipAnimation = false;
bToolMode = false;
bSkipPhysics = false;
pSystem = NULL;
memset(pProtectedFunctions, 0, sizeof(pProtectedFunctions));
pCvarsDefault = NULL;
pSharedEnvironment = nullptr;
}
};
@@ -782,8 +641,6 @@ struct SSystemGlobalEnvironment
{
AZ::IO::IArchive* pCryPak;
AZ::IO::FileIOBase* pFileIO;
IProfileLogSystem* pProfileLogSystem;
IOpticsManager* pOpticsManager;
ITimer* pTimer;
ICryFont* pCryFont;
::IConsole* pConsole;
@@ -791,81 +648,27 @@ struct SSystemGlobalEnvironment
ILog* pLog;
IMovieSystem* pMovieSystem;
INameTable* pNameTable;
IVisualLog* pVisualLog;
IRenderer* pRenderer;
IMaterialEffects* pMaterialEffects;
ISoftCodeMgr* pSoftCodeMgr;
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)
@@ -895,11 +698,6 @@ struct SSystemGlobalEnvironment
{
bDedicated = isDedicated;
}
ILINE void SetIsClient(bool isClient)
{
bClient = isClient;
}
#endif
//this way the compiler can strip out code for consoles
@@ -939,26 +737,6 @@ struct SSystemGlobalEnvironment
#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;
@@ -969,35 +747,17 @@ struct SSystemGlobalEnvironment
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)
: bToolMode(false)
{
};
};
@@ -1035,37 +795,11 @@ struct IProfilingSystem
// 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.
@@ -1094,9 +828,6 @@ struct ISystem
virtual void DoWorkDuringOcclusionChecks() = 0;
virtual bool NeedDoWorkDuringOcclusionChecks() = 0;
//! Update screen and call some important tick functions during loading.
virtual void SynchronousLoadingTick(const char* pFunc, int line) = 0;
// Summary:
// Returns the current used memory.
virtual uint32 GetUsedMemory() = 0;
@@ -1170,7 +901,6 @@ struct ISystem
virtual IZLibDecompressor* GetIZLibDecompressor() = 0;
virtual ILZ4Decompressor* GetLZ4Decompressor() = 0;
virtual IZStdDecompressor* GetZStdDecompressor() = 0;
virtual INotificationNetwork* GetINotificationNetwork() = 0;
virtual IViewSystem* GetIViewSystem() = 0;
virtual ILevelSystem* GetILevelSystem() = 0;
virtual INameTable* GetINameTable() = 0;
@@ -1187,24 +917,10 @@ struct ISystem
// 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 ITimer* GetITimer() = 0;
virtual 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 SetIVisualLog(IVisualLog* pVisualLog) = 0;
//virtual const char *GetGamePath()=0;
virtual void DebugStats(bool checkpoint, bool leaks) = 0;
virtual void DumpWinHeaps() = 0;
@@ -1219,7 +935,6 @@ struct ISystem
virtual bool WasInDevMode() const = 0;
virtual bool IsDevMode() const = 0;
virtual bool IsMODValid(const char* szMODName) const = 0;
virtual bool IsMinimalMode() const = 0;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -1334,12 +1049,6 @@ struct ISystem
// Detects and set optimal spec.
virtual void AutoDetectSpec(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:
// Query if system is now paused.
// Pause flag is set when calling system update with pause mode.
@@ -1406,14 +1115,6 @@ struct ISystem
// Get log index of the currently running Open 3D Engine 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;
@@ -1458,17 +1159,6 @@ struct ISystem
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
@@ -1513,11 +1203,6 @@ struct ISystem
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
@@ -1594,7 +1279,7 @@ typedef ISystem* (*PFNCREATESYSTEMINTERFACE)(SSystemInitParams& initParams);
//////////////////////////////////////////////////////////////////////////
// Global environment variable.
//////////////////////////////////////////////////////////////////////////
extern SC_API SSystemGlobalEnvironment* gEnv;
extern SSystemGlobalEnvironment* gEnv;
// Summary:
@@ -1613,11 +1298,6 @@ inline ISystem* GetISystem()
}
return systemInterface;
};
inline ISystemScheduler* GetISystemScheduler(void)
{
return gEnv->pSystemScheduler;
};
//////////////////////////////////////////////////////////////////////////
// Description:
@@ -1640,7 +1320,6 @@ void* GetDetachEnvironmentSymbol();
extern bool g_bProfilerEnabled;
extern int g_iTraceAllocations;
// Summary:
// Interface of the DLL.