Skip to content

Port docs from PH#90

Draft
Mityno wants to merge 3 commits into
zeldaret:mainfrom
Mityno:port-docs
Draft

Port docs from PH#90
Mityno wants to merge 3 commits into
zeldaret:mainfrom
Mityno:port-docs

Conversation

@Mityno

@Mityno Mityno commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@decomp-dev

decomp-dev Bot commented Jun 19, 2026

Copy link
Copy Markdown

Report for eur (d1e3be4 - 1682e68)

No changes

Report for jp (d1e3be4 - 1682e68)

No changes

@Yanis002 Yanis002 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread docs/decompiling.md
- [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)).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)).

Comment thread docs/decompiling.md

<!-- 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread docs/decompiling.md
- [Decompiling `.init` functions](#decompiling-init-functions)
- [The Ghidra project](#the-ghidra-project)

## Pick a source file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part should also mention issues to make reservation for non-actors (like the PH docs)

Comment thread docs/decompiling.md
## 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).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).

Comment thread docs/decompiling.md
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:
![List of objects in objdiff](https://github.com/zeldaret/ph/blob/main/docs/images/objdiff_objects.png)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should copy paste the image here and update the link

Comment thread docs/decompiling.md

Looking at this output, we might try writing something like this:
```cpp
ARM bool Actor::Drop(Vec3p *vel) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ARM bool Actor::Drop(Vec3p *vel) {
bool Actor::Drop(Vec3p *vel) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to explain this, the ARM macro was removed, I mentioned how to handle thumb in another comment

Comment thread docs/decompiling.md
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!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread docs/decompiling.md

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread docs/decompiling.md
Comment on lines +94 to +97
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking more about it I don't believe we actually use .sbss at all with dsd 🤔 maybe we should remove that? idk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants