Browse Source

Merge pull request #90 from dpogue/swapunswap_rename

Swap and Unswap renaming.

Closes #86 and #90.
Darryl Pogue 13 years ago
parent
commit
47bcc46e22
  1. 4
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 10
      Sources/Plasma/Apps/plPythonPack/main.cpp
  3. 8
      Sources/Plasma/CoreLib/hsBitVector.cpp
  4. 28
      Sources/Plasma/CoreLib/hsBounds.cpp
  5. 16
      Sources/Plasma/CoreLib/hsColorRGBA.h
  6. 10
      Sources/Plasma/CoreLib/hsGeometry3.cpp
  7. 4
      Sources/Plasma/CoreLib/hsMatrix33.cpp
  8. 8
      Sources/Plasma/CoreLib/hsMatrix44.cpp
  9. 16
      Sources/Plasma/CoreLib/hsQuat.cpp
  10. 126
      Sources/Plasma/CoreLib/hsStream.cpp
  11. 222
      Sources/Plasma/CoreLib/hsStream.h
  12. 40
      Sources/Plasma/CoreLib/hsTypes.h
  13. 16
      Sources/Plasma/CoreLib/pcSmallRect.cpp
  14. 8
      Sources/Plasma/CoreLib/plGeneric.cpp
  15. 4
      Sources/Plasma/CoreLib/plLoadMask.cpp
  16. 12
      Sources/Plasma/CoreLib/plViewTransform.cpp
  17. 36
      Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp
  18. 16
      Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp
  19. 4
      Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp
  20. 20
      Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp
  21. 8
      Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp
  22. 20
      Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp
  23. 16
      Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp
  24. 56
      Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp
  25. 46
      Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp
  26. 4
      Sources/Plasma/FeatureLib/pfConditional/plANDConditionalObject.cpp
  27. 4
      Sources/Plasma/FeatureLib/pfConditional/plActivatorConditionalObject.cpp
  28. 4
      Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp
  29. 4
      Sources/Plasma/FeatureLib/pfConditional/plControlEventConditionalObject.cpp
  30. 4
      Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp
  31. 4
      Sources/Plasma/FeatureLib/pfConditional/plKeyPressConditionalObject.cpp
  32. 4
      Sources/Plasma/FeatureLib/pfConditional/plORConditionalObject.cpp
  33. 8
      Sources/Plasma/FeatureLib/pfConditional/plObjectInBoxConditionalObject.cpp
  34. 12
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp
  35. 4
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp
  36. 12
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.cpp
  37. 20
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp
  38. 12
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp
  39. 12
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp
  40. 4
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp
  41. 36
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp
  42. 4
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp
  43. 8
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp
  44. 6
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp
  45. 12
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp
  46. 12
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp
  47. 4
      Sources/Plasma/FeatureLib/pfMessage/pfGUINotifyMsg.h
  48. 4
      Sources/Plasma/FeatureLib/pfMessage/pfGameGUIMsg.h
  49. 20
      Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h
  50. 4
      Sources/Plasma/FeatureLib/pfMessage/pfMarkerMsg.cpp
  51. 12
      Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.cpp
  52. 6
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  53. 8
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
  54. 6
      Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp
  55. 28
      Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h
  56. 4
      Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp
  57. 4
      Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp
  58. 8
      Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp
  59. 4
      Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp
  60. 20
      Sources/Plasma/NucleusLib/inc/hsGMatState.inl
  61. 12
      Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp
  62. 4
      Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp
  63. 28
      Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp
  64. 4
      Sources/Plasma/NucleusLib/pnMessage/plAudioSysMsg.h
  65. 48
      Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.cpp
  66. 8
      Sources/Plasma/NucleusLib/pnMessage/plClientMsg.h
  67. 8
      Sources/Plasma/NucleusLib/pnMessage/plCursorChangeMsg.h
  68. 20
      Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h
  69. 12
      Sources/Plasma/NucleusLib/pnMessage/plIntRefMsg.h
  70. 44
      Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp
  71. 8
      Sources/Plasma/NucleusLib/pnMessage/plMessageWithCallbacks.cpp
  72. 152
      Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp
  73. 8
      Sources/Plasma/NucleusLib/pnMessage/plObjRefMsg.h
  74. 4
      Sources/Plasma/NucleusLib/pnMessage/plPlayerPageMsg.h
  75. 4
      Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.cpp
  76. 12
      Sources/Plasma/NucleusLib/pnMessage/plRefMsg.cpp
  77. 8
      Sources/Plasma/NucleusLib/pnMessage/plServerReplyMsg.cpp
  78. 32
      Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.cpp
  79. 8
      Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h
  80. 4
      Sources/Plasma/NucleusLib/pnMessage/plWarpMsg.h
  81. 4
      Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp
  82. 67
      Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp
  83. 28
      Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp
  84. 12
      Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.cpp
  85. 4
      Sources/Plasma/NucleusLib/pnNetCommon/plNetGroup.h
  86. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp
  87. 4
      Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.cpp
  88. 12
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp
  89. 8
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp
  90. 4
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h
  91. 4
      Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp
  92. 4
      Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp
  93. 12
      Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.cpp
  94. 8
      Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp
  95. 4
      Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.cpp
  96. 6
      Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h
  97. 2
      Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt
  98. 1
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAllIncludes.h
  99. 146
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtEndian.cpp
  100. 189
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtEndian.h
  101. Some files were not shown because too many files have changed in this diff Show More

4
Sources/Plasma/Apps/plClient/plClient.cpp

@ -2124,7 +2124,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
/// Read the rest in
selMode.Read(&stream);
UInt16 performance = stream.ReadSwap16();
UInt16 performance = stream.ReadLE16();
if( performance < 25 )
plBitmap::SetGlobalLevelChopCount( 2 );
@ -2158,7 +2158,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
{
dmr.GetDevice()->Write(&stream);
dmr.GetMode()->Write(&stream);
stream.WriteSwap16((UInt16)(0*100));
stream.WriteLE16((UInt16)(0*100));
stream.Close();
}

10
Sources/Plasma/Apps/plPythonPack/main.cpp

