Files
jak-project/goal_src/jak2/pc/debug/pc-debug-methods.gc
T
ManDude 4b8b2abbed port pckernel to Jak 2 (#2248)
Adds the `pckernel` system to Jak 2, allowing you to do the PC-specific
things that Jak 1 lets you do like change game resolution, etc.

In other to reduce the amount of code duplication for something that
we're gonna be changing a lot over time, I split it into a few more code
files. In this new system, `pckernel-h.gc`, `pckernel-common.gc`
(previously `pckernel.gc`) and `pc-debug-common.gc` are the files that
should be shared across all games (I hacked the Jak 2 project to pull
these files from the Jak 1 folder), while `pckernel-impl.gc`,
`pckernel.gc` and `pc-debug-methods.gc` are their respective
game-specific counterparts that should be loaded after. I'm not fully
happy with this, I think it's slightly messy, but it cleanly separates
code that should be game-specific and not accidentally copied around and
code that should be the same for all games anyway.
2023-02-25 10:19:32 -05:00

50 lines
2.1 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
#|
Various debugging displays made for the pc port. This file includes overrides or game-specific implementations.
|#
;; debug-only file!
(declare-file (debug))
(defmethod print-debug-misc pc-settings-jak2 ((obj pc-settings-jak2))
"prints various miscellaneous debug text to the game console, according to what's enabled in this object."
(when (-> obj display-bug-report)
#f)
)
(defconstant MEM_BAR_NUM 11) ;; amount of memory usage bars (override later if wanted)
(defmethod draw-memory pc-settings-jak2 ((obj pc-settings-jak2) (buf dma-buffer))
"draw the memory heap status in the bottom right corner"
(when (-> obj display-heap-status)
(let ((idx 0)
(level-heap-colors (new 'static 'array rgba 6 (static-rgba 32 255 255 64)
(static-rgba 255 32 255 64)
(static-rgba 255 255 32 64)
(static-rgba 32 255 255 64)
(static-rgba 255 32 255 64)
(static-rgba 255 255 32 64)
)))
(draw-memory-bar-kheap buf global :idx idx :color (static-rgba 32 32 255 64))
(draw-memory-bar-kheap buf debug :idx (1+! idx) :color (static-rgba 255 32 32 64))
(dotimes (i (-> *level* length))
(if (!= (-> *level* level i status) 'inactive) (draw-memory-bar-kheap buf (-> *level* level i heap) :name (string-format "l~D" i) :idx (1+! idx) :color (-> level-heap-colors i)))
)
(draw-memory-bar-dead-pool-heap buf *nk-dead-pool* :name "actor" :idx (1+! idx) :color (static-rgba 32 255 32 64))
(draw-memory-bar-generic buf
:remain (* 16 (dma-buffer-free (-> *display* frames (-> *display* on-screen) global-buf)))
:total (length (-> *display* frames (-> *display* on-screen) global-buf))
:name "dma-global" :idx (1+! idx) :color (static-rgba 32 32 255 64))
(draw-memory-bar-generic buf
:remain (* 16 (dma-buffer-free (-> *display* frames (-> *display* on-screen) debug-buf)))
:total (length (-> *display* frames (-> *display* on-screen) debug-buf))
:name "dma-debug" :idx (1+! idx) :color (static-rgba 255 32 32 64))
)
#t)
)