Add OpenSim protocols support to Velopack

This commit is contained in:
Hecklezz
2026-04-10 02:40:08 +10:00
parent 82f2968e82
commit 148e9c3ec2
+32
View File
@@ -276,6 +276,10 @@ static bool custom_download_asset(void* user_data,
static const wchar_t* PROTOCOL_SECONDLIFE = L"secondlife";
static const wchar_t* PROTOCOL_GRID_INFO = L"x-grid-location-info";
// <FS:TJ> Support for Opensim protocols
static const wchar_t* PROTOCOL_HOP_OPENSIM = L"hop";
static const wchar_t* PROTOCOL_GRID_INFO_OPENSIM = L"x-grid-info";
// </FS:TJ>
static std::wstring get_viewer_exe_name()
{
return ll_convert<std::wstring>(gDirUtilp->getExecutableFilename());
@@ -403,6 +407,22 @@ static void register_protocol_handler(const std::wstring& protocol,
(BYTE*)cmd_value.c_str(), (DWORD)((cmd_value.size() + 1) * sizeof(wchar_t)));
RegCloseKey(hkey);
}
// <FS:TJ> [FIRE-30446] Set FriendlyAppName for protocols
std::wstring friendlyappname_key_path = key_path + L"\\shell\\open";
if (RegCreateKeyExW(HKEY_CURRENT_USER, friendlyappname_key_path.c_str(), 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL) == ERROR_SUCCESS)
{
#ifdef OPENSIM
std::wstring friendlyappname_value = get_app_name_oneword() + L" for OpenSimulator";
#else
std::wstring friendlyappname_value = get_app_name_oneword();
#endif
RegSetValueExW(hkey, L"FriendlyAppName", 0, REG_SZ,
(BYTE*)friendlyappname_value.c_str(), (DWORD)((friendlyappname_value.size() + 1) * sizeof(wchar_t)));
RegCloseKey(hkey);
}
// </FS:TJ>
}
void clear_nsis_links()
@@ -656,7 +676,15 @@ static void on_after_install(void* user_data, const char* app_version)
std::wstring exe_path = install_dir + L"\\" + get_viewer_exe_name();
register_protocol_handler(PROTOCOL_SECONDLIFE, L"URL:Second Life", exe_path);
// <FS:TJ> Support for OpenSim protocols
#ifndef OPENSIM
register_protocol_handler(PROTOCOL_GRID_INFO, L"URL:Second Life", exe_path);
#else
register_protocol_handler(PROTOCOL_GRID_INFO, L"URL:Hypergrid", exe_path);
#endif
register_protocol_handler(PROTOCOL_HOP_OPENSIM, L"URL:Hypergrid", exe_path);
register_protocol_handler(PROTOCOL_GRID_INFO_OPENSIM, L"URL:Hypergrid", exe_path);
// </FS:TJ>
create_shortcuts(install_dir, app_name);
}
@@ -666,6 +694,10 @@ static void on_before_uninstall(void* user_data, const char* app_version)
unregister_protocol_handler(PROTOCOL_SECONDLIFE);
unregister_protocol_handler(PROTOCOL_GRID_INFO);
// <FS:TJ> Support for OpenSim protocols
unregister_protocol_handler(PROTOCOL_HOP_OPENSIM);
unregister_protocol_handler(PROTOCOL_GRID_INFO_OPENSIM);
// </FS:TJ>
unregister_uninstall_info();
remove_shortcuts(app_name);
}