Files
jak-project/test/decompiler/reference/jakx/engine/dma/dma_REF.gc
T
Tyler Wilding 9c86c86c74 d/jx: More files (#4360)
Breaks the 300 file milestone, also includes the majority of mips2c
functions carried forward. Some functions need some fixes in the c++
code to mips2c properly, and a small handful of the mips2c functions
require manual patching -- all spots were marked with `TODO - fix` that
had to be commented out to get things compiling.
2026-09-04 09:27:06 -04:00

671 lines
18 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for function dma-sync-hang
;; ERROR: failed type prop at 0: Could not figure out load: (set! v1 (l.w a0))
(defun dma-sync-hang ((a0-0 dma-bank))
(local-vars (v0-0 none) (v1-0 none) (v1-1 none))
(until (begin
(set! v1-0 (the-as none (l.w a0-0)))
(set! v1-1 (the-as none (logand v1-0 256)))
(nop!)
(nop!)
(nop!)
(nop!)
(zero? v1-1)
)
(empty)
)
(set! v0-0 (the-as none 0))
(ret-none)
)
;; definition for function dma-sync-crash
;; WARN: Return type mismatch int vs none.
(defun dma-sync-crash ((arg0 dma-bank))
(let ((v1-0 #x4c4b40))
(while (nonzero? (-> arg0 chcr str))
(cond
((zero? v1-0)
(crash!)
0
)
(else
(+! v1-0 -1)
)
)
)
)
0
(none)
)
;; definition for function dma-send
;; WARN: Return type mismatch int vs none.
(defun dma-send ((arg0 dma-bank) (arg1 uint) (arg2 uint))
(dma-sync (the-as pointer arg0) 0 0)
(flush-cache 0)
(.sync.l)
(set! (-> arg0 madr) (logior (logand #xfffffff arg1) (if (= (logand #x70000000 arg1) #x70000000)
(shl #x8000 16)
0
)
)
)
(set! (-> arg0 qwc) arg2)
(.sync.l)
(set! (-> arg0 chcr) (new 'static 'dma-chcr :str #x1))
(.sync.l)
0
(none)
)
;; definition for function dma-send-chain
;; WARN: Return type mismatch int vs none.
(defun dma-send-chain ((arg0 dma-bank-source) (arg1 uint))
(dma-sync (the-as pointer arg0) 0 0)
(flush-cache 0)
(.sync.l)
(set! (-> arg0 qwc) (the-as uint 0))
(set! (-> arg0 tadr) (logior (logand #xfffffff arg1) (if (= (logand #x70000000 arg1) #x70000000)
(shl #x8000 16)
0
)
)
)
(.sync.l)
(set! (-> arg0 chcr) (new 'static 'dma-chcr :dir #x1 :mod #x1 :tte #x1 :str #x1))
(.sync.l)
0
(none)
)
;; definition for function dma-send-chain-no-tte
;; WARN: Return type mismatch int vs none.
(defun dma-send-chain-no-tte ((arg0 dma-bank-source) (arg1 uint))
(dma-sync (the-as pointer arg0) 0 0)
(flush-cache 0)
(.sync.l)
(set! (-> arg0 qwc) (the-as uint 0))
(set! (-> arg0 tadr) (logior (logand #xfffffff arg1) (if (= (logand #x70000000 arg1) #x70000000)
(shl #x8000 16)
0
)
)
)
(.sync.l)
(set! (-> arg0 chcr) (new 'static 'dma-chcr :dir #x1 :mod #x1 :str #x1))
(.sync.l)
0
(none)
)
;; definition for function dma-send-chain-no-flush
;; WARN: Return type mismatch int vs none.
(defun dma-send-chain-no-flush ((arg0 dma-bank-source) (arg1 uint))
(dma-sync (the-as pointer arg0) 0 0)
(.sync.l)
(set! (-> arg0 qwc) (the-as uint 0))
(set! (-> arg0 tadr) (logior (logand #xfffffff arg1) (if (= (logand #x70000000 arg1) #x70000000)
(shl #x8000 16)
0
)
)
)
(.sync.l)
(set! (-> arg0 chcr) (new 'static 'dma-chcr :dir #x1 :mod #x1 :tte #x1 :str #x1))
(.sync.l)
0
(none)
)
;; definition for function dma-send-to-spr
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ s5-0 16) v1-1) at op 16
;; ERROR: Failed store: (s.w! (+ s5-0 128) v1-3) at op 19
;; ERROR: Failed store: (s.w! (+ s5-0 32) arg2) at op 20
;; ERROR: Failed store: (s.w! s5-0 v1-4) at op 23
(defun dma-send-to-spr ((arg0 uint) (arg1 uint) (arg2 uint) (arg3 symbol))
(let ((s5-0 #x1000d400))
(dma-sync (the-as pointer s5-0) 0 0)
(flush-cache 0)
(.sync.l)
(let ((v1-1 (logand #xfffffff arg1)))
(s.w! (+ s5-0 16) v1-1)
)
(let ((v1-3 (logand #xfffffff arg0)))
(s.w! (+ s5-0 128) v1-3)
)
(s.w! (+ s5-0 32) arg2)
(.sync.l)
(let ((v1-4 256))
(s.w! s5-0 v1-4)
)
(.sync.l)
(if arg3
(dma-sync (the-as pointer s5-0) 0 0)
)
)
0
(none)
)
;; definition for function dma-send-to-spr-no-flush
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ s5-0 16) v1-1) at op 13
;; ERROR: Failed store: (s.w! (+ s5-0 128) v1-3) at op 16
;; ERROR: Failed store: (s.w! (+ s5-0 32) arg2) at op 17
;; ERROR: Failed store: (s.w! s5-0 v1-4) at op 20
(defun dma-send-to-spr-no-flush ((arg0 uint) (arg1 uint) (arg2 uint) (arg3 symbol))
(let ((s5-0 #x1000d400))
(dma-sync (the-as pointer s5-0) 0 0)
(.sync.l)
(let ((v1-1 (logand #xfffffff arg1)))
(s.w! (+ s5-0 16) v1-1)
)
(let ((v1-3 (logand #xfffffff arg0)))
(s.w! (+ s5-0 128) v1-3)
)
(s.w! (+ s5-0 32) arg2)
(.sync.l)
(let ((v1-4 256))
(s.w! s5-0 v1-4)
)
(.sync.l)
(if arg3
(dma-sync (the-as pointer s5-0) 0 0)
)
)
0
(none)
)
;; definition for function dma-send-from-spr
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ s5-0 16) v1-1) at op 16
;; ERROR: Failed store: (s.w! (+ s5-0 128) v1-3) at op 19
;; ERROR: Failed store: (s.w! (+ s5-0 32) arg2) at op 20
;; ERROR: Failed store: (s.w! s5-0 v1-4) at op 23
(defun dma-send-from-spr ((arg0 uint) (arg1 uint) (arg2 uint) (arg3 symbol))
(let ((s5-0 #x1000d000))
(dma-sync (the-as pointer s5-0) 0 0)
(flush-cache 0)
(.sync.l)
(let ((v1-1 (logand #xfffffff arg0)))
(s.w! (+ s5-0 16) v1-1)
)
(let ((v1-3 (logand #xfffffff arg1)))
(s.w! (+ s5-0 128) v1-3)
)
(s.w! (+ s5-0 32) arg2)
(.sync.l)
(let ((v1-4 256))
(s.w! s5-0 v1-4)
)
(.sync.l)
(if arg3
(dma-sync (the-as pointer s5-0) 0 0)
)
)
0
(none)
)
;; definition for function dma-send-from-spr-no-flush
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ s5-0 16) v1-1) at op 13
;; ERROR: Failed store: (s.w! (+ s5-0 128) v1-3) at op 16
;; ERROR: Failed store: (s.w! (+ s5-0 32) arg2) at op 17
;; ERROR: Failed store: (s.w! s5-0 v1-4) at op 20
(defun dma-send-from-spr-no-flush ((arg0 uint) (arg1 uint) (arg2 uint) (arg3 symbol))
(let ((s5-0 #x1000d000))
(dma-sync (the-as pointer s5-0) 0 0)
(.sync.l)
(let ((v1-1 (logand #xfffffff arg0)))
(s.w! (+ s5-0 16) v1-1)
)
(let ((v1-3 (logand #xfffffff arg1)))
(s.w! (+ s5-0 128) v1-3)
)
(s.w! (+ s5-0 32) arg2)
(.sync.l)
(let ((v1-4 256))
(s.w! s5-0 v1-4)
)
(.sync.l)
(if arg3
(dma-sync (the-as pointer s5-0) 0 0)
)
)
0
(none)
)
;; definition for function dma-initialize
;; ERROR: failed type prop at 1: Could not figure out load: (set! v1 (l.wu (+ v1 32)))
(defun dma-initialize ()
(local-vars
(v0-0 none)
(v1-0 int)
(v1-1 none)
(v1-2 none)
(v1-3 none)
(v1-4 none)
(v1-5 none)
(v1-6 none)
(v1-7 none)
(a0-0 none)
(a0-1 none)
(a0-2 none)
(a0-3 none)
)
(set! v1-0 #x10003800)
(set! v1-1 (the-as none (l.wu (+ v1-0 32))))
(set! a0-0 (the-as none -3))
(set! v1-2 (the-as none (logand v1-1 a0-0)))
(set! v1-3 (the-as none (logior v1-2 2)))
(set! a0-1 (the-as none #x10003800))
(s.w! (+ a0-1 32) v1-3)
(set! v1-4 (the-as none #x10003c00))
(set! v1-5 (the-as none (l.wu (+ v1-4 32))))
(set! a0-2 (the-as none -3))
(set! v1-6 (the-as none (logand v1-5 a0-2)))
(set! v1-7 (the-as none (logior v1-6 2)))
(set! a0-3 (the-as none #x10003c00))
(s.w! (+ a0-3 32) v1-7)
(set! v0-0 (the-as none 0))
(ret-none)
)
;; definition for function clear-vu0-mem
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! a2-1 a1-0) at op 6
(defun clear-vu0-mem ()
(let ((v1-0 #x11004000))
(dotimes (a0-0 1024)
(let ((a1-0 (the-as uint #xabadbeef))
(a2-1 (+ v1-0 (* a0-0 4)))
)
(s.w! a2-1 a1-0)
)
)
)
0
(none)
)
;; definition for function clear-vu1-mem
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! a2-1 a1-0) at op 6
(defun clear-vu1-mem ()
(let ((v1-0 #x1100c000))
(dotimes (a0-0 4096)
(let ((a1-0 (the-as uint #xabadbeef))
(a2-1 (+ v1-0 (* a0-0 4)))
)
(s.w! a2-1 a1-0)
)
)
)
0
(none)
)
;; definition for function dump-vu1-mem
;; ERROR: failed type prop at 10: Could not figure out load: (set! a3 (l.wu v1))
;; WARN: Return type mismatch int vs none.
(defun dump-vu1-mem ()
(local-vars
(v0-0 none)
(v0-1 none)
(v0-2 int)
(v1-0 int)
(v1-1 int)
(v1-2 int)
(v1-3 none)
(v1-4 none)
(v1-5 none)
(v1-6 none)
(v1-7 none)
(v1-8 none)
(v1-9 none)
(v1-10 none)
(v1-11 none)
(v1-12 none)
(v1-13 none)
(v1-14 none)
(v1-15 none)
(v1-16 none)
(v1-17 none)
(v1-18 none)
(v1-19 none)
(v1-20 none)
(v1-21 none)
(v1-22 none)
(v1-23 none)
(v1-24 none)
(v1-25 none)
(v1-26 none)
(v1-27 none)
(v1-28 none)
(v1-29 none)
(a0-0 int)
(a0-1 none)
(a1-0 string)
(a1-1 none)
(a2-1 none)
(a3-0 none)
(a3-1 none)
(t0-0 none)
(t0-1 none)
(t1-0 none)
(t1-1 none)
(t2-0 none)
(s5-0 int)
(t9-0 (function _varargs_ object))
(t9-1 none)
(gp-0 int)
)
(set! gp-0 #x1100c000)
(set! s5-0 0)
(while (<.si s5-0 1024)
(set! t9-0 format)
(set! a0-0 0)
(set! a1-0 L56)
(set! a2-0 s5-0)
(set! v1-0 (sll s5-0 2))
(set! v1-1 (sll v1-0 2))
(set! v1-2 (+ gp-0 v1-1))
(set! a3-0 (the-as none (l.wu v1-2)))
(set! v1-3 (the-as none (sll s5-0 2)))
(set! v1-4 (the-as none (+ v1-3 1)))
(set! v1-5 (the-as none (sll v1-4 2)))
(set! v1-6 (the-as none (+ gp-0 v1-5)))
(set! t0-0 (the-as none (l.wu v1-6)))
(set! v1-7 (the-as none (sll s5-0 2)))
(set! v1-8 (the-as none (+ v1-7 2)))
(set! v1-9 (the-as none (sll v1-8 2)))
(set! v1-10 (the-as none (+ gp-0 v1-9)))
(set! t1-0 (the-as none (l.wu v1-10)))
(set! v1-11 (the-as none (sll s5-0 2)))
(set! v1-12 (the-as none (+ v1-11 3)))
(set! v1-13 (the-as none (sll v1-12 2)))
(set! v1-14 (the-as none (+ gp-0 v1-13)))
(set! t2-0 (the-as none (l.wu v1-14)))
(call!)
(set! t9-1 (the-as none format))
(set! a0-1 (the-as none 0))
(set! a1-1 (the-as none L55))
(set! v1-15 (the-as none (sll s5-0 2)))
(set! v1-16 (the-as none (sll v1-15 2)))
(set! v1-17 (the-as none (+ gp-0 v1-16)))
(set! a2-1 (the-as none (l.wu v1-17)))
(set! v1-18 (the-as none (sll s5-0 2)))
(set! v1-19 (the-as none (+ v1-18 1)))
(set! v1-20 (the-as none (sll v1-19 2)))
(set! v1-21 (the-as none (+ gp-0 v1-20)))
(set! a3-1 (the-as none (l.wu v1-21)))
(set! v1-22 (the-as none (sll s5-0 2)))
(set! v1-23 (the-as none (+ v1-22 2)))
(set! v1-24 (the-as none (sll v1-23 2)))
(set! v1-25 (the-as none (+ gp-0 v1-24)))
(set! t0-1 (the-as none (l.wu v1-25)))
(set! v1-26 (the-as none (sll s5-0 2)))
(set! v1-27 (the-as none (+ v1-26 3)))
(set! v1-28 (the-as none (sll v1-27 2)))
(set! v1-29 (the-as none (+ gp-0 v1-28)))
(set! t1-1 (the-as none (l.wu v1-29)))
(call!)
(set! s5-0 (the-as int (+ s5-0 1)))
)
(set! v0-2 0)
(ret-none)
)
;; definition for function dump-vu1-range
;; ERROR: failed type prop at 13: Could not figure out load: (set! a3 (l.wu v1))
;; WARN: Return type mismatch int vs symbol.
(defun dump-vu1-range ((a0-0 uint) (a1-0 uint))
(local-vars
(v0-0 none)
(v0-1 none)
(v0-2 int)
(v1-0 uint)
(v1-1 uint)
(v1-2 uint)
(v1-3 none)
(v1-4 none)
(v1-5 none)
(v1-6 none)
(v1-7 none)
(v1-8 none)
(v1-9 none)
(v1-10 none)
(v1-11 none)
(v1-12 none)
(v1-13 none)
(v1-14 none)
(v1-15 none)
(v1-16 none)
(v1-17 none)
(v1-18 none)
(v1-19 none)
(v1-20 none)
(v1-21 none)
(v1-22 none)
(v1-23 none)
(v1-24 none)
(v1-25 none)
(v1-26 none)
(v1-27 none)
(v1-28 none)
(v1-29 none)
(a0-1 int)
(a0-2 none)
(a1-1 string)
(a1-2 none)
(a2-1 none)
(a3-0 none)
(a3-1 none)
(t0-0 none)
(t0-1 none)
(t1-0 none)
(t1-1 none)
(t2-0 none)
(s2-0 uint)
(s3-0 int)
(s4-0 int)
(t9-0 (function _varargs_ object))
(t9-1 none)
)
(set! s4-0 #x1100c000)
(set! s3-0 0)
(while (<.si s3-0 a1-0)
(set! s2-0 (+ s3-0 a0-0))
(set! t9-0 format)
(set! a0-1 0)
(set! a1-1 L54)
(set! a2-0 s2-0)
(set! v1-0 (sll s2-0 2))
(set! v1-1 (sll v1-0 2))
(set! v1-2 (+ s4-0 v1-1))
(set! a3-0 (the-as none (l.wu v1-2)))
(set! v1-3 (the-as none (sll s2-0 2)))
(set! v1-4 (the-as none (+ v1-3 1)))
(set! v1-5 (the-as none (sll v1-4 2)))
(set! v1-6 (the-as none (+ s4-0 v1-5)))
(set! t0-0 (the-as none (l.wu v1-6)))
(set! v1-7 (the-as none (sll s2-0 2)))
(set! v1-8 (the-as none (+ v1-7 2)))
(set! v1-9 (the-as none (sll v1-8 2)))
(set! v1-10 (the-as none (+ s4-0 v1-9)))
(set! t1-0 (the-as none (l.wu v1-10)))
(set! v1-11 (the-as none (sll s2-0 2)))
(set! v1-12 (the-as none (+ v1-11 3)))
(set! v1-13 (the-as none (sll v1-12 2)))
(set! v1-14 (the-as none (+ s4-0 v1-13)))
(set! t2-0 (the-as none (l.wu v1-14)))
(call!)
(set! t9-1 (the-as none format))
(set! a0-2 (the-as none 0))
(set! a1-2 (the-as none L55))
(set! v1-15 (the-as none (sll s2-0 2)))
(set! v1-16 (the-as none (sll v1-15 2)))
(set! v1-17 (the-as none (+ s4-0 v1-16)))
(set! a2-1 (the-as none (l.wu v1-17)))
(set! v1-18 (the-as none (sll s2-0 2)))
(set! v1-19 (the-as none (+ v1-18 1)))
(set! v1-20 (the-as none (sll v1-19 2)))
(set! v1-21 (the-as none (+ s4-0 v1-20)))
(set! a3-1 (the-as none (l.wu v1-21)))
(set! v1-22 (the-as none (sll s2-0 2)))
(set! v1-23 (the-as none (+ v1-22 2)))
(set! v1-24 (the-as none (sll v1-23 2)))
(set! v1-25 (the-as none (+ s4-0 v1-24)))
(set! t0-1 (the-as none (l.wu v1-25)))
(set! v1-26 (the-as none (sll s2-0 2)))
(set! v1-27 (the-as none (+ v1-26 3)))
(set! v1-28 (the-as none (sll v1-27 2)))
(set! v1-29 (the-as none (+ s4-0 v1-28)))
(set! t1-1 (the-as none (l.wu v1-29)))
(call!)
(set! v1-30 (the-as none v0-1))
(set! s3-0 (the-as int (+ s3-0 1)))
)
(set! v0-2 0)
(ret-value v0-2)
)
;; definition for function reset-vif1-path
;; WARN: Return type mismatch int vs none.
(defun reset-vif1-path ()
(format 0 "~`dma-bank-vif`I~`vif-bank`I" #x10009000 #x10003c00)
(reset-path)
(set-graphics-mode)
(format 0 "gkernel: vif1 path reset!~%")
0
(none)
)
;; definition for function ultimate-memcpy
;; WARN: Return type mismatch int vs none.
;; ERROR: Failed store: (s.w! (+ s4-0 16) arg1) at op 26
;; ERROR: Failed store: (s.w! (+ s4-0 128) 0) at op 27
;; ERROR: Failed store: (s.w! (+ s4-0 32) s1-0) at op 28
;; ERROR: Failed store: (s.w! s4-0 v1-3) at op 31
;; ERROR: Failed store: (s.w! (+ s3-0 16) arg0) at op 40
;; ERROR: Failed store: (s.w! (+ s3-0 128) 0) at op 41
;; ERROR: Failed store: (s.w! (+ s3-0 32) s1-0) at op 42
;; ERROR: Failed store: (s.w! s3-0 v1-5) at op 45
(defun ultimate-memcpy ((arg0 pointer) (arg1 pointer) (arg2 uint))
(let ((s4-0 #x1000d400)
(s3-0 #x1000d000)
(s2-0 (shr arg2 4))
)
(flush-cache 0)
(dma-sync (the-as pointer s4-0) 0 0)
(dma-sync (the-as pointer s3-0) 0 0)
(while (> s2-0 0)
(let ((s1-0 (the-as int s2-0)))
(if (< (the-as uint 1024) (the-as uint s1-0))
(set! s1-0 1024)
)
(set! s2-0 (- s2-0 (the-as uint s1-0)))
(.sync.l)
(s.w! (+ s4-0 16) arg1)
(s.w! (+ s4-0 128) 0)
(s.w! (+ s4-0 32) s1-0)
(.sync.l)
(let ((v1-3 256))
(s.w! s4-0 v1-3)
)
(.sync.l)
(dma-sync (the-as pointer s4-0) 0 0)
(&+! arg1 (* s1-0 16))
(s.w! (+ s3-0 16) arg0)
(s.w! (+ s3-0 128) 0)
(s.w! (+ s3-0 32) s1-0)
(.sync.l)
(let ((v1-5 256))
(s.w! s3-0 v1-5)
)
(.sync.l)
(dma-sync (the-as pointer s3-0) 0 0)
(&+! arg0 (* s1-0 16))
)
)
)
0
(none)
)
;; definition for function symlink2
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function symlink3
;; ERROR: failed type prop at 1: Couldn't figure out integer subtract: (- a1 #f) (<uninitialized> and '#f)
;; ERROR: Function may read a register that is not set: a0
;; ERROR: Function may read a register that is not set: a1
;; ERROR: Function may read a register that is not set: a2
;; ERROR: Function may read a register that is not set: ra
;; ERROR: Unsupported inline assembly instruction kind - [sll a3, a3, 16]
;; ERROR: Unsupported inline assembly instruction kind - [jr ra]
(defun symlink3 ()
(local-vars
(v0-0 none)
(v1-0 none)
(a0-0 none)
(a1-0 none)
(a2-0 none)
(a3-0 int)
(a3-1 none)
(t0-0 none)
(t1-0 none)
(t3-0 none)
(t3-1 none)
(t3-2 none)
(t4-0 none)
(t4-1 none)
(t4-2 none)
(t4-3 none)
(t4-4 none)
(ra-0 none)
)
(set! a3-0 #xffff)
(set! v1-0 (the-as none (- a1-0 #f)))
(.sll a3-1 a3-0 16)
(set! t0-0 (the-as none 1020))
(set! t1-0 (the-as none (logior a3-1 #xffff)))
(until (begin (label cfg-5) (zero? t4-2))
(label cfg-1)
(set! t4-0 (the-as none (l.bu a2-0)))
(set! a2-0 (the-as none (+ a2-0 1)))
(set! t4-1 (the-as none (sll t4-0 2)))
(nop!)
((b! (= t4-1 t0-0) L2 (set! a0-0 (+ a0-0 t4-1))) (set! a0-0 (the-as none (+ a0-0 t4-1))))
(set! t3-0 (the-as none (l.w a0-0)))
(set! t4-2 (the-as none (l.bu a2-0)))
(bl! (= t3-0 t1-0) L3 (no-delay!))
(s.w! a0-0 a1-0)
(set! t4-3 (the-as none (+ t3-0 v1-0)))
(set! t3-1 (the-as none (logand t3-0 a3-1)))
(set! t4-4 (the-as none (logand t4-3 #xffff)))
(nop!)
(set! t3-2 (the-as none (logior t3-1 t4-4)))
(set! t4-2 (the-as none (l.bu a2-0)))
(s.w! a0-0 t3-2)
(nop!)
)
(.jr ra-0)
(set! v0-0 (the-as none (+ a2-0 1)))
(ret-none)
)
;; failed to figure out what this is:
(dma-initialize)