Browse Source

Toss old RAM functions

If we really care about system RAM, we should reimplement this in a less
obsolete way--and hopefully update the RAM tiers ;)
Adam Johnson 13 years ago
parent
commit
172b3c6cfb
  1. 7
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 26
      Sources/Plasma/CoreLib/HeadSpin.cpp
  3. 13
      Sources/Plasma/CoreLib/HeadSpin.h
  4. 6
      Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp

7
Sources/Plasma/Apps/plClient/plClient.cpp

@ -2367,18 +2367,13 @@ void plClient::IDetectAudioVideoSettings()
stream = plEncryptedStream::OpenEncryptedFileWrite(audioIniFile); stream = plEncryptedStream::OpenEncryptedFileWrite(audioIniFile);
plAudioCaps caps = plAudioCapsDetector::Detect(false, true); plAudioCaps caps = plAudioCapsDetector::Detect(false, true);
val = 6;
if( (hsPhysicalMemory() < 256) || plProfileManager::Instance().GetProcessorSpeed() < 1350000000)
{
val = 3;
}
char deviceName[256]; char deviceName[256];
sprintf(deviceName, "\"%s\"", DEFAULT_AUDIO_DEVICE_NAME); sprintf(deviceName, "\"%s\"", DEFAULT_AUDIO_DEVICE_NAME);
WriteBool(stream, "Audio.Initialize", caps.IsAvailable()); WriteBool(stream, "Audio.Initialize", caps.IsAvailable());
WriteBool(stream, "Audio.UseEAX", false); WriteBool(stream, "Audio.UseEAX", false);
WriteInt(stream, "Audio.SetPriorityCutoff", val); WriteInt(stream, "Audio.SetPriorityCutoff", 6);
WriteInt(stream, "Audio.MuteAll", false); WriteInt(stream, "Audio.MuteAll", false);
WriteInt(stream, "Audio.SetChannelVolume SoundFX", 1); WriteInt(stream, "Audio.SetChannelVolume SoundFX", 1);
WriteInt(stream, "Audio.SetChannelVolume BgndMusic", 1); WriteInt(stream, "Audio.SetChannelVolume BgndMusic", 1);

26
Sources/Plasma/CoreLib/HeadSpin.cpp

@ -588,32 +588,6 @@ int hsRemove(const char * fname)
return remove(fname); return remove(fname);
} }
uint32_t hsPhysicalMemory()
{
#define HS_ONE_MEGABYTE 1048576 // 1024 * 1024
#if HS_BUILD_FOR_WIN32
MEMORYSTATUS ms;
GlobalMemoryStatus(&ms);
return (ms.dwTotalPhys / HS_ONE_MEGABYTE);
#endif
}
MemSpec hsMemorySpec()
{
uint32_t mem = hsPhysicalMemory();
// Currently adding a little margin of error here
// due to the fact that Windows doesn't seem to
// be totally accurate in it's calculations.
if (mem < 127)
return kBlows;
else if (mem < 255)
return kAcceptable;
else
return kOptimal;
}
// //
// Microsoft SAMPLE CODE // Microsoft SAMPLE CODE
// returns array of allocated version info strings or nil // returns array of allocated version info strings or nil

13
Sources/Plasma/CoreLib/HeadSpin.h

@ -535,19 +535,6 @@ inline float hsRadiansToDegrees(float rad) { return float(rad * (180 / M_PI)); }
# define ALIGN(n) __atribute__(aligned(n)) # define ALIGN(n) __atribute__(aligned(n))
#endif #endif
/////////////////////////////
// Physical memory functions
/////////////////////////////
enum MemSpec
{
kBlows = 0, // Less than 128
kAcceptable, // Less than 256
kOptimal // 256 or greater
};
uint32_t hsPhysicalMemory();
MemSpec hsMemorySpec();
inline int hsRandMax() { return 32767; } inline int hsRandMax() { return 32767; }
inline float hsRandNorm() { return 1.f / 32767.f; } // multiply by hsRand to get randoms ranged [0..1] inline float hsRandNorm() { return 1.f / 32767.f; } // multiply by hsRand to get randoms ranged [0..1]
int hsRand(void); int hsRand(void);

6
Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp

@ -1015,12 +1015,6 @@ void plgAudioSys::Init(hsWindowHndl hWnd)
fSys->RegisterAs( kAudioSystem_KEY ); fSys->RegisterAs( kAudioSystem_KEY );
plgDispatch::Dispatch()->RegisterForExactType( plAudioSysMsg::Index(), fSys->GetKey() ); plgDispatch::Dispatch()->RegisterForExactType( plAudioSysMsg::Index(), fSys->GetKey() );
plgDispatch::Dispatch()->RegisterForExactType( plRenderMsg::Index(), fSys->GetKey() ); plgDispatch::Dispatch()->RegisterForExactType( plRenderMsg::Index(), fSys->GetKey() );
if(hsPhysicalMemory() <= 380)
{
plStatusLog::AddLineS("audio.log", "StreamFromRam Disabled");
fStreamFromRAMCutoff = 4;
}
fWnd = hWnd; fWnd = hWnd;
if(fMuted) if(fMuted)

Loading…
Cancel
Save