summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2026-08-23 14:29:44 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2026-08-23 14:29:44 -0400
commit4caa5d8fc4bb0ee015d6d76102ca4e3cf86bc63e (patch)
tree8328c5b9b166b4ace24c50331d6595d631bd4c83
parent85047b9356f0957d83cedccc3e9314921f1cf89a (diff)
Add CONTRIBUTING.md, update coding guidelines
-rw-r--r--CONTRIBUTING.md5
-rw-r--r--README.md2
-rw-r--r--docs/coding_guidelines.md26
-rw-r--r--docs/decompiling.md4
4 files changed, 29 insertions, 8 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..6cc0080c
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,5 @@
+# Contributing
+
+Anyone can open a pull request, but please be aware that we do not accept contributions that are primarily AI-generated or directly copy-pasted from Ghidra. Your PR will be closed if it contains obvious signs of machine-generated code. It is your responsibility to check the code that you are submitting and make sure it is readable and feels like something a human programmer would write. Refer to the [coding guidelines page](coding_guidelines.md) for more information.
+
+Check the [readme](/README.md) for details on how to get the repository set up, and the [decompiling guide](/docs/decompiling.md) for an explanation of the process of decompiling itself.
diff --git a/README.md b/README.md
index c2c93ea2..8dcc9502 100644
--- a/README.md
+++ b/README.md
@@ -121,3 +121,5 @@ Contributing
=======
If you've got all the requirements set up and want to learn how to contribute to the decompilation effort, see [this guide](/docs/decompiling.md) for details.
+
+Anyone can open a pull request, but please be aware that we do not accept contributions that are primarily AI-generated or directly copy-pasted from Ghidra. Your PR will be closed if it contains obvious signs of machine-generated code. It is your responsibility to check the code that you are submitting and make sure it is readable and feels like something a human programmer would write. Refer to the [coding guidelines page](coding_guidelines.md) for more information.
diff --git a/docs/coding_guidelines.md b/docs/coding_guidelines.md
index 9711ab88..e8050b6b 100644
--- a/docs/coding_guidelines.md
+++ b/docs/coding_guidelines.md
@@ -6,13 +6,25 @@ Naming variables properly isn't required to help with the decompilation. You can
## Table of Contents
-1. [Primitive types](#primitive-types)
-2. [Offsets and padding](#offsets-and-padding)
-3. [Includes](#includes)
-4. [Naming style](#naming-style)
-5. [Use the official names where possible](#use-the-official-names-where-possible)
-6. [Resource archive enums](#resource-archive-enums)
-7. [Look at the actor's model](#look-at-the-actors-model)
+1. [Avoid Ghidra-isms](#avoid-ghidra-isms)
+2. [Primitive types](#primitive-types)
+3. [Offsets and padding](#offsets-and-padding)
+4. [Includes](#includes)
+5. [Naming style](#naming-style)
+6. [Use the official names where possible](#use-the-official-names-where-possible)
+7. [Resource archive enums](#resource-archive-enums)
+8. [Look at the actor's model](#look-at-the-actors-model)
+
+## Avoid Ghidra-isms
+
+Try to avoid directly copy-pasting code from Ghidra without cleaning it up. Ghidra tends to produce strange code that humans wouldn't write. Some common examples include:
+
+- Assigning to variables inside of `if` statements using the comma operator instead of creating multiple nested `if` statements
+- Always using `} else { if {` instead of `} else if {`, creating excessive indentation levels
+- Placing excessive unnecessary parentheses around conditions in complex if statements, even when the code would be logically equivalent without them
+- Copying the value of a variable to a second variable and checking the second variable, instead of just checking the first variable directly
+
+These make the code harder for a human to read, and occasionally they can even affect how the code matches in subtle ways (e.g. regalloc).
## Primitive types
diff --git a/docs/decompiling.md b/docs/decompiling.md
index 2b5f4f91..8450b33e 100644
--- a/docs/decompiling.md
+++ b/docs/decompiling.md
@@ -4,6 +4,8 @@ This document describes the basics how to start decompiling code and contributin
If you haven't already, you should first follow the instructions in the [readme](../README.md) to get the decomp set up, as well as the tools you will be using to work on it: objdiff and Ghidra.
+You should also read the [coding guidelines page](coding_guidelines.md) page to ensure that the code you write is clear and readable.
+
## Table of Contents
1. [Choosing an object to decompile](#choosing-an-object-to-decompile)
@@ -689,4 +691,4 @@ Then you can just submit a pull request as-is instead of worrying about it any m
Once an actor is fully decompiled, you can start naming some of its member variables if you want to. This is completely optional - it's normal to submit a PR without documenting most fields. Leaving them unnamed (e.g. `field_0x290`) is preferable to coming up with wrong names if you aren't sure.
-But if you do decide to start naming things, you should check out the [coding guidelines page](coding_guidelines.md).
+But if you do decide to start naming things, you should check out the ['Naming style' section of the coding guidelines page](coding_guidelines.md#naming-style).