Commit graph

35 commits

Author SHA1 Message Date
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
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 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
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 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 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 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 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
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 9ffc6014e1
fix printing and add gstate (#330) 2021-03-22 20:04:00 -04:00
water111 aa9bcd07f4
[Decompiler] Flag uses of vf registers for values outside of functions (#263)
* clean up warning system

* add bad dependency warning

* add q and acc
2021-02-15 11:55:10 -05:00
water111 2f722e6379
[Decompiler] Expression Building (#211)
* up to ash

* add more expressions

* fix some return variable usage nonsense

* bfloat print working

* basic-type working

* type working, fix decompiler on all files

* clang format
2021-01-24 16:39:15 -05:00
water111 4a97e15b40
[Decompiler] Remove most IR1 Analysis (#207)
* temp

* remove some of ir1
2021-01-22 22:03:58 -05:00
water111 2901f4a99e
[Decompiler] Write IR2 to file and implement some Atomic Op conversions (#187) 2021-01-09 20:01:48 -05:00
water111 5093b97cda
[Decompiler - New IR] Add AtomicOp (#181)
* wip decompiler ir

* add AtomicOp stuff

* fix windows build and warnings

* add instruction parser

* include

* make minilzo shared

* odr fix

* a

* fix merge conflicts

* move decompiler into namespace

* update the code coverage to include the decompiler

* add demo test

* add register use test to example test
2021-01-06 20:04:15 -05:00
water111 3331e9cd00
Replace spdlog (#185)
* remove spdlog

* clang format and fix windows

* add format shared

* windows sucks
2021-01-06 12:16:39 -05:00
water111 cae3871730
[Decompiler] Experimental Expression Stack (#157)
* begin framework for expressions

* more

* clean up warnings

* small fixes

* update

* wip type prop improvements

* see if nasm works

* fix format strings
2020-12-17 15:48:07 -05:00
water111 9b32835faa
Type Prop - Second Attempt (#142)
* setup and run on identity

* temp

* temp2

* temp

* update

* mroe

* successful in gcommon
2020-11-28 15:35:38 -05:00
water 4fb8381105 add reginfo to basic ops 2020-11-27 14:46:55 -05:00
water a9cfa19f92 add IR atomic interface and switch all basic ops to these 2020-11-26 22:16:59 -05:00
water111 a45d180f2c
Try to speed up the build (#106)
* first attempt

* attempt 2

* windows and formatting fix
2020-10-29 21:27:52 -04:00
water111 b56025412b
Recognize auto-generated inspect methods and create deftypes from them (#95)
- Recognize new type definitions/parents/type flags in the decompiler
- Analyze autogenerated inspect methods and dump guesses at fields to a file
- Utility functions for accessing static data by label
- Better ordering in the decompiler to go through functions in the order they appeared in the source
- Added a decent number of types to `all-types.gc` based on the new field analyzer
- Correct a few `int`/`integer` mistakes in `gcommon.gc` (this should really be a warning)
- Correct a few type issues in `gcommon` and `gkernel-h`
- Option in the decompiler to be strict about `define-extern` redefining a type of a symbol
- Add a test to check consistency in types between `all-types.gc` (used by decompiler) and `goal_src` (used by the compiler)
2020-10-24 22:51:40 -04:00
water111 b561cdfade
Make decompiler naming consistent (#94)
* use a fixed object file naming by default, option to allow new map file creation

* fix prints

* fixing up edge cases

* update json config
2020-10-24 14:27:50 -04:00
water111 fc1a8f37c6
Partially Implement Decompiler Type Analysis (#90)
* implement basic framework for decompiler type analysis

* before type system changes

* add some decompiler stuff to the type system

* try algorithm on a few functions
2020-10-18 15:44:19 -04:00
water111 a64dd6c90b
Add CFG to IR decompiler pass (#60)
* add some more cfg ir stuff

* add cond with else

* add type of recognition

* add cond to compare conversion

* finally all conds are passing

* started sc recognize, but ash min and max should be recognized first

* fix ash showing up as sc

* add abs

* fix merge issues

* try building goos with optimizations on

* sc mostly working, still need to fix right aligned nesting

* ands and ors are converting correctly now

* clean up
2020-10-06 18:14:27 -04:00
water111 376c273845
Add decompiler IR, basic operations, all-types file (#57)
* framework for basic op

* started IR framework

* check in type info file

* add some basic operations to the first pass ir conversion

* use a single condition system

* add more basic op decoding

* more ir
2020-09-29 20:24:15 -04:00
water c3aff47886 add decompiler 2020-08-22 23:30:17 -04:00