[development] removed CryLibrary (#5474)

* [redcode_crylibrary] replaced CrySystem loading in launcher and editor with new custom wrapper that uses AZ::DynamicModuleHandle

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>

* [redcode_crylibrary] removed all remaining references to CryLibrary

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>

* [redcode_crylibrary] migrate CrySystem loading to use AZ::DynamicModuleHandle directly instead

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>

* [redcode_crylibrary] clean up of CrySystemModuleHandle and old CrySystem module [un]init functions

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>

* [redcode_crylibrary] added trailing newline to DllMain.cpp in CrySystem

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
Scott Romero
2021-11-10 08:43:13 -08:00
committed by GitHub
parent 8b5fe4a015
commit ab37eb138c
17 changed files with 24 additions and 527 deletions
+5 -1
View File
@@ -12,6 +12,8 @@
#include <AZCrySystemInitLogSink.h>
#include "DebugCallStack.h"
#include <AzCore/Module/Environment.h> // for AZ_DECLARE_MODULE_INITIALIZATION
#if defined(AZ_RESTRICTED_PLATFORM)
#undef AZ_RESTRICTED_SECTION
#define DLLMAIN_CPP_SECTION_1 1
@@ -67,7 +69,7 @@ CRYSYSTEM_API ISystem* CreateSystemInterface(const SSystemInitParams& startupPar
// We must attach to the environment prior to allocating CSystem, as opposed to waiting
// for ModuleInitISystem(), because the log message sink uses buses.
// Environment should have been attached via InjectEnvironment
// Environment should have been attached via InitializeDynamicModule
AZ_Assert(AZ::Environment::IsReady(), "Environment is not attached, must be attached before CreateSystemInterface can be called");
pSystem = new CSystem(startupParams.pSharedEnvironment);
@@ -115,3 +117,5 @@ CRYSYSTEM_API ISystem* CreateSystemInterface(const SSystemInitParams& startupPar
}
};
// declare the functions used by AZ::DynamicModule to [un]initialize the library here
AZ_DECLARE_MODULE_INITIALIZATION
-1
View File
@@ -16,7 +16,6 @@
#include <AzCore/Console/Console.h>
#include <AzCore/IO/IStreamer.h>
#include <AzCore/IO/SystemFile.h>
#include "CryLibrary.h"
#include <CryPath.h>
#include <CrySystemBus.h>
#include <CryCommon/IFont.h>
-5
View File
@@ -85,10 +85,6 @@ class CWatchdogThread;
#endif
#if defined(LINUX)
#include "CryLibrary.h"
#endif
#ifdef WIN32
using WIN_HMODULE = void*;
#else
@@ -226,7 +222,6 @@ public:
void Quit() override;
bool IsQuitting() const override;
void ShutdownFileSystem(); // used to cleanup any file resources, such as cache handle.
void SetAffinity();
const char* GetUserName() override;
int GetApplicationInstance() override;
int GetApplicationLogInstance(const char* logFilePath) override;
-1
View File
@@ -30,7 +30,6 @@
#define SYSTEMINIT_CPP_SECTION_17 17
#endif
#include "CryLibrary.h"
#include "CryPath.h"
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
-34
View File
@@ -14,7 +14,6 @@
#include <IRenderer.h>
#include <IMovieSystem.h>
#include <ILog.h>
#include <CryLibrary.h>
#include <AzCore/Debug/StackTracer.h>
#include <AzCore/IO/SystemFile.h> // for AZ_MAX_PATH_LEN
#include <AzCore/std/allocator_stack.h>
@@ -70,39 +69,6 @@ const char* g_szModuleGroups[][2] = {
{"CrySystem.dll", g_szGroupCore}
};
//////////////////////////////////////////////////////////////////////////
void CSystem::SetAffinity()
{
// the following code is only for Windows
#ifdef WIN32
// set the process affinity
ICVar* pcvAffinityMask = GetIConsole()->GetCVar("sys_affinity");
if (!pcvAffinityMask)
{
pcvAffinityMask = REGISTER_INT("sys_affinity", 0, VF_NULL, "");
}
if (pcvAffinityMask)
{
unsigned nAffinity = pcvAffinityMask->GetIVal();
if (nAffinity)
{
typedef BOOL (WINAPI * FnSetProcessAffinityMask)(IN HANDLE hProcess, IN DWORD_PTR dwProcessAffinityMask);
HMODULE hKernel = CryLoadLibrary ("kernel32.dll");
if (hKernel)
{
FnSetProcessAffinityMask SetProcessAffinityMask = (FnSetProcessAffinityMask)GetProcAddress(hKernel, "SetProcessAffinityMask");
if (SetProcessAffinityMask && !SetProcessAffinityMask(GetCurrentProcess(), nAffinity))
{
GetILog()->LogError("Error: Cannot set affinity mask %d, error code %d", nAffinity, GetLastError());
}
FreeLibrary (hKernel);
}
}
}
#endif
}
#if defined(WIN32)
#pragma pack(push,1)
struct PEHeader_DLL