aboutsummaryrefslogtreecommitdiff
path: root/STANDARDS.md
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2024-09-20 14:24:56 +0200
committerGitHub <noreply@github.com>2024-09-20 14:24:56 +0200
commita4b09bc42d5f79ef86697c893efc9e3b7d966502 (patch)
treed4c7b2b8cc04361ddf7b9c942e5f9462bb55e0b9 /STANDARDS.md
parenta9d2ce8a692f7890f4e4bfc21458332890605a5f (diff)
parent6737a344c012c0f7fd19cd593949dd3dbe5a0cb7 (diff)
downloadNorthstarLauncher-a4b09bc42d5f79ef86697c893efc9e3b7d966502.tar.gz
NorthstarLauncher-a4b09bc42d5f79ef86697c893efc9e3b7d966502.zip
Merge branch 'main' into feat/overhaul-mod-loading-locations
Diffstat (limited to 'STANDARDS.md')
-rw-r--r--STANDARDS.md53
1 files changed, 53 insertions, 0 deletions
diff --git a/STANDARDS.md b/STANDARDS.md
new file mode 100644
index 00000000..89d36523
--- /dev/null
+++ b/STANDARDS.md
@@ -0,0 +1,53 @@
+# Code standards
+
+There are exceptions, ask for them!
+
+### Preamble
+
+You are more than welcome to reformat any existing files using these rules should they fail to match them but please SPLIT your formatting changes from the rest by making a separate PR!
+
+### General rules
+
+> Basic rules that apply all the time.
+
+Always assert your assumptions!
+
+Use PascalCase for all names.
+
+Suffix structs with `_t`.
+
+Prefix classes with `C` (class) and `I` (abstract class).
+
+Prefix all class member variables with `m_`.
+
+Prefixes `g_` for global variables and `s_` for static variables are welcome.
+
+For hooking we use `o_<function name>` for function pointers pointing to the original implementation and `h_<function name>` for functions we replace them with.
+
+Document all function implementations and their arguments (if the argument is self explanatory you don't need to document it) valve style:
+```
+//-----------------------------------------------------------------------------
+// Purpose: MH_MakeHook wrapper
+// Input : *ppOriginal - Original function being detoured
+// pDetour - Detour function
+// Output : true on success, false otherwise
+//-----------------------------------------------------------------------------
+```
+
+Don't overcomment your code unless nescessary, expect the reader to have limited knowledge.
+
+Use `FIXME` comments for possible improvements/issues, `NOTE` for important information one might want to look into.
+
+### Valve source files
+
+> Rules that apply to all files from original valve code base.
+
+When adding or just modifying a file that's present in valve source place it where valve put it.
+
+Always use hungarian notation in these files.
+
+### New files
+
+> Rules that apply to Respawn or our own files.
+
+When adding new files follow the general rules, you don't have to use hungarian notation. Put the file where you think it makes the most sense.