[decomp] transformq-h, clean up trig, and offline test for trig (#485)

* clean up

* fix store vf fallback errors
This commit is contained in:
water111
2021-05-15 10:38:14 -04:00
committed by GitHub
parent c95e501cec
commit 613efbd768
12 changed files with 1284 additions and 343 deletions
+21 -2
View File
@@ -233,12 +233,31 @@ FormElement* StoreOp::get_vf_store_as_form(FormPool& pool, const Env& env) const
auto addr = pool.alloc_single_element_form<DerefElement>(nullptr, source, true, tokens);
return pool.alloc_element<VectorFloatLoadStoreElement>(m_value.var().reg(), addr, false);
} else {
// try again with no deref.
rd_in.deref = {};
auto rd_no_deref = env.dts->ts.reverse_field_lookup(rd_in);
if (rd_no_deref.success) {
auto source = pool.alloc_single_element_form<SimpleExpressionElement>(
nullptr, SimpleAtom::make_var(ro.var).as_expr(), m_my_idx);
std::vector<DerefToken> tokens;
for (auto& x : rd_no_deref.tokens) {
tokens.push_back(to_token(x));
}
auto addr = pool.alloc_single_element_form<DerefElement>(nullptr, source,
rd_no_deref.addr_of, tokens);
// this cast isn't required (.svf will take anything), but it makes it clear that there's
// some sketchy type stuff going on.
addr = pool.alloc_single_element_form<CastElement>(
nullptr, TypeSpec("pointer", {TypeSpec("uint128")}), addr);
return pool.alloc_element<VectorFloatLoadStoreElement>(m_value.var().reg(), addr, false);
}
}
}
}
// nothing worked.
throw std::runtime_error("NYI get_vf_store_as_form fallback");
return pool.alloc_element<StoreElement>(this);
}
FormElement* StoreOp::get_as_form(FormPool& pool, const Env& env) const {
+11 -76
View File
@@ -1419,12 +1419,12 @@
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(y-angle (_type_) float 22)
(global-y-angle-to-point (_type_ vector) float 23)
(relative-y-angle-to-point (_type_ vector) float 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(dummy-27 () none 27)
(get-quaternion (_type_) quaternion 27)
)
)
@@ -1664,7 +1664,7 @@
(define-extern coserp (function float float float float))
(define-extern sinerp-clamp (function float float float float))
;;(define-extern exp-slead object) ;; unknown type
;; ;; unknown type
(define-extern coserp180-clamp (function float float float float))
;; unknown type
(define-extern exp (function float float))
@@ -1675,20 +1675,21 @@
(define-extern coserp180 (function float float float float))
(define-extern sign (function float float))
(define-extern sinerp (function float float float float))
;; unknown type
(define-extern ease-in-out (function int int float))
(define-extern asin (function float float))
;;(define-extern sincos-table object) ;; unknown type
;;(define-extern exp-strail object) ;; unknown type
(define-extern coserp-clamp (function float float float float))
(define-extern tan (function float float))
;; ;; unknown type
;;(define-extern binary-table object) ;; unknown type
(define-extern binary-table (array float))
(define-extern sincos-table (array float))
(define-extern exp-slead (pointer float))
(define-extern exp-strail (pointer float))
(define-extern sincos! (function (pointer float) float int))
(define-extern sincos-rad! (function (pointer float) float int))
@@ -9894,25 +9895,6 @@
:flag-assert #x38000000b8
(:methods
(new (symbol type process int) _type_)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(dummy-27 () none 27)
(dummy-28 () none 28)
(dummy-29 () none 29)
(dummy-30 () none 30)
@@ -9976,53 +9958,6 @@
:size-assert #x1bc
:flag-assert #x41000001bc
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(dummy-27 () none 27)
(dummy-28 () none 28)
(dummy-29 () none 29)
(dummy-30 () none 30)
(dummy-31 () none 31)
(dummy-32 () none 32)
(dummy-33 () none 33)
(dummy-34 () none 34)
(dummy-35 () none 35)
(dummy-36 () none 36)
(dummy-37 () none 37)
(dummy-38 () none 38)
(dummy-39 () none 39)
(dummy-40 () none 40)
(dummy-41 () none 41)
(dummy-42 () none 42)
(dummy-43 () none 43)
(dummy-44 () none 44)
(dummy-45 () none 45)
(dummy-46 () none 46)
(dummy-47 () none 47)
(dummy-48 () none 48)
(dummy-49 () none 49)
(dummy-50 () none 50)
(dummy-51 () none 51)
(dummy-52 () none 52)
(dummy-53 () none 53)
(dummy-54 () none 54)
(dummy-55 () none 55)
(dummy-56 () none 56)
(dummy-57 () none 57)
(dummy-58 () none 58)
@@ -22,6 +22,19 @@
["L41", "float", true]
],
"trigonometry" : [
["L98", "(pointer float)", true, 32],
["L99", "(pointer float)", true, 32],
["L104", "_auto_", true],
["L103", "_auto_", true],
["L102", "vector", true],
["L101", "vector", true],
["L100", "vector", true],
["L152", "float", true],
["L138", "float", true],
["L137", "float", true]
],
"vector-h": [
["L32", "vector", true],
["L31", "vector", true],
@@ -147,5 +147,10 @@
"update-mood-erase-color2": [[16, "mood-fog"]],
"make-light-kit": [[16, "matrix"]]
"make-light-kit": [[16, "matrix"]],
"(method 23 trsqv)": [[16, "vector"]],
"(method 24 trsqv)": [[16, "vector"]],
"vector-sincos!": [[16, "vector"]]
}
@@ -305,25 +305,6 @@
:flag-assert #x38000000b8
(:methods
(new (symbol type process int) _type_)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(dummy-27 () none 27)
(dummy-28 () none 28)
(dummy-29 () none 29)
(dummy-30 () none 30)
@@ -387,53 +368,6 @@
:size-assert #x1bc
:flag-assert #x41000001bc
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(dummy-27 () none 27)
(dummy-28 () none 28)
(dummy-29 () none 29)
(dummy-30 () none 30)
(dummy-31 () none 31)
(dummy-32 () none 32)
(dummy-33 () none 33)
(dummy-34 () none 34)
(dummy-35 () none 35)
(dummy-36 () none 36)
(dummy-37 () none 37)
(dummy-38 () none 38)
(dummy-39 () none 39)
(dummy-40 () none 40)
(dummy-41 () none 41)
(dummy-42 () none 42)
(dummy-43 () none 43)
(dummy-44 () none 44)
(dummy-45 () none 45)
(dummy-46 () none 46)
(dummy-47 () none 47)
(dummy-48 () none 48)
(dummy-49 () none 49)
(dummy-50 () none 50)
(dummy-51 () none 51)
(dummy-52 () none 52)
(dummy-53 () none 53)
(dummy-54 () none 54)
(dummy-55 () none 55)
(dummy-56 () none 56)
(dummy-57 () none 57)
(dummy-58 () none 58)
+1
View File
@@ -22,3 +22,4 @@
(define *unity-quaternion* (new 'static 'quaternion :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(define-extern matrix->quaternion (function quaternion matrix quaternion))
(define-extern vector-y-angle (function vector float))
+48 -20
View File
@@ -40,26 +40,54 @@
:size-assert #x8c
:flag-assert #x1c0000008c
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(dummy-27 () none 27)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(y-angle (_type_) float 22)
(global-y-angle-to-point (_type_ vector) float 23)
(relative-y-angle-to-point (_type_ vector) float 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(get-quaternion (_type_) quaternion 27)
)
)
(defmethod global-y-angle-to-point trsqv ((obj trsqv) (arg0 vector))
"Get the angle from the position of this trsqv to the point arg0."
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(vector-y-angle
(vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans))
)
)
)
;; todo trsqv methods 23 and 24
(defmethod relative-y-angle-to-point trsqv ((obj trsqv) (arg0 vector))
"Get the y angle between here and arg0, starting at whatever angle we're currently at."
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(deg-diff
(y-angle obj)
(vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans)))
)
)
)
+158 -176
View File
@@ -36,15 +36,14 @@
(defun radmod ((arg0 float))
"Wrap arg0 to be within (-pi, pi)."
(local-vars (f0-1 float))
(set! f0-1 (+ PI arg0))
(if (< 0.0 f0-1)
(+ MINUS_PI (- f0-1 (* (the float (the int (/ f0-1 TWO_PI))) TWO_PI)))
(+ PI (- f0-1 (* (the float (the int (/ f0-1 TWO_PI))) TWO_PI)))
)
(let ((f0-1 (+ PI arg0)))
(if (< 0.0 f0-1)
(+ MINUS_PI (- f0-1 (* (the float (the int (/ f0-1 6.283185))) 6.283185)))
(+ PI (- f0-1 (* (the float (the int (/ f0-1 6.283185))) 6.283185)))
)
)
)
(defun deg- ((arg0 float) (arg1 float))
"Compute arg0-arg1, unwrapped, using rotation units.
Result should be in the range (-180, 180)"
@@ -64,52 +63,45 @@
(defun deg-seek ((in float) (target float) (max-diff float))
"Move in toward target by at most max-diff, using rotation units"
(local-vars
(in-int int)
(target-int int)
(max-diff-int int)
(diff int)
(abs-diff int)
)
(set! in-int (shl (the int in) 48))
(set! target-int (shl (the int target) 48))
(set! max-diff-int (shl (the int max-diff) 48))
(set! diff (- target-int in-int))
(set! abs-diff (abs diff))
(the float
(sar (cond
((< abs-diff 0) ;; ??
(+ in-int max-diff-int)
)
((>= max-diff-int abs-diff)
target-int
)
((>= diff 0)
(+ in-int max-diff-int)
)
(else
(- in-int max-diff-int)
)
)
48
(let ((in-int (shl (the int in) 48))
(target-int (shl (the int target) 48))
)
(let* ((max-diff-int (shl (the int max-diff) 48))
(diff (- target-int in-int))
(abs-diff (abs diff))
)
(set! target-int (cond
((< abs-diff 0)
(+ in-int max-diff-int)
)
((>= max-diff-int abs-diff)
target-int
)
((>= diff 0)
(+ in-int max-diff-int)
)
(else
(- in-int max-diff-int)
)
)
)
)
)
(the float (sar target-int 48))
)
)
(defun deg-seek-smooth ((in float) (target float) (max-diff float) (amount float))
"Step amount of the way from in to target, by at most max-diff, using rotation units"
(local-vars (step float))
;; how much we want to go
(set! step (* (deg- target in) amount))
;; can we make it in one go?
(if (< max-diff (fabs step))
;; nope, saturate.
(if (>= step 0.00000000)
(set! step max-diff)
(set! step (- max-diff))
)
)
(+ in step)
(let ((step (* (deg- target in) amount)))
(if (< max-diff (fabs step))
(set! step (if (>= step 0.0)
max-diff
(- max-diff)
)
)
)
(+ in step)
)
)
(defun deg-lerp-clamp ((min-val float) (max-val float) (in float))
@@ -220,31 +212,23 @@
(defun sin ((arg0 float))
"Compute the sine of an angle in rotation units. Unwraps it."
(local-vars
(f0-1 float)
(f0-3 float)
(f0-4 float)
(f1-4 float)
(f1-5 float)
(f1-6 float)
(f1-7 float)
(f2-0 float)
(f2-1 float)
(f2-2 float)
(f2-3 float)
)
(set! f2-0 (* ROT_TO_RAD (the float (sar (shl (the int arg0) 48) 48))))
(set! f0-1 f2-0)
(set! f1-4 (* (the-as float #x3f7fffde) f2-0))
(set! f0-3 (* f2-0 f2-0))
(set! f2-1 (* f2-0 f0-3))
(set! f1-5 (+ f1-4 (* (the-as float #xbe2aa8f5) f2-1)))
(set! f2-2 (* f2-1 f0-3))
(set! f1-6 (+ f1-5 (* (the-as float #x3c086bf6) f2-2)))
(set! f2-3 (* f2-2 f0-3))
(set! f1-7 (+ f1-6 (* (the-as float #xb94d2072) f2-3)))
(set! f0-4 (* f2-3 f0-3))
(+ f1-7 (* (the-as float #x361aa27f) f0-4))
;; convert
(let ((f2-0 (* 0.000095873795 (the float (sar (shl (the int arg0) 48) 48)))))
(let ((f0-1 f2-0))
)
(let* ((f1-4 (* 0.999998 f2-0))
(f0-3 (* f2-0 f2-0))
(f2-1 (* f2-0 f0-3))
(f1-5 (+ f1-4 (* -0.16666014 f2-1)))
(f2-2 (* f2-1 f0-3))
(f1-6 (+ f1-5 (* 0.008326521 f2-2)))
(f2-3 (* f2-2 f0-3))
(f1-7 (+ f1-6 (* -0.0001956241 f2-3)))
(f0-4 (* f2-3 f0-3))
)
(+ f1-7 (* 0.0000023042373 f0-4))
)
)
)
(defun sin-rad ((arg0 float))
@@ -610,7 +594,7 @@
(set! f17 (the-as float #xBEFF0000))
)
)
;; sll r0, r0, 0
;; mul.s f5, f3, f2
(set! f5 (* f3 f2))
@@ -938,7 +922,7 @@
(defun atan-rad ((arg0 float))
"inverse tangent in radians"
(atan-series-rad (/ (+ -1.000000 arg0) (+ 1.000000 arg0)))
(atan-series-rad (/ (+ -1.0 arg0) (+ 1.0 arg0)))
)
(defun sign ((arg0 float))
@@ -950,42 +934,44 @@
-1.000000)
(else
0.000000)
)
)
)
(defun atan2-rad ((arg0 float) (arg1 float))
(local-vars
(f0-6 float)
(f0-14 float)
(f0-22 float)
(f0-28 float)
(f30-1 float)
(f30-2 float)
)
(if (= arg1 0.000000)
(* PI_OVER_2 (sign arg0))
(cond
((and (< arg0 0.000000) (< arg1 0.000000))
;; this was probably an inline call to atan-rad
(set! f30-1 MINUS_PI)
(set! f0-6 (/ arg0 arg1))
(+ f30-1 (atan-series-rad (/ (+ -1.000000 f0-6) (+ 1.000000 f0-6))))
)
((< arg0 0.000000)
(set! f0-14 (- (/ arg0 arg1)))
(- (atan-series-rad (/ (+ -1.000000 f0-14) (+ 1.000000 f0-14))))
)
((< arg1 0.000000)
(set! f30-2 PI)
(set! f0-22 (- (/ arg0 arg1)))
(- f30-2 (atan-series-rad (/ (+ -1.000000 f0-22) (+ 1.000000 f0-22))))
)
(else
(set! f0-28 (/ arg0 arg1))
(atan-series-rad (/ (+ -1.000000 f0-28) (+ 1.000000 f0-28)))
)
(cond
((= arg1 0.0)
(* 1.5707963 (sign arg0))
)
(else
(cond
((and (< arg0 0.0) (< arg1 0.0))
(let ((f30-1 MINUS_PI)
(f0-6 (/ arg0 arg1))
)
(+ f30-1 (atan-series-rad (/ (+ -1.0 f0-6) (+ 1.0 f0-6))))
)
)
)
((< arg0 0.0)
(let ((f0-14 (- (/ arg0 arg1))))
(- (atan-series-rad (/ (+ -1.0 f0-14) (+ 1.0 f0-14))))
)
)
((< arg1 0.0)
(let ((f30-2 PI)
(f0-22 (- (/ arg0 arg1)))
)
(- f30-2 (atan-series-rad (/ (+ -1.0 f0-22) (+ 1.0 f0-22))))
)
)
(else
(let ((f0-28 (/ arg0 arg1)))
(atan-series-rad (/ (+ -1.0 f0-28) (+ 1.0 f0-28)))
)
)
)
)
)
)
;; ????
@@ -1220,49 +1206,52 @@
(and (= arg1 0.0) (= arg0 0.0))
0.000000
(cond
((and (< arg1 0.0) (< arg0 0.0))
(+ -32768.0 (atan0 (- arg0) (- arg1)))
((and (< arg1 0.0) (< arg0 0.0))
(+ -32768.0 (atan0 (- arg0) (- arg1)))
)
((< arg0 0.)
(- (atan0 (- arg0) arg1))
)
((< arg1 0.)
(- 32768.0 (atan0 arg0 (- arg1)))
)
(else
(atan0 arg0 arg1)
)
)
((< arg0 0.)
(- (atan0 (- arg0) arg1))
)
((< arg1 0.)
(- 32768.0 (atan0 arg0 (- arg1)))
)
(else
(atan0 arg0 arg1)
)
)
)
)
(defun asin ((arg0 float))
"Inverse sine. Returns rotation units"
(local-vars
(v1-1 symbol)
(v1-2 float)
(v1-4 float)
(gp-0 symbol)
(f0-0 float)
(f0-5 float)
(f0-6 float)
(f0-8 float)
(f1-2 float)
)
(set! gp-0 '#f)
(set! f0-0 0.000000)
(when (< arg0 0.000000) (set! arg0 (- arg0)) (set! gp-0 '#t) (set! v1-1 gp-0))
(cond
((< 1.000000 arg0) (set! f0-5 (the-as float #x467ffffc)) (set! v1-2 f0-5))
(else
(set! f0-6 1.000000)
(set! f1-2 arg0)
(set! f0-8 (sqrtf (- f0-6 (* f1-2 f1-2))))
(set! f0-5 (atan0 arg0 f0-8))
(set! v1-4 f0-5)
(let ((gp-0 #f))
(let ((f0-0 0.0))
)
(when (< arg0 0.0)
(set! arg0 (- arg0))
(set! gp-0 #t)
)
(let ((f0-5 (cond
((< 1.0 arg0)
16383.996
)
(else
(let* ((f0-6 1.0)
(f1-2 arg0)
(f0-8 (sqrtf (- f0-6 (* f1-2 f1-2))))
)
(atan0 arg0 f0-8)
)
)
)
)
)
(if gp-0
(- f0-5)
f0-5
)
)
)
)
(if gp-0 (- f0-5) f0-5)
)
(defun acos ((arg0 float))
@@ -1272,33 +1261,26 @@
(defun acos-rad ((arg0 float))
"Inverse cosine, returning radians."
(local-vars
(a1-0 none)
(f0-1 float)
(f0-3 float)
(f0-5 float)
(f0-6 float)
(f0-8 float)
(f0-10 float)
(f1-1 float)
(f1-6 float)
)
(cond
((>= arg0 0.000000)
(set! f0-1 1.000000)
(set! f1-1 arg0)
(set! f0-3 (sqrtf (- f0-1 (* f1-1 f1-1))))
(set! f0-5 (/ (- f0-3 arg0) (+ f0-3 arg0)))
(atan-series-rad f0-5)
((>= arg0 0.0)
(let* ((f0-1 1.0)
(f1-1 arg0)
(f0-3 (sqrtf (- f0-1 (* f1-1 f1-1))))
(f0-5 (/ (- f0-3 arg0) (+ f0-3 arg0)))
)
(atan-series-rad f0-5)
)
)
(else
(let* ((f0-6 1.0)
(f1-6 arg0)
(f0-8 (sqrtf (- f0-6 (* f1-6 f1-6))))
(f0-10 (/ (+ f0-8 arg0) (- f0-8 arg0)))
)
(- PI (atan-series-rad f0-10))
)
)
)
(else
(set! f0-6 1.000000)
(set! f1-6 arg0)
(set! f0-8 (sqrtf (- f0-6 (* f1-6 f1-6))))
(set! f0-10 (/ (+ f0-8 arg0) (- f0-8 arg0)))
(- (the-as float #x40490fda) (atan-series-rad f0-10))
)
)
)
(defun sinerp ((minimum float) (maximum float) (amount float))
@@ -1309,10 +1291,10 @@
(defun sinerp-clamp ((minimum float) (maximum float) (amount float))
"Like sinerp, but clamp to min,max"
(cond
((>= 0.000000 amount) minimum)
((>= amount 1.000000) maximum)
(else (sinerp minimum maximum amount))
)
((>= 0.000000 amount) minimum)
((>= amount 1.000000) maximum)
(else (sinerp minimum maximum amount))
)
)
(defun coserp ((minimum float) (maximum float) (amount float))
@@ -1323,10 +1305,10 @@
(defun coserp-clamp ((minimum float) (maximum float) (amount float))
"Weird 90 degree lerp with cosine, clamped to min,max"
(cond
((>= 0.000000 amount) minimum)
((>= amount 1.000000) maximum)
(else (coserp minimum maximum amount))
)
((>= 0.000000 amount) minimum)
((>= amount 1.000000) maximum)
(else (coserp minimum maximum amount))
)
)
(defun coserp180 ((minimum float) (maximum float) (amount float))
@@ -581,3 +581,7 @@
; but the decompiler won't output it, so we have to manually define it
(define-extern wind-work type)
(define-extern *wind-work* wind-work)
(define-extern vector-y-angle (function vector float))
(define-extern atan0 (function float float float))
(define-extern vector-rad<-vector-deg! (function vector vector none))
(define-extern vector-rad<-vector-deg/2! (function vector vector int))
@@ -0,0 +1,155 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type transformq
(deftype transformq (transform)
((quat quaternion :inline :offset 16)
)
:method-count-assert 9
:size-assert #x30
:flag-assert #x900000030
)
;; definition for method 3 of type transformq
(defmethod inspect transformq ((obj transformq))
(format #t "[~8x] ~A~%" obj 'transformq)
(format #t "~Ttrans: ~`vector`P~%" (-> obj trans))
(format #t "~Trot: ~`vector`P~%" (-> obj rot))
(format #t "~Tscale: ~`vector`P~%" (-> obj scale))
(format #t "~Tquat: #<quaternion @ #x~X>~%" (-> obj rot))
obj
)
;; definition of type trsq
(deftype trsq (trs)
((quat quaternion :inline :offset 32)
)
:method-count-assert 9
:size-assert #x40
:flag-assert #x900000040
)
;; definition for method 3 of type trsq
(defmethod inspect trsq ((obj trsq))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Ttrans: ~`vector`P~%" (-> obj trans))
(format #t "~Trot: ~`vector`P~%" (-> obj rot))
(format #t "~Tscale: ~`vector`P~%" (-> obj scale))
(format #t "~Tquat: #<quaternion @ #x~X>~%" (-> obj rot))
obj
)
;; definition of type trsqv
(deftype trsqv (trsq)
((pause-adjust-distance float :offset 4)
(nav-radius float :offset 8)
(transv vector :inline :offset-assert 64)
(rotv vector :inline :offset-assert 80)
(scalev vector :inline :offset-assert 96)
(dir-targ quaternion :inline :offset-assert 112)
(angle-change-time uint64 :offset-assert 128)
(old-y-angle-diff float :offset-assert 136)
)
:method-count-assert 28
:size-assert #x8c
:flag-assert #x1c0000008c
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(y-angle (_type_) float 22)
(global-y-angle-to-point (_type_ vector) float 23)
(relative-y-angle-to-point (_type_ vector) float 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(get-quaternion (_type_) quaternion 27)
)
)
;; definition for method 3 of type trsqv
(defmethod inspect trsqv ((obj trsqv))
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~Ttrans: ~`vector`P~%" (-> obj trans))
(format #t "~Trot: ~`vector`P~%" (-> obj rot))
(format #t "~Tscale: ~`vector`P~%" (-> obj scale))
(format #t "~Tquat: #<quaternion @ #x~X>~%" (-> obj rot))
(format
#t
"~Tpause-adjust-distance: (meters ~m)~%"
(-> obj pause-adjust-distance)
)
(format #t "~Tnav-radius: (meters ~m)~%" (-> obj nav-radius))
(format #t "~Ttransv: ~`vector`P~%" (-> obj transv))
(format #t "~Trotv: ~`vector`P~%" (-> obj rotv))
(format #t "~Tscalev: ~`vector`P~%" (-> obj scalev))
(format #t "~Tdir-targ: #<quaternion @ #x~X>~%" (-> obj dir-targ))
(format #t "~Tangle-change-time: ~D~%" (-> obj angle-change-time))
(format #t "~Told-y-angle-diff: ~f~%" (-> obj old-y-angle-diff))
obj
)
;; definition for method 23 of type trsqv
(defmethod global-y-angle-to-point trsqv ((obj trsqv) (arg0 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(let ((t9-0 vector-y-angle)
(v1-0 (new 'stack-no-clear 'vector))
)
(let ((a0-1 (-> obj trans)))
(.lvf vf4 (&-> arg0 quad))
(.lvf vf5 (&-> a0-1 quad))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.sub.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> v1-0 quad) vf6)
(t9-0 v1-0)
)
)
)
;; definition for method 24 of type trsqv
(defmethod relative-y-angle-to-point trsqv ((obj trsqv) (arg0 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(let ((gp-0 deg-diff)
(s3-0 (y-angle obj))
(t9-1 vector-y-angle)
(a0-2 (new 'stack-no-clear 'vector))
)
(let ((v1-1 (-> obj trans)))
(.lvf vf4 (&-> arg0 quad))
(.lvf vf5 (&-> v1-1 quad))
)
(.mov.vf vf6 vf0 :mask #b1000)
(.sub.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> a0-2 quad) vf6)
(gp-0 s3-0 (t9-1 a0-2))
)
)
)
;; failed to figure out what this is:
(let ((v0-3 0))
)
@@ -0,0 +1,856 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function radmod
(defun radmod ((arg0 float))
(let ((f0-1 (+ PI arg0)))
(if (< 0.0 f0-1)
(+ MINUS_PI (- f0-1 (* (the float (the int (/ f0-1 6.283185))) 6.283185)))
(+ PI (- f0-1 (* (the float (the int (/ f0-1 6.283185))) 6.283185)))
)
)
)
;; definition for function deg-
(defun deg- ((arg0 float) (arg1 float))
(the float (sar (- (shl (the int arg0) 48) (shl (the int arg1) 48)) 48))
)
;; definition for function deg-diff
(defun deg-diff ((arg0 float) (arg1 float))
(the float (sar (- (shl (the int arg1) 48) (shl (the int arg0) 48)) 48))
)
;; definition for function deg-seek
(defun deg-seek ((in float) (target float) (max-diff float))
(let ((in-int (shl (the int in) 48))
(target-int (shl (the int target) 48))
)
(let* ((max-diff-int (shl (the int max-diff) 48))
(diff (- target-int in-int))
(abs-diff (abs diff))
)
(set! target-int (cond
((< abs-diff 0)
(+ in-int max-diff-int)
)
((>= max-diff-int abs-diff)
(empty)
target-int
)
((>= diff 0)
(+ in-int max-diff-int)
)
(else
(- in-int max-diff-int)
)
)
)
)
(the float (sar target-int 48))
)
)
;; definition for function deg-seek-smooth
(defun
deg-seek-smooth
((in float) (target float) (max-diff float) (amount float))
(let ((step (* (deg- target in) amount)))
(if (< max-diff (fabs step))
(set! step (if (>= step 0.0)
max-diff
(- max-diff)
)
)
)
(+ in step)
)
)
;; definition for function deg-lerp-clamp
(defun deg-lerp-clamp ((min-val float) (max-val float) (in float))
(cond
((>= 0.0 in)
min-val
)
((>= in 1.0)
max-val
)
(else
(the
float
(sar (shl (the int (+ min-val (* in (deg-diff min-val max-val)))) 48) 48)
)
)
)
)
;; definition for symbol binary-table, type (array float)
(define
binary-table
(the-as (array float)
(new
'static
'boxed-array
float
32
1.0
0.5
0.25
0.125
0.0625
0.03125
0.015625
0.0078125
0.00390625
0.001953125
0.0009765625
0.00048828125
0.00024414062
0.00012207031
0.000061035156
0.000030517578
0.000015258789
0.0000076293945
0.0000038146973
0.0000019073486
0.0000009536743
0.00000047683716
0.00000023841858
0.00000011920929
0.000000059604645
0.000000029802322
0.000000014901161
0.000000007450581
0.0000000037252903
0.0000000018626451
0.0000000009313226
0.0000000004656613
)
)
)
;; definition for symbol sincos-table, type (array float)
(define
sincos-table
(the-as (array float)
(new
'static
'boxed-array
float
32
0.7853982
0.4636476
0.24497867
0.124354996
0.06241881
0.031239834
0.015623729
0.007812341
0.0039062302
0.0019531226
0.0009765622
0.0004882812
0.00024414062
0.00012207031
0.000061035156
0.000030517578
0.000015258789
0.0000076293945
0.0000038146973
0.0000019073486
0.0000009536743
0.00000047683716
0.00000023841858
0.00000011920929
0.000000059604645
0.000000029802322
0.000000014901161
0.000000007450581
0.0000000037252903
0.0000000018626451
0.0000000009313226
0.0000000004656613
)
)
)
;; 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))
)
(let* ((f1-4 (* 0.999998 f2-0))
(f0-3 (* f2-0 f2-0))
(f2-1 (* f2-0 f0-3))
(f1-5 (+ f1-4 (* -0.16666014 f2-1)))
(f2-2 (* f2-1 f0-3))
(f1-6 (+ f1-5 (* 0.008326521 f2-2)))
(f2-3 (* f2-2 f0-3))
(f1-7 (+ f1-6 (* -0.0001956241 f2-3)))
(f0-4 (* f2-3 f0-3))
)
(+ f1-7 (* 0.0000023042373 f0-4))
)
)
)
;; definition for function sin-rad
;; WARN: Unsupported inline assembly instruction kind - [mula.s f0, f7]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f2, f8]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f4, f9]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f5, f10]
;; WARN: Unsupported inline assembly instruction kind - [madd.s f12, f6, f11]
(defun sin-rad ((arg0 float))
(local-vars (f12-0 float))
(let* ((f1-0 (* arg0 arg0))
(f7-0 0.999998)
(f8-0 -0.16666014)
(f2-0 (* arg0 f1-0))
(f3-0 (* f1-0 f1-0))
(f9-0 0.008326521)
(f4-0 (* f2-0 f1-0))
(f5-0 (* f3-0 f2-0))
(f10-0 -0.0001956241)
(f6-0 (* f4-0 f3-0))
(f11-0 0.0000023042373)
)
(.mula.s arg0 f7-0)
(.madda.s f2-0 f8-0)
(.madda.s f4-0 f9-0)
(.madda.s f5-0 f10-0)
(.madd.s f12-0 f6-0 f11-0)
)
f12-0
)
;; definition for symbol *sin-poly-vec*, type vector
(define
*sin-poly-vec*
(new 'static 'vector
:x -0.16666014
:y 0.008326521
:z -0.0001956241
:w 0.0000023042373
)
)
;; definition for symbol *sin-poly-vec2*, type vector
(define *sin-poly-vec2* (new 'static 'vector :x 0.999998))
;; definition for function vector-sin-rad!
(defun vector-sin-rad! ((arg0 vector) (arg1 vector))
(rlet ((acc :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(.lvf vf1 (&-> arg1 quad))
(.mul.vf vf3 vf1 vf1)
(let ((v1-0 *sin-poly-vec2*))
(.lvf vf10 (&-> v1-0 quad))
)
(let ((v1-1 *sin-poly-vec*))
(.lvf vf9 (&-> v1-1 quad))
)
(.mul.vf vf4 vf3 vf1)
(.mul.vf vf5 vf3 vf3)
(.mul.x.vf acc vf1 vf10)
(.mul.vf vf6 vf4 vf3)
(.mul.vf vf7 vf5 vf4)
(.add.mul.x.vf acc vf4 vf9 acc)
(.mul.vf vf8 vf6 vf5)
(.add.mul.y.vf acc vf6 vf9 acc)
(.add.mul.z.vf acc vf7 vf9 acc)
(.add.mul.w.vf vf2 vf8 vf9 acc)
(.svf (&-> arg0 quad) vf2)
arg0
)
)
;; definition for function cos-rad
;; WARN: Unsupported inline assembly instruction kind - [mula.s f7, f7]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f8, f1]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f9, f3]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f10, f4]
;; WARN: Unsupported inline assembly instruction kind - [madd.s f12, f11, f5]
(defun cos-rad ((arg0 float))
(local-vars (f12-0 float))
(let* ((f1-0 (* arg0 arg0))
(f7-0 1.0)
(f8-0 -0.49998003)
(f3-0 (* f1-0 f1-0))
(f9-0 0.041620404)
(f10-0 -0.0013636408)
(f4-0 (* f3-0 f1-0))
(f5-0 (* f3-0 f3-0))
(f11-0 0.000020170546)
)
(.mula.s f7-0 f7-0)
(.madda.s f8-0 f1-0)
(.madda.s f9-0 f3-0)
(.madda.s f10-0 f4-0)
(.madd.s f12-0 f11-0 f5-0)
)
f12-0
)
;; definition for symbol *cos-poly-vec*, type vector
(define
*cos-poly-vec*
(new 'static 'vector
:x -0.49998003
:y 0.041620404
:z -0.0013636408
:w 0.000020170546
)
)
;; definition for function vector-cos-rad!
;; WARN: Bad vector register dependency: vf2
(defun vector-cos-rad! ((arg0 vector) (arg1 vector))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf9 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(.lvf vf1 (&-> arg1 quad))
(.sub.vf vf2 vf2 vf2)
(let ((v1-0 *cos-poly-vec*))
(.lvf vf9 (&-> v1-0 quad))
)
(.mul.vf vf3 vf1 vf1)
(.add.w.vf acc vf2 vf0)
(.mul.vf vf4 vf3 vf3)
(.add.mul.x.vf acc vf3 vf9 acc)
(.mul.vf vf5 vf4 vf3)
(.add.mul.y.vf acc vf4 vf9 acc)
(.mul.vf vf6 vf4 vf4)
(.add.mul.z.vf acc vf5 vf9 acc)
(.add.mul.w.vf vf2 vf6 vf9 acc)
(.svf (&-> arg0 quad) vf2)
arg0
)
)
;; definition for function vector-sincos-rad!
;; WARN: Bad vector register dependency: vf14
(defun vector-sincos-rad! ((arg0 vector) (arg1 vector) (arg2 vector))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf14 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(.lvf vf1 (&-> arg2 quad))
(.sub.vf vf14 vf14 vf14)
(let ((v1-0 *sin-poly-vec2*))
(.lvf vf11 (&-> v1-0 quad))
)
(.mul.vf vf2 vf1 vf1)
(let ((v1-1 *sin-poly-vec*))
(.lvf vf10 (&-> v1-1 quad))
)
(let ((v1-2 *cos-poly-vec*))
(.lvf vf13 (&-> v1-2 quad))
)
(.mul.x.vf acc vf1 vf11)
(.mul.vf vf3 vf2 vf1)
(.mul.vf vf4 vf2 vf2)
(.mul.vf vf5 vf3 vf2)
(.mul.vf vf6 vf3 vf3)
(.mul.vf vf7 vf4 vf3)
(.mul.vf vf8 vf4 vf4)
(.mul.vf vf9 vf5 vf4)
(.add.mul.x.vf acc vf3 vf10 acc)
(.add.mul.y.vf acc vf5 vf10 acc)
(.add.mul.z.vf acc vf7 vf10 acc)
(.add.mul.w.vf vf12 vf9 vf10 acc)
(.add.w.vf acc vf14 vf0)
(.add.mul.x.vf acc vf2 vf13 acc)
(.add.mul.y.vf acc vf4 vf13 acc)
(.add.mul.z.vf acc vf6 vf13 acc)
(.add.mul.w.vf vf14 vf8 vf13 acc)
(.svf (&-> arg0 quad) vf12)
(.svf (&-> arg1 quad) vf14)
0
)
)
;; definition for function sincos-rad!
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function sincos!
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function vector-rad<-vector-deg!
;; INFO: Return type mismatch float vs none.
(defun vector-rad<-vector-deg! ((arg0 vector) (arg1 vector))
(local-vars (v0-0 float) (v1-1 float) (v1-2 int) (v1-3 int))
(rlet ((vf1 :class vf)
(vf2 :class vf)
)
(let ((v1-0 #x38c90fda))
(.lvf vf1 (&-> arg1 quad))
(.ftoi.vf vf1 vf1)
(.mov vf2 v1-0)
)
(.mov v1-1 vf1)
(.pw.sll v1-2 v1-1 16)
(.pw.sra v1-3 v1-2 16)
(.mov vf1 v1-3)
(.itof.vf vf1 vf1)
(.mul.x.vf vf1 vf1 vf2)
(.svf (&-> arg0 quad) vf1)
(.mov v0-0 vf1)
(none)
)
)
;; definition for function vector-rad<-vector-deg/2!
;; INFO: Return type mismatch float vs int.
(defun vector-rad<-vector-deg/2! ((arg0 vector) (arg1 vector))
(local-vars (v0-0 float) (v1-1 float) (v1-2 int) (v1-3 int))
(rlet ((vf1 :class vf)
(vf2 :class vf)
)
(let ((v1-0 #x38c90fda))
(let ((a2-0 #x3f000000))
(.lvf vf1 (&-> arg1 quad))
(.mov vf2 a2-0)
)
(.mul.x.vf vf1 vf1 vf2)
(.ftoi.vf vf1 vf1)
(.mov vf2 v1-0)
)
(.mov v1-1 vf1)
(.pw.sll v1-2 v1-1 16)
(.pw.sra v1-3 v1-2 16)
(.mov vf1 v1-3)
(.itof.vf vf1 vf1)
(.mul.x.vf vf1 vf1 vf2)
(.svf (&-> arg0 quad) vf1)
(.mov v0-0 vf1)
(the-as int v0-0)
)
)
;; definition for function vector-sincos!
(defun vector-sincos! ((arg0 vector) (arg1 vector) (arg2 vector))
(let ((s4-0 (new 'stack-no-clear 'vector)))
(vector-rad<-vector-deg! s4-0 arg2)
(vector-sincos-rad! arg0 arg1 s4-0)
)
)
;; definition for function tan-rad
(defun tan-rad ((arg0 float))
(/ (sin arg0) (cos arg0))
)
;; definition for function cos
(defun cos ((arg0 float))
(sin (+ 16384.0 arg0))
)
;; definition for function tan
(defun tan ((arg0 float))
(/ (sin arg0) (cos arg0))
)
;; definition for function atan0
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function atan-series-rad
;; WARN: Unsupported inline assembly instruction kind - [adda.s f0, f18]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f2, f11]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f4, f12]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f5, f13]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f6, f14]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f7, f15]
;; WARN: Unsupported inline assembly instruction kind - [madda.s f8, f16]
;; WARN: Unsupported inline assembly instruction kind - [madd.s f18, f9, f17]
(defun atan-series-rad ((arg0 float))
(local-vars (f18-1 float))
(let* ((f1-0 (* arg0 arg0))
(f10-0 0.99999934)
(f11-0 -0.33329856)
(f2-0 (* arg0 f1-0))
(f3-0 (* f1-0 f1-0))
(f12-0 0.19946536)
(f4-0 (* f2-0 f1-0))
(f5-0 (* f3-0 f2-0))
(f13-0 -0.13908534)
(f6-0 (* f4-0 f3-0))
(f7-0 (* f5-0 f3-0))
(f14-0 0.09642004)
(f8-0 (* f6-0 f3-0))
(f9-0 (* f7-0 f3-0))
(f15-0 -0.055909887)
(f18-0 0.7853982)
(f0-1 (* arg0 f10-0))
(f16-0 0.02186123)
(f17-0 -0.004054058)
)
(.adda.s f0-1 f18-0)
(.madda.s f2-0 f11-0)
(.madda.s f4-0 f12-0)
(.madda.s f5-0 f13-0)
(.madda.s f6-0 f14-0)
(.madda.s f7-0 f15-0)
(.madda.s f8-0 f16-0)
(.madd.s f18-1 f9-0 f17-0)
)
f18-1
)
;; definition for function atan-rad
(defun atan-rad ((arg0 float))
(atan-series-rad (/ (+ -1.0 arg0) (+ 1.0 arg0)))
)
;; definition for function sign
(defun sign ((arg0 float))
(cond
((< 0.0 arg0)
1.0
)
((< arg0 0.0)
-1.0
)
(else
0.0
)
)
)
;; definition for function atan2-rad
(defun atan2-rad ((arg0 float) (arg1 float))
(cond
((= arg1 0.0)
(* 1.5707963 (sign arg0))
)
(else
(cond
((and (< arg0 0.0) (< arg1 0.0))
(let ((f30-1 MINUS_PI)
(f0-6 (/ arg0 arg1))
)
(+ f30-1 (atan-series-rad (/ (+ -1.0 f0-6) (+ 1.0 f0-6))))
)
)
((< arg0 0.0)
(let ((f0-14 (- (/ arg0 arg1))))
(- (atan-series-rad (/ (+ -1.0 f0-14) (+ 1.0 f0-14))))
)
)
((< arg1 0.0)
(let ((f30-2 PI)
(f0-22 (- (/ arg0 arg1)))
)
(- f30-2 (atan-series-rad (/ (+ -1.0 f0-22) (+ 1.0 f0-22))))
)
)
(else
(let ((f0-28 (/ arg0 arg1)))
(atan-series-rad (/ (+ -1.0 f0-28) (+ 1.0 f0-28)))
)
)
)
)
)
)
;; definition of type float-type
(deftype float-type (uint32)
()
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
;; definition for symbol exp-slead, type (pointer float)
(define
exp-slead
(new 'static 'array float 32
1.0
1.0218964
1.0442734
1.0671387
1.0905075
1.1143799
1.1387863
1.1637192
1.1892014
1.2152405
1.2418518
1.2690506
1.2968369
1.3252335
1.354248
1.3839035
1.4142075
1.4451752
1.4768219
1.5091629
1.5422058
1.5759735
1.6104889
1.645752
1.6817856
1.7186127
1.7562485
1.7947083
1.8340073
1.8741608
1.9151993
1.9571381
)
)
;; definition for symbol exp-strail, type (pointer float)
(define
exp-strail
(new 'static 'array float 32
0.0
0.0000007863494
0.00000040596257
0.0000017288019
0.00000022534104
0.0000068597833
0.0000023188388
0.0000056815315
0.0000057600223
0.0000068814647
0.000006005433
0.0000003590472
0.0000027016238
0.000003183687
0.000007500062
0.000006378546
0.000006103877
0.0000056360786
0.0000042465254
0.0000015247614
0.000005014861
0.000007334366
0.0000014403477
0.000003525029
0.000007247011
0.000006627224
0.0000036862523
0.00000082304996
0.0000008232258
0.0000068675085
0.000007281612
0.000006062652
)
)
;; definition for function exp
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function atan
(defun atan ((arg0 float) (arg1 float))
(cond
((and (= arg1 0.0) (= arg0 0.0))
0.0
)
(else
(cond
((and (< arg1 0.0) (< arg0 0.0))
(+ -32768.0 (atan0 (- arg0) (- arg1)))
)
((< arg0 0.0)
(- (atan0 (- arg0) arg1))
)
((< arg1 0.0)
(- 32768.0 (atan0 arg0 (- arg1)))
)
(else
(atan0 arg0 arg1)
)
)
)
)
)
;; definition for function asin
(defun asin ((arg0 float))
(let ((gp-0 #f))
(let ((f0-0 0.0))
)
(when (< arg0 0.0)
(set! arg0 (- arg0))
(set! gp-0 #t)
)
(let ((f0-5 (cond
((< 1.0 arg0)
16383.996
)
(else
(let* ((f0-6 1.0)
(f1-2 arg0)
(f0-8 (sqrtf (- f0-6 (* f1-2 f1-2))))
)
(atan0 arg0 f0-8)
)
)
)
)
)
(if gp-0
(- f0-5)
f0-5
)
)
)
)
;; definition for function acos
(defun acos ((arg0 float))
(- 16384.0 (asin arg0))
)
;; definition for function acos-rad
(defun acos-rad ((arg0 float))
(cond
((>= arg0 0.0)
(let* ((f0-1 1.0)
(f1-1 arg0)
(f0-3 (sqrtf (- f0-1 (* f1-1 f1-1))))
(f0-5 (/ (- f0-3 arg0) (+ f0-3 arg0)))
)
(atan-series-rad f0-5)
)
)
(else
(let* ((f0-6 1.0)
(f1-6 arg0)
(f0-8 (sqrtf (- f0-6 (* f1-6 f1-6))))
(f0-10 (/ (+ f0-8 arg0) (- f0-8 arg0)))
)
(- PI (atan-series-rad f0-10))
)
)
)
)
;; definition for function sinerp
(defun sinerp ((arg0 float) (arg1 float) (arg2 float))
(lerp arg0 arg1 (sin (* 16384.0 arg2)))
)
;; definition for function sinerp-clamp
(defun sinerp-clamp ((minimum float) (maximum float) (amount float))
(cond
((>= 0.0 amount)
minimum
)
((>= amount 1.0)
maximum
)
(else
(sinerp minimum maximum amount)
)
)
)
;; definition for function coserp
(defun coserp ((minimum float) (maximum float) (amount float))
(lerp minimum maximum (- 1.0 (cos (* 16384.0 amount))))
)
;; definition for function coserp-clamp
(defun coserp-clamp ((minimum float) (maximum float) (amount float))
(cond
((>= 0.0 amount)
minimum
)
((>= amount 1.0)
maximum
)
(else
(coserp minimum maximum amount)
)
)
)
;; definition for function coserp180
(defun coserp180 ((minimum float) (maximum float) (amount float))
(lerp minimum maximum (* 0.5 (- 1.0 (cos (* 32768.0 amount)))))
)
;; definition for function coserp180-clamp
(defun coserp180-clamp ((minimum float) (maximum float) (amount float))
(cond
((>= 0.0 amount)
minimum
)
((>= amount 1.0)
maximum
)
(else
(coserp180 minimum maximum amount)
)
)
)
;; definition for function ease-in-out
(defun ease-in-out ((total int) (progress int))
(local-vars (v1-0 int))
(cond
((>= progress total)
1.0
)
((<= progress 0)
0.0
)
((begin
(set! v1-0 (/ total 2))
(< v1-0 progress)
)
(let ((a0-1 (- progress total)))
(+
0.5
(*
0.5
(sin (- 16384.0 (/ (* 16384.0 (the float a0-1)) (the float v1-0))))
)
)
)
)
(else
(- 0.5 (* 0.5 (cos (/ (* 16384.0 (the float progress)) (the float v1-0)))))
)
)
)
+11 -2
View File
@@ -15,8 +15,8 @@ namespace {
// list of object files to ignore during reference checks
const std::unordered_set<std::string> g_object_files_to_ignore_ref_checks = {
"pskernel", "transformq-h", "geometry", "trigonometry", "math-camera", "timer",
"texture", "ocean-tables", "ocean-frames", "time-of-day", "display"};
"pskernel", "geometry", "math-camera", "timer", "texture",
"ocean-tables", "ocean-frames", "time-of-day", "display"};
const std::unordered_set<std::string> g_object_files_to_ignore_decompiling = {
// TODO - not implemented, if you want to ignore decompiling something currently, don't include
@@ -49,6 +49,8 @@ const std::unordered_set<std::string> expected_skip_in_decompiler = {
// bounding-box
"(method 9 bounding-box)", // handwritten asm loop
"(method 14 bounding-box)", // handwritten asm loop
// trig
"exp", "atan0", "sincos!", "sincos-rad!",
// matrix
"(method 9 matrix)", // handwritten asm loop
"matrix-axis-sin-cos!", "matrix-axis-sin-cos-vu!",
@@ -97,6 +99,13 @@ const std::unordered_set<std::string> skip_in_compiling = {
"rand-vu-init", "rand-vu", "rand-vu-nostep", // random hardware
"log2", // weird tricky int-as-float stuff
// trig
"sin-rad", // fpu acc
"cos-rad", // fpu acc
"atan-series-rad", // fpu acc
"vector-rad<-vector-deg!", // bad decisions on float vs int128
"vector-rad<-vector-deg/2!", // bad decisions on float vs int128
/// VECTOR-H
"(method 3 vector)", // this function appears twice, which confuses the compiler.
"vector-dot", // fpu acc