Browse Source

Fix Endian functions names in hsTypes and hsStream.

Function and macro names for endianness were previously vague,
and on big-endian systems entirely misleading.  The names are
now properly descriptive of what they actually do.
Joseph Davies 13 years ago committed by Darryl Pogue
parent
commit
e462ef04b3
  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. 28
      Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp
  83. 12
      Sources/Plasma/NucleusLib/pnNetCommon/plNetAddress.cpp
  84. 4
      Sources/Plasma/NucleusLib/pnNetCommon/plNetGroup.h
  85. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp
  86. 4
      Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.cpp
  87. 12
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp
  88. 8
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.cpp
  89. 4
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedValue.h
  90. 4
      Sources/Plasma/NucleusLib/pnNetCommon/pnNetCommon.cpp
  91. 4
      Sources/Plasma/NucleusLib/pnSceneObject/plCoordinateInterface.cpp
  92. 12
      Sources/Plasma/NucleusLib/pnSceneObject/plDrawInterface.cpp
  93. 8
      Sources/Plasma/NucleusLib/pnSceneObject/plSceneObject.cpp
  94. 4
      Sources/Plasma/NucleusLib/pnSceneObject/plSimulationInterface.cpp
  95. 6
      Sources/Plasma/NucleusLib/pnTimer/plTimedValue.h
  96. 4
      Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp
  97. 48
      Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp
  98. 92
      Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp
  99. 72
      Sources/Plasma/PubUtilLib/plAudio/plSound.cpp
  100. 4
      Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp
  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 /// Read the rest in
