mirror of
https://github.com/open-goal/jak-project
synced 2026-08-18 05:48:28 -04:00
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!
This commit is contained in:
+3
-3
@@ -20,10 +20,10 @@
|
||||
:flag-assert #xe00000018
|
||||
(:methods
|
||||
(talker-speech-class-method-9 () none 9)
|
||||
(talker-speech-class-method-10 () none 10)
|
||||
(talker-speech-class-method-10 (_type_) none 10)
|
||||
(talker-speech-class-method-11 () none 11)
|
||||
(talker-speech-class-method-12 () none 12)
|
||||
(talker-speech-class-method-13 () none 13)
|
||||
(talker-speech-class-method-12 (_type_ int) none 12)
|
||||
(talker-speech-class-method-13 (_type_ int) none 13)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -2005,7 +2005,7 @@
|
||||
(when s4-0
|
||||
(let ((gp-1 (-> arg3 param 0)))
|
||||
(set! (-> *syntax-context* got-error?) #f)
|
||||
(eval! *syntax-context* (the-as structure gp-1))
|
||||
(eval! *syntax-context* gp-1)
|
||||
(when (not (-> *syntax-context* got-error?))
|
||||
(set! (-> s4-0 changed) #t)
|
||||
(cond
|
||||
|
||||
+18
-1
@@ -684,7 +684,24 @@
|
||||
)
|
||||
|
||||
;; definition for function debug-menu-func-decode
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
;; WARN: Return type mismatch object vs function.
|
||||
;; WARN: Using new Jak 2 rtype-of
|
||||
(defun debug-menu-func-decode ((arg0 object))
|
||||
(let ((v1-2 (rtype-of arg0)))
|
||||
(the-as function (cond
|
||||
((or (= v1-2 symbol) (= v1-2 type))
|
||||
(-> (the-as symbol arg0) value)
|
||||
)
|
||||
((= v1-2 function)
|
||||
arg0
|
||||
)
|
||||
(else
|
||||
nothing
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function debug-menu-make-from-template
|
||||
;; INFO: Used lq/sq
|
||||
|
||||
+2
-2
@@ -231,7 +231,7 @@
|
||||
:flag-assert #x1b00000034
|
||||
(:methods
|
||||
(entity-method-22 (_type_) _type_ 22)
|
||||
(entity-method-23 (_type_) _type_ 23)
|
||||
(kill! (_type_) _type_ 23)
|
||||
(entity-method-24 () none 24)
|
||||
(entity-method-25 () none 25)
|
||||
(entity-method-26 () none 26)
|
||||
@@ -288,7 +288,7 @@
|
||||
(next-actor (_type_) entity-actor 27)
|
||||
(prev-actor (_type_) entity-actor 28)
|
||||
(entity-actor-method-29 () none 29)
|
||||
(entity-actor-method-30 () none 30)
|
||||
(entity-actor-method-30 (_type_ entity-perm-status symbol) none 30)
|
||||
(entity-actor-method-31 (_type_ vector vector vector object float) nav-mesh 31)
|
||||
(entity-actor-method-32 (_type_ vector vector nav-poly float) nav-poly 32)
|
||||
)
|
||||
|
||||
+2
-2
@@ -131,7 +131,7 @@
|
||||
(want-display-level (_type_ symbol symbol) int 13)
|
||||
(want-vis-level (_type_ symbol) none 14)
|
||||
(want-force-vis (_type_ symbol symbol) int 15)
|
||||
(execute-command (_type_ pair) none 16)
|
||||
(execute-command (_type_ pair object) none 16)
|
||||
(execute-commands-up-to (_type_ float) none 17)
|
||||
(backup-load-state-and-set-cmds (_type_ pair) int 18)
|
||||
(restore-load-state-and-cleanup (_type_) int 19)
|
||||
@@ -335,7 +335,7 @@
|
||||
(game-info-method-18 () none 18)
|
||||
(get-current-continue-point (_type_) continue-point 19)
|
||||
(get-continue-by-name (_type_ string) continue-point 20)
|
||||
(set-continue! (_type_ basic) continue-point 21)
|
||||
(set-continue! (_type_ basic symbol) continue-point 21)
|
||||
(game-info-method-22 () none 22)
|
||||
(game-info-method-23 () none 23)
|
||||
(game-info-method-24 () none 24)
|
||||
|
||||
+1
-1
@@ -560,7 +560,7 @@
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
(add-setting (_type_ process symbol object object object) none 9)
|
||||
(persist-with-delay (_type_ process time-frame object object float object) none 10)
|
||||
(persist-with-delay (_type_ symbol time-frame symbol symbol float int) none 10)
|
||||
(set-setting (_type_ process symbol object object object) none 11)
|
||||
(remove-setting (_type_ process symbol) none 12)
|
||||
(kill-persister (_type_ engine-pers object) none 13)
|
||||
|
||||
+3
-8
@@ -806,6 +806,7 @@
|
||||
;; definition for method 9 of type setting-control
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod add-setting setting-control ((obj setting-control) (arg0 process) (arg1 symbol) (arg2 object) (arg3 object) (arg4 object))
|
||||
"Originally called `setting-set` see (anon-function 48 script)"
|
||||
(add-connection (-> obj engine) arg0 arg1 arg2 arg3 arg4)
|
||||
0
|
||||
(none)
|
||||
@@ -822,14 +823,8 @@
|
||||
|
||||
;; definition for method 10 of type setting-control
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod persist-with-delay setting-control ((obj setting-control)
|
||||
(arg0 process)
|
||||
(arg1 time-frame)
|
||||
(arg2 object)
|
||||
(arg3 object)
|
||||
(arg4 float)
|
||||
(arg5 object)
|
||||
)
|
||||
(defmethod persist-with-delay setting-control ((obj setting-control) (arg0 symbol) (arg1 time-frame) (arg2 symbol) (arg3 symbol) (arg4 float) (arg5 int))
|
||||
"Originally called `setting-pers` see (anon-function 46 script)"
|
||||
(let ((v1-1 (schedule-callback (-> obj engine-pers) arg0 arg1)))
|
||||
(when v1-1
|
||||
(set! (-> v1-1 param 0) arg2)
|
||||
|
||||
+50
-52
@@ -687,68 +687,66 @@
|
||||
|
||||
;; definition for function sound-play-by-name
|
||||
;; INFO: Used lq/sq
|
||||
(defun sound-play-by-name ((arg0 sound-name) (arg1 sound-id) (arg2 int) (arg3 int) (arg4 int) (arg5 sound-group) (arg6 symbol))
|
||||
(defbehavior sound-play-by-name process-drawable ((arg0 sound-name) (arg1 sound-id) (arg2 int) (arg3 int) (arg4 int) (arg5 sound-group) (arg6 object))
|
||||
"Last arg can by a symbol with value [[#t]], in which case it will pull `trans` [[vector]] off the current [[process-drawable]]
|
||||
otherwise, an explicit [[vector]] can be provided"
|
||||
(local-vars (sv-16 sound-group))
|
||||
(with-pp
|
||||
(set! sv-16 arg5)
|
||||
(let ((s4-0 (the-as object arg6)))
|
||||
(when *sound-player-enable*
|
||||
(let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry))))
|
||||
(set! (-> s5-0 command) (sound-command play))
|
||||
(set! (-> s5-0 id) arg1)
|
||||
(set! (-> s5-0 name) arg0)
|
||||
(set! (-> s5-0 params mask) (the-as uint 0))
|
||||
(set! (-> s5-0 params group) (the-as uint sv-16))
|
||||
(set! (-> s5-0 params volume) arg2)
|
||||
(set! (-> s5-0 params pitch-mod) arg3)
|
||||
(set! (-> s5-0 params bend) arg4)
|
||||
(let ((s3-1 (the-as process-drawable pp)))
|
||||
(when (= (the-as symbol s4-0) #t)
|
||||
(if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root)))
|
||||
(set! s4-0 (-> s3-1 root trans))
|
||||
(set! s4-0 #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (the-as vector3w (-> s5-0 params trans)) (the-as vector s4-0))
|
||||
)
|
||||
)
|
||||
)
|
||||
arg1
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function sound-play-by-spec
|
||||
;; INFO: Used lq/sq
|
||||
(defun sound-play-by-spec ((arg0 sound-spec) (arg1 sound-id) (arg2 vector))
|
||||
(with-pp
|
||||
(set! sv-16 arg5)
|
||||
(let ((s4-0 arg6))
|
||||
(when *sound-player-enable*
|
||||
(let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry))))
|
||||
(set! (-> s5-0 command) (sound-command play))
|
||||
(set! (-> s5-0 id) arg1)
|
||||
(set! (-> s5-0 name) (-> arg0 sound-name))
|
||||
(set! (-> s5-0 params mask) (the-as uint (-> arg0 mask)))
|
||||
(set! (-> s5-0 params group-and-regs) (-> arg0 group-and-regs))
|
||||
(set! (-> s5-0 params volume) (-> arg0 volume))
|
||||
(set! (-> s5-0 params pitch-mod) (-> arg0 pitch-mod))
|
||||
(set! (-> s5-0 params bend) (-> arg0 bend))
|
||||
(set! (-> s5-0 params fo-min) (-> arg0 fo-min))
|
||||
(set! (-> s5-0 params fo-max) (-> arg0 fo-max))
|
||||
(set! (-> s5-0 params fo-curve) (-> arg0 fo-curve))
|
||||
(set! (-> s5-0 params priority) (-> arg0 priority))
|
||||
(let ((s3-1 (the-as process-drawable pp)))
|
||||
(when (= arg2 #t)
|
||||
(set! (-> s5-0 name) arg0)
|
||||
(set! (-> s5-0 params mask) (the-as uint 0))
|
||||
(set! (-> s5-0 params group) (the-as uint sv-16))
|
||||
(set! (-> s5-0 params volume) arg2)
|
||||
(set! (-> s5-0 params pitch-mod) arg3)
|
||||
(set! (-> s5-0 params bend) arg4)
|
||||
(let ((s3-1 self))
|
||||
(when (= s4-0 #t)
|
||||
(if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root)))
|
||||
(set! arg2 (-> s3-1 root trans))
|
||||
(set! arg2 (the-as vector #f))
|
||||
(set! s4-0 (-> s3-1 root trans))
|
||||
(set! s4-0 #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (the-as vector3w (-> s5-0 params trans)) arg2)
|
||||
(sound-trans-convert (the-as vector3w (-> s5-0 params trans)) (the-as vector s4-0))
|
||||
)
|
||||
)
|
||||
arg1
|
||||
)
|
||||
arg1
|
||||
)
|
||||
|
||||
;; definition for function sound-play-by-spec
|
||||
;; INFO: Used lq/sq
|
||||
(defbehavior sound-play-by-spec process-drawable ((arg0 sound-spec) (arg1 sound-id) (arg2 vector))
|
||||
(when *sound-player-enable*
|
||||
(let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry))))
|
||||
(set! (-> s5-0 command) (sound-command play))
|
||||
(set! (-> s5-0 id) arg1)
|
||||
(set! (-> s5-0 name) (-> arg0 sound-name))
|
||||
(set! (-> s5-0 params mask) (the-as uint (-> arg0 mask)))
|
||||
(set! (-> s5-0 params group-and-regs) (-> arg0 group-and-regs))
|
||||
(set! (-> s5-0 params volume) (-> arg0 volume))
|
||||
(set! (-> s5-0 params pitch-mod) (-> arg0 pitch-mod))
|
||||
(set! (-> s5-0 params bend) (-> arg0 bend))
|
||||
(set! (-> s5-0 params fo-min) (-> arg0 fo-min))
|
||||
(set! (-> s5-0 params fo-max) (-> arg0 fo-max))
|
||||
(set! (-> s5-0 params fo-curve) (-> arg0 fo-curve))
|
||||
(set! (-> s5-0 params priority) (-> arg0 priority))
|
||||
(let ((s3-1 self))
|
||||
(when (= arg2 #t)
|
||||
(if (and s3-1 (type? s3-1 process-drawable) (nonzero? (-> s3-1 root)))
|
||||
(set! arg2 (-> s3-1 root trans))
|
||||
(set! arg2 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (the-as vector3w (-> s5-0 params trans)) arg2)
|
||||
)
|
||||
)
|
||||
arg1
|
||||
)
|
||||
|
||||
;; definition for function sound-pause
|
||||
@@ -1023,7 +1021,7 @@
|
||||
(-> obj pitch)
|
||||
0
|
||||
(sound-group sfx)
|
||||
(the-as symbol (-> obj trans))
|
||||
(-> obj trans)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1037,7 +1035,7 @@
|
||||
(-> obj pitch)
|
||||
0
|
||||
(sound-group sfx)
|
||||
(the-as symbol (-> obj trans))
|
||||
(-> obj trans)
|
||||
)
|
||||
)
|
||||
(set! (-> obj play-time)
|
||||
|
||||
+1
-6
@@ -3293,12 +3293,7 @@
|
||||
(if (not arg0)
|
||||
(set! arg0 (get-current-continue-point *game-info*))
|
||||
)
|
||||
(let* ((a0-6 *game-info*)
|
||||
(t9-4 (method-of-object a0-6 set-continue!))
|
||||
(a1-3 arg0)
|
||||
)
|
||||
(t9-4 a0-6 a1-3)
|
||||
)
|
||||
(set-continue! *game-info* arg0 #f)
|
||||
(stack-size-set! (-> obj main-thread) 1024)
|
||||
(logior! (-> obj mask) (process-mask target))
|
||||
(set! (-> obj state-hook) (the-as (function none :behavior target) nothing))
|
||||
|
||||
+8
-7
@@ -3,10 +3,11 @@
|
||||
|
||||
;; definition of type script-form
|
||||
(deftype script-form (structure)
|
||||
((name string :offset-assert 0)
|
||||
(spec basic :offset-assert 4)
|
||||
(func basic :offset-assert 8)
|
||||
((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
|
||||
@@ -37,7 +38,7 @@
|
||||
(trans vector :offset-assert 12)
|
||||
(side-effect? symbol :offset-assert 16)
|
||||
(got-error? symbol :offset-assert 20)
|
||||
(expr basic :offset-assert 24)
|
||||
(expr pair :offset-assert 24)
|
||||
(param-count int32 :offset-assert 28)
|
||||
(param object 16 :offset-assert 32)
|
||||
(param-type object 16 :offset-assert 96)
|
||||
@@ -47,9 +48,9 @@
|
||||
:flag-assert #xc000000a0
|
||||
(:methods
|
||||
(new (symbol type basic process vector) _type_ 0)
|
||||
(eval! (_type_ structure) pair 9)
|
||||
(script-context-method-10 () none 10)
|
||||
(script-context-method-11 () none 11)
|
||||
(eval! (_type_ object) object 9)
|
||||
(script-context-method-10 (_type_ object pair) object 10)
|
||||
(script-context-method-11 (_type_ pair pair symbol) symbol 11)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+13
-10
@@ -251,7 +251,7 @@
|
||||
)
|
||||
(and (eval!
|
||||
(new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f))
|
||||
(the-as structure (-> obj open-test))
|
||||
(-> obj open-test)
|
||||
)
|
||||
(-> *setting-control* user-current airlock)
|
||||
)
|
||||
@@ -306,7 +306,7 @@
|
||||
(set! s4-0 (-> ctywide borrow-level 1))
|
||||
)
|
||||
(set! s3-0 (cdr s3-0))
|
||||
(set! s2-0 (car s3-0))
|
||||
(set! s2-0 (car (the-as pair s3-0)))
|
||||
)
|
||||
)
|
||||
(when s4-0
|
||||
@@ -327,7 +327,7 @@
|
||||
)
|
||||
)
|
||||
(set! gp-1 (cdr gp-1))
|
||||
(set! a1-7 (car gp-1))
|
||||
(set! a1-7 (car (the-as pair gp-1)))
|
||||
)
|
||||
)
|
||||
#t
|
||||
@@ -346,7 +346,7 @@
|
||||
(return #f)
|
||||
(label cfg-50)
|
||||
(set! v1-33 (cdr v1-33))
|
||||
(set! a0-11 (car v1-33))
|
||||
(set! a0-11 (car (the-as pair v1-33)))
|
||||
)
|
||||
)
|
||||
#t
|
||||
@@ -613,12 +613,15 @@
|
||||
(eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-0)
|
||||
)
|
||||
)
|
||||
(when (-> self were-behind?)
|
||||
(let ((gp-1 (res-lump-struct (-> self entity) 'on-inside structure)))
|
||||
(set! (-> self were-behind?) #f)
|
||||
(if (and gp-1 (not *scene-player*))
|
||||
(eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-1)
|
||||
)
|
||||
(the-as
|
||||
pair
|
||||
(when (-> self were-behind?)
|
||||
(let ((gp-1 (res-lump-struct (-> self entity) 'on-inside structure)))
|
||||
(set! (-> self were-behind?) #f)
|
||||
(if (and gp-1 (not *scene-player*))
|
||||
(eval! (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) gp-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user