This document is to act as a guideline for how you should submit Pull Requests.
This document aims to clarify the coding standard required for a Pull Request to be accepted.
While not all code submitted at this time conforms to this standard, it is the intention of the project to correct it in time.
C code that's contributed to this codebase should have clang-format
ran on it. You can do this easily by adding the C files you changed, and then running git clang-format
, which will run clang-format
on staged files.
-
Avoid naming a function that you are not matching. If you have not matched to understand the functionality, don't expect that someone else did just because they named it.
-
Affix functions within Melee related code with the file's name. While asserts may indicate this was not the case for your function, this is to make the code easier to read.
- Use Lower Camel Casing for the function's filename if it is made up of multiple words.
- Use Upper Camel Casing for the function's name itself, unless it is a standard library reimplementation.
- Examples:
lbVector_sin lbArchive_Parse Player_DoThing Stage_GetLeftBlastZone ftFox_LaserOnDeath
- Structs should be formatted the following way for Melee related code. This does not apply to code from libraries:
-
Prefix struct variables in larger structs, such as those seen in Fighters, with their offset
-
If you copy structs from another project, remove any members from the struct which are not part of your code or existing code.
- Yes:
typedef struct Player { /* 0x00 */ u8 x0_thing; /* 0x04 */ u32 x4_filler[3]; /* 0x10 */ u8 x10_thing; };
- No:
typedef struct Player { u8 thing; u32 something; u32 something2; u32 something3; u8 thing; };
-
- Functions acting as just a stub, IE. do nothing, should have an explicit
return
rather than being empty
- Make NULL checks explicit
- Yes:
if (ptr != NULL)
- No:
if (!ptr)
- Yes:
- Do not leave
else
orelse if
conditions dangling unless theif
condition lacks braces.-
Yes:
if (condition) { // code } else { // code }
-
Yes:
if (condition) // code line else // code line
-
No:
if (condition) { // code } else // code line
-
- Integer literals
- Yes:
123U
foru32
- Yes:
123456L
fors64
- Yes:
123456LU
foru64
- Yes:
0xABC
for hexidecimal - No:
0XABC
- Yes:
- Floating-point literals
- Yes:
1.23F
forf32
- No:
1.23f
- Yes:
1.23L
forf64
- No:
1.23
- Yes:
1.23e-5F
- No:
1.23E-5F
- No:
1.
1.F
1.f
1.L
- No:
1
forf32
orf64
- Yes:
If you just want to get started and match a function, you don't need to create a PR! You can just create an issue with your decomp.me link and a maintainer will add your code to the repo.
If you're familiar with git and want to make changes locally, you can also fork the repo to your personal GitHub. When submitting code, try to group your changes into fewer but larger PRs, as it'a easier to review that way.
When you open a PR, the #melee
channel on Discord will be notified.