Reimplementation of the Diablo2 game coupled with patching facilities for modders.

Related tags

Game D2MOO
Overview

D2MOO - Diablo II Method and Ordinal Overhaul

Cow

This project is a re-implementation of the Diablo2 game coupled with patching facilities for modders. The aim is to provide the modding community with an easy tool to understand and patch the game. To ensure that we stay as close as possible to the original game, we do not provide fixes for bugs (yet).

The game assets, main executable code and anything related to hacking or piracy is NOT endorsed by the authors, and as such we will not provide code related to such subjects. The original game assets and binaries is required to use this project.

How to build

Dependencies

For the patching we rely on the D2.Detours project, which is included as a git submodule. (use the git submodule update --init command, or clone this project with git clone --recursive) You will also need to install the CMake build system and Visual C++ (or any C++ compiler that can generate .DLLs on Windows) which are freely available.

Build the project

In the current directory:

# Configure the CMake project
cmake -A Win32 -B build
# Build the release config
cmake --build build --config Release
# Install
cmake --install build --config Release --prefix YOUR_INSTALL_FOLDER

Usage

  • Build D2MOO
  • Launch Diablo2 (or D2SE) by using the command D2.DetoursLauncher [Path to D2 or D2SE].
    • If the Game.exe/D2SE.exe executable is not provided, you can start it from the game folder. It can also detect the installation path.
    • The detours .dll expects patch dlls to be in patch folder of the Diablo2/D2SE executable. This can be overriden using the DIABLO2_PATCH environment variable.

The debug targets are already configured and set as startup project when using Visual Studio.

Versions

The project is currently based on the 1.10f version of the game. Feel free to submit patches for other versions of the game!

FAQ

Why is the code so ugly and with names such as a1, a2, ... ?

The code was originally extracted by a reverse engineering tool, and slowly cleaned to use understandable names

Can I build D2Common.dll and replace it directly with the one from the game ?

Not yet, but this is one of the objectives ! We are in the (slow) process of checking each ordinal (exported functions) and patching them one by one. See D2Common.patch.cpp for the current status of each ordinal.

Why is there only D2Common.dll ?

Because it contains a lot of functions that are used in both, client and server code, and as such, it serves as a solid base for further work.
We might add other DLLs in the future if there is enough interest / help from the community. Any contributions are welcome.

How can I write my own mod using this ?

The documentation for that is not written yet, please contact us directly on the Phrozen Keep forums / Discord server. More importantly, we need your feedback to determine a roadmap.

Why yet another project for D2 modding and code editing ?

We felt that the current projects are not good enough, and more importantly did not cover enough parts of the game. Having a centralized code that one can launch and use as reference will make it easier, we hope, for the modding community.

I have other questions !

Please feel free to open an issue or visit the Phrozen Keep forums / Discord server !

Credits

This could not have been done without the amazing help and work of the Phrozen Keep community! Non-exhaustive list of members who helped putting this together (alphabetical order):

  • @FearedBliss
  • @Firehawk
  • @Kingpin
  • @Lectem
  • @lolet
  • @Mentor
  • @misiek1294
  • @Mnw1995
  • @Myhrginoc
  • @Necrolis
  • @Nefarius
  • @Ogodei
  • Paul Siramy
  • @raler (that sparked the idea for the current name of the project)
  • @SVR
  • @Szumigajowy
  • @whist
  • ...

If you think you should be on this list, reach us on the forum, discord, or open a pull request!

Legal

The source code in this repository is intended for non-commercial use only. However it uses a permissive license so that any modder may use this. Credits to the team are appreciated, and the license must be preserved in derivative work.

Battle.net(R) - Copyright (C) 1996 Blizzard Entertainment, Inc. All rights reserved. Battle.net and Blizzard Entertainment are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.

Diablo(R) - Copyright (C) 1996 Blizzard Entertainment, Inc. All rights reserved. Diablo and Blizzard Entertainment are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.

D2MOO and any of its' maintainers are in no way associated with or endorsed by Blizzard Entertainment(R).

Comments
  • Add Unicode struct type

    Add Unicode struct type

    This adds a basic reimplementation of the Unicode struct with its constructors and unsigned short conversion operator. Other functions are significantly large and will be added in later pull requests.

    I can confirm that the functions, with the exception with the default constructor closure, are generated with the exact same code in Visual C++ 6.0. In VS 2019, The default constructor closure does not generate unless the Unicode::Unicode(unsigned short) constructor is declared with __declspec(dllexport). In addition, the default constructor closure generates the exact same code if the same constructor is also declared inline.

    Otherwise, the code behaves exactly the same as vanilla Diablo II.

    opened by IAmTrial 4
  • News

    News

    D2Common.0x6FDB64A0 and LoadItemStatCost Now they seem to work properly, however the STATLIST_InsertStatModOrFail_6FDB7690 and D2Common.0x6FDB5830 functions are not working properly.

    STATLIST_InsertStatModOrFail_6FDB7690 it's wrong in some ISC, example: Cold Skill Damage % D2Common.0x6FDB5830 it has a problem with the Auras. The auras of nearby friendly units do not share it with other friendly units (disabling it works perfectly).

    opened by Araksson 4
  • Add D2Lang Unicode::strlen

    Add D2Lang Unicode::strlen

    These changes add the Unicode::strlen function. The function behaves similar to what is expected for a strlen function, with one notable exception. If the supplied string pointer is NULL, then the function returns 0.

    When the function is compiled with Visual C++ 6.0, the binary is the same as 1.10f.

    opened by IAmTrial 3
  • Add D2Lang CRC-16 Calculate Checksum function

    Add D2Lang CRC-16 Calculate Checksum function

    This adds a reimplementation of the CRC-16 calculate checksum function, D2Lang.Ordinal10005. The lookup table is replicated 100%, and each of the 4x4 matrix sets are described in comments. My own quickly written tests external to this repository confirms that the function outputs the exact same checksum as the vanilla 1.10f D2Lang.dll, when fed the same input.

    opened by IAmTrial 3
  • Refactor D2Common ordinal 10515 for easier flow

    Refactor D2Common ordinal 10515 for easier flow

    These changes simplify ordinal 10515 for better readability.

    For documentation reference: This function appears to be a free/dealloc function for D2UnitStrc starting from a StatList marked STATLIST_TEMPONLY.

    documentation 
    opened by IAmTrial 2
  • Function (D2Common_STATES_ToggleState_6FDB8900) Not Working

    Function (D2Common_STATES_ToggleState_6FDB8900) Not Working

    • i tested the function it doesnt work and you error 2 is gdwBitMasks[nState % 32] -> gdwBitMasks[nState % 31]

    bool bStateMaskDisguise = pStatesTxtRecord->dwStateFlags & gdwBitMasks[STATEMASK_DISGUISE]; Fix bool bStateMaskNoSend = pStatesTxtRecord->dwStateFlags & gdwBitMasks[STATEMASK_NOSEND];

    • i fixed the code my way and it works Link
    opened by raumuongluoc 2
  • I checked the latest changes with StatList, I have bad news

    I checked the latest changes with StatList, I have bad news

    The errors remain exactly the same.

    This was added that LoadItemStatCost does not read the OPs 0/8/9/10/11 that correspond to the same OPs that fail with the STATLIST_UpdateUnitNewStat function and STATLIST_InsertStatModOrFail

    (As a side note, LoadISC from the pre-bulk changes version worked fine (it's the one I'm using))

    Sorry for my slowness, I still haven't finished rearranging all my code, it's very long and I didn't check even half of the D2Moo functions (corresponding to ItemsFunctions, DRLG, Path and Missiles). The good news is that I have made several fixes to the Path and Skills functions to make them work much better (and in some cases, to work directly).

    And with Statlist I can't fix those errors.

    I also don't have enough time to repair all the maximum details, but I would like to get it since it is very useful to handle all the statlists to try to expand them a bit with some custom code (in addition to expanding the ISC OPs which are also very useful)

    opened by Araksson 2
  • Add D2Lang.Unicode::toUtf

    Add D2Lang.Unicode::toUtf

    These changes add the D2Lang.Unicode::toUtf function. The function converts a null-terminated string of USC-2 encoded characters into a null-terminated UTF-8 string.

    Vanilla bugs are documented and workarounds are documented.

    My own testing confirms that the function works similarly to its vanilla counterpart. The file scoped sgUtf8ConvertTable is confirmed to be the exact same structure when the default pragma pack is used. Pragma pack is used due to an error during the compilation process, but can be ignored using pragma pack, because the variable is not exported outside the file scope.

    opened by IAmTrial 1
  • UNITS_GetFrameBonus & D2COMMON_11013_ConvertMode - Synchronization issues

    UNITS_GetFrameBonus & D2COMMON_11013_ConvertMode - Synchronization issues

    //D2Common.0x6FDC0FC0 (#10436) int __stdcall UNITS_GetFrameBonus(D2UnitStrc* pUnit)

    This feature has timing issues in "hth" mode when the character dies.

    Verified with Sorceress.

    The head of the Sorceress goes "crazy" and does not show the proper location as she walks after dying.

    Possibly it is related to an internal function, I have not verified exactly which one, although my suspicions point to this other:

    //D2Common.0x6FDB30A0 (#11013) void __stdcall D2COMMON_11013_ConvertMode(D2UnitStrc* pUnit, int* pType, int* pClass, int* pMode, char* szFile, int nLine)

    opened by Araksson 1
  • DRLGPRESET_ParseDS1File does not control MonPresetId properly

    DRLGPRESET_ParseDS1File does not control MonPresetId properly

    From Conqueror on the PK discord:

    There are more bugs I discovered in 3 DRLG functions //D2Common.0x6FD85A10 DRLGPRESET_ParseDS1File Doesn't control MonPreset ID properly The Objects I rewrote it completely to implement Extended Object in my Mod, this works fine, still adding more than 150 objects per act. So for this part the function is perfect. In MonPresets the error is that it does not correctly calculate the ID for SuperUniques, NPC and Champion / Unique monsters

    bug 
    opened by Lectem 1
  • [WIP] Clean headers (Move structs to the correct places)

    [WIP] Clean headers (Move structs to the correct places)

    I'm currently moving structures from the centralized headers to their own headers, which will help since we won't have everything in just a few files. This is obviously taking quite some time, hence why I open this WIP pull request.

    I'm also taking the opportunity to change int => int32_t, short => int16_t.

    opened by Lectem 1
  • Rename Fog.dll functions according to names from D2CMPd.dll

    Rename Fog.dll functions according to names from D2CMPd.dll

    Current names for fog functions are not good (especially memory allocations functions are named with client/server, instead of D2Alloc(Pool). (Fog.#10042 and and Fog.#10045)

    image

    enhancement good first issue 
    opened by Lectem 0
  • Clarify how to integrate D2Moo for modders

    Clarify how to integrate D2Moo for modders

    Right now I did not choose the way we want to support mods for the D2Moo integration. In the long term, I think the best option is to use a fork of D2Moo, but it's not necessarily simple to migrate from an existing mod (for example using D2Template) as you would have 2 different patching methods.

    In my opinion this should be a discussion with other modders / community, so I listed a few ideas, their advantages and drawbacks in the following table.

    Please give your opinion!

    | D2MOO as | Method | Integration with existing mod | Ease of update | Can share includes | Compatible with D2Template | Can easily change implementation of an ordinal | Mod redistribution | Can contribute/share easily (bugs) | Is own project bugged or is it D2Moo? | |------------|------------------------------------------------------|-------------------------------------------------|--------------------------|--------------------|----------------------------|------------------------------------------------|-------------------------------------------------------------------------------------------|------------------------------------|---------------------------------------| | subproject | Configure CMake to use your own patch files and .def | medium | easy | only unpatched | +/- | yes, but only from the original dll pov | D2Moo launcher + .dlls | yes | easy to know | | subproject | Import D2MOO .dlls and patch the functions you want | easy | easy | only unpatched | yes | yes, but only from the original dll pov | Whatever you already had | yes | easy to know | | subproject | Link D2Moo statically | medium | easy | only unpatched | yes | yes, but only from the original dll pov | Whatever you already had | yes | mostly easy to know | | fork | Fork D2Moo and work directly on it | needs some transition (start by importing dll?) | easy, might need resolve | all | +/- | yes | D2Moo launcher + .dlls (OR simply .dlls if we use forwarding DLLs for unpatched ordinals) | yes | just need to change branch | | source | Copy paste (please don't) | "easy" but leads to lot of issues | hard | copy-paste... | yes | depends on your project patching facilities | ? | no | no |

    help wanted question 
    opened by Lectem 1
  • Bugs already present in the original game

    Bugs already present in the original game

    The original game as a lot of bugs, and we need to decide what to do about it. Since D2MOO's main objective is to implement the vanilla game, we must keep the code of those bugs, and document them. We could probably still fix them, and use a macro for such code to enable/disable fixes.

    I'm adding a new Label for bugs reported that might have an impact to modders, but were already present in the original game, thus not due to D2MOO.

    Such bugs must be both labeled and reference this issue.

    bug documentation help wanted 
    opened by Lectem 0
Owner
The Phrozen Keep
Serving the Diablo II modding community since 2000
The Phrozen Keep
Open-source flog (Nintendo Switch's Golf NES easter egg) reimplementation

This repository is dedicated to flog, an easter egg present on Nintendo Switch consoles, containing various tools and information, which are the result of progressive reverse-engineering of the easter egg.

XorTroll 8 Sep 29, 2022
Free in the Dark, a Alone in the Dark engine reimplementation.

FITD Free in the Dark, a Alone in the Dark engine reimplementation. Long overdue source code update from the version that was released on source forge

null 47 Dec 20, 2022
Humongous Yaga engine reimplementation

linyaga Wrapper for Humongous Entertainment games based on the Yaga engine. Pajama Sam: Life is Rough When You Lose Your Stuff Putt-Putt: Pep's Birthd

Gregory 10 Dec 31, 2022
Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World.

OpenXRay OpenXRay is an improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World. S

null 2.2k Jan 1, 2023
Stealthy way to hijack the existing game process handle within the game launcher (currently supports Steam and Battle.net). Achieve external game process read/write with minimum footprint.

Launcher Abuser Stealthy way to hijack the existing game process handle within the game launcher (currently supports Steam and Battle.net). Achieve ex

Ricardo Nacif 80 Nov 25, 2022
Game Boy, Game Boy Color, and Game Boy Advanced Emulator

SkyEmu SkyEmu is low level cycle accurate GameBoy, GameBoy Color and Game Boy Advance emulator that I have been developing in my spare time. Its prima

Sky 321 Jan 4, 2023
A cycle-accurate Game Boy and Game Boy Color Emulator, with rewind feature.

Azayaka is a free and open-source Game Boy and Game Boy Color emulator written in C++. Features Cycle-Accurate emulation. Console based Debugg

Zach Collins 23 Dec 3, 2022
The Game Boy ROM of the Game Boy bitcoin miner!

game-boy-bitcoin-miner The Game Boy ROM of the Game Boy bitcoin miner! To build this, currently this patch needs to be applied to GBDK: https://gist.g

Ghidra Ninja 80 Dec 11, 2022
CLUSEK-RT is a complex game engine written in C++ and the successor of the CLUSEK game engine

CLUSEK-RT is a complex game engine written in C++ and the successor of the CLUSEK game engine. This engine has been designed with a cross-platform design in mind. Thanks to Vulkan API it delivers a next-gen experience with ray tracing to both Linux and Windows platforms

Jakub Biliński 48 Dec 29, 2022
Ground Engine is an easy to use Game Engine for 3D Game Development written in C++

Ground Engine is an easy to use Game Engine Framework for 3D Game Development written in C++. It's currently under development and its creation will b

 PardCode 61 Dec 14, 2022
Minetest is an open source voxel game engine with easy modding and game creation

Minetest is an open source voxel game engine with easy modding and game creation

Minetest 8.3k Dec 29, 2022
A game made for the Game (Engineless) Jam using Raylib

Fastest Pizza Delivery A fun little 3D game made for the Game (Engineless) Jam. It is still is development but the basic gameplay is something l

Ryuzaki 2 Apr 3, 2022
SameBoy DX is a Qt-based interface of SameBoy, a free, highly accurate Game Boy and Game Boy Color emulator.

SameBoy DX SameBoy DX is a Qt-based interface of SameBoy, a free, highly accurate Game Boy and Game Boy Color emulator. Build requirements: CMake Pyth

Snowy 7 Oct 2, 2022
To recreate the board game Scotland yard and enable a single player to play the game by letting one of the roles being played by the computer based on written algorithm

Scotland Yard GAME OF SCOTLAND YARD This is a custom version of the classic board game, Scotland Yard .The game uses the London map used in the origin

Brshank 2 Nov 11, 2021
Ncurses based omok game, execute omok game in your terminal

omok_game execute omok game in your terminal Omok game played by two people. 한국어 버전(korean version)

SunjungAn 1 Dec 3, 2022
Slender Man Returns is a game inspired by the original indie game Slender

Slender Man Returns is a game inspired by the original indie game Slender: The Eight Pages, but redesigned to run on the popular Unity game engine. Ported to PSVita. Original project by Rosario Terranova.

null 8 Jul 5, 2022
A Game Boy game that rewards you for playing it on several console models!

GB Corp. A Game Boy game for the Game Boy Competition 2021 by Dr. Ludos (2021) This is the source code, you can get a precompiled rom from here: https

Dr. Ludos 10 Sep 25, 2022
GB Studio is a quick and easy to use retro adventure game creator for Game Boy available for Mac, Linux and Windows

GB Studio is a quick and easy to use retro adventure game creator for Game Boy available for Mac, Linux and Windows

Chris Maltby 6.8k Jan 8, 2023
A high speed C++17 Vulkan game engine

Acid is an open-source, cross-platform game engine written in modern C++17 and structured to be fast, simple, and extremely modular. Vulkan is the sol

Equilibrium Games 1.4k Dec 30, 2022