As the years show, we have practically no chance to see the original source code - or at least a remake - of the first part of Diablo (
The Darkening of Tristram event in
Diablo III in honor of the 20th anniversary of the first part) is, of course, good, but still a bit not what the fans expected). And let the latest update for the game came out in 2001, and Blizzard itself has long ceased to support and sell it - the memory of it still remains alive in our hearts. That once again was confirmed by a certain GalaXyHaXz who decided to perform reverse engineering of the game.
Source code is available
on Github . The Devilution project, which its author GalaXyHaXz dubbed the “Diablo Devolution”, took him over 1,200 hours - 4 months of work. Also do not miss the volume comments of the author, shedding light on the source code of the game, and located in
another repository . The code itself does not look good yet, but it will continue to be put in order as the work on other modules of the game progresses.
The idea of reverse engineering of such a large project at first seemed like a fantastic task, if not for one lucky chance - or, in other words, a small oversight that happened 20 years ago.
In 1998, Blizzard gave Diablo source code to two studios: Synergestic Software, which developed the Hellfire add-on, and Climax Studios, which worked on the port for the Playstation. Sony's QA department in Japan is
not the first time to “delight” with its leaks , they also distinguished themselves this time - in the Japanese version of the port,
a symbolic file was accidentally forgotten, which included functions, data, types and much more. This made it possible to restore the original functions, global variables, data structures, and so on. The beta version of the port for Playstation also leaked, and there was another similar file in it, which greatly simplified the task.
To top it off, the debugging build of the PC version of the game was always lying right on your game disks, hidden in the DIABDAT.MPQ archive -> D1221A.MPQ -> DIABLO.EXE. The build contains debugging tools that are missing from the release version, as well as a large number of asserts, which made it possible to recreate the names of files and functions — even the line numbers of the code are as close as possible to the original.
Diablo development began around the time that Windows 95 came out. Accordingly, the game was optimized for it. To compile the game, Microsoft Visual C ++ 4.20 was used, which was
updated to version 5.10 in subsequent patches . In order to accurately reproduce the original code, compatibility with these versions of compilers was maintained in the project, however Makefiles for modern compilers are available. Executable binary files resulting from the compilation work according to reports on Windows 7, Linux-WINE and Windows 10.
The notorious fact that the game has changed dramatically over the course of the project, and many ideas were cut out of it right before the release - and multiplayer was added in haste.
Many creators of modifications for the game (for example, the authors of The Hell mod)
have already gone quite far in their research on code research, including using the process memory; however, they did not publish the results of their work, and many of these mods were abandoned halfway. If Devilution can be brought to a certain degree of readiness, this problem can be avoided - plus learn something new about the game itself.
At the moment, reverse engineering Diablo.exe has been performed. There are still a few libraries left to tackle: Battle.snp (outdated Battle.Net protocol), DiabloUI.dll (main game menu code, entirely tied to Windows and poorly written), Standard.snp (local multiplayer code, outdated, similar to in Starcraft) and a couple more modules.
Theoretically, in the near future (after reversing
DiabloUI.dll ), the game can become cross-platform - unless, of course, Blizzard does not hasten to cover the shop before the author can attract enough enthusiasts to solve this task.
PS But what about Diablo II is not so clear: the game continues to be sold and maintained by Blizzard, the amount of its code base is about 8 times more than the original, and there are rumors that the official remaster is not far off - therefore its full reverse engineering in the foreseeable future does not have to wait.