Massive commit, beefed up the audio crash prevention, made a blacklist for assets, added sound explorer, fixed import, added item button to vfs explorer.

JELLY ROLL
This commit is contained in:
phr0z3nt04st
2010-07-08 00:20:37 -05:00
parent 30f5ce7491
commit 82aef8fa4c
27 changed files with 1232 additions and 61 deletions

View File

@@ -226,7 +226,7 @@ BOOL LLVorbisDecodeState::initDecode()
size_guess += 2048;
bool abort_decode = false;
// <edit>
// This magic value is equivilent to 150MiB of data.
// Prevents griffers from utilizin a huge xbox sound the size of god to instafry the viewer
if(size_guess >= 157286400)
@@ -235,7 +235,7 @@ BOOL LLVorbisDecodeState::initDecode()
abort_decode = true;
}
else if( vi->channels < 1 || vi->channels > LLVORBIS_CLIP_MAX_CHANNELS )
else /* </edit> */if( vi->channels < 1 || vi->channels > LLVORBIS_CLIP_MAX_CHANNELS )
{
abort_decode = true;
llwarns << "Bad channel count: " << vi->channels << llendl;
@@ -251,8 +251,25 @@ BOOL LLVorbisDecodeState::initDecode()
return FALSE;
}
mWAVBuffer.reserve(size_guess);
mWAVBuffer.resize(WAV_HEADER_SIZE);
// <edit>
try
{
// </edit>
mWAVBuffer.reserve(size_guess);
mWAVBuffer.resize(WAV_HEADER_SIZE);
// <edit>
}
catch(std::bad_alloc)
{
llwarns << "bad_alloc" << llendl;
if(mInFilep)
{
delete mInFilep;
mInFilep = NULL;
}
return FALSE;
}
// </edit>
{
// write the .wav format header
@@ -425,7 +442,10 @@ BOOL LLVorbisDecodeState::finishDecode()
char pcmout[4096]; /*Flawfinder: ignore*/
fade_length = llmin((S32)128,(S32)(data_length-36)/8);
if((S32)mWAVBuffer.size() >= (WAV_HEADER_SIZE + 2* fade_length))
// <edit>
//if((S32)mWAVBuffer.size() >= (WAV_HEADER_SIZE + 2* fade_length))
if((S32)mWAVBuffer.size() > (WAV_HEADER_SIZE + 2* fade_length))
// </edit>
{
memcpy(pcmout, &mWAVBuffer[WAV_HEADER_SIZE], (2 * fade_length)); /*Flawfinder: ignore*/
}
@@ -444,7 +464,10 @@ BOOL LLVorbisDecodeState::finishDecode()
memcpy(&mWAVBuffer[WAV_HEADER_SIZE], pcmout, (2 * fade_length)); /*Flawfinder: ignore*/
}
S32 near_end = mWAVBuffer.size() - (2 * fade_length);
if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length))
// <edit>
//if ((S32)mWAVBuffer.size() >= ( near_end + 2* fade_length))
if ((S32)mWAVBuffer.size() > ( near_end + 2* fade_length))
// </edit>
{
memcpy(pcmout, &mWAVBuffer[near_end], (2 * fade_length)); /*Flawfinder: ignore*/
}
@@ -543,13 +566,18 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
{
if (mCurrentDecodep)
{
BOOL res;
// <edit> rawrning
//BOOL res;
BOOL res = false;
// </edit>
// Decode in a loop until we're done or have run out of time.
while(!(res = mCurrentDecodep->decodeSection()) && (decode_timer.getElapsedTimeF32() < num_secs))
{
// decodeSection does all of the work above
}
/* <edit> */ try{ /* </edit> */
while(!(res = mCurrentDecodep->decodeSection()) && (decode_timer.getElapsedTimeF32() < num_secs))
{
// decodeSection does all of the work above
}
/* <edit> */ }catch(std::bad_alloc){llerrs<<"bad_alloc whilst decoding"<<llendl;} /* </edit> */
if (mCurrentDecodep->isDone() && !mCurrentDecodep->isValid())
{

View File

@@ -814,7 +814,10 @@ F64 LLAudioEngine::mapWindVecToPan(LLVector3 wind_vec)
void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain,
const S32 type, const LLVector3d &pos_global)
// <edit>
//const S32 type, const LLVector3d &pos_global)
const S32 type, const LLVector3d &pos_global, const LLUUID source_object)
// </edit>
{
// Create a new source (since this can't be associated with an existing source.
//llinfos << "Localized: " << audio_uuid << llendl;
@@ -827,7 +830,10 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
LLUUID source_id;
source_id.generate();
LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type);
// <edit>
//LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type);
LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type, source_object, true);
// </edit>
gAudiop->addAudioSource(asp);
if (pos_global.isExactlyZero())
{
@@ -1254,7 +1260,10 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E
//
LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain, const S32 type)
// <edit>
//LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain, const S32 type)
LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain, const S32 type, const LLUUID source_id, const bool isTrigger)
// </edit>
: mID(id),
mOwnerID(owner_id),
mPriority(0.f),
@@ -1267,10 +1276,17 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mQueueSounds(false),
mPlayedOnce(false),
mType(type),
// <edit>
mSourceID(source_id),
mIsTrigger(isTrigger),
// </edit>
mChannelp(NULL),
mCurrentDatap(NULL),
mQueuedDatap(NULL)
{
// <edit>
mLogID.generate();
// </edit>
}
@@ -1282,6 +1298,10 @@ LLAudioSource::~LLAudioSource()
mChannelp->setSource(NULL);
mChannelp = NULL;
}
// <edit>
if(mType != LLAudioEngine::AUDIO_TYPE_UI) // && mSourceID.notNull())
logSoundStop(mLogID);
// </edit>
}
@@ -1370,6 +1390,10 @@ bool LLAudioSource::setupChannel()
bool LLAudioSource::play(const LLUUID &audio_uuid)
{
// <edit>
if(mType != LLAudioEngine::AUDIO_TYPE_UI) //&& mSourceID.notNull())
logSoundPlay(mLogID, this, mPositionGlobal, mType, audio_uuid, mOwnerID, mSourceID, mIsTrigger, mLoop); // is mID okay for source id?
// </edit>
// Special abuse of play(); don't play a sound, but kill it.
if (audio_uuid.isNull())
{
@@ -1770,4 +1794,65 @@ bool LLAudioData::load()
return true;
}
// <edit>
std::map<LLUUID, LLSoundHistoryItem> gSoundHistory;
// static
void logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVector3d position, S32 type, LLUUID assetid, LLUUID ownerid, LLUUID sourceid, bool is_trigger, bool is_looped)
{
LLSoundHistoryItem item;
item.mID = id;
item.mAudioSource = audio_source;
item.mPosition = position;
item.mType = type;
item.mAssetID = assetid;
item.mOwnerID = ownerid;
item.mSourceID = sourceid;
item.mPlaying = true;
item.mTimeStarted = LLTimer::getElapsedSeconds();
item.mTimeStopped = F64_MAX;
item.mIsTrigger = is_trigger;
item.mIsLooped = is_looped;
item.mReviewed = false;
item.mReviewedCollision = false;
gSoundHistory[id] = item;
}
static void logSoundStop(LLUUID id)
{
if(gSoundHistory.find(id) != gSoundHistory.end())
{
gSoundHistory[id].mPlaying = false;
gSoundHistory[id].mTimeStopped = LLTimer::getElapsedSeconds();
gSoundHistory[id].mAudioSource = NULL; // just in case
pruneSoundLog();
}
}
static void pruneSoundLog()
{
if(++gSoundHistoryPruneCounter >= 64)
{
gSoundHistoryPruneCounter = 0;
while(gSoundHistory.size() > 256)
{
std::map<LLUUID, LLSoundHistoryItem>::iterator iter = gSoundHistory.begin();
std::map<LLUUID, LLSoundHistoryItem>::iterator end = gSoundHistory.end();
U64 lowest_time = (*iter).second.mTimeStopped;
LLUUID lowest_id = (*iter).first;
for( ; iter != end; ++iter)
{
if((*iter).second.mTimeStopped < lowest_time)
{
lowest_time = (*iter).second.mTimeStopped;
lowest_id = (*iter).first;
}
}
gSoundHistory.erase(lowest_id);
}
}
}
// </edit>

