Browse Source

Merge pull request #465 from Hoikas/kill-utils-str

Moar pnUtStr Killing
Darryl Pogue 9 years ago
parent
commit
0b6fc76403
  1. 2
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 18
      Sources/Plasma/Apps/plClient/winmain.cpp
  3. 17
      Sources/Plasma/Apps/plUruLauncher/plClientLauncher.cpp
  4. 2
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
  5. 6
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp
  6. 13
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp
  7. 20
      Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp
  8. 20
      Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp
  9. 6
      Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.h
  10. 3
      Sources/Plasma/FeatureLib/pfPython/cyAccountManagementGlue.cpp
  11. 4
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  12. 4
      Sources/Plasma/FeatureLib/pfPython/cyMisc.h
  13. 2
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp
  14. 58
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp
  15. 29
      Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp
  16. 17
      Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp
  17. 4
      Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h
  18. 9
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  19. 2
      Sources/Plasma/FeatureLib/pfPython/pyVault.h
  20. 78
      Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp
  21. 26
      Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h
  22. 4
      Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.cpp
  23. 4
      Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.h
  24. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h
  25. 8
      Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp
  26. 2
      Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.h
  27. 8
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp
  28. 12
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h
  29. 14
      Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt
  30. 61
      Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxStr.cpp
  31. 97
      Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Str.cpp
  32. 164
      Sources/Plasma/NucleusLib/pnUtils/pnUtStr.cpp
  33. 30
      Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h
  34. 54
      Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp
  35. 32
      Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.h
  36. 38
      Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoaderPaging.cpp
  37. 4
      Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp
  38. 27
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp
  39. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h
  40. 8
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp
  41. 16
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  42. 141
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  43. 35
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h
  44. 22
      Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp
  45. 365
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp
  46. 60
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h
  47. 23
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp
  48. 2
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h
  49. 26
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp
  50. 16
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h
  51. 2
      Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp
  52. 52
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp
  53. 14
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h

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

@ -1474,7 +1474,7 @@ bool plClient::StartInit()
plSynchedObject::PushSynchDisabled(false); // enable dirty tracking
if (StrCmp(NetCommGetStartupAge()->ageDatasetName, "StartUp") == 0)
if (NetCommGetStartupAge()->ageDatasetName.CompareI("StartUp") == 0)
{
plNetCommAuthMsg * msg = new plNetCommAuthMsg();
msg->result = kNetSuccess;

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

@ -813,7 +813,7 @@ static void SaveUserPass(LoginDialogParam *pLoginParam, char *password)
store->SetPassword(pLoginParam->username, plString::Null);
}
NetCommSetAccountUsernamePassword(theUser.ToWchar(), pLoginParam->namePassHash);
NetCommSetAccountUsernamePassword(theUser, pLoginParam->namePassHash);
// FIXME: Real OS detection
NetCommSetAuthTokenAndOS(nil, L"win");
@ -871,7 +871,7 @@ void StatusCallback(void *param)
HWND hwnd = (HWND)param;
const char *statusUrl = GetServerStatusUrl();
plString statusUrl = GetServerStatusUrl();
CURL *hCurl = curl_easy_init();
// For reporting errors
@ -880,14 +880,14 @@ void StatusCallback(void *param)
while(s_loginDlgRunning)
{
curl_easy_setopt(hCurl, CURLOPT_URL, statusUrl);
curl_easy_setopt(hCurl, CURLOPT_URL, statusUrl.c_str());
curl_easy_setopt(hCurl, CURLOPT_USERAGENT, "UruClient/1.0");
curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, &CurlCallback);
curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, param);
if (statusUrl[0] && curl_easy_perform(hCurl) != 0) // only perform request if there's actually a URL set
if (!statusUrl.IsEmpty() && curl_easy_perform(hCurl) != 0) // only perform request if there's actually a URL set
PostMessage(hwnd, WM_USER_SETSTATUSMSG, 0, (LPARAM) curlError);
for(unsigned i = 0; i < UPDATE_STATUSMSG_SECONDS && s_loginDlgRunning; ++i)
{
Sleep(1000);
@ -1033,8 +1033,8 @@ BOOL CALLBACK UruLoginDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
}
else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_URULOGIN_NEWACCTLINK)
{
const char* signupurl = GetServerSignupUrl();
ShellExecuteA(NULL, "open", signupurl, NULL, NULL, SW_SHOWNORMAL);
plString signupurl = GetServerSignupUrl();
ShellExecuteW(NULL, L"open", signupurl.ToWchar(), NULL, NULL, SW_SHOWNORMAL);
return TRUE;
}
@ -1270,9 +1270,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
if (!doIntroDialogs && loginParam.remember) {
ENetError auth;
wchar_t wusername[kMaxAccountNameLength];
StrToUnicode(wusername, loginParam.username, arrsize(wusername));
NetCommSetAccountUsernamePassword(wusername, loginParam.namePassHash);
NetCommSetAccountUsernamePassword(loginParam.username, loginParam.namePassHash);
bool cancelled = AuthenticateNetClientComm(&auth, NULL);
if (IS_NET_ERROR(auth) || cancelled) {

17
Sources/Plasma/Apps/plUruLauncher/plClientLauncher.cpp

@ -103,13 +103,13 @@ static size_t ICurlCallback(void* buffer, size_t size, size_t nmemb, void* threa
hsError plShardStatus::Run()
{
{
const char* url = GetServerStatusUrl();
plString url = GetServerStatusUrl();
// initialize CURL
std::unique_ptr<CURL, std::function<void(CURL*)>> curl(curl_easy_init(), curl_easy_cleanup);
curl_easy_setopt(curl.get(), CURLOPT_ERRORBUFFER, fCurlError);
curl_easy_setopt(curl.get(), CURLOPT_USERAGENT, "UruClient/1.0");
curl_easy_setopt(curl.get(), CURLOPT_URL, url);
curl_easy_setopt(curl.get(), CURLOPT_URL, url.c_str());
curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, this);
curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, ICurlCallback);
@ -123,7 +123,7 @@ hsError plShardStatus::Run()
if (!fRunning)
break;
if (url[0] && curl_easy_perform(curl.get()))
if (!url.IsEmpty() && curl_easy_perform(curl.get()))
fShardFunc(fCurlError);
fLastUpdate = hsTimer::GetSysSeconds();
} while (fRunning);
@ -334,16 +334,15 @@ bool plClientLauncher::CompleteSelfPatch(std::function<void(void)> waitProc) con
// ===================================================
static void IGotFileServIPs(ENetError result, void* param, const wchar_t* addr)
static void IGotFileServIPs(ENetError result, void* param, const plString& addr)
{
plClientLauncher* launcher = static_cast<plClientLauncher*>(param);
NetCliGateKeeperDisconnect();
if (IS_NET_SUCCESS(result)) {
// bah... why do I even bother
plString eapSucks = plString::FromWchar(addr);
const char* eapReallySucks[] = { eapSucks.c_str() };
NetCliFileStartConnect(eapReallySucks, 1, true);
plString eapSucks[] = { addr };
NetCliFileStartConnect(eapSucks, 1, true);
// Who knows if we will actually connect. So let's start updating.
launcher->PatchClient();
@ -373,8 +372,8 @@ void plClientLauncher::InitializeNetCore()
NetClientSetTransTimeoutMs(kNetTransTimeout);
// Gotta grab the filesrvs from the gate
const char** addrs;
uint32_t num = GetGateKeeperSrvHostnames(&addrs);
const plString* addrs;
uint32_t num = GetGateKeeperSrvHostnames(addrs);
NetCliGateKeeperStartConnect(addrs, num);
NetCliGateKeeperFileSrvIpAddressRequest(IGotFileServIPs, this, true);

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

@ -3916,7 +3916,7 @@ PF_CONSOLE_CMD( Nav, ExcludePage, "string pageName", "Excludes the given page fr
{
char str[ 256 ];
sprintf( str, "Page %s excluded from load", (char *)params[ 0 ] );
plAgeLoader::GetInstance()->AddExcludedPage( params[ 0 ] );
plAgeLoader::GetInstance()->AddExcludedPage( (char*)params[ 0 ] );
PrintString( str );
}
}

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

@ -789,11 +789,7 @@ PF_CONSOLE_CMD( Net_Vault,
"string stationName, string mtSpawnPt",
"Register an MT Station with your Nexus" )
{
wchar_t wName[MAX_PATH];
wchar_t wObj[MAX_PATH];
StrToUnicode(wName, params[0], arrsize(wName));
StrToUnicode(wObj, params[1], arrsize(wObj));
VaultRegisterMTStationAndWait ( wName, wObj );
VaultRegisterMTStationAndWait((char*)params[0], (char*)params[1]);
PrintString("Registered MT Station.");
}

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

@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pfConsoleCmd.h"
#include "pnNetBase/pnNetBase.h"
#include "pfUtilBase64.h"
#include "plString.h"
#include <algorithm>
@ -89,7 +90,7 @@ PF_CONSOLE_CMD(
"string url",
"Set the server's status URL"
) {
SetServerStatusUrl(params[0]);
SetServerStatusUrl((char*)params[0]);
}
//============================================================================
@ -99,7 +100,7 @@ PF_CONSOLE_CMD(
"string url",
"Set the server's new user sign-up URL"
) {
SetServerSignupUrl(params[0]);
SetServerSignupUrl((char*)params[0]);
}
//============================================================================
@ -109,7 +110,7 @@ PF_CONSOLE_CMD(
"string name",
"Set the displayable server name"
) {
SetServerDisplayName(params[0]);
SetServerDisplayName((char*)params[0]);
}
//============================================================================
@ -134,7 +135,7 @@ PF_CONSOLE_CMD(
"string address",
"Set the File Server address"
) {
SetFileSrvHostname(params[0]);
SetFileSrvHostname((char*)params[0]);
}
@ -149,7 +150,7 @@ PF_CONSOLE_CMD(
"string address",
"Set the Auth Server address"
) {
SetAuthSrvHostname(params[0]);
SetAuthSrvHostname((char*)params[0]);
}
//============================================================================
@ -261,7 +262,7 @@ PF_CONSOLE_CMD(
"string address",
"Set the GateKeeper Server address"
) {
SetGateKeeperSrvHostname(params[0]);
SetGateKeeperSrvHostname((char*)params[0]);
}
//============================================================================

20
Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp

@ -133,14 +133,14 @@ void pfGameScore::TransferPoints(pfGameScore* to, int32_t points, plKey recvr)
//======================================
static void OnScoreCreate(
ENetError result,
void * param,
uint32_t scoreId,
uint32_t createdTime, // ignored
uint32_t ownerId,
const char* gameName,
uint32_t gameType,
int32_t value
ENetError result,
void * param,
uint32_t scoreId,
uint32_t createdTime, // ignored
uint32_t ownerId,
const plString& gameName,
uint32_t gameType,
int32_t value
) {
ScoreUpdateParam* p = (ScoreUpdateParam*)param;
pfGameScore* score = new pfGameScore(scoreId, ownerId, gameName, gameType, value);
@ -151,7 +151,7 @@ static void OnScoreCreate(
void pfGameScore::Create(uint32_t ownerId, const plString& name, uint32_t type, int32_t value, plKey rcvr)
{
NetCliAuthScoreCreate(ownerId, name.c_str(), type, value, OnScoreCreate, new ScoreUpdateParam(nil, rcvr));
NetCliAuthScoreCreate(ownerId, name, type, value, OnScoreCreate, new ScoreUpdateParam(nil, rcvr));
}
//======================================
@ -165,7 +165,7 @@ static void OnScoreFound(
for (uint32_t i = 0; i < scoreCount; ++i)
{
const NetGameScore ngs = scores[i];
vec[i] = new pfGameScore(ngs.scoreId, ngs.ownerId, plString::FromWchar(ngs.gameName), ngs.gameType, ngs.value);
vec[i] = new pfGameScore(ngs.scoreId, ngs.ownerId, ngs.gameName, ngs.gameType, ngs.value);
}
ScoreFindParam* p = (ScoreFindParam*)param;

20
Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp

@ -69,9 +69,9 @@ PyObject* cyAccountManagement::GetPlayerList()
for (int i = 0; i < numPlayers; ++i)
{
PyObject* playerTuple = PyTuple_New(3);
PyObject* playerName = PyUnicode_FromUnicode((const Py_UNICODE*)playerList[i].playerName, wcslen(playerList[i].playerName));
PyObject* playerName = PyUnicode_FromStringEx(playerList[i].playerName);
PyObject* playerId = PyInt_FromLong(playerList[i].playerInt);
PyObject* avatarShape = PyString_FromString(playerList[i].avatarDatasetName);
PyObject* avatarShape = PyString_FromPlString(playerList[i].avatarDatasetName);
PyTuple_SetItem(playerTuple, 0, playerName);
PyTuple_SetItem(playerTuple, 1, playerId);
@ -96,13 +96,13 @@ PyObject* cyAccountManagement::GetPlayerList()
return pList;
}
std::wstring cyAccountManagement::GetAccountName()
plString cyAccountManagement::GetAccountName()
{
const NetCommAccount* acct = NetCommGetAccount();
if (acct)
return acct->accountName;
else
return L"";
return "";
}
void cyAccountManagement::CreatePlayer(const char* playerName, const char* avatar, const char* invitationCode)
@ -112,7 +112,11 @@ void cyAccountManagement::CreatePlayer(const char* playerName, const char* avata
void cyAccountManagement::CreatePlayerW(const wchar_t* playerName, const wchar_t* avatar, const wchar_t* invitationCode)
{
NetCommCreatePlayer(playerName, avatar, invitationCode, 0, nil);
NetCommCreatePlayer(plString::FromWchar(playerName),
plString::FromWchar(avatar),
plString::FromWchar(invitationCode),
0,
nullptr);
}
void cyAccountManagement::DeletePlayer(unsigned playerId)
@ -135,9 +139,7 @@ void cyAccountManagement::UpgradeVisitorToExplorer(unsigned playerId)
NetCommUpgradeVisitorToExplorer(playerId, nil);
}
void cyAccountManagement::ChangePassword(const char* password)
void cyAccountManagement::ChangePassword(const plString& password)
{
wchar_t* wpassword = StrDupToUnicode(password);
NetCommChangeMyPassword(wpassword);
free(wpassword);
NetCommChangeMyPassword(password);
}

6
Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.h

@ -50,10 +50,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//
#include <vector>
#include <string>
typedef struct _object PyObject;
typedef struct PyMethodDef PyMethodDef;
class plString;
class cyAccountManagement
{
@ -63,14 +63,14 @@ public:
static bool IsSubscriptionActive();
static PyObject* GetPlayerList();
static std::wstring GetAccountName();
static plString GetAccountName();
static void CreatePlayer(const char* playerName, const char* avatar, const char* invitationCode);
static void CreatePlayerW(const wchar_t* playerName, const wchar_t* avatar, const wchar_t* invitationCode);
static void DeletePlayer(unsigned playerId);
static void SetActivePlayer(unsigned playerId);
static bool IsActivePlayerSet();
static void UpgradeVisitorToExplorer(unsigned playerId);
static void ChangePassword(const char* password);
static void ChangePassword(const plString& password);
};

3
Sources/Plasma/FeatureLib/pfPython/cyAccountManagementGlue.cpp

@ -61,8 +61,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetAccountPlayerList, "Returns list of
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetAccountName, "Returns the account name for the current account")
{
std::wstring name = cyAccountManagement::GetAccountName();
return PyUnicode_FromWideChar(name.c_str(), name.length());
return PyUnicode_FromStringEx(cyAccountManagement::GetAccountName());
}
PYTHON_GLOBAL_METHOD_DEFINITION(PtCreatePlayer, args, "Params: playerName, avatarShape, invitation\nCreates a new player")

4
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -614,7 +614,7 @@ plString cyMisc::GetLocalClientName()
// : Return the current guid of the instance of the age the player is in
//
const char * cyMisc::GetAgeName()
plString cyMisc::GetAgeName()
{
return NetCommGetAge()->ageDatasetName;
}
@ -2875,7 +2875,7 @@ void cyMisc::SetBehaviorNetFlags(pyKey & behKey, bool netForce, bool netProp)
}
}
void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[])
void cyMisc::SendFriendInvite(const plString& email, const plString& toName)
{
if (hsRef<RelVaultNode> pNode = VaultGetPlayerNode())
{

4
Sources/Plasma/FeatureLib/pfPython/cyMisc.h

@ -299,7 +299,7 @@ public:
// : Return the current coordinates of the player within this age
// : Return the current time with the current age the player is in
//
static const char* GetAgeName();
static plString GetAgeName();
static PyObject* GetAgeInfo(); // returns pyAgeInfoStruct
static plString GetPrevAgeName();
static PyObject* GetPrevAgeInfo();
@ -952,7 +952,7 @@ public:
static plFileName GetInitPath();
static void SetBehaviorNetFlags(pyKey & behKey, bool netForce, bool netProp);
static void SendFriendInvite(const wchar_t email[], const wchar_t toName[]);
static void SendFriendInvite(const plString& email, const plString& toName);
static PyObject* PyGuidGenerate();
static PyObject* GetAIAvatarsByModelName(const char* name);
static void ForceVaultNodeUpdate(unsigned nodeId);

2
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp

@ -53,7 +53,7 @@ PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtFlashWindow, cyMisc::FlashWindow, "Flash
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetAgeName, "DEPRECIATED - use ptDniInfoSource instead")
{
return PyString_FromString(cyMisc::GetAgeName());
return PyString_FromPlString(cyMisc::GetAgeName());
}
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetAgeInfo, "Returns ptAgeInfoStruct of the current Age")

58
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp

@ -695,66 +695,26 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtSetBehaviorNetFlags, args, "Params: behKey, ne
PYTHON_GLOBAL_METHOD_DEFINITION(PtSendFriendInvite, args, "Params: emailAddress, toName = \"Friend\"\nSends an email with invite code")
{
PyObject* emailObj;
PyObject* toNameObj = nil;
if (!PyArg_ParseTuple(args, "O|O", &emailObj, &toNameObj))
char* emailIn = nullptr;
char* nameIn = nullptr;
if (!PyArg_ParseTuple(args, "es|es", "utf8", &emailIn, "utf8", &nameIn))
{
PyErr_SetString(PyExc_TypeError, "PtSendFriendInvite expects a string and optionally another string");
PYTHON_RETURN_ERROR;
}
wchar_t emailAddr[kMaxEmailAddressLength];
memset(emailAddr, 0, sizeof(emailAddr));
plString email = emailIn;
plString name = nameIn ? nameIn : "Friend";
PyMem_Free(emailIn);
PyMem_Free(nameIn);
wchar_t toName[kMaxPlayerNameLength];
memset(toName, 0, sizeof(toName));
// Check and see if the email address is ok
int origStrLen = 0;
if (PyUnicode_Check(emailObj))
{
origStrLen = PyUnicode_GET_SIZE(emailObj);
PyUnicode_AsWideChar((PyUnicodeObject*)emailObj, emailAddr, arrsize(emailAddr) - 1);
}
else if (PyString_Check(emailObj))
{
char* cAddr = PyString_AsString(emailObj);
origStrLen = StrLen(cAddr);
StrToUnicode(emailAddr, cAddr, arrsize(emailAddr));
}
else
{
PyErr_SetString(PyExc_TypeError, "PtSendFriendInvite expects a string and optionally another string");
PYTHON_RETURN_ERROR;
}
if (origStrLen >= kMaxEmailAddressLength)
if (email.GetSize() >= kMaxEmailAddressLength)
{
PyErr_SetString(PyExc_TypeError, "PtSendFriendInvite: Email address too long");
PYTHON_RETURN_ERROR;
}
// Check if the "to name" field is ok
if (toNameObj)
{
if (PyUnicode_Check(toNameObj))
{
origStrLen = PyUnicode_GET_SIZE(toNameObj);
PyUnicode_AsWideChar((PyUnicodeObject*)toNameObj, toName, arrsize(toName) - 1);
}
else if (PyString_Check(toNameObj))
{
char* cName = PyString_AsString(toNameObj);
origStrLen = StrLen(cName);
StrToUnicode(toName, cName, arrsize(toName));
}
else
StrCopy(toName, L"Friend", arrsize(toName));
}
else
StrCopy(toName, L"Friend", arrsize(toName));
cyMisc::SendFriendInvite(emailAddr, toName);
cyMisc::SendFriendInvite(email, name);
PYTHON_RETURN_NONE;
}

29
Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp

@ -590,10 +590,10 @@ plPythonSDLModifier* ExternFindAgePySDL()
plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL()
{
const char* ageName = cyMisc::GetAgeName();
plString ageName = cyMisc::GetAgeName();
if (strcmp(ageName, "") == 0)
return nil; // don't have an age, probably because we're running in max?
if (ageName.IsEmpty())
return nullptr; // don't have an age, probably because we're running in max?
// find the Age Global object
plLocation loc = plKeyFinder::Instance().FindLocation(ageName,plAgeDescription::GetCommonPage(plAgeDescription::kGlobal));
@ -613,27 +613,27 @@ plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL()
return sdlMod;
plNetClientApp::StaticErrorMsg("pfmod %s has a nil python SDL modifier for age sdl %s",
pfmod->GetKeyName().c_str("?"), ageName);
pfmod->GetKeyName().c_str("?"), ageName.c_str());
}
else
{
if (!key)
plNetClientApp::StaticErrorMsg("nil key %s for age sdl %s", ageName, oid.StringIze().c_str());
plNetClientApp::StaticErrorMsg("nil key %s for age sdl %s", ageName.c_str(), oid.StringIze().c_str());
else
if (!key->ObjectIsLoaded())
plNetClientApp::StaticErrorMsg("key %s not loaded for age sdl %s",
key->GetName().c_str("?"), ageName);
key->GetName().c_str("?"), ageName.c_str());
else
if (!plPythonFileMod::ConvertNoRef(key->ObjectIsLoaded()))
plNetClientApp::StaticErrorMsg("key %s is not a python file mod for age sdl %s",
key->GetName().c_str("?"), ageName);
key->GetName().c_str("?"), ageName.c_str());
}
}
else
plNetClientApp::StaticErrorMsg("Invalid plUoid for age sdl %s", ageName);
plNetClientApp::StaticErrorMsg("Invalid plUoid for age sdl %s", ageName.c_str());
}
else
plNetClientApp::StaticErrorMsg("Invalid plLocation for age sdl %s", ageName);
plNetClientApp::StaticErrorMsg("Invalid plLocation for age sdl %s", ageName.c_str());
// couldn't find one (maybe because we didn't look)
return nil;
@ -680,8 +680,8 @@ pySDLModifier::pySDLModifier(plPythonSDLModifier* sdlMod)
PyObject* pySDLModifier::GetAgeSDL()
{
const char* ageName = cyMisc::GetAgeName();
if (strcmp(ageName, "") == 0)
plString ageName = cyMisc::GetAgeName();
if (ageName.IsEmpty())
PYTHON_RETURN_NONE; // just return none if the age is blank (running in max?)
const plPythonSDLModifier* ageSDL = plPythonSDLModifier::FindAgeSDL();
@ -691,10 +691,9 @@ PyObject* pySDLModifier::GetAgeSDL()
}
// didn't find one, throw an exception for the python programmer to chew on
char errmsg[256];
sprintf(errmsg,"Age Global SDL for %s does not exist!",ageName);
plNetClientApp::StaticErrorMsg(errmsg);
PyErr_SetString(PyExc_KeyError, errmsg);
plString err = plFormat("Age Global SDL for {} does not exist!", ageName);
plNetClientApp::StaticErrorMsg(err.c_str());
PyErr_SetString(PyExc_KeyError, err.c_str());
PYTHON_RETURN_ERROR;
}

