Commit graph

1121 commits

Author SHA1 Message Date
Tyler Wilding 60db0e5ef9
deps: update fmt to latest version (#3403)
This updates `fmt` to the latest version and moves to just being a copy
of their repo to make updating easier (no editing their cmake / figuring
out which files to minimally include).

The motivation for this is now that we switched to C++ 20, there were a
ton of deprecated function usages that is going away in future compiler
versions. This gets rid of all those warnings.
2024-03-05 22:11:52 -05:00
Tyler Wilding 258fd75cd6
decomp: update naming across jak2/3 (#3395) 2024-03-03 20:49:40 -05:00
Hat Kid 2969833b2d
decomp3: more engine stuff, detect non-virtual state inheritance (#3377)
- `speech`
- `ambient`
- `water-h`
- `vol-h`
- `generic-obs`
- `carry-h`
- `pilot-h`
- `board-h`
- `gun-h`
- `flut-h`
- `indax-h`
- `lightjak-h`
- `darkjak-h`
- `target-util`
- `history`
- `collide-reaction-target`
- `logic-target`
- `sidekick`
- `projectile`
- `voicebox`
- `ragdoll-edit`
- most of `ragdoll` (not added to gsrc yet)
- `curves`
- `find-nearest`
- `lightjak-wings`
- `target-handler`
- `target-anim`
- `target`
- `target2`
- `target-swim`
- `target-lightjak`
- `target-invisible`
- `target-death`
- `target-gun`
- `gun-util`
- `board-util`
- `target-board`
- `board-states`
- `mech-h`
- `vol`
- `vent`
- `viewer`
- `gem-pool`
- `collectables`
- `crates`
- `secrets-menu`

Additionally:

- Detection of non-virtual state inheritance
- Added a config file that allows overriding the process stack size set
by `stack-size-set!` calls
- Fix for integer multiplication with `r0`
- Fixed detection for the following macros:
	- `static-attack-info`
- `defpart` and `defpartgroup` (probably still needs adjustments, uses
Jak 2 implementation at the moment)
- `sound-play` (Jak 3 seems to always call `sound-play-by-name` with a
`sound-group` of 0, so the macro has been temporarily defaulted to use
that)

One somewhat significant change made here that should be noted is that
the return type of `process::init-from-entity!` was changed to `object`.
I've been thinking about this for a while, since it looks a bit nicer
without the `(none)` at the end and I have recently encountered init
methods that early return `0`.
2024-03-03 15:15:27 -05:00
Luminar Light 0ae0938965
Only remove -vis from name if it is part of the name. (#3257)
During level extraction, the last 4 characters of the level name are
always removed, because it is assumed that '-vis' is there. But it isn't
always there. This is especially true in post-TPL games.

This causes multiple problems:
- There can be levels in the extraction that will miss their last 4
characters from their name, which is sad, and may make it harder to
identify them.
- If there are '-vis'-less levels whose names are identical apart from
the last 4 characters, the extractor will only get the last one (it
probably extracts all but overwrites everything but the last one). For
example 'ctyasha' and 'ctykora'.

This issue affects the glb extraction and the entities json extraction.

I personally think that just keeping the -vis in the name would be the
best solution, but I guess there was a reason why it was decided that it
should be removed from the name. So to adapt to this, my implementation
will still remove '-vis' from the name, but only if it is actually in
the name - otherwise it won't remove anything.

I hope my changes didn't break anything. Extraction seemed to run fine
after my changes, and I was able to see both ctyasha and ctykora json
files. And didn't see any '-vis', so it is still properly removed.

---------

Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2024-02-24 14:13:48 -05:00
Matt Dallmeyer d5f92efcda
Rename bigmap-id enum entries (#3380)
also fixed some docstrings that were swapped
2024-02-23 14:46:57 -05:00
Ziemas 4e569f0115
Switch to std::span (#3376)
Now that we have cpp20 we can ditch nonstd::span.

Depends on #3375
2024-02-18 13:23:19 -05:00
Ziemas 4afefc5a82
Update to C++20 (#3193)
Just putting this here for consideration, I'm personally not in a big
rush to get it.

---------

Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2024-02-17 14:14:23 -05:00
Hat Kid 406441038b
decomp3: game-info, game-task, game-save, level-info, process-drawable and more (#3374)
- `settings`
- `generic-vu1`
- `generic-vu0`
2024-02-15 11:16:07 +00:00
ManDude c99f9a4834
decomp loader (#3373)
fixes `defskelgroup` being broken in jak 2

switches jak 3 to the jak 3 font (currently identical to jak 2)
2024-02-13 16:38:58 +00:00
water111 d8181fb169
[jak3] joint-mod, subdivide, bsp (#3371) 2024-02-11 13:53:29 -05:00
water111 79d14af0b5
Decompile joint, collide-func, clean up joint decompression code for all games (#3369)
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.
2024-02-11 09:50:07 -05:00
Hat Kid a4e629ebf9
decompiler: defskelgroup macro detection for jak 3, fix art group dumping for jak 3 and some more decomp work (#3370)
- `transformq`
- `wind-work`
- `progress-static`
- `merc-vu1`
- `emerc-vu1`
- `merc`
- `emerc`
- `cloth-h`
- Most of `cloth`, not added to gsrc yet

Art group dumps were incorrect for Jak 3 because the master art group
fields were at different offsets.
2024-02-11 09:32:06 -05:00
Tyler Wilding 18903f0561
decomp: Copy over new docstrings back to jak 2's common code, write some scripts to help automate this (#3366) 2024-02-04 13:53:06 -05:00
Tyler Wilding 314f488377
d/j3: do a few mood related files and fix some issues along the way (#3365) 2024-02-04 08:40:43 -05:00
water111 221360270a
[jak3] decomp gsound (#3364)
Decompile `gsound.gc`
2024-02-03 17:16:23 -05:00
water111 8b1c7759ea
[jak3] More headers, up to load-dgo (#3363)
path-h, sparticle-h, load-dgo, nav-control-h, nav-mesh-h, rigid-body-h,
actor-hash-h, spatial-hash-h
2024-02-03 15:03:10 -05:00
water111 af2fa6acbc
[jak3] More headers again again (#3359)
collide-cache-h, collide-h, projectile-h, background-h, subdivide-h,
hfrag-h, shrubbery-h, tfrag-h, tie-h
2024-02-03 12:15:51 -05:00
Hat Kid 9e8bee5b42
decomp3: more headers (again) (#3362)
- `entity-h`
- `eye-h`
- `simple-sprite-h`
- `sprite-h`
- `cam-debug-h`
- `cam-update-h`
- `cam-interface-h`
- `hud-h`
- `actor-link-h`
- `camera-h`
- `progress-h`

Also fills out a lot of the `text-id` enum. `progress-static` is also
very close to ready, only being blocked by #3361.
2024-02-03 11:39:29 -05:00
water111 b1b5cbb143
[jak3] More headers again (#3352)
joint-mod-h
collide-frag-h
projectile-h
stats-h
bsp-h
chain-physics-h
ragdoll-h
collide-hash-h
2024-02-01 18:46:54 -05:00
Hat Kid 7e5541d793
decomp3: more headers (#3356)
- `pov-camera-h`
- `sync-info-h`
- `trajectory-h`
- `collide-target-h` (`control-info` just padded out for now)
- `water-info-h`
- `process-drawable-h`
- `process-focusable`
- `focus`
- `effect-control-h`
- `process-taskable-h`
- `generic-obs-h`
- `target-h`
2024-02-01 17:58:10 -05:00
water111 1cccfbbf78
[jak3] More headers! (#3351)
Decomp aligner-h, joint-h, prim-h, debug-h, game-h, penetrate-h,
bones-h, foreground-h, scene-h, script-h.

Also, has a little bit of the joint-mod-h file, but it's not finished
yet.
2024-01-31 19:05:12 -05:00
Hat Kid ea93d32acc
decomp3: more misc files (#3349)
- `pat-h`
- `engines`
- `res-h`
- `res`
- `fact-h`
- `game-info-h`
- `wind-h`
- `merc-h`
- `shadow-vu1-h`
- `shadow-cpu-h`
- `dynamics-h`
- `memcard-h`
- `surface-h`
- part of `gui-h`
- `ambient-h`
- `speech-h`
- `prototype-h`
- `smush-control-h`
- `generic-merc-h`
- `generic-work-h`
- `collide-func-h`
- `collide-mesh-h`
- `collide-shape-h` (only missing the `new` method for `collide-shape`
because we don't have `process-drawable` yet and that also needs joint
stuff etc.)
- `collide-touch-h`
- `collide-edge-grab-h`
- `lightning-h`

This also adds argument name remaps for the `relocate` and `mem-usage`
methods (Jak 1 and 2 ref tests were updated, but not the gsrc).
2024-01-31 18:25:06 -05:00
Matt Dallmeyer 1979f94e45
Rip collision based on config flag (#3348)
Added a new `rip_collision` flag to the decompiler config and wired it
up. Cleaned up the comments around these fields in the JSON too for
clarity

Also refactored a bunch of the related extract functions to read from
`config` object rather than pass down a bunch of booleans
2024-01-29 22:15:42 +01:00
water111 ba8d4c2903
[jak3] Drawable header decomp (#3347) 2024-01-28 14:23:41 -05:00
water111 bfe0a72ae7
[jak3] decompile (but not port) texture (#3346)
For now - just a plain decompilation, with no PC port changes. I think
it'll be easier to do those once we have a little bit more decompiled.
2024-01-27 16:30:18 -05:00
water111 8d0d05717f
[jak3] misc. headers (#3345)
trail-h, minimap-h, bigmap-h, capture, memory-usage-h, blit-displays-h,
sky-h, rest of ocean-h
2024-01-27 14:06:21 -05:00
water111 5fe4d12f70
[jak3] dma-disasm, time-of-day-h, texture-anim-h, level-h (#3344) 2024-01-27 13:09:37 -05:00
water111 4bd5111280
[jak3] dma, dma-bucket, dma-buffer (#3331) 2024-01-27 11:44:08 -05:00
Hat Kid f045e6cef1
decomp3: font-h, display, profile, settings-h, camera-defs-h, text-h (#3335) 2024-01-27 11:27:34 -05:00
Hat Kid 17f5f74238
jak3: dump of all vu programs (#3340)
With the exception of `sprite` and the new `hfrag` renderer, everything
appears to be identical to Jak 2.
2024-01-27 11:38:03 +01:00
Tyler Wilding 7ef2c2fac3
decomp: add a new config flag to disable var-name casts (#3338)
This is handy when you want to try comparing the decompiler's output
across games (ie. for checking if only naming differs)
2024-01-25 21:28:47 -05:00
Hat Kid 0ea718a5ee
decomp3: loader-h, capture-h, math-camera-h, math-camera, connect, gs, texture-h (#3333) 2024-01-25 15:44:26 +01:00
Hat Kid 3a2c57c091
decomp3: timer, display-h, decomp-h, file-io, pad (#3332) 2024-01-23 23:52:15 -05:00
water111 b130c2f439
[jak3] A few early files (#3330)
types-h, vu1-macros, gsound-h, dma-h, video-h, vu1-user-h, profile-h

The `gsound-h` is very simple, but the rest have decent docs and all the
macros we had from jak 2.

So far, barely any differences! (there's a few in gsound-h)
2024-01-22 21:09:48 -05:00
Ziemas 3dc27e37e5
decompiler: Extract Jak3 VAGs (#3328) 2024-01-22 20:47:06 -05:00
Hat Kid d4c21c784f
decomp3: geometry, vector, timer-h, ocean table files and game-task related enums (#3329) 2024-01-22 20:45:53 -05:00
water111 01d5fc2bbb
[jak3] Decomp for gkernel, gkernel-h, gstate, gstring (#3326)
I ported the kernel test from jak1/jak2 to jak 3, and it's passing!
2024-01-21 18:08:05 -05:00
Tyler Wilding 5ddf1e4b4d
lsp: flag unnamed variables in IR files (#3325)
![image](https://github.com/open-goal/jak-project/assets/13153231/a020fbf6-65b9-4317-8a9d-5991f2d15e32)
2024-01-21 01:05:41 -05:00
water111 1c0038294f
[jak3] Decompile gcommon (#3321)
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.
2024-01-20 12:33:39 -05:00
Hat Kid 9a4929ac0c
decomp3: some engine files (#3319)
- `vector-h`
- `gravity-h`
- `bounding-box-h`
- `matrix-h`
- `quaternion-h`
- `euler-h`
- `transform-h`
- `geometry-h`
- `trigonometry-h`
- `transformq-h`
- `bounding-box`
- `matrix`
- `matrix-compose`
- `transform`
- `quaternion`
- `euler`
- `trigonometry`

Not a whole lot of changes, just a couple of new functions and one new
file (`matrix-compose`).
2024-01-20 10:42:51 -05:00
Hat Kid 85039fe2d6
jak3: fix all-types file order (#3316)
In #3300, `per_object` in `ObjectFileDB::ir2_analyze_all_types()` was
changed to an `unordered_map`, which messed with the object file order
in `all-types`. This fixes the issue by going through each object file
in order and then looking up the type info from the map instead of
iterating through the map.

This also removes the method IDs from the old method comments and adds a
stub for the `new` method if there is an old method comment for it, in
order to stay consistent with the rest of the method list.
2024-01-18 14:57:10 +01:00
water111 4f537d4a71
[jak3] Set up ckernel (#3308)
This sets up the C Kernel for Jak 3, and makes it possible to build and
load code built with `goalc --jak3`.

There's not too much interesting here, other than they switched to a
system where symbol IDs (unique numbers less than 2^14) are generated at
compile time, and those get included in the object file itself.

This is kind of annoying, since it means all tools that produce a GOAL
object file need to work together to assign unique symbol IDs. And since
the symbol IDs can't conflict, and are only a number between 0 and 2^14,
you can't just hash and hope for no collisions.

We work around this by ignoring the IDs and re-assigning our own. I
think this is very similar to what the C Kernel did on early builds of
Jak 3 which supported loading old format level files, which didn't have
the IDs included.

As far as I can tell, this shouldn't cause any problems. It defeats all
of their fancy tricks to save memory by not storing the symbol string,
but we don't care.
2024-01-16 19:24:02 -05:00
Tyler Wilding 4101d5d80e
tests: add jak3 typeconsistency test and ensure offline tests are working (#3310) 2024-01-16 00:15:33 -05:00
jabermony 07427799a6
Jak3 Build Environment (#3098)
This sets out the bones of a Jak 3 build, many things are stubbed out,
guessed, or copied from Jak 2 but it should at least be good enough to:
run `task set-game-jak3`
launch the repl
run builds from the repl

build outputs themselves are untested but the build itself runs without
errors

---------

Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
2024-01-15 20:37:16 -05:00
Hat Kid 619f39d3b7
custom levels: enum lump support (#3305)
This adds support for using enums in lumps using the new lump types
`enum-int32` and `enum-uint32`. Also adds these other new lump types:

- `water-height` (takes 3 meter floats, an enum and another optional
meter float)
- `eco-info` (takes an enum and an int)
- `vector3m` (3 meter floats + `w` set to 1.0)
2024-01-15 12:46:42 +01:00
Matt Dallmeyer 2071c98b55
Fix cases of string formatting with non string literals (#3304)
The logger used in `goalc` tries to print an already-formatted string
`message` using `fmt::print(message);` Usually this doesn't cause
problems, but if you try to print, for example, an exception that has
special characters (notably `{`) it will try to do another round of
formatting/replacements, despite not having any args to replace with,
which ends up throwing another exception. This is why errors when
parsing custom level JSON cause the REPL to exit.

I've hopefully identified all the various instances of this across the
codebase
2024-01-14 12:02:08 +00:00
ManDude 7a8aa71204
[jak2] implement statistics tracker (#3288)
Currently only tracks enemy kills, and how they were killed. There is
currently no menu for this, but I've already added most of the text for
it. Also did a bunch of misc decompilation fixes and renamed some
methods.

Fixes #3277 
Fixes #3278
2024-01-11 22:49:41 +00:00
Tyler Wilding 4cccaf2645
d/j3: all-types: guess at associated process for non-virtual states and fix some issues along the way (#3300)
This will make a best effort attempt at guessing which process a
non-virtual state belongs to:
![Screenshot 2024-01-08
195309](https://github.com/open-goal/jak-project/assets/13153231/69132f10-823d-4df5-b2d6-662d4dd754a0)

I also noticed some issues while working on this, mainly around how
virtual states were being output. They were being duplicated, for
example:
![Screenshot 2024-01-08
184733](https://github.com/open-goal/jak-project/assets/13153231/1edb0f1a-3ac7-46cb-96cd-cf93d42fb01f)
or
![Screenshot 2024-01-08
193730](https://github.com/open-goal/jak-project/assets/13153231/45673653-4000-45bb-af00-9baa6e2a70ae)

I think I've fixed that, but @Hat-Kid I defer to you to see if i've done
something terrible.
![Screenshot 2024-01-08
194513](https://github.com/open-goal/jak-project/assets/13153231/75543d2e-69da-4bbd-b143-2f824b9d8dde)
2024-01-09 16:50:05 -05:00
Matt Dallmeyer 9d680a0aba
Support extracting collision to obj for jak2/3 formats (#3292)
![image](https://github.com/open-goal/jak-project/assets/2515356/b4d43254-4fc4-4f66-92d1-0d61e471b90e)

![image](https://github.com/open-goal/jak-project/assets/2515356/d2fa9fb8-5f51-43c5-8e0e-b51b64499b72)
2024-01-05 09:36:09 +01:00
ManDude 349919f788
[jak2] implement pc cheats in menu (#3275)
Adds the opengoal cheats to the secrets menu. Only cheats that are fully
functional and unlockable are there right now, which is eight cheats.

This update will reset most Jak 2 settings.

Also fixes #3274 .
2023-12-28 11:14:10 +00:00