mirror of
https://github.com/open-goal/jak-project
synced 2026-06-08 04:17:28 -04:00
93afb02cf4
This includes all the collision stuff needed to spawn `target`, decompiles the sparticle code and adds some of the PC hacks needed for merc to run (it doesn't work quite right and looks bad, likely due to a combination of code copied from Jak 2 and the time of day hacks). There are a bunch of temporary hacks (see commits) in place to prevent the game from crashing quite as much, but it is still extremely prone to doing so due to lots of missing functions/potentially bad decomp. --------- Co-authored-by: water <awaterford111445@gmail.com>
447 lines
13 KiB
Common Lisp
Vendored
Generated
447 lines
13 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for method 7 of type process
|
|
(defmethod relocate ((this process) (offset int))
|
|
(let ((v1-0 *kernel-context*))
|
|
(set! (-> v1-0 relocating-process) this)
|
|
(set! (-> v1-0 relocating-min) (the-as int (&-> this type)))
|
|
(set! (-> v1-0 relocating-max)
|
|
(the-as int (+ (+ (-> this allocated-length) -4 (-> process size)) (the-as int this)))
|
|
)
|
|
(set! (-> v1-0 relocating-offset) offset)
|
|
)
|
|
(&+! (-> this ppointer 0) offset)
|
|
(let ((v1-5 (-> this entity)))
|
|
(if (and v1-5 (= (-> v1-5 extra process) this))
|
|
(&+! (-> v1-5 extra process) offset)
|
|
)
|
|
)
|
|
(let ((v1-7 (-> this connection-list next1)))
|
|
(while (the-as connection v1-7)
|
|
(let ((a0-14 (-> v1-7 prev1)))
|
|
(if (and (>= (the-as int a0-14) (-> *kernel-context* relocating-min))
|
|
(< (the-as int a0-14) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> v1-7 prev1) offset)
|
|
)
|
|
)
|
|
(let ((a0-19 (-> (the-as connection v1-7) param1)))
|
|
(if (and (>= (the-as int a0-19) (-> *kernel-context* relocating-min))
|
|
(< (the-as int a0-19) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> (the-as connection v1-7) param1) offset)
|
|
)
|
|
)
|
|
(let ((a0-24 (-> (the-as connection v1-7) param2)))
|
|
(if (and (>= a0-24 (-> *kernel-context* relocating-min)) (< a0-24 (-> *kernel-context* relocating-max)))
|
|
(+! (-> (the-as connection v1-7) param2) offset)
|
|
)
|
|
)
|
|
(let ((a0-29 (-> (the-as connection v1-7) param3)))
|
|
(if (and (>= a0-29 (-> *kernel-context* relocating-min)) (< a0-29 (-> *kernel-context* relocating-max)))
|
|
(+! (-> (the-as connection v1-7) param3) offset)
|
|
)
|
|
)
|
|
(set! v1-7 (-> (the-as connection v1-7) next1))
|
|
)
|
|
)
|
|
(let ((v1-10 (-> this self)))
|
|
(if (and (>= (the-as int v1-10) (-> *kernel-context* relocating-min))
|
|
(< (the-as int v1-10) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> this self) offset)
|
|
)
|
|
)
|
|
(let ((v1-15 (-> this ppointer)))
|
|
(if (and (>= (the-as int v1-15) (-> *kernel-context* relocating-min))
|
|
(< (the-as int v1-15) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> this ppointer) offset)
|
|
)
|
|
)
|
|
(let ((s4-0 (&+ (-> this heap-base) 4)))
|
|
(while (< (the-as int s4-0) (the-as int (-> this heap-cur)))
|
|
(relocate s4-0 offset)
|
|
(&+! s4-0 (logand -16 (+ (asize-of s4-0) 15)))
|
|
)
|
|
)
|
|
(&+! (-> this main-thread) offset)
|
|
(&+! (-> this top-thread) offset)
|
|
(if (-> this state-stack)
|
|
(&+! (-> this state-stack) offset)
|
|
)
|
|
(&+! (-> this heap-base) offset)
|
|
(&+! (-> this heap-cur) offset)
|
|
(&+! (-> this heap-top) offset)
|
|
(let ((a2-4 (asize-of this))
|
|
(a1-22 (&-> this type))
|
|
)
|
|
(cond
|
|
((>= offset 0)
|
|
(qmem-copy->! (&+ a1-22 offset) a1-22 a2-4)
|
|
)
|
|
((< a2-4 2560)
|
|
(qmem-copy<-! (&+ a1-22 offset) a1-22 a2-4)
|
|
)
|
|
(else
|
|
(ultimate-memcpy (&+ a1-22 offset) a1-22 (the-as uint a2-4))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> *kernel-context* relocating-process) #f)
|
|
(&+ this offset)
|
|
)
|
|
|
|
;; definition for method 7 of type cpu-thread
|
|
(defmethod relocate ((this cpu-thread) (offset int))
|
|
(&+! (-> this process) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type process-drawable
|
|
;; WARN: Return type mismatch process vs process-drawable.
|
|
(defmethod relocate ((this process-drawable) (offset int))
|
|
(let ((v1-0 *kernel-context*))
|
|
(set! (-> v1-0 relocating-process) this)
|
|
(set! (-> v1-0 relocating-min) (the-as int (&-> this type)))
|
|
(set! (-> v1-0 relocating-max)
|
|
(the-as int (+ (+ (-> this allocated-length) -4 (-> process size)) (the-as int this)))
|
|
)
|
|
(set! (-> v1-0 relocating-offset) offset)
|
|
)
|
|
(let ((a0-6 (-> this nav)))
|
|
(if (and (nonzero? a0-6) a0-6)
|
|
(relocate a0-6 offset)
|
|
)
|
|
)
|
|
(if (nonzero? (-> this root))
|
|
(&+! (-> this root) offset)
|
|
)
|
|
(if (nonzero? (-> this node-list))
|
|
(&+! (-> this node-list) offset)
|
|
)
|
|
(if (nonzero? (-> this draw))
|
|
(&+! (-> this draw) offset)
|
|
)
|
|
(if (nonzero? (-> this skel))
|
|
(&+! (-> this skel) offset)
|
|
)
|
|
(if (nonzero? (-> this align))
|
|
(&+! (-> this align) offset)
|
|
)
|
|
(if (nonzero? (-> this path))
|
|
(&+! (-> this path) offset)
|
|
)
|
|
(if (nonzero? (-> this vol))
|
|
(&+! (-> this vol) offset)
|
|
)
|
|
(if (nonzero? (-> this fact))
|
|
(&+! (-> this fact) offset)
|
|
)
|
|
(if (nonzero? (-> this link))
|
|
(&+! (-> this link) offset)
|
|
)
|
|
(if (nonzero? (-> this part))
|
|
(&+! (-> this part) offset)
|
|
)
|
|
(if (nonzero? (-> this water))
|
|
(&+! (-> this water) offset)
|
|
)
|
|
(if (nonzero? (-> this sound))
|
|
(&+! (-> this sound) offset)
|
|
)
|
|
(if (nonzero? (-> this carry))
|
|
(&+! (-> this carry) offset)
|
|
)
|
|
(if (nonzero? (-> this rbody))
|
|
(&+! (-> this rbody) offset)
|
|
)
|
|
(the-as process-drawable ((method-of-type process relocate) this offset))
|
|
)
|
|
|
|
;; definition for method 7 of type collide-shape
|
|
(defmethod relocate ((this collide-shape) (offset int))
|
|
(&+! (-> this process) offset)
|
|
(&+! (-> this root-prim) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type collide-shape-moving
|
|
;; WARN: Return type mismatch collide-shape vs collide-shape-moving.
|
|
(defmethod relocate ((this collide-shape-moving) (offset int))
|
|
(if (-> this dynam)
|
|
(&+! (-> this dynam) offset)
|
|
)
|
|
(the-as collide-shape-moving ((method-of-type collide-shape relocate) this offset))
|
|
)
|
|
|
|
;; definition for method 7 of type collide-shape-prim
|
|
(defmethod relocate ((this collide-shape-prim) (offset int))
|
|
(&+! (-> this cshape) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type collide-shape-prim-group
|
|
(defmethod relocate ((this collide-shape-prim-group) (offset int))
|
|
(&+! (-> this cshape) offset)
|
|
(&+! (-> this child) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type fact-info
|
|
(defmethod relocate ((this fact-info) (offset int))
|
|
(&+! (-> this process) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type draw-control
|
|
(defmethod relocate ((this draw-control) (offset int))
|
|
(&+! (-> this skeleton) offset)
|
|
(&+! (-> this process) offset)
|
|
(when (-> this ripple)
|
|
(if (-> this ripple query)
|
|
(&+! (-> this ripple query) offset)
|
|
)
|
|
(&+! (-> this ripple) offset)
|
|
)
|
|
(let ((v1-14 (-> this shadow-ctrl)))
|
|
(if (and (>= (the-as int v1-14) (-> *kernel-context* relocating-min))
|
|
(< (the-as int v1-14) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> this shadow-ctrl) offset)
|
|
)
|
|
)
|
|
(when (-> this cloth-instances)
|
|
(dotimes (v1-21 (-> this cloth-instances length))
|
|
(&+! (-> this cloth-instances v1-21) offset)
|
|
)
|
|
(&+! (-> this cloth-instances) offset)
|
|
)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type joint-control
|
|
(defmethod relocate ((this joint-control) (offset int))
|
|
(if (-> this effect)
|
|
(&+! (-> this effect) offset)
|
|
)
|
|
(if (-> this top-anim)
|
|
(&+! (-> this top-anim) offset)
|
|
)
|
|
(&+! (-> this root-channel) offset)
|
|
(countdown (v1-10 (-> this allocated-length))
|
|
(&+! (-> this channel v1-10 parent) offset)
|
|
)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type cspace-array
|
|
(defmethod relocate ((this cspace-array) (offset int))
|
|
(countdown (v1-0 (-> this length))
|
|
(let ((a2-2 (-> this data v1-0)))
|
|
(if (-> a2-2 parent)
|
|
(&+! (-> a2-2 parent) offset)
|
|
)
|
|
(&+! (-> a2-2 bone) offset)
|
|
(let ((a3-6 (-> a2-2 param1)))
|
|
(if (and (>= (the-as int a3-6) (-> *kernel-context* relocating-min))
|
|
(< (the-as int a3-6) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> a2-2 param1) offset)
|
|
)
|
|
)
|
|
(let ((a3-11 (-> a2-2 param2)))
|
|
(if (and (>= (the-as int a3-11) (-> *kernel-context* relocating-min))
|
|
(< (the-as int a3-11) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> a2-2 param2) offset)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type path-control
|
|
(defmethod relocate ((this path-control) (offset int))
|
|
(&+! (-> this process) offset)
|
|
(let ((v1-2 (-> this curve cverts)))
|
|
(if (and (>= (the-as int v1-2) (-> *kernel-context* relocating-min))
|
|
(< (the-as int v1-2) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> this curve cverts) offset)
|
|
)
|
|
)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type vol-control
|
|
(defmethod relocate ((this vol-control) (offset int))
|
|
(&+! (-> this process) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type water-control
|
|
(defmethod relocate ((this water-control) (offset int))
|
|
(&+! (-> this process) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type actor-link-info
|
|
(defmethod relocate ((this actor-link-info) (offset int))
|
|
(&+! (-> this process) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type align-control
|
|
(defmethod relocate ((this align-control) (offset int))
|
|
(&+! (-> this process) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type joint-mod
|
|
(defmethod relocate ((this joint-mod) (offset int))
|
|
(&+! (-> this process) offset)
|
|
(&+! (-> this joint) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type joint-mod-ik
|
|
(defmethod relocate ((this joint-mod-ik) (offset int))
|
|
(&+! (-> this process) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type effect-control
|
|
(defmethod relocate ((this effect-control) (offset int))
|
|
(&+! (-> this process) offset)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type sparticle-launch-control
|
|
(defmethod relocate ((this sparticle-launch-control) (offset int))
|
|
(&+! (-> this proc) offset)
|
|
(countdown (v1-2 (-> this length))
|
|
(let* ((a0-4 (-> this data v1-2))
|
|
(a2-0 (-> a0-4 center))
|
|
)
|
|
(if (and (>= (the-as int a2-0) (-> *kernel-context* relocating-min))
|
|
(< (the-as int a2-0) (-> *kernel-context* relocating-max))
|
|
)
|
|
(&+! (-> a0-4 center) offset)
|
|
)
|
|
)
|
|
)
|
|
(forall-particles-with-key
|
|
this
|
|
(lambda ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
|
|
(let ((v1-1 (-> *kernel-context* relocating-offset)))
|
|
(set! (-> arg1 key) (the-as sparticle-launch-control (+ (the-as int (-> arg1 key)) v1-1)))
|
|
(if (-> arg1 binding)
|
|
(set! (-> arg1 binding) (the-as sparticle-launch-state (+ (the-as int (-> arg1 binding)) v1-1)))
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
#t
|
|
#t
|
|
)
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type camera-master
|
|
;; WARN: Return type mismatch process vs camera-master.
|
|
(defmethod relocate ((this camera-master) (offset int))
|
|
(if (nonzero? (-> this water-drip))
|
|
(&+! (-> this water-drip) offset)
|
|
)
|
|
(the-as camera-master ((method-of-type process relocate) this offset))
|
|
)
|
|
|
|
;; definition for method 7 of type time-of-day-proc
|
|
;; WARN: Return type mismatch process vs time-of-day-proc.
|
|
(defmethod relocate ((this time-of-day-proc) (offset int))
|
|
(if (nonzero? (-> this sun))
|
|
(&+! (-> this sun) offset)
|
|
)
|
|
(if (nonzero? (-> this green-sun))
|
|
(&+! (-> this green-sun) offset)
|
|
)
|
|
(if (nonzero? (-> this moon))
|
|
(&+! (-> this moon) offset)
|
|
)
|
|
(if (nonzero? (-> this day-star))
|
|
(&+! (-> this day-star) offset)
|
|
)
|
|
(the-as time-of-day-proc ((method-of-type process relocate) this offset))
|
|
)
|
|
|
|
;; definition for method 7 of type part-tracker
|
|
;; WARN: Return type mismatch process vs part-tracker.
|
|
(defmethod relocate ((this part-tracker) (offset int))
|
|
(if (nonzero? (-> this root))
|
|
(&+! (-> this root) offset)
|
|
)
|
|
(if (nonzero? (-> this part))
|
|
(&+! (-> this part) offset)
|
|
)
|
|
(the-as part-tracker ((method-of-type process relocate) this offset))
|
|
)
|
|
|
|
;; definition for method 7 of type part-spawner
|
|
;; WARN: Return type mismatch process vs part-spawner.
|
|
(defmethod relocate ((this part-spawner) (offset int))
|
|
(if (nonzero? (-> this root))
|
|
(&+! (-> this root) offset)
|
|
)
|
|
(if (nonzero? (-> this part))
|
|
(&+! (-> this part) offset)
|
|
)
|
|
(if (nonzero? (-> this path))
|
|
(&+! (-> this path) offset)
|
|
)
|
|
(if (nonzero? (-> this sound))
|
|
(&+! (-> this sound) offset)
|
|
)
|
|
(if (nonzero? (-> this sound-extra))
|
|
(&+! (-> this sound-extra) offset)
|
|
)
|
|
(the-as part-spawner ((method-of-type process relocate) this offset))
|
|
)
|
|
|
|
;; definition for method 7 of type lightning-tracker
|
|
;; WARN: Return type mismatch process vs lightning-tracker.
|
|
(defmethod relocate ((this lightning-tracker) (offset int))
|
|
(if (nonzero? (-> this root))
|
|
(&+! (-> this root) offset)
|
|
)
|
|
(if (nonzero? (-> this lightning))
|
|
(&+! (-> this lightning) offset)
|
|
)
|
|
(the-as lightning-tracker ((method-of-type process relocate) this offset))
|
|
)
|
|
|
|
;; definition for method 7 of type manipy
|
|
;; WARN: Return type mismatch process-drawable vs manipy.
|
|
(defmethod relocate ((this manipy) (offset int))
|
|
(if (nonzero? (-> this joint 0))
|
|
(&+! (-> this joint 0) offset)
|
|
)
|
|
(if (nonzero? (-> this joint 1))
|
|
(&+! (-> this joint 1) offset)
|
|
)
|
|
(if (nonzero? (-> this joint 2))
|
|
(&+! (-> this joint 2) offset)
|
|
)
|
|
(if (nonzero? (-> this joint 3))
|
|
(&+! (-> this joint 3) offset)
|
|
)
|
|
(the-as manipy ((method-of-type process-drawable relocate) this offset))
|
|
)
|
|
|
|
|
|
|
|
|