selMode.Read(&stream); selMode.Read(&stream);
UInt16 performance = stream.ReadSwap16(); UInt16 performance = stream.ReadLE16();
if( performance < 25 ) if( performance < 25 )
plBitmap::SetGlobalLevelChopCount( 2 ); plBitmap::SetGlobalLevelChopCount( 2 );
@ -2158,7 +2158,7 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
{ {
dmr.GetDevice()->Write(&stream); dmr.GetDevice()->Write(&stream);
dmr.GetMode()->Write(&stream); dmr.GetMode()->Write(&stream);
stream.WriteSwap16((UInt16)(0*100)); stream.WriteLE16((UInt16)(0*100));
stream.Close(); 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(errmsg);
printf("\n"); printf("\n");
} }
s->WriteSwap32(size); s->WriteLE32(size);
s->Write(size, pycode); s->Write(size, pycode);
} }
else else
{ {
printf("......blast! Compile error!\n"); printf("......blast! Compile error!\n");
s->WriteSwap32(0); s->WriteLE32(0);
PyErr_Print(); PyErr_Print();
PyErr_Clear(); 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")) if (!s.Open(pakName.c_str(), "wb"))
return; return;
s.WriteSwap32(fileNames.size()); s.WriteLE32(fileNames.size());
int i; int i;
for (i = 0; i < fileNames.size(); i++) for (i = 0; i < fileNames.size(); i++)
{ {
s.WriteSafeString(fileNames[i].c_str()); s.WriteSafeString(fileNames[i].c_str());
s.WriteSwap32(0); s.WriteLE32(0);
} }
PythonInterface::initPython(rootPath); 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++) for (i = 0; i < fileNames.size(); i++)
{ {
s.WriteSafeString(fileNames[i].c_str()); s.WriteSafeString(fileNames[i].c_str());
s.WriteSwap32(filePositions[i]); s.WriteLE32(filePositions[i]);
} }
s.Close(); s.Close();

8
Sources/Plasma/CoreLib/hsBitVector.cpp

@ -115,24 +115,24 @@ void hsBitVector::Read(hsStream* s)
{ {
Reset(); Reset();
s->LogReadSwap(&fNumBitVectors,"NumBitVectors"); s->LogReadLE(&fNumBitVectors,"NumBitVectors");
if( fNumBitVectors ) if( fNumBitVectors )
{ {
delete [] fBitVectors; delete [] fBitVectors;
fBitVectors = TRACKED_NEW UInt32[fNumBitVectors]; fBitVectors = TRACKED_NEW UInt32[fNumBitVectors];
int i; int i;
for( i = 0; i < fNumBitVectors; i++ ) for( i = 0; i < fNumBitVectors; i++ )
s->LogReadSwap(&fBitVectors[i],"BitVector"); s->LogReadLE(&fBitVectors[i],"BitVector");
} }
} }
void hsBitVector::Write(hsStream* s) const void hsBitVector::Write(hsStream* s) const
{ {
s->WriteSwap32(fNumBitVectors); s->WriteLE32(fNumBitVectors);
int i; int i;
for( i = 0; i < fNumBitVectors; i++ ) for( i = 0; i < fNumBitVectors; i++ )
s->WriteSwap32(fBitVectors[i]); s->WriteLE32(fBitVectors[i]);
} }
hsTArray<Int16>& hsBitVector::Enumerate(hsTArray<Int16>& dst) const 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) void hsBounds::Read(hsStream *s)
{ {
fType =(hsBoundsType) s->ReadSwap32(); fType =(hsBoundsType) s->ReadLE32();
} }
void hsBounds::Write(hsStream *s) 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); hsBounds::Write(stream);
fCenter.Write(stream); fCenter.Write(stream);
stream->WriteSwap32(fCenterValid); stream->WriteLE32(fCenterValid);
stream->WriteSwap32(fNumPlanes); stream->WriteLE32(fNumPlanes);
int i; int i;
for( i = 0; i < fNumPlanes; i++ ) for( i = 0; i < fNumPlanes; i++ )
{ {
@ -633,8 +633,8 @@ void hsBoundsOriented::Read(hsStream *stream)
{ {
hsBounds::Read(stream); hsBounds::Read(stream);
fCenter.Read(stream); fCenter.Read(stream);
fCenterValid = (hsBool)stream->ReadSwap32(); fCenterValid = (hsBool)stream->ReadLE32();
fNumPlanes = stream->ReadSwap32(); fNumPlanes = stream->ReadLE32();
if (fPlanes) if (fPlanes)
delete [] fPlanes; delete [] fPlanes;
fPlanes = TRACKED_NEW hsPlane3[fNumPlanes]; fPlanes = TRACKED_NEW hsPlane3[fNumPlanes];
@ -2592,7 +2592,7 @@ hsBool hsBounds3Ext::ISectRayBS(const hsPoint3& from, const hsPoint3& to, hsPoin
void hsBounds3Ext::Read(hsStream *s) void hsBounds3Ext::Read(hsStream *s)
{ {
fExtFlags = s->ReadSwap32(); fExtFlags = s->ReadLE32();
hsBounds3::Read(s); hsBounds3::Read(s);
if( !(fExtFlags & kAxisAligned) ) if( !(fExtFlags & kAxisAligned) )
{ {
@ -2601,8 +2601,8 @@ void hsBounds3Ext::Read(hsStream *s)
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
{ {
fAxes[i].Read(s); fAxes[i].Read(s);
fDists[i].fX = s->ReadSwapScalar(); fDists[i].fX = s->ReadLEScalar();
fDists[i].fY = s->ReadSwapScalar(); fDists[i].fY = s->ReadLEScalar();
} }
IMakeMinsMaxs(); IMakeMinsMaxs();
IMakeDists(); IMakeDists();
@ -2611,7 +2611,7 @@ void hsBounds3Ext::Read(hsStream *s)
} }
void hsBounds3Ext::Write(hsStream *s) void hsBounds3Ext::Write(hsStream *s)
{ {
s->WriteSwap32(fExtFlags); s->WriteLE32(fExtFlags);
hsBounds3::Write(s); hsBounds3::Write(s);
if( !(fExtFlags & kAxisAligned) ) if( !(fExtFlags & kAxisAligned) )
{ {
@ -2622,14 +2622,14 @@ void hsBounds3Ext::Write(hsStream *s)
fAxes[i].Write(s); fAxes[i].Write(s);
if( fExtFlags & kDistsSet ) if( fExtFlags & kDistsSet )
{ {
s->WriteSwapScalar(fDists[i].fX); s->WriteLEScalar(fDists[i].fX);
s->WriteSwapScalar(fDists[i].fY); s->WriteLEScalar(fDists[i].fY);
} }
else else
{ {
// Playing nice with binary patches--writing uninited values BAD! // Playing nice with binary patches--writing uninited values BAD!
s->WriteSwapScalar( 0.f ); s->WriteLEScalar( 0.f );
s->WriteSwapScalar( 0.f ); s->WriteLEScalar( 0.f );
} }
} }
} }

16
Sources/Plasma/CoreLib/hsColorRGBA.h

@ -78,17 +78,17 @@ struct hsColorRGBA {
inline void hsColorRGBA::Read(hsStream *s) inline void hsColorRGBA::Read(hsStream *s)
{ {
r = s->ReadSwapScalar(); r = s->ReadLEScalar();
g = s->ReadSwapScalar(); g = s->ReadLEScalar();
b = s->ReadSwapScalar(); b = s->ReadLEScalar();
a = s->ReadSwapScalar(); a = s->ReadLEScalar();
} }
inline void hsColorRGBA::Write(hsStream *s) const inline void hsColorRGBA::Write(hsStream *s) const
{ {
s->WriteSwapScalar(r); s->WriteLEScalar(r);
s->WriteSwapScalar(g); s->WriteLEScalar(g);
s->WriteSwapScalar(b); s->WriteLEScalar(b);
s->WriteSwapScalar(a); s->WriteLEScalar(a);
} }
inline hsColorRGBA& hsColorRGBA::FromARGB32(UInt32 c) 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 void hsScalarTriple::Write(hsStream *stream) const
{ {
stream->WriteSwapScalar(fX); stream->WriteLEScalar(fX);
stream->WriteSwapScalar(fY); stream->WriteLEScalar(fY);
stream->WriteSwapScalar(fZ); stream->WriteLEScalar(fZ);
} }
hsPlane3::hsPlane3(const hsPoint3* pt1, const hsPoint3* pt2, const hsPoint3* pt3) 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) void hsPlane3::Read(hsStream *stream)
{ {
fN.Read(stream); fN.Read(stream);
fD=stream->ReadSwapScalar(); fD=stream->ReadLEScalar();
} }
void hsPlane3::Write(hsStream *stream) const void hsPlane3::Write(hsStream *stream) const
{ {
fN.Write(stream); 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++ ) 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++ ) 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(i=0; i<4; i++)
for(j=0; j<4; j++) for(j=0; j<4; j++)
#if HS_SCALAR_IS_FIXED #if HS_SCALAR_IS_FIXED
fMap[i][j] = stream->ReadSwap32(); fMap[i][j] = stream->ReadLE32();
#endif #endif
#if HS_SCALAR_IS_FLOAT #if HS_SCALAR_IS_FLOAT
fMap[i][j] = stream->ReadSwapFloat(); fMap[i][j] = stream->ReadLEFloat();
#endif #endif
IsIdentity(); IsIdentity();
} }
@ -961,10 +961,10 @@ void hsMatrix44::Write(hsStream *stream)
for(i=0; i<4; i++) for(i=0; i<4; i++)
for(j=0; j<4; j++) for(j=0; j<4; j++)
#if HS_SCALAR_IS_FIXED #if HS_SCALAR_IS_FIXED
stream->WriteSwap32(fMap[i][j]); stream->WriteLE32(fMap[i][j]);
#endif #endif
#if HS_SCALAR_IS_FLOAT #if HS_SCALAR_IS_FLOAT
stream->WriteSwapFloat(fMap[i][j]); stream->WriteLEFloat(fMap[i][j]);
#endif #endif
} }
} }

16
Sources/Plasma/CoreLib/hsQuat.cpp

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

222
Sources/Plasma/CoreLib/hsStream.h

@ -61,8 +61,8 @@ struct FileEntry;
#define LogReadSafeString() ReadSafeString(); #define LogReadSafeString() ReadSafeString();
#define LogReadSafeStringLong() ReadSafeStringLong(); #define LogReadSafeStringLong() ReadSafeStringLong();
#define LogSkip(deltaByteCount, desc) Skip(deltaByteCount) #define LogSkip(deltaByteCount, desc) Skip(deltaByteCount)
#define LogReadSwap(value, desc) ReadSwap(value) #define LogReadLE(value, desc) ReadLE(value)
#define LogReadSwapArray(count, values, desc) ReadSwap(count, values) #define LogReadLEArray(count, values, desc) ReadLE(count, values)
#define LogSubStreamStart(desc) LogVoidFunc() #define LogSubStreamStart(desc) LogVoidFunc()
#define LogSubStreamPushDesc(desc) LogVoidFunc() #define LogSubStreamPushDesc(desc) LogVoidFunc()
#define LogSubStreamEnd() LogVoidFunc() #define LogSubStreamEnd() LogVoidFunc()
@ -148,162 +148,162 @@ public:
bool Readbool(); bool Readbool();
hsBool ReadBool(); hsBool ReadBool();
void ReadBool(int count, hsBool values[]); void ReadBool(int count, hsBool values[]);
UInt16 ReadSwap16(); UInt16 ReadLE16();
void ReadSwap16(int count, UInt16 values[]); void ReadLE16(int count, UInt16 values[]);
UInt32 ReadSwap32(); UInt32 ReadLE32();
void ReadSwap32(int count, UInt32 values[]); void ReadLE32(int count, UInt32 values[]);
UInt32 ReadUnswap32(); UInt32 ReadBE32();
void Writebool(bool value); void Writebool(bool value);
void WriteBool(hsBool value); void WriteBool(hsBool value);
void WriteBool(int count, const hsBool values[]); void WriteBool(int count, const hsBool values[]);
void WriteByte(UInt8 value); void WriteByte(UInt8 value);
void WriteSwap16(UInt16 value); void WriteLE16(UInt16 value);
void WriteSwap16(int count, const UInt16 values[]); void WriteLE16(int count, const UInt16 values[]);
void WriteSwap32(UInt32 value); void WriteLE32(UInt32 value);
void WriteSwap32(int count, const UInt32 values[]); void WriteLE32(int count, const UInt32 values[]);
void WriteUnswap32(UInt32 value); void WriteBE32(UInt32 value);
/* Overloaded Begin (8 & 16 & 32 int)*/ /* Overloaded Begin (8 & 16 & 32 int)*/
/* yes, swapping an 8 bit value does nothing, just useful*/ /* yes, swapping an 8 bit value does nothing, just useful*/
void ReadSwap(bool* value) { *value = this->ReadByte() ? true : false; } void ReadLE(bool* value) { *value = this->ReadByte() ? true : false; }
void ReadSwap(UInt8* value) { *value = this->ReadByte(); } void ReadLE(UInt8* value) { *value = this->ReadByte(); }
void ReadSwap(int count, UInt8 values[]) { this->Read(count, values); } void ReadLE(int count, UInt8 values[]) { this->Read(count, values); }
void ReadSwap(UInt16* value) { *value = this->ReadSwap16(); } void ReadLE(UInt16* value) { *value = this->ReadLE16(); }
void ReadSwap(int count, UInt16 values[]) { this->ReadSwap16(count, values); } void ReadLE(int count, UInt16 values[]) { this->ReadLE16(count, values); }
void ReadSwap(UInt32* value) { *value = this->ReadSwap32(); } void ReadLE(UInt32* value) { *value = this->ReadLE32(); }
void ReadSwap(int count, UInt32 values[]) { this->ReadSwap32(count, values); } void ReadLE(int count, UInt32 values[]) { this->ReadLE32(count, values); }
#ifdef STREAM_LOGGER #ifdef STREAM_LOGGER
// Begin LogReadSwaps // Begin LogReadLEs
virtual void LogReadSwap(bool* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(bool* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwap(UInt8* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(UInt8* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwapArray(int count, UInt8 values[], const char* desc) { this->ReadSwap(count, values); } virtual void LogReadLEArray(int count, UInt8 values[], const char* desc) { this->ReadLE(count, values); }
virtual void LogReadSwap(UInt16* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(UInt16* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwapArray(int count, UInt16 values[], const char* desc) { this->ReadSwap(count, values); } virtual void LogReadLEArray(int count, UInt16 values[], const char* desc) { this->ReadLE(count, values); }
virtual void LogReadSwap(UInt32* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(UInt32* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwapArray(int count, UInt32 values[], const char* desc) { this->ReadSwap(count, values); } virtual void LogReadLEArray(int count, UInt32 values[], const char* desc) { this->ReadLE(count, values); }
// End LogReadSwaps // End LogReadLEs
#endif #endif
void WriteSwap(bool value) { this->Write(1,&value); } void WriteLE(bool value) { this->Write(1,&value); }
void WriteSwap(UInt8 value) { this->Write(1,&value); } void WriteLE(UInt8 value) { this->Write(1,&value); }
void WriteSwap(int count, const UInt8 values[]) { this->Write(count, values); } void WriteLE(int count, const UInt8 values[]) { this->Write(count, values); }
void WriteSwap(UInt16 value) { this->WriteSwap16(value); } void WriteLE(UInt16 value) { this->WriteLE16(value); }
void WriteSwap(int count, const UInt16 values[]) { this->WriteSwap16(count, values); } void WriteLE(int count, const UInt16 values[]) { this->WriteLE16(count, values); }
void WriteSwap(UInt32 value) { this->WriteSwap32(value); } void WriteLE(UInt32 value) { this->WriteLE32(value); }
void WriteSwap(int count, const UInt32 values[]) { this->WriteSwap32(count, values); } void WriteLE(int count, const UInt32 values[]) { this->WriteLE32(count, values); }
void ReadSwap(Int8* value) { *value = this->ReadByte(); } void ReadLE(Int8* value) { *value = this->ReadByte(); }
void ReadSwap(int count, Int8 values[]) { this->Read(count, values); } void ReadLE(int count, Int8 values[]) { this->Read(count, values); }
void ReadSwap(char* value) { *value = (char)this->ReadByte(); } void ReadLE(char* value) { *value = (char)this->ReadByte(); }
void ReadSwap(int count, char values[]) { this->Read(count, values); } void ReadLE(int count, char values[]) { this->Read(count, values); }
void ReadSwap(Int16* value) { *value = (Int16)this->ReadSwap16(); } void ReadLE(Int16* value) { *value = (Int16)this->ReadLE16(); }
void ReadSwap(int count, Int16 values[]) { this->ReadSwap16(count, (UInt16*)values); } void ReadLE(int count, Int16 values[]) { this->ReadLE16(count, (UInt16*)values); }
void ReadSwap(Int32* value) { *value = (Int32)this->ReadSwap32(); } void ReadLE(Int32* value) { *value = (Int32)this->ReadLE32(); }
void ReadSwap(int count, Int32 values[]) { this->ReadSwap32(count, (UInt32*)values); } void ReadLE(int count, Int32 values[]) { this->ReadLE32(count, (UInt32*)values); }
#ifdef STREAM_LOGGER #ifdef STREAM_LOGGER
// Begin LogReadSwaps // Begin LogReadLEs
virtual void LogReadSwap(Int8* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(Int8* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwapArray(int count, Int8 values[], const char* desc) { this->ReadSwap(count, values); } virtual void LogReadLEArray(int count, Int8 values[], const char* desc) { this->ReadLE(count, values); }
virtual void LogReadSwap(char* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(char* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwapArray(int count, char values[], const char* desc) { this->ReadSwap(count, values); } virtual void LogReadLEArray(int count, char values[], const char* desc) { this->ReadLE(count, values); }
virtual void LogReadSwap(Int16* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(Int16* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwapArray(int count, Int16 values[], const char* desc) { this->ReadSwap(count, (UInt16*)values); } virtual void LogReadLEArray(int count, Int16 values[], const char* desc) { this->ReadLE(count, (UInt16*)values); }
virtual void LogReadSwap(Int32* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(Int32* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwapArray(int count, Int32 values[], const char* desc) { this->ReadSwap(count, (UInt32*)values); } virtual void LogReadLEArray(int count, Int32 values[], const char* desc) { this->ReadLE(count, (UInt32*)values); }
virtual void LogReadSwap(int* value, const char* desc) { this->ReadSwap(value); } virtual void LogReadLE(int* value, const char* desc) { this->ReadLE(value); }
virtual void LogReadSwapArray(int count, int values[], const char* desc) { this->ReadSwap(count, (UInt32*)values); } virtual void LogReadLEArray(int count, int values[], const char* desc) { this->ReadLE(count, (UInt32*)values); }
// End LogReadSwaps // End LogReadLEs
#endif #endif
void WriteSwap(Int8 value) { this->Write(1,&value); } void WriteLE(Int8 value) { this->Write(1,&value); }
void WriteSwap(int count, const Int8 values[]) { this->Write(count, values); } void WriteLE(int count, const Int8 values[]) { this->Write(count, values); }
void WriteSwap(char value) { this->Write(1,(UInt8*)&value); } void WriteLE(char value) { this->Write(1,(UInt8*)&value); }
void WriteSwap(int count, const char values[]) { this->Write(count, (UInt8*)values); } void WriteLE(int count, const char values[]) { this->Write(count, (UInt8*)values); }
void WriteSwap(Int16 value) { this->WriteSwap16((UInt16)value); } void WriteLE(Int16 value) { this->WriteLE16((UInt16)value); }
void WriteSwap(int count, const Int16 values[]) { this->WriteSwap16(count, (UInt16*)values); } void WriteLE(int count, const Int16 values[]) { this->WriteLE16(count, (UInt16*)values); }
void WriteSwap(Int32 value) { this->WriteSwap32((UInt32)value); } void WriteLE(Int32 value) { this->WriteLE32((UInt32)value); }
void WriteSwap(int count, const Int32 values[]) { this->WriteSwap32(count, (UInt32*)values); } void WriteLE(int count, const Int32 values[]) { this->WriteLE32(count, (UInt32*)values); }
/* Overloaded End */ /* Overloaded End */
#if HS_CAN_USE_FLOAT #if HS_CAN_USE_FLOAT
float ReadSwapFloat(); float ReadLEFloat();
void ReadSwapFloat(int count, float values[]); void ReadLEFloat(int count, float values[]);
double ReadSwapDouble(); double ReadLEDouble();
void ReadSwapDouble(int count, double values[]); void ReadLEDouble(int count, double values[]);
float ReadUnswapFloat(); float ReadBEFloat();
void WriteSwapFloat(float value); void WriteLEFloat(float value);
void WriteSwapFloat(int count, const float values[]); void WriteLEFloat(int count, const float values[]);
void WriteSwapDouble(double value); void WriteLEDouble(double value);
void WriteSwapDouble(int count, const double values[]); void WriteLEDouble(int count, const double values[]);
void WriteUnswapFloat(float value); void WriteBEFloat(float value);
/* Overloaded Begin (Float)*/ /* Overloaded Begin (Float)*/
void ReadSwap(float* value) { *value = ReadSwapFloat(); } void ReadLE(float* value) { *value = ReadLEFloat(); }
void ReadSwap(int count, float values[]) { ReadSwapFloat(count, values); } void ReadLE(int count, float values[]) { ReadLEFloat(count, values); }
void ReadSwap(double* value) { *value = ReadSwapDouble(); } void ReadLE(double* value) { *value = ReadLEDouble(); }
void ReadSwap(int count, double values[]) { ReadSwapDouble(count, values); } void ReadLE(int count, double values[]) { ReadLEDouble(count, values); }
#ifdef STREAM_LOGGER #ifdef STREAM_LOGGER
// Begin LogReadSwaps // Begin LogReadLEs
virtual void LogReadSwap(float* value, const char* desc) { ReadSwap(value); } virtual void LogReadLE(float* value, const char* desc) { ReadLE(value); }
virtual void LogReadSwapArray(int count, float values[], const char* desc) { ReadSwap(count, values); } virtual void LogReadLEArray(int count, float values[], const char* desc) { ReadLE(count, values); }
virtual void LogReadSwap(double* value, const char* desc) { ReadSwap(value); } virtual void LogReadLE(double* value, const char* desc) { ReadLE(value); }
virtual void LogReadSwapArray(int count, double values[], const char* desc) { ReadSwap(count, values); } virtual void LogReadLEArray(int count, double values[], const char* desc) { ReadLE(count, values); }
// End LogReadSwaps // End LogReadLEs
#endif #endif
void WriteSwap(float value) { WriteSwapFloat(value); } void WriteLE(float value) { WriteLEFloat(value); }
void WriteSwap(int count, const float values[]) { WriteSwapFloat(count, values); } void WriteLE(int count, const float values[]) { WriteLEFloat(count, values); }
void WriteSwap(double value) { WriteSwapDouble(value); } void WriteLE(double value) { WriteLEDouble(value); }
void WriteSwap(int count, const double values[]) { WriteSwapDouble(count, values); } void WriteLE(int count, const double values[]) { WriteLEDouble(count, values); }
/* Overloaded End */ /* Overloaded End */
#endif #endif
#if HS_SCALAR_IS_FIXED #if HS_SCALAR_IS_FIXED
hsFixed ReadSwapScalar() { return (hsFixed)this->ReadSwap32(); } hsFixed ReadLEScalar() { return (hsFixed)this->ReadLE32(); }
void ReadSwapScalar(int count, hsFixed values[]) 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 WriteLEScalar(hsFixed value) { this->WriteLE32(value); }
void WriteSwapScalar(int count, const hsFixed values[]) 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) */ /* Overloaded Begin (Scalar) */
void ReadSwap(hsFixed* value) { this->ReadSwap((UInt32*)value); } void ReadLE(hsFixed* value) { this->ReadLE((UInt32*)value); }
void ReadSwap(int count, hsFixed values[]) { this->ReadSwap(count, (UInt32*)values); } void ReadLE(int count, hsFixed values[]) { this->ReadLE(count, (UInt32*)values); }
void WriteSwap(hsFixed value) { this->WriteSwap((UInt32)value); } void WriteLE(hsFixed value) { this->WriteLE((UInt32)value); }
void WriteSwap(int count, const hsFixed values[]) { this->WriteSwap(count, (UInt32*)values); } void WriteLE(int count, const hsFixed values[]) { this->WriteLE(count, (UInt32*)values); }
/* Overloaded End */ /* Overloaded End */
#else #else
float ReadSwapScalar() { return (float)this->ReadSwapFloat(); } float ReadLEScalar() { return (float)this->ReadLEFloat(); }
void ReadSwapScalar(int count, float values[]) void ReadLEScalar(int count, float values[])
{ {
this->ReadSwapFloat(count, (float*)values); this->ReadLEFloat(count, (float*)values);
} }
float ReadUnswapScalar() { return (float)this->ReadUnswapFloat(); } float ReadBEScalar() { return (float)this->ReadBEFloat(); }
void WriteSwapScalar(float value) { this->WriteSwapFloat(value); } void WriteLEScalar(float value) { this->WriteLEFloat(value); }
void WriteSwapScalar(int count, const float values[]) 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 #endif
void WriteSwapAtom(UInt32 tag, UInt32 size); void WriteLEAtom(UInt32 tag, UInt32 size);
UInt32 ReadSwapAtom(UInt32* size); UInt32 ReadLEAtom(UInt32* size);
/* Overloaded Begin (Atom)*/ /* Overloaded Begin (Atom)*/
void WriteSwap(UInt32* tag, UInt32 size) { WriteSwapAtom(*tag, size); } void WriteLE(UInt32* tag, UInt32 size) { WriteLEAtom(*tag, size); }
void ReadSwap(UInt32* tag, UInt32 *size) { *tag = ReadSwapAtom(size); } void ReadLE(UInt32* tag, UInt32 *size) { *tag = ReadLEAtom(size); }
/* Overloaded End */ /* Overloaded End */
virtual void VirtualSetPosition(UInt32 pos, VDB_Type ){ SetPosition(pos); }; virtual void VirtualSetPosition(UInt32 pos, VDB_Type ){ SetPosition(pos); };
virtual hsPackFileSys::FileEntry *GetFileEntry() { return nil; } // Streams from Packfiles can return a FileEntry 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 #endif
#if LITTLE_ENDIAN #if LITTLE_ENDIAN
#define hsUNSWAP16(n) hsSwapEndian16(n) #define hsToBE16(n) hsSwapEndian16(n)
#define hsUNSWAP32(n) hsSwapEndian32(n) #define hsToBE32(n) hsSwapEndian32(n)
#define hsUNSWAP64(n) hsSwapEndian64(n) #define hsToBE64(n) hsSwapEndian64(n)
#define hsUNSWAPFloat(n) hsSwapEndianFloat(n) #define hsToBEFloat(n) hsSwapEndianFloat(n)
#define hsUNSWAPDouble(n) hsSwapEndianDouble(n) #define hsToBEDouble(n) hsSwapEndianDouble(n)
#define hsSWAP16(n) (n) #define hsToLE16(n) (n)
#define hsSWAP32(n) (n) #define hsToLE32(n) (n)
#define hsSWAP64(n) (n) #define hsToLE64(n) (n)
#define hsSWAPFloat(n) (n) #define hsToLEFloat(n) (n)
#define hsSWAPDouble(n) (n) #define hsToLEDouble(n) (n)
#else #else
#define hsUNSWAP16(n) (n) #define hsToBE16(n) (n)
#define hsUNSWAP32(n) (n) #define hsToBE32(n) (n)
#define hsUNSWAP64(n) (n) #define hsToBE64(n) (n)
#define hsUNSWAPFloat(n) (n) #define hsToBEFloat(n) (n)
#define hsUNSWAPDouble(n) (n) #define hsToBEDouble(n) (n)
#define hsSWAP16(n) hsSwapEndian16(n) #define hsToLE16(n) hsSwapEndian16(n)
#define hsSWAP32(n) hsSwapEndian32(n) #define hsToLE32(n) hsSwapEndian32(n)
#define hsSWAP64(n) hsSwapEndian64(n) #define hsToLE64(n) hsSwapEndian64(n)
#define hsSWAPFloat(n) hsSwapEndianFloat(n) #define hsToLEFloat(n) hsSwapEndianFloat(n)
#define hsSWAPDouble(n) hsSwapEndianDouble(n) #define hsToLEDouble(n) hsSwapEndianDouble(n)
#endif #endif
inline void hsSwap(Int32& a, Int32& b) 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 ) void pcSmallRect::Read( hsStream *s )
{ {
s->ReadSwap( &fX ); s->ReadLE( &fX );
s->ReadSwap( &fY ); s->ReadLE( &fY );
s->ReadSwap( &fWidth ); s->ReadLE( &fWidth );
s->ReadSwap( &fHeight ); s->ReadLE( &fHeight );
} }
void pcSmallRect::Write( hsStream *s ) void pcSmallRect::Write( hsStream *s )
{ {
s->WriteSwap( fX ); s->WriteLE( fX );
s->WriteSwap( fY ); s->WriteLE( fY );
s->WriteSwap( fWidth ); s->WriteLE( fWidth );
s->WriteSwap( fHeight ); s->WriteLE( fHeight );
} }

8
Sources/Plasma/CoreLib/plGeneric.cpp

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

4
Sources/Plasma/CoreLib/plLoadMask.cpp

@ -82,7 +82,7 @@ void plLoadMask::Read(hsStream* s)
{ {
// read as packed byte // read as packed byte
UInt8 qc; UInt8 qc;
s->LogReadSwap(&qc,"Quality|Capabilty"); s->LogReadLE(&qc,"Quality|Capabilty");
fQuality[0] = (qc & 0xf0) >> 4; fQuality[0] = (qc & 0xf0) >> 4;
fQuality[1] = (qc & 0x0f); fQuality[1] = (qc & 0x0f);
@ -96,7 +96,7 @@ void plLoadMask::Write(hsStream* s) const
{ {
// write packed into 1 byte // write packed into 1 byte
UInt8 qc = (fQuality[0]<<4) | (fQuality[1] & 0xf); 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[]) 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) void plViewTransform::Read(hsStream* s)
{ {
fFlags = s->ReadSwap32(); fFlags = s->ReadLE32();
fFlags &= ~kSetMask; fFlags &= ~kSetMask;
fCameraToWorld.Read(s); fCameraToWorld.Read(s);
@ -358,8 +358,8 @@ void plViewTransform::Read(hsStream* s)
fMin.Read(s); fMin.Read(s);
fMax.Read(s); fMax.Read(s);
fWidth = s->ReadSwap16(); fWidth = s->ReadLE16();
fHeight = s->ReadSwap16(); fHeight = s->ReadLE16();
fViewPortX.Read(s); fViewPortX.Read(s);
fViewPortY.Read(s); fViewPortY.Read(s);
@ -370,7 +370,7 @@ void plViewTransform::Read(hsStream* s)
void plViewTransform::Write(hsStream* s) void plViewTransform::Write(hsStream* s)
{ {
s->WriteSwap32(fFlags & ~kSetMask); s->WriteLE32(fFlags & ~kSetMask);
fCameraToWorld.Write(s); fCameraToWorld.Write(s);
fWorldToCamera.Write(s); fWorldToCamera.Write(s);
@ -378,8 +378,8 @@ void plViewTransform::Write(hsStream* s)
fMin.Write(s); fMin.Write(s);
fMax.Write(s); fMax.Write(s);
s->WriteSwap16(fWidth); s->WriteLE16(fWidth);
s->WriteSwap16(fHeight); s->WriteLE16(fHeight);
fViewPortX.Write(s); fViewPortX.Write(s);
fViewPortY.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()); SetNumBoids(s->ReadByte());
fBoidKey = mgr->ReadKey(s); fBoidKey = mgr->ReadKey(s);
fFlock.SetGoalWeight(s->ReadSwapScalar()); fFlock.SetGoalWeight(s->ReadLEScalar());
fFlock.SetWanderWeight(s->ReadSwapScalar()); fFlock.SetWanderWeight(s->ReadLEScalar());
fFlock.SetSeparationWeight(s->ReadSwapScalar()); fFlock.SetSeparationWeight(s->ReadLEScalar());
fFlock.SetSeparationRadius(s->ReadSwapScalar()); fFlock.SetSeparationRadius(s->ReadLEScalar());
fFlock.SetCohesionWeight(s->ReadSwapScalar()); fFlock.SetCohesionWeight(s->ReadLEScalar());
fFlock.SetCohesionRadius(s->ReadSwapScalar()); fFlock.SetCohesionRadius(s->ReadLEScalar());
fFlock.SetMaxForce(s->ReadSwapScalar()); fFlock.SetMaxForce(s->ReadLEScalar());
fFlock.SetMaxSpeed(s->ReadSwapScalar()); fFlock.SetMaxSpeed(s->ReadLEScalar());
fFlock.SetMinSpeed(s->ReadSwapScalar()); fFlock.SetMinSpeed(s->ReadLEScalar());
fUseTargetRotation = s->ReadBool(); fUseTargetRotation = s->ReadBool();
fRandomizeAnimationStart = s->ReadBool(); fRandomizeAnimationStart = s->ReadBool();
@ -1058,18 +1058,18 @@ void pfObjectFlocker::Write(hsStream* s, hsResMgr* mgr)
s->WriteByte(fNumBoids); s->WriteByte(fNumBoids);
mgr->WriteKey(s, fBoidKey); mgr->WriteKey(s, fBoidKey);
s->WriteSwapScalar(fFlock.GoalWeight()); s->WriteLEScalar(fFlock.GoalWeight());
s->WriteSwapScalar(fFlock.WanderWeight()); s->WriteLEScalar(fFlock.WanderWeight());
s->WriteSwapScalar(fFlock.SeparationWeight()); s->WriteLEScalar(fFlock.SeparationWeight());
s->WriteSwapScalar(fFlock.SeparationRadius()); s->WriteLEScalar(fFlock.SeparationRadius());
s->WriteSwapScalar(fFlock.CohesionWeight()); s->WriteLEScalar(fFlock.CohesionWeight());
s->WriteSwapScalar(fFlock.CohesionRadius()); s->WriteLEScalar(fFlock.CohesionRadius());
s->WriteSwapScalar(fFlock.MaxForce()); s->WriteLEScalar(fFlock.MaxForce());
s->WriteSwapScalar(fFlock.MaxSpeed()); s->WriteLEScalar(fFlock.MaxSpeed());
s->WriteSwapScalar(fFlock.MinSpeed()); s->WriteLEScalar(fFlock.MinSpeed());
s->WriteBool(fUseTargetRotation); s->WriteBool(fUseTargetRotation);
s->WriteBool(fRandomizeAnimationStart); 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); plSingleModifier::Read(s, mgr);
fMasterPower = s->ReadSwapScalar(); fMasterPower = s->ReadLEScalar();
fDirectRate = s->ReadSwapScalar(); fDirectRate = s->ReadLEScalar();
fImpulseRate = s->ReadSwapScalar(); fImpulseRate = s->ReadLEScalar();
fSpringKonst = s->ReadSwapScalar(); fSpringKonst = s->ReadLEScalar();
} }
void plBlower::Write(hsStream* s, hsResMgr* mgr) void plBlower::Write(hsStream* s, hsResMgr* mgr)
{ {
plSingleModifier::Write(s, mgr); plSingleModifier::Write(s, mgr);
s->WriteSwapScalar(fMasterPower); s->WriteLEScalar(fMasterPower);
s->WriteSwapScalar(fDirectRate); s->WriteLEScalar(fDirectRate);
s->WriteSwapScalar(fImpulseRate); s->WriteLEScalar(fImpulseRate);
s->WriteSwapScalar(fSpringKonst); s->WriteLEScalar(fSpringKonst);
} }
void plBlower::IInitOscillators() 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); plCoordinateInterface::Read(stream, mgr);
fFilterMask = stream->ReadSwap32(); fFilterMask = stream->ReadLE32();
fRefParentLocalToWorld.Read(stream); fRefParentLocalToWorld.Read(stream);
} }
@ -102,7 +102,7 @@ void plFilterCoordInterface::Write(hsStream* stream, hsResMgr* mgr)
{ {
plCoordinateInterface::Write(stream, mgr); plCoordinateInterface::Write(stream, mgr);
stream->WriteSwap32(fFilterMask); stream->WriteLE32(fFilterMask);
fRefParentLocalToWorld.Write(stream); 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); mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefObject), plRefFlags::kPassiveRef);
int n = stream->ReadSwap32(); int n = stream->ReadLE32();
while(n--) while(n--)
{ {
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefStereizer), plRefFlags::kPassiveRef); 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)); SetFollowMode(FollowMode(f & 0xffff));
fFollowFlags = (UInt16)((f >> 16) & 0xffff); fFollowFlags = (UInt16)((f >> 16) & 0xffff);
if( fFollowFlags & kOffset ) if( fFollowFlags & kOffset )
{ {
fOffset = stream->ReadSwapScalar(); fOffset = stream->ReadLEScalar();
} }
if( fFollowFlags & kOffsetAng ) if( fFollowFlags & kOffsetAng )
{ {
@ -180,11 +180,11 @@ void plLineFollowMod::Read(hsStream* stream, hsResMgr* mgr)
} }
if( fFollowFlags & kOffsetClamp ) if( fFollowFlags & kOffsetClamp )
{ {
fOffsetClamp = stream->ReadSwapScalar(); fOffsetClamp = stream->ReadLEScalar();
} }
if( fFollowFlags & kSpeedClamp ) if( fFollowFlags & kSpeedClamp )
{ {
fSpeedClamp = stream->ReadSwapScalar(); fSpeedClamp = stream->ReadLEScalar();
} }
} }
@ -198,20 +198,20 @@ void plLineFollowMod::Write(hsStream* stream, hsResMgr* mgr)
mgr->WriteKey(stream, fRefObj); mgr->WriteKey(stream, fRefObj);
stream->WriteSwap32(fStereizers.GetCount()); stream->WriteLE32(fStereizers.GetCount());
int i; int i;
for( i = 0; i < fStereizers.GetCount(); i++ ) for( i = 0; i < fStereizers.GetCount(); i++ )
mgr->WriteKey(stream, fStereizers[i]->GetKey()); mgr->WriteKey(stream, fStereizers[i]->GetKey());
UInt32 f = UInt32(fFollowMode) | (UInt32(fFollowFlags) << 16); UInt32 f = UInt32(fFollowMode) | (UInt32(fFollowFlags) << 16);
stream->WriteSwap32(f); stream->WriteLE32(f);
if( fFollowFlags & kOffset ) if( fFollowFlags & kOffset )
stream->WriteSwapScalar(fOffset); stream->WriteLEScalar(fOffset);
if( fFollowFlags & kOffsetClamp ) if( fFollowFlags & kOffsetClamp )
stream->WriteSwapScalar(fOffsetClamp); stream->WriteLEScalar(fOffsetClamp);
if( fFollowFlags & kSpeedClamp ) 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(); fMode = s->ReadByte();
fState = s->ReadByte(); fState = s->ReadByte();
fMinDelay = s->ReadSwapScalar(); fMinDelay = s->ReadLEScalar();
fMaxDelay = s->ReadSwapScalar(); fMaxDelay = s->ReadLEScalar();
IReset(); IReset();
} }
@ -290,8 +290,8 @@ void plRandomCommandMod::Write(hsStream* s, hsResMgr* mgr)
s->WriteByte(fMode); s->WriteByte(fMode);
s->WriteByte(fState); s->WriteByte(fState);
s->WriteSwapScalar(fMinDelay); s->WriteLEScalar(fMinDelay);
s->WriteSwapScalar(fMaxDelay); s->WriteLEScalar(fMaxDelay);
} }
void plRandomCommandMod::IRetry(hsScalar secs) 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); plSingleModifier::Read(stream, mgr);
fAmbientDist = stream->ReadSwapScalar(); fAmbientDist = stream->ReadLEScalar();
fTransition = stream->ReadSwapScalar(); fTransition = stream->ReadLEScalar();
fMaxSepDist = stream->ReadSwapScalar(); fMaxSepDist = stream->ReadLEScalar();
fMinSepDist = stream->ReadSwapScalar(); fMinSepDist = stream->ReadLEScalar();
fTanAng = stream->ReadSwapScalar(); fTanAng = stream->ReadLEScalar();
fInitPos.Read(stream); fInitPos.Read(stream);
@ -96,13 +96,13 @@ void plStereizer::Write(hsStream* stream, hsResMgr* mgr)
{ {
plSingleModifier::Write(stream, mgr); plSingleModifier::Write(stream, mgr);
stream->WriteSwapScalar(fAmbientDist); stream->WriteLEScalar(fAmbientDist);
stream->WriteSwapScalar(fTransition); stream->WriteLEScalar(fTransition);
stream->WriteSwapScalar(fMaxSepDist); stream->WriteLEScalar(fMaxSepDist);
stream->WriteSwapScalar(fMinSepDist); stream->WriteLEScalar(fMinSepDist);
stream->WriteSwapScalar(fTanAng); stream->WriteLEScalar(fTanAng);
fInitPos.Write(stream); fInitPos.Write(stream);
} }

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

@ -64,23 +64,23 @@ plRandomSoundModGroup::~plRandomSoundModGroup()
void plRandomSoundModGroup::Read(hsStream *s) void plRandomSoundModGroup::Read(hsStream *s)
{ {
fNumSounds = s->ReadSwap16(); fNumSounds = s->ReadLE16();
fGroupedIdx = s->ReadSwap16(); fGroupedIdx = s->ReadLE16();
fIndices = TRACKED_NEW UInt16[fNumSounds]; fIndices = TRACKED_NEW UInt16[fNumSounds];
int i; int i;
for (i = 0; i < fNumSounds; i++) for (i = 0; i < fNumSounds; i++)
fIndices[i] = s->ReadSwap16(); fIndices[i] = s->ReadLE16();
} }
void plRandomSoundModGroup::Write(hsStream *s) void plRandomSoundModGroup::Write(hsStream *s)
{ {
s->WriteSwap16(fNumSounds); s->WriteLE16(fNumSounds);
s->WriteSwap16(fGroupedIdx); s->WriteLE16(fGroupedIdx);
int i; int i;
for (i = 0; i < fNumSounds; 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); plRandomCommandMod::Read(s, mgr);
fNumGroups = s->ReadSwap16(); fNumGroups = s->ReadLE16();
if (fNumGroups > 0) if (fNumGroups > 0)
{ {
fGroups = TRACKED_NEW plRandomSoundModGroup[fNumGroups]; fGroups = TRACKED_NEW plRandomSoundModGroup[fNumGroups];
@ -308,7 +308,7 @@ void plRandomSoundMod::Write(hsStream *s, hsResMgr *mgr)
{ {
plRandomCommandMod::Write(s, mgr); plRandomCommandMod::Write(s, mgr);
s->WriteSwap16(fNumGroups); s->WriteLE16(fNumGroups);
if (fNumGroups > 0) if (fNumGroups > 0)
{ {
int i; 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()); plgDispatch::Dispatch()->RegisterForExactType(plPlayerPageMsg::Index(), GetKey());
} }
fAccel = stream->ReadSwapFloat(); fAccel = stream->ReadLEFloat();
fDecel = stream->ReadSwapFloat(); fDecel = stream->ReadLEFloat();
fVelocity = stream->ReadSwapFloat(); fVelocity = stream->ReadLEFloat();
fPOAAccel = stream->ReadSwapFloat(); fPOAAccel = stream->ReadLEFloat();
fPOADecel = stream->ReadSwapFloat(); fPOADecel = stream->ReadLEFloat();
fPOAVelocity = stream->ReadSwapFloat(); fPOAVelocity = stream->ReadLEFloat();
fXPanLimit = stream->ReadSwapFloat(); fXPanLimit = stream->ReadLEFloat();
fZPanLimit = stream->ReadSwapFloat(); fZPanLimit = stream->ReadLEFloat();
fZoomRate = stream->ReadSwapFloat(); fZoomRate = stream->ReadLEFloat();
fZoomMin = stream->ReadSwapFloat(); fZoomMin = stream->ReadLEFloat();
fZoomMax = stream->ReadSwapFloat(); fZoomMax = stream->ReadLEFloat();
} }
@ -522,17 +522,17 @@ void plCameraBrain1::Write(hsStream* stream, hsResMgr* mgr)
mgr->WriteKey(stream, GetSubject()); mgr->WriteKey(stream, GetSubject());
mgr->WriteKey(stream, fRail); mgr->WriteKey(stream, fRail);
fFlags.Write(stream); fFlags.Write(stream);
stream->WriteSwapFloat(fAccel); stream->WriteLEFloat(fAccel);
stream->WriteSwapFloat(fDecel); stream->WriteLEFloat(fDecel);
stream->WriteSwapFloat(fVelocity); stream->WriteLEFloat(fVelocity);
stream->WriteSwapFloat(fPOAAccel); stream->WriteLEFloat(fPOAAccel);
stream->WriteSwapFloat(fPOADecel); stream->WriteLEFloat(fPOADecel);
stream->WriteSwapFloat(fPOAVelocity); stream->WriteLEFloat(fPOAVelocity);
stream->WriteSwapFloat(fXPanLimit); stream->WriteLEFloat(fXPanLimit);
stream->WriteSwapFloat(fZPanLimit); stream->WriteLEFloat(fZPanLimit);
stream->WriteSwapFloat(fZoomRate); stream->WriteLEFloat(fZoomRate);
stream->WriteSwapFloat(fZoomMin); stream->WriteLEFloat(fZoomMin);
stream->WriteSwapFloat(fZoomMax); stream->WriteLEFloat(fZoomMax);
} }
hsBool plCameraBrain1::MsgReceive(plMessage* msg) hsBool plCameraBrain1::MsgReceive(plMessage* msg)
{ {
@ -1759,18 +1759,18 @@ hsPoint3 plCameraBrain1_Circle::GetCenterPoint()
void plCameraBrain1_Circle::Write(hsStream* stream, hsResMgr* mgr) void plCameraBrain1_Circle::Write(hsStream* stream, hsResMgr* mgr)
{ {
plCameraBrain1::Write(stream, mgr); plCameraBrain1::Write(stream, mgr);
stream->WriteSwap32(GetCircleFlags()); stream->WriteLE32(GetCircleFlags());
fCenter.Write(stream); fCenter.Write(stream);
stream->WriteSwapScalar(GetRadius()); stream->WriteLEScalar(GetRadius());
mgr->WriteKey(stream, fCenterObject); mgr->WriteKey(stream, fCenterObject);
mgr->WriteKey(stream, fPOAObj); mgr->WriteKey(stream, fPOAObj);
stream->WriteSwapScalar(fCirPerSec); stream->WriteLEScalar(fCirPerSec);
} }
void plCameraBrain1_Circle::Read(hsStream* stream, hsResMgr* mgr) void plCameraBrain1_Circle::Read(hsStream* stream, hsResMgr* mgr)
{ {
plCameraBrain1::Read(stream, mgr); plCameraBrain1::Read(stream, mgr);
SetCircleFlags(stream->ReadSwap32()); SetCircleFlags(stream->ReadLE32());
if (GetCircleFlags() & kCircleLocalAvatar) if (GetCircleFlags() & kCircleLocalAvatar)
{ {
if (plNetClientApp::GetInstance() && plNetClientApp::GetInstance()->GetLocalPlayer()) if (plNetClientApp::GetInstance() && plNetClientApp::GetInstance()->GetLocalPlayer())
@ -1780,12 +1780,12 @@ void plCameraBrain1_Circle::Read(hsStream* stream, hsResMgr* mgr)
} }
fCenter.Read(stream); fCenter.Read(stream);
SetRadius(stream->ReadSwapScalar()); SetRadius(stream->ReadLEScalar());
plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kCircleTarget ); // SceneObject plGenRefMsg* msg = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kCircleTarget ); // SceneObject
mgr->ReadKeyNotifyMe( stream, msg, plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( stream, msg, plRefFlags::kActiveRef );
plGenRefMsg* msg2 = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnRequest, 0, kPOAObject ); // SceneObject plGenRefMsg* msg2 = TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnRequest, 0, kPOAObject ); // SceneObject
mgr->ReadKeyNotifyMe( stream, msg2, plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( stream, msg2, plRefFlags::kActiveRef );
fCirPerSec = stream->ReadSwapScalar(); fCirPerSec = stream->ReadLEScalar();
plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey()); 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); hsKeyedObject::Read(stream, mgr);
fBrain = nil; fBrain = nil;
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefBrain), plRefFlags::kActiveRef); mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kRefBrain), plRefFlags::kActiveRef);
int count = stream->ReadSwap32(); int count = stream->ReadLE32();
int i; int i;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
@ -332,12 +332,12 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr)
hsBool cutpos = stream->ReadBool(); hsBool cutpos = stream->ReadBool();
hsBool cutpoa = stream->ReadBool(); hsBool cutpoa = stream->ReadBool();
hsBool ignore = stream->ReadBool(); hsBool ignore = stream->ReadBool();
hsScalar v = stream->ReadSwapScalar(); hsScalar v = stream->ReadLEScalar();
hsScalar a = stream->ReadSwapScalar(); hsScalar a = stream->ReadLEScalar();
hsScalar d = stream->ReadSwapScalar(); hsScalar d = stream->ReadLEScalar();
hsScalar pV = stream->ReadSwapScalar(); hsScalar pV = stream->ReadLEScalar();
hsScalar pA = stream->ReadSwapScalar(); hsScalar pA = stream->ReadLEScalar();
hsScalar pD = stream->ReadSwapScalar(); hsScalar pD = stream->ReadLEScalar();
CamTrans* camTrans = TRACKED_NEW CamTrans(key); CamTrans* camTrans = TRACKED_NEW CamTrans(key);
camTrans->fAccel = a; camTrans->fAccel = a;
@ -352,9 +352,9 @@ void plCameraModifier1::Read(hsStream* stream, hsResMgr* mgr)
fTrans.Append(camTrans); fTrans.Append(camTrans);
} }
fFOVw = stream->ReadSwapFloat(); fFOVw = stream->ReadLEFloat();
fFOVh = stream->ReadSwapFloat(); fFOVh = stream->ReadLEFloat();
int n = stream->ReadSwap32(); int n = stream->ReadLE32();
fMessageQueue.SetCountAndZero(n); fMessageQueue.SetCountAndZero(n);
for(i = 0; i < n; i++ ) 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); mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, i, kRefCallbackMsg), plRefFlags::kActiveRef);
} }
n = stream->ReadSwap32(); n = stream->ReadLE32();
fFOVInstructions.SetCountAndZero(n); fFOVInstructions.SetCountAndZero(n);
for(i = 0; i < n; i++ ) for(i = 0; i < n; i++ )
{ {
@ -387,23 +387,23 @@ void plCameraModifier1::Write(hsStream* stream, hsResMgr* mgr)
mgr->WriteKey(stream, fBrain ); mgr->WriteKey(stream, fBrain );
int i = fTrans.Count(); int i = fTrans.Count();
stream->WriteSwap32(i); stream->WriteLE32(i);
for (i = 0; i < fTrans.Count(); i++) for (i = 0; i < fTrans.Count(); i++)
{ {
mgr->WriteKey(stream, fTrans[i]->fTransTo); mgr->WriteKey(stream, fTrans[i]->fTransTo);
stream->WriteBool(fTrans[i]->fCutPos); stream->WriteBool(fTrans[i]->fCutPos);
stream->WriteBool(fTrans[i]->fCutPOA); stream->WriteBool(fTrans[i]->fCutPOA);
stream->WriteBool(fTrans[i]->fIgnore); stream->WriteBool(fTrans[i]->fIgnore);
stream->WriteSwapScalar(fTrans[i]->fVelocity); stream->WriteLEScalar(fTrans[i]->fVelocity);
stream->WriteSwapScalar(fTrans[i]->fAccel); stream->WriteLEScalar(fTrans[i]->fAccel);
stream->WriteSwapScalar(fTrans[i]->fDecel); stream->WriteLEScalar(fTrans[i]->fDecel);
stream->WriteSwapScalar(fTrans[i]->fPOAVelocity); stream->WriteLEScalar(fTrans[i]->fPOAVelocity);
stream->WriteSwapScalar(fTrans[i]->fPOAAccel); stream->WriteLEScalar(fTrans[i]->fPOAAccel);
stream->WriteSwapScalar(fTrans[i]->fPOADecel); stream->WriteLEScalar(fTrans[i]->fPOADecel);
} }
stream->WriteSwapFloat(fFOVw); stream->WriteLEFloat(fFOVw);
stream->WriteSwapFloat(fFOVh); stream->WriteLEFloat(fFOVh);
stream->WriteSwap32(fMessageQueue.Count()); stream->WriteLE32(fMessageQueue.Count());
for (i = 0; i < fMessageQueue.Count(); i++) for (i = 0; i < fMessageQueue.Count(); i++)
{ {
mgr->WriteCreatable(stream, fMessageQueue[i]); mgr->WriteCreatable(stream, fMessageQueue[i]);
@ -412,7 +412,7 @@ void plCameraModifier1::Write(hsStream* stream, hsResMgr* mgr)
{ {
mgr->WriteKey(stream, fMessageQueue[i]->GetSender()); mgr->WriteKey(stream, fMessageQueue[i]->GetSender());
} }
stream->WriteSwap32(fFOVInstructions.Count()); stream->WriteLE32(fFOVInstructions.Count());
for (i = 0; i < fFOVInstructions.Count(); i++) for (i = 0; i < fFOVInstructions.Count(); i++)
{ {
mgr->WriteCreatable(stream, fFOVInstructions[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); plConditionalObject::Read(stream, mgr);
plCondRefMsg* refMsg; plCondRefMsg* refMsg;
int n = stream->ReadSwap32(); int n = stream->ReadLE32();
fChildren.SetCountAndZero(n); fChildren.SetCountAndZero(n);
for(int i = 0; i < n; i++ ) for(int i = 0; i < n; i++ )
{ {
@ -116,7 +116,7 @@ void plANDConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Write(stream, mgr); plConditionalObject::Write(stream, mgr);
stream->WriteSwap32(fChildren.GetCount()); stream->WriteLE32(fChildren.GetCount());
for( int i = 0; i < fChildren.GetCount(); i++ ) for( int i = 0; i < fChildren.GetCount(); i++ )
fChildren[i]->Write(stream, mgr); 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); plConditionalObject::Read(stream, mgr);
fActivators.Reset(); fActivators.Reset();
int n = stream->ReadSwap32(); int n = stream->ReadLE32();
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
fActivators.Append(mgr->ReadKey(stream)); fActivators.Append(mgr->ReadKey(stream));
} }
void plActivatorConditionalObject::Write(hsStream* stream, hsResMgr* mgr) void plActivatorConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Write(stream, mgr); plConditionalObject::Write(stream, mgr);
stream->WriteSwap32(fActivators.Count()); stream->WriteLE32(fActivators.Count());
for (int i = 0; i < fActivators.Count(); i++) for (int i = 0; i < fActivators.Count(); i++)
mgr->WriteKey(stream, fActivators[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); plConditionalObject::Read(stream, mgr);
fTarget = mgr->ReadKey(stream); fTarget = mgr->ReadKey(stream);
fAction = (CallbackEvent)stream->ReadSwap32(); fAction = (CallbackEvent)stream->ReadLE32();
} }
void plAnimationEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr) void plAnimationEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Write(stream, mgr); plConditionalObject::Write(stream, mgr);
mgr->WriteKey(stream, fTarget); 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) void plControlEventConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Read(stream, mgr); plConditionalObject::Read(stream, mgr);
fControlEvent = (ControlEventCode)stream->ReadSwap32(); fControlEvent = (ControlEventCode)stream->ReadLE32();
} }
void plControlEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr) void plControlEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Write(stream, 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) void plFacingConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Write(stream, mgr); plConditionalObject::Write(stream, mgr);
stream->WriteSwap(fTolerance); stream->WriteLE(fTolerance);
stream->WriteBool(fDirectional); stream->WriteBool(fDirectional);
} }
void plFacingConditionalObject::Read(hsStream* stream, hsResMgr* mgr) void plFacingConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Read(stream, mgr); plConditionalObject::Read(stream, mgr);
stream->ReadSwap(&fTolerance); stream->ReadLE(&fTolerance);
fDirectional = stream->ReadBool(); 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) void plKeyPressConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Read(stream, mgr); plConditionalObject::Read(stream, mgr);
fKeyEvent = (plKeyDef)stream->ReadSwap32(); fKeyEvent = (plKeyDef)stream->ReadLE32();
} }
void plKeyPressConditionalObject::Write(hsStream* stream, hsResMgr* mgr) void plKeyPressConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Write(stream, 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); plConditionalObject::Read(stream, mgr);
plCondRefMsg* refMsg; plCondRefMsg* refMsg;
int n = stream->ReadSwap32(); int n = stream->ReadLE32();
fChildren.SetCountAndZero(n); fChildren.SetCountAndZero(n);
for(int i = 0; i < n; i++ ) for(int i = 0; i < n; i++ )
{ {
@ -121,7 +121,7 @@ void plORConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Write(stream, mgr); plConditionalObject::Write(stream, mgr);
stream->WriteSwap32(fChildren.GetCount()); stream->WriteLE32(fChildren.GetCount());
for( int i = 0; i < fChildren.GetCount(); i++ ) for( int i = 0; i < fChildren.GetCount(); i++ )
mgr->WriteKey(stream, fChildren[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) void plVolumeSensorConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Read(stream, mgr); plConditionalObject::Read(stream, mgr);
fTrigNum = stream->ReadSwap32(); fTrigNum = stream->ReadLE32();
fType = stream->ReadSwap32(); fType = stream->ReadLE32();
fFirst = stream->ReadBool(); fFirst = stream->ReadBool();
} }
void plVolumeSensorConditionalObject::Write(hsStream* stream, hsResMgr* mgr) void plVolumeSensorConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
plConditionalObject::Write(stream, mgr); plConditionalObject::Write(stream, mgr);
stream->WriteSwap32(fTrigNum); stream->WriteLE32(fTrigNum);
stream->WriteSwap32(fType); stream->WriteLE32(fType);
stream->WriteBool(fFirst); stream->WriteBool(fFirst);
} }
#include "pnMessage/plPlayerPageMsg.h" #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); pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset(); fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32(); UInt32 i, count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString(); fAnimName = s->ReadSafeString();
fMouseOverAnimKeys.Reset(); fMouseOverAnimKeys.Reset();
count = s->ReadSwap32(); count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fMouseOverAnimKeys.Append( mgr->ReadKey( s ) ); fMouseOverAnimKeys.Append( mgr->ReadKey( s ) );
fMouseOverAnimName = s->ReadSafeString(); fMouseOverAnimName = s->ReadSafeString();
fNotifyType = s->ReadSwap32(); fNotifyType = s->ReadLE32();
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef ); 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 ); pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount(); UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count ); s->WriteLE32( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] ); mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName ); s->WriteSafeString( fAnimName );
count = fMouseOverAnimKeys.GetCount(); count = fMouseOverAnimKeys.GetCount();
s->WriteSwap32( count ); s->WriteLE32( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->WriteKey( s, fMouseOverAnimKeys[ i ] ); mgr->WriteKey( s, fMouseOverAnimKeys[ i ] );
s->WriteSafeString( fMouseOverAnimName ); s->WriteSafeString( fMouseOverAnimName );
s->WriteSwap32( fNotifyType ); s->WriteLE32( fNotifyType );
mgr->WriteKey( s, fDraggable != nil ? fDraggable->GetKey() : nil ); 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); pfGUIControlMod::Read(s, mgr);
fAnimationKeys.Reset(); fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32(); UInt32 i, count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimationKeys.Append( mgr->ReadKey( s ) );
@ -111,7 +111,7 @@ void pfGUICheckBoxCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr ); pfGUIControlMod::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount(); UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count ); s->WriteLE32( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ 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 ) if( obj != nil )
{ {
s->WriteSwap32( obj->fType ); s->WriteLE32( obj->fType );
obj->IWrite( s ); obj->IWrite( s );
} }
else else
s->WriteSwap32( kNull ); s->WriteLE32( kNull );
} }
pfGUICtrlProcWriteableObject *pfGUICtrlProcWriteableObject::Read( hsStream *s ) pfGUICtrlProcWriteableObject *pfGUICtrlProcWriteableObject::Read( hsStream *s )
{ {
pfGUICtrlProcWriteableObject *obj; pfGUICtrlProcWriteableObject *obj;
UInt32 type = s->ReadSwap32(); UInt32 type = s->ReadLE32();
switch( type ) switch( type )
{ {
@ -125,7 +125,7 @@ pfGUIConsoleCmdProc::~pfGUIConsoleCmdProc()
void pfGUIConsoleCmdProc::IRead( hsStream *s ) void pfGUIConsoleCmdProc::IRead( hsStream *s )
{ {
int i = s->ReadSwap32(); int i = s->ReadLE32();
if( i > 0 ) if( i > 0 )
{ {
fCommand = TRACKED_NEW char[ i + 1 ]; fCommand = TRACKED_NEW char[ i + 1 ];
@ -140,11 +140,11 @@ void pfGUIConsoleCmdProc::IWrite( hsStream *s )
{ {
if( fCommand != nil ) if( fCommand != nil )
{ {
s->WriteSwap32( strlen( fCommand ) ); s->WriteLE32( strlen( fCommand ) );
s->Write( strlen( fCommand ), fCommand ); s->Write( strlen( fCommand ), fCommand );
} }
else else
s->WriteSwap32( 0 ); s->WriteLE32( 0 );
} }
void pfGUIConsoleCmdProc::DoSomething( pfGUIControlMod *ctrl ) void pfGUIConsoleCmdProc::DoSomething( pfGUIControlMod *ctrl )

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

@ -127,12 +127,12 @@ void pfGUIColorScheme::Read( hsStream *s )
fBackColor.Read( s ); fBackColor.Read( s );
fSelForeColor.Read( s ); fSelForeColor.Read( s );
fSelBackColor.Read( s ); fSelBackColor.Read( s );
s->ReadSwap( &fTransparent ); s->ReadLE( &fTransparent );
delete [] fFontFace; delete [] fFontFace;
fFontFace = s->ReadSafeString(); fFontFace = s->ReadSafeString();
s->ReadSwap( &fFontSize ); s->ReadLE( &fFontSize );
s->ReadSwap( &fFontFlags ); s->ReadLE( &fFontFlags );
} }
void pfGUIColorScheme::Write( hsStream *s ) void pfGUIColorScheme::Write( hsStream *s )
@ -141,11 +141,11 @@ void pfGUIColorScheme::Write( hsStream *s )
fBackColor.Write( s ); fBackColor.Write( s );
fSelForeColor.Write( s ); fSelForeColor.Write( s );
fSelBackColor.Write( s ); fSelBackColor.Write( s );
s->WriteSwap( fTransparent ); s->WriteLE( fTransparent );
s->WriteSafeString( fFontFace ); s->WriteSafeString( fFontFace );
s->WriteSwap( fFontSize ); s->WriteLE( fFontSize );
s->WriteSwap( fFontFlags ); s->WriteLE( fFontFlags );
} }
//// Constructor/Destructor ////////////////////////////////////////////////// //// Constructor/Destructor //////////////////////////////////////////////////
@ -809,7 +809,7 @@ void pfGUIControlMod::Refresh( void )
void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr ) void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr )
{ {
plSingleModifier::Read(s, mgr); plSingleModifier::Read(s, mgr);
s->ReadSwap( &fTagID ); s->ReadLE( &fTagID );
fVisible = s->ReadBool(); fVisible = s->ReadBool();
// Read the handler in // Read the handler in
@ -842,7 +842,7 @@ void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr )
{ {
fSoundIndices.SetCountAndZero( count ); fSoundIndices.SetCountAndZero( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fSoundIndices[ i ] = (int)s->ReadSwap32(); fSoundIndices[ i ] = (int)s->ReadLE32();
} }
if( HasFlag( kHasProxy ) ) if( HasFlag( kHasProxy ) )
@ -857,7 +857,7 @@ void pfGUIControlMod::Write( hsStream *s, hsResMgr *mgr )
ClearFlag( kHasProxy ); ClearFlag( kHasProxy );
plSingleModifier::Write( s, mgr ); plSingleModifier::Write( s, mgr );
s->WriteSwap( fTagID ); s->WriteLE( fTagID );
s->WriteBool( fVisible ); s->WriteBool( fVisible );
// Write the handler out (if it's not a writeable, damn you) // 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() ); s->WriteByte( fSoundIndices.GetCount() );
UInt8 i; UInt8 i;
for( i = 0; i < fSoundIndices.GetCount(); i++ ) for( i = 0; i < fSoundIndices.GetCount(); i++ )
s->WriteSwap32( fSoundIndices[ i ] ); s->WriteLE32( fSoundIndices[ i ] );
if( HasFlag( kHasProxy ) ) if( HasFlag( kHasProxy ) )
mgr->WriteKey( s, fProxy->GetKey() ); 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 ); s->Read( sizeof( fName ), fName );
UInt32 i, count = s->ReadSwap32(); UInt32 i, count = s->ReadLE32();
fControls.SetCountAndZero( count ); fControls.SetCountAndZero( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kControlRef ), plRefFlags::kActiveRef ); 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 ); hsgResMgr::ResMgr()->AddViaNotify( GetKey(), refMsg, plRefFlags::kPassiveRef );
} }
s->ReadSwap( &fTagID ); s->ReadLE( &fTagID );
fProcReceiver = mgr->ReadKey( s ); fProcReceiver = mgr->ReadKey( s );
if( fProcReceiver != nil ) if( fProcReceiver != nil )
SetHandler( TRACKED_NEW pfGUIDialogNotifyProc( fProcReceiver ) ); SetHandler( TRACKED_NEW pfGUIDialogNotifyProc( fProcReceiver ) );
s->ReadSwap( &fVersion ); s->ReadLE( &fVersion );
fColorScheme->Read( s ); fColorScheme->Read( s );
@ -333,15 +333,15 @@ void pfGUIDialogMod::Write( hsStream *s, hsResMgr *mgr )
mgr->WriteKey( s, fRenderMod->GetKey() ); mgr->WriteKey( s, fRenderMod->GetKey() );
s->Write( sizeof( fName ), fName ); s->Write( sizeof( fName ), fName );
s->WriteSwap32( fControls.GetCount() ); s->WriteLE32( fControls.GetCount() );
for( i = 0; i < fControls.GetCount(); i++ ) for( i = 0; i < fControls.GetCount(); i++ )
mgr->WriteKey( s, fControls[ i ]->GetKey() ); mgr->WriteKey( s, fControls[ i ]->GetKey() );
s->WriteSwap( fTagID ); s->WriteLE( fTagID );
mgr->WriteKey( s, fProcReceiver ); mgr->WriteKey( s, fProcReceiver );
s->WriteSwap( fVersion ); s->WriteLE( fVersion );
fColorScheme->Write( s ); 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); pfGUIControlMod::Read(s, mgr);
count = s->ReadSwap32(); count = s->ReadLE32();
fTextMaps.SetCountAndZero( count ); fTextMaps.SetCountAndZero( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefTextMap ), plRefFlags::kActiveRef );
count = s->ReadSwap32(); count = s->ReadLE32();
fLayers.SetCountAndZero( count ); fLayers.SetCountAndZero( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefLayer ), plRefFlags::kActiveRef );
count = s->ReadSwap32(); count = s->ReadLE32();
fMaterials.SetCountAndZero( count ); fMaterials.SetCountAndZero( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, i, kRefMaterial ), plRefFlags::kActiveRef ); 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 ); pfGUIControlMod::Write( s, mgr );
s->WriteSwap32( fTextMaps.GetCount() ); s->WriteLE32( fTextMaps.GetCount() );
for( i = 0; i < fTextMaps.GetCount(); i++ ) for( i = 0; i < fTextMaps.GetCount(); i++ )
mgr->WriteKey( s, fTextMaps[ i ]->GetKey() ); mgr->WriteKey( s, fTextMaps[ i ]->GetKey() );
s->WriteSwap32( fLayers.GetCount() ); s->WriteLE32( fLayers.GetCount() );
for( i = 0; i < fLayers.GetCount(); i++ ) for( i = 0; i < fLayers.GetCount(); i++ )
mgr->WriteKey( s, fLayers[ i ]->GetKey() ); mgr->WriteKey( s, fLayers[ i ]->GetKey() );
s->WriteSwap32( fMaterials.GetCount() ); s->WriteLE32( fMaterials.GetCount() );
for( i = 0; i < fMaterials.GetCount(); i++ ) for( i = 0; i < fMaterials.GetCount(); i++ )
mgr->WriteKey( s, fMaterials[ i ]->GetKey() ); 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); pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset(); fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32(); UInt32 i, count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString(); fAnimName = s->ReadSafeString();
@ -125,7 +125,7 @@ void pfGUIKnobCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIValueCtrl::Write( s, mgr ); pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount(); UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count ); s->WriteLE32( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] ); mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName ); 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; fOriginX = fOriginY = -1.f;
fMargin = s->ReadSwap16(); fMargin = s->ReadLE16();
UInt32 i, count = s->ReadSwap32(); UInt32 i, count = s->ReadLE32();
fMenuItems.SetCountAndZero( count ); fMenuItems.SetCountAndZero( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
{ {
@ -271,9 +271,9 @@ void pfGUIPopUpMenu::Write( hsStream *s, hsResMgr *mgr )
pfGUIDialogMod::Write( s, mgr ); pfGUIDialogMod::Write( s, mgr );
s->WriteSwap16( fMargin ); s->WriteLE16( fMargin );
s->WriteSwap32( fMenuItems.GetCount() ); s->WriteLE32( fMenuItems.GetCount() );
UInt32 i; UInt32 i;
for( i = 0; i < fMenuItems.GetCount(); i++ ) for( i = 0; i < fMenuItems.GetCount(); i++ )
{ {
@ -892,11 +892,11 @@ void pfGUISkin::Read( hsStream *s, hsResMgr *mgr )
{ {
hsKeyedObject::Read( s, mgr ); hsKeyedObject::Read( s, mgr );
s->ReadSwap( &fItemMargin ); s->ReadLE( &fItemMargin );
s->ReadSwap( &fBorderMargin ); s->ReadLE( &fBorderMargin );
UInt32 i, count; UInt32 i, count;
s->ReadSwap( &count ); s->ReadLE( &count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fElements[ i ].Read( s ); fElements[ i ].Read( s );
@ -911,11 +911,11 @@ void pfGUISkin::Write( hsStream *s, hsResMgr *mgr )
{ {
hsKeyedObject::Write( s, mgr ); hsKeyedObject::Write( s, mgr );
s->WriteSwap( fItemMargin ); s->WriteLE( fItemMargin );
s->WriteSwap( fBorderMargin ); s->WriteLE( fBorderMargin );
UInt32 i = kNumElements; UInt32 i = kNumElements;
s->WriteSwap( i ); s->WriteLE( i );
for( i = 0; i < kNumElements; i++ ) for( i = 0; i < kNumElements; i++ )
fElements[ i ].Write( s ); fElements[ i ].Write( s );
@ -941,16 +941,16 @@ hsBool pfGUISkin::MsgReceive( plMessage *msg )
void pfGUISkin::pfSRect::Read( hsStream *s ) void pfGUISkin::pfSRect::Read( hsStream *s )
{ {
s->ReadSwap( &fX ); s->ReadLE( &fX );
s->ReadSwap( &fY ); s->ReadLE( &fY );
s->ReadSwap( &fWidth ); s->ReadLE( &fWidth );
s->ReadSwap( &fHeight ); s->ReadLE( &fHeight );
} }
void pfGUISkin::pfSRect::Write( hsStream *s ) void pfGUISkin::pfSRect::Write( hsStream *s )
{ {
s->WriteSwap( fX ); s->WriteLE( fX );
s->WriteSwap( fY ); s->WriteLE( fY );
s->WriteSwap( fWidth ); s->WriteLE( fWidth );
s->WriteSwap( fHeight ); 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); pfGUIValueCtrl::Read(s, mgr);
fAnimationKeys.Reset(); fAnimationKeys.Reset();
UInt32 i, count = s->ReadSwap32(); UInt32 i, count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString(); fAnimName = s->ReadSafeString();
@ -124,7 +124,7 @@ void pfGUIProgressCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIValueCtrl::Write( s, mgr ); pfGUIValueCtrl::Write( s, mgr );
UInt32 i, count = fAnimationKeys.GetCount(); UInt32 i, count = fAnimationKeys.GetCount();
s->WriteSwap32( count ); s->WriteLE32( count );
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
mgr->WriteKey( s, fAnimationKeys[ i ] ); mgr->WriteKey( s, fAnimationKeys[ i ] );
s->WriteSafeString( fAnimName ); 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); pfGUIControlMod::Read(s, mgr);
UInt32 i, count = s->ReadSwap32(); UInt32 i, count = s->ReadLE32();
fControls.SetCountAndZero( count ); fControls.SetCountAndZero( count );
for( i = 0; i < count; i++ ) 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 ); 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 ) if( fValue != -1 && fControls[ fValue ] != nil )
fControls[ fValue ]->SetChecked( true ); fControls[ fValue ]->SetChecked( true );
} }
@ -195,11 +195,11 @@ void pfGUIRadioGroupCtrl::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr ); pfGUIControlMod::Write( s, mgr );
s->WriteSwap32( fControls.GetCount() ); s->WriteLE32( fControls.GetCount() );
for( i = 0; i < fControls.GetCount(); i++ ) for( i = 0; i < fControls.GetCount(); i++ )
mgr->WriteKey( s, fControls[ i ]->GetKey() ); mgr->WriteKey( s, fControls[ i ]->GetKey() );
s->WriteSwap16( (UInt16)fDefaultValue ); s->WriteLE16( (UInt16)fDefaultValue );
} }
//// SetValue //////////////////////////////////////////////////////////////// //// SetValue ////////////////////////////////////////////////////////////////

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

@ -154,7 +154,7 @@ void pfGUITextBoxMod::Read( hsStream *s, hsResMgr *mgr )
{ {
pfGUIControlMod::Read(s, mgr); pfGUIControlMod::Read(s, mgr);
UInt32 len = s->ReadSwap32(); UInt32 len = s->ReadLE32();
if( len > 0 ) if( len > 0 )
{ {
char *text = TRACKED_NEW char[ len + 1 ]; char *text = TRACKED_NEW char[ len + 1 ];
@ -181,11 +181,11 @@ void pfGUITextBoxMod::Write( hsStream *s, hsResMgr *mgr )
pfGUIControlMod::Write( s, mgr ); pfGUIControlMod::Write( s, mgr );
if( fText == nil ) if( fText == nil )
s->WriteSwap32( 0 ); s->WriteLE32( 0 );
else else
{ {
char *text = hsWStringToString(fText); char *text = hsWStringToString(fText);
s->WriteSwap32( strlen( text ) ); s->WriteLE32( strlen( text ) );
s->Write( strlen( text ), text ); s->Write( strlen( text ), text );
delete [] 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, kRefUpControl ), plRefFlags::kActiveRef );
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDownControl ), plRefFlags::kActiveRef );
s->ReadSwap( &fMin ); s->ReadLE( &fMin );
s->ReadSwap( &fMax ); s->ReadLE( &fMax );
s->ReadSwap( &fStep ); s->ReadLE( &fStep );
fValue = fMin; fValue = fMin;
} }
@ -222,9 +222,9 @@ void pfGUIUpDownPairMod::Write( hsStream *s, hsResMgr *mgr )
mgr->WriteKey( s, fUpControl->GetKey() ); mgr->WriteKey( s, fUpControl->GetKey() );
mgr->WriteKey( s, fDownControl->GetKey() ); mgr->WriteKey( s, fDownControl->GetKey() );
s->WriteSwap( fMin ); s->WriteLE( fMin );
s->WriteSwap( fMax ); s->WriteLE( fMax );
s->WriteSwap( fStep ); 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); pfGUIControlMod::Read(s, mgr);
s->ReadSwap( &fMin ); s->ReadLE( &fMin );
s->ReadSwap( &fMax ); s->ReadLE( &fMax );
s->ReadSwap( &fStep ); s->ReadLE( &fStep );
fValue = fMin; fValue = fMin;
} }
@ -104,8 +104,8 @@ void pfGUIValueCtrl::Write( hsStream *s, hsResMgr *mgr )
{ {
pfGUIControlMod::Write( s, mgr ); pfGUIControlMod::Write( s, mgr );
s->WriteSwap( fMin ); s->WriteLE( fMin );
s->WriteSwap( fMax ); s->WriteLE( fMax );
s->WriteSwap( fStep ); s->WriteLE( fStep );
} }

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

