From 9b27b6e5098aee7a050d4c3f3f14050c509f74ec Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 14 Dec 2022 19:41:07 +0200 Subject: [PATCH 01/13] SL-13610 [MAC] WIP List HID available devices in joystick selection Doesn't filter the list yet, just shows full list of usb devices Selecting visible devices doesn't work yet --- indra/llui/lltransutil.cpp | 4 +- indra/llwindow/llwindow.h | 8 +- indra/llwindow/llwindowmacosx-objc.mm | 1 + indra/llwindow/llwindowmacosx.cpp | 315 +++++++++++++++++- indra/llwindow/llwindowmacosx.h | 5 + indra/llwindow/llwindowwin32.cpp | 5 +- indra/llwindow/llwindowwin32.h | 5 +- indra/llxml/llxmlnode.cpp | 2 +- indra/newview/llfilepicker.cpp | 6 +- indra/newview/llfloaterjoystick.cpp | 14 +- indra/newview/llfloaterjoystick.h | 1 + indra/newview/llviewerjoystick.cpp | 25 +- indra/newview/llviewerjoystick.h | 6 +- .../default/xui/en/floater_about_land.xml | 12 + 14 files changed, 384 insertions(+), 25 deletions(-) diff --git a/indra/llui/lltransutil.cpp b/indra/llui/lltransutil.cpp index 5da722a72b..ecd065a4ef 100644 --- a/indra/llui/lltransutil.cpp +++ b/indra/llui/lltransutil.cpp @@ -44,8 +44,8 @@ bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::setdumpCurrentDirectories(LLError::LEVEL_WARN); - LL_ERRS() << "Couldn't load string table " << xml_filename << ". Please reinstall viewer from https://secondlife.com/support/downloads/ and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL; + //gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN); + LL_ERRS() << "Couldn't load string table " << xml_filename << " " << errno << ". Please reinstall viewer from https://secondlife.com/support/downloads/ and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL; return false; } diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index ac4848579f..2d27092e0a 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -196,7 +196,13 @@ public: // windows only DirectInput8 for joysticks virtual void* getDirectInput8() { return NULL; }; - virtual bool getInputDevices(U32 device_type_filter, void * devices_callback, void* userdata) { return false; }; + virtual bool getInputDevices(U32 device_type_filter, + std::function osx_callback, + void* win_callback, + void* userdata) + { + return false; + }; virtual S32 getRefreshRate() { return mRefreshRate; } protected: diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 690fe058db..2e75d309ea 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -27,6 +27,7 @@ #include #include +#include #include "llopenglview-objc.h" #include "llwindowmacosx-objc.h" #include "llappdelegate-objc.h" diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 2c841d4703..bd13138a7d 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -43,6 +43,13 @@ #include #include +#include +#include +#include +#include +#include +#include + extern BOOL gDebugWindowProc; BOOL gHiDPISupport = TRUE; @@ -212,13 +219,16 @@ bool callKeyUp(NSKeyEventRef event, unsigned short key, unsigned int mask) bool callKeyDown(NSKeyEventRef event, unsigned short key, unsigned int mask, wchar_t character) { - if((key == gKeyboard->inverseTranslateKey('Z')) && (character == 'y')) + //if (mask!=MASK_NONE) { - key = gKeyboard->inverseTranslateKey('Y'); - } - else if ((key == gKeyboard->inverseTranslateKey('Y')) && (character == 'z')) - { - key = gKeyboard->inverseTranslateKey('Z'); + if((key == gKeyboard->inverseTranslateKey('Z')) && (character == 'y')) + { + key = gKeyboard->inverseTranslateKey('Y'); + } + else if ((key == gKeyboard->inverseTranslateKey('Y')) && (character == 'z')) + { + key = gKeyboard->inverseTranslateKey('Z'); + } } mRawKeyEvent = event; @@ -1803,6 +1813,299 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) } } + +// Device and Element Interfaces + +typedef enum HIDElementTypeMask +{ + kHIDElementTypeInput = 1 << 1, + kHIDElementTypeOutput = 1 << 2, + kHIDElementTypeFeature = 1 << 3, + kHIDElementTypeCollection = 1 << 4, + kHIDElementTypeIO = kHIDElementTypeInput | kHIDElementTypeOutput | kHIDElementTypeFeature, + kHIDElementTypeAll = kHIDElementTypeIO | kHIDElementTypeCollection +}HIDElementTypeMask; + +struct hu_element_t +{ + unsigned long type; // the type defined by IOHIDElementType in IOHIDKeys.h + long usage; // usage within above page from IOUSBHIDParser.h which defines specific usage + long usagePage; // usage page from IOUSBHIDParser.h which defines general usage + void* cookie; // unique value( within device of specific vendorID and productID ) which identifies element, will NOT change + long min; // reported min value possible + long max; // reported max value possible + long scaledMin; // reported scaled min value possible + long scaledMax; // reported scaled max value possible + long size; // size in bits of data return from element + unsigned char relative; // are reports relative to last report( deltas ) + unsigned char wrapping; // does element wrap around( one value higher than max is min ) + unsigned char nonLinear; // are the values reported non-linear relative to element movement + unsigned char preferredState; // does element have a preferred state( such as a button ) + unsigned char nullState; // does element have null state + long units; // units value is reported in( not used very often ) + long unitExp; // exponent for units( also not used very often ) + char name[256]; // name of element( c string ) + + // runtime variables + long initialCenter; // center value at start up + unsigned char hasCenter; // whether or not to use center for calibration + long minReport; // min returned value + long maxReport; // max returned value( calibrate call ) + long userMin; // user set value to scale to( scale call ) + long userMax; + + struct hu_element_t* pPrevious; // previous element( NULL at list head ) + struct hu_element_t* pChild; // next child( only of collections ) + struct hu_element_t* pSibling; // next sibling( for elements and collections ) + + long depth; +}; + +struct HidDevice +{ // interface to device, NULL = no interface + char mProduct[256]; // name of product + long mlocalID; // long representing location in USB( or other I/O ) chain which device is pluged into, can identify specific device on machine + long mUsage; // usage page from IOUSBHID Parser.h which defines general usage + long mUsagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage +}; + +/************************************************************************* +* +* hu_BuildDevice( inHIDDevice ) +* +* Purpose: given a IO device object build a flat device record including device info and all elements +* +* Notes: handles NULL lists properly +* +* Inputs: inHIDDevice - the I/O device object +* +* Returns: hu_device_t* - the address of the new device record +*/ + + +static void populate_device_info( io_object_t io_obj_p, CFDictionaryRef device_dic, HidDevice* devicep ) +{ + CFMutableDictionaryRef io_properties = nil; + io_registry_entry_t entry1; + io_registry_entry_t entry2; + kern_return_t rc; + + // Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also + // get dictionary for usb properties: step up two levels and get CF dictionary for USB properties + // try to get parent1 + rc = IORegistryEntryGetParentEntry( io_obj_p, kIOServicePlane, &entry1 ); + if ( KERN_SUCCESS == rc ) + { + rc = IORegistryEntryGetParentEntry( entry1, kIOServicePlane, &entry2 ); + + IOObjectRelease( entry1 ); + + if ( KERN_SUCCESS == rc ) + { + rc = IORegistryEntryCreateCFProperties( entry2, &io_properties, kCFAllocatorDefault, kNilOptions ); + // either way, release parent2 + IOObjectRelease( entry2 ); + } + } + if ( KERN_SUCCESS == rc ) + { + // IORegistryEntryCreateCFProperties() succeeded + if ( io_properties != nil ) + { + CFTypeRef dict_element = 0; + // get device info + // try hid dictionary first, if fail then go to usb dictionary + + + dict_element = CFDictionaryGetValue( device_dic, CFSTR(kIOHIDProductKey) ); + if ( !dict_element ) + { + dict_element = CFDictionaryGetValue( io_properties, CFSTR( "USB Product Name" ) ); + } + if ( dict_element ) + { + bool res = CFStringGetCString((CFStringRef)dict_element, devicep->mProduct, 256, kCFStringEncodingUTF8); + if ( !res ) + { + LL_WARNS("Joystick") << "Failed to populate mProduct" << LL_ENDL; + } + } + + dict_element = CFDictionaryGetValue( device_dic, CFSTR( kIOHIDLocationIDKey ) ); + if ( !dict_element ) + { + dict_element = CFDictionaryGetValue( io_properties, CFSTR( "locationID" ) ); + } + if ( dict_element ) + { + bool res = CFNumberGetValue( (CFNumberRef)dict_element, kCFNumberLongType, &devicep->mlocalID ); + if ( !res ) + { + LL_WARNS("Joystick") << "Failed to populate mLocalID" << LL_ENDL; + } + } + + dict_element = CFDictionaryGetValue( device_dic, CFSTR( kIOHIDPrimaryUsagePageKey ) ); + if ( dict_element ) + { + bool res = CFNumberGetValue( (CFNumberRef)dict_element, kCFNumberLongType, &devicep->mUsagePage ); + if ( !res ) + { + LL_WARNS("Joystick") << "Failed to populate mUsagePage" << LL_ENDL; + } + dict_element = CFDictionaryGetValue( device_dic, CFSTR( kIOHIDPrimaryUsageKey ) ); + if ( dict_element ) + { + if ( !CFNumberGetValue( (CFNumberRef)dict_element, kCFNumberLongType, &devicep->mUsage ) ) + { + LL_WARNS("Joystick") << "Failed to populate mUsage" << LL_ENDL; + } + } + } + CFRelease(io_properties); + } + else + { + LL_WARNS("Joystick") << "Failed to populate fields" << LL_ENDL; + } + } +} + +HidDevice populate_device( io_object_t io_obj ) +{ + void* interfacep = nullptr; + HidDevice device; + memset( &device, 0, sizeof( HidDevice ) ); + CFMutableDictionaryRef device_dic = 0; + kern_return_t result = IORegistryEntryCreateCFProperties( io_obj, &device_dic, kCFAllocatorDefault, kNilOptions ); + + if ( KERN_SUCCESS == result + && device_dic ) + { + IOReturn io_result = kIOReturnSuccess; + HRESULT query_result = S_OK; + SInt32 the_score = 0; + IOCFPlugInInterface **the_interface = NULL; + + + io_result = IOCreatePlugInInterfaceForService( io_obj, kIOHIDDeviceUserClientTypeID, + kIOCFPlugInInterfaceID, &the_interface, &the_score ); + if ( io_result == kIOReturnSuccess ) + { + query_result = ( *the_interface )->QueryInterface( the_interface, CFUUIDGetUUIDBytes( kIOHIDDeviceInterfaceID ), ( LPVOID * ) & ( interfacep ) ); + if ( query_result != S_OK ) + { + LL_WARNS("Joystick") << "QueryInterface failed" << LL_ENDL; + } + IODestroyPlugInInterface( the_interface ); + } + else + { + LL_WARNS("Joystick") << "IOCreatePlugInInterfaceForService failed" << LL_ENDL; + } + + if ( interfacep ) + { + result = ( *( IOHIDDeviceInterface** )interfacep )->open( interfacep, 0 ); + + if ( result != kIOReturnSuccess) + { + LL_WARNS("Joystick") << "open failed" << LL_ENDL; + } + } + // extract needed fields + populate_device_info( io_obj, device_dic, &device ); + + // Release interface + if ( interfacep ) + { + ( *( IOHIDDeviceInterface** ) interfacep )->close( interfacep ); + + ( *( IOHIDDeviceInterface** ) interfacep )->Release( interfacep ); + + interfacep = NULL; + } + + CFRelease( device_dic ); + } + else + { + LL_WARNS("Joystick") << "populate_device failed" << LL_ENDL; + } + + return device; +} + +static void get_devices(std::list &list_of_devices, + io_iterator_t inIODeviceIterator) +{ + IOReturn result = kIOReturnSuccess; // assume success( optimist! ) + io_object_t io_obj = 0; + + while ( 0 != (io_obj = IOIteratorNext( inIODeviceIterator ) ) ) + { + HidDevice device = populate_device( io_obj ); + + list_of_devices.push_back(device); + + // release the device object, it is no longer needed + result = IOObjectRelease( io_obj ); + if ( KERN_SUCCESS != result ) + { + LL_WARNS("Joystick") << "IOObjectRelease failed" << LL_ENDL; + } + } +} + +bool LLWindowMacOSX::getInputDevices(U32 device_type_filter, + std::function osx_callback, + void* win_callback, + void* userdata) +{ + CFMutableDictionaryRef device_dict_ref; + IOReturn result = kIOReturnSuccess; // assume success( optimist! ) + + // Set up matching dictionary to search the I/O Registry for HID devices we are interested in. Dictionary reference is NULL if error. + + // A dictionary to match devices to? + device_dict_ref = IOServiceMatching( kIOHIDDeviceKey ); + + // BUG FIX! one reference is consumed by IOServiceGetMatchingServices + CFRetain( device_dict_ref ); + io_iterator_t io_iter = 0; + + // create an IO object iterator + result = IOServiceGetMatchingServices( kIOMasterPortDefault, device_dict_ref, &io_iter ); + if ( kIOReturnSuccess != result ) + { + LL_WARNS("Joystick") << "IOServiceGetMatchingServices failed" << LL_ENDL; + } + + if ( io_iter ) + { + // add all existing devices + std::list device_list; + + get_devices(device_list, io_iter); + + std::list::iterator iter; + + for (iter = device_list.begin(); iter != device_list.end(); ++iter) + { + S32 size = sizeof(long); + LLSD::Binary data; //just an std::vector + data.resize(size); + memcpy(&data[0], &iter->mlocalID, size); + std::string label(iter->mProduct); + + osx_callback(label, data, userdata); + } + } + + CFRelease( device_dict_ref ); + return false; // todo: should be true once UI part gets done +} + LLSD LLWindowMacOSX::getNativeKeyData() { LLSD result = LLSD::emptyMap(); diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 851c860017..cec4f86b25 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -112,6 +112,11 @@ public: void interruptLanguageTextInput() override; void spawnWebBrowser(const std::string& escaped_url, bool async) override; F32 getSystemUISize() override; + + bool getInputDevices(U32 device_type_filter, + std::function osx_callback, + void* win_callback, + void* userdata) override; static std::vector getDisplaysResolutionList(); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 2e560ddb0a..b959c03406 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4495,7 +4495,10 @@ void* LLWindowWin32::getDirectInput8() return &gDirectInput8; } -bool LLWindowWin32::getInputDevices(U32 device_type_filter, void * di8_devices_callback, void* userdata) +bool LLWindowWin32::getInputDevices(U32 device_type_filter + std::function osx_callback, + void * di8_devices_callback, + void* userdata) { if (gDirectInput8 != NULL) { diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index b391acc12d..6fbb956539 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -129,7 +129,10 @@ public: static void setDPIAwareness(); /*virtual*/ void* getDirectInput8(); - /*virtual*/ bool getInputDevices(U32 device_type_filter, void * di8_devices_callback, void* userdata); + /*virtual*/ bool getInputDevices(U32 device_type_filter, + std::function osx_callback, + void* win_callback, + void* userdata); U32 getRawWParam() { return mRawWParam; } diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 455df13e48..43d4adbc26 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -837,7 +837,7 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, if (!LLXMLNode::parseFile(filename, root, NULL)) { - LL_WARNS() << "Problem reading UI description file: " << filename << LL_ENDL; + LL_WARNS() << "Problem reading UI description file: " << filename << " " << errno << LL_ENDL; return false; } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index f1f156c2e0..e416172eb2 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -599,6 +599,9 @@ std::unique_ptr> LLFilePicker::navOpenFilterProc(ELoadF switch(filter) { case FFLOAD_ALL: + case FFLOAD_EXE: + allowedv->push_back("app"); + allowedv->push_back("exe"); allowedv->push_back("wav"); allowedv->push_back("bvh"); allowedv->push_back("anim"); @@ -617,9 +620,6 @@ std::unique_ptr> LLFilePicker::navOpenFilterProc(ELoadF allowedv->push_back("tpic"); allowedv->push_back("png"); break; - case FFLOAD_EXE: - allowedv->push_back("app"); - allowedv->push_back("exe"); break; case FFLOAD_WAV: allowedv->push_back("wav"); diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 558b14bba7..5265411e54 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -250,6 +250,12 @@ void LLFloaterJoystick::refresh() initFromSettings(); } +void LLFloaterJoystick::addDeviceCallback(std::string &name, LLSD::Binary& value, void* userdata) +{ + LLFloaterJoystick * floater = (LLFloaterJoystick*)userdata; + floater->mJoysticksCombo->add(name, value, ADD_BOTTOM, 1); +} + void LLFloaterJoystick::addDevice(std::string &name, LLSD& value) { mJoysticksCombo->add(name, value, ADD_BOTTOM, 1); @@ -264,19 +270,21 @@ void LLFloaterJoystick::refreshListOfDevices() mHasDeviceList = false; + void* win_calback = nullptr; // di8_devices_callback callback is immediate and happens in scope of getInputDevices() #if LL_WINDOWS && !LL_MESA_HEADLESS // space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib U32 device_type = DI8DEVCLASS_GAMECTRL; - void* callback = &di8_list_devices_callback; + win_calback = di8_list_devices_callback; +#elif LL_DARWIN + U32 device_type = 0; #else // MAC doesn't support device search yet // On MAC there is an ndof_idsearch and it is possible to specify product // and manufacturer in NDOF_Device for ndof_init_first to pick specific one U32 device_type = 0; - void* callback = NULL; #endif - if (gViewerWindow->getWindow()->getInputDevices(device_type, callback, this)) + if (gViewerWindow->getWindow()->getInputDevices(device_type, addDeviceCallback, win_calback, this)) { mHasDeviceList = true; } diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index 1d46efd3f6..912d9b5310 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -46,6 +46,7 @@ public: virtual void draw(); static void setSNDefaults(); + static void addDeviceCallback(std::string &name, LLSD::Binary& value, void* userdata); void addDevice(std::string &name, LLSD& value); protected: diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index e35cb26ce1..26a626f60f 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -227,8 +227,17 @@ std::string string_from_guid(const GUID &guid) return res; } +#elif LL_DARWIN + +bool macos_devices_callback(std::string &product, LLSD::Binary &data, void* userdata) +{ + //LLViewerJoystick::getInstance()->initDevice(&device, product_name, data); + return false; +} + #endif + // ----------------------------------------------------------------------------- void LLViewerJoystick::updateEnabled(bool autoenable) { @@ -365,19 +374,21 @@ void LLViewerJoystick::init(bool autoenable) { if (mNdofDev) { + void* win_callback = nullptr; + std::function osx_callback; // di8_devices_callback callback is immediate and happens in scope of getInputDevices() #if LL_WINDOWS && !LL_MESA_HEADLESS // space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib U32 device_type = DI8DEVCLASS_GAMECTRL; - void* callback = &di8_devices_callback; + win_callback = &di8_devices_callback; #else // MAC doesn't support device search yet // On MAC there is an ndof_idsearch and it is possible to specify product // and manufacturer in NDOF_Device for ndof_init_first to pick specific one U32 device_type = 0; - void* callback = NULL; + osx_callback = macos_devices_callback; #endif - if (!gViewerWindow->getWindow()->getInputDevices(device_type, callback, NULL)) + if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL)) { LL_INFOS("Joystick") << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL; // Failed to gather devices from windows, init first suitable one @@ -438,21 +449,23 @@ void LLViewerJoystick::initDevice(LLSD &guid) { #if LIB_NDOF mLastDeviceUUID = guid; + void* win_callback = nullptr; + std::function osx_callback; #if LL_WINDOWS && !LL_MESA_HEADLESS // space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib U32 device_type = DI8DEVCLASS_GAMECTRL; - void* callback = &di8_devices_callback; + win_callback = &di8_devices_callback; #else // MAC doesn't support device search yet // On MAC there is an ndof_idsearch and it is possible to specify product // and manufacturer in NDOF_Device for ndof_init_first to pick specific one U32 device_type = 0; - void* callback = NULL; + osx_callback = macos_devices_callback; #endif mDriverState = JDS_INITIALIZING; - if (!gViewerWindow->getWindow()->getInputDevices(device_type, callback, NULL)) + if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL)) { LL_INFOS("Joystick") << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL; // Failed to gather devices from windows, init first suitable one diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h index 3b4f898710..49f8c8eabf 100644 --- a/indra/newview/llviewerjoystick.h +++ b/indra/newview/llviewerjoystick.h @@ -103,7 +103,11 @@ private: bool mCameraUpdated; bool mOverrideCamera; U32 mJoystickRun; - LLSD mLastDeviceUUID; // _GUID as U8 binary map, integer 1 for no device/ndof's device + + // Windows: _GUID as U8 binary map + // MacOS: long as an U8 binary map + // Else: integer 1 for no device/ndof's default device + LLSD mLastDeviceUUID; static F32 sLastDelta[7]; static F32 sDelta[7]; diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index b1ed245378..d0d4b4ebc0 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -435,6 +435,18 @@ left_pad="5" top_pad="7" width="180" /> + + Place Page: + Date: Tue, 20 Dec 2022 17:44:08 +0200 Subject: [PATCH 02/13] SL-13610 [MAC] WIP enable initing devices by local id --- autobuild.xml | 6 +- indra/llwindow/llwindow.h | 2 +- indra/llwindow/llwindowmacosx.cpp | 11 +- indra/llwindow/llwindowmacosx.h | 2 +- indra/llwindow/llwindowwin32.cpp | 2 +- indra/llwindow/llwindowwin32.h | 2 +- indra/newview/llfloaterjoystick.cpp | 3 +- indra/newview/llfloaterjoystick.h | 2 +- indra/newview/llviewerjoystick.cpp | 168 ++++++++++++++++++++++------ indra/newview/llviewerjoystick.h | 4 + 10 files changed, 156 insertions(+), 46 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 9785884a40..e07e92421b 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1384,9 +1384,9 @@ archive hash - a487fff84208a45844602c4a1f68c974 + 69c3e7c8cbf47d6f840011d1fa34cd8b url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/76356/727333/libndofdev-0.1.555523-darwin64-555523.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/108791/947410/libndofdev-0.1.577357-darwin64-577357.tar.bz2 name darwin64 @@ -1417,7 +1417,7 @@ version - 0.1.555523 + 0.1.577357 libpng diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 2d27092e0a..8ee06a2cc1 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -197,7 +197,7 @@ public: // windows only DirectInput8 for joysticks virtual void* getDirectInput8() { return NULL; }; virtual bool getInputDevices(U32 device_type_filter, - std::function osx_callback, + std::function osx_callback, void* win_callback, void* userdata) { diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index bd13138a7d..914e590ae9 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -2058,10 +2058,11 @@ static void get_devices(std::list &list_of_devices, } bool LLWindowMacOSX::getInputDevices(U32 device_type_filter, - std::function osx_callback, + std::function osx_callback, void* win_callback, void* userdata) { + bool return_value = false; CFMutableDictionaryRef device_dict_ref; IOReturn result = kIOReturnSuccess; // assume success( optimist! ) @@ -2098,12 +2099,16 @@ bool LLWindowMacOSX::getInputDevices(U32 device_type_filter, memcpy(&data[0], &iter->mlocalID, size); std::string label(iter->mProduct); - osx_callback(label, data, userdata); + if (osx_callback(label, data, userdata)) + { + break; //found device + } } + return_value = true; } CFRelease( device_dict_ref ); - return false; // todo: should be true once UI part gets done + return return_value; } LLSD LLWindowMacOSX::getNativeKeyData() diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index cec4f86b25..679bb13335 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -114,7 +114,7 @@ public: F32 getSystemUISize() override; bool getInputDevices(U32 device_type_filter, - std::function osx_callback, + std::function osx_callback, void* win_callback, void* userdata) override; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index b959c03406..3c7922648b 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4496,7 +4496,7 @@ void* LLWindowWin32::getDirectInput8() } bool LLWindowWin32::getInputDevices(U32 device_type_filter - std::function osx_callback, + std::function osx_callback, void * di8_devices_callback, void* userdata) { diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 6fbb956539..dcefe6dab2 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -130,7 +130,7 @@ public: /*virtual*/ void* getDirectInput8(); /*virtual*/ bool getInputDevices(U32 device_type_filter, - std::function osx_callback, + std::function osx_callback, void* win_callback, void* userdata); diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 5265411e54..18e5858e8d 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -250,10 +250,11 @@ void LLFloaterJoystick::refresh() initFromSettings(); } -void LLFloaterJoystick::addDeviceCallback(std::string &name, LLSD::Binary& value, void* userdata) +bool LLFloaterJoystick::addDeviceCallback(std::string &name, LLSD::Binary& value, void* userdata) { LLFloaterJoystick * floater = (LLFloaterJoystick*)userdata; floater->mJoysticksCombo->add(name, value, ADD_BOTTOM, 1); + return false; // keep searching } void LLFloaterJoystick::addDevice(std::string &name, LLSD& value) diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index 912d9b5310..e7049ab906 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -46,7 +46,7 @@ public: virtual void draw(); static void setSNDefaults(); - static void addDeviceCallback(std::string &name, LLSD::Binary& value, void* userdata); + static bool addDeviceCallback(std::string &name, LLSD::Binary& value, void* userdata); void addDevice(std::string &name, LLSD& value); protected: diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 26a626f60f..e182b31ed2 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -229,9 +229,17 @@ std::string string_from_guid(const GUID &guid) } #elif LL_DARWIN -bool macos_devices_callback(std::string &product, LLSD::Binary &data, void* userdata) +bool macos_devices_callback(std::string &product_name, LLSD::Binary &data, void* userdata) { - //LLViewerJoystick::getInstance()->initDevice(&device, product_name, data); + S32 size = sizeof(long); + long id; + memcpy(&id, &data[0], size); + + NDOF_Device *device = ndof_idsearch(id); + if (device) + { + return LLViewerJoystick::getInstance()->initDevice(device, data); + } return false; } @@ -374,27 +382,50 @@ void LLViewerJoystick::init(bool autoenable) { if (mNdofDev) { + U32 device_type = 0; void* win_callback = nullptr; - std::function osx_callback; + std::function osx_callback; // di8_devices_callback callback is immediate and happens in scope of getInputDevices() #if LL_WINDOWS && !LL_MESA_HEADLESS // space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib - U32 device_type = DI8DEVCLASS_GAMECTRL; + device_type = DI8DEVCLASS_GAMECTRL; win_callback = &di8_devices_callback; -#else - // MAC doesn't support device search yet - // On MAC there is an ndof_idsearch and it is possible to specify product - // and manufacturer in NDOF_Device for ndof_init_first to pick specific one - U32 device_type = 0; +#elif LL_DARWIN osx_callback = macos_devices_callback; -#endif - if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL)) + + if (mLastDeviceUUID.isBinary()) { - LL_INFOS("Joystick") << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL; - // Failed to gather devices from windows, init first suitable one - mLastDeviceUUID = LLSD(); - void *preffered_device = NULL; - initDevice(preffered_device); + S32 size = sizeof(long); + long id; + memcpy(&id, &mLastDeviceUUID[0], size); + + NDOF_Device *device = ndof_idsearch(id); + if (device) + { + if (ndof_init_first(device, nullptr)) + { + mDriverState = JDS_INITIALIZING; + // Saved device no longer exist + LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; + } + else + { + mNdofDev = device; + mDriverState = JDS_INITIALIZED; + } + } + } +#endif + if (mDriverState != JDS_INITIALIZED) + { + if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL)) + { + LL_INFOS("Joystick") << "Failed to gather input devices. Falling back to ndof's init" << LL_ENDL; + // Failed to gather devices, init first suitable one + mLastDeviceUUID = LLSD(); + void *preffered_device = NULL; + initDevice(preffered_device); + } } if (mDriverState == JDS_INITIALIZING) @@ -449,29 +480,51 @@ void LLViewerJoystick::initDevice(LLSD &guid) { #if LIB_NDOF mLastDeviceUUID = guid; + U32 device_type = 0; void* win_callback = nullptr; - std::function osx_callback; - + std::function osx_callback; + mDriverState = JDS_INITIALIZING; + #if LL_WINDOWS && !LL_MESA_HEADLESS // space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib - U32 device_type = DI8DEVCLASS_GAMECTRL; + device_type = DI8DEVCLASS_GAMECTRL; win_callback = &di8_devices_callback; -#else - // MAC doesn't support device search yet - // On MAC there is an ndof_idsearch and it is possible to specify product - // and manufacturer in NDOF_Device for ndof_init_first to pick specific one - U32 device_type = 0; +#elif LL_DARWIN osx_callback = macos_devices_callback; + if (mLastDeviceUUID.isBinary()) + { + S32 size = sizeof(long); + long id; + memcpy(&id, &mLastDeviceUUID[0], size); + + NDOF_Device *device = ndof_idsearch(id); + if (device) + { + if (ndof_init_first(device, nullptr)) + { + mDriverState = JDS_INITIALIZING; + // Saved device no longer exist + LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; + } + else + { + mNdofDev = device; + mDriverState = JDS_INITIALIZED; + } + } + } #endif - mDriverState = JDS_INITIALIZING; - if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL)) + if (mDriverState != JDS_INITIALIZED) { - LL_INFOS("Joystick") << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL; - // Failed to gather devices from windows, init first suitable one - void *preffered_device = NULL; - mLastDeviceUUID = LLSD(); - initDevice(preffered_device); + if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL)) + { + LL_INFOS("Joystick") << "Failed to gather input devices. Falling back to ndof's init" << LL_ENDL; + // Failed to gather devices from windows, init first suitable one + void *preffered_device = NULL; + mLastDeviceUUID = LLSD(); + initDevice(preffered_device); + } } if (mDriverState == JDS_INITIALIZING) @@ -528,6 +581,25 @@ void LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE #endif } +bool LLViewerJoystick::initDevice(NDOF_Device * ndof_device, LLSD::Binary &data) +{ + mLastDeviceUUID = data; +#if LIB_NDOF + if (ndof_init_first(ndof_device, nullptr)) + { + mDriverState = JDS_UNINITIALIZED; + LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; + } + else + { + mNdofDev = ndof_device; + mDriverState = JDS_INITIALIZED; + return true; + } +#endif + return false; +} + // ----------------------------------------------------------------------------- void LLViewerJoystick::terminate() { @@ -1359,9 +1431,21 @@ std::string LLViewerJoystick::getDeviceUUIDString() { return std::string(); } +#elif LL_DARWIN + if (mLastDeviceUUID.isBinary()) + { + S32 size = sizeof(long); + LLSD::Binary data = mLastDeviceUUID.asBinary(); + long id; + memcpy(&id, &data[0], size); + return std::to_string(id); + } + else + { + return std::string(); + } #else return std::string(); - // return mLastDeviceUUID; #endif } @@ -1385,8 +1469,24 @@ void LLViewerJoystick::loadDeviceIdFromSettings() LLSD::Binary data; //just an std::vector data.resize(size); memcpy(&data[0], &guid /*POD _GUID*/, size); - // We store this data in LLSD since LLSD is versatile and will be able to handle both GUID2 - // and any data MAC will need for device selection + // We store this data in LLSD since it can handle both GUID2 and long + mLastDeviceUUID = LLSD(data); + } +#elif LL_DARWIN + std::string device_string = gSavedSettings.getString("JoystickDeviceUUID"); + if (device_string.empty()) + { + mLastDeviceUUID = LLSD(); + } + else + { + LL_DEBUGS("Joystick") << "Looking for device by id: " << device_string << LL_ENDL; + long id = std::stol(device_string); + S32 size = sizeof(long); + LLSD::Binary data; //just an std::vector + data.resize(size); + memcpy(&data[0], &id, size); + // We store this data in LLSD since it can handle both GUID2 and long mLastDeviceUUID = LLSD(data); } #else diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h index 49f8c8eabf..0e5629497d 100644 --- a/indra/newview/llviewerjoystick.h +++ b/indra/newview/llviewerjoystick.h @@ -30,6 +30,9 @@ #include "stdtypes.h" #if LIB_NDOF +#if LL_DARWIN +#define TARGET_OS_MAC 1 +#endif #include "ndofdev_external.h" #else #define NDOF_Device void @@ -54,6 +57,7 @@ public: void initDevice(LLSD &guid); void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/); void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid); + bool initDevice(NDOF_Device * ndof_device, LLSD::Binary &guid); void terminate(); void updateStatus(); From 6481d36c69dbcafdb23cb27dc07aa047b3d7d64e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 27 Dec 2022 15:27:29 +0200 Subject: [PATCH 03/13] SL-13610 [MAC] WIP filter out incompatible devices --- indra/llwindow/llwindowmacosx.cpp | 95 +++++++++++++++++++++++++++--- indra/newview/llviewerjoystick.cpp | 2 + 2 files changed, 89 insertions(+), 8 deletions(-) diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 914e590ae9..3cb5939dc9 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1862,11 +1862,13 @@ struct hu_element_t }; struct HidDevice -{ // interface to device, NULL = no interface - char mProduct[256]; // name of product - long mlocalID; // long representing location in USB( or other I/O ) chain which device is pluged into, can identify specific device on machine - long mUsage; // usage page from IOUSBHID Parser.h which defines general usage - long mUsagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage +{ + long mAxis; + long mLocalID; + char mProduct[256]; + char mManufacturer[256]; + long mUsage; + long mUsagePage; }; /************************************************************************* @@ -1931,6 +1933,20 @@ static void populate_device_info( io_object_t io_obj_p, CFDictionaryRef device_d } } + dict_element = CFDictionaryGetValue( device_dic, CFSTR( kIOHIDManufacturerKey ) ); + if ( !dict_element ) + { + dict_element = CFDictionaryGetValue( io_properties, CFSTR( "USB Vendor Name" ) ); + } + if ( dict_element ) + { + bool res = CFStringGetCString( (CFStringRef)dict_element, devicep->mManufacturer, 256, kCFStringEncodingUTF8 ); + if ( !res ) + { + LL_WARNS("Joystick") << "Failed to populate mManufacturer" << LL_ENDL; + } + } + dict_element = CFDictionaryGetValue( device_dic, CFSTR( kIOHIDLocationIDKey ) ); if ( !dict_element ) { @@ -1938,7 +1954,7 @@ static void populate_device_info( io_object_t io_obj_p, CFDictionaryRef device_d } if ( dict_element ) { - bool res = CFNumberGetValue( (CFNumberRef)dict_element, kCFNumberLongType, &devicep->mlocalID ); + bool res = CFNumberGetValue( (CFNumberRef)dict_element, kCFNumberLongType, &devicep->mLocalID ); if ( !res ) { LL_WARNS("Joystick") << "Failed to populate mLocalID" << LL_ENDL; @@ -1962,6 +1978,59 @@ static void populate_device_info( io_object_t io_obj_p, CFDictionaryRef device_d } } } + + //Add axis, because ndof lib checks sutability by axises as well as other elements + devicep->mAxis = 0; + CFTypeRef hid_elements = CFDictionaryGetValue( device_dic, CFSTR( kIOHIDElementKey ) ); + if ( hid_elements && CFGetTypeID( hid_elements ) == CFArrayGetTypeID( ) ) + { + long count = CFArrayGetCount( (CFArrayRef) hid_elements ); + for (int i = 0; i < count; ++i) + { + CFTypeRef element = CFArrayGetValueAtIndex((CFArrayRef) hid_elements, i); + if (element && CFGetTypeID( element ) == CFDictionaryGetTypeID( )) + { + long type = 0, usage_page = 0, usage = 0; + + CFTypeRef ref_value = CFDictionaryGetValue( (CFDictionaryRef) element, CFSTR( kIOHIDElementTypeKey ) ); + if ( ref_value ) + { + CFNumberGetValue( (CFNumberRef)ref_value, kCFNumberLongType, &type ); + } + + ref_value = CFDictionaryGetValue( (CFDictionaryRef) element, CFSTR( kIOHIDElementUsagePageKey ) ); + if ( ref_value ) + { + CFNumberGetValue( (CFNumberRef)ref_value, kCFNumberLongType, &usage_page ); + } + + ref_value = CFDictionaryGetValue( (CFDictionaryRef) element, CFSTR( kIOHIDElementUsageKey ) ); + if ( ref_value ) + { + CFNumberGetValue( (CFNumberRef)ref_value, kCFNumberLongType, &usage ); + } + if ( type != 0 + && type != kIOHIDElementTypeCollection + && usage_page == kHIDPage_GenericDesktop) + { + switch( usage ) + { + case kHIDUsage_GD_X: + case kHIDUsage_GD_Y: + case kHIDUsage_GD_Z: + case kHIDUsage_GD_Rx: + case kHIDUsage_GD_Ry: + case kHIDUsage_GD_Rz: + devicep->mAxis++; + break; + default: + break; + } + } + } + } + } + CFRelease(io_properties); } else @@ -2046,7 +2115,17 @@ static void get_devices(std::list &list_of_devices, { HidDevice device = populate_device( io_obj ); - list_of_devices.push_back(device); + if (device.mAxis >= 3 + || (device.mUsagePage == kHIDPage_GenericDesktop + && (device.mUsage == kHIDUsage_GD_MultiAxisController + || device.mUsage == kHIDUsage_GD_GamePad + || device.mUsage == kHIDUsage_GD_Joystick)) + || (device.mUsagePage == kHIDPage_Game + && (device.mUsage == kHIDUsage_Game_3DGameController)) + || strstr(device.mManufacturer, "3Dconnexion")) + { + list_of_devices.push_back(device); + } // release the device object, it is no longer needed result = IOObjectRelease( io_obj ); @@ -2096,7 +2175,7 @@ bool LLWindowMacOSX::getInputDevices(U32 device_type_filter, S32 size = sizeof(long); LLSD::Binary data; //just an std::vector data.resize(size); - memcpy(&data[0], &iter->mlocalID, size); + memcpy(&data[0], &iter->mLocalID, size); std::string label(iter->mProduct); if (osx_callback(label, data, userdata)) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index e182b31ed2..95cfa5cd78 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -399,6 +399,7 @@ void LLViewerJoystick::init(bool autoenable) long id; memcpy(&id, &mLastDeviceUUID[0], size); + // todo: search by manufcturer instead, locid might have changed NDOF_Device *device = ndof_idsearch(id); if (device) { @@ -500,6 +501,7 @@ void LLViewerJoystick::initDevice(LLSD &guid) NDOF_Device *device = ndof_idsearch(id); if (device) { + // todo: search by manufcturer instead, locid might have changed if (ndof_init_first(device, nullptr)) { mDriverState = JDS_INITIALIZING; From 3084f864176dffbc5da19e6f958a55513f63e795 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 29 Dec 2022 19:16:15 +0200 Subject: [PATCH 04/13] SL-13610 [MAC] Manufacturer based search --- autobuild.xml | 6 +- indra/llwindow/llwindow.h | 2 +- indra/llwindow/llwindowmacosx.cpp | 247 +++++++++++++++++------- indra/llwindow/llwindowmacosx.h | 2 +- indra/llwindow/llwindowwin32.cpp | 2 +- indra/llwindow/llwindowwin32.h | 2 +- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloaterjoystick.cpp | 17 +- indra/newview/llfloaterjoystick.h | 2 +- indra/newview/llviewerjoystick.cpp | 175 ++++++++--------- indra/newview/llviewerjoystick.h | 6 +- 11 files changed, 286 insertions(+), 177 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index e07e92421b..9785884a40 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1384,9 +1384,9 @@ archive hash - 69c3e7c8cbf47d6f840011d1fa34cd8b + a487fff84208a45844602c4a1f68c974 url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/108791/947410/libndofdev-0.1.577357-darwin64-577357.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/76356/727333/libndofdev-0.1.555523-darwin64-555523.tar.bz2 name darwin64 @@ -1417,7 +1417,7 @@ version - 0.1.577357 + 0.1.555523 libpng diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 8ee06a2cc1..45049e1539 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -197,7 +197,7 @@ public: // windows only DirectInput8 for joysticks virtual void* getDirectInput8() { return NULL; }; virtual bool getInputDevices(U32 device_type_filter, - std::function osx_callback, + std::function osx_callback, void* win_callback, void* userdata) { diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 3cb5939dc9..aa87a6803f 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1813,53 +1813,158 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) } } - -// Device and Element Interfaces - -typedef enum HIDElementTypeMask +// String should match ndof, so string mapping code was copied as is +static char mapChar( char c ) { - kHIDElementTypeInput = 1 << 1, - kHIDElementTypeOutput = 1 << 2, - kHIDElementTypeFeature = 1 << 3, - kHIDElementTypeCollection = 1 << 4, - kHIDElementTypeIO = kHIDElementTypeInput | kHIDElementTypeOutput | kHIDElementTypeFeature, - kHIDElementTypeAll = kHIDElementTypeIO | kHIDElementTypeCollection -}HIDElementTypeMask; + unsigned char uc = ( unsigned char ) c; + + switch( uc ) + { + case '/': return '-'; // use dash instead of slash + + case 0x7F: return ' '; + case 0x80: return 'A'; + case 0x81: return 'A'; + case 0x82: return 'C'; + case 0x83: return 'E'; + case 0x84: return 'N'; + case 0x85: return 'O'; + case 0x86: return 'U'; + case 0x87: return 'a'; + case 0x88: return 'a'; + case 0x89: return 'a'; + case 0x8A: return 'a'; + case 0x8B: return 'a'; + case 0x8C: return 'a'; + case 0x8D: return 'c'; + case 0x8E: return 'e'; + case 0x8F: return 'e'; + case 0x90: return ' '; + case 0x91: return ' '; // ? ' + case 0x92: return ' '; // ? ' + case 0x93: return ' '; // ? " + case 0x94: return ' '; // ? " + case 0x95: return ' '; + case 0x96: return ' '; + case 0x97: return ' '; + case 0x98: return ' '; + case 0x99: return ' '; + case 0x9A: return ' '; + case 0x9B: return 0x27; + case 0x9C: return 0x22; + case 0x9D: return ' '; + case 0x9E: return ' '; + case 0x9F: return ' '; + case 0xA0: return ' '; + case 0xA1: return ' '; + case 0xA2: return ' '; + case 0xA3: return ' '; + case 0xA4: return ' '; + case 0xA5: return ' '; + case 0xA6: return ' '; + case 0xA7: return ' '; + case 0xA8: return ' '; + case 0xA9: return ' '; + case 0xAA: return ' '; + case 0xAB: return ' '; + case 0xAC: return ' '; + case 0xAD: return ' '; + case 0xAE: return ' '; + case 0xAF: return ' '; + case 0xB0: return ' '; + case 0xB1: return ' '; + case 0xB2: return ' '; + case 0xB3: return ' '; + case 0xB4: return ' '; + case 0xB5: return ' '; + case 0xB6: return ' '; + case 0xB7: return ' '; + case 0xB8: return ' '; + case 0xB9: return ' '; + case 0xBA: return ' '; + case 0xBB: return ' '; + case 0xBC: return ' '; + case 0xBD: return ' '; + case 0xBE: return ' '; + case 0xBF: return ' '; + case 0xC0: return ' '; + case 0xC1: return ' '; + case 0xC2: return ' '; + case 0xC3: return ' '; + case 0xC4: return ' '; + case 0xC5: return ' '; + case 0xC6: return ' '; + case 0xC7: return ' '; + case 0xC8: return ' '; + case 0xC9: return ' '; + case 0xCA: return ' '; + case 0xCB: return 'A'; + case 0xCC: return 'A'; + case 0xCD: return 'O'; + case 0xCE: return ' '; + case 0xCF: return ' '; + case 0xD0: return '-'; + case 0xD1: return '-'; + case 0xD2: return 0x22; + case 0xD3: return 0x22; + case 0xD4: return 0x27; + case 0xD5: return 0x27; + case 0xD6: return '-'; // use dash instead of slash + case 0xD7: return ' '; + case 0xD8: return 'y'; + case 0xD9: return 'Y'; + case 0xDA: return '-'; // use dash instead of slash + case 0xDB: return ' '; + case 0xDC: return '<'; + case 0xDD: return '>'; + case 0xDE: return ' '; + case 0xDF: return ' '; + case 0xE0: return ' '; + case 0xE1: return ' '; + case 0xE2: return ','; + case 0xE3: return ','; + case 0xE4: return ' '; + case 0xE5: return 'A'; + case 0xE6: return 'E'; + case 0xE7: return 'A'; + case 0xE8: return 'E'; + case 0xE9: return 'E'; + case 0xEA: return 'I'; + case 0xEB: return 'I'; + case 0xEC: return 'I'; + case 0xED: return 'I'; + case 0xEE: return 'O'; + case 0xEF: return 'O'; + case 0xF0: return ' '; + case 0xF1: return 'O'; + case 0xF2: return 'U'; + case 0xF3: return 'U'; + case 0xF4: return 'U'; + case 0xF5: return '|'; + case 0xF6: return ' '; + case 0xF7: return ' '; + case 0xF8: return ' '; + case 0xF9: return ' '; + case 0xFA: return '.'; + case 0xFB: return ' '; + case 0xFC: return ' '; + case 0xFD: return 0x22; + case 0xFE: return ' '; + case 0xFF: return ' '; + } + return c; +} -struct hu_element_t +// String should match ndof for manufacturer based search to work +static void sanitizeString( char* inCStr ) { - unsigned long type; // the type defined by IOHIDElementType in IOHIDKeys.h - long usage; // usage within above page from IOUSBHIDParser.h which defines specific usage - long usagePage; // usage page from IOUSBHIDParser.h which defines general usage - void* cookie; // unique value( within device of specific vendorID and productID ) which identifies element, will NOT change - long min; // reported min value possible - long max; // reported max value possible - long scaledMin; // reported scaled min value possible - long scaledMax; // reported scaled max value possible - long size; // size in bits of data return from element - unsigned char relative; // are reports relative to last report( deltas ) - unsigned char wrapping; // does element wrap around( one value higher than max is min ) - unsigned char nonLinear; // are the values reported non-linear relative to element movement - unsigned char preferredState; // does element have a preferred state( such as a button ) - unsigned char nullState; // does element have null state - long units; // units value is reported in( not used very often ) - long unitExp; // exponent for units( also not used very often ) - char name[256]; // name of element( c string ) - - // runtime variables - long initialCenter; // center value at start up - unsigned char hasCenter; // whether or not to use center for calibration - long minReport; // min returned value - long maxReport; // max returned value( calibrate call ) - long userMin; // user set value to scale to( scale call ) - long userMax; - - struct hu_element_t* pPrevious; // previous element( NULL at list head ) - struct hu_element_t* pChild; // next child( only of collections ) - struct hu_element_t* pSibling; // next sibling( for elements and collections ) - - long depth; -}; + char* charIt = inCStr; + while ( *charIt ) + { + *charIt = mapChar( *charIt ); + charIt++; + } +} struct HidDevice { @@ -1871,20 +1976,6 @@ struct HidDevice long mUsagePage; }; -/************************************************************************* -* -* hu_BuildDevice( inHIDDevice ) -* -* Purpose: given a IO device object build a flat device record including device info and all elements -* -* Notes: handles NULL lists properly -* -* Inputs: inHIDDevice - the I/O device object -* -* Returns: hu_device_t* - the address of the new device record -*/ - - static void populate_device_info( io_object_t io_obj_p, CFDictionaryRef device_dic, HidDevice* devicep ) { CFMutableDictionaryRef io_properties = nil; @@ -1927,6 +2018,7 @@ static void populate_device_info( io_object_t io_obj_p, CFDictionaryRef device_d if ( dict_element ) { bool res = CFStringGetCString((CFStringRef)dict_element, devicep->mProduct, 256, kCFStringEncodingUTF8); + sanitizeString(devicep->mProduct); if ( !res ) { LL_WARNS("Joystick") << "Failed to populate mProduct" << LL_ENDL; @@ -1941,6 +2033,7 @@ static void populate_device_info( io_object_t io_obj_p, CFDictionaryRef device_d if ( dict_element ) { bool res = CFStringGetCString( (CFStringRef)dict_element, devicep->mManufacturer, 256, kCFStringEncodingUTF8 ); + sanitizeString(devicep->mManufacturer); if ( !res ) { LL_WARNS("Joystick") << "Failed to populate mManufacturer" << LL_ENDL; @@ -2115,17 +2208,30 @@ static void get_devices(std::list &list_of_devices, { HidDevice device = populate_device( io_obj ); - if (device.mAxis >= 3 - || (device.mUsagePage == kHIDPage_GenericDesktop - && (device.mUsage == kHIDUsage_GD_MultiAxisController - || device.mUsage == kHIDUsage_GD_GamePad - || device.mUsage == kHIDUsage_GD_Joystick)) - || (device.mUsagePage == kHIDPage_Game - && (device.mUsage == kHIDUsage_Game_3DGameController)) - || strstr(device.mManufacturer, "3Dconnexion")) + if (debugLoggingEnabled("Joystick")) { list_of_devices.push_back(device); + LL_DEBUGS("Joystick") << "Device axises: " << (S32)device.mAxis + << "Device HIDUsepage: " << (S32)device.mUsagePage + << "Device HIDUsage: " << (S32)device.mUsage + << LL_ENDL; } + else + { + // Should match ndof + if (device.mAxis >= 3 + || (device.mUsagePage == kHIDPage_GenericDesktop + && (device.mUsage == kHIDUsage_GD_MultiAxisController + || device.mUsage == kHIDUsage_GD_GamePad + || device.mUsage == kHIDUsage_GD_Joystick)) + || (device.mUsagePage == kHIDPage_Game + && device.mUsage == kHIDUsage_Game_3DGameController) + || strstr(device.mManufacturer, "3Dconnexion")) + { + list_of_devices.push_back(device); + } + } + // release the device object, it is no longer needed result = IOObjectRelease( io_obj ); @@ -2137,7 +2243,7 @@ static void get_devices(std::list &list_of_devices, } bool LLWindowMacOSX::getInputDevices(U32 device_type_filter, - std::function osx_callback, + std::function osx_callback, void* win_callback, void* userdata) { @@ -2172,11 +2278,10 @@ bool LLWindowMacOSX::getInputDevices(U32 device_type_filter, for (iter = device_list.begin(); iter != device_list.end(); ++iter) { - S32 size = sizeof(long); - LLSD::Binary data; //just an std::vector - data.resize(size); - memcpy(&data[0], &iter->mLocalID, size); std::string label(iter->mProduct); + LLSD data; + data["manufacturer"] = std::string(iter->mManufacturer); + data["product"] = label; if (osx_callback(label, data, userdata)) { diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 679bb13335..19136aa3de 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -114,7 +114,7 @@ public: F32 getSystemUISize() override; bool getInputDevices(U32 device_type_filter, - std::function osx_callback, + std::function osx_callback, void* win_callback, void* userdata) override; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 3c7922648b..60bd3b080d 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4496,7 +4496,7 @@ void* LLWindowWin32::getDirectInput8() } bool LLWindowWin32::getInputDevices(U32 device_type_filter - std::function osx_callback, + std::function osx_callback, void * di8_devices_callback, void* userdata) { diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index dcefe6dab2..b0d5c557b8 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -130,7 +130,7 @@ public: /*virtual*/ void* getDirectInput8(); /*virtual*/ bool getInputDevices(U32 device_type_filter, - std::function osx_callback, + std::function osx_callback, void* win_callback, void* userdata); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ff7232830b..3e17c434a3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3770,7 +3770,7 @@ Persist 1 Type - String + LLSD Value diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 18e5858e8d..d3add020cf 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -250,7 +250,7 @@ void LLFloaterJoystick::refresh() initFromSettings(); } -bool LLFloaterJoystick::addDeviceCallback(std::string &name, LLSD::Binary& value, void* userdata) +bool LLFloaterJoystick::addDeviceCallback(std::string &name, LLSD& value, void* userdata) { LLFloaterJoystick * floater = (LLFloaterJoystick*)userdata; floater->mJoysticksCombo->add(name, value, ADD_BOTTOM, 1); @@ -280,9 +280,9 @@ void LLFloaterJoystick::refreshListOfDevices() #elif LL_DARWIN U32 device_type = 0; #else - // MAC doesn't support device search yet - // On MAC there is an ndof_idsearch and it is possible to specify product - // and manufacturer in NDOF_Device for ndof_init_first to pick specific one + // On MAC it is possible to specify product + // and manufacturer in NDOF_Device for + // ndof_init_first to pick specific device U32 device_type = 0; #endif if (gViewerWindow->getWindow()->getInputDevices(device_type, addDeviceCallback, win_calback, this)) @@ -427,10 +427,11 @@ void LLFloaterJoystick::onCommitJoystickEnabled(LLUICtrl*, void *joy_panel) joystick->toggleFlycam(); } } - - std::string device_id = LLViewerJoystick::getInstance()->getDeviceUUIDString(); - gSavedSettings.setString("JoystickDeviceUUID", device_id); - LL_DEBUGS("Joystick") << "Selected " << device_id << " as joystick." << LL_ENDL; + + LLViewerJoystick::getInstance()->saveDeviceIdToSettings(); + + std::string device_string = LLViewerJoystick::getInstance()->getDeviceUUIDString(); + LL_DEBUGS("Joystick") << "Selected " << device_string << " as joystick." << LL_ENDL; self->refreshListOfDevices(); } diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index e7049ab906..ff889c804b 100644 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -46,7 +46,7 @@ public: virtual void draw(); static void setSNDefaults(); - static bool addDeviceCallback(std::string &name, LLSD::Binary& value, void* userdata); + static bool addDeviceCallback(std::string &name, LLSD& value, void* userdata); void addDevice(std::string &name, LLSD& value); protected: diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 95cfa5cd78..ef96ea4493 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -229,18 +229,11 @@ std::string string_from_guid(const GUID &guid) } #elif LL_DARWIN -bool macos_devices_callback(std::string &product_name, LLSD::Binary &data, void* userdata) +bool macos_devices_callback(std::string &product_name, LLSD &data, void* userdata) { - S32 size = sizeof(long); - long id; - memcpy(&id, &data[0], size); + std::string product = data["product"].asString(); - NDOF_Device *device = ndof_idsearch(id); - if (device) - { - return LLViewerJoystick::getInstance()->initDevice(device, data); - } - return false; + return LLViewerJoystick::getInstance()->initDevice(nullptr, product, data); } #endif @@ -384,7 +377,7 @@ void LLViewerJoystick::init(bool autoenable) { U32 device_type = 0; void* win_callback = nullptr; - std::function osx_callback; + std::function osx_callback; // di8_devices_callback callback is immediate and happens in scope of getInputDevices() #if LL_WINDOWS && !LL_MESA_HEADLESS // space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib @@ -393,27 +386,24 @@ void LLViewerJoystick::init(bool autoenable) #elif LL_DARWIN osx_callback = macos_devices_callback; - if (mLastDeviceUUID.isBinary()) + if (mLastDeviceUUID.isMap()) { - S32 size = sizeof(long); - long id; - memcpy(&id, &mLastDeviceUUID[0], size); + std::string manufacturer = mLastDeviceUUID["manufacturer"].asString(); + std::string product = mLastDeviceUUID["product"].asString(); - // todo: search by manufcturer instead, locid might have changed - NDOF_Device *device = ndof_idsearch(id); - if (device) + strncpy(mNdofDev->manufacturer, manufacturer.c_str(), sizeof(mNdofDev->manufacturer)); + strncpy(mNdofDev->product, product.c_str(), sizeof(mNdofDev->product)); + + if (ndof_init_first(mNdofDev, nullptr)) { - if (ndof_init_first(device, nullptr)) - { - mDriverState = JDS_INITIALIZING; - // Saved device no longer exist - LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; - } - else - { - mNdofDev = device; - mDriverState = JDS_INITIALIZED; - } + mDriverState = JDS_INITIALIZING; + // Saved device no longer exist + // No device found + LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; + } + else + { + mDriverState = JDS_INITIALIZED; } } #endif @@ -483,7 +473,7 @@ void LLViewerJoystick::initDevice(LLSD &guid) mLastDeviceUUID = guid; U32 device_type = 0; void* win_callback = nullptr; - std::function osx_callback; + std::function osx_callback; mDriverState = JDS_INITIALIZING; #if LL_WINDOWS && !LL_MESA_HEADLESS @@ -492,27 +482,24 @@ void LLViewerJoystick::initDevice(LLSD &guid) win_callback = &di8_devices_callback; #elif LL_DARWIN osx_callback = macos_devices_callback; - if (mLastDeviceUUID.isBinary()) + if (mLastDeviceUUID.isMap()) { - S32 size = sizeof(long); - long id; - memcpy(&id, &mLastDeviceUUID[0], size); + std::string manufacturer = mLastDeviceUUID["manufacturer"].asString(); + std::string product = mLastDeviceUUID["product"].asString(); - NDOF_Device *device = ndof_idsearch(id); - if (device) + strncpy(mNdofDev->manufacturer, manufacturer.c_str(), sizeof(mNdofDev->manufacturer)); + strncpy(mNdofDev->product, product.c_str(), sizeof(mNdofDev->product)); + + if (ndof_init_first(mNdofDev, nullptr)) { - // todo: search by manufcturer instead, locid might have changed - if (ndof_init_first(device, nullptr)) - { - mDriverState = JDS_INITIALIZING; - // Saved device no longer exist - LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; - } - else - { - mNdofDev = device; - mDriverState = JDS_INITIALIZED; - } + mDriverState = JDS_INITIALIZING; + // Saved device no longer exist + // Np other device present + LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; + } + else + { + mDriverState = JDS_INITIALIZED; } } #endif @@ -522,7 +509,7 @@ void LLViewerJoystick::initDevice(LLSD &guid) if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL)) { LL_INFOS("Joystick") << "Failed to gather input devices. Falling back to ndof's init" << LL_ENDL; - // Failed to gather devices from windows, init first suitable one + // Failed to gather devices from window, init first suitable one void *preffered_device = NULL; mLastDeviceUUID = LLSD(); initDevice(preffered_device); @@ -537,19 +524,37 @@ void LLViewerJoystick::initDevice(LLSD &guid) #endif } -void LLViewerJoystick::initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid) +bool LLViewerJoystick::initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid) { #if LIB_NDOF mLastDeviceUUID = guid; - + +#if LL_DARWIN + if (guid.isMap()) + { + std::string manufacturer = mLastDeviceUUID["manufacturer"].asString(); + std::string product = mLastDeviceUUID["product"].asString(); + + strncpy(mNdofDev->manufacturer, manufacturer.c_str(), sizeof(mNdofDev->manufacturer)); + strncpy(mNdofDev->product, product.c_str(), sizeof(mNdofDev->product)); + } + else + { + mNdofDev->product[0] = '\0'; + mNdofDev->manufacturer[0] = '\0'; + } +#else strncpy(mNdofDev->product, name.c_str(), sizeof(mNdofDev->product)); mNdofDev->manufacturer[0] = '\0'; +#endif - initDevice(preffered_device); + return initDevice(preffered_device); +#else + return false; #endif } -void LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE8* */) +bool LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE8* */) { #if LIB_NDOF // Different joysticks will return different ranges of raw values. @@ -579,23 +584,6 @@ void LLViewerJoystick::initDevice(void * preffered_device /* LPDIRECTINPUTDEVICE else { mDriverState = JDS_INITIALIZED; - } -#endif -} - -bool LLViewerJoystick::initDevice(NDOF_Device * ndof_device, LLSD::Binary &data) -{ - mLastDeviceUUID = data; -#if LIB_NDOF - if (ndof_init_first(ndof_device, nullptr)) - { - mDriverState = JDS_UNINITIALIZED; - LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; - } - else - { - mNdofDev = ndof_device; - mDriverState = JDS_INITIALIZED; return true; } #endif @@ -1407,6 +1395,8 @@ bool LLViewerJoystick::isDeviceUUIDSet() #if LL_WINDOWS && !LL_MESA_HEADLESS // for ease of comparison and to dial less with platform specific variables, we store id as LLSD binary return mLastDeviceUUID.isBinary(); +#elif LL_DARWIN + return mLastDeviceUUID.isMap(); #else return false; #endif @@ -1434,13 +1424,11 @@ std::string LLViewerJoystick::getDeviceUUIDString() return std::string(); } #elif LL_DARWIN - if (mLastDeviceUUID.isBinary()) + if (mLastDeviceUUID.isMap()) { - S32 size = sizeof(long); - LLSD::Binary data = mLastDeviceUUID.asBinary(); - long id; - memcpy(&id, &data[0], size); - return std::to_string(id); + std::string manufacturer = mLastDeviceUUID["manufacturer"].asString(); + std::string product = mLastDeviceUUID["product"].asString(); + return manufacturer + ":" + product; } else { @@ -1451,13 +1439,32 @@ std::string LLViewerJoystick::getDeviceUUIDString() #endif } +void LLViewerJoystick::saveDeviceIdToSettings() +{ +#if LL_WINDOWS && !LL_MESA_HEADLESS + // can't save as binary directly, + // someone editing the xml will corrupt it + // so convert to string first + std::string device_string = getDeviceUUIDString(); + gSavedSettings.setLLSD("JoystickDeviceUUID", LLSD(device_string); +#else + LLSD device_id = getDeviceUUID(); + gSavedSettings.setLLSD("JoystickDeviceUUID", device_id); +#endif +} + void LLViewerJoystick::loadDeviceIdFromSettings() { + LLSD dev_id = gSavedSettings.getLLSD("JoystickDeviceUUID"); #if LL_WINDOWS && !LL_MESA_HEADLESS // We can't save binary data to gSavedSettings, somebody editing the file will corrupt it, // so _GUID data gets converted to string (we probably can convert it to LLUUID with memcpy) // and here we need to convert it back to binary from string - std::string device_string = gSavedSettings.getString("JoystickDeviceUUID"); + std::string device_string; + if (dev_id.isString()) + { + device_string = dev_id.asString(); + } if (device_string.empty()) { mLastDeviceUUID = LLSD(); @@ -1475,21 +1482,17 @@ void LLViewerJoystick::loadDeviceIdFromSettings() mLastDeviceUUID = LLSD(data); } #elif LL_DARWIN - std::string device_string = gSavedSettings.getString("JoystickDeviceUUID"); - if (device_string.empty()) + if (!dev_id.isMap()) { mLastDeviceUUID = LLSD(); } else { - LL_DEBUGS("Joystick") << "Looking for device by id: " << device_string << LL_ENDL; - long id = std::stol(device_string); - S32 size = sizeof(long); - LLSD::Binary data; //just an std::vector - data.resize(size); - memcpy(&data[0], &id, size); + std::string manufacturer = mLastDeviceUUID["manufacturer"].asString(); + std::string product = mLastDeviceUUID["product"].asString(); + LL_DEBUGS("Joystick") << "Looking for device by manufacturer: " << manufacturer << " and product: " << product << LL_ENDL; // We store this data in LLSD since it can handle both GUID2 and long - mLastDeviceUUID = LLSD(data); + mLastDeviceUUID = dev_id; } #else mLastDeviceUUID = LLSD(); diff --git a/indra/newview/llviewerjoystick.h b/indra/newview/llviewerjoystick.h index 0e5629497d..33579f544c 100644 --- a/indra/newview/llviewerjoystick.h +++ b/indra/newview/llviewerjoystick.h @@ -55,9 +55,8 @@ class LLViewerJoystick : public LLSingleton public: void init(bool autoenable); void initDevice(LLSD &guid); - void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/); - void initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid); - bool initDevice(NDOF_Device * ndof_device, LLSD::Binary &guid); + bool initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/); + bool initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8*/, std::string &name, LLSD &guid); void terminate(); void updateStatus(); @@ -80,6 +79,7 @@ public: LLSD getDeviceUUID(); //unconverted, OS dependent value wrapped into LLSD, for comparison/search std::string getDeviceUUIDString(); // converted readable value for settings std::string getDescription(); + void saveDeviceIdToSettings(); protected: void updateEnabled(bool autoenable); From 92f2cf60896e0beb65ab5faaf6894b683121cdbe Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 23 Oct 2023 16:08:46 +0300 Subject: [PATCH 05/13] SL-13610 build fix --- indra/llwindow/llwindowwin32.cpp | 2 +- indra/newview/llviewerjoystick.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 60bd3b080d..694f010ef3 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -4495,7 +4495,7 @@ void* LLWindowWin32::getDirectInput8() return &gDirectInput8; } -bool LLWindowWin32::getInputDevices(U32 device_type_filter +bool LLWindowWin32::getInputDevices(U32 device_type_filter, std::function osx_callback, void * di8_devices_callback, void* userdata) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index ef96ea4493..4577f71061 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -1446,7 +1446,7 @@ void LLViewerJoystick::saveDeviceIdToSettings() // someone editing the xml will corrupt it // so convert to string first std::string device_string = getDeviceUUIDString(); - gSavedSettings.setLLSD("JoystickDeviceUUID", LLSD(device_string); + gSavedSettings.setLLSD("JoystickDeviceUUID", LLSD(device_string)); #else LLSD device_id = getDeviceUUID(); gSavedSettings.setLLSD("JoystickDeviceUUID", device_id); From ccae16ab55cf9796594e440c229c985e9a6e8c53 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 23 Oct 2023 17:59:35 +0300 Subject: [PATCH 06/13] SL-13610 revert changes to floater_about_land Dupplicate. No idea how it got into the merge --- .../skins/default/xui/en/floater_about_land.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index d0d4b4ebc0..b1ed245378 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -435,18 +435,6 @@ left_pad="5" top_pad="7" width="180" /> - - Place Page: - Date: Mon, 23 Oct 2023 16:13:10 +0200 Subject: [PATCH 07/13] Fill agent_id fields in LLAvatarData correctly when using capability for avatar properties request --- indra/newview/llavatarpropertiesprocessor.cpp | 36 +++++++++---------- indra/newview/llavatarpropertiesprocessor.h | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 9d3bc7cabe..fc15b0f8c3 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -271,7 +271,7 @@ bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avata } // static -void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_url, LLUUID agent_id, EAvatarProcessorType type) +void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_url, LLUUID avatar_id, EAvatarProcessorType type) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -282,21 +282,21 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); httpOpts->setFollowRedirects(true); - std::string finalUrl = cap_url + "/" + agent_id.asString(); + std::string finalUrl = cap_url + "/" + avatar_id.asString(); LLSD result = httpAdapter->getAndSuspend(httpRequest, finalUrl, httpOpts, httpHeaders); // Response is being processed, no longer pending is required - getInstance()->removePendingRequest(agent_id, type); + getInstance()->removePendingRequest(avatar_id, type); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status || !result.has("id") - || agent_id != result["id"].asUUID()) + || avatar_id != result["id"].asUUID()) { - LL_WARNS("AvatarProperties") << "Failed to get agent information for id " << agent_id + LL_WARNS("AvatarProperties") << "Failed to get agent information for id " << avatar_id << (!status ? " (no HTTP status)" : !result.has("id") ? " (no result.id)" : std::string(" (result.id=") + result["id"].asUUID().asString() + ")") << LL_ENDL; @@ -309,8 +309,8 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur std::string birth_date; - avatar_data.agent_id = agent_id; - avatar_data.avatar_id = agent_id; + avatar_data.agent_id = gAgentID; + avatar_data.avatar_id = avatar_id; avatar_data.image_id = result["sl_image_id"].asUUID(); avatar_data.fl_image_id = result["fl_image_id"].asUUID(); avatar_data.partner_id = result["partner_id"].asUUID(); @@ -320,7 +320,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur // TODO: SL-20163 Remove the "has" check when SRV-684 is done // and the field "hide_age" is included to the http response avatar_data.hide_age = !result.has("hide_age") || result["hide_age"].asBoolean(); - avatar_data.profile_url = getProfileURL(agent_id.asString()); + avatar_data.profile_url = getProfileURL(avatar_id.asString()); avatar_data.customer_type = result["customer_type"].asString(); avatar_data.flags = 0; @@ -351,14 +351,14 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_data.caption_text = result["caption"].asString(); } - getInstance()->notifyObservers(agent_id, &avatar_data, type); + getInstance()->notifyObservers(avatar_id, &avatar_data, type); } else if (type == APT_PICKS) { LLAvatarPicks avatar_picks; - avatar_picks.agent_id = agent_id; // Not in use? - avatar_picks.target_id = agent_id; + avatar_picks.agent_id = gAgentID; // Not in use? + avatar_picks.target_id = avatar_id; LLSD picks_array = result["picks"]; for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it) @@ -367,14 +367,14 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_picks.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); } - getInstance()->notifyObservers(agent_id, &avatar_picks, type); + getInstance()->notifyObservers(avatar_id, &avatar_picks, type); } else if (type == APT_GROUPS) { LLAvatarGroups avatar_groups; - avatar_groups.agent_id = agent_id; // Not in use? - avatar_groups.avatar_id = agent_id; // target_id + avatar_groups.agent_id = gAgentID; // Not in use? + avatar_groups.avatar_id = avatar_id; // target_id LLSD groups_array = result["groups"]; for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) @@ -390,17 +390,17 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_groups.group_list.push_back(group_data); } - getInstance()->notifyObservers(agent_id, &avatar_groups, type); + getInstance()->notifyObservers(avatar_id, &avatar_groups, type); } else if (type == APT_NOTES) { LLAvatarNotes avatar_notes; - avatar_notes.agent_id = agent_id; - avatar_notes.target_id = agent_id; + avatar_notes.agent_id = gAgentID; + avatar_notes.target_id = avatar_id; avatar_notes.notes = result["notes"].asString(); - getInstance()->notifyObservers(agent_id, &avatar_notes, type); + getInstance()->notifyObservers(avatar_id, &avatar_notes, type); } } diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index 0dcda5a748..330a5591b5 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -248,7 +248,7 @@ public: static bool hasPaymentInfoOnFile(const LLAvatarData* avatar_data); - static void requestAvatarPropertiesCoro(std::string cap_url, LLUUID agent_id, EAvatarProcessorType type); + static void requestAvatarPropertiesCoro(std::string cap_url, LLUUID avatar_id, EAvatarProcessorType type); static void processAvatarPropertiesReply(LLMessageSystem* msg, void**); From 9bfb2b57c9df1822d66751865da172c128fdfe6a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 23 Oct 2023 16:37:24 +0200 Subject: [PATCH 08/13] Add some optimizations and modern C++ while already touching LLAvatarPropertiesProcessor --- indra/newview/llavatarpropertiesprocessor.cpp | 94 +++++++++---------- 1 file changed, 45 insertions(+), 49 deletions(-) diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index fc15b0f8c3..c787954e2b 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -67,7 +67,7 @@ void LLAvatarPropertiesProcessor::addObserver(const LLUUID& avatar_id, LLAvatarP // IAN BUG this should update the observer's UUID if this is a dupe - sent to PE if (it == end) { - mObservers.insert(pair(avatar_id, observer)); + mObservers.emplace(avatar_id, observer); } } @@ -117,8 +117,7 @@ void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarPr // Try to send HTTP request if cap_url is available if (type == APT_PROPERTIES || type == APT_PICKS || type == APT_GROUPS || type == APT_NOTES) { - std::string cap_url(gAgent.getRegionCapability("AgentProfile")); - if (!cap_url.empty()) + if (std::string cap_url(gAgent.getRegionCapability("AgentProfile")); !cap_url.empty()) { initAgentProfileCapRequest(avatar_id, cap_url, type); return; @@ -148,8 +147,7 @@ void LLAvatarPropertiesProcessor::sendGenericRequest(const LLUUID& avatar_id, EA // indicate we're going to make a request addPendingRequest(avatar_id, type); - std::vector strings; - strings.push_back(avatar_id.asString()); + std::vector strings{ avatar_id.asString() }; send_generic_message(method, strings); } @@ -161,8 +159,8 @@ void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequestMessage(const LLUUI msg->newMessageFast(_PREHASH_AvatarPropertiesRequest); msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, gAgentID); + msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); msg->addUUIDFast(_PREHASH_AvatarID, avatar_id); gAgent.sendReliableMessage(); } @@ -230,19 +228,21 @@ std::string LLAvatarPropertiesProcessor::accountType(const LLAvatarData* avatar_ std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_data) { // Special accounts like M Linden don't have payment info revealed. - if (!avatar_data->caption_text.empty()) return ""; + if (!avatar_data->caption_text.empty()) + return ""; // Linden employees don't have payment info revealed - const S32 LINDEN_EMPLOYEE_INDEX = 3; - if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return ""; + constexpr S32 LINDEN_EMPLOYEE_INDEX = 3; + if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) + return ""; - BOOL transacted = (avatar_data->flags & AVATAR_TRANSACTED); - BOOL identified = (avatar_data->flags & AVATAR_IDENTIFIED); + bool transacted = (avatar_data->flags & AVATAR_TRANSACTED); + bool identified = (avatar_data->flags & AVATAR_IDENTIFIED); // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations //BOOL age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED); const char* payment_text; - if(transacted) + if (transacted) { payment_text = "PaymentInfoUsed"; } @@ -261,11 +261,13 @@ std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_ bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avatar_data) { // Special accounts like M Linden don't have payment info revealed. - if (!avatar_data->caption_text.empty()) return true; + if (!avatar_data->caption_text.empty()) + return true; // Linden employees don't have payment info revealed - const S32 LINDEN_EMPLOYEE_INDEX = 3; - if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return true; + constexpr S32 LINDEN_EMPLOYEE_INDEX = 3; + if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) + return true; return ((avatar_data->flags & AVATAR_TRANSACTED) || (avatar_data->flags & AVATAR_IDENTIFIED)); } @@ -422,7 +424,7 @@ void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date); // Since field 'hide_age' is not supported by msg system we'd better hide the age here - avatar_data.hide_age = TRUE; + avatar_data.hide_age = true; avatar_data.caption_index = 0; S32 charter_member_size = 0; @@ -484,7 +486,7 @@ void LLAvatarPropertiesProcessor::processAvatarClassifiedsReply(LLMessageSystem* msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, data.classified_id, n); msg->getString(_PREHASH_Data, _PREHASH_Name, data.name, n); - classifieds.classifieds_list.push_back(data); + classifieds.classifieds_list.emplace_back(data); } LLAvatarPropertiesProcessor* self = getInstance(); @@ -551,7 +553,7 @@ void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block); msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block); - avatar_picks.picks_list.push_back(std::make_pair(pick_id,pick_name)); + avatar_picks.picks_list.emplace_back(std::make_pair(pick_id,pick_name)); } LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending @@ -606,7 +608,7 @@ void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i ); msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i ); - avatar_groups.group_list.push_back(group_data); + avatar_groups.group_list.emplace_back(group_data); } LLAvatarPropertiesProcessor* self = getInstance(); @@ -619,16 +621,13 @@ void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id, void* data, // Copy the map (because observers may delete themselves when updated?) LLAvatarPropertiesProcessor::observer_multimap_t observers = mObservers; - observer_multimap_t::iterator oi = observers.begin(); - observer_multimap_t::iterator end = observers.end(); - for (; oi != end; ++oi) + for (const auto& [agent_id, observer] : observers) { // only notify observers for the same agent, or if the observer // didn't know the agent ID and passed a NULL id. - const LLUUID &agent_id = oi->first; if (agent_id == id || agent_id.isNull()) { - oi->second->processProperties(data, type); + observer->processProperties(data, type); } } } @@ -642,8 +641,8 @@ void LLAvatarPropertiesProcessor::sendFriendRights(const LLUUID& avatar_id, S32 // setup message header msg->newMessageFast(_PREHASH_GrantUserRights); msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_Rights); msg->addUUID(_PREHASH_AgentRelated, avatar_id); @@ -662,8 +661,8 @@ void LLAvatarPropertiesProcessor::sendNotes(const LLUUID& avatar_id, const std:: // setup message header msg->newMessageFast(_PREHASH_AvatarNotesUpdate); msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_Data); msg->addUUID(_PREHASH_TargetID, avatar_id); @@ -679,8 +678,8 @@ void LLAvatarPropertiesProcessor::sendPickDelete( const LLUUID& pick_id ) LLMessageSystem* msg = gMessageSystem; msg->newMessage(_PREHASH_PickDelete); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_PickID, pick_id); gAgent.sendReliableMessage(); @@ -696,8 +695,8 @@ void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_ msg->newMessage(_PREHASH_ClassifiedDelete); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_ClassifiedID, classified_id); @@ -708,16 +707,14 @@ void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_ void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* interests_data) { if(!interests_data) - { return; - } LLMessageSystem* msg = gMessageSystem; msg->newMessage(_PREHASH_AvatarInterestsUpdate); msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); - msg->addUUIDFast( _PREHASH_SessionID, gAgent.getSessionID() ); + msg->addUUIDFast( _PREHASH_AgentID, gAgentID ); + msg->addUUIDFast( _PREHASH_SessionID, gAgentSessionID ); msg->nextBlockFast( _PREHASH_PropertiesData); msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask); msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text); @@ -730,14 +727,15 @@ void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick) { - if (!new_pick) return; + if (!new_pick) + return; LLMessageSystem* msg = gMessageSystem; msg->newMessage(_PREHASH_PickInfoUpdate); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_PickID, new_pick->pick_id); @@ -774,8 +772,8 @@ void LLAvatarPropertiesProcessor::sendClassifiedInfoUpdate(const LLAvatarClassif msg->newMessage(_PREHASH_ClassifiedInfoUpdate); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_ClassifiedID, c_data->classified_id); @@ -796,9 +794,7 @@ void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, { // Must ask for a pick based on the creator id because // the pick database is distributed to the inventory cluster. JC - std::vector request_params; - request_params.push_back(creator_id.asString() ); - request_params.push_back(pick_id.asString() ); + std::vector request_params{ creator_id.asString(), pick_id.asString() }; send_generic_message("pickinforequest", request_params); } @@ -809,8 +805,8 @@ void LLAvatarPropertiesProcessor::sendClassifiedInfoRequest(const LLUUID& classi msg->newMessage(_PREHASH_ClassifiedInfoRequest); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_ClassifiedID, classified_id); @@ -827,7 +823,7 @@ bool LLAvatarPropertiesProcessor::isPendingRequest(const LLUUID& avatar_id, EAva if (it == mRequestTimestamps.end()) return false; // We found a request, check if it has timed out - U32 now = time(NULL); + U32 now = time(nullptr); const U32 REQUEST_EXPIRE_SECS = 5; U32 expires = it->second + REQUEST_EXPIRE_SECS; @@ -841,7 +837,7 @@ bool LLAvatarPropertiesProcessor::isPendingRequest(const LLUUID& avatar_id, EAva void LLAvatarPropertiesProcessor::addPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type) { timestamp_map_t::key_type key = std::make_pair(avatar_id, type); - U32 now = time(NULL); + U32 now = time(nullptr); // Add or update existing (expired) request mRequestTimestamps[ key ] = now; } From 1f27d2b62316c1d1f8fc527c0d9f2a634a0bdd8e Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 23 Oct 2023 16:42:19 +0200 Subject: [PATCH 09/13] Remove unnecessary make_pair call --- indra/newview/llavatarpropertiesprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index c787954e2b..49a4a5b65c 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -553,7 +553,7 @@ void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block); msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block); - avatar_picks.picks_list.emplace_back(std::make_pair(pick_id,pick_name)); + avatar_picks.picks_list.emplace_back(pick_id, pick_name); } LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending From 1e47b78f1717b6cf56e5b13e0c179c6985b447d8 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Tue, 24 Oct 2023 19:14:26 +0300 Subject: [PATCH 10/13] SL-20524 Update contributions.txt --- doc/contributions.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/contributions.txt b/doc/contributions.txt index cde1da47a9..adc6e92941 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -239,6 +239,7 @@ Ansariel Hiller SL-18432 SL-19140 SL-4126 + SL-20524 Aralara Rajal Arare Chantilly CHUIBUG-191 From d4087fce7b36625259576d5964c5a8dd8e93d707 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 21 Oct 2023 00:07:40 +0300 Subject: [PATCH 11/13] SL-20513 Cleanup LLAvatarPropertiesProcessor #1 --- indra/newview/llavatariconctrl.cpp | 4 +- indra/newview/llavatarpropertiesprocessor.cpp | 178 +++--------------- indra/newview/llavatarpropertiesprocessor.h | 120 +++++------- indra/newview/llfloaterbuycurrency.cpp | 2 +- indra/newview/llfloaterpreference.cpp | 4 +- indra/newview/llinspectavatar.cpp | 2 +- indra/newview/llpanelprofile.cpp | 78 +++----- indra/newview/llpanelprofile.h | 7 +- indra/newview/llstartup.cpp | 9 - 9 files changed, 111 insertions(+), 293 deletions(-) diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 6145a88743..43d83da5ab 100644 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -245,7 +245,7 @@ void LLAvatarIconCtrl::setValue(const LLSD& value) // messages. People API already hits the user table. LLIconCtrl::setValue(mDefaultIconName, LLViewerFetchedTexture::BOOST_UI); app->addObserver(mAvatarId, this); - app->sendAvatarPropertiesRequest(mAvatarId); + app->sendAvatarLegacyPropertiesRequest(mAvatarId); } } } @@ -296,7 +296,7 @@ void LLAvatarIconCtrl::processProperties(void* data, EAvatarProcessorType type) { if (APT_PROPERTIES_LEGACY == type) { - LLAvatarData* avatar_data = static_cast(data); + LLAvatarLegacyData* avatar_data = static_cast(data); if (avatar_data) { if (avatar_data->avatar_id != mAvatarId) diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 49a4a5b65c..472cf8b8d5 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -115,7 +115,7 @@ void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarPr } // Try to send HTTP request if cap_url is available - if (type == APT_PROPERTIES || type == APT_PICKS || type == APT_GROUPS || type == APT_NOTES) + if (type == APT_PROPERTIES || type == APT_PICKS) { if (std::string cap_url(gAgent.getRegionCapability("AgentProfile")); !cap_url.empty()) { @@ -172,9 +172,14 @@ void LLAvatarPropertiesProcessor::initAgentProfileCapRequest(const LLUUID& avata [cap_url, avatar_id, type]() { requestAvatarPropertiesCoro(cap_url, avatar_id, type); }); } -void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequest(const LLUUID& avatar_id, bool use_cap) +void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequest(const LLUUID& avatar_id) { - sendRequest(avatar_id, use_cap ? APT_PROPERTIES : APT_PROPERTIES_LEGACY, "AvatarPropertiesRequest"); + sendRequest(avatar_id, APT_PROPERTIES, "AvatarPropertiesRequest"); +} + +void LLAvatarPropertiesProcessor::sendAvatarLegacyPropertiesRequest(const LLUUID& avatar_id) +{ + sendRequest(avatar_id, APT_PROPERTIES_LEGACY, "AvatarPropertiesRequest"); } void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id) @@ -182,16 +187,6 @@ void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id sendGenericRequest(avatar_id, APT_PICKS, "avatarpicksrequest"); } -void LLAvatarPropertiesProcessor::sendAvatarNotesRequest(const LLUUID& avatar_id) -{ - sendGenericRequest(avatar_id, APT_NOTES, "avatarnotesrequest"); -} - -void LLAvatarPropertiesProcessor::sendAvatarGroupsRequest(const LLUUID& avatar_id) -{ - sendGenericRequest(avatar_id, APT_GROUPS, "avatargroupsrequest"); -} - void LLAvatarPropertiesProcessor::sendAvatarTexturesRequest(const LLUUID& avatar_id) { sendGenericRequest(avatar_id, APT_TEXTURES, "avatartexturesrequest"); @@ -324,6 +319,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_data.hide_age = !result.has("hide_age") || result["hide_age"].asBoolean(); avatar_data.profile_url = getProfileURL(avatar_id.asString()); avatar_data.customer_type = result["customer_type"].asString(); + avatar_data.notes = result["notes"].asString(); avatar_data.flags = 0; if (result["online"].asBoolean()) @@ -353,6 +349,20 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_data.caption_text = result["caption"].asString(); } + LLSD groups_array = result["groups"]; + for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) + { + const LLSD& group_info = *it; + LLAvatarData::LLGroupData group_data; + group_data.group_powers = 0; // Not in use? + group_data.group_title = group_info["name"].asString(); // Missing data, not in use? + group_data.group_id = group_info["id"].asUUID(); + group_data.group_name = group_info["name"].asString(); + group_data.group_insignia_id = group_info["image_id"].asUUID(); + + avatar_data.group_list.push_back(group_data); + } + getInstance()->notifyObservers(avatar_id, &avatar_data, type); } else if (type == APT_PICKS) @@ -371,39 +381,6 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur getInstance()->notifyObservers(avatar_id, &avatar_picks, type); } - else if (type == APT_GROUPS) - { - LLAvatarGroups avatar_groups; - - avatar_groups.agent_id = gAgentID; // Not in use? - avatar_groups.avatar_id = avatar_id; // target_id - - LLSD groups_array = result["groups"]; - for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) - { - const LLSD& group_info = *it; - LLAvatarGroups::LLGroupData group_data; - group_data.group_powers = 0; // Not in use? - group_data.group_title = group_info["name"].asString(); // Missing data, not in use? - group_data.group_id = group_info["id"].asUUID(); - group_data.group_name = group_info["name"].asString(); - group_data.group_insignia_id = group_info["image_id"].asUUID(); - - avatar_groups.group_list.push_back(group_data); - } - - getInstance()->notifyObservers(avatar_id, &avatar_groups, type); - } - else if (type == APT_NOTES) - { - LLAvatarNotes avatar_notes; - - avatar_notes.agent_id = gAgentID; - avatar_notes.target_id = avatar_id; - avatar_notes.notes = result["notes"].asString(); - - getInstance()->notifyObservers(avatar_id, &avatar_notes, type); - } } void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**) @@ -443,33 +420,6 @@ void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* self->notifyObservers(avatar_data.avatar_id, &avatar_data, APT_PROPERTIES_LEGACY); } -void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* msg, void**) -{ -/* - AvatarInterestsReply is automatically sent by the server in response to the - AvatarPropertiesRequest sent when the panel is opened (in addition to the AvatarPropertiesReply message). - If the interests panel is no longer part of the design (?) we should just register the message - to a handler function that does nothing. - That will suppress the warnings and be compatible with old server versions. - WARNING: LLTemplateMessageReader::decodeData: Message from 216.82.37.237:13000 with no handler function received: AvatarInterestsReply -*/ - - LLInterestsData interests_data; - - msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, interests_data.agent_id ); - msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, interests_data.avatar_id ); - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_WantToMask, interests_data.want_to_mask ); - msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_WantToText, interests_data.want_to_text ); - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_SkillsMask, interests_data.skills_mask ); - msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_SkillsText, interests_data.skills_text ); - msg->getString( _PREHASH_PropertiesData, _PREHASH_LanguagesText, interests_data.languages_text ); - - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(interests_data.avatar_id, APT_INTERESTS_INFO); - self->notifyObservers(interests_data.avatar_id, &interests_data, APT_INTERESTS_INFO); -} - void LLAvatarPropertiesProcessor::processAvatarClassifiedsReply(LLMessageSystem* msg, void**) { LLAvatarClassifieds classifieds; @@ -523,21 +473,6 @@ void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* ms self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO); } - -void LLAvatarPropertiesProcessor::processAvatarNotesReply(LLMessageSystem* msg, void**) -{ - LLAvatarNotes avatar_notes; - - msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_notes.agent_id); - msg->getUUID(_PREHASH_Data, _PREHASH_TargetID, avatar_notes.target_id); - msg->getString(_PREHASH_Data, _PREHASH_Notes, avatar_notes.notes); - - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(avatar_notes.target_id, APT_NOTES); - self->notifyObservers(avatar_notes.target_id,&avatar_notes,APT_NOTES); -} - void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, void**) { LLAvatarPicks avatar_picks; @@ -591,31 +526,6 @@ void LLAvatarPropertiesProcessor::processPickInfoReply(LLMessageSystem* msg, voi self->notifyObservers(pick_data.creator_id, &pick_data, APT_PICK_INFO); } -void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, void**) -{ - LLAvatarGroups avatar_groups; - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, avatar_groups.agent_id ); - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_groups.avatar_id ); - - S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData); - for(S32 i = 0; i < group_count; ++i) - { - LLAvatarGroups::LLGroupData group_data; - - msg->getU64( _PREHASH_GroupData, _PREHASH_GroupPowers, group_data.group_powers, i ); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_data.group_title, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_data.group_id, i); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i ); - - avatar_groups.group_list.emplace_back(group_data); - } - - LLAvatarPropertiesProcessor* self = getInstance(); - self->removePendingRequest(avatar_groups.avatar_id, APT_GROUPS); - self->notifyObservers(avatar_groups.avatar_id,&avatar_groups,APT_GROUPS); -} - void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id, void* data, EAvatarProcessorType type) { // Copy the map (because observers may delete themselves when updated?) @@ -652,27 +562,6 @@ void LLAvatarPropertiesProcessor::sendFriendRights(const LLUUID& avatar_id, S32 } } -void LLAvatarPropertiesProcessor::sendNotes(const LLUUID& avatar_id, const std::string notes) -{ - if(!avatar_id.isNull()) - { - LLMessageSystem* msg = gMessageSystem; - - // setup message header - msg->newMessageFast(_PREHASH_AvatarNotesUpdate); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgentID); - msg->addUUID(_PREHASH_SessionID, gAgentSessionID); - - msg->nextBlockFast(_PREHASH_Data); - msg->addUUID(_PREHASH_TargetID, avatar_id); - msg->addString(_PREHASH_Notes, notes); - - gAgent.sendReliableMessage(); - } -} - - void LLAvatarPropertiesProcessor::sendPickDelete( const LLUUID& pick_id ) { LLMessageSystem* msg = gMessageSystem; @@ -704,27 +593,6 @@ void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_ gAgent.sendReliableMessage(); } -void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* interests_data) -{ - if(!interests_data) - return; - - LLMessageSystem* msg = gMessageSystem; - - msg->newMessage(_PREHASH_AvatarInterestsUpdate); - msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast( _PREHASH_AgentID, gAgentID ); - msg->addUUIDFast( _PREHASH_SessionID, gAgentSessionID ); - msg->nextBlockFast( _PREHASH_PropertiesData); - msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask); - msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text); - msg->addU32Fast( _PREHASH_SkillsMask, interests_data->skills_mask); - msg->addStringFast( _PREHASH_SkillsText, interests_data->skills_text); - msg->addString( _PREHASH_LanguagesText, interests_data->languages_text); - - gAgent.sendReliableMessage(); -} - void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick) { if (!new_pick) diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index 330a5591b5..2bf8e879bd 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -50,45 +50,68 @@ class LLMessageSystem; enum EAvatarProcessorType { - APT_PROPERTIES_LEGACY, // APT_PROPERTIES via udp request + APT_PROPERTIES_LEGACY, // APT_PROPERTIES via udp request (Truncates data!!!) APT_PROPERTIES, // APT_PROPERTIES via http request - APT_NOTES, - APT_GROUPS, APT_PICKS, APT_PICK_INFO, APT_TEXTURES, - APT_INTERESTS_INFO, APT_CLASSIFIEDS, APT_CLASSIFIED_INFO }; -struct LLInterestsData +// legacy data is supposed to match AvatarPropertiesReply, +// but it is obsolete, fields like about_text will truncate +// data, if you need them, use AgenProfile cap. +// Todo: remove it once once icon ids get moved elsewhere, +// since AgentProfile is too large for bulk icon requests +struct LLAvatarLegacyData { - LLUUID agent_id; - LLUUID avatar_id; //target id - U32 want_to_mask; - std::string want_to_text; - U32 skills_mask; - std::string skills_text; - std::string languages_text; + LLUUID agent_id; + LLUUID avatar_id; //target id + LLUUID image_id; + LLUUID fl_image_id; + LLUUID partner_id; + std::string about_text; + std::string fl_about_text; + LLDate born_on; + std::string profile_url; + U8 caption_index; + std::string caption_text; + std::string customer_type; + U32 flags; }; struct LLAvatarData { - LLUUID agent_id; - LLUUID avatar_id; //target id - LLUUID image_id; - LLUUID fl_image_id; - LLUUID partner_id; - std::string about_text; - std::string fl_about_text; - LLDate born_on; - std::string profile_url; - U8 caption_index; - std::string caption_text; - std::string customer_type; - U32 flags; - bool hide_age; + LLUUID agent_id; + LLUUID avatar_id; //target id + LLUUID image_id; + LLUUID fl_image_id; + LLUUID partner_id; + std::string about_text; + std::string fl_about_text; + LLDate born_on; + std::string profile_url; + U8 caption_index; + std::string caption_text; + std::string customer_type; + U32 flags; + bool hide_age; + std::string notes; + + struct LLGroupData; + typedef std::list group_list_t; + group_list_t group_list; +}; + +struct LLAvatarData::LLGroupData +{ + U64 group_powers; + BOOL accept_notices; + std::string group_title; + LLUUID group_id; + std::string group_name; + LLUUID group_insignia_id; }; struct LLAvatarPicks @@ -122,36 +145,6 @@ struct LLPickData //used only in write (update) requests LLUUID session_id; - -}; - -struct LLAvatarNotes -{ - LLUUID agent_id; - LLUUID target_id; //target id - std::string notes; -}; - -struct LLAvatarGroups -{ - LLUUID agent_id; - LLUUID avatar_id; //target id - BOOL list_in_profile; - - struct LLGroupData; - typedef std::list group_list_t; - - group_list_t group_list; - - struct LLGroupData - { - U64 group_powers; - BOOL accept_notices; - std::string group_title; - LLUUID group_id; - std::string group_name; - LLUUID group_insignia_id; - }; }; struct LLAvatarClassifieds @@ -211,10 +204,9 @@ public: // Request various types of avatar data. Duplicate requests will be // suppressed while waiting for a response from the network. - void sendAvatarPropertiesRequest(const LLUUID& avatar_id, bool use_cap = false); + void sendAvatarPropertiesRequest(const LLUUID& avatar_id); + void sendAvatarLegacyPropertiesRequest(const LLUUID& avatar_id); void sendAvatarPicksRequest(const LLUUID& avatar_id); - void sendAvatarNotesRequest(const LLUUID& avatar_id); - void sendAvatarGroupsRequest(const LLUUID& avatar_id); void sendAvatarTexturesRequest(const LLUUID& avatar_id); void sendAvatarClassifiedsRequest(const LLUUID& avatar_id); @@ -229,14 +221,10 @@ public: void sendFriendRights(const LLUUID& avatar_id, S32 rights); - void sendNotes(const LLUUID& avatar_id, const std::string notes); - void sendPickDelete(const LLUUID& pick_id); void sendClassifiedDelete(const LLUUID& classified_id); - void sendInterestsInfoUpdate(const LLInterestsData* interests_data); - // Returns translated, human readable string for account type, such // as "Resident" or "Linden Employee". Used for profiles, inspectors. static std::string accountType(const LLAvatarData* avatar_data); @@ -252,16 +240,10 @@ public: static void processAvatarPropertiesReply(LLMessageSystem* msg, void**); - static void processAvatarInterestsReply(LLMessageSystem* msg, void**); - static void processAvatarClassifiedsReply(LLMessageSystem* msg, void**); static void processClassifiedInfoReply(LLMessageSystem* msg, void**); - static void processAvatarGroupsReply(LLMessageSystem* msg, void**); - - static void processAvatarNotesReply(LLMessageSystem* msg, void**); - static void processAvatarPicksReply(LLMessageSystem* msg, void**); static void processPickInfoReply(LLMessageSystem* msg, void**); diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index b0e63d5844..0cfac166c7 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -354,7 +354,7 @@ LLFetchAvatarPaymentInfo::~LLFetchAvatarPaymentInfo() void LLFetchAvatarPaymentInfo::processProperties(void* data, EAvatarProcessorType type) { - if (data && type == APT_PROPERTIES_LEGACY) + if (data && type == APT_PROPERTIES) { LLAvatarData* avatar_data = static_cast(data); LLFloaterBuyCurrency::handleBuyCurrency(LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(avatar_data), mHasTarget, mName, mPrice); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 1f5eb5fdff..ba61668d26 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -332,7 +332,7 @@ void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType t { if ( APT_PROPERTIES_LEGACY == type ) { - const LLAvatarData* pAvatarData = static_cast( pData ); + const LLAvatarLegacyData* pAvatarData = static_cast( pData ); if (pAvatarData && (gAgent.getID() == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) { mAllowPublish = (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH); @@ -662,7 +662,7 @@ void LLFloaterPreference::onOpen(const LLSD& key) (gAgent.isMature() || gAgent.isGodlike()); LLComboBox* maturity_combo = getChild("maturity_desired_combobox"); - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() ); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarLegacyPropertiesRequest( gAgent.getID() ); if (can_choose_maturity) { // if they're not adult or a god, they shouldn't see the adult selection, so delete it diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 4d003989fc..ca18dc343d 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -124,7 +124,7 @@ public: processor->addObserver(mAvatarID, this); // send a request (duplicates will be suppressed inside the avatar // properties processor) - processor->sendAvatarPropertiesRequest(mAvatarID, true); + processor->sendAvatarPropertiesRequest(mAvatarID); } ~LLFetchAvatarData() diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index a7a1f05c8a..ba5f6e2e09 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -159,6 +159,7 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) avatar_data->born_on = result["member_since"].asDate(); avatar_data->profile_url = getProfileURL(agent_id.asString()); avatar_data->customer_type = result["customer_type"].asString(); + avatar_data->notes = result["notes"].asString(); avatar_data->flags = 0; @@ -195,6 +196,21 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) result["hide_age"].asBoolean() : // Server option value provided by resident !panel_profile->getSelfProfile(); // Fallback temporary value (to be removed) + // Groups + LLSD groups_array = result["groups"]; + for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) + { + const LLSD& group_info = *it; + LLAvatarData::LLGroupData group_data; + group_data.group_powers = 0; // Not in use? + group_data.group_title = group_info["name"].asString(); // Missing data, not in use? + group_data.group_id = group_info["id"].asUUID(); + group_data.group_name = group_info["name"].asString(); + group_data.group_insignia_id = group_info["image_id"].asUUID(); + + avatar_data->group_list.push_back(group_data); + } + panel = floater_profile->findChild(PANEL_SECONDLIFE, TRUE); LLPanelProfileSecondLife *panel_sl = dynamic_cast(panel); if (panel_sl) @@ -216,6 +232,13 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) panel_first->processProperties(avatar_data); } + panel = floater_profile->findChild(PANEL_NOTES, TRUE); + LLPanelProfileNotes* panel_notes = dynamic_cast(panel); + if (panel_notes) + { + panel_notes->processProperties(avatar_data); + } + // Picks LLSD picks_array = result["picks"]; LLAvatarPicks avatar_picks; @@ -236,44 +259,6 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) LLAgentPicksInfo::getInstance()->onServerRespond(&avatar_picks); panel_picks->processProperties(&avatar_picks); } - - // Groups - LLSD groups_array = result["groups"]; - LLAvatarGroups avatar_groups; - avatar_groups.agent_id = agent_id; // Not in use? - avatar_groups.avatar_id = agent_id; // target_id - - for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) - { - const LLSD& group_info = *it; - LLAvatarGroups::LLGroupData group_data; - group_data.group_powers = 0; // Not in use? - group_data.group_title = group_info["name"].asString(); // Missing data, not in use? - group_data.group_id = group_info["id"].asUUID(); - group_data.group_name = group_info["name"].asString(); - group_data.group_insignia_id = group_info["image_id"].asUUID(); - - avatar_groups.group_list.push_back(group_data); - } - - if (panel_sl) - { - panel_sl->processGroupProperties(&avatar_groups); - } - - // Notes - LLAvatarNotes avatar_notes; - - avatar_notes.agent_id = agent_id; - avatar_notes.target_id = agent_id; - avatar_notes.notes = result["notes"].asString(); - - panel = floater_profile->findChild(PANEL_NOTES, TRUE); - LLPanelProfileNotes *panel_notes = dynamic_cast(panel); - if (panel_notes) - { - panel_notes->processProperties(&avatar_notes); - } } LLUUID post_profile_image(std::string cap_url, const LLSD &first_data, std::string path_to_image, LLHandle *handle) @@ -1052,21 +1037,18 @@ void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avat fillAccountStatus(avatar_data); - setLoaded(); -} - -void LLPanelProfileSecondLife::processGroupProperties(const LLAvatarGroups* avatar_groups) -{ - LLAvatarGroups::group_list_t::const_iterator it = avatar_groups->group_list.begin(); - const LLAvatarGroups::group_list_t::const_iterator it_end = avatar_groups->group_list.end(); + LLAvatarData::group_list_t::const_iterator it = avatar_data->group_list.begin(); + const LLAvatarData::group_list_t::const_iterator it_end = avatar_data->group_list.end(); for (; it_end != it; ++it) { - LLAvatarGroups::LLGroupData group_data = *it; + LLAvatarData::LLGroupData group_data = *it; mGroups[group_data.group_name] = group_data.group_id; } mGroupList->setGroups(mGroups); + + setLoaded(); } void LLPanelProfileSecondLife::openGroupProfile() @@ -2483,9 +2465,9 @@ void LLPanelProfileNotes::onDiscardNotesChanges() setNotesText(mCurrentNotes); } -void LLPanelProfileNotes::processProperties(LLAvatarNotes* avatar_notes) +void LLPanelProfileNotes::processProperties(const LLAvatarData* avatar_data) { - setNotesText(avatar_notes->notes); + setNotesText(avatar_data->notes); mNotesEditor->setEnabled(TRUE); setLoaded(); } diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index f4b618eb27..178c413659 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -115,11 +115,6 @@ protected: */ void processProfileProperties(const LLAvatarData* avatar_data); - /** - * Processes group related data received from server. - */ - void processGroupProperties(const LLAvatarGroups* avatar_groups); - /** * Fills common for Avatar profile and My Profile fields. */ @@ -335,7 +330,7 @@ public: BOOL postBuild() override; - void processProperties(LLAvatarNotes* avatar_notes); + void processProperties(const LLAvatarData* avatar_data); void resetData() override; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 228483d42b..cccd16a77e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2657,15 +2657,6 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("AvatarPropertiesReply", &LLAvatarPropertiesProcessor::processAvatarPropertiesReply); - msg->setHandlerFunc("AvatarInterestsReply", - &LLAvatarPropertiesProcessor::processAvatarInterestsReply); - msg->setHandlerFunc("AvatarGroupsReply", - &LLAvatarPropertiesProcessor::processAvatarGroupsReply); - // ratings deprecated - //msg->setHandlerFuncFast(_PREHASH_AvatarStatisticsReply, - // LLPanelAvatar::processAvatarStatisticsReply); - msg->setHandlerFunc("AvatarNotesReply", - &LLAvatarPropertiesProcessor::processAvatarNotesReply); msg->setHandlerFunc("AvatarPicksReply", &LLAvatarPropertiesProcessor::processAvatarPicksReply); msg->setHandlerFunc("AvatarClassifiedReply", From f54d0329f32081883704cc2694871600f896006b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 24 Oct 2023 00:14:21 +0300 Subject: [PATCH 12/13] SL-20513 Cleanup LLAvatarPropertiesProcessor #2 --- indra/newview/llagentpicksinfo.cpp | 12 +- indra/newview/llagentpicksinfo.h | 4 +- indra/newview/llavatarpropertiesprocessor.cpp | 189 +++++++----------- indra/newview/llavatarpropertiesprocessor.h | 21 +- indra/newview/llpanelprofile.cpp | 25 +-- indra/newview/llpanelprofilepicks.cpp | 12 +- indra/newview/llpanelprofilepicks.h | 2 +- indra/newview/llstartup.cpp | 4 +- 8 files changed, 108 insertions(+), 161 deletions(-) diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp index 799060eeab..0b72f1ee4d 100644 --- a/indra/newview/llagentpicksinfo.cpp +++ b/indra/newview/llagentpicksinfo.cpp @@ -49,10 +49,10 @@ public: void sendAgentPicksRequest() { - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(gAgent.getID()); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgent.getID()); } - typedef boost::function server_respond_callback_t; + typedef boost::function server_respond_callback_t; void setServerRespondCallback(const server_respond_callback_t& cb) { @@ -61,10 +61,10 @@ public: virtual void processProperties(void* data, EAvatarProcessorType type) { - if(APT_PICKS == type) + if(APT_PROPERTIES == type) { - LLAvatarPicks* picks = static_cast(data); - if(picks && gAgent.getID() == picks->target_id) + LLAvatarData* picks = static_cast(data); + if(picks && gAgent.getID() == picks->avatar_id) { if(mServerRespondCallback) { @@ -115,7 +115,7 @@ bool LLAgentPicksInfo::isPickLimitReached() return getNumberOfPicks() >= getMaxNumberOfPicks(); } -void LLAgentPicksInfo::onServerRespond(LLAvatarPicks* picks) +void LLAgentPicksInfo::onServerRespond(LLAvatarData* picks) { if(!picks) { diff --git a/indra/newview/llagentpicksinfo.h b/indra/newview/llagentpicksinfo.h index 21df036cb7..56e7bd0775 100644 --- a/indra/newview/llagentpicksinfo.h +++ b/indra/newview/llagentpicksinfo.h @@ -29,7 +29,7 @@ #include "llsingleton.h" -struct LLAvatarPicks; +struct LLAvatarData; /** * Class that provides information about Agent Picks @@ -74,7 +74,7 @@ public: void decrementNumberOfPicks() { --mNumberOfPicks; } - void onServerRespond(LLAvatarPicks* picks); + void onServerRespond(LLAvatarData* picks); private: diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 472cf8b8d5..5b28e9f4c6 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -115,20 +115,19 @@ void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarPr } // Try to send HTTP request if cap_url is available - if (type == APT_PROPERTIES || type == APT_PICKS) + if (type == APT_PROPERTIES) { - if (std::string cap_url(gAgent.getRegionCapability("AgentProfile")); !cap_url.empty()) + std::string cap_url = gAgent.getRegionCapability("AgentProfile"); + if (!cap_url.empty()) { initAgentProfileCapRequest(avatar_id, cap_url, type); - return; } - - // Don't sent UDP request for APT_PROPERTIES - if (type == APT_PROPERTIES) + else { - LL_WARNS() << "No cap_url for APT_PROPERTIES, request is not sent" << LL_ENDL; - return; + // Don't sent UDP request for APT_PROPERTIES + LL_WARNS() << "No cap_url for APT_PROPERTIES, request for " << avatar_id << " is not sent" << LL_ENDL; } + return; } // Send UDP request @@ -182,11 +181,6 @@ void LLAvatarPropertiesProcessor::sendAvatarLegacyPropertiesRequest(const LLUUID sendRequest(avatar_id, APT_PROPERTIES_LEGACY, "AvatarPropertiesRequest"); } -void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id) -{ - sendGenericRequest(avatar_id, APT_PICKS, "avatarpicksrequest"); -} - void LLAvatarPropertiesProcessor::sendAvatarTexturesRequest(const LLUUID& avatar_id) { sendGenericRequest(avatar_id, APT_TEXTURES, "avatartexturesrequest"); @@ -300,90 +294,80 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur return; } - if (type == APT_PROPERTIES) + LLAvatarData avatar_data; + + std::string birth_date; + + avatar_data.agent_id = gAgentID; + avatar_data.avatar_id = avatar_id; + avatar_data.image_id = result["sl_image_id"].asUUID(); + avatar_data.fl_image_id = result["fl_image_id"].asUUID(); + avatar_data.partner_id = result["partner_id"].asUUID(); + avatar_data.about_text = result["sl_about_text"].asString(); + avatar_data.fl_about_text = result["fl_about_text"].asString(); + avatar_data.born_on = result["member_since"].asDate(); + // TODO: SL-20163 Remove the "has" check when SRV-684 is done + // and the field "hide_age" is included to the http response + avatar_data.hide_age = !result.has("hide_age") || result["hide_age"].asBoolean(); + avatar_data.profile_url = getProfileURL(avatar_id.asString()); + avatar_data.customer_type = result["customer_type"].asString(); + avatar_data.notes = result["notes"].asString(); + + avatar_data.flags = 0; + if (result["online"].asBoolean()) { - LLAvatarData avatar_data; - - std::string birth_date; - - avatar_data.agent_id = gAgentID; - avatar_data.avatar_id = avatar_id; - avatar_data.image_id = result["sl_image_id"].asUUID(); - avatar_data.fl_image_id = result["fl_image_id"].asUUID(); - avatar_data.partner_id = result["partner_id"].asUUID(); - avatar_data.about_text = result["sl_about_text"].asString(); - avatar_data.fl_about_text = result["fl_about_text"].asString(); - avatar_data.born_on = result["member_since"].asDate(); - // TODO: SL-20163 Remove the "has" check when SRV-684 is done - // and the field "hide_age" is included to the http response - avatar_data.hide_age = !result.has("hide_age") || result["hide_age"].asBoolean(); - avatar_data.profile_url = getProfileURL(avatar_id.asString()); - avatar_data.customer_type = result["customer_type"].asString(); - avatar_data.notes = result["notes"].asString(); - - avatar_data.flags = 0; - if (result["online"].asBoolean()) - { - avatar_data.flags |= AVATAR_ONLINE; - } - if (result["allow_publish"].asBoolean()) - { - avatar_data.flags |= AVATAR_ALLOW_PUBLISH; - } - if (result["identified"].asBoolean()) - { - avatar_data.flags |= AVATAR_IDENTIFIED; - } - if (result["transacted"].asBoolean()) - { - avatar_data.flags |= AVATAR_TRANSACTED; - } - - avatar_data.caption_index = 0; - if (result.has("charter_member")) // won't be present if "caption" is set - { - avatar_data.caption_index = result["charter_member"].asInteger(); - } - else if (result.has("caption")) - { - avatar_data.caption_text = result["caption"].asString(); - } - - LLSD groups_array = result["groups"]; - for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) - { - const LLSD& group_info = *it; - LLAvatarData::LLGroupData group_data; - group_data.group_powers = 0; // Not in use? - group_data.group_title = group_info["name"].asString(); // Missing data, not in use? - group_data.group_id = group_info["id"].asUUID(); - group_data.group_name = group_info["name"].asString(); - group_data.group_insignia_id = group_info["image_id"].asUUID(); - - avatar_data.group_list.push_back(group_data); - } - - getInstance()->notifyObservers(avatar_id, &avatar_data, type); + avatar_data.flags |= AVATAR_ONLINE; } - else if (type == APT_PICKS) + if (result["allow_publish"].asBoolean()) { - LLAvatarPicks avatar_picks; - - avatar_picks.agent_id = gAgentID; // Not in use? - avatar_picks.target_id = avatar_id; - - LLSD picks_array = result["picks"]; - for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it) - { - const LLSD& pick_data = *it; - avatar_picks.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); - } - - getInstance()->notifyObservers(avatar_id, &avatar_picks, type); + avatar_data.flags |= AVATAR_ALLOW_PUBLISH; } + if (result["identified"].asBoolean()) + { + avatar_data.flags |= AVATAR_IDENTIFIED; + } + if (result["transacted"].asBoolean()) + { + avatar_data.flags |= AVATAR_TRANSACTED; + } + + avatar_data.caption_index = 0; + if (result.has("charter_member")) // won't be present if "caption" is set + { + avatar_data.caption_index = result["charter_member"].asInteger(); + } + else if (result.has("caption")) + { + avatar_data.caption_text = result["caption"].asString(); + } + + // Groups + LLSD groups_array = result["groups"]; + for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) + { + const LLSD& group_info = *it; + LLAvatarData::LLGroupData group_data; + group_data.group_powers = 0; // Not in use? + group_data.group_title = group_info["name"].asString(); // Missing data, not in use? + group_data.group_id = group_info["id"].asUUID(); + group_data.group_name = group_info["name"].asString(); + group_data.group_insignia_id = group_info["image_id"].asUUID(); + + avatar_data.group_list.push_back(group_data); + } + + // Picks + LLSD picks_array = result["picks"]; + for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it) + { + const LLSD& pick_data = *it; + avatar_data.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); + } + + getInstance()->notifyObservers(avatar_id, &avatar_data, type); } -void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**) +void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSystem* msg, void**) { LLAvatarData avatar_data; std::string birth_date; @@ -473,29 +457,6 @@ void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* ms self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO); } -void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, void**) -{ - LLAvatarPicks avatar_picks; - msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_picks.agent_id); - msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, avatar_picks.target_id); - - S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data); - for (int block = 0; block < block_count; ++block) - { - LLUUID pick_id; - std::string pick_name; - - msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block); - msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block); - - avatar_picks.picks_list.emplace_back(pick_id, pick_name); - } - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(avatar_picks.target_id, APT_PICKS); - self->notifyObservers(avatar_picks.target_id,&avatar_picks,APT_PICKS); -} - void LLAvatarPropertiesProcessor::processPickInfoReply(LLMessageSystem* msg, void**) { LLPickData pick_data; diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index 2bf8e879bd..1bf07704a9 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -52,7 +52,6 @@ enum EAvatarProcessorType { APT_PROPERTIES_LEGACY, // APT_PROPERTIES via udp request (Truncates data!!!) APT_PROPERTIES, // APT_PROPERTIES via http request - APT_PICKS, APT_PICK_INFO, APT_TEXTURES, APT_CLASSIFIEDS, @@ -102,6 +101,10 @@ struct LLAvatarData struct LLGroupData; typedef std::list group_list_t; group_list_t group_list; + + typedef std::pair pick_data_t; + typedef std::list< pick_data_t> picks_list_t; + picks_list_t picks_list; }; struct LLAvatarData::LLGroupData @@ -114,16 +117,6 @@ struct LLAvatarData::LLGroupData LLUUID group_insignia_id; }; -struct LLAvatarPicks -{ - LLUUID agent_id; - LLUUID target_id; //target id - - typedef std::pair pick_data_t; - typedef std::list< pick_data_t> picks_list_t; - picks_list_t picks_list; -}; - struct LLPickData { LLUUID agent_id; @@ -206,7 +199,6 @@ public: // suppressed while waiting for a response from the network. void sendAvatarPropertiesRequest(const LLUUID& avatar_id); void sendAvatarLegacyPropertiesRequest(const LLUUID& avatar_id); - void sendAvatarPicksRequest(const LLUUID& avatar_id); void sendAvatarTexturesRequest(const LLUUID& avatar_id); void sendAvatarClassifiedsRequest(const LLUUID& avatar_id); @@ -238,14 +230,13 @@ public: static void requestAvatarPropertiesCoro(std::string cap_url, LLUUID avatar_id, EAvatarProcessorType type); - static void processAvatarPropertiesReply(LLMessageSystem* msg, void**); + // Processing of UDP variant of properties, truncates certain fields! + static void processAvatarLegacyPropertiesReply(LLMessageSystem* msg, void**); static void processAvatarClassifiedsReply(LLMessageSystem* msg, void**); static void processClassifiedInfoReply(LLMessageSystem* msg, void**); - static void processAvatarPicksReply(LLMessageSystem* msg, void**); - static void processPickInfoReply(LLMessageSystem* msg, void**); protected: diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index ba5f6e2e09..7cd58ff6f4 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -211,6 +211,15 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) avatar_data->group_list.push_back(group_data); } + // Picks + LLSD picks_array = result["picks"]; + + for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it) + { + const LLSD& pick_data = *it; + avatar_data->picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); + } + panel = floater_profile->findChild(PANEL_SECONDLIFE, TRUE); LLPanelProfileSecondLife *panel_sl = dynamic_cast(panel); if (panel_sl) @@ -239,25 +248,13 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) panel_notes->processProperties(avatar_data); } - // Picks - LLSD picks_array = result["picks"]; - LLAvatarPicks avatar_picks; - avatar_picks.agent_id = agent_id; // Not in use? - avatar_picks.target_id = agent_id; - - for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it) - { - const LLSD& pick_data = *it; - avatar_picks.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); - } - panel = floater_profile->findChild(PANEL_PICKS, TRUE); LLPanelProfilePicks *panel_picks = dynamic_cast(panel); if (panel_picks) { // Refresh pick limit before processing - LLAgentPicksInfo::getInstance()->onServerRespond(&avatar_picks); - panel_picks->processProperties(&avatar_picks); + LLAgentPicksInfo::getInstance()->onServerRespond(avatar_data); + panel_picks->processProperties(avatar_data); } } diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index fa42199089..f49ed2d644 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -289,17 +289,17 @@ void LLPanelProfilePicks::callbackDeletePick(const LLSD& notification, const LLS void LLPanelProfilePicks::processProperties(void* data, EAvatarProcessorType type) { - if (APT_PICKS == type) + if (APT_PROPERTIES == type) { - LLAvatarPicks* avatar_picks = static_cast(data); - if (avatar_picks && getAvatarId() == avatar_picks->target_id) + LLAvatarData* avatar_picks = static_cast(data); + if (avatar_picks && getAvatarId() == avatar_picks->avatar_id) { processProperties(avatar_picks); } } } -void LLPanelProfilePicks::processProperties(const LLAvatarPicks* avatar_picks) +void LLPanelProfilePicks::processProperties(const LLAvatarData* avatar_picks) { LLUUID selected_id = mPickToSelectOnLoad; bool has_selection = false; @@ -317,7 +317,7 @@ void LLPanelProfilePicks::processProperties(const LLAvatarPicks* avatar_picks) mTabContainer->deleteAllTabs(); - LLAvatarPicks::picks_list_t::const_iterator it = avatar_picks->picks_list.begin(); + LLAvatarData::picks_list_t::const_iterator it = avatar_picks->picks_list.begin(); for (; avatar_picks->picks_list.end() != it; ++it) { LLUUID pick_id = it->first; @@ -421,7 +421,7 @@ void LLPanelProfilePicks::updateData() { setIsLoading(); - LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(avatar_id); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(avatar_id); } if (!getIsLoaded()) { diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h index f84463cc9b..fc29a9de0f 100644 --- a/indra/newview/llpanelprofilepicks.h +++ b/indra/newview/llpanelprofilepicks.h @@ -58,7 +58,7 @@ public: void selectPick(const LLUUID& pick_id); void processProperties(void* data, EAvatarProcessorType type) override; - void processProperties(const LLAvatarPicks* avatar_picks); + void processProperties(const LLAvatarData* avatar_picks); void resetData() override; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index cccd16a77e..916848ff5f 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2656,9 +2656,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) LLViewerParcelMgr::processParcelDwellReply); msg->setHandlerFunc("AvatarPropertiesReply", - &LLAvatarPropertiesProcessor::processAvatarPropertiesReply); - msg->setHandlerFunc("AvatarPicksReply", - &LLAvatarPropertiesProcessor::processAvatarPicksReply); + &LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply); msg->setHandlerFunc("AvatarClassifiedReply", &LLAvatarPropertiesProcessor::processAvatarClassifiedsReply); From 69aa02d2e1873970302942487b96d3a6aca119e5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 24 Oct 2023 23:02:56 +0300 Subject: [PATCH 13/13] SL-20513 Make profile floater use properties processor #3 --- indra/newview/llpanelavatar.cpp | 10 + indra/newview/llpanelavatar.h | 10 +- indra/newview/llpanelclassified.cpp | 5 + indra/newview/llpanelprofile.cpp | 258 +++++--------------------- indra/newview/llpanelprofile.h | 33 +--- indra/newview/llpanelprofilepicks.cpp | 4 + indra/newview/llpanelprofilepicks.h | 2 - 7 files changed, 77 insertions(+), 245 deletions(-) diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 626978f9fb..ad8ed7c144 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -194,3 +194,13 @@ void LLPanelProfilePropertiesProcessorTab::setAvatarId(const LLUUID & avatar_id) LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); } } + +void LLPanelProfilePropertiesProcessorTab::updateData() +{ + LLUUID avatar_id = getAvatarId(); + if (!getStarted() && avatar_id.notNull()) + { + setIsLoading(); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(getAvatarId()); + } +} diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index 572e1eb029..1106c44734 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -97,12 +97,12 @@ public: /** * Sends update data request to server. */ - virtual void updateData() {}; + virtual void updateData(){}; /** * Clears panel data if viewing avatar info for first time and sends update data request. */ - virtual void onOpen(const LLSD& key); + virtual void onOpen(const LLSD& key) override; /** * Clears all data received from server. @@ -160,12 +160,14 @@ public: LLPanelProfilePropertiesProcessorTab(); ~LLPanelProfilePropertiesProcessorTab(); - /*virtual*/ void setAvatarId(const LLUUID& avatar_id); + void setAvatarId(const LLUUID& avatar_id) override; + + void updateData() override; /** * Processes data received from server via LLAvatarPropertiesObserver. */ - virtual void processProperties(void* data, EAvatarProcessorType type) = 0; + virtual void processProperties(void* data, EAvatarProcessorType type) override = 0; }; #endif // LL_LLPANELAVATAR_H diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 183000ceac..e926ed2b3c 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -104,6 +104,11 @@ LLPanelClassifiedInfo::LLPanelClassifiedInfo() LLPanelClassifiedInfo::~LLPanelClassifiedInfo() { sAllPanels.remove(this); + + if (getAvatarId().notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); + } } BOOL LLPanelClassifiedInfo::postBuild() diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 7cd58ff6f4..eb62627278 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -102,162 +102,6 @@ static const std::string PROFILE_IMAGE_UPLOAD_CAP = "UploadAgentProfileImage"; ////////////////////////////////////////////////////////////////////////// -void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) -{ - LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("request_avatar_properties_coro", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpHeaders::ptr_t httpHeaders; - - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - httpOpts->setFollowRedirects(true); - - std::string finalUrl = cap_url + "/" + agent_id.asString(); - - LLSD result = httpAdapter->getAndSuspend(httpRequest, finalUrl, httpOpts, httpHeaders); - - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - - LL_DEBUGS("AvatarProperties") << "Agent id: " << agent_id << " Result: " << httpResults << LL_ENDL; - - if (!status - || !result.has("id") - || agent_id != result["id"].asUUID()) - { - LL_WARNS("AvatarProperties") << "Failed to get agent information for id " << agent_id << LL_ENDL; - return; - } - - LLFloater* floater_profile = LLFloaterReg::findInstance("profile", LLSD().with("id", agent_id)); - if (!floater_profile) - { - // floater is dead, so panels are dead as well - return; - } - - LLPanel *panel = floater_profile->findChild(PANEL_PROFILE_VIEW, TRUE); - LLPanelProfile *panel_profile = dynamic_cast(panel); - if (!panel_profile) - { - LL_WARNS() << PANEL_PROFILE_VIEW << " not found" << LL_ENDL; - return; - } - - // Avatar Data - LLAvatarData *avatar_data = &panel_profile->mAvatarData; - std::string birth_date; - - avatar_data->agent_id = agent_id; - avatar_data->avatar_id = agent_id; - avatar_data->image_id = result["sl_image_id"].asUUID(); - avatar_data->fl_image_id = result["fl_image_id"].asUUID(); - avatar_data->partner_id = result["partner_id"].asUUID(); - avatar_data->about_text = result["sl_about_text"].asString(); - avatar_data->fl_about_text = result["fl_about_text"].asString(); - avatar_data->born_on = result["member_since"].asDate(); - avatar_data->profile_url = getProfileURL(agent_id.asString()); - avatar_data->customer_type = result["customer_type"].asString(); - avatar_data->notes = result["notes"].asString(); - - avatar_data->flags = 0; - - if (result["online"].asBoolean()) - { - avatar_data->flags |= AVATAR_ONLINE; - } - if (result["allow_publish"].asBoolean()) - { - avatar_data->flags |= AVATAR_ALLOW_PUBLISH; - } - if (result["identified"].asBoolean()) - { - avatar_data->flags |= AVATAR_IDENTIFIED; - } - if (result["transacted"].asBoolean()) - { - avatar_data->flags |= AVATAR_TRANSACTED; - } - - avatar_data->caption_index = 0; - if (result.has("charter_member")) // won't be present if "caption" is set - { - avatar_data->caption_index = result["charter_member"].asInteger(); - } - else if (result.has("caption")) - { - avatar_data->caption_text = result["caption"].asString(); - } - - // TODO: SL-20163 Remove the "has" check when SRV-684 is done - // and the field "hide_age" is included to the http response - avatar_data->hide_age = result.has("hide_age") ? - result["hide_age"].asBoolean() : // Server option value provided by resident - !panel_profile->getSelfProfile(); // Fallback temporary value (to be removed) - - // Groups - LLSD groups_array = result["groups"]; - for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) - { - const LLSD& group_info = *it; - LLAvatarData::LLGroupData group_data; - group_data.group_powers = 0; // Not in use? - group_data.group_title = group_info["name"].asString(); // Missing data, not in use? - group_data.group_id = group_info["id"].asUUID(); - group_data.group_name = group_info["name"].asString(); - group_data.group_insignia_id = group_info["image_id"].asUUID(); - - avatar_data->group_list.push_back(group_data); - } - - // Picks - LLSD picks_array = result["picks"]; - - for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it) - { - const LLSD& pick_data = *it; - avatar_data->picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); - } - - panel = floater_profile->findChild(PANEL_SECONDLIFE, TRUE); - LLPanelProfileSecondLife *panel_sl = dynamic_cast(panel); - if (panel_sl) - { - panel_sl->processProfileProperties(avatar_data); - } - - panel = floater_profile->findChild(PANEL_WEB, TRUE); - LLPanelProfileWeb *panel_web = dynamic_cast(panel); - if (panel_web) - { - panel_web->setLoaded(); - } - - panel = floater_profile->findChild(PANEL_FIRSTLIFE, TRUE); - LLPanelProfileFirstLife *panel_first = dynamic_cast(panel); - if (panel_first) - { - panel_first->processProperties(avatar_data); - } - - panel = floater_profile->findChild(PANEL_NOTES, TRUE); - LLPanelProfileNotes* panel_notes = dynamic_cast(panel); - if (panel_notes) - { - panel_notes->processProperties(avatar_data); - } - - panel = floater_profile->findChild(PANEL_PICKS, TRUE); - LLPanelProfilePicks *panel_picks = dynamic_cast(panel); - if (panel_picks) - { - // Refresh pick limit before processing - LLAgentPicksInfo::getInstance()->onServerRespond(avatar_data); - panel_picks->processProperties(avatar_data); - } -} - LLUUID post_profile_image(std::string cap_url, const LLSD &first_data, std::string path_to_image, LLHandle *handle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -835,7 +679,7 @@ void LLFloaterProfilePermissions::onCancel() // LLPanelProfileSecondLife LLPanelProfileSecondLife::LLPanelProfileSecondLife() - : LLPanelProfileTab() + : LLPanelProfilePropertiesProcessorTab() , mAvatarNameCacheConnection() , mHasUnsavedDescriptionChanges(false) , mWaitingForImageUpload(false) @@ -952,26 +796,6 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&LLPanelProfileSecondLife::onAvatarNameCache, this, _1, _2)); } -void LLPanelProfileSecondLife::updateData() -{ - LLUUID avatar_id = getAvatarId(); - if (!getStarted() && avatar_id.notNull()) - { - setIsLoading(); - - std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP); - if (!cap_url.empty()) - { - LLCoros::instance().launch("requestAgentUserInfoCoro", - [cap_url, avatar_id]() { request_avatar_properties_coro(cap_url, avatar_id); }); - } - else - { - LL_WARNS() << "Failed to update profile data, no cap found" << LL_ENDL; - } - } -} - void LLPanelProfileSecondLife::refreshName() { if (!mAvatarNameCacheConnection.connected()) @@ -1015,6 +839,18 @@ void LLPanelProfileSecondLife::resetData() childSetVisible("partner_spacer_layout", TRUE); } +void LLPanelProfileSecondLife::processProperties(void* data, EAvatarProcessorType type) +{ + if (APT_PROPERTIES == type) + { + LLAvatarData* avatar_data = static_cast(data); + if (avatar_data && getAvatarId() == avatar_data->avatar_id) + { + processProfileProperties(avatar_data); + } + } +} + void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avatar_data) { const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); @@ -1316,14 +1152,15 @@ void LLPanelProfileSecondLife::fillAgeData(const LLAvatarData* avatar_data) { // Date from server comes already converted to stl timezone, // so display it as an UTC + 0 - std::string name_and_date = getString(avatar_data->hide_age ? "date_format_short" : "date_format_full"); + bool hide_age = avatar_data->hide_age && !getSelfProfile(); + std::string name_and_date = getString(hide_age ? "date_format_short" : "date_format_full"); LLSD args_name; args_name["datetime"] = (S32)avatar_data->born_on.secondsSinceEpoch(); LLStringUtil::format(name_and_date, args_name); getChild("sl_birth_date")->setValue(name_and_date); LLUICtrl* userAgeCtrl = getChild("user_age"); - if (avatar_data->hide_age) + if (hide_age) { userAgeCtrl->setVisible(FALSE); } @@ -1424,7 +1261,7 @@ void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id) LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); } - LLPanelProfileTab::setAvatarId(avatar_id); + LLPanelProfilePropertiesProcessorTab::setAvatarId(avatar_id); if (LLAvatarActions::isFriend(getAvatarId())) { @@ -2111,6 +1948,8 @@ void LLPanelProfileWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e LLStringUtil::format_map_t args; args["[TIME]"] = llformat("%.2f", mPerformanceTimer.getElapsedTimeF32()); childSetValue("status_text", LLSD( getString("LoadTime", args)) ); + + setLoaded(); } break; @@ -2126,7 +1965,7 @@ void LLPanelProfileWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e ////////////////////////////////////////////////////////////////////////// LLPanelProfileFirstLife::LLPanelProfileFirstLife() - : LLPanelProfileTab() + : LLPanelProfilePropertiesProcessorTab() , mHasUnsavedChanges(false) { } @@ -2328,6 +2167,18 @@ void LLPanelProfileFirstLife::onDiscardDescriptionChanges() setDescriptionText(mCurrentDescription); } +void LLPanelProfileFirstLife::processProperties(void* data, EAvatarProcessorType type) +{ + if (APT_PROPERTIES == type) + { + LLAvatarData* avatar_data = static_cast(data); + if (avatar_data && getAvatarId() == avatar_data->avatar_id) + { + processProperties(avatar_data); + } + } +} + void LLPanelProfileFirstLife::processProperties(const LLAvatarData* avatar_data) { setDescriptionText(avatar_data->fl_about_text); @@ -2376,7 +2227,7 @@ void LLPanelProfileFirstLife::setLoaded() ////////////////////////////////////////////////////////////////////////// LLPanelProfileNotes::LLPanelProfileNotes() -: LLPanelProfileTab() +: LLPanelProfilePropertiesProcessorTab() , mHasUnsavedChanges(false) { @@ -2386,22 +2237,6 @@ LLPanelProfileNotes::~LLPanelProfileNotes() { } -void LLPanelProfileNotes::updateData() -{ - LLUUID avatar_id = getAvatarId(); - if (!getStarted() && avatar_id.notNull()) - { - setIsLoading(); - - std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP); - if (!cap_url.empty()) - { - LLCoros::instance().launch("requestAgentUserInfoCoro", - [cap_url, avatar_id]() { request_avatar_properties_coro(cap_url, avatar_id); }); - } - } -} - void LLPanelProfileNotes::commitUnsavedChanges() { if (mHasUnsavedChanges) @@ -2462,6 +2297,18 @@ void LLPanelProfileNotes::onDiscardNotesChanges() setNotesText(mCurrentNotes); } +void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType type) +{ + if (APT_PROPERTIES == type) + { + LLAvatarData* avatar_data = static_cast(data); + if (avatar_data && getAvatarId() == avatar_data->avatar_id) + { + processProperties(avatar_data); + } + } +} + void LLPanelProfileNotes::processProperties(const LLAvatarData* avatar_data) { setNotesText(avatar_data->notes); @@ -2475,14 +2322,6 @@ void LLPanelProfileNotes::resetData() setNotesText(std::string()); } -void LLPanelProfileNotes::setAvatarId(const LLUUID& avatar_id) -{ - if (avatar_id.notNull()) - { - LLPanelProfileTab::setAvatarId(avatar_id); - } -} - ////////////////////////////////////////////////////////////////////////// // LLPanelProfile @@ -2559,12 +2398,7 @@ void LLPanelProfile::updateData() mPanelFirstlife->setIsLoading(); mPanelNotes->setIsLoading(); - std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP); - if (!cap_url.empty()) - { - LLCoros::instance().launch("requestAgentUserInfoCoro", - [cap_url, avatar_id]() { request_avatar_properties_coro(cap_url, avatar_id); }); - } + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(getAvatarId()); } } diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 178c413659..221a576a65 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -68,7 +68,7 @@ class LLViewerFetchedTexture; * Panel for displaying Avatar's second life related info. */ class LLPanelProfileSecondLife - : public LLPanelProfileTab + : public LLPanelProfilePropertiesProcessorTab , public LLFriendObserver , public LLVoiceClientStatusObserver { @@ -93,10 +93,6 @@ public: void resetData() override; - /** - * Sends update data request to server. - */ - void updateData() override; void refreshName(); void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); @@ -107,7 +103,7 @@ public: bool hasUnsavedChanges() override; void commitUnsavedChanges() override; - friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id); + void processProperties(void* data, EAvatarProcessorType type) override; protected: /** @@ -245,8 +241,6 @@ public: void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); - friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id); - protected: void onCommitLoad(LLUICtrl* ctrl); @@ -265,7 +259,7 @@ private: * Panel for displaying Avatar's first life related info. */ class LLPanelProfileFirstLife - : public LLPanelProfileTab + : public LLPanelProfilePropertiesProcessorTab { public: LLPanelProfileFirstLife(); @@ -275,6 +269,7 @@ public: BOOL postBuild() override; + void processProperties(void* data, EAvatarProcessorType type) override; void processProperties(const LLAvatarData* avatar_data); void resetData() override; @@ -285,8 +280,6 @@ public: bool hasUnsavedChanges() override { return mHasUnsavedChanges; } void commitUnsavedChanges() override; - friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id); - protected: void setLoaded() override; @@ -318,24 +311,21 @@ protected: * Panel for displaying Avatar's notes and modifying friend's rights. */ class LLPanelProfileNotes - : public LLPanelProfileTab + : public LLPanelProfilePropertiesProcessorTab { public: LLPanelProfileNotes(); /*virtual*/ ~LLPanelProfileNotes(); - void setAvatarId(const LLUUID& avatar_id) override; - void onOpen(const LLSD& key) override; BOOL postBuild() override; + void processProperties(void* data, EAvatarProcessorType type) override; void processProperties(const LLAvatarData* avatar_data); void resetData() override; - void updateData() override; - bool hasUnsavedChanges() override { return mHasUnsavedChanges; } void commitUnsavedChanges() override; @@ -382,10 +372,6 @@ public: void showClassified(const LLUUID& classified_id = LLUUID::null, bool edit = false); void createClassified(); - LLAvatarData getAvatarData() { return mAvatarData; }; - - friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id); - private: void onTabChange(); @@ -396,13 +382,6 @@ private: LLPanelProfileFirstLife* mPanelFirstlife; LLPanelProfileNotes* mPanelNotes; LLTabContainer* mTabContainer; - - // Todo: due to server taking minutes to update this needs a more long term storage - // to reuse recently saved values if user opens floater again - // Storage implementation depends onto how a cap will be implemented, if cap will be - // enought to fully update LLAvatarPropertiesProcessor, then this storage can be - // implemented there. - LLAvatarData mAvatarData; }; #endif //LL_LLPANELPROFILE_H diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index f49ed2d644..13c35a27a0 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -294,6 +294,10 @@ void LLPanelProfilePicks::processProperties(void* data, EAvatarProcessorType typ LLAvatarData* avatar_picks = static_cast(data); if (avatar_picks && getAvatarId() == avatar_picks->avatar_id) { + if (getSelfProfile()) + { + LLAgentPicksInfo::getInstance()->onServerRespond(avatar_picks); + } processProperties(avatar_picks); } } diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h index fc29a9de0f..79a5ace865 100644 --- a/indra/newview/llpanelprofilepicks.h +++ b/indra/newview/llpanelprofilepicks.h @@ -77,8 +77,6 @@ public: bool hasUnsavedChanges() override; void commitUnsavedChanges() override; - friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id); - private: void onClickNewBtn(); void onClickDelete();