mirror of
https://github.com/open-goal/jak-project
synced 2026-05-27 16:14:18 -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>
315 lines
8.5 KiB
Common Lisp
Vendored
Generated
315 lines
8.5 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for method 9 of type rigid-body-queue
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod rigid-body-queue-method-9 ((this rigid-body-queue))
|
|
(set! (-> this count) 0)
|
|
(dotimes (v1-0 128)
|
|
(set! (-> this array v1-0) (the-as handle #f))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 16 of type rigid-body-queue
|
|
(defmethod validate ((this rigid-body-queue))
|
|
(let ((gp-0 0))
|
|
(dotimes (v1-0 (-> this count))
|
|
(let ((a1-2 (-> this array v1-0))
|
|
(a2-0 (+ v1-0 1))
|
|
)
|
|
(while (< a2-0 (-> this count))
|
|
(if (= a1-2 (-> this array a2-0))
|
|
(+! gp-0 1)
|
|
)
|
|
(+! a2-0 1)
|
|
)
|
|
)
|
|
)
|
|
(if (> gp-0 0)
|
|
(format 0 "rigid-body-queue::validate: duplicate count ~d~%" gp-0)
|
|
)
|
|
(zero? gp-0)
|
|
)
|
|
)
|
|
|
|
;; definition for method 10 of type rigid-body-queue
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod rigid-body-queue-method-10 ((this rigid-body-queue))
|
|
(local-vars (s4-0 process))
|
|
(with-pp
|
|
(let ((f0-0 (seconds-per-frame))
|
|
(v1-1 (-> this count))
|
|
)
|
|
(b! #t cfg-9 :delay (nop!))
|
|
(label cfg-1)
|
|
(+! v1-1 -1)
|
|
(let ((a0-4 (handle->process (-> this array v1-1))))
|
|
(cond
|
|
(a0-4
|
|
(let ((a0-6 (-> (the-as rigid-body-object a0-4) rbody)))
|
|
(set! (-> a0-6 state time-remaining) f0-0)
|
|
(set! (-> a0-6 state blocked-by) #f)
|
|
(set! (-> a0-6 state step-count) 0)
|
|
(logclear! (-> a0-6 state flags) (rigid-body-flag blocker))
|
|
)
|
|
)
|
|
(else
|
|
)
|
|
)
|
|
)
|
|
(label cfg-9)
|
|
(b! (nonzero? v1-1) cfg-1 :delay (nop!))
|
|
)
|
|
(let ((s5-0 0))
|
|
(b! #t cfg-35 :delay (nop!))
|
|
(until (= (-> this array s5-0) (process->handle s4-0))
|
|
(label cfg-11)
|
|
(set! s4-0 (handle->process (-> this array s5-0)))
|
|
(b! (not s4-0) cfg-34 :delay (empty-form))
|
|
(let ((s3-0 (-> (the-as rigid-body-object s4-0) rbody)))
|
|
(b!
|
|
(not (and (logtest? (-> s3-0 state flags) (rigid-body-flag enable-physics))
|
|
(and (< 0.001 (-> s3-0 state time-remaining)) (< (-> s3-0 state step-count) 4))
|
|
)
|
|
)
|
|
cfg-34
|
|
:delay (empty-form)
|
|
)
|
|
(rigid-body-object-method-51 (the-as rigid-body-object s4-0))
|
|
(+! (-> s3-0 state step-count) 1)
|
|
(let ((a2-2 (-> s3-0 state blocked-by)))
|
|
(b! (not a2-2) cfg-34 :delay (empty-form))
|
|
(b! (not #t) cfg-34 :delay (empty-form))
|
|
(logior! (-> a2-2 rbody state flags) (rigid-body-flag blocker))
|
|
(rigid-body-queue-method-13 this s5-0 a2-2)
|
|
)
|
|
)
|
|
)
|
|
(label cfg-34)
|
|
(+! s5-0 1)
|
|
(label cfg-35)
|
|
(b! (< s5-0 (-> this count)) cfg-11)
|
|
)
|
|
(let ((s5-1 0))
|
|
(b! #t cfg-48 :delay (nop!))
|
|
(label cfg-37)
|
|
(let ((a0-20 (handle->process (-> this array s5-1))))
|
|
(when (and a0-20
|
|
(logtest? (-> (the-as rigid-body-object a0-20) rbody state flags) (rigid-body-flag enable-physics))
|
|
)
|
|
(let ((s4-1 pp))
|
|
(set! pp (the-as rigid-body-object a0-20))
|
|
(rigid-body-object-method-52 (the-as rigid-body-object a0-20))
|
|
(set! pp s4-1)
|
|
)
|
|
)
|
|
)
|
|
(+! s5-1 1)
|
|
(label cfg-48)
|
|
(b! (< s5-1 (-> this count)) cfg-37)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 11 of type rigid-body-queue
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod rigid-body-queue-method-11 ((this rigid-body-queue) (arg0 rigid-body-object))
|
|
(let ((v1-0 -1))
|
|
(let ((a2-0 0))
|
|
(b! #t cfg-9 :delay (nop!))
|
|
(label cfg-1)
|
|
(b! (handle->process (-> this array a2-0)) cfg-8 :delay (empty-form))
|
|
(set! v1-0 a2-0)
|
|
(b! #t cfg-11 :delay (nop!))
|
|
(label cfg-8)
|
|
(+! a2-0 1)
|
|
(label cfg-9)
|
|
(b! (< a2-0 (-> this count)) cfg-1)
|
|
)
|
|
(label cfg-11)
|
|
(b! (= v1-0 -1) cfg-18 :delay (nop!))
|
|
(set! (-> this array v1-0) (process->handle arg0))
|
|
)
|
|
(b! #t cfg-25 :delay (nop!))
|
|
(label cfg-18)
|
|
(b! (>= (-> this count) 128) cfg-25 :delay #f)
|
|
(set! (-> this array (-> this count)) (process->handle arg0))
|
|
(+! (-> this count) 1)
|
|
(label cfg-25)
|
|
0
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 12 of type rigid-body-queue
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod rigid-body-queue-method-12 ((this rigid-body-queue) (arg0 int) (arg1 int))
|
|
(when (< arg0 arg1)
|
|
(let ((v1-1 arg1)
|
|
(a3-0 (+ arg1 -1))
|
|
(a2-3 (-> this array arg1))
|
|
)
|
|
(while (>= a3-0 arg0)
|
|
(set! (-> this array v1-1) (-> this array a3-0))
|
|
(+! a3-0 -1)
|
|
(+! v1-1 -1)
|
|
)
|
|
(set! (-> this array arg0) a2-3)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 13 of type rigid-body-queue
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod rigid-body-queue-method-13 ((this rigid-body-queue) (arg0 int) (arg1 rigid-body-object))
|
|
(let ((v1-2 (process->handle arg1))
|
|
(a2-4 (+ arg0 1))
|
|
)
|
|
(b! #t cfg-9 :delay (nop!))
|
|
(label cfg-6)
|
|
(b! (!= (-> this array a2-4) v1-2) cfg-8 :delay (empty-form))
|
|
(rigid-body-queue-method-12 this arg0 a2-4)
|
|
(b! #t cfg-11 :delay (nop!))
|
|
(label cfg-8)
|
|
(+! a2-4 1)
|
|
(label cfg-9)
|
|
(b! (< a2-4 (-> this count)) cfg-6)
|
|
)
|
|
(label cfg-11)
|
|
0
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 14 of type rigid-body-queue
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod rigid-body-queue-method-14 ((this rigid-body-queue) (arg0 int))
|
|
(let ((v1-0 arg0)
|
|
(a1-1 (+ arg0 1))
|
|
)
|
|
(while (< a1-1 (-> this count))
|
|
(set! (-> this array v1-0) (-> this array a1-1))
|
|
(+! a1-1 1)
|
|
(+! v1-0 1)
|
|
)
|
|
)
|
|
(+! (-> this count) -1)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 15 of type rigid-body-queue
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod rigid-body-queue-method-15 ((this rigid-body-queue) (arg0 rigid-body-object))
|
|
(let ((v1-2 (process->handle arg0))
|
|
(a1-4 0)
|
|
)
|
|
(b! #t cfg-9 :delay (nop!))
|
|
(label cfg-6)
|
|
(b! (!= (-> this array a1-4) v1-2) cfg-8 :delay (empty-form))
|
|
(rigid-body-queue-method-14 this a1-4)
|
|
(b! #t cfg-11 :delay (nop!))
|
|
(label cfg-8)
|
|
(+! a1-4 1)
|
|
(label cfg-9)
|
|
(b! (< a1-4 (-> this count)) cfg-6)
|
|
)
|
|
(label cfg-11)
|
|
0
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition of type rigid-body-queue-manager
|
|
(deftype rigid-body-queue-manager (process)
|
|
((queue rigid-body-queue)
|
|
)
|
|
(:state-methods
|
|
idle
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type rigid-body-queue-manager
|
|
(defmethod inspect ((this rigid-body-queue-manager))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(let ((t9-0 (method-of-type process inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~2Tqueue: #<rigid-body-queue @ #x~X>~%" (-> this queue))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate idle (rigid-body-queue-manager)
|
|
:virtual #t
|
|
:exit (behavior ()
|
|
(set! (-> self queue count) 0)
|
|
0
|
|
)
|
|
:code sleep-code
|
|
:post (behavior ()
|
|
(local-vars (a0-3 int) (a0-5 int))
|
|
(let* ((v1-1 (-> *perf-stats* data 17))
|
|
(a0-0 (-> v1-1 ctrl))
|
|
)
|
|
(+! (-> v1-1 count) 1)
|
|
(b! (zero? a0-0) cfg-2 :delay (nop!))
|
|
(.mtc0 Perf 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mtpc pcr0 0)
|
|
(.mtpc pcr1 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mtc0 Perf a0-0)
|
|
)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(label cfg-2)
|
|
0
|
|
(rigid-body-queue-method-10 (-> self queue))
|
|
(let ((v1-6 (-> *perf-stats* data 17)))
|
|
(b! (zero? (-> v1-6 ctrl)) cfg-4 :delay (nop!))
|
|
(.mtc0 Perf 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mfpc a0-3 pcr0)
|
|
(+! (-> v1-6 accum0) a0-3)
|
|
(.mfpc a0-5 pcr1)
|
|
(+! (-> v1-6 accum1) a0-5)
|
|
)
|
|
(label cfg-4)
|
|
0
|
|
)
|
|
)
|
|
|
|
;; definition for function rigid-body-queue-manager-init-by-other
|
|
(defbehavior rigid-body-queue-manager-init-by-other rigid-body-queue-manager ((arg0 rigid-body-queue))
|
|
(stack-size-set! (-> self main-thread) 128)
|
|
(set! (-> self queue) arg0)
|
|
(rigid-body-queue-method-9 (-> self queue))
|
|
(go-virtual idle)
|
|
)
|
|
|
|
;; definition for function rigid-body-queue-manager-spawn
|
|
(defun rigid-body-queue-manager-spawn ((arg0 rigid-body-queue) (arg1 process-tree))
|
|
(let ((gp-0 (the-as process #f)))
|
|
(let ((v1-1 (process-spawn rigid-body-queue-manager arg0 :to arg1)))
|
|
(if v1-1
|
|
(set! gp-0 (-> v1-1 0))
|
|
)
|
|
)
|
|
gp-0
|
|
)
|
|
)
|