Commit Graph

15 Commits

Author SHA1 Message Date
Luciano Ciccariello
f88ded1823
PSXSDK: libgpu ext, sys (#862)
Decompile all the `ext.c` and a good chunk of `sys.c`
2023-12-18 16:27:54 -05:00
bismurphy
7deb7ccc9f
Fix an edge case in jump table resolver (#677)
This fixes jump table resolution for EntityMpReplenished as commented on
by xeeynamo in my previous PR.
2023-10-10 22:20:56 +01:00
bismurphy
1254130443
Add jumptable resolver to decompile.py (#675)
This is some code I wrote a while ago and I think it might make sense to
add it to `decompile.py`.

This function takes in an assembly file, and will scan through it for
any jump tables. It will then find them in the asm folder, and move the
jumptable information into the assembly file for the function. This
means that users do not have to seek out rodata and paste it into the
asm file manually.

As an example, the user can now run `dec EntityAlucard` and it will
successfully decompile the function and insert it to the .c file,
because now when it passes the assembly to m2c, the rodata is there at
the bottom of the assembly function. Overall this has been a big
convenience for me and I hope it will be helpful for others.
2023-10-10 21:37:05 +01:00
bismurphy
a8730df7d5
Restructure arg handling for decompile.py (#657)
As part of an upcoming PR, I would like to call decompile.py from an
external Python script. Therefore, to make this easy, I have moved the
main behaviors of decompile.py to a dedicated `main()` function, which
gets called with the arguments from `argparse`. The parsing, rather than
being out in the open in the file, is handled in the `if __name__==
__main__` block, since we shouldn't need to do parsing when calling
externally.

This change had one small breaking result, that `check_injected_code`
wasn't working since it was relying on `func` being an accessible global
variable. Now `func` is passed as a function argument, so it will not
error out. Otherwise, this PR should hopefully be completely "invisible"
when using decompile.py as it was used previously, but should open the
door to better external calling.
2023-10-04 18:50:14 +01:00
Luciano Ciccariello
4e1ed4289d
Add all weapon signatures (#477)
I poked inside the exported functions and detected all the signatures
used. This will be helpful to keep decompiling DRA. I took the chance to
decompile `func_ptr_80170004` from `w_015` and all the `GetWeaponId`.
Interestingly, `w_057` and `w_058` has the wrong implementation of
`GetWeaponId`, suggesting developers copy&pasted stuff around after all.

This depends from #476 . Let's not merge before that.
2023-08-15 18:57:59 -07:00
Luciano Ciccariello
e92e9f4f4d
w_000 matching (#465)
![f_000](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/abcc5bd5-ed0c-4fc7-88fa-aa6e796aac1b)

Matches w_000, effectively opening the doors to understand how hand
equippables work. That includes weapons, shields, consumable; all of
them internally named as Weapons). This overlay is used by:

* Tyrfing
* Namakura
* Gladius
* Scimitar
* Cutlass
* Saber
* Falchion
* Broadsword
* Bekatowa
* Damascus sword
* Hunter sword
* Bastard sword
* Talwar
* Sword of Hador
* Luminus
* Harper
* Gram
* Mormegil
* Terminus Est
* Dark Blade
* Mourneblade
* Badelaire

Due to the nature of splat, renaming the symbols is hella hard but
possible once we start importing the `.data` section in it. As far I
know this overlay does not contain any `.rodata`.

Checklist to convert it from Draft to Ready:

- [x] Decompile [func_4000_8017B1D8](https://decomp.me/scratch/HLPI0)
- [x] Confirm name of the functions
- [X] ~~Put shareable code in the appropriate folder (either as `.h` or
`.c`~~ not all overlays have identical functions (see w_029). Needs more
research
- [X] ~~Import `.data` in the C file~~ needs substancial re-work in the
spriteparts asset extractor
- [x] Move `AnimSoundEvent` to the appropriate header
- [X] ~~Rename `Entity::unk58` and `Entity::`unk6A`~~ more appropriate
as a separate PR
2023-08-14 09:21:59 -07:00
Luciano Ciccariello
72c8dd8569 Tweak decompiler and update m2c 2023-07-13 00:03:14 +01:00
Luciano Ciccariello
f7896127ac Decompiler now works for the same function names across different overlays 2023-07-09 19:47:44 +01:00
Luciano Ciccariello
d33df2ce6a Update diff script to work with servant overlays 2023-02-08 14:44:01 +00:00
Luciano Ciccariello
0a125d19d6 Update m2c 2023-01-21 05:20:05 +00:00
Luciano Ciccariello
65fec2b636 Comment out the NON_MATCHING ifndef when outputting decompiled code 2022-12-25 08:32:24 +00:00
Luciano Ciccariello
d56377a1f3 Show differ command in case the function does not match 2022-12-25 08:19:10 +00:00
Luciano Ciccariello
f209d03d97 hohoho merry christmas. (?) 2022-12-25 07:22:11 +00:00
Luciano Ciccariello
2a90dd0cdc Decompile script can now be run on old python3 versions 2022-12-25 07:00:23 +00:00
Luciano Ciccariello
09b412f592 Add script to automatically decompile functions 2022-12-24 20:01:37 +00:00