Skip to content

Commit

Permalink
[jak3] More headers! (#3351)
Browse files Browse the repository at this point in the history
Decomp aligner-h, joint-h, prim-h, debug-h, game-h, penetrate-h,
bones-h, foreground-h, scene-h, script-h.

Also, has a little bit of the joint-mod-h file, but it's not finished
yet.
  • Loading branch information
water111 authored Feb 1, 2024
1 parent ea93d32 commit 1cccfbb
Show file tree
Hide file tree
Showing 32 changed files with 4,620 additions and 531 deletions.
1,089 changes: 607 additions & 482 deletions decompiler/config/jak3/all-types.gc

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion decompiler/config/jak3/ntsc_v1/type_casts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,12 @@
[8, "v1", "pointer"],
[[9, 11], "v1", "touching-prims-entry"],
[[1, 20], "a1", "touching-prims-entry"]
]
],
"(method 0 prim-strip)": [[[101, 121], "a0", "vector"]],
"(method 0 script-context)": [[[8, 17], "v0", "script-context"]],
"joint-mod-spinner-callback": [[[2, 63], "gp", "joint-mod-spinner"]],
"joint-mod-rotate-local-callback": [
[[2, 16], "v1", "joint-mod-rotate-local"]
],
"joint-mod-rotate-world-callback": [[[0, 24], "s3", "joint-mod-rotate-world"]]
}
3 changes: 3 additions & 0 deletions decompiler/config/jak3/ntsc_v1/var_names.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -728,5 +728,8 @@
"a1-0": "current",
"a2-0": "next"
}
},
"(method 0 prim-strip)": {
"args": ["allocation", "type-to-make", "num-vertices", "tex-id", "tex-name"]
}
}
44 changes: 44 additions & 0 deletions goal_src/jak3/engine/anim/aligner-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,49 @@
;; name in dgo: aligner-h
;; dgos: GAME

(defenum align-flags
:bitfield #t
:type uint32
(disabled) ;; keep object velocity
(af01)
(af02)
(af03)
(af04)
(af05)
)

;; DECOMP BEGINS

(deftype align-control (basic)
((flags align-flags)
(process process-drawable)
(frame-group art-joint-anim)
(frame-num float)
(matrix matrix 2 :inline)
(transform transform 2 :inline)
(delta transformq :inline)
(last-speed meters)
(align transformq :inline :overlay-at (-> transform 0 trans data 0))
)
(:methods
(new (symbol type process) _type_)
(align-control-method-9 () none)
(align-control-method-10 () none)
(align-control-method-11 () none)
(align-control-method-12 () none)
(align-control-method-13 () none)
)
)


;; WARN: Return type mismatch object vs align-control.
(defmethod new align-control ((allocation symbol) (type-to-make type) (arg0 process))
(let ((v0-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size))))))
(when (zero? (the-as align-control v0-0))
(go process-drawable-art-error "memory")
(return (the-as align-control 0))
)
(set! (-> (the-as align-control v0-0) process) (the-as process-drawable arg0))
(the-as align-control v0-0)
)
)
142 changes: 142 additions & 0 deletions goal_src/jak3/engine/anim/joint-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,147 @@
;; name in dgo: joint-h
;; dgos: GAME

(declare-type joint-control basic)

(defenum joint-control-command
:type uint64
(push 1)
(blend 2)
(push1 19)
(stack 36)
(float 42)
(stack1 52)
)

(defenum joint-control-status
:type uint16
:bitfield #t

(sync-math 0) ;; 1
(spooling 1) ;; 2
(spooling-not-last-block 2) ;; 4
(blend-shape 3) ;; 8
(math-when-off-screen 4) ;; 16
(valid-spooled-frame 5) ;; 32
(blend-shape-valid 6) ;; 64
(eye-anim-valid 7) ;; 128
(eye-anim 8) ;; 256
(force-math 9)
(no-joint-callbacks 10)
)

(declare-type effect-control basic)

;; DECOMP BEGINS

(deftype joint-control-channel (structure)
((parent joint-control)
(frame-group art-joint-anim)
(frame-num float)
(dist meters)
(num-func (function joint-control-channel float float float float))
(param float 3)
(frame-interp float 2)
(inspector-amount uint8)
(command joint-control-command)
(group-sub-index int8)
(group-size int8)
(eval-time uint32)
)
)


(deftype top-anim-joint-control (basic)
((process (pointer process-drawable))
(interp-select uint64 2)
(base-anim basic)
(base-anim-speed float)
(base-anim-blend float)
(interp float)
(frame-group art-joint-anim)
(frame-group-push art-joint-anim)
(frame-num float)
(frame-targ art-joint-anim)
(frame-speed float)
(frame-blend float)
(frame-cur-blend float)
(frame-start float)
(frame-post-blend float)
(frame-post-end float)
(frame-push-time time-frame)
(frame-post-put-away basic)
(update-time time-frame)
)
(:methods
(new (symbol type) _type_)
(top-anim-joint-control-method-9 () none)
(top-anim-joint-control-method-10 () none)
(top-anim-joint-control-method-11 () none)
(top-anim-joint-control-method-12 () none)
)
)