View File

@@ -139,7 +139,11 @@ public:
// Owner ID is the owner of the object making the request
void triggerSound(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain,
const S32 type = LLAudioEngine::AUDIO_TYPE_NONE,
const LLVector3d &pos_global = LLVector3d::zero);
// <edit>
//const LLVector3d &pos_global = LLVector3d::zero);
const LLVector3d &pos_global = LLVector3d::zero,
const LLUUID source_object = LLUUID::null);
// </edit>
bool preloadSound(const LLUUID &id);
void addAudioSource(LLAudioSource *asp);
@@ -261,7 +265,10 @@ class LLAudioSource
public:
// owner_id is the id of the agent responsible for making this sound
// play, for example, the owner of the object currently playing it
LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE);
// <edit>
//LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE);
LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE, const LLUUID source_id = LLUUID::null, const bool isTrigger = true);
// </edit>
virtual ~LLAudioSource();
virtual void update(); // Update this audio source
@@ -301,6 +308,9 @@ public:
virtual void setGain(const F32 gain) { mGain = llclamp(gain, 0.f, 1.f); }
const LLUUID &getID() const { return mID; }
// <edit>
const LLUUID &getLogID() const { return mLogID; }
// </edit>
bool isDone() const;
bool isMuted() const { return mSourceMuted; }
@@ -334,6 +344,11 @@ protected:
S32 mType;
LLVector3d mPositionGlobal;
LLVector3 mVelocity;
// <edit>
LLUUID mLogID;
LLUUID mSourceID;
bool mIsTrigger;
// </edit>
//LLAudioSource *mSyncMasterp; // If we're a slave, the source that we're synced to.
LLAudioChannel *mChannelp; // If we're currently playing back, this is the channel that we're assigned to.
@@ -452,4 +467,32 @@ protected:
extern LLAudioEngine* gAudiop;
// <edit>
typedef struct
{
LLUUID mID;
LLVector3d mPosition;
S32 mType;
bool mPlaying;
LLUUID mAssetID;
LLUUID mOwnerID;
LLUUID mSourceID;
bool mIsTrigger;
bool mIsLooped;
F64 mTimeStarted;
F64 mTimeStopped;
bool mReviewed;
bool mReviewedCollision;
LLAudioSource* mAudioSource;
} LLSoundHistoryItem;
extern std::map<LLUUID, LLSoundHistoryItem> gSoundHistory;
static void logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVector3d position, S32 type, LLUUID assetid, LLUUID ownerid, LLUUID sourceid, bool is_trigger, bool is_looped);
static void logSoundStop(LLUUID id);
static void pruneSoundLog();
static int gSoundHistoryPruneCounter;
// </edit>
#endif

View File

@@ -422,6 +422,17 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
}
return;
}
/* <edit> */
if(std::find(mBlackListedAsset.begin(),mBlackListedAsset.end(),uuid) != mBlackListedAsset.end())
{
llinfos << "Blacklisted asset " << uuid.asString() << " was trying to be accessed!!!!!!" << llendl;
if (callback)
{
callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID);
}
return;
}
/* </edit> */
BOOL exists = mVFS->getExists(uuid, type);
LLVFile file(mVFS, uuid, type);

View File

@@ -262,6 +262,8 @@ public:
virtual void getAssetData(const LLUUID uuid, LLAssetType::EType atype, LLGetAssetCallback cb, void *user_data, BOOL is_priority = FALSE);
std::vector<LLUUID> mBlackListedAsset;
/*
* TransactionID version
* Viewer needs the store_local

View File

@@ -599,7 +599,33 @@ void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callb
impl.mReplyQueue.push_back(PendingReply(id, callback, user_data));
}
}
// <edit>
BOOL LLCacheName::getIfThere(const LLUUID& id, std::string& fullname, BOOL& is_group)
{
if(id.isNull())
{
fullname = "";
return FALSE;
}
LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id );
if (entry)
{
if (entry->mIsGroup)
{
fullname = entry->mGroupName;
}
else
{
fullname = entry->mFirstName + " " + entry->mLastName;
}
is_group = entry->mIsGroup;
return TRUE;
}
fullname = "";
return FALSE;
}
// </edit>
void LLCacheName::processPending()
{
const F32 SECS_BETWEEN_PROCESS = 0.1f;

View File

@@ -90,7 +90,11 @@ public:
// otherwise, will request the data, and will call the callback when
// available. There is no garuntee the callback will ever be called.
void get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data = NULL);
// <edit>
BOOL getIfThere(const LLUUID& id, std::string& fullname, BOOL& is_group);
// </edit>
// LEGACY
void getName(const LLUUID& id, LLCacheNameCallback callback, void* user_data = NULL)
{ get(id, FALSE, callback, user_data); }

View File

@@ -138,6 +138,7 @@ set(viewer_SOURCE_FILES
llfloateravatarpicker.cpp
llfloateravatartextures.cpp
llfloaterbeacons.cpp
llfloaterblacklist.cpp
llfloaterbuildoptions.cpp
llfloaterbulkpermission.cpp
llfloaterbump.cpp
@@ -160,6 +161,7 @@ set(viewer_SOURCE_FILES
llfloaterexport.cpp
llfloaterexportregion.cpp
llfloaterexploreanimations.cpp
llfloaterexploresounds.cpp
llfloaterfriends.cpp
llfloaterfonttest.cpp
llfloatergesture.cpp
@@ -577,6 +579,7 @@ set(viewer_HEADER_FILES
llfloateravatarpicker.h
llfloateravatartextures.h
llfloaterbeacons.h
llfloaterblacklist.h
llfloaterbuildoptions.h
llfloaterbulkpermission.h
llfloaterbump.h
@@ -598,6 +601,7 @@ set(viewer_HEADER_FILES
llfloaterexport.h
llfloaterexportregion.h
llfloaterexploreanimations.h
llfloaterexploresounds.h
llfloaterevent.h
llfloaterfonttest.h
llfloaterfriends.h

View File

@@ -4494,6 +4494,66 @@
<integer>400</integer>
</array>
</map>
<key>FloaterSoundsRect</key>
<map>
<key>Comment</key>
<string>Rectangle for sounds log floater.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Rect</string>
<key>Value</key>
<array>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
</array>
</map>
<key>FloaterSoundsLogAvatars</key>
<map>
<key>Comment</key>
<string>Show SoundTriggers/gestures played by agents in the log. Also includes collision sounds if enabled</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FloaterSoundsLogObjects</key>
<map>
<key>Comment</key>
<string>Show sounds played by objects in the log. Also includes collision sounds if enabled</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FloaterSoundsLogCollisions</key>
<map>
<key>Comment</key>
<string>Don't filter out default collision sounds in the log</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FloaterSoundsLogRepeats</key>
<map>
<key>Comment</key>
<string>Only show one entry for each unique asset ID in the log</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FloaterStatisticsRect</key>
<map>
<key>Comment</key>

View File

@@ -40,7 +40,10 @@
#include "llviewerparcelmgr.h"
LLAudioSourceVO::LLAudioSourceVO(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, LLViewerObject *objectp)
: LLAudioSource(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX),
// <edit>
// : LLAudioSource(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX),
: LLAudioSource(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, objectp->getID(), false),
// </edit>
mObjectp(objectp)
{
update();

View File

@@ -55,6 +55,7 @@ LLFilePicker LLFilePicker::sInstance;
#define SOUND_FILTER L"Sounds (*.wav; *.ogg)\0*.wav;*.ogg\0"
#define IMAGE_FILTER L"Images (*.tga; *.bmp; *.jpg; *.jpeg; *.png; *.jp2; *.j2k; *.j2c)\0*.tga;*.bmp;*.jpg;*.jpeg;*.png;*.jp2;*.j2k;*.j2c\0"
#define INVGZ_FILTER L"Inv cache (*.inv; *.inv.gz)\0*.inv;*.inv.gz\0"
#define BLACKLIST_FILTER L"Asset Blacklist (*.blacklist)\0*.blacklist;\0"
// <edit/>
#define ANIM_FILTER L"Animations (*.bvh)\0*.bvh\0"
#ifdef _CORY_TESTING
@@ -206,6 +207,10 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter)
L"\0";
break;
*/
case FFLOAD_BLACKLIST:
mOFN.lpstrFilter = BLACKLIST_FILTER \
L"\0";
break;
// </edit>
default:
res = FALSE;
@@ -677,6 +682,16 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename)
L"InvCache (*.inv)\0*.inv\0" \
L"\0";
break;
case FFSAVE_BLACKLIST:
if(filename.empty())
{
wcsncpy( mFilesW,L"untitled.blacklist", FILENAME_BUFFER_SIZE);
}
mOFN.lpstrDefExt = L".blacklist";
mOFN.lpstrFilter =
L"Asset Blacklists (*.blacklist)\0*.blacklist\0" \
L"\0";
break;
// </edit>
default:
return FALSE;

