Files
jak-project/goal_src/jak2/engine/util/script-h.gc
T
Tyler Wilding 82e0517275 d/jak2: get script decompiling, no ref tests yet (#1877)
Has boxed array accessing that prevents me from adding anything to ref
tests (the entire file is lambdas so the access pattern that i would
like to ignore happens at the top-level, can't ignore it.

This code actually already has quite a bit of original docstrings so
it's not too bad in that regard considering a `script-context` can have
16 arbitrary objects. It seems they rarely put more than a single object
in the context and the types are usually obvious / are actually type
checked!
2022-09-14 19:37:12 -04:00

83 lines
2.4 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: script-h.gc
;; name in dgo: script-h
;; dgos: ENGINE, GAME
(define-extern *load-state* load-state)
;; NOTE - for editable-player
(declare-type script-context structure)
(define-extern *syntax-context* script-context)
(define-extern *script-context* script-context)
;; NOTE - for menu
(define-extern command-get-int (function object int int))
(define-extern command-get-float (function object float float))
;; DECOMP BEGINS
(deftype script-form (structure)
((name symbol :offset-assert 0)
(spec pair :offset-assert 4)
(func (function script-context object) :offset-assert 8)
)
:pack-me
:method-count-assert 10
:size-assert #xc
:flag-assert #xa0000000c
(:methods
(script-form-method-9 () none 9)
)
)
(deftype script-context (structure)
((load-state load-state :offset-assert 0)
(key basic :offset-assert 4)
(process process :offset-assert 8)
(trans vector :offset-assert 12)
(side-effect? symbol :offset-assert 16)
(got-error? symbol :offset-assert 20)
(expr pair :offset-assert 24)
(param-count int32 :offset-assert 28)
(param object 16 :offset-assert 32)
(param-type object 16 :offset-assert 96)
)
:method-count-assert 12
:size-assert #xa0
:flag-assert #xc000000a0
(:methods
(new (symbol type basic process vector) _type_ 0)
(eval! (_type_ object) object 9)
(script-context-method-10 (_type_ object pair) object 10)
(script-context-method-11 (_type_ pair pair symbol) symbol 11)
)
)
;; WARN: Return type mismatch structure vs script-context.
(defmethod new script-context ((allocation symbol) (type-to-make type) (arg0 basic) (arg1 process) (arg2 vector))
(let ((t9-0 (method-of-type structure new))
(v1-1 type-to-make)
)
(-> type-to-make size)
(let ((v0-0 (t9-0 allocation v1-1)))
(set! (-> (the-as script-context v0-0) key) arg0)
(set! (-> (the-as script-context v0-0) process) arg1)
(set! (-> (the-as script-context v0-0) load-state) *load-state*)
(set! (-> (the-as script-context v0-0) side-effect?) #t)
(set! (-> (the-as script-context v0-0) got-error?) #f)
(set! (-> (the-as script-context v0-0) trans) arg2)
(the-as script-context v0-0)
)
)
)
0