[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
@@ -39,5 +39,4 @@
)
;; failed to figure out what this is:
(let ((v0-2 0))
)
0
@@ -40,12 +40,9 @@
(f2-0 (* f24-0 f22-0))
(f3-0 (* f24-0 f4-0))
)
(let ((v1-7 0))
)
(let ((v1-8 0))
)
(let ((v1-9 0))
)
0
0
0
(let* ((v1-12 (logand (/ (the int (-> s5-0 w)) 4) 1))
(a1-2 (-> EulSafe (logand (/ (the int (-> s5-0 w)) 8) 3)))
(a0-21 (-> EulNext (+ a1-2 v1-12)))
@@ -227,12 +224,9 @@
;; definition for function matrix->eul
(defun matrix->eul ((arg0 euler-angles) (arg1 matrix) (arg2 int))
(let ((v1-0 0))
)
(let ((v1-1 0))
)
(let ((v1-2 0))
)
0
0
0
(let* ((v1-4 (logand (/ arg2 4) 1))
(s3-0 (-> EulSafe (logand (/ arg2 8) 3)))
(s2-0 (-> EulNext (+ s3-0 v1-4)))
@@ -222,5 +222,4 @@
;; ERROR: function was not converted to expressions. Cannot decompile.
;; failed to figure out what this is:
(let ((v0-7 0))
)
0
@@ -35,5 +35,4 @@
(define *unity-quaternion* (new 'static 'quaternion :w 1.0))
;; failed to figure out what this is:
(let ((v0-2 0))
)
0
@@ -814,8 +814,7 @@
(f0-0 1.0)
)
(when (< f1-0 0.0)
(let ((f0-1 (- f1-0)))
)
(- f1-0)
(set! f0-0 -1.0)
)
(let ((v1-2 (- 1.0 arg3)))
@@ -1117,8 +1116,7 @@
)
)
)
(let ((v0-5 0))
)
0
(none)
)
)
@@ -45,5 +45,4 @@
)
;; failed to figure out what this is:
(let ((v0-4 0))
)
0
@@ -112,5 +112,4 @@
)
;; failed to figure out what this is:
(let ((v0-8 0))
)
0
@@ -2,5 +2,4 @@
(in-package goal)
;; failed to figure out what this is:
(let ((v0-0 0))
)
0
@@ -176,8 +176,7 @@
;; definition for function sin
(defun sin ((arg0 float))
(let ((f2-0 (* 0.000095873795 (the float (sar (shl (the int arg0) 48) 48)))))
(let ((f0-1 f2-0))
)
f2-0
(let* ((f1-4 (* 0.999998 f2-0))
(f0-3 (* f2-0 f2-0))
(f2-1 (* f2-0 f0-3))
@@ -689,8 +688,7 @@
;; definition for function asin
(defun asin ((arg0 float))
(let ((gp-0 #f))
(let ((f0-0 0.0))
)
0.0
(when (< arg0 0.0)
(set! arg0 (- arg0))
(set! gp-0 #t)
@@ -903,36 +903,12 @@
;; definition for function vector+!
(defun vector+! ((arg0 vector) (arg1 vector) (arg2 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> arg1 quad))
(.lvf vf5 (&-> arg2 quad))
(.add.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> arg0 quad) vf6)
arg0
)
(vector+! arg0 arg1 arg2)
)
;; definition for function vector-!
(defun vector-! ((arg0 vector) (arg1 vector) (arg2 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(.lvf vf4 (&-> arg1 quad))
(.lvf vf5 (&-> arg2 quad))
(.mov.vf vf6 vf0 :mask #b1000)
(.sub.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> arg0 quad) vf6)
arg0
)
(vector-! arg0 arg1 arg2)
)
;; definition for function vector-zero!
@@ -458,26 +458,8 @@
;; definition for function vector-v!
(defun vector-v! ((arg0 vector))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((v1-0 arg0))
(let ((a1-0 arg0)
(f0-0 (-> *display* seconds-per-frame))
)
(.lvf vf1 (&-> a1-0 quad))
(let ((a1-1 f0-0))
(.mov vf2 a1-1)
)
)
(.add.x.vf vf1 vf0 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-0 quad) vf1)
)
arg0
)
(vector-float*! arg0 arg0 (-> *display* seconds-per-frame))
arg0
)
;; definition for function vector-v+!
@@ -507,26 +489,7 @@
;; definition for function vector-v*float!
(defun vector-v*float! ((delta-p vector) (velocity vector) (scale float))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((v0-0 delta-p))
(let ((v1-0 velocity)
(f0-1 (* scale (-> *display* seconds-per-frame)))
)
(.lvf vf1 (&-> v1-0 quad))
(let ((v1-1 f0-1))
(.mov vf2 v1-1)
)
)
(.add.x.vf vf1 vf0 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v0-0 quad) vf1)
v0-0
)
)
(vector-float*! delta-p velocity (* scale (-> *display* seconds-per-frame)))
)
;; definition for function vector-v*float++!
@@ -1143,8 +1106,7 @@
;; definition for function vector3s-copy!
(defun vector3s-copy! ((arg0 vector) (arg1 vector))
(let ((v1-0 "Copy a vector3s"))
)
"Copy a vector3s"
(set! (-> arg0 x) (-> arg1 x))
(set! (-> arg0 y) (-> arg1 y))
(set! (-> arg0 z) (-> arg1 z))
@@ -1153,8 +1115,7 @@
;; definition for function vector3s+!
(defun vector3s+! ((arg0 vector) (arg1 vector) (arg2 vector))
(let ((v1-0 "Add 2 vectors3."))
)
"Add 2 vectors3."
(set! (-> arg0 x) (+ (-> arg1 x) (-> arg2 x)))
(set! (-> arg0 y) (+ (-> arg1 y) (-> arg2 y)))
(set! (-> arg0 z) (+ (-> arg1 z) (-> arg2 z)))
@@ -1163,8 +1124,7 @@
;; definition for function vector3s*float!
(defun vector3s*float! ((arg0 vector) (arg1 vector) (arg2 float))
(let ((v1-0 "mult vectors3 by float"))
)
"mult vectors3 by float"
(set! (-> arg0 x) (* (-> arg1 x) arg2))
(set! (-> arg0 y) (* (-> arg1 y) arg2))
(set! (-> arg0 z) (* (-> arg1 z) arg2))
@@ -1173,8 +1133,7 @@
;; definition for function vector3s-!
(defun vector3s-! ((arg0 vector) (arg1 vector) (arg2 vector))
(let ((v1-0 "Subtract 2 vectors3: c = (a - b)."))
)
"Subtract 2 vectors3: c = (a - b)."
(set! (-> arg0 x) (- (-> arg1 x) (-> arg2 x)))
(set! (-> arg0 y) (- (-> arg1 y) (-> arg2 y)))
(set! (-> arg0 z) (- (-> arg1 z) (-> arg2 z)))