From 453a4a13f87d5cbfa6150a4f76f9e976692b54e6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 20 Dec 2022 17:44:08 +0200 Subject: SL-13610 [MAC] WIP enable initing devices by local id --- autobuild.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'autobuild.xml') 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 -- cgit v1.3 From 3084f864176dffbc5da19e6f958a55513f63e795 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 29 Dec 2022 19:16:15 +0200 Subject: SL-13610 [MAC] Manufacturer based search --- autobuild.xml | 6 +- indra/llwindow/llwindow.h | 2 +- indra/llwindow/llwindowmacosx.cpp | 251 ++++++++++++++++++++++---------- 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, 288 insertions(+), 179 deletions(-) (limited to 'autobuild.xml') 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) } } +// String should match ndof, so string mapping code was copied as is +static char mapChar( char c ) +{ + 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; +} -// 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; -}; +// String should match ndof for manufacturer based search to work +static void sanitizeString( char* inCStr ) +{ + 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,18 +2208,31 @@ 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 ); if ( KERN_SUCCESS != result ) @@ -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(); + + strncpy(mNdofDev->manufacturer, manufacturer.c_str(), sizeof(mNdofDev->manufacturer)); + strncpy(mNdofDev->product, product.c_str(), sizeof(mNdofDev->product)); - // todo: search by manufcturer instead, locid might have changed - NDOF_Device *device = ndof_idsearch(id); - if (device) + 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); -- cgit v1.3 From 6e6df8c31e09e6ba69156150ecd37cc4ac4ea0e6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 8 Jan 2024 19:27:58 +0200 Subject: SL-20747 Fix pshell command failing in some cases --- autobuild.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'autobuild.xml') diff --git a/autobuild.xml b/autobuild.xml index 0e5a5a2a25..879657b748 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -2563,11 +2563,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - eb1316584188dafb591f80b46b357c737f90d1a7 + 8a04e6b3c6ff7f645219955a1389035565eb10d8 hash_algorithm sha1 url - https://github.com/secondlife/viewer-manager/releases/download/v3.0-08bf5ee/viewer_manager-3.0-08bf5ee-darwin64-08bf5ee.tar.zst + https://github.com/secondlife/viewer-manager/releases/download/v3.0-f14b5ec-D591/viewer_manager-3.0-f14b5ec-darwin64-f14b5ec.tar.zst name darwin64 @@ -2577,11 +2577,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - f4677b0ebd9880f29c118af51ada50883dd0a1e4 + a1e467c08ecbe6ab24fc8756a815a431a9b00f62 hash_algorithm sha1 url - https://github.com/secondlife/viewer-manager/releases/download/v3.0-08bf5ee/viewer_manager-3.0-08bf5ee-linux64-08bf5ee.tar.zst + https://github.com/secondlife/viewer-manager/releases/download/v3.0-f14b5ec-D591/viewer_manager-3.0-f14b5ec-linux64-f14b5ec.tar.zst name linux64 @@ -2591,11 +2591,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive hash - 7426c5a1d7eb231b476625637a1f2daba0a6bc55 + 56b613decdd36b2a17646bf3e2cfc2fed8456b8c hash_algorithm sha1 url - https://github.com/secondlife/viewer-manager/releases/download/v3.0-08bf5ee/viewer_manager-3.0-08bf5ee-windows64-08bf5ee.tar.zst + https://github.com/secondlife/viewer-manager/releases/download/v3.0-f14b5ec-D591/viewer_manager-3.0-f14b5ec-windows64-f14b5ec.tar.zst name windows64 @@ -2607,8 +2607,6 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors LICENSE copyright Copyright (c) 2000-2012, Linden Research, Inc. - version - 3.0-08bf5ee name viewer-manager description @@ -2617,6 +2615,8 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors https://bitbucket.org/lindenlab/vmp-standalone source_type hg + version + 3.0-f14b5ec vlc-bin -- cgit v1.3 From be35287184dde0f4a34ac05c5616b7d7d6f59ef7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 5 Mar 2024 20:42:24 +0200 Subject: SL-20429 Fix emoji categories having mixed translations Was caused by package substituting '&' with 'and' instead of '&' --- autobuild.xml | 14 +++++++++----- indra/newview/CMakeLists.txt | 2 ++ indra/newview/skins/default/xui/da/emoji_categories.xml | 10 +++++----- indra/newview/skins/default/xui/de/emoji_categories.xml | 10 +++++----- indra/newview/skins/default/xui/en/emoji_categories.xml | 14 +++++++++----- indra/newview/skins/default/xui/it/emoji_categories.xml | 6 +++--- indra/newview/skins/default/xui/pl/emoji_categories.xml | 8 ++++---- 7 files changed, 37 insertions(+), 27 deletions(-) (limited to 'autobuild.xml') diff --git a/autobuild.xml b/autobuild.xml index 8d4ab978fa..de503a7d34 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -474,9 +474,11 @@ archive hash - 7ac35da9b1b5c9a05954edeef3fe8e54 + 52c41a4547d2d9aceb4a9a1e9e1680c71e5ffa79 + hash_algorithm + sha1 url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113242/980233/emoji_shortcodes-6.1.0.579438-darwin64-579438.tar.bz2 + https://github.com/secondlife/3p-emoji-shortcodes/releases/download/v6.1.0.5413f58/emoji_shortcodes-6.1.0.5413f58-darwin64-5413f58.tar.zst name darwin64 @@ -486,16 +488,18 @@ archive hash - 087ce7e6d93dcd88b477b10d8e1ab259 + 3137e06d376767a631bc9626832d558c4d5e5aa9 + hash_algorithm + sha1 url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113243/980244/emoji_shortcodes-6.1.0.579438-windows64-579438.tar.bz2 + https://github.com/secondlife/3p-emoji-shortcodes/releases/download/v6.1.0.5413f58/emoji_shortcodes-6.1.0.5413f58-windows64-5413f58.tar.zst name windows64 version - 6.1.0.579438 + 6.1.0.5413f58 expat diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 355f35c558..5e6b8c1b87 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1617,6 +1617,8 @@ set(viewer_APPSETTINGS_FILES app_settings/anim.ini app_settings/cmd_line.xml app_settings/commands.xml + app_settings/emoji_groups.xml + app_settings/foldertypes.xml app_settings/grass.xml app_settings/ignorable_dialogs.xml app_settings/key_bindings.xml diff --git a/indra/newview/skins/default/xui/da/emoji_categories.xml b/indra/newview/skins/default/xui/da/emoji_categories.xml index 456b18e4e2..f2a7f7a3aa 100644 --- a/indra/newview/skins/default/xui/da/emoji_categories.xml +++ b/indra/newview/skins/default/xui/da/emoji_categories.xml @@ -5,13 +5,13 @@ Name smileys and emotion Category - smileys and følelser + smileys & følelser Name people and body Category - mennesker and krop + mennesker & krop Name @@ -23,19 +23,19 @@ Name animals and nature Category - dyr and natur + dyr & natur Name food and drink Category - mad and drikke + mad & drikke Name travel and places Category - rejser and steder + rejser & steder Name diff --git a/indra/newview/skins/default/xui/de/emoji_categories.xml b/indra/newview/skins/default/xui/de/emoji_categories.xml index ed63d0bac9..ff9e4aec63 100644 --- a/indra/newview/skins/default/xui/de/emoji_categories.xml +++ b/indra/newview/skins/default/xui/de/emoji_categories.xml @@ -5,13 +5,13 @@ Name smileys and emotion Category - Smileys and Emotionen + Smileys & Emotionen Name people and body Category - Menschen and Körper + Menschen & Körper Name @@ -23,19 +23,19 @@ Name animals and nature Category - Tiere and Natur + Tiere & Natur Name food and drink Category - Essen and Trinken + Essen & Trinken Name travel and places Category - Reisen and Orte + Reisen & Orte Name diff --git a/indra/newview/skins/default/xui/en/emoji_categories.xml b/indra/newview/skins/default/xui/en/emoji_categories.xml index 0315d0c43a..5e7700da33 100644 --- a/indra/newview/skins/default/xui/en/emoji_categories.xml +++ b/indra/newview/skins/default/xui/en/emoji_categories.xml @@ -1,17 +1,21 @@ + Name smileys and emotion Category - smileys and emotion + smileys & emotion Name people and body Category - people and body + people & body Name @@ -23,19 +27,19 @@ Name animals and nature Category - animals and nature + animals & nature Name food and drink Category - food and drink + food & drink Name travel and places Category - travel and places + travel & places Name diff --git a/indra/newview/skins/default/xui/it/emoji_categories.xml b/indra/newview/skins/default/xui/it/emoji_categories.xml index a4782e60a6..b447a5b78b 100644 --- a/indra/newview/skins/default/xui/it/emoji_categories.xml +++ b/indra/newview/skins/default/xui/it/emoji_categories.xml @@ -5,7 +5,7 @@ Name smileys and emotion Category - smileys and emozione + smileys & emozione Name @@ -23,7 +23,7 @@ Name animals and nature Category - animali and natura + animali & natura Name @@ -35,7 +35,7 @@ Name travel and places Category - viaggi and luoghi + viaggi & luoghi Name diff --git a/indra/newview/skins/default/xui/pl/emoji_categories.xml b/indra/newview/skins/default/xui/pl/emoji_categories.xml index 9aad7af794..42f8e2eb4a 100644 --- a/indra/newview/skins/default/xui/pl/emoji_categories.xml +++ b/indra/newview/skins/default/xui/pl/emoji_categories.xml @@ -5,13 +5,13 @@ Name smileys and emotion Category - buźki and emocje + buźki & emocje Name people and body Category - ludzie and ciało + ludzie & ciało Name @@ -23,7 +23,7 @@ Name animals and nature Category - zwierzęta and przyroda + zwierzęta & przyroda Name @@ -35,7 +35,7 @@ Name travel and places Category - podróże and miejsca + podróże & miejsca Name -- cgit v1.3 From 2f452d06e6964b0edf26b0b3f6eaa156e3fa2d48 Mon Sep 17 00:00:00 2001 From: Henri Beauchamp Date: Wed, 13 Mar 2024 13:57:39 +0100 Subject: Proposal #2 to restore how UI/dialogs used to render by prioritizing fallback fonts. With the emojis support, a new font was added, which not only provides emojis but also fancy colorful replacements for UTF-8 characters that used to be supported by our fallback (monochrome) fonts: this causes discrepancies and unwanted/undesired changes in scripted objects menus (e.g. an empty circle or square may render as a black, full one, a heart may render red instead of white), not to mention the larger font size used by the emoji characters... This patch restores the aspect of such menus/dialogs/UI elements with UTF-8 characters that *are* supported by the usual fallback fonts (fonts which may also vary from one viewer to another, and from one OS to another), so that everything keeps working/rendering as it always did so far, while not impairing the use of new colorful emojis. This second proposal ensures that: - "genuine" emojis (in the 0x1f000-0x1ffff range), will *always* be rendered using the new emojis font (this solves, for example, the monochrome "yellow faces" issue seen with some characters in my first proposal). - Special UTF-8 characters (in the 0x2000-0x32FF range) which have been used by scripters so far, will render as they used to, using the monochrome fallback fonts (this repairs scripted dialogs menus). - Remaining special characters, that do not have a corresponding glyph in the monochrome font, but do have one in the emojis font, will use the latter font to render. It also got the nice side-effect of removing the dependency on the ICU4C library. Note however that the recent commit: https://github.com/secondlife/viewer/commit/326055ba82c22fedde186c6a56bafd4fe87e613a will need to be reverted to allow this patch to actually fix scripted dialogs. Also, some cleanup might be needed in skins/default/xui/*/emoji_characters.xml to remove from it the special UTF-8 characters that will no longer be rendered with fanciful colors, but instead with the monochrome font glyphs. --- autobuild.xml | 48 ------------ indra/cmake/CMakeLists.txt | 1 - indra/cmake/Copy3rdPartyLibs.cmake | 9 --- indra/cmake/ICU4C.cmake | 23 ------ indra/llcommon/CMakeLists.txt | 2 - indra/llcommon/llstring.cpp | 41 +++------- indra/llcommon/llstring.h | 3 +- indra/llrender/llfontfreetype.cpp | 150 ++++++++++++++++++++++++------------- indra/newview/CMakeLists.txt | 2 - indra/newview/viewer_manifest.py | 4 - 10 files changed, 108 insertions(+), 175 deletions(-) delete mode 100644 indra/cmake/ICU4C.cmake (limited to 'autobuild.xml') diff --git a/autobuild.xml b/autobuild.xml index de503a7d34..e2f78a3358 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -959,54 +959,6 @@ description Havok source code for libs and demos - icu4c - - canonical_repo - https://bitbucket.org/lindenlab/3p-icu4c - copyright - Copyright (c) 1995-2011 International Business Machines Corporation and others <http://source.icu-project.org> - description - ICU is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications. ICU is widely portable and gives applications the same results on all platforms and between C/C++ and Java software. - license - ICU, permissive non-copyleft free software license - license_file - LICENSES/icu.txt - name - icu4c - platforms - - darwin64 - - archive - - hash - 47bc32b991385f1a6530e4c6179b07f64ca6edc7 - hash_algorithm - sha1 - url - https://github.com/secondlife/3p-icu4c/releases/download/v4.8.1-7d08d82/icu4c-4.8.1-darwin64-7d08d82.tar.zst - - name - darwin64 - - windows64 - - archive - - hash - b7db881dac80302e4d9010af34c0bf6ca9897df9 - hash_algorithm - sha1 - url - https://github.com/secondlife/3p-icu4c/releases/download/v4.8.1-7d08d82/icu4c-4.8.1-windows64-7d08d82.tar.zst - - name - windows64 - - - version - 4.8.1-7d08d82 - jpegencoderbasic platforms diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 05c51c018d..cb3b77300a 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -30,7 +30,6 @@ set(cmake_SOURCE_FILES GoogleMock.cmake Havok.cmake Hunspell.cmake - ICU4C.cmake JsonCpp.cmake LLAddBuildTest.cmake LLAppearance.cmake diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 9f79c13a97..7938d4f54b 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -62,15 +62,6 @@ if(WINDOWS) uriparser.dll ) - # ICU4C (same filenames for 32 and 64 bit builds) - set(release_files ${release_files} icudt48.dll) - set(release_files ${release_files} icuin48.dll) - set(release_files ${release_files} icuio48.dll) - set(release_files ${release_files} icule48.dll) - set(release_files ${release_files} iculx48.dll) - set(release_files ${release_files} icutu48.dll) - set(release_files ${release_files} icuuc48.dll) - # OpenSSL if(ADDRESS_SIZE EQUAL 64) set(release_files ${release_files} libcrypto-1_1-x64.dll) diff --git a/indra/cmake/ICU4C.cmake b/indra/cmake/ICU4C.cmake deleted file mode 100644 index 7b27665483..0000000000 --- a/indra/cmake/ICU4C.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -include_guard() - -add_library( ll::icu4c INTERFACE IMPORTED ) - - -use_system_binary(icu4c) -use_prebuilt_binary(icu4c) -if (WINDOWS) - target_link_libraries( ll::icu4c INTERFACE icuuc) -elseif(DARWIN) - target_link_libraries( ll::icu4c INTERFACE icuuc) -#elseif(LINUX) -## target_link_libraries( ll::icu4c INTERFACE ) -else() - message(FATAL_ERROR "Invalid platform") -endif() - -target_include_directories( ll::icu4c SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/unicode ) - -use_prebuilt_binary(dictionaries) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index c947184dc8..5f4ed2fffa 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -3,7 +3,6 @@ project(llcommon) include(00-Common) -include(ICU4C) include(LLCommon) include(bugsplat) include(Linking) @@ -283,7 +282,6 @@ target_link_libraries( ll::uriparser ll::oslibraries ll::tracy - ll::icu4c ) target_include_directories(llcommon INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 4aa54bb12d..28c2ec5b39 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -30,7 +30,6 @@ #include "llerror.h" #include "llfasttimer.h" #include "llsd.h" -#include #include #if LL_WINDOWS @@ -1008,40 +1007,18 @@ std::string LLStringOps::sAM; std::string LLStringOps::sPM; // static -bool LLStringOps::isEmoji(llwchar wch) -{ - int ublock = ublock_getCode(wch); - switch (ublock) - { - case UBLOCK_GENERAL_PUNCTUATION: - case UBLOCK_LETTERLIKE_SYMBOLS: - case UBLOCK_ARROWS: - case UBLOCK_MISCELLANEOUS_TECHNICAL: - case UBLOCK_ENCLOSED_ALPHANUMERICS: - case UBLOCK_GEOMETRIC_SHAPES: - case UBLOCK_MISCELLANEOUS_SYMBOLS: - case UBLOCK_DINGBATS: - case UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION: - case UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS: - case UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS: - case UBLOCK_EMOTICONS: - case UBLOCK_TRANSPORT_AND_MAP_SYMBOLS: -#if U_ICU_VERSION_MAJOR_NUM > 56 - // Boost uses ICU so we can't update it independently - case UBLOCK_SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS: -#endif // U_ICU_VERSION_MAJOR_NUM > 56 - return true; - default: -#if U_ICU_VERSION_MAJOR_NUM > 56 - return false; +bool LLStringOps::isEmoji(llwchar a) +{ +#if 0 // Do not consider special characters that might have a corresponding + // glyph in the monochorme fallback fonts as a "genuine" emoji. HB + return a == 0xa9 || a == 0xae || (a >= 0x2000 && a < 0x3300) || + (a >= 0x1f000 && a < 0x20000); #else - // See https://en.wikipedia.org/wiki/Supplemental_Symbols_and_Pictographs - return wch >= 0x1F900 && wch <= 0x1F9FF; -#endif // U_ICU_VERSION_MAJOR_NUM > 56 - } + // These are indeed "genuine" emojis, we *do want* rendered as such. HB + return a >= 0x1f000 && a < 0x20000; +#endif } - S32 LLStringOps::collate(const llwchar* a, const llwchar* b) { #if LL_WINDOWS diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index a40359115e..a8d910298c 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -189,7 +189,8 @@ public: static bool isAlnum(char a) { return isalnum((unsigned char)a) != 0; } static bool isAlnum(llwchar a) { return iswalnum(a) != 0; } - static bool isEmoji(llwchar wch); + // Returns true when 'a' corresponds to a "genuine" emoji. HB + static bool isEmoji(llwchar a); static S32 collate(const char* a, const char* b) { return strcoll(a, b); } static S32 collate(const llwchar* a, const llwchar* b); diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index d87fb5245c..f987c599ad 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -354,11 +354,10 @@ void LLFontFreetype::clearFontStreams() } #endif -void LLFontFreetype::addFallbackFont(const LLPointer& fallback_font, const char_functor_t& functor) +void LLFontFreetype::addFallbackFont(const LLPointer& fallback_font, + const char_functor_t& functor) { - // Insert functor fallbacks before generic fallbacks - mFallbackFonts.insert((functor) ? std::find_if(mFallbackFonts.begin(), mFallbackFonts.end(), [](const fallback_font_t& fe) { return !fe.second; }) : mFallbackFonts.end(), - std::make_pair(fallback_font, functor)); + mFallbackFonts.emplace_back(fallback_font, functor); } F32 LLFontFreetype::getLineHeight() const @@ -450,55 +449,100 @@ BOOL LLFontFreetype::hasGlyph(llwchar wch) const LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch, EFontGlyphType glyph_type) const { - if (mFTFace == NULL) - return FALSE; - - llassert(!mIsFallback); - llassert(glyph_type < EFontGlyphType::Count); - //LL_DEBUGS() << "Adding new glyph for " << wch << " to font" << LL_ENDL; - - FT_UInt glyph_index; - - // Fallback fonts with a functor have precedence over everything else - fallback_font_vector_t::const_iterator it_fallback = mFallbackFonts.cbegin(); - /* This leads to a bug SL-19831 "Check marks in the menu are less visible." - ** Also, LLFontRegistry::createFont() says: "Fallback fonts don't render" - for (; it_fallback != mFallbackFonts.cend() && it_fallback->second; ++it_fallback) - { - if (it_fallback->second(wch)) - { - glyph_index = FT_Get_Char_Index(it_fallback->first->mFTFace, wch); - if (glyph_index) - { - return addGlyphFromFont(it_fallback->first, wch, glyph_index, glyph_type); - } - } - } - */ - - // Initialize char to glyph map - glyph_index = FT_Get_Char_Index(mFTFace, wch); - if (glyph_index == 0) - { - //LL_INFOS() << "Trying to add glyph from fallback font!" << LL_ENDL; - for (; it_fallback != mFallbackFonts.cend(); ++it_fallback) - { - glyph_index = FT_Get_Char_Index(it_fallback->first->mFTFace, wch); - if (glyph_index) - { - return addGlyphFromFont(it_fallback->first, wch, glyph_index, glyph_type); - } - } - } - - std::pair range_it = mCharGlyphInfoMap.equal_range(wch); - char_glyph_info_map_t::iterator iter = - std::find_if(range_it.first, range_it.second, [&glyph_type](const char_glyph_info_map_t::value_type& entry) { return entry.second->mGlyphType == glyph_type; }); - if (iter == range_it.second) - { - return addGlyphFromFont(this, wch, glyph_index, glyph_type); - } - return NULL; + if (!mFTFace) + { + return NULL; + } + + llassert(!mIsFallback); + llassert(glyph_type < EFontGlyphType::Count); + //LL_DEBUGS() << "Adding new glyph for " << wch << " to font" << LL_ENDL; + + // Initialize char to glyph map + FT_UInt glyph_index = FT_Get_Char_Index(mFTFace, wch); + if (glyph_index == 0) + { + // No corresponding glyph in this font: look for a glyph in fallback + // fonts. + size_t count = mFallbackFonts.size(); + if (LLStringOps::isEmoji(wch)) + { + // This is a "genuine" emoji (in the range 0x1f000-0x20000): print + // it using the emoji font(s) if possible. HB + for (size_t i = 0; i < count; ++i) + { + const fallback_font_t& pair = mFallbackFonts[i]; + if (!pair.second || !pair.second(wch)) + { + // If this font does not have a functor, or the character + // does not pass the functor, reject it. Note: we keep the + // functor test (despite the fact we already tested for + // LLStringOps::isEmoji(wch) above), in case we would use + // different, more restrictive or partionned functors in + // the future with several different emoji fonts. HB + continue; + } + glyph_index = FT_Get_Char_Index(pair.first->mFTFace, wch); + if (glyph_index) + { + return addGlyphFromFont(pair.first, wch, glyph_index, + glyph_type); + } + } + } + // Then try and find a monochrome fallback font that could print this + // glyph: such fonts do *not* have a functor. We give priority to + // monochrome fonts for non-genuine emojis so that UI elements which + // used to render with them before the emojis font introduction (e.g. + // check marks in menus, or LSL dialogs text and buttons) do render the + // same way as they always did. HB + std::vector emoji_fonts_idx; + for (size_t i = 0; i < count; ++i) + { + const fallback_font_t& pair = mFallbackFonts[i]; + if (pair.second) + { + // If this font got a functor, remember the index for later and + // try the next fallback font. HB + emoji_fonts_idx.push_back(i); + continue; + } + glyph_index = FT_Get_Char_Index(pair.first->mFTFace, wch); + if (glyph_index) + { + return addGlyphFromFont(pair.first, wch, glyph_index, + glyph_type); + } + } + // Everything failed so far: this character is not a genuine emoji, + // neither a special character known from our monochrome fallback + // fonts: make a last try, using the emoji font(s), but ignoring the + // functor to render using whatever (colorful) glyph that might be + // available in such fonts for this character. HB + for (size_t j = 0, count2 = emoji_fonts_idx.size(); j < count2; ++j) + { + const fallback_font_t& pair = mFallbackFonts[emoji_fonts_idx[j]]; + glyph_index = FT_Get_Char_Index(pair.first->mFTFace, wch); + if (glyph_index) + { + return addGlyphFromFont(pair.first, wch, glyph_index, + glyph_type); + } + } + } + + auto range_it = mCharGlyphInfoMap.equal_range(wch); + char_glyph_info_map_t::iterator iter = + std::find_if(range_it.first, range_it.second, + [&glyph_type](const char_glyph_info_map_t::value_type& entry) + { + return entry.second->mGlyphType == glyph_type; + }); + if (iter == range_it.second) + { + return addGlyphFromFont(this, wch, glyph_index, glyph_type); + } + return NULL; } LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, llwchar wch, U32 glyph_index, EFontGlyphType requested_glyph_type) const diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5e6b8c1b87..c01cd2c34f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -18,7 +18,6 @@ include(DragDrop) include(EXPAT) include(FMODSTUDIO) include(Hunspell) -include(ICU4C) include(JPEGEncoderBasic) include(JsonCpp) include(LLAppearance) @@ -1934,7 +1933,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLPHYSICSEXTENSIONS_LIBRARIES} ll::bugsplat ll::tracy - ll::icu4c ) if( TARGET ll::intel_memops ) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index c7f32d0da9..3efd88964d 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -559,10 +559,6 @@ class Windows_x86_64_Manifest(ViewerManifest): self.path("OpenAL32.dll") self.path("alut.dll") - # For ICU4C - self.path("icudt48.dll") - self.path("icuuc48.dll") - # For textures self.path("openjp2.dll") -- cgit v1.3 From ae796157943294c4ef566dfd7d26b89802ff4571 Mon Sep 17 00:00:00 2001 From: nerodevo <100370411+nerodevo@users.noreply.github.com> Date: Sat, 13 Apr 2024 06:31:38 -0500 Subject: Revert "DRTVWR-601: Drop 32-bit Windows build of llphysicsextension_stub." This reverts commit d07cd115e3bdef8a2b1d2f6a5a507ddb67ff8cd9. --- autobuild.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'autobuild.xml') diff --git a/autobuild.xml b/autobuild.xml index 6209de2994..d4a0a720c9 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1652,6 +1652,18 @@ name linux64 + windows + + archive + + hash + 2e5f1f7046a49d8b0bc295aa878116bc + url + http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/60043/564063/llphysicsextensions_stub-1.0.542456-windows-542456.tar.bz2 + + name + windows + license internal -- cgit v1.3 From b04b4de46510992d6b0b88a529dffec0d235a75a Mon Sep 17 00:00:00 2001 From: nerodevo <100370411+nerodevo@users.noreply.github.com> Date: Tue, 16 Apr 2024 10:52:24 -0500 Subject: Change windows to windows64 --- autobuild.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'autobuild.xml') diff --git a/autobuild.xml b/autobuild.xml index d4a0a720c9..66fce65da8 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1652,7 +1652,7 @@ name linux64 - windows + windows64 archive -- cgit v1.3 From d06e0004353576f71fdc4265d68885a2e17b3852 Mon Sep 17 00:00:00 2001 From: nerodevo <100370411+nerodevo@users.noreply.github.com> Date: Tue, 16 Apr 2024 11:08:23 -0500 Subject: Change windows to windows64 again Missed the second change... Here it is. --- autobuild.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'autobuild.xml') diff --git a/autobuild.xml b/autobuild.xml index 66fce65da8..f0961b0557 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1662,7 +1662,7 @@ http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/60043/564063/llphysicsextensions_stub-1.0.542456-windows-542456.tar.bz2 name - windows + windows64 license -- cgit v1.3 From 9bf2dfbb39032d7407295089cf181de0987083e5 Mon Sep 17 00:00:00 2001 From: Bennett Goble Date: Sun, 28 Apr 2024 09:59:21 -0700 Subject: Use s3 hosted slvoice autobuild dependencies Pull SLVoice from s3 so that the OSS build configurations work. --- autobuild.xml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'autobuild.xml') diff --git a/autobuild.xml b/autobuild.xml index 5920e4d9e5..a876af5f0b 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -2368,14 +2368,12 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive - creds - github hash - cc7c5bf53f83cff81d874ad66394df0991bd432c + 1e70b06fe6eb9796097010871b32d8e95167e373 hash_algorithm sha1 url - https://api.github.com/repos/secondlife/3p-slvoice/releases/assets/108299352 + https://automated-builds-secondlife-com.s3.amazonaws.com/gh/secondlife/3p-slvoice/slvoice-4.10.0000.32327.5fc3fe7c.5942f08-darwin64-5942f08.tar.zst name darwin64 @@ -2396,14 +2394,12 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors archive - creds - github hash - 0c205371bb1731a9812b00556037729fdc057cbc + ddfb7c30d9756915e8b26f44e2ee3a69ee87fb9a hash_algorithm sha1 url - https://api.github.com/repos/secondlife/3p-slvoice/releases/assets/108299356 + https://automated-builds-secondlife-com.s3.amazonaws.com/gh/secondlife/3p-slvoice/slvoice-4.10.0000.32327.5fc3fe7c.5942f08-windows64-5942f08.tar.zst name windows64 -- cgit v1.3