I finally read through all the joint code and wrote up some
documentation. I think this will be really helpful when we try to
understand all the functions in `process-drawable`, or if somebody ever
wants to import/export animations.
This switches all three games to using a new faster GOAL joint
decompressor. It is on by default, but you can go back to the old
version by setting `*use-new-decompressor*` to false.
Also fix the log-related crash, fix the clock speed used in timer math.
Decompile `gcommon`. I adjusted the spacing of docstring comments, and
removed some spammy decompiler warning prints.
I also added some random notes I had on VU programs from jak1/jak2. They
are not polished, but I think it's still worth including since we'll
have to go through them again for jak 3.
Should fix https://github.com/open-goal/jak-project/issues/2679
Here's a test program that will trigger the bug when near these guards:
```lisp
(define *cquery* (new 'global 'collide-query))
(defun test-bad-collide ()
(let ((lower (new 'static 'vector :x 1681893.8750 :y 61314.2031 :z 345208.6562 :w 1.))
(upper (new 'static 'vector :x 1701603.8750 :y 67624.0625 :z 357881.0312 :w 1.))
;(cquery (new 'stack-no-clear 'collide-query))
)
(set! (-> *cquery* collide-with) (the-as collide-spec 1))
(set! (-> *cquery* ignore-process0) #f)
(set! (-> *cquery* ignore-process1) #f)
(set! (-> *cquery* ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
(set! (-> *cquery* action-mask) (collide-action solid))
(set! (-> *cquery* bbox min quad) (-> lower quad))
(set! (-> *cquery* bbox max quad) (-> upper quad))
(format 0 "doing collide...~%")
(fill-using-bounding-box *collide-cache* *cquery*)
(format 0 "have ~d and ~d~%" (-> *collide-cache* num-tris) (-> *collide-cache* num-prims))
)
(none)
)
```
As far as I can tell, there's a totally invalid collide-hash with an
inside `axis-scale.z`. On the PS2, it gets ignore because of how
float->int works for floats that are too big. On PC, it ends up using a
negative value and loop forever.
This PR is a combination of
https://github.com/open-goal/jak-project/pull/2507 and some additional
changes to port Shadow VU1 to OpenGL. As far as I can tell, it's
working.
---------
Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
Definitely needs a clean up pass, but I think the functionality is very
close.
There's a few "hacks" still:
- I am using the emerc logic for environment mapping, which doesn't care
about the length of the normals. I can't figure out how the normal
scaling worked in etie. I want to do a little bit more experimentation
with this before merging.
- There is some part about adgifs for TIE and ETIE that I don't
understand. The clearly correct behavior of TIE/ETIE is that the alpha
settings from the adgif shader are overwritten by the settings from the
renderer. But I can't figure out how this happens in all cases.
- Fade out is completely disabled. I think this is fine because the
performance difference isn't bad. But if you are comparing screenshots
with PCSX2, it will make things look a tiny bit different.
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)
* [WIP] initial sprite distort implementation
* Clean up
* More clean up + document sprite distort VU program
* Format code
* Address CI issues
* Adjust hacks in distort fragment shader
* oops
* Optimize sprite distort rendering down to one draw call
~2x speed up
* Format file
* Clean up distort rendering and add separate profile scopes
* Fix glVertexAttribPointer
* Fix sprite distort getting messed up when the viewable area doesn't fit the window perfectly
* Add debug option to disable sprite distort
* One evil space to fail CI...
* oops
* Increase sprite-aux-list size when PC_BIG_MEMORY is true
* Address lints
* git: ignore vs build dir
* cmake: ditch `clang-cl` on windows in favor of actual `clang`
* build: suppress a significant number of warnings
* build: adjust workflows and vendor nasm
* docs: update docs to remove `clang-cl` mentions
* build: fix some copy-paste mistakes in the linux build
* build: remove C++20 compat warnings as that is useful if we want to upgrade
* docs for ee merc code
* wip
* more extraction stuff
* partial mat1 working
* mat1
* cleanup
* partial mat2 and mat3 support
* merc extraction seems to work
* [goalc] macro expansion in integer constants
* working
* didn't break it yet
* support conditional compilation
* fix up some more small bugs
* fix duplicate evaluation of bitfield definitions
* paranoid
* decompile 90% of shrubbery
* some more progress
* some more
* big function decompiled
* went through `draw-prototype-inline-array-shrub` and made more notes
* shrub: start implementing extract_shrub
* read through current notes and add the info to current decomp
* decomp: allow skipping inline-asm from output
* add code to BspHeader to get GOAL types for shrubs
* add doc
* wip
* fix bad merge
Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
Co-authored-by: Tyler Wilding <xTVaser@users.noreply.github.com>
* rewrite memcard and game-save code
* fix memcard status and bank check
* more robustness
* fix bank pick on card update
* fix load file bugs
* bug fixes and final touches
* add timers and turn off prints
* optimization?
* update pics
* make money starburst slightly easier to see
* fix first time save bug
* reduce filesystem load a bit
* too bright
* Optimize `file_is_present`
* bug & crash fixes
* relax fog hack slightly
* buff particles more
* borderless hack
* tone down sprite hack
* int consts in `deftype` + increase sparticle queue
* move a menu button around
* clang + test fixes
* less confusing image
* add test for new deftype feature
* ci: switch to codacy for coverage
* docs: update badges
* decomp: allow overriding config flags via CLI
* cleanup: top level file cleanup
* docs: big README overhaul
Attempt to close#1128 and #1086
* decomp: attempt to detect if `iso_data` is missing or wrongly extracted
* game: switch to `fpng` for screenshots, allow for compression
closes#1035
* game: switch vsync control to a checkbox
* lint: format cpp files
* lint: format json files
* docs/scripts: organize taskfile
* also add a new sprite renderer
* claaaang
* goal build fix
* fix tests, add stack singleton option
* make all event-message-blocks the same
* diskboot
* docs: quick update of readme and windows screenshots for vs 2022
* update the docs portal to be better on mobile, support videos, and better gallery
* docs: re-generate site