Page 1 of 1

Porting DOS games to modern platforms

Posted: Sun Dec 27, 2020 7:03 am
by gabonator
Hello guys,

few years ago I made an experiment where I translated the disassembled code of a game (Alley Cat, Star Goose) into C++ or Javascript. It was just a proof of concept and a lot of things needed to be fixed by hand. I sporadically returned to this experiment to improve the translation process. Now it has became quite powerful and standalone and this is a result (Star goose in swift):

https://youtu.be/IaZiQrUdR9s

Anyone interested in this topic? Anyone who would like to contribute to this project? It is in C++ and there are still a lot of things to be improved. Currently I am finetuning the conversion tool to port the Xenon2 game and I am looking to extend the compatibility to Borland C applications.

Gabriel

Porting DOS games to modern platforms

Posted: Sun Dec 27, 2020 2:42 pm
by MrFlibble
Hi, and welcome to the forums! I fixed the YT link for you.

Did I understand correctly that your tool can work with multiple different games?

I know of several successful projects that rebuilt the code of DOS games from disassembled binaries: OpenDUNE, OpenFodder, SDLPoP, Omnispeak to name a few. But I believe each of them required some meticulous work with the disassembled code and could not become a base for putting more games through the same process (save for the manual skills acquired by the respective authors that is).

You might also find this topic of interest:
https://www.dosgames.com/forum/viewtopic.php?t=27053

Porting DOS games to modern platforms

Posted: Mon Jan 11, 2021 8:46 am
by gabonator
Yes, exactly like that. The idea behind this project is to have a tool which can be used on any DOS application. But from my research (tested about 10 games), not every game can be ported easily. Currently it supports apps written in raw assembly and it highly depends on how the game was programmed - if the author uses some tricks for the program flow extensively (indirect calls) or some flags related operations, a lot od manual fixing is required. Star goose is very nicely written and whole application can be converted into working form almost automatically. Currently I am trying to finetune the process for a set of chosen games, write tutorial how to use these tools and then extend the support to Borland Pascal and Borland C applications.

Thank you for the links, porting commander keen was on my todo list :)

Porting DOS games to modern platforms

Posted: Tue Jan 12, 2021 9:04 am
by MrFlibble
That's some very nice project, please keep us updated and good luck!

Porting DOS games to modern platforms

Posted: Wed Jan 20, 2021 7:39 am
by gabonator
Yes, but there are some requirements though, the game binary cannot be packed or protected. In those old days there were various tricks to protect the games from copying and the hacker groups either produced "vigrin" binary of the game, or they made resident app that cracks the game during execution. Some games used even more crazy methods to protect (e.g. Storm lord which decodes just the instruction that are being executed and then encodes them back). So if there are some guys who had experience in cracking of ancient games, I would appreciate their help with finding or producing unprotected binaries (storm lord, titus the fox, arkanoid2).

The tool produces C++ code from assembly, but it requires some light skills with IDA - sometimes the disassembler does not identify all parts of the code. Especially when the game jumps to some memory location through indirect call or indirect jump. So it takes few iterations:
- unpack executable (if applicable)
- extract data segment (or whole binary blob from exe)
- ida disassembly
- cicoparser conversion asm to c++
- create host application which loads the data segment and handles dos/bios/video/input/filesystem stuff (I usually recycle it from previous project and add missing parts)
- run the app, fix parts of code where cicoparcer left marks (it will stop execution when it hits the mark and you will need to fix it, if using visual studio with edit&continue feature, it is really quick task)
- implement missing dos/other calls
- identify missing parts of code during execution of the freshly made app (indirect calls)
- ida - mark missing parts as code and generate assembly again
- convert
- build & test
- repeat if necessary

But the best part of this is - you can alter the game in any way - you have everything in control. For example I ported CDMAN to wasm, so it can run in web browser. And to provide mouse/touch support, I made small extension which handles touches and calculates shortest distance for the pacman to reach the destination.

https://rawgit.valky.eu/gabonator/Proje ... index.html

and here is source code for those who would like to see more:
https://github.com/gabonator/Projects/t ... man/source

Porting DOS games to modern platforms

Posted: Sat Jan 30, 2021 2:48 pm
by Frenkel
gabonator wrote: So if there are some guys who had experience in cracking of ancient games, I would appreciate their help with finding or producing unprotected binaries (storm lord, titus the fox, arkanoid2).
For Titus the Fox, you could try http://ttf.mine.nu/

Porting DOS games to modern platforms

Posted: Wed Feb 03, 2021 6:49 pm
by gabonator
I have partially ported another game - this time I have used C++ to javascript converter instead of C++ compiled into WASM. Still has some issues, but playable:

Rick Dangerous 2
https://l.valky.eu/dosrick2

Porting DOS games to modern platforms

Posted: Mon Feb 08, 2021 3:49 pm
by MrFlibble
If you haven't already, maybe it'd be a good idea to post your results at VOGONS.

Porting DOS games to modern platforms

Posted: Wed Mar 03, 2021 4:30 pm
by gabonator
Thank you for suggestion, I posted it there as well. Just for update, here is Xenon2 ported to javascript (just first level):

http://x.valky.eu/xenon2js

Porting DOS games to modern platforms

Posted: Thu Mar 04, 2021 7:51 am
by MrFlibble
Nice progress!

Porting DOS games to modern platforms

Posted: Sat Mar 20, 2021 12:03 pm
by Frenkel
Frenkel wrote:
gabonator wrote: So if there are some guys who had experience in cracking of ancient games, I would appreciate their help with finding or producing unprotected binaries (storm lord, titus the fox, arkanoid2).
For Titus the Fox, you could try http://ttf.mine.nu/
And the demo version of Titus the Fox.

Porting DOS games to modern platforms

Posted: Sun Apr 18, 2021 7:57 am
by gabonator
I have finally found some time to make a demonstration video how a game can be completely rewritten into C++ in less than 25 minutes: https://www.youtube.com/watch?v=4fAeUx8A-OE

Porting DOS games to modern platforms

Posted: Sun Apr 18, 2021 10:29 am
by MrFlibble
Hey, that's very cool, thanks for sharing!

Previously you mentioned that some games lend themselves to this kind of reverse-engineering better than others, depending on the way they were coded. Can you give any more guidelines as to which games would have a higher probability of successful reverse-engineering with minimal user input? I guess that stuff like Doom or Daggerfall would not be easy (we don't need to reverse-engineer Doom, I'm just naming it as an example).