mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
134 lines
2.6 KiB
Common Lisp
134 lines
2.6 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: memory-usage-h.gc
|
|
;; name in dgo: memory-usage-h
|
|
;; dgos: ENGINE, GAME
|
|
|
|
(defenum mem-usage-id
|
|
:bitfield #f
|
|
:type uint32
|
|
(tfragment 1)
|
|
(tfragment-base 2)
|
|
(tfragment-common 3)
|
|
(tfragment-level0 4)
|
|
(tfragment-level1 5)
|
|
(tfragment-color 6)
|
|
(tfragment-debug 7)
|
|
|
|
(tie-fragment 9)
|
|
(tie-gif 10)
|
|
(tie-points 11)
|
|
(tie-colors 12)
|
|
(tie-draw-points 13)
|
|
(tie-debug 14)
|
|
|
|
(tie-generic 17)
|
|
(instance-tie 18)
|
|
(instance-tie-colors0 19)
|
|
(instance-tie-colors1 20)
|
|
(instance-tie-colors2 21)
|
|
(instance-tie-colors3 22)
|
|
(inst-tie-colors* 23)
|
|
|
|
;; 25-33 is shrub stuff
|
|
|
|
;;
|
|
|
|
(entity 43)
|
|
(camera 44)
|
|
|
|
(res 48)
|
|
|
|
;; 50-57 is collision
|
|
|
|
(bsp-main 58)
|
|
(bsp-misc 59)
|
|
(bsp-node 60)
|
|
(bsp-leaf-vis-self 61)
|
|
(bsp-leaf-vis-adj 62)
|
|
|
|
(pat 64)
|
|
(level-code 65)
|
|
(entity-links 66)
|
|
|
|
(joint 67)
|
|
|
|
(joint-anim-compressed-control 69)
|
|
(joint-anim-fixed 70)
|
|
(joint-anim-frame 71)
|
|
(subtitle 72)
|
|
(art-group 73)
|
|
(art-mesh-anim 74)
|
|
(art-mesh-geo 75)
|
|
(art-joint-geo 76)
|
|
(art-joint-anim 77)
|
|
(merc-ctrl 78)
|
|
(joint-anim-drawable 79)
|
|
(blend-shape 80)
|
|
|
|
(texture 82)
|
|
|
|
(array 84)
|
|
|
|
(unsorted-proc 90)
|
|
(8k-dead-pool 91)
|
|
(16k-dead-pool 92)
|
|
(nk-dead-pool 93)
|
|
(target-dead-pool 94)
|
|
(camera-dead-pool 95)
|
|
(debug-dead-pool 96)
|
|
(process-active 97)
|
|
(heap-total 98)
|
|
(heap-process 99)
|
|
(heap-header 100)
|
|
(heap-thread 101)
|
|
(heap-root 102)
|
|
|
|
(heap-draw-control 103)
|
|
(heap-joint-control 104)
|
|
(heap-cspace 105)
|
|
(heap-bone 106)
|
|
(heap-part 107)
|
|
(heap-collide-prim 108)
|
|
(heap-misc 109)
|
|
|
|
|
|
(eye-anim 111)
|
|
)
|
|
|
|
(define-extern mem-size (function basic symbol int int))
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
;; this file is debug only
|
|
(declare-file (debug))
|
|
|
|
(deftype memory-usage-info (structure)
|
|
((name string)
|
|
(count int32)
|
|
(used int32)
|
|
(total int32)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype memory-usage-block (basic)
|
|
((work-bsp basic)
|
|
(length int32)
|
|
(data memory-usage-info 112 :inline)
|
|
)
|
|
(:methods
|
|
(reset! (_type_) _type_)
|
|
(calculate-total (_type_) int)
|
|
(print-mem-usage (_type_ level object) _type_)
|
|
)
|
|
)
|
|
|
|
|
|
(define *mem-usage* (new 'debug 'memory-usage-block))
|
|
|
|
(define *dma-mem-usage* (new 'debug 'memory-usage-block))
|
|
|
|
(define *temp-mem-usage* (the-as memory-usage-block #f))
|