@ -126,14 +126,14 @@ public:
{ {
plMessage::IMsgRead(stream, mgr); plMessage::IMsgRead(stream, mgr);
fControlKey = mgr->ReadKey(stream); fControlKey = mgr->ReadKey(stream);
fEvent = stream->ReadSwap32(); fEvent = stream->ReadLE32();
} }
void Write(hsStream* stream, hsResMgr* mgr) void Write(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgWrite(stream, mgr); plMessage::IMsgWrite(stream, mgr);
mgr->WriteKey(stream, fControlKey); 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) virtual void Read(hsStream* s, hsResMgr* mgr)
{ {
plMessage::IMsgRead( s, mgr ); plMessage::IMsgRead( s, mgr );
s->ReadSwap( &fCommand ); s->ReadLE( &fCommand );
s->Read( sizeof( fString ), fString ); s->Read( sizeof( fString ), fString );
fAge = s->ReadSafeString(); fAge = s->ReadSafeString();
} }
@ -86,7 +86,7 @@ class pfGameGUIMsg : public plMessage
virtual void Write(hsStream* s, hsResMgr* mgr) virtual void Write(hsStream* s, hsResMgr* mgr)
{ {
plMessage::IMsgWrite( s, mgr ); plMessage::IMsgWrite( s, mgr );
s->WriteSwap( fCommand ); s->WriteLE( fCommand );
s->Write( sizeof( fString ), fString ); s->Write( sizeof( fString ), fString );
s->WriteSafeString( fAge ); 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) virtual void Read(hsStream* s, hsResMgr* mgr)
{ {
plMessage::IMsgRead( s, mgr ); plMessage::IMsgRead( s, mgr );
s->ReadSwap( &fCommand ); s->ReadLE( &fCommand );
fUser = s->ReadSafeString(); fUser = s->ReadSafeString();
fPlayerID = s->ReadSwap32(); fPlayerID = s->ReadLE32();
wchar_t *temp = s->ReadSafeWString(); wchar_t *temp = s->ReadSafeWString();
if (temp) // apparently ReadSafeWString can return null, which std::wstring doesn't like being assigned 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""; fString = L"";
delete [] temp; delete [] temp;
fFlags = s->ReadSwap32(); fFlags = s->ReadLE32();
fDelay = s->ReadSwapScalar(); fDelay = s->ReadLEScalar();
fValue = s->ReadSwap32(); fValue = s->ReadLE32();
} }
virtual void Write(hsStream* s, hsResMgr* mgr) virtual void Write(hsStream* s, hsResMgr* mgr)
{ {
plMessage::IMsgWrite( s, mgr ); plMessage::IMsgWrite( s, mgr );
s->WriteSwap( fCommand ); s->WriteLE( fCommand );
s->WriteSafeString( fUser ); s->WriteSafeString( fUser );
s->WriteSwap32( fPlayerID ); s->WriteLE32( fPlayerID );
s->WriteSafeWString( fString.c_str() ); s->WriteSafeWString( fString.c_str() );
s->WriteSwap32( fFlags ); s->WriteLE32( fFlags );
s->WriteSwapScalar(fDelay); s->WriteLEScalar(fDelay);
s->WriteSwap32( fValue ); s->WriteLE32( fValue );
} }
UInt8 GetCommand( void ) const { return fCommand; } 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(); fType = (Type)stream->ReadByte();
if (fType == kMarkerCaptured) if (fType == kMarkerCaptured)
fMarkerID = stream->ReadSwap32(); fMarkerID = stream->ReadLE32();
} }
void pfMarkerMsg::Write(hsStream* stream, hsResMgr* mgr) void pfMarkerMsg::Write(hsStream* stream, hsResMgr* mgr)
@ -72,7 +72,7 @@ void pfMarkerMsg::Write(hsStream* stream, hsResMgr* mgr)
stream->WriteByte(fType); stream->WriteByte(fType);
if (fType == kMarkerCaptured) if (fType == kMarkerCaptured)
stream->WriteSwap32(fMarkerID); stream->WriteLE32(fMarkerID);
} }
void pfMarkerMsg::PrintDebug(char* buf) 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); plMessage::IMsgRead(stream, mgr);
fCommands = stream->ReadSwap32(); fCommands = stream->ReadLE32();
if (stream->ReadBool()) if (stream->ReadBool())
fItemKey = mgr->ReadKey(stream); fItemKey = mgr->ReadKey(stream);
fColor.Read(stream); fColor.Read(stream);
fLayer = stream->ReadByte(); fLayer = stream->ReadByte();
fDelta = stream->ReadByte(); fDelta = stream->ReadByte();
fWeight = stream->ReadSwapScalar(); fWeight = stream->ReadLEScalar();
} }
void plClothingMsg::Write(hsStream* stream, hsResMgr* mgr) void plClothingMsg::Write(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgWrite(stream, mgr); plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap32(fCommands); stream->WriteLE32(fCommands);
stream->WriteBool(fItemKey != nil); stream->WriteBool(fItemKey != nil);
if (fItemKey) if (fItemKey)
mgr->WriteKey(stream, fItemKey); mgr->WriteKey(stream, fItemKey);
fColor.Write(stream); fColor.Write(stream);
stream->WriteByte(fLayer); stream->WriteByte(fLayer);
stream->WriteByte(fDelta); stream->WriteByte(fDelta);
stream->WriteSwapScalar(fWeight); stream->WriteLEScalar(fWeight);
} }
enum ClothingFlags enum ClothingFlags
@ -85,7 +85,7 @@ void plClothingMsg::ReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s); contentFlags.Read(s);
if (contentFlags.IsBitSet(kClothingCommands)) if (contentFlags.IsBitSet(kClothingCommands))
fCommands = s->ReadSwap32(); fCommands = s->ReadLE32();
if (contentFlags.IsBitSet(kClothingItemKey)) if (contentFlags.IsBitSet(kClothingItemKey))
{ {
if (s->ReadBool()) if (s->ReadBool())
@ -106,7 +106,7 @@ void plClothingMsg::WriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s); contentFlags.Write(s);
// kClothingCommands // kClothingCommands
s->WriteSwap32(fCommands); s->WriteLE32(fCommands);
// kClothingItemKey // kClothingItemKey
s->WriteBool(fItemKey != nil); s->WriteBool(fItemKey != nil);
if (fItemKey) if (fItemKey)

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

@ -2301,10 +2301,10 @@ public:
if ( ageInfoStream && nPlayersStream ) if ( ageInfoStream && nPlayersStream )
{ {
UInt16 nAgeInfoEntries; UInt16 nAgeInfoEntries;
ageInfoStream->GetStream()->ReadSwap( &nAgeInfoEntries ); ageInfoStream->GetStream()->ReadLE( &nAgeInfoEntries );
UInt16 nPlayerCountEntries; UInt16 nPlayerCountEntries;
nPlayersStream->GetStream()->ReadSwap( &nPlayerCountEntries ); nPlayersStream->GetStream()->ReadLE( &nPlayerCountEntries );
hsAssert( nAgeInfoEntries==nPlayerCountEntries, "huh?" ); hsAssert( nAgeInfoEntries==nPlayerCountEntries, "huh?" );
@ -2316,7 +2316,7 @@ public:
plAgeInfoStruct ageInfo; plAgeInfoStruct ageInfo;
UInt32 nPlayers; UInt32 nPlayers;
ageInfo.Read( ageInfoStream->GetStream(), nil ); ageInfo.Read( ageInfoStream->GetStream(), nil );
nPlayersStream->GetStream()->ReadSwap( &nPlayers ); nPlayersStream->GetStream()->ReadLE( &nPlayers );
PyObject* t = PyTuple_New(2); PyObject* t = PyTuple_New(2);
PyTuple_SetItem(t, 0, pyAgeInfoStruct::New(&ageInfo)); PyTuple_SetItem(t, 0, pyAgeInfoStruct::New(&ageInfo));
PyTuple_SetItem(t, 1, PyLong_FromUnsignedLong(nPlayers)); 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(); fPythonFile = stream->ReadSafeString();
// then read in the list of receivers that want to be notified // then read in the list of receivers that want to be notified
int nRcvs = stream->ReadSwap32(); int nRcvs = stream->ReadLE32();
fReceivers.Reset(); fReceivers.Reset();
int m; int m;
for( m=0; m<nRcvs; 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 // then read in the list of parameters
int nParms = stream->ReadSwap32(); int nParms = stream->ReadLE32();
fParameters.SetCountAndZero(nParms); fParameters.SetCountAndZero(nParms);
int i; int i;
for( i=0; i<nParms; i++ ) for( i=0; i<nParms; i++ )
@ -2969,13 +2969,13 @@ void plPythonFileMod::Write(hsStream* stream, hsResMgr* mgr)
stream->WriteSafeString(fPythonFile); stream->WriteSafeString(fPythonFile);
// then write out the list of receivers that want to be notified // then write out the list of receivers that want to be notified
stream->WriteSwap32(fReceivers.GetCount()); stream->WriteLE32(fReceivers.GetCount());
int m; int m;
for( m=0; m<fReceivers.GetCount(); m++ ) for( m=0; m<fReceivers.GetCount(); m++ )
mgr->WriteKey(stream, fReceivers[m]); mgr->WriteKey(stream, fReceivers[m]);
// then write out the list of parameters // then write out the list of parameters
stream->WriteSwap32(fParameters.GetCount()); stream->WriteLE32(fParameters.GetCount());
int i; int i;
for( i=0; i<fParameters.GetCount(); i++ ) for( i=0; i<fParameters.GetCount(); i++ )
fParameters[i].Write(stream,mgr); fParameters[i].Write(stream,mgr);

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

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

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

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

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

@ -186,7 +186,7 @@ void plDistOpacityMod::Read(hsStream* s, hsResMgr* mgr)
int i; int i;
for( i = 0; i < kNumDists; i++ ) for( i = 0; i < kNumDists; i++ )
fDists[i] = s->ReadSwapScalar(); fDists[i] = s->ReadLEScalar();
ICheckDists(); ICheckDists();
@ -199,7 +199,7 @@ void plDistOpacityMod::Write(hsStream* s, hsResMgr* mgr)
int i; int i;
for( i = 0; i < kNumDists; i++ ) for( i = 0; i < kNumDists; i++ )
s->WriteSwapScalar(fDists[i]); s->WriteLEScalar(fDists[i]);
} }
void plDistOpacityMod::SetTarget(plSceneObject* so) 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); plLayerInterface::Read(s, mgr);
fOpScale = s->ReadSwapScalar(); fOpScale = s->ReadLEScalar();
} }
void plFadeOpacityLay::Write(hsStream* s, hsResMgr* mgr) void plFadeOpacityLay::Write(hsStream* s, hsResMgr* mgr)
{ {
plLayerInterface::Write(s, 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); plSingleModifier::Read(s, mgr);
fFadeUp = s->ReadSwapScalar(); fFadeUp = s->ReadLEScalar();
fFadeDown = s->ReadSwapScalar(); fFadeDown = s->ReadLEScalar();
} }
void plFadeOpacityMod::Write(hsStream* s, hsResMgr* mgr) void plFadeOpacityMod::Write(hsStream* s, hsResMgr* mgr)
{ {
plSingleModifier::Write(s, mgr); plSingleModifier::Write(s, mgr);
s->WriteSwapScalar(fFadeUp); s->WriteLEScalar(fFadeUp);
s->WriteSwapScalar(fFadeDown); s->WriteLEScalar(fFadeDown);
} }
void plFadeOpacityMod::SetTarget(plSceneObject* so) 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); plLayerAnimation::Read(s, mgr);
delete [] fMovieName; delete [] fMovieName;
int len = s->ReadSwap32(); int len = s->ReadLE32();
if( len ) if( len )
{ {
fMovieName = TRACKED_NEW char[len+1]; fMovieName = TRACKED_NEW char[len+1];
@ -204,7 +204,7 @@ void plLayerMovie::Write(hsStream* s, hsResMgr* mgr)
plLayerAnimation::Write(s, mgr); plLayerAnimation::Write(s, mgr);
int len = hsStrlen(fMovieName); int len = hsStrlen(fMovieName);
s->WriteSwap32(len); s->WriteLE32(len);
if( len ) if( len )
s->Write(len, fMovieName); s->Write(len, fMovieName);
} }

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

