;;-*-Lisp-*- (in-package goal) ;; definition for function transform-float-point ;; ERROR: Bad vector register dependency: vf1 ;; ERROR: Bad vector register dependency: vf2 ;; ERROR: Bad vector register dependency: vf3 ;; ERROR: Bad vector register dependency: vf4 ;; ERROR: Bad vector register dependency: vf6 ;; ERROR: Bad vector register dependency: vf8 ;; ERROR: Bad vector register dependency: vf9 (defun transform-float-point ((in vector) (out vector4w)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) (vf8 :class vf) (vf9 :class vf) ) (init-vf0-vector) (.lvf vf5 (&-> in quad)) (.mul.w.vf acc vf4 vf5) (.add.mul.x.vf acc vf1 vf5 acc) (.add.mul.y.vf acc vf2 vf5 acc) (.add.mul.z.vf vf5 vf3 vf5 acc) (.div.vf Q vf9 vf5 :fsf #b0 :ftf #b11) (.wait.vf) (.mul.vf.xyz vf5 vf5 Q) (.add.vf vf5 vf5 vf8) (.max.x.vf.w vf5 vf5 vf0) (.min.x.vf.w vf5 vf5 vf6) (vftoi4.xyzw vf5 vf5) (.svf (&-> out quad) vf5) out ) ) ;; definition (debug) for function add-debug-point ;; INFO: Used lq/sq (defun-debug add-debug-point ((enable-draw symbol) (bucket bucket-id) (pt vector)) (if (not enable-draw) (return #f) ) (let ((s5-0 (new 'stack 'vector4w-2)) (pt-copy (new 'stack-no-clear 'vector)) ) (set! (-> pt-copy quad) (-> pt quad)) (set! (-> pt-copy w) 1.0) (when (transform-point-qword! (-> s5-0 vector 0) pt-copy) (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) bucket ) (let ((a0-5 (the-as (pointer uint64) (-> buf base)))) (let* ((a1-3 buf) (a3-0 (the-as dma-packet (-> a1-3 base))) ) (set! (-> a3-0 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) (set! (-> a3-0 vif0) (new 'static 'vif-tag)) (set! (-> a3-0 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) (set! (-> a1-3 base) (&+ (the-as pointer a3-0) 16)) ) (let* ((a1-4 buf) (a3-2 (the-as gs-gif-tag (-> a1-4 base))) ) (set! (-> a3-2 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :pre #x1 :prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe #x1) :nreg #x8 ) ) (set! (-> a3-2 regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id rgbaq) :regs1 (gif-reg-id xyzf2) :regs2 (gif-reg-id rgbaq) :regs3 (gif-reg-id xyzf2) :regs4 (gif-reg-id rgbaq) :regs5 (gif-reg-id xyzf2) :regs6 (gif-reg-id rgbaq) :regs7 (gif-reg-id xyzf2) ) ) (set! (-> a1-4 base) (&+ (the-as pointer a3-2) 16)) ) (set! (-> s5-0 vector 1 x) 255) (set! (-> s5-0 vector 1 y) 128) (set! (-> s5-0 vector 1 z) 128) (set! (-> s5-0 vector 1 w) 128) (+! (-> s5-0 vector 0 y) 288) (let* ((a1-11 buf) (a3-4 (the-as vector4w-2 (-> a1-11 base))) ) (set! (-> a3-4 vector 0 quad) (-> s5-0 vector 1 quad)) (set! (-> a3-4 vector 1 quad) (-> s5-0 vector 0 quad)) (set! (-> a1-11 base) (&+ (the-as pointer a3-4) 32)) ) (+! (-> s5-0 vector 0 x) -256) (+! (-> s5-0 vector 0 y) -288) (set! (-> s5-0 vector 1 x) 128) (set! (-> s5-0 vector 1 y) 255) (let* ((a1-18 buf) (a3-6 (the-as vector4w-2 (-> a1-18 base))) ) (set! (-> a3-6 vector 0 quad) (-> s5-0 vector 1 quad)) (set! (-> a3-6 vector 1 quad) (-> s5-0 vector 0 quad)) (set! (-> a1-18 base) (&+ (the-as pointer a3-6) 32)) ) (+! (-> s5-0 vector 0 x) 512) (set! (-> s5-0 vector 1 y) 128) (set! (-> s5-0 vector 1 z) 255) (let* ((a1-23 buf) (a3-8 (the-as vector4w-2 (-> a1-23 base))) ) (set! (-> a3-8 vector 0 quad) (-> s5-0 vector 1 quad)) (set! (-> a3-8 vector 1 quad) (-> s5-0 vector 0 quad)) (set! (-> a1-23 base) (&+ (the-as pointer a3-8) 32)) ) (+! (-> s5-0 vector 0 x) -256) (+! (-> s5-0 vector 0 y) -288) (set! (-> s5-0 vector 1 x) 255) (set! (-> s5-0 vector 1 y) 128) (let* ((a3-10 buf) (a1-30 (the-as vector4w-2 (-> a3-10 base))) ) (set! (-> a1-30 vector 0 quad) (-> s5-0 vector 1 quad)) (set! (-> a1-30 vector 1 quad) (-> s5-0 vector 0 quad)) (set! (-> a3-10 base) (&+ (the-as pointer a1-30) 32)) ) (let ((a3-14 (/ (the-as int (+ (- -16 (the-as int a0-5)) (the-as int (-> buf base)))) 16))) (cond ((nonzero? a3-14) (logior! (-> a0-5 0) (shr (shl a3-14 48) 48)) (logior! (-> a0-5 1) (shl (shr (shl a3-14 48) 48) 32)) ) (else (set! (-> buf base) a0-5) ) ) ) ) ) ) ) #f ) ;; definition (debug) for function debug-line-clip? ;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition (debug) for function internal-draw-debug-line ;; INFO: Used lq/sq (defun-debug internal-draw-debug-line ((bucket bucket-id) (start vector) (end vector) (start-color rgba) (mode symbol) (end-color rgba)) (local-vars (var-end vector) (sv-128 vector) (sv-144 vector)) (set! var-end end) (let ((var-start-color start-color) (var-mode mode) (var-end-color end-color) ) (let ((buf (-> *display* frames (-> *display* on-screen) debug-buf))) (if (< (the-as uint (shr (+ (&- (-> buf end) (the-as uint (-> buf base))) 15) 4)) (the-as uint #x8000)) (return (the-as pointer #f)) ) ) (if (or (= var-end-color -1) (= var-end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #xff))) (set! var-end-color var-start-color) ) (case var-mode (('fade) (set! var-end-color (new 'static 'rgba :r (shr (-> var-end-color r) 1) :g (shr (-> var-end-color g) 1) :b (shr (-> var-end-color b) 1) :a (-> var-end-color a) ) ) ) ) (let ((s4-0 (new 'stack 'vector4w-2)) (s3-0 (new 'stack 'vector4w-2)) ) (set! sv-128 (new 'stack-no-clear 'vector)) (set! sv-144 (new 'stack-no-clear 'vector)) (when (debug-line-clip? sv-128 sv-144 start var-end) (set! (-> sv-128 w) 1.0) (set! (-> sv-144 w) 1.0) (when (and (transform-point-qword! (-> s4-0 vector 0) sv-128) (transform-point-qword! (-> s4-0 vector 1) sv-144)) (with-dma-buffer-add-bucket ((buf2 (-> *display* frames (-> *display* on-screen) debug-buf)) bucket ) (let ((a0-28 (the-as (pointer uint64) (-> buf2 base)))) (let* ((a1-6 buf2) (pkt1 (the-as dma-packet (-> a1-6 base))) ) (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) (set! (-> pkt1 vif0) (new 'static 'vif-tag)) (set! (-> pkt1 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) (set! (-> a1-6 base) (&+ (the-as pointer pkt1) 16)) ) (let* ((a1-7 buf2) (giftag (the-as gs-gif-tag (-> a1-7 base))) ) (set! (-> giftag tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :pre #x1 :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) :nreg #x4 ) ) (set! (-> giftag regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id rgbaq) :regs1 (gif-reg-id xyzf2) :regs2 (gif-reg-id rgbaq) :regs3 (gif-reg-id xyzf2) ) ) (set! (-> a1-7 base) (&+ (the-as pointer giftag) 16)) ) (case var-mode (('fade-depth) (let ((f0-3 (fmax 0.2 (fmin 1.0 (* 0.00000005960465 (the float (-> s4-0 vector 0 z))))))) (set! (-> s3-0 vector 0 x) (the int (* (the float (-> var-start-color r)) f0-3))) (set! (-> s3-0 vector 0 y) (the int (* (the float (-> var-start-color g)) f0-3))) (set! (-> s3-0 vector 0 z) (the int (* (the float (-> var-start-color b)) f0-3))) ) (set! (-> s3-0 vector 0 w) (the-as int (-> var-start-color a))) ) (else (set! (-> s3-0 vector 0 x) (the-as int (-> var-start-color r))) (set! (-> s3-0 vector 0 y) (the-as int (-> var-start-color g))) (set! (-> s3-0 vector 0 z) (the-as int (-> var-start-color b))) (set! (-> s3-0 vector 0 w) (the-as int (-> var-start-color a))) ) ) (cond ((= var-mode 'fade-depth) (let ((f0-7 (fmax 0.2 (fmin 1.0 (* 0.00000005960465 (the float (-> s4-0 vector 1 z))))))) (set! (-> s3-0 vector 1 x) (the int (* (the float (-> var-end-color r)) f0-7))) (set! (-> s3-0 vector 1 y) (the int (* (the float (-> var-end-color g)) f0-7))) (set! (-> s3-0 vector 1 z) (the int (* (the float (-> var-end-color b)) f0-7))) ) (set! (-> s3-0 vector 1 w) (the-as int (-> var-end-color a))) ) (else (set! (-> s3-0 vector 1 x) (the-as int (-> var-end-color r))) (set! (-> s3-0 vector 1 y) (the-as int (-> var-end-color g))) (set! (-> s3-0 vector 1 z) (the-as int (-> var-end-color b))) (set! (-> s3-0 vector 1 w) (the-as int (-> var-end-color a))) ) ) (+! (-> s4-0 vector 0 z) -8192) (+! (-> s4-0 vector 1 z) -8192) (let* ((a3-7 buf2) (a1-50 (the-as (inline-array vector4w-2) (-> a3-7 base))) ) (set! (-> a1-50 0 vector 0 quad) (-> s3-0 vector 0 quad)) (set! (-> a1-50 0 vector 1 quad) (-> s4-0 vector 0 quad)) (set! (-> a1-50 1 vector 0 quad) (-> s3-0 vector 1 quad)) (set! (-> a1-50 1 vector 1 quad) (-> s4-0 vector 1 quad)) (set! (-> a3-7 base) (&+ (the-as pointer a1-50) 64)) ) (let ((a3-11 (/ (the-as int (+ (- -16 (the-as int a0-28)) (the-as int (-> buf2 base)))) 16))) (cond ((nonzero? a3-11) (logior! (-> a0-28 0) (shr (shl a3-11 48) 48)) (logior! (-> a0-28 1) (shl (shr (shl a3-11 48) 48) 32)) ) (else (set! (-> buf2 base) a0-28) ) ) ) ) ) ) ) ) ) ) ;; definition (debug) for function internal-draw-debug-text-3d ;; INFO: Used lq/sq (defun-debug internal-draw-debug-text-3d ((bucket bucket-id) (text string) (position vector) (color font-color) (screen-offset vector2h)) (let ((screen-pos (new 'stack-no-clear 'vector4w))) (set! (-> screen-pos quad) (the-as uint128 0)) (when (transform-point-qword! screen-pos position) (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) bucket ) (let ((font-ctx (new 'stack 'font-context *font-default-matrix* (+ (-> screen-offset x) -1792 (/ (-> screen-pos x) 16)) (+ (-> screen-offset y) -1855 (/ (-> screen-pos y) 16)) 0.0 color (font-flags shadow kerning) ) ) ) (let ((v1-10 font-ctx)) (set! (-> v1-10 origin z) (the float (/ (-> screen-pos z) 16))) ) (draw-string text buf font-ctx) ) ) ) ) ) ;; definition (debug) for function add-debug-outline-triangle (defun-debug add-debug-outline-triangle ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) (when enable (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (add-debug-line #t bucket p1 p2 color #f (the-as rgba -1)) (add-debug-line #t bucket p2 p0 color #f (the-as rgba -1)) ) #f ) ;; definition (debug) for function add-debug-triangle-normal (defun-debug add-debug-triangle-normal ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) (when enable (let ((s4-0 (new 'stack-no-clear 'vector)) (s3-0 (vector-3pt-cross! (new 'stack-no-clear 'vector) p0 p1 p2)) ) (vector-float/! s3-0 s3-0 (* 0.00024414062 (vector-length s3-0))) (vector+! s4-0 p0 p1) (vector+! s4-0 s4-0 p2) (vector-float/! s4-0 s4-0 3.0) (vector+! s3-0 s3-0 s4-0) (add-debug-line #t bucket s4-0 s3-0 color #f (the-as rgba -1)) ) ) #f ) ;; definition (debug) for function add-debug-flat-triangle ;; INFO: Used lq/sq (defun-debug add-debug-flat-triangle ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) (local-vars (sv-160 vector) (sv-176 vector)) (set! sv-160 p0) (set! sv-176 p1) (let ((s0-0 p2) (s3-0 color) ) (if (not enable) (return #f) ) (let ((s5-0 (new 'stack 'vector4w-3)) (s4-0 (new 'stack 'vector4w-3)) (a1-3 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) ) (set! (-> a1-3 quad) (-> sv-160 quad)) (set! (-> s2-0 quad) (-> sv-176 quad)) (set! (-> s1-0 quad) (-> s0-0 quad)) (set! (-> a1-3 w) 1.0) (set! (-> s2-0 w) 1.0) (set! (-> s1-0 w) 1.0) (when (and (transform-point-qword! (-> s5-0 vector 0) a1-3) (transform-point-qword! (-> s5-0 vector 1) s2-0) (transform-point-qword! (-> s5-0 vector 2) s1-0) ) (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) bucket ) (let ((a0-12 (the-as (pointer uint64) (-> buf base)))) (let* ((a1-6 buf) (pkt1 (the-as dma-packet (-> a1-6 base))) ) (set! (-> pkt1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) (set! (-> pkt1 vif0) (new 'static 'vif-tag)) (set! (-> pkt1 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) (set! (-> a1-6 base) (&+ (the-as pointer pkt1) 16)) ) (let* ((a1-7 buf) (giftag (the-as gs-gif-tag (-> a1-7 base))) ) (set! (-> giftag tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :pre #x1 :prim (new 'static 'gs-prim :prim (gs-prim-type tri) :iip #x1 :abe #x1) :nreg #x6 ) ) (set! (-> giftag regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id rgbaq) :regs1 (gif-reg-id xyzf2) :regs2 (gif-reg-id rgbaq) :regs3 (gif-reg-id xyzf2) :regs4 (gif-reg-id rgbaq) :regs5 (gif-reg-id xyzf2) ) ) (set! (-> a1-7 base) (&+ (the-as pointer giftag) 16)) ) (set! (-> s4-0 vector 0 x) (the-as int (-> s3-0 r))) (set! (-> s4-0 vector 0 y) (the-as int (-> s3-0 g))) (set! (-> s4-0 vector 0 z) (the-as int (-> s3-0 b))) (set! (-> s4-0 vector 0 w) (the-as int (-> s3-0 a))) (+! (-> s5-0 vector 0 z) -8192) (+! (-> s5-0 vector 1 z) -8192) (+! (-> s5-0 vector 2 z) -8192) (let* ((a1-21 buf) (a3-5 (the-as (inline-array vector) (-> a1-21 base))) ) (set! (-> a3-5 0 quad) (-> s4-0 vector 0 quad)) (set! (-> a3-5 1 quad) (-> s5-0 vector 0 quad)) (set! (-> a3-5 2 quad) (-> s4-0 vector 0 quad)) (set! (-> a3-5 3 quad) (-> s5-0 vector 1 quad)) (set! (-> a3-5 4 quad) (-> s4-0 vector 0 quad)) (set! (-> a3-5 5 quad) (-> s5-0 vector 2 quad)) (set! (-> a1-21 base) (&+ (the-as pointer a3-5) 96)) ) (let ((a1-25 (/ (the-as int (+ (- -16 (the-as int a0-12)) (the-as int (-> buf base)))) 16))) (cond ((nonzero? a1-25) (logior! (-> a0-12 0) (shr (shl a1-25 48) 48)) (logior! (-> a0-12 1) (shl (shr (shl a1-25 48) 48) 32)) ) (else (set! (-> buf base) a0-12) ) ) ) ) ) ) ) ) #f ) ;; this part is debug only (when *debug-segment* ;; definition of type debug-line (deftype debug-line (structure) ((flags int32) (bucket bucket-id) (v1 vector :inline) (v2 vector :inline) (color rgba) (mode symbol) (color2 rgba) ) ) ;; definition for method 3 of type debug-line (defmethod inspect ((this debug-line)) (when (not this) (set! this this) (goto cfg-4) ) (format #t "[~8x] ~A~%" this 'debug-line) (format #t "~1Tflags: ~D~%" (-> this flags)) (format #t "~1Tbucket: ~D~%" (-> this bucket)) (format #t "~1Tv1: #~%" (-> this v1)) (format #t "~1Tv2: #~%" (-> this v2)) (format #t "~1Tcolor: ~D~%" (-> this color)) (format #t "~1Tmode: ~A~%" (-> this mode)) (format #t "~1Tcolor2: ~D~%" (-> this color2)) (label cfg-4) this ) ;; definition of type debug-text-3d (deftype debug-text-3d (structure) ((flags int32) (bucket bucket-id) (pos vector :inline) (color font-color) (offset vector2h :inline) (str string) ) ) ;; definition for method 3 of type debug-text-3d (defmethod inspect ((this debug-text-3d)) (when (not this) (set! this this) (goto cfg-4) ) (format #t "[~8x] ~A~%" this 'debug-text-3d) (format #t "~1Tflags: ~D~%" (-> this flags)) (format #t "~1Tbucket: ~D~%" (-> this bucket)) (format #t "~1Tpos: #~%" (-> this pos)) (format #t "~1Tcolor: ~D~%" (-> this color)) (format #t "~1Toffset: #~%" (-> this offset)) (format #t "~1Tstr: ~A~%" (-> this str)) (label cfg-4) this ) ;; definition of type debug-tracking-thang (deftype debug-tracking-thang (basic) ((length int32) (allocated-length int32) ) ) ;; definition for method 3 of type debug-tracking-thang (defmethod inspect ((this debug-tracking-thang)) (when (not this) (set! this this) (goto cfg-4) ) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~1Tlength: ~D~%" (-> this length)) (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) (label cfg-4) this ) ;; definition for symbol *debug-lines*, type (inline-array debug-line) (define *debug-lines* (the-as (inline-array debug-line) (malloc 'debug #x100000))) ;; definition for symbol *debug-lines-trk*, type debug-tracking-thang (define *debug-lines-trk* (new 'debug 'debug-tracking-thang)) ;; failed to figure out what this is: (set! (-> *debug-lines-trk* allocated-length) #x4000) ;; definition for symbol *debug-text-3ds*, type (inline-array debug-text-3d) (define *debug-text-3ds* (the-as (inline-array debug-text-3d) (malloc 'debug #x6000))) ;; definition for symbol *debug-text-3d-trk*, type debug-tracking-thang (define *debug-text-3d-trk* (new 'debug 'debug-tracking-thang)) ;; failed to figure out what this is: (set! (-> *debug-text-3d-trk* allocated-length) 512) ;; failed to figure out what this is: (dotimes (gp-0 (-> *debug-text-3d-trk* allocated-length)) (set! (-> *debug-text-3ds* gp-0 str) (new 'debug 'string 80 (the-as string #f))) ) ) ;; definition (debug) for function get-debug-line (defun-debug get-debug-line () (cond ((< (-> *debug-lines-trk* length) (-> *debug-lines-trk* allocated-length)) (+! (-> *debug-lines-trk* length) 1) (-> *debug-lines* (+ (-> *debug-lines-trk* length) -1)) ) (else (the-as debug-line #f) ) ) ) ;; definition (debug) for function get-debug-text-3d (defun-debug get-debug-text-3d () (cond ((< (-> *debug-text-3d-trk* length) (-> *debug-text-3d-trk* allocated-length)) (+! (-> *debug-text-3d-trk* length) 1) (-> *debug-text-3ds* (+ (-> *debug-text-3d-trk* length) -1)) ) (else (the-as debug-text-3d #f) ) ) ) ;; definition (debug) for function debug-reset-buffers (defun-debug debug-reset-buffers () (set! (-> *debug-lines-trk* length) 0) (set! (-> *debug-text-3d-trk* length) 0) (set! *debug-draw-pauseable* #f) #f ) ;; definition (debug) for function debug-draw-buffers (defun-debug debug-draw-buffers () (dotimes (i (-> *debug-lines-trk* length)) (let ((line (-> *debug-lines* i))) (internal-draw-debug-line (-> line bucket) (-> line v1) (-> line v2) (-> line color) (-> line mode) (-> line color2) ) ) ) (dotimes (j (-> *debug-text-3d-trk* length)) (let ((text-3d (-> *debug-text-3ds* j))) (internal-draw-debug-text-3d (-> text-3d bucket) (-> text-3d str) (-> text-3d pos) (-> text-3d color) (-> text-3d offset) ) ) ) #f ) ;; definition (debug) for function add-debug-line ;; INFO: Used lq/sq (defun-debug add-debug-line ((enable symbol) (bucket bucket-id) (start vector) (end vector) (start-color rgba) (mode symbol) (end-color rgba) ) (when enable (cond (*debug-draw-pauseable* (let ((line (get-debug-line))) (when line (set! (-> line bucket) bucket) (set! (-> line v1 quad) (-> start quad)) (set! (-> line v2 quad) (-> end quad)) (set! (-> line color) start-color) (set! (-> line color2) end-color) (set! (-> line mode) mode) ) ) ) (else (internal-draw-debug-line bucket start end start-color mode end-color) ) ) ) #f ) ;; definition (debug) for function add-debug-line2d ;; INFO: Used lq/sq (defun-debug add-debug-line2d ((enable symbol) (bucket bucket-id) (start vector4w) (end vector4w) (color vector4w)) (if (not enable) (return #f) ) (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) bucket ) (let ((p0 (new 'stack 'vector4w)) (p1 (new 'stack 'vector4w)) ) (set! (-> p0 quad) (-> start quad)) (set! (-> p1 quad) (-> end quad)) (set! (-> p0 x) (* (+ (-> p0 x) 2048) 16)) (set! (-> p0 y) (* -16 (- 2048 (-> p0 y)))) (set! (-> p0 z) #x7fffff) (set! (-> p1 x) (* (+ (-> p1 x) 2048) 16)) (set! (-> p1 y) (* -16 (- 2048 (-> p1 y)))) (set! (-> p1 z) #x7fffff) (let ((a0-18 (the-as (pointer uint64) (-> buf base)))) (let* ((a1-7 buf) (a2-3 (the-as dma-packet (-> a1-7 base))) ) (set! (-> a2-3 dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) (set! (-> a2-3 vif0) (new 'static 'vif-tag)) (set! (-> a2-3 vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1)) (set! (-> a1-7 base) (&+ (the-as pointer a2-3) 16)) ) (let* ((a1-8 buf) (giftag (the-as gs-gif-tag (-> a1-8 base))) ) (set! (-> giftag tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :pre #x1 :prim (new 'static 'gs-prim :prim (gs-prim-type line) :iip #x1 :abe #x1) :nreg #x4 ) ) (set! (-> giftag regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id rgbaq) :regs1 (gif-reg-id xyzf2) :regs2 (gif-reg-id rgbaq) :regs3 (gif-reg-id xyzf2) ) ) (set! (-> a1-8 base) (&+ (the-as pointer giftag) 16)) ) (let* ((a1-9 buf) (v0 (the-as vector4w-2 (-> a1-9 base))) ) (set! (-> v0 vector 0 quad) (-> color quad)) (set! (-> v0 vector 1 quad) (-> p0 quad)) (set! (-> a1-9 base) (&+ (the-as pointer v0) 32)) ) (let* ((a1-10 buf) (v1 (the-as vector4w-2 (-> a1-10 base))) ) (set! (-> v1 vector 0 quad) (-> color quad)) (set! (-> v1 vector 1 quad) (-> p1 quad)) (set! (-> a1-10 base) (&+ (the-as pointer v1) 32)) ) (let ((a1-14 (/ (the-as int (+ (- -16 (the-as int a0-18)) (the-as int (-> buf base)))) 16))) (cond ((nonzero? a1-14) (logior! (-> a0-18 0) (shr (shl a1-14 48) 48)) (logior! (-> a0-18 1) (shl (shr (shl a1-14 48) 48) 32)) ) (else (set! (-> buf base) a0-18) ) ) ) ) ) ) #f ) ;; definition (debug) for function add-debug-box ;; INFO: Used lq/sq (defun-debug add-debug-box ((enable symbol) (bucket bucket-id) (c1 vector) (c2 vector) (color rgba)) (let ((p0 (new-stack-vector0))) (set! (-> p0 quad) (-> c1 quad)) (let ((p1 (new-stack-vector0))) (set! (-> p1 quad) (-> c1 quad)) (when enable (set! (-> p1 x) (-> c2 x)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p1 x) (-> c1 x)) (set! (-> p1 y) (-> c2 y)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p1 y) (-> c1 y)) (set! (-> p1 z) (-> c2 z)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p0 y) (-> c2 y)) (set! (-> p1 y) (-> c2 y)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p1 z) (-> c1 z)) (set! (-> p1 x) (-> c2 x)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p1 y) (-> c1 y)) (set! (-> p0 x) (-> c2 x)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p0 quad) (-> c2 quad)) (set! (-> p1 quad) (-> c2 quad)) (set! (-> p1 x) (-> c1 x)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p1 x) (-> c2 x)) (set! (-> p1 y) (-> c1 y)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p1 y) (-> c2 y)) (set! (-> p1 z) (-> c1 z)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p0 y) (-> c1 y)) (set! (-> p1 y) (-> c1 y)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p1 z) (-> c2 z)) (set! (-> p1 x) (-> c1 x)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! (-> p1 y) (-> c2 y)) (set! (-> p0 x) (-> c1 x)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) ) ) ) #f ) ;; definition (debug) for function add-debug-box-with-transform ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs symbol. (defun-debug add-debug-box-with-transform ((enable symbol) (bucket bucket-id) (box bounding-box) (trans matrix) (color rgba)) (b! (not enable) cfg-5 :delay (nop!)) (let ((points (new 'stack-no-clear 'inline-array 'vector 8))) (let ((corners (new 'stack-no-clear 'inline-array 'vector 2)) (point (new 'stack-no-clear 'vector)) ) (set! (-> corners 0 quad) (-> box min quad)) (set! (-> corners 1 quad) (-> box max quad)) (set! (-> point w) 1.0) (dotimes (i 8) (set! (-> point x) (-> corners (logand i 1) x)) (set! (-> point y) (-> corners (logand (/ i 2) 1) y)) (set! (-> point z) (-> corners (logand (/ i 4) 1) z)) (let ((a0-5 (-> points i))) (vector-matrix*! a0-5 point trans) ) ) ) (add-debug-line #t bucket (-> points 0) (-> points 1) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 1) (-> points 3) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 3) (-> points 2) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 2) (-> points 0) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 4) (-> points 5) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 5) (-> points 7) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 7) (-> points 6) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 6) (-> points 4) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 0) (-> points 4) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 1) (-> points 5) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 3) (-> points 7) color #f (the-as rgba -1)) (add-debug-line #t bucket (-> points 2) (-> points 6) color #f (the-as rgba -1)) ) (label cfg-5) (the-as symbol 0) ) ;; definition (debug) for function add-debug-x ;; INFO: Used lq/sq (defun-debug add-debug-x ((enable symbol) (bucket bucket-id) (position vector) (color rgba)) (if (not enable) (return #f) ) (let ((p0 (new-stack-vector0)) (p1 (new-stack-vector0)) ) (vector+! p0 position (new 'static 'vector :x -1228.8)) (vector+! p1 position (new 'static 'vector :x 1228.8)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (vector+! p0 position (new 'static 'vector :z -1228.8)) (vector+! p1 position (new 'static 'vector :z 1228.8)) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) ) #f ) ;; definition (debug) for function add-debug-cross ;; INFO: Used lq/sq (defun-debug add-debug-cross ((enable symbol) (bucket bucket-id) (position vector) (radius float)) (if (not enable) (return #f) ) (let ((p0 (new-stack-vector0)) (p1 (new-stack-vector0)) ) (let ((a1-1 p0) (v1-2 position) (a0-1 (new 'stack-no-clear 'vector)) ) (set! (-> a0-1 x) (- radius)) (set! (-> a0-1 y) 0.0) (set! (-> a0-1 z) 0.0) (set! (-> a0-1 w) 1.0) (vector+! a1-1 v1-2 a0-1) ) (let ((a1-3 p1) (v1-3 position) (a0-2 (new 'stack-no-clear 'vector)) ) (set! (-> a0-2 x) radius) (set! (-> a0-2 y) 0.0) (set! (-> a0-2 z) 0.0) (set! (-> a0-2 w) 1.0) (vector+! a1-3 v1-3 a0-2) ) (add-debug-line #t bucket p0 p1 *color-red* #f (the-as rgba -1)) (let ((a1-6 p0) (v1-4 position) (a0-4 (new 'stack-no-clear 'vector)) ) (set! (-> a0-4 x) 0.0) (set! (-> a0-4 y) (- radius)) (set! (-> a0-4 z) 0.0) (set! (-> a0-4 w) 1.0) (vector+! a1-6 v1-4 a0-4) ) (let ((a1-8 p1) (v1-5 position) (a0-5 (new 'stack-no-clear 'vector)) ) (set! (-> a0-5 x) 0.0) (set! (-> a0-5 y) radius) (set! (-> a0-5 z) 0.0) (set! (-> a0-5 w) 1.0) (vector+! a1-8 v1-5 a0-5) ) (add-debug-line #t bucket p0 p1 *color-green* #f (the-as rgba -1)) (let ((a1-11 p0) (v1-6 position) (a0-7 (new 'stack-no-clear 'vector)) ) (set! (-> a0-7 x) 0.0) (set! (-> a0-7 y) 0.0) (set! (-> a0-7 z) (- radius)) (set! (-> a0-7 w) 1.0) (vector+! a1-11 v1-6 a0-7) ) (let ((a0-8 p1) (v1-7 (new 'stack-no-clear 'vector)) ) (set! (-> v1-7 x) 0.0) (set! (-> v1-7 y) 0.0) (set! (-> v1-7 z) radius) (set! (-> v1-7 w) 1.0) (vector+! a0-8 position v1-7) ) (add-debug-line #t bucket p0 p1 *color-blue* #f (the-as rgba -1)) ) #f ) ;; definition (debug) for function add-debug-text-3d ;; INFO: Used lq/sq (defun-debug add-debug-text-3d ((enable symbol) (bucket bucket-id) (text string) (position vector) (color font-color) (screen-offset vector2h) ) (when enable (cond (*debug-draw-pauseable* (let ((v1-2 (get-debug-text-3d))) (when v1-2 (set! (-> v1-2 flags) 0) (set! (-> v1-2 bucket) bucket) (set! (-> v1-2 pos quad) (-> position quad)) (cond (screen-offset (set! (-> v1-2 offset x) (-> screen-offset x)) (set! (-> v1-2 offset y) (-> screen-offset y)) ) (else (set! (-> v1-2 offset x) 0) (set! (-> v1-2 offset y) 0) 0 ) ) (set! (-> v1-2 color) color) (let ((a0-6 0) (a1-2 (-> text data)) (v1-4 (-> v1-2 str data)) ) (while (and (nonzero? (-> a1-2 0)) (< a0-6 79)) (set! (-> v1-4 0) (-> a1-2 0)) (set! a1-2 (&-> a1-2 1)) (set! v1-4 (&-> v1-4 1)) (+! a0-6 1) ) (set! (-> v1-4 0) (the-as uint 0)) ) 0 ) ) ) (else (internal-draw-debug-text-3d bucket text position color (cond (screen-offset (empty) screen-offset ) (else (new 'static 'vector2h) ) ) ) ) ) ) #f ) ;; definition (debug) for function add-debug-sphere-with-transform (defun-debug add-debug-sphere-with-transform ((enable symbol) (bucket bucket-id) (position vector) (radius meters) (trans matrix) (color rgba)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) (vf2 :class vf) (vf3 :class vf) (vf4 :class vf) (vf5 :class vf) ) (init-vf0-vector) (when enable (.lvf vf5 (&-> position quad)) (.lvf vf1 (&-> trans quad 0)) (.lvf vf2 (&-> trans quad 1)) (.lvf vf3 (&-> trans quad 2)) (.lvf vf4 (&-> trans trans quad)) (.mul.w.vf acc vf4 vf0) (.add.mul.x.vf acc vf1 vf5 acc) (.add.mul.y.vf acc vf2 vf5 acc) (.add.mul.z.vf vf5 vf3 vf5 acc) (let ((position-transformed (new 'stack-no-clear 'vector))) (.svf (&-> position-transformed quad) vf5) (add-debug-sphere enable bucket position-transformed radius color) ) ) #f ) ) ;; definition (debug) for function add-debug-sphere (defun-debug add-debug-sphere ((enable symbol) (bucket bucket-id) (position vector) (radius meters) (color rgba)) (if enable (add-debug-sphere-from-table bucket position radius color 6) ) #f ) ;; definition (debug) for function add-debug-text-sphere (defun-debug add-debug-text-sphere ((enable symbol) (bucket bucket-id) (position vector) (radius meters) (text string) (color rgba)) (add-debug-sphere enable bucket position radius color) (add-debug-text-3d enable bucket text position (font-color default) (the-as vector2h #f)) #f ) ;; definition (debug) for function add-debug-spheres (defun-debug add-debug-spheres ((enable symbol) (bucket bucket-id) (origins (inline-array vector)) (count int) (color rgba)) (when enable (let ((origin (-> origins 0))) (countdown (i count) (add-debug-sphere #t bucket origin (-> origin w) color) (&+! origin 16) ) ) ) #f ) ;; definition (debug) for function add-debug-line-sphere ;; INFO: Used lq/sq ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Return type mismatch int vs none. (defun-debug add-debug-line-sphere ((enable symbol) (bucket bucket-id) (position vector) (forward vector) (arg4 float) (color rgba)) (local-vars (var-bucket bucket-id) (var-position vector) (var-forward vector) (var-arg4 float) (var-color rgba) (mat matrix) (forward-length float) ) (b! (not enable) cfg-8 :delay (nop!)) (set! var-bucket bucket) (set! var-position position) (set! var-forward forward) (set! var-arg4 arg4) (set! var-color color) (set! mat (new 'stack-no-clear 'matrix)) (set! forward-length (vector-length var-forward)) (let ((mat-forward (new 'stack-no-clear 'vector)) (mat-down (new 'stack-no-clear 'vector)) ) (vector-normalize-copy! mat-forward var-forward 1.0) (vector-reset! mat-down) (let* ((f0-2 (-> mat-forward y)) (f0-4 (* f0-2 f0-2)) (f1-0 (-> mat-forward z)) ) (if (< f0-4 (* f1-0 f1-0)) (set! (-> mat-down y) -1.0) (set! (-> mat-down z) -1.0) ) ) (forward-down->inv-matrix mat mat-forward mat-down) ) (set! (-> mat trans quad) (-> var-position quad)) (set! (-> mat trans w) 1.0) (let ((gp-1 (new 'static 'inline-array vector 3 (new 'static 'vector :y 0.5877 :z 0.951 :w 0.951) (new 'static 'vector :x 0.5877 :z -0.5877 :w -0.951) (new 'static 'vector :x -0.951 :y -0.5878) ) ) (s5-1 (new 'static 'inline-array vector 3 (new 'static 'vector :x 1.0 :y 0.809 :z 0.3089 :w -0.3088) (new 'static 'vector :x -0.809 :y -1.0 :z -0.809 :w -0.309) (new 'static 'vector :x 0.3089 :y 0.8089) ) ) (s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) ) (set! (-> s1-0 z) 0.0) (set! (-> s1-0 w) 1.0) (set! (-> s1-0 x) (* var-arg4 (-> s5-1 2 y))) (set! (-> s1-0 y) (* var-arg4 (-> gp-1 2 y))) (vector-matrix*! s3-0 s1-0 mat) (dotimes (i 10) (set! (-> s4-0 quad) (-> s3-0 quad)) (set! (-> s1-0 x) (* var-arg4 (-> (&-> s5-1 0 data i) 0))) (set! (-> s1-0 y) (* var-arg4 (-> (&-> gp-1 0 data i) 0))) (vector-matrix*! s3-0 s1-0 mat) (add-debug-line #t var-bucket s4-0 s3-0 var-color #f (the-as rgba -1)) (vector+float*! s2-0 s3-0 (-> mat vector 2) forward-length) (add-debug-line #t var-bucket s3-0 s2-0 var-color #f (the-as rgba -1)) (vector+float*! s4-0 s4-0 (-> mat vector 2) forward-length) (add-debug-line #t var-bucket s4-0 s2-0 var-color #f (the-as rgba -1)) ) ) (label cfg-8) 0 (none) ) ;; definition (debug) for function add-debug-circle ;; INFO: Used lq/sq (defun-debug add-debug-circle ((enable symbol) (bucket bucket-id) (position vector) (radius float) (color rgba) (orientation matrix)) "note: you may pass #f for orientation" (local-vars (i int) (sv-64 vector) (sv-80 vector)) (if (not enable) (return #f) ) (let ((angle 0.0) (line-start (new-stack-vector0)) (line-end (new-stack-vector0)) ) (set! i 0) (while (< i 12) (set! sv-64 line-start) (set! (-> sv-64 x) (* radius (cos angle))) (set! (-> sv-64 y) 0.0) (set! (-> sv-64 z) (* radius (sin angle))) (set! (-> sv-64 w) 1.0) (set! angle (+ 5461.3335 angle)) (set! sv-80 line-end) (set! (-> sv-80 x) (* radius (cos angle))) (set! (-> sv-80 y) 0.0) (set! (-> sv-80 z) (* radius (sin angle))) (set! (-> sv-80 w) 1.0) (when orientation (vector-matrix*! line-start line-start orientation) (vector-matrix*! line-end line-end orientation) ) (vector+! line-start line-start position) (vector+! line-end line-end position) (add-debug-line #t bucket line-start line-end color #f (the-as rgba -1)) (set! i (+ i 1)) ) ) #f ) ;; definition (debug) for function add-debug-vector ;; INFO: Used lq/sq (defun-debug add-debug-vector ((enable symbol) (bucket bucket-id) (position vector) (direction vector) (length meters) (color rgba)) (if (not enable) (return #f) ) (let ((line-end (new-stack-vector0))) (set! (-> line-end x) (+ (-> position x) (* (-> direction x) length))) (set! (-> line-end y) (+ (-> position y) (* (-> direction y) length))) (set! (-> line-end z) (+ (-> position z) (* (-> direction z) length))) (add-debug-line #t bucket position line-end color #f (the-as rgba -1)) ) #f ) ;; definition (debug) for function add-debug-matrix (defun-debug add-debug-matrix ((enable symbol) (bucket bucket-id) (mat matrix) (line-length meters)) (add-debug-vector enable bucket (-> mat trans) (-> mat vector 0) line-length (new 'static 'rgba :r #xff :a #x80) ) (add-debug-vector enable bucket (-> mat trans) (-> mat vector 1) line-length (new 'static 'rgba :g #xff :a #x80) ) (add-debug-vector enable bucket (-> mat trans) (-> mat vector 2) line-length (new 'static 'rgba :b #xff :a #x80) ) mat ) ;; definition (debug) for function add-debug-rot-matrix (defun-debug add-debug-rot-matrix ((enable symbol) (bucket bucket-id) (mat matrix) (position vector)) (add-debug-vector enable bucket position (-> mat vector 0) (meters 2) (new 'static 'rgba :r #xff :a #x80)) (add-debug-vector enable bucket position (-> mat vector 1) (meters 2) (new 'static 'rgba :g #xff :a #x80)) (add-debug-vector enable bucket position (-> mat vector 2) (meters 2) (new 'static 'rgba :b #xff :a #x80)) mat ) ;; definition (debug) for function add-debug-quaternion ;; WARN: Return type mismatch int vs none. (defun-debug add-debug-quaternion ((enable symbol) (bucket bucket-id) (position vector) (quat quaternion)) (when enable (let ((mat (quaternion->matrix (new 'stack-no-clear 'matrix) quat))) (add-debug-rot-matrix enable bucket mat position) ) ) 0 (none) ) ;; definition (debug) for function add-debug-cspace (defun-debug add-debug-cspace ((enable symbol) (bucket bucket-id) (csp cspace)) (add-debug-matrix enable bucket (-> csp bone transform) (meters 2)) csp ) ;; definition (debug) for function add-debug-yrot-vector ;; INFO: Used lq/sq ;; WARN: Stack slot offset 32 signed mismatch ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot offset 32 signed mismatch ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 ;; WARN: Stack slot offset 32 signed mismatch ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defun-debug add-debug-yrot-vector ((enable symbol) (bucket bucket-id) (position vector) (angle float) (line-length float) (color rgba)) (local-vars (var-angle float)) (set! var-angle angle) (let ((var-line-length line-length) (var-color color) ) (if (not enable) (return #f) ) (let ((line-start (new-stack-vector0))) (set-vector! line-start (+ (-> position x) (* (sin var-angle) var-line-length)) (-> position y) (+ (-> position z) (* (cos var-angle) var-line-length)) 1.0 ) (add-debug-line enable bucket line-start position var-color #f (the-as rgba -1)) ) ) #f ) ;; definition (debug) for function add-debug-arc ;; INFO: Used lq/sq (defun-debug add-debug-arc ((enable symbol) (bucket bucket-id) (position vector) (start-angle float) (end-angle float) (radius float) (color rgba) (orientation matrix) ) "note: you may pass #f for orientation" (local-vars (line-start vector) (line-end vector) (i int) (sv-96 vector) (sv-112 vector)) (if (not enable) (return #f) ) (let ((angle start-angle)) (set! line-start (new 'stack-no-clear 'vector)) (set! (-> line-start quad) (the-as uint128 0)) (set! line-end (new 'stack-no-clear 'vector)) (set! (-> line-end quad) (the-as uint128 0)) (set! i 0) (while (< i 12) (set! sv-96 line-start) (set! (-> sv-96 x) (* radius (sin angle))) (set! (-> sv-96 y) 0.0) (set! (-> sv-96 z) (* radius (cos angle))) (set! (-> sv-96 w) 1.0) (+! angle (the float (/ (the int (- end-angle start-angle)) 12))) (set! sv-112 line-end) (set! (-> sv-112 x) (* radius (sin angle))) (set! (-> sv-112 y) 0.0) (set! (-> sv-112 z) (* radius (cos angle))) (set! (-> sv-112 w) 1.0) (when orientation (vector-matrix*! line-start line-start orientation) (vector-matrix*! line-end line-end orientation) ) (vector+! line-start line-start position) (vector+! line-end line-end position) (add-debug-line #t bucket line-start line-end color #f (the-as rgba -1)) (cond ((zero? i) (add-debug-line #t bucket line-start position color #f (the-as rgba -1)) ) ((= i 11) (add-debug-line #t bucket line-end position color #f (the-as rgba -1)) ) ) (set! i (+ i 1)) ) ) #f ) ;; definition (debug) for function add-debug-curve ;; INFO: Used lq/sq (defun-debug add-debug-curve ((enable symbol) (bucket bucket-id) (cverts (inline-array vector)) (num-cverts int) (knots (pointer float)) (num-knots int) (color rgba) ) (local-vars (p1 vector) (iterations int) (i int)) (if (not enable) (return #f) ) (let ((p0 (new-stack-vector0))) (set! p1 (new 'stack-no-clear 'vector)) (set! (-> p1 quad) (the-as uint128 0)) (set! iterations (* num-cverts 4)) (curve-evaluate! p1 (-> knots 0) cverts num-cverts knots num-knots) (set! i 0) (while (< i iterations) (set! (-> p0 quad) (-> p1 quad)) (curve-evaluate! p1 (/ (the float (+ i 1)) (the float iterations)) cverts num-cverts knots num-knots) (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) (set! i (+ i 1)) ) ) #f ) ;; definition (debug) for function add-debug-curve2 (defun-debug add-debug-curve2 ((enable symbol) (bucket bucket-id) (curve curve) (color rgba) (arg4 symbol)) (if enable (add-debug-curve #t bucket (-> curve cverts) (-> curve num-cverts) (-> curve knots) (-> curve num-knots) color ) ) #f ) ;; definition (debug) for function add-debug-points ;; INFO: Used lq/sq (defun-debug add-debug-points ((enable symbol) (bucket bucket-id) (points (inline-array vector)) (num-points int) (color rgba) (y-override float) (highlight int) ) (local-vars (sv-32 (function symbol bucket-id string vector font-color vector2h symbol)) (sv-48 symbol) (sv-64 bucket-id) (sv-80 (function _varargs_ object)) (position vector) ) (when enable (dotimes (i num-points) (set! position (new 'stack-no-clear 'vector)) (set! (-> position quad) (the-as uint128 0)) (set! (-> position quad) (-> points i quad)) (if (!= y-override 0.0) (set! (-> position y) y-override) ) (set! sv-32 add-debug-text-3d) (set! sv-48 #t) (set! sv-64 bucket) (set! sv-80 format) (let ((a0-5 (clear *temp-string*)) (a1-1 "~d") (a2-1 i) ) (sv-80 a0-5 a1-1 a2-1) ) (let ((a2-2 *temp-string*) (a3-1 position) (t0-1 1) (t1-1 #f) ) (sv-32 sv-48 sv-64 a2-2 a3-1 (the-as font-color t0-1) (the-as vector2h t1-1)) ) (let ((t9-3 add-debug-x) (a0-7 #t) (a1-3 bucket) (a3-2 (if (= i highlight) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) color ) ) ) (t9-3 a0-7 a1-3 position a3-2) ) ) ) #f ) ;; definition (debug) for function debug-percent-bar ;; INFO: Used lq/sq ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch (defun-debug debug-percent-bar ((enable symbol) (bucket bucket-id) (x int) (y int) (percentage float) (color rgba) (width int) (height int)) (local-vars (sv-16 int) (sv-32 float)) (set! sv-16 y) (set! sv-32 percentage) (let ((s2-0 color) (s1-0 width) (s3-0 height) ) (if (not enable) (return #f) ) (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) bucket ) (draw-sprite2d-xy buf x sv-16 s1-0 s3-0 (new 'static 'rgba :a #x40)) (draw-sprite2d-xy buf x (+ sv-16 2) (the int (* sv-32 (the float s1-0))) (+ s3-0 -4) s2-0) ) ) #f ) ;; definition (debug) for function debug-pad-display ;; INFO: Used lq/sq (defun-debug debug-pad-display ((pad cpad-info)) (let ((stick-history (new 'static 'inline-array vector 32 (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) (new 'static 'vector) ) ) ) (countdown (i 31) (let ((a0-3 (-> stick-history i quad))) (set! (-> stick-history (+ i 1) quad) a0-3) ) ) (set! (-> stick-history 0 x) (* (sin (-> pad stick0-dir)) (-> pad stick0-speed))) (set! (-> stick-history 0 y) (* (cos (-> pad stick0-dir)) (-> pad stick0-speed))) (dotimes (j 32) (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) debug-buf)) (bucket-id debug2) ) (draw-sprite2d-xy buf (the int (* 120.0 (-> stick-history j x))) (the int (* 144.0 (-> stick-history j y))) 10 10 (new 'static 'rgba :a #x80 :r (- 255 (* 7 j))) ) ) ) ) #f ) ;; definition (debug) for function add-debug-light ;; INFO: Used lq/sq (defun-debug add-debug-light ((enable symbol) (bucket bucket-id) (light light) (position vector) (text string)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) (vf5 :class vf) (vf6 :class vf) (vf7 :class vf) ) (init-vf0-vector) (if (not enable) (return #f) ) (when (!= (-> light extra x) 0.0) (add-debug-vector enable bucket position (-> light direction) (meters 3) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) ) (let ((sphere-pos (new-stack-vector0))) (let ((v1-3 (-> light direction))) (let ((a0-3 (* 12288.0 (-> light extra x)))) (.mov vf7 a0-3) ) (.lvf vf5 (&-> v1-3 quad)) ) (.lvf vf4 (&-> position quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> sphere-pos quad) vf6) (let ((color-rgba (logior (logior (logior (shr (shl (the int (* 128.0 (-> light color w))) 56) 32) (shr (shl (the int (* 128.0 (-> light color z))) 56) 40) ) (shr (shl (the int (* 128.0 (-> light color y))) 56) 48) ) (shr (shl (the int (* 128.0 (-> light color x))) 56) 56) ) ) ) (format (clear *temp-string*) "~S ~,,2f" text (-> light extra x)) (let ((t0-2 *temp-string*)) (add-debug-text-sphere enable bucket sphere-pos (* 2048.0 (-> light extra x)) t0-2 (the-as rgba color-rgba)) ) ) ) ) #f ) ) ;; definition (debug) for function add-debug-lights (defun-debug add-debug-lights ((enable symbol) (bucket bucket-id) (lights (inline-array light)) (position vector)) (if (not enable) (return #f) ) (add-debug-light enable bucket (-> lights 0) position "dir0") (add-debug-light enable bucket (-> lights 1) position "dir1") (add-debug-light enable bucket (-> lights 2) position "dir2") (add-debug-light enable bucket (-> lights 3) position "ambi") #f ) ;; definition (debug) for function drawable-frag-count (defun-debug drawable-frag-count ((drbl drawable)) (let ((count 0)) (cond ((not drbl) ) ((type? drbl drawable-group) (dotimes (i (-> (the-as drawable-group drbl) length)) (+! count (drawable-frag-count (-> (the-as drawable-group drbl) data i))) ) ) (else (+! count 1) ) ) count ) ) ;; definition for method 3 of type debug-vertex-stats (defmethod inspect ((this debug-vertex-stats)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tlength: ~D~%" (-> this length)) (format #t "~Tpos-count: ~D~%" (-> this pos-count)) (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this vertex)) (dotimes (s5-0 (-> this length)) (let ((s4-0 (-> this vertex s5-0))) (format #t " ~D : trans: ~D ~D ~D ~D" s5-0 (-> s4-0 trans x) (-> s4-0 trans y) (-> s4-0 trans z) (-> s4-0 trans w) ) (format #t " st: ~D ~D~%" (-> s4-0 st x) (-> s4-0 st y)) (format #t " col: ~X norm: ~D ~D ~D~%" (-> s4-0 color) (-> s4-0 normal x) (-> s4-0 normal y) (-> s4-0 normal z) ) ) ) this ) ;; definition (debug) for function history-init (defun-debug history-init ((history pos-history) (num-points int)) (set! (-> history num-points) num-points) (set! (-> history points) (the-as (inline-array vector) #f)) history ) ;; definition (debug) for function history-draw-and-update ;; INFO: Used lq/sq (defun-debug history-draw-and-update ((history pos-history) (draw symbol) (pos vector)) (if (and draw (not (-> history points))) (set! (-> history points) (the-as (inline-array vector) (malloc 'debug (* (-> history num-points) 16)))) ) (when (-> history points) (set! (-> history points (-> history h-first) quad) (-> pos quad)) (+! (-> history h-first) 1) (when (>= (-> history h-first) (-> history num-points)) (set! (-> history h-first) 0) 0 ) ) (when draw (dotimes (i (+ (-> history num-points) -1)) (if (!= (+ i 1) (-> history h-first)) (add-debug-line #t (bucket-id debug-no-zbuf1) (-> history points i) (-> history points (+ i 1)) (new 'static 'rgba :r #x80 :g #xc0 :b #x80 :a #x80) #f (the-as rgba -1) ) ) ) ) #f ) ;; definition (debug) for function dma-timeout-cam ;; INFO: Used lq/sq (defun-debug dma-timeout-cam () (let ((pos (new-stack-vector0)) (rot (new-stack-matrix0)) ) (set! (-> pos x) -666764.4) (set! (-> pos y) 21102.984) (set! (-> pos z) 51613.348) (set! (-> pos w) 1.0) (set! (-> rot vector 0 x) -0.911) (set! (-> rot vector 0 y) 0.0) (set! (-> rot vector 0 z) 0.4122) (set! (-> rot vector 0 w) 0.0) (set! (-> rot vector 1 x) -0.0984) (set! (-> rot vector 1 y) 0.971) (set! (-> rot vector 1 z) -0.2174) (set! (-> rot vector 1 w) 0.0) (set! (-> rot vector 2 x) -0.4003) (set! (-> rot vector 2 y) -0.2387) (set! (-> rot vector 2 z) -0.8847) (set! (-> rot vector 2 w) 0.0) (set! (-> rot trans x) 0.0) (set! (-> rot trans y) 0.0) (set! (-> rot trans z) 0.0) (set! (-> rot trans w) 1.0) (debug-set-camera-pos-rot! pos rot) ) ) ;; definition (debug) for function display-file-info (defun-debug display-file-info () (when (and *display-file-info* (!= *master-mode* 'menu)) (dotimes (i (-> *level* length)) (let ((level (-> *level* level i))) (when (= (-> level status) 'active) (let ((bsp (-> level bsp))) (format *stdcon* "file name: ~S~%" (-> bsp info file-name)) (format *stdcon* "version: ~D.~D~%" (-> bsp info major-version) (-> bsp info minor-version)) (format *stdcon* "maya file: ~S~%" (-> bsp info maya-file-name)) (format *stdcon* "mdb file: ~S~%" (-> bsp info mdb-file-name)) (format *stdcon* "~S" (-> bsp info tool-debug)) ) ) ) ) ) 0 ) ;; definition (debug) for function add-debug-cursor ;; INFO: Used lq/sq (defun-debug add-debug-cursor ((enable symbol) (bucket bucket-id) (x int) (y int) (arg4 mouse-buttons)) (when enable (with-dma-buffer-add-bucket ((buf (-> *display* frames (-> *display* on-screen) global-buf)) bucket ) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) (let ((v1-7 arg4)) (draw-string-xy "X" buf (+ x -5) (+ y -4) (cond ((= v1-7 (mouse-buttons left)) (font-color red) ) ((= v1-7 (mouse-buttons right)) (font-color yellow) ) ((= v1-7 (mouse-buttons middle)) (font-color green) ) (else (font-color default) ) ) (font-flags shadow) ) ) ) ) 0 ) ;; this part is debug only (when *debug-segment* ;; definition for symbol *boundary-polygon*, type (inline-array sky-vertex) (define *boundary-polygon* (the-as (inline-array sky-vertex) (malloc 'debug 768))) ) ;; definition (debug) for function init-boundary-regs ;; INFO: function output is handled by mips2c (def-mips2c init-boundary-regs (function none)) ;; definition (debug) for function add-boundary-shader ;; WARN: Return type mismatch pointer vs none. (defun-debug add-boundary-shader ((tex-id texture-id) (buf dma-buffer)) (let ((tex (lookup-texture-by-id tex-id))) (when tex (let* ((v1-0 buf) (giftag (the-as gs-gif-tag (-> v1-0 base))) ) (set! (-> giftag tag) (new 'static 'gif-tag64 :nloop #x1 :nreg #x5)) (set! (-> giftag regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d) :regs1 (gif-reg-id a+d) :regs2 (gif-reg-id a+d) :regs3 (gif-reg-id a+d) :regs4 (gif-reg-id a+d) ) ) (set! (-> v1-0 base) (&+ (the-as pointer giftag) 16)) ) (let ((shader (the-as adgif-shader (-> buf base)))) (adgif-shader<-texture-simple! shader tex) (set! (-> shader alpha) (new 'static 'gs-alpha :b #x1 :d #x1)) (set! (-> shader tex0 tfx) 0) (set! (-> shader tex1 mmag) 0) (set! (-> shader clamp) (new 'static 'gs-clamp)) ) 0 (&+! (-> buf base) 80) ) ) (none) ) ;; definition (debug) for function draw-boundary-polygon ;; INFO: function output is handled by mips2c (def-mips2c draw-boundary-polygon function) ;; definition (debug) for function render-boundary-quad ;; INFO: function output is handled by mips2c (def-mips2c render-boundary-quad function) ;; definition (debug) for function render-boundary-tri ;; INFO: function output is handled by mips2c (def-mips2c render-boundary-tri (function sky-vertex dma-buffer none)) ;; definition (debug) for function add-debug-bound-internal ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defun-debug add-debug-bound-internal ((buf dma-buffer) (pts (inline-array vector)) (num-pts int) (color0 rgba) (color1 rgba) (flip-tex int)) (rlet ((vf27 :class vf)) (set-vector! (-> *boundary-polygon* 0 col) (the float (-> color0 r)) (the float (-> color0 g)) (the float (-> color0 b)) (the float (-> color0 a)) ) (set-vector! (-> *boundary-polygon* 1 col) (the float (-> color1 r)) (the float (-> color1 g)) (the float (-> color1 b)) (the float (-> color1 a)) ) (init-boundary-regs) (.lvf vf27 (&-> *sky-work* giftag-roof quad)) (let ((s3-0 0) (s2-1 (if (nonzero? flip-tex) (new 'static 'matrix :vector (new 'static 'inline-array vector 4 (new 'static 'vector :x 1.0 :y 8.0 :z 1.0 :w 1.0) (new 'static 'vector :z 1.0 :w 1.0) (new 'static 'vector :y 8.0 :z 1.0 :w 1.0) (new 'static 'vector :x 1.0 :z 1.0 :w 1.0) ) ) (new 'static 'matrix :vector (new 'static 'inline-array vector 4 (new 'static 'vector :z 1.0 :w 1.0) (new 'static 'vector :y 8.0 :z 1.0 :w 1.0) (new 'static 'vector :x 1.0 :z 1.0 :w 1.0) (new 'static 'vector :x 1.0 :y 8.0 :z 1.0 :w 1.0) ) ) ) ) ) (while (< s3-0 (+ num-pts -2)) (cond ((not (logtest? s3-0 1)) (dotimes (v1-6 3) (set! (-> *boundary-polygon* v1-6 pos quad) (-> pts (+ s3-0 v1-6) quad)) (set! (-> *boundary-polygon* v1-6 stq quad) (-> s2-1 quad (+ s3-0 v1-6))) ) ) (else (set! (-> *boundary-polygon* 0 pos quad) (-> pts (+ s3-0 1) quad)) (set! (-> *boundary-polygon* 1 pos quad) (-> pts s3-0 quad)) (set! (-> *boundary-polygon* 2 pos quad) (-> pts (+ s3-0 2) quad)) (set! (-> *boundary-polygon* 0 stq quad) (-> s2-1 quad (+ s3-0 1))) (set! (-> *boundary-polygon* 1 stq quad) (-> s2-1 quad s3-0)) (set! (-> *boundary-polygon* 2 stq quad) (-> s2-1 quad (+ s3-0 2))) ) ) (render-boundary-tri (-> *boundary-polygon* 0) buf) (+! s3-0 1) ) ) (none) ) ) ;; definition (debug) for function add-debug-bound ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. ;; WARN: Function add-debug-bound has a return type of none, but the expression builder found a return statement. (defun-debug add-debug-bound ((buf bucket-id) (pts (inline-array vector)) (c0 int) (c1 rgba) (flash rgba) (arg5 int)) (local-vars (sv-16 pointer) (sv-32 int)) (set! sv-32 arg5) (if (< c0 3) (return 0) ) (case sv-32 ((1) (if (logtest? (-> *display* real-frame-clock integral-frame-counter) 4) (set! sv-32 1) (set! sv-32 0) ) sv-32 ) ) (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) buf ) (dma-buffer-add-gs-set s4-0 (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) :aref #x26 :zte #x1 :ztst (gs-ztest greater-equal) ) ) (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) ) (set! sv-16 (-> s4-0 base)) (&+! (-> s4-0 base) 16) (add-boundary-shader (new 'static 'texture-id :index #x3 :page #x70c) s4-0) (add-debug-bound-internal s4-0 pts c0 c1 flash sv-32) (close-sky-buffer s4-0) (let ((v1-25 (/ (the-as int (+ (- -16 (the-as int sv-16)) (the-as int (-> s4-0 base)))) 16))) (set! (-> (the-as dma-packet sv-16) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-25)) (set! (-> (the-as dma-packet sv-16) vif0) (new 'static 'vif-tag)) (set! (-> (the-as dma-packet sv-16) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1 :imm v1-25)) ) ) 0 (none) ) ;; definition (debug) for function cpu-delay ;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition (debug) for function qword-read-time ;; ERROR: function was not converted to expressions. Cannot decompile. ;; definition (debug) for function bugfix? ;; ERROR: function was not converted to expressions. Cannot decompile.