mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 23:00:45 -04:00
decomp: mostly finish aligner (#686)
* decomp: mostly finish `aligner` Issues in aligner/aligner-h that require hand-editing after decompilation * linting
This commit is contained in:
Vendored
+65
-16
@@ -11,20 +11,38 @@
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{
|
||||
"overviewRulerColor": "transparent", // TODO - fix this bug, it extends beyond the line match
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#41f041",
|
||||
"fontWeight": "bold"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(<uninitialized>)": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#c72855"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(INFO:.*)": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "yellow",
|
||||
"fontWeight": "bold",
|
||||
"filterFileRegex": ".*ir2\\.asm"
|
||||
"fontWeight": "bold"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(sp, -?\\d+ )": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#00ff08",
|
||||
"fontWeight": "bold"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -57,6 +75,24 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"(lwu t9)": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "magenta"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(jalr)": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "magenta"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(L\\d+)": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
@@ -75,117 +111,130 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"(at)": {
|
||||
"([\\s\\(])(at)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "red"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(gp)": {
|
||||
"([\\s\\(])(gp)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#64c5e3"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(v0)": {
|
||||
"([\\s\\(])(v0)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#c6c1e6"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(v1)": {
|
||||
"([\\s\\(])(v1)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#dae6be"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(s6)": {
|
||||
"([\\s\\(])(s6)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#41f0b0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(a0)": {
|
||||
"([\\s\\(])(a0)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "pink"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(a1)": {
|
||||
"([\\s\\(])(a1)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#e065bb"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(a2)": {
|
||||
"([\\s\\(])(a2)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#6dd1a6"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(a3)": {
|
||||
"([\\s\\(])(a3)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#bad192"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(t0)": {
|
||||
"([\\s\\(])(t0)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#b56b82"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(t1)": {
|
||||
"([\\s\\(])(t1)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#6d32ba"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(t2)": {
|
||||
"([\\s\\(])(t2)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#db9267"
|
||||
}
|
||||
]
|
||||
},
|
||||
"(t3)": {
|
||||
"([\\s\\(])(t3)([\\s\\),:-])": {
|
||||
"filterFileRegex": ".*ir2\\.asm",
|
||||
"decorations": [
|
||||
{},
|
||||
{
|
||||
"overviewRulerColor": "transparent",
|
||||
"color": "#92db67"
|
||||
|
||||
@@ -2194,7 +2194,7 @@
|
||||
(global-y-angle-to-point (_type_ vector) float 23)
|
||||
(relative-y-angle-to-point (_type_ vector) float 24)
|
||||
(TODO-VECTOR-MATH-ISSUES-25 (_type_) float 25)
|
||||
(dummy-26 () none 26)
|
||||
(TODO-RENAME-26 (_type_ int vector float) trsqv 26)
|
||||
(get-quaternion (_type_) quaternion 27)
|
||||
)
|
||||
)
|
||||
@@ -9672,10 +9672,11 @@
|
||||
|
||||
;; - Types
|
||||
|
||||
(declare-type process-drawable process)
|
||||
(deftype align-control (basic)
|
||||
((flags uint32 :offset-assert 4)
|
||||
(process process :offset-assert 8)
|
||||
(frame-group basic :offset-assert 12)
|
||||
(process process-drawable :offset-assert 8)
|
||||
(frame-group art-joint-anim :offset-assert 12)
|
||||
(frame-num float :offset-assert 16)
|
||||
(matrix matrix 2 :inline :offset-assert 32)
|
||||
(transform transform 2 :inline :offset-assert 160)
|
||||
@@ -9688,11 +9689,11 @@
|
||||
:flag-assert #xe00000134
|
||||
(:methods
|
||||
(new (symbol type process) _type_ :behavior process-drawable 0)
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
(dummy-11 () none 11)
|
||||
(dummy-12 () none 12)
|
||||
(dummy-13 () none 13)
|
||||
(TODO-RENAME-9 (_type_) transformq 9)
|
||||
(TODO-RENAME-10 (_type_ int float float float) trsqv 10)
|
||||
(TODO-RENAME-11 (_type_ int vector int float float) none 11) ;; 3rd arg is unused
|
||||
(first-transform (_type_) transform 12)
|
||||
(snd-transform (_type_) transform 13)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -10823,7 +10824,6 @@
|
||||
:flag-assert #x38000000b8
|
||||
(:methods
|
||||
(new (symbol type process collide-list-enum) _type_)
|
||||
(dummy-26 () none 26)
|
||||
(dummy-28 () none 28)
|
||||
(dummy-29 () none 29)
|
||||
(dummy-30 () none 30)
|
||||
|
||||
@@ -540,5 +540,14 @@
|
||||
[64, "vector"]
|
||||
],
|
||||
|
||||
"(method 9 align-control)": [
|
||||
[16, "matrix"],
|
||||
[80, "quaternion"]
|
||||
],
|
||||
|
||||
"(method 10 align-control)": [
|
||||
[16, "vector"]
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below!": []
|
||||
}
|
||||
|
||||
@@ -1154,5 +1154,9 @@
|
||||
[6, "a3", "symbol"]
|
||||
],
|
||||
|
||||
"(method 9 align-control)": [
|
||||
[[27, 31], "t9", "(function object object object object)"]
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below": []
|
||||
}
|
||||
|
||||
@@ -7,26 +7,26 @@
|
||||
|
||||
|
||||
(deftype align-control (basic)
|
||||
((flags uint32 :offset-assert 4)
|
||||
(process process :offset-assert 8)
|
||||
(frame-group basic :offset-assert 12)
|
||||
(frame-num float :offset-assert 16)
|
||||
(matrix matrix 2 :inline :offset-assert 32)
|
||||
(transform transform 2 :inline :offset-assert 160)
|
||||
(delta transformq :inline :offset-assert 256)
|
||||
(last-speed float :offset-assert 304) ;; meters
|
||||
(align transformq :inline :offset 160)
|
||||
((flags uint32 :offset-assert 4)
|
||||
(process process-drawable :offset-assert 8)
|
||||
(frame-group art-joint-anim :offset-assert 12)
|
||||
(frame-num float :offset-assert 16)
|
||||
(matrix matrix 2 :inline :offset-assert 32)
|
||||
(transform transform 2 :inline :offset-assert 160)
|
||||
(delta transformq :inline :offset-assert 256)
|
||||
(last-speed float :offset-assert 304);; meters
|
||||
(align transformq :inline :offset 160)
|
||||
)
|
||||
:method-count-assert 14
|
||||
:size-assert #x134
|
||||
:flag-assert #xe00000134
|
||||
(:methods
|
||||
(new (symbol type process) _type_ :behavior process-drawable 0)
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
(dummy-11 () none 11)
|
||||
(dummy-12 () none 12)
|
||||
(dummy-13 () none 13)
|
||||
(TODO-RENAME-9 (_type_) transformq 9)
|
||||
(TODO-RENAME-10 (_type_ int float float float) trsqv 10)
|
||||
(TODO-RENAME-11 (_type_ int vector int float float) none 11) ;; 3rd arg is unused
|
||||
(first-transform (_type_) transform 12)
|
||||
(snd-transform (_type_) transform 13)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
(return (the align-control 0))
|
||||
)
|
||||
|
||||
(set! (-> obj process) proc)
|
||||
(set! (-> obj process) (the-as process-drawable proc))
|
||||
obj
|
||||
)
|
||||
)
|
||||
|
||||
@@ -5,3 +5,268 @@
|
||||
;; name in dgo: aligner
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; definition for method 9 of type align-control
|
||||
;; WARN: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)]
|
||||
;; WARN: Unsupported inline assembly instruction kind - [jr ra]
|
||||
;; Used lq/sq
|
||||
(defmethod TODO-RENAME-9 align-control ((obj align-control))
|
||||
(local-vars (a0-9 symbol) (s7-0 none) (ra-0 int))
|
||||
(with-pp
|
||||
(let ((s5-0 (-> obj process skel active-channels)))
|
||||
(dotimes (s4-0 s5-0)
|
||||
(let* ((a0-3 (-> obj process skel channel s4-0))
|
||||
(v1-5 (-> a0-3 frame-group))
|
||||
(a0-4 (-> a0-3 command))
|
||||
(a1-0 'stack)
|
||||
(a2-0 (= a0-4 a1-0))
|
||||
)
|
||||
(cond
|
||||
((or a2-0 (begin
|
||||
(set! a1-0 'stack1)
|
||||
(= a0-4 a1-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
; TODO - support decompiling the return-from-thread
|
||||
; TODO - properly decompile the `go`to
|
||||
; (when (!= (-> v1-5 type) art-joint-anim)
|
||||
; (let
|
||||
; ((t9-0 (the-as (function object object object object) enter-state))
|
||||
; (a0-7 "align joint-anim")
|
||||
; )
|
||||
; (set! (-> pp next-state) process-drawable-art-error)
|
||||
; (t9-0 a0-7 (the-as none a1-0) a2-0)
|
||||
; )
|
||||
; (.lw ra-0 return-from-thread s7-0)
|
||||
; (.jr ra-0)
|
||||
; (nop!)
|
||||
; 0
|
||||
; )
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let* ((a0-8 (-> obj process skel root-channel 0))
|
||||
(v1-16 (-> a0-8 frame-group))
|
||||
(f0-0 (-> a0-8 frame-num))
|
||||
)
|
||||
(= (-> a0-8 num-func) num-func-loop!)
|
||||
(cond
|
||||
((or (not v1-16) (!= (-> obj frame-group) v1-16))
|
||||
(set! a0-9 #t)
|
||||
)
|
||||
(else
|
||||
(if (= (-> a0-8 num-func) num-func-loop!)
|
||||
(set! a0-9 (< (* (-> a0-8 param 0) (- f0-0 (-> obj frame-num))) 0.0))
|
||||
(set! a0-9 (= f0-0 0.0))
|
||||
)
|
||||
)
|
||||
)
|
||||
(if a0-9
|
||||
(set! (-> obj flags) (logior (-> obj flags) 1))
|
||||
(set! (-> obj flags) (logand -2 (the-as int (-> obj flags))))
|
||||
)
|
||||
(set! (-> obj frame-group) v1-16)
|
||||
(set! (-> obj frame-num) f0-0)
|
||||
)
|
||||
(mem-copy!
|
||||
(the-as pointer (-> obj transform 1))
|
||||
(the-as pointer (-> obj transform))
|
||||
48
|
||||
)
|
||||
(quaternion-copy!
|
||||
(the-as quaternion (-> obj transform 1 rot))
|
||||
(-> obj align quat)
|
||||
)
|
||||
(set! (-> obj transform 1 scale quad) (-> obj align scale quad))
|
||||
(let* ((a2-5 (-> obj matrix 1))
|
||||
(a3-0 (-> obj matrix))
|
||||
(v1-19 (-> a3-0 0 vector 0 quad))
|
||||
(a0-18 (-> a3-0 0 vector 1 quad))
|
||||
(a1-12 (-> a3-0 0 vector 2 quad))
|
||||
(a3-1 (-> a3-0 0 vector 3 quad))
|
||||
)
|
||||
(set! (-> a2-5 vector 0 quad) v1-19)
|
||||
(set! (-> a2-5 vector 1 quad) a0-18)
|
||||
(set! (-> a2-5 vector 2 quad) a1-12)
|
||||
(set! (-> a2-5 vector 3 quad) a3-1)
|
||||
)
|
||||
(let ((s5-1 (-> obj process node-list data 1)))
|
||||
(cspace<-matrix-no-push-joint! s5-1 (the-as matrix (-> obj process skel)))
|
||||
(let* ((v1-23 (-> obj matrix))
|
||||
(a3-2 (-> s5-1 bone transform))
|
||||
(a0-21 (-> a3-2 vector 0 quad))
|
||||
(a1-14 (-> a3-2 vector 1 quad))
|
||||
(a2-6 (-> a3-2 vector 2 quad))
|
||||
(a3-3 (-> a3-2 vector 3 quad))
|
||||
)
|
||||
(set! (-> v1-23 0 vector 0 quad) a0-21)
|
||||
(set! (-> v1-23 0 vector 1 quad) a1-14)
|
||||
(set! (-> v1-23 0 vector 2 quad) a2-6)
|
||||
(set! (-> v1-23 0 vector 3 quad) a3-3)
|
||||
)
|
||||
(vector*!
|
||||
(the-as vector (-> obj transform))
|
||||
(-> s5-1 bone position)
|
||||
(-> obj process root scale)
|
||||
)
|
||||
)
|
||||
(vector-!
|
||||
(the-as vector (-> obj delta))
|
||||
(the-as vector (-> obj transform))
|
||||
(the-as vector (-> obj transform 1))
|
||||
)
|
||||
(let ((s5-2 (-> obj align scale)))
|
||||
(set! (-> s5-2 x) (vector-length (the-as vector (-> obj matrix))))
|
||||
(set! (-> s5-2 y) (vector-length (-> obj matrix 0 vector 1)))
|
||||
(set! (-> s5-2 z) (vector-length (-> obj matrix 0 vector 2)))
|
||||
(set! (-> s5-2 w) 1.0)
|
||||
)
|
||||
(vector-!
|
||||
(-> obj delta scale)
|
||||
(-> obj align scale)
|
||||
(-> obj transform 1 scale)
|
||||
)
|
||||
(let
|
||||
((a2-8
|
||||
(matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> obj align scale))
|
||||
)
|
||||
)
|
||||
(quaternion-normalize!
|
||||
(matrix->quaternion
|
||||
(-> obj align quat)
|
||||
(matrix*! a2-8 (the-as matrix (-> obj matrix)) a2-8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let
|
||||
((a1-24
|
||||
(quaternion-inverse!
|
||||
(new 'stack-no-clear 'quaternion)
|
||||
(the-as quaternion (-> obj transform 1 rot))
|
||||
)
|
||||
)
|
||||
)
|
||||
(quaternion-normalize!
|
||||
(quaternion*! (-> obj delta quat) a1-24 (-> obj align quat))
|
||||
)
|
||||
)
|
||||
(-> obj delta)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 12 of type align-control
|
||||
;; INFO: Return type mismatch (inline-array transform) vs transform.
|
||||
(defmethod first-transform align-control ((obj align-control))
|
||||
(the-as transform (-> obj transform))
|
||||
)
|
||||
|
||||
;; definition for method 13 of type align-control
|
||||
(defmethod snd-transform align-control ((obj align-control))
|
||||
(-> obj transform 1)
|
||||
)
|
||||
|
||||
;; definition for method 10 of type align-control
|
||||
(defmethod
|
||||
TODO-RENAME-10
|
||||
align-control
|
||||
((obj align-control) (arg0 int) (arg1 float) (arg2 float) (arg3 float))
|
||||
(when (zero? (logand (-> obj flags) 1))
|
||||
(let* ((a0-1 (-> obj process))
|
||||
(t9-0 (method-of-object a0-1 dummy-16))
|
||||
(v1-4 (-> obj delta))
|
||||
(t1-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(set! (-> t1-0 x) arg1)
|
||||
(set! (-> t1-0 y) arg2)
|
||||
(set! (-> t1-0 z) arg3)
|
||||
(set! (-> t1-0 w) 1.0)
|
||||
(t9-0 a0-1 arg0 (the-as (inline-array vector) v1-4) t1-0)
|
||||
)
|
||||
)
|
||||
(-> obj process root)
|
||||
)
|
||||
|
||||
;; definition for method 26 of type trsqv
|
||||
(defmethod
|
||||
TODO-RENAME-26
|
||||
trsqv
|
||||
((obj trsqv) (arg0 int) (arg1 vector) (arg2 float))
|
||||
(let ((gp-0 (-> obj transv)))
|
||||
(when (nonzero? (logand arg0 4))
|
||||
(set! (-> gp-0 x) (-> arg1 x))
|
||||
(set! (-> gp-0 z) (-> arg1 z))
|
||||
(let
|
||||
((f0-4
|
||||
(fmin (* (vector-xz-length arg1) (-> *display* frames-per-second)) arg2)
|
||||
)
|
||||
)
|
||||
(vector-xz-normalize! gp-0 f0-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for method 11 of type align-control
|
||||
;; INFO: Return type mismatch trsqv vs none.
|
||||
(defmethod
|
||||
TODO-RENAME-11
|
||||
align-control
|
||||
((obj align-control)
|
||||
(arg0 int)
|
||||
(arg1 vector)
|
||||
(arg2 int)
|
||||
(arg3 float)
|
||||
(arg4 float)
|
||||
)
|
||||
(when (zero? (logand (-> obj flags) 1))
|
||||
(let ((s5-0 (-> obj delta)))
|
||||
(let ((s3-0 (-> obj process root transv)))
|
||||
(if (nonzero? (logand arg0 2))
|
||||
(set!
|
||||
(-> s3-0 y)
|
||||
(* (* (-> s5-0 trans y) arg3) (-> *display* frames-per-second))
|
||||
)
|
||||
)
|
||||
(when (nonzero? (logand arg0 4))
|
||||
(set! (-> s3-0 x) (-> arg1 x))
|
||||
(set! (-> s3-0 z) (-> arg1 z))
|
||||
(let
|
||||
((f0-8
|
||||
(*
|
||||
(fmin
|
||||
(vector-xz-length arg1)
|
||||
(* (vector-xz-length (-> s5-0 trans)) arg4)
|
||||
)
|
||||
(-> *display* frames-per-second)
|
||||
)
|
||||
)
|
||||
(t9-2 vector-xz-normalize!)
|
||||
)
|
||||
(set! (-> obj last-speed) f0-8)
|
||||
(t9-2 s3-0 f0-8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (nonzero? (logand arg0 16))
|
||||
(quaternion-normalize!
|
||||
(quaternion*!
|
||||
(-> obj process root quat)
|
||||
(-> obj process root quat)
|
||||
(-> s5-0 quat)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(-> obj process root)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,3 +5,5 @@
|
||||
;; name in dgo: joint
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; TODO - for aligner
|
||||
(define-extern cspace<-matrix-no-push-joint! (function cspace matrix matrix))
|
||||
|
||||
@@ -303,7 +303,6 @@
|
||||
:flag-assert #x38000000b8
|
||||
(:methods
|
||||
(new (symbol type process collide-list-enum) _type_)
|
||||
(dummy-26 () none 26)
|
||||
(dummy-28 () none 28)
|
||||
(dummy-29 () none 29)
|
||||
(dummy-30 () none 30)
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
(global-y-angle-to-point (_type_ vector) float 23)
|
||||
(relative-y-angle-to-point (_type_ vector) float 24)
|
||||
(TODO-VECTOR-MATH-ISSUES-25 (_type_) float 25)
|
||||
(dummy-26 () none 26)
|
||||
(TODO-RENAME-26 (_type_ int vector float) trsqv 26)
|
||||
(get-quaternion (_type_) quaternion 27)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -3,26 +3,26 @@
|
||||
|
||||
;; definition of type align-control
|
||||
(deftype align-control (basic)
|
||||
((flags uint32 :offset-assert 4)
|
||||
(process process :offset-assert 8)
|
||||
(frame-group basic :offset-assert 12)
|
||||
(frame-num float :offset-assert 16)
|
||||
(matrix matrix 2 :inline :offset-assert 32)
|
||||
(transform transform 2 :inline :offset-assert 160)
|
||||
(delta transformq :inline :offset-assert 256)
|
||||
(last-speed float :offset-assert 304)
|
||||
(align transformq :inline :offset 160)
|
||||
((flags uint32 :offset-assert 4)
|
||||
(process process-drawable :offset-assert 8)
|
||||
(frame-group art-joint-anim :offset-assert 12)
|
||||
(frame-num float :offset-assert 16)
|
||||
(matrix matrix 2 :inline :offset-assert 32)
|
||||
(transform transform 2 :inline :offset-assert 160)
|
||||
(delta transformq :inline :offset-assert 256)
|
||||
(last-speed float :offset-assert 304)
|
||||
(align transformq :inline :offset 160)
|
||||
)
|
||||
:method-count-assert 14
|
||||
:size-assert #x134
|
||||
:flag-assert #xe00000134
|
||||
(:methods
|
||||
(new (symbol type process) _type_ :behavior process-drawable 0)
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
(dummy-11 () none 11)
|
||||
(dummy-12 () none 12)
|
||||
(dummy-13 () none 13)
|
||||
(TODO-RENAME-9 (_type_) transformq 9)
|
||||
(TODO-RENAME-10 (_type_ int float float float) trsqv 10)
|
||||
(TODO-RENAME-11 (_type_ int vector int float float) none 11)
|
||||
(first-transform (_type_) transform 12)
|
||||
(snd-transform (_type_) transform 13)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
)
|
||||
(return (the-as align-control 0))
|
||||
)
|
||||
(set! (-> obj process) arg0)
|
||||
(set! (-> obj process) (the-as process-drawable arg0))
|
||||
obj
|
||||
)
|
||||
)
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for method 9 of type align-control
|
||||
;; WARN: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)]
|
||||
;; WARN: Unsupported inline assembly instruction kind - [jr ra]
|
||||
;; Used lq/sq
|
||||
(defmethod TODO-RENAME-9 align-control ((obj align-control))
|
||||
(local-vars (a0-9 symbol) (s7-0 none) (ra-0 int))
|
||||
(with-pp
|
||||
(let ((s5-0 (-> obj process skel active-channels)))
|
||||
(dotimes (s4-0 s5-0)
|
||||
(let* ((a0-3 (-> obj process skel channel s4-0))
|
||||
(v1-5 (-> a0-3 frame-group))
|
||||
(a0-4 (-> a0-3 command))
|
||||
(a1-0 'stack)
|
||||
(a2-0 (= a0-4 a1-0))
|
||||
)
|
||||
(cond
|
||||
((or a2-0 (begin
|
||||
(set! a1-0 'stack1)
|
||||
(= a0-4 a1-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(when (!= (-> v1-5 type) art-joint-anim)
|
||||
(let
|
||||
((t9-0 (the-as (function object object object object) enter-state))
|
||||
(a0-7 "align joint-anim")
|
||||
)
|
||||
(set! (-> pp next-state) process-drawable-art-error)
|
||||
(t9-0 a0-7 (the-as none a1-0) a2-0)
|
||||
)
|
||||
(.lw ra-0 return-from-thread s7-0)
|
||||
(.jr ra-0)
|
||||
(nop!)
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let* ((a0-8 (-> obj process skel root-channel 0))
|
||||
(v1-16 (-> a0-8 frame-group))
|
||||
(f0-0 (-> a0-8 frame-num))
|
||||
)
|
||||
(= (-> a0-8 num-func) num-func-loop!)
|
||||
(cond
|
||||
((or (not v1-16) (!= (-> obj frame-group) v1-16))
|
||||
(set! a0-9 #t)
|
||||
)
|
||||
(else
|
||||
(if (= (-> a0-8 num-func) num-func-loop!)
|
||||
(set! a0-9 (< (* (-> a0-8 param 0) (- f0-0 (-> obj frame-num))) 0.0))
|
||||
(set! a0-9 (= f0-0 0.0))
|
||||
)
|
||||
)
|
||||
)
|
||||
(if a0-9
|
||||
(set! (-> obj flags) (logior (-> obj flags) 1))
|
||||
(set! (-> obj flags) (logand -2 (the-as int (-> obj flags))))
|
||||
)
|
||||
(set! (-> obj frame-group) v1-16)
|
||||
(set! (-> obj frame-num) f0-0)
|
||||
)
|
||||
(mem-copy!
|
||||
(the-as pointer (-> obj transform 1))
|
||||
(the-as pointer (-> obj transform))
|
||||
48
|
||||
)
|
||||
(quaternion-copy!
|
||||
(the-as quaternion (-> obj transform 1 rot))
|
||||
(-> obj align quat)
|
||||
)
|
||||
(set! (-> obj transform 1 scale quad) (-> obj align scale quad))
|
||||
(let* ((a2-5 (-> obj matrix 1))
|
||||
(a3-0 (-> obj matrix))
|
||||
(v1-19 (-> a3-0 0 vector 0 quad))
|
||||
(a0-18 (-> a3-0 0 vector 1 quad))
|
||||
(a1-12 (-> a3-0 0 vector 2 quad))
|
||||
(a3-1 (-> a3-0 0 vector 3 quad))
|
||||
)
|
||||
(set! (-> a2-5 vector 0 quad) v1-19)
|
||||
(set! (-> a2-5 vector 1 quad) a0-18)
|
||||
(set! (-> a2-5 vector 2 quad) a1-12)
|
||||
(set! (-> a2-5 vector 3 quad) a3-1)
|
||||
)
|
||||
(let ((s5-1 (-> obj process node-list data 1)))
|
||||
(cspace<-matrix-no-push-joint! s5-1 (the-as matrix (-> obj process skel)))
|
||||
(let* ((v1-23 (-> obj matrix))
|
||||
(a3-2 (-> s5-1 bone transform))
|
||||
(a0-21 (-> a3-2 vector 0 quad))
|
||||
(a1-14 (-> a3-2 vector 1 quad))
|
||||
(a2-6 (-> a3-2 vector 2 quad))
|
||||
(a3-3 (-> a3-2 vector 3 quad))
|
||||
)
|
||||
(set! (-> v1-23 0 vector 0 quad) a0-21)
|
||||
(set! (-> v1-23 0 vector 1 quad) a1-14)
|
||||
(set! (-> v1-23 0 vector 2 quad) a2-6)
|
||||
(set! (-> v1-23 0 vector 3 quad) a3-3)
|
||||
)
|
||||
(vector*!
|
||||
(the-as vector (-> obj transform))
|
||||
(-> s5-1 bone position)
|
||||
(-> obj process root scale)
|
||||
)
|
||||
)
|
||||
(vector-!
|
||||
(the-as vector (-> obj delta))
|
||||
(the-as vector (-> obj transform))
|
||||
(the-as vector (-> obj transform 1))
|
||||
)
|
||||
(let ((s5-2 (-> obj align scale)))
|
||||
(set! (-> s5-2 x) (vector-length (the-as vector (-> obj matrix))))
|
||||
(set! (-> s5-2 y) (vector-length (-> obj matrix 0 vector 1)))
|
||||
(set! (-> s5-2 z) (vector-length (-> obj matrix 0 vector 2)))
|
||||
(set! (-> s5-2 w) 1.0)
|
||||
)
|
||||
(vector-!
|
||||
(-> obj delta scale)
|
||||
(-> obj align scale)
|
||||
(-> obj transform 1 scale)
|
||||
)
|
||||
(let
|
||||
((a2-8
|
||||
(matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> obj align scale))
|
||||
)
|
||||
)
|
||||
(quaternion-normalize!
|
||||
(matrix->quaternion
|
||||
(-> obj align quat)
|
||||
(matrix*! a2-8 (the-as matrix (-> obj matrix)) a2-8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let
|
||||
((a1-24
|
||||
(quaternion-inverse!
|
||||
(new 'stack-no-clear 'quaternion)
|
||||
(the-as quaternion (-> obj transform 1 rot))
|
||||
)
|
||||
)
|
||||
)
|
||||
(quaternion-normalize!
|
||||
(quaternion*! (-> obj delta quat) a1-24 (-> obj align quat))
|
||||
)
|
||||
)
|
||||
(-> obj delta)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 12 of type align-control
|
||||
;; INFO: Return type mismatch (inline-array transform) vs transform.
|
||||
(defmethod first-transform align-control ((obj align-control))
|
||||
(the-as transform (-> obj transform))
|
||||
)
|
||||
|
||||
;; definition for method 13 of type align-control
|
||||
(defmethod snd-transform align-control ((obj align-control))
|
||||
(-> obj transform 1)
|
||||
)
|
||||
|
||||
;; definition for method 10 of type align-control
|
||||
(defmethod
|
||||
TODO-RENAME-10
|
||||
align-control
|
||||
((obj align-control) (arg0 int) (arg1 float) (arg2 float) (arg3 float))
|
||||
(when (zero? (logand (-> obj flags) 1))
|
||||
(let* ((a0-1 (-> obj process))
|
||||
(t9-0 (method-of-object a0-1 dummy-16))
|
||||
(v1-4 (-> obj delta))
|
||||
(t1-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(set! (-> t1-0 x) arg1)
|
||||
(set! (-> t1-0 y) arg2)
|
||||
(set! (-> t1-0 z) arg3)
|
||||
(set! (-> t1-0 w) 1.0)
|
||||
(t9-0 a0-1 arg0 (the-as (inline-array vector) v1-4) t1-0)
|
||||
)
|
||||
)
|
||||
(-> obj process root)
|
||||
)
|
||||
|
||||
;; definition for method 26 of type trsqv
|
||||
(defmethod
|
||||
TODO-RENAME-26
|
||||
trsqv
|
||||
((obj trsqv) (arg0 int) (arg1 vector) (arg2 float))
|
||||
(let ((gp-0 (-> obj transv)))
|
||||
(when (nonzero? (logand arg0 4))
|
||||
(set! (-> gp-0 x) (-> arg1 x))
|
||||
(set! (-> gp-0 z) (-> arg1 z))
|
||||
(let
|
||||
((f0-4
|
||||
(fmin (* (vector-xz-length arg1) (-> *display* frames-per-second)) arg2)
|
||||
)
|
||||
)
|
||||
(vector-xz-normalize! gp-0 f0-4)
|
||||
)
|
||||
)
|
||||
)
|
||||
obj
|
||||
)
|
||||
|
||||
;; definition for method 11 of type align-control
|
||||
;; INFO: Return type mismatch trsqv vs none.
|
||||
(defmethod
|
||||
TODO-RENAME-11
|
||||
align-control
|
||||
((obj align-control)
|
||||
(arg0 int)
|
||||
(arg1 vector)
|
||||
(arg2 int)
|
||||
(arg3 float)
|
||||
(arg4 float)
|
||||
)
|
||||
(when (zero? (logand (-> obj flags) 1))
|
||||
(let ((s5-0 (-> obj delta)))
|
||||
(let ((s3-0 (-> obj process root transv)))
|
||||
(if (nonzero? (logand arg0 2))
|
||||
(set!
|
||||
(-> s3-0 y)
|
||||
(* (* (-> s5-0 trans y) arg3) (-> *display* frames-per-second))
|
||||
)
|
||||
)
|
||||
(when (nonzero? (logand arg0 4))
|
||||
(set! (-> s3-0 x) (-> arg1 x))
|
||||
(set! (-> s3-0 z) (-> arg1 z))
|
||||
(let
|
||||
((f0-8
|
||||
(*
|
||||
(fmin
|
||||
(vector-xz-length arg1)
|
||||
(* (vector-xz-length (-> s5-0 trans)) arg4)
|
||||
)
|
||||
(-> *display* frames-per-second)
|
||||
)
|
||||
)
|
||||
(t9-2 vector-xz-normalize!)
|
||||
)
|
||||
(set! (-> obj last-speed) f0-8)
|
||||
(t9-2 s3-0 f0-8)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (nonzero? (logand arg0 16))
|
||||
(quaternion-normalize!
|
||||
(quaternion*!
|
||||
(-> obj process root quat)
|
||||
(-> obj process root quat)
|
||||
(-> s5-0 quat)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(-> obj process root)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
(global-y-angle-to-point (_type_ vector) float 23)
|
||||
(relative-y-angle-to-point (_type_ vector) float 24)
|
||||
(TODO-VECTOR-MATH-ISSUES-25 (_type_) float 25)
|
||||
(dummy-26 () none 26)
|
||||
(TODO-RENAME-26 (_type_ int vector float) trsqv 26)
|
||||
(get-quaternion (_type_) quaternion 27)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -88,11 +88,7 @@ const std::unordered_set<std::string> g_functions_expected_to_reject = {
|
||||
const std::unordered_set<std::string> g_functions_to_skip_compiling = {
|
||||
/// GCOMMON
|
||||
// these functions are not implemented by the compiler in OpenGOAL, but are in GOAL.
|
||||
"abs",
|
||||
"ash",
|
||||
"min",
|
||||
"max",
|
||||
"lognor",
|
||||
"abs", "ash", "min", "max", "lognor",
|
||||
// weird PS2 specific debug registers:
|
||||
"breakpoint-range-set!",
|
||||
// inline assembly
|
||||
@@ -106,8 +102,7 @@ const std::unordered_set<std::string> g_functions_to_skip_compiling = {
|
||||
"enter-state", // stack pointer asm
|
||||
|
||||
/// MATH
|
||||
"rand-vu-init",
|
||||
"rand-vu",
|
||||
"rand-vu-init", "rand-vu",
|
||||
"rand-vu-nostep", // random hardware
|
||||
|
||||
// trig
|
||||
@@ -127,19 +122,14 @@ const std::unordered_set<std::string> g_functions_to_skip_compiling = {
|
||||
"disasm-dma-list", // missing a single cast :(
|
||||
|
||||
// math camera
|
||||
"transform-point-vector!",
|
||||
"transform-point-qword!",
|
||||
"transform-point-vector-scale!",
|
||||
"transform-point-vector!", "transform-point-qword!", "transform-point-vector-scale!",
|
||||
|
||||
// display-h
|
||||
"put-draw-env",
|
||||
|
||||
// vector
|
||||
// bad decisions on float vs int128
|
||||
"vector-degf",
|
||||
"vector-degmod",
|
||||
"vector-deg-diff",
|
||||
"vector-degi",
|
||||
"vector-degf", "vector-degmod", "vector-deg-diff", "vector-degi",
|
||||
|
||||
// geometry
|
||||
"calculate-basis-functions-vector!", // asm requiring manual rewrite
|
||||
@@ -162,7 +152,9 @@ const std::unordered_set<std::string> g_functions_to_skip_compiling = {
|
||||
"ripple-execute",
|
||||
|
||||
"get-task-status",
|
||||
};
|
||||
|
||||
// aligner - return-from-thread, currently not supported
|
||||
"(method 9 align-control)"};
|
||||
|
||||
// default location for the data. It can be changed with a command line argument.
|
||||
std::string g_iso_data_path = "";
|
||||
|
||||
Reference in New Issue
Block a user