Remove implicit conversion operator from RString to const char* (Win32)
follows up on6a29f651c7andecfcb11a00
This commit is contained in:
@@ -53,7 +53,7 @@ static INT_PTR CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
|||||||
// Set static text.
|
// Set static text.
|
||||||
RString sMessage = g_sMessage;
|
RString sMessage = g_sMessage;
|
||||||
Replace(sMessage, "\n", "\r\n" );
|
Replace(sMessage, "\n", "\r\n" );
|
||||||
SetWindowText( GetDlgItem(hWnd, IDC_MESSAGE), sMessage );
|
SetWindowText( GetDlgItem(hWnd, IDC_MESSAGE), sMessage.c_str() );
|
||||||
|
|
||||||
// Focus is on any of the controls in the dialog by default.
|
// Focus is on any of the controls in the dialog by default.
|
||||||
// I'm not sure why. Set focus to the button manually. -Chris
|
// I'm not sure why. Set focus to the button manually. -Chris
|
||||||
@@ -119,7 +119,7 @@ Dialog::Result DialogDriver_Win32::OKCancel( RString sMessage, RString sID )
|
|||||||
|
|
||||||
#if !defined(SMPACKAGE)
|
#if !defined(SMPACKAGE)
|
||||||
//DialogBox( handle.Get(), MAKEINTRESOURCE(IDD_OK), ::GetHwnd(), OKWndProc );
|
//DialogBox( handle.Get(), MAKEINTRESOURCE(IDD_OK), ::GetHwnd(), OKWndProc );
|
||||||
int result = ::MessageBox( nullptr, sMessage, GetWindowTitle(), MB_OKCANCEL );
|
int result = ::MessageBox( nullptr, sMessage.c_str(), GetWindowTitle().c_str(), MB_OKCANCEL );
|
||||||
#else
|
#else
|
||||||
int result = ::AfxMessageBox( ConvertUTF8ToACP(sMessage).c_str(), MB_OKCANCEL, 0 );
|
int result = ::AfxMessageBox( ConvertUTF8ToACP(sMessage).c_str(), MB_OKCANCEL, 0 );
|
||||||
#endif
|
#endif
|
||||||
@@ -149,7 +149,7 @@ static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
|
|||||||
// Set static text
|
// Set static text
|
||||||
RString sMessage = g_sErrorString;
|
RString sMessage = g_sErrorString;
|
||||||
Replace(sMessage, "\n", "\r\n" );
|
Replace(sMessage, "\n", "\r\n" );
|
||||||
SetWindowText( GetDlgItem(hWnd, IDC_EDIT_ERROR), sMessage );
|
SetWindowText( GetDlgItem(hWnd, IDC_EDIT_ERROR), sMessage.c_str() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
@@ -163,7 +163,7 @@ static INT_PTR CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
|
|||||||
|
|
||||||
RString sAppDataDir = SpecialDirs::GetAppDataDir();
|
RString sAppDataDir = SpecialDirs::GetAppDataDir();
|
||||||
RString sCommand = "notepad \"" + sAppDataDir + PRODUCT_ID + "/Logs/log.txt\"";
|
RString sCommand = "notepad \"" + sAppDataDir + PRODUCT_ID + "/Logs/log.txt\"";
|
||||||
CreateProcess(
|
CreateProcess( // TODO: resolve Warning C6335 "leaking process information"
|
||||||
nullptr, // pointer to name of executable module
|
nullptr, // pointer to name of executable module
|
||||||
const_cast<char *>(sCommand.c_str()), // pointer to command line string
|
const_cast<char *>(sCommand.c_str()), // pointer to command line string
|
||||||
nullptr, // process security attributes
|
nullptr, // process security attributes
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ LightsDriver_SextetStreamToFile::LightsDriver_SextetStreamToFile(const RString&
|
|||||||
{
|
{
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
_impl = new SextetImpl(CreateFile(
|
_impl = new SextetImpl(CreateFile(
|
||||||
filename, // pipe name
|
filename.c_str(), // pipe name
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
0, // no sharing
|
0, // no sharing
|
||||||
NULL, // default security attributes
|
NULL, // default security attributes
|
||||||
@@ -170,7 +170,7 @@ LightsDriver_SextetStreamToFile::LightsDriver_SextetStreamToFile()
|
|||||||
{
|
{
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
_impl = new SextetImpl(CreateFile(
|
_impl = new SextetImpl(CreateFile(
|
||||||
g_sSextetStreamOutputFilename.Get(), // pipe name
|
g_sSextetStreamOutputFilename.Get().c_str(), // pipe name
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
0, // no sharing
|
0, // no sharing
|
||||||
NULL, // default security attributes
|
NULL, // default security attributes
|
||||||
|
|||||||
@@ -42,19 +42,19 @@ static void DestroyGraphicsWindowAndOpenGLContext()
|
|||||||
|
|
||||||
void *LowLevelWindow_Win32::GetProcAddress( RString s )
|
void *LowLevelWindow_Win32::GetProcAddress( RString s )
|
||||||
{
|
{
|
||||||
void *pRet = (void*) wglGetProcAddress( s );
|
void *pRet = (void*) wglGetProcAddress( s.c_str() );
|
||||||
if( pRet != nullptr )
|
if( pRet != nullptr )
|
||||||
return pRet;
|
return pRet;
|
||||||
|
|
||||||
if (g_HGL_Module != nullptr)
|
if (g_HGL_Module != nullptr)
|
||||||
{
|
{
|
||||||
pRet = (void *) ::GetProcAddress( g_HGL_Module, s );
|
pRet = (void *) ::GetProcAddress( g_HGL_Module, s.c_str() );
|
||||||
|
|
||||||
if (pRet != nullptr)
|
if (pRet != nullptr)
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void*) ::GetProcAddress( GetModuleHandle(nullptr), s );
|
return (void*) ::GetProcAddress( GetModuleHandle(nullptr), s.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
LowLevelWindow_Win32::LowLevelWindow_Win32()
|
LowLevelWindow_Win32::LowLevelWindow_Win32()
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ static bool TestReady( const RString &sDrive, RString &sVolumeLabelOut )
|
|||||||
TCHAR szFileSystemNameBuffer[MAX_PATH];
|
TCHAR szFileSystemNameBuffer[MAX_PATH];
|
||||||
|
|
||||||
if( !GetVolumeInformation(
|
if( !GetVolumeInformation(
|
||||||
sDrive,
|
sDrive.c_str(),
|
||||||
szVolumeNameBuffer,
|
szVolumeNameBuffer,
|
||||||
sizeof(szVolumeNameBuffer),
|
sizeof(szVolumeNameBuffer),
|
||||||
&dwVolumeSerialNumber,
|
&dwVolumeSerialNumber,
|
||||||
@@ -76,7 +76,7 @@ static bool IsFloppyDrive( const RString &sDrive )
|
|||||||
{
|
{
|
||||||
char szBuf[1024];
|
char szBuf[1024];
|
||||||
|
|
||||||
int iRet = QueryDosDevice( sDrive, szBuf, 1024 );
|
int iRet = QueryDosDevice( sDrive.c_str(), szBuf, 1024 );
|
||||||
if( iRet == 0 )
|
if( iRet == 0 )
|
||||||
{
|
{
|
||||||
LOG->Warn( werr_ssprintf(GetLastError(), "QueryDosDevice(%s)", sDrive.c_str()) );
|
LOG->Warn( werr_ssprintf(GetLastError(), "QueryDosDevice(%s)", sDrive.c_str()) );
|
||||||
@@ -116,7 +116,8 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
|
|||||||
|
|
||||||
LOG->Trace( sDrive );
|
LOG->Trace( sDrive );
|
||||||
|
|
||||||
if( IsFloppyDrive(sDrive) )
|
// we definitely don't need this lol
|
||||||
|
if (IsFloppyDrive(sDrive.c_str()))
|
||||||
{
|
{
|
||||||
LOG->Trace( "IsFloppyDrive" );
|
LOG->Trace( "IsFloppyDrive" );
|
||||||
continue;
|
continue;
|
||||||
@@ -127,7 +128,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
|
|||||||
|
|
||||||
bool bIsSpecifiedMountPoint = false;
|
bool bIsSpecifiedMountPoint = false;
|
||||||
FOREACH_ENUM( PlayerNumber, p )
|
FOREACH_ENUM( PlayerNumber, p )
|
||||||
bIsSpecifiedMountPoint |= EqualsNoCase(MEMCARDMAN->m_sMemoryCardOsMountPoint[p].Get(), sDrive);
|
bIsSpecifiedMountPoint |= EqualsNoCase(MEMCARDMAN->m_sMemoryCardOsMountPoint[p].Get(), sDrive.c_str());
|
||||||
|
|
||||||
RString sDrivePath = sDrive + "\\";
|
RString sDrivePath = sDrive + "\\";
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( GetDriveType(sDrivePath) != DRIVE_REMOVABLE )
|
if( GetDriveType(sDrivePath.c_str()) != DRIVE_REMOVABLE )
|
||||||
{
|
{
|
||||||
LOG->Trace( "not DRIVE_REMOVABLE" );
|
LOG->Trace( "not DRIVE_REMOVABLE" );
|
||||||
continue;
|
continue;
|
||||||
@@ -145,7 +146,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
|
|||||||
}
|
}
|
||||||
|
|
||||||
RString sVolumeLabel;
|
RString sVolumeLabel;
|
||||||
if( !TestReady(sDrivePath, sVolumeLabel) )
|
if( !TestReady(sDrivePath.c_str(), sVolumeLabel) )
|
||||||
{
|
{
|
||||||
LOG->Trace( "not TestReady" );
|
LOG->Trace( "not TestReady" );
|
||||||
continue;
|
continue;
|
||||||
@@ -153,8 +154,8 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
|
|||||||
|
|
||||||
vDevicesOut.push_back( UsbStorageDevice() );
|
vDevicesOut.push_back( UsbStorageDevice() );
|
||||||
UsbStorageDevice &usbd = vDevicesOut.back();
|
UsbStorageDevice &usbd = vDevicesOut.back();
|
||||||
usbd.SetOsMountDir( sDrive );
|
usbd.SetOsMountDir( sDrive.c_str() );
|
||||||
usbd.sDevice = "\\\\.\\" + sDrive;
|
usbd.sDevice = RString("\\\\.\\") + sDrive.c_str();
|
||||||
usbd.sVolumeLabel = sVolumeLabel;
|
usbd.sVolumeLabel = sVolumeLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStor
|
|||||||
DWORD dwNumberOfFreeClusters;
|
DWORD dwNumberOfFreeClusters;
|
||||||
DWORD dwTotalNumberOfClusters;
|
DWORD dwTotalNumberOfClusters;
|
||||||
if( GetDiskFreeSpace(
|
if( GetDiskFreeSpace(
|
||||||
usbd.sOsMountDir,
|
usbd.sOsMountDir.c_str(),
|
||||||
&dwSectorsPerCluster,
|
&dwSectorsPerCluster,
|
||||||
&dwBytesPerSector,
|
&dwBytesPerSector,
|
||||||
&dwNumberOfFreeClusters,
|
&dwNumberOfFreeClusters,
|
||||||
@@ -196,7 +197,7 @@ bool MemoryCardDriverThreaded_Windows::Mount( UsbStorageDevice* pDevice )
|
|||||||
void MemoryCardDriverThreaded_Windows::Unmount( UsbStorageDevice* pDevice )
|
void MemoryCardDriverThreaded_Windows::Unmount( UsbStorageDevice* pDevice )
|
||||||
{
|
{
|
||||||
/* Try to flush the device before returning. This requires administrator priviliges. */
|
/* Try to flush the device before returning. This requires administrator priviliges. */
|
||||||
HANDLE hDevice = CreateFile( pDevice->sDevice, GENERIC_WRITE,
|
HANDLE hDevice = CreateFile( pDevice->sDevice.c_str(), GENERIC_WRITE,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr );
|
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr );
|
||||||
|
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ static void debug_crash()
|
|||||||
* If iID == GetInvalidThreadId(), then output a stack trace for every thread. */
|
* If iID == GetInvalidThreadId(), then output a stack trace for every thread. */
|
||||||
void CrashHandler::ForceDeadlock( RString reason, uint64_t iID )
|
void CrashHandler::ForceDeadlock( RString reason, uint64_t iID )
|
||||||
{
|
{
|
||||||
strncpy( g_CrashInfo.m_CrashReason, reason, sizeof(g_CrashInfo.m_CrashReason) );
|
strncpy( g_CrashInfo.m_CrashReason, reason.c_str(), sizeof(g_CrashInfo.m_CrashReason) );
|
||||||
g_CrashInfo.m_CrashReason[ sizeof(g_CrashInfo.m_CrashReason)-1 ] = 0;
|
g_CrashInfo.m_CrashReason[ sizeof(g_CrashInfo.m_CrashReason)-1 ] = 0;
|
||||||
|
|
||||||
/* Suspend the other thread we're going to backtrace. (We need to at least
|
/* Suspend the other thread we're going to backtrace. (We need to at least
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ RString SpliceProgramPath( RString fn )
|
|||||||
char szModName[MAX_PATH];
|
char szModName[MAX_PATH];
|
||||||
char *pszFile;
|
char *pszFile;
|
||||||
GetFullPathName( szBuf, sizeof(szModName), szModName, &pszFile );
|
GetFullPathName( szBuf, sizeof(szModName), szModName, &pszFile );
|
||||||
strcpy( pszFile, fn );
|
strcpy( pszFile, fn.c_str() );
|
||||||
|
|
||||||
return szModName;
|
return szModName;
|
||||||
}
|
}
|
||||||
@@ -501,8 +501,8 @@ static void DoSave( const RString &sReport )
|
|||||||
{
|
{
|
||||||
RString sName = SpliceProgramPath( "../crashinfo.txt" );
|
RString sName = SpliceProgramPath( "../crashinfo.txt" );
|
||||||
|
|
||||||
SetFileAttributes( sName, FILE_ATTRIBUTE_NORMAL );
|
SetFileAttributes( sName.c_str(), FILE_ATTRIBUTE_NORMAL );
|
||||||
FILE *pFile = fopen( sName, "w+" );
|
FILE *pFile = fopen( sName.c_str(), "w+" );
|
||||||
if( pFile == nullptr )
|
if( pFile == nullptr )
|
||||||
return;
|
return;
|
||||||
fprintf( pFile, "%s", sReport.c_str() );
|
fprintf( pFile, "%s", sReport.c_str() );
|
||||||
@@ -510,7 +510,7 @@ static void DoSave( const RString &sReport )
|
|||||||
fclose( pFile );
|
fclose( pFile );
|
||||||
|
|
||||||
// Discourage changing crashinfo.txt.
|
// Discourage changing crashinfo.txt.
|
||||||
SetFileAttributes( sName, FILE_ATTRIBUTE_READONLY );
|
SetFileAttributes( sName.c_str(), FILE_ATTRIBUTE_READONLY );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
|
bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
|
||||||
@@ -683,8 +683,8 @@ void CrashDialog::SetDialogInitial()
|
|||||||
{
|
{
|
||||||
HWND hDlg = GetHwnd();
|
HWND hDlg = GetHwnd();
|
||||||
|
|
||||||
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), A_CRASH_HAS_OCCURRED.GetValue() );
|
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), A_CRASH_HAS_OCCURRED.GetValue().c_str() );
|
||||||
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue() );
|
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue().c_str() );
|
||||||
ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), false );
|
ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), false );
|
||||||
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
|
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
|
||||||
}
|
}
|
||||||
@@ -745,7 +745,7 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
|||||||
case IDC_VIEW_LOG:
|
case IDC_VIEW_LOG:
|
||||||
{
|
{
|
||||||
RString sLogPath;
|
RString sLogPath;
|
||||||
FILE *pFile = fopen( SpliceProgramPath("../Portable.ini"), "r" );
|
FILE *pFile = fopen( SpliceProgramPath("../Portable.ini").c_str(), "r" );
|
||||||
if(pFile != nullptr)
|
if(pFile != nullptr)
|
||||||
{
|
{
|
||||||
sLogPath = SpliceProgramPath("../Logs/log.txt");
|
sLogPath = SpliceProgramPath("../Logs/log.txt");
|
||||||
@@ -754,11 +754,11 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
|||||||
else
|
else
|
||||||
sLogPath = SpecialDirs::GetAppDataDir() + PRODUCT_ID +"/Logs/log.txt";
|
sLogPath = SpecialDirs::GetAppDataDir() + PRODUCT_ID +"/Logs/log.txt";
|
||||||
|
|
||||||
ShellExecute( nullptr, "open", sLogPath, "", "", SW_SHOWNORMAL );
|
ShellExecute( nullptr, "open", sLogPath.c_str(), "", "", SW_SHOWNORMAL );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDC_CRASH_SAVE:
|
case IDC_CRASH_SAVE:
|
||||||
ShellExecute( nullptr, "open", SpliceProgramPath("../crashinfo.txt"), "", "", SW_SHOWNORMAL );
|
ShellExecute( nullptr, "open", SpliceProgramPath("../crashinfo.txt").c_str(), "", "", SW_SHOWNORMAL );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case IDC_BUTTON_RESTART:
|
case IDC_BUTTON_RESTART:
|
||||||
Win32RestartProgram();
|
Win32RestartProgram();
|
||||||
@@ -810,21 +810,21 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
|||||||
/* On error, don't show the "report" button again. If the submission was actually
|
/* On error, don't show the "report" button again. If the submission was actually
|
||||||
* successful, then it'd be too easy to accidentally spam the server by holding
|
* successful, then it'd be too easy to accidentally spam the server by holding
|
||||||
* down the button. */
|
* down the button. */
|
||||||
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() );
|
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue().c_str() );
|
||||||
}
|
}
|
||||||
else if( xml.GetChildValue("UpdateAvailable", m_sUpdateURL) )
|
else if( xml.GetChildValue("UpdateAvailable", m_sUpdateURL) )
|
||||||
{
|
{
|
||||||
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_AVAILABLE.GetValue() );
|
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_AVAILABLE.GetValue().c_str() );
|
||||||
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), VIEW_UPDATE.GetValue() );
|
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), VIEW_UPDATE.GetValue().c_str() );
|
||||||
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
|
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
|
||||||
}
|
}
|
||||||
else if( xml.GetChildValue("ReportId", iID) )
|
else if( xml.GetChildValue("ReportId", iID) )
|
||||||
{
|
{
|
||||||
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_NOT_AVAILABLE.GetValue() );
|
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_NOT_AVAILABLE.GetValue().c_str() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() );
|
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue().c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xml.GetChildValue("ReportId", iID) )
|
if( xml.GetChildValue("ReportId", iID) )
|
||||||
@@ -835,7 +835,7 @@ INT_PTR CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), false );
|
ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), false );
|
||||||
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue() );
|
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue().c_str() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ void NetworkStream_Win32::Open( const RString &sHost, int iPort, ConnectionType
|
|||||||
m_hResolve = WSAAsyncGetHostByName(
|
m_hResolve = WSAAsyncGetHostByName(
|
||||||
mw.GetHwnd(),
|
mw.GetHwnd(),
|
||||||
WM_USER,
|
WM_USER,
|
||||||
m_sHost,
|
m_sHost.c_str(),
|
||||||
(char *) pHost,
|
(char *) pHost,
|
||||||
MAXGETHOSTSTRUCT
|
MAXGETHOSTSTRUCT
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -88,13 +88,13 @@ static LRESULT CALLBACK GraphicsWindow_WndProc( HWND hWnd, UINT msg, WPARAM wPar
|
|||||||
* because that's where most other apps seem to do it. */
|
* because that's where most other apps seem to do it. */
|
||||||
if( g_bHasFocus && !bHadFocus )
|
if( g_bHasFocus && !bHadFocus )
|
||||||
{
|
{
|
||||||
ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId, &g_FullScreenDevMode, nullptr, CDS_FULLSCREEN, nullptr );
|
ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId.c_str(), &g_FullScreenDevMode, nullptr, CDS_FULLSCREEN, nullptr );
|
||||||
ShowWindow( g_hWndMain, SW_SHOWNORMAL );
|
ShowWindow( g_hWndMain, SW_SHOWNORMAL );
|
||||||
SetWindowPos( g_hWndMain, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
|
SetWindowPos( g_hWndMain, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
|
||||||
}
|
}
|
||||||
else if( !g_bHasFocus && bHadFocus )
|
else if( !g_bHasFocus && bHadFocus )
|
||||||
{
|
{
|
||||||
ChangeDisplaySettingsEx(g_CurrentParams.sDisplayId, nullptr, nullptr, 0, nullptr);
|
ChangeDisplaySettingsEx(g_CurrentParams.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ static void AdjustVideoModeParams( VideoModeParams &p )
|
|||||||
DEVMODE dm;
|
DEVMODE dm;
|
||||||
ZERO( dm );
|
ZERO( dm );
|
||||||
dm.dmSize = sizeof(dm);
|
dm.dmSize = sizeof(dm);
|
||||||
if (!EnumDisplaySettings(p.sDisplayId, ENUM_CURRENT_SETTINGS, &dm))
|
if (!EnumDisplaySettings(p.sDisplayId.c_str(), ENUM_CURRENT_SETTINGS, &dm))
|
||||||
{
|
{
|
||||||
p.rate = 60;
|
p.rate = 60;
|
||||||
LOG->Warn( "%s", werr_ssprintf(GetLastError(), "EnumDisplaySettings failed").c_str() );
|
LOG->Warn( "%s", werr_ssprintf(GetLastError(), "EnumDisplaySettings failed").c_str() );
|
||||||
@@ -233,7 +233,7 @@ RString GraphicsWindow::SetScreenMode( const VideoModeParams &p )
|
|||||||
if( p.windowed )
|
if( p.windowed )
|
||||||
{
|
{
|
||||||
// We're going windowed. If we were previously fullscreen, reset.
|
// We're going windowed. If we were previously fullscreen, reset.
|
||||||
ChangeDisplaySettingsEx( p.sDisplayId, nullptr, nullptr, 0, nullptr );
|
ChangeDisplaySettingsEx( p.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr );
|
||||||
|
|
||||||
return RString();
|
return RString();
|
||||||
}
|
}
|
||||||
@@ -251,13 +251,13 @@ RString GraphicsWindow::SetScreenMode( const VideoModeParams &p )
|
|||||||
DevMode.dmDisplayFrequency = p.rate;
|
DevMode.dmDisplayFrequency = p.rate;
|
||||||
DevMode.dmFields |= DM_DISPLAYFREQUENCY;
|
DevMode.dmFields |= DM_DISPLAYFREQUENCY;
|
||||||
}
|
}
|
||||||
ChangeDisplaySettingsEx(p.sDisplayId, nullptr, nullptr, 0, nullptr);
|
ChangeDisplaySettingsEx(p.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr);
|
||||||
|
|
||||||
int ret = ChangeDisplaySettingsEx( p.sDisplayId, &DevMode, nullptr, CDS_FULLSCREEN, nullptr );
|
int ret = ChangeDisplaySettingsEx( p.sDisplayId.c_str(), &DevMode, nullptr, CDS_FULLSCREEN, nullptr );
|
||||||
if( ret != DISP_CHANGE_SUCCESSFUL && (DevMode.dmFields & DM_DISPLAYFREQUENCY) )
|
if( ret != DISP_CHANGE_SUCCESSFUL && (DevMode.dmFields & DM_DISPLAYFREQUENCY) )
|
||||||
{
|
{
|
||||||
DevMode.dmFields &= ~DM_DISPLAYFREQUENCY;
|
DevMode.dmFields &= ~DM_DISPLAYFREQUENCY;
|
||||||
ret = ChangeDisplaySettingsEx( p.sDisplayId, &DevMode, nullptr, CDS_FULLSCREEN, nullptr );
|
ret = ChangeDisplaySettingsEx( p.sDisplayId.c_str(), &DevMode, nullptr, CDS_FULLSCREEN, nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: append error
|
// XXX: append error
|
||||||
@@ -309,7 +309,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
|
|||||||
pos.y = 0;
|
pos.y = 0;
|
||||||
|
|
||||||
// Look for the preferred display's position.
|
// Look for the preferred display's position.
|
||||||
if (EnumDisplaySettingsEx(p.sDisplayId, ENUM_CURRENT_SETTINGS, &devmode, 0) && deviceModeIsValid(devmode)
|
if (EnumDisplaySettingsEx(p.sDisplayId.c_str(), ENUM_CURRENT_SETTINGS, &devmode, 0) && deviceModeIsValid(devmode)
|
||||||
&& (devmode.dmFields & DM_POSITION))
|
&& (devmode.dmFields & DM_POSITION))
|
||||||
{
|
{
|
||||||
pos = devmode.dmPosition;
|
pos = devmode.dmPosition;
|
||||||
@@ -321,7 +321,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
|
|||||||
int iWindowStyle = GetWindowStyle( p.windowed , p.bWindowIsFullscreenBorderless );
|
int iWindowStyle = GetWindowStyle( p.windowed , p.bWindowIsFullscreenBorderless );
|
||||||
|
|
||||||
AppInstance inst;
|
AppInstance inst;
|
||||||
HWND hWnd = CreateWindow( g_sClassName, "app", iWindowStyle,
|
HWND hWnd = CreateWindow( g_sClassName.c_str(), "app", iWindowStyle,
|
||||||
0, 0, 0, 0, nullptr, nullptr, inst, nullptr );
|
0, 0, 0, 0, nullptr, nullptr, inst, nullptr );
|
||||||
if( hWnd == nullptr )
|
if( hWnd == nullptr )
|
||||||
RageException::Throw( "%s", werr_ssprintf( GetLastError(), "CreateWindow" ).c_str() );
|
RageException::Throw( "%s", werr_ssprintf( GetLastError(), "CreateWindow" ).c_str() );
|
||||||
@@ -353,7 +353,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWindowTextA( g_hWndMain, ConvertUTF8ToACP(p.sWindowTitle) );
|
SetWindowTextA( g_hWndMain, ConvertUTF8ToACP(p.sWindowTitle).c_str() );
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
// Update the window icon.
|
// Update the window icon.
|
||||||
@@ -500,7 +500,7 @@ void GraphicsWindow::Initialize( bool bD3D )
|
|||||||
LoadCursor( nullptr, IDC_ARROW ), /* default cursor */
|
LoadCursor( nullptr, IDC_ARROW ), /* default cursor */
|
||||||
nullptr, /* hbrBackground */
|
nullptr, /* hbrBackground */
|
||||||
nullptr, /* lpszMenuName */
|
nullptr, /* lpszMenuName */
|
||||||
g_sClassName /* lpszClassName */
|
g_sClassName.c_str() /* lpszClassName */
|
||||||
};
|
};
|
||||||
|
|
||||||
m_bWideWindowClass = false;
|
m_bWideWindowClass = false;
|
||||||
@@ -519,10 +519,10 @@ void GraphicsWindow::Shutdown()
|
|||||||
* It'd be nice to not do this: Windows will do it when we quit, and if
|
* It'd be nice to not do this: Windows will do it when we quit, and if
|
||||||
* we're shutting down OpenGL to try D3D, this will cause extra mode
|
* we're shutting down OpenGL to try D3D, this will cause extra mode
|
||||||
* switches. However, we need to do this before displaying dialogs. */
|
* switches. However, we need to do this before displaying dialogs. */
|
||||||
ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId, nullptr, nullptr, 0, nullptr );
|
ChangeDisplaySettingsEx( g_CurrentParams.sDisplayId.c_str(), nullptr, nullptr, 0, nullptr );
|
||||||
|
|
||||||
AppInstance inst;
|
AppInstance inst;
|
||||||
UnregisterClass( g_sClassName, inst );
|
UnregisterClass( g_sClassName.c_str(), inst );
|
||||||
}
|
}
|
||||||
|
|
||||||
HDC GraphicsWindow::GetHDC()
|
HDC GraphicsWindow::GetHDC()
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ MessageWindow::MessageWindow( const RString &sClassName )
|
|||||||
LoadCursor( nullptr, IDC_ARROW ), /* default cursor */
|
LoadCursor( nullptr, IDC_ARROW ), /* default cursor */
|
||||||
nullptr, /* hbrBackground */
|
nullptr, /* hbrBackground */
|
||||||
nullptr, /* lpszMenuName */
|
nullptr, /* lpszMenuName */
|
||||||
sClassName /* lpszClassName */
|
sClassName.c_str() /* lpszClassName */
|
||||||
};
|
};
|
||||||
|
|
||||||
if( !RegisterClassA(&WindowClass) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS )
|
if( !RegisterClassA(&WindowClass) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS )
|
||||||
RageException::Throw( "%s", werr_ssprintf( GetLastError(), "RegisterClass" ).c_str() );
|
RageException::Throw( "%s", werr_ssprintf( GetLastError(), "RegisterClass" ).c_str() );
|
||||||
|
|
||||||
// XXX: on 2k/XP, use HWND_MESSAGE as parent
|
// XXX: on 2k/XP, use HWND_MESSAGE as parent
|
||||||
m_hWnd = CreateWindow( sClassName, sClassName, WS_DISABLED, 0, 0, 0, 0, nullptr, nullptr, inst, nullptr );
|
m_hWnd = CreateWindow( sClassName.c_str(), sClassName.c_str(), WS_DISABLED, 0, 0, 0, 0, nullptr, nullptr, inst, nullptr );
|
||||||
ASSERT( m_hWnd != nullptr );
|
ASSERT( m_hWnd != nullptr );
|
||||||
|
|
||||||
SetProp( m_hWnd, "MessageWindow", this );
|
SetProp( m_hWnd, "MessageWindow", this );
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ static HKEY OpenRegKey( const RString &sKey, RegKeyMode mode, bool bWarnOnError
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
HKEY hRetKey;
|
HKEY hRetKey;
|
||||||
LONG retval = RegOpenKeyEx( hType, sSubkey, 0, (mode==READ) ? KEY_READ:KEY_WRITE, &hRetKey );
|
LONG retval = RegOpenKeyEx( hType, sSubkey.c_str(), 0, (mode==READ) ? KEY_READ:KEY_WRITE, &hRetKey );
|
||||||
if ( retval != ERROR_SUCCESS )
|
if ( retval != ERROR_SUCCESS )
|
||||||
{
|
{
|
||||||
if( bWarnOnError )
|
if( bWarnOnError )
|
||||||
@@ -69,7 +69,7 @@ bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, RSt
|
|||||||
char sBuffer[MAX_PATH];
|
char sBuffer[MAX_PATH];
|
||||||
DWORD iSize = sizeof(sBuffer);
|
DWORD iSize = sizeof(sBuffer);
|
||||||
DWORD iType;
|
DWORD iType;
|
||||||
LONG iRet = RegQueryValueEx( hKey, sName, nullptr, &iType, (LPBYTE)sBuffer, &iSize );
|
LONG iRet = RegQueryValueEx( hKey, sName.c_str(), nullptr, &iType, (LPBYTE)sBuffer, &iSize );
|
||||||
RegCloseKey( hKey );
|
RegCloseKey( hKey );
|
||||||
if( iRet != ERROR_SUCCESS )
|
if( iRet != ERROR_SUCCESS )
|
||||||
return false;
|
return false;
|
||||||
@@ -95,7 +95,7 @@ bool RegistryAccess::GetRegValue( const RString &sKey, const RString &sName, int
|
|||||||
DWORD iValue;
|
DWORD iValue;
|
||||||
DWORD iSize = sizeof(iValue);
|
DWORD iSize = sizeof(iValue);
|
||||||
DWORD iType;
|
DWORD iType;
|
||||||
LONG iRet = RegQueryValueEx( hKey, sName, nullptr, &iType, (LPBYTE) &iValue, &iSize );
|
LONG iRet = RegQueryValueEx( hKey, sName.c_str(), nullptr, &iType, (LPBYTE) &iValue, &iSize );
|
||||||
RegCloseKey( hKey );
|
RegCloseKey( hKey );
|
||||||
if( iRet != ERROR_SUCCESS )
|
if( iRet != ERROR_SUCCESS )
|
||||||
return false;
|
return false;
|
||||||
@@ -169,7 +169,7 @@ bool RegistryAccess::SetRegValue( const RString &sKey, const RString &sName, con
|
|||||||
|
|
||||||
strcpy( sz, sVal.c_str() );
|
strcpy( sz, sVal.c_str() );
|
||||||
|
|
||||||
LONG lResult = ::RegSetValueEx(hKey, LPCTSTR(sName), 0, REG_SZ, (LPBYTE)sz, strlen(sz) + 1);
|
LONG lResult = ::RegSetValueEx(hKey, LPCTSTR(sName.c_str()), 0, REG_SZ, (LPBYTE)sz, strlen(sz) + 1);
|
||||||
if( lResult != ERROR_SUCCESS )
|
if( lResult != ERROR_SUCCESS )
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ bool RegistryAccess::SetRegValue( const RString &sKey, const RString &sName, boo
|
|||||||
|
|
||||||
bool bSuccess = true;
|
bool bSuccess = true;
|
||||||
|
|
||||||
if (::RegSetValueEx(hKey, LPCTSTR(sName), 0,
|
if (::RegSetValueEx(hKey, LPCTSTR(sName.c_str()), 0,
|
||||||
REG_BINARY, (LPBYTE)&bVal, sizeof(bVal))
|
REG_BINARY, (LPBYTE)&bVal, sizeof(bVal))
|
||||||
!= ERROR_SUCCESS)
|
!= ERROR_SUCCESS)
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
@@ -205,7 +205,7 @@ bool RegistryAccess::CreateKey( const RString &sKey )
|
|||||||
DWORD dwDisposition = 0;
|
DWORD dwDisposition = 0;
|
||||||
if( ::RegCreateKeyEx(
|
if( ::RegCreateKeyEx(
|
||||||
hType,
|
hType,
|
||||||
sSubkey,
|
sSubkey.c_str(),
|
||||||
0,
|
0,
|
||||||
nullptr,
|
nullptr,
|
||||||
REG_OPTION_NON_VOLATILE,
|
REG_OPTION_NON_VOLATILE,
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ bool USBDevice::Open( int iVID, int iPID, int iBlockSize, int iNum, void (*pfnIn
|
|||||||
RString path;
|
RString path;
|
||||||
while( (path = GetUSBDevicePath(iIndex++)) != "" )
|
while( (path = GetUSBDevicePath(iIndex++)) != "" )
|
||||||
{
|
{
|
||||||
HANDLE h = CreateFile( path, GENERIC_READ,
|
HANDLE h = CreateFile( path.c_str(), GENERIC_READ,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr );
|
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr );
|
||||||
|
|
||||||
if( h == INVALID_HANDLE_VALUE )
|
if( h == INVALID_HANDLE_VALUE )
|
||||||
@@ -138,7 +138,7 @@ bool WindowsFileIO::Open( RString path, int iBlockSize )
|
|||||||
if( m_Handle != INVALID_HANDLE_VALUE )
|
if( m_Handle != INVALID_HANDLE_VALUE )
|
||||||
CloseHandle( m_Handle );
|
CloseHandle( m_Handle );
|
||||||
|
|
||||||
m_Handle = CreateFile( path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
m_Handle = CreateFile( path.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr );
|
nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr );
|
||||||
|
|
||||||
if( m_Handle == INVALID_HANDLE_VALUE )
|
if( m_Handle == INVALID_HANDLE_VALUE )
|
||||||
|
|||||||
Reference in New Issue
Block a user