Commit Graph

1195 Commits

Author SHA1 Message Date
bismurphy
88134dba3c
More entity cleanup: ET_Generic, renaming, and some Animset improvements (#1723)
This is doing a few different things; I'm sort of finding issues and
fixing them one by one. I've found more, but don't want this PR to get
too bloated.

1) Removal of more uses of ET_Generic, and eliminating a few of its
members

2) Renaming EntityUnk15 to EntityGreyPuff

3) Reworking Animset data. It's s16, not u32, so the data in d_2F324.c
has been adjusted to match that.
2024-10-05 12:37:48 +01:00
H.M. Burger
7752094c15
Importing tt_001 animation data (#1731)
Adding animation frame data to tt_001
Renaming file to animationdata for tt_000
2024-10-04 22:20:07 -07:00
H.M. Burger
4d2ccaac2b
Importing tt_001 clut data (#1730)
Again, data is shared with tt_000, so I merged that into a shared
header.
2024-10-04 21:11:15 -07:00
H.M. Burger
4282ac221e
Importing tt_001 data spriteparts (#1729)
Spriteparts data is the same between bat and ghost, so I moved them to a
shared header.
If they are different than other familiars, we'll have to rename the
shared header.
2024-10-04 20:57:04 -07:00
H.M. Burger
bc549c75e6
Small refactor for servant update (#1727)
A small refactor renaming a global variable for when the cutscene has
control of the engine.
In servant, it short cuts the main update function so that your familiar
isn't doing stuff while a cutscene is running.
Also some flag cleanup.

I've figured out quite a bit with the functions and how they are called.
It looks like most of the functions in ServantDesc are actually update
functions called by using the entityId as an offset. I want to update to
make that more clear, but I want to isolate that into it's own PR and I
already had this refactor in flight.
2024-10-04 20:52:23 -07:00
Josh Schreuder
f647b0c26b
Rename g_Player.unk0 to g_Player.status (#1721)
As discussed in
https://github.com/Xeeynamo/sotn-decomp/pull/1709#issuecomment-2386396310
2024-10-04 20:03:16 -07:00
Jonathan Hohle
c1b36a1029
Map HD CEN's e_particles and create_entity (#1726)
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (push) Blocked by required conditions
Build C code / build-macos (push) Blocked by required conditions
Build C code / build-windows (push) Blocked by required conditions
Build C code / build-linux-lle (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
And fix some segment offsets.
2024-10-04 14:49:52 -07:00
H.M. Burger
87c23d5cca
Refactoring Servant init code (#1720)
Some checks failed
Format code / format (push) Has been cancelled
Build C code / extract-assets (push) Has been cancelled
Build Saturn version / build-and-test-saturn (push) Has been cancelled
Build Saturn version / function-finder-saturn (push) Has been cancelled
Build Debug Module tool / build (push) Has been cancelled
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been cancelled
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been cancelled
Build PSX and PSP version / build-and-test (us, us) (push) Has been cancelled
Build C code / build-linux (push) Has been cancelled
Build C code / build-macos (push) Has been cancelled
Build C code / build-windows (push) Has been cancelled
Build C code / build-linux-lle (push) Has been cancelled
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been cancelled
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been cancelled
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been cancelled
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been cancelled
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been cancelled
Lots of cleanup here to make the code easier to read.

1. Adding CLUT index defines to avoid magic numbers
2. Adding InitializeMode enum and hooking that up
3. Updating function names for servant init
4. Cleaning up magic numbers used in tt_000 init function

I wanted to add a enum for the EntityId, but both servants share 0xD1.
Looking at the other EntityIDs definitions, there seems to be some
crossover, but it also looks like they may be partly unique across the
different binaries. Probably need more study to figure out how to unify
them (or if it's even possible to unify).

We also may want to look at splitting enum definitions and defining
flags/fixed values into some sort of enum file structure. Having them
all in game.h is making a large file. But we would obviously not want to
fracture the codebase more. Either way, that's way beyond the scope of
what I wanted to do here.
2024-10-03 14:19:11 -07:00
sozud
a1c00767ea
More HD CEN dedupes (#1725) 2024-10-03 11:11: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
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
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
Aleksandr Shabelnikov
b9f02684ee
Overlay NO0: Deduplicate and split collision data (#1710) 2024-10-01 11:46:56 -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
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
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
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
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
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
Aleksandr Shabelnikov
c2669ae583
#1635: RBO3 overlay (#1671) 2024-09-25 10:02:18 -07:00
Onenutmcgee
e357fcaeeb
tt_001 duplicate function decomp (#1670)
- Decompiled duplicate function func_us_801714F4
- Decompiled duplicate function func_us_80172904
- Decompiled duplicate function func_us_8017293C (renamed
Tt001UpdateAnim per tt_000 duplicate)
- Decompiled duplicate function func_us_80172B50
- Decompiled duplicate function func_us_80172B88
- Added EntitySearch D_80170EE4[] to servant.h to be used by
func_us_80172B88 similar to duplicate in tt_000

A lot of these are in the same order in tt_000, so I would assume they
could be moved to shared static functions at some point.
2024-09-25 00:39:35 -07:00
Kelly MacNeill
181a6fe95b
decompile EntityCastleBridge (#1666)
this one was trickier and larger than my previous contributions. I'm not
sure what the best way to rename the symbols are, so I expect to receive
some comments on that.
2024-09-25 00:05:24 -07:00
Onenutmcgee
30274f0f0e
Moving tt_001 us.c to f84.c as the decompiler script doesn't like the file to end in.us (#1669)
The decompilation script did not like to decompile anything from tt_001
because it ended in us.c. This would cause it to find muliple (5) paths
and would halt.

Change moves the code to F84.c in line with the code split in tt_000
2024-09-24 19:31:14 +01:00
Josh Schreuder
05d8eab3db
#1637: Add servant/tt_001.bin (#1659)
Followed [the
guide](https://github.com/Xeeynamo/sotn-decomp/wiki/Decompilation#add-new-overlay)
which seemed to work relatively painlessly for this overlay.

I hit an issue in `make-config.py` where no duplicates were found and
have added a separate commit which fixed that. Otherwise no issues with
guide.
```
josh@JoshsPC:/mnt/c/dev/sotn-decomp$ tools/make-config.py tt_001
✔ generating psx splat config
✔ splitting config/splat.us.tt_001.yaml
✔ adjusting files at src/servant/tt_001
✔ disassembling matched functions
✖ finding duplicates across overlays
Traceback (most recent call last):
  File "/mnt/c/dev/sotn-decomp/tools/make-config.py", line 1132, in <module>
    raise e
  File "/mnt/c/dev/sotn-decomp/tools/make-config.py", line 1126, in <module>
    make_config(args.input, args.version)
  File "/mnt/c/dev/sotn-decomp/tools/make-config.py", line 1106, in make_config
    if found > 0:
TypeError: '>' not supported between instances of 'NoneType' and 'int'
```
2024-09-23 18:39:35 -07:00
Luciano Ciccariello
31abdd439e
Add HD version of the RIC overlay (#1660)
I was also able to remove the weird `goto block` on `RicMain`.

The HD version seems to be an older version. I am not entirely sure of
the US changes, but it seem to fix a series of bugs when Richter gets
grabbed by Gaibon? There's a new debug string which ints
`g_Player.unk7A` being named as `run_disable_f` but I did not yet rename
it.
2024-09-23 23:39:39 +01:00
roeming
2940a4634c
Linking w_017 data contents (#1652) 2024-09-23 10:54:27 -07:00
Luciano Ciccariello
d30e3e0c9c
BOMAR: Import BSS (#1656)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
2024-09-22 12:40:16 +01:00
Kelly MacNeill
465df5849f
decompile EntityUnkId2F (#1655)
this one has a jump table which was quite a headache to figure out.
thanks to sozud for the help!
2024-09-22 11:27:33 +01:00
bismurphy
0501151335
De-duplicate CEN (#1651)
I went through all of CEN, cross-referencing it with WRP to make as many
files match as possible. This involved pulling in data (which had been
pulled in on WRP but not on CEN yet), renaming shared variables to not
have placeholder names, adjusting file splits, and more.

EntityBreakable seems to be very different here, so I did not do any
deduplication on that one yet. I think we need to get a robust system
for deduplicating across stages so we can share .h files even when the
stages are different. Right now there's no way for an included .h file
to know it's part of CEN (at least, that I know of).
2024-09-22 10:24:34 +01:00
Jonathan Hohle
7881032011
Decompile EntityMariaCutscene of boss/mar (#1649)
This is similar to other cutscenes but with a few minor differences. Of
note is that the PSX version uses an uninitialized pointer.

Pulls in the remaining duplicates and `func_us_8018C90C` as well
finishing off the remaining functions in `boss/mar`.
2024-09-22 10:20:23 +01:00
sozud
7d9f2cd04e
Split no3 (#1654)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
2024-09-21 22:26:44 -07:00
bismurphy
faf36a565e
Migrate ST0 to use e_misc.h (#1648)
This completes the migration for all stages into e_misc.h. They are now
all using it in a unified manner.

It's very satisfying to have everything coming together across the
stages like this!
2024-09-21 16:54:04 +01:00
Luciano Ciccariello
f05e41c2b0
Ignore DRA HD orphan symbol 2024-09-21 16:53:08 +01:00
bismurphy
1fbcf6833c
Decompile ST0 EntityRelicOrb (#1633)
Some checks failed
Format code / format (push) Failing after 1s
Build C code / extract-assets (push) Failing after 1s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 1s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
First working version of this.

Next steps will involve doing #ifdef to unify the function, but wanted
to start by getting something in that matches by itself.
2024-09-20 18:16:21 -07:00
Jonathan Hohle
ca857ea4e4
Build QoL (#1632)
Several quality of life changes for building:

* The Makefile has a `help` target which will show common targets.
Targets with comments starting with `##@` will be included in the help
output.

* The `check` target now has colored output.

* Added `check_disk` target which will check hashes of extracted disk
contents (useful for those who dump their own discs)

* Added `dump_disk` target which will create a bin/cue pair from an
original disc.
2024-09-20 23:56:34 +01:00
bismurphy
c20e98281a
Use e_misc.h across overlays (#1631)
Good amount of deduplication here.

The only issue I ran into is that NZ0 has slightly different data for
one array (it's missing two zeros at the end). I tried doing `#undef
STAGE #define STAGE STAGE_NZ0` in `nz0.h` and testing `#if STAGE ==
STAGE_NZ0`, but for some reason that was failing. I went with `#define
STAGE_IS_NZ0` and `#if !defined(STAGE_IS_NZ0)` for now; not sure what I
was doing wrong.
2024-09-19 22:11:17 +01:00
bismurphy
f2eb670d61
De-dupe EntityHeartDrop (#1628)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
Pulls this function into a .h file.

Since each overlay uses a different offset into g_CastleFlags, we use
`#define HEART_DROP_CASTLE_FLAG` before each `#include` statement in
order to set these up correctly.

Next we will hopefully be able to dedupe e_misc.c, but that will take a
bit longer especially since PSP still needs EntityRelicOrb done, but I'm
working on that one now.
2024-09-19 19:19:33 +01:00
Jonathan Hohle
666113f080
Decompile MAR func_us_8018CA94 (#1625) 2024-09-18 09:50:03 -07:00
sozud
76dee745d8
CutsceneUnk4 (#1623)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
2024-09-16 23:15:59 -07:00
sozud
e337ab398a
Dedupe CutsceneUnk1 (#1622)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
2024-09-16 19:36:50 -07:00
Luciano Ciccariello
2917d62f8d
MAR assets + CutsceneRun (#1619)
PSX: https://decomp.me/scratch/RL97B
PSP: https://decomp.me/scratch/3WKmX

`func_us_8018B4A0` needed to be decompiled before importing all the
assets due to GCC compiling `PfnEntityUpdates[entity->entityId - 1]`
into a hardcoded offset landing to the `header.c` data as a fake symbol.

The decompiled function seem to be some kind of object spawner for the
cutscenes controller. I have yet to confirm that, so I did not rename
any symbols yet.

EDIT: `func_us_8018B4A0` turned out to be a shared function I renamed as
`CutsceneRun`. DRE and CEN use slightly different variants and they will
not use the new `cutscene.h`. I plan on putting more stuff into
`cutscene.h` in a separate PR and maybe rename all the C files that
handle cutscenes accordingly.
2024-09-17 00:18:27 +01:00
Luciano Ciccariello
d91155004a
MAR duplicates (#1618)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
Matches 72% of the entire overlay in one go. Around 80% of the overlay
code is made of duplicate function.

A few observations:
* `func_us_8018AC0C` seems to be an older, buggy version of
`func_801B246C` and it seem to indicate `ObjInit2` was either a `u16`
array or there were macros involved.
* `e_breakable` is the same function, but the data changes in most
overlays; I had to pull the data out. The SFX ID is also different.

Data handled through the asset manager and BSS will come as part of a
separate PR.
2024-09-16 18:19:29 +01:00
sozud
7adbf52011
EntityStoneDoor (#1616)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
Thanks to sonicdcer
2024-09-15 23:30:00 -07:00
sozud
005f5ca702
EntityStatue (#1615)
Thanks to sonicdcer
2024-09-15 23:15:01 -07:00
sozud
eaef9d3523
EntityBirdcageDoor (#1614)
Thanks to sonicdcer
2024-09-15 23:03:21 -07:00
sozud
15e3cb5a78
EntityClockHands (#1613)
Thanks to sonicdcer
2024-09-15 22:52:05 -07:00
sozud
ee22761733
EntityClockRoomController (#1610)
Starting to import work from
https://github.com/Xeeynamo/sotn-decomp/pull/557
Credit to @sonicdcer
2024-09-15 22:42:35 -07:00
Luciano Ciccariello
d3875f72f1
Split C files for MAR (#1611)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
This PR prepares MAR to be de-duplicated easily. I just de-duplicate
some easy C files. I am submitting this as it is to allow @sozud to
submit #1610 without any delay.

note: it took me longer than I expected to do this. It is a step it
would really be beneficial to have automated in the future via
`make-config.py`
2024-09-15 23:38:46 +01:00
bismurphy
ff3ff091f8
Deduplicate st_update.c across overlays (#1609)
Renames the file, imports the data, and uses the .h in every overlay.

Given that this one doesn't have any PSP craziness, would this maybe be
a place where it would make sense to copy in the function C code? Right
now st_update.h is just an array definition and a few #include calls for
the .h files for `random.h`, `update.h`, and `update_stage_entities.h`.
2024-09-15 22:54:34 +01:00
Luciano Ciccariello
fffa28c7f7
Add BOSS/MAR.BIN (#1608)
Small PR to enable #557 and to let be used as an example for [our
wiki](https://github.com/Xeeynamo/sotn-decomp/wiki/Decompilation#add-new-overlay).

This was done with the new `make-config.py` tool.
2024-09-15 21:49:56 +01:00
bismurphy
908bd1d2eb
Deduplicate st_common.c across all existing stages (#1606)
I noticed that there was large overlap between these, but it was
incomplete as different stages had different levels of de-duplication
completed.

I went through and completely de-duplicated this file, so it is now
st_common.h everywhere.

There were a few leftover functions in MAD and ST0, so I decompiled
those in my previous PRs, and now in this one, I'm doing ifdef to make
it all match for all stages.

This is pretty cool and represents a large amount of code reduction.

The original C file which was used as the basis for st_common.h was the
WRP one, which has PSP support, so this may be a great step to making
many overlays match on PSP too.
2024-09-15 21:31:15 +01:00
bismurphy
f1128926cc
Decompile ST0 GetPlayerCollisionWith (#1605)
Some checks failed
Format code / format (push) Failing after 0s
Build C code / extract-assets (push) Failing after 0s
Build C code / build-linux (push) Has been skipped
Build C code / build-macos (push) Has been skipped
Build C code / build-windows (push) Has been skipped
Build C code / build-linux-lle (push) Has been skipped
Build Saturn version / build-and-test-saturn (push) Has been skipped
Build Saturn version / function-finder-saturn (push) Has been skipped
Build Debug Module tool / build (push) Failing after 0s
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / build-and-test (us, us) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Has been skipped
Build PSX and PSP version / generate-progress-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Has been skipped
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Has been skipped
ST0 has a different version of this function, which was not yet
decompiled. Other people had some scratches, but they weren't very
close.

I took the function that exists in other overlays, and removed code
until it matched.

Might try to de-duplicate this with ST0 ifdef stuff, but for now, I
wanted to just get the single decompiled function reviewed.
2024-09-15 18:19:17 +01:00
sozud
85dd4a6540
Mark libgte funcs as asm (#1600)
RotMatrix
RotMatrixYXZ
RotMatrixX
RotMatrixY
RotMatrixZ
ScaleMatrix

I think these are handwritten because they heavily use $t registers,
which is not like the code gcc produces. It makes sense for these to be
hand-optimized since they are speed-critical. Also, these don't use the
`ctc2` etc. instructions so I don't think it's a mix of C and gte
macros.

I dumped all the remaining gte funcs to a gist if others want to inspect
these https://gist.github.com/sozud/62a6a4a7f751010d435714a5191c46f3
2024-09-15 18:13:38 +01:00
Luciano Ciccariello
0df1cccf2a
Add some missing US undefined symbols (#1592)
Allows to compile overlays without necessarily having to splat DRA to
generate `undefined_syms_auto.us.dra.txt`
2024-09-09 08:04:39 +01:00
Luciano Ciccariello
edb4f0ebc0
RIC and Alucard share field docs (#1588)
Not a big PR. The highlights are `g_Player.timers` and
`entity->hitParams`. The last one is a bit weird as it looks like a mix
between `attackElement` and `hitEffect`.

The `var_s4` on `RicMain` is uninitialised and it leads to an undefined
behaviour. Recompiling the code for PSX by moving things around, that
variable will not be `0` at the beginning but some random value. This
prevented Richter's run, blade dash and high jump to work. I added an
`#ifdef` in case people wants to mod the overlay.

This is probably the last batch of changes for RIC for a while.
2024-09-07 18:00:44 +01:00
Luciano Ciccariello
f448782618
RIC blueprint docs (#1577)
List of the most important changes:
* The two fields in `FACTORY` are now reversed; what used to be
`FACTORY(0x2000, 44)` is now `FACTORY(44, 0x20)`
* Introduce `WFACTORY` to imply `((g_HandId + 1) << 0xC)` in it
(`((g_HandId + 1) << 0xE)` is not yet cracked)
* Remove `assets/ric/blueprints.json` in favour of baking the info into
a C file to easily link enums
* Add `B_MAKE` to define a blueprint entry
* Document almost all RIC entities
* Document almost all RIC blueprints
2024-09-07 01:29:56 +01:00
Luciano Ciccariello
af503baa43
RIC: add more documentation (#1573)
Follow-up to #1569 .

Loads of changes, where the most prominent one is synchronising the
`self->ext.*.subweaponId` field across entities to make it work on
`RicSetSubweaponParams`. I added some static assertions with the new
macro `SYNC_FIELD`, which is easier to read.

The new `enum RicSubweapons` decouples the subweapons of Richter from
those found in DRA. This is important because
`assets/ric/subweapondefs.json` is different from the definition stored
in DRA.

I discovered new entities and renamed them accordingly. I am following
the format `RicEntity` for each entity. Then `RicEntitySubwpn` or
`RicEntityCrash` for the appropriate category.

The BSS section has been assigned to the right places and `ric.h` has
been cleaned as most of the declarations are no longer necessary. More
data and functions have been marked as `static`.

`src/st/st0/2DAC8.c` had a reference to `.ext.agunea`, which was
probably put there by mistake. The fake symbol `D_801758D0` has been
removed and I think I found a way to fix the stopwatch subweapon without
the `#ifdef`.

```c
#ifdef VERSION_PC
#ifdef _MSC_VER
            {
                s32 temp_x = (rcos(primLine->angle) << 8);
                s32 temp_y = (-(rsin(primLine->angle) << 8));
                primLine->velocityX = *(f32*)&temp_x;
                primLine->velocityY = *(f32*)&temp_y;
            }
#else
            primLine->velocityX = (f32)(rcos(primLine->angle) << 8);
            primLine->velocityY = (f32) - (rsin(primLine->angle) << 8);
#endif
#else
            primLine->velocityX = (rcos(primLine->angle) << 8);
            primLine->velocityY = -(rsin(primLine->angle) << 8);
#endif
```
this one has been resolved by just using `velocityX.val`.
2024-08-27 18:18:26 +01:00
Luciano Ciccariello
9112ccc88c
RIC: add more documentation (#1569)
I documented all the `PLAYER.step` for Richter and got the meaning of
most of the functions with their parameters. There are some additional
renaming and magic numbers documented that are not worth to mention
individually.

I plan to get rid of `EntityTypes` as it is not sustainable to document
256 combination of entities. Instead I am thinking it would be a better
approach to document the `g_Entities` indices as ranges. For example
from `32` to `47` we have particles, from `48` to `64` we have player
entities that can hit the stage entities and so on.

I re-organised and re-imported some of the data close to the function
that use them. This will allow me to later split entities into their own
units as separate C files.
2024-08-24 09:57:53 +01:00
bismurphy
a11c22adef
Decompile ST0 func_801BD8F0 (#1563)
In addition to decompiling the function, two big changes were needed:

- Decompiling this function uncovered a maspsx bug with generating `nop`
padding instructions; that is now fixed and this PR includes a maspsx
update.
- We also discovered (thanks @mkst !) that g_Tilemap.bg was not actually
a member of g_Tilemap. I renamed it to g_BgLayers, and did a
find-and-replace across the repo to change all references. This appears
to have no impact on any existing function, but leads to the correct
register loading on this function.

It's a weird one, and was tricky to get matching (actually, this was a
super old decomp.me browser tab I discovered was still open, which is
why I came back to it), but these tricky ones are great for discovering
where we have mistakes in our structure of the game's data.
2024-08-22 18:19:49 +01:00
bismurphy
a8572f8922
Deduplicate Bone Scimitar enemy (#1559)
After modernizing this, I've gone ahead and pulled out the functions in
this file into a .h, as with other duplicate functions.
2024-08-21 23:19:15 +01:00
sozud
6b4254b2fc
More dedupes (#1556) 2024-08-20 20:57:18 -07:00
sozud
88024b24ff
More dedupes (#1555) 2024-08-20 16:02:21 -07:00
Jonathan Hohle
959ebe41ac
Update Symbol Name, Size Comment (#1553)
Renamed `PLAYER_ext_generic_unk7C` to `PLAYER_ext_player_anim` since we
know the player entity is being referenced.

Added a size comment to `WeaponAnimation` to help me find it next time
I'm looking for an `0x10` sized struct.
2024-08-20 18:21:16 -04:00
bismurphy
bac0e55cd2
Modernize NO3/NP3 Bone Scimitar (#1551)
NO3 and NP3 had a weird mix of Bone Scimitar functions where each was
partially complete and missing different parts.

Now both are complete and modernized. Could use another pass to make it
PSP-matching, but for now I'll leave this one at this point where the
code seems nice.
2024-08-20 12:23:51 -07:00
sozud
99ef943f6b
More dedupes (#1550)
Merging to prevent more conflicts with other work
2024-08-20 11:24:52 -07:00
Josh Lory
a62e1052e7
Finish two related files: w_012 and w_034 (#1549)
* https://decomp.me/scratch/h62LS
* https://decomp.me/scratch/FhCre
* https://decomp.me/scratch/N3tj5
2024-08-19 22:00:58 -07:00
sozud
f40e9a1639
More dedupes (#1548) 2024-08-19 21:36:45 -07:00
sozud
7433787b9b
more stage dedupes (#1543) 2024-08-19 23:00:03 +01:00
Josh Lory
f21224fb6f
Import data for w_041 and link (#1546)
Also links `w_052` which I missed in
https://github.com/Xeeynamo/sotn-decomp/pull/1524
2024-08-19 10:51:24 -07:00
Josh Lory
247f58f90e
Finish w_007 and import data (#1539)
https://decomp.me/scratch/Zn2uO
2024-08-18 14:52:32 -07:00
bismurphy
e37ebe715b
Improve EntityWargExplosionPuffOpaque (#1538)
Main changes here involve renaming the Ext member from `et38` to
`wargpuff` which seems more descriptive.

Also added entity ID numbers across the overlays, to be used in the
function right before the warg puff function, which spawns the warg
puffs with a call to `CreateEntityFromEntity`.
2024-08-18 14:38:58 -07:00
bismurphy
0dddb4bed8
Improve some TT_000 code quality (#1532)
- Rename func_801733D4 to BatFamiliarBlueTrail
- Add PSP symbols for several various variables used in `func_80172120`
- Attempt to get `func_80172120` closer to matching on PSP. Almost got
it but not quite working; this is at least an improvement. Scratch:
https://decomp.me/scratch/QBytP
- Create `Ext` for BatFamiliarBlueTrail; all it uses is the parent which
is the same as Factory, but still better to have its own until we know
the real situation for entities.
- General commenting to make flow of functions clearer.
2024-08-18 09:38:13 +01:00
Josh Lory
c939079eab
Finish w_045 and import data (#1521)
Unfortunately this build will fail until the fix is merged to decouple
`func_ptr_*` signatures.

* [func_ptr_80170004_w_045](https://decomp.me/scratch/OmJXk)
* [func_ptr_8017000C_w_045](https://decomp.me/scratch/c5Qrm)
2024-08-18 09:22:14 +01:00
Jonathan Hohle
dc92c84193
Port EntityMerman & EntityMerman from NP3 to NO3 (#1529)
Copied the `EnttityMerman` and `EntityMerman2` implementations from NP3
to NO3. These are identical, however, rely on too many things which
require renaming to share at this point.

NO3's `EntityMerman2` was previously `EntityMerman3`, but is identical
to NP3's Merman2, so it was renamed to match.

A small amount of cleanup was done to the implementations to bring them
closer to current standards.
2024-08-17 11:41:47 -07:00
Josh Lory
912153bed3
Import data for w_044 (#1526)
Might try replacing the clut with actual 16 bit colors. Is this the
right macro to use?

```
#define COLOR16(r, g, b, a) (r) + ((g) << 5) + ((b) << 10) + ((a) << 15)
```
2024-08-17 11:09:13 -07:00
SynaMax
03b1059c1a
Renaming func_80134714 to PlaySfxVolPan (#1527) 2024-08-16 14:22:08 -07:00
Jonathan Hohle
ec33f90170
Rename Entity unk4C to anim (#1522)
`unk4c` is used to store a reference to the entity's current animation.
Renaming the field to `anim` match the purpose.
2024-08-16 16:11:14 +01:00
Josh Lory
b3ef37a4a7
Import data for w_052 (#1524)
Finishes the `.data` section. I thought I could just update sizes and
`.bss` would work as well, but I'm running into issues.
2024-08-15 23:18:19 -07:00
Josh Lory
6c4e63fd12
Finish w_046 and import data (#1511)
https://decomp.me/scratch/dKGxs
https://decomp.me/scratch/YGyQp
2024-08-15 14:36:06 -07:00
Luciano Ciccariello
eca5393e43
Document Richter overlay (#1513)
This is a proposal on how I would like the naming scheme going forward
for the player. The proposal includes the naming and layout once we
document Alucard and decompile Maria (PSP). Please let's agree on naming
and structure so it can be easy to hack and plug new custom characters
at any time.

* Animations to have `XXX_anim_yyy` where `XXX` is three letters for
`arc`, `ric` or `mar` (`arc` taken from `BIN/ARC_F.BIN`). To mark them
`static` whenever it is possible to do so.
* `PL_S_xxx` to mark a player step. Steps might be similar between the
three different players, but they must be isolated into the respective
headers `dra.h` for Alucard, `ric.h` for Richter, `mar.h` for Maria. I
am aware that Alcuard steps are used in weapons, which is why they are
currently found in `game.h`. This needs to be addressed at some point.
* PL_T_xxx` for the various timers from `g_Player.D_80072F00`. Those
_might_ be need to be shared between all players, we need more research.
* `XxxHandleYyy` for the step handlers. You will see `RicHandleJump` to
handle `PL_S_JUMP`.
* `XxxSetYyy` for the functions responsible of transitioning into a
specific step (see `RicSetJump`)

Prefer imperative verbs than paste tense or anything else. So `dead`
instead of `killed`, `run` instead of `running` and so on.

Functions and animations have `Ric` or `ric_` pre-pended since those
symbols are publicly exported and not marked as static. But `#define`s
and `enum`s that are isolated into the player's header should be
generic.

I cracked the animation system, so I created the macros `A_END`,
`A_LOOP_AT` and so on.

In a next pull request I will change `Entity::unk4C` into
`Entity::anim`. I did not want to include it here to not change too many
files in one go.
2024-08-15 14:57:54 +01:00
bismurphy
7c4c077543
Start documenting some game engine stuff (#1515)
Just some symbol renaming; this is a big task and will probably take
lots of research to work out how all the different interwoven systems
work, but this is some starting steps.
2024-08-14 17:48:05 -07:00
bismurphy
efecb91c2d
Use e_collect.h for NP3, CEN, MAD, DRE, ST0 (#1502)
Came across e_collect.c in NP3, and it wasn't using the e_collect.h, but
now it is. Overall just a big deduplication.
2024-08-13 12:28:57 -07:00
Jonathan Hohle
e4a9eb1a17
Decompile and Split NO3 to Match NP3 (#1504)
This is a simple synchronization between methods already decompiled in
NP3 to their counterparts in NO3. Player water effect has been split to
match, but no data has been mapped in this pass.

Decompiles methods based on the NP3 implementation:

* `EntityBackgroundBushes`
* `func_801B94F0`
* `func_801D0A2C`
* `EntityAlucardWaterEffect`
* `EntityMermanSpawner`
* `EntityMermanExplosion`

Splits `e_bone_scimitar`, and `player_water_effect` into a separates
file to match `NP3`.
2024-08-13 11:03:18 -07:00
Jonathan Hohle
a34dc9a778
Stage BSS Organizing, Padding Macros (#1497)
Maps `create_entity` and `e_collect` data, text, and bss for all stages.

Adds macros for defining padding for various sections by size.

Tables for section sizes have been added to common includes to make
calculating offsets easier when segments.
2024-08-11 15:49:53 +01:00
Luciano Ciccariello
551f3c8bae
NZ0 data import and code refactor (#1494)
plus some minor edits to link the stage
2024-08-09 18:25:53 +01:00
Luciano Ciccariello
e2ca7ee416
Import w_002 data and link overlay (#1493)
This PR aims to be a blueprint to what needs to be done for the
remaining 56 weapon overlays
2024-08-09 17:53:10 +01:00
Josh Lory
a148db7885
Decompile DRE EntityUnkId23 (#1434)
https://decomp.me/scratch/LLpca
2024-08-09 09:51:53 -07:00
sozud
301f3128d9
some ric fixes (#1490)
This fixes a few RIC crashes, gets it up to the point that the
blueprints need to be loaded
2024-08-09 09:24:58 -07:00
Jonathan Hohle
2e181ea9f3
Move Some cen Data to Logical Compile Unit (#1492)
This change moves BSS variables into their most appropriate compile
unit, "decompiles" several data files, and splits out some existing data
into its logical unit.

BSS data has all been removed from `bss.c` and moved to a file where the
data is either first used or where it can be made static.

Several data files have been converted to appropriate types and added
to the most appropriate file. This converts the header related
references and some of the other early data.

Finally, some data like has been rearranged and moved into logical
compile units like data from `entity.c` into `holyglassescutscene.c`.
Logical boundaries were chosen based on where data could be made static.
2024-08-09 10:30:12 +01:00
Luciano Ciccariello
f1faef333a
Weapon assets and statically linked (#1470)
Allow to compile weapon overlays as a single C files. The benefit is to
disallow symbols to be exported by statically compile them all but the
header. We would no longer need to use `OVL_EXPORT` as long as the
symbols are marked as `static`. The frames data is also generated as an
array of data that can be just included into their respective C files,
generated by JSON files on the fly.

I changed `animset` to `frameset` as the data does not represent a set
of animations but rather a set of frames, where every frame has multiple
sprites. The information on how the frames are played (e.g. animation)
is found elsewhere.

Following the full list of changes to achieve this project:
* The `animset` from splat is now dummied out
* The `frameset` JSON is now generated by the asset manager
* The `frameset` JSON is now compiled into `src/weapon/w_0xx_y.h`
* The `header.c` has been moved into `shared.h`
* For simplicity I added a `#define g_Animset w_000_1`. I did not want
to hack the asset manager too much to force the name to be `g_Animset`
and I did not want to change all the symbols yet.
* Simplified `weapon_pc.c` as we now only need the exported header
* Always try to build the most up-to-date asset manager: this should
avoid weird errors whenever people pull new changes

As the asset manager now can accept those `config` files, now the CLI
supports the following commands:
* `stage extract`
* `stage build`
* `config extract` (NEW)
* `config build` (NEW)

The config structure is heavily inspired to Splat to maintain
consistency and continuity.
2024-08-09 00:57:26 +01:00
Jonathan Hohle
329c52189a
Finish EntityLockCamera Decomp (#1486)
Replaces the partial `EntityLockCamera` with a matching decomp.
2024-08-08 14:47:35 -07:00
Alejandro Asenjo Nitti
23a68b0c09
Import RIC data & the rest of rodata (#1483)
co-authored-by: @DerpPrincess
2024-08-08 10:11:15 -07:00
Luciano Ciccariello
358b7a10df
Import BSS section across all overlays (#1473)
I did not do it for `weapon`. This is the script I used:

`python3 a.py asm/us/st/dre/data/23264.sbss.s > src/st/dre/bss.c`

```python
import sys

with open(sys.argv[1], "r") as f:
    lines = f.readlines()

print('#include "common.h"')
print("")
for line in lines:
    if line == "\n":
        continue
    elif line.startswith(".include"):
        continue
    elif line.startswith(".section"):
        continue
    elif line.startswith("glabel"):
        label = line[7:].replace("\n", "")
        len = 0
    elif ".word" in line:
        if len > 0 and n != 4:
            print(f"WARN: {label}", file=sys.stderr)
        n = 4
        len += 1
    elif ".short" in line:
        if len > 0 and n != 2:
            print(f"WARN: {label}", file=sys.stderr)
        n = 2
        len += 1
    elif ".byte" in line:
        if len > 0 and n != 1:
            print(f"WARN: {label}", file=sys.stderr)
        n = 1
        len += 1
    elif line.startswith(".size"):
        if len == 1:
            if n == 1:
                print(f"u8 {label};")
            elif n == 2:
                print(f"u16 {label};")
            elif n == 4:
                print(f"u32 {label};")
        else:
            if n == 1:
                print(f"u8 {label}[{len}];")
            elif n == 2:
                print(f"u16 {label}[{len}];")
            elif n == 4:
                print(f"u32 {label}[{len}];")

```

the script is a bit dumb. It does not account of the header. Some types
are wrong compared to their prototype. The memory layout matches though,
so we can keep iterating on top of this.
2024-08-04 16:14:49 -07:00
sozud
a869b920b9
Start documenting sfx scripts (#1459) 2024-08-01 12:23:03 -07:00
Jonathan Hohle
d89e1ea8c1
Symbol Matching (#1455)
Matching several symbols for consistent names across duplicates.
2024-07-31 22:44:37 +01:00
Jonathan Hohle
e9685614c0
Decompiles Remaining rwrp Function & Data (#1437)
Adds an a PSX implementation of `EntityRWarpRoom`. This is similar to
`EntityWarpRoom`, but needs to raise and lower the player stands on, and
obviously has to warp to other inverted rooms.

This also pulls in the remaining data and static storage, completing the
`rwrp` mapping.

---------

Co-authored-by: Jonathan Hohle <jon@ttkb.co>
2024-07-29 21:30:24 -04:00
bismurphy
fe180b52dc
Decompile w52 (Alucard Shield) func_ptr_80170004 (#1444)
The most important thing here is that D_170000_8017CBD0 is an array of
f32 values. But since entry 0 is only accessed with `.i.hi`, the
auto-detected symbol was `CBD2`, offset by 2, so I had to manually make
the symbol for this one variable. I studied the symbols file to figure
out how to declare it, and this ended up working. Now that I know how to
make weapon symbols, I can start making useful names for these in the
future. Not for this one though, this doesn't make any sense.
2024-07-27 09:27:18 -04:00
bismurphy
8cd4eb91bc
Decompile DRA func_80115394 (#1436)
Brings DRA up to one function remaining.

I think everything is in order, but looking forward to any suggestions.

The last missing function is a pretty irrelevant Kanji function, so it
will be nice to have all the material to really start understanding DRA
now.
2024-07-26 08:53:04 -04:00
Luciano Ciccariello
c9f6e2b1b3
NP3 first steps to align C extraction (#1430)
Start to perform a series of code refactoring to align the various
overlays on how NZ0, WRP and RWRP are currently organised, aiming to
share as much code as possible. This is a good stop gap that does not
change too much. There are virtually no major changes other than the
removal of the fake symbol `D_8003BEEC`.

I found it is very hard to share every single line of code due to some
minor differences in the castle flags. I couldn't yet spot a reliable
pattern on how castle flags are manager across stages.

My vision is to share as much code as possible, possibly not as header
files but as C files in a similar fashion of #1425 . I am aiming to
model NP3 so we can merge it with NO3 given the fact they share a good
chunk of the code base.

I am waiting to split the rest of the entities into their own individual
files. My idea is to have a file per entity or per entity group with
their own set of data and helper functions, possibly all marked as
`static`. We agreed it is probably a good idea to wait exploring the PSP
build of NZ0, NO3 or NP3 before performing this step.
2024-07-26 08:36:05 -04:00
Luciano Ciccariello
b8f87761e7
Merge RWRP with WRP (#1425)
This will decompile all the functions but the new `EntityRWarpRoom` from
the RWRP overlay.

Note that as `e_misc.c` has a function with a different castle flag, I
had to use a shared header. Everything else was identical.

---------

Co-authored-by: bismurphy <tjmurphy@mit.edu>
2024-07-22 10:57:21 -04:00
Luciano Ciccariello
99bb97e859
HD WRP matching (#1421)
Mostly identical to MAD and PSP. There are four very different functions
from US that needs to be decompiled to be 100% complete:
* [x] `e_misc.c` `EntityMessageBox`
* [x] `e_misc.c` `EntityRelicOrb`
* [x] ~`e_stage_name.c` `StageNamePopupHelper`~ it does not exist
* [x] `e_stage_name.c` `EntityStageNamePopup`

These four very different functions are the only ones that use the JP
text instead of the US one. This overlay also lacks of `BlitChar`.

`EntityStageNamePopup` is very similar to the PSP counterpart. I used
@joshlory scratch to match the HD part.

`EntityRelicOrb` had some #ifdef between US and BETA (aka the MAD
overlay). I found some code that crossed between BETA and HD, so I just
put an `#else` after `VERSION_US`. We are starting to reconstruct how
the source code originally evolved across different game builds.
2024-07-19 19:05:26 -05:00
Josh Lory
2ec252543a
Decompile DRA EntityPlayerDissolves (#1420)
PSX: https://decomp.me/scratch/6ucWC
PSP: https://decomp.me/scratch/70r4s
2024-07-18 20:57:49 -07:00
bismurphy
9a08a85b8f
Decompile SEL func_801B99E4 (#1419)
The vast majority of this comes from a 6-month-old scratch by
@ser-pounce , here: https://decomp.me/scratch/7Ram0

I finished it up, and made some changes to make it fit into the current
state of the repo.

That scratch puts the isrgb24 value into a StreamCtl struct. I'm
inclined to agree with that, but want to minimize the impact of this PR
on the larger repo for the moment. I expect StreamCtl to be used more
heavily in the final function for SEL, but we'll see how that goes.

The StreamEnv struct is in exactly the same location as
Unkstruct_801B9B7C (which was actually unused), so I eliminated that
one.

That's just about all I have to say for now.
2024-07-17 21:20:24 -07:00
bismurphy
2dfedc44c3
Rework D_8003C908 (#1418)
The next function of SEL, func_801B99E4, makes it clear that D_8003C908
is not a struct member. I do not know why it was placed in this struct.
I have that function now matching, but since we're changing around
variables that are used elsewhere, I decided to split the PR so that we
can handle one type of change at a time.

The D_8003C908 variable has not yet been used in any C code, so this
change does not affect anything.

Further, since both struct members were s32, I decided to make it a
2-member array for the sake of conciseness in the code.
2024-07-17 19:13:53 -07:00
Luciano Ciccariello
91a0dab64e
e_collect.c adjustments (#1412)
Changelog:
* Import all the PSP WRP data that belong to `e_collect.c`
* Remove the `ext.generic` use in favour of `ET_EquipItemDrop`
* Document some fields from `ET_EquipItemDrop`
* Discover the extra field `mariaSubWeapon` on PSP
* `g_api.AddToInventory` signature changed to allow a better match on
[EntityEquipItemDrop](https://decomp.me/scratch/PULKm)
* Remove the fake array `D_8003BF9C` in favour of `g_CastleFlags`
* The `O_TAG` struct is also valid on PSP
* Decompile `EntityPrizeDrop` on PSP
* Align `func_8018CAB0` to PSP
* Align `EntityPrizeDrop` to PSP with a bunch of `#ifdef`
* Align `EntityEquipItemDrop` to PSP using the WIP scratch
[EntityEquipItemDrop](https://decomp.me/scratch/PULKm)
* `DestroyCurrentEntity` is just an dummy item collector from
`EntityPrizeDrop`
* Duplicate functions in other overlays are not yet aligned as I am
waiting to migrate them to use `e_collect`


I noticed splat is not able to successfully recognise pointers if the
data is too scattered. I had to merge the `data` in the YAML and allow
it to be exported into a single file before starting to import it.

The only missing function from `e_collect.c` is
[EntityEquipItemDrop](https://decomp.me/scratch/PULKm).

Data on PSX are slightly shuffled within the same C file. I believe the
PSP build retains the original data order.

Thanks to @sozud for the majority of the work on `EntityPrizeDrop` and
`EntityEquipItemDrop` on PSP. And thanks to @bismurphy for solving the
last piece of the puzzle to match `EntityPrizeDrop`.
2024-07-17 20:22:31 +01:00
bismurphy
8c5bb8d625
Decompile RIC EntityPlayerBlinkWhite (#1414)
Wow! With this one, Richter is now down to a single non-matching
function (it's a duplicate of a DRA function which is missing - the one
with the funny pointer math which is connected with
EntityPlayerDissolves).

Anyway, we're matching. This is different from DRA's
EntityPlayerBlinkWhite, but in weird ways that made it a huge pain to
get matching. Definitely was not a matter of replacing a few lines like
some duplicated functions are.

Anyway, looking forward to see if there's anything to fix!
2024-07-17 12:05:56 -07:00
bismurphy
d2db3606a2
Decompile DRA EntityNumberMovesToHPMeter (#1415)
This was decompiled by @joshlory , but due to some annoying rodata, I
ended up taking over the PR on their behalf and submitting. The file
split here was a bit tricky to get right, but now we're matching.

I did not do any reviewing of this code, it is presented here as it was
made by josh's scratch.
2024-07-16 21:27:16 -07:00
bismurphy
ed7e5c0b70
Decompile RIC EntitySubwpnThrownDagger (#1411)
RIC had 3 functions remaining, one of which was this one. Given its
similarity to the one in DRA, I decided to revisit it, and thankfully it
now matches.

I also did some cleanup on the DRA one, including renaming variables,
using macros, etc.

We now have two functions remaining in RIC. They are both duplicates of
remaining DRA functions, which have the same issues as the DRA ones do.
This means that once DRA is solved, RIC will be too, which is amazing!
2024-07-16 09:35:43 -07:00
Luciano Ciccariello
512e162f51
DRA finish to import all data from US and HD to C files (#1410)
with the exception of those three SEQ files, which needs to be handled
with the asset manager
2024-07-14 09:35:13 -07:00
bismurphy
e6efb57796
Decompile DRA func_8012F894 (#1409)
This function was previously the last function in its file.

Upon decompiling, the rodata (specifically the `00 00 00 00` pattern)
indicated that the file does not end here, and that in fact the entire
following file should be part of this file, so I had to change the
splits to accomplish this.

It's an ugly function, and was hard to get a match, but here it is. Did
what I could to document variables but it doesn't seem to make much
sense, if you ask me.
2024-07-13 15:09:54 -07:00
bismurphy
d09bbe8596
Decompile DRA EntityPlayerOutline (#1405)
This was EntityMPReplenished, but then I looked into how it is used and
found that it is used for many other things besides replenishing MP, so
I named it more generically.

I think I hunted down every situation where it is used and documented
them fairly well. In general, I think this is a relatively good-looking
function and is easy to read.

Looking forward to seeing any feedback!
2024-07-12 11:05:27 -07:00
Josh Lory
3e7c376143
Decompile DRA EntityStopWatch (#1383)
PSX: https://decomp.me/scratch/eMQyN
PSP: https://decomp.me/scratch/1Ktyt
2024-07-12 00:32:13 -07:00
bismurphy
1bb611fe02
Decompile DRA RenderEntities (#1393)
Now with the maspsx changes, this can also match by using
SPRITESHEET_PTR.

Tried to document all the variables, use flags when possible, etc, so
hopefully this is mostly complete. Should be exciting to have
RenderEntities and RenderPrimitives both working now!
2024-07-11 11:41:07 -07:00
Josh Lory
d756e28f77
Use SFX constants (#1403)
Open to suggestions for how to break this change up to make it easier to
review. The data extraction necessary for naming values in `D_800ACF60`
and `D_800ACF84` could be a separate commit... but I'm not sure it's
worth it.
2024-07-11 10:03:39 -07:00
Josh Lory
c1455c9638
Decompile DRA func_801042C4 with help from @bismurphy (#1401)
PSX: https://decomp.me/scratch/PLi6k
PSP: https://decomp.me/scratch/nYr6M
2024-07-10 21:53:21 -07:00
Josh Lory
b98a3da1bd
Decompile DRA EntityBatEcho (#1400)
PSX: https://decomp.me/scratch/3MCaB
PSP: https://decomp.me/scratch/18Dbq
2024-07-10 20:25:28 -07:00
sozud
6e2c372ce8
_otc, register docs (#1399) 2024-07-10 14:30:30 -07:00
sozud
33566ce10b
Progress towards linking/loading weapons (#1384)
This links w_000 and allows the texture to be loaded to vram, as well as
the functions executed.

g_Cluts was renamed since the stages also have g_Cluts. A macro and
preprocessor defines are used to allow unique weapon function names.
This doesn't load the animsets since it seems like that stuff is getting
redone with the asset manager.
2024-07-10 13:53:04 -07:00
Jonathan Hohle
2305f1973c
rwrp Decomp (#1398)
Replace 14 ASM functions with common files, duplicates, near duplicates,
or new decomps.

---------

Co-authored-by: Jonathan Hohle <jon@ttkb.co>
2024-07-09 13:25:42 -07:00
Jonathan Hohle
f724532c70
Extract Entity Definitions for CEN (#1395)
Entity definitions for `cen`.

Cleans up some declarations (like `D_8018068C`) to better match the
data.
2024-07-08 20:19:47 +01:00
bismurphy
d3c209eab9
Decompile DRA EntityPlayerBlinkWhite (#1392)
This is the largest function remaining in the decomp, and now it's dealt
with.

It's a giant beast and I can't claim to be anywhere near understanding a
single thing that it does. Researching this and documenting it will be a
second giant PR. Maybe I'll do that someday, but for now I'll leave it
to anyone else who wants to give it a try. None of the variables have
useful names. We could have "give the variables in this function useful
names relating to how they are used" be a "good first PR" issue, since
we set up several of those a while ago.

Data types on some of the externs it uses have been changed to match how
the function uses them.

This also uses g_PlOvlSpritesheet, which we have found seems to need to
be accessed as a numerical pointer, so I added a #define for that. It
seems to be working, so big thank you to everyone who was involved in
the process of setting that up. I believe this is the first function to
actually make use of that.

Besides that, I'll leave it to others to make their comments. There is
really too much in this function for me to talk about it, but hopefully
this is a reasonable start and we can make whatever tweaks are needed to
get this merged.
2024-07-08 00:54:25 -07:00
bismurphy
9d528eadde
Decompile DRA EntityMist (#1385)
This is a big messy function, but it's decompiled!

Did what I could to rename variables in a useful way, but I could only
get so far. Hopefully one day we can work out exactly what all the
different angles, XY variables, etc are. But this is one of the biggest
remaining functions and it's great to have matching.
2024-07-07 18:24:44 +01:00
Josh Lory
8ec6dcd2d7
Duplicate DRA EntityTransparentWhiteCircle (#1382)
PSX: https://decomp.me/scratch/GW1Hi

Near-duplicate of RIC `EntityShrinkingPowerUpRing` with a few
modifications.
2024-07-06 18:24:06 -07:00
bismurphy
8ac5ebc378
Refactor/clean-up of some of Alucard's jumping logic (#1376)
There was a question in the decomp discord about the bounce when Alucard
dive-kicks and hits an enemy. I tracked this down, and in the process,
found some moderately old functions that could use some improvements to
their code style. I also cross-referenced these with PSP to make the
code make a bit more sense.

The PSP version makes it clear that D_800ACF7C is not a struct and is
just an array of s16, so I made that change. The struct version matched
on PS1, but now that PSP reveals that it was fake, we turn it back to
just an array.

Let me know if I missed anything! Nice to have real names for some of
these functions.
2024-07-05 10:58:54 -07:00
Luciano Ciccariello
de46f99e2e
New asset manager (#1343)
This aims to deprecate all the Splat tools in `tools/splat_ext` in
favour of a more centralised asset manager. This brings the following
advantages:

* Much faster extraction
* Faster build
* Automatically define `static` symbols or unique names whenever
`static` is not possible
* Allow to embed assets into the output binary
* Drastically simplify `Makefile` by removing all the asset build rules
* Avoid situations where it is not possible to extract and build assets
that is not 4-byte aligned

This is achieved by having the splat YAML targeting a normal C file as
data and have an external tool to take care of the following:

1. Extract asset files straight from the overlay binary file into human
readable file in `assets/st/STAGE_NAME`
2. Build assets as header files that go into `src/st/STAGE_NAME` to just
include them from any C file

This requires each stage header to have the following new format: please
see `src/st/nz0/header.c`

Built assets in `src/st` are ignored by Git.

As for now, for simplicity sake, the steps `make extract_assets` and
`make build_assets` are just executed within `make extract` exclusively
for the US version.

I plan to auto-generate files such as `src/st/nz0/tile_data.c`.

For a first iteration I am aiming to handle the following:

* [X] Extract rooms: `assets/st/*/rooms.json`
* [X] Extract room layers: `assets/st/*/entity_layouts.json`
* [X] Extract tilemap data: `assets/st/*/tilemap_*.bin`
* [X] Extract tilemap definitions: `assets/st/*/tiledef_*.json`
* [X] Extract sprites: `assets/st/*/sprites.json`
* [x] Extract entity layouts
* [X] Build rooms: `src/st/*/rooms.h`
* [X] Build room layers: `src/st/*/layers.h`
* [X] Build tilemap data: `src/st/*/tilemap_*.h`
* [X] Build tilemap definitions: `src/st/*/tiledef_*.h`
* [x] Build sprites (aka `g_SpriteBanks`)
* [x] Build entity layouts
* [x] Allow the tool to suggest how to adjust the Splat config for each
overlay

I want the tool to cover the following stages:
* [x] CEN
* [x] DRE
* ~MAD~ I do not think this can be done, it is way too different from
the other overlays
* [x] NO3
* [x] NP3
* [X] NZ0
* [x] ST0
* [X] WRP
* [x] RWRP
* ~WRP (PSP)~ Maybe in a follow-up PR

For a later iteration I plan on extracting and build:

* Entity GFX thingie
* The CLUT thingie in the header
* Uncompressed GFX data
* Cutscene data
* Blueprints
* The `src/config_us.h` thingie

---------

Co-authored-by: Josh Lory <josh.lory@outlook.com>
2024-07-02 21:38:36 +01:00
bismurphy
f7882814b0
Decompile Karma Coin func_ptr_80170008 (#1372)
The Karma Coin, surprisingly, has the largest EntityWeaponAttack of all
the weapons. For that reason, I'm targeting it next.

It has one small other entity function, so this PR decompiles that
first, prior to going ahead and decompiling the EntityWeaponAttack
itself.

Otherwise, nothing too crazy special here. I imagine decompiling the
Karma Coin will make it clear what this helper entity is.
2024-07-02 12:56:30 -07:00
Josh Lory
342bdfcdd4
Decompile DRA EntitySubwpnThrownDagger (#1369)
Shout out to @bismurphy for doing most of the initial work on this
match.

PSX:  https://decomp.me/scratch/2GysU
PSP: https://decomp.me/scratch/cjmbN
2024-07-01 19:33:45 -07:00
Josh Lory
472c455b37
Decompile DRA EntityLevelUpAnimation (#1354)
PSX: https://decomp.me/scratch/tedz6
PSP: https://decomp.me/scratch/TWe0Y

Not an exact match on PSP yet. Happy to take another pass if you want
that to also match!
2024-07-01 17:15:18 -07:00
Josh Lory
fd2bc9382e
Decompile DRA func_80129864 (#1364)
PSX: https://decomp.me/scratch/0camu
PSP: https://decomp.me/scratch/g2m4c

The previous version of the PSX decomp.me has some clues to better
variable names but I was having trouble solving the final register
mismatches.
2024-07-01 17:06:55 -07:00
sozud
e517944ab0
SsVabOpenHeadWithMode Attempt (#1362)
This PR is trying to get SsVabOpenHeadWithMode running, but I'm getting
the wrong result vs. my test app. I'm putting this up to see if others
have ideas.
c7484b6800/test.c (L154)

I check a bunch of preconditions on the test app and the implementation
so I think they are starting from the same state. The test app is able
to play the library song so I think it's OK.

The problem is that SpuMalloc returns the wrong value. See
```
_svm_vab_start[vabId] = spuAllocMem;
```

_svm_vab_start[0] is supposed to be 0x00001010 but instead we get
0x11010.


c7484b6800/test.c (L201)

```
69648 != 4112 in check_ss_vab_open_head_with_mode /home/d/sotn-decomp-2/src/pc/psxsdk/emu.cpp:306
```

The scratch for SpuMalloc is https://decomp.me/scratch/UjIPd

The version here is based off this one since I think that scratch isn't
usable yet.
4ff48d4660/psx_seq_player/lib_spu.cpp (L2462)

The scratch for func_800286E0 is https://decomp.me/scratch/msP8t
2024-07-01 11:23:21 -07:00
Jonathan Hohle
9f11c4157a
CEN, DRE, MAD, NO3, NP3, RWRP, & ST0 Stage Headers (#1356)
Decompiles stage header data for all in progress stages.

Of note is that NO3 and NP3 (and likely other future stages) use an
`AbbreviatedHeader` because their `SpriteBanks` start immediately after
`UpdateStageEntities`. There are several areas which use
`sizeof(Overlay)` to copy this data over, in those cases sprite bank
data is copied into the tail fields of the overlay but are never used.
2024-06-28 15:11:14 +01:00
Jonathan Hohle
9bf34f1ac2
Decompile PrologueScroll (#1358)
`PrologueScroll` is responsible for scrolling the prologue text
following Richter's fight with Dracula.

Co-authored-by: Jonathan Hohle <jon@ttkb.co>
2024-06-27 19:52:31 -07:00
Josh Lory
6462f2f4eb
Duplicate DRA EntitySubwpnAxeCrash (#1352)
Near-duplicate of `EntitySubwpnCrashAgunea` in RIC.
2024-06-24 11:49:21 -07:00
Josh Lory
16c0b3f174
Extract more DRA data (#1351)
Continuing the work in
https://github.com/Xeeynamo/sotn-decomp/pull/1350.
2024-06-23 22:50:56 -07:00
Josh Lory
077527d0ea
Duplicate DRA EntityHolyWaterBreakGlass (#1350)
I'm not sure if I did the data extraction correctly. There is more to
pull out of the remaining `0x106C8` section but the sizes aren't quite
lining up.
2024-06-23 20:29:17 -07:00
bismurphy
404d5da5bb
Decompile NP3 EntityGaibon (#1347)
This finishes NP3.

Gaibon's logic is extremely similar here as it is in NZ0. There are a
few differences, especially in the initialization code (which runs
before the primary switch), but as a whole, it's a copy-paste.

Slogra and Gaibon are in separate files. The only way we know this is
because they both have debugging `charal` strings which exist separately
in rodata (if they were the same file, it would reuse the same rodata
location for both strings).
2024-06-19 21:51:37 +01:00
Jonathan Hohle
d5977d931a
Decompile WRP BSS (#1337)
Move BSS definitions to code. This is the last of the ASM configured for
WRP.

---------

Co-authored-by: Jonathan Hohle <jon@ttkb.co>
2024-06-18 16:01:03 -07:00