Merge branch 'DRTVWR-582-maint-U' of https://github.com/secondlife/viewer

# Conflicts:
#	autobuild.xml
#	indra/cmake/CMakeLists.txt
#	indra/llaudio/llaudioengine_fmodstudio.cpp
#	indra/llcommon/llsdserialize.cpp
#	indra/llcommon/llsdserialize.h
#	indra/llcommon/tests/llleap_test.cpp
#	indra/newview/app_settings/settings.xml
#	indra/newview/llfilepicker_mac.mm
#	indra/newview/llinventorymodel.cpp
#	indra/newview/llstartup.cpp
#	indra/newview/llurldispatcher.cpp
#	indra/newview/llvieweraudio.cpp
#	indra/newview/skins/default/xui/en/menu_viewer.xml
#	indra/newview/skins/default/xui/en/strings.xml
master
Ansariel 2023-04-21 14:22:42 +02:00
commit 9b93864eb9
73 changed files with 651 additions and 514 deletions

18
.github/workflows/pre-commit.yaml vendored Normal file
View File

@ -0,0 +1,18 @@
name: pre-commit
on:
pull_request:
push:
branches: [main, contribute]
tags: [v*]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.0

View File

@ -1,9 +1,8 @@
repos:
- repo: https://bitbucket.org/lindenlab/git-hooks.git
rev: v1.0.0-beta2
- repo: https://github.com/secondlife/git-hooks.git
rev: v1.0.0
hooks:
- id: opensource-license
- id: jira-issue
- id: llsd
- id: no-trigraphs
- id: copyright
@ -11,7 +10,7 @@ repos:
files: \.(cpp|c|h|py|glsl|cmake|txt)$
exclude: language.txt
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
rev: v4.4.0
hooks:
- id: check-xml
- id: mixed-line-ending

View File

@ -672,9 +672,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>7b4aceaed511d44c4d1354b2162b59c7</string>
<string>02b569ac2bd71f201e3dd86ade7b3eeb</string>
<key>url</key>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107398/936936/bugsplat-1.0.7.576560-darwin64-576560.tar.bz2</string>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113876/983684/bugsplat-1.0.7.579696-darwin64-579696.tar.bz2</string>
</map>
<key>name</key>
<string>darwin64</string>
@ -684,9 +684,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>53918c7c74b943cdc0bb90caf9657a84</string>
<string>5b32c47ae8e8cf0d4106f08e8db18044</string>
<key>url</key>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107400/936949/bugsplat-4.0.3.0.576560-windows-576560.tar.bz2</string>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113878/983697/bugsplat-4.0.3.0.579696-windows-579696.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>
@ -696,16 +696,16 @@
<key>archive</key>
<map>
<key>hash</key>
<string>19d6a55db101f02e7eb531daf3e8cfd1</string>
<string>79c005fd8a660f8551b3c9ede64fa4ef</string>
<key>url</key>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/107401/936948/bugsplat-.576560-windows64-576560.tar.bz2</string>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113879/983696/bugsplat-4.0.3.0.579696-windows64-579696.tar.bz2</string>
</map>
<key>name</key>
<string>windows64</string>
</map>
</map>
<key>version</key>
<string>4.0.3.0.576560</string>
<string>4.0.3.0.579696</string>
</map>
<key>colladadom</key>
<map>
@ -3013,16 +3013,6 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>name</key>
<string>windows64</string>
</map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>46edf0f55417f8ef0d33a5c007bc3644</string>
<key>url</key>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/89310/815451/threejs-0.132.2-windows64-564843.tar.bz2</string>
</map>
</map>
</map>
<key>version</key>
<string>0.132.2</string>

View File

@ -70,99 +70,6 @@ set(cmake_SOURCE_FILES
ZLIBNG.cmake
)
00-Common.cmake
APR.cmake
Audio.cmake
Boost.cmake
bugsplat.cmake
BuildVersion.cmake
CEFPlugin.cmake
CMakeCopyIfDifferent.cmake
ColladaDom.cmake
ConfigurePkgConfig.cmake
CURL.cmake
Copy3rdPartyLibs.cmake
GLIB.cmake
DeploySharedLibs.cmake
Discord.cmake # <FS:LO> Discord rich presence
DragDrop.cmake
EXPAT.cmake
FindAPR.cmake
FindAutobuild.cmake
FindFMODSTUDIO.cmake
FindGLH.cmake
FindHUNSPELL.cmake
FindJsonCpp.cmake
FindNDOF.cmake
FindOpenJPEG.cmake
FindSCP.cmake
FindURIPARSER.cmake
FindXmlRpcEpi.cmake
FindZLIBNG.cmake
FMODSTUDIO.cmake
FreeType.cmake
GLEXT.cmake
GLH.cmake
GLOD.cmake
## GStreamer010Plugin.cmake
GoogleMock.cmake
Growl.cmake
Havok.cmake
Hunspell.cmake
JPEG.cmake
JsonCpp.cmake
LLAddBuildTest.cmake
LLAppearance.cmake
LLAudio.cmake
LLCharacter.cmake
LLCommon.cmake
LLCrashLogger.cmake
LLImage.cmake
LLImageJ2COJ.cmake
LLInventory.cmake
LLKDU.cmake
LLLogin.cmake
LLMath.cmake
LLMeshOptimizer.cmake
LLMessage.cmake
LLPhysicsExtensions.cmake
LLPlugin.cmake
LLPrimitive.cmake
LLRender.cmake
LLSharedLibs.cmake
LLTestCommand.cmake
LLUI.cmake
LLFileSystem.cmake
LLWindow.cmake
LLXML.cmake
Linking.cmake
MediaPluginBase.cmake
MESHOPTIMIZER.cmake
NDOF.cmake
OPENAL.cmake
OpenGL.cmake
OpenJPEG.cmake
OpenSSL.cmake
PNG.cmake
PluginAPI.cmake
Prebuilt.cmake
PulseAudio.cmake
Python.cmake
TemplateCheck.cmake
Tracy.cmake
Tut.cmake
UI.cmake
UnixInstall.cmake
URIPARSER.cmake
Variables.cmake
ViewerMiscLibs.cmake
VisualLeakDetector.cmake
LibVLCPlugin.cmake
XmlRpcEpi.cmake
xxHash.cmake
ZLIBNG.cmake
)
source_group("Shared Rules" FILES ${cmake_SOURCE_FILES})
set(master_SOURCE_FILES

View File

@ -217,7 +217,8 @@ std::string LLAudioEngine::getInternetStreamURL()
{
if (mStreamingAudioImpl)
return mStreamingAudioImpl->getURL();
else return std::string();
return std::string();
}
@ -358,42 +359,43 @@ void LLAudioEngine::idle()
}
continue;
}
else
// Check to see if the current sound is done playing.
if (!channelp->isPlaying())
{
// Check to see if the current sound is done playing, or looped.
if (!channelp->isPlaying())
sourcep->mCurrentDatap = sourcep->mQueuedDatap;
sourcep->mQueuedDatap = NULL;
// Reset the timer so the source doesn't die.
sourcep->mAgeTimer.reset();
// Make sure we have the buffer set up if we just decoded the data
if (sourcep->mCurrentDatap)
{
updateBufferForData(sourcep->mCurrentDatap);
}
// Actually play the associated data.
sourcep->setupChannel();
channelp->updateBuffer();
sourcep->getChannel()->play();
continue;
}
// Check to see if the current sound is looped.
if (sourcep->isLoop())
{
// It's a loop, we need to check and see if we're done with it.
if (channelp->mLoopedThisFrame)
{
sourcep->mCurrentDatap = sourcep->mQueuedDatap;
sourcep->mQueuedDatap = NULL;
// Reset the timer so the source doesn't die.
sourcep->mAgeTimer.reset();
// Make sure we have the buffer set up if we just decoded the data
if (sourcep->mCurrentDatap)
{
updateBufferForData(sourcep->mCurrentDatap);
}
// Actually play the associated data.
// Actually, should do a time sync so if we're a loop master/slave
// we don't drift away.
sourcep->setupChannel();
channelp->updateBuffer();
sourcep->getChannel()->play();
}
else if (sourcep->isLoop())
{
// It's a loop, we need to check and see if we're done with it.
if (channelp->mLoopedThisFrame)
{
sourcep->mCurrentDatap = sourcep->mQueuedDatap;
sourcep->mQueuedDatap = NULL;
// Actually, should do a time sync so if we're a loop master/slave
// we don't drift away.
sourcep->setupChannel();
sourcep->getChannel()->play();
}
}
}
}
@ -409,18 +411,11 @@ void LLAudioEngine::idle()
for (source_map::value_type& src_pair : mAllSources)
{
LLAudioSource *sourcep = src_pair.second;
if (sourcep->isMuted())
if (sourcep->isMuted() && sourcep->isSyncMaster() && sourcep->getPriority() > max_sm_priority)
{
continue;
}
if (sourcep->isSyncMaster())
{
if (sourcep->getPriority() > max_sm_priority)
{
sync_masterp = sourcep;
master_channelp = sync_masterp->getChannel();
max_sm_priority = sourcep->getPriority();
}
sync_masterp = sourcep;
master_channelp = sync_masterp->getChannel();
max_sm_priority = sourcep->getPriority();
}
}
@ -755,7 +750,7 @@ F64 LLAudioEngine::mapWindVecToGain(LLVector3 wind_vec)
}
return (gain);
}
}
F64 LLAudioEngine::mapWindVecToPitch(LLVector3 wind_vec)
@ -996,11 +991,10 @@ void LLAudioEngine::cleanupAudioSource(LLAudioSource *asp)
else
{
LL_DEBUGS("AudioEngine") << "Cleaning up audio sources for "<< asp->getID() <<LL_ENDL;
delete asp;
mAllSources.erase(iter);
delete asp;
mAllSources.erase(iter);
}
}
}
bool LLAudioEngine::hasDecodedFile(const LLUUID &uuid)
{
@ -1829,19 +1823,18 @@ void LLAudioChannel::setSource(LLAudioSource *sourcep)
{
LL_DEBUGS("AudioEngine") << "( id: " << sourcep->getID() << ")" << LL_ENDL;
if (sourcep == mCurrentSourcep)
{
// Don't reallocate the channel, this will make FMOD goofy.
//LL_INFOS() << "Calling setSource with same source!" << LL_ENDL;
if (sourcep == mCurrentSourcep)
{
// Don't reallocate the channel, this will make FMOD goofy.
//LL_INFOS() << "Calling setSource with same source!" << LL_ENDL;
}
mCurrentSourcep = sourcep;
updateBuffer();
update3DPosition();
}
mCurrentSourcep = sourcep;
updateBuffer();
update3DPosition();
}
}
bool LLAudioChannel::updateBuffer()
{

View File

@ -95,6 +95,7 @@ public:
// initialization/startup/shutdown
virtual bool init(void *userdata, const std::string &app_title);
virtual std::string getDriverName(bool verbose) = 0;
virtual LLStreamingAudioInterface *createDefaultStreamingAudioImpl() const = 0;
virtual void shutdown();
// Used by the mechanics of the engine
@ -526,13 +527,13 @@ struct SoundData
const LLUUID& owner_id,
const F32 gain,
const S32 type = LLAudioEngine::AUDIO_TYPE_NONE,
const LLVector3d &pos_global = LLVector3d::zero)
const LLVector3d &pos_global = LLVector3d::zero) :
audio_uuid(audio_uuid),
owner_id(owner_id),
gain(gain),
type(type),
pos_global(pos_global)
{
this->audio_uuid = audio_uuid;
this->owner_id = owner_id;
this->gain = gain;
this->type = type;
this->pos_global = pos_global;
}
};

