Browse Source

Split out minimal core console functionality from the pfConsole module

--HG--
rename : Sources/Plasma/FeatureLib/pfConsole/pfConsoleCmd.cpp => Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp
rename : Sources/Plasma/FeatureLib/pfConsole/pfConsoleCmd.h => Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h
rename : Sources/Plasma/FeatureLib/pfConsole/pfConsoleContext.cpp => Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.cpp
rename : Sources/Plasma/FeatureLib/pfConsole/pfConsoleContext.h => Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.h
rename : Sources/Plasma/FeatureLib/pfConsole/pfConsoleEngine.cpp => Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp
Michael Hansen 14 years ago
parent
commit
57757281f8
  1. 1
      Sources/Plasma/Apps/plClient/CMakeLists.txt
  2. 2
      Sources/Plasma/Apps/plClient/plClient.cpp
  3. 6
      Sources/Plasma/Apps/plClient/winmain.cpp
  4. 1
      Sources/Plasma/FeatureLib/CMakeLists.txt
  5. 6
      Sources/Plasma/FeatureLib/pfConsole/CMakeLists.txt
  6. 8
      Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp
  7. 9
      Sources/Plasma/FeatureLib/pfConsole/pfCCRConsoleCommands.cpp
  8. 2
      Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp
  9. 21
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
  10. 288
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp
  11. 2
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.h
  12. 8
      Sources/Plasma/FeatureLib/pfConsole/pfGameConsoleCommands.cpp
  13. 22
      Sources/Plasma/FeatureLib/pfConsoleCore/CMakeLists.txt
  14. 6
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp
  15. 11
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h
  16. 335
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp
  17. 0
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.cpp
  18. 0
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.h
  19. 0
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp
  20. 25
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h

1
Sources/Plasma/Apps/plClient/CMakeLists.txt

@ -102,6 +102,7 @@ target_link_libraries(plClient pfCCR)
target_link_libraries(plClient pfCharacter)
target_link_libraries(plClient pfConditional)
target_link_libraries(plClient pfConsole)
target_link_libraries(plClient pfConsoleCore)
target_link_libraries(plClient pfCsrSrv)
target_link_libraries(plClient pfGameGUIMgr)
target_link_libraries(plClient pfGameMgr)

2
Sources/Plasma/Apps/plClient/plClient.cpp

@ -63,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plMessage/plNetCommMsgs.h"
#include "plMessage/plAgeLoadedMsg.h"
#include "pfConsole/pfConsoleEngine.h"
#include "pfConsoleCore/pfConsoleEngine.h"
#include "pfConsole/pfConsole.h"
#include "pfConsole/pfConsoleDirSrc.h"
#include "plScene/plPageTreeMgr.h"

6
Sources/Plasma/Apps/plClient/winmain.cpp

@ -1528,9 +1528,13 @@ LONG WINAPI plCustomUnhandledExceptionFilter( struct _EXCEPTION_POINTERS *Except
return EXCEPTION_EXECUTE_HANDLER;
}
#include "pfConsole/pfConsoleEngine.h"
#include "pfConsoleCore/pfConsoleEngine.h"
PF_CONSOLE_LINK_ALL()
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
PF_CONSOLE_INIT_ALL()
// Set global handle
gHInst = hInst;

1
Sources/Plasma/FeatureLib/CMakeLists.txt

@ -7,6 +7,7 @@ add_subdirectory(pfCamera)
add_subdirectory(pfCharacter)
add_subdirectory(pfConditional)
add_subdirectory(pfConsole)
add_subdirectory(pfConsoleCore)
add_subdirectory(pfCsrSrv)
add_subdirectory(pfGameGUIMgr)
add_subdirectory(pfGameMgr)

6
Sources/Plasma/FeatureLib/pfConsole/CMakeLists.txt

