Commit Graph

1796 Commits

Author SHA1 Message Date
bismurphy
c5d0842edd
Decompile RIC func_8015A7D0 (#892)
Just the next sequential function, this one is fairly simple. No real
comments to share beyond that.
2023-12-26 16:22:07 -05:00
bismurphy
ce6005f9a5
Decompile RIC func_80159CE4 (#888)
This one was very complicated. It has 4 different switches in it, all
with their own rodata!

It also interacts with a lot of different parts of the game, including
various unknown members of structs like g_Player, so it might be a
useful resource for starting to understand what some of that stuff is.

One goto left in it that I couldn't get rid of, the jump is between two
unexpected locations that seem very different from each other.

Scratch here if anyone would like to attempt improvements:
https://decomp.me/scratch/0k84D
2023-12-26 14:13:44 +00:00
ser-pounce
c4514d2669
Decompile RIC func_8015FDB0 (#891)
Thanks for completing the match.
2023-12-26 12:35:13 +00:00
Luciano Ciccariello
1d5155d853
Add sprite rendering (#850)
As per title.

I created a new folder called `assetx/`, that is not cleaned with `make
clean` and that contains assets that are not extracted from the game and
that we want to keep in the repo. I am not sure if we agree on this, so
I will be happy to remove it from the PR if it is an unwanted approach.

`MySetDrawMode` is implemented and it sets the texture to render. The
problem is that currently there is not a batch system in place, meaning
`MyRenderPrimitives` will operate on the latest texture set. This works
as I am using just one texture, but it will not work long-term. The PS1
uses something called Ordering Table (our `g_CurrentOt`) that contains a
list of ordered drawing calls that will be submitted to the GPU via
`DrawOTag(g_CurrentOT)`. A later PR will come to properly handle this.

The PS1 has 32 texture pages (or `tpages`, or `tp`). I am thinking to
store each tpage into 128x128 textures. I am not sure how it will work
long-term or if it would be better to just create a single 1024x512
texture with the entire vram in it. When the tpage is 0x1E the font PNG
is loaded.
2023-12-25 20:36:17 +00:00
bismurphy
1b166bced6
Decompile DRA func_80105428 (#885)
Not totally sure what this one is for, but it's connected to saving the
game.

D_801379C8.vy is very heavily used, I'm not sure what the purpose of
that SVECTOR is. But anyway, it matches.
2023-12-25 14:57:46 -05:00
Luciano Ciccariello
ac61a3139c
Extract BIN/F_GAME.BIN (#886)
Mostly a proof of concept to extract resources from `BIN/F_GAME.BIN`.
There are tons of hacks to make this work:
* Tweaked png2s to decode binaries into PNGs
* Add a `config/gfx.game.json` that describes how to extract different
sprites out of a binary file
* Coded the palette location by reading the `clut` parameter in the
source code. A clut value of `0x196` corresponds to `"palette": "0x96"`
or `"palette": 150`.
* Coded the bits per pixel for a couple of 8-bit images
* Coded the palette location of those graphics that expects the palette
from DRA.BIN instead of F_GAME.BIN
* For all the undiscovered palette, I called the files `unk` and
defaulted their palette to grey

The expectation is that sprites will slowly be documented and added into
`config/gfx.game.json` by modders and enthusiasts. This does not yet
pack back these PNGs into the binary file. The way these assets are
extracted is probably not final or perfect, but we have to start from
somewhere.


![image](https://github.com/Xeeynamo/sotn-decomp/assets/6128729/ce12ad2d-d95d-41e8-ac31-186cd36ac965)
2023-12-25 19:23:25 +00:00
ser-pounce
28e48ee71b
Decompile RIC func_8015F9F0 (#887)
Annoying asm gotos, but done.
2023-12-25 19:23:00 +00:00
Julien Augugliaro
ca66ee6fd6
Decompile DRA func_80133FCC (#836)
Should be good to go ?
2023-12-25 11:36:08 -05:00
bismurphy
c3b9be494c
Decompile DRA func_80128C2C (#884)
The next subweapon entity. This is for the lightning subweapon. Happy to
take name suggestions but for now we have a comment on the function so
doesn't really matter if we name it immediately.
2023-12-25 16:29:09 +00:00
bismurphy
0b250771c0
Decompile DRA func_80104790 (#883)
Whole lot of overlap with func_80105078, which was just merged.
2023-12-25 13:34:58 +00:00
ser-pounce
067d243418
Decompile RIC func_8015E484 (#882)
Thanks for the help on Discord again
2023-12-24 20:48:32 +00:00
Luciano Ciccariello
310d368917
Fix window flashing on WSL2 (#881)
I noticed the sound test app flashes when running on WSL2. This is due
to `MyPutDispEnv` continuously calling `SDL_SetWindowSize` even when the
parameters are the same as the previous frame.
2023-12-24 13:14:23 -05:00
Luciano Ciccariello
70d2a82688
Fix reporting for the RIC overlay (#880)
Re-generate symbols for `build/us/ric.map`. Also I moved the
`--no-default` as it was previously ignored.
2023-12-24 12:29:21 -05:00
bismurphy
a70727877c
Decompile DRA func_80105078 (#878)
Not really sure what this one does, lots of math with vectors and
matrices.
2023-12-24 12:20:19 -05:00
Luciano Ciccariello
60a167896f
Fix D_80097488 overlaps (#879)
Remove a bunch of fake symbols that were overlapping with `D_80097488`.
I created a new struct called `Pos`. Since it is very similar to
`Camera` I placed them close-by as in future we might want to merge
them.

I created some symbol hints like `D_8009748A_x_i_hi` as there are a few
functions that still use them.
2023-12-22 20:52:51 +00:00
Mark Street
fd49b82d1f
Update maspsx (--expand-li) (#877)
Once decomp.me is updated I will update the SOTN preset to include
`--expand-li`. Let me know if you run into any issues but this builds an
🆗 binary for me.
2023-12-20 21:13:37 +00:00
sozud
f7d606e331
Allow function_finder to filter on keywords (#875)
The point of this is to be able to get results only for what you want to
work on.
2023-12-20 11:52:18 -05:00
bismurphy
597f70d341
Decompile RIC func_80159670 (#876)
Nothing super special here, just another RIC function. I believe this is
a helper function for Richter's state machine, since it switches on
PLAYER.step_s.
2023-12-20 07:47:12 +00:00
bismurphy
74da2594ac
Extract RIC SpriteParts (#874)
This was done by comparing the src/servant/tt_000/spriteparts.c file to
the data I found in RIC 170AC.data.s. I then wrote a Python script to
take the data in the data file and output a C file which has all the
same formatting as that existing spriteparts.c file. This is a big chunk
of the .data section for RIC, so it's nice to have it pulled out to a C
file now.
2023-12-20 07:39:48 +00:00
bismurphy
d44abf220e
Decompile RIC CheckBladeDashInput (#873)
Richter's other special move, I think these are the only two.

Very weird logic in the initialization (everything above the switch),
but I got a match.
2023-12-19 14:32:42 -05:00
bismurphy
6898b8b608
Decompile RIC func_801572A8 (#872)
Not really sure what this does, it's called by UpdateEntityRichter 5
times. Has weird pointer caching but thankfully I got it to match.

Nice to see it using g_Player.colliders, colliders2, and colliders3, I
think we probably have those all settled now.
2023-12-19 13:09:07 -05:00
sozud
e9d43e1ae2
SsUtGetVagAtr (#870) 2023-12-19 12:55:43 -05:00
sozud
bb49cf9b96
SpuVmNoiseOff (#871) 2023-12-19 12:21:08 -05:00
sozud
9f9238dba0
_SsContResetAll (#869) 2023-12-18 18:51:33 -05:00
sozud
aaaa3fc661
Add sdk to function finder (#868) 2023-12-18 23:02:45 +00:00
Luciano Ciccariello
b54740552d
Decompile SEL func_801B76F0 (#867)
The `const int PRIM = -5;` is very weird, I am not sure what's going on
there. The struct makes sense on the surrounding functions. I am not
even sure if the function is ever called as it involves the use of a
cutscene dialogue, never seen in the SEL overlay.
2023-12-18 23:02:16 +00:00
Luciano Ciccariello
f88ded1823
PSXSDK: libgpu ext, sys (#862)
Decompile all the `ext.c` and a good chunk of `sys.c`
2023-12-18 16:27:54 -05:00
ser-pounce
ce30caa958
Makefile refactoring (#866)
Needed a break from all the asm. I realize that Makefile changes aren't
always appreciated as they can break things in unexpected ways,
especially if they come from newbies to the project (ahem), so feel free
to close this if it's not needed.

One comment about removing `/**/*.s` and `/**/*.c`: as far as I could
see there were no subdirectories, so didn't seem needed.
2023-12-18 21:22:42 +00:00
ser-pounce
23cec56a75
Decompile NP3 func_801cf7a0 (restored) (#865)
Sorry for closing pr 858, here it is again.
2023-12-18 21:18:38 +00:00
bismurphy
4b4cd960f0
Decompile RIC func_801603C4 (#864)
Mostly a duplicate of a DRA function but enough different logic to be
fairly different.

Interesting that this uses the "dead player" string which matches HD but
is different from in US DRA.
2023-12-18 20:19:50 +00:00
bismurphy
c8d99b61f1
Extract DRA strings from rodata (#863)
There are 3 strings in DRA that were being left in rodata and printed
with `FntPrint(&whatever)`, this fixes two of them (the third will first
require other stuff in rodata before it to be extracted).

I also discovered that HD uses a different string in one of those spots
which was a big surprise! Weirdly, US has a string written in Japanese
(though using Latin characters) and HD has a string written in English.
2023-12-18 14:54:38 -05:00
bismurphy
4a744f382c
Decompile RIC CheckHighJumpInput (#861)
The function that keeps track of if Richter has pressed down-up-cross to
do a High Jump move.

This is the first time we have a button combo being tracked outside of
DRA, so I moved the ButtonComboState struct from dra.h to game.h.

When the input succeeds, a function is called, so I've named that
function DoHighJump and also made general changes to that function to
bring it up to date with our current code standards (like FIX()).

I think those are the main highlights!
2023-12-18 19:22:45 +00:00
Luciano Ciccariello
692c28b2af Amend suggested changes to update_animation
Thanks @bismurphy for the suggestion!
2023-12-18 18:27:18 +00:00
ser-pounce
86d15d4100
Decompile and dedupe func_801D2320 (+9 dupes) (#860)
Probably needs some variable name fine tuning but the logic is mostly
clear.
2023-12-18 17:59:47 +00:00
sozud
9ebe4150ae
spu_r (#856)
This one is pretty odd, not sure if there's better ways to write this or
not.
2023-12-17 14:48:38 -05:00
ser-pounce
bc0b208ed1
Decompile NP3 func_801CF778 (#857)
Use of ext member seems appropriate in context.
2023-12-17 15:22:31 +00:00
Luciano Ciccariello
21f158a7c7
Load assets json (#851)
Uses a small JSON parsing library called cJSON (MIT license) to parse
the assets `equipment.json` and `accessory.json` and load them in memory
rather than hard coding it or pre-building it.
2023-12-17 14:10:11 +00:00
ser-pounce
77b385286a
Decompile SEL func_801B3F94 + refactor (#855)
Started off as a dedupe, but DRA func_80102E04 and SEL func_801B3F94
ended up being slightly different. Also refactored some symbols.
2023-12-17 14:06:31 +00:00
sozud
ea6fd198dd
libsnd libspu funcs (#854)
Co-authored-by @sonicdcer
2023-12-17 02:56:26 -05:00
ser-pounce
3054be9d5d
Dupe EntityBreakable, CreateEntityFromCurrentEntity (#853)
Deduping EntityBreakable needs more disassembly in rwrp 8DF0
2023-12-16 10:09:15 -08:00
ser-pounce
126a3dcaff
Dedupe FindFirstUnkPrim (#852)
Follows discussion on https://github.com/Xeeynamo/sotn-decomp/pull/848,
not too sure about interim function name.
2023-12-16 08:53:28 -08:00
Luciano Ciccariello
f640b1a936
Synchronise asset config with the latest headers (#849) 2023-12-15 13:58:26 -08:00
ser-pounce
a4d7b18878
Decompile dupe function rwrp func_801A2550 (#848)
Hopefully straightfoward
2023-12-15 13:54:27 -08:00
ser-pounce
b04d5046c2
Decompile NP3 func_801D0B40 (#847)
Thanks for the help on Discord, resolves #718.
2023-12-15 09:04:14 +00:00
Luciano Ciccariello
df00eb8a49
Sounds sim: Import 5D6C4 and pads (#846)
Import 5D6C4. Also split `pads.c` as it did not have much sense to be in
`47BB8` as the latter is purely related to the VSync and the sim driver.
2023-12-14 14:41:05 -08:00
Luciano Ciccariello
4ae33f00d3
Import 5D6C4 data (#845)
More data importing and more documentation as data is providing more
context.

I also found a good amount of "fake" symbols, like in `DrawHud` and
`DrawHudSubweapon`.
2023-12-14 08:45:07 -08:00
bismurphy
3951b44a6f
Decompile RIC func_8015E800 (#844)
I think this is the last one of those messy collider functions.

Will add collider enums as usual.
2023-12-14 08:08:19 -08:00
bismurphy
4aa2175516
Decompile RIC func_8015EE28 (#843)
This one is messy but it works. Another of those big collider functions.

Had to split g_Player.colliders into two arrays, so now we actually have
3 arrays of colliders going on. Might have more splitting to come.

We have `g_Player.colliders2[i].effects >> 4` which used the wrong
`sra`/`srl` instruction, so this indicates that it needs to be u32, not
s32.
2023-12-13 16:52:36 -08:00
Luciano Ciccariello
b017890c7d
Sound sim: Implement SetDefDispEnv (#842)
Simply allow to resize the window as the game switches resolutions
between in-game and menu
2023-12-13 16:41:56 -08:00
Luciano Ciccariello
e37320de08
Menu refactor and portability (#841)
Quite big PR that aims to document most of `menu.c` and make the code
more portable.

I had to declare `u16* func_80106A28(u32 arg0, u16 kind);` on the top of
`main.c`. Without it the compiler assumes it returns an `int`, which is
not big enough for 64-bit pointers. It took me a while to realise that
was the cause of the crash. We will have more of them in the future.

EDIT: Ignore the commit `******* FIX`. It was meant to be squashed for a
clearer commit history but I forgot to do it.
2023-12-13 16:32:59 -08:00