View File

@ -308,10 +308,6 @@ bool LLAudioEngine_FMODSTUDIO::init(void* userdata, const std::string &app_title
Check_FMOD_Error(mSystem->createChannelGroup("Ambient", &mChannelGroups[AUDIO_TYPE_AMBIENT]), "FMOD::System::createChannelGroup");
}
// set up our favourite FMOD-native streaming audio implementation if none has already been added
if (!getStreamingAudioImpl()) // no existing implementation added
setStreamingAudioImpl(new LLStreamingAudio_FMODSTUDIO(mSystem));
LL_INFOS("AppInit") << "LLAudioEngine_FMODSTUDIO::init() FMOD Studio initialized correctly" << LL_ENDL;
FMOD_ADVANCEDSETTINGS settings_dump = { };
@ -395,6 +391,13 @@ std::string LLAudioEngine_FMODSTUDIO::getDriverName(bool verbose)
}
// create our favourite FMOD-native streaming audio implementation
LLStreamingAudioInterface *LLAudioEngine_FMODSTUDIO::createDefaultStreamingAudioImpl() const
{
return new LLStreamingAudio_FMODSTUDIO(mSystem);
}
void LLAudioEngine_FMODSTUDIO::allocateListener(void)
{
try

View File

@ -59,6 +59,7 @@ public:
// initialization/startup/shutdown
virtual bool init(void *user_data, const std::string &app_title);
virtual std::string getDriverName(bool verbose);
virtual LLStreamingAudioInterface* createDefaultStreamingAudioImpl() const;
virtual void allocateListener();
virtual void shutdown();

View File

@ -167,48 +167,34 @@ const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luc
//
// defined for U16, U32, U64, S16, S32, S64, :
// llclampb(a) // clamps a to [0 .. 255]
//
//
template <typename T1, typename T2>
inline auto llmax(T1 d1, T2 d2)
// recursion tail
template <typename T>
inline auto llmax(T data)
{
return (d1 > d2) ? d1 : d2;
return data;
}
template <typename T1, typename T2, typename T3>
inline auto llmax(T1 d1, T2 d2, T3 d3)
template <typename T0, typename T1, typename... Ts>
inline auto llmax(T0 d0, T1 d1, Ts... rest)
{
auto r = llmax(d1,d2);
return llmax(r, d3);
auto maxrest = llmax(d1, rest...);
return (d0 > maxrest)? d0 : maxrest;
}
template <typename T1, typename T2, typename T3, typename T4>
inline auto llmax(T1 d1, T2 d2, T3 d3, T4 d4)
// recursion tail
template <typename T>
inline auto llmin(T data)
{
auto r1 = llmax(d1,d2);
auto r2 = llmax(d3,d4);
return llmax(r1, r2);
return data;
}
template <typename T1, typename T2>
inline auto llmin(T1 d1, T2 d2)
template <typename T0, typename T1, typename... Ts>
inline auto llmin(T0 d0, T1 d1, Ts... rest)
{
return (d1 < d2) ? d1 : d2;
}
template <typename T1, typename T2, typename T3>
inline auto llmin(T1 d1, T2 d2, T3 d3)
{
auto r = llmin(d1,d2);
return (r < d3 ? r : d3);
}
template <typename T1, typename T2, typename T3, typename T4>
inline auto llmin(T1 d1, T2 d2, T3 d3, T4 d4)
{
auto r1 = llmin(d1,d2);
auto r2 = llmin(d3,d4);
return llmin(r1, r2);
auto minrest = llmin(d1, rest...);
return (d0 < minrest) ? d0 : minrest;
}
template <typename A, typename MIN, typename MAX>

View File

@ -96,7 +96,7 @@ LLMD5::LLMD5()
// operation, processing another message block, and updating the
// context.
void LLMD5::update (const uint1 *input, const size_t input_length) {
void LLMD5::update (const uint8_t *input, const size_t input_length) {
size_t input_index, buffer_index;
size_t buffer_space; // how much space is left in buffer
@ -189,7 +189,7 @@ void LLMD5::finalize (){
unsigned char bits[8]; /* Flawfinder: ignore */
size_t index, padLen;
static uint1 PADDING[64]={
static uint8_t PADDING[64]={
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@ -201,8 +201,8 @@ void LLMD5::finalize (){
}
// Save number of bits.
// Treat count, a uint64_t, as uint4[2].
encode (bits, reinterpret_cast<uint4*>(&count), 8);
// Treat count, a uint64_t, as uint32_t[2].
encode (bits, reinterpret_cast<uint32_t*>(&count), 8);
// Pad out to 56 mod 64.
index = size_t((count >> 3) & 0x3f);
@ -412,7 +412,7 @@ Rotation is separate from addition to prevent recomputation.
// LLMD5 basic transformation. Transforms state based on block.
void LLMD5::transform (const U8 block[64]){
uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
decode (x, block, 64);
@ -496,38 +496,38 @@ void LLMD5::transform (const U8 block[64]){
state[3] += d;
// Zeroize sensitive information.
memset ( (uint1 *) x, 0, sizeof(x));
memset ( (uint8_t *) x, 0, sizeof(x));
}
// Encodes input (UINT4) into output (unsigned char). Assumes len is
// Encodes input (uint32_t) into output (unsigned char). Assumes len is
// a multiple of 4.
void LLMD5::encode (uint1 *output, const uint4 *input, const size_t len) {
void LLMD5::encode (uint8_t *output, const uint32_t *input, const size_t len) {
size_t i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (uint1) (input[i] & 0xff);
output[j+1] = (uint1) ((input[i] >> 8) & 0xff);
output[j+2] = (uint1) ((input[i] >> 16) & 0xff);
output[j+3] = (uint1) ((input[i] >> 24) & 0xff);
output[j] = (uint8_t) (input[i] & 0xff);
output[j+1] = (uint8_t) ((input[i] >> 8) & 0xff);
output[j+2] = (uint8_t) ((input[i] >> 16) & 0xff);
output[j+3] = (uint8_t) ((input[i] >> 24) & 0xff);
}
}
// Decodes input (unsigned char) into output (UINT4). Assumes len is
// Decodes input (unsigned char) into output (uint32_t). Assumes len is
// a multiple of 4.
void LLMD5::decode (uint4 *output, const uint1 *input, const size_t len){
void LLMD5::decode (uint32_t *output, const uint8_t *input, const size_t len){
size_t i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) |
(((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24);
output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) |
(((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24);
}

View File

@ -67,6 +67,8 @@ documentation and/or software.
*/
#include <cstdint> // uint32_t et al.
// use for the raw digest output
const int MD5RAW_BYTES = 16;
@ -75,18 +77,13 @@ const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null
const int MD5HEX_STR_BYTES = 32; // message system fixed size
class LL_COMMON_API LLMD5 {
// first, some types:
typedef unsigned int uint4; // assumes integer is 4 words long
typedef unsigned short int uint2; // assumes short integer is 2 words long
typedef unsigned char uint1; // assumes char is 1 word long
// how many bytes to grab at a time when checking files
static const int BLOCK_LEN;
public:
// methods for controlled operation:
LLMD5 (); // simple initializer
void update (const uint1 *input, const size_t input_length);
void update (const uint8_t *input, const size_t input_length);
void update (std::istream& stream);
void update (FILE *file);
void update (const std::string& str);
@ -109,19 +106,19 @@ private:
// next, the private data:
uint4 state[4];
uint32_t state[4];
uint64_t count; // number of *bits*, mod 2^64
uint1 buffer[64]; // input buffer
uint1 digest[16];
uint1 finalized;
uint8_t buffer[64]; // input buffer
uint8_t digest[16];
uint8_t finalized;
// last, the private methods, mostly static:
void init (); // called by all constructors
void transform (const uint1 *buffer); // does the real update work. Note
void transform (const uint8_t *buffer); // does the real update work. Note
// that length is implied to be 64.
static void encode (uint1 *dest, const uint4 *src, const size_t length);
static void decode (uint4 *dest, const uint1 *src, const size_t length);
static void encode (uint8_t *dest, const uint32_t *src, const size_t length);
static void decode (uint32_t *dest, const uint8_t *src, const size_t length);
};

View File

@ -146,7 +146,7 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, llssize max_bytes)
// byte. We could store one if needed, since even the incremented
// inbuf won't exceed sizeof(hdr_buf)-1, but there's no need.
}
std::string header{ hdr_buf, std::string::size_type(inbuf) };
std::string header{ hdr_buf, static_cast<std::string::size_type>(inbuf) };
if (str.fail())
{
str.clear();
@ -2242,7 +2242,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, const U8* in, S32 size)
{
U8* result = NULL;
llssize cur_size = 0;
U32 cur_size = 0;
z_stream strm;
constexpr U32 CHUNK = 1024 * 512;
@ -2448,7 +2448,7 @@ U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size
return result;
}
char* strip_deprecated_header(char* in, llssize& cur_size, llssize* header_size)
char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size)
{
const char* deprecated_header = "<? LLSD/Binary ?>";
constexpr size_t deprecated_header_size = 17;

View File

@ -873,5 +873,5 @@ LL_COMMON_API std::string zip_llsd(LLSD& data);
LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, size_t& outsize,std::istream& is, S32 size);
// returns a pointer to the array or past the array if the deprecated header exists
LL_COMMON_API char* strip_deprecated_header(char* in, llssize& cur_size, llssize* header_size = nullptr);
LL_COMMON_API char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size = nullptr);
#endif // LL_LLSDSERIALIZE_H

View File

@ -577,10 +577,12 @@ S32 Recording::getSampleCount( const StatType<EventAccumulator>& stat )
// PeriodicRecording
///////////////////////////////////////////////////////////////////////
PeriodicRecording::PeriodicRecording( S32 num_periods, EPlayState state)
PeriodicRecording::PeriodicRecording( size_t num_periods, EPlayState state)
: mAutoResize(num_periods == 0),
mCurPeriod(0),
mNumRecordedPeriods(0),
// This guarantee that mRecordingPeriods cannot be empty is essential for
// code in several methods.
mRecordingPeriods(num_periods ? num_periods : 1)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
@ -596,18 +598,19 @@ PeriodicRecording::~PeriodicRecording()
void PeriodicRecording::nextPeriod()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
if (mAutoResize)
{
mRecordingPeriods.push_back(Recording());
}
Recording& old_recording = getCurRecording();
mCurPeriod = (mCurPeriod + 1) % mRecordingPeriods.size();
inci(mCurPeriod);
old_recording.splitTo(getCurRecording());
mNumRecordedPeriods = mRecordingPeriods.empty()? 0 :
llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1);
// Since mRecordingPeriods always has at least one entry, we can always
// safely subtract 1 from its size().
mNumRecordedPeriods = llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1);
}
void PeriodicRecording::appendRecording(Recording& recording)
@ -620,31 +623,29 @@ void PeriodicRecording::appendRecording(Recording& recording)
void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
if (other.mRecordingPeriods.empty()) return;
getCurRecording().update();
other.getCurRecording().update();
const auto other_recording_slots = other.mRecordingPeriods.size();
const auto other_num_recordings = other.getNumRecordedPeriods();
const auto other_current_recording_index = other.mCurPeriod;
const auto other_oldest_recording_index = (other_current_recording_index + other_recording_slots - other_num_recordings) % other_recording_slots;
const auto other_oldest_recording_index = other.previ(other_current_recording_index, other_num_recordings);
// append first recording into our current slot
getCurRecording().appendRecording(other.mRecordingPeriods[other_oldest_recording_index]);
// from now on, add new recordings for everything after the first
auto other_index = (other_oldest_recording_index + 1) % other_recording_slots;
auto other_index = other.nexti(other_oldest_recording_index);
if (mAutoResize)
{
// push back recordings for everything in the middle
auto other_index = (other_oldest_recording_index + 1) % other_recording_slots;
while (other_index != other_current_recording_index)
{
mRecordingPeriods.push_back(other.mRecordingPeriods[other_index]);
other_index = (other_index + 1) % other_recording_slots;
other.inci(other_index);
}
// add final recording, if it wasn't already added as the first
@ -653,36 +654,25 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
mRecordingPeriods.push_back(other.mRecordingPeriods[other_current_recording_index]);
}
mCurPeriod = mRecordingPeriods.empty()? 0 : mRecordingPeriods.size() - 1;
// mRecordingPeriods is never empty()
mCurPeriod = mRecordingPeriods.size() - 1;
mNumRecordedPeriods = mCurPeriod;
}
else
{
S32 num_to_copy = llmin((S32)mRecordingPeriods.size(), (S32)other_num_recordings);
std::vector<Recording>::iterator src_it = other.mRecordingPeriods.begin() + other_index ;
std::vector<Recording>::iterator dest_it = mRecordingPeriods.begin() + mCurPeriod;
auto num_to_copy = llmin(mRecordingPeriods.size(), other_num_recordings);
// already consumed the first recording from other, so start counting at 1
for(S32 i = 1; i < num_to_copy; i++)
for (size_t n = 1, srci = other_index, dsti = mCurPeriod;
n < num_to_copy;
++n, other.inci(srci), inci(dsti))
{
*dest_it = *src_it;
if (++src_it == other.mRecordingPeriods.end())
{
src_it = other.mRecordingPeriods.begin();
}
if (++dest_it == mRecordingPeriods.end())
{
dest_it = mRecordingPeriods.begin();
}
mRecordingPeriods[dsti] = other.mRecordingPeriods[srci];
}
// want argument to % to be positive, otherwise result could be negative and thus out of bounds
llassert(num_to_copy >= 1);
// advance to last recording period copied, and make that our current period
mCurPeriod = (mCurPeriod + num_to_copy - 1) % mRecordingPeriods.size();
inci(mCurPeriod, num_to_copy - 1);
mNumRecordedPeriods = llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + num_to_copy - 1);
}
@ -694,13 +684,11 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
F64Seconds PeriodicRecording::getDuration() const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
F64Seconds duration;
auto num_periods = mRecordingPeriods.size();
for (size_t i = 1; i <= num_periods; i++)
for (size_t n = 0; n < mRecordingPeriods.size(); ++n)
{
auto index = (mCurPeriod + num_periods - i) % num_periods;
duration += mRecordingPeriods[index].getDuration();
duration += mRecordingPeriods[nexti(mCurPeriod, n)].getDuration();
}
return duration;
}
@ -737,16 +725,14 @@ const Recording& PeriodicRecording::getCurRecording() const
Recording& PeriodicRecording::getPrevRecording( size_t offset )
{
auto num_periods = mRecordingPeriods.size();
offset = llclamp(offset, 0, num_periods - 1);
return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods];
// reuse const implementation, but return non-const reference
return const_cast<Recording&>(
const_cast<const PeriodicRecording*>(this)->getPrevRecording(offset));
}
const Recording& PeriodicRecording::getPrevRecording( size_t offset ) const
{
auto num_periods = mRecordingPeriods.size();
offset = llclamp(offset, 0, num_periods - 1);
return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods];
return mRecordingPeriods[previ(mCurPeriod, offset)];
}
void PeriodicRecording::handleStart()
@ -789,14 +775,14 @@ void PeriodicRecording::handleSplitTo(PeriodicRecording& other)
getCurRecording().splitTo(other.getCurRecording());
}
F64 PeriodicRecording::getPeriodMin( const StatType<EventAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMin( const StatType<EventAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
bool has_value = false;
F64 min_val = std::numeric_limits<F64>::max();
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -811,14 +797,14 @@ F64 PeriodicRecording::getPeriodMin( const StatType<EventAccumulator>& stat, siz
: NaN;
}
F64 PeriodicRecording::getPeriodMax( const StatType<EventAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMax( const StatType<EventAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
bool has_value = false;
F64 max_val = std::numeric_limits<F64>::min();
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -834,7 +820,7 @@ F64 PeriodicRecording::getPeriodMax( const StatType<EventAccumulator>& stat, siz
}
// calculates means using aggregates per period
F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -842,7 +828,7 @@ F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, si
F64 mean = 0;
S32 valid_period_count = 0;
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -857,7 +843,7 @@ F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, si
: NaN;
}
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -866,7 +852,7 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulat
F64 sum_of_squares = 0;
S32 valid_period_count = 0;
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -882,14 +868,14 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulat
: NaN;
}
F64 PeriodicRecording::getPeriodMin( const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMin( const StatType<SampleAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
bool has_value = false;
F64 min_val = std::numeric_limits<F64>::max();
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -904,14 +890,14 @@ F64 PeriodicRecording::getPeriodMin( const StatType<SampleAccumulator>& stat, si
: NaN;
}
F64 PeriodicRecording::getPeriodMax(const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/)
F64 PeriodicRecording::getPeriodMax(const StatType<SampleAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
bool has_value = false;
F64 max_val = std::numeric_limits<F64>::min();
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -927,7 +913,7 @@ F64 PeriodicRecording::getPeriodMax(const StatType<SampleAccumulator>& stat, siz
}
F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -935,7 +921,7 @@ F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, s
S32 valid_period_count = 0;
F64 mean = 0;
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -950,13 +936,13 @@ F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, s
: NaN;
}
F64 PeriodicRecording::getPeriodMedian( const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMedian( const StatType<SampleAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
std::vector<F64> buf;
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.getDuration() > (F32Seconds)0.f)
@ -976,7 +962,7 @@ F64 PeriodicRecording::getPeriodMedian( const StatType<SampleAccumulator>& stat,
return F64((buf.size() % 2 == 0) ? (buf[buf.size() / 2 - 1] + buf[buf.size() / 2]) / 2 : buf[buf.size() / 2]);
}
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -985,7 +971,7 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumula
S32 valid_period_count = 0;
F64 sum_of_squares = 0;
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -1002,13 +988,13 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumula
}
F64Kilobytes PeriodicRecording::getPeriodMin( const StatType<MemAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64Kilobytes PeriodicRecording::getPeriodMin( const StatType<MemAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
F64Kilobytes min_val(std::numeric_limits<F64>::max());
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
min_val = llmin(min_val, recording.getMin(stat));
@ -1022,13 +1008,13 @@ F64Kilobytes PeriodicRecording::getPeriodMin(const MemStatHandle& stat, size_t n
return getPeriodMin(static_cast<const StatType<MemAccumulator>&>(stat), num_periods);
}
F64Kilobytes PeriodicRecording::getPeriodMax(const StatType<MemAccumulator>& stat, size_t num_periods /*= S32_MAX*/)
F64Kilobytes PeriodicRecording::getPeriodMax(const StatType<MemAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
F64Kilobytes max_val(0.0);
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
max_val = llmax(max_val, recording.getMax(stat));
@ -1042,14 +1028,14 @@ F64Kilobytes PeriodicRecording::getPeriodMax(const MemStatHandle& stat, size_t n
return getPeriodMax(static_cast<const StatType<MemAccumulator>&>(stat), num_periods);
}
F64Kilobytes PeriodicRecording::getPeriodMean( const StatType<MemAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64Kilobytes PeriodicRecording::getPeriodMean( const StatType<MemAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
F64Kilobytes mean(0);
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
mean += recording.getMean(stat);
@ -1063,7 +1049,7 @@ F64Kilobytes PeriodicRecording::getPeriodMean(const MemStatHandle& stat, size_t
return getPeriodMean(static_cast<const StatType<MemAccumulator>&>(stat), num_periods);
}
F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType<MemAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType<MemAccumulator>& stat, size_t num_periods /*= std::numeric_limits<size_t>::max()*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -1072,7 +1058,7 @@ F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType<MemAc
S32 valid_period_count = 0;
F64 sum_of_squares = 0;
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))

View File

@ -33,6 +33,7 @@
#include "lltimer.h"
#include "lltraceaccumulators.h"
#include "llpointer.h"
#include <limits>
class LLStopWatchControlsMixinCommon
{
@ -330,7 +331,7 @@ namespace LLTrace
: public LLStopWatchControlsMixin<PeriodicRecording>
{
public:
PeriodicRecording(S32 num_periods, EPlayState state = STOPPED);
PeriodicRecording(size_t num_periods, EPlayState state = STOPPED);
~PeriodicRecording();
void nextPeriod();
@ -353,7 +354,7 @@ namespace LLTrace
Recording snapshotCurRecording() const;
template <typename T>
auto getSampleCount(const StatType<T>& stat, size_t num_periods = S32_MAX)
auto getSampleCount(const StatType<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -373,14 +374,14 @@ namespace LLTrace
// catch all for stats that have a defined sum
template <typename T>
typename T::value_t getPeriodMin(const StatType<T>& stat, size_t num_periods = S32_MAX)
typename T::value_t getPeriodMin(const StatType<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
bool has_value = false;
typename T::value_t min_val(std::numeric_limits<typename T::value_t>::max());
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -396,39 +397,39 @@ namespace LLTrace
}
template<typename T>
T getPeriodMin(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
T getPeriodMin(const CountStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMin(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
F64 getPeriodMin(const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodMin(const StatType<SampleAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template<typename T>
T getPeriodMin(const SampleStatHandle<T>& stat, size_t num_periods = S32_MAX)
T getPeriodMin(const SampleStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMin(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
}
F64 getPeriodMin(const StatType<EventAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodMin(const StatType<EventAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template<typename T>
T getPeriodMin(const EventStatHandle<T>& stat, size_t num_periods = S32_MAX)
T getPeriodMin(const EventStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMin(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
}
F64Kilobytes getPeriodMin(const StatType<MemAccumulator>& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMin(const StatType<MemAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
F64Kilobytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const StatType<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const StatType<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
typename RelatedTypes<typename T::value_t>::fractional_t min_val(std::numeric_limits<F64>::max());
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
min_val = llmin(min_val, recording.getPerSec(stat));
@ -437,7 +438,7 @@ namespace LLTrace
}
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMinPerSec(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMinPerSec(const CountStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMinPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
@ -449,14 +450,14 @@ namespace LLTrace
// catch all for stats that have a defined sum
template <typename T>
typename T::value_t getPeriodMax(const StatType<T>& stat, size_t num_periods = S32_MAX)
typename T::value_t getPeriodMax(const StatType<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
bool has_value = false;
typename T::value_t max_val(std::numeric_limits<typename T::value_t>::min());
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.hasValue(stat))
@ -472,39 +473,39 @@ namespace LLTrace
}
template<typename T>
T getPeriodMax(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
T getPeriodMax(const CountStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMax(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
F64 getPeriodMax(const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodMax(const StatType<SampleAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template<typename T>
T getPeriodMax(const SampleStatHandle<T>& stat, size_t num_periods = S32_MAX)
T getPeriodMax(const SampleStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMax(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
}
F64 getPeriodMax(const StatType<EventAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodMax(const StatType<EventAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template<typename T>
T getPeriodMax(const EventStatHandle<T>& stat, size_t num_periods = S32_MAX)
T getPeriodMax(const EventStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMax(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
}
F64Kilobytes getPeriodMax(const StatType<MemAccumulator>& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMax(const StatType<MemAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
F64Kilobytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const StatType<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const StatType<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
F64 max_val = std::numeric_limits<F64>::min();
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
max_val = llmax(max_val, recording.getPerSec(stat));
@ -513,7 +514,7 @@ namespace LLTrace
}
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMaxPerSec(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMaxPerSec(const CountStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMaxPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
@ -525,14 +526,14 @@ namespace LLTrace
// catch all for stats that have a defined sum
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMean(const StatType<T >& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMean(const StatType<T >& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
typename RelatedTypes<typename T::value_t>::fractional_t mean(0);
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.getDuration() > (F32Seconds)0.f)
@ -546,39 +547,39 @@ namespace LLTrace
}
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMean(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMean(const CountStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
F64 getPeriodMean(const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodMean(const StatType<SampleAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMean(const SampleStatHandle<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMean(const SampleStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
}
F64 getPeriodMean(const StatType<EventAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodMean(const StatType<EventAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMean(const EventStatHandle<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMean(const EventStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
}
F64Kilobytes getPeriodMean(const StatType<MemAccumulator>& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMean(const StatType<MemAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
F64Kilobytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const StatType<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const StatType<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
typename RelatedTypes<typename T::value_t>::fractional_t mean = 0;
for (S32 i = 1; i <= num_periods; i++)
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.getDuration() > (F32Seconds)0.f)
@ -593,64 +594,64 @@ namespace LLTrace
}
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMeanPerSec(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMeanPerSec(const CountStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMeanPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
F64 getPeriodMedian( const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodMedian( const StatType<SampleAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMedianPerSec(const StatType<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMedianPerSec(const StatType<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
std::vector <typename RelatedTypes<typename T::value_t>::fractional_t> buf;
for (S32 i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.getDuration() > (F32Seconds)0.f)
{
buf.push_back(recording.getPerSec(stat));
}
}
std::sort(buf.begin(), buf.end());
std::vector <typename RelatedTypes<typename T::value_t>::fractional_t> buf;
for (size_t i = 1; i <= num_periods; i++)
{
Recording& recording = getPrevRecording(i);
if (recording.getDuration() > (F32Seconds)0.f)
{
buf.push_back(recording.getPerSec(stat));
}
}
std::sort(buf.begin(), buf.end());
return typename RelatedTypes<T>::fractional_t((buf.size() % 2 == 0) ? (buf[buf.size() / 2 - 1] + buf[buf.size() / 2]) / 2 : buf[buf.size() / 2]);
}
return typename RelatedTypes<T>::fractional_t((buf.size() % 2 == 0) ? (buf[buf.size() / 2 - 1] + buf[buf.size() / 2]) / 2 : buf[buf.size() / 2]);
}
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMedianPerSec(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMedianPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMedianPerSec(const CountStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMedianPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
//
// PERIODIC STANDARD DEVIATION
//
F64 getPeriodStandardDeviation(const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodStandardDeviation(const StatType<SampleAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const SampleStatHandle<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const SampleStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
}
F64 getPeriodStandardDeviation(const StatType<EventAccumulator>& stat, size_t num_periods = S32_MAX);
F64 getPeriodStandardDeviation(const StatType<EventAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const EventStatHandle<T>& stat, size_t num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const EventStatHandle<T>& stat, size_t num_periods = std::numeric_limits<size_t>::max())
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
}
F64Kilobytes getPeriodStandardDeviation(const StatType<MemAccumulator>& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodStandardDeviation(const StatType<MemAccumulator>& stat, size_t num_periods = std::numeric_limits<size_t>::max());
F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = std::numeric_limits<size_t>::max());
private:
// implementation for LLStopWatchControlsMixin
@ -659,6 +660,35 @@ namespace LLTrace
/*virtual*/ void handleReset();
/*virtual*/ void handleSplitTo(PeriodicRecording& other);
// helper methods for wraparound ring-buffer arithmetic
inline
size_t wrapi(size_t i) const
{
return i % mRecordingPeriods.size();
}
inline
size_t nexti(size_t i, size_t offset=1) const
{
return wrapi(i + offset);
}
inline
size_t previ(size_t i, size_t offset=1) const
{
auto num_periods = mRecordingPeriods.size();
// constrain offset
offset = llclamp(offset, 0, num_periods - 1);
// add size() so expression can't go (unsigned) "negative"
return wrapi(i + num_periods - offset);
}
inline
void inci(size_t& i, size_t offset=1) const
{
i = nexti(i, offset);
}
private:
std::vector<Recording> mRecordingPeriods;
const bool mAutoResize;

View File

@ -109,7 +109,12 @@ namespace tut
"import os\n"
"import sys\n"
"\n"
"from llbase import llsd\n"
"try:\n"
// new freestanding llsd package
" import llsd\n"
"except ImportError:\n"
// older llbase.llsd module
" from llbase import llsd\n"
"\n"
"class ProtocolError(Exception):\n"
" def __init__(self, msg, data):\n"

View File

@ -276,7 +276,7 @@ namespace tut
// why does LLSDSerialize::deserialize() reverse the parse() params??
mParser = [parser](std::istream& istr, LLSD& data, llssize max_bytes)
{
return (parser(data, istr, max_bytes) > 0);
return parser(data, istr, max_bytes);
};
}

View File

@ -240,6 +240,12 @@
<string>NoAudio</string>
</map>
<key>nofmod</key>
<map>
<key>map-to</key>
<string>UseMediaPluginsForStreamingAudio</string>
</map>
<key>noninteractive</key>
<map>
<key>desc</key>

View File

@ -9882,6 +9882,17 @@
<key>Backup</key>
<integer>0</integer>
</map>
<key>UseMediaPluginsForStreamingAudio</key>
<map>
<key>Comment</key>
<string>Use media plugins (VLC) for streaming audio.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>NoHardwareProbe</key>
<map>
<key>Comment</key>
@ -14489,11 +14500,11 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>ShowBanLines</key>
<map>
<key>Comment</key>
<string>Show in-world ban/access borders</string>
<string>Show in-world ban/access borders, 0 - do not show, 1 - show on collision, 2 - show on proximity</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<string>S32</string>
<key>Value</key>
<integer>1</integer>
</map>

View File

@ -96,7 +96,7 @@ public:
// requests will be throttled from a non-trusted browser
LLObjectIMHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params.size() < 1)
{

View File

@ -1437,7 +1437,7 @@ public:
}
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params.size() < 2)
{

View File

@ -847,7 +847,7 @@ public:
LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_THROTTLE) { }
// Your code here
bool handle(const LLSD& tokens, const LLSD& query_map,
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid,
LLMediaCtrl* web)
{
bool retval = false;

View File

@ -95,7 +95,7 @@ class LLLoginLocationAutoHandler : public LLCommandHandler
public:
// don't allow from external browsers
LLLoginLocationAutoHandler() : LLCommandHandler("location_login", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
{

View File

@ -46,7 +46,7 @@ public:
// not allowed from outside the app
FSSlurlCommandHandler() : LLCommandHandler("firestorm", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params.size() < 2)
{
@ -253,7 +253,7 @@ public:
// not allowed from outside the app
FSHelpSlurlCommandHandler() : LLCommandHandler("fshelp", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params.size() < 2)
{

View File

@ -35,6 +35,7 @@
#include "llcommandhandler.h"
#include "llslurl.h"
#include "llurldispatcher.h"
#include "llviewernetwork.h"
#include "llviewerobject.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
@ -153,7 +154,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
params.append(event_data["x"]);
params.append(event_data["y"]);
params.append(event_data["z"]);
LLCommandDispatcher::dispatch("teleport", params, LLSD(), NULL, "clicked", true);
LLCommandDispatcher::dispatch("teleport", params, LLSD(), LLGridManager::getInstance()->getGrid(), NULL, "clicked", true);
// *TODO - lookup other LLCommandHandlers for "agent", "classified", "event", "group", "floater", "parcel", "login", login_refresh", "balance", "chat"
// should we just compose LLCommandHandler and LLDispatchListener?
}

View File

@ -156,7 +156,10 @@ public:
// requests will be throttled from a non-trusted browser
LLAppearanceHandler() : LLCommandHandler("appearance", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
// support secondlife:///app/appearance/show, but for now we just
// make all secondlife:///app/appearance SLapps behave this way
@ -5042,8 +5045,10 @@ public:
// not allowed from outside the app
LLWearFolderHandler() : LLCommandHandler("wear_folder", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
LLSD::UUID folder_uuid;

View File

@ -45,7 +45,7 @@ public:
// requests will be throttled from a non-trusted browser
LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
std::string action( "" );
if ( params.size() >= 1 )

View File

@ -88,7 +88,7 @@ public:
// requests will be throttled from a non-trusted browser
LLObjectIMHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params.size() < 1)
{

View File

@ -65,7 +65,7 @@ class LLObjectHandler : public LLCommandHandler
public:
LLObjectHandler() : LLCommandHandler("object", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params.size() < 2) return false;

View File

@ -64,7 +64,7 @@ void LLCommandDispatcherListener::dispatch(const LLSD& params) const
// But for testing, allow a caller to specify untrusted.
trusted_browser = params["trusted"].asBoolean();
}
LLCommandDispatcher::dispatch(params["cmd"], params["params"], params["query"], NULL,
LLCommandDispatcher::dispatch(params["cmd"], params["params"], params["query"], "", NULL,
"clicked", trusted_browser);
}

View File

@ -60,6 +60,7 @@ public:
bool dispatch(const std::string& cmd,
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web,
const std::string& nav_type,
bool trusted_browser);
@ -96,6 +97,7 @@ void LLCommandHandlerRegistry::add(const char* cmd,
bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web,
const std::string& nav_type,
bool trusted_browser)
@ -163,7 +165,7 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
}
}
if (!info.mHandler) return false;
return info.mHandler->handle(params, query_map, web);
return info.mHandler->handle(params, query_map, grid, web);
}
void LLCommandHandlerRegistry::notifySlurlBlocked()
@ -218,12 +220,13 @@ LLCommandHandler::~LLCommandHandler()
bool LLCommandDispatcher::dispatch(const std::string& cmd,
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web,
const std::string& nav_type,
bool trusted_browser)
{
return LLCommandHandlerRegistry::instance().dispatch(
cmd, params, query_map, web, nav_type, trusted_browser);
cmd, params, query_map, grid, web, nav_type, trusted_browser);
}
static std::string lookup(LLCommandHandler::EUntrustedAccess value);

View File

@ -42,7 +42,7 @@ public:
LLFooHandler() : LLCommandHandler("foo", UNTRUSTED_BLOCK) { }
// Your code here
bool handle(const LLSD& tokens, const LLSD& query_map,
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid,
LLMediaCtrl* web)
{
if (tokens.size() < 1) return false;
@ -88,6 +88,7 @@ public:
virtual bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web) = 0;
// For URL secondlife:///app/foo/bar/baz?cat=1&dog=2
// @params - array of "bar", "baz", possibly empty
@ -104,6 +105,7 @@ public:
static bool dispatch(const std::string& cmd,
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web,
const std::string& nav_type,
bool trusted_browser);

View File

@ -47,8 +47,10 @@ class LLEventHandler : public LLCommandHandler
public:
// requires trusted browser to trigger
LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 2)
{

View File

@ -71,7 +71,7 @@ NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned
return panel;
}
std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::string>* allowed_types,
std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::string>* allowed_types,
unsigned int flags)
{
std::unique_ptr<std::vector<std::string>> outfiles;
@ -103,7 +103,6 @@ std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::st
}
}
}
return outfiles;
}
@ -150,7 +149,7 @@ void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
}
}
std::unique_ptr<std::string> doSaveDialog(const std::string* file,
std::unique_ptr<std::string> doSaveDialog(const std::string* file,
const std::string* type,
const std::string* creator,
const std::string* extension,

View File

@ -92,8 +92,10 @@ class LLExperienceHandler : public LLCommandHandler
public:
LLExperienceHandler() : LLCommandHandler("experience", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if(params.size() != 2 || params[1].asString() != "profile")
return false;

View File

@ -49,7 +49,7 @@ LLFloater* get_parent_floater(LLView* view)
}
bool LLFloaterHandler::handle(const LLSD &params, const LLSD &query_map, LLMediaCtrl *web)
bool LLFloaterHandler::handle(const LLSD &params, const LLSD &query_map, const std::string& grid, LLMediaCtrl *web)
{
if (params.size() < 1) return false;
LLFloater* floater = NULL;

View File

@ -33,7 +33,7 @@ class LLFloaterHandler
{
public:
LLFloaterHandler() : LLCommandHandler("floater", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web);
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web);
};
#endif

View File

@ -964,8 +964,10 @@ public:
LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { }
// Your code here
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
bool retval = false;
// Need at least 2 tokens to have a valid message.

View File

@ -49,7 +49,7 @@ class LLSearchHandler : public LLCommandHandler
public:
// requires trusted browser to trigger
LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_CLICK_ONLY) { }
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableSearch"))
{

View File

@ -132,8 +132,10 @@ public:
// requires trusted browser to trigger
LLWorldMapHandler() : LLCommandHandler("worldmap", UNTRUSTED_CLICK_ONLY ) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
// <FS:Ansariel> FIRE-17927: Viewer crashes when opening worldmap SLURL command from login panel
if (LLStartUp::getStartupState() < STATE_STARTED)
@ -178,7 +180,10 @@ public:
{
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
{

View File

@ -885,6 +885,12 @@ void LLViewerParcelMgr::renderCollisionSegments(U8* segments, BOOL use_pass, LLV
gGL.end();
}
void LLViewerParcelMgr::resetCollisionTimer()
{
mCollisionTimer.reset();
mRenderCollision = TRUE;
}
void draw_line_cube(F32 width, const LLVector3& center)
{
width = 0.5f * width;

View File

@ -94,8 +94,10 @@ public:
return true;
}
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_STARTED)
{

View File

@ -223,8 +223,7 @@ bool contains_nocopy_items(const LLUUID& id)
return false;
}
// Generates a string containing the path to the item specified by
// item_id.
// Generates a string containing the path to the item specified by id.
void append_path(const LLUUID& id, std::string& path)
{
std::string temp;
@ -244,6 +243,36 @@ void append_path(const LLUUID& id, std::string& path)
path.append(temp);
}
// Generates a string containing the path name of the object.
std::string make_path(const LLInventoryObject* object)
{
std::string path;
append_path(object->getUUID(), path);
return path + "/" + object->getName();
}
// Generates a string containing the path name of the object specified by id.
std::string make_inventory_path(const LLUUID& id)
{
if (LLInventoryObject* object = gInventory.getObject(id))
return make_path(object);
return "";
}
// Generates a string containing the path name and id of the object.
std::string make_info(const LLInventoryObject* object)
{
return "'" + make_path(object) + "' (" + object->getUUID().asString() + ")";
}
// Generates a string containing the path name and id of the object specified by id.
std::string make_inventory_info(const LLUUID& id)
{
if (LLInventoryObject* object = gInventory.getObject(id))
return make_info(object);
return "<Inventory object not found!> (" + id.asString() + ")";
}
void update_marketplace_folder_hierarchy(const LLUUID cat_id)
{
// When changing the marketplace status of a folder, the only thing that needs to happen is
@ -1542,6 +1571,7 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
if (copy)
{
// Copy the item
LL_INFOS("SLM") << "Copy item '" << make_info(viewer_inv_item) << "' to '" << make_inventory_path(dest_folder) << "'" << LL_ENDL;
LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, dest_folder));
copy_inventory_item(
gAgent.getID(),
@ -1553,6 +1583,7 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
}
else
{
LL_INFOS("SLM") << "Move item '" << make_info(viewer_inv_item) << "' to '" << make_inventory_path(dest_folder) << "'" << LL_ENDL;
// Reparent the item
gInventory.changeItemParent(viewer_inv_item, dest_folder, true);
}
@ -1599,6 +1630,7 @@ bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUU
}
else
{
LL_INFOS("SLM") << "Move category " << make_info(viewer_inv_cat) << " to '" << make_inventory_path(dest_folder) << "'" << LL_ENDL;
// Reparent the folder
gInventory.changeCategoryParent(viewer_inv_cat, dest_folder, false);
// Check the destination folder recursively for no copy items and promote the including folders if any

View File

@ -85,9 +85,19 @@ void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory*
void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& root_copy_id, bool move_no_copy_items);
// Generates a string containing the path to the item specified by item_id.
// Generates a string containing the path to the object specified by id (not including the object name).
void append_path(const LLUUID& id, std::string& path);
// Generates a string containing the path name of the object.
std::string make_path(const LLInventoryObject* object);
// Generates a string containing the path name of the object specified by id.
std::string make_inventory_path(const LLUUID& id);
// Generates a string containing the path name and id of the object.
std::string make_info(const LLInventoryObject* object);
// Generates a string containing the path name and id of the object specified by id.
std::string make_inventory_info(const LLUUID& id);
typedef boost::function<void(std::string& validation_message, S32 depth, LLError::ELevel log_level)> validation_callback_t;
bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size = 1, bool from_paste = false);

View File

@ -758,6 +758,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
const std::string& pname,
inventory_func_type callback)
{
LL_DEBUGS(LOG_INV) << "Create '" << pname << "' in '" << make_inventory_path(parent_id) << "'" << LL_ENDL;
LLUUID id;
if (!isInventoryUsable())
{
@ -849,6 +850,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
cat->packMessage(msg);
gAgent.sendReliableMessage();
LL_INFOS(LOG_INV) << "Created new category '" << make_inventory_path(id) << "'" << LL_ENDL;
// return the folder id of the newly created folder
return id;
}
@ -1498,6 +1500,7 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id);
if(cat && (cat->getParentUUID() != cat_id))
{
LL_DEBUGS(LOG_INV) << "Move category '" << make_path(cat) << "' to '" << make_inventory_path(cat_id) << "'" << LL_ENDL;
cat_array_t* cat_array;
cat_array = getUnlockedCatArray(cat->getParentUUID());
if(cat_array) vector_replace_with_last(*cat_array, cat);
@ -1510,6 +1513,7 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
LLPointer<LLViewerInventoryItem> item = getItem(object_id);
if(item && (item->getParentUUID() != cat_id))
{
LL_DEBUGS(LOG_INV) << "Move item '" << make_path(item) << "' to '" << make_inventory_path(cat_id) << "'" << LL_ENDL;
item_array_t* item_array;
item_array = getUnlockedItemArray(item->getParentUUID());
if(item_array) vector_replace_with_last(*item_array, item);
@ -1528,14 +1532,14 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item,
{
if (item->getParentUUID() == new_parent_id)
{
LL_DEBUGS(LOG_INV) << "'" << item->getName() << "' (" << item->getUUID()
<< ") is already in folder " << new_parent_id << LL_ENDL;
LL_DEBUGS(LOG_INV) << make_info(item) << " is already in folder " << make_inventory_info(new_parent_id) << LL_ENDL;
}
else
{
LL_INFOS(LOG_INV) << "Moving '" << item->getName() << "' (" << item->getUUID()
<< ") from " << item->getParentUUID() << " to folder "
<< new_parent_id << LL_ENDL;
LL_INFOS(LOG_INV) << "Move item " << make_info(item)
<< " from " << make_inventory_info(item->getParentUUID())
<< " to " << make_inventory_info(new_parent_id) << LL_ENDL;
// <FS> Locked folder
if ((isObjectDescendentOf(item->getUUID(), AOEngine::instance().getAOFolder())
@ -1594,6 +1598,10 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat,
}
// </FS>
LL_INFOS(LOG_INV) << "Move category " << make_info(cat)
<< " from " << make_inventory_info(cat->getParentUUID())
<< " to " << make_inventory_info(new_parent_id) << LL_ENDL;
LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
update.push_back(old_folder);

View File

@ -90,6 +90,7 @@ void LLLoginHandler::parse(const LLSD& queryMap)
bool LLLoginHandler::handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
// do nothing if we are already logged in

View File

@ -35,7 +35,7 @@ class LLLoginHandler : public LLCommandHandler
public:
// allow from external browsers
LLLoginHandler() : LLCommandHandler("login", UNTRUSTED_ALLOW) { }
/*virtual*/ bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web);
/*virtual*/ bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web);
// Fill in our internal fields from a SLURL like
// secondlife:///app/login?first=Bob&last=Dobbs

View File

@ -1970,12 +1970,10 @@ EMeshProcessingResult LLMeshRepoThread::headerReceived(const LLVolumeParams& mes
U32 header_size = 0;
if (data_size > 0)
{
llssize dsize = data_size;
llssize header_size_tmp{};
char* result_ptr = strip_deprecated_header((char*)data, dsize, &header_size_tmp);
header_size = static_cast<U32>(header_size_tmp);
U32 dsize = data_size;
char* result_ptr = strip_deprecated_header((char*)data, dsize, &header_size);
data_size = static_cast<S32>(dsize);
data_size = dsize;
boost::iostreams::stream<boost::iostreams::array_source> stream(result_ptr, data_size);

View File

@ -1894,7 +1894,7 @@ class LLMetricSystemHandler : public LLCommandHandler
public:
LLMetricSystemHandler() : LLCommandHandler("metricsystem", UNTRUSTED_CLICK_ONLY) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
// change height units TRUE for meters and FALSE for feet
BOOL new_value = (gSavedSettings.getBOOL("HeightUnits") == FALSE) ? TRUE : FALSE;

View File

@ -99,7 +99,7 @@ class LLLoginLocationAutoHandler : public LLCommandHandler
public:
// don't allow from external browsers
LLLoginLocationAutoHandler() : LLCommandHandler("location_login", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
{

View File

@ -98,8 +98,10 @@ class LLParcelHandler : public LLCommandHandler
public:
// requires trusted browser to trigger
LLParcelHandler() : LLCommandHandler("parcel", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 2)
{

View File

@ -473,8 +473,10 @@ public:
// requires trusted browser to trigger
LLProfileHandler() : LLCommandHandler("profile", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 1) return false;
std::string agent_name = params[0];
@ -521,8 +523,10 @@ public:
return false;
}
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 2) return false;
LLUUID avatar_id;
@ -651,9 +655,9 @@ public:
// requires trusted browser to trigger
FSAgentSelfHandler() : LLCommandHandler("agentself", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
return gAgentHandler.handle(params, query_map, web);
return gAgentHandler.handle(params, query_map, grid, web);
}
};
FSAgentSelfHandler gAgentSelfHandler;

View File

@ -108,7 +108,7 @@ public:
return true;
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_STARTED)
{

View File

@ -89,8 +89,10 @@ public:
return true;
}
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_STARTED)
{

View File

@ -38,7 +38,7 @@ public:
{
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAvatarShare"))
{

View File

@ -1019,9 +1019,22 @@ bool idle_startup()
#else
void* window_handle = NULL;
#endif
bool init = gAudiop->init(window_handle, LLAppViewer::instance()->getSecondLifeTitle());
if(init)
if (gAudiop->init(window_handle, LLAppViewer::instance()->getSecondLifeTitle()))
{
if (FALSE == gSavedSettings.getBOOL("UseMediaPluginsForStreamingAudio"))
{
LL_INFOS("AppInit") << "Using default impl to render streaming audio" << LL_ENDL;
gAudiop->setStreamingAudioImpl(gAudiop->createDefaultStreamingAudioImpl());
}
// if the audio engine hasn't set up its own preferred handler for streaming audio
// then set up the generic streaming audio implementation which uses media plugins
if (NULL == gAudiop->getStreamingAudioImpl())
{
LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL;
gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins());
}
// <FS:Ansariel> Output device selection
gAudiop->setDevice(LLUUID(gSavedSettings.getString("FSOutputDeviceUUID")));
@ -1033,16 +1046,6 @@ bool idle_startup()
delete gAudiop;
gAudiop = NULL;
}
if (gAudiop)
{
// if the audio engine hasn't set up its own preferred handler for streaming audio then set up the generic streaming audio implementation which uses media plugins
if (NULL == gAudiop->getStreamingAudioImpl())
{
LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL;
gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins());
}
}
}
}

View File

@ -1781,7 +1781,7 @@ class LLBalanceHandler : public LLCommandHandler
public:
// Requires "trusted" browser/URL source
LLBalanceHandler() : LLCommandHandler("balance", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (tokens.size() == 1
&& tokens[0].asString() == "request")

View File

@ -103,6 +103,8 @@ private:
// Called by LLWorldMap when a region name has been resolved to a
// location in-world, used by places-panel display.
static bool handleGrid(const LLSLURL& slurl);
friend class LLTeleportHandler;
};
@ -186,7 +188,7 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl,
}
bool handled = LLCommandDispatcher::dispatch(
slurl.getAppCmd(), path, query_map, web, nav_type, trusted_browser);
slurl.getAppCmd(), path, query_map, slurl.getGrid(), web, nav_type, trusted_browser);
// </FS:AW handle hop app teleports properly>
// alert if we didn't handle this secondlife:///app/ SLURL
@ -219,6 +221,11 @@ bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string
return true;
}
// <FS:AW hypergrid support >
// if (!handleGrid(slurl))
// {
// return true;
// }
// LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
//
// LLURLDispatcherImpl::regionNameCallback,
@ -265,6 +272,31 @@ void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& s
}
}
bool LLURLDispatcherImpl::handleGrid(const LLSLURL& slurl)
{
if (LLGridManager::getInstance()->getGrid(slurl.getGrid())
!= LLGridManager::getInstance()->getGrid())
{
LLSD args;
args["SLURL"] = slurl.getLocationString();
args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
std::string grid_label =
LLGridManager::getInstance()->getGridLabel(slurl.getGrid());
if (!grid_label.empty())
{
args["GRID"] = grid_label;
}
else
{
args["GRID"] = slurl.getGrid();
}
LLNotificationsUtil::add("CantTeleportToGrid", args);
return false;
}
return true;
}
/* static */
void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{
@ -339,8 +371,10 @@ public:
&LLTeleportHandler::from_event);
}
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
// construct a "normal" SLURL, resolve the region to
// a global position, and teleport to it
@ -350,19 +384,19 @@ public:
#ifdef OPENSIM
LLSLURL slurl(tokens, true);
std::string grid = slurl.getGrid();
std::string gatekeeper = LLGridManager::getInstance()->getGatekeeper(grid);
std::string url_grid = slurl.getGrid();
std::string gatekeeper = LLGridManager::getInstance()->getGatekeeper(url_grid);
std::string region_name = slurl.getRegion();
std::string dest;
std::string current = LLGridManager::getInstance()->getGrid();
if ((grid != current) && (!LLGridManager::getInstance()->isInOpenSim() || (!slurl.getHypergrid() && gatekeeper.empty())))
if ((url_grid != current) && (!LLGridManager::getInstance()->isInOpenSim() || (!slurl.getHypergrid() && gatekeeper.empty())))
{
dest = slurl.getSLURLString();
if (!dest.empty())
{
LLSD args;
args["SLURL"] = dest;
args["GRID"] = grid;
args["GRID"] = url_grid;
args["CURRENT_GRID"] = current;
LLNotificationsUtil::add("CantTeleportToGrid", args);
return true;
@ -397,7 +431,7 @@ public:
std::string region_name = LLURI::unescape(tokens[0]);
std::string callback_url = LLSLURL(region_name, coords).getSLURLString();
std::string callback_url = LLSLURL(url_grid, region_name, coords).getSLURLString();
#endif // OPENSIM
// </FS:AW optional opensim support>

View File

@ -97,7 +97,13 @@ void LLViewerAudio::startInternetStreamWithAutoFade(const std::string &streamURI
// </FS:CR>
}
// Record the URI we are going to be switching to
if (!gAudiop)
{
LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
return;
}
// Record the URI we are going to be switching to
mNextStreamURI = streamURI;
// <FS:Ansariel> Optional audio stream fading
@ -111,11 +117,6 @@ void LLViewerAudio::startInternetStreamWithAutoFade(const std::string &streamURI
switch (mFadeState)
{
case FADE_IDLE:
if (!gAudiop)
{
LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
break;
}
// If a stream is playing fade it out first
if (!gAudiop->getInternetStreamURL().empty())
{
@ -128,28 +129,28 @@ void LLViewerAudio::startInternetStreamWithAutoFade(const std::string &streamURI
mFadeState = FADE_IN;
LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
if(stream && stream->supportsAdjustableBufferSizes())
stream->setBufferSizes(gSavedSettings.getU32("FMODStreamBufferSize"),gSavedSettings.getU32("FMODDecodeBufferSize"));
if (stream && stream->supportsAdjustableBufferSizes())
stream->setBufferSizes(gSavedSettings.getU32("FMODStreamBufferSize"), gSavedSettings.getU32("FMODDecodeBufferSize"));
gAudiop->startInternetStream(mNextStreamURI);
startFading();
registerIdleListener();
break;
}
startFading();
break;
case FADE_OUT:
startFading();
registerIdleListener();
break;
case FADE_IN:
registerIdleListener();
break;
default:
LL_WARNS() << "Unknown fading state: " << mFadeState << LL_ENDL;
break;
return;
}
registerIdleListener();
}
// A return of false from onIdleUpdate means it will be called again next idle update.
@ -263,15 +264,12 @@ void LLViewerAudio::startFading()
// This minimum fade time prevents divide by zero and negative times
const F32 AUDIO_MUSIC_MINIMUM_FADE_TIME = 0.01f;
if(mDone)
if (mDone)
{
// The fade state here should only be one of FADE_IN or FADE_OUT, but, in case it is not,
// rather than check for both states assume a fade in and check for the fade out case.
mFadeTime = AUDIO_MUSIC_FADE_IN_TIME;
if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT)
{
mFadeTime = AUDIO_MUSIC_FADE_OUT_TIME;
}
mFadeTime = LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT ?
AUDIO_MUSIC_FADE_OUT_TIME : AUDIO_MUSIC_FADE_IN_TIME;
// Prevent invalid fade time
mFadeTime = llmax(mFadeTime, AUDIO_MUSIC_MINIMUM_FADE_TIME);

View File

@ -326,6 +326,7 @@ public:
bool handle(
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web) override
{
if (params.size() != 1)

View File

@ -46,7 +46,7 @@ public:
// requests will be throttled from a non-trusted browser
LLHelpHandler() : LLCommandHandler("help", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
LLViewerHelp* vhelp = LLViewerHelp::getInstance();
if (! vhelp)

View File

@ -237,8 +237,10 @@ public:
// requires trusted browser to trigger
LLInventoryHandler() : LLCommandHandler("inventory", UNTRUSTED_CLICK_ONLY) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 1)
{

View File

@ -11593,6 +11593,25 @@ class LLWorldPostProcess : public view_listener_t
}
};
class LLWorldCheckBanLines : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
S32 callback_data = userdata.asInteger();
return gSavedSettings.getS32("ShowBanLines") == callback_data;
}
};
class LLWorldShowBanLines : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
S32 callback_data = userdata.asInteger();
gSavedSettings.setS32("ShowBanLines", callback_data);
return true;
}
};
void handle_flush_name_caches()
{
// <FS:Ansariel> Crash fix
@ -12131,6 +12150,8 @@ void initialize_menus()
view_listener_t::addMenu(new LLWorldEnvPreset(), "World.EnvPreset");
view_listener_t::addMenu(new LLWorldEnableEnvPreset(), "World.EnableEnvPreset");
view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess");
view_listener_t::addMenu(new LLWorldCheckBanLines() , "World.CheckBanLines");
view_listener_t::addMenu(new LLWorldShowBanLines() , "World.ShowBanLines");
// Tools menu
view_listener_t::addMenu(new LLToolsSelectTool(), "Tools.SelectTool");

View File

@ -6449,6 +6449,11 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
LandBuyAccessBlocked_AdultsOnlyContent
-----------------------------------------------------------------------*/
static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION);
if (ban_lines_mode == LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION)
{
LLViewerParcelMgr::getInstance()->resetCollisionTimer();
}
if (handle_special_notification(notificationID, llsdBlock))
{
return true;
@ -6654,6 +6659,13 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data)
{
BOOL modal = FALSE;
process_alert_core(message, modal);
static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION);
if (ban_lines_mode == LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION
&& message.find("Cannot enter parcel") != std::string::npos)
{
LLViewerParcelMgr::getInstance()->resetCollisionTimer();
}
}
}