View File

@@ -94,6 +94,7 @@ public:
// <edit>
FFLOAD_INVGZ = 9,
FFLOAD_AO = 10,
FFLOAD_BLACKLIST = 11
// </edit>
};
@@ -137,6 +138,7 @@ public:
FFSAVE_INVGZ = 33,
FFSAVE_LANDMARK = 34,
FFSAVE_AO = 35,
FFSAVE_BLACKLIST = 36,
// </edit>
};

View File

@@ -0,0 +1,198 @@
// <edit>
#include "llviewerprecompiledheaders.h"
#include "llfloaterblacklist.h"
#include "lluictrlfactory.h"
#include "llsdserialize.h"
#include "llscrolllistctrl.h"
#include "llcheckboxctrl.h"
#include "llfilepicker.h"
#include "llviewerwindow.h"
#include "llviewercontrol.h"
LLFloaterBlacklist* LLFloaterBlacklist::sInstance;
LLFloaterBlacklist::LLFloaterBlacklist()
: LLFloater()
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_blacklist.xml");
}
LLFloaterBlacklist::~LLFloaterBlacklist()
{
sInstance = NULL;
}
// static
void LLFloaterBlacklist::show()
{
if(sInstance)
sInstance->open();
else
{
sInstance = new LLFloaterBlacklist();
sInstance->open();
}
}
BOOL LLFloaterBlacklist::postBuild()
{
childSetAction("add_btn", onClickAdd, this);
childSetAction("clear_btn", onClickClear, this);
childSetAction("copy_uuid_btn", onClickCopyUUID, this);
childSetAction("remove_btn", onClickRemove, this);
childSetAction("save_btn", onClickSave, this);
childSetAction("load_btn", onClickLoad, this);
refresh();
return TRUE;
}
void LLFloaterBlacklist::refresh()
{
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("file_list");
list->clearRows();
if(gAssetStorage) // just in case
{
LLSD settings;
for(std::vector<LLUUID>::iterator iter = gAssetStorage->mBlackListedAsset.begin();
iter != gAssetStorage->mBlackListedAsset.end(); ++iter)
{
LLSD element;
element["id"] = (*iter);
LLSD& name_column = element["columns"][0];
name_column["column"] = "asset_id";
name_column["value"] = (*iter).asString();
list->addElement(element, ADD_BOTTOM);
settings.append((*iter));
}
setMassEnabled(!gAssetStorage->mBlackListedAsset.empty());
gSavedSettings.setLLSD("Blacklist.Settings",settings);
}
else
setMassEnabled(FALSE);
setEditID(mSelectID);
}
void LLFloaterBlacklist::add(LLUUID uuid)
{
if(gAssetStorage)
gAssetStorage->mBlackListedAsset.push_back(uuid);
refresh();
}
void LLFloaterBlacklist::clear()
{
if(gAssetStorage) // just in case
{
gAssetStorage->mBlackListedAsset.clear();
}
refresh();
}
void LLFloaterBlacklist::setEditID(LLUUID edit_id)
{
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("file_list");
bool found = false;
if(gAssetStorage)
found = std::find(gAssetStorage->mBlackListedAsset.begin(),
gAssetStorage->mBlackListedAsset.end(),edit_id) != gAssetStorage->mBlackListedAsset.end();
if(found)
{
mSelectID = edit_id;
list->selectByID(edit_id);
setEditEnabled(true);
}
else
{
mSelectID = LLUUID::null;
list->deselectAllItems(TRUE);
setEditEnabled(false);
}
}
void LLFloaterBlacklist::removeEntry()
{
if(gAssetStorage && mSelectID.notNull())
std::remove(gAssetStorage->mBlackListedAsset.begin(),gAssetStorage->mBlackListedAsset.end(),mSelectID);
refresh();
}
void LLFloaterBlacklist::setMassEnabled(bool enabled)
{
childSetEnabled("clear_btn", enabled);
}
void LLFloaterBlacklist::setEditEnabled(bool enabled)
{
childSetEnabled("copy_uuid_btn", enabled);
childSetEnabled("remove_btn", enabled);
}
// static
void LLFloaterBlacklist::onClickAdd(void* user_data)
{
LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data;
if(!floaterp) return;
floaterp->add(LLUUID(floaterp->childGetValue("id_edit").asString()));
}
// static
void LLFloaterBlacklist::onClickClear(void* user_data)
{
LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data;
if(!floaterp) return;
floaterp->clear();
}
// static
void LLFloaterBlacklist::onCommitFileList(LLUICtrl* ctrl, void* user_data)
{
LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data;
LLScrollListCtrl* list = floaterp->getChild<LLScrollListCtrl>("file_list");
LLUUID selected_id;
if(list->getFirstSelected())
selected_id = list->getFirstSelected()->getUUID();
floaterp->setEditID(selected_id);
}
// static
void LLFloaterBlacklist::onClickCopyUUID(void* user_data)
{
LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data;
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(floaterp->mSelectID.asString()));
}
// static
void LLFloaterBlacklist::onClickRemove(void* user_data)
{
LLFloaterBlacklist* floaterp = (LLFloaterBlacklist*)user_data;
floaterp->removeEntry();
}
// static
void LLFloaterBlacklist::loadFromSave()
{
if(!gAssetStorage) return;
LLSD blacklist = gSavedSettings.getLLSD("Blacklist.Settings");
for(LLSD::array_iterator itr = blacklist.beginArray(); itr != blacklist.endArray(); ++itr)
{
gAssetStorage->mBlackListedAsset.push_back(itr->asUUID());
}
}
//static
void LLFloaterBlacklist::onClickSave(void* user_data)
{
LLFilePicker& file_picker = LLFilePicker::instance();
if(file_picker.getSaveFile( LLFilePicker::FFSAVE_BLACKLIST, LLDir::getScrubbedFileName("untitled.blacklist")))
{
std::string file_name = file_picker.getFirstFile();
llofstream export_file(file_name);
LLSDSerialize::toPrettyXML(gSavedSettings.getLLSD("Blacklist.Settings"), export_file);
export_file.close();
}
}
//static
void LLFloaterBlacklist::onClickLoad(void* user_data)
{
LLFloaterBlacklist* floater = (LLFloaterBlacklist*)user_data;
LLFilePicker& file_picker = LLFilePicker::instance();
if(file_picker.getOpenFile(LLFilePicker::FFLOAD_BLACKLIST))
{
std::string file_name = file_picker.getFirstFile();
llifstream xml_file(file_name);
if(!xml_file.is_open()) return;
LLSD data;
if(LLSDSerialize::fromXML(data, xml_file) >= 1)
{
gSavedSettings.setLLSD("Blacklist.Settings", data);
LLFloaterBlacklist::loadFromSave();
floater->refresh();
}
xml_file.close();
}
}
// </edit>