@ -12,23 +12,17 @@ set(pfConsole_SOURCES
pfAvatarConsoleCommands.cpp
pfCCRConsoleCommands.cpp
pfConsole.cpp
pfConsoleCmd.cpp
pfConsoleCommands.cpp
pfConsoleCommandsNet.cpp
pfConsoleContext.cpp
pfConsoleDirSrc.cpp
pfConsoleEngine.cpp
pfDispatchLog.cpp
pfGameConsoleCommands.cpp
)
set(pfConsole_HEADERS
pfConsole.h
pfConsoleCmd.h
pfConsoleContext.h
pfConsoleCreatable.h
pfConsoleDirSrc.h
pfConsoleEngine.h
pfDispatchLog.h
)

8
Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp

@ -33,7 +33,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define LIMIT_CONSOLE_COMMANDS 1
#endif
#include "pfConsoleCmd.h"
#include "pfConsoleCore/pfConsoleCmd.h"
#include "plgDispatch.h"
#include "pfConsole.h"
#include "hsResMgr.h"
@ -76,10 +76,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define PF_SANITY_CHECK( cond, msg ) { if( !( cond ) ) { PrintString( msg ); return; } }
//// DO NOT REMOVE!!!!
//// This is here so Microsoft VC won't decide to "optimize" this file out
void pfConsoleCmdGroup::DummyAvatar( void )
{
}
PF_CONSOLE_FILE_DUMMY(Avatar)
//// DO NOT REMOVE!!!!
/////////////////////////////////////////////////////////////////
//

9
Sources/Plasma/FeatureLib/pfConsole/pfCCRConsoleCommands.cpp

@ -36,16 +36,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Only calls to the CCRMgr interface are allowed here
// See me if you need to include any other files...
//
#include "pfConsoleCmd.h"
#include "pfConsoleCore/pfConsoleCmd.h"
#include "pfConsole.h"
#include "pfCCR/plCCRMgr.h"
#include "plNetClient/plNetClientMgr.h"
//// DO NOT REMOVE!!!!
//// This is here so Microsoft VC won't decide to "optimize" this file out
// YOU ALSO NEED TO CALL THIS FXN
void pfConsoleCmdGroup::DummyCCR( void )
{
}
PF_CONSOLE_FILE_DUMMY(CCR)
//// DO NOT REMOVE!!!!
void PrintStringF(void pfun(const char *),const char * fmt, ...);

2
Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp

@ -30,7 +30,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//////////////////////////////////////////////////////////////////////////////
#include "pfConsole.h"
#include "pfConsoleEngine.h"
#include "pfConsoleCore/pfConsoleEngine.h"
#include "plPipeline/plDebugText.h"
#include "plInputCore/plInputDevice.h"
#include "plInputCore/plInputInterface.h"

21
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp

