Pirates of a certain age are closely familiar “Are you going to work the death” me me and the Wide range of ports I was born (including a game the death who – which Runs inside an instance the death Itself). Still, this week viral video And the The ultimate itch release from U.S the death working port The standard notepad.exe text editor in Windows He left us a number of questions.
Most importantly: “How?” And why?”
“My favorite kind of magic trick”
When it comes to “how?” dumbad Programmer Sam Chiet told Ars that the hack is “my favorite kind of magic trick,” the kind that “looks wild, but is very simple.”
Building a C# port of open source the death Code source (And later turned into Chocolate Dome for the generic version), Chiet first converts each successive frame of the game to ASCII text. This is done using a simple algorithm that determines the “brightness” of each pixel (by averaging the RGB color channel data), and then converts that to a similar bold ASCII character using a predefined lookup table (ranging from “$” and “@” for the darkest pixel to “\” and “.” for lighter).
I got DOOM running inside Notepad at 60fps pic.twitter.com/EQFuRu4N0r
– Samperson (Crime Arc) (SamNChiet) October 9, 2022
“[The] The conversion is very simple and probably “incorrect,” but it works, and that’s what matters,” Cheett said. magic tricks [like this] Always equal parts disappointing and wonderful! “
Because “a notepad line is twice as wide,” dumbad It initially subtracts every other row of the generated text to keep the resulting ASCII in correct proportions. From there, Windows makes it relatively easy to insert a 360×240 text into Notepad at any font size the window and screen can handle, Chiet said.
“I’m stealing a reference to an internal text box and sticking it in my memory via the OS ‘message’ and forcing it to repaint,” he said. As for reading player input, this is “just something you can steal from anywhere in Windows; you don’t need to ‘open’ your specific software.”
“Travel aficionado. Infuriatingly humble reader. Incurable internet specialist.”