cracyc / msdos-player

67 stars 4 forks source link

Terminal #16

Open cracyc opened 7 months ago

cracyc commented 7 months ago

Full screen text output is broken on the terminal. https://github.com/cracyc/msdos-player/commit/b2a3b3441111f7728c014e1a6b4b90a2d5cce329 makes Wordperfect 6 work a bit but it breaks on the old console. I think that terminal support with vt escapes is going to be required for good output and might work okay on the console with windows 10 and 11 but will break on windows 8 and below.

roytam1 commented 7 months ago

maybe related: https://github.com/microsoft/terminal/issues/8681

roytam1 commented 7 months ago

and BTW conhost v2 crashes when msdos-player resizing console, MS fixed in their side but the fix doesn't deploy to most of LTS versions: https://github.com/microsoft/terminal/issues/256 and we may need workaround like: https://github.com/manuelschiller/vim/commit/235410f2a0f45be45ad7e0092a8f704077e7c3c3

roytam1 commented 7 months ago

and I tried to fix conhost-v2 crash in 21H2 LTSC by re-ordering API calls, and trying to add newline and move cursor 1 line upper. it may still crash but less frequent: https://github.com/roytam1/msdos-player/commit/827d35bbb1b66bedb6755f87acfd6e84ab168713

roytam1 commented 7 months ago

testing another workaround, which seems to be working: https://github.com/rprichard/winpty/pull/182/commits/b96df701744e1e6ca46cc5f4da3a96685b277612 my changes (against 2024-02-28 build): https://github.com/roytam1/msdos-player/commit/747044de4a742648263af0cbedbd6736b489be40

cracyc commented 7 months ago

https://github.com/cracyc/msdos-player/tree/vt makes this work much better with full vt escapes rather than an ugly workaround.

WP6 with terminal and win32 console API Screenshot 2024-03-02 165140 WP6 with terminal and vt escapes Screenshot 2024-03-02 165203

Still needs some work and testing.

cracyc commented 6 months ago

Vt support is mostly done. Buffer resizing had to be disabled as it broke output (and is the main reason why win32 console io didn't work in the terminal) and window resizing too as it caused the buffer to be resized and doesn't work anyway. The main remaining things are GetConsoleScreenBufferInfo for the cursor position, DECXCPR can be used but needs to work with the next, ReadConsoleInputA for input, can be replaced with ENABLE_VIRTUAL_TERMINAL_INPUT, and ReadConsoleOutputA which there is no replacement.