[decompiler] detect seek! and seekl! macros (#1317)

* detect `seek!` and `seekl!`

* fancy struct instead of pair mess

* fixes

* i think this was wrong?

* update refs

* update source

* More logical branching

* even better branching
This commit is contained in:
ManDude
2022-04-18 20:01:44 +01:00
committed by GitHub
parent cbc6987351
commit 66e395d547
109 changed files with 952 additions and 1398 deletions
+5 -7
View File
@@ -1201,13 +1201,11 @@
)
)
)
(set! (-> self control unknown-float80)
(seek
(-> self control unknown-float80)
f0-2
(* (-> self control unknown-float82) (-> *display* seconds-per-frame))
)
)
(seek!
(-> self control unknown-float80)
f0-2
(* (-> self control unknown-float82) (-> *display* seconds-per-frame))
)
)
(vector-deg-slerp
(-> self control dynam gravity-normal)
+15 -28
View File
@@ -396,9 +396,7 @@
:code
(behavior ()
(while #t
(set! (-> self in-out-position)
(seekl (-> self in-out-position) 0 (the int (* 350.0 (-> *display* time-adjust-ratio))))
)
(seekl! (-> self in-out-position) 0 (the int (* 350.0 (-> *display* time-adjust-ratio))))
(if (zero? (-> self in-out-position))
(go hud-normal)
)
@@ -424,12 +422,8 @@
(= (-> *progress-process* 0 next-state name) 'progress-going-out)
(= (-> *progress-process* 0 next-state name) 'progress-gone)
)
(set! (-> self in-out-position)
(seekl (-> self in-out-position) 0 (the int (* 150.0 (-> *display* time-adjust-ratio))))
)
(set! (-> self in-out-position)
(seekl (-> self in-out-position) 4096 (the int (* 200.0 (-> *display* time-adjust-ratio))))
)
(seekl! (-> self in-out-position) 0 (the int (* 150.0 (-> *display* time-adjust-ratio))))
(seekl! (-> self in-out-position) 4096 (the int (* 200.0 (-> *display* time-adjust-ratio))))
)
(suspend)
)
@@ -442,9 +436,7 @@
:code
(behavior ()
(while #t
(set! (-> self in-out-position)
(seekl (-> self in-out-position) 4096 (the int (* 350.0 (-> *display* time-adjust-ratio))))
)
(seekl! (-> self in-out-position) 4096 (the int (* 350.0 (-> *display* time-adjust-ratio))))
(if (= (-> self in-out-position) 4096)
(deactivate self)
)
@@ -2567,13 +2559,11 @@
(fmin 1.0 (* arg0 (/ (-> self control unknown-float01) (-> self control unknown-surface01 target-speed))))
)
)
(set! (-> self control unknown-float130)
(seek
(-> self control unknown-float130)
(fmax (fmin (* (+ f0-1 arg2) (fmax 0.5 (+ 0.5 (vector-dot gp-0 v1-2)))) arg3) (- arg3))
(* arg1 (-> *display* seconds-per-frame))
)
)
(seek!
(-> self control unknown-float130)
(fmax (fmin (* (+ f0-1 arg2) (fmax 0.5 (+ 0.5 (vector-dot gp-0 v1-2)))) arg3) (- arg3))
(* arg1 (-> *display* seconds-per-frame))
)
)
(let ((a2-2 (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control unknown-quaternion00))))
(forward-up-nopitch->quaternion (-> self control unknown-quaternion01) gp-0 a2-2)
@@ -2590,15 +2580,12 @@
)
(set! (-> self control unknown-float00) (fabs (-> self control unknown-float130)))
(if (= (-> self next-state name) 'target-swim-down)
(set! (-> self control unknown-float131)
(seek (-> self control unknown-float131) (the-as float -6144.0) (* 4096.0 (-> *display* seconds-per-frame)))
)
(set! (-> self control unknown-float131) (seek
(-> self control unknown-float131)
(the-as float (-> (new 'static 'array int32 1 0) 0))
(* 2048.0 (-> *display* seconds-per-frame))
)
)
(seek! (-> self control unknown-float131) (the-as float -6144.0) (* 4096.0 (-> *display* seconds-per-frame)))
(seek!
(-> self control unknown-float131)
(the-as float (-> (new 'static 'array int32 1 0) 0))
(* 2048.0 (-> *display* seconds-per-frame))
)
)
(let ((f0-20 (-> self control unknown-float131)))
(set! (-> self control unknown-vector11 y) f0-20)
+21 -30
View File
@@ -806,9 +806,7 @@
)
)
(until (ja-done? 0)
(set! (-> self control unknown-float81)
(seek (-> self control unknown-float81) (the-as float 0.0) (-> *display* seconds-per-frame))
)
(seek! (-> self control unknown-float81) (the-as float 0.0) (-> *display* seconds-per-frame))
(suspend)
(let ((a0-50 (-> self skel root-channel 0)))
(set! (-> a0-50 param 0) (the float (+ (-> a0-50 frame-group data 0 length) -1)))
@@ -2287,13 +2285,11 @@
)
(mod-var-jump #t #t (cpad-hold? (-> self control unknown-cpad-info00 number) x) (-> self control transv))
(slide-down-test)
(set! (-> self control unknown-float122)
(seek
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
)
(seek!
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
(none)
)
:code
@@ -2486,13 +2482,11 @@
(if (!= (-> self state-time) (-> *display* base-frame-counter))
(mod-var-jump #t #t (cpad-hold? (-> self control unknown-cpad-info00 number) x) (-> self control transv))
)
(set! (-> self control unknown-float122)
(seek
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
)
(seek!
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
(none)
)
:code
@@ -2620,13 +2614,11 @@
)
)
(mod-var-jump #t #t (cpad-hold? (-> self control unknown-cpad-info00 number) x) (-> self control transv))
(set! (-> self control unknown-float122)
(seek
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.00012207031 (+ -2048.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
)
(seek!
(-> self control unknown-float122)
(fmax 0.0 (fmin 1.0 (* 0.00012207031 (+ -2048.0 (-> self control unknown-float01)))))
(-> *display* seconds-per-frame)
)
(none)
)
:code
@@ -3434,12 +3426,11 @@
(go target-hit-ground #f)
)
(if (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5))
(set! (-> self control dynam gravity-length) (seek
(-> self control dynam gravity-length)
(-> self control unknown-dynamics00 gravity-length)
(* 245760.0 (-> *display* seconds-per-frame))
)
)
(seek!
(-> self control dynam gravity-length)
(-> self control unknown-dynamics00 gravity-length)
(* 245760.0 (-> *display* seconds-per-frame))
)
)
(when (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.05))
(< (vector-dot (-> self control dynam gravity-normal) (-> self control unknown-vector10))