View File

@@ -0,0 +1,33 @@
// <edit>
#ifndef LL_LLFLOATERBLACKLIST_H
#define LL_LLFLOATERBLACKLIST_H
#include "llfloater.h"
class LLFloaterBlacklist : LLFloater
{
public:
LLFloaterBlacklist();
~LLFloaterBlacklist();
static void show();
BOOL postBuild();
void refresh();
void add(LLUUID uuid);
void clear();
void setEditID(LLUUID edit_id);
void removeEntry();
static void onClickAdd(void* user_data);
static void onClickClear(void* user_data);
static void onCommitFileList(LLUICtrl* ctrl, void* user_data);
static void onClickCopyUUID(void* user_data);
static void onClickRemove(void* user_data);
static void loadFromSave();
static void onClickSave(void* user_data);
static void onClickLoad(void* user_data);
protected:
LLUUID mSelectID;
private:
static LLFloaterBlacklist* sInstance;
void setMassEnabled(bool enabled);
void setEditEnabled(bool enabled);
};
#endif
// </edit>

View File

@@ -0,0 +1,456 @@
// <edit>
#include "llviewerprecompiledheaders.h"
#include "llfloaterexploresounds.h"
#include "lluictrlfactory.h"
#include "llscrolllistctrl.h"
#include "lllocalinventory.h"
#include "llagent.h"
#include "llviewerwindow.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
static const size_t num_collision_sounds = 28;
const LLUUID collision_sounds[num_collision_sounds] =
{
LLUUID("dce5fdd4-afe4-4ea1-822f-dd52cac46b08"),
LLUUID("51011582-fbca-4580-ae9e-1a5593f094ec"),
LLUUID("68d62208-e257-4d0c-bbe2-20c9ea9760bb"),
LLUUID("75872e8c-bc39-451b-9b0b-042d7ba36cba"),
LLUUID("6a45ba0b-5775-4ea8-8513-26008a17f873"),
LLUUID("992a6d1b-8c77-40e0-9495-4098ce539694"),
LLUUID("2de4da5a-faf8-46be-bac6-c4d74f1e5767"),
LLUUID("6e3fb0f7-6d9c-42ca-b86b-1122ff562d7d"),
LLUUID("14209133-4961-4acc-9649-53fc38ee1667"),
LLUUID("bc4a4348-cfcc-4e5e-908e-8a52a8915fe6"),
LLUUID("9e5c1297-6eed-40c0-825a-d9bcd86e3193"),
LLUUID("e534761c-1894-4b61-b20c-658a6fb68157"),
LLUUID("8761f73f-6cf9-4186-8aaa-0948ed002db1"),
LLUUID("874a26fd-142f-4173-8c5b-890cd846c74d"),
LLUUID("0e24a717-b97e-4b77-9c94-b59a5a88b2da"),
LLUUID("75cf3ade-9a5b-4c4d-bb35-f9799bda7fb2"),
LLUUID("153c8bf7-fb89-4d89-b263-47e58b1b4774"),
LLUUID("55c3e0ce-275a-46fa-82ff-e0465f5e8703"),
LLUUID("24babf58-7156-4841-9a3f-761bdbb8e237"),
LLUUID("aca261d8-e145-4610-9e20-9eff990f2c12"),
LLUUID("0642fba6-5dcf-4d62-8e7b-94dbb529d117"),
LLUUID("25a863e8-dc42-4e8a-a357-e76422ace9b5"),
LLUUID("9538f37c-456e-4047-81be-6435045608d4"),
LLUUID("8c0f84c3-9afd-4396-b5f5-9bca2c911c20"),
LLUUID("be582e5d-b123-41a2-a150-454c39e961c8"),
LLUUID("c70141d4-ba06-41ea-bcbc-35ea81cb8335"),
LLUUID("7d1826f4-24c4-4aac-8c2e-eff45df37783"),
LLUUID("063c97d3-033a-4e9b-98d8-05c8074922cb")
};
LLFloaterExploreSounds* LLFloaterExploreSounds::sInstance;
LLFloaterExploreSounds::LLFloaterExploreSounds()
: LLFloater(), LLEventTimer(0.25f)
{
LLFloaterExploreSounds::sInstance = this;
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_explore_sounds.xml");
}
LLFloaterExploreSounds::~LLFloaterExploreSounds()
{
LLFloaterExploreSounds::sInstance = NULL;
}
// static
void LLFloaterExploreSounds::toggle()
{
if(LLFloaterExploreSounds::sInstance) LLFloaterExploreSounds::sInstance->close(FALSE);
else LLFloaterExploreSounds::sInstance = new LLFloaterExploreSounds();
}
void LLFloaterExploreSounds::close(bool app_quitting)
{
LLFloater::close(app_quitting);
}
BOOL LLFloaterExploreSounds::postBuild(void)
{
childSetDoubleClickCallback("sound_list", handle_play_locally, this);
childSetAction("play_locally_btn", handle_play_locally, this);
childSetAction("play_in_world_btn", handle_play_in_world, this);
childSetAction("play_ambient_btn", handle_play_ambient, this);
childSetAction("look_at_btn", handle_look_at, this);
childSetAction("open_btn", handle_open, this);
childSetAction("copy_uuid_btn", handle_copy_uuid, this);
childSetAction("stop_btn", handle_stop, this);
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("sound_list");
list->sortByColumn("playing", TRUE);
return TRUE;
}
LLSoundHistoryItem LLFloaterExploreSounds::getItem(LLUUID itemID)
{
if(gSoundHistory.find(itemID) != gSoundHistory.end())
return gSoundHistory[itemID];
else
{
// If log is paused, hopefully we can find it in mLastHistory
std::list<LLSoundHistoryItem>::iterator iter = mLastHistory.begin();
std::list<LLSoundHistoryItem>::iterator end = mLastHistory.end();
for( ; iter != end; ++iter)
{
if((*iter).mID == itemID) return (*iter);
}
}
LLSoundHistoryItem item;
item.mID = LLUUID::null;
return item;
}
class LLSoundHistoryItemCompare
{
public:
bool operator() (LLSoundHistoryItem first, LLSoundHistoryItem second)
{
if(first.mPlaying)
{
if(second.mPlaying)
{
return (first.mTimeStarted > second.mTimeStarted);
}
else
{
return true;
}
}
else if(second.mPlaying)
{
return false;
}
else
{
return (first.mTimeStopped > second.mTimeStopped);
}
}
};
// static
BOOL LLFloaterExploreSounds::tick()
{
//if(childGetValue("pause_chk").asBoolean()) return FALSE;
bool show_collision_sounds = childGetValue("collision_chk").asBoolean();
bool show_repeated_assets = childGetValue("repeated_asset_chk").asBoolean();
bool show_avatars = childGetValue("avatars_chk").asBoolean();
bool show_objects = childGetValue("objects_chk").asBoolean();
std::list<LLSoundHistoryItem> history;
if(childGetValue("pause_chk").asBoolean())
{
history = mLastHistory;
}
else
{
std::map<LLUUID, LLSoundHistoryItem>::iterator map_iter = gSoundHistory.begin();
std::map<LLUUID, LLSoundHistoryItem>::iterator map_end = gSoundHistory.end();
for( ; map_iter != map_end; ++map_iter)
{
history.push_back((*map_iter).second);
}
LLSoundHistoryItemCompare c;
history.sort(c);
mLastHistory = history;
}
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("sound_list");
// Save scroll pos and selection so they can be restored
S32 scroll_pos = list->getScrollPos();
LLDynamicArray<LLUUID> selected_ids;
std::vector<LLScrollListItem*> selected_items = list->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selected_items.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selected_items.end();
for(; selection_iter != selection_end; ++selection_iter)
selected_ids.push_back((*selection_iter)->getUUID());
list->clearRows();
std::list<LLUUID> unique_asset_list;
std::list<LLSoundHistoryItem>::iterator iter = history.begin();
std::list<LLSoundHistoryItem>::iterator end = history.end();
for( ; iter != end; ++iter)
{
LLSoundHistoryItem item = (*iter);
bool is_avatar = item.mOwnerID == item.mSourceID;
if(is_avatar && !show_avatars) continue;
bool is_object = !is_avatar;
if(is_object && !show_objects) continue;
bool is_repeated_asset = std::find(unique_asset_list.begin(), unique_asset_list.end(), item.mAssetID) != unique_asset_list.end();
if(is_repeated_asset && !show_repeated_assets) continue;
if(!item.mReviewed)
{
item.mReviewedCollision = std::find(&collision_sounds[0], &collision_sounds[num_collision_sounds], item.mAssetID) != &collision_sounds[num_collision_sounds];
item.mReviewed = true;
}
bool is_collision_sound = item.mReviewedCollision;
if(is_collision_sound && !show_collision_sounds) continue;
unique_asset_list.push_back(item.mAssetID);
LLSD element;
element["id"] = item.mID;
LLSD& playing_column = element["columns"][0];
playing_column["column"] = "playing";
if(item.mPlaying)
playing_column["value"] = " Playing";
else
playing_column["value"] = llformat("%.1f min ago", (LLTimer::getElapsedSeconds() - item.mTimeStopped) / 60.f);
LLSD& type_column = element["columns"][1];
type_column["column"] = "type";
if(item.mType == LLAudioEngine::AUDIO_TYPE_UI)
{
// this shouldn't happen for now, as UI is forbidden in the log
type_column["value"] = "UI";
}
else
{
std::string type;
if(is_avatar)
{
type = "Avatar";
}
else
{
if(item.mIsTrigger)
{
type = "llTriggerSound";
}
else
{
if(item.mIsLooped)
type = "llLoopSound";
else
type = "llPlaySound";
}
}
type_column["value"] = type;
}
LLSD& owner_column = element["columns"][2];
owner_column["column"] = "owner";
std::string fullname;
BOOL is_group;
if(gCacheName->getIfThere(item.mOwnerID, fullname, is_group))
{
if(is_group) fullname += " (Group)";
owner_column["value"] = fullname;
}
else
owner_column["value"] = item.mOwnerID.asString();
LLSD& sound_column = element["columns"][3];
sound_column["column"] = "sound";
sound_column["value"] = item.mAssetID.asString();
list->addElement(element, ADD_BOTTOM);
}
list->selectMultiple(selected_ids);
list->setScrollPos(scroll_pos);
return FALSE;
}
// static
void LLFloaterExploreSounds::handle_play_locally(void* user_data)
{
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
std::vector<LLScrollListItem*> selection = list->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
std::vector<LLUUID> asset_list;
for( ; selection_iter != selection_end; ++selection_iter)
{
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
if(item.mID.isNull()) continue;
// Unique assets only
if(std::find(asset_list.begin(), asset_list.end(), item.mAssetID) == asset_list.end())
{
asset_list.push_back(item.mAssetID);
gAudiop->triggerSound(item.mAssetID, LLUUID::null, 1.0f, LLAudioEngine::AUDIO_TYPE_UI);
}
}
}
// static
void LLFloaterExploreSounds::handle_play_in_world(void* user_data)
{
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
std::vector<LLScrollListItem*> selection = list->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
for( ; selection_iter != selection_end; ++selection_iter)
{
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
if(item.mID.isNull()) continue;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_SoundTrigger);
msg->nextBlockFast(_PREHASH_SoundData);
msg->addUUIDFast(_PREHASH_SoundID, item.mAssetID);
// Client untrusted, ids set on sim
msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null );
msg->addUUIDFast(_PREHASH_ObjectID, LLUUID::null );
msg->addUUIDFast(_PREHASH_ParentID, LLUUID::null );
msg->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
LLVector3 position = gAgent.getPositionAgent();
msg->addVector3Fast(_PREHASH_Position, position);
msg->addF32Fast(_PREHASH_Gain, 1.0f);
gAgent.sendMessage();
}
}
// static
void LLFloaterExploreSounds::handle_play_ambient(void* user_data)
{
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
std::vector<LLScrollListItem*> selection = list->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
for( ; selection_iter != selection_end; ++selection_iter)
{
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
if(item.mID.isNull()) continue;
int gain = 0.01f;
for(int i = 0; i < 2; i++)
{
gMessageSystem->newMessageFast(_PREHASH_SoundTrigger);
gMessageSystem->nextBlockFast(_PREHASH_SoundData);
gMessageSystem->addUUIDFast(_PREHASH_SoundID, item.mAssetID);
gMessageSystem->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
gMessageSystem->addUUIDFast(_PREHASH_ObjectID, LLUUID::null);
gMessageSystem->addUUIDFast(_PREHASH_ParentID, LLUUID::null);
gMessageSystem->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
LLVector3d pos = -from_region_handle(gAgent.getRegion()->getHandle());
gMessageSystem->addVector3Fast(_PREHASH_Position, (LLVector3)pos);
gMessageSystem->addF32Fast(_PREHASH_Gain, gain);
gMessageSystem->sendReliable(gAgent.getRegionHost());
gain = 1.0f;
}
}
}
// static
void LLFloaterExploreSounds::handle_look_at(void* user_data)
{
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
LLUUID selection = list->getSelectedValue().asUUID();
LLSoundHistoryItem item = floater->getItem(selection); // Single item only
if(item.mID.isNull()) return;
LLVector3d pos_global = item.mPosition;
// Try to find object position
if(item.mSourceID.notNull())
{
LLViewerObject* object = gObjectList.findObject(item.mSourceID);
if(object)
{
pos_global = object->getPositionGlobal();
}
}
// Move the camera
// Find direction to self (reverse)
LLVector3d cam = gAgent.getPositionGlobal() - pos_global;
cam.normalize();
// Go 4 meters back and 3 meters up
cam *= 4.0f;
cam += pos_global;
cam += LLVector3d(0.f, 0.f, 3.0f);
gAgent.setFocusOnAvatar(FALSE, FALSE);
gAgent.setCameraPosAndFocusGlobal(cam, pos_global, item.mSourceID);
gAgent.setCameraAnimating(FALSE);
}
// static
void LLFloaterExploreSounds::handle_open(void* user_data)
{
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
std::vector<LLScrollListItem*> selection = list->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
std::vector<LLUUID> asset_list;
for( ; selection_iter != selection_end; ++selection_iter)
{
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
if(item.mID.isNull()) continue;
// Unique assets only
if(std::find(asset_list.begin(), asset_list.end(), item.mAssetID) == asset_list.end())
{
asset_list.push_back(item.mAssetID);
LLUUID inv_item = LLLocalInventory::addItem(item.mAssetID.asString(), LLAssetType::AT_SOUND, item.mAssetID, true);
}
}
}
// static
void LLFloaterExploreSounds::handle_copy_uuid(void* user_data)
{
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
LLUUID selection = list->getSelectedValue().asUUID(); // Single item only
LLSoundHistoryItem item = floater->getItem(selection);
if(item.mID.isNull()) return;
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(item.mAssetID.asString()));
}
// static
void LLFloaterExploreSounds::handle_stop(void* user_data)
{
LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
std::vector<LLScrollListItem*> selection = list->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
std::vector<LLUUID> asset_list;
for( ; selection_iter != selection_end; ++selection_iter)
{
LLSoundHistoryItem item = floater->getItem((*selection_iter)->getValue());
if(item.mID.isNull()) continue;
if(item.mPlaying)
{
if(item.mAudioSource)
{
S32 type = item.mType;
item.mAudioSource->setType(LLAudioEngine::AUDIO_TYPE_UI);
if(item.mAudioSource)
item.mAudioSource->play(LLUUID::null);
if(item.mAudioSource)
item.mAudioSource->setType(type);
}
}
}
}
// </edit>