@ -34,7 +34,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif
#include "pfConsoleCmd.h"
#include "pfConsoleCore/pfConsoleCmd.h"
#include "plgDispatch.h"
#include "plAgeLoader/plAgeLoader.h"
@ -75,7 +75,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plVault/plVault.h"
#include "../../Apps/plClient/plClient.h"
#include "pfConsole.h"
#include "pfConsoleContext.h"
#include "pfConsoleCore/pfConsoleContext.h"
#include "plResMgr/plKeyFinder.h"
#include "plModifier/plSimpleModifier.h"
#include "plAvatar/plAvatarMgr.h"
@ -160,10 +160,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// DO NOT REMOVE!!!!
//// This is here so Microsoft VC won't decide to "optimize" this file out
//// DO NOT REMOVE!!!!
void pfConsoleCmdGroup::Dummy( void )
{
}
PF_CONSOLE_FILE_DUMMY(Main)
//// DO NOT REMOVE!!!!
//// Defining Console Commands ///////////////////////////////////////////////
@ -258,6 +255,7 @@ plKey FindSceneObjectByName(const char* name, const char* ageName, char* statusS
plKey FindObjectByName(const char* name, int type, const char* ageName, char* statusStr, bool subString=false);
plKey FindObjectByNameAndType(const char* name, const char* typeName, const char* ageName,
char* statusStr, bool subString=false);
void PrintStringF(void pfun(const char *),const char * fmt, ...);
//
// Find an object from name, type (int), and optionally age.
@ -355,17 +353,6 @@ plKey FindObjectByNameAndType(const char* name, const char* typeName, const char
return FindObjectByName(name, plFactory::FindClassIndex(typeName), ageName, statusStr, subString);
}
void PrintStringF(void pfun(const char *),const char * fmt, ...)
{
va_list args;
char buffy[512];
va_start(args, fmt);
vsprintf(buffy, fmt, args);
va_end(args);
pfun(buffy);
}
//// plDoesFileExist //////////////////////////////////////////////////////////
// Utility function to determine whether the given file exists

288
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp

@ -34,7 +34,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif
#include "pfConsoleCmd.h"
#include "pfConsoleCore/pfConsoleCmd.h"
#include "plgDispatch.h"
#include "plAgeLoader/plAgeLoader.h"
@ -89,10 +89,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// DO NOT REMOVE!!!!
//// This is here so Microsoft VC won't decide to "optimize" this file out
//// DO NOT REMOVE!!!!
void pfConsoleCmdGroup::DummyNet( void )
{
}
PF_CONSOLE_FILE_DUMMY(Net)
//// DO NOT REMOVE!!!!
//// Defining Console Commands ///////////////////////////////////////////////
@ -1053,284 +1050,3 @@ PF_CONSOLE_CMD(
}
#endif
///////////////////////////////////////
/*****************************************************************************
*
* Server
*
***/
//TODO: Fix Plasma to use OpenSSL's byte order (or better yet, to use OpenSSL),
// so this hack isn't needed
static void swap_key_bytes(byte keyData[])
{
for (size_t i = 0; i < (kNetDiffieHellmanKeyBits / 16); ++i)
std::swap(keyData[i], keyData[ (kNetDiffieHellmanKeyBits / 8) - i - 1 ]);
}
//============================================================================
// Server group
PF_CONSOLE_GROUP(Server)
//============================================================================
PF_CONSOLE_CMD(
Server,
Status,
"string url",
"Set the server's status URL"
) {
wchar_t *wurl = hsStringToWString((const char *)params[0]);
SetServerStatusUrl(wurl);
delete [] wurl;
}
//============================================================================
PF_CONSOLE_CMD(
Server,
Signup,
"string url",
"Set the server's new user sign-up URL"
) {
wchar_t *wurl = hsStringToWString((const char *)params[0]);
SetServerSignupUrl(wurl);
delete [] wurl;
}
//============================================================================
PF_CONSOLE_CMD(
Server,
DispName,
"string name",
"Set the displayable server name"
) {
wchar_t *wname = hsStringToWString((const char *)params[0]);
SetServerDisplayName(wname);
delete [] wname;
}
//============================================================================
// Server.File group
PF_CONSOLE_SUBGROUP(Server, File)
//============================================================================
PF_CONSOLE_CMD(
Server_File,
Host,
"string address",
"Set the File Server address"
) {
wchar_t *wHost = hsStringToWString((const char *)params[0]);
SetFileSrvHostname(wHost);
delete [] wHost;
}
//============================================================================
// Server.Auth group
PF_CONSOLE_SUBGROUP(Server, Auth)
//============================================================================
PF_CONSOLE_CMD(
Server_Auth,
Host,
"string address",
"Set the Auth Server address"
) {
wchar_t *wHost = hsStringToWString((const char *)params[0]);
SetAuthSrvHostname(wHost);
delete [] wHost;
}
//============================================================================
PF_CONSOLE_CMD(
Server_Auth,
N,
"string base64Key",
"Set the Auth Server N key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kAuthDhNData);
swap_key_bytes(kAuthDhNData);
}
//============================================================================
PF_CONSOLE_CMD(
Server_Auth,
X,
"string base64Key",
"Set the Auth Server X key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kAuthDhXData);
swap_key_bytes(kAuthDhXData);
}
//============================================================================
// Server.Csr group
PF_CONSOLE_SUBGROUP(Server, Csr)
//============================================================================
PF_CONSOLE_CMD(
Server_Csr,
Host,
"string address",
"Set the Csr Server address"
) {
wchar_t *wHost = hsStringToWString((const char *)params[0]);
SetCsrSrvHostname(wHost);
delete [] wHost;
}
//============================================================================
PF_CONSOLE_CMD(
Server_Csr,
N,
"string base64Key",
"Set the Csr Server N key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kCsrDhNData);
swap_key_bytes(kCsrDhNData);
}
//============================================================================
PF_CONSOLE_CMD(
Server_Csr,
X,
"string base64Key",
"Set the Csr Server X key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kCsrDhXData);
swap_key_bytes(kCsrDhXData);
}
//============================================================================
// Server.Game group
PF_CONSOLE_SUBGROUP(Server, Game)
//============================================================================
PF_CONSOLE_CMD(
Server_Game,
N,
"string base64Key",
"Set the Game Server N key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGameDhNData);
swap_key_bytes(kGameDhNData);
}
//============================================================================
PF_CONSOLE_CMD(
Server_Game,
X,
"string base64Key",
"Set the Game Server X key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGameDhXData);
swap_key_bytes(kGameDhXData);
}
//============================================================================
// Server.Gate group
PF_CONSOLE_SUBGROUP(Server, Gate)
//============================================================================
PF_CONSOLE_CMD(
Server_Gate,
Host,
"string address",
"Set the GateKeeper Server address"
) {
wchar_t *wHost = hsStringToWString((const char *)params[0]);
SetGateKeeperSrvHostname(wHost);
delete [] wHost;
}
//============================================================================
PF_CONSOLE_CMD(
Server_Gate,
N,
"string base64Key",
"Set the GateKeeper Server N key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGateKeeperDhNData);
swap_key_bytes(kGateKeeperDhNData);
}
//============================================================================
PF_CONSOLE_CMD(
Server_Gate,
X,
"string base64Key",
"Set the GateKeeper Server X key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGateKeeperDhXData);
swap_key_bytes(kGateKeeperDhXData);
}

2
Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.h

@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsTypes.h"
#include "hsStlUtils.h"
#include "pfConsoleEngine.h"
#include "pfConsoleCore/pfConsoleEngine.h"
//// pfConsoleDirSrc Class Definition ////////////////////////////////////////

8
Sources/Plasma/FeatureLib/pfConsole/pfGameConsoleCommands.cpp

@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif
#include "pfConsoleCmd.h"
#include "pfConsoleCore/pfConsoleCmd.h"
#include "pfConsole.h"
#include "plPipeline.h"
@ -75,12 +75,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// DO NOT REMOVE!!!!
//// This is here so Microsoft VC won't decide to "optimize" this file out
PF_CONSOLE_FILE_DUMMY(Game)
//// DO NOT REMOVE!!!!
void pfConsoleCmdGroup::DummyJunior( void )
{
}
//// DO NOT REMOVE!!!!
//// plDoesFileExist //////////////////////////////////////////////////////////
// Utility function to determine whether the given file exists

22
Sources/Plasma/FeatureLib/pfConsoleCore/CMakeLists.txt

@ -0,0 +1,22 @@
include_directories(../../CoreLib)
include_directories(../../FeatureLib)
include_directories(../../NucleusLib)
include_directories(../../PubUtilLib)
set(pfConsoleCore_SOURCES
pfConsoleCmd.cpp
pfConsoleCommandsCore.cpp
pfConsoleContext.cpp
pfConsoleEngine.cpp
)
set(pfConsoleCore_HEADERS
pfConsoleCmd.h
pfConsoleContext.h
pfConsoleEngine.h
)
add_library(pfConsoleCore STATIC ${pfConsoleCore_SOURCES} ${pfConsoleCore_HEADERS})
source_group("Source Files" FILES ${pfConsoleCore_SOURCES})
source_group("Header Files" FILES ${pfConsoleCore_HEADERS})

6
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCmd.cpp → Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp

@ -45,12 +45,6 @@ UInt32 pfConsoleCmdGroup::fBaseCmdGroupRef = 0;
pfConsoleCmdGroup::pfConsoleCmdGroup( char *name, char *parent )
{
Dummy();
DummyJunior();
DummyNet();
DummyAvatar();
DummyCCR();
fNext = nil;
fPrevPtr = nil;
fCommands = nil;

11
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCmd.h → Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h

@ -94,12 +94,6 @@ class pfConsoleCmdGroup
static pfConsoleCmdGroup *FindSubGroupRecurse( const char *name );
static void DecBaseCmdGroupRef( void );
static void Dummy( void );
static void DummyJunior( void );
static void DummyNet( void );
static void DummyAvatar( void );
static void DummyCCR( void );
};
//// pfConsoleCmdParam Class Definition //////////////////////////////////////
@ -267,6 +261,9 @@ public:
pfConsoleCmdGroup conGroup_##parent##_##name( #name, #parent );
//// Force the console sources to generate a linkable output /////////////////
#endif //_pfConsoleCmd_h
#define PF_CONSOLE_FILE_DUMMY( name ) \
void _console_##name##_file_dummy() { }
#endif //_pfConsoleCmd_h

335
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp

@ -0,0 +1,335 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
//////////////////////////////////////////////////////////////////////////////
// //
// Actual CORE Console Commands and Groups //
// //
//////////////////////////////////////////////////////////////////////////////
#include "pfConsoleCmd.h"
#include "pnNetBase/Pch.h"
#include <algorithm>
//// DO NOT REMOVE!!!!
//// This is here so Microsoft VC won't decide to "optimize" this file out
PF_CONSOLE_FILE_DUMMY(Core)
//// DO NOT REMOVE!!!!
//
// utility functions
//
//////////////////////////////////////////////////////////////////////////////
void PrintStringF(void pfun(const char *),const char * fmt, ...)
{
va_list args;
char buffy[512];
va_start(args, fmt);
vsprintf(buffy, fmt, args);
va_end(args);
pfun(buffy);
}
/*****************************************************************************
*
* Server
*
***/
//TODO: Fix Plasma to use OpenSSL's byte order (or better yet, to use OpenSSL),
// so this hack isn't needed
static void swap_key_bytes(byte keyData[])
{
for (size_t i = 0; i < (kNetDiffieHellmanKeyBits / 16); ++i)
std::swap(keyData[i], keyData[ (kNetDiffieHellmanKeyBits / 8) - i - 1 ]);
}
//============================================================================
// Server group
PF_CONSOLE_GROUP(Server)
//============================================================================
PF_CONSOLE_CMD(
Server,
Status,
"string url",
"Set the server's status URL"
) {
wchar_t *wurl = hsStringToWString((const char *)params[0]);
SetServerStatusUrl(wurl);
delete [] wurl;
}
//============================================================================
PF_CONSOLE_CMD(
Server,
Signup,
"string url",
"Set the server's new user sign-up URL"
) {
wchar_t *wurl = hsStringToWString((const char *)params[0]);
SetServerSignupUrl(wurl);
delete [] wurl;
}
//============================================================================
PF_CONSOLE_CMD(
Server,
DispName,
"string name",
"Set the displayable server name"
) {
wchar_t *wname = hsStringToWString((const char *)params[0]);
SetServerDisplayName(wname);
delete [] wname;
}
//============================================================================
// Server.File group
PF_CONSOLE_SUBGROUP(Server, File)
//============================================================================
PF_CONSOLE_CMD(
Server_File,
Host,
"string address",
"Set the File Server address"
) {
wchar_t *wHost = hsStringToWString((const char *)params[0]);
SetFileSrvHostname(wHost);
delete [] wHost;
}
//============================================================================
// Server.Auth group
PF_CONSOLE_SUBGROUP(Server, Auth)
//============================================================================
PF_CONSOLE_CMD(
Server_Auth,
Host,
"string address",
"Set the Auth Server address"
) {
wchar_t *wHost = hsStringToWString((const char *)params[0]);
SetAuthSrvHostname(wHost);
delete [] wHost;
}
//============================================================================
PF_CONSOLE_CMD(
Server_Auth,
N,
"string base64Key",
"Set the Auth Server N key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kAuthDhNData);
swap_key_bytes(kAuthDhNData);
}
//============================================================================
PF_CONSOLE_CMD(
Server_Auth,
X,
"string base64Key",
"Set the Auth Server X key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kAuthDhXData);
swap_key_bytes(kAuthDhXData);
}
//============================================================================
// Server.Csr group
PF_CONSOLE_SUBGROUP(Server, Csr)
//============================================================================
PF_CONSOLE_CMD(
Server_Csr,
Host,
"string address",
"Set the Csr Server address"
) {
wchar_t *wHost = hsStringToWString((const char *)params[0]);
SetCsrSrvHostname(wHost);
delete [] wHost;
}
//============================================================================
PF_CONSOLE_CMD(
Server_Csr,
N,
"string base64Key",
"Set the Csr Server N key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kCsrDhNData);
swap_key_bytes(kCsrDhNData);
}
//============================================================================
PF_CONSOLE_CMD(
Server_Csr,
X,
"string base64Key",
"Set the Csr Server X key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kCsrDhXData);
swap_key_bytes(kCsrDhXData);
}
//============================================================================
// Server.Game group
PF_CONSOLE_SUBGROUP(Server, Game)
//============================================================================
PF_CONSOLE_CMD(
Server_Game,
N,
"string base64Key",
"Set the Game Server N key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGameDhNData);
swap_key_bytes(kGameDhNData);
}
//============================================================================
PF_CONSOLE_CMD(
Server_Game,
X,
"string base64Key",
"Set the Game Server X key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGameDhXData);
swap_key_bytes(kGameDhXData);
}
//============================================================================
// Server.Gate group
PF_CONSOLE_SUBGROUP(Server, Gate)
//============================================================================
PF_CONSOLE_CMD(
Server_Gate,
Host,
"string address",
"Set the GateKeeper Server address"
) {
wchar_t *wHost = hsStringToWString((const char *)params[0]);
SetGateKeeperSrvHostname(wHost);
delete [] wHost;
}
//============================================================================
PF_CONSOLE_CMD(
Server_Gate,
N,
"string base64Key",
"Set the GateKeeper Server N key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGateKeeperDhNData);
swap_key_bytes(kGateKeeperDhNData);
}
//============================================================================
PF_CONSOLE_CMD(
Server_Gate,
X,
"string base64Key",
"Set the GateKeeper Server X key"
) {
int baseLength = hsStrlen((const char *)params[0]);
if ((kNetDiffieHellmanKeyBits / 8) != Base64DecodeSize(baseLength, (const char *)params[0])) {
PrintStringF(PrintString, "Invalid key: should be exactly %u bytes",
kNetDiffieHellmanKeyBits / 8);
return;
}
Base64Decode(hsStrlen((const char *)params[0]), (const char *)params[0],
kNetDiffieHellmanKeyBits / 8, kGateKeeperDhXData);
swap_key_bytes(kGateKeeperDhXData);
}

0
Sources/Plasma/FeatureLib/pfConsole/pfConsoleContext.cpp → Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.cpp

0
Sources/Plasma/FeatureLib/pfConsole/pfConsoleContext.h → Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleContext.h

0
Sources/Plasma/FeatureLib/pfConsole/pfConsoleEngine.cpp → Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp

25
Sources/Plasma/FeatureLib/pfConsole/pfConsoleEngine.h → Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h

@ -95,4 +95,29 @@ class pfConsoleEngine
};
//// Use in your Main module to provide Console functionality ////////////////
#define PF_CONSOLE_LINK_FILE( name ) \
void _console_##name##_file_dummy();
#define PF_CONSOLE_INITIALIZE( name ) \
_console_##name##_file_dummy();
#define PF_CONSOLE_LINK_ALL() \
PF_CONSOLE_LINK_FILE(Avatar) \
PF_CONSOLE_LINK_FILE(CCR) \
PF_CONSOLE_LINK_FILE(Core) \
PF_CONSOLE_LINK_FILE(Game) \
PF_CONSOLE_LINK_FILE(Main) \
PF_CONSOLE_LINK_FILE(Net)
#define PF_CONSOLE_INIT_ALL() \
PF_CONSOLE_INITIALIZE(Avatar) \
PF_CONSOLE_INITIALIZE(CCR) \
PF_CONSOLE_INITIALIZE(Core) \
PF_CONSOLE_INITIALIZE(Game) \
PF_CONSOLE_INITIALIZE(Main) \
PF_CONSOLE_INITIALIZE(Net)
#endif //_pfConsoleEngine_h
Loading…
Cancel
Save