@ -7,20 +7,20 @@
void hsGMatState::Read(hsStream* s) void hsGMatState::Read(hsStream* s)
{ {
fBlendFlags = s->ReadSwap32(); fBlendFlags = s->ReadLE32();
fClampFlags = s->ReadSwap32(); fClampFlags = s->ReadLE32();
fShadeFlags = s->ReadSwap32(); fShadeFlags = s->ReadLE32();
fZFlags = s->ReadSwap32(); fZFlags = s->ReadLE32();
fMiscFlags = s->ReadSwap32(); fMiscFlags = s->ReadLE32();
} }
void hsGMatState::Write(hsStream* s) void hsGMatState::Write(hsStream* s)
{ {
s->WriteSwap32(fBlendFlags); s->WriteLE32(fBlendFlags);
s->WriteSwap32(fClampFlags); s->WriteLE32(fClampFlags);
s->WriteSwap32(fShadeFlags); s->WriteLE32(fShadeFlags);
s->WriteSwap32(fZFlags); s->WriteLE32(fZFlags);
s->WriteSwap32(fMiscFlags); s->WriteLE32(fMiscFlags);
} }
void hsGMatState::Clear(const hsGMatState& state) 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) void plKeyImp::Read(hsStream* s)
{ {
fUoid.Read(s); fUoid.Read(s);
s->ReadSwap(&fStartPos); s->ReadLE(&fStartPos);
s->ReadSwap(&fDataLen); s->ReadLE(&fDataLen);
plProfile_NewMem(KeyMem, CalcKeySize(this)); plProfile_NewMem(KeyMem, CalcKeySize(this));
@ -204,15 +204,15 @@ void plKeyImp::SkipRead(hsStream* s)
{ {
plUoid tempUoid; plUoid tempUoid;
tempUoid.Read(s); tempUoid.Read(s);
s->ReadSwap32(); s->ReadLE32();
s->ReadSwap32(); s->ReadLE32();
} }
void plKeyImp::Write(hsStream* s) void plKeyImp::Write(hsStream* s)
{ {
fUoid.Write(s); fUoid.Write(s);
s->WriteSwap(fStartPos); s->WriteLE(fStartPos);
s->WriteSwap(fDataLen); s->WriteLE(fDataLen);
if (fStartPos == (UInt32)-1) if (fStartPos == (UInt32)-1)
int foo = 0; 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); hsKeyedObject::Read(s, mgr);
int numKeys = s->ReadSwap32(); int numKeys = s->ReadLE32();
fForwardKeys.Reset(); fForwardKeys.Reset();
fForwardKeys.Expand(numKeys); fForwardKeys.Expand(numKeys);
fForwardKeys.SetCount(numKeys); fForwardKeys.SetCount(numKeys);
@ -91,7 +91,7 @@ void plMsgForwarder::Write(hsStream* s, hsResMgr* mgr)
hsKeyedObject::Write(s, mgr); hsKeyedObject::Write(s, mgr);
int numKeys = fForwardKeys.Count(); int numKeys = fForwardKeys.Count();
s->WriteSwap32(numKeys); s->WriteLE32(numKeys);
for (int i = 0; i < numKeys; i++) for (int i = 0; i < numKeys; i++)
mgr->WriteKey(s, fForwardKeys[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) void plLocation::Read(hsStream* s)
{ {
s->LogReadSwap(&fSequenceNumber, "Location Sequence Number"); s->LogReadLE(&fSequenceNumber, "Location Sequence Number");
s->LogReadSwap(&fFlags, "Location Flags"); s->LogReadLE(&fFlags, "Location Flags");
} }
void plLocation::Write(hsStream* s) const void plLocation::Write(hsStream* s) const
{ {
s->WriteSwap(fSequenceNumber); s->WriteLE(fSequenceNumber);
s->WriteSwap(fFlags); s->WriteLE(fFlags);
} }
plLocation& plLocation::operator=(const plLocation& rhs) plLocation& plLocation::operator=(const plLocation& rhs)
@ -175,18 +175,18 @@ void plUoid::Read(hsStream* s)
else else
fLoadMask.SetAlways(); fLoadMask.SetAlways();
s->LogReadSwap(&fClassType, "ClassType"); s->LogReadLE(&fClassType, "ClassType");
s->LogReadSwap(&fObjectID, "ObjectID"); s->LogReadLE(&fObjectID, "ObjectID");
s->LogSubStreamPushDesc("ObjectName"); s->LogSubStreamPushDesc("ObjectName");
fObjectName = s->LogReadSafeString(); fObjectName = s->LogReadSafeString();
// conditional cloneIDs read // conditional cloneIDs read
if (contents & kHasCloneIDs) if (contents & kHasCloneIDs)
{ {
s->LogReadSwap( &fCloneID ,"CloneID"); s->LogReadLE( &fCloneID ,"CloneID");
UInt16 dummy; UInt16 dummy;
s->LogReadSwap(&dummy, "dummy"); // To avoid breaking format s->LogReadLE(&dummy, "dummy"); // To avoid breaking format
s->LogReadSwap( &fClonePlayerID ,"ClonePlayerID"); s->LogReadLE( &fClonePlayerID ,"ClonePlayerID");
} }
else else
{ {
@ -209,17 +209,17 @@ void plUoid::Write(hsStream* s) const
if (contents & kHasLoadMask) if (contents & kHasLoadMask)
fLoadMask.Write(s); fLoadMask.Write(s);
s->WriteSwap( fClassType ); s->WriteLE( fClassType );
s->WriteSwap( fObjectID ); s->WriteLE( fObjectID );
s->WriteSafeString( fObjectName ); s->WriteSafeString( fObjectName );
// conditional cloneIDs write // conditional cloneIDs write
if (contents & kHasCloneIDs) if (contents & kHasCloneIDs)
{ {
s->WriteSwap(fCloneID); s->WriteLE(fCloneID);
UInt16 dummy = 0; UInt16 dummy = 0;
s->WriteSwap(dummy); // to avoid breaking format s->WriteLE(dummy); // to avoid breaking format
s->WriteSwap(fClonePlayerID); s->WriteLE(fClonePlayerID);
} }
} }

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

@ -94,14 +94,14 @@ public:
void Read(hsStream* stream, hsResMgr* mgr) void Read(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgRead(stream, mgr); plMessage::IMsgRead(stream, mgr);
stream->WriteSwap(fAudFlag); stream->WriteLE(fAudFlag);
mgr->WriteKey(stream, pObj); mgr->WriteKey(stream, pObj);
} }
void Write(hsStream* stream, hsResMgr* mgr) void Write(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgWrite(stream, mgr); plMessage::IMsgWrite(stream, mgr);
stream->ReadSwap(&fAudFlag); stream->ReadLE(&fAudFlag);
pObj = mgr->ReadKey(stream); 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); plMessage::IMsgRead(stream, mgr);
fCmd.Read(stream); fCmd.Read(stream);
fTransTime = stream->ReadSwapDouble(); fTransTime = stream->ReadLEDouble();
fActivated = stream->ReadBool(); fActivated = stream->ReadBool();
fNewCam = mgr->ReadKey(stream); fNewCam = mgr->ReadKey(stream);
fTriggerer = mgr->ReadKey(stream); fTriggerer = mgr->ReadKey(stream);
@ -92,7 +92,7 @@ void plCameraMsg::Write(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgWrite(stream, mgr); plMessage::IMsgWrite(stream, mgr);
fCmd.Write(stream); fCmd.Write(stream);
stream->WriteSwapDouble(fTransTime); stream->WriteLEDouble(fTransTime);
stream->WriteBool(fActivated); stream->WriteBool(fActivated);
mgr->WriteKey(stream, fNewCam); mgr->WriteKey(stream, fNewCam);
mgr->WriteKey(stream, fTriggerer); mgr->WriteKey(stream, fTriggerer);
@ -101,33 +101,33 @@ void plCameraMsg::Write(hsStream* stream, hsResMgr* mgr)
void plCameraConfig::Read(hsStream* stream) void plCameraConfig::Read(hsStream* stream)
{ {
fAccel = stream->ReadSwapFloat(); fAccel = stream->ReadLEFloat();
fDecel = stream->ReadSwapFloat(); fDecel = stream->ReadLEFloat();
fVel = stream->ReadSwapFloat(); fVel = stream->ReadLEFloat();
fFPAccel = stream->ReadSwapFloat(); fFPAccel = stream->ReadLEFloat();
fFPDecel = stream->ReadSwapFloat(); fFPDecel = stream->ReadLEFloat();
fFPVel = stream->ReadSwapFloat(); fFPVel = stream->ReadLEFloat();
fFOVw = stream->ReadSwapFloat(); fFOVw = stream->ReadLEFloat();
fFOVh = stream->ReadSwapFloat(); fFOVh = stream->ReadLEFloat();
fOffset.fX = stream->ReadSwapFloat(); fOffset.fX = stream->ReadLEFloat();
fOffset.fY = stream->ReadSwapFloat(); fOffset.fY = stream->ReadLEFloat();
fOffset.fZ = stream->ReadSwapFloat(); fOffset.fZ = stream->ReadLEFloat();
fWorldspace = stream->ReadBool(); fWorldspace = stream->ReadBool();
} }
void plCameraConfig::Write(hsStream* stream) void plCameraConfig::Write(hsStream* stream)
{ {
stream->WriteSwapFloat(fAccel); stream->WriteLEFloat(fAccel);
stream->WriteSwapFloat(fDecel); stream->WriteLEFloat(fDecel);
stream->WriteSwapFloat(fVel); stream->WriteLEFloat(fVel);
stream->WriteSwapFloat(fFPAccel); stream->WriteLEFloat(fFPAccel);
stream->WriteSwapFloat(fFPDecel); stream->WriteLEFloat(fFPDecel);
stream->WriteSwapFloat(fFPVel); stream->WriteLEFloat(fFPVel);
stream->WriteSwapFloat(fFOVw); stream->WriteLEFloat(fFOVw);
stream->WriteSwapFloat(fFOVh); stream->WriteLEFloat(fFOVh);
stream->WriteSwapFloat(fOffset.fX); stream->WriteLEFloat(fOffset.fX);
stream->WriteSwapFloat(fOffset.fY); stream->WriteLEFloat(fOffset.fY);
stream->WriteSwapFloat(fOffset.fZ); stream->WriteLEFloat(fOffset.fZ);
stream->WriteBool(fWorldspace); stream->WriteBool(fWorldspace);
} }

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

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

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

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

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

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

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

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

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

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

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

@ -77,7 +77,7 @@ public:
fLocallyOriginated = stream->ReadBool(); fLocallyOriginated = stream->ReadBool();
fLastOut = stream->ReadBool(); fLastOut = stream->ReadBool();
fUnload = stream->ReadBool(); fUnload = stream->ReadBool();
fClientID = stream->ReadSwap32(); fClientID = stream->ReadLE32();
} }
void Write(hsStream* stream, hsResMgr* mgr) void Write(hsStream* stream, hsResMgr* mgr)
{ {
@ -86,7 +86,7 @@ public:
stream->WriteBool(fLocallyOriginated); stream->WriteBool(fLocallyOriginated);
stream->WriteBool(fLastOut); stream->WriteBool(fLastOut);
stream->WriteBool(fUnload); 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) void plProxyDrawMsg::Read(hsStream* s, hsResMgr* mgr)
{ {
plMessage::IMsgRead(s, mgr); plMessage::IMsgRead(s, mgr);
fProxyFlags = s->ReadSwap16(); fProxyFlags = s->ReadLE16();
} }
void plProxyDrawMsg::Write(hsStream* s, hsResMgr* mgr) void plProxyDrawMsg::Write(hsStream* s, hsResMgr* mgr)
{ {
plMessage::IMsgWrite(s, 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) void plRefMsg::Read(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgRead(stream, mgr); plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fContext); stream->ReadLE(&fContext);
plKey key; plKey key;
key = mgr->ReadKey(stream); key = mgr->ReadKey(stream);
@ -93,7 +93,7 @@ void plRefMsg::Read(hsStream* stream, hsResMgr* mgr)
void plRefMsg::Write(hsStream* stream, hsResMgr* mgr) void plRefMsg::Write(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgWrite(stream, mgr); plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fContext); stream->WriteLE(fContext);
mgr->WriteKey(stream, (fRef ? fRef->GetKey() : nil)); mgr->WriteKey(stream, (fRef ? fRef->GetKey() : nil));
mgr->WriteKey(stream, (fOldRef ? fOldRef->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) void plGenRefMsg::Read(hsStream* stream, hsResMgr* mgr)
{ {
plRefMsg::Read(stream, mgr); plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType); stream->ReadLE(&fType);
fWhich = stream->ReadSwap32(); fWhich = stream->ReadLE32();
} }
void plGenRefMsg::Write(hsStream* stream, hsResMgr* mgr) void plGenRefMsg::Write(hsStream* stream, hsResMgr* mgr)
{ {
plRefMsg::Write(stream, mgr); plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType); stream->WriteLE(fType);
stream->WriteSwap32(fWhich); 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) void plServerReplyMsg::Read(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgRead(stream, mgr); plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fType); stream->ReadLE(&fType);
} }
void plServerReplyMsg::Write(hsStream* stream, hsResMgr* mgr) void plServerReplyMsg::Write(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgWrite(stream, mgr); plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fType); stream->WriteLE(fType);
} }
enum ServerReplyFlags enum ServerReplyFlags
@ -68,7 +68,7 @@ void plServerReplyMsg::ReadVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Read(s); contentFlags.Read(s);
if (contentFlags.IsBitSet(kServerReplyType)) if (contentFlags.IsBitSet(kServerReplyType))
s->ReadSwap(&fType); s->ReadLE(&fType);
} }
void plServerReplyMsg::WriteVersion(hsStream* s, hsResMgr* mgr) void plServerReplyMsg::WriteVersion(hsStream* s, hsResMgr* mgr)
@ -80,5 +80,5 @@ void plServerReplyMsg::WriteVersion(hsStream* s, hsResMgr* mgr)
contentFlags.Write(s); contentFlags.Write(s);
// kServerReplyType // 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); plMessageWithCallbacks::Read(stream, mgr);
fCmd.Read(stream); fCmd.Read(stream);
stream->ReadSwap(&fBegin); stream->ReadLE(&fBegin);
stream->ReadSwap(&fEnd); stream->ReadLE(&fEnd);
fLoop = stream->ReadBool(); fLoop = stream->ReadBool();
fPlaying = stream->ReadBool(); fPlaying = stream->ReadBool();
stream->ReadSwap(&fSpeed); stream->ReadLE(&fSpeed);
stream->ReadSwap(&fTime); stream->ReadLE(&fTime);
stream->ReadSwap(&fIndex); stream->ReadLE(&fIndex);
stream->ReadSwap(&fRepeats); stream->ReadLE(&fRepeats);
stream->ReadSwap(&fNameStr); stream->ReadLE(&fNameStr);
stream->ReadSwap(&fVolume); stream->ReadLE(&fVolume);
fFadeType = (plSoundMsg::FadeType)stream->ReadByte(); fFadeType = (plSoundMsg::FadeType)stream->ReadByte();
} }
@ -80,15 +80,15 @@ void plSoundMsg::Write(hsStream* stream, hsResMgr* mgr)
plMessageWithCallbacks::Write(stream, mgr); plMessageWithCallbacks::Write(stream, mgr);
fCmd.Write(stream); fCmd.Write(stream);
stream->WriteSwap(fBegin); stream->WriteLE(fBegin);
stream->WriteSwap(fEnd); stream->WriteLE(fEnd);
stream->WriteBool(fLoop); stream->WriteBool(fLoop);
stream->WriteBool(fPlaying); stream->WriteBool(fPlaying);
stream->WriteSwap(fSpeed); stream->WriteLE(fSpeed);
stream->WriteSwap(fTime); stream->WriteLE(fTime);
stream->WriteSwap(fIndex); stream->WriteLE(fIndex);
stream->WriteSwap(fRepeats); stream->WriteLE(fRepeats);
stream->WriteSwap(fNameStr); stream->WriteLE(fNameStr);
stream->WriteSwap(fVolume); stream->WriteLE(fVolume);
stream->WriteByte( (UInt8)fFadeType ); stream->WriteByte( (UInt8)fFadeType );
} }

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

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

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

