Files
jak-project/goal_src/jak1/engine/debug/stats-h.gc
T
Hat Kid f4085a4362 jak1: clean up all dummy methods (#2457)
Cleans up every `dummy-*` and `TODO-RENAME-*` method up with either
proper names or by renaming them to `[type-name]-method-[method-id]`
similar to Jak 2's `all-types`.

Also fixes the bad format string in `collide-cache` and adds the event
handler hack to Jak 1.

The game boots and runs fine, but I might have missed a PAL patch or
other manual patches here and there, please double-check if possible.
2023-04-05 18:41:05 -04:00

137 lines
3.4 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: stats-h.gc
;; name in dgo: stats-h
;; dgos: GAME, ENGINE
;; DECOMP BEGINS
(deftype tr-stat (structure)
((groups uint16 :offset-assert 0)
(fragments uint16 :offset-assert 2)
(tris uint32 :offset-assert 4)
(dverts uint32 :offset-assert 8)
(instances uint16 :offset-assert 12)
(pad uint16 :offset-assert 14)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(deftype merc-global-stats (structure)
((merc tr-stat :inline :offset-assert 0)
(mercneric tr-stat :inline :offset-assert 16)
)
:method-count-assert 9
:size-assert #x20
:flag-assert #x900000020
)
(deftype perf-stat (structure)
((frame-number uint32 :offset-assert 0)
(count uint32 :offset-assert 4)
(cycles uint32 :offset-assert 8)
(instructions uint32 :offset-assert 12)
(icache uint32 :offset-assert 16)
(dcache uint32 :offset-assert 20)
(select uint32 :offset-assert 24)
(ctrl uint32 :offset-assert 28)
(accum0 uint32 :offset-assert 32)
(accum1 uint32 :offset-assert 36)
(to-vu0-waits uint32 :offset-assert 40)
(to-spr-waits uint32 :offset-assert 44)
(from-spr-waits uint32 :offset-assert 48)
)
:pack-me
:method-count-assert 14
:size-assert #x34
:flag-assert #xe00000034
(:methods
(perf-stat-method-9 (_type_) none 9)
(print-to-stream (_type_ string basic) none 10)
(reset! (_type_) none 11)
(read! (_type_) none 12)
(update-wait-stats (_type_ uint uint uint) none 13)
)
)
(deftype perf-stat-array (inline-array-class)
((data perf-stat :inline :dynamic :offset-assert 16)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(set! (-> perf-stat-array heap-base) (the-as uint 52))
(define *pc-perf-stat-counter* (the-as uint 0))
(defmethod reset! perf-stat ((obj perf-stat))
"Perfomance counters are partially implemented, they just count cycles."
(+! (-> obj count) 1)
(when (nonzero? (-> obj ctrl))
(set! *pc-perf-stat-counter* (get-cpu-clock))
)
#|
(let ((v1-0 (-> obj ctrl)))
(+! (-> obj count) 1)
(b! (zero? v1-0) cfg-2)
(.mtc0 Perf r0-0)
(.sync.l)
(.sync.p)
(.mtpc pcr0 r0-0)
(.mtpc pcr1 r0-0)
(.sync.l)
(.sync.p)
(.mtc0 Perf v1-0)
)
(.sync.l)
(.sync.p)
(label cfg-2)
|#
(none)
)
(defmethod read! perf-stat ((obj perf-stat))
"Perfomance counters are partially implemented, they just count cycles."
(when (nonzero? (-> obj ctrl))
(+! (-> obj accum0) (- (get-cpu-clock) *pc-perf-stat-counter*))
(set! (-> obj accum1) 0)
)
#|
(b! (zero? (-> obj ctrl)) cfg-2)
(.mtc0 Perf r0-0)
(.sync.l)
(.sync.p)
(.mfpc v1-1 pcr0)
(+! (-> obj accum0) (the-as uint v1-1))
(.mfpc v1-3 pcr1)
(+! (-> obj accum1) (the-as uint v1-3))
(label cfg-2)
|#
(none)
)
(defmethod update-wait-stats perf-stat ((obj perf-stat) (arg0 uint) (arg1 uint) (arg2 uint))
(when (nonzero? (-> obj ctrl))
(+! (-> obj to-vu0-waits) arg0)
(+! (-> obj to-spr-waits) arg1)
(+! (-> obj from-spr-waits) arg2)
)
0
(none)
)
(when (not *debug-segment*)
(set! (-> perf-stat method-table 11) nothing)
(set! (-> perf-stat method-table 12) nothing)
(set! (-> perf-stat method-table 13) nothing)
)