diff --git a/.gitignore b/.gitignore index 268fa3c2..45ac706b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,5 +12,4 @@ tools/mwcc_compiler/* *.bat include/lmgr326b.dll .idea/ -.vscode/ -versions/ \ No newline at end of file +versions/ diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 00000000..a784916d --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/include", + "${workspaceFolder}/libc" + ], + "cStandard": "c99", + "cppStandard": "c++98", + "intelliSenseMode": "linux-clang-x86", + "compilerPath": "" + } + ], + "version": 4 +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..cf8979be --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "ms-vscode.cpptools", + "xaver.clang-format" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..f3378976 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,17 @@ +{ + "[c]": { + "files.encoding": "shiftjis", + "editor.defaultFormatter": "xaver.clang-format" + }, + "[cpp]": { + "files.encoding": "shiftjis", + "editor.defaultFormatter": "xaver.clang-format" + }, + "editor.tabSize": 2, + "files.associations": { + "source_location": "cpp" + }, + "files.autoSave": "onFocusChange", + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c9bb69f..a0255bc8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,8 +14,23 @@ There are several useful resources you can use for this decomp: Visual Studio Code is recommended. -[objdiff](https://github.com/encounter/objdiff) will be your primary diffing tool. // TODO more info +### Diffing +[objdiff](https://github.com/encounter/objdiff) will be your primary diffing tool. You can fetch a binary from the latest GitHub Actions build, or build from source with `cargo run --release`. + +objdiff configuration: +- Project dir: `prime` +- Target build dir: `prime/build/mp1.0/asm` +- Base build dir: `prime/build/mp1.0/src` +- Obj: Whatever .o you're currently working on (can select from asm or src build dirs) +- [x] Build target +- [x] Reverse function order (deferred) + +objdiff will automatically rebuild and reload the object on source changes, so you can quickly iterate on functions. + +With CodeWarrior, the `-inline deferred` flag reverses the function order in a translation unit. You'll work bottom-up in most asm files. Dolphin SDK files do **not** use `-inline deferred`, so their function order is top-down. + +### Sharing When you have a function mismatch that you want help on, you can upload a scratch to [decomp.me](https://decomp.me): - Use `tools/decompctx.py src/path/to/file.cpp` to generate `ctx.c` which you can put in the "Context" field. - Set preset to `Metroid Prime (USA)`. @@ -33,6 +48,7 @@ Metaforce -> decomp - Any other `zeus::` class has the prefixed removed, i.e. `zeus::CVector3f` -> `CVector3f` - `std::vector` -> `rstl::vector` - `std::optional` -> `rstl::optional_object` +- `std::pair` -> `rstl::pair` - `std::unique_ptr` -> `rstl::single_ptr` or `rstl::auto_ptr` (`auto_ptr` has an adjacent boolean) - `std::shared_ptr` -> `rstl::rc_ptr` or `rstl::ncrc_ptr` - `std::array var` -> `T var[N]` @@ -186,4 +202,4 @@ However, in retail, the standard is to use `GetX()` for const and `X()` for non- ```c++ CWorld* World() { return x850_world.get(); } const CWorld* GetWorld() const { return x850_world.get(); } -``` \ No newline at end of file +```