[decompiler] clean up vector detection and add vector float product detection (#638)

* change

* recognize vector float product and update tests
This commit is contained in:
water111
2021-06-27 17:24:35 -04:00
committed by GitHub
parent bfb1fbe1fc
commit a6d5c4eda3
146 changed files with 1085 additions and 1653 deletions
@@ -16,8 +16,7 @@
(set! *redline-index* (+ *redline-index* 1))
(when (>= *redline-index* 400)
(set! *redline-index* 0)
(let ((v0-1 0))
)
0
)
(none)
)
@@ -42,8 +41,7 @@
(set! *blueline-index* (+ *blueline-index* 1))
(when (>= *blueline-index* 400)
(set! *blueline-index* 0)
(let ((v0-1 0))
)
0
)
(none)
)
@@ -68,8 +66,7 @@
(set! *greenline-index* (+ *greenline-index* 1))
(when (>= *greenline-index* 400)
(set! *greenline-index* 0)
(let ((v0-1 0))
)
0
)
(none)
)
@@ -94,8 +91,7 @@
(set! *yellowline-index* (+ *yellowline-index* 1))
(when (>= *yellowline-index* 400)
(set! *yellowline-index* 0)
(let ((v0-1 0))
)
0
)
(none)
)
@@ -120,8 +116,7 @@
(set! *timeplot-index* (+ *timeplot-index* 1))
(when (>= *timeplot-index* 400)
(set! *timeplot-index* 0)
(let ((v0-1 0))
)
0
)
(none)
)
@@ -137,10 +132,6 @@
(define-perm *cam-layout* symbol #f)
;; failed to figure out what this is:
(let ((v0-6 0))
)
0
)
@@ -23,9 +23,4 @@
(define-perm *camera-orbit-target* process-drawable #f)
;; failed to figure out what this is:
(let ((v0-0 0))
)
0
@@ -3,28 +3,10 @@
;; definition for function position-in-front-of-camera!
(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((v1-0 arg0))
(let ((a0-2 (-> *math-camera* inv-camera-rot vector 2))
(f0-0 arg1)
)
(.lvf vf1 (&-> a0-2 quad))
(let ((a0-3 f0-0))
(.mov vf2 a0-3)
)
)
(.add.x.vf vf1 vf0 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-0 quad) vf1)
)
(vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2)
(vector+! arg0 arg0 (-> *math-camera* trans))
arg0
)
(vector-float*! arg0 (-> *math-camera* inv-camera-rot vector 2) arg1)
(vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2)
(vector+! arg0 arg0 (-> *math-camera* trans))
arg0
)
;; definition for function matrix-local->world
@@ -93,8 +75,7 @@
(send-event-function *camera* a1-2)
)
)
(let ((v0-4 0))
)
0
(none)
)
)
@@ -10,8 +10,7 @@
;; 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))
)
0
)
;; definition (perm) for symbol *camera-other-fov*, type bfloat
@@ -34,5 +33,4 @@
(define-perm *camera-other-root* vector (vector-reset! (new 'global 'vector)))
;; failed to figure out what this is:
(let ((v0-6 0))
)
0
@@ -247,8 +247,7 @@
(set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3)
(let ((v0-0 0))
)
0
(none)
)
@@ -264,18 +263,15 @@
(set! (-> obj accel) (-> arg0 accel))
(set! (-> obj max-vel) (-> arg0 max-vel))
(set! (-> obj max-partial) (-> arg0 max-partial))
(let ((v0-0 0))
)
0
(none)
)
;; definition for method 11 of type cam-float-seeker
;; INFO: Return type mismatch int vs none.
(defmethod TODO-RENAME-11 cam-float-seeker ((obj cam-float-seeker) (arg0 float))
(let ((f0-0 0.0))
)
(let ((f0-1 0.0))
)
0.0
0.0
(let* ((f1-2 (- (+ (-> obj target) arg0) (-> obj value)))
(f0-5 (* (-> obj max-partial) (fabs f1-2)))
)
@@ -293,8 +289,7 @@
(let ((f0-10 (* (-> obj vel) (-> *display* time-adjust-ratio))))
(set! (-> obj value) (+ (-> obj value) f0-10))
)
(let ((v0-0 0))
)
0
(none)
)
@@ -358,8 +353,7 @@
(set! (-> obj accel) arg1)
(set! (-> obj max-vel) arg2)
(set! (-> obj max-partial) arg3)
(let ((v0-0 0))
)
0
(none)
)
@@ -369,77 +363,37 @@
TODO-RENAME-10
cam-vector-seeker
((obj cam-vector-seeker) (arg0 vector))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(let ((f0-0 0.0))
(let ((gp-0 (new 'stack-no-clear 'vector)))
0.0
(cond
(arg0
(vector+! gp-0 (-> obj target) arg0)
(vector-! gp-0 gp-0 (-> obj value))
)
(cond
(arg0
(vector+! gp-0 (-> obj target) arg0)
(vector-! gp-0 gp-0 (-> obj value))
)
(else
(vector-! gp-0 (-> obj target) (-> obj value))
)
(else
(vector-! gp-0 (-> obj target) (-> obj value))
)
(let ((f30-1 (* (-> obj max-partial) (vector-length gp-0))))
(let ((v1-3 gp-0))
(let ((a0-5 gp-0)
(f0-3 (* (-> obj accel) (-> *display* time-adjust-ratio)))
)
(.lvf vf1 (&-> a0-5 quad))
(let ((a0-6 f0-3))
(.mov vf2 a0-6)
)
)
(.add.x.vf vf1 vf0 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-3 quad) vf1)
)
(vector+! (-> obj vel) (-> obj vel) gp-0)
(let ((f0-4 (vector-length (-> obj vel)))
(f1-2 (fmin f30-1 (-> obj max-vel)))
)
(when (< f1-2 f0-4)
(let ((v1-6 (-> obj vel)))
(let ((a0-9 (-> obj vel))
(f0-5 (/ f1-2 f0-4))
)
(.lvf vf1 (&-> a0-9 quad))
(let ((a0-10 f0-5))
(.mov vf2 a0-10)
)
(let ((f30-1 (* (-> obj max-partial) (vector-length gp-0))))
(vector-float*!
gp-0
gp-0
(* (-> obj accel) (-> *display* time-adjust-ratio))
)
(vector+! (-> obj vel) (-> obj vel) gp-0)
(let ((f0-4 (vector-length (-> obj vel)))
(f1-2 (fmin f30-1 (-> obj max-vel)))
)
)
(.add.x.vf vf1 vf0 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-6 quad) vf1)
)
)
(if (< f1-2 f0-4)
(vector-float*! (-> obj vel) (-> obj vel) (/ f1-2 f0-4))
)
)
(let ((v1-7 gp-0))
(let ((a0-11 (-> obj vel))
(f0-6 (-> *display* time-adjust-ratio))
)
(.lvf vf1 (&-> a0-11 quad))
(let ((a0-12 f0-6))
(.mov vf2 a0-12)
)
)
(.add.x.vf vf1 vf0 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-7 quad) vf1)
)
(vector+! (-> obj value) (-> obj value) gp-0)
)
(let ((v0-2 0))
)
(none)
(vector-float*! gp-0 (-> obj vel) (-> *display* time-adjust-ratio))
(vector+! (-> obj value) (-> obj value) gp-0)
)
0
(none)
)
;; definition of type cam-rotation-tracker
@@ -790,5 +744,4 @@
)
;; failed to figure out what this is:
(let ((v0-28 0))
)
0
@@ -192,5 +192,4 @@
)
;; failed to figure out what this is:
(let ((v0-6 0))
)
0
@@ -50,12 +50,7 @@
(y-rat (-> math-cam y-ratio))
(cull-info (-> math-cam cull-info))
)
(let
((unused-x-thing
(/ (+ 1.0 (* (* 4.0 x-rat) x-rat)) (+ 1.0 (* x-rat x-rat)))
)
)
)
(/ (+ 1.0 (* (* 4.0 x-rat) x-rat)) (+ 1.0 (* x-rat x-rat)))
(let ((y-thing (/ (+ 1.0 (* (* 4.0 y-rat) y-rat)) (+ 1.0 (* y-rat y-rat)))))
(set!
(-> cull-info x-fact)
@@ -149,8 +144,7 @@
(let ((fog-constant-1 100.0)
(fog-constant-2 16760631.0)
)
(let ((f0-21 16777115.0))
)
16777115.0
(let
((fog-at-near-plane
(/
@@ -275,12 +269,9 @@
)
)
)
(let ((v1-17 0))
)
(let ((v1-20 (make-u128 0 (shl #x301ec000 32))))
)
(let ((v1-23 (make-u128 0 (shl #x303ec000 32))))
)
0
(make-u128 0 (shl #x301ec000 32))
(make-u128 0 (shl #x303ec000 32))
(let ((pfog (-> math-cam pfog0)))
(let ((vis-gif-0 (-> math-cam vis-gifs)))
(set! (-> vis-gif-0 0 fog0) (the-as uint pfog))
@@ -478,8 +469,7 @@
(vf31 :class vf)
)
(init-vf0-vector)
(let ((v1-0 0))
)
0
(.lvf vf24 (&-> *math-camera* camera-temp vector 0 quad))
(.lvf vf25 (&-> *math-camera* camera-temp vector 1 quad))
(.lvf vf26 (&-> *math-camera* camera-temp vector 2 quad))
@@ -526,8 +516,7 @@
(vf31 :class vf)
)
(init-vf0-vector)
(let ((v1-0 0))
)
0
(.lvf vf24 (&-> *math-camera* camera-temp vector 0 quad))
(.lvf vf25 (&-> *math-camera* camera-temp vector 1 quad))
(.lvf vf26 (&-> *math-camera* camera-temp vector 2 quad))
@@ -574,8 +563,7 @@
(vf31 :class vf)
)
(init-vf0-vector)
(let ((v1-0 0))
)
0
(.lvf vf24 (&-> *math-camera* camera-temp vector 0 quad))
(.lvf vf25 (&-> *math-camera* camera-temp vector 1 quad))
(.lvf vf26 (&-> *math-camera* camera-temp vector 2 quad))
@@ -598,8 +586,7 @@
(.add.vf vf28 vf28 vf30)
(.max.x.vf vf28 vf28 vf0 :mask #b1000)
(.svf (&-> arg0 quad) vf28)
(let ((a0-2 (zero? (logand v1-7 63))))
)
(zero? (logand v1-7 63))
(.mov v0-0 vf23)
v0-0
)
@@ -47,5 +47,4 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
)
0