mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Merge pull request #275 from zrax/file-utils
Unify filesystem utilities
This commit is contained in:
@ -187,16 +187,10 @@ plVirtualCam1::plVirtualCam1()
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
// only open log file if logging is on
|
||||
if ( !plStatusLog::fLoggingOff )
|
||||
{
|
||||
wchar_t fileAndPath[MAX_PATH];
|
||||
PathGetLogDirectory(fileAndPath, arrsize(fileAndPath));
|
||||
PathAddFilename(fileAndPath, fileAndPath, L"camLog.txt", arrsize(fileAndPath));
|
||||
foutLog = hsWFopen( fileAndPath, L"wt" );
|
||||
}
|
||||
foutLog = plFileSystem::Open(plFileName::Join(plFileSystem::GetLogPath(), "camLog.txt"), "wt");
|
||||
#endif
|
||||
|
||||
SetFlags(kFirstPersonEnabled);
|
||||
|
||||
}
|
||||
|
||||
plVirtualCam1::~plVirtualCam1()
|
||||
|
@ -112,9 +112,9 @@ PF_CONSOLE_FILE_DUMMY(Avatar)
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
plKey FindSceneObjectByName(const plString& name, const char* ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByName(const plString& name, int type, const char* ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByNameAndType(const plString& name, const char* typeName, const char* ageName,
|
||||
plKey FindSceneObjectByName(const plString& name, const plString& ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByName(const plString& name, int type, const plString& ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByNameAndType(const plString& name, const char* typeName, const plString& ageName,
|
||||
char* statusStr, bool subString=false);
|
||||
void PrintStringF(void pfun(const char *),const char * fmt, ...);
|
||||
|
||||
@ -361,7 +361,7 @@ PF_CONSOLE_CMD( Avatar_Turn, SetMouseTurnSensitivity, "float sensitivity", "Set
|
||||
PF_CONSOLE_CMD( Avatar_Multistage, Trigger, "string multiComp", "Triggers the named Multistage Animation component")
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plMultistageBehMod", nil, str, true);
|
||||
plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plMultistageBehMod", "", str, true);
|
||||
PrintString(str);
|
||||
|
||||
if (key)
|
||||
@ -499,7 +499,7 @@ PF_CONSOLE_CMD( Avatar, SeekPoint, "string seekpoint", "Move to the given seekpo
|
||||
if(avatar)
|
||||
{
|
||||
char buff[256];
|
||||
plKey seekKey = FindSceneObjectByName(spName, nil, buff);
|
||||
plKey seekKey = FindSceneObjectByName(spName, "", buff);
|
||||
plSeekPointMod *mod = plAvatarMgr::GetInstance()->FindSeekPoint(spName);
|
||||
|
||||
if(mod)
|
||||
@ -596,7 +596,7 @@ PF_CONSOLE_CMD( Avatar, FakeLinkToObj, "string objName", "Pseudo-Link the avatar
|
||||
{
|
||||
plString spName = plString::FromUtf8(params[0]);
|
||||
char buff[256];
|
||||
plKey seekKey = FindSceneObjectByName(spName, nil, buff);
|
||||
plKey seekKey = FindSceneObjectByName(spName, "", buff);
|
||||
if (!seekKey)
|
||||
{
|
||||
PrintString("Can't find object with that name, fake link failed.");
|
||||
|
@ -155,7 +155,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plUnifiedTime/plUnifiedTime.h"
|
||||
//end for agedefn test
|
||||
|
||||
#include "plFile/hsFiles.h"
|
||||
#include "pnSceneObject/plAudioInterface.h"
|
||||
|
||||
#include "plStatusLog/plStatusLog.h"
|
||||
@ -263,9 +262,9 @@ PF_CONSOLE_FILE_DUMMY(Main)
|
||||
// utility functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
plKey FindSceneObjectByName(const plString& name, const char* ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByName(const plString& name, int type, const char* ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByNameAndType(const plString& name, const char* typeName, const char* ageName,
|
||||
plKey FindSceneObjectByName(const plString& name, const plString& ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByName(const plString& name, int type, const plString& ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByNameAndType(const plString& name, const char* typeName, const plString& ageName,
|
||||
char* statusStr, bool subString=false);
|
||||
void PrintStringF(void pfun(const char *),const char * fmt, ...);
|
||||
|
||||
@ -273,7 +272,7 @@ void PrintStringF(void pfun(const char *),const char * fmt, ...);
|
||||
// Find an object from name, type (int), and optionally age.
|
||||
// Name can be an alias specified by saying $foo
|
||||
//
|
||||
plKey FindObjectByName(const plString& name, int type, const char* ageName, char* statusStr, bool subString)
|
||||
plKey FindObjectByName(const plString& name, int type, const plString& ageName, char* statusStr, bool subString)
|
||||
{
|
||||
if (name.IsNull())
|
||||
{
|
||||
@ -293,22 +292,22 @@ plKey FindObjectByName(const plString& name, int type, const char* ageName, char
|
||||
// Try restricted to our age first, if we're not given an age name. This works
|
||||
// around most of the problems associated with unused keys in pages causing the pages to be marked
|
||||
// as not loaded and thus screwing up our searches
|
||||
if( ageName == nil && plNetClientMgr::GetInstance() != nil )
|
||||
if (ageName.IsNull() && plNetClientMgr::GetInstance() != nil)
|
||||
{
|
||||
const char *thisAge = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName();
|
||||
if (thisAge != nil)
|
||||
plString thisAge = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName();
|
||||
if (!thisAge.IsNull())
|
||||
{
|
||||
key = plKeyFinder::Instance().StupidSearch(thisAge, nil, type, name, subString);
|
||||
key = plKeyFinder::Instance().StupidSearch(thisAge, "", type, name, subString);
|
||||
if (key != nil)
|
||||
{
|
||||
if (statusStr)
|
||||
if (statusStr)
|
||||
sprintf(statusStr, "Found Object");
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fallback
|
||||
key = plKeyFinder::Instance().StupidSearch(ageName,nil,type, name, subString);
|
||||
key = plKeyFinder::Instance().StupidSearch(ageName, "", type, name, subString);
|
||||
|
||||
if (!key)
|
||||
{
|
||||
@ -334,7 +333,7 @@ plKey FindObjectByName(const plString& name, int type, const char* ageName, char
|
||||
// Name can be an alias specified by saying $foo.
|
||||
// Will load the object if necessary.
|
||||
//
|
||||
plKey FindSceneObjectByName(const plString& name, const char* ageName, char* statusStr, bool subString)
|
||||
plKey FindSceneObjectByName(const plString& name, const plString& ageName, char* statusStr, bool subString)
|
||||
{
|
||||
plKey key=FindObjectByName(name, plSceneObject::Index(), ageName, statusStr, subString);
|
||||
|
||||
@ -352,7 +351,7 @@ plKey FindSceneObjectByName(const plString& name, const char* ageName, char* sta
|
||||
// Find an object from name, type (string) and optionally age.
|
||||
// Name can be an alias specified by saying $foo
|
||||
//
|
||||
plKey FindObjectByNameAndType(const plString& name, const char* typeName, const char* ageName,
|
||||
plKey FindObjectByNameAndType(const plString& name, const char* typeName, const plString& ageName,
|
||||
char* statusStr, bool subString)
|
||||
{
|
||||
if (!typeName)
|
||||
@ -1579,8 +1578,8 @@ PF_CONSOLE_CMD( Graphics_Renderer, GrabCubeMap,
|
||||
"Take cubemap from sceneObject's position and name it prefix_XX.jpg")
|
||||
{
|
||||
char str[512];
|
||||
plString objName = plString::FromUtf8(params[0]);
|
||||
plKey key = FindSceneObjectByName(objName, nil, str);
|
||||
plString objName = static_cast<const char *>(params[0]);
|
||||
plKey key = FindSceneObjectByName(objName, "", str);
|
||||
PrintString( str );
|
||||
if( !key )
|
||||
return;
|
||||
@ -1841,7 +1840,7 @@ PF_CONSOLE_CMD( Graphics_Show, SingleSound,
|
||||
{
|
||||
char str[ 512 ];
|
||||
|
||||
const char *ageName = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName();
|
||||
plString ageName = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName();
|
||||
|
||||
plKey key = FindSceneObjectByName( plString::FromUtf8( params[ 0 ] ), ageName, str, true );
|
||||
plSceneObject *obj = ( key != nil ) ? plSceneObject::ConvertNoRef( key->GetObjectPtr() ) : nil;
|
||||
@ -2175,7 +2174,7 @@ PF_CONSOLE_CMD( App,
|
||||
{
|
||||
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), "", str);
|
||||
plSceneObject* obj = plSceneObject::ConvertNoRef(key->GetObjectPtr());
|
||||
if( !obj )
|
||||
{
|
||||
@ -2252,7 +2251,7 @@ PF_CONSOLE_CMD( App,
|
||||
{
|
||||
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), "", str);
|
||||
plSceneObject* obj = plSceneObject::ConvertNoRef(key->GetObjectPtr());
|
||||
if( !obj )
|
||||
{
|
||||
@ -2307,7 +2306,7 @@ PF_CONSOLE_CMD( App,
|
||||
{
|
||||
char str[256];
|
||||
plString name = plString::FromUtf8(params[0]);
|
||||
plKey key = FindSceneObjectByName(name, nil, str);
|
||||
plKey key = FindSceneObjectByName(name, "", str);
|
||||
if( !key )
|
||||
{
|
||||
sprintf(str, "%s - Not Found!", name.c_str());
|
||||
@ -2773,7 +2772,7 @@ PF_CONSOLE_CMD( Registry, ListRefs, "string keyType, string keyName", "For the g
|
||||
"the objects who currently have active refs on it." )
|
||||
{
|
||||
char result[ 256 ];
|
||||
plKey obj = FindObjectByNameAndType( plString::FromUtf8( params[ 1 ] ), params[ 0 ], nil, result);
|
||||
plKey obj = FindObjectByNameAndType( plString::FromUtf8( params[ 1 ] ), params[ 0 ], "", result);
|
||||
if( obj == nil )
|
||||
{
|
||||
PrintString( result );
|
||||
@ -2950,7 +2949,7 @@ PF_CONSOLE_CMD( Camera, SwitchTo, "string cameraName", "Switch to the named came
|
||||
{
|
||||
char str[256];
|
||||
plString foo = plString::Format("%s_", (char*)params[0]);
|
||||
plKey key = FindObjectByNameAndType(foo, "plCameraModifier1", nil, str, true);
|
||||
plKey key = FindObjectByNameAndType(foo, "plCameraModifier1", "", str, true);
|
||||
PrintString(str);
|
||||
|
||||
if (key)
|
||||
@ -3076,7 +3075,7 @@ PF_CONSOLE_GROUP( Logic )
|
||||
static plLogicModBase *FindLogicMod(const plString &name)
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindObjectByNameAndType(name, "plLogicModifier", nil, str, true);
|
||||
plKey key = FindObjectByNameAndType(name, "plLogicModifier", "", str, true);
|
||||
pfConsole::AddLine(str);
|
||||
|
||||
if (key)
|
||||
@ -3173,7 +3172,7 @@ PF_CONSOLE_CMD( Logic, TriggerResponderNum, "int responderNum, ...", "Triggers t
|
||||
}
|
||||
|
||||
char str[256];
|
||||
plKey key = FindObjectByNameAndType(responderNames[responderNum-1], "plResponderModifier", nil, str, true);
|
||||
plKey key = FindObjectByNameAndType(responderNames[responderNum-1], "plResponderModifier", "", str, true);
|
||||
PrintString(str);
|
||||
|
||||
if (key)
|
||||
@ -3189,7 +3188,7 @@ PF_CONSOLE_CMD( Logic, TriggerResponder, "string responderComp, ...", "Triggers
|
||||
}
|
||||
|
||||
char str[256];
|
||||
plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plResponderModifier", nil, str, true);
|
||||
plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plResponderModifier", "", str, true);
|
||||
PrintString(str);
|
||||
|
||||
int responderState = -1;
|
||||
@ -3211,7 +3210,7 @@ PF_CONSOLE_CMD( Logic, FastForwardResponder, "string responderComp, ...", "Fastf
|
||||
}
|
||||
|
||||
char str[256];
|
||||
plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plResponderModifier", nil, str, true);
|
||||
plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plResponderModifier", "", str, true);
|
||||
PrintString(str);
|
||||
|
||||
int responderState = -1;
|
||||
@ -3522,7 +3521,7 @@ PF_CONSOLE_CMD( Audio, SetVolume,
|
||||
"string obj, float vol", "Sets the volume on a given object. 1 is max volume, 0 is silence" )
|
||||
{
|
||||
char str[ 256 ];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[ 0 ]), nil, str);
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[ 0 ]), "", str);
|
||||
if( key == nil )
|
||||
return;
|
||||
|
||||
@ -3551,7 +3550,7 @@ PF_CONSOLE_CMD( Audio, IsolateSound,
|
||||
plKey key;
|
||||
plAudioSysMsg *asMsg;
|
||||
|
||||
key = FindSceneObjectByName( plString::FromUtf8( params[ 0 ] ), nil, str );
|
||||
key = FindSceneObjectByName( plString::FromUtf8( params[ 0 ] ), "", str );
|
||||
if( key == nil )
|
||||
{
|
||||
sprintf( str, "Cannot find sound %s", (char *)params[ 0 ] );
|
||||
@ -3928,36 +3927,10 @@ PF_CONSOLE_CMD( Nav, PageInNode, // Group name, Function name
|
||||
plSynchEnabler ps(false); // disable dirty tracking while paging in
|
||||
plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kLoadRoom);
|
||||
pMsg1->AddReceiver( plClient::GetInstance()->GetKey() );
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation(nil, params[0]));
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation("", static_cast<const char *>(params[0])));
|
||||
plgDispatch::MsgSend(pMsg1);
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Nav, PageInNodeList, // Group name, Function name
|
||||
"string roomNameBase", // Params
|
||||
"Pages in all scene nodes that start with name." ) // Help string
|
||||
{
|
||||
/* This is really old and hasn't worked since 2002 anyways. */
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
plSynchEnabler ps(false); // disable dirty tracking while paging in
|
||||
|
||||
std::string pageInNodesStr;
|
||||
pageInNodesStr += "dat\\";
|
||||
pageInNodesStr += (char*)params[0];
|
||||
pageInNodesStr += "*.prx";
|
||||
hsFolderIterator pageInNodesIter(pageInNodesStr.data(), true);
|
||||
|
||||
plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kLoadRoom);
|
||||
while (pageInNodesIter.NextFile())
|
||||
{
|
||||
char nodeName[255];
|
||||
_splitpath(pageInNodesIter.GetFileName(), NULL, NULL, nodeName, NULL);
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation(nil, nodeName));
|
||||
}
|
||||
pMsg1->AddReceiver( plClient::GetInstance()->GetKey() );
|
||||
plgDispatch::MsgSend(pMsg1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef LIMIT_CONSOLE_COMMANDS
|
||||
|
||||
|
||||
@ -3968,7 +3941,7 @@ PF_CONSOLE_CMD( Nav, PageOutNode, // Group name, Function name
|
||||
plSynchEnabler ps(false); // disable dirty tracking while paging out
|
||||
plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kUnloadRoom);
|
||||
pMsg1->AddReceiver( plClient::GetInstance()->GetKey() );
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation(nil, params[0]));
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation("", static_cast<const char *>(params[0])));
|
||||
plgDispatch::MsgSend(pMsg1);
|
||||
}
|
||||
|
||||
@ -3977,7 +3950,7 @@ PF_CONSOLE_CMD( Nav, UnloadPlayer, // Group name, Function name
|
||||
"unloads a named player" ) // Help string
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), "", str);
|
||||
PrintString("UnloadPlayer (console version) is currently broken. Hassle Matt.");
|
||||
// plNetClientMgr::UnloadPlayer(key);
|
||||
}
|
||||
@ -3995,12 +3968,12 @@ PF_CONSOLE_CMD( Nav, MovePlayer, // Group name, Function name
|
||||
"moves a player from one paging unit to another" ) // Help string
|
||||
{
|
||||
char str[256];
|
||||
plKey playerKey = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey playerKey = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if( !playerKey )
|
||||
return;
|
||||
|
||||
plKey nodeKey = FindObjectByName(plString::FromUtf8(params[1]), plSceneNode::Index(), nil, str);
|
||||
plKey nodeKey = FindObjectByName(static_cast<const char *>(params[1]), plSceneNode::Index(), "", str);
|
||||
PrintString(str);
|
||||
if( !nodeKey )
|
||||
return;
|
||||
@ -4307,7 +4280,7 @@ PF_CONSOLE_CMD( Access,
|
||||
char str[256];
|
||||
char* preFix = params[0];
|
||||
plString name = plString::Format("%s_plMorphSequence_0", preFix);
|
||||
plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str);
|
||||
plKey key = FindObjectByName(name, plMorphSequence::Index(), "", str);
|
||||
PrintString(str);
|
||||
if (!key)
|
||||
return;
|
||||
@ -4332,7 +4305,7 @@ PF_CONSOLE_CMD( Access,
|
||||
char str[256];
|
||||
char* preFix = params[0];
|
||||
plString name = plString::Format("%s_plMorphSequence_2", preFix);
|
||||
plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str);
|
||||
plKey key = FindObjectByName(name, plMorphSequence::Index(), "", str);
|
||||
PrintString(str);
|
||||
if (!key)
|
||||
return;
|
||||
@ -4353,7 +4326,7 @@ PF_CONSOLE_CMD( Access,
|
||||
char str[256];
|
||||
char* preFix = params[0];
|
||||
plString name = plString::Format("%s_plMorphSequence_2", preFix);
|
||||
plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str);
|
||||
plKey key = FindObjectByName(name, plMorphSequence::Index(), "", str);
|
||||
PrintString(str);
|
||||
if (!key)
|
||||
return;
|
||||
@ -4572,7 +4545,7 @@ PF_CONSOLE_CMD( Access,
|
||||
"Test fading on visibility" )
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if( !key )
|
||||
return;
|
||||
@ -4604,7 +4577,7 @@ PF_CONSOLE_CMD( Access,
|
||||
"Set the los test marker" )
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if( !key )
|
||||
return;
|
||||
@ -4618,7 +4591,7 @@ PF_CONSOLE_CMD( Access,
|
||||
"Set the Los hack marker" )
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
|
||||
plSceneObject* so = nil;
|
||||
@ -4693,7 +4666,7 @@ PF_CONSOLE_CMD( Access,
|
||||
"Fire shot along gun's z-axis, creating decal of radius <radius>, with optional max-range (def 1000)" )
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if( !key )
|
||||
return;
|
||||
@ -4774,7 +4747,7 @@ PF_CONSOLE_CMD( Access,
|
||||
"Add particle system <psys> to bulletMgr <bull>")
|
||||
{
|
||||
char str[256];
|
||||
plKey bullKey = FindObjectByName(plString::FromUtf8(params[0]), plDynaBulletMgr::Index(), nil, str, false);
|
||||
plKey bullKey = FindObjectByName(static_cast<const char *>(params[0]), plDynaBulletMgr::Index(), "", str, false);
|
||||
PrintString(str);
|
||||
if( !(bullKey && bullKey->GetObjectPtr()) )
|
||||
{
|
||||
@ -4782,7 +4755,7 @@ PF_CONSOLE_CMD( Access,
|
||||
return;
|
||||
}
|
||||
|
||||
plKey sysKey = FindSceneObjectByName(plString::FromUtf8(params[1]), nil, str);
|
||||
plKey sysKey = FindSceneObjectByName(static_cast<const char *>(params[1]), "", str);
|
||||
if( !(sysKey && sysKey->GetObjectPtr()) )
|
||||
{
|
||||
PrintString("Psys not found");
|
||||
@ -4982,7 +4955,7 @@ static void IDisplayWaveVal(PrintFunk PrintString, plWaveSet7* wave, plWaveCmd::
|
||||
static plWaveSet7* IGetWaveSet(PrintFunk PrintString, const plString& name)
|
||||
{
|
||||
char str[256];
|
||||
plKey waveKey = FindObjectByName(name, plWaveSet7::Index(), nil, str, false);
|
||||
plKey waveKey = FindObjectByName(name, plWaveSet7::Index(), "", str, false);
|
||||
PrintString(str);
|
||||
if (!waveKey)
|
||||
return nil;
|
||||
@ -5463,7 +5436,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Drawable, // Group name, Function name
|
||||
"Enable or disable drawing of a sceneobject" ) // Help string
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if (!key)
|
||||
return;
|
||||
@ -5482,7 +5455,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Physical, // Group name, Function name
|
||||
"Enable or disable the physical of a sceneobject" ) // Help string
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if (!key)
|
||||
return;
|
||||
@ -5524,7 +5497,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Audible, // Group name, Function name
|
||||
"Enable or disable the audible of a sceneobject" ) // Help string
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if (!key)
|
||||
return;
|
||||
@ -5543,7 +5516,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, All, // Group name, Function name
|
||||
"Enable or disable all fxns of a sceneobject" ) // Help string
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if (!key)
|
||||
return;
|
||||
@ -5563,10 +5536,10 @@ PF_CONSOLE_CMD( SceneObject, Attach, // Group name, Function name
|
||||
{
|
||||
char str[256];
|
||||
|
||||
plString childName = plString::FromUtf8(params[0]);
|
||||
plString parentName = plString::FromUtf8(params[1]);
|
||||
plString childName = static_cast<const char *>(params[0]);
|
||||
plString parentName = static_cast<const char *>(params[1]);
|
||||
|
||||
plKey childKey = FindSceneObjectByName(childName, nil, str);
|
||||
plKey childKey = FindSceneObjectByName(childName, "", str);
|
||||
if( !childKey )
|
||||
{
|
||||
PrintString(str);
|
||||
@ -5580,7 +5553,7 @@ PF_CONSOLE_CMD( SceneObject, Attach, // Group name, Function name
|
||||
return;
|
||||
}
|
||||
|
||||
plKey parentKey = FindSceneObjectByName(parentName, nil, str);
|
||||
plKey parentKey = FindSceneObjectByName(parentName, "", str);
|
||||
if( !parentKey )
|
||||
{
|
||||
PrintString(str);
|
||||
@ -5601,9 +5574,9 @@ PF_CONSOLE_CMD( SceneObject, Detach, // Group name, Function name
|
||||
{
|
||||
char str[256];
|
||||
|
||||
plString childName = plString::FromUtf8(params[0]);
|
||||
plString childName = static_cast<const char *>(params[0]);
|
||||
|
||||
plKey childKey = FindSceneObjectByName(childName, nil, str);
|
||||
plKey childKey = FindSceneObjectByName(childName, "", str);
|
||||
if( !childKey )
|
||||
{
|
||||
PrintString(str);
|
||||
@ -6186,7 +6159,7 @@ PF_CONSOLE_GROUP( ParticleSystem ) // Defines a main command group
|
||||
void UpdateParticleParam(const plString &objName, int32_t paramID, float value, void (*PrintString)(const char *))
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(objName, nil, str);
|
||||
plKey key = FindSceneObjectByName(objName, "", str);
|
||||
PrintString(str);
|
||||
if (key == nil) return;
|
||||
|
||||
@ -6309,7 +6282,7 @@ PF_CONSOLE_CMD( ParticleSystem,
|
||||
"Creates a system (if necessary) on the avatar, and transfers particles" )
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
if (key == nil)
|
||||
return;
|
||||
|
||||
@ -6317,7 +6290,7 @@ PF_CONSOLE_CMD( ParticleSystem,
|
||||
if (so == nil)
|
||||
return;
|
||||
|
||||
plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
if (avMod)
|
||||
(new plParticleTransferMsg(nil, avMod->GetKey(), 0, so->GetKey(), (int)params[1]))->Send();
|
||||
}
|
||||
@ -6328,7 +6301,7 @@ PF_CONSOLE_CMD( ParticleSystem,
|
||||
"Flag some particles for death." )
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
if (key == nil)
|
||||
return;
|
||||
|
||||
@ -6350,7 +6323,7 @@ PF_CONSOLE_SUBGROUP( ParticleSystem, Flock )
|
||||
static plParticleFlockEffect *FindFlock(const plString &objName)
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(objName, nil, str);
|
||||
plKey key = FindSceneObjectByName(objName, "", str);
|
||||
|
||||
if (key == nil)
|
||||
return nil;
|
||||
@ -6528,7 +6501,7 @@ PF_CONSOLE_GROUP( Animation ) // Defines a main command group
|
||||
void SendAnimCmdMsg(const plString &objName, plMessage *msg)
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(objName, nil, str);
|
||||
plKey key = FindSceneObjectByName(objName, "", str);
|
||||
if (key != nil)
|
||||
{
|
||||
msg->AddReceiver(key);
|
||||
|
@ -84,8 +84,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plUnifiedTime/plUnifiedTime.h"
|
||||
//end for agedefn test
|
||||
|
||||
#include "plFile/hsFiles.h"
|
||||
|
||||
#include "plStatusLog/plStatusLog.h"
|
||||
|
||||
#include "hsTemplates.h"
|
||||
@ -196,9 +194,9 @@ PF_CONSOLE_FILE_DUMMY(Net)
|
||||
// utility functions
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
plKey FindSceneObjectByName(const plString& name, const char* ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByName(const plString& name, int type, const char* ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByNameAndType(const plString& name, const char* typeName, const char* ageName,
|
||||
plKey FindSceneObjectByName(const plString& name, const plString& ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByName(const plString& name, int type, const plString& ageName, char* statusStr, bool subString=false);
|
||||
plKey FindObjectByNameAndType(const plString& name, const char* typeName, const plString& ageName,
|
||||
char* statusStr, bool subString=false);
|
||||
void PrintStringF(void pfun(const char *),const char * fmt, ...);
|
||||
|
||||
@ -507,9 +505,9 @@ PF_CONSOLE_CMD( Net, // groupName
|
||||
SetObjUpdateFreq, // fxnName
|
||||
"string objName, float freqInSecs", // paramList
|
||||
"Instructs the server to only send me updates about this object periodically" ) // helpString
|
||||
{
|
||||
{
|
||||
char str[256];
|
||||
plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
|
||||
plKey key = FindSceneObjectByName(static_cast<const char *>(params[0]), "", str);
|
||||
PrintString(str);
|
||||
if (!key)
|
||||
return;
|
||||
|
@ -49,75 +49,46 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "HeadSpin.h"
|
||||
#include "hsExceptions.h"
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
|
||||
#include "hsWindows.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
//// ParseDirectory //////////////////////////////////////////////////////////
|
||||
|
||||
bool pfConsoleDirSrc::ParseDirectory(const plFileName& path, const plString& mask /* = L"*.*" */)
|
||||
bool pfConsoleDirSrc::ParseDirectory(const plFileName& path, const char* mask /* = L"*.*" */)
|
||||
{
|
||||
WIN32_FIND_DATAW findInfo;
|
||||
HANDLE handle;
|
||||
|
||||
hsAssert( fEngine != nil, "Cannot do a dir execute without an engine!" );
|
||||
|
||||
handle = FindFirstFileW(plFileName::Join(path, mask).AsString().ToWchar(), &findInfo);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
do
|
||||
std::vector<plFileName> files = plFileSystem::ListDir(path, mask);
|
||||
for (auto iter = files.begin(); iter != files.end(); ++iter)
|
||||
{
|
||||
if (!( findInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
plFileName name = iter->GetFileName();
|
||||
if (AlreadyProcessedFile(path, name))
|
||||
continue;
|
||||
AddProcessedFile(path, name);
|
||||
if (!fEngine->ExecuteFile(*iter))
|
||||
{
|
||||
plFileName name = plString::FromWchar(findInfo.cFileName);
|
||||
plFileName fileAndPath = plFileName::Join(path, name);
|
||||
if (AlreadyProcessedFile(path, name))
|
||||
continue;
|
||||
AddProcessedFile(path, name);
|
||||
if (!fEngine->ExecuteFile(fileAndPath))
|
||||
{
|
||||
// Change the following line once we have a better way of reporting
|
||||
// errors in the parsing
|
||||
std::wstringstream error;
|
||||
std::wstringstream caption;
|
||||
wchar_t* errorMsg = hsStringToWString(fEngine->GetErrorMsg());
|
||||
wchar_t* errorLine = hsStringToWString(fEngine->GetLastErrorLine());
|
||||
// Change the following line once we have a better way of reporting
|
||||
// errors in the parsing
|
||||
plStringStream error, caption;
|
||||
|
||||
caption << L"Error parsing " << findInfo.cFileName;
|
||||
error << errorMsg << L":\n\nCommand: '" << errorLine << L"'\n\nPress OK to continue parsing files.";
|
||||
caption << "Error parsing " << name.AsString();
|
||||
error << fEngine->GetErrorMsg() << ":\n\nCommand: '" << fEngine->GetLastErrorLine()
|
||||
<< "'\n\nPress OK to continue parsing files.";
|
||||
|
||||
hsMessageBox(error.str().c_str(), caption.str().c_str(), hsMessageBoxNormal);
|
||||
hsMessageBox(error.GetString().c_str(), caption.GetString().c_str(), hsMessageBoxNormal);
|
||||
|
||||
delete [] errorMsg;
|
||||
delete [] errorLine;
|
||||
|
||||
FindClose(handle);
|
||||
SetCheckProcessedFiles(true);
|
||||
return false;
|
||||
}
|
||||
SetCheckProcessedFiles(true);
|
||||
return false;
|
||||
}
|
||||
} while (FindNextFileW(handle, &findInfo) != 0);
|
||||
}
|
||||
|
||||
FindClose(handle);
|
||||
SetCheckProcessedFiles(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error This needs to be implemented for this platform!!!!
|
||||
|
||||
#endif
|
||||
|
||||
void pfConsoleDirSrc::ResetProcessedFiles()
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<fProcessedFiles.size(); i++)
|
||||
delete fProcessedFiles[i];
|
||||
fProcessedFiles.clear();
|
||||
fProcessedFiles.clear();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -71,14 +71,14 @@ class pfConsoleDirSrc
|
||||
{
|
||||
plFileName fPath;
|
||||
plFileName fFile;
|
||||
FileName() : fPath(""), fFile("") {}
|
||||
FileName() {}
|
||||
FileName(const plFileName& p, const plFileName& f) : fPath(p), fFile(f) {}
|
||||
};
|
||||
std::vector<FileName*> fProcessedFiles; // list of init files we've already executed
|
||||
bool fCheckProcessedFiles; // set to check and skip files init files we've already executed
|
||||
public:
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine) : fCheckProcessedFiles(false) { fEngine = engine; }
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine, const plFileName& path, const plString& mask = "*.ini")
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine, const plFileName& path, const char* mask = "*.ini")
|
||||
: fCheckProcessedFiles(false)
|
||||
{
|
||||
fEngine = engine;
|
||||
@ -88,7 +88,7 @@ class pfConsoleDirSrc
|
||||
~pfConsoleDirSrc() { ResetProcessedFiles(); }
|
||||
|
||||
// Steps through the given directory and executes all files with the console engine
|
||||
bool ParseDirectory(const plFileName& path, const plString& mask = "*.*");
|
||||
bool ParseDirectory(const plFileName& path, const char* mask = "*.*");
|
||||
|
||||
void ResetProcessedFiles();
|
||||
bool AlreadyProcessedFile(const plFileName& path, const plFileName& file);
|
||||
|
@ -305,7 +305,7 @@ static bool DumpSpecificMsgInfo(plMessage* msg, plString& info)
|
||||
|
||||
case plClientMsg::kLoadAgeKeys:
|
||||
case plClientMsg::kReleaseAgeKeys:
|
||||
info += plString::Format(" - Age: %s", clientMsg->GetAgeName());
|
||||
info += plString::Format(" - Age: %s", clientMsg->GetAgeName().c_str());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plCrashSrv.h"
|
||||
#include "plCrash_Private.h"
|
||||
#include "plFile/plFileUtils.h"
|
||||
#include "plProduct.h"
|
||||
#include "plFileSystem.h"
|
||||
|
||||
|
@ -2535,10 +2535,10 @@ plKey pfJournalBook::IGetMipmapKey( const wchar_t *name, const plLocation &loc
|
||||
// Do a search through our current age with just the name given
|
||||
if( plNetClientMgr::GetInstance() != nil )
|
||||
{
|
||||
const char *thisAge = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName();
|
||||
if( thisAge != nil )
|
||||
plString thisAge = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName();
|
||||
if (!thisAge.IsNull())
|
||||
{
|
||||
key = plKeyFinder::Instance().StupidSearch( thisAge, nil, plMipmap::Index(), cName, true );
|
||||
key = plKeyFinder::Instance().StupidSearch( thisAge, "", plMipmap::Index(), cName, true );
|
||||
if( key != nil )
|
||||
{
|
||||
return key;
|
||||
|
@ -51,7 +51,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plResMgr/plLocalization.h"
|
||||
|
||||
#include "plFile/hsFiles.h"
|
||||
#include "plFile/plEncryptedStream.h"
|
||||
#include "plStatusLog/plStatusLog.h"
|
||||
|
||||
@ -94,7 +93,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool fWeExploded; // alternative to massive error stack
|
||||
plString fFilename;
|
||||
plFileName fFilename;
|
||||
XML_Parser fParser;
|
||||
|
||||
struct tagInfo
|
||||
@ -121,7 +120,7 @@ protected:
|
||||
public:
|
||||
LocalizationXMLFile() : fWeExploded(false) { }
|
||||
|
||||
bool Parse(const plString & fileName); // returns false on failure
|
||||
bool Parse(const plFileName & fileName); // returns false on failure
|
||||
void AddError(const plString & errorText);
|
||||
};
|
||||
|
||||
@ -354,7 +353,7 @@ void LocalizationXMLFile::IHandleTranslationTag(const LocalizationXMLFile::tagIn
|
||||
|
||||
//// Parse() /////////////////////////////////////////////////////////
|
||||
|
||||
bool LocalizationXMLFile::Parse(const plString& fileName)
|
||||
bool LocalizationXMLFile::Parse(const plFileName& fileName)
|
||||
{
|
||||
fFilename = fileName;
|
||||
|
||||
@ -382,10 +381,10 @@ bool LocalizationXMLFile::Parse(const plString& fileName)
|
||||
XML_SetCharacterDataHandler(fParser, HandleData);
|
||||
XML_SetUserData(fParser, (void*)this);
|
||||
|
||||
hsStream *xmlStream = plEncryptedStream::OpenEncryptedFile(fileName.c_str());
|
||||
hsStream *xmlStream = plEncryptedStream::OpenEncryptedFile(fileName);
|
||||
if (!xmlStream)
|
||||
{
|
||||
pfLocalizationDataMgr::GetLog()->AddLineF("ERROR: Can't open file stream for %s", fileName.c_str());
|
||||
pfLocalizationDataMgr::GetLog()->AddLineF("ERROR: Can't open file stream for %s", fileName.AsString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -437,15 +436,15 @@ void LocalizationXMLFile::AddError(const plString& errorText)
|
||||
class LocalizationDatabase
|
||||
{
|
||||
protected:
|
||||
plString fDirectory; // the directory we're supposed to parse
|
||||
plFileName fDirectory; // the directory we're supposed to parse
|
||||
|
||||
std::vector<LocalizationXMLFile> fFiles; // the various XML files in that directory
|
||||
|
||||
LocalizationXMLFile::ageMap fData;
|
||||
|
||||
LocalizationXMLFile::element IMergeElementData(LocalizationXMLFile::element firstElement, LocalizationXMLFile::element secondElement, const plString & fileName, const plString & path);
|
||||
LocalizationXMLFile::set IMergeSetData(LocalizationXMLFile::set firstSet, LocalizationXMLFile::set secondSet, const plString & fileName, const plString & path);
|
||||
LocalizationXMLFile::age IMergeAgeData(LocalizationXMLFile::age firstAge, LocalizationXMLFile::age secondAge, const plString & fileName, const plString & path);
|
||||
LocalizationXMLFile::element IMergeElementData(LocalizationXMLFile::element firstElement, LocalizationXMLFile::element secondElement, const plFileName & fileName, const plString & path);
|
||||
LocalizationXMLFile::set IMergeSetData(LocalizationXMLFile::set firstSet, LocalizationXMLFile::set secondSet, const plFileName & fileName, const plString & path);
|
||||
LocalizationXMLFile::age IMergeAgeData(LocalizationXMLFile::age firstAge, LocalizationXMLFile::age secondAge, const plFileName & fileName, const plString & path);
|
||||
void IMergeData(); // merge all localization data in the files
|
||||
|
||||
void IVerifyElement(const plString &ageName, const plString &setName, LocalizationXMLFile::set::iterator& curElement);
|
||||
@ -456,7 +455,7 @@ protected:
|
||||
public:
|
||||
LocalizationDatabase() {}
|
||||
|
||||
void Parse(const plString & directory);
|
||||
void Parse(const plFileName & directory);
|
||||
LocalizationXMLFile::ageMap GetData() {return fData;}
|
||||
};
|
||||
|
||||
@ -466,7 +465,7 @@ public:
|
||||
|
||||
//// IMergeElementData ///////////////////////////////////////////////
|
||||
|
||||
LocalizationXMLFile::element LocalizationDatabase::IMergeElementData(LocalizationXMLFile::element firstElement, LocalizationXMLFile::element secondElement, const plString & fileName, const plString & path)
|
||||
LocalizationXMLFile::element LocalizationDatabase::IMergeElementData(LocalizationXMLFile::element firstElement, LocalizationXMLFile::element secondElement, const plFileName & fileName, const plString & path)
|
||||
{
|
||||
// copy the data over, alerting the user to any duplicate translations
|
||||
LocalizationXMLFile::element::iterator curTranslation;
|
||||
@ -475,7 +474,7 @@ LocalizationXMLFile::element LocalizationDatabase::IMergeElementData(Localizatio
|
||||
if (firstElement.find(curTranslation->first) != firstElement.end())
|
||||
{
|
||||
pfLocalizationDataMgr::GetLog()->AddLineF("Duplicate %s translation for %s found in file %s. Ignoring second translation.",
|
||||
curTranslation->first.c_str(), path.c_str(), fileName.c_str());
|
||||
curTranslation->first.c_str(), path.c_str(), fileName.AsString().c_str());
|
||||
}
|
||||
else
|
||||
firstElement[curTranslation->first] = curTranslation->second;
|
||||
@ -486,7 +485,7 @@ LocalizationXMLFile::element LocalizationDatabase::IMergeElementData(Localizatio
|
||||
|
||||
//// IMergeSetData ///////////////////////////////////////////////////
|
||||
|
||||
LocalizationXMLFile::set LocalizationDatabase::IMergeSetData(LocalizationXMLFile::set firstSet, LocalizationXMLFile::set secondSet, const plString & fileName, const plString & path)
|
||||
LocalizationXMLFile::set LocalizationDatabase::IMergeSetData(LocalizationXMLFile::set firstSet, LocalizationXMLFile::set secondSet, const plFileName & fileName, const plString & path)
|
||||
{
|
||||
// Merge all the elements
|
||||
LocalizationXMLFile::set::iterator curElement;
|
||||
@ -505,7 +504,7 @@ LocalizationXMLFile::set LocalizationDatabase::IMergeSetData(LocalizationXMLFile
|
||||
|
||||
//// IMergeAgeData ///////////////////////////////////////////////////
|
||||
|
||||
LocalizationXMLFile::age LocalizationDatabase::IMergeAgeData(LocalizationXMLFile::age firstAge, LocalizationXMLFile::age secondAge, const plString & fileName, const plString & path)
|
||||
LocalizationXMLFile::age LocalizationDatabase::IMergeAgeData(LocalizationXMLFile::age firstAge, LocalizationXMLFile::age secondAge, const plFileName & fileName, const plString & path)
|
||||
{
|
||||
// Merge all the sets
|
||||
LocalizationXMLFile::age::iterator curSet;
|
||||
@ -640,24 +639,21 @@ void LocalizationDatabase::IVerifyData()
|
||||
|
||||
//// Parse() /////////////////////////////////////////////////////////
|
||||
|
||||
void LocalizationDatabase::Parse(const plString & directory)
|
||||
void LocalizationDatabase::Parse(const plFileName & directory)
|
||||
{
|
||||
fDirectory = directory;
|
||||
fFiles.clear();
|
||||
|
||||
char filename[255];
|
||||
hsFolderIterator xmlFolder((directory + PATH_SEPARATOR_STR).c_str());
|
||||
while(xmlFolder.NextFileSuffix(".loc"))
|
||||
std::vector<plFileName> locFiles = plFileSystem::ListDir(directory, "*.loc");
|
||||
for (auto iter = locFiles.begin(); iter != locFiles.end(); ++iter)
|
||||
{
|
||||
xmlFolder.GetPathAndName(filename);
|
||||
|
||||
LocalizationXMLFile newFile;
|
||||
bool retVal = newFile.Parse(filename);
|
||||
bool retVal = newFile.Parse(*iter);
|
||||
if (!retVal)
|
||||
pfLocalizationDataMgr::GetLog()->AddLineF("WARNING: Errors in file %s", filename);
|
||||
pfLocalizationDataMgr::GetLog()->AddLineF("WARNING: Errors in file %s", iter->GetFileName().c_str());
|
||||
|
||||
fFiles.push_back(newFile);
|
||||
pfLocalizationDataMgr::GetLog()->AddLineF("File %s parsed and added to database", filename);
|
||||
pfLocalizationDataMgr::GetLog()->AddLineF("File %s parsed and added to database", iter->GetFileName().c_str());
|
||||
}
|
||||
|
||||
IMergeData();
|
||||
@ -822,7 +818,7 @@ plStatusLog *pfLocalizationDataMgr::fLog = nil; // output logfile
|
||||
|
||||
//// Constructor/Destructor //////////////////////////////////////////
|
||||
|
||||
pfLocalizationDataMgr::pfLocalizationDataMgr(const plString & path)
|
||||
pfLocalizationDataMgr::pfLocalizationDataMgr(const plFileName & path)
|
||||
{
|
||||
hsAssert(!fInstance, "Tried to create the localization data manager more than once!");
|
||||
fInstance = this;
|
||||
@ -932,7 +928,7 @@ void pfLocalizationDataMgr::IConvertAge(LocAgeInfo *ageInfo, const plString & cu
|
||||
|
||||
//// IWriteText //////////////////////////////////////////////////////
|
||||
|
||||
void pfLocalizationDataMgr::IWriteText(const plString & filename, const plString & ageName, const plString & languageName)
|
||||
void pfLocalizationDataMgr::IWriteText(const plFileName & filename, const plString & ageName, const plString & languageName)
|
||||
{
|
||||
bool weWroteData = false; // did we actually write any data of consequence?
|
||||
bool setEmpty = true;
|
||||
@ -980,7 +976,7 @@ void pfLocalizationDataMgr::IWriteText(const plString & filename, const plString
|
||||
if (weWroteData)
|
||||
{
|
||||
// now spit the results out to the file
|
||||
hsStream *xmlStream = plEncryptedStream::OpenEncryptedFileWrite(filename.c_str());
|
||||
hsStream *xmlStream = plEncryptedStream::OpenEncryptedFileWrite(filename);
|
||||
xmlStream->Write(fileData.GetLength(), fileData.GetString().c_str());
|
||||
xmlStream->Close();
|
||||
delete xmlStream;
|
||||
@ -989,7 +985,7 @@ void pfLocalizationDataMgr::IWriteText(const plString & filename, const plString
|
||||
|
||||
//// Initialize //////////////////////////////////////////////////////
|
||||
|
||||
void pfLocalizationDataMgr::Initialize(const plString & path)
|
||||
void pfLocalizationDataMgr::Initialize(const plFileName & path)
|
||||
{
|
||||
if (fInstance)
|
||||
return;
|
||||
@ -1194,7 +1190,7 @@ bool pfLocalizationDataMgr::DeleteElement(const plString & name)
|
||||
|
||||
//// WriteDatabaseToDisk /////////////////////////////////////////////
|
||||
|
||||
void pfLocalizationDataMgr::WriteDatabaseToDisk(const plString & path)
|
||||
void pfLocalizationDataMgr::WriteDatabaseToDisk(const plFileName & path)
|
||||
{
|
||||
std::vector<plString> ageNames = GetAgeList();
|
||||
std::vector<plString> languageNames = IGetAllLanguageNames();
|
||||
@ -1202,7 +1198,9 @@ void pfLocalizationDataMgr::WriteDatabaseToDisk(const plString & path)
|
||||
{
|
||||
for (int curLanguage = 0; curLanguage < languageNames.size(); curLanguage++)
|
||||
{
|
||||
IWriteText(plString::Format("%s/%s%s.loc", path, ageNames[curAge].c_str(), languageNames[curLanguage].c_str()), ageNames[curAge], languageNames[curLanguage]);
|
||||
plFileName locPath = plFileName::Join(path, plString::Format("%s%s.loc",
|
||||
ageNames[curAge].c_str(), languageNames[curLanguage].c_str()));
|
||||
IWriteText(locPath, ageNames[curAge], languageNames[curLanguage]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include <map>
|
||||
|
||||
#include "pfLocalizedString.h"
|
||||
#include "plFileSystem.h"
|
||||
|
||||
class plStatusLog;
|
||||
class plString;
|
||||
|
||||
// Helper classes/structs that are only used in this main class
|
||||
class LocalizationDatabase;
|
||||
@ -106,7 +106,7 @@ protected:
|
||||
// Contains all localized strings, the key is the Age.Set.Name specified by XML, in localizedElement, the key is the language string
|
||||
pf3PartMap<localizedElement> fLocalizedElements;
|
||||
|
||||
plString fDataPath;
|
||||
plFileName fDataPath;
|
||||
|
||||
localizedElement ICreateLocalizedElement(); // ease of use function that creates a basic localized element object
|
||||
|
||||
@ -117,13 +117,13 @@ protected:
|
||||
void IConvertSet(LocSetInfo *setInfo, const plString & curPath);
|
||||
void IConvertAge(LocAgeInfo *ageInfo, const plString & curPath);
|
||||
|
||||
void IWriteText(const plString & filename, const plString & ageName, const plString & languageName); // Write localization text to the specified file
|
||||
void IWriteText(const plFileName & filename, const plString & ageName, const plString & languageName); // Write localization text to the specified file
|
||||
|
||||
pfLocalizationDataMgr(const plString & path);
|
||||
pfLocalizationDataMgr(const plFileName & path);
|
||||
public:
|
||||
virtual ~pfLocalizationDataMgr();
|
||||
|
||||
static void Initialize(const plString & path);
|
||||
static void Initialize(const plFileName & path);
|
||||
static void Shutdown();
|
||||
static pfLocalizationDataMgr &Instance(void) {return *fInstance;}
|
||||
static bool InstanceValid(void) {return fInstance != nil;}
|
||||
@ -162,7 +162,7 @@ public:
|
||||
bool DeleteElement(const plString & name);
|
||||
|
||||
// Writes the current database to the disk (editor only). It will create all the files and put them into path
|
||||
void WriteDatabaseToDisk(const plString & path);
|
||||
void WriteDatabaseToDisk(const plFileName & path);
|
||||
|
||||
void OutputTreeToLog(); // prints the localization tree to the log file
|
||||
};
|
||||
|
@ -73,7 +73,7 @@ pfLocalizationMgr::~pfLocalizationMgr()
|
||||
|
||||
//// Initialize //////////////////////////////////////////////////////
|
||||
|
||||
void pfLocalizationMgr::Initialize(const plString & dataPath)
|
||||
void pfLocalizationMgr::Initialize(const plFileName & dataPath)
|
||||
{
|
||||
if (fInstance)
|
||||
return;
|
||||
|
@ -51,6 +51,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "HeadSpin.h"
|
||||
|
||||
class plFileName;
|
||||
|
||||
class pfLocalizationMgr
|
||||
{
|
||||
private:
|
||||
@ -60,7 +62,7 @@ protected:
|
||||
public:
|
||||
virtual ~pfLocalizationMgr();
|
||||
|
||||
static void Initialize(const plString & dataPath);
|
||||
static void Initialize(const plFileName & dataPath);
|
||||
static void Shutdown();
|
||||
static pfLocalizationMgr &Instance(void) {return *fInstance;}
|
||||
static bool InstanceValid(void) {return fInstance != nil;}
|
||||
|
@ -43,19 +43,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsStream.h"
|
||||
|
||||
|
||||
pfMovieEventMsg::~pfMovieEventMsg()
|
||||
{
|
||||
delete [] fMovieName;
|
||||
}
|
||||
|
||||
|
||||
void pfMovieEventMsg::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plMessage::IMsgRead(stream, mgr);
|
||||
|
||||
fReason = (Reason)stream->ReadByte();
|
||||
|
||||
fMovieName = stream->ReadSafeString();
|
||||
fMovieName = stream->ReadSafeString_TEMP();
|
||||
}
|
||||
|
||||
void pfMovieEventMsg::Write(hsStream* stream, hsResMgr* mgr)
|
||||
@ -64,6 +58,6 @@ void pfMovieEventMsg::Write(hsStream* stream, hsResMgr* mgr)
|
||||
|
||||
stream->WriteByte(fReason);
|
||||
|
||||
stream->WriteSafeString(fMovieName);
|
||||
stream->WriteSafeString(fMovieName.AsString());
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#define pfMovieEventMsg_h_inc
|
||||
|
||||
#include "pnMessage/plMessage.h"
|
||||
#include "plFileSystem.h"
|
||||
|
||||
class pfMovieEventMsg : public plMessage
|
||||
{
|
||||
@ -54,23 +55,18 @@ public:
|
||||
Reason fReason;
|
||||
|
||||
|
||||
char* fMovieName;
|
||||
plFileName fMovieName;
|
||||
|
||||
pfMovieEventMsg(const char* movieName, Reason reason=kMovieDone) : plMessage(nil, nil, nil)
|
||||
pfMovieEventMsg(const plFileName& movieName, Reason reason=kMovieDone) : plMessage(nil, nil, nil)
|
||||
{
|
||||
fReason = reason;
|
||||
if (movieName)
|
||||
fMovieName = hsStrcpy(movieName);
|
||||
else
|
||||
fMovieName = nil;
|
||||
fMovieName = movieName;
|
||||
}
|
||||
|
||||
pfMovieEventMsg() : plMessage(nil, nil, nil), fMovieName(nil), fReason(kMovieDone)
|
||||
pfMovieEventMsg() : plMessage(nil, nil, nil), fReason(kMovieDone)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~pfMovieEventMsg();
|
||||
|
||||
|
||||
CLASSNAME_REGISTER(pfMovieEventMsg);
|
||||
GETINTERFACE_ANY(pfMovieEventMsg, plMessage);
|
||||
|
@ -208,7 +208,7 @@ PyObject* cyMisc::FindSceneObject(const plString& name, const char* ageName)
|
||||
const char* theAge = ageName;
|
||||
if ( ageName[0] == 0 )
|
||||
theAge = nil;
|
||||
key=plKeyFinder::Instance().StupidSearch(theAge,nil,plSceneObject::Index(), name, false);
|
||||
key=plKeyFinder::Instance().StupidSearch(theAge, "", plSceneObject::Index(), name, false);
|
||||
}
|
||||
|
||||
if ( key == nil )
|
||||
@ -1457,7 +1457,7 @@ void cyMisc::PageOutNode(const char* nodeName)
|
||||
plClientMsg* pMsg1 = new plClientMsg(plClientMsg::kUnloadRoom);
|
||||
plKey clientKey = hsgResMgr::ResMgr()->FindKey( kClient_KEY );
|
||||
pMsg1->AddReceiver( clientKey );
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation(nil, nodeName));
|
||||
pMsg1->AddRoomLoc(plKeyFinder::Instance().FindLocation("", nodeName));
|
||||
plgDispatch::MsgSend(pMsg1);
|
||||
}
|
||||
}
|
||||
@ -2484,7 +2484,7 @@ void cyMisc::RebuildCameraStack(const plString& name, const char* ageName)
|
||||
|
||||
if ( !name.IsEmpty() )
|
||||
{
|
||||
key=plKeyFinder::Instance().StupidSearch(nil,nil,plSceneObject::Index(), name, false);
|
||||
key=plKeyFinder::Instance().StupidSearch("", "", plSceneObject::Index(), name, false);
|
||||
}
|
||||
if ( key == nil )
|
||||
{
|
||||
@ -2685,7 +2685,7 @@ void cyMisc::FakeLinkToObjectNamed(const plString& name)
|
||||
plKey key = nil;
|
||||
if ( !name.IsEmpty() )
|
||||
{
|
||||
key = plKeyFinder::Instance().StupidSearch(nil,nil,plSceneObject::Index(), name, false);
|
||||
key = plKeyFinder::Instance().StupidSearch("", "", plSceneObject::Index(), name, false);
|
||||
}
|
||||
|
||||
if (!key)
|
||||
@ -2790,28 +2790,24 @@ bool cyMisc::DumpLogs(const std::wstring & folder)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool cyMisc::FileExists(const std::wstring & filename)
|
||||
bool cyMisc::FileExists(const plFileName & filename)
|
||||
{
|
||||
return PathDoesFileExist(filename.c_str());
|
||||
return plFileInfo(filename).Exists();
|
||||
}
|
||||
|
||||
bool cyMisc::CreateDir(const std::wstring & directory)
|
||||
bool cyMisc::CreateDir(const plFileName & directory)
|
||||
{
|
||||
return PathCreateDirectory(directory.c_str(), kPathCreateDirFlagEntireTree) == kPathCreateDirSuccess;
|
||||
return plFileSystem::CreateDir(directory, true);
|
||||
}
|
||||
|
||||
std::wstring cyMisc::GetUserPath()
|
||||
plFileName cyMisc::GetUserPath()
|
||||
{
|
||||
wchar_t path[MAX_PATH];
|
||||
PathGetUserDirectory(path, arrsize(path));
|
||||
return path;
|
||||
return plFileSystem::GetUserDataPath();
|
||||
}
|
||||
|
||||
std::wstring cyMisc::GetInitPath()
|
||||
plFileName cyMisc::GetInitPath()
|
||||
{
|
||||
wchar_t path[MAX_PATH];
|
||||
PathGetInitDirectory(path, arrsize(path));
|
||||
return path;
|
||||
return plFileSystem::GetInitPath();
|
||||
}
|
||||
|
||||
void cyMisc::SetBehaviorNetFlags(pyKey & behKey, bool netForce, bool netProp)
|
||||
|
@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#ifndef cyMisc_h
|
||||
#define cyMisc_h
|
||||
|
||||
#include <string>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NAME: cyMisc
|
||||
@ -67,6 +65,7 @@ class pyGUIDialog;
|
||||
class plPipeline;
|
||||
class plDisplayMode;
|
||||
class plUUID;
|
||||
class plFileName;
|
||||
struct PipelineParams;
|
||||
|
||||
typedef struct _object PyObject;
|
||||
@ -934,11 +933,11 @@ public:
|
||||
|
||||
static bool DumpLogs(const std::wstring & folder);
|
||||
|
||||
static bool FileExists(const std::wstring & filename);
|
||||
static bool CreateDir(const std::wstring & directory);
|
||||
static bool FileExists(const plFileName & filename);
|
||||
static bool CreateDir(const plFileName & directory);
|
||||
|
||||
static std::wstring GetUserPath();
|
||||
static std::wstring GetInitPath();
|
||||
static plFileName GetUserPath();
|
||||
static plFileName GetInitPath();
|
||||
|
||||
static void SetBehaviorNetFlags(pyKey & behKey, bool netForce, bool netProp);
|
||||
static void SendFriendInvite(const wchar_t email[], const wchar_t toName[]);
|
||||
|
@ -632,24 +632,9 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtFileExists, args, "Params: filename\nReturns t
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (PyUnicode_Check(filenameObj))
|
||||
if (PyString_CheckEx(filenameObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(filenameObj);
|
||||
wchar_t* text = new wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)filenameObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
bool retVal = cyMisc::FileExists(text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else if (PyString_Check(filenameObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(filenameObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
bool retVal = cyMisc::FileExists(wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
PYTHON_RETURN_BOOL(cyMisc::FileExists(PyString_AsStringEx(filenameObj)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -667,24 +652,9 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtCreateDir, args, "Params: directory\nCreates t
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (PyUnicode_Check(directoryObj))
|
||||
if (PyString_CheckEx(directoryObj))
|
||||
{
|
||||
int strLen = PyUnicode_GetSize(directoryObj);
|
||||
wchar_t* text = new wchar_t[strLen + 1];
|
||||
PyUnicode_AsWideChar((PyUnicodeObject*)directoryObj, text, strLen);
|
||||
text[strLen] = L'\0';
|
||||
bool retVal = cyMisc::CreateDir(text);
|
||||
delete [] text;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
}
|
||||
else if (PyString_Check(directoryObj))
|
||||
{
|
||||
// we'll allow this, just in case something goes weird
|
||||
char* text = PyString_AsString(directoryObj);
|
||||
wchar_t* wText = hsStringToWString(text);
|
||||
bool retVal = cyMisc::CreateDir(wText);
|
||||
delete [] wText;
|
||||
PYTHON_RETURN_BOOL(retVal);
|
||||
PYTHON_RETURN_BOOL(cyMisc::CreateDir(PyString_AsStringEx(directoryObj)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -695,14 +665,12 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtCreateDir, args, "Params: directory\nCreates t
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetUserPath, "Returns the unicode path to the client's root user directory. Do NOT convert to a standard string.")
|
||||
{
|
||||
std::wstring val = cyMisc::GetUserPath();
|
||||
return PyUnicode_FromWideChar(val.c_str(), val.length());
|
||||
return PyUnicode_FromStringEx(cyMisc::GetUserPath().AsString());
|
||||
}
|
||||
|
||||
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetInitPath, "Returns the unicode path to the client's init directory. Do NOT convert to a standard string.")
|
||||
{
|
||||
std::wstring val = cyMisc::GetInitPath();
|
||||
return PyUnicode_FromWideChar(val.c_str(), val.length());
|
||||
return PyUnicode_FromStringEx(cyMisc::GetInitPath().AsString());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -438,12 +438,8 @@ bool plPythonFileMod::ILoadPythonCode()
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
// get code from file and execute in module
|
||||
// see if the file exists first before trying to import it
|
||||
char pathandfile[256];
|
||||
sprintf(pathandfile, ".\\python\\%s.py",fPythonFile);
|
||||
wchar_t *wPathandfile = hsStringToWString(pathandfile);
|
||||
bool exists = PathDoesFileExist(wPathandfile);
|
||||
delete [] wPathandfile;
|
||||
if (exists)
|
||||
plFileName pyfile = plFileName::Join(".", "python", plString::Format("%s.py", fPythonFile));
|
||||
if (plFileInfo(pyfile).Exists())
|
||||
{
|
||||
char fromLoad[256];
|
||||
//sprintf(fromLoad,"from %s import *", fPythonFile);
|
||||
@ -453,7 +449,7 @@ bool plPythonFileMod::ILoadPythonCode()
|
||||
if ( PythonInterface::RunString( fromLoad, fModule) )
|
||||
{
|
||||
// we've loaded the code into our module
|
||||
// now attach the glue python code to the end
|
||||
// now attach the glue python code to the end
|
||||
if ( !PythonInterface::RunString("execfile('.\\\\python\\\\plasma\\\\glue.py')", fModule) )
|
||||
{
|
||||
// display any output (NOTE: this would be disabled in production)
|
||||
|
@ -51,7 +51,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "plPythonPack.h"
|
||||
|
||||
#include "plFile/hsFiles.h"
|
||||
#include "plFile/plSecureStream.h"
|
||||
#include "plFile/plStreamSource.h"
|
||||
|
||||
|
@ -46,7 +46,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plgDispatch.h"
|
||||
#include "plCompression/plZlibStream.h"
|
||||
#include "pnEncryption/plChecksum.h"
|
||||
#include "plFile/plFileUtils.h"
|
||||
#include "plFile/plSecureStream.h"
|
||||
#include "plFile/plStreamSource.h"
|
||||
#include "plMessage/plNetCommMsgs.h"
|
||||
@ -96,7 +95,7 @@ void GotFileSrvManifest(
|
||||
void* param,
|
||||
const wchar_t group[],
|
||||
const NetCliFileManifestEntry manifest[],
|
||||
uint32_t entryCount
|
||||
uint32_t entryCount
|
||||
) {
|
||||
pfSecurePreloader* sp = (pfSecurePreloader*)param;
|
||||
if (result == kNetErrFileNotFound)
|
||||
@ -116,10 +115,10 @@ void GotFileSrvManifest(
|
||||
}
|
||||
|
||||
void FileDownloaded(
|
||||
ENetError result,
|
||||
void* param,
|
||||
const wchar_t filename[],
|
||||
hsStream* writer
|
||||
ENetError result,
|
||||
void* param,
|
||||
const plFileName & filename,
|
||||
hsStream* writer
|
||||
) {
|
||||
pfSecurePreloader* sp = (pfSecurePreloader*)param;
|
||||
if (IS_NET_ERROR(result))
|
||||
@ -243,9 +242,9 @@ void pfSecurePreloader::PreloadNextFile()
|
||||
|
||||
// Thankfully, both callbacks have the same arguments
|
||||
if (fLegacyMode)
|
||||
NetCliAuthFileRequest(filename.AsString().ToWchar(), s, FileDownloaded, this);
|
||||
NetCliAuthFileRequest(filename, s, FileDownloaded, this);
|
||||
else
|
||||
NetCliFileDownloadRequest(filename.AsString().ToWchar(), s, FileDownloaded, this);
|
||||
NetCliFileDownloadRequest(filename, s, FileDownloaded, this);
|
||||
}
|
||||
|
||||
void pfSecurePreloader::Init()
|
||||
@ -346,8 +345,8 @@ void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEn
|
||||
const NetCliFileManifestEntry mfs = manifestEntries[i];
|
||||
bool fetchMe = true;
|
||||
hsRAMStream* s = nil;
|
||||
plFileName clientName = plString::FromWchar(mfs.clientName);
|
||||
plFileName downloadName = plString::FromWchar(mfs.downloadName);
|
||||
plFileName clientName = mfs.clientName;
|
||||
plFileName downloadName = mfs.downloadName;
|
||||
|
||||
if (plFileInfo(clientName).Exists())
|
||||
{
|
||||
@ -355,10 +354,8 @@ void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEn
|
||||
if (s)
|
||||
{
|
||||
// Damn this
|
||||
const char* md5 = hsWStringToString(mfs.md5);
|
||||
plMD5Checksum srvHash;
|
||||
srvHash.SetFromHexString(md5);
|
||||
delete[] md5;
|
||||
srvHash.SetFromHexString(mfs.md5.c_str());
|
||||
|
||||
// Now actually copare the hashes
|
||||
plMD5Checksum lclHash;
|
||||
@ -394,7 +391,7 @@ void pfSecurePreloader::PreloadManifest(const NetCliFileManifestEntry manifestEn
|
||||
PreloadNextFile();
|
||||
}
|
||||
|
||||
void pfSecurePreloader::FilePreloaded(const wchar_t* file, hsStream* stream)
|
||||
void pfSecurePreloader::FilePreloaded(const plFileName& file, hsStream* stream)
|
||||
{
|
||||
// Clear out queue
|
||||
fDownloadEntries.pop();
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
void PreloadManifest(const NetCliFileManifestEntry manifestEntries[], uint32_t entryCount);
|
||||
void PreloadManifest(const NetCliAuthFileInfo manifestEntries[], uint32_t entryCount);
|
||||
void PreloadNextFile();
|
||||
void FilePreloaded(const wchar_t* filename, hsStream* stream);
|
||||
void FilePreloaded(const plFileName& filename, hsStream* stream);
|
||||
|
||||
plOperationProgress* GetProgressBar() { return fProgress; }
|
||||
|
||||
|
@ -85,10 +85,10 @@ plLayerAVI::~plLayerAVI()
|
||||
bool plLayerAVI::IInit()
|
||||
{
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
int ret = AVIStreamOpenFromFile( &fAVIInfo->fAVIStream,
|
||||
fMovieName,
|
||||
streamtypeVIDEO,
|
||||
0,
|
||||
int ret = AVIStreamOpenFromFileW( &fAVIInfo->fAVIStream,
|
||||
fMovieName.AsString().ToWchar(),
|
||||
streamtypeVIDEO,
|
||||
0,
|
||||
OF_READ,
|
||||
NULL);
|
||||
|
||||
|
@ -51,8 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "plPipeline/hsGDeviceRef.h"
|
||||
|
||||
plLayerMovie::plLayerMovie()
|
||||
: fMovieName(nil),
|
||||
fCurrentFrame(-1),
|
||||
: fCurrentFrame(-1),
|
||||
fLength(0),
|
||||
fWidth(32),
|
||||
fHeight(32)
|
||||
@ -66,8 +65,6 @@ plLayerMovie::plLayerMovie()
|
||||
|
||||
plLayerMovie::~plLayerMovie()
|
||||
{
|
||||
delete [] fMovieName;
|
||||
|
||||
delete *fTexture;
|
||||
}
|
||||
|
||||
@ -75,10 +72,10 @@ bool plLayerMovie::ISetFault(const char* errStr)
|
||||
{
|
||||
#ifdef HS_DEBUGGING
|
||||
char buff[256];
|
||||
sprintf(buff, "ERROR %s: %s\n", fMovieName, errStr);
|
||||
sprintf(buff, "ERROR %s: %s\n", fMovieName.AsString().c_str(), errStr);
|
||||
hsStatusMessage(buff);
|
||||
#endif // HS_DEBUGGING
|
||||
*fMovieName = 0;
|
||||
fMovieName = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -115,7 +112,7 @@ bool plLayerMovie::ISetupBitmap()
|
||||
memset(b->GetImage(), 0x10, b->GetHeight() * b->GetRowBytes() );
|
||||
b->SetFlags( b->GetFlags() | plMipmap::kDontThrowAwayImage );
|
||||
|
||||
plString name = plString::Format( "%s_BMap", fMovieName );
|
||||
plString name = plString::Format( "%s_BMap", fMovieName.AsString().c_str() );
|
||||
hsgResMgr::ResMgr()->NewKey( name, b, plLocation::kGlobalFixedLoc );
|
||||
|
||||
*fTexture = (plBitmap *)b;
|
||||
@ -183,18 +180,19 @@ void plLayerMovie::Read(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
plLayerAnimation::Read(s, mgr);
|
||||
|
||||
delete [] fMovieName;
|
||||
int len = s->ReadLE32();
|
||||
if( len )
|
||||
{
|
||||
fMovieName = new char[len+1];
|
||||
s->Read(len, fMovieName);
|
||||
fMovieName[len] = 0;
|
||||
plStringBuffer<char> movieName;
|
||||
char *buf = movieName.CreateWritableBuffer(len);
|
||||
s->Read(len, buf);
|
||||
buf[len] = 0;
|
||||
fMovieName = plString(movieName);
|
||||
}
|
||||
else
|
||||
{
|
||||
hsAssert(false, "Reading empty string for movie name");
|
||||
fMovieName = nil;
|
||||
fMovieName = "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,16 +200,8 @@ void plLayerMovie::Write(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
plLayerAnimation::Write(s, mgr);
|
||||
|
||||
int len = (fMovieName) ? strlen(fMovieName) : 0;
|
||||
s->WriteLE32(len);
|
||||
if( len )
|
||||
s->Write(len, fMovieName);
|
||||
}
|
||||
|
||||
void plLayerMovie::SetMovieName(const char* n)
|
||||
{
|
||||
delete [] fMovieName;
|
||||
fMovieName = hsStrcpy(n);
|
||||
s->WriteLE32(fMovieName.GetSize());
|
||||
s->Write(fMovieName.GetSize(), fMovieName.AsString().c_str());
|
||||
}
|
||||
|
||||
bool plLayerMovie::MsgReceive(plMessage* msg)
|
||||
|
@ -53,17 +53,17 @@ class hsResMgr;
|
||||
class plLayerMovie : public plLayerAnimation
|
||||
{
|
||||
protected:
|
||||
char* fMovieName;
|
||||
plFileName fMovieName;
|
||||
|
||||
// plAnimTimeConvert fTimeConvert;
|
||||
|
||||
int32_t fCurrentFrame;
|
||||
float fLength;
|
||||
uint32_t fWidth, fHeight;
|
||||
int32_t fCurrentFrame;
|
||||
float fLength;
|
||||
uint32_t fWidth, fHeight;
|
||||
|
||||
virtual int32_t ISecsToFrame(float secs) = 0;
|
||||
virtual int32_t ISecsToFrame(float secs) = 0;
|
||||
|
||||
bool IGetFault() const { return !(fMovieName && *fMovieName); }
|
||||
bool IGetFault() const { return !fMovieName.IsValid(); }
|
||||
bool ISetFault(const char* errStr);
|
||||
bool ICheckBitmap();
|
||||
bool IMovieIsIdle(); // will call IRelease();
|
||||
@ -82,15 +82,15 @@ public:
|
||||
CLASSNAME_REGISTER( plLayerMovie );
|
||||
GETINTERFACE_ANY( plLayerMovie, plLayerAnimation );
|
||||
|
||||
virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore);
|
||||
virtual uint32_t Eval(double secs, uint32_t frame, uint32_t ignore);
|
||||
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
bool IsStopped() { return fTimeConvert.IsStopped(); }
|
||||
|
||||
void SetMovieName(const char* n);
|
||||
const char* GetMovieName() const { return fMovieName; }
|
||||
void SetMovieName(const plFileName& n) { fMovieName = n; }
|
||||
const plFileName& GetMovieName() const { return fMovieName; }
|
||||
|
||||
virtual bool MsgReceive(plMessage* msg);
|
||||
|
||||
|
Reference in New Issue
Block a user