mirror of
https://github.com/open-goal/jak-project
synced 2026-05-29 08:43:08 -04:00
f7bd0752f8
* wip * getting stuff set up so we can actually run test cases * better handle block entry stuff * types2 working on gstring * comments * math ref working * up to first stack stuff * stack fixes * bounding box * math stuff is working * float fixes * temp debug for (method 9 profile-array) * stupid stupid bug * debugging * everything is broken * some amount of type stuff works * bitfield * texture bitfields not working * temp * types * more stuff * type check * temp * float related fixes for light and res problems * revisit broken files, fix bugs * more types * vector debug * bug fixes for decompiler crashes in harder functions * update goal_src
226 lines
6.4 KiB
Common Lisp
Vendored
Generated
226 lines
6.4 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type dma-packet
|
|
(deftype dma-packet (structure)
|
|
((dma dma-tag :offset-assert 0)
|
|
(vif0 vif-tag :offset-assert 8)
|
|
(vif1 vif-tag :offset-assert 12)
|
|
(quad uint128 :offset 0)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x10
|
|
:flag-assert #x900000010
|
|
)
|
|
|
|
;; definition for method 3 of type dma-packet
|
|
;; INFO: Used lq/sq
|
|
(defmethod inspect dma-packet ((obj dma-packet))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj 'dma-packet)
|
|
(format #t "~1Tdma: #x~X~%" (-> obj dma))
|
|
(format #t "~1Tvif0: #x~X~%" (-> obj vif0))
|
|
(format #t "~1Tvif1: #x~X~%" (-> obj vif1))
|
|
(format #t "~1Tquad: ~D~%" (-> obj quad))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; definition of type dma-packet-array
|
|
(deftype dma-packet-array (inline-array-class)
|
|
((data dma-packet :inline :dynamic :offset-assert 16)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x10
|
|
:flag-assert #x900000010
|
|
)
|
|
|
|
;; definition for method 3 of type dma-packet-array
|
|
(defmethod inspect dma-packet-array ((obj dma-packet-array))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj (-> obj type))
|
|
(format #t "~1Tlength: ~D~%" (-> obj length))
|
|
(format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length))
|
|
(format #t "~1Tdata[0] @ #x~X~%" (-> obj data))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(set! (-> dma-packet-array heap-base) (the-as uint 16))
|
|
|
|
;; definition of type dma-gif
|
|
(deftype dma-gif (structure)
|
|
((gif uint64 2 :offset-assert 0)
|
|
(quad uint128 :offset 0)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x10
|
|
:flag-assert #x900000010
|
|
)
|
|
|
|
;; definition for method 3 of type dma-gif
|
|
;; INFO: Used lq/sq
|
|
(defmethod inspect dma-gif ((obj dma-gif))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj 'dma-gif)
|
|
(format #t "~1Tgif[2] @ #x~X~%" (-> obj gif))
|
|
(format #t "~1Tquad: ~D~%" (-> obj quad))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; definition of type dma-gif-packet
|
|
(deftype dma-gif-packet (structure)
|
|
((dma-vif dma-packet :inline :offset-assert 0)
|
|
(gif uint64 2 :offset-assert 16)
|
|
(gif0 uint64 :offset 16)
|
|
(gif1 uint64 :offset 24)
|
|
(quad uint128 2 :offset 0)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x20
|
|
:flag-assert #x900000020
|
|
)
|
|
|
|
;; definition for method 3 of type dma-gif-packet
|
|
(defmethod inspect dma-gif-packet ((obj dma-gif-packet))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj 'dma-gif-packet)
|
|
(format #t "~1Tdma-vif: #<dma-packet @ #x~X>~%" (-> obj dma-vif))
|
|
(format #t "~1Tgif[2] @ #x~X~%" (-> obj gif))
|
|
(format #t "~1Tquad[2] @ #x~X~%" (-> obj dma-vif))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; definition of type dma-buffer
|
|
(deftype dma-buffer (basic)
|
|
((allocated-length int32 :offset-assert 4)
|
|
(base pointer :offset-assert 8)
|
|
(end pointer :offset-assert 12)
|
|
(data uint64 1 :offset-assert 16)
|
|
(data-buffer uint8 :dynamic :offset 16)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x18
|
|
:flag-assert #x900000018
|
|
(:methods
|
|
(new (symbol type int) _type_ 0)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type dma-buffer
|
|
(defmethod inspect dma-buffer ((obj dma-buffer))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj (-> obj type))
|
|
(format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length))
|
|
(format #t "~1Tbase: #x~X~%" (-> obj base))
|
|
(format #t "~1Tend: #x~X~%" (-> obj end))
|
|
(format #t "~1Tdata[1] @ #x~X~%" (-> obj data))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; definition for method 0 of type dma-buffer
|
|
(defmethod new dma-buffer ((allocation symbol) (type-to-make type) (arg0 int))
|
|
(let ((v0-0 (object-new allocation type-to-make (+ arg0 -4 (-> type-to-make size)))))
|
|
(set! (-> v0-0 base) (-> v0-0 data))
|
|
(set! (-> v0-0 allocated-length) arg0)
|
|
v0-0
|
|
)
|
|
)
|
|
|
|
;; definition for function dma-buffer-inplace-new
|
|
(defun dma-buffer-inplace-new ((arg0 dma-buffer) (arg1 int))
|
|
(set! (-> arg0 base) (-> arg0 data))
|
|
(set! (-> arg0 allocated-length) arg1)
|
|
arg0
|
|
)
|
|
|
|
;; definition for method 4 of type dma-buffer
|
|
(defmethod length dma-buffer ((obj dma-buffer))
|
|
(-> obj allocated-length)
|
|
)
|
|
|
|
;; definition for method 5 of type dma-buffer
|
|
(defmethod asize-of dma-buffer ((obj dma-buffer))
|
|
(+ (-> obj allocated-length) -4 (-> dma-buffer size))
|
|
)
|
|
|
|
;; definition for function dma-buffer-length
|
|
(defun dma-buffer-length ((arg0 dma-buffer))
|
|
(shr (+ (&- (-> arg0 base) (the-as uint (-> arg0 data))) 15) 4)
|
|
)
|
|
|
|
;; definition for function dma-buffer-free
|
|
(defun dma-buffer-free ((arg0 dma-buffer))
|
|
(shr (+ (&- (-> arg0 end) (the-as uint (-> arg0 base))) 15) 4)
|
|
)
|
|
|
|
;; definition for function dma-buffer-add-vu-function
|
|
(defun dma-buffer-add-vu-function ((arg0 dma-buffer) (arg1 vu-function) (arg2 int))
|
|
(let ((v1-0 (&-> arg1 data 4))
|
|
(a3-0 (-> arg1 qlength))
|
|
(a1-1 (-> arg1 origin))
|
|
)
|
|
(while (> a3-0 0)
|
|
(let ((t0-1 (min 127 a3-0)))
|
|
(let* ((t1-1 arg0)
|
|
(t2-0 (the-as object (-> t1-1 base)))
|
|
)
|
|
(set! (-> (the-as dma-packet t2-0) dma)
|
|
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int v1-0) :qwc t0-1)
|
|
)
|
|
(set! (-> (the-as dma-packet t2-0) vif0) (new 'static 'vif-tag :cmd (if (zero? arg2) 16 19)))
|
|
(set! (-> (the-as dma-packet t2-0) vif1) (new 'static 'vif-tag :cmd (vif-cmd mpg) :num (* t0-1 2) :imm a1-1))
|
|
(set! (-> t1-1 base) (&+ (the-as pointer t2-0) 16))
|
|
)
|
|
(&+! v1-0 (* t0-1 16))
|
|
(set! a3-0 (- a3-0 t0-1))
|
|
(+! a1-1 (* t0-1 2))
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
|
|
;; definition for function dma-buffer-send
|
|
(defun dma-buffer-send ((arg0 dma-bank) (arg1 dma-buffer))
|
|
(when (< (-> arg1 allocated-length) (&- (-> arg1 base) (the-as uint (-> arg1 data))))
|
|
(crash!)
|
|
0
|
|
)
|
|
(dma-send arg0 (the-as uint (-> arg1 data)) (the-as uint (dma-buffer-length arg1)))
|
|
(none)
|
|
)
|
|
|
|
;; definition for function dma-buffer-send-chain
|
|
(defun dma-buffer-send-chain ((arg0 dma-bank-source) (arg1 dma-buffer))
|
|
(when (< (-> arg1 allocated-length) (&- (-> arg1 base) (the-as uint (-> arg1 data))))
|
|
(crash!)
|
|
0
|
|
)
|
|
(dma-send-chain arg0 (the-as uint (-> arg1 data)))
|
|
(none)
|
|
)
|
|
|
|
|
|
|
|
|