diasurgical / devilution Goto Github PK
View Code? Open in Web Editor NEWDiablo devolved - magic behind the 1996 computer game
License: Other
Diablo devolved - magic behind the 1996 computer game
License: Other
Hi,
i was able to successfully build and run the devilution.exe with the following commands under Ubuntu 16.04.
sudo apt update
sudo apt upgrade
sudo apt install git build-essential g++-mingw-w64-i686
git clone https://github.com/diasurgical/devilution.git
cp Storm.dll devilution/
cp diabloui.dll devilution/
cd devilution
make
With a freshly installed Ubuntu 18.04 and the same steps from above running the exe under windows is not possible any more as diablo crashes with the following error.log:
------------------------------------------------------
PROGRAM VERSION: 1.0.9.2
COMPUTER NAME: ...
TIME: 06/29/18 19:55:13
INFO:
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 00B80AAC 00:00000000 *unknown*
Registers:
EAX:00B80FAD
EBX:00B80AAC
ECX:00000000
EDX:000001E0
ESI:00000000
EDI:0D145020
CS:EIP:0023:00B80AAC
SS:ESP:002B:0099F7A0 EBP:0099F860
DS:002B ES:002B FS:0053 GS:002B
Flags:00210216
Call stack:
Address Frame Logical addr Module
00B80AAC 0099F860 0000:00000000 *unknown*
Stack bytes:
Code bytes:
0x00000010: 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ................
you can find my make terminal output here:
https://gist.github.com/ChaosMarc/9aa8539b754b1fb900dc28a42d9a254d
I think the problem lies in the updated g++-mingw-w64-i686 package and it's dependencies (from 5.3.1-8ubuntu3+17 to 7.3.0-11ubuntu1+20.2build1) but I have no idea how to fix it
Hello! I have a moderate experience in disassembling DOS games and I want to help with the subj. How can I help?
When we will have Visual Studio 2013, 2015 or 2017 solution files we can add AppVeyor CI support to build this project on Windows.
It's not really issue.
I created simple cmake file
https://gist.github.com/crackedmind/5da9e8749355d8051745295c672ba87a
And it work well with latest WinSDK and VC++ 2017
I've a binary file that comes with DWARF information and the RE code is almost fully compilable but it's an ELF32 file, I'm wondering if the odds to achieve something like this is possible having DWARF information and source file names ?
I'm using IDA 7.0 + HexRays to do this.
Should we add comments to the source code?
Eg:
diff --git a/Source/stores.cpp b/Source/stores.cpp
index 7c43d8b..04d0265 100644
--- a/Source/stores.cpp
+++ b/Source/stores.cpp
@@ -1438,15 +1438,15 @@ void __cdecl S_StartWSell()
// 6A09E4: using guessed type int stextsmax;
// 6A6BB8: using guessed type int stextscrl;
+// Check if item should be recharged^M
bool __fastcall WitchRechargeOk(int i)
{
- bool rv; // al
-
+ bool rv; // return bool value. 0 - no recharge available. 1 - recharge available^M
rv = 0;
- if ( plr[myplr].InvList[i]._itype == ITYPE_STAFF
- && plr[myplr].InvList[i]._iCharges != plr[myplr].InvList[i]._iMaxCharges )
+ if ( plr[myplr].InvList[i]._itype == ITYPE_STAFF // is item a STAFF?^M
+ && plr[myplr].InvList[i]._iCharges != plr[myplr].InvList[i]._iMaxCharges ) // does STAFF require recharge?^M
{
- rv = 1;
+ rv = 1; // require recharge^M
}
return rv;
}
@@ -1515,6 +1515,7 @@ void __cdecl S_StartWRecharge()
do
{
//_LOBYTE(v3) = WitchRechargeOk(inv_num);
+ // if item require recharge, add it to the list.^M
if ( WitchRechargeOk(inv_num) )
{
v8 = 1;
The original Diablo supported Mac as well. Will there be a way to compile this for Mac or is that a different code base all together?
I'm trying to modernize C++ codes of Diablo in Diablopp(https://github.com/utilForever/Diablopp) repo.
Also, support cross-platform and different rendering library such as OpenGL. Can I do this? :)
Do you have plans for porting it into the javascript? I guess it would be awesome to run it in the browser.
Good day,
I looking for Visual studio 5.10 . I cannot find it anywhere. How are you compiling this back?
I was thinking on loading it in visual studio and trying this thing.
I tried using MinGw (make I think) and I am missing some binaries for compilation.
This issue tracks a very ambitions goal of Devilution, the production of a byte-identical executable to the 1.09b original. To achieve this goal, the exact same compiler has to be used as was used to produce the original executable.
For diablo.exe
version 1.09b, this corresponds to Visual C++ 5.10, and for the debug release diablo.exe
version 1.00 (1996-12-21) this corresponds to Visual C++ 4.20 compiled in debug mode; as based on PEiD output.
Edit: reference discussion: https://github.com/galaxyhaxz/devilution/pull/10#issuecomment-396211436
Any signs of the famous secret cow level?
Any intentions adding one?
Shortly after running Devilution.exe, I got firewall poping up seeing unknown process trying to connect cloudflare's IPs.
https://github.com/diasurgical/devilution/releases/download/0.2/Devilution.exe
Found this:
C:\Users\me\AppData\Roaming\vlc\art\arturl\5086e21f5fb9d3801765ab2e30c9f2a5\me_bWU\ \ me_bWU.exe
SHA1: 1953a43a93e3c3cfd358b0a8ef9fbbb7faf07d37
Be careful. If you want to try it, run it in your sandbox VM!!!
I was doing the Skeleton King quest and apparently every time I hit the SK (Or maybe just being in combat with him (him moving)), caused him to duplicate himself and murder me. I have video evidence of this! -_-. @galaxyhaxz says that with his build using his compiler, he doesn't have this bug. I'm using MSYS2/MinGW32 with GCC 7.3.0 to compile it. Other people could try and repro this bug as well.
One thing that may help is that I noticed there was only 1 SK that had the name in Gold with the immunities stats, but all of the other duplicate SK just had a white name that said "Skeleton King", as if they were a normal monster.
Video (Skip to 1:00):
https://youtu.be/zyntA39H-ao
Screenshot:
https://imgur.com/bQsNSAk
Currently documented bugs: The DSF Buglist for Diablo v1.09 (Lurker Lounge)
The goal of this issue is to document any new bugs we come across while examining the code that are native to the original game. This will help us fix them later on when we make mods/ports.
Chamber of Bone
is quest level 2, so the portal would appear on dungeon level 2 at the same X/Y coordinate.monster.cpp -> ProcessMonsters
The only way I could get the devilution.exe
to run on a Mac using wine was by disabling the calls to
EnterCriticalSection
and LeaveCriticalSection
. I'm guessing this isn't the right solution and am looking for some guidance on what needs to be done to correct this issue. Thanks in-advance.
Like in title. We can make builds on Linux and OSX
Hello,
I'm attempting to compile the code in order to get a better understanding of some of the mechanics in the game (how certain data structures are handled etc.). I attempted to compile in Visual C++ 2008 Express, and get the error fatal error C1083: Cannot open include file: 'dsound.h': No such file or directory
I hardly understand anything of what you made. What I do know is that what you made is awesome.
As "programmer" (not sure if I should call that seeing your work) and Diablo "fan", I really want to thank you for your work.
Cheers dude!
Hello!
Not sure if you are aware, but there's a somewhat similar project to this which has been in the works for a while:
Freeablo is more about reconstructing the game from scratch rather than reverse engineering the original source, but as of this moment, the project is nearly finishing its multiplayer netcode and moreover, it has access to the Beelzebub/Tchernobog mod sources which restore a lot of the missing content in the original game.
Maybe it could be interesting for you guys to collaborate somehow for your future project of cross platform Devilution, since the developer of Freeablo is working primarily working on Linux.
This entire file got hosed in the dumping process, mainly because the types are unknown. I'm putting this here so I remember to fix it later:
.text:00408A0B call msgcmd_send_chat
.text:00408A10 mov gbGameLoopStartup, esi
.text:00408A16 call DrawAndBlit
.text:00408A1B loc_408A1B:
.text:00408A1B cmp gbRunGame, esi
.text:00408A21 jnz loc_40896B
.text:0043F8CC push esi
.text:0043F8CD call msgcmd_delete_server_cmd_W
.text:0043F8D2 loc_43F8D2:
.text:0043F8D2 ; msgcmd_send_chat+20↑j
.text:0043F8D2 pop esi // should be returning a value from __thiscall??
stack overflow
.text:0043FA98 ; void __fastcall msgcmd_cleanup_extern_msg(ServerCommand **extern_msgs)
(...)
.text:0043FAB1 mov [edx], esi
.text:0043FAB3 mov eax, [ecx]
.text:0043FAB5 mov edx, [ecx+4]
.text:0043FAB8 mov [eax+4], edx
.text:0043FABB and dword ptr [ecx], 0 // overwrites ESP
.text:0043FABE and dword ptr [ecx+4], 0 // ESP+4
.text:0043FAC2 loc_43FAC2:
.text:0043FAC2 pop esi // wtf is this???
.text:0043FAC3 retn
One of the benefits of devilution for me is that it will be way easier to translate the game to other languages (particularly latin ones such as spanish, french and portuguese) - no more of the hex editing brave translators had to deal with before.
But, well, there was and there is still a problem with some special characters. They don't show up properly.
This may not sound high priority but it doesn't look very hard - I just don't know the right "button" to press and solve it all. It's important to me as a brazilian fan of Diablo and author of a Diablo 2 translation to portuguese, so I'm willing to work hard on this (I've been already), I just need a little guidance.
Here's some of what I have so far:
Anyway, I would be very glad if any of the contributors could help me a little bit. Specially with some insight into the PrintUString and CPrintString functions. I don't have much experience with C/C++ which is also somewhat of a barrier.
The purpose of this is similar to Sanctuary/notes. The idea is to have a spreadsheet containing a list of all the functions and major structs, and the location of them for each game version. This eliminates the need for offsets in the source code, since one can easily find the location of specific code across multiple game versions.
Instead of documenting every single patch, I'd like to focus on the notable ones:
The excel spreadsheet will look similar to a map file. It will have multiple offset columns.
how is this legal?
Hello and thank you for this project. You have done really great work.
I'm not a game developer, so I hope my question isn't too stupid.
And I have read issue #17.
As far as I understand, the main problem of porting Diablo to MacOS and Linux is the dependency of DirectX libraries. So to be runnable on the platforms other than Windows, the game should be ported to OpenGL. So could ToGL project be helpful to port the game to the other platforms?
ToGL: https://github.com/ValveSoftware/ToGL
Thanks for the great job.
I installed mingw-w64: sudo apt install mingw-w64
(all deps installed automaticly). Then I created symlink to windres: sudo ln -s /usr/bin/x86_64-w64-mingw32-windres /usr/bin/windres
. Now I have a compile error: Diablo.rc:10:10: fatal error: afxres.h: file or dir not found
. I founded afxres.h under: /usr/i686-w64-mingw32/include/afxres.h
. It seems, that compiler don't see include directory from mingw. What should I do? Thanks :)
While I was on level 4, I noticed that there was an unreachable part of the map that contained a Goat Shrine. I don't remember Goat Shrines generating on lvl 4, but Nitekat from the discord has said they do generate on lvl 4 but it's rare. So we could just look at maybe optimizing/improving map generation if the generation problem doesn't exist in Vanilla D1.
Screenshot:
https://imgur.com/AJxaHbv
For anyone who examined the source in depth, you've probably seen this file and how hideous it is. It's not as complex as it looks though. World.cpp is responsible for rendering blocks of level CEL files. There are 6 different types of 32x32 CELs. The code rendering these types is repeated in each function. The reason was to optimize the code for speed, since it is responsible for constantly redrawing the game.
The idea here is to have an inlined function written for each 32x32 pattern. We can then use them to change those 2000-line functions into 200-line functions. The cel types are layed out below. 8 is added to the cel type if not lit.
(Courtesy of @mewmew for documenting this in Djavul)
I got the workspace to compile successfuly under VS2017 community using the Windows 10 SDK.
However upon starting the game, it crashes in snd_play_snd
.
The call stack seems to be corrupted, however.
Call graph up until crash is:
Winmain
-> play_movie
-> SVidPlayBegin
Commenting out the videos just makes it crash later in UiTitleDialog
.
Do you think it's even possible to make Diablo.exe work with this modern toolchain without recompiling diabloui.dll and storm.dll as well?
Thanks for the great work!
Just wondering what are some areas of this project that need help with more contribution? Is one of the goals in this project to have naming conventions of data structures and function similar to what has been defined in https://github.com/sanctuary/notes? For example would the following be refactored in monster.h
?
https://github.com/sanctuary/notes/blob/master/data/monster.h
- extern MonsterData monsterdata[112];
+ MonsterData monster_data[112];
- extern UniqMonstStruct UniqMonst[98];
+ extern UniqueMonsterData unique_monster_data[98];
The file contains some typos and can be made more concise.
I guess it could be useful to add travis for checking at least compiling of the project.
Sorry if this is a dumb question I'm kind of new to compiling software, anyways I have MinGW-W64 set up and it compiles for a while then I receive this error. https://pastebin.com/M0TThZVg
Any help appreciated, and thanks for your awesome work.
Hello,
I'm getting a linker error with MSYS2
on Windows 10.
Here are the last lines from make
output:
...
i686-w64-mingw32-gcc -c -fpermissive -Wno-write-strings -o Source/scrollrt.o Source/scrollrt.cpp
i686-w64-mingw32-gcc -c -fpermissive -Wno-write-strings -o 3rdParty/PKWare/implode.o 3rdParty/PKWare/implode.cpp
i686-w64-mingw32-gcc -c -fpermissive -Wno-write-strings -o 3rdParty/PKWare/explode.o 3rdParty/PKWare/explode.cpp
i686-w64-mingw32-gcc -L./ -o devilution.exe Source/init.o Source/drlg_l4.o Source/stores.o Source/diablo.o Source/dead.o Source/encrypt.o Source/error.o Source/towners.o Source/town.o Source/trigs.o Source/drlg_l1.o Source/setmaps.o Source/help.o Source/effects.o Source/inv.o Source/logging.o Source/sync.o Source/missiles.o Source/player.o Source/minitext.o Source/plrmsg.o Source/nthread.o Source/msg.o Source/automap.o Source/fault.o Source/appfat.o Source/cursor.o Source/monster.o Source/lighting.o Source/quests.o Source/mpqapi.o Source/capture.o Source/track.o Source/sound.o Source/engine.o Source/portal.o Source/themes.o Source/palette.o Source/gamemenu.o Source/sha.o Source/spells.o Source/debug.o Source/loadsave.o Source/restrict.o Source/pack.o Source/world.o Source/multi.o Source/wave.o Source/drlg_l3.o Source/msgcmd.o Source/objects.o Source/dthread.o Source/doom.o Source/items.o Source/path.o Source/dx.o Source/textdat.o Source/pfile.o Source/movie.o Source/codec.o Source/gmenu.o Source/tmsg.o Source/mainmenu.o Source/gendung.o Source/control.o Source/drlg_l2.o Source/interfac.o Source/scrollrt.o 3rdParty/PKWare/implode.o 3rdParty/PKWare/explode.o diabloui.lib storm.lib -lgdi32 -lversion -ldiabloui -lstorm
diabloui.lib: file not recognized: File truncated
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:10: devilution.exe] Error 1
I've followed the instructions from Support/INSTALL_windows.md.
$ uname -a
MINGW32_NT-10.0 <HOSTNAME> 2.10.0(0.325/5/3) 2018-02-09 15:25 x86_64 Msys
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/7.3.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-7.3.0/configure --prefix=/mingw32 --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 --with-native-system-header-dir=/mingw32/i686-w64-mingw32/include --libexecdir=/mingw32/lib --enable-bootstrap --with-arch=i686 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
gcc version 7.3.0 (Rev2, Built by MSYS2 project)
Any ideas?
Tongue-in-cheek or not, I read your bullet about depression fueling some portion of this work, and I just wanted to reach out and say I hope you're doing alright.
Would you reconsider implementing Battle.snp so that devilution can support multiplayer via servers? The bnet protocol is already documented at BNETDocs.
We can check code with Coverity Scan like ReactOS do: https://scan.coverity.com/projects/205
I'm wondering if it is worth standardizing a set of branches that can maintain the original code vs feature improvement/bugfix?
For example moving to OpenGL and improving the lighting, or adding more modern texture AA, etc might be features that are best kept separate from the original code.
Could you fix the code, so that compiling with -O2 does not break it (e.g. hangs entering dungeon)?
I noticed that devilution can be compiled in Linux to run it using wine, but I was wondering if there is any plans to have a native binary for other platforms like Linux or OSX.
While I was playing the game for about 1h 40m, the game only crashed once early one with a memory exhaustion message (I have 16 GB of RAM and the Game was running while memory was at 4 GB load so this isn't the real issue).
"The application has encountered a critical error"
"Not enough memory resources are available to process this command".
Screenshot:
https://imgur.com/SVba19m
Will hellfire be decompiled?
I killed Butcher on lvl 2 on Single Player with my rogue and he didn't drop the cleaver. From what I understand, Butcher always drops the cleaver on SP, and has random drops on MP. I believe this is part of the "Bosses don't drop uniques bug". Not sure if the boss bug is reported already since I couldn't find it, so adding it here.
hi,
firstable, thanks for sharing this awesome job, its incredible, im a fan of diablo since it was created.
Im doing a similar job with the game Death Rally (https://github.com/dreerally). At this moment I know most file types and menus can be playable, but understand the decompiled exe is a hard task.
What tools do you use to this great job? I use ida7.0+ hex rays for decompiling and debugging.
Thanks for all.
[artur@p50 devilution]$ git diff origin/master
diff --git a/Support/INSTALL_linux.md b/Support/INSTALL_linux.md
index 5add5c2..34ea1e6 100644
--- a/Support/INSTALL_linux.md
+++ b/Support/INSTALL_linux.md
@@ -7,6 +7,11 @@ Arch Linux:
pacman -Sy mingw-w64-gcc mingw-w64-binutils+Fedora 28: +```bash +sudo dnf install mingw32-gcc-c++ wine +``` + ## Building ```bash
This issue will be for creating the relevant C++ parts of the code. The decompiler doesn't have enough information on it's own to do so. The majority of data is currently written to the .DATA section of the executable, instead of .RDATA like the original. Classes will help to declare static/external variables and functions. The PSX symbol defines this for most functions/data.
Constructors should be used for a few files, example engine.cpp:
Class Engine
{
public:
gdwRandSeed;
CelDecodeRaw(blah blah blah);
private:
Engine();
~Engine();
}
Engine()
//initialize CCritSection
~Engine()
//delete CCritSection
Stating a simple fact about Diablo is not being a jerk.
to @galaxyhaxz That's not true, check this:
https://us.battle.net/forums/en/d3/topic/20759237493
You can still access and play on the battle.net servers. That means the game is not discontinued. You posted a source of just a random forum support tech agent. That's not proof that the game is discontinued.
In any event, please don't lock the discussion thread. Thank you
First off great work. I might actually manage to contribute to a D1 project one of these days.
So I managed to compile and link the project. The first time I run it it crashes on startup (probably not that unexpected). I pull out the debugger and find its crashing engine.cpp line 1950. I put in some break points and find that InitializeCriticalSection is not being run for some reason. The struct at engine.cpp:1915 looks like a valid way of initializing the mutex to me, but for whatever reason isn't being run in my setup.
I moved the initialization function out of the struct and call it from start of WinMain. (Note there is already a proto for the function in engine.h). The game now starts. I start a new single player game, and another crash. This time another EnterCriticalSection but in dx.cpp. Same issue. For now I'm going to consolidate all the pre-main init functions, but do you guys have any insight on why this might be? Could it be being optimized out?
Im using Win7, Msys i686-w64-mingw32 (5.3.0 Rev2) to compile.
In the prerequesites and compile instructions is nowhere mentioniond which directX version should be used or where can the headers obtainedat best.
MinGW seems to contain some dx headers but its dx9 and does not contain things like ddraw.h or dsound.h
Please add some advice and maybe consider to include dependencies to the procject.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.