mirror of
https://github.com/open-goal/jak-project
synced 2026-07-10 15:14:15 -04:00
7348e6a4ff
Update the decompiler to use the new vf macros. Also, fix a bunch of silly casting issues where accessing inline fields with an offset of 0 would be better than a cast:  --------- Co-authored-by: water111 <awaterford1111445@gmail.com>
208 lines
6.7 KiB
Common Lisp
Vendored
Generated
208 lines
6.7 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type bsp-node
|
|
(deftype bsp-node (structure)
|
|
((front int32)
|
|
(back int32)
|
|
(front-flags uint32)
|
|
(back-flags uint32)
|
|
(plane vector :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type bsp-node
|
|
(defmethod inspect ((this bsp-node))
|
|
(format #t "[~8x] ~A~%" this 'bsp-node)
|
|
(format #t "~Tfront: ~D~%" (-> this front))
|
|
(format #t "~Tback: ~D~%" (-> this back))
|
|
(format #t "~Tfront-flags: ~D~%" (-> this front-flags))
|
|
(format #t "~Tback-flags: ~D~%" (-> this back-flags))
|
|
(format #t "~Tplane: #<vector @ #x~X>~%" (-> this plane))
|
|
this
|
|
)
|
|
|
|
;; definition of type bsp-header
|
|
(deftype bsp-header (drawable)
|
|
((info file-info :overlay-at id)
|
|
(all-visible-list (pointer uint16))
|
|
(visible-list-length int32)
|
|
(drawable-trees drawable-tree-array)
|
|
(pat pointer)
|
|
(pat-length int32)
|
|
(texture-remap-table (pointer uint64))
|
|
(texture-remap-table-len int32)
|
|
(texture-ids (pointer texture-id))
|
|
(texture-page-count int32)
|
|
(unk-zero-0 basic)
|
|
(name symbol)
|
|
(nickname symbol)
|
|
(vis-info level-vis-info 8)
|
|
(actors drawable-inline-array-actor)
|
|
(cameras (array entity-camera))
|
|
(nodes (inline-array bsp-node))
|
|
(level level)
|
|
(current-leaf-idx uint16)
|
|
(unk-data-2 uint16 9)
|
|
(boxes box8s-array)
|
|
(current-bsp-back-flags uint32)
|
|
(ambients drawable-inline-array-ambient)
|
|
(unk-data-4 float)
|
|
(unk-data-5 float)
|
|
(adgifs adgif-shader-array)
|
|
(actor-birth-order (pointer uint32))
|
|
(split-box-indices (pointer uint16))
|
|
(unk-data-8 uint32 55)
|
|
)
|
|
(:methods
|
|
(relocate (_type_ kheap (pointer uint8)) none :replace)
|
|
(birth (_type_) none)
|
|
(deactivate-entities (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition of type game-level
|
|
(deftype game-level (basic)
|
|
((master-bsp basic)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type game-level
|
|
(defmethod inspect ((this game-level))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Tmaster-bsp: ~A~%" (-> this master-bsp))
|
|
this
|
|
)
|
|
|
|
;; definition of type view-frustum
|
|
(deftype view-frustum (structure)
|
|
((hither-top-left vector :inline)
|
|
(hither-top-right vector :inline)
|
|
(hither-bottom-left vector :inline)
|
|
(hither-bottom-right vector :inline)
|
|
(yon-top-left vector :inline)
|
|
(yon-top-right vector :inline)
|
|
(yon-bottom-left vector :inline)
|
|
(yon-bottom-right vector :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type view-frustum
|
|
(defmethod inspect ((this view-frustum))
|
|
(format #t "[~8x] ~A~%" this 'view-frustum)
|
|
(format #t "~Thither-top-left: #<vector @ #x~X>~%" (-> this hither-top-left))
|
|
(format #t "~Thither-top-right: #<vector @ #x~X>~%" (-> this hither-top-right))
|
|
(format #t "~Thither-bottom-left: #<vector @ #x~X>~%" (-> this hither-bottom-left))
|
|
(format #t "~Thither-bottom-right: #<vector @ #x~X>~%" (-> this hither-bottom-right))
|
|
(format #t "~Tyon-top-left: #<vector @ #x~X>~%" (-> this yon-top-left))
|
|
(format #t "~Tyon-top-right: #<vector @ #x~X>~%" (-> this yon-top-right))
|
|
(format #t "~Tyon-bottom-left: #<vector @ #x~X>~%" (-> this yon-bottom-left))
|
|
(format #t "~Tyon-bottom-right: #<vector @ #x~X>~%" (-> this yon-bottom-right))
|
|
this
|
|
)
|
|
|
|
;; definition for method 3 of type bsp-header
|
|
(defmethod inspect ((this bsp-header))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Tall-visible-list: #x~X~%" (-> this all-visible-list))
|
|
(format #t "~Tvisible-list-length: ~D~%" (-> this visible-list-length))
|
|
(format #t "~Tdrawable-trees: ~A~%" (-> this drawable-trees))
|
|
(format #t "~Tpat: #x~X~%" (-> this pat))
|
|
(format #t "~Tpat-length: ~D~%" (-> this pat-length))
|
|
(inspect-bsp-tree this (-> this nodes 0))
|
|
this
|
|
)
|
|
|
|
;; definition (debug) for function inspect-bsp-tree
|
|
;; INFO: Return type mismatch bsp-header vs none.
|
|
(defun-debug inspect-bsp-tree ((arg0 bsp-header) (arg1 bsp-node))
|
|
(cond
|
|
((zero? arg1)
|
|
)
|
|
(else
|
|
(format #t "_#x~X________________~%" arg1)
|
|
(inspect arg1)
|
|
(let ((s4-0 *print-column*))
|
|
(set! *print-column* (+ *print-column* 64))
|
|
(if (> (-> arg1 front) 0)
|
|
(inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 front)))
|
|
(format #t "_#x~X________________~%" arg1)
|
|
)
|
|
(if (> (-> arg1 back) 0)
|
|
(inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 back)))
|
|
(format #t "_#x~X________________~%" arg1)
|
|
)
|
|
(set! *print-column* s4-0)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function map-bsp-tree
|
|
;; INFO: Return type mismatch bsp-header vs none.
|
|
(defun map-bsp-tree ((arg0 (function bsp-node none)) (arg1 bsp-header) (arg2 bsp-node))
|
|
(cond
|
|
((zero? arg2)
|
|
)
|
|
(else
|
|
(if (> (-> arg2 front) 0)
|
|
(map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 front)))
|
|
(arg0 arg2)
|
|
)
|
|
(if (> (-> arg2 back) 0)
|
|
(map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 back)))
|
|
(arg0 arg2)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition of type cl-stat
|
|
(deftype cl-stat (structure)
|
|
((fragments uint32)
|
|
(tris uint32)
|
|
(output uint32)
|
|
)
|
|
:pack-me
|
|
)
|
|
|
|
;; definition for method 3 of type cl-stat
|
|
(defmethod inspect ((this cl-stat))
|
|
(format #t "[~8x] ~A~%" this 'cl-stat)
|
|
(format #t "~Tfragments: ~D~%" (-> this fragments))
|
|
(format #t "~Ttris: ~D~%" (-> this tris))
|
|
(format #t "~Toutput: ~D~%" (-> this output))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-stats
|
|
(deftype collide-stats (structure)
|
|
((other cl-stat :inline)
|
|
(total cl-stat :inline)
|
|
(nodes uint32)
|
|
(calls uint32)
|
|
(total-target stopwatch :inline)
|
|
(target-cache-fill stopwatch :inline)
|
|
(target-ray-poly stopwatch :inline)
|
|
(pad uint32)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-stats
|
|
(defmethod inspect ((this collide-stats))
|
|
(format #t "[~8x] ~A~%" this 'collide-stats)
|
|
(format #t "~Tother: #<cl-stat @ #x~X>~%" (-> this other))
|
|
(format #t "~Ttotal: #<cl-stat @ #x~X>~%" (-> this total))
|
|
(format #t "~Tnodes: ~D~%" (-> this nodes))
|
|
(format #t "~Tcalls: ~D~%" (-> this calls))
|
|
(format #t "~Ttotal-target: #<stopwatch @ #x~X>~%" (-> this total-target))
|
|
(format #t "~Ttarget-cache-fill: #<stopwatch @ #x~X>~%" (-> this target-cache-fill))
|
|
(format #t "~Ttarget-ray-poly: #<stopwatch @ #x~X>~%" (-> this target-ray-poly))
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|