1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 12:19:55 +00:00
openmw-tes3mp/components
AnyOldName3 89d73c5fc7 Only reroute stdout etc. to new console if not already redirected
This should fix the issue where Windows Release builds (compiled as
/SUBSYSTEM:WINDOWS instead of /SUBSYSTEM:CONSOLE) can't have their
output redirected.

Basically, a console application creates a console if not given one, so
you get a console window behind OpenMW while it's running. It was
decided that this was ugly, so we set Release builds to be windows
applications, which don't get an automatic console and don't
automatically connect to a console if given one anyway.

Of course, we still wanted to actually be able to print to a console if
given one, so we manually attach to the parent process' console if it
exists, then reopen the standard streams connected to CON, the Windows
pseudo-file representing the current console.

This is a little like connecting a second wire into a dumb terminal in
that you're pumping characters into the display rather than onto a
pipeline, so output can't be redirected.

It turns out, though, that if a /SUBSYSTEM:WINDOWS application has its
standard streams redirected by the calling process, it still gets its
handles as normal, so everything starts off connected just how we want
it and we were clobbering this good setup with the straight-to-console
fix.

All we need to do to fix that is check if we've got valid standard
handles and that they go somewhere useful, and if so, avoid reopening
them once the console is attached. Simples.
2020-11-14 02:04:46 +00:00
..
bsa Merge branch 'cleanup_1' into 'master' 2020-10-24 18:43:03 +00:00
bullethelpers components/bullethelpers cleanup; removed warnings by using override 2020-10-22 22:46:18 +02:00
compiler Merge pull request #3018 from akortunov/emplace 2020-11-01 01:58:56 +03:00
config Merge branch 'cleanup_1' into 'master' 2020-10-24 18:43:03 +00:00
contentselector Mark overrided methods by override keyword 2020-10-16 22:18:54 +04:00
crashcatcher Try to disable CoverityScan warning in code with explanation 2020-10-28 18:01:42 +04:00
debug Only reroute stdout etc. to new console if not already redirected 2020-11-14 02:04:46 +00:00
detournavigator add more optionals and casserts for windows 2020-10-25 01:34:04 +02:00
esm Merge pull request #3018 from akortunov/emplace 2020-11-01 01:58:56 +03:00
esmterrain Mark overrided methods by override keyword 2020-10-16 22:18:54 +04:00
fallback set minimal boost version; remove #ifdef boost version checks 2020-10-25 22:43:10 +01:00
files Merge pull request #3018 from akortunov/emplace 2020-11-01 01:58:56 +03:00
fontloader Catch MyGUI exceptions in the FontLoader destructor 2020-06-18 15:13:02 +04:00
interpreter Mark overrided methods by override keyword 2020-10-16 22:18:54 +04:00
loadinglistener Fix C5204 warnings by adding default virtual destructors 2020-03-26 14:49:12 +04:00
misc Use some C++17 where it makes the code more readable 2020-10-22 07:15:16 +02:00
myguiplatform components/compiler cleanup; also cleaned up related cascading warnings; fixed up final/override issues 2020-10-22 23:57:53 +02:00
nif Handle NiGeomMorpherController interpolator list 2020-11-10 23:23:11 +03:00
nifbullet Misc NIF loader improvements 2020-11-08 13:23:18 +03:00
nifosg check ValueTs 2020-11-13 16:41:45 +01:00
process Remove redundant includes 2019-02-23 08:02:12 +04:00
resource Remove shader visitor settings manager dependency 2020-11-09 13:59:59 +03:00
sceneutil Merge branch 'shadows-bin' into 'master' 2020-11-13 16:29:41 +00:00
sdlutil Mark overrided methods by override keyword 2020-10-16 22:18:54 +04:00
settings Support vectors in settings.cfg 2020-07-24 21:47:49 +02:00
shader Merge branch 'shadows-bin' into 'master' 2020-11-13 16:29:41 +00:00
terrain Merge pull request #3018 from akortunov/emplace 2020-11-01 01:58:56 +03:00
to_utf8 Remove redundant includes 2019-02-23 08:02:12 +04:00
translation Replace all NULLs to nullptr 2018-10-09 10:21:12 +04:00
version Allow getting available version information even when clone is shallow 2017-03-07 21:53:49 +01:00
vfs Merge pull request #3018 from akortunov/emplace 2020-11-01 01:58:56 +03:00
widgets Merge pull request #3018 from akortunov/emplace 2020-11-01 01:58:56 +03:00
CMakeLists.txt Merge branch '3' of https://gitlab.com/bzzt/openmw into shadows-bin 2020-10-23 17:55:15 +01:00
doc.hpp second set of additional doxygen comments 2010-09-25 20:15:05 +02:00