Changeset - r17677:024018b5cd4e
[Not reviewed]
master
0 2 0
terkhen - 13 years ago 2011-05-15 14:51:06
terkhen@openttd.org
(svn r22464) -Fix [FS#4587]: [Windows] Prevent a crash when launching OpenTTD with -d from a MSYS console. Added a note to known-bugs about this issue.
2 files changed with 21 insertions and 1 deletions:
0 comments (0 inline, 0 general)
known-bugs.txt
Show inline comments
 
@@ -284,12 +284,18 @@ Station build date is incorrect [FS#4415
 
	was completely destroyed/rebuilt later on.
 
	The tile query tool can be fixed by changing the "Build date" text
 
	to "Date at which the last (re)construction took place" but this is
 
	deemed too specific and long for that window.
 

	
 
Can't change volume inside OpenTTD [FS#4416]
 
	Some backends do not provide a means to change the volume of sound
 
	effects or music. The mixing of music and sound is left to external
 
	libraries/the operating system we can't handle the volume control
 
	in OpenTTD. As a result you can't change the volume inside OpenTTD
 
	for backends such as SDL; just use the volume control provided by
 
	your operating system.
 

	
 
Can't run OpenTTD with the -d option from a MSYS console [FS#4587]
 
	The MSYS console does not allow OpenTTD to open an extra console for
 
	debugging output. Compiling OpenTTD with the --enable-console
 
	configure option prevents this issue and allows the -d option to use
 
	the MSYS console for its output.
src/os/windows/win32.cpp
Show inline comments
 
@@ -288,25 +288,39 @@ void CreateConsole()
 
	if (_has_console) return;
 
	_has_console = true;
 

	
 
	AllocConsole();
 

	
 
	hand = GetStdHandle(STD_OUTPUT_HANDLE);
 
	GetConsoleScreenBufferInfo(hand, &coninfo);
 
	coninfo.dwSize.Y = 500;
 
	SetConsoleScreenBufferSize(hand, coninfo.dwSize);
 

	
 
	/* redirect unbuffered STDIN, STDOUT, STDERR to the console */
 
#if !defined(__CYGWIN__)
 
	*stdout = *_fdopen( _open_osfhandle((intptr_t)hand, _O_TEXT), "w" );
 

	
 
	/* Check if we can open a handle to STDOUT. */
 
	int fd = _open_osfhandle((intptr_t)hand, _O_TEXT);
 
	if (fd == -1) {
 
		/* Free everything related to the console. */
 
		FreeConsole();
 
		_has_console = false;
 
		_close(fd);
 
		CloseHandle(hand);
 

	
 
		ShowInfo("Unable to open an output handle to the console. Check known-bugs.txt for details.");
 
		return;
 
	}
 

	
 
	*stdout = *_fdopen(fd, "w");
 
	*stdin = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_INPUT_HANDLE), _O_TEXT), "r" );
 
	*stderr = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_ERROR_HANDLE), _O_TEXT), "w" );
 
#else
 
	/* open_osfhandle is not in cygwin */
 
	*stdout = *fdopen(1, "w" );
 
	*stdin = *fdopen(0, "r" );
 
	*stderr = *fdopen(2, "w" );
 
#endif
 

	
 
	setvbuf(stdin, NULL, _IONBF, 0);
 
	setvbuf(stdout, NULL, _IONBF, 0);
 
	setvbuf(stderr, NULL, _IONBF, 0);
0 comments (0 inline, 0 general)