Commit Graph

2770 Commits

Author SHA1 Message Date
sozud
a239ecc7e0 Fix argument? 2024-10-02 21:34:09 -07:00
sozud
a24c5cdca1 Fix path? 2024-10-02 21:31:16 -07:00
sozud
3ac5786db0 Try fixing analyze_calls 2024-10-02 21:23:59 -07:00
Josh Schreuder
98b784a592
Add duplicate match info to function report (#1719) 2024-10-02 20:54:24 -07:00
sozud
98f63b3e25 Try fixing dups report 2024-10-02 20:09:05 -07:00
sozud
b6152f5ac8
HD CEN DestroyEntity EntityPrizeDrop (#1718) 2024-10-02 18:04:22 -07:00
sozud
c90cbfaebe
CEN HD CollectHeartVessel/CollectLifeVessel (#1717) 2024-10-02 17:36:30 -07:00
Aleksandr Shabelnikov
6903e8f2bf
Decompile tt_001 func_us_801720E4 (#1713) 2024-10-02 17:26:40 -07:00
sozud
332acfe69a
CEN HD CollectHeart CollectGold (#1716) 2024-10-02 16:09:21 -07:00
sozud
a305fef935
Dedupe PrizeDropFall2 (#1715) 2024-10-02 22:39:01 +01:00
sozud
1117ef0af1
Dedupe PrizeDropFall (#1714)
Progress towards fixing CEN HD
2024-10-02 20:10:44 +01:00
bismurphy
eff7109db4
Move unkB8 out of Ext and into Entity (#1706)
Improved PR compared to #1704 .

We decided that unkB8 shouldn't be part of the Ext since it appears to
apply to all entities.

Also discovered some issues with the ET_GurkhaHammer struct, so resolved
those as well.

Now all accesses to the unkB8 offset go directly to `self->unkB8`.

Unrelated to all this unkB8 stuff, I found that there was an extra C
file in DRE which was not being used. Its code had been moved to
succubus.c, and it looks like the original file was accidentally left in
place. I deleted it here.
2024-10-02 19:16:52 +01:00
Josh Schreuder
939fd7daca
Decompile tt_001 func_us_80171284 (#1712)
PSX: https://decomp.me/scratch/APOek
PSP: https://decomp.me/scratch/T9RKT

Had do some some kinda ugly ifdef PSP stuff here as there is some
differences between the two.
2024-10-02 11:10:35 -07:00
H.M. Burger
ed33e90bd2
Decompiling tt_001.func_us_8017246C (#1711)
Accurate for PSX and PSP

PSP scratch: https://decomp.me/scratch/lZHti

Some of these global variables I've figured out, but I am planning on
doing a refactor of tt_001 next and will rename the vars there.
2024-10-02 11:04:56 -07:00
Jonathan Hohle
11631e1475
Add CEN Overlay to HD (#1705)
Adds the CEN overaly to the HD version of the game.

Resolves #1638.

This uses most, but not all, matching functions. Some were excluded
because due to symbols mapping that has not bee completed yet.

Not all data has been imported, and mapping symbols, and data should
make many of the remaining functions easy to import.
2024-10-01 22:31:18 -07:00
Josh Schreuder
b9d7e3fd57
Use player status flags where possible (#1709)
There's some cases which don't nicely map to the defines in place so
I've left as is

-
cf280c66f5/src/st/dre/succubus.c (L583)
- is this a mask like these?
https://github.com/search?q=repo%3AXeeynamo%2Fsotn-decomp%20PLAYER_UNK0C_READY_MASK&type=code
2024-10-01 17:23:24 -07:00
Aleksandr Shabelnikov
b9f02684ee
Overlay NO0: Deduplicate and split collision data (#1710) 2024-10-01 11:46:56 -07:00
Onenutmcgee
74ce2c49b8
Decompiling function tt_001.func_us_80171624 (#1708) 2024-10-01 09:04:45 -07:00
Onenutmcgee
646cc181cb
Various cleanup to match PSP decomp (#1707)
Ran my code for this function against the PSP assembly and fixed a bunch
of places where it didn't match.

It's pretty close now, but still missing a bit. I think it's mostly
around the number of parameters and the number of temp variables as it's
mostly all in the stack push/pop.

Also removing unnecessary casts.

Scratch
https://decomp.me/scratch/0Gm3x
2024-10-01 08:52:34 -07:00
Aleksandr Shabelnikov
cf280c66f5
Overlay NO0: Deduplicate and split st_update data (#1703)
Co-authored-by: SynaMax <djsynamax@gmail.com>
2024-09-30 16:56:38 -04:00
bismurphy
80d9bd8cc5
Refactor some stuff with subweapons (#1702)
Primary goal here was to eliminate `ext.generic.unkB0`. It turns out
that the only entity that reaches up into this unkB0 region is the
Subweapon entity.

I went through and changed these all to `ext.subweapon.subweaponId`, but
also did some analysis on all the uses to make sure this was an accurate
change to make.

Other highlights:

- Naming CheckSubwpnChainLimit and its RIC counterpart
- Moving the RIC version of that function to the next file, split makes
more sense this way.
- Made both versions of that function `static`
- renamed subweapondef's unk6 to be chainLimit
- Changed g_unkGraphicsStruct.unk0 to be called `pauseEnemies`. It's
true when the stopwatch subweapon is used, and in cutscenes. Found this
due to looking at the stopwatch subweapon setting this value. Also made
it a bool since it's only ever used as a bool.
- Added some playersteps enum uses where they were still using hex
values
- Studied RicEntityStopwatchCrashLightning in order to give it that name

I think that's about it. Overall just some modest cleanup, but continues
to make the game code more readable.
2024-09-30 21:19:51 +01:00
sozud
ac00e388e0 Revert "Fix matchings/nonmatchings duplicates in dups?"
This reverts commit b03d705503.
2024-09-30 11:52:05 -07:00
sozud
b03d705503 Fix matchings/nonmatchings duplicates in dups? 2024-09-30 11:35:08 -07:00
sozud
82a40f7a24 Fix dups tool 2024-09-30 11:13:21 -07:00
Onenutmcgee
3561526801
Decompile-func_us_80171864 (#1692)
Decompilation of func_us_80171864
Adding ET_Ghost for the Entity.ext union.

Thanks to @sozud for setting up a PSP environment for me.
Thanks to @joshlory for figuring out the last bit.
2024-09-29 21:27:15 -07:00
bismurphy
2e4ebb994e
Add NO0 (Marble Gallery) overlay (#1691)
This adds this overlay to the project.

Importantly, we use a new tool (tools/auto_dedupe_new_overlay) to
process the new overlay and automatically split its C files according to
known duplicate files. As of now, this does not do any decompiling (the
whole overlay is kept as INCLUDE_ASM), but it automatically does all the
file splits and code copying needed. Hopefully this reduces some amount
of duplicated work.

To be clear, this new script is not in any build chain, but is meant to
be used after `make-config` to take the overlay from being a single
giant lump of `us.c` to being individual files, for the sake of easier
deduplicating. It will likely need some revision for future overlays,
but at least it should be a good start toward reducing tedious work.

I'll leave this overlay in place like this for about a week in case
there are any newcomers who would like to try de-duplicating some of
these files and decompiling the new functions; after that week I'll get
into doing things myself.
2024-09-30 00:53:54 +01:00
bismurphy
ac5a03cf4d
Rewrite EntityHolyWater (#1700)
Main motivation here was to eliminate `ext.generic.unkB2`, which no
longer exists and has been removed from the struct. While I was at it, I
modernized the holy water function.

The argument is "self" instead of "entity"

We use FIX() where relevant

Function is adjusted to match on PSP

Variables are renamed

Factory calls are commented

I think those are the main highlights. Mostly small stuff, but
everything comes step by step.
2024-09-29 19:14:53 +01:00
Luciano Ciccariello
04b5019374
Cutscene data and better names (#1698)
Minor follow-up to #1686 . I couldn't de-fake the g_Dialogue symbols in
ST0 like I did with `src/st/dre/bss.c` due some functions that are not
yet fully decompiled.
2024-09-29 17:23:07 +01:00
bismurphy
49de0e3200
Refactor EntityFireWarg in NO3 (#1699)
Various small cleanups on this function.

In the past it was EntityStrongWarg, but I found that this is actually
the Fire Warg.

It is unused in NO3, but is used in RNO3.

Also removed a Multi that was being used that applied across two
different entities.

Various comments, cleanups, renamings, etc
2024-09-29 16:57:56 +01:00
Josh Schreuder
5915b2f2f0
Decompile tt_001 func_us_80170F84 (#1696)
PSX: https://decomp.me/scratch/7RyGs
PSP is not being built currently but should match once that's done too:
https://decomp.me/scratch/Nbn5X

I've called this one `UpdateEntityVelocityTowardsTarget` based on what
it appears to be doing
2024-09-29 15:15:44 +01:00
Josh Schreuder
5c287ce528
Deduplicate tt_000 tt_001 SFX function (#1695)
Thought this was going to be more work as duplicate report had it at 93%
and with a jump table, as it turns out I think they're the same besides
a single global memory address
2024-09-29 15:13:53 +01:00
Josh Schreuder
7f3855bb50
Use collider values to map to enum (#1694)
Minor fixes to use the enum values in `dra`, `ric`, `cen`, `no3`, `np3`,
`weapon`
2024-09-29 09:12:03 -04:00
sozud
d880b77db6 Revert "Try fixing dups report"
This reverts commit ea8cb184ad.
2024-09-28 23:01:07 -07:00
sozud
ea8cb184ad Try fixing dups report 2024-09-28 22:44:02 -07:00
sozud
fb8e5d7950
Revert "Add duplicate match info to function report" (#1693)
Reverts Xeeynamo/sotn-decomp#1690
2024-09-28 20:39:33 -07:00
Josh Schreuder
efcf8d4d20
Add duplicate match info to function report (#1690)
This can be merged after #1689 which fixes some things with the CI
workflows
2024-09-28 20:18:19 -07:00
Luciano Ciccariello
f86e111fc5
Extract cutscene scripts, portraits and normalize code (#1686)
More research on how cutscenes work.

I normalized all the various C files as `cutscene.c`, marked all the
isolated function as `static` and renamed the main entity as
`{STAGE}_CutsceneExec` (e.g. `CEN_CutsceneExec`). I am using the
`OVL_EXPORT` to automate the names.

TO-DO:

- [x] Rename entity as `{STAGE}_EntityCutscene` for consistency
- [x] CEN
- [x] DRE
- [x] NO3
- [x] NZ0
- [x] ST0
- [x] MAR
~~SEL~~

The offset of the portrait data seems to be hardcoded. I have no idea
how to resolve these offsets at compilation time. The entire cutscene
script thing is very sketchy and horribly designed by the original
developers. What a nightmare to integrate into our project.

This is how a cutscene script gets decompiled:

```
LOAD_PORTRAIT(0x80188D8C, 0),
SET_PORTRAIT(1, 0),
SCRIPT_UNKNOWN_11(),
PLAY_SOUND(0x37B),
WAIT_FOR_SOUND(),
SET_SPEED(4),
'T','h','a','t',' ','v','o','i','c','e','!',' ',
SET_WAIT(16),
SET_SPEED(3),
'A','l','u','c','a','r','d',',',
LINE_BREAK(),
SET_WAIT(16),
SET_FLAG(2),
'i','t','\'','s',' ','y','o','u','!',
SET_WAIT(48),
NEXT_DIALOG(),
```
2024-09-28 19:56:35 -07:00
sozud
4be6249664
Turn on disassemble_all for most yamls (#1689)
This is prep for fixing our tooling and all the force_extract stuff.
Weapon0 doesn't seem to match with this setting on for some reason?
2024-09-28 09:29:16 -07:00
Josh Schreuder
6d9828dd90
Decompile tt_001 func_us_80171568 (#1687)
https://decomp.me/scratch/rbZPM
2024-09-28 11:29:59 +01:00
Josh Lory
6f2d884c0f
Decompile func_ptr_80170008_w_030 (#1676)
https://decomp.me/scratch/pJHc1

Second to last weapon func!
2024-09-28 01:53:55 -07:00
sozud
0ac2fa8bf7
Revert "Add duplicate match info to function report" (#1688)
Reverts Xeeynamo/sotn-decomp#1685
2024-09-27 22:12:34 -07:00
Josh Schreuder
b31367b227
Add duplicate match info to function report (#1685)
Had an idea, not sure if this is useful or not but I figured it might
help give an indication for newer people or those not in the Discord
loop if code is already duplicated when looking at the function report.

Here's an example output from the current state (minus the scratches
which didn't seem to load for me locally so I skipped them)

[functions.md](https://github.com/user-attachments/files/17162454/functions.md)

@bismurphy guessing this would be your area of expertise 😄 


![image](https://github.com/user-attachments/assets/49a89a56-0328-4428-8abb-c0cbc95135c9)
2024-09-27 21:21:30 -07:00
Luciano Ciccariello
807375d669
CEN cutscene parser (#1680)
`CutsceneUnk2` uses 8 prims but only 7 are allocated. It looks like at
some point the game writes to the address `0x00000000` but I did not
confirm it with a PS1 debugger. This is a potential bug. `CutsceneUnk2`
signature was also wrong.

I had to get rid of `GfxBank` in `src/st/cen/header.c` and I probably
need to do the same for the other header files. The code reads chunks of
WORDS at the time and a structure would be too large to include
`GFX_TERMINATE` in it.

CEN is there but not linked because it conflicts with some WRP symbols.
I decided to take a much simpler approach compared to what I did with
WRP (which needs to be refactored later on).

There's a cutscene parser. The asset manager is exporting it to
`src/st/cen/cutscene_data.h` if you want to have a look. I know I am
still using `config/assets.us.weapon.yaml` and it probably needs to be
renamed as `config/assets.us.yaml` later on. I am still deciding.
2024-09-27 23:13:29 +01:00
Josh Schreuder
854683e40c
Deduplicate SetEntityAnimation function in tt_000 and tt_001 (#1684)
Last full dupe across these too. Thanks sozud for clearing up the file
splits for me in #1683
2024-09-27 09:22:00 -07:00
sozud
ed245e09b6
Fix tt_001 split (#1683) 2024-09-27 01:14:06 -07:00
Josh Schreuder
28dab97fdb
Deduplicate more tt_001 functions with tt_000 (#1682)
* `CalculateDistance` (fka func_80173FE8)
* `IsMovementAllowed` (fka func_801746A0)
* `CheckAllEntitiesValid` (fka func_801747B8)
* `ServantUnk0` (fka func_80174864)
2024-09-27 01:01:39 -07:00
Josh Schreuder
dea7992f71
Deduplicate tt_001 functions with tt_000 (#1681)
* `ProcessEvent`
* `CreateEventEntity`
* `CalculateAngleToEntity` (the function formerly known as
func_80173F30)
* `GetTargetPositionWithDistanceBuffer` (the function formerly known as
func_80173F74)

There's 4 more duplicates which I'll start on separately so as to not
make this PR too big.
2024-09-26 19:45:06 -07:00
Onenutmcgee
86d432788d
Decompile libgpu SetDrawEnv (#1678)
Decompiled libgpu SetDrawEnv

This function actually packs some of the short length fields from a
DRAWENV struct into DR_ENV struct code fields, which are longs.

IE dr_env->code[7] gets packed with env->clip.x in the hi 2 bytes and
env->clip.y in the low 2 bytes.

Perhaps DR_ENV should actually be PACKED_DRAWENV.

Co-authored-by: sozud <sozud@users.noreply.github.com> (main
decompilation)
Co-authored-by: dezgeg <dezgeg@users.noreply.github.com> (getting it
across the finish line)
2024-09-26 19:22:55 +01:00
Josh Schreuder
dc3583ab9a
Update entity IDs to map to enum (#1675)
Did my best to give contextual names where possible based on surrounding
code.

There's still some remaining ones where it wasn't clear what the entity
was referring to so have left some as is.
2024-09-26 18:59:26 +01:00
Max Clark
86f6474da6
Decompile ST/NO3 EntityStrongWarg (#1674)
Required code moving @ padding for jumptable to align (thanks @sozud !).
The new function is in
[4CA54.c](https://github.com/Xeeynamo/sotn-decomp/compare/master...Max-Clark:sotn-decomp:EntityStrongWarg?expand=1#diff-0c3d267f1984dee80517bbcbafd22a0774290aed49f88dd5f038d8eb634eb0ae)
2024-09-25 20:51:14 -07:00