17
Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp

@ -173,27 +173,18 @@ plUUID pyAgeVault::GetAgeGuid( void )
///////////////
// Chronicle
PyObject* pyAgeVault::FindChronicleEntry( const char * entryName )
PyObject* pyAgeVault::FindChronicleEntry( const plString& entryName )
{
wchar_t wEntryName[kMaxVaultNodeStringLength];
StrToUnicode(wEntryName, entryName, arrsize(wEntryName));
if (hsRef<RelVaultNode> rvn = VaultFindAgeChronicleEntry(wEntryName))
if (hsRef<RelVaultNode> rvn = VaultFindAgeChronicleEntry(entryName))
return pyVaultChronicleNode::New(rvn);
// just return a None object
PYTHON_RETURN_NONE;
}
void pyAgeVault::AddChronicleEntry( const char * name, uint32_t type, const char * value )
void pyAgeVault::AddChronicleEntry( const plString& name, uint32_t type, const plString& value )
{
wchar_t * wEntryName = StrDupToUnicode(name);
wchar_t * wEntryValue = StrDupToUnicode(value);
VaultAddAgeChronicleEntry(wEntryName, type, wEntryValue);
free(wEntryName);
free(wEntryValue);
VaultAddAgeChronicleEntry(name, type, value);
}
// AGE DEVICES. AKA IMAGERS, WHATEVER.

4
Sources/Plasma/FeatureLib/pfPython/pyAgeVault.h

@ -92,8 +92,8 @@ public:
PyObject* GetSubAgesFolder( void ); // returns pyVaultFolderNode
PyObject* GetChronicleFolder( void ); // returns pyVaultFolderNode
// Age chronicle (not the player chronicle!)
PyObject* FindChronicleEntry( const char * entryName ); // returns pyVaultChronicleNode
void AddChronicleEntry( const char * name, uint32_t type, const char * value );
PyObject* FindChronicleEntry( const plString& entryName ); // returns pyVaultChronicleNode
void AddChronicleEntry( const plString& name, uint32_t type, const plString& value );
// Players who have published to devices in this age
PyObject* GetPeopleIKnowAboutFolder( void ); // returns pyVaultPlayerInfoListNode
// PERSONAL AGE SPECIFIC

9
Sources/Plasma/FeatureLib/pfPython/pyVault.cpp

@ -489,15 +489,10 @@ bool pyVault::AmAgeCzar( const pyAgeInfoStruct * ageInfo )
return VaultAmCzarOfAge(ageInstId);
}
void pyVault::RegisterMTStation( const char * stationName, const char * backLinkSpawnPtObjName )
void pyVault::RegisterMTStation( const plString& stationName, const plString& backLinkSpawnPtObjName )
{
wchar_t wStationName[256];
wchar_t wSpawnPt[256];
StrToUnicode(wStationName, stationName, arrsize(wStationName));
StrToUnicode(wSpawnPt, backLinkSpawnPtObjName, arrsize(wSpawnPt));
// Note: This doesn't actually block (~Hoikas)
VaultRegisterMTStationAndWait( wStationName, wSpawnPt);
VaultRegisterMTStationAndWait(stationName, backLinkSpawnPtObjName);
}
void pyVault::RegisterOwnedAge( const pyAgeLinkStruct & link )

2
Sources/Plasma/FeatureLib/pfPython/pyVault.h

@ -160,7 +160,7 @@ public:
void RegisterVisitAge( const pyAgeLinkStruct & link );
void UnRegisterVisitAge( const char * guid );
// Register a nexus station
void RegisterMTStation( const char * stationName, const char * mtSpawnPt );
void RegisterMTStation( const plString& stationName, const plString& mtSpawnPt );
///////////////
// Invite player to visit an age.

78
Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp

@ -41,11 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include "pnNbSrvs.h"
#if !HS_BUILD_FOR_WIN32
# include <wchar.h>
#endif
#include "plString.h"
/*****************************************************************************
*
@ -53,22 +49,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*
***/
static char s_authAddrConsole[64] = {0};
static const char* s_authAddrs[] = {
s_authAddrConsole
};
static char s_fileAddrConsole[64] = {0};
static const char* s_fileAddrs[] = {
s_fileAddrConsole
};
static char s_gateKeeperAddrConsole[64] = {0};
static const char* s_gateKeeperAddrs[] = {
s_gateKeeperAddrConsole
};
static plString s_authAddrs[] = { "" };
static plString s_fileAddrs[] = { "" };
static plString s_gateKeeperAddrs[] = { "" };
static unsigned s_clientPort = 14617;
@ -82,45 +65,40 @@ static unsigned s_clientPort = 14617;
//============================================================================
// Auth
//============================================================================
unsigned GetAuthSrvHostnames (const char*** addrs) {
*addrs = s_authAddrs;
unsigned GetAuthSrvHostnames (const plString*& addrs) {
addrs = s_authAddrs;
return arrsize(s_authAddrs);
}
//============================================================================
void SetAuthSrvHostname (const char addr[]) {
strncpy(s_authAddrConsole, addr, arrsize(s_authAddrConsole));
void SetAuthSrvHostname (const plString& addr) {
s_authAddrs[0] = addr;
}
//============================================================================
// File
//============================================================================
unsigned GetFileSrvHostnames (const char*** addrs) {
*addrs = s_fileAddrs;
unsigned GetFileSrvHostnames (const plString*& addrs) {
addrs = s_fileAddrs;
return arrsize(s_fileAddrs);
}
//============================================================================
void SetFileSrvHostname (const char addr[]) {
strncpy(s_fileAddrConsole, addr, arrsize(s_fileAddrConsole));
void SetFileSrvHostname (const plString& addr) {
s_fileAddrs[0] = addr;
}
//============================================================================
// GateKeeper
//============================================================================
unsigned GetGateKeeperSrvHostnames (const char*** addrs) {
*addrs = s_gateKeeperAddrs;
unsigned GetGateKeeperSrvHostnames (const plString*& addrs) {
addrs = s_gateKeeperAddrs;
return arrsize(s_gateKeeperAddrs);
}
//============================================================================
void SetGateKeeperSrvHostname (const char addr[]) {
strncpy(s_gateKeeperAddrConsole, addr, arrsize(s_gateKeeperAddrConsole));
void SetGateKeeperSrvHostname (const plString& addr) {
s_gateKeeperAddrs[0] = addr;
}
//============================================================================
@ -139,36 +117,36 @@ void SetClientPort(unsigned port) {
//============================================================================
// User-visible Server
//============================================================================
static char s_serverStatusUrl[256] = {0};
static char s_serverSignupUrl[256] = {0};
static char s_serverName[256] = {0};
static plString s_serverStatusUrl;
static plString s_serverSignupUrl;
static plString s_serverName;
//============================================================================
const char* GetServerStatusUrl () {
plString GetServerStatusUrl () {
return s_serverStatusUrl;
}
//============================================================================
void SetServerStatusUrl (const char url[]) {
strncpy(s_serverStatusUrl, url, arrsize(s_serverStatusUrl));
void SetServerStatusUrl (const plString& url) {
s_serverStatusUrl = url;
}
//============================================================================
const char* GetServerSignupUrl () {
plString GetServerSignupUrl () {
return s_serverSignupUrl;
}
//============================================================================
void SetServerSignupUrl (const char url[]) {
strncpy(s_serverSignupUrl, url, arrsize(s_serverSignupUrl));
void SetServerSignupUrl (const plString& url) {
s_serverSignupUrl = url;
}
//============================================================================
const char* GetServerDisplayName () {
plString GetServerDisplayName () {
return s_serverName;
}
//============================================================================
void SetServerDisplayName (const char name[]) {
strncpy(s_serverName, name, arrsize(s_serverName));
void SetServerDisplayName (const plString& name) {
s_serverName = name;
}

26
Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h

@ -84,25 +84,27 @@ enum ESrvType {
*
***/
unsigned GetAuthSrvHostnames (const char*** addrs); // returns addrCount
void SetAuthSrvHostname (const char addr[]);
class plString;
unsigned GetFileSrvHostnames (const char*** addrs); // returns addrCount
void SetFileSrvHostname (const char addr[]);
unsigned GetAuthSrvHostnames (const plString*& addrs); // returns addrCount
void SetAuthSrvHostname (const plString& addr);
unsigned GetGateKeeperSrvHostnames (const char*** addrs); // returns addrCount
void SetGateKeeperSrvHostname (const char addr[]);
unsigned GetFileSrvHostnames (const plString*& addrs); // returns addrCount
void SetFileSrvHostname (const plString& addr);
unsigned GetGateKeeperSrvHostnames (const plString*& addrs); // returns addrCount
void SetGateKeeperSrvHostname (const plString& addr);
unsigned GetClientPort();
void SetClientPort(unsigned port);
const char *GetServerStatusUrl ();
void SetServerStatusUrl (const char url[]);
plString GetServerStatusUrl ();
void SetServerStatusUrl (const plString& url);
const char *GetServerSignupUrl ();
void SetServerSignupUrl (const char url[]);
plString GetServerSignupUrl ();
void SetServerSignupUrl (const plString& url);
const char *GetServerDisplayName ();
void SetServerDisplayName (const char name[]);
plString GetServerDisplayName ();
void SetServerDisplayName (const plString& name);
#endif // pnNbSrvs_inc

4
Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.cpp

@ -57,7 +57,7 @@ plNetAddress::plNetAddress(uint32_t addr, uint16_t port)
SetPort(port);
}
plNetAddress::plNetAddress(const char* addr, uint16_t port)
plNetAddress::plNetAddress(const plString& addr, uint16_t port)
{
Clear();
SetHost(addr);
@ -114,7 +114,7 @@ plString plNetAddress::GetHostWithPort() const
return ss.GetString();
}
bool plNetAddress::SetHost(const char* hostname)
bool plNetAddress::SetHost(const plString& hostname)
{
fAddr.sin_addr.s_addr = pnNetCommon::GetBinAddr(hostname);
fAddr.sin_family = AF_INET;

4
Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.h

@ -104,7 +104,7 @@ public:
* @param addr The DNS hostname of the host.
* @param port The port number as a 16-bit host order integer.
*/
plNetAddress(const char* addr, uint16_t port);
plNetAddress(const plString& addr, uint16_t port);
virtual ~plNetAddress(){}
@ -158,7 +158,7 @@ public:
*
* @param hostname The DNS name of the host.
*/
bool SetHost(const char* hostname);
bool SetHost(const plString& hostname);
/**
* Sets the IPv4 address of the host from an unsigned 32-bit integer in

2
Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h

@ -189,7 +189,7 @@ public:
virtual plNetGroupId GetEffectiveNetGroup(const plSynchedObject* obj) const { hsAssert(false, "stub"); return plNetGroup::kNetGroupUnknown; }
virtual int Update(double secs) { return hsOK;}
virtual const char* GetServerLogTimeAsString(plString& ts) const { hsAssert(false, "stub"); return nil; }
virtual plUoid GetAgeSDLObjectUoid(const char* ageName) const { hsAssert(false, "stub"); return plUoid(); }
virtual plUoid GetAgeSDLObjectUoid(const plString& ageName) const { hsAssert(false, "stub"); return plUoid(); }
virtual void StayAlive(double secs) {}
virtual void QueueDisableNet( bool showDlg, const char msg[] ) {}

8
Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp

@ -67,13 +67,13 @@ plString GetTextAddr(uint32_t binAddr)
}
// NOTE: On Win32, WSAStartup() must be called before GetBinAddr() will work.
uint32_t GetBinAddr(const char * textAddr)
uint32_t GetBinAddr(const plString& textAddr)
{
uint32_t addr = 0;
if (!textAddr)
if (textAddr.IsEmpty())
return addr;
addr = inet_addr(textAddr);
addr = inet_addr(textAddr.c_str());
if(addr == INADDR_NONE)
{
struct addrinfo* ai = nil;
@ -81,7 +81,7 @@ uint32_t GetBinAddr(const char * textAddr)
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = PF_INET;
hints.ai_flags = AI_CANONNAME;
if (getaddrinfo(textAddr, nil, &hints, &ai) != 0)
if (getaddrinfo(textAddr.c_str(), nil, &hints, &ai) != 0)
{
hsAssert(false, "getaddrinfo failed");
return addr;

2
Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.h

@ -81,7 +81,7 @@ namespace pnNetCommon
{
#ifndef SERVER
uint32_t GetBinAddr(const char* textAddr);
uint32_t GetBinAddr(const plString& textAddr);
plString GetTextAddr(uint32_t binAddr);
#endif // SERVER

8
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.cpp

@ -207,8 +207,8 @@ unsigned NetGameScore::Read(const uint8_t inbuffer[], unsigned bufsz, uint8_t**
IReadValue(&value, &buffer, &bufsz);
IReadString(&tempstr, &buffer, &bufsz);
StrCopy(gameName, tempstr, arrsize(gameName));
delete tempstr;
gameName = plString::FromWchar(tempstr);
free(tempstr);
if (end)
*end = buffer;
@ -226,7 +226,7 @@ unsigned NetGameScore::Write(ARRAY(uint8_t) * buffer) const {
IWriteValue(createdTime, buffer);
IWriteValue(gameType, buffer);
IWriteValue(value, buffer);
IWriteString(gameName, buffer);
IWriteString(gameName.ToWchar().GetData(), buffer);
return buffer->Count() - pos;
}
@ -238,7 +238,7 @@ void NetGameScore::CopyFrom(const NetGameScore & score) {
createdTime = score.createdTime;
gameType = score.gameType;
value = score.value;
StrCopy(gameName, score.gameName, arrsize(gameName));
gameName = score.gameName;
}
/*****************************************************************************

12
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h

@ -104,10 +104,10 @@ struct NetAgeInfo {
wchar_t ageInstName[kMaxAgeNameLength];
wchar_t ageUserName[kMaxAgeNameLength];
wchar_t ageDesc[1024];
uint32_t ageSequenceNumber;
uint32_t ageLanguage;
uint32_t population; // only used with GetPublicAgeList query results
uint32_t currentPopulation; // only used with GetPublicAgeList query results
uint32_t ageSequenceNumber;
uint32_t ageLanguage;
uint32_t population; // only used with GetPublicAgeList query results
uint32_t currentPopulation; // only used with GetPublicAgeList query results
};
/*****************************************************************************
@ -119,8 +119,8 @@ struct NetAgeInfo {
struct NetGameScore {
unsigned scoreId;
unsigned ownerId;
uint32_t createdTime;
wchar_t gameName[kMaxGameScoreNameLength];
uint32_t createdTime;
plString gameName;
unsigned gameType;
int value;

14
Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt

@ -33,21 +33,13 @@ set(pnUtils_SOURCES
if(WIN32)
set(pnUtils_WIN32
Win32/pnUtW32Misc.cpp
Win32/pnUtW32Str.cpp
)
else()
set(pnUtils_UNIX
Unix/pnUtUxStr.cpp
)
endif()
endif(WIN32)
add_library(pnUtils STATIC ${pnUtils_HEADERS} ${pnUtils_SOURCES}
${pnUtils_UNIX} ${pnUtils_WIN32})
add_library(pnUtils STATIC ${pnUtils_HEADERS} ${pnUtils_SOURCES} ${pnUtils_WIN32})
source_group("Header Files" FILES ${pnUtils_HEADERS})
source_group("Source Files" FILES ${pnUtils_SOURCES})
if(WIN32)
source_group("Win32" FILES ${pnUtils_WIN32})
else()
source_group("Unix" FILES ${pnUtils_UNIX})
endif()
endif(WIN32)

61
Sources/Plasma/NucleusLib/pnUtils/Unix/pnUtUxStr.cpp

@ -1,61 +0,0 @@
/*==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/pnUtils/Private/Unix/pnUtUxStr.cpp
*
***/
#include "../pnUtStr.h"
#ifdef HS_BUILD_FOR_UNIX
#else
// Dummy function to prevent a linker warning complaining about no public symbols if the
// contents of the file get compiled out via pre-processor
void UxStrPreventLNK4221Warning () {
}
#endif

97
Sources/Plasma/NucleusLib/pnUtils/Win32/pnUtW32Str.cpp

@ -1,97 +0,0 @@
/*==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/pnUtils/Private/Win32/pnUtW32Str.cpp
*
***/
#include "../pnUtils.h"
/*****************************************************************************
*
* Exports
*
***/
//===========================================================================
unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars) {
return StrToAnsi(dest, source, destChars, CP_ACP);
}
//===========================================================================
unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars, unsigned codePage) {
ASSERT(destChars != (unsigned)-1);
ASSERT(dest != nil);
int result = WideCharToMultiByte(codePage, 0, source, -1, dest, destChars, nil, nil);
if (result)
return result - 1; // return number of characters not including null terminator
else if (destChars) {
dest[destChars - 1] = 0; // null terminate the destination buffer
return destChars - 1;
}
else
return 0;
}
//===========================================================================
unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars) {
return StrToUnicode(dest, source, destChars, CP_ACP);
}
//===========================================================================
unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars, unsigned codePage) {
ASSERT(destChars != (unsigned)-1);
ASSERT(dest != nil);
int result = MultiByteToWideChar(codePage, 0, source, -1, dest, destChars);
if (result)
return result - 1; // return number of characters not including null terminator
else if (destChars) {
dest[destChars - 1] = 0; // null terminate the destination buffer
return destChars - 1;
}
else
return 0;
}

164
Sources/Plasma/NucleusLib/pnUtils/pnUtStr.cpp

@ -98,17 +98,6 @@ static chartype * IStrDup (const chartype str[]) {
return buffer;
}
//===========================================================================
template<class chartype>
static chartype * IStrDupLen (const chartype str[], unsigned chars) {
unsigned len = IStrLen(str) + 1;
if (len > chars)
len = chars;
chartype * buffer = (chartype *)malloc(len * sizeof(chartype));
IStrCopy(buffer, str, len);
return buffer;
}
//===========================================================================
template<class chartype, class findchartype>
static chartype * IStrChr (chartype * str, findchartype ch, unsigned chars) {
@ -120,60 +109,6 @@ static chartype * IStrChr (chartype * str, findchartype ch, unsigned chars) {
return nil;
}
//===========================================================================
static inline bool ICharUnicodeToUtf8 (char ** dest, const wchar_t * source[], unsigned destChars) {
unsigned ch = *(*source)++;
bool result = false;
if (ch < 0x80) {
if (destChars >= 1) {
*(*dest)++ = (char)ch;
result = true;
}
}
else if (ch < 0x800) {
if (destChars >= 2) {
*(*dest)++ = (char)(0xc0 | (ch >> 6));
*(*dest)++ = (char)(0x80 | (ch & 0x3f));
result = true;
}
}
else {
if (destChars >= 3) {
*(*dest)++ = (char)(0xe0 | (ch >> 12));
*(*dest)++ = (char)(0x80 | ((ch >> 6) & 0x3f));
*(*dest)++ = (char)(0x80 | (ch & 0x3f));
result = true;
}
}
return result;
}
//===========================================================================
static inline void ICharUtf8ToUnicode (wchar_t ** dest, const char * source[]) {
unsigned result, remaining;
if ((**source & 0xf0) == 0xe0) {
result = *(*source)++ & 0x0f;
remaining = 2;
}
else if ((**source & 0xe0) == 0xc0) {
result = *(*source)++ & 0x1f;
remaining = 1;
}
else if ((**source & 0x80) == 0x00) {
result = *(*source)++;
remaining = 0;
}
else {
// unsupported code sequence (>0xffff)
++(*source);
return;
}
for (; remaining-- && *source; ++*source)
if ((**source & 0xc0) == 0x80)
result = (result << 6) | (**source & 0x3f);
*(*dest)++ = (wchar_t)result;
}
//===========================================================================
template<typename chartype>
static unsigned IStrPrintfValidate (chartype * dest, unsigned count, int result) {
@ -214,39 +149,6 @@ static int IStrCmpI (const chartype str1[], const chartype str2[], unsigned char
return 0;
}
//===========================================================================
template<class chartype>
static void IStrPack (chartype * dest, const chartype source[], unsigned chars) {
while ((chars > 1) && *dest) {
--chars;
++dest;
}
while ((chars > 1) && ((*dest = *source++) != 0)) {
--chars;
++dest;
}
if (chars)
*dest = 0;
}
//===========================================================================
template<class chartype>
static chartype * IStrStr (chartype source[], const chartype match[]) {
if (!*match)
return source;
for (chartype * curr = source; *curr; ++curr) {
chartype * s1 = curr;
const chartype * s2 = match;
while (*s1 && *s2 && *s1 == *s2)
s1++, s2++;
if (!*s2)
return curr;
}
return nil;
}
//===========================================================================
template<class chartype>
static uint32_t IStrHash (const chartype str[], unsigned chars) {
@ -374,42 +276,6 @@ wchar_t * StrDup (const wchar_t str[]) {
return IStrDup(str);
}
//===========================================================================
char * StrDupLen (const char str[], unsigned chars) {
return IStrDupLen(str, chars);
}
//===========================================================================
wchar_t * StrDupLen (const wchar_t str[], unsigned chars) {
return IStrDupLen(str, chars);
}
//============================================================================
wchar_t * StrDupToUnicode (const char str[]) {
unsigned bytes = StrBytes(str) * sizeof(wchar_t);
wchar_t * dst = (wchar_t*)malloc(bytes);
StrToUnicode(dst, str, bytes / sizeof(wchar_t));
return dst;
}
//============================================================================
char * StrDupToAnsi (const wchar_t str[]) {
unsigned bytes = StrBytes(str) / sizeof(wchar_t);
char * dst = (char*)malloc(bytes);
StrToAnsi(dst, str, bytes);
return dst;
}
//===========================================================================
unsigned StrBytes (const char str[]) { // includes space for terminator
return (IStrLen(str) + 1) * sizeof(str[0]);
}
//===========================================================================
unsigned StrBytes (const wchar_t str[]) { // includes space for terminator
return (IStrLen(str) + 1) * sizeof(str[0]);
}
//===========================================================================
char * StrChr (char * str, char ch, unsigned chars) {
return IStrChr(str, ch, chars);
@ -490,36 +356,6 @@ void StrCopy (wchar_t * dest, const wchar_t source[], unsigned chars) {
IStrCopy(dest, source, chars);
}
//===========================================================================
void StrPack (char * dest, const char source[], unsigned chars) {
IStrPack(dest, source, chars);
}
//===========================================================================
void StrPack (wchar_t * dest, const wchar_t source[], unsigned chars) {
IStrPack(dest, source, chars);
}
//===========================================================================
char * StrStr (char * source, const char match[]) {
return IStrStr(source, match);
}
//===========================================================================
const char * StrStr (const char source[], const char match[]) {
return IStrStr<const char>(source, match);
}
//===========================================================================
wchar_t * StrStr (wchar_t * source, const wchar_t match[]) {
return IStrStr(source, match);
}
//===========================================================================
const wchar_t * StrStr (const wchar_t source[], const wchar_t match[]) {
return IStrStr<const wchar_t>(source, match);
}
//===========================================================================
unsigned StrLen (const char str[]) {
return IStrLen(str);

30
Sources/Plasma/NucleusLib/pnUtils/pnUtStr.h

@ -57,7 +57,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifdef _INC_SHLWAPI
# undef StrChr
# undef StrDup
# undef StrStr
#endif // _INC_SHLWAPI
/*****************************************************************************
@ -69,9 +68,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
inline char CharLowerFast (char ch) { return ((ch >= 'A') && (ch <= 'Z')) ? (char )(ch + 'a' - 'A') : ch; }
inline wchar_t CharLowerFast (wchar_t ch) { return ((ch >= L'A') && (ch <= L'Z')) ? (wchar_t)(ch + L'a' - L'A') : ch; }
unsigned StrBytes (const char str[]); // includes space for terminator
unsigned StrBytes (const wchar_t str[]); // includes space for terminator
char * StrChr (char * str, char ch, unsigned chars = (unsigned)-1);
wchar_t * StrChr (wchar_t * str, wchar_t ch, unsigned chars = (unsigned)-1);
const char * StrChr (const char str[], char ch, unsigned chars = (unsigned)-1);
@ -89,41 +85,15 @@ unsigned StrLen (const wchar_t str[]);
char * StrDup (const char str[]);
wchar_t * StrDup (const wchar_t str[]);
char * StrDupLen (const char str[], unsigned chars);
wchar_t * StrDupLen (const wchar_t str[], unsigned chars);
wchar_t * StrDupToUnicode (const char str[]);
char * StrDupToAnsi (const wchar_t str[]);
int StrCmp (const char str1[], const char str2[], unsigned chars = (unsigned)-1);
int StrCmp (const wchar_t str1[], const wchar_t str2[], unsigned chars = (unsigned)-1);
int StrCmpI (const char str1[], const char str2[], unsigned chars = (unsigned)-1);
int StrCmpI (const wchar_t str1[], const wchar_t str2[], unsigned chars = (unsigned)-1);
char * StrStr (char * source, const char match[]);
const char * StrStr (const char source[], const char match[]);
wchar_t * StrStr (wchar_t * source, const wchar_t match[]);
const wchar_t * StrStr (const wchar_t source[], const wchar_t match[]);
void StrCopy (char * dest, const char source[], unsigned chars);
void StrCopy (wchar_t * dest, const wchar_t source[], unsigned chars);
void StrPack (char * dest, const char source[], unsigned chars);
void StrPack (wchar_t * dest, const wchar_t source[], unsigned chars);
unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars);
unsigned StrToAnsi (char * dest, const wchar_t source[], unsigned destChars, unsigned codePage);
unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars);
unsigned StrToUnicode (wchar_t * dest, const char source[], unsigned destChars, unsigned codePage);
// FIXME: Get rid of these
inline unsigned StrToUnicode(wchar_t * dest, const plString & source, unsigned destChars)
{ return StrToUnicode(dest, source.c_str(), destChars); }
inline unsigned StrToUnicode(wchar_t * dest, const plString & source, unsigned destChars, unsigned codePage)
{ return StrToUnicode(dest, source.c_str(), destChars, codePage); }
float StrToFloat (const char source[], const char ** endptr);
float StrToFloat (const wchar_t source[], const wchar_t ** endptr);

54
Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.cpp

@ -171,13 +171,13 @@ bool plAgeLoader::MsgReceive(plMessage* msg)
// return false on error
//
//============================================================================
bool plAgeLoader::LoadAge(const char ageName[])
bool plAgeLoader::LoadAge(const plString& ageName)
{
return ILoadAge(ageName);
}
//============================================================================
void plAgeLoader::UpdateAge(const char ageName[])
void plAgeLoader::UpdateAge(const plString& ageName)
{
plResPatcher::GetInstance()->Update(ageName);
}
@ -199,14 +199,14 @@ void plAgeLoader::NotifyAgeLoaded( bool loaded )
//// ILoadAge ////////////////////////////////////////////////////////////////
// Does the loading-specific stuff for queueing an age to load
bool plAgeLoader::ILoadAge(const char ageName[])
bool plAgeLoader::ILoadAge(const plString& ageName)
{
plNetClientApp* nc = plNetClientApp::GetInstance();
ASSERT(!nc->GetFlagsBit(plNetClientApp::kPlayingGame));
StrCopy(fAgeName, ageName, arrsize(fAgeName));
nc->DebugMsg( "Net: Loading age %s", fAgeName);
fAgeName = ageName;
nc->DebugMsg( "Net: Loading age %s", fAgeName.c_str());
if ((fFlags & kLoadMask) != 0)
ErrorAssert(__LINE__, __FILE__, "Fatal Error:\nAlready loading or unloading an age.\n%s will now exit.",
@ -227,20 +227,15 @@ bool plAgeLoader::ILoadAge(const char ageName[])
/// Step 2: Load the keys for this age, so we can find sceneNodes for them
// exec age .fni file when data is done loading
char consoleIniName[ 256 ];
sprintf( consoleIniName, "dat\\%s.fni", fAgeName);
fPendingAgeFniFiles.push_back( consoleIniName );
fPendingAgeFniFiles.emplace_back(plFormat("dat\\{}.fni", fAgeName));
fPendingAgeCsvFiles.emplace_back(plFormat("dat\\{}.csv", fAgeName));
char csvName[256];
sprintf(csvName, "dat\\%s.csv", fAgeName);
fPendingAgeCsvFiles.push_back(csvName);
plSynchEnabler p( false ); // turn off dirty tracking while in this function
hsStream* stream=GetAgeDescFileStream(fAgeName);
if (!stream)
{
nc->ErrorMsg("Failed loading age. Age desc file %s has nil stream", fAgeName);
nc->ErrorMsg("Failed loading age. Age desc file %s has nil stream", fAgeName.c_str());
fFlags &= ~kLoadingAge;
return false;
}
@ -329,13 +324,13 @@ class plUnloadAgeCollector : public plRegistryPageIterator
{
public:
hsTArray<plRegistryPageNode *> fPages;
const char *fAge;
plUnloadAgeCollector( const char *a ) : fAge( a ) {}
const plString fAge;
plUnloadAgeCollector(const plString& a) : fAge( a ) {}
virtual bool EatPage( plRegistryPageNode *page )
{
if( fAge && page->GetPageInfo().GetAge().CompareI(fAge) == 0 )
if ( !fAge.IsEmpty() && page->GetPageInfo().GetAge().CompareI(fAge) == 0 )
{
fPages.Append( page );
}
@ -351,7 +346,7 @@ class plUnloadAgeCollector : public plRegistryPageIterator
bool plAgeLoader::IUnloadAge()
{
plNetClientApp* nc = plNetClientApp::GetInstance();
nc->DebugMsg( "Net: Unloading age %s", fAgeName);
nc->DebugMsg( "Net: Unloading age %s", fAgeName.c_str());
hsAssert( (fFlags & kLoadMask)==0, "already loading or unloading an age?");
fFlags |= kUnLoadingAge;
@ -362,7 +357,7 @@ bool plAgeLoader::IUnloadAge()
// Note: instead of going from the .age file, we just want a list of what
// is REALLY paged in for this age. So ask the resMgr!
plUnloadAgeCollector collector( fAgeName);
plUnloadAgeCollector collector(fAgeName);
// WARNING: unsafe cast here, but it's ok, until somebody is mean and makes a non-plResManager resMgr
( (plResManager *)hsgResMgr::ResMgr() )->IterateAllPages( &collector );
@ -413,7 +408,7 @@ void plAgeLoader::ExecPendingAgeFniFiles()
int i;
for (i=0;i<PendingAgeFniFiles().size(); i++)
{
plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kExecuteFile, fPendingAgeFniFiles[i].c_str() );
plConsoleMsg *cMsg = new plConsoleMsg( plConsoleMsg::kExecuteFile, fPendingAgeFniFiles[i].AsString().c_str() );
plgDispatch::MsgSend( cMsg );
}
fPendingAgeFniFiles.clear();
@ -424,7 +419,7 @@ void plAgeLoader::ExecPendingAgeCsvFiles()
int i;
for (i=0;i<PendingAgeCsvFiles().size(); i++)
{
hsStream* stream = plEncryptedStream::OpenEncryptedFile(fPendingAgeCsvFiles[i].c_str());
hsStream* stream = plEncryptedStream::OpenEncryptedFile(fPendingAgeCsvFiles[i].AsString().c_str());
if (stream)
{
plRelevanceMgr::Instance()->ParseCsvInput(stream);
@ -439,21 +434,18 @@ void plAgeLoader::ExecPendingAgeCsvFiles()
// return alloced stream or nil
// static
//
hsStream* plAgeLoader::GetAgeDescFileStream(const char* ageName)
hsStream* plAgeLoader::GetAgeDescFileStream(const plString& ageName)
{
if (!ageName)
return nil;
if (ageName.IsEmpty())
return nullptr;
char ageDescFileName[256];
sprintf(ageDescFileName, "dat\\%s.age", ageName);
plFileName ageDescFileName = plFormat("dat\\{}.age", ageName);
hsStream* stream = plEncryptedStream::OpenEncryptedFile(ageDescFileName);
if (!stream)
{
char str[256];
sprintf(str, "Can't find age desc file %s", ageDescFileName);
hsAssert(false, str);
return nil;
hsAssert(false, plFormat("Can't find age desc file {}", ageDescFileName).c_str());
return nullptr;
}
return stream;

32
Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoader.h

@ -68,7 +68,7 @@ class plAgeLoader : public hsKeyedObject
friend class plNetClientJoinTask;
private:
typedef std::vector<plKey> plKeyVec;
typedef std::vector<std::string> plStringVec;
typedef std::vector<plFileName> plFileNameVec;
enum Flags
{
@ -80,15 +80,15 @@ private:
static plAgeLoader* fInstance;
uint32_t fFlags;
plStringVec fPendingAgeFniFiles; // list of age .fni files to be parsed
plStringVec fPendingAgeCsvFiles; // list of age .csv files to be parsed
plFileNameVec fPendingAgeFniFiles; // list of age .fni files to be parsed
plFileNameVec fPendingAgeCsvFiles; // list of age .csv files to be parsed
plKeyVec fPendingPageIns; // keys of rooms which are currently being paged in.
plKeyVec fPendingPageOuts; // keys of rooms which are currently being paged out.
plAgeDescription fCurAgeDescription;
plStateDataRecord* fInitialAgeState;
char fAgeName[kMaxAgeNameLength];
bool ILoadAge(const char ageName[]);
plString fAgeName;
bool ILoadAge(const plString& ageName);
bool IUnloadAge();
void ISetInitialAgeState(plStateDataRecord* s); // sent from server with joinAck
const plStateDataRecord* IGetInitialAgeState() const { return fInitialAgeState; }
@ -102,21 +102,21 @@ public:
static plAgeLoader* GetInstance();
static void SetInstance(plAgeLoader* inst);
static hsStream* GetAgeDescFileStream(const char* ageName);
static hsStream* GetAgeDescFileStream(const plString& ageName);
void Init();
void Shutdown();
bool MsgReceive(plMessage* msg);
bool LoadAge(const char ageName[]);
bool LoadAge(const plString& ageName);
bool UnloadAge() { return IUnloadAge(); }
void UpdateAge(const char ageName[]);
void UpdateAge(const plString& ageName);
void NotifyAgeLoaded( bool loaded );
const plKeyVec& PendingPageOuts() const { return fPendingPageOuts; }
const plKeyVec& PendingPageIns() const { return fPendingPageIns; }
const plStringVec& PendingAgeCsvFiles() const { return fPendingAgeCsvFiles; }
const plStringVec& PendingAgeFniFiles() const { return fPendingAgeFniFiles; }
const plFileNameVec& PendingAgeCsvFiles() const { return fPendingAgeCsvFiles; }
const plFileNameVec& PendingAgeFniFiles() const { return fPendingAgeFniFiles; }
void AddPendingPageInRoomKey(plKey r);
bool RemovePendingPageInRoomKey(plKey r);
bool IsPendingPageInRoomKey(plKey p, int* idx=nil);
@ -126,12 +126,12 @@ public:
// Fun debugging exclude commands (to prevent certain pages from loading)
void ClearPageExcludeList( void );
void AddExcludedPage( const char *pageName, const char *ageName = nil );
bool IsPageExcluded( const plAgePage *page, const char *ageName = nil );
void AddExcludedPage( const plString& pageName, const plString& ageName = "" );
bool IsPageExcluded( const plAgePage *page, const plString& ageName = "" );
const plAgeDescription &GetCurrAgeDesc( void ) const { return fCurAgeDescription; }
// paging
// paging
void FinishedPagingInRoom(plKey* rmKey, int numRms); // call when finished paging in/out a room
void StartPagingOutRoom(plKey* rmKey, int numRms); // call when starting to page in/out a room
void FinishedPagingOutRoom(plKey* rmKey, int numRms);

38
Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoaderPaging.cpp

@ -259,42 +259,28 @@ bool plAgeLoader::RemovePendingPageInRoomKey(plKey pKey)
class plExcludePage
{
public:
char *fPageName;
char *fAgeName;
plString fPageName;
plString fAgeName;
plExcludePage() { fPageName = nil; fAgeName = nil; }
plExcludePage( char *p, char *a )
{
fPageName = p;
fAgeName = a;
}
plExcludePage() { }
plExcludePage(const plString& p, const plString& a)
: fPageName(p), fAgeName(a)
{ }
};
static hsTArray<plExcludePage> sExcludeList;
void plAgeLoader::ClearPageExcludeList( void )
{
int i;
for( i = 0; i < sExcludeList.GetCount(); i++ )
{
delete [] sExcludeList[ i ].fPageName;
delete [] sExcludeList[ i ].fAgeName;
}
sExcludeList.Reset();
}
void plAgeLoader::AddExcludedPage( const char *pageName, const char *ageName )
void plAgeLoader::AddExcludedPage( const plString& pageName, const plString& ageName )
{
char *p = hsStrcpy( pageName );
char *a = nil;
if( ageName != nil )
a = hsStrcpy( ageName );
sExcludeList.Append( plExcludePage( p, a ) );
sExcludeList.Append( plExcludePage( pageName, ageName ) );
}
bool plAgeLoader::IsPageExcluded( const plAgePage *page, const char *ageName )
bool plAgeLoader::IsPageExcluded( const plAgePage *page, const plString& ageName )
{
// check page flags
if (page->GetFlags() & plAgePage::kPreventAutoLoad)
@ -307,8 +293,8 @@ bool plAgeLoader::IsPageExcluded( const plAgePage *page, const char *ageName
{
if( pageName.CompareI( sExcludeList[ i ].fPageName ) == 0 )
{
if( ageName == nil || sExcludeList[ i ].fAgeName == nil ||
stricmp( ageName, sExcludeList[ i ].fAgeName ) == 0 )
if( ageName.IsEmpty() || sExcludeList[ i ].fAgeName.IsEmpty() ||
ageName.CompareI(sExcludeList[ i ].fAgeName) == 0 )
{
return true;
}

4
Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp

@ -226,7 +226,7 @@ void plNCAgeJoiner::Start () {
// if we're linking to startup then set the OfflineAge flag
// so we by-pass the game server
if (StrLen(age.ageDatasetName) == 0 || StrCmpI(age.ageDatasetName, "StartUp") == 0) {
if (age.ageDatasetName.IsEmpty() || age.ageDatasetName.CompareI("StartUp") == 0) {
nc->SetFlagsBit(plNetClientApp::kLinkingToOfflineAge);
// no need to update if we're not using a GameSrv
@ -276,7 +276,7 @@ void plNCAgeJoiner::ExecNextOp () {
case kLoadPlayer: {
LogMsg(kLogPerf, L"AgeJoiner: Exec:kLoadPlayer");
// Start loading local player
const char * avatarName;
plString avatarName;
if (NetCommNeedToLoadAvatar()) {
if (nc->GetFlagsBit(plNetClientApp::kLinkingToOfflineAge))
avatarName = "Male";

27
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp

@ -1007,12 +1007,11 @@ bool plNetClientMgr::MsgReceive( plMessage* msg )
}
// if we're linking to startup we don't need (or want) a player set
char ageName[kMaxAgeNameLength];
StrCopy(ageName, NetCommGetStartupAge()->ageDatasetName, arrsize(ageName));
if (!StrLen(ageName))
StrCopy(ageName, "StartUp", arrsize(ageName));
if (0 == StrCmpI(ageName, "StartUp"))
NetCommSetActivePlayer(0, nil);
plString ageName = NetCommGetStartupAge()->ageDatasetName;
if (ageName.IsEmpty())
ageName = "StartUp";
if (ageName.CompareI("StartUp") == 0)
NetCommSetActivePlayer(0, nullptr);
plAgeLinkStruct link;
link.GetAgeInfo()->SetAgeFilename(NetCommGetStartupAge()->ageDatasetName);
@ -1084,9 +1083,9 @@ bool plNetClientMgr::CanSendMsg(plNetMessage * msg)
plString plNetClientMgr::GetPlayerName(const plKey avKey) const
{
// local case
if (!avKey || avKey==GetLocalPlayerKey())
return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi);
if (!avKey || avKey == GetLocalPlayerKey())
return NetCommGetPlayer()->playerName;
plNetTransportMember* mbr=TransportMgr().GetMember(TransportMgr().FindMember(avKey));
return mbr ? mbr->GetPlayerName() : plString::Null;
}
@ -1094,15 +1093,15 @@ plString plNetClientMgr::GetPlayerName(const plKey avKey) const
plString plNetClientMgr::GetPlayerNameById (unsigned playerId) const {
// local case
if (NetCommGetPlayer()->playerInt == playerId)
return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi);
return NetCommGetPlayer()->playerName;
plNetTransportMember * mbr = TransportMgr().GetMember(TransportMgr().FindMember(playerId));
return mbr ? mbr->GetPlayerName() : plString::Null;
}
unsigned plNetClientMgr::GetPlayerIdByName (const plString & name) const {
// local case
if (0 == name.Compare(NetCommGetPlayer()->playerNameAnsi))
if (name.CompareI(NetCommGetPlayer()->playerName) == 0)
return NetCommGetPlayer()->playerInt;
unsigned n = TransportMgr().GetNumMembers();
@ -1365,9 +1364,9 @@ bool plNetClientMgr::IFindModifier(plSynchedObject* obj, int16_t classIdx)
return cnt==0 ? false : true;
}
plUoid plNetClientMgr::GetAgeSDLObjectUoid(const char* ageName) const
plUoid plNetClientMgr::GetAgeSDLObjectUoid(const plString& ageName) const
{
hsAssert(ageName, "nil ageName");
hsAssert(!ageName.IsEmpty(), "nil ageName");
// if age sdl hook is loaded
if (fAgeSDLObjectKey)

2
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h

@ -356,7 +356,7 @@ public:
void AddPendingLoad(PendingLoad *pl);
const plKey& GetAgeSDLObjectKey() const { return fAgeSDLObjectKey; }
plUoid GetAgeSDLObjectUoid(const char* ageName) const;
plUoid GetAgeSDLObjectUoid(const plString& ageName) const;
plNetClientComm& GetNetClientComm() { return fNetClientComm; }
plString GetNextAgeFilename() const;
void SetOverrideAgeTimeOfDayPercent(float f) { fOverrideAgeTimeOfDayPercent=f; }

8
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp

@ -155,7 +155,7 @@ void plNetClientMgr::ISendCCRPetition(plCCRPetitionMsg* petMsg)
info.AddValue( "Petition", "Content", note );
info.AddValue( "Petition", "Title", title );
info.AddValue( "Petition", "Language", plLocalization::GetLanguageName( plLocalization::GetLanguage() ) );
info.AddValue( "Petition", "AcctName", NetCommGetAccount()->accountNameAnsi );
info.AddValue( "Petition", "AcctName", NetCommGetAccount()->accountName.c_str() );
char buffy[20];
sprintf(buffy, "%u", GetPlayerID());
info.AddValue( "Petition", "PlayerID", buffy );
@ -170,10 +170,8 @@ void plNetClientMgr::ISendCCRPetition(plCCRPetitionMsg* petMsg)
std::string buf;
buf.resize( size );
ram.CopyToMem( (void*)buf.data() );
wchar_t * wStr = StrDupToUnicode(buf.c_str());
NetCliAuthSendCCRPetition(wStr);
free(wStr);
NetCliAuthSendCCRPetition(buf.c_str());
}
//

16
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -434,11 +434,7 @@ void plNetLinkingMgr::IDoLink(plLinkToAgeMsg* msg)
NlmJoinAgeOp * joinAgeOp = new NlmJoinAgeOp;
joinAgeOp->age.ageInstId = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid();
joinAgeOp->muteSfx = !msg->PlayLinkInSfx();
StrCopy(
joinAgeOp->age.ageDatasetName,
GetAgeLink()->GetAgeInfo()->GetAgeFilename().c_str(),
arrsize(joinAgeOp->age.ageDatasetName)
);
joinAgeOp->age.ageDatasetName = GetAgeLink()->GetAgeInfo()->GetAgeFilename();
StrCopy(
joinAgeOp->age.spawnPtName,
GetAgeLink()->SpawnPoint().GetName().c_str(),
@ -1069,14 +1065,10 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
case plNetCommon::LinkingRules::kChildAgeBook:
{
plAgeLinkStruct childLink;
wchar_t parentAgeName[MAX_PATH];
if (link->HasParentAgeFilename())
StrToUnicode(parentAgeName, link->GetParentAgeFilename(), arrsize(parentAgeName));
switch(VaultAgeFindOrCreateChildAgeLink(
(link->HasParentAgeFilename() ? parentAgeName : nil),
info,
&childLink))
link->GetParentAgeFilename(),
info,
&childLink))
{
case static_cast<uint8_t>(hsFail):
success = kLinkFailed;

141
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -111,19 +111,19 @@ static bool s_loginComplete = false;
static bool s_hasAuthSrvIpAddress = false;
static bool s_hasFileSrvIpAddress = false;
static ENetError s_authResult = kNetErrAuthenticationFailed;
static char s_authSrvAddr[256];
static char s_fileSrvAddr[256];
static plString s_authSrvAddr;
static plString s_fileSrvAddr;
static char s_iniServerAddr[256];
static char s_iniFileServerAddr[256];
static wchar_t s_iniAccountUsername[kMaxAccountNameLength];
static plString s_iniAccountUsername;
static ShaDigest s_namePassHash;
static wchar_t s_iniAuthToken[kMaxPublisherAuthKeyLength];
static wchar_t s_iniOS[kMaxGTOSIdLength];
static bool s_iniReadAccountInfo = true;
static wchar_t s_iniStartupAgeName[kMaxAgeNameLength];
static plString s_iniStartupAgeName;
static plUUID s_iniStartupAgeInstId;
static wchar_t s_iniStartupPlayerName[kMaxPlayerNameLength];
static plString s_iniStartupPlayerName;
static bool s_netError = false;
@ -392,10 +392,8 @@ static void INetCliAuthLoginRequestCallback (
s_player = nil;
s_players.Clear();
bool wantsStartUpAge = (
!StrLen(s_startupAge.ageDatasetName) ||
0 == StrCmpI(s_startupAge.ageDatasetName, "StartUp")
);
bool wantsStartUpAge = (s_startupAge.ageDatasetName.IsEmpty() ||
s_startupAge.ageDatasetName.CompareI("StartUp") == 0);
s_loginComplete = true;
@ -405,13 +403,12 @@ static void INetCliAuthLoginRequestCallback (
s_account.billingType = billingType;
s_players.GrowToCount(playerCount, true);
for (unsigned i = 0; i < playerCount; ++i) {
LogMsg(kLogDebug, L"Player %u: %s explorer: %u", playerInfoArr[i].playerInt, playerInfoArr[i].playerName, playerInfoArr[i].explorer);
s_players[i].playerInt = playerInfoArr[i].playerInt;
s_players[i].explorer = playerInfoArr[i].explorer;
StrCopy(s_players[i].playerName, playerInfoArr[i].playerName, arrsize(s_players[i].playerName));
StrToAnsi(s_players[i].playerNameAnsi, playerInfoArr[i].playerName, arrsize(s_players[i].playerNameAnsi));
StrToAnsi(s_players[i].avatarDatasetName, playerInfoArr[i].avatarShape, arrsize(s_players[i].avatarDatasetName));
if (!wantsStartUpAge && 0 == StrCmpI(s_players[i].playerName, s_iniStartupPlayerName, (unsigned)-1))
LogMsg(kLogDebug, L"Player %u: %S explorer: %u", playerInfoArr[i].playerInt, playerInfoArr[i].playerName.c_str(), playerInfoArr[i].explorer);
s_players[i].playerInt = playerInfoArr[i].playerInt;
s_players[i].explorer = playerInfoArr[i].explorer;
s_players[i].playerName = playerInfoArr[i].playerName;
s_players[i].avatarDatasetName = playerInfoArr[i].avatarShape;
if (!wantsStartUpAge && s_players[i].playerName.CompareI(s_iniStartupPlayerName) == 0)
s_player = &s_players[i];
}
@ -424,7 +421,7 @@ static void INetCliAuthLoginRequestCallback (
// If they specified an alternate age, but we couldn't find the player, force
// the StartUp age to load so that they may select/create a player first.
if (!wantsStartUpAge && !s_player)
StrCopy(s_startupAge.ageDatasetName, "StartUp", arrsize(s_startupAge.ageDatasetName));
s_startupAge.ageDatasetName = "StartUp";
// If they specified an alternate age, and we found the player, set the active player now
// so that the link operation will be successful once the client is finished initializing.
@ -447,16 +444,15 @@ static void INetCliAuthCreatePlayerRequestCallback (
LogMsg(kLogDebug, L"Create player failed: %s", NetErrorToString(result));
}
else {
LogMsg(kLogDebug, L"Created player %s: %u", playerInfo.playerName, playerInfo.playerInt);
LogMsg(kLogDebug, L"Created player %S: %u", playerInfo.playerName.c_str(), playerInfo.playerInt);
unsigned currPlayer = s_player ? s_player->playerInt : 0;
unsigned currPlayer = s_player ? s_player->playerInt : 0;
NetCommPlayer * newPlayer = s_players.New();
newPlayer->playerInt = playerInfo.playerInt;
newPlayer->explorer = playerInfo.explorer;
StrCopy(newPlayer->playerName, playerInfo.playerName, arrsize(newPlayer->playerName));
StrToAnsi(newPlayer->playerNameAnsi, playerInfo.playerName, arrsize(newPlayer->playerNameAnsi));
StrToAnsi(newPlayer->avatarDatasetName, playerInfo.avatarShape, arrsize(newPlayer->avatarDatasetName));
newPlayer->playerInt = playerInfo.playerInt;
newPlayer->explorer = playerInfo.explorer;
newPlayer->playerName = playerInfo.playerName;
newPlayer->avatarDatasetName = playerInfo.avatarShape;
{ for (unsigned i = 0; i < s_players.Count(); ++i) {
if (s_players[i].playerInt == currPlayer) {
@ -655,9 +651,9 @@ static void INetCliAuthSendFriendInviteCallback (
static void AuthSrvIpAddressCallback (
ENetError result,
void * param,
const wchar_t addr[]
const plString& addr
) {
StrToAnsi(s_authSrvAddr, addr, arrsize(s_authSrvAddr));
s_authSrvAddr = addr;
s_hasAuthSrvIpAddress = true;
}
@ -665,9 +661,9 @@ static void AuthSrvIpAddressCallback (
static void FileSrvIpAddressCallback (
ENetError result,
void * param,
const wchar_t addr[]
const plString& addr
) {
StrToAnsi(s_fileSrvAddr, addr, arrsize(s_fileSrvAddr));
s_fileSrvAddr = addr;
s_hasFileSrvIpAddress = true;
}
@ -725,9 +721,7 @@ void NetCommSetAvatarLoaded (bool loaded /* = true */) {
}
//============================================================================
void NetCommChangeMyPassword (
const wchar_t password[]
) {
void NetCommChangeMyPassword (const plString& password) {
NetCliAuthAccountChangePasswordRequest(s_account.accountName, password, INetCliAuthChangePasswordCallback, nil);
}
@ -748,8 +742,8 @@ void NetCommStartup () {
// Set startup age info
memset(&s_startupAge, 0, sizeof(s_startupAge));
StrCopy(s_iniStartupAgeName, L"StartUp", arrsize(s_iniStartupAgeName));
StrCopy(s_startupAge.ageDatasetName, "StartUp", arrsize(s_startupAge.ageDatasetName));
s_iniStartupAgeName = "StartUp";
s_startupAge.ageDatasetName = s_iniStartupAgeName;
s_startupAge.ageInstId = s_iniStartupAgeInstId;
StrCopy(s_startupAge.spawnPtName, "LinkInPointDefault", arrsize(s_startupAge.spawnPtName));
@ -810,18 +804,18 @@ void NetCommUpdate () {
//============================================================================
void NetCommConnect () {
const char** addrs;
const plString* addrs;
unsigned count;
bool connectedToKeeper = false;
// if a console override was specified for a authserv, connect directly to the authserver rather than going through the gatekeeper
if((count = GetAuthSrvHostnames(&addrs)) && strlen(addrs[0]))
if((count = GetAuthSrvHostnames(addrs)) && !addrs[0].IsEmpty())
{
NetCliAuthStartConnect(addrs, count);
}
else
{
count = GetGateKeeperSrvHostnames(&addrs);
count = GetGateKeeperSrvHostnames(addrs);
NetCliGateKeeperStartConnect(addrs, count);
connectedToKeeper = true;
@ -833,7 +827,7 @@ void NetCommConnect () {
AsyncSleep(10);
}
const char* authSrv[] = {
const plString authSrv[] = {
s_authSrvAddr
};
NetCliAuthStartConnect(authSrv, 1);
@ -842,14 +836,14 @@ void NetCommConnect () {
if (!gDataServerLocal) {
// if a console override was specified for a filesrv, connect directly to the fileserver rather than going through the gatekeeper
if((count = GetFileSrvHostnames(&addrs)) && strlen(addrs[0]))
if((count = GetFileSrvHostnames(addrs)) && !addrs[0].IsEmpty())
{
NetCliFileStartConnect(addrs, count);
}
else
{
if (!connectedToKeeper) {
count = GetGateKeeperSrvHostnames(&addrs);
count = GetGateKeeperSrvHostnames(addrs);
NetCliGateKeeperStartConnect(addrs, count);
connectedToKeeper = true;
}
@ -862,7 +856,7 @@ void NetCommConnect () {
AsyncSleep(10);
}
const char* fileSrv[] = {
const plString fileSrv[] = {
s_fileSrvAddr
};
NetCliFileStartConnect(fileSrv, 1);
@ -1011,10 +1005,10 @@ void NetCommSetMsgPreHandler (
//============================================================================
void NetCommSetAccountUsernamePassword (
const wchar_t username[],
const plString& username,
const ShaDigest & namePassHash
) {
StrCopy(s_iniAccountUsername, username, arrsize(s_iniAccountUsername));
s_iniAccountUsername = username;
memcpy(s_namePassHash, namePassHash, sizeof(ShaDigest));
s_iniReadAccountInfo = false;
@ -1047,16 +1041,7 @@ void NetCommAuthenticate (
) {
s_loginComplete = false;
StrCopy(
s_account.accountName,
s_iniAccountUsername,
arrsize(s_account.accountName)
);
StrToAnsi(
s_account.accountNameAnsi,
s_iniAccountUsername,
arrsize(s_account.accountNameAnsi)
);
s_account.accountName = s_iniAccountUsername;
memcpy(s_account.accountNamePassHash, s_namePassHash, sizeof(ShaDigest));
NetCliAuthLoginRequest(
@ -1085,11 +1070,8 @@ void NetCommLinkToAge ( // --> plNetCommLinkToAgeMsg
return;
}
wchar_t wAgeName[kMaxAgeNameLength];
StrToUnicode(wAgeName, s_age.ageDatasetName, arrsize(wAgeName));
NetCliAuthAgeRequest(
wAgeName,
s_age.ageDatasetName,
s_age.ageInstId,
INetCliAuthAgeRequestCallback,
param
@ -1123,7 +1105,7 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg
s_player = &s_players[i];
break;
}
else if (0 == StrCmpI(s_players[i].playerName, s_iniStartupPlayerName, arrsize(s_players[i].playerName))) {
else if (s_players[i].playerName.CompareI(s_iniStartupPlayerName) == 0) {
playerInt = s_players[i].playerInt;
s_player = &s_players[i];
}
@ -1140,41 +1122,16 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg
//============================================================================
void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg
const char playerName[],
const char avatarShape[],
const char friendInvite[],
unsigned createFlags,
void * param
) {
wchar_t wplayerName[kMaxPlayerNameLength];
wchar_t wavatarShape[MAX_PATH];
wchar_t wfriendInvite[MAX_PATH];
StrToUnicode(wplayerName, playerName, arrsize(wplayerName));
StrToUnicode(wavatarShape, avatarShape, arrsize(wavatarShape));
StrToUnicode(wfriendInvite, friendInvite, arrsize(wfriendInvite));
NetCliAuthPlayerCreateRequest(
wplayerName,
wavatarShape,
(friendInvite != NULL) ? wfriendInvite : NULL,
INetCliAuthCreatePlayerRequestCallback,
param
);
}
//============================================================================
void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg
const wchar_t playerName[],
const wchar_t avatarShape[],
const wchar_t friendInvite[],
const plString& playerName,
const plString& avatarShape,
const plString& friendInvite,
unsigned createFlags,
void * param
) {
NetCliAuthPlayerCreateRequest(
playerName,
avatarShape,
(friendInvite != NULL) ? friendInvite : NULL,
friendInvite,
INetCliAuthCreatePlayerRequestCallback,
param
);
@ -1197,18 +1154,16 @@ void NetCommDeletePlayer ( // --> plNetCommDeletePlayerMsg
//============================================================================
void NetCommGetPublicAgeList (//-> plNetCommPublicAgeListMsg
const char ageName[],
const plString& ageName,
void * param,
plNetCommReplyMsg::EParamType ptype
) {
NetCommParam * cp = new NetCommParam;
cp->param = param;
cp->type = ptype;
wchar_t wStr[MAX_PATH];
StrToUnicode(wStr, ageName, arrsize(wStr));
NetCliAuthGetPublicAgeList(
wStr,
ageName,
INetCliAuthGetPublicAgeListCallback,
cp
);
@ -1313,8 +1268,8 @@ void NetCommSetCCRLevel (
//============================================================================
void NetCommSendFriendInvite (
const wchar_t emailAddress[],
const wchar_t toName[],
const plString& emailAddress,
const plString& toName,
const plUUID& inviteUuid
) {
NetCliAuthSendFriendInvite(

35
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h

@ -56,6 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h"
#include "pnUtils/pnUtils.h"
#include "pnNetBase/pnNetBase.h"
#include "plString.h"
#include "plNetCommon/plNetServerSessionInfo.h"
#include "plNetCommon/plNetCommonHelpers.h"
#include "plMessage/plNetCommMsgs.h"
@ -72,17 +73,15 @@ class plNetMessage;
struct NetCommPlayer {
unsigned playerInt;
wchar_t playerName[kMaxPlayerNameLength];
char playerNameAnsi[kMaxPlayerNameLength];
char avatarDatasetName[64];
plString playerName;
plString avatarDatasetName;
unsigned explorer;
};
struct NetCommAccount {
plUUID accountUuid;
wchar_t accountName[kMaxAccountNameLength];
plString accountName;
ShaDigest accountNamePassHash;
char accountNameAnsi[kMaxAccountNameLength];
unsigned accountFlags;
unsigned billingType;
};
@ -90,12 +89,11 @@ struct NetCommAccount {
struct NetCommAge {
plUUID ageInstId;
unsigned ageVaultId;
char ageDatasetName[kMaxAgeNameLength];
plString ageDatasetName;
char spawnPtName[64];
NetCommAge() : ageVaultId(0)
{
memset(ageDatasetName, 0, sizeof(ageDatasetName));
memset(spawnPtName, 0, sizeof(spawnPtName));
}
};
@ -108,13 +106,13 @@ const ARRAY(NetCommPlayer) & NetCommGetPlayerList ();
unsigned NetCommGetPlayerCount ();
bool NetCommIsLoginComplete ();
void NetCommSetReadIniAccountInfo (bool readFromIni);
void NetCommSetAccountUsernamePassword (const wchar_t username[], const ShaDigest & namePassHash);
void NetCommSetAccountUsernamePassword (const plString& username, const ShaDigest & namePassHash);
void NetCommSetAuthTokenAndOS (wchar_t authToken[], wchar_t os[]);
ENetError NetCommGetAuthResult ();
bool NetCommNeedToLoadAvatar ();
void NetCommSetAvatarLoaded (bool loaded = true);
void NetCommChangeMyPassword (const wchar_t password[]);
void NetCommChangeMyPassword (const plString& password);
void NetCommStartup ();
void NetCommShutdown ();
@ -210,16 +208,9 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg
void * param
);
void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg
const char playerName[],
const char avatarShape[],
const char friendInvite[],
unsigned createFlags,
void * param
);
void NetCommCreatePlayer ( // --> plNetCommCreatePlayerMsg
const wchar_t playerName[],
const wchar_t avatarShape[],
const wchar_t friendInvite[],
const plString& playerName,
const plString& avatarShape,
const plString& friendInvite,
unsigned createFlags,
void * param
);
@ -228,7 +219,7 @@ void NetCommDeletePlayer ( // --> plNetCommDeletePlayerMsg
void * param
);
void NetCommGetPublicAgeList (//-> plNetCommPublicAgeListMsg
const char ageName[],
const plString& ageName,
void * param,
plNetCommReplyMsg::EParamType ptype = plNetCommReplyMsg::kParamTypeOther
);
@ -284,8 +275,8 @@ void NetCommSetCCRLevel (
unsigned ccrLevel
);
void NetCommSendFriendInvite (
const wchar_t emailAddress[],
const wchar_t toName[],
const plString& emailAddress,
const plString& toName,
const plUUID& inviteUuid
);

22
Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp

@ -167,20 +167,14 @@ void plAgeInfoStruct::CopyFrom( const plVaultAgeInfoNode * node )
//============================================================================
void plAgeInfoStruct::CopyFrom(const NetAgeInfo & info) {
char tmp[MAX_PATH];
// Filename
StrToAnsi(tmp, info.ageFilename, arrsize(tmp));
SetAgeFilename(tmp);
// InstanceName
StrToAnsi(tmp, info.ageInstName, arrsize(tmp));
SetAgeInstanceName(tmp);
// UserDefinedName
StrToAnsi(tmp, info.ageUserName, arrsize(tmp));
SetAgeUserDefinedName(tmp);
// Description
StrToAnsi(tmp, info.ageDesc, arrsize(tmp));
SetAgeDescription(tmp);
// Filename
SetAgeFilename(plString::FromWchar(info.ageFilename));
// InstanceName
SetAgeInstanceName(plString::FromWchar(info.ageInstName));
// UserDefinedName
SetAgeUserDefinedName(plString::FromWchar(info.ageUserName));
// Description
SetAgeDescription(plString::FromWchar(info.ageDesc));
plUUID inst(info.ageInstId);
SetAgeInstanceGuid(&inst);

365
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp

@ -91,7 +91,7 @@ struct CliAuConn : hsRefCnt {
LINK(CliAuConn) link;
AsyncSocket sock;
NetCli * cli;
char name[MAX_PATH];
plString name;
plNetAddress addr;
plUUID token;
unsigned seq;
@ -194,14 +194,14 @@ struct LoginRequestTrans : NetAuthTrans {
struct AgeRequestTrans : NetAuthTrans {
FNetCliAuthAgeRequestCallback m_callback;
void * m_param;
wchar_t m_ageName[kMaxAgeNameLength];
plString m_ageName;
unsigned m_ageMcpId;
plUUID m_ageInstId;
unsigned m_ageVaultId;
uint32_t m_gameSrvNode;
AgeRequestTrans (
const wchar_t ageName[],
const plString& ageName,
const plUUID& ageInstId,
FNetCliAuthAgeRequestCallback callback,
void * param
@ -290,19 +290,19 @@ struct PlayerCreateRequestTrans : NetAuthTrans {
FNetCliAuthPlayerCreateRequestCallback m_callback;
void * m_param;
// send
wchar_t m_playerName[kMaxPlayerNameLength];
wchar_t m_avatarShape[MAX_PATH];
wchar_t m_friendInvite[MAX_PATH];
// send
plString m_playerName;
plString m_avatarShape;
plString m_friendInvite;
// recv
NetCliAuthPlayerInfo m_playerInfo;
PlayerCreateRequestTrans (
const wchar_t playerName[],
const wchar_t avatarShape[],
const wchar_t friendInvite[],
const plString& playerName,
const plString& avatarShape,
const plString& friendInvite,
FNetCliAuthPlayerCreateRequestCallback callback,
void * param
);
@ -400,13 +400,13 @@ struct AccountChangePasswordRequestTrans : NetAuthTrans {
FNetCliAuthAccountChangePasswordRequestCallback m_callback;
void * m_param;
// send
wchar_t m_accountName[kMaxAccountNameLength];
// send
plString m_accountName;
ShaDigest m_namePassHash;
AccountChangePasswordRequestTrans (
const wchar_t accountName[],
const wchar_t password[],
const plString& accountName,
const plString& password,
FNetCliAuthAccountChangePasswordRequestCallback callback,
void * param
);
@ -427,17 +427,17 @@ struct GetPublicAgeListTrans : NetAuthTrans {
void * m_param;
// send
wchar_t m_ageName[MAX_PATH];
plString m_ageName;
// recv
ARRAY(NetAgeInfo) m_ages;
GetPublicAgeListTrans (
const wchar_t ageName[],
const plString& ageName,
FNetCliAuthGetPublicAgeListCallback callback,
void * param
);
bool Send ();
void Post ();
bool Recv (
@ -686,10 +686,10 @@ struct VaultInitAgeTrans : NetAuthTrans {
plUUID m_ageInstId;
plUUID m_parentAgeInstId;
wchar_t * m_ageFilename;
wchar_t * m_ageInstName;
wchar_t * m_ageUserName;
wchar_t * m_ageDesc;
plString m_ageFilename;
plString m_ageInstName;
plString m_ageUserName;
plString m_ageDesc;
unsigned m_ageSequenceNumber;
unsigned m_ageLanguage;
@ -701,10 +701,10 @@ struct VaultInitAgeTrans : NetAuthTrans {
void * param, // optional
const plUUID& ageInstId, // optional. is used in match
const plUUID& parentAgeInstId, // optional. is used in match
const wchar_t ageFilename[], // optional. is used in match
const wchar_t ageInstName[], // optional. not used in match
const wchar_t ageUserName[], // optional. not used in match
const wchar_t ageDesc[], // optional. not used in match
const plString ageFilename, // optional. is used in match
const plString ageInstName, // optional. not used in match
const plString ageUserName, // optional. not used in match
const plString ageDesc, // optional. not used in match
unsigned ageSequenceNumber, // optional. not used in match
unsigned ageLanguage // optional. not used in match
);
@ -942,14 +942,14 @@ struct SendFriendInviteTrans : NetAuthTrans {
FNetCliAuthSendFriendInviteCallback m_callback;
void * m_param;
// send
wchar_t m_emailAddress[kMaxEmailAddressLength];
wchar_t m_toName[kMaxPlayerNameLength];
// send
plString m_emailAddress;
plString m_toName;
plUUID m_inviteUuid;
SendFriendInviteTrans(
const wchar_t emailAddr[],
const wchar_t toName[],
const plString& emailAddr,
const plString& toName,
const plUUID& inviteUuid,
FNetCliAuthSendFriendInviteCallback callback,
void * param
@ -982,17 +982,17 @@ struct ScoreCreateTrans : NetAuthTrans {
// send
unsigned m_ownerId;
char m_gameName[kMaxGameScoreNameLength];
plString m_gameName;
unsigned m_gameType;
int m_value;
// recv
unsigned m_scoreId;
uint32_t m_createdTime;
uint32_t m_createdTime;
ScoreCreateTrans (
unsigned ownerId,
const char* gameName,
const plString& gameName,
unsigned gameType,
int value,
FNetCliAuthCreateScoreCallback callback,
@ -1038,9 +1038,9 @@ struct ScoreGetScoresTrans : NetAuthTrans {
FNetCliAuthGetScoresCallback m_callback;
void * m_param;
// send
// send
unsigned m_ownerId;
char m_gameName[kMaxGameScoreNameLength];
plString m_gameName;
// recv
NetGameScore * m_scores;
@ -1048,7 +1048,7 @@ struct ScoreGetScoresTrans : NetAuthTrans {
ScoreGetScoresTrans (
unsigned ownerId,
const char* gameName,
const plString& gameName,
FNetCliAuthGetScoresCallback callback,
void * param
);
@ -1150,11 +1150,11 @@ struct ScoreGetRanksTrans : NetAuthTrans {
FNetCliAuthGetRanksCallback m_callback;
void * m_param;
// send
// send
unsigned m_ownerId;
unsigned m_scoreGroup;
unsigned m_parentFolderId;
wchar_t m_gameName[kMaxGameScoreNameLength];
plString m_gameName;
unsigned m_timePeriod;
unsigned m_numResults;
unsigned m_pageNumber;
@ -1168,7 +1168,7 @@ struct ScoreGetRanksTrans : NetAuthTrans {
unsigned ownerId,
unsigned scoreGroup,
unsigned parentFolderId,
const char * cGameName,
const plString& gameName,
unsigned timePeriod,
unsigned numResults,
unsigned pageNumber,
@ -1203,7 +1203,7 @@ static bool s_running;
static CCritSect s_critsect;
static LISTDECL(CliAuConn, link) s_conns;
static CliAuConn * s_active;
static wchar_t s_accountName[kMaxAccountNameLength];
static plString s_accountName;
static ShaDigest s_accountNamePassHash;
static wchar_t s_authToken[kMaxPublisherAuthKeyLength];
static wchar_t s_os[kMaxGTOSIdLength];
@ -1231,42 +1231,28 @@ static FNotifyNewBuildHandler s_notifyNewBuildHandler;
***/
//===========================================================================
static inline bool ICharIsSpace (unsigned ch) {
return ch == ' ';
}
static ENetError FixupPlayerName (plString& name) {
ASSERT(!name.IsEmpty());
//===========================================================================
static ENetError FixupPlayerName (wchar_t * name) {
ASSERT(name);
// Trim leading and trailing whitespace and convert
// multiple internal spaces into only one space
unsigned nonSpaceChars = 0;
wchar_t *dst = name;
for (wchar_t *src = name; *src; ) {
// Skip whitespace
while (*src && ICharIsSpace(*src))
src++;
// If the block skipped was not at the beginning
// of the string then add one space character
if (*src && (dst != name))
*dst++ = ' ';
// Copy characters until end-of-string or next whitespace
while (*src && !ICharIsSpace(*src)) {
++nonSpaceChars;
*dst++ = *src++;
}
}
// Trim leading and trailing whitespace
name = name.Trim(" \t\n\r");
// Ensure destination string is terminated
*dst = 0;
// Convert remaining internal whitespace to a single space.
// Kind of hacky, but meh.
std::vector<plString> things = name.Tokenize(" \t\n\r");
// Check for minimum name length
if (nonSpaceChars < 3)
return kNetErrPlayerNameInvalid;
plStringStream ss;
for (auto it = things.begin(); it != things.end(); ++it) {
ss << *it;
if ((it + 1) != things.end())
ss << " ";
}
name = ss.GetString();
// Now, check to see if we have the appropriate length
// We could count the characters, but lazy...
if (name.Replace(" ", "").GetSize() < 3)
return kNetErrPlayerNameInvalid;
return kNetSuccess;
}
@ -1529,7 +1515,7 @@ static void Connect (
//============================================================================
static void Connect (
const char name[],
const plString& name,
const plNetAddress& addr
) {
ASSERT(s_running);
@ -1538,7 +1524,7 @@ static void Connect (
conn->addr = addr;
conn->seq = ConnNextSequence();
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
strncpy(conn->name, name, arrsize(conn->name));
conn->name = name;
conn->Ref("Lifetime");
conn->AutoReconnect();
@ -1594,8 +1580,6 @@ CliAuConn::CliAuConn ()
, sock(nil), cli(nil), seq(0), serverChallenge(0)
, cancelId(nil), abandoned(false)
{
memset(name, 0, sizeof(name));
++s_perf[kPerfConnCount];
}
@ -2613,17 +2597,17 @@ LoginRequestTrans::LoginRequestTrans (
//============================================================================
void LoginRequestTrans::AddPlayer (
unsigned playerInt,
unsigned playerInt,
const wchar_t playerName[],
const wchar_t avatarShape[],
unsigned explorer
unsigned explorer
) {
unsigned index = m_playerCount++;
ASSERT(index < kMaxPlayersPerAccount);
m_players[index].playerInt = playerInt;
m_players[index].explorer = explorer;
StrCopy(m_players[index].playerName, playerName, arrsize(m_players[index].playerName));
StrCopy(m_players[index].avatarShape, avatarShape, arrsize(m_players[index].avatarShape));
m_players[index].playerInt = playerInt;
m_players[index].explorer = explorer;
m_players[index].playerName = plString::FromWchar(playerName);
m_players[index].avatarShape = plString::FromWchar(avatarShape);
}
//============================================================================
@ -2636,7 +2620,7 @@ bool LoginRequestTrans::Send () {
uint32_t clientChallenge = 0;
// Regex search for primary email domain
std::vector<plString> match = plString::FromWchar(s_accountName).RESearch("[^@]+@([^.]+\\.)*([^.]+)\\.[^.]+");
std::vector<plString> match = s_accountName.RESearch("[^@]+@([^.]+\\.)*([^.]+)\\.[^.]+");
if (match.empty() || match[2].CompareI("gametap") == 0) {
memcpy(challengeHash, s_accountNamePassHash, sizeof(ShaDigest));
} else {
@ -2653,11 +2637,13 @@ bool LoginRequestTrans::Send () {
);
}
plStringBuffer<uint16_t> accountName = s_accountName.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_AcctLoginRequest,
m_transId,
clientChallenge,
(uintptr_t) s_accountName,
(uintptr_t) accountName.GetData(),
(uintptr_t) &challengeHash,
(uintptr_t) s_authToken,
(uintptr_t) s_os,
@ -2723,16 +2709,16 @@ bool LoginRequestTrans::Recv (
//============================================================================
AgeRequestTrans::AgeRequestTrans (
const wchar_t ageName[],
const plString& ageName,
const plUUID& ageInstId,
FNetCliAuthAgeRequestCallback callback,
void * param
) : NetAuthTrans(kAgeRequestTrans)
, m_ageName(ageName)
, m_ageInstId(ageInstId)
, m_callback(callback)
, m_param(param)
{
StrCopy(m_ageName, ageName, arrsize(m_ageName));
}
//============================================================================
@ -2744,10 +2730,12 @@ bool AgeRequestTrans::Send () {
if (!AcquireConn())
return true;
plStringBuffer<uint16_t> ageName = m_ageName.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_AgeRequest,
m_transId,
(uintptr_t) m_ageName,
kCli2Auth_AgeRequest,
m_transId,
(uintptr_t) ageName.GetData(),
(uintptr_t) &m_ageInstId,
};
@ -2936,21 +2924,18 @@ bool AccountCreateFromKeyRequestTrans::Recv (
//============================================================================
PlayerCreateRequestTrans::PlayerCreateRequestTrans (
const wchar_t playerName[],
const wchar_t avatarShape[],
const wchar_t friendInvite[],
const plString& playerName,
const plString& avatarShape,
const plString& friendInvite,
FNetCliAuthPlayerCreateRequestCallback callback,
void * param
) : NetAuthTrans(kPlayerCreateRequestTrans)
, m_playerName(playerName)
, m_avatarShape(avatarShape)
, m_friendInvite(friendInvite)
, m_callback(callback)
, m_param(param)
{
StrCopy(m_playerName, playerName, arrsize(m_playerName));
StrCopy(m_avatarShape, avatarShape, arrsize(m_avatarShape));
if (friendInvite)
StrCopy(m_friendInvite, friendInvite, arrsize(m_friendInvite));
else
m_friendInvite[0] = 0;
memset(&m_playerInfo, 0, sizeof(m_playerInfo));
}
@ -2959,16 +2944,20 @@ bool PlayerCreateRequestTrans::Send () {
if (!AcquireConn())
return false;
plStringBuffer<uint16_t> playerName = m_playerName.ToUtf16();
plStringBuffer<uint16_t> avatarShape = m_avatarShape.ToUtf16();
plStringBuffer<uint16_t> friendInvite = m_friendInvite.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_PlayerCreateRequest,
m_transId,
(uintptr_t) m_playerName,
(uintptr_t) m_avatarShape,
(uintptr_t) m_friendInvite,
(uintptr_t) playerName.GetData(),
(uintptr_t) avatarShape.GetData(),
(uintptr_t) friendInvite.GetData(),
};
m_conn->Send(msg, arrsize(msg));
return true;
}
@ -2988,10 +2977,10 @@ bool PlayerCreateRequestTrans::Recv (
) {
const Auth2Cli_PlayerCreateReply & reply = *(const Auth2Cli_PlayerCreateReply *) msg;
if (!IS_NET_ERROR(reply.result)) {
m_playerInfo.playerInt = reply.playerInt;
m_playerInfo.explorer = reply.explorer;
StrCopy(m_playerInfo.playerName, reply.playerName, arrsize(m_playerInfo.playerName));
StrCopy(m_playerInfo.avatarShape, reply.avatarShape, arrsize(m_playerInfo.avatarShape));
m_playerInfo.playerInt = reply.playerInt;
m_playerInfo.explorer = reply.explorer;
m_playerInfo.playerName = plString::FromWchar(reply.playerName);
m_playerInfo.avatarShape = plString::FromWchar(reply.avatarShape);
}
m_result = reply.result;
m_state = kTransStateComplete;
@ -3166,19 +3155,18 @@ bool SetPlayerRequestTrans::Recv (
//============================================================================
AccountChangePasswordRequestTrans::AccountChangePasswordRequestTrans (
const wchar_t accountName[],
const wchar_t password[],
const plString& accountName,
const plString& password,
FNetCliAuthAccountChangePasswordRequestCallback callback,
void * param
) : NetAuthTrans(kAccountChangePasswordRequestTrans)
, m_accountName(accountName)
, m_callback(callback)
, m_param(param)
{
StrCopy(m_accountName, accountName, arrsize(m_accountName));
CryptHashPassword(
plString::FromWchar(m_accountName),
plString::FromWchar(password),
m_accountName,
password,
m_namePassHash
);
}
@ -3188,10 +3176,12 @@ bool AccountChangePasswordRequestTrans::Send () {
if (!AcquireConn())
return false;
plStringBuffer<uint16_t> accountName = m_accountName.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_AcctChangePasswordRequest,
m_transId,
(uintptr_t) m_accountName,
(uintptr_t) accountName.GetData(),
(uintptr_t) &m_namePassHash,
};
@ -3228,14 +3218,14 @@ bool AccountChangePasswordRequestTrans::Recv (
//============================================================================
GetPublicAgeListTrans::GetPublicAgeListTrans (
const wchar_t ageName[],
const plString& ageName,
FNetCliAuthGetPublicAgeListCallback callback,
void * param
) : NetAuthTrans(kGetPublicAgeListTrans)
, m_ageName(ageName)
, m_callback(callback)
, m_param(param)
{
StrCopy(m_ageName, ageName, arrsize(m_ageName));
}
//============================================================================
@ -3243,10 +3233,12 @@ bool GetPublicAgeListTrans::Send () {
if (!AcquireConn())
return false;
plStringBuffer<uint16_t> ageName = m_ageName.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_GetPublicAgeList,
m_transId,
(uintptr_t) &m_ageName,
(uintptr_t) ageName.GetData(),
};
m_conn->Send(msg, arrsize(msg));
@ -3817,10 +3809,10 @@ VaultInitAgeTrans::VaultInitAgeTrans (
void * param, // optional
const plUUID& ageInstId, // optional. is used in match
const plUUID& parentAgeInstId, // optional. is used in match
const wchar_t ageFilename[], // optional. is used in match
const wchar_t ageInstName[], // optional. not used in match
const wchar_t ageUserName[], // optional. not used in match
const wchar_t ageDesc[], // optional. not used in match
const plString ageFilename, // optional. is used in match
const plString ageInstName, // optional. not used in match
const plString ageUserName, // optional. not used in match
const plString ageDesc, // optional. not used in match
unsigned ageSequenceNumber, // optional. not used in match
unsigned ageLanguage // optional. not used in match
) : NetAuthTrans(kVaultInitAgeTrans)
@ -3828,10 +3820,6 @@ VaultInitAgeTrans::VaultInitAgeTrans (
, m_param(param)
, m_ageInstId(ageInstId)
, m_parentAgeInstId(parentAgeInstId)
, m_ageFilename(StrDup(ageFilename ? ageFilename : L""))
, m_ageInstName(StrDup(ageInstName ? ageInstName : L""))
, m_ageUserName(StrDup(ageUserName ? ageUserName : L""))
, m_ageDesc(StrDup(ageDesc ? ageDesc : L""))
, m_ageSequenceNumber(ageSequenceNumber)
, m_ageLanguage(ageLanguage)
, m_ageId(0)
@ -3841,10 +3829,6 @@ VaultInitAgeTrans::VaultInitAgeTrans (
//============================================================================
VaultInitAgeTrans::~VaultInitAgeTrans () {
free(m_ageFilename);
free(m_ageInstName);
free(m_ageUserName);
free(m_ageDesc);
}
//============================================================================
@ -3852,19 +3836,24 @@ bool VaultInitAgeTrans::Send () {
if (!AcquireConn())
return false;
plStringBuffer<uint16_t> ageFilename = m_ageFilename.ToUtf16();
plStringBuffer<uint16_t> ageInstName = m_ageInstName.ToUtf16();
plStringBuffer<uint16_t> ageUserName = m_ageUserName.ToUtf16();
plStringBuffer<uint16_t> ageDesc = m_ageDesc.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_VaultInitAgeRequest,
m_transId,
(uintptr_t) &m_ageInstId,
(uintptr_t) &m_parentAgeInstId,
(uintptr_t) m_ageFilename,
(uintptr_t) m_ageInstName,
(uintptr_t) m_ageUserName,
(uintptr_t) m_ageDesc,
m_ageSequenceNumber,
m_ageLanguage,
(uintptr_t) ageFilename.GetData(),
(uintptr_t) ageInstName.GetData(),
(uintptr_t) ageUserName.GetData(),
(uintptr_t) ageDesc.GetData(),
m_ageSequenceNumber,
m_ageLanguage,
};
m_conn->Send(msg, arrsize(msg));
return true;
@ -4416,8 +4405,8 @@ bool ChangePlayerNameRequestTrans::Recv (
//============================================================================
SendFriendInviteTrans::SendFriendInviteTrans (
const wchar_t emailAddr[],
const wchar_t toName[],
const plString& emailAddr,
const plString& toName,
const plUUID& inviteUuid,
FNetCliAuthSendFriendInviteCallback callback,
void * param
@ -4425,9 +4414,9 @@ SendFriendInviteTrans::SendFriendInviteTrans (
, m_callback(callback)
, m_param(param)
, m_inviteUuid(inviteUuid)
, m_toName(toName)
, m_emailAddress(emailAddr)
{
StrCopy(m_emailAddress, emailAddr, arrsize(m_emailAddress));
StrCopy(m_toName, toName, arrsize(m_toName));
}
//============================================================================
@ -4435,12 +4424,15 @@ bool SendFriendInviteTrans::Send () {
if (!AcquireConn())
return false;
plStringBuffer<uint16_t> emailAddress = m_emailAddress.ToUtf16();
plStringBuffer<uint16_t> toName = m_toName.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_SendFriendInviteRequest,
m_transId,
(uintptr_t) &m_inviteUuid,
(uintptr_t) m_emailAddress,
(uintptr_t) m_toName,
(uintptr_t) emailAddress.GetData(),
(uintptr_t) toName.GetData(),
};
m_conn->Send(msg, arrsize(msg));
@ -4491,7 +4483,7 @@ void AuthConnectedNotifyTrans::Post() {
//============================================================================
ScoreCreateTrans::ScoreCreateTrans (
unsigned ownerId,
const char* gameName,
const plString& gameName,
unsigned gameType,
int value,
FNetCliAuthCreateScoreCallback callback,
@ -4500,12 +4492,12 @@ ScoreCreateTrans::ScoreCreateTrans (
, m_callback(callback)
, m_param(param)
, m_ownerId(ownerId)
, m_gameName(gameName)
, m_gameType(gameType)
, m_value(value)
, m_scoreId(0)
, m_createdTime(0)
{
StrCopy(m_gameName, gameName, arrsize(m_gameName));
}
//============================================================================
@ -4513,16 +4505,15 @@ bool ScoreCreateTrans::Send () {
if (!AcquireConn())
return false;
wchar_t wgameName[kMaxGameScoreNameLength];
StrToUnicode(wgameName, m_gameName, arrsize(wgameName));
plStringBuffer<uint16_t> gameName = m_gameName.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_ScoreCreate,
kCli2Auth_ScoreCreate,
m_transId,
m_ownerId,
(uintptr_t) wgameName,
(uintptr_t) gameName.GetData(),
m_gameType,
(uintptr_t)m_value
(uintptr_t) m_value
};
m_conn->Send(msg, arrsize(msg));
@ -4626,17 +4617,17 @@ bool ScoreDeleteTrans::Recv (
//============================================================================
ScoreGetScoresTrans::ScoreGetScoresTrans (
unsigned ownerId,
const char* gameName,
const plString& gameName,
FNetCliAuthGetScoresCallback callback,
void * param
) : NetAuthTrans(kScoreGetScoresTrans)
, m_callback(callback)
, m_param(param)
, m_ownerId(ownerId)
, m_scores(nil)
, m_gameName(gameName)
, m_scores(nullptr)
, m_scoreCount(0)
{
StrCopy(m_gameName, gameName, arrsize(m_gameName));
}
//============================================================================
@ -4649,14 +4640,13 @@ bool ScoreGetScoresTrans::Send () {
if (!AcquireConn())
return false;
wchar_t wgameName[kMaxGameScoreNameLength];
StrToUnicode(wgameName, m_gameName, arrsize(wgameName));
plStringBuffer<uint16_t> gameName = m_gameName.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_ScoreGetScores,
m_transId,
m_ownerId,
(uintptr_t) wgameName
kCli2Auth_ScoreGetScores,
m_transId,
m_ownerId,
(uintptr_t) gameName.GetData()
};
m_conn->Send(msg, arrsize(msg));
@ -4896,7 +4886,7 @@ ScoreGetRanksTrans::ScoreGetRanksTrans (
unsigned ownerId,
unsigned scoreGroup,
unsigned parentFolderId,
const char * cGameName,
const plString& gameName,
unsigned timePeriod,
unsigned numResults,
unsigned pageNumber,
@ -4909,12 +4899,12 @@ ScoreGetRanksTrans::ScoreGetRanksTrans (
, m_ownerId(ownerId)
, m_scoreGroup(scoreGroup)
, m_parentFolderId(parentFolderId)
, m_gameName(gameName)
, m_timePeriod(timePeriod)
, m_numResults(numResults)
, m_pageNumber(pageNumber)
, m_sortDesc(sortDesc)
{
StrToUnicode(m_gameName, cGameName, arrsize(m_gameName));
}
//============================================================================
@ -4922,13 +4912,15 @@ bool ScoreGetRanksTrans::Send () {
if (!AcquireConn())
return false;
plStringBuffer<uint16_t> gameName = m_gameName.ToUtf16();
const uintptr_t msg[] = {
kCli2Auth_ScoreGetRanks,
m_transId,
m_ownerId,
m_scoreGroup,
m_parentFolderId,
(uintptr_t) m_gameName,
(uintptr_t) gameName.GetData(),
m_timePeriod,
m_numResults,
m_pageNumber,
@ -5124,7 +5116,7 @@ void AuthPingEnable (bool enable) {
//============================================================================
void NetCliAuthStartConnect (
const char* authAddrList[],
const plString authAddrList[],
uint32_t authAddrCount
) {
// TEMP: Only connect to one auth server until we fill out this module
@ -5133,7 +5125,7 @@ void NetCliAuthStartConnect (
for (unsigned i = 0; i < authAddrCount; ++i) {
// Do we need to lookup the address?
const char* name = authAddrList[i];
const char* name = authAddrList[i].c_str();
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -5141,7 +5133,7 @@ void NetCliAuthStartConnect (
AsyncAddressLookupName(
&cancelId,
AsyncLookupCallback,
authAddrList[i],
authAddrList[i].c_str(),
GetClientPort(),
nil
);
@ -5230,7 +5222,7 @@ void NetCliAuthAccountExistsRequest (
//============================================================================
void NetCliAuthLoginRequest (
const wchar_t accountName[],
const plString& accountName,
const ShaDigest * accountNamePassHash,
const wchar_t authToken[],
const wchar_t os[],
@ -5238,8 +5230,8 @@ void NetCliAuthLoginRequest (
void * param
) {
// Cache updated login info if provided.
if (accountName)
StrCopy(s_accountName, accountName, arrsize(s_accountName));
if (!accountName.IsEmpty())
s_accountName = accountName;
if (accountNamePassHash)
memcpy(s_accountNamePassHash, *accountNamePassHash, sizeof(ShaDigest));
if (authToken)
@ -5253,7 +5245,7 @@ void NetCliAuthLoginRequest (
//============================================================================
void NetCliAuthAgeRequest (
const wchar_t ageName[],
const plString& ageName,
const plUUID& ageInstId,
FNetCliAuthAgeRequestCallback callback,
void * param
@ -5319,14 +5311,13 @@ void NetCliAuthAccountCreateFromKeyRequest (
//============================================================================
void NetCliAuthPlayerCreateRequest (
const wchar_t playerName[],
const wchar_t avatarShape[],
const wchar_t friendInvite[],
const plString& playerName,
const plString& avatarShape,
const plString& friendInvite,
FNetCliAuthPlayerCreateRequestCallback callback,
void * param
) {
wchar_t name[kMaxPlayerNameLength];
StrCopy(name, playerName, arrsize(name));
plString name = playerName;
ENetError error = FixupPlayerName(name);
if (IS_NET_ERROR(error)) {
NetCliAuthPlayerInfo playerInfo;
@ -5425,7 +5416,7 @@ void NetCliAuthSetAgePublic (
//============================================================================
void NetCliAuthGetPublicAgeList (
const wchar_t ageName[],
const plString& ageName,
FNetCliAuthGetPublicAgeListCallback callback,
void * param
) {
@ -5439,8 +5430,8 @@ void NetCliAuthGetPublicAgeList (
//============================================================================
void NetCliAuthAccountChangePasswordRequest (
const wchar_t accountName[],
const wchar_t password[],
const plString& accountName,
const plString& password,
FNetCliAuthAccountChangePasswordRequestCallback callback,
void * param
) {
@ -5738,10 +5729,10 @@ void NetCliAuthVaultSendNode (
void NetCliAuthVaultInitAge (
const plUUID& ageInstId, // optional. is used in match
const plUUID& parentAgeInstId, // optional. is used in match
const wchar_t ageFilename[], // optional. is used in match
const wchar_t ageInstName[], // optional. not used in match
const wchar_t ageUserName[], // optional. not used in match
const wchar_t ageDesc[], // optional. not used in match
const plString& ageFilename, // optional. is used in match
const plString& ageInstName, // optional. not used in match
const plString& ageUserName, // optional. not used in match
const plString& ageDesc, // optional. not used in match
unsigned ageSequenceNumber, // optional. not used in match
unsigned ageLanguage, // optional. not used in match
FNetCliAuthAgeInitCallback callback, // optional
@ -5771,7 +5762,7 @@ void NetCliAuthSetRecvBufferHandler (
//============================================================================
void NetCliAuthSendCCRPetition (
const wchar_t * petitionText
const plString& petitionText
) {
hsAssert(false, "eric, implement me.");
}
@ -5907,9 +5898,9 @@ void NetCliAuthChangePlayerNameRequest (
//============================================================================
void NetCliAuthSendFriendInvite (
const wchar_t emailAddress[],
const wchar_t toName[],
const plUUID& inviteUuid,
const plString& emailAddress,
const plString& toName,
const plUUID& inviteUuid,
FNetCliAuthSendFriendInviteCallback callback,
void * param
) {
@ -5926,7 +5917,7 @@ void NetCliAuthSendFriendInvite (
//============================================================================
void NetCliAuthScoreCreate (
unsigned ownerId,
const char* gameName,
const plString& gameName,
unsigned gameType,
int value,
FNetCliAuthCreateScoreCallback callback,
@ -5960,7 +5951,7 @@ void NetCliAuthScoreDelete(
//============================================================================
void NetCliAuthScoreGetScores(
unsigned ownerId,
const char* gameName,
const plString& gameName,
FNetCliAuthGetScoresCallback callback,
void * param
) {
@ -6028,7 +6019,7 @@ void NetCliAuthScoreGetRankList(
unsigned ownerId,
unsigned scoreGroup,
unsigned parentFolderId,
const char * gameName,
const plString& gameName,
unsigned timePeriod,
unsigned numResults,
unsigned pageNumber,

60
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h

@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliAuthStartConnect (
const char* authAddrList[],
const plString authAddrList[],
uint32_t authAddrCount
);
bool NetCliAuthQueryConnected ();
@ -119,8 +119,8 @@ void NetCliAuthAccountExistsRequest (
//============================================================================
struct NetCliAuthPlayerInfo {
unsigned playerInt;
wchar_t playerName[kMaxPlayerNameLength];
wchar_t avatarShape[kMaxVaultNodeStringLength];
plString playerName;
plString avatarShape;
unsigned playerFlags;
unsigned explorer;
};
@ -135,7 +135,7 @@ typedef void (*FNetCliAuthLoginRequestCallback)(
unsigned playerCount
);
void NetCliAuthLoginRequest (
const wchar_t accountName[], // nil --> reuse previous acct name
const plString& accountName, // nil --> reuse previous acct name
const ShaDigest * accountNamePassHash, // nil --> reuse previous acct pass
const wchar_t authToken[], // nil --> reuse previous auth token
const wchar_t os[], // nil --> reuse previous os
@ -200,9 +200,9 @@ typedef void (*FNetCliAuthPlayerCreateRequestCallback)(
const NetCliAuthPlayerInfo & playerInfo
);
void NetCliAuthPlayerCreateRequest (
const wchar_t playerName[],
const wchar_t avatarShape[],
const wchar_t friendInvite[],
const plString& playerName,
const plString& avatarShape,
const plString& friendInvite,
FNetCliAuthPlayerCreateRequestCallback callback,
void * param
);
@ -258,7 +258,7 @@ typedef void (*FNetCliAuthGetPublicAgeListCallback)(
const ARRAY(NetAgeInfo) & ages
);
void NetCliAuthGetPublicAgeList (
const wchar_t ageName[],
const plString& ageName,
FNetCliAuthGetPublicAgeListCallback callback,
void * param
);
@ -271,8 +271,8 @@ typedef void (*FNetCliAuthAccountChangePasswordRequestCallback)(
void * param
);
void NetCliAuthAccountChangePasswordRequest (
const wchar_t accountName[],
const wchar_t accountPass[],
const plString& accountName,
const plString& accountPass,
FNetCliAuthAccountChangePasswordRequestCallback callback,
void * param
);
@ -330,7 +330,7 @@ typedef void (*FNetCliAuthAgeRequestCallback)(
plNetAddress gameAddr
);
void NetCliAuthAgeRequest (
const wchar_t ageName[], // L"Teledahn"
const plString& ageName, // "Teledahn"
const plUUID& ageInstId,
FNetCliAuthAgeRequestCallback callback,
void * param
@ -521,10 +521,10 @@ typedef void (*FNetCliAuthAgeInitCallback) (
void NetCliAuthVaultInitAge (
const plUUID& ageInstId, // optional. is used in match
const plUUID& parentAgeInstId, // optional. is used in match
const wchar_t ageFilename[], // optional. is used in match
const wchar_t ageInstName[], // optional. not used in match
const wchar_t ageUserName[], // optional. not used in match
const wchar_t ageDesc[], // optional. not used in match
const plString& ageFilename, // optional. is used in match
const plString& ageInstName, // optional. not used in match
const plString& ageUserName, // optional. not used in match
const plString& ageDesc, // optional. not used in match
unsigned ageSequenceNumber, // optional. not used in match
unsigned ageLanguage, // optional. not used in match
FNetCliAuthAgeInitCallback callback, // optional
@ -575,7 +575,7 @@ void NetCliAuthChangePlayerNameRequest (
// CCRPetition
//============================================================================
void NetCliAuthSendCCRPetition (
const wchar_t * petitionText
const plString& petitionText
);
//============================================================================
@ -587,9 +587,9 @@ typedef void (*FNetCliAuthSendFriendInviteCallback)(
);
void NetCliAuthSendFriendInvite (
const wchar_t emailAddress[],
const wchar_t toName[],
const plUUID& inviteUuid,
const plString& emailAddress,
const plString& toName,
const plUUID& inviteUuid,
FNetCliAuthSendFriendInviteCallback callback,
void * param
);
@ -629,18 +629,18 @@ typedef void (*FNetCliAuthScoreUpdateCallback)(
//============================================================================
typedef void (*FNetCliAuthCreateScoreCallback)(
ENetError result,
void * param,
unsigned scoreId,
uint32_t createdTime,
unsigned ownerId,
const char* gameName,
unsigned gameType,
int value
ENetError result,
void * param,
unsigned scoreId,
uint32_t createdTime,
unsigned ownerId,
const plString& gameName,
unsigned gameType,
int value
);
void NetCliAuthScoreCreate(
unsigned ownerId,
const char* gameName,
const plString& gameName,
unsigned gameType,
int value,
FNetCliAuthCreateScoreCallback callback,
@ -664,7 +664,7 @@ typedef void (*FNetCliAuthGetScoresCallback)(
void NetCliAuthScoreGetScores(
unsigned ownerId,
const char* gameName,
const plString& gameName,
FNetCliAuthGetScoresCallback callback,
void * param
);
@ -707,7 +707,7 @@ void NetCliAuthScoreGetRankList(
unsigned ownerId,
unsigned scoreGroup,
unsigned parentFolderId,
const char * gameName,
const plString& gameName,
unsigned timePeriod,
unsigned numResults,
unsigned pageNumber,

23
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp

@ -64,7 +64,7 @@ struct CliFileConn : hsRefCnt {
LINK(CliFileConn) link;
hsReaderWriterLock sockLock; // to protect the socket pointer so we don't nuke it while using it
AsyncSocket sock;
char name[MAX_PATH];
plString name;
plNetAddress addr;
unsigned seq;
ARRAY(uint8_t) recvBuffer;
@ -536,18 +536,18 @@ static void Connect (CliFileConn * conn) {
//============================================================================
static void Connect (
const char name[],
const plString& name,
const plNetAddress& addr
) {
ASSERT(s_running);
CliFileConn * conn = new CliFileConn;
strncpy(conn->name, name, arrsize(conn->name));
conn->addr = addr;
conn->buildId = s_connectBuildId;
conn->serverType = s_serverType;
conn->seq = ConnNextSequence();
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
conn->name = name;
conn->addr = addr;
conn->buildId = s_connectBuildId;
conn->serverType = s_serverType;
conn->seq = ConnNextSequence();
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
conn->Ref("Lifetime");
conn->AutoReconnect();
@ -584,7 +584,6 @@ CliFileConn::CliFileConn ()
, numImmediateDisconnects(0), numFailedConnects(0)
, pingTimer(nil), pingSendTimeMs(0), lastHeardTimeMs(0)
{
memset(name, 0, sizeof(name));
++s_perf[kPerfConnCount];
}
@ -1344,7 +1343,7 @@ unsigned FileGetConnId () {
//============================================================================
void NetCliFileStartConnect (
const char* fileAddrList[],
const plString fileAddrList[],
uint32_t fileAddrCount,
bool isPatcher /* = false */
) {
@ -1356,7 +1355,7 @@ void NetCliFileStartConnect (
for (unsigned i = 0; i < fileAddrCount; ++i) {
// Do we need to lookup the address?
const char* name = fileAddrList[i];
const char* name = fileAddrList[i].c_str();
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -1364,7 +1363,7 @@ void NetCliFileStartConnect (
AsyncAddressLookupName(
&cancelId,
AsyncLookupCallback,
fileAddrList[i],
fileAddrList[i].c_str(),
GetClientPort(),
nil
);

2
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h

@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliFileStartConnect (
const char* fileAddrList[],
const plString fileAddrList[],
unsigned fileAddrCount,
bool isPatcher = false
);

26
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp

@ -89,7 +89,7 @@ struct CliGkConn : hsRefCnt {
LINK(CliGkConn) link;
AsyncSocket sock;
NetCli * cli;
char name[MAX_PATH];
plString name;
plNetAddress addr;
plUUID token;
unsigned seq;
@ -131,7 +131,7 @@ struct PingRequestTrans : NetGateKeeperTrans {
struct FileSrvIpAddressRequestTrans : NetGateKeeperTrans {
FNetCliGateKeeperFileSrvIpAddressRequestCallback m_callback;
void * m_param;
wchar_t m_addr[64];
plString m_addr;
bool m_isPatcher;
FileSrvIpAddressRequestTrans (
@ -154,8 +154,8 @@ struct FileSrvIpAddressRequestTrans : NetGateKeeperTrans {
struct AuthSrvIpAddressRequestTrans : NetGateKeeperTrans {
FNetCliGateKeeperAuthSrvIpAddressRequestCallback m_callback;
void * m_param;
wchar_t m_addr[64];
plString m_addr;
AuthSrvIpAddressRequestTrans (
FNetCliGateKeeperAuthSrvIpAddressRequestCallback callback,
void * param
@ -463,7 +463,7 @@ static void Connect (
//============================================================================
static void Connect (
const char name[],
const plString& name,
const plNetAddress& addr
) {
ASSERT(s_running);
@ -472,7 +472,7 @@ static void Connect (
conn->addr = addr;
conn->seq = ConnNextSequence();
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
strncpy(conn->name, name, arrsize(conn->name));
conn->name = name;
conn->Ref("Lifetime");
conn->AutoReconnect();
@ -530,8 +530,6 @@ CliGkConn::CliGkConn ()
, sock(nil), cli(nil), seq(0), serverChallenge(0)
, cancelId(nil), abandoned(false)
{
memset(name, 0, sizeof(name));
++s_perf[kPerfConnCount];
}
@ -876,7 +874,7 @@ bool FileSrvIpAddressRequestTrans::Recv (
m_result = kNetSuccess;
m_state = kTransStateComplete;
StrCopy(m_addr, reply.address, 64);
m_addr = plString::FromWchar(reply.address);
return true;
}
@ -933,7 +931,7 @@ bool AuthSrvIpAddressRequestTrans::Recv (
m_result = kNetSuccess;
m_state = kTransStateComplete;
StrCopy(m_addr, reply.address, 64);
m_addr = plString::FromWchar(reply.address);
return true;
}
@ -1059,14 +1057,14 @@ unsigned GateKeeperGetConnId () {
//============================================================================
void NetCliGateKeeperStartConnect (
const char* gateKeeperAddrList[],
uint32_t gateKeeperAddrCount
const plString gateKeeperAddrList[],
uint32_t gateKeeperAddrCount
) {
gateKeeperAddrCount = std::min(gateKeeperAddrCount, 1u);
for (unsigned i = 0; i < gateKeeperAddrCount; ++i) {
// Do we need to lookup the address?
const char* name = gateKeeperAddrList[i];
const char* name = gateKeeperAddrList[i].c_str();
while (unsigned ch = *name) {
++name;
if (!(isdigit(ch) || ch == L'.' || ch == L':')) {
@ -1074,7 +1072,7 @@ void NetCliGateKeeperStartConnect (
AsyncAddressLookupName(
&cancelId,
AsyncLookupCallback,
gateKeeperAddrList[i],
gateKeeperAddrList[i].c_str(),
GetClientPort(),
nil
);

16
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.h

@ -62,8 +62,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Connect
//============================================================================
void NetCliGateKeeperStartConnect (
const char* gateKeeperAddrList[],
uint32_t gateKeeperAddrCount
const plString gateKeeperAddrList[],
uint32_t gateKeeperAddrCount
);
bool NetCliGateKeeperQueryConnected ();
@ -107,9 +107,9 @@ void NetCliGateKeeperPingRequest (
// FileSrvIpAddress
//============================================================================
typedef void (*FNetCliGateKeeperFileSrvIpAddressRequestCallback)(
ENetError result,
void * param,
const wchar_t addr[]
ENetError result,
void * param,
const plString& addr
);
void NetCliGateKeeperFileSrvIpAddressRequest (
@ -123,9 +123,9 @@ void NetCliGateKeeperFileSrvIpAddressRequest (
// AuthSrvIpAddress
//============================================================================
typedef void (*FNetCliGateKeeperAuthSrvIpAddressRequestCallback)(
ENetError result,
void * param,
const wchar_t addr[]
ENetError result,
void * param,
const plString& addr
);
void NetCliGateKeeperAuthSrvIpAddressRequest (

2
Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp

@ -210,7 +210,7 @@ void plAutoProfileImp::INextProfile()
// Log the stats for this spawn point
if (!fLastSpawnPointName.IsNull())
{
const char * ageName = NetCommGetAge()->ageDatasetName;
plString ageName = NetCommGetAge()->ageDatasetName;
plProfileManagerFull::Instance().LogStats(ageName, fLastSpawnPointName);
plMipmap mipmap;

52
Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp

@ -2078,23 +2078,13 @@ void VaultInitAge (
) {
VaultAgeInitTrans * trans = new VaultAgeInitTrans(callback, state, param);
wchar_t ageFilename[MAX_PATH];
wchar_t ageInstName[MAX_PATH];
wchar_t ageUserName[MAX_PATH];
wchar_t ageDesc[1024];
StrToUnicode(ageFilename, info->GetAgeFilename(), arrsize(ageFilename));
StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName));
StrToUnicode(ageUserName, info->GetAgeUserDefinedName(), arrsize(ageUserName));
StrToUnicode(ageDesc, info->GetAgeDescription(), arrsize(ageDesc));
NetCliAuthVaultInitAge(
*info->GetAgeInstanceGuid(),
parentAgeInstId,
ageFilename,
ageInstName,
ageUserName,
ageDesc,
info->GetAgeFilename(),
info->GetAgeInstanceName(),
info->GetAgeUserDefinedName(),
info->GetAgeDescription(),
info->GetAgeSequenceNumber(),
info->GetAgeLanguage(),
VaultAgeInitTrans::AgeInitCallback,
@ -3444,17 +3434,14 @@ bool VaultAmCzarOfAge (const plUUID& ageInstId) {
//============================================================================
bool VaultRegisterMTStationAndWait (
const wchar_t stationName[],
const wchar_t linkBackSpawnPtObjName[]
const plString& stationName,
const plString& linkBackSpawnPtObjName
) {
plAgeInfoStruct info;
info.SetAgeFilename(kCityAgeFilename);
if (hsRef<RelVaultNode> rvn = VaultGetOwnedAgeLink(&info)) {
char title[MAX_PATH], spawnPt[MAX_PATH];
StrToAnsi(title, stationName, arrsize(title));
StrToAnsi(spawnPt, linkBackSpawnPtObjName, arrsize(spawnPt));
VaultAgeLinkNode link(rvn);
link.AddSpawnPoint(plSpawnPointInfo(title, spawnPt));
link.AddSpawnPoint({ stationName, linkBackSpawnPtObjName });
return true;
}
return false;
@ -3673,16 +3660,16 @@ hsRef<RelVaultNode> VaultFindAgeSubAgeLink (const plAgeInfoStruct * info) {
}
//============================================================================
hsRef<RelVaultNode> VaultFindAgeChronicleEntry (const wchar_t entryName[], int entryType) {
hsRef<RelVaultNode> VaultFindAgeChronicleEntry (const plString& entryName, int entryType) {
hsAssert(false, "eric, implement me");
return nil;
}
//============================================================================
void VaultAddAgeChronicleEntry (
const wchar_t entryName[],
int entryType,
const wchar_t entryValue[]
const plString& entryName,
int entryType,
const plString& entryValue
) {
hsAssert(false, "eric, implement me");
}
@ -4262,7 +4249,7 @@ static void _AddChildNodeCallback (
//============================================================================
bool VaultAgeFindOrCreateChildAgeLinkAndWait (
const wchar_t parentAgeName[],
const plString& parentAgeName,
const plAgeInfoStruct * info,
plAgeLinkStruct * link
) {
@ -4274,15 +4261,12 @@ bool VaultAgeFindOrCreateChildAgeLinkAndWait (
{ // Get id of child ages folder
hsRef<RelVaultNode> rvnAgeInfo;
if (parentAgeName) {
char ansi[MAX_PATH];
StrToAnsi(ansi, parentAgeName, arrsize(ansi));
if (!parentAgeName.IsEmpty()) {
plAgeInfoStruct pinfo;
pinfo.SetAgeFilename(ansi);
pinfo.SetAgeFilename(parentAgeName);
if (hsRef<RelVaultNode> rvnAgeLink = VaultGetOwnedAgeLink(&pinfo))
rvnAgeInfo = rvnAgeLink->GetChildNode(plVault::kNodeType_AgeInfo, 1);
}
else {
} else {
rvnAgeInfo = VaultGetAgeInfoNode();
}
@ -4523,17 +4507,15 @@ namespace _VaultCreateChildAge {
}; // namespace _VaultCreateAge
uint8_t VaultAgeFindOrCreateChildAgeLink(
const wchar_t parentAgeName[],
const plString& parentAgeName,
const plAgeInfoStruct* info,
plAgeLinkStruct* link)
{
using namespace _VaultCreateChildAge;
// First, try to find an already existing ChildAge
char name[MAX_PATH];
StrToAnsi(name, parentAgeName, arrsize(name));
plAgeInfoStruct search;
search.SetAgeFilename(name);
search.SetAgeFilename(parentAgeName);
hsRef<RelVaultNode> rvnParentInfo;
if (hsRef<RelVaultNode> rvnParentLink = VaultGetOwnedAgeLink(&search))

14
Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.h

@ -375,8 +375,8 @@ bool VaultAmCzarOfCurrentAge ();
bool VaultAmOwnerOfAge (const plUUID& ageInstId);
bool VaultAmCzarOfAge (const plUUID& ageInstId);
bool VaultRegisterMTStationAndWait (
const wchar_t stationName[],
const wchar_t linkBackSpawnPtObjName[]
const plString& stationName,
const plString& linkBackSpawnPtObjName
);
void VaultProcessPlayerInbox ();
@ -402,12 +402,12 @@ hsRef<RelVaultNode> VaultGetAgePublicAgesFolder();
hsRef<RelVaultNode> VaultAgeGetBookshelfFolder();
hsRef<RelVaultNode> VaultFindAgeSubAgeLink(const plAgeInfoStruct * info);
hsRef<RelVaultNode> VaultFindAgeChildAgeLink(const plAgeInfoStruct * info);
hsRef<RelVaultNode> VaultFindAgeChronicleEntry(const wchar_t entryName[], int entryType = -1);
hsRef<RelVaultNode> VaultFindAgeChronicleEntry(const plString& entryName, int entryType = -1);
// if entry of same name and type already exists, value is updated
void VaultAddAgeChronicleEntry (
const wchar_t entryName[],
const plString& entryName,
int entryType,
const wchar_t entryValue[]
const plString& entryValue
);
hsRef<RelVaultNode> VaultAgeAddDeviceAndWait(const plString& deviceName); // blocks until completion
void VaultAgeRemoveDevice (const plString& deviceName);
@ -434,11 +434,11 @@ bool VaultAgeFindOrCreateSubAgeLinkAndWait (
);
bool VaultAgeFindOrCreateSubAgeLink(const plAgeInfoStruct* info, plAgeLinkStruct* link, const plUUID& arentUuid);
bool VaultAgeFindOrCreateChildAgeLinkAndWait (
const wchar_t parentAgeName[], // nil --> current age, non-nil --> owned age by given name
const plString& parentAgeName, // nil --> current age, non-nil --> owned age by given name
const plAgeInfoStruct * info,
plAgeLinkStruct * link
);
uint8_t VaultAgeFindOrCreateChildAgeLink(const wchar_t parentAgeName[], const plAgeInfoStruct* info, plAgeLinkStruct* link);
uint8_t VaultAgeFindOrCreateChildAgeLink(const plString& parentAgeName, const plAgeInfoStruct* info, plAgeLinkStruct* link);

Loading…
Cancel
Save