mirror of
https://github.com/open-goal/jak-project
synced 2026-09-08 20:02:39 -04:00
[Decomp] Math library: transform and quaternion (#344)
* decompile transform * types for quaternion * part of quaternion * finish quaternion * fix offline test reference * wip fix to let issue * fix
This commit is contained in:
@@ -97,4 +97,23 @@
|
||||
(define-extern cos (function float float))
|
||||
(define-extern vector-sincos! (function vector vector vector int))
|
||||
(define-extern matrix-axis-sin-cos! (function matrix vector float float none))
|
||||
(define-extern atan (function float float float))
|
||||
(define-extern atan (function float float float))
|
||||
|
||||
;; transform
|
||||
(define-extern vector-identity! (function vector vector))
|
||||
|
||||
;; quaternion
|
||||
(define-extern acos (function float float))
|
||||
(define-extern acos-rad (function float float))
|
||||
(define-extern atan2-rad (function float float float))
|
||||
(define-extern vector-length (function vector float))
|
||||
(define-extern sincos-rad! (function (pointer float) float int))
|
||||
(define-extern atan-series-rad (function float float))
|
||||
(define-extern vector-sin-rad! (function vector vector vector))
|
||||
(define-extern vector-rad<-vector-deg/2! (function vector vector int))
|
||||
(define-extern vector-sincos-rad! (function vector vector vector int))
|
||||
(define-extern deg-diff (function float float float))
|
||||
(define-extern vector-xz-normalize! (function vector float vector))
|
||||
(declare-type quaternion structure)
|
||||
(define-extern quaternion-from-two-vectors-max-angle! (function quaternion vector vector float quaternion))
|
||||
(define-extern vector-xz-length (function vector float))
|
||||
@@ -288,38 +288,25 @@
|
||||
;; WARN: Unsupported inline assembly instruction kind - [subu a2, v1, s7]
|
||||
;; WARN: Unsupported inline assembly instruction kind - [sllv a2, v1, r0]
|
||||
(defmethod print handle ((obj handle))
|
||||
(local-vars
|
||||
(r0-0 none)
|
||||
(a2-0 int)
|
||||
(a2-1 process)
|
||||
(a2-2 (pointer process))
|
||||
(s7-0 none)
|
||||
)
|
||||
(local-vars (r0-0 none) (a2-0 int) (a2-2 (pointer process)) (s7-0 none))
|
||||
(if (nonzero? obj)
|
||||
(let ((t9-0 format)
|
||||
(a0-1 #t)
|
||||
(a1-0 "#<handle :process ~A :pid ~D>")
|
||||
(v1-0 obj)
|
||||
)
|
||||
(let ((v1-0 obj))
|
||||
(.subu a2-0 (the-as handle v1-0) s7-0)
|
||||
(set! a2-1 (and (nonzero? a2-0) (begin
|
||||
(.sllv a2-2 (the-as handle v1-0) r0-0)
|
||||
(let ((a3-0 (-> a2-2 0)))
|
||||
(set!
|
||||
a2-1
|
||||
(if (= (sar v1-0 32) (-> a3-0 pid))
|
||||
a3-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-2 a2-1))
|
||||
)
|
||||
a2-1
|
||||
)
|
||||
)
|
||||
)
|
||||
(.subu a2-0 (the-as handle v1-0) s7-0)
|
||||
(t9-0 a0-1 a1-0 (and (nonzero? a2-0) (begin
|
||||
(.sllv a2-2 (the-as handle v1-0) r0-0)
|
||||
(let ((a3-0 (-> a2-2 0)))
|
||||
(if (= (sar v1-0 32) (-> a3-0 pid))
|
||||
a3-0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(sar (the-as int obj) 32)
|
||||
)
|
||||
(t9-0 a0-1 a1-0 a2-1 (sar (the-as int obj) 32))
|
||||
)
|
||||
(format #t "#<handle :process 0 :pid 0>")
|
||||
)
|
||||
|
||||
@@ -582,7 +582,6 @@
|
||||
)
|
||||
|
||||
;; definition for method 14 of type dead-pool
|
||||
;; INFO: Return type mismatch process-tree vs process.
|
||||
(defmethod get-process dead-pool ((obj dead-pool) (arg0 type) (arg1 int))
|
||||
(let ((s4-0 (the-as object (-> obj child))))
|
||||
(when
|
||||
@@ -602,7 +601,7 @@
|
||||
(v1-6 (the-as process s4-0))
|
||||
)
|
||||
(t9-1 a0-2 a1-2 a2-1 (if (the-as process v1-6)
|
||||
(-> (the-as (pointer process-tree) v1-6) 0 self)
|
||||
(-> (the-as (pointer process) v1-6) 0 self)
|
||||
)
|
||||
(-> obj name)
|
||||
)
|
||||
@@ -611,19 +610,16 @@
|
||||
)
|
||||
(the-as process (cond
|
||||
(s4-0
|
||||
(set!
|
||||
(-> (the-as (pointer process-tree) s4-0) 0 type)
|
||||
arg0
|
||||
)
|
||||
(-> (the-as (pointer process-tree) s4-0) 0)
|
||||
(set! (-> (the-as (pointer process) s4-0) 0 type) arg0)
|
||||
(-> (the-as (pointer process) s4-0) 0)
|
||||
)
|
||||
(else
|
||||
(format
|
||||
0
|
||||
"WARNING: ~A ~A could not be allocated, because ~A was empty.~%"
|
||||
arg0
|
||||
(if (the-as (pointer process-tree) s4-0)
|
||||
(-> (the-as (pointer process-tree) s4-0) 0 self)
|
||||
(if (the-as (pointer process) s4-0)
|
||||
(-> (the-as (pointer process) s4-0) 0 self)
|
||||
)
|
||||
(-> obj name)
|
||||
)
|
||||
@@ -886,17 +882,13 @@
|
||||
(let ((v1-5 (-> s1-0 next)))
|
||||
(set! (-> s1-0 next) s4-0)
|
||||
(set! (-> s4-0 next) v1-5)
|
||||
(when v1-5
|
||||
(if v1-5
|
||||
(set! (-> v1-5 prev) s4-0)
|
||||
(let ((v1-6 s4-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> s4-0 prev) s1-0)
|
||||
(when (= s1-0 (-> obj alive-list prev))
|
||||
(if (= s1-0 (-> obj alive-list prev))
|
||||
(set! (-> obj alive-list prev) s4-0)
|
||||
(let ((v1-9 s4-0))
|
||||
)
|
||||
)
|
||||
(let ((a0-4 (gap-location obj s1-0)))
|
||||
(set!
|
||||
@@ -914,14 +906,12 @@
|
||||
(if (= (-> obj first-gap) s1-0)
|
||||
(set! (-> obj first-gap) (find-gap obj s4-0))
|
||||
)
|
||||
(when
|
||||
(if
|
||||
(or
|
||||
(not (-> obj first-shrink))
|
||||
(< (the-as int s3-0) (the-as int (-> obj first-shrink process)))
|
||||
)
|
||||
(set! (-> obj first-shrink) s4-0)
|
||||
(let ((v1-22 s4-0))
|
||||
)
|
||||
)
|
||||
(set! (-> s3-0 parent) (-> obj ppointer))
|
||||
(set! (-> s3-0 pool) obj)
|
||||
@@ -1048,13 +1038,9 @@
|
||||
)
|
||||
((< f0-2 0.2)
|
||||
(set! arg0 (shl arg0 2))
|
||||
(let ((v1-10 arg0))
|
||||
)
|
||||
)
|
||||
((< f0-2 0.3)
|
||||
(set! arg0 (shl arg0 1))
|
||||
(let ((v1-12 arg0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1066,8 +1052,6 @@
|
||||
(when (not v1-13)
|
||||
(set! v1-13 (-> obj alive-list next))
|
||||
(set! (-> obj first-shrink) v1-13)
|
||||
(let ((a0-5 v1-13))
|
||||
)
|
||||
)
|
||||
(if v1-13
|
||||
(shrink-heap obj (-> v1-13 process))
|
||||
@@ -1130,10 +1114,8 @@
|
||||
(let ((v1-19 (-> a1-3 next)))
|
||||
(set! (-> a1-3 next) s4-0)
|
||||
(set! (-> s4-0 next) v1-19)
|
||||
(when v1-19
|
||||
(if v1-19
|
||||
(set! (-> v1-19 prev) s4-0)
|
||||
(let ((v1-20 s4-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> s4-0 prev) a1-3)
|
||||
@@ -1285,8 +1267,6 @@
|
||||
(iterate-process-tree (-> v1-4 0) arg1 arg2)
|
||||
(set! v1-4 s3-1)
|
||||
)
|
||||
(let ((a0-4 v1-4))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1323,8 +1303,6 @@
|
||||
(execute-process-tree (-> v1-8 0) arg1 arg2)
|
||||
(set! v1-8 s4-1)
|
||||
)
|
||||
(let ((a0-6 v1-8))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1353,8 +1331,6 @@
|
||||
)
|
||||
(set! v1-5 s5-1)
|
||||
)
|
||||
(let ((a0-5 v1-5))
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as process #f)
|
||||
@@ -1395,7 +1371,7 @@
|
||||
)
|
||||
)
|
||||
(when (-> a0-0 trans-hook)
|
||||
(let*
|
||||
(let
|
||||
((s4-0
|
||||
(new
|
||||
'process
|
||||
@@ -1406,13 +1382,14 @@
|
||||
(-> a0-0 main-thread stack-top)
|
||||
)
|
||||
)
|
||||
(v0-1
|
||||
(reset-and-call s4-0 (-> a0-0 trans-hook))
|
||||
)
|
||||
(let
|
||||
((v0-1
|
||||
(reset-and-call s4-0 (-> a0-0 trans-hook))
|
||||
)
|
||||
)
|
||||
)
|
||||
(delete s4-0)
|
||||
(let ((v1-12 v0-1))
|
||||
)
|
||||
)
|
||||
(if (= (-> a0-0 status) 'dead)
|
||||
(return (begin
|
||||
@@ -1617,52 +1594,44 @@
|
||||
(v1-4 (the-as (pointer process-tree) #f))
|
||||
)
|
||||
(let ((t1-0 t0-0))
|
||||
(when (= (if t1-0
|
||||
(-> t1-0 0 self)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
(if (= (if t1-0
|
||||
(-> t1-0 0 self)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
(set! a3-1 a2-1)
|
||||
(let ((t1-3 a3-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((t1-4 t0-0))
|
||||
(when (= (if t1-4
|
||||
(-> t1-4 0 self)
|
||||
)
|
||||
arg1
|
||||
)
|
||||
(if (= (if t1-4
|
||||
(-> t1-4 0 self)
|
||||
)
|
||||
arg1
|
||||
)
|
||||
(set! v1-4 a2-1)
|
||||
(let ((t1-7 v1-4))
|
||||
)
|
||||
)
|
||||
)
|
||||
(while (and (-> t0-0 0 brother) (or (not a3-1) (not v1-4)))
|
||||
(let ((t1-8 t0-0))
|
||||
(when (= (-> (if t1-8
|
||||
(-> t1-8 0 self)
|
||||
)
|
||||
brother
|
||||
)
|
||||
arg1
|
||||
)
|
||||
(if (= (-> (if t1-8
|
||||
(-> t1-8 0 self)
|
||||
)
|
||||
brother
|
||||
)
|
||||
arg1
|
||||
)
|
||||
(set! v1-4 t0-0)
|
||||
(let ((t1-12 v1-4))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((t1-13 t0-0))
|
||||
(when (= (-> (if t1-13
|
||||
(-> t1-13 0 self)
|
||||
)
|
||||
brother
|
||||
)
|
||||
arg0
|
||||
)
|
||||
(if (= (-> (if t1-13
|
||||
(-> t1-13 0 self)
|
||||
)
|
||||
brother
|
||||
)
|
||||
arg0
|
||||
)
|
||||
(set! a3-1 t0-0)
|
||||
(let ((t1-17 a3-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! t0-0 (-> t0-0 0 brother))
|
||||
@@ -1842,32 +1811,30 @@
|
||||
(entity-deactivate-handler obj (-> obj entity))
|
||||
)
|
||||
(let ((s5-0 pp))
|
||||
)
|
||||
(let ((s4-0 (-> obj stack-frame-top)))
|
||||
(while (the-as protect-frame s4-0)
|
||||
(let ((v1-5 (-> s4-0 type)))
|
||||
(if (or (= v1-5 protect-frame) (= v1-5 state))
|
||||
((-> (the-as protect-frame s4-0) exit))
|
||||
(let ((s4-0 (-> obj stack-frame-top)))
|
||||
(while (the-as protect-frame s4-0)
|
||||
(let ((v1-5 (-> s4-0 type)))
|
||||
(if (or (= v1-5 protect-frame) (= v1-5 state))
|
||||
((-> (the-as protect-frame s4-0) exit))
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(the-as protect-frame s4-0)
|
||||
(-> (the-as protect-frame s4-0) next)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(the-as protect-frame s4-0)
|
||||
(-> (the-as protect-frame s4-0) next)
|
||||
)
|
||||
)
|
||||
(let ((s6-2 s5-0))
|
||||
)
|
||||
)
|
||||
(let ((v0-2 (process-disconnect obj))
|
||||
(v1-11 (-> obj child))
|
||||
)
|
||||
(let ((v0-2 (process-disconnect obj)))
|
||||
)
|
||||
(let ((v1-11 (-> obj child)))
|
||||
(while v1-11
|
||||
(let ((s5-1 (-> v1-11 0 brother)))
|
||||
(deactivate (-> v1-11 0))
|
||||
(let ((v1-13 v0-2))
|
||||
)
|
||||
(set! v1-11 s5-1)
|
||||
)
|
||||
(let ((a0-8 v1-11))
|
||||
)
|
||||
)
|
||||
)
|
||||
(return-process (-> obj pool) obj)
|
||||
|
||||
@@ -99,8 +99,6 @@
|
||||
(cond
|
||||
((-> s0-2 exit)
|
||||
(set! (-> pp stack-frame-top) s0-2)
|
||||
(let ((v1-20 s0-2))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! (-> pp stack-frame-top) #f)
|
||||
@@ -143,14 +141,24 @@
|
||||
|
||||
;; definition for function send-event-function
|
||||
(defun send-event-function ((arg0 process) (arg1 event-message-block))
|
||||
(when (and arg0 (!= (-> arg0 type) process-tree) (-> arg0 event-hook))
|
||||
(let ((s6-1 arg0))
|
||||
)
|
||||
((-> arg0 event-hook)
|
||||
(-> arg1 from)
|
||||
(-> arg1 num-params)
|
||||
(-> arg1 message)
|
||||
arg1
|
||||
(if (and arg0 (!= (-> arg0 type) process-tree) (-> arg0 event-hook))
|
||||
(let ((gp-0 pp))
|
||||
(let ((s6-1 arg0))
|
||||
)
|
||||
(let
|
||||
((v0-0
|
||||
((-> arg0 event-hook)
|
||||
(-> arg1 from)
|
||||
(-> arg1 num-params)
|
||||
(-> arg1 message)
|
||||
arg1
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s6-2 gp-0))
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -489,10 +489,8 @@
|
||||
(&- arg-end (the-as uint arg-start))
|
||||
)
|
||||
)
|
||||
(when (= (-> arg-end 0) 34)
|
||||
(if (= (-> arg-end 0) 34)
|
||||
(set! arg-end (&-> arg-end 1))
|
||||
(let ((v1-6 arg-end))
|
||||
)
|
||||
)
|
||||
(let ((a1-3 (string-skip-whitespace arg-end)))
|
||||
(string-suck-up! arg a1-3)
|
||||
@@ -548,8 +546,6 @@
|
||||
(when (= (-> next-char-2 1) 45)
|
||||
(set! v1-0 #t)
|
||||
(set! next-char-2 (&-> next-char-2 1))
|
||||
(let ((a1-8 next-char-2))
|
||||
)
|
||||
)
|
||||
(while
|
||||
(or
|
||||
@@ -566,47 +562,23 @@
|
||||
(>= (the-as uint 102) (-> next-char-2 0))
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((and
|
||||
(set!
|
||||
result
|
||||
(if
|
||||
(and
|
||||
(>= (-> next-char-2 0) (the-as uint 65))
|
||||
(>= (the-as uint 70) (-> next-char-2 0))
|
||||
)
|
||||
(set!
|
||||
result
|
||||
(the-as
|
||||
int
|
||||
(+ (+ (-> next-char-2 0) -55) (the-as uint (shl result 4)))
|
||||
)
|
||||
)
|
||||
(let ((a1-14 (the-as uint result)))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(cond
|
||||
((and
|
||||
(+ (+ (-> next-char-2 0) -55) (the-as uint (shl result 4)))
|
||||
(the-as
|
||||
int
|
||||
(if
|
||||
(and
|
||||
(>= (-> next-char-2 0) (the-as uint 97))
|
||||
(>= (the-as uint 102) (-> next-char-2 0))
|
||||
)
|
||||
(set!
|
||||
result
|
||||
(the-as
|
||||
int
|
||||
(+ (+ (-> next-char-2 0) -87) (the-as uint (shl result 4)))
|
||||
)
|
||||
)
|
||||
(let ((a1-20 (the-as uint result)))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set!
|
||||
result
|
||||
(the-as
|
||||
int
|
||||
(+ (+ (-> next-char-2 0) -48) (the-as uint (shl result 4)))
|
||||
)
|
||||
)
|
||||
(let ((a1-23 (the-as uint result)))
|
||||
)
|
||||
(+ (+ (-> next-char-2 0) -87) (the-as uint (shl result 4)))
|
||||
(+ (+ (-> next-char-2 0) -48) (the-as uint (shl result 4)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -637,8 +609,6 @@
|
||||
(when (= (-> str-ptr 1) 45)
|
||||
(set! v1-0 #t)
|
||||
(set! str-ptr (&-> str-ptr 1))
|
||||
(let ((a1-47 str-ptr))
|
||||
)
|
||||
)
|
||||
(while
|
||||
(and
|
||||
|
||||
@@ -131,12 +131,11 @@
|
||||
(rand-vu-init 1.418091)
|
||||
|
||||
;; definition for function rand-vu
|
||||
;; INFO: Return type mismatch int vs float.
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.VRGET]
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.VRXOR]
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.VRNEXT]
|
||||
(defun rand-vu ()
|
||||
(local-vars (v0-0 int))
|
||||
(local-vars (v0-0 float))
|
||||
(rlet ((Q :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
@@ -150,15 +149,14 @@
|
||||
(TODO.VRNEXT vf1)
|
||||
(.sub.w.vf vf1 vf1 vf0)
|
||||
(.mov v0-0 vf1)
|
||||
(the-as float v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function rand-vu-nostep
|
||||
;; INFO: Return type mismatch int vs float.
|
||||
;; WARN: Inline assembly instruction marked with TODO - [TODO.VRGET]
|
||||
(defun rand-vu-nostep ()
|
||||
(local-vars (v0-0 int))
|
||||
(local-vars (v0-0 float))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
)
|
||||
@@ -166,7 +164,7 @@
|
||||
(TODO.VRGET vf1)
|
||||
(.sub.w.vf vf1 vf1 vf0)
|
||||
(.mov v0-0 vf1)
|
||||
(the-as float v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
@@ -182,24 +180,14 @@
|
||||
|
||||
;; definition for function rand-vu-int-range
|
||||
(defun rand-vu-int-range ((first int) (second int))
|
||||
(cond
|
||||
((< first second)
|
||||
(set! second (+ second 1))
|
||||
(let ((v1-1 second))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! first (+ first 1))
|
||||
(let ((v1-3 first))
|
||||
)
|
||||
)
|
||||
(if (< first second)
|
||||
(set! second (+ second 1))
|
||||
(set! first (+ first 1))
|
||||
)
|
||||
(let
|
||||
((float-in-range (rand-vu-float-range (the float first) (the float second))))
|
||||
(when (< float-in-range 0.0)
|
||||
(if (< float-in-range 0.0)
|
||||
(set! float-in-range (+ -1.0 float-in-range))
|
||||
(let ((v1-5 float-in-range))
|
||||
)
|
||||
)
|
||||
(the int float-in-range)
|
||||
)
|
||||
|
||||
@@ -238,8 +238,6 @@
|
||||
(set! (-> dst data 1) (-> temp-vec3 data 1))
|
||||
(set! (-> dst data 2) (-> temp-vec3 data 2))
|
||||
)
|
||||
(let ((v1-1 dst))
|
||||
)
|
||||
dst
|
||||
)
|
||||
|
||||
@@ -259,8 +257,6 @@
|
||||
(set! (-> dst data 1) (-> temp-vec3 data 1))
|
||||
(set! (-> dst data 2) (-> temp-vec3 data 2))
|
||||
)
|
||||
(let ((v1-1 dst))
|
||||
)
|
||||
dst
|
||||
)
|
||||
|
||||
@@ -815,8 +811,6 @@
|
||||
(set! (-> dst data 14) 0.0)
|
||||
(let ((f0-12 1.0))
|
||||
(set! (-> dst data 15) f0-12)
|
||||
(let ((v1-1 f0-12))
|
||||
)
|
||||
)
|
||||
dst
|
||||
)
|
||||
@@ -912,9 +906,8 @@
|
||||
)
|
||||
|
||||
;; definition for function matrix3-determinant
|
||||
;; INFO: Return type mismatch int vs float.
|
||||
(defun matrix3-determinant ((arg0 matrix))
|
||||
(local-vars (v0-0 int))
|
||||
(local-vars (v0-0 float))
|
||||
(rlet ((acc :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
@@ -929,7 +922,7 @@
|
||||
(.add.y.vf vf13 vf13 vf13 :mask #b1)
|
||||
(.add.z.vf vf13 vf13 vf13 :mask #b1)
|
||||
(.mov v0-0 vf13)
|
||||
(the-as float v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
;; definition of type quaternion
|
||||
(deftype quaternion (structure)
|
||||
((data float 4 :offset-assert 0)
|
||||
(x float :offset 0)
|
||||
(y float :offset 4)
|
||||
(z float :offset 8)
|
||||
(w float :offset 12)
|
||||
((x float :offset-assert 0)
|
||||
(y float :offset-assert 4)
|
||||
(z float :offset-assert 8)
|
||||
(w float :offset-assert 12)
|
||||
(data float 4 :offset 0)
|
||||
(vec vector :inline :offset 0)
|
||||
(quad uint128 :offset 0)
|
||||
)
|
||||
@@ -17,15 +17,16 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type quaternion
|
||||
;; INFO: this function exists in multiple non-identical object files
|
||||
;; Used lq/sq
|
||||
(defmethod inspect quaternion ((obj quaternion))
|
||||
(format #t "[~8x] ~A~%" obj 'quaternion)
|
||||
(format #t "~Tdata[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tx: ~f~%" (-> obj data 0))
|
||||
(format #t "~Ty: ~f~%" (-> obj data 1))
|
||||
(format #t "~Tz: ~f~%" (-> obj data 2))
|
||||
(format #t "~Tw: ~f~%" (-> obj data 3))
|
||||
(format #t "~Tvec: #<vector @ #x~X>~%" (-> obj data))
|
||||
(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 "~Tvec: #<vector @ #x~X>~%" (&-> obj x))
|
||||
(format #t "~Tquad: ~D~%" (-> obj vec quad))
|
||||
obj
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,9 @@
|
||||
:method-count-assert 9
|
||||
:size-assert #x40
|
||||
:flag-assert #x900000040
|
||||
(:methods
|
||||
(new (symbol type) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type trs
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for method 2 of type transform
|
||||
(defmethod print transform ((obj transform))
|
||||
(format #t "#<transform @ #x~X~%" obj)
|
||||
(format
|
||||
#t
|
||||
"~T~Ttrans:~F ~F ~F ~F ~%"
|
||||
(-> obj trans data 0)
|
||||
(-> obj trans data 1)
|
||||
(-> obj trans data 2)
|
||||
(-> obj trans data 3)
|
||||
)
|
||||
(format
|
||||
#t
|
||||
"~T~Trot: ~F ~F ~F ~F ~%"
|
||||
(-> obj rot data 0)
|
||||
(-> obj rot data 1)
|
||||
(-> obj rot data 2)
|
||||
(-> obj rot data 3)
|
||||
)
|
||||
(format
|
||||
#t
|
||||
"~T~Tscale:~F ~F ~F ~F>"
|
||||
(-> obj scale data 0)
|
||||
(-> obj scale data 1)
|
||||
(-> obj scale data 2)
|
||||
(-> obj scale data 3)
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for method 0 of type trs
|
||||
(defmethod new trs ((allocation symbol) (type-to-make type))
|
||||
(let
|
||||
((obj
|
||||
(object-new allocation type-to-make (the-as int (-> type-to-make size)))
|
||||
)
|
||||
)
|
||||
(set! (-> obj trans data 3) 1.0)
|
||||
(set! (-> obj rot data 3) 1.0)
|
||||
(vector-identity! (-> obj scale))
|
||||
obj
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function transform-matrix-calc!
|
||||
;; Used lq/sq
|
||||
(defun transform-matrix-calc! ((tf transform) (dst-mat matrix))
|
||||
(let ((s4-0 (new 'stack 'matrix)))
|
||||
(set! (-> s4-0 vector 0 quad) (the-as uint128 0))
|
||||
(set! (-> s4-0 vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> s4-0 vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> s4-0 vector 3 quad) (the-as uint128 0))
|
||||
(let ((s3-0 (new 'stack 'matrix)))
|
||||
(set! (-> s3-0 vector 0 quad) (the-as uint128 0))
|
||||
(set! (-> s3-0 vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> s3-0 vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> s3-0 vector 3 quad) (the-as uint128 0))
|
||||
(matrix-identity! dst-mat)
|
||||
(matrix-translate! dst-mat (-> tf trans))
|
||||
(matrix-rotate-y! s4-0 (-> tf rot data 1))
|
||||
(matrix*! s3-0 s4-0 dst-mat)
|
||||
(matrix-rotate-x! s4-0 (-> tf rot data 0))
|
||||
(matrix*! dst-mat s4-0 s3-0)
|
||||
(matrix-rotate-z! s4-0 (-> tf rot data 2))
|
||||
(matrix*! s3-0 s4-0 dst-mat)
|
||||
(matrix-scale! s4-0 (-> tf scale))
|
||||
(matrix*! dst-mat s4-0 s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function transform-matrix-parent-calc!
|
||||
;; Used lq/sq
|
||||
(defun
|
||||
transform-matrix-parent-calc!
|
||||
((tf transform) (dst-mat matrix) (inv-scale vector))
|
||||
(let ((s4-0 (new 'stack 'matrix)))
|
||||
(set! (-> s4-0 vector 0 quad) (the-as uint128 0))
|
||||
(set! (-> s4-0 vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> s4-0 vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> s4-0 vector 3 quad) (the-as uint128 0))
|
||||
(let ((s3-0 (new 'stack 'matrix)))
|
||||
(set! (-> s3-0 vector 0 quad) (the-as uint128 0))
|
||||
(set! (-> s3-0 vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> s3-0 vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> s3-0 vector 3 quad) (the-as uint128 0))
|
||||
(matrix-identity! s3-0)
|
||||
(matrix-translate! s3-0 (-> tf trans))
|
||||
(matrix-inv-scale! s4-0 inv-scale)
|
||||
(matrix*! dst-mat s4-0 s3-0)
|
||||
(matrix-rotate-y! s4-0 (-> tf rot data 1))
|
||||
(matrix*! s3-0 s4-0 dst-mat)
|
||||
(matrix-rotate-x! s4-0 (-> tf rot data 0))
|
||||
(matrix*! dst-mat s4-0 s3-0)
|
||||
(matrix-rotate-z! s4-0 (-> tf rot data 2))
|
||||
(matrix*! s3-0 s4-0 dst-mat)
|
||||
(matrix-scale! s4-0 (-> tf scale))
|
||||
(matrix*! dst-mat s4-0 s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function trs-matrix-calc!
|
||||
(defun trs-matrix-calc! ((tf trs) (dst-mat matrix))
|
||||
(transform-matrix-calc! (the-as transform (-> tf trans)) dst-mat)
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(none)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -842,9 +842,8 @@
|
||||
)
|
||||
|
||||
;; definition for function vector-dot-vu
|
||||
;; INFO: Return type mismatch int vs float.
|
||||
(defun vector-dot-vu ((arg0 vector) (arg1 vector))
|
||||
(local-vars (v0-0 int))
|
||||
(local-vars (v0-0 float))
|
||||
(rlet ((vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
)
|
||||
@@ -854,7 +853,7 @@
|
||||
(.add.y.vf vf1 vf1 vf1 :mask #b1)
|
||||
(.add.z.vf vf1 vf1 vf1 :mask #b1)
|
||||
(.mov v0-0 vf1)
|
||||
(the-as float v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
@@ -883,9 +882,8 @@
|
||||
)
|
||||
|
||||
;; definition for function vector4-dot-vu
|
||||
;; INFO: Return type mismatch int vs float.
|
||||
(defun vector4-dot-vu ((arg0 vector) (arg1 vector))
|
||||
(local-vars (v0-0 int))
|
||||
(local-vars (v0-0 float))
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
@@ -902,7 +900,7 @@
|
||||
(.add.mul.z.vf acc vf3 vf1 acc :mask #b1)
|
||||
(.add.mul.w.vf vf1 vf3 vf1 acc :mask #b1)
|
||||
(.mov v0-0 vf1)
|
||||
(the-as float v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -2550,7 +2550,7 @@ TEST_F(FormRegressionTest, ExprTerminal2) {
|
||||
|
||||
std::string expected =
|
||||
"(let\n"
|
||||
" ((f0-4 (sqrt (/ (- (* 0.0 arg0) arg1) arg2))))\n"
|
||||
" ((f0-4 (sqrtf (/ (- (* 0.0 arg0) arg1) arg2))))\n"
|
||||
" (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4))))\n"
|
||||
" )";
|
||||
test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using namespace decompiler;
|
||||
|
||||
// tests stack variables
|
||||
TEST_F(FormRegressionTest, MatrixPMult) {
|
||||
std::string func =
|
||||
"sll r0, r0, 0\n"
|
||||
@@ -56,4 +57,272 @@ TEST_F(FormRegressionTest, MatrixPMult) {
|
||||
"[\n"
|
||||
" [16, \"matrix\"]\n"
|
||||
" ]");
|
||||
}
|
||||
|
||||
// TODO- this should also work without the cast, but be uglier.
|
||||
TEST_F(FormRegressionTest, VectorXQuaternionWithCast) {
|
||||
std::string func =
|
||||
"sll r0, r0, 0\n"
|
||||
|
||||
" daddiu sp, sp, -112\n"
|
||||
" sd ra, 0(sp)\n"
|
||||
" sq s5, 80(sp)\n"
|
||||
" sq gp, 96(sp)\n"
|
||||
|
||||
" or gp, a0, r0\n"
|
||||
" daddiu s5, sp, 16\n"
|
||||
" sq r0, 0(s5)\n"
|
||||
" sq r0, 16(s5)\n"
|
||||
" sq r0, 32(s5)\n"
|
||||
" sq r0, 48(s5)\n"
|
||||
" lw t9, quaternion->matrix(s7)\n"
|
||||
" or a0, s5, r0\n"
|
||||
" jalr ra, t9\n"
|
||||
" sll v0, ra, 0\n"
|
||||
|
||||
" daddu v1, r0, s5\n"
|
||||
" lq v1, 0(v1)\n"
|
||||
|
||||
" sq v1, 0(gp)\n"
|
||||
" or v0, gp, r0\n"
|
||||
" ld ra, 0(sp)\n"
|
||||
" lq gp, 96(sp)\n"
|
||||
" lq s5, 80(sp)\n"
|
||||
" jr ra\n"
|
||||
" daddiu sp, sp, 112";
|
||||
std::string type = "(function quaternion quaternion quaternion)";
|
||||
std::string expected =
|
||||
"(begin\n"
|
||||
" (let ((s5-0 (new (quote stack) (quote matrix))))\n"
|
||||
" (set! (-> s5-0 vector 0 quad) (the-as uint128 0))\n"
|
||||
" (set! (-> s5-0 vector 1 quad) (the-as uint128 0))\n"
|
||||
" (set! (-> s5-0 vector 2 quad) (the-as uint128 0))\n"
|
||||
" (set! (-> s5-0 vector 3 quad) (the-as uint128 0))\n"
|
||||
" (quaternion->matrix s5-0 arg1)\n"
|
||||
" (set! (-> arg0 vec quad) (-> (the-as (pointer uint128) (-> s5-0 data)) 0))\n"
|
||||
" )\n"
|
||||
" arg0\n"
|
||||
" )";
|
||||
test_with_stack_vars(func, type, expected,
|
||||
"[\n"
|
||||
" [16, \"matrix\"]\n"
|
||||
" ]",
|
||||
"[[10, \"v1\", \"(pointer uint128)\"]]");
|
||||
}
|
||||
|
||||
TEST_F(FormRegressionTest, EliminateFloatDeadSet) {
|
||||
std::string func =
|
||||
"sll r0, r0, 0\n"
|
||||
"L32:\n"
|
||||
" daddiu sp, sp, -16\n"
|
||||
" sd fp, 8(sp)\n"
|
||||
" or fp, t9, r0\n"
|
||||
|
||||
" lwu v1, 4(a0)\n"
|
||||
" mtc1 f0, v1\n"
|
||||
" cvt.s.w f1, f0\n"
|
||||
//" lwc1 f0, L83(fp)\n"
|
||||
" mtc1 f0, r0\n"
|
||||
" lw a1, *display*(s7)\n"
|
||||
" ld a1, 780(a1)\n"
|
||||
" divu a1, v1\n"
|
||||
" mfhi v1\n"
|
||||
" mtc1 f2, v1\n"
|
||||
" cvt.s.w f2, f2\n"
|
||||
" lwc1 f3, 0(a0)\n"
|
||||
" add.s f2, f2, f3\n"
|
||||
" div.s f3, f2, f1\n"
|
||||
" cvt.w.s f3, f3\n"
|
||||
" cvt.s.w f3, f3\n"
|
||||
" mul.s f3, f3, f1\n"
|
||||
" sub.s f2, f2, f3\n"
|
||||
" div.s f1, f2, f1\n"
|
||||
" mul.s f0, f0, f1\n"
|
||||
//" lwc1 f1, L84(fp)\n"
|
||||
" mtc1 f1, r0\n"
|
||||
//" lwc1 f2, L83(fp)\n"
|
||||
" mtc1 f2, r0\n"
|
||||
" lwc1 f3, 12(a0)\n"
|
||||
" mul.s f2, f2, f3\n"
|
||||
" sub.s f1, f1, f2\n"
|
||||
//" lwc1 f2, L84(fp)\n"
|
||||
" mtc1 f2, r0\n"
|
||||
//" lwc1 f3, L83(fp)\n"
|
||||
" mtc1 f3, r0\n"
|
||||
" lwc1 f4, 8(a0)\n"
|
||||
" mul.s f3, f3, f4\n"
|
||||
" sub.s f2, f2, f3\n"
|
||||
//" lwc1 f3, L84(fp)\n"
|
||||
" mtc1 f3, r0\n"
|
||||
" add.s f3, f3, f1\n"
|
||||
" c.lt.s f0, f3\n"
|
||||
" bc1t L33\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
" mtc1 f0, r0\n"
|
||||
" mfc1 v1, f0\n"
|
||||
" beq r0, r0, L36\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
"L33:\n"
|
||||
//" lwc1 f3, L84(fp)\n"e
|
||||
" mtc1 f3, r0\n"
|
||||
" c.lt.s f3, f0\n"
|
||||
" bc1f L34\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
//" lwc1 f2, L84(fp)\n"
|
||||
" mtc1 f2, r0\n"
|
||||
//" lwc1 f3, L82(fp)\n"
|
||||
" mtc1 f3, r0\n"
|
||||
" add.s f0, f3, f0\n"
|
||||
" div.s f0, f0, f1\n"
|
||||
" sub.s f0, f2, f0\n"
|
||||
" mfc1 v1, f0\n"
|
||||
" beq r0, r0, L36\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
"L34:\n"
|
||||
" c.lt.s f0, f2\n"
|
||||
" bc1t L35\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
//" lwc1 f0, L84(fp)\n"
|
||||
" mtc1 f0, r0\n"
|
||||
" mfc1 v1, f0\n"
|
||||
" beq r0, r0, L36\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
"L35:\n"
|
||||
" div.s f0, f0, f2\n"
|
||||
" mfc1 v1, f0\n"
|
||||
|
||||
"L36:\n"
|
||||
" mfc1 v0, f0\n"
|
||||
" ld fp, 8(sp)\n"
|
||||
" jr ra\n"
|
||||
" daddiu sp, sp, 16";
|
||||
std::string type = "(function sync-info-paused float)";
|
||||
std::string expected =
|
||||
"(let* ((v1-0 (-> arg0 period))\n"
|
||||
" (f1-0 (the float v1-0))\n"
|
||||
" (f0-1 0.0)\n"
|
||||
" (f2-2\n"
|
||||
" (+\n"
|
||||
" (the float (mod (-> *display* base-frame-counter) v1-0))\n"
|
||||
" (-> arg0 offset)\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (f0-2\n"
|
||||
" (* f0-1 (/ (- f2-2 (* (the float (the int (/ f2-2 f1-0))) f1-0)) f1-0))\n"
|
||||
" )\n"
|
||||
" (f1-3 (- 0.0 (* 0.0 (-> arg0 pause-after-in))))\n"
|
||||
" (f2-7 (- 0.0 (* 0.0 (-> arg0 pause-after-out))))\n"
|
||||
" )\n"
|
||||
" (cond\n"
|
||||
" ((>= f0-2 (+ 0.0 f1-3))\n"
|
||||
" 0.0\n"
|
||||
" )\n"
|
||||
" ((< 0.0 f0-2)\n"
|
||||
" (- 0.0 (/ (+ 0.0 f0-2) f1-3))\n"
|
||||
" )\n"
|
||||
" ((>= f0-2 f2-7)\n"
|
||||
" 0.0\n"
|
||||
" )\n"
|
||||
" (else\n"
|
||||
" (/ f0-2 f2-7)\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )";
|
||||
test_with_stack_vars(func, type, expected, "[]");
|
||||
}
|
||||
|
||||
TEST_F(FormRegressionTest, IterateProcessTree) {
|
||||
std::string func =
|
||||
"sll r0, r0, 0\n"
|
||||
|
||||
" daddiu sp, sp, -80\n"
|
||||
" sd ra, 0(sp)\n"
|
||||
" sq s3, 16(sp)\n"
|
||||
" sq s4, 32(sp)\n"
|
||||
" sq s5, 48(sp)\n"
|
||||
" sq gp, 64(sp)\n"
|
||||
|
||||
" or s3, a0, r0\n"
|
||||
" or gp, a1, r0\n"
|
||||
" or s5, a2, r0\n"
|
||||
" lwu v1, 4(s3)\n"
|
||||
" andi v1, v1, 256\n"
|
||||
" bnel v1, r0, L113\n"
|
||||
|
||||
" daddiu s4, s7, 8\n"
|
||||
|
||||
" or t9, gp, r0\n"
|
||||
" or a0, s3, r0\n"
|
||||
" jalr ra, t9\n"
|
||||
" sll v0, ra, 0\n"
|
||||
" or s4, v0, r0\n"
|
||||
|
||||
"L113:\n"
|
||||
" daddiu v1, s7, dead\n"
|
||||
" bne s4, v1, L114\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
" or v1, s7, r0\n"
|
||||
" beq r0, r0, L117\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
"L114:\n"
|
||||
" lwu v1, 16(s3)\n"
|
||||
" beq r0, r0, L116\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
"L115:\n"
|
||||
" lwu a0, 0(v1)\n"
|
||||
" lwu s3, 12(a0)\n"
|
||||
" lw t9, iterate-process-tree(s7)\n"
|
||||
" lwu a0, 0(v1)\n"
|
||||
" or a1, gp, r0\n"
|
||||
" or a2, s5, r0\n"
|
||||
" jalr ra, t9\n"
|
||||
" sll v0, ra, 0\n"
|
||||
|
||||
" or v1, s3, r0\n"
|
||||
" or a0, v1, r0\n"
|
||||
|
||||
"L116:\n"
|
||||
" bne s7, v1, L115\n"
|
||||
" sll r0, r0, 0\n"
|
||||
|
||||
" or v1, s7, r0\n"
|
||||
|
||||
"L117:\n"
|
||||
" or v0, s4, r0\n"
|
||||
" ld ra, 0(sp)\n"
|
||||
" lq gp, 64(sp)\n"
|
||||
" lq s5, 48(sp)\n"
|
||||
" lq s4, 32(sp)\n"
|
||||
" lq s3, 16(sp)\n"
|
||||
" jr ra\n"
|
||||
" daddiu sp, sp, 80";
|
||||
std::string type = "(function process-tree (function object object) kernel-context object)";
|
||||
std::string expected =
|
||||
"(let ((s4-0 (or (nonzero? (logand (-> arg0 mask) 256)) (arg1 arg0))))\n"
|
||||
" (cond\n"
|
||||
" ((= s4-0 (quote dead))\n"
|
||||
" )\n"
|
||||
" (else\n"
|
||||
" (let ((v1-4 (-> arg0 child)))\n"
|
||||
" (while v1-4\n"
|
||||
" (let ((s3-1 (-> v1-4 0 brother)))\n"
|
||||
" (iterate-process-tree (-> v1-4 0) arg1 arg2)\n"
|
||||
" (set! v1-4 s3-1)\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" s4-0\n"
|
||||
" )";
|
||||
test_with_stack_vars(func, type, expected, "[]");
|
||||
}
|
||||
@@ -2357,8 +2357,6 @@ TEST_F(FormRegressionTest, ExprStringToInt) {
|
||||
" (when (= (-> a0-3 1) 45)\n"
|
||||
" (set! v1-0 #t)\n"
|
||||
" (set! a0-3 (&-> a0-3 1))\n"
|
||||
" (let ((a1-8 a0-3))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (while\n"
|
||||
" (or\n"
|
||||
@@ -2375,38 +2373,23 @@ TEST_F(FormRegressionTest, ExprStringToInt) {
|
||||
" (>= (the-as uint 102) (-> a0-3 0))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (cond\n"
|
||||
" ((and\n"
|
||||
" (set!\n"
|
||||
" v0-0\n"
|
||||
" (if\n"
|
||||
" (and\n"
|
||||
" (>= (-> a0-3 0) (the-as uint 65))\n"
|
||||
" (>= (the-as uint 70) (-> a0-3 0))\n"
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" v0-0\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -55) (the-as uint (shl v0-0 4))))\n"
|
||||
" )\n"
|
||||
" (let ((a1-14 (the-as uint v0-0)))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (else\n"
|
||||
" (cond\n"
|
||||
" ((and\n"
|
||||
" (+ (+ (-> a0-3 0) -55) (the-as uint (shl v0-0 4)))\n"
|
||||
" (the-as\n"
|
||||
" int\n"
|
||||
" (if\n"
|
||||
" (and\n"
|
||||
" (>= (-> a0-3 0) (the-as uint 97))\n"
|
||||
" (>= (the-as uint 102) (-> a0-3 0))\n"
|
||||
" )\n"
|
||||
" (set!\n"
|
||||
" v0-0\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -87) (the-as uint (shl v0-0 4))))\n"
|
||||
" )\n"
|
||||
" (let ((a1-20 (the-as uint v0-0)))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (else\n"
|
||||
" (set!\n"
|
||||
" v0-0\n"
|
||||
" (the-as int (+ (+ (-> a0-3 0) -48) (the-as uint (shl v0-0 4))))\n"
|
||||
" )\n"
|
||||
" (let ((a1-23 (the-as uint v0-0)))\n"
|
||||
" )\n"
|
||||
" (+ (+ (-> a0-3 0) -87) (the-as uint (shl v0-0 4)))\n"
|
||||
" (+ (+ (-> a0-3 0) -48) (the-as uint (shl v0-0 4)))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
@@ -2437,8 +2420,6 @@ TEST_F(FormRegressionTest, ExprStringToInt) {
|
||||
" (when (= (-> a0-1 1) 45)\n"
|
||||
" (set! v1-0 #t)\n"
|
||||
" (set! a0-1 (&-> a0-1 1))\n"
|
||||
" (let ((a1-47 a0-1))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (while\n"
|
||||
" (and (>= (-> a0-1 0) (the-as uint 48)) (>= (the-as uint 57) (-> a0-1 0)))\n"
|
||||
|
||||
@@ -1090,7 +1090,7 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPool) {
|
||||
" (v1-6 (the-as process s4-0))\n"
|
||||
" )\n"
|
||||
" (t9-1 a0-2 a1-2 a2-1 (if (the-as process v1-6)\n"
|
||||
" (-> (the-as (pointer process-tree) v1-6) 0 self)\n"
|
||||
" (-> (the-as (pointer process) v1-6) 0 self)\n"
|
||||
" )\n"
|
||||
" (-> arg0 name)\n"
|
||||
" )\n"
|
||||
@@ -1099,16 +1099,16 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPool) {
|
||||
" )\n"
|
||||
" (the-as process (cond\n"
|
||||
" (s4-0\n"
|
||||
" (set! (-> (the-as (pointer process-tree) s4-0) 0 type) arg1)\n"
|
||||
" (-> (the-as (pointer process-tree) s4-0) 0)\n"
|
||||
" (set! (-> (the-as (pointer process) s4-0) 0 type) arg1)\n"
|
||||
" (-> (the-as (pointer process) s4-0) 0)\n"
|
||||
" )\n"
|
||||
" (else\n"
|
||||
" (format\n"
|
||||
" 0\n"
|
||||
" \"WARNING: ~A ~A could not be allocated, because ~A was empty.~%\"\n"
|
||||
" arg1\n"
|
||||
" (if (the-as (pointer process-tree) s4-0)\n"
|
||||
" (-> (the-as (pointer process-tree) s4-0) 0 self)\n"
|
||||
" (if (the-as (pointer process) s4-0)\n"
|
||||
" (-> (the-as (pointer process) s4-0) 0 self)\n"
|
||||
" )\n"
|
||||
" (-> arg0 name)\n"
|
||||
" )\n"
|
||||
@@ -1123,8 +1123,8 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPool) {
|
||||
func, type, expected, false, "dead-pool",
|
||||
{{"L315", "WARNING: ~A ~A had to be allocated from the debug pool, because ~A was empty.~%"},
|
||||
{"L314", "WARNING: ~A ~A could not be allocated, because ~A was empty.~%"}},
|
||||
"[\t\t[24, \"v1\", \"(pointer process-tree)\"],\n"
|
||||
"\t\t[[30,39], \"s4\", \"(pointer process-tree)\"]]");
|
||||
"[\t\t[24, \"v1\", \"(pointer process)\"],\n"
|
||||
"\t\t[[30,39], \"s4\", \"(pointer process)\"]]");
|
||||
}
|
||||
|
||||
TEST_F(FormRegressionTest, ExprMethod15DeadPool) {
|
||||
@@ -2016,13 +2016,12 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPoolHeap) {
|
||||
" ((v1-5 (-> s1-0 next)))\n"
|
||||
" (set! (-> s1-0 next) s4-0)\n"
|
||||
" (set! (-> s4-0 next) v1-5)\n"
|
||||
" (when v1-5 (set! (-> v1-5 prev) s4-0) (let ((v1-6 s4-0))))\n"
|
||||
" (if v1-5 (set! (-> v1-5 prev) s4-0))\n"
|
||||
" )\n"
|
||||
" (set! (-> s4-0 prev) s1-0)\n"
|
||||
" (when\n"
|
||||
" (if\n"
|
||||
" (= s1-0 (-> arg0 alive-list prev))\n"
|
||||
" (set! (-> arg0 alive-list prev) s4-0)\n"
|
||||
" (let ((v1-9 s4-0)))\n"
|
||||
" )\n"
|
||||
" (let\n"
|
||||
" ((a0-4 (gap-location arg0 s1-0)))\n"
|
||||
@@ -2042,13 +2041,12 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPoolHeap) {
|
||||
" (= (-> arg0 first-gap) s1-0)\n"
|
||||
" (set! (-> arg0 first-gap) (find-gap arg0 s4-0))\n"
|
||||
" )\n"
|
||||
" (when\n"
|
||||
" (if\n"
|
||||
" (or\n"
|
||||
" (not (-> arg0 first-shrink))\n"
|
||||
" (< (the-as int s3-0) (the-as int (-> arg0 first-shrink process)))\n"
|
||||
" )\n"
|
||||
" (set! (-> arg0 first-shrink) s4-0)\n"
|
||||
" (let ((v1-22 s4-0)))\n"
|
||||
" )\n"
|
||||
" (set! (-> s3-0 parent) (-> arg0 ppointer))\n"
|
||||
" (set! (-> s3-0 pool) arg0)\n"
|
||||
@@ -2593,8 +2591,8 @@ TEST_F(FormRegressionTest, ExprMethod16DeadPoolHeap) {
|
||||
" (format *stdcon* \"~3LLow Actor Memory~%~0L\" a2-0)\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" ((< f0-2 (l.f L347)) (set! arg1 (shl arg1 2)) (let ((v1-10 arg1))))\n"
|
||||
" ((< f0-2 (l.f L348)) (set! arg1 (shl arg1 1)) (let ((v1-12 arg1))))\n"
|
||||
" ((< f0-2 (l.f L347)) (set! arg1 (shl arg1 2)))\n"
|
||||
" ((< f0-2 (l.f L348)) (set! arg1 (shl arg1 1)))\n"
|
||||
" )\n"
|
||||
" )\n"
|
||||
" (set! (-> arg0 compact-count-targ) (the-as uint arg1))\n"
|
||||
@@ -2608,7 +2606,6 @@ TEST_F(FormRegressionTest, ExprMethod16DeadPoolHeap) {
|
||||
" (not v1-13)\n"
|
||||
" (set! v1-13 (-> arg0 alive-list next))\n"
|
||||
" (set! (-> arg0 first-shrink) v1-13)\n"
|
||||
" (let ((a0-5 v1-13)))\n"
|
||||
" )\n"
|
||||
" (if v1-13 (shrink-heap arg0 (-> v1-13 process)))\n"
|
||||
" )\n"
|
||||
@@ -2818,7 +2815,7 @@ TEST_F(FormRegressionTest, ExprMethod18DeadPoolHeap) {
|
||||
" ((v1-19 (-> a1-3 next)))\n"
|
||||
" (set! (-> a1-3 next) s4-0)\n"
|
||||
" (set! (-> s4-0 next) v1-19)\n"
|
||||
" (when v1-19 (set! (-> v1-19 prev) s4-0) (let ((v1-20 s4-0))))\n"
|
||||
" (if v1-19 (set! (-> v1-19 prev) s4-0))\n"
|
||||
" )\n"
|
||||
" (set! (-> s4-0 prev) a1-3)\n"
|
||||
" (set! (-> arg0 alive-list prev) s4-0)\n"
|
||||
|
||||
@@ -14,7 +14,7 @@ const std::unordered_set<std::string> g_object_files_to_decompile = {
|
||||
"gcommon", "gstring-h", "gkernel-h", "gkernel",
|
||||
/*"pskernel",*/ "gstring", "dgo-h", "gstate", "types-h", "vu1-macros", "math", "vector-h",
|
||||
"bounding-box-h", "matrix-h", "quaternion-h", "euler-h", "transform-h", "geometry-h",
|
||||
"trigonometry-h", /* transformq-h */ "matrix",
|
||||
"trigonometry-h", /* transformq-h */ "matrix", "transform", "quaternion",
|
||||
/* gap */
|
||||
"bounding-box"};
|
||||
|
||||
@@ -25,7 +25,7 @@ const std::vector<std::string> g_object_files_to_check_against_reference = {
|
||||
"math", "vector-h", "bounding-box-h", "matrix-h", "quaternion-h", "euler-h", "transform-h",
|
||||
"geometry-h", "trigonometry-h",
|
||||
/* transformq-h, */
|
||||
"matrix",
|
||||
"matrix", "transform", "quaternion",
|
||||
/* gap */ "bounding-box"};
|
||||
|
||||
// the functions we expect the decompiler to skip
|
||||
@@ -82,7 +82,8 @@ const std::unordered_set<std::string> skip_in_compiling = {
|
||||
"(method 10 process)",
|
||||
|
||||
/// GSTATE
|
||||
"enter-state", // stack pointer asm
|
||||
"enter-state", // stack pointer asm
|
||||
"send-event-function", // pp asm (eventually we should make this work)
|
||||
|
||||
/// MATH
|
||||
"rand-vu-init", "rand-vu", "rand-vu-nostep", // random hardware
|
||||
@@ -92,6 +93,11 @@ const std::unordered_set<std::string> skip_in_compiling = {
|
||||
"(method 3 vector)", // this function appears twice, which confuses the compiler.
|
||||
"vector-dot", // fpu acc
|
||||
"vector4-dot", // fpu acc
|
||||
|
||||
// QUATERNION
|
||||
"matrix-with-scale->quaternion", // fpu acc
|
||||
"quaternion-delta-y", // fpu acc
|
||||
|
||||
};
|
||||
|
||||
// default location for the data. It can be changed with a command line argument.
|
||||
|
||||
Reference in New Issue
Block a user