-
Notifications
You must be signed in to change notification settings - Fork 12
Contributing
The first iteration of SlashDiablo HD relied heavily on Visual Studio 2013 and its runtime. This meant that the code could only be compiled by the Visual Studio C++ compiler and could not be compiled natively on Linux. To prevent this dependency from occurring again, all future projects will follow the following rules.
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.
- If possible, try to use std::string_view where there is char[].
- If the value must be stored, then it convert it to std::string.
- Use Windows API types for number related values when calling Windows functions. You must convert the return value to their standard C/C++ equivalents if there is a return value.
- For character types, however, you must use standard C/C++ types.
- 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.
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++, 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.
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++1z" (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.