View File

@ -72,12 +72,16 @@
#include "llenvironment.h"
const F32 PARCEL_COLLISION_DRAW_SECS = 1.f;
const F32 PARCEL_BAN_LINES_DRAW_SECS_ON_COLLISION = 10.f;
const F32 PARCEL_COLLISION_DRAW_SECS_ON_PROXIMITY = 1.f;
// Globals
U8* LLViewerParcelMgr::sPackedOverlay = NULL;
S32 LLViewerParcelMgr::PARCEL_BAN_LINES_HIDE = 0;
S32 LLViewerParcelMgr::PARCEL_BAN_LINES_ON_COLLISION = 1;
S32 LLViewerParcelMgr::PARCEL_BAN_LINES_ON_PROXIMITY = 2;
LLUUID gCurrentMovieID = LLUUID::null;
@ -940,13 +944,18 @@ void LLViewerParcelMgr::render()
void LLViewerParcelMgr::renderParcelCollision()
{
static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , PARCEL_BAN_LINES_ON_COLLISION);
// check for expiration
if (mCollisionTimer.getElapsedTimeF32() > PARCEL_COLLISION_DRAW_SECS)
F32 expiration = (ban_lines_mode == PARCEL_BAN_LINES_ON_PROXIMITY)
? PARCEL_COLLISION_DRAW_SECS_ON_PROXIMITY
: PARCEL_BAN_LINES_DRAW_SECS_ON_COLLISION;
if (mCollisionTimer.getElapsedTimeF32() > expiration)
{
mRenderCollision = FALSE;
mRenderCollision = false;
}
if (mRenderCollision && gSavedSettings.getBOOL("ShowBanLines"))
if (mRenderCollision && ban_lines_mode != PARCEL_BAN_LINES_HIDE)
{
LLViewerRegion* regionp = gAgent.getRegion();
if (regionp)
@ -1914,8 +1923,11 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)
{
// We're about to collide with this parcel
parcel_mgr.mRenderCollision = TRUE;
parcel_mgr.mCollisionTimer.reset();
static LLCachedControl<S32> ban_lines_mode(gSavedSettings , "ShowBanLines" , PARCEL_BAN_LINES_ON_COLLISION);
if (ban_lines_mode == PARCEL_BAN_LINES_ON_PROXIMITY)
{
parcel_mgr.resetCollisionTimer();
}
// Differentiate this parcel if we are banned from it.
if (sequence_id == COLLISION_BANNED_PARCEL_SEQ_ID)

View File

@ -219,6 +219,11 @@ public:
void renderHighlightSegments(const U8* segments, LLViewerRegion* regionp);
void renderCollisionSegments(U8* segments, BOOL use_pass, LLViewerRegion* regionp);
static S32 PARCEL_BAN_LINES_HIDE;
static S32 PARCEL_BAN_LINES_ON_COLLISION;
static S32 PARCEL_BAN_LINES_ON_PROXIMITY;
void resetCollisionTimer(); // Ban lines visibility timer
void sendParcelGodForceOwner(const LLUUID& owner_id);
// make the selected parcel a content parcel.
@ -380,7 +385,7 @@ private:
collision_update_signal_t* mCollisionUpdateSignal;
// [/SL:KB]
U8* mCollisionSegments;
BOOL mRenderCollision;
bool mRenderCollision;
BOOL mRenderSelection;
S32 mCollisionBanned;
LLFrameTimer mCollisionTimer;

View File

@ -138,8 +138,8 @@ class LLRegionHandler : public LLCommandHandler
public:
// requests will be throttled from a non-trusted browser
LLRegionHandler() : LLCommandHandler("region", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
// make sure that we at least have a region name
int num_params = params.size();
@ -150,6 +150,10 @@ public:
// build a secondlife://{PLACE} SLurl from this SLapp
std::string url = "secondlife://";
if (!grid.empty())
{
url += grid + "/secondlife/";
}
boost::regex name_rx("[A-Za-z0-9()_%]+");
boost::regex coord_rx("[0-9]+");
for (int i = 0; i < num_params; i++)

View File

@ -38,7 +38,7 @@ public:
{
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableVoiceCall"))
{

View File

@ -58,7 +58,7 @@ public:
// requests will be throttled from a non-trusted browser
LLVoiceHandler() : LLCommandHandler("voice", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params[0].asString() == "effects")
{

View File

@ -50,6 +50,7 @@
#include "lltextureview.h"
#include "lltracker.h"
#include "llviewercamera.h"
#include "llviewernetwork.h"
#include "llviewertexture.h"
#include "llviewertexturelist.h"
#include "llviewerregion.h"
@ -2010,7 +2011,7 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
// Invoke the event details floater if someone is clicking on an event.
LLSD params(LLSD::emptyArray());
params.append(event_id);
LLCommandDispatcher::dispatch("event", params, LLSD(), NULL, "clicked", true);
LLCommandDispatcher::dispatch("event", params, LLSD(), LLGridManager::getInstance()->getGrid(), NULL, "clicked", true);
break;
}
case MAP_ITEM_LAND_FOR_SALE:

View File

@ -133,7 +133,9 @@
<menu_item_call label="Mein Land" name="My Land"/>
<menu_item_call label="Mein Linden Home" name="Linden Home"/>
<menu label="Anzeigen" name="LandShow">
<menu_item_check label="Bannlinien" name="Ban Lines"/>
<menu_item_check label="Bannlinien nicht anzeigen" name="Hide Ban Lines"/>
<menu_item_check label="Bannlinien bei Kollision anzeigen" name="Show Ban Lines On Collision"/>
<menu_item_check label="Bannlinien bei Annäherung anzeigen" name="Show Ban Lines On Proximity"/>
<menu_item_check label="Ortungssignale" name="beacons"/>
<menu_item_check label="Grundstücksgrenzen" name="Property Lines"/>
<menu_item_check label="Landeigentümer" name="Land Owners"/>

View File

@ -1150,15 +1150,38 @@
name="LandShow"
tear_off="true">
<menu_item_check
label="Ban Lines"
name="Ban Lines">
<menu_item_check.on_check
control="ShowBanLines" />
<menu_item_check.on_click
function="ToggleControl"
parameter="ShowBanLines" />
</menu_item_check>
<menu_item_check
label="Hide Ban Lines"
name="Hide Ban Lines">
<menu_item_check.on_check
function="World.CheckBanLines"
parameter="0" />
<menu_item_check.on_click
function="World.ShowBanLines"
parameter="0" />
</menu_item_check>
<menu_item_check
label="Show Ban Lines On Collision"
name="Show Ban Lines On Collision">
<menu_item_check.on_check
function="World.CheckBanLines"
parameter="1" />
<menu_item_check.on_click
function="World.ShowBanLines"
parameter="1" />
</menu_item_check>
<menu_item_check
label="Show Ban Lines On Proximity"
name="Show Ban Lines On Proximity">
<menu_item_check.on_check
function="World.CheckBanLines"
parameter="2" />
<menu_item_check.on_click
function="World.ShowBanLines"
parameter="2" />
</menu_item_check>
<menu_item_separator />
<menu_item_check
label="Beacons"

View File

@ -296,7 +296,7 @@
Maximum Altitude:
</text>
<slider
decimal_digits="1"
decimal_digits="2"
follows="left|top"
height="16"
increment="0.01"