aboutsummaryrefslogtreecommitdiffstats
path: root/code/sys/sys_win32.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-11-30 18:32:52 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-11-30 18:32:52 +0000
commit7fccfcafc99fe8a81bee1e2cc32e3e383d238dc2 (patch)
tree7937e9a76c67be3539dd3d156c0504d5a8b14612 /code/sys/sys_win32.c
parent9fd7f3aaf029d18a4e596672f8ec899add5e9a58 (diff)
downloadioquake3-aero-7fccfcafc99fe8a81bee1e2cc32e3e383d238dc2.tar.gz
ioquake3-aero-7fccfcafc99fe8a81bee1e2cc32e3e383d238dc2.zip
* Add con_log.c to log all console output
* Add con_passive.c to cut down on #ifdef DEDICATED in sys_main.c * Add Sys_ErrorDialog to report ERR_FATALs to the user + On Windows use a MessageBox and offer to copy the console log to the clipboard + On everything else print to the terminal and save the console log as crashlog.txt git-svn-id: svn://svn.icculus.org/quake3/trunk@1222 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/sys/sys_win32.c')
-rw-r--r--code/sys/sys_win32.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c
index 64a57a2..18724b3 100644
--- a/code/sys/sys_win32.c
+++ b/code/sys/sys_win32.c
@@ -525,3 +525,43 @@ void Sys_Sleep( int msec )
WaitForSingleObject( GetStdHandle( STD_INPUT_HANDLE ), msec );
}
+/*
+==============
+Sys_ErrorDialog
+
+Display an error message
+==============
+*/
+void Sys_ErrorDialog( const char *error )
+{
+ if( MessageBox( NULL, va( "%s. Copy console log to clipboard?", error ),
+ NULL, MB_YESNO|MB_ICONERROR ) == IDYES )
+ {
+ HGLOBAL memoryHandle;
+ char *clipMemory;
+
+ memoryHandle = GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, CON_LogSize( ) + 1 );
+ clipMemory = (char *)GlobalLock( memoryHandle );
+
+ if( clipMemory )
+ {
+ char *p = clipMemory;
+ char buffer[ 1024 ];
+ unsigned int size;
+
+ while( ( size = CON_LogRead( buffer, sizeof( buffer ) ) ) > 0 )
+ {
+ Com_Memcpy( p, buffer, size );
+ p += size;
+ }
+
+ *p = '\0';
+
+ if( OpenClipboard( NULL ) && EmptyClipboard( ) )
+ SetClipboardData( CF_TEXT, memoryHandle );
+
+ GlobalUnlock( clipMemory );
+ CloseClipboard( );
+ }
+ }
+}