mirror of
https://github.com/open-goal/jak-project
synced 2026-08-08 10:34:30 -04:00
6884b0f73e
Adds sprite distort, fixes buggy sprite rendering in progress, adds scissoring support (used in various scrolling menus) and a very basic implementation of `blit-displays`. This is enough to make the fade effect in the progress menu work, along with all the menus working properly without needing to use the REPL. This does not make screen flipping and the filter when failing a mission work. Added support in the decompiler for detecting `dma-buffer-add-gs-set` and `dma-buffer-add-gs-set-flusha` and updated all of the Jak 2 code to use it. Readability improved! Fixes decompiler issue with `with-dma-buffer-add-bucket` not inlining forms which broke syntax. Fixes store error warnings showing up for non-existent stores, there is now a dedicated pass for this at the end. I started work on making `BITBLTBUF` stuff work in the DirectRenderer, but stopped for now because it wasn't strictly necessary. It will still assert like before.
199 lines
8.5 KiB
Common Lisp
199 lines
8.5 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: generic-vu1.gc
|
|
;; name in dgo: generic-vu1
|
|
;; dgos: ENGINE, GAME
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(define generic-vu1-block (new 'static 'vu-function))
|
|
|
|
(defun generic-setup-constants ((arg0 generic-constants))
|
|
(let ((v1-0 *math-camera*))
|
|
(set-vector! (-> arg0 fog) (-> v1-0 pfog0) (-> v1-0 fog-min) (-> v1-0 fog-max) 3071.0)
|
|
(set! (-> arg0 adgif tag) (new 'static 'gif-tag64 :nloop #x7 :nreg #x1))
|
|
(set! (-> arg0 adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
|
(set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad))
|
|
(set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad))
|
|
(set! (-> arg0 invh-scale quad) (-> v1-0 inv-hmge-scale quad))
|
|
(set! (-> arg0 guard quad) (-> v1-0 guard quad))
|
|
)
|
|
(set! (-> arg0 flush dword 0) (the-as uint #x3f80000080808080))
|
|
(set! (-> arg0 flush dword 1) (the-as uint 1))
|
|
(none)
|
|
)
|
|
|
|
(defun generic-add-constants ((arg0 dma-buffer))
|
|
(let* ((a1-0 8)
|
|
(v1-0 arg0)
|
|
(a0-1 (the-as dma-packet (-> v1-0 base)))
|
|
)
|
|
(set! (-> a0-1 dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-0))
|
|
(set! (-> a0-1 vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
|
(set! (-> a0-1 vif1) (new 'static 'vif-tag :imm #x381 :cmd (vif-cmd unpack-v4-32) :num a1-0))
|
|
(set! (-> v1-0 base) (the-as pointer (&+ a0-1 16)))
|
|
)
|
|
(generic-setup-constants (the-as generic-constants (-> arg0 base)))
|
|
(&+! (-> arg0 base) 128)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function generic-setup-shrub-constants
|
|
;; ERROR: function has no type analysis. Cannot decompile.
|
|
|
|
;; definition for function generic-add-shrub-constants
|
|
;; ERROR: failed type prop at 20: Called a function, but we do not know its type
|
|
|
|
(defun generic-init-buf ((arg0 dma-buffer) (arg1 gs-zbuf))
|
|
(dma-buffer-add-vu-function arg0 generic-vu1-block 1)
|
|
(let* ((v1-0 arg0)
|
|
(a0-2 (the-as dma-packet (-> v1-0 base)))
|
|
)
|
|
(set! (-> a0-2 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
|
|
(set! (-> a0-2 vif0) (new 'static 'vif-tag))
|
|
(set! (-> a0-2 vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1))
|
|
(set! (-> v1-0 base) (the-as pointer (&+ a0-2 16)))
|
|
)
|
|
(let* ((v1-1 arg0)
|
|
(a0-4 (the-as gs-gif-tag (-> v1-1 base)))
|
|
)
|
|
(set! (-> a0-4 tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
|
|
(set! (-> a0-4 regs) GIF_REGS_ALL_AD)
|
|
(set! (-> v1-1 base) (the-as pointer (&+ a0-4 16)))
|
|
)
|
|
(let* ((v1-2 arg0)
|
|
(a0-6 (-> v1-2 base))
|
|
)
|
|
(set! (-> (the-as (pointer gs-zbuf) a0-6) 0) arg1)
|
|
(set! (-> (the-as (pointer gs-reg64) a0-6) 1) (gs-reg64 zbuf-1))
|
|
(set! (-> v1-2 base) (&+ a0-6 16))
|
|
)
|
|
(generic-add-constants arg0)
|
|
(let* ((v1-3 arg0)
|
|
(a0-9 (the-as dma-packet (-> v1-3 base)))
|
|
)
|
|
(set! (-> a0-9 dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
|
|
(set! (-> a0-9 vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1))
|
|
(set! (-> a0-9 vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
|
|
(set! (-> v1-3 base) (the-as pointer (&+ a0-9 16)))
|
|
)
|
|
(let ((v1-4 (-> arg0 base)))
|
|
(set! (-> (the-as (pointer uint32) v1-4) 0) (the-as uint #x3000000))
|
|
(set! (-> (the-as (pointer uint32) v1-4) 1) (the-as uint #x2000000))
|
|
(set! (-> (the-as (pointer uint32) v1-4) 2) (the-as uint 0))
|
|
(set! (-> (the-as (pointer uint32) v1-4) 3) (the-as uint #x30000000))
|
|
(set! (-> (the-as (pointer uint32) v1-4) 4) (the-as uint 0))
|
|
(set! (-> (the-as (pointer uint32) v1-4) 5) (the-as uint 0))
|
|
(set! (-> (the-as (pointer uint32) v1-4) 6) (the-as uint 0))
|
|
(set! (-> (the-as (pointer uint32) v1-4) 7) (the-as uint 0))
|
|
(set! (-> arg0 base) (&+ v1-4 32))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defun generic-vu1-init-buf ((arg0 bucket-id) (arg1 gs-zbuf))
|
|
(let ((gp-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
|
|
(when (!= gp-0 (-> gp-0 last))
|
|
(let* ((s5-0 (-> *display* frames (-> *display* on-screen) global-buf))
|
|
(s4-1 (-> s5-0 base))
|
|
)
|
|
(generic-init-buf s5-0 arg1)
|
|
(let ((v1-12 (the-as object (-> s5-0 base))))
|
|
(set! (-> (the-as dma-packet v1-12) dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> gp-0 next)))
|
|
(set! (-> (the-as dma-packet v1-12) vif0) (new 'static 'vif-tag))
|
|
(set! (-> (the-as dma-packet v1-12) vif1) (new 'static 'vif-tag))
|
|
(set! (-> s5-0 base) (the-as pointer (&+ (the-as dma-packet v1-12) 16)))
|
|
)
|
|
(set! (-> gp-0 next) (the-as uint s4-1))
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defun generic-vu1-init-buf-special ((arg0 bucket-id) (arg1 gs-zbuf))
|
|
(let ((s5-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
|
|
(when (!= s5-0 (-> s5-0 last))
|
|
(let* ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))
|
|
(s3-1 (-> s4-0 base))
|
|
)
|
|
;; this is like the normal one, but runs fx-copy-buf first, copying the framebuffer.
|
|
;(fx-copy-buf s4-0)
|
|
(generic-init-buf s4-0 arg1)
|
|
(let ((v1-12 (the-as dma-packet (-> s4-0 base))))
|
|
(set! (-> v1-12 dma) (new 'static 'dma-tag :id (dma-tag-id next) :addr (-> s5-0 next)))
|
|
(set! (-> v1-12 vif0) (new 'static 'vif-tag))
|
|
(set! (-> v1-12 vif1) (new 'static 'vif-tag))
|
|
(set! (-> s4-0 base) (the-as pointer (&+ v1-12 16)))
|
|
)
|
|
(set! (-> s5-0 next) (the-as uint s3-1))
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function generic-vu1-init-buffers
|
|
(defun generic-vu1-init-buffers ()
|
|
(when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask generic))
|
|
(let ((s5-0 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))))
|
|
(let ((gp-0 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)))
|
|
(when #t
|
|
(generic-vu1-init-buf (bucket-id gmerc-l0-tfrag) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l1-tfrag) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l2-tfrag) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l3-tfrag) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l4-tfrag) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l5-tfrag) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-lcom-tfrag) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l0-pris) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l1-pris) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l2-pris) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l3-pris) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l4-pris) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l5-pris) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-lcom-pris) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l0-shrub) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l1-shrub) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l2-shrub) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l3-shrub) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l4-shrub) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l5-shrub) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-lcom-shrub) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l0-alpha) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l1-alpha) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l2-alpha) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l3-alpha) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l4-alpha) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l5-alpha) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l0-pris2) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l1-pris2) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l2-pris2) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l3-pris2) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l4-pris2) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l5-pris2) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-lcom-pris2) s5-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l0-water) gp-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l1-water) gp-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l2-water) gp-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l3-water) gp-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l4-water) gp-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-l5-water) gp-0)
|
|
(generic-vu1-init-buf (bucket-id gmerc-lcom-water) gp-0)
|
|
)
|
|
(generic-vu1-init-buf (bucket-id effects) gp-0)
|
|
)
|
|
(generic-vu1-init-buf-special (bucket-id gmerc-warp) s5-0)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
|
|
|
|
|