Commit Graph

2576 Commits

Author SHA1 Message Date
bismurphy
943828b370
Decompile Axelord Shield func_ptr_80170024 (#1472)
Next one! Lots of collisions here which is interesting.
2024-08-04 09:55:34 -07:00
Luciano Ciccariello
1f17a2a133
Refactor File helper functions (#1471)
Use the following input endpoints `FileOpenRead`, `FileReadToBuf`,
`FileAsString` and `FileUseContent`.

There was a lot of redundant and inconsistent code scattered across all
the functions responsible of opening and processing files. I also
realised the purpose of some File helpers was not entirely clear, so I
spent some effort to document them.

This is a small part of a bigger effort on refactoring `sim_pc.c`. I am
also planning on adding support for paths such as `disk://` to load from
`disks/us/`, `asset://` to load from `asset/`, `card://` to start adding
support for simulated memcards and so on. This is setting the very
basics to plan that out.
2024-08-04 17:36:43 +01:00
Jonathan Hohle
10d9723493
Decompile func_ptr_80170008 in w_007 (#1467)
Decompile's `w_007`'s `func_ptr_80170008`.
2024-08-03 12:02:33 -07:00
SynaMax
22d3bc5ad3
Added and updated SFX references (#1469)
Stopping at 0x633 (`SFX_UI_SELECT`) for now, but will continue to add
and update more sfx references soon.

So far we have 51 out of a potential 736 sfx IDs (`0x8E0` - `0x600`).  

For what it's worth, the last valid sound ID I have listed in my
spreadsheet is `0x8D2` found in `DRA`, `RIC`, `BO4`, `BO6`, and `RBO5`
so the actual number might be 722 enum IDs, but we'll see what happens
since the last sfx group in the list belongs to vabid 3.
2024-08-03 11:50:03 -07:00
SynaMax
8bdde29673
More SFX additions to enum (#1468)
I decided to rename `SFX_SKULL_HIT` to `SFX_METAL_CLANG`, as well as
`SFX_SWORD_SWISH` to `SFX_WEAPON_SWISH`.

These are more generic names that better match up with the actual sound.
While `SFX_SWORD` is mainly used for sword weapon cues, it is used for
other weapon entities so I renamed it.

Same idea also applied to `METAL_CLANG`; it's mainly used for the CGI
spinning Stone Skull enemies but it also shows up in CEN as an elevator
sound cue.

I also used `SFX_RIC_RSTONE_TINK` as an abbreviation for the Rebound
Stone "tink" sfx, to help keep these names short.
2024-08-02 18:58:30 -07:00
sozud
74560d8545
Function finder fixes (#1466)
Currently function_finder misses functions since we don't continue to
fetch if there's another page of results. However just increasing the
page size makes the script super slow.

This adds caches to the zip file and result fetching to try and get this
running at a reasonable speed for `weapon`. We also fetch until `next`
is null and increase the page size so all the results are fetched. This
runs about 12 minutes on my system now. Results look like this
https://gist.github.com/sozud/69aeafcc671d6354da474db952e8afef
2024-08-02 12:28:12 -07:00
bismurphy
50f5ad9dca
Decompile Herald Shield EntityWeaponShieldSpell (#1464)
Nothing super special, pretty similar structure to some other shield
spells.
2024-08-02 09:25:32 +01:00
SynaMax
1eceab45db
More SFX added to enum (#1465)
Slowly adding more sounds and updating all the references in the
codebase.
2024-08-02 09:24:13 +01:00
Jonathan Hohle
cb5d6462ed
Decompile func_ptr_80170008 of w015 (#1463)
Decompiles `func_ptr_80170008` of `w015`.
2024-08-01 14:54:57 -07:00
sozud
a869b920b9
Start documenting sfx scripts (#1459) 2024-08-01 12:23:03 -07:00
bismurphy
c71a3dcf83
Decompile Herald Shield func_ptr_80170024 (#1461)
Continuing along. This one was a bit tough to work out with all the gte
transformations, but thankfully we made it work.
2024-08-01 10:38:56 -07:00
Jonathan Hohle
ade2b75f26
Decompile memmove (#1462)
Decompile `libc2`'s `memmove`.
2024-08-01 10:15:03 -07:00
Jonathan Hohle
b762258c33
Decompile Remaining w_037 (#1460)
Decompile `EntityWeaponAttack` and `func_ptr_80170008`.
2024-08-01 09:14:52 -07:00
SynaMax
e0647f9ade
Added SFX enum and SFX_RIC_WHIP_RATTLE_A (#1458)
Starting off with something simple. Per
[sozud](https://github.com/sozud)'s suggestion in #1441 , I put in a new
enum for sounds. There's only one reference to Richter's whip sound in
the codebase so far. According to my research, BO6 and RBO1 reference
this ID as well.

There's several other whip rattle sounds (0x603-0x606) immediately
following the commonly heard 0x602 cue. Unless BO6 or RBO1 uses random
sound calls (like Alucard's randomized grunts), I don't believe these
are referenced in the game and are unused.
2024-08-01 07:49:36 -07:00
Jonathan Hohle
d011e9eb70
Decompile w_038, w_039 EntityWeaponAttack (#1457)
Decompiles `EntityWeaponAttack` for `w_038` and `w_039`. These match
several other `EntityWeaponAttack` methods with the addition of a
conditional call to `CreateEntFactoryFromEntity` at the end.
2024-07-31 22:48:19 +01:00
Jonathan Hohle
d89e1ea8c1
Symbol Matching (#1455)
Matching several symbols for consistent names across duplicates.
2024-07-31 22:44:37 +01:00
bismurphy
c8a080e849
Decompile Dark Shield EntityWeaponShieldSpell (#1454)
Essentially more of the same.
2024-07-31 10:57:18 -07: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
3491326b00
Decompile Dark Shield func_ptr_80170024 (#1453)
Yet another one, seems many of these shields are padding out the struct
as we go since we now have an unkA0.
2024-07-29 13:36:48 -04:00
bismurphy
a9d08c0263
Decompile Goddess Shield EntityWeaponShieldSpell (#1452)
Next shield, these seem to be coming together nicely, I'm looking
forward to being able to study and compare all the shields when they're
done.
2024-07-29 08:56:28 -04:00
bismurphy
41159bab18
Decompile Goddess Shield func_ptr_80170024 (#1451)
Nothing very special here, each shield seems to have different
func_ptr_80170024 effects and this is one of them.
2024-07-28 20:37:18 -04:00
Luciano Ciccariello
a819daaf14 Downgrade splat 0.24.7 to 0.24.6 2024-07-29 00:01:16 +01:00
Luciano Ciccariello
b5b1c411db Fix progress for overlays that have no nonmatchings folder 2024-07-28 18:48:03 +01:00
bismurphy
a2ad5683be
Decompile EntityWeaponAttack for all remaining shields (#1450)
This PR is big, but it's because these functions are almost perfect
duplicates of each other. I figured it would make more sense to process
them all at once than to have 9 more PRs for essentially the same
function.

This basically handles the animation of holding up/putting down a
shield, so it makes sense that the shields are all mostly the same.

The differences are with shields that have an effect when something hits
them - this includes the Iron Shield, Dark Shield, and Herald Shield.
Aside from these ones, this function is a perfect copy-paste, only
requiring variables to be renamed. And with those three, it's still the
same function, just with a few lines added to create their special
effect. Search for "hitFlags" to see the effects on Iron and Herald, and
for ext.darkShield to see the madness going on with the Dark Shield.

Please let me know if you'd like this PR handled differently; hopefully
despite the size here, the level of shared code makes it reasonable to
have such a big PR.
2024-07-28 12:06:34 -04:00
Jonathan Hohle
85cbb974cd
Match Functions with Same Name in dups (#1449)
The duplicates report has several false negatives when a function has
the same name as another function which has not been decompiled. This
affects overlays which share many of the same function names (e.g.
`EntityWeaponAttack`).

The duplicates tool now parses the `INCLUDE_ASM` macro to extract the
path and ASM file. It then uses that when determining whether or not
each ASM file is actually included or not. Previously, only the function
name was checked, so if any `INCLUDE_ASM` file had the target function
name, it would be marked as not decompiled.

Before:

% | Decomp? | Name | Asm Path

-----|-------|-------------------------------|--------------------------------
| 1.00 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_008/EntityWeaponAttack.s
| 1.00 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_009/EntityWeaponAttack.s
| 0.91 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_010/EntityWeaponAttack.s
| 1.00 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_011/EntityWeaponAttack.s
| 0.98 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_025/EntityWeaponAttack.s
| 1.00 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_026/EntityWeaponAttack.s
| 1.00 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_027/EntityWeaponAttack.s
| 1.00 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_028/EntityWeaponAttack.s
| 0.97 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_058/EntityWeaponAttack.s

After:

% | Decomp? | Name | Asm Path

-----|-------|-------------------------------|--------------------------------
1.00 | true | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_008/EntityWeaponAttack.s
1.00 | true | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_009/EntityWeaponAttack.s
0.91 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_010/EntityWeaponAttack.s
1.00 | true | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_011/EntityWeaponAttack.s
0.98 | false | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_025/EntityWeaponAttack.s
1.00 | true | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_026/EntityWeaponAttack.s
1.00 | true | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_027/EntityWeaponAttack.s
1.00 | true | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_028/EntityWeaponAttack.s
0.97 | true | EntityWeaponAttack |
../../asm/us/weapon/nonmatchings/w_058/EntityWeaponAttack.s

(note: `w_008`, `w_009`, and `w_011` are decompiled in my workspace, but
not in GH)

Co-authored-by: Jonathan Hohle <jon@ttkb.co>
2024-07-28 11:48:41 -04:00
bismurphy
93c51db4fd
Decompile Shaman Shield EntityWeaponShieldSpell (#1448)
Alucard/Alucart shields are done, next is Shaman Shield. Lots of these
shield spells are very similar.
2024-07-28 07:37:33 -04:00
bismurphy
bdfc152bb4
Decompile Alucard Shield EntityWeaponAttack (#1447)
Finishes the Alucard shield, which is nice!
2024-07-27 17:22:15 -04:00
Josh Lory
f0b9c43819
Decompile func_ptr_8017000C_w_016 (#1446)
https://decomp.me/scratch/pmlaG
2024-07-27 16:49:07 -04:00
Josh Lory
a473a1fed0
More weapon funcs (#1443)
Includes:

* [func_ptr_80170004_w_010](https://decomp.me/scratch/SH0iK)
* [func_ptr_80170008_w_043](https://decomp.me/scratch/LeMEl)
* [EntityWeaponAttack_w_045](https://decomp.me/scratch/4oeHu)
2024-07-27 15:26:32 -04:00
bismurphy
8722459b8c
Decompile Alucard Shield EntityWeaponShieldSpell (#1445)
Shield work seems to be going well! Here's the next one.
2024-07-27 14:04:55 -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
47b3b3eb2c
Decompile w58 (Alucart Shield) EntityWeaponAttack (#1440)
Finishing the Alucart Shield.

Noticed we are doing stuff with offset 0xAC which sounds a lot like the
one in the Player entity, so I called it anim for now especially since
it seems connected with animations.

This finishes this shield. I'm going to try to go through all the
shields in the weapon overlays and get them done, they seem like some of
the most complicated since a lot of the shield spells do some kind of
crazy stuff with graphics.
2024-07-26 23:27:03 -04:00
Josh Lory
42107e8bb8
Various weapon pointer funcs (#1442) 2024-07-26 21:32:40 -04:00
bismurphy
12f8f7149d
Decompile w58 (Alucart Shield) Shield Spell (#1439)
This modifies a variable at 0x80097420, I noticed that was in the
g_UnkGraphicsStruct, so I went through all the uses of that variable and
made them all use the struct.
2024-07-26 19:13:51 +01:00
bismurphy
4b425c4cd0
Decompile RIC func_8015A9B0 (#1438)
This finishes RIC.

Very similar to the most recent DRA function 80115394, so noted that
here.
2024-07-26 12:29:12 -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
SynaMax
e81fbf3ca1
SFX defines for Karma Coin (#1423) 2024-07-26 08:44:27 -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
Josh Lory
ef4bd2feef
Idea: allow postfixing of func names (#1435)
Now that @sozud has added function similarity, I wonder if it's worth
including prefix matches in the results of function_finder. This would
let us name a scratch ex: `EntityWeaponAttack_w_053` and have it still
show up in functions.md. Thoughts?
2024-07-26 07:59:12 -04:00
sozud
1e0458ff10
cd funcs (#1431)
some of these by @joshlory
2024-07-25 07:54:53 -04:00
sozud
3ae8f4d883
Compare function similiarity in function_finder (#1432)
This changes the psx function finder to compare the local and remote asm
to find a match. Right now there's a lot of false positives due to name
collisions. The new output looks like this:

https://gist.github.com/sozud/4eaa80c2ebb475551986b4f55d42d036

This should be off by default for the other platforms but I can't check
saturn locally right now.
2024-07-25 08:30:34 +01:00
Josh Lory
91ddf19d8f
Decompile NO3 func_801CE740 (#1433)
https://decomp.me/scratch/inbZb
2024-07-24 20:43:23 -04:00
sozud
1d53f6e715
cd funcs (#1429)
some funcs by @joshlory
2024-07-22 22:20:33 +01:00
sozud
4fe662c4e3
Import gte code, candle test button (#1422)
This imports the psycross gte code and hooks it up. I added a hotkey to
create a candle with a subweapon. As far as I can tell you can't give
yourself a subweapon directly without breaking stuff since
EntityBreakable and the entity it spawns set up various things. I used
this to test the gte. This also fixes a couple of function pointers like
CheckCollision to fix the cross animation. This removes a few gte
functions we previously implemented in favor of their versions, I'm not
sure about the tradeoffs there.
2024-07-22 22:20:01 +01:00
Mark Street
20c3370f4f
Use allegrex assembler for PSP (#1424)
I moved *some* of the PSX-specific stuff out of the common `Makefile`
and into the `Makefile.psx.mk` -- there is still more that could be done
here, but this should be enough to have the correct rules for PSX and
PSP with the desired assembler.


Also threw in a bonus feature where I've removed the `move` macro from
`macro.inc` because `maspsx` does this automagically for you now.
2024-07-22 15:36:28 -04:00
sozud
6d727283f1
PSX libcd funcs (#1426) 2024-07-22 18:36:10 +01:00
bismurphy
54009dbdcb
Attempt fixing analyze_calls build issue (#1428)
Iterating on this problem in master.

Now that wrp/rwrp are sharing so much code, analyze_calls is having
trouble telling what functions call each other in which overlay.

I think this will resolve all the issues we have for now, but I'm sure
more will appear over time.
2024-07-22 12:32:19 -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