Commit graph

97 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
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
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 bf961a36f4
decompiler: some hacks to allow running decompiler on jak 3 v5 code files, improve all-types generation (#2526)
Co-authored-by: water <awaterford111445@gmail.com>
2023-10-07 22:14:12 +02:00
ManDude fe491c2b5e
[opengoal] make none a child of object (#3001)
Previously, `object` and `none` were both top-level types. This made
decompilation rather messy as they have no LCA and resulted in a lot of
variables coming out as type `none` which is very very wrong and
additionally there were plenty of casts to `object`. This changes it so
`none` becomes a child of `object` (it is still represented by
`NullType` which remains unusable in compilation).

This change makes `object` the sole top-level type, and the type that
can represent *any* GOAL object. I believe this matches the original
GOAL built-in type structure. A function that has a return type of
`object` can now return an integer or a `none` at the same time.
However, keep in mind that the return value of `(none)` is still
undefined, just as before. This also makes a cast to `object`
meaningless in 90% of the situations it showed up in (as every single
thing is already an `object`) and the decompiler will no longer emit
them. Casts to `none` are also reduced. Yay!

Additionally, state handlers also don't get the final `(none)` printed
out anymore. The return type of a state handler is completely
meaningless outside the event handler (which is return type `object`
anyway) so there are no limitations on what the last form needs to be. I
did this instead of making them return `object` to trick the decompiler
into not trying to output a variable to be used as a return value
(internally, in the decompiler they still have return type `none`, but
they have `object` elsewhere).

Fixes #1703 
Fixes #830 
Fixes #928
2023-09-22 10:54:49 +01:00
water111 f39b993f79
[decommp] generic-obs (#2013) 2022-11-12 17:56:07 -05:00
ManDude b0e8cba6f1
[decomp2] game-save (#1988)
memory card code was not done!
2022-10-29 16:08:04 -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
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 4d751af38e
logs: replace every fmt::print with a lg call instead (#1368)
Favors the `lg` namespace over `fmt` directly, as this will output the
logs to a file / has log levels.

I also made assertion errors go to a file, this unfortunately means
importing `lg` and hence `fmt` which was attempted to be avoided before.
But I'm not sure how else to do this aspect without re-inventing the
file logging.

We have a lot of commented out prints as well that we should probably
cleanup at some point / switch them to trace level and default to `info`
level.

I noticed the pattern of disabling debug logs behind some boolean,
something to consider cleaning up in the future -- if our logs were more
structured (knowing where they are coming from) then a lot this
boilerplate could be eliminated.

Closes #1358
2022-10-01 11:58:36 -04:00
water111 06ef52cd25
[decompiler] support for jak 2 (#1781)
* [decompiler] suppport jak 2

* cleanpu

* remove brief from gtest options

* fix test
2022-08-22 18:53:51 -04:00
Tyler Wilding b3e77c673f
decomp/lsp: Differentiate warnings from likely/definite errors (#1725)
* decomp: differentiate potential false positive warnings from likely/certain failures

* lsp: handle IR2 errors

* decomp: downgrade an expr building warning as often expressions build fine

* tests: update reference tests since comments aren't ignored

* decomp: simplify warnings interface

* tests: update ref tests
2022-08-06 11:52:36 -04:00
Tyler Wilding 01c70368e3
LSP: initial LSP implementation for IR files to assist with decompilation (#1647)
* lsp: json-rpc example is working, a decent place to start...

* lsp: vendor library

* lsp: cleanup and time to get started

* lsp: commit what i got so far

* lsp: example `initialize` payload

* lsp: switch to `stdio`

* stash

* modularize the lsp implementation

* lsp: implement first actual LSP feature - function names in outline

* lsp: produce document diagnostics

* lsp: remove unused third-party lib

* lsp: support hovering MIPS instructions in IR files

* lsp: basic go-to all-types definition

* stash

* lsp: cleanup code, just need to add it to the release artifacts

* fix some project configuration

* fix linux build

* lsp: add lsp to PR artifacts and release assets

* lsp: address feedback
2022-07-18 18:26:57 -04:00
water111 91fa0122d8
[decompiler] Jak 2 modifications, new all-types code (#1553)
* temp

* look at old game types

* clean up
2022-06-25 21:26:15 -04:00
Tyler Wilding 2d595c1ac0
lint: add include sorting config to clang-format (#1517) 2022-06-22 23:37:46 -04:00
water111 ecb2781a89
[decompiler] cleanup to get atomic ops working on jak2 inputs (#1426)
* [decompiler] cleanup to get atomic ops working on jak2 inputs

* clang format
2022-06-08 18:34:52 -04:00
Tyler Wilding c4a92571b2
Improve ASSERT macro, fix linux file paths in Taskfile and hopefully fix the windows release (#1295)
* ci: fix windows releases (hopefully)

* scripts: fix Taskfile file references for linux

* asserts: add `ASSERT_MSG` macro and ensure `stdout` is flushed before `abort`ing

* asserts: refactor all `assert(false);` with a preceeding message instances

* lint: format

* temp...

* fix compiler errors

* assert: allow for string literals in `ASSERT_MSG`

* lint: formatting

* revert temp change for testing
2022-04-12 18:48:27 -04:00
water111 f341be65e9
remove old ir1 code (#1287) 2022-04-09 11:46:56 -04:00
water111 78cde74d5a
update readme and fix always playing str (#1139)
* update readme deps

* replace assert

* bump timeout

* fix memory corruption in kernel

* use unknown if level name is invalid
2022-02-08 19:02:47 -05:00
water111 38c805ca7c
unused version of collide line sphere collide list (#1071) 2022-01-09 17:45:19 -05:00
water111 474a8494d8
remove gd files, simplify fakeiso (#1053)
* remove gd files, simplify fakeiso

* fix bug in decompiler mistakenly marking functions as asm
2022-01-04 23:36:39 -05:00
ManDude c9204f2a9b
Fix Windows asserts (#1045)
* fix release mode asserts

* clang

* dummy
2022-01-02 18:02:10 -05:00
water111 d6e82eedb0
[decomp] fix and decomp part tester (#935)
* temp

* update tests
2021-10-23 20:15:31 -04:00
water111 f0ceea8b2e
[sparticle] 2d hud particles (#849)
* wip, taking a break to work on asm stuff first

* the goal code for sparticle

* mips2c the first sparticle asm function

* temp

* particle processing no longer crashing

* temp

* working texture cache for vi1 and hud textures

* sprites

* cleanup 1

* temp

* temp

* add zstd library

* temp

* working

* tests

* include fix

* uncomment

* better decomp of sparticle stuff, part 1

* update references
2021-09-26 11:41:58 -04:00
water111 f9d8fcd6e4
[decomp] add mips2c converter (#842)
* mips 2 c basic version, not yet tested

* calling works without crashing, but the function doesn't

* it works

* add test

* cleanup and actually add the test

* dont use mips2c by default for font

* clean up formatting
2021-09-11 20:52:35 -04:00
water111 403bb5f4de
[decomp] game-info (#779)
* support more process stuff

* more of game info

* add ref file

* progress on save
2021-08-22 20:12:47 -04:00
water111 e4f5e8eebd
improve warnings (#770) 2021-08-18 20:19:01 -04:00
water111 97ab6a4e12
add support for non virtual states (#764)
* add support for non virtual states

* typecheck go

* start on virtual states

* more support for virtual states

* offline passes

* fix tests

* use behavior shortcut instead of lambda

* final cleanup of virtual go

* unused var warnings and fix inconsistent enum decompile order on win vs linux

* fix thread safety bug with goal symbol table and vif1 interrupt handler

* fix type mistake
2021-08-17 20:54:03 -04:00
water 78928e4c04 temp 2021-08-14 23:15:10 -04:00
water 72340811e5 decomp decomp 2021-08-14 16:49:45 -04:00
water111 2b6684aa5c
[decompiler] Working toward bsp (#717)
* clean up

* before int to float stuff

* before trying to eliminate the separate read and write maps

* partial fix for register issues

* add missing include
2021-07-25 15:30:37 -04:00
water111 656489e942
[decomp] Clean up - part 2 (#687)
* temp

* temp2

* basic case support

* working for or without else

* support more cases

* clean up to drawable headers

* ocean

* format json
2021-07-11 16:35:25 -04:00
water111 1898c7c52a
[decomp] texture (#684)
* temp

* more cleanup

* fix merge issue

* handle no texture correctly
2021-07-09 22:20:37 -04:00
water111 551a9c4955
[decompiler] ASM Branching Support (#677)
* basic example working in geometry

* before updating offline'

* clean up

* temp

* progress
2021-07-05 16:07:07 -04:00
water111 4bea175140
[decompiler/compiler] Fixes for task-control (#668)
* fix decompiler for task control

* support in compiler

* changelog

* typo
2021-07-01 21:38:19 -04:00
water111 1ffd42e090
[decomp] clean up and make level-update-after-load work (#628)
* temp

* make level-update-after-load work

* add missing const
2021-06-26 13:03:31 -04:00
water111 44f8ff6d25
[decompiler] bug fixes related to infinite loop CFGs, argument registers (#622)
* temp

* clean up

* more clean
2021-06-23 22:09:02 -04:00
water111 84c0522102
[decompiler] Add pass to generate a symbol definition map file (#546)
* add symbol order file

* class to struct fix for windows
2021-05-31 10:43:25 -04:00
water111 0f0902eabf
add config option for changing cond splitting behavior (#522) 2021-05-24 19:52:19 -04:00
water111 d719bf5677
[decompiler] support break (#516)
* support break

* finish implementation of break, decomp method 19 of res
2021-05-23 20:16:34 -04:00
water111 8d4b644a14
fix cond with else that is empty bug (#470) 2021-05-12 15:54:33 -04:00
water111 0599d144f8
[decompiler] Clean up config more (#458)
* remove global config

* fix dir
2021-05-11 20:49:54 -04:00
water111 433993074a
Clean up some errors/crashes in decompiler (#452)
* fix offline tests, clean up some warnings

* clean up warnings during decomp

* fix remaining crash issues
2021-05-11 16:43:13 -04:00
ManDude fef9b139d7
Force-enable assert on release mode Windows build (#440) 2021-05-10 23:03:56 -04:00
water111 fa122356ec
[Decompiler] Fixes for dma-disasm (#377)
* small tweaks

* fix up some more dma stuff
2021-04-23 20:29:15 -04:00
water111 64c35ca453
[Decompiler] Stack Variables (#338)
* clean up type analysis

* get everything set up

* basic stack variables working

* partial load fix

* most of matrix

* add offline tests
2021-03-27 15:18:59 -04:00
water111 7fac11ddf5
Support 128-bit variables (#336)
* wip 128 bit support

* add a few more files to offline test
2021-03-25 16:02:48 -04:00
water111 99683c0dac
[decompiler] Add tests and fixes for vector-h and math (#333)
* before messing with ssa stuff

* fix ash

* bounding box
2021-03-24 19:16:31 -04:00
water111 9ffc6014e1
fix printing and add gstate (#330) 2021-03-22 20:04:00 -04:00
water111 e93d97dd07
[decompiler] gkernel offline test (#321)
* working on pointer math

* bug fixes

* gkernel passing with no anon functions

* update tests
2021-03-14 16:11:42 -04:00