View File

@@ -0,0 +1,41 @@
// <edit>
#ifndef LL_LLFLOATEREXPLORESOUNDS_H
#define LL_LLFLOATEREXPLORESOUNDS_H
#include "llfloater.h"
#include "llaudioengine.h"
class LLFloaterExploreSounds
: public LLFloater, public LLEventTimer
{
public:
LLFloaterExploreSounds();
BOOL postBuild(void);
void close(bool app_quitting);
BOOL tick();
LLSoundHistoryItem getItem(LLUUID itemID);
static void handle_play_locally(void* user_data);
static void handle_play_in_world(void* user_data);
static void handle_play_ambient(void* user_data);
static void handle_look_at(void* user_data);
static void handle_open(void* user_data);
static void handle_copy_uuid(void* user_data);
static void handle_stop(void* user_data);
private:
virtual ~LLFloaterExploreSounds();
std::list<LLSoundHistoryItem> mLastHistory;
// static stuff!
public:
static LLFloaterExploreSounds* sInstance;
static void toggle();
};
#endif
// </edit>

View File

@@ -43,6 +43,7 @@ BOOL LLFloaterVFSExplorer::postBuild()
childSetAction("reload_all_btn", onClickReload, this);
childSetAction("copy_uuid_btn", onClickCopyUUID, this);
childSetAction("edit_data_btn", onClickEditData, this);
childSetAction("item_btn", onClickItem, this);
refresh();
return TRUE;
}
@@ -178,13 +179,14 @@ void LLFloaterVFSExplorer::onClickReload(void* user_data)
void LLFloaterVFSExplorer::onClickEditData(void* user_data)
{
LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data;
LLVFSFileSpecifier file;
std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator end = sVFSFileMap.end();
for(std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = sVFSFileMap.begin(); iter != end; ++iter)
{
if((*iter).first.mFileID == floaterp->mEditID)
file = (*iter).first;
}
LLVFSFileSpecifier file = floaterp->getEditEntry();
DOFloaterHex::show(file.mFileID, true, file.mFileType);
}
// static
void LLFloaterVFSExplorer::onClickItem(void* user_data)
{
LLFloaterVFSExplorer* floaterp = (LLFloaterVFSExplorer*)user_data;
LLVFSFileSpecifier file = floaterp->getEditEntry();
LLLocalInventory::addItem(file.mFileID.asString(),file.mFileType,file.mFileID,true);
}
// </edit>

