Remove GotoURL

"Report" button has not been removed from CrashHandlerChild / Crash.mm / DialogDriver_Win32, but functionality has been removed.
This commit is contained in:
sukibaby
2025-01-25 23:53:44 -08:00
committed by teejusb
parent 6947276894
commit cc5670e8d1
17 changed files with 4 additions and 270 deletions
-2
View File
@@ -51,7 +51,6 @@ else()
"archutils/Win32/DirectXHelpers.cpp"
"archutils/Win32/ErrorStrings.cpp"
"archutils/Win32/GetFileInformation.cpp"
"archutils/Win32/GotoURL.cpp"
"archutils/Win32/GraphicsWindow.cpp"
"archutils/Win32/MessageWindow.cpp"
"archutils/Win32/RegistryAccess.cpp"
@@ -76,7 +75,6 @@ else()
"archutils/Win32/DirectXHelpers.h"
"archutils/Win32/ErrorStrings.h"
"archutils/Win32/GetFileInformation.h"
"archutils/Win32/GotoURL.h"
"archutils/Win32/GraphicsWindow.h"
"archutils/Win32/MessageWindow.h"
"archutils/Win32/RegistryAccess.h"
-10
View File
@@ -832,16 +832,6 @@ void GameCommand::ApplySelf( const std::vector<PlayerNumber> &vpns ) const
if( !m_sProfileID.empty() )
for (PlayerNumber const &pn : vpns)
ProfileManager::m_sDefaultLocalProfileID[pn].Set( m_sProfileID );
if( !m_sUrl.empty() )
{
if( HOOKS->GoToURL( m_sUrl ) )
{
if( m_bUrlExits )
SCREENMAN->SetNewScreen( "ScreenExit" );
}
else
ScreenPrompt::Prompt( SM_None, COULD_NOT_LAUNCH_BROWSER );
}
/* If we're going to stop music, do so before preparing new screens, so we
* don't stop music between preparing screens and loading screens. */
-8
View File
@@ -157,14 +157,6 @@ void ScreenInstallOverlay::Init()
bool ScreenInstallOverlay::Input( const InputEventPlus &input )
{
/*
if( input.DeviceI.button == g_buttonLogin && input.type == IET_FIRST_PRESS )
{
HOOKS->GoToURL("http://www.stepmania.com/launch.php");
return true;
}
*/
return Screen::Input(input);
}
-5
View File
@@ -51,11 +51,6 @@ bool ArchHooks::AppFocusChanged()
return bFocusChanged;
}
bool ArchHooks::GoToURL( RString sUrl )
{
return false;
}
ArchHooks *ArchHooks::Create()
{
return new ARCH_HOOKS;
-5
View File
@@ -114,11 +114,6 @@ public:
*/
bool AppFocusChanged();
/*
* Open a URL in the default web browser
*/
virtual bool GoToURL( RString sUrl );
virtual float GetDisplayAspectRatio() = 0;
/** @brief Fetch the contents of the system clipboard. */
-1
View File
@@ -10,7 +10,6 @@ public:
RString GetArchName() const;
void DumpDebugInfo();
RString GetPreferredLanguage();
bool GoToURL( RString sUrl );
float GetDisplayAspectRatio();
};
-10
View File
@@ -248,16 +248,6 @@ RString ArchHooks::GetPreferredLanguage()
return ret;
}
bool ArchHooks_MacOSX::GoToURL( RString sUrl )
{
CFURLRef url = CFURLCreateWithBytes( kCFAllocatorDefault, (const UInt8*)sUrl.data(),
sUrl.length(), kCFStringEncodingUTF8, nil);
OSStatus result = LSOpenCFURLRef( url, nil);
CFRelease( url );
return result == 0;
}
int64_t ArchHooks::GetSystemTimeInMicroseconds()
{
// http://developer.apple.com/qa/qa2004/qa1398.html
-25
View File
@@ -226,31 +226,6 @@ void ArchHooks_Unix::Init()
#endif
}
bool ArchHooks_Unix::GoToURL( RString sUrl )
{
int status;
pid_t p = fork();
if ( p == -1 )
{
// Call to fork failed
return false;
}
else if ( p == 0 )
{
// Child
const char * const argv[] = { "xdg-open", sUrl.c_str(), nullptr };
execv( "/usr/bin/xdg-open", const_cast<char * const *>( argv ));
// If we reach here, the call to execvp failed
exit( 1 );
}
else
{
// Parent
waitpid( p, &status, 0 );
return WEXITSTATUS( status ) == 0;
}
}
#ifndef _CS_GNU_LIBC_VERSION
#define _CS_GNU_LIBC_VERSION 2
#endif
-2
View File
@@ -18,8 +18,6 @@ public:
void MountInitialFilesystems( const RString &sDirOfExecutable );
float GetDisplayAspectRatio() { return 4.0f/3; }
bool GoToURL( RString sUrl );
static clockid_t GetClock();
RString GetClipboard();
-6
View File
@@ -9,7 +9,6 @@
#include "archutils/win32/DebugInfoHunt.h"
#include "archutils/win32/ErrorStrings.h"
#include "archutils/win32/RestartProgram.h"
#include "archutils/win32/GotoURL.h"
#include "archutils/Win32/RegistryAccess.h"
#include "VersionHelpers.h"
@@ -171,11 +170,6 @@ void ArchHooks_Win32::SetupConcurrentRenderingThread()
SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL );
}
bool ArchHooks_Win32::GoToURL( RString sUrl )
{
return ::GotoURL( sUrl );
}
float ArchHooks_Win32::GetDisplayAspectRatio()
{
DEVMODE dm;
-1
View File
@@ -20,7 +20,6 @@ public:
void UnBoostPriority();
void SetupConcurrentRenderingThread();
bool GoToURL( RString sUrl );
virtual float GetDisplayAspectRatio();
RString GetClipboard();
};
+1 -2
View File
@@ -9,7 +9,6 @@
#include "archutils/win32/AppInstance.h"
#include "archutils/win32/ErrorStrings.h"
#include "archutils/win32/GotoURL.h"
#include "archutils/win32/RestartProgram.h"
#include "archutils/Win32/SpecialDirs.h"
#if !defined(SMPACKAGE)
@@ -179,7 +178,7 @@ static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
}
break;
case IDC_BUTTON_REPORT:
GotoURL( REPORT_BUG_URL );
// safe to remove this button?
break;
case IDC_BUTTON_RESTART:
Win32RestartProgram();
+1 -3
View File
@@ -54,11 +54,9 @@ void CrashHandler::InformUserOfCrash( const RString& sPath )
switch( response )
{
case kCFUserNotificationDefaultResponse:
HOOKS->GoToURL( REPORT_BUG_URL );
// Fall through.
case kCFUserNotificationOtherResponse:
// Open the file with the default application (probably TextEdit).
HOOKS->GoToURL( "file://" + sPath );
// Open the file with the default application (probably TextEdit). [unimplemented]
break;
}
CFRelease( sBody );
+2 -28
View File
@@ -6,7 +6,6 @@
#include "archutils/Win32/WindowsResources.h"
#include "archutils/Win32/DialogUtil.h"
#include "archutils/Win32/ErrorStrings.h"
#include "archutils/Win32/GotoURL.h"
#include "archutils/Win32/RestartProgram.h"
#include "archutils/Win32/CrashHandlerNetworking.h"
#include "archutils/Win32/WindowsDialogBox.h"
@@ -766,35 +765,10 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
EndDialog( hDlg, FALSE );
break;
case IDC_BUTTON_REPORT:
GotoURL( REPORT_BUG_URL );
// safe to remove button?
break;
case IDC_BUTTON_AUTO_REPORT:
if( !m_sUpdateURL.empty() )
{
/* We already sent the report, were told that there's an update,
* and substituted the URL. */
GotoURL( m_sUpdateURL );
break;
}
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), false );
ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), true );
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), REPORTING_THE_PROBLEM.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CANCEL.GetValue() );
SendDlgItemMessage( hDlg, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0,100) );
SendDlgItemMessage( hDlg, IDC_PROGRESS, PBM_SETPOS, 0, 0 );
// Create the form data to send.
m_pPost = new NetworkPostData;
m_pPost->SetData( "Product", PRODUCT_ID );
m_pPost->SetData( "Version", product_version );
m_pPost->SetData( "Arch", HOOKS->GetArchName().c_str() );
m_pPost->SetData( "Report", m_sCrashReport );
m_pPost->SetData( "Reason", m_CrashData.m_CrashInfo.m_CrashReason );
m_pPost->Start( CRASH_REPORT_HOST, CRASH_REPORT_PORT, CRASH_REPORT_PATH );
SetTimer( hDlg, 0, 100, nullptr );
// same here
break;
}
break;
-127
View File
@@ -1,127 +0,0 @@
#include "global.h"
#include "GotoURL.h"
#include <cstdint>
#include <windows.h>
#include <shellapi.h>
#include <string>
#include <codecvt>
#include <locale>
#include <vector>
static std::wstring ConvertToWString(const std::string& str)
{
int size_needed = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int)str.size(), nullptr, 0);
std::wstring wstrTo(size_needed, 0);
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int)str.size(), &wstrTo[0], size_needed);
return wstrTo;
}
static LONG GetRegKey(HKEY key, const std::wstring& subkey, std::wstring& retdata)
{
HKEY hKey;
LONG iRet = RegOpenKeyExW(key, subkey.c_str(), 0, KEY_QUERY_VALUE, &hKey);
if (iRet != ERROR_SUCCESS)
{
return iRet;
}
DWORD iDataSize = 0;
iRet = RegQueryValueExW(hKey, L"emulation", nullptr, nullptr, nullptr, &iDataSize);
if (iRet != ERROR_SUCCESS)
{
RegCloseKey(hKey);
return iRet;
}
std::vector<wchar_t> data(iDataSize / sizeof(wchar_t));
iRet = RegQueryValueExW(hKey, L"emulation", nullptr, nullptr, reinterpret_cast<LPBYTE>(data.data()), &iDataSize);
if (iRet == ERROR_SUCCESS)
{
retdata.assign(data.begin(), data.end() - 1);
}
RegCloseKey(hKey);
return iRet;
}
bool GotoURL(const RString& sUrl)
{
// Convert RString to std::wstring
std::wstring iUrl = ConvertToWString(sUrl);
// First try ShellExecuteEx
SHELLEXECUTEINFOW sei = { sizeof(sei) };
sei.lpVerb = L"open";
sei.lpFile = iUrl.c_str();
sei.nShow = SW_SHOWDEFAULT;
sei.fMask = SEE_MASK_FLAG_NO_UI;
if (ShellExecuteExW(&sei) && reinterpret_cast<intptr_t>(sei.hInstApp) > 32)
return true;
// If it failed, get the .htm regkey and lookup the program
std::wstring key;
if (GetRegKey(HKEY_CLASSES_ROOT, L".htm", key) != ERROR_SUCCESS)
return false;
key += L"\\shell\\open\\command";
if( GetRegKey(HKEY_CLASSES_ROOT, key, key) != ERROR_SUCCESS )
return false;
size_t pos = key.find(L"\"%1\"");
if (pos == std::wstring::npos)
{
// No quotes found. Check for %1 without quotes
pos = key.find(L"%1");
if (pos == std::wstring::npos)
pos = key.length() - 1; // No parameter.
else
key.erase(pos); // Remove the parameter
}
else
{
key.erase(pos); // Remove the parameter
}
key += L" " + iUrl;
STARTUPINFOW si = { sizeof(si) };
PROCESS_INFORMATION pi;
if (CreateProcessW(nullptr, &key[0], nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi))
{
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return true;
}
return false;
}
/*
* (c) 2002-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-32
View File
@@ -1,32 +0,0 @@
#ifndef GOTO_URL_H
#define GOTO_URL_H
/** @brief Open URLs in a browser. */
bool GotoURL( const RString& sUrl );
#endif
/*
* (c) 2002-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-3
View File
@@ -20,7 +20,6 @@
#include "LocalizedString.h"
#include "arch/Dialog/Dialog.h"
#include "archutils/Win32/SpecialDirs.h"
#include "archutils/Win32/GotoURL.h"
#include "archutils/Win32/ErrorStrings.h"
#include <vector>
@@ -646,6 +645,4 @@ void LanguagesDlg::OnBnClickedCheckLanguage()
}
file.Close();
GotoURL( ssprintf("file://%s", sFullFile.c_str()) );
}