@ -86,14 +86,14 @@ public:
{ {
plMessage::IMsgRead(stream, mgr); plMessage::IMsgRead(stream, mgr);
fTransform.Read(stream); fTransform.Read(stream);
stream->ReadSwap(&fWarpFlags); stream->ReadLE(&fWarpFlags);
} }
void Write(hsStream* stream, hsResMgr* mgr) void Write(hsStream* stream, hsResMgr* mgr)
{ {
plMessage::IMsgWrite(stream, mgr); plMessage::IMsgWrite(stream, mgr);
fTransform.Write(stream); 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) void plLogicModBase::Read(hsStream* stream, hsResMgr* mgr)
{ {
plSingleModifier::Read(stream, mgr); plSingleModifier::Read(stream, mgr);
int n = stream->ReadSwap32(); int n = stream->ReadLE32();
fCommandList.SetCountAndZero(n); fCommandList.SetCountAndZero(n);
for(int i = 0; i < n; i++ ) 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) void plLogicModBase::Write(hsStream* stream, hsResMgr* mgr)
{ {
plSingleModifier::Write(stream, mgr); plSingleModifier::Write(stream, mgr);
stream->WriteSwap32(fCommandList.GetCount()); stream->WriteLE32(fCommandList.GetCount());
for(int i = 0; i < fCommandList.GetCount(); i++ ) for(int i = 0; i < fCommandList.GetCount(); i++ )
mgr->WriteCreatable( stream, fCommandList[i] ); mgr->WriteCreatable( stream, fCommandList[i] );
mgr->WriteCreatable( stream, fNotify ); mgr->WriteCreatable( stream, fNotify );

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

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

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

@ -149,16 +149,16 @@ std::string plNetAddress::AsString() const
void plNetAddress::Read(hsStream * s) void plNetAddress::Read(hsStream * s)
{ {
s->ReadSwap((UInt32*)&fAddr.sin_addr.s_addr); s->ReadLE((UInt32*)&fAddr.sin_addr.s_addr);
s->ReadSwap(&fAddr.sin_port); s->ReadLE(&fAddr.sin_port);
s->ReadSwap(&fAddr.sin_family); s->ReadLE(&fAddr.sin_family);
} }
void plNetAddress::Write(hsStream * s) void plNetAddress::Write(hsStream * s)
{ {
s->WriteSwap((UInt32)fAddr.sin_addr.s_addr); s->WriteLE((UInt32)fAddr.sin_addr.s_addr);
s->WriteSwap(fAddr.sin_port); s->WriteLE(fAddr.sin_port);
s->WriteSwap(fAddr.sin_family); 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; } bool operator<(const plNetGroupId& netGroup) const { return fId < netGroup.fId; }
// read and write to hsStream // read and write to hsStream
void Write(hsStream *s) const { fId.Write(s); s->WriteSwap(fFlags); } void Write(hsStream *s) const { fId.Write(s); s->WriteLE(fFlags); }
void Read(hsStream *s) { fId.Read(s); s->LogReadSwap(&fFlags,"GroupId Flags"); } void Read(hsStream *s) { fId.Read(s); s->LogReadLE(&fFlags,"GroupId Flags"); }
}; };
namespace plNetGroup namespace plNetGroup

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

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

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

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

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

@ -333,11 +333,11 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
hsKeyedObject::Read(stream, mgr); hsKeyedObject::Read(stream, mgr);
fNetGroup = GetKey()->GetUoid().GetLocation(); fNetGroup = GetKey()->GetUoid().GetLocation();
stream->ReadSwap(&fSynchFlags); stream->ReadLE(&fSynchFlags);
if (fSynchFlags & kExcludePersistentState) if (fSynchFlags & kExcludePersistentState)
{ {
Int16 num; Int16 num;
stream->ReadSwap(&num); stream->ReadLE(&num);
fSDLExcludeList.clear(); fSDLExcludeList.clear();
int i; int i;
for(i=0;i<num;i++) for(i=0;i<num;i++)
@ -351,7 +351,7 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
if (fSynchFlags & kHasVolatileState) if (fSynchFlags & kHasVolatileState)
{ {
Int16 num; Int16 num;
stream->ReadSwap(&num); stream->ReadLE(&num);
fSDLVolatileList.clear(); fSDLVolatileList.clear();
int i; int i;
for(i=0;i<num;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) void plSynchedObject::Write(hsStream* stream, hsResMgr* mgr)
{ {
hsKeyedObject::Write(stream, mgr); hsKeyedObject::Write(stream, mgr);
stream->WriteSwap(fSynchFlags); stream->WriteLE(fSynchFlags);
if (fSynchFlags & kExcludePersistentState) if (fSynchFlags & kExcludePersistentState)
{ {
Int16 num=fSDLExcludeList.size(); Int16 num=fSDLExcludeList.size();
stream->WriteSwap(num); stream->WriteLE(num);
SDLStateList::iterator it=fSDLExcludeList.begin(); SDLStateList::iterator it=fSDLExcludeList.begin();
for(; it != fSDLExcludeList.end(); it++) for(; it != fSDLExcludeList.end(); it++)
@ -383,7 +383,7 @@ void plSynchedObject::Write(hsStream* stream, hsResMgr* mgr)
if (fSynchFlags & kHasVolatileState) if (fSynchFlags & kHasVolatileState)
{ {
Int16 num=fSDLVolatileList.size(); Int16 num=fSDLVolatileList.size();
stream->WriteSwap(num); stream->WriteLE(num);
SDLStateList::iterator it=fSDLVolatileList.begin(); SDLStateList::iterator it=fSDLVolatileList.begin();
for(; it != fSDLVolatileList.end(); it++) 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() \ #define ISaveOrLoadSimpleType() \
{ \ { \
if (save) \ if (save) \
stream->WriteSwap(v); \ stream->WriteLE(v); \
else \ else \
stream->ReadSwap(&v); \ stream->ReadLE(&v); \
return 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... // I need to write a key to MY stream...
#if 0 // DEBUG #if 0 // DEBUG
Int32 len = hsStrlen(key->GetName()); Int32 len = hsStrlen(key->GetName());
stream->WriteSwap32(len); stream->WriteLE32(len);
stream->Write(len, key->GetName()); stream->Write(len, key->GetName());
#endif #endif
key->GetUoid().Write(stream); key->GetUoid().Write(stream);
@ -119,7 +119,7 @@ const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, hsBool32 save, hsSt
{ {
// read a key from MY stream // read a key from MY stream
#if 0 // DEBUG #if 0 // DEBUG
Int32 len = stream->ReadSwap32(); Int32 len = stream->ReadLE32();
char tmp[256]; char tmp[256];
hsAssert(len<256, "key name overflow"); hsAssert(len<256, "key name overflow");
stream->Read(len, tmp); 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 // write out size of array
Int32 i, num = fValueList.GetCount(); Int32 i, num = fValueList.GetCount();
stream->WriteSwap(num); stream->WriteLE(num);
for(i=0;i<num;i++) for(i=0;i<num;i++)
{ {
plSynchedValueBase::ISaveOrLoad(fValueList[i], save, stream, mgr); plSynchedValueBase::ISaveOrLoad(fValueList[i], save, stream, mgr);
@ -351,7 +351,7 @@ void plSynchedTArray<T>::ISaveOrLoad(hsBool32 save, hsStream* stream, hsResMgr*
fValueList.Reset(); fValueList.Reset();
// read in size of array // read in size of array
Int32 i, num; Int32 i, num;
stream->ReadSwap(&num); stream->ReadLE(&num);
for(i=0;i<num;i++) 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(); fStream.Rewind();
std::string buf; std::string buf;
UInt32 len = fStream.GetEOF(); UInt32 len = fStream.GetEOF();
stream->WriteSwap( len ); stream->WriteLE( len );
buf.resize( len ); buf.resize( len );
fStream.Read( len, (void*)buf.data() ); fStream.Read( len, (void*)buf.data() );
stream->Write( len, (const void*)buf.data() ); stream->Write( len, (const void*)buf.data() );
@ -113,7 +113,7 @@ void plCreatableStream::Read( hsStream* stream, hsResMgr* mgr )
fStream.Rewind(); fStream.Rewind();
std::string buf; std::string buf;
UInt32 len; UInt32 len;
stream->LogReadSwap( &len,"CreatableStream Len"); stream->LogReadLE( &len,"CreatableStream Len");
buf.resize( len ); buf.resize( len );
stream->LogRead( len, (void*)buf.data(),"CreatableStream Data"); stream->LogRead( len, (void*)buf.data(),"CreatableStream Data");
fStream.Write( len, (const void*)buf.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); fLocalToWorld.Read(stream);
fWorldToLocal.Read(stream); fWorldToLocal.Read(stream);
int n = stream->ReadSwap32(); int n = stream->ReadLE32();
int i; int i;
for( i = 0; i < n; i++ ) for( i = 0; i < n; i++ )
{ {
@ -576,7 +576,7 @@ void plCoordinateInterface::Write(hsStream* stream, hsResMgr* mgr)
fLocalToWorld.Write(stream); fLocalToWorld.Write(stream);
fWorldToLocal.Write(stream); fWorldToLocal.Write(stream);
stream->WriteSwap32(fChildren.GetCount()); stream->WriteLE32(fChildren.GetCount());
int i; int i;
for( i = 0; i < fChildren.GetCount(); i++ ) for( i = 0; i < fChildren.GetCount(); i++ )
mgr->WriteKey(stream, fChildren[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); plObjInterface::Read(s, mgr);
int nDrawables = s->ReadSwap32(); int nDrawables = s->ReadLE32();
if (nDrawables > 0) if (nDrawables > 0)
ICheckDrawableIndex(nDrawables-1); ICheckDrawableIndex(nDrawables-1);
int i; int i;
for( i = 0; i < fDrawables.GetCount(); 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); plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, i, plIntRefMsg::kDrawable);
mgr->ReadKeyNotifyMe(s,refMsg, plRefFlags::kActiveRef); mgr->ReadKeyNotifyMe(s,refMsg, plRefFlags::kActiveRef);
} }
int nReg = s->ReadSwap32(); int nReg = s->ReadLE32();
fRegions.SetCountAndZero(nReg); fRegions.SetCountAndZero(nReg);
for( i = 0; i < nReg; i++ ) for( i = 0; i < nReg; i++ )
{ {
@ -171,16 +171,16 @@ void plDrawInterface::Write(hsStream* s, hsResMgr* mgr)
{ {
plObjInterface::Write(s, mgr); plObjInterface::Write(s, mgr);
s->WriteSwap32(fDrawables.GetCount()); s->WriteLE32(fDrawables.GetCount());
int i; int i;
for( i = 0; i < fDrawables.GetCount(); i++ ) for( i = 0; i < fDrawables.GetCount(); i++ )
{ {
s->WriteSwap32(fDrawableIndices[i]); s->WriteLE32(fDrawableIndices[i]);
mgr->WriteKey(s, fDrawables[i]); mgr->WriteKey(s, fDrawables[i]);
} }
s->WriteSwap32(fRegions.GetCount()); s->WriteLE32(fRegions.GetCount());
for( i = 0; i < fRegions.GetCount(); i++ ) for( i = 0; i < fRegions.GetCount(); i++ )
{ {
mgr->WriteKey(s, fRegions[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 i;
int nGen = stream->ReadSwap32(); int nGen = stream->ReadLE32();
fGenerics.SetCount(0); fGenerics.SetCount(0);
for( i = 0; i < nGen; i++ ) for( i = 0; i < nGen; i++ )
{ {
@ -134,7 +134,7 @@ void plSceneObject::Read(hsStream* stream, hsResMgr* mgr)
plObjRefMsg* refMsg; plObjRefMsg* refMsg;
int nOldMods=fModifiers.GetCount(); // existng modifiers created during interface loading 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 fModifiers.ExpandAndZero(nOldMods+nNewMods); // reserve space for new modifiers+existing modifiers
for( i = nOldMods; i < nOldMods+nNewMods; i++ ) for( i = nOldMods; i < nOldMods+nNewMods; i++ )
{ {
@ -159,7 +159,7 @@ void plSceneObject::Write(hsStream* stream, hsResMgr* mgr)
int i; int i;
stream->WriteSwap32(fGenerics.GetCount()); stream->WriteLE32(fGenerics.GetCount());
for( i = 0; i < fGenerics.GetCount(); i++ ) for( i = 0; i < fGenerics.GetCount(); i++ )
mgr->WriteKey(stream, fGenerics[i]); mgr->WriteKey(stream, fGenerics[i]);
@ -167,7 +167,7 @@ void plSceneObject::Write(hsStream* stream, hsResMgr* mgr)
if (fModifiers[i]->GetKey() == nil) if (fModifiers[i]->GetKey() == nil)
RemoveModifier(fModifiers[i]); RemoveModifier(fModifiers[i]);
stream->WriteSwap32(fModifiers.GetCount()); stream->WriteLE32(fModifiers.GetCount());
for( i = 0; i < fModifiers.GetCount(); i++ ) for( i = 0; i < fModifiers.GetCount(); i++ )
mgr->WriteKey(stream,fModifiers[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 // avoid breaking the format
fProps.Read(s); fProps.Read(s);
// Also unnecessary // Also unnecessary
int poop = s->ReadSwap32(); int poop = s->ReadLE32();
plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kPhysical, 0); plIntRefMsg* refMsg = TRACKED_NEW plIntRefMsg(GetKey(), plRefMsg::kOnCreate, 0, plIntRefMsg::kPhysical, 0);
mgr->ReadKeyNotifyMe(s, refMsg, plRefFlags::kActiveRef); mgr->ReadKeyNotifyMe(s, refMsg, plRefFlags::kActiveRef);
@ -109,7 +109,7 @@ void plSimulationInterface::Write(hsStream* s, hsResMgr* mgr)
// Legacy crap // Legacy crap
fProps.Write(s); fProps.Write(s);
s->WriteSwap32(0); s->WriteLE32(0);
mgr->WriteKey(s, fPhysical); 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). // 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> template <class T> class plTimedSimple : public plTimedValue<T>
{ {
public: public:
@ -141,7 +141,7 @@ template <class T>
void plTimedSimple<T>::Read(hsStream* s) void plTimedSimple<T>::Read(hsStream* s)
{ {
T val; T val;
s->ReadSwap(&val); s->ReadLE(&val);
Set(val, 0.f); Set(val, 0.f);
} }
@ -149,7 +149,7 @@ template <class T>
void plTimedSimple<T>::Write(hsStream* s) const void plTimedSimple<T>::Write(hsStream* s) const
{ {
T val = this->Value(); T val = this->Value();
s->WriteSwap(val); s->WriteLE(val);
} }
template <class T> template <class T>

4
Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp

@ -453,7 +453,7 @@ hsBool plWinAudible::IsPlaying(int index)
void plWinAudible::Read(hsStream* s, hsResMgr* mgr) void plWinAudible::Read(hsStream* s, hsResMgr* mgr)
{ {
plAudible::Read(s, mgr); plAudible::Read(s, mgr);
int n = s->ReadSwap32(); int n = s->ReadLE32();
fSoundObjs.SetCountAndZero(n); fSoundObjs.SetCountAndZero(n);
for(int i = 0; i < n; i++ ) for(int i = 0; i < n; i++ )
{ {
@ -482,7 +482,7 @@ void plWinAudible::IAssignSoundKey( plSound *sound, const char *name, UInt32 i )
void plWinAudible::Write(hsStream* s, hsResMgr* mgr) void plWinAudible::Write(hsStream* s, hsResMgr* mgr)
{ {
plAudible::Write(s, mgr); plAudible::Write(s, mgr);
s->WriteSwap32(fSoundObjs.GetCount()); s->WriteLE32(fSoundObjs.GetCount());
for(int i = 0; i < fSoundObjs.GetCount(); i++ ) for(int i = 0; i < fSoundObjs.GetCount(); i++ )
// mgr->WriteCreatable( s, fSoundObjs[i] ); // mgr->WriteCreatable( s, fSoundObjs[i] );
mgr->WriteKey(s, fSoundObjs[i]); mgr->WriteKey(s, fSoundObjs[i]);

48
Sources/Plasma/PubUtilLib/plAudio/plEAXEffects.cpp

@ -462,23 +462,23 @@ void plEAXSourceSettings::Read( hsStream *s )
fEnabled = s->ReadBool(); fEnabled = s->ReadBool();
if( fEnabled ) if( fEnabled )
{ {
fRoom = s->ReadSwap16(); fRoom = s->ReadLE16();
fRoomHF = s->ReadSwap16(); fRoomHF = s->ReadLE16();
fRoomAuto = s->ReadBool(); fRoomAuto = s->ReadBool();
fRoomHFAuto = s->ReadBool(); fRoomHFAuto = s->ReadBool();
fOutsideVolHF = s->ReadSwap16(); fOutsideVolHF = s->ReadLE16();
fAirAbsorptionFactor = s->ReadSwapFloat(); fAirAbsorptionFactor = s->ReadLEFloat();
fRoomRolloffFactor = s->ReadSwapFloat(); fRoomRolloffFactor = s->ReadLEFloat();
fDopplerFactor = s->ReadSwapFloat(); fDopplerFactor = s->ReadLEFloat();
fRolloffFactor = s->ReadSwapFloat(); fRolloffFactor = s->ReadLEFloat();
fSoftStarts.Read( s ); fSoftStarts.Read( s );
fSoftEnds.Read( s ); fSoftEnds.Read( s );
fOcclusionSoftValue = -1.f; fOcclusionSoftValue = -1.f;
SetOcclusionSoftValue( s->ReadSwapFloat() ); SetOcclusionSoftValue( s->ReadLEFloat() );
fDirtyParams = kAll; fDirtyParams = kAll;
} }
@ -491,22 +491,22 @@ void plEAXSourceSettings::Write( hsStream *s )
s->WriteBool( fEnabled ); s->WriteBool( fEnabled );
if( fEnabled ) if( fEnabled )
{ {
s->WriteSwap16( fRoom ); s->WriteLE16( fRoom );
s->WriteSwap16( fRoomHF ); s->WriteLE16( fRoomHF );
s->WriteBool( fRoomAuto ); s->WriteBool( fRoomAuto );
s->WriteBool( fRoomHFAuto ); s->WriteBool( fRoomHFAuto );
s->WriteSwap16( fOutsideVolHF ); s->WriteLE16( fOutsideVolHF );
s->WriteSwapFloat( fAirAbsorptionFactor ); s->WriteLEFloat( fAirAbsorptionFactor );
s->WriteSwapFloat( fRoomRolloffFactor ); s->WriteLEFloat( fRoomRolloffFactor );
s->WriteSwapFloat( fDopplerFactor ); s->WriteLEFloat( fDopplerFactor );
s->WriteSwapFloat( fRolloffFactor ); s->WriteLEFloat( fRolloffFactor );
fSoftStarts.Write( s ); fSoftStarts.Write( s );
fSoftEnds.Write( s ); fSoftEnds.Write( s );
s->WriteSwapFloat( fOcclusionSoftValue ); s->WriteLEFloat( fOcclusionSoftValue );
} }
} }
@ -607,18 +607,18 @@ void plEAXSourceSoftSettings::Reset( void )
void plEAXSourceSoftSettings::Read( hsStream *s ) void plEAXSourceSoftSettings::Read( hsStream *s )
{ {
s->ReadSwap( &fOcclusion ); s->ReadLE( &fOcclusion );
s->ReadSwap( &fOcclusionLFRatio ); s->ReadLE( &fOcclusionLFRatio );
s->ReadSwap( &fOcclusionRoomRatio ); s->ReadLE( &fOcclusionRoomRatio );
s->ReadSwap( &fOcclusionDirectRatio ); s->ReadLE( &fOcclusionDirectRatio );
} }
void plEAXSourceSoftSettings::Write( hsStream *s ) void plEAXSourceSoftSettings::Write( hsStream *s )
{ {
s->WriteSwap( fOcclusion ); s->WriteLE( fOcclusion );
s->WriteSwap( fOcclusionLFRatio ); s->WriteLE( fOcclusionLFRatio );
s->WriteSwap( fOcclusionRoomRatio ); s->WriteLE( fOcclusionRoomRatio );
s->WriteSwap( fOcclusionDirectRatio ); s->WriteLE( fOcclusionDirectRatio );
} }
void plEAXSourceSoftSettings::SetOcclusion( Int16 occ, hsScalar lfRatio, hsScalar roomRatio, hsScalar directRatio ) void plEAXSourceSoftSettings::SetOcclusion( Int16 occ, hsScalar lfRatio, hsScalar roomRatio, hsScalar directRatio )

92
Sources/Plasma/PubUtilLib/plAudio/plEAXListenerMod.cpp

@ -173,30 +173,30 @@ void plEAXListenerMod::Read( hsStream* s, hsResMgr* mgr )
mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, kRefSoftRegion ), plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( s, TRACKED_NEW plGenRefMsg( GetKey(), plRefMsg::kOnCreate, 0, kRefSoftRegion ), plRefFlags::kActiveRef );
// Read the listener params // Read the listener params
fListenerProps->ulEnvironment = s->ReadSwap32(); fListenerProps->ulEnvironment = s->ReadLE32();
fListenerProps->flEnvironmentSize = s->ReadSwapFloat(); fListenerProps->flEnvironmentSize = s->ReadLEFloat();
fListenerProps->flEnvironmentDiffusion = s->ReadSwapFloat(); fListenerProps->flEnvironmentDiffusion = s->ReadLEFloat();
fListenerProps->lRoom = s->ReadSwap32(); fListenerProps->lRoom = s->ReadLE32();
fListenerProps->lRoomHF = s->ReadSwap32(); fListenerProps->lRoomHF = s->ReadLE32();
fListenerProps->lRoomLF = s->ReadSwap32(); fListenerProps->lRoomLF = s->ReadLE32();
fListenerProps->flDecayTime = s->ReadSwapFloat(); fListenerProps->flDecayTime = s->ReadLEFloat();
fListenerProps->flDecayHFRatio = s->ReadSwapFloat(); fListenerProps->flDecayHFRatio = s->ReadLEFloat();
fListenerProps->flDecayLFRatio = s->ReadSwapFloat(); fListenerProps->flDecayLFRatio = s->ReadLEFloat();
fListenerProps->lReflections = s->ReadSwap32(); fListenerProps->lReflections = s->ReadLE32();
fListenerProps->flReflectionsDelay = s->ReadSwapFloat(); fListenerProps->flReflectionsDelay = s->ReadLEFloat();
//fListenerProps->vReflectionsPan; // early reflections panning vector //fListenerProps->vReflectionsPan; // early reflections panning vector
fListenerProps->lReverb = s->ReadSwap32(); // late reverberation level relative to room effect fListenerProps->lReverb = s->ReadLE32(); // late reverberation level relative to room effect
fListenerProps->flReverbDelay = s->ReadSwapFloat(); fListenerProps->flReverbDelay = s->ReadLEFloat();
//fListenerProps->vReverbPan; // late reverberation panning vector //fListenerProps->vReverbPan; // late reverberation panning vector
fListenerProps->flEchoTime = s->ReadSwapFloat(); fListenerProps->flEchoTime = s->ReadLEFloat();
fListenerProps->flEchoDepth = s->ReadSwapFloat(); fListenerProps->flEchoDepth = s->ReadLEFloat();
fListenerProps->flModulationTime = s->ReadSwapFloat(); fListenerProps->flModulationTime = s->ReadLEFloat();
fListenerProps->flModulationDepth = s->ReadSwapFloat(); fListenerProps->flModulationDepth = s->ReadLEFloat();
fListenerProps->flAirAbsorptionHF = s->ReadSwapFloat(); fListenerProps->flAirAbsorptionHF = s->ReadLEFloat();
fListenerProps->flHFReference = s->ReadSwapFloat(); fListenerProps->flHFReference = s->ReadLEFloat();
fListenerProps->flLFReference = s->ReadSwapFloat(); fListenerProps->flLFReference = s->ReadLEFloat();
fListenerProps->flRoomRolloffFactor = s->ReadSwapFloat(); fListenerProps->flRoomRolloffFactor = s->ReadLEFloat();
fListenerProps->ulFlags = s->ReadSwap32(); fListenerProps->ulFlags = s->ReadLE32();
// Done reading, time to tell the audio sys we exist // Done reading, time to tell the audio sys we exist
IRegister(); IRegister();
@ -210,30 +210,30 @@ void plEAXListenerMod::Write( hsStream* s, hsResMgr* mgr )
mgr->WriteKey( s, fSoftRegion ); mgr->WriteKey( s, fSoftRegion );
// Write the listener params // Write the listener params
s->WriteSwap32( fListenerProps->ulEnvironment ); s->WriteLE32( fListenerProps->ulEnvironment );
s->WriteSwapFloat( fListenerProps->flEnvironmentSize ); s->WriteLEFloat( fListenerProps->flEnvironmentSize );
s->WriteSwapFloat( fListenerProps->flEnvironmentDiffusion ); s->WriteLEFloat( fListenerProps->flEnvironmentDiffusion );
s->WriteSwap32( fListenerProps->lRoom ); s->WriteLE32( fListenerProps->lRoom );
s->WriteSwap32( fListenerProps->lRoomHF ); s->WriteLE32( fListenerProps->lRoomHF );
s->WriteSwap32( fListenerProps->lRoomLF ); s->WriteLE32( fListenerProps->lRoomLF );
s->WriteSwapFloat( fListenerProps->flDecayTime ); s->WriteLEFloat( fListenerProps->flDecayTime );
s->WriteSwapFloat( fListenerProps->flDecayHFRatio ); s->WriteLEFloat( fListenerProps->flDecayHFRatio );
s->WriteSwapFloat( fListenerProps->flDecayLFRatio ); s->WriteLEFloat( fListenerProps->flDecayLFRatio );
s->WriteSwap32( fListenerProps->lReflections ); s->WriteLE32( fListenerProps->lReflections );
s->WriteSwapFloat( fListenerProps->flReflectionsDelay ); s->WriteLEFloat( fListenerProps->flReflectionsDelay );
//s->WriteSwapFloat( fListenerProps->vReflectionsPan; // early reflections panning vector //s->WriteLEFloat( fListenerProps->vReflectionsPan; // early reflections panning vector
s->WriteSwap32( fListenerProps->lReverb ); // late reverberation level relative to room effect s->WriteLE32( fListenerProps->lReverb ); // late reverberation level relative to room effect
s->WriteSwapFloat( fListenerProps->flReverbDelay ); s->WriteLEFloat( fListenerProps->flReverbDelay );
//s->WriteSwapFloat( fListenerProps->vReverbPan; // late reverberation panning vector //s->WriteLEFloat( fListenerProps->vReverbPan; // late reverberation panning vector
s->WriteSwapFloat( fListenerProps->flEchoTime ); s->WriteLEFloat( fListenerProps->flEchoTime );
s->WriteSwapFloat( fListenerProps->flEchoDepth ); s->WriteLEFloat( fListenerProps->flEchoDepth );
s->WriteSwapFloat( fListenerProps->flModulationTime ); s->WriteLEFloat( fListenerProps->flModulationTime );
s->WriteSwapFloat( fListenerProps->flModulationDepth ); s->WriteLEFloat( fListenerProps->flModulationDepth );
s->WriteSwapFloat( fListenerProps->flAirAbsorptionHF ); s->WriteLEFloat( fListenerProps->flAirAbsorptionHF );
s->WriteSwapFloat( fListenerProps->flHFReference ); s->WriteLEFloat( fListenerProps->flHFReference );
s->WriteSwapFloat( fListenerProps->flLFReference ); s->WriteLEFloat( fListenerProps->flLFReference );
s->WriteSwapFloat( fListenerProps->flRoomRolloffFactor ); s->WriteLEFloat( fListenerProps->flRoomRolloffFactor );
s->WriteSwap32( fListenerProps->ulFlags ); s->WriteLE32( fListenerProps->ulFlags );
} }

72
Sources/Plasma/PubUtilLib/plAudio/plSound.cpp

@ -1262,11 +1262,11 @@ void plSound::IRead( hsStream *s, hsResMgr *mgr )
{ {
fPlaying = s->ReadBool(); fPlaying = s->ReadBool();
fVirtualStartTime = hsTimer::GetSysSeconds(); // Need if we're autostart fVirtualStartTime = hsTimer::GetSysSeconds(); // Need if we're autostart
fTime = s->ReadSwapDouble(); fTime = s->ReadLEDouble();
fMaxFalloff = s->ReadSwap32(); fMaxFalloff = s->ReadLE32();
fMinFalloff = s->ReadSwap32(); fMinFalloff = s->ReadLE32();
s->ReadSwap( &fCurrVolume ); s->ReadLE( &fCurrVolume );
s->ReadSwap( &fDesiredVol ); s->ReadLE( &fDesiredVol );
/// mcn debugging - Thanks to some of my older sound code, it's possible that a few volumes /// mcn debugging - Thanks to some of my older sound code, it's possible that a few volumes
/// will come in too large. This will only happen with scenes that were exported with that intermediate /// will come in too large. This will only happen with scenes that were exported with that intermediate
@ -1279,11 +1279,11 @@ void plSound::IRead( hsStream *s, hsResMgr *mgr )
fCurrVolume = 1.f; fCurrVolume = 1.f;
fMaxVolume = fDesiredVol; fMaxVolume = fDesiredVol;
fOuterVol = s->ReadSwap32(); fOuterVol = s->ReadLE32();
fInnerCone = s->ReadSwap32(); fInnerCone = s->ReadLE32();
fOuterCone = s->ReadSwap32(); fOuterCone = s->ReadLE32();
s->ReadSwap( &fFadedVolume ); s->ReadLE( &fFadedVolume );
s->ReadSwap( &fProperties ); s->ReadLE( &fProperties );
fType = s->ReadByte(); fType = s->ReadByte();
fPriority = s->ReadByte(); fPriority = s->ReadByte();
@ -1312,16 +1312,16 @@ void plSound::IRead( hsStream *s, hsResMgr *mgr )
void plSound::IWrite( hsStream *s, hsResMgr *mgr ) void plSound::IWrite( hsStream *s, hsResMgr *mgr )
{ {
s->WriteBool(fPlaying); s->WriteBool(fPlaying);
s->WriteSwapDouble(fTime); s->WriteLEDouble(fTime);
s->WriteSwap32(fMaxFalloff); s->WriteLE32(fMaxFalloff);
s->WriteSwap32(fMinFalloff); s->WriteLE32(fMinFalloff);
s->WriteSwap( fCurrVolume ); s->WriteLE( fCurrVolume );
s->WriteSwap( fDesiredVol ); s->WriteLE( fDesiredVol );
s->WriteSwap32(fOuterVol); s->WriteLE32(fOuterVol);
s->WriteSwap32(fInnerCone); s->WriteLE32(fInnerCone);
s->WriteSwap32(fOuterCone); s->WriteLE32(fOuterCone);
s->WriteSwap( fFadedVolume ); s->WriteLE( fFadedVolume );
s->WriteSwap( fProperties ); s->WriteLE( fProperties );
s->WriteByte( fType ); s->WriteByte( fType );
s->WriteByte( fPriority ); s->WriteByte( fPriority );
@ -1347,24 +1347,24 @@ void plSound::IWrite( hsStream *s, hsResMgr *mgr )
void plSound::plFadeParams::Read( hsStream *s ) void plSound::plFadeParams::Read( hsStream *s )
{ {
s->ReadSwap( &fLengthInSecs ); s->ReadLE( &fLengthInSecs );
s->ReadSwap( &fVolStart ); s->ReadLE( &fVolStart );
s->ReadSwap( &fVolEnd ); s->ReadLE( &fVolEnd );
s->ReadSwap( &fType ); s->ReadLE( &fType );
s->ReadSwap( &fCurrTime ); s->ReadLE( &fCurrTime );
s->ReadSwap( &fStopWhenDone ); s->ReadLE( &fStopWhenDone );
s->ReadSwap( &fFadeSoftVol ); s->ReadLE( &fFadeSoftVol );
} }
void plSound::plFadeParams::Write( hsStream *s ) void plSound::plFadeParams::Write( hsStream *s )
{ {
s->WriteSwap( fLengthInSecs ); s->WriteLE( fLengthInSecs );
s->WriteSwap( fVolStart ); s->WriteLE( fVolStart );
s->WriteSwap( fVolEnd ); s->WriteLE( fVolEnd );
s->WriteSwap( fType ); s->WriteLE( fType );
s->WriteSwap( fCurrTime ); s->WriteLE( fCurrTime );
s->WriteSwap( fStopWhenDone ); s->WriteLE( fStopWhenDone );
s->WriteSwap( fFadeSoftVol ); s->WriteLE( fFadeSoftVol );
} }
hsScalar plSound::plFadeParams::InterpValue( void ) hsScalar plSound::plFadeParams::InterpValue( void )
@ -1534,11 +1534,11 @@ plAGApplicator *plSoundVolumeApplicator::CloneWithChannel( plAGChannel *channel
void plSoundVolumeApplicator::Write( hsStream *stream, hsResMgr *mgr ) void plSoundVolumeApplicator::Write( hsStream *stream, hsResMgr *mgr )
{ {
plAGApplicator::Write( stream, mgr ); plAGApplicator::Write( stream, mgr );
stream->WriteSwap32( fIndex ); stream->WriteLE32( fIndex );
} }
void plSoundVolumeApplicator::Read( hsStream *s, hsResMgr *mgr ) void plSoundVolumeApplicator::Read( hsStream *s, hsResMgr *mgr )
{ {
plAGApplicator::Read( s, mgr ); plAGApplicator::Read( s, mgr );
fIndex = s->ReadSwap32(); fIndex = s->ReadLE32();
} }

4
Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp

@ -624,7 +624,7 @@ hsBool plSpeex::Encode(short *data, int numFrames, int *packedLength, hsRAMStrea
frameLength = speex_bits_write(fBits, (char *)frameData, fFrameSize); frameLength = speex_bits_write(fBits, (char *)frameData, fFrameSize);
// write data - length and bytes // write data - length and bytes
out->WriteSwap(frameLength); out->WriteLE(frameLength);
*packedLength += sizeof(frameLength); // add length of encoded frame *packedLength += sizeof(frameLength); // add length of encoded frame
out->Write(frameLength, frameData); out->Write(frameLength, frameData);
*packedLength += frameLength; // update length *packedLength += frameLength; // update length
@ -654,7 +654,7 @@ hsBool plSpeex::Decode(UInt8 *data, int size, int numFrames, int *numOutputBytes
// Decode data // Decode data
for (int i = 0; i < numFrames; i++) for (int i = 0; i < numFrames; i++)
{ {
stream.ReadSwap( &frameLen ); // read the length of the current frame to be decoded stream.ReadLE( &frameLen ); // read the length of the current frame to be decoded
stream.Read( frameLen, frameData ); // read the data stream.Read( frameLen, frameData ); // read the data
memset(speexOutput, 0, fFrameSize * sizeof(float)); memset(speexOutput, 0, fFrameSize * sizeof(float));

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

Loading…
Cancel
Save