(deftype joint-control (basic)
((status joint-control-status)
(allocated-length uint8)
(active-channels uint8)
(root-channel (inline-array joint-control-channel) :offset 16)
(blend-index uint8)
(active-frame-interp uint8)
(float-channels uint8)
(generate-frame-function (function joint-anim-frame int joint-control int))
(prebind-function (function joint-anim-frame int joint-control int))
(postbind-function (function draw-control cspace-array joint-control none))
(effect effect-control)
(interp-select int64 2)
(top-anim top-anim-joint-control)
(override (array float))
(channel joint-control-channel :dynamic)
)
(:methods
(new (symbol type) _type_)
(joint-control-method-9 () none)
(joint-control-method-10 () none)
(joint-control-method-11 () none)
(joint-control-method-12 () none)
)
)


(deftype matrix-stack (structure)
((top matrix)
(data matrix 24 :inline)
)
)


(deftype channel-upload-info (structure)
((fixed joint-anim-compressed-fixed)
(fixed-qwc int32)
(frame joint-anim-compressed-frame)
(frame-qwc int32)
(amount float)
(interp float)
)
:pack-me
)


(deftype joint-work (structure)
((temp-mtx matrix :inline)
(joint-stack matrix-stack :inline)
(fix-jmp-table (function none) 16)
(frm-jmp-table (function none) 16)
(pair-jmp-table (function none) 16)
(uploads channel-upload-info 24 :inline)
(num-uploads int32)
(mtx-acc matrix 2 :inline)
(tq-acc transformq 100 :inline)
(jacp-hdr joint-anim-compressed-hdr :inline)
(fixed-data joint-anim-compressed-fixed :inline)
(frame-data joint-anim-compressed-frame 2 :inline)
(flatten-array float 576 :overlay-at mtx-acc)
(flattened vector 24 :inline :overlay-at mtx-acc)
)
)
2 changes: 1 addition & 1 deletion goal_src/jak3/engine/anim/mspace-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The callback function is used to take the joint transforms out of the joint anim


(deftype cspace-array (inline-array-class)
((data cspace :dynamic)
((data cspace :inline :dynamic)
)
)

Expand Down
49 changes: 48 additions & 1 deletion goal_src/jak3/engine/collide/collide-shape-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t
(nav-flags uint8)
(total-prims uint8)
(num-riders uint8)
(pat-ignore-mask pat-surface)
(event-self symbol :offset 152)
(event-other symbol)
(root-prim collide-shape-prim)
Expand Down Expand Up @@ -398,7 +399,53 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t
(the-as int (-> this num-children))
)

;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod new collide-shape ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 collide-list-enum))
(let ((s5-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> s5-0 actor-hash-index) -1)
(set! (-> s5-0 process) arg0)
(set! (-> s5-0 max-iteration-count) (the-as uint 1))
(set! (-> s5-0 nav-flags) (the-as uint 1))
(set! (-> s5-0 event-self) #f)
(set! (-> s5-0 event-other) #f)
(set! (-> s5-0 riders) (the-as (inline-array collide-rider) #f))
(set! (-> s5-0 root-prim) #f)
(set! (-> s5-0 penetrate-using) (penetrate))
(set! (-> s5-0 penetrated-by) (penetrate))
(set! (-> s5-0 event-priority) (the-as uint 0))
(set! (-> s5-0 rider-max-momentum) 409600.0)
(case (-> arg0 type symbol)
(('camera)
(set! (-> s5-0 pat-ignore-mask) (new 'static 'pat-surface :nocamera #x1 :probe #x1 :noendlessfall #x1))
)
(('target)
(set! (-> s5-0 pat-ignore-mask) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :board #x1))
)
(else
(set! (-> s5-0 pat-ignore-mask)
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
)
)
)
(set! (-> s5-0 trans w) 1.0)
(quaternion-identity! (the-as quaternion (-> s5-0 rot)))
(vector-identity! (-> s5-0 scale))
(cond
((= arg1 (collide-list-enum hit-by-player))
(add-connection *collide-hit-by-player-list* arg0 #f s5-0 #f #f)
)
((= arg1 (collide-list-enum usually-hit-by-player))
(add-connection *collide-hit-by-others-list* arg0 #f s5-0 #f #f)
)
((= arg1 (collide-list-enum hit-by-others))
(add-connection *collide-player-list* arg0 #f s5-0 #f #f)
)
(else
(format 0 "Unsupported collide-list-enum in collide-shape constructor!~%")
)
)
s5-0
)
)

;; WARN: Return type mismatch collide-shape vs collide-shape-moving.
(defmethod new collide-shape-moving ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 collide-list-enum))
Expand Down
Loading

0 comments on commit 1cccfbb

Please sign in to comment.