@ -187,13 +187,13 @@ void WritePythonFile(std::string fileName, std::string path, hsStream *s)
printf(errmsg);
printf("\n");
}
s->WriteSwap32(size);
s->WriteLE32(size);
s->Write(size, pycode);
}
else
{
printf("......blast! Compile error!\n");
s->WriteSwap32(0);
s->WriteLE32(0);
PyErr_Print();
PyErr_Clear();
@ -378,13 +378,13 @@ void PackDirectory(std::string dir, std::string rootPath, std::string pakName, s
if (!s.Open(pakName.c_str(), "wb"))
return;
s.WriteSwap32(fileNames.size());
s.WriteLE32(fileNames.size());
int i;
for (i = 0; i < fileNames.size(); i++)
{
s.WriteSafeString(fileNames[i].c_str());
s.WriteSwap32(0);
s.WriteLE32(0);
}
PythonInterface::initPython(rootPath);
@ -412,7 +412,7 @@ void PackDirectory(std::string dir, std::string rootPath, std::string pakName, s
for (i = 0; i < fileNames.size(); i++)
{
s.WriteSafeString(fileNames[i].c_str());
s.WriteSwap32(filePositions[i]);
s.WriteLE32(filePositions[i]);
}
s.Close();

8
Sources/Plasma/CoreLib/hsBitVector.cpp

@ -115,24 +115,24 @@ void hsBitVector::Read(hsStream* s)
{
Reset();
s->LogReadSwap(&fNumBitVectors,"NumBitVectors");
s->LogReadLE(&fNumBitVectors,"NumBitVectors");
if( fNumBitVectors )
{
delete [] fBitVectors;
fBitVectors = TRACKED_NEW UInt32[fNumBitVectors];
int i;
for( i = 0; i < fNumBitVectors; i++ )
s->LogReadSwap(&fBitVectors[i],"BitVector");
s->LogReadLE(&fBitVectors[i],"BitVector");
}
}
void hsBitVector::Write(hsStream* s) const
{
s->WriteSwap32(fNumBitVectors);
s->WriteLE32(fNumBitVectors);
int i;
for( i = 0; i < fNumBitVectors; i++ )
s->WriteSwap32(fBitVectors[i]);
s->WriteLE32(fBitVectors[i]);
}
hsTArray<Int16>& hsBitVector::Enumerate(hsTArray<Int16>& dst) const

28
Sources/Plasma/CoreLib/hsBounds.cpp

@ -60,12 +60,12 @@ const hsScalar hsBounds::kRealSmall = 1.0e-5f;
void hsBounds::Read(hsStream *s)
{
fType =(hsBoundsType) s->ReadSwap32();
fType =(hsBoundsType) s->ReadLE32();
}
void hsBounds::Write(hsStream *s)
{
s->WriteSwap32((Int32)fType);
s->WriteLE32((Int32)fType);
}
///////////////////////////////////////////////////////////////////////////////////////
@ -620,8 +620,8 @@ void hsBoundsOriented::Write(hsStream *stream)
{
hsBounds::Write(stream);
fCenter.Write(stream);
stream->WriteSwap32(fCenterValid);
stream->WriteSwap32(fNumPlanes);
stream->WriteLE32(fCenterValid);
stream->WriteLE32(fNumPlanes);
int i;
for( i = 0; i < fNumPlanes; i++ )
{
@ -633,8 +633,8 @@ void hsBoundsOriented::Read(hsStream *stream)
{
hsBounds::Read(stream);
fCenter.Read(stream);
fCenterValid = (hsBool)stream->ReadSwap32();
fNumPlanes = stream->ReadSwap32();
fCenterValid = (hsBool)stream->ReadLE32();
fNumPlanes = stream->ReadLE32();
if (fPlanes)
delete [] fPlanes;
fPlanes = TRACKED_NEW hsPlane3[fNumPlanes];
@ -2592,7 +2592,7 @@ hsBool hsBounds3Ext::ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoin
void hsBounds3Ext::Read(hsStream *s)
{
fExtFlags = s->ReadSwap32();
fExtFlags = s->ReadLE32();
hsBounds3::Read(s);
if( !(fExtFlags & kAxisAligned) )
{
@ -2601,8 +2601,8 @@ void hsBounds3Ext::Read(hsStream *s)
for( i = 0; i < 3; i++ )
{
fAxes[i].Read(s);
fDists[i].fX = s->ReadSwapScalar();
fDists[i].fY = s->ReadSwapScalar();
fDists[i].fX = s->ReadLEScalar();
fDists[i].fY = s->ReadLEScalar();
}
IMakeMinsMaxs();
IMakeDists();
@ -2611,7 +2611,7 @@ void hsBounds3Ext::Read(hsStream *s)
}
void hsBounds3Ext::Write(hsStream *s)
{
s->WriteSwap32(fExtFlags);
s->WriteLE32(fExtFlags);
hsBounds3::Write(s);
if( !(fExtFlags & kAxisAligned) )
{
@ -2622,14 +2622,14 @@ void hsBounds3Ext::Write(hsStream *s)
fAxes[i].Write(s);
if( fExtFlags & kDistsSet )
{
s->WriteSwapScalar(fDists[i].fX);
s->WriteSwapScalar(fDists[i].fY);
s->WriteLEScalar(fDists[i].fX);
s->WriteLEScalar(fDists[i].fY);
}
else
{
// Playing nice with binary patches--writing uninited values BAD!
s->WriteSwapScalar( 0.f );
s->WriteSwapScalar( 0.f );
s->WriteLEScalar( 0.f );
s->WriteLEScalar( 0.f );
}
}
}

16
Sources/Plasma/CoreLib/hsColorRGBA.h

@ -78,17 +78,17 @@ struct hsColorRGBA {
inline void hsColorRGBA::Read(hsStream *s)
{
r = s->ReadSwapScalar();
g = s->ReadSwapScalar();
b = s->ReadSwapScalar();
a = s->ReadSwapScalar();
r = s->ReadLEScalar();
g = s->ReadLEScalar();
b = s->ReadLEScalar();
a = s->ReadLEScalar();
}
inline void hsColorRGBA::Write(hsStream *s) const
{
s->WriteSwapScalar(r);
s->WriteSwapScalar(g);
s->WriteSwapScalar(b);
s->WriteSwapScalar(a);
s->WriteLEScalar(r);
s->WriteLEScalar(g);
s->WriteLEScalar(b);
s->WriteLEScalar(a);
}
inline hsColorRGBA& hsColorRGBA::FromARGB32(UInt32 c)

10
Sources/Plasma/CoreLib/hsGeometry3.cpp

@ -93,9 +93,9 @@ void hsScalarTriple::Read(hsStream *stream)
void hsScalarTriple::Write(hsStream *stream) const
{
stream->WriteSwapScalar(fX);
stream->WriteSwapScalar(fY);
stream->WriteSwapScalar(fZ);
stream->WriteLEScalar(fX);
stream->WriteLEScalar(fY);
stream->WriteLEScalar(fZ);
}
hsPlane3::hsPlane3(const hsPoint3* pt1, const hsPoint3* pt2, const hsPoint3* pt3)
@ -117,11 +117,11 @@ hsPlane3::hsPlane3(const hsPoint3* pt1, const hsPoint3* pt2, const hsPoint3* pt3
void hsPlane3::Read(hsStream *stream)
{
fN.Read(stream);
fD=stream->ReadSwapScalar();
fD=stream->ReadLEScalar();
}
void hsPlane3::Write(hsStream *stream) const
{
fN.Write(stream);
stream->WriteSwapScalar(fD);
stream->WriteLEScalar(fD);
}

4
Sources/Plasma/CoreLib/hsMatrix33.cpp

@ -95,7 +95,7 @@ void hsMatrix33::Read(hsStream* s)
{
for( j = 0; j < 3; j++ )
{
fMap[i][j] = s->ReadSwapScalar();
fMap[i][j] = s->ReadLEScalar();
}
}
}
@ -107,7 +107,7 @@ void hsMatrix33::Write(hsStream* s)
{
for( j = 0; j < 3; j++ )
{
s->WriteSwapScalar(fMap[i][j]);
s->WriteLEScalar(fMap[i][j]);
}
}
}

8
Sources/Plasma/CoreLib/hsMatrix44.cpp

@ -940,10 +940,10 @@ void hsMatrix44::Read(hsStream *stream)
for(i=0; i<4; i++)
for(j=0; j<4; j++)
#if HS_SCALAR_IS_FIXED
fMap[i][j] = stream->ReadSwap32();
fMap[i][j] = stream->ReadLE32();
#endif
#if HS_SCALAR_IS_FLOAT
fMap[i][j] = stream->ReadSwapFloat();
fMap[i][j] = stream->ReadLEFloat();
#endif
IsIdentity();
}
@ -961,10 +961,10 @@ void hsMatrix44::Write(hsStream *stream)
for(i=0; i<4; i++)
for(j=0; j<4; j++)
#if HS_SCALAR_IS_FIXED
stream->WriteSwap32(fMap[i][j]);
stream->WriteLE32(fMap[i][j]);
#endif
#if HS_SCALAR_IS_FLOAT
stream->WriteSwapFloat(fMap[i][j]);
stream->WriteLEFloat(fMap[i][j]);
#endif
}
}

16
Sources/Plasma/CoreLib/hsQuat.cpp

@ -240,18 +240,18 @@ hsQuat hsQuat::operator*(const hsQuat &in) const
// I/O
void hsQuat::Read(hsStream *stream)
{
fX = stream->ReadSwapFloat();
fY = stream->ReadSwapFloat();
fZ = stream->ReadSwapFloat();
fW = stream->ReadSwapFloat();
fX = stream->ReadLEFloat();
fY = stream->ReadLEFloat();
fZ = stream->ReadLEFloat();
fW = stream->ReadLEFloat();
}
void hsQuat::Write(hsStream *stream)
{
stream->WriteSwapFloat(fX);
stream->WriteSwapFloat(fY);
stream->WriteSwapFloat(fZ);
stream->WriteSwapFloat(fW);
stream->WriteLEFloat(fX);
stream->WriteLEFloat(fY);
stream->WriteLEFloat(fZ);
stream->WriteLEFloat(fW);
}

126
Sources/Plasma/CoreLib/hsStream.cpp

@ -151,7 +151,7 @@ UInt32 hsStream::WriteFmtV(const char * fmt, va_list av)
UInt32 hsStream::WriteSafeStringLong(const char *string)
{
UInt32 len = hsStrlen(string);
WriteSwap32(len);
WriteLE32(len);
if (len > 0)
{
char *buff = TRACKED_NEW char[len+1];
@ -172,16 +172,16 @@ UInt32 hsStream::WriteSafeStringLong(const char *string)
UInt32 hsStream::WriteSafeWStringLong(const wchar_t *string)
{
UInt32 len = wcslen(string);
WriteSwap32(len);
WriteLE32(len);
if (len > 0)
{
int i;
for (i=0; i<len; i++)
{
wchar_t buff = ~string[i];
WriteSwap16((UInt16)buff);
WriteLE16((UInt16)buff);
}
WriteSwap16((UInt16)L'\0');
WriteLE16((UInt16)L'\0');
}
return 0;
}
@ -189,7 +189,7 @@ UInt32 hsStream::WriteSafeWStringLong(const wchar_t *string)
char *hsStream::ReadSafeStringLong()
{
char *name = nil;
UInt32 numChars = ReadSwap32();
UInt32 numChars = ReadLE32();
if (numChars > 0 && numChars <= GetSizeLeft())
{
name = TRACKED_NEW char[numChars+1];
@ -211,14 +211,14 @@ char *hsStream::ReadSafeStringLong()
wchar_t *hsStream::ReadSafeWStringLong()
{
wchar_t *retVal = nil;
UInt32 numChars = ReadSwap32();
UInt32 numChars = ReadLE32();
if (numChars > 0 && numChars <= (GetSizeLeft()/2)) // divide by two because each char is two bytes
{
retVal = TRACKED_NEW wchar_t[numChars+1];
int i;
for (i=0; i<numChars; i++)
retVal[i] = (wchar_t)ReadSwap16();
retVal[numChars] = (wchar_t)ReadSwap16(); // we wrote the null out, read it back in
retVal[i] = (wchar_t)ReadLE16();
retVal[numChars] = (wchar_t)ReadLE16(); // we wrote the null out, read it back in
if (retVal[0]* 0x80)
{
@ -237,7 +237,7 @@ UInt32 hsStream::WriteSafeString(const char *string)
hsAssert(len<0xf000, xtl::format("string len of %d is too long for WriteSafeString %s, use WriteSafeStringLong",
string, len).c_str() );
WriteSwap16(len | 0xf000);
WriteLE16(len | 0xf000);
if (len > 0)
{
char *buff = TRACKED_NEW char[len+1];
@ -261,16 +261,16 @@ UInt32 hsStream::WriteSafeWString(const wchar_t *string)
hsAssert(len<0xf000, xtl::format("string len of %d is too long for WriteSafeWString, use WriteSafeWStringLong",
len).c_str() );
WriteSwap16(len | 0xf000);
WriteLE16(len | 0xf000);
if (len > 0)
{
int i;
for (i=0; i<len; i++)
{
wchar_t buff = ~string[i];
WriteSwap16((UInt16)buff);
WriteLE16((UInt16)buff);
}
WriteSwap16((UInt16)L'\0');
WriteLE16((UInt16)L'\0');
}
return 0;
}
@ -278,13 +278,13 @@ UInt32 hsStream::WriteSafeWString(const wchar_t *string)
char *hsStream::ReadSafeString()
{
char *name = nil;
UInt16 numChars = ReadSwap16();
UInt16 numChars = ReadLE16();
#ifndef REMOVE_ME_SOON
// Backward compat hack - remove in a week or so (from 6/30/03)
hsBool oldFormat = !(numChars & 0xf000);
if (oldFormat)
ReadSwap16();
ReadLE16();
#endif
numChars &= ~0xf000;
@ -310,7 +310,7 @@ char *hsStream::ReadSafeString()
wchar_t *hsStream::ReadSafeWString()
{
wchar_t *retVal = nil;
UInt32 numChars = ReadSwap16();
UInt32 numChars = ReadLE16();
numChars &= ~0xf000;
hsAssert(numChars <= GetSizeLeft()/2, "Bad string");
@ -319,8 +319,8 @@ wchar_t *hsStream::ReadSafeWString()
retVal = TRACKED_NEW wchar_t[numChars+1];
int i;
for (i=0; i<numChars; i++)
retVal[i] = (wchar_t)ReadSwap16();
retVal[numChars] = (wchar_t)ReadSwap16(); // we wrote the null out, read it back in
retVal[i] = (wchar_t)ReadLE16();
retVal[numChars] = (wchar_t)ReadLE16(); // we wrote the null out, read it back in
if (retVal[0]* 0x80)
{
@ -499,81 +499,81 @@ hsBool hsStream::ReadLn(char *s, UInt32 maxLen, const char beginComment, const c
return true;
}
UInt16 hsStream::ReadSwap16()
UInt16 hsStream::ReadLE16()
{
UInt16 value;
this->Read(sizeof(UInt16), &value);
value = hsSWAP16(value);
value = hsToLE16(value);
return value;
}
void hsStream::ReadSwap16(int count, UInt16 values[])
void hsStream::ReadLE16(int count, UInt16 values[])
{
this->Read(count * sizeof(UInt16), values);
for (int i = 0; i < count; i++)
values[i] = hsSWAP16(values[i]);
values[i] = hsToLE16(values[i]);
}
UInt32 hsStream::ReadSwap32()
UInt32 hsStream::ReadLE32()
{
UInt32 value;
Read4Bytes(&value);
value = hsSWAP32(value);
value = hsToLE32(value);
return value;
}
void hsStream::ReadSwap32(int count, UInt32 values[])
void hsStream::ReadLE32(int count, UInt32 values[])
{
this->Read(count * sizeof(UInt32), values);
for (int i = 0; i < count; i++)
values[i] = hsSWAP32(values[i]);
values[i] = hsToLE32(values[i]);
}
UInt32 hsStream::ReadUnswap32()
UInt32 hsStream::ReadBE32()
{
UInt32 value;
Read4Bytes(&value);
value = hsUNSWAP32(value);
value = hsToBE32(value);
return value;
}
#if HS_CAN_USE_FLOAT
double hsStream::ReadSwapDouble()
double hsStream::ReadLEDouble()
{
double value;
Read8Bytes(&value);
value = hsSWAPDouble(value);
value = hsToLEDouble(value);
return value;
}
void hsStream::ReadSwapDouble(int count, double values[])
void hsStream::ReadLEDouble(int count, double values[])
{
this->Read(count * sizeof(double), values);
for (int i = 0; i < count; i++)
values[i] = hsSWAPDouble(values[i]);
values[i] = hsToLEDouble(values[i]);
}
float hsStream::ReadSwapFloat()
float hsStream::ReadLEFloat()
{
float value;
Read4Bytes(&value);
value = hsSWAPFloat(value);
value = hsToLEFloat(value);
return value;
}
void hsStream::ReadSwapFloat(int count, float values[])
void hsStream::ReadLEFloat(int count, float values[])
{
this->Read(count * sizeof(float), values);
for (int i = 0; i < count; i++)
values[i] = hsSWAPFloat(values[i]);
values[i] = hsToLEFloat(values[i]);
}
float hsStream::ReadUnswapFloat()
float hsStream::ReadBEFloat()
{
float value;
this->Read(sizeof(float), &value);
value = hsUNSWAPFloat(value);
value = hsToBEFloat(value);
return value;
}
#endif
@ -612,78 +612,78 @@ void hsStream::WriteByte(UInt8 value)
this->Write(sizeof(UInt8), &value);
}
void hsStream::WriteSwap16(UInt16 value)
void hsStream::WriteLE16(UInt16 value)
{
value = hsSWAP16(value);
value = hsToLE16(value);
this->Write(sizeof(Int16), &value);
}
void hsStream::WriteSwap16(int count, const UInt16 values[])
void hsStream::WriteLE16(int count, const UInt16 values[])
{
for (int i = 0; i < count; i++)
this->WriteSwap16(values[i]);
this->WriteLE16(values[i]);
}
void hsStream::WriteSwap32(UInt32 value)
void hsStream::WriteLE32(UInt32 value)
{
value = hsSWAP32(value);
value = hsToLE32(value);
this->Write(sizeof(Int32), &value);
}
void hsStream::WriteSwap32(int count, const UInt32 values[])
void hsStream::WriteLE32(int count, const UInt32 values[])
{
for (int i = 0; i < count; i++)
this->WriteSwap32(values[i]);
this->WriteLE32(values[i]);
}
void hsStream::WriteUnswap32(UInt32 value)
void hsStream::WriteBE32(UInt32 value)
{
value = hsUNSWAP32(value);
value = hsToBE32(value);
this->Write(sizeof(Int32), &value);
}
#if HS_CAN_USE_FLOAT
void hsStream::WriteSwapDouble(double value)
void hsStream::WriteLEDouble(double value)
{
value = hsSWAPDouble(value);
value = hsToLEDouble(value);
this->Write(sizeof(double), &value);
}
void hsStream::WriteSwapDouble(int count, const double values[])
void hsStream::WriteLEDouble(int count, const double values[])
{
for (int i = 0; i < count; i++)
this->WriteSwapDouble(values[i]);
this->WriteLEDouble(values[i]);
}
void hsStream::WriteSwapFloat(float value)
void hsStream::WriteLEFloat(float value)
{
value = hsSWAPFloat(value);
value = hsToLEFloat(value);
this->Write(sizeof(float), &value);
}
void hsStream::WriteSwapFloat(int count, const float values[])
void hsStream::WriteLEFloat(int count, const float values[])
{
for (int i = 0; i < count; i++)
this->WriteSwapFloat(values[i]);
this->WriteLEFloat(values[i]);
}
void hsStream::WriteUnswapFloat(float value)
void hsStream::WriteBEFloat(float value)
{
value = hsUNSWAPFloat(value);
value = hsToBEFloat(value);
this->Write(sizeof(float), &value);
}
#endif
void hsStream::WriteSwapAtom(UInt32 tag, UInt32 size)
void hsStream::WriteLEAtom(UInt32 tag, UInt32 size)
{
this->WriteSwap32(tag);
this->WriteSwap32(size);
this->WriteLE32(tag);
this->WriteLE32(size);
}
UInt32 hsStream::ReadSwapAtom(UInt32* sizePtr)
UInt32 hsStream::ReadLEAtom(UInt32* sizePtr)
{
UInt32 tag = this->ReadSwap32();
UInt32 size = this->ReadSwap32();
UInt32 tag = this->ReadLE32();
UInt32 size = this->ReadLE32();
if (sizePtr)
*sizePtr = size;

222
Sources/Plasma/CoreLib/hsStream.h

@ -61,8 +61,8 @@ struct FileEntry;
#define LogReadSafeString() ReadSafeString();
#define LogReadSafeStringLong() ReadSafeStringLong();
#define LogSkip(deltaByteCount, desc) Skip(deltaByteCount)
#define LogReadSwap(value, desc) ReadSwap(value)
#define LogReadSwapArray(count, values, desc) ReadSwap(count, values)
#define LogReadLE(value, desc) ReadLE(value)
#define LogReadLEArray(count, values, desc) ReadLE(count, values)
#define LogSubStreamStart(desc) LogVoidFunc()
#define LogSubStreamPushDesc(desc) LogVoidFunc()
#define LogSubStreamEnd() LogVoidFunc()
@ -148,162 +148,162 @@ public:
bool Readbool();
hsBool ReadBool();
void ReadBool(int count, hsBool values[]);
UInt16 ReadSwap16();
void ReadSwap16(int count, UInt16 values[]);
UInt32 ReadSwap32();
void ReadSwap32(int count, UInt32 values[]);
UInt32 ReadUnswap32();
UInt16 ReadLE16();
void ReadLE16(int count, UInt16 values[]);
UInt32 ReadLE32();
void ReadLE32(int count, UInt32 values[]);
UInt32 ReadBE32();
void Writebool(bool value);
void WriteBool(hsBool value);
void WriteBool(int count, const hsBool values[]);
void WriteByte(UInt8 value);
void WriteSwap16(UInt16 value);
void WriteSwap16(int count, const UInt16 values[]);
void WriteSwap32(UInt32 value);
void WriteSwap32(int count, const UInt32 values[]);
void WriteUnswap32(UInt32 value);
void WriteLE16(UInt16 value);
void WriteLE16(int count, const UInt16 values[]);
void WriteLE32(UInt32 value);
void WriteLE32(int count, const UInt32 values[]);
void WriteBE32(UInt32 value);
/* Overloaded Begin (8 & 16 & 32 int)*/
/* yes, swapping an 8 bit value does nothing, just useful*/
void ReadSwap(bool* value) { *value = this->ReadByte() ? true : false; }
void ReadSwap(UInt8* value) { *value = this->ReadByte(); }
void ReadSwap(int count, UInt8 values[]) { this->Read(count, values); }
void ReadSwap(UInt16* value) { *value = this->ReadSwap16(); }
void ReadSwap(int count, UInt16 values[]) { this->ReadSwap16(count, values); }
void ReadSwap(UInt32* value) { *value = this->ReadSwap32(); }
void ReadSwap(int count, UInt32 values[]) { this->ReadSwap32(count, values); }
void ReadLE(bool* value) { *value = this->ReadByte() ? true : false; }
void ReadLE(UInt8* value) { *value = this->ReadByte(); }
void ReadLE(int count, UInt8 values[]) { this->Read(count, values); }
void ReadLE(UInt16* value) { *value = this->ReadLE16(); }
void ReadLE(int count, UInt16 values[]) { this->ReadLE16(count, values); }
void ReadLE(UInt32* value) { *value = this->ReadLE32(); }
void ReadLE(int count, UInt32 values[]) { this->ReadLE32(count, values); }
#ifdef STREAM_LOGGER
// Begin LogReadSwaps
virtual void LogReadSwap(bool* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwap(UInt8* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwapArray(int count, UInt8 values[], const char* desc) { this->ReadSwap(count, values); }
virtual void LogReadSwap(UInt16* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwapArray(int count, UInt16 values[], const char* desc) { this->ReadSwap(count, values); }
virtual void LogReadSwap(UInt32* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwapArray(int count, UInt32 values[], const char* desc) { this->ReadSwap(count, values); }
// End LogReadSwaps
// Begin LogReadLEs
virtual void LogReadLE(bool* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLE(UInt8* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLEArray(int count, UInt8 values[], const char* desc) { this->ReadLE(count, values); }
virtual void LogReadLE(UInt16* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLEArray(int count, UInt16 values[], const char* desc) { this->ReadLE(count, values); }
virtual void LogReadLE(UInt32* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLEArray(int count, UInt32 values[], const char* desc) { this->ReadLE(count, values); }
// End LogReadLEs
#endif
void WriteSwap(bool value) { this->Write(1,&value); }
void WriteSwap(UInt8 value) { this->Write(1,&value); }
void WriteSwap(int count, const UInt8 values[]) { this->Write(count, values); }
void WriteSwap(UInt16 value) { this->WriteSwap16(value); }
void WriteSwap(int count, const UInt16 values[]) { this->WriteSwap16(count, values); }
void WriteSwap(UInt32 value) { this->WriteSwap32(value); }
void WriteSwap(int count, const UInt32 values[]) { this->WriteSwap32(count, values); }
void ReadSwap(Int8* value) { *value = this->ReadByte(); }
void ReadSwap(int count, Int8 values[]) { this->Read(count, values); }
void ReadSwap(char* value) { *value = (char)this->ReadByte(); }
void ReadSwap(int count, char values[]) { this->Read(count, values); }
void ReadSwap(Int16* value) { *value = (Int16)this->ReadSwap16(); }
void ReadSwap(int count, Int16 values[]) { this->ReadSwap16(count, (UInt16*)values); }
void ReadSwap(Int32* value) { *value = (Int32)this->ReadSwap32(); }
void ReadSwap(int count, Int32 values[]) { this->ReadSwap32(count, (UInt32*)values); }
void WriteLE(bool value) { this->Write(1,&value); }
void WriteLE(UInt8 value) { this->Write(1,&value); }
void WriteLE(int count, const UInt8 values[]) { this->Write(count, values); }
void WriteLE(UInt16 value) { this->WriteLE16(value); }
void WriteLE(int count, const UInt16 values[]) { this->WriteLE16(count, values); }
void WriteLE(UInt32 value) { this->WriteLE32(value); }
void WriteLE(int count, const UInt32 values[]) { this->WriteLE32(count, values); }
void ReadLE(Int8* value) { *value = this->ReadByte(); }
void ReadLE(int count, Int8 values[]) { this->Read(count, values); }
void ReadLE(char* value) { *value = (char)this->ReadByte(); }
void ReadLE(int count, char values[]) { this->Read(count, values); }
void ReadLE(Int16* value) { *value = (Int16)this->ReadLE16(); }
void ReadLE(int count, Int16 values[]) { this->ReadLE16(count, (UInt16*)values); }
void ReadLE(Int32* value) { *value = (Int32)this->ReadLE32(); }
void ReadLE(int count, Int32 values[]) { this->ReadLE32(count, (UInt32*)values); }
#ifdef STREAM_LOGGER
// Begin LogReadSwaps
virtual void LogReadSwap(Int8* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwapArray(int count, Int8 values[], const char* desc) { this->ReadSwap(count, values); }
virtual void LogReadSwap(char* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwapArray(int count, char values[], const char* desc) { this->ReadSwap(count, values); }
virtual void LogReadSwap(Int16* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwapArray(int count, Int16 values[], const char* desc) { this->ReadSwap(count, (UInt16*)values); }
virtual void LogReadSwap(Int32* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwapArray(int count, Int32 values[], const char* desc) { this->ReadSwap(count, (UInt32*)values); }
virtual void LogReadSwap(int* value, const char* desc) { this->ReadSwap(value); }
virtual void LogReadSwapArray(int count, int values[], const char* desc) { this->ReadSwap(count, (UInt32*)values); }
// End LogReadSwaps
// Begin LogReadLEs
virtual void LogReadLE(Int8* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLEArray(int count, Int8 values[], const char* desc) { this->ReadLE(count, values); }
virtual void LogReadLE(char* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLEArray(int count, char values[], const char* desc) { this->ReadLE(count, values); }
virtual void LogReadLE(Int16* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLEArray(int count, Int16 values[], const char* desc) { this->ReadLE(count, (UInt16*)values); }
virtual void LogReadLE(Int32* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLEArray(int count, Int32 values[], const char* desc) { this->ReadLE(count, (UInt32*)values); }
virtual void LogReadLE(int* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadLEArray(int count, int values[], const char* desc) { this->ReadLE(count, (UInt32*)values); }
// End LogReadLEs
#endif
void WriteSwap(Int8 value) { this->Write(1,&value); }
void WriteSwap(int count, const Int8 values[]) { this->Write(count, values); }
void WriteSwap(char value) { this->Write(1,(UInt8*)&value); }
void WriteSwap(int count, const char values[]) { this->Write(count, (UInt8*)values); }
void WriteSwap(Int16 value) { this->WriteSwap16((UInt16)value); }
void WriteSwap(int count, const Int16 values[]) { this->WriteSwap16(count, (UInt16*)values); }
void WriteSwap(Int32 value) { this->WriteSwap32((UInt32)value); }
void WriteSwap(int count, const Int32 values[]) { this->WriteSwap32(count, (UInt32*)values); }
void WriteLE(Int8 value) { this->Write(1,&value); }
void WriteLE(int count, const Int8 values[]) { this->Write(count, values); }
void WriteLE(char value) { this->Write(1,(UInt8*)&value); }
void WriteLE(int count, const char values[]) { this->Write(count, (UInt8*)values); }
void WriteLE(Int16 value) { this->WriteLE16((UInt16)value); }
void WriteLE(int count, const Int16 values[]) { this->WriteLE16(count, (UInt16*)values); }
void WriteLE(Int32 value) { this->WriteLE32((UInt32)value); }
void WriteLE(int count, const Int32 values[]) { this->WriteLE32(count, (UInt32*)values); }
/* Overloaded End */
#if HS_CAN_USE_FLOAT
float ReadSwapFloat();
void ReadSwapFloat(int count, float values[]);
double ReadSwapDouble();
void ReadSwapDouble(int count, double values[]);
float ReadUnswapFloat();
void WriteSwapFloat(float value);
void WriteSwapFloat(int count, const float values[]);
void WriteSwapDouble(double value);
void WriteSwapDouble(int count, const double values[]);
void WriteUnswapFloat(float value);
float ReadLEFloat();
void ReadLEFloat(int count, float values[]);
double ReadLEDouble();
void ReadLEDouble(int count, double values[]);
float ReadBEFloat();
void WriteLEFloat(float value);
void WriteLEFloat(int count, const float values[]);
void WriteLEDouble(double value);
void WriteLEDouble(int count, const double values[]);
void WriteBEFloat(float value);
/* Overloaded Begin (Float)*/
void ReadSwap(float* value) { *value = ReadSwapFloat(); }
void ReadSwap(int count, float values[]) { ReadSwapFloat(count, values); }
void ReadSwap(double* value) { *value = ReadSwapDouble(); }
void ReadSwap(int count, double values[]) { ReadSwapDouble(count, values); }
void ReadLE(float* value) { *value = ReadLEFloat(); }
void ReadLE(int count, float values[]) { ReadLEFloat(count, values); }
void ReadLE(double* value) { *value = ReadLEDouble(); }
void ReadLE(int count, double values[]) { ReadLEDouble(count, values); }
#ifdef STREAM_LOGGER
// Begin LogReadSwaps
virtual void LogReadSwap(float* value, const char* desc) { ReadSwap(value); }
virtual void LogReadSwapArray(int count, float values[], const char* desc) { ReadSwap(count, values); }
virtual void LogReadSwap(double* value, const char* desc) { ReadSwap(value); }
virtual void LogReadSwapArray(int count, double values[], const char* desc) { ReadSwap(count, values); }
// End LogReadSwaps
// Begin LogReadLEs
virtual void LogReadLE(float* value, const char* desc) { ReadLE(value); }
virtual void LogReadLEArray(int count, float values[], const char* desc) { ReadLE(count, values); }
virtual void LogReadLE(double* value, const char* desc) { ReadLE(value); }
virtual void LogReadLEArray(int count, double values[], const char* desc) { ReadLE(count, values); }
// End LogReadLEs
#endif
void WriteSwap(float value) { WriteSwapFloat(value); }
void WriteSwap(int count, const float values[]) { WriteSwapFloat(count, values); }
void WriteSwap(double value) { WriteSwapDouble(value); }
void WriteSwap(int count, const double values[]) { WriteSwapDouble(count, values); }
void WriteLE(float value) { WriteLEFloat(value); }
void WriteLE(int count, const float values[]) { WriteLEFloat(count, values); }
void WriteLE(double value) { WriteLEDouble(value); }
void WriteLE(int count, const double values[]) { WriteLEDouble(count, values); }
/* Overloaded End */
#endif
#if HS_SCALAR_IS_FIXED
hsFixed ReadSwapScalar() { return (hsFixed)this->ReadSwap32(); }
void ReadSwapScalar(int count, hsFixed values[])
hsFixed ReadLEScalar() { return (hsFixed)this->ReadLE32(); }
void ReadLEScalar(int count, hsFixed values[])
{
this->ReadSwap32(count, (UInt32*)values);
this->ReadLE32(count, (UInt32*)values);
}
hsFixed ReadUnswapScalar() { return (hsFixed)this->ReadUnswap32(); }
hsFixed ReadBEScalar() { return (hsFixed)this->ReadBE32(); }
void WriteSwapScalar(hsFixed value) { this->WriteSwap32(value); }
void WriteSwapScalar(int count, const hsFixed values[])
void WriteLEScalar(hsFixed value) { this->WriteLE32(value); }
void WriteLEScalar(int count, const hsFixed values[])
{
this->WriteSwap32(count, (UInt32*)values);
this->WriteLE32(count, (UInt32*)values);
}
void WriteUnswapScalar(hsFixed value) { this->WriteUnswap32(value); }
void WriteBEScalar(hsFixed value) { this->WriteBE32(value); }
/* Overloaded Begin (Scalar) */
void ReadSwap(hsFixed* value) { this->ReadSwap((UInt32*)value); }
void ReadSwap(int count, hsFixed values[]) { this->ReadSwap(count, (UInt32*)values); }
void WriteSwap(hsFixed value) { this->WriteSwap((UInt32)value); }
void WriteSwap(int count, const hsFixed values[]) { this->WriteSwap(count, (UInt32*)values); }
void ReadLE(hsFixed* value) { this->ReadLE((UInt32*)value); }
void ReadLE(int count, hsFixed values[]) { this->ReadLE(count, (UInt32*)values); }
void WriteLE(hsFixed value) { this->WriteLE((UInt32)value); }
void WriteLE(int count, const hsFixed values[]) { this->WriteLE(count, (UInt32*)values); }
/* Overloaded End */
#else
float ReadSwapScalar() { return (float)this->ReadSwapFloat(); }
void ReadSwapScalar(int count, float values[])
float ReadLEScalar() { return (float)this->ReadLEFloat(); }
void ReadLEScalar(int count, float values[])
{
this->ReadSwapFloat(count, (float*)values);
this->ReadLEFloat(count, (float*)values);
}
float ReadUnswapScalar() { return (float)this->ReadUnswapFloat(); }
void WriteSwapScalar(float value) { this->WriteSwapFloat(value); }
void WriteSwapScalar(int count, const float values[])
float ReadBEScalar() { return (float)this->ReadBEFloat(); }
void WriteLEScalar(float value) { this->WriteLEFloat(value); }
void WriteLEScalar(int count, const float values[])
{
this->WriteSwapFloat(count, (float*)values);
this->WriteLEFloat(count, (float*)values);
}
void WriteUnswapScalar(float value) { this->WriteUnswapFloat(value); }
void WriteBEScalar(float value) { this->WriteBEFloat(value); }
#endif
void WriteSwapAtom(UInt32 tag, UInt32 size);
UInt32 ReadSwapAtom(UInt32* size);
void WriteLEAtom(UInt32 tag, UInt32 size);
UInt32 ReadLEAtom(UInt32* size);
/* Overloaded Begin (Atom)*/
void WriteSwap(UInt32* tag, UInt32 size) { WriteSwapAtom(*tag, size); }
void ReadSwap(UInt32* tag, UInt32 *size) { *tag = ReadSwapAtom(size); }
void WriteLE(UInt32* tag, UInt32 size) { WriteLEAtom(*tag, size); }
void ReadLE(UInt32* tag, UInt32 *size) { *tag = ReadLEAtom(size); }
/* Overloaded End */
virtual void VirtualSetPosition(UInt32 pos, VDB_Type ){ SetPosition(pos); };
virtual hsPackFileSys::FileEntry *GetFileEntry() { return nil; } // Streams from Packfiles can return a FileEntry

40
Sources/Plasma/CoreLib/hsTypes.h

@ -197,27 +197,27 @@ typedef UInt32 hsGSeedValue;
#endif
#if LITTLE_ENDIAN
#define hsUNSWAP16(n) hsSwapEndian16(n)
#define hsUNSWAP32(n) hsSwapEndian32(n)
#define hsUNSWAP64(n) hsSwapEndian64(n)
#define hsUNSWAPFloat(n) hsSwapEndianFloat(n)
#define hsUNSWAPDouble(n) hsSwapEndianDouble(n)
#define hsSWAP16(n) (n)
#define hsSWAP32(n) (n)
#define hsSWAP64(n) (n)
#define hsSWAPFloat(n) (n)
#define hsSWAPDouble(n) (n)
#define hsToBE16(n) hsSwapEndian16(n)
#define hsToBE32(n) hsSwapEndian32(n)
#define hsToBE64(n) hsSwapEndian64(n)
#define hsToBEFloat(n) hsSwapEndianFloat(n)
#define hsToBEDouble(n) hsSwapEndianDouble(n)
#define hsToLE16(n) (n)
#define hsToLE32(n) (n)
#define hsToLE64(n) (n)
#define hsToLEFloat(n) (n)
#define hsToLEDouble(n) (n)
#else
#define hsUNSWAP16(n) (n)
#define hsUNSWAP32(n) (n)
#define hsUNSWAP64(n) (n)
#define hsUNSWAPFloat(n) (n)
#define hsUNSWAPDouble(n) (n)
#define hsSWAP16(n) hsSwapEndian16(n)
#define hsSWAP32(n) hsSwapEndian32(n)
#define hsSWAP64(n) hsSwapEndian64(n)
#define hsSWAPFloat(n) hsSwapEndianFloat(n)
#define hsSWAPDouble(n) hsSwapEndianDouble(n)
#define hsToBE16(n) (n)
#define hsToBE32(n) (n)
#define hsToBE64(n) (n)
#define hsToBEFloat(n) (n)
#define hsToBEDouble(n) (n)
#define hsToLE16(n) hsSwapEndian16(n)
#define hsToLE32(n) hsSwapEndian32(n)
#define hsToLE64(n) hsSwapEndian64(n)
#define hsToLEFloat(n) hsSwapEndianFloat(n)
#define hsToLEDouble(n) hsSwapEndianDouble(n)
#endif
inline void hsSwap(Int32& a, Int32& b)

16
Sources/Plasma/CoreLib/pcSmallRect.cpp

@ -50,16 +50,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
void pcSmallRect::Read( hsStream *s )
{
s->ReadSwap( &fX );
s->ReadSwap( &fY );
s->ReadSwap( &fWidth );
s->ReadSwap( &fHeight );
s->ReadLE( &fX );
s->ReadLE( &fY );
s->ReadLE( &fWidth );
s->ReadLE( &fHeight );
}
void pcSmallRect::Write( hsStream *s )
{
s->WriteSwap( fX );
s->WriteSwap( fY );
s->WriteSwap( fWidth );
s->WriteSwap( fHeight );
s->WriteLE( fX );
s->WriteLE( fY );
s->WriteLE( fWidth );
s->WriteLE( fHeight );
}

8
Sources/Plasma/CoreLib/plGeneric.cpp

@ -153,11 +153,11 @@ int plGeneric::Write(hsStream* stream)
break;
case kInt:
stream->WriteSwap(fIntVal);
stream->WriteLE(fIntVal);
break;
case kFloat:
stream->WriteSwap(fFloatVal);
stream->WriteLE(fFloatVal);
break;
case kString:
@ -181,11 +181,11 @@ int plGeneric::Read(hsStream* stream)
break;
case kInt:
stream->ReadSwap(&fIntVal);
stream->ReadLE(&fIntVal);
break;
case kFloat:
stream->ReadSwap(&fFloatVal);
stream->ReadLE(&fFloatVal);
break;
case kString:

4
Sources/Plasma/CoreLib/plLoadMask.cpp

@ -82,7 +82,7 @@ void plLoadMask::Read(hsStream* s)
{
// read as packed byte
UInt8 qc;
s->LogReadSwap(&qc,"Quality|Capabilty");
s->LogReadLE(&qc,"Quality|Capabilty");
fQuality[0] = (qc & 0xf0) >> 4;
fQuality[1] = (qc & 0x0f);
@ -96,7 +96,7 @@ void plLoadMask::Write(hsStream* s) const
{
// write packed into 1 byte
UInt8 qc = (fQuality[0]<<4) | (fQuality[1] & 0xf);
s->WriteSwap(qc);
s->WriteLE(qc);
}
UInt32 plLoadMask::ValidateReps(int num, const int quals[], const int caps[])

12
Sources/Plasma/CoreLib/plViewTransform.cpp

@ -349,7 +349,7 @@ void plViewTransform::GetViewPort(int& loX, int& loY, int& hiX, int& hiY) const
void plViewTransform::Read(hsStream* s)
{
fFlags = s->ReadSwap32();
fFlags = s->ReadLE32();
fFlags &= ~kSetMask;
fCameraToWorld.Read(s);
@ -358,8 +358,8 @@ void plViewTransform::Read(hsStream* s)
fMin.Read(s);
fMax.Read(s);
fWidth = s->ReadSwap16();
fHeight = s->ReadSwap16();
fWidth = s->ReadLE16();
fHeight = s->ReadLE16();
fViewPortX.Read(s);
fViewPortY.Read(s);
@ -370,7 +370,7 @@ void plViewTransform::Read(hsStream* s)
void plViewTransform::Write(hsStream* s)
{
s->WriteSwap32(fFlags & ~kSetMask);
s->WriteLE32(fFlags & ~kSetMask);
fCameraToWorld.Write(s);
fWorldToCamera.Write(s);
@ -378,8 +378,8 @@ void plViewTransform::Write(hsStream* s)
fMin.Write(s);
fMax.Write(s);
s->WriteSwap16(fWidth);
s->WriteSwap16(fHeight);
s->WriteLE16(fWidth);
s->WriteLE16(fHeight);
fViewPortX.Write(s);
fViewPortY.Write(s);

36
Sources/Plasma/FeatureLib/pfAnimation/pfObjectFlocker.cpp

@ -1032,18 +1032,18 @@ void pfObjectFlocker::Read(hsStream* s, hsResMgr* mgr)
SetNumBoids(s->ReadByte());
fBoidKey = mgr->ReadKey(s);
fFlock.SetGoalWeight(s->ReadSwapScalar());
fFlock.SetWanderWeight(s->ReadSwapScalar());
fFlock.SetGoalWeight(s->ReadLEScalar());
fFlock.SetWanderWeight(s->ReadLEScalar());
fFlock.SetSeparationWeight(s->ReadSwapScalar());
fFlock.SetSeparationRadius(s->ReadSwapScalar());
fFlock.SetSeparationWeight(s->ReadLEScalar());
fFlock.SetSeparationRadius(s->ReadLEScalar());
fFlock.SetCohesionWeight(s->ReadSwapScalar());
fFlock.SetCohesionRadius(s->ReadSwapScalar());
fFlock.SetCohesionWeight(s->ReadLEScalar());
fFlock.SetCohesionRadius(s->ReadLEScalar());
fFlock.SetMaxForce(s->ReadSwapScalar());
fFlock.SetMaxSpeed(s->ReadSwapScalar());
fFlock.SetMinSpeed(s->ReadSwapScalar());
fFlock.SetMaxForce(s->ReadLEScalar());
fFlock.SetMaxSpeed(s->ReadLEScalar());
fFlock.SetMinSpeed(s->ReadLEScalar());
fUseTargetRotation = s->ReadBool();
fRandomizeAnimationStart = s->ReadBool();
@ -1058,18 +1058,18 @@ void pfObjectFlocker::Write(hsStream* s, hsResMgr* mgr)
s->WriteByte(fNumBoids);
mgr->WriteKey(s, fBoidKey);
s->WriteSwapScalar(fFlock.GoalWeight());
s->WriteSwapScalar(fFlock.WanderWeight());
s->WriteLEScalar(fFlock.GoalWeight());
s->WriteLEScalar(fFlock.WanderWeight());
s->WriteSwapScalar(fFlock.SeparationWeight());
s->WriteSwapScalar(fFlock.SeparationRadius());
s->WriteLEScalar(fFlock.SeparationWeight());
s->WriteLEScalar(fFlock.SeparationRadius());
s->WriteSwapScalar(fFlock.CohesionWeight());
s->WriteSwapScalar(fFlock.CohesionRadius());
s->WriteLEScalar(fFlock.CohesionWeight());
s->WriteLEScalar(fFlock.CohesionRadius());
s->WriteSwapScalar(fFlock.MaxForce());
s->WriteSwapScalar(fFlock.MaxSpeed());
s->WriteSwapScalar(fFlock.MinSpeed());
s->WriteLEScalar(fFlock.MaxForce());
s->WriteLEScalar(fFlock.MaxSpeed());
s->WriteLEScalar(fFlock.MinSpeed());
s->WriteBool(fUseTargetRotation);
s->WriteBool(fRandomizeAnimationStart);

16
Sources/Plasma/FeatureLib/pfAnimation/plBlower.cpp

@ -193,20 +193,20 @@ void plBlower::Read(hsStream* s, hsResMgr* mgr)
{
plSingleModifier::Read(s, mgr);
fMasterPower = s->ReadSwapScalar();
fDirectRate = s->ReadSwapScalar();
fImpulseRate = s->ReadSwapScalar();
fSpringKonst = s->ReadSwapScalar();
fMasterPower = s->ReadLEScalar();
fDirectRate = s->ReadLEScalar();
fImpulseRate = s->ReadLEScalar();
fSpringKonst = s->ReadLEScalar();
}
void plBlower::Write(hsStream* s, hsResMgr* mgr)
{
plSingleModifier::Write(s, mgr);
s->WriteSwapScalar(fMasterPower);
s->WriteSwapScalar(fDirectRate);
s->WriteSwapScalar(fImpulseRate);
s->WriteSwapScalar(fSpringKonst);
s->WriteLEScalar(fMasterPower);
s->WriteLEScalar(fDirectRate);
s->WriteLEScalar(fImpulseRate);
s->WriteLEScalar(fSpringKonst);
}
void plBlower::IInitOscillators()

4
Sources/Plasma/FeatureLib/pfAnimation/plFilterCoordInterface.cpp

@ -94,7 +94,7 @@ void plFilterCoordInterface::Read(hsStream* stream, hsResMgr* mgr)
{
plCoordinateInterface::Read(stream, mgr);
fFilterMask = stream->ReadSwap32();
fFilterMask = stream->ReadLE32();
fRefParentLocalToWorld.Read(stream);
}
@ -102,7 +102,7 @@ void plFilterCoordInterface::Write(hsStream* stream, hsResMgr* mgr)
{
plCoordinateInterface::Write(stream, mgr);
stream->WriteSwap32(fFilterMask);
stream->WriteLE32(fFilterMask);
fRefParentLocalToWorld.Write(stream);
}

20
Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp

@ -159,20 +159,20 @@ void plLineFollowMod::Read(hsStream* stream, hsResMgr* mgr)
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefObject), plRefFlags::kPassiveRef);
int n = stream->ReadSwap32();
int n = stream->ReadLE32();
while(n--)
{
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefStereizer), plRefFlags::kPassiveRef);
}
UInt32 f = stream->ReadSwap32();
UInt32 f = stream->ReadLE32();
SetFollowMode(FollowMode(f & 0xffff));
fFollowFlags = (UInt16)((f >> 16) & 0xffff);
if( fFollowFlags & kOffset )
{
fOffset = stream->ReadSwapScalar();
fOffset = stream->ReadLEScalar();
}
if( fFollowFlags & kOffsetAng )
{
@ -180,11 +180,11 @@ void plLineFollowMod::Read(hsStream* stream, hsResMgr* mgr)
}
if( fFollowFlags & kOffsetClamp )
{
fOffsetClamp = stream->ReadSwapScalar();
fOffsetClamp = stream->ReadLEScalar();
}
if( fFollowFlags & kSpeedClamp )
{
fSpeedClamp = stream->ReadSwapScalar();
fSpeedClamp = stream->ReadLEScalar();
}
}
@ -198,20 +198,20 @@ void plLineFollowMod::Write(hsStream* stream, hsResMgr* mgr)
mgr->WriteKey(stream, fRefObj);
stream->WriteSwap32(fStereizers.GetCount());
stream->WriteLE32(fStereizers.GetCount());
int i;
for( i = 0; i < fStereizers.GetCount(); i++ )
mgr->WriteKey(stream, fStereizers[i]->GetKey());
UInt32 f = UInt32(fFollowMode) | (UInt32(fFollowFlags) << 16);
stream->WriteSwap32(f);
stream->WriteLE32(f);
if( fFollowFlags & kOffset )
stream->WriteSwapScalar(fOffset);
stream->WriteLEScalar(fOffset);
if( fFollowFlags & kOffsetClamp )
stream->WriteSwapScalar(fOffsetClamp);
stream->WriteLEScalar(fOffsetClamp);
if( fFollowFlags & kSpeedClamp )
stream->WriteSwapScalar(fSpeedClamp);
stream->WriteLEScalar(fSpeedClamp);
}

8
Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp

@ -277,8 +277,8 @@ void plRandomCommandMod::Read(hsStream* s, hsResMgr* mgr)
fMode = s->ReadByte();
fState = s->ReadByte();
fMinDelay = s->ReadSwapScalar();
fMaxDelay = s->ReadSwapScalar();
fMinDelay = s->ReadLEScalar();
fMaxDelay = s->ReadLEScalar();
IReset();
}
@ -290,8 +290,8 @@ void plRandomCommandMod::Write(hsStream* s, hsResMgr* mgr)
s->WriteByte(fMode);
s->WriteByte(fState);
s->WriteSwapScalar(fMinDelay);
s->WriteSwapScalar(fMaxDelay);
s->WriteLEScalar(fMinDelay);
s->WriteLEScalar(fMaxDelay);
}
void plRandomCommandMod::IRetry(hsScalar secs)

20
Sources/Plasma/FeatureLib/pfAnimation/plStereizer.cpp

@ -78,13 +78,13 @@ void plStereizer::Read(hsStream* stream, hsResMgr* mgr)
{
plSingleModifier::Read(stream, mgr);
fAmbientDist = stream->ReadSwapScalar();
fTransition = stream->ReadSwapScalar();
fAmbientDist = stream->ReadLEScalar();
fTransition = stream->ReadLEScalar();
fMaxSepDist = stream->ReadSwapScalar();
fMinSepDist = stream->ReadSwapScalar();
fMaxSepDist = stream->ReadLEScalar();
fMinSepDist = stream->ReadLEScalar();
fTanAng = stream->ReadSwapScalar();
fTanAng = stream->ReadLEScalar();
fInitPos.Read(stream);
@ -96,13 +96,13 @@ void plStereizer::Write(hsStream* stream, hsResMgr* mgr)
{
plSingleModifier::Write(stream, mgr);
stream->WriteSwapScalar(fAmbientDist);
stream->WriteSwapScalar(fTransition);
stream->WriteLEScalar(fAmbientDist);
stream->WriteLEScalar(fTransition);
stream->WriteSwapScalar(fMaxSepDist);
stream->WriteSwapScalar(fMinSepDist);
stream->WriteLEScalar(fMaxSepDist);
stream->WriteLEScalar(fMinSepDist);
stream->WriteSwapScalar(fTanAng);
stream->WriteLEScalar(fTanAng);
fInitPos.Write(stream);
}

16
Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp

@ -64,23 +64,23 @@ plRandomSoundModGroup::~plRandomSoundModGroup()
void plRandomSoundModGroup::Read(hsStream *s)
{
fNumSounds = s->ReadSwap16();
fGroupedIdx = s->ReadSwap16();
fNumSounds = s->ReadLE16();
fGroupedIdx = s->ReadLE16();
fIndices = TRACKED_NEW UInt16[fNumSounds];
int i;
for (i = 0; i < fNumSounds; i++)
fIndices[i] = s->ReadSwap16();
fIndices[i] = s->ReadLE16();
}
void plRandomSoundModGroup::Write(hsStream *s)
{
s->WriteSwap16(fNumSounds);
s->WriteSwap16(fGroupedIdx);
s->WriteLE16(fNumSounds);
s->WriteLE16(fGroupedIdx);
int i;
for (i = 0; i < fNumSounds; i++)
s->WriteSwap16(fIndices[i]);
s->WriteLE16(fIndices[i]);
}
///////////////////////////////////////////////////////////////////////////////////////
@ -294,7 +294,7 @@ void plRandomSoundMod::Read(hsStream *s, hsResMgr *mgr)
{
plRandomCommandMod::Read(s, mgr);
fNumGroups = s->ReadSwap16();
fNumGroups = s->ReadLE16();
if (fNumGroups > 0)
{
fGroups = TRACKED_NEW plRandomSoundModGroup[fNumGroups];
@ -308,7 +308,7 @@ void plRandomSoundMod::Write(hsStream *s, hsResMgr *mgr)
{
plRandomCommandMod::Write(s, mgr);
s->WriteSwap16(fNumGroups);
s->WriteLE16(fNumGroups);
if (fNumGroups > 0)
{
int i;

56
Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp

@ -501,17 +501,17 @@ void plCameraBrain1::Read(hsStream* stream, hsResMgr* mgr)
plgDispatch::Dispatch()->RegisterForExactType(plPlayerPageMsg::Index(), GetKey());
}
fAccel = stream->ReadSwapFloat();
fDecel = stream->ReadSwapFloat();
fVelocity = stream->ReadSwapFloat();
fPOAAccel = stream->ReadSwapFloat();
fPOADecel = stream->ReadSwapFloat();
fPOAVelocity = stream->ReadSwapFloat();
fXPanLimit = stream->ReadSwapFloat();
fZPanLimit = stream->ReadSwapFloat();
fZoomRate = stream->ReadSwapFloat();
fZoomMin = stream->ReadSwapFloat();
fZoomMax = stream->ReadSwapFloat();
fAccel = stream->ReadLEFloat();
fDecel = stream->ReadLEFloat();
fVelocity = stream->ReadLEFloat();
fPOAAccel = stream->ReadLEFloat();
fPOADecel = stream->ReadLEFloat();
fPOAVelocity = stream->ReadLEFloat();
fXPanLimit = stream->ReadLEFloat();
fZPanLimit = stream->ReadLEFloat();
fZoomRate = stream->ReadLEFloat();
fZoomMin = stream->ReadLEFloat();
fZoomMax = stream->ReadLEFloat();
}
@ -522,17 +522,17 @@ void plCameraBrain1::Write(hsStream* stream, hsResMgr* mgr)
mgr->WriteKey(stream, GetSubject());
mgr->WriteKey(stream, fRail);
fFlags.Write(stream);
stream->WriteSwapFloat(fAccel);
stream->WriteSwapFloat(fDecel);
stream->WriteSwapFloat(fVelocity);
stream->WriteSwapFloat(fPOAAccel);
stream->WriteSwapFloat(fPOADecel);
stream->WriteSwapFloat(fPOAVelocity);
stream->WriteSwapFloat(fXPanLimit);
stream->WriteSwapFloat(fZPanLimit);
stream->WriteSwapFloat(fZoomRate);
stream->WriteSwapFloat(fZoomMin);
stream->WriteSwapFloat(fZoomMax);
stream->WriteLEFloat(fAccel);
stream->WriteLEFloat(fDecel);
stream->WriteLEFloat(fVelocity);
stream->WriteLEFloat(fPOAAccel);
stream->WriteLEFloat(fPOADecel);
stream->WriteLEFloat(fPOAVelocity);
stream->WriteLEFloat(fXPanLimit);
stream->WriteLEFloat(fZPanLimit);
stream->WriteLEFloat(fZoomRate);
stream->WriteLEFloat(fZoomMin);
stream->WriteLEFloat(fZoomMax);
}
hsBool plCameraBrain1::MsgReceive(plMessage* msg)
{
@ -1759,18 +1759,18 @@ hsPoint3 plCameraBrain1_Circle::GetCenterPoint()
void plCameraBrain1_Circle::Write(hsStream* stream, hsResMgr* mgr)
{
plCameraBrain1::Write(stream, mgr);
stream->WriteSwap32(GetCircleFlags());
stream->WriteLE32(GetCircleFlags());
fCenter.Write(stream);
stream->WriteSwapScalar(GetRadius());
stream->WriteLEScalar(GetRadius());
mgr->WriteKey(stream, fCenterObject);
mgr->WriteKey(stream, fPOAObj);
stream->WriteSwapScalar(fCirPerSec);
stream->WriteLEScalar(fCirPerSec);
}
void plCameraBrain1_Circle::Read(hsStream* stream, hsResMgr* mgr)
{
plCameraBrain1::Read(stream, mgr);
SetCircleFlags(stream->ReadSwap32());
SetCircleFlags(stream->ReadLE32());
if (GetCircleFlags() & kCircleLocalAvatar)
{
if (plNetClientApp::GetInstance() && plNetClientApp::GetInstance()->GetLocalPlayer())
@ -1780,12 +1780,12 @@ void plCameraBrain1_Circle::Read(hsStream* stream, hsResMgr* mgr)
}
fCenter.Read(stream);
SetRadius(stream->ReadSwapScalar());
SetRadius(stream->ReadLEScalar());
plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kCircleTarget ); // SceneObject
mgr->ReadKeyNotifyMe( stream, msg, plRefFlags::kActiveRef );
plGenRefMsg* msg2 = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnRequest, 0, kPOAObject ); // SceneObject
mgr->ReadKeyNotifyMe( stream, msg2, plRefFlags::kActiveRef );
fCirPerSec = stream->ReadSwapScalar();
fCirPerSec = stream->ReadLEScalar();
plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
}

46
Sources/Plasma/FeatureLib/pfCamera/plCameraModifier.cpp

@ -323,7 +323,7 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr)
hsKeyedObject::Read(stream, mgr);
fBrain = nil;
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefBrain), plRefFlags::kActiveRef);
int count = stream->ReadSwap32();
int count = stream->ReadLE32();
int i;
for (i = 0; i < count; i++)
{
@ -332,12 +332,12 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr)
hsBool cutpos = stream->ReadBool();
hsBool cutpoa = stream->ReadBool();
hsBool ignore = stream->ReadBool();
hsScalar v = stream->ReadSwapScalar();
hsScalar a = stream->ReadSwapScalar();
hsScalar d = stream->ReadSwapScalar();
hsScalar pV = stream->ReadSwapScalar();
hsScalar pA = stream->ReadSwapScalar();
hsScalar pD = stream->ReadSwapScalar();
hsScalar v = stream->ReadLEScalar();
hsScalar a = stream->ReadLEScalar();
hsScalar d = stream->ReadLEScalar();
hsScalar pV = stream->ReadLEScalar();
hsScalar pA = stream->ReadLEScalar();
hsScalar pD = stream->ReadLEScalar();
CamTrans* camTrans = TRACKED_NEW CamTrans(key);
camTrans->fAccel = a;
@ -352,9 +352,9 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr)
fTrans.Append(camTrans);
}
fFOVw = stream->ReadSwapFloat();
fFOVh = stream->ReadSwapFloat();
int n = stream->ReadSwap32();
fFOVw = stream->ReadLEFloat();
fFOVh = stream->ReadLEFloat();
int n = stream->ReadLE32();
fMessageQueue.SetCountAndZero(n);
for(i = 0; i < n; i++ )
{
@ -366,7 +366,7 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr)
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefCallbackMsg), plRefFlags::kActiveRef);
}
n = stream->ReadSwap32();
n = stream->ReadLE32();
fFOVInstructions.SetCountAndZero(n);
for(i = 0; i < n; i++ )
{
@ -387,23 +387,23 @@ void plCameraModifier1::Write(hsStream* stream, hsResMgr* mgr)
mgr->WriteKey(stream, fBrain );
int i = fTrans.Count();
stream->WriteSwap32(i);
stream->WriteLE32(i);
for (i = 0; i < fTrans.Count(); i++)
{
mgr->WriteKey(stream, fTrans[i]->fTransTo);
stream->WriteBool(fTrans[i]->fCutPos);
stream->WriteBool(fTrans[i]->fCutPOA);
stream->WriteBool(fTrans[i]->fIgnore);
stream->WriteSwapScalar(fTrans[i]->fVelocity);
stream->WriteSwapScalar(fTrans[i]->fAccel);
stream->WriteSwapScalar(fTrans[i]->fDecel);
stream->WriteSwapScalar(fTrans[i]->fPOAVelocity);
stream->WriteSwapScalar(fTrans[i]->fPOAAccel);
stream->WriteSwapScalar(fTrans[i]->fPOADecel);
}
stream->WriteSwapFloat(fFOVw);
stream->WriteSwapFloat(fFOVh);
stream->WriteSwap32(fMessageQueue.Count());
stream->WriteLEScalar(fTrans[i]->fVelocity);
stream->WriteLEScalar(fTrans[i]->fAccel);
stream->WriteLEScalar(fTrans[i]->fDecel);
stream->WriteLEScalar(fTrans[i]->fPOAVelocity);
stream->WriteLEScalar(fTrans[i]->fPOAAccel);
stream->WriteLEScalar(fTrans[i]->fPOADecel);
}
stream->WriteLEFloat(fFOVw);
stream->WriteLEFloat(fFOVh);
stream->WriteLE32(fMessageQueue.Count());
for (i = 0; i < fMessageQueue.Count(); i++)
{
mgr->WriteCreatable(stream, fMessageQueue[i]);
@ -412,7 +412,7 @@ void plCameraModifier1::Write(hsStream* stream, hsResMgr* mgr)
{
mgr->WriteKey(stream, fMessageQueue[i]->GetSender());
}
stream->WriteSwap32(fFOVInstructions.Count());
stream->WriteLE32(fFOVInstructions.Count());
for (i = 0; i < fFOVInstructions.Count(); i++)
{
mgr->WriteCreatable(stream, fFOVInstructions[i]);

4
Sources/Plasma/FeatureLib/pfConditional/plANDConditionalObject.cpp

@ -103,7 +103,7 @@ void plANDConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
plConditionalObject::Read(stream, mgr);
plCondRefMsg* refMsg;
int n = stream->ReadSwap32();
int n = stream->ReadLE32();
fChildren.SetCountAndZero(n);
for(int i = 0; i < n; i++ )
{
@ -116,7 +116,7 @@ void plANDConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Write(stream, mgr);
stream->WriteSwap32(fChildren.GetCount());
stream->WriteLE32(fChildren.GetCount());
for( int i = 0; i < fChildren.GetCount(); i++ )
fChildren[i]->Write(stream, mgr);
}

4
Sources/Plasma/FeatureLib/pfConditional/plActivatorConditionalObject.cpp

@ -145,14 +145,14 @@ void plActivatorConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Read(stream, mgr);
fActivators.Reset();
int n = stream->ReadSwap32();
int n = stream->ReadLE32();
for (int i = 0; i < n; i++)
fActivators.Append(mgr->ReadKey(stream));
}
void plActivatorConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Write(stream, mgr);
stream->WriteSwap32(fActivators.Count());
stream->WriteLE32(fActivators.Count());
for (int i = 0; i < fActivators.Count(); i++)
mgr->WriteKey(stream, fActivators[i]);
}

4
Sources/Plasma/FeatureLib/pfConditional/plAnimationEventConditionalObject.cpp

@ -86,13 +86,13 @@ void plAnimationEventConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Read(stream, mgr);
fTarget = mgr->ReadKey(stream);
fAction = (CallbackEvent)stream->ReadSwap32();
fAction = (CallbackEvent)stream->ReadLE32();
}
void plAnimationEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Write(stream, mgr);
mgr->WriteKey(stream, fTarget);
stream->WriteSwap32(fAction);
stream->WriteLE32(fAction);
}

4
Sources/Plasma/FeatureLib/pfConditional/plControlEventConditionalObject.cpp

@ -73,12 +73,12 @@ hsBool plControlEventConditionalObject::MsgReceive(plMessage* msg)
void plControlEventConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Read(stream, mgr);
fControlEvent = (ControlEventCode)stream->ReadSwap32();
fControlEvent = (ControlEventCode)stream->ReadLE32();
}
void plControlEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Write(stream, mgr);
stream->WriteSwap32((UInt32)fControlEvent);
stream->WriteLE32((UInt32)fControlEvent);
}

4
Sources/Plasma/FeatureLib/pfConditional/plFacingConditionalObject.cpp

@ -67,14 +67,14 @@ hsBool plFacingConditionalObject::MsgReceive(plMessage* msg)
void plFacingConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Write(stream, mgr);
stream->WriteSwap(fTolerance);
stream->WriteLE(fTolerance);
stream->WriteBool(fDirectional);
}
void plFacingConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Read(stream, mgr);
stream->ReadSwap(&fTolerance);
stream->ReadLE(&fTolerance);
fDirectional = stream->ReadBool();
}

4
Sources/Plasma/FeatureLib/pfConditional/plKeyPressConditionalObject.cpp

@ -73,12 +73,12 @@ hsBool plKeyPressConditionalObject::MsgReceive(plMessage* msg)
void plKeyPressConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Read(stream, mgr);
fKeyEvent = (plKeyDef)stream->ReadSwap32();
fKeyEvent = (plKeyDef)stream->ReadLE32();
}
void plKeyPressConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Write(stream, mgr);
stream->WriteSwap32((UInt32)fKeyEvent);
stream->WriteLE32((UInt32)fKeyEvent);
}

4
Sources/Plasma/FeatureLib/pfConditional/plORConditionalObject.cpp

@ -108,7 +108,7 @@ void plORConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
plConditionalObject::Read(stream, mgr);
plCondRefMsg* refMsg;
int n = stream->ReadSwap32();
int n = stream->ReadLE32();
fChildren.SetCountAndZero(n);
for(int i = 0; i < n; i++ )
{
@ -121,7 +121,7 @@ void plORConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Write(stream, mgr);
stream->WriteSwap32(fChildren.GetCount());
stream->WriteLE32(fChildren.GetCount());
for( int i = 0; i < fChildren.GetCount(); i++ )
mgr->WriteKey(stream, fChildren[i]);
}

8
Sources/Plasma/FeatureLib/pfConditional/plObjectInBoxConditionalObject.cpp

@ -282,15 +282,15 @@ hsBool plVolumeSensorConditionalObject::Satisfied()
void plVolumeSensorConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Read(stream, mgr);
fTrigNum = stream->ReadSwap32();
fType = stream->ReadSwap32();
fTrigNum = stream->ReadLE32();
fType = stream->ReadLE32();
fFirst = stream->ReadBool();
}
void plVolumeSensorConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{
plConditionalObject::Write(stream, mgr);
stream->WriteSwap32(fTrigNum);
stream->WriteSwap32(fType);
stream->WriteLE32(fTrigNum);
stream->WriteLE32(fType);
stream->WriteBool(fFirst);
}
#include "pnMessage/plPlayerPageMsg.h"

12
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp

@ -201,18 +201,18 @@ void pfGUIButtonMod::Read( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
UInt32 i, count = s->ReadLE32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fMouseOverAnimKeys.Reset();
count = s->ReadSwap32();
count = s->ReadLE32();
for( i = 0; i < count; i++ )
fMouseOverAnimKeys.Append( mgr->ReadKey( s ) );
fMouseOverAnimName = s->ReadSafeString();
fNotifyType = s->ReadSwap32();
fNotifyType = s->ReadLE32();
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef );
}
@ -221,18 +221,18 @@ void pfGUIButtonMod::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );
count = fMouseOverAnimKeys.GetCount();
s->WriteSwap32( count );
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fMouseOverAnimKeys[ i ] );
s->WriteSafeString( fMouseOverAnimName );
s->WriteSwap32( fNotifyType );
s->WriteLE32( fNotifyType );
mgr->WriteKey( s, fDraggable != nil ? fDraggable->GetKey() : nil );

4
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp

@ -98,7 +98,7 @@ void pfGUICheckBoxCtrl::Read( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
UInt32 i, count = s->ReadLE32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
@ -111,7 +111,7 @@ void pfGUICheckBoxCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );

12
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlHandlers.cpp

@ -61,18 +61,18 @@ void pfGUICtrlProcWriteableObject::Write( pfGUICtrlProcWriteableObject *obj,
{
if( obj != nil )
{
s->WriteSwap32( obj->fType );
s->WriteLE32( obj->fType );
obj->IWrite( s );
}
else
s->WriteSwap32( kNull );
s->WriteLE32( kNull );
}
pfGUICtrlProcWriteableObject *pfGUICtrlProcWriteableObject::Read( hsStream *s )
{
pfGUICtrlProcWriteableObject *obj;
UInt32 type = s->ReadSwap32();
UInt32 type = s->ReadLE32();
switch( type )
{
@ -125,7 +125,7 @@ pfGUIConsoleCmdProc::~pfGUIConsoleCmdProc()
void pfGUIConsoleCmdProc::IRead( hsStream *s )
{
int i = s->ReadSwap32();
int i = s->ReadLE32();
if( i > 0 )
{
fCommand = TRACKED_NEW char[ i + 1 ];
@ -140,11 +140,11 @@ void pfGUIConsoleCmdProc::IWrite( hsStream *s )
{
if( fCommand != nil )
{
s->WriteSwap32( strlen( fCommand ) );
s->WriteLE32( strlen( fCommand ) );
s->Write( strlen( fCommand ), fCommand );
}
else
s->WriteSwap32( 0 );
s->WriteLE32( 0 );
}
void pfGUIConsoleCmdProc::DoSomething( pfGUIControlMod *ctrl )

20
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp

@ -127,12 +127,12 @@ void pfGUIColorScheme::Read( hsStream *s )
fBackColor.Read( s );
fSelForeColor.Read( s );
fSelBackColor.Read( s );
s->ReadSwap( &fTransparent );
s->ReadLE( &fTransparent );
delete [] fFontFace;
fFontFace = s->ReadSafeString();
s->ReadSwap( &fFontSize );
s->ReadSwap( &fFontFlags );
s->ReadLE( &fFontSize );
s->ReadLE( &fFontFlags );
}
void pfGUIColorScheme::Write( hsStream *s )
@ -141,11 +141,11 @@ void pfGUIColorScheme::Write( hsStream *s )
fBackColor.Write( s );
fSelForeColor.Write( s );
fSelBackColor.Write( s );
s->WriteSwap( fTransparent );
s->WriteLE( fTransparent );
s->WriteSafeString( fFontFace );
s->WriteSwap( fFontSize );
s->WriteSwap( fFontFlags );
s->WriteLE( fFontSize );
s->WriteLE( fFontFlags );
}
//// Constructor/Destructor //////////////////////////////////////////////////
@ -809,7 +809,7 @@ void pfGUIControlMod::Refresh( void )
void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr )
{
plSingleModifier::Read(s, mgr);
s->ReadSwap( &fTagID );
s->ReadLE( &fTagID );
fVisible = s->ReadBool();
// Read the handler in
@ -842,7 +842,7 @@ void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr )
{
fSoundIndices.SetCountAndZero( count );
for( i = 0; i < count; i++ )
fSoundIndices[ i ] = (int)s->ReadSwap32();
fSoundIndices[ i ] = (int)s->ReadLE32();
}
if( HasFlag( kHasProxy ) )
@ -857,7 +857,7 @@ void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr )
ClearFlag( kHasProxy );
plSingleModifier::Write( s, mgr );
s->WriteSwap( fTagID );
s->WriteLE( fTagID );
s->WriteBool( fVisible );
// Write the handler out (if it's not a writeable, damn you)
@ -885,7 +885,7 @@ void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr )
s->WriteByte( fSoundIndices.GetCount() );
UInt8 i;
for( i = 0; i < fSoundIndices.GetCount(); i++ )
s->WriteSwap32( fSoundIndices[ i ] );
s->WriteLE32( fSoundIndices[ i ] );
if( HasFlag( kHasProxy ) )
mgr->WriteKey( s, fProxy->GetKey() );

12
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp

@ -296,7 +296,7 @@ void pfGUIDialogMod::Read( hsStream *s, hsResMgr *mgr )
s->Read( sizeof( fName ), fName );
UInt32 i, count = s->ReadSwap32();
UInt32 i, count = s->ReadLE32();
fControls.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kControlRef ), plRefFlags::kActiveRef );
@ -310,13 +310,13 @@ void pfGUIDialogMod::Read( hsStream *s, hsResMgr *mgr )
hsgResMgr::ResMgr()->AddViaNotify( GetKey(), refMsg, plRefFlags::kPassiveRef );
}
s->ReadSwap( &fTagID );
s->ReadLE( &fTagID );
fProcReceiver = mgr->ReadKey( s );
if( fProcReceiver != nil )
SetHandler( TRACKED_NEW pfGUIDialogNotifyProc( fProcReceiver ) );
s->ReadSwap( &fVersion );
s->ReadLE( &fVersion );
fColorScheme->Read( s );
@ -333,15 +333,15 @@ void pfGUIDialogMod::Write( hsStream *s, hsResMgr *mgr )
mgr->WriteKey( s, fRenderMod->GetKey() );
s->Write( sizeof( fName ), fName );
s->WriteSwap32( fControls.GetCount() );
s->WriteLE32( fControls.GetCount() );
for( i = 0; i < fControls.GetCount(); i++ )
mgr->WriteKey( s, fControls[ i ]->GetKey() );
s->WriteSwap( fTagID );
s->WriteLE( fTagID );
mgr->WriteKey( s, fProcReceiver );
s->WriteSwap( fVersion );
s->WriteLE( fVersion );
fColorScheme->Write( s );

12
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDynDisplayCtrl.cpp

@ -121,17 +121,17 @@ void pfGUIDynDisplayCtrl::Read( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Read(s, mgr);
count = s->ReadSwap32();
count = s->ReadLE32();
fTextMaps.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef );
count = s->ReadSwap32();
count = s->ReadLE32();
fLayers.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef );
count = s->ReadSwap32();
count = s->ReadLE32();
fMaterials.SetCountAndZero( count );
for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefMaterial ), plRefFlags::kActiveRef );
@ -144,15 +144,15 @@ void pfGUIDynDisplayCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr );
s->WriteSwap32( fTextMaps.GetCount() );
s->WriteLE32( fTextMaps.GetCount() );
for( i = 0; i < fTextMaps.GetCount(); i++ )
mgr->WriteKey( s, fTextMaps[ i ]->GetKey() );
s->WriteSwap32( fLayers.GetCount() );
s->WriteLE32( fLayers.GetCount() );
for( i = 0; i < fLayers.GetCount(); i++ )
mgr->WriteKey( s, fLayers[ i ]->GetKey() );
s->WriteSwap32( fMaterials.GetCount() );
s->WriteLE32( fMaterials.GetCount() );
for( i = 0; i < fMaterials.GetCount(); i++ )
mgr->WriteKey( s, fMaterials[ i ]->GetKey() );
}

