mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
CWE Directory Reorganization
Rearrange directory structure of CWE to be loosely equivalent to the H'uru Plasma repository. Part 1: Movement of directories and files.
This commit is contained in:
56
Sources/Plasma/NucleusLib/pnCsrCli/Pch.h
Normal file
56
Sources/Plasma/NucleusLib/pnCsrCli/Pch.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*==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/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
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==*/
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrCli/Pch.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PCH_H
|
||||
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnCsrCli/Pch.h included more than once"
|
||||
#endif
|
||||
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PCH_H
|
||||
|
||||
|
||||
#include "pnCsrCli.h"
|
||||
|
||||
#include <malloc.h>
|
269
Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp
Normal file
269
Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp
Normal file
@ -0,0 +1,269 @@
|
||||
/*==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/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
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==*/
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.cpp
|
||||
*
|
||||
***/
|
||||
|
||||
#include "Pch.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Local types
|
||||
*
|
||||
***/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Local data
|
||||
*
|
||||
***/
|
||||
|
||||
static bool s_running;
|
||||
static CCritSect s_critsect;
|
||||
static SimpleNetConn * s_conn;
|
||||
static FCsrCliOnError s_onError;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Local functions
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
static SimpleNetConn * GetConnIncRef () {
|
||||
|
||||
SimpleNetConn * conn;
|
||||
s_critsect.Enter();
|
||||
{
|
||||
if (nil != (conn = s_conn))
|
||||
SimpleNetConnIncRef(conn);
|
||||
}
|
||||
s_critsect.Leave();
|
||||
return conn;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static bool SimpleNetOnMsg (
|
||||
SimpleNetConn * ,
|
||||
SimpleNet_MsgHeader *
|
||||
) {
|
||||
LogMsg(kLogPerf, L"pnCsrCli: Rcvd unexpected message from peer");
|
||||
return false;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void SimpleNetOnError (
|
||||
SimpleNetConn * ,
|
||||
ENetError error
|
||||
) {
|
||||
if (!s_running)
|
||||
return;
|
||||
|
||||
LogMsg(kLogPerf, L"pnCsrCli: NetError: %s", NetErrorToString(error));
|
||||
|
||||
if (error == kNetErrDisconnected)
|
||||
CsrCliDisconnect();
|
||||
|
||||
s_onError(error);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void SimpleNetOnConnect (
|
||||
void * param,
|
||||
SimpleNetConn * conn,
|
||||
ENetError result
|
||||
) {
|
||||
FCsrCliOnConnect onConnect = (FCsrCliOnConnect)param;
|
||||
|
||||
LogMsg(kLogPerf, L"pnCsrCli: OnConnect: %s", NetErrorToString(result));
|
||||
|
||||
if (s_conn)
|
||||
CsrCliDisconnect();
|
||||
|
||||
if (IS_NET_SUCCESS(result)) {
|
||||
s_critsect.Enter();
|
||||
{
|
||||
s_conn = conn;
|
||||
}
|
||||
s_critsect.Leave();
|
||||
}
|
||||
|
||||
if (onConnect)
|
||||
onConnect(result);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
static void Send_ExecConsoleCmd (const char cmd[]) {
|
||||
|
||||
SimpleNetConn * conn = GetConnIncRef();
|
||||
if (!conn)
|
||||
return;
|
||||
|
||||
unsigned cmdBytes = StrBytes(cmd);
|
||||
|
||||
CsrNet_ExecConsoleCmd * msg;
|
||||
|
||||
unsigned msgBytes
|
||||
= sizeof(*msg)
|
||||
- sizeof(msg->cmd)
|
||||
+ cmdBytes
|
||||
+ sizeof(cmd[0])
|
||||
;
|
||||
|
||||
msg = new(_alloca(msgBytes)) CsrNet_ExecConsoleCmd();
|
||||
msg->messageBytes = msgBytes;
|
||||
|
||||
StrCopy(msg->cmd, cmd, cmdBytes / sizeof(cmd[0]));
|
||||
msg->cmd[cmdBytes] = 0;
|
||||
|
||||
SimpleNetSend(conn, msg);
|
||||
SimpleNetConnDecRef(conn);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Exports
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
void CsrCliInitialize (FCsrCliOnError onError) {
|
||||
|
||||
ASSERT(!s_running);
|
||||
ASSERT(onError);
|
||||
|
||||
s_running = true;
|
||||
s_onError = onError;
|
||||
|
||||
SimpleNetInitialize();
|
||||
SimpleNetCreateChannel(kSimpleNetChannelCsr, SimpleNetOnMsg, SimpleNetOnError);
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
void CsrCliShutdown () {
|
||||
|
||||
s_running = false;
|
||||
s_onError = nil;
|
||||
|
||||
CsrCliDisconnect();
|
||||
SimpleNetDestroyChannel(kSimpleNetChannelCsr);
|
||||
SimpleNetShutdown();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CsrCliStartConnecting (
|
||||
const wchar addr[],
|
||||
FCsrCliOnConnect onConnect
|
||||
) {
|
||||
ASSERT(s_running);
|
||||
|
||||
CsrCliDisconnect();
|
||||
SimpleNetStartConnecting(kSimpleNetChannelCsr, addr, SimpleNetOnConnect, onConnect);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CsrCliDisconnect () {
|
||||
|
||||
SimpleNetConn * conn = nil;
|
||||
s_critsect.Enter();
|
||||
{
|
||||
SWAP(conn, s_conn);
|
||||
}
|
||||
s_critsect.Leave();
|
||||
if (conn)
|
||||
SimpleNetDisconnect(conn);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CsrCliToggleAvatarPhysical () {
|
||||
|
||||
ASSERT(s_running);
|
||||
|
||||
Send_ExecConsoleCmd("Avatar.Physics.TogglePhysical");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CsrCliWarpPlayerHere (unsigned playerId) {
|
||||
|
||||
ASSERT(s_running);
|
||||
|
||||
char cmd[1024];
|
||||
StrPrintf(cmd, arrsize(cmd), "CCR.WarpPlayerHere %u", playerId);
|
||||
Send_ExecConsoleCmd(cmd);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CsrCliWarpToPlayer (unsigned playerId) {
|
||||
|
||||
ASSERT(s_running);
|
||||
|
||||
char cmd[1024];
|
||||
StrPrintf(cmd, arrsize(cmd), "CCR.WarpToPlayer %u", playerId);
|
||||
Send_ExecConsoleCmd(cmd);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CsrCliLinkPlayerHere (unsigned playerId) {
|
||||
|
||||
ASSERT(s_running);
|
||||
|
||||
char cmd[1024];
|
||||
StrPrintf(cmd, arrsize(cmd), "CCR.LinkPlayerHere %u", playerId);
|
||||
Send_ExecConsoleCmd(cmd);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void CsrCliLinkToPlayer (unsigned playerId) {
|
||||
|
||||
ASSERT(s_running);
|
||||
|
||||
char cmd[1024];
|
||||
StrPrintf(cmd, arrsize(cmd), "CCR.LinkToPlayer %u", playerId);
|
||||
Send_ExecConsoleCmd(cmd);
|
||||
}
|
83
Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h
Normal file
83
Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*==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/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
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==*/
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $/Plasma20/Sources/Plasma/NucleusLib/pnCsrCli/pnCsrCli.h
|
||||
*
|
||||
***/
|
||||
|
||||
#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PNCSRCLI_H
|
||||
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PNCSRCLI_H
|
||||
|
||||
|
||||
#include "pnCsrNet/pnCsrNet.h"
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* pnCsrCli
|
||||
* - Connects to pfCsrSrv in remote CSR client.
|
||||
* - Sends commands to pfCsrSrv for remote execution.
|
||||
*
|
||||
***/
|
||||
|
||||
typedef void (*FCsrCliOnError) (ENetError error);
|
||||
|
||||
void CsrCliInitialize (FCsrCliOnError onError);
|
||||
void CsrCliShutdown ();
|
||||
|
||||
typedef void (*FCsrCliOnConnect) (ENetError result);
|
||||
|
||||
void CsrCliStartConnecting (
|
||||
const wchar addr[],
|
||||
FCsrCliOnConnect onConnect
|
||||
);
|
||||
void CsrCliDisconnect ();
|
||||
|
||||
void CsrCliToggleAvatarPhysical ();
|
||||
void CsrCliWarpPlayerHere (unsigned playerId);
|
||||
void CsrCliWarpToPlayer (unsigned playerId);
|
||||
void CsrCliLinkPlayerHere (unsigned playerId);
|
||||
void CsrCliLinkToPlayer (unsigned playerId);
|
||||
|
||||
|
||||
#endif // PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNCSRCLI_PNCSRCLI_H
|
Reference in New Issue
Block a user