SPEC-7531 Change Code/CryEngine to Code/Legacy (#1634)
* git mv Code\CryEngine Code\Legacy * redirecting CMakeLists.txt * fixing uic warning * Some more CryEngine mentions * validation scripts Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "CrySystem_precompiled.h"
|
||||
#include "RemoteConsole.h"
|
||||
|
||||
#ifdef USE_REMOTE_CONSOLE
|
||||
#include "RemoteConsole_impl.inl"
|
||||
#else
|
||||
#include "RemoteConsole_none.inl"
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H
|
||||
#define CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H
|
||||
#pragma once
|
||||
|
||||
#include <IConsole.h>
|
||||
#include <CryListenerSet.h>
|
||||
|
||||
#if !defined(RELEASE) || defined(RELEASE_LOGGING) || defined(ENABLE_PROFILING_CODE)
|
||||
#define USE_REMOTE_CONSOLE
|
||||
|
||||
struct SRemoteServer;
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CRemoteConsole
|
||||
//
|
||||
// IRemoteConsole implementation
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class CRemoteConsole
|
||||
: public IRemoteConsole
|
||||
{
|
||||
public:
|
||||
static CRemoteConsole* GetInst()
|
||||
{
|
||||
static StaticInstance<CRemoteConsole, AZStd::no_destruct<CRemoteConsole>> inst;
|
||||
return &inst;
|
||||
}
|
||||
|
||||
virtual void RegisterConsoleVariables();
|
||||
virtual void UnregisterConsoleVariables();
|
||||
|
||||
virtual void Start();
|
||||
virtual void Stop();
|
||||
virtual bool IsStarted() const { return m_running; }
|
||||
|
||||
virtual void AddLogMessage(const char* log);
|
||||
virtual void AddLogWarning(const char* log);
|
||||
virtual void AddLogError(const char* log);
|
||||
|
||||
virtual void Update();
|
||||
|
||||
virtual void RegisterListener(IRemoteConsoleListener* pListener, const char* name);
|
||||
virtual void UnregisterListener(IRemoteConsoleListener* pListener);
|
||||
|
||||
typedef CListenerSet<IRemoteConsoleListener*> TListener;
|
||||
|
||||
|
||||
CRemoteConsole();
|
||||
virtual ~CRemoteConsole();
|
||||
|
||||
TListener m_listener;
|
||||
int m_lastPortValue = 0;
|
||||
volatile bool m_running;
|
||||
|
||||
#if defined(USE_REMOTE_CONSOLE)
|
||||
SRemoteServer* m_pServer;
|
||||
ICVar* m_pLogEnableRemoteConsole = nullptr;
|
||||
ICVar* m_remoteConsoleAllowedHostList = nullptr;
|
||||
ICVar* m_remoteConsolePort = nullptr;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <RemoteConsoleCore.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CRemoteConsole::CRemoteConsole()
|
||||
: m_listener(1)
|
||||
, m_lastPortValue(0)
|
||||
, m_running(false)
|
||||
|
||||
, m_pServer(nullptr)
|
||||
, m_pLogEnableRemoteConsole(nullptr)
|
||||
, m_remoteConsoleAllowedHostList(nullptr)
|
||||
, m_remoteConsolePort(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CRemoteConsole::~CRemoteConsole()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::RegisterConsoleVariables()
|
||||
{
|
||||
m_pLogEnableRemoteConsole = REGISTER_INT("log_EnableRemoteConsole", 1, VF_DUMPTODISK, "enables/disables the remote console");
|
||||
m_remoteConsoleAllowedHostList = REGISTER_STRING("log_RemoteConsoleAllowedAddresses", "", VF_DUMPTODISK, "COMMA separated list of allowed hosts or IP addresses which can connect");
|
||||
m_remoteConsolePort = REGISTER_INT("log_RemoteConsolePort", defaultRemoteConsolePort, VF_DUMPTODISK, "Base port (4600 for example) for remote console to listen on. It will start there and continue upwards until an unused one is found.");
|
||||
m_lastPortValue = 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::UnregisterConsoleVariables()
|
||||
{
|
||||
m_pLogEnableRemoteConsole = nullptr;
|
||||
m_remoteConsoleAllowedHostList = nullptr;
|
||||
m_remoteConsolePort = nullptr;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::Start()
|
||||
{
|
||||
if (!IsStarted())
|
||||
{
|
||||
m_pServer = new SRemoteServer;
|
||||
|
||||
m_pServer->StartServer();
|
||||
m_running = true;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::Stop()
|
||||
{
|
||||
// make sure we don't stop if we never started the remote console in the first place
|
||||
if (IsStarted())
|
||||
{
|
||||
m_running = false;
|
||||
m_pServer->StopServer();
|
||||
m_pServer->WaitForThread();
|
||||
|
||||
delete m_pServer;
|
||||
m_pServer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::AddLogMessage(const char* log)
|
||||
{
|
||||
if (!IsStarted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IRemoteEvent* pEvent = new SStringEvent<eCET_LogMessage>(log);
|
||||
m_pServer->AddEvent(pEvent);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::AddLogWarning(const char* log)
|
||||
{
|
||||
if (!IsStarted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IRemoteEvent* pEvent = new SStringEvent<eCET_LogWarning>(log);
|
||||
m_pServer->AddEvent(pEvent);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::AddLogError(const char* log)
|
||||
{
|
||||
if (!IsStarted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IRemoteEvent* pEvent = new SStringEvent<eCET_LogError>(log);
|
||||
m_pServer->AddEvent(pEvent);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::Update()
|
||||
{
|
||||
if (m_pLogEnableRemoteConsole)
|
||||
{
|
||||
// we disable the remote console in the editor, since there is no reason to remote into it and we don't want it eating up that port
|
||||
// number anyway and preventing the game from using it.
|
||||
bool isEditor = gEnv && gEnv->IsEditor();
|
||||
bool isEnabled = (!isEditor) && (m_pLogEnableRemoteConsole->GetIVal());
|
||||
bool isStarted = IsStarted();
|
||||
|
||||
int newPortValue = m_remoteConsolePort->GetIVal();
|
||||
|
||||
// the editor never allows remote control.
|
||||
if ((isEnabled) && (!isStarted))
|
||||
{
|
||||
Start();
|
||||
}
|
||||
else if (isStarted)
|
||||
{
|
||||
if ((!isEnabled) || (newPortValue != m_lastPortValue))
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
|
||||
m_lastPortValue = newPortValue;
|
||||
|
||||
}
|
||||
|
||||
if (m_pServer)
|
||||
{
|
||||
TEventBuffer events;
|
||||
m_pServer->GetEvents(events);
|
||||
for (TEventBuffer::iterator it = events.begin(), end = events.end(); it != end; ++it)
|
||||
{
|
||||
IRemoteEvent* pEvent = *it;
|
||||
switch (pEvent->GetType())
|
||||
{
|
||||
case eCET_ConsoleCommand:
|
||||
for (TListener::Notifier notifier(m_listener); notifier.IsValid(); notifier.Next())
|
||||
{
|
||||
notifier->OnConsoleCommand(((SStringEvent<eCET_ConsoleCommand>*)pEvent)->GetData());
|
||||
}
|
||||
break;
|
||||
case eCET_GameplayEvent:
|
||||
for (TListener::Notifier notifier(m_listener); notifier.IsValid(); notifier.Next())
|
||||
{
|
||||
notifier->OnGameplayCommand(((SStringEvent<eCET_GameplayEvent>*)pEvent)->GetData());
|
||||
}
|
||||
break;
|
||||
}
|
||||
delete *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::RegisterListener(IRemoteConsoleListener* pListener, const char* name)
|
||||
{
|
||||
m_listener.Add(pListener, name);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::UnregisterListener(IRemoteConsoleListener* pListener)
|
||||
{
|
||||
m_listener.Remove(pListener);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CRemoteConsole::CRemoteConsole()
|
||||
: m_listener(1)
|
||||
, m_lastPortValue(0)
|
||||
, m_running(false)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CRemoteConsole::~CRemoteConsole()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::RegisterConsoleVariables()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::UnregisterConsoleVariables()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::Start()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::Stop()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::AddLogMessage(const char* log)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::AddLogWarning(const char* log)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::AddLogError(const char* log)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::Update()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::RegisterListener(IRemoteConsoleListener* pListener, const char* name)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CRemoteConsole::UnregisterListener(IRemoteConsoleListener* pListener)
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user