4
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp

@ -109,7 +109,7 @@ void pfGUIKnobCtrl::Read( hsStream *s, hsResMgr *mgr )
pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
UInt32 i, count = s->ReadLE32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
@ -125,7 +125,7 @@ void pfGUIKnobCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );

36
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp

@ -240,9 +240,9 @@ void pfGUIPopUpMenu::Read( hsStream *s, hsResMgr *mgr )
fOriginX = fOriginY = -1.f;
fMargin = s->ReadSwap16();
fMargin = s->ReadLE16();
UInt32 i, count = s->ReadSwap32();
UInt32 i, count = s->ReadLE32();
fMenuItems.SetCountAndZero( count );
for( i = 0; i < count; i++ )
{
@ -271,9 +271,9 @@ void pfGUIPopUpMenu::Write( hsStream *s, hsResMgr *mgr )
pfGUIDialogMod::Write( s, mgr );
s->WriteSwap16( fMargin );
s->WriteLE16( fMargin );
s->WriteSwap32( fMenuItems.GetCount() );
s->WriteLE32( fMenuItems.GetCount() );
UInt32 i;
for( i = 0; i < fMenuItems.GetCount(); i++ )
{
@ -892,11 +892,11 @@ void pfGUISkin::Read( hsStream *s, hsResMgr *mgr )
{
hsKeyedObject::Read( s, mgr );
s->ReadSwap( &fItemMargin );
s->ReadSwap( &fBorderMargin );
s->ReadLE( &fItemMargin );
s->ReadLE( &fBorderMargin );
UInt32 i, count;
s->ReadSwap( &count );
s->ReadLE( &count );
for( i = 0; i < count; i++ )
fElements[ i ].Read( s );
@ -911,11 +911,11 @@ void pfGUISkin::Write( hsStream *s, hsResMgr *mgr )
{
hsKeyedObject::Write( s, mgr );
s->WriteSwap( fItemMargin );
s->WriteSwap( fBorderMargin );
s->WriteLE( fItemMargin );
s->WriteLE( fBorderMargin );
UInt32 i = kNumElements;
s->WriteSwap( i );
s->WriteLE( i );
for( i = 0; i < kNumElements; i++ )
fElements[ i ].Write( s );
@ -941,16 +941,16 @@ hsBool pfGUISkin::MsgReceive( plMessage *msg )
void pfGUISkin::pfSRect::Read( hsStream *s )
{
s->ReadSwap( &fX );
s->ReadSwap( &fY );
s->ReadSwap( &fWidth );
s->ReadSwap( &fHeight );
s->ReadLE( &fX );
s->ReadLE( &fY );
s->ReadLE( &fWidth );
s->ReadLE( &fHeight );
}
void pfGUISkin::pfSRect::Write( hsStream *s )
{
s->WriteSwap( fX );
s->WriteSwap( fY );
s->WriteSwap( fWidth );
s->WriteSwap( fHeight );
s->WriteLE( fX );
s->WriteLE( fY );
s->WriteLE( fWidth );
s->WriteLE( fHeight );
}

4
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp

@ -111,7 +111,7 @@ void pfGUIProgressCtrl::Read( hsStream *s, hsResMgr *mgr )
pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32();
UInt32 i, count = s->ReadLE32();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
@ -124,7 +124,7 @@ void pfGUIProgressCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count );
s->WriteLE32( count );
for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName );

8
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIRadioGroupCtrl.cpp

@ -175,7 +175,7 @@ void pfGUIRadioGroupCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
UInt32 i, count = s->ReadSwap32();
UInt32 i, count = s->ReadLE32();
fControls.SetCountAndZero( count );
for( i = 0; i < count; i++ )
@ -183,7 +183,7 @@ void pfGUIRadioGroupCtrl::Read( hsStream *s, hsResMgr *mgr )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefControl ), plRefFlags::kActiveRef );
}
fValue = fDefaultValue = s->ReadSwap16();
fValue = fDefaultValue = s->ReadLE16();
if( fValue != -1 && fControls[ fValue ] != nil )
fControls[ fValue ]->SetChecked( true );
}
@ -195,11 +195,11 @@ void pfGUIRadioGroupCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr );
s->WriteSwap32( fControls.GetCount() );
s->WriteLE32( fControls.GetCount() );
for( i = 0; i < fControls.GetCount(); i++ )
mgr->WriteKey( s, fControls[ i ]->GetKey() );
s->WriteSwap16( (UInt16)fDefaultValue );
s->WriteLE16( (UInt16)fDefaultValue );
}
//// SetValue ////////////////////////////////////////////////////////////////

