Windows virtual terminal sequences
Microsoft has been making a recommendation that programs should switch from using the classic low-level console API calls to virtual terminal sequences for a couple of years. References: "Our recommendation is to replace the classic Windows Console API with virtual terminal sequences. This article will outline the difference between the two and discuss the reasons for our recommendation." From: Classic Console APIs versus Virtual Terminal Sequences https://docs.microsoft.com/en-us/windows/console/classic-vs-vt The online documentation for WriteConsoleOutputCharacter() and WriteConsoleOutputAttribute() have this disclaimer on them: "This document describes console platform functionality that is no longer a part of our ecosystem roadmap. We do not recommend using this content in new products, but we will continue to support existing usages for the indefinite future. Our preferred modern solution focuses on virtual terminal sequences for maximum compatibility in cross-platform scenarios. You can find more information about this design decision in our classic console vs. virtual terminal document." Since NetHack started out as a terminal program, before there was a Windows "classic" console API introduced with Windows NT, it seemed only fitting that the Windows console port should evolve in the virtual terminal direction. This is a first stab at it. The performance won't be as instantaneous as the low-level console API's. That's likely partly because of this consoletty.c initial implementation, but it may also partly be because under the hood in the OS, there's recognitions/translations/conversions going on. Microsoft states it will continue to evolve the Windows Terminal and console, and hopefully it will improve. Hopefully it isn't too slow to play. It still attempts to take advantage of the back buffer stuff that Barton House introduced to minimize screen updates. At this point, it can still be recompiled without the virtual terminal support by defining NO_VT when compiling consoletty.c, or by commenting out the definition of VIRTUAL_TERMINAL_SEQUENCES at the top of sys/windows/consoletty.c That's the informational news, and the negative news out of the way. There's some good news too. Because the virtual terminal sequences support include 24-bit color support, the Windows console under virtual terminal sequence can provide a more pleasant set of colors to the NetHack console interface. To that end, some color changes have been implemented in consoletty.c now. It makes the console port ready to accept and display 24-bit color from the NetHack core, if that should ever happen, as well. As usual with a first implementation, there may be some bugs. Reports are welcome.
This commit is contained in:
@@ -15,7 +15,9 @@ void (*decgraphics_mode_callback)(void) = 0; /* set in tty_start_screen() */
|
||||
void (*ibmgraphics_mode_callback)(void) = 0; /* set in tty_start_screen() */
|
||||
void (*ascgraphics_mode_callback)(void) = 0; /* set in tty_start_screen() */
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
void (*ibmgraphics_mode_callback)(void) = 0; /* set in tty_start_screen() */
|
||||
#endif
|
||||
#ifdef CURSES_GRAPHICS
|
||||
void (*cursesgraphics_mode_callback)(void) = 0;
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user