View File

@@ -30,6 +30,7 @@ public:
static void onClickRemove(void* user_data);
static void onClickReload(void* user_data);
static void onClickEditData(void* user_data);
static void onClickItem(void* user_data);
private:
static LLFloaterVFSExplorer* sInstance;
static std::map<LLVFSFileSpecifier, LLVFSFileBlock*> sVFSFileMap;

View File

@@ -23,6 +23,7 @@
#include "lleconomy.h"
#include "llfloaterperms.h"
#include "llviewerregion.h"
#include "llviewerobjectlist.h"
// static vars
bool LLXmlImport::sImportInProgress = false;
@@ -45,7 +46,59 @@ LLXmlImportOptions* LLXmlImport::sXmlImportOptions;
std::map<LLUUID,LLUUID> LLXmlImport::sTextureReplace;
int LLXmlImport::sTotalAssets = 0;
int LLXmlImport::sUploadedAssets = 0;
// timer for watching link
class LLLinkTimer : public LLEventTimer
{
public:
LLLinkTimer(std::vector<LLUUID> roots) : LLEventTimer(0.1f)
{
mOptions = LLXmlImport::sXmlImportOptions;
mRoots = roots;
}
virtual BOOL tick()
{
// Import for this timer has been cancled :<
if(!LLXmlImport::sImportInProgress || (LLXmlImport::sXmlImportOptions && mOptions && mOptions != LLXmlImport::sXmlImportOptions)) return TRUE;
// LET US CONTINUE
std::vector<LLUUID> unlinked_roots;
for(std::vector<LLUUID>::iterator itr = mRoots.begin();itr != mRoots.end();itr++)
{
LLViewerObject* object = gObjectList.findObject((*itr));
if(object)
{
if(object->numChildren() == 0)
{
llinfos << "WAIT " << (*itr).asString() << llendl;
unlinked_roots.push_back((*itr));
}
}
}
if(unlinked_roots.size() > 0)
{
mRoots = unlinked_roots;
return FALSE;
}
else
{
LLXmlImport::finish_link();
return TRUE;
}
}
protected:
LLXmlImportOptions* mOptions;
std::vector<LLUUID> mRoots;
};
bool operator==(const LLXmlImportOptions &a, const LLXmlImportOptions &b)
{
return (a.mID == b.mID);
}
bool operator!=(const LLXmlImportOptions &a, const LLXmlImportOptions &b)
{
return (a.mID != b.mID);
}
LLXmlImportOptions::LLXmlImportOptions(LLXmlImportOptions* options)
{
mName = options->mName;
@@ -55,6 +108,7 @@ LLXmlImportOptions::LLXmlImportOptions(LLXmlImportOptions* options)
mSupplier = options->mSupplier;
mKeepPosition = options->mKeepPosition;
mAssetDir = options->mAssetDir;
mID = options->mID;
}
LLXmlImportOptions::LLXmlImportOptions(std::string filename)
: mSupplier(NULL),
@@ -128,14 +182,7 @@ void LLXmlImportOptions::init(LLSD llsd)
mChildObjects.push_back(unsorted_objects[i]);
}
F32 throttle = gSavedSettings.getF32("OutBandwidth");
// Gross magical value that is 128kbit/s
// Sim appears to drop requests if they come in faster than this. *sigh*
if(throttle < 128000.)
{
gMessageSystem->mPacketRing.setOutBandwidth(128000.0);
}
gMessageSystem->mPacketRing.setUseOutThrottle(TRUE);
mID.generate();
}
LLImportAssetData::LLImportAssetData(std::string infilename,LLUUID inassetid,LLAssetType::EType intype)
@@ -568,6 +615,15 @@ void LLXmlImport::rez_supply()
// static
void LLXmlImport::import(LLXmlImportOptions* import_options)
{
F32 throttle = gSavedSettings.getF32("OutBandwidth");
// Gross magical value that is 128kbit/s
// Sim appears to drop requests if they come in faster than this. *sigh*
if(throttle < 128000.)
{
gMessageSystem->mPacketRing.setOutBandwidth(128000.0);
}
gMessageSystem->mPacketRing.setUseOutThrottle(TRUE);
sXmlImportOptions = import_options;
if(sXmlImportOptions->mSupplier == NULL)
{
@@ -994,39 +1050,54 @@ void LLXmlImport::onNewPrim(LLViewerObject* object)
else
{
// Take attachables into inventory
std::string msg = "Wait a few moments for the attachments to attach...";
std::string msg = "Wait a few moments for the attachments to link and attach...";
LLChat chat(msg);
LLFloaterChat::addChat(chat);
sAttachmentsDone = 0;
std::map<std::string, U8>::iterator at_iter = sId2attachpt.begin();
std::map<std::string, U8>::iterator at_end = sId2attachpt.end();
for( ; at_iter != at_end; ++at_iter)
U32 ip = gAgent.getRegionHost().getAddress();
U32 port = gAgent.getRegionHost().getPort();
std::vector<LLUUID> roots;
roots.resize(sLinkSets.size());
for(std::map<U32, std::queue<U32> >::iterator itr = sLinkSets.begin();itr != sLinkSets.end();++itr)
{
LLUUID tid;
tid.generate();
U32 at_localid = sId2localid[(*at_iter).first];
gMessageSystem->newMessageFast(_PREHASH_DeRezObject);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_AgentBlock);
gMessageSystem->addUUIDFast(_PREHASH_GroupID, LLUUID::null);
gMessageSystem->addU8Fast(_PREHASH_Destination, DRD_TAKE_INTO_AGENT_INVENTORY);
gMessageSystem->addUUIDFast(_PREHASH_DestinationID, sFolderID);
gMessageSystem->addUUIDFast(_PREHASH_TransactionID, tid);
gMessageSystem->addU8Fast(_PREHASH_PacketCount, 1);
gMessageSystem->addU8Fast(_PREHASH_PacketNumber, 0);
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, at_localid);
gMessageSystem->sendReliable(gAgent.getRegionHost());
LLUUID id = LLUUID::null;
LLViewerObjectList::getUUIDFromLocal(id,itr->first,ip,port);
if(id.notNull())
{
roots.push_back(id);
}
}
sAttachmentsDone = 0;
new LLLinkTimer(roots);
}
}
LLFloaterImportProgress::update();
rez_supply();
}
void LLXmlImport::finish_link()
{
std::map<std::string, U8>::iterator at_iter = sId2attachpt.begin();
std::map<std::string, U8>::iterator at_end = sId2attachpt.end();
for( ; at_iter != at_end; ++at_iter)
{
LLUUID tid;
tid.generate();
U32 at_localid = sId2localid[(*at_iter).first];
gMessageSystem->newMessageFast(_PREHASH_DeRezObject);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->nextBlockFast(_PREHASH_AgentBlock);
gMessageSystem->addUUIDFast(_PREHASH_GroupID, LLUUID::null);
gMessageSystem->addU8Fast(_PREHASH_Destination, DRD_TAKE_INTO_AGENT_INVENTORY);
gMessageSystem->addUUIDFast(_PREHASH_DestinationID, sFolderID);
gMessageSystem->addUUIDFast(_PREHASH_TransactionID, tid);
gMessageSystem->addU8Fast(_PREHASH_PacketCount, 1);
gMessageSystem->addU8Fast(_PREHASH_PacketNumber, 0);
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, at_localid);
gMessageSystem->sendReliable(gAgent.getRegionHost());
}
}
// static
void LLXmlImport::onNewItem(LLViewerInventoryItem* item)
{

View File

@@ -56,6 +56,8 @@ public:
class LLXmlImportOptions
{
friend bool operator==(const LLXmlImportOptions &a, const LLXmlImportOptions &b);
friend bool operator!=(const LLXmlImportOptions &a, const LLXmlImportOptions &b);
public:
LLXmlImportOptions(LLXmlImportOptions* options);
LLXmlImportOptions(std::string filename);
@@ -73,6 +75,8 @@ public:
BOOL mKeepPosition;
LLViewerObject* mSupplier;
BOOL mReplaceTexture;
protected:
LLUUID mID;
};
@@ -86,6 +90,7 @@ public:
static void Cancel(void* user_data);
static void rez_supply();
static void finish_init();
static void finish_link();
static bool sImportInProgress;
static bool sImportHasAttachments;

View File

@@ -198,6 +198,7 @@
//#include "llfloateravatars.h"
//#include "llactivation.h"
#include "llao.h"
#include "llfloaterblacklist.h"
//#include "llcheats.h"
// </edit>
@@ -1421,6 +1422,7 @@ bool idle_startup()
// <edit>
LLAO::refresh();
LLFloaterBlacklist::loadFromSave();
// </edit>
if (show_connect_box)

View File

@@ -596,6 +596,13 @@ bool LLTextureFetchWorker::doWork(S32 param)
if (mState == INIT)
{
if(gAssetStorage && std::find(gAssetStorage->mBlackListedAsset.begin(),
gAssetStorage->mBlackListedAsset.end(),mID) != gAssetStorage->mBlackListedAsset.end())
{
llinfos << "Blacklisted asset " << mID.asString() << " was trying to be accessed!!!!!!" << llendl;
mState = DONE;
return true;
}
mRequestedDiscard = -1;
mLoadedDiscard = -1;
mDecodedDiscard = -1;
@@ -606,6 +613,9 @@ bool LLTextureFetchWorker::doWork(S32 param)
mSentRequest = UNSENT;
mDecoded = FALSE;
mWritten = FALSE;
// <edit>
if(mBuffer)
// </edit>
delete[] mBuffer;
mBuffer = NULL;
mBufferSize = 0;

View File

@@ -64,6 +64,8 @@
#include "llfloaterimport.h"
#include "llfloaterexport.h"
#include "llfloaterexploreanimations.h"
#include "llfloaterexploresounds.h"
#include "llfloaterblacklist.h"
// </edit>
#include "lltimer.h"
#include "llvfile.h"
@@ -406,6 +408,8 @@ void handle_open_message_builder(void*);
void handle_edit_ao(void*);
void handle_local_assets(void*);
void handle_vfs_explorer(void*);
void handle_sounds_explorer(void*);
void handle_blacklist(void*);
// </edit>
BOOL is_inventory_visible( void* user_data );
@@ -761,6 +765,10 @@ void init_client_menu(LLMenuGL* menu)
&handle_local_assets, NULL));
sub->append(new LLMenuItemCallGL( "VFS Explorer",
&handle_vfs_explorer, NULL));
sub->append(new LLMenuItemCallGL( "Sound Explorer",
&handle_sounds_explorer, NULL));
sub->append(new LLMenuItemCallGL( "Asset Blacklist",
&handle_blacklist, NULL));
sub->append(new LLMenuItemCheckGL( "Enable AO",
&menu_toggle_control,
@@ -3103,6 +3111,16 @@ void handle_vfs_explorer(void*)
LLFloaterVFSExplorer::show();
}
void handle_sounds_explorer(void*)
{
LLFloaterExploreSounds::toggle();
}
void handle_blacklist(void*)
{
LLFloaterBlacklist::show();
}
void handle_close_all_notifications(void*)
{
LLView::child_list_t child_list(*(gNotifyBoxView->getChildList()));

View File

@@ -3635,8 +3635,8 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
}
// <edit>
gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global);
//gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global, object_id);
//gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global);
gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global, object_id);
// </edit>
}

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
can_resize="false" width="320" min_width="320" height="320" min_height="320"
name="floater_blacklist" title="Asset Blacklist" rect_control="FloaterVFSRect">
<button name="add_btn" follows="left|top" width="100" bottom="-45" left="10" height="20" label="Add..."/>
<button name="clear_btn" follows="left|top" width="100" left_delta="100" bottom_delta="0" height="20" label="Clear"/>
<line_editor name="id_edit" enable="true" follows="left|bottom|right" bottom_delta="-23" left="10" width="300" height="20"/>
<scroll_list bottom="30" can_resize="true" column_padding="0" draw_heading="true"
follows="left|top|bottom|right" left="10" multi_select="true"
name="file_list" right="-10" search_column="0" top="-70">
<column dynamicwidth="true" name="asset_id" label="Asset ID" />
</scroll_list>
<button name="copy_uuid_btn" follows="left|bottom" width="75" bottom_delta="-23" left="10" height="20" label="Copy UUID"/>
<button name="remove_btn" follows="left|bottom" width="75" bottom_delta="0" left_delta="75" height="20" label="Remove"/>
<button name="save_btn" follows="left|bottom" width="75" bottom_delta="0" left_delta="75" height="20" label="Save XML"/>
<button name="load_btn" follows="left|bottom" width="75" bottom_delta="0" left_delta="75" height="20" label="Load XML"/>
</floater>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
can_resize="true" height="300" width="500" min_width="500" min_height="170"
name="floater_explore_sounds" title="Sounds" rect_control="FloaterSoundsRect">
<check_box follows="top|left" bottom_delta="-40" left="5" width="64" name="avatars_chk" label="Avatars" control_name="FloaterSoundsLogAvatars" />
<check_box follows="top|left" bottom_delta="0" left_delta="64" width="64" name="objects_chk" label="Objects" initial_value="true" control_name="FloaterSoundsLogObjects" />
<check_box follows="top|left" bottom_delta="0" left_delta="64" width="160" name="collision_chk" label="Default Collision Sounds" control_name="FloaterSoundsLogCollisions" />
<check_box follows="top|left" bottom_delta="0" left_delta="160" width="110" name="repeated_asset_chk" label="Repeated Asset" control_name="FloaterSoundsLogRepeats" />
<check_box follows="top|left" bottom_delta="0" left_delta="110" width="80" name="pause_chk" label="Pause Log" initial_value="false"/>
<scroll_list bottom="50" can_resize="true" column_padding="0" draw_heading="true"
follows="left|top|bottom|right" left="10" multi_select="true"
name="sound_list" search_column="0" top="-40" right="-10">
<column dynamicwidth="false" width="80" label="Playing" name="playing" />
<column dynamicwidth="false" width="100" label="Type" name="type" />
<column dynamicwidth="true" label="Owner" name="owner" />
<column dynamicwidth="true" label="Sound" name="sound" />
</scroll_list>
<button bottom="28" follows="bottom|left" height="20" label="Play Locally" name="play_locally_btn"
left="10" width="95"/>
<button bottom_delta="0" follows="bottom|left" height="20" label="Play In World" name="play_in_world_btn"
left_delta="100" width="95"/>
<button bottom="28" follows="bottom|left" height="20" label="Play Ambient" name="play_ambient_btn"
left_delta="100" width="95"/>
<button bottom="6" follows="bottom|left" height="20" label="Look At" name="look_at_btn"
left="10" width="95"/>
<button bottom_delta="0" follows="bottom|left" height="20" label="Open" name="open_btn"
left_delta="100" width="95"/>
<button bottom_delta="0" follows="bottom|left" height="20" label="Copy UUID" name="copy_uuid_btn"
left_delta="100" width="95"/>
<button bottom_delta="0" follows="bottom|left" height="20" label="Stop" name="stop_btn"
left_delta="100" width="95"/>
</floater>

View File

@@ -84,6 +84,7 @@
</combo_item>
</combo_box>
<button name="copy_uuid_btn" follows="left|bottom" width="75" bottom="7" left="10" height="20" label="Copy UUID"/>
<button name="item_btn" follows="left|bottom" width="75" bottom_delta="0" left_delta="75" height="20" label="Item"/>
<button name="remove_btn" follows="left|bottom" width="75" bottom_delta="0" left_delta="75" height="20" label="Remove"/>
<button name="edit_data_btn" follows="left|bottom" width="75" bottom_delta="0" left_delta="75" height="20" label="View Data"/>
</floater>