vfs explorer can now be used to view cached asset data with the built in hex editor
This commit is contained in:
@@ -31,6 +31,17 @@ DOFloaterHex::DOFloaterHex(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_ty
|
|||||||
: LLFloater()
|
: LLFloater()
|
||||||
{
|
{
|
||||||
sInstances.push_back(this);
|
sInstances.push_back(this);
|
||||||
|
if(vfs)
|
||||||
|
{
|
||||||
|
mVFS = true;
|
||||||
|
mAssetId = item_id;
|
||||||
|
mAssetType = asset_type;
|
||||||
|
} else {
|
||||||
|
mVFS = false;
|
||||||
|
mAssetId = mItem->getAssetUUID();
|
||||||
|
mAssetType = mItem->getType();
|
||||||
|
}
|
||||||
|
llinfos << "Asset ID: " << item_id.asString() << llendl;
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml");
|
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hex.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,9 +60,6 @@ void DOFloaterHex::show(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_type)
|
|||||||
DOFloaterHex* floaterp = new DOFloaterHex(item_id);
|
DOFloaterHex* floaterp = new DOFloaterHex(item_id);
|
||||||
floaterp->setRect(rect);
|
floaterp->setRect(rect);
|
||||||
|
|
||||||
floaterp->mVFS = false;
|
|
||||||
floaterp->mAssetId = item->getAssetUUID();
|
|
||||||
floaterp->mAssetType = item->getType();
|
|
||||||
floaterp->mItem = item;
|
floaterp->mItem = item;
|
||||||
|
|
||||||
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
||||||
@@ -61,12 +69,10 @@ void DOFloaterHex::show(LLUUID item_id, BOOL vfs, LLAssetType::EType asset_type)
|
|||||||
gFloaterView->getNewFloaterPosition(&left, &top);
|
gFloaterView->getNewFloaterPosition(&left, &top);
|
||||||
LLRect rect = gSavedSettings.getRect("FloaterHexRect");
|
LLRect rect = gSavedSettings.getRect("FloaterHexRect");
|
||||||
rect.translate(left - rect.mLeft, top - rect.mTop);
|
rect.translate(left - rect.mLeft, top - rect.mTop);
|
||||||
DOFloaterHex* floaterp = new DOFloaterHex(item_id);
|
DOFloaterHex* floaterp = new DOFloaterHex(item_id, true, asset_type);
|
||||||
floaterp->setRect(rect);
|
floaterp->setRect(rect);
|
||||||
|
|
||||||
floaterp->mVFS = true;
|
llinfos << "Asset ID: " << item_id.asString() << llendl;
|
||||||
floaterp->mAssetId = item_id;
|
|
||||||
floaterp->mAssetType = asset_type;
|
|
||||||
|
|
||||||
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
gFloaterView->adjustToFitScreen(floaterp, FALSE);
|
||||||
}
|
}
|
||||||
@@ -139,6 +145,7 @@ void DOFloaterHex::imageCallback(BOOL success,
|
|||||||
BOOL final,
|
BOOL final,
|
||||||
void* userdata)
|
void* userdata)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(final)
|
if(final)
|
||||||
{
|
{
|
||||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(userdata);
|
||||||
@@ -179,6 +186,7 @@ void DOFloaterHex::assetCallback(LLVFS *vfs,
|
|||||||
LLAssetType::EType type,
|
LLAssetType::EType type,
|
||||||
void* user_data, S32 status, LLExtStat ext_status)
|
void* user_data, S32 status, LLExtStat ext_status)
|
||||||
{
|
{
|
||||||
|
|
||||||
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
LLInventoryBackup::callbackdata* data = static_cast<LLInventoryBackup::callbackdata*>(user_data);
|
||||||
DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
|
DOFloaterHex* floater = (DOFloaterHex*)(data->floater);
|
||||||
if(!floater) return;
|
if(!floater) return;
|
||||||
@@ -259,6 +267,7 @@ void DOFloaterHex::assetCallback(LLVFS *vfs,
|
|||||||
// static
|
// static
|
||||||
void DOFloaterHex::onClickUpload(void* user_data)
|
void DOFloaterHex::onClickUpload(void* user_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
DOFloaterHex* floater = (DOFloaterHex*)user_data;
|
DOFloaterHex* floater = (DOFloaterHex*)user_data;
|
||||||
LLInventoryItem* item = floater->mItem;
|
LLInventoryItem* item = floater->mItem;
|
||||||
|
|
||||||
@@ -453,29 +462,34 @@ void DOFloaterHex::handleSizing()
|
|||||||
|
|
||||||
void DOFloaterHex::readVFile()
|
void DOFloaterHex::readVFile()
|
||||||
{
|
{
|
||||||
|
if(!mVFS) return;
|
||||||
// quick cut paste job
|
// quick cut paste job
|
||||||
// Todo: this doesn't work for static vfs shit
|
// Todo: this doesn't work for static vfs shit
|
||||||
LLVFile file(gVFS, mAssetId, mAssetType, LLVFile::READ);
|
LLVFile file(gVFS, mAssetId, mAssetType, LLVFile::READ);
|
||||||
S32 size = file.getSize();
|
if(file.getVFSThread())
|
||||||
|
|
||||||
char* buffer = new char[size];
|
|
||||||
if (buffer == NULL)
|
|
||||||
{
|
{
|
||||||
llerrs << "Memory Allocation Failed" << llendl;
|
S32 size = file.getSize();
|
||||||
return;
|
|
||||||
|
char* buffer = new char[size];
|
||||||
|
if (buffer == NULL)
|
||||||
|
{
|
||||||
|
llerrs << "Memory Allocation Failed" << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
file.read((U8*)buffer, size);
|
||||||
|
|
||||||
|
std::vector<U8> new_data;
|
||||||
|
for(S32 i = 0; i < size; i++)
|
||||||
|
new_data.push_back(buffer[i]);
|
||||||
|
|
||||||
|
delete[] buffer;
|
||||||
|
|
||||||
|
mEditor->setValue(new_data);
|
||||||
|
mEditor->setVisible(TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file.read((U8*)buffer, size);
|
|
||||||
|
|
||||||
std::vector<U8> new_data;
|
|
||||||
for(S32 i = 0; i < size; i++)
|
|
||||||
new_data.push_back(buffer[i]);
|
|
||||||
|
|
||||||
delete[] buffer;
|
|
||||||
|
|
||||||
mEditor->setValue(new_data);
|
|
||||||
mEditor->setVisible(TRUE);
|
|
||||||
|
|
||||||
childSetText("status_text", std::string("Editing VFile"));
|
childSetText("status_text", std::string("Editing VFile"));
|
||||||
|
|
||||||
childSetEnabled("upload_btn", false);
|
childSetEnabled("upload_btn", false);
|
||||||
|
|||||||
Reference in New Issue
Block a user