Commit Graph

13 Commits (11eff02a1de963cc979c798892bd08ca32532227)

Author SHA1 Message Date
Petr Mikheev 49c6e50c31 Print '--version' and '--help' messages without timestamps 4 years ago
Petr Mikheev 5734551ff3 Add time to logs. Redirect OSG log to OpenMW log. 4 years ago
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.
4 years ago
elsid 29f262e514
Fix crash on destructed stream usage 5 years ago
Andrei Kortunov 14b756a692 Use a generic logging system for RecastNavigation 6 years ago
Stanislaw Halik c5c160870d fix accidental header namespace inclusion 6 years ago
Stanislaw Halik f6c8842457 move to debugging.[ch]pp 6 years ago
Stanislaw Halik 74955555b9 remove verbose comments and example 6 years ago
Stanislaw Halik 64e960aa22 enable win32 debug console when launching from console 6 years ago
Andrei Kortunov e06f0b797a Replace all NULLs to nullptr 6 years ago
Andrei Kortunov 9a5b016293 Move crashcatcher initialization to components 6 years ago
Andrei Kortunov 5e172ed831 Move cerr initialization out of 'try' block 6 years ago
Andrei Kortunov 7d6e3673e0 Implement advanced logging system (feature #4581) 6 years ago