jak-project/goal_src/jak2/engine/util/capture.gc
ManDude 6884b0f73e
start blit-displays decomp & renderer + improve decompilation of some DMA macros (#2616)
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.
2023-05-04 18:34:09 -04:00

59 lines
2.2 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: capture.gc
;; name in dgo: capture
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
;; this file is debug only
(declare-file (debug))
(defun gs-set-default-store-image ((arg0 gs-store-image-packet) (arg1 int) (arg2 int) (arg3 gs-psm) (arg4 int) (arg5 int) (arg6 int) (arg7 int))
(set! (-> arg0 vifcode 0) (new 'static 'vif-tag))
(set! (-> arg0 vifcode 1) (new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd mskpath3)))
(set! (-> arg0 vifcode 2) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
(set! (-> arg0 vifcode 3) (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1))
(set! (-> arg0 giftag) (new 'static 'gif-tag :nloop #x5 :eop #x1 :nreg #x1 :regs0 (gif-reg-id a+d)))
(set! (-> arg0 bitbltbuf) (new 'static 'gs-bitbltbuf :sbp arg1 :sbw arg2 :spsm (the-as int arg3)))
(set! (-> arg0 bitbltbuf-addr) (gs-reg64 bitbltbuf))
(set! (-> arg0 trxpos) (new 'static 'gs-trxpos :ssax arg4 :ssay arg5))
(set! (-> arg0 trxpos-addr) (gs-reg64 trxpos))
(set! (-> arg0 trxreg) (new 'static 'gs-trxreg :rrw arg6 :rrh arg7))
(set! (-> arg0 trxreg-addr) (gs-reg64 trxreg))
(set! (-> arg0 finish) 0)
(set! (-> arg0 finish-addr) (gs-reg64 finish))
(set! (-> arg0 trxdir) (new 'static 'gs-trxdir :xdir #x1))
(set! (-> arg0 trxdir-addr) (gs-reg64 trxdir))
;; (.sync.l)
7
)
(defun store-image ((arg0 screen-shot-work))
(let ((gp-0 512)
(s5-0 416)
)
(let ((a3-0 (-> arg0 count))
(a2-0 (-> arg0 name))
)
(set! (-> *image-name* data 0) (the-as uint 0))
(format *image-name* "final/rawshots/~s-~d.raw" a2-0 a3-0)
)
(format 0 "writing ~s~%" *image-name*)
(let ((s4-0 (new 'stack 'file-stream *image-name* 'write)))
(let ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf data)))
(let ((s2-0 (new 'static 'gs-store-image-packet)))
(gs-set-default-store-image s2-0 #x3300 (/ gp-0 64) (gs-psm ct32) 0 0 gp-0 s5-0)
(flush-cache 0)
(gs-store-image s2-0 s3-0)
)
(sync-path 0 0)
(file-stream-write s4-0 s3-0 (the-as uint (* (* s5-0 gp-0) 4)))
)
(file-stream-close s4-0)
)
)
0
)