6
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp

@ -154,7 +154,7 @@ void pfGUITextBoxMod::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
UInt32 len = s->ReadSwap32();
UInt32 len = s->ReadLE32();
if( len > 0 )
{
char *text = TRACKED_NEW char[ len + 1 ];
@ -181,11 +181,11 @@ void pfGUITextBoxMod::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr );
if( fText == nil )
s->WriteSwap32( 0 );
s->WriteLE32( 0 );
else
{
char *text = hsWStringToString(fText);
s->WriteSwap32( strlen( text ) );
s->WriteLE32( strlen( text ) );
s->Write( strlen( text ), text );
delete [] text;
}

12
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIUpDownPairMod.cpp

@ -208,9 +208,9 @@ void pfGUIUpDownPairMod::Read( hsStream *s, hsResMgr *mgr )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefUpControl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef );
s->ReadSwap( &fMin );
s->ReadSwap( &fMax );
s->ReadSwap( &fStep );
s->ReadLE( &fMin );
s->ReadLE( &fMax );
s->ReadLE( &fStep );
fValue = fMin;
}
@ -222,9 +222,9 @@ void pfGUIUpDownPairMod::Write( hsStream *s, hsResMgr *mgr )
mgr->WriteKey( s, fUpControl->GetKey() );
mgr->WriteKey( s, fDownControl->GetKey() );
s->WriteSwap( fMin );
s->WriteSwap( fMax );
s->WriteSwap( fStep );
s->WriteLE( fMin );
s->WriteLE( fMax );
s->WriteLE( fStep );
}

