d/jak2: some work in memory-usage | nav-graph-h and finish pov-camera and aligner (#1901)

This commit is contained in:
Tyler Wilding
2022-09-24 14:47:03 -04:00
committed by GitHub
parent 80cefb9575
commit 123e7fd87b
35 changed files with 1670 additions and 292 deletions
+5 -5
View File
@@ -18,11 +18,11 @@
:flag-assert #xe00000134
(:methods
(new (symbol type process) _type_ 0)
(align-control-method-9 () none 9)
(align-control-method-10 () none 10)
(align-control-method-11 () none 11)
(align-control-method-12 () none 12)
(align-control-method-13 () none 13)
(compute-alignment! (_type_) transformq 9)
(align! (_type_ align-opts float float float) trsqv 10)
(align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv :behavior process 11)
(first-transform (_type_) transform 12)
(second-transform (_type_) transform 13)
)
)
+220
View File
@@ -0,0 +1,220 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for method 9 of type align-control
;; INFO: Used lq/sq
;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)]
;; ERROR: Unsupported inline assembly instruction kind - [jr ra]
(defmethod compute-alignment! align-control ((obj align-control))
(local-vars (a0-10 symbol) (s7-0 none) (ra-0 int))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
)
(init-vf0-vector)
(joint-control-method-10 (-> obj process skel))
(let ((s5-0 (-> obj process skel active-channels)))
(dotimes (s4-0 (the-as int s5-0))
(let* ((a0-4 (-> obj process skel channel s4-0))
(v1-7 (-> a0-4 frame-group))
)
(case (-> a0-4 command)
(((joint-control-command stack) (joint-control-command stack1))
)
(else
(when (!= (-> v1-7 type) art-joint-anim)
(go process-drawable-art-error "align joint-anim")
(.lw ra-0 return-from-thread s7-0)
(.jr ra-0)
(nop!)
0
)
)
)
)
)
)
(let* ((a0-9 (-> obj process skel root-channel 0))
(v1-18 (-> a0-9 frame-group))
(f0-0 (-> a0-9 frame-num))
)
(= (-> a0-9 num-func) num-func-loop!)
(cond
((or (not v1-18) (!= (-> obj frame-group) v1-18))
(set! a0-10 #t)
)
((= (-> a0-9 num-func) num-func-loop!)
(set! a0-10 (< (* (-> a0-9 param 0) (- f0-0 (-> obj frame-num))) 0.0))
)
(else
(set! a0-10 (= f0-0 0.0))
)
)
(if a0-10
(logior! (-> obj flags) (align-flags disabled))
(logclear! (-> obj flags) (align-flags disabled))
)
(set! (-> obj frame-group) v1-18)
(set! (-> obj frame-num) f0-0)
)
(mem-copy! (the-as pointer (-> obj transform 1)) (the-as pointer (-> obj transform)) 48)
(quaternion-copy! (the-as quaternion (-> obj transform 1 rot)) (-> obj align quat))
(set! (-> obj transform 1 scale quad) (-> obj align scale quad))
(let* ((a2-5 (-> obj matrix 1))
(a3-0 (-> obj matrix))
(v1-21 (-> a3-0 0 vector 0 quad))
(a0-19 (-> a3-0 0 vector 1 quad))
(a1-13 (-> a3-0 0 vector 2 quad))
(a3-1 (-> a3-0 0 trans quad))
)
(set! (-> a2-5 vector 0 quad) v1-21)
(set! (-> a2-5 vector 1 quad) a0-19)
(set! (-> a2-5 vector 2 quad) a1-13)
(set! (-> a2-5 trans quad) a3-1)
)
(let ((s5-1 (-> obj process node-list data 1)))
(cspace<-matrix-no-push-joint! s5-1 (-> obj process skel))
(let* ((v1-25 (-> obj matrix))
(a3-2 (-> s5-1 bone transform))
(a0-22 (-> a3-2 vector 0 quad))
(a1-15 (-> a3-2 vector 1 quad))
(a2-6 (-> a3-2 vector 2 quad))
(a3-3 (-> a3-2 trans quad))
)
(set! (-> v1-25 0 vector 0 quad) a0-22)
(set! (-> v1-25 0 vector 1 quad) a1-15)
(set! (-> v1-25 0 vector 2 quad) a2-6)
(set! (-> v1-25 0 trans quad) a3-3)
)
(let ((v1-26 (-> obj transform)))
(let ((a0-24 (-> s5-1 bone transform trans))
(a1-18 (-> obj process root scale))
)
(.lvf vf4 (&-> a0-24 quad))
(.lvf vf5 (&-> a1-18 quad))
)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
(.mul.vf vf6 vf4 vf5 :mask #b111)
(.svf (&-> v1-26 0 trans quad) vf6)
)
)
(vector-!
(the-as vector (-> obj delta))
(the-as vector (-> obj transform))
(the-as vector (-> obj transform 1))
)
(set-vector!
(-> obj align scale)
(vector-length (the-as vector (-> obj matrix)))
(vector-length (-> obj matrix 0 vector 1))
(vector-length (-> obj matrix 0 vector 2))
1.0
)
(vector-! (-> obj delta scale) (-> obj align scale) (-> obj transform 1 scale))
(let ((a2-7 (matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> obj align scale))))
(quaternion-normalize!
(matrix->quaternion (-> obj align quat) (matrix*! a2-7 (the-as matrix (-> obj matrix)) a2-7))
)
)
(let ((a1-27 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> obj transform 1 rot)))))
(quaternion-normalize! (quaternion*! (-> obj delta quat) a1-27 (-> obj align quat)))
)
(-> obj delta)
)
)
;; definition for method 12 of type align-control
;; WARN: Return type mismatch (inline-array transform) vs transform.
(defmethod first-transform align-control ((obj align-control))
"@returns The first of the two [[transforms]] held by the object"
(the-as transform (-> obj transform))
)
;; definition for method 13 of type align-control
(defmethod second-transform align-control ((obj align-control))
"@returns The second of the two [[transforms]] held by the object"
(-> obj transform 1)
)
;; definition for method 10 of type align-control
(defmethod align! align-control ((obj align-control) (options align-opts) (x float) (y float) (z float))
"As long as [[align-flags::0]] is not set call [[process-drawable::16]] on the process being controlled
using the arguments passed to construct a [[vector]] - <`x`, `y`, `z`, 1.0>
@returns the `root` of the [[process-drawable]] after the method returns
@see [[process-drawable::16]]"
(when (zero? (logand (-> obj flags) (align-flags disabled)))
(let* ((process (-> obj process))
(method-call (method-of-object process apply-alignment))
(transform (-> obj delta))
(data (new 'stack-no-clear 'vector))
)
(set! (-> data x) x)
(set! (-> data y) y)
(set! (-> data z) z)
(set! (-> data w) 1.0)
(method-call process options transform data)
)
)
(-> obj process root)
)
;; definition for method 26 of type trsqv
(defmethod set-and-limit-velocity trsqv ((obj trsqv) (unkBitfield int) (limit vector) (arg2 float))
"TODO - arg1 is an bitfield of some sort"
(let ((transv (-> obj transv)))
(when (logtest? unkBitfield 4)
(set! (-> transv x) (-> limit x))
(set! (-> transv z) (-> limit z))
(let* ((v1-2 limit)
(f0-8
(fmin
(* (sqrtf (+ (* (-> v1-2 x) (-> v1-2 x)) (* (-> v1-2 z) (-> v1-2 z)))) (-> self clock frames-per-second))
arg2
)
)
)
(vector-xz-normalize! transv f0-8)
)
)
)
obj
)
;; definition for method 11 of type align-control
(defmethod align-vel-and-quat-only! align-control ((obj align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float))
(when (zero? (logand (-> obj flags) (align-flags disabled)))
(let ((s5-0 (-> obj delta)))
(let ((a0-1 (-> obj process root transv)))
(if (logtest? arg0 (align-opts adjust-y-vel))
(set! (-> a0-1 y) (* (-> s5-0 trans y) arg3 (-> self clock frames-per-second)))
)
(when (logtest? arg0 (align-opts adjust-xz-vel))
(set! (-> a0-1 x) (-> arg1 x))
(set! (-> a0-1 z) (-> arg1 z))
(let* ((v1-11 arg1)
(f0-9 (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z)))))
(v1-13 (-> s5-0 trans))
(f0-11 (* (fmin f0-9 (* (sqrtf (+ (* (-> v1-13 x) (-> v1-13 x)) (* (-> v1-13 z) (-> v1-13 z)))) arg4))
(-> self clock frames-per-second)
)
)
(t9-0 vector-xz-normalize!)
)
(set! (-> obj last-speed) f0-11)
(t9-0 a0-1 f0-11)
)
)
)
(if (logtest? arg0 (align-opts adjust-quat))
(quaternion-normalize! (quaternion*! (-> obj process root quat) (-> obj process root quat) (-> s5-0 quat)))
)
)
)
(-> obj process root)
)
+9 -13
View File
@@ -5,7 +5,7 @@
(deftype pov-camera (process-drawable)
((flags pov-camera-flag :offset-assert 200)
(debounce-start-time time-frame :offset-assert 208)
(notify-handle uint64 :offset-assert 216)
(notify-handle handle :offset-assert 216)
(anim-name string :offset-assert 224)
(command-list pair :offset-assert 228)
(mask-to-clear process-mask :offset-assert 232)
@@ -17,16 +17,16 @@
:size-assert #xf4
:flag-assert #x1e008000f4
(:methods
(pov-camera-method-20 () none 20)
(pov-camera-method-21 () none 21)
(pov-camera-method-22 () none 22)
(pov-camera-method-23 () none 23)
(pov-camera-method-24 () none 24)
(pov-camera-method-25 () none 25)
(pov-camera-method-26 () none 26)
(pov-camera-abort () _type_ :state 20)
(pov-camera-done-playing () _type_ :state 21)
(pov-camera-playing () _type_ :state 22)
(pov-camera-start-playing () _type_ :state 23)
(pov-camera-startup () _type_ :state 24)
(abort? (_type_) symbol :behavior pov-camera 25)
(target-grabbed? (_type_) symbol 26)
(pov-camera-method-27 () none 27)
(pov-camera-method-28 () none 28)
(pov-camera-method-29 () none 29)
(target-released? (_type_) symbol 29)
)
)
@@ -53,7 +53,3 @@
;; failed to figure out what this is:
0
+1 -1
View File
@@ -1318,7 +1318,7 @@
)
(t9-32 a0-32 a1-32 (- (-> a2-29 data 0 end-time) (-> a2-29 data 0 start-time)))
)
(compute-memory-usage (-> *level* level0) #f)
(compute-memory-usage! (-> *level* level0) #f)
(format #t " (set! *camera-old-tfrag-bytes* ~D)~%" (+ (-> *level* level0 mem-usage-block data 1 total)
(-> *level* level0 mem-usage-block data 2 total)
(-> *level* level0 mem-usage-block data 3 total)
+2 -2
View File
@@ -42,8 +42,8 @@
:flag-assert #xc00000710
(:methods
(reset! (_type_) _type_ 9)
(memory-usage-block-method-10 () none 10)
(print-mem-usage (_type_ level object) none 11)
(calculate-total (_type_) int 10)
(print-mem-usage (_type_ level object) _type_ 11)
)
)
+1 -1
View File
@@ -67,7 +67,7 @@
:heap-size #x10000
)
(new 'static 'entity-info
:ptype (type-ref nav-graph :method-count 47)
:ptype (type-ref nav-graph :method-count 45)
:package "game"
:art-group '()
:pool '*16k-dead-pool*
+1 -1
View File
@@ -28,7 +28,7 @@
(:methods
(initialize-skeleton (_type_ skeleton-group pair) none 14)
(initialize-skeleton-by-name (_type_ string object) draw-control 15)
(process-drawable-method-16 () none 16)
(apply-alignment (_type_ align-opts transformq vector) object 16)
(process-drawable-method-17 () none 17)
(process-drawable-method-18 () none 18)
(process-drawable-method-19 () none 19)
+10
View File
@@ -126,6 +126,9 @@
;; definition of type gs-display
(deftype gs-display (uint64)
"the GS's DISPLAY registers make settings for the display position on the screen regarding
information on Rectangular Area Read Output Circuit n for the PCRTC.
write-only"
((dx uint16 :offset 0 :size 12)
(dy uint16 :offset 12 :size 11)
(magh uint8 :offset 23 :size 4)
@@ -140,6 +143,8 @@
;; definition of type gs-bgcolor
(deftype gs-bgcolor (uint64)
"the GS's BGCOLOR register sets the background color of the PCRTC with RGB value.
write-only"
((r uint8 :offset 0 :size 8)
(g uint8 :offset 8 :size 8)
(b uint8 :offset 16 :size 8)
@@ -151,6 +156,11 @@
;; definition of type gs-csr
(deftype gs-csr (uint64)
"the GS's CSR register sets and obtains various GS statuses.
read-write. the fields have different effects depending on whether they're being read from
or written to.
bits 5 and 6 (0x20 and 0x40) should be zero"
((signal uint8 :offset 0 :size 1)
(finish uint8 :offset 1 :size 1)
(hsint uint8 :offset 2 :size 1)
+147
View File
@@ -0,0 +1,147 @@
;;-*-Lisp-*-
(in-package goal)
;; definition for function set-video-mode
;; WARN: Return type mismatch int vs none.
(defun set-video-mode ((tv-format symbol))
"Set related settings to the video mode in the settings, [[*video-params*]] and the [[*video-mode*]]
`ntsc` has a [[*video-mode*]] value of `0`, where as `pal` has a value of `1`
Will also set a bunch of common settings related to profiling and the camera to finalize the switch
@param tv-format Recognizes `ntsc` and `pal`"
(case tv-format
(('ntsc)
(set! (-> *setting-control* user-default display-dx) 0)
(set! (-> *setting-control* user-default display-dy) 8)
(set! (-> *video-params* display-fbp) 164)
(set! (-> *video-params* display-sy) 224)
(set! *video-mode* 0)
(sound-set-fps 60)
)
(('pal)
(set! (-> *setting-control* user-default display-dx) 0)
(set! (-> *setting-control* user-default display-dy) 24)
(set! (-> *video-params* display-fbp) 144)
(set! (-> *video-params* display-sy) 256)
(set! *video-mode* 1)
(sound-set-fps 50)
)
)
(set-time-ratios *display* (-> *display* dog-ratio))
(set! (-> *video-params* reset-video-mode) #t)
(set! (-> *math-camera* isometric vector 1 y) 0.5)
(set! (-> *math-camera* y-clip) 416.0)
(set! (-> *math-camera* y-pix) (* 0.5 (-> *math-camera* y-clip)))
(set! *profile-y* 1848)
(set! (-> *video-params* set-video-mode) #t)
0
(none)
)
;; definition for function get-video-mode
(defun get-video-mode ()
"@returns the current video mode, for example `ntsc` or `pal`"
(-> *setting-control* user-current video-mode)
)
;; definition for function set-aspect-ratio
;; WARN: Return type mismatch int vs none.
(defun set-aspect-ratio ((aspect symbol))
"Set [[*video-params*]] aspect-ratio related settings based on the mode provided.
@param aspect Recognizes `aspect4x3` and `aspect16x9`"
(case aspect
(('aspect4x3)
(set! (-> *video-params* relative-x-scale) 1.0)
(set! (-> *video-params* relative-x-scale-reciprical) 1.0)
)
(('aspect16x9)
(set! (-> *video-params* relative-x-scale) 0.75)
(set! (-> *video-params* relative-x-scale-reciprical) 1.3333334)
)
)
0
(none)
)
;; definition for function get-aspect-ratio
(defun get-aspect-ratio ()
"@returns The current aspect ratio mode setting"
(-> *setting-control* user-current aspect-ratio)
)
;; definition for function set-progressive-scan
;; WARN: Return type mismatch int vs none.
(defun set-progressive-scan ((val symbol))
"Flip the progressive scan setting flag depending on the value provided
@param val The value to set the progressive scan flag to"
(set! (-> *setting-control* user-default use-progressive-scan) val)
0
(none)
)
;; definition for function get-progressive-scan
(defun get-progressive-scan ()
"@returns If using progressive scan is currently set in the settings"
(-> *setting-control* user-current use-progressive-scan)
)
;; definition for symbol *smode2*, type int
(define *smode2* 0)
;; definition for function set-graphics-mode
;; WARN: Return type mismatch int vs none.
(defun set-graphics-mode ()
"TODO"
(let ((settings *setting-control*)
(gs-bank (the-as gs-bank #x12000000))
(video-settings *video-params*)
)
(let ((display *display*))
(cond
((-> settings user-current use-progressive-scan)
(when (nonzero? *smode2*)
(reset-graph 0 0 80 0)
(set! *smode2* 0)
0
)
(set! (-> gs-bank display1) (new 'static 'gs-display
:magh #x1
:dw #x4ff
:dy (+ (-> video-settings display-dy) 50)
:dx (+ (* (-> video-settings display-dx) 2) 326)
:dh (+ (* (-> video-settings display-sy) 2) -1)
)
)
)
(else
(when (or (!= *smode2* 1) (-> *video-params* set-video-mode))
(if (= (-> *setting-control* user-current video-mode) 'ntsc)
(reset-graph 0 1 2 0)
(reset-graph 0 1 3 0)
)
(set! *smode2* 1)
(set! (-> *video-params* set-video-mode) #f)
)
(set! (-> gs-bank display1) (new 'static 'gs-display
:magh #x3
:dw #x9ff
:dy (+ (-> video-settings display-dy) 50)
:dx (+ (* (-> video-settings display-dx) 4) 652)
:dh (+ (* (-> video-settings display-sy) 2) -1)
)
)
)
)
(set! (-> gs-bank pmode) (-> display pmode))
(set! (-> gs-bank bgcolor) (the-as gs-bgcolor (-> display bgcolor)))
)
(set! (-> gs-bank dspfb1) (new 'static 'gs-display-fb :fbw #xa :fbp (-> video-settings display-fbp)))
)
0
(none)
)
+1 -1
View File
@@ -477,7 +477,7 @@
(level-method-11 () none 11)
(unload! (_type_) _type_ 12)
(bsp-name (_type_) symbol 13)
(compute-memory-usage (_type_ object) memory-usage-block 14)
(compute-memory-usage! (_type_ symbol) memory-usage-block 14)
(inside-boxes-check (_type_ vector) symbol 15)
(level-method-16 () none 16)
(load-continue (_type_) _type_ 17)
+3 -3
View File
@@ -18,7 +18,7 @@
;; definition for function quaternion-axis-angle!
(defun quaternion-axis-angle! ((arg0 quaternion) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(sincos! (the-as (pointer float) s5-0) (* 0.5 arg4))
(sincos! s5-0 (* 0.5 arg4))
(let ((f0-2 (-> s5-0 x)))
(set! (-> arg0 x) (* arg1 f0-2))
(set! (-> arg0 y) (* arg2 f0-2))
@@ -32,7 +32,7 @@
;; definition for function quaternion-vector-angle!
(defun quaternion-vector-angle! ((arg0 quaternion) (arg1 vector) (arg2 float))
(let ((s5-0 (new 'stack-no-clear 'vector)))
(sincos! (the-as (pointer float) s5-0) (* 0.5 arg2))
(sincos! s5-0 (* 0.5 arg2))
(let ((f0-2 (-> s5-0 x)))
(set! (-> arg0 x) (* (-> arg1 x) f0-2))
(set! (-> arg0 y) (* (-> arg1 y) f0-2))
@@ -604,7 +604,7 @@
)
(else
(let ((s5-0 (new 'stack-no-clear 'vector)))
(sincos-rad! (the-as (pointer float) s5-0) f30-0)
(sincos-rad! s5-0 f30-0)
(let ((f0-6 (/ (-> s5-0 x) f30-0)))
(set! (-> arg0 x) (* (-> arg1 x) f0-6))
(set! (-> arg0 y) (* (-> arg1 y) f0-6))
+1 -5
View File
@@ -81,7 +81,7 @@
(global-y-angle-to-point (_type_ vector) float 23)
(relative-y-angle-to-point (_type_ vector) float 24)
(roll-relative-to-gravity (_type_) float 25)
(set-and-limit-velocity (_type_ int vector float) trsqv 26)
(set-and-limit-velocity (_type_ int vector float) trsqv :behavior process 26)
(get-quaternion (_type_) quaternion 27)
)
)
@@ -121,7 +121,3 @@
;; failed to figure out what this is:
0
+338
View File
@@ -0,0 +1,338 @@
;;-*-Lisp-*-
(in-package goal)
;; definition of type nav-branch
(deftype nav-branch (structure)
((node nav-node 2 :offset-assert 0)
(src-node nav-node :offset 0)
(dest-node nav-node :offset 4)
(temp-dest-node-id int32 :offset 4)
(speed-limit uint8 :offset-assert 8)
(density uint8 :offset-assert 9)
(clock-type uint8 :offset-assert 10)
(clock-mask uint8 :offset-assert 11)
(max-user-count uint8 :offset-assert 12)
(user-count uint8 :offset-assert 13)
(width uint8 :offset-assert 14)
(flags uint8 :offset-assert 15)
)
:method-count-assert 21
:size-assert #x10
:flag-assert #x1500000010
(:methods
(nav-branch-method-9 () none 9)
(nav-branch-method-10 () none 10)
(nav-branch-method-11 (_type_) float 11)
(nav-branch-method-12 (_type_) float 12)
(nav-branch-method-13 (_type_) float 13)
(user-limit-reached? (_type_) symbol 14)
(nav-branch-method-15 (_type_) symbol 15)
(nav-branch-method-16 () none 16)
(nav-branch-method-17 () none 17)
(nav-branch-method-18 () none 18)
(nav-branch-method-19 () none 19)
(nav-branch-method-20 () none 20)
)
)
;; definition for method 3 of type nav-branch
(defmethod inspect nav-branch ((obj nav-branch))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'nav-branch)
(format #t "~1Tnode[2] @ #x~X~%" (-> obj node))
(format #t "~1Tsrc-node: ~A~%" (-> obj src-node))
(format #t "~1Tdest-node: ~A~%" (-> obj dest-node))
(format #t "~1Ttemp-dest-node-id: ~D~%" (-> obj dest-node))
(format #t "~1Tspeed-limit: ~D~%" (-> obj speed-limit))
(format #t "~1Tdensity: ~D~%" (-> obj density))
(format #t "~1Tclock-type: ~D~%" (-> obj clock-type))
(format #t "~1Tclock-mask: ~D~%" (-> obj clock-mask))
(format #t "~1Tmax-user-count: ~D~%" (-> obj max-user-count))
(format #t "~1Tuser-count: ~D~%" (-> obj user-count))
(format #t "~1Twidth: ~D~%" (-> obj width))
(format #t "~1Tflags: ~D~%" (-> obj flags))
(label cfg-4)
obj
)
;; definition of type nav-node
(deftype nav-node (structure)
((data uint32 8 :offset-assert 0)
(position vector :inline :offset 0)
(pos-x float :offset 0)
(pos-y float :offset 4)
(pos-z float :offset 8)
(angle uint16 :offset 12)
(id uint16 :offset 14)
(radius uint8 :offset 16)
(branch-count int8 :offset 17)
(flags nav-node-flag-byte :offset 18)
(pad0 int8 1 :offset 19)
(branch-array uint32 :offset 20)
(nav-mesh-id uint32 :offset 24)
(level level :offset 28)
)
:method-count-assert 22
:size-assert #x20
:flag-assert #x1600000020
(:methods
(nav-node-method-9 () none 9)
(nav-node-method-10 () none 10)
(nav-node-method-11 () none 11)
(nav-node-method-12 () none 12)
(nav-node-method-13 () none 13)
(nav-node-method-14 () none 14)
(nav-node-method-15 () none 15)
(nav-node-method-16 () none 16)
(nav-node-method-17 () none 17)
(get-position (_type_ vector) vector 18)
(calc-sine-and-cosine! (_type_ vector) vector 19)
(get-angle (_type_) float 20)
(nav-node-method-21 (_type_) float 21)
)
)
;; definition for method 3 of type nav-node
(defmethod inspect nav-node ((obj nav-node))
(when (not obj)
(set! obj obj)
(goto cfg-14)
)
(format #t "[~8x] ~A~%" obj 'nav-node)
(format #t "~1Tdata[32] @ #x~X~%" (-> obj position))
(format #t "~1Tposition: ~`vector`P~%" (-> obj position))
(format #t "~1Tpos-x: ~f~%" (-> obj position x))
(format #t "~1Tpos-y: ~f~%" (-> obj position y))
(format #t "~1Tpos-z: ~f~%" (-> obj position z))
(format #t "~1Tangle: ~D~%" (-> obj angle))
(format #t "~1Tid: ~D~%" (-> obj id))
(format #t "~1Tradius: ~D~%" (-> obj radius))
(format #t "~1Tbranch-count: ~D~%" (-> obj branch-count))
(format #t "~1Tflags: #x~X : (nav-node-flag " (-> obj flags))
(let ((s5-0 (-> obj flags)))
(if (= (logand s5-0 (nav-node-flag-byte blocked)) (nav-node-flag-byte blocked))
(format #t "blocked ")
)
(if (= (logand s5-0 (nav-node-flag-byte selected)) (nav-node-flag-byte selected))
(format #t "selected ")
)
(if (= (logand s5-0 (nav-node-flag-byte pedestrian)) (nav-node-flag-byte pedestrian))
(format #t "pedestrian ")
)
(if (= (logand s5-0 (nav-node-flag-byte visited)) (nav-node-flag-byte visited))
(format #t "visited ")
)
(if (= (logand s5-0 (nav-node-flag-byte hidden)) (nav-node-flag-byte hidden))
(format #t "hidden ")
)
)
(format #t ")~%")
(format #t "~1Tpad0[1] @ #x~X~%" (-> obj pad0))
(format #t "~1Tbranch-array: #x~X~%" (-> obj branch-array))
(format #t "~1Tnav-mesh-id: ~D~%" (-> obj nav-mesh-id))
(format #t "~1Tlevel: ~A~%" (-> obj level))
(label cfg-14)
obj
)
;; definition for method 11 of type nav-branch
(defmethod nav-branch-method-11 nav-branch ((obj nav-branch))
"TODO
@returns `density * 0.0078125` - is this some kind of trick?"
(* 0.0078125 (the float (-> obj density)))
)
;; definition for method 12 of type nav-branch
(defmethod nav-branch-method-12 nav-branch ((obj nav-branch))
"TODO
@returns `speed-limit * 1024.0`"
(* 1024.0 (the float (-> obj speed-limit)))
)
;; definition for method 13 of type nav-branch
(defmethod nav-branch-method-13 nav-branch ((obj nav-branch))
"TODO
@returns `width * 256.0`"
(* 256.0 (the float (-> obj width)))
)
;; definition for method 14 of type nav-branch
(defmethod user-limit-reached? nav-branch ((obj nav-branch))
(>= (-> obj user-count) (-> obj max-user-count))
)
;; definition for method 15 of type nav-branch
(defmethod nav-branch-method-15 nav-branch ((obj nav-branch))
"TODO - checks that `dest-node`'s `id` isn't #FFFF"
(!= (-> obj dest-node id) #xffff)
)
;; definition for method 21 of type nav-node
(defmethod nav-node-method-21 nav-node ((obj nav-node))
"TODO
@returns `radius * 1024.0"
(* 1024.0 (the float (-> obj radius)))
)
;; definition for method 20 of type nav-node
(defmethod get-angle nav-node ((obj nav-node))
(the float (-> obj angle))
)
;; definition for method 19 of type nav-node
(defmethod calc-sine-and-cosine! nav-node ((obj nav-node) (ret vector))
"Computes the sine and cosine of the `angle`.
@param! ret The result <cosine, 0.0, -(sine), 1.0>
@returns Nothing, the result will be in `ret`"
(let ((angle (the float (-> obj angle)))
(sin-cos-result (new 'stack-no-clear 'vector))
)
(sincos! sin-cos-result angle)
(set! (-> ret x) (-> sin-cos-result y))
(set! (-> ret y) 0.0)
(set! (-> ret z) (- (-> sin-cos-result x)))
)
(set! (-> ret w) 1.0)
ret
)
;; definition for method 18 of type nav-node
;; INFO: Used lq/sq
(defmethod get-position nav-node ((obj nav-node) (ret vector))
"@param! ret The [[vector]] that is modified to hold the result
@returns the `position` [[vector]] with a `w` component of `1.0`"
(set! (-> ret quad) (-> obj position quad))
(set! (-> ret w) 1.0)
ret
)
;; definition of type nav-graph-link
(deftype nav-graph-link (structure)
((id uint32 :offset-assert 0)
(dest-graph-id uint32 :offset-assert 4)
(src-branch-id uint16 :offset-assert 8)
(dest-node-id uint16 :offset-assert 10)
(dest-graph basic :offset-assert 12)
(dummy-node nav-node :inline :offset-assert 16)
)
:method-count-assert 9
:size-assert #x30
:flag-assert #x900000030
)
;; definition for method 3 of type nav-graph-link
(defmethod inspect nav-graph-link ((obj nav-graph-link))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj 'nav-graph-link)
(format #t "~1Tid: ~D~%" (-> obj id))
(format #t "~1Tdest-graph-id: ~D~%" (-> obj dest-graph-id))
(format #t "~1Tsrc-branch-id: ~D~%" (-> obj src-branch-id))
(format #t "~1Tdest-node-id: ~D~%" (-> obj dest-node-id))
(format #t "~1Tdest-graph: ~A~%" (-> obj dest-graph))
(format #t "~1Tdummy-node: #<nav-node @ #x~X>~%" (-> obj dummy-node))
(label cfg-4)
obj
)
;; definition of type nav-graph
(deftype nav-graph (basic)
((node-count int16 :offset-assert 4)
(branch-count int16 :offset-assert 6)
(node-array (inline-array nav-node) :offset-assert 8)
(branch-array uint32 :offset-assert 12)
(link-count int16 :offset-assert 16)
(pad2 uint16 :offset-assert 18)
(link-array uint32 :offset-assert 20)
(first-node int16 :offset-assert 24)
(pad0 uint16 :offset-assert 26)
(patched basic :offset-assert 28)
(id uint32 :offset-assert 32)
(pad1 uint32 6 :offset-assert 36)
)
:method-count-assert 45
:size-assert #x3c
:flag-assert #x2d0000003c
(:methods
(nav-graph-method-9 () none 9)
(nav-graph-method-10 () none 10)
(nav-graph-method-11 () none 11)
(nav-graph-method-12 () none 12)
(nav-graph-method-13 () none 13)
(nav-graph-method-14 () none 14)
(nav-graph-method-15 () none 15)
(nav-graph-method-16 () none 16)
(nav-graph-method-17 () none 17)
(nav-graph-method-18 () none 18)
(nav-graph-method-19 () none 19)
(nav-graph-method-20 () none 20)
(nav-graph-method-21 () none 21)
(nav-graph-method-22 () none 22)
(nav-graph-method-23 () none 23)
(nav-graph-method-24 () none 24)
(nav-graph-method-25 () none 25)
(nav-graph-method-26 () none 26)
(nav-graph-method-27 () none 27)
(nav-graph-method-28 () none 28)
(nav-graph-method-29 () none 29)
(nav-graph-method-30 () none 30)
(nav-graph-method-31 () none 31)
(nav-graph-method-32 () none 32)
(nav-graph-method-33 () none 33)
(nav-graph-method-34 () none 34)
(nav-graph-method-35 () none 35)
(nav-graph-method-36 () none 36)
(nav-graph-method-37 () none 37)
(nav-graph-method-38 () none 38)
(nav-graph-method-39 () none 39)
(nav-graph-method-40 () none 40)
(node-at-idx (_type_ int) nav-node 41)
(nav-graph-method-42 () none 42)
(nav-graph-method-43 () none 43)
(nav-graph-method-44 () none 44)
)
)
;; definition for method 3 of type nav-graph
(defmethod inspect nav-graph ((obj nav-graph))
(when (not obj)
(set! obj obj)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" obj (-> obj type))
(format #t "~1Tnode-count: ~D~%" (-> obj node-count))
(format #t "~1Tbranch-count: ~D~%" (-> obj branch-count))
(format #t "~1Tnode-array: #x~X~%" (-> obj node-array))
(format #t "~1Tbranch-array: #x~X~%" (-> obj branch-array))
(format #t "~1Tlink-count: ~D~%" (-> obj link-count))
(format #t "~1Tpad2: ~D~%" (-> obj pad2))
(format #t "~1Tlink-array: #x~X~%" (-> obj link-array))
(format #t "~1Tfirst-node: ~D~%" (-> obj first-node))
(format #t "~1Tpad0: ~D~%" (-> obj pad0))
(format #t "~1Tpatched: ~A~%" (-> obj patched))
(format #t "~1Tid: ~D~%" (-> obj id))
(format #t "~1Tpad1[6] @ #x~X~%" (-> obj pad1))
(label cfg-4)
obj
)
;; definition for method 41 of type nav-graph
(defmethod node-at-idx nav-graph ((obj nav-graph) (idx int))
"Get the `nav-node` at a given position.
@param idx The position in the `node-array` to return
@returns the [[nav-node]] if it can be found, otherwise return [[#f]]"
(let ((v0-0 (the-as nav-node #f)))
(if (and (>= idx 0) (< idx (-> obj node-count)))
(set! v0-0 (-> obj node-array idx))
)
v0-0
)
)
;; failed to figure out what this is:
0
+34 -17
View File
@@ -1,9 +1,10 @@
{
"dgos": [
"CGO/KERNEL.CGO",
"CGO/ENGINE.CGO",
"CGO/COMMON.CGO",
"CGO/GAME.CGO"
"CGO/KERNEL.CGO",
"CGO/ENGINE.CGO",
"CGO/COMMON.CGO",
"CGO/GAME.CGO",
"DGO/CWI.DGO"
],
"skip_compile_files": [],
@@ -19,19 +20,33 @@
/// GSTATE
"enter-state", // stack pointer asm
// MATH
"logf", "log2f", "cube-root", "lerp-scale", "rand-vu-init", "rand-vu", "rand-vu-nostep",
"logf",
"log2f",
"cube-root",
"lerp-scale",
"rand-vu-init",
"rand-vu",
"rand-vu-nostep",
// MATRIX
"matrix-axis-sin-cos-vu!", "matrix-axis-sin-cos!", "matrix-3x3-normalize!",
"matrix-axis-sin-cos-vu!",
"matrix-axis-sin-cos!",
"matrix-3x3-normalize!",
// DMA
"disasm-dma-list",
// PAD (bug)
"service-cpads",
// GEOMETRY asm
"closest-pt-in-triangle", "circle-circle-xz-intersect", "calculate-basis-functions-vector!", "curve-evaluate!",
"closest-pt-in-triangle",
"circle-circle-xz-intersect",
"calculate-basis-functions-vector!",
"curve-evaluate!",
// TIMER asm
"(method 9 clock)",
// math camera stupid broken gif crap and CLIP
"update-math-camera", "transform-point-vector!", "transform-point-qword!", "transform-point-vector-scale!",
"update-math-camera",
"transform-point-vector!",
"transform-point-qword!",
"transform-point-vector-scale!",
// quad thing
"(method 3 connection-minimap)",
"(method 3 sky-vertex)",
@@ -53,7 +68,10 @@
// - never fixed this one in jak 1, assumed there was an original bug?
"print-game-text",
// joint asm
"cspace<-parented-transformq-joint!", "(method 11 art-joint-anim-manager)", "make-joint-jump-tables", "joint-channel-copy!",
"cspace<-parented-transformq-joint!",
"(method 11 art-joint-anim-manager)",
"make-joint-jump-tables",
"joint-channel-copy!",
// vector-dot in stack vars
"joint-mod-ik-callback",
"joint-mod-look-at-handler",
@@ -118,7 +136,8 @@
"add-debug-bound",
// gun-util
"draw-beam", "(method 9 gun-info)",
"draw-beam",
"(method 9 gun-info)",
// mood
"update-mood-direction", // power of two case
// texture
@@ -128,6 +147,9 @@
"(method 18 mysql-nav-graph)", // asm / dead-code
"(method 10 mysql-nav-graph)",
// aligner - never fixed in jak 1
"(method 9 align-control)",
"bsp-camera-asm",
"build-masks",
@@ -138,12 +160,7 @@
"cam-bike": [
"code" // hang
],
"cam-stick": [
"code"
],
"cam-circular": [
"enter",
"event"
]
"cam-stick": ["code"],
"cam-circular": ["enter", "event"]
}
}