Decompilation: Next batch of files (#539)

* decomp: `collide-frag-h`

* decomp: `effect-control-h`

* decomp: `cam-update-h`

* decomp: `collide-func`

variable pass failed on ray-plane-intersect: invalid unordered_map<K, T> key

* decomp: `cylinder` with vector dot product issue

* decomp: `debug-sphere`

* decomp: `generic`

* decomp: fix `effect-control-h`

* scripts: improve decomp-next script

* decomp: Fix `debug-sphere` issues via type casting

* decomp: Add `collide-frag-h` to reference tests

* scripts: Add script to add a new reference test

* decomp: Add `cam-update-h` to reference tests

* goalc: Fix empty let removal issue

* decomp: Not adding cylinder to goal_src yet either

* decomp: Add `debug-sphere` to reference tests

* decomp: Attempt to finish `generic` but blocked by decomp issue

https://github.com/water111/jak-project/issues/563

* linting

* decomp: Resolve failing tests

* decomp: Address feedback
This commit is contained in:
Tyler Wilding
2021-06-06 23:01:30 -04:00
committed by GitHub
parent c19bcd37aa
commit 698d96cc4e
23 changed files with 865 additions and 188 deletions
@@ -826,3 +826,9 @@
(define-extern scf-get-territory (function int))
(declare-type font-context basic)
(define-extern print-game-text (function string font-context symbol int int float)) ; TODO decomp error, this seems correct though
; TODO - for cam-update-h
(define-extern *camera-look-through-other* int)
(define-extern *camera-other-trans* vector)
(define-extern *camera-other-root* vector)
@@ -0,0 +1,59 @@
;;-*-Lisp-*-
(in-package goal)
(rlet ((vf0 :class vf))
(init-vf0-vector)
;; definition for symbol *external-cam-options*, type int
(define *external-cam-options* 0)
;; definition for symbol *external-cam-mode*, type symbol
(define *external-cam-mode* #f)
;; failed to figure out what this is:
(when (or (not *camera-look-through-other*) (zero? *camera-look-through-other*))
(set! *camera-look-through-other* 0)
(let ((v1-4 0))
)
)
;; definition (perm) for symbol *camera-other-fov*, type bfloat
(define-perm *camera-other-fov* bfloat (new 'static 'bfloat :data 11650.845))
;; failed to figure out what this is:
(when (or (not *camera-other-trans*) (zero? *camera-other-trans*))
(let ((v1-15 (new 'global 'vector)))
(.svf (&-> v1-15 quad) vf0)
(set! *camera-other-trans* v1-15)
)
)
;; definition (perm) for symbol *camera-other-matrix*, type matrix
(define-perm *camera-other-matrix* matrix
(matrix-identity! (new 'global 'matrix))
)
;; definition (perm) for symbol *camera-smush-control*, type smush-control
(define-perm *camera-smush-control* smush-control
(set-zero! (new 'global 'smush-control))
)
;; failed to figure out what this is:
(when (or (not *camera-other-root*) (zero? *camera-other-root*))
(let ((v1-34 (new 'global 'vector)))
(.svf (&-> v1-34 quad) vf0)
(set! *camera-other-root* v1-34)
)
)
;; failed to figure out what this is:
(let ((v0-6 0))
)
;; failed to figure out what this is:
(none)
)
@@ -0,0 +1,112 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type collide-frag-vertex
(deftype collide-frag-vertex (vector)
()
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
;; definition for method 3 of type collide-frag-vertex
;; Used lq/sq
(defmethod inspect collide-frag-vertex ((obj collide-frag-vertex))
(format #t "[~8x] ~A~%" obj 'collide-frag-vertex)
(format #t "~Tdata[4] @ #x~X~%" (&-> obj x))
(format #t "~Tx: ~f~%" (-> obj x))
(format #t "~Ty: ~f~%" (-> obj y))
(format #t "~Tz: ~f~%" (-> obj z))
(format #t "~Tw: ~f~%" (-> obj w))
(format #t "~Tquad: ~D~%" (-> obj quad))
obj
)
;; definition of type collide-frag-mesh
(deftype collide-frag-mesh (basic)
((packed-data uint32 :offset-assert 4)
(pat-array uint32 :offset-assert 8)
(strip-data-len uint16 :offset-assert 12)
(poly-count uint16 :offset-assert 14)
(base-trans vector :inline :offset-assert 16)
(vertex-count uint8 :offset 28)
(vertex-data-qwc uint8 :offset 29)
(total-qwc uint8 :offset 30)
(unused uint8 :offset 31)
)
:method-count-assert 9
:size-assert #x20
:flag-assert #x900000020
)
;; definition for method 3 of type collide-frag-mesh
(defmethod inspect collide-frag-mesh ((obj collide-frag-mesh))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tpacked-data: #x~X~%" (-> obj packed-data))
(format #t "~Tpat-array: #x~X~%" (-> obj pat-array))
(format #t "~Tstrip-data-len: ~D~%" (-> obj strip-data-len))
(format #t "~Tpoly-count: ~D~%" (-> obj poly-count))
(format #t "~Tbase-trans: #<vector @ #x~X>~%" (-> obj base-trans))
(format #t "~Tvertex-count: ~D~%" (-> obj vertex-count))
(format #t "~Tvertex-data-qwc: ~D~%" (-> obj vertex-data-qwc))
(format #t "~Ttotal-qwc: ~D~%" (-> obj total-qwc))
(format #t "~Tunused: ~D~%" (-> obj unused))
obj
)
;; definition of type collide-fragment
(deftype collide-fragment (drawable)
((mesh collide-frag-mesh :offset 8)
)
:method-count-assert 18
:size-assert #x20
:flag-assert #x1200000020
)
;; definition for method 3 of type collide-fragment
(defmethod inspect collide-fragment ((obj collide-fragment))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tid: ~D~%" (-> obj id))
(format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
(format #t "~Tmesh: ~A~%" (-> obj mesh))
obj
)
;; definition of type drawable-inline-array-collide-fragment
(deftype drawable-inline-array-collide-fragment (drawable-inline-array)
((data collide-fragment 1 :inline :offset-assert 32)
(pad uint32 :offset-assert 64)
)
:method-count-assert 18
:size-assert #x44
:flag-assert #x1200000044
)
;; definition for method 3 of type drawable-inline-array-collide-fragment
(defmethod
inspect
drawable-inline-array-collide-fragment
((obj drawable-inline-array-collide-fragment))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tid: ~D~%" (-> obj id))
(format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
(format #t "~Tlength: ~D~%" (-> obj length))
(format #t "~Tdata[1] @ #x~X~%" (-> obj data))
obj
)
;; definition of type drawable-tree-collide-fragment
(deftype drawable-tree-collide-fragment (drawable-tree)
()
:method-count-assert 18
:size-assert #x24
:flag-assert #x1200000024
)
;; failed to figure out what this is:
(let ((v0-5 0))
)
@@ -0,0 +1,142 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type debug-sphere-table
(deftype debug-sphere-table (basic)
((point vector 300 :inline :offset-assert 16)
)
:method-count-assert 9
:size-assert #x12d0
:flag-assert #x9000012d0
)
;; definition for method 3 of type debug-sphere-table
(defmethod inspect debug-sphere-table ((obj debug-sphere-table))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Tpoint[300] @ #x~X~%" (-> obj point))
obj
)
;; definition for function make-debug-sphere-table
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defun make-debug-sphere-table ((arg0 debug-sphere-table))
(local-vars (sv-80 int))
(let ((s5-0 (new-stack-vector0))
(f30-0 1.0)
(s4-0 0)
)
(let ((v1-0 s5-0))
(set! (-> v1-0 x) 0.0)
(set! (-> v1-0 y) 0.0)
(set! (-> v1-0 z) 0.0)
(set! (-> v1-0 w) 1.0)
)
(dotimes (s3-0 10)
(let ((f28-0 (* f30-0 (sin (* 3276.8 (the float s3-0)))))
(f26-0 (* f30-0 (sin (* 3276.8 (the float (+ s3-0 1))))))
(s2-0 (new-stack-vector0))
(s1-0 (new-stack-vector0))
(s0-0 (new-stack-vector0))
)
(set!
(-> s2-0 y)
(+ (-> s5-0 y) (* (cos (* 3276.8 (the float s3-0))) f30-0))
)
(set! (-> s1-0 y) (-> s2-0 y))
(set!
(-> s0-0 y)
(+ (-> s5-0 y) (* (cos (* 3276.8 (the float (+ s3-0 1)))) f30-0))
)
(set! sv-80 0)
(while (< sv-80 10)
(set!
(-> s2-0 x)
(+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f28-0))
)
(set!
(-> s2-0 z)
(+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f28-0))
)
(set!
(-> s1-0 x)
(+ (-> s5-0 x) (* (cos (* 6553.6 (the float (+ sv-80 1)))) f28-0))
)
(set!
(-> s1-0 z)
(+ (-> s5-0 z) (* (sin (* 6553.6 (the float (+ sv-80 1)))) f28-0))
)
(set!
(-> s0-0 x)
(+ (-> s5-0 x) (* (cos (* 6553.6 (the float sv-80))) f26-0))
)
(set!
(-> s0-0 z)
(+ (-> s5-0 z) (* (sin (* 6553.6 (the float sv-80))) f26-0))
)
(set! (-> arg0 point s4-0 quad) (-> s2-0 quad))
(set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad))
(set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad))
(+! s4-0 3)
(set! sv-80 (+ sv-80 1))
)
)
)
)
(let ((v0-10 0))
)
(none)
)
;; definition for symbol *debug-sphere-table*, type debug-sphere-table
(define *debug-sphere-table* (new 'static 'debug-sphere-table))
;; failed to figure out what this is:
(make-debug-sphere-table *debug-sphere-table*)
;; definition for function add-debug-sphere-from-table
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defun
add-debug-sphere-from-table
((arg0 int) (arg1 vector) (arg2 vector) (arg3 rgba))
(rlet ((vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
)
(let ((s4-0 (new-stack-vector0))
(s3-0 (new-stack-vector0))
(s2-0 (new-stack-vector0))
(points (-> *debug-sphere-table* point))
)
(.lvf vf1 (&-> arg1 quad))
(.mov vf2 arg2)
(dotimes (s0-0 100)
(.lvf vf3 (&-> points 0 quad))
(.lvf vf4 (&-> points 1 quad))
(.lvf vf5 (&-> points 2 quad))
(set! points (the-as (inline-array vector) (-> points 3)))
(.mul.x.vf vf3 vf3 vf2)
(.mul.x.vf vf4 vf4 vf2)
(.mul.x.vf vf5 vf5 vf2)
(.add.vf vf3 vf3 vf1)
(.add.vf vf4 vf4 vf1)
(.add.vf vf5 vf5 vf1)
(.svf (&-> s4-0 quad) vf3)
(.svf (&-> s3-0 quad) vf4)
(.svf (&-> s2-0 quad) vf5)
(add-debug-line #t arg0 s4-0 s3-0 arg3 #f -1)
(add-debug-line #t arg0 s4-0 s2-0 arg3 #f -1)
)
)
(let ((v0-2 0))
)
(none)
)
)
@@ -693,8 +693,8 @@
:size-assert #x28
:flag-assert #xb00000028
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(TODO-RENAME-HUGE-9 (_type_ vector) none 9)
(TODO-RENAME-10 (_type_ vector vector) float 10)
)
)
@@ -719,8 +719,8 @@
:size-assert #x28
:flag-assert #xb00000028
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(TODO-RENAME-HUGE-9 (_type_ vector) none 9)
(TODO-RENAME-10 (_type_ vector vector) float 10)
)
)