Commit graph

381 commits

Author SHA1 Message Date
Hat Kid a857061e96
jak2: focus-test? macro, fix (zero? (logand ...)) -> (not (logtest? ...)) detection (#2321)
There are *a lot* of file changes and while I have carefully gone
through every gsrc change to fix up manual patches, there might still be
spots that I missed.
2023-03-14 22:57:31 -04:00
ManDude 0cf285ef99
[jak2] decomp cleanup of traffic things + fix stadium crash (#2319) 2023-03-11 22:45:14 +00:00
ManDude 0c64d48b0d
[jak2] force-envmap? hack (#2316)
Also affects texscroll and ripple, but I'm not sure what would be good
places to test those.
2023-03-11 22:13:55 +00:00
Hat Kid a1dee19d0d
decomp: finish stadium-obs (#2294)
Co-authored-by: water <awaterford111445@gmail.com>
2023-03-11 15:55:39 -05:00
ManDude 77242bd12e
[jak2] script-eval macro (#2315)
turns
```lisp
      (eval! (new 'stack 'script-context (process->ppointer self) self (the-as vector #f)) '(teleport))
      (eval! (new 'stack 'script-context (process->ppointer self) self (the-as vector #f)) (-> arg0 on-goto))
```
into
```lisp
      (script-eval '(teleport))
      (script-eval (-> arg0 on-goto))
```
2023-03-11 10:45:16 -05:00
ManDude 9cb2963cde
add debug joint renderer (#2309) 2023-03-10 03:12:44 +00:00
water111 9c7b86c595
[jak2] fix blerc profile bar issue (#2307)
Fix so the profile bar doesn't do something silly when
`merc-blend-shape` returns early, skipping the part where `end-time` is
set.
2023-03-10 02:10:43 +00:00
Tyler Wilding 021bae08ec
d/jak2: fix elevator issues and cleanup script-context new method (#2304)
This fixes the issue where elevators leave you behind (stack structure
related)

At the same time I cleaned up some things I found along the way, most
notably changing `script-context`'s `basic` field to `object` as
non-basics use this method as well.

Fixes #2305
2023-03-09 20:03:43 -05:00
water111 0db9b288e4
[merc2] Support texscroll, use in jak 1 in more places, fix envmap bug (#2303)
Three main changes:

- Adds support for the texture scrolling effect used on conveyor belts,
and turn it on for jak 2.
- Use merc instead of generic in jak 1 for ripple/water/texscroll stuff
(non-ocean water, lava, dark eco, etc). This is a pretty big speedup in
a lot of places.
- Fix a really old bug with blending mode used to draw environment maps.
The effect is that envmaps were half as bright as they should have been.

As usual, there's a flag to go back to the old behavior on jak 1. Set
these to `#t` to use generic like we used to.
```
*texscroll-force-generic*
*ripple-force-generic*
```

The format has changed, and everything must be rebuilt (C++, FR3's, GOAL
code)
2023-03-09 20:01:22 -05:00
water111 0b8b927315
[merc] support eyes through merc (#2300)
Support rendering eyes with merc for both jak 1 and jak 2.

For jak 1, everything should look the same, but merc will be used to
draw eyes. This means that jak is now fully drawn with merc!

For jak 2, eyes should draw, but there are still a few issues:
- the tbp/clut ptr trick is used a lot for these eye textures, so
there's a lot that use the wrong texture
- I had to enable a bunch more "texture uploads" (basically emulating
the ps2 texture system) in order to get the eyes to upload. It would be
much better if the eye renderer could somehow grab the texture from the
merc model info, skipping the vram addressing stuff entirely. I plan to
return to this.
- I disabled some sky draws in `sky-tng`. After turning on pris2
uploads, the sky flashed in a really annoying way.
2023-03-08 18:18:35 -05:00
water111 d6bd437ea1
[merc] support up to 64 effects (#2292) 2023-02-27 21:02:47 -05:00
water111 2c12a4e00b
[jak2] WIP minimap (#2280)
Work in progress minimap. Known issues:
- "path finding" doesn't appear to work - it gets stuck forever in many
cases
- some nasty patches around timer-based code
- jak arrow blending issues
- would be nice to make it higher resolution

if the search is forced to terminate due to iteration/time limits, the
icon is not in the right place

![image](https://user-images.githubusercontent.com/48171810/221432792-678d6124-a6a6-4875-a91f-7eceedbfec98.png)
2023-02-27 19:51:14 -05:00
ManDude 1d0a5ade8d
[jak2] minor decomp cleanup + add force actors and sprite pc hacks (#2291)
I didn't actually visually notice much of a difference with these hacks
unlike in Jak 1, but I also avoided checking the missions thoroughly
since the game crashes very often right now.
2023-02-28 00:35:57 +00:00
Tyler Wilding c3310e1833
docs: fix method docstrings and grab @file comment blocks to use as a file description (#2289) 2023-02-27 18:58:01 -05:00
ManDude e1e6695e92
[jak2] merc lod hacks + region debugger + make level heap less massive (#2285) 2023-02-27 18:45:32 +00:00
water111 e48ae247c4
[jak2] fix palace rotation and sprite glow depth test (#2269)
- Disable depth test for sprite glow (VU1 programs only `sq.xy` and
leaves `z` alone, which has Z_MAX from the template)
- Fix tfrag/tie/shrub issues when `use-camera-other` is set.
2023-02-26 09:52:04 -05:00
Tyler Wilding 90d5e83d9e
d/jak2: finish forest-obs (#2266) 2023-02-26 09:49:16 -05:00
ManDude 190fa4bbe8
[windows] make the games start up in the user's preferred system UI language (#2267)
Where applicable, of course.

My system language is set to English so I actually can't test this. If
anyone has their Windows language (NOT LOCALE) set to Spanish, German,
French, Italian or Japanese please test this.

Fixes #1734 

Also fixes the opengoal debugger on Windows and fixes the decomp for
`menu` which was causing some crashes related to input handling.
2023-02-26 09:46:57 -05:00
water111 8a363c2fc9
[jak2] fix foreground light calculation (#2254)
Fixes the abrupt change in lighting when walking around here

![image](https://user-images.githubusercontent.com/48171810/221382856-17f0ec18-1ce8-40f9-b65c-a59cf2d7d93f.png)
2023-02-25 17:55:55 -05:00
water111 3f1f443d58
[jak 2] fix boot, increase level heap sizes (#2252)
Increase level heaps and borrow heaps. The level heap increase was
likely not needed, but better safe than sorry. We allocate the 128 MB
main heap anyway so there's no harm.

Also fix the crash when using `-boot`. As I thought it was just a
one-line typo in the kernel.
2023-02-25 15:20:17 -05:00
ManDude ad9a532ff9
[jak2] text aspect ratio fixes (#2251)
Fixes the aspect ratio of the font renderer (Jak 2 does not need the
same hacks as Jak 1), the custom letterbox/pillarbox sizes and fixes the
heap display.

---------

Co-authored-by: water <awaterford111445@gmail.com>
2023-02-25 19:27:58 +00:00
water111 909da024fc
[decomp] ctywide-obs (#2250)
finish this up
2023-02-25 14:00:16 -05:00
ManDude 4b8b2abbed
port pckernel to Jak 2 (#2248)
Adds the `pckernel` system to Jak 2, allowing you to do the PC-specific
things that Jak 1 lets you do like change game resolution, etc.

In other to reduce the amount of code duplication for something that
we're gonna be changing a lot over time, I split it into a few more code
files. In this new system, `pckernel-h.gc`, `pckernel-common.gc`
(previously `pckernel.gc`) and `pc-debug-common.gc` are the files that
should be shared across all games (I hacked the Jak 2 project to pull
these files from the Jak 1 folder), while `pckernel-impl.gc`,
`pckernel.gc` and `pc-debug-methods.gc` are their respective
game-specific counterparts that should be loaded after. I'm not fully
happy with this, I think it's slightly messy, but it cleanly separates
code that should be game-specific and not accidentally copied around and
code that should be the same for all games anyway.
2023-02-25 10:19:32 -05:00
Matt Dallmeyer e89f0770dc
Fix Jak 2 warp gates (#2244) 2023-02-24 19:33:27 +01:00
Hat Kid 2d8ad39fea
jak2: add back some pc port debugging tools and add palace-scenes to gsrc (#2240)
Ports some of the custom PC port debugging code from Jak 1, such as the
entity debugger, Anim Tester X and part tester, to Jak 2 and gives the
PC menu code the same treatment Jak 1 received recently in #2216.
Some adjustments have been made to make things work in Jak 2 and some
stuff is still incomplete.
The majority of the default PC menu code has been left commented out in
preparation for @ManDude's plan to port the rest of the Jak 1 `pckernel`
features to Jak 2.

Also adds the code for `palace-scenes` to gsrc as that seems to have
been missed.
2023-02-23 21:39:02 +00:00
water111 08ce65fd9b
[jak2] add sprite glow renderer (#2232)
Adds the "sprite glow" renderer, which is responsible for the glowing
lights.
2023-02-20 20:25:45 -05:00
Hat Kid d946a09a99
decomp: palcab-obs (#2222)
Co-authored-by: water <awaterford111445@gmail.com>
2023-02-18 15:59:34 -05:00
water111 b7cfd80b14
set up fog for jak 2 (#2223)
![image](https://user-images.githubusercontent.com/48171810/219878142-8ad7c154-9f52-4ad8-a315-1c932e24cd4b.png)
2023-02-18 15:45:13 -05:00
Hat Kid f452a504e6
decomp: race-* files (#2224) 2023-02-18 15:45:00 -05:00
Hat Kid 7a2575fd23
decomp: meet-brutter (#2218) 2023-02-18 10:30:29 -05:00
ManDude 324def1303
split new pc features in some files into their own code files + address some old issues + ripple graphics improvements (#2216)
Moves PC-specific entity and debug menu things to `entity-debug.gc` and
`default-menu-pc.gc` respectively and makes `(declare-file (debug))`
work as it should (no need to wrap the entire file in `(when
*debug-segment*` now!).

Also changes the DGO descriptor format so that it's less verbose. It
might break custom levels, but the format change is very simple so it
should not be difficult for anyone to update to the new format. Sadly,
you lose the completely useless ability to use DGO object names that
don't match the source file name. The horror!

I've also gone ahead and expanded the force envmap option to also force
the ripple effect to be active. I did not notice any performance or
visual drawbacks from this. Gets rid of some distracting LOD and some
water pools appearing super flat (and pitch back for dark eco).

Fixes #1424
2023-02-13 21:39:14 +00:00
water111 ed38adc2a7
[tie] support per-proto visibility flags (#2212)
Jak 2 adds a feature to disable protos in TIE. It's used to hide things
like steps for a future mission in ruins, and also to hide the static
version of the tower when it switches to the merc version for the
cutscene:


![image](https://user-images.githubusercontent.com/48171810/218270077-d8c52235-ddbf-4194-80f6-b8aa1eeeb7ec.png)
2023-02-11 12:00:05 -05:00
water111 e26efcc4f3
[jak 2] add lightning renderer (#2203)
Implements the jak 2 lightning renderer as an alternate path through
Generic2. Also set up some generic stuff in the goal code.

There is a problem with the texture pool, which doesn't support the case
where two textures have the same tbp, but different cluts. So lightning
is often the wrong color (usually red).
2023-02-09 19:11:13 -05:00
Tyler Wilding 65812f722c
d/jak2: seal-at-waterslums working, and do a pass through all missions (#2199)
I did a pass through all missions, fixing issues as they came up. Also
got `seal-at-waterslums` working -- the best mission in the game 🥳

Co-authored-by: water <awaterford111445@gmail.com>
2023-02-09 18:40:01 -05:00
Hat Kid 67d4eda169
decomp: hover-* files, wasp, crimson-guard-hover, flamer, target-turret, drill-turret, jellyfish (#2198)
Manual patches:

- `drill-turret`: The static data for `*turret-13-path*`,
`*turret-14-path*` and `*turret-15-path*` was decompiled by hand and the
integers in the `set-speed-mult` events have been replaced with boxed
integer arrays that contain only that integer in order to make the
compiler happy. To that effect, the event handler in `target-turret` was
changed to access that array instead of just accessing the int.
- `hover-nav-control`: In `hover-nav-control::10`, `arg2` is usually a
`vector`, but there are some places where it is called with `#t` as
`arg2` and, subsequently, crashes the game because it tries to access
the `quad` of `arg2` if `arg2` is truthy. To mitigate this, the
condition `arg2` has been replaced with `(and (!= arg2 #t) arg2)` (in
this case, it would jump to the `else` that just resets the `dest-vel`
and `transv` `quad`s)
- `drill-baron`: The static data for `*drill-ship-turret-speed-event*`
has been decompiled by hand.

TODOs:
- Jellyfish crash the game
- Destroying the metalhead eggs that are on the breakable wall crashes
the game (already happened with the Peacemaker before)
- Figure out why static data of type `turret-path-event` doesn't
decompile

The docs for all the hover-nav and nav-network code could use some love
in the future, I'm not smart enough to figure out what any of that code
actually means, but it seems to work...

Also threw in the fix for the ▲ that was accidentally left commented
out.
2023-02-09 18:22:56 -05:00
Hat Kid 4ee402984f
decomp: citizen-* files, metalhead-* files, civilian, guard, hal3-course (#2194)
No more ghost town!

Manual patches:

- `hal3-course`: In `(anon-function 17 hal3-course)`, the decompiler is
doing something strange with `s3-0` that fails to compile, so I just
removed the `set!` and inlined the condition in the `when`.
- `guard`: Rewrote `(.mula.s)` stuff
2023-02-07 19:56:06 -05:00
water111 45f7770ca2
[decomp] finish up nav-graph, traffic-engine, traffic-manager, height-map (#2191)
Some of these were almost done, just needed a few more types.
2023-02-05 18:16:58 -05:00
Tyler Wilding a83bd49426
d/jak2: finish onin-game and resolve type-hinting (array object) elements (#2188)
Fixes https://github.com/open-goal/jak-project/issues/2047
2023-02-04 20:36:30 -05:00
water111 65eef8ff26
[jak2] pc-hook for pris texture upload (#2184)
Fixes a bunch of hud textures:


![image](https://user-images.githubusercontent.com/48171810/215919174-b6ff9af7-0408-4e97-b142-0fbbeafa196a.png)
2023-01-31 20:36:07 -05:00
Tyler Wilding b72383964f
d/jak2: cleaning up the remainder of unblocked / unclaimed files (#2171)
Co-authored-by: water <awaterford111445@gmail.com>
2023-01-31 18:32:50 -05:00
water111 71cb1aef6f
[merc2] support vertex updates, use this for blerc in jak 1 and jak 2 (#2179)
This PR adds a feature to merc2 to update vertices. This will be needed
to efficient do effects like blerc/ripple/texture scroll. It's enabled
for blerc in jak 1 and jak 2, but with a few disclaimers:
- currently we still use the mips2c blerc implementation, which is slow
and has some "jittering" because of integer precision. When porting to
PC, there was an additional synchronization problem because blerc
overwrites the merc data as its being read by the renderers. I _think_
this wasn't an issue on PS2 because the blerc dma is higher priority
than the VIF1 DMA, but I'm not certain. Either way, I had to add a mutex
for this on PC to avoid very slight flickering/gaps. This isn't ideal
for performance, but still beats generic by a significant amount in
every place I tested. If you see merc taking 2ms to draw, it is likely
because it is stuck waiting on blerc to finish. This will go away once
blerc itself is ported to C++.
- in jak 1, we end up using generic in some cases where we could use
merc. In particular maia in village3 hut. This will be fixed later once
we can use merc in more places. I don't want to mess with the
merc/generic selection logic when we're hopefully going to get rid of it
soon.
- There is no support for ripple or texture scroll. These use generic on
jak 1, and remain broken on jak 2.
- Like with `emerc`, jak 1 has a toggle to go back to the old behavior
`*blerc-hack*`.
- In most cases, toggling this causes no visual differences. One
exception is Gol's teeth. I believe this is caused by texture coordinate
rounding issues, where generic has an additional float -> int -> float
compared to PC merc. It is very hard to notice so I'm not going to worry
about it.
2023-01-31 18:23:39 -05:00
Tyler Wilding 22bae7fbe0
g/jak2: Add missing DGO files to game.gp lost in the shuffle (#2178)
When I cleaned up the `game.gp` some DGOs were no longer referenced
because my first dependency script omitted them -- thinking they weren't
required. From the perspective of the source files they indeed weren't
required but we still have to produce the DGO file.

also works around #2177
2023-01-30 20:45:45 -05:00
Tyler Wilding 18507bc78e
d/jak2: get portrun working and decompile a bunch of miscellaneous files (#2169) 2023-01-28 19:36:57 -05:00
Tyler Wilding 4876b6af21
g/jak2: cleanup target-board a bit, add a new feature (#2154) 2023-01-28 18:44:29 -05:00
Tyler Wilding e6f55b9b55
d/jak2: decompile all *-texture files except castle-texture (#2149)
Fixes https://github.com/open-goal/jak-project/issues/2051
2023-01-28 17:37:37 -05:00
Hat Kid 8b21a55906
decomp: blerc, ripple, under-* files (#2163)
Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2023-01-28 16:02:58 -05:00
Hat Kid e0ee9b6a81
decomp: drill-obs, drill-obs2, drillmid-obs, drill-panel, drill-spool (#2152)
Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2023-01-28 15:41:48 -05:00
Hat Kid fa8c789dcd
decomp: eye (#2148) 2023-01-28 15:17:49 -05:00
water111 0fcc7eb8e9
[merc2] Support emerc (#2147)
This adds environment mapping support to `Merc2`, and turns it on for
Jak 1 and Jak 2.

- The performance is much better
- Jak 1 can be toggled back to the old behavior with `(set! *emerc-hack*
#f)`. The new environment mapping is identical to the old one everywhere
I checked.
- Jak 1 still falls back to generic for ripple/texscroll/blerc/eyes -
there's still no dynamic texture or vertex updating support. The eye
detection stuff will sometimes flag stuff as eyes which is not eyes,
which is fine, but means that generic will be used in some places where
emerc could be used. For example, the shiny plates on jak's arm will be
drawn with generic because jak has eyes.
- Jak 2 hasn't been checked super carefully against PCSX2 yet.
- Jak 2 still isn't technically using emerc, but instead putting emerc
models in the merc bucket.
- The interface to merc is a lot different now and totally custom
OpenGOAL DMA code. The original merc drawing asm doesn't run anymore.
- The FR3 format changed
- Something funky going on with foreground lighting in escape, but
doesn't seem to be related to this change?

Performance comparison, jak 1, in likely the most generic-merc heavy
spot:

![image](https://user-images.githubusercontent.com/48171810/213882718-feb2ab59-95a9-44a2-b0e5-95fba860c7b0.png)

![image](https://user-images.githubusercontent.com/48171810/213882736-8dbbf4c9-6bbf-4d0b-96ce-78d63274660c.png)
2023-01-22 18:30:31 -05:00
Tyler Wilding 50c57e23be
d/jak2: "finish" traffic-manager, vehicle-util and citizen-h (#2144)
Some more progress on vehicle code, the following files still remain:
- vehicle-guard (annoying stack types)
- traffic-engine (many issues, some which already have issues made for
them, other entirely new confusing things!)
2023-01-22 18:16:24 -05:00
Hat Kid 3d08d079c9
jak2: ocean renderer (#2142)
Initial implementation of the `ocean-mid`, `ocean-far` and `ocean-near`
renderers for Jak 2.

There's still a few things to sort out, mainly:

- [x] ~Backwards compatibility with Jak 1. The only thing that currently
stands in the way of that is figuring out a clean way to "un-hardcode"
the texture base pointer in C++ without creating a completely separate
`OceanTexture` class for Jak 2. One thing I thought of would be
modifying `BucketRenderer`'s virtual `init_textures` method to also pass
the `GameVersion`, but I'm not sure if there's a better way.~
- [x] ~The sudden transition from `ocean-near` to `ocean-mid`. Not sure
why it's happening or how to fix it.~
- [x] The ocean has two new methods in Jak 2, `ocean::89` and
`ocean::79`, one of which seems to be related to time of day sky colors.
~Even without them implemented, the end result looks quite close, so we
may be able to skip them?~ `ocean::89` generates `ocean-mid` envmap
textures, so it will likely be required, but will not be handled right
now.

Reverted the VU prologue removals because it made the tests fail.
2023-01-22 18:07:46 -05:00
Tyler Wilding 2ba07eb058
d/jak2: finish consite-obs and get almost all side-missions working (#2143)
Some side missions require cars, they don't work yet. Also the
ring-races and collection ones do not grant orbs. The hoaming beacon
collection one causes a `hud` crash
2023-01-22 09:31:39 -05:00
Tyler Wilding abf61a94fb
docs: add support for :override-doc in method declarations as well as documenting state handlers (#2139)
Adding support for better child-type method docstrings. This is a
problem unique to methods.

Usually, a child-type will have the same signature and a common name
will apply, but the implementation is different. This means, you
probably want a different docstring to describe what is happening.

Currently this is possible to do via `:replace`. The problem with
replace is two fold:
- a replaced method ends up in the generated `deftype`...because you
usually change the signature!
- we don't put docstrings in the `deftype` in normal GOAL, this is just
something we do for the `all-types` file (they go in the `defmethod`
instead)
- more importantly, this means anytime you now want to change the
parent's name/args/return type -- you have to apply that change
everywhere.

So this is a better design you can now just declare the method like so:
```clj
(:override-doc "my new docstring" <method_id>)
```

And internally a pseudo-replaced method will be added, but it will
inherit everything from the parent (except the docstring of course)

Unrelated - I also made all the keyword args for declaring methods not
depend on ordering

This also adds support for documenting virtual and non-virtual state
handlers. For example:

```clj
  (:states
    (part-tester-idle (:event "test") symbol))
```

or

```clj
(idle () _type_ :state (:event "test") 20)
```

I will probably add the ability to give some sort of over-view docstring
at a later date.

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-21 20:45:45 -05:00
Tyler Wilding e5d6ac1c41
d/jak2: second documentation PR and finish forest-scenes and palace-scenes (#2136)
Also fixes #2135

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-21 20:26:51 -05:00
Hat Kid 1d868a2bd9
decomp: kor-*|kid-*|widow-*|hal-*|atoll-* files, spyder, sniper, juicer and more (#2134)
Full list:

- `atoll-obs`
- `atoll-tank`
- `juicer`
- `sniper`
- `transport`
- `yakow`
- `kid-h`
- `kid-states`
- `kid-task`
- `kid3-course`
- `kid`
- `kor-h`
- `kor-states`
- `kor-task`
- `kor3-course`
- `kor`
- `spyder`
- `spydroid`
- `widow-baron`
- `widow-extras`
- `widow-more-extras`
- `widow2`
- `widow`
- `flying-spider`
- `mammoth`
- `mantis`
- `nest-obs`
- `hal-task`
- `hal`
- `hal3-course`

Manual patches:
- `widow`: `handle->process` stack var
- `nestb-scenes`: Commented out `nav-network` stuff, was causing crashes
in `nest`

Also fixes `ginsu` crash (`blade-part` had the wrong type)
2023-01-21 19:50:48 -05:00
Hat Kid 9889b638b3
jak2: tomb fixes (#2137) 2023-01-17 03:18:01 +01:00
water111 7d7625f4f8
[jak2] workaround for cutscene playing (#2131) 2023-01-16 13:37:29 -05:00
Tyler Wilding dd0a8a17b2
docs - first chunk of work documenting the files I glossed over (#2130)
- started documenting the files I glossed over, some are totally done,
others are just partially done
- I changed the decompiler to automatically initialize the
art-group-info from the json file. This makes updating gsrc, even a
single file at a time, have consistent naming
- Though I disabled this functionality for jak 1, as I have no idea if
using the ntsc art groups will cause a regression for different versions
- fix indentation for docstrings -- it still doesn't look great, but
this is now a formatting concern, rather than the docstring having a
bunch of happen-stance leading whitespace.
2023-01-15 11:33:39 -05:00
water111 a0d2bce27b
Minor bug fixes (#2128)
- make sure bsp is processed on `l` levels in extraction (caused missing
remaps)
- clean up a few prints in extraction
- handle the <15 byte differences in art group files automatically (no
more errors about file naming)
- fix potential exception thrown by merc2 in a few ways: fixed bad data
in FR3's, check texture index just in case, and handle exceptions a
little bit better (still a crash, but at least you get a print)
- fix mips2 ocean stuff causing ocean far crashes
2023-01-14 16:26:17 -05:00
Hat Kid 8a82c2225e
decomp: ai-task-h, whack, bot, sig, ash files (#2127)
`whack` is missing a single function (`birth-func-whack-score`) that I
couldn't figure out the right args for.

I was not able to test any of this code because I cannot get `atoll` to
extract.
2023-01-14 16:12:03 -05:00
Hat Kid 459d83f755
decomp: tomb-* files, target-indax, grunt-mech, breakable-wall, pillar-collapse, mechtest-obs, ruins-obs (#2114)
Manual patches in:

- `tomb-boulder`: a few `ppointer->handle`s (I think) were not being
decompiled properly (all used in combination with `clone-anim-once`)
- `ruins-obs`, `pillar-collapse`: `art-joint-anim` casts
- `tomb-beetle`: commented out a call to `shadow-control-method-14` that
was crashing the game when spawning the beetles
- `grunt-mech`: commented out `(.mula.s)` instruction

Notes:
- `enemy-info`'s `idle-anim-script` is most likely a `(pointer
idle-control-frame)`, however, some `nav-enemy-info` labels set it to
`#f` (first encountered in `tomb-beetle`, but also present in `hal`,
`roboguard` and `metalkor-setup`), which crashes the decompiler. This
may become a problem in the future when we eventually get to these
files. For this PR, I made `tomb-beetle` decompile with
`idle-anim-script` set to `#f` and have not noticed any issues/crashes
with that.
- `tomb-boulder` compiles and doesn't crash, but when trying to play the
Daxter chase sequence, the boulder sometimes either spawns at the origin
or spawns in the correct place, but doesn't move.

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-14 13:53:31 -05:00
Tyler Wilding b072126764
d/jak2: some minor fixes and workarounds to make debugging easier (#2116)
- worked around audio code for gungame, the tutorials now function
- auto-exit cutscenes upon entry. This doesn't always work nicely (i
didnt want to cause any side-effects due to messing with load states)
but it atleast stops jak from being stuck forever waiting for the
cutscene to load
2023-01-14 12:36:41 -05:00
Tyler Wilding 8b12553d15
d/jak2: first pass at decompiling the core vehicle/traffic code (#2058)
Effects the following files:
- [x] vehicle-rider
- [x] vehicle-control
- [x] vehicle-effects
- [x] vehicle
~~- [ ] vehicle-util~~
- [x] vehicle-physics
- [x] vehicle-states
~~- [ ] vehicle-guard~~
~~- [ ] traffic-engine~~
~~- [ ] traffic-manager~~

With the exception of traffic-engine, most of these files are either
done or have 1-3 stubborn functions remaining. Draft while I try to
resolve as many as possible / cleanup names and such.

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-14 12:01:33 -05:00
water111 d65a1c365a
some bug fixes (#2125) 2023-01-14 11:04:15 -05:00
Tyler Wilding a75f4c187b
d/jak2: mostly complete sewer-enemy and sewer-board missions (#2108)
Finishes the following files:
- `sewer-scenes`
- `sewgun-turret`
- `fordumpc-part`
- `sewer-obs`
- `sewer-obs2`
- `gator`

Fixes #2052
2023-01-14 10:54:39 -05:00
water111 cb8cafa40a
[decomp] minimap (#2118) 2023-01-11 19:42:39 -05:00
Tyler Wilding e0d31a33bd
d/jak2 - initial crimson-guard-level decomp and also the dig missions (#2092)
Finishes a bunch of files related to crimson guards / early missions:
- `crimson-guard-level`
- `dig-digger`
- `fordumpa-obs`
- `fort-robotank`
- `fort-robotank-turret`
- `fort-turret`
- `transport-level`
- `fordumpb-obs`
- `fort-floor-spike`
- `fordumpc-obs`
2023-01-11 19:07:35 -05:00
Hat Kid bdee98323d
decomp: add a bunch of enemy files (#2101)
Adds the following files:

- `amphibian`
- `centurion`
- `ginsu`
- `grenadier`
- `hopper`
- `metalmonk`
- `monster-frog`
- `predator-graph`
- `predator-h`
- `predator`
- `rapid-gunner`
- `rhino`
- `rhino-wall`
- `tomb-baby-spider`

Also adds the DGOs for the following levels:

- Mar's Tomb
- Mountain Temple
- Drill Platform
- Sacred Site (Sage Hut)

Manual patches:

- The decompiler emits `(b! #t cfg-17)` in `(trans hostile hopper)`
without putting a `(label cfg-17)` anywhere
- Added cast to `art-joint-anim` in `(code broken rhino-wall)` and
`(code hit rhino-wall)`

Other notes:

- `amphibian` seems to occasionally crash when using its tongue attack.
Haven't investigated this yet
- `ginsu` crashes after being killed somewhere in the `deactivate`
method, possibly because of its `part-spawner`
- Predators aren't spawning in the forest hunt mission, not sure if
`forest-obs` might be needed for that or if it's something else
- The `rhino-wall` STR animation seems to load (albeit a bit broken due
to missing VAG stream playback), but causes the viewport to shrink as
soon as it's played
- I added `pegasus::74` to the `event_handler_hack` bool in
`variable_naming.cpp` because I got a `none` cast after changing the
return value of `enemy::74`
2023-01-07 17:14:12 -05:00
Tyler Wilding f699675ede
g/jak2: initial Discord RPC implementation (#2100)
Notable things:
- This assert is hit when trying to save the pc-settings file, NYI
e630b50690/game/kernel/common/Symbol4.h (L14)
so right now settings aren't persisted. But RPC defaults to on
- The existing functions can probably be made generic based off the game
version, but I didn't spend time refactoring them yet as they aren't
really ready to be used in jak 2 yet (we have no screenshots for the
levels for example)
2023-01-07 10:34:01 -05:00
water111 f50c0e56e9
[jak2] use art constants (#2097) 2023-01-07 10:32:03 -05:00
Tyler Wilding 5095b867b0
d/jak2: finish jetboard training mission (mostly) and scouts mission (#2090)
The things that aren't working right now:
- returning the board (maybe cutscene related?)
  - draft until i see if this can be sorted out
- seems to need streaming audio as well, the `scene-player` gets
properly initialized from what i can tell
- had to hack around the streaming audio parts.
2023-01-04 20:43:34 -05:00
Hat Kid 09d555b4a0
decomp: mech, mech-states, target-mech (#2091)
Everything relating to IK in `target-mech` was commented out as I
couldn't get a lambda to decompile properly, but the mech still seems to
work fine without it.

Co-authored-by: water <awaterford111445@gmail.com>
2023-01-04 19:42:26 -05:00
ManDude 15a8a9c8ef
add ja zero func (#2074)
fixes #2071
2023-01-02 18:23:33 +00:00
water111 77a3e4125c
[jak2] don't ignore disable-draw bits (#2089)
Same idea as what I did for jak 1, but now there's a mask that can be
set by the user. It's used on the gun course dummies, for example.
2023-01-02 13:09:30 -05:00
water111 20a6839e07
[jak2] fix hud and some particles (#2088)
Fixes:
- a very old bug in depth in DirectRenderer, probably from the original
tfrag stuff. Looked at PCSX2 source code to see how 32/24 bit depths are
handled. This fixes hud sprites being drawn behind level geometry.
- saturate `vftoi4` like the ps2 does when the float is too large,
fixing hidden text in `hud`. For now it's only using this in the font
code because this saturation is actually kinda slow and hasn't been a
problem in other places.
- fix crazy particle spawning issue with blue gun and dripping stuff.
This would happen if particles kill themselves while being processed
(through a callback)
2023-01-02 12:13:19 -05:00
water111 0e43c96e52
[decomp] hud, hud-classes, add some new basic alignment options, fix type bug (#2084) 2023-01-02 10:05:22 -05:00
Tyler Wilding 9f53edae7a
game/debugging: Add a new imgui menu to filter debug text and adjust imgui config settings (#2085)
This adds a new ImGUI menu to help filter out the clutter on screen.


https://user-images.githubusercontent.com/13153231/210192912-b1c28319-bacb-449c-ad7f-e7308fb75f50.mp4

This also:
- moves the imgui display bool into a game specific config file (you can
hide it in jak1, and not in jak2)
- the config file also persists the settings from this menu (except the
filters for now, future TODO)
- there is a new `ignore_imgui_hide_keybind` in this file to ignore
hiding it when you press Alt
2023-01-02 09:45:38 -05:00
Tyler Wilding 284fb09997
d/jak2: decompile fodder and nav-enemy (#2080)
fixes #1983 

First functioning enemy!


https://user-images.githubusercontent.com/13153231/210184845-f1d93491-11f5-4a64-b69c-41e535992ebc.mp4
2023-01-01 21:03:07 -05:00
water111 308038a20f
[decomp] collectables, fix float bug in a few files (#2082)
Fixes https://github.com/open-goal/jak-project/issues/1931
Also decompile collectables.gc
2023-01-01 18:05:31 -05:00
Tyler Wilding 5333aa3fb2
d/jak2: finish decompiling gungame files and tomb-scenes (#2076) 2023-01-01 16:22:44 -05:00
water111 0cddf6b6a5
W/nav debugging (#2077)
Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2023-01-01 12:11:18 -05:00
water111 602765db6e
[decomp] drawable, memory-usage (#2070) 2022-12-30 18:23:53 -05:00
Tyler Wilding 6406ba05a6
d/jak2: finish atoll-scenes (#2069) 2022-12-30 18:23:45 -05:00
water111 d454dfbcd8
add target-board-handler (#2068) 2022-12-30 15:23:46 -05:00
water111 f6c5504f6f
[decomp] fix up gun decomp (#2067)
I did some manual modifications in a few places to work around some
truly mysterious control flow, and some unsupported stack array stuff.

Also fixes a bug in decompiling static improper lists.

As far as I can tell, guns work, other than some graphical issues and
the crazy particle spawning issue, but I strongly suspect these are
problems with the sparticle/graphics side.
2022-12-30 14:07:32 -05:00
Hat Kid 98c2291102
jak2: misc fixes (#2050)
- Stub `target-board-handler` to prevent jetboard crash
- Increase stack size for `target` to fix dark bomb crash
- Uncomment some code in `target-darkjak` to make Dark Jak work (texture
morph still crashes, so it's commented out)
- Increase stack size for a `process-spawn-function` in
`target-send-attack` to fix a crash with giant Dark Jak
2022-12-22 13:59:24 -05:00
Tyler Wilding 1b2db09f51
d/jak2: pass through all simple / non-blocked *-part, *-ocean and *-scenes files (#2048)
A big one...

I figure even if we would like to change the way the particle/scene code
is output -- it'd be easier to find patterns with it all decompiled.

I've updated my script so it can easily be used to mass update these
files:
```bash
task update-gsrc-glob GLOB="**/*-part*.gc"
```
> for example will update gsrc files with `part` in their name -- if
they are in ref tests (so uncompleted ones aren't touched)

I found a few issues along the way that I'll have to make issues for
soon.
2022-12-22 13:57:57 -05:00
Ziemas 5b99929394
989snd: Support version >= 2 sound effects (#1991)
Supports most of the grain types now while maintaining compatibility
with the old stuff (at least the subset of things jak1 uses)

Would benefit from some testing in Jak 1 to make sure I didn't break
anything.

Sorry the git history is a mess, I'll do something about it later.
2022-12-02 18:08:44 -05:00
water111 80e9528e4e
lights, death, and rotation fix (#2042)
- decompile `lights.gc`
- decompile remaining `target-death` function, you can die now
- fix float issue with `matrix-from-two-vectors-smooth!` making jak face
the wrong way in the slide thing
2022-12-02 10:02:13 -05:00
Tyler Wilding 728b2689b6
d/jak2: decomp a bunch of files related to the beginning of the game (#2043)
Mostly easy / particle def files. I did a bit in `ruins` but CFG
failures and missing `drawable` functions make it untestable for now so
I've put that on pause.
2022-12-01 21:26:49 -05:00
water111 70e231fa72
[jak 2] merc (#2039) 2022-11-30 22:36:09 -05:00
Hat Kid ceebe3f7eb
decomp: target-tube (#2041) 2022-11-30 19:52:42 -05:00
Tyler Wilding cdb61f69f8
d/jak2: finish decompiling enemy-h | enemy | grunt and flitter (#2023) 2022-11-29 19:19:05 -05:00
water111 7a1a64acba
target code bugfixes (#2034) 2022-11-21 20:25:20 -05:00
water111 6298533eaa
[decomp] collide cache, other minor fixes (#2031) 2022-11-20 11:32:29 -05:00
water111 e0ebc5a68e
[decomp] target-handler (#2027) 2022-11-20 09:21:25 -05:00
Tyler Wilding bf83f2442d
d/jak2: cleanup more of editable and editable-player (#2029)
- Rough start of the SQLite integration to facilitate the SQL queries
- Cleanup and disable a little bit of code so the game no longer crashes
when entering the editor
- Implement some of the mouse data stuff


![image](https://user-images.githubusercontent.com/13153231/202881481-95bc0a2a-ac3d-4f65-aff1-b9f7ee5ee345.png)


https://user-images.githubusercontent.com/13153231/202881484-399747e7-dcdb-4e09-93e9-b561a45c8a18.mp4

This is a very old branch so best to get it merged now that it's at a
decent point so it can be iterated on.
2022-11-19 23:28:20 -05:00
water111 928b18f01c
clean up to target-handler (#2026) 2022-11-19 17:58:51 -05:00
water111 029983270e
[decomp] target cleanup (#2021)
everything up to collide-reaction-target (which is mostly done, but
could use a few more names)

Fixes issues with gun-part and target-part
2022-11-13 19:09:34 -05:00
water111 3c393845c7
[decomp] finish lightning-draw (#2019) 2022-11-13 12:05:49 -05:00
Tyler Wilding c8abafcb7a
d/jak2: partial cleanup pass from main -> gun-part (#2017) 2022-11-13 11:38:25 -05:00
water111 f39b993f79
[decommp] generic-obs (#2013) 2022-11-12 17:56:07 -05:00
Tyler Wilding 84ef64398e
d/jak2: finish process-drawable, collide-reaction-target, target-anim, almost target-part and gun-part (#2012)
- target-part
- ;; ERROR: Failed to convert to atomic ops: Variable could not be
constructed from register r0 in `process-drawable-shock-wall-effect`
- gun-part
  - missing sparticle decompiling case it seems related to `L155`

This is pretty rough but...im excited to see it working :)
2022-11-12 11:19:04 -05:00
water111 3909a251cc
[decomp] clean up some names/types (#2011)
cutting down on some of the most common `unknown` methods, before we add
too much gameplay code
2022-11-11 20:18:13 -05:00
water111 b90b6c9aff
small cleanup on camera code (#2010)
fixes https://github.com/open-goal/jak-project/issues/1960 and patches
scratchpad use in cam-debug
2022-11-11 17:27:09 -05:00
water111 b2b47eec5c
[decomp] spatial-hash (#2009) 2022-11-11 16:23:26 -05:00
water111 136136e498
[decomp] start work on collide (#2008)
Adds `collide-shape` and a few other related ones.
2022-11-11 12:01:45 -05:00
Tyler Wilding 190fe6968f
d/jak2: finish guard-projectile | metalhead-projectile | guard-conversation and start crimson-guard-level (#2006)
Related issue - https://github.com/open-goal/jak-project/issues/2005
2022-11-06 14:30:43 -05:00
Hat Kid 88eb45ab52
decomp: ocean, ocean-mid, ocean-near, ocean-texture, ocean-transition, ocean-vu0 (#1994)
The VU programs for the ocean renderer have changed a bit and
`ocean-texture` has a bunch of new stuff, otherwise things are
relatively similar to Jak 1.

This is the first time I used mips2c and I'm not sure I did it 100%
right, so that should be double-checked.
2022-10-30 19:09:35 -04:00
water111 811b5de6cb
[decomp] collide-mesh (#1999) 2022-10-30 15:54:10 -04:00
water111 8ae4829f48
[decomp] collide-hash, collide-frag, collide-probe (#1998)
The only interesting one is `collide-hash`, which is untested.
The other two are very likely unused. I skipped the annoying code in
`collide-probe` because it's not used and the same as jak 1.
2022-10-29 20:32:03 -04:00
Tyler Wilding 50076537b7
d/jak2: finish sidekick, target-carry and battle. Close to finishing target-death and warp-gate (#1990) 2022-10-29 18:27:31 -04:00
Tyler Wilding 760e11a087
d/jak2: finish scene-actor, scene-looper, race-part, rigid-body-plat, debug-part, voicebox (#1987)
Co-authored-by: water <awaterford111445@gmail.com>
2022-10-29 16:42:57 -04:00
Tyler Wilding d13155bfd0
d/jak2: Decompile palace-ocean, ctysluma-part, nav-enemy-h and a bunch of work on enemy and nav-mesh related files (#1984)
Couldn't finish any of the enemy/nav-enemy related files for one reason
or another, but quite a bit of work that will be easier to merge and
iterate on instead of keeping track of the branch.

enemy/idle-control has some very weird focus related code.

nav-mesh/nav-control still has a bunch of CFG resolution problems that
need to be manually resolved.

Co-authored-by: water <awaterford111445@gmail.com>
2022-10-29 16:28:52 -04:00
ManDude b0e8cba6f1
[decomp2] game-save (#1988)
memory card code was not done!
2022-10-29 16:08:04 -04:00
Tyler Wilding 84497712ff
d/jak2: finish task-arrow | carry-h | projectile | gun-[red|yellow|blue]-shot (#1864) 2022-10-29 15:22:57 -04:00
Tyler Wilding 41c3423767
d/jak2: finish viewer, texture-finish, process-taskable, main-collide, prototype and los-control (#1975) 2022-10-22 13:26:28 -04:00
water111 ddd60fca48
[decompiler] handle pointer to symbol value, clean up prints on offline test (#1978)
- fix issue described in
https://github.com/open-goal/jak-project/issues/1939
- fix `text`, which was manually patched with the wrong offset (was
reading the symbol value off by one byte)
- clean up some random useless prints
- make the offline tests keep trying if there's a comparison error,
clean up the output a bit so the diffs are all at the end.
2022-10-16 18:19:59 -04:00
Tyler Wilding e7bb0fb68d
d/jak2: decompile ambient | speech and bigmap-data (#1954)
fma-sphere not completed due to #1888
2022-10-16 18:09:15 -04:00
water111 e443676889
[decomp] sky-tng (#1972)
https://www.youtube.com/watch?v=fkAMvEYXOGc
2022-10-15 18:21:17 -04:00
Tyler Wilding fd7d9c3df5
d/jak2: finish scene (#1971)
`scene-player-init` has some weird `rtype-of` usage (mostly in the
`pair` clause)
2022-10-15 17:43:02 -04:00
water111 a10d60c42c
[decompiler] nicer static giftags (#1970)
```
      :gif0 (new 'static 'gif-tag64
        :nloop #x4
        :eop #x1
        :pre #x1
        :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
        :nreg #x3
        )
      :gif1 (new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
```
instead of
```
:gif (new 'static 'array uint64 2 #x303e400000008004 #x412)
```
2022-10-15 10:59:09 -04:00
water111 b6f0ef52b3
[decomp] fixes for loader and game-info (#1968)
Fixes for the functions that weren't decompiled. `initialize` in
`game-info.gc` was fixed manually.
2022-10-14 20:47:59 -04:00
Hat Kid da5aef8d60
decomp: finish target-[util|darkjak|swim|gun] | water | water-anim | crates | dark-eco-pool, fix skelgroup detection, add failed store/load warnings and clean up jak 3 config (#1958)
Almost done:
- `target-handler` (`(none)` event handler casts and CFG error)
- `target2` (`(none)` event handler casts)
- `powerups` (`cloud-track` does some weird stuff with `handle`s)
- `gun-states` (CFG error)

Some progress in:
- `water-flow`

Additionally:

- Clean up the two year old Jak 3 config file and add a config skeleton
(disassembling seems to not have worked, but I was able to dump obj
files and the `all_scripts` file)
- Fix automatic skelgroup detection and `defskelgroup` macro for Jak 2
(closes #1950)
- When a function decompiles without any major errors, a warning is
generated with the op id for each unresolved load and store that will
likely fail to compile (closes #1933)
2022-10-14 19:35:57 -04:00
Tyler Wilding e3473c1902
d/jak2: finish cty-guard-turret-button | race-h | height-map-h and a lot of rigid-body (#1957)
Also cleaned up `data_decompiler.cpp` to make it a lot less verbose to
add a special case for an array field.
2022-10-11 23:20:36 -04:00
Brent Hickey f7e1e73809
Decompile los-control-h (#1844)
Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2022-10-11 19:39:45 -04:00
water111 8827af5efd
add workaround for menu-option-list weirdness (#1961)
The type makes no sense when compared to the actual data there. This
modifies the type slightly, which I think is better than spending a
bunch of effort to special case this in the compiler/decompiler.

If we try this, and it turns out it doesn't work, we can always revisit
it. But I think this will work.
2022-10-11 19:21:10 -04:00
Tyler Wilding f6bdc07990
d/jak2: finish progress menu code and initialize the camera (#1945)
This PR does a few main things:
- finish decompiling the progress related code
- implemented changes necessary to load the text files end-to-end
   - japanese/korean character encodings were not added
- finish more camera code, which is required to spawn the progress menu
/ init the default language settings needed for text
  - initialized the camera as well

Still havn't opened the menu as there are a lot of checks around
`*target*` which I havn't yet gone through and attempted to comment out.
2022-10-11 18:30:26 -04:00
water111 9a04c7e311
[decomp] sparticle, sparticle-launcher, set up sprite (#1949)
- fix crash with unhandled sparticle definition (happens with the weird
array int32s that I don't understand yet)
- update mips2c stuff
- add part-tester
- fix some issues around texture uploads
 

![image](https://user-images.githubusercontent.com/48171810/194784675-54e3dc58-7846-450d-a1e9-cefd841dda94.png)
2022-10-09 19:56:07 -04:00
ManDude af5009a29e
[decomp] make defpart and defpartgroup work in jak 2 (#1947) 2022-10-09 12:53:44 -04:00
water111 405a144815
[decomp] finish up debug.gc, get boundary rendering working (#1944)
![image](https://user-images.githubusercontent.com/48171810/194726152-74167185-0297-4982-8ed9-42936ad80fe7.png)
2022-10-08 17:02:40 -04:00
water111 3d4dfb2077
[decomp] Decompile some time-of-day stuff, support new style Jak 2 time of day (#1943)
- Add "tfrag-water" tfrag tree support (may just be the same as Jak 1's
'dirt' for the settings)
- Add "tfrag-trans" tfrag tree support, reusing "trans-tfrag" from jak
1.
- Add a hack to `LinkedObjectFileCreation` to handle `oracle`, which is
accidentally multiply defined as a type leftover from jak 1 (an entity
in village1), and level info for jak 2.
- Add `VI1.DGO`
- add `time-of-day.gc`, and a few other stub functions so it works
- Set up some time of day stuff in GOAL for jak 2/PC renderers
- Clean up time of day in c++ renderers, support the more complicated
weight system used by jak 2 (backward compatible with jak 1, thankfully)

The mood functions now run, so this could cause problems if they rely on
stuff we don't have yet. But it seems fine for ctysluma and prison for
now.


![image](https://user-images.githubusercontent.com/48171810/194719441-d185f59c-19dc-4cd3-a5c4-00b0cfe1d6c3.png)


![image](https://user-images.githubusercontent.com/48171810/194719449-6e051bf3-0750-42e5-a654-901313dbe479.png)


![image](https://user-images.githubusercontent.com/48171810/194719455-3ca6793e-873a-449a-8e85-9c20ffeb4da3.png)


![image](https://user-images.githubusercontent.com/48171810/194719461-8f27af17-4434-4492-96cd-8c5eec6eafdf.png)


![image](https://user-images.githubusercontent.com/48171810/194719468-720715b9-985a-4acf-928c-eab948cfcb03.png)


![image](https://user-images.githubusercontent.com/48171810/194719486-bfb91e83-f6ca-4585-80ad-3b2c0cbbd5af.png)


![image](https://user-images.githubusercontent.com/48171810/194719492-df065d2f-cb5a-47e3-a248-f5317c42082f.png)


![image](https://user-images.githubusercontent.com/48171810/194719507-91e1f477-ecfe-4d6c-b744-5f24646255ca.png)
2022-10-08 13:33:03 -04:00
Tyler Wilding be1e40a041
d/jak2: decompile conveyor | elevator | plat | bouncer | basebutton | base-plat | most of sampler | simple-nav-sphere | simple-focus | elec-gate and blocking-plane (#1942)
Most of these have been atleast partially documented / named / cleaned
up as well.

Co-authored-by: water <awaterford111445@gmail.com>
2022-10-08 12:42:52 -04:00
Tyler Wilding 2d1b5fa57c
d/jak2: finish region as well as some typedef files - ctywide-obs-h | vehicle-h | rigid-body-h (#1935) 2022-10-08 11:45:41 -04:00
water111 f1682867af
[graphics] hook up visibility data for jak 2 (#1938)
It works!

Visibility off:

![image](https://user-images.githubusercontent.com/48171810/193422627-c5560519-6d20-4645-baa5-5236c7969d6e.png)

On:

![image](https://user-images.githubusercontent.com/48171810/193422631-716fff10-9ad7-486f-ad35-9ddcddf2c4eb.png)

Overall the visibility data looks a lot better than in jak 1.
2022-10-01 17:12:12 -04:00
water111 d52739226c
[decomp] decompile decomp.gc (#1936)
A few issues:
- lwidea's fr3 is getting loaded and unloaded all the time
- the debug line drawing clipping is wrong (doesn't seem wrong in pcsx2,
so I think this is on us)
- nothing actually using vis data yet
- at a large distance, our view frustum culling seems slightly too
aggressive (might be that viewport scissoring is wrong)
- in the city, things seem darker as you move away. unclear how this is
happening (fog?)
2022-10-01 13:39:56 -04:00
ManDude 9351bf782e
[decomp2] game-info, game-task and task-control (#1884)
And everything else needed for them!

A couple functions are bad currently.

- fixes #1929 - untested on linux
- fixes #1924 - now you need to type `,` before a lambda you want to put
in a pair.
- fix debugger symbol table in jak 2
- made the decompiler output `(meters 2)` instead of `(meters 2.0)`
- fixed a bug with the bitfield enum special -1 case
- made bad game text decomp not exit the decompiler
- added `editable-player` and `script`
2022-09-27 19:44:20 -04:00
water111 e3a4627eeb
[decompiler] recognize jak 2 vector-float*!, fix some vector inline casting bugs (#1926) 2022-09-26 20:57:44 -04:00
water111 bdf63b9048
[decomp] sync-info, fix some looping type pass bugs (#1925) 2022-09-26 19:40:46 -04:00
water111 5c7a3384e5
[jak2] static sound macro (#1919)
eg
```
(set! (-> obj sound-pre-open) (static-sound-spec "airlock-slider"))
```
it is the same as jak 1, but the `fo-curve` option is set to 1
sometimes.
2022-09-25 16:19:06 -04:00
water111 b5705bde96
[decomp] Partial implementation of tie (#1916)
Some stuff isn't working fully yet:
- fog color
- time of day
- draw order for multiple passes (currently all draws in the default tie
bucket)
- possibly settings for transparent stuff (untested, but might work)
- the "vanish" effect (we might not want this anyway?)
- environment mapping/etie completely not implemented.


![image](https://user-images.githubusercontent.com/48171810/192154314-2cc8ac51-9dad-474f-a84b-3a1d98973215.png)

![image](https://user-images.githubusercontent.com/48171810/192154316-457a7ee0-b5a4-4a40-b48e-8863114da735.png)
2022-09-25 12:50:51 -04:00
Hat Kid a53c06fe2b
decomp: target, target-board, board-states (#1915)
Just missing `target-board-handler` because it errored with `Bad delay
slot in clean_up_cond_no_else_final` and I wasn't able to figure out
where the asm branch was.

Commented out `target-board-clone-anim` because it crashes even after
adding `clone-anim` and `clone-anim-once`.
2022-09-25 12:07:37 -04:00
Hat Kid e8b1aee24d
decomp: majority of progress (#1904)
Gets through ~90% of `progress`, wasn't able to figure out some stuff.
2022-09-25 10:15:32 -04:00
water111 edecac9f09
[decomp] add shrubbery renderer (#1914)
as with last time, fog and time of day are still garbage, but it still
works:


![image](https://user-images.githubusercontent.com/48171810/192119423-91b80500-a161-42ce-b734-0c528cc721cf.png)

The shrub near render is just falling back to generic again.
2022-09-24 17:46:13 -04:00
water111 6227c6d6a8
More array special cases (#1913)
also make jak 1 and jak 2 behave the same way, to reduce confusion. It
wasn't too bad to update jak 1.
2022-09-24 16:10:13 -04:00
Tyler Wilding 123e7fd87b
d/jak2: some work in memory-usage | nav-graph-h and finish pov-camera and aligner (#1901) 2022-09-24 14:47:03 -04:00
water111 80cefb9575
[decomp] background and tfrag (#1909) 2022-09-24 14:30:44 -04:00
Tyler Wilding e64414d9d0
d/jak2: finish drawable-group | drawable-inline-array | drawable-tree and path (#1899) 2022-09-24 12:27:02 -04:00
Ethan Lafrenais dc5dc9c76c
[decomp] jak2: shrubbery (#1898)
Some notes:
- `draw-prototype-inline-array-shrub` can probably be decompiled but I'm
not comfortable doing this function myself. It's got a ton of inline
assembly (or at least I think it's inline assembly) and is very long. I
left this marked as asm for now but I am confident in the function
definition.
- The VU program is identical to Jak 1 (yay)
- There's some new `dma-test` stuff at the end of the file, not really
sure what it's doing but it runs in the top-level.
2022-09-18 12:19:16 -04:00
water111 1b45aab3cc
[decompile] subdivide, wind-work, tie-work, bsp, focus (#1897)
- decompile `subdivide`, `wind-work`, `tie-work`, `bsp`, `focus`
- support `ppacb` in compiler
- don't assert when bitfield stuff fails due to constant propgataion
weirdness
- finish up history
- div/mod unsigned assert fix in decompiler
- empty assert fix in decompiler for failed `add` type prop
- make jak 1 performance counters "work" (just measure time)
- fix cast/typos on pcgtb/vftoi15
2022-09-17 14:58:25 -04:00
water111 6a1bde4168
[decomp] fix up debug menu rendering, add a few others (#1892)
![image](https://user-images.githubusercontent.com/48171810/190832869-e609d346-9c4a-43fb-ad94-2a9690521adc.png)
actor vis boxes for PRI.DGO
2022-09-16 20:42:33 -04:00
Tyler Wilding 82e0517275
d/jak2: get script decompiling, no ref tests yet (#1877)
Has boxed array accessing that prevents me from adding anything to ref
tests (the entire file is lambdas so the access pattern that i would
like to ignore happens at the top-level, can't ignore it.

This code actually already has quite a bit of original docstrings so
it's not too bad in that regard considering a `script-context` can have
16 arbitrary objects. It seems they rarely put more than a single object
in the context and the types are usually obvious / are actually type
checked!
2022-09-14 19:37:12 -04:00
Tyler Wilding 4620f96574
d/jak2: mostly finish mysql-nav-graph and fix docstring handling around with-pp/local-vars (#1869) 2022-09-13 18:15:02 -04:00
water111 4eea31c3e9
[jak 2] texture (#1866)
- Decompile and patch `texture.gc` for PC
- Improve decompiler when offset doesn't fit in immediate (for types
larger than 8k and some scratchpad accesses)
- Fix symbol->string issues in both jak 1 and 2
- Fix bug with VIF interrupt used to profile VU code (hooked up to
OpenGLRenderer BucketRenderers in PC port)
- Support `~o` in `format`.
- Uncomment stuff in `merc.gc` that now works!

![image](https://user-images.githubusercontent.com/48171810/189505469-941b4a3e-23c7-4740-aa1b-2e461ed19fa9.png)

fixes https://github.com/open-goal/jak-project/issues/1850
2022-09-11 14:17:55 -04:00
Tyler Wilding 017070525a
d/jak2: finish vol | cam-layout | menu | default-menu and start working on nav code (#1867)
I also added font-color names since this PR adds quite a few:

![image](https://user-images.githubusercontent.com/13153231/189508209-c8849672-fac5-47cb-9652-f1d4648f0af8.png)
2022-09-11 13:42:46 -04:00
Hat Kid 7339b2b965
decomp: merc, merc-vu1 (#1865)
The merc VU1 program is identical to Jak 1. Jak 2's merc is doing some
new texture login stuff and the DMA buffer setup is a bit different, but
overall very similar.
2022-09-10 19:02:58 -04:00
Tyler Wilding 81b6d5fe08
d/jak2: finish find-nearest | trajectory | editable-h and most of editable and editable-player (#1847)
Also made a first-pass of their SQL schema in preparation for getting
that working.
2022-09-10 18:03:17 -04:00
Hat Kid bb777e4bac
decomp: logic-target (#1861)
Also adds all names for `focus-status`.

Closes #1859 and updates ref tests for Jak 1 for this edge case.
2022-09-08 18:26:33 -04:00
water111 f3c63f26bb
fix let* format, new on stack guessing case, type failure, handle casts (#1860)
Fixes https://github.com/open-goal/jak-project/issues/1821 by adding a
special case for `new` method calls where the argument with type
`symbol` is actually an address to uninitialized structure on the stack.

Fixes https://github.com/open-goal/jak-project/issues/1849 (or at least
the cause of the issue Vaser gave in chat, and one random one I found in
`debug-sphere`)

Fixes https://github.com/open-goal/jak-project/issues/1853

Fixes https://github.com/open-goal/jak-project/issues/1857 by moving the
cast into the cond if the body is a single form and the destination type
is a bitfield/enum which is likely to work well. Seems to work on the
examples we could find in jak 1 and jak 2.

Also fixes an issue with casts on the result of `handle->process` (a
common place to use casts)

the output of process->handle is a plain process. Most of the time, you
end up casting this to a more specific. If you add a cast on every use
of the variable, the decompiler will decide to change the type of that
variable to the more specific type, and this breaks the handle cast.

so previously it was impossible to get code like
```
    (let* ((s2-0 (the-as swingpole (handle->process (-> self control hack))))
           (gp-0 (-> s2-0 dir))
           )
```
But now it will work
2022-09-07 21:58:09 -04:00
Ethan Lafrenais 22982d2750
[decomp] jak2: debug, debug-sphere (#1846)
I wasn't able to 100% complete `debug` due to a bunch of level boundary
debug stuff I couldn't figure out. But, I added a ref test and
documented/copied over everything else into goal_src.

Most of the functions that existed in Jak 1 are identical, others got an
extra param or 2 and some now make copies of arguments instead of
modifying them. There's a bunch of new functions, including all of the
debug functions that used to be in `level-boundary` are now in `debug`.
At the very end of `debug` there's also some weird asm functions
checking for some EE memory controller bug (not sure what's up with
that)?
2022-09-07 18:14:34 -04:00
Tyler Wilding 44d59e6b33
d/jak2: finish mood-funcs | mood-funcs2 | almost all of mood and airlock (#1842) 2022-09-06 20:35:00 -04:00
water111 b5d21be9c5
W/misc fixes (#1838)
* temp

* temp

* before cleaning up

* cleanup merge

* fix warnings

* merge fix

* clang format
2022-09-05 20:29:12 -04:00
Tyler Wilding 80d0137dba
d/jak2: finish the majority of sparticle and sparticle-launcher (#1840)
* sparticle-launcher

* d/jak2: large amount of `sparticle-launcher` done

* d/jak2: finish the majority of `sparticle`

* decomp: improve format code ignoring

* d/jak2: make bits unique in `sp-cpuinfo-flag`

* d/jak1: revert config change
2022-09-05 18:03:46 -04:00
Hat Kid 2a1dc7bd2b
decomp: emerc, emerc-vu1 (#1833)
* decompiler: add support for `MADDq` in VU disassembler, add `emerc-vu1` program

* decomp: `emerc`, `emerc-vu1`
2022-09-02 18:29:30 -04:00
ManDude f1f18e7e05
[decomp2] joint-mod, chain-physics, loader (#1816)
* prep

* Update repo-settings-mark.bat

* Update repo-settings-unmark.bat

* decomp `joint-mod`

* add `joint-mod-ik-callback` to ref exceptions

* `chain-physics`

* Update jak2_ntsc_v1.jsonc

* update bat scripts

* `loader`

* pretty

* refs

* support `process->handle` (and `ppointer->handle`?)

* refs

* source and fixes

* fix `ja` detect

* `ja` macro implement

* fix a method

* update source

* merge fixes

* annoying fixes

* format

* arg

* hack

* fix test
2022-09-02 18:13:38 -04:00
Hat Kid 52bb1c4915
decomp: board-h, board-util, gun-util, darkjak-h (#1817)
* decomp: `board-util`, `gun-util`, `darkjak-h`

* address changes and decompile `board-h`

* fix `board-util`

* remove `_type_` from `projectile` method

* fix `gun-h.gc`

* Update gun-h.gc
2022-09-01 18:25:42 -04:00
water111 937ae0cb97
[decomp] fix joint type (#1827)
* fix joint type

* fix relocate hack bug

* update
2022-08-31 19:48:06 -04:00
Tyler Wilding d264779173
d/jak2: finish glist | glist-h | camera | cam-interface | cam-states-dbg | cam-combiner | cam-debug | cam-start (#1829)
* d/jak2: finish `glist` and `glist-h` partially done `time-of-day`

* d/jak2: finish `camera` and `cam-interface`

* d/jak2: partially finish `cam-master` `cam-states`, and `cam-update` finish `cam-states-dbg` `cam-combiner` `cam-debug` and `cam-start`

* tests: update ref tests

* scripts: add scripts to automatically update gsrc files

* d/jak2: update gsrc
2022-08-31 19:22:47 -04:00
Ethan Lafrenais e7b1a2d292
[decomp] jak2: sprite, sprite-distort, some of sprite-glow (#1814)
* Decompile sprite-distort

* Revert matrix, sprite-vec-data-2d changes

* Sprite distort ref test

* Sprite distort docs

* Better sprite-distort docs

* Jak2 sprite distort VU

* sprite decomp

* Some of sprite-glow

* Clean up
2022-08-29 19:04:54 -04:00
Tyler Wilding d176b294b9
d/jak2: finish entity-table | sky-data | relocate | and the majority of default-menu (#1812)
* d/jak2: finish `entity-table`

* d/jak2: finish `sky-data`

* d/jak2: finish `relocate`

* d/jak2: halfway through `default-menu`

* d/jak2: 75% done `default-menu`....

* d/jak2: add `default-menu` to ref tests (partially)

* d/jak2: finish updating related code

* scripts: add tooling to automatically keep code from `all-types` up to date

* d/jak2: fixed vector types
2022-08-29 18:49:57 -04:00
water111 2bead6db97
[decompile] Joint (#1813)
* temp

* decompile joints

* fix merge
2022-08-28 16:38:58 -04:00
Tyler Wilding d4a065a4e5
d/jak2: finish level-info (#1807) 2022-08-28 16:13:42 -04:00
Tyler Wilding b9c6a840ad
d/jak2: finish settings (#1803)
* d/jak2: finish `settings`

* add `settings` related macros to goal_src
2022-08-28 16:13:26 -04:00
Tyler Wilding 799e10a0ae
d/jak2: finish cylinder | mech-h | font-data most of text and history and chip away at a bunch of other files (#1802)
* d/jak2: finish `cylinder`

* d/jak2: mostly finish `history`

* d/jak2: finish a bit of `ripple` and `sync-info`

* d/jak2: finish `font-data` and chip away at some other files

* d/jak2: most of `text` done, a bit of `script` - symbol arr issue in `level-info`

* d/jak2: finish `mech-h`

* lint: format

* tests: fix typeconsistency

* d/jak2: address feedback
2022-08-28 10:45:07 -04:00
water111 f8007cc84b
[decomp] Jak 2 mips2c, collide-func (#1805) 2022-08-26 18:03:48 -04:00
Hat Kid 24590ec670
decomp: water-h, pilot-h, gun-h and board-h types (#1801)
* decomp: `water-h`, `pilot-h`, `gun-h` and `board-h` types

* update ref test

* fix arg type

* address changes
2022-08-26 14:57:32 -04:00
water111 7443520e88
[decomp] load-dgo, ramdisk, gsound, transformq (#1798)
* temp

* cleanup after merge

* transformq too
2022-08-24 21:57:13 -04:00
Tyler Wilding 01abde35d8
d/jak2: First few files, mood-tables and vol-h (#1796)
* decomp: format jak1 cast files

* decomp: finish `mood-tables` and `mood-tables2`

* jak2: stop disasm'ing

* jak2: format jak2 cast files, start working on the rest of the `mood` files

* scripts: fix running pcsx2 watcher

* d/jak2: finish `vol-h`

* d/jak2: address feedback
2022-08-24 19:34:09 -04:00
water111 f7bd0752f8
[decomp] Decompile first batch of files in engine (#1787)
* wip

* getting stuff set up so we can actually run test cases

* better handle block entry stuff

* types2 working on gstring

* comments

* math ref working

* up to first stack stuff

* stack fixes

* bounding box

* math stuff is working

* float fixes

* temp debug for (method 9 profile-array)

* stupid stupid bug

* debugging

* everything is broken

* some amount of type stuff works

* bitfield

* texture bitfields not working

* temp

* types

* more stuff

* type check

* temp

* float related fixes for light and res problems

* revisit broken files, fix bugs

* more types

* vector debug

* bug fixes for decompiler crashes in harder functions

* update goal_src
2022-08-24 00:29:51 -04:00
Tyler Wilding c269374e24
gsrc: add decomp begins placeholder to all gsrc files (#1731) 2022-08-05 16:12:54 -04:00
Tyler Wilding 345793af41
jak2: Generate goal_src skeleton (#1581)
* jak2: merge identical art files

* jak2: a skeleton is born
2022-06-30 01:22:51 -04:00