Port docs from PH#90
Conversation
Yanis002
left a comment
There was a problem hiding this comment.
I started the review thinking it was ready and just as I'm about to be done I notice the draft lol (no worries it's a me issue), anyway here's my comments for now, feel free if you have any questions
| - [The Ghidra project](#the-ghidra-project) | ||
|
|
||
| ## Pick a source file | ||
| A reservation sheet exists for a list of delinked source files that are ready to be decompiled. This list grows as more source files are delinked from the rest of the base ROM. You can request access to the sheet in the ZeldaRet discord [channels for ST](https://discord.com/channels/688807550715560050/1453177153502969977) (you can join the server with [this invite link](https://discord.gg/6tjntnU8hC)). |
There was a problem hiding this comment.
| A reservation sheet exists for a list of delinked source files that are ready to be decompiled. This list grows as more source files are delinked from the rest of the base ROM. You can request access to the sheet in the ZeldaRet discord [channels for ST](https://discord.com/channels/688807550715560050/1453177153502969977) (you can join the server with [this invite link](https://discord.gg/6tjntnU8hC)). | |
| For actors and map objects, a reservation sheet exists for a list of delinked source files that are ready to be decompiled. This list grows as more source files are delinked from the rest of the base ROM. You can request access to the sheet in the ZeldaRET discord [channels for ST](https://discord.com/channels/688807550715560050/1453177153502969977) (you can join the server with [this invite link](https://discord.gg/6tjntnU8hC)). |
|
|
||
| <!-- TODO --> | ||
| If you want to unclaim the file, <!-- leave another comment so we can be certain that the source file is available to be claimed again. --> | ||
| Remember to make a pull request of any progress you made on the source file, whether it is just header files or partially decompiled code. |
There was a problem hiding this comment.
| Remember to make a pull request of any progress you made on the source file, whether it is just header files or partially decompiled code. | |
| remember to make a pull request of any progress you made on the source file, whether it is just header files or partially decompiled code. |
(since the other part of the sentence is commented out)
There was a problem hiding this comment.
Yeah I intend those to be two separate sentences, I commented the part that doesn't apply to ST but kept it to have the meaning
| - [Decompiling `.init` functions](#decompiling-init-functions) | ||
| - [The Ghidra project](#the-ghidra-project) | ||
|
|
||
| ## Pick a source file |
There was a problem hiding this comment.
this part should also mention issues to make reservation for non-actors (like the PH docs)
| ## Decompiling a source file | ||
| We use the object diffing tool [`objdiff`](https://github.com/encounter/objdiff) to track differences between our decompiled C++ code and the base ROM's code. | ||
| 1. [Download the latest release.](https://github.com/encounter/objdiff/releases/latest) | ||
| 1. Run `configure.py <eur|usa>` and `ninja` to generate `objdiff.json` in the repository root (don't forget to follow the instructions in [INSTALL.md](../INSTALL.md) first). |
There was a problem hiding this comment.
| 1. Run `configure.py <eur|usa>` and `ninja` to generate `objdiff.json` in the repository root (don't forget to follow the instructions in [INSTALL.md](../INSTALL.md) first). | |
| 1. Run `configure.py [--version|-v <eur|jp>]` and `ninja` to generate `objdiff.json` in the repository root (don't forget to follow the instructions in [INSTALL.md](../INSTALL.md) first). Note: if `--version` isn't passed the project will be configured to use all supported versions (meaning all versions will be showed on objdiff). |
| 1. In `objdiff`, set the project directory to the repository root (it should load `objdiff.json` itself). | ||
| 1. [WSL only] If you're using WSL (which is possible), navigate to the project directory with window's directory picker tool and select | ||
| 1. Select your source file in the left sidebar: | ||
|  |
There was a problem hiding this comment.
you should copy paste the image here and update the link
|
|
||
| Looking at this output, we might try writing something like this: | ||
| ```cpp | ||
| ARM bool Actor::Drop(Vec3p *vel) { |
There was a problem hiding this comment.
| ARM bool Actor::Drop(Vec3p *vel) { | |
| bool Actor::Drop(Vec3p *vel) { |
There was a problem hiding this comment.
to explain this, the ARM macro was removed, I mentioned how to handle thumb in another comment
| 1. Press the `decomp.me` button in `objdiff`. | ||
| 1. Once you're sent to `decomp.me`, go to "Options" and change the preset to "Phantom Hourglass". | ||
| 1. Paste your code into the "Source code" tab. | ||
| 1. Share the link with us! |
There was a problem hiding this comment.
| 1. Share the link with us! | |
| 1. Share the link with us! | |
| Note: if the function is using THUMB mode you can use `THUMB_BEGIN` and `THUMB_END` before and after the function to create a THUMB region, anything outside of the region will use ARM. |
There was a problem hiding this comment.
oh yeah also, as I learned yesterday, if you have inlines in a header and #include the header outside of the region it will use ARM, but if you do include it inside the thumb region it will use thumb
|
|
||
| Another consequence of having a destructor is that a `DestructorChain` object will be added to the `.bss` section. This struct | ||
| is 12 (`0xc`) bytes long and is also implicit, so we don't need to define it ourselves. | ||
|
|
There was a problem hiding this comment.
to this I'd like to add that if you have multiple ctors in the same file they will all end up in the same static initializer function, meaning the order of the declarations will change the order of the code from the sinit function (also something else to know is that you only have one sinit per source file)
| Other than `.text` and `.init` which contain code, there are the following sections for data: | ||
| - `.rodata`: Global or static constants | ||
| - `.data`: Global or static variables | ||
| - `.bss`/`.sbss`: Global or static uninitialized variables |
There was a problem hiding this comment.
| Other than `.text` and `.init` which contain code, there are the following sections for data: | |
| - `.rodata`: Global or static constants | |
| - `.data`: Global or static variables | |
| - `.bss`/`.sbss`: Global or static uninitialized variables | |
| Other than `.text` and `.init` which contain code, there are the following sections for data: | |
| - `.rodata`: Global or static constants (requires `const`) | |
| - `.data`: Global or static variables (requires not using `const` except if it's used in a static initializer, in which case all of the data will be set to zero) | |
| - `.bss`/`.sbss`: Global or static uninitialized variables |
There was a problem hiding this comment.
thinking more about it I don't believe we actually use .sbss at all with dsd 🤔 maybe we should remove that? idk
No description provided.