12
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIValueCtrl.cpp

@ -93,9 +93,9 @@ void pfGUIValueCtrl::Read( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Read(s, mgr);
s->ReadSwap( &fMin );
s->ReadSwap( &fMax );
s->ReadSwap( &fStep );
s->ReadLE( &fMin );
s->ReadLE( &fMax );
s->ReadLE( &fStep );
fValue = fMin;
}
@ -104,8 +104,8 @@ void pfGUIValueCtrl::Write( hsStream *s, hsResMgr *mgr )
{
pfGUIControlMod::Write( s, mgr );
s->WriteSwap( fMin );
s->WriteSwap( fMax );
s->WriteSwap( fStep );
s->WriteLE( fMin );
s->WriteLE( fMax );
s->WriteLE( fStep );
}

4
Sources/Plasma/FeatureLib/pfMessage/pfGUINotifyMsg.h

@ -126,14 +126,14 @@ public:
{
plMessage::IMsgRead(stream, mgr);
fControlKey = mgr->ReadKey(stream);
fEvent = stream->ReadSwap32();
fEvent = stream->ReadLE32();
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
mgr->WriteKey(stream, fControlKey);
stream->WriteSwap32(fEvent);
stream->WriteLE32(fEvent);
}
};

4
Sources/Plasma/FeatureLib/pfMessage/pfGameGUIMsg.h

@ -78,7 +78,7 @@ class pfGameGUIMsg : public plMessage
virtual void Read(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgRead( s, mgr );
s->ReadSwap( &fCommand );
s->ReadLE( &fCommand );
s->Read( sizeof( fString ), fString );
fAge = s->ReadSafeString();
}
@ -86,7 +86,7 @@ class pfGameGUIMsg : public plMessage
virtual void Write(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgWrite( s, mgr );
s->WriteSwap( fCommand );
s->WriteLE( fCommand );
s->Write( sizeof( fString ), fString );
s->WriteSafeString( fAge );
}

20
Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h

@ -189,9 +189,9 @@ class pfKIMsg : public plMessage
virtual void Read(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgRead( s, mgr );
s->ReadSwap( &fCommand );
s->ReadLE( &fCommand );
fUser = s->ReadSafeString();
fPlayerID = s->ReadSwap32();
fPlayerID = s->ReadLE32();
wchar_t *temp = s->ReadSafeWString();
if (temp) // apparently ReadSafeWString can return null, which std::wstring doesn't like being assigned
@ -200,21 +200,21 @@ class pfKIMsg : public plMessage
fString = L"";
delete [] temp;
fFlags = s->ReadSwap32();
fDelay = s->ReadSwapScalar();
fValue = s->ReadSwap32();
fFlags = s->ReadLE32();
fDelay = s->ReadLEScalar();
fValue = s->ReadLE32();
}
virtual void Write(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgWrite( s, mgr );
s->WriteSwap( fCommand );
s->WriteLE( fCommand );
s->WriteSafeString( fUser );
s->WriteSwap32( fPlayerID );
s->WriteLE32( fPlayerID );
s->WriteSafeWString( fString.c_str() );
s->WriteSwap32( fFlags );
s->WriteSwapScalar(fDelay);
s->WriteSwap32( fValue );
s->WriteLE32( fFlags );
s->WriteLEScalar(fDelay);
s->WriteLE32( fValue );
}
UInt8 GetCommand( void ) const { return fCommand; }

4
Sources/Plasma/FeatureLib/pfMessage/pfMarkerMsg.cpp

@ -62,7 +62,7 @@ void pfMarkerMsg::Read(hsStream* stream, hsResMgr* mgr)
fType = (Type)stream->ReadByte();
if (fType == kMarkerCaptured)
fMarkerID = stream->ReadSwap32();
fMarkerID = stream->ReadLE32();
}
void pfMarkerMsg::Write(hsStream* stream, hsResMgr* mgr)
@ -72,7 +72,7 @@ void pfMarkerMsg::Write(hsStream* stream, hsResMgr* mgr)
stream->WriteByte(fType);
if (fType == kMarkerCaptured)
stream->WriteSwap32(fMarkerID);
stream->WriteLE32(fMarkerID);
}
void pfMarkerMsg::PrintDebug(char* buf)

12
Sources/Plasma/FeatureLib/pfMessage/plClothingMsg.cpp

@ -47,27 +47,27 @@ void plClothingMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fCommands = stream->ReadSwap32();
fCommands = stream->ReadLE32();
if (stream->ReadBool())
fItemKey = mgr->ReadKey(stream);
fColor.Read(stream);
fLayer = stream->ReadByte();
fDelta = stream->ReadByte();
fWeight = stream->ReadSwapScalar();
fWeight = stream->ReadLEScalar();
}
void plClothingMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap32(fCommands);
stream->WriteLE32(fCommands);
stream->WriteBool(fItemKey != nil);
if (fItemKey)
mgr->WriteKey(stream, fItemKey);
fColor.Write(stream);
stream->WriteByte(fLayer);
stream->WriteByte(fDelta);
stream->WriteSwapScalar(fWeight);
stream->WriteLEScalar(fWeight);
}
enum ClothingFlags
@ -85,7 +85,7 @@ void plClothingMsg::ReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s);
if (contentFlags.IsBitSet(kClothingCommands))
fCommands = s->ReadSwap32();
fCommands = s->ReadLE32();
if (contentFlags.IsBitSet(kClothingItemKey))
{
if (s->ReadBool())
@ -106,7 +106,7 @@ void plClothingMsg::WriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
// kClothingCommands
s->WriteSwap32(fCommands);
s->WriteLE32(fCommands);
// kClothingItemKey
s->WriteBool(fItemKey != nil);
if (fItemKey)

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

@ -2301,10 +2301,10 @@ public:
if ( ageInfoStream && nPlayersStream )
{
UInt16 nAgeInfoEntries;
ageInfoStream->GetStream()->ReadSwap( &nAgeInfoEntries );
ageInfoStream->GetStream()->ReadLE( &nAgeInfoEntries );
UInt16 nPlayerCountEntries;
nPlayersStream->GetStream()->ReadSwap( &nPlayerCountEntries );
nPlayersStream->GetStream()->ReadLE( &nPlayerCountEntries );
hsAssert( nAgeInfoEntries==nPlayerCountEntries, "huh?" );
@ -2316,7 +2316,7 @@ public:
plAgeInfoStruct ageInfo;
UInt32 nPlayers;
ageInfo.Read( ageInfoStream->GetStream(), nil );
nPlayersStream->GetStream()->ReadSwap( &nPlayers );
nPlayersStream->GetStream()->ReadLE( &nPlayers );
PyObject* t = PyTuple_New(2);
PyTuple_SetItem(t, 0, pyAgeInfoStruct::New(&ageInfo));
PyTuple_SetItem(t, 1, PyLong_FromUnsignedLong(nPlayers));

8
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp

@ -2942,7 +2942,7 @@ void plPythonFileMod::Read(hsStream* stream, hsResMgr* mgr)
fPythonFile = stream->ReadSafeString();
// then read in the list of receivers that want to be notified
int nRcvs = stream->ReadSwap32();
int nRcvs = stream->ReadLE32();
fReceivers.Reset();
int m;
for( m=0; m<nRcvs; m++ )
@ -2951,7 +2951,7 @@ void plPythonFileMod::Read(hsStream* stream, hsResMgr* mgr)
}
// then read in the list of parameters
int nParms = stream->ReadSwap32();
int nParms = stream->ReadLE32();
fParameters.SetCountAndZero(nParms);
int i;
for( i=0; i<nParms; i++ )
@ -2969,13 +2969,13 @@ void plPythonFileMod::Write(hsStream* stream, hsResMgr* mgr)
stream->WriteSafeString(fPythonFile);
// then write out the list of receivers that want to be notified
stream->WriteSwap32(fReceivers.GetCount());
stream->WriteLE32(fReceivers.GetCount());
int m;
for( m=0; m<fReceivers.GetCount(); m++ )
mgr->WriteKey(stream, fReceivers[m]);
// then write out the list of parameters
stream->WriteSwap32(fParameters.GetCount());
stream->WriteLE32(fParameters.GetCount());
int i;
for( i=0; i<fParameters.GetCount(); i++ )
fParameters[i].Write(stream,mgr);

6
Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp

@ -144,7 +144,7 @@ bool plPythonPack::Open()
delete [] tempFilename;
// read the index data
int numFiles = fPackStream->ReadSwap32();
int numFiles = fPackStream->ReadLE32();
UInt32 streamIndex = (UInt32)(fPackStreams.size());
for (int i = 0; i < numFiles; i++)
{
@ -152,7 +152,7 @@ bool plPythonPack::Open()
char* buf = fPackStream->ReadSafeString();
std::string pythonName = buf; // reading a "string" from a hsStream directly into a stl string causes memory loss
delete [] buf;
UInt32 offset = fPackStream->ReadSwap32();
UInt32 offset = fPackStream->ReadLE32();
plPackOffsetInfo offsetInfo;
offsetInfo.fOffset = offset;
@ -209,7 +209,7 @@ PyObject* plPythonPack::OpenPacked(const char* fileName)
fPackStream->SetPosition(offsetInfo.fOffset);
Int32 size = fPackStream->ReadSwap32();
Int32 size = fPackStream->ReadLE32();
if (size > 0)
{
char *buf = TRACKED_NEW char[size];

28
Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h

@ -356,32 +356,32 @@ public:
{
SetToNone();
fID = stream->ReadSwap32();
fValueType = stream->ReadSwap32();
fID = stream->ReadLE32();
fValueType = stream->ReadLE32();
// read the different types of data
int count;
switch ( fValueType )
{
case kInt:
datarecord.fIntNumber = stream->ReadSwap32();
datarecord.fIntNumber = stream->ReadLE32();
break;
case kFloat:
stream->ReadSwap(&datarecord.fFloatNumber);
stream->ReadLE(&datarecord.fFloatNumber);
break;
case kBoolean:
datarecord.fBool = stream->ReadSwap32();
datarecord.fBool = stream->ReadLE32();
break;
case kString:
case kAnimationName:
count = stream->ReadSwap32();
count = stream->ReadLE32();
if ( count != 0 )
{
datarecord.fString = TRACKED_NEW char[count+1];
stream->ReadSwap(count,datarecord.fString);
stream->ReadLE(count,datarecord.fString);
}
else
datarecord.fString = nil;
@ -412,20 +412,20 @@ public:
void Write(hsStream * stream, hsResMgr* mgr)
{
int count;
stream->WriteSwap32(fID);
stream->WriteSwap32(fValueType);
stream->WriteLE32(fID);
stream->WriteLE32(fValueType);
switch ( fValueType )
{
case kInt:
stream->WriteSwap32(datarecord.fIntNumber);
stream->WriteLE32(datarecord.fIntNumber);
break;
case kFloat:
stream->WriteSwap(datarecord.fFloatNumber);
stream->WriteLE(datarecord.fFloatNumber);
break;
case kBoolean:
stream->WriteSwap32(datarecord.fBool);
stream->WriteLE32(datarecord.fBool);
break;
case kString:
@ -434,9 +434,9 @@ public:
count = hsStrlen(datarecord.fString)+1;
else
count = 0;
stream->WriteSwap(count);
stream->WriteLE(count);
if ( count != 0 )
stream->WriteSwap(count,datarecord.fString);
stream->WriteLE(count,datarecord.fString);
break;
case kSceneObject:

4
Sources/Plasma/FeatureLib/pfSurface/plDistOpacityMod.cpp

@ -186,7 +186,7 @@ void plDistOpacityMod::Read(hsStream* s, hsResMgr* mgr)
int i;
for( i = 0; i < kNumDists; i++ )
fDists[i] = s->ReadSwapScalar();
fDists[i] = s->ReadLEScalar();
ICheckDists();
@ -199,7 +199,7 @@ void plDistOpacityMod::Write(hsStream* s, hsResMgr* mgr)
int i;
for( i = 0; i < kNumDists; i++ )
s->WriteSwapScalar(fDists[i]);
s->WriteLEScalar(fDists[i]);
}
void plDistOpacityMod::SetTarget(plSceneObject* so)

4
Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityLay.cpp

@ -78,13 +78,13 @@ void plFadeOpacityLay::Read(hsStream* s, hsResMgr* mgr)
{
plLayerInterface::Read(s, mgr);
fOpScale = s->ReadSwapScalar();
fOpScale = s->ReadLEScalar();
}
void plFadeOpacityLay::Write(hsStream* s, hsResMgr* mgr)
{
plLayerInterface::Write(s, mgr);
s->WriteSwapScalar(fOpScale);
s->WriteLEScalar(fOpScale);
}

8
Sources/Plasma/FeatureLib/pfSurface/plFadeOpacityMod.cpp

@ -126,16 +126,16 @@ void plFadeOpacityMod::Read(hsStream* s, hsResMgr* mgr)
{
plSingleModifier::Read(s, mgr);
fFadeUp = s->ReadSwapScalar();
fFadeDown = s->ReadSwapScalar();
fFadeUp = s->ReadLEScalar();
fFadeDown = s->ReadLEScalar();
}
void plFadeOpacityMod::Write(hsStream* s, hsResMgr* mgr)
{
plSingleModifier::Write(s, mgr);
s->WriteSwapScalar(fFadeUp);
s->WriteSwapScalar(fFadeDown);
s->WriteLEScalar(fFadeUp);
s->WriteLEScalar(fFadeDown);
}
void plFadeOpacityMod::SetTarget(plSceneObject* so)

4
Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp

@ -185,7 +185,7 @@ void plLayerMovie::Read(hsStream* s, hsResMgr* mgr)
plLayerAnimation::Read(s, mgr);
delete [] fMovieName;
int len = s->ReadSwap32();
int len = s->ReadLE32();
if( len )
{
fMovieName = TRACKED_NEW char[len+1];
@ -204,7 +204,7 @@ void plLayerMovie::Write(hsStream* s, hsResMgr* mgr)
plLayerAnimation::Write(s, mgr);
int len = hsStrlen(fMovieName);
s->WriteSwap32(len);
s->WriteLE32(len);
if( len )
s->Write(len, fMovieName);
}

20
Sources/Plasma/NucleusLib/inc/hsGMatState.inl

@ -7,20 +7,20 @@
void hsGMatState::Read(hsStream* s)
{
fBlendFlags = s->ReadSwap32();
fClampFlags = s->ReadSwap32();
fShadeFlags = s->ReadSwap32();
fZFlags = s->ReadSwap32();
fMiscFlags = s->ReadSwap32();
fBlendFlags = s->ReadLE32();
fClampFlags = s->ReadLE32();
fShadeFlags = s->ReadLE32();
fZFlags = s->ReadLE32();
fMiscFlags = s->ReadLE32();
}
void hsGMatState::Write(hsStream* s)
{
s->WriteSwap32(fBlendFlags);
s->WriteSwap32(fClampFlags);
s->WriteSwap32(fShadeFlags);
s->WriteSwap32(fZFlags);
s->WriteSwap32(fMiscFlags);
s->WriteLE32(fBlendFlags);
s->WriteLE32(fClampFlags);
s->WriteLE32(fShadeFlags);
s->WriteLE32(fZFlags);
s->WriteLE32(fMiscFlags);
}
void hsGMatState::Clear(const hsGMatState& state)

12
Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp

@ -189,8 +189,8 @@ hsKeyedObject* plKeyImp::VerifyLoaded()
void plKeyImp::Read(hsStream* s)
{
fUoid.Read(s);
s->ReadSwap(&fStartPos);
s->ReadSwap(&fDataLen);
s->ReadLE(&fStartPos);
s->ReadLE(&fDataLen);
plProfile_NewMem(KeyMem, CalcKeySize(this));
@ -204,15 +204,15 @@ void plKeyImp::SkipRead(hsStream* s)
{
plUoid tempUoid;
tempUoid.Read(s);
s->ReadSwap32();
s->ReadSwap32();
s->ReadLE32();
s->ReadLE32();
}
void plKeyImp::Write(hsStream* s)
{
fUoid.Write(s);
s->WriteSwap(fStartPos);
s->WriteSwap(fDataLen);
s->WriteLE(fStartPos);
s->WriteLE(fDataLen);
if (fStartPos == (UInt32)-1)
int foo = 0;
}

4
Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp

@ -75,7 +75,7 @@ void plMsgForwarder::Read(hsStream* s, hsResMgr* mgr)
{
hsKeyedObject::Read(s, mgr);
int numKeys = s->ReadSwap32();
int numKeys = s->ReadLE32();
fForwardKeys.Reset();
fForwardKeys.Expand(numKeys);
fForwardKeys.SetCount(numKeys);
@ -91,7 +91,7 @@ void plMsgForwarder::Write(hsStream* s, hsResMgr* mgr)
hsKeyedObject::Write(s, mgr);
int numKeys = fForwardKeys.Count();
s->WriteSwap32(numKeys);
s->WriteLE32(numKeys);
for (int i = 0; i < numKeys; i++)
mgr->WriteKey(s, fForwardKeys[i]);
}

28
Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp

@ -59,14 +59,14 @@ plLocation::plLocation(const plLocation& toCopyFrom)
void plLocation::Read(hsStream* s)
{
s->LogReadSwap(&fSequenceNumber, "Location Sequence Number");
s->LogReadSwap(&fFlags, "Location Flags");
s->LogReadLE(&fSequenceNumber, "Location Sequence Number");
s->LogReadLE(&fFlags, "Location Flags");
}
void plLocation::Write(hsStream* s) const
{
s->WriteSwap(fSequenceNumber);
s->WriteSwap(fFlags);
s->WriteLE(fSequenceNumber);
s->WriteLE(fFlags);
}
plLocation& plLocation::operator=(const plLocation& rhs)
@ -175,18 +175,18 @@ void plUoid::Read(hsStream* s)
else
fLoadMask.SetAlways();
s->LogReadSwap(&fClassType, "ClassType");
s->LogReadSwap(&fObjectID, "ObjectID");
s->LogReadLE(&fClassType, "ClassType");
s->LogReadLE(&fObjectID, "ObjectID");
s->LogSubStreamPushDesc("ObjectName");
fObjectName = s->LogReadSafeString();
// conditional cloneIDs read
if (contents & kHasCloneIDs)
{
s->LogReadSwap( &fCloneID ,"CloneID");
s->LogReadLE( &fCloneID ,"CloneID");
UInt16 dummy;
s->LogReadSwap(&dummy, "dummy"); // To avoid breaking format
s->LogReadSwap( &fClonePlayerID ,"ClonePlayerID");
s->LogReadLE(&dummy, "dummy"); // To avoid breaking format
s->LogReadLE( &fClonePlayerID ,"ClonePlayerID");
}
else
{
@ -209,17 +209,17 @@ void plUoid::Write(hsStream* s) const
if (contents & kHasLoadMask)
fLoadMask.Write(s);
s->WriteSwap( fClassType );
s->WriteSwap( fObjectID );
s->WriteLE( fClassType );
s->WriteLE( fObjectID );
s->WriteSafeString( fObjectName );
// conditional cloneIDs write
if (contents & kHasCloneIDs)
{
s->WriteSwap(fCloneID);
s->WriteLE(fCloneID);
UInt16 dummy = 0;
s->WriteSwap(dummy); // to avoid breaking format
s->WriteSwap(fClonePlayerID);
s->WriteLE(dummy); // to avoid breaking format
s->WriteLE(fClonePlayerID);
}
}

4
Sources/Plasma/NucleusLib/pnMessage/plAudioSysMsg.h

@ -94,14 +94,14 @@ public:
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->WriteSwap(fAudFlag);
stream->WriteLE(fAudFlag);
mgr->WriteKey(stream, pObj);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->ReadSwap(&fAudFlag);
stream->ReadLE(&fAudFlag);
pObj = mgr->ReadKey(stream);
}
};

48
Sources/Plasma/NucleusLib/pnMessage/plCameraMsg.cpp

@ -81,7 +81,7 @@ void plCameraMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fCmd.Read(stream);
fTransTime = stream->ReadSwapDouble();
fTransTime = stream->ReadLEDouble();
fActivated = stream->ReadBool();
fNewCam = mgr->ReadKey(stream);
fTriggerer = mgr->ReadKey(stream);
@ -92,7 +92,7 @@ void plCameraMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fCmd.Write(stream);
stream->WriteSwapDouble(fTransTime);
stream->WriteLEDouble(fTransTime);
stream->WriteBool(fActivated);
mgr->WriteKey(stream, fNewCam);
mgr->WriteKey(stream, fTriggerer);
@ -101,33 +101,33 @@ void plCameraMsg::Write(hsStream* stream, hsResMgr* mgr)
void plCameraConfig::Read(hsStream* stream)
{
fAccel = stream->ReadSwapFloat();
fDecel = stream->ReadSwapFloat();
fVel = stream->ReadSwapFloat();
fFPAccel = stream->ReadSwapFloat();
fFPDecel = stream->ReadSwapFloat();
fFPVel = stream->ReadSwapFloat();
fFOVw = stream->ReadSwapFloat();
fFOVh = stream->ReadSwapFloat();
fOffset.fX = stream->ReadSwapFloat();
fOffset.fY = stream->ReadSwapFloat();
fOffset.fZ = stream->ReadSwapFloat();
fAccel = stream->ReadLEFloat();
fDecel = stream->ReadLEFloat();
fVel = stream->ReadLEFloat();
fFPAccel = stream->ReadLEFloat();
fFPDecel = stream->ReadLEFloat();
fFPVel = stream->ReadLEFloat();
fFOVw = stream->ReadLEFloat();
fFOVh = stream->ReadLEFloat();
fOffset.fX = stream->ReadLEFloat();
fOffset.fY = stream->ReadLEFloat();
fOffset.fZ = stream->ReadLEFloat();
fWorldspace = stream->ReadBool();
}
void plCameraConfig::Write(hsStream* stream)
{
stream->WriteSwapFloat(fAccel);
stream->WriteSwapFloat(fDecel);
stream->WriteSwapFloat(fVel);
stream->WriteSwapFloat(fFPAccel);
stream->WriteSwapFloat(fFPDecel);
stream->WriteSwapFloat(fFPVel);
stream->WriteSwapFloat(fFOVw);
stream->WriteSwapFloat(fFOVh);
stream->WriteSwapFloat(fOffset.fX);
stream->WriteSwapFloat(fOffset.fY);
stream->WriteSwapFloat(fOffset.fZ);
stream->WriteLEFloat(fAccel);
stream->WriteLEFloat(fDecel);
stream->WriteLEFloat(fVel);
stream->WriteLEFloat(fFPAccel);
stream->WriteLEFloat(fFPDecel);
stream->WriteLEFloat(fFPVel);
stream->WriteLEFloat(fFOVw);
stream->WriteLEFloat(fFOVh);
stream->WriteLEFloat(fOffset.fX);
stream->WriteLEFloat(fOffset.fY);
stream->WriteLEFloat(fOffset.fZ);
stream->WriteBool(fWorldspace);
}

8
Sources/Plasma/NucleusLib/pnMessage/plClientMsg.h

@ -153,15 +153,15 @@ public:
void Read(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType);
stream->ReadSwap(&fWhich);
stream->ReadLE(&fType);
stream->ReadLE(&fWhich);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType);
stream->WriteSwap(fWhich);
stream->WriteLE(fType);
stream->WriteLE(fWhich);
}
};

8
Sources/Plasma/NucleusLib/pnMessage/plCursorChangeMsg.h

@ -91,15 +91,15 @@ public:
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fType = stream->ReadSwap32();
fPriority = stream->ReadSwap32();
fType = stream->ReadLE32();
fPriority = stream->ReadLE32();
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap32(fType);
stream->WriteSwap32(fPriority);
stream->WriteLE32(fType);
stream->WriteLE32(fPriority);
}
};

20
Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h

@ -91,20 +91,20 @@ public:
virtual void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fEventTime = stream->ReadSwapFloat();
fEvent = (CallbackEvent)stream->ReadSwap16();
fIndex = stream->ReadSwap16();
fRepeats = stream->ReadSwap16();
fUser = stream->ReadSwap16();
fEventTime = stream->ReadLEFloat();
fEvent = (CallbackEvent)stream->ReadLE16();
fIndex = stream->ReadLE16();
fRepeats = stream->ReadLE16();
fUser = stream->ReadLE16();
}
virtual void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwapFloat(fEventTime);
stream->WriteSwap16((Int16)fEvent);
stream->WriteSwap16(fIndex);
stream->WriteSwap16(fRepeats);
stream->WriteSwap16(fUser);
stream->WriteLEFloat(fEventTime);
stream->WriteLE16((Int16)fEvent);
stream->WriteLE16(fIndex);
stream->WriteLE16(fRepeats);
stream->WriteLE16(fUser);
}
};

12
Sources/Plasma/NucleusLib/pnMessage/plIntRefMsg.h

@ -78,17 +78,17 @@ public:
void Read(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType);
stream->ReadSwap(&fWhich);
stream->ReadSwap(&fIdx);
stream->ReadLE(&fType);
stream->ReadLE(&fWhich);
stream->ReadLE(&fIdx);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType);
stream->WriteSwap(fWhich);
stream->WriteSwap(fIdx);
stream->WriteLE(fType);
stream->WriteLE(fWhich);
stream->WriteLE(fIdx);
}
};

44
Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp

@ -119,14 +119,14 @@ void plMessage::IMsgRead(hsStream* s, hsResMgr* mgr)
fSender = mgr->ReadKey(s);
int n;
s->LogReadSwap(&n,"NumberOfReceivers");
s->LogReadLE(&n,"NumberOfReceivers");
fReceivers.SetCount(n);
int i;
for( i = 0; i < fReceivers.GetCount(); i++ )
fReceivers[i] = mgr->ReadKey(s);
s->LogReadSwap(&fTimeStamp,"TimeStamp"); // read as double
s->LogReadSwap(&fBCastFlags, "BCastFlags");
s->LogReadLE(&fTimeStamp,"TimeStamp"); // read as double
s->LogReadLE(&fBCastFlags, "BCastFlags");
}
void plMessage::IMsgWrite(hsStream* s, hsResMgr* mgr)
@ -134,13 +134,13 @@ void plMessage::IMsgWrite(hsStream* s, hsResMgr* mgr)
plCreatable::Write(s, mgr);
mgr->WriteKey(s,fSender);
s->WriteSwap32(fReceivers.GetCount());
s->WriteLE32(fReceivers.GetCount());
int i;
for( i = 0; i < fReceivers.GetCount(); i++ )
mgr->WriteKey(s,fReceivers[i]);
s->WriteSwap(fTimeStamp); // write as double
s->WriteSwap32(fBCastFlags);
s->WriteLE(fTimeStamp); // write as double
s->WriteLE32(fBCastFlags);
}
enum MsgFlags
@ -161,7 +161,7 @@ void plMessage::IMsgReadVersion(hsStream* s, hsResMgr* mgr)
if (contentFlags.IsBitSet(kMsgReceivers))
{
int n = s->ReadSwap32();
int n = s->ReadLE32();
fReceivers.SetCount(n);
int i;
for( i = 0; i < fReceivers.GetCount(); i++ )
@ -169,10 +169,10 @@ void plMessage::IMsgReadVersion(hsStream* s, hsResMgr* mgr)
}
if (contentFlags.IsBitSet(kMsgTimeStamp))
s->ReadSwap(&fTimeStamp); // read as double
s->ReadLE(&fTimeStamp); // read as double
if (contentFlags.IsBitSet(kMsgBCastFlags))
fBCastFlags = s->ReadSwap32();
fBCastFlags = s->ReadLE32();
}
void plMessage::IMsgWriteVersion(hsStream* s, hsResMgr* mgr)
@ -188,16 +188,16 @@ void plMessage::IMsgWriteVersion(hsStream* s, hsResMgr* mgr)
mgr->WriteKey(s,fSender);
// kMsgReceivers
s->WriteSwap32(fReceivers.GetCount());
s->WriteLE32(fReceivers.GetCount());
int i;
for( i = 0; i < fReceivers.GetCount(); i++ )
mgr->WriteKey(s,fReceivers[i]);
// kMsgTimeStamp
s->WriteSwap(fTimeStamp); // write as double
s->WriteLE(fTimeStamp); // write as double
// kMsgBCastFlags
s->WriteSwap32(fBCastFlags);
s->WriteLE32(fBCastFlags);
}
void plMessage::AddNetReceiver( UInt32 plrID )
@ -222,7 +222,7 @@ int plMsgStdStringHelper::Poke(const std::string & stringref, hsStream* stream,
plMessage::plStrLen strlen;
hsAssert( stringref.length()<0xFFFF, "buf too big for plMsgStdStringHelper" );
strlen = stringref.length();
stream->WriteSwap(strlen);
stream->WriteLE(strlen);
if (strlen)
stream->Write(strlen,stringref.data());
return stream->GetPosition();
@ -231,7 +231,7 @@ int plMsgStdStringHelper::Poke(const std::string & stringref, hsStream* stream,
int plMsgStdStringHelper::PokeBig(const std::string & stringref, hsStream* stream, const UInt32 peekOptions)
{
UInt32 strlen = stringref.length();
stream->WriteSwap(strlen);
stream->WriteLE(strlen);
if (strlen)
stream->Write(strlen,stringref.data());
return stream->GetPosition();
@ -242,7 +242,7 @@ int plMsgStdStringHelper::Poke(const char * buf, UInt32 bufsz, hsStream* stream,
plMessage::plStrLen strlen;
hsAssert( bufsz<0xFFFF, "buf too big for plMsgStdStringHelper" );
strlen = (plMessage::plStrLen)bufsz;
stream->WriteSwap(strlen);
stream->WriteLE(strlen);
if (strlen)
stream->Write(strlen,buf);
return stream->GetPosition();
@ -250,7 +250,7 @@ int plMsgStdStringHelper::Poke(const char * buf, UInt32 bufsz, hsStream* stream,
int plMsgStdStringHelper::PokeBig(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions)
{
stream->WriteSwap(bufsz);
stream->WriteLE(bufsz);
if (bufsz)
stream->Write(bufsz,buf);
return stream->GetPosition();
@ -261,7 +261,7 @@ int plMsgStdStringHelper::Peek(std::string & stringref, hsStream* stream, const
{
plMessage::plStrLen strlen;
stream->LogSubStreamStart("push this");
stream->LogReadSwap(&strlen,"StrLen");
stream->LogReadLE(&strlen,"StrLen");
stringref.erase();
if (strlen <= stream->GetSizeLeft())
{
@ -283,7 +283,7 @@ int plMsgStdStringHelper::PeekBig(std::string & stringref, hsStream* stream, co
{
UInt32 bufsz;
stream->LogSubStreamStart("push this");
stream->LogReadSwap(&bufsz,"Bufsz");
stream->LogReadLE(&bufsz,"Bufsz");
stringref.erase();
if (bufsz <= stream->GetSizeLeft())
{
@ -308,7 +308,7 @@ int plMsgXtlStringHelper::Poke(const xtl::istring & stringref, hsStream* stream,
{
plMessage::plStrLen strlen;
strlen = stringref.length();
stream->WriteSwap(strlen);
stream->WriteLE(strlen);
if (strlen)
stream->Write(strlen,stringref.data());
return stream->GetPosition();
@ -319,7 +319,7 @@ int plMsgXtlStringHelper::Peek(xtl::istring & stringref, hsStream* stream, const
{
plMessage::plStrLen strlen;
stream->LogSubStreamStart("push me");
stream->LogReadSwap(&strlen,"StrLen");
stream->LogReadLE(&strlen,"StrLen");
stringref.erase();
if (strlen <= stream->GetSizeLeft())
{
@ -341,7 +341,7 @@ int plMsgCStringHelper::Poke(const char * str, hsStream* stream, const UInt32 pe
{
plMessage::plStrLen strlen;
strlen = (str)?hsStrlen(str):0;
stream->WriteSwap(strlen);
stream->WriteLE(strlen);
if (strlen)
stream->Write(strlen,str);
return stream->GetPosition();
@ -352,7 +352,7 @@ int plMsgCStringHelper::Peek(char *& str, hsStream* stream, const UInt32 peekOpt
{
plMessage::plStrLen strlen;
stream->LogSubStreamStart("push me");
stream->LogReadSwap(&strlen,"StrLen");
stream->LogReadLE(&strlen,"StrLen");
delete [] str;
str = nil;
if (strlen <= stream->GetSizeLeft())

8
Sources/Plasma/NucleusLib/pnMessage/plMessageWithCallbacks.cpp

@ -68,7 +68,7 @@ void plMessageWithCallbacks::Read(hsStream* stream, hsResMgr* mgr)
Clear();
// read count
int n = stream->ReadSwap32();
int n = stream->ReadLE32();
fCallbacks.SetCount(n);
// read callbacks
@ -85,7 +85,7 @@ void plMessageWithCallbacks::Write(hsStream* stream, hsResMgr* mgr)
// write count
int n=fCallbacks.GetCount();
stream->WriteSwap32(n);
stream->WriteLE32(n);
// write callbacks
int i;
@ -110,7 +110,7 @@ void plMessageWithCallbacks::ReadVersion(hsStream* s, hsResMgr* mgr)
if (contentFlags.IsBitSet(kMsgWithCBsCallbacks))
{
// read count
int n = s->ReadSwap32();
int n = s->ReadLE32();
fCallbacks.SetCount(n);
for (int i = 0; i < n; i++)
@ -128,7 +128,7 @@ void plMessageWithCallbacks::WriteVersion(hsStream* s, hsResMgr* mgr)
// write count
int n = fCallbacks.GetCount();
s->WriteSwap32(n);
s->WriteLE32(n);
// write callbacks
for (int i = 0; i < n; i++)

152
Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp

@ -840,11 +840,11 @@ void plNotifyMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
// read in the static data
fType = stream->ReadSwap32();
stream->ReadSwap(&fState);
fID = stream->ReadSwap32();
fType = stream->ReadLE32();
stream->ReadLE(&fState);
fID = stream->ReadLE32();
// read in the variable part of the message
Int32 numberEDs = stream->ReadSwap32();
Int32 numberEDs = stream->ReadLE32();
fEvents.SetCountAndZero(numberEDs);
if ( numberEDs > 0 )
{
@ -869,12 +869,12 @@ void plNotifyMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
// write static data
stream->WriteSwap32(fType);
stream->WriteSwap(fState);
stream->WriteSwap32(fID);
stream->WriteLE32(fType);
stream->WriteLE(fState);
stream->WriteLE32(fID);
// then write the variable data
Int32 numberEDs = fEvents.Count();
stream->WriteSwap32(numberEDs);
stream->WriteLE32(numberEDs);
if ( numberEDs > 0 )
{
// write out each record
@ -903,18 +903,18 @@ void plNotifyMsg::ReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s);
if (contentFlags.IsBitSet(kNotifyMsgType))
fType = s->ReadSwap32();
fType = s->ReadLE32();
if (contentFlags.IsBitSet(kNotifyMsgState))
s->ReadSwap(&fState);
s->ReadLE(&fState);
if (contentFlags.IsBitSet(kNotifyMsgID))
fID = s->ReadSwap32();
fID = s->ReadLE32();
if (contentFlags.IsBitSet(kNotifyMsgEDs))
{
// read in the variable part of the message
Int32 numberEDs = s->ReadSwap32();
Int32 numberEDs = s->ReadLE32();
fEvents.SetCountAndZero(numberEDs);
if (numberEDs > 0)
{
@ -946,17 +946,17 @@ void plNotifyMsg::WriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
// kNotifyMsgType
s->WriteSwap32(fType);
s->WriteLE32(fType);
// kNotifyMsgState
s->WriteSwap(fState);
s->WriteLE(fState);
// kNotifyMsgID
s->WriteSwap32(fID);
s->WriteLE32(fID);
// kNotifyMsgEDs
Int32 numberEDs = fEvents.Count();
s->WriteSwap32(numberEDs);
s->WriteLE32(numberEDs);
if (numberEDs > 0)
{
// write out each record
@ -1028,7 +1028,7 @@ proEventData* proEventData::ICreateEventDataType(Int32 type)
proEventData* proEventData::Read( hsStream *stream, hsResMgr *mgr )
{
Int32 evtType = stream->ReadSwap32();
Int32 evtType = stream->ReadLE32();
proEventData* data = ICreateEventDataType(evtType);
@ -1040,7 +1040,7 @@ proEventData* proEventData::Read( hsStream *stream, hsResMgr *mgr )
void proEventData::Write(hsStream *stream, hsResMgr *mgr)
{
stream->WriteSwap32(fEventType);
stream->WriteLE32(fEventType);
IWrite(stream, mgr);
}
@ -1056,7 +1056,7 @@ proEventData* proEventData::ReadVersion(hsStream* s, hsResMgr* mgr)
if (contentFlags.IsBitSet(kProEventDataType))
{
Int32 evtType = s->ReadSwap32();
Int32 evtType = s->ReadLE32();
proEventData* data = ICreateEventDataType(evtType);
@ -1076,7 +1076,7 @@ void proEventData::WriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
// kProEventDataType
s->WriteSwap32(fEventType);
s->WriteLE32(fEventType);
IWriteVersion(s, mgr);
}
@ -1233,12 +1233,12 @@ void proSpawnedEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
void proControlKeyEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
fControlKey = stream->ReadSwap32();
fControlKey = stream->ReadLE32();
fDown = stream->ReadBool();
}
void proControlKeyEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
stream->WriteSwap32(fControlKey);
stream->WriteLE32(fControlKey);
stream->WriteBool(fDown);
}
@ -1254,7 +1254,7 @@ void proControlKeyEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s);
if (contentFlags.IsBitSet(kProControlKey))
fControlKey = s->ReadSwap32();
fControlKey = s->ReadLE32();
if (contentFlags.IsBitSet(kProControlDown))
fDown = s->ReadBool();
}
@ -1266,7 +1266,7 @@ void proControlKeyEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
// kProControlKey
s->WriteSwap32(fControlKey);
s->WriteLE32(fControlKey);
// kProControlDown
s->WriteBool(fDown);
}
@ -1286,16 +1286,16 @@ void proVariableEventData::IDestruct()
void proVariableEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
fName = stream->ReadSafeString();
fDataType = stream->ReadSwap32();
fNumber = stream->ReadSwapScalar();
fDataType = stream->ReadLE32();
fNumber = stream->ReadLEScalar();
fKey = mgr->ReadKey(stream);
}
void proVariableEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
stream->WriteSafeString(fName);
stream->WriteSwap32(fDataType);
stream->WriteSwapScalar(fNumber);
stream->WriteLE32(fDataType);
stream->WriteLEScalar(fNumber);
mgr->WriteKey(stream, fKey);
}
@ -1315,9 +1315,9 @@ void proVariableEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
if (contentFlags.IsBitSet(kProVariableName))
fName = s->ReadSafeString();
if (contentFlags.IsBitSet(kProVariableDataType))
fDataType = s->ReadSwap32();
fDataType = s->ReadLE32();
if (contentFlags.IsBitSet(kProVariableNumber))
fNumber = s->ReadSwapScalar();
fNumber = s->ReadLEScalar();
if (contentFlags.IsBitSet(kProVariableKey))
fKey = mgr->ReadKey(s);
}
@ -1334,9 +1334,9 @@ void proVariableEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
// kProVariableName
s->WriteSafeString(fName);
// kProVariableDataType
s->WriteSwap32(fDataType);
s->WriteLE32(fDataType);
// kProVariableNumber
s->WriteSwapScalar(fNumber);
s->WriteLEScalar(fNumber);
// kProVariableKey
mgr->WriteKey(s, fKey);
}
@ -1345,7 +1345,7 @@ void proFacingEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
fFacer = mgr->ReadKey(stream);
fFacee = mgr->ReadKey(stream);
dot = stream->ReadSwapScalar();
dot = stream->ReadLEScalar();
enabled = stream->ReadBool();
}
@ -1353,7 +1353,7 @@ void proFacingEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
mgr->WriteKey(stream, fFacer);
mgr->WriteKey(stream, fFacee);
stream->WriteSwapScalar(dot);
stream->WriteLEScalar(dot);
stream->WriteBool(enabled);
}
@ -1375,7 +1375,7 @@ void proFacingEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
if (contentFlags.IsBitSet(kProFacingFacee))
fFacee = mgr->ReadKey(s);
if (contentFlags.IsBitSet(kProFacingDot))
dot = s->ReadSwapScalar();
dot = s->ReadLEScalar();
if (contentFlags.IsBitSet(kProFacingEnabled))
enabled = s->ReadBool();
}
@ -1394,7 +1394,7 @@ void proFacingEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
// kProFacingFacee
mgr->WriteKey(s, fFacee);
// kProFacingDot
s->WriteSwapScalar(dot);
s->WriteLEScalar(dot);
// kProFacingEnabled
s->WriteBool(enabled);
}
@ -1493,12 +1493,12 @@ void proActivateEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
void proCallbackEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
fEventType = stream->ReadSwap32();
fEventType = stream->ReadLE32();
}
void proCallbackEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
stream->WriteSwap32(fEventType);
stream->WriteLE32(fEventType);
}
enum ProCallbackFlags
@ -1512,7 +1512,7 @@ void proCallbackEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s);
if (contentFlags.IsBitSet(kProCallbackEventType))
fEventType = s->ReadSwap32();
fEventType = s->ReadLE32();
}
void proCallbackEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
@ -1522,17 +1522,17 @@ void proCallbackEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
// kProCallbackEventType
s->WriteSwap32(fEventType);
s->WriteLE32(fEventType);
}
void proResponderStateEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
fState = stream->ReadSwap32();
fState = stream->ReadLE32();
}
void proResponderStateEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
stream->WriteSwap32(fState);
stream->WriteLE32(fState);
}
enum ProResponderFlags
@ -1546,7 +1546,7 @@ void proResponderStateEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s);
if (contentFlags.IsBitSet(kProResponderState))
fState = s->ReadSwap32();
fState = s->ReadLE32();
}
void proResponderStateEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
@ -1556,20 +1556,20 @@ void proResponderStateEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
// kProResponderState
s->WriteSwap32(fState);
s->WriteLE32(fState);
}
void proMultiStageEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
fStage = stream->ReadSwap32();
fEvent = stream->ReadSwap32();
fStage = stream->ReadLE32();
fEvent = stream->ReadLE32();
fAvatar = mgr->ReadKey(stream);
}
void proMultiStageEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
stream->WriteSwap32(fStage);
stream->WriteSwap32(fEvent);
stream->WriteLE32(fStage);
stream->WriteLE32(fEvent);
mgr->WriteKey(stream, fAvatar);
}
@ -1586,9 +1586,9 @@ void proMultiStageEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s);
if (contentFlags.IsBitSet(kProMultiStageStage))
fStage = s->ReadSwap32();
fStage = s->ReadLE32();
if (contentFlags.IsBitSet(kProMultiStageEvent))
fEvent = s->ReadSwap32();
fEvent = s->ReadLE32();
if (contentFlags.IsBitSet(kProMultiStageAvatar))
fAvatar = mgr->ReadKey(s);
}
@ -1602,23 +1602,23 @@ void proMultiStageEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
// kProMultiStageStage
s->WriteSwap32(fStage);
s->WriteLE32(fStage);
// kProMultiStageEvent
s->WriteSwap32(fEvent);
s->WriteLE32(fEvent);
// kProMultiStageAvatar
mgr->WriteKey(s, fAvatar);
}
void proCoopEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
fID = stream->ReadSwap32();
fSerial = stream->ReadSwap16();
fID = stream->ReadLE32();
fSerial = stream->ReadLE16();
}
void proCoopEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
stream->WriteSwap32(fID);
stream->WriteSwap16(fSerial);
stream->WriteLE32(fID);
stream->WriteLE16(fSerial);
}
enum ProCoopFlags
@ -1633,9 +1633,9 @@ void proCoopEventData::IReadVersion(hsStream* stream, hsResMgr* mgr)
contentFlags.Read(stream);
if(contentFlags.IsBitSet(kProCoopID))
fID = stream->ReadSwap32();
fID = stream->ReadLE32();
if(contentFlags.IsBitSet(kProCoopSerial))
fSerial = stream->ReadSwap16();
fSerial = stream->ReadLE16();
}
void proCoopEventData::IWriteVersion(hsStream* stream, hsResMgr* mgr)
@ -1645,23 +1645,23 @@ void proCoopEventData::IWriteVersion(hsStream* stream, hsResMgr* mgr)
contentFlags.SetBit(kProCoopSerial);
contentFlags.Write(stream);
stream->WriteSwap32(fID);
stream->WriteSwap16(fSerial);
stream->WriteLE32(fID);
stream->WriteLE16(fSerial);
}
void proOfferLinkingBookEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
mgr->WriteKey(stream, offerer);
stream->WriteSwap32(targetAge);
stream->WriteSwap32(offeree);
stream->WriteLE32(targetAge);
stream->WriteLE32(offeree);
}
void proOfferLinkingBookEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
offerer = mgr->ReadKey(stream);
targetAge = stream->ReadSwap32();
offeree = stream->ReadSwap32();
targetAge = stream->ReadLE32();
offeree = stream->ReadLE32();
}
enum ProOfferFlags
@ -1680,8 +1680,8 @@ void proOfferLinkingBookEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
mgr->WriteKey(s, offerer);
s->WriteSwap32(targetAge);
s->WriteSwap32(offeree);
s->WriteLE32(targetAge);
s->WriteLE32(offeree);
}
void proOfferLinkingBookEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
@ -1692,21 +1692,21 @@ void proOfferLinkingBookEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
if(contentFlags.IsBitSet(kProOfferOfferer))
offerer = mgr->ReadKey(s);
if(contentFlags.IsBitSet(kProOfferTargetAge))
targetAge = s->ReadSwap32();
targetAge = s->ReadLE32();
if(contentFlags.IsBitSet(kProOfferOfferee))
offeree = s->ReadSwap32();
offeree = s->ReadLE32();
}
void proBookEventData::IWrite(hsStream* stream, hsResMgr* mgr)
{
stream->WriteSwap32(fEvent);
stream->WriteSwap32(fLinkID);
stream->WriteLE32(fEvent);
stream->WriteLE32(fLinkID);
}
void proBookEventData::IRead(hsStream* stream, hsResMgr* mgr)
{
fEvent = stream->ReadSwap32();
fLinkID = stream->ReadSwap32();
fEvent = stream->ReadLE32();
fLinkID = stream->ReadLE32();
}
enum ProBookFlags
@ -1722,8 +1722,8 @@ void proBookEventData::IWriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.SetBit(kProBookLinkID);
contentFlags.Write(s);
s->WriteSwap32( fEvent );
s->WriteSwap32( fLinkID );
s->WriteLE32( fEvent );
s->WriteLE32( fLinkID );
}
void proBookEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
@ -1732,9 +1732,9 @@ void proBookEventData::IReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s);
if(contentFlags.IsBitSet(kProBookEvent))
fEvent = s->ReadSwap32();
fEvent = s->ReadLE32();
if(contentFlags.IsBitSet(kProBookLinkID))
fLinkID = s->ReadSwap32();
fLinkID = s->ReadLE32();
}

8
Sources/Plasma/NucleusLib/pnMessage/plObjRefMsg.h

@ -74,15 +74,15 @@ public:
void Read(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType);
stream->ReadSwap(&fWhich);
stream->ReadLE(&fType);
stream->ReadLE(&fWhich);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType);
stream->WriteSwap(fWhich);
stream->WriteLE(fType);
stream->WriteLE(fWhich);
}
};

4
Sources/Plasma/NucleusLib/pnMessage/plPlayerPageMsg.h

@ -77,7 +77,7 @@ public:
fLocallyOriginated = stream->ReadBool();
fLastOut = stream->ReadBool();
fUnload = stream->ReadBool();
fClientID = stream->ReadSwap32();
fClientID = stream->ReadLE32();
}
void Write(hsStream* stream, hsResMgr* mgr)
{
@ -86,7 +86,7 @@ public:
stream->WriteBool(fLocallyOriginated);
stream->WriteBool(fLastOut);
stream->WriteBool(fUnload);
stream->WriteSwap32(fClientID);
stream->WriteLE32(fClientID);
}
};

4
Sources/Plasma/NucleusLib/pnMessage/plProxyDrawMsg.cpp

@ -71,11 +71,11 @@ plProxyDrawMsg::~plProxyDrawMsg()
void plProxyDrawMsg::Read(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgRead(s, mgr);
fProxyFlags = s->ReadSwap16();
fProxyFlags = s->ReadLE16();
}
void plProxyDrawMsg::Write(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgWrite(s, mgr);
s->WriteSwap16(fProxyFlags);
s->WriteLE16(fProxyFlags);
}

12
Sources/Plasma/NucleusLib/pnMessage/plRefMsg.cpp

@ -81,7 +81,7 @@ plRefMsg& plRefMsg::SetOldRef(hsKeyedObject* oldRef)
void plRefMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fContext);
stream->ReadLE(&fContext);
plKey key;
key = mgr->ReadKey(stream);
@ -93,7 +93,7 @@ void plRefMsg::Read(hsStream* stream, hsResMgr* mgr)
void plRefMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fContext);
stream->WriteLE(fContext);
mgr->WriteKey(stream, (fRef ? fRef->GetKey() : nil));
mgr->WriteKey(stream, (fOldRef ? fOldRef->GetKey() : nil));
@ -103,13 +103,13 @@ void plRefMsg::Write(hsStream* stream, hsResMgr* mgr)
void plGenRefMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType);
fWhich = stream->ReadSwap32();
stream->ReadLE(&fType);
fWhich = stream->ReadLE32();
}
void plGenRefMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType);
stream->WriteSwap32(fWhich);
stream->WriteLE(fType);
stream->WriteLE32(fWhich);
}

8
Sources/Plasma/NucleusLib/pnMessage/plServerReplyMsg.cpp

@ -46,13 +46,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
void plServerReplyMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fType);
stream->ReadLE(&fType);
}
void plServerReplyMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fType);
stream->WriteLE(fType);
}
enum ServerReplyFlags
@ -68,7 +68,7 @@ void plServerReplyMsg::ReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s);
if (contentFlags.IsBitSet(kServerReplyType))
s->ReadSwap(&fType);
s->ReadLE(&fType);
}
void plServerReplyMsg::WriteVersion(hsStream* s, hsResMgr* mgr)
@ -80,5 +80,5 @@ void plServerReplyMsg::WriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s);
// kServerReplyType
s->WriteSwap(fType);
s->WriteLE(fType);
}

32
Sources/Plasma/NucleusLib/pnMessage/plSoundMsg.cpp

@ -62,16 +62,16 @@ void plSoundMsg::Read(hsStream* stream, hsResMgr* mgr)
plMessageWithCallbacks::Read(stream, mgr);
fCmd.Read(stream);
stream->ReadSwap(&fBegin);
stream->ReadSwap(&fEnd);
stream->ReadLE(&fBegin);
stream->ReadLE(&fEnd);
fLoop = stream->ReadBool();
fPlaying = stream->ReadBool();
stream->ReadSwap(&fSpeed);
stream->ReadSwap(&fTime);
stream->ReadSwap(&fIndex);
stream->ReadSwap(&fRepeats);
stream->ReadSwap(&fNameStr);
stream->ReadSwap(&fVolume);
stream->ReadLE(&fSpeed);
stream->ReadLE(&fTime);
stream->ReadLE(&fIndex);
stream->ReadLE(&fRepeats);
stream->ReadLE(&fNameStr);
stream->ReadLE(&fVolume);
fFadeType = (plSoundMsg::FadeType)stream->ReadByte();
}
@ -80,15 +80,15 @@ void plSoundMsg::Write(hsStream* stream, hsResMgr* mgr)
plMessageWithCallbacks::Write(stream, mgr);
fCmd.Write(stream);
stream->WriteSwap(fBegin);
stream->WriteSwap(fEnd);
stream->WriteLE(fBegin);
stream->WriteLE(fEnd);
stream->WriteBool(fLoop);
stream->WriteBool(fPlaying);
stream->WriteSwap(fSpeed);
stream->WriteSwap(fTime);
stream->WriteSwap(fIndex);
stream->WriteSwap(fRepeats);
stream->WriteSwap(fNameStr);
stream->WriteSwap(fVolume);
stream->WriteLE(fSpeed);
stream->WriteLE(fTime);
stream->WriteLE(fIndex);
stream->WriteLE(fRepeats);
stream->WriteLE(fNameStr);
stream->WriteLE(fVolume);
stream->WriteByte( (UInt8)fFadeType );
}

8
Sources/Plasma/NucleusLib/pnMessage/plTimeMsg.h

@ -72,15 +72,15 @@ public:
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fSeconds);
stream->ReadSwap(&fDelSecs);
stream->ReadLE(&fSeconds);
stream->ReadLE(&fDelSecs);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fSeconds);
stream->WriteSwap(fDelSecs);
stream->WriteLE(fSeconds);
stream->WriteLE(fDelSecs);
}
};

4
Sources/Plasma/NucleusLib/pnMessage/plWarpMsg.h

@ -86,14 +86,14 @@ public:
{
plMessage::IMsgRead(stream, mgr);
fTransform.Read(stream);
stream->ReadSwap(&fWarpFlags);
stream->ReadLE(&fWarpFlags);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fTransform.Write(stream);
stream->WriteSwap(fWarpFlags);
stream->WriteLE(fWarpFlags);
}
};

4
Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp

@ -318,7 +318,7 @@ void plLogicModBase::AddNotifyReceiver(plKey receiver)
void plLogicModBase::Read(hsStream* stream, hsResMgr* mgr)
{
plSingleModifier::Read(stream, mgr);
int n = stream->ReadSwap32();
int n = stream->ReadLE32();
fCommandList.SetCountAndZero(n);
for(int i = 0; i < n; i++ )
{
@ -339,7 +339,7 @@ void plLogicModBase::Read(hsStream* stream, hsResMgr* mgr)
void plLogicModBase::Write(hsStream* stream, hsResMgr* mgr)
{
plSingleModifier::Write(stream, mgr);
stream->WriteSwap32(fCommandList.GetCount());
stream->WriteLE32(fCommandList.GetCount());
for(int i = 0; i < fCommandList.GetCount(); i++ )
mgr->WriteCreatable( stream, fCommandList[i] );
mgr->WriteCreatable( stream, fNotify );

67
Sources/Plasma/NucleusLib/pnNetCli/pnNcCli.cpp

@ -266,13 +266,6 @@ static void BufferedSendData (
#define ASSERT_MSG_VALID(expr) \
ASSERTMSG(expr, "Invalid message definition");
#define WRITE_SWAPPED_INT(t,c) { \
ASSERT(sizeof(t) == sizeof(c)); \
t endianCount = Endian((t)c); \
AddToSendBuffer(cli, sizeof(t), (const void *) &endianCount); \
}
ASSERT(cli);
ASSERT(msg);
ASSERT(fieldCount);
@ -287,8 +280,8 @@ static void BufferedSendData (
ASSERT(fieldCount-1 == sendMsg->msg.count);
// insert messageId into command stream
const word msgId = (word) msg[0];
WRITE_SWAPPED_INT(word, msgId);
const word msgId = hsToLE16((word)msg[0]);
AddToSendBuffer(cli, sizeof(word), (const void*)&msgId);
++msg;
ASSERT_MSG_VALID(msg < msgEnd);
@ -305,11 +298,33 @@ static void BufferedSendData (
void * temp = ALLOCA(byte, bytes);
if (count == 1)
{
// Single values are passed by value
EndianCopy(temp, (const byte *) msg, count, cmd->size);
if (cmd->size == sizeof(byte)) {
*(byte*)temp = *(byte*)msg;
} else if (cmd->size == sizeof(word)) {
*(word*)temp = hsToLE16(*(word*)msg);
} else if (cmd->size == sizeof(dword)) {
*(dword*)temp = hsToLE32(*(dword*)msg);
} else if (cmd->size == sizeof(qword)) {
*(qword*)temp = hsToLE64(*(qword*)msg);
}
}
else
{
// Value arrays are passed in by ptr
EndianCopy(temp, (const byte *) *msg, count, cmd->size);
for (int i = 0; i < count; i++) {
if (cmd->size == sizeof(byte)) {
((byte*)temp)[i] = ((byte*)*msg)[i];
} else if (cmd->size == sizeof(word)) {
((word*)temp)[i] = hsToLE16(((word*)*msg)[i]);
} else if (cmd->size == sizeof(dword)) {
((dword*)temp)[i] = hsToLE32(((dword*)*msg)[i]);
} else if (cmd->size == sizeof(qword)) {
((qword*)temp)[i] = hsToLE64(((qword*)*msg)[i]);
}
}
}
// Write values to send buffer
AddToSendBuffer(cli, bytes, temp);
@ -335,7 +350,8 @@ static void BufferedSendData (
const word length = (word) StrLen((const wchar *) *msg);
ASSERT_MSG_VALID(length < cmd->count);
// Write actual string length
WRITE_SWAPPED_INT(word, length);
word size = hsToLE16(length);
AddToSendBuffer(cli, sizeof(word), (const void*)&size);
// Write string data
AddToSendBuffer(cli, length * sizeof(wchar), (const void *) *msg);
}
@ -354,8 +370,8 @@ static void BufferedSendData (
// remember the element size
varSize = cmd->size;
// write the actual element count
varCount = (dword) *msg;
WRITE_SWAPPED_INT(dword, varCount);
varCount = hsToLE32((dword)*msg);
AddToSendBuffer(cli, sizeof(dword), (const void*)&varCount);
}
break;
@ -396,7 +412,7 @@ static bool DispatchData (NetCli * cli, void * param) {
if (!cli->input.Get(sizeof(msgId), &msgId))
goto NEED_MORE_DATA;
msgId = Endian(msgId);
msgId = hsToLE16(msgId);
if (nil == (cli->recvMsg = NetMsgChannelFindRecvMessage(cli->channel, msgId)))
goto ERR_NO_HANDLER;
@ -434,11 +450,16 @@ static bool DispatchData (NetCli * cli, void * param) {
}
// Byte-swap integers
EndianConvert(
data,
count,
cli->recvField->size
);
// This is so screwed up >.<
for (int i = 0; i < count; i++) {
if (cli->recvField->size == sizeof(word)) {
((word*)data)[i] = hsToLE16(((word*)data)[i]);
} else if (cli->recvField->size == sizeof(dword)) {
((dword*)data)[i] = hsToLE32(((dword*)data)[i]);
} else if (cli->recvField->size == sizeof(qword)) {
((qword*)data)[i] = hsToLE64(((qword*)data)[i]);
}
}
// Field complete
}
@ -486,10 +507,10 @@ static bool DispatchData (NetCli * cli, void * param) {
}
// Byte-swap value
EndianConvert((dword *) data, 1);
dword val = hsToLE32(*(dword*)data);
// Prepare to read var-length field
cli->recvFieldBytes = *(dword *)data * cli->recvField->size;
cli->recvFieldBytes = val * cli->recvField->size;
// Field complete
}
@ -516,7 +537,7 @@ static bool DispatchData (NetCli * cli, void * param) {
word length;
if (!cli->input.Get(sizeof(word), &length))
goto NEED_MORE_DATA;
cli->recvFieldBytes = Endian(length) * sizeof(wchar);
cli->recvFieldBytes = hsToLE16(length) * sizeof(wchar);
// Validate size. Use >= instead of > to leave room for the NULL terminator.
if (cli->recvFieldBytes >= cli->recvField->count * cli->recvField->size)

28
Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp

@ -174,7 +174,7 @@ const char & plGenericType::IToChar( void ) const
void plGenericType::Read(hsStream* s)
{
IDeallocString();
s->ReadSwap(&fType);
s->ReadLE(&fType);
switch ( fType )
{
@ -184,23 +184,23 @@ void plGenericType::Read(hsStream* s)
break;
case kBool:
{Int8 b;
s->ReadSwap( &b );
s->ReadLE( &b );
fB = b?true:false;}
break;
case kChar:
s->ReadSwap( &fC );
s->ReadLE( &fC );
break;
case kInt :
s->ReadSwap( &fI );
s->ReadLE( &fI );
break;
case kUInt:
s->ReadSwap( &fU );
s->ReadLE( &fU );
break;
case kFloat:
s->ReadSwap( &fF );
s->ReadLE( &fF );
break;
case kDouble:
s->ReadSwap( &fD );
s->ReadLE( &fD );
break;
case kNone :
break;
@ -209,7 +209,7 @@ void plGenericType::Read(hsStream* s)
void plGenericType::Write(hsStream* s)
{
s->WriteSwap(fType);
s->WriteLE(fType);
switch ( fType )
{
@ -219,22 +219,22 @@ void plGenericType::Write(hsStream* s)
break;
case kBool:
{Int8 b = fB?1:0;
s->WriteSwap( b );}
s->WriteLE( b );}
break;
case kChar:
s->WriteSwap( fC );
s->WriteLE( fC );
break;
case kInt :
s->WriteSwap( fI );
s->WriteLE( fI );
break;
case kUInt:
s->WriteSwap( fU );
s->WriteLE( fU );
break;
case kFloat:
s->WriteSwap( fF );
s->WriteLE( fF );
break;
case kDouble:
s->WriteSwap( fD );
s->WriteLE( fD );
break;
case kNone :
break;

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

@ -149,16 +149,16 @@ std::string plNetAddress::AsString() const
void plNetAddress::Read(hsStream * s)
{
s->ReadSwap((UInt32*)&fAddr.sin_addr.s_addr);
s->ReadSwap(&fAddr.sin_port);
s->ReadSwap(&fAddr.sin_family);
s->ReadLE((UInt32*)&fAddr.sin_addr.s_addr);
s->ReadLE(&fAddr.sin_port);
s->ReadLE(&fAddr.sin_family);
}
void plNetAddress::Write(hsStream * s)
{
s->WriteSwap((UInt32)fAddr.sin_addr.s_addr);
s->WriteSwap(fAddr.sin_port);
s->WriteSwap(fAddr.sin_family);
s->WriteLE((UInt32)fAddr.sin_addr.s_addr);
s->WriteLE(fAddr.sin_port);
s->WriteLE(fAddr.sin_family);
}

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

@ -76,8 +76,8 @@ public:
bool operator<(const plNetGroupId& netGroup) const { return fId < netGroup.fId; }
// read and write to hsStream
void Write(hsStream *s) const { fId.Write(s); s->WriteSwap(fFlags); }
void Read(hsStream *s) { fId.Read(s); s->LogReadSwap(&fFlags,"GroupId Flags"); }
void Write(hsStream *s) const { fId.Write(s); s->WriteLE(fFlags); }
void Read(hsStream *s) { fId.Read(s); s->LogReadLE(&fFlags,"GroupId Flags"); }
};
namespace plNetGroup

2
Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp

@ -78,7 +78,7 @@ plNetResManager::~plNetResManager()
plCreatable* plNetResManager::IReadCreatable(hsStream* s) const
{
UInt16 hClass = s->ReadSwap16();
UInt16 hClass = s->ReadLE16();
if (plFactory::CanCreate(hClass))
{
plCreatable *pCre = plFactory::Create(hClass);

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

@ -86,7 +86,7 @@ void plNetSharedState::Read(hsStream* stream)
Reset();
plMsgStdStringHelper::Peek(fName, stream);
Int32 num=stream->ReadSwap32();
Int32 num=stream->ReadLE32();
fServerMayDelete = stream->Readbool();
fVars.reserve(num);
@ -103,7 +103,7 @@ void plNetSharedState::Write(hsStream* stream)
{
plMsgStdStringHelper::Poke(fName, stream);
Int32 num=GetNumVars();
stream->WriteSwap32(num);
stream->WriteLE32(num);
stream->Writebool(fServerMayDelete);
int i;

12
Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp

@ -333,11 +333,11 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
hsKeyedObject::Read(stream, mgr);
fNetGroup = GetKey()->GetUoid().GetLocation();
stream->ReadSwap(&fSynchFlags);
stream->ReadLE(&fSynchFlags);
if (fSynchFlags & kExcludePersistentState)
{
Int16 num;
stream->ReadSwap(&num);
stream->ReadLE(&num);
fSDLExcludeList.clear();
int i;
for(i=0;i<num;i++)
@ -351,7 +351,7 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
if (fSynchFlags & kHasVolatileState)
{
Int16 num;
stream->ReadSwap(&num);
stream->ReadLE(&num);
fSDLVolatileList.clear();
int i;
for(i=0;i<num;i++)
@ -366,12 +366,12 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
void plSynchedObject::Write(hsStream* stream, hsResMgr* mgr)
{
hsKeyedObject::Write(stream, mgr);
stream->WriteSwap(fSynchFlags);
stream->WriteLE(fSynchFlags);
if (fSynchFlags & kExcludePersistentState)
{
Int16 num=fSDLExcludeList.size();
stream->WriteSwap(num);
stream->WriteLE(num);
SDLStateList::iterator it=fSDLExcludeList.begin();
for(; it != fSDLExcludeList.end(); it++)
@ -383,7 +383,7 @@ void plSynchedObject::Write(hsStream* stream, hsResMgr* mgr)
if (fSynchFlags & kHasVolatileState)
{
Int16 num=fSDLVolatileList.size();
stream->WriteSwap(num);
stream->WriteLE(num);
SDLStateList::iterator it=fSDLVolatileList.begin();
for(; it != fSDLVolatileList.end(); it++)

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

@ -52,9 +52,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define ISaveOrLoadSimpleType() \
{ \
if (save) \
stream->WriteSwap(v); \
stream->WriteLE(v); \
else \
stream->ReadSwap(&v); \
stream->ReadLE(&v); \
return v; \
}
@ -101,7 +101,7 @@ const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, hsBool32 save, hsSt
// I need to write a key to MY stream...
#if 0 // DEBUG
Int32 len = hsStrlen(key->GetName());
stream->WriteSwap32(len);
stream->WriteLE32(len);
stream->Write(len, key->GetName());
#endif
key->GetUoid().Write(stream);
@ -119,7 +119,7 @@ const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, hsBool32 save, hsSt
{
// read a key from MY stream
#if 0 // DEBUG
Int32 len = stream->ReadSwap32();
Int32 len = stream->ReadLE32();
char tmp[256];
hsAssert(len<256, "key name overflow");
stream->Read(len, tmp);

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

@ -339,7 +339,7 @@ void plSynchedTArray<T>::ISaveOrLoad(hsBool32 save, hsStream* stream, hsResMgr*
{
// write out size of array
Int32 i, num = fValueList.GetCount();
stream->WriteSwap(num);
stream->WriteLE(num);
for(i=0;i<num;i++)
{
plSynchedValueBase::ISaveOrLoad(fValueList[i], save, stream, mgr);
@ -351,7 +351,7 @@ void plSynchedTArray<T>::ISaveOrLoad(hsBool32 save, hsStream* stream, hsResMgr*
fValueList.Reset();
// read in size of array
Int32 i, num;
stream->ReadSwap(&num);
stream->ReadLE(&num);
for(i=0;i<num;i++)
{

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

@ -101,7 +101,7 @@ void plCreatableStream::Write( hsStream* stream, hsResMgr* mgr )
fStream.Rewind();
std::string buf;
UInt32 len = fStream.GetEOF();
stream->WriteSwap( len );
stream->WriteLE( len );
buf.resize( len );
fStream.Read( len, (void*)buf.data() );
stream->Write( len, (const void*)buf.data() );
@ -113,7 +113,7 @@ void plCreatableStream::Read( hsStream* stream, hsResMgr* mgr )
fStream.Rewind();
std::string buf;
UInt32 len;
stream->LogReadSwap( &len,"CreatableStream Len");
stream->LogReadLE( &len,"CreatableStream Len");
buf.resize( len );
stream->LogRead( len, (void*)buf.data(),"CreatableStream Data");
fStream.Write( len, (const void*)buf.data() );

4
Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp

@ -557,7 +557,7 @@ void plCoordinateInterface::Read(hsStream* stream, hsResMgr* mgr)
fLocalToWorld.Read(stream);
fWorldToLocal.Read(stream);
int n = stream->ReadSwap32();
int n = stream->ReadLE32();
int i;
for( i = 0; i < n; i++ )
{
@ -576,7 +576,7 @@ void plCoordinateInterface::Write(hsStream* stream, hsResMgr* mgr)
fLocalToWorld.Write(stream);
fWorldToLocal.Write(stream);
stream->WriteSwap32(fChildren.GetCount());
stream->WriteLE32(fChildren.GetCount());
int i;
for( i = 0; i < fChildren.GetCount(); i++ )
mgr->WriteKey(stream, fChildren[i]);

12
Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.cpp

@ -146,19 +146,19 @@ void plDrawInterface::Read(hsStream* s, hsResMgr* mgr)
{
plObjInterface::Read(s, mgr);
int nDrawables = s->ReadSwap32();
int nDrawables = s->ReadLE32();
if (nDrawables > 0)
ICheckDrawableIndex(nDrawables-1);
int i;
for( i = 0; i < fDrawables.GetCount(); i++ )
{
fDrawableIndices[i] = s->ReadSwap32();
fDrawableIndices[i] = s->ReadLE32();
plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, i, plIntRefMsg::kDrawable);
mgr->ReadKeyNotifyMe(s,refMsg, plRefFlags::kActiveRef);
}
int nReg = s->ReadSwap32();
int nReg = s->ReadLE32();
fRegions.SetCountAndZero(nReg);
for( i = 0; i < nReg; i++ )
{
@ -171,16 +171,16 @@ void plDrawInterface::Write(hsStream* s, hsResMgr* mgr)
{
plObjInterface::Write(s, mgr);
s->WriteSwap32(fDrawables.GetCount());
s->WriteLE32(fDrawables.GetCount());
int i;
for( i = 0; i < fDrawables.GetCount(); i++ )
{
s->WriteSwap32(fDrawableIndices[i]);
s->WriteLE32(fDrawableIndices[i]);
mgr->WriteKey(s, fDrawables[i]);
}
s->WriteSwap32(fRegions.GetCount());
s->WriteLE32(fRegions.GetCount());
for( i = 0; i < fRegions.GetCount(); i++ )
{
mgr->WriteKey(s, fRegions[i]);

8
Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp

@ -124,7 +124,7 @@ void plSceneObject::Read(hsStream* stream, hsResMgr* mgr)
int i;
int nGen = stream->ReadSwap32();
int nGen = stream->ReadLE32();
fGenerics.SetCount(0);
for( i = 0; i < nGen; i++ )
{
@ -134,7 +134,7 @@ void plSceneObject::Read(hsStream* stream, hsResMgr* mgr)
plObjRefMsg* refMsg;
int nOldMods=fModifiers.GetCount(); // existng modifiers created during interface loading
int nNewMods = stream->ReadSwap32();
int nNewMods = stream->ReadLE32();
fModifiers.ExpandAndZero(nOldMods+nNewMods); // reserve space for new modifiers+existing modifiers
for( i = nOldMods; i < nOldMods+nNewMods; i++ )
{
@ -159,7 +159,7 @@ void plSceneObject::Write(hsStream* stream, hsResMgr* mgr)
int i;
stream->WriteSwap32(fGenerics.GetCount());
stream->WriteLE32(fGenerics.GetCount());
for( i = 0; i < fGenerics.GetCount(); i++ )
mgr->WriteKey(stream, fGenerics[i]);
@ -167,7 +167,7 @@ void plSceneObject::Write(hsStream* stream, hsResMgr* mgr)
if (fModifiers[i]->GetKey() == nil)
RemoveModifier(fModifiers[i]);
stream->WriteSwap32(fModifiers.GetCount());
stream->WriteLE32(fModifiers.GetCount());
for( i = 0; i < fModifiers.GetCount(); i++ )
mgr->WriteKey(stream,fModifiers[i]);

4
Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.cpp

@ -97,7 +97,7 @@ void plSimulationInterface::Read(hsStream* s, hsResMgr* mgr)
// avoid breaking the format
fProps.Read(s);
// Also unnecessary
int poop = s->ReadSwap32();
int poop = s->ReadLE32();
plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kPhysical, 0);
mgr->ReadKeyNotifyMe(s, refMsg, plRefFlags::kActiveRef);
@ -109,7 +109,7 @@ void plSimulationInterface::Write(hsStream* s, hsResMgr* mgr)
// Legacy crap
fProps.Write(s);
s->WriteSwap32(0);
s->WriteLE32(0);
mgr->WriteKey(s, fPhysical);
}

6
Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h

@ -76,7 +76,7 @@ public:
};
// Read/Writable version of plTimedValue, for intrinsic types (e.g. int, float, bool).
// Must be a type that hsStream has an overloaded ReadSwap/WriteSwap defined.
// Must be a type that hsStream has an overloaded ReadLE/WriteLE defined.
template <class T> class plTimedSimple : public plTimedValue<T>
{
public:
@ -141,7 +141,7 @@ template <class T>
void plTimedSimple<T>::Read(hsStream* s)
{
T val;
s->ReadSwap(&val);
s->ReadLE(&val);
Set(val, 0.f);
}
@ -149,7 +149,7 @@ template <class T>
void plTimedSimple<T>::Write(hsStream* s) const
{
T val = this->Value();
s->WriteSwap(val);
s->WriteLE(val);
}
template <class T>

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

@ -22,8 +22,6 @@ set(pnUtils_PRIVATE
Private/pnUtCoreLib.h
Private/pnUtCrypt.h
Private/pnUtCrypt.cpp
Private/pnUtEndian.h
Private/pnUtEndian.cpp
Private/pnUtHash.h
Private/pnUtHash.cpp
Private/pnUtList.h

1
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtAllIncludes.h

@ -69,7 +69,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnUtCmd.h"
#include "pnUtMisc.h"
#include "pnUtCrypt.h"
#include "pnUtEndian.h"
#include "pnUtSpareList.h"
#include "pnUtSubst.h"
#include "pnUtRand.h"

146
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtEndian.cpp

@ -1,146 +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/pnUtEndian.cpp
*
***/
#include "../Pch.h"
#pragma hdrstop
/*****************************************************************************
*
* Big endian functions
*
***/
#ifdef BIG_ENDIAN
//===========================================================================
void EndianConvert (word * array, unsigned count) {
for (; count--; ++array)
*array = Endian(*array);
}
//===========================================================================
void EndianConvert (dword * array, unsigned count) {
for (; count--; ++array)
*array = Endian(*array);
}
//===========================================================================
void EndianConvert (qword * array, unsigned count) {
for (; count--; ++array)
*array = Endian(*array);
}
//============================================================================
void EndianConvert (byte * data, unsigned elemCount, unsigned elemBytes) {
switch (elemBytes) {
case sizeof(byte):
break;
case sizeof(word):
EndianConvert((word *)data, elemCount);
break;
case sizeof(dword):
EndianConvert((dword *)data, elemCount);
break;
case sizeof(qword):
EndianConvert((qword *)data, elemCount);
break;
DEFAULT_FATAL(elemBytes);
}
}
//===========================================================================
void EndianCopy (unsigned * dst, const word src[], unsigned count) {
for (; count--; ++src, ++dst)
*dst = (unsigned)Endian(*src);
}
//===========================================================================
void EndianCopy (unsigned * dst, const dword src[], unsigned count) {
for (; count--; ++src, ++dst)
*dst = (unsigned)Endian(*src);
}
//===========================================================================
void EndianCopy (unsigned * dst, const qword src[], unsigned count) {
for (; count--; ++src, ++dst)
*dst = (unsigned)Endian(*src);
}
//============================================================================
void EndianCopy (
void * dst,
const byte src[],
unsigned elemCount,
unsigned elemBytes
) {
switch (elemBytes) {
case sizeof(byte):
MemCopy(dst, src, elemCount);
break;
case sizeof(word):
EndianCopy((word *)dst, (const word *)src, elemCount);
break;
case sizeof(dword):
EndianCopy((dword *)dst, (const dword *)src, elemCount);
break;
case sizeof(qword):
EndianCopy((qword *)dst, (const qword *)src, elemCount);
break;
DEFAULT_FATAL(elemBytes);
}
}
#endif // BIG_ENDIAN

189
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtEndian.h

@ -1,189 +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/pnUtEndian.h
*
***/
#ifdef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTENDIAN_H
#error "Header $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtEndian.h included more than once"
#endif
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTENDIAN_H
// NOTE: Because we predominantly run on little-endian CPUs, we don't
// convert to "network order" when sending integers across the network
// (tcp uses big-endian regardless of underlying hardware) and instead
// use little-endian as the "native" language of our network messages.
/*****************************************************************************
*
* Little endian functions
*
***/
#ifdef LITTLE_ENDIAN
//============================================================================
inline word Endian (word value) { return value; }
inline dword Endian (dword value) { return value; }
inline qword Endian (qword value) { return value; }
//===========================================================================
inline void EndianConvert (
word * array,
unsigned count
) {
return;
}
//===========================================================================
inline void EndianConvert (
dword * array,
unsigned count
) {
return;
}
//===========================================================================
inline void EndianConvert (
qword * array,
unsigned count
) {
return;
}
//===========================================================================
inline void EndianConvert (
byte * data,
unsigned elemCount,
unsigned elemBytes
) {
return;
}
//===========================================================================
inline void EndianCopy (
word * dst,
const word src[],
unsigned count
) {
MemCopy(dst, src, count * sizeof(word));
}
//===========================================================================
inline void EndianCopy (
dword * dst,
const dword src[],
unsigned count
) {
MemCopy(dst, src, count * sizeof(dword));
}
//===========================================================================
inline void EndianCopy (
qword * dst,
const qword src[],
unsigned count
) {
MemCopy(dst, src, count * sizeof(qword));
}
//===========================================================================
inline void EndianCopy (
void * dst,
const byte src[],
unsigned elemCount,
unsigned elemBytes
) {
MemCopy(dst, src, elemCount * elemBytes);
}
#endif // LITTLE_ENDIAN
/*****************************************************************************
*
* Big endian functions
*
***/
#ifdef BIG_ENDIAN
//===========================================================================
inline word Endian (word value) {
return (value >> 8) | (value << 8);
}
//===========================================================================
inline dword Endian (dword value) {
return ((value) << 24) |
((value & 0x0000ff00) << 8) |
((value & 0x00ff0000) >> 8) |
((value) >> 24);
}
//===========================================================================
inline qword Endian (qword value) {
return ((value) << 56) |
((value & 0x000000000000ff00) << 40) |
((value & 0x0000000000ff0000) << 24) |
((value & 0x00000000ff000000) << 8) |
((value & 0x000000ff00000000) >> 8) |
((value & 0x0000ff0000000000) >> 24) |
((value & 0x00ff000000000000) >> 40) |
((value) >> 56);
}
void EndianConvert (word * array, unsigned count);
void EndianConvert (dword * array, unsigned count);
void EndianConvert (qword * array, unsigned count);
void EndianConvert (byte * data, unsigned elemCount, unsigned elemBytes);
void EndianCopy (word * dst, const word src[], unsigned count);
void EndianCopy (dword * dst, const dword src[], unsigned count);
void EndianCopy (qword * dst, const dword src[], unsigned count);
void EndianCopy (void * dst, const byte src[], unsigned elemCount, unsigned elemBytes);
#endif

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save