Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Contributing

IAmTrial edited this page Jan 5, 2018 · 7 revisions

When the first tool, SlashDiablo HD, was in development, it relied heavily on Visual Studio 2013 and its runtime. There is currently an attempt to shift the codebase to utilizing the free alternative MinGW in order to allow editing on a wider variety of IDEs.

A first few set of simple coding rules are put in place for this project:

  • 4 spaces, no tabs
  • K&R indentation
  • Intel x86 syntax (Cheat Engine and OllyDbg use this format)
    • Do NOT use or mix in AT&T syntax.
    • .intel_syntax must appear at the start of .S files.
    • Everything is in lowercase, except where required.
  • Use C as little as possible and use C++ wherever you can. Convert char[] to std::string if the char[] version is not required and conversion isn't unnecessary.
  • Use Windows API types when calling Windows functions. Try to convert the return value to their C/C++ equivalents if there is a return value.
    • Explicitly use the Unicode "W" variants of Windows functions. Do not rely on Unicode define and do not use TCHAR.

Other rules are implied in the code, but I will add more if necessary.

Compiler

The primary compiler to use is MinGW-w64_i686. This is not to be confused with the original MinGW project. The second compiler to take into consideration is Microsoft Visual C++ 2013, though compatibility with Microsoft's compiler is not a primary issue. The reason for preference of MinGW-w64 is because it is a free as in freedom compiler. It can also solve the issue of dependencies by packing dependencies with individual tools.

The main reason for using MinGW-w64 instead of MinGW is because the maintainers of the project have neglected to fix std::to_wstring compilation errors.

Another reason is that MinGW-w64 is consistently implementing the latest release of GCC 7.2 in its rolling release. In GCC 8, which is currently in stage 3 development, __attribute__((naked)) will allow for similar syntax to Visual C++ 2013's __declspec(naked), which can reduce the need for .S files and can improve readability for most Diablo II modders.

Compiler Settings

In order to ensure that the code can compile on your machine without having dependencies, here are a list of things you will need to do:

  • Add "-std=c++11" (this isn't a legacy project, so start with the newest standard as of writing)
  • Add "-l Version" to libraries

You must also compile with "-Wall" to resolve warnings explicitly. Do not expect your code to be accepted if it compiles with warnings.

Clone this wiki locally