Commit Graph

1062 Commits

Author SHA1 Message Date
Hat Kid 0385c76811
decomp: support `part-tracker-spawn` in jak2, part group constants (#4082) 2025-11-20 16:22:29 +01:00
Hat Kid 73dd982fdc
jak3: misc high fps fixes (#4055)
Fixes for:

- `prebot` sword attack and projectile speed (fixes #4050)
- Fast first person camera turning speed (fixes #4051)
- Slow turret camera turning speed (fixes #4052)
- `flyingsaw` movement and rotation speed (fixes #4053)
- Green eco drain rate on jetboard during `forest-kill-plants` mission
(fixes #4054)
- `skeet` rotation speed
- `maker-grenade` tumble speed
- Jetboard spin speed
- `hud-skill` rotation speed (also for jak2)
- `gun-dark-shot` projectile speed (also for jak2)
- `target-float` up/down speed (also for jak2)
- Texscroll speed
- Slow walk anim after landing from a jump
2025-10-17 14:28:22 +02:00
Alex 48903fc6f8
[jak3] fix stereo vag commands causing memory corruption (#4040)
All stereo VAG commands would write to an out-of-bounds array element
and corrupt the whole VAG queue list.

Fixes random sound-related crashes including a consistent Light Jak
Freeze crash.
2025-10-07 01:34:51 +01:00
water111 c8a1643e9f
[jak3] Add zoom blur and color filter effect (#4031)
Add the zoom blur effect, used by cutscene effects and a few weapons:


https://github.com/user-attachments/assets/8d231b34-faf8-4b88-a636-edf2b5477ff9

And color filtering


https://github.com/user-attachments/assets/67db5933-4b29-4c77-ad56-5025cbefa328

There's still two blit-displays not covered: scanlines and the light jak
slow motion effect.
2025-10-04 17:06:18 -04:00
Hat Kid c61a69d751
jak3: wip pc progress code (#3898) 2025-04-16 20:57:43 +02:00
Tyler Wilding 647282d896
deps: update `fmt` to `11.1.4` (#3880)
Fixes #3886
2025-04-12 15:59:13 -04:00
Tyler Wilding 41ed4b1d7e
ci: update to ubuntu `22.04` (#3860)
Ubuntu 20.04 is hitting it's next EOL stage in april
https://endoflife.date/ubuntu
And it's being removed from github actions in april to go along with
that
https://github.blog/changelog/2025-01-15-github-actions-ubuntu-20-runner-image-brownout-dates-and-other-breaking-changes/

Getting ahead of this before we have random failures, I'll update the
launcher along with this change for this month.

On the bright side, we can finally update clang-format!
2025-02-16 17:40:52 -05:00
water111 23118be428
[jak3] Fix crash in subrails (#3863)
After the change to vector ops, subrails was crashing. This fixes the
crash by fixing a stack type and also marks those new vector op
functions as inline.

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-02-16 17:40:23 -05:00
water111 2a4d3d7a4a
[decompiler] More inline vector functions (#3861)
This adds more recognition for inlined vector functions to the
decompiler, which can clean up a bunch of ugly looking code/`rlet`s.


![image](https://github.com/user-attachments/assets/1f7b4627-81bd-481b-b828-76b9f7ba13b3)

Unfortunately, this changes the numbering of ops in the decomp, since
all the vector instructions get combined in a single "operation" by the
decompiler. I really tried to avoid having this ever happen in the
decompiler and this is one of the few cases where it has. So I had to
update a bunch of type casts.

For that reason I haven't turned this on in Jak 2 yet, although I am
planning to do that at some point. (probably at the same time as porting
back a bunch of jak 3 improvements to jak 2)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-02-16 15:59:17 -05:00
water111 48cb9bb787
[decompiler] `as-type` and font method support (#3855)
Add support for `as-type` macro, and detecting inline font methods. This
works in all three games but I've only updated jak 3's goal_src for now.
Eventually I will go back and work through the others, but I want to get
more decompiler features in first.


![image](https://github.com/user-attachments/assets/5c31bf85-97b4-437c-bc4b-dc054e60551e)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-02-01 21:23:11 -05:00
water111 7348e6a4ff
[decompiler] Update vector ops, reduce casts (#3849)
Update the decompiler to use the new vf macros.

Also, fix a bunch of silly casting issues where accessing inline fields
with an offset of 0 would be better than a cast:

![image](https://github.com/user-attachments/assets/885bbb07-634f-47b8-99f5-5a947941cdde)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-20 16:32:58 -05:00
water111 98d6618a8b
[decompiler] Detect vector*! (#3846)
Detect use of `vector*!`, which is inlined in jak 2 and jak 3.

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-20 12:21:28 -05:00
water111 3ee2b4423c
[decompiler] Cleanup for Jak 3 (#3845)
This PR does a few cleanups:
- improve method names/comments/flags for `enemy.gc` and a few other
files
- fix `new-stack-matrix0` not working for jak 3
- add `matrix-copy!` detection for jak 3
- add `vector-copy!` detection

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-20 10:31:29 -05:00
Hat Kid 51d008f9ab
decompiler: detect and turn inverse mult to div (#3795)
Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2024-12-07 23:10:49 +01:00
Hat Kid 6a06291e6e
jak1, jak2: add `get-texture` macro (#3778)
Ports the `get-texture` macro added in Jak 3 to Jak 1 and 2.
2024-11-26 11:29:34 +01:00
Hat Kid 2ff49b9905
jak3: fix ragdolls settling too early (#3775)
`none` methods strike again

Fixes #3774
2024-11-22 02:36:50 +01:00
water111 5e3cb8faa6
[jak3] Fix stack layout for car spawn (#3765)
Fix for cars spawning under ground or in weird places

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-11-16 17:52:14 -05:00
Hat Kid af5cb9b1cb
jak3: `subtitle3`, `vag-player` (#3758) 2024-11-12 02:45:16 +01:00
water111 dff9ac163a
[custom levels] A few bug fixes (#3736)
- Bug fix to KD tree splitting, should fix cases with bad vertex
colors/alphas.
- Normalize normals instead of asserting if they are the wrong length.
**the fact that blender exports normals incorrectly is a bug and I doubt
their implementation is correct if you've scaled things on only on
axis.**
- Automatically resize metallic texture (envmap strength) if it doesn't
match the size of the rgb texture instead of asserting

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-10-27 12:31:41 -04:00
Hat Kid 7de5eb9fc0
jak3: misc fixes (#3686)
- Fix global heap display in cheat mode
- Fix `tpl-watcher` NaNs after they fire their laser (`vf0` was being
clobbered) (Fixes #3684)
- Fix `artifact-race` talkers (Fixes #3685)
2024-09-23 18:41:34 +02:00
water111 f60a155c0f
[jak3] Fix crash with volcano platforms (#3676)
Ended up being a simple fix to a stack type in rigid-body.

Co-authored-by: water111 <awaterford1111445@gmail.com>
2024-09-22 13:09:41 -04:00
Hat Kid 7053090541
jak3: decomp `bigmap`, `blit-displays`, fix `progress` crash (#3657)
`bigmap` and `blit-displays` mostly work. `blit-displays` is still
missing all of the special effects that were added in Jak 3 (brightness
and contrast settings, screen blur effect, etc.).

`bigmap` is missing the player marker texture (`hud-target-marker`) for
some reason, it's part of `tpage-17` which is coming from
`progress-minimap` and should already be included. The icons also
currently stretch when using aspect ratios other than 4:3.

The progress menu now also works for the most part. The draw order is a
bit messed up because some code was initially drawing things with the
ocean bucket, which was changed to use `hud-draw-hud-alpha` instead for
now. The texture for the volume and brightness/contrast sliders still
looks wrong.

Fixes #3653
Fixes #3656
2024-09-07 14:18:30 +02:00
Hat Kid bc66d416b4
decompiler: `call-parent-state-handler` and `suspend-for` macros (#3625)
Also fix `hud-draw-pris2` bucket in Jak 3 to make subtitles work and
foreground HUD envmap.
2024-09-04 19:35:54 +02:00
Tyler Wilding c72a086e49
jak2: support mirror mode (#3616)
Fixes #3210


![image](https://github.com/user-attachments/assets/86bb6a67-bc6a-4169-aa82-d6a46ecd43d7)

TIL that on the PS4/PS5, mirror mode breaks the upscaling
2024-07-30 23:30:53 -04:00
Tyler Wilding e975eab15a
decompiler: Apply docstring indentation fix to all game versions (#3614)
Previously was only applying to game versions above Jak 2, Fixes #3342
2024-07-29 21:57:07 -04:00
water111 9d0009715e
[jak3] Fix alpha for prims, entity-table (#3609)
Fix issue where light-trail is invisible and some actors not spawning
due to out of memory.
2024-07-27 12:46:33 -04:00
water111 3856ae505a
[jak3] Some cleanup/fixes around curve and light-trail (#3608)
They still don't work yet, this is just naming/comments to help with
debug.

The vehicle tracks are now at least trying to draw, but like the others,
don't actually show up.
2024-07-27 11:17:39 -04:00
Tyler Wilding 92c4390f0a
jak1: Adjust sprite positioning or hide them where appropriate when using non-standard aspect ratios (#3596)
This attempts to do a best-effort quick fix for the sprite alignment in
the menus and first person views on higher aspect ratios. This:
- Hides the binocular borders completely when using a non-standard ratio
![Screenshot 2024-07-20
021430](https://github.com/user-attachments/assets/c56d3a6c-13b0-43e1-b99b-83292993728c)
- Hides the borders in jak's first person view when using a non-standard
ratio
![Screenshot 2024-07-20
021310](https://github.com/user-attachments/assets/fefca993-960b-4741-87b7-6d7c17efe89d)
- Uses a combination of manual alignment and approximation to get the
pause menu closer.
![Screenshot 2024-07-20
151725](https://github.com/user-attachments/assets/2c8aa759-b33a-4fbe-abc6-b5861fc33208)
> 32:9 screenshot.

I accomplished the last one by manually aligning all of the core sprites
and text for the most popular aspect ratios. This means that from a
practical standpoint, things should align "perfectly". However, I then
used all of those values to derive a polynomial for each adjustment
based on the aspect ratio. This allows the game to do a half-decent
approximation/interpolation for every aspect ratio in-between the common
ones. It won't be perfect, but it will be better than this:

![image](https://github.com/user-attachments/assets/420b1e38-6f88-436a-8e8c-21df6b49428e)
2024-07-26 23:15:51 -04:00
water111 82a23c747e
[jak3] prim rendering for cloth (#3607) 2024-07-26 20:31:32 -04:00
water111 e81431bd21
[wip] Jak 3 Overlord (#3567) 2024-07-26 09:42:28 -04:00
Hat Kid 365fae4913
jak3: fix `bbush` rings (#3593)
Fixes #3592
2024-07-17 21:49:07 +02:00
Hat Kid bdded9ad8c
jak3: add missing texture animations (#3577)
This refactors some of the texture animation code a bit to better
support multiple games and adds most of the missing texture animations
for Jak 3 with a couple of exceptions/bugs:

- `hanga-sprite`: Despite `move_to_pool` being set for this anim, it's
not showing up in-game, but it does display properly in the ImGUI debug
window.

![image](https://github.com/open-goal/jak-project/assets/6624576/29df8e17-8831-412b-b9b7-7704d6bd7813)
- `factoryc-alpha`: Some conveyors do not have the animation for some
reason.

![image](https://github.com/open-goal/jak-project/assets/6624576/209ef073-2a81-4e2c-b020-dc2ae0b01196)
- This spot in Spargus seems to use texture animations, but it looks
like it maps to the `fora-water-dest` texture/slot, which comes from
`foresta-water`. Because the texture is not initialized, the texture
shows up black on first load, but it does show up after loading
`foresta`.

![image](https://github.com/open-goal/jak-project/assets/6624576/1e54bab2-f97c-47d5-a92a-a98a52c30178)

![image](https://github.com/open-goal/jak-project/assets/6624576/240b0137-1e9e-4e65-8446-0f78df9802dd)
- `hfrag` texture anim is not handled yet. Probably needs some special
casing.
2024-07-15 02:25:18 +02:00
Tyler Wilding c162c66118
g/j1: Cleanup all main issues in the formatter and format all of `goal_src/jak1` (#3535)
This PR does two main things:
1. Work through the main low-hanging fruit issues in the formatter
keeping it from feeling mature and usable
2. Iterate and prove that point by formatting all of the Jak 1 code
base. **This has removed around 100K lines in total.**
- The decompiler will now format it's results for jak 1 to keep things
from drifting back to where they were. This is controlled by a new
config flag `format_code`.

How am I confident this hasn't broken anything?:
- I compiled the entire project and stored it's `out/jak1/obj` files
separately
- I then recompiled the project after formatting and wrote a script that
md5's each file and compares it (`compare-compilation-outputs.py`
- The results (eventually) were the same:

![Screenshot 2024-05-25
132900](https://github.com/open-goal/jak-project/assets/13153231/015e6f20-8d19-49b7-9951-97fa88ddc6c2)
> This proves that the only difference before and after is non-critical
whitespace for all code/macros that is actually in use.

I'm still aware of improvements that could be made to the formatter, as
well as general optimization of it's performance. But in general these
are for rare or non-critical situations in my opinion and I'll work
through them before doing Jak 2. The vast majority looks great and is
working properly at this point. Those known issues are the following if
you are curious:

![image](https://github.com/open-goal/jak-project/assets/13153231/0edfaba1-6d36-40f5-ab23-0642209867c4)
2024-06-05 22:17:31 -04:00
ManDude 37762c5fb7
wrap sprite rgba to 0-255 (#3549) 2024-06-04 07:57:52 +01:00
ManDude ea1271cfd0
[jak3] implement autocollect and city turbo board cheats, fix actor heap and level flags (#3541) 2024-05-31 16:41:35 +01:00
Matt Dallmeyer 70ea2a1f67
jak3 - fill out some `text-id` entries (#3494)
Slam Dozer > Ram Rod
2024-05-30 21:49:10 -04:00
ManDude 645e649a9c
jak3: shadow culling hack + finish region debugging tools + fix bigmap crashes (#3532) 2024-05-23 23:43:38 +01:00
water111 271007e552
Start setting up texture animation for jak 3. (#3524)
For now, this just adds sky (clouds and fog), darkjak, and skull gem.

There are some unknown issues with drawing the skull gems still, but I
think it's unrelated to texture animations.

Also fixes https://github.com/open-goal/jak-project/issues/3523
2024-05-18 11:23:48 -04:00
Hat Kid c12a5d777c
decomp3: decompile remaining mission code (#3515)
This should make all missions playable with the exception of the end of
`precursor-destroy-ship` because `precurd` asserts on level extraction.

- `trail`
- `trail-graph`
- `wastrail-graph`
- `cty-protect`
- `protect-gunship`
- `protect-path`
- `protect-script`
- `assault-cams`
- `assault-enemies`
- `assault-path`
- `assault-script`
- `assault-shared`
- `assault-task`
- `hover-nav-precura`
- `precura-mood`
- `precura-obs`
- `precura-obs2`
- `precura-part`
- `precurc-mood`
- `precurc-obs`
- `precurc-part`
- `precurd-obs`
- `precurd-part`
- `precurd-scenes`
2024-05-16 16:21:44 +02:00
ManDude ebbbedabc5
jak3: fix hud sprite crash + add entity debugger (#3516) 2024-05-13 04:09:25 +01:00
Tyler Wilding d1ece445d4
Dependency graph work - Part 1 - Preliminary work (#3505)
Relates to #1353 

This adds no new functionality or overhead to the compiler, yet. This is
the preliminary work that has:
- added code to the compiler in several spots to flag when something is
used without being properly required/imported/whatever (disabled by
default)
- that was used to generate project wide file dependencies (some
circulars were manually fixed)
- then that graph underwent a transitive reduction and the result was
written to all `jak1` source files.

The next step will be making this actually produce and use a dependency
graph. Some of the reasons why I'm working on this:
- eliminates more `game.gp` boilerplate. This includes the `.gd` files
to some extent (`*-ag` files and `tpage` files will still need to be
handled) this is the point of the new `bundles` form. This should make
it even easier to add a new file into the source tree.
- a build order that is actually informed from something real and
compiler warnings that tell you when you are using something that won't
be available at build time.
- narrows the search space for doing LSP actions -- like searching for
references. Since it would be way too much work to store in the compiler
every location where every symbol/function/etc is used, I have to do
ad-hoc searches. By having a dependency graph i can significantly reduce
that search space.
- opens the doors for common shared code with a legitimate pattern.
Right now jak 2 shares code from the jak 1 folder. This is basically a
hack -- but by having an explicit require syntax, it would be possible
to reference arbitrary file paths, such as a `common` folder.

Some stats:
- Jak 1 has about 2500 edges between files, including transitives
- With transitives reduced at the source code level, each file seems to
have a modest amount of explicit requirements.

Known issues:
- Tracking the location for where `defmacro`s and virtual state
definitions were defined (and therefore the file) is still problematic.
Because those forms are in a macro environment, the reader does not
track them. I'm wondering if a workaround could be to search the
reader's text_db by not just the `goos::Object` but by the text
position. But for the purposes of finishing this work, I just statically
analyzed and searched the code with throwaway python code.
2024-05-12 12:37:59 -04:00
water111 e0b1d8c21e
Jak3 sky (#3514) 2024-05-12 09:36:50 -04:00
Hat Kid 6b3844bf99
decomp3: more misc files (#3513)
4 missions to go!

- `ctygenb-part`
- `power-game`
- `vinroom-part`
- `vinroom-scenes`
- `gungame-part`
- `gungame-scenes`
- `hiphog-obs`
- `hiphog-part`
- `hiphog-scenes`
- `hover-nav-lpattack`
- `king-rider`
- `rubble-attack`
- `rubble-obs`
- `rubble-part`
- `rubblea-init`
- `rublcst-scenes`
- `mood-funcs2`
- `gun-dummy-art`
- `gun-dummy-part`
- `gun-dummy`
- `gungame-data`
- `gungame-manager`
- `gungame-obs`
- `blow-tower-data`
- `blow-tower-extra`
- `blow-tower-obs2`
- `blow-tower-obs`
- `blow-tower-part`
- `blow-tower-script`
- `blow-tower-shared`
- `blow-tower-speech`
- `cty-blow-tower`
2024-05-11 17:57:26 -04:00
Hat Kid 4dd2bab06e
jak3: fix local space particle info crash (#3511) 2024-05-10 16:14:50 +02:00
water111 5b04be2fa0
Add hfrag, clean up some background renderer stuff (#3509)
This adds hfrag, but with a few remaining issues:
- The textures aren't animated. Instead, it just uses one texture.
- The texture filtering isn't as good as at it could be.

I also cleaned up a few issues with the background renderers:
- Cleaned up some stuff that is common to hfrag, tie, tfrag, shrub
- Moved time-of-day color packing stuff to FR3 creation, rather than at
level load. This appears to reduce the frame time spikes when a level is
first drawn by about 5 or 6 ms in big levels.
- Cleaned up the x86 specific stuff used in time of day. Now there's
only one place where we have an `ifdef`, rather than spreading it all
over the rendering code.
2024-05-09 20:11:43 -04:00
Hat Kid 949508d0ed
decomp3: traffic/citizen/faction code, `desert-rescue` (#3506)
- `cty-faction-h`
- `nav-graph`
- `citizen-h`
- `citizen`
- `civilian`
- `traffic-engine`
- `traffic-manager`
- `cty-attack-controller`
- `cty-faction`
- `formation-object`
- `formations`
- `squad-control-city-h`
- `squad-control-city`
- `traffic-util`
- `wlander-female`
- `wlander-h`
- `wlander-male`
- `speech-manager`
- `desert-rescue`
- `desresc-path`
- `neo-satellite`
- `rope-prim-system-h`
- `rope-prim-system`
- `rope-system`
- `wland-passenger`
- `cty-guard-projectile`
- `ctywide-init`
- `ff-squad-control`
- `guard-grenade`
- `guard-rifle`
- `guard-states`
- `guard-tazer`
- `ctywide-speech`
- `citizen-chick`
- `citizen-fat`
- `citizen-norm`
- `guard`
- `bike`
- `car`
- `test-bike`
- `vehicle-rider`
- `desert-rescue-bbush`
- `ff-squad-control-h`
- `flee-info`
- `guard-h`
- `mission-squad-control`
- `kg-squad-control`
- `kg-squad-member-h`
- `kg-squad-member`
- `mh-squad-control`
- `mh-squad-member-h`
- `mh-squad-member`
- `ctywide-obs-h`
- `ctywide-obs`
- `ctywide-part`
- `ctywide-scenes`
- `ctywide-tasks`
- `ctywide-texture`
- `billiards`
- `guide-arrow`
- `kg-vehicles`
- `flying-turret`
- `roboguard-city`
- `citizen-enemy`
- `metalhead-flitter`
- `metalhead-grunt`
- `metalhead-predator`
- `spydroid`
- `kg-squad-control-h`
- `mh-squad-control-h`
- `krimson-wall`
- `ctyport-obs`
- `ctyinda-obs`
- `ctyinda-part`
- `ctyindb-obs`
- `ctyindb-part`
- `ctyport-attack`
- `h-torpedo`
- `ctyport-part`
- `ctyport-scenes`
- `external-player-control`
- `desert-chase-path-h`
- `desert-chase-path`
- `desert-chase`
- `desert-jump`
- `wcar-catapult`
- `bombbot-h`
- `bombbot`
- `bombbot-path`
- `cty-hijack-missile`
- `cty-hijack`
- `ctyport-attack-bbush`
- `ctysluma-part`
- `ctyslumb-part`
- `ctyslumc-obs`
- `ctyslumc-part`
- `searchlight`
- `cty-destroy-grid`
- `ctyfarm-obs`
- `ctyfarma-part`
- `ctyfarmb-part`
- `freehq-part`
- `freehq-scenes`
- `onintent-scenes`
- `onintent-part`
- `cty-sniper-battery`
- `cty-sniper-turret`
- `intro-obs`
- `intro-part`
- `intro-scenes`
- `palcab-part`
- `palroof-part`
2024-05-09 19:18:55 -04:00
water111 807ca7465f
fix c++ compiler warnings, extract_merc assert (#3488)
Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2024-05-03 17:29:18 +01:00
Hat Kid f9e0aa82bc
jak3: fix mirage shot (#3501) 2024-05-01 21:57:13 +02:00
Hat Kid 3ff3760621
jak3: add discord rpc and fix some decomp (#3500) 2024-05-01 13:49:26 +02:00
ManDude 5705359df9
[jak3] fix some flag names and a wcar crash (#3498) 2024-05-01 08:44:26 +01:00