From 4dd0c8bf2cd3bf30591dbdbb046f551a78ad8ca4 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sun, 14 Aug 2022 23:23:30 -0400 Subject: [PATCH 01/23] ref: update pad_REF (#1761) --- test/decompiler/reference/jak1/engine/ps2/pad_REF.gc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc b/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc index 3071e8b4a9..cd1638ab7f 100644 --- a/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc +++ b/test/decompiler/reference/jak1/engine/ps2/pad_REF.gc @@ -140,11 +140,11 @@ ;; definition of type cpad-list (deftype cpad-list (basic) ((num-cpads int32 :offset-assert 4) - (cpads cpad-info 2 :offset-assert 8) + (cpads cpad-info 4 :offset-assert 8) ) :method-count-assert 9 - :size-assert #x10 - :flag-assert #x900000010 + :size-assert #x18 + :flag-assert #x900000018 (:methods (new (symbol type) _type_ 0) ) From dee8feb00333f3510dd6900656d56d4a619dba96 Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Mon, 15 Aug 2022 23:46:29 +0100 Subject: [PATCH 02/23] fix a game bug and add a new compiler feature (#1758) * dont crash on inline static value array * [goalc] add support for non-static inline arrays of values * add a kernel group to jak1 * move and cleanup pc debug code * random cleanup in `hud-classes` * pc port fix for gondola spools * format * address feedback (wow it was actually just changing 1 line all along...) * minor decomp cleanup * ref test --- decompiler/config/all-types.gc | 2 +- goal_src/goal-lib.gc | 5 ++ goal_src/jak1/engine/gfx/hw/display-h.gc | 9 +++ goal_src/jak1/engine/target/target-death.gc | 25 ++------ goal_src/jak1/engine/ui/hud-classes.gc | 41 +++---------- goal_src/jak1/examples/display-all-colors.gc | 61 ------------------- goal_src/jak1/game.gp | 8 +++ goal_src/jak1/levels/village3/village3-obs.gc | 10 ++- goal_src/jak1/pc/util/display-font-color.gc | 52 ++++++++++++++++ .../{pc_debug => pc/util}/font-encode-test.gc | 39 +++++------- .../{pc_debug => pc/util}/pc-pad-utils.gc | 14 ++--- goalc/compiler/compilation/Static.cpp | 8 ++- goalc/compiler/compilation/Type.cpp | 11 ++-- .../jak1/engine/target/target-death_REF.gc | 26 ++------ 14 files changed, 134 insertions(+), 177 deletions(-) delete mode 100644 goal_src/jak1/examples/display-all-colors.gc create mode 100644 goal_src/jak1/pc/util/display-font-color.gc rename goal_src/jak1/{pc_debug => pc/util}/font-encode-test.gc (66%) rename goal_src/jak1/{pc_debug => pc/util}/pc-pad-utils.gc (95%) diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index ec87b74519..d4ff86ae98 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -21051,7 +21051,7 @@ (define-extern death-movie-remap (function int int int)) (define-extern pov-camera-init-by-other (function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) ;; TODO - not confirmed -- sunken-elevator (define-extern target-hit-effect (function attack-info none :behavior target)) -(define-extern target-hit-setup-anim (function attack-info object :behavior target)) +(define-extern target-hit-setup-anim (function attack-info none :behavior target)) (define-extern target-hit-move (function attack-info symbol (function none :behavior target) float none :behavior target)) (define-extern target-hit-orient (function attack-info vector symbol :behavior target)) (define-extern target-hit-push (function vector matrix float float attack-info object :behavior target)) diff --git a/goal_src/goal-lib.gc b/goal_src/goal-lib.gc index 226c131d1f..b5e08c8602 100644 --- a/goal_src/goal-lib.gc +++ b/goal_src/goal-lib.gc @@ -878,6 +878,11 @@ `(make-group "iso") ) +(defmacro mkr () + "Make kernel" + `(make-group "kernel") + ) + (defmacro mng () "Make engine" `(make-group "engine") diff --git a/goal_src/jak1/engine/gfx/hw/display-h.gc b/goal_src/jak1/engine/gfx/hw/display-h.gc index deaff89224..680d02d2ba 100644 --- a/goal_src/jak1/engine/gfx/hw/display-h.gc +++ b/goal_src/jak1/engine/gfx/hw/display-h.gc @@ -246,3 +246,12 @@ (defmacro real-current-time () `(-> *display* real-frame-counter) ) + + +;; debug stuff really +(defmacro get-screen-x (frac) + `(the int (* ,frac 512))) + +(defmacro get-screen-y (frac) + `(the int (* ,frac 224))) + diff --git a/goal_src/jak1/engine/target/target-death.gc b/goal_src/jak1/engine/target/target-death.gc index 1327aee2fe..3df6095d27 100644 --- a/goal_src/jak1/engine/target/target-death.gc +++ b/goal_src/jak1/engine/target/target-death.gc @@ -714,25 +714,13 @@ (('back) (when (not (ja-group? eichar-hit-from-back-ja)) (ja-channel-push! 1 (seconds 0.075)) - (let ((gp-1 (-> self skel root-channel 0))) - (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim eichar-hit-from-back-ja) num-func-identity) - (let ((f0-0 0.0)) - (set! (-> gp-1 frame-num) f0-0) - f0-0 - ) - ) + (ja :group! eichar-hit-from-back-ja :num! min) ) ) (('up 'up-forward) (when (not (ja-group? eichar-hit-up-ja)) (ja-channel-push! 1 (seconds 0.075)) - (let ((gp-2 (-> self skel root-channel 0))) - (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim eichar-hit-up-ja) num-func-identity) - (let ((f0-1 0.0)) - (set! (-> gp-2 frame-num) f0-1) - f0-1 - ) - ) + (ja :group! eichar-hit-up-ja :num! min) ) ) (('air 'jump) @@ -752,16 +740,11 @@ (else (when (not (ja-group? eichar-hit-from-front-ja)) (ja-channel-push! 1 (seconds 0.075)) - (let ((gp-5 (-> self skel root-channel 0))) - (joint-control-channel-group-eval! gp-5 (the-as art-joint-anim eichar-hit-from-front-ja) num-func-identity) - (let ((f0-10 0.0)) - (set! (-> gp-5 frame-num) f0-10) - f0-10 - ) - ) + (ja :group! eichar-hit-from-front-ja :num! min) ) ) ) + (none) ) (defbehavior target-hit-move target ((arg0 attack-info) (arg1 symbol) (arg2 (function none :behavior target)) (arg3 float)) diff --git a/goal_src/jak1/engine/ui/hud-classes.gc b/goal_src/jak1/engine/ui/hud-classes.gc index a56ce2661e..3aa4a02483 100644 --- a/goal_src/jak1/engine/ui/hud-classes.gc +++ b/goal_src/jak1/engine/ui/hud-classes.gc @@ -742,38 +742,17 @@ (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) - (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) - (gp-0 (-> s5-0 base)) - ) - (let ((s4-0 draw-string-xy)) - (format (clear *temp-string*) "~D" (-> obj value)) - (s4-0 - *temp-string* - s5-0 - (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset))) - (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) - (the int (-> *video-parms* relative-y-scale)) + (with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) + (bucket-id debug)) + (draw-string-xy (string-format "~D" (-> obj value)) buf + (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset))) + (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) + (the int (-> *video-parms* relative-y-scale)) + ) + 2 ) - 2 - ) - (font-color dark-yellow) - (font-flags shadow kerning large) - ) - ) - (let ((a3-7 (-> s5-0 base))) - (let ((v1-8 (the-as dma-packet (-> s5-0 base)))) - (set! (-> v1-8 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-8 vif0) (new 'static 'vif-tag)) - (set! (-> v1-8 vif1) (new 'static 'vif-tag)) - (set! (-> s5-0 base) (&+ (the-as pointer v1-8) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id debug) - gp-0 - (the-as (pointer dma-tag) a3-7) - ) - ) + (font-color dark-yellow) + (font-flags shadow kerning large)) ) 0 (none) diff --git a/goal_src/jak1/examples/display-all-colors.gc b/goal_src/jak1/examples/display-all-colors.gc deleted file mode 100644 index 3a068c8a43..0000000000 --- a/goal_src/jak1/examples/display-all-colors.gc +++ /dev/null @@ -1,61 +0,0 @@ -;;-*-Lisp-*- -(in-package goal) - -;; This script creates a simple process that draws text demonstrating -;; all of GOAL's color constants to the on-screen debug output. - -;; Create somewhere for the handle to the process to live. See https://open-goal.github.io/docs/reference/process_and_state -;; as well as kernel/gstate.gc -(define *color-display-handle* (new 'static 'handle)) -(set! *color-display-handle* (the handle #f)) - - -(defun-debug start-display-text-colors () - "Spawn an onscreen string displaying all possible colors" - (if (not (handle->process *color-display-handle*)) - (let ((disp-proc - (process-spawn-function process :name 'display-proc - (lambda :behavior process () - (stack-size-set! (-> self main-thread) 256) - (loop - ;; These constants live in engine/gfx/font-h.gc - (format *stdcon* "~0k~%~% -~0L 0 default ~1L 1 white -~2L 2 gray ~3L 3 orange-red -~4L 4 bright-orange-red ~5L 5 bright-orange-red -~6L 6 bright-green ~7L 7 dark-blue -~8L 8 light-blue ~9L 9 dark-pink -~10L10 lighter-blue ~11L11 dark-light-blue -~12L12 dim-white ~13L13 dim-gray -~14L14 orange-red-2 ~15L15 yellow-green -~16L16 dark-green ~17L17 another-gray -~18L18 dark-dark-green ~19L19 flat-dark-purple -~20L20 flat-yellow ~21L21 blue-white -~22L22 pad-back ~23L23 pad-shine -~24L24 pad-square ~25L25 pad-circle -~26L26 pad-triangle ~27L27 pad-x -~28L28 lighter-lighter-blue ~29L29 yellow-orange -~30L30 yellow-green-2 ~31L31 another-light-blue -~32L32 light-yellow ~33L33 red-orange -~34L34 another-orange-red~0L~% - alternate names - ~3L3 red ~4L4 red2 ~5L5 yellow ~6L6 green ~7L7 blue - ~10L10 cyan ~33L33 red-reverse ~34L34 red-obverse~0L" - ) - (suspend) - ) - ) - ) - )) - (set! *color-display-handle* (ppointer->handle disp-proc)) - ) - ;; else - (format #t "Colors are already being displayed") - ) - ) - - -(defun-debug stop-display-text-colors () - "Kill the example text color display" - (kill-by-name 'display-proc *active-pool*) - ) diff --git a/goal_src/jak1/game.gp b/goal_src/jak1/game.gp index 914b6d6c15..c32ebe3297 100644 --- a/goal_src/jak1/game.gp +++ b/goal_src/jak1/game.gp @@ -400,6 +400,14 @@ +;;;;;;;;;;;;;;;;;;;;; +;; kernel Group +;;;;;;;;;;;;;;;;;;;;; +;; the kernel group is a group of files required to boot the game kernel + +(group "kernel" "$OUT/iso/KERNEL.CGO") + + ;;;;;;;;;;;;;;;;;;;;; ;; engine Group ;;;;;;;;;;;;;;;;;;;;; diff --git a/goal_src/jak1/levels/village3/village3-obs.gc b/goal_src/jak1/levels/village3/village3-obs.gc index ead7017be3..7ca81bd297 100644 --- a/goal_src/jak1/levels/village3/village3-obs.gc +++ b/goal_src/jak1/levels/village3/village3-obs.gc @@ -152,7 +152,15 @@ (not (movie?)) (not (level-hint-displayed?)) (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 3)) - (file-status *art-control* (-> self anim name) 0) + ;; pc port note : fix gondola spool not loading because it's "too far away" (technically) + (#if (not PC_PORT) + (file-status *art-control* (-> self anim name) 0) + (begin + (spool-push *art-control* (-> self anim name) 0 self (vector-vector-distance + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 3)) + (target-pos 0))) + (file-status *art-control* (-> self anim name) 0)) + ) ) ) (let ((s3-0 (get-reminder (get-task-control (game-task village3-button)) 2)) diff --git a/goal_src/jak1/pc/util/display-font-color.gc b/goal_src/jak1/pc/util/display-font-color.gc new file mode 100644 index 0000000000..e2eecfe9ab --- /dev/null +++ b/goal_src/jak1/pc/util/display-font-color.gc @@ -0,0 +1,52 @@ +;;-*-Lisp-*- +(in-package goal) + +;; This script creates a simple process that draws text demonstrating +;; all of GOAL's color constants to the on-screen debug output. + +;; Create somewhere for the handle to the process to live. See https://open-goal.github.io/docs/reference/process_and_state +;; as well as kernel/gstate.gc +(define *color-displays* (new 'global 'inline-array 'handle 1)) + +(defmacro get-color-display-handle () + `(-> *color-displays* 0)) + +(set! (get-color-display-handle) INVALID_HANDLE) + +;; font-color is from font-h.gc +(defun font-color->string ((val font-color)) + "return the name of the font-color" + (enum->string font-color val) + ) + +(defun draw-all-font-colors () + "draws all font color names onscreen" + (with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) + (bucket-id debug-no-zbuf)) + (dotimes (i 48) + (draw-string-xy (string-format "~2D ~S" i (font-color->string (the font-color i))) buf + (+ 4 (* (get-screen-x 0.5) (mod i 2))) (+ 8 (* 8 (/ i 2))) (the font-color i) (font-flags shadow))) + ) + ) + +(defun start-display-text-colors () + "Spawn an onscreen string displaying all possible colors" + (if (handle->process (get-color-display-handle)) + (format #t "Colors are already being displayed") + ;; else + (set! (get-color-display-handle) + (ppointer->handle (process-spawn-function process :name 'display-proc + (lambda :behavior process () + (loop + (draw-all-font-colors) + (suspend)) + ) + ))) + ) + ) + + +(defun-debug stop-display-text-colors () + "Kill the example text color display" + (kill-by-name 'display-proc *active-pool*) + ) diff --git a/goal_src/jak1/pc_debug/font-encode-test.gc b/goal_src/jak1/pc/util/font-encode-test.gc similarity index 66% rename from goal_src/jak1/pc_debug/font-encode-test.gc rename to goal_src/jak1/pc/util/font-encode-test.gc index 05809eef87..4b1d5ef91a 100644 --- a/goal_src/jak1/pc_debug/font-encode-test.gc +++ b/goal_src/jak1/pc/util/font-encode-test.gc @@ -8,11 +8,9 @@ ;; To run this: #| -(make-group "iso") ;; build the game -(lt) ;; connect to the runtime -(lg) ;; have the runtime load the game engine -(test-play) ;; start the game loop -(ml "goal_src/pc_debug/font-encode-test.gc") ;; build and load this file. +(mi) ;; build the game +(lt) ;; connect to the runtime +(ml "goal_src/jak1/pc/util/font-encode-test.gc") ;; build and load this file. |# @@ -30,8 +28,8 @@ ;;;; functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define *font-string* (new 'global 'string 64 (the-as string #f))) -(define *font-string-ex* "") +(define *font-string* (new 'global 'string 64 (the string #f))) +(define *font-string-ex* (the string #f)) (define *font-string-val* #x96) (defun-debug font-encode-test-start () @@ -40,9 +38,6 @@ (unless (process-by-name 'font-encode *active-pool*) (process-spawn-function process :name 'font-encode (lambda :behavior process () - - (stack-size-set! (-> self main-thread) 768) - (let ((fnt (new 'stack 'font-context *font-default-matrix* FONT_ENCODE_TEXT_LEFT FONT_ENCODE_TEXT_Y 0.0 (font-color orange-red) (font-flags shadow kerning large middle))) ) @@ -54,27 +49,20 @@ (suspend) (if (or (cpad-pressed? 0 left) (cpad-hold? 0 l1)) - (-! *font-string-val* 1) - ) + (-! *font-string-val* 1)) (if (or (cpad-pressed? 0 right) (cpad-hold? 0 r1)) - (+! *font-string-val* 1) - ) - (if (< *font-string-val* 1) - (set! *font-string-val* 1) - ) - (if (> *font-string-val* #x1ff) - (set! *font-string-val* #x1ff) - ) + (+! *font-string-val* 1)) + (minmax! *font-string-val* 1 #x1ff) (clear *font-string*) (cond ((>= *font-string-val* #x100) (set! (-> *font-string* data 0) (/ *font-string-val* 256)) - (set! (-> *font-string* data 1) (mod *font-string-val* 256)) + (set! (-> *font-string* data 1) (logand *font-string-val* #xff)) (set! (-> *font-string* data 2) 0) ) (else - (set! (-> *font-string* data 0) (mod *font-string-val* 256)) + (set! (-> *font-string* data 0) (logand *font-string-val* #xff)) (set! (-> *font-string* data 1) 0) ) ) @@ -82,11 +70,12 @@ (set-origin! fnt FONT_ENCODE_TEXT_LEFT FONT_ENCODE_TEXT_Y) (set-flags! fnt (font-flags shadow kerning large middle)) (print-game-text *font-string* fnt #f 128 24) - (set-origin! fnt FONT_ENCODE_TEXT_LEFT (+ FONT_ENCODE_TEXT_Y 32)) - (print-game-text *font-string-ex* fnt #f 128 24) + (when *font-string-ex* + (set-origin! fnt FONT_ENCODE_TEXT_LEFT (+ FONT_ENCODE_TEXT_Y 32)) + (print-game-text *font-string-ex* fnt #f 128 24)) (set-origin! fnt FONT_ENCODE_TEXT_LEFT (- FONT_ENCODE_TEXT_Y 16)) (set-flags! fnt (font-flags shadow kerning middle)) - (print-game-text (string-format "#x~X" *font-string-val*) fnt #f 128 12) + (print-game-text (string-format "#x~x" *font-string-val*) fnt #f 128 12) ) ) diff --git a/goal_src/jak1/pc_debug/pc-pad-utils.gc b/goal_src/jak1/pc/util/pc-pad-utils.gc similarity index 95% rename from goal_src/jak1/pc_debug/pc-pad-utils.gc rename to goal_src/jak1/pc/util/pc-pad-utils.gc index fd00295898..a240aedaf6 100644 --- a/goal_src/jak1/pc_debug/pc-pad-utils.gc +++ b/goal_src/jak1/pc/util/pc-pad-utils.gc @@ -10,11 +10,9 @@ ;; To run this: #| -(make-group "iso") ;; build the game -(lt) ;; connect to the runtime -(lg) ;; have the runtime load the game engine -(test-play) ;; start the game loop -(ml "goal_src/pc_debug/pc-pad-utils.gc") ;; build and load this file. +(mi) ;; build the game +(lt) ;; connect to the runtime +(ml "goal_src/jak1/pc/util/pc-pad-utils.gc") ;; build and load this file. |# @@ -30,12 +28,12 @@ ) (define *pc-pad-proc-list* (new 'static 'pc-pad-proc-list)) -(set! (-> *pc-pad-proc-list* show) (the handle #f)) -(set! (-> *pc-pad-proc-list* input) (the handle #f)) +(set! (-> *pc-pad-proc-list* show) INVALID_HANDLE) +(set! (-> *pc-pad-proc-list* input) INVALID_HANDLE) ;; a pc pad process (deftype pc-pad-proc (process) - ((state-time int64) + ((state-time time-frame) (input-index uint64) (pad-idx int64) ) diff --git a/goalc/compiler/compilation/Static.cpp b/goalc/compiler/compilation/Static.cpp index a172284acc..8c1a40149e 100644 --- a/goalc/compiler/compilation/Static.cpp +++ b/goalc/compiler/compilation/Static.cpp @@ -1052,7 +1052,7 @@ StaticResult Compiler::fill_static_inline_array(const goos::Object& form, // get all arguments now auto args = get_list_as_vector(rest); if (args.size() < 4) { - throw_compiler_error(form, "new static boxed array must have type and min-size arguments"); + throw_compiler_error(form, "new static inline array must have type and min-size arguments"); } auto content_type = parse_typespec(args.at(2), env); s64 min_size = get_constant_integer_or_error(args.at(3), env); @@ -1060,8 +1060,10 @@ StaticResult Compiler::fill_static_inline_array(const goos::Object& form, auto inline_array_type = m_ts.make_inline_array_typespec(content_type); auto deref_info = m_ts.get_deref_info(inline_array_type); - ASSERT(deref_info.can_deref); - ASSERT(!deref_info.mem_deref); + if (!deref_info.can_deref || deref_info.mem_deref) { + throw_compiler_error(form, "new static inline array of type {} is currently not supported", + content_type.print()); + } auto obj = std::make_unique(seg); obj->set_offset(is_basic(content_type) ? 4 : 0); obj->data.resize(length * deref_info.stride); diff --git a/goalc/compiler/compilation/Type.cpp b/goalc/compiler/compilation/Type.cpp index 30b438a043..bbc3144bf3 100644 --- a/goalc/compiler/compilation/Type.cpp +++ b/goalc/compiler/compilation/Type.cpp @@ -982,8 +982,9 @@ Val* Compiler::compile_heap_new(const goos::Object& form, throw_compiler_error(form, "new array form got more arguments than expected"); } - auto ts = is_inline ? m_ts.make_inline_array_typespec(elt_type) - : m_ts.make_pointer_typespec(elt_type); + auto ts = is_inline && m_ts.lookup_type(elt_type)->is_reference() + ? m_ts.make_inline_array_typespec(elt_type) + : m_ts.make_pointer_typespec(elt_type); auto info = m_ts.get_deref_info(ts); if (!info.can_deref) { throw_compiler_error(form, "Cannot make an {} of {}\n", main_type.print(), ts.print()); @@ -1003,9 +1004,9 @@ Val* Compiler::compile_heap_new(const goos::Object& form, args.push_back(array_size); } - auto array = compile_real_function_call(form, malloc_func, args, env); - array->set_type(ts); - return array; + auto new_array = compile_real_function_call(form, malloc_func, args, env); + new_array->set_type(ts); + return new_array; } else { bool got_content_type = false; // for boxed array std::string content_type; // for boxed array. diff --git a/test/decompiler/reference/jak1/engine/target/target-death_REF.gc b/test/decompiler/reference/jak1/engine/target/target-death_REF.gc index baa50b097b..9eba9cd403 100644 --- a/test/decompiler/reference/jak1/engine/target/target-death_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/target-death_REF.gc @@ -713,30 +713,19 @@ ) ;; definition for function target-hit-setup-anim +;; INFO: Return type mismatch object vs none. (defbehavior target-hit-setup-anim target ((arg0 attack-info)) (case (-> arg0 angle) (('back) (when (not (ja-group? eichar-hit-from-back-ja)) (ja-channel-push! 1 (seconds 0.075)) - (let ((gp-1 (-> self skel root-channel 0))) - (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim eichar-hit-from-back-ja) num-func-identity) - (let ((f0-0 0.0)) - (set! (-> gp-1 frame-num) f0-0) - f0-0 - ) - ) + (ja :group! eichar-hit-from-back-ja :num! min) ) ) (('up 'up-forward) (when (not (ja-group? eichar-hit-up-ja)) (ja-channel-push! 1 (seconds 0.075)) - (let ((gp-2 (-> self skel root-channel 0))) - (joint-control-channel-group-eval! gp-2 (the-as art-joint-anim eichar-hit-up-ja) num-func-identity) - (let ((f0-1 0.0)) - (set! (-> gp-2 frame-num) f0-1) - f0-1 - ) - ) + (ja :group! eichar-hit-up-ja :num! min) ) ) (('air 'jump) @@ -756,16 +745,11 @@ (else (when (not (ja-group? eichar-hit-from-front-ja)) (ja-channel-push! 1 (seconds 0.075)) - (let ((gp-5 (-> self skel root-channel 0))) - (joint-control-channel-group-eval! gp-5 (the-as art-joint-anim eichar-hit-from-front-ja) num-func-identity) - (let ((f0-10 0.0)) - (set! (-> gp-5 frame-num) f0-10) - f0-10 - ) - ) + (ja :group! eichar-hit-from-front-ja :num! min) ) ) ) + (none) ) ;; definition for function target-hit-move From 34d6e8d71e32ed85d0c25ed76adfb37771ec497c Mon Sep 17 00:00:00 2001 From: Liam Hackett Date: Mon, 15 Aug 2022 23:47:23 +0100 Subject: [PATCH 03/23] Update Readme to include missing dependencies on Fedora and Arch installations (#1763) Update docs to include missing dependencies on Fedora and Arch --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40318178d4..361af0e91a 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ cmake -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_EXE_LINKER_FLAGS="-fuse Install packages and init repository: ```sh -sudo pacman -S cmake libpulse base-devel nasm python +sudo pacman -S cmake libpulse base-devel nasm python libx11 libxrandr libxinerama libxcursor libxi yay -S go-task ``` @@ -158,7 +158,7 @@ Run tests: Install packages and init repository: ```sh -sudo dnf install cmake lld clang nasm libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel pulseaudio-libs-devel +sudo dnf install cmake python lld clang nasm libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel pulseaudio-libs-devel sudo sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin ``` From 18dfb6c1d1ac2a4dfe18620251c7bc1287e5d0f8 Mon Sep 17 00:00:00 2001 From: Liam Hackett Date: Tue, 16 Aug 2022 00:08:51 +0100 Subject: [PATCH 04/23] Add dockerfiles for Linux environments with documentation (#1764) * Add dockerfiles for linux environments with documentation * Clean up documentation --- README.md | 25 +++++++++++++++++++++++++ docker/Arch/Dockerfile | 28 ++++++++++++++++++++++++++++ docker/Fedora/Dockerfile | 20 ++++++++++++++++++++ docker/Ubuntu/Dockerfile | 24 ++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 docker/Arch/Dockerfile create mode 100644 docker/Fedora/Dockerfile create mode 100644 docker/Ubuntu/Dockerfile diff --git a/README.md b/README.md index 361af0e91a..e3d4187ee0 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - [Current Status](#current-status) - [Methodology](#methodology) - [Setting up a Development Environment](#setting-up-a-development-environment) + - [Docker](#docker) - [Linux](#linux) - [Ubuntu (20.04)](#ubuntu-2004) - [Arch](#arch) @@ -95,6 +96,30 @@ The remainder of this README is catered towards people interested in building th If this does not sound like you and you just want to play the game, refer to the above section [How to play the game](#how-to-play-the-game) +### Docker + +All three Linux systems are supported using Docker. + +Pick your supported prefered flavour of linux and build your chosen image + +``` +docker build -f docker/(Arch|Fedora|Ubuntu)/Dockerfile -t jak . +``` + +This will create an image with all required dependencies and already built. + +``` +docker run -v "$(pwd)"/build:/home/jak/jak-project/build -it jak bash +``` + +Note: If you the build directory you'll need to rerun the build command. Alteratively you can get the build via `docker cp` + +This will link your build folder to the images so can validate your build or test it on an external device. + +Docker images can be linked into your IDE (e.g. CLion) to help with codesniffing, static analysis, run tests and continuous build. + +Unfortently you'll still need task runner on your local machine to run the game or instead, manually run the game via the commands found in `Taskfile.yml` + ### Linux #### Ubuntu (20.04) diff --git a/docker/Arch/Dockerfile b/docker/Arch/Dockerfile new file mode 100644 index 0000000000..1e82723e8b --- /dev/null +++ b/docker/Arch/Dockerfile @@ -0,0 +1,28 @@ +FROM archlinux:latest + +RUN pacman -Syyu --noconfirm --needed cmake libpulse base-devel nasm python git libx11 libxrandr libxinerama libxcursor libxi + +# makepkg user and workdir +ARG user=jak +RUN useradd --system --create-home $user \ + && echo "$user ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/$user +USER $user +WORKDIR /home/$user + +# Install yay +RUN git clone https://aur.archlinux.org/yay.git \ + && cd yay \ + && makepkg -sri --needed --noconfirm \ + && cd \ + # Clean up + && rm -rf .cache yay + +RUN yay --noconfirm -S go-task + +RUN mkdir /home/$user/jak-project/ +COPY --chown=jak:jak . /home/$user/jak-project +RUN git config --global --add safe.directory /home/jak/jak-project + +WORKDIR /home/$user/jak-project + +RUN cmake -B build && cmake --build build -j 8 \ No newline at end of file diff --git a/docker/Fedora/Dockerfile b/docker/Fedora/Dockerfile new file mode 100644 index 0000000000..a150cf2fb0 --- /dev/null +++ b/docker/Fedora/Dockerfile @@ -0,0 +1,20 @@ +FROM fedora:latest + +RUN dnf install -y curl cmake python lld clang nasm libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel pulseaudio-libs-devel +RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin + +ARG user=jak + +RUN useradd -m -d /home/${user} ${user} + +USER $user + +WORKDIR /home/$user + +RUN mkdir /home/$user/jak-project/ +COPY --chown=jak:jak . /home/$user/jak-project + +WORKDIR /home/$user/jak-project + +RUN cmake -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -B build +RUN cmake --build build -j$(nproc) \ No newline at end of file diff --git a/docker/Ubuntu/Dockerfile b/docker/Ubuntu/Dockerfile new file mode 100644 index 0000000000..4d88164918 --- /dev/null +++ b/docker/Ubuntu/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:20.04 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update +RUN apt-get install -y gcc make cmake build-essential g++ nasm clang-format libxrandr-dev libxinerama-dev libxcursor-dev libpulse-dev libxi-dev python lld clang curl + +RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin + +ARG user=jak + +RUN useradd -m -d /home/${user} ${user} + +USER $user + +WORKDIR /home/$user + +RUN mkdir /home/$user/jak-project/ +COPY --chown=jak:jak . /home/$user/jak-project + +WORKDIR /home/$user/jak-project/build + +RUN cmake -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. +WORKDIR /home/$user/jak-project +RUN cmake -B build && cmake --build build -j 8 From b2eb041ebe5d72678ae7f9c88c5fd8d80beae800 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 17 Aug 2022 00:57:59 -0400 Subject: [PATCH 05/23] ci: add back the windows artifact (#1766) --- .github/workflows/windows-build-clang.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/windows-build-clang.yaml b/.github/workflows/windows-build-clang.yaml index d755a47e9f..7891494a2e 100644 --- a/.github/workflows/windows-build-clang.yaml +++ b/.github/workflows/windows-build-clang.yaml @@ -52,3 +52,10 @@ jobs: GTEST_OUTPUT: "xml:opengoal-test-report.xml" run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_brief=1 --gtest_filter="-*MANUAL_TEST*" + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: opengoal-windows-${{ inputs.cachePrefix }} + if-no-files-found: error + path: ./build/bin + From 375e9c7713165da5046e4d8a8d31d2a12beac9cb Mon Sep 17 00:00:00 2001 From: animalstyletaco Date: Fri, 19 Aug 2022 08:28:06 -0700 Subject: [PATCH 06/23] Added first working instance of controller/keyboard re-mapper (#1702) * Added First working instance of controller/keyboard re-mapper * Fixed clang formatting issues * Updated newpad.cpp to inverse analog y-axis to make json labelling consistent * Added mouse sensitivity options for X and Y axis in json, removed scroll mouse support, and other changes requested in feedback * Added option to have ImGui debug menu appear on start up and remove hard coded set_imgui_visible calls * Added newpad unit tests and updated function names to better describe intended functionalities * Fixed formatting issue in newpad unit test * Removed rumble unit test new pad * Fixed codacy static analysis issues * Fixed Linux build issues * Implemented github feedback * Implemented updated github feedback * Fixed formatting errors * Updated Pad::CheckPadIdx * Implemented changes based on latest github feedback * Implemented changes based on github feedback Co-authored-by: animalstyletaco --- game/graphics/display.cpp | 1 - game/graphics/gfx.cpp | 208 ++++++++++++++--- game/graphics/gfx.h | 5 +- game/graphics/pipelines/opengl.cpp | 98 ++++++++- game/graphics/pipelines/opengl.h | 11 + game/sce/libpad.cpp | 8 +- game/system/newpad.cpp | 343 ++++++++++++++++++++++------- game/system/newpad.h | 42 +++- test/CMakeLists.txt | 1 + test/game/test_newpad.cpp | 311 ++++++++++++++++++++++++++ 10 files changed, 899 insertions(+), 129 deletions(-) create mode 100644 test/game/test_newpad.cpp diff --git a/game/graphics/display.cpp b/game/graphics/display.cpp index dbbc4da5b4..5e75124175 100644 --- a/game/graphics/display.cpp +++ b/game/graphics/display.cpp @@ -92,7 +92,6 @@ int InitMainDisplay(int width, lg::error("Failed to make main display."); return 1; } - display->set_imgui_visible(true); set_main_display(display); return 0; } diff --git a/game/graphics/gfx.cpp b/game/graphics/gfx.cpp index b98beec433..896d6b1bd1 100644 --- a/game/graphics/gfx.cpp +++ b/game/graphics/gfx.cpp @@ -14,6 +14,7 @@ #include "common/log/log.h" #include "common/symbols.h" #include "common/util/FileUtil.h" +#include "common/util/json_util.h" #include "game/common/file_paths.h" #include "game/kernel/common/kscheme.h" @@ -42,8 +43,8 @@ void InitSettings(GfxSettings& settings) { settings.pad_mapping_info.buffer_mode = true; // debug input settings settings.pad_mapping_info.debug = true; - // use a default mapping - Pad::DefaultMapping(settings.pad_mapping_info); + + Pad::DefaultMapping(Gfx::g_settings.pad_mapping_info); } } // namespace @@ -53,36 +54,180 @@ namespace Gfx { std::function vsync_callback; GfxGlobalSettings g_global_settings; GfxSettings g_settings; + +Pad::MappingInfo& get_button_mapping() { + return g_settings.pad_mapping_info; +} + // const std::vector renderers = {&moduleOpenGL}; -// TODO serialize -void LoadSettings() { - const auto filename = file_util::get_file_path({GAME_CONFIG_DIR_NAME, SETTINGS_GFX_FILE_NAME}); - if (fs::exists(filename)) { - // this is just wrong LOL - FILE* fp = file_util::open_file(filename.c_str(), "rb"); - lg::info("Found graphics configuration file. Checking version."); - u64 version; - fread(&version, sizeof(u64), 1, fp); - if (version == GfxSettings::CURRENT_VERSION) { - fseek(fp, 0, SEEK_SET); - fread(&g_settings, sizeof(GfxSettings), 1, fp); - lg::info("Loaded graphics configuration file."); - } else { - // TODO upgrade func - lg::info("Detected graphics configuration file from old version. Ignoring."); +// Not crazy about this declaration +const std::pair gamepad_map[] = {{"Select", Pad::Button::Select}, + {"L3", Pad::Button::L3}, + {"R3", Pad::Button::R3}, + {"Start", Pad::Button::Start}, + {"Up", Pad::Button::Up}, + {"Right", Pad::Button::Right}, + {"Down", Pad::Button::Down}, + {"Left", Pad::Button::Left}, + {"L1", Pad::Button::L1}, + {"R1", Pad::Button::R1}, + {"Triangle", Pad::Button::Triangle}, + {"Circle", Pad::Button::Circle}, + {"X", Pad::Button::X}, + {"Square", Pad::Button::Square}}; + +const std::pair analog_map[] = { + {"Left X Axis", Pad::Analog::Left_X}, + {"Left Y Axis", Pad::Analog::Left_Y}, + {"Right X Axis", Pad::Analog::Right_X}, + {"Right Y Axis", Pad::Analog::Right_Y}, +}; + +bool g_is_debug_menu_visible_on_startup = false; + +bool get_debug_menu_visible_on_startup() { + return g_is_debug_menu_visible_on_startup; +} + +void DumpToJson(ghc::filesystem::path& filename) { + nlohmann::json json; + json["Debug Menu Visibility"] = false; // Assume start up debug display is disabled + auto& peripherals_json = json["Peripherals"]; + + for (uint32_t i = 0; i < Pad::CONTROLLER_COUNT; ++i) { + nlohmann::json peripheral_json; + peripheral_json["ID"] = i + 1; + + auto& controller_json = peripheral_json["Controller"]; + auto& controller_buttons_json = controller_json["Buttons"]; + for (const auto& [name, value] : gamepad_map) { + controller_buttons_json[name] = + g_settings.pad_mapping_info.controller_button_mapping[i][(int)value]; } - fclose(fp); + + auto& keyboard_json = peripheral_json["Keyboard+Mouse"]; + auto& keyboard_buttons_json = keyboard_json["Buttons"]; + for (const auto& [name, value] : gamepad_map) { + keyboard_buttons_json[name] = + g_settings.pad_mapping_info.keyboard_button_mapping[i][(int)value]; + } + + auto& keyboard_analogs_json = keyboard_json["Analog"]; + for (const auto& [name, value] : analog_map) { + if (g_settings.pad_mapping_info.keyboard_analog_mapping[i][(int)value].mode == + Pad::AnalogMappingMode::AnalogInput) { + keyboard_analogs_json[name]["Axis Id"] = + g_settings.pad_mapping_info.keyboard_analog_mapping[i][(int)value].axis_id; + } else { + keyboard_analogs_json[name]["Positive Key"] = + g_settings.pad_mapping_info.keyboard_analog_mapping[i][(int)value].positive_key; + keyboard_analogs_json[name]["Negative Key"] = + g_settings.pad_mapping_info.keyboard_analog_mapping[i][(int)value].negative_key; + } + } + peripheral_json["X-Axis Mouse Sensitivity"] = + g_settings.pad_mapping_info.mouse_x_axis_sensitivities[i]; + peripheral_json["Y-Axis Mouse Sensitivity"] = + g_settings.pad_mapping_info.mouse_y_axis_sensitivities[i]; + peripherals_json.emplace_back(peripheral_json); + } + + file_util::write_text_file(filename, json.dump(4)); +} + +void SavePeripheralSettings() { + auto filename = (file_util::get_user_config_dir() / "controller" / "controller-settings.json"); + file_util::create_dir_if_needed_for_file(filename); + + DumpToJson(filename); + lg::info("Saved graphics configuration file."); +} + +void LoadPeripheralSettings(const ghc::filesystem::path& filepath) { + Pad::DefaultMapping(g_settings.pad_mapping_info); + + auto file_txt = file_util::read_text_file(filepath); + auto configuration = parse_commented_json(file_txt, filepath.string()); + + if (configuration.find("Debug Menu Visibility") != configuration.end()) { + g_is_debug_menu_visible_on_startup = configuration["Debug Menu Visibility"].get(); + } + + int controller_index = 0; + for (const auto& peripheral : configuration["Peripherals"]) { + auto& controller_buttons_json = peripheral["Controller"]["Buttons"]; + auto& keyboard_buttons_json = peripheral["Keyboard+Mouse"]["Buttons"]; + + for (const auto& [name, button] : gamepad_map) { + if (controller_buttons_json.find(name) != controller_buttons_json.end()) { + g_settings.pad_mapping_info.controller_button_mapping[controller_index][(int)button] = + controller_buttons_json[name].get(); + } else { + lg::warn( + "Controller button override not found for {}. Using controller default value: {}", name, + g_settings.pad_mapping_info.controller_button_mapping[controller_index][(int)button]); + } + + if (keyboard_buttons_json.find(name) != keyboard_buttons_json.end()) { + g_settings.pad_mapping_info.keyboard_button_mapping[controller_index][(int)button] = + keyboard_buttons_json[name].get(); + } else { + lg::warn( + "Keyboard button override not found for {}. Using keyboard default value: {}", name, + g_settings.pad_mapping_info.keyboard_button_mapping[controller_index][(int)button]); + } + } + + auto& keyboard_analogs_json = peripheral["Keyboard+Mouse"]["Analog"]; + for (const auto& [name, value] : analog_map) { + Pad::AnalogMappingInfo analog_mapping; + if (keyboard_analogs_json[name].contains("Axis Id") == true) { + analog_mapping.mode = Pad::AnalogMappingMode::AnalogInput; + analog_mapping.axis_id = keyboard_analogs_json[name]["Axis Id"].get(); + g_settings.pad_mapping_info.keyboard_analog_mapping[controller_index][(int)value] = + analog_mapping; + continue; + } + + if (keyboard_analogs_json[name].contains("Positive Key") == true) { + analog_mapping.positive_key = keyboard_analogs_json[name]["Positive Key"].get(); + } else { + lg::warn("Keyboard analog override not found for {}. Using keyboard default value: {}", + name, + g_settings.pad_mapping_info.keyboard_analog_mapping[controller_index][(int)value] + .positive_key); + } + + if (keyboard_analogs_json[name].contains("Negative Key") == true) { + analog_mapping.negative_key = keyboard_analogs_json[name]["Negative Key"].get(); + } else { + lg::warn("Keyboard analog override not found for {}. Using keyboard default value: {}", + name, + g_settings.pad_mapping_info.keyboard_analog_mapping[controller_index][(int)value] + .negative_key); + } + g_settings.pad_mapping_info.keyboard_analog_mapping[controller_index][(int)value] = + analog_mapping; + } + g_settings.pad_mapping_info.mouse_x_axis_sensitivities[controller_index] = + peripheral["X-Axis Mouse Sensitivity"].get(); + g_settings.pad_mapping_info.mouse_y_axis_sensitivities[controller_index] = + peripheral["Y-Axis Mouse Sensitivity"].get(); + controller_index++; } } -void SaveSettings() { - const auto filename = file_util::get_file_path({GAME_CONFIG_DIR_NAME, SETTINGS_GFX_FILE_NAME}); - file_util::create_dir_if_needed(file_util::get_file_path({GAME_CONFIG_DIR_NAME})); - FILE* fp = file_util::open_file(filename.c_str(), "wb"); - fwrite(&g_settings, sizeof(GfxSettings), 1, fp); - fclose(fp); - lg::info("Saved graphics configuration file."); +void LoadSettings() { + auto filename = (file_util::get_user_config_dir() / "controller" / "controller-settings.json"); + if (fs::exists(filename)) { + LoadPeripheralSettings(filename); + lg::info("Loaded graphics configuration file."); + return; + } else { + SavePeripheralSettings(); + lg::info("Couldn't find controller-settings.json creating new controller settings file."); + } } const GfxRendererModule* GetRenderer(GfxPipeline pipeline) { @@ -319,7 +464,7 @@ void input_mode_save() { g_settings.pad_mapping_info_backup = g_settings.pad_mapping_info; // copy to backup g_settings.pad_mapping_info = Pad::g_input_mode_mapping; // set current mapping - SaveSettings(); + SavePeripheralSettings(); } } @@ -328,15 +473,18 @@ s64 get_mapped_button(s64 pad, s64 button) { lg::error("Invalid parameters to get_mapped_button({}, {})", pad, button); return -1; } - return (s64)g_settings.pad_mapping_info.pad_mapping[pad][button]; + + return (Pad::GetGamepadState(pad) > -1) + ? (s64)g_settings.pad_mapping_info.controller_button_mapping[pad][button] + : (s64)g_settings.pad_mapping_info.keyboard_button_mapping[pad][button]; } int PadIsPressed(Pad::Button button, int port) { return Pad::IsPressed(g_settings.pad_mapping_info, button, port); } -int PadAnalogValue(Pad::Analog analog, int port) { - return Pad::AnalogValue(g_settings.pad_mapping_info, analog, port); +int PadGetAnalogValue(Pad::Analog analog, int port) { + return Pad::GetAnalogValue(g_settings.pad_mapping_info, analog, port); } void SetLod(RendererTreeType tree, int lod) { diff --git a/game/graphics/gfx.h b/game/graphics/gfx.h index 941ac790fc..5d61f78060 100644 --- a/game/graphics/gfx.h +++ b/game/graphics/gfx.h @@ -124,6 +124,8 @@ u32 Init(GameVersion version); void Loop(std::function f); u32 Exit(); +Pad::MappingInfo& get_button_mapping(); + u32 vsync(); void register_vsync_callback(std::function f); void clear_vsync_callback(); @@ -152,9 +154,10 @@ void set_msaa(int samples); void input_mode_set(u32 enable); void input_mode_save(); s64 get_mapped_button(s64 pad, s64 button); +bool get_debug_menu_visible_on_startup(); int PadIsPressed(Pad::Button button, int port); -int PadAnalogValue(Pad::Analog analog, int port); +int PadGetAnalogValue(Pad::Analog analog, int port); // matching enum in kernel-defs.gc !! enum class RendererTreeType { NONE = 0, TFRAG3 = 1, TIE3 = 2, INVALID }; diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index 8602f83d8c..b89bf5d22e 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -78,6 +78,11 @@ struct GraphicsData { std::unique_ptr g_gfx_data; +std::atomic g_cursor_input_mode = GLFW_CURSOR_DISABLED; +bool is_cursor_position_valid = false; +double last_cursor_x_position = 0; +double last_cursor_y_position = 0; + struct { bool callbacks_registered = false; GLFWmonitor** monitors; @@ -209,6 +214,7 @@ static std::shared_ptr gl_make_display(int width, } auto display = std::make_shared(window, is_main); + // lg::debug("init display #x{:x}", (uintptr_t)display); // setup imgui @@ -255,6 +261,16 @@ GLDisplay::GLDisplay(GLFWwindow* window, bool is_main) : m_window(window) { display->on_key(window, key, scancode, action, mods); }); + glfwSetMouseButtonCallback(window, [](GLFWwindow* window, int button, int action, int mode) { + GLDisplay* display = reinterpret_cast(glfwGetWindowUserPointer(window)); + display->on_mouse_key(window, button, action, mode); + }); + + glfwSetCursorPosCallback(window, [](GLFWwindow* window, double xposition, double yposition) { + GLDisplay* display = reinterpret_cast(glfwGetWindowUserPointer(window)); + display->on_cursor_position(window, xposition, yposition); + }); + glfwSetWindowPosCallback(window, [](GLFWwindow* window, int xpos, int ypos) { GLDisplay* display = reinterpret_cast(glfwGetWindowUserPointer(window)); display->on_window_pos(window, xpos, ypos); @@ -289,6 +305,11 @@ GLDisplay::~GLDisplay() { } } +void GLDisplay::update_cursor_visibility(GLFWwindow* window, bool is_visible) { + g_cursor_input_mode = (is_visible) ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED; + glfwSetInputMode(window, GLFW_CURSOR, g_cursor_input_mode); +} + void GLDisplay::on_key(GLFWwindow* window, int key, int /*scancode*/, int action, int /*mods*/) { if (action == GlfwKeyAction::Press) { // lg::debug("KEY PRESS: key: {} scancode: {} mods: {:X}", key, scancode, mods); @@ -296,13 +317,63 @@ void GLDisplay::on_key(GLFWwindow* window, int key, int /*scancode*/, int action } else if (action == GlfwKeyAction::Release) { // lg::debug("KEY RELEASE: key: {} scancode: {} mods: {:X}", key, scancode, mods); Pad::OnKeyRelease(key); - if ((key == GLFW_KEY_LEFT_ALT || key == GLFW_KEY_RIGHT_ALT) && - glfwGetWindowAttrib(window, GLFW_FOCUSED)) { - set_imgui_visible(!is_imgui_visible()); + GLDisplay* display = reinterpret_cast(glfwGetWindowUserPointer(window)); + if (display != NULL) { // toggle ImGui when pressing Alt + if ((key == GLFW_KEY_LEFT_ALT || key == GLFW_KEY_RIGHT_ALT) && + glfwGetWindowAttrib(window, GLFW_FOCUSED)) { + display->set_imgui_visible(!display->is_imgui_visible()); + update_cursor_visibility(window, display->is_imgui_visible()); + } } } } +void GLDisplay::on_mouse_key(GLFWwindow* window, int button, int action, int mode) { + int key = + button + GLFW_KEY_LAST; // Mouse button index are appended after initial GLFW keys in newpad + + if (button == GLFW_MOUSE_BUTTON_LEFT && + g_cursor_input_mode == + GLFW_CURSOR_NORMAL) { // Are there any other mouse buttons we don't want to use? + Pad::ClearKey(key); + return; + } + + if (action == GlfwKeyAction::Press) { + Pad::OnKeyPress(key); + } else if (action == GlfwKeyAction::Release) { + Pad::OnKeyRelease(key); + } +} + +void GLDisplay::on_cursor_position(GLFWwindow* window, double xposition, double yposition) { + Pad::MappingInfo mapping_info = Gfx::get_button_mapping(); + if (g_cursor_input_mode == GLFW_CURSOR_NORMAL) { + if (is_cursor_position_valid == true) { + Pad::ClearAnalogAxisValue(mapping_info, GlfwKeyCustomAxis::CURSOR_X_AXIS); + Pad::ClearAnalogAxisValue(mapping_info, GlfwKeyCustomAxis::CURSOR_Y_AXIS); + is_cursor_position_valid = false; + } + return; + } + + if (is_cursor_position_valid == false) { + last_cursor_x_position = xposition; + last_cursor_y_position = yposition; + is_cursor_position_valid = true; + return; + } + + double xoffset = xposition - last_cursor_x_position; + double yoffset = yposition - last_cursor_y_position; + + Pad::SetAnalogAxisValue(mapping_info, GlfwKeyCustomAxis::CURSOR_X_AXIS, xoffset); + Pad::SetAnalogAxisValue(mapping_info, GlfwKeyCustomAxis::CURSOR_Y_AXIS, yoffset); + + last_cursor_x_position = xposition; + last_cursor_y_position = yposition; +} + void GLDisplay::on_window_pos(GLFWwindow* /*window*/, int xpos, int ypos) { if (m_fullscreen_target_mode == GfxDisplayMode::Windowed) { m_last_windowed_xpos = xpos; @@ -451,7 +522,8 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { x = m_last_windowed_xpos; y = m_last_windowed_ypos; } else { - // fullscreen -> windowed, use last windowed size but on the monitor previously fullscreened + // fullscreen -> windowed, use last windowed size but on the monitor previously + // fullscreened int monitorX, monitorY, monitorWidth, monitorHeight; glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight); @@ -464,8 +536,8 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { glfwSetWindowAttrib(m_window, GLFW_DECORATED, GLFW_TRUE); glfwSetWindowFocusCallback(m_window, NULL); glfwSetWindowAttrib(m_window, GLFW_FLOATING, GLFW_FALSE); + glfwSetWindowMonitor(m_window, NULL, x, y, width, height, GLFW_DONT_CARE); - set_imgui_visible(true); // these might have changed m_last_windowed_width = width; @@ -480,7 +552,6 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { glfwSetWindowFocusCallback(m_window, NULL); glfwSetWindowAttrib(m_window, GLFW_FLOATING, GLFW_FALSE); glfwSetWindowMonitor(m_window, monitor, 0, 0, vmode->width, vmode->height, GLFW_DONT_CARE); - set_imgui_visible(false); } break; case GfxDisplayMode::Borderless: { // borderless fullscreen @@ -495,7 +566,6 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { #else glfwSetWindowMonitor(m_window, NULL, x, y, vmode->width, vmode->height, GLFW_DONT_CARE); #endif - set_imgui_visible(false); } break; } } @@ -602,7 +672,9 @@ void GLDisplay::render() { auto p = scoped_prof("poll-gamepads"); glfwPollEvents(); glfwMakeContextCurrent(m_window); - Pad::update_gamepads(); + + auto& mapping_info = Gfx::get_button_mapping(); + Pad::update_gamepads(mapping_info); } // imgui start of frame @@ -761,13 +833,15 @@ void gl_send_chain(const void* data, u32 offset) { // we copy the dma data and give a copy of it to the render. // the copy has a few advantages: // - if the game code has a bug and corrupts the DMA buffer, the renderer won't see it. - // - the copied DMA is much smaller than the entire game memory, so it can be dumped to a file + // - the copied DMA is much smaller than the entire game memory, so it can be dumped to a + // file // separate of the entire RAM. // - it verifies the DMA data is valid early on. - // but it may also be pretty expensive. Both the renderer and the game wait on this to complete. + // but it may also be pretty expensive. Both the renderer and the game wait on this to + // complete. - // The renderers should just operate on DMA chains, so eliminating this step in the future may - // be easy. + // The renderers should just operate on DMA chains, so eliminating this step in the future + // may be easy. g_gfx_data->dma_copier.set_input_data(data, offset, run_dma_copy); diff --git a/game/graphics/pipelines/opengl.h b/game/graphics/pipelines/opengl.h index ffe4a1b0be..40d53be35f 100644 --- a/game/graphics/pipelines/opengl.h +++ b/game/graphics/pipelines/opengl.h @@ -18,6 +18,11 @@ enum GlfwKeyAction { Repeat = GLFW_REPEAT // repeated input on hold e.g. when typing something }; +enum GlfwKeyCustomAxis { + CURSOR_X_AXIS = GLFW_GAMEPAD_AXIS_LAST + 1, + CURSOR_Y_AXIS = GLFW_GAMEPAD_AXIS_LAST + 2 +}; + class GLDisplay : public GfxDisplay { public: GLDisplay(GLFWwindow* window, bool is_main); @@ -42,6 +47,9 @@ class GLDisplay : public GfxDisplay { void on_window_pos(GLFWwindow* window, int xpos, int ypos); void on_window_size(GLFWwindow* window, int width, int height); void on_iconify(GLFWwindow* window, int iconified); + void on_mouse_key(GLFWwindow* window, int button, int action, int mode); + void on_cursor_position(GLFWwindow* window, double xposition, double yposition); + void update_cursor_visibility(GLFWwindow* window, bool is_visible); private: GLFWwindow* m_window; @@ -52,3 +60,6 @@ class GLDisplay : public GfxDisplay { }; extern const GfxRendererModule gRendererOpenGL; +namespace glfw { +static const int NUM_KEYS = GLFW_KEY_LAST + GLFW_MOUSE_BUTTON_LAST + 1; +} diff --git a/game/sce/libpad.cpp b/game/sce/libpad.cpp index d92410a3c8..823cf7884c 100644 --- a/game/sce/libpad.cpp +++ b/game/sce/libpad.cpp @@ -70,10 +70,10 @@ int scePadRead(int port, int /*slot*/, u8* rdata) { cpad->status = 0x70 /* (dualshock2) */ | (20 / 2); /* (dualshock2 data size) */ - cpad->rightx = Gfx::PadAnalogValue(Pad::Analog::Right_X, port); - cpad->righty = Gfx::PadAnalogValue(Pad::Analog::Right_Y, port); - cpad->leftx = Gfx::PadAnalogValue(Pad::Analog::Left_X, port); - cpad->lefty = Gfx::PadAnalogValue(Pad::Analog::Left_Y, port); + cpad->rightx = Gfx::PadGetAnalogValue(Pad::Analog::Right_X, port); + cpad->righty = Gfx::PadGetAnalogValue(Pad::Analog::Right_Y, port); + cpad->leftx = Gfx::PadGetAnalogValue(Pad::Analog::Left_X, port); + cpad->lefty = Gfx::PadGetAnalogValue(Pad::Analog::Left_Y, port); // pressure sensitivity. ignore for now. for (int i = 0; i < 12; ++i) { diff --git a/game/system/newpad.cpp b/game/system/newpad.cpp index 7931b15624..cde31c0dd0 100644 --- a/game/system/newpad.cpp +++ b/game/system/newpad.cpp @@ -6,6 +6,9 @@ #include "newpad.h" +#include +#include + #include "common/log/log.h" #include "common/util/Assert.h" #include "common/util/FileUtil.h" @@ -22,11 +25,12 @@ namespace Pad { ******************************** */ -constexpr int NUM_KEYS = GLFW_KEY_LAST + 1; // key-down status of any detected key. -bool g_key_status[NUM_KEYS] = {0}; +bool g_key_status[glfw::NUM_KEYS] = {0}; // key-down status of any detected key. this is buffered for the remainder of a frame. -bool g_buffered_key_status[NUM_KEYS] = {0}; +bool g_buffered_key_status[glfw::NUM_KEYS] = {0}; + +float g_key_analogs[CONTROLLER_COUNT][(int)Analog::Max] = {{0}}; bool g_gamepad_buttons[CONTROLLER_COUNT][(int)Button::Max] = {{0}}; float g_gamepad_analogs[CONTROLLER_COUNT][(int)Analog::Max] = {{0}}; @@ -44,6 +48,36 @@ u64 input_mode_mod = 0; u64 input_mode_index = 0; MappingInfo g_input_mode_mapping; +void ClearKey(int key) { + if (key < 0 || key > glfw::NUM_KEYS) { + lg::warn("ClearKey failed: Attempted to clear invalid key {}", key); + return; + } + + g_key_status[key] = false; + g_buffered_key_status[key] = false; +} + +void ClearAnalogAxisValue(MappingInfo& mapping_info, int axis) { + for (int pad = 0; pad < CONTROLLER_COUNT; ++pad) { + for (int analog = 0; analog < (int)Analog::Max; ++analog) { + if (mapping_info.keyboard_analog_mapping[pad][analog].axis_id == axis && + mapping_info.keyboard_analog_mapping[pad][analog].mode == + AnalogMappingMode::AnalogInput) { + g_key_analogs[pad][analog] = 0.0f; + } + } + } +} + +void ForceClearAnalogValue() { + for (int pad = 0; pad < CONTROLLER_COUNT; ++pad) { + for (int analog = 0; analog < (int)Analog::Max; ++analog) { + g_key_analogs[pad][analog] = 0.0f; + } + } +} + void ForceClearKeys() { for (auto& key : g_key_status) { key = false; @@ -54,7 +88,7 @@ void ForceClearKeys() { } void ClearKeys() { - for (int key = 0; key < NUM_KEYS; key++) { + for (int key = 0; key < glfw::NUM_KEYS; key++) { g_buffered_key_status[key] = g_key_status[key]; } } @@ -77,7 +111,7 @@ void OnKeyPress(int key) { return; } // set absolute key status - ASSERT(key < NUM_KEYS); + ASSERT(key < glfw::NUM_KEYS); g_key_status[key] = true; // set buffered key status g_buffered_key_status[key] = true; @@ -87,7 +121,7 @@ void OnKeyRelease(int key) { if (input_mode == InputModeStatus::Enabled) { return; } - ASSERT(key < NUM_KEYS); + ASSERT(key < glfw::NUM_KEYS); g_key_status[key] = false; } @@ -98,14 +132,15 @@ void OnKeyRelease(int key) { */ static int CheckPadIdx(int pad) { - if (pad < 0 || pad > CONTROLLER_COUNT) { + if (pad < 0 || pad >= CONTROLLER_COUNT) { lg::error("Invalid pad {}", pad); return -1; } return pad; } -// returns 1 if button is pressed. returns 0 if invalid or not pressed. +// returns 1 if either keyboard or controller button is pressed. Controller button has priority. +// returns 0 if invalid or not pressed. int IsPressed(MappingInfo& mapping, Button button, int pad = 0) { if (CheckPadIdx(pad) == -1) { return 0; @@ -114,67 +149,119 @@ int IsPressed(MappingInfo& mapping, Button button, int pad = 0) { if (g_gamepad_buttons[pad][(int)button]) { return 1; } - auto key = mapping.pad_mapping[pad][(int)button]; + + int key = mapping.keyboard_button_mapping[pad][(int)button]; if (key == -1) return 0; auto& keymap = mapping.buffer_mode ? g_buffered_key_status : g_key_status; - ASSERT(key < NUM_KEYS); + ASSERT(key < glfw::NUM_KEYS); return keymap[key]; } +void SetAnalogAxisValue(MappingInfo& mapping_info, int axis, double value) { + const double sensitivity_numerator = Gfx::g_global_settings.target_fps; + const double minimum_sensitivity = 1e-4; + + for (int pad = 0; pad < CONTROLLER_COUNT; ++pad) { + for (int analog = 0; analog < (int)Analog::Max; ++analog) { + if (mapping_info.keyboard_analog_mapping[pad][analog].axis_id == axis) { + double newValue = value; + if (axis == GlfwKeyCustomAxis::CURSOR_X_AXIS) { + if (mapping_info.mouse_x_axis_sensitivities[pad] < minimum_sensitivity) { + mapping_info.mouse_x_axis_sensitivities[pad] = minimum_sensitivity; + } + newValue /= (sensitivity_numerator / mapping_info.mouse_x_axis_sensitivities[pad]); + } else if (axis == GlfwKeyCustomAxis::CURSOR_Y_AXIS) { + if (mapping_info.mouse_y_axis_sensitivities[pad] < minimum_sensitivity) { + mapping_info.mouse_y_axis_sensitivities[pad] = minimum_sensitivity; + } + newValue /= (sensitivity_numerator / mapping_info.mouse_y_axis_sensitivities[pad]); + } + + if (newValue > 1.0) { + g_key_analogs[pad][analog] = 1.0; + } else if (newValue < -1.0) { + g_key_analogs[pad][analog] = -1.0; + } else if (std::isnan(newValue)) { + g_key_analogs[pad][analog] = 0.0; + } else { + g_key_analogs[pad][analog] = newValue; + } + + // Invert logic used here. Left Y axis movement is based on towrds the camera. + // In game forward is treated as going away from the camera and backwards is headed towards + // the camera. + if (axis == GlfwKeyCustomAxis::CURSOR_Y_AXIS) { + g_key_analogs[pad][analog] *= -1; + } + } + } + } +} + +void UpdateAxisValue(MappingInfo& mapping_info) { + for (int pad = 0; pad < CONTROLLER_COUNT; ++pad) { + for (int analog = 0; analog < (int)Analog::Max; ++analog) { + if (mapping_info.keyboard_analog_mapping[pad][analog].mode == + AnalogMappingMode::AnalogInput) { + continue; // Assumed Set Axis set value already + } + + // Invert logic used here. Left Y axis movement is based on towrds the camera. + // In game forward is treated as going away from the camera and backwards is headed towards + // the camera. + double input = 0.0f; + if (mapping_info.keyboard_analog_mapping[pad][analog].positive_key > -1 && + mapping_info.keyboard_analog_mapping[pad][analog].positive_key < glfw::NUM_KEYS) { + if (analog == static_cast(Analog::Left_Y) || + analog == static_cast(Analog::Right_Y)) { + input -= + g_buffered_key_status[mapping_info.keyboard_analog_mapping[pad][analog].positive_key]; + } else { + input += + g_buffered_key_status[mapping_info.keyboard_analog_mapping[pad][analog].positive_key]; + } + } + if (mapping_info.keyboard_analog_mapping[pad][analog].negative_key > -1 && + mapping_info.keyboard_analog_mapping[pad][analog].negative_key < glfw::NUM_KEYS) { + if (analog == static_cast(Analog::Left_Y) || + analog == static_cast(Analog::Right_Y)) { + input += + g_buffered_key_status[mapping_info.keyboard_analog_mapping[pad][analog].negative_key]; + } else { + input -= + g_buffered_key_status[mapping_info.keyboard_analog_mapping[pad][analog].negative_key]; + } + } + g_key_analogs[pad][analog] = input; + } + } +} + // returns the value of the analog axis (in the future, likely pressure sensitive if we support it?) // if invalid or otherwise -- returns 127 (analog stick neutral position) -int AnalogValue(MappingInfo& /*mapping*/, Analog analog, int pad = 0) { +int GetAnalogValue(MappingInfo& /*mapping*/, Analog analog, int pad = 0) { + float input = 0.0f; if (CheckPadIdx(pad) == -1) { // Pad out of range, return a stable value return 127; } - float input = 0.0f; - if (pad == 0) { - // Movement controls mapped to WASD keys - if (g_buffered_key_status[GLFW_KEY_W] && analog == Analog::Left_Y) - input += -1.0f; - if (g_buffered_key_status[GLFW_KEY_S] && analog == Analog::Left_Y) - input += 1.0f; - if (g_buffered_key_status[GLFW_KEY_A] && analog == Analog::Left_X) - input += -1.0f; - if (g_buffered_key_status[GLFW_KEY_D] && analog == Analog::Left_X) - input += 1.0f; - - // Camera controls mapped to IJKL keys - if (g_buffered_key_status[GLFW_KEY_I] && analog == Analog::Right_Y) - input += -1.0f; - if (g_buffered_key_status[GLFW_KEY_K] && analog == Analog::Right_Y) - input += 1.0f; - if (g_buffered_key_status[GLFW_KEY_J] && analog == Analog::Right_X) - input += -1.0f; - if (g_buffered_key_status[GLFW_KEY_L] && analog == Analog::Right_X) - input += 1.0f; - } else if (pad == 1) { - // these bindings are not sane - if (g_buffered_key_status[GLFW_KEY_KP_5] && analog == Analog::Left_Y) - input += -1.0f; - if (g_buffered_key_status[GLFW_KEY_KP_2] && analog == Analog::Left_Y) - input += 1.0f; - if (g_buffered_key_status[GLFW_KEY_KP_1] && analog == Analog::Left_X) - input += -1.0f; - if (g_buffered_key_status[GLFW_KEY_KP_3] && analog == Analog::Left_X) - input += 1.0f; - - // these bindings are not sane - if (g_buffered_key_status[GLFW_KEY_KP_DIVIDE] && analog == Analog::Right_Y) - input += -1.0f; - if (g_buffered_key_status[GLFW_KEY_KP_8] && analog == Analog::Right_Y) - input += 1.0f; - if (g_buffered_key_status[GLFW_KEY_KP_7] && analog == Analog::Right_X) - input += -1.0f; - if (g_buffered_key_status[GLFW_KEY_KP_9] && analog == Analog::Right_X) - input += 1.0f; + float controller_input = 0.0f; + if (g_gamepads.gamepad_idx[pad] > -1) { + controller_input = g_gamepad_analogs[pad][(int)analog]; } - if (input == 0) { - input = g_gamepad_analogs[pad][(int)analog]; + float keyboard_input = g_key_analogs[pad][(int)analog]; + // Hack. Clearing the buffer immediately can lead to inconsistencies on analog input. + // If a mouse is disconnected or can't calculate a new delta it would stay stuck at 1. + // Decreasing the values gradually seems like a good comprise. + g_key_analogs[pad][(int)analog] *= 0.95; + + if (fabs(controller_input) > fabs(keyboard_input)) { + input = controller_input; + } else { + input = keyboard_input; } // GLFW provides float in range -1 to 1, caller expects 0-255 @@ -195,15 +282,62 @@ void MapButton(MappingInfo& mapping, Button button, int pad, int key) { return; } - mapping.pad_mapping[pad][(int)button] = key; + if (g_gamepads.gamepad_idx[pad] == -1) { + // TODO: Check if other pad is keyboard and if key is already bound + mapping.keyboard_button_mapping[pad][(int)button] = key; + } else { + mapping.controller_button_mapping[pad][(int)button] = key; + } +} + +void MapAnalog(MappingInfo& mapping, Analog button, int pad, AnalogMappingInfo& analomapping_info) { + // check if pad is valid. dont map buttons with invalid pads. + if (CheckPadIdx(pad) == -1) { + return; + } + + if (g_gamepads.gamepad_idx[pad] == -1) { + // TODO: Check if other pad is keyboard and if key is already bound + mapping.keyboard_analog_mapping[pad][(int)button] = analomapping_info; + } else { + mapping.controller_analog_mapping[pad][(int)button] = analomapping_info; + } } // reset button mappings void DefaultMapping(MappingInfo& mapping) { // make every button invalid - for (int p = 0; p < CONTROLLER_COUNT; ++p) { - for (int i = 0; i < (int)Button::Max; ++i) { - MapButton(mapping, (Button)i, p, -1); + for (int32_t pad = 0; pad < CONTROLLER_COUNT; ++pad) { + for (int32_t button = 0; button < (int)Pad::Button::Max; ++button) { + mapping.controller_button_mapping[pad][button] = -1; + mapping.keyboard_button_mapping[pad][button] = -1; + } + + for (int32_t analog = 0; analog < (int)Pad::Analog::Max; ++analog) { + mapping.controller_analog_mapping[pad][analog] = AnalogMappingInfo(); + mapping.keyboard_analog_mapping[pad][analog] = AnalogMappingInfo(); + } + } + + constexpr std::pair gamepad_map[] = { + {Button::Select, GLFW_GAMEPAD_BUTTON_BACK}, + {Button::L3, GLFW_GAMEPAD_BUTTON_LEFT_THUMB}, + {Button::R3, GLFW_GAMEPAD_BUTTON_RIGHT_THUMB}, + {Button::Start, GLFW_GAMEPAD_BUTTON_START}, + {Button::Up, GLFW_GAMEPAD_BUTTON_DPAD_UP}, + {Button::Right, GLFW_GAMEPAD_BUTTON_DPAD_RIGHT}, + {Button::Down, GLFW_GAMEPAD_BUTTON_DPAD_DOWN}, + {Button::Left, GLFW_GAMEPAD_BUTTON_DPAD_LEFT}, + {Button::L1, GLFW_GAMEPAD_BUTTON_LEFT_BUMPER}, + {Button::R1, GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER}, + {Button::Triangle, GLFW_GAMEPAD_BUTTON_TRIANGLE}, + {Button::Circle, GLFW_GAMEPAD_BUTTON_CIRCLE}, + {Button::X, GLFW_GAMEPAD_BUTTON_CROSS}, + {Button::Square, GLFW_GAMEPAD_BUTTON_SQUARE}}; + + for (int32_t pad = 0; pad < CONTROLLER_COUNT; ++pad) { + for (const auto& [button, value] : gamepad_map) { + mapping.controller_button_mapping[pad][(int)button] = value; } } @@ -212,6 +346,8 @@ void DefaultMapping(MappingInfo& mapping) { // // Need someway to toggle off -- where do we have access to the game's settings? + // TODO - What should the second pc default controls be? + // R1 / L1 MapButton(mapping, Button::L1, 0, GLFW_KEY_Q); MapButton(mapping, Button::R1, 0, GLFW_KEY_O); @@ -238,6 +374,31 @@ void DefaultMapping(MappingInfo& mapping) { // l3/r3 for menu MapButton(mapping, Button::L3, 0, GLFW_KEY_COMMA); MapButton(mapping, Button::R3, 0, GLFW_KEY_PERIOD); + + AnalogMappingInfo analomapping_info; + + analomapping_info.positive_key = GLFW_KEY_D; + analomapping_info.negative_key = GLFW_KEY_A; + MapAnalog(mapping, Analog::Left_X, 0, analomapping_info); + + analomapping_info.positive_key = GLFW_KEY_W; + analomapping_info.negative_key = GLFW_KEY_S; + MapAnalog(mapping, Analog::Left_Y, 0, analomapping_info); + + analomapping_info.mode = AnalogMappingMode::AnalogInput; + analomapping_info.axis_id = GlfwKeyCustomAxis::CURSOR_X_AXIS; + MapAnalog(mapping, Analog::Right_X, 0, analomapping_info); + + analomapping_info.axis_id = GlfwKeyCustomAxis::CURSOR_Y_AXIS; + MapAnalog(mapping, Analog::Right_Y, 0, analomapping_info); + + const double default_mouse_x_sensitivity = 5.0f; + const double default_mouse_y_sensitivity = 2.0f; + + for (int pad = 0; pad < CONTROLLER_COUNT; ++pad) { + mapping.mouse_x_axis_sensitivities[pad] = default_mouse_x_sensitivity; + mapping.mouse_y_axis_sensitivities[pad] = default_mouse_y_sensitivity; + } } void EnterInputMode() { @@ -315,29 +476,21 @@ void clear_pad(int pad) { for (int i = 0; i < (int)Button::Max; ++i) { g_gamepad_buttons[pad][i] = false; } - for (int i = 0; i < 4; ++i) { + for (int i = 0; i < (int)Analog::Max; ++i) { g_gamepad_analogs[pad][i] = 0; } } -void update_gamepads() { +void update_gamepads(MappingInfo& mapping_info) { check_gamepads(); + UpdateAxisValue(mapping_info); - constexpr std::pair gamepad_map[] = { - {Button::Select, GLFW_GAMEPAD_BUTTON_BACK}, - {Button::L3, GLFW_GAMEPAD_BUTTON_LEFT_THUMB}, - {Button::R3, GLFW_GAMEPAD_BUTTON_RIGHT_THUMB}, - {Button::Start, GLFW_GAMEPAD_BUTTON_START}, - {Button::Up, GLFW_GAMEPAD_BUTTON_DPAD_UP}, - {Button::Right, GLFW_GAMEPAD_BUTTON_DPAD_RIGHT}, - {Button::Down, GLFW_GAMEPAD_BUTTON_DPAD_DOWN}, - {Button::Left, GLFW_GAMEPAD_BUTTON_DPAD_LEFT}, - {Button::L1, GLFW_GAMEPAD_BUTTON_LEFT_BUMPER}, - {Button::R1, GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER}, - {Button::Triangle, GLFW_GAMEPAD_BUTTON_TRIANGLE}, - {Button::Circle, GLFW_GAMEPAD_BUTTON_CIRCLE}, - {Button::X, GLFW_GAMEPAD_BUTTON_CROSS}, - {Button::Square, GLFW_GAMEPAD_BUTTON_SQUARE}}; + if (g_gamepads.gamepad_idx[0] == -1) { + for (int pad = 0; pad < CONTROLLER_COUNT; ++pad) { + clear_pad(pad); + } + return; + } constexpr std::pair gamepad_analog_map[] = { {Analog::Left_X, GLFW_GAMEPAD_AXIS_LEFT_X}, @@ -345,12 +498,13 @@ void update_gamepads() { {Analog::Right_X, GLFW_GAMEPAD_AXIS_RIGHT_X}, {Analog::Right_Y, GLFW_GAMEPAD_AXIS_RIGHT_Y}}; - auto read_pad_state = [gamepad_map, gamepad_analog_map](int pad) { + auto read_pad_state = [gamepad_analog_map, mapping_info](int pad) { GLFWgamepadstate state; glfwGetGamepadState(g_gamepads.gamepad_idx[pad], &state); - for (const auto& [button, idx] : gamepad_map) { - g_gamepad_buttons[pad][(int)button] = state.buttons[idx]; + for (int32_t button = 0; button < (int)Pad::Button::Max; ++button) { + int key = mapping_info.controller_button_mapping[pad][button]; + g_gamepad_buttons[pad][(int)button] = state.buttons[key]; } g_gamepad_buttons[pad][(int)Button::L2] = state.axes[GLFW_GAMEPAD_AXIS_LEFT_TRIGGER] > 0; @@ -377,4 +531,37 @@ int rumble(int pad, float slow_motor, float fast_motor) { return 0; } +int GetGamepadState(int pad) { + return g_gamepads.gamepad_idx[pad]; +} + +// The following setters/getters are mainly used for unit tests +void SetGamepadState(int pad, int pad_index) { + if (CheckPadIdx(pad) != -1) { + if (pad_index <= GLFW_JOYSTICK_LAST) { + g_gamepads.gamepad_idx[pad] = pad_index; + } + } +} + +bool* GetKeyboardInputBuffer() { + return g_key_status; +} +// key-down status of any detected key. this is buffered for the remainder of a frame. +bool* GetKeyboardBufferedInputBuffer() { + return g_buffered_key_status; +} + +float* GetKeyboardInputAnalogBuffer(int pad) { + return g_key_analogs[pad]; +} + +bool* GetControllerInputBuffer(int pad) { + return g_gamepad_buttons[pad]; +} + +float* GetControllerAnalogInputBuffer(int pad) { + return g_gamepad_analogs[pad]; +} + }; // namespace Pad diff --git a/game/system/newpad.h b/game/system/newpad.h index 0d5d994e54..0eb2e3ed30 100644 --- a/game/system/newpad.h +++ b/game/system/newpad.h @@ -60,23 +60,48 @@ enum class Button { O = Circle }; +enum class AnalogMappingMode { DigitalInput = 0, AnalogInput = 1 }; + +// AnalogMappingInfo allows either button or axes to control analog input(s). +// * In Digital Input Mode, uses both positive_key and negative_key as button indices. +// * In Analog Input mode, only the positive_key is used. +// - The positive_key in Analog Input mode represents an analog axis (i.e +// GLFW_GAMEPAD_AXIS_RIGHT_Y) +struct AnalogMappingInfo { + AnalogMappingMode mode = AnalogMappingMode::DigitalInput; + int axis_id = -1; + int positive_key = -1; + int negative_key = -1; +}; + struct MappingInfo { bool debug = true; // debug mode bool buffer_mode = true; // use buffered inputs - int pad_mapping[CONTROLLER_COUNT][(int)Pad::Button::Max]; // controller button mapping + int controller_button_mapping[CONTROLLER_COUNT][(int)Pad::Button::Max]; + AnalogMappingInfo controller_analog_mapping[CONTROLLER_COUNT][(int)Pad::Analog::Max]; + + int keyboard_button_mapping[CONTROLLER_COUNT][( + int)Pad::Button::Max]; // Back up in case controller gets disconnected + AnalogMappingInfo keyboard_analog_mapping[CONTROLLER_COUNT][(int)Pad::Analog::Max]; + double mouse_x_axis_sensitivities[CONTROLLER_COUNT]; + double mouse_y_axis_sensitivities[CONTROLLER_COUNT]; // TODO complex button mapping & key macros (e.g. shift+x for l2+r2 press etc.) }; void OnKeyPress(int key); void OnKeyRelease(int key); +void ClearKey(int key); void ForceClearKeys(); void ClearKeys(); void DefaultMapping(MappingInfo& mapping); int IsPressed(MappingInfo& mapping, Button button, int pad); -int AnalogValue(MappingInfo& mapping, Analog analog, int pad); +int GetAnalogValue(MappingInfo& mapping, Analog analog, int pad); void MapButton(MappingInfo& mapping, Button button, int pad, int key); +void MapAnalog(MappingInfo& mapping, Button button, int pad, AnalogMappingInfo& analogMapping); +void SetAnalogAxisValue(MappingInfo& mapping, int axis, double value); +void ClearAnalogAxisValue(MappingInfo& mapping, int axis); // this enum is also in pc-pad-utils.gc enum class InputModeStatus { Disabled, Enabled, Canceled }; @@ -90,7 +115,18 @@ u64 input_mode_get_index(); void input_mode_pad_set(s64); void initialize(); -void update_gamepads(); +void update_gamepads(MappingInfo& mapping_info); int rumble(int pad, float slow_motor, float fast_motor); +int GetGamepadState(int pad); +void ForceClearAnalogValue(); +void clear_pad(int pad); + +void UpdateAxisValue(MappingInfo& mapping_info); +void SetGamepadState(int pad, int pad_index); +bool* GetKeyboardInputBuffer(); +bool* GetKeyboardBufferedInputBuffer(); +float* GetKeyboardInputAnalogBuffer(int pad); +bool* GetControllerInputBuffer(int pad); +float* GetControllerAnalogInputBuffer(int pad); } // namespace Pad diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1e76c35927..949435a2b9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -34,6 +34,7 @@ add_executable(goalc-test ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_DataParser.cpp ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_DisasmVifDecompile.cpp ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_VuDisasm.cpp + ${CMAKE_CURRENT_LIST_DIR}/game/test_newpad.cpp ${GOALC_TEST_FRAMEWORK_SOURCES} ${GOALC_TEST_CASES}) diff --git a/test/game/test_newpad.cpp b/test/game/test_newpad.cpp new file mode 100644 index 0000000000..6308324d3e --- /dev/null +++ b/test/game/test_newpad.cpp @@ -0,0 +1,311 @@ + +#include +#include + +#include "game/graphics/pipelines/opengl.h" +#include "game/system/newpad.h" +#include "gtest/gtest.h" +//#include "gmock/gmock.h" + +class PeripheralTest : public ::testing::Test { + public: + PeripheralTest() { + Pad::ForceClearKeys(); + Pad::ForceClearAnalogValue(); + + for (int i = 0; i < Pad::CONTROLLER_COUNT; ++i) { + Pad::clear_pad(i); + Pad::SetGamepadState(i, -1); + } + Pad::DefaultMapping(mapping_info_); + }; + ~PeripheralTest(){}; + + protected: + Pad::MappingInfo mapping_info_; +}; + +TEST_F(PeripheralTest, UpdatePad_KeyboardPad_ClearsControllerInputBuffers) { + // Arrange + bool expected_controller_status = false; + + bool* controller_input_buffer = Pad::GetControllerInputBuffer(0); + ::memset(controller_input_buffer, true, + sizeof(controller_input_buffer[0]) * (int)Pad::Button::Max); + + // Act + Pad::update_gamepads(mapping_info_); + + // Assert + for (int i = 0; i < (int)Pad::Button::Max; ++i) { + EXPECT_EQ(expected_controller_status, controller_input_buffer[i]); + } +} +TEST_F(PeripheralTest, ClearKey_ValidKey_UpdateKeyboardBuffer) { + // Arrange + int input_key = 127; + bool expected_buffer_key_status = false; + + bool* actual_keyboard_buffer = Pad::GetKeyboardBufferedInputBuffer(); + ::memset(actual_keyboard_buffer, true, sizeof(*actual_keyboard_buffer) * glfw::NUM_KEYS); + + // Act + Pad::ClearKey(input_key); + + // Assert + bool actual_buffer_key_status = actual_keyboard_buffer[input_key]; + EXPECT_EQ(expected_buffer_key_status, actual_buffer_key_status); +} +TEST_F(PeripheralTest, ClearKey_InvalidKey_DoNothing) { + // Arrange + int input_key = glfw::NUM_KEYS + 1; + bool expected_buffer_key_status = true; + + bool* actual_keyboard_buffer = Pad::GetKeyboardBufferedInputBuffer(); + ::memset(actual_keyboard_buffer, true, sizeof(*actual_keyboard_buffer) * glfw::NUM_KEYS); + + // Act + Pad::ClearKey(input_key); + + // Assert + for (int i = 0; i < glfw::NUM_KEYS; ++i) { + EXPECT_EQ(expected_buffer_key_status, actual_keyboard_buffer[i]); + } +} +TEST_F(PeripheralTest, SetAnalogAxisValue_NominalAnalogAxisX_SetConvertedValue) { + // Arrange + float expected_analog_value = 0; + std::swap(mapping_info_.controller_analog_mapping[0][(int)Pad::Analog::Left_X], + mapping_info_.controller_analog_mapping[0][(int)Pad::Analog::Right_X]); + + // Act + Pad::SetAnalogAxisValue(mapping_info_, static_cast(GlfwKeyCustomAxis::CURSOR_X_AXIS), 100.0); + + // Assert + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(0); + EXPECT_FLOAT_EQ(expected_analog_value, keyboard_analog_buffer[(int)Pad::Analog::Left_X]); +} +TEST_F(PeripheralTest, SetAnalogAxisValue_NominalAnalogAxisY_SetConvertedValue) { // Arrange + float expected_analog_value = 0; + std::swap(mapping_info_.controller_analog_mapping[0][(int)Pad::Analog::Left_Y], + mapping_info_.controller_analog_mapping[0][(int)Pad::Analog::Right_Y]); + + // Act + Pad::SetAnalogAxisValue(mapping_info_, static_cast(GlfwKeyCustomAxis::CURSOR_X_AXIS), 100.0); + + // Assert + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(0); + EXPECT_FLOAT_EQ(expected_analog_value, keyboard_analog_buffer[(int)Pad::Analog::Left_Y]); +} +TEST_F(PeripheralTest, SetAnalogAxisValue_InputLargerThanMaxValue_SetMaxValue) { + // Arrange + float expected_analog_value = 1; + + // Act + Pad::SetAnalogAxisValue(mapping_info_, static_cast(GlfwKeyCustomAxis::CURSOR_X_AXIS), 100.0); + + // Assert + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(0); + EXPECT_FLOAT_EQ(expected_analog_value, keyboard_analog_buffer[(int)Pad::Analog::Right_X]); +} +TEST_F(PeripheralTest, SetAnalogAxisValue_InputSmallerThanMinValue_SetMinValue) { + // Arrange + float expected_analog_value = -1; + + // Act + Pad::SetAnalogAxisValue(mapping_info_, static_cast(GlfwKeyCustomAxis::CURSOR_X_AXIS), + -100.0); + + // Assert + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(0); + EXPECT_FLOAT_EQ(expected_analog_value, keyboard_analog_buffer[(int)Pad::Analog::Right_X]); +} +TEST_F(PeripheralTest, SetAnalogAxisValue_InputIsNAN_SetZero) { + // Arrange + float expected_analog_value = 0; + + // Act + Pad::SetAnalogAxisValue(mapping_info_, static_cast(GlfwKeyCustomAxis::CURSOR_X_AXIS), + std::nan("1")); + + // Assert + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(0); + EXPECT_FLOAT_EQ(expected_analog_value, keyboard_analog_buffer[(int)Pad::Analog::Right_X]); +} +TEST_F( + PeripheralTest, + SetAnalogAxisValue_MouseXAxisSensitivityLowerThanMinimumSensitivty_SetMouseSensitivityToMinimum) { + // Arrange + float expected_x_axis_sensitivity = 1e-4; + mapping_info_.mouse_x_axis_sensitivities[0] = 0; + + // Act + Pad::SetAnalogAxisValue(mapping_info_, static_cast(GlfwKeyCustomAxis::CURSOR_X_AXIS), 100); + + // Assert + EXPECT_FLOAT_EQ(expected_x_axis_sensitivity, mapping_info_.mouse_x_axis_sensitivities[0]); +} +TEST_F( + PeripheralTest, + SetAnalogAxisValue_MouseYAxisSensitivityLowerThanMinimumSensitivty_SetMouseSensitivityToMinimum) { + // Arrange + float expected_y_axis_sensitivity = 1e-4; + mapping_info_.mouse_y_axis_sensitivities[0] = 0; + + // Act + Pad::SetAnalogAxisValue(mapping_info_, static_cast(GlfwKeyCustomAxis::CURSOR_Y_AXIS), 100); + + // Assert + EXPECT_FLOAT_EQ(expected_y_axis_sensitivity, mapping_info_.mouse_y_axis_sensitivities[0]); +} + +TEST_F(PeripheralTest, UpdateAxisValue_XAxisPositiveKey_IncrementValue) { + // Arrange + float expected_analog_value = 1.0f; + int pad_index = 0; + int key = GLFW_KEY_D; + bool* keyboard_buffered_key_buffer = Pad::GetKeyboardBufferedInputBuffer(); + keyboard_buffered_key_buffer[key] = true; + + // Act + Pad::UpdateAxisValue(mapping_info_); + + // Arrange + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(pad_index); + float actual_analog_value = keyboard_analog_buffer[(int)Pad::Analog::Left_X]; + EXPECT_FLOAT_EQ(expected_analog_value, actual_analog_value); +} +TEST_F(PeripheralTest, UpdateAxisValue_YAxisPositiveKey_DecrementValue) { + // Arrange + float expected_analog_value = -1.0f; + int pad_index = 0; + int key = GLFW_KEY_W; + bool* keyboard_buffered_key_buffer = Pad::GetKeyboardBufferedInputBuffer(); + keyboard_buffered_key_buffer[key] = true; + + // Act + Pad::UpdateAxisValue(mapping_info_); + + // Arrange + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(pad_index); + float actual_analog_value = keyboard_analog_buffer[(int)Pad::Analog::Left_Y]; + EXPECT_FLOAT_EQ(expected_analog_value, actual_analog_value); +} +TEST_F(PeripheralTest, UpdateAxisValue_XAxisNegativeKey_DecrementValue) { + // Arrange + int pad_index = 0; + float expected_analog_value = -1.0f; + + int key = GLFW_KEY_A; + bool* keyboard_buffered_key_buffer = Pad::GetKeyboardBufferedInputBuffer(); + keyboard_buffered_key_buffer[key] = true; + + // Act + Pad::UpdateAxisValue(mapping_info_); + + // Arrange + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(pad_index); + float actual_analog_value = keyboard_analog_buffer[(int)Pad::Analog::Left_X]; + EXPECT_FLOAT_EQ(expected_analog_value, actual_analog_value); +} + +TEST_F(PeripheralTest, UpdateAxisValue_RightYAxisPositiveKey_IncrementValue) { + // Arrange + float expected_analog_value = 1.0f; + int pad_index = 0; + int key = GLFW_KEY_S; + bool* keyboard_buffered_key_buffer = Pad::GetKeyboardBufferedInputBuffer(); + keyboard_buffered_key_buffer[key] = true; + + // Act + Pad::UpdateAxisValue(mapping_info_); + + // Arrange + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(pad_index); + float actual_analog_value = keyboard_analog_buffer[(int)Pad::Analog::Left_Y]; + EXPECT_FLOAT_EQ(expected_analog_value, actual_analog_value); +} + +TEST_F(PeripheralTest, GetAnalogValue_InvalidPadId_ReturnsNeutralPosition) { + // Arrange + int expected_analog_status = 127; + + // Act + int actual_analog_status = Pad::GetAnalogValue(mapping_info_, Pad::Analog::Left_X, 2); + + // Assert + EXPECT_EQ(expected_analog_status, actual_analog_status); +} +TEST_F(PeripheralTest, GetAnalogValue_ControllerPad_ReturnsAnalogValue) { + // Arrange + int expected_analog_status = 0; + + int pad_index = 0; + int controller_index = 0; + Pad::SetGamepadState(pad_index, controller_index); + + float* controller_analog_buffer = Pad::GetControllerAnalogInputBuffer(pad_index); + controller_analog_buffer[(int)Pad::Analog::Left_X] = -1.0f; + + // Act + int actual_analog_status = Pad::GetAnalogValue(mapping_info_, Pad::Analog::Left_X, 0); + + // Assert + EXPECT_EQ(expected_analog_status, actual_analog_status); +} +TEST_F(PeripheralTest, GetAnalogValue_KeyboardPad_ReturnsAnalogValue) { + // Arrange + int expected_analog_status = 255; + int pad_index = 0; + + float* keyboard_analog_buffer = Pad::GetKeyboardInputAnalogBuffer(pad_index); + keyboard_analog_buffer[(int)Pad::Analog::Left_X] = 1.0f; + + // Act + int actual_analog_status = Pad::GetAnalogValue(mapping_info_, Pad::Analog::Left_X, 0); + + // Assert + EXPECT_EQ(expected_analog_status, actual_analog_status); +} + +TEST_F(PeripheralTest, IsPressed_InvalidPadId_ReturnsFalse) { + // Arrange + int expected_button_status = 0; + + // Act + int actual_button_status = Pad::IsPressed(mapping_info_, Pad::Button::X, 2); + + // Assert + EXPECT_EQ(expected_button_status, actual_button_status); +} +TEST_F(PeripheralTest, IsPressed_ControllerPad_ReturnsControllerBufferValue) { + // Arrange + int expected_button_status = 1; + + int pad_index = 0; + int controller_index = 0; + Pad::SetGamepadState(pad_index, controller_index); + + bool* controller_button_status_buffer = Pad::GetControllerInputBuffer(pad_index); + controller_button_status_buffer[(int)Pad::Button::X] = expected_button_status; + + // Act + int actual_button_status = Pad::IsPressed(mapping_info_, Pad::Button::X, pad_index); + + // Assert + EXPECT_EQ(expected_button_status, actual_button_status); +} +TEST_F(PeripheralTest, IsPressed_KeyboardPad_ReturnsKeyboardBufferValue) { + // Arrange + int expected_button_status = 1; + bool* keyboard_buffered_key_status_buffer = Pad::GetKeyboardBufferedInputBuffer(); + keyboard_buffered_key_status_buffer[GLFW_KEY_SPACE] = expected_button_status; + + // Act + int actual_button_status = Pad::IsPressed(mapping_info_, Pad::Button::X, 0); + + // Assert + EXPECT_EQ(expected_button_status, actual_button_status); +} + +// TODO: InputModeStatus Tests From b3c58d2247c232511371dba5166b03b27267ade9 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Fri, 19 Aug 2022 11:30:07 -0400 Subject: [PATCH 07/23] scripts: Add a (hopefully) better goal_src updating script (#1769) * scripts: cleanup scripts directory some more * stash, getting there * stash again * closer! * it works! decently....cleanup time and add some extra features * minor cleanup --- .gitignore | 1 + .vscode/launch.json | 4 +- Taskfile.yml | 10 - goal_src/jak2/kernel/gkernel.gc | 65 +- scripts/add-all-heap-bases.py | 30 - scripts/add-pragma-once-headers.py | 21 - scripts/add-reference-test.py | 34 - scripts/{ => examples}/nrepl-test.py | 0 scripts/{ => gsrc}/check-gsrc-file.py | 0 scripts/gsrc/requirements.txt | 1 + .../check_for_identical_objs.py | 0 .../init_folder_struct_jak2.py | 0 .../make_empty_obj_files.py | 0 .../remove_identical_objs.py | 0 scripts/gsrc/update-from-decomp.py | 967 +++ scripts/gsrc/utils.py | 31 + scripts/jak1-symbol-mapping.json | 7144 ----------------- scripts/search-decomp/.gitignore | 2 - scripts/search-decomp/grep.py | 72 - scripts/search-decomp/vu-fp-instructions.txt | 122 - scripts/update-game-text-id.py | 61 - scripts/update-goal-src.py | 131 - 22 files changed, 1043 insertions(+), 7653 deletions(-) delete mode 100644 scripts/add-all-heap-bases.py delete mode 100644 scripts/add-pragma-once-headers.py delete mode 100644 scripts/add-reference-test.py rename scripts/{ => examples}/nrepl-test.py (100%) rename scripts/{ => gsrc}/check-gsrc-file.py (100%) create mode 100644 scripts/gsrc/requirements.txt rename scripts/{initial_gsrc_creation => gsrc/skeleton_creation}/check_for_identical_objs.py (100%) rename scripts/{initial_gsrc_creation => gsrc/skeleton_creation}/init_folder_struct_jak2.py (100%) rename scripts/{initial_gsrc_creation => gsrc/skeleton_creation}/make_empty_obj_files.py (100%) rename scripts/{initial_gsrc_creation => gsrc/skeleton_creation}/remove_identical_objs.py (100%) create mode 100644 scripts/gsrc/update-from-decomp.py create mode 100644 scripts/gsrc/utils.py delete mode 100644 scripts/jak1-symbol-mapping.json delete mode 100644 scripts/search-decomp/.gitignore delete mode 100644 scripts/search-decomp/grep.py delete mode 100644 scripts/search-decomp/vu-fp-instructions.txt delete mode 100644 scripts/update-game-text-id.py delete mode 100644 scripts/update-goal-src.py diff --git a/.gitignore b/.gitignore index 2c014eb495..7bba4e3ac9 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ texture_replacements/* svnrev.h ci-artifacts/ out/build/ +__pycache__/ diff --git a/.vscode/launch.json b/.vscode/launch.json index 5bfcae9f77..6db58b557a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,9 +8,9 @@ "name": "Python", "type": "python", "request": "launch", - "program": "${workspaceFolder}/scripts/initial_gsrc_creation/replicate_folder_structure.py", + "program": "${workspaceFolder}/scripts/gsrc/update-from-decomp.py", "console": "integratedTerminal", - "cwd": "${workspaceFolder}/scripts/initial_gsrc_creation" + "cwd": "${workspaceFolder}" }, ] } diff --git a/Taskfile.yml b/Taskfile.yml index 6196e59ec1..db2b7a73b9 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -78,17 +78,7 @@ tasks: cmds: - rm ./decompiler_out/**/*.asm - rm ./decompiler_out/**/*disasm.gc - # TODO - the below are broken, need to be updated or replaced - # update-gsrc: - # cmds: - # - python ./scripts/next-decomp-file.py --files "{{.FILES}}" - # - task: decomp - # - task: find-label-types - # - python ./scripts/update-goal-src.py --files "{{.FILES}}" - # - task: type-test - # - task: check-gsrc-file # TOOLS - # TODO - broken! # analyze-ee-memory: # cmds: # - '{{.MEMDUMP_BIN_RELEASE_DIR}}/memory_dump_tool "{{.FILE}}" ./ > ee-analysis.log' diff --git a/goal_src/jak2/kernel/gkernel.gc b/goal_src/jak2/kernel/gkernel.gc index 03444d131f..9c8b500b33 100644 --- a/goal_src/jak2/kernel/gkernel.gc +++ b/goal_src/jak2/kernel/gkernel.gc @@ -5,6 +5,25 @@ ;; name in dgo: gkernel ;; dgos: KERNEL +;; og:ignore-errors:true +;; og:ignore-form:defun kernel-dispatcher + +;; forward declared stuff +(define-extern *kernel-clock* clock) +(define-extern *debug-dead-pool* dead-pool-heap) +(define-extern *null-process* process) +(define-extern *vis-boot* symbol) +(define-extern *listener-process* process) +(define-extern *active-pool* process-tree) +(define-extern *default-level* level) + +(define-extern change-parent (function process-tree process-tree process-tree)) +(define-extern search-process-tree (function process-tree (function process-tree object) process-tree)) +(define-extern iterate-process-tree (function process-tree (function object object) kernel-context object)) +(define-extern execute-process-tree (function process-tree (function object object) kernel-context object)) +(define-extern inspect-process-tree (function process-tree int int symbol process-tree)) +(define-extern process-disconnect (function process int)) + ;; DECOMP BEGINS ;; Version constants @@ -16,30 +35,12 @@ (define *kernel-boot-level* #f) (define *use-old-listener-print* #f) - ;; Stats (define *deci-count* 0) (define *last-loado-length* 0) (define *last-loado-global-usage* 0) (define *last-loado-debug-usage* 0) -;; forward declared stuff -(define-extern *kernel-clock* clock) -(define-extern *debug-dead-pool* dead-pool-heap) -(define-extern *null-process* process) -(define-extern *vis-boot* symbol) -(define-extern *listener-process* process) -(define-extern *active-pool* process-tree) -(define-extern *default-level* level) - - -(define-extern change-parent (function process-tree process-tree process-tree)) -(define-extern search-process-tree (function process-tree (function process-tree object) process-tree)) -(define-extern iterate-process-tree (function process-tree (function object object) kernel-context object)) -(define-extern execute-process-tree (function process-tree (function object object) kernel-context object)) -(define-extern inspect-process-tree (function process-tree int int symbol process-tree)) -(define-extern process-disconnect (function process int)) - (defmethod relocate object ((obj object) (arg0 int)) "Most general relocate method." obj @@ -90,8 +91,10 @@ ;; the main execution stack that's not on the scratchpad (define *dram-stack* (the-as (pointer uint8) (malloc 'global DPROCESS_STACK_SIZE))) +;; DECOMP DEVIATION ;; the top of the stack. (defconstant *kernel-dram-stack* (&+ *dram-stack* DPROCESS_STACK_SIZE)) +;; DECOMP DEVIATION ;; the top of the scratchpad stack (set! (-> *kernel-context* fast-stack-top) (the-as pointer #x70004000)) @@ -102,6 +105,7 @@ ;; PC Port Scratchpad ;;;;;;;;;;;;;;;;;;;;;;; +;; DECOMP DEVIATION (#cond (PC_PORT ;; we'll create a fake scratchpad: @@ -140,7 +144,7 @@ (< (the-as int ,x) (scratchpad-end)) ) ) - +;; DECOMP DEVIATION ;;;;;;;;;;;;; ;; Thread @@ -238,11 +242,13 @@ (none) ) +;; decomp deviation (defun-debug stream<-process-mask ((arg0 object) (arg1 process-mask)) "Print a process mask." (bit-enum->string process-mask arg1 arg0) arg1 ) +;; decomp deviation (define *master-mode* 'game) (define *pause-lock* #f) @@ -417,6 +423,7 @@ obj ) +;; decomp deviation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Context Suspend And Resume - Kernel ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -789,6 +796,8 @@ ) (none) ) +;; decomp deviation + (defmethod new dead-pool ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int) (arg2 string)) "Allocate a tree of dead processes." @@ -814,6 +823,7 @@ ) ) +;; decomp deviation (defmethod get-process dead-pool ((obj dead-pool) (arg0 type) (arg1 int)) "Try to get a process from this dead pool. If it fails, try the debug dead pool and complain." @@ -835,7 +845,6 @@ ;; this didn't work right in the original game, just crash here. (break) ) - (cond (s4-0 ;; got a process somehow, set the type and return. @@ -854,6 +863,7 @@ ) ) ) +;; decomp deviation (defmethod return-process dead-pool ((obj dead-pool) (arg0 process)) "Return a process to the dead pool." @@ -1127,6 +1137,7 @@ ) ) +;; decomp deviation (defmethod return-process dead-pool-heap ((obj dead-pool-heap) (proc process)) "Return a process to a dead pool heap" @@ -1215,6 +1226,8 @@ ) obj ) +;; decomp deviation + (defmethod compact dead-pool-heap ((obj dead-pool-heap) (arg0 int)) "Relocate processes to remove gaps and increase free memory." @@ -1521,6 +1534,7 @@ (the-as process-tree #f) ) +;; decomp deviation (defun kernel-dispatcher () "Main entry point to GOAL from C++." @@ -1649,6 +1663,7 @@ ) |# +;; decomp deviation (defun sync-dispatcher () "Run just the listener function. Used for SQL query stuff." @@ -1726,6 +1741,7 @@ `(the-as (function uint uint uint uint uint uint object) ,func) ) +;; decomp deviation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Stack Frame Stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1843,7 +1859,6 @@ ) ) - (defun throw-dispatch ((obj catch-frame) value) "Throw the given value to the catch frame. Only can throw a 64-bit value. The original could throw 128 bits." @@ -1940,6 +1955,7 @@ (format 0 "ERROR: throw could not find tag ~A~%" name) (break) ) +;; decomp deviation (defmethod new protect-frame ((allocation symbol) (type-to-make type) (arg0 (function none))) "Create a new protect frame, must be on the stack." @@ -2086,6 +2102,7 @@ arg0 ) +;; decomp deviation (defmethod activate process ((obj process) (arg0 process-tree) (arg1 basic) (arg2 pointer)) "Start a process!" ;; if we got the scratchpad stack, move to the fake scratchpad. @@ -2140,7 +2157,6 @@ (change-parent obj arg0) ) - (defun run-function-in-process ((obj process) (func function) a0 a1 a2 a3 a4 a5) "Switch to the given process and run the function. This is used to initialize a process. The function will run until it attempts to change state. At the first attempt to change state, @@ -2242,9 +2258,8 @@ (.add a4 a4) (.add a5 a5) ) - ) - +;; decomp deviation (defun set-to-run ((thread cpu-thread) (func function) a0 a1 a2 a3 a4 a5) "Set the given thread to call the given function with the given arguments next time it resumes. @@ -2290,6 +2305,7 @@ (set! (-> dead-state code) (the (function none :behavior process) nothing)) (define entity-deactivate-handler (the-as (function process entity-actor none) nothing)) +;; decomp deviation (defmethod deactivate process ((obj process)) "Kill a process." (with-pp @@ -2376,6 +2392,7 @@ (none) ) ) +;; decomp deviation ;;;;;;;;;;;;;;;;;;; ;; Kernel globals diff --git a/scripts/add-all-heap-bases.py b/scripts/add-all-heap-bases.py deleted file mode 100644 index bec7f93f37..0000000000 --- a/scripts/add-all-heap-bases.py +++ /dev/null @@ -1,30 +0,0 @@ -import os - -new_file = [] -with open("./decompiler/config/all-types.gc") as f: - symbols_found = [] - lines = f.readlines() - - for line_num, line in enumerate(lines): - if "flag-assert" in line: - heap_base_amount = "" - flag_assert = line.split("#x")[1].strip() - heap_base_amount = flag_assert[len(flag_assert)-7:len(flag_assert)-4] - if len(flag_assert) > 1 and heap_base_amount != "000": - # First let's check to see if the heap-base already exists around this line - found_heapbase = False - for i in range(line_num - 4, line_num + 3): - temp_line = lines[i] - if "heap-base" in temp_line: - found_heapbase = True - break - if found_heapbase == False: - if line.startswith(";"): - new_file.append("; :heap-base #x{}\n".format(heap_base_amount.lstrip("0"))) - else: - new_file.append(" :heap-base #x{}\n".format(heap_base_amount.lstrip("0"))) - new_file.append(line) - -os.remove("./decompiler/config/all-types.gc") -with open("./decompiler/config/all-types.gc", "w") as f: - f.writelines(new_file) diff --git a/scripts/add-pragma-once-headers.py b/scripts/add-pragma-once-headers.py deleted file mode 100644 index b8e214b68b..0000000000 --- a/scripts/add-pragma-once-headers.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import os -from glob import glob - - -folders = sys.argv -cwd = os.getcwd() - -for folder in folders: - directory = os.path.join(cwd, folder) - files = [y for x in os.walk(directory) for y in glob(os.path.join(x[0], '*.h'))] - for fPath in files: - print("Processing %s" % fPath) - with open(fPath, 'r+') as f: - content = f.read() - f.seek(0, 0) - if (content.startswith("#pragma once") == False): - f.write("#pragma once\n\n" + content) - diff --git a/scripts/add-reference-test.py b/scripts/add-reference-test.py deleted file mode 100644 index e3bb9f8be2..0000000000 --- a/scripts/add-reference-test.py +++ /dev/null @@ -1,34 +0,0 @@ -# Decompiles and adds the file to the reference test folder -from jak1_file_list import file_list - -import argparse -parser = argparse.ArgumentParser() -parser.add_argument("--file") -args = parser.parse_args() - -if not args.file: - print("No --file argument provided!") - exit(1) - -import os - -# TODO - make customizable -if not os.path.exists("./decompiler_out/jak1/{}_disasm.gc".format(args.file)): - print("File not already decompiled!") - exit(1) - -src_path = "" -for f in file_list: - if f[2] != 3: - continue - if f[0] == args.file: - src_path = f[4] - break - -if not os.path.exists("./test/decompiler/reference/{}".format(src_path)): - os.makedirs("./test/decompiler/reference/{}".format(src_path)) - -import shutil - -shutil.copy("./decompiler_out/jak1/{}_disasm.gc".format(args.file), "./test/decompiler/reference/{}/{}_REF.gc".format(src_path, args.file)) -print("Copied!") diff --git a/scripts/nrepl-test.py b/scripts/examples/nrepl-test.py similarity index 100% rename from scripts/nrepl-test.py rename to scripts/examples/nrepl-test.py diff --git a/scripts/check-gsrc-file.py b/scripts/gsrc/check-gsrc-file.py similarity index 100% rename from scripts/check-gsrc-file.py rename to scripts/gsrc/check-gsrc-file.py diff --git a/scripts/gsrc/requirements.txt b/scripts/gsrc/requirements.txt new file mode 100644 index 0000000000..ec512b4a94 --- /dev/null +++ b/scripts/gsrc/requirements.txt @@ -0,0 +1 @@ +rapidfuzz diff --git a/scripts/initial_gsrc_creation/check_for_identical_objs.py b/scripts/gsrc/skeleton_creation/check_for_identical_objs.py similarity index 100% rename from scripts/initial_gsrc_creation/check_for_identical_objs.py rename to scripts/gsrc/skeleton_creation/check_for_identical_objs.py diff --git a/scripts/initial_gsrc_creation/init_folder_struct_jak2.py b/scripts/gsrc/skeleton_creation/init_folder_struct_jak2.py similarity index 100% rename from scripts/initial_gsrc_creation/init_folder_struct_jak2.py rename to scripts/gsrc/skeleton_creation/init_folder_struct_jak2.py diff --git a/scripts/initial_gsrc_creation/make_empty_obj_files.py b/scripts/gsrc/skeleton_creation/make_empty_obj_files.py similarity index 100% rename from scripts/initial_gsrc_creation/make_empty_obj_files.py rename to scripts/gsrc/skeleton_creation/make_empty_obj_files.py diff --git a/scripts/initial_gsrc_creation/remove_identical_objs.py b/scripts/gsrc/skeleton_creation/remove_identical_objs.py similarity index 100% rename from scripts/initial_gsrc_creation/remove_identical_objs.py rename to scripts/gsrc/skeleton_creation/remove_identical_objs.py diff --git a/scripts/gsrc/update-from-decomp.py b/scripts/gsrc/update-from-decomp.py new file mode 100644 index 0000000000..67ce4a4fed --- /dev/null +++ b/scripts/gsrc/update-from-decomp.py @@ -0,0 +1,967 @@ +# Updates a gsrc file from it's respective decompiled output +# Tries it's very best to: +# - retain all comments (100% of them) +# - place them in either the exact same spot, or roughly the same spot +# - retain decomp deviations (marked with ;; decomp deviation comment guards) and try to place them back +# - this will also automate the process of knowing if a file was modified or not if actually used +# +# This is done with a variety of heuristics and can obviously only be so +# accurate on unstructured data like code +# +# Assumes this is ran from the root dir of the repository + +# Overview of the process: +# - Collect all comments, associate as much metadata with them as possible so we can reposition them in the new output +# - Potential metadata that will help (from most to least accurate) +# - symbol it is directly before/after (symbol names don't change, so this is VERY accurate (ie. a function name / type name)) +# - forms/variable names it is directly before/after (these may change, might be the whole reason you are decompiling again!) +# - line number into a form (may also change, but independent of output) +# - containing form (if all else fails, we can atleast put it _near_ where it should go) +# Update the decompilation +# Attempt to add back all of the comment lines +# - adjust indentation if needed +# +# 1. Get metadata from original file so we can reconstruct it +# 2. Cleanup disasm file (get rid of most comments, etc) +# 3. Add back all comment blocks to modified original file +# 4. hope for the best... + +# Known Issues: +# - use defuns as symbols (consistent names), but account for padding properly +# - padding after decomp deviation blocks / blocks in general is wrong +# - blocks starting inline (ie '(define foo 'bar) #|start of a block comment that continues on...) +# - decomp deviation blocks inside forms can cause paren counting issues +# - +# - codes a mess, as one would probably expect for something as miserable as this, it needs a refactor +# - there are likely ways to make this more efficient + +import argparse +import re +from rapidfuzz import fuzz +from utils import get_gsrc_path_from_filename + +# TODO - rename and refactor all usages, it's not _always_ a comment anymore! +# RetainedCode or something +class CommentMeta: + def __init__(self): + self.data = "" + self.symbol_before = None + self.symbol_inline = None + self.symbol_after = None + self.symbol_padding_before = None + self.symbol_padding_after = None + # NOTE - maybe holding more than just 1 line before/after might help? + self.code_before = None + self.code_after = None + self.code_padding_before = None + self.code_padding_after = None + self.line_num_in_form = None # None == top level + self.containing_form = None # none - top level + self.containing_form_kind = None # function|method|behaviour + self.containing_form_func_name = None # or the method/behaviour + self.containing_form_type = None + self.inline = False + self.code_in_line = None # only for inline comments + self.line_in_file = None # a worst-case scenario fallback + + def __str__(self): + return "{}:{}:{}".format(self.data, self.symbol_before, self.symbol_after) + + +parser = argparse.ArgumentParser("update-from-decomp") +parser.add_argument("--game", help="The name of the game", type=str) +parser.add_argument("--file", help="The name of the file", type=str) +parser.add_argument( + "--debug", help="Output debug metadata on every block", action="store_true" +) +parser.add_argument( + "--clearDebug", help="Clear debug metadata", action="store_true" +) # TODO - implement! +args = parser.parse_args() + +gsrc_path = get_gsrc_path_from_filename(args.game, args.file) + +comments = [] +debug_lines = [] + + +def debug_nice_formatted_code(val): + if val is None: + return None + return val.strip()[0:20] + + +# returns (symbol | None, padding) +def backtrack_for_symbol(lines, index): + padding = 0 + for i in range(index - 1, 0, -1): + tline = lines[i].strip() + matches = re.search( + r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline + ) + if matches is not None: + return matches.group(1), padding + elif ( + not tline.strip() == "" and not tline.strip().startswith(";") + ) or "decomp begins" in tline.lower(): + # we hit a non empty line (but it wasn't a symbol!) + return None, padding + elif tline.strip() == "": + padding = padding + 1 + return None, padding + + +def symbol_on_line(line): + tline = line.lstrip() + matches = re.search( + r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline + ) + if matches is not None: + return matches.group(1) + return None + + +def lookahead_for_symbol(lines, index): + padding = 0 + for i in range(index + 1, len(lines), 1): + tline = lines[i].lstrip() + matches = re.search( + r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline + ) + if matches is not None: + return matches.group(1), padding + elif ( + not tline.strip() == "" and not tline.strip().startswith(";") + ) or "decomp begins" in tline.lower(): + # we hit a non empty line (but it wasn't a symbol!) + return None, padding + elif tline.strip() == "": + padding = padding + 1 + return None, padding + + +def backtrack_for_code(lines, index): + padding = 0 + for i in range(index - 1, 0, -1): + line = lines[i] + if line.strip() == "": + padding = padding + 1 + continue + elif "decomp begins" in line.lower(): + return None, padding + elif line.lstrip().startswith(";"): + continue + return line, padding + + +def lookahead_for_code(lines, index): + padding = 0 + for i in range(index + 1, len(lines), 1): + line = lines[i] + if line.strip() == "": + padding = padding + 1 + continue + elif "decomp begins" in line.lower(): + return None, padding + elif line.lstrip().startswith(";"): + continue + return line, padding + + +# returns form, or none +def is_line_start_of_form(line): + if line.rstrip().startswith(";"): + return None + matches = re.search(r"\(\s*([^\s.]*)\s+", line) + if matches is not None: + return line + return None + + +def has_form_ended(stack, line): + # if the stack is empty, return true + line_before_comment = line.partition(";")[0] + for char in line_before_comment: + if char == "(": + stack.append(char) + elif char == ")": + if len(stack) == 0: + # unbalanced parens? + return True + stack.pop() + if len(stack) == 0: + return True + else: + if len(stack) == 0: + return True + return False + + +def append_form_metadata(comment, form_start_line): + func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_start_line) + if func_matches is not None: + comment.containing_form_kind = "function" + comment.containing_form_func_name = func_matches.group(1) + comment.containing_form_type = None + return + behavior_matches = re.search( + r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_start_line + ) + if behavior_matches is not None: + comment.containing_form_kind = "behavior" + comment.containing_form_func_name = behavior_matches.group(1) + comment.containing_form_type = behavior_matches.group(2) + return + method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_start_line) + if method_matches is not None: + comment.containing_form_kind = "method" + comment.containing_form_func_name = method_matches.group(1) + comment.containing_form_type = method_matches.group(2) + return + comment.containing_form_kind = "unknown" + comment.containing_form_func_name = None + comment.containing_form_type = None + + +decomp_ignore_forms = [] +decomp_ignore_errors = False + +with open(gsrc_path) as f: + lines_temp = f.readlines() + lines = [] + # Get rid of debug lines, this is so i can re-run without having to reset the file + for line in lines_temp: + if "[DEBUG]" in line: + continue + # Check for comment annotate overrides / settings, this is the "nicest" place to shove this + if "og:ignore-errors" in line and "true" in line: + decomp_ignore_errors = True + if "og:ignore-form" in line: + decomp_ignore_forms.append(line.partition("ignore-form:")[2].strip()) + lines.append(line) + # track if we are inside a define*/defun/defmethod/deftype/defstate + within_form = None + line_num_in_form = None + form_paren_stack = [] + found_output = False + i = 0 + while i < len(lines): + debug_lines.append(lines[i]) + tline = lines[i].lstrip() + if "decomp begins" in tline.lower(): + found_output = True + i = i + 1 + continue + if not found_output: + i = i + 1 + continue + # actually process code + if within_form is None: + # lets see if we are now in one + within_form = is_line_start_of_form(lines[i]) + if within_form is not None: + line_num_in_form = 0 + if has_form_ended(form_paren_stack, lines[i]): + within_form = None + form_paren_stack = [] + elif within_form is not None: + # check if the form has ended by counting parens + if has_form_ended(form_paren_stack, lines[i]): + within_form = None + form_paren_stack = [] + line_num_in_form = 0 + else: + line_num_in_form = line_num_in_form + 1 + + if tline.startswith(";") or tline.startswith("#|"): + # treat decomp deviation blocks as essentially comments as well, so include them in a block comment if appropriate + # this is done because there is nothing to match them against (if a comment is inside them for example) + # so we have to copy them in full + in_deviation_block = False + if "decomp deviation" in tline.lower() or tline.startswith("#|"): + in_deviation_block = True + current_comment = CommentMeta() + current_comment.line_in_file = i + current_comment.data = lines[i] + ( + current_comment.symbol_before, + current_comment.symbol_padding_before, + ) = backtrack_for_symbol(lines, i) + ( + current_comment.code_before, + current_comment.code_padding_before, + ) = backtrack_for_code(lines, i) + current_comment.containing_form = within_form + if within_form is not None: + append_form_metadata(current_comment, within_form) + current_comment.line_num_in_form = line_num_in_form + current_comment.inline = False + # look ahead to handle block comments + if i + 1 < len(lines): + next_line = lines[i + 1] + if "decomp deviation" in next_line.lower() or next_line.startswith("|#"): + in_deviation_block = False + while i + 1 < len(lines) and ( + in_deviation_block + or next_line.lstrip().startswith(";") + or next_line.lstrip().startswith("|#") + ): + debug_lines.append(lines[i + 1]) + i = i + 1 + current_comment.data = current_comment.data + next_line + if i + 1 < len(lines): + next_line = lines[i + 1] + if "decomp deviation" in next_line.lower() or next_line.startswith( + "|#" + ): + in_deviation_block = False + ( + current_comment.symbol_after, + current_comment.symbol_padding_after, + ) = lookahead_for_symbol(lines, i) + ( + current_comment.code_after, + current_comment.code_padding_after, + ) = lookahead_for_code(lines, i) + comments.append(current_comment) + debug_lines.append( + ";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format( + current_comment.symbol_before, + current_comment.symbol_padding_before, + current_comment.symbol_after, + current_comment.symbol_padding_after, + debug_nice_formatted_code(current_comment.code_before), + current_comment.code_padding_before, + debug_nice_formatted_code(current_comment.code_after), + current_comment.code_padding_after, + ) + ) + debug_lines.append( + ";; [DEBUG]: in_form - {}...:{}\n".format( + debug_nice_formatted_code(current_comment.containing_form), + current_comment.line_num_in_form, + ) + ) + # inline comments + # TODO - cleanup duplication + elif ";" in tline: + current_comment = CommentMeta() + current_comment.line_in_file = i + current_comment.data = ";" + tline.partition(";")[2] + ( + current_comment.symbol_before, + current_comment.symbol_padding_before, + ) = backtrack_for_symbol(lines, i) + ( + current_comment.symbol_after, + current_comment.symbol_padding_after, + ) = lookahead_for_symbol(lines, i) + ( + current_comment.code_before, + current_comment.code_padding_before, + ) = backtrack_for_code(lines, i) + ( + current_comment.code_after, + current_comment.code_padding_after, + ) = lookahead_for_code(lines, i) + current_comment.containing_form = within_form + if within_form is not None: + append_form_metadata(current_comment, within_form) + current_comment.line_num_in_form = line_num_in_form + current_comment.symbol_inline = symbol_on_line(tline) + current_comment.inline = True + current_comment.code_in_line = tline.partition(";")[0] + comments.append(current_comment) + debug_lines.append( + ";; [DEBUG]: sym - {}:{} | {}:{} || code - {}...:{} | {}...:{}\n".format( + current_comment.symbol_before, + current_comment.symbol_padding_before, + current_comment.symbol_after, + current_comment.symbol_padding_after, + debug_nice_formatted_code(current_comment.code_before), + current_comment.code_padding_before, + debug_nice_formatted_code(current_comment.code_after), + current_comment.code_padding_after, + ) + ) + debug_lines.append( + ";; [DEBUG]: in_form - {}...:{} || inline_code - {}...\n".format( + debug_nice_formatted_code(current_comment.containing_form), + current_comment.line_num_in_form, + debug_nice_formatted_code(current_comment.code_in_line), + ) + ) + i = i + 1 + + +if args.debug: + with open(gsrc_path, "w") as f: + f.writelines(debug_lines) + exit(0) + +# Step 2: Cleanup the decomp output + +lines_to_ignore = [ + ";;-*-Lisp-*-", + "(in-package goal)", + ";; definition", + ";; INFO:", + ";; failed to figure", + ";; Used lq/sq", + ";; this part is debug only", +] + +if decomp_ignore_errors: + lines_to_ignore.append(";; ERROR:") + lines_to_ignore.append(";; WARN:") + +decomp_lines = [] +# cache all form definition lines from the incoming decompilation +# this way, we can "quickly" figure out which form is the most relevant +decomp_form_def_lines = [] + + +def should_ignore_line(line): + for ignore_line in lines_to_ignore: + if line.lower().startswith(ignore_line.lower()): + return True + return False + + +# TODO - check for existance probably +decomp_file_path = "./decompiler_out/{}/{}_disasm.gc".format(args.game, args.file) +with open(decomp_file_path) as f: + lines = f.readlines() + i = 0 + decomp_form_paren_stack = [] + decomp_within_form = None + while i < len(lines): + line = lines[i] + if should_ignore_line(line): + i = i + 1 + continue + decomp_within_form = is_line_start_of_form(line) + # Check if we should ignore the form + if decomp_within_form is not None: + # See if we should skip it + skip_form = False + for form_to_ignore in decomp_ignore_forms: + if form_to_ignore in decomp_within_form: + skip_form = True + break + if has_form_ended(decomp_form_paren_stack, line): + decomp_within_form = None + decomp_form_paren_stack = [] + if not skip_form: + decomp_lines.append(line) + i = i + 1 + else: + if not skip_form: + decomp_form_def_lines.append(decomp_within_form) + decomp_lines.append(line) + while i < len(lines): + i = i + 1 + line = lines[i] + if not skip_form: + decomp_lines.append(line) + if has_form_ended(decomp_form_paren_stack, line): + decomp_within_form = None + decomp_form_paren_stack = [] + i = i + 1 + break + else: + decomp_lines.append(line) + i = i + 1 + + +# Step 3: Start merging the new code + comments +final_lines = [] +decomp_started = False + + +def get_symbol_at_line(line): + tline = line.strip() + matches = re.search( + r"(?:define|define-extern|defun|defstate|deftype)\s+([^\s]*)\s", tline + ) + if matches is not None: + return matches.group(1) + return None + + +def relevant_symbol_comments_for_line_before(line): + symbol = get_symbol_at_line(line) + if symbol is None: + return [] + # Loop through comments, finding any that match the symbol + # they WILL be placed, so we can remove them from our list now + i = 0 + relevant_comments = [] + while i < len(comments): + comment = comments[i] + if comment.symbol_after == symbol: + relevant_comments.append(comment) + comments.pop(i) + else: + i = i + 1 + return relevant_comments + + +def padding_before_comment(comment): + if comment.containing_form is None: + if comment.symbol_after is not None: + return "\n" * comment.symbol_padding_after + return "" + + +def relevant_symbol_comments_for_inline(line): + symbol = get_symbol_at_line(line) + if symbol is None: + return [] + # Loop through comments, finding any that match the symbol + # they WILL be placed, so we can remove them from our list now + i = 0 + relevant_comments = [] + while i < len(comments): + comment = comments[i] + if comment.symbol_inline == symbol: + relevant_comments.append(comment) + comments.pop(i) + else: + i = i + 1 + return relevant_comments + + +def padding_after_comment(comment): + if comment.containing_form is None: + if comment.symbol_before is not None: + return "\n" * comment.symbol_padding_before + return "" + + +def relevant_symbol_comments_for_line_after(line): + symbol = get_symbol_at_line(line) + if symbol is None: + return [] + # Loop through comments, finding any that match the symbol + # they WILL be placed, so we can remove them from our list now + i = 0 + relevant_comments = [] + while i < len(comments): + comment = comments[i] + # if we can, we prefer to put comments before not after (more accurate re-creation) + if comment.symbol_after is None and comment.symbol_before == symbol: + relevant_comments.append(comment) + comments.pop(i) + else: + i = i + 1 + return relevant_comments + + +# the first half of the defmethod/etc lines (before arg list) is less likely to change +# so we want to split it to weight it more heavily +def split_def_line(line): + first_part = "" + second_part = "" + for index, char in enumerate(line): + if char == "(": + if index == 0: + first_part = first_part + char + else: + second_part = second_part + char + continue + else: + if second_part != "": + second_part = second_part + char + else: + first_part = first_part + char + return first_part, second_part + + +def get_form_metadata(form_def_line): + func_matches = re.search(r"\(defun(?:-debug)? ([^\s]*)", form_def_line) + if func_matches is not None: + return "function", func_matches.group(1), None + behavior_matches = re.search(r"\((?:defbehavior) ([^\s]*) ([^\s]*)", form_def_line) + if behavior_matches is not None: + return "behavior", behavior_matches.group(1), behavior_matches.group(2) + method_matches = re.search(r"\((?:defmethod) ([^\s]*) ([^\s]*)", form_def_line) + if method_matches is not None: + return "method", method_matches.group(1), method_matches.group(2) + return "unknown", None, None + + +built_in_method_names = [ + "new", + "delete", + "print", + "inspect", + "length", + "asize-of", + "copy", + "relocate", + "memusage", +] + + +def different_method_names(form_func_name, comment_form_func_name): + if ( + comment_form_func_name not in built_in_method_names + and form_func_name not in built_in_method_names + ): + return False + return form_func_name != comment_form_func_name + + +def get_relevant_form_comments(form_def_line): + form_kind, form_func_name, form_type = get_form_metadata(form_def_line) + code_def_part, code_rest = split_def_line(form_def_line) + relevant_comments = [] + i = 0 + while i < len(comments): + comment = comments[i] + if comment.containing_form is None: + i = i + 1 + continue + ( + comment_form_kind, + comment_form_func_name, + comment_form_type, + ) = get_form_metadata(comment.containing_form) + # First disqualify the form if it's obviously unrelated + if comment_form_kind != "unknown": + if form_kind != comment_form_kind: + i = i + 1 + continue + elif form_kind == "function" and comment_form_func_name != form_func_name: + i = i + 1 + continue + elif form_kind == "behavior" and comment_form_func_name != form_func_name: + i = i + 1 + continue + elif form_kind == "method" and ( + comment_form_type != form_type + or different_method_names(form_func_name, comment_form_func_name) + ): + i = i + 1 + continue + # Evaluate it's score (comments and current def line) + def_part, rest = split_def_line(comment.containing_form) + def_score = fuzz.ratio(code_def_part, def_part) * 0.65 + if def_score == 65.0 and form_kind != "unknown": + relevant_comments.append(comment) + comments.pop(i) + continue + rest_score = fuzz.ratio(code_rest, rest) * 0.35 + combined_score = def_score + rest_score + threshold = 50.0 + if combined_score < threshold: + i = i + 1 + continue + # Now, let's look at ALL other def lines yet to come from the decomp output + # if any are a better match, don't add the comment yet -- we'll add it when we get there! + # TODO - remove lines from the list as we find them so speed this up + found_better_form = False + for decomp_def_line in decomp_form_def_lines: + line_form_kind, line_form_func_name, line_form_type = get_form_metadata( + decomp_def_line + ) + if form_kind != "unknown": + if form_kind != line_form_kind: + continue + elif form_kind == "function" and line_form_func_name != form_func_name: + continue + elif form_kind == "behavior" and line_form_func_name != form_func_name: + continue + elif form_kind == "method" and ( + line_form_type != form_type + or different_method_names(form_func_name, line_form_func_name) + ): + continue + def_part, rest = split_def_line(decomp_def_line) + def_score = fuzz.ratio(code_def_part, def_part) * 0.65 + if def_score == 65.0 and form_kind != "unknown": + found_better_form = True + break + rest_score = fuzz.ratio(code_rest, rest) * 0.35 + if combined_score < def_score + rest_score: + found_better_form = True + break + # TODO otherwise? still test? + if found_better_form: + i = i + 1 + continue + relevant_comments.append(comment) + comments.pop(i) + return relevant_comments + + +# Simple fuzz ratio, but removes obvious outliers like empty lines / lines with only a paren +def score_alg(line1, line2): + tline1 = line1.strip() + tline2 = line2.strip() + if tline1 == "" or tline1 == ")" or tline1 == "(": + return -1 + if tline2 == "" or tline2 == ")" or tline2 == "(": + return -1 + return fuzz.ratio(tline1, tline2) + + +# TODO - improvement on comparison - a higher score on a longer line == better? some sort of weighting approach here too? + +with open(gsrc_path) as f: + lines = f.readlines() + within_form = None + line_num_in_form = None + form_paren_stack = [] + for line in lines: + if "[DEBUG]" in line: + continue + if line.lower().lstrip().startswith(";; decomp begins"): + decomp_started = True + final_lines.append(line) + break + if not decomp_started: + final_lines.append(line) + continue + + i = 0 + while i < len(decomp_lines): + line = decomp_lines[i] + # Otherwise, its a part of the output we have to be more careful about + # For every line in the decompiled output, we scan our comment list to see if anything matches + # if it does, we insert it appropriately and remove the comment from the list + # + # This is the main source of inefficiency, but the process gets progressively faster as comments are eliminated + if within_form is None: + # lets see if we are now in one + within_form = is_line_start_of_form(line) + # TODO - check line for symbol matches? + if within_form is not None: + line_num_in_form = 0 + if has_form_ended(form_paren_stack, line): + within_form = None + form_paren_stack = [] + else: + # Get all of the lines of the form at once + form_start = decomp_lines[i] + form_lines = [form_start] + while i < len(decomp_lines): + i = i + 1 + line = decomp_lines[i] + if has_form_ended(form_paren_stack, line): + within_form = None + form_paren_stack = [] + break + else: + form_lines.append(line) + # Add any comments needed to the form contents + # - first we get all comments that have match well with the form's start line (ie. defmethod ....) + form_comments = get_relevant_form_comments(form_start) + # - for each comment, let's find which line matches it the best, + # if NONE exceed the threshold (if both match the same, pick the first), we default to the line offset + for comment in form_comments: + highest_score = -1 + index_to_insert = -1 + threshold = 50.0 + place_kind = None + for index, form_line in enumerate(form_lines): + # skip any comments that were previously added + if form_line.lstrip().startswith(";"): + continue + if comment.code_in_line is not None: + score = score_alg(form_line, comment.code_in_line) + if score >= threshold and score > highest_score: + index_to_insert = index + highest_score = score + place_kind = "inline" + if comment.code_before is not None: + score = score_alg(form_line, comment.code_before) + if score >= threshold and score > highest_score: + index_to_insert = index + highest_score = score + place_comment_after = True + place_kind = "next_line" + if comment.code_after is not None: + score = score_alg(form_line, comment.code_after) + if score >= threshold and score > highest_score: + index_to_insert = index + highest_score = score + place_comment_after = False + place_kind = "before_line" + # add the comment! + if index_to_insert == -1: + if comment.inline: + form_lines[comment.line_num_in_form] = ( + form_lines[index_to_insert].rstrip() + + " " + + comment.data + ) + else: + form_lines.insert( + comment.line_num_in_form, comment.data + ) + elif comment.inline: + form_index = index_to_insert + if place_kind == "next_line": + form_index = index_to_insert + 1 + form_lines[form_index] = ( + form_lines[form_index].rstrip() + " " + comment.data + ) + elif place_kind == "next_line": + form_lines.insert( + index_to_insert + 1, + padding_before_comment(comment) + comment.data, + ) + else: + form_lines.insert( + index_to_insert, + padding_after_comment(comment) + comment.data, + ) + # Add the lines to the final output + for form_line in form_lines: + final_lines.append(form_line) + + # Otherwise, we are at the top-level! + if within_form is None: + before_comments = relevant_symbol_comments_for_line_before(line) + for comment in before_comments: + final_lines.append(padding_before_comment(comment) + comment.data) + inline_comments = relevant_symbol_comments_for_inline(line) + if len(inline_comments) > 0: + comment_str = "" + for comment in inline_comments: + comment_str = comment_str + comment.data.strip() + comment_str = comment_str.replace(";", "") + final_lines.append( + "{} ;; {}".format(line.rstrip(), comment_str.strip()) + ) + else: + final_lines.append(line) + after_comments = relevant_symbol_comments_for_line_after(line) + for comment in after_comments: + final_lines.append(padding_after_comment(comment) + comment.data) + # next line + i = i + 1 + +# Step 3.b: Handle any remaining top level comments +# If we can't find a code line that meets a threshold, default to their line number +# - Why is this done after: if a comment is associated with nothing but code, we have no +# guarantee where it should go, so we have to wait until all code is populated +# This is SUPER inefficient, so hopefully we've processed nearly all comments by this point +for comment in comments: + within_form = None + line_num_in_form = None + form_paren_stack = [] + found_output = True + i = 0 + index_to_insert = -1 + highest_score = -1 + place_comment_after = True + threshold = 50.0 + while i < len(final_lines): + debug_lines.append(final_lines[i]) + tline = final_lines[i].lstrip() + if "decomp begins" in tline.lower(): + found_output = True + i = i + 1 + continue + if not found_output: + i = i + 1 + continue + line = final_lines[i] + # We can try to claw back a bit of efficiency by skipping the inside of forms + if within_form is not None: + # check if the form has ended by counting parens + if has_form_ended(form_paren_stack, line): + if comment.code_in_line is not None: + score = score_alg(line, comment.code_in_line) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + if comment.code_before is not None: + score = score_alg(line, comment.code_before) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = True + if comment.code_after is not None: + score = score_alg(line, comment.code_after) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = False + within_form = None + form_paren_stack = [] + line_num_in_form = 0 + else: + line_num_in_form = line_num_in_form + 1 + else: + # lets see if we are now in a form + within_form = is_line_start_of_form(line) + if within_form is not None: + if comment.code_in_line is not None: + score = score_alg(line, comment.code_in_line) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + if comment.code_before is not None: + score = score_alg(line, comment.code_before) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = True + if comment.code_after is not None: + score = score_alg(line, comment.code_after) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = False + line_num_in_form = 0 + else: + # just normal code, check it + if comment.code_in_line is not None: + score = score_alg(line, comment.code_in_line) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + if comment.code_before is not None: + score = score_alg(line, comment.code_before) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = True + if comment.code_after is not None: + score = score_alg(line, comment.code_after) + if score >= threshold and score > highest_score: + index_to_insert = i + highest_score = score + place_comment_after = False + i = i + 1 + # end of while loop + # add the comment! + if index_to_insert == -1: + if comment.inline: + final_lines[comment.line_in_file] = ( + final_lines[comment.line_in_file].rstrip() + " " + comment.data + ) + else: + final_lines.insert(comment.line_in_file, comment.data) + elif comment.inline: + final_lines[index_to_insert] = ( + final_lines[index_to_insert].rstrip() + " " + comment.data + ) + elif place_comment_after: + final_lines.insert( + index_to_insert + 1, + padding_before_comment(comment) + comment.data, + ) + else: + final_lines.insert( + index_to_insert, + padding_after_comment(comment) + comment.data, + ) + +# Step 4: Write it out +with open(gsrc_path, "w") as f: + f.writelines(final_lines) diff --git a/scripts/gsrc/utils.py b/scripts/gsrc/utils.py new file mode 100644 index 0000000000..331aa51dae --- /dev/null +++ b/scripts/gsrc/utils.py @@ -0,0 +1,31 @@ +import json +import os + +jak1_files = None +jak2_files = None + +with open('./goal_src/jak1/build/all_objs.json', 'r') as f: + jak1_files = json.load(f) +with open('./goal_src/jak2/build/all_objs.json', 'r') as f: + jak2_files = json.load(f) + +def get_file_list(game_name): + if game_name == "jak1": + return jak1_files + else: + return jak2_files + +def get_gsrc_path_from_filename(game_name, file_name): + file_list = get_file_list(game_name) + src_path = "" + for f in file_list: + if f[2] != 3: + continue + if f[0] == file_name: + src_path = f[4] + break + path = "./goal_src/{}/{}/{}.gc".format(game_name, src_path, file_name) + if not os.path.exists(path): + print("{} couldn't find in /goal_src/{}!".format(file_name, game_name)) + exit(1) + return path diff --git a/scripts/jak1-symbol-mapping.json b/scripts/jak1-symbol-mapping.json deleted file mode 100644 index a1f89bf0d0..0000000000 --- a/scripts/jak1-symbol-mapping.json +++ /dev/null @@ -1,7144 +0,0 @@ -{ - "actor-link-h": [ - "entity-actor-count", - "entity-actor-lookup", - "entity-by-name", - "entity-by-aid", - "actor-link-subtask-complete-hook", - "actor-link-dead-hook", - "alt-actor-list-subtask-incomplete-count", - "actor-link-info" - ], - "air": ["point-in-air?", "points-in-air?", "add-debug-air-box"], - "air-h": ["point-in-air-box-area?", "point-in-air-box?", "air-box"], - "aligner-h": ["align-control"], - "ambient": [ - "ambient-type-error", - "ambient-type-sound", - "ambient-type-sound-loop", - "ambient-type-poi", - "ambient-type-hint", - "ambient-type-light", - "ambient-type-dark", - "ambient-type-weather-off", - "ambient-type-ocean-off", - "ambient-type-ocean-near-off", - "ambient-type-music", - "level-hint-task-process", - "bottom-hud-hidden?", - "level-hint-init-by-other", - "level-hint-exit", - "level-hint-error", - "voicebox-spawn", - "hide-bottom-hud", - "level-hint-ambient-sound", - "level-hint-sidekick", - "level-hint-normal", - "ambient-hint-init-by-other", - "level-hint-process-cmd", - "task-known?", - "can-grab-display?", - "level-hint-displayed?", - "*execute-ambients*", - "ambient-inspect" - ], - "anim-tester": [ - "*anim-tester*", - "anim-test-sequence", - "anim-test-edit-sequence-list-handler", - "*ANIM_TESTER-bank*", - "anim-test-seq-mark-as-edited", - "anim-test-seq-item", - "anim-tester-start", - "anim-tester-add-newobj", - "anim-tester-stop", - "anim-tester", - "initialize-anim-tester", - "anim-tester-save-object-seqs", - "anim-tester-num-print", - "anim-test-obj-list-handler", - "anim-tester-standard-event-handler", - "anim-tester-reset", - "anim-tester-process", - "anim-tester-get-playing-item", - "anim-tester-update-anim-info", - "anim-tester-interface", - "display-list-control", - "anim-test-anim-list-handler", - "anim-test-sequence-list-handler", - "anim-test-field-highlight-lw", - "*DISP_LIST-bank*", - "anim-tester-disp-frame-num", - "anim-test-seq-item-copy!", - "anim-tester-adjust-frame", - "anim-test-edit-seq-insert-item", - "anim-tester-pick-item-setup", - "*debug-menu-context*", - "anim-tester-save-all-objects", - "anim-tester-real-post", - "anim-test-obj-item-valid?", - "list-control", - "list-field", - "DISP_LIST-bank", - "anim-tester-bank", - "anim-test-obj", - "anim-test-obj-init", - "anim-test-sequence-init", - "anim-test-obj-remove-invalid", - "anim-tester-post", - "anim-tester-string-get-frame!!", - "anim-tester-load-object-seqs", - "anim-tester-add-object", - "anim-tester-set-name", - "anim-tester-add-sequence" - ], - "aphid": [ - "*aphid-sg*", - "*aphid-nav-enemy-info*", - "aphid-invulnerable", - "aphid-vulnerable", - "aphid-init-by-other", - "aphid" - ], - "art-h": [ - "new-dynamic-structure", - "joint-anim", - "joint-anim-matrix", - "joint-anim-transformq", - "joint-anim-drawable", - "joint-anim-compressed", - "joint-anim-frame", - "joint-anim-compressed-hdr", - "joint-anim-compressed-fixed", - "joint-anim-compressed-frame", - "joint-anim-compressed-control", - "art", - "art-element", - "art-mesh-anim", - "art-joint-anim", - "art-group", - "art-mesh-geo", - "art-joint-geo", - "skeleton-group", - "lod-group", - "lod-set", - "draw-control" - ], - "assert": [ - "*run-time-assert-enable*", - "__assert", - "__assert-min-max-range-float", - "__assert-min-max-range-int", - "__assert-zero-lim-range-int" - ], - "assert-h": ["*__private-assert-info*", "__assert-info-private-struct"], - "assistant": ["*assistant-sg*", "check-drop-level-assistant", "assistant"], - "assistant-citadel": [ - "*assistant-lavatube-end-sg*", - "assistant-lavatube-end" - ], - "assistant-firecanyon": ["*assistant-firecanyon-sg*", "assistant-firecanyon"], - "assistant-lavatube": [ - "*assistant-lavatube-start-sg*", - "assistant-lavatube-start" - ], - "assistant-village2": [ - "*assistant-village2-sg*", - "just-particles", - "assistant-levitator-blue-glow", - "assistant-levitator-blue-beam", - "*jaws-sg*", - "check-drop-level-assistant-bluehut", - "assistant-levitator" - ], - "assistant-village3": ["*assistant-village3-sg*", "assistant-villagec"], - "babak": ["*babak-sg*", "*babak-nav-enemy-info*", "babak"], - "babak-with-cannon": [ - "beachcam-spawn", - "mistycam-spawn", - "babak-with-cannon-jump-off-cannon", - "babak-with-cannon-compute-ride-point", - "babak-with-cannon-compute-cannon-dir", - "babak-with-cannon-shooting", - "babak-with-cannon-jump-onto-cannon", - "babak-run-to-cannon", - "handle->process-safe", - "babak-with-cannon-ride-cannon-post", - "babak-with-cannon" - ], - "baby-spider": [ - "baby-spider-hatching", - "baby-spider-resume", - "*baby-spider-sg*", - "*baby-spider-nav-enemy-info-for-cave-trap*", - "*baby-spider-nav-enemy-info*", - "baby-spider-die-fast", - "baby-spider-default-event-handler", - "baby-spider-init-by-other", - "baby-spider-spawn-params", - "baby-spider" - ], - "background": [ - "background-upload-vu0", - "*instance-shrub-work*", - "*background-work*", - "time-of-day-interp-colors", - "draw-drawable-tree-instance-shrub", - "upload-vis-bits", - "time-of-day-interp-colors-scratch", - "draw-drawable-tree-tfrag", - "draw-drawable-tree-trans-tfrag", - "draw-drawable-tree-dirt-tfrag", - "draw-drawable-tree-ice-tfrag", - "*instance-tie-work*", - "tie-near-make-perspective-matrix", - "draw-drawable-tree-instance-tie", - "background-vu0-block", - "init-background", - "finish-background" - ], - "background-h": ["background-work"], - "balloonlurker": [ - "balloonlurker-pilot-init-by-other", - "balloonlurker-patrol", - "*balloonlurker-sg*", - "balloonlurker-find-nearest-path-point", - "balloonlurker-snap-to-path-point", - "*balloonlurker-constants*", - "balloonlurker-pilot-idle", - "*balloonlurker-pilot-sg*", - "balloonlurker-pilot-die", - "*BALLOONLURKER-bank*", - "balloonlurker-die", - "balloonlurker-get-next-path-point", - "*balloonlurker-rudder-joint-home*", - "balloonlurker-play-sounds", - "balloonlurker-player-impulse", - "balloonlurker-mine-explode", - "balloonlurker-get-path-point", - "balloonlurker-event-handler", - "balloonlurker-post", - "balloonlurker-bank", - "balloonlurker", - "balloonlurker-pilot" - ], - "basebutton": [ - "*warp-jump-mods*", - "target-warp-out", - "*warp-info*", - "*generic-button-sg*", - "basebutton-init-by-other", - "basebutton", - "warp-gate" - ], - "baseplat": [ - "plat-code", - "plat-trans", - "plat-post", - "plat-event", - "eco-door-event-handler", - "baseplat", - "eco-door" - ], - "battlecontroller": [ - "battlecontroller-task-completed?", - "battlecontroller-off", - "battlecontroller-camera-on", - "battlecontroller-spawn-creature-random-spawner", - "battlecontroller-disable-ocean", - "battlecontroller-update-spawners", - "battlecontroller-fill-all-spawners", - "battlecontroller-battle-begin", - "battlecontroller-spawn-creature-at-spawner", - "battlecontroller-spawn-creature", - "battlecontroller-spawners-full?", - "battlecontroller-default-event-handler", - "battlecontroller-draw-debug", - "battlecontroller-camera-off", - "battlecontroller-battle-end", - "battlecontroller-special-contents?", - "battlecontroller-special-contents-collected?", - "battlecontroller-set-special-contents-collected", - "battlecontroller-set-task-completed", - "battlecontroller-spawner", - "battlecontroller-creature-type", - "battlecontroller" - ], - "beach-obs": [ - "*beachcam-sg*", - "*harvester-sg*", - "harvester-idle", - "harvester-inflate", - "*flutflutegg-sg*", - "flutflutegg-break", - "flutflutegg-idle", - "flutflutegg-physics-fall", - "flutflutegg-hit-sounds", - "flutflutegg-physics", - "*bladeassm-sg*", - "bladeassm-prebind-function", - "bladeassm-idle", - "flying-rock-init-by-other", - "*kickrock-sg*", - "flying-rock-rolling", - "flying-rock-idle", - "*ecoventrock-sg*", - "ecoventrock-break", - "ecoventrock-idle", - "spawn-flying-rock", - "*grottopole-sg*", - "move-grottopole-to-position", - "grottopole-idle", - "move-grottopole", - "grottopole-moving-up", - "grottopole-moving-down", - "*windmill-one-sg*", - "windmill-one-idle", - "*flutflut-naked-sg*", - "windmill-one", - "grottopole", - "ecoventrock", - "flying-rock", - "bladeassm", - "flutflutegg", - "harvester", - "beachcam" - ], - "beach-part": ["sound-beach-waterfall", "beach-part"], - "beach-rocks": ["*lrocklrg-sg*", "beach-rock", "lrocklrg"], - "billy": [ - "*billy-sg*", - "*billy-sidekick-sg*", - "billy-kill-all-but-farthy", - "billy-playing", - "billy-game-update", - "billy-done", - "billy-snack-init-by-other", - "rat-about-to-eat?", - "billy-game-update-wave", - "billy-rat-init-by-other", - "*farthy-snack-sg*", - "billy-rat-salivate", - "billy-rat-eat", - "billy-snack-idle", - "billy-snack-eat", - "billy", - "billy-snack", - "billy-rat" - ], - "bird-lady": ["*bird-lady-sg*", "bird-lady"], - "bird-lady-beach": ["*bird-lady-beach-sg*", "bird-lady-beach"], - "blocking-plane": [ - "blocking-plane-init-by-other", - "*ef-plane-sg*", - "blocking-plane-idle", - "blocking-plane" - ], - "bonelurker": [ - "*bonelurker-sg*", - "*bonelurker-nav-enemy-info*", - "bonelurker-set-small-bounds-sphere", - "bonelurker-set-large-bounds-sphere", - "bonelurker-stun", - "bonelurker-stunned-event-handler", - "bonelurker-push-post", - "bonelurker" - ], - "bones": [ - "*merc-bucket-info*", - "paused?", - "*bone-calculation-list*", - "bones-vu0-block", - "*texscroll-globals*", - "dump-mem", - "bone-list-init", - "texscroll-make-request", - "texscroll-execute", - "*use-generic*", - "bones-set-sqwc", - "bones-reset-sqwc", - "*merc-global-array*", - "bones-init", - "draw-bones-mtx-calc", - "bones-mtx-calc", - "bones-mtx-calc-execute", - "bones-wrapup", - "*bones-first*", - "dump-qword", - "bones-debug", - "dump-bone-mem", - "*default-shadow-settings*", - "draw-bones-shadow", - "draw-bones-generic-merc", - "draw-bones-merc", - "draw-bones-check-longest-edge", - "draw-bones-check-longest-edge-asm", - "draw-bones", - "draw-bones-hud", - "bone-calculation", - "bone-calculation-list", - "texscroll-globals", - "merc-effect-bucket-info", - "merc-bucket-info" - ], - "bones-h": [ - "invalidate-cache-line", - "*merc-globals*", - "bone-buffer", - "bone-layout", - "bone-regs", - "bone-work", - "bone-debug", - "bone-memory", - "merc-globals", - "merc-global-array", - "shadow-dma-packet" - ], - "bouncer": [ - "*bouncer-sg*", - "bouncer-wait", - "bouncer-fire", - "bouncer-smush", - "springbox" - ], - "bounding-box": ["box-vector-enside?", "box-vector-inside?"], - "bounding-box-h": ["bounding-box", "bounding-box4w", "bounding-box-both"], - "bsp": [ - "print-cl-stat", - "clear-cl-stat", - "mem-usage-bsp-tree", - "*test-shrub*", - "bsp-camera-asm", - "print-collide-stats" - ], - "bsp-h": [ - "map-bsp-tree", - "inspect-bsp-tree", - "bsp-node", - "bsp-header", - "game-level", - "view-frustum", - "cl-stat", - "collide-stats" - ], - "bully": [ - "*bully-sg*", - "*bully-shadow-control*", - "bully-idle", - "bully-broken-cage-init-by-other", - "bully-start-spinning", - "bully-stop-spinning", - "bully-notice", - "bully-die", - "*bully-broken-cage-sg*", - "bully-broken-cage-explode", - "bully-default-event-handler", - "bully-post", - "bully-broken-cage", - "bully" - ], - "cam-combiner": ["cam-combiner-active", "cam-combiner-init"], - "cam-debug": [ - "*camera-old-level*", - "*camera-old-cpu*", - "*camera-old-vu*", - "*camera-old-tfrag-bytes*", - "*camera-old-stat-string-tfrag-near*", - "*camera-old-stat-string-tfrag*", - "*camera-old-stat-string-total*", - "cam-collision-record-draw", - "master-draw-coordinates", - "cam-debug-draw-tris", - "cam-collision-record-step", - "*cam-collision-record-show*", - "*cam-collision-record*", - "*cam-collision-record-last*", - "*cam-collision-record-first*", - "camera-sphere", - "camera-line-rel", - "camera-fov-draw", - "*cam-debug-los-tri*", - "*cam-debug-los-tri-current*", - "*cam-debug-coll-tri*", - "*cam-debug-coll-tri-current*", - "cam-line-dma", - "camera-line2d", - "camera-plot-float-func", - "cam-debug-add-coll-tri", - "debug-euler", - "bike-cam-limit", - "external-cam-reset!", - "cam-dbg-scratch", - "cam-debug-tri", - "cam-collision-record", - "cam-collision-record-array" - ], - "cam-debug-h": [ - "*timeplot-index*", - "*timeplot-table*", - "*yellowline-index*", - "*yellowline-table*", - "*greenline-index*", - "*greenline-table*", - "*blueline-index*", - "*blueline-table*", - "*redline-index*", - "*redline-table*", - "float-save-redline", - "float-lookup-redline", - "float-save-blueline", - "float-lookup-blueline", - "float-save-greenline", - "float-lookup-greenline", - "float-save-yellowline", - "float-lookup-yellowline", - "float-save-timeplot", - "float-lookup-timeplot", - "*cam-layout*" - ], - "cam-interface": [ - "*camera-dummy-vector*", - "matrix-world->local", - "camera-angle", - "camera-teleport-to-entity" - ], - "cam-interface-h": [ - "*camera-read-analog*", - "*camera-read-buttons*", - "*cam-free-move-along-z*", - "*camera-init-mat*", - "*camera*", - "*camera-combiner*", - "*camera-orbit-target*" - ], - "cam-layout": [ - "cam-layout-stop", - "cam-layout-start", - "cam-layout", - "cam-layout-init", - "*camera-layout-blink*", - "*last-cur-entity*", - "clmf-next-entity", - "*clm-select*", - "*clm*", - "cam-layout-active", - "cam-layout-entity-info", - "cam-layout-entity-volume-info", - "cam-layout-do-menu", - "*camera-layout-message-ypos*", - "*CAM_LAYOUT-bank*", - "cam-layout-print", - "clm-list", - "cam-layout-function-call", - "cam-layout-do-action", - "function", - "clm", - "clmf-cam-flag-toggle-info", - "clmf-save-single", - "cam-layout-save-cam-rot", - "cam-layout-save-cam-trans", - "cam-layout-save-pivot", - "cam-layout-save-align", - "cam-layout-save-interesting", - "cam-layout-save-fov", - "cam-layout-save-focalpull", - "cam-layout-save-flags", - "cam-layout-save-introsplinetime", - "cam-layout-save-introsplineexitval", - "cam-layout-save-interptime", - "cam-layout-save-splineoffset", - "cam-layout-save-spline-follow-dist-offset", - "cam-layout-save-campointsoffset", - "cam-layout-save-tiltAdjust", - "cam-layout-save-stringMinLength", - "cam-layout-save-stringMaxLength", - "cam-layout-save-stringMinHeight", - "cam-layout-save-stringMaxHeight", - "cam-layout-save-stringCliffHeight", - "cam-layout-save-maxAngle", - "cam-layout-save-campoints-flags", - "cam-layout-save-focalpull-flags", - "cam-index-options->string", - "cam-slave-options->string", - "fov->maya", - "*clm-edit*", - "*clm-focalpull-attr*", - "*clm-index-attr*", - "*clm-intro-attr*", - "*clm-spline-attr*", - "*clm-vol-attr*", - "*volume-descriptor-current*", - "*volume-point-current*", - "*volume-normal-current*", - "cam-layout-entity-volume-info-create", - "clmf-next-volume", - "clmf-input", - "camera-fov-frame", - "interp-test-info", - "interp-test", - "v-slrp!", - "interp-test-deg", - "*volume-descriptor*", - "camera-line-setup", - "camera-line-draw", - "*volume-point*", - "*volume-normal*", - "cam-layout-intersect-dist", - "cam-layout-bank", - "clm-basic", - "clm-item-action", - "clm-item", - "clm-list-item", - "volume-descriptor-array", - "clmf-button-test", - "clmf-bna", - "clmf-implement", - "clmf-pos-rot", - "clmf-next-vol-dpad", - "clmf-to-edit-cam", - "clmf-to-vol-attr", - "clmf-to-spline-attr", - "clmf-to-intro-attr", - "clmf-to-index-attr", - "clmf-to-focalpull-attr", - "clmf-to-edit", - "clmf-to-select", - "clmf-look-through", - "clmf-save-one", - "clmf-save-all", - "clmf-cam-flag-toggle", - "clmf-cam-flag", - "clmf-cam-float-adjust", - "clmf-cam-meters", - "clmf-cam-fov", - "clmf-cam-deg", - "clmf-cam-intro-time", - "clmf-cam-interp-time", - "clmf-cam-float", - "clmf-cam-string", - "*clm-cam-attr*", - "*clm-cam-lookthrough*", - "*clm-save-all*", - "*clm-save-one*", - "cam-layout-restart" - ], - "cam-master": [ - "list-keeper-init", - "cam-free-floating", - "cam-master-active", - "list-keeper-active", - "master-track-target", - "master-check-regions", - "camera-master-debug", - "master-unset-region", - "reset-target-tracking", - "reset-drawable-tracking", - "master-switch-to-entity", - "cam-fixed", - "cam-decel", - "reset-drawable-follow", - "reset-follow", - "cam-eye", - "in-cam-entity-volume?", - "master-base-region", - "setup-slave-for-hopefull", - "master-is-hopeful-better?", - "*CAMERA_MASTER-bank*", - "target-cam-pos", - "cam-master-init", - "camera-master-bank", - "list-keeper" - ], - "cam-start": ["cam-stop", "reset-cameras", "cam-start"], - "cam-states": [ - "cam-bike-code", - "*CAM_BIKE-bank*", - "cam-calc-bike-follow!", - "cam-stick-code", - "*CAM_STICK-bank*", - "set-string-parms", - "cam-string-code", - "cam-string", - "cam-string-find-position-rel!", - "cam-string-set-position-rel!", - "cam-debug-reset-coll-tri", - "cam-string-follow", - "cam-string-line-of-sight", - "cam-string-joystick", - "cam-string-find-hidden", - "cam-collision-record-save", - "cam-string-move", - "cam-dist-analog-input", - "cam-los-collide", - "dist-info-init", - "*CAM_STRING-bank*", - "los-cw-ccw", - "cam-debug-add-los-tri", - "cam-los-spline-collide", - "cam-los-setup-lateral", - "slave-los-state->string", - "dist-info-print", - "dist-info-valid?", - "dist-info-append", - "cam-circular-code", - "cam-circular-position", - "cam-circular-position-into-max-angle", - "*CAM_BILLY-bank*", - "*CAM_EYE-bank*", - "cam-standoff", - "cam-standoff-calc-trans", - "cam-pov", - "cam-pov180", - "cam-pov-track", - "cam-eye-bank", - "cam-billy-bank", - "cam-billy", - "cam-endlessfall", - "cam-lookat", - "cam-string-bank", - "string-push-help", - "cam-draw-collide-cache", - "los-dist", - "collide-los-dist-info", - "collide-los-result", - "cam-stick-bank", - "cam-stick", - "cam-bike-bank", - "cam-bike" - ], - "cam-states-dbg": [ - "*camera-orbit-info*", - "*CAM_ORBIT-bank*", - "cam-free-floating-move", - "cam-free-floating-input", - "*CAM_FREE-bank*", - "*CAM_POINT_WATCH-bank*", - "cam-point-watch", - "cam-orbit", - "cam-point-watch-bank", - "cam-free-bank", - "camera-free-floating-move-info", - "camera-orbit-info", - "CAM_ORBIT-bank" - ], - "cam-update": [ - "*start-timer*", - "*timer-value*", - "*start-pos*", - "move-camera-from-pad", - "*save-camera-inv-rot*", - "update-view-planes", - "update-visible", - "*update-leaf-when-outside-bsp*", - "set-point", - "plane-from-points", - "update-camera" - ], - "cam-update-h": [ - "*external-cam-options*", - "*external-cam-mode*", - "*camera-look-through-other*", - "*camera-other-fov*", - "*camera-other-trans*", - "*camera-other-matrix*", - "*camera-smush-control*", - "*camera-other-root*" - ], - "camera": [ - "vector-into-frustum-nosmooth!", - "slave-matrix-blend-2", - "mat-remove-z-rot", - "parameter-ease-sin-clamp", - "cam-slave-get-intro-step", - "cam-slave-get-float", - "cam-slave-init-vars", - "cam-calc-follow!", - "slave-set-rotation!", - "camera-slave-debug", - "camera-line-rel-len", - "*cam-res-string*", - "cam-slave-get-flags", - "cam-circular", - "cam-standoff-read-entity", - "cam-spline", - "*camera-base-mode*", - "cam-fixed-read-entity", - "cam-slave-get-vector-with-offset", - "cam-slave-get-fov", - "cam-slave-get-interp-time", - "cam-slave-get-rot", - "cam-state-from-entity", - "parameter-ease-none", - "parameter-ease-clamp", - "parameter-ease-lerp-clamp", - "parameter-ease-sqrt-clamp", - "fourth-power", - "third-power", - "parameter-ease-sqr-clamp", - "cam-slave-go", - "cam-slave-init", - "cam-standard-event-handler", - "cam-curve-pos", - "cam-curve-setup", - "v-slrp2!", - "v-slrp3!" - ], - "camera-h": [ - "*CAMERA-bank*", - "camera-bank", - "cam-index", - "tracking-point", - "tracking-spline-sampler", - "tracking-spline", - "cam-float-seeker", - "cam-vector-seeker", - "cam-rotation-tracker", - "camera-combiner", - "camera-slave", - "camera-master" - ], - "capture": [ - "gs-set-default-store-image", - "gs-store-image", - "sync-path", - "file-stream-write", - "file-stream-close", - "store-image", - "gs-store-image-packet" - ], - "cave-trap": [ - "cave-trap-idle", - "cave-trap-give-up", - "cave-trap-active", - "spider-vent-idle", - "cave-trap-default-event-handler", - "cave-trap", - "spider-vent", - "spawn-baby-spider-best", - "spawn-baby-spider-work" - ], - "cavecrystal-light": [ - "*cavecrystal-engine*", - "cavecrystal-light-control-default-callback", - "cavecrystal-light", - "cavecrystal-light-control" - ], - "citadel-obs": [ - "*citadelcam-sg*", - "citadelcam-idle", - "citadelcam-stair-plats", - "citb-generator-broken", - "citb-generator-idle", - "*citb-generator-sg*", - "*citb-generator-broken-sg*", - "citb-generator-trigger-others", - "citb-generator-break", - "*citb-hose-sg*", - "citb-hose-die", - "citb-hose-idle", - "citb-hose-spawn", - "*citb-coil-sg*", - "citb-coil-broken", - "citb-coil-idle", - "citb-coil-break", - "*citb-robotboss-sg*", - "citb-robotboss-die", - "citb-robotboss-idle", - "*citb-robotboss-nose-sg*", - "*citb-robotboss-head-sg*", - "*citb-robotboss-gun-sg*", - "*citb-robotboss-leftshoulder-sg*", - "*citb-robotboss-rightshoulder-sg*", - "*citb-robotboss-leftarm-sg*", - "*citb-robotboss-rightarm-sg*", - "*citb-robotboss-belly-sg*", - "*citb-launcher-sg*", - "*citb-button-sg*", - "*citb-iris-door-sg*", - "*citb-disc-d-sg*", - "*citb-disc-c-sg*", - "*citb-disc-b-sg*", - "*citb-disc-a-sg*", - "citb-disc-idle", - "*citb-arm-shoulder-b-sg*", - "*citb-arm-shoulder-a-sg*", - "*citb-arm-d-sg*", - "*citb-arm-c-sg*", - "*citb-arm-b-sg*", - "*citb-arm-a-sg*", - "citb-hose-event-handler", - "citb-arm-section", - "citb-arm", - "citb-arm-shoulder", - "citb-arm-a", - "citb-arm-b", - "citb-arm-c", - "citb-arm-d", - "citb-arm-shoulder-a", - "citb-arm-shoulder-b", - "citb-disc", - "citb-disc-a", - "citb-disc-b", - "citb-disc-c", - "citb-disc-d", - "citb-iris-door", - "citb-button", - "citb-launcher", - "citb-robotboss", - "citb-coil", - "citb-hose", - "citb-chains", - "citb-generator", - "citadelcam", - "citb-battlecontroller" - ], - "citadel-part": [ - "citb-part", - "check-drop-level-firehose-pops", - "birth-func-random-rot" - ], - "citadel-sages": [ - "*green-sagecage-sg*", - "citb-sage-draw-beam", - "*robotboss-sg*", - "*evilbro-citadel-sg*", - "*evilsis-citadel-sg*", - "*yellowsage-sg*", - "*bluesage-sg*", - "*redsage-sg*", - "citb-sagecage-init-by-other", - "citb-sagecage-idle", - "*citb-sagecage-sg*", - "citb-sagecage-update-collision", - "citb-sagecage-draw-bars", - "citb-sagecage", - "citb-sage", - "red-sagecage", - "blue-sagecage", - "yellow-sagecage", - "green-sagecage" - ], - "citb-bunny": [ - "*citb-bunny-nav-enemy-info*", - "*citb-bunny-sg*", - "citb-bunny" - ], - "citb-drop-plat-CIT": [ - "citb-drop-plat-idle", - "citb-drop-plat-spawn-children", - "citb-drop-plat-drop-children", - "citb-drop-plat-drop-all-children", - "citb-drop-plat-active", - "drop-plat-init-by-other", - "drop-plat-spawn", - "*citb-drop-plat-red-sg*", - "*citb-drop-plat-green-sg*", - "*citb-drop-plat-blue-sg*", - "*citb-drop-plat-yellow-sg*", - "*citb-drop-plat-sg*", - "drop-plat-set-fade", - "drop-plat-die", - "drop-plat-idle", - "drop-plat-drop", - "drop-plat-rise", - "drop-plat", - "handle-inline-array", - "citb-drop-plat" - ], - "citb-plat": [ - "citb-exit-plat-idle", - "*citb-exit-plat-sg*", - "citb-exit-plat-move-player", - "citb-exit-plat-rise", - "*citb-firehose-sg*", - "citb-firehose-idle", - "citb-firehose-blast-particles", - "citb-firehose-active", - "citb-firehose-blast", - "*citb-stopbox-sg*", - "*citb-donut-sg*", - "*citb-rotatebox-sg*", - "*citb-chain-plat-sg*", - "*citb-chain-plat-constants*", - "citb-chain-plat-settle", - "*plat-citb-sg*", - "*plat-eco-citb-lit-sg*", - "*plat-eco-citb-unlit-sg*", - "citb-base-plat", - "citb-plat-eco", - "citb-plat", - "citb-stair-plat", - "citb-chain-plat", - "citb-rotatebox", - "citb-donut", - "citb-stopbox", - "citb-firehose", - "citb-exit-plat" - ], - "collectables": [ - "collectable", - "eco-collectable", - "eco", - "eco-yellow", - "eco-red", - "eco-blue", - "health", - "eco-pill", - "money", - "fuel-cell", - "buzzer", - "ecovalve", - "vent", - "ventyellow", - "ventred", - "ventblue", - "ecovent", - "vent-wait-for-touch", - "vent-pickup", - "vent-standard-event-handler", - "vent-blocked", - "ecovalve-init-by-other", - "*ecovalve-sg*", - "ecovalve-idle", - "*eco-pill-count*", - "birth-pickup-at-point", - "*buzzer-sg*", - "fuel-cell-pick-anim", - "fuel-cell-clone-anim", - "*fuel-cell-tune-pos*", - "*fuel-cell-sg*", - "othercam-init-by-other", - "fuel-cell-animate", - "*money-sg*", - "add-blue-motion", - "check-blue-suck", - "initialize-eco-by-other", - "add-blue-shake", - "money-init-by-other", - "money-init-by-other-no-bob", - "fuel-cell-init-by-other", - "fuel-cell-init-as-clone", - "buzzer-init-by-other" - ], - "collectables-part": [ - "eco-fadeout", - "eco-track-root-prim-fadeout", - "part-tracker-track-root", - "part-tracker-move-to-target", - "part-tracker-track-target", - "sparticle-track-root-money" - ], - "collide": ["*collide-vif0-init*"], - "collide-cache": [ - "make-collide-list-using-line-sphere-inst-test", - "*already-printed-exeeded-max-cache-tris*", - "test-closest-pt-in-triangle", - "collide-puls-work", - "lsmi-work" - ], - "collide-cache-h": [ - "*collide-work*", - "*collide-cache*", - "*collide-list*", - "collide-using-spheres-params", - "collide-puss-sphere", - "collide-puss-work", - "collide-puyp-work", - "collide-cache-tri", - "collide-cache-prim", - "collide-cache", - "collide-list-item", - "collide-list", - "collide-work" - ], - "collide-edge-grab": [ - "*rotate-surface*", - "*no-walk-surface*", - "pbhp-stack-vars" - ], - "collide-edge-grab-h": [ - "*collide-edge-work*", - "*edge-grab-info*", - "edge-grab-info", - "collide-edge-tri", - "collide-edge-edge", - "collide-edge-hold-item", - "collide-edge-hold-list", - "collide-edge-work" - ], - "collide-frag": ["sphere-cull"], - "collide-frag-h": [ - "collide-frag-vertex", - "collide-frag-mesh", - "collide-fragment", - "drawable-inline-array-collide-fragment", - "drawable-tree-collide-fragment" - ], - "collide-func": [ - "ray-sphere-intersect", - "raw-ray-sphere-intersect", - "ray-circle-intersect", - "ray-cylinder-intersect", - "ray-plane-intersect", - "ray-triangle-intersect", - "collide-do-primitives", - "moving-sphere-triangle-intersect", - "moving-sphere-sphere-intersect", - "moving-sphere-moving-sphere-intersect" - ], - "collide-h": ["*collide-test-flag*"], - "collide-mesh": ["sopt-work", "spat-work", "oot-work"], - "collide-mesh-h": [ - "*collide-mesh-cache*", - "collide-tri-result", - "collide-mesh-tri", - "collide-mesh", - "collide-mesh-cache", - "collide-mesh-cache-tri" - ], - "collide-planes": [ - "camera-bounding-box-draw", - "collide-planes-test0", - "collide-planes-test1", - "camera-cross", - "collide-planes-intersect", - "collide-planes" - ], - "collide-probe": [ - "misty-ambush-height", - "distc", - "interpolate", - "collide-upload-vu0", - "collide-probe-instance-tie", - "collide-probe-node", - "collide-vu0-block", - "indent-to", - "probe-traverse-inline-array-node", - "probe-traverse-draw-node", - "creates-new-method?", - "overrides-parent-method?", - "describe-methods", - "probe-traverse-collide-fragment", - "*collide-probe-stack*", - "print-out", - "collide-probe-instance-tie-collide-frags", - "collide-probe-collide-fragment-tree-make-list", - "collide-probe-instance-tie-tree-make-list", - "collide-probe-make-list", - "misty-ambush-height-probe", - "pke-collide-test", - "collide-probe-stack-elem", - "collide-probe-stack" - ], - "collide-reaction-target": [ - "collide-shape-moving-angle-set!", - "target-collision-low-coverage", - "poly-find-nearest-edge", - "target-collision-reaction", - "target-collision-no-reaction" - ], - "collide-shape": [ - "*col-timer-enable*", - "*frame-timer*", - "*col-timer*", - "*race-track-surface*", - "target-attack-up", - "find-ground-point", - "default-collision-reaction", - "simple-collision-reaction", - "collide-shape-draw-debug-marks", - "debug-report-col-stats" - ], - "collide-shape-h": [ - "*collide-hit-by-player-list*", - "*collide-usually-hit-by-player-list*", - "*collide-hit-by-others-list*", - "*collide-player-list*", - "*collide-shape-prim-backgnd*", - "*collide-shape-prim-water*", - "collide-sticky-rider", - "collide-sticky-rider-group", - "pull-rider-info", - "collide-shape-intersect", - "collide-overlap-result", - "overlaps-others-params", - "collide-prim-core", - "collide-shape-prim", - "collide-shape-prim-sphere", - "collide-shape-prim-mesh", - "collide-shape-prim-group", - "collide-shape", - "collide-shape-moving" - ], - "collide-target-h": ["collide-history", "control-info"], - "collide-touch": ["add-prims-touching-work"], - "collide-touch-h": [ - "*touching-prims-entry-pool*", - "*touching-list*", - "touching-prim", - "touching-prims-entry", - "touching-prims-entry-pool", - "touching-shapes-entry", - "touching-list" - ], - "connect": [ - "connection-process-apply", - "connectable", - "connection", - "engine" - ], - "crates": [ - "crate-post", - "*crate-iron-sg*", - "*crate-steel-sg*", - "*crate-darkeco-sg*", - "*crate-barrel-sg*", - "*crate-bucket-sg*", - "*crate-wood-sg*", - "*CRATE-bank*", - "crate-standard-event-handler", - "crate-init-by-other", - "crate-bank", - "crate", - "barrel", - "bucket", - "crate-buzzer", - "pickup-spawner" - ], - "credits": [ - "*title-credits-scale*", - "*title-credits-spacing*", - "set-credits-font-color", - "draw-title-credits", - "draw-end-credits" - ], - "cylinder": [ - "ray-arbitrary-circle-intersect", - "camera-line", - "cylinder-verts", - "cylinder-flat-verts" - ], - "dark-crystal": [ - "*dark-crystal-sg*", - "dark-crystal-spawn-fuel-cell", - "dark-crystal-idle", - "*dark-crystal-explode-sg*", - "*dark-crystal-exploder-params*", - "*dark-crystal-flash-delays*", - "dark-crystal-explode", - "dark-crystal-activate", - "dark-crystal" - ], - "dark-eco-pool": [ - "ripple-for-dark-eco-pool", - "ripple-for-misty-dark-eco-pool", - "ripple-for-maincave-dark-eco-pool", - "ripple-for-sunken-dark-eco-helix-room", - "ripple-for-finalboss-dark-eco-pool", - "dark-eco-pool" - ], - "darkcave-obs": [ - "*cavecrystal-sg*", - "*cavecrystal-light-control*", - "cavecrystal-idle", - "cavecrystal-active", - "cavecrystal" - ], - "darkvine": [ - "*darkvine-sg*", - "darkvine-die", - "darkvine-idle", - "darkvine-retreat", - "darkvine-event-handler", - "darkvine" - ], - "debug": [ - "debug-set-camera-pos-rot!", - "drawable-frag-count", - "add-debug-light", - "add-debug-vector", - "add-debug-text-3d", - "add-debug-x", - "add-debug-curve", - "add-debug-sphere", - "get-debug-text-3d", - "internal-draw-debug-text-3d", - "get-debug-line", - "internal-draw-debug-line", - "*debug-lines*", - "*debug-lines-trk*", - "*debug-text-3ds*", - "*debug-text-3d-trk*", - "draw-string", - "transform-float-point", - "add-debug-point", - "add-debug-outline-triangle", - "add-debug-triangle-normal", - "add-debug-flat-triangle", - "debug-reset-buffers", - "debug-draw-buffers", - "add-debug-line2d", - "add-debug-box", - "add-debug-sphere-with-transform", - "add-debug-spheres", - "add-debug-circle", - "add-debug-rot-matrix", - "add-debug-yrot-vector", - "add-debug-arc", - "add-debug-curve2", - "add-debug-points", - "debug-percent-bar", - "debug-pad-display", - "add-debug-lights", - "history-init", - "history-draw-and-update", - "dma-timeout-cam", - "display-file-info", - "debug-line", - "debug-text-3d", - "debug-tracking-thang" - ], - "debug-h": ["pos-history", "debug-vertex", "debug-vertex-stats"], - "debug-sphere": [ - "*debug-sphere-table*", - "add-debug-line", - "make-debug-sphere-table", - "add-debug-sphere-from-table", - "debug-sphere-table" - ], - "decomp": ["unpack-comp-rle", "unpack-comp-huf", "huf-dictionary-node"], - "decomp-h": ["decomp-work"], - "default-menu": [ - "*popup-menu-context*", - "build-continue-menu", - "debug-menu-make-camera-menu", - "debug-menu-make-shader-menu", - "debug-menu-make-instance-menu", - "debug-menu-make-task-menu", - "dm-current-continue", - "dm-task-get-money", - "dm-levitator-ready", - "dm-lavabike-ready", - "dm-give-all-cells", - "debug-menu-make-task-unknown-menu", - "debug-menu-make-task-need-hint-menu", - "debug-menu-make-task-need-introduction-menu", - "debug-menu-make-task-need-reminder-a-menu", - "debug-menu-make-task-need-reminder-menu", - "debug-menu-make-task-need-reward-speech-menu", - "debug-menu-make-task-need-resolution-menu", - "dm-give-cell", - "*instance-shrub-menu*", - "*instance-tie-menu*", - "build-instance-list", - "dm-edit-instance-toggle-pick-func", - "*enable-instance-tie-menu*", - "dm-boolean-toggle-pick-func", - "*shader-pick-menu*", - "build-shader-list", - "all-texture-tweak-adjust", - "debug-menu-make-camera-mode-menu", - "dm-cam-externalize", - "dm-cam-render-float", - "dm-cam-settings-func", - "dm-cam-settings-func-int", - "debug-create-cam-restore", - "dm-cam-mode-func", - "cam-robotboss", - "dm-instance-pick-func", - "dm-enable-instance-func", - "dm-shader-pick-func", - "debug-menu-nodeeul", "eul->matrix", "set-eul!", "eul->quat", "quat->eul"], - "euler-h": ["EulSafe", "EulNext", "euler-angles"], - "evilbro": ["*evilsis-intro-sg*", "*evilbro-intro-sg*", "evilbro", "evilsis"], - "explorer": ["*explorer-sg*", "explorer"], - "eye": ["convert-eye-data", "*eye-work*", "render-eyes", "update-eyes"], - "eye-h": [ - "*eye-control-array*", - "eye", - "eye-control", - "eye-control-array", - "eye-work" - ], - "fact-h": [ - "process-drawable-art-error", - "*FACT-bank*", - "pickup-type->string", - "fact-bank", - "fact-info", - "fact-info-target", - "fact-info-enemy" - ], - "farmer": ["*farmer-sg*", "farmer"], - "file-io": [ - "*file-temp-string*", - "file-stream-read", - "file-stream-open", - "file-stream-length", - "file-stream-read-string", - "make-file-name", - "make-vfile-name", - "file-info-correct-version?", - "file-stream", - "file-info" - ], - "final-door": [ - "powercellalt-init-by-other", - "*powercellalt-sg*", - "*power-right-sg*", - "*power-left-sg*", - "fin-door", - "final-door", - "power-left", - "power-right", - "powercellalt" - ], - "firecanyon-obs": [ - "*crate-darkeco-cluster-sg*", - "*spike-sg*", - "spike-down", - "spike-idle", - "spike-up", - "balloon-idle", - "balloon-popping", - "balloon", - "spike", - "crate-darkeco-cluster" - ], - "firecanyon-part": ["firecanyon-part"], - "fisher-JUN": [ - "*fish-net-sg*", - "*fisher-sg*", - "*FISHER-bank*", - "fisher-fish-water", - "fisher-playing", - "*fisher-params*", - "fisher-game-update", - "fisher-done", - "fisher-draw-display", - "fisher-spawn-ambient", - "fisher-fish-init-by-other", - "*catch-fishc-sg*", - "*catch-fishb-sg*", - "*catch-fisha-sg*", - "fisher-fish-fall", - "fisher-fish-move", - "fisher-fish-caught", - "fisher-fish-die", - "fisher-bank", - "fisher-params", - "fisher", - "fisher-fish" - ], - "fishermans-boat": [ - "fishermans-boat-spawn-particles", - "fishermans-boat-play-sounds", - "fishermans-boat-reset-physics", - "fishermans-boat-docked-village", - "*fb-evilbro-sg*", - "*fb-evilsis-sg*", - "fishermans-boat-docked-misty", - "*fishermans-boat-sg*", - "*boat-turning-radius-table*", - "*boat-throttle-control-table*", - "fishermans-boat-set-dock-point", - "fishermans-boat-set-path-point", - "fishermans-boat-next-path-point", - "*fishermans-boat-constants*", - "fishermans-boat-set-throttle-by-speed", - "fishermans-boat-player-control", - "fishermans-boat-entering-village", - "fishermans-boat-entering-misty", - "fishermans-boat-enter-dock?", - "fishermans-boat-leave-dock?", - "fishermans-boat-ride-to-village1", - "fishermans-boat-ride-to-misty", - "fishermans-boat-wave", - "fishermans-boat-post", - "fishermans-boat-leaving-village", - "fishermans-boat-leaving-misty", - "fishermans-boat-measurements", - "boat-stabilizer", - "vehicle-path", - "vehicle-controller", - "fishermans-boat" - ], - "floating-launcher": [ - "*floating-launcher-sg*", - "floating-launcher-idle", - "floating-launcher-ready", - "floating-launcher-lowering", - "floating-launcher" - ], - "flutflut": [ - "*flutflut-sg*", - "*flutflut-shadow-control*", - "flutflut-effect", - "flutflut" - ], - "flutflut-bluehut": ["*flutflut-bluehut-sg*", "flutflut-bluehut"], - "flying-lurker": [ - "*flying-lurker-sg*", - "play-movie?", - "flying-lurker-move", - "flying-lurker-rotate", - "flying-lurker-die", - "flying-lurker-idle", - "first?", - "flying-lurker-start", - "flying-lurker-clone", - "flying-lurker-handler", - "flying-lurker-sleep", - "flying-lurker-play-intro", - "flying-lurker-inc-try-count", - "*ogrecam-sg*", - "flying-lurker-fly", - "flying-lurker-calc-anim-speed", - "flying-lurker-calc-speed", - "*plunger-lurker-sg*", - "plunger-lurker-die", - "plunger-lurker-idle", - "plunger-lurker-flee", - "plunger-lurker-plunge", - "plunger-lurker", - "flying-lurker" - ], - "font": [ - "*font12-table*", - "*font24-table*", - "get-string-length", - "draw-string-adv" - ], - "font-h": [ - "*font-default-matrix*", - "*font-work*", - "font-set-tex0", - "char-verts", - "char-color", - "font-context", - "font-work" - ], - "gambler": ["*gambler-sg*", "gambler"], - "game-h": [ - "*global-attack-id*", - "process-drawable", - "process-drawable-reserved", - "attack-info", - "ground-tween-info" - ], - "game-info": [ - "*level-task-data-remap*", - "get-task-control", - "level-hint-spawn", - "get-game-count", - "activate-orb-all", - "close-specific-task!", - "reset-all-hint-controls", - "*kernel-boot-message*", - "reset-actors", - "*spawn-actors*", - "set-blackout-frames", - "set-master-mode", - "stop", - "start", - "*default-continue*", - "position-in-front-of-camera!", - "*level-load-list*", - "game-task->string", - "trsq->continue-point" - ], - "game-info-h": [ - "*GAME-bank*", - "*game-info*", - "game-bank", - "actor-id", - "level-buffer-state", - "load-state", - "continue-point", - "game-info" - ], - "game-save": [ - "*auto-save-info*", - "auto-save-command", - "auto-save-init-by-other", - "progress-allowed?", - "print-game-text", - "get-aspect-ratio", - "get-task-status", - "lookup-level-info", - "calculate-completion", - "scf-get-time", - "*level-task-data*", - "game-save-elt->string", - "progress-level-index->string", - "auto-save-post", - "auto-save-check", - "game-save-tag", - "game-save", - "auto-save" - ], - "gcommon": [ - "format", - "#f", - "structure", - "pair", - "binteger", - "type", - "valid?", - "type-type?", - "symbol", - "fact", - "array", - "number", - "integer", - "float", - "object", - "delete-car!", - "nmember", - "name=", - "nothing", - "identity", - "1/", - "+", - "-", - "*", - "/", - "ash", - "mod", - "rem", - "abs", - "min", - "max", - "logior", - "logand", - "lognor", - "logxor", - "lognot", - "false-func", - "true-func", - "_format", - "uint128", - "method-set!", - "basic", - "basic-type?", - "find-parent-method", - "ref", - "last", - "member", - "assoc", - "assoce", - "nassoc", - "nassoce", - "append!", - "delete!", - "insert-cons!", - "sort", - "mem-copy!", - "qmem-copy<-!", - "qmem-copy->!", - "mem-set32!", - "mem-or!", - "quad-copy!", - "*print-column*", - "print", - "printl", - "inspect", - "*debug-segment*", - "mem-print", - "*trace-list*", - "print-tree-bitmask", - "breakpoint-range-set!", - "vec4s", - "bfloat", - "inline-array-class" - ], - "generic": [ - "*generic-foreground-sinks*", - "generic-init-buf", - "generic-dma-foreground-sink-init", - "generic-init-buffers", - "generic-sink" - ], - "generic-effect": [ - "generic-work-init", - "generic-upload-vu0", - "upload-vu0-program", - "*generic-consts*", - "*generic-envmap-texture*", - "*target-lock*", - "generic-initialize-without-sink", - "generic-initialize", - "generic-wrapup", - "generic-dma-from-spr", - "generic-light-proc", - "generic-envmap-proc", - "generic-prepare-dma-double", - "generic-prepare-dma-single", - "generic-envmap-dproc", - "generic-interp-dproc", - "generic-no-light-proc", - "generic-no-light-dproc-only", - "generic-no-light-dproc", - "generic-no-light+envmap", - "generic-no-light", - "generic-envmap-only-proc", - "generic-light", - "generic-copy-vtx-dclr-dtex", - "generic-none", - "generic-none-dma-wait", - "generic-debug-light-proc", - "generic-post-debug" - ], - "generic-h": [ - "gsf-vertex-array", - "gsf-fx-vertex-array", - "kmalloc", - "*gsf-buffer*", - "gsf-vertex", - "gsf-fx-vertex", - "gsf-header", - "gsf-ik", - "gsf-info", - "gsf-buffer", - "generic-frag", - "generic-strip", - "generic-envmap-saves", - "generic-interp-job", - "generic-saves", - "generic-gif-tag", - "ad-cmd", - "generic-envmap-consts", - "generic-consts", - "generic-storage" - ], - "generic-merc": [ - "mercneric-vu0-block", - "*inv-init-table*", - "generic-merc-init-asm", - "mercneric-matrix-asm", - "mercneric-shader-asm", - "mercneric-bittable-asm", - "mercneric-convert", - "high-speed-reject", - "generic-merc-execute-asm", - "generic-merc-add-to-cue", - "generic-merc-execute-all", - "invinitdata" - ], - "generic-merc-h": [ - "merc-matrix", - "generic-merc-tag", - "generic-merc-ctrl", - "generic-merc-ctrl-with-sfx", - "generic-merc-input", - "generic-merc-output", - "generic-merc-dcache", - "gm-shadow", - "generic-merc-work" - ], - "generic-obs": [ - "line-in-view-frustum?", - "*particle-quat*", - "process-drawable-random-point!", - "touch-tracker-idle", - "cam-launcher-longfall", - "cam-launcher-shortfall", - "launcher-idle", - "process-drawable-from-entity!", - "launcher-deactivated", - "launcher-active", - "cam-launcher-long-joystick", - "beach-part-grotto-1", - "part-spawner-active", - "*lev-string*", - "med-res-level-idle", - "camera-tracker-process", - "hide-hud-quick", - "command-get-process", - "camera-change-to", - "camera-look-at", - "camera-pov-from", - "command-get-trans", - "manipy-init", - "part-tracker-process", - "part-tracker-notify", - "manipy-idle", - "clone-anim-once", - "convert-to-hud-object", - "swingpole-stance", - "swingpole-active", - "merc-eye-anim", - "clone-anim", - "command-get-camera", - "ja-anim-done?", - "camera-anim", - "camera-tracker-init", - "cam-launcher-joystick", - "launcher-init-by-other", - "touch-tracker-init", - "process-drawable-pair-random-point!", - "birth-func-set-quat", - "draw-eco-beam", - "target-start", - "camera-start", - "med-res-level", - "launcher" - ], - "generic-obs-h": [ - "manipy", - "part-spawner", - "part-tracker", - "camera-tracker", - "touch-tracker", - "swingpole", - "gui-query", - "othercam", - "process-hidden" - ], - "generic-tie": [ - "generic-tie-dma-to-spad", - "generic-tie-dma-to-spad-sync", - "*generic-tie*", - "generic-tie-decompress", - "generic-tie-upload-next", - "generic-tie-convert-proc", - "generic-tie-convert", - "generic-tie-display-stats", - "generic-tie-debug", - "generic-tie-execute" - ], - "generic-tie-h": [ - "generic-tie-instance", - "generic-tie-input", - "generic-tie-run-control", - "generic-tie-base-point", - "generic-tie-bps", - "generic-tie-interp-point", - "generic-tie-ips", - "generic-tie-header", - "generic-tie-matrix", - "generic-tie-normal", - "generic-tie-control", - "generic-tie-stats", - "generic-tie-calls", - "generic-tie-shadow", - "generic-tie-work" - ], - "generic-vu0": ["generic-vu0-block"], - "generic-vu1": [ - "generic-vu1-block", - "generic-add-constants", - "generic-setup-constants", - "generic-reset-buffers" - ], - "generic-vu1-h": ["pris-mtx", "generic-pris-mtx-save", "generic-constants"], - "generic-work-h": [ - "*generic-debug*", - "generic-input-buffer", - "generic-debug", - "generic-vu1-header", - "generic-vu1-texbuf", - "generic-texbuf", - "generic-effect-work", - "generic-effect-buffer", - "generic-work" - ], - "geologist": ["*geologist-sg*", "geologist"], - "geometry": [ - "curve-length", - "curve-get-pos!", - "vector-vector-distance-squared", - "curve-evaluate!", - "vector-vector-distance", - "circle-circle-xz-intersect", - "vector-normalize-copy!", - "forward-up->quaternion", - "matrix-from-two-vectors-partial-linear!", - "matrix-from-two-vectors-max-angle!", - "vector-negate!", - "vector-normalize-ret-len!", - "vector-flatten!", - "vector-normalize!", - "vector-cross!", - "forward-down->inv-matrix", - "forward-up-nopitch->inv-matrix", - "forward-down-nopitch->inv-matrix", - "vector-float*!", - "vector+float*!", - "vector-reflect!", - "vector-reflect-flat!", - "vector-reflect-true-flat!", - "vector-reflect-flat-above!", - "vector-segment-distance-point!", - "vector-line-distance", - "vector-line-distance-point!", - "vector-orient-by-quat!", - "forward-up-nopitch->quaternion", - "quaternion-from-two-vectors!", - "matrix-from-two-vectors!", - "matrix-from-two-vectors-max-angle-partial!", - "matrix-remove-z-rot", - "matrix-rot-diff!", - "quaternion-seek", - "vector-deg-seek", - "vector-deg-slerp", - "vector-vector-deg-slerp!", - "normal-of-plane", - "vector-3pt-cross!", - "closest-pt-in-triangle", - "point-in-triangle-cross", - "point-in-plane-<-point+normal!", - "circle-test", - "vector-circle-tangent-new", - "vector-circle-tangent", - "find-knot-span", - "calculate-basis-functions-vector!", - "curve-copy!", - "curve-closest-point", - "vector-plane-distance" - ], - "geometry-h": ["curve", "border-plane"], - "gkernel": [ - "dead-state", - "entity-deactivate-handler", - "process-disconnect", - "*kernel-context*", - "throw", - "set-to-run-bootstrap", - "change-parent", - "inspect-process-tree", - "*listener-function*", - "*enable-method-set*", - "reset-and-call", - "*listener-process*", - "execute-process-tree", - "*active-pool*", - "*stdcon1*", - "*stdcon*", - "*debug-draw-pauseable*", - "*stdcon0*", - "*dram-stack*", - "search-process-tree", - "iterate-process-tree", - "*global-search-name*", - "process-not-name", - "process-by-name", - "*global-search-count*", - "*null-kernel-context*", - "*null-process*", - "process", - "*debug-dead-pool*", - "*vis-boot*", - "inspect-process-heap", - "*kernel-packages*", - "dgo-load", - "*kernel-version*", - "*irx-version*", - "*kernel-boot-mode*", - "*kernel-boot-level*", - "*deci-count*", - "*last-loado-length*", - "*last-loado-global-usage*", - "*last-loado-debug-usage*", - "load-package", - "unload-package", - "malloc", - "remove-exit", - "stream<-process-mask", - "*master-mode*", - "*pause-lock*", - "return-from-thread", - "return-from-thread-dead", - "process-count", - "kill-by-name", - "kill-by-type", - "kill-not-name", - "kill-not-type", - "kernel-dispatcher", - "throw-dispatch", - "previous-brother", - "change-brother", - "change-to-last-brother", - "run-function-in-process", - "set-to-run", - "*16k-dead-pool*", - "*8k-dead-pool*", - "*4k-dead-pool*", - "*target-dead-pool*", - "*camera-dead-pool*", - "*camera-master-dead-pool*", - "*nk-dead-pool*", - "*default-dead-pool*", - "*pickup-dead-pool*", - "*dead-pool-list*", - "*display-pool*", - "*camera-pool*", - "*target-pool*", - "*entity-pool*", - "*default-pool*" - ], - "gkernel-h": [ - "process-tree", - "stack-frame", - "uint64", - "kernel-context", - "thread", - "cpu-thread", - "dead-pool", - "dead-pool-heap-rec", - "dead-pool-heap", - "catch-frame", - "protect-frame", - "handle", - "state", - "event-message-block" - ], - "glist": [ - "glst-num-elements", - "glst-insert-after", - "glst-insert-before", - "glst-remove", - "glst-remove-tail", - "glst-remove-head", - "glst-add-tail", - "glst-add-head", - "glst-init-list!", - "glst-find-node-by-name", - "glst-get-node-by-index", - "glst-length-of-longest-name", - "glst-get-node-index" - ], - "glist-h": [ - "glst-next", - "glst-prev", - "glst-head", - "glst-tail", - "glst-end-of-list?", - "glst-start-of-list?", - "glst-empty?", - "glst-node-name", - "glst-set-name!", - "glst-node", - "glst-named-node", - "glst-list" - ], - "gnawer": [ - "*gnawer-sg*", - "gnawer-put-items-at-dest", - "gnawer-chewing-on-post", - "*gnawer-segment-infos*", - "gnawer-give-fuel-cell", - "gnawer-dying-give-pickups", - "gnawer-wait-to-run", - "gnawer-die", - "gnawer-run", - "gnawer-retreat-into-post", - "gnawer-falling-segment-init-by-other", - "gnawer-joint-callback", - "*gnawer-segment-sg*", - "gnawer-falling-segment", - "gnawer-segment-info", - "gnawer-segment", - "gnawer-route", - "gnawer" - ], - "green-eco-lurker": [ - "spawn-minions", - "green-eco-lurker-init-by-other", - "green-eco-lurker-wait-to-appear", - "*green-eco-lurker-sg*", - "*green-eco-lurker-nav-enemy-info*", - "green-eco-lurker-appear-land", - "green-eco-lurker-appear", - "green-eco-lurker-tune-spheres", - "green-eco-lurker-gen-init-by-other", - "green-eco-lurker", - "green-eco-lurker-gen" - ], - "gs": [ - "*fog-color*", - "psm-size", - "psm-page-height", - "psm->string", - "*default-regs-buffer*", - "default-buffer-init", - "open-gif-packet", - "add-reg-gif-packet", - "close-gif-packet", - "draw-context-set-xy", - "gs-pmode", - "gs-smode2", - "gs-display-fb", - "gs-display", - "gs-bgcolor", - "gs-csr", - "gs-bank", - "gs-frame", - "gs-zbuf", - "gs-xy-offset", - "gs-scissor", - "gs-prmode-cont", - "gs-color-clamp", - "gs-dthe", - "gs-test", - "gs-prim", - "gs-rgbaq", - "gs-xyz", - "gs-uv", - "gs-st", - "gs-xyzf", - "gs-trxpos", - "gs-trxreg", - "gs-trxdir", - "gs-bitbltbuf", - "gs-tex0", - "gs-tex1", - "gs-texa", - "gs-texclut", - "gs-miptbp", - "gs-alpha", - "gs-clamp", - "gs-fog", - "gs-fogcol", - "gif-ctrl", - "gif-mode", - "gif-stat", - "gif-cnt", - "gif-p3cnt", - "gif-p3tag", - "gif-bank", - "gif-tag-prim", - "gif-tag-count", - "gif-tag64", - "gif-tag", - "gs-gif-tag", - "gif-packet", - "draw-context" - ], - "gsound": [ - "*flava-table*", - "math-camera-pos", - "target-pos", - "camera-pos", - "*sound-iop-info*", - "new-sound-id", - "get-sound-buffer-entry", - "sound-trans-convert", - "sound-stop", - "*ambient-spec*", - "effect-param->sound-spec", - "ear-trans", - "*debug-effect-control*", - "sound-play-by-spec", - "sound-play-by-name", - "*setting-control*", - "*sound-player-enable*", - "sound-angle-convert", - "*sound-player-rpc*", - "sound-set-ear-trans", - "activate-progress", - "*sound-loader-rpc*", - "kset-language", - "sound-command->string", - "sound-name=", - "str-is-playing?", - "current-str-id", - "current-str-pos", - "is-cd-in?", - "check-irx-version", - "sound-bank-load", - "sound-bank-unload", - "sound-music-load", - "sound-music-unload", - "sound-reload-info", - "set-language", - "list-sounds", - "sound-buffer-dump", - "swap-sound-buffers", - "free-last-sound-buffer-entry", - "sound-basic-cb", - "sound-set-volume", - "sound-set-reverb", - "sound-pause", - "sound-continue", - "sound-group-pause", - "sound-group-stop", - "sound-group-continue", - "sound-set-falloff-curve", - "sound-set-sound-falloff", - "sound-set-flava", - "sound-volume-off", - "show-iop-info", - "show-iop-memory", - "make-sqrt-table", - "flava-lookup", - "sound-iop-info", - "flava-table-row", - "flava-table" - ], - "gsound-h": [ - "*current-sound-id*", - "*sound-bank-1*", - "*sound-bank-2*", - "sound-id", - "sound-bank-id", - "sound-name", - "sound-rpc-cmd", - "sound-play-parms", - "sound-rpc-bank-cmd", - "sound-rpc-sound-cmd", - "sound-rpc-group-cmd", - "sound-rpc-load-bank", - "sound-rpc-load-music", - "sound-rpc-unload-bank", - "sound-rpc-play", - "sound-rpc-pause-sound", - "sound-rpc-stop-sound", - "sound-rpc-continue-sound", - "sound-rpc-set-param", - "sound-rpc-set-master-volume", - "sound-rpc-pause-group", - "sound-rpc-stop-group", - "sound-rpc-continue-group", - "sound-rpc-get-irx-version", - "sound-rpc-set-language", - "sound-rpc-set-falloff-curve", - "sound-rpc-set-sound-falloff", - "sound-rpc-reload-info", - "sound-rpc-set-reverb", - "sound-rpc-set-ear-trans", - "sound-rpc-set-flava", - "sound-rpc-shutdown", - "sound-rpc-list-sounds", - "sound-rpc-unload-music", - "sound-rpc-union", - "sound-spec", - "ambient-sound" - ], - "gstate": [ - "enter-state", - "inherit-state", - "send-event-function", - "looping-code" - ], - "gstring": [ - "string-get-arg!!", - "*string-tmp-str*", - "string=", - "string->float", - "string->int", - "string-skip-whitespace", - "copyn-string<-charp", - "string-suck-up!", - "string-strip-trailing-whitespace!", - "string-strip-leading-whitespace!", - "string", - "string-skip-to-char", - "cat-string<-string_to_charp", - "copy-string<-string", - "string-charp=", - "string<-charp", - "charp<-string", - "copy-charp<-charp", - "cat-string<-string", - "catn-string<-charp", - "append-character-to-string", - "charp-basename", - "clear", - "string?", - "string<=?", - "string>=?", - "string-cat-to-last-char", - "string-strip-whitespace!", - "string-get-int32!!", - "string-get-float!!", - "string-get-flag!!", - "*temp-string*" - ], - "helix-water": [ - "*helix-water*", - "helix-water-idle", - "helix-water-activated", - "*helix-button-sg*", - "*helix-button*", - "helix-button-startup", - "helix-button-idle-down", - "helix-button-quick-activate", - "helix-button-activate", - "helix-button-idle-up", - "*helix-slide-door-sg*", - "*helix-slide-door*", - "helix-slide-door-idle-open", - "helix-slide-door-idle-closed", - "helix-slide-door-close", - "helix-slide-door", - "helix-button", - "helix-dark-eco", - "helix-water" - ], - "hint-control": [ - "*hint-semaphore*", - "find-hint-control-index", - "start-hint-timer", - "increment-success-for-hint", - "can-hint-be-played?", - "update-task-hints" - ], - "hint-control-h": [ - "level-hint-control", - "task-hint-control", - "task-hint-control-group" - ], - "hopper": [ - "*hopper-sg*", - "*hopper-nav-enemy-info*", - "hopper-do-jump", - "hopper-jump-to", - "hopper-find-ground", - "hopper" - ], - "hud": [ - "send-hud-increment-event", - "hud-hidden", - "hud-leaving", - "hud-in", - "hud-arriving", - "hud-init-by-other", - "hud-collecting" - ], - "hud-classes": [ - "calculate-rotation-and-color-for-slice", - "*fuelcell-naked-sg*", - "part-hud-health-01-func", - "part-hud-health-02-func", - "part-hud-health-03-func", - "fuel-cell-hud-orbit-callback", - "fuel-cell-hud-starburst-3-callback", - "fuel-cell-hud-starburst-4-callback", - "fuel-cell-hud-center-callback", - "part-hud-buzzer-func", - "part-hud-eco-timer-01-func", - "part-hud-eco-timer-02-func", - "part-hud-eco-timer-03-func", - "part-hud-eco-timer-backing-func", - "part-hud-eco-timer-func", - "show-hud", - "hud-pickups", - "hud-health", - "hud-money-all", - "hud-money", - "hud-fuel-cell", - "hud-buzzers", - "hud-power" - ], - "hud-h": ["*hud-parts*", "hud-icon", "hud-particle", "hud", "hud-parts"], - "ice-cube": [ - "*ice-cube-break-sg*", - "ice-cube-face-player", - "ice-cube-tired", - "ice-cube-retract-spikes", - "ice-cube-mean-charge-done", - "ice-cube-mean-turn-to-charge", - "ice-cube-become-mean", - "ice-cube-appear-land", - "ice-cube-appear", - "ice-cube-trying-to-appear", - "*ice-cube-sg*", - "*ice-cube-nav-enemy-info*", - "ice-cube-shatter", - "ice-cube-default-event-handler", - "ice-cube-mean-charge", - "ice-cube" - ], - "joint": [ - "flatten-joint-control-to-spr", - "make-joint-jump-tables", - "calc-animation-from-spr", - "decompress-fixed-data-to-accumulator", - "decompress-frame-data-to-accumulator", - "decompress-frame-data-pair-to-accumulator", - "matrix-from-control!", - "matrix-from-control-channel!", - "matrix-from-control-pair!", - "matrix-from-joint-anim-frame", - "create-interpolated-joint-animation-frame", - "mem-size", - "jacc-mem-usage", - "joint-anim-inspect-elt", - "joint-anim-login", - "joint-control-channel-eval", - "joint-control-channel-eval!", - "joint-control-channel-group-eval!", - "joint-control-channel-group!", - "joint-control-copy!", - "joint-control-remap!", - "cspace<-cspace!", - "cspace<-rot-yxy!", - "cspace<-transform-yxy!", - "cspace<-transformq+trans!", - "cspace<-transformq+world-trans!", - "cspace-calc-total-matrix!", - "cspace<-matrix-no-push-joint!", - "cspace<-matrix-joint!", - "cspace<-parented-matrix-joint!", - "clear-frame-accumulator", - "normalize-frame-quaternions" - ], - "joint-exploder": [ - "joint-exploder-joint-callback", - "joint-exploder-shatter", - "joint-exploder-init-by-other", - "joint-exploder-tuning", - "joint-exploder-static-joint-params", - "joint-exploder-static-params", - "joint-exploder-joint", - "joint-exploder-joints", - "joint-exploder-list", - "joint-exploder" - ], - "joint-h": [ - "joint-control-channel", - "joint-control", - "matrix-stack", - "channel-upload-info", - "joint-work" - ], - "joint-mod-h": [ - "joint-mod-spinner-callback", - "cspace<-parented-transformq-joint!", - "joint-mod-blend-local-callback", - "joint-mod-set-world-callback", - "cspace<-transformq!", - "joint-mod-set-local-callback", - "joint-mod-wheel-callback", - "vector<-cspace!", - "*joint-axis-vectors*", - "add-debug-text-sphere", - "last-try-to-look-at-data", - "joint-mod-look-at-handler", - "joint-mod-world-look-at-handler", - "joint-mod-rotate-handler", - "joint-mod-joint-set-handler", - "joint-mod-joint-set*-handler", - "add-debug-matrix", - "joint-mod-debug-draw", - "joint-mod", - "try-to-look-at-info", - "joint-mod-wheel", - "joint-mod-set-local", - "joint-mod-set-world", - "joint-mod-blend-local", - "joint-mod-spinner" - ], - "jungle-elevator": ["jungle-elevator"], - "jungle-mirrors": [ - "*reflector-mirror-sg*", - "reflector-mirror-broken", - "reflector-mirror-idle", - "*reflector-mirror-break-sg*", - "peri-beamcam-init-by-other", - "draw-power-beam", - "reflector-origin-idle", - "reflector-origin-update", - "reflector-init-by-other", - "periscope-find-next", - "*periscope-base-sg*", - "periscope-find-reflection-angles", - "periscope-update-joints", - "periscope-power-on", - "periscope-has-power-input?", - "periscope-wait-for-player", - "periscope-idle", - "periscope-draw-beam", - "periscope-find-aim-at-angles", - "cam-periscope", - "periscope-crosshair", - "periscope-test-task-complete?", - "periscope-draw-beam-impact", - "periscope-wait-for-power-input", - "periscope-player-control", - "periscope-activate", - "periscope-set-target-direction", - "*periscope-mirror-sg*", - "reflector-idle", - "periscope-post", - "periscope-debug-trans", - "target-close-to-point?", - "periscope", - "reflector", - "reflector-origin", - "reflector-mirror" - ], - "jungle-obs": [ - "ripple-for-jungle-water", - "*jngpusher-sg*", - "jngpusher-idle", - "*sidedoor-sg*", - "*maindoor-sg*", - "maindoor-open", - "maindoor-closed", - "*precurbridge-sg*", - "precurbridge-active", - "precurbridge-idle", - "*junglecam-sg*", - "precurbridge-activate", - "*accordian-sg*", - "accordian-idle", - "*lurkerm-piston-sg*", - "lurkerm-piston-idle", - "*lurkerm-short-sail-sg*", - "lurkerm-short-sail-idle", - "*lurkerm-tall-sail-sg*", - "lurkerm-tall-sail-idle", - "*towertop-sg*", - "towertop-idle", - "*logtrap-sg*", - "*med-res-firecanyon-sg*", - "*jungle-camera-sg*", - "precurbridge-span", - "logtrap", - "towertop", - "lurkerm-tall-sail", - "lurkerm-short-sail", - "lurkerm-piston", - "accordian", - "junglecam", - "precurbridgecam", - "precurbridge", - "maindoor", - "sidedoor", - "jngpusher", - "jungle-water" - ], - "jungle-part": ["jungle-part"], - "jungleb-obs": [ - "*jng-iris-door-sg*", - "*eggtop-sg*", - "eggtop-close", - "eggtop-idle", - "eggtop", - "jng-iris-door" - ], - "junglefish": [ - "*junglefish-sg*", - "*junglefish-nav-enemy-info*", - "junglefish" - ], - "junglesnake": [ - "*junglesnake-sg*", - "junglesnake-sleeping", - "*junglesnake-twist-max-deltas*", - "junglesnake-tracking", - "junglesnake-attack", - "junglesnake-give-up", - "junglesnake-joint-callback", - "junglesnake-wake", - "junglesnake-die", - "junglesnake-default-event-handler", - "junglesnake-twist-joint", - "junglesnake-tilt-joint", - "junglesnake" - ], - "kermit": [ - "*kermit-sg*", - "*kermit-nav-enemy-info*", - "kermit-get-tongue-target-callback", - "kermit-idle", - "kermit-disable-tongue", - "kermit-hop", - "kermit-set-nav-mesh-target", - "kermit-set-rotate-dir-to-player", - "kermit-chase", - "kermit-simple-post", - "kermit-player-target-pos", - "kermit-tongue-pos", - "kermit-check-tongue-is-clear?", - "kermit-retract-tongue", - "kermit-enable-tongue", - "spawn-kermit-pulse", - "kermit-check-to-hit-player?", - "kermit-tongue-stuck", - "kermit-patrol", - "kermit-attack", - "kermit-chase-new-position", - "kermit-give-up", - "kermit-get-head-dir-xz", - "kermit-set-rotate-dir-to-nav-target", - "kermit-notice", - "kermit-get-new-patrol-point", - "kermit-long-hop", - "kermit-short-hop", - "kermit-pulse-init-by-other", - "kermit-pulse-idle", - "kermit-pulse-impact", - "joint-mod-tracker-callback", - "build-matrix-from-up-and-forward-axes!", - "kermit-get-head-dir", - "kermit-post", - "joint-mod-tracker", - "kermit-pulse", - "kermit" - ], - "launcherdoor": [ - "*launcherdoor-maincave-sg*", - "*launcherdoor-sg*", - "launcherdoor-open", - "launcherdoor-closed", - "launcherdoor" - ], - "lava": ["ripple-for-lava", "lava"], - "lavatube-energy": [ - "*energylava-sg*", - "energylava-idle", - "*energyhub-sg*", - "energyarm-init-by-other", - "energyhub-stopped", - "energyhub-idle", - "energyhub-set-lava-height", - "energyhub-stop", - "energyhub-trans", - "energyarm-init", - "*energyarm-sg*", - "energyarm-stop", - "energyball-init-by-other", - "energyarm-idle", - "energyarm-trans", - "energyarm-no-ball", - "energyball-init", - "*energyball-sg*", - "energyball-idle", - "*energybase-sg*", - "energybase-stopped", - "energybase-idle", - "energybase-stopping", - "*energydoor-sg*", - "energydoor-player-dist", - "energydoor-closed-till-near", - "energydoor-opened", - "energydoor-closed-till-task", - "energydoor-opening", - "energydoor-open-handler", - "energydoor-closed-handler", - "energydoor-closing", - "energyarm-fall", - "energydoor", - "energybase", - "energyhub", - "energyarm", - "energyball", - "energylava" - ], - "lavatube-obs": [ - "*lavayellowtarp-sg*", - "lavayellowtarp-idle", - "ripple-for-lavatube-lava", - "*lavaballoon-sg*", - "*chainmine-sg*", - "*lavafallsewerb-sg*", - "lavafallsewerb-idle", - "*lavafallsewera-sg*", - "lavafallsewera-idle", - "darkecobarrel-base-init", - "darkecobarrel-base-time", - "darkecobarrel-cycle-time", - "darkecobarrel-advance-curspawn", - "darkecobarrel-mover-init-by-other", - "darkecobarrel-base-done?", - "darkecobarrel-base-pos", - "darkecobarrel-spawner", - "darkecobarrel-mover-pos", - "darkecobarrel-mover-move", - "darkecobarrel-mover-die", - "*darkecobarrel-sg*", - "*lavashortcut-sg*", - "lavashortcut-idle", - "*lavafall-sg*", - "lavafall-idle", - "*lavabase-sg*", - "lavabase-idle", - "lavabase", - "lavafall", - "lavashortcut", - "darkecobarrel-leak", - "darkecobarrel-base", - "darkecobarrel-mover", - "darkecobarrel", - "lavafallsewera", - "lavafallsewerb", - "chainmine", - "lavaballoon", - "lavatube-lava", - "lavayellowtarp" - ], - "lavatube-part": ["lavatube-part"], - "level": [ - "update-sound-banks", - "load-vis-info", - "*print-login*", - "on", - "unload", - "*login-state*", - "link-resume", - "level-update-after-load", - "add-bsp-drawable", - "remap-level-name", - "bg", - "play", - "show-level" - ], - "level-h": [ - "*level*", - "level-vis-info", - "level-load-info", - "login-state", - "level", - "level-group" - ], - "level-info": [ - "training", - "village1", - "beach", - "jungle", - "jungleb", - "misty", - "firecanyon", - "village2", - "sunken", - "sunkenb", - "swamp", - "rolling", - "ogre", - "village3", - "snow", - "maincave", - "darkcave", - "robocave", - "lavatube", - "citadel", - "finalboss", - "intro", - "demo", - "title", - "halfpipe", - "default-level" - ], - "light-eco": [ - "*light-eco-big-sg*", - "light-eco-mother-appear", - "light-eco-mother-active", - "light-eco-mother-discipate", - "light-eco-child-init-by-other", - "*light-eco-small-sg*", - "light-eco-child-appear", - "light-eco-child-die", - "light-eco-child-idle", - "light-eco-child-hit-ground", - "light-eco-child-grabbed", - "check-drop-level-lighteco-big-pops", - "check-drop-level-lighteco-pops", - "light-eco-child-default-event-handler", - "light-eco-mother-default-event-handler", - "light-eco-mother-init-by-other", - "light-eco-child", - "light-eco-mother" - ], - "lights": [ - "vu-lights<-light-group!", - "light-slerp", - "light-group-slerp", - "light-group-process!", - "*default-lights*", - "vu-lights-default!" - ], - "lights-h": [ - "vu-lights", - "light", - "light-ellipse", - "light-array", - "light-volume", - "light-volume-sphere", - "light-volume-planes", - "light-volume-array", - "light-group" - ], - "load-boundary": [ - "check-closed-boundary", - "check-open-boundary", - "load-state-want-vis", - "load-state-want-levels", - "load-state-want-display-level", - "load-state-want-force-vis", - "command-get-param", - "entity-birth-no-kill", - "part-tracker-init", - "command-list-get-process", - "command-get-quoted-param", - "command-get-int", - "*backup-load-state*", - "ambient-hint-spawn", - "command-get-float", - "*display-load-commands*", - "process-by-ename", - "point-in-polygon", - "*triangulation-buffer*", - "try-corner", - "split-monotone-polygon", - "fix-boundary-normals", - "triangulate-boundary", - "find-bounding-circle", - "render-boundary", - "check-boundary", - "edit-load-boundaries", - "*lb-editor-parms*", - "copy-load-command!", - "copy-load-boundary!", - "lb-add-plane", - "lb-add", - "save-boundary-cmd", - "replace-load-boundary", - "format-boundary-cmd", - "boundary-set-color", - "*boundary-polygon*", - "add-boundary-shader", - "draw-boundary-cap", - "draw-boundary-side", - "init-boundary-regs", - "render-boundary-tri", - "render-boundary-quad", - "draw-boundary-polygon", - "lb-del", - "lb-add-vtx-before", - "lb-add-vtx-after", - "lb-del-vtx", - "load-boundary-from-template", - "---lb-save", - "lb-add-load", - "lb-add-load-plane", - "lb-flip", - "lb-set-camera", - "lb-set-player", - "lb-copy", - "render-boundaries", - "command-get-time", - "lb-editor-parms" - ], - "load-boundary-data": ["*static-load-boundary-list*"], - "load-boundary-h": [ - "*load-boundary-list*", - "*load-boundary-target*", - "lbvtx", - "load-boundary-crossing-command", - "load-boundary" - ], - "load-dgo": [ - "*dgo-name*", - "link-begin", - "*load-dgo-rpc*", - "*dgo-time*", - "string->sound-name", - "*play-str-rpc*", - "*que-str-lock*", - "*load-str-lock*", - "*load-str-rpc*", - "str-load", - "str-load-status", - "str-load-cancel", - "str-play-async", - "str-play-stop", - "str-play-queue", - "str-ambient-play", - "str-ambient-stop", - "str-play-kick", - "dgo-load-begin", - "dgo-load-get-next", - "dgo-load-continue", - "dgo-load-cancel", - "find-temp-buffer", - "dgo-load-link", - "destroy-mem", - "load-dgo-msg", - "load-chunk-msg", - "dgo-header" - ], - "loader": [ - "*load-state*", - "*art-control*", - "ja-channel-push!", - "ja-channel-set!", - "kill-current-level-hint", - "level-hint-surpress!", - "ja-aframe-num", - "ja-abort-spooled-anim", - "*preload-spool-anims*", - "*stack-top*", - "*kernel-sp*", - "art-group-load-check", - "drawable-load", - "art-load", - "ja-play-spooled-anim" - ], - "loader-h": [ - "load-dir", - "load-dir-art-group", - "external-art-buffer", - "spool-anim", - "external-art-control" - ], - "logic-target": [ - "init-target", - "target-print-stats", - "activate-hud", - "reset-target-state", - "init-sidekick", - "target-generic-event-handler", - "level-setup", - "target-continue", - "target-exit", - "target-calc-camera-pos", - "do-target-shadow", - "target-powerup-process", - "flag-setup", - "build-conversions", - "do-rotations1", - "read-pad", - "turn-to-vector", - "add-thrust", - "add-gravity", - "do-rotations2", - "reverse-conversions", - "bend-gravity", - "post-flag-setup", - "joint-points", - "target-real-post", - "target-compute-edge", - "target-compute-pole", - "target-compute-slopes", - "warp-vector-into-surface!", - "vector<-pad-in-surface!", - "draw-history", - "vector-turn-to", - "print-history", - "local-pad-angle", - "turn-around?", - "target-move-dist", - "target-compute-edge-rider", - "target-post", - "target-swim-post", - "target-no-stick-post", - "target-no-move-post", - "target-slide-down-post", - "target-no-ja-move-post" - ], - "lurkercrab": [ - "*lurkercrab-sg*", - "*lurkercrab-nav-enemy-info*", - "lurkercrab-vulnerable", - "lurkercrab-invulnerable", - "lurkercrab-pushed", - "lurkercrab" - ], - "lurkerpuppy": [ - "*lurkerpuppy-sg*", - "*lurkerpuppy-nav-enemy-info*", - "lurkerpuppy" - ], - "lurkerworm": [ - "*lurkerworm-sg*", - "lurkerworm-prebind-function", - "lurkerworm-joint-callback", - "lurkerworm-idle", - "lurkerworm-rest", - "lurkerworm-strike", - "lurkerworm-sink", - "lurkerworm-rise", - "lurkerworm-spot", - "lurkerworm-die", - "lurkerworm-default-event-handler", - "lurkerworm-default-post-behavior", - "lurkerworm" - ], - "main": [ - "display-loop", - "entity-by-type", - "*cheat-temp*", - "scf-get-territory", - "*progress-cheat*", - "scf-get-timeout", - "scf-get-inactive-timeout", - "*master-exit*", - "kernel-shutdown", - "*last-master-mode*", - "pause-allowed?", - "menu-respond-to-pause", - "hide-progress-screen", - "set-letterbox-frames", - "letterbox", - "blackout", - "*screen-filter*", - "main-cheats", - "off" - ], - "main-collide": [ - "drawable-sphere-box-intersect?", - "instance-sphere-box-intersect?", - "instance-tfragment-add-debug-sphere" - ], - "main-h": [ - "*stats-poly*", - "*stats-memory*", - "*stats-memory-short*", - "*stats-collide*", - "*stats-bsp*", - "*stats-buffer*", - "*stats-target*", - "*stats-dma-test*", - "*artist-all-visible*", - "*artist-flip-visible*", - "*artist-fix-visible*", - "*artist-fix-frustum*", - "*artist-error-spheres*", - "*artist-use-menu-subdiv*", - "*display-profile*", - "*display-sidekick-stats*", - "*display-quad-stats*", - "*display-tri-stats*", - "*display-perf-stats*", - "*display-ground-stats*", - "*display-collision-marks*", - "*display-collide-cache*", - "*display-render-collision*", - "*display-hipri-collision-marks*", - "*display-edge-collision-marks*", - "*display-geo-marks*", - "*display-target-marks*", - "*display-collide-history*", - "*display-xyz-axes*", - "*display-cam-collide-history*", - "*record-cam-collide-history*", - "*display-cam-master-marks*", - "*display-cam-other*", - "*display-camera-marks*", - "*camera-no-mip-correction*", - "*display-cam-los-info*", - "*display-cam-los-debug*", - "*display-cam-los-marks*", - "*display-cam-coll-marks*", - "*display-camera-info*", - "*display-camera-old-stats*", - "*display-camera-last-attacker*", - "*display-file-info*", - "*display-actor-marks*", - "*display-ambient-hint-marks*", - "*display-ambient-sound-marks*", - "*display-ambient-poi-marks*", - "*display-ambient-light-marks*", - "*display-ambient-dark-marks*", - "*display-ambient-weather-off-marks*", - "*display-ambient-ocean-off-marks*", - "*display-ambient-ocean-near-off-marks*", - "*display-ambient-music-marks*", - "*display-sprite-info*", - "*display-entity-errors*", - "*display-lights*", - "*display-instance-info*", - "*display-deci-count*", - "*sync-dma*", - "*display-strip-lines*", - "*display-nav-marks*", - "*display-path-marks*", - "*display-vol-marks*", - "*display-water-marks*", - "*display-actor-anim*", - "*display-process-anim*", - "*display-actor-vis*", - "*display-actor-graph*", - "*display-level-border*", - "*display-load-boundaries*", - "*display-memcard-info*", - "*display-split-boxes*", - "*display-split-box-info*", - "*display-texture-download*", - "*display-art-control*", - "*display-level-spheres*", - "*time-of-day-effects*", - "*time-of-day-fast*", - "*display-iop-info*", - "*ambient-sound-class*", - "*slow-frame-rate*", - "*weather-off*", - "*debug-pause*", - "*subdivide-draw-mode*", - "*ocean-subdivide-draw-mode*", - "*dproc*", - "*run*", - "*teleport*", - "*teleport-count*", - "*draw-hook*", - "*debug-hook*", - "*menu-hook*", - "*progress-hook*", - "*dma-timeout-hook*", - "*frame-stats*", - "frame-stats", - "screen-filter" - ], - "maincave-obs": [ - "*caveelevator-sg*", - "caveelevator-joint-callback", - "cavecrystal-light-control-caveelevator-callback", - "caveelevator-cycle-active", - "caveelevator-one-way-idle-start", - "caveelevator-one-way-travel-to-start", - "caveelevator-one-way-idle-end", - "caveelevator-one-way-travel-to-end", - "*cavespatulatwo-sg*", - "cavespatulatwo-idle", - "*cavespatula-darkcave-sg*", - "*cavespatula-sg*", - "cavespatula-idle", - "caveflamepots-active", - "*cavetrapdoor-sg*", - "*cavecrusher-sg*", - "cavecrusher-idle", - "ripple-for-cave-water", - "*maincavecam-sg*", - "maincavecam", - "cave-water", - "cavecrusher", - "cavetrapdoor", - "caveflamepots", - "cavespatula", - "cavespatulatwo", - "caveelevator" - ], - "maincave-part": [ - "check-drop-level-maincave-drip", - "maincave-part", - "darkcave-part" - ], - "math": [ - "rand-vu", - "rand-vu-float-range", - "truncate", - "integral?", - "fractional-part", - "log2", - "seek", - "lerp", - "lerp-scale", - "lerp-clamp", - "seekl", - "rand-vu-init", - "rand-vu-nostep", - "rand-vu-percent?", - "rand-vu-int-range", - "rand-vu-int-count", - "*random-generator*", - "rand-uint31-gen", - "rgba", - "xyzw", - "xyzwh", - "random-generator" - ], - "math-camera": [ - "*math-camera*", - "update-math-camera", - "fog-corrector-setup", - "*math-camera-fog-correction*", - "sprite-distorter-generate-tables", - "math-cam-start-smoothing", - "move-target-from-pad", - "transform-point-vector!", - "transform-point-qword!", - "transform-point-vector-scale!", - "init-for-transform", - "fog-corrector" - ], - "math-camera-h": ["vis-gif-tag", "cull-info", "math-camera"], - "matrix": [ - "atan", - "matrix-4x4-determinant", - "matrix-3x3-determinant", - "matrix-axis-sin-cos!", - "sin", - "cos", - "matrix-rotate-y!", - "matrix-rotate-x!", - "matrix*!", - "vector-sincos!", - "matrix-rotate-z!", - "matrix-identity!", - "matrix-transpose!", - "vector-rotate*!", - "vector-matrix*!", - "*identity-matrix*", - "matrix+!", - "matrix-!", - "matrixp*!", - "vector3s-matrix*!", - "vector3s-rotate*!", - "matrix-inverse-of-rot-trans!", - "matrix-4x4-inverse!", - "matrix-translate!", - "matrix-translate+!", - "matrix-scale!", - "scale-matrix!", - "matrix-inv-scale!", - "column-scale-matrix!", - "matrix-rotate-zyx!", - "matrix-rotate-xyz!", - "matrix-rotate-zxy!", - "matrix-rotate-yxz!", - "matrix-rotate-yzx!", - "matrix-rotate-yxy!", - "matrix-rotate-yx!", - "matrix-axis-sin-cos-vu!", - "matrix-axis-angle!", - "matrix-lerp!", - "matrix3-determinant", - "matrix-3x3-inverse!", - "matrix-3x3-inverse-transpose!", - "matrix3-inverse-transpose!", - "matrix-4x4-inverse-transpose!", - "matrix-y-angle" - ], - "matrix-h": ["matrix-copy!", "matrix", "matrix3", "matrix4h"], - "mayor": ["*mayor-sg*", "mayor-lurkerm-reward-speech", "mayor"], - "memcard-h": [ - "mc-get-slot-info", - "mc-run", - "mc-check-result", - "int32", - "mc-sync", - "show-mc-info", - "mc-handle", - "mc-file-info", - "mc-slot-info" - ], - "memory-usage": ["*max-dma*"], - "memory-usage-h": [ - "*mem-usage*", - "*dma-mem-usage*", - "*temp-mem-usage*", - "memory-usage-info", - "memory-usage-block" - ], - "menu": [ - "debug-menus-active", - "debug-menus-default-joypad-func", - "debug-menu-context-render", - "debug-menu-context-close-submenu", - "debug-menu-context-activate-selection", - "debug-menu-context-select-new-item", - "debug-menu-item-send-msg", - "debug-menu-send-msg", - "debug-menu-context-send-msg", - "debug-menu-item-submenu-msg", - "debug-menu-item-function-msg", - "debug-menu-item-flag-msg", - "debug-menu-item-var-msg", - "debug-menu-context-release-joypad", - "debug-menu-context-grab-joypad", - "debug-menu-item-var-joypad-handler", - "debug-menu-item-var-update-display-str", - "debug-menu-context-open-submenu", - "debug-menu-context-select-next-or-prev-item", - "debug-menu-render", - "debug-menu-item-render", - "debug-menu-item-submenu-render", - "debug-menu-item-function-render", - "debug-menu-item-flag-render", - "debug-menu-item-var-render", - "debug-menu-make-from-template", - "debug-menu-append-item", - "debug-menu-context-set-root-menu", - "debug-menu-func-decode", - "debug-menu-item-var-make-int", - "debug-menu-item-var-make-float", - "debug-menu-rebuild", - "debug-menu-context-default-selection", - "debug-menu-item-get-max-width", - "debug-menu-remove-all-items", - "debug-menu-find-from-template", - "debug-menus-handler", - "debug-menu-context", - "debug-menu-node", - "debug-menu", - "debug-menu-item", - "debug-menu-item-submenu", - "debug-menu-item-function", - "debug-menu-item-flag", - "debug-menu-item-var" - ], - "merc": [ - "merc-vu1-init-buffer", - "merc-vu1-initialize-chain", - "merc-vu1-add-vu-function", - "*merc-ctrl-header*", - "get-eye-block", - "merc-stats-display", - "merc-stats", - "merc-edge-stats", - "merc-vu1-init-buffers" - ], - "merc-blend-shape": [ - "*blerc-globals*", - "setup-blerc-chains-for-one-fragment", - "setup-blerc-chains", - "blerc-stats-init", - "*stats-blerc*", - "blerc-init", - "blerc-a-fragment", - "dma-from-spr", - "merc-dma-chain-to-spr", - "blerc-execute", - "merc-blend-shape", - "blerc-block-header", - "blerc-block", - "blerc-dcache", - "blerc-globals", - "blerc-context" - ], - "merc-death": [ - "*merc-death-globals*", - "birth-func-death-sparks", - "death-beach-puppy", - "death-jungle-snake", - "death-default", - "death-warp-in", - "death-warp-out", - "merc-death-spawn", - "death-info" - ], - "merc-h": [ - "merc-fragment-fp-data", - "merc-blend-data", - "ripple-merc-query", - "merc-byte-header", - "merc-fragment", - "merc-vtx", - "merc-fp-header", - "merc-mat-dest", - "merc-fragment-control", - "merc-blend-ctrl", - "mei-envmap-tint", - "mei-texture-scroll", - "mei-ripple", - "merc-extra-info", - "merc-effect", - "merc-eye-ctrl", - "merc-eye-anim-frame", - "merc-eye-anim-block", - "merc-ctrl-header", - "merc-ctrl", - "merc-vu1-low-mem", - "ripple-wave", - "ripple-wave-set", - "ripple-control" - ], - "merc-vu1": ["merc-vu1-block"], - "minecart": [ - "minecartsteel-initialize-by-other", - "*minecartsteel-sg*", - "minecartsteel" - ], - "miners": [ - "*cavegem-sg*", - "*minershort-sg*", - "minershort-trans-hook", - "*minertall-sg*", - "miners-anim-loop", - "minertall", - "minershort", - "cavegem" - ], - "misty-conveyor": [ - "*keg-conveyor-sg*", - "keg-conveyor-paddle-init-by-other", - "keg-conveyor-idle", - "*keg-conveyor-paddle-sg*", - "keg-conveyor-paddle-idle", - "*keg-conveyor-keg-spawn-table*", - "keg-conveyor-spawn-keg", - "keg-conveyor-spawn-bouncing-keg", - "keg-init-by-other", - "*keg-sg*", - "keg-on-paddle", - "keg-die", - "keg-in-chute", - "keg-bounce-set-particle-rotation-callback", - "keg-update-smush", - "keg-on-path", - "keg-paddle-to-path", - "keg-event-handler", - "keg-post", - "keg-conveyor", - "keg-conveyor-paddle", - "keg" - ], - "misty-obs": [ - "boat-fuelcell-spawn", - "boat-fuelcell-idle", - "*mistycam-sg*", - "boat-fuelcell-die", - "*mis-bone-platform-sg*", - "*bone-platform-constants*", - "*breakaway-left-sg*", - "*breakaway-mid-sg*", - "*breakaway-right-sg*", - "breakaway-idle", - "breakaway-fall", - "breakaway-about-to-fall", - "*mis-bone-bridge-sg*", - "mis-bone-bridge-fall", - "mis-bone-bridge-idle", - "mis-bone-bridge-hit", - "mis-bone-bridge-bump", - "*windturbine-sg*", - "windturbine-idle", - "*boatpaddle-sg*", - "boatpaddle-idle", - "mis-bone-bridge-event-handler", - "actor-wait-for-period", - "misty-cam-restore", - "boatpaddle", - "windturbine", - "mis-bone-bridge", - "breakaway", - "breakaway-right", - "breakaway-mid", - "breakaway-left", - "bone-platform", - "mistycam", - "misty-battlecontroller", - "boat-fuelcell" - ], - "misty-part": ["misty-part"], - "misty-teetertotter": [ - "*teetertotter-sg*", - "teetertotter-idle", - "target-on-end-of-teetertotter?", - "teetertotter-launch", - "teetertotter-bend", - "teetertotter" - ], - "misty-warehouse": [ - "*rounddoor-sg*", - "*silostep-sg*", - "silostep-rise", - "silostep-idle", - "misty-camera-view", - "silostep-camera", - "silostep", - "rounddoor" - ], - "mistycannon": [ - "*mistycannon-sg*", - "mistycannon-prebind-function", - "mistycannon-postbind-function", - "angle-tracker-init-range!", - "mistycannon-pick-random-target-point", - "mistycannon-idle", - "mistycannon-waiting-for-player", - "cam-mistycannon", - "mistycannon-waiting-for-player-to-fuck-off", - "angle-tracker-seek!", - "mistycannon-aim-at-player", - "mistycannon-player-control", - "mistycannon-do-aim", - "mistycannon-find-trajectory", - "solve-missile-velocity", - "spawn-mistycannon-missile", - "angle-tracker-apply-move!", - "mistycannon-missile-init-by-other", - "mistycannon-collision-reaction", - "*mistycannon-missile-sg*", - "mistycannon-missile-idle", - "mistycannon-missile-explode", - "mistycannon-missile-in-water", - "angle-tracker-get-value", - "angle-tracker-set-value", - "solve-missile-tilt", - "mistycannon-find-best-solution", - "angle-tracker", - "mistycannon-missile", - "mistycannon-init-data", - "mistycannon", - "quadratic-solution", - "trajectory-params" - ], - "mood": [ - "clear-mood-times", - "update-mood-quick", - "update-mood-flames", - "update-mood-light", - "target-joint-pos", - "update-mood-itimes", - "update-mood-fog", - "update-mood-sky-texture", - "update-mood-palette", - "*time-of-day-proc*", - "update-mood-interp", - "update-mood-lightning", - "*lightning-time2*", - "update-mood-lava", - "update-light-kit", - "set-target-light-index", - "*rolling-spheres-on*", - "*rolling-spheres-light0*", - "*rolling-spheres-light1*", - "*rolling-spheres-light2*", - "*rolling-spheres-light3*", - "*rolling-spheres-light4*", - "update-mood-caustics", - "update-mood-jungleb-blue", - "update-mood-prt-color", - "*flash0*", - "*flash1*", - "*flash2*", - "*flash3*", - "*flash4*", - "*flash5*", - "*flash6*", - "*flash7*", - "*lightning-index*", - "*lightning-time*", - "*lightning-frame-done*", - "*lightning-realtime-done*", - "*thunder-id0*", - "*thunder-id1*", - "*thunder-id2*", - "*thunder-id*", - "*thunder-count*", - "*lava-time*", - "update-mood-default", - "update-mood-misty", - "update-mood-village2", - "update-mood-swamp", - "update-mood-village1", - "update-mood-jungle", - "update-mood-jungleb", - "update-mood-sunken", - "update-mood-rolling", - "update-mood-firecanyon", - "update-mood-training", - "update-mood-maincave", - "update-mood-darkcave", - "update-mood-robocave", - "update-mood-snow", - "update-mood-village3", - "update-mood-lavatube", - "update-mood-ogre", - "update-mood-finalboss", - "update-mood-citadel", - "flames-state", - "lightning-state", - "light-time-state", - "light-state", - "lava-state", - "misty-states", - "swamp-village2-states", - "village1-states", - "jungle-states", - "sunken-states", - "rolling-states", - "firecanyon-states", - "training-states", - "maincave-states", - "robocave-states", - "snow-states", - "village3-states", - "lavatube-states", - "ogre-states", - "finalboss-states", - "citadel-states" - ], - "mood-h": [ - "mood-fog", - "mood-fog-table", - "mood-lights", - "mood-lights-table", - "mood-sun", - "mood-sun-table", - "mood-context" - ], - "mood-tables": [ - "make-light-kit", - "make-village1-light-kit", - "make-misty-light-kit", - "make-village2-light-kit", - "make-rolling-light-kit", - "make-village3-light-kit", - "update-mood-shadow-direction", - "update-mood-erase-color", - "update-mood-erase-color2", - "*default-interp-table*", - "*village1-palette-interp-table*", - "*misty-palette-interp-table*", - "*firecanyon-palette-interp-table*", - "*rolling-palette-interp-table*", - "*village2-sky-texture-table*", - "*finalboss-interp-table*", - "*village1-mood-fog-table*", - "*village1-mood-lights-table*", - "*village1-mood-sun-table*", - "*training-mood-fog-table*", - "*snow-mood-fog-table*", - "*snow-mood-lights-table*", - "*snow-mood-sun-table*", - "*jungleb-mood-fog-table*", - "*jungleb-mood-lights-table*", - "*jungleb-mood-sun-table*", - "*maincave-mood-fog-table*", - "*maincave-mood-lights-table*", - "*maincave-mood-sun-table*", - "*robocave-mood-fog-table*", - "*darkcave-mood-fog-table*", - "*darkcave-mood-lights-table*", - "*darkcave-mood-sun-table*", - "*misty-mood-fog-table*", - "*misty-mood-lights-table*", - "*misty-mood-sun-table*", - "*village2-mood-fog-table*", - "*village2-mood-lights-table*", - "*village2-mood-sun-table*", - "*swamp-mood-fog-table*", - "*swamp-mood-lights-table*", - "*swamp-mood-sun-table*", - "*sunken-mood-fog-table*", - "*sunken-mood-lights-table*", - "*sunken-mood-sun-table*", - "*rolling-mood-fog-table*", - "*rolling-mood-lights-table*", - "*rolling-mood-sun-table*", - "*firecanyon-mood-fog-table*", - "*firecanyon-mood-lights-table*", - "*firecanyon-mood-sun-table*", - "*ogre-mood-fog-table*", - "*ogre-mood-lights-table*", - "*ogre2-mood-lights-table*", - "*ogre3-mood-fog-table*", - "*ogre3-mood-lights-table*", - "*village3-mood-fog-table*", - "*village3-mood-lights-table*", - "*lavatube-mood-fog-table*", - "*lavatube-mood-lights-table*", - "*lavatube-mood-sun-table*", - "*finalboss-mood-sun-table*", - "*finalboss-mood-fog-table*", - "*citadel-mood-fog-table*", - "*citadel-mood-lights-table*", - "*citadel-mood-sun-table*", - "*default-mood*", - "*village1-mood*", - "*beach-mood*", - "*jungle-mood*", - "*jungleb-mood*", - "*misty-mood*", - "*firecanyon-mood*", - "*village2-mood*", - "*swamp-mood*", - "*sunken-mood*", - "*sunkenb-mood*", - "*rolling-mood*", - "*training-mood*", - "*maincave-mood*", - "*darkcave-mood*", - "*robocave-mood*", - "*snow-mood*", - "*ogre-mood*", - "*ogre2-mood*", - "*ogre3-mood*", - "*village3-mood*", - "*finalboss-mood*", - "*finalboss2-mood*", - "*lavatube-mood*", - "*citadel-mood*" - ], - "mother-spider": [ - "*mother-spider-sg*", - "mother-spider-die-wait-for-children", - "mother-spider-idle", - "*mother-spider-threads*", - "*mother-spider-leg-infos*", - "mother-spider-leg-init-by-other", - "mother-spider-hit-while-birthing", - "mother-spider-birthing", - "mother-spider-traveling", - "mother-spider-birth-baby", - "mother-spider-tracking", - "mother-spider-hit-while-tracking", - "mother-spider-spit", - "mother-spider-stop-traveling", - "mother-spider-full-joint-callback", - "mother-spider-die-from-uppercut", - "mother-spider-die", - "*mother-spider-leg-sg*", - "mother-spider-leg-flying", - "wait-for-children", - "mother-spider-default-event-handler", - "mother-spider-death-event-handler" - ], - "mother-spider-egg": [ - "*mother-spider-egg-unbroken-sg*", - "*mother-spider-egg-broken-sg*", - "mother-spider-egg-falling", - "mother-spider-egg-die-exit", - "mother-spider-egg-hatch", - "mother-spider-egg-die", - "mother-spider-egg-on-ground", - "mother-spider-egg-die-while-falling", - "mother-spider-egg-init-by-other", - "mother-spider-egg" - ], - "mother-spider-h": [ - "mother-spider-leg", - "mother-spider-thread", - "mother-spider-leg-info", - "mother-spider-history", - "mother-spider-history-array", - "mother-spider" - ], - "mother-spider-proj": [ - "mother-spider-proj-update-velocity", - "mother-spider-proj" - ], - "mspace-h": [ - "joint", - "bone-cache", - "bone", - "skeleton", - "cspace", - "cspace-array" - ], - "mud": ["ripple-for-mud", "ripple-for-small-mud", "mud"], - "muse": [ - "*muse-sg*", - "*muse-nav-enemy-info*", - "muse-idle", - "muse-check-dest-point", - "muse-caught", - "analyze-point-on-path-segment", - "muse-get-path-point", - "muse", - "point-on-path-segment-info" - ], - "nav-enemy": [ - "*nav-enemy-dummy-shadow-control*", - "nav-enemy-rnd-int-range", - "nav-enemy-initialize-jump", - "nav-enemy-neck-control-look-at", - "nav-enemy-facing-point?", - "nav-enemy-turn-to-face-point", - "nav-enemy-execute-jump", - "nav-enemy-jump-land-anim", - "nav-enemy-rnd-float-range", - "nav-enemy-common-post", - "nav-enemy-execute-custom-jump", - "nav-enemy-initialize-custom-jump", - "nav-enemy-simple-post", - "nav-enemy-fall-and-play-death-anim", - "nav-enemy-neck-control-inactive", - "nav-enemy-frustrated?", - "nav-enemy-player-at-frustration-point?", - "nav-enemy-reset-frustration", - "nav-enemy-rnd-go-idle?", - "nav-enemy-notice-player?", - "nav-enemy-turn-to-face-dir", - "nav-enemy-facing-direction?", - "nav-enemy-test-point-near-nav-mesh?", - "nav-enemy-travel-post", - "nav-enemy-get-new-patrol-point", - "nav-enemy-set-hit-from-direction", - "nav-enemy-send-attack", - "nav-enemy-rnd-int-count", - "nav-enemy-rnd-float", - "nav-enemy-rnd-percent?", - "nav-enemy-default-event-handler", - "nav-enemy-jump-event-handler", - "process-drawable-death-event-handler", - "nav-enemy-patrol-post", - "nav-enemy-chase-post", - "nav-enemy-flee-post", - "nav-enemy-face-player-post", - "nav-enemy-falling-post", - "nav-enemy-death-post", - "nav-enemy-player-vulnerable?", - "nav-enemy-facing-player?", - "nav-enemy-test-nav-mesh-intersection-xz?", - "nav-enemy-test-point-in-nav-mesh?", - "nav-enemy-set-base-collide-sphere-collide-with", - "ja-group-index?", - "nav-enemy-jump-post", - "nav-enemy-jump-land-post", - "nav-enemy-init-by-other" - ], - "nav-enemy-h": ["nav-enemy-info", "nav-enemy"], - "navigate": [ - "test-xz-point-on-line-segment?", - "ray-ccw-line-segment-intersection?", - "choose-travel-portal-vertex", - "init-ray", - "*edge-vert0-table*", - "*edge-vert1-table*", - "ray-line-segment-intersection?", - "point-triangle-distance-min", - "*edge-mask-table*", - "*nav-patch-route-table*", - "*nav-timer*", - "*nav-update-route-table-ray-count*", - "*nav-update-route-table-route-count*", - "nav-mesh-update-route-table", - "nav-mesh-lookup-route", - "nav-ray-test-local?", - "init-ray-local", - "init-ray-dir-local", - "*debug-traverse*", - "*debug-tests*", - "circle-triangle-intersection?", - "point-inside-rect?", - "recursive-inside-poly", - "point-inside-poly?", - "vu-point-triangle-intersection?", - "*color-red*", - "*color-blue*", - "*color-green*", - "*color-cyan*", - "*color-yellow*", - "*color-white*", - "*travel-timer*", - "*clip-for-spheres-timer*", - "*find-poly-timer*", - "*nav-timer-enable*", - "*nav-triangle-test-count*", - "*nav-last-triangle-test-count*", - "pke-nav-hack", - "debug-report-nav-stats", - "*debug-output*", - "*debug-nav*", - "*debug-nav-ray*", - "*debug-ray-offset*", - "*debug-nav-travel*", - "*color-black*", - "*color-gray*", - "*color-magenta*", - "*color-light-red*", - "*color-light-green*", - "*color-light-blue*", - "*color-light-cyan*", - "*color-light-magenta*", - "*color-light-yellow*", - "*color-dark-red*", - "*color-dark-green*", - "*color-dark-blue*", - "*color-dark-cyan*", - "*color-dark-magenta*", - "*color-dark-yellow*", - "*color-orange*", - "*nav-one-third*", - "inc-mod3", - "dec-mod3", - "circle-triangle-intersection-proc?", - "nav-ray-test", - "*debug-offset*", - "clip-vector-to-halfspace!", - "add-nav-sphere", - "add-collide-shape-spheres", - "circle-tangent-directions", - "find-closest-circle-ray-intersection", - "sign-bit", - "compute-dir-parm", - "*debug-ray-test*", - "*debug-ray-test-capture-mode*", - "*debug-ray-test-capture-output*", - "*test-ray-start-poly-id*", - "*test-ray-src-pos*", - "*test-ray-dest-pos*", - "debug-nav-validate-current-poly", - "start-collect-nav", - "end-collect-nav", - "nav-sphere-from-cam", - "cfs-travel-vec", - "cfs-work", - "nav-control-cfs-work" - ], - "navigate-h": [ - "nav-mesh-connect", - "process-level-heap", - "*default-nav-mesh*", - "has-nav-mesh?", - "nav-poly", - "nav-vertex", - "nav-sphere", - "nav-ray", - "nav-route-portal", - "clip-travel-vector-to-mesh-return-info", - "nav-node", - "nav-lookup-elem", - "nav-mesh", - "check-vector-collision-with-nav-spheres-info", - "nav-gap-info", - "nav-control" - ], - "ocean": [ - "*ocean-map*", - "ocean-interp-wave", - "ocean-generate-verts", - "*swamp-low-ocean-marker*", - "draw-ocean-texture", - "ocean-init-buffer", - "draw-ocean-far", - "draw-ocean-mid", - "ocean-end-buffer", - "draw-ocean-near", - "init-ocean-far-regs", - "render-ocean-far", - "render-ocean-quad", - "draw-large-polygon-ocean", - "draw-ocean", - "update-ocean" - ], - "ocean-frames": ["*ocean-wave-frames*"], - "ocean-h": [ - "*ocean-work*", - "*ocean-facing*", - "*ocean-off*", - "*ocean-mid-off*", - "*ocean-near-off*", - "*ocean-heights*", - "*ocean-verts*", - "ocean-corner", - "ocean-wave-info", - "ocean-vertex", - "ocean-spheres", - "ocean-colors", - "ocean-mid-mask", - "ocean-mid-indices", - "ocean-mid-masks", - "ocean-trans-mask", - "ocean-trans-index", - "ocean-trans-indices", - "ocean-near-index", - "ocean-near-indices", - "ocean-near-colors", - "ocean-map", - "ocean-trans-strip", - "ocean-trans-strip-array", - "ocean-wave-data", - "ocean-wave-frames", - "ocean-work", - "ocean-vu0-work", - "ocean-texture-constants", - "ocean-texture-work", - "ocean-mid-vertex", - "ocean-mid-constants", - "ocean-mid-upload", - "ocean-mid-upload2", - "ocean-mid-work", - "ocean-near-constants", - "ocean-near-upload", - "ocean-near-vertex", - "ocean-near-work" - ], - "ocean-mid": [ - "ocean-mid-block", - "ocean-mid-add-constants", - "ocean-mid-add-call", - "ocean-mid-add-upload", - "ocean-mid-add-call-flush", - "draw-ocean-transition", - "draw-ocean-mid-seams", - "ocean-seams-add-constants", - "ocean-mid-add-upload-top", - "ocean-mid-add-upload-bottom", - "ocean-mid-add-upload-middle", - "ocean-mid-camera-masks-bit?", - "ocean-mid-mask-ptrs-bit?", - "ocean-mid-add-upload-table", - "ocean-mid-camera-masks-set!", - "ocean-mid-add-matrices", - "ocean-mid-check", - "ocean-matrix*!", - "ocean-mid-setup-constants", - "ocean-vector-matrix*!" - ], - "ocean-near": [ - "ocean-near-block", - "ocean-near-add-constants", - "ocean-near-add-heights", - "ocean-near-add-call", - "ocean-near-add-upload", - "ocean-near-add-matrices", - "ocean-near-setup-constants", - "ocean-near-add-call-flush" - ], - "ocean-tables": [ - "*ocean-spheres-village1*", - "*ocean-colors-village1*", - "*ocean-near-indices-village1*", - "*ocean-trans-indices-village1*", - "*ocean-mid-indices-village1*", - "*ocean-mid-masks-village1*", - "*ocean-spheres-village2*", - "*ocean-colors-village2*", - "*ocean-near-indices-village2*", - "*ocean-trans-indices-village2*", - "*ocean-mid-indices-village2*", - "*ocean-mid-masks-village2*", - "*ocean-near-indices-sunken*", - "*ocean-trans-indices-sunken*", - "*ocean-mid-indices-sunken*", - "*ocean-mid-masks-sunken*", - "*ocean-map-village1*", - "*ocean-map-village2*", - "*ocean-map-sunken*" - ], - "ocean-texture": [ - "ocean-texture-vu1-block", - "ocean-texture-add-constants", - "ocean-texture-add-envmap", - "ocean-texture-add-verts", - "ocean-texture-add-call-start", - "ocean-texture-add-call-rest", - "ocean-texture-add-verts-last", - "ocean-texture-add-call-done", - "*ocean-texture-work*", - "ocean-texture-setup-constants" - ], - "ocean-trans-tables": [ - "*ocean-left-table*", - "*ocean-right-table*", - "*ocean-up-table*", - "*ocean-down-table*", - "*ocean-down-left-table*", - "*ocean-down-right-table*", - "*ocean-up-right-table*", - "*ocean-up-left-table*", - "*ocean-trans-left-table*", - "*ocean-trans-right-table*", - "*ocean-trans-up-table*", - "*ocean-trans-down-table*", - "*ocean-trans-down-left-table*", - "*ocean-trans-down-right-table*", - "*ocean-trans-up-right-table*", - "*ocean-trans-up-left-table*", - "*ocean-trans-corner-table*", - "*ocean-trans-strip-array*", - "*ocean-trans-st-table*" - ], - "ocean-transition": [ - "ocean-make-trans-camera-masks", - "ocean-trans-add-upload-strip", - "ocean-trans-add-constants", - "draw-ocean-transition-seams", - "ocean-trans-camera-masks-bit?", - "ocean-trans-add-upload", - "ocean-trans-mask-ptrs-bit?", - "ocean-trans-add-upload-table", - "ocean-transition-check", - "ocean-trans-mask-ptrs-set!" - ], - "ocean-vu0": ["*ocean-vu0-work*", "ocean-vu0-block"], - "ogre-obs": [ - "*shortcut-boulder-whole-sg*", - "*shortcut-boulder-broken-sg*", - "shortcut-boulder-idle", - "shortcut-boulder-break", - "ripple-for-ogre-lava", - "*ogre-bridgeend-sg*", - "ogre-bridgeend-idle", - "*ogre-bridge-sg*", - "*ogre-bridge-joint-array*", - "ogre-bridge-update-joints", - "ogre-bridge-activated", - "ogre-bridge-idle", - "ogre-bridge-break", - "ogre-bridge-activate", - "*ogre-isle-d-sg*", - "*ogre-isle-b-sg*", - "*ogre-isle-constants*", - "*ogre-step-b-sg*", - "*ogre-step-c-sg*", - "*ogre-step-a-sg*", - "*ogre-step-constants*", - "*tntbarrel-sg*", - "*med-res-snow-sg*", - "*ogre-isle-a-sg*", - "*ogre-isle-c-sg*", - "tntbarrel", - "ogre-plat", - "ogre-step", - "ogre-step-a", - "ogre-step-b", - "ogre-step-c", - "ogre-step-d", - "ogre-isle", - "ogre-isle-b", - "ogre-isle-c", - "ogre-isle-d", - "ogre-bridge", - "ogre-bridgeend", - "ogre-lava", - "shortcut-boulder" - ], - "ogre-part": ["ogre-part"], - "ogreboss": [ - "*ogreboss-sg*", - "ogreboss-get-targets", - "*ogreboss*", - "ogreboss-dead", - "ogreboss-idle", - "ogreboss-reset-camera", - "ogreboss-trigger-steps", - "ogreboss-die", - "ogreboss-stage1", - "ogreboss-submerge", - "ogreboss-post", - "ogreboss-spawn-super-boulder", - "ogreboss-update-shuffling", - "ogreboss-stage3-throw", - "ogreboss-player-inside-range?", - "ogreboss-super-boulder", - "ogreboss-super-boulder-init-by-other", - "ogreboss-set-stage2-camera", - "ogreboss-move-far", - "ogreboss-roll-boulder", - "ogreboss-stage3-shuffle", - "ogreboss-stage3-hit", - "ogreboss-update-super-boulder", - "ogreboss-blend-hit-anim", - "ogreboss-bounce-boulder", - "ogreboss-bounce-boulder-init-by-other", - "ogreboss-set-stage1-camera", - "ogreboss-move-near", - "ogreboss-shoot-boulder", - "ogreboss-inc-try-count", - "ogreboss-stage2", - "ogreboss-emerge", - "ogreboss-pick-target", - "ogreboss-missile", - "ogreboss-missile-init-by-other", - "ogreboss-idle-loop", - "*ogreboss-cam-sg*", - "ogreboss-wait-for-player", - "ogreboss-intro", - "*ogreboss-column-sg*", - "*ogreboss-bounce-boulder-sg*", - "ogreboss-bounce-boulder-idle", - "*ogreboss-super-boulder-sg*", - "ogreboss-super-boulder-idle", - "ogreboss-super-boulder-impact-effect", - "ogreboss-super-boulder-roll", - "ogreboss-super-boulder-play-hit-anim", - "ogreboss-rock-explosion-effect", - "ogreboss-super-boulder-land", - "ogreboss-super-boulder-throw", - "ogreboss-super-boulder-hit", - "ogreboss-super-boulder-die", - "ogreboss-super-boulder-killed-player", - "*ogreboss-shoot-boulder-sg*", - "*ogreboss-missile-shadow-control*", - "ogreboss-missile-idle", - "*ogreboss-shoot-boulder-break-sg*", - "ogreboss-missile-impact", - "*ogreboss-shadow-control*", - "ogreboss-missile-seek", - "ogreboss-missile-scale-explosion", - "ogreboss-missile-init-data", - "ogreboss-super-boulder-event-handler", - "ogreboss-bounce-boulder-event-handler", - "ogreboss", - "ogreboss-debug-adjust-difficulty", - "ogreboss-attack-event-handler" - ], - "oracle": ["*oracle-sg*", "oracle"], - "orb-cache": [ - "*orb-cache-top-sg*", - "orb-cache-top-complete", - "orb-cache-top-activate", - "orb-cache-top-idle", - "orb-cache-top" - ], - "orbit-plat": [ - "*orbit-plat-sg*", - "orbit-plat-bottom-init-by-other", - "orbit-plat-wait-for-other", - "orbit-plat-idle", - "orbit-plat-riding", - "orbit-plat-rotating", - "get-rotate-point!", - "get-nav-point!", - "orbit-plat-still", - "orbit-plat-reset", - "*orbit-plat-bottom-sg*", - "orbit-plat-bottom-idle", - "orbit-plat-bottom", - "orbit-plat" - ], - "pad": [ - "cpad-set-buzz!", - "*cpad-list*", - "cpad-get-data", - "get-current-time", - "get-integral-current-time", - "*cpad-debug*", - "cpad-invalid!", - "cpad-open", - "*cheat-mode*", - "analog-input", - "service-cpads", - "buzz-stop!", - "hw-cpad", - "cpad-info", - "cpad-list" - ], - "part-tester": [ - "part-tester", - "*debug-part-dead-pool*", - "part-tester-init-by-other", - "*part-tester*", - "part-tester-idle", - "*part-tester-name*", - "start-part" - ], - "pat-h": [ - "pat-material->string", - "pat-mode->string", - "pat-event->string", - "*pat-mode-info*", - "pat-surface", - "pat-mode-info" - ], - "path-h": ["string->symbol", "path-control", "curve-control"], - "pelican": [ - "*pelican-sg*", - "pelican-wait-at-end", - "pelican-wait-at-nest", - "pelican-circle", - "pelican-fly", - "pelican-path-update", - "zero-func", - "*PELICAN-bank*", - "pelican-dive", - "pelican-post", - "pelican-from-nest", - "pelican-explode", - "pelican-spit", - "pelican-fly-to-end", - "pelican-to-nest", - "pelican-bank", - "pelican" - ], - "plant-boss": [ - "*plant-boss-sg*", - "*plant-boss-shadow-control*", - "plant-boss-arm", - "plant-boss-arm-init", - "plant-boss-back-arms-init", - "plant-boss-vine-init", - "plant-boss-root-init", - "plant-boss-leaf", - "plant-boss-leaf-init", - "plant-boss-dead", - "plant-boss-far-idle", - "plant-boss-dead-idle", - "plant-boss-dead-bounce", - "plant-boss-generic-event-handler", - "plant-boss-post", - "plant-boss-spawn", - "plant-boss-attack", - "plant-boss-idle", - "plant-boss-reset", - "plant-boss-default-event-handler", - "plant-boss-hit", - "plant-boss-vulnerable", - "plant-boss-intro", - "*plant-boss-leaf-sg*", - "plant-boss-leaf-idle", - "plant-boss-leaf-die", - "plant-boss-leaf-open-idle", - "plant-boss-leaf-close", - "plant-boss-leaf-bounce", - "plant-boss-leaf-open", - "*plant-boss-root-sg*", - "plant-boss-root-idle", - "*plant-boss-vine-sg*", - "plant-boss-vine-idle", - "*plant-boss-back-arms-sg*", - "plant-boss-back-arms-idle", - "*plant-boss-arm-sg*", - "plant-boss-arm-idle", - "plant-boss-root-die", - "plant-boss-vine-die", - "plant-boss-vine-hit", - "plant-boss-back-arms-hit", - "plant-boss-back-arms-die", - "plant-boss-arm-die", - "plant-boss-arm-hit", - "plant-boss-eat", - "plant-boss" - ], - "plat": ["*plat-jungleb-sg*", "*plat-sunken-sg*", "*plat-sg*", "plat"], - "plat-button": [ - "*plat-button-sg*", - "plat-button-camera-off", - "plat-button-camera-on", - "plat-button" - ], - "plat-eco": ["*plat-eco-lit-sg*", "*plat-eco-unlit-sg*", "plat-eco"], - "plat-flip": ["*plat-flip-sg*", "plat-flip-idle", "plat-flip"], - "pov-camera": ["pov-camera-play-and-reposition"], - "pov-camera-h": ["pov-camera"], - "powerups": ["eco-blue-glow", "cloud-track"], - "process-drawable": [ - "process-entity-status!", - "process-grab?", - "process-release?", - "ja-post", - "make-nodes-from-jg", - "dma-add-process-drawable", - "add-process-drawable", - "*valid-con*", - "vector<-cspace+vector!", - "cspace-children", - "cspace-inspect-tree", - "*default-skel-template*", - "fill-skeleton-cache", - "execute-math-engine", - "draw-joint-spheres", - "process-drawable-idle", - "anim-loop", - "ja-done?", - "ja-min?", - "ja-max?", - "ja-num-frames", - "ja-frame-num", - "ja-aframe", - "ja-speed", - "ja-step", - "ja-group-size", - "ja-eval", - "ja-blend-eval", - "transform-post", - "rider-trans", - "rider-post", - "pusher-post", - "process-drawable-delay-player", - "process-drawable-fuel-cell-handler", - "process-drawable-birth-fuel-cell", - "process-drawable-valid?" - ], - "process-drawable-h": [ - "joint-control-reset!", - "cspace-index-by-name", - "cspace-by-name", - "cspace-by-name-no-fail", - "cspace-index-by-name-no-fail", - "num-func-none", - "num-func-+!", - "num-func--!", - "num-func-loop!", - "num-func-seek!", - "num-func-blend-in!", - "num-func-chan", - "num-func-identity" - ], - "process-taskable": [ - "othercam-running", - "othercam-calc", - "vector-for-ambient", - "hide-hud", - "hud-hidden?", - "process-taskable-clean-up-after-talking", - "process-taskable-hide-exit", - "process-taskable-play-anim-code", - "process-taskable-play-anim-trans", - "process-taskable-anim-loop", - "process-taskable-play-anim-enter", - "process-taskable-play-anim-exit", - "process-taskable-hide-handler", - "process-taskable-hide-enter" - ], - "progress": [ - "progress-normal", - "progress-going-out", - "progress-gone", - "*progress-state*", - "get-next-task-up", - "get-next-level-up", - "get-next-level-down", - "get-next-task-down", - "*progress-save-info*", - "progress-coming-in", - "make-levels-with-tasks-available-to-progress", - "*progress-stack*", - "progress-init-by-other", - "init-game-options", - "progress-waiting", - "progress-global-state", - "make-current-level-available-to-progress", - "progress-debug" - ], - "progress-draw": [ - "adjust-pos", - "draw-percent-bar", - "print-language-name", - "hide-progress-icons" - ], - "progress-h": [ - "*progress-process*", - "*progress-last-task-index*", - "count-info", - "game-count-info", - "task-info-data", - "level-tasks-info", - "game-option", - "progress" - ], - "progress-part": [ - "part-progress-hud-left-func", - "part-progress-hud-right-func", - "part-progress-hud-orb-func", - "part-progress-hud-buzzer-func", - "part-progress-hud-button-func", - "part-progress-hud-tint-func", - "part-progress-card-slot-01-func", - "part-progress-card-slot-02-func", - "part-progress-card-slot-03-func", - "part-progress-card-slot-04-func", - "part-progress-card-cell-func", - "part-progress-save-icon-func", - "fuel-cell-progress-hud-orbit-callback" - ], - "progress-static": [ - "*main-options*", - "*title*", - "*options*", - "*main-options-demo*", - "*main-options-demo-shared*", - "*game-options*", - "*game-options-japan*", - "*game-options-demo*", - "*graphic-options*", - "*graphic-title-options-pal*", - "*sound-options*", - "*yes-no-options*", - "*ok-options*", - "*load-options*", - "*save-options*", - "*save-options-title*", - "*options-remap*", - "*language-name-remap*", - "*task-egg-starting-x*", - "*game-counts*" - ], - "projectiles": [ - "projectile-collision-reaction", - "projectile-update-velocity-space-wars", - "find-nearest-attackable", - "find-ground-and-draw-shadow", - "*search-info*", - "spawn-projectile-blue", - "search-info" - ], - "projectiles-h": ["projectile", "projectile-yellow", "projectile-blue"], - "prototype-h": [ - "prototype-bucket", - "prototype-bucket-shrub", - "prototype-inline-array-shrub", - "prototype-array-shrub-info", - "prototype-bucket-tie", - "prototype-array-tie", - "proxy-prototype-array-tie", - "instance" - ], - "pskernel": [ - "deinstall-debug-handlers", - "return-from-exception", - "kernel-set-exception-vector", - "kernel-write", - "install-debug-handler", - "kernel-copy-function", - "kernel-copy-to-kernel-ram", - "kernel-write-function", - "kernel-read-function", - "kernel-read", - "kernel-check-hardwired-addresses", - "install-default-debug-handler", - "kernel-set-interrupt-vector", - "kernel-set-level2-vector", - "deinstall-debug-handler", - "resend-exception", - "lowmemmap" - ], - "puffer": [ - "*puffer-sg*", - "*puffer-mean-sg*", - "puffer-idle", - "puffer-patrol", - "puffer-attack", - "puffer-die", - "puffer-default-event-handler", - "puffer-post", - "puffer", - "pick-patrol-point-away-from-buddy-work" - ], - "qbert-plat": [ - "qbert-plat-master-wait-for-door", - "qbert-plat-master-idle", - "qbert-plat-master-do-door", - "qbert-plat-wait-for-master", - "*qbert-plat-sg*", - "*qbert-plat-constants*", - "qbert-plat-on-init-by-other", - "*qbert-plat-on-sg*", - "qbert-plat-on-mimic", - "qbert-plat-on-die", - "qbert-plat-event-handler", - "qbert-plat-on", - "qbert-plat", - "qbert-plat-master" - ], - "quaternion": [ - "quaternion->matrix", - "quaternion-vector-angle!", - "vector-xz-length", - "vector-xz-normalize!", - "quaternion-from-two-vectors-max-angle!", - "vector-z-quaternion!", - "quaternion-normalize!", - "quaternion*!", - "acos", - "vector-x-quaternion!", - "quaternion-y-angle", - "vector-rad<-vector-deg/2!", - "vector-sincos-rad!", - "quaternion-dot", - "atan-series-rad", - "vector-sin-rad!", - "vector-length", - "sincos-rad!", - "quaternion-vector-len", - "atan2-rad", - "matrix->quaternion", - "quaternion-float*!", - "acos-rad", - "quaternion-norm", - "quaternion-axis-angle!", - "vector-angle<-quaternion!", - "quaternion-zero!", - "quaternion-identity!", - "quaternion-i!", - "quaternion-j!", - "quaternion-k!", - "quaternion-copy!", - "quaternion-set!", - "quaternion+!", - "quaternion-!", - "quaternion-negate!", - "quaternion-conjugate!", - "quaternion-float/!", - "quaternion-norm2", - "quaternion-inverse!", - "quaternion-right-mult-matrix!", - "quaternion-left-mult-matrix!", - "matrix-with-scale->quaternion", - "quaternion-log!", - "quaternion-exp!", - "quaternion-slerp!", - "quaternion-pseudo-slerp!", - "quaternion-zxy!", - "vector-y-quaternion!", - "quaternion-vector-y-angle", - "quaternion-rotate-local-x!", - "quaternion-rotate-local-y!", - "quaternion-rotate-local-z!", - "quaternion-rotate-y!", - "quaternion-rotate-x!", - "quaternion-rotate-z!", - "quaternion-delta-y", - "quaternion-rotate-y-to-vector!", - "vector-rotate-y!", - "vector-x-angle", - "quaterion<-rotate-y-vector", - "quaternion-validate", - "quaternion-xz-angle" - ], - "quaternion-h": ["*unity-quaternion*", "quaternion"], - "quicksandlurker": [ - "*quicksandlurker-sg*", - "quicksandlurker-idle", - "orient-to-face-target", - "quicksandlurker-track", - "quicksandlurker-wait", - "quicksandlurker-popup", - "quicksandlurker-spit", - "spawn-quicksandlurker-missile", - "quicksandlurker-attack", - "quicksandlurker-check-hide-transition", - "quicksandlurker-hide", - "inc-angle", - "quicksandlurker-die", - "quicksandlurker-victory", - "quicksandlurker-missile-init-by-other", - "quicksandlurker-missile-idle", - "quicksandlurker-missile-impact", - "get-height-over-navmesh!", - "intersects-nav-mesh?", - "quicksandlurker-default-event-handler", - "quicksandlurker-post", - "quicksandlurker-yawn", - "quicksandlurker-missile", - "quicksandlurker-missile-init-data", - "quicksandlurker" - ], - "racer": [ - "*racer-sg*", - "*racer-shadow-control*", - "blocking-plane-spawn", - "racer-effect", - "blocking-plane-destroy", - "*racer-explode-sg*", - "racer" - ], - "racer-part": [ - "zoomer-heat-slice-color", - "part-hud-racer-speed-func", - "part-hud-racer-heat-func", - "part-hud-zoomer-heat-slice-01-func", - "part-hud-zoomer-heat-slice-02-func", - "part-hud-zoomer-heat-slice-03-func", - "hud-bike-heat", - "hud-bike-speed" - ], - "racer-states-L1-RACERP": [ - "target-racing", - "target-racing-grab", - "target-racing-clone-anim", - "target-racing-get-off-hit-ground", - "target-racing-get-off-jump", - "target-racing-death", - "target-racing-smack-check", - "target-racing-jump", - "target-racing-bounce", - "target-racing-falling", - "target-racing-get-on", - "target-racing-get-off", - "target-racing-hit" - ], - "ramdisk": [ - "*ramdisk-rpc*", - "*current-ramdisk-id*", - "ramdisk-load", - "ramdisk-sync", - "ramdisk-rpc-fill", - "ramdisk-rpc-load", - "ramdisk-rpc-load-to-ee" - ], - "res": ["*res-static-buf*", "uinteger", "part-group-pointer?"], - "res-h": ["*res-key-string*", "res-tag", "res-lump"], - "rigid-body": [ - "*rigid-body-platform-constants*", - "matrix-3x3-triple-transpose-product", - "rigid-body-platform-event-handler", - "rigid-body-platform-post", - "rigid-body-platform-constants", - "rigid-body-control-point-inline-array", - "rigid-body-platform" - ], - "rigid-body-h": ["rigid-body", "rigid-body-control-point"], - "ripple": [ - "ripple-update-waveform-offs", - "ripple-slow-add-sine-waves", - "*ripple-globals*", - "ripple-execute-init", - "ripple-create-wave-table", - "ripple-apply-wave-table", - "ripple-make-request", - "ripple-execute", - "ripple-matrix-scale", - "ripple-add-debug-sphere", - "ripple-find-height", - "ripple-request", - "ripple-globals" - ], - "robocave-part": ["robocave-part"], - "robotboss": [ - "robotboss-blue-wait", - "robotboss-blue-dark-bomb", - "robotboss-always-trans", - "robotboss-shooting-trans", - "robotboss-blue-done", - "*robotboss-blueeco-sg*", - "robotboss-blue-beam", - "robotboss-position", - "robotboss-cut-cam", - "robotboss-set-dda", - "robotboss-cut-cam-exit", - "robotboss-setup-for-hits", - "robotboss-yellow-eco-on", - "robotboss-yellow-eco-off", - "robotboss-blue-dark-bomb-wait", - "robotboss-green", - "robotboss-green-wait", - "robotboss-green-dark-bomb", - "robotboss-greenshot", - "robotboss-handler", - "robotboss-green-dark-bomb-wait", - "robotboss-darkecobomb", - "robotboss-red", - "robotboss-red-wait", - "robotboss-is-red-hit", - "robotboss-redshot-fill-array", - "robotboss-redshot", - "robotboss-red-dark-bomb", - "*robotboss-redeco-sg*", - "robotboss-red-dark-bomb-wait", - "robotboss-yellow", - "robotboss-yellow-wait", - "robotboss-time-to-shoot-yellow", - "robotboss-is-yellow-hit", - "robotboss-yellowshot", - "robotboss-yellow-dark-bomb", - "*robotboss-yelloweco-sg*", - "robotboss-white-eco-movie", - "robotboss-daxter-sacrifice-movie", - "robotboss-yellow-dark-bomb-wait", - "robotboss-bomb-handler", - "robotboss-anim-blend-loop", - "redshot-launch-info", - "redshot-launch-array" - ], - "robotboss-h": ["robotboss-dda", "robotboss", "target-has-all-the-cells?"], - "robotboss-misc": [ - "*finalbosscam-sg*", - "robotboss-manipy-trans-hook", - "*silodoor-sg*", - "*ecoclaw-sg*", - "*ecoclaw*", - "ecoclaw-idle", - "ecoclaw-activate", - "ecoclaw-beam-particle-callback", - "*med-res-snow1-sg*", - "ecoclaw-handler", - "finalbosscam-init-by-other", - "ecoclaw-part-info", - "ecoclaw", - "silodoor", - "finalbosscam" - ], - "robotboss-weapon": [ - "*redring-sg*", - "arcing-shot-setup", - "yellowshot-idle", - "arcing-shot-calculate", - "redshot-idle", - "redshot-trans", - "redshot-wait", - "redshot-explode", - "redshot-particle-callback", - "*greenshot-sg*", - "greenshot-idle", - "*darkecobomb-sg*", - "darkecobomb-idle", - "darkecobomb-land", - "darkecobomb-explode-if-player-high-enough", - "darkecobomb-countdown", - "darkecobomb-explode", - "arcing-shot-draw", - "arcing-shot-debug-trajectory", - "darkecobomb-handler", - "darkecobomb-init-by-other", - "greenshot-init-by-other", - "redshot-handler", - "redshot-init-by-other", - "yellowshot-init-by-other", - "torus", - "torus-verts", - "arcing-shot", - "darkecobomb", - "greenshot", - "redshot", - "yellowshot" - ], - "rolling-lightning-mole": [ - "*lightning-mole-sg*", - "peeper-up", - "peeper-down", - "peeper-hide", - "peeper-wait", - "*lightning-mole-nav-enemy-info*", - "lightning-mole-gone", - "lightning-mole-hiding", - "lightning-mole-yelp", - "*lightning-mole-hole*", - "lightning-mole-head-for-hole", - "lightning-mole-dive", - "lightning-mole-task-complete?", - "fleeing-nav-enemy-clip-travel", - "fleeing-nav-enemy-adjust-travel", - "fleeing-nav-enemy-chase-post-func", - "lightning-mole-debug-run", - "fleeing-nav-enemy-debug", - "fleeing-nav-enemy-adjust-nav-info", - "find-adjacent-bounds-one", - "find-adjacent-bounds", - "fleeing-nav-enemy-chase-post", - "lightning-mole-hole-post", - "lightning-mole-run-code", - "lightning-mole-debug-blend", - "check-drop-level-rolling-dirt", - "check-drop-level-rolling-dirt-finish", - "fleeing-nav-enemy-info", - "fleeing-nav-enemy", - "lightning-mole", - "peeper" - ], - "rolling-obs": [ - "ripple-for-rolling-water", - "gorge-init", - "gorge-start-idle", - "gorge-in-front", - "gorge-start-ready", - "gorge-start-launch-start-banner", - "gorge-trans", - "gorge-start-draw-time", - "gorge-behind", - "gorge-start-racing", - "seconds->race-time", - "race-time-read", - "rolling-start-init-by-other", - "gorge-finish-init-by-other", - "gorge-abort-init-by-other", - "gorge-start-race-finished", - "gorge-start-race-aborted", - "race-time->string", - "race-time-less-than", - "race-time-save", - "gorge-finish-idle", - "gorge-abort-idle", - "*rolling-start-whole-sg*", - "*rolling-start-broken-sg*", - "rolling-start-whole", - "rolling-start-break", - "*happy-plant-sg*", - "happy-plant-opened", - "happy-plant-init", - "dark-plants-all-done", - "happy-plant-opening", - "*rollingcam-sg*", - "*dark-plant-sg*", - "dark-plant-randomize", - "dark-plant-gone", - "dark-plant-startup", - "dark-plant-idle", - "dark-plant-sprout", - "dark-plant-check-target", - "dark-plant-has-bad-neighbor", - "dark-plant-death", - "pusher-base-init", - "*pusher-sg*", - "gorge-pusher-idle", - "pusher-idle", - "dark-plant-trans", - "race-time-copy!", - "race-time->seconds", - "rolling-part", - "rollingcam", - "pusher-base", - "pusher", - "gorge-pusher", - "dark-plant", - "happy-plant", - "race-time", - "rolling-start", - "gorge", - "gorge-start", - "gorge-finish", - "gorge-abort", - "rolling-water" - ], - "rolling-race-ring": [ - "*race-ring-sg*", - "first-ring?", - "race-ring-active", - "race-ring-wait", - "last-ring?", - "race-ring-idle", - "race-ring-blue-set-particle-rotation-callback", - "race-ring-set-particle-rotation-callback", - "race-ring" - ], - "rolling-robber": [ - "*robber-sg*", - "robber-find-ground", - "robber-die", - "robber-dead", - "robber-initial", - "robber-initial-notice", - "robber-move", - "robber-calc-speed", - "robber-rotate", - "robber-flee", - "robber-calc-anim-speed", - "robber-got-away", - "robber-tired", - "robber-idle", - "robber-task-complete?", - "fuel-cell-init-as-spline-slider", - "fuel-cell-spline-slider", - "robber-event-handler", - "robber-debug", - "robber" - ], - "ropebridge": [ - "*ropebridge-tunings*", - "ropebridge-joint-callback", - "ropebridge-idle", - "*ropebridge-70-rest-state*", - "*ropebridge-52-rest-state*", - "*ropebridge-32-rest-state*", - "*ropebridge-36-rest-state*", - "*ropebridge-32-sg*", - "*snow-bridge-36-sg*", - "*ropebridge-52-sg*", - "*ropebridge-70-sg*", - "*ropebridge-36-sg*", - "*vil3-bridge-36-sg*", - "ropebridge-tuning", - "ropebridge-spring-point", - "ropebridge" - ], - "rpc-h": ["rpc-busy?", "rpc-call", "rpc-buffer", "rpc-buffer-pair"], - "sage": ["*sage-sg*", "sage"], - "sage-bluehut": ["*sage-bluehut-sg*", "assistant-bluehut", "sage-bluehut"], - "sage-finalboss-FIN": [ - "*sage-finalboss-sg*", - "sage-finalboss-extra-enter", - "sage-finalboss-extra-trans", - "sage-finalboss-credits", - "sage-finalboss-credit-particle", - "*jak-white-sg*", - "*robotboss-cinematic-sg*", - "*plat-eco-finalboss-lit-sg*", - "*plat-eco-finalboss-unlit-sg*", - "plat-eco-finalboss", - "sage-finalboss-particle", - "sage-finalboss" - ], - "sage-finalboss-part": [ - "check-drop-level-eichar-lighteco-pops", - "check-drop-level-bigdoor-open-pops" - ], - "sage-village3": [ - "*sage-village3-sg*", - "*evilbro-village3-sg*", - "*evilsis-village3-sg*", - "sage-villagec" - ], - "sculptor": [ - "*sculptor-sg*", - "muse-to-idle", - "*sculptor-muse-sg*", - "sculptor" - ], - "seagull": [ - "seagull-init-by-other", - "sound-seagull-squall", - "seagullflock-idle", - "seagullflock-at-waterfall", - "aybabtu", - "seagull-reaction", - "*seagull-sg*", - "seagull-idle", - "seagull-soaring", - "seagull-flying", - "seagull-landing", - "*seagull-boxes*", - "seagull-takeoff", - "seagull-post", - "beach-rock-trigger", - "seagull", - "seagullflock" - ], - "sequence-a-village1": [ - "sequenceA-village1-init-by-other", - "sequenceA-village1-trans-hook", - "*sidekick-human-sg*", - "sequenceA-village1" - ], - "settings": [ - "set-aspect-ratio", - "set-video-mode", - "scf-get-volume", - "scf-get-language", - "scf-get-aspect", - "*boot-video-mode*" - ], - "settings-h": ["setting-data", "setting-control", "scf-time"], - "shadow": [ - "compute-and-draw-shadow", - "draw-shadow", - "add-fake-shadow-to-buffer", - "swap-fake-shadow-buffers" - ], - "shadow-cpu": [ - "shadow-vu0-upload", - "shadow-vu1-init-buffer", - "shadow-dma-init", - "shadow-execute", - "shadow-dma-end", - "shadow-vu0-block", - "*shadow-data*", - "shadow-xform-verts", - "shadow-calc-dual-verts", - "shadow-scissor-edges", - "shadow-scissor-top", - "shadow-init-vars", - "shadow-find-facing-single-tris", - "shadow-find-single-edges", - "shadow-find-facing-double-tris", - "shadow-find-double-edges", - "shadow-add-verts", - "shadow-add-facing-single-tris", - "shadow-add-single-edges", - "shadow-add-double-tris", - "shadow-add-double-edges", - "shadow-execute-all", - "shadow-stats", - "shadow-dcache" - ], - "shadow-cpu-h": [ - "shadow-queue-append", - "shadow-queue-reset", - "*shadow-queue*", - "*shadow*", - "*shadow-object*", - "*shadow-debug*", - "shadow-settings", - "shadow-control", - "shadow-data", - "shadow-work", - "shadow-run", - "shadow-queue", - "shadow-vertex", - "shadow-matrix-ref", - "shadow-edge", - "shadow-tri", - "shadow-header", - "shadow-geo" - ], - "shadow-h": [ - "*fake-shadow-buffer-1*", - "*fake-shadow-buffer-2*", - "*fake-shadow-buffer*", - "fake-shadow", - "fake-shadow-buffer" - ], - "shadow-vu1": [ - "shadow-vu1-block", - "shadow-vu1-add-constants", - "shadow-vu1-add-matrix", - "*shadow-vu1-tri-template*", - "shadow-vu1-constants", - "shadow-vu1-gifbuf-template" - ], - "sharkey": [ - "*sharkey-sg*", - "*sharkey-nav-enemy-info*", - "sharkey-get-player-position", - "sharkey-follow-trajectory", - "sharkey-reset-position", - "sharkey-notice-player?", - "sharkey-move-to-attack-position", - "sharkey" - ], - "shover": ["*shover-sg*", "*shover*", "shover-idle", "shover"], - "shrubbery": [ - "upload-generic-shrub", - "shrub-num-tris", - "shrub-init-frame", - "shrub-upload-model", - "shrub-do-init-frame", - "shrub-vu1-block", - "shrub-upload-view-data", - "shrub-init-view-data", - "mem-usage-shrub-walk", - "shrub-make-perspective-matrix", - "shrub-time", - "draw-inline-array-instance-shrub", - "draw-prototype-inline-array-shrub", - "shrub-upload-test", - "test-func" - ], - "shrubbery-h": [ - "shrubbery-login-post-texture", - "*shrub-state*", - "billboard", - "shrub-view-data", - "shrubbery", - "instance-shrubbery", - "drawable-inline-array-instance-shrub", - "drawable-tree-instance-shrub", - "generic-shrub-fragment", - "prototype-shrubbery", - "prototype-trans-shrubbery", - "prototype-generic-shrub", - "shrubbery-matrix", - "shrub-near-packet", - "instance-shrub-work", - "instance-shrub-dma" - ], - "sidekick": [ - "*sidekick-sg*", - "cspace<-cspace+quaternion!", - "sidekick-clone", - "*sidekick-remap*", - "starts" - ], - "sidekick-human": [ - "sequenceC-trans-hook", - "*darkecocan-sg*", - "sequenceC-can-trans-hook", - "*darkecocan-glow-sg*", - "sequenceC-can-trans-hook-2", - "*lurker-army*", - "*evilbro-sg*", - "evilsib-trans-hook-wait", - "*evilsis-sg*", - "evilsib-trans-hook-hover", - "sequenceA", - "sequenceB", - "sequenceC", - "army-info" - ], - "sky": [ - "sky-vu1-block", - "sky-add-frame-data", - "sky-make-sun-data", - "sky-make-moon-data", - "sky-make-light", - "sky-init-upload-data", - "sky-upload", - "sky-draw", - "sky-frame-data" - ], - "sky-h": [ - "*sky-parms*", - "*sky-upload-data*", - "*sky-drawn*", - "*cloud-drawn*", - "sky-color-hour", - "sky-color-day", - "sky-circle-data", - "sky-sun-data", - "sky-moon-data", - "sky-orbit", - "sky-upload-data", - "sky-parms", - "sky-tng-data", - "sky-work", - "sky-vertex" - ], - "sky-tng": [ - "copy-sky-texture", - "copy-cloud-texture", - "*sky-work*", - "init-sky-regs", - "*sky-tng-data*", - "render-sky-tri", - "sky-roof-polygons", - "close-sky-buffer", - "sky-cloud-polygons", - "set-tex-offset", - "render-sky-quad", - "sky-tng-setup-cloud-layer", - "sky-cloud-polygon-indices", - "draw-large-polygon", - "init-sky-tng-data", - "clip-polygon-against-positive-hyperplane", - "clip-polygon-against-negative-hyperplane", - "sky-duplicate-polys", - "sky-tng-setup-clouds", - "render-sky-tng" - ], - "sky-utils": [ - "sky-set-sun-radii", - "sky-set-sun-colors", - "sky-set-sun-colors-sun", - "sky-set-sun-colors-halo", - "sky-set-sun-colors-aurora", - "sky-set-orbit" - ], - "smush-control-h": ["smush-control"], - "snow-ball": [ - "snow-ball-idle", - "snow-ball-roller-init-by-other", - "*snow-ball-sg*", - "snow-ball-shadow-init-by-other", - "snow-ball-roller-idle", - "snow-ball-roller-path-update", - "snow-ball-roller-path-init", - "*snow-ball-shadow-sg*", - "*snow-ball-shadow-control*", - "snow-ball-shadow-idle", - "snow-ball-shadow", - "snow-ball-junction", - "snow-ball-path-info", - "snow-ball-roller", - "snow-ball" - ], - "snow-bumper": [ - "*snow-bumper-sg*", - "snow-bumper-spawn-fuel-cell", - "snow-bumper-inactive-idle", - "snow-bumper-active-far-idle", - "snow-bumper-deactivate", - "snow-bumper-active-close-idle", - "snow-bumper" - ], - "snow-bunny": [ - "snow-bunny-execute-jump", - "snow-bunny-initialize-jump", - "*snow-bunny*", - "*snow-bunny-nav-enemy-info*", - "*snow-bunny-sg*", - "snow-bunny-default-event-handler", - "snow-bunny", - "snow-bunny-retreat-work" - ], - "snow-flutflut-obs": [ - "*flutflut-plat-large-sg*", - "*flutflut-plat-med-sg*", - "*flutflut-plat-small-sg*", - "elevator-idle-at-cave", - "elevator-travel-to-cave", - "elevator-idle-at-fort", - "elevator-travel-to-fort", - "flutflut-plat-hidden-idle", - "flutflut-plat-hide", - "flutflut-plat-appear", - "*snow-button-sg*", - "snow-button-up-idle", - "snow-button-deactivate", - "snow-button-activate", - "flutflut-plat", - "snow-button", - "flutflut-plat-small", - "flutflut-plat-med", - "flutflut-plat-large" - ], - "snow-obs": [ - "*snow-switch-sg*", - "snow-log-button-idle-down", - "snow-log-button-idle-up", - "snow-log-button-activate", - "*snow-log-sg*", - "snow-log-wait-for-master", - "snow-log-active", - "snow-log-activate", - "snow-log-hidden", - "snow-switch-idle-down", - "snow-switch-idle-up", - "*snowcam-sg*", - "snow-switch-activate", - "*snow-gears-sg*", - "snow-gears-idle", - "snow-gears-stopped", - "snow-gears-halt", - "snow-gears-activate", - "*snow-fort-gate-sg*", - "snow-fort-gate-idle-open", - "snow-fort-gate-idle-closed", - "snow-fort-gate-activate", - "*snow-spatula-sg*", - "snow-spatula-idle", - "*snowpusher-sg*", - "snowpusher-idle", - "*snow-eggtop-sg*", - "snow-eggtop-idle-down", - "snow-eggtop-idle-up", - "snow-eggtop-activate", - "snow-switch-event-handler", - "snow-log-button-event-handler", - "snowcam", - "snow-eggtop", - "snowpusher", - "snow-spatula", - "snow-fort-gate", - "snow-gears", - "snow-switch", - "snow-log", - "snow-log-button" - ], - "snow-part": ["snow-bird-bob-func", "sparticle-snow-birds-moon", "snow-part"], - "snow-ram": ["*ram-sg*", "ram-fun-idle", "ram-idle", "ram-give-fuel-cell"], - "snow-ram-boss": [ - "ram-boss-tracking", - "*ram-boss-nav-enemy-info-no-shield*", - "ram-boss-nav-resume", - "ram-boss-throw", - "ram-boss-nav-start", - "ram-boss-jump-down-hit-ground", - "ram-boss-jump-down", - "ram-boss-already-down", - "ram-boss-idle", - "*ram-boss-sg*", - "*ram-boss-nav-enemy-info*", - "ram-boss-lose-shield", - "ram-boss-up-defend-block", - "ram-boss-forward-defend-block", - "ram-boss-proj-launch", - "snow-ram-proj-update-velocity", - "ram-boss-proj-growing", - "ram-boss-on-ground-event-handler", - "ram-boss-init-by-other", - "ram-boss-show-anims", - "ram-boss-proj", - "ram-boss" - ], - "snow-ram-h": ["ram"], - "sparticle": [ - "*particles-flag*", - "all-particles-60-to-50", - "all-particles-50-to-60", - "sp-process-particle-system", - "*sp-particle-system-2d*", - "*sp-particle-system-3d*", - "forall-particles-runner", - "sparticle-60-to-50", - "sparticle-50-to-60", - "forall-particles", - "sparticle-kill-it-level0", - "sparticle-kill-it-level1", - "forall-particles-with-key", - "sparticle-kill-it", - "forall-particles-with-key-runner", - "sp-get-approx-alloc-size", - "sp-process-block", - "sp-copy-to-spr", - "sp-process-block-3d", - "sp-process-block-2d", - "sp-copy-from-spr", - "sp-free-particle", - "sp-particle-copy!", - "sp-get-block-size", - "sp-kill-particle", - "sp-orbiter", - "memcpy", - "kill-all-particles-in-level", - "set-particle-frame-time", - "process-particles" - ], - "sparticle-h": [ - "*sp-frame-time*", - "*sp-60-hz*", - "sparticle-cpuinfo", - "sparticle-launchinfo", - "sparticle-system" - ], - "sparticle-launcher": [ - "*global-toggle*", - "sphere-in-view-frustum?", - "kill-all-particles-with-key", - "*part-id-table*", - "*particle-300hz-timer*", - "sp-relaunch-setup-fields", - "sp-init-fields!", - "*sp-launch-queue*", - "sp-launch-particles-var", - "sp-get-particle", - "*death-adgif*", - "particle-adgif", - "*part-group-id-table*", - "lookup-part-group-by-name", - "lookup-part-group-pointer-by-name", - "unlink-part-group-by-heap", - "*sp-launcher-lock*", - "*sp-launcher-enable*", - "particle-setup-adgif", - "*particle-adgif-cache*", - "sp-queue-launch", - "sp-adjust-launch", - "sp-euler-convert", - "sp-rotate-system", - "sp-launch-particles-death", - "sp-clear-queue", - "sp-relaunch-particle-2d", - "sp-relaunch-particle-3d", - "sparticle-track-root", - "sparticle-track-root-prim", - "birth-func-copy-rot-color", - "birth-func-copy2-rot-color", - "birth-func-copy-omega-to-z", - "birth-func-random-next-time", - "sparticle-birthinfo", - "sp-queued-launch-particles", - "sp-launch-queue", - "particle-adgif-cache" - ], - "sparticle-launcher-h": [ - "sp-field-init-spec", - "sparticle-launcher", - "sparticle-group-item", - "sparticle-launch-state", - "sparticle-launch-group", - "sparticle-launch-control" - ], - "spider-egg": [ - "*spider-egg-unbroken-sg*", - "*spider-egg-broken-sg*", - "spider-egg-idle", - "spider-egg-hatch", - "spider-egg-die", - "spider-egg" - ], - "spiderwebs": [ - "*spiderwebs-sg*", - "spiderwebs-idle", - "*spider-jump-mods*", - "spiderwebs-bounce", - "spiderwebs-default-event-handler", - "spiderwebs" - ], - "sprite": [ - "*sprite-hvdf-data*", - "*sprite-hvdf-control*", - "sprite-init-distorter", - "sprite-draw-distorters", - "sprite-vu1-block", - "sprite-add-frame-data", - "sprite-add-matrix-data", - "sprite-add-3d-all", - "*sprite-array-3d*", - "sprite-add-2d-all", - "*sprite-array-2d*", - "sprite-add-shadow-all", - "sprite-add-shadow-chunk", - "sprite-setup-header", - "*shadow-middot-texture*", - "sprite-add-3d-chunk", - "sprite-add-2d-chunk", - "sprite-setup-frame-data", - "*sprite-aux-list*", - "clear-sprite-aux-list", - "add-to-sprite-aux-list", - "sprite-set-3d-quaternion!", - "sprite-get-3d-quaternion!", - "sprite-draw", - "sprite-allocate-user-hvdf", - "sprite-release-user-hvdf", - "sprite-get-user-hvdf", - "sprite-header", - "sprite-hvdf-data", - "sprite-hvdf-control", - "sprite-aux-list", - "sprite-frame-data" - ], - "sprite-distort": [ - "*sprite-distorter-sine-tables*", - "sprite-distort-vu1-block", - "sprite-distorter-sine-tables" - ], - "sprite-h": [ - "sprite-vec-data-2d", - "sprite-array-2d", - "sprite-vec-data-3d", - "sprite-array-3d" - ], - "square-platform": [ - "square-platform-master-idle", - "square-platform-master-activate", - "*square-platform-sg*", - "square-platform-lowered", - "square-platform-rising", - "square-platform-lowering", - "square-platform-raised", - "square-platform", - "square-platform-button", - "square-platform-master" - ], - "static-screen": ["static-screen-init-by-other", "static-screen"], - "stats-h": ["tr-stat", "merc-global-stats", "perf-stat", "perf-stat-array"], - "steam-cap": [ - "*steam-cap-sg*", - "steam-cap-idle", - "steam-cap-control-pt", - "steam-cap" - ], - "subdivide": [ - "*subdivide-settings*", - "*tfrag-work*", - "*perf-stats*", - "perf-stat-bucket->string", - "print-tr-stat", - "*merc-global-stats*", - "*stat-string-tfrag-near*", - "*stat-string-tfrag*", - "*stat-string-total*", - "clear-tr-stat", - "print-terrain-stats", - "update-subdivide-settings!", - "set-tfrag-dists!", - "*terrain-context*", - "GSH_ENABLE", - "GSH_BUCKET", - "GSH_WHICH_STAT", - "GSH_MAX_DISPLAY", - "GSH_TIME", - "*gomi-stats-hack*", - "start-perf-stat-collection", - "end-perf-stat-collection", - "print-perf-stats" - ], - "subdivide-h": [ - "*terrain-stats*", - "*collide-stats*", - "subdivide-settings", - "subdivide-dists", - "gs-packed-rgba", - "gs-packed-xyzw", - "gs-packed-stq", - "gs-packed-gt", - "gs-packed-gt4", - "terrain-bsp", - "terrain-stats", - "dma-area", - "background-area", - "foreground-area", - "ambient-area", - "work-area", - "terrain-context" - ], - "sun-exit-chamber": [ - "*exit-chamber-sg*", - "exit-chamber-button-init-by-other", - "exit-chamber-charger-puzzle", - "exit-chamber-idle-in-sunken", - "exit-chamber-idle-in-village", - "exit-chamber-lower", - "exit-chamber-rise", - "exit-chamber-charger-puzzle-beaten", - "*blue-eco-charger-sg*", - "blue-eco-charger-orb-init-by-other", - "blue-eco-charger-idle", - "blue-eco-charger-open", - "blue-eco-charger-close", - "blue-eco-charger-stuck-open", - "*blue-eco-charger-orb-sg*", - "blue-eco-charger-orb-idle", - "blue-eco-charger-orb-active", - "blue-eco-charger-orb", - "blue-eco-charger", - "exit-chamber-items", - "exit-chamber", - "exit-chamber-button" - ], - "sun-iris-door": [ - "*sun-iris-door-sg*", - "sun-iris-door-open", - "sun-iris-door-closed", - "sun-iris-door-opening", - "sun-iris-door-closing", - "sun-iris-door-init-by-other", - "sun-iris-door" - ], - "sunken-elevator": ["*sunken-elevator-sg*", "sunken-elevator"], - "sunken-fish": [ - "sunkenfisha-init-by-other", - "sunkenfisha-idle", - "*sunkenfisha-red-yellow-sg*", - "*sunkenfisha-yellow-blue-sg*", - "*sunkenfisha-yellow-eye-sg*", - "sunkenfisha" - ], - "sunken-obs": [ - "*seaweed-sg*", - "*seaweed*", - "seaweed-idle", - "*side-to-side-plat-sg*", - "*sunkencam-sg*", - "water-vol-deadly", - "side-to-side-plat", - "sunkencam", - "seaweed" - ], - "sunken-part": ["sunken-part"], - "sunken-pipegame": [ - "sunken-pipegame-button-init-by-other", - "sunken-pipegame-start-up", - "sunken-pipegame-idle", - "sunken-pipegame-end-play", - "sunken-pipegame-beat-challenge", - "sunken-pipegame-begin-play", - "sunken-pipegame-button", - "sunken-pipegame-prize", - "sunken-pipegame" - ], - "sunken-water": ["ripple-for-sunken-water", "sunken-water"], - "surface-h": [ - "calc-terminal-vel", - "calc-terminal2-vel", - "calc-terminal4-vel", - "surface-interp!", - "surface-mult!", - "surface-clamp-speed", - "*walk-mods*", - "*walk-no-turn-mods*", - "*turn-around-mods*", - "*duck-mods*", - "*duck-attack-mods*", - "*jump-mods*", - "*double-jump-mods*", - "*smack-jump-mods*", - "*high-jump-mods*", - "*launch-jump-mods*", - "*forward-high-jump-mods*", - "*flip-jump-mods*", - "*forward-jump-mods*", - "*forward-pole-jump-mods*", - "*attack-mods*", - "*jump-attack-mods*", - "*uppercut-jump-mods*", - "*run-attack-mods*", - "*wheel-mods*", - "*wheel-flip-mods*", - "*flop-mods*", - "*flop-land-mods*", - "*wade-mods*", - "*swim-mods*", - "*dive-mods*", - "*dive-bottom-mods*", - "*pole-mods*", - "*grab-mods*", - "*edge-grab-mods*", - "*empty-mods*", - "*neutral-mods*", - "*stone-surface*", - "*edge-surface*", - "*wade-surface*", - "*slope-surface*", - "*quicksand-surface*", - "*tar-surface*", - "*grass-surface*", - "*ice-surface*", - "*tread-surface*", - "*standard-ground-surface*", - "*swim-surface*", - "surface" - ], - "swamp-bat": [ - "swamp-bat-make-path-select-plane", - "swamp-bat-setup-new-path", - "swamp-bat-update-path", - "swamp-bat-slave-init-by-other", - "swamp-bat-idle", - "swamp-bat-launch-slave", - "swamp-bat-check-slave-paths-match?", - "swamp-bat-launch-slaves", - "swamp-bat-slave-get-new-path", - "*swamp-bat-slave-sg*", - "swamp-bat-slave-idle", - "swamp-bat-slave-return", - "swamp-bat-slave-strafe", - "swamp-bat-slave-swoop", - "swamp-bat-slave-post", - "swamp-bat-slave-die", - "swamp-bat-slave-launch", - "swamp-bat-slave-event-handler", - "swamp-bat-slave-path-post", - "swamp-bat-debug", - "swamp-bat-idle-path", - "swamp-bat", - "swamp-bat-slave" - ], - "swamp-blimp": [ - "*swamp-blimp-sg*", - "swamp-rope-init-by-other", - "swamp-blimp-setup", - "swamp-blimp-idle", - "swamp-blimp-bye-bye", - "*SWAMP_BLIMP-bank*", - "*swamp-rope-sg*", - "tetherrock-get-info", - "swamp-rope-idle-rock", - "swamp-rope-idle-arm", - "swamp-rope-break", - "swamp-rope-post", - "swamp-rope-break-code", - "swamp-rope-update-bounding-spheres", - "*precursor-arm-sg*", - "precursor-arm-idle", - "precursor-arm-die", - "precursor-arm-slip", - "precursor-arm-sink", - "*swamp-tetherrock-sg*", - "swamp-tetherrock-die", - "swamp-tetherrock-hide", - "swamp-tetherrock-idle", - "swamp-tetherrock-break", - "*swamp-tetherrock-explode-sg*", - "swamp-rope-trans", - "blimp-trans", - "bustarock", - "swamp-blimp-bank", - "tetherrock-info", - "swamp-rope-rand-float", - "swamp-rope-oscillator", - "swamp-blimp-rand-vector", - "swamp-blimp-oscillator", - "swamp-tetherrock", - "precursor-arm", - "swamp-rope", - "swamp-blimp" - ], - "swamp-obs": [ - "*swampcam-sg*", - "*tar-plat-sg*", - "*tar-plat-constants*", - "*swamp-rock-sg*", - "swamp-rock-idle", - "swamp-rock-break", - "*balance-plat-sg*", - "balance-plat-idle", - "swamp-spike-gate-down", - "swamp-spike-gate-up", - "swamp-spike-idle", - "*swamp-spike-sg*", - "swamp-spike-set-particle-rotation-callback", - "swamp-spike-default-event-handler", - "swamp-spike-post", - "swamp-rock-init-by-other", - "swamp-spike", - "swampgate", - "balance-plat", - "swamp-rock", - "tar-plat", - "swamp-barrel", - "swampcam", - "swamp-battlecontroller" - ], - "swamp-part": ["swamp-part"], - "swamp-rat": [ - "swamp-rat-spawn", - "*swamp-rat-sg*", - "*swamp-rat-nav-enemy-info*", - "swamp-rat-update-wiggle-target", - "swamp-rat-update-wiggle-params", - "pointer", - "swamp-rat-default-event-handler", - "swamp-rat-init-by-other", - "swamp-rat" - ], - "swamp-rat-nest": [ - "*swamp-rat-nest-dummy-c-sg*", - "*swamp-rat-nest-dummy-b-sg*", - "*swamp-rat-nest-dummy-a-sg*", - "swamp-rat-nest-idle", - "swamp-rat-nest-active", - "swamp-rat-nest-check-dummy", - "swamp-rat-nest-spawn-rat", - "swamp-rat-nest-gestate", - "swamp-rat-nest-dummy-init-by-other", - "swamp-rat-nest-die", - "swamp-rat-nest-pick-spawn-joint", - "swamp-rat-nest-victory", - "swamp-rat-nest-dummy-idle", - "swamp-rat-nest-dummy-hit", - "swamp-rat-nest-dummy-die", - "swamp-rat-nest-dummy-shake", - "swamp-rat-nest-dummy-take-damage", - "swamp-rat-nest-dummy-draw-spawn-joints", - "swamp-rat-nest-dummy-event-handler", - "swamp-rat-nest-default-event-handler", - "swamp-rat-nest", - "swamp-rat-nest-dummy", - "swamp-rat-nest-dummy-a", - "swamp-rat-nest-dummy-b", - "swamp-rat-nest-dummy-c" - ], - "sync-info-h": [ - "sync-info", - "sync-info-eased", - "sync-info-paused", - "delayed-rand-float", - "oscillating-float", - "bouncing-float", - "delayed-rand-vector", - "oscillating-vector" - ], - "target": [ - "target-land-effect", - "target-hit-ground", - "target-stance", - "target-high-jump", - "target-attack-air", - "target-wheel-flip", - "target-duck-stance", - "target-hit-ground-anim", - "target-hit-ground-hard", - "target-flop-hit-ground", - "target-yellow-jump-blast", - "target-swim-down", - "target-flop", - "mod-var-jump", - "init-var-jump", - "target-attack-uppercut-jump", - "target-attack", - "target-attack-uppercut", - "target-yellow-blast", - "target-wade-walk", - "target-walk", - "target-running-attack", - "target-falling-anim", - "target-falling-trans", - "target-duck-high-jump-jump", - "target-launch", - "target-duck-high-jump", - "target-double-jump", - "target-duck-walk", - "target-ice-walk", - "target-wheel", - "target-turn-around", - "target-stance-ambient", - "target-ice-stance", - "target-falling-anim-trans", - "target-startup", - "target-jump-forward" - ], - "target-death": [ - "target-death-anim", - "death-movie-remap", - "*death-spool-array*", - "pov-camera-init-by-other", - "*deathcam-sg*", - "target-hit-effect", - "*smack-mods*", - "target-hit-setup-anim", - "target-hit-move", - "target-hit-orient", - "target-hit-push", - "*smack-up-mods*", - "velocity-set-to-target!", - "target-title", - "start-sequence-a", - "target-demo", - "task-closed?", - "target-warp-in", - "*auto-continue*", - "next-level" - ], - "target-flut": [ - "target-flut-post-post", - "target-flut-stance", - "target-flut-grab", - "target-flut-clone-anim", - "target-flut-get-off-hit-ground", - "target-flut-falling-anim-trans", - "target-flut-get-off-jump", - "target-flut-death", - "target-flut-hit-ground", - "*flut-air-attack-mods*", - "target-flut-air-attack-hit-ground", - "target-flut-jump", - "target-flut-dangerous-event-handler", - "*FLUT-bank*", - "target-flut-falling", - "*flut-run-attack-mods*", - "target-flut-hit", - "*flut-jump-mods*", - "target-flut-hit-ground-anim", - "target-flut-walk", - "*flut-walk-mods*", - "target-flut-air-attack", - "*flut-double-jump-mods*", - "target-flut-double-jump", - "target-flut-standard-event-handler", - "target-flut-running-attack", - "flut-info", - "target-flut-get-on", - "target-flut-get-off", - "flut-bank", - "target-flut-post" - ], - "target-h": ["*target*", "*sidekick*", "target", "sidekick"], - "target-handler": [ - "target-bonk-event-handler", - "target-standard-event-handler", - "target-send-attack", - "target-jump", - "target-attacked", - "target-hit", - "target-eco-powerup", - "target-load-wait", - "target-grab", - "target-look-around", - "target-billy-game", - "target-racing-start", - "target-flut-start", - "target-snowball-start", - "target-tube-start", - "target-periscope", - "target-fishing", - "target-final-door", - "target-play-anim", - "target-clone-anim", - "target-edge-grab", - "target-pole-cycle", - "target-swim-stance", - "target-wade-stance", - "target-apply-tongue", - "get-intersect-point", - "target-powerup-effect", - "target-shoved", - "target-dangerous-event-handler", - "target-jump-event-handler", - "target-walk-event-handler", - "target-state-hook-exit", - "target-effect-exit" - ], - "target-part": [ - "birth-func-copy-target-y-rot", - "birth-func-ground-orient", - "birth-func-target-orient", - "birth-func-vector-orient", - "part-tracker-track-target-joint", - "process-drawable-burn-effect" - ], - "target-racer-L1-RACERP": [ - "racer-collision-reaction", - "racer-service-slide", - "racer-xz", - "racer-thrust", - "racer-calc-gravity", - "racer-on-ground?", - "target-racing-smack", - "racer-collision", - "racer-integrate", - "racer-effects", - "racer-sounds", - "racer-bend-gravity", - "racer-find-prop-point", - "racer-cushion", - "*racer-mods*", - "*racer-air-mods*", - "racer-buzz", - "target-racing-center-anim", - "target-racing-turn-anim", - "target-racing-jump-anim", - "target-racing-land-anim", - "target-racing-post" - ], - "target-racer-h-L1-RACERP": [ - "*RACER-bank*", - "*balloon-sg*", - "racer-info", - "racer-bank" - ], - "target-snowball": [ - "target-snowball-post", - "target-snowball", - "*SNOWBALL-bank*", - "snowball-info", - "snowball-bank" - ], - "target-tube": [ - "find-target-point", - "distance-from-tangent", - "target-tube", - "target-tube-death", - "*tube-jump-mods*", - "target-tube-post", - "target-tube-turn-anim", - "target-tube-jump", - "*tube-mods*", - "*tube-surface*", - "target-tube-hit", - "tube-thrust", - "tube-sounds", - "*tube-hit-mods*", - "*TUBE-bank*", - "tube-info", - "tube-bank", - "slide-control" - ], - "target-util": [ - "*TARGET-bank*", - "target-slide-down", - "target-height-above-ground", - "target-falling", - "target-align-vel-z-adjust", - "target-collide-set!", - "*jchar-sg*", - "*target-shadow-control*", - "target-start-attack", - "target-danger-set!", - "average-turn-angle", - "can-play-stance-amibent?", - "can-jump?", - "move-legs?", - "fall-test", - "slide-down-test", - "smack-surface?", - "can-wheel?", - "can-duck?", - "can-exit-duck?", - "can-hands?", - "can-feet?", - "vector-local+!", - "move-forward", - "set-forward-vel", - "delete-back-vel", - "set-side-vel", - "target-timed-invulnerable", - "target-timed-invulnerable-off", - "ground-tween-initialize", - "ground-tween-update", - "target-rot", - "target-bank" - ], - "target2": [ - "target-death", - "target-swim-jump-jump", - "target-swim-tilt", - "target-swim-up", - "target-swim-jump", - "target-swim-walk", - "projectile-init-by-other", - "*yellow-jump-mods*", - "target-edge-grab-jump", - "target-edge-grab-off", - "target-pole-flip-up-jump", - "target-pole-flip-forward-jump", - "target-pole-flip-up", - "target-pole-flip-forward", - "first-person-hud", - "*fp-hud-stack*", - "first-person-hud-init-by-other", - "target-stance-look-around", - "hud-normal", - "hud-coming-in", - "disable-hud", - "hud-going-out", - "hud-waiting", - "enable-hud", - "part-first-person-hud-left-func", - "part-first-person-hud-right-func", - "part-first-person-hud-selector-func", - "look-for-points-of-interest" - ], - "task-control": [ - "task-status->string", - "*null-task-control*", - "*task-controls*", - "*assistant-tasks*", - "*assistant-village2-tasks*", - "*gambler-tasks*", - "*geologist-tasks*", - "*mayor-tasks*", - "*sage-tasks*", - "*sage-bluehut-tasks*", - "*oracle-village1-tasks*", - "*oracle-village2-tasks*", - "*oracle-village3-tasks*", - "*miners-tasks*", - "*sage-villagec-tasks*", - "*citb-greensage-tasks*", - "*citb-bluesage-tasks*", - "*citb-redsage-tasks*", - "*citb-yellowsage-tasks*", - "open-specific-task!", - "task-exists?", - "sages-kidnapped?" - ], - "task-control-h": [ - "task-cstage", - "task-control", - "ambient-control", - "process-taskable" - ], - "text": [ - "*level-text-file-load-flag*", - "*game-text-line*", - "*game-text-word*", - "set-font-color-alpha", - "load-game-text-info", - "text-is-loading", - "load-level-text-files", - "draw-debug-text-box", - "print-game-text-scaled", - "disable-level-text-file-loading", - "enable-level-text-file-loading" - ], - "text-h": [ - "*text-group-names*", - "kheap", - "*common-text-heap*", - "*common-text*", - "game-text", - "game-text-info" - ], - "texture": [ - "adgif-shader<-texture!", - "adgif-shader<-texture-with-update!", - "level-remap-texture", - "link-texture-by-id", - "lookup-texture-by-id", - "texture-page-login", - "texture-page-default-allocate", - "loading-level", - "*texture-pool*", - "loado", - "*font-texture*", - "global", - "*txt-dma-list*", - "texture-relocate", - "dma-buffer-add-ref-texture", - "upload-vram-pages", - "upload-vram-pages-pris", - "movie?", - "texture-page-near-allocate-1", - "texture-page-near-allocate-0", - "texture-page-common-allocate", - "texture-page-size-check", - "update-vram-pages", - "upload-vram-data", - "gs-page-width", - "gs-page-height", - "gs-largest-block", - "gs-block-width", - "gs-block-height", - "gs-find-block", - "ct32-24-block-table", - "ct16-block-table", - "ct16s-block-table", - "mz32-24-block-table", - "mz16-block-table", - "mz16s-block-table", - "mt8-block-table", - "mt4-block-table", - "physical-address", - "texture-qwc", - "texture-bpp", - "texture-page-dir-inspect", - "gs-blocks-used", - "texture-page-common-boot-allocate", - "texture-page-level-allocate", - "relocate-later", - "*shader-list*", - "*edit-shader*", - "adgif-shader-update!", - "adgif-shader-login", - "adgif-shader-login-no-remap", - "adgif-shader-login-fast", - "adgif-shader-login-no-remap-fast", - "adgif-shader<-texture-simple!" - ], - "texture-h": [ - "*texture-enable-user-menu*", - "*texture-enable-user*", - "texture-mip->segment", - "*texture-relocate-later*", - "*texture-page-dir*", - "*sky-base-vram-word*", - "*sky-base-block*", - "*sky-base-page*", - "*depth-cue-base-vram-word*", - "*depth-cue-base-block*", - "*depth-cue-base-page*", - "*eyes-base-vram-word*", - "*eyes-base-block*", - "*eyes-base-page*", - "*ocean-base-vram-word*", - "*ocean-base-block*", - "*ocean-base-page*", - "texture-id", - "texture-pool-segment", - "texture-pool", - "texture", - "texture-page-segment", - "texture-page", - "shader-ptr", - "texture-link", - "texture-page-dir-entry", - "texture-page-dir", - "texture-relocate-later", - "adgif-shader", - "adgif-shader-array" - ], - "texture-upload": ["*ocean-texture*"], - "tfrag": [ - "add-tfrag-mtx-0", - "add-tfrag-mtx-1", - "add-tfrag-data", - "tfrag-vu1-block", - "t-stat", - "*tfrag-display-stats*", - "tfrag-data-setup", - "tfrag-print-stats", - "tfrag-init-buffer", - "tfrag-end-buffer", - "draw-inline-array-tfrag", - "tfrag-near-init-buffer", - "tfrag-near-end-buffer", - "draw-inline-array-tfrag-near", - "stats-tfrag-asm" - ], - "tfrag-h": [ - "tfragment-stats", - "tfragment-debug-data", - "generic-tfragment", - "tfragment", - "drawable-inline-array-tfrag", - "drawable-inline-array-trans-tfrag", - "drawable-tree-tfrag", - "drawable-tree-trans-tfrag", - "drawable-tree-dirt-tfrag", - "drawable-tree-ice-tfrag", - "drawable-tree-lowres-tfrag", - "drawable-tree-lowres-trans-tfrag", - "tfrag-dists", - "tfrag-data", - "tfrag-control", - "tfrag-stats", - "tfrag-packet", - "tfrag-work", - "tfrag-dma" - ], - "tfrag-methods": ["edge-debug-lines", "vis-cull"], - "tfrag-near": ["tnear-vu1-block", "tfrag-details", "clip-restore"], - "ticky": ["ticky"], - "tie": [ - "tie-vu1-block", - "tie-init-consts", - "tie-float-reg", - "tie-int-reg", - "tie-init-engine", - "tie-end-buffer", - "tie-ints", - "tie-floats", - "tie-consts" - ], - "tie-h": [ - "*instance-tie-work-copy*", - "tie-fragment", - "instance-tie", - "drawable-inline-array-instance-tie", - "drawable-tree-instance-tie", - "prototype-tie", - "tie-matrix", - "instance-tie-work", - "instance-tie-dma", - "prototype-tie-work", - "prototype-tie-dma" - ], - "tie-methods": [ - "tie-init-buffers", - "*tie*", - "tie-debug-between", - "tie-debug-one", - "walk-tie-generic-prototypes", - "*pke-hack*", - "draw-inline-array-instance-tie", - "draw-inline-array-prototype-tie-generic-asm", - "draw-inline-array-prototype-tie-asm", - "draw-inline-array-prototype-tie-near-asm", - "tie-test-cam-restore", - "tie-instance-debug" - ], - "tie-near": [ - "tie-near-vu1-block", - "tie-near-init-consts", - "tie-near-init-engine", - "tie-near-end-buffer", - "tie-near-int-reg", - "tie-near-float-reg", - "tie-near-consts" - ], - "tie-work": ["*prototype-tie-work*"], - "time-of-day": [ - "make-sky-textures", - "sky-base-polygons", - "init-time-of-day", - "time-of-day-tick", - "time-of-day-effect", - "update-sky-tng-data", - "time-of-day-update", - "start-time-of-day", - "time-of-day-setup", - "set-time-of-day", - "init-time-of-day-context", - "update-time-of-day" - ], - "time-of-day-h": [ - "*palette-fade-controls*", - "*time-of-day-mode*", - "*time-of-day-context*", - "palette-fade-control", - "palette-fade-controls", - "time-of-day-proc", - "time-of-day-palette", - "time-of-day-context", - "time-of-day-dma" - ], - "timer": [ - "stopwatch-elapsed-ticks", - "timer-reset", - "timer-count", - "disable-irq", - "enable-irq", - "stopwatch-init", - "stopwatch-reset", - "stopwatch-start", - "stopwatch-stop", - "stopwatch-begin", - "stopwatch-end", - "stopwatch-elapsed-seconds" - ], - "timer-h": [ - "*ticks-per-frame*", - "timer-init", - "timer-mode", - "timer-bank", - "timer-hold-bank", - "stopwatch", - "profile-frame", - "profile-bar" - ], - "tippy": ["tippy"], - "title-obs": [ - "target-title-play", - "target-title-wait", - "*logo-japan-sg*", - "*logo-sg*", - "*ndi-sg*", - "logo-slave-init-by-other", - "*ndi-cam-sg*", - "*ndi-volumes-sg*", - "*logo-cam-sg*", - "*logo-volumes-japan-sg*", - "*logo-volumes-sg*", - "*logo-black-sg*", - "logo-init-by-other", - "logo", - "logo-slave" - ], - "training-obs": [ - "*scarecrow-b-sg*", - "*scarecrow-b-break-sg*", - "*scarecrow-a-sg*", - "*scarecrow-a-break-sg*", - "*tra-iris-door-sg*", - "*tra-pontoon-sg*", - "*tra-pontoon-constants*", - "*training-cam-sg*", - "ripple-for-training-water", - "training-water", - "training-cam", - "tra-pontoon", - "tra-iris-door", - "scarecrow-a", - "scarecrow-b" - ], - "training-part": [ - "check-drop-level-training-mist", - "check-drop-level-training-spout-rain", - "tra-bird-bob-func", - "tra-sparticle-seagull-moon", - "training-part" - ], - "trajectory-h": ["trajectory"], - "transform": [ - "transform-matrix-calc!", - "vector-identity!", - "transform-matrix-parent-calc!", - "trs-matrix-calc!" - ], - "transform-h": ["transform", "trs"], - "transformq": [ - "transformq-copy!", - "matrix<-transformq!", - "matrix<-no-trans-transformq!", - "matrix<-transformq+trans!", - "matrix<-transformq+world-trans!", - "matrix<-parented-transformq!" - ], - "transformq-h": ["deg-diff", "vector-y-angle", "transformq", "trsq", "trsqv"], - "trigonometry": [ - "coserp180", - "coserp", - "sinerp", - "asin", - "atan0", - "sign", - "vector-rad<-vector-deg!", - "*sin-poly-vec2*", - "*sin-poly-vec*", - "*cos-poly-vec*", - "deg-", - "radmod", - "deg-seek", - "deg-seek-smooth", - "deg-lerp-clamp", - "binary-table", - "sincos-table", - "sin-rad", - "cos-rad", - "vector-cos-rad!", - "sincos!", - "tan-rad", - "tan", - "atan-rad", - "exp-slead", - "exp-strail", - "exp", - "sinerp-clamp", - "coserp-clamp", - "coserp180-clamp", - "ease-in-out", - "float-type" - ], - "twister": ["twist-joint", "twister"], - "types-h": ["int64", "uint32", "time-frame", "part-id"], - "vector": [ - "*display*", - "vector+float!", - "vector*!", - "vector+*!", - "vector-*!", - "vector/!", - "vector-average!", - "vector--float*!", - "vector-float/!", - "vector-negate-in-place!", - "vector=", - "vector-delta", - "vector-seek!", - "vector-seek-2d-xz-smooth!", - "vector-seek-2d-yz-smooth!", - "vector-seek-3d-smooth!", - "seek-with-smooth", - "vector-seconds", - "vector-seconds!", - "vector-v!", - "vector-v+!", - "vector-v*float+!", - "vector-v++!", - "vector-v*float!", - "vector-v*float++!", - "vector-to-ups!", - "vector-from-ups!", - "vector-length-squared", - "vector-xz-length-squared", - "vector-vector-xz-distance", - "vector-vector-xz-distance-squared", - "vector-length-max!", - "vector-xz-length-max!", - "vector-rotate-around-y!", - "rotate-y<-vector+vector", - "vector-cvt.w.s!", - "vector-cvt.s.w!", - "rot-zxy-from-vector!", - "rot-zyx-from-vector!", - "vector-lerp!", - "vector-lerp-clamp!", - "vector4-lerp!", - "vector4-lerp-clamp!", - "vector-degi", - "vector-degf", - "vector-degmod", - "vector-deg-diff", - "vector-deg-lerp-clamp!", - "vector3s-copy!", - "vector3s+!", - "vector3s*float!", - "vector3s-!", - "spheres-overlap?", - "sphere<-vector!", - "sphere<-vector+r!", - "rand-vu-sphere-point!" - ], - "vector-h": [ - "*null-vector*", - "*identity-vector*", - "*x-vector*", - "*y-vector*", - "*z-vector*", - "*up-vector*", - "vector-dot", - "vector-dot-vu", - "vector4-dot", - "vector4-dot-vu", - "vector+!", - "vector-!", - "vector-zero!", - "vector-reset!", - "vector-copy!", - "*zero-vector*", - "bit-array", - "vector4ub", - "vector4b", - "vector2h", - "vector2uh", - "vector3h", - "vector2w", - "vector3w", - "vector4w", - "vector4w-2", - "vector4w-3", - "vector4w-4", - "vector4h", - "vector8h", - "vector16b", - "vector", - "vector4s-3", - "vector-array", - "rgbaf", - "plane", - "sphere", - "isphere", - "box8s", - "box8s-array", - "cylinder", - "cylinder-flat", - "vertical-planes", - "vertical-planes-array", - "qword", - "vector3s" - ], - "video": ["set-hud-aspect-ratio"], - "video-h": ["*video-parms*", "video-parms"], - "viewer": [ - "init-viewer-for-other", - "*viewer*", - "actor-get-arg!", - "viewer-ja-name", - "viewer-geo-name", - "init-viewer", - "art-part-name", - "*viewer-sg*", - "viewer-process", - "viewer-string", - "add-a-bunch", - "viewer" - ], - "vif-h": ["vif-stat", "vif-fbrst", "vif-err", "vif-bank"], - "village-obs-L1": [ - "ripple-for-villagea-water", - "*revcycle-sg*", - "*revcycleprop-sg*", - "*hutlamp-sg*", - "set-period", - "hutlamp-idle", - "update-clock", - "village-fish-idle", - "villa-starfish-idle", - "process-drawable-child-count", - "starfish-spawn-child", - "starfish-init-by-other", - "starfish-idle", - "*starfish-sg*", - "*starfish-nav-enemy-info*", - "starfish-patrol", - "reflector-end-idle", - "*reflector-middle-sg*", - "reflector-middle-idle", - "*mayorgears-sg*", - "mayorgears-idle", - "*windspinner-sg*", - "windspinner-idle", - "*sagesail-sg*", - "sagesail-idle", - "*windmill-sail-sg*", - "windmill-sail-idle", - "*med-res-jungle-sg*", - "*med-res-jungle1-sg*", - "*med-res-jungle2-sg*", - "*med-res-beach-sg*", - "*med-res-beach1-sg*", - "*med-res-beach2-sg*", - "*med-res-beach3-sg*", - "*med-res-misty-sg*", - "*med-res-village11-sg*", - "*med-res-village12-sg*", - "*med-res-village13-sg*", - "*med-res-training-sg*", - "windmill-sail", - "sagesail", - "windspinner", - "mayorgears", - "reflector-middle", - "reflector-end", - "villa-starfish", - "starfish", - "village-fish", - "villa-fisha", - "villa-fishb", - "cyclegen", - "hutlamp", - "revcycleprop", - "revcycle", - "villagea-water" - ], - "village1-part": [ - "villagea-part", - "bird-bob-func", - "sparticle-seagull-moon", - "check-drop-level-village1-fountain-nosplash", - "check-drop-level-village1-fountain" - ], - "village1-part2": ["check-drop-level-sagehut"], - "village2-obs": [ - "ripple-for-villageb-water", - "*ogreboss-village2-sg*", - "ogreboss-village2-idle", - "ogreboss-village2-throw", - "*fireboulder-sg*", - "boulder1-trans", - "boulder2-trans", - "boulder3-trans", - "boulder4-trans", - "boulder4-trans-2", - "boulder4-trans-3", - "boulder3-trans-2", - "boulder2-trans-2", - "*exit-chamber-dummy-sg*", - "exit-chamber-dummy-wait-to-appear", - "exit-chamber-dummy-idle", - "*ceilingflag-sg*", - "ceilingflag-idle", - "fireboulder-disable-blocking-collision", - "fireboulder-idle", - "fireboulder-hover", - "fireboulder-be-clone", - "fireboulder-hover-stuff", - "*allpontoons-sg*", - "allpontoons-idle", - "allpontoons-be-clone", - "*pontoonten-sg*", - "*pontoonten-constants*", - "*pontoonfive-sg*", - "*pontoonfive-constants*", - "pontoon-die", - "pontoon-hidden", - "*village2cam-sg*", - "*med-res-rolling-sg*", - "*med-res-rolling1-sg*", - "*med-res-village2-sg*", - "ogreboss-village2-trans", - "village2cam", - "pontoon", - "pontoonfive", - "pontoonten", - "allpontoons", - "fireboulder", - "ceilingflag", - "exit-chamber-dummy", - "ogreboss-village2", - "villageb-ogreboss", - "villageb-water" - ], - "village2-part": ["villageb-part", "check-drop-level-sagehut2"], - "village3-obs": [ - "*gondolacables-sg*", - "*pistons-sg*", - "*gondola-sg*", - "ripple-for-villagec-lava", - "*med-res-ogre-sg*", - "*med-res-ogre2-sg*", - "*med-res-ogre3-sg*", - "*med-res-finalboss-sg*", - "villagec-lava", - "gondola", - "pistons", - "gondolacables" - ], - "village3-part": ["villagec-part"], - "villagep-obs": [ - "*village-cam-sg*", - "warp-gate-init-by-other", - "*warp-gate-switch-sg*", - "get-next-slot-up", - "get-next-slot-down", - "print-level-name", - "warpgate", - "warp-gate-switch", - "village-cam" - ], - "voicebox": [ - "cam-voicebox", - "voicebox-init-by-other", - "*voicebox-sg*", - "empty-state", - "voicebox-track", - "camera-voicebox", - "voicebox" - ], - "vol": ["plane-volume-intersect-dist"], - "vol-h": ["plane-volume", "vol-control"], - "vu1-user-h": [ - "*vu1-enable-user-menu*", - "*vu1-enable-user*", - "dma-foreground-sink", - "generic-bucket-state", - "generic-dma-foreground-sink", - "dma-foreground-sink-group" - ], - "wall-plat": [ - "*wall-plat-sg*", - "wall-plat-sync-idle", - "wall-plat-retracted", - "wall-plat-retracting", - "wall-plat-extended", - "wall-plat-extending", - "wall-plat" - ], - "warrior": ["*warrior-sg*", "warrior"], - "water": [ - "splash-spawn", - "part-water-splash-callback", - "ocean-get-height", - "birth-func-y->userdata", - "birth-func-ocean-height", - "check-water-level-drop", - "check-water-level-drop-and-die", - "check-water-level-above-and-die", - "water-vol-init-by-other" - ], - "water-anim": [ - "*water-anim-look*", - "*water-anim-sunken-dark-eco-qbert-sg*", - "*water-anim-sunken-dark-eco-platform-room-sg*", - "*water-anim-sunken-dark-eco-helix-room-sg*", - "*water-anim-sunken-big-room-sg*", - "*water-anim-sunken-first-room-from-entrance-sg*", - "*water-anim-sunken-qbert-room-sg*", - "*water-anim-sunken-first-right-branch-sg*", - "*water-anim-sunken-circular-with-bullys-sg*", - "*water-anim-sunken-hall-with-one-whirlpool-sg*", - "*water-anim-sunken-hall-with-three-whirlpools-sg*", - "*water-anim-sunken-start-of-helix-slide-sg*", - "*water-anim-sunken-room-above-exit-chamber-sg*", - "*water-anim-sunken-hall-before-big-room-sg*", - "*water-anim-sunken-short-piece-sg*", - "*water-anim-sunken-big-room-upper-water-sg*", - "*water-anim-maincave-center-pool-sg*", - "*water-anim-maincave-lower-right-pool-sg*", - "*water-anim-maincave-mid-right-pool-sg*", - "*water-anim-maincave-lower-left-pool-sg*", - "*water-anim-maincave-mid-left-pool-sg*", - "*water-anim-maincave-water-with-crystal-sg*", - "*water-anim-robocave-main-pool-sg*", - "*water-anim-misty-mud-by-arena-sg*", - "*water-anim-misty-mud-above-skeleton-sg*", - "*water-anim-misty-mud-behind-skeleton-sg*", - "*water-anim-misty-mud-above-skull-back-sg*", - "*water-anim-misty-mud-above-skull-front-sg*", - "*water-anim-misty-mud-other-near-skull-sg*", - "*water-anim-misty-mud-near-skull-sg*", - "*water-anim-misty-mud-under-spine-sg*", - "*water-anim-misty-mud-by-dock-sg*", - "*water-anim-misty-mud-island-near-dock-sg*", - "*water-anim-misty-mud-lonely-island-sg*", - "*water-anim-misty-dark-eco-pool-sg*", - "*water-anim-ogre-lava-sg*", - "*water-anim-jungle-river-sg*", - "*water-anim-village3-lava-sg*", - "*water-anim-training-lake-sg*", - "*water-anim-darkcave-water-with-crystal-sg*", - "*water-anim-rolling-water-back-sg*", - "*water-anim-rolling-water-front-sg*", - "*water-anim-finalboss-dark-eco-pool-sg*", - "*water-anim-lavatube-energy-lava-sg*", - "*water-anim-village1-rice-paddy-sg*", - "*water-anim-village1-fountain-sg*", - "*water-anim-village1-rice-paddy-mid-sg*", - "*water-anim-village1-rice-paddy-top-sg*", - "*water-anim-village2-bucket-sg*", - "water-anim", - "water-anim-look" - ], - "water-h": ["water-control", "water-vol"], - "weather-part": [ - "matrix-local->world", - "group-rain-screend-drop", - "update-snow", - "check-drop-level-rain", - "update-rain", - "cam-master-effect", - "sparticle-track-sun" - ], - "wedge-plats": [ - "*wedge-plat-sg*", - "wedge-plat-outer-idle", - "wedge-plat-outer-tip", - "wedge-plat-idle", - "wedge-plat-tip", - "wedge-plat-master-idle", - "*wedge-plat-outer-sg*", - "wedge-plat-master", - "wedge-plat", - "wedge-plat-outer" - ], - "whirlpool": ["*whirlpool-sg*", "whirlpool-idle", "whirlpool"], - "wind": ["update-wind"], - "wind-h": [ - "*wind-work*", - "*wind-scales*", - "wind-get-hashed-index", - "wind-vector", - "wind-work" - ], - "wobbler": ["wobbler"], - "yakow": [ - "*YAKOW-bank*", - "*yakow-sg*", - "yakow-graze", - "yakow-task-complete?", - "yakow-idle", - "yakow-run-away", - "yakow-graze-kicked", - "yakow-walk-to", - "yakow-facing-player?", - "yakow-post", - "yakow-notice", - "yakow-facing-point?", - "yakow-facing-direction?", - "yakow-generate-travel-vector", - "yakow-common-post", - "yakow-cam", - "yakow-kicked", - "*village1cam-sg*", - "yakow-default-event-handler", - "yakow-simple-post", - "yakow-run-post", - "yakow-blend-walk-run", - "yakow-die", - "yakow-bank", - "yakow" - ], - "yeti": [ - "yeti-resuming-start", - "yeti-first-time-start", - "yeti-slave-init-by-other", - "yeti-idle", - "yeti-slave-appear-jump-up", - "*yeti-sg*", - "*yeti-nav-enemy-info*", - "yeti-slave-appear-land", - "yeti-slave-default-event-handler", - "yeti-slave-show-anims", - "yeti-slave", - "yeti" - ] -} diff --git a/scripts/search-decomp/.gitignore b/scripts/search-decomp/.gitignore deleted file mode 100644 index 89eab800ac..0000000000 --- a/scripts/search-decomp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.txt -*.md diff --git a/scripts/search-decomp/grep.py b/scripts/search-decomp/grep.py deleted file mode 100644 index 17f91dd30d..0000000000 --- a/scripts/search-decomp/grep.py +++ /dev/null @@ -1,72 +0,0 @@ -import re -import os -import argparse -import time - -parser = argparse.ArgumentParser('pygrep') -parser.add_argument('-d', '--directory', type=str, required=True, help='root directory to recursively search') -parser.add_argument('-s', '--search_term_file', type=str, required=True, help='search term file') -parser.add_argument('-o', '--output_file', type=str, required=True, help='output file name') -args = parser.parse_args() - -summary_results = {} -results = {} -search_terms = [] - -with open(args.search_term_file, "r") as f: - print("Initializing Search Term File") - for line in f: - token = line.strip() - # VU INSTRUCTION ADDITION. Appends all combinations of `dest` to replace `{DEST}` - vuDestCombinations = ["x", "xy", "xz", "xw", "xyz", "xzw", "xyzw", "y", "yz", "yw", "yzw", "z", "zw", "w"] - if "{DEST}" in token: - for combination in vuDestCombinations: - tempToken = token.replace("{DEST}", combination) - search_terms.append({ - "term": tempToken - }) - summary_results[tempToken.lower()] = 0 - results[tempToken.lower()] = [] - else: - search_terms.append({ - "term": token - }) - summary_results[token.lower()] = 0 - results[token.lower()] = [] - -print("Searching for {} tokens...".format(len(search_terms))) - -totalTimeStart = time.time() -for index, search_term in enumerate(search_terms): - start = time.time() - term = search_term["term"].lower() - print("[{:.2f}%] - Searching for - {}...".format((index/len(search_terms) * 100), term), end="") - pattern = re.compile(re.escape(term) + "\s+") - for path, _, files in os.walk(args.directory): - for fn in files: - filepath = os.path.join(path, fn) - with open(filepath) as handle: - for lineno, line in enumerate(handle): - mo = pattern.search(line) - if mo: - result = "{}:{}:{}".format(filepath, - lineno, - line) - summary_results[term] = summary_results[term] + 1 - results[term].append(result.strip()) - print("Took {:.2f} seconds, Found - {} occurences.".format(time.time() - start, summary_results[term])) -print("Took {} seconds in total".format(time.time() - totalTimeStart)) - -if os.path.exists(args.output_file): - os.remove(args.output_file) - -with open(args.output_file, "w") as f: - print("Outputting Report") - f.write("USAGE SUMMARY\n") - for key in sorted(summary_results, key=summary_results.get, reverse=True): - f.write("{} - {}\n".format(key, summary_results[key])) - f.write("\nOCCURENCES\n") - for key, value in results.items(): - f.write("{}\n".format(key)) - for occurence in value: - f.write("- {}\n".format(occurence)) diff --git a/scripts/search-decomp/vu-fp-instructions.txt b/scripts/search-decomp/vu-fp-instructions.txt deleted file mode 100644 index c2b6af8b3f..0000000000 --- a/scripts/search-decomp/vu-fp-instructions.txt +++ /dev/null @@ -1,122 +0,0 @@ -VABS.{DEST} -VADD.{DEST} -VADDA.{DEST} -VADDAi.{DEST} -VADDAq.{DEST} -VADDAw.{DEST} -VADDAx.{DEST} -VADDAy.{DEST} -VADDAz.{DEST} -VADDi.{DEST} -VADDq.{DEST} -VADDw.{DEST} -VADDx.{DEST} -VADDy.{DEST} -VADDz.{DEST} -VCLIP.xyz -VDIVx Q -VFTOI0.{DEST} -VFTOI12.{DEST} -VFTOI15.{DEST} -VFTOI4.{DEST} -VIADD -VIADDI -VIAND -VILWR.{DEST} -VIOR -VISUB -VISWR.{DEST} -VITOF0.{DEST} -VITOF12.{DEST} -VITOF15.{DEST} -VITOF4.{DEST} -VLQD.{DEST} -VLQI.{DEST} -VMADD.{DEST} -VMADDA.{DEST} -VMADDA.{DEST} -VMADDAi.{DEST} -VMADDAi.{DEST} -VMADDAq.{DEST} -VMADDAq.{DEST} -VMADDAw.{DEST} -VMADDAx.{DEST} -VMADDAy.{DEST} -VMADDAz.{DEST} -VMADDi.{DEST} -VMADDq.{DEST} -VMADDw.{DEST} -VMADDx.{DEST} -VMADDy.{DEST} -VMADDz.{DEST} -VMAX.{DEST} -VMAXi.{DEST} -VMAXw.{DEST} -VMAXx.{DEST} -VMAXy.{DEST} -VMAXz.{DEST} -VMFIR -VMINI.{DEST} -VMINI.{DEST} -VMINIi.{DEST} -VMINIw.{DEST} -VMINIx.{DEST} -VMINIy.{DEST} -VMINIz.{DEST} -VMOVE.{DEST} -VMR32.{DEST} -VMSUB.{DEST} -VMSUBA.{DEST} -VMSUBAi.{DEST} -VMSUBAq.{DEST} -VMSUBAw.{DEST} -VMSUBAx.{DEST} -VMSUBAy.{DEST} -VMSUBAz.{DEST} -VMSUBi.{DEST} -VMSUBq.{DEST} -VMSUBw.{DEST} -VMSUBx.{DEST} -VMSUBy.{DEST} -VMSUBz.{DEST} -VMTIRx -VMUL.{DEST} -VMULA.{DEST} -VMULAi.{DEST} -VMULAq.{DEST} -VMULAw.{DEST} -VMULAx.{DEST} -VMULAy.{DEST} -VMULAz.{DEST} -VMULi.{DEST} -VMULq.{DEST} -VMULw.{DEST} -VMULx.{DEST} -VMULy.{DEST} -VMULz.{DEST} -VNOP -VOPMSUB.xyz -VOPMULA.xyz -VRGET.{DEST} -VRINIT -VRNEXT.{DEST} -VRSQRT Q -VRXORw -VSQD.{DEST} -VSQI.{DEST} -VSQRTy -VSUB.{DEST} -VSUBA.{DEST} -VSUBAi.{DEST} -VSUBAq.{DEST} -VSUBAw.{DEST} -VSUBAx.{DEST} -VSUBAy.{DEST} -VSUBAz.{DEST} -VSUBi.{DEST} -VSUBq.{DEST} -VSUBw.{DEST} -VSUBx.{DEST} -VSUBy.{DEST} -VSUBz.{DEST} -VWAIT Q \ No newline at end of file diff --git a/scripts/update-game-text-id.py b/scripts/update-game-text-id.py deleted file mode 100644 index 9561c71554..0000000000 --- a/scripts/update-game-text-id.py +++ /dev/null @@ -1,61 +0,0 @@ -## Given a list of files(comma delimited), decompile it, then place it under the specified placeholder (if it exists) -## if the placeholder doesn't exist, error out -## the placeholder is `;; DECOMP BEGINS` - -import os - -print("Copying game-text-id enum") -begin_str = ";; GAME-TEXT-ID ENUM BEGINS" -end_str = ";; GAME-TEXT-ID ENUM ENDS" -enum_lines = [] -with open('./decompiler/config/all-types.gc') as f: - lines = f.readlines() - found_enum = False - for line in lines: - if found_enum and end_str in line: - break - if found_enum: - enum_lines.append(line) - if begin_str in line: - found_enum = True -new_texth_lines = [] -with open('goal_src/engine/ui/text-h.gc') as f: - lines = f.readlines() - found_enum = False - for line in lines: - if begin_str in line: - found_enum = True - new_texth_lines.append(begin_str + "\n") - new_texth_lines += enum_lines - new_texth_lines.append(end_str + "\n") - continue - if end_str in line: - found_enum = False - continue - if found_enum: - continue - new_texth_lines.append(line) -os.remove('goal_src/engine/ui/text-h.gc') -with open('goal_src/engine/ui/text-h.gc', "w") as f: - f.writelines(new_texth_lines) -with open('goal_src/engine/pc/ui/text-h.gc') as f: - lines = f.readlines() - found_enum = False - for line in lines: - if begin_str in line: - found_enum = True - new_texth_lines.append(begin_str + "\n") - new_texth_lines += enum_lines - new_texth_lines.append(end_str + "\n") - continue - if end_str in line: - found_enum = False - continue - if found_enum: - continue - new_texth_lines.append(line) -os.remove('goal_src/engine/pc/ui/text-h.gc') -with open('goal_src/engine/pc/ui/text-h.gc', "w") as f: - f.writelines(new_texth_lines) -print("game-text-id enum updated!") - diff --git a/scripts/update-goal-src.py b/scripts/update-goal-src.py deleted file mode 100644 index 7d8df4c760..0000000000 --- a/scripts/update-goal-src.py +++ /dev/null @@ -1,131 +0,0 @@ -## Given a list of files(comma delimited), decompile it, then place it under the specified placeholder (if it exists) -## if the placeholder doesn't exist, error out -## the placeholder is `;; DECOMP BEGINS` - -from jak1_file_list import file_list -import os -import argparse -parser = argparse.ArgumentParser() -parser.add_argument("--files") -args = parser.parse_args() - -files = args.files.split(",") - -throw_error = False - -# files in this list have manual modifications in in code block -# sometimes these modifications don't prevent a compiler error -# and are easy to commit -# -# if you know of / add such a modification, you should append to this -# list, it will remind you such a file was touched by making a root file -# that will be picked up by git to shame you -files_with_modifications = [ - "ambient", - "viewer", - "sunken-obs", - "cam-master", - "target-snowball", - "logic-target", - "default-menu", - "collide-shape", - "cam-states", - "misty-obs", - "lavatube-energy", - "sage-finalboss", - "progress", - "entity", - "ogreboss", - "navigate", - "ice-cube", - "snow-bunny", - "citadel-sages", - "racer-part", - "collectables-part", - "collectables", - "basebutton" -] - -for file in files: - if file in files_with_modifications: - file_name = "{}.manual_restore_reminder".format(file) - with open(file_name, 'w') as fp: - pass - - disasm_path = "./decompiler_out/jak1/{}_disasm.gc".format(file) - if not os.path.exists(disasm_path): - print("{} doesn't exist!".format(disasm_path)) - throw_error = True - continue - - src_path = "" - for f in file_list: - if f[2] != 3: - continue - if f[0] == file: - src_path = f[4] - break - - if not os.path.exists("./goal_src/{}".format(src_path)): - print("{} couldn't find in /goal_src!".format(file)) - throw_error = True - continue - - file_path = "./goal_src/{}/{}.gc".format(src_path, file) - new_lines = [] - with open(file_path) as f: - lines = f.readlines() - found_placeholder = False - for line in lines: - if ";; decomp begins" in line.lower(): - found_placeholder = True - new_lines.append(line.upper()) - break - new_lines.append(line) - if found_placeholder == False: - print("No placeholder found in {}, skipping".format(file_path)) - throw_error = True - continue - - # finally...update the file - lines_to_ignore = [ - ";;-*-Lisp-*-", - "(in-package goal)", - ";; definition", - ";; INFO:", - ";; failed to figure", - ";; Used lq/sq" - ] - def skippable_line(line): - for prefix in lines_to_ignore: - if line.startswith(prefix): - return True - return False - with open(disasm_path) as f: - lines = f.readlines() - in_inspect_method = False - for i, line in enumerate(lines): - # strip inspect methods - if line.startswith("(defmethod inspect") or (line.startswith("(defmethod") and (i + 1 < len(lines) and "inspect" in lines[i+1])): - in_inspect_method = True - continue - if in_inspect_method and line == "\n": - in_inspect_method = False - elif in_inspect_method: - continue - # strip comments we dont care about - if skippable_line(line): - continue - # otherwise, add it to the file - new_lines.append(line) - - # write the damn thing - os.remove(file_path) - with open(file_path, "w") as f: - f.writelines(new_lines) - - print("Copied - {}!".format(file)) - - -if throw_error: - exit(1) From e71adf6e3d0b5d4672490f6197df892b6fd125b7 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Fri, 19 Aug 2022 21:50:36 -0400 Subject: [PATCH 08/23] tests: allow the binary prep steps in the linux release script to be skipped (#1772) --- .../scripts/releases/extract_build_linux.sh | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/scripts/releases/extract_build_linux.sh b/.github/scripts/releases/extract_build_linux.sh index ea5a3ce33b..5f95e6531a 100755 --- a/.github/scripts/releases/extract_build_linux.sh +++ b/.github/scripts/releases/extract_build_linux.sh @@ -8,17 +8,21 @@ SOURCE=${3} mkdir -p $DEST -cp $BIN_SOURCE/game/gk $DEST -cp $BIN_SOURCE/goalc/goalc $DEST -cp $BIN_SOURCE/decompiler/extractor $DEST +PREP_BIN="${PREP_BIN:-true}" -strip $DEST/gk -strip $DEST/goalc -strip $DEST/extractor +if [ "$PREP_BIN" = "true" ]; then + cp $BIN_SOURCE/game/gk $DEST + cp $BIN_SOURCE/goalc/goalc $DEST + cp $BIN_SOURCE/decompiler/extractor $DEST -chmod +x $DEST/gk -chmod +x $DEST/goalc -chmod +x $DEST/extractor + strip $DEST/gk + strip $DEST/goalc + strip $DEST/extractor + + chmod +x $DEST/gk + chmod +x $DEST/goalc + chmod +x $DEST/extractor +fi mkdir -p $DEST/data mkdir -p $DEST/data/launcher/ From 04d6b13ced775715b520819ea79d5cf9ef35f72f Mon Sep 17 00:00:00 2001 From: Matt Dallmeyer <2515356+dallmeyer@users.noreply.github.com> Date: Sat, 20 Aug 2022 07:16:16 -0700 Subject: [PATCH 09/23] HUD - show total/level counts on dpad up/down (#1756) * hud - show total counters on dpad up, level counters on dpad down * make views toggle-able, extend hud timeout on toggle, decompilation cleanup * review feedback round 1 * refactor draw-hud methods * scaled version of draw-string-xy working, need to adjust hud labels still * adjust scale/position of hud counters * remove unnecessary adjustments * update comments --- goal_src/jak1/engine/gfx/font.gc | 37 ++++ goal_src/jak1/engine/ui/hud-classes.gc | 271 +++++++++++++++++++------ goal_src/jak1/engine/ui/hud-h.gc | 9 + goal_src/jak1/engine/ui/text.gc | 40 ++-- 4 files changed, 269 insertions(+), 88 deletions(-) diff --git a/goal_src/jak1/engine/gfx/font.gc b/goal_src/jak1/engine/gfx/font.gc index 15018341f1..41227aa637 100644 --- a/goal_src/jak1/engine/gfx/font.gc +++ b/goal_src/jak1/engine/gfx/font.gc @@ -1830,3 +1830,40 @@ (draw-string str buf context) ) ) + +;; Added for PC port +(defun draw-string-xy-scaled ((str string) (buf dma-buffer) (x int) (y int) (color font-color) (flags font-flags) (scale float)) + "Draw a string at the given xy location, with the given scale." + (let ((font-ctxt (new 'stack 'font-context *font-default-matrix* x y 0.0 color flags))) + (let ((scaled-width (* (-> font-ctxt width) scale)) + (scaled-height (* (-> font-ctxt height) scale)) + (orig-mat-x-scale (-> font-ctxt mat vector 0 x)) + (orig-mat-y-scale (-> font-ctxt mat vector 1 y)) + (orig-vid-parms-x-scale (-> *video-parms* relative-x-scale)) + (orig-vid-parms-y-scale (-> *video-parms* relative-y-scale)) + ) + (*! (-> font-ctxt scale) scale) + (set! (-> font-ctxt width) scaled-width) + (set! (-> font-ctxt height) scaled-height) + + ;; scaling globals *font-default-matrix*, *video-parms* (based on print-game-text scaling) + (*! (-> *font-default-matrix* vector 0 x) scale) + (*! (-> *font-default-matrix* vector 1 y) scale) + (*! (-> *video-parms* relative-x-scale) scale) + (*! (-> *video-parms* relative-y-scale) scale) + (set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale))) + (set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 scale)) + + (draw-string str buf font-ctxt) + + ;; un-scaling globals *font-default-matrix*, *video-params* + (set! (-> *font-default-matrix* vector 0 x) orig-mat-x-scale) + (set! (-> *font-default-matrix* vector 1 y) orig-mat-y-scale) + (set! (-> *video-parms* relative-x-scale) orig-vid-parms-x-scale) + (set! (-> *video-parms* relative-y-scale) orig-vid-parms-y-scale) + (set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale))) + (set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 (-> *video-parms* relative-y-scale))) + ) + ) + (none) + ) diff --git a/goal_src/jak1/engine/ui/hud-classes.gc b/goal_src/jak1/engine/ui/hud-classes.gc index 3aa4a02483..73c71ecfc5 100644 --- a/goal_src/jak1/engine/ui/hud-classes.gc +++ b/goal_src/jak1/engine/ui/hud-classes.gc @@ -737,22 +737,79 @@ :flag-assert #x1b00c00124 ) - +(define-extern *game-counts* game-count-info) (defmethod draw-hud hud-money ((obj hud-money)) (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) + ;; modified for pc port + (cond + ((cpad-hold? 0 up) + (set! *hud-collectable-view* (hud-collectable-view game-totals)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) + ) + ((cpad-hold? 0 down) + (set! *hud-collectable-view* (hud-collectable-view level-totals)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) + ) + ((or (cpad-hold? 0 left) (cpad-hold? 0 right)) + (set! *hud-collectable-view* (hud-collectable-view original)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) + ) + ) (with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) (bucket-id debug)) - (draw-string-xy (string-format "~D" (-> obj value)) buf - (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset))) - (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) - (the int (-> *video-parms* relative-y-scale)) - ) - 2 + (let* ((string-x (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset)))) + (string-y (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) (the int (-> *video-parms* relative-y-scale))) 2)) + ) + (case *hud-collectable-view* + (((hud-collectable-view game-totals)) + ;; show orbs collected/total across entire game + (draw-string-xy-scaled + (string-format + "~D~%/~D" + (the int (-> *game-info* money-total)) + 2000 ;;(-> (the progress (-> *progress-process* 0)) total-nb-of-orbs) ) + buf + string-x + (- string-y 5) (font-color dark-yellow) - (font-flags shadow kerning large)) + (font-flags shadow kerning large) + 0.8 + ) + ) + (((hud-collectable-view level-totals)) + (let ((lvl-idx (-> *level-task-data-remap* (+ (-> *target* current-level info index) -1)))) + ;; show orbs collected/total this level + (draw-string-xy-scaled + (string-format + "~D~%/~D" + (-> *game-info* money-per-level lvl-idx) + (-> *game-counts* data lvl-idx money-count) + ) + buf + string-x + (- string-y 5) + (font-color dark-yellow) + (font-flags shadow kerning large) + 0.8 + ) + ) + ) + (((hud-collectable-view original)) + ;; show original (total collected, unspent orbs) + (draw-string-xy + (string-format "~D" (-> obj value)) + buf + string-x + string-y + (font-color dark-yellow) + (font-flags shadow kerning large) + ) + ) + ) + ) ) 0 (none) @@ -1099,37 +1156,81 @@ (defmethod draw-hud hud-fuel-cell ((obj hud-fuel-cell)) (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) - ) - (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) - (gp-0 (-> s5-0 base)) - ) - (let ((s4-0 draw-string-xy)) - (format (clear *temp-string*) "~D" (-> obj value)) - (s4-0 - *temp-string* - s5-0 - (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset))) - (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) - (the int (-> *video-parms* relative-y-scale)) - ) - 2 - ) - (font-color dark-yellow) - (font-flags shadow kerning large) - ) + ) + ;; modified for pc port + (cond + ((cpad-hold? 0 up) + (set! *hud-collectable-view* (hud-collectable-view game-totals)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) ) - (let ((a3-7 (-> s5-0 base))) - (let ((v1-8 (the-as object (-> s5-0 base)))) - (set! (-> (the-as (pointer int64) v1-8)) #x20000000) - (set! (-> (the-as dma-packet v1-8) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-8) vif1) (new 'static 'vif-tag)) - (set! (-> s5-0 base) (&+ (the-as pointer v1-8) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id debug) - gp-0 - (the-as (pointer dma-tag) a3-7) + ((cpad-hold? 0 down) + (set! *hud-collectable-view* (hud-collectable-view level-totals)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) + ) + ((or (cpad-hold? 0 left) (cpad-hold? 0 right)) + (set! *hud-collectable-view* (hud-collectable-view original)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) + ) + ) + (with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) + (bucket-id debug)) + (let* ((string-x (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset)))) + (string-y (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) (the int (-> *video-parms* relative-y-scale))) 2)) + ) + (case *hud-collectable-view* + (((hud-collectable-view game-totals)) + ;; show cells collected/total across entire game + (draw-string-xy-scaled + (string-format + "~D~%/~D" + (the int (-> *game-info* fuel)) + 101 ;;(-> (the progress (-> *progress-process* 0)) total-nb-of-power-cells) + ) + buf + string-x + (- string-y 5) + (font-color dark-yellow) + (font-flags shadow kerning large) + 0.8 + ) + ) + (((hud-collectable-view level-totals)) + (let ((lvl-idx (-> *level-task-data-remap* (+ (-> *target* current-level info index) -1))) + (completed-task-count 0)) + ;; determine number of cells collected in this level + (dotimes (task-idx (-> *level-task-data* lvl-idx nb-of-tasks)) + (if (= (get-task-status (-> *level-task-data* lvl-idx task-info task-idx task-id)) (task-status invalid)) + (+! completed-task-count 1) + ) + ) + + ;; show cells/total collected this level + (draw-string-xy-scaled + (string-format + "~D~%/~D" + completed-task-count + (-> *level-task-data* lvl-idx nb-of-tasks) + ) + buf + string-x + (- string-y 5) + (font-color dark-yellow) + (font-flags shadow kerning large) + 0.8 + ) + ) + ) + (((hud-collectable-view original)) + ;; show original (cells collected across entire game) + (draw-string-xy + (string-format "~D" (-> obj value)) + buf + string-x + string-y + (font-color dark-yellow) + (font-flags shadow kerning large) + ) + ) ) ) ) @@ -1362,6 +1463,21 @@ (let ((t9-0 (method-of-type hud draw-hud))) (t9-0 obj) ) + ;; modified for pc port + (cond + ((cpad-hold? 0 up) + (set! *hud-collectable-view* (hud-collectable-view game-totals)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) + ) + ((cpad-hold? 0 down) + (set! *hud-collectable-view* (hud-collectable-view level-totals)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) + ) + ((or (cpad-hold? 0 left) (cpad-hold? 0 right)) + (set! *hud-collectable-view* (hud-collectable-view original)) + (set! (-> obj trigger-time) (-> *display* base-frame-counter)) + ) + ) (set! (-> obj text-y) (+ (if (nonzero? (-> obj next-y-offset)) (-> obj text-y-offset) 0 @@ -1369,36 +1485,57 @@ 362 ) ) - (let* ((s5-0 (-> *display* frames (-> *display* on-screen) frame global-buf)) - (gp-0 (-> s5-0 base)) - ) - (let ((s3-0 draw-string-xy)) - (format (clear *temp-string*) "~2,' D" (-> obj value)) - (s3-0 - *temp-string* - s5-0 - (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset))) - (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) - (the int (-> *video-parms* relative-y-scale)) + (with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) + (bucket-id debug)) + (let* ((string-x (+ (-> obj text-x) (* (-> obj x-sgn) (-> obj offset)))) + (string-y (/ (* (+ (-> obj text-y) (* (-> obj y-sgn) (-> obj offset)) (-> obj y-offset)) (the int (-> *video-parms* relative-y-scale))) 2)) + ) + (case *hud-collectable-view* + (((hud-collectable-view game-totals)) + ;; show flies collected/total across entire game + (draw-string-xy-scaled + (string-format + " ~D~% /~D" + (the int (-> *game-info* buzzer-total)) + 112 ;; (-> (the progress (-> *progress-process* 0)) total-nb-of-buzzers) ) - 2 - ) - (font-color dark-yellow) - (font-flags shadow kerning large) - ) - ) - (let ((a3-7 (-> s5-0 base))) - (let ((v1-11 (the-as object (-> s5-0 base)))) - (set! (-> (the-as (pointer int64) v1-11)) #x20000000) - (set! (-> (the-as dma-packet v1-11) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-11) vif1) (new 'static 'vif-tag)) - (set! (-> s5-0 base) (&+ (the-as pointer v1-11) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) frame bucket-group) - (bucket-id debug) - gp-0 - (the-as (pointer dma-tag) a3-7) + buf + string-x + (- string-y 5) + (font-color dark-yellow) + (font-flags shadow kerning large) + 0.8 + ) + ) + (((hud-collectable-view level-totals)) + (let ((lvl-idx (-> *level-task-data-remap* (+ (-> *target* current-level info index) -1)))) + ;; show flies collected/total this level + (draw-string-xy-scaled + (string-format + " ~D~% /~D" + (buzzer-count *game-info* (-> *level-task-data* lvl-idx task-info (-> *level-task-data* lvl-idx buzzer-task-index) task-id)) + (-> *game-counts* data lvl-idx buzzer-count) + ) + buf + string-x + (- string-y 5) + (font-color dark-yellow) + (font-flags shadow kerning large) + 0.8 + ) + ) + ) + (((hud-collectable-view original)) + ;; show original (flies collected this level) + (draw-string-xy + (string-format " ~D" (-> obj value)) + buf + string-x + string-y + (font-color dark-yellow) + (font-flags shadow kerning large) + ) + ) ) ) ) diff --git a/goal_src/jak1/engine/ui/hud-h.gc b/goal_src/jak1/engine/ui/hud-h.gc index 49a777bdd4..1a4bd9cc42 100644 --- a/goal_src/jak1/engine/ui/hud-h.gc +++ b/goal_src/jak1/engine/ui/hud-h.gc @@ -141,6 +141,15 @@ ) ) +;; added for pc port +(defenum hud-collectable-view + (original) + (game-totals) + (level-totals) + ) + +(define *hud-collectable-view* (hud-collectable-view original)) + 0 diff --git a/goal_src/jak1/engine/ui/text.gc b/goal_src/jak1/engine/ui/text.gc index 7b6ee437c3..b28e0668fa 100644 --- a/goal_src/jak1/engine/ui/text.gc +++ b/goal_src/jak1/engine/ui/text.gc @@ -327,35 +327,33 @@ (defun print-game-text-scaled ((str string) (scale float) (font-ctxt font-context) (alpha int)) "Print text, with a given scaling" - (let ((f26-0 (-> font-ctxt width)) - (f30-0 (-> font-ctxt height)) - (f24-0 (-> font-ctxt origin x)) - (f22-0 (-> font-ctxt origin y)) - (f28-0 (-> font-ctxt scale)) + (let ((orig-width (-> font-ctxt width)) + (orig-height (-> font-ctxt height)) + (orig-x (-> font-ctxt origin x)) + (orig-y (-> font-ctxt origin y)) + (orig-scale (-> font-ctxt scale)) ) - (let ((f0-1 (* (-> font-ctxt width) scale)) - (f1-2 (* (-> font-ctxt height) scale)) + (let ((scaled-width (* (-> font-ctxt width) scale)) + (scaled-height (* (-> font-ctxt height) scale)) ) - (if (logtest? (-> font-ctxt flags) 4) - (+! (-> font-ctxt origin x) (* 0.5 (- f26-0 f0-1))) + (if (logtest? (-> font-ctxt flags) (font-flags middle)) + (+! (-> font-ctxt origin x) (* 0.5 (- orig-width scaled-width))) ) - (if (logtest? (-> font-ctxt flags) 8) + (if (logtest? (-> font-ctxt flags) (font-flags left)) ;; this code is really weird. it does the divide with an int, but fails ;; to convert it back to a float before adding?? - (+! (-> font-ctxt origin y) (the-as float (/ (the int (- f30-0 f1-2)) 2))) + (+! (-> font-ctxt origin y) (the-as float (/ (the int (- orig-height scaled-height)) 2))) ) - (let ((v1-10 font-ctxt)) - (set! (-> v1-10 scale) (* f28-0 scale)) - ) - (set! (-> font-ctxt width) f0-1) - (set! (-> font-ctxt height) f1-2) + (set! (-> font-ctxt scale) (* orig-scale scale)) + (set! (-> font-ctxt width) scaled-width) + (set! (-> font-ctxt height) scaled-height) ) (print-game-text str font-ctxt #f alpha 22) - (set! (-> font-ctxt origin x) f24-0) - (set! (-> font-ctxt origin y) f22-0) - (set! (-> font-ctxt width) f26-0) - (set! (-> font-ctxt height) f30-0) - (set! (-> font-ctxt scale) f28-0) + (set! (-> font-ctxt origin x) orig-x) + (set! (-> font-ctxt origin y) orig-y) + (set! (-> font-ctxt width) orig-width) + (set! (-> font-ctxt height) orig-height) + (set! (-> font-ctxt scale) orig-scale) ) (none) ) From 7b25afa697e79aceb30176c68c1c45abc48ea8fc Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Sat, 20 Aug 2022 15:30:37 +0100 Subject: [PATCH 10/23] add a bunch of new cheat codes & re-do all pc cheat codes (#1770) * redo cheat encodings * fix error * add no texture cheat * tiny cleanup + add sidekick stats button * crappy implementation of big/small head mode * more correct bone scaling * redo bone manip code a bit * jp text fixes * improved matrix math! * add big fist cheat, minor type cleanup, add some debug toggles * move all this mess to a new file * slightly rework joint scaling function * add big head npc cheat * subtitles typo * WIP mirror mode * fix mirrored hud sprites * fix mirror mode sound pan * add cheats to menu! * split some subtitles --- decompiler/config/all-types.gc | 25 ++-- game/assets/game_text.gp | 2 - game/assets/jak1/subtitle/game_subtitle_en.gd | 47 ++++--- game/assets/jak1/text/game_text_en.gs | 20 ++- game/assets/jak1/text/game_text_ja.gs | 8 +- game/assets/jak1/text/text_patch_ja.gs | 10 -- game/graphics/gfx.h | 12 +- .../opengl_renderer/OpenGLRenderer.cpp | 4 +- game/graphics/opengl_renderer/Shader.cpp | 4 +- game/graphics/opengl_renderer/Shader.h | 2 +- .../background/background_common.cpp | 21 +-- .../opengl_renderer/foreground/Generic2.h | 1 + .../foreground/Generic2_OpenGL.cpp | 26 ++-- .../opengl_renderer/foreground/Merc2.cpp | 40 +++--- .../opengl_renderer/foreground/Merc2.h | 2 + .../opengl_renderer/shaders/generic.frag | 72 +++++++---- .../opengl_renderer/shaders/merc2.frag | 18 ++- .../opengl_renderer/shaders/shrub.frag | 10 +- .../opengl_renderer/shaders/shrub.vert | 1 + .../opengl_renderer/shaders/tfrag3.frag | 12 +- game/kernel/common/kmachine.cpp | 8 ++ game/kernel/common/kmachine.h | 1 + game/kernel/jak1/kmachine.cpp | 1 + goal_src/jak1/dgos/engine.gd | 1 + goal_src/jak1/dgos/game.gd | 1 + goal_src/jak1/engine/anim/joint-mod-h.gc | 40 +++--- goal_src/jak1/engine/anim/mspace-h.gc | 2 +- .../jak1/engine/common-obs/generic-obs.gc | 2 + .../engine/common-obs/process-drawable.gc | 22 +++- .../engine/common-obs/process-taskable.gc | 2 + goal_src/jak1/engine/debug/default-menu.gc | 19 +-- goal_src/jak1/engine/game/main.gc | 3 +- goal_src/jak1/engine/gfx/hw/display.gc | 4 +- goal_src/jak1/engine/gfx/math-camera.gc | 17 +-- goal_src/jak1/engine/gfx/sprite/sprite.gc | 11 +- goal_src/jak1/engine/math/matrix.gc | 2 +- goal_src/jak1/engine/ps2/pad.gc | 12 +- goal_src/jak1/engine/sound/gsound.gc | 7 + goal_src/jak1/engine/ui/text-h.gc | 7 + goal_src/jak1/game.gp | 3 +- goal_src/jak1/kernel-defs.gc | 4 + goal_src/jak1/pc/pckernel-h.gc | 95 ++++++++------ goal_src/jak1/pc/pckernel.gc | 71 ++++++---- goal_src/jak1/pc/progress-pc.gc | 42 +++--- goal_src/jak1/pc/util/pc-anim-util.gc | 122 ++++++++++++++++++ .../jak1/engine/anim/mspace-h_REF.gc | 2 +- .../jak1/engine/target/joint-mod-h_REF.gc | 29 ++--- 47 files changed, 587 insertions(+), 280 deletions(-) delete mode 100644 game/assets/jak1/text/text_patch_ja.gs create mode 100644 goal_src/jak1/pc/util/pc-anim-util.gc diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index d4ff86ae98..d9295e4f4a 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -1530,6 +1530,13 @@ (cheat-sky #x1097) (cheat-req-100-percent #x1098) (cheat-req-beat-game #x1099) + (cheat-big-head #x109a) + (cheat-small-head #x109b) + (cheat-big-fist #x109c) + (cheat-big-head-npc #x109d) + (cheat-no-tex #x109e) + (cheat-mirror #x109f) + (cheat-huge-head #x10a0) (music-player #x10c0) (scene-player #x10c1) (play-credits #x10c2) @@ -6579,7 +6586,7 @@ ;; - Types (deftype joint (basic) - ((name basic :offset-assert 4) + ((name string :offset-assert 4) (number int32 :offset-assert 8) (parent joint :offset-assert 12) (bind-pose matrix :inline :offset-assert 16) @@ -11422,8 +11429,8 @@ (up uint8 :offset-assert 136) (nose uint8 :offset-assert 137) (ear uint8 :offset-assert 138) - (shutting-down? basic :offset-assert 140) - (parented-scale? basic :offset 128) + (shutting-down? symbol :offset-assert 140) + (parented-scale? symbol :offset 128) ) :method-count-assert 16 :size-assert #x90 @@ -11436,7 +11443,7 @@ (reset-blend! (_type_) _type_ 12) (set-twist! (_type_ float float float) vector 13) (set-trs! (_type_ vector quaternion vector) none 14) - (shut-down! (_type_) float 15) + (shut-down! (_type_) none 15) ) ) @@ -11467,13 +11474,13 @@ (deftype joint-mod-set-local (basic) ((transform transformq :inline :offset-assert 16) - (set-rotation basic :offset-assert 64) - (set-scale basic :offset-assert 68) - (set-translation basic :offset-assert 72) - (enable basic :offset-assert 76) + (set-rotation symbol :offset-assert 64) + (set-scale symbol :offset-assert 68) + (set-translation symbol :offset-assert 72) + (enable symbol :offset-assert 76) ) (:methods - (new (symbol type process-drawable int basic basic basic) _type_) + (new (symbol type process-drawable int symbol symbol symbol) _type_) ) :method-count-assert 9 :size-assert #x50 diff --git a/game/assets/game_text.gp b/game/assets/game_text.gp index e671bb2ef0..9b48590ca0 100644 --- a/game/assets/game_text.gp +++ b/game/assets/game_text.gp @@ -6,8 +6,6 @@ (text ;; NOTE : we compile using the fixed v2 encoding because it's what we use. (file "$DECOMP/assets/game_text.txt") ;; this is the decompiler-generated file! - ;; "patch" files so we can fix some errors and perhaps maintain consistency - (file "game/assets/jak1/text/text_patch_ja.gs") ;; add custom files down here (file "game/assets/jak1/text/game_text_en.gs") (file "game/assets/jak1/text/game_text_de.gs") diff --git a/game/assets/jak1/subtitle/game_subtitle_en.gd b/game/assets/jak1/subtitle/game_subtitle_en.gd index b3312ae433..aa78cb1d20 100644 --- a/game/assets/jak1/subtitle/game_subtitle_en.gd +++ b/game/assets/jak1/subtitle/game_subtitle_en.gd @@ -56,7 +56,7 @@ (1329 "SAGE" "TO HAVE A CHANCE AT RETURNING YOU TO YOUR PREVIOUS FORM:") (1431 "SAGE" "GOL ACHERON, THE SAGE.") (1493) - (1496 :offscreen "SAGE" "BUT HE LIVES FAR TO THE NORTH. FAR, FAR TO NORTH.") + (1496 :offscreen "SAGE" "BUT HE LIVES FAR TO THE NORTH. FAR, FAR TO THE NORTH.") (1639 :offscreen "SAGE" "NOBODY HAS SPOKEN TO HIM IN AGES.") (1718 "SAGE" "I WOULD TELEPORT YOU THERE, BUT I CAN'T DO THAT EITHER.") (1831 "SAGE" "NONE OF THE THREE SAGES THAT MAINTAIN THE OTHER TELEPORTER GATES") @@ -918,13 +918,15 @@ ) ("sagevb01" :hint #x288 - (0 "SAGE" "WELL, I SEE THAT YOU TWO HAVE FINALLY DECIDED TO UNBLOCK MY COLLECTORS.") + (0 "SAGE" "WELL, I SEE THAT YOU TWO HAVE FINALLY") + (163 "SAGE" "DECIDED TO UNBLOCK MY COLLECTORS.") (347) - (352 "SAGE" "I WOULD OFFER MY CONGRATULATIONS, BUT YOU HAVE SO MUCH TO DO I WON'T WASTE YOUR TIME.") + (352 "SAGE" "I WOULD OFFER MY CONGRATULATIONS") + (493 "SAGE" "BUT YOU HAVE SO MUCH TO DO I WON'T WASTE YOUR TIME.") (705) (712 "SAGE" "BY THE WAY, IF THINGS DON'T WORK OUT,") (884 "SAGE" "DAXTER COULD ALWAYS GET A JOB CONTROLLING THE VILLAGE RAT PROBLEM.") - (1116 "SAGE" "NYEH HA HA HA HA.") + (1116 "SAGE" "NYEH HA HA HA HA HA.") ) ("sksp0443" :hint #x2af (0 "DAXTER" "PUNCH THOSE POLES UP FROM BELOW!")) @@ -1602,7 +1604,7 @@ ("asstvb20" :hint #x327 (40 "KEIRA" "GOOD FLYING! THOSE LURKERS WERE NO MATCH FOR YOUR ZOOMER!") - (298 "KEIRA" "THAT'S ONE MORE POWER CELL!") + (295 "KEIRA" "THAT'S ONE MORE POWER CELL!") ) ("asstvb21" :hint #x328 @@ -1613,8 +1615,11 @@ ) ("sagevb03" :hint #x36a - (0 "SAGE" "YOU KEEP ON IMPRESSING ME. BUT THEN MAYBE IT'S JUST BECAUSE I'VE GOT LOW EXPECTATIONS.") - (420 "SAGE" "OKAY, YOUR MOMENT OF GLOATING IS OVER. GET ON WITH IT!") + (0 "SAGE" "YOU KEEP ON IMPRESSING ME. BUT THEN MAYBE IT'S JUST BECAUSE") + (226 "SAGE" "I'VE GOT LOW EXPECTATIONS.") + (420 "SAGE" "OKAY, YOUR MOMENT OF GLOATING IS OVER.") + (598) + (613 "SAGE" "GET ON WITH IT!") ) ("sagevb04" :hint #x36b @@ -1792,7 +1797,12 @@ ("sksp0113" :hint #x339 (0 "DAXTER" "THOSE MUST BE THE INFESTED PLANTS OL' LOG-NOGGIN WAS TALKIN' ABOUT.")) ("sksp0114" :hint #x33a (0 "DAXTER" "WE HAVE TO USE GREEN ECO TO CURE THOSE PLANTS.")) ("sksp0115" :hint #x33b (0 "DAXTER" "JAK, DRIVE THROUGH THE GREEN ECO VENT.")) -("sksp0116" :hint #x33c (0 "DAXTER" "THAT'S ONE OF THOSE FLYING LURKERS! HE MIGHT HAVE A POWER CELL!")) + +("sksp0116" :hint #x33c + (0 "DAXTER" "THAT'S ONE OF THOSE FLYING LURKERS!") + (103 "DAXTER" "HE MIGHT HAVE A POWER CELL!") + ) + ("sksp0117" :hint #x33d (0 "DAXTER" "THERE'S THE MOLE HOLE!")) ("sksp0118" :hint #x33e (0 "DAXTER" "NOW, LET'S FLY OVER THE INFECTED PLANTS!")) ("sksp0119" :hint #x33f (0 "DAXTER" "ONE RING DOWN, A BUNCH TO GO!")) @@ -1999,10 +2009,11 @@ (418) (441 "OLD MAN" "HA HA HA HA HA!") (500) - (528 "OLD MAN" "I'D HARDLY CALL IT \"STRUGGLE.\" WOULD YOU, DEAR SISTER?") + (528 "OLD MAN" "I'D HARDLY CALL IT \"STRUGGLE.\"") + (618 "OLD MAN" "WOULD YOU, DEAR SISTER?") (672 "WOMAN" "CERTAINLY NOT. THE RED SAGE GAVE UP WITH SO LITTLE EFFORT.") - (799) - (806 "WOMAN" "NO FUN AT ALL.") + (800) + (805 "WOMAN" "NO FUN AT ALL.") (860) (884 "SAGE" "GOL? IS THAT YOU?") (965) @@ -2021,7 +2032,7 @@ (2212) (2223 "SAGE" "YOU CAN'T CONTROL DARK ECO BY ITSELF! EVEN THE PRECURSORS COULDN'T-") (2357 "MAIA" "UNTIL NOW, WE'VE HAD TO SCRAPE BY WITH WHAT LITTLE DARK ECO") - (2457 "MAIA" "WE COULD FIND NEAR THE SURFACE.") + (2452 "MAIA" "WE COULD FIND NEAR THE SURFACE.") (2508) (2520 "MAIA" "BUT SOON, WE WILL HAVE ACCESS TO THE VAST STORES") (2611 "MAIA" "OF DARK ECO HIDDEN DEEP UNDERGROUND.") @@ -2031,9 +2042,10 @@ (2841 "GOL" "THEY WILL BE OPENED, AND ALL THE DARK ECO IN THE WORLD WILL BE OURS!") (3028) (3034 "SAGE" "BUT THAT'S IMPOSSIBLE! ONLY A PRECURSOR ROBOT-") - (3128 "MAIA" "OH, DON'T LOOK SO UPSET, SAMOS. WE'VE GOT BIG PLANS FOR YOU.") + (3128 "MAIA" "OH, DON'T LOOK SO UPSET, SAMOS.") + (3210 "MAIA" "WE'VE GOT BIG PLANS FOR YOU.") (3300) - (3303 :offscreen "MAIA" "AH HA HA HA HA HA HA! AH...") + (3303 :offscreen "MAIA" "AH HA HA HA HA HA HA! AHH...") (3460) (3495 "DAXTER" "WAIT A MINUTE!") (3538) @@ -2050,7 +2062,8 @@ (3995 "SAGE" "TWIST AND DESTROY EVERYTHING IT TOUCHES!") (4080 "SAGE" "WE SIMPLY MUST GET TO THEIR CITADEL, TO STOP THEM!") (4189) - (4192 "KEIRA" "THE FASTEST WAY THERE IS THROUGH THE LAVA TUBE AT THE BOTTOM OF THIS CRATER.") + (4192 "KEIRA" "THE FASTEST WAY THERE IS THROUGH THE LAVA TUBE") + (4276 "KEIRA" "AT THE BOTTOM OF THIS CRATER.") (4316) (4324 "KEIRA" "A FEW MORE POWER CELLS, AND YOUR ZOOMER'S HEAT SHIELD") (4398 "KEIRA" "SHOULD GET YOU ACROSS THE LAVA SAFELY.") @@ -2087,8 +2100,8 @@ (158 :offscreen "SAGE" "APPARENTLY THEY'VE DISCOVERED, AND ARE NOW TRYING TO REMOVE,") (270 :offscreen "SAGE" "SOME DARK ECO STORES FROZEN IN THE GLACIERS.") (378) - (381 "SAGE" "WHILE YOU'RE UP THERE POKING AROUND FOR POWER CELLS, STOP THOSE LURKERS,") - (537 "SAGE" "AND KEEP A LITTLE MORE DARK ECO OUT OF GOL'S HANDS.") + (381 "SAGE" "WHILE YOU'RE UP THERE POKING AROUND FOR POWER CELLS") + (490 "SAGE" "STOP THOSE LURKERS, AND KEEP A LITTLE MORE DARK ECO OUT OF GOL'S HANDS.") (660) ) diff --git a/game/assets/jak1/text/game_text_en.gs b/game/assets/jak1/text/game_text_en.gs index 40a0364618..063361e547 100644 --- a/game/assets/jak1/text/game_text_en.gs +++ b/game/assets/jak1/text/game_text_en.gs @@ -167,8 +167,8 @@ "CHEATS") (#x1081 "SECRETS" "SECRETS") -(#x1082 "SELECT LEVEL" - "SELECT LEVEL") +(#x1082 "SELECT TRACK" + "SELECT TRACK") (#x1083 "SELECT FLAVOR" "SELECT FLAVOUR") (#x1084 "FINAL BOSS" @@ -204,6 +204,20 @@ "REACH 100% COMPLETION") (#x1099 "BEAT THE GAME" "BEAT THE GAME") +(#x109a "BIG HEAD JAK" + "BIG HEAD JAK") +(#x109b "SMALL HEAD JAK" + "SMALL HEAD JAK") +(#x109c "BIG FIST JAK" + "BIG FIST JAK") +(#x109d "BIG HEAD CHARACTERS" + "BIG HEAD CHARACTERS") +(#x109e "NO TEXTURES MODE" + "NO TEXTURES MODE") +(#x109f "MIRRORED WORLD" + "MIRRORED WORLD") +(#x10a0 "HUGE HEAD JAK" + "HUGE HEAD JAK") (#x10c0 "MUSIC PLAYER" "MUSIC PLAYER") @@ -343,7 +357,7 @@ "NORSK") ;; ----------------- -;; test +;; test (DO NOT TRANSLATE) (#x7fff "ARMOR" diff --git a/game/assets/jak1/text/game_text_ja.gs b/game/assets/jak1/text/game_text_ja.gs index 358e76b161..3c3acae46b 100644 --- a/game/assets/jak1/text/game_text_ja.gs +++ b/game/assets/jak1/text/game_text_ja.gs @@ -12,9 +12,9 @@ (#x107f "ヒントロッグ") (#x1080 "チート") (#x1081 "シークレット") -(#x1082 "レベルをセレクトください") +(#x1082 "きょくをセレクトください") (#x1083 "へんかをセレクトください") -(#x1084 "ラスボス") +(#x1084 "チューンドプリカーソルロボット") (#x1085 "スタッフロール") (#x1086 "?????") (#x1087 "ハイブリッドラーカー クロウ") @@ -68,8 +68,8 @@ (#x1101 "赤の賢者") (#x1102 "青の賢者") (#x1103 "城のハブ") -(#x1104 "ラスボスの中かん") -(#x1105 "ラスボスのけつまつ") +(#x1104 "プリカーソルロボットの中かん") +(#x1105 "プリカーソルロボットのけつまつ") diff --git a/game/assets/jak1/text/text_patch_ja.gs b/game/assets/jak1/text/text_patch_ja.gs deleted file mode 100644 index f09aae93ff..0000000000 --- a/game/assets/jak1/text/text_patch_ja.gs +++ /dev/null @@ -1,10 +0,0 @@ -(group-name "common") -(language-id 5) -(text-version jak1-v2) - -;; ----------------- -;; fixes - - ; 闇の眷者 ゴルとマイアの城 -(#x122 "闇の賢者 ゴルとマイアの城") -(#x801 "闇の賢者 ゴルとマイアの城") diff --git a/game/graphics/gfx.h b/game/graphics/gfx.h index 5d61f78060..4ec8f72ce6 100644 --- a/game/graphics/gfx.h +++ b/game/graphics/gfx.h @@ -90,10 +90,6 @@ struct GfxGlobalSettings { int lod_tfrag = 0; int lod_tie = 0; - // collision renderer settings - bool collision_enable = false; - bool collision_wireframe = true; - // vsync enable bool vsync = true; bool old_vsync = false; @@ -102,9 +98,17 @@ struct GfxGlobalSettings { // use custom frame limiter bool framelimiter = true; + // frame timing things bool experimental_accurate_lag = false; bool sleep_in_frame_limiter = true; + // fancy effect things + bool hack_no_tex = false; + + // collision renderer settings + bool collision_enable = false; + bool collision_wireframe = true; + // matching enum in kernel-defs.gc !! enum CollisionRendererMode { None, Mode, Event, Material, Skip } collision_mode = Mode; std::array collision_mode_mask = {UINT32_MAX}; diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index d1119571cc..5fe6164724 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -614,8 +614,8 @@ void OpenGLRenderer::setup_frame(const RenderOptions& settings) { if (m_render_state.draw_region_w <= 0 || m_render_state.draw_region_h <= 0) { // trying to draw to 0 size region... opengl doesn't like this. - m_render_state.draw_region_w = 640; - m_render_state.draw_region_h = 480; + m_render_state.draw_region_w = 320; + m_render_state.draw_region_h = 240; } if (m_fbo_state.render_fbo->is_window) { diff --git a/game/graphics/opengl_renderer/Shader.cpp b/game/graphics/opengl_renderer/Shader.cpp index 0444299947..9c1990e6f6 100644 --- a/game/graphics/opengl_renderer/Shader.cpp +++ b/game/graphics/opengl_renderer/Shader.cpp @@ -61,7 +61,7 @@ Shader::Shader(const std::string& shader_name) { m_is_okay = true; } -void Shader::activate() { +void Shader::activate() const { ASSERT(m_is_okay); glUseProgram(m_program); } @@ -93,6 +93,6 @@ ShaderLibrary::ShaderLibrary() { at(ShaderId::DEPTH_CUE) = {"depth_cue"}; for (auto& shader : m_shaders) { - ASSERT_MSG(shader.okay(), "Shader compiled"); + ASSERT_MSG(shader.okay(), "error compiling shader"); } } diff --git a/game/graphics/opengl_renderer/Shader.h b/game/graphics/opengl_renderer/Shader.h index 7e1fdbedaa..f48f629662 100644 --- a/game/graphics/opengl_renderer/Shader.h +++ b/game/graphics/opengl_renderer/Shader.h @@ -9,7 +9,7 @@ class Shader { static constexpr char shader_folder[] = "game/graphics/opengl_renderer/shaders/"; Shader(const std::string& shader_name); Shader() = default; - void activate(); + void activate() const; bool okay() const { return m_is_okay; } u64 id() const { return m_program; } diff --git a/game/graphics/opengl_renderer/background/background_common.cpp b/game/graphics/opengl_renderer/background/background_common.cpp index 02a983c1a3..168badf275 100644 --- a/game/graphics/opengl_renderer/background/background_common.cpp +++ b/game/graphics/opengl_renderer/background/background_common.cpp @@ -149,17 +149,18 @@ DoubleDraw setup_tfrag_shader(SharedRenderState* render_state, DrawMode mode, Sh void first_tfrag_draw_setup(const TfragRenderSettings& settings, SharedRenderState* render_state, ShaderId shader) { - render_state->shaders[shader].activate(); - auto shid = render_state->shaders[shader].id(); - glUniform1i(glGetUniformLocation(shid, "tex_T0"), 0); - glUniformMatrix4fv(glGetUniformLocation(shid, "camera"), 1, GL_FALSE, - settings.math_camera.data()); - glUniform4f(glGetUniformLocation(shid, "hvdf_offset"), settings.hvdf_offset[0], + const auto& sh = render_state->shaders[shader]; + sh.activate(); + auto id = sh.id(); + glUniform1i(glGetUniformLocation(id, "gfx_hack_no_tex"), Gfx::g_global_settings.hack_no_tex); + glUniform1i(glGetUniformLocation(id, "tex_T0"), 0); + glUniformMatrix4fv(glGetUniformLocation(id, "camera"), 1, GL_FALSE, settings.math_camera.data()); + glUniform4f(glGetUniformLocation(id, "hvdf_offset"), settings.hvdf_offset[0], settings.hvdf_offset[1], settings.hvdf_offset[2], settings.hvdf_offset[3]); - glUniform1f(glGetUniformLocation(shid, "fog_constant"), settings.fog.x()); - glUniform1f(glGetUniformLocation(shid, "fog_min"), settings.fog.y()); - glUniform1f(glGetUniformLocation(shid, "fog_max"), settings.fog.z()); - glUniform4f(glGetUniformLocation(shid, "fog_color"), render_state->fog_color[0] / 255.f, + glUniform1f(glGetUniformLocation(id, "fog_constant"), settings.fog.x()); + glUniform1f(glGetUniformLocation(id, "fog_min"), settings.fog.y()); + glUniform1f(glGetUniformLocation(id, "fog_max"), settings.fog.z()); + glUniform4f(glGetUniformLocation(id, "fog_color"), render_state->fog_color[0] / 255.f, render_state->fog_color[1] / 255.f, render_state->fog_color[2] / 255.f, render_state->fog_intensity / 255); } diff --git a/game/graphics/opengl_renderer/foreground/Generic2.h b/game/graphics/opengl_renderer/foreground/Generic2.h index 59a7471507..76e1d5da37 100644 --- a/game/graphics/opengl_renderer/foreground/Generic2.h +++ b/game/graphics/opengl_renderer/foreground/Generic2.h @@ -198,5 +198,6 @@ class Generic2 : public BucketRenderer { GLuint index_buffer; GLuint alpha_reject, color_mult, fog_color, scale, mat_23, mat_32, mat_33, fog_consts, hvdf_offset; + GLuint gfx_hack_no_tex; } m_ogl; }; diff --git a/game/graphics/opengl_renderer/foreground/Generic2_OpenGL.cpp b/game/graphics/opengl_renderer/foreground/Generic2_OpenGL.cpp index 21382011fe..e76a39868e 100644 --- a/game/graphics/opengl_renderer/foreground/Generic2_OpenGL.cpp +++ b/game/graphics/opengl_renderer/foreground/Generic2_OpenGL.cpp @@ -63,17 +63,21 @@ void Generic2::opengl_cleanup() { } void Generic2::init_shaders(ShaderLibrary& shaders) { - shaders[ShaderId::GENERIC].activate(); - m_ogl.alpha_reject = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "alpha_reject"); - m_ogl.color_mult = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "color_mult"); - m_ogl.fog_color = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "fog_color"); + const auto& shader = shaders[ShaderId::GENERIC]; + auto id = shader.id(); - m_ogl.scale = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "scale"); - m_ogl.mat_23 = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "mat_23"); - m_ogl.mat_32 = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "mat_32"); - m_ogl.mat_33 = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "mat_33"); - m_ogl.fog_consts = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "fog_constants"); - m_ogl.hvdf_offset = glGetUniformLocation(shaders[ShaderId::GENERIC].id(), "hvdf_offset"); + shader.activate(); + m_ogl.alpha_reject = glGetUniformLocation(id, "alpha_reject"); + m_ogl.color_mult = glGetUniformLocation(id, "color_mult"); + m_ogl.fog_color = glGetUniformLocation(id, "fog_color"); + + m_ogl.scale = glGetUniformLocation(id, "scale"); + m_ogl.mat_23 = glGetUniformLocation(id, "mat_23"); + m_ogl.mat_32 = glGetUniformLocation(id, "mat_32"); + m_ogl.mat_33 = glGetUniformLocation(id, "mat_33"); + m_ogl.fog_consts = glGetUniformLocation(id, "fog_constants"); + m_ogl.hvdf_offset = glGetUniformLocation(id, "hvdf_offset"); + m_ogl.gfx_hack_no_tex = glGetUniformLocation(id, "gfx_hack_no_tex"); } void Generic2::opengl_bind_and_setup_proj(SharedRenderState* render_state) { @@ -90,6 +94,7 @@ void Generic2::opengl_bind_and_setup_proj(SharedRenderState* render_state) { m_drawing_config.fog_max); glUniform4f(m_ogl.hvdf_offset, m_drawing_config.hvdf_offset[0], m_drawing_config.hvdf_offset[1], m_drawing_config.hvdf_offset[2], m_drawing_config.hvdf_offset[3]); + glUniform1i(m_ogl.gfx_hack_no_tex, Gfx::g_global_settings.hack_no_tex); } void Generic2::setup_opengl_for_draw_mode(const DrawMode& draw_mode, @@ -317,6 +322,7 @@ void Generic2::do_draws(SharedRenderState* render_state, ScopedProfilerNode& pro glUniform1f(m_ogl.mat_23, m_drawing_config.hud_mat_23); glUniform1f(m_ogl.mat_32, m_drawing_config.hud_mat_32); glUniform1f(m_ogl.mat_33, m_drawing_config.hud_mat_33); + glUniform1i(m_ogl.gfx_hack_no_tex, false); do_hud_draws(render_state, prof); } diff --git a/game/graphics/opengl_renderer/foreground/Merc2.cpp b/game/graphics/opengl_renderer/foreground/Merc2.cpp index 3ba76b6328..0af7fc6a72 100644 --- a/game/graphics/opengl_renderer/foreground/Merc2.cpp +++ b/game/graphics/opengl_renderer/foreground/Merc2.cpp @@ -73,6 +73,7 @@ void Merc2::init_for_frame(SharedRenderState* render_state) { glUniform4f(m_uniforms.fog_color, render_state->fog_color[0] / 255.f, render_state->fog_color[1] / 255.f, render_state->fog_color[2] / 255.f, render_state->fog_intensity / 255); + glUniform1i(m_uniforms.gfx_hack_no_tex, Gfx::g_global_settings.hack_no_tex); } void Merc2::draw_debug_window() { @@ -86,28 +87,31 @@ void Merc2::draw_debug_window() { } void Merc2::init_shaders(ShaderLibrary& shaders) { + const auto& shader = shaders[ShaderId::MERC2]; + auto id = shader.id(); shaders[ShaderId::MERC2].activate(); - m_uniforms.light_direction[0] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "light_dir0"); - m_uniforms.light_direction[1] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "light_dir1"); - m_uniforms.light_direction[2] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "light_dir2"); - m_uniforms.light_color[0] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "light_col0"); - m_uniforms.light_color[1] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "light_col1"); - m_uniforms.light_color[2] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "light_col2"); - m_uniforms.light_ambient = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "light_ambient"); + m_uniforms.light_direction[0] = glGetUniformLocation(id, "light_dir0"); + m_uniforms.light_direction[1] = glGetUniformLocation(id, "light_dir1"); + m_uniforms.light_direction[2] = glGetUniformLocation(id, "light_dir2"); + m_uniforms.light_color[0] = glGetUniformLocation(id, "light_col0"); + m_uniforms.light_color[1] = glGetUniformLocation(id, "light_col1"); + m_uniforms.light_color[2] = glGetUniformLocation(id, "light_col2"); + m_uniforms.light_ambient = glGetUniformLocation(id, "light_ambient"); - m_uniforms.hvdf_offset = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "hvdf_offset"); - m_uniforms.perspective[0] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "perspective0"); - m_uniforms.perspective[1] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "perspective1"); - m_uniforms.perspective[2] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "perspective2"); - m_uniforms.perspective[3] = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "perspective3"); + m_uniforms.hvdf_offset = glGetUniformLocation(id, "hvdf_offset"); + m_uniforms.perspective[0] = glGetUniformLocation(id, "perspective0"); + m_uniforms.perspective[1] = glGetUniformLocation(id, "perspective1"); + m_uniforms.perspective[2] = glGetUniformLocation(id, "perspective2"); + m_uniforms.perspective[3] = glGetUniformLocation(id, "perspective3"); - m_uniforms.fog = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "fog_constants"); - m_uniforms.decal = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "decal_enable"); + m_uniforms.fog = glGetUniformLocation(id, "fog_constants"); + m_uniforms.decal = glGetUniformLocation(id, "decal_enable"); - m_uniforms.fog_color = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "fog_color"); - m_uniforms.perspective_matrix = - glGetUniformLocation(shaders[ShaderId::MERC2].id(), "perspective_matrix"); - m_uniforms.ignore_alpha = glGetUniformLocation(shaders[ShaderId::MERC2].id(), "ignore_alpha"); + m_uniforms.fog_color = glGetUniformLocation(id, "fog_color"); + m_uniforms.perspective_matrix = glGetUniformLocation(id, "perspective_matrix"); + m_uniforms.ignore_alpha = glGetUniformLocation(id, "ignore_alpha"); + + m_uniforms.gfx_hack_no_tex = glGetUniformLocation(id, "gfx_hack_no_tex"); } /*! diff --git a/game/graphics/opengl_renderer/foreground/Merc2.h b/game/graphics/opengl_renderer/foreground/Merc2.h index 27f9265431..8b1dbeb093 100644 --- a/game/graphics/opengl_renderer/foreground/Merc2.h +++ b/game/graphics/opengl_renderer/foreground/Merc2.h @@ -98,6 +98,8 @@ class Merc2 : public BucketRenderer { GLuint ignore_alpha; GLuint decal; + + GLuint gfx_hack_no_tex; } m_uniforms; GLuint m_vao; diff --git a/game/graphics/opengl_renderer/shaders/generic.frag b/game/graphics/opengl_renderer/shaders/generic.frag index 8642942ded..8fc81f16d9 100644 --- a/game/graphics/opengl_renderer/shaders/generic.frag +++ b/game/graphics/opengl_renderer/shaders/generic.frag @@ -12,6 +12,8 @@ in vec4 fragment_color; in flat uvec2 tex_info; +uniform int gfx_hack_no_tex; + layout (binding = 0) uniform sampler2D tex_T0; layout (binding = 1) uniform sampler2D tex_T1; layout (binding = 2) uniform sampler2D tex_T2; @@ -42,32 +44,56 @@ vec4 sample_tex(vec2 coord, uint unit) { } void main() { - vec4 T0 = sample_tex(tex_coord.xy, tex_info.x); - // y is tcc - // z is decal + // 0x1 is tcc + // 0x2 is decal + // 0x4 is fog - if ((tex_info.y & 1u) == 0) { - if ((tex_info.y & 2u) == 0) { - // modulate + no tcc - color.xyz = fragment_color.xyz * T0.xyz; - color.w = fragment_color.w; - } else { - // decal + no tcc - color.xyz = T0.xyz * 0.5; - color.w = fragment_color.w; - } + if (gfx_hack_no_tex == 0) { + vec4 T0 = sample_tex(tex_coord.xy, tex_info.x); + if ((tex_info.y & 1u) == 0) { + if ((tex_info.y & 2u) == 0) { + // modulate + no tcc + color.rgb = fragment_color.rgb * T0.rgb; + color.a = fragment_color.a; + } else { + // decal + no tcc + color.rgb = T0.rgb * 0.5; + color.a = fragment_color.a; + } + } else { + if ((tex_info.y & 2u) == 0) { + // modulate + tcc + color = fragment_color * T0; + } else { + // decal + tcc + color.rgb = T0.rgb * 0.5; + color.a = T0.a; + } + } + color *= 2; } else { - if ((tex_info.y & 2u) == 0) { - // modulate + tcc - color = fragment_color * T0; - } else { - // decal + tcc - color.xyz = T0.xyz * 0.5; - color.w = T0.w; - } + if ((tex_info.y & 1u) == 0) { + if ((tex_info.y & 2u) == 0) { + // modulate + no tcc + color.rgb = fragment_color.rgb; + color.a = fragment_color.a * 2; + } else { + // decal + no tcc + color.rgb = vec3(1); + color.a = fragment_color.a * 2; + } + } else { + if ((tex_info.y & 2u) == 0) { + // modulate + tcc + color = fragment_color; + } else { + // decal + tcc + color.rgb = vec3(0.5); + color.a = 1.0; + } + } } - color *= 2; - color.xyz *= color_mult; + color.rgb *= color_mult; if (color.a < alpha_reject) { discard; diff --git a/game/graphics/opengl_renderer/shaders/merc2.frag b/game/graphics/opengl_renderer/shaders/merc2.frag index ab461cbba2..1a261ae134 100644 --- a/game/graphics/opengl_renderer/shaders/merc2.frag +++ b/game/graphics/opengl_renderer/shaders/merc2.frag @@ -13,17 +13,23 @@ uniform int ignore_alpha; uniform int decal_enable; +uniform int gfx_hack_no_tex; void main() { - vec4 T0 = texture(tex_T0, vtx_st); + if (gfx_hack_no_tex == 0) { + vec4 T0 = texture(tex_T0, vtx_st); - if (decal_enable == 0) { - color.xyz = vtx_color * T0.xyz; + if (decal_enable == 0) { + color.rgb = vtx_color * T0.rgb; + } else { + color.rgb = T0.rgb * 0.5; + } + color.a = T0.a; + color *= 2; } else { - color.xyz = T0.xyz * 0.5; + color.rgb = vtx_color; + color.a = 1; } - color.w = T0.w; - color *= 2; if (ignore_alpha == 0 && color.w < 0.128) { diff --git a/game/graphics/opengl_renderer/shaders/shrub.frag b/game/graphics/opengl_renderer/shaders/shrub.frag index aafd4e9e63..3fda310119 100644 --- a/game/graphics/opengl_renderer/shaders/shrub.frag +++ b/game/graphics/opengl_renderer/shaders/shrub.frag @@ -11,9 +11,15 @@ uniform float alpha_min; uniform float alpha_max; uniform vec4 fog_color; +uniform int gfx_hack_no_tex; + void main() { - vec4 T0 = texture(tex_T0, tex_coord.xy / 4096.f); - color = fragment_color * T0; + if (gfx_hack_no_tex == 0) { + vec4 T0 = texture(tex_T0, tex_coord.xy); + color = fragment_color * T0; + } else { + color = fragment_color; + } if (color.a < alpha_min || color.a > alpha_max) { discard; diff --git a/game/graphics/opengl_renderer/shaders/shrub.vert b/game/graphics/opengl_renderer/shaders/shrub.vert index b84897eda4..368fdf08b8 100644 --- a/game/graphics/opengl_renderer/shaders/shrub.vert +++ b/game/graphics/opengl_renderer/shaders/shrub.vert @@ -75,4 +75,5 @@ void main() { fragment_color.a *= 2; tex_coord = tex_coord_in; + tex_coord.xy /= 4096; } diff --git a/game/graphics/opengl_renderer/shaders/tfrag3.frag b/game/graphics/opengl_renderer/shaders/tfrag3.frag index 379482da8d..a0e25d8c5f 100644 --- a/game/graphics/opengl_renderer/shaders/tfrag3.frag +++ b/game/graphics/opengl_renderer/shaders/tfrag3.frag @@ -11,10 +11,16 @@ uniform float alpha_min; uniform float alpha_max; uniform vec4 fog_color; +uniform int gfx_hack_no_tex; + void main() { - //vec4 T0 = texture(tex_T0, tex_coord); - vec4 T0 = texture(tex_T0, tex_coord.xy); - color = fragment_color * T0; + if (gfx_hack_no_tex == 0) { + //vec4 T0 = texture(tex_T0, tex_coord); + vec4 T0 = texture(tex_T0, tex_coord.xy); + color = fragment_color * T0; + } else { + color = fragment_color/2; + } if (color.a < alpha_min || color.a > alpha_max) { discard; diff --git a/game/kernel/common/kmachine.cpp b/game/kernel/common/kmachine.cpp index 83a8da9a83..e665602ece 100644 --- a/game/kernel/common/kmachine.cpp +++ b/game/kernel/common/kmachine.cpp @@ -461,6 +461,14 @@ u32 get_collision_mask(GfxGlobalSettings::CollisionRendererMode mode, int mask) : s7.offset; } +void set_gfx_hack(u64 which, u32 symptr) { + switch (which) { + case 0: // no tex + Gfx::g_global_settings.hack_no_tex = symptr != s7.offset; + break; + } +} + /*! * PC PORT FUNCTIONS END */ diff --git a/game/kernel/common/kmachine.h b/game/kernel/common/kmachine.h index 1eb1229f70..d84dbeaa86 100644 --- a/game/kernel/common/kmachine.h +++ b/game/kernel/common/kmachine.h @@ -74,5 +74,6 @@ void set_collision(u32 symptr); void set_collision_wireframe(u32 symptr); void set_collision_mask(GfxGlobalSettings::CollisionRendererMode mode, int mask, u32 symptr); u32 get_collision_mask(GfxGlobalSettings::CollisionRendererMode mode, int mask); +void set_gfx_hack(u64 which, u32 symptr); u32 offset_of_s7(); void vif_interrupt_callback(); diff --git a/game/kernel/jak1/kmachine.cpp b/game/kernel/jak1/kmachine.cpp index 019733fceb..6bf3c6f78a 100644 --- a/game/kernel/jak1/kmachine.cpp +++ b/game/kernel/jak1/kmachine.cpp @@ -639,6 +639,7 @@ void InitMachine_PCPort() { make_function_symbol_from_c("pc-get-collision-mask", (void*)get_collision_mask); make_function_symbol_from_c("pc-set-collision-wireframe", (void*)set_collision_wireframe); make_function_symbol_from_c("pc-set-collision", (void*)set_collision); + make_function_symbol_from_c("pc-set-gfx-hack", (void*)set_gfx_hack); // file related functions make_function_symbol_from_c("pc-filepath-exists?", (void*)filepath_exists); diff --git a/goal_src/jak1/dgos/engine.gd b/goal_src/jak1/dgos/engine.gd index bdcb904960..4a0bc6228c 100644 --- a/goal_src/jak1/dgos/engine.gd +++ b/goal_src/jak1/dgos/engine.gd @@ -196,6 +196,7 @@ ("game-info.o" "game-info") ("game-save.o" "game-save") ("settings.o" "settings") + ("pc-anim-util.o" "pc-anim-util") ;; added ("pckernel.o" "pckernel") ;; added ("mood-tables.o" "mood-tables") ("mood.o" "mood") diff --git a/goal_src/jak1/dgos/game.gd b/goal_src/jak1/dgos/game.gd index 15c245e5d8..3b6b83adfb 100644 --- a/goal_src/jak1/dgos/game.gd +++ b/goal_src/jak1/dgos/game.gd @@ -192,6 +192,7 @@ ("game-info.o" "game-info") ("game-save.o" "game-save") ("settings.o" "settings") + ("pc-anim-util.o" "pc-anim-util") ;; added ("pckernel.o" "pckernel") ;; added ("mood-tables.o" "mood-tables") ("mood.o" "mood") diff --git a/goal_src/jak1/engine/anim/joint-mod-h.gc b/goal_src/jak1/engine/anim/joint-mod-h.gc index bf53db9d33..087f10ab5a 100644 --- a/goal_src/jak1/engine/anim/joint-mod-h.gc +++ b/goal_src/jak1/engine/anim/joint-mod-h.gc @@ -49,8 +49,8 @@ (up uint8 :offset-assert 136) (nose uint8 :offset-assert 137) (ear uint8 :offset-assert 138) - (shutting-down? basic :offset-assert 140) - (parented-scale? basic :offset 128) + (shutting-down? symbol :offset-assert 140) + (parented-scale? symbol :offset 128) ) :method-count-assert 16 :size-assert #x90 @@ -63,7 +63,7 @@ (reset-blend! (_type_) _type_ 12) (set-twist! (_type_ float float float) vector 13) (set-trs! (_type_ vector quaternion vector) none 14) - (shut-down! (_type_) float 15) + (shut-down! (_type_) none 15) ) ) @@ -161,10 +161,8 @@ (defmethod shut-down! joint-mod ((obj joint-mod)) "Shut down and set the blend to zero." (set! (-> obj shutting-down?) #t) - (let ((f0-0 0.0)) - (set! (-> obj blend) f0-0) - f0-0 - ) + (set! (-> obj blend) 0.0) + (none) ) (defmethod set-twist! joint-mod ((obj joint-mod) (x float) (y float) (z float)) @@ -178,14 +176,14 @@ (defmethod set-trs! joint-mod ((obj joint-mod) (trans vector) (rot quaternion) (scale vector)) "Set the translation, rotation, and scale." (if trans - (set! (-> obj trans quad) (-> trans quad)) - ) + (set! (-> obj trans quad) (-> trans quad)) + ) (if rot - (quaternion-copy! (-> obj quat) rot) - ) + (quaternion-copy! (-> obj quat) rot) + ) (if scale - (set! (-> obj scale quad) (-> scale quad)) - ) + (set! (-> obj scale quad) (-> scale quad)) + ) (none) ) @@ -225,8 +223,8 @@ (defmethod look-at-enemy! joint-mod ((obj joint-mod) (target-trans vector) (option symbol) (proc process)) "Set up animation for Jak looking at an enemy. If option is 'attacking, remember when this happened. - Will only override an existing look-at if this one is closer, or option is 'force. - " + Will only override an existing look-at if this one is closer, or option is 'force." + (when (= option 'attacking) ;; make sure we got a process-drawable (let* ((s3-0 proc) @@ -725,16 +723,16 @@ (deftype joint-mod-set-local (basic) ((transform transformq :inline :offset-assert 16) - (set-rotation basic :offset-assert 64) - (set-scale basic :offset-assert 68) - (set-translation basic :offset-assert 72) - (enable basic :offset-assert 76) + (set-rotation symbol :offset-assert 64) + (set-scale symbol :offset-assert 68) + (set-translation symbol :offset-assert 72) + (enable symbol :offset-assert 76) ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 (:methods - (new (symbol type process-drawable int basic basic basic) _type_ 0) + (new (symbol type process-drawable int symbol symbol symbol) _type_ 0) ) ) @@ -762,7 +760,7 @@ (none) ) -(defmethod new joint-mod-set-local ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 basic) (arg3 basic) (arg4 basic)) +(defmethod new joint-mod-set-local ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 int) (arg2 symbol) (arg3 symbol) (arg4 symbol)) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> v0-0 set-translation) arg2) (set! (-> v0-0 set-rotation) arg3) diff --git a/goal_src/jak1/engine/anim/mspace-h.gc b/goal_src/jak1/engine/anim/mspace-h.gc index c9251ee67e..3339980db3 100644 --- a/goal_src/jak1/engine/anim/mspace-h.gc +++ b/goal_src/jak1/engine/anim/mspace-h.gc @@ -18,7 +18,7 @@ ;; First, the joint. This type just describes how the skeleton is connected and the bind pose. (deftype joint (basic) - ((name basic :offset-assert 4) ;; the joint's name (neckA, neckB, Rtoes, etc) + ((name string :offset-assert 4) ;; the joint's name (neckA, neckB, Rtoes, etc) (number int32 :offset-assert 8) ;; the joint's number in the cspace-array (parent joint :offset-assert 12) ;; the parent joint (ex, Lshould has parent of chest) (bind-pose matrix :inline :offset-assert 16) ;; the bind pose, as a matrix. diff --git a/goal_src/jak1/engine/common-obs/generic-obs.gc b/goal_src/jak1/engine/common-obs/generic-obs.gc index a15a87c52d..b9d43ffaba 100644 --- a/goal_src/jak1/engine/common-obs/generic-obs.gc +++ b/goal_src/jak1/engine/common-obs/generic-obs.gc @@ -541,6 +541,8 @@ ((nonzero? (-> self skel)) (set! (-> self new-joint-anim) (ja-group)) (set! (-> self anim-mode) 'loop) + (#when PC_PORT + (set! (-> self skel postbind-function) process-drawable-joint-callback-pc)) ) (else (set! (-> self anim-mode) 'still) diff --git a/goal_src/jak1/engine/common-obs/process-drawable.gc b/goal_src/jak1/engine/common-obs/process-drawable.gc index e7edd79d9c..3f1492c7ef 100644 --- a/goal_src/jak1/engine/common-obs/process-drawable.gc +++ b/goal_src/jak1/engine/common-obs/process-drawable.gc @@ -295,6 +295,11 @@ (define-extern draw-joint-spheres (function process-drawable symbol)) +(#when PC_PORT + +(define *display-bones* #f) +(define *display-joint-names* #f) + (defun-debug draw-bone-lines ((obj process-drawable)) "Added in PC port to debug bones" (dotimes (i (-> obj node-list length)) @@ -307,7 +312,7 @@ ) ) ) - ) + )) (defmethod do-joint-math! process-drawable ((obj process-drawable)) (cond @@ -383,8 +388,14 @@ ) ) ) - ; (draw-bone-lines obj) - ;; (draw-joint-spheres obj) + + (#when PC_PORT + (when *debug-segment* + (if *display-bones* + (draw-bone-lines obj)) + (if *display-joint-names* + (draw-joint-spheres obj)) + )) 0 (none) @@ -404,8 +415,9 @@ (defun draw-joint-spheres ((arg0 process-drawable)) (dotimes (s5-0 (-> arg0 node-list length)) (let ((a2-0 (vector<-cspace! (new-stack-vector0) (-> arg0 node-list data s5-0)))) - (add-debug-sphere #t (bucket-id debug) a2-0 819.2 (new 'static 'rgba :g #xff :a #x40)) - ;;(add-debug-text-sphere #t (bucket-id debug) a2-0 819.2 (the string (-> arg0 node-list data s5-0 joint name)) (new 'static 'rgba :g #xff :a #x40)) + (add-debug-sphere #t (bucket-id debug) a2-0 (meters 0.1) (static-rgba 0 #xff 0 #x40)) + (#when PC_PORT + (add-debug-text-sphere (!= (-> arg0 node-list data s5-0 joint) #f) (bucket-id debug) a2-0 (meters 0.1) (-> arg0 node-list data s5-0 joint name) (static-rgba 0 #xff 0 #x40))) ) ) #f diff --git a/goal_src/jak1/engine/common-obs/process-taskable.gc b/goal_src/jak1/engine/common-obs/process-taskable.gc index 2d7f8bff9d..c5b27ed117 100644 --- a/goal_src/jak1/engine/common-obs/process-taskable.gc +++ b/goal_src/jak1/engine/common-obs/process-taskable.gc @@ -1023,6 +1023,8 @@ (initialize-skeleton obj arg1 '()) (set! (-> obj shadow-backup) (-> obj draw shadow)) (logior! (-> obj skel status) (janim-status eye)) + (#when PC_PORT + (set! (-> obj skel postbind-function) process-drawable-joint-callback-pc)) (set! (-> obj root-override pause-adjust-distance) -122880.0) (set! (-> obj fuel-cell-anim) (fuel-cell-pick-anim obj)) (set! (-> obj draw origin-joint-index) (the-as uint arg2)) diff --git a/goal_src/jak1/engine/debug/default-menu.gc b/goal_src/jak1/engine/debug/default-menu.gc index fb1b0008c7..57198902dc 100644 --- a/goal_src/jak1/engine/debug/default-menu.gc +++ b/goal_src/jak1/engine/debug/default-menu.gc @@ -4599,45 +4599,45 @@ (flag "Blue eco" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) (logclear! (-> *pc-settings* cheats) (pc-cheats eco-red eco-yellow eco-green)) - (pc-cheat-toggle-and-tune *pc-settings* eco-blue) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) eco-blue) ) (pc-cheats? (-> *pc-settings* cheats) eco-blue))) (flag "Red eco" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) (logclear! (-> *pc-settings* cheats) (pc-cheats eco-blue eco-yellow eco-green)) - (pc-cheat-toggle-and-tune *pc-settings* eco-red) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) eco-red) ) (pc-cheats? (-> *pc-settings* cheats) eco-red))) (flag "Green eco" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) (logclear! (-> *pc-settings* cheats) (pc-cheats eco-red eco-yellow eco-blue)) - (pc-cheat-toggle-and-tune *pc-settings* eco-green) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) eco-green) ) (pc-cheats? (-> *pc-settings* cheats) eco-green))) (flag "Yellow eco" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) (logclear! (-> *pc-settings* cheats) (pc-cheats eco-red eco-blue eco-green)) - (pc-cheat-toggle-and-tune *pc-settings* eco-yellow) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) eco-yellow) ) (pc-cheats? (-> *pc-settings* cheats) eco-yellow))) (flag "Invincibility" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) - (pc-cheat-toggle-and-tune *pc-settings* invinc) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) invinc) ) (pc-cheats? (-> *pc-settings* cheats) invinc))) (flag "Blue sidekick" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) - (pc-cheat-toggle-and-tune *pc-settings* sidekick-blue) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) sidekick-blue) ) (pc-cheats? (-> *pc-settings* cheats) sidekick-blue))) (flag "All flavas" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) - (pc-cheat-toggle-and-tune *pc-settings* tunes) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) tunes) ) (pc-cheats? (-> *pc-settings* cheats) tunes))) (flag "Real time tod" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) - (pc-cheat-toggle-and-tune *pc-settings* sky) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) sky) ) (pc-cheats? (-> *pc-settings* cheats) sky))) ) @@ -4740,6 +4740,7 @@ (flag "Heap status" #f ,(dm-lambda-boolean-flag (-> *pc-settings* display-heap-status))) (flag "Bug report" #f ,(dm-lambda-boolean-flag (-> *pc-settings* display-bug-report))) (flag "Text boxes" #f ,(dm-lambda-boolean-flag (-> *pc-settings* display-text-box))) + (flag "Sidekick stats" *display-sidekick-stats* dm-boolean-toggle-pick-func) (float-var "Actor birth dist" #f ,(dm-lambda-meters-var (-> *ACTOR-bank* birth-dist)) 20 1 #t 0 10000 1) (float-var "Actor pause dist" #f ,(dm-lambda-meters-var (-> *ACTOR-bank* pause-dist)) 20 1 #t 0 10000 1) (menu "Mood override" @@ -4765,6 +4766,8 @@ (float-fixed-var "Palette 7 Amt" 7 dm-mood-palette-float 0 10 #t 0 1000 3) ) ) + (flag "Joint names" *display-joint-names* dm-boolean-toggle-pick-func) + (flag "Bone lines" *display-bones* dm-boolean-toggle-pick-func) ) )) (other-menu (-> (the-as debug-menu-item-submenu other-menu-node) submenu)) diff --git a/goal_src/jak1/engine/game/main.gc b/goal_src/jak1/engine/game/main.gc index f6b7a16c98..cbb445fc8a 100644 --- a/goal_src/jak1/engine/game/main.gc +++ b/goal_src/jak1/engine/game/main.gc @@ -938,8 +938,7 @@ (with-profiler "process-particles" (process-particles)) ;; vif0 collide - ;; swap sound - ;; str play + (with-profiler "sound-update" (swap-sound-buffers (ear-trans) (camera-pos) (camera-angle)) (str-play-kick) diff --git a/goal_src/jak1/engine/gfx/hw/display.gc b/goal_src/jak1/engine/gfx/hw/display.gc index 71763deaf0..fca8182c29 100644 --- a/goal_src/jak1/engine/gfx/hw/display.gc +++ b/goal_src/jak1/engine/gfx/hw/display.gc @@ -9,7 +9,9 @@ (defconstant DMA_BUFFER_GLOBAL_SIZE (#if (not PC_PORT) (* 1712 1024) ;; 1712K (* PROCESS_HEAP_MULT 2664 1024))) ;; 2600K x actor heap increase (usually 3x) -(defconstant DMA_BUFFER_DEBUG_SIZE (* 8 1024 1024)) ;; 8M +(defconstant DMA_BUFFER_DEBUG_SIZE (#if (not PC_PORT) + (* 8 1024 1024) ;; 8M + (* 16 1024 1024))) ;; 16M ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TIME diff --git a/goal_src/jak1/engine/gfx/math-camera.gc b/goal_src/jak1/engine/gfx/math-camera.gc index b7728d28be..11a776eacf 100644 --- a/goal_src/jak1/engine/gfx/math-camera.gc +++ b/goal_src/jak1/engine/gfx/math-camera.gc @@ -62,10 +62,8 @@ (set! (-> math-cam y-ratio) (* (1/ ASPECT_4X3) (-> math-cam x-ratio))) (set! (-> math-cam y-ratio) (* (1/ ASPECT_16X9) (-> math-cam x-ratio))) ) - (#when PC_PORT + (with-pc (cond - ((not *pc-settings*) - ) ((-> *pc-settings* use-vis?) ;; using game vis, cannot allow seeing more of the view ;; crops excess aspect ratio at the top and bottom @@ -228,14 +226,17 @@ (set! (-> math-cam guard w) 1.0) (set! (-> math-cam isometric vector 3 z) (- 16777215.0 hvdf-z)) ;; PC HACK! - ;; for whatever reason, the font render ends up computing a depth #x1000000 instead of + ;; for whatever reason, the font renderer ends up computing a depth #x1000000 instead of ;; #xffffffff, which overflows the 24-bit z buffer. ;; cheating this by 1 bit seems to fix it. (#when PC_PORT - ;; #x4b002032 -> #x4b002031 - (set! (-> math-cam isometric vector 3 z) (the-as float (- (the-as int (-> math-cam isometric vector 3 z)) 1))) - ) - + ;; #x4b002032 -> #x4b002031 + (set! (-> math-cam isometric vector 3 z) (the-as float (1- (the-as int (-> math-cam isometric vector 3 z))))) + ;; also do mirror game check here. + (when (pc-cheats? (-> *pc-settings* cheats) mirror) + (*! (-> math-cam perspective vector 0 x) -1.) + ) + ) ) (set! (-> math-cam isometric vector 3 w) fog-slope) diff --git a/goal_src/jak1/engine/gfx/sprite/sprite.gc b/goal_src/jak1/engine/gfx/sprite/sprite.gc index 1195ddbc42..7c0df7a51e 100644 --- a/goal_src/jak1/engine/gfx/sprite/sprite.gc +++ b/goal_src/jak1/engine/gfx/sprite/sprite.gc @@ -340,6 +340,9 @@ ;; math camera stuff (set! (-> data basis-x quad) (the-as uint128 0)) (set! (-> data basis-x x) (- (-> *math-camera* perspective vector 0 x))) + (with-pc + (when (pc-cheats? (-> *pc-settings* cheats) mirror) + (*! (-> data basis-x x) -1.0))) (set! (-> data basis-y quad) (the-as uint128 0)) (set! (-> data basis-y y) (- (-> *math-camera* perspective vector 1 y))) (set! (-> data min-scale) (sqrtf (* (/ 1.0 (-> data basis-x x)) (/ 1.0 (-> data basis-y y))))) @@ -551,13 +554,17 @@ (f2-0 (-> *math-camera* perspective vector 1 y)) (f0-1 (* -1.9996 (-> *math-camera* perspective vector 0 x))) ) - (#when PC_PORT - (when (and *pc-settings* (not (-> *pc-settings* use-vis?))) + (with-pc + (when (not (-> *pc-settings* use-vis?)) ;; when the game is in widescreen, HUD sprites are generally enlarged, which looks terrible. ;; this reverts that. (*! f1-0 (-> *pc-settings* aspect-ratio-scale)) (*! f0-1 (-> *pc-settings* aspect-ratio-scale)) ) + (when (pc-cheats? (-> *pc-settings* cheats) mirror) + (*! f1-0 -1.0) + (*! f0-1 -1.0) + ) ) (set-vector! (-> mtx2 vector 0) f0-1 0.0 0.0 0.0) (set-vector! (-> mtx2 vector 1) 0.0 (- (* (/ f2-0 f1-0) f0-1)) 0.0 0.0) diff --git a/goal_src/jak1/engine/math/matrix.gc b/goal_src/jak1/engine/math/matrix.gc index f0908102a5..13e38886a4 100644 --- a/goal_src/jak1/engine/math/matrix.gc +++ b/goal_src/jak1/engine/math/matrix.gc @@ -607,7 +607,7 @@ (defun scale-matrix! ((dst matrix) (scale vector) (src matrix)) "Scale an existing matrix. Okay for dst = src. The scaling is applied per row. This means the x component of scale is used to scale the first row of src. - The w component of scale is used." + The w component of scale IS USED!!" (rlet ((vf4 :class vf) (vf5 :class vf) (vf6 :class vf) diff --git a/goal_src/jak1/engine/ps2/pad.gc b/goal_src/jak1/engine/ps2/pad.gc index 07f0ff8453..ca4372ca13 100644 --- a/goal_src/jak1/engine/ps2/pad.gc +++ b/goal_src/jak1/engine/ps2/pad.gc @@ -316,14 +316,14 @@ (set! (-> pad button0-abs 1) (-> pad button0-shadow-abs 0)) (set! (-> pad button0-rel 2) (-> pad button0-rel 1)) (set! (-> pad button0-rel 1) (-> pad button0-rel 0)) - ;; we might want to clear a button so we back it up in a "shadow" field + ;; we might want to clear a button after it is pressed, so we back it up in a "shadow" field (let ((current-button0 (-> pad button0))) (set! (-> pad button0-shadow-abs 0) (the-as pad-buttons current-button0)) (set! (-> pad button0-abs 0) (the-as pad-buttons current-button0)) ) ;; buttons going down (set! (-> pad button0-rel 0) (logclear (-> pad button0-abs 0) (-> pad button0-abs 1))) - ;; ?? + ;; some debugging thing they wrote at some point (when *cpad-debug* (set! (-> pad leftx) (the-as uint 255)) (set! (-> pad rightx) (the-as uint 255)) @@ -332,8 +332,14 @@ ;; compute a speed and direction for stick0 (set! (-> pad stick0-speed) 1.0) (cond - ;; check if analog is valid? + ;; check if controller is a valid dualshock 2 ((= (shr (-> pad status) 4) 7) + ;; invert analogs if mirrored mode. trust me, you'll need this. + (#when PC_PORT + (when (pc-cheats? (-> *pc-settings* cheats) mirror) + (set! (-> pad leftx) (- 255 (-> pad leftx))) + (set! (-> pad rightx) (- 255 (-> pad rightx))) + )) ;; compute speed and direction, with deadband. (let ((f30-0 (* 0.0078125 (the float (+ (-> pad leftx) -128)))) (f28-0 (* 0.0078125 (the float (- 127 (the-as int (-> pad lefty)))))) diff --git a/goal_src/jak1/engine/sound/gsound.gc b/goal_src/jak1/engine/sound/gsound.gc index 57625dddec..cf5ceee1b8 100644 --- a/goal_src/jak1/engine/sound/gsound.gc +++ b/goal_src/jak1/engine/sound/gsound.gc @@ -335,6 +335,13 @@ (sound-trans-convert (-> cmd ear-trans) ear-trans) (sound-trans-convert (-> cmd cam-trans) cam-trans) (set! (-> cmd cam-angle) (sound-angle-convert cam-angle)) + (#when PC_PORT + (when (pc-cheats? (-> *pc-settings* cheats) mirror) + ;; flip sound pan. + ;; this isn't really appropriate if there's front-back panning (surround)... + (+! (-> cmd cam-angle) 180) + ) + ) ) 0 ) diff --git a/goal_src/jak1/engine/ui/text-h.gc b/goal_src/jak1/engine/ui/text-h.gc index 1b650ad45a..4a5f613bf5 100644 --- a/goal_src/jak1/engine/ui/text-h.gc +++ b/goal_src/jak1/engine/ui/text-h.gc @@ -680,6 +680,13 @@ (cheat-sky #x1097) (cheat-req-100-percent #x1098) (cheat-req-beat-game #x1099) + (cheat-big-head #x109a) + (cheat-small-head #x109b) + (cheat-big-fist #x109c) + (cheat-big-head-npc #x109d) + (cheat-no-tex #x109e) + (cheat-mirror #x109f) + (cheat-huge-head #x10a0) (music-player #x10c0) (scene-player #x10c1) (play-credits #x10c2) diff --git a/goal_src/jak1/game.gp b/goal_src/jak1/game.gp index c32ebe3297..d8ef1ef291 100644 --- a/goal_src/jak1/game.gp +++ b/goal_src/jak1/game.gp @@ -2036,7 +2036,8 @@ ;; Custom or Modified Code (goal-src "pc/pckernel-h.gc" "dma-buffer") -(goal-src "pc/pckernel.gc" "settings" "video") +(goal-src "pc/util/pc-anim-util.gc" "target-h") +(goal-src "pc/pckernel.gc" "pc-anim-util" "settings" "video" "target-h") (goal-src "pc/subtitle.gc" "text" "pckernel" "hint-control" "loader-h" "gsound" "ambient") (goal-src "pc/progress-pc.gc" "progress" "pckernel") (goal-src "pc/util/anim-tester-x.gc" "pckernel" "gstring" "joint" "process-drawable" "art-h" "effect-control") diff --git a/goal_src/jak1/kernel-defs.gc b/goal_src/jak1/kernel-defs.gc index d45a355ff5..0ff6d85112 100644 --- a/goal_src/jak1/kernel-defs.gc +++ b/goal_src/jak1/kernel-defs.gc @@ -319,6 +319,9 @@ (material 3) (skip 4)) +(defenum pc-gfx-hack + (no-tex 0)) + (define-extern __read-ee-timer (function uint)) (define-extern __mem-move (function pointer pointer uint none)) (define-extern __send-gfx-dma-chain (function object object none)) @@ -361,6 +364,7 @@ (define-extern pc-set-window-lock (function symbol none)) (define-extern pc-set-game-resolution (function int int none)) (define-extern pc-set-msaa (function int none)) +(define-extern pc-set-gfx-hack (function pc-gfx-hack symbol none)) (defenum pc-prof-event (begin 0) diff --git a/goal_src/jak1/pc/pckernel-h.gc b/goal_src/jak1/pc/pckernel-h.gc index 52e67cd4e4..2559eab64f 100644 --- a/goal_src/jak1/pc/pckernel-h.gc +++ b/goal_src/jak1/pc/pckernel-h.gc @@ -103,7 +103,7 @@ (korean 98) ;; future-proofing here (russian 97) ;; same thing - (custom 500) ;; temp + (custom 100) ;; temp ) @@ -115,6 +115,7 @@ ) ;; cheats +(defconstant PC_CHEAT_MAX 18) ;; number of cheats (defenum pc-cheats :bitfield #t :type uint64 @@ -126,6 +127,16 @@ (sidekick-blue) (tunes) (sky) + (mirror) + (big-head) + (small-head) + (big-fist) + (no-tex) + (hard-rats) + (hero-mode) + (huge-head) + (big-head-npc) + (oh-my-goodness) ) (defmacro pc-cheats? (obj &rest cheats) @@ -531,55 +542,53 @@ ) (seval (define *pc-cheat-map* - '((a (triangle triangle)) - (b (square square)) - (c (circle circle)) - (d (x x)) - (e (right right)) - (f (right up)) - (g (right down)) - (h (left right)) - (i (up right)) - (j (down left)) - (k (square right)) - (l (left down)) - (m (up circle)) - (n (up up)) - (o (circle square)) - (p (down circle)) - (q (dowm square)) - (r (circle x)) - (s (down x)) - (t (triangle square)) - (u (square x)) - (v (x triangle)) - (w (left left)) - (x (up down)) - (y (up x)) - (z (up circle)) + '((#\a (circle triangle)) + (#\b (square x)) + (#\c (circle)) + (#\d (down)) + (#\e (right right)) + ;; #\f + ;; #\g + ;; #\h + (#\i (up)) + ;; #\j + (#\k (circle)) + (#\l (left)) + (#\m (triangle)) + (#\n (up up)) + (#\o (square)) + (#\p (square circle)) + ;; #\q + (#\r (right)) + (#\s (down down)) + (#\t (triangle)) + (#\u (up)) + (#\v (down)) + (#\w (left left)) + (#\x (x)) + (#\y (triangle)) + (#\z (x x)) )) ) -(desfun pc-cheat-encode (letters extra) +(desfun pc-cheat-encode (word extra) "turn a cheat word into input names." - (let ((out '())) + (let ((out '()) + (word-str (symbol->string word))) - (dolist (in letters) - - (let ((buttons (cadr (assoc (car in) *pc-cheat-map*)))) - (dolist (button buttons) - - (set! out (cons (car button) out)) - ) - ) - ) + (dotimes (i (string-length word-str)) + (let ((char-to-inputs (assoc (string-ref word-str i) *pc-cheat-map*))) + (if (null? char-to-inputs) + (ferror "bad input for pc cheat name: {}" (string-ref word-str i)) + (dolist (button (cadr char-to-inputs)) + (set! out (cons (car button) out)) + )) + )) (dolist (ex extra) - - (set! out (cons (car ex) out)) - ) - (reverse out) - ) + (set! out (cons (car ex) out))) + + out) ) (defmacro pc-check-cheat-code (cheat-var pad-idx input &key (extra ()) &rest body) diff --git a/goal_src/jak1/pc/pckernel.gc b/goal_src/jak1/pc/pckernel.gc index 8b61d429db..135f563d62 100644 --- a/goal_src/jak1/pc/pckernel.gc +++ b/goal_src/jak1/pc/pckernel.gc @@ -249,12 +249,15 @@ (none)) -(define *pc-cheat-temp* (the-as (pointer int32) (malloc 'global (* 4 8)))) -(defmacro pc-cheat-toggle-and-tune (obj cheat) +;; where we store the input progress for the cheat codes. make sure there's enough space for all cheats. +(define *pc-cheat-temp* (new 'global 'inline-array 'uint8 PC_CHEAT_MAX)) + +(defmacro pc-cheat-toggle-and-tune (cheats-var cheat) + "quickly toggle a cheat code and play an appropriate sound" `(begin (cpad-clear! 0 r1) - (logxor! (-> ,obj cheats) (pc-cheats ,cheat)) - (cheats-sound-play (logtest? (-> ,obj cheats) (pc-cheats ,cheat))) + (logxor! ,cheats-var (pc-cheats ,cheat)) + (cheats-sound-play (logtest? ,cheats-var (pc-cheats ,cheat))) ) ) @@ -369,38 +372,49 @@ (defmethod update-cheats pc-settings ((obj pc-settings)) "run cheats." + ;; first check for cheat inputs. (when (and (cpad-hold? 0 l2) (cpad-hold? 0 l1) (cpad-hold? 0 r2) (cpad-hold? 0 r1)) - (pc-check-cheat-code (-> *pc-cheat-temp* 0) 0 (s p i r i t) :extra (x) + (pc-check-cheat-code (-> *pc-cheat-temp* 0) 0 spirit :extra (x) (logclear! (-> obj cheats) (pc-cheats eco-red eco-yellow eco-green)) - (pc-cheat-toggle-and-tune obj eco-blue)) + (pc-cheat-toggle-and-tune (-> obj cheats) eco-blue)) - (pc-check-cheat-code (-> *pc-cheat-temp* 1) 0 (s p i r i t) :extra (circle) + (pc-check-cheat-code (-> *pc-cheat-temp* 1) 0 spirit :extra (circle) (logclear! (-> obj cheats) (pc-cheats eco-blue eco-yellow eco-green)) - (pc-cheat-toggle-and-tune obj eco-red)) + (pc-cheat-toggle-and-tune (-> obj cheats) eco-red)) - (pc-check-cheat-code (-> *pc-cheat-temp* 2) 0 (s p i r i t) :extra (triangle) + (pc-check-cheat-code (-> *pc-cheat-temp* 2) 0 spirit :extra (triangle) (logclear! (-> obj cheats) (pc-cheats eco-red eco-yellow eco-blue)) - (pc-cheat-toggle-and-tune obj eco-green)) + (pc-cheat-toggle-and-tune (-> obj cheats) eco-green)) - (pc-check-cheat-code (-> *pc-cheat-temp* 3) 0 (s p i r i t) :extra (square) + (pc-check-cheat-code (-> *pc-cheat-temp* 3) 0 spirit :extra (square) (logclear! (-> obj cheats) (pc-cheats eco-red eco-blue eco-green)) - (pc-cheat-toggle-and-tune obj eco-yellow)) + (pc-cheat-toggle-and-tune (-> obj cheats) eco-yellow)) - (pc-check-cheat-code (-> *pc-cheat-temp* 4) 0 (s t e e l) + (pc-check-cheat-code (-> *pc-cheat-temp* 4) 0 undead (logclear! (-> *target* state-flags) 16) - (pc-cheat-toggle-and-tune obj invinc)) + (pc-cheat-toggle-and-tune (-> obj cheats) invinc)) - (pc-check-cheat-code (-> *pc-cheat-temp* 5) 0 (l e a d s) - (pc-cheat-toggle-and-tune obj sidekick-blue)) - - (pc-check-cheat-code (-> *pc-cheat-temp* 6) 0 (t u n e s) - (pc-cheat-toggle-and-tune obj tunes)) - - (pc-check-cheat-code (-> *pc-cheat-temp* 7) 0 (s k y) - (pc-cheat-toggle-and-tune obj sky)) + (pc-check-cheat-code (-> *pc-cheat-temp* 5) 0 bluemoon (pc-cheat-toggle-and-tune (-> obj cheats) sidekick-blue)) + (pc-check-cheat-code (-> *pc-cheat-temp* 6) 0 boombox (pc-cheat-toggle-and-tune (-> obj cheats) tunes)) + (pc-check-cheat-code (-> *pc-cheat-temp* 7) 0 skies (pc-cheat-toggle-and-tune (-> obj cheats) sky)) + (pc-check-cheat-code (-> *pc-cheat-temp* 8) 0 speclum (pc-cheat-toggle-and-tune (-> obj cheats) mirror)) + (pc-check-cheat-code (-> *pc-cheat-temp* 9) 0 brains (pc-cheat-toggle-and-tune (-> obj cheats) big-head)) + (pc-check-cheat-code (-> *pc-cheat-temp* 10) 0 driedup (pc-cheat-toggle-and-tune (-> obj cheats) small-head)) + (pc-check-cheat-code (-> *pc-cheat-temp* 11) 0 yourpalm (pc-cheat-toggle-and-tune (-> obj cheats) big-fist)) + (pc-check-cheat-code (-> *pc-cheat-temp* 12) 0 bakeonly (pc-cheat-toggle-and-tune (-> obj cheats) no-tex)) + ;(pc-check-cheat-code (-> *pc-cheat-temp* 13) 0 rodent (pc-cheat-toggle-and-tune (-> obj cheats) hard-rats)) + ;(pc-check-cheat-code (-> *pc-cheat-temp* 14) 0 lunatic (pc-cheat-toggle-and-tune (-> obj cheats) hero-mode)) + (pc-check-cheat-code (-> *pc-cheat-temp* 15) 0 plzstop (pc-cheat-toggle-and-tune (-> obj cheats) huge-head)) + (pc-check-cheat-code (-> *pc-cheat-temp* 16) 0 evilbabe (pc-cheat-toggle-and-tune (-> obj cheats) oh-my-goodness)) + (pc-check-cheat-code (-> *pc-cheat-temp* 17) 0 smart (pc-cheat-toggle-and-tune (-> obj cheats) big-head-npc)) ) + ;; run cheats here. + ;;;;;;;;;;;;;;;;;;; (when *target* + ;; hook custom animation callback + (if (nonzero? (-> *target* skel)) + (set! (-> *target* skel postbind-function) target-joint-callback-pc)) (with-pp (protect ((-> *target* fact-info-target eco-source) *sound-player-enable*) ;; act as if this isnt a new source of eco to prevent spamming sounds. then restore the old source! @@ -461,13 +475,16 @@ ) (if (pc-cheats? (-> obj cheats) sky) - (let ((date (new 'stack 'scf-time))) + (let ((date (new 'stack-no-clear 'scf-time))) (scf-get-time date) (when (zero? (-> date stat)) - (set-time-of-day (+ (the float (bcd->dec (-> date hour))) (/ (the float (bcd->dec (-> date minute))) 60))) - ) - ) - ) + (set-time-of-day (+ (the float (bcd->dec (-> date hour))) (/ (the float (bcd->dec (-> date minute))) 60)))) + )) + + (pc-set-gfx-hack (pc-gfx-hack no-tex) (logtest? (-> obj cheats) (pc-cheats no-tex))) + + ;; run cheats end!!! + ;;;;;;;;;;;;;;;;;;;; (logior! (-> obj cheats-known) (-> obj cheats)) 0) diff --git a/goal_src/jak1/pc/progress-pc.gc b/goal_src/jak1/pc/progress-pc.gc index 8125f067f9..5a7eb56566 100644 --- a/goal_src/jak1/pc/progress-pc.gc +++ b/goal_src/jak1/pc/progress-pc.gc @@ -238,14 +238,21 @@ ) (define *cheats* (new 'static 'boxed-array :type game-option + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-sidekick-alt) :scale #t :param1 5.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-big-head) :scale #t :param1 9.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-small-head) :scale #t :param1 10.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-big-fist) :scale #t :param1 11.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-big-head-npc) :scale #t :param1 16.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-tunes) :scale #t :param1 6.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-sky) :scale #t :param1 7.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-huge-head) :scale #t :param1 15.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-mirror) :scale #t :param1 8.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-eco-yellow) :scale #t :param1 3.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-eco-blue) :scale #t :param1 2.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-eco-red) :scale #t :param1 1.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-eco-green) :scale #t :param1 0.0) (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-invinc) :scale #t :param1 4.0) - (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-sidekick-alt) :scale #t :param1 5.0) - (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-tunes) :scale #t :param1 6.0) - (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-sky) :scale #t :param1 7.0) + (new 'static 'game-option :option-type (game-option-type cheat-toggle) :name (game-text-id cheat-no-tex) :scale #t :param1 12.0) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) @@ -640,9 +647,9 @@ ;; give cheats (when (task-closed? (game-task finalboss-movies) (task-status need-reminder)) - (logior! (-> *pc-settings* cheats-known) (pc-cheats sidekick-blue tunes sky)) + (logior! (-> *pc-settings* cheats-known) (pc-cheats sidekick-blue tunes sky big-head small-head big-fist big-head-npc)) (when (>= (calculate-completion (the progress #f)) 100.0) - (logior! (-> *pc-settings* cheats-known) (pc-cheats invinc eco-blue eco-red eco-green eco-yellow)))) + (logior! (-> *pc-settings* cheats-known) (pc-cheats invinc eco-blue eco-red eco-green eco-yellow huge-head mirror no-tex)))) ;; set up options for each screen (set! (-> *options-remap* (progress-screen settings)) (if (or *cheat-mode* (nonzero? (-> *pc-settings* cheats-known))) @@ -756,14 +763,9 @@ (set! (-> *sound-options-pc* 0 value-to-modify) (&-> *setting-control* default sfx-volume)) (set! (-> *sound-options-pc* 1 value-to-modify) (&-> *setting-control* default music-volume)) (set! (-> *sound-options-pc* 2 value-to-modify) (&-> *setting-control* default dialog-volume)) - (set! (-> *cheats* 0 value-to-modify) (&-> *progress-carousell* symbol-backup)) - (set! (-> *cheats* 1 value-to-modify) (&-> *progress-carousell* symbol-backup)) - (set! (-> *cheats* 2 value-to-modify) (&-> *progress-carousell* symbol-backup)) - (set! (-> *cheats* 3 value-to-modify) (&-> *progress-carousell* symbol-backup)) - (set! (-> *cheats* 4 value-to-modify) (&-> *progress-carousell* symbol-backup)) - (set! (-> *cheats* 5 value-to-modify) (&-> *progress-carousell* symbol-backup)) - (set! (-> *cheats* 6 value-to-modify) (&-> *progress-carousell* symbol-backup)) - (set! (-> *cheats* 7 value-to-modify) (&-> *progress-carousell* symbol-backup)) + (dotimes (i (1- (-> *cheats* length))) + (set! (-> *cheats* i value-to-modify) (&-> *progress-carousell* symbol-backup)) + ) ;(set! (-> *sound-options-pc* 3 value-to-modify) (&-> *pc-settings* music-fadein?)) (set! (-> *progress-carousell* aspect-native-choice) (-> *pc-settings* use-vis?)) @@ -1947,13 +1949,23 @@ (pc-cheats eco-green) (pc-cheats eco-red) (pc-cheats eco-yellow) - (pc-cheats invinc)) + (pc-cheats invinc) + (pc-cheats huge-head) + (pc-cheats mirror) + (pc-cheats no-tex) + ) (set! option-str (lookup-text! *common-text* (game-text-id cheat-req-100-percent) #f))) (((pc-cheats sky) (pc-cheats sidekick-blue) - (pc-cheats tunes)) + (pc-cheats tunes) + (pc-cheats big-head) + (pc-cheats small-head) + (pc-cheats big-fist) + (pc-cheats big-head-npc) + ) (set! option-str (lookup-text! *common-text* (game-text-id cheat-req-beat-game) #f))) (else + ;; (format 0 "weird case ~f #x~x~%" (-> options index param1) (ash 1 (the int (-> options index param1)))) (set! option-str locked-str)) ) ) diff --git a/goal_src/jak1/pc/util/pc-anim-util.gc b/goal_src/jak1/pc/util/pc-anim-util.gc new file mode 100644 index 0000000000..52f2065354 --- /dev/null +++ b/goal_src/jak1/pc/util/pc-anim-util.gc @@ -0,0 +1,122 @@ +;;-*-Lisp-*- +(in-package goal) + +#| +A random assortment of functions used for manipulating various animations and skeletons in the pc port. + +This is used for funny cheat codes and the like. +|# + + +(define *cheat-big-head-scale* (new 'static 'vector :x 1.5 :y 1.5 :z 1.5 :w 1.0)) +(define *cheat-huge-head-scale* (new 'static 'vector :x 2.5 :y 2.5 :z 2.5 :w 1.0)) +(define *cheat-small-head-scale* (new 'static 'vector :x 0.667 :y 0.667 :z 0.667 :w 1.0)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; callbacks for joint scaling ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun matrix-diagonal! ((out matrix) (value float)) + "clear matrix and set its diagonal to a value." + (set! (-> out vector 0 quad) (the-as uint128 0)) + (set! (-> out vector 1 quad) (the-as uint128 0)) + (set! (-> out vector 2 quad) (the-as uint128 0)) + (set! (-> out vector 3 quad) (the-as uint128 0)) + (set! (-> out vector 0 data 0) value) + (set! (-> out vector 1 data 1) value) + (set! (-> out vector 2 data 2) value) + (set! (-> out vector 3 data 3) value) + out + ) + +(defun matrix*!-bone-callback ((the-bone bone) (is-parent? symbol) (mtx matrix) a) + "apply a transform matrix to a bone." + (matrix*! (-> the-bone transform) (-> the-bone transform) mtx) + ) + +(defun cspace-map-joints ((proc process-drawable) (cspace-idx int) (include-parent? symbol) (func (function bone symbol object object object)) p0 p1) + "run func on all joints' bones that are children of cspace-idx + if include-parent? = #t then also apply to that joint." + ;; iterate through all cspaces in the process + (let ((parent-joint (-> proc node-list data cspace-idx joint))) + (dotimes (i (-> proc node-list length)) + ;; see if it's a joint and keep that for later + (awhen (-> proc node-list data i joint) + (cond + ;; run func if we ARE the parent! + ((= it parent-joint) + ;;(format #t "running map on parent ~A~%" it) + (if include-parent? + (func (-> proc node-list data i bone) #t p0 p1))) + ;; otherwise go up our parents until we hit what we want (yay!) or nothing (nay...) + (else + (let ((cur-parent it)) + (until (or (not cur-parent) (= cur-parent parent-joint)) + (set! cur-parent (-> cur-parent parent)) + ) + (when (= cur-parent parent-joint) + ;;(format #t "running map on child ~A~%" it) + (func (-> proc node-list data i bone) #f p0 p1)) + ) + ) + ) + ) + )) + ) + +(defun scale-joints ((obj process-drawable) (cspace-idx int) (scale-children? symbol) (scale vector)) + "scale a joint (cspace-idx) in an actor. if scale-children? = #t, also scales all child joints." + (if (= cspace-idx -1) + (return #f)) + (let* ((parent-mtx (-> obj node-list data cspace-idx bone transform)) + (unscale-q (matrix-diagonal! (new-stack-matrix0) (/ 1.0 (-> parent-mtx data 15)))) + (scale-q (matrix-diagonal! (new-stack-matrix0) (-> parent-mtx data 15))) + + (scale-mat (matrix-scale! (new-stack-matrix0) scale)) + (parent-fixed (matrix*! (new-stack-matrix0) parent-mtx unscale-q)) + + (inv-parent (matrix-4x4-inverse! (new-stack-matrix0) parent-fixed)) + ;; bone * inverse(parent * unscale-q) * scale * parent * scale-q + + (matrix1 (matrix*! (new-stack-matrix0) inv-parent scale-mat)) + (matrix2 (matrix*! (new-stack-matrix0) matrix1 parent-mtx)) + (matrix3 (matrix*! (new-stack-matrix0) matrix2 scale-q)) + ) + (if scale-children? + (cspace-map-joints obj cspace-idx #t matrix*!-bone-callback matrix3 scale) + (matrix*!-bone-callback (-> obj node-list data cspace-idx bone) #t matrix3 scale) + ) + ) + ) + +(defun target-joint-callback-pc ((obj target)) + "custom animation callback for *target*" + + (let ((neckA-idx (cspace-index-by-name obj "neckA"))) + (cond + ((pc-cheats? (-> *pc-settings* cheats) small-head) (scale-joints obj neckA-idx #t *cheat-small-head-scale*)) + ((pc-cheats? (-> *pc-settings* cheats) huge-head) (scale-joints obj neckA-idx #t *cheat-huge-head-scale*)) + ((pc-cheats? (-> *pc-settings* cheats) big-head) (scale-joints obj neckA-idx #t *cheat-big-head-scale*)) + )) + (when (and (pc-cheats? (-> *pc-settings* cheats) big-fist) (!= 'target-edge-grab (-> obj next-state name))) + (scale-joints obj (cspace-index-by-name obj "sk_lhand") #t *cheat-huge-head-scale*) + (scale-joints obj (cspace-index-by-name obj "sk_rhand") #t *cheat-huge-head-scale*) + ) + 0 (none) + ) + +(defun process-drawable-joint-callback-pc ((obj process-drawable)) + "custom animation callback for any process drawable" + + (when (pc-cheats? (-> *pc-settings* cheats) oh-my-goodness) + ;; don't ask. + (scale-joints obj (cspace-index-by-name obj "lbood") #t (new 'static 'vector :x 2.0 :y 2.0 :z 2.0 :w 1.0)) + (scale-joints obj (cspace-index-by-name obj "rboob") #t (new 'static 'vector :x 2.0 :y 2.0 :z 2.0 :w 1.0)) + ) + (when (pc-cheats? (-> *pc-settings* cheats) big-head-npc) + (scale-joints obj (cspace-index-by-name obj "head") #t *cheat-big-head-scale*) + ) + 0 (none) + ) + + diff --git a/test/decompiler/reference/jak1/engine/anim/mspace-h_REF.gc b/test/decompiler/reference/jak1/engine/anim/mspace-h_REF.gc index 4131ebd75b..32ac8f68d0 100644 --- a/test/decompiler/reference/jak1/engine/anim/mspace-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/mspace-h_REF.gc @@ -3,7 +3,7 @@ ;; definition of type joint (deftype joint (basic) - ((name basic :offset-assert 4) + ((name string :offset-assert 4) (number int32 :offset-assert 8) (parent joint :offset-assert 12) (bind-pose matrix :inline :offset-assert 16) diff --git a/test/decompiler/reference/jak1/engine/target/joint-mod-h_REF.gc b/test/decompiler/reference/jak1/engine/target/joint-mod-h_REF.gc index e0585c9481..e119050121 100644 --- a/test/decompiler/reference/jak1/engine/target/joint-mod-h_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/joint-mod-h_REF.gc @@ -20,8 +20,8 @@ (up uint8 :offset-assert 136) (nose uint8 :offset-assert 137) (ear uint8 :offset-assert 138) - (shutting-down? basic :offset-assert 140) - (parented-scale? basic :offset 128) + (shutting-down? symbol :offset-assert 140) + (parented-scale? symbol :offset 128) ) :method-count-assert 16 :size-assert #x90 @@ -34,7 +34,7 @@ (reset-blend! (_type_) _type_ 12) (set-twist! (_type_ float float float) vector 13) (set-trs! (_type_ vector quaternion vector) none 14) - (shut-down! (_type_) float 15) + (shut-down! (_type_) none 15) ) ) @@ -159,12 +159,11 @@ ) ;; definition for method 15 of type joint-mod +;; INFO: Return type mismatch float vs none. (defmethod shut-down! joint-mod ((obj joint-mod)) (set! (-> obj shutting-down?) #t) - (let ((f0-0 0.0)) - (set! (-> obj blend) f0-0) - f0-0 - ) + (set! (-> obj blend) 0.0) + (none) ) ;; definition for method 13 of type joint-mod @@ -667,16 +666,16 @@ ;; definition of type joint-mod-set-local (deftype joint-mod-set-local (basic) ((transform transformq :inline :offset-assert 16) - (set-rotation basic :offset-assert 64) - (set-scale basic :offset-assert 68) - (set-translation basic :offset-assert 72) - (enable basic :offset-assert 76) + (set-rotation symbol :offset-assert 64) + (set-scale symbol :offset-assert 68) + (set-translation symbol :offset-assert 72) + (enable symbol :offset-assert 76) ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 (:methods - (new (symbol type process-drawable int basic basic basic) _type_ 0) + (new (symbol type process-drawable int symbol symbol symbol) _type_ 0) ) ) @@ -722,9 +721,9 @@ (type-to-make type) (arg0 process-drawable) (arg1 int) - (arg2 basic) - (arg3 basic) - (arg4 basic) + (arg2 symbol) + (arg3 symbol) + (arg4 symbol) ) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> v0-0 set-translation) arg2) From 0850c7d98c45d896a96a13372a782cf4bc614e30 Mon Sep 17 00:00:00 2001 From: animalstyletaco Date: Sat, 20 Aug 2022 07:31:39 -0700 Subject: [PATCH 11/23] Fixed invalid cursor mode bug in GLDisplay::update_cursor_visibility() (#1774) * Fixed invalid cursor mode bug in GLDisplay::update_cursor_visibility() * Removed global cursor mode variable Co-authored-by: animalstyletaco --- game/graphics/pipelines/opengl.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index b89bf5d22e..01db62c41b 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -78,7 +78,6 @@ struct GraphicsData { std::unique_ptr g_gfx_data; -std::atomic g_cursor_input_mode = GLFW_CURSOR_DISABLED; bool is_cursor_position_valid = false; double last_cursor_x_position = 0; double last_cursor_y_position = 0; @@ -306,8 +305,8 @@ GLDisplay::~GLDisplay() { } void GLDisplay::update_cursor_visibility(GLFWwindow* window, bool is_visible) { - g_cursor_input_mode = (is_visible) ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED; - glfwSetInputMode(window, GLFW_CURSOR, g_cursor_input_mode); + auto cursor_mode = (is_visible) ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED; + glfwSetInputMode(window, GLFW_CURSOR, cursor_mode); } void GLDisplay::on_key(GLFWwindow* window, int key, int /*scancode*/, int action, int /*mods*/) { @@ -317,13 +316,10 @@ void GLDisplay::on_key(GLFWwindow* window, int key, int /*scancode*/, int action } else if (action == GlfwKeyAction::Release) { // lg::debug("KEY RELEASE: key: {} scancode: {} mods: {:X}", key, scancode, mods); Pad::OnKeyRelease(key); - GLDisplay* display = reinterpret_cast(glfwGetWindowUserPointer(window)); - if (display != NULL) { // toggle ImGui when pressing Alt - if ((key == GLFW_KEY_LEFT_ALT || key == GLFW_KEY_RIGHT_ALT) && - glfwGetWindowAttrib(window, GLFW_FOCUSED)) { - display->set_imgui_visible(!display->is_imgui_visible()); - update_cursor_visibility(window, display->is_imgui_visible()); - } + if ((key == GLFW_KEY_LEFT_ALT || key == GLFW_KEY_RIGHT_ALT) && + glfwGetWindowAttrib(window, GLFW_FOCUSED)) { + set_imgui_visible(!is_imgui_visible()); + update_cursor_visibility(window, is_imgui_visible()); } } } @@ -333,8 +329,7 @@ void GLDisplay::on_mouse_key(GLFWwindow* window, int button, int action, int mod button + GLFW_KEY_LAST; // Mouse button index are appended after initial GLFW keys in newpad if (button == GLFW_MOUSE_BUTTON_LEFT && - g_cursor_input_mode == - GLFW_CURSOR_NORMAL) { // Are there any other mouse buttons we don't want to use? + is_imgui_visible()) { // Are there any other mouse buttons we don't want to use? Pad::ClearKey(key); return; } @@ -348,7 +343,7 @@ void GLDisplay::on_mouse_key(GLFWwindow* window, int button, int action, int mod void GLDisplay::on_cursor_position(GLFWwindow* window, double xposition, double yposition) { Pad::MappingInfo mapping_info = Gfx::get_button_mapping(); - if (g_cursor_input_mode == GLFW_CURSOR_NORMAL) { + if (is_imgui_visible()) { if (is_cursor_position_valid == true) { Pad::ClearAnalogAxisValue(mapping_info, GlfwKeyCustomAxis::CURSOR_X_AXIS); Pad::ClearAnalogAxisValue(mapping_info, GlfwKeyCustomAxis::CURSOR_Y_AXIS); From 3c89cd08bef75f21cbc02862fc249990c0cc8245 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sat, 20 Aug 2022 10:32:00 -0400 Subject: [PATCH 12/23] Improvements for stuttering (#1768) * tie changes * other changes * cleanpu * remove silly profiling * loader frames bug fix * fix merge issue --- .../opengl_renderer/background/Tie3.cpp | 12 +- .../opengl_renderer/loader/Loader.cpp | 6 + .../opengl_renderer/loader/LoaderStages.cpp | 107 ++++++++- game/graphics/opengl_renderer/loader/common.h | 1 + game/graphics/pipelines/opengl.cpp | 217 +++++++++++++----- game/graphics/pipelines/opengl.h | 36 +++ game/kernel/common/kmachine.cpp | 3 +- game/kernel/jak1/kmachine.cpp | 15 ++ game/runtime.cpp | 12 +- 9 files changed, 332 insertions(+), 77 deletions(-) diff --git a/game/graphics/opengl_renderer/background/Tie3.cpp b/game/graphics/opengl_renderer/background/Tie3.cpp index f68cbb8fbc..0a14adaf46 100644 --- a/game/graphics/opengl_renderer/background/Tie3.cpp +++ b/game/graphics/opengl_renderer/background/Tie3.cpp @@ -1,5 +1,7 @@ #include "Tie3.h" +#include "common/global_profiler/GlobalProfiler.h" + #include "third-party/imgui/imgui.h" Tie3::Tie3(const std::string& name, BucketId my_id, int level_id) @@ -15,6 +17,7 @@ Tie3::~Tie3() { } void Tie3::update_load(const LevelData* loader_data) { + auto ul = scoped_prof("update-load"); const tfrag3::Level* lev_data = loader_data->level.get(); m_wind_vectors.clear(); // We changed level! @@ -31,6 +34,7 @@ void Tie3::update_load(const LevelData* loader_data) { size_t max_inds = 0; for (u32 l_geo = 0; l_geo < tfrag3::TIE_GEOS; l_geo++) { for (u32 l_tree = 0; l_tree < lev_data->tie_trees[l_geo].size(); l_tree++) { + auto ul = scoped_prof("load-tree"); size_t wind_idx_buffer_len = 0; size_t num_grps = 0; const auto& tree = lev_data->tie_trees[l_geo][l_tree]; @@ -90,11 +94,7 @@ void Tie3::update_load(const LevelData* loader_data) { ); glGenBuffers(1, &lod_tree[l_tree].single_draw_index_buffer); - glGenBuffers(1, &lod_tree[l_tree].index_buffer); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, lod_tree[l_tree].index_buffer); - // todo: move to loader, this will probably be quite slow. - glBufferData(GL_ELEMENT_ARRAY_BUFFER, tree.unpacked.indices.size() * sizeof(u32), - tree.unpacked.indices.data(), GL_STATIC_DRAW); + lod_tree[l_tree].index_buffer = loader_data->tie_data[l_geo][l_tree].index_buffer; if (wind_idx_buffer_len > 0) { lod_tree[l_tree].wind_matrix_cache.resize(tree.wind_instance_info.size()); @@ -278,7 +278,7 @@ void Tie3::discard_tree_cache() { for (auto& tree : m_trees[geo]) { glBindTexture(GL_TEXTURE_1D, tree.time_of_day_texture); glDeleteTextures(1, &tree.time_of_day_texture); - glDeleteBuffers(1, &tree.index_buffer); + // glDeleteBuffers(1, &tree.index_buffer); glDeleteBuffers(1, &tree.single_draw_index_buffer); glDeleteVertexArrays(1, &tree.vao); } diff --git a/game/graphics/opengl_renderer/loader/Loader.cpp b/game/graphics/opengl_renderer/loader/Loader.cpp index e07c967ce1..6c3c0c5302 100644 --- a/game/graphics/opengl_renderer/loader/Loader.cpp +++ b/game/graphics/opengl_renderer/loader/Loader.cpp @@ -1,5 +1,6 @@ #include "Loader.h" +#include "common/global_profiler/GlobalProfiler.h" #include "common/util/FileUtil.h" #include "common/util/Timer.h" #include "common/util/compress.h" @@ -192,6 +193,7 @@ void Loader::load_common(TexturePool& tex_pool, const std::string& name) { bool Loader::upload_textures(Timer& timer, LevelData& data, TexturePool& texture_pool) { // try to move level from initializing to initialized: + auto evt = scoped_prof("upload-textures"); constexpr int MAX_TEX_BYTES_PER_FRAME = 1024 * 128; int bytes_this_run = 0; @@ -303,6 +305,7 @@ void Loader::update(TexturePool& texture_pool) { loader_input.tex_pool = &texture_pool; for (auto& stage : m_loader_stages) { + auto evt = scoped_prof(fmt::format("stage-{}", stage->name()).c_str()); Timer stage_timer; done = stage->run(loader_timer, loader_input); if (stage_timer.getMs() > 5.f) { @@ -314,6 +317,7 @@ void Loader::update(TexturePool& texture_pool) { } if (done) { + auto evt = scoped_prof("finish-stages"); lk.lock(); m_loaded_tfrag3_levels[name] = std::move(lev); m_initializing_tfrag3_levels.erase(it); @@ -326,6 +330,7 @@ void Loader::update(TexturePool& texture_pool) { } if (!did_gpu_stuff) { + auto evt = scoped_prof("gpu-unload"); // try to remove levels. Timer unload_timer; if (m_loaded_tfrag3_levels.size() >= 3) { @@ -362,6 +367,7 @@ void Loader::update(TexturePool& texture_pool) { if (tie_tree.has_wind) { glDeleteBuffers(1, &tie_tree.wind_indices); } + glDeleteBuffers(1, &tie_tree.index_buffer); } } diff --git a/game/graphics/opengl_renderer/loader/LoaderStages.cpp b/game/graphics/opengl_renderer/loader/LoaderStages.cpp index 7208b06bb4..801a1e2ba3 100644 --- a/game/graphics/opengl_renderer/loader/LoaderStages.cpp +++ b/game/graphics/opengl_renderer/loader/LoaderStages.cpp @@ -2,6 +2,8 @@ #include "Loader.h" +#include "common/global_profiler/GlobalProfiler.h" + constexpr float LOAD_BUDGET = 2.5f; /*! @@ -278,6 +280,7 @@ class TieLoadStage : public LoaderStage { } if (!m_opengl_created) { + auto evt = scoped_prof("tie-opengl-create"); for (int geo = 0; geo < tfrag3::TIE_GEOS; geo++) { auto& in_trees = data.lev_data->level->tie_trees[geo]; for (auto& in_tree : in_trees) { @@ -287,6 +290,11 @@ class TieLoadStage : public LoaderStage { glBufferData(GL_ARRAY_BUFFER, in_tree.unpacked.vertices.size() * sizeof(tfrag3::PreloadedVertex), nullptr, GL_STATIC_DRAW); + + glGenBuffers(1, &tree_out.index_buffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, tree_out.index_buffer); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, in_tree.unpacked.indices.size() * sizeof(u32), + nullptr, GL_STATIC_DRAW); } } m_opengl_created = true; @@ -294,6 +302,7 @@ class TieLoadStage : public LoaderStage { } if (!m_verts_done) { + auto evt = scoped_prof("tie-verts"); constexpr u32 CHUNK_SIZE = 32768; u32 uploaded_bytes = 0; @@ -324,8 +333,12 @@ class TieLoadStage : public LoaderStage { data.lev_data->tie_data[m_next_geo][m_next_tree].vertex_buffer); u32 upload_size = (end_vert_for_chunk - start_vert_for_chunk) * sizeof(tfrag3::PreloadedVertex); - glBufferSubData(GL_ARRAY_BUFFER, start_vert_for_chunk * sizeof(tfrag3::PreloadedVertex), - upload_size, tree.unpacked.vertices.data() + start_vert_for_chunk); + { + auto bsd = scoped_prof(fmt::format("buffer-{}k", upload_size / 1024).c_str()); + glBufferSubData(GL_ARRAY_BUFFER, start_vert_for_chunk * sizeof(tfrag3::PreloadedVertex), + upload_size, tree.unpacked.vertices.data() + start_vert_for_chunk); + } + uploaded_bytes += upload_size; if (complete_tree) { @@ -352,6 +365,7 @@ class TieLoadStage : public LoaderStage { } if (!m_wind_indices_done) { + auto evt = scoped_prof("tie-wind"); bool abort = false; for (; m_next_geo < tfrag3::TIE_GEOS; m_next_geo++) { auto& geo_trees = data.lev_data->level->tie_trees[m_next_geo]; @@ -383,12 +397,75 @@ class TieLoadStage : public LoaderStage { abort = true; } } - m_next_tree = 0; } - m_indices_done = true; - m_done = true; - return true; + m_wind_indices_done = true; + m_next_geo = 0; + m_next_vert = 0; + m_next_tree = 0; + + if (timer.getMs() > LOAD_BUDGET) { + return false; + } + } + + if (!m_indices_done) { + auto evt = scoped_prof("tie-ind"); + constexpr u32 CHUNK_SIZE = 32768 * 8; + u32 uploaded_bytes = 0; + + while (true) { + const auto& tree = data.lev_data->level->tie_trees[m_next_geo][m_next_tree]; + u32 end_ind_in_tree = tree.unpacked.indices.size(); + // the number of indices we'd need to finish the tree right now + size_t num_inds_left_in_tree = end_ind_in_tree - m_next_vert; + size_t start_ind_for_chunk; + size_t end_ind_for_chunk; + + bool complete_tree; + + if (num_inds_left_in_tree > CHUNK_SIZE) { + complete_tree = false; + // should only do partial + start_ind_for_chunk = m_next_vert; + end_ind_for_chunk = start_ind_for_chunk + CHUNK_SIZE; + m_next_vert += CHUNK_SIZE; + } else { + // should do all! + start_ind_for_chunk = m_next_vert; + end_ind_for_chunk = end_ind_in_tree; + complete_tree = true; + } + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, + data.lev_data->tie_data[m_next_geo][m_next_tree].index_buffer); + u32 upload_size = (end_ind_for_chunk - start_ind_for_chunk) * sizeof(u32); + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, start_ind_for_chunk * sizeof(u32), upload_size, + tree.unpacked.indices.data() + start_ind_for_chunk); + uploaded_bytes += upload_size; + + if (complete_tree) { + // and move on to next tree + m_next_vert = 0; + m_next_tree++; + if (m_next_tree >= data.lev_data->level->tie_trees[m_next_geo].size()) { + m_next_tree = 0; + m_next_geo++; + if (m_next_geo >= tfrag3::TIE_GEOS) { + m_indices_done = true; + m_next_tree = 0; + m_next_geo = 0; + m_next_vert = 0; + m_done = true; + return true; + } + } + } + + if (timer.getMs() > LOAD_BUDGET || (uploaded_bytes / 1024) > 2048) { + return false; + } + } } return false; @@ -461,6 +538,23 @@ class CollideLoaderStage : public LoaderStage { bool m_done = false; }; +class StallLoaderStage : public LoaderStage { + public: + StallLoaderStage() : LoaderStage("stall") {} + bool run(Timer&, LoaderInput& data) override { + m_count++; + if (m_count > 10) { + return true; + } + return false; + } + + void reset() override { m_count = 0; } + + private: + int m_count = 0; +}; + MercLoaderStage::MercLoaderStage() : LoaderStage("merc") {} void MercLoaderStage::reset() { m_done = false; @@ -531,5 +625,6 @@ std::vector> make_loader_stages() { ret.push_back(std::make_unique()); ret.push_back(std::make_unique()); ret.push_back(std::make_unique()); + ret.push_back(std::make_unique()); return ret; } \ No newline at end of file diff --git a/game/graphics/opengl_renderer/loader/common.h b/game/graphics/opengl_renderer/loader/common.h index 4c60809fa0..2f5173bb52 100644 --- a/game/graphics/opengl_renderer/loader/common.h +++ b/game/graphics/opengl_renderer/loader/common.h @@ -15,6 +15,7 @@ struct LevelData { struct TieOpenGL { GLuint vertex_buffer; + GLuint index_buffer; bool has_wind = false; GLuint wind_indices; }; diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index 01db62c41b..fcb13a29d8 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -213,7 +213,8 @@ static std::shared_ptr gl_make_display(int width, } auto display = std::make_shared(window, is_main); - + display->set_imgui_visible(Gfx::get_debug_menu_visible_on_startup()); + display->update_cursor_visibility(window, display->is_imgui_visible()); // lg::debug("init display #x{:x}", (uintptr_t)display); // setup imgui @@ -482,19 +483,40 @@ void render_game_frame(int game_width, } void GLDisplay::get_position(int* x, int* y) { - glfwGetWindowPos(m_window, x, y); + std::lock_guard lk(m_lock); + if (x) { + *x = m_display_state.window_pos_x; + } + if (y) { + *y = m_display_state.window_pos_y; + } } void GLDisplay::get_size(int* width, int* height) { - glfwGetFramebufferSize(m_window, width, height); + std::lock_guard lk(m_lock); + if (width) { + *width = m_display_state.window_size_width; + } + if (height) { + *height = m_display_state.window_size_height; + } } void GLDisplay::get_scale(float* xs, float* ys) { - glfwGetWindowContentScale(m_window, xs, ys); + std::lock_guard lk(m_lock); + if (xs) { + *xs = m_display_state.window_scale_x; + } + if (ys) { + *ys = m_display_state.window_scale_y; + } } void GLDisplay::set_size(int width, int height) { - glfwSetWindowSize(m_window, width, height); + // glfwSetWindowSize(m_window, width, height); + m_pending_size.width = width; + m_pending_size.height = height; + m_pending_size.pending = true; if (windowed()) { m_last_windowed_width = width; @@ -566,48 +588,45 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { } int GLDisplay::get_screen_vmode_count() { - int count = 0; - glfwGetVideoModes(get_monitor(fullscreen_screen()), &count); - return count; + std::lock_guard lk(m_lock); + return m_display_state.num_vmodes; } void GLDisplay::get_screen_size(int vmode_idx, s32* w_out, s32* h_out) { - GLFWmonitor* monitor = get_monitor(fullscreen_screen()); - auto vmode = glfwGetVideoMode(monitor); - int count = 0; - auto vmodes = glfwGetVideoModes(monitor, &count); - if (vmode_idx >= 0) { - vmode = &vmodes[vmode_idx]; - } else if (fullscreen_mode() == GfxDisplayMode::Fullscreen) { - for (int i = 0; i < count; ++i) { - if (!vmode || vmode->height < vmodes[i].height) { - vmode = &vmodes[i]; - } + std::lock_guard lk(m_lock); + if (vmode_idx >= 0 && vmode_idx < MAX_VMODES) { + if (w_out) { + *w_out = m_display_state.vmodes[vmode_idx].width; + } + if (h_out) { + *h_out = m_display_state.vmodes[vmode_idx].height; + } + } else if (fullscreen_mode() == Fullscreen) { + if (w_out) { + *w_out = m_display_state.largest_vmode_width; + } + if (h_out) { + *h_out = m_display_state.largest_vmode_height; + } + } else { + if (w_out) { + *w_out = m_display_state.current_vmode.width; + } + if (h_out) { + *h_out = m_display_state.current_vmode.height; } - } - if (w_out) { - *w_out = vmode->width; - } - if (h_out) { - *h_out = vmode->height; } } int GLDisplay::get_screen_rate(int vmode_idx) { - GLFWmonitor* monitor = get_monitor(fullscreen_screen()); - auto vmode = glfwGetVideoMode(monitor); - int count = 0; - auto vmodes = glfwGetVideoModes(monitor, &count); - if (vmode_idx >= 0) { - vmode = &vmodes[vmode_idx]; + std::lock_guard lk(m_lock); + if (vmode_idx >= 0 && vmode_idx < MAX_VMODES) { + return m_display_state.vmodes[vmode_idx].refresh_rate; } else if (fullscreen_mode() == GfxDisplayMode::Fullscreen) { - for (int i = 0; i < count; ++i) { - if (!vmode || vmode->refreshRate < vmodes[i].refreshRate) { - vmode = &vmodes[i]; - } - } + return m_display_state.largest_vmode_refresh_rate; + } else { + return m_display_state.current_vmode.refresh_rate; } - return vmode->refreshRate; } GLFWmonitor* GLDisplay::get_monitor(int index) { @@ -632,8 +651,17 @@ void GLDisplay::set_lock(bool lock) { } bool GLDisplay::fullscreen_pending() { - GLFWmonitor* monitor = get_monitor(fullscreen_screen()); - auto vmode = glfwGetVideoMode(monitor); + GLFWmonitor* monitor; + { + auto _ = scoped_prof("get_monitor"); + monitor = get_monitor(fullscreen_screen()); + } + + const GLFWvidmode* vmode; + { + auto _ = scoped_prof("get-video-mode"); + vmode = glfwGetVideoMode(monitor); + } return GfxDisplay::fullscreen_pending() || (vmode->width != m_last_video_mode.width || vmode->height != m_last_video_mode.height || @@ -658,19 +686,73 @@ void update_global_profiler() { prof().set_enable(g_gfx_data->debug_gui.record_events); } +void GLDisplay::VMode::set(const GLFWvidmode* vmode) { + width = vmode->width; + height = vmode->height; + refresh_rate = vmode->refreshRate; +} + +void GLDisplay::update_glfw() { + auto p = scoped_prof("update_glfw"); + + glfwPollEvents(); + glfwMakeContextCurrent(m_window); + auto& mapping_info = Gfx::get_button_mapping(); + Pad::update_gamepads(mapping_info); + + glfwGetFramebufferSize(m_window, &m_display_state_copy.window_size_width, + &m_display_state_copy.window_size_height); + + glfwGetWindowContentScale(m_window, &m_display_state_copy.window_scale_x, + &m_display_state_copy.window_scale_y); + + glfwGetWindowPos(m_window, &m_display_state_copy.window_pos_x, + &m_display_state_copy.window_pos_y); + + GLFWmonitor* monitor = get_monitor(fullscreen_screen()); + auto current_vmode = glfwGetVideoMode(monitor); + if (current_vmode) { + m_display_state_copy.current_vmode.set(current_vmode); + } + + int count = 0; + auto vmodes = glfwGetVideoModes(monitor, &count); + + if (count > MAX_VMODES) { + fmt::print("got too many vmodes: {}\n", count); + count = MAX_VMODES; + } + + m_display_state_copy.num_vmodes = count; + + m_display_state_copy.largest_vmode_width = 1; + m_display_state_copy.largest_vmode_refresh_rate = 1; + for (int i = 0; i < count; i++) { + if (vmodes[i].width > m_display_state_copy.largest_vmode_width) { + m_display_state_copy.largest_vmode_height = vmodes[i].height; + m_display_state_copy.largest_vmode_width = vmodes[i].width; + } + + if (vmodes[i].refreshRate > m_display_state_copy.largest_vmode_refresh_rate) { + m_display_state_copy.largest_vmode_refresh_rate = vmodes[i].refreshRate; + } + m_display_state_copy.vmodes[i].set(&vmodes[i]); + } + + if (m_pending_size.pending) { + glfwSetWindowSize(m_window, m_pending_size.width, m_pending_size.height); + m_pending_size.pending = false; + } + + std::lock_guard lk(m_lock); + m_display_state = m_display_state_copy; +} + /*! * Main function called to render graphics frames. This is called in a loop. */ void GLDisplay::render() { - // poll events - { - auto p = scoped_prof("poll-gamepads"); - glfwPollEvents(); - glfwMakeContextCurrent(m_window); - - auto& mapping_info = Gfx::get_button_mapping(); - Pad::update_gamepads(mapping_info); - } + update_glfw(); // imgui start of frame { @@ -717,18 +799,30 @@ void GLDisplay::render() { ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); } + // update fullscreen mode, if requested + { + auto p = scoped_prof("fullscreen-update"); + update_last_fullscreen_mode(); + + if (fullscreen_pending() && !minimized()) { + fullscreen_flush(); + } + } + // actual vsync g_gfx_data->debug_gui.finish_frame(); - { - auto p = scoped_prof("swap-buffers"); - glfwSwapBuffers(m_window); - } if (Gfx::g_global_settings.framelimiter) { auto p = scoped_prof("frame-limiter"); g_gfx_data->frame_limiter.run( Gfx::g_global_settings.target_fps, Gfx::g_global_settings.experimental_accurate_lag, Gfx::g_global_settings.sleep_in_frame_limiter, g_gfx_data->last_engine_time); } + + { + auto p = scoped_prof("swap-buffers"); + glfwSwapBuffers(m_window); + } + // actually wait for vsync if (g_gfx_data->debug_gui.should_gl_finish()) { glFinish(); @@ -755,16 +849,6 @@ void GLDisplay::render() { g_gfx_data->sync_cv.notify_all(); } - // update fullscreen mode, if requested - { - auto p = scoped_prof("fullscreen-update"); - update_last_fullscreen_mode(); - - if (fullscreen_pending() && !minimized()) { - fullscreen_flush(); - } - } - // reboot whole game, if requested if (g_gfx_data->debug_gui.want_reboot_in_debug) { g_gfx_data->debug_gui.want_reboot_in_debug = false; @@ -845,6 +929,11 @@ void gl_send_chain(const void* data, u32 offset) { } } +/*! + * Upload texture outside of main DMA chain. + * We trust the game to not remove textures that are currently being used, but if the game is messed + * up, there is a possible race to updating this texture. + */ void gl_texture_upload_now(const u8* tpage, int mode, u32 s7_ptr) { // block if (g_gfx_data) { @@ -855,6 +944,10 @@ void gl_texture_upload_now(const u8* tpage, int mode, u32 s7_ptr) { } } +/*! + * Handle a local->local texture copy. The texture pool can just update texture pointers. + * This is called from the main thread and the texture pool itself will handle locking. + */ void gl_texture_relocate(u32 destination, u32 source, u32 format) { if (g_gfx_data) { g_gfx_data->texture_pool->relocate(destination, source, format); diff --git a/game/graphics/pipelines/opengl.h b/game/graphics/pipelines/opengl.h index 40d53be35f..37f983dc7f 100644 --- a/game/graphics/pipelines/opengl.h +++ b/game/graphics/pipelines/opengl.h @@ -6,6 +6,8 @@ */ #define GLFW_INCLUDE_NONE +#include + #include "game/graphics/display.h" #include "game/graphics/gfx.h" @@ -52,10 +54,44 @@ class GLDisplay : public GfxDisplay { void update_cursor_visibility(GLFWwindow* window, bool is_visible); private: + void update_glfw(); + GLFWwindow* m_window; bool m_minimized = false; GLFWvidmode m_last_video_mode = {0, 0, 0, 0, 0, 0}; + static constexpr int MAX_VMODES = 128; + + struct VMode { + void set(const GLFWvidmode* vmode); + int width = 640, height = 480; + int refresh_rate = 60; + }; + + struct DisplayState { + s32 window_pos_x = 0; + s32 window_pos_y = 0; + int window_size_width = 640, window_size_height = 480; + float window_scale_x = 1.f, window_scale_y = 1.f; + + bool pending_size_change = false; + s32 requested_size_width = 0; + s32 requested_size_height = 0; + + int num_vmodes = 0; + VMode vmodes[MAX_VMODES]; + int largest_vmode_width = 640, largest_vmode_height = 480; + int largest_vmode_refresh_rate = 60; + VMode current_vmode; + } m_display_state, m_display_state_copy; + std::mutex m_lock; + + struct { + bool pending = false; + int width = 0; + int height = 0; + } m_pending_size; + GLFWmonitor* get_monitor(int index); }; diff --git a/game/kernel/common/kmachine.cpp b/game/kernel/common/kmachine.cpp index e665602ece..df86ebebb6 100644 --- a/game/kernel/common/kmachine.cpp +++ b/game/kernel/common/kmachine.cpp @@ -340,6 +340,7 @@ void DecodeTime(u32 ptr) { */ /*! * Get a 300MHz timer value. + * Called from EE thread */ u64 read_ee_timer() { u64 ns = ee_clock_timer.getNs(); @@ -354,7 +355,7 @@ void c_memmove(u32 dst, u32 src, u32 size) { } /*! - * Returns size of window. + * Returns size of window. Called from game thread */ void get_window_size(u32 w_ptr, u32 h_ptr) { if (w_ptr) { diff --git a/game/kernel/jak1/kmachine.cpp b/game/kernel/jak1/kmachine.cpp index 6bf3c6f78a..50dbd93fe1 100644 --- a/game/kernel/jak1/kmachine.cpp +++ b/game/kernel/jak1/kmachine.cpp @@ -381,10 +381,16 @@ int ShutdownMachine() { } // todo, these could probably be moved to common +/*! + * Called from game thread to submit rendering DMA chain. + */ void send_gfx_dma_chain(u32 /*bank*/, u32 chain) { Gfx::send_chain(g_ee_main_mem, chain); } +/*! + * Called from game thread to upload a texture outside of the main DMA chain. + */ void pc_texture_upload_now(u32 page, u32 mode) { Gfx::texture_upload_now(Ptr(page).c(), mode, s7.offset); } @@ -393,11 +399,20 @@ void pc_texture_relocate(u32 dst, u32 src, u32 format) { Gfx::texture_relocate(dst, src, format); } +/*! + * Called from the game thread at initialization. + * The game thread is the only one to touch the mips2c function table (through the linker and + * through this function), so no locking is needed. + */ u64 pc_get_mips2c(u32 name) { const char* n = Ptr(name).c()->data(); return Mips2C::gLinkedFunctionTable.get(n); } +/*! + * Called from the game thread at each frame to tell the PC rendering code which levels to start + * loading. The loader internally handles locking. + */ void pc_set_levels(u32 l0, u32 l1) { std::string l0s = Ptr(l0).c()->data(); std::string l1s = Ptr(l1).c()->data(); diff --git a/game/runtime.cpp b/game/runtime.cpp index 96061b522c..69620fa929 100644 --- a/game/runtime.cpp +++ b/game/runtime.cpp @@ -355,20 +355,28 @@ RuntimeExitStatus exec_runtime(int argc, char** argv) { // TODO relegate this to its own function if (enable_display) { Gfx::Loop([]() { return MasterExit == RuntimeExitStatus::RUNNING; }); - Gfx::Exit(); } // hack to make the IOP die quicker if it's loading/unloading music gMusicFade = 0; + // if we have no display, wait here for DECI to shutdown deci_thread.join(); - // DECI has been killed, shutdown! + + // fully shut down EE first before stopping the other threads + ee_thread.join(); // to be extra sure tm.shutdown(); // join and exit tm.join(); + + // kill renderer after all threads are stopped. + // this makes sure the std::shared_ptr is destroyed in the main thread. + if (enable_display) { + Gfx::Exit(); + } lg::info("GOAL Runtime Shutdown (code {})", MasterExit); munmap(g_ee_main_mem, EE_MAIN_MEM_SIZE); return MasterExit; From 7fd206be9c8e46253d1fe06a70552856ae3ca3a5 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 20 Aug 2022 10:41:03 -0400 Subject: [PATCH 13/23] game: add a speedrunner mode which enables a faster new-game/resetting experience (#1773) game: add a speedrunner mode which enables a faster new-game - skips intro cutscene - removes auto-save prompt --- Taskfile.yml | 9 +++- decompiler/config/all-types.gc | 1 + game/assets/jak1/text/game_text_en.gs | 3 ++ goal_src/jak1/engine/debug/default-menu.gc | 1 + goal_src/jak1/engine/game/game-save.gc | 4 +- goal_src/jak1/engine/ui/progress/progress.gc | 20 ++++++--- goal_src/jak1/engine/ui/text-h.gc | 1 + goal_src/jak1/pc/pckernel-h.gc | 2 + goal_src/jak1/pc/pckernel.gc | 4 +- goal_src/jak1/pc/progress-pc.gc | 46 ++++++++++++++++++-- 10 files changed, 80 insertions(+), 11 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index db2b7a73b9..5a51a5dfb0 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -36,12 +36,19 @@ tasks: cmds: - '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/{{.DECOMP_CONFIG}}" ./iso_data ./decompiler_out --config-override "{\\\"decompile_code\\\": false}"' boot-game: - desc: "Boots the game, it will fail if it's not already booted!" + desc: "Boots the game, it will fail if it's not already compiled!" preconditions: - sh: test -f {{.GK_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}} msg: "Couldn't locate runtime executable in '{{.GK_BIN_RELEASE_DIR}}/gk'" cmds: - "{{.GK_BIN_RELEASE_DIR}}/gk -boot -fakeiso -debug -v" + boot-game-retail: + desc: "Boots the game without debug mode, it will fail if it's not already compiled!" + preconditions: + - sh: test -f {{.GK_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}} + msg: "Couldn't locate runtime executable in '{{.GK_BIN_RELEASE_DIR}}/gk'" + cmds: + - "{{.GK_BIN_RELEASE_DIR}}/gk -boot -fakeiso -v" run-game: desc: "Start the game's runtime, to start the game itself the REPL is required" preconditions: diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index d9295e4f4a..9f418348cb 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -1608,6 +1608,7 @@ (scene-255 #x12ff) (hint-0 #x1300) (hint-511 #x14ff) + (speedrunner-mode #x1500) ;; GAME-TEXT-ID ENUM ENDS ) diff --git a/game/assets/jak1/text/game_text_en.gs b/game/assets/jak1/text/game_text_en.gs index 063361e547..9c954f2701 100644 --- a/game/assets/jak1/text/game_text_en.gs +++ b/game/assets/jak1/text/game_text_en.gs @@ -356,6 +356,9 @@ (#x1116 "NORSK" "NORSK") +(#x1500 "SPEEDRUNNER MODE" + "SPEEDRUNNER MODE") + ;; ----------------- ;; test (DO NOT TRANSLATE) diff --git a/goal_src/jak1/engine/debug/default-menu.gc b/goal_src/jak1/engine/debug/default-menu.gc index 57198902dc..0351d7a3f2 100644 --- a/goal_src/jak1/engine/debug/default-menu.gc +++ b/goal_src/jak1/engine/debug/default-menu.gc @@ -4668,6 +4668,7 @@ (flag "uk-english" 6 dm-text-language) ) (flag "Discord RPC" #t ,(dm-lambda-boolean-flag (-> *pc-settings* discord-rpc?))) + (flag "Speedrunner Mode" #t ,(dm-lambda-boolean-flag (-> *pc-settings* speedrunner-mode?))) (menu "PS2 settings" ;(flag "PS2 Load speed" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-read-speed?))) (flag "PS2 Particles" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-parts?))) diff --git a/goal_src/jak1/engine/game/game-save.gc b/goal_src/jak1/engine/game/game-save.gc index b8b69d51af..89c3cbb8c6 100644 --- a/goal_src/jak1/engine/game/game-save.gc +++ b/goal_src/jak1/engine/game/game-save.gc @@ -1726,7 +1726,9 @@ ) (suspend) ) - (activate-progress *dproc* (progress-screen auto-save)) + ;; Don't display the auto-save warning prompt if speedrunning + (when (= (-> *pc-settings* speedrunner-mode?) #f) + (activate-progress *dproc* (progress-screen auto-save))) ) ) ) diff --git a/goal_src/jak1/engine/ui/progress/progress.gc b/goal_src/jak1/engine/ui/progress/progress.gc index 1ec474f0bd..df1e55b552 100644 --- a/goal_src/jak1/engine/ui/progress/progress.gc +++ b/goal_src/jak1/engine/ui/progress/progress.gc @@ -1727,11 +1727,21 @@ (let ((gp-1 (-> *setting-control* default auto-save))) (sound-volume-off) (set! (-> *game-info* mode) 'play) - (initialize! *game-info* 'game (the-as game-save #f) "intro-start") - (set! (-> *setting-control* default auto-save) gp-1) - ) - (set-master-mode 'game) - ) + ;; Start a new game differently if speedrunning mode is active + (cond ((= (-> *pc-settings* speedrunner-mode?) #t) + ;; spawn at the warp gate + (initialize! *game-info* 'game (the-as game-save #f) "game-start") + ;; disable hints (this seems to be overriden by your slot 1 save though) + (set! (-> *setting-control* default play-hints) #f) + ;; skip intro cutscene + (close-specific-task! (game-task intro) (task-status need-resolution)) + ;; enable auto saving by default + (set! (-> *setting-control* default auto-save) #t)) + ;; start the game normally + (else + (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + (set! (-> *setting-control* default auto-save) gp-1)))) + (set-master-mode 'game)) (else (set! v0-0 (the-as none -1)) (set! (-> self next-display-state) (the-as progress-screen v0-0)) diff --git a/goal_src/jak1/engine/ui/text-h.gc b/goal_src/jak1/engine/ui/text-h.gc index 4a5f613bf5..ea68b0149e 100644 --- a/goal_src/jak1/engine/ui/text-h.gc +++ b/goal_src/jak1/engine/ui/text-h.gc @@ -758,6 +758,7 @@ (scene-255 #x12ff) (hint-0 #x1300) (hint-511 #x14ff) + (speedrunner-mode #x1500) ;; GAME-TEXT-ID ENUM ENDS ) diff --git a/goal_src/jak1/pc/pckernel-h.gc b/goal_src/jak1/pc/pckernel-h.gc index 2559eab64f..1d3fef3a1d 100644 --- a/goal_src/jak1/pc/pckernel-h.gc +++ b/goal_src/jak1/pc/pckernel-h.gc @@ -313,6 +313,7 @@ (scenes-seen uint8 PC_SPOOL_LOG_LENGTH) ;; cutscenes that have been seen, by spool-anim (maybe use 8-char name or bits instead?) (discord-rpc? symbol) ;; enable discord rich presence integration + (speedrunner-mode? symbol) ;; enable speedrunner mode (cheats pc-cheats) (cheats-known pc-cheats) @@ -415,6 +416,7 @@ (set! (-> obj aspect-custom-x) 4) (set! (-> obj aspect-custom-y) 3) (set! (-> obj discord-rpc?) #t) + (set! (-> obj speedrunner-mode?) #f) (set! (-> obj window-lock?) #t) (reset-gfx obj) diff --git a/goal_src/jak1/pc/pckernel.gc b/goal_src/jak1/pc/pckernel.gc index 135f563d62..2a124fbf27 100644 --- a/goal_src/jak1/pc/pckernel.gc +++ b/goal_src/jak1/pc/pckernel.gc @@ -810,7 +810,7 @@ (set! (-> obj aspect-custom-y) (file-stream-read-int file)) ;; aspect auto (set! (-> obj aspect-ratio-auto?) (file-stream-read-symbol file)) - + (unless (-> obj aspect-ratio-auto?) (set-aspect! obj (-> obj aspect-custom-x) (-> obj aspect-custom-y)) ) @@ -850,6 +850,7 @@ (("subtitles?") (set! (-> obj subtitles?) (file-stream-read-symbol file))) (("hinttitles?") (set! (-> obj hinttitles?) (file-stream-read-symbol file))) (("discord-rpc?") (set! (-> obj discord-rpc?) (file-stream-read-symbol file))) + (("speedrunner-mode?") (set! (-> obj speedrunner-mode?) (file-stream-read-symbol file))) (("first-camera-h-inverted?") (set! (-> obj first-camera-h-inverted?) (file-stream-read-symbol file))) (("first-camera-v-inverted?") (set! (-> obj first-camera-v-inverted?) (file-stream-read-symbol file))) (("third-camera-h-inverted?") (set! (-> obj third-camera-h-inverted?) (file-stream-read-symbol file))) @@ -971,6 +972,7 @@ (format file " (use-vis? ~A)~%" (-> obj use-vis?)) (format file " (skip-movies? ~A)~%" (-> obj skip-movies?)) (format file " (discord-rpc? ~A)~%" (-> obj discord-rpc?)) + (format file " (speedrunner-mode? ~A)~%" (-> obj speedrunner-mode?)) (format file " (first-camera-h-inverted? ~A)~%" (-> obj first-camera-h-inverted?)) (format file " (first-camera-v-inverted? ~A)~%" (-> obj first-camera-v-inverted?)) (format file " (third-camera-h-inverted? ~A)~%" (-> obj third-camera-h-inverted?)) diff --git a/goal_src/jak1/pc/progress-pc.gc b/goal_src/jak1/pc/progress-pc.gc index 5a7eb56566..3a59269c7a 100644 --- a/goal_src/jak1/pc/progress-pc.gc +++ b/goal_src/jak1/pc/progress-pc.gc @@ -162,6 +162,7 @@ (define *misc-options* (new 'static 'boxed-array :type game-option (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id money-starburst) :scale #t) (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id discord-rpc) :scale #t) + (new 'static 'game-option :option-type (game-option-type on-off) :name (game-text-id speedrunner-mode) :scale #t) (new 'static 'game-option :option-type (game-option-type button) :name (game-text-id back) :scale #t) ) ) @@ -750,6 +751,7 @@ (set! (-> *graphic-options-no-frame-rate-pc* 4 value-to-modify) (&-> *progress-carousell* int-backup)) (set! (-> *misc-options* 0 value-to-modify) (&-> *pc-settings* money-starburst?)) (set! (-> *misc-options* 1 value-to-modify) (&-> *pc-settings* discord-rpc?)) + (set! (-> *misc-options* 2 value-to-modify) (&-> *pc-settings* speedrunner-mode?)) (set! (-> *camera-options* 0 value-to-modify) (&-> *pc-settings* first-camera-h-inverted?)) (set! (-> *camera-options* 1 value-to-modify) (&-> *pc-settings* first-camera-v-inverted?)) (set! (-> *camera-options* 2 value-to-modify) (&-> *pc-settings* third-camera-h-inverted?)) @@ -1479,11 +1481,13 @@ ((< (-> obj option-index) 4) (sound-play "start-options") (set! (-> *progress-state* which) (-> obj option-index)) + ;; save slot selected (if (zero? (-> s5-0 file (-> obj option-index) present)) (set! (-> obj next-display-state) (progress-screen memcard-saving)) (set! (-> obj next-display-state) (progress-screen memcard-data-exists)) ) ) + ;; continue without saving ((and (= (-> obj display-state) (progress-screen save-game-title)) (= (-> obj option-index) 4)) (sound-play "starts-options") (sound-volume-off) @@ -1526,7 +1530,19 @@ (sound-play "cursor-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) - (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + ;; Start a new game differently if speedrunning mode is active + (cond ((= (-> *pc-settings* speedrunner-mode?) #t) + ;; spawn at the warp gate + (initialize! *game-info* 'game (the-as game-save #f) "game-start") + ;; disable hints (this seems to be overriden by your slot 1 save though) + (set! (-> *setting-control* default play-hints) #f) + ;; skip intro cutscene + (close-specific-task! (game-task intro) (task-status need-resolution)) + ;; enable auto saving by default + (set! (-> *setting-control* default auto-save) #t)) + ;; start the game normally + (else + (initialize! *game-info* 'game (the-as game-save #f) "intro-start"))) (set-master-mode 'game) ) ) @@ -1540,7 +1556,19 @@ (sound-play "start-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) - (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + ;; Start a new game differently if speedrunning mode is active + (cond ((= (-> *pc-settings* speedrunner-mode?) #t) + ;; spawn at the warp gate + (initialize! *game-info* 'game (the-as game-save #f) "game-start") + ;; disable hints (this seems to be overriden by your slot 1 save though) + (set! (-> *setting-control* default play-hints) #f) + ;; skip intro cutscene + (close-specific-task! (game-task intro) (task-status need-resolution)) + ;; enable auto saving by default + (set! (-> *setting-control* default auto-save) #t)) + ;; start the game normally + (else + (initialize! *game-info* 'game (the-as game-save #f) "intro-start"))) (set-master-mode 'game) ) ((nonzero? (-> obj display-state-stack 0)) @@ -1623,7 +1651,19 @@ (sound-play "start-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) - (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + ;; Start a new game differently if speedrunning mode is active + (cond ((= (-> *pc-settings* speedrunner-mode?) #t) + ;; spawn at the warp gate + (initialize! *game-info* 'game (the-as game-save #f) "game-start") + ;; disable hints (this seems to be overriden by your slot 1 save though) + (set! (-> *setting-control* default play-hints) #f) + ;; skip intro cutscene + (close-specific-task! (game-task intro) (task-status need-resolution)) + ;; enable auto saving by default + (set! (-> *setting-control* default auto-save) #t)) + ;; start the game normally + (else + (initialize! *game-info* 'game (the-as game-save #f) "intro-start"))) (set-master-mode 'game) ) (else From dec7da2110eaee4afc351a76f9521541bb8977b0 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sun, 21 Aug 2022 18:13:27 -0400 Subject: [PATCH 14/23] game: windowed mode related fixes (#1778) * game: restore windowed mode settings properly * game: use the game version for saving settings/saves * game: prevent windowed mode from being auto-centered on initial init * game: save and restore window coordinates * lint: formatting --- common/util/FileUtil.cpp | 14 +++++----- common/util/FileUtil.h | 5 ++-- game/graphics/display.cpp | 41 ++++++++++++++++++++++++++++++ game/graphics/display.h | 15 ++++++++--- game/graphics/gfx.h | 2 +- game/graphics/pipelines/opengl.cpp | 23 ++++++++++++----- game/graphics/pipelines/opengl.h | 5 ++-- game/kernel/common/kmemcard.cpp | 21 ++++++++------- game/kernel/jak1/kmachine.cpp | 3 +-- game/kernel/jak2/kmachine.cpp | 3 +-- goal_src/jak1/pc/pckernel.gc | 17 ++++++++----- 11 files changed, 107 insertions(+), 42 deletions(-) diff --git a/common/util/FileUtil.cpp b/common/util/FileUtil.cpp index ffc8412baa..0234383710 100644 --- a/common/util/FileUtil.cpp +++ b/common/util/FileUtil.cpp @@ -33,8 +33,8 @@ #include #include #endif +#include "common/log/log.h" #include "common/util/Assert.h" -#include namespace file_util { fs::path get_user_home_dir() { @@ -66,14 +66,14 @@ fs::path get_user_config_dir() { return config_base_path / "OpenGOAL"; } -fs::path get_user_settings_dir() { - // TODO - jak2 - return get_user_config_dir() / "jak1" / "settings"; +fs::path get_user_settings_dir(GameVersion game_version) { + auto game_version_name = game_version_names[game_version]; + return get_user_config_dir() / game_version_name / "settings"; } -fs::path get_user_memcard_dir() { - // TODO - jak2 - return get_user_config_dir() / "jak1" / "saves"; +fs::path get_user_memcard_dir(GameVersion game_version) { + auto game_version_name = game_version_names[game_version]; + return get_user_config_dir() / game_version_name / "saves"; } struct { diff --git a/common/util/FileUtil.h b/common/util/FileUtil.h index a830b4c185..99c7fa6e23 100644 --- a/common/util/FileUtil.h +++ b/common/util/FileUtil.h @@ -22,14 +22,15 @@ #include #include "common/common_types.h" +#include "common/versions.h" namespace fs = ghc::filesystem; namespace file_util { fs::path get_user_home_dir(); fs::path get_user_config_dir(); -fs::path get_user_settings_dir(); -fs::path get_user_memcard_dir(); +fs::path get_user_settings_dir(GameVersion game_version); +fs::path get_user_memcard_dir(GameVersion game_version); fs::path get_jak_project_dir(); bool create_dir_if_needed(const fs::path& path); diff --git a/game/graphics/display.cpp b/game/graphics/display.cpp index 5e75124175..652f2e4a62 100644 --- a/game/graphics/display.cpp +++ b/game/graphics/display.cpp @@ -5,9 +5,17 @@ #include "display.h" +#include + #include "gfx.h" #include "common/log/log.h" +#include "common/util/FileUtil.h" +#include "common/util/json_util.h" + +#include "game/runtime.h" + +#include "third-party/json.hpp" /* ******************************** @@ -61,6 +69,35 @@ int GfxDisplay::height() { return h; } +void GfxDisplay::save_display_settings() { + nlohmann::json json; + json["window_xpos"] = m_last_windowed_xpos; + json["window_ypos"] = m_last_windowed_ypos; + std::string file_path = + (file_util::get_user_settings_dir(g_game_version) / "display-settings.json").string(); + file_util::write_text_file(file_path, json.dump(2)); +} + +void GfxDisplay::restore_display_settings() { + try { + std::string file_path = + (file_util::get_user_settings_dir(g_game_version) / "display-settings.json").string(); + if (!file_util::file_exists(file_path)) { + return; + } + auto raw = file_util::read_text_file(file_path); + auto json = parse_commented_json(raw, "display-settings.json"); + if (json.contains("window_xpos")) { + m_last_windowed_xpos = json.at("window_xpos").get(); + } + if (json.contains("window_ypos")) { + m_last_windowed_ypos = json.at("window_ypos").get(); + } + } catch (std::exception& e) { + // do nothing + } +} + /* ******************************** * DISPLAY @@ -93,6 +130,8 @@ int InitMainDisplay(int width, return 1; } set_main_display(display); + // Restore window settings + display->restore_display_settings(); return 0; } @@ -108,6 +147,8 @@ void KillDisplay(std::shared_ptr display) { } if (GetMainDisplay() == display) { + // Save the main display's position to a file so it can be restored upon re-opening + display->save_display_settings(); // killing the main display, kill all children displays too! while (g_displays.size() > 1) { KillDisplay(g_displays.at(1)); diff --git a/game/graphics/display.h b/game/graphics/display.h index 91e9833e22..aca9a4821b 100644 --- a/game/graphics/display.h +++ b/game/graphics/display.h @@ -28,12 +28,13 @@ class GfxDisplay { // next mode GfxDisplayMode m_fullscreen_target_mode = GfxDisplayMode::Windowed; // current mode (start as -1 to force an initial fullscreen update) - GfxDisplayMode m_fullscreen_mode = (GfxDisplayMode)-1; + GfxDisplayMode m_fullscreen_mode = GfxDisplayMode::ForceUpdate; // previous mode (last frame) GfxDisplayMode m_last_fullscreen_mode = GfxDisplayMode::Windowed; - int m_last_windowed_xpos = 0; - int m_last_windowed_ypos = 0; + // move it a bit away from the top, or the title bar can be hidden + int m_last_windowed_xpos = 50; + int m_last_windowed_ypos = 50; int m_last_windowed_width = 640; int m_last_windowed_height = 480; @@ -84,6 +85,14 @@ class GfxDisplay { int width(); int height(); + + struct DisplaySettings { + int window_xpos; + int window_ypos; + }; + + void save_display_settings(); + void restore_display_settings(); }; namespace Display { diff --git a/game/graphics/gfx.h b/game/graphics/gfx.h index 4ec8f72ce6..df76cb5f4f 100644 --- a/game/graphics/gfx.h +++ b/game/graphics/gfx.h @@ -21,7 +21,7 @@ class GfxDisplay; // enum for rendering pipeline enum class GfxPipeline { Invalid = 0, OpenGL }; -enum GfxDisplayMode { Windowed = 0, Fullscreen = 1, Borderless = 2 }; +enum GfxDisplayMode { ForceUpdate = -1, Windowed = 0, Fullscreen = 1, Borderless = 2 }; // module for the different rendering pipelines struct GfxRendererModule { diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index fcb13a29d8..e2877b2ee1 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -371,14 +371,18 @@ void GLDisplay::on_cursor_position(GLFWwindow* window, double xposition, double } void GLDisplay::on_window_pos(GLFWwindow* /*window*/, int xpos, int ypos) { - if (m_fullscreen_target_mode == GfxDisplayMode::Windowed) { + // only change them on a legit change, not on the initial update + if (m_fullscreen_mode != GfxDisplayMode::ForceUpdate && + m_fullscreen_target_mode == GfxDisplayMode::Windowed) { m_last_windowed_xpos = xpos; m_last_windowed_ypos = ypos; } } void GLDisplay::on_window_size(GLFWwindow* /*window*/, int width, int height) { - if (m_fullscreen_target_mode == GfxDisplayMode::Windowed) { + // only change them on a legit change, not on the initial update + if (m_fullscreen_mode != GfxDisplayMode::ForceUpdate && + m_fullscreen_target_mode == GfxDisplayMode::Windowed) { m_last_windowed_width = width; m_last_windowed_height = height; } @@ -556,11 +560,13 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { glfwSetWindowMonitor(m_window, NULL, x, y, width, height, GLFW_DONT_CARE); - // these might have changed - m_last_windowed_width = width; - m_last_windowed_height = height; - m_last_windowed_xpos = x; - m_last_windowed_ypos = y; + // these might have changed, only store them on a legit change, not on the initial update + if (m_last_fullscreen_mode != GfxDisplayMode::ForceUpdate) { + m_last_windowed_width = width; + m_last_windowed_height = height; + m_last_windowed_xpos = x; + m_last_windowed_ypos = y; + } } break; case GfxDisplayMode::Fullscreen: { // fullscreen @@ -584,6 +590,9 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { glfwSetWindowMonitor(m_window, NULL, x, y, vmode->width, vmode->height, GLFW_DONT_CARE); #endif } break; + default: { + break; + } } } diff --git a/game/graphics/pipelines/opengl.h b/game/graphics/pipelines/opengl.h index 37f983dc7f..6b655ca52e 100644 --- a/game/graphics/pipelines/opengl.h +++ b/game/graphics/pipelines/opengl.h @@ -69,8 +69,9 @@ class GLDisplay : public GfxDisplay { }; struct DisplayState { - s32 window_pos_x = 0; - s32 window_pos_y = 0; + // move it a bit away from the top by default + s32 window_pos_x = 50; + s32 window_pos_y = 50; int window_size_width = 640, window_size_height = 480; float window_scale_x = 1.f, window_scale_y = 1.f; diff --git a/game/kernel/common/kmemcard.cpp b/game/kernel/common/kmemcard.cpp index 39d84092f4..e915af2ea2 100644 --- a/game/kernel/common/kmemcard.cpp +++ b/game/kernel/common/kmemcard.cpp @@ -116,7 +116,7 @@ u32 mc_checksum(Ptr data, s32 size) { * PC port function that returns whether a given bank ID's file exists or not. */ bool file_is_present(int id, int bank = 0) { - auto bankname = file_util::get_user_memcard_dir() / filename[4 + id * 2 + bank]; + auto bankname = file_util::get_user_memcard_dir(g_game_version) / filename[4 + id * 2 + bank]; if (!fs::exists(bankname) || fs::file_size(bankname) < BANK_TOTAL_SIZE) { // file doesn't exist, or size is bad. we do not want to open files that will crash on read! return false; @@ -146,13 +146,14 @@ void pc_update_card() { // int highest_save_count = 0; mc_last_file = -1; for (s32 file = 0; file < 4; file++) { - auto bankname = file_util::get_user_memcard_dir() / filename[4 + file * 2]; + auto bankname = file_util::get_user_memcard_dir(g_game_version) / filename[4 + file * 2]; mc_files[file].present = file_is_present(file); if (mc_files[file].present) { auto bankdata = file_util::read_binary_file(bankname.string()); auto header1 = reinterpret_cast(bankdata.data()); if (file_is_present(file, 1)) { - auto bankname2 = file_util::get_user_memcard_dir() / filename[1 + 4 + file * 2]; + auto bankname2 = + file_util::get_user_memcard_dir(g_game_version) / filename[1 + 4 + file * 2]; auto bankdata2 = file_util::read_binary_file(bankname2.string()); auto header2 = reinterpret_cast(bankdata2.data()); @@ -189,7 +190,7 @@ void pc_game_save_synch() { Timer mc_timer; mc_timer.start(); pc_update_card(); - auto path = file_util::get_user_memcard_dir() / filename[0]; + auto path = file_util::get_user_memcard_dir(g_game_version) / filename[0]; file_util::create_dir_if_needed_for_file(path.string()); // cd_reprobe_save // @@ -211,7 +212,8 @@ void pc_game_save_synch() { // file*2 + p4 is the bank (2 banks per file, p4 is 0 or 1 to select the bank) // 4 is the first bank file mc_print("open {} for saving", filename[op.param2 * 2 + 4 + p4]); - auto save_path = file_util::get_user_memcard_dir() / filename[op.param2 * 2 + 4 + p4]; + auto save_path = + file_util::get_user_memcard_dir(g_game_version) / filename[op.param2 * 2 + 4 + p4]; file_util::create_dir_if_needed_for_file(save_path.string()); auto fd = file_util::open_file(save_path.string().c_str(), "wb"); mc_print("synchronous save file open took {:.2f}ms\n", mc_timer.getMs()); @@ -281,11 +283,12 @@ void pc_game_load_open_file(FILE* fd) { if (fclose(fd) == 0) { // cb_closedload // // added : check if aux bank exists - if (p2 < 1 && - fs::exists(file_util::get_user_memcard_dir() / filename[op.param2 * 2 + 4 + p2 + 1])) { + if (p2 < 1 && fs::exists(file_util::get_user_memcard_dir(g_game_version) / + filename[op.param2 * 2 + 4 + p2 + 1])) { p2++; mc_print("reading next save bank {}", filename[op.param2 * 2 + 4 + p2]); - auto new_bankname = file_util::get_user_memcard_dir() / filename[op.param2 * 2 + 4 + p2]; + auto new_bankname = + file_util::get_user_memcard_dir(g_game_version) / filename[op.param2 * 2 + 4 + p2]; auto new_fd = file_util::open_file(new_bankname.string().c_str(), "rb"); pc_game_load_open_file(new_fd); } else { @@ -402,7 +405,7 @@ void pc_game_load_synch() { p2 = 0; mc_print("opening save file {}", filename[op.param2 * 2 + 4]); - auto path = file_util::get_user_memcard_dir() / filename[op.param2 * 2 + 4]; + auto path = file_util::get_user_memcard_dir(g_game_version) / filename[op.param2 * 2 + 4]; auto fd = file_util::open_file(path.string().c_str(), "rb"); pc_game_load_open_file(fd); diff --git a/game/kernel/jak1/kmachine.cpp b/game/kernel/jak1/kmachine.cpp index 50dbd93fe1..8d4330020e 100644 --- a/game/kernel/jak1/kmachine.cpp +++ b/game/kernel/jak1/kmachine.cpp @@ -677,8 +677,7 @@ void InitMachine_PCPort() { auto user_dir_path = file_util::get_user_config_dir(); intern_from_c("*pc-user-dir-base-path*")->value = make_string_from_c(user_dir_path.string().c_str()); - // TODO - we will eventually need a better way to know what game we are playing - auto settings_path = file_util::get_user_settings_dir(); + auto settings_path = file_util::get_user_settings_dir(g_game_version); intern_from_c("*pc-settings-folder*")->value = make_string_from_c(settings_path.string().c_str()); intern_from_c("*pc-settings-built-sha*")->value = make_string_from_c(GIT_VERSION); } diff --git a/game/kernel/jak2/kmachine.cpp b/game/kernel/jak2/kmachine.cpp index f9ec84c603..6cc370b12b 100644 --- a/game/kernel/jak2/kmachine.cpp +++ b/game/kernel/jak2/kmachine.cpp @@ -521,8 +521,7 @@ void InitMachine_PCPort() { auto user_dir_path = file_util::get_user_config_dir(); intern_from_c("*pc-user-dir-base-path*")->value() = make_string_from_c(user_dir_path.string().c_str()); - // TODO - we will eventually need a better way to know what game we are playing - auto settings_path = file_util::get_user_settings_dir(); + auto settings_path = file_util::get_user_settings_dir(g_game_version); intern_from_c("*pc-settings-folder*")->value() = make_string_from_c(settings_path.string().c_str()); intern_from_c("*pc-settings-built-sha*")->value() = make_string_from_c(GIT_VERSION); diff --git a/goal_src/jak1/pc/pckernel.gc b/goal_src/jak1/pc/pckernel.gc index 2a124fbf27..68658a7102 100644 --- a/goal_src/jak1/pc/pckernel.gc +++ b/goal_src/jak1/pc/pckernel.gc @@ -48,18 +48,18 @@ ;;;; updates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - (defmethod set-display-mode! pc-settings ((obj pc-settings) (mode symbol)) "sets the game's display mode" - ;; change the display mode. (set! (-> obj display-mode) mode) + ;; if windowed mode, set the size properly + (when (= (-> obj display-mode) 'windowed) + (pc-set-window-size (max PC_MIN_WIDTH (-> obj win-width)) (max PC_MIN_HEIGHT (-> obj win-height)))) 0) (defmethod set-size! pc-settings ((obj pc-settings) (width int) (height int)) "sets the size of the display window" - (format #t "Setting size to ~D x ~D~%" width height) + (format 0 "Setting ~A size to ~D x ~D~%" (-> obj display-mode) width height) (cond ((= 'windowed (-> obj display-mode)) (set! (-> obj win-width) width) @@ -73,7 +73,6 @@ ) (none)) - (defmethod set-aspect! pc-settings ((obj pc-settings) (aw int) (ah int)) "set the aspect ratio used for rendering. this forces native widescreen and takes width and height ratios." (let ((aspect (/ (the float aw) (the float ah)))) @@ -916,6 +915,10 @@ (format 0 "pc settings file read: ~A~%" filename) + ;; restore the windowed mode resolution properly + (when (= (-> obj display-mode) 'windowed) + (pc-set-window-size (max PC_MIN_WIDTH (-> obj win-width)) (max PC_MIN_HEIGHT (-> obj win-height)))) + #t ) @@ -932,13 +935,13 @@ (format file "(settings #x~X~%" (-> obj version)) (format file " (fps ~D)~%" (-> obj target-fps)) - (format file " (game-size ~D ~D)~%" (-> obj width) (-> obj height)) (format file " (msaa ~D)~%" (-> obj gfx-msaa)) - (format file " (window-size ~D ~D)~%" (-> obj win-width) (-> obj win-height)) (format file " (aspect-state ~A ~D ~D ~A)~%" (-> *setting-control* default aspect-ratio) (-> obj aspect-custom-x) (-> obj aspect-custom-y) (-> obj aspect-ratio-auto?)) (format file " (display-mode ~A)~%" (-> obj display-mode)) + (format file " (window-size ~D ~D)~%" (-> obj win-width) (-> obj win-height)) + (format file " (game-size ~D ~D)~%" (-> obj width) (-> obj height)) (format file " (monitor ~D)~%" (-> obj monitor)) (format file " (letterbox ~A)~%" (-> obj letterbox?)) (format file " (vsync ~A)~%" (-> obj vsync?)) From 665c578ccfb7ac49bb5c1e8ba8b0cf0e344e53f9 Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Sun, 21 Aug 2022 23:13:47 +0100 Subject: [PATCH 15/23] [game] cutscene skipping (#1779) * split some subtitles * allow cutscene skipping in retail and fix softlock * formatting * make intro skipping work? * citadel sagecage skipping * finalboss sage skipping * quicker quit to title * uk text fixes * fisher cutscene skipping * fix test --- .../jak1/subtitle/game_subtitle_en-uk.gd | 69 +++++++++++-------- game/assets/jak1/subtitle/game_subtitle_en.gd | 15 ++-- .../engine/common-obs/process-taskable.gc | 8 ++- goal_src/jak1/engine/ui/progress/progress.gc | 27 ++++---- goal_src/jak1/game.gp | 4 +- goal_src/jak1/levels/citadel/citadel-sages.gc | 9 +++ goal_src/jak1/levels/finalboss/robotboss.gc | 4 ++ .../jak1/levels/finalboss/sage-finalboss.gc | 10 +++ goal_src/jak1/levels/jungle/fisher.gc | 43 ++++++++++++ goal_src/jak1/levels/misty/sidekick-human.gc | 18 +++++ goal_src/jak1/levels/title/title-obs.gc | 38 +++++++--- goal_src/jak1/levels/village1/sage.gc | 10 +++ .../levels/village1/sequence-a-village1.gc | 18 ++++- goal_src/jak1/pc/progress-pc.gc | 5 ++ 14 files changed, 219 insertions(+), 59 deletions(-) diff --git a/game/assets/jak1/subtitle/game_subtitle_en-uk.gd b/game/assets/jak1/subtitle/game_subtitle_en-uk.gd index d299c27d32..4ceafe613e 100644 --- a/game/assets/jak1/subtitle/game_subtitle_en-uk.gd +++ b/game/assets/jak1/subtitle/game_subtitle_en-uk.gd @@ -43,8 +43,9 @@ ) ("sagevb25" :hint #x90c - (3 "SAGE" "GOOD WORK, THE BLUE ECO CAUSED THE DOOR TO OPEN. WITH BLUE ECO, YOU CAN BREATHE") - (365 "SAGE" "ENERGY INTO ALL KINDS OF PRECURSOR ARTEFACTS THAT HAVE LAIN DORMANT FOR YEARS.") + (3 "SAGE" "GOOD WORK, THE BLUE ECO CAUSED THE DOOR TO OPEN.") + (250 "SAGE" "WITH BLUE ECO, YOU CAN BREATHE ENERGY INTO ALL KINDS") + (476 "SAGE" "OF PRECURSOR ARTEFACTS THAT HAVE LAIN DORMANT FOR YEARS.") ) ;; ----------------- @@ -56,10 +57,12 @@ ;; ----------------- ("bird-lady-beach-resolution" - (30 "BIRDWATCHER" "OH MY, I HOPE THE POOR DEAR'S OKAY. HERE'S A POWER CELL FOR YOUR VALOUR.") - (243) + (30 "BIRDWATCHER" "OH MY, I HOPE THE POOR DEAR'S OKAY.") + (148) + (157 "BIRDWATCHER" "HERE'S A POWER CELL FOR YOUR VALOUR.") + (237) (306 "FLUT FLUT" "MAMA!") - (354) + (351) (406 "FLUT FLUT" "MAMA!") (430 "DAXTER" "OH NO! NO, NO, NO, NO!") (533) @@ -78,14 +81,18 @@ (245) (251 "DAXTER" "HUH! YOU DON'T LOOK SO GOOD YOURSELF, LADY!") (328) - (331 "BIRDWATCHER" "OH, SORRY. I THOUGHT YOU WERE A SPOTTED ORANGE-BELLIED RAIN FRAY.") - (451) - (454 "BIRDWATCHER" "YOU KNOW, YESTERDAY I SAW SOME TERRIBLY VICIOUS CREATURES") - (578 "BIRDWATCHER" "CAPTURE A MOTHER FLUT FLUT NEAR THE BEACH.") + (331 "BIRDWATCHER" "OH, SORRY. I THOUGHT YOU WERE A SPOTTED") + (408 "BIRDWATCHER" "ORANGE-BELLIED RAIN FRAY.") + (454) + (457 "BIRDWATCHER" "YOU KNOW, YESTERDAY I SAW SOME") + (536 "BIRDWATCHER" "TERRIBLY VICIOUS CREATURES CAPTURE") + (590 "BIRDWATCHER" "A MOTHER FLUT FLUT NEAR THE BEACH.") (648) - (654 :offscreen "BIRDWATCHER" "NOW THERE'S THIS POOR LITTLE ORPHAN EGG SITTING IN A NEST AT THE TOP OF THE CLIFF") - (796 :offscreen "BIRDWATCHER" "AND I CAN'T GET TO IT. IF YOU COULD CLIMB UP THERE AND PUSH IT OFF, I'VE PILED") - (945 :offscreen "BIRDWATCHER" "SOME HAY DOWN AT THE BASE TO CATCH IT SAFELY.") + (654 :offscreen "BIRDWATCHER" "NOW THERE'S THIS POOR LITTLE ORPHAN EGG") + (730 :offscreen "BIRDWATCHER" "SITTING IN A NEST AT THE TOP OF THE CLIFF") + (794 :offscreen "BIRDWATCHER" "AND I CAN'T GET TO IT.") + (854 :offscreen "BIRDWATCHER" "IF YOU COULD CLIMB UP THERE AND PUSH IT OFF, I'VE PILED") + (946 :offscreen "BIRDWATCHER" "SOME HAY DOWN AT THE BASE TO CATCH IT SAFELY.") (1041) (1044 "BIRDWATCHER" "DO AN OLD LADY A FAVOUR, AND I'LL GIVE YOU A POWER CELL.") (1198) @@ -108,7 +115,7 @@ ;; ----------------- ("sage-bluehut-introduction-prec-arm" - (0 "SAGE" "WELL, I HOPE YOU'VE PACKED A LUNCH.'CAUSE WE'RE JUST GETTING STARTED.") + (0 "SAGE" "WELL, I HOPE YOU'VE PACKED A LUNCH. 'CAUSE WE'RE JUST GETTING STARTED.") (130) (140 "SAGE" "ACCORDING TO THE BLUE SAGE'S NOTES,") (208 "SAGE" "LURKERS HAVE INFESTED THE SWAMP ACROSS THE BAY.") @@ -244,10 +251,11 @@ (418) (441 "OLD MAN" "HA HA HA HA HA!") (500) - (528 "OLD MAN" "I'D HARDLY CALL IT \"STRUGGLE.\" WOULD YOU, DEAR SISTER?") + (528 "OLD MAN" "I'D HARDLY CALL IT \"STRUGGLE.\"") + (618 "OLD MAN" "WOULD YOU, DEAR SISTER?") (672 "WOMAN" "CERTAINLY NOT. THE RED SAGE GAVE UP WITH SO LITTLE EFFORT.") - (799) - (806 "WOMAN" "NO FUN AT ALL.") + (800) + (805 "WOMAN" "NO FUN AT ALL.") (860) (884 "SAGE" "GOL? IS THAT YOU?") (965) @@ -265,7 +273,8 @@ (1996 "GOL" "WE'VE LEARNED ITS SECRETS, AND NOW WE CAN RESHAPE THE WORLD TO OUR LIKING.") (2212) (2223 "SAGE" "YOU CAN'T CONTROL DARK ECO BY ITSELF! EVEN THE PRECURSORS COULDN'T-") - (2357 "MAIA" "UNTIL NOW, WE'VE HAD TO SCRAPE BY WITH WHAT LITTLE DARK ECO WE COULD FIND NEAR THE SURFACE.") + (2357 "MAIA" "UNTIL NOW, WE'VE HAD TO SCRAPE BY WITH WHAT LITTLE DARK ECO") + (2452 "MAIA" "WE COULD FIND NEAR THE SURFACE.") (2508) (2520 "MAIA" "BUT SOON, WE WILL HAVE ACCESS TO THE VAST STORES") (2611 "MAIA" "OF DARK ECO HIDDEN DEEP UNDERGROUND.") @@ -275,9 +284,10 @@ (2841 "GOL" "THEY WILL BE OPENED, AND ALL THE DARK ECO IN THE WORLD WILL BE OURS!") (3028) (3034 "SAGE" "BUT THAT'S IMPOSSIBLE! ONLY A PRECURSOR ROBOT-") - (3128 "MAIA" "OH, DON'T LOOK SO UPSET, SAMOS. WE'VE GOT BIG PLANS FOR YOU.") + (3128 "MAIA" "OH, DON'T LOOK SO UPSET, SAMOS.") + (3210 "MAIA" "WE'VE GOT BIG PLANS FOR YOU.") (3300) - (3303 :offscreen "MAIA" "AH HA HA HA HA HA HA! AH...") + (3303 :offscreen "MAIA" "AH HA HA HA HA HA HA! AHH...") (3460) (3495 "DAXTER" "WAIT A MINUTE!") (3538) @@ -290,13 +300,15 @@ (3822) (3828 "SAGE" "WE MAY ALL BE DOOMED.") (3897) - (3903 "SAGE" "IF THEY OPEN THE SILOS, THE DARK ECO WILL TWIST AND DESTROY EVERYTHING IT TOUCHES!") + (3903 "SAGE" "IF THEY OPEN THE SILOS, THE DARK ECO WILL") + (3995 "SAGE" "TWIST AND DESTROY EVERYTHING IT TOUCHES!") (4080 "SAGE" "WE SIMPLY MUST GET TO THEIR CITADEL, TO STOP THEM!") (4189) - (4192 "KEIRA" "THE FASTEST WAY THERE IS THROUGH THE LAVA TUBE AT THE BOTTOM OF THIS CRATER.") + (4192 "KEIRA" "THE FASTEST WAY THERE IS THROUGH THE LAVA TUBE") + (4276 "KEIRA" "AT THE BOTTOM OF THIS CRATER.") (4316) (4324 "KEIRA" "A FEW MORE POWER CELLS, AND YOUR ZOOMER'S HEAT SHIELD") - (4400 "KEIRA" "SHOULD GET YOU ACROSS THE LAVA SAFELY.") + (4398 "KEIRA" "SHOULD GET YOU ACROSS THE LAVA SAFELY.") (4460) (4464 "SAGE" "ALL RIGHT, MY BOY. YOU KNOW WHAT TO DO.") (4545 "SAGE" "TAKE THE FLEABAG AND GO ROUND UP MORE POWER CELLS.") @@ -327,18 +339,21 @@ ;; ----------------- ("green-sagecage-introduction" - (130 "SAGE" "IT'S ABOUT TIME YOU TWO DECIDED TO SHOW UP!") - (207 "DAXTER" "NICE TO SEE YOU TOO! DO THEY HAVE YOU MOPPING THE FLOORS NOW?") + (128 "SAGE" "IT'S ABOUT TIME YOU TWO DECIDED TO SHOW UP!") + (207 "DAXTER" "NICE TO SEE YOU TOO!") + (269) + (275 "DAXTER" "DO THEY HAVE YOU MOPPING THE FLOORS NOW?") (343 "SAGE" "THERE'S NO TIME FOR JOKES, DAXTER. GOL AND MAIA KIDNAPPED US") (477 "SAGE" "TO SAP OUR ENERGIES TO POWER THEIR ABOMINABLE MACHINE.") (574) - (584 :offscreen "SAGE" "IT APPEARS THEY HAVE COMBINED THE FUNCTIONAL REMAINS OF A PRECURSOR ROBOT") - (710 :offscreen "SAGE" "WITH SCAVENGED ARTEFACTS FROM ACROSS THE LAND.") + (583 :offscreen "SAGE" "IT APPEARS THEY HAVE COMBINED THE FUNCTIONAL REMAINS OF A PRECURSOR ROBOT") + (709 :offscreen "SAGE" "WITH SCAVENGED ARTEFACTS FROM ACROSS THE LAND.") (800) (816 :offscreen "SAGE" "THEN THEY ADDED A FEW DIABOLICAL ADDITIONS OF THEIR OWN,") (926 :offscreen "SAGE" "CREATING THE ONE THING CAPABLE OF OPENING THE DARK ECO SILOS.") (1060 "SAGE" "IF YOU CAN FREE THE FOUR OF US, WE CAN USE OUR COMBINED POWERS") - (1180 "SAGE" "TO BREAK THE FORCE SHIELD SURROUNDING THE ROBOT, BEFORE THEY USE IT TO DESTROY THE WORLD.") + (1180 "SAGE" "TO BREAK THE FORCE SHIELD SURROUNDING THE ROBOT") + (1265 "SAGE" "BEFORE THEY USE IT TO DESTROY THE WORLD.") ) ;; ----------------- diff --git a/game/assets/jak1/subtitle/game_subtitle_en.gd b/game/assets/jak1/subtitle/game_subtitle_en.gd index aa78cb1d20..f91d6c0f5f 100644 --- a/game/assets/jak1/subtitle/game_subtitle_en.gd +++ b/game/assets/jak1/subtitle/game_subtitle_en.gd @@ -379,16 +379,21 @@ (640 "SAGE" "ARTIFACTS WHEN YOU GET NEAR THEM.") ) -("sagevb23" :hint #x90a (0 "SAGE" "NOTICE HOW EACH BLUE ECO CLUSTER YOU PICK UP INCREASES THE TIME YOU CAN USE ITS POWER.")) +("sagevb23" :hint #x90a + (0 "SAGE" "NOTICE HOW EACH BLUE ECO CLUSTER YOU PICK UP") + (199 "SAGE" "INCREASES THE TIME YOU CAN USE ITS POWER.") + ) ("sagevb24" :hint #x90b - (3 "SAGE" "THIS IS A PRECURSOR DOOR. IT CAN ONLY BE OPENED BY APPROACHING THE DOOR") + (3 "SAGE" "THIS IS A PRECURSOR DOOR.") + (169 "SAGE" "IT CAN ONLY BE OPENED BY APPROACHING THE DOOR") (357 "SAGE" "WHILE CHANNELLING BLUE ECO THROUGH YOUR BODY.") ) ("sagevb25" :hint #x90c - (3 "SAGE" "GOOD WORK, THE BLUE ECO CAUSED THE DOOR TO OPEN. WITH BLUE ECO, YOU CAN BREATHE") - (365 "SAGE" "ENERGY INTO ALL KINDS OF PRECURSOR ARTIFACTS THAT HAVE LAIN DORMANT FOR YEARS.") + (3 "SAGE" "GOOD WORK, THE BLUE ECO CAUSED THE DOOR TO OPEN.") + (250 "SAGE" "WITH BLUE ECO, YOU CAN BREATHE ENERGY INTO ALL KINDS") + (476 "SAGE" "OF PRECURSOR ARTIFACTS THAT HAVE LAIN DORMANT FOR YEARS.") ) ("sagevb26" :hint #x90d (0 "SAGE" "USE YOUR GOGGLES TO VIEW YOUR PROGRESS DURING THE ADVENTURE.")) @@ -1456,7 +1461,7 @@ ) ("sage-bluehut-introduction-prec-arm" - (0 "SAGE" "WELL, I HOPE YOU'VE PACKED A LUNCH.'CAUSE WE'RE JUST GETTING STARTED.") + (0 "SAGE" "WELL, I HOPE YOU'VE PACKED A LUNCH. 'CAUSE WE'RE JUST GETTING STARTED.") (130) (140 "SAGE" "ACCORDING TO THE BLUE SAGE'S NOTES,") (208 "SAGE" "LURKERS HAVE INFESTED THE SWAMP ACROSS THE BAY.") diff --git a/goal_src/jak1/engine/common-obs/process-taskable.gc b/goal_src/jak1/engine/common-obs/process-taskable.gc index c5b27ed117..f10e702ed7 100644 --- a/goal_src/jak1/engine/common-obs/process-taskable.gc +++ b/goal_src/jak1/engine/common-obs/process-taskable.gc @@ -432,7 +432,11 @@ (if (-> self blend-on-exit) (set! (-> self blend-on-exit) arg0) ) - (if (and *debug-segment* *cheat-mode*) + ;; allow cutscene skipping on pc port + ;; save a sort of timestamp just so we know whether it took at least 1 frame + (#when PC_PORT + (define *play-anim-time* (current-time))) + (if (#if PC_PORT #t (and *debug-segment* *cheat-mode*)) (ja-play-spooled-anim (the-as spool-anim arg1) arg0 @@ -446,6 +450,8 @@ (the-as (function process-drawable symbol) false-func) ) ) + (#when PC_PORT + (if (= (current-time) *play-anim-time*) (suspend))) (remove-setting! 'music-volume) (remove-setting! 'sfx-volume) (remove-setting! 'ambient-volume) diff --git a/goal_src/jak1/engine/ui/progress/progress.gc b/goal_src/jak1/engine/ui/progress/progress.gc index df1e55b552..57f3c8757d 100644 --- a/goal_src/jak1/engine/ui/progress/progress.gc +++ b/goal_src/jak1/engine/ui/progress/progress.gc @@ -1728,19 +1728,20 @@ (sound-volume-off) (set! (-> *game-info* mode) 'play) ;; Start a new game differently if speedrunning mode is active - (cond ((= (-> *pc-settings* speedrunner-mode?) #t) - ;; spawn at the warp gate - (initialize! *game-info* 'game (the-as game-save #f) "game-start") - ;; disable hints (this seems to be overriden by your slot 1 save though) - (set! (-> *setting-control* default play-hints) #f) - ;; skip intro cutscene - (close-specific-task! (game-task intro) (task-status need-resolution)) - ;; enable auto saving by default - (set! (-> *setting-control* default auto-save) #t)) - ;; start the game normally - (else - (initialize! *game-info* 'game (the-as game-save #f) "intro-start") - (set! (-> *setting-control* default auto-save) gp-1)))) + (cond + ((= (-> *pc-settings* speedrunner-mode?) #t) + ;; spawn at the warp gate + (initialize! *game-info* 'game (the-as game-save #f) "game-start") + ;; disable hints (this seems to be overriden by your slot 1 save though) + (set! (-> *setting-control* default play-hints) #f) + ;; skip intro cutscene + (close-specific-task! (game-task intro) (task-status need-resolution)) + ;; enable auto saving by default + (set! (-> *setting-control* default auto-save) #t)) + ;; start the game normally + (else + (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + (set! (-> *setting-control* default auto-save) gp-1)))) (set-master-mode 'game)) (else (set! v0-0 (the-as none -1)) diff --git a/goal_src/jak1/game.gp b/goal_src/jak1/game.gp index d8ef1ef291..f9b07cda01 100644 --- a/goal_src/jak1/game.gp +++ b/goal_src/jak1/game.gp @@ -1599,7 +1599,9 @@ (goal-src-sequence "levels/title/" :deps ;; no idea what these depend on, make it depend on the whole engine - ("$OUT/obj/ticky.o") + ("$OUT/obj/ticky.o" + "$OUT/obj/progress-pc.o" + ) "title-obs.gc" ) diff --git a/goal_src/jak1/levels/citadel/citadel-sages.gc b/goal_src/jak1/levels/citadel/citadel-sages.gc index baf146e07b..88d18f1ffb 100644 --- a/goal_src/jak1/levels/citadel/citadel-sages.gc +++ b/goal_src/jak1/levels/citadel/citadel-sages.gc @@ -1066,6 +1066,15 @@ ) ) ) + (#when PC_PORT + (when (and (= (get-response (-> self query)) 'no) (or (not (= *cheat-mode* 'debug)) (not (cpad-hold? 0 r1))) (= (-> self which-movie) 1)) + (format #t "skipped green-sagecage~%") + (start 'play (get-continue-by-name *game-info* "citadel-elevator")) + (set! (-> self draw bounds w) 10240.0) + ((-> (method-of-type process-taskable play-anim) exit)) + (set! (-> self which-movie) 2) + (return #f) + )) (cond ((= (-> self which-movie) 1) (set-blackout-frames (seconds 100)) diff --git a/goal_src/jak1/levels/finalboss/robotboss.gc b/goal_src/jak1/levels/finalboss/robotboss.gc index e93493b335..04e80110a6 100644 --- a/goal_src/jak1/levels/finalboss/robotboss.gc +++ b/goal_src/jak1/levels/finalboss/robotboss.gc @@ -804,6 +804,10 @@ (while (movie?) (suspend) ) + (#when PC_PORT + (-! (-> self state-time) (seconds 0.95)) + ((-> self state trans)) + ) (let ((a0-18 (handle->process gp-1))) (if a0-18 (deactivate a0-18) diff --git a/goal_src/jak1/levels/finalboss/sage-finalboss.gc b/goal_src/jak1/levels/finalboss/sage-finalboss.gc index 65b6aefae2..7618a852ed 100644 --- a/goal_src/jak1/levels/finalboss/sage-finalboss.gc +++ b/goal_src/jak1/levels/finalboss/sage-finalboss.gc @@ -600,6 +600,16 @@ (none) ) :exit (behavior () + (#when PC_PORT + (when (and (= (get-response (-> self query)) 'no) (or (not (= *cheat-mode* 'debug)) (not (cpad-hold? 0 r1)))) + (case (current-status (-> self tasks)) + (((task-status need-reminder-a)) + (format #t "sage finalboss exit in status ~S~%" (task-status->string (current-status (-> self tasks)))) + (close-specific-task! (game-task finalboss-movies) (task-status need-reminder-a)) + (set! (-> self kick-the-credits) #t) + ) + )) + ) (when (= (current-status (-> self tasks)) (task-status invalid)) (cond ((not (-> self credits-played)) diff --git a/goal_src/jak1/levels/jungle/fisher.gc b/goal_src/jak1/levels/jungle/fisher.gc index c9e625998d..1d698af5da 100644 --- a/goal_src/jak1/levels/jungle/fisher.gc +++ b/goal_src/jak1/levels/jungle/fisher.gc @@ -1636,6 +1636,43 @@ ) ) +(#when PC_PORT +;; pc port needs its own implementation of play-anim for cutscene skipping +(define *fisher-camera-backup-fov* (degrees 46.2356)) +(define *fisher-camera-backup-trans* (new 'static 'vector :x 1095664.2500 :y 15926.4003 :z -945203.3750 :w 1.0000)) +(define *fisher-camera-backup-matrix* (new 'static 'matrix :vector (new 'static 'inline-array vector 4 + (new 'static 'vector :x -0.8677 :y -0.0000 :z 0.4969) + (new 'static 'vector :x -0.0081 :y 0.9998 :z -0.0141) + (new 'static 'vector :x -0.4968 :y -0.0163 :z -0.8676) + (new 'static 'vector :w 1.0) + ))) +(define *fisher-camera-use-backup* #f) + +(defstate play-anim (fisher) + :virtual #t + + :enter (behavior () + (set! *fisher-camera-use-backup* #f) + ((-> (method-of-type process-taskable play-anim) enter)) + 0 + (none)) + + :exit (behavior () + (set! *fisher-camera-use-backup* (and (= (get-response (-> self query)) 'no) (or (not (= *cheat-mode* 'debug)) (not (cpad-hold? 0 r1))) + (-> self training))) + (set! (-> self cur-trans-hook) (lambda () (when *fisher-camera-use-backup* + (set! (-> *camera-other-fov* data) *fisher-camera-backup-fov*) + (vector-copy! *camera-other-trans* *fisher-camera-backup-trans*) + (matrix-copy! *camera-other-matrix* *fisher-camera-backup-matrix*) + ) + (none))) + ((-> (method-of-type process-taskable play-anim) exit)) + 0 + (none)) + + ) +) + (defstate query (fisher) :virtual #t :enter (behavior () @@ -1650,6 +1687,12 @@ ) (none) ) + :exit (behavior () + (#when PC_PORT + ;; needed for cutscene skipping + (set! (-> self cur-trans-hook) nothing) + ) + ((-> (method-of-type process-taskable play-anim) exit))) ) (defmethod TODO-RENAME-43 fisher ((obj fisher)) diff --git a/goal_src/jak1/levels/misty/sidekick-human.gc b/goal_src/jak1/levels/misty/sidekick-human.gc index 3c27187cd5..97bf827da5 100644 --- a/goal_src/jak1/levels/misty/sidekick-human.gc +++ b/goal_src/jak1/levels/misty/sidekick-human.gc @@ -1485,6 +1485,15 @@ ) ) ((-> (method-of-type process-taskable play-anim) exit)) + (#when PC_PORT + ;; extra stuff when skipping cutscene + (when (and (= (get-response (-> self query)) 'no) (or (not (= *cheat-mode* 'debug)) (not (cpad-hold? 0 r1)))) + (close-specific-task! (game-task intro) (task-status need-resolution)) + (start 'play (get-continue-by-name *game-info* "game-start")) + (set-blackout-frames (seconds 0.1)) + (return #f) + ) + ) (let ((gp-1 (entity-by-name "sequenceC-1"))) (set-blackout-frames (seconds 20)) (send-event *camera* 'clear-entity) @@ -1666,6 +1675,15 @@ ) ) ((-> (method-of-type process-taskable play-anim) exit)) + (#when PC_PORT + ;; extra stuff when skipping cutscene + (when (and (= (get-response (-> self query)) 'no) (or (not (= *cheat-mode* 'debug)) (not (cpad-hold? 0 r1)))) + (close-specific-task! (game-task intro) (task-status need-resolution)) + (start 'play (get-continue-by-name *game-info* "game-start")) + (set-blackout-frames (seconds 0.1)) + (return #f) + ) + ) (start 'play (get-continue-by-name *game-info* "village1-intro")) (none) ) diff --git a/goal_src/jak1/levels/title/title-obs.gc b/goal_src/jak1/levels/title/title-obs.gc index c88fb2c5d2..ae4f65fd7f 100644 --- a/goal_src/jak1/levels/title/title-obs.gc +++ b/goal_src/jak1/levels/title/title-obs.gc @@ -490,15 +490,16 @@ ) :trans (behavior () ((-> (method-of-type logo startup) trans)) - (if (and (or *debug-segment* PC_PORT) - (cpad-pressed? 0 start circle x) - (member (level-status *level* 'village1) '(loaded active)) - ) + (if (and *debug-segment* + (cpad-pressed? 0 start circle x) + (member (level-status *level* 'village1) '(loaded active)) + ) (set-setting! 'bg-a 'abs 1.0 0) ) (when (and (= (-> *setting-control* current bg-a) 1.0) (and (member (level-status *level* 'village1) '(active loaded)) - (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 3)) + ;; i think we can forgo the time check here... + (#if PC_PORT #t (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 3))) (let ((gp-2 (level-get *level* 'village1))) (when gp-2 (load-state-want-levels 'title 'village1) @@ -556,12 +557,27 @@ (send-event (handle->process (-> self sidekick)) 'origin-joint-index 6) (set! (-> self anim) (-> self next-anim)) (set! (-> self next-anim) (new 'static 'spool-anim :name "logo-intro" :index 5 :parts 3 :command-list '())) - (ja-play-spooled-anim - (-> self anim) - (the-as art-joint-anim #f) - (the-as art-joint-anim #f) - (the-as (function process-drawable symbol) false-func) - ) + (#cond + (PC_PORT + (cond + (*quit-to-title* + (set! *quit-to-title* #f)) + (else + (ja-play-spooled-anim + (-> self anim) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (the-as (function process-drawable symbol) false-func) + )) + )) + (#t + (ja-play-spooled-anim + (-> self anim) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (the-as (function process-drawable symbol) false-func) + ) + )) (set! (-> self done?) #t) (set-setting! 'bg-a 'abs 1.0 0) (anim-loop) diff --git a/goal_src/jak1/levels/village1/sage.gc b/goal_src/jak1/levels/village1/sage.gc index cf8be68b9e..bb371eb984 100644 --- a/goal_src/jak1/levels/village1/sage.gc +++ b/goal_src/jak1/levels/village1/sage.gc @@ -506,6 +506,16 @@ ) ) ((-> (method-of-type process-taskable play-anim) exit)) + (#when PC_PORT + ;; extra stuff when skipping cutscene + (when (and (= (get-response (-> self query)) 'no) (or (not (= *cheat-mode* 'debug)) (not (cpad-hold? 0 r1))) + (= (current-task (-> self tasks)) (game-task intro))) + (close-specific-task! (game-task intro) (task-status need-resolution)) + (start 'play (get-continue-by-name *game-info* "game-start")) + (set-blackout-frames (seconds 0.1)) + (return #f) + ) + ) (case (get-task-status (game-task intro)) (((task-status need-resolution)) (remove-setting! 'music-volume-movie) diff --git a/goal_src/jak1/levels/village1/sequence-a-village1.gc b/goal_src/jak1/levels/village1/sequence-a-village1.gc index 5f3a346a1b..cb63f64211 100644 --- a/goal_src/jak1/levels/village1/sequence-a-village1.gc +++ b/goal_src/jak1/levels/village1/sequence-a-village1.gc @@ -301,6 +301,18 @@ ) ) ((-> (method-of-type process-taskable play-anim) exit)) + (#when PC_PORT + ;; extra stuff when skipping cutscene + (when (and (= (get-response (-> self query)) 'no) (or (not (= *cheat-mode* 'debug)) (not (cpad-hold? 0 r1)))) + (close-specific-task! (game-task intro) (task-status need-resolution)) + (start 'play (get-continue-by-name *game-info* "game-start")) + (set-blackout-frames (seconds 0.1)) + (if (nonzero? (-> self part)) + (kill-and-free-particles (-> self part)) + ) + (return #f) + ) + ) (let ((gp-0 (entity-by-name "sequenceB-1"))) (set-blackout-frames (seconds 20)) (send-event *camera* 'clear-entity) @@ -315,7 +327,11 @@ (none) ) :trans (behavior () - (spool-push *art-control* "sage-intro-sequence-b" 0 self -1.0) + ;; yeah they messed up a little bit here + (#if PC_PORT + (spool-push *art-control* "sidekick-human-intro-sequence-b" 0 self -1.0) + (spool-push *art-control* "sage-intro-sequence-b" 0 self -1.0) + ) ((-> (method-of-type process-taskable play-anim) trans)) (none) ) diff --git a/goal_src/jak1/pc/progress-pc.gc b/goal_src/jak1/pc/progress-pc.gc index 3a59269c7a..e7134b63be 100644 --- a/goal_src/jak1/pc/progress-pc.gc +++ b/goal_src/jak1/pc/progress-pc.gc @@ -52,6 +52,10 @@ (1+! (-> *progress-scroll* start-index)))) +;; used in title logo +(define *quit-to-title* #f) + + ;; ############################ ;; CAROUSELL STUFF ;; ############################ @@ -1630,6 +1634,7 @@ (((progress-screen quit)) (cond ((-> *progress-state* yes-no-choice) + (set! *quit-to-title* #t) (sound-play "start-options") (sound-volume-off) (set! (-> *game-info* mode) 'play) From a3dac2ab245a5b4841c41fe9bec55f87949ca0ed Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Mon, 22 Aug 2022 00:14:39 +0200 Subject: [PATCH 16/23] game: add new cheats to debug menu (#1780) add new cheats to debug menu --- goal_src/jak1/engine/debug/default-menu.gc | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/goal_src/jak1/engine/debug/default-menu.gc b/goal_src/jak1/engine/debug/default-menu.gc index 0351d7a3f2..6e4c8425cf 100644 --- a/goal_src/jak1/engine/debug/default-menu.gc +++ b/goal_src/jak1/engine/debug/default-menu.gc @@ -4596,6 +4596,36 @@ ) (menu "Secrets" (menu "PC cheats" + (flag "Big head jak" #f (lambda (arg (msg debug-menu-msg)) + (when (= msg (debug-menu-msg press)) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) big-head) + ) + (pc-cheats? (-> *pc-settings* cheats) big-head))) + (flag "Small head jak" #f (lambda (arg (msg debug-menu-msg)) + (when (= msg (debug-menu-msg press)) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) small-head) + ) + (pc-cheats? (-> *pc-settings* cheats) small-head))) + (flag "Big fist jak" #f (lambda (arg (msg debug-menu-msg)) + (when (= msg (debug-menu-msg press)) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) big-fist) + ) + (pc-cheats? (-> *pc-settings* cheats) big-fist))) + (flag "Big head npcs" #f (lambda (arg (msg debug-menu-msg)) + (when (= msg (debug-menu-msg press)) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) big-head-npc) + ) + (pc-cheats? (-> *pc-settings* cheats) big-head-npc))) + (flag "Huge head jak" #f (lambda (arg (msg debug-menu-msg)) + (when (= msg (debug-menu-msg press)) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) huge-head) + ) + (pc-cheats? (-> *pc-settings* cheats) huge-head))) + (flag "Mirrored mode" #f (lambda (arg (msg debug-menu-msg)) + (when (= msg (debug-menu-msg press)) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) mirror) + ) + (pc-cheats? (-> *pc-settings* cheats) mirror))) (flag "Blue eco" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) (logclear! (-> *pc-settings* cheats) (pc-cheats eco-red eco-yellow eco-green)) @@ -4622,6 +4652,7 @@ (pc-cheats? (-> *pc-settings* cheats) eco-yellow))) (flag "Invincibility" #f (lambda (arg (msg debug-menu-msg)) (when (= msg (debug-menu-msg press)) + (logclear! (-> *target* state-flags) 16) (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) invinc) ) (pc-cheats? (-> *pc-settings* cheats) invinc))) @@ -4640,6 +4671,26 @@ (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) sky) ) (pc-cheats? (-> *pc-settings* cheats) sky))) + (flag "No textures" #f (lambda (arg (msg debug-menu-msg)) + (when (= msg (debug-menu-msg press)) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) no-tex) + ) + (pc-cheats? (-> *pc-settings* cheats) no-tex))) + (flag "Boods" #f (lambda (arg (msg debug-menu-msg)) + (when (= msg (debug-menu-msg press)) + (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) oh-my-goodness) + ) + (pc-cheats? (-> *pc-settings* cheats) oh-my-goodness))) +;; (flag "Hard rats" #f (lambda (arg (msg debug-menu-msg)) +;; (when (= msg (debug-menu-msg press)) +;; (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) hard-rats) +;; ) +;; (pc-cheats? (-> *pc-settings* cheats) hard-rats))) +;; (flag "Hero mode" #f (lambda (arg (msg debug-menu-msg)) +;; (when (= msg (debug-menu-msg press)) +;; (pc-cheat-toggle-and-tune (-> *pc-settings* cheats) hero-mode) +;; ) +;; (pc-cheats? (-> *pc-settings* cheats) hero-mode))) ) ) (flag "Letterbox" #f ,(dm-lambda-boolean-flag (-> *pc-settings* letterbox?))) From b388aa7b712a89d49bf36bf6f144c26e5d560a4d Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sun, 21 Aug 2022 19:00:13 -0400 Subject: [PATCH 17/23] add option to disable mouse hiding (#1782) * add option to disable mouse hiding * write setting --- game/graphics/gfx.cpp | 3 +++ game/graphics/pipelines/opengl.cpp | 8 +++++--- game/system/newpad.h | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/game/graphics/gfx.cpp b/game/graphics/gfx.cpp index 896d6b1bd1..ea1b6c640c 100644 --- a/game/graphics/gfx.cpp +++ b/game/graphics/gfx.cpp @@ -94,6 +94,7 @@ void DumpToJson(ghc::filesystem::path& filename) { nlohmann::json json; json["Debug Menu Visibility"] = false; // Assume start up debug display is disabled auto& peripherals_json = json["Peripherals"]; + json["Use Mouse"] = g_settings.pad_mapping_info.use_mouse; for (uint32_t i = 0; i < Pad::CONTROLLER_COUNT; ++i) { nlohmann::json peripheral_json; @@ -154,6 +155,8 @@ void LoadPeripheralSettings(const ghc::filesystem::path& filepath) { g_is_debug_menu_visible_on_startup = configuration["Debug Menu Visibility"].get(); } + g_settings.pad_mapping_info.use_mouse = configuration.value("Use Mouse", false); + int controller_index = 0; for (const auto& peripheral : configuration["Peripherals"]) { auto& controller_buttons_json = peripheral["Controller"]["Buttons"]; diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index e2877b2ee1..3f026299cd 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -306,8 +306,10 @@ GLDisplay::~GLDisplay() { } void GLDisplay::update_cursor_visibility(GLFWwindow* window, bool is_visible) { - auto cursor_mode = (is_visible) ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED; - glfwSetInputMode(window, GLFW_CURSOR, cursor_mode); + if (Gfx::get_button_mapping().use_mouse) { + auto cursor_mode = is_visible ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED; + glfwSetInputMode(window, GLFW_CURSOR, cursor_mode); + } } void GLDisplay::on_key(GLFWwindow* window, int key, int /*scancode*/, int action, int /*mods*/) { @@ -344,7 +346,7 @@ void GLDisplay::on_mouse_key(GLFWwindow* window, int button, int action, int mod void GLDisplay::on_cursor_position(GLFWwindow* window, double xposition, double yposition) { Pad::MappingInfo mapping_info = Gfx::get_button_mapping(); - if (is_imgui_visible()) { + if (is_imgui_visible() || !mapping_info.use_mouse) { if (is_cursor_position_valid == true) { Pad::ClearAnalogAxisValue(mapping_info, GlfwKeyCustomAxis::CURSOR_X_AXIS); Pad::ClearAnalogAxisValue(mapping_info, GlfwKeyCustomAxis::CURSOR_Y_AXIS); diff --git a/game/system/newpad.h b/game/system/newpad.h index 0eb2e3ed30..2b74e4ba2d 100644 --- a/game/system/newpad.h +++ b/game/system/newpad.h @@ -75,7 +75,8 @@ struct AnalogMappingInfo { }; struct MappingInfo { - bool debug = true; // debug mode + bool debug = true; // debug mode + bool use_mouse = false; bool buffer_mode = true; // use buffered inputs int controller_button_mapping[CONTROLLER_COUNT][(int)Pad::Button::Max]; From 1a5ea4036afab1d75c3f37a71278e8d6d92658f5 Mon Sep 17 00:00:00 2001 From: Shalen Bennett <70249609+doctashay@users.noreply.github.com> Date: Sun, 21 Aug 2022 20:47:27 -0600 Subject: [PATCH 18/23] Update documentation (#1767) Co-authored-by: doctashay --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e3d4187ee0..c4f2b8296c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

- Documentation Badge + Documentation Badge Linux and Windows Build Codacy Badge Codacy Badge @@ -11,8 +11,8 @@ PRs

-- [READ FIRST](#read-first) - - [How to play the game](#how-to-play-the-game) +- [Please read first](#please-read-first) + - [Quick Start](#quick-start) - [Project Description](#project-description) - [Current Status](#current-status) - [Methodology](#methodology) @@ -40,21 +40,21 @@ - [`goal_src/`](#goal_src) - [`game` runtime](#game-runtime) -## READ FIRST +## Please read first -The github repositories are for development of the project and tracking active issues. Most of the information you will find here pertains to setting up the project for development purposes and is not relevant to a general user. +Our repositories on GitHub are primarily for development of the project and tracking active issues. Most of the information you will find here pertains to setting up the project for development purposes and is not relevant to the end-user. -There is a discord server where discussion occur https://discord.gg/VZbXMHXzWv +For questions or additional information pertaining to the project, we have a Discord for discussion here: https://discord.gg/VZbXMHXzWv -Additionally you can find further information and answers to **frequently asked questions** on the project's main website https://open-goal.github.io/ +Additionally, you can find further documentation and answers to **frequently asked questions** on the project's main website: https://opengoal.dev -### How to play the game +**Do not use this decompilation project without providing your own legally purchased copy of the game.** -To just play the game, follow the steps in this video https://www.youtube.com/watch?v=p8I9NfuZOgE +### Quick Start -We don't save any assets from the game - you must use your own legitimately obtained copy of the game. +If you just want to play the game, you can follow the steps in this video: https://www.youtube.com/watch?v=p8I9NfuZOgE -> Note that this installation method is a temporary stop gap while we work on something more user-friendly. +We do not distribute any assets from the game - you must use your own legitimately obtained PS2 copy of the game. We support every retail PAL, NTSC, and NTSC-J build, including Greatest Hits copies. ## Project Description @@ -94,7 +94,7 @@ Our decompiler is designed specifically for processing the output of the origina The remainder of this README is catered towards people interested in building the project from source, typically with the intention on contributing as a developer. -If this does not sound like you and you just want to play the game, refer to the above section [How to play the game](#how-to-play-the-game) +If this does not sound like you and you just want to play the game, refer to the above section [Quick Start](#quick-start) ### Docker From bae02a83af7b0d1d0e7c7d1dbeffe929af00b172 Mon Sep 17 00:00:00 2001 From: OpenGOALBot Date: Mon, 22 Aug 2022 16:21:42 +0000 Subject: [PATCH 19/23] Updating Controller Database --- game/assets/sdl_controller_db.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/game/assets/sdl_controller_db.txt b/game/assets/sdl_controller_db.txt index f5874a3dec..0cd4e9463c 100644 --- a/game/assets/sdl_controller_db.txt +++ b/game/assets/sdl_controller_db.txt @@ -19,6 +19,7 @@ 03000000801000000900000000000000,8BitDo F30 Arcade Stick,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Windows, 03000000c82d00001038000000000000,8BitDo F30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Windows, 03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows, +03000000c82d00001251000000000000,8BitDo Lite 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows, 03000000c82d00001151000000000000,8BitDo Lite SE,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows, 03000000c82d00000151000000000000,8BitDo M30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftx:a0,lefty:a2,rightshoulder:b6,righttrigger:b7,rightx:a3,righty:a5,start:b11,x:b3,y:b4,platform:Windows, 03000000c82d00000650000000000000,8BitDo M30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b8,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Windows, @@ -211,6 +212,7 @@ 03000000300f00000b01000000000000,GGE909 Recoil,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows, 03000000f0250000c283000000000000,Gioteck PlayStation Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows, 03000000f025000021c1000000000000,Gioteck PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows, +03000000f025000031c1000000000000,Gioteck PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows, 03000000f0250000c383000000000000,Gioteck VX2 PlayStation Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows, 03000000f0250000c483000000000000,Gioteck VX2 PlayStation Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows, 030000004f04000026b3000000000000,GP XID,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows, @@ -276,7 +278,7 @@ 030000000d0f00005c00000000000000,Hori Real Arcade Pro V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows, 030000000d0f0000af00000000000000,Hori Real Arcade Pro VHS,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b0,y:b3,platform:Windows, 030000000d0f00001b00000000000000,Hori Real Arcade Pro VX,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b9,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows, -03000000ad1b000002f5000000000000,Hori Real Arcade Pro VX,a:b0,b:b1,back:b7,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b07,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b08,righttrigger:b11,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Windows, +03000000ad1b000002f5000000000000,Hori Real Arcade Pro VX,a:b0,b:b1,back:b7,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b11,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Windows, 030000000d0f00009c00000000000000,Hori TAC Pro,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows, 030000000d0f0000c900000000000000,Hori Taiko Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows, 030000000d0f0000c100000000000000,Horipad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows, @@ -746,6 +748,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X, 03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X, 03000000c82d00001251000000010000,8BitDo Lite 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X, +03000000c82d00001251000000020000,8BitDo Lite 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X, 03000000c82d00001151000000010000,8BitDo Lite SE,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X, 03000000c82d00001151000000020000,8BitDo Lite SE,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X, 03000000a30c00002400000006020000,8BitDo M30,a:b2,b:b1,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,guide:b9,leftshoulder:b6,lefttrigger:b5,rightshoulder:b4,righttrigger:b7,start:b8,x:b3,y:b0,platform:Mac OS X, @@ -973,6 +976,8 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000021000000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 05000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, +03000000c82d00001251000011010000,8BitDo Lite 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, +05000000c82d00001251000000010000,8BitDo Lite 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 03000000c82d00001151000011010000,8BitDo Lite SE,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 05000000c82d00001151000000010000,8BitDo Lite SE,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 03000000c82d00000151000000010000,8BitDo M30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, @@ -1234,7 +1239,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 050000007e0500000920000001800000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, 050000007e0500000720000001800000,Nintendo Switch Right Joy-Con,a:b1,b:b2,back:b9,leftshoulder:b4,leftstick:b10,leftx:a1~,lefty:a0,rightshoulder:b6,start:b8,x:b0,y:b3,platform:Linux, 05000000010000000100000003000000,Nintendo Wii Remote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux, -050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux, +050000007e0500003003000001000000,Nintendo Wii U Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux, 030000000d0500000308000010010000,Nostromo n45 Dual Analog,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,platform:Linux, 050000007e0500001920000001000000,NSO N64 Controller,+rightx:b8,+righty:b7,-rightx:b3,-righty:b2,a:b1,b:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,righttrigger:b10,start:b9,platform:Linux, 050000007e0500001720000001000000,NSO SNES Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, @@ -1459,8 +1464,8 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 050000005e040000130b000009050000,Xbox Series Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 050000005e040000130b000013050000,Xbox Series Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 060000005e040000120b00000b050000,Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, +030000005e040000120b000007050000,Xbox Series X Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 050000005e040000130b000011050000,Xbox Series X Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, -030000005e040000120b000007050000,Xbox Series X Controller,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,misc1:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux, 050000005e040000130b000007050000,Xbox Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 03000000450c00002043000010010000,XEOX SL6556 BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux, 05000000172700004431000029010000,XiaoMi Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Linux, @@ -1479,8 +1484,12 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 33313433353539306634656436353432,8BitDo Dogbone,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftx:a0,lefty:a1,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android, 38426974446f20446f67626f6e65204d,8BitDo Dogbone,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftx:a0,lefty:a1,rightx:a2,righty:a3,start:b6,platform:Android, 34343439373236623466343934376233,8BitDo FC30 Pro,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b3,leftstick:b28,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b29,righttrigger:b7,start:b5,x:b30,y:b2,platform:Android, +38426974446f2038426974446f204c69,8BitDo Lite,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b17,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b18,rightx:a2,righty:a3,start:b6,x:b3,y:b2,platform:Android, +30643332373663313263316637356631,8BitDo Lite 2,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b17,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b18,rightx:a2,righty:a3,start:b6,x:b3,y:b2,platform:Android, +38426974446f204c6974652032000000,8BitDo Lite 2,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b17,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b18,rightx:a2,righty:a3,start:b6,x:b3,y:b2,platform:Android, +62656331626461363634633735353032,8BitDo Lite 2,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b17,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b18,rightx:a2,righty:a3,start:b6,x:b3,y:b2,platform:Android, 38393936616436383062666232653338,8BitDo Lite SE,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:b17,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b18,rightx:a2,righty:a3,start:b6,x:b3,y:b2,platform:Android, -38426974446f2038426974446f204c69,8BitDo Lite SE,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b17,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b18,rightx:a2,righty:a3,start:b6,x:b3,y:b2,platform:Android, +38426974446f204c6974652053450000,8BitDo Lite SE,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:b17,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b18,rightx:a2,righty:a3,start:b6,x:b3,y:b2,platform:Android, 39356430616562366466646636643435,8BitDo Lite SE,a:b1,b:b0,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:b17,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b18,rightx:a2,righty:a3,start:b6,x:b3,y:b2,platform:Android, 05000000c82d000006500000ffff3f00,8BitDo M30,a:b1,b:b0,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,guide:b17,leftshoulder:b9,lefttrigger:a5,rightshoulder:b10,righttrigger:a4,start:b6,x:b3,y:b2,platform:Android, 05000000c82d000051060000ffff3f00,8BitDo M30,a:b1,b:b0,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,guide:b17,leftshoulder:b9,lefttrigger:a4,rightshoulder:b10,righttrigger:a5,start:b6,x:b3,y:b2,platform:Android, From 5af36ac610f5d1b4616345dc2406f3f61478240c Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Mon, 22 Aug 2022 18:02:31 -0400 Subject: [PATCH 20/23] maybe fix bridge blast (#1784) --- goal_src/jak1/engine/common-obs/ropebridge.gc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/goal_src/jak1/engine/common-obs/ropebridge.gc b/goal_src/jak1/engine/common-obs/ropebridge.gc index 077d0f08d2..d189898f46 100644 --- a/goal_src/jak1/engine/common-obs/ropebridge.gc +++ b/goal_src/jak1/engine/common-obs/ropebridge.gc @@ -608,7 +608,21 @@ (when (-> self do-physics?) (clear-spring-forces self) (set-vel-from-riders self) - (do-integration self) + + ;; original + ;; (do-integration self) + + ;; modified to try to fix crazy bridges + ;; instead of doing one big step when lagging, do multiple small steps. + ;; temporarily change time ratio to 1.0 (like we are 60 fps) + (let ((old-time-ratio (the int (-> *display* time-ratio)))) + (set-time-ratios *display* 1.0) + ;; then do multiple steps to simulate the same amount of time, but without longer timesteps + (dotimes (i old-time-ratio) + (do-integration self) + ) + (set-time-ratios *display* (the float old-time-ratio)) + ) ) ) (none) From 06ef52cd2545b15e3bfed2588129cb64717a255c Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Mon, 22 Aug 2022 18:53:51 -0400 Subject: [PATCH 21/23] [decompiler] support for jak 2 (#1781) * [decompiler] suppport jak 2 * cleanpu * remove brief from gtest options * fix test --- common/type_system/TypeFieldLookup.cpp | 27 +- decompiler/CMakeLists.txt | 3 + decompiler/Function/Warnings.h | 1 - decompiler/IR2/AtomicOp.cpp | 51 +- decompiler/IR2/AtomicOp.h | 89 +- decompiler/IR2/AtomicOpTypeAnalysis.cpp | 1 + decompiler/IR2/Env.cpp | 124 +- decompiler/IR2/Env.h | 1 + decompiler/IR2/ExpressionHelpers.cpp | 31 +- decompiler/IR2/Form.cpp | 3 + decompiler/IR2/Form.h | 12 +- decompiler/IR2/FormExpressionAnalysis.cpp | 70 +- decompiler/IR2/IR2_common.h | 1 + decompiler/ObjectFile/LinkedObjectFile.h | 4 +- .../ObjectFile/LinkedObjectFileCreation.cpp | 2 +- decompiler/ObjectFile/ObjectFileDB.cpp | 2 +- decompiler/ObjectFile/ObjectFileDB.h | 1 + decompiler/ObjectFile/ObjectFileDB_IR2.cpp | 30 +- .../analysis/analyze_inspect_method.cpp | 9 +- decompiler/analysis/atomic_op_builder.cpp | 88 +- decompiler/analysis/insert_lets.cpp | 39 +- decompiler/config/jak2/all-types.gc | 9414 +++++++++-------- .../jak2/anonymous_function_types.jsonc | 30 + decompiler/config/jak2/hacks.jsonc | 38 +- decompiler/config/jak2/label_types.jsonc | 67 +- decompiler/config/jak2/stack_structures.jsonc | 159 +- decompiler/config/jak2/type_casts.jsonc | 365 +- decompiler/config/jak2/var_names.jsonc | 45 +- decompiler/config/jak2_ntsc_v1.jsonc | 2 +- decompiler/level_extractor/fr3_to_gltf.cpp | 4 +- decompiler/types2/ForwardProp.cpp | 2455 +++++ decompiler/types2/types2.cpp | 760 ++ decompiler/types2/types2.h | 248 + decompiler/util/DecompilerTypeSystem.cpp | 4 +- decompiler/util/data_decompile.cpp | 27 +- decompiler/util/goal_constants.h | 3 + goal_src/jak2/kernel-defs.gc | 2 +- goalc/build_level/collide_bvh.cpp | 62 +- test.sh | 2 +- test/decompiler/FormRegressionTest.h | 2 +- .../reference/jak1/engine/anim/joint_REF.gc | 2 +- .../jak1/engine/draw/drawable_REF.gc | 2 +- .../reference/jak1/engine/gfx/sky/sky_REF.gc | 2 +- .../reference/jak1/engine/math/vector_REF.gc | 22 +- .../reference/jak1/engine/util/glist_REF.gc | 4 +- .../jak1/levels/rolling/rolling-obs_REF.gc | 2 +- .../reference/jak2/decompiler-macros.gc | 141 + .../reference/jak2/kernel/gstate_REF.gc | 2 +- test/decompiler/test_InstructionDecode.cpp | 8 +- test/offline/config/jak2/config.jsonc | 21 +- test/offline/offline_test_main.cpp | 5 +- 51 files changed, 9934 insertions(+), 4555 deletions(-) create mode 100644 decompiler/types2/ForwardProp.cpp create mode 100644 decompiler/types2/types2.cpp create mode 100644 decompiler/types2/types2.h diff --git a/common/type_system/TypeFieldLookup.cpp b/common/type_system/TypeFieldLookup.cpp index cc013e71ec..5b690d75de 100644 --- a/common/type_system/TypeFieldLookup.cpp +++ b/common/type_system/TypeFieldLookup.cpp @@ -482,20 +482,6 @@ FieldReverseLookupOutput TypeSystem::reverse_field_lookup( // just use the multi-lookup set to 1 and grab the first result. auto multi_result = reverse_field_multi_lookup(input, 100); - for (auto& result : multi_result.results) { - // compute the score. - result.total_score = 0; - for (auto& tok : result.tokens) { - result.total_score += tok.score(); - } - } - - // use stable sort to make sure we break ties by being first in the order. - std::stable_sort(multi_result.results.begin(), multi_result.results.end(), - [](const FieldReverseLookupOutput& a, const FieldReverseLookupOutput& b) { - return a.total_score > b.total_score; - }); - /* if (multi_result.results.size() > 1) { fmt::print("Multiple:\n"); @@ -532,6 +518,19 @@ FieldReverseMultiLookupOutput TypeSystem::reverse_field_multi_lookup( try_reverse_lookup(input, *this, nullptr, &result, max_count); if (!result.results.empty()) { result.success = true; + for (auto& r : result.results) { + // compute the score. + r.total_score = 0; + for (auto& tok : r.tokens) { + r.total_score += tok.score(); + } + } + + // use stable sort to make sure we break ties by being first in the order. + std::stable_sort(result.results.begin(), result.results.end(), + [](const FieldReverseLookupOutput& a, const FieldReverseLookupOutput& b) { + return a.total_score > b.total_score; + }); } return result; } diff --git a/decompiler/CMakeLists.txt b/decompiler/CMakeLists.txt index db9b96959a..0374470012 100644 --- a/decompiler/CMakeLists.txt +++ b/decompiler/CMakeLists.txt @@ -69,6 +69,9 @@ add_library( ObjectFile/ObjectFileDB.cpp ObjectFile/ObjectFileDB_IR2.cpp + types2/ForwardProp.cpp + types2/types2.cpp + util/config_parsers.cpp util/data_decompile.cpp util/DataParser.cpp diff --git a/decompiler/Function/Warnings.h b/decompiler/Function/Warnings.h index ad1a7bc4f1..92426b73d1 100644 --- a/decompiler/Function/Warnings.h +++ b/decompiler/Function/Warnings.h @@ -104,6 +104,5 @@ class DecompWarnings { } std::vector m_warnings; - bool m_used_lq_sq = false; }; } // namespace decompiler diff --git a/decompiler/IR2/AtomicOp.cpp b/decompiler/IR2/AtomicOp.cpp index 72f19106df..d5d4b9a17e 100644 --- a/decompiler/IR2/AtomicOp.cpp +++ b/decompiler/IR2/AtomicOp.cpp @@ -142,16 +142,55 @@ SimpleAtom SimpleAtom::make_static_address(int static_label_id) { return result; } +/*! + * Mark this atom as a float. It will be printed as a float. + * This can only be applied to an "integer" atom. + * This should be used carefully, as this doesn't handle casts/types - it just changes the + * representation, which will do the wrong thing unless the type system is aware of this + * too. + */ +void SimpleAtom::mark_as_float() { + ASSERT(is_int()); + m_display_int_as_float = true; +} + +bool SimpleAtom::is_integer_promoted_to_float() const { + return m_kind == Kind::INTEGER_CONSTANT && m_display_int_as_float; +} + +float SimpleAtom::get_integer_promoted_to_float() const { + ASSERT(is_integer_promoted_to_float()); + s32 as_s32 = get_int(); + ASSERT(get_int() == (s64)as_s32); + float result; + memcpy(&result, &as_s32, 4); + return result; +} + goos::Object SimpleAtom::to_form(const std::vector& labels, const Env& env) const { switch (m_kind) { case Kind::VARIABLE: return m_variable.to_form(env); case Kind::INTEGER_CONSTANT: { - if (std::abs(m_int) > INT32_MAX) { - u64 v = m_int; - return pretty_print::to_symbol(fmt::format("#x{:x}", v)); + if (m_display_int_as_float) { + float f; + s32 as_s32 = m_int; + ASSERT(((s64)as_s32) == m_int); // float should always be a sign extended 32-bit value. + memcpy(&f, &as_s32, 4); + if (f == f) { + return goos::Object::make_float(f); + } else { + // nan or weird + ASSERT(false); // let's abort on this for now, can remove if it actually comes up. + return pretty_print::to_symbol(fmt::format("(the-as float #x{:x})", m_int)); + } } else { - return goos::Object::make_integer(m_int); + if (std::abs(m_int) > INT32_MAX) { + u64 v = m_int; + return pretty_print::to_symbol(fmt::format("#x{:x}", v)); + } else { + return goos::Object::make_integer(m_int); + } } } @@ -311,6 +350,8 @@ std::string get_simple_expression_op_name(SimpleExpression::Kind kind) { return "vec3dot"; case SimpleExpression::Kind::VECTOR_4_DOT: return "vec4dot"; + case SimpleExpression::Kind::VECTOR_LENGTH: + return "veclength"; case SimpleExpression::Kind::SET_ON_LESS_THAN: case SimpleExpression::Kind::SET_ON_LESS_THAN_IMM: return "set-on-less-than"; @@ -378,6 +419,8 @@ int get_simple_expression_arg_count(SimpleExpression::Kind kind) { case SimpleExpression::Kind::SET_ON_LESS_THAN: case SimpleExpression::Kind::SET_ON_LESS_THAN_IMM: return 2; + case SimpleExpression::Kind::VECTOR_LENGTH: + return 1; default: ASSERT(false); return -1; diff --git a/decompiler/IR2/AtomicOp.h b/decompiler/IR2/AtomicOp.h index 7b84193768..1cecc2e497 100644 --- a/decompiler/IR2/AtomicOp.h +++ b/decompiler/IR2/AtomicOp.h @@ -19,6 +19,11 @@ class FormElement; class ConditionElement; class FormPool; class DecompilerTypeSystem; +namespace types2 { +struct Instruction; +struct TypeState; +struct TypePropExtras; +} // namespace types2 /*! * An atomic operation represents a single operation from the point of view of the IR2 system. @@ -78,6 +83,12 @@ class AtomicOp { TypeState propagate_types(const TypeState& input, const Env& env, DecompilerTypeSystem& dts); + virtual void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) = 0; + int op_id() const { return m_my_idx; } const std::vector& read_regs() const { return m_read_regs; } const std::vector& write_regs() const { return m_write_regs; } @@ -176,12 +187,16 @@ class SimpleAtom { ASSERT(is_sym_ptr() || is_sym_val()); return m_string; } + void mark_as_float(); + bool is_integer_promoted_to_float() const; + float get_integer_promoted_to_float() const; private: Kind m_kind = Kind::INVALID; std::string m_string; // for symbol ptr and symbol val s64 m_int = -1; // for integer constant and static address label id RegisterAccess m_variable; + bool m_display_int_as_float = false; }; /*! @@ -240,6 +255,7 @@ class SimpleExpression { SUBU_L32_S7, // use SUBU X, src0, s7 to check if lower 32-bits are s7. VECTOR_3_DOT, VECTOR_4_DOT, + VECTOR_LENGTH, // jak 2 only. SET_ON_LESS_THAN, SET_ON_LESS_THAN_IMM }; @@ -250,6 +266,11 @@ class SimpleExpression { ASSERT(idx < args()); return m_args[idx]; } + + SimpleAtom& get_arg(int idx) { + ASSERT(idx < args()); + return m_args[idx]; + } Kind kind() const { return m_kind; } SimpleExpression() = default; SimpleExpression(Kind kind, const SimpleAtom& arg0); @@ -304,6 +325,11 @@ class SetVarOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; const RegisterAccess& dst() const { return m_dst; } const SimpleExpression& src() const { return m_src; } @@ -334,6 +360,11 @@ class AsmOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; const Instruction& instruction() const { return m_instr; } const std::optional dst() const { return m_dst; } @@ -437,6 +468,11 @@ class SetVarConditionOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; private: @@ -463,6 +499,11 @@ class StoreOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; const SimpleExpression& addr() const { return m_addr; } const SimpleAtom& value() const { return m_value; } @@ -492,9 +533,13 @@ class LoadVarOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; TP_Type get_src_type(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) const; void collect_vars(RegAccessSet& vars) const override; - const SimpleExpression& src() const { return m_src; } Kind kind() const { return m_kind; } int size() const { return m_size; } @@ -580,6 +625,11 @@ class BranchOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; const IR2_BranchDelay& branch_delay() const { return m_branch_delay; } const IR2_Condition& condition() const { return m_condition; } @@ -616,6 +666,11 @@ class AsmBranchOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; bool is_likely() const { return m_likely; } const IR2_Condition& condition() const { return m_condition; } @@ -653,6 +708,11 @@ class SpecialOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; Kind kind() const { return m_kind; } @@ -676,6 +736,11 @@ class CallOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; const std::vector& arg_vars() const { return m_arg_vars; } RegisterAccess function_var() const { return m_function_var; } @@ -717,6 +782,11 @@ class ConditionalMoveFalseOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; private: @@ -748,6 +818,11 @@ class FunctionEndOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; void mark_function_as_no_return_value(); const RegisterAccess& return_var() const { @@ -775,7 +850,13 @@ class StackSpillStoreOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; + int offset() const { return m_offset; } private: SimpleAtom m_value; @@ -798,7 +879,13 @@ class StackSpillLoadOp : public AtomicOp { TypeState propagate_types_internal(const TypeState& input, const Env& env, DecompilerTypeSystem& dts) override; + void propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) override; void collect_vars(RegAccessSet& vars) const override; + int offset() const { return m_offset; } private: RegisterAccess m_dst; diff --git a/decompiler/IR2/AtomicOpTypeAnalysis.cpp b/decompiler/IR2/AtomicOpTypeAnalysis.cpp index 327e8ada80..c843bfbdee 100644 --- a/decompiler/IR2/AtomicOpTypeAnalysis.cpp +++ b/decompiler/IR2/AtomicOpTypeAnalysis.cpp @@ -243,6 +243,7 @@ TP_Type SimpleExpression::get_type(const TypeState& input, return TP_Type::make_from_ts("int"); case Kind::VECTOR_3_DOT: case Kind::VECTOR_4_DOT: + case Kind::VECTOR_LENGTH: return TP_Type::make_from_ts("float"); default: throw std::runtime_error("Simple expression cannot get_type: " + diff --git a/decompiler/IR2/Env.cpp b/decompiler/IR2/Env.cpp index b520dbc952..011fccd69e 100644 --- a/decompiler/IR2/Env.cpp +++ b/decompiler/IR2/Env.cpp @@ -507,69 +507,73 @@ void Env::disable_use(const RegisterAccess& access) { */ void Env::set_stack_structure_hints(const std::vector& hints) { for (auto& hint : hints) { - StackStructureEntry entry; - entry.hint = hint; - - switch (hint.container_type) { - case StackStructureHint::ContainerType::NONE: { - // parse the type spec. - TypeSpec base_typespec = dts->parse_type_spec(hint.element_type); - auto type_info = dts->ts.lookup_type(base_typespec); - // just a plain object on the stack. - if (!type_info->is_reference()) { - throw std::runtime_error( - fmt::format("Stack variable type {} is not a reference and cannot be stored directly " - "on the stack. Use an array instead.", - base_typespec.print())); - } - entry.ref_type = base_typespec; - entry.size = type_info->get_size_in_memory(); - // sanity check the alignment - if (align(entry.hint.stack_offset, type_info->get_in_memory_alignment()) != - entry.hint.stack_offset) { - lg::error("Misaligned stack variable of type {} offset {} required align {}\n", - entry.ref_type.print(), entry.hint.stack_offset, - type_info->get_in_memory_alignment()); - } - } break; - - case StackStructureHint::ContainerType::INLINE_ARRAY: { - TypeSpec base_typespec = dts->parse_type_spec(hint.element_type); - auto type_info = dts->ts.lookup_type(base_typespec); - if (!type_info->is_reference()) { - throw std::runtime_error( - fmt::format("Stack inline-array element type {} is not a reference and cannot be " - "stored in an inline-array. Use an array instead.", - base_typespec.print())); - } - - entry.ref_type = TypeSpec("inline-array", {TypeSpec(base_typespec)}); - entry.size = 1; // we assume that there is no constant propagation into this array and - // make this only trigger in get_stack_type if we hit exactly. - // sanity check the alignment - if (align(entry.hint.stack_offset, type_info->get_in_memory_alignment()) != - entry.hint.stack_offset) { - lg::error("Misaligned stack variable of type {} offset {} required align {}\n", - entry.ref_type.print(), entry.hint.stack_offset, - type_info->get_in_memory_alignment()); - } - } break; - - case StackStructureHint::ContainerType::ARRAY: { - TypeSpec base_typespec = dts->parse_type_spec(hint.element_type); - entry.ref_type = TypeSpec("pointer", {TypeSpec(base_typespec)}); - entry.size = 1; // we assume that there is no constant propagation into this array and - // make this only trigger in get_stack_type if we hit exactly. - break; - } - default: - ASSERT(false); - } - - m_stack_structures.push_back(entry); + add_stack_structure_hint(hint); } } +void Env::add_stack_structure_hint(const StackStructureHint& hint) { + StackStructureEntry entry; + entry.hint = hint; + + switch (hint.container_type) { + case StackStructureHint::ContainerType::NONE: { + // parse the type spec. + TypeSpec base_typespec = dts->parse_type_spec(hint.element_type); + auto type_info = dts->ts.lookup_type(base_typespec); + // just a plain object on the stack. + if (!type_info->is_reference()) { + throw std::runtime_error( + fmt::format("Stack variable type {} is not a reference and cannot be stored directly " + "on the stack. Use an array instead.", + base_typespec.print())); + } + entry.ref_type = base_typespec; + entry.size = type_info->get_size_in_memory(); + // sanity check the alignment + if (align(entry.hint.stack_offset, type_info->get_in_memory_alignment()) != + entry.hint.stack_offset) { + lg::error("Misaligned stack variable of type {} offset {} required align {}\n", + entry.ref_type.print(), entry.hint.stack_offset, + type_info->get_in_memory_alignment()); + } + } break; + + case StackStructureHint::ContainerType::INLINE_ARRAY: { + TypeSpec base_typespec = dts->parse_type_spec(hint.element_type); + auto type_info = dts->ts.lookup_type(base_typespec); + if (!type_info->is_reference()) { + throw std::runtime_error( + fmt::format("Stack inline-array element type {} is not a reference and cannot be " + "stored in an inline-array. Use an array instead.", + base_typespec.print())); + } + + entry.ref_type = TypeSpec("inline-array", {TypeSpec(base_typespec)}); + entry.size = 1; // we assume that there is no constant propagation into this array and + // make this only trigger in get_stack_type if we hit exactly. + // sanity check the alignment + if (align(entry.hint.stack_offset, type_info->get_in_memory_alignment()) != + entry.hint.stack_offset) { + lg::error("Misaligned stack variable of type {} offset {} required align {}\n", + entry.ref_type.print(), entry.hint.stack_offset, + type_info->get_in_memory_alignment()); + } + } break; + + case StackStructureHint::ContainerType::ARRAY: { + TypeSpec base_typespec = dts->parse_type_spec(hint.element_type); + entry.ref_type = TypeSpec("pointer", {TypeSpec(base_typespec)}); + entry.size = 1; // we assume that there is no constant propagation into this array and + // make this only trigger in get_stack_type if we hit exactly. + break; + } + default: + ASSERT(false); + } + + m_stack_structures.push_back(entry); +} + std::optional Env::get_art_elt_name(int idx) const { ASSERT(dts); auto it = dts->art_group_info.find(art_group()); diff --git a/decompiler/IR2/Env.h b/decompiler/IR2/Env.h index c577d44d06..6c5a6ef894 100644 --- a/decompiler/IR2/Env.h +++ b/decompiler/IR2/Env.h @@ -174,6 +174,7 @@ class Env { } void set_stack_structure_hints(const std::vector& hints); + void add_stack_structure_hint(const StackStructureHint& hint); const std::vector& stack_structure_hints() const { return m_stack_structures; } diff --git a/decompiler/IR2/ExpressionHelpers.cpp b/decompiler/IR2/ExpressionHelpers.cpp index abbee45fca..b231cf114c 100644 --- a/decompiler/IR2/ExpressionHelpers.cpp +++ b/decompiler/IR2/ExpressionHelpers.cpp @@ -9,6 +9,20 @@ namespace decompiler { +// needed for jak 2. +std::optional try_get_const_float(const Form* form) { + auto* as_cfe = form->try_as_element(); + if (as_cfe) { + return as_cfe->value(); + } + + auto atom = form_as_atom(form); + if (atom && atom->is_integer_promoted_to_float()) { + return atom->get_integer_promoted_to_float(); + } + return {}; +} + FormElement* handle_get_property_value_float(const std::vector& forms, FormPool& pool, const Env& env) { @@ -35,8 +49,8 @@ FormElement* handle_get_property_value_float(const std::vector& forms, } // get the time. It must be DEFAULT_RES_TIME - auto lookup_time = forms.at(3)->try_as_element(); - if (!lookup_time || lookup_time->value() != DEFAULT_RES_TIME) { + auto lookup_time = try_get_const_float(forms.at(3)); + if (!lookup_time || *lookup_time != DEFAULT_RES_TIME) { fmt::print("fail: bad time {}\n", forms.at(3)->to_string(env)); return nullptr; } @@ -44,8 +58,8 @@ FormElement* handle_get_property_value_float(const std::vector& forms, // get the default value. It can be anything... Form* default_value = forms.at(4); // but let's see if it's 0, because that's the default in the macro - auto default_value_float = default_value->try_as_element(); - if (default_value_float && default_value_float->value() == 0) { + auto default_value_float = try_get_const_float(default_value); + if (default_value_float && *default_value_float == 0) { default_value = nullptr; } @@ -111,8 +125,8 @@ FormElement* handle_get_property_data_or_structure(const std::vector& for // get the time. It can be anything, but there's a default. auto time = forms.at(3); - auto lookup_time = time->try_as_element(); - if (lookup_time && lookup_time->value() == DEFAULT_RES_TIME) { + auto lookup_time = try_get_const_float(time); + if (lookup_time && *lookup_time == DEFAULT_RES_TIME) { time = nullptr; } @@ -153,8 +167,9 @@ FormElement* handle_get_property_data(const std::vector& forms, FormElement* handle_get_property_struct(const std::vector& forms, FormPool& pool, const Env& env) { - return handle_get_property_data_or_structure(forms, pool, env, ResLumpMacroElement::Kind::STRUCT, - "#f", TypeSpec("structure")); + return handle_get_property_data_or_structure( + forms, pool, env, ResLumpMacroElement::Kind::STRUCT, + env.version == GameVersion::Jak2 ? "(the-as structure #f)" : "#f", TypeSpec("structure")); } FormElement* handle_get_property_value(const std::vector& forms, diff --git a/decompiler/IR2/Form.cpp b/decompiler/IR2/Form.cpp index 11ae58520c..d312987516 100644 --- a/decompiler/IR2/Form.cpp +++ b/decompiler/IR2/Form.cpp @@ -1862,6 +1862,8 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) { return "cpad-pressed?"; case FixedOperatorKind::CPAD_HOLD_P: return "cpad-hold?"; + case FixedOperatorKind::VECTOR_LENGTH: + return "vector-length"; default: ASSERT(false); return ""; @@ -3193,6 +3195,7 @@ goos::Object DefpartElement::to_form_internal(const Env& env) const { // sp-end break; } + ASSERT(env.version == GameVersion::Jak1); // need to update enums item_forms.push_back(decompile_sparticle_field_init(e, env.dts->ts)); } if (!item_forms.empty()) { diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index 6eab5e872f..d7fd877143 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -228,12 +228,12 @@ class SimpleExpressionElement : public FormElement { FormStack& stack, std::vector* result, bool allow_side_effects); - void update_from_stack_vector_dot(FixedOperatorKind kind, - const Env& env, - FormPool& pool, - FormStack& stack, - std::vector* result, - bool allow_side_effects); + void update_from_stack_vectors_in_common(FixedOperatorKind kind, + const Env& env, + FormPool& pool, + FormStack& stack, + std::vector* result, + bool allow_side_effects); const SimpleExpression& expr() const { return m_expr; } diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 17ce439e74..ebd10e5d3e 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -1504,24 +1504,28 @@ void SimpleExpressionElement::update_from_stack_vector_float_product( result->push_back(new_form); } -void SimpleExpressionElement::update_from_stack_vector_dot(FixedOperatorKind kind, - const Env& env, - FormPool& pool, - FormStack& stack, - std::vector* result, - bool allow_side_effects) { - std::vector popped_args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var()}, - env, pool, stack, allow_side_effects); +void SimpleExpressionElement::update_from_stack_vectors_in_common(FixedOperatorKind kind, + const Env& env, + FormPool& pool, + FormStack& stack, + std::vector* result, + bool allow_side_effects) { + std::vector register_acccesses; + for (int arg_idx = 0; arg_idx < m_expr.args(); arg_idx++) { + register_acccesses.push_back(m_expr.get_arg(arg_idx).var()); + } + std::vector popped_args = + pop_to_forms(register_acccesses, env, pool, stack, allow_side_effects); - for (int i = 0; i < 2; i++) { + for (int i = 0; i < m_expr.args(); i++) { auto arg_type = env.get_types_before_op(m_my_idx).get(m_expr.get_arg(i).var().reg()); if (arg_type.typespec() != TypeSpec("vector")) { popped_args.at(i) = cast_form(popped_args.at(i), TypeSpec("vector"), pool, env); } } - auto new_form = pool.alloc_element( - GenericOperator::make_fixed(kind), std::vector{popped_args.at(0), popped_args.at(1)}); + auto new_form = + pool.alloc_element(GenericOperator::make_fixed(kind), popped_args); result->push_back(new_form); } @@ -1606,7 +1610,14 @@ FormElement* SimpleExpressionElement::update_from_stack_logor_or_logand_helper( FormStack& stack, bool allow_side_effects) { // grab the normal variable type - auto arg0_type = env.get_variable_type(m_expr.get_arg(0).var(), true); + TypeSpec arg0_type; + if (m_expr.get_arg(0).is_var()) { + arg0_type = env.get_variable_type(m_expr.get_arg(0).var(), true); + } else if (m_expr.get_arg(0).is_int(0)) { + arg0_type = TypeSpec("int"); // ?? + } else { + ASSERT(false); + } // and try to get it as a bitfield auto type_info = env.dts->ts.lookup_type(arg0_type); @@ -1614,7 +1625,7 @@ FormElement* SimpleExpressionElement::update_from_stack_logor_or_logand_helper( bool had_pcpyud = false; TypeSpec bitfield_type = arg0_type; - if (!bitfield_info) { + if (!bitfield_info && m_expr.get_arg(0).is_var()) { // the above won't work if we're already done a pcpyud to grab the upper 64 bits. // we need to grab the type in the register (a TP_type) and check const auto& arg0_reg_type = @@ -1672,15 +1683,25 @@ FormElement* SimpleExpressionElement::update_from_stack_logor_or_logand_helper( } else { // and, two forms auto arg1_type = env.get_variable_type(m_expr.get_arg(1).var(), true); - auto arg0_i = is_int_type(env, m_my_idx, m_expr.get_arg(0).var()); - auto arg0_u = is_uint_type(env, m_my_idx, m_expr.get_arg(0).var()); + auto arg0_i = + m_expr.get_arg(0).is_var() ? is_int_type(env, m_my_idx, m_expr.get_arg(0).var()) : true; + auto arg0_u = + m_expr.get_arg(0).is_var() ? is_uint_type(env, m_my_idx, m_expr.get_arg(0).var()) : false; auto arg1_i = is_int_type(env, m_my_idx, m_expr.get_arg(1).var()); auto arg1_u = is_uint_type(env, m_my_idx, m_expr.get_arg(1).var()); auto arg0_n = arg0_i || arg0_u; auto arg1_n = arg1_i || arg1_u; - auto args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var()}, env, pool, stack, - allow_side_effects); + std::vector args; + + if (m_expr.get_arg(0).is_var()) { + args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var()}, env, pool, stack, + allow_side_effects); + } else { + args = pop_to_forms({m_expr.get_arg(1).var()}, env, pool, stack, allow_side_effects); + args.insert(args.begin(), pool.form( + SimpleAtom::make_int_constant(m_expr.get_arg(0).get_int()))); + } if (bitfield_info) { // either the immediate didn't fit in the 16-bit imm or it's with a variable @@ -2318,12 +2339,16 @@ void SimpleExpressionElement::update_from_stack(const Env& env, update_from_stack_subu_l32_s7(env, pool, stack, result, allow_side_effects); break; case SimpleExpression::Kind::VECTOR_3_DOT: - update_from_stack_vector_dot(FixedOperatorKind::VECTOR_3_DOT, env, pool, stack, result, - allow_side_effects); + update_from_stack_vectors_in_common(FixedOperatorKind::VECTOR_3_DOT, env, pool, stack, result, + allow_side_effects); break; case SimpleExpression::Kind::VECTOR_4_DOT: - update_from_stack_vector_dot(FixedOperatorKind::VECTOR_4_DOT, env, pool, stack, result, - allow_side_effects); + update_from_stack_vectors_in_common(FixedOperatorKind::VECTOR_4_DOT, env, pool, stack, result, + allow_side_effects); + break; + case SimpleExpression::Kind::VECTOR_LENGTH: + update_from_stack_vectors_in_common(FixedOperatorKind::VECTOR_LENGTH, env, pool, stack, + result, allow_side_effects); break; default: throw std::runtime_error( @@ -2701,7 +2726,8 @@ bool try_to_rewrite_matrix_inline_ctor(const Env& env, FormPool& pool, FormStack } else { matcher = Matcher::set( Matcher::deref(Matcher::any_reg(0), false, - {DerefTokenMatcher::string("quad"), DerefTokenMatcher::integer(i)}), + {DerefTokenMatcher::string("vector"), DerefTokenMatcher::integer(i), + DerefTokenMatcher::string("quad")}), Matcher::cast("uint128", Matcher::integer(0))); } diff --git a/decompiler/IR2/IR2_common.h b/decompiler/IR2/IR2_common.h index 0f1e4f387c..cb6dfca92e 100644 --- a/decompiler/IR2/IR2_common.h +++ b/decompiler/IR2/IR2_common.h @@ -169,6 +169,7 @@ enum class FixedOperatorKind { PROCESS_TO_HANDLE, PPOINTER_TO_PROCESS, VECTOR_4_DOT, + VECTOR_LENGTH, SEND_EVENT, CPAD_PRESSED_P, CPAD_HOLD_P, diff --git a/decompiler/ObjectFile/LinkedObjectFile.h b/decompiler/ObjectFile/LinkedObjectFile.h index d33b30f4e3..f592892a03 100644 --- a/decompiler/ObjectFile/LinkedObjectFile.h +++ b/decompiler/ObjectFile/LinkedObjectFile.h @@ -25,7 +25,7 @@ namespace decompiler { */ class LinkedObjectFile { public: - LinkedObjectFile() = default; + LinkedObjectFile(GameVersion version) : version(version){}; void set_segment_count(int n_segs); void push_back_word_to_segment(uint32_t word, int segment); int get_label_id_for(int seg, int offset); @@ -137,6 +137,8 @@ class LinkedObjectFile { std::unique_ptr label_db; + GameVersion version; + private: goos::Object to_form_script(int seg, int word_idx, std::vector& seen); goos::Object to_form_script_object(int seg, int byte_idx, std::vector& seen); diff --git a/decompiler/ObjectFile/LinkedObjectFileCreation.cpp b/decompiler/ObjectFile/LinkedObjectFileCreation.cpp index f95d717482..51db88689e 100644 --- a/decompiler/ObjectFile/LinkedObjectFileCreation.cpp +++ b/decompiler/ObjectFile/LinkedObjectFileCreation.cpp @@ -816,7 +816,7 @@ LinkedObjectFile to_linked_object_file(const std::vector& data, const std::string& name, DecompilerTypeSystem& dts, GameVersion game_version) { - LinkedObjectFile result; + LinkedObjectFile result(game_version); const auto* header = (const LinkHeaderCommon*)&data.at(0); // use appropriate linker diff --git a/decompiler/ObjectFile/ObjectFileDB.cpp b/decompiler/ObjectFile/ObjectFileDB.cpp index cbf7a570af..4f1adf3563 100644 --- a/decompiler/ObjectFile/ObjectFileDB.cpp +++ b/decompiler/ObjectFile/ObjectFileDB.cpp @@ -359,7 +359,7 @@ void ObjectFileDB::add_obj_from_dgo(const std::string& obj_name, } // nope, have to add a new one. - ObjectFileData data; + ObjectFileData data(config.game_version); data.data.resize(obj_size); memcpy(data.data.data(), obj_data, obj_size); data.record.hash = hash; diff --git a/decompiler/ObjectFile/ObjectFileDB.h b/decompiler/ObjectFile/ObjectFileDB.h index 1db8ad242c..37f072874a 100644 --- a/decompiler/ObjectFile/ObjectFileDB.h +++ b/decompiler/ObjectFile/ObjectFileDB.h @@ -37,6 +37,7 @@ struct ObjectFileRecord { * All of the data for a single object file */ struct ObjectFileData { + ObjectFileData(GameVersion version) : linked_data(version) {} std::vector data; // raw bytes LinkedObjectFile linked_data; // data including linking annotations ObjectFileRecord record; // name diff --git a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp index 3d11c4e462..70563bbec8 100644 --- a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp +++ b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp @@ -29,6 +29,7 @@ #include "decompiler/analysis/symbol_def_map.h" #include "decompiler/analysis/type_analysis.h" #include "decompiler/analysis/variable_naming.h" +#include "decompiler/types2/types2.h" namespace decompiler { @@ -538,14 +539,33 @@ void ObjectFileDB::ir2_type_analysis_pass(int seg, const Config& config, ObjectF func.ir2.env.set_art_group(obj_name + "-ag"); } - if (run_type_analysis_ir2(ts, dts, func)) { - func.ir2.env.types_succeeded = true; + constexpr bool kForceNewTypes = false; + if (config.game_version == GameVersion::Jak2 || kForceNewTypes) { + // use new types for jak 2 always + types2::Input in; + types2::Output out; + in.func = &func; + in.function_type = ts; + in.dts = &dts; + try { + types2::run(out, in); + func.ir2.env.set_types(out.block_init_types, out.op_end_types, *func.ir2.atomic_ops, + ts); + } catch (const std::exception& e) { + func.warnings.warning("Type analysis failed: {}", e.what()); + } + func.ir2.env.types_succeeded = out.succeeded; } else { - func.warnings.error("Type Propagation failed: Type analysis failed"); + // old type pass + if (run_type_analysis_ir2(ts, dts, func)) { + func.ir2.env.types_succeeded = true; + } else { + func.warnings.warning("Type analysis failed"); + } } } else { lg::warn("Function {} didn't know its type", func.name()); - func.warnings.error("Function {} has unknown type", func.name()); + func.warnings.warning("Function {} has unknown type", func.name()); } } }); @@ -872,9 +892,11 @@ std::string ObjectFileDB::ir2_function_to_string(ObjectFileData& data, Function& result += ";; Warnings:\n" + func.warnings.get_warning_text(true) + "\n"; } + /* if (func.ir2.env.has_local_vars()) { result += func.ir2.env.print_local_var_types(func.ir2.top_form); } + */ bool print_atomics = func.ir2.atomic_ops_succeeded; // print each instruction in the function. diff --git a/decompiler/analysis/analyze_inspect_method.cpp b/decompiler/analysis/analyze_inspect_method.cpp index 3c26986434..a42dcd3872 100644 --- a/decompiler/analysis/analyze_inspect_method.cpp +++ b/decompiler/analysis/analyze_inspect_method.cpp @@ -1157,7 +1157,7 @@ bool allow_guess(const Field& field) { std::string TypeInspectorResult::print_as_deftype( StructureType* old_game_type, std::unordered_map& previous_results, - DecompilerTypeSystem& previous_game_ts, + DecompilerTypeSystem& /*previous_game_ts*/, ObjectFileDB::PerObjectAllTypeInfo& object_file_meta) { std::string result; @@ -1408,8 +1408,8 @@ std::string get_label_type_name(LinkedObjectFile& file, std::string label_name) void inspect_top_level_for_metadata(Function& top_level, LinkedObjectFile& file, - DecompilerTypeSystem& dts, - DecompilerTypeSystem& previous_game_ts, + DecompilerTypeSystem& /*dts*/, + DecompilerTypeSystem& /*previous_game_ts*/, ObjectFileDB::PerObjectAllTypeInfo& objectFile) { // State as a method: /* @@ -1434,7 +1434,7 @@ void inspect_top_level_for_metadata(Function& top_level, // Check for non-method states std::string last_seen_label = ""; // TODO - safely increment op number - for (int i = 0; i < top_level.ir2.atomic_ops->ops.size(); i++) { + for (int i = 0; i < (int)top_level.ir2.atomic_ops->ops.size(); i++) { const auto& aop = top_level.ir2.atomic_ops->ops.at(i); const std::string as_str = aop.get()->to_string(top_level.ir2.env); @@ -1488,7 +1488,6 @@ void inspect_top_level_for_metadata(Function& top_level, // Check for types // if there's no inspect method, we can use just use the call to the type's new method // to find the type - const auto& env = top_level.ir2.env; for (int i = 0; i < ((int)top_level.ir2.atomic_ops->ops.size()) - 5; i++) { // lw v1, type(s7) ;; [ 20] (set! v1-10 type) [] -> [v1: ] const auto& aop_0 = top_level.ir2.atomic_ops->ops.at(i); diff --git a/decompiler/analysis/atomic_op_builder.cpp b/decompiler/analysis/atomic_op_builder.cpp index b633c56e3c..35ff7bdb5c 100644 --- a/decompiler/analysis/atomic_op_builder.cpp +++ b/decompiler/analysis/atomic_op_builder.cpp @@ -3,10 +3,10 @@ #include "atomic_op_builder.h" #include "common/log/log.h" #include "common/symbols.h" +#include "decompiler/Disasm/DecompilerLabel.h" #include "decompiler/Disasm/InstructionMatching.h" #include "decompiler/Function/Function.h" #include "decompiler/Function/Warnings.h" -#include "decompiler/util/TP_Type.h" namespace decompiler { @@ -1944,6 +1944,87 @@ std::unique_ptr convert_vector3_dot(const Instruction* instrs, int idx idx); } +std::unique_ptr convert_vector_length(const Instruction* instrs, int idx) { + // 0: lqc2 vf1, 0(a1) + if (instrs[0].kind != InstructionKind::LQC2 || instrs[0].get_dst(0).get_reg() != make_vf(1) || + !instrs[0].get_src(0).is_imm(0)) { + return nullptr; + } + Register vec_src = instrs[0].get_src(1).get_reg(); + + auto vf0 = make_vf(0); + auto vf1 = make_vf(1); + + // 1: vmul.xyzw vf1, vf1, vf1 + std::vector labels; + if (instrs[1].kind != InstructionKind::VMUL || instrs[1].get_dst(0).get_reg() != vf1 || + instrs[1].get_src(0).get_reg() != vf1 || instrs[1].get_src(1).get_reg() != vf1 || + instrs[1].cop2_dest != 0b1111) { + return nullptr; + } + + // 2: vmulax.w acc, vf0, vf1 + if (instrs[2].kind != InstructionKind::VMULA_BC || instrs[2].get_src(0).get_reg() != vf0 || + instrs[2].get_src(1).get_reg() != vf1 || instrs[2].cop2_dest != 0b0001 || + instrs[2].cop2_bc != 0) { + return nullptr; + } + + // 3: vmadday.w acc, vf0, vf1 + if (instrs[3].kind != InstructionKind::VMADDA_BC || instrs[3].get_src(0).get_reg() != vf0 || + instrs[3].get_src(1).get_reg() != vf1 || instrs[3].cop2_dest != 0b0001 || + instrs[3].cop2_bc != 1) { + return nullptr; + } + + // 4: vmaddz.w vf1, vf0, vf1 + if (instrs[4].kind != InstructionKind::VMADD_BC || instrs[4].get_dst(0).get_reg() != vf1 || + instrs[4].get_src(0).get_reg() != vf0 || instrs[4].get_src(1).get_reg() != vf1 || + instrs[4].cop2_dest != 0b0001 || instrs[4].cop2_bc != 2) { + return nullptr; + } + + // 5: vsqrt Q, vf1.w + if (instrs[5].kind != InstructionKind::VSQRT || instrs[5].get_src(0).get_reg() != vf1) { + return nullptr; + } + + // 6: vaddw.x vf1, vf0, vf0 + if (instrs[6].kind != InstructionKind::VADD_BC || instrs[6].get_dst(0).get_reg() != vf1 || + instrs[6].get_src(0).get_reg() != vf0 || instrs[6].get_src(1).get_reg() != vf0 || + instrs[6].cop2_dest != 0b1000 || instrs[6].cop2_bc != 3) { + return nullptr; + } + + // 7: vwaitq + if (instrs[7].kind != InstructionKind::VWAITQ) { + return nullptr; + } + + // 8: vmulq.x vf1, vf1, Q + if (instrs[8].kind != InstructionKind::VMULQ || instrs[8].get_dst(0).get_reg() != vf1 || + instrs[8].get_src(0).get_reg() != vf1 || instrs[8].cop2_dest != 0b1000) { + return nullptr; + } + + // 9: vnop + if (instrs[9].kind != InstructionKind::VNOP) { + return nullptr; + } + // 10: vnop + if (instrs[10].kind != InstructionKind::VNOP) { + return nullptr; + } + // 11: qmfc2.i a1, vf1 + if (instrs[11].kind != InstructionKind::QMFC2 || instrs[11].src->get_reg() != vf1) { + return nullptr; + } + auto dst = instrs[11].get_dst(0).get_reg(); + return std::make_unique( + make_dst_var(dst, idx), + SimpleExpression(SimpleExpression::Kind::VECTOR_LENGTH, make_src_atom(vec_src, idx)), idx); +} + // 12 instructions std::unique_ptr convert_vector4_dot(const Instruction* instrs, int idx) { // lwc1 f0, 0(a0) @@ -2061,6 +2142,11 @@ std::unique_ptr convert_12(const Instruction* instrs, int idx) { if (as_vector4_dot) { return as_vector4_dot; } + + auto as_vector_length = convert_vector_length(instrs, idx); + if (as_vector_length) { + return as_vector_length; + } return nullptr; } diff --git a/decompiler/analysis/insert_lets.cpp b/decompiler/analysis/insert_lets.cpp index e3ae2ac3c4..8ea37652e9 100644 --- a/decompiler/analysis/insert_lets.cpp +++ b/decompiler/analysis/insert_lets.cpp @@ -340,19 +340,46 @@ FormElement* rewrite_as_send_event(LetElement* in, //////////////////////////////////////////////////////// // (set! (-> block-var from) ) bool not_proc = false; - Matcher set_from_matcher = Matcher::set( - Matcher::deref(Matcher::reg(block_var_reg), false, {DerefTokenMatcher::string("from")}), - Matcher::any_reg(1)); + Matcher set_from_matcher; + switch (env.version) { + case GameVersion::Jak1: + set_from_matcher = Matcher::set( + Matcher::deref(Matcher::reg(block_var_reg), false, {DerefTokenMatcher::string("from")}), + Matcher::any_reg(1)); + break; + case GameVersion::Jak2: + // in jak 2, the event message block holds a ppointer instead. + set_from_matcher = Matcher::set( + Matcher::deref(Matcher::reg(block_var_reg), false, {DerefTokenMatcher::string("from")}), + Matcher::op_fixed(FixedOperatorKind::PROCESS_TO_PPOINTER, {Matcher::any_reg(1)})); + break; + default: + ASSERT(false); + } auto from_mr = match(set_from_matcher, body->at(0)); if (!from_mr.matched) { // initial matcher failed. try more advanced "from" matcher now. - Matcher set_from_form_matcher = Matcher::set( - Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string("from")}), - Matcher::any(1)); + Matcher set_from_form_matcher; + switch (env.version) { + case GameVersion::Jak1: + set_from_form_matcher = Matcher::set( + Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string("from")}), + Matcher::any(1)); + break; + case GameVersion::Jak2: + set_from_form_matcher = Matcher::set( + Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string("from")}), + Matcher::op_fixed(FixedOperatorKind::PROCESS_TO_PPOINTER, {Matcher::any(1)})); + break; + default: + ASSERT(false); + } + from_mr = match(set_from_form_matcher, body->at(0)); if (!from_mr.matched) { return nullptr; } + fmt::print("case 1: {}\n", from_mr.maps.forms.at(1)->to_string(env)); not_proc = true; } diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index ace5237645..a5690714dd 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -12,16 +12,20 @@ (define-extern binteger type) (define-extern number type) (define-extern integer type) +(define-extern uinteger type) (define-extern float type) (define-extern boolean type) ;; not actually added as a runtime type in jak2, but valid? supports it. (define-extern uint16 type) (define-extern uint32 type) +(define-extern int32 type) (define-extern int64 type) +(define-extern uint8 type) (define-extern uint64 type) (define-extern process-tree type) (define-extern process type) (define-extern stack-frame type) (define-extern global kheap) +(define-extern kheap type) @@ -61,24 +65,46 @@ (define-extern scf-get-territory (function int)) ;; not actually a scf function... (define-extern mouse-get-data (function mouse-info none)) (define-extern file-stream-read (function file-stream pointer int int)) -(define-extern file-stream-open (function file-stream basic symbol file-stream)) +(define-extern file-stream-open (function file-stream string symbol file-stream)) (define-extern file-stream-length (function file-stream int)) +(define-extern reset-path (function none)) +(define-extern flush-cache (function int none)) +(define-extern gs-store-image (function object object object)) +(define-extern sync-path (function int int int)) +(define-extern file-stream-write (function file-stream pointer uint uint)) +(define-extern file-stream-close (function file-stream file-stream)) +(define-extern new-dynamic-structure (function symbol type int structure)) +(define-extern kernel-shutdown (function none)) +(define-extern scf-get-timeout (function int)) +(define-extern scf-get-inactive-timeout (function int)) +(define-extern syncv (function int int)) +(define-extern string->symbol (function string symbol)) +(define-extern link-begin (function pointer (pointer uint8) int kheap link-flag int)) +(define-extern link-resume (function int)) +(define-extern link-reset (function none)) + +(define-extern loading-level kheap) + + + +(defenum kmalloc-flags + :bitfield #t + (align-16 4) + (align-64 6) + (align-256 8) + (memset 12) + (top 13) + ) + +(define-extern kmalloc (function kheap int kmalloc-flags string pointer)) + (define-extern *kernel-boot-message* symbol) +(define-extern *kernel-boot-art-group* string) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gcommon ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| -(deftype array (UNKNOWN) - () - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ;; Failed to read fields. - ) -|# - (deftype vec4s (uint128) ((x float :offset 0) (y float :offset 32) @@ -895,6 +921,7 @@ (w uint8 :offset 3) (clr uint32 :offset 0) ) + :pack-me :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 @@ -908,6 +935,7 @@ (w int8 :offset 3) (clr int32 :offset 0) ) + :pack-me :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 @@ -919,6 +947,7 @@ (y uint8 :offset 1) (clr uint16 :offset 0) ) + :pack-me :method-count-assert 9 :size-assert #x2 :flag-assert #x900000002 @@ -940,6 +969,7 @@ (x int16 :offset 0) (y int16 :offset 2) ) + :pack-me :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 @@ -951,6 +981,7 @@ (y uint16 :offset 2) (val uint32 :offset 0) ) + :pack-me :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 @@ -1000,7 +1031,7 @@ ) (deftype vector4w (structure) - ((data uint32 4 :offset-assert 0) + ((data uint32 4 :offset-assert 0 :score -1) (x int32 :offset 0) (y int32 :offset 4) (z int32 :offset 8) @@ -1087,6 +1118,7 @@ (w int16 :offset 6) (long uint64 :offset 0) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 @@ -1121,7 +1153,7 @@ ) (deftype vector-array (inline-array-class) - ((data vector :inline :dynamic :offset-assert 16) + ((data vector :inline :dynamic :offset-assert 16 :score 10) ) :method-count-assert 9 :size-assert #x10 @@ -1236,7 +1268,7 @@ (word uint32 4 :offset 0) (dword uint64 2 :offset 0) (quad uint128 :offset 0) - (vector vector :inline :offset 0) + (vector vector :inline :offset 0 :score -100) (vector4w vector4w :inline :offset 0) ) :method-count-assert 9 @@ -1297,7 +1329,7 @@ (intersects-line-segment? (_type_ vector vector) symbol 12) (set-from-point-offset! (_type_ vector vector) none 13) (set-from-point-offset-pad! (_type_ vector vector float) int 14) - (set-to-point! (_type_ vector vector float) none 15) + (set-to-point! (_type_ vector) none 15) (set-from-sphere! (_type_ sphere) none 16) (set-from-spheres! (_type_ (inline-array sphere) int) int 17) (get-bounding-sphere (_type_ vector) vector 18) @@ -1344,10 +1376,10 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype matrix (structure) - ((data float 16 :offset-assert 0) - (vector vector 4 :offset 0) - (quad uint128 4 :offset 0) - (trans vector :inline :offset 48) + ((data float 16 :offset-assert 0) + (vector vector 4 :inline :offset 0) + (quad uint128 4 :offset 0) + (trans vector :inline :offset 48) ) :method-count-assert 10 :size-assert #x40 @@ -1359,7 +1391,7 @@ (deftype matrix3 (structure) ((data float 12 :offset-assert 0) - (vector vector 3 :offset 0) + (vector vector 3 :inline :offset 0) (quad uint128 3 :offset 0) ) :method-count-assert 9 @@ -1368,9 +1400,9 @@ ) (deftype matrix4h (structure) - ((data int16 16 :offset-assert 0) - (vector4h vector4h 4 :offset 0) - (long int64 4 :offset 0) + ((data int16 16 :offset-assert 0) + (vector4h vector4h 4 :inline :offset 0) + (long int64 4 :offset 0) ) :method-count-assert 9 :size-assert #x20 @@ -1384,7 +1416,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype quaternion (structure) - ((data float 4 :offset-assert 0) + ((data float 4 :offset-assert 0 :score -1) (x float :offset 0) (y float :offset 4) (z float :offset 8) @@ -1432,6 +1464,9 @@ (rot vector :inline :offset-assert 32) (scale vector :inline :offset-assert 48) ) + (:methods + (new (symbol type) _type_ 0) + ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 @@ -1480,7 +1515,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype transformq (transform) - ((quat quaternion :inline :offset 16) + ((quat quaternion :inline :offset 16 :score 1) ) :method-count-assert 9 :size-assert #x30 @@ -1488,7 +1523,7 @@ ) (deftype trsq (trs) - ((quat quaternion :inline :offset 32) + ((quat quaternion :inline :offset 32 :score 1) ) :method-count-assert 9 :size-assert #x40 @@ -1509,25 +1544,25 @@ :size-assert #x8c :flag-assert #x1c0000008c (:methods - (trsqv-method-9 () none 9) ;; (seek-toward-heading-vec! (_type_ vector float time-frame) quaternion 9) - (trsqv-method-10 () none 10) ;; (set-heading-vec! (_type_ vector) quaternion 10) - (trsqv-method-11 () none 11) ;; (seek-to-point-toward-point! (_type_ vector float time-frame) quaternion 11) - (trsqv-method-12 () none 12) ;; (point-toward-point! (_type_ vector) quaternion 12) - (trsqv-method-13 () none 13) ;; (seek-toward-yaw-angle! (_type_ float float time-frame) quaternion 13) - (trsqv-method-14 () none 14) ;; (set-yaw-angle-clear-roll-pitch! (_type_ float) quaternion 14) - (trsqv-method-15 () none 15) ;; (set-roll-to-grav! (_type_ float) quaternion 15) - (trsqv-method-16 () none 16) ;; (set-roll-to-grav-2! (_type_ float) quaternion 16) - (trsqv-method-17 () none 17) ;; (rotate-toward-orientation! (_type_ quaternion float float) quaternion 17) - (trsqv-method-18 () none 18) ;; (set-quaternion! (_type_ quaternion) quaternion 18) - (trsqv-method-19 () none 19) ;; (set-heading-vec-clear-roll-pitch! (_type_ vector) quaternion 19) - (trsqv-method-20 () none 20) ;; (point-toward-point-clear-roll-pitch! (_type_ vector) quaternion 20) - (trsqv-method-21 () none 21) ;; (rot->dir-targ! (_type_) quaternion 21) + (seek-toward-heading-vec! (_type_ vector float time-frame) quaternion 9) + (set-heading-vec! (_type_ vector) quaternion 10) + (seek-to-point-toward-point! (_type_ vector float time-frame) quaternion 11) + (point-toward-point! (_type_ vector) quaternion 12) + (seek-toward-yaw-angle! (_type_ float float time-frame) quaternion 13) + (set-yaw-angle-clear-roll-pitch! (_type_ float) quaternion 14) + (set-roll-to-grav! (_type_ float) quaternion 15) + (set-roll-to-grav-2! (_type_ float) quaternion 16) + (rotate-toward-orientation! (_type_ quaternion float float) quaternion 17) + (set-quaternion! (_type_ quaternion) quaternion 18) + (set-heading-vec-clear-roll-pitch! (_type_ vector) quaternion 19) + (point-toward-point-clear-roll-pitch! (_type_ vector) quaternion 20) + (rot->dir-targ! (_type_) quaternion 21) (y-angle (_type_) float 22) (global-y-angle-to-point (_type_ vector) float 23) (relative-y-angle-to-point (_type_ vector) float 24) - (trsqv-method-25 () none 25) ;; (roll-relative-to-gravity (_type_) float 25) - (trsqv-method-26 () none 26) ;; (set-and-limit-velocity (_type_ int vector float) trsqv 26) - (trsqv-method-27 () none 27) ;; (get-quaternion (_type_) quaternion 27) + (roll-relative-to-gravity (_type_) float 25) + (set-and-limit-velocity (_type_ int vector float) trsqv 26) + (get-quaternion (_type_) quaternion 27) ) ) @@ -1621,7 +1656,7 @@ (define-extern quaternion-axis-angle! (function quaternion float float float float quaternion)) (define-extern quaternion-vector-angle! (function quaternion vector float quaternion)) (define-extern vector-angle<-quaternion! (function vector quaternion vector)) -(define-extern quaternion-look-at! (function vector vector vector quaternion)) +(define-extern quaternion-look-at! (function quaternion vector vector quaternion)) (define-extern quaternion-zero! (function quaternion quaternion)) (define-extern quaternion-identity! (function quaternion quaternion)) (define-extern quaternion-i! (function quaternion quaternion)) @@ -1772,9 +1807,17 @@ (defenum sound-group :bitfield #t :type uint8 - ; (sfx) - ; (music) - ; (dialog) + (sfx) + (sog1) + (sog2) + (sog3) + (sog4) + (sog5) + (sog6) + (sog7) + + ; (music) 1 + ; (dialog) 2 ; (sog3) ; (ambient) ; (sog5) @@ -1782,18 +1825,19 @@ ; (sog7) ) +;; not 100% sure on these (defenum sound-mask :bitfield #t :type uint16 - ; (volume) - ; (pitch) - ; (bend) - ; (unused) - ; (time) - ; (trans) - ; (fo-min) - ; (fo-max) - ; (fo-curve) + (volume) + (pitch) + (bend) + (unused) + (time) + (trans) + (fo-min) + (fo-max) + (fo-curve) ) @@ -2107,7 +2151,7 @@ (group sound-group :offset-assert 12) (reg uint8 3 :offset-assert 13) (sound-name-char uint8 16 :offset-assert 16) - (sound-name sound-name :offset 16) + (sound-name sound-name :offset 16 :score 1) (trans int32 4 :offset-assert 32) (volume int32 :offset-assert 48) (pitch-mod int32 :offset-assert 52) @@ -2904,7 +2948,7 @@ (bucket-322 322) (bucket-323 323) (bucket-324 324) - (debug 325) + (debug-no-zbuf 325) ) (defenum vu1-renderer-mask @@ -2947,11 +2991,25 @@ (rn34) ) +(defenum tpage-category + :type int8 + (tfrag 0) + (pris 1) + (shrub 2) + (alpha 3) + (water 4) + (warp 5) + (pris2 6) + (sprite 7) + (map 8) + (sky 9) + ) + (deftype dma-foreground-sink (basic) - ((bucket bucket-id :offset-assert 4) - (foreground-texture-page int8 :offset-assert 8) - (foreground-texture-level int8 :offset-assert 9) - (foreground-output-bucket int8 :offset-assert 10) + ((bucket bucket-id :offset-assert 4) + (foreground-texture-page tpage-category :offset-assert 8) + (foreground-texture-level int8 :offset-assert 9) + (foreground-output-bucket int8 :offset-assert 10) ) :method-count-assert 9 :size-assert #xb @@ -2981,13 +3039,13 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype profile-segment (structure) - ((name basic :offset-assert 0) + ((name symbol :offset-assert 0) (start-time int16 :offset-assert 4) (end-time int16 :offset-assert 6) (count uint8 :offset-assert 8) (vu-count uint8 :offset-assert 9) (depth uint16 :offset-assert 10) - (color uint32 :offset-assert 12) + (color rgba :offset-assert 12) (code-time uint16 :offset 4) (vu-time uint16 :offset 6) ) @@ -3013,7 +3071,7 @@ (depth int8 :offset-assert 6) (max-depth int8 :offset-assert 7) (base-time int16 :offset-assert 8) - (segment basic 9 :offset-assert 12) ;; todo + (segment profile-segment 9 :offset-assert 12) ;; todo (data profile-segment 512 :inline :offset-assert 48) ) :method-count-assert 13 @@ -3021,13 +3079,13 @@ :flag-assert #xd00002030 (:methods (get-total-time (_type_) int 9) - (profile-segment-array-method-10 () none 10) - (profile-segment-array-method-11 () none 11) - (profile-segment-array-method-12 () none 12) + (start-frame! (_type_) none 10) + (start-segment! (_type_ symbol rgba) none 11) + (end-segment! (_type_) none 12) ) ) - +(declare-type dma-buffer structure) (deftype profile-array (structure) ((data profile-segment-array 2 :offset-assert 0) ;; guess @@ -3036,9 +3094,9 @@ :size-assert #x8 :flag-assert #xc00000008 (:methods - (profile-array-method-9 () none 9) - (profile-array-method-10 () none 10) - (profile-array-method-11 () none 11) + (setup-categories! (_type_) none 9) + (draw-bars! (_type_ dma-buffer int) none 10) + (draw-text! (_type_) none 11) ) ) @@ -3141,6 +3199,9 @@ (deftype dma-gif-packet (structure) ((dma-vif dma-packet :inline :offset-assert 0) (gif uint64 2 :offset-assert 16) + ;; added these two + (gif0 uint64 :offset 16) + (gif1 uint64 :offset 24) (quad uint128 2 :offset 0) ) :method-count-assert 9 @@ -3154,6 +3215,7 @@ (base pointer :offset-assert 8) (end pointer :offset-assert 12) (data uint64 1 :offset-assert 16) + (data-buffer uint8 :dynamic :offset 16) ;; added ) (:methods (new (symbol type int) _type_ 0) @@ -3288,7 +3350,7 @@ :flag-assert #xa00000090 (:methods (new (symbol type int) _type_ 0) - (cpad-info-method-9 () none 9) + (invert-analog-if-needed (_type_) none 9) ) ) @@ -4036,6 +4098,21 @@ :flag-assert #x900000010 ) + +; (deftype dma-gif-packet (structure) +; ((dma-vif dma-packet :inline :offset-assert 0) +; (gif uint64 2 :offset-assert 16) +; ;; added these two +; (gif0 gif-tag64 :offset 16 :score 1) +; (gif1 gif-tag-regs :offset 24 :score 1) +; (quad uint128 2 :offset 0) +; ) +; :method-count-assert 9 +; :size-assert #x20 +; :flag-assert #x900000020 +; ) + + (deftype gif-packet (basic) ((reg-count int32 :offset-assert 4) @@ -4194,7 +4271,7 @@ :flag-assert #xa0000009c (:methods (new (symbol type int int int int int) _type_ 0) - (display-method-9 () none 9) ;; (set-time-ratios (_type_ float) float 9) + (set-time-ratios (_type_ float) float 9) ) ) @@ -4521,9 +4598,9 @@ :size-assert #xd0 :flag-assert #x10000000d0 (:methods - ;; (new (symbol type) _type_ 0) - (external-art-control-method-9 () none 9) ;; (update (_type_ symbol) int 9) - (external-art-control-method-10 () none 10) ;; (clear-rec (_type_) int 10) + (new (symbol type) _type_ 0) + (update (_type_ symbol) int 9) + (clear-rec (_type_) int 10) (external-art-control-method-11 () none 11) ;; (spool-push (_type_ string int process float) int 11) (external-art-control-method-12 () none 12) ;; (file-status (_type_ string int) symbol 12) (external-art-control-method-13 () none 13) ;; (reserve-alloc (_type_) kheap 13) @@ -4593,8 +4670,8 @@ (segment-common texture-pool-segment :inline :offset 28) (common-page texture-page 32 :offset-assert 52) ;; guessed by decompiler (common-page-mask int32 :offset-assert 180) - (update-sprites-flag basic :offset-assert 184) - (update-flag basic :offset-assert 188) + (update-sprites-flag symbol :offset-assert 184) + (update-flag symbol :offset-assert 188) (texture-enable-user uint64 :offset-assert 192) (texture-enable-user-menu uint64 :offset-assert 200) (ids uint32 128 :offset-assert 208) ;; guessed by decompiler @@ -4603,24 +4680,24 @@ :size-assert #x2d0 :flag-assert #x1a000002d0 (:methods - ;; (new (symbol type) _type_ 0) - (texture-pool-method-9 () none 9) ;; (initialize! (_type_) _type_ 9) + (new (symbol type) _type_ 0) + (initialize! (_type_) _type_ 9) (texture-pool-method-10 () none 10) ;; (print-usage (_type_) _type_ 10) (texture-pool-method-11 () none 11) ;; (setup-font-texture! (_type_) none 11) - (texture-pool-method-12 () none 12) ;; (allocate-defaults! (_type_) none 12) - (texture-pool-method-13 () none 13) ;; (login-level-textures (_type_ level int (pointer texture-id)) none 13) + (allocate-defaults! (_type_) none 12) + (login-level-textures (_type_ level int (pointer texture-id)) none 13) (texture-pool-method-14 () none 14) ;; (add-tex-to-dma! (_type_ level int) none 14) - (texture-pool-method-15 () none 15) ;; (allocate-vram-words! (_type_ int) int 15) - (texture-pool-method-16 () none 16) ;; (allocate-segment! (_type_ texture-pool-segment int) texture-pool-segment 16) + (allocate-vram-words! (_type_ int) int 15) + (allocate-segment! (_type_ texture-pool-segment int) texture-pool-segment 16) (texture-pool-method-17 () none 17) ;; (unused-17 () none 17) - (texture-pool-method-18 () none 18) ;; (unused-18 () none 18) - (texture-pool-method-19 () none 19) ;; (unused-19 () none 19) - (texture-pool-method-20 () none 20) ;; (unload! (_type_ texture-page) int 20) - (texture-pool-method-21 () none 21) ;; (upload-one-common! (_type_ level) symbol 21) - (texture-pool-method-22 () none 22) ;; (lookup-boot-common-id (_type_ int) int 22) - (texture-pool-method-23 () none 23) - (texture-pool-method-24 () none 24) - (texture-pool-method-25 () none 25) + (texture-pool-method-18 (_type_ int) int 18) ;; (unused-18 () none 18) + (update-warp-and-hud (_type_) none 19) ;; (unused-19 () none 19) + (update-sprites (_type_) none 20) ;; (unload! (_type_ texture-page) int 20) + (flag-update-and-sprite (_type_) none 21) ;; (upload-one-common! (_type_ level) symbol 21) + (relocate-sprite-dests! (_type_) none 22) ;; (lookup-boot-common-id (_type_ int) int 22) + (relocate-hud-dests! (_type_) none 23) + (relocate-warp-dests! (_type_) none 24) + (clear-ids (_type_) none 25) ) ) @@ -4701,11 +4778,11 @@ :size-assert #x80 :flag-assert #xe00000080 (:methods - (texture-page-method-9 () none 9) ;; (remove-from-heap (_type_ kheap) _type_ 9) - (texture-page-method-10 () none 10) ;; (get-leftover-block-count (_type_ int int) int 10) - (texture-page-method-11 () none 11) ;; (unused-11 () none 11) - (texture-page-method-12 () none 12) ;; (relocate-dests! (_type_ int int) none 12) - (texture-page-method-13 () none 13) ;; (add-to-dma-buffer (_type_ dma-buffer int) int 13) + (remove-from-heap (_type_ kheap) _type_ 9) + (get-leftover-block-count (_type_ int int) int 10) + (relocate-dests! (_type_ int int) none 11) ;; (unused-11 () none 11) + (texture-page-method-12 () none 12) ;; + (upload-now! (_type_ int) none 13) ;; (add-to-dma-buffer (_type_ dma-buffer int) int 13) ) ) @@ -4759,8 +4836,8 @@ (deftype adgif-shader (structure) - ((quad qword 5 :offset-assert 0) - (prims gs-reg64 10 :offset 0) + ((quad qword 5 :inline :offset-assert 0 :score -100) + (prims gs-reg64 10 :offset 0 :score -100) (reg-0 uint8 :offset 8) (reg-1 uint8 :offset 24) (reg-2 uint8 :offset 40) @@ -5051,7 +5128,7 @@ ) (deftype light-sphere (structure) - ((name basic :offset-assert 0) + ((name string :offset-assert 0) (bsphere vector :inline :offset-assert 16) (direction vector :inline :offset-assert 32) (color vector :inline :offset-assert 48) @@ -5080,13 +5157,13 @@ ((num-lights uint16 :offset-assert 4) (num-indices uint16 :offset-assert 6) (num-buckets uint16 :offset-assert 8) - (bucket-step uint16 2 :offset-assert 10) + (bucket-step uint8 2 :offset-assert 10) (base-trans vector :inline :offset-assert 16) (axis-scale vector :inline :offset-assert 32) (dimension-array vector4w :inline :offset-assert 48) - (bucket-array uint32 :offset-assert 64) - (index-array uint32 :offset-assert 68) - (light-sphere-array uint32 :offset-assert 72) + (bucket-array pointer :offset-assert 64) + (index-array pointer :offset-assert 68) + (light-sphere-array (inline-array light-sphere) :offset-assert 72) ) :method-count-assert 9 :size-assert #x4c @@ -5106,13 +5183,14 @@ (dir1 light :inline :offset-assert 48) (dir2 light :inline :offset-assert 96) (ambi light :inline :offset-assert 144) + (lights light 4 :inline :offset 0) ;; added ) :method-count-assert 9 :size-assert #xc0 :flag-assert #x9000000c0 ) -(define-extern *light-hash* light-hash-work) +(define-extern *light-hash* light-hash) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mood-h ;; @@ -5445,57 +5523,58 @@ ) (deftype level-load-info (basic) - ((name-list string 6 :offset-assert 4) + ((name-list symbol 6 :offset-assert 4 :score -1) (index int16 :offset-assert 28) (task-level uint8 :offset-assert 30) - (name string :offset 4) - (visname string :offset 8) - (nickname string :offset 12) - (dbname string :offset 16) - (taskname string :offset 20) + (name symbol :offset 4) + (visname symbol :offset 8) + (nickname symbol :offset 12) + (dbname symbol :offset 16) + (taskname symbol :offset 20) + (other-name-1 symbol :offset 24) (packages pair :offset-assert 32) ;; guess on type (memory-mode uint32 :offset-assert 36) (music-bank basic :offset-assert 40) (ambient-sounds basic :offset-assert 44) (sound-reverb float :offset-assert 48) - (mood-func basic :offset-assert 52) - (mood-init basic :offset-assert 56) + (mood-func symbol :offset-assert 52) + (mood-init symbol :offset-assert 56) (ocean basic :offset-assert 60) (sky basic :offset-assert 64) (use-camera-other basic :offset-assert 68) (part-engine-max int32 :offset-assert 72) (city-map-bits uint64 :offset-assert 80) - (continues basic :offset-assert 88) - (tasks basic :offset-assert 92) + (continues pair :offset-assert 88) + (tasks pair :offset-assert 92) (priority int32 :offset-assert 96) - (load-commands basic :offset-assert 100) - (alt-load-commands basic :offset-assert 104) + (load-commands pair :offset-assert 100) + (alt-load-commands pair :offset-assert 104) (bsp-mask uint64 :offset-assert 112) (buzzer int32 :offset-assert 120) (buttom-height meters :offset-assert 124) - (run-packages basic :offset-assert 128) + (run-packages pair :offset-assert 128) (prev-level basic :offset-assert 132) (next-level basic :offset-assert 136) (wait-for-load symbol :offset-assert 140) - (login-func basic :offset-assert 144) - (activate-func basic :offset-assert 148) - (deactivate-func basic :offset-assert 152) - (kill-func basic :offset-assert 156) + (login-func symbol :offset-assert 144) + (activate-func symbol :offset-assert 148) + (deactivate-func symbol :offset-assert 152) + (kill-func symbol :offset-assert 156) (borrow-size uint16 2 :offset-assert 160) (borrow-level symbol 2 :offset-assert 164) (borrow-display? basic 2 :offset-assert 172) (base-task-mask task-mask :offset-assert 180) - (texture-anim basic 10 :offset-assert 184) - (texture-anim-tfrag basic :offset 184) - (texture-anim-pris basic :offset 188) - (texture-anim-shrub basic :offset 192) - (texture-anim-alpha basic :offset 196) - (texture-anim-water basic :offset 200) - (texture-anim-twarp basic :offset 204) - (texture-anim-pris2 basic :offset 208) - (texture-anim-sprite basic :offset 212) - (texture-anim-map basic :offset 216) - (texture-anim-sky basic :offset 220) + (texture-anim symbol 10 :offset-assert 184 :score -1) + (texture-anim-tfrag symbol :offset 184) + (texture-anim-pris symbol :offset 188) + (texture-anim-shrub symbol :offset 192) + (texture-anim-alpha symbol :offset 196) + (texture-anim-water symbol :offset 200) + (texture-anim-twarp symbol :offset 204) + (texture-anim-pris2 symbol :offset 208) + (texture-anim-sprite symbol :offset 212) + (texture-anim-map symbol :offset 216) + (texture-anim-sky symbol :offset 220) (draw-priority float :offset-assert 224) (level-flags uint32 :offset-assert 228) (fog-height float :offset-assert 232) @@ -5506,15 +5585,15 @@ (max-rain float :offset-assert 272) (fog-mult float :offset-assert 276) (ocean-alpha float :offset-assert 280) - (extra-sound-bank basic :offset-assert 284) + (extra-sound-bank pair :offset-assert 284) ) :method-count-assert 9 :size-assert #x120 :flag-assert #x900000120 ;; Failed to read fields. ) - (declare-type drawable basic) + (deftype login-state (basic) ((state int32 :offset-assert 4) (pos uint32 :offset-assert 8) @@ -5525,6 +5604,18 @@ :size-assert #x50 :flag-assert #x900000050 ) +(declare-type entity-links-array inline-array-class) +(declare-type game-text-info basic) + +(defenum load-buffer-mode + :type uint32 + (small-edge 0) + (small-center 1) + (medium 2) + (large 3) + (borrow 4) + (ten 10) + ) (deftype level (basic) ((name symbol :offset-assert 4) @@ -5537,13 +5628,14 @@ (heap kheap :inline :offset-assert 48) (borrow-heap kheap 2 :inline :offset-assert 64) (bsp bsp-header :offset-assert 96) - (art-group basic :offset-assert 100) - (info basic :offset-assert 104) + (art-group load-dir-art-group :offset-assert 100) + (info level-load-info :offset-assert 104) (texture-page texture-page 18 :offset-assert 108) (loaded-texture-page texture-page 16 :offset-assert 180) (loaded-texture-page-count int32 :offset-assert 244) - (entity basic :offset-assert 248) + (entity entity-links-array :offset-assert 248) (closest-object float :offset-assert 252) + (closest-object-array float 18 :offset 252) ;; ???? (upload-size int32 18 :offset 324) (inside-boxes symbol :offset-assert 396) @@ -5553,7 +5645,7 @@ (force-inside? symbol :offset-assert 412) (mood-context mood-context :inline :offset-assert 416) (mood-func basic :offset-assert 2384) - (mood-init basic :offset-assert 2388) + (mood-init (function mood-context none) :offset-assert 2388) (vis-bits pointer :offset-assert 2392) (all-visible? symbol :offset-assert 2396) (force-all-visible? symbol :offset-assert 2400) @@ -5568,10 +5660,10 @@ (code-memory-end pointer :offset-assert 4508) (load-start-time time-frame :offset-assert 4512) (load-stop-time time-frame :offset-assert 4520) - (load-buffer basic 2 :offset-assert 4528) + (load-buffer uint32 2 :offset-assert 4528) (load-buffer-size uint32 :offset-assert 4536) (load-buffer-last uint32 :offset-assert 4540) - (load-buffer-mode uint32 :offset-assert 4544) + (load-buffer-mode load-buffer-mode :offset-assert 4544) (display-start-time time-frame :offset-assert 4552) (memory-mask uint32 :offset-assert 4560) (task-mask task-mask :offset-assert 4564) @@ -5595,7 +5687,7 @@ (part-engine basic :offset-assert 5148) (user-object basic 4 :offset-assert 5152) (loaded-text-info-count int32 :offset-assert 5168) - (loaded-text-info object 8 :offset-assert 5172) + (loaded-text-info game-text-info 8 :offset-assert 5172) (level-type basic :offset-assert 5204) (load-order int64 :offset-assert 5208) @@ -5607,27 +5699,27 @@ :flag-assert #x1e0000146c ;; Failed to read fields. (:methods - (level-method-9 () none 9) ;; (deactivate (_type_) _type_ 9) + (deactivate (_type_) _type_ 9) (level-method-10 () none 10) ;; (is-object-visible? (_type_ int) symbol 10) (level-method-11 () none 11) ;; (add-irq-to-tex-buckets! (_type_) none 11) - (level-method-12 () none 12) ;; (unload! (_type_) _type_ 12) - (level-method-13 () none 13) ;; (bsp-name (_type_) symbol 13) - (level-method-14 () none 14) ;; (compute-memory-usage (_type_ object) memory-usage-block 14) - (level-method-15 () none 15) ;; (point-in-boxes? (_type_ vector) symbol 15) + (unload! (_type_) _type_ 12) + (bsp-name (_type_) symbol 13) + (compute-memory-usage (_type_ object) memory-usage-block 14) + (point-in-boxes? (_type_ vector) symbol 15) (level-method-16 () none 16) ;; (update-vis! (_type_ level-vis-info uint uint) symbol 16) - (level-method-17 () none 17) ;; (load-continue (_type_) _type_ 17) - (level-method-18 () none 18) ;; (load-begin (_type_) _type_ 18) - (level-method-19 () none 19) ;; (login-begin (_type_) _type_ 19) - (level-method-20 () none 20) ;; (vis-load (_type_) uint 20) - (level-method-21 () none 21) ;; (unused-21 (_type_) none 21) + (load-continue (_type_) _type_ 17) + (load-begin (_type_) _type_ 18) + (login-begin (_type_) _type_ 19) + (debug-print-region-splitbox (_type_ vector object) none 20) ;; (vis-load (_type_) uint 20) + (get-art-group-by-name (_type_ string) art-group 21) ;; (unused-21 (_type_) none 21) (level-method-22 () none 22) ;; (birth (_type_) _type_ 22) (level-method-23 () none 23) ;; (level-status-set! (_type_ symbol) _type_ 23) - (level-method-24 () none 24) ;; (load-required-packages (_type_) _type_ 24) - (level-method-25 () none 25) ;; (init-vis (_type_) int 25) - (level-method-26 () none 26) ;; (vis-clear (_type_) int 26) - (level-method-27 () none 27) ;; (debug-print-splitbox (_type_ vector string) none 27) - (level-method-28 () none 28) ;; (art-group-get-by-name (_type_ string) art-group 28) - (level-method-29 () none 29) + (level-method-24 () none 24) + (birth (_type_) _type_ 25) ;; (init-vis (_type_) int 25) + (level-status-update! (_type_ symbol) _type_ 26) + (load-required-packages (_type_) _type_ 27) ;; (debug-print-splitbox (_type_ vector string) none 27) + (init-vis-from-bsp (_type_) none 28) + (vis-clear (_type_) none 29) ) ) @@ -5676,28 +5768,28 @@ :flag-assert #x1f00009014 ;; Failed to read fields. (:methods - (level-group-method-9 () none 9) ;; (level-get (_type_ symbol) level 9) - (level-group-method-10 () none 10) ;; (level-get-with-status (_type_ symbol) level 10) - (level-group-method-11 () none 11) ;; (level-get-for-use (_type_ symbol symbol) level 11) - (level-group-method-12 () none 12) ;; (activate-levels! (_type_) int 12) - (level-group-method-13 () none 13) ;; (debug-print-entities (_type_ symbol type) none 13) + (level-get (_type_ symbol) level 9) + (level-get-with-status (_type_ symbol) level 10) + (get-level-by-heap-ptr-and-status (_type_ pointer uint) level 11) ;; + (level-get-for-use (_type_ symbol symbol) level 12) + (activate-levels! (_type_) int 13) ;; (debug-print-entities (_type_ symbol type) none 13) (level-group-method-14 () none 14) ;; (debug-draw-actors (_type_ symbol) none 14) (level-group-method-15 () none 15) ;; (actors-update (_type_) object 15) - (level-group-method-16 () none 16) ;; (level-update (_type_) int 16) + (assign-draw-indices (_type_) none 16) ;; (level-update (_type_) int 16) (level-group-method-17 () none 17) ;; (level-get-target-inside (_type_) level 17) (level-group-method-18 () none 18) ;; (alloc-levels! (_type_ symbol) int 18) - (level-group-method-19 () none 19) ;; (load-commands-set! (_type_ pair) pair 19) - (level-group-method-20 () none 20) ;; (art-group-get-by-name (_type_ string) art-group 20) - (level-group-method-21 () none 21) ;; (load-command-get-index (_type_ symbol int) pair 21) - (level-group-method-22 () none 22) ;; (update-vis-volumes (_type_) none 22) + (level-update (_type_) none 19) ;; + (level-get-target-inside (_type_) level 20) ;; (art-group-get-by-name (_type_ string) art-group 20) + (alloc-levels-if-needed (_type_ symbol) none 21) + (load-commands-set! (_type_ pair) pair 22) ;; (update-vis-volumes (_type_) none 22) (level-group-method-23 () none 23) ;; (update-vis-volumes-from-nav-mesh (_type_) none 23) - (level-group-method-24 () none 24) ;; (print-volume-sizes (_type_) none 24) + (load-command-get-index (_type_ symbol int) pair 24) ;; (print-volume-sizes (_type_) none 24) (level-group-method-25 () none 25) ;; (level-status (_type_ symbol) symbol 25) - (level-group-method-26 () none 26) ;; (level-get-most-disposable (_type_) level 26) + (level-group-method-26 () none 26) (level-group-method-27 () none 27) - (level-group-method-28 () none 28) - (level-group-method-29 () none 29) - (level-group-method-30 () none 30) + (level-status (_type_ symbol) symbol 28) + (load-in-progress? (_type_) symbol 29) + (level-get-most-disposable (_type_) level 30) ) ) @@ -5843,6 +5935,7 @@ (mirror-normal vector :inline :offset-assert 1568) (fov-correction-factor float :offset-assert 1584) ) + (:methods (new (symbol type) _type_ 0)) :method-count-assert 9 :size-assert #x634 :flag-assert #x900000634 @@ -5898,11 +5991,21 @@ (defenum font-color :type uint32 + (zero 0) + (one 1) + (orange-red 3) ) (defenum font-flags :type uint32 :bitfield #t + (shadow 0) + (kerning 1) + (middle 2) + (left 3) + (right 4) + (large 5) + (pc-hack 6) ) (deftype font-context (basic) @@ -5922,7 +6025,7 @@ :size-assert #x54 :flag-assert #x1500000054 (:methods - (new (symbol type matrix int int int font-color font-flags) _type_ 0) + (new (symbol type matrix int int float font-color font-flags) _type_ 0) (set-mat! (font-context matrix) font-context 9) (set-origin! (font-context int int) font-context 10) (set-depth! (font-context int) font-context 11) @@ -5994,14 +6097,14 @@ (define-extern *font-default-matrix* matrix) (define-extern *font-work* font-work) -;; (define-extern font-set-tex0 function) ;; (function (pointer gs-tex0) texture uint uint uint none) -;; (define-extern set-font-color function) +(define-extern font-set-tex0 (function (pointer gs-tex0) texture uint uint uint none)) +(define-extern set-font-color (function int int int int int none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; decomp-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype decomp-work (structure) ((buffer0 uint8 2048 :offset-assert 0) ;; guessed by decompiler (buffer1 uint8 2048 :offset-assert 2048) ;; guessed by decompiler @@ -6012,7 +6115,6 @@ :size-assert #x3000 :flag-assert #x900003000 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -6036,40 +6138,43 @@ (define-extern *profile-w* int) (define-extern *profile-h* int) (define-extern *profile-ticks* symbol) -;; (define-extern profile-texture-test function) -;; (define-extern profile-tfrag-test function) -;; (define-extern profile-tie-test function) -;; (define-extern profile-merc-test function) -;; (define-extern profile-emerc-test function) -;; (define-extern profile-mercneric-test function) +(define-extern profile-texture-test (function bucket-id symbol)) +(define-extern profile-tfrag-test (function bucket-id symbol)) +(define-extern profile-tie-test (function bucket-id symbol)) +(define-extern profile-merc-test (function bucket-id symbol)) +(define-extern profile-emerc-test (function bucket-id symbol)) +(define-extern profile-mercneric-test (function bucket-id symbol)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; display ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern get-current-time (function time-frame)) -(define-extern get-integral-current-time (function time-frame)) -(define-extern set-display (function display int int int int int display)) -;; (define-extern allocate-dma-buffers function) ;; (function display display) -;; (define-extern *font-context* object) ;; font-context -;; (define-extern draw-sprite2d-xy function) ;; (function dma-buffer int int int int rgba none) -;; (define-extern draw-sprite2d-xy-absolute function) -;; (define-extern draw-quad2d function) ;; (function dma-buffer draw-context none) -;; (define-extern screen-gradient function) ;; (function dma-buffer rgba rgba rgba rgba none) -;; (define-extern vif1-handler-debug function) ;; (function none) -;; (define-extern vif1-handler function) ;; (function none) -;; (define-extern vblank-handler function) ;; (function int) -;; (define-extern set-display-gs-state function) ;; (function dma-buffer int int int int int dma-buffer) -;; (define-extern set-display-gs-state-offset function) ;; (function dma-buffer int int int int int int int dma-buffer) -;; (define-extern reset-display-gs-state function) ;; (function display dma-buffer int display) -;; (define-extern *vu0-dma-list* object) ;; dma-buffer +(define-extern get-integral-current-time (function uint)) +(define-extern set-display (function display display)) +(define-extern allocate-dma-buffers (function display display)) +(define-extern *font-context* font-context) +(define-extern draw-sprite2d-xy (function dma-buffer int int int int rgba none)) +(define-extern draw-sprite2d-xy-absolute (function dma-buffer int int int int rgba none)) +(define-extern draw-quad2d (function dma-buffer draw-context none)) +(define-extern screen-gradient (function dma-buffer rgba rgba rgba rgba none)) +(define-extern vif1-handler-debug (function none)) +(define-extern vif1-handler (function none)) +(define-extern vblank-handler (function int)) +(define-extern set-display-gs-state (function dma-buffer int int int int int dma-buffer)) +(define-extern set-display-gs-state-offset (function dma-buffer int int int int int int int dma-buffer)) +(define-extern reset-display-gs-state (function display dma-buffer int display)) +(define-extern *vu0-dma-list* dma-buffer) (define-extern *display* display) +(define-extern install-handler (function int function int)) ;; GOAL thinks it returns something. + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; connect ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype connectable (structure) ((next0 connectable :offset-assert 0) (prev0 connectable :offset-assert 4) @@ -6080,119 +6185,145 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| + +(declare-type engine basic) + (deftype connection (connectable) ((param0 basic :offset-assert 16) (param1 int32 :offset-assert 20) ;; guessed by decompiler (param2 int32 :offset-assert 24) ;; guessed by decompiler (param3 int32 :offset-assert 28) ;; guessed by decompiler - (quad uint128 2 :offset-assert 0) ;; guessed by decompiler + (quad uint128 2 :offset 0) ;; guessed by decompiler ) :method-count-assert 14 :size-assert #x20 :flag-assert #xe00000020 ;; field param1 uses ~A with a signed load field param2 uses ~A with a signed load field param3 uses ~A with a signed load (:methods - (connection-method-9 () none 9) ;; (get-engine (connection) engine 9) - (connection-method-10 () none 10) ;; (get-process (connection) process 10) - (connection-method-11 () none 11) ;; (belongs-to-engine? (connection engine) symbol 11) - (connection-method-12 () none 12) ;; (belongs-to-process? (connection process) symbol 12) - (connection-method-13 () none 13) ;; (move-to-dead (connection) connection 13) + (get-engine (connection) engine 9) + (get-process (connection) process 10) + (belongs-to-engine? (connection engine) symbol 11) + (belongs-to-process? (connection process) symbol 12) + (move-to-dead (connection) connection 13) ) ) -|# -#| + + (deftype engine (basic) - () + ((name symbol :offset-assert 4) + (engine-time time-frame :offset 16) + (allocated-length int16 :offset 10) + (length int16 :offset 8) + (element-type type :offset 12) + (alive-list connectable :inline :offset-assert 32) + (alive-list-end connectable :inline :offset-assert 48) + (dead-list connectable :inline :offset-assert 64) + (dead-list-end connectable :inline :offset-assert 80) + ;; storage for nodes. this is dynamically sized. + (data connection :dynamic :inline :offset-assert 96) + ) :method-count-assert 26 :size-assert #x60 :flag-assert #x1a00000060 ;; Failed to read fields. (:methods - ;; (new (symbol type basic int) _type_ 0) - (engine-method-9 () none 9) ;; (inspect-all-connections (engine) engine 9) - (engine-method-10 () none 10) ;; (apply-to-connections (engine (function connectable none)) int 10) - (engine-method-11 () none 11) ;; (apply-to-connections-reverse (engine (function connectable none)) int 11) - (engine-method-12 () none 12) ;; (execute-connections (engine object) int 12) - (engine-method-13 () none 13) ;; (execute-connections-and-move-to-dead (engine object) int 13) - (engine-method-14 () none 14) ;; (execute-connections-if-needed (engine object) int 14) - (engine-method-15 () none 15) ;; (add-connection (engine process object object object object) connection 15) - (engine-method-16 () none 16) ;; (remove-from-process (engine process) int 16) - (engine-method-17 () none 17) ;; (remove-matching (engine (function connection engine symbol)) int 17) - (engine-method-18 () none 18) ;; (remove-all (engine) int 18) - (engine-method-19 () none 19) ;; (remove-by-param1 (engine object) int 19) - (engine-method-20 () none 20) ;; (remove-by-param2 (engine int) int 20) - (engine-method-21 () none 21) ;; (get-first-connectable (engine) connectable 21) - (engine-method-22 () none 22) ;; (get-last-connectable (engine) connectable 22) - (engine-method-23 () none 23) ;; (unknown-1 (engine (pointer uint32)) uint 23) - (engine-method-24 () none 24) - (engine-method-25 () none 25) + (new (symbol type symbol int type) _type_ 0) + (inspect-all-connections (engine) engine 9) + (apply-to-connections (engine (function connectable none)) int 10) + (apply-to-connections-reverse (engine (function connectable none)) int 11) + (execute-connections (engine object) int 12) + (execute-connections-and-move-to-dead (engine object) int 13) + (execute-connections-if-needed (engine object) int 14) + (add-connection (engine process object object object object) connection 15) + (remove-from-process (engine process) int 16) + (remove-matching (engine (function connection engine symbol)) int 17) + (remove-all (engine) int 18) + (remove-by-param0 (engine object) int 19) + (remove-by-param1 (engine int) int 20) + (remove-by-param2 (engine int) int 21) + (get-first-connectable (engine) connectable 22) + (get-last-connectable (engine) connectable 23) + (get-next-connectable (_type_ connectable) connectable 24) + (get-prev-connectable (_type_ connectable) connectable 25) ) ) -|# -#| + (deftype connection-pers (structure) - () + ((next connection-pers :offset-assert 0) + (key object :offset-assert 4) + (update-time time-frame :offset-assert 8) + (param object 4 :offset 16) + (param-int32 int32 4 :offset 16) + (param-int64 int64 2 :offset 16) + (param-float float 4 :offset 16) + (param-quat int128 :offset 16) + ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ;; Failed to read fields. ) -|# -#| (deftype engine-pers (basic) - ((name basic :offset-assert 4) + ((name symbol :offset-assert 4) (length int16 :offset-assert 8) (allocated-length int16 :offset-assert 10) - (element-type basic :offset-assert 12) + (element-type type :offset-assert 12) (execute-time time-frame :offset-assert 16) (alive-list connection-pers :offset-assert 24) (dead-list connection-pers :offset-assert 28) - (data UNKNOWN :dynamic :offset-assert 32) + (data connection-pers :inline :dynamic :offset-assert 32) ) :method-count-assert 15 :size-assert #x20 :flag-assert #xf00000020 (:methods - (engine-pers-method-9 () none 9) - (engine-pers-method-10 () none 10) - (engine-pers-method-11 () none 11) - (engine-pers-method-12 () none 12) - (engine-pers-method-13 () none 13) - (engine-pers-method-14 () none 14) + (new (symbol type symbol int type) _type_ 0) + (schedule-callback (_type_ object time-frame) connection-pers 9) + (kill-callback (_type_) none 10) + (kill-by-key (_type_ object) none 11) + (kill-matching (_type_ (function engine-pers connection-pers object object symbol) object object) none 12) + (update-callback (_type_) none 13) + (run-pending-updates! (_type_ time-frame) none 14) ) ) -|# -;; (define-extern connection-process-apply function) ;; (function process (function object none) symbol) +(define-extern connection-process-apply (function process (function object none) symbol)) (define-extern process-disconnect (function process int)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; text-id-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defenum game-text-id + :type uint32 + :bitfield #f +;; GAME-TEXT-ID ENUM BEGINS + (pause 257) +;; GAME-TEXT-ID ENUM ENDS +) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; text-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype game-text (structure) ((id game-text-id :offset-assert 0) ;; guessed by decompiler (text string :offset-assert 4) ;; guessed by decompiler ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| + + (deftype game-text-info (basic) ((length int32 :offset-assert 4) (language-id int32 :offset-assert 8) @@ -6203,39 +6334,38 @@ :size-assert #x10 :flag-assert #xa00000010 (:methods - (game-text-info-method-9 () none 9) ;; (lookup-text! (_type_ game-text-id symbol) string 9) + (lookup-text! (_type_ game-text-id symbol) string 9) ) ) -|# -;; (define-extern *text-group-names* array) ;; (array string) -;; (define-extern *common-text-heap* object) ;; kheap -;; (define-extern *common-text* object) ;; game-text-info + +(define-extern *text-group-names* (array string)) +(define-extern *common-text-heap* kheap) +(define-extern *common-text* game-text-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; camera-defs-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype camera-bank (basic) ((collide-move-rad float :offset-assert 4) (joypad uint32 :offset-assert 8) (min-detectable-velocity float :offset-assert 12) - (attack-timeout uint64 :offset-assert 16) ;; time-frame + (attack-timeout time-frame :offset-assert 16) ;; time-frame (default-string-max-y meters :offset-assert 24) (default-string-min-y meters :offset-assert 28) (default-string-max-z meters :offset-assert 32) (default-string-min-z meters :offset-assert 36) (default-string-push-z meters :offset-assert 40) - (default-tilt-adjust deg :offset-assert 44) ;; degrees + (default-tilt-adjust degrees :offset-assert 44) ;; degrees ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# -#| + (deftype camera-master-bank (basic) ((onscreen-head-height meters :offset-assert 4) (onscreen-foot-height meters :offset-assert 8) @@ -6250,16 +6380,15 @@ :size-assert #x24 :flag-assert #x900000024 ) -|# -;; (define-extern *CAMERA-bank* camera-bank) ;; camera-bank -;; (define-extern *CAMERA_MASTER-bank* camera-master-bank) ;; camera-master-bank + +(define-extern *CAMERA-bank* camera-bank) +(define-extern *CAMERA_MASTER-bank* camera-master-bank) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; trail-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype trail-node (structure) ((next-id int16 :offset-assert 0) (prev-id int16 :offset-assert 2) @@ -6281,9 +6410,7 @@ (trail-node-method-11 () none 11) ) ) -|# -#| (deftype trail-visgroup (structure) ((first-node uint16 :offset-assert 0) (node-count uint8 :offset-assert 2) @@ -6293,9 +6420,8 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| + (deftype trail-conn (structure) ((head-id uint16 :offset-assert 0) (tail-id uint16 :offset-assert 2) @@ -6310,9 +6436,7 @@ (trail-conn-method-9 () none 9) ) ) -|# -#| (deftype trail-conn-hash-cell (structure) ((first-conn uint16 :offset-assert 0) (conn-count uint8 :offset-assert 2) @@ -6322,9 +6446,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype trail-conn-search (structure) ((best-conn-id int32 :offset-assert 0) (best-dist float :offset-assert 4) @@ -6333,18 +6455,17 @@ (debug-cells-searched int32 :offset-assert 16) (debug-conns-searched int32 :offset-assert 20) (bounds bounding-box4w :inline :offset-assert 32) - (cell-quads UNKNOWN 2 :offset-assert 64) - (conn-quads UNKNOWN 7 :offset-assert 96) - (cell-bits UNKNOWN 2 :offset-assert 64) - (conn-bits UNKNOWN 2 :offset-assert 96) + (cell-quads qword 2 :inline :offset-assert 64) + (conn-quads qword 7 :inline :offset-assert 96) + (cell-bits vector16ub 2 :inline :offset 64) + ;; (conn-bits UNKNOWN 2 :offset-assert 96) ?? ) :method-count-assert 9 :size-assert #xd0 :flag-assert #x9000000d0 ) -|# -#| + (deftype trail-conn-hash (basic) ((cell-width meters :offset-assert 4) (origin vector :inline :offset-assert 16) @@ -6355,9 +6476,8 @@ :size-assert #x28 :flag-assert #x900000028 ) -|# -#| + (deftype trail-cached-search-info (structure) ((goal-conn-id int16 :offset-assert 0) (orig-goal-pos vector :inline :offset-assert 16) @@ -6367,9 +6487,8 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| + (deftype trail-graph (basic) ((mode uint8 :offset-assert 4) (search-id uint32 :offset-assert 8) @@ -6389,10 +6508,10 @@ (orig-goal-pos vector :inline :offset-assert 64) (conn-start-pos vector :inline :offset-assert 80) (conn-goal-pos vector :inline :offset-assert 96) - (open-quads UNKNOWN 6 :offset-assert 112) - (closed-quads UNKNOWN 6 :offset-assert 208) - (open-bits UNKNOWN 2 :offset-assert 112) - (closed-bits UNKNOWN 2 :offset-assert 208) + (open-quads qword 6 :inline :offset-assert 112) + (closed-quads qword 6 :inline :offset-assert 208) + ; (open-bits UNKNOWN 2 :offset-assert 112) + ; (closed-bits UNKNOWN 2 :offset-assert 208) ) :method-count-assert 29 :size-assert #x130 @@ -6420,38 +6539,149 @@ (trail-graph-method-28 () none 28) ) ) -|# -;; (define-extern *trail-graph* object) +(define-extern *trail-graph* trail-graph) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; minimap-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum minimap-flag + :bitfield #t + :type uint16 + (active 0) ;; 1 + (fade-in 1) ;; 2 + (fade-out 2) ;; 4 + (clamp 3) ;; 8 + (trail 4) ;; 16 + (task-graph 5) ;; 32 + (flash 6) ;; 64 + (minimap 7) ;; 128 + (background 8) ;; 256 + (task 9) ;; 512 + (enemy 10) ;; 1024 + (frustum 11) ;; 2048 + (racer 12) ;; 4096 + (bigmap 13) ;; 8192 + (goal 14) ;; 16384 + (city-only 15) ;; 32768 + ) + +(defenum minimap-class + :type uint16 + :bitfield #f + (none 0) + (onintent 1) + (ruins 2) + (vinroom 3) + (mountain 4) + (hideout 5) + (sewer 6) + (atoll 7) + (hiphog 8) + (fortress 9) + (gungame 10) + (gun-yellow 11) + (garage 12) + (palace-cable 13) + (guard 14) + (goal 15) + (goal-no-trail 16) + (parking-spot 17) + (forest 18) + (kiosk 19) + (dig 20) + (canyon 21) + (tomb 22) + (tanker 23) + (kid 24) + (consite 25) + (palace 26) + (castle 27) + (underport 28) + (stadium 29) + (port-turret 30) + (oracle 31) + (guard-frustum 32) + (burning-bush 33) + (gun-dark 34) + (slumc-seal 35) + (racer 36) + (racer-target 37) + (racer-errol 38) + (flag 39) + (bbush-gena 40) + (bbush-gena-2 41) + (bbush-genb 42) + (bbush-genb-2 43) + (bbush-genc 44) + (bbush-genc-2 45) + (bbush-sluma 46) + (bbush-slumb 47) + (bbush-slumb-2 48) + (bbush-slumc 49) + (bbush-port-3 50) + (bbush-port-2 51) + (bbush-port 52) + (bbush-farma 53) + (bbush-farmb 54) + (bbush-inda 55) + (bbush-indb 56) + (bbush-marka 57) + (bbush-markb 58) + (bbush-markb-2 59) + (bbush-pal 60) + (bbush-pal-2 61) + (bbush-stadium 62) + (atoll-valve 63) + (atoll-ashelin 64) + (mountain-lens 65) + (mountain-shard 66) + (mountain-gear 67) + (ruins-hut 68) + (forest-samos 69) + (metalhead 70) + + ) + (deftype minimap-class-node (structure) - () + ((default-position vector :inline :offset-assert 0) + (flags minimap-flag :offset-assert 16) + (class minimap-class :offset-assert 18) + (name basic :offset-assert 20) + (icon-xy vector2ub :inline :offset-assert 24) + (scale float :offset-assert 28) + (color rgba :offset-assert 32) + ) :method-count-assert 9 :size-assert #x24 :flag-assert #x900000024 ;; Failed to read fields. ) -|# -#| + (deftype connection-minimap (connection-pers) - () + ((handle handle :offset 8) + (position vector :offset 16) + (alpha float :offset 20) + (class minimap-class-node :offset 24) + (flags minimap-flag :offset 28) + (node uint16 :offset 30) + (edge-ry float :offset-assert 32) + (last-world-pos vector :inline :offset-assert 48) + (last-relative-pos vector :inline :offset-assert 64) + ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ;; Failed to read fields. ) -|# -#| + + (deftype engine-minimap (engine-pers) - ((alive-list connection-minimap :offset-assert 24) - (dead-list connection-minimap :offset-assert 28) + ((alive-list-override connection-minimap :offset 24) + (dead-list-override connection-minimap :offset 28) ) :method-count-assert 15 :size-assert #x20 @@ -6459,9 +6689,7 @@ (:methods ) ) -|# -#| (deftype minimap-trail (structure) ((used-by connection-minimap :offset-assert 0) (search-id uint32 :offset-assert 4) @@ -6470,7 +6698,7 @@ (node-path-dist float :offset-assert 16) (last-updated uint64 :offset-assert 24) (cached-info trail-cached-search-info :inline :offset-assert 32) - (node-id UNKNOWN 64 :offset-assert 80) + (node-id uint16 64 :offset-assert 80) ) :method-count-assert 11 :size-assert #xd0 @@ -6480,23 +6708,23 @@ (minimap-trail-method-10 () none 10) ) ) -|# -#| + + (deftype minimap-draw-work (structure) ((buf basic :offset-assert 0) (justify-right basic :offset-assert 4) (draw-pos vector4w :inline :offset-assert 16) (mat matrix :inline :offset-assert 32) - (corner UNKNOWN 4 :offset-assert 96) + (corner vector4w 4 :inline :offset-assert 96) ) :method-count-assert 9 :size-assert #xa0 :flag-assert #x9000000a0 ) -|# -#| + + (deftype minimap (structure) ((draw-tmpl dma-gif-packet :inline :offset-assert 0) (draw2-tmpl dma-gif-packet :inline :offset-assert 32) @@ -6513,11 +6741,11 @@ (map-bits uint64 :offset-assert 256) (level basic :offset-assert 264) (ctywide basic :offset-assert 268) - (inv-scale float :offset-assert 212) - (fade float :offset-assert 220) + (inv-scale float :offset 212) + (fade float :offset 220) (engine basic :offset-assert 272) (engine-key uint32 :offset-assert 276) - (trail UNKNOWN 6 :offset-assert 288) + (trail minimap-trail 6 :inline :offset-assert 288) (race-tex basic :offset-assert 1536) (race-scale float :offset-assert 1540) (race-level basic :offset-assert 1544) @@ -6551,118 +6779,104 @@ (minimap-method-27 () none 27) ) ) -|# + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bigmap-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype bigmap-bit-mask (structure) - ((data UNKNOWN 6656 :offset-assert 0) + ((data uint8 6656 :offset-assert 0) ) :method-count-assert 9 :size-assert #x1a00 :flag-assert #x900001a00 ) -|# -#| + (deftype bigmap-layer-mask (structure) - ((data UNKNOWN 26624 :offset-assert 0) + ((data uint8 26624 :offset-assert 0) ) :method-count-assert 9 :size-assert #x6800 :flag-assert #x900006800 ) -|# -#| (deftype bigmap-image (structure) ((clut-offset uint32 :offset-assert 0) (image-offset uint32 :offset-assert 4) - (pad UNKNOWN 2 :offset-assert 8) - (data UNKNOWN 1 :offset-assert 16) + (pad uint32 2 :offset-assert 8) + (data uint8 1 :offset-assert 16) ) :method-count-assert 9 :size-assert #x11 :flag-assert #x900000011 ) -|# -#| + (deftype bigmap-info (vector) - ((data UNKNOWN 4 :offset-assert 0) - (x float :offset-assert 0) - (y float :offset-assert 4) - (z float :offset-assert 8) - (w float :offset-assert 12) - (quad uint128 :offset-assert 0) - (scale float :offset-assert 8) - (inv-scale float :offset-assert 12) + ((scale float :offset 8 :score 1) + (inv-scale float :offset 12 :score 1) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| + (deftype bigmap-info-array (structure) - ((data UNKNOWN 21 :offset-assert 0) + ((data bigmap-info 21 :inline :offset-assert 0) ) :method-count-assert 9 :size-assert #x150 :flag-assert #x900000150 ) -|# -#| (deftype bigmap-compressed-layers (structure) - ((data UNKNOWN 20 :offset-assert 0) - (layer0 uint32 :offset-assert 0) - (layer1 uint32 :offset-assert 4) - (layer2 uint32 :offset-assert 8) - (layer3 uint32 :offset-assert 12) - (layer4 uint32 :offset-assert 16) - (layer5 uint32 :offset-assert 20) - (layer6 uint32 :offset-assert 24) - (layer7 uint32 :offset-assert 28) - (layer8 uint32 :offset-assert 32) - (layer9 uint32 :offset-assert 36) - (layer10 uint32 :offset-assert 40) - (layer11 uint32 :offset-assert 44) - (layer12 uint32 :offset-assert 48) - (layer13 uint32 :offset-assert 52) - (layer14 uint32 :offset-assert 56) - (layer15 uint32 :offset-assert 60) - (layer16 uint32 :offset-assert 64) - (layer17 uint32 :offset-assert 68) - (layer18 uint32 :offset-assert 72) - (layer19 uint32 :offset-assert 76) + ((data uint32 20 :offset-assert 0 :score -1) + (layer0 uint32 :offset 0) + (layer1 uint32 :offset 4) + (layer2 uint32 :offset 8) + (layer3 uint32 :offset 12) + (layer4 uint32 :offset 16) + (layer5 uint32 :offset 20) + (layer6 uint32 :offset 24) + (layer7 uint32 :offset 28) + (layer8 uint32 :offset 32) + (layer9 uint32 :offset 36) + (layer10 uint32 :offset 40) + (layer11 uint32 :offset 44) + (layer12 uint32 :offset 48) + (layer13 uint32 :offset 52) + (layer14 uint32 :offset 56) + (layer15 uint32 :offset 60) + (layer16 uint32 :offset 64) + (layer17 uint32 :offset 68) + (layer18 uint32 :offset 72) + (layer19 uint32 :offset 76) ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ) -|# -#| + (deftype bigmap (basic) - ((drawing-flag basic :offset-assert 4) - (loading-flag basic :offset-assert 8) - (recording-flag basic :offset-assert 12) - (fill-flag basic :offset-assert 16) + ((drawing-flag symbol :offset-assert 4) + (loading-flag symbol :offset-assert 8) + (recording-flag symbol :offset-assert 12) + (fill-flag symbol :offset-assert 16) (bigmap-index uint32 :offset-assert 20) - (bigmap-image basic :offset-assert 24) + (bigmap-image external-art-buffer :offset-assert 24) (tpage basic :offset-assert 28) (progress-minimap basic :offset-assert 32) (mask-index uint32 :offset-assert 36) (bit-mask bigmap-bit-mask :offset-assert 40) (compressed-next-index uint32 :offset-assert 44) (max-next-index uint32 :offset-assert 48) - (compressed-masks UNKNOWN 20 :offset-assert 52) + (compressed-masks uint32 20 :offset-assert 52) ;; just a guess... (compressed-data uint32 :offset-assert 132) (layer-index uint32 :offset-assert 136) (layer-mask bigmap-layer-mask :offset-assert 140) @@ -6679,23 +6893,24 @@ (draw-tmpl dma-gif-packet :inline :offset-assert 224) (adgif-tmpl dma-gif-packet :inline :offset-assert 256) (offset vector :inline :offset-assert 288) - (size float :offset-assert 296) - (scale float :offset-assert 300) + (size float :offset 296) + (scale float :offset 300) (draw-offset vector :inline :offset-assert 304) - (draw-size float :offset-assert 312) - (draw-scale float :offset-assert 316) + (draw-size float :offset 312) + (draw-scale float :offset 316) (scroll vector :inline :offset-assert 320) (pos vector4w :inline :offset-assert 336) (color vector4w :inline :offset-assert 352) - (corner UNKNOWN 4 :offset-assert 368) + (corner vector4w 4 :inline :offset-assert 368) (auto-save-icon-flag basic :offset-assert 432) ) :method-count-assert 28 :size-assert #x1b4 :flag-assert #x1c000001b4 (:methods - (bigmap-method-9 () none 9) - (bigmap-method-10 () none 10) + (new (symbol type) _type_ 0) + (initialize (_type_) none 9) ;; some sort of init? + (update (_type_) none 10) (bigmap-method-11 () none 11) (bigmap-method-12 () none 12) (bigmap-method-13 () none 13) @@ -6715,9 +6930,8 @@ (bigmap-method-27 () none 27) ) ) -|# -;; (define-extern *bigmap-info-array* object) +(define-extern *bigmap-info-array* bigmap-info-array) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; settings-h ;; @@ -6961,7 +7175,7 @@ :size-assert #xfb0 :flag-assert #x1300000fb0 (:methods - ;; (new (symbol type int) _type_ 0) + (new (symbol type int) _type_ 0) (setting-control-method-9 () none 9) ;; (add-setting (_type_ process symbol object object object) none 9) (setting-control-method-10 () none 10) ;; (set-setting (_type_ process symbol object object object) none 10) (setting-control-method-11 () none 11) ;; (remove-setting (_type_ process symbol) none 11) @@ -6971,7 +7185,7 @@ (setting-control-method-15 () none 15) (setting-control-method-16 () none 16) (setting-control-method-17 () none 17) - (setting-control-method-18 () none 18) + (update (_type_) none 18) ) ) @@ -6980,14 +7194,21 @@ ;; capture ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern gs-set-default-store-image function) ;; (function gs-store-image-packet int int int int int int int int) -;; (define-extern store-image function) ;; (function int int) - +(define-extern gs-set-default-store-image (function gs-store-image-packet int int int int int int int int)) +(define-extern store-image (function screen-shot-work int)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; memory-usage-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum mem-usage-id + :type uint32 + (bsp-leaf-vis-self 62) + (bsp-leaf-vis-adj 63) + + (level-code 65) + (entity-links 66) + ) + (deftype memory-usage-info (structure) ((name string :offset-assert 0) ;; guessed by decompiler (count int32 :offset-assert 4) @@ -6998,13 +7219,11 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype memory-usage-block (basic) ((work-bsp basic :offset-assert 4) (length int32 :offset-assert 8) - (data memory-usage-info 112 :offset-assert 16) ;; guessed by decompiler + (data memory-usage-info 112 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 12 :size-assert #x710 @@ -7015,17 +7234,16 @@ (memory-usage-block-method-11 () none 11) ;; (print-mem-usage (_type_ level object) none 11) ) ) -|# -;; (define-extern *mem-usage* object) ;; memory-usage-block -;; (define-extern *dma-mem-usage* object) ;; memory-usage-block -;; (define-extern *temp-mem-usage* object) ;; memory-usage-block +(define-extern *mem-usage* memory-usage-block) +(define-extern *dma-mem-usage* memory-usage-block) +(define-extern *temp-mem-usage* memory-usage-block) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; blit-displays-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype blit-displays-work (structure) ((adgif-tmpl dma-gif-packet :inline :offset-assert 0) (sprite-tmpl dma-gif-packet :inline :offset-assert 32) @@ -7034,7 +7252,7 @@ (scan-tmpl dma-gif-packet :inline :offset-assert 128) (color vector4w :inline :offset-assert 160) (line-color uint64 :offset-assert 176) - (scan-colors UNKNOWN 15 :offset-assert 192) + (scan-colors vector4w 15 :inline :offset-assert 192) ;; guesss (menu-mode basic :offset-assert 432) (screen-copied basic :offset-assert 436) (vu1-enable-user-menu uint64 :offset-assert 440) @@ -7051,13 +7269,15 @@ :size-assert #x1e0 :flag-assert #x9000001e0 ) -|# + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; texture ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; TODO skip + #| (deftype texture-page-dir (basic) () @@ -7071,53 +7291,53 @@ ) |# -;; (define-extern texture-bpp function) ;; (function gs-psm int) -;; (define-extern texture-qwc function) ;; (function int int gs-psm int) -;; (define-extern physical-address function) ;; (function pointer pointer) -;; (define-extern dma-buffer-add-ref-texture function) ;; (function dma-buffer pointer int int gs-psm none) -;; (define-extern gs-find-block function) ;; (function int int gs-psm int) -;; (define-extern gs-page-width function) ;; (function gs-psm int) -;; (define-extern gs-page-height function) ;; (function gs-psm int) -;; (define-extern gs-block-width function) ;; (function gs-psm int) -;; (define-extern gs-block-height function) ;; (function gs-psm int) -;; (define-extern gs-largest-block function) ;; (function int int gs-psm int) -;; (define-extern gs-blocks-used function) ;; (function int int gs-psm int) -;; (define-extern texture-page-default-allocate function) ;; (function texture-pool texture-page kheap int texture-page) -;; (define-extern texture-page-common-allocate function) ;; (function texture-pool texture-page kheap int texture-page) -;; (define-extern texture-page-font-allocate function) -;; (define-extern texture-page-common-boot-allocate function) ;; (function texture-pool texture-page kheap int texture-page) -;; (define-extern upload-vram-data function) ;; (function dma-buffer int pointer int none) -;; (define-extern upload-vram-pages function) ;; (function texture-pool texture-pool-segment texture-page int bucket-id int) -;; (define-extern update-vram-pages function) ;; (function texture-pool texture-pool-segment texture-page int int) -;; (define-extern upload-vram-pages-pris function) ;; (function texture-pool texture-pool-segment texture-page bucket-id int int) -;; (define-extern texture-page-level-allocate function) ;; (function texture-pool texture-page kheap int texture-page) +(define-extern texture-bpp (function gs-psm int)) +(define-extern texture-qwc (function int int gs-psm int)) +(define-extern physical-address (function pointer pointer)) +(define-extern dma-buffer-add-ref-texture (function dma-buffer pointer int int gs-psm none)) +(define-extern gs-find-block (function int int gs-psm int)) +(define-extern gs-page-width (function gs-psm int)) +(define-extern gs-page-height (function gs-psm int)) +(define-extern gs-block-width (function gs-psm int)) +(define-extern gs-block-height (function gs-psm int)) +(define-extern gs-largest-block (function int int gs-psm int)) +(define-extern gs-blocks-used (function int int gs-psm int)) +(define-extern texture-page-default-allocate (function texture-pool texture-page kheap int texture-page)) +(define-extern texture-page-common-allocate (function texture-pool texture-page kheap int texture-page)) +(define-extern texture-page-font-allocate (function texture-pool texture-page kheap int texture-page)) +(define-extern texture-page-common-boot-allocate (function texture-pool texture-page kheap int texture-page)) +(define-extern upload-vram-data (function dma-buffer int pointer int int none)) +(define-extern upload-vram-pages (function texture-pool texture-pool-segment texture-page int bucket-id int)) +(define-extern update-vram-pages (function texture-pool texture-pool-segment texture-page int int)) +(define-extern upload-vram-pages-pris (function texture-pool texture-pool-segment texture-page bucket-id int int)) +(define-extern texture-page-level-allocate (function texture-pool texture-page kheap int texture-page)) ;; (define-extern texture-page-size-check function) ;; (function texture-pool level symbol int) ;; (define-extern set-skull-gem-masks function) ;; (define-extern upload-textures function) -;; (define-extern *txt-dma-list* object) ;; dma-buffer +(define-extern *txt-dma-list* dma-buffer) ;; (define-extern texture-relocate function) ;; (function dma-buffer texture int gs-psm int dma-buffer) -;; (define-extern relocate-later function) ;; (function symbol) +(define-extern relocate-later (function symbol)) ;; (define-extern texture-page-login function) ;; (function texture-id (function texture-pool texture-page kheap int texture-page) kheap texture-page-dir-entry) ;; (define-extern lookup-texture-by-id function) ;; (function texture-id texture) ;; (define-extern lookup-texture-by-id-fast function) ;; (define-extern lookup-texture-by-name function) ;; (define-extern lookup-texture-id-by-name function) ;; (define-extern lookup-level-texture-by-name function) -;; (define-extern *shader-list* object) ;; pair -;; (define-extern *edit-shader* object) ;; texture-id +(define-extern *shader-list* pair) +(define-extern *edit-shader* texture-id) ;; (define-extern link-texture-by-id function) ;; (function texture-id adgif-shader texture-page-dir-entry) ;; (define-extern adgif-shader<-texture! function) ;; (function adgif-shader texture adgif-shader) ;; (define-extern adgif-shader-update! function) ;; (function adgif-shader texture none) ;; (define-extern adgif-shader<-texture-with-update! function) ;; (function adgif-shader texture adgif-shader) ;; (define-extern hack-texture function) ;; (define-extern adgif-shader-login function) ;; (function adgif-shader texture) -;; (define-extern adgif-shader-login-no-remap function) ;; (function adgif-shader texture) +(define-extern adgif-shader-login-no-remap (function adgif-shader texture)) ;; (define-extern adgif-shader-login-fast function) ;; (function adgif-shader texture) ;; (define-extern adgif-shader-login-no-remap-fast function) ;; (function adgif-shader texture) ;; (define-extern adgif-shader<-texture-simple! function) ;; (function adgif-shader texture adgif-shader) ;; (define-extern set-dirty-mask! function) ;; (define-extern texture-page-dir-inspect function) ;; (function texture-page-dir symbol none) -;; (define-extern *texture-pool* object) ;; texture-pool +(define-extern *texture-pool* texture-pool) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; main-h ;; @@ -7133,8 +7353,8 @@ ) (deftype screen-filter (basic) - ((draw? basic :offset-assert 4) - (bucket int32 :offset-assert 8) + ((draw? symbol :offset-assert 4) + (bucket bucket-id :offset-assert 8) (color vector :inline :offset-assert 16) (color-src vector :inline :offset-assert 32) (color-dest vector :inline :offset-assert 48) @@ -7146,9 +7366,9 @@ :size-assert #x50 :flag-assert #xc00000050 (:methods - (screen-filter-method-9 () none 9) ;; (draw (_type_) none 9) - (screen-filter-method-10 () none 10) - (screen-filter-method-11 () none 11) + (draw (_type_) none 9) + (setup (_type_ vector vector float bucket-id) none 10) + (disable (_type_) none 11) ) ) @@ -7289,11 +7509,11 @@ (define-extern *col-rend* col-rend) (define-extern debug-actor? (function object symbol)) +(define-extern *time-of-day* (pointer process)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mspace-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype joint (basic) ((name basic :offset-assert 4) (number int32 :offset-assert 8) @@ -7304,9 +7524,7 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype bone-cache (structure) ((bone-matrix uint32 :offset-assert 0) (parent-matrix uint32 :offset-assert 4) @@ -7317,33 +7535,24 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype bone (structure) ((transform matrix :inline :offset-assert 0) - (position vector :inline :offset-assert 48) + (position vector :inline :offset 48) (scale vector :inline :offset-assert 64) ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype skeleton (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data UNKNOWN :dynamic :offset-assert 16) - ) + ((bones bone :inline :dynamic)) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype cspace (structure) ((parent cspace :offset-assert 0) (joint joint :offset-assert 4) ;; guessed by decompiler @@ -7363,26 +7572,21 @@ (cspace-method-9 () none 9) ;; (reset-and-assign-geo! (_type_ basic) _type_ 9) ) ) -|# -#| (deftype cspace-array (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data cspace :dynamic :offset-assert 16) ;; guessed by decompiler + ((data cspace :inline :dynamic :offset-assert 16) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drawable-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype drawable (basic) ((id int16 :offset-assert 4) (bsphere vector :inline :offset-assert 16) @@ -7391,19 +7595,19 @@ :size-assert #x20 :flag-assert #x1100000020 (:methods - (drawable-method-9 () none 9) ;; (login (_type_) _type_ 9) - (drawable-method-10 () none 10) ;; (draw (_type_ _type_ display-frame) none 10) + (login (_type_) _type_ 9) + (draw (_type_ _type_ display-frame) none 10) (drawable-method-11 () none 11) ;; (collide-with-box (_type_ int collide-list) none 11) (drawable-method-12 () none 12) ;; (collide-y-probe (_type_ int collide-list) none 12) (drawable-method-13 () none 13) ;; (collide-ray (_type_ int collide-list) none 13) - (drawable-method-14 () none 14) ;; (collect-stats (_type_) none 14) - (drawable-method-15 () none 15) ;; (debug-draw (_type_ drawable display-frame) none 15) - (drawable-method-16 () none 16) ;; (unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 16) + (debug-draw (_type_ drawable display-frame) none 14) ;; (collect-stats (_type_) none 14) + (unpack-vis (_type_ (pointer int8) (pointer int8)) (pointer int8) 15) ;; + (drawable-method-16 () none 16) ;; ) ) -|# -#| + + (deftype drawable-error (drawable) ((name string :offset-assert 32) ;; guessed by decompiler ) @@ -7413,16 +7617,17 @@ (:methods ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drawable-group-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype drawable-group (drawable) - () + ((length int16 :offset 6) + (data drawable :dynamic :offset-assert 32) + ) :method-count-assert 17 :size-assert #x20 :flag-assert #x1100000020 @@ -7431,16 +7636,14 @@ ;; (new (symbol type int) _type_ 0) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drawable-inline-array-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype drawable-inline-array (drawable) - ((length int16 :offset-assert 6) + ((length int16 :offset 6) ) :method-count-assert 17 :size-assert #x20 @@ -7448,19 +7651,17 @@ (:methods ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; draw-node-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype draw-node (drawable) - ((child-count uint8 :offset-assert 6) - (flags uint8 :offset-assert 7) - (child drawable :offset-assert 8) ;; guessed by decompiler - (distance float :offset-assert 12) + ((child-count uint8 :offset 6) + (flags uint8 :offset 7) + (child drawable :offset 8) ;; guessed by decompiler + (distance float :offset 12) ) :method-count-assert 17 :size-assert #x20 @@ -7469,11 +7670,12 @@ (:methods ) ) -|# -#| + (deftype drawable-inline-array-node (drawable-inline-array) - () + ((data draw-node 1 :inline) + (pad uint32) + ) :method-count-assert 17 :size-assert #x44 :flag-assert #x1100000044 @@ -7481,42 +7683,39 @@ (:methods ) ) -|# -#| + (deftype draw-node-dma (structure) - ((banka draw-node 32 :offset-assert 4) ;; guessed by decompiler - (bankb draw-node 32 :offset-assert 1028) ;; guessed by decompiler + ((banka draw-node 32 :inline :offset-assert 0) + (bankb draw-node 32 :inline :offset-assert 1024) ) :method-count-assert 9 :size-assert #x800 :flag-assert #x900000800 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drawable-tree-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (deftype drawable-tree (drawable-group) -;; () -;; :flag-assert #x1100000020 -;; ) +(deftype drawable-tree (drawable-group) + () + :flag-assert #x1100000020 + ) -;; (deftype drawable-tree-array (drawable-group) -;; () -;; :flag-assert #x1100000020 -;; ) +(deftype drawable-tree-array (drawable-group) + ((trees drawable-tree :dynamic :offset 32 :score 100)) + :flag-assert #x1100000020 + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drawable-actor-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype drawable-actor (drawable) - ((actor entity-actor :offset-assert 8) ;; guessed by decompiler + ((actor entity-actor :offset 8) ;; guessed by decompiler ) :method-count-assert 17 :size-assert #x20 @@ -7524,24 +7723,25 @@ (:methods ) ) -|# -;; (deftype drawable-tree-actor (drawable-tree) -;; () -;; :flag-assert #x1100000020 -;; ) -;; (deftype drawable-inline-array-actor (drawable-inline-array) -;; () -;; :flag-assert #x1100000044 -;; ) +(deftype drawable-tree-actor (drawable-tree) + () + :flag-assert #x1100000020 + ) + +(deftype drawable-inline-array-actor (drawable-inline-array) + ((data drawable-actor 1 :inline) + (pad uint8 4)) + :flag-assert #x1100000044 + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; region-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype region (structure) ((id uint32 :offset-assert 0) (on-enter basic :offset-assert 4) @@ -7556,23 +7756,19 @@ (region-method-9 () none 9) ) ) -|# -#| + (deftype region-array (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data UNKNOWN :dynamic :offset-assert 16) + ((data region :inline :dynamic :offset-assert 16) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| + (deftype drawable-region-prim (drawable) - ((region region :offset-assert 8) + ((region region :offset 8) ) :method-count-assert 20 :size-assert #x20 @@ -7583,28 +7779,29 @@ (drawable-region-prim-method-19 () none 19) ) ) -|# -#| + (deftype drawable-tree-region-prim (drawable-tree) - () + ((name basic :offset 8) + (data2 drawable-inline-array :dynamic :offset 32 :score 1)) :method-count-assert 19 :size-assert #x20 :flag-assert #x1300000020 ;; Failed to read fields. (:methods (drawable-tree-region-prim-method-17 () none 17) - (drawable-tree-region-prim-method-18 () none 18) + (debug-print (_type_ vector object) none 18) ) ) -|# -;; (deftype drawable-inline-array-region-prim (drawable-inline-array) -;; () -;; :flag-assert #x1100000044 -;; ) -#| +(deftype drawable-inline-array-region-prim (drawable-inline-array) + ((data drawable-region-prim 1 :inline) + (pad uint8 4)) + :flag-assert #x1100000044 + ) + + (deftype drawable-region-sphere (drawable-region-prim) () :method-count-assert 20 @@ -7613,24 +7810,20 @@ (:methods ) ) -|# -#| (deftype region-face-data (structure) ((normal vector :inline :offset-assert 0) - (normal-offset float :offset-assert 12) + (normal-offset float :offset 12) (num-points uint32 :offset-assert 16) - (points UNKNOWN :dynamic :offset-assert 32) + (points vector :inline :dynamic :offset-assert 32) ;; guess ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype drawable-region-face (drawable-region-prim) - ((data region-face-data :offset-assert 12) + ((data region-face-data :offset 12) ) :method-count-assert 20 :size-assert #x20 @@ -7638,23 +7831,17 @@ (:methods ) ) -|# -#| (deftype region-face-array (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data UNKNOWN :dynamic :offset-assert 20) + ((data region-face-data :dynamic :offset 20) ;; not sure what's going on here. ) :method-count-assert 9 :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype drawable-region-volume (drawable-region-prim) - ((faces basic :offset-assert 12) + ((faces region-face-array :offset 12) ) :method-count-assert 20 :size-assert #x20 @@ -7662,25 +7849,21 @@ (:methods ) ) -|# -#| (deftype region-prim-list (structure) ((num-items int32 :offset-assert 0) - (items UNKNOWN 320 :offset-assert 4) + (items drawable-region-prim 320 :offset-assert 4) ) :method-count-assert 9 :size-assert #x504 :flag-assert #x900000504 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; traffic-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype traffic-danger-info (structure) ((sphere sphere :inline :offset-assert 0) (velocity vector :inline :offset-assert 16) @@ -7695,9 +7878,7 @@ :size-assert #x36 :flag-assert #x900000036 ) -|# -#| (deftype traffic-suppression-params (structure) ((bbox bounding-box :inline :offset-assert 0) (duration uint64 :offset-assert 32) @@ -7709,13 +7890,11 @@ (:methods (traffic-suppression-params-method-9 () none 9) (traffic-suppression-params-method-10 () none 10) - (traffic-suppression-params-method-11 () none 11) + (has-valid-id? (_type_) none 11) (traffic-suppression-params-method-12 () none 12) ) ) -|# -#| (deftype traffic-object-spawn-params (structure) ((object-type uint8 :offset-assert 0) (behavior uint64 :offset-assert 8) @@ -7735,12 +7914,11 @@ :size-assert #x68 :flag-assert #x900000068 ) -|# -;; (define-extern *traffic-manager* object) -;; (define-extern *ctywide-entity* object) -;; (define-extern *lwide-entity* object) -;; (define-extern *race-vehicle-entity* object) +(define-extern *traffic-manager* process) +(define-extern *ctywide-entity* object) +(define-extern *lwide-entity* object) +(define-extern *race-vehicle-entity* object) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; game-task-h ;; @@ -7748,34 +7926,361 @@ (defenum game-task :type uint8 + :bitfield #f + (none 0) + (complete 1) + (dummy0 2) + (eco-blue-button 3) + (eco-yellow-button 4) + (eco-red-button 5) + (fortress-escape 6) + (city-help-kid 7) + (city-vehicle-training 8) + (ruins-tower 9) + (atoll-water 10) + (fortress-dump 11) + (city-krew-delivery 12) + (city-red-gun-training 13) + (atoll-sig 14) + (sewer-enemy 15) + (strip-rescue 16) + (atoll-battle 17) + (mountain-lens 18) + (mountain-gear 19) + (mountain-shard 20) + (mountain-collection 21) + (city-keira-delivery 22) + (stadium-board1 23) + (city-krew-collection 24) + (city-yellow-gun-training 25) + (drill-eggs 26) + (city-power 27) + (palace-cable 28) + (palace-boss 29) + (city-shuttle 30) + (ruins-enemy 31) + (city-blue-gun-training 32) + (forest-scouts 33) + (city-escort-kid 34) + (dig-knock-down 35) + (strip-grenade 36) + (drill-ship 37) + (city-port-run 38) + (city-meet-brutter 39) + (sewer-board 40) + (forest-hunt 41) + (city-intercept-tanker 42) + (stadium-race-class3 43) + (city-protect-water-slums 44) + (dig-find-totem 45) + (city-destroy-guard-vehicles 46) + (city-play-onin-game 47) + (canyon-insert-items 48) + (tomb-poles 49) + (tomb-water 50) + (tomb-boss 51) + (fortress-save-friends 52) + (sewer-escort 53) + (city-dark-gun-training 54) + (stadium-race-class2 55) + (city-stop-bomb-bots 56) + (city-errol-challenge 57) + (strip-drop 58) + (ruins-mech 59) + (forest-protect 60) + (drill-mech 61) + (city-save-lurkers 62) + (stadium-race-class 63) + (palace-sneak-in 64) + (castle-break-in 65) + (castle-boss 66) + (city-whack 67) + (under-mech 68) + (under-sig 69) + (city-defend-stadium 70) + (consite-find-baron 71) + (nest-get-to-gun 72) + (nest-enter 73) + (nest-boss 74) + (city-win 75) + (city-oracle 76) + (city-burning-bush-ring-1 77) + (city-burning-bush-get-to-1 78) + (city-burning-bush-get-to-2 79) + (city-burning-bush-get-to-3 80) + (city-burning-bush-get-to-4 81) + (city-burning-bush-collection-1 82) + (city-burning-bush-racepoint-1 83) + (city-burning-bush-ring-2 84) + (city-burning-bush-get-to-5 85) + (city-burning-bush-get-to-6 86) + (city-burning-bush-shuttle-1 87) + (city-burning-bush-get-to-7 88) + (city-burning-bush-get-to-8 89) + (city-burning-bush-get-to-9 90) + (city-burning-bush-collection-2 91) + (city-burning-bush-get-to-10 92) + (city-burning-bush-get-to-11 93) + (city-burning-bush-ring-3 94) + (city-burning-bush-get-to-12 95) + (city-burning-bush-bombbot-1 96) + (city-burning-bush-get-to-13 97) + (city-burning-bush-get-to-14 98) + (city-burning-bush-get-to-15 99) + (city-burning-bush-collection-3 100) + (city-burning-bush-race-errol 101) + (city-burning-bush-race-port 102) + (stadium-burning-bush-race-board 103) + (stadium-burning-bush-race-class3 104) + (stadium-burning-bush-race-class2 105) + (stadium-burning-bush-race-class1 106) + (stadium-burning-bush-race-class3-r 107) + (stadium-burning-bush-race-class2-r 108) + (stadium-burning-bush-race-class1-r 109) + (max 110) ) +(defenum game-task-actor + :bitfield #f + :type uint8 + (none 0) + (minimap 1) + (torn-hideout 2) + (torn-alley 3) + (kor-alley 4) + (kor-vinroom 5) + (kor-tomb 6) + (krew-hiphog 7) + (sig-hiphog 8) + (sig-atoll 9) + (keira-garage 10) + (vin-vinroom 11) + (ashelin-atoll 12) + (ashelin-market 13) + (onin-onintent 14) + (pecker-onintent 15) + (baron-palace 16) + (baron-tomb 17) + (youngsamos-hideout 18) + (youngsamos-tomb 19) + (brutter-kiosk 20) + (kid-tomb 21) + (youngsamos-alley 22) + (kid-alley 23) + (crocadog-alley 24) + (crocadog-tomb 25) + (youngsamos-forest 26) + (ashelin-throne 27) + (baron-castle 28) + (tess-alley 29) + (youngsamos-onintent 30) + (samos-hideout 31) + (burning-bush-slumb 32) + (burning-bush-gena 33) + (burning-bush-genc 34) + (tess-hiphog 35) + (keira-stadium 36) + (kor-consite 37) + (kor-onintent 38) + (oracle-oracle 39) + (daxter-tomb 40) + (burning-bush-marka 41) + (burning-bush-sluma 42) + (burning-bush-slumb-2 43) + (burning-bush-slumc 44) + (burning-bush-farma 45) + (burning-bush-farmb 46) + (burning-bush-markb 47) + (burning-bush-markb-2 48) + (burning-bush-gena-2 49) + (burning-bush-genb 50) + (burning-bush-genc-2 51) + (burning-bush-inda 52) + (burning-bush-indb 53) + (burning-bush-port 54) + (burning-bush-port-2 55) + (burning-bush-port-3 56) + (burning-bush-pal 57) + (burning-bush-stadium 58) + (burning-bush-pal-2 59) + (burning-bush-genb-2 60) + (kor-hideout 61) + (kid-hideout 62) + (kid-vinroom 63) + (crocadog-vinroom 64) + (samos-garage 65) + (baron-consite 66) + (whack-a-metal-hiphog 67) + ) + +(defenum game-task-action + :bitfield #f + :type uint8 + (hide 0) + (idle 1) + (say 2) + (talk 3) + (show 4) + (shade 5) + (play 6) + (menu 7) + ) + +(defenum game-task-flags + :type uint8 + ) + +(defenum game-task-icon + :type uint16 + ) + +(defenum task-manager-mask + :type uint32 + :bitfield #t + (intro-scene 0) ;; 1 + (resolution-scene 1) ;; 2 + (begin-sphere 2) ;; 4 + (end-sphere 3) ;; 8 + (fail-message 4) ;; 16 + (retry-message 5) ;; 32 + ) + +(defenum game-task-node-flag + :type uint32 ;; guess + :bitfield #t + + (closed 0) ;; 1 + (auto-close 1) ;; 2 + (data 2) ;; 4 + (close-task 3) ;; 8 + (save-on-life 4) ;; 16 + (save-on-try 5) ;; 32 + (abs-task-mask 6) ;; 64 + (set-task-mask 7) ;; 128 + (clear-task-mask 8) ;; 256 + (task-retry 9) ;; 512 + (exclusive 10) ;; 1024 + (intro-wait 11) ;; 2048 + (city-wait 12) ;; 4096 + (reset-on-try 13) ;; 8192 + (task-manager 14) ;; 16384 + (no-fail-on-death 15) ;; 32768 + (no-restart 16) ;; 1 + (no-audio 17) ;; 2 + (no-slow-down 18) ;; #4 high + (utility-node 19) ;; #x8 high + ) + +(defenum game-task-node-command + :type uint8 ;; guess + :bitfield #f + (none 0) + (add-sidekick 1) + (sub-sidekick 2) + (add-board 3) + (sub-board 4) + (add-gun-red 5) + (add-gun-yellow 6) + (add-gun-blue 7) + (add-gun-dark 8) + (add-gun-up-1 9) + (add-gun-up-2 10) + (add-gun-up-3 11) + (add-gun-up-4 12) + (add-pass-red 13) + (add-pass-green 14) + (add-pass-yellow 15) + (add-pass-blue 16) + (add-darkjak 17) + (add-darkjak-0 18) + (add-darkjak-1 19) + (add-darkjak-2 20) + (add-darkjak-3 21) + (add-board-training 22) + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; task-control-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| -(deftype task-manager-info (UNKNOWN) - () - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ;; Failed to read fields. +(deftype game-task-event (basic) + ((actor game-task-actor :offset-assert 4) + (action game-task-action :offset-assert 5) + (icon game-task-icon :offset 6) + (flags game-task-flags :offset 7) + (scene basic :offset 8) + (distance meters :offset-assert 12) ) -|# - -#| -(deftype game-task-node-info (UNKNOWN) - () - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ;; Failed to read fields. + :flag-assert #x900000010 ) -|# -#| -(deftype game-task-info (UNKNOWN) + +(deftype task-manager-info (structure) + ((mask task-manager-mask) + (level basic) + (manager handle) + (fail-message uint32) + (retry-message uint32) + (intro-scene basic) + (resolution-scene basic) + (resolution-scene-continue basic) + (retry-continue basic) + (fail-continue basic) + (init-hook basic) + (cleanup-hook basic) + (update-hook basic) + (code-hook basic) + (complete-hook basic) + (fail-hook basic) + (event-hook basic) + (final-node uint16) + (time-limit int32) + (sphere-count int8) + (index int8) + (intro-delay uint16) + (sphere-array uint32) ;; pointers... + (on-complete basic) + (on-fail basic) + (begin-sphere sphere :inline) + (end-sphere sphere :inline) + ) + :flag-assert #x900000080 + ) + + + +(deftype game-task-node-info (basic) + ((level basic) + (task game-task) + (name basic) + (when-open basic) + (flags game-task-node-flag) + (parent-node uint16 4) + (task-mask task-mask) + (on-open basic) + (info task-manager-info) + (borrow basic) + (open? symbol) + (on-close basic) + (close-time time-frame) + (death-count uint16) + (gem-count uint16) + (skill-count uint16) + (suck-death-count uint8) + (add game-task-node-command) + (description uint32) + ) + :flag-assert #xe0000004c + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + (dummy-12 () none 12) + (dummy-13 () none 13) + ) + ) + + +(deftype game-task-info (basic) ((name basic :offset-assert 4) (text-name uint32 :offset-assert 8) (pre-play-node uint16 :offset-assert 12) @@ -7785,67 +8290,116 @@ (play-continue basic :offset-assert 24) (kiosk-play-continue basic :offset-assert 28) ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + :flag-assert #x900000020 ) -|# -#| -(deftype task-manager (UNKNOWN) - () - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ;; Failed to read fields. +(deftype game-task-control (basic) + ((counter uint32) + (actor game-task-actor) + (current-node uint16) + (current-event uint32) + ) + :flag-assert #xa00000010 + (:methods + (dummy-9 () none 9) + ) ) -|# -#| -(deftype ambient-control (UNKNOWN) + +(deftype task-manager (process) + ( + (node-info basic) + (info task-manager-info) + (lev-name basic) + (fail-on-death? symbol) + (fail-now basic) + (retry-now basic) + (allow-fail basic) + (state-time time-frame) + (count int16) + (max-count int16) + (sub-state uint32 :offset-assert 172) + (slave uint64 32) ;; ? + (arrow uint64 :offset-assert 432) + (link uint32) + (start-time time-frame) + (total-time time-frame) + (beep-time time-frame) + (time-limit time-frame) + (begin-pos vector :inline :offset-assert 480) + (end-pos vector :inline) + (data-int8 int8 32) + (data-int32 int32 32) + (data-float float 32) + (data-vector vector 32 :inline :offset-assert 800) + (actor-group uint32 4 :offset-assert 1312) + (minimap uint32 8 :offset-assert 1328) + (hud uint64 4 :offset-assert 1360) + (hud-timer time-frame :offset 1360) + (hud-counter int64 :offset 1368) + (sound-id uint32 4 :offset-assert 1392) + (intro-time time-frame :offset-assert 1408) + ) + :flag-assert #x1705100588 + (:methods + (dummy-14 () none 14) + (dummy-15 () none 15) + (dummy-16 () none 16) + (dummy-17 () none 17) + (dummy-18 () none 18) + (dummy-19 () none 19) + (dummy-20 () none 20) + (dummy-21 () none 21) + (dummy-22 () none 22) + + ) + ) + + +(deftype ambient-control (structure) ((last-ambient-time time-frame :offset-assert 0) ;; time-frame (last-ambient string :offset-assert 8) ;; guessed by decompiler (last-ambient-id sound-id :offset-assert 12) ;; guessed by decompiler ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 + :flag-assert #xc00000010 + (:methods + (dummy-9 () none 9) + (dummy-10 () none 10) + (dummy-11 () none 11) + ) ) -|# -;; (define-extern game-task->string function) ;; (function game-task string) -;; (define-extern c-string->game-task function) -;; (define-extern game-task-actor->string function) -;; (define-extern game-task-action->string function) -;; (define-extern game-task-node-flag->string function) -;; (define-extern game-task-node-command->string function) -;; (define-extern *traffic-engine* object) +(define-extern game-task->string (function game-task string)) +(define-extern c-string->game-task (function string game-task)) +(define-extern game-task-actor->string (function game-task-actor string)) +(define-extern game-task-action->string (function game-task-action string)) +(define-extern game-task-node-flag->string (function game-task-node-flag none)) +(define-extern game-task-node-command->string (function game-task-node-command string)) +(define-extern *traffic-engine* object) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gsf-vertex (structure) - ((data uint32 8 :offset-assert 0) ;; guessed by decompiler - (byte uint8 32 :offset-assert 0) ;; guessed by decompiler - (quad uint128 2 :offset-assert 0) ;; guessed by decompiler - (vt qword :inline :offset-assert 0) - (pos vector3s :inline :offset-assert 0) - (tex vector2uh :inline :offset-assert 12) - (nrm vector3s :inline :offset-assert 16) - (nc qword :inline :offset-assert 16) - (clr vector4ub :inline :offset-assert 28) - (dtex vector2uh :inline :offset-assert 16) - (dclr vector4ub :inline :offset-assert 20) + ((data uint32 8 :offset-assert 0) + (byte uint8 32 :offset 0) + (quad uint128 2 :offset 0) + (vt qword :inline :offset 0) + (pos vector3s :inline :offset 0) + (tex vector2uh :inline :offset 12) + (nrm vector3s :inline :offset 16) + (nc qword :inline :offset 16) + (clr vector4ub :inline :offset 28) + (dtex vector2uh :inline :offset 16) + (dclr vector4ub :inline :offset 20) ) + :pack-me :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype gsf-fx-vertex (structure) ((clr vector4ub :inline :offset-assert 0) (tex vector2uh :inline :offset-assert 4) @@ -7854,9 +8408,8 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| + (deftype gsf-header (structure) ((num-strips uint8 :offset-assert 0) (num-new-vtxs uint8 :offset-assert 1) @@ -7868,9 +8421,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype gsf-ik (structure) ((index uint8 :offset-assert 0) (no-kick uint8 :offset-assert 1) @@ -7879,9 +8430,7 @@ :size-assert #x2 :flag-assert #x900000002 ) -|# -#| (deftype gsf-info (structure) ((ptr-iks uint32 :offset-assert 0) (ptr-verts uint32 :offset-assert 4) @@ -7892,22 +8441,18 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype gsf-buffer (structure) ((data uint8 8192 :offset-assert 0) ;; guessed by decompiler - (info gsf-info :inline :offset-assert 0) - (header gsf-header :inline :offset-assert 16) - (work-area uint8 :dynamic :offset-assert 32) ;; guessed by decompiler + (info gsf-info :inline :offset 0) + (header gsf-header :inline :offset 16) + (work-area uint8 :dynamic :offset 32) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x2000 :flag-assert #x900002000 ) -|# -#| (deftype generic-frag (structure) ((start-pos uint16 :offset-assert 0) (end-pos uint16 :offset-assert 2) @@ -7916,9 +8461,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype generic-strip (structure) ((pos uint16 :offset-assert 0) (len uint16 :offset-assert 2) @@ -7927,9 +8470,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype generic-envmap-saves (structure) ((index-mask vector4w :inline :offset-assert 0) (verts uint128 12 :offset-assert 16) ;; guessed by decompiler @@ -7939,9 +8480,7 @@ :size-assert #x110 :flag-assert #x900000110 ) -|# -#| (deftype generic-interp-job (structure) ((job-type uint16 :offset-assert 0) (num uint16 :offset-assert 2) @@ -7951,13 +8490,12 @@ (morph-z uint16 :offset-assert 12) (morph-w uint16 :offset-assert 14) ) + :pack-me :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype generic-saves (structure) ((ptr-dma uint32 :offset-assert 0) (ptr-vtxs uint32 :offset-assert 4) @@ -7990,24 +8528,20 @@ :size-assert #x170 :flag-assert #x900000170 ) -|# -#| (deftype generic-gif-tag (structure) ((data uint32 4 :offset-assert 0) ;; guessed by decompiler - (qword qword :inline :offset-assert 0) - (fan-prim uint32 :offset-assert 0) - (str-prim uint32 :offset-assert 4) - (regs uint32 :offset-assert 8) - (num-strips uint32 :offset-assert 12) + (qword qword :inline :offset 0) + (fan-prim uint32 :offset 0) + (str-prim uint32 :offset 4) + (regs uint32 :offset 8) + (num-strips uint32 :offset 12) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype generic-envmap-consts (structure) ((consts vector :inline :offset-assert 0) (strgif generic-gif-tag :inline :offset-assert 16) @@ -8018,9 +8552,7 @@ :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype generic-consts (structure) ((dma-header dma-packet :inline :offset-assert 0) (vif-header uint32 4 :offset-assert 16) ;; guessed by decompiler @@ -8033,7 +8565,7 @@ (ztest-normal gs-adcmd :inline :offset-assert 176) ;; ad-cmd :inline (ztest-opaque gs-adcmd :inline :offset-assert 192) ;; ad-cmd :inline (adcmd-offsets uint8 16 :offset-assert 208) ;; guessed by decompiler - (adcmds ad-cmd 4 :offset-assert 144) ;; guessed by decompiler + ;(adcmds gs-adcmd 4 :offset-assert 144) ;; guessed by decompiler (stcycle-tag uint32 :offset-assert 224) (unpack-vtx-tag uint32 :offset-assert 228) (unpack-clr-tag uint32 :offset-assert 232) @@ -8051,9 +8583,7 @@ :size-assert #x1b0 :flag-assert #x9000001b0 ) -|# -#| (deftype generic-storage (structure) ((data uint128 16 :offset-assert 0) ;; guessed by decompiler ) @@ -8061,7 +8591,6 @@ :size-assert #x100 :flag-assert #x900000100 ) -|# #| (deftype gsf-vertex-array (UNKNOWN) @@ -8083,13 +8612,28 @@ ) |# -;; (define-extern *gsf-buffer* object) ;; gsf-buffer +(deftype gsf-vertex-array (structure) + ((vtx gsf-vertex :dynamic :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x0 + :flag-assert #x900000000 + ) + +(deftype gsf-fx-vertex-array (structure) + ((data gsf-fx-vertex :dynamic :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x0 + :flag-assert #x900000000 + ) + +(define-extern *gsf-buffer* gsf-buffer) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sky-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype sky-color-hour (structure) ((snapshot1 int32 :offset-assert 0) (snapshot2 int32 :offset-assert 4) @@ -8100,51 +8644,43 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype sky-color-day (structure) - ((hour sky-color-hour 24 :offset-assert 0) ;; guessed by decompiler + ((hour sky-color-hour 24 :inline :offset-assert 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x180 :flag-assert #x900000180 ) -|# -#| (deftype sky-sun-data (structure) ((data uint128 4 :offset-assert 0) ;; guessed by decompiler - (pos vector :inline :offset-assert 0) - (r-sun float :offset-assert 16) - (r-halo float :offset-assert 20) - (r-aurora float :offset-assert 24) - (c-sun-start rgba :offset-assert 32) ;; guessed by decompiler - (c-sun-end rgba :offset-assert 48) ;; guessed by decompiler - (c-halo-start rgba :offset-assert 36) ;; guessed by decompiler - (c-halo-end rgba :offset-assert 52) ;; guessed by decompiler - (c-aurora-start rgba :offset-assert 40) ;; guessed by decompiler - (c-aurora-end rgba :offset-assert 56) ;; guessed by decompiler + (pos vector :inline :offset 0) + (r-sun float :offset 16) + (r-halo float :offset 20) + (r-aurora float :offset 24) + (c-sun-start rgba :offset 32) ;; guessed by decompiler + (c-sun-end rgba :offset 48) ;; guessed by decompiler + (c-halo-start rgba :offset 36) ;; guessed by decompiler + (c-halo-end rgba :offset 52) ;; guessed by decompiler + (c-aurora-start rgba :offset 40) ;; guessed by decompiler + (c-aurora-end rgba :offset 56) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype sky-moon-data (structure) ((data uint128 2 :offset-assert 0) ;; guessed by decompiler - (pos vector :inline :offset-assert 0) - (scale vector :inline :offset-assert 16) + (pos vector :inline :offset 0) + (scale vector :inline :offset 16) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype sky-orbit (structure) ((high-noon float :offset-assert 0) (tilt float :offset-assert 4) @@ -8153,25 +8689,22 @@ (min-halo float :offset-assert 16) (max-halo float :offset-assert 20) ) + :allow-misaligned :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype sky-upload-data (structure) ((data uint128 10 :offset-assert 0) ;; guessed by decompiler - (sun sky-sun-data 2 :offset-assert 0) ;; guessed by decompiler - (moon sky-moon-data :inline :offset-assert 128) + (sun sky-sun-data 2 :inline :offset 0) ;; guessed by decompiler + (moon sky-moon-data :inline :offset 128) ) :method-count-assert 9 :size-assert #xa0 :flag-assert #x9000000a0 ) -|# -#| (deftype sky-vertex (structure) ((pos vector :inline :offset-assert 0) (stq vector :inline :offset-assert 16) @@ -8181,19 +8714,7 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| -(deftype sky-vertex (structure) - () - :method-count-assert 9 - :size-assert #x30 - :flag-assert #x900000030 - ;; Failed to read fields. - ) -|# - -#| (deftype cloud-vertex (structure) ((pos vector :inline :offset-assert 0) (stq vector :inline :offset-assert 16) @@ -8207,19 +8728,15 @@ :size-assert #x70 :flag-assert #x900000070 ) -|# -#| (deftype cloud-vert-array (structure) - ((data UNKNOWN 100 :offset-assert 0) + ((data cloud-vertex 100 :inline :offset-assert 0) ) :method-count-assert 9 :size-assert #x2bc0 :flag-assert #x900002bc0 ) -|# -#| (deftype haze-vertex (structure) ((pos vector :inline :offset-assert 0) (nrm vector :inline :offset-assert 16) @@ -8229,19 +8746,15 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype haze-vert-array (structure) - ((data UNKNOWN 36 :offset-assert 0) + ((data haze-vertex 36 :inline :offset-assert 0) ) :method-count-assert 9 :size-assert #x6c0 :flag-assert #x9000006c0 ) -|# -#| (deftype cloud-lights (structure) ((sun0-normal vector :inline :offset-assert 0) (sun1-normal vector :inline :offset-assert 16) @@ -8260,9 +8773,7 @@ :size-assert #x9c :flag-assert #x90000009c ) -|# -#| (deftype haze-lights (structure) ((sun0-normal vector :inline :offset-assert 0) (sun1-normal vector :inline :offset-assert 16) @@ -8279,9 +8790,7 @@ :size-assert #x7c :flag-assert #x90000007c ) -|# -#| (deftype sky-work (structure) ((adgif-tmpl dma-gif-packet :inline :offset-assert 0) (draw-tmpl dma-gif-packet :inline :offset-assert 32) @@ -8290,28 +8799,28 @@ (blend-tmpl dma-gif-packet :inline :offset-assert 128) (sprite-tmpl dma-gif-packet :inline :offset-assert 160) (sprite-tmpl2 dma-gif-packet :inline :offset-assert 192) - (sun-coords UNKNOWN 2 :offset-assert 224) - (green-coords UNKNOWN 2 :offset-assert 256) - (moon0-coords UNKNOWN 2 :offset-assert 288) - (moon1-coords UNKNOWN 2 :offset-assert 320) - (moon2-coords UNKNOWN 2 :offset-assert 352) - (star-coords UNKNOWN 2 :offset-assert 384) - (sun-colors UNKNOWN 2 :offset-assert 416) - (green-colors UNKNOWN 2 :offset-assert 448) - (moon-colors UNKNOWN 3 :offset-assert 480) - (star-colors UNKNOWN 16 :offset-assert 528) - (st-coords UNKNOWN 2 :offset-assert 784) - (random UNKNOWN 8 :offset-assert 816) + (sun-coords vector 2 :inline :offset-assert 224) + (green-coords vector 2 :inline :offset-assert 256) + (moon0-coords vector 2 :inline :offset-assert 288) + (moon1-coords vector 2 :inline :offset-assert 320) + (moon2-coords vector 2 :inline :offset-assert 352) + (star-coords vector 2 :inline :offset-assert 384) + (sun-colors vector 2 :inline :offset-assert 416) + (green-colors vector 2 :inline :offset-assert 448) + (moon-colors vector 3 :inline :offset-assert 480) + (star-colors vector 16 :inline :offset-assert 528) + (st-coords vector 2 :inline :offset-assert 784) + (random vector 8 :inline :offset-assert 816) (giftag-base dma-gif :inline :offset-assert 944) (giftag-haze dma-gif :inline :offset-assert 960) (giftag-roof dma-gif :inline :offset-assert 976) (giftag-ocean dma-gif :inline :offset-assert 992) (fog vector :inline :offset-assert 1008) - (sky UNKNOWN 8 :offset-assert 1024) + (sky float 8 :offset-assert 1024) (time float :offset-assert 1056) (off-s uint16 :offset-assert 1060) (off-t uint16 :offset-assert 1062) - (orbit UNKNOWN 3 :offset-assert 1064) + (orbit sky-orbit 3 :inline :offset-assert 1064) (upload-data sky-upload-data :inline :offset-assert 1168) (ambi-color vector :inline :offset-assert 1328) (ambi-color-lower vector :inline :offset-assert 1344) @@ -8327,7 +8836,7 @@ (haze-lights haze-lights :inline :offset-assert 1744) (buf basic :offset-assert 1868) (draw-vortex basic :offset-assert 1872) - (stars UNKNOWN 512 :offset-assert 1888) + (stars vector 512 :inline :offset-assert 1888) ) :method-count-assert 37 :size-assert #x2760 @@ -8363,14 +8872,12 @@ (sky-work-method-36 () none 36) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ocean-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype ocean-corner (structure) ((bsphere sphere :inline :offset-assert 0) (start-corner vector :inline :offset-assert 16) @@ -8382,9 +8889,7 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype ocean-wave-info (structure) ((frequency float :offset-assert 0) (amplitude float :offset-assert 4) @@ -8399,9 +8904,7 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype ocean-vertex (structure) ((pos vector :inline :offset-assert 0) (stq vector :inline :offset-assert 16) @@ -8411,19 +8914,15 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype ocean-spheres (structure) - ((spheres sphere 36 :offset-assert 0) ;; guessed by decompiler + ((spheres sphere 36 :inline :offset-assert 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x240 :flag-assert #x900000240 ) -|# -#| (deftype ocean-colors (structure) ((colors rgba 2548 :offset-assert 0) ;; guessed by decompiler ) @@ -8431,30 +8930,25 @@ :size-assert #x27d0 :flag-assert #x9000027d0 ) -|# -#| (deftype ocean-colors-float (structure) - ((colors UNKNOWN 2548 :offset-assert 0) + ((colors vector 2548 :inline :offset-assert 0) ;; guess ) :method-count-assert 9 :size-assert #x9f40 :flag-assert #x900009f40 ) -|# -#| (deftype ocean-mid-mask (structure) ((mask uint8 8 :offset-assert 0) ;; guessed by decompiler - (dword uint64 :offset-assert 0) + (dword uint64 :offset 0) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype ocean-mid-indices (basic) ((data uint16 36 :offset-assert 4) ;; guessed by decompiler ) @@ -8462,9 +8956,7 @@ :size-assert #x4c :flag-assert #x90000004c ) -|# -#| (deftype ocean-mid-masks (basic) ((data (inline-array ocean-mid-mask) :offset-assert 4) ;; guessed by decompiler ) @@ -8472,41 +8964,34 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype ocean-trans-mask (structure) ((mask uint8 4 :offset-assert 0) ;; guessed by decompiler - (word int32 :offset-assert 0) ;; uint64 + (word int32 :offset 0) ;; uint64 ) :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype ocean-trans-index (structure) ((parent int16 :offset-assert 0) (child int16 :offset-assert 2) ) + :pack-me :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype ocean-trans-indices (basic) - ((data ocean-trans-index 2304 :offset-assert 4) ;; guessed by decompiler + ((data ocean-trans-index 2304 :inline :offset-assert 4) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x2404 :flag-assert #x900002404 ) -|# -#| (deftype ocean-near-index (structure) ((data uint16 16 :offset-assert 0) ;; guessed by decompiler ) @@ -8514,9 +8999,7 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype ocean-near-indices (basic) ((data (inline-array ocean-near-index) :offset-assert 4) ;; guessed by decompiler ) @@ -8524,9 +9007,7 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype ocean-near-colors (structure) ((color0 vector :inline :offset-assert 0) (color1 vector :inline :offset-assert 16) @@ -8537,9 +9018,7 @@ :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype ocean-trans-strip (structure) ((verts uint128 10 :offset-assert 0) ;; guessed by decompiler ) @@ -8547,19 +9026,15 @@ :size-assert #xa0 :flag-assert #x9000000a0 ) -|# -#| (deftype ocean-trans-strip-array (structure) - ((data ocean-trans-strip 4 :offset-assert 0) ;; guessed by decompiler + ((data ocean-trans-strip 4 :inline :offset-assert 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x280 :flag-assert #x900000280 ) -|# -#| (deftype ocean-wave-data (structure) ((data uint8 1024 :offset-assert 0) ;; guessed by decompiler ) @@ -8567,22 +9042,18 @@ :size-assert #x400 :flag-assert #x900000400 ) -|# -#| (deftype ocean-wave-frames (structure) - ((frame ocean-wave-data 64 :offset-assert 0) ;; guessed by decompiler + ((frame ocean-wave-data 64 :inline :offset-assert 0) ;; guessed by decompiler ) + ;; overflow 16-bit int size bug :method-count-assert 9 - :size-assert #x0 - :heap-base #x1 - :flag-assert #x900010000 + :size-assert #x10000 + ;:flag-assert #x900010000 ) -|# -#| (deftype ocean-texture-constants (structure) - ((giftag qword :inline :offset-assert 0) ;; gs-gif-tag :inline + ((giftag gs-gif-tag :inline :offset-assert 0) ;; was qword (buffers vector4w :inline :offset-assert 16) (dests vector4w :inline :offset-assert 32) (start vector :inline :offset-assert 48) @@ -8594,9 +9065,7 @@ :size-assert #x70 :flag-assert #x900000070 ) -|# -#| (deftype ocean-mid-vertex (structure) ((stq vector :inline :offset-assert 0) (col vector :inline :offset-assert 16) @@ -8606,9 +9075,8 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| + (deftype ocean-mid-constants (structure) ((hmge-scale vector :inline :offset-assert 0) (inv-hmge-scale vector :inline :offset-assert 16) @@ -8616,17 +9084,17 @@ (fog vector :inline :offset-assert 48) (constants vector :inline :offset-assert 64) (constants2 vector :inline :offset-assert 80) - (drw-fan qword :inline :offset-assert 96) ;; gs-gif-tag :inline - (env-fan qword :inline :offset-assert 112) ;; gs-gif-tag :inline - (drw-adgif qword :inline :offset-assert 128) ;; gs-gif-tag :inline + (drw-fan gs-gif-tag :inline :offset-assert 96) ;; gs-gif-tag :inline + (env-fan gs-gif-tag :inline :offset-assert 112) ;; gs-gif-tag :inline + (drw-adgif gs-gif-tag :inline :offset-assert 128) ;; gs-gif-tag :inline (drw-texture adgif-shader :inline :offset-assert 144) - (drw-strip-0 qword :inline :offset-assert 224) ;; gs-gif-tag :inline - (drw-strip-1 qword :inline :offset-assert 240) ;; gs-gif-tag :inline - (env-adgif qword :inline :offset-assert 256) ;; gs-gif-tag :inline + (drw-strip-0 gs-gif-tag :inline :offset-assert 224) ;; gs-gif-tag :inline + (drw-strip-1 gs-gif-tag :inline :offset-assert 240) ;; gs-gif-tag :inline + (env-adgif gs-gif-tag :inline :offset-assert 256) ;; gs-gif-tag :inline (env-texture adgif-shader :inline :offset-assert 272) - (env-strip qword :inline :offset-assert 352) ;; gs-gif-tag :inline + (env-strip gs-gif-tag :inline :offset-assert 352) ;; gs-gif-tag :inline (env-color vector :inline :offset-assert 368) - (index-table vector4w 8 :offset-assert 384) ;; guessed by decompiler + (index-table vector4w 8 :inline :offset-assert 384) ;; guessed by decompiler (pos0 vector :inline :offset-assert 512) (pos1 vector :inline :offset-assert 528) (pos2 vector :inline :offset-assert 544) @@ -8636,9 +9104,8 @@ :size-assert #x240 :flag-assert #x900000240 ) -|# -#| + (deftype ocean-mid-upload (structure) ((rot matrix :inline :offset-assert 0) (matrix matrix :inline :offset-assert 64) @@ -8649,9 +9116,7 @@ :size-assert #x760 :flag-assert #x900000760 ) -|# -#| (deftype ocean-mid-upload2 (structure) ((rot matrix :inline :offset-assert 0) (matrix matrix :inline :offset-assert 64) @@ -8670,9 +9135,7 @@ :size-assert #x230 :flag-assert #x900000230 ) -|# -#| (deftype ocean-mid-work (structure) ((env0 vector :inline :offset-assert 0) (env1 vector :inline :offset-assert 16) @@ -8686,9 +9149,7 @@ :size-assert #x160 :flag-assert #x900000160 ) -|# -#| (deftype ocean-near-constants (structure) ((hmge-scale vector :inline :offset-assert 0) (inv-hmge-scale vector :inline :offset-assert 16) @@ -8699,31 +9160,29 @@ (constants3 vector :inline :offset-assert 96) (constants4 vector :inline :offset-assert 112) (constants5 vector :inline :offset-assert 128) - (drw-fan qword :inline :offset-assert 144) ;; gs-gif-tag :inline - (drw2-fan qword :inline :offset-assert 160) ;; gs-gif-tag :inline - (env-fan qword :inline :offset-assert 176) ;; gs-gif-tag :inline - (drw-adgif qword :inline :offset-assert 192) ;; gs-gif-tag :inline + (drw-fan gs-gif-tag :inline :offset-assert 144) ;; gs-gif-tag :inline + (drw2-fan gs-gif-tag :inline :offset-assert 160) ;; gs-gif-tag :inline + (env-fan gs-gif-tag :inline :offset-assert 176) ;; gs-gif-tag :inline + (drw-adgif gs-gif-tag :inline :offset-assert 192) ;; gs-gif-tag :inline (drw-texture adgif-shader :inline :offset-assert 208) - (drw-strip qword :inline :offset-assert 288) ;; gs-gif-tag :inline - (env-adgif qword :inline :offset-assert 304) ;; gs-gif-tag :inline + (drw-strip gs-gif-tag :inline :offset-assert 288) ;; gs-gif-tag :inline + (env-adgif gs-gif-tag :inline :offset-assert 304) ;; gs-gif-tag :inline (env-texture adgif-shader :inline :offset-assert 320) - (env-strip qword :inline :offset-assert 400) ;; gs-gif-tag :inline + (env-strip gs-gif-tag :inline :offset-assert 400) ;; gs-gif-tag :inline (env-color vector :inline :offset-assert 416) - (drw2-adgif qword :inline :offset-assert 432) ;; gs-gif-tag :inline + (drw2-adgif gs-gif-tag :inline :offset-assert 432) ;; gs-gif-tag :inline (drw2-tex0 qword :inline :offset-assert 448) (drw2-frame qword :inline :offset-assert 464) - (drw2-strip qword :inline :offset-assert 480) ;; gs-gif-tag :inline - (drw3-adgif qword :inline :offset-assert 496) ;; gs-gif-tag :inline + (drw2-strip gs-gif-tag :inline :offset-assert 480) ;; gs-gif-tag :inline + (drw3-adgif gs-gif-tag :inline :offset-assert 496) ;; gs-gif-tag :inline (drw3-frame qword :inline :offset-assert 512) - (index-table vector4w 4 :offset-assert 528) ;; guessed by decompiler + (index-table vector4w 4 :inline :offset-assert 528) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x250 :flag-assert #x900000250 ) -|# -#| (deftype ocean-near-upload (structure) ((rot matrix :inline :offset-assert 0) (matrix matrix :inline :offset-assert 64) @@ -8736,9 +9195,7 @@ :size-assert #x100 :flag-assert #x900000100 ) -|# -#| (deftype ocean-near-vertex (structure) ((stq vector :inline :offset-assert 0) (clr vector :inline :offset-assert 16) @@ -8748,9 +9205,7 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype ocean-near-work (structure) ((verts-ptr vector :inline :offset-assert 0) (indices uint128 16 :offset-assert 16) ;; guessed by decompiler @@ -8759,29 +9214,23 @@ :size-assert #x110 :flag-assert #x900000110 ) -|# -#| (deftype ocean-height-array (structure) - ((data UNKNOWN 1024 :offset-assert 0) + ((data float 1024 :offset-assert 0) ;; guess ) :method-count-assert 9 :size-assert #x1000 :flag-assert #x900001000 ) -|# -#| (deftype ocean-vert-array (structure) - ((data UNKNOWN 2048 :offset-assert 0) + ((data vector 2048 :inline :offset-assert 0);; guess ) :method-count-assert 9 :size-assert #x8000 :flag-assert #x900008000 ) -|# -#| (deftype ocean-map (structure) ((start-corner vector :inline :offset-assert 0) (far-color vector :inline :offset-assert 16) @@ -8800,9 +9249,7 @@ (ocean-map-method-10 () none 10) ) ) -|# -#| (deftype ocean (ocean-map) ((off basic :offset-assert 56) (near-off basic :offset-assert 60) @@ -8817,14 +9264,14 @@ (map-min vector :inline :offset-assert 112) (map-max vector :inline :offset-assert 128) (interp vector :inline :offset-assert 144) - (corner-array UNKNOWN 25 :offset-assert 160) + (corner-array ocean-corner 25 :inline :offset-assert 160) (corner-count int32 :offset-assert 2160) - (temp-vecs UNKNOWN 4 :offset-assert 2176) - (mid-mask-ptrs UNKNOWN 36 :offset-assert 2240) - (mid-camera-masks UNKNOWN 36 :offset-assert 2384) - (trans-mask-ptrs UNKNOWN 64 :offset-assert 2672) - (trans-camera-masks UNKNOWN 16 :offset-assert 2928) - (trans-temp-masks UNKNOWN 16 :offset-assert 2992) + (temp-vecs vector 4 :inline :offset-assert 2176) + (mid-mask-ptrs pointer 36 :offset-assert 2240) + (mid-camera-masks uint64 36 :offset-assert 2384) + (trans-mask-ptrs pointer 64 :offset-assert 2672) + (trans-camera-masks uint32 16 :offset-assert 2928) + (trans-temp-masks uint32 16 :offset-assert 2992) (sprite-tmpl dma-gif-packet :inline :offset-assert 3056) (sprite-tmpl2 dma-gif-packet :inline :offset-assert 3088) (sprite-tmpl3 dma-gif-packet :inline :offset-assert 3120) @@ -8839,13 +9286,13 @@ (haze-lights haze-lights :inline :offset-assert 3536) (constant vector :inline :offset-assert 3664) (sky-color vector :inline :offset-assert 3680) - (haze-verts UNKNOWN 32 :offset-assert 3696) - (cloud-verts UNKNOWN 36 :offset-assert 4208) - (cloud-nrms UNKNOWN 36 :offset-assert 4784) - (cloud-col0 UNKNOWN 36 :offset-assert 5360) - (cloud-col1 UNKNOWN 36 :offset-assert 5936) - (cloud-st0 UNKNOWN 36 :offset-assert 6512) - (cloud-st1 UNKNOWN 36 :offset-assert 7088) + (haze-verts vector4w 32 :inline :offset-assert 3696) + (cloud-verts vector4w 36 :inline :offset-assert 4208) + (cloud-nrms vector 36 :inline :offset-assert 4784) + (cloud-col0 vector 36 :inline :offset-assert 5360) + (cloud-col1 vector 36 :inline :offset-assert 5936) + (cloud-st0 vector 36 :inline :offset-assert 6512) + (cloud-st1 vector 36 :inline :offset-assert 7088) (color80808080 vector4w :inline :offset-assert 7664) (color80808040 vector4w :inline :offset-assert 7680) (color80808000 vector4w :inline :offset-assert 7696) @@ -8865,8 +9312,8 @@ (xy2020 vector4w :inline :offset-assert 7920) (xy4040 vector4w :inline :offset-assert 7936) (xy8080 vector4w :inline :offset-assert 7952) - (cloud-alpha UNKNOWN 36 :offset-assert 7968) - (near-mask-indices UNKNOWN 16 :offset-assert 8004) + (cloud-alpha uint8 36 :offset-assert 7968) + (near-mask-indices uint16 16 :offset-assert 8004) (mid-minx uint8 :offset-assert 8036) (mid-maxx uint8 :offset-assert 8037) (mid-minz uint8 :offset-assert 8038) @@ -8889,7 +9336,7 @@ (frame-speed float :offset-assert 8084) (frame-num2 float :offset-assert 8088) (frame-speed2 float :offset-assert 8092) - (cloud-interp float :offset-assert 3676) + (cloud-interp float :offset 3676) (scales vector :inline :offset-assert 8096) (mask-hi vector4w :inline :offset-assert 8112) (mask-lo vector4w :inline :offset-assert 8128) @@ -8986,58 +9433,56 @@ (ocean-method-91 () none 91) ) ) -|# -;; (define-extern *ocean-map* object) ;; ocean-map -;; (define-extern *ocean* object) +(define-extern *ocean-map* ocean-map) +(define-extern *ocean* ocean) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ocean-trans-tables ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *ocean-left-table* object) ;; (pointer float) -;; (define-extern *ocean-right-table* object) ;; (pointer float) -;; (define-extern *ocean-up-table* object) ;; (pointer float) -;; (define-extern *ocean-down-table* object) ;; (pointer float) -;; (define-extern *ocean-down-left-table* object) ;; (pointer float) -;; (define-extern *ocean-down-right-table* object) ;; (pointer float) -;; (define-extern *ocean-up-right-table* object) ;; (pointer float) -;; (define-extern *ocean-up-left-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-left-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-right-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-up-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-down-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-down-left-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-down-right-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-up-right-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-up-left-table* object) ;; (pointer float) -;; (define-extern *ocean-trans-corner-table* object) ;; (inline-array vector4w-2) -;; (define-extern *ocean-trans-strip-array* object) ;; (pointer float) -;; (define-extern *ocean-trans-st-table* object) ;; (inline-array vector) +(define-extern *ocean-left-table* (pointer float)) +(define-extern *ocean-right-table* (pointer float)) +(define-extern *ocean-up-table* (pointer float)) +(define-extern *ocean-down-table* (pointer float)) +(define-extern *ocean-down-left-table* (pointer float)) +(define-extern *ocean-down-right-table* (pointer float)) +(define-extern *ocean-up-right-table* (pointer float)) +(define-extern *ocean-up-left-table* (pointer float)) +(define-extern *ocean-trans-left-table* (pointer float)) +(define-extern *ocean-trans-right-table* (pointer float)) +(define-extern *ocean-trans-up-table* (pointer float)) +(define-extern *ocean-trans-down-table* (pointer float)) +(define-extern *ocean-trans-down-left-table* (pointer float)) +(define-extern *ocean-trans-down-right-table* (pointer float)) +(define-extern *ocean-trans-up-right-table* (pointer float)) +(define-extern *ocean-trans-up-left-table* (pointer float)) +(define-extern *ocean-trans-corner-table* (inline-array vector4w-2)) +(define-extern *ocean-trans-strip-array* (pointer float)) +(define-extern *ocean-trans-st-table* (inline-array vector)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ocean-tables ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *ocean-spheres-city* object) -;; (define-extern *ocean-colors-city* object) -;; (define-extern *ocean-near-indices-city* ocean-near-indices) -;; (define-extern *ocean-trans-indices-city* ocean-trans-indices) -;; (define-extern *ocean-mid-indices-city* ocean-mid-indices) -;; (define-extern *ocean-mid-masks-city* ocean-mid-masks) -;; (define-extern *ocean-map-city* object) +(define-extern *ocean-spheres-city* ocean-spheres) +(define-extern *ocean-colors-city* ocean-colors) +(define-extern *ocean-near-indices-city* ocean-near-indices) +(define-extern *ocean-trans-indices-city* ocean-trans-indices) +(define-extern *ocean-mid-indices-city* ocean-mid-indices) +(define-extern *ocean-mid-masks-city* ocean-mid-masks) +(define-extern *ocean-map-city* ocean-map) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ocean-frames ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *ocean-wave-frames* object) ;; (pointer uint32) +(define-extern *ocean-wave-frames* (pointer uint32)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; time-of-day-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype palette-fade-control (structure) ((trans vector :inline :offset-assert 0) (fade float :offset-assert 16) @@ -9047,11 +9492,9 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype palette-fade-controls (basic) - ((control palette-fade-control 8 :offset-assert 16) ;; guessed by decompiler + ((control palette-fade-control 8 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 11 :size-assert #x110 @@ -9061,41 +9504,31 @@ (palette-fade-controls-method-10 () none 10) ;; (set-fade! (_type_ int float float vector) object 10) ) ) -|# -#| +(declare-type sparticle-launch-control inline-array-class) (deftype time-of-day-proc (process) - ((hours int32 :offset-assert 124) - (minutes int32 :offset-assert 128) - (seconds int32 :offset-assert 132) - (old-frame uint64 :offset-assert 140) - (current-frame uint64 :offset-assert 148) - (frames uint64 :offset-assert 156) - (time-of-day float :offset-assert 164) - (time-ratio float :offset-assert 168) - (dest-time-ratio float :offset-assert 172) - (dest-time-delta float :offset-assert 176) - (sun-count int32 :offset-assert 180) - (sun sparticle-launch-control :offset-assert 184) ;; guessed by decompiler - (green-sun-count int32 :offset-assert 188) - (green-sun sparticle-launch-control :offset-assert 192) ;; guessed by decompiler - (moon-count int32 :offset-assert 196) - (moon sparticle-launch-control :offset-assert 200) ;; guessed by decompiler + ((hours int32 :offset-assert 128) + (minutes int32 :offset-assert 132) + (seconds int32 :offset-assert 136) + (old-frame uint64 :offset-assert 144) + (current-frame uint64 :offset-assert 152) + (frames uint64 :offset-assert 160) + (time-of-day float :offset-assert 168) + (time-ratio float :offset-assert 172) + (dest-time-ratio float :offset-assert 176) + (dest-time-delta float :offset-assert 180) + (sun-count int32 :offset-assert 184) + (sun sparticle-launch-control :offset-assert 188) ;; guessed by decompiler + (green-sun-count int32 :offset-assert 192) + (green-sun sparticle-launch-control :offset-assert 196) ;; guessed by decompiler + (moon-count int32 :offset-assert 200) + (moon sparticle-launch-control :offset-assert 204) ;; guessed by decompiler ) :method-count-assert 14 :size-assert #xd0 :flag-assert #xe005000d0 - (:methods - (time-of-day-proc-method-9 () none 9) - (time-of-day-proc-method-10 () none 10) - (time-of-day-proc-method-11 () none 11) - (time-of-day-proc-method-12 () none 12) - (time-of-day-proc-method-13 () none 13) - ) ) -|# -#| (deftype time-of-day-palette (basic) ((width int32 :offset-assert 4) (height int32 :offset-assert 8) @@ -9106,9 +9539,8 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| + (deftype time-of-day-context (basic) ((interp float 6 :offset-assert 4) ;; guessed by decompiler (current-fog mood-fog :inline :offset-assert 32) @@ -9116,9 +9548,9 @@ (current-env-color vector :inline :offset-assert 96) (current-prt-color vector :inline :offset-assert 112) (current-shadow-color vector :inline :offset-assert 128) - (light-group light-group 8 :offset-assert 144) ;; guessed by decompiler + (light-group light-group 8 :inline :offset-assert 144) ;; guessed by decompiler (current-clouds mood-clouds :inline :offset-assert 1680) - (times UNKNOWN 8 :offset-assert 1696) + (times vector 8 :inline :offset-assert 1696) ;; might be vector4w? (title-light-group light-group :inline :offset-assert 1824) (filter vector :inline :offset-assert 2016) (filter-color vector :inline :offset-assert 2032) @@ -9140,9 +9572,8 @@ :size-assert #x834 :flag-assert #x900000834 ) -|# -#| + (deftype time-of-day-dma (structure) ((outa uint32 256 :offset-assert 0) ;; guessed by decompiler (outb uint32 256 :offset-assert 1024) ;; guessed by decompiler @@ -9153,16 +9584,14 @@ :size-assert #x1000 :flag-assert #x900001000 ) -|# -;; (define-extern *palette-fade-controls* object) ;; palette-fade-controls -;; (define-extern *time-of-day-context* time-of-day-context) ;; time-of-day-context +(define-extern *palette-fade-controls* palette-fade-controls) ;; palette-fade-controls +(define-extern *time-of-day-context* time-of-day-context) ;; time-of-day-context ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; art-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype joint-anim (basic) ((name string :offset-assert 4) ;; guessed by decompiler (number int16 :offset-assert 8) @@ -9172,24 +9601,20 @@ :size-assert #xc :flag-assert #x90000000c ) -|# -;; (deftype joint-anim-matrix (joint-anim) -;; () -;; :flag-assert #x900000010 -;; ) +(deftype joint-anim-matrix (joint-anim) + ((data matrix :inline :dynamic :offset 16)) + :flag-assert #x900000010 + ) -#| (deftype joint-anim-transformq (joint-anim) - () + ((data transformq :inline :dynamic :offset 16) + ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 - ;; Failed to read fields. ) -|# -#| (deftype joint-anim-drawable (joint-anim) ((data drawable :dynamic :offset-assert 12) ;; guessed by decompiler ) @@ -9197,20 +9622,19 @@ :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype joint-anim-frame (structure) - ((matrices matrix 2 :offset-assert 0) ;; guessed by decompiler - (data matrix :dynamic :offset-assert 128) ;; guessed by decompiler + ((matrices matrix 2 :inline :offset-assert 0) ;; guessed by decompiler + (data matrix :dynamic :offset-assert 128) ;; guessed by decompiler ) + (:methods + (new (symbol type int) _type_ 0) + ) :method-count-assert 9 :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype joint-anim-compressed-hdr (structure) ((control-bits uint32 14 :offset-assert 0) ;; guessed by decompiler (num-joints uint32 :offset-assert 56) @@ -9220,38 +9644,32 @@ :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype joint-anim-compressed-fixed (structure) ((hdr joint-anim-compressed-hdr :inline :offset-assert 0) (offset-64 uint32 :offset-assert 64) (offset-32 uint32 :offset-assert 68) (offset-16 uint32 :offset-assert 72) (reserved uint32 :offset-assert 76) - (data vector 133 :offset-assert 80) ;; guessed by decompiler + (data vector 133 :inline :offset-assert 80) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x8a0 :flag-assert #x9000008a0 ) -|# -#| (deftype joint-anim-compressed-frame (structure) ((offset-64 uint32 :offset-assert 0) (offset-32 uint32 :offset-assert 4) (offset-16 uint32 :offset-assert 8) (reserved uint32 :offset-assert 12) - (data vector 133 :offset-assert 16) ;; guessed by decompiler + (data vector 133 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x860 :flag-assert #x900000860 ) -|# -#| (deftype joint-anim-compressed-control (structure) ((num-frames uint16 :offset-assert 0) ;; uint32 (flags uint16 :offset-assert 2) @@ -9264,11 +9682,9 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype art (basic) - ((name string :offset-assert 8) ;; guessed by decompiler + ((name string :offset 8) ;; guessed by decompiler (length int32 :offset-assert 12) (extra res-lump :offset-assert 16) ;; guessed by decompiler ) @@ -9282,30 +9698,26 @@ (art-method-12 () none 12) ;; (needs-link? (_type_) symbol 12) ) ) -|# -#| + (deftype art-element (art) - () + ((pad uint8 12)) :method-count-assert 13 :size-assert #x20 :flag-assert #xd00000020 - (:methods - ) ) -|# -;; (deftype art-mesh-anim (art-element) -;; () -;; :flag-assert #xd00000020 -;; ) -#| +(deftype art-mesh-anim (art-element) + () + :flag-assert #xd00000020 + ) + (deftype art-joint-anim (art-element) - ((speed float :offset-assert 20) - (artist-base float :offset-assert 24) - (artist-step float :offset-assert 28) - (eye-anim basic :offset-assert 4) + ((speed float :offset 20) + (artist-base float :offset 24) + (artist-step float :offset 28) + (eye-anim basic :offset 4) (master-art-group-name string :offset-assert 32) ;; guessed by decompiler (master-art-group-index int32 :offset-assert 36) (blend-shape-anim basic :offset-assert 40) @@ -9318,11 +9730,11 @@ (:methods ) ) -|# -#| (deftype art-group (art) - () + ((info file-info :offset 4) + (data art-element :dynamic :offset 32) ;; might just be art? + ) :method-count-assert 15 :size-assert #x20 :flag-assert #xf00000020 @@ -9332,19 +9744,17 @@ (art-group-method-14 () none 14) ;; (unlink-art! (_type_) int 14) ) ) -|# -;; (deftype art-mesh-geo (art-element) -;; () -;; :flag-assert #xd00000020 -;; ) +(deftype art-mesh-geo (art-element) + () + :flag-assert #xd00000020 + ) -;; (deftype art-joint-geo (art-element) -;; () -;; :flag-assert #xd00000020 -;; ) +(deftype art-joint-geo (art-element) + () + :flag-assert #xd00000020 + ) -#| (deftype art-joint-anim-manager-slot (structure) ((anim basic :offset-assert 0) (comp-data uint32 :offset-assert 4) @@ -9354,37 +9764,33 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| + (deftype art-joint-anim-manager (basic) - () + ((kheap kheap :inline) + (free-index int32) + (slot art-joint-anim-manager-slot 64 :inline) + ) :method-count-assert 14 :size-assert #x430 :flag-assert #xe00000430 ;; Failed to read fields. (:methods + (new (symbol type int) _type_ 0) (art-joint-anim-manager-method-9 () none 9) (art-joint-anim-manager-method-10 () none 10) - (art-joint-anim-manager-method-11 () none 11) + (unload-from-slot (_type_ int) none 11) (art-joint-anim-manager-method-12 () none 12) - (art-joint-anim-manager-method-13 () none 13) + (unload-from-level (_type_ level) none 13) ) ) -|# -#| (deftype skeleton-group (art-group) - ((name basic :offset-assert 8) - (length int32 :offset-assert 12) - (extra basic :offset-assert 16) - (info basic :offset-assert 4) - (data UNKNOWN :dynamic :offset-assert 32) - (art-group-name string :offset-assert 32) ;; guessed by decompiler + ((art-group-name string :offset-assert 32) ;; guessed by decompiler (jgeo int32 :offset-assert 36) (janim int32 :offset-assert 40) (bounds vector :inline :offset-assert 48) - (radius meters :offset-assert 60) + (radius meters :offset 60) (mgeo int16 6 :offset-assert 64) ;; guessed by decompiler (max-lod int32 :offset-assert 76) (lod-dist float 6 :offset-assert 80) ;; guessed by decompiler @@ -9396,6 +9802,7 @@ (origin-joint-index int8 :offset-assert 112) (shadow-joint-index int8 :offset-assert 113) (light-index uint8 :offset-assert 114) + (pad uint8) ;; ? ) :method-count-assert 16 :size-assert #x74 @@ -9404,22 +9811,20 @@ (skeleton-group-method-15 () none 15) ) ) -|# -#| +(declare-type merc-ctrl art-element) (deftype lod-group (structure) ((geo merc-ctrl :offset-assert 0) ;; guessed by decompiler (dist meters :offset-assert 4) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype lod-set (structure) - ((lod lod-group 6 :offset-assert 0) ;; guessed by decompiler + ((lod lod-group 6 :inline :offset-assert 0) ;; guessed by decompiler (max-lod int8 :offset-assert 48) ) :method-count-assert 10 @@ -9429,18 +9834,95 @@ (lod-set-method-9 () none 9) ;; (setup-lods! (_type_ skeleton-group art-group entity) _type_ 9) ) ) -|# -#| +(defenum draw-control-status + :type uint16 + :bitfield #t + (close-to-screen 0) ;; 1 + (no-draw 1) ;; 2 + (no-draw-temp 2) ;; 4 + (on-screen 3) ;; 8 + (uninited 4) ;; 16 + (no-draw-bounds 5) ;; 32 + (no-closest-distance 6) ;; 64 + (math-skel 7) ;; 128 + (force-vu1 8) ;; 256 + (no-draw-bounds2 9) ;; 512 + (force-fade 10) ;; 1024 + (warp-cross-fade 11) ;; 2048 + (lod-set 12) ;; 4096 + (disable-fog 13) ;; 8192 + (hud 14) ;; 16384 + ) + +(defenum draw-control-data-format + :type uint8 + :bitfield #f + (pris 0) + (merc 1) + ) + +(defenum draw-control-global-effect + :type uint8 + :bitfield #t + (bit-0 0) + (bit-1 1) ;; 2 + (title-light 2) ;; 4 + (disable-envmap 3) ;; 8 + ) + +(declare-type ripple-control basic) +(declare-type shadow-control basic) + (deftype draw-control (basic) - () + ((process process :offset-assert 4) + (status draw-control-status) + (data-format draw-control-data-format) + (global-effect draw-control-global-effect) + (art-group art-group :offset-assert 12) + (jgeo art-joint-geo) + (mgeo merc-ctrl) + (dma-add-func function) ;; (function process-drawable draw-control symbol object none) + (skeleton skeleton) + (lod-set lod-set :inline) + (max-lod int8 :offset 80) + (force-lod int8) + (cur-lod int8) + (desired-lod int8) + (ripple ripple-control) + (longest-edge meters :offset-assert 88) + (longest-edge? uint32 :offset 88) + (light-index uint8) + (shadow-mask uint8) + (level-index uint8) + (death-draw-overlap uint8 :offset-assert 95) + (death-timer uint8) + (death-timer-org uint8) + (death-vertex-skip uint16) + (death-effect uint32) + (shadow uint32) + (shadow-ctrl shadow-control :offset-assert 108) + (distance meters) + (origin vector :inline) + (bounds vector :inline) + (radius meters :offset 156) + (color-mult rgbaf :inline) + (color-emissive rgbaf :inline) + (effect-mask uint64) + (seg-mask uint64) + (origin-joint-index uint8) + (shadow-joint-index uint8) + (force-fade uint8) + (default-texture-page uint8) + (shadow-values uint32) + ) :method-count-assert 15 :size-assert #xd8 :flag-assert #xf000000d8 ;; Failed to read fields. (:methods ;; (new (symbol type process art-joint-geo) _type_ 0) - (draw-control-method-9 () none 9) ;; (get-skeleton-origin (_type_) vector 9) + (get-skeleton-origin (_type_) vector 9) (draw-control-method-10 () none 10) ;; (lod-set! (_type_ int) none 10) (draw-control-method-11 () none 11) ;; (lods-assign! (_type_ lod-set) none 11) (draw-control-method-12 () none 12) @@ -9448,28 +9930,24 @@ (draw-control-method-14 () none 14) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-vu1-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype pris-mtx (structure) ((data float 32 :offset-assert 0) ;; guessed by decompiler - (vector vector 8 :offset-assert 0) ;; guessed by decompiler - (t-mtx matrix :inline :offset-assert 0) - (n-mtx matrix3 :inline :offset-assert 64) - (scale vector :inline :offset-assert 112) + (vector vector 8 :offset 0) ;; guessed by decompiler + (t-mtx matrix :inline :offset 0) + (n-mtx matrix3 :inline :offset 64) + (scale vector :inline :offset 112) ) :method-count-assert 9 :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype generic-pris-mtx-save (structure) ((loc-mtx pris-mtx :inline :offset-assert 0) (par-mtx pris-mtx :inline :offset-assert 128) @@ -9479,12 +9957,10 @@ :size-assert #x180 :flag-assert #x900000180 ) -|# -#| (deftype generic-constants (structure) ((fog vector :inline :offset-assert 0) - (adgif qword :inline :offset-assert 16) ;; gs-gif-tag :inline + (adgif gs-gif-tag :inline :offset-assert 16) ;; was qword (hvdf-offset vector :inline :offset-assert 32) (hmge-scale vector :inline :offset-assert 48) (invh-scale vector :inline :offset-assert 64) @@ -9496,9 +9972,7 @@ :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype generic-shrub-constants (structure) ((shrub-giftag generic-gif-tag :inline :offset-assert 0) (shrub-adnop qword :inline :offset-assert 16) @@ -9507,38 +9981,32 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype gcf-shader (structure) - ((adgif UNKNOWN 5 :offset-assert 0) - (shader adgif-shader :inline :offset-assert 0) - (pos uint32 :offset-assert 12) - (num uint32 :offset-assert 28) + ((adgif uint128 5 :offset-assert 0) ;; guess + (shader adgif-shader :inline :offset 0) + (pos uint32 :offset 12) + (num uint32 :offset 28) ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype gcf-control (structure) ((matrix matrix :inline :offset-assert 0) (giftag generic-gif-tag :inline :offset-assert 64) - (adnops UNKNOWN 2 :offset-assert 80) - (num-strips uint32 :offset-assert 76) - (num-dps uint32 :offset-assert 92) - (kick-offset uint32 :offset-assert 108) - (shader UNKNOWN :dynamic :offset-assert 112) + (adnops uint32 2 :offset-assert 80) ;; guess + (num-strips uint32 :offset 76) + (num-dps uint32 :offset 92) + (kick-offset uint32 :offset 108) + (shader gcf-shader :inline :dynamic :offset-assert 112) ;; guess ) :method-count-assert 9 :size-assert #x70 :flag-assert #x900000070 ) -|# -#| (deftype gcf-vertex (structure) ((tex vector4w :inline :offset-assert 0) (clr gs-packed-rgba :inline :offset-assert 16) @@ -9548,30 +10016,23 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; merc-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype ripple-merc-query (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (start-vertex int32 :offset-assert 16) + ((start-vertex int32 :offset-assert 16) (vertex-skip int32 :offset-assert 20) (vertex-count int32 :offset-assert 24) (current-loc int32 :offset-assert 28) - (data vector :dynamic :offset-assert 32) ;; guessed by decompiler + (data vector :inline :dynamic :offset-assert 32) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype merc-byte-header (structure) ((srcdest-off uint8 :offset-assert 0) (rgba-off uint8 :offset-assert 1) @@ -9592,9 +10053,7 @@ :size-assert #x17 :flag-assert #x900000017 ) -|# -#| (deftype merc-fragment (structure) ((header merc-byte-header :inline :offset-assert 0) (rest uint8 1 :offset-assert 23) ;; guessed by decompiler @@ -9603,12 +10062,10 @@ :size-assert #x18 :flag-assert #xa00000018 (:methods - (merc-fragment-method-9 () none 9) ;; (login-adgifs (_type_) none 9) + (login-adgifs (_type_) none 9) ) ) -|# -#| (deftype merc-vtx (structure) ((mat-0 uint8 :offset-assert 0) (mat-1 uint8 :offset-assert 1) @@ -9627,9 +10084,7 @@ :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype merc-fp-header (structure) ((x-add float :offset-assert 0) (y-add float :offset-assert 4) @@ -9643,44 +10098,34 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype merc-mat-dest (structure) ((matrix-number uint8 :offset-assert 0) (matrix-dest uint8 :offset-assert 1) ) + :pack-me :method-count-assert 9 :size-assert #x2 :flag-assert #x900000002 ) -|# -#| (deftype merc-fragment-control (structure) ((unsigned-four-count uint8 :offset-assert 0) (lump-four-count uint8 :offset-assert 1) (fp-qwc uint8 :offset-assert 2) (mat-xfer-count uint8 :offset-assert 3) - (mat-dest-data merc-mat-dest :dynamic :offset-assert 4) ;; guessed by decompiler + (mat-dest-data merc-mat-dest :inline :dynamic :offset-assert 4) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ) -|# -#| -(deftype merc-blend-data (UNKNOWN) - ((int8-data int8 :dynamic :offset-assert 0) ;; guessed by decompiler +(deftype merc-blend-data (structure) ;; was unknown! + ((int8-data int8 :dynamic :offset-assert 0) ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 ) -|# -#| (deftype merc-blend-ctrl (structure) ((blend-vtx-count uint8 :offset-assert 0) (nonzero-index-count uint8 :offset-assert 1) @@ -9690,9 +10135,7 @@ :size-assert #x2 :flag-assert #x900000002 ) -|# -#| (deftype mei-envmap-tint (structure) ((fade0 float :offset-assert 0) (fade1 float :offset-assert 4) @@ -9703,9 +10146,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype mei-texture-scroll (structure) ((max-dist float :offset-assert 0) (st-int-scale uint8 :offset-assert 4) @@ -9719,9 +10160,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype mei-ripple (structure) ((x-base float :offset-assert 0) (z-base float :offset-assert 4) @@ -9732,9 +10171,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype merc-extra-info (structure) ((envmap-tint-offset uint8 :offset-assert 0) (shader-offset uint8 :offset-assert 1) @@ -9746,9 +10183,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype merc-effect (structure) ((frag-geo merc-fragment :offset-assert 0) (frag-ctrl merc-fragment-control :offset-assert 4) @@ -9768,68 +10203,59 @@ :size-assert #x20 :flag-assert #xa00000020 (:methods - (merc-effect-method-9 () none 9) ;; (login-adgifs (_type_) none 9) + (login-adgifs (_type_) none 9) ) ) -|# -#| (deftype merc-eye-ctrl (structure) ((eye-slot int8 :offset-assert 0) (shader-offset int8 :offset-assert 1) (shader-count int8 :offset-assert 2) - (shader adgif-shader 6 :offset-assert 16) ;; guessed by decompiler - (left-iris-shader adgif-shader :inline :offset-assert 16) - (left-pupil-shader adgif-shader :inline :offset-assert 96) - (left-lid-shader adgif-shader :inline :offset-assert 176) - (right-iris-shader adgif-shader :inline :offset-assert 256) - (right-pupil-shader adgif-shader :inline :offset-assert 336) - (right-lid-shader adgif-shader :inline :offset-assert 416) + (shader adgif-shader 6 :inline :offset-assert 16 :score -1) ;; guessed by decompiler + (left-iris-shader adgif-shader :inline :offset 16) + (left-pupil-shader adgif-shader :inline :offset 96) + (left-lid-shader adgif-shader :inline :offset 176) + (right-iris-shader adgif-shader :inline :offset 256) + (right-pupil-shader adgif-shader :inline :offset 336) + (right-lid-shader adgif-shader :inline :offset 416) ) :method-count-assert 9 :size-assert #x1f0 :flag-assert #x9000001f0 ) -|# -#| (deftype merc-eye-anim-frame (structure) ((pupil-trans-x int8 :offset-assert 0) (pupil-trans-y int8 :offset-assert 1) (blink int8 :offset-assert 2) - (iris-scale int8 :offset-assert 4) - (pupil-scale int8 :offset-assert 5) - (lid-scale int8 :offset-assert 6) - (dword uint64 :offset-assert 0) + (iris-scale int8 :offset 4) + (pupil-scale int8 :offset 5) + (lid-scale int8 :offset 6) + (dword uint64 :offset 0) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype merc-eye-anim-block (structure) ((max-frame int16 :offset-assert 0) - (data merc-eye-anim-frame :dynamic :offset-assert 8) ;; guessed by decompiler + (data merc-eye-anim-frame :inline :dynamic :offset-assert 8) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype texture-usage-group (structure) - ((data UNKNOWN 7 :offset-assert 0) + ((data texture-masks 7 :inline :offset-assert 0) ;; total guess here ) :method-count-assert 9 :size-assert #x150 :flag-assert #x900000150 ) -|# -#| (deftype merc-ctrl-header (structure) ((xyz-scale float :offset-assert 0) (st-magic uint32 :offset-assert 4) @@ -9858,40 +10284,38 @@ (num-verts uint16 :offset-assert 58) (longest-edge float :offset-assert 60) (eye-ctrl merc-eye-ctrl :offset-assert 64) - (pad UNKNOWN 3 :offset-assert 68) + (pad uint32 3 :offset-assert 68) (masks-padding texture-masks :inline :offset-assert 80) - (texture-usage-group texture-usage-group :offset-assert 80) - (dummy-bytes uint8 :dynamic :offset-assert 32) ;; guessed by decompiler - (envmap-tint uint32 :offset-assert 32) - (query basic :offset-assert 36) - (needs-clip uint8 :offset-assert 40) - (use-isometric uint8 :offset-assert 41) - (use-attached-shader uint8 :offset-assert 42) - (display-triangles uint8 :offset-assert 43) - (death-vertex-skip uint16 :offset-assert 44) - (death-start-vertex uint16 :offset-assert 46) - (death-effect uint32 :offset-assert 48) - (use-translucent uint8 :offset-assert 52) - (display-this-fragment uint8 :offset-assert 53) - (use-warp uint8 :offset-assert 54) - (ignore-alpha uint8 :offset-assert 55) - (force-fade uint8 :offset-assert 56) - (disable-fog uint8 :offset-assert 57) - (disable-envmap uint8 :offset-assert 58) + (texture-usage-group texture-usage-group :offset 80) + (dummy-bytes uint8 :dynamic :offset 32) ;; guessed by decompiler + (envmap-tint uint32 :offset 32) + (query basic :offset 36) + (needs-clip uint8 :offset 40) + (use-isometric uint8 :offset 41) + (use-attached-shader uint8 :offset 42) + (display-triangles uint8 :offset 43) + (death-vertex-skip uint16 :offset 44) + (death-start-vertex uint16 :offset 46) + (death-effect uint32 :offset 48) + (use-translucent uint8 :offset 52) + (display-this-fragment uint8 :offset 53) + (use-warp uint8 :offset 54) + (ignore-alpha uint8 :offset 55) + (force-fade uint8 :offset 56) + (disable-fog uint8 :offset 57) + (disable-envmap uint8 :offset 58) ) :method-count-assert 9 :size-assert #x80 :flag-assert #x900000080 ;; field xyz-scale is a float printed as hex? ) -|# -#| (deftype merc-ctrl (art-element) - ((num-joints int32 :offset-assert 20) - (seg-table basic :offset-assert 24) + ((num-joints int32 :offset 20) + (seg-table basic :offset 24) (header merc-ctrl-header :inline :offset-assert 32) - (effect merc-effect :dynamic :offset-assert 160) ;; guessed by decompiler + (effect merc-effect :inline :dynamic :offset-assert 160) ;; guessed by decompiler ) :method-count-assert 13 :size-assert #xa0 @@ -9899,12 +10323,10 @@ (:methods ) ) -|# -#| (deftype merc-vu1-low-mem (structure) - ((tri-strip-gif qword :inline :offset-assert 0) ;; gs-gif-tag :inline - (ad-gif qword :inline :offset-assert 16) ;; gs-gif-tag :inline + ((tri-strip-gif gs-gif-tag :inline :offset-assert 0) ;; was qword + (ad-gif gs-gif-tag :inline :offset-assert 16) ;; was qword (hvdf-offset vector :inline :offset-assert 32) (perspective uint128 4 :offset-assert 48) ;; guessed by decompiler (fog vector :inline :offset-assert 112) @@ -9913,24 +10335,20 @@ :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype emerc-vu1-low-mem (structure) - ((tri-strip-gif qword :inline :offset-assert 0) - (ad-gif qword :inline :offset-assert 16) - (hvdf-offset vector :inline :offset-assert 32) - (perspective UNKNOWN 4 :offset-assert 48) - (fog vector :inline :offset-assert 112) - (unperspect vector :inline :offset-assert 128) + ((tri-strip-gif qword :inline :offset-assert 0) + (ad-gif qword :inline :offset-assert 16) + (hvdf-offset vector :inline :offset-assert 32) + (perspective vector 4 :inline :offset-assert 48) + (fog vector :inline :offset-assert 112) + (unperspect vector :inline :offset-assert 128) ) :method-count-assert 9 :size-assert #x90 :flag-assert #x900000090 ) -|# -#| (deftype ripple-wave (structure) ((scale float :offset-assert 0) (offs float :offset-assert 4) @@ -9941,27 +10359,24 @@ (zmul float :offset-assert 20) (delta float :offset-assert 24) ) + :pack-me :method-count-assert 9 :size-assert #x1c :flag-assert #x90000001c ) -|# -#| (deftype ripple-wave-set (basic) ((count int32 :offset-assert 4) (converted basic :offset-assert 8) (normal-scale float :offset-assert 12) - (wave ripple-wave 4 :offset-assert 16) ;; guessed by decompiler + (wave ripple-wave 4 :inline :offset-assert 16) ;; guessed by decompiler (frame-save uint64 :offset-assert 128) ;; uint32 ) :method-count-assert 9 :size-assert #x88 :flag-assert #x900000088 ) -|# -#| (deftype ripple-control (basic) ((global-scale float :offset-assert 4) (last-frame-scale float :offset-assert 8) @@ -9973,52 +10388,39 @@ (send-query symbol :offset-assert 32) ;; guessed by decompiler (query ripple-merc-query :offset-assert 36) ;; guessed by decompiler ) + (:methods + (new (symbol type) _type_ 0) + ) :method-count-assert 9 :size-assert #x28 :flag-assert #x900000028 ) -|# -#| -(deftype merc-blend-data (UNKNOWN) - ((int8-data int8 :dynamic :offset-assert 0) ;; guessed by decompiler - ) - :method-count-assert 0 - :size-assert #x0 - :flag-assert #x0 - ) -|# - -;; (define-extern merc-fragment-fp-data function) ;; (function merc-fragment merc-fp-header) +(define-extern merc-fragment-fp-data (function merc-fragment merc-fp-header)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-merc-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype merc-matrix (structure) ((quad uint128 8 :offset-assert 0) ;; guessed by decompiler - (vector vector 8 :offset-assert 0) ;; guessed by decompiler - (tag uint64 :offset-assert 0) + (vector vector 8 :offset 0) ;; guessed by decompiler + (tag uint64 :offset 0) ) :method-count-assert 9 :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype generic-merc-tag (dma-packet) - ((next-ptr uint32 :offset-assert 12) - (size uint32 :offset-assert 8) + ((next-ptr uint32 :offset 12) + (size uint32 :offset 8) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype generic-merc-ctrl (structure) ((tag generic-merc-tag :inline :offset-assert 0) (lights vu-lights :inline :offset-assert 16) @@ -10029,9 +10431,7 @@ :size-assert #x120 :flag-assert #x900000120 ) -|# -#| (deftype generic-merc-ctrl-with-sfx (generic-merc-ctrl) ((sfx-data uint128 11 :offset-assert 288) ;; guessed by decompiler ) @@ -10039,14 +10439,12 @@ :size-assert #x1d0 :flag-assert #x9000001d0 ) -|# -#| (deftype generic-merc-input (structure) ((geo-tag generic-merc-tag :inline :offset-assert 0) (geo-block uint8 1296 :offset-assert 16) ;; guessed by decompiler - (byte-header merc-byte-header :inline :offset-assert 16) - (matrix merc-matrix 9 :offset-assert 1312) ;; guessed by decompiler + (byte-header merc-byte-header :inline :offset 16) + (matrix merc-matrix 9 :inline :offset-assert 1312) ;; guessed by decompiler (control generic-merc-ctrl-with-sfx :inline :offset-assert 2464) (end-tag generic-merc-tag :inline :offset-assert 2928) (shader adgif-shader :inline :offset-assert 2944) @@ -10055,24 +10453,20 @@ :size-assert #xbd0 :flag-assert #x900000bd0 ) -|# -#| (deftype generic-merc-output (structure) ((info gsf-info :inline :offset-assert 0) (header gsf-header :inline :offset-assert 16) (index-kick-table uint16 80 :offset-assert 32) ;; guessed by decompiler - (index-table uint8 160 :offset-assert 32) ;; guessed by decompiler + (index-table uint8 160 :offset 32) ;; guessed by decompiler (inverse-table uint8 256 :offset-assert 192) ;; guessed by decompiler - (vertex-table gsf-vertex 72 :offset-assert 448) ;; guessed by decompiler + (vertex-table gsf-vertex 72 :inline :offset-assert 448) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #xac0 :flag-assert #x900000ac0 ) -|# -#| (deftype generic-merc-dcache (structure) ((output-a generic-merc-output :inline :offset-assert 0) (output-b generic-merc-output :inline :offset-assert 2752) @@ -10085,9 +10479,7 @@ :size-assert #x2000 :flag-assert #x900002000 ) -|# -#| (deftype gm-shadow (structure) ((perspective matrix :inline :offset-assert 0) (isometric matrix :inline :offset-assert 64) @@ -10121,9 +10513,7 @@ :size-assert #x190 :flag-assert #x900000190 ) -|# -#| (deftype generic-merc-work (structure) ((input-a generic-merc-input :inline :offset-assert 0) (input-b generic-merc-input :inline :offset-assert 3024) @@ -10135,17 +10525,15 @@ :size-assert #x1c00 :flag-assert #x900001c00 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-tie-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype generic-tie-instance (structure) ((matrix-tag dma-packet :inline :offset-assert 0) - (matrix-data vector 6 :offset-assert 16) ;; guessed by decompiler + (matrix-data vector 6 :inline :offset-assert 16) ;; guessed by decompiler (index-tag dma-packet :inline :offset-assert 112) (indices uint8 224 :offset-assert 128) ;; guessed by decompiler (end-tag dma-packet :inline :offset-assert 352) @@ -10154,16 +10542,14 @@ :size-assert #x170 :flag-assert #x900000170 ) -|# -#| (deftype generic-tie-input (structure) ((palette-tag dma-packet :inline :offset-assert 0) (palette rgba 128 :offset-assert 16) ;; guessed by decompiler (model-tag dma-packet :inline :offset-assert 528) - (model vector 146 :offset-assert 544) ;; guessed by decompiler + (model vector 146 :inline :offset-assert 544) ;; guessed by decompiler (matrix-tag dma-packet :inline :offset-assert 2880) - (matrix-data vector 6 :offset-assert 2896) ;; guessed by decompiler + (matrix-data vector 6 :inline :offset-assert 2896) ;; guessed by decompiler (index-tag dma-packet :inline :offset-assert 2992) (indices uint8 224 :offset-assert 3008) ;; guessed by decompiler (end-tag dma-packet :inline :offset-assert 3232) @@ -10172,9 +10558,7 @@ :size-assert #xcb0 :flag-assert #x900000cb0 ) -|# -#| (deftype generic-tie-run-control (structure) ((skip-bp2 uint8 :offset-assert 0) (skip-ips uint8 :offset-assert 1) @@ -10193,76 +10577,67 @@ :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype generic-tie-base-point (structure) ((data uint16 8 :offset-assert 0) ;; guessed by decompiler - (quad uint128 :offset-assert 0) - (x int16 :offset-assert 0) - (y int16 :offset-assert 2) - (z int16 :offset-assert 4) - (d0 int16 :offset-assert 6) - (vtx uint64 :offset-assert 0) - (u int16 :offset-assert 8) - (v int16 :offset-assert 10) - (tex uint32 :offset-assert 8) - (w int16 :offset-assert 12) - (d1 int16 :offset-assert 14) + (quad uint128 :offset 0) + (x int16 :offset 0) + (y int16 :offset 2) + (z int16 :offset 4) + (d0 int16 :offset 6) + (vtx uint64 :offset 0) + (u int16 :offset 8) + (v int16 :offset 10) + (tex uint32 :offset 8) + (w int16 :offset 12) + (d1 int16 :offset 14) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype generic-tie-bps (structure) - ((bp generic-tie-base-point 4 :offset-assert 0) ;; guessed by decompiler + ((bp generic-tie-base-point 4 :inline :offset-assert 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype generic-tie-interp-point (structure) ((data uint16 12 :offset-assert 0) ;; guessed by decompiler - (quad uint128 :offset-assert 0) - (x int16 :offset-assert 0) - (y int16 :offset-assert 2) - (z int16 :offset-assert 4) - (d0 int16 :offset-assert 6) - (vtx0 uint64 :offset-assert 0) - (dx int16 :offset-assert 8) - (dy int16 :offset-assert 10) - (dz int16 :offset-assert 12) - (unused int16 :offset-assert 14) - (vtx1 uint64 :offset-assert 8) - (u int16 :offset-assert 16) - (v int16 :offset-assert 18) - (tex uint32 :offset-assert 16) - (w int16 :offset-assert 20) - (d1 int16 :offset-assert 22) + ;(quad uint128 :offset 0) ;; misaligned?? + (x int16 :offset 0) + (y int16 :offset 2) + (z int16 :offset 4) + (d0 int16 :offset 6) + (vtx0 uint64 :offset 0) + (dx int16 :offset 8) + (dy int16 :offset 10) + (dz int16 :offset 12) + (unused int16 :offset 14) + (vtx1 uint64 :offset 8) + (u int16 :offset 16) + (v int16 :offset 18) + (tex uint32 :offset 16) + (w int16 :offset 20) + (d1 int16 :offset 22) ) + :pack-me :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype generic-tie-ips (structure) - ((ip generic-tie-interp-point 2 :offset-assert 0) ;; guessed by decompiler + ((ip generic-tie-interp-point 2 :inline :offset-assert 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype generic-tie-header (structure) ((effect uint8 :offset-assert 0) (interp-table-size uint8 :offset-assert 1) @@ -10279,9 +10654,7 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype generic-tie-matrix (structure) ((matrix matrix :inline :offset-assert 0) (morph vector :inline :offset-assert 64) @@ -10291,9 +10664,7 @@ :size-assert #x60 :flag-assert #x900000060 ) -|# -#| (deftype generic-tie-normal (structure) ((x int8 :offset-assert 0) (y int8 :offset-assert 1) @@ -10304,9 +10675,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype generic-tie-control (structure) ((ptr-palette uint32 :offset-assert 0) (ptr-shaders uint32 :offset-assert 4) @@ -10328,9 +10697,7 @@ :size-assert #x3c :flag-assert #x90000003c ) -|# -#| (deftype generic-tie-stats (structure) ((num-bps uint32 :offset-assert 0) (num-ips uint32 :offset-assert 4) @@ -10346,22 +10713,19 @@ :size-assert #x24 :flag-assert #x900000024 ) -|# -#| (deftype generic-tie-calls (structure) ((generic-prepare-dma-double basic :offset-assert 0) (generic-envmap-dproc basic :offset-assert 4) (generic-interp-dproc basic :offset-assert 8) (generic-no-light-dproc basic :offset-assert 12) ) + :pack-me :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype generic-tie-shadow (structure) ((out-buf gsf-buffer :offset-assert 0) (cur-buf uint32 :offset-assert 4) @@ -10373,13 +10737,12 @@ (write-limit uint32 :offset-assert 28) (calls generic-tie-calls :inline :offset-assert 32) ) + :pack-me :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype generic-tie-work (structure) ((control generic-tie-control :inline :offset-assert 0) (interp-job generic-interp-job :inline :offset-assert 60) @@ -10393,26 +10756,22 @@ :size-assert #x1d50 :flag-assert #x900001d50 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-work-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype generic-input-buffer (structure) ((data uint128 473 :offset-assert 0) ;; guessed by decompiler - (merc generic-merc-work :inline :offset-assert 0) - (tie generic-tie-work :inline :offset-assert 0) + (merc generic-merc-work :inline :offset 0) + (tie generic-tie-work :inline :offset 0) ) :method-count-assert 9 :size-assert #x1d90 :flag-assert #x900001d90 ) -|# -#| (deftype generic-debug (structure) ((locks uint32 4 :offset-assert 0) ;; guessed by decompiler (timer uint32 32 :offset-assert 16) ;; guessed by decompiler @@ -10426,26 +10785,22 @@ :size-assert #x19c :flag-assert #x90000019c ) -|# -#| (deftype generic-vu1-header (structure) ((matrix matrix :inline :offset-assert 0) (strgif generic-gif-tag :inline :offset-assert 64) - (adcmds ad-cmd 2 :offset-assert 80) ;; guessed by decompiler - (adnop1 gs-adcmd :inline :offset-assert 80) ;; ad-cmd :inline - (adnop2 gs-adcmd :inline :offset-assert 96) ;; ad-cmd :inline - (dps uint16 :offset-assert 92) - (kickoff uint16 :offset-assert 108) - (strips uint16 :offset-assert 76) + (adcmds gs-adcmd 2 :inline :offset-assert 80) ;; guessed by decompiler + (adnop1 gs-adcmd :inline :offset 80) ;; ad-cmd :inline + (adnop2 gs-adcmd :inline :offset 96) ;; ad-cmd :inline + (dps uint16 :offset 92) + (kickoff uint16 :offset 108) + (strips uint16 :offset 76) ) :method-count-assert 9 :size-assert #x70 :flag-assert #x900000070 ) -|# -#| (deftype generic-vu1-texbuf (structure) ((header generic-vu1-header :inline :offset-assert 0) (shader uint32 :dynamic :offset-assert 112) ;; guessed by decompiler @@ -10454,9 +10809,7 @@ :size-assert #x70 :flag-assert #x900000070 ) -|# -#| (deftype generic-texbuf (structure) ((tag dma-packet :inline :offset-assert 0) (header generic-vu1-header :inline :offset-assert 16) @@ -10466,9 +10819,7 @@ :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype generic-effect-work (structure) ((consts generic-consts :inline :offset-assert 0) (storage generic-storage :inline :offset-assert 432) @@ -10479,9 +10830,7 @@ :size-assert #x420 :flag-assert #x900000420 ) -|# -#| (deftype generic-effect-buffer (structure) ((outbuf-0 uint8 3552 :offset-assert 0) ;; guessed by decompiler (work generic-effect-work :inline :offset-assert 3552) @@ -10491,9 +10840,7 @@ :size-assert #x1fe0 :flag-assert #x900001fe0 ) -|# -#| (deftype generic-work (structure) ((saves generic-saves :inline :offset-assert 0) (storage generic-storage :inline :offset-assert 368) @@ -10504,20 +10851,29 @@ :size-assert #x3fe0 :flag-assert #x900003fe0 ) -|# -;; (define-extern *generic-debug* object) ;; generic-debug +(define-extern *generic-debug* generic-debug) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; shadow-cpu-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum shadow-flags + :bitfield #t + :type int32 + (shdf00) ;; unused + (disable-fade) + (shdf02) ;; only set, never used. + (shdf03) + (shdf04) ;; unused + (disable-draw) + ) + (deftype shadow-settings (structure) - ((center vector :inline :offset-assert 0) - (flags int32 :offset-assert 12) ;; shadow-flags + ((center vector :inline :offset-assert 0 :score -1) + (flags shadow-flags :offset 12) ;; shadow-flags (shadow-dir vector :inline :offset-assert 16) - (dist-to-locus float :offset-assert 28) + (dist-to-locus float :offset 28) (bot-plane plane :inline :offset-assert 32) (top-plane plane :inline :offset-assert 48) (fade-dist float :offset-assert 64) @@ -10529,9 +10885,7 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype shadow-control (basic) ((settings shadow-settings :inline :offset-assert 16) ) @@ -10539,21 +10893,19 @@ :size-assert #x60 :flag-assert #xf00000060 (:methods - ;; (new (symbol type float float float float float) _type_ 0) - (shadow-control-method-9 () none 9) ;; (clear-offset-bit (shadow-control) int 9) - (shadow-control-method-10 () none 10) ;; (set-offset-bit (shadow-control) int 10) - (shadow-control-method-11 () none 11) ;; (set-top-plane-offset (shadow-control float) int 11) - (shadow-control-method-12 () none 12) ;; (set-bottom-plane-offset (shadow-control float) int 12) + (new (symbol type float float float float float) _type_ 0) + (clear-offset-bit (shadow-control) int 9) + (set-offset-bit (shadow-control) int 10) + (set-top-plane-offset (shadow-control float) int 11) + (set-bottom-plane-offset (shadow-control float) int 12) (shadow-control-method-13 () none 13) ;; (unused-13 (_type_) none 13) (shadow-control-method-14 () none 14) ;; (update-direction-from-time-of-day (_type_) none 14) ) ) -|# -#| (deftype shadow-data (structure) ((dma-unpack-template dma-packet :inline :offset-assert 0) - (dma-cnt uint64 :offset-assert 16) ;; dma-tag + (dma-cnt dma-tag :offset-assert 16) ;; was u64 (vif-nop vif-tag :offset-assert 24) ;; guessed by decompiler (vif-unpack-v4-8 vif-tag :offset-assert 28) ;; guessed by decompiler (pdc basic :offset-assert 32) @@ -10565,9 +10917,7 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype shadow-work (structure) ((shadow-data shadow-data :inline :offset-assert 0) (inbuf uint128 600 :offset-assert 48) ;; guessed by decompiler @@ -10576,9 +10926,7 @@ :size-assert #x25b0 :flag-assert #x9000025b0 ) -|# -#| (deftype shadow-bucket (structure) ((first uint32 :offset-assert 0) (next uint32 :offset-assert 4) @@ -10586,25 +10934,22 @@ (shadow-color uint32 :offset-assert 12) (constants basic :offset-assert 16) ) + :allow-misaligned :method-count-assert 9 :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype shadow-globals (structure) ((num-buckets uint32 :offset-assert 0) (cur-bucket uint32 :offset-assert 4) - (bucket UNKNOWN 2 :offset-assert 8) + (bucket shadow-bucket 2 :inline :offset-assert 8) ) :method-count-assert 9 :size-assert #x48 :flag-assert #x900000048 ) -|# -#| (deftype shadow-vertex (structure) ((x float :offset-assert 0) (y float :offset-assert 4) @@ -10615,9 +10960,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype shadow-matrix-ref (structure) ((joint-0 uint8 :offset-assert 0) (joint-1 uint8 :offset-assert 1) @@ -10626,22 +10969,18 @@ :size-assert #x2 :flag-assert #x900000002 ) -|# -#| -(deftype shadow-edge (structure) - ((ind-0 uint16 :offset-assert 0) - (ind-1 uint16 :offset-assert 2) - (tri-0 uint16 :offset-assert 4) - (tri-1 uint16 :offset-assert 6) - ) - :method-count-assert 9 - :size-assert #x4 - :flag-assert #x900000004 - ) -|# +; (deftype shadow-edge (structure) +; ((ind-0 uint16 :offset-assert 0) +; (ind-1 uint16 :offset-assert 2) +; (tri-0 uint16 :offset-assert 4) +; (tri-1 uint16 :offset-assert 6) +; ) +; :method-count-assert 9 +; :size-assert #x4 +; :flag-assert #x900000004 +; ) -#| (deftype shadow-tri (structure) ((ind-0 uint8 :offset-assert 0) (ind-1 uint8 :offset-assert 1) @@ -10652,9 +10991,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype shadow-edge (structure) ((ind-0 uint8 :offset-assert 0) (ind-1 uint8 :offset-assert 1) @@ -10665,9 +11002,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype shadow-frag-header (structure) ((qwc-data uint32 :offset-assert 0) (num-joints uint32 :offset-assert 4) @@ -10688,25 +11023,22 @@ :size-assert #x2c :flag-assert #x90000002c ) -|# -#| (deftype shadow-frag-ref (structure) ((header shadow-frag-header :offset-assert 0) (qwc uint32 :offset-assert 4) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype shadow-geo-old (art-element) - ((version uint32 :offset-assert 20) + ((version uint32 :offset 20) (header shadow-frag-header :inline :offset-assert 32) - (total-qwc uint32 :offset-assert 32) - (rest UNKNOWN :dynamic :offset-assert 80) + (total-qwc uint32 :offset 32) + (rest uint64 :dynamic :offset-assert 80) ) :method-count-assert 13 :size-assert #x50 @@ -10714,15 +11046,13 @@ (:methods ) ) -|# -#| (deftype shadow-geo (art-element) - ((version uint32 :offset-assert 20) + ((version uint32 :offset 20) (total-qwc uint32 :offset-assert 32) (num-joints uint32 :offset-assert 36) (num-fragments uint32 :offset-assert 40) - (frags UNKNOWN :dynamic :offset-assert 44) + (frags shadow-frag-ref :inline :dynamic :offset-assert 44) ;; guess ) :method-count-assert 13 :size-assert #x2c @@ -10730,13 +11060,12 @@ (:methods ) ) -|# -;; (define-extern *shadow-globals* object) -;; (define-extern *shadow* object) ;; symbol -;; (define-extern *shadow-object* object) ;; symbol -;; (define-extern *shadow-debug* object) ;; symbol -;; (define-extern *shadow-dma-buf* object) +(define-extern *shadow-globals* shadow-globals) +(define-extern *shadow* object) ;; symbol +(define-extern *shadow-object* object) +(define-extern *shadow-debug* object) +(define-extern *shadow-dma-buf* dma-buffer) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; shadow-vu1-h ;; @@ -10747,38 +11076,36 @@ ;; memcard-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (deftype mc-handle (int32) -;; () -;; :flag-assert #x900000004 -;; ) +(deftype mc-handle (int32) + () + :flag-assert #x900000004 + ) -#| (deftype mc-file-info (structure) ((present int32 :offset-assert 0) - (blind-data float 16 :offset-assert 4) ;; guessed by decompiler - (blind-data-int8 int8 64 :offset-assert 4) ;; guessed by decompiler - (level-index int32 :offset-assert 4) - (gem-count float :offset-assert 8) - (skill-count float :offset-assert 12) - (completion-percentage float :offset-assert 16) - (minute uint8 :offset-assert 24) - (hour uint8 :offset-assert 25) - (week uint8 :offset-assert 26) - (day uint8 :offset-assert 27) - (month uint8 :offset-assert 28) - (year uint8 :offset-assert 29) - (game-time0 uint32 :offset-assert 36) - (game-time1 uint32 :offset-assert 40) - (secrets uint32 :offset-assert 44) - (features uint32 :offset-assert 48) + (blind-data float 16 :offset 4) ;; guessed by decompiler + (blind-data-int8 int8 64 :offset 4) ;; guessed by decompiler + (level-index int32 :offset 4) + (gem-count float :offset 8) + (skill-count float :offset 12) + (completion-percentage float :offset 16) + (minute uint8 :offset 24) + (hour uint8 :offset 25) + (week uint8 :offset 26) + (day uint8 :offset 27) + (month uint8 :offset 28) + (year uint8 :offset 29) + (game-time0 uint32 :offset 36) + (game-time1 uint32 :offset 40) + (secrets uint32 :offset 44) + (features uint32 :offset 48) ) + :pack-me :method-count-assert 9 :size-assert #x44 :flag-assert #x900000044 ) -|# -#| (deftype mc-slot-info (structure) ((handle int32 :offset-assert 0) (known int32 :offset-assert 4) @@ -10787,16 +11114,20 @@ (last-file int32 :offset-assert 16) (mem-required int32 :offset-assert 20) (mem-actual int32 :offset-assert 24) - (file mc-file-info 4 :offset-assert 28) ;; guessed by decompiler + (file mc-file-info 4 :inline :offset-assert 28) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x12c :flag-assert #x90000012c ) -|# -;; (define-extern mc-sync function) ;; (function int) -;; (define-extern show-mc-info function) ;; (function dma-buffer none) +(define-extern mc-sync (function int)) +(define-extern show-mc-info (function dma-buffer none)) + +(define-extern mc-run (function none)) +(define-extern mc-check-result (function int)) +(define-extern mc-get-slot-info (function int mc-slot-info none)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; game-info-h ;; @@ -10842,26 +11173,33 @@ (force-vis? symbol :offset-assert 8) ;; guessed by decompiler (force-inside? symbol :offset-assert 12) ;; guessed by decompiler ) + :pack-me :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -#| + (deftype load-state (basic) - () + ((want level-buffer-state 6 :inline) + (want-sound symbol 3) + (vis-nick symbol :offset-assert 112) + (command-list pair) + (object-name string 256) + (object-status basic 256) + ) :method-count-assert 22 :size-assert #x878 :flag-assert #x1600000878 ;; Failed to read fields. (:methods - ;; (new (symbol type) _type_ 0) - (load-state-method-9 () none 9) ;; (reset! (_type_) _type_ 9) - (load-state-method-10 () none 10) ;; (update! (_type_) int 10) - (load-state-method-11 () none 11) ;; (want-levels (_type_ symbol symbol) int 11) + (new (symbol type) _type_ 0) + (reset! (_type_) _type_ 9) + (update! (_type_) int 10) + (want-levels (_type_ (pointer symbol)) int 11) (load-state-method-12 () none 12) ;; (want-display-level (_type_ symbol symbol) int 12) - (load-state-method-13 () none 13) ;; (want-vis (_type_ symbol) int 13) - (load-state-method-14 () none 14) ;; (want-force-vis (_type_ symbol symbol) int 14) + (want-display-level (_type_ symbol symbol) int 13) + (want-vis-level (_type_ symbol) none 14) ;; (want-force-vis (_type_ symbol symbol) int 14) (load-state-method-15 () none 15) ;; (execute-command (_type_ pair) none 15) (load-state-method-16 () none 16) ;; (execute-commands-up-to (_type_ float) int 16) (load-state-method-17 () none 17) ;; (backup-load-state-and-set-cmds (_type_ pair) int 17) @@ -10871,11 +11209,57 @@ (load-state-method-21 () none 21) ) ) -|# -#| + +(defenum continue-flags + :type uint32 + :bitfield #t + (cf0 0) + (cf1 1) + (cf2 2) + (cf3 3) + (cf4 4) + (cf5 5) + (cf6 6) + (cf7 7) + (cf8 8) + (cf9 9) + (cf10 10) + (cf11 11) + (cf12 12) + (cf13 13) + (cf14 14) + (cf15 15) + (cf16 16) + (cf17 17) + (cf18 18) + (cf19 19) + (cf20 20) + (cf21 21) + (cf22 22) + (cf23 23) + (cf24 24) + (cf25 25) + (cf26 26) + (cf27 27) + (cf28 28) + (cf29 29) + (cf30 30) + ) + (deftype continue-point (basic) - () + ((name string) ;; ? + (level symbol) ;; ? + (flags continue-flags) + (trans vector :inline) + (quat vector :inline) + (camera-trans vector :inline) + (camera-rot float 9) + (on-goto pair) + (vis-nick symbol) + (want level-buffer-state 6 :inline) + (want-sound symbol 3) + ) :method-count-assert 12 :size-assert #xd8 :flag-assert #xc000000d8 @@ -10886,9 +11270,33 @@ (continue-point-method-11 () none 11) ) ) -|# -#| +(defenum mc-status-code + :type uint32 + ; (busy 0) + ; (ok 1) + ; (bad-handle 2) + ; (format-failed 3) + ; (internal-error 4) + ; (write-error 5) + ; (read-error 6) + ; (new-game 7) + ; (no-memory 8) + ; (no-card 9) + ; (no-last 10) + ; (no-format 11) + ; (no-file 12) + ; (no-save 13) + ; (no-space 14) + ; (bad-version 15) + ; (no-process 16) + ; (no-auto-save 17) + ) + +(declare-type entity-perm-array inline-array-class) +(declare-type continue-point basic) +(declare-type game-save basic) + (deftype game-info (basic) ((mode symbol :offset-assert 4) ;; guessed by decompiler (save-name basic :offset-assert 8) @@ -10910,9 +11318,11 @@ (features uint64 :offset-assert 128) (debug-features uint64 :offset-assert 136) (secrets uint32 :offset-assert 144) + (unknown-pad1 uint32) (purchase-secrets uint32 :offset-assert 152) + (unknown-pad2 uint32) (gun-type int32 :offset-assert 160) - (gun-ammo UNKNOWN 4 :offset-assert 164) + (gun-ammo uint32 4 :offset-assert 164) ;; ?? (shield float :offset-assert 180) (score float :offset-assert 184) (score-owner uint64 :offset-assert 192) @@ -10926,7 +11336,9 @@ (task-perm-list entity-perm-array :offset-assert 236) ;; guessed by decompiler (current-continue continue-point :offset-assert 240) ;; guessed by decompiler (last-continue basic :offset-assert 244) + (unknown-pad3 uint32 3) (task-counter uint32 :offset-assert 260) + (unknown-pad4 uint32) (level-opened uint8 32 :offset-assert 268) ;; guessed by decompiler (total-deaths int32 :offset-assert 300) (continue-deaths int32 :offset-assert 304) @@ -10937,7 +11349,10 @@ (death-time time-frame :offset-assert 336) ;; time-frame (hit-time time-frame :offset-assert 344) ;; time-frame (task-pickup-time time-frame :offset-assert 352) - (death-pos vector-array :offset-assert 372) ;; guessed by decompiler + (unknown-array1 (array uint64)) + (unknown-array2 (array uint64)) + (unknown-array3 (array uint64)) + (death-pos vector-array :offset 372) ;; guessed by decompiler ?? (stop-watch-start uint64 :offset-assert 376) (stop-watch-stop uint64 :offset-assert 384) (blackout-time time-frame :offset-assert 392) ;; time-frame @@ -10947,20 +11362,20 @@ (display-text-handle uint64 :offset-assert 424) ;; handle (death-movie-tick int32 :offset-assert 432) (want-auto-save symbol :offset-assert 436) ;; guessed by decompiler - (auto-save-proc uint64 :offset-assert 440) ;; handle + (auto-save-proc handle :offset-assert 440) ;; handle (auto-save-status mc-status-code :offset-assert 448) ;; guessed by decompiler (auto-save-card int32 :offset-assert 452) (auto-save-which int32 :offset-assert 456) (auto-save-count int32 :offset-assert 460) (pov-camera-handle uint64 :offset-assert 464) ;; handle (other-camera-handle uint64 :offset-assert 472) ;; handle - (controller UNKNOWN 2 :offset-assert 480) + (controller uint64 2 :offset-assert 480) ;; ?? (race-timer uint64 :offset-assert 496) (race-current-lap-count int32 :offset-assert 504) (race-total-lap-count int32 :offset-assert 508) (race-position int32 :offset-assert 512) (race-number-turbos int32 :offset-assert 516) - (bot-health UNKNOWN 3 :offset-assert 520) + (bot-health uint32 3 :offset-assert 520) ;; ?? (demo-state uint32 :offset-assert 532) (wanted-flash basic :offset-assert 536) (distance float :offset-assert 540) @@ -10970,6 +11385,7 @@ (goal float :offset-assert 564) (miss float :offset-assert 568) (miss-max float :offset-assert 572) + (unknown-array4 (array uint64)) ;; ?? (live-eco-pill-count int32 :offset-assert 580) (live-gem-count int32 :offset-assert 584) (air-supply float :offset-assert 588) @@ -10981,42 +11397,122 @@ :size-assert #x25c :flag-assert #x1f0000025c (:methods - (game-info-method-9 () none 9) ;; (initialize! (_type_ symbol game-save string) _type_ 9) + (initialize! (_type_ symbol game-save string) _type_ 9) (game-info-method-10 () none 10) ;; (adjust (_type_ symbol float handle) float 10) (game-info-method-11 () none 11) ;; (task-complete? (_type_ game-task) symbol 11) (game-info-method-12 () none 12) ;; (lookup-entity-perm-by-aid (_type_ actor-id) entity-perm 12) (game-info-method-13 () none 13) ;; (get-entity-task-perm (_type_ game-task) entity-perm 13) - (game-info-method-14 () none 14) ;; (copy-perms-from-level! (_type_ level) none 14) - (game-info-method-15 () none 15) ;; (copy-perms-to-level! (_type_ level) none 15) - (game-info-method-16 () none 16) ;; (debug-print (_type_ symbol) _type_ 16) - (game-info-method-17 () none 17) ;; (get-or-create-continue! (_type_) continue-point 17) + (game-info-method-14 () none 14) ;; 14) + (game-info-method-15 () none 15) + (copy-perms-from-level! (_type_ level) none 16) ;; (debug-print (_type_ symbol) _type_ 16) + (copy-perms-to-level! (_type_ level) none 17) ;; (get-or-create-continue! (_type_) continue-point 17) (game-info-method-18 () none 18) ;; (get-continue-by-name (_type_ string) continue-point 18) (game-info-method-19 () none 19) ;; (set-continue! (_type_ basic) continue-point 19) (game-info-method-20 () none 20) ;; (buzzer-count (_type_ game-task) int 20) - (game-info-method-21 () none 21) ;; (seen-text? (_type_ game-text-id) symbol 21) + (set-continue! (_type_ basic) continue-point 21) ;; (seen-text? (_type_ game-text-id) symbol 21) (game-info-method-22 () none 22) ;; (mark-text-as-seen (_type_ game-text-id) none 22) (game-info-method-23 () none 23) ;; (got-buzzer? (_type_ game-task int) symbol 23) (game-info-method-24 () none 24) ;; (save-game! (_type_ game-save string) none 24) (game-info-method-25 () none 25) ;; (load-game! (_type_ game-save) game-save 25) (game-info-method-26 () none 26) ;; (clear-text-seen! (_type_ game-text-id) none 26) - (game-info-method-27 () none 27) ;; (get-death-count (_type_ symbol) int 27) + (get-next-attack-id (_type_) uint 27) ;; (get-death-count (_type_ symbol) int 27) (game-info-method-28 () none 28) ;; (get-health-percent-lost (_type_ symbol) float 28) (game-info-method-29 () none 29) (game-info-method-30 () none 30) ) ) -|# -;; (define-extern *GAME-bank* game-bank) ;; game-bank -;; (define-extern *game-info* object) ;; game-info + +(define-extern *GAME-bank* game-bank) +(define-extern *game-info* game-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gui-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + +(defenum gui-action + :type uint8 + :bitfield #f + (none 0) + (queue 1) + (play 2) + (playing 3) + (stop 4) + (stopping 5) + (abort 6) + (hide 7) + (hidden 8) + (fade 9) + ) + +(defenum gui-channel + :type uint8 + :bitfield #f + (none 0) + (art-load 16) + (art-load-next 17) + (background 18) + (jak 19) + (daxter 20) + (sig 21) + (ashelin 22) + (mog 23) + (jinx 24) + (grim 25) + (kid 26) + (kor 27) + (hal 28) + (voicebox 29) + (guard 30) + (crocadog 31) + (alert 32) + (citizen 33) + (bbush 34) + (krew 35) + (voice 47) + (movie 64) + (blackout 65) + (query 66) + (message 67) + (notice 68) + (subtitle 69) + (supertitle 70) + (notice-low 71) + (screen 79) + (hud-upper-right 80) + (hud-upper-left 81) + (hud-lower-right 82) + (hud-lower-left 83) + (hud-lower-left-1 84) + (hud-lower-left-2 85) + (hud-center-right 86) + (hud-center-left 87) + (hud-middle-right 88) + (hud-middle-left 89) + (hud-upper-center 90) + (hud-upper-center-2 91) + (hud 95) + (max 96) + ) + (deftype gui-connection (connection) - () + ((priority float :offset 16 :score 1) + (action gui-action :offset 20) + (channel gui-channel :offset 21) + (anim-part uint8 :offset 22) + (flags uint8 :offset 23) + (name object :offset 24) + (id uint32 :offset 28) + (handle handle :offset 0) + (time-stamp time-frame :offset 8) + (hold-time time-frame :offset-assert 32) + (fo-min int16) + (fo-max int16) + (fo-curve int8) + (fade uint8) + (pad uint8 2) + ) :method-count-assert 14 :size-assert #x30 :flag-assert #xe00000030 @@ -11024,11 +11520,13 @@ (:methods ) ) -|# -#| + + (deftype gui-control (basic) - () + ((engine engine) + (data uint8 3272) + ) :method-count-assert 25 :size-assert #xcd0 :flag-assert #x1900000cd0 @@ -11038,7 +11536,7 @@ (gui-control-method-10 () none 10) (gui-control-method-11 () none 11) (gui-control-method-12 () none 12) - (gui-control-method-13 () none 13) + (update (_type_ symbol) none 13) (gui-control-method-14 () none 14) (gui-control-method-15 () none 15) (gui-control-method-16 () none 16) @@ -11052,16 +11550,13 @@ (gui-control-method-24 () none 24) ) ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ambient-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype talker-speech-class (structure) - ((name basic :offset-assert 0) + ((name string :offset-assert 0) (channel uint8 :offset-assert 4) (flags uint8 :offset-assert 5) (speech uint16 :offset-assert 6) @@ -11072,6 +11567,7 @@ (neg uint16 :offset-assert 18) (on-close basic :offset-assert 20) ) + :pack-me :method-count-assert 14 :size-assert #x18 :flag-assert #xe00000018 @@ -11084,72 +11580,92 @@ (talker-speech-class-method-13 () none 13) ) ) -|# -#| (deftype talker (process) - ((trans vector :inline :offset-assert 124) - (message talker-speech-class :offset-assert 140) - (total-time time-frame :offset-assert 148) - (total-off-time time-frame :offset-assert 156) - (start-time time-frame :offset-assert 164) - (state-time time-frame :offset-assert 172) - (voicebox uint64 :offset-assert 180) - (voice-id uint32 :offset-assert 188) - (message-id uint32 :offset-assert 192) - (region region :offset-assert 196) - (interp float :offset-assert 200) - (save? basic :offset-assert 204) + ((trans vector :inline :offset-assert 128) + (message talker-speech-class :offset-assert 144) + (total-time time-frame :offset-assert 152) + (total-off-time time-frame :offset-assert 160) + (start-time time-frame :offset-assert 168) + (state-time time-frame :offset-assert 176) + (voicebox uint64 :offset-assert 184) + (voice-id uint32 :offset-assert 192) + (message-id uint32 :offset-assert 196) + (region region :offset-assert 200) + (interp float :offset-assert 204) + (save? basic :offset-assert 208) ) :method-count-assert 18 :size-assert #xd4 :flag-assert #x12006000d4 (:methods - (talker-method-9 () none 9) - (talker-method-10 () none 10) - (talker-method-11 () none 11) - (talker-method-12 () none 12) - (talker-method-13 () none 13) (talker-method-14 () none 14) (talker-method-15 () none 15) (talker-method-16 () none 16) (talker-method-17 () none 17) ) ) -|# -;; (define-extern *talker-speech* object) +(define-extern *talker-speech* talker-speech-class) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; speech-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum speech-type-flag + :type uint8 + :bitfield #t + (random-order 0) + ) + (deftype speech-type-info (structure) - () + ((channel uint8) + (flags speech-type-flag) + (priority int8) + (request-timeout uint16) + (min-delay uint16) + (max-delay uint16) + (delay uint16) + (play-index int16) + (list basic) + ) :method-count-assert 9 :size-assert #x14 :flag-assert #x900000014 ;; Failed to read fields. ) -|# -#| (deftype speech-request (structure) ((handle uint64 :offset-assert 0) (time time-frame :offset-assert 8) (priority float :offset-assert 16) (speech-type int8 :offset-assert 20) ) + :pack-me :method-count-assert 9 :size-assert #x15 :flag-assert #x900000015 ) -|# -#| +(defenum speech-channel-flag + :type uint8 + :bitfield #t + (disable 0) + ) + (deftype speech-channel (structure) - () + ((flags speech-channel-flag) + (gui-channel gui-channel) + (delay uint16) + (id uint32) + (update-time time-frame :offset-assert 8) + (start-time time-frame) + (end-time time-frame) + (request speech-request :inline) + (last-request speech-request :inline) + (target-pos vector :inline) + (speech-table uint32) + ) :method-count-assert 14 :size-assert #x64 :flag-assert #xe00000064 @@ -11162,12 +11678,11 @@ (speech-channel-method-13 () none 13) ) ) -|# -#| + (deftype speech-control (structure) - ((channel-array UNKNOWN 2 :offset-assert 0) - (speech-table UNKNOWN 57 :offset-assert 224) + ((channel-array speech-channel 2 :inline :offset-assert 0) + (speech-table uint32 57 :offset-assert 224) ;; guess ) :method-count-assert 17 :size-assert #x1c4 @@ -11183,31 +11698,28 @@ (speech-control-method-16 () none 16) ) ) -|# + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; wind-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype wind-vector (structure) ((wind-pos vector4w :inline :offset-assert 0) ;; vector2w :inline (wind-vel vector4w :inline :offset-assert 16) ;; vector2w :inline - (stiffness float :offset-assert 28) + (stiffness float :offset 28) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype wind-work (basic) - ((wind-array vector 64 :offset-assert 16) ;; guessed by decompiler + ((wind-array vector 64 :inline :offset-assert 16) ;; guessed by decompiler (wind-normal vector :inline :offset-assert 1040) (wind-temp vector :inline :offset-assert 1056) - (wind-force float 64 :offset-assert 1072) ;; guessed by decompiler + (wind-force float 64 :offset-assert 1072) ;; guessed by decompiler (wind-const vector :inline :offset-assert 1328) (wind-time uint32 :offset-assert 1344) (wait-to-vu0 uint32 :offset-assert 1348) @@ -11223,33 +11735,29 @@ (last-mem uint32 :offset-assert 1388) (next-spr uint32 :offset-assert 1392) (last-spr uint32 :offset-assert 1396) - (to-ptrs UNKNOWN 3 :offset-assert 1400) + (to-ptrs uint32 3 :offset-assert 1400) ) :method-count-assert 9 :size-assert #x584 :flag-assert #x900000584 ) -|# -#| (deftype wind-dma (structure) - ((buffer0 UNKNOWN 128 :offset-assert 0) - (buffer1 UNKNOWN 128 :offset-assert 4096) - (buffer2 UNKNOWN 128 :offset-assert 8192) + ((buffer0 wind-vector 128 :inline :offset-assert 0) + (buffer1 wind-vector 128 :inline :offset-assert 4096) + (buffer2 wind-vector 128 :inline :offset-assert 8192) ) :method-count-assert 9 :size-assert #x3000 :flag-assert #x900003000 ) -|# -;; (define-extern *wind-scales* array) ;; (array uint8) +(define-extern *wind-scales* (array uint8)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; prototype-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype prototype-bucket (basic) ((name string :offset-assert 4) ;; guessed by decompiler (flags uint16 :offset-assert 8) ;; uint32 @@ -11259,41 +11767,38 @@ (geometry drawable 4 :offset-assert 16) ;; guessed by decompiler (dists vector :inline :offset-assert 32) (rdists vector :inline :offset-assert 48) - (near-plane meters :offset-assert 32) - (near-stiff meters :offset-assert 36) - (mid-plane meters :offset-assert 40) - (far-plane meters :offset-assert 44) - (rlength-near float :offset-assert 48) - (rlength-stiff float :offset-assert 52) - (rlength-mid float :offset-assert 56) - (stiffness float :offset-assert 60) + (near-plane meters :offset 32) + (near-stiff meters :offset 36) + (mid-plane meters :offset 40) + (far-plane meters :offset 44) + (rlength-near float :offset 48) + (rlength-stiff float :offset 52) + (rlength-mid float :offset 56) + (stiffness float :offset 60) ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype prototype-bucket-shrub (prototype-bucket) ((next uint32 4 :offset-assert 64) ;; guessed by decompiler (count uint16 4 :offset-assert 80) ;; guessed by decompiler (mod-count uint16 4 :offset-assert 88) ;; guessed by decompiler (last dma-packet 4 :offset-assert 96) ;; guessed by decompiler - (next-clear uint128 :offset-assert 64) - (count-clear uint64 :offset-assert 80) - (last-clear uint128 :offset-assert 96) + (next-clear uint128 :offset 64) + (count-clear uint64 :offset 80) + (last-clear uint128 :offset 96) ) :method-count-assert 9 :size-assert #x70 :flag-assert #x900000070 ) -|# -#| (deftype prototype-inline-array-shrub (drawable) - ((length int16 :offset-assert 6) - (data prototype-bucket-shrub 1 :offset-assert 36) ;; guessed by decompiler + ((length int16 :offset 6) + (data prototype-bucket-shrub 1 :inline :offset 32) ;; guessed by decompiler + (_pad uint32) ) :method-count-assert 17 :size-assert #x94 @@ -11301,9 +11806,7 @@ (:methods ) ) -|# -#| (deftype prototype-array-shrub-info (basic) ((prototype-inline-array-shrub prototype-inline-array-shrub :offset-assert 4) ;; guessed by decompiler (wind-vectors uint32 :offset-assert 8) @@ -11313,9 +11816,9 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| +(declare-type prototype-tie drawable) + (deftype prototype-bucket-tie (prototype-bucket) ((next uint32 12 :offset-assert 64) ;; guessed by decompiler (count uint16 12 :offset-assert 112) ;; guessed by decompiler @@ -11332,94 +11835,89 @@ (tie-colors time-of-day-palette :offset-assert 180) ;; guessed by decompiler (data uint32 :dynamic :offset-assert 184) ;; guessed by decompiler (color-index-qwc uint32 :dynamic :offset-assert 184) ;; guessed by decompiler - (scissor-frag-count uint8 :offset-assert 136) - (near-frag-count uint8 :offset-assert 137) - (mid-frag-count uint8 :offset-assert 138) - (far-frag-count uint8 :offset-assert 139) - (scissor-index-start uint8 :offset-assert 140) - (near-index-start uint8 :offset-assert 141) - (mid-index-start uint8 :offset-assert 142) - (far-index-start uint8 :offset-assert 143) - (scissor-base-qw uint16 :offset-assert 144) - (near-base-qw uint16 :offset-assert 146) - (mid-base-qw uint16 :offset-assert 148) - (far-base-qw uint16 :offset-assert 150) - (tie-next UNKNOWN 4 :offset-assert 64) - (tie-scissor-next uint32 :offset-assert 64) - (tie-near-next uint32 :offset-assert 68) - (tie-mid-next uint32 :offset-assert 72) - (tie-far-next uint32 :offset-assert 76) - (trans-next UNKNOWN 4 :offset-assert 64) - (trans-scissor-next UNKNOWN 4 :offset-assert 64) - (trans-near-next uint32 :offset-assert 68) - (trans-mid-next uint32 :offset-assert 72) - (trans-far-next uint32 :offset-assert 76) - (water-next UNKNOWN 4 :offset-assert 64) - (water-scissor-next UNKNOWN 4 :offset-assert 64) - (water-near-next uint32 :offset-assert 68) - (water-mid-next uint32 :offset-assert 72) - (water-far-next uint32 :offset-assert 76) - (envmap-next UNKNOWN 4 :offset-assert 80) - (envmap-scissor-next UNKNOWN 4 :offset-assert 80) - (envmap-near-next uint32 :offset-assert 84) - (envmap-mid-next uint32 :offset-assert 88) - (envmap-far-next uint32 :offset-assert 92) - (generic-next uint32 3 :offset-assert 96) ;; guessed by decompiler - (generic-near-next uint32 :offset-assert 96) - (generic-mid-next uint32 :offset-assert 100) - (generic-far-next uint32 :offset-assert 104) - (vanish-next uint32 :offset-assert 108) - (tie-count UNKNOWN 4 :offset-assert 112) - (tie-scissor-count uint16 :offset-assert 112) - (tie-near-count uint16 :offset-assert 114) - (tie-mid-count uint16 :offset-assert 116) - (tie-far-count uint16 :offset-assert 118) - (trans-count UNKNOWN 4 :offset-assert 112) - (trans-scissor-count uint16 :offset-assert 112) - (trans-near-count uint16 :offset-assert 114) - (trans-mid-count uint16 :offset-assert 116) - (trans-far-count uint16 :offset-assert 118) - (water-count UNKNOWN 4 :offset-assert 112) - (water-scissor-count uint16 :offset-assert 112) - (water-near-count uint16 :offset-assert 114) - (water-mid-count uint16 :offset-assert 116) - (water-far-count uint16 :offset-assert 118) - (envmap-count UNKNOWN 4 :offset-assert 120) - (envmap-scissor-count uint16 :offset-assert 120) - (envmap-near-count uint16 :offset-assert 122) - (envmap-mid-count uint16 :offset-assert 124) - (envmap-far-count uint16 :offset-assert 126) - (generic-count uint16 3 :offset-assert 128) ;; guessed by decompiler - (generic-near-count uint16 :offset-assert 128) - (generic-mid-count uint16 :offset-assert 130) - (generic-far-count uint16 :offset-assert 132) - (vanish-count uint16 :offset-assert 134) - (next-clear uint128 3 :offset-assert 64) ;; guessed by decompiler - (count-clear uint64 3 :offset-assert 112) ;; guessed by decompiler + (scissor-frag-count uint8 :offset 136) + (near-frag-count uint8 :offset 137) + (mid-frag-count uint8 :offset 138) + (far-frag-count uint8 :offset 139) + (scissor-index-start uint8 :offset 140) + (near-index-start uint8 :offset 141) + (mid-index-start uint8 :offset 142) + (far-index-start uint8 :offset 143) + (scissor-base-qw uint16 :offset 144) + (near-base-qw uint16 :offset 146) + (mid-base-qw uint16 :offset 148) + (far-base-qw uint16 :offset 150) + (tie-next uint32 4 :offset 64) + (tie-scissor-next uint32 :offset 64) + (tie-near-next uint32 :offset 68) + (tie-mid-next uint32 :offset 72) + (tie-far-next uint32 :offset 76) + (trans-next uint32 4 :offset 64) + (trans-scissor-next uint32 4 :offset 64) + (trans-near-next uint32 :offset 68) + (trans-mid-next uint32 :offset 72) + (trans-far-next uint32 :offset 76) + (water-next uint32 4 :offset 64) + (water-scissor-next uint32 4 :offset 64) + (water-near-next uint32 :offset 68) + (water-mid-next uint32 :offset 72) + (water-far-next uint32 :offset 76) + (envmap-next uint32 4 :offset 80) + (envmap-scissor-next uint32 4 :offset 80) + (envmap-near-next uint32 :offset 84) + (envmap-mid-next uint32 :offset 88) + (envmap-far-next uint32 :offset 92) + (generic-next uint32 3 :offset 96) ;; guessed by decompiler + (generic-near-next uint32 :offset 96) + (generic-mid-next uint32 :offset 100) + (generic-far-next uint32 :offset 104) + (vanish-next uint32 :offset 108) + (tie-count uint16 4 :offset 112) + (tie-scissor-count uint16 :offset 112) + (tie-near-count uint16 :offset 114) + (tie-mid-count uint16 :offset 116) + (tie-far-count uint16 :offset 118) + (trans-count uint16 4 :offset 112) + (trans-scissor-count uint16 :offset 112) + (trans-near-count uint16 :offset 114) + (trans-mid-count uint16 :offset 116) + (trans-far-count uint16 :offset 118) + (water-count uint16 4 :offset 112) + (water-scissor-count uint16 :offset 112) + (water-near-count uint16 :offset 114) + (water-mid-count uint16 :offset 116) + (water-far-count uint16 :offset 118) + (envmap-count uint16 4 :offset 120) + (envmap-scissor-count uint16 :offset 120) + (envmap-near-count uint16 :offset 122) + (envmap-mid-count uint16 :offset 124) + (envmap-far-count uint16 :offset 126) + (generic-count uint16 3 :offset 128) ;; guessed by decompiler + (generic-near-count uint16 :offset 128) + (generic-mid-count uint16 :offset 130) + (generic-far-count uint16 :offset 132) + (vanish-count uint16 :offset 134) + (next-clear uint128 3 :offset 64) ;; guessed by decompiler + (count-clear uint64 3 :offset 112) ;; guessed by decompiler + ;; added + (tie-geom prototype-tie 4 :offset 16 :score 1) ) :method-count-assert 9 :size-assert #xb8 :flag-assert #x9000000b8 ) -|# -#| (deftype prototype-array-tie (array) - ((type type :offset-assert 0) ;; guessed by decompiler - (length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (content-type type :offset-assert 12) ;; guessed by decompiler + ((array-data prototype-bucket-tie :dynamic :offset 16) ;; NOTE - field added, not 100% positive on the type ) :method-count-assert 10 :size-assert #x10 :flag-assert #xa00000010 (:methods - (prototype-array-tie-method-9 () none 9) ;; (login (_type_) none 9) + (login (_type_) none 9) ) ) -|# -#| (deftype proxy-prototype-array-tie (basic) ((prototype-array-tie prototype-array-tie :offset-assert 4) ;; guessed by decompiler (wind-vectors uint32 :offset-assert 8) @@ -11430,14 +11928,12 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype instance (drawable) - ((bucket-index uint16 :offset-assert 6) + ((bucket-index uint16 :offset 6) (origin matrix4h :inline :offset-assert 32) - (flags uint16 :offset-assert 46) - (wind-index uint16 :offset-assert 62) + (flags uint16 :offset 46) + (wind-index uint16 :offset 62) ) :method-count-assert 17 :size-assert #x40 @@ -11445,27 +11941,49 @@ (:methods ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; joint-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum joint-control-command + :type int64 + (push 1) + (blend 2) + (eight 8) + (push1 19) + (stack 36) + (float 42) + (stack1 52) + ) + +(declare-type joint-control basic) (deftype joint-control-channel (structure) - () + ((parent joint-control :offset-assert 0) + (frame-group art-joint-anim :offset-assert 4) + (frame-num float :offset-assert 8) + (dist meters :offset-assert 12) + (num-func (function joint-control-channel float float float)) + (param float 3) + (frame-interp float 2) + (inspector-amount uint8) + (command joint-control-command) + (group-sub-index int8 :offset-assert 56) + (grou-size int8) + (eval-time uint32) + ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ;; Failed to read fields. ) -|# -#| + + (deftype top-anim-joint-control (basic) ((process uint32 :offset-assert 4) - (interp-select UNKNOWN 2 :offset-assert 8) + (interp-select uint64 2 :offset-assert 8) (base-anim basic :offset-assert 24) (base-anim-speed float :offset-assert 28) (base-anim-blend float :offset-assert 32) @@ -11494,11 +12012,40 @@ (top-anim-joint-control-method-12 () none 12) ) ) -|# -#| + +(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 + ) + (deftype joint-control (basic) - () + ((status joint-control-status) + (allocated-length uint8) + (active-channels uint8) + (root-channel uint32 :offset 16) + (blend-index uint8) + (active-frame-interp uint8) + (float-channels uint8) + (generate-frame-function function) + (prebind-function function) + (postbind-function function) + (effect basic) + (interp-select int64 2) + (top-anim basic) + (override basic) + (channel joint-control-channel :inline :dynamic) + ) :method-count-assert 12 :size-assert #x40 :flag-assert #xc00000040 @@ -11510,20 +12057,16 @@ (joint-control-method-11 () none 11) ) ) -|# -#| (deftype matrix-stack (structure) ((top matrix :offset-assert 0) - (data matrix 24 :offset-assert 16) ;; guessed by decompiler + (data matrix 24 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x610 :flag-assert #x900000610 ) -|# -#| (deftype channel-upload-info (structure) ((fixed joint-anim-compressed-fixed :offset-assert 0) (fixed-qwc int32 :offset-assert 4) @@ -11532,67 +12075,62 @@ (amount float :offset-assert 16) (interp float :offset-assert 20) ) + :pack-me :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype joint-work (structure) ((temp-mtx matrix :inline :offset-assert 0) (joint-stack matrix-stack :inline :offset-assert 64) (fix-jmp-table (function none) 16 :offset-assert 1616) ;; guessed by decompiler (frm-jmp-table (function none) 16 :offset-assert 1680) ;; guessed by decompiler (pair-jmp-table (function none) 16 :offset-assert 1744) ;; guessed by decompiler - (uploads channel-upload-info 24 :offset-assert 1808) ;; guessed by decompiler + (uploads channel-upload-info 24 :inline :offset-assert 1808) ;; guessed by decompiler (num-uploads int32 :offset-assert 2384) - (mtx-acc matrix 2 :offset-assert 2400) ;; guessed by decompiler - (tq-acc transformq 100 :offset-assert 2528) ;; guessed by decompiler + (mtx-acc matrix 2 :inline :offset-assert 2400) ;; guessed by decompiler + (tq-acc transformq 100 :inline :offset-assert 2528) ;; guessed by decompiler (jacp-hdr joint-anim-compressed-hdr :inline :offset-assert 7328) (fixed-data joint-anim-compressed-fixed :inline :offset-assert 7392) - (frame-data joint-anim-compressed-frame 2 :offset-assert 9600) ;; guessed by decompiler - (flatten-array float 576 :offset-assert 2400) ;; guessed by decompiler - (flattened vector 24 :offset-assert 2400) ;; guessed by decompiler + (frame-data joint-anim-compressed-frame 2 :inline :offset-assert 9600) ;; guessed by decompiler + (flatten-array float 576 :offset 2400) ;; guessed by decompiler + (flattened vector 24 :offset 2400) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x3640 :flag-assert #x900003640 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bones-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + (deftype bone-buffer (structure) - ((joint joint-anim-compressed-hdr 16 :offset-assert 0) ;; guessed by decompiler - (bone bone 16 :offset-assert 1024) ;; guessed by decompiler - (output UNKNOWN 16 :offset-assert 2304) + ((joint joint-anim-compressed-hdr 16 :inline :offset-assert 0) ;; guessed by decompiler + (bone bone 16 :inline :offset-assert 1024) ;; guessed by decompiler + ;; (output UNKNOWN 16 :offset-assert 2304) + (_pad uint8 #x800) ) :method-count-assert 9 :size-assert #x1100 :flag-assert #x900001100 ) -|# -#| (deftype bone-layout (structure) ((data uint16 8 :offset-assert 0) ;; guessed by decompiler - (joint joint 2 :offset-assert 0) ;; guessed by decompiler - (bone bone 2 :offset-assert 8) ;; guessed by decompiler - (output uint32 2 :offset-assert 16) ;; guessed by decompiler - (unused UNKNOWN 2 :offset-assert 24) + (joint joint 2 :offset 0) ;; guessed by decompiler + (bone bone 2 :offset 8) ;; guessed by decompiler + (output uint32 2 :offset 16) ;; guessed by decompiler + (unused uint32 2 :offset 24) ;; was "cache" in jak 1, but they removed this. ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype bone-regs (structure) ((dma-buf basic :offset-assert 0) (wait-count uint32 :offset-assert 4) @@ -11608,9 +12146,7 @@ :size-assert #x24 :flag-assert #x900000024 ) -|# -#| (deftype bone-work (structure) ((layout bone-layout :inline :offset-assert 0) (regs bone-regs :inline :offset-assert 32) @@ -11619,9 +12155,7 @@ :size-assert #x44 :flag-assert #x900000044 ) -|# -#| (deftype bone-debug (structure) ((time-ctr uint32 :offset-assert 0) (timing uint32 360 :offset-assert 4) ;; guessed by decompiler @@ -11630,22 +12164,40 @@ :size-assert #x5a4 :flag-assert #x9000005a4 ) -|# -#| (deftype bone-memory (structure) ((work bone-work :inline :offset-assert 0) - (buffer bone-buffer 2 :offset-assert 80) ;; guessed by decompiler + (buffer bone-buffer 2 :inline :offset-assert 80) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x2250 :flag-assert #x900002250 ) -|# -#| +(defenum bone-calc-flags + :type uint16 + :bitfield #t + (bncfl00 0) + (bncfl01 1) ;; use identity matrix in bone matrix calc instead of cam rot (effectively screen-space bones?) + (bncfl02 2) + (bncfl03 3) + (bncfl04 4) + (bncfl05 5) + (bncfl06 6) + (bncfl07 7) + (bncfl08 8) + (bncfl09 9) + (bncfl10 10) + (bncfl11 11) + (bncfl12 12) + (bncfl13 13) + (bncfl14 14) + (bncfl15 15) + ) + + (deftype bone-calculation (structure) - ((flags uint16 :offset-assert 0) ;; bone-calc-flags + ((flags bone-calc-flags :offset-assert 0) ;; bone-calc-flags (num-bones uint16 :offset-assert 2) (matrix-area (inline-array matrix) :offset-assert 4) ;; guessed by decompiler (joints (inline-array joint) :offset-assert 8) ;; guessed by decompiler @@ -11663,39 +12215,35 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; foreground-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype mercneric-chain (structure) ((first uint32 :offset-assert 0) (next uint32 :offset-assert 4) (state generic-bucket-state :inline :offset-assert 8) (vu1-bucket int32 :offset-assert 16) ) + :pack-me :method-count-assert 9 :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype merc-chain (structure) ((first dma-packet :offset-assert 0) (patch dma-packet :offset-assert 4) (vu1-bucket int32 :offset-assert 8) ) + :pack-me :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype foreground-bucket (structure) ((merc merc-chain :inline :offset-assert 0) (emerc merc-chain :inline :offset-assert 12) @@ -11705,30 +12253,25 @@ :size-assert #x2c :flag-assert #x90000002c ) -|# -#| (deftype foreground-level-buckets (structure) - ((data UNKNOWN 7 :offset-assert 0) + ((data foreground-bucket 7 :inline :offset-assert 0) ) :method-count-assert 9 :size-assert #x150 :flag-assert #x900000150 ) -|# -#| + (deftype foreground-bucket-grid (structure) - ((level-buckets UNKNOWN 7 :offset-assert 0) + ((level-buckets foreground-level-buckets 7 :inline :offset-assert 0) (warp-chain mercneric-chain :inline :offset-assert 2352) ) :method-count-assert 9 :size-assert #x944 :flag-assert #x900000944 ) -|# -#| (deftype foreground-regs (structure) ((dist float :offset-assert 0) (merc-used uint32 :offset-assert 4) @@ -11749,12 +12292,10 @@ :size-assert #x38 :flag-assert #x900000038 ) -|# -#| (deftype foreground-work (structure) ((regs foreground-regs :inline :offset-assert 0) - (draw-index-map UNKNOWN 7 :offset-assert 64) + (draw-index-map uint16 7 :offset 64) ;; ???? (grid foreground-bucket-grid :inline :offset-assert 80) (bounds sphere :inline :offset-assert 2464) (lights vu-lights :inline :offset-assert 2480) @@ -11765,9 +12306,7 @@ :size-assert #xa40 :flag-assert #x900000a40 ) -|# -#| (deftype texscroll-globals (structure) ((requests int32 :offset-assert 0) (effects merc-effect 32 :offset-assert 4) ;; guessed by decompiler @@ -11776,9 +12315,7 @@ :size-assert #x84 :flag-assert #x900000084 ) -|# -#| (deftype merc-effect-bucket-info (structure) ((color-fade rgba :offset-assert 0) ;; guessed by decompiler (merc-path uint8 :offset-assert 4) @@ -11786,27 +12323,24 @@ (disable-draw uint8 :offset-assert 6) (disable-envmap uint8 :offset-assert 7) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype merc-bucket-info (structure) ((light vu-lights :inline :offset-assert 0) (needs-clip int32 :offset-assert 112) (need-mercprime-if-merc int32 :offset-assert 116) (must-use-mercneric-for-clip int32 :offset-assert 120) - (effect merc-effect-bucket-info 64 :offset-assert 124) ;; guessed by decompiler + (effect merc-effect-bucket-info 64 :inline :offset-assert 124) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x27c :flag-assert #x90000027c ) -|# -#| (deftype foreground-globals (structure) ((foreground-grid foreground-bucket-grid :inline :offset-assert 0) (merc-bucket-info merc-bucket-info :inline :offset-assert 2384) @@ -11816,9 +12350,7 @@ :size-assert #xc54 :flag-assert #x900000c54 ) -|# -#| (deftype shadow-dma-packet (structure) ((tag generic-merc-tag :inline :offset-assert 0) (settings shadow-settings :inline :offset-assert 16) @@ -11830,33 +12362,41 @@ :size-assert #x90 :flag-assert #x900000090 ) -|# -;; (define-extern invalidate-cache-line function) ;; (function pointer int) -;; (define-extern *foreground* object) +(define-extern invalidate-cache-line (function pointer int)) +(define-extern *foreground* foreground-globals) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; engines ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *background-draw-engine* object) ;; engine -;; (define-extern *matrix-engine* object) ;; (array handle) -;; (define-extern *part-engine* object) -;; (define-extern *camera-engine* object) ;; engine -;; (define-extern *debug-engine* object) ;; engine -;; (define-extern *pad-engine* object) -;; (define-extern *lightning-engine* object) -;; (define-extern *hud-engine* object) -;; (define-extern *task-manager-engine* object) +(define-extern *background-draw-engine* engine) +(define-extern *matrix-engine* (array handle)) +(define-extern *part-engine* engine) +(define-extern *camera-engine* engine) ;; engine +(define-extern *debug-engine* engine) ;; engine +(define-extern *pad-engine* engine) +(define-extern *lightning-engine* engine) +(define-extern *hud-engine* engine) +(define-extern *task-manager-engine* engine) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; lightning-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum lightning-spec-flags + :type uint16 + :bitfield #t + (lsf0 0) + (lsf1 1) + (lsf2 2) + (lsf3 3) + (size-from-adjust-dist 4) + ) + (deftype lightning-spec (basic) - ((name basic :offset-assert 4) - (flags uint16 :offset-assert 8) + ((name string :offset-assert 4) + (flags lightning-spec-flags :offset-assert 8) (rand-func uint8 :offset-assert 10) (adjust-distance uint8 :offset-assert 11) (start-color uint32 :offset-assert 12) @@ -11881,18 +12421,24 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| +(defenum lightning-mode + :type uint8 + (lm0 0) + (lm1 1) + (lm2 2) + (lm3 3) + ) + (deftype lightning-state (structure) - ((mode uint8 :offset-assert 0) + ((mode lightning-mode :offset-assert 0) (counter float :offset-assert 4) (points-to-draw int32 :offset-assert 8) (box-size float :offset-assert 12) (gcf-control gcf-control :inline :offset-assert 16) - (line basic :offset-assert 128) - (meet basic :offset-assert 132) - (path basic :offset-assert 136) + (line vector-array :offset-assert 128) + (meet vector-array :offset-assert 132) + (path vector-array :offset-assert 136) (start-color uint32 :offset-assert 140) (end-color uint32 :offset-assert 144) ) @@ -11900,45 +12446,41 @@ :size-assert #x94 :flag-assert #x900000094 ) -|# -#| (deftype lightning-control (basic) - ((spec basic :offset-assert 4) - (process uint32 :offset-assert 8) + ((spec lightning-spec :offset-assert 4) + (process process :offset-assert 8) (state lightning-state :inline :offset-assert 16) ) :method-count-assert 14 :size-assert #xa4 :flag-assert #xe000000a4 (:methods - (lightning-control-method-9 () none 9) - (lightning-control-method-10 () none 10) - (lightning-control-method-11 () none 11) - (lightning-control-method-12 () none 12) - (lightning-control-method-13 () none 13) + (new (symbol type lightning-spec process float) _type_) + (change-mode (_type_ lightning-mode) lightning-mode 9) + (get-mode (_type_) lightning-mode 10) + (set-point (_type_ int vector) none 11) + (set-first-meet-point (_type_ vector) none 12) + (set-last-meet-point (_type_ vector) none 13) ) ) -|# -#| (deftype lightning-probe-vars (basic) ((src-joint-index uint32 :offset-assert 4) (next-spawn-time time-frame :offset-assert 8) (last-valid-time time-frame :offset-assert 16) - (point UNKNOWN 2 :offset-assert 32) - (start-pos vector :inline :offset-assert 32) - (end-pos vector :inline :offset-assert 48) - (probe-dirs uint32 :offset-assert 64) + (point vector 2 :inline :offset-assert 32) + (start-pos vector :inline :offset 32) + (end-pos vector :inline :offset 48) + (probe-dirs (inline-array vector) :offset-assert 64) ) :method-count-assert 9 :size-assert #x44 :flag-assert #x900000044 ) -|# -;; (define-extern lookup-lightning-spec-by-name function) -;; (define-extern *lightning-probe-vars* lightning-probe-vars) +(define-extern lookup-lightning-spec-by-name (function string lightning-spec)) +(define-extern *lightning-probe-vars* lightning-probe-vars) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; res-h ;; @@ -11958,6 +12500,22 @@ (declare-type entity-links structure) + + + +(define-extern *res-key-string* string) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; res ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(deftype res-tag-pair (uint64) + ((lo int32 :offset 0) + (hi int32 :offset 32) + ) + ;; made-up type + ) + (deftype res-lump (basic) ((length int32 :offset-assert 4) (allocated-length int32 :offset-assert 8) @@ -11972,84 +12530,53 @@ :flag-assert #x1600000020 ;; field extra uses ~A with a signed load (:methods - ;; (new (symbol type int int) _type_ 0) - (res-lump-method-9 () none 9) ;; (get-property-data (_type_ symbol symbol float pointer (pointer res-tag) pointer) pointer 9) - (res-lump-method-10 () none 10) ;; (get-property-struct (_type_ symbol symbol float structure (pointer res-tag) pointer) structure 10) - (res-lump-method-11 () none 11) ;; (get-property-value (_type_ symbol symbol float uint128 (pointer res-tag) pointer) uint128 11) - (res-lump-method-12 () none 12) ;; (get-property-value-float (_type_ symbol symbol float float (pointer res-tag) pointer) float 12) - (res-lump-method-13 () none 13) ;; (get-tag-index-data (_type_ int) pointer 13) - (res-lump-method-14 () none 14) ;; (get-tag-data (_type_ res-tag) pointer 14) - (res-lump-method-15 () none 15) ;; (allocate-data-memory-for-tag! (_type_ res-tag) res-tag 15) - (res-lump-method-16 () none 16) ;; (sort! (_type_) _type_ 16) - (res-lump-method-17 () none 17) ;; (add-data! (_type_ res-tag pointer) res-lump 17) - (res-lump-method-18 () none 18) ;; (add-32bit-data! (_type_ res-tag object) res-lump 18) - (res-lump-method-19 () none 19) ;; (lookup-tag-idx (_type_ symbol symbol float) res-tag-pair 19) - (res-lump-method-20 () none 20) ;; (make-property-data (_type_ float res-tag-pair pointer) pointer 20) - (res-lump-method-21 () none 21) ;; (get-curve-data! (_type_ curve symbol symbol float) symbol 21) + (new (symbol type int int) _type_ 0) + (get-property-data (_type_ symbol symbol float pointer (pointer res-tag) pointer) pointer :no-virtual 9) + (get-property-struct (_type_ symbol symbol float structure (pointer res-tag) pointer) structure :no-virtual 10) + (get-property-value (_type_ symbol symbol float uint128 (pointer res-tag) pointer) uint128 :no-virtual 11) + (get-property-value-float (_type_ symbol symbol float float (pointer res-tag) pointer) float :no-virtual 12) + (get-tag-index-data (_type_ int) pointer 13) + (get-tag-data (_type_ res-tag) pointer 14) + (allocate-data-memory-for-tag! (_type_ res-tag) res-tag 15) + (sort! (_type_) _type_ 16) + (add-data! (_type_ res-tag pointer) res-lump 17) + (add-32bit-data! (_type_ res-tag object) res-lump 18) + (lookup-tag-idx (_type_ symbol symbol float) res-tag-pair :no-virtual 19) + (make-property-data (_type_ float res-tag-pair pointer) pointer 20) + (get-curve-data! (_type_ curve symbol symbol float) symbol 21) ) ) - -;; (define-extern *res-key-string* object) ;; string - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; res ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#| -(deftype res-lump (basic) - () - :method-count-assert 22 - :size-assert #x20 - :flag-assert #x1600000020 - ;; Failed to read fields. - (:methods - ;; (new (symbol type int int) _type_ 0) - (res-lump-method-9 () none 9) ;; (get-property-data (_type_ symbol symbol float pointer (pointer res-tag) pointer) pointer 9) - (res-lump-method-10 () none 10) ;; (get-property-struct (_type_ symbol symbol float structure (pointer res-tag) pointer) structure 10) - (res-lump-method-11 () none 11) ;; (get-property-value (_type_ symbol symbol float uint128 (pointer res-tag) pointer) uint128 11) - (res-lump-method-12 () none 12) ;; (get-property-value-float (_type_ symbol symbol float float (pointer res-tag) pointer) float 12) - (res-lump-method-13 () none 13) ;; (get-tag-index-data (_type_ int) pointer 13) - (res-lump-method-14 () none 14) ;; (get-tag-data (_type_ res-tag) pointer 14) - (res-lump-method-15 () none 15) ;; (allocate-data-memory-for-tag! (_type_ res-tag) res-tag 15) - (res-lump-method-16 () none 16) ;; (sort! (_type_) _type_ 16) - (res-lump-method-17 () none 17) ;; (add-data! (_type_ res-tag pointer) res-lump 17) - (res-lump-method-18 () none 18) ;; (add-32bit-data! (_type_ res-tag object) res-lump 18) - (res-lump-method-19 () none 19) ;; (lookup-tag-idx (_type_ symbol symbol float) res-tag-pair 19) - (res-lump-method-20 () none 20) ;; (make-property-data (_type_ float res-tag-pair pointer) pointer 20) - (res-lump-method-21 () none 21) ;; (get-curve-data! (_type_ curve symbol symbol float) symbol 21) - ) - ) -|# - -;; (define-extern *res-static-buf* object) ;; pointer +(define-extern *res-static-buf* pointer) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; lights ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *light-hash-work* object) -;; (define-extern light-slerp function) ;; (function light light light float light) -;; (define-extern light-group-slerp function) ;; (function light-group light-group light-group float light-group) -;; (define-extern light-group-process! function) ;; (function vu-lights light-group vector vector none) -;; (define-extern *default-lights* object) ;; vu-lights -;; (define-extern vu-lights-default! function) ;; (function vu-lights vu-lights) -;; (define-extern init-light-hash function) -;; (define-extern light-hash-count-items function) +;; TODO skipped +;; some asm stuff, maybe needs mips2c. + +(define-extern *light-hash-work* light-hash-work) +(define-extern light-slerp (function light light light float light)) +(define-extern light-group-slerp (function light-group light-group light-group float light-group)) +(define-extern light-group-process! (function vu-lights light-group vector vector none)) +(define-extern *default-lights* vu-lights) +(define-extern vu-lights-default! (function vu-lights vu-lights)) +(define-extern init-light-hash (function none)) +(define-extern light-hash-count-items (function light-hash none)) ;; (define-extern light-hash-add-items function) -;; (define-extern reset-light-hash function) -;; (define-extern update-light-hash function) -;; (define-extern lookup-light-sphere-by-name function) -;; (define-extern light-hash-get-bucket-index function) +(define-extern reset-light-hash (function none)) +(define-extern update-light-hash (function light-hash none)) +(define-extern lookup-light-sphere-by-name (function string light-hash light-sphere)) +(define-extern light-hash-get-bucket-index (function light-hash vector int)) ;; (define-extern add-light-sphere-to-light-group function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; dynamics-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype dynamics (basic) - ((name basic :offset-assert 4) + ((name symbol :offset-assert 4) (gravity-max meters :offset-assert 8) (gravity-length meters :offset-assert 12) (gravity vector :inline :offset-assert 16) @@ -12061,87 +12588,248 @@ :size-assert #x38 :flag-assert #xa00000038 (:methods - (dynamics-method-9 () none 9) + (set-gravity-length (_type_ float) none 9) ) ) -|# -;; (define-extern time-to-apex function) ;; (function float float int) -;; (define-extern time-to-ground function) ;; (function float float float int) -;; (define-extern *standard-dynamics* dynamics) ;; dynamics +(define-extern time-to-apex (function float float int)) +(define-extern time-to-ground (function float float float int)) +(define-extern *standard-dynamics* dynamics) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; surface-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum surface-flag + :bitfield #t + :type uint32 + + (look-around 0) ;; 1 + (xz-local 1) ;; 2 + (smooth-collision 2) ;; 4 + (no-turn-around 3) ;; 8 + (turn-to-pad 4) ;; 16 + (turn-to-vel 5) ;; 32 + (no-jump 6) ;; 64 + (no-attack 7) ;; 128 + (no-hands 8) ;; 256 + (no-feet 9) ;; 512 + (check-edge 10) ;; 1024 + (air 11) ;; 2048 + (attack 12) ;; 4096 + (duck 13) ;; 8192 + (momentum 14) ;; 16384 + (turn-when-centered 15) ;; 32768 + + (turn-to-alt 16) ;; hi 1 + (spin 17) ;; hi 2 + (super 18) ;; hi 4 + (gun-inactive 19) ;; hi 8 + (gun-hide 20) ;; hi 16 + (gun-off 21) ;; hi 32 + (gun-fast-exit 22) ;; hi 64 + (gun-direct 23) ;; hi 128 + (gun-strafe 24) ;; hi 256 + (gun-no-twist 25) ;; hi 512 + (laser-hide 26) ;; hi 1024 + (no-board 27) ;; hi 2048 + (gun-turn-fast 28) ;; hi 4096 + ) + (deftype surface (basic) - () + ((name symbol) + ;(data float 30 :score -1) + (turnv float :offset-assert 8) + (turnvv float :offset-assert 12) + (tiltv float :offset-assert 16) + (tiltvv float :offset-assert 20) + + (transv-max float :offset-assert 24) + (target-speed float :offset-assert 28) + (seek0 float :offset-assert 32) + (seek90 float :offset-assert 36) + (seek180 float :offset-assert 40) + (fric float :offset-assert 44) + (nonlin-fric-dist float :offset-assert 48) + (slip-factor float :offset-assert 52) + (slide-factor float :offset-assert 56) + (slope-up-factor float :offset-assert 60) + (slope-down-factor float :offset-assert 64) + (slope-slip-angle float :offset-assert 68) + (impact-fric float :offset-assert 72) + (bend-factor float :offset-assert 76) + (bend-speed float :offset-assert 80) + (alignv float :offset-assert 84) + (slope-up-traction float :offset-assert 88) + (align-speed float :offset-assert 92) + + (slope-change-preserve float) + + (turnvf float :offset-assert 100) + (turnvvf float :offset-assert 104) + (tiltvf float :offset-assert 108) + (tiltvvf float :offset-assert 112) + (vel-turn float :offset-assert 116) + + ;; hook + (active-hook (function none) :offset 128) + (touch-hook (function none)) + (impact-hook function) + (mult-hook (function surface surface surface int none)) + (exit-hook function) + + ;; dataw + (mode symbol :offset-assert 148) + (flags surface-flag) + + (data float 30 :offset 8) + (hook function 4 :offset 128) + (dataw uint32 2 :offset 148) + + ) :method-count-assert 9 :size-assert #x9c :flag-assert #x90000009c ;; Failed to read fields. ) -|# -;; (define-extern calc-terminal-vel function) ;; (function float float float float) -;; (define-extern calc-terminal2-vel function) ;; (function float float float float float) -;; (define-extern calc-terminal4-vel function) ;; (function float float float float) -;; (define-extern surface-interp! function) ;; (function surface surface surface float surface) -;; (define-extern surface-mult! function) ;; (function surface surface surface surface) -;; (define-extern surface-clamp-speed function) ;; (function surface surface surface int none) -;; (define-extern *walk-mods* surface) ;; surface -;; (define-extern *walk-no-turn-mods* surface) ;; surface -;; (define-extern *turn-around-mods* surface) ;; surface -;; (define-extern *jump-mods* surface) ;; surface -;; (define-extern *double-jump-mods* surface) ;; surface -;; (define-extern *smack-jump-mods* surface) ;; surface -;; (define-extern *high-jump-mods* surface) ;; surface -;; (define-extern *launch-jump-mods* surface) ;; surface -;; (define-extern *forward-high-jump-mods* surface) ;; surface -;; (define-extern *flip-jump-mods* surface) ;; surface -;; (define-extern *forward-jump-mods* surface) ;; surface -;; (define-extern *forward-pole-jump-mods* surface) ;; surface -;; (define-extern *dark-jump-mods* object) -;; (define-extern *roll-mods* surface) -;; (define-extern *roll-flip-mods* surface) -;; (define-extern *flop-mods* surface) ;; surface -;; (define-extern *flop-land-mods* object) ;; surface -;; (define-extern *wade-mods* surface) ;; surface -;; (define-extern *swim-mods* surface) ;; surface -;; (define-extern *dive-mods* surface) ;; surface -;; (define-extern *dive-bottom-mods* surface) ;; surface -;; (define-extern *pole-mods* object) ;; surface -;; (define-extern *grab-mods* object) ;; surface -;; (define-extern *edge-grab-mods* object) ;; surface -;; (define-extern *empty-mods* surface) ;; surface -;; (define-extern *neutral-mods* surface) ;; surface -;; (define-extern *stone-surface* surface) ;; surface -;; (define-extern *gravel-surface* surface) -;; (define-extern *edge-surface* surface) ;; surface -;; (define-extern *wade-surface* surface) ;; surface -;; (define-extern *quicksand-surface* surface) ;; surface -;; (define-extern *tar-surface* surface) ;; surface -;; (define-extern *ice-surface* surface) ;; surface -;; (define-extern *rail-surface* surface) -;; (define-extern *standard-ground-surface* object) ;; surface -;; (define-extern *swim-surface* object) ;; surface +(define-extern calc-terminal-vel (function float float float float)) +(define-extern calc-terminal2-vel (function float float float float float)) +(define-extern calc-terminal4-vel (function float float float float)) +(define-extern surface-interp! (function surface surface surface float surface)) +(define-extern surface-mult! (function surface surface surface surface)) +(define-extern surface-clamp-speed (function surface surface surface int none)) +(define-extern *walk-mods* surface) +(define-extern *walk-no-turn-mods* surface) +(define-extern *turn-around-mods* surface) +(define-extern *jump-mods* surface) +(define-extern *double-jump-mods* surface) +(define-extern *smack-jump-mods* surface) +(define-extern *high-jump-mods* surface) +(define-extern *launch-jump-mods* surface) +(define-extern *forward-high-jump-mods* surface) +(define-extern *flip-jump-mods* surface) +(define-extern *forward-jump-mods* surface) +(define-extern *forward-pole-jump-mods* surface) +(define-extern *dark-jump-mods* surface) +(define-extern *roll-mods* surface) +(define-extern *roll-flip-mods* surface) +(define-extern *flop-mods* surface) +(define-extern *flop-land-mods* surface) +(define-extern *wade-mods* surface) +(define-extern *swim-mods* surface) +(define-extern *dive-mods* surface) +(define-extern *dive-bottom-mods* surface) +(define-extern *pole-mods* surface) +(define-extern *grab-mods* surface) +(define-extern *edge-grab-mods* surface) +(define-extern *empty-mods* surface) +(define-extern *neutral-mods* surface) +(define-extern *stone-surface* surface) +(define-extern *gravel-surface* surface) +(define-extern *edge-surface* surface) +(define-extern *wade-surface* surface) +(define-extern *quicksand-surface* surface) +(define-extern *tar-surface* surface) +(define-extern *ice-surface* surface) +(define-extern *rail-surface* surface) +(define-extern *standard-ground-surface* surface) +(define-extern *swim-surface* surface) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; pat-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum pat-mode + :type uint8 + (ground 0) + (wall 1) + (obstacle 2) + (halfpipe 3) + ) + +(defenum pat-material + :type uint8 + (unknown 0) + (ice 1) + (quicksand 2) + (waterbottom 3) + (tar 4) + (sand 5) + (wood 6) + (grass 7) + (pcmetal 8) + (snow 9) + (deepsnow 10) + (hotcoals 11) + (lava 12) + (crwood 13) + (gravel 14) + (dirt 15) + (metal 16) + (straw 17) + (tube 18) + (swamp 19) + (stopproj 20) + (rotate 21) + (neutral 22) + (stone 23) + (crmetal 24) + (carpet 25) + (grmetal 26) + (shmetal 27) + (hdwood 28) + ) + +(defenum pat-event + :type uint8 + (none 0) + (deadly 1) + (endlessfall 2) + (burn 3) + (deadlup 4) + (burnup 5) + (melt 6) + (slide 7) + (lip 8) + (lipramp 9) + (shock 10) + (shockup 11) + (hide 12) + (rail 13) + (slippery 14) + ) + (deftype pat-surface (uint32) - () + ((skip uint8 :offset 0 :size 7 :do-not-decompile) + (mode pat-mode :offset 7 :size 3) + (material pat-material :offset 10 :size 6) + (camera uint8 :offset 16 :size 1 :do-not-decompile) ;; sz = 2?? + (event pat-event :offset 18 :size 6) + (skip2 uint8 :offset 24 :size 5 :do-not-decompile) + + (noentity uint8 :offset 0 :size 1) + (nocamera uint8 :offset 1 :size 1) + (noedge uint8 :offset 2 :size 1) + (nogrind uint8 :offset 3 :size 1) + (nojak uint8 :offset 4 :size 1) + (noboard uint8 :offset 5 :size 1) + (nopilot uint8 :offset 6 :size 1) + + (probe uint8 :offset 24 :size 1) + (nomech uint8 :offset 25 :size 1) + (noproj uint8 :offset 26 :size 1) + (noendlessfall uint8 :offset 27 :size 1) + (noprobe uint8 :offset 28 :size 1) + + (nolineofsight uint8 :offset 16 :size 1) + ) :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ;; Failed to read some fields. ) -|# -#| (deftype pat-mode-info (structure) ((name string :offset-assert 0) ;; guessed by decompiler (wall-angle float :offset-assert 4) @@ -12152,18 +12840,56 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -;; (define-extern pat-material->string function) ;; (function pat-surface string) -;; (define-extern pat-mode->string function) ;; (function pat-surface string) -;; (define-extern pat-event->string function) ;; (function pat-surface string) -;; (define-extern *pat-mode-info* object) ;; (inline-array pat-mode-info) + +(define-extern pat-material->string (function pat-surface string)) +(define-extern pat-mode->string (function pat-surface string)) +(define-extern pat-event->string (function pat-surface string)) +(define-extern *pat-mode-info* (inline-array pat-mode-info)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; fact-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum pickup-type + :bitfield #f + :type int32 + (none 0) + (eco-yellow 1) + (eco-red 2) + (eco-blue 3) + (eco-dark 4) + (eco-green 5) + (eco-pill-green 6) + (eco-pill-dark 7) + (eco-pill-random 8) + (money 9) + (fuel-cell 10) + (buzzer 11) + (darkjak 12) + (ammo-yellow 13) + (ammo-red 14) + (ammo-blue 15) + (ammo-dark 16) + (shield 17) + (health 18) + (trick-point 19) + (trick-judge 20) + (gem 21) + (skill 22) + (karma 23) + (gun-red 24) + (gun-yellow 25) + (gun-blue 26) + (gun-dark 27) + (board 28) + (pass-red 29) + (pass-green 30) + (pass-yellow 31) + (pass-blue 32) + (ammo-random 33) + ) + (deftype fact-bank (basic) ((eco-level-max float :offset-assert 4) (eco-single-inc float :offset-assert 8) @@ -12204,27 +12930,98 @@ :size-assert #xa0 :flag-assert #x9000000a0 ) -|# -#| +(defenum actor-option + :bitfield #t + :type uint64 + + (blocked 0) ;; 1 + (spawns-fuel-cell 1) ;; 2 + (draw-blocker 2) ;; 4 + (loop 3) ;; 8 + (reflect 4) ;; 16 + (wait-for-cue 5) ;; 32 + (auto-pickup 6) ;; 64 + (fuel-cell-no-jump 7) ;; 128 + (suck-in 8) ;; 256 + (fade-out 9) ;; 512 + (big-collision 10) ;; 1024 + (racer-only 11) ;; 2048 + (no-reaction 12) ;; 4096 + (no-shadow 13) ;; 8192 + (wait-for-task-complete 14) ;; 16384 + (respawn-delay 15) ;; 32768 + + (no-amb-sound 16) ;; hi 1 + (user17 17) ;; hi 2 + (user18 18) ;; hi 4 + (user19 19) ;; hi 8 + (user20 20) ;; hi 16 + (cond-hide 21) ;; hi 32 + (cond-respawn 22) ;; hi 64 + (fall 23) ;; hi 128 + (mirror 24) ;; hi 256 + (cond-low-ammo 25) ;; hi 512 + (no-distance-check-fadeout 26) ;; 1024 + (no-track 27) ;; hi 2048 + ) + (deftype fact-info (basic) - () + ((process process :offset-assert 4) + (pickup-type pickup-type :offset-assert 8) + (pickup-amount float :offset-assert 12) + (pickup-spawn-amount float :offset-assert 16) + (options actor-option :offset-assert 24) + (fade-time time-frame :offset-assert 32) + ) :method-count-assert 12 :size-assert #x28 :flag-assert #xc00000028 ;; Failed to read fields. (:methods - ;; (new (symbol type process-drawable pickup-type float) _type_ 0) + (new (symbol type process pickup-type float) _type_ 0) (fact-info-method-9 () none 9) ;; (drop-pickup (_type_ symbol process-tree fact-info int) (pointer process) 9) - (fact-info-method-10 () none 10) ;; (reset! (_type_ symbol) none 10) - (fact-info-method-11 () none 11) ;; (pickup-collectable! (_type_ pickup-type float handle) float 11) + (reset! (_type_ symbol) none 10) + (pickup-collectable! (_type_ pickup-type float handle) float 11) ) ) -|# -#| (deftype fact-info-target (fact-info) - () + ((eco-type int32) + (eco-level float) + (eco-pickup-time time-frame) + (eco-timeout time-frame) + (eco-source uint64) + (eco-source-time time-frame) + (health float) + (health-max float) + (health-pickup-time time-frame) + (buzzer float) + (buzzer-max float) + (eco-pill-green float) + (eco-pill-green-max float) + (eco-pill-green-pickup-time time-frame) + (eco-pill-dark-pickup-time time-frame) + (money-pickup-time time-frame) + (buzzer-pickup-time time-frame) + (task-pickup-time time-frame) + (stop-time-timeout time-frame) + (darkjak-start-time time-frame) + (darkjak-effect-time time-frame) + (ammo-pickup-time time-frame) + (shield-pickup-time time-frame) + (shield-start-time time-frame) + (shield-use-time time-frame) + (shield-level float) + (shield-attack-id uint32) + (trick-point float) + (trick-point-pickup-time time-frame) + (trick-point-start-time time-frame) + (trick-point-duration time-frame) + (gem-pickup-time time-frame) + (skill-pickup-time time-frame) + (karma-pickup-time time-frame) + ) :method-count-assert 13 :size-assert #x110 :flag-assert #xd00000110 @@ -12234,25 +13031,65 @@ (fact-info-target-method-12 () none 12) ) ) -|# -#| +(defenum enemy-option + :bitfield #t + :type uint32 + (user0 0) ;; 1 + (user1 1) ;; 2 + (user2 2) ;; 4 + (user3 3) ;; 8 + (user4 4) ;; 16 + (user5 5) ;; 32 + (user6 6) ;; 64 + (user7 7) ;; 128 + (user8 8) ;; 256 + (user9 9) ;; 512 + (user10 10) ;; 1024 + (user11 11) ;; 2048 + (user12 12) ;; 4096 + (user13 13) ;; 8192 + (user14 14) ;; 16k + (user15 15) + + (dormant 16) ;; hi 1 + (dormant-aware 17) ;; hi 2 + (ambush 18) ;; hi 4 + (spawner 19) ;; hi 8 + (prespawned 20) ;; hi 16 + (multi-focus 21) ;; hi 32 + (has-trigger 22) + (idle-til-trigger 23) ;; hi 128 + (knocked-into-water 24) ;; hi 256 + (water 25) ;; hi 512 + ) + (deftype fact-info-enemy (fact-info) - () + ((speed float) + (idle-distance meters) + (notice-top meters) + (notice-bottom meters) + (cam-horz meters) + (cam-vert meters) + (cam-notice-dist meters) + (enemy-options enemy-option) + (trig-dist meters) + (trig-actor-group uint32) + (trig-mask-count int8) + (trig-mask uint8 2) + ) :method-count-assert 13 :size-assert #x53 :flag-assert #xd00000053 ;; Failed to read fields. (:methods - ;; (new (symbol type process-drawable pickup-type float) _type_ 0) - (fact-info-enemy-method-12 () none 12) + (new (symbol type process (pointer float) pickup-type float) _type_ 0) + (clear-mask-bits (_type_ int) none 12) ) ) -|# -#| (deftype fact-info-crate (fact-info) - () + ((suck-count int32)) :method-count-assert 12 :size-assert #x2c :flag-assert #xc0000002c @@ -12260,9 +13097,7 @@ (:methods ) ) -|# -#| (deftype fact-info-enemy-defaults (basic) ((idle-distance meters :offset-assert 4) ) @@ -12270,33 +13105,57 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -;; (define-extern *FACT-bank* fact-bank) ;; fact-bank -;; (define-extern pickup-type->string function) ;; (function pickup-type string) -;; (define-extern *fact-info-enemy-defaults* fact-info-enemy-defaults) +(define-extern *FACT-bank* fact-bank) +(define-extern pickup-type->string (function pickup-type string)) +(define-extern *fact-info-enemy-defaults* fact-info-enemy-defaults) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; aligner-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(declare-type process-drawable process) + +(defenum align-flags + :bitfield #t + :type uint32 + (disabled) ;; keep object velocity + ) + +(defenum align-opts + :bitfield #t + :type uint32 + (adjust-x-vel) + (adjust-y-vel) + (adjust-xz-vel) + (keep-other-velocities) + (adjust-quat) ;; 16 + (alop0) + (alop1) + (alop2) + (alop3) + (alop4) + (alop5) + (no-gravity) + (ignore-y-if-zero) + ) + (deftype align-control (basic) ((flags align-flags :offset-assert 4) ;; guessed by decompiler (process process-drawable :offset-assert 8) ;; guessed by decompiler (frame-group art-joint-anim :offset-assert 12) ;; guessed by decompiler (frame-num float :offset-assert 16) - (matrix matrix 2 :offset-assert 32) ;; guessed by decompiler - (transform transform 2 :offset-assert 160) ;; guessed by decompiler + (matrix matrix 2 :inline :offset-assert 32) ;; guessed by decompiler + (transform transform 2 :inline :offset-assert 160) ;; guessed by decompiler (delta transformq :inline :offset-assert 256) (last-speed meters :offset-assert 304) - (align transformq :inline :offset-assert 160) + (align transformq :inline :offset 160) ) :method-count-assert 14 :size-assert #x134 :flag-assert #xe00000134 (:methods - ;; (new (symbol type process) _type_ 0) + (new (symbol type process) _type_ 0) (align-control-method-9 () none 9) ;; (compute-alignment! (_type_) transformq 9) (align-control-method-10 () none 10) ;; (align! (_type_ align-opts float float float) trsqv 10) (align-control-method-11 () none 11) ;; (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv 11) @@ -12304,49 +13163,91 @@ (align-control-method-13 () none 13) ;; (snd-transform (_type_) transform 13) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; penetrate-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern penetrate-using->damage function) -;; (define-extern penetrated-by-all&hit-points->penetrated-by function) +(defenum penetrate + :bitfield #t + :type uint64 + (touch 0) ;; 1 + (generic-attack 1) ;; 2 + (lunge 2) ;; 4 + (flop 3) ;; 8 + (punch 4) ;; 16 + (spin 5) ;; 32 + (roll 6) ;; 64 + (uppercut 7) ;; 128 + (bonk 8) ;; 256 + (tube 9) ;; 512 + (vehicle 10) ;; 1024 + (flut-attack 11) ;; 2048 + (board 12) ;; 4096 + (mech 13) ;; 8192 + (mech-punch 14) ;; 16384 + (mech-bonk 15) ;; 32768 + (dark-skin 16) ;; hi 1 + (dark-punch 17) ;; hi 2 + (dark-bomb 18) ;; hi 4 + (dark-giant 19) ;; hi 8 + (shield 20) ;; hi 16 + (explode 21) ;; hi 32 + (jak-yellow-shot 22) ;; hi 64 + (jak-red-shot 23) ;; hi 128 + (jak-blue-shot 24) ;; hi 256 + (jak-dark-shot 25) ;; hi 512 + (enemy-yellow-shot 26) ;; hi 1024 + (enemy-dark-shot 27) ;; hi 2048 + (eco-yellow 28) ;; hi 4096 + (eco-red 29) ;; hi 8192 + (eco-blue 30) ;; hi 16384 + (eco-green 31) ;; hi 32768 + (knocked 32) ;; hihi 1 + ) + +(define-extern penetrate-using->damage (function penetrate int)) +(define-extern penetrated-by-all&hit-points->penetrated-by (function penetrate int penetrate)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; game-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(declare-type nav-control structure) +(declare-type path-control basic) +(declare-type vol-control basic) +(declare-type actor-link-info basic) +(declare-type water-control basic) + +(defenum state-flags + :bitfield #t + :type uint32 + ) + (deftype process-drawable (process) - ((root trsqv :offset-assert 124) ;; guessed by decompiler - (node-list cspace-array :offset-assert 128) ;; guessed by decompiler - (draw draw-control :offset-assert 132) ;; guessed by decompiler - (skel joint-control :offset-assert 136) ;; guessed by decompiler - (nav nav-control :offset-assert 140) ;; guessed by decompiler - (align align-control :offset-assert 144) ;; guessed by decompiler - (path path-control :offset-assert 148) ;; guessed by decompiler - (vol vol-control :offset-assert 152) ;; guessed by decompiler - (fact fact-info :offset-assert 156) ;; guessed by decompiler - (link actor-link-info :offset-assert 160) ;; guessed by decompiler - (part sparticle-launch-control :offset-assert 164) ;; guessed by decompiler - (water water-control :offset-assert 168) ;; guessed by decompiler - (sound ambient-sound :offset-assert 172) ;; guessed by decompiler - (carry basic :offset-assert 176) - (rbody basic :offset-assert 180) - (state-flags state-flags :offset-assert 184) ;; guessed by decompiler - (state-time time-frame :offset-assert 188) ;; time-frame + ((root trsqv :offset-assert 128) ;; guessed by decompiler + (node-list cspace-array :offset-assert 132) ;; guessed by decompiler + (draw draw-control :offset-assert 136) ;; guessed by decompiler + (skel joint-control :offset-assert 140) ;; guessed by decompiler + (nav nav-control :offset-assert 144) ;; guessed by decompiler + (align align-control :offset-assert 148) ;; guessed by decompiler + (path path-control :offset-assert 152) ;; guessed by decompiler + (vol vol-control :offset-assert 156) ;; guessed by decompiler + (fact fact-info :offset-assert 160) ;; guessed by decompiler + (link actor-link-info :offset-assert 164) ;; guessed by decompiler + (part sparticle-launch-control :offset-assert 168) ;; guessed by decompiler + (water water-control :offset-assert 172) ;; guessed by decompiler + (sound ambient-sound :offset-assert 176) ;; guessed by decompiler + (carry basic :offset-assert 180) + (rbody basic :offset-assert 184) + (state-flags state-flags :offset-assert 188) ;; guessed by decompiler + (state-time time-frame :offset-assert 192) ;; time-frame ) :method-count-assert 20 :size-assert #xc8 :flag-assert #x14005000c8 (:methods - (process-drawable-method-9 () none 9) - (process-drawable-method-10 () none 10) - (process-drawable-method-11 () none 11) - (process-drawable-method-12 () none 12) - (process-drawable-method-13 () none 13) (process-drawable-method-14 () none 14) ;; (initialize-skeleton (_type_ skeleton-group pair) none 14) (process-drawable-method-15 () none 15) ;; (initialize-skeleton-by-name (_type_ string object) _type_ 15) (process-drawable-method-16 () none 16) ;; (apply-alignment (_type_ align-opts transformq vector) collide-shape 16) @@ -12355,9 +13256,7 @@ (process-drawable-method-19 () none 19) ;; (evaluate-joint-control (_type_) none 19) ) ) -|# -#| (deftype process-drawable-reserved (process-drawable) () :method-count-assert 178 @@ -12524,9 +13423,7 @@ (process-drawable-reserved-method-177 () none 177) ) ) -|# -#| (deftype attack-dir-info (structure) ((dir vector :inline :offset-assert 0) (xz-dir vector :inline :offset-assert 16) @@ -12537,11 +13434,61 @@ :size-assert #x40 :flag-assert #x900000040 ) -|# -#| +(defenum attack-info-mask + :bitfield #t + :type uint32 + (trans 0) ;; 1 + (vector 1) ;; 2 + (intersection 2) ;; 4 + (attacker 3) ;; 8 + (attack-time 4) ;; 16 + (invinc-time 5) ;; 32 + (mode 6) ;; 64 + (shove-back 7) ;; 128 + (shove-up 8) ;; 256 + (speed 9) ;; 512 + (dist 10) ;; 1024 + (control 11) ;; 2048 + (angle 12) ;; 4096 + (rotate-to 13) ;; 8192 + (prev-state 14) ;; 16384 + (id 15) ;; 32768 + (count 16) ;; hi 1 + (penetrate-using 17) ;; hi 2 + (attacker-velocity 18);; hi 4 + (damage 19) ;; hi 8 + (shield-damage 20) ;; hi16 + (knock 21) ;; hi 32 + (test 22) ;; hi 64 + ) + (deftype attack-info (structure) - () + ((trans vector :inline) + (vector vector :inline) + (attacker-velocity vector :inline) + (intersection vector :inline) + (attacker handle) + (attack-time time-frame) + (invinc-time time-frame) + (mask attack-info-mask) + (mode symbol) + (shove-back meters) + (shove-up meters) + (speed meters) + (dist meters) + (control float) + (angle symbol) + (rotate-to degrees) + (prev-state state) + (id uint32) + (count uint32) + (penetrate-using uint64) + (damage float) + (shield-damage float) + (knock uint8) + (test uint32) + ) :method-count-assert 12 :size-assert #xa0 :flag-assert #xc000000a0 @@ -12552,9 +13499,7 @@ (attack-info-method-11 () none 11) ) ) -|# -#| (deftype ground-tween-info (structure) ((chan uint8 3 :offset-assert 0) ;; guessed by decompiler (blend float 3 :offset-assert 4) ;; guessed by decompiler @@ -12564,14 +13509,12 @@ :size-assert #x24 :flag-assert #x900000024 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; script-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype script-form (structure) ((name basic :offset-assert 0) (spec basic :offset-assert 4) @@ -12584,29 +13527,36 @@ (script-form-method-9 () none 9) ) ) -|# -#| (deftype script-context (structure) - () + ((load-state load-state) + (key basic) + (process process) + (trans vector) + (side-effect? symbol) + (got-error? symbol) + (expr basic) + (param-count int32) + (param object 16) + (param-type object 16) + ) :method-count-assert 12 :size-assert #xa0 :flag-assert #xc000000a0 ;; Failed to read fields. (:methods + (new (symbol type basic process vector) _type_ 0) (script-context-method-9 () none 9) (script-context-method-10 () none 10) (script-context-method-11 () none 11) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; scene-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype scene-actor (basic) ((name basic :offset-assert 4) (level basic :offset-assert 8) @@ -12633,16 +13583,9 @@ (scene-actor-method-9 () none 9) ) ) -|# -#| (deftype scene (art-group) - ((name basic :offset-assert 8) - (length int32 :offset-assert 12) - (extra basic :offset-assert 16) - (info basic :offset-assert 4) - (data UNKNOWN :dynamic :offset-assert 32) - (mask-to-clear uint32 :offset-assert 32) + ((mask-to-clear uint32 :offset-assert 32) (entity basic :offset-assert 36) (art-group basic :offset-assert 40) (anim basic :offset-assert 44) @@ -12675,32 +13618,30 @@ (scene-method-16 () none 16) ) ) -|# -#| (deftype scene-player (process-drawable) - ((scene-list basic :offset-assert 196) - (scene basic :offset-assert 200) - (scene-index int32 :offset-assert 204) - (anim basic :offset-assert 208) - (next-anim basic :offset-assert 212) - (camera uint64 :offset-assert 220) - (main-entity basic :offset-assert 228) - (wait basic :offset-assert 232) - (old-target-pos transformq :inline :offset-assert 236) - (pre-cut-frame basic :offset-assert 284) - (preload-continue basic :offset-assert 288) - (dma-max uint32 :offset-assert 292) - (gui-id uint32 :offset-assert 296) - (aborted? basic :offset-assert 300) - (scene-start-time time-frame :offset-assert 308) - (targ-speed float :offset-assert 316) - (cur-speed float :offset-assert 320) - (speed-change-time time-frame :offset-assert 324) - (speed-press-time time-frame :offset-assert 332) - (speed-change-speed float :offset-assert 340) - (subtitle-change-time time-frame :offset-assert 348) - (user-sound UNKNOWN 4 :offset-assert 356) + ((scene-list basic :offset-assert 200) + (scene basic :offset-assert 204) + (scene-index int32 :offset-assert 208) + (anim basic :offset-assert 212) + (next-anim basic :offset-assert 216) + (camera uint64 :offset-assert 224) + (main-entity basic :offset-assert 232) + (wait basic :offset-assert 236) + (old-target-pos transformq :inline :offset-assert 240) + (pre-cut-frame basic :offset-assert 288) + (preload-continue basic :offset-assert 292) + (dma-max uint32 :offset-assert 296) + (gui-id uint32 :offset-assert 300) + (aborted? basic :offset-assert 304) + (scene-start-time time-frame :offset-assert 312) + (targ-speed float :offset-assert 320) + (cur-speed float :offset-assert 324) + (speed-change-time time-frame :offset-assert 328) + (speed-press-time time-frame :offset-assert 336) + (speed-change-speed float :offset-assert 344) + (subtitle-change-time time-frame :offset-assert 352) + (user-sound uint32 4 :offset-assert 360) ;; guess ) :method-count-assert 26 :size-assert #x178 @@ -12714,18 +13655,21 @@ (scene-player-method-25 () none 25) ) ) -|# -;; (define-extern *scene-player* object) +(define-extern *scene-player* scene-player) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sync-info-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum sync-flags + :type uint64 + :bitfield #t + ) + (deftype sync-info-params (structure) ((sync-type basic :offset-assert 0) - (sync-flags uint64 :offset-assert 8) + (sync-flags sync-flags :offset-assert 8) (entity basic :offset-assert 16) (period uint32 :offset-assert 20) (percent float :offset-assert 24) @@ -12738,11 +13682,9 @@ :size-assert #x2c :flag-assert #x90000002c ) -|# -#| (deftype sync-info (structure) - ((sync-flags uint64 :offset-assert 0) + ((sync-flags sync-flags :offset-assert 0) (offset float :offset-assert 8) (period uint32 :offset-assert 12) ) @@ -12759,9 +13701,7 @@ (sync-info-method-15 () none 15) ;; (load-params! (_type_ process uint float float float) symbol 15) ) ) -|# -#| (deftype sync-linear (sync-info) () :method-count-assert 16 @@ -12770,9 +13710,7 @@ (:methods ) ) -|# -#| (deftype sync-eased (sync-info) ((tlo float :offset-assert 16) (thi float :offset-assert 20) @@ -12788,9 +13726,7 @@ (:methods ) ) -|# -#| (deftype sync-paused (sync-info) ((pause-in float :offset-assert 16) (pause-out float :offset-assert 20) @@ -12801,9 +13737,7 @@ (:methods ) ) -|# -#| (deftype delayed-rand-float (structure) ((min-time int32 :offset-assert 0) (max-time int32 :offset-assert 4) @@ -12822,9 +13756,7 @@ (delayed-rand-float-method-12 () none 12) ) ) -|# -#| (deftype oscillating-float (structure) ((value float :offset-assert 0) (target float :offset-assert 4) @@ -12841,9 +13773,7 @@ (oscillating-float-method-10 () none 10) ;; (update! (_type_ float) float 10) ) ) -|# -#| (deftype bouncing-float (structure) ((osc oscillating-float :inline :offset-assert 0) (max-value float :offset-assert 24) @@ -12861,9 +13791,7 @@ (bouncing-float-method-12 () none 12) ;; (at-max? (_type_) symbol 12) ) ) -|# -#| (deftype delayed-rand-vector (structure) ((min-time int32 :offset-assert 0) (max-time int32 :offset-assert 4) @@ -12883,9 +13811,7 @@ (delayed-rand-vector-method-12 () none 12) ;; (update-with-delay-or-reset! (_type_) vector 12) ) ) -|# -#| (deftype oscillating-vector (structure) ((value vector :inline :offset-assert 0) (target vector :inline :offset-assert 16) @@ -12902,23 +13828,29 @@ (oscillating-vector-method-10 () none 10) ;; (update! (_type_ vector) vector 10) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; pov-camera-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum pov-camera-flag + :bitfield #t + :type int32 + (notify-of-abort 0) + (allow-abort 1) + (inherit-orientation 2) + ) + (deftype pov-camera (process-drawable) - ((flags int32 :offset-assert 196) ;; pov-camera-flag - (debounce-start-time time-frame :offset-assert 204) ;; time-frame - (notify-handle uint64 :offset-assert 212) ;; handle - (anim-name string :offset-assert 220) ;; guessed by decompiler - (command-list pair :offset-assert 224) ;; guessed by decompiler - (mask-to-clear process-mask :offset-assert 228) ;; guessed by decompiler - (music-volume-movie float :offset-assert 232) - (sfx-volume-movie float :offset-assert 236) + ((flags pov-camera-flag :offset-assert 200) ;; pov-camera-flag + (debounce-start-time time-frame :offset-assert 208) ;; time-frame + (notify-handle uint64 :offset-assert 216) ;; handle + (anim-name string :offset-assert 224) ;; guessed by decompiler + (command-list pair :offset-assert 228) ;; guessed by decompiler + (mask-to-clear process-mask :offset-assert 232) ;; guessed by decompiler + (music-volume-movie float :offset-assert 236) + (sfx-volume-movie float :offset-assert 240) ) :method-count-assert 30 :size-assert #xf4 @@ -12936,14 +13868,12 @@ (pov-camera-method-29 () none 29) ;; (set-stack-size! (_type_) none 29) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; smush-control-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype smush-control (structure) ((start-time time-frame :offset-assert 0) ;; time-frame (period float :offset-assert 8) @@ -12957,22 +13887,20 @@ :size-assert #x20 :flag-assert #xf00000020 (:methods - (smush-control-method-9 () none 9) ;; (set-zero! (_type_) _type_ 9) - (smush-control-method-10 () none 10) ;; (update! (_type_) float 10) - (smush-control-method-11 () none 11) ;; (get-no-update (_type_) float 11) - (smush-control-method-12 () none 12) ;; (activate! (_type_ float int int float float) _type_ 12) - (smush-control-method-13 () none 13) ;; (nonzero-amplitude? (_type_) symbol 13) - (smush-control-method-14 () none 14) ;; (die-on-next-update! (_type_) _type_ 14) + (set-zero! (_type_) _type_ 9) + (update! (_type_) float 10) + (get-no-update (_type_) float 11) + (activate! (_type_ float int int float float clock) _type_ 12) + (nonzero-amplitude? (_type_) symbol 13) + (die-on-next-update! (_type_) _type_ 14) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; debug-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype pos-history (structure) ((points (inline-array vector) :offset-assert 0) ;; guessed by decompiler (num-points int32 :offset-assert 4) @@ -12983,9 +13911,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype debug-vertex (structure) ((trans vector4w :inline :offset-assert 0) (normal vector3h :inline :offset-assert 16) @@ -12996,50 +13922,102 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype debug-vertex-stats (basic) ((length int32 :offset-assert 4) (pos-count int32 :offset-assert 8) - (vertex debug-vertex 600 :offset-assert 16) ;; guessed by decompiler + (vertex debug-vertex 600 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x4b10 :flag-assert #x900004b10 ) -|# -;; (define-extern *color-black* object) ;; rgba -;; (define-extern *color-white* object) ;; rgba -;; (define-extern *color-gray* object) ;; rgba -;; (define-extern *color-red* object) ;; rgba -;; (define-extern *color-green* object) ;; rgba -;; (define-extern *color-blue* object) ;; rgba -;; (define-extern *color-cyan* object) ;; rgba -;; (define-extern *color-magenta* object) ;; rgba -;; (define-extern *color-yellow* object) ;; rgba -;; (define-extern *color-light-red* object) ;; rgba -;; (define-extern *color-light-green* object) ;; rgba -;; (define-extern *color-light-blue* object) ;; rgba -;; (define-extern *color-light-cyan* object) ;; rgba -;; (define-extern *color-light-magenta* object) ;; rgba -;; (define-extern *color-light-yellow* object) ;; rgba -;; (define-extern *color-dark-red* object) ;; rgba -;; (define-extern *color-dark-green* object) ;; rgba -;; (define-extern *color-dark-blue* object) ;; rgba -;; (define-extern *color-dark-cyan* object) ;; rgba -;; (define-extern *color-dark-magenta* object) ;; rgba -;; (define-extern *color-dark-yellow* object) ;; rgba -;; (define-extern *color-orange* object) ;; rgba +(define-extern *color-black* rgba) +(define-extern *color-white* rgba) +(define-extern *color-gray* rgba) +(define-extern *color-red* rgba) +(define-extern *color-green* rgba) +(define-extern *color-blue* rgba) +(define-extern *color-cyan* rgba) +(define-extern *color-magenta* rgba) +(define-extern *color-yellow* rgba) +(define-extern *color-light-red* rgba) +(define-extern *color-light-green* rgba) +(define-extern *color-light-blue* rgba) +(define-extern *color-light-cyan* rgba) +(define-extern *color-light-magenta* rgba) +(define-extern *color-light-yellow* rgba) +(define-extern *color-dark-red* rgba) +(define-extern *color-dark-green* rgba) +(define-extern *color-dark-blue* rgba) +(define-extern *color-dark-cyan* rgba) +(define-extern *color-dark-magenta* rgba) +(define-extern *color-dark-yellow* rgba) +(define-extern *color-orange* rgba) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; joint-mod-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum joint-mod-mode + :bitfield #f + :type uint32 + + ) + +(defenum track-mode + :bitfield #t + :type uint16 + (track-on 0) ;; 1 + (track-x 1) ;; 2 + (track-y 2) ;; 4 + (lock-on 3) ;; 8 + (no-trans 4) ;; 16 + (no-rotate 5) ;; 32 + (no-scale 6) ;; 64 + ) + (deftype joint-mod (basic) - () + ((mode joint-mod-mode) + (process process) + (joint cspace) + (target vector :inline :offset 16) + (twist vector :inline :offset 32) + ;;(twist-max vector :inline) + (twist-max float 4) + (extra-twist degrees :offset 40) + (track-mode track-mode :offset 44) + (loock-at-count uint16 :offset 46) + (twist-range-x meters :offset 56) + (twist-range-y meters :offset 60) + (twist-speed-x float :offset 64) + (twist-speed-y float :offset 68) + (twist-min-x float :offset 72) + (twist-min-y float :offset 76) + (trans vector :inline :offset-assert 80) + (shmushy-old float :offset 80) + (smushy-off float :offset 84) + (smushyv float :offset 88) + (quat quaternion :inline :offset-assert 96) + (scale vector :inline) + (notice-time time-frame) + (flex-blend float) + (blend float) + (max-dist meters) + (ignore-angle degrees) + (up uint8) + (nose uint8) + (ear uint8) + (base-joint uint8) + (base-nose uint8) + (shutting-down? symbol) + (parented-scale? symbol) + (polar-internal-tilt-max float) + (polar-internal-radius float) + (polar-external-tilt-max float) + (polar-external-radius float) + ) :method-count-assert 16 :size-assert #xb8 :flag-assert #x10000000b8 @@ -13049,15 +14027,13 @@ (joint-mod-method-9 () none 9) ;; (set-mode! (_type_ joint-mod-handler-mode) _type_ 9) (joint-mod-method-10 () none 10) ;; (set-target! (_type_ vector) none 10) (joint-mod-method-11 () none 11) ;; (look-at-enemy! (_type_ vector symbol process) none 11) - (joint-mod-method-12 () none 12) ;; (reset-blend! (_type_) _type_ 12) + (reset-blend! (_type_) _type_ 12) (joint-mod-method-13 () none 13) ;; (set-twist! (_type_ float float float) vector 13) (joint-mod-method-14 () none 14) ;; (set-trs! (_type_ vector quaternion vector) none 14) (joint-mod-method-15 () none 15) ;; (shut-down! (_type_) float 15) ) ) -|# -#| (deftype try-to-look-at-info (basic) ((who uint64 :offset-assert 8) ;; handle (horz float :offset-assert 16) @@ -13067,9 +14043,7 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype joint-mod-wheel (basic) ((last-position vector :inline :offset-assert 16) (angle float :offset-assert 32) @@ -13077,106 +14051,114 @@ (wheel-radius float :offset-assert 40) (wheel-axis int8 :offset-assert 44) ) + (:methods + (new (symbol type process-drawable int float int) _type_) + ) :method-count-assert 9 :size-assert #x2d :flag-assert #x90000002d ) -|# -#| (deftype joint-mod-set-local (basic) ((transform transformq :inline :offset-assert 16) - (set-rotation basic :offset-assert 64) - (set-scale basic :offset-assert 68) - (set-translation basic :offset-assert 72) - (enable basic :offset-assert 76) + (set-rotation symbol :offset-assert 64) + (set-scale symbol :offset-assert 68) + (set-translation symbol :offset-assert 72) + (enable symbol :offset-assert 76) ) + (:methods + (new (symbol type process-drawable int symbol symbol symbol) _type_) + ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype joint-mod-add-local (basic) ((transform transformq :inline :offset-assert 16) - (add-rotation basic :offset-assert 64) - (add-scale basic :offset-assert 68) - (add-translation basic :offset-assert 72) - (enable basic :offset-assert 76) + (add-rotation symbol :offset-assert 64) + (add-scale symbol :offset-assert 68) + (add-translation symbol :offset-assert 72) + (enable symbol :offset-assert 76) ) + (:methods + (new (symbol type process-drawable int symbol symbol symbol) _type_) + ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype joint-mod-set-world (basic) ((transform transformq :inline :offset-assert 16) (node-index int32 :offset-assert 64) - (enable basic :offset-assert 68) + (enable symbol :offset-assert 68) ) + (:methods + (new (symbol type process-drawable int symbol) _type_) + ) :method-count-assert 9 :size-assert #x48 :flag-assert #x900000048 ) -|# -#| (deftype joint-mod-blend-local (basic) ((transform transformq :inline :offset-assert 16) (blend-transform transformq :inline :offset-assert 64) (node-index int32 :offset-assert 112) (blend float :offset-assert 116) - (enable basic :offset-assert 120) + (enable symbol :offset-assert 120) ) + (:methods + (new (symbol type process-drawable int symbol) _type_) + ) :method-count-assert 9 :size-assert #x7c :flag-assert #x90000007c ) -|# -#| (deftype joint-mod-spinner (basic) ((spin-axis vector :inline :offset-assert 16) (angle float :offset-assert 32) (spin-rate float :offset-assert 36) - (enable basic :offset-assert 40) + (enable symbol :offset-assert 40) ) + (:methods + (new (symbol type process-drawable int vector float) _type_) + ) :method-count-assert 9 :size-assert #x2c :flag-assert #x90000002c ) -|# -#| (deftype joint-mod-blend-world (basic) ((transform transformq :inline :offset-assert 16) (blend-transform transformq :inline :offset-assert 64) (blend-flags uint32 :offset-assert 112) (node-index int32 :offset-assert 116) (blend float :offset-assert 120) - (enable basic :offset-assert 124) + (enable symbol :offset-assert 124) ) + (:methods + (new (symbol type process-drawable int symbol float) _type_) + ) :method-count-assert 9 :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype joint-mod-rotate-local (basic) - ((enable basic :offset-assert 4) + ((enable symbol :offset-assert 4) (rotation quaternion :inline :offset-assert 16) ) + (:methods + (new (symbol type process-drawable int symbol) _type_) + ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype joint-mod-ik (basic) ((flags uint32 :offset-assert 4) (process basic :offset-assert 8) @@ -13202,18 +14184,17 @@ (joint-mod-ik-method-10 () none 10) ) ) -|# -;; (define-extern joint-mod-debug-draw function) ;; (function joint-mod none) -;; (define-extern *joint-axis-vectors* object) ;; (inline-array vector) -;; (define-extern joint-mod-wheel-callback function) ;; (function cspace transformq none) -;; (define-extern joint-mod-set-local-callback function) ;; (function cspace transformq none) -;; (define-extern joint-mod-add-local-callback function) -;; (define-extern joint-mod-set-world-callback function) ;; (function cspace transformq none) -;; (define-extern joint-mod-blend-local-callback function) ;; (function cspace transformq none) -;; (define-extern joint-mod-spinner-callback function) ;; (function cspace transformq none) -;; (define-extern joint-mod-blend-world-callback function) -;; (define-extern joint-mod-rotate-local-callback function) +(define-extern joint-mod-debug-draw (function joint-mod none)) +(define-extern *joint-axis-vectors* (inline-array vector)) +(define-extern joint-mod-wheel-callback (function cspace transformq none)) +(define-extern joint-mod-set-local-callback (function cspace transformq none)) +(define-extern joint-mod-add-local-callback (function cspace transformq none)) +(define-extern joint-mod-set-world-callback (function cspace transformq none)) +(define-extern joint-mod-blend-local-callback (function cspace transformq none)) +(define-extern joint-mod-spinner-callback (function cspace transformq none)) +(define-extern joint-mod-blend-world-callback (function cspace transformq none)) +(define-extern joint-mod-rotate-local-callback (function cspace transformq none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-func-h ;; @@ -13224,9 +14205,8 @@ ;; collide-mesh-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype collide-tri-result (structure) - ((vertex vector 3 :offset-assert 0) ;; guessed by decompiler + ((vertex vector 3 :inline :offset-assert 0) ;; guessed by decompiler (intersect vector :inline :offset-assert 48) (normal vector :inline :offset-assert 64) (pat pat-surface :offset-assert 80) ;; guessed by decompiler @@ -13236,27 +14216,24 @@ :size-assert #x58 :flag-assert #x900000058 ) -|# -#| (deftype collide-mesh-tri (structure) ((vertex-index uint8 3 :offset-assert 0) ;; guessed by decompiler (unused uint8 :offset-assert 3) (pat pat-surface :offset-assert 4) ;; guessed by decompiler ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype collide-mesh (basic) ((joint-id int32 :offset-assert 4) (num-tris uint32 :offset-assert 8) (num-verts uint32 :offset-assert 12) (vertex-data (inline-array vector) :offset-assert 16) ;; guessed by decompiler - (tris collide-mesh-tri 1 :offset-assert 32) ;; guessed by decompiler + (tris collide-mesh-tri 1 :inline :offset 32) ;; guessed by decompiler ) :method-count-assert 16 :size-assert #x28 @@ -13271,37 +14248,31 @@ (collide-mesh-method-15 () none 15) ;; (collide-mesh-math-2 (_type_ object object object) none 15) ) ) -|# -#| (deftype collide-mesh-cache-tri (structure) - ((vertex vector 3 :offset-assert 0) ;; guessed by decompiler + ((vertex vector 3 :inline :offset-assert 0) ;; guessed by decompiler (normal vector :inline :offset-assert 48) (bbox4w bounding-box4w :inline :offset-assert 64) - (pat pat-surface :offset-assert 60) ;; guessed by decompiler + (pat pat-surface :offset 60) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x60 :flag-assert #x900000060 ) -|# -#| (deftype collide-mesh-cache-entry (structure) ((mat matrix :inline :offset-assert 0) - (tris UNKNOWN :dynamic :offset-assert 64) + (tris collide-mesh-cache-tri :dynamic :inline :offset-assert 64) ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype collide-mesh-cache (basic) ((used-size uint32 :offset-assert 4) (max-size uint32 :offset-assert 8) - (id uint64 :offset-assert 12) ;; guessed by decompiler + (id uint32 :offset-assert 12) ;; guessed by decompiler (data uint8 48000 :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 13 @@ -13309,20 +14280,78 @@ :flag-assert #xd0000bb90 (:methods (collide-mesh-cache-method-9 () none 9) ;; (allocate! (_type_ int) int 9) - (collide-mesh-cache-method-10 () none 10) ;; (is-id? (_type_ int) symbol 10) - (collide-mesh-cache-method-11 () none 11) ;; (next-id! (_type_) uint 11) + (is-id? (_type_ int) symbol 10) ;; (is-id? (_type_ int) symbol 10) + (next-id! (_type_) uint 11) ;; (next-id! (_type_) uint 11) (collide-mesh-cache-method-12 () none 12) ) ) -|# -;; (define-extern *collide-mesh-cache* object) ;; collide-mesh-cache +(define-extern *collide-mesh-cache* collide-mesh-cache) ;; collide-mesh-cache ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-shape-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(declare-type collide-shape trsqv) +(declare-type collide-shape-moving collide-shape) +(declare-type touching-list structure) + +(defenum collide-spec + :bitfield #t + :type uint32 + + (backgnd 0) ;; 1 + (jak 1) ;; 2 + (bot 2) ;; 4 + (crate 3) ;; 8 + (civilian 4) ;; 16 + (enemy 5) ;; 32 + (obstacle 6) ;; 64 + (vehicle-sphere 7) ;; 128 + (hit-by-player-list 8) ;; 256 + (hit-by-others-list 9) ;; 512 + (player-list 10) ;; 1024 + (water 11) ;; 2048 + (collectable 12) ;; 4096 + (blocking-plane 13) ;; 8192 + (projectile 14) ;; 16384 + (jak-vulnerable 15) ;; 32768 + (camera-blocker 16) ;; hi 1 + (notice-blue-eco-powerup 17) ;; hi 2 + (tobot 18) ;; hi 4 + (pusher 19) ;; hi 8 + (vehicle-mesh 20) ;; hi 16 + (bot-targetable 21) ;; hi 32 + (jak-vehicle 22) ;; hi 64 + (special-obstacle 23) ;; hi 128 + (mech-punch 24) ;; hi 256 + (obstacle-for-jak 25) ;; hi 512 + (vehicle-mesh-probeable 26) ;; hi 1024 + ) + +(defenum collide-action + :bitfield #t + :type uint32 + + (solid 0) ;; 1 + (semi-solid 1) ;; 2 + (rideable 2) ;; 4 + (can-ride 3) ;; 8 + (dont-push-away 4) ;; 16 + (pull-rider-can-collide 5) ;; 32 + (deadly 6) ;; 64 + (persistent-attack 7) ;; 128 + (no-smack 8) ;; 256 + (no-standon 9) ;; 512 + (block-turn-around 10) ;; 1024 + (check-edge 11) ;; 2048 + (check-stuck 12) ;; 4096 + (stuck-wall-escape 13) ;; 8192 + (no-normal-reset 14) ;; 163884 + (edge-grabbed 15) ;; 32768 + (nav-sphere 16) ;; hi 1 + ) + (deftype collide-rider (structure) ((rider-handle uint64 :offset-assert 0) (sticky-prim basic :offset-assert 8) @@ -13333,24 +14362,20 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype collide-rider-pool (basic) ((alloc-count int32 :offset-assert 4) - (riders UNKNOWN 20 :offset-assert 16) + (riders collide-rider 20 :inline :offset-assert 16) ) :method-count-assert 11 :size-assert #x290 :flag-assert #xb00000290 (:methods (collide-rider-pool-method-9 () none 9) - (collide-rider-pool-method-10 () none 10) + (prepare (_type_) none 10) ) ) -|# -#| (deftype pull-rider-info (structure) ((rider collide-rider :offset-assert 0) ;; collide-sticky-rider (rider-cshape collide-shape-moving :offset-assert 4) ;; guessed by decompiler @@ -13361,26 +14386,27 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| +(defenum overlaps-others-options + :type uint32 + :bitfield #t + ) + (deftype overlaps-others-params (structure) - ((options uint32 :offset-assert 0) - (collide-with-filter uint32 :offset-assert 4) + ((options overlaps-others-options :offset-assert 0) + (collide-with-filter collide-spec :offset-assert 4) (tlist touching-list :offset-assert 8) ;; guessed by decompiler - (filtered-root-collide-with uint32 :offset-assert 12) - (filtered-child-collide-with uint32 :offset-assert 16) - (filtered-other-collide-as uint32 :offset-assert 20) + (filtered-root-collide-with collide-spec :offset-assert 12) + (filtered-child-collide-with collide-spec :offset-assert 16) + (filtered-other-collide-as collide-spec :offset-assert 20) ) :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype move-above-ground-params (structure) - ((gnd-collide-with uint32 :offset-assert 0) + ((gnd-collide-with collide-spec :offset-assert 0) (popup float :offset-assert 4) (dont-move-if-overlaps? basic :offset-assert 8) (hover-if-no-ground? basic :offset-assert 12) @@ -13388,7 +14414,7 @@ (new-pos vector :inline :offset-assert 48) (old-gspot-pos vector :inline :offset-assert 64) (old-gspot-normal vector :inline :offset-assert 80) - (pat uint32 :offset-assert 96) + (pat pat-surface :offset-assert 96) ;; was u32 (on-ground? basic :offset-assert 100) (do-move? basic :offset-assert 104) ) @@ -13396,33 +14422,52 @@ :size-assert #x6c :flag-assert #x90000006c ) -|# -#| +(defenum prim-type + :type int8 + (prim -2) + (sphere -1) + (group 0) + (mesh 1) + (fake-prim 2) + ) + (deftype collide-prim-core (structure) ((world-sphere vector :inline :offset-assert 0) - (collide-as collide-kind :offset-assert 16) ;; guessed by decompiler + (collide-as collide-spec :offset-assert 16) ;; guessed by decompiler (collide-with uint32 :offset-assert 20) (action collide-action :offset-assert 24) ;; guessed by decompiler - (prim-type int8 :offset-assert 28) - (unused1 UNKNOWN 3 :offset-assert 29) - (quad uint128 2 :offset-assert 0) ;; guessed by decompiler + (prim-type prim-type :offset-assert 28) + (unused1 uint8 3 :offset-assert 29) + (quad uint128 2 :offset 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype collide-shape-prim (basic) - () + ((cshape collide-shape :offset-assert 4) + (prim-id uint32 :offset-assert 8) + (transform-index int8 :offset-assert 12) + (unused2 int8 3) + (prim-core collide-prim-core :inline :offset-assert 16) + (local-sphere vector :inline :offset-assert 48) + ;; specifc + (world-sphere vector :inline :offset 16) + (collide-as collide-spec :offset 32) + (collide-with collide-spec :offset 36) + (action collide-action :offset 40) + (prim-type int8 :offset 44) + (radius float :offset 60) + (specific uint8 16 :score -1) + ) :method-count-assert 20 :size-assert #x50 :flag-assert #x1400000050 ;; Failed to read fields. (:methods - ;; (new (symbol type collide-shape uint int) _type_ 0) + (new (symbol type collide-shape uint int) _type_ 0) (collide-shape-prim-method-9 () none 9) ;; (move-by-vector! (_type_ vector) none 9) (collide-shape-prim-method-10 () none 10) ;; (find-prim-by-id (_type_ uint) collide-shape-prim 10) (collide-shape-prim-method-11 () none 11) ;; (debug-draw-world-sphere (_type_) symbol 11) @@ -13436,56 +14481,84 @@ (collide-shape-prim-method-19 () none 19) ;; (collide-with-collide-cache-prim-sphere (_type_ collide-shape-intersect collide-cache-prim) none 19) ) ) -|# -#| + (deftype collide-shape-prim-sphere (collide-shape-prim) - () + ((pat pat-surface :offset 64) + (nav-radius float :offset 68) + ) :method-count-assert 20 :size-assert #x50 :flag-assert #x1400000050 ;; Failed to read fields. (:methods - ;; (new (symbol type collide-shape uint) _type_ 0) + (new (symbol type collide-shape uint) _type_ 0) ) ) -|# -#| + (deftype collide-shape-prim-mesh (collide-shape-prim) - () + ((mesh collide-mesh :offset 64) + (mesh-id int32 :offset 68) + (mesh-cache-id uint32 :offset 72) + (mesh-cache-entry collide-mesh-cache-entry :offset 76) + ) :method-count-assert 20 :size-assert #x50 :flag-assert #x1400000050 ;; Failed to read fields. (:methods - ;; (new (symbol type collide-shape uint uint) _type_ 0) + (new (symbol type collide-shape uint uint) _type_ 0) ) ) -|# -#| (deftype collide-shape-prim-group (collide-shape-prim) - () + ((num-children uint8 :offset 64) + (num-alloc-children uint8 :offset 65) + (child (inline-array collide-shape) :offset 68) ;; total guess.. + ) :method-count-assert 20 :size-assert #x50 :flag-assert #x1400000050 ;; Failed to read fields. (:methods - ;; (new (symbol type collide-shape uint int) _type_ 0) + (new (symbol type collide-shape uint int) _type_ 0) ) ) -|# -#| +(defenum collide-list-enum + (hit-by-player) + (usually-hit-by-player) + (hit-by-others) + (player) + ) + + (deftype collide-shape (trsqv) - () + ((actor-hash-index int16 :offset 12) + (process process :offset-assert 140) + (max-iteration-count uint8) + (nav-flags uint8) + (total-prims uint8) + (num-riders uint8) + (pat-ignore-mask pat-surface) + (event-self symbol) + (event-other symbol) + (root-prim collide-shape-prim) + (riders pointer) ;; no + (penetrate-using penetrate) + (penetrated-by penetrate) + (backup-collide-as collide-spec) + (backup-collde-with collide-spec) + (event-priority uint8) + (rider-max-momentum float) + ) :method-count-assert 55 :size-assert #xc8 :flag-assert #x37000000c8 ;; Failed to read fields. (:methods - ;; (new (symbol type process-drawable collide-list-enum) _type_ 0) + (new (symbol type process-drawable collide-list-enum) _type_ 0) (collide-shape-method-28 () none 28) ;; (move-by-vector! (_type_ vector) none 28) (collide-shape-method-29 () none 29) ;; (alloc-riders (_type_ int) none 29) (collide-shape-method-30 () none 30) ;; (move-to-point! (_type_ vector) none 30) @@ -13515,11 +14588,107 @@ (collide-shape-method-54 () none 54) ;; (set-collide-offense (_type_ int collide-offense) none 54) ) ) -|# -#| +(defenum cshape-moving-flags + :bitfield #t + :type uint64 + (csmf00) + (csmf01) + (csmf02) + (csmf03) + (csmf04) + (csmf05) + (csmf06) + (csmf07) + (csmf08) + (csmf09) + (csmf10) + (csmf11) + (csmf12) + (csmf13) + (csmf14) + (csmf15) + (csmf16) + (csmf17) + (csmf18) + (csmf19) + (csmf20) + (csmf21) + (csmf22) + (csmf23) + (csmf24) + (csmf25) + (csmf26) + (csmf27) + (csmf28) + (csmf29) + ) + +(defenum cshape-reaction-flags + :bitfield #t + :type uint32 + (csrf00) + (csrf01) + (csrf02) + (csrf03) + (csrf04) + (csrf05) + (csrf06) + (csrf07) + (csrf08) + (csrf09) + (csrf10) + (csrf11) + (csrf12) + (csrf13) + (csrf14) + (csrf15) + (csrf16) + (csrf17) + (csrf18) + (csrf19) + (csrf20) + (csrf21) + (csrf22) + (csrf23) + (csrf24) + (csrf25) + (csrf26) + (csrf27) + (csrf28) + (csrf29) + (csrf30) + (csrf31) + ) + (deftype collide-shape-moving (collide-shape) - () + ((rider-time time-frame :offset-assert 200) + (rider-last-move vector :inline) + (trans-old vector :inline) + (poly-pat pat-surface :offset 272) + (cur-pat pat-surface) + (ground-pat pat-surface) + (status cshape-moving-flags) + (old-status cshape-moving-flags) + (prev-status cshape-moving-flags :offset-assert 304) + (reaction-flag cshape-reaction-flags) + (reaction function) ;; function types... + (no-reaction function) + (local-normal vector :inline) + (surface-normal vector :inline) + (poly-normal vector :inline) + (ground-poly-normal vector :inline) + (gspot-pos vector :inline) + (gspot-normal vector :inline) + (grount-touch-point vector :inline) + (ground-impact-vel meters) + (surface-angle float) + (poly-angle float) + (touch-angle float) + (coverage float) + (dynam dynamics) + (surf surface) + ) :method-count-assert 68 :size-assert #x1dc :flag-assert #x44000001dc @@ -13540,127 +14709,133 @@ (collide-shape-moving-method-67 () none 67) ) ) -|# -;; (define-extern *collide-hit-by-player-list* object) ;; engine -;; (define-extern *collide-hit-by-others-list* object) ;; engine -;; (define-extern *collide-player-list* object) ;; engine -;; (define-extern *collide-shape-prim-backgnd* collide-shape-prim-mesh) ;; collide-shape-prim-mesh -;; (define-extern *collide-shape-prim-water* collide-shape-prim-mesh) ;; collide-shape-prim-mesh -;; (define-extern *collide-rider-pool* object) +(define-extern *collide-hit-by-player-list* engine) ;; engine +(define-extern *collide-hit-by-others-list* engine) ;; engine +(define-extern *collide-player-list* engine) ;; engine +(define-extern *collide-shape-prim-backgnd* collide-shape-prim-mesh) ;; collide-shape-prim-mesh +(define-extern *collide-shape-prim-water* collide-shape-prim-mesh) ;; collide-shape-prim-mesh +(define-extern *collide-rider-pool* collide-rider-pool) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-obs-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (deftype manipy (process-drawable) -;; () -;; :flag-assert #x1501000174 -;; ) +(defenum manipy-options + :bitfield #t + :type uint32 + ) + +(deftype manipy (process-drawable) + ((new-trans-hook (function none) :offset-assert 200) + (cur-trans-hook (function none) :offset-assert 204) + (cur-event-hook (function none) :offset-assert 208) + (new-joint-anim art-joint-anim :offset-assert 212) + (new-joint-anim-blend uint64 :offset-assert 216) + (anim-mode symbol :offset-assert 224) + (cur-grab-handle handle :offset-assert 232) + (cur-target-handle handle :offset-assert 240) + (old-grab-pos vector :inline :offset-assert 256) + (joint joint-mod 4 :offset-assert 272) + (new-post-hook (function none) :offset-assert 288) + (cur-post-hook (function none) :offset-assert 292) + (clone-copy-trans symbol :offset-assert 296) + (shadow-backup basic :offset-assert 300) + (draw? symbol :offset-assert 304) + (userdata uint64 :offset-assert 312) + (prefix basic :offset-assert 320) + (shadow-volume-joint int32 :offset-assert 324) + (speed float :offset-assert 328) + (user-uint64 uint64 4 :offset-assert 336) + (options manipy-options :offset-assert 368) + ) + :flag-assert #x1501000174 + (:methods + (manipy-method-20 () none 20) + ) + ) -#| (deftype part-spawner (process) - ((root trsqv :offset-assert 124) ;; guessed by decompiler - (part sparticle-launch-control :offset-assert 128) ;; guessed by decompiler - (sound ambient-sound :offset-assert 132) ;; guessed by decompiler - (mode (pointer sparticle-launch-group) :offset-assert 136) ;; guessed by decompiler - (enable symbol :offset-assert 140) ;; guessed by decompiler - (radius meters :offset-assert 144) - (world-sphere sphere :inline :offset-assert 156) + ((root trsqv :offset-assert 128) ;; guessed by decompiler + (part sparticle-launch-control :offset-assert 132) ;; guessed by decompiler + (sound ambient-sound :offset-assert 136) ;; guessed by decompiler + (mode (pointer sparticle-launch-group) :offset-assert 140) ;; guessed by decompiler + (enable symbol :offset-assert 144) ;; guessed by decompiler + (radius meters :offset-assert 148) + (world-sphere sphere :inline :offset-assert 160) ) :method-count-assert 16 :size-assert #xb0 :flag-assert #x10003000b0 (:methods - (part-spawner-method-9 () none 9) - (part-spawner-method-10 () none 10) - (part-spawner-method-11 () none 11) - (part-spawner-method-12 () none 12) - (part-spawner-method-13 () none 13) (part-spawner-method-14 () none 14) (part-spawner-method-15 () none 15) ) ) -|# -#| (deftype part-tracker (process) - ((root trsqv :offset-assert 124) ;; guessed by decompiler - (mat matrix :inline :offset-assert 140) - (part sparticle-launch-control :offset-assert 204) ;; guessed by decompiler - (callback (function part-tracker vector) :offset-assert 208) ;; guessed by decompiler - (linger-callback (function part-tracker vector) :offset-assert 212) ;; guessed by decompiler - (duration uint64 :offset-assert 220) ;; time-frame - (linger-duration uint64 :offset-assert 228) ;; time-frame - (start-time time-frame :offset-assert 236) ;; time-frame - (target uint64 :offset-assert 244) ;; handle - (target-joint int32 :offset-assert 252) - (offset vector :inline :offset-assert 268) - (userdata uint64 :offset-assert 284) - (user-time time-frame 2 :offset-assert 292) ;; guessed by decompiler - (user-vector vector :inline :offset-assert 316) - (user-handle uint32 2 :offset-assert 348) ;; guessed by decompiler + ((root trsqv :offset-assert 128) ;; guessed by decompiler + (mat matrix :inline :offset-assert 144) + (part sparticle-launch-control :offset-assert 208) ;; guessed by decompiler + (callback (function part-tracker vector) :offset-assert 212) ;; guessed by decompiler + (linger-callback (function part-tracker vector) :offset-assert 216) ;; guessed by decompiler + (duration uint64 :offset-assert 224) ;; time-frame + (linger-duration uint64 :offset-assert 232) ;; time-frame + (start-time time-frame :offset-assert 240) ;; time-frame + (target uint64 :offset-assert 248) ;; handle + (target-joint int32 :offset-assert 256) + (offset vector :inline :offset-assert 272) + (userdata uint64 :offset-assert 288) + (user-time time-frame 2 :offset-assert 296) ;; guessed by decompiler + (user-vector vector :inline :offset-assert 320) ;; two of these in jak1, seems like there's still space. + (user-handle uint32 2 :offset 352) ;; guessed by decompiler ) :method-count-assert 16 :size-assert #x168 :flag-assert #x1000f00168 ;; field userdata uses ~A with a 64-bit load (:methods - (part-tracker-method-9 () none 9) - (part-tracker-method-10 () none 10) - (part-tracker-method-11 () none 11) - (part-tracker-method-12 () none 12) - (part-tracker-method-13 () none 13) (part-tracker-method-14 () none 14) (part-tracker-method-15 () none 15) ) ) -|# -#| (deftype lightning-tracker (process) - ((root basic :offset-assert 124) - (lightning basic :offset-assert 128) - (callback basic :offset-assert 132) - (duration uint64 :offset-assert 140) - (start-time time-frame :offset-assert 148) - (offset0 vector :inline :offset-assert 156) - (offset1 vector :inline :offset-assert 172) - (target0 uint64 :offset-assert 188) - (target1 uint64 :offset-assert 196) - (target-joint0 int32 :offset-assert 204) - (target-joint1 int32 :offset-assert 208) - (sound uint32 :offset-assert 212) - (userdata uint64 :offset-assert 220) - (user-time UNKNOWN 2 :offset-assert 228) - (user-vector vector :inline :offset-assert 252) - (user-handle UNKNOWN 2 :offset-assert 284) + ((root basic :offset-assert 128) + (lightning basic :offset-assert 132) + (callback basic :offset-assert 136) + (duration uint64 :offset-assert 144) + (start-time time-frame :offset-assert 152) + (offset0 vector :inline :offset-assert 160) + (offset1 vector :inline :offset-assert 176) + (target0 uint64 :offset-assert 192) + (target1 uint64 :offset-assert 200) + (target-joint0 int32 :offset-assert 208) + (target-joint1 int32 :offset-assert 212) + (sound uint32 :offset-assert 216) + (userdata uint64 :offset-assert 224) + (user-time time-frame 2 :offset-assert 232) + (user-vector vector :inline :offset-assert 256) + (user-handle handle 2 :offset 288) ) :method-count-assert 17 :size-assert #x130 :flag-assert #x1100b00130 ;; field userdata uses ~A with a 64-bit load (:methods - (lightning-tracker-method-9 () none 9) - (lightning-tracker-method-10 () none 10) - (lightning-tracker-method-11 () none 11) - (lightning-tracker-method-12 () none 12) - (lightning-tracker-method-13 () none 13) (lightning-tracker-method-14 () none 14) (lightning-tracker-method-15 () none 15) (lightning-tracker-method-16 () none 16) ) ) -|# -#| (deftype touch-tracker (process-drawable) - ((duration uint64 :offset-assert 196) ;; time-frame - (target uint64 :offset-assert 204) ;; handle - (event symbol :offset-assert 212) ;; guessed by decompiler - (run-function (function object) :offset-assert 216) ;; guessed by decompiler - (callback (function touch-tracker none) :offset-assert 220) ;; guessed by decompiler - (event-mode basic :offset-assert 224) + ((duration time-frame :offset-assert 200) + (target handle :offset-assert 208) + (event symbol :offset-assert 216) ;; guessed by decompiler + (run-function (function object) :offset-assert 220) ;; guessed by decompiler + (callback (function touch-tracker none) :offset-assert 224) ;; guessed by decompiler + (event-mode basic :offset-assert 228) ) :method-count-assert 21 :size-assert #xe8 @@ -13669,16 +14844,14 @@ (touch-tracker-method-20 () none 20) ) ) -|# -#| (deftype swingpole (process-drawable) - ((edge-length meters :offset-assert 196) - (path-pos float :offset-assert 200) - (joint-track int32 :offset-assert 204) - (speed meters :offset-assert 208) - (dir vector :inline :offset-assert 220) - (sync sync-eased :inline :offset-assert 236) + ((edge-length meters :offset-assert 200) + (path-pos float :offset-assert 204) + (joint-track int32 :offset-assert 208) + (speed meters :offset-assert 212) + (dir vector :inline :offset-assert 224) + (sync sync-eased :inline :offset-assert 240) ) :method-count-assert 23 :size-assert #x11c @@ -13689,9 +14862,7 @@ (swingpole-method-22 () none 22) ) ) -|# -#| (deftype gui-query (structure) ((x-position int32 :offset-assert 0) (y-position int32 :offset-assert 4) @@ -13709,42 +14880,31 @@ (gui-query-method-10 () none 10) ;; (get-response (_type_) symbol 10) ) ) -|# -#| (deftype othercam (process) - ((hand uint64 :offset-assert 124) ;; handle - (old-global-mask process-mask :offset-assert 132) ;; guessed by decompiler - (mask-to-clear process-mask :offset-assert 136) ;; guessed by decompiler - (cam-joint-index int32 :offset-assert 140) - (old-pos vector :inline :offset-assert 156) - (old-mat-z vector :inline :offset-assert 172) - (had-valid-frame basic :offset-assert 188) - (border-value basic :offset-assert 192) - (die? symbol :offset-assert 196) ;; guessed by decompiler - (survive-anim-end? symbol :offset-assert 200) ;; guessed by decompiler - (spooling? symbol :offset-assert 204) ;; guessed by decompiler - (fov float :offset-assert 208) + ((hand handle :offset-assert 128) + (old-global-mask process-mask :offset-assert 136) ;; guessed by decompiler + (mask-to-clear process-mask :offset-assert 140) ;; guessed by decompiler + (cam-joint-index int32 :offset-assert 144) + (old-pos vector :inline :offset-assert 160) + (old-mat-z vector :inline :offset-assert 176) + (had-valid-frame basic :offset-assert 192) + (border-value basic :offset-assert 196) + (die? symbol :offset-assert 200) ;; guessed by decompiler + (survive-anim-end? symbol :offset-assert 204) ;; guessed by decompiler + (spooling? symbol :offset-assert 208) ;; guessed by decompiler + (fov float :offset-assert 212) ) :method-count-assert 14 :size-assert #xd8 :flag-assert #xe006000d8 - (:methods - (othercam-method-9 () none 9) - (othercam-method-10 () none 10) - (othercam-method-11 () none 11) - (othercam-method-12 () none 12) - (othercam-method-13 () none 13) - ) ) -|# -#| (deftype explosion (process-drawable) - ((start-time time-frame :offset-assert 196) - (duration uint32 :offset-assert 204) - (linger-duration uint32 :offset-assert 208) - (attack-id uint32 :offset-assert 212) + ((start-time time-frame :offset-assert 200) + (duration uint32 :offset-assert 208) + (linger-duration uint32 :offset-assert 212) + (attack-id uint32 :offset-assert 216) ) :method-count-assert 23 :size-assert #xdc @@ -13755,24 +14915,20 @@ (explosion-method-22 () none 22) ) ) -|# -#| (deftype explosion-init-params (structure) ((spawn-point vector :inline :offset-assert 0) (spawn-quat quaternion :inline :offset-assert 16) (radius float :offset-assert 32) (group basic :offset-assert 36) - (collide-with uint32 :offset-assert 40) - (penetrate-using uint64 :offset-assert 48) + (collide-with collide-spec :offset-assert 40) + (penetrate-using penetrate :offset-assert 48) ) :method-count-assert 9 :size-assert #x38 :flag-assert #x900000038 ) -|# -#| (deftype process-hidden (process) () :method-count-assert 15 @@ -13780,22 +14936,15 @@ :flag-assert #xf00000080 ;; Failed to read fields. (:methods - (process-hidden-method-9 () none 9) - (process-hidden-method-10 () none 10) - (process-hidden-method-11 () none 11) - (process-hidden-method-12 () none 12) - (process-hidden-method-13 () none 13) (process-hidden-method-14 () none 14) ;; (die () _type_ :state 14) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; trajectory-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype trajectory (structure) ((initial-position vector :inline :offset-assert 0) (initial-velocity vector :inline :offset-assert 16) @@ -13806,52 +14955,57 @@ :size-assert #x28 :flag-assert #x1200000028 (:methods - (trajectory-method-9 () none 9) ;; (eval-position! (_type_ float vector) vector 9) - (trajectory-method-10 () none 10) ;; (eval-velocity! (_type_ float vector) vector 10) - (trajectory-method-11 () none 11) ;; (setup-from-to-duration! (_type_ vector vector float float) none 11) - (trajectory-method-12 () none 12) ;; (setup-from-to-xz-vel! (_type_ vector vector float float) none 12) - (trajectory-method-13 () none 13) ;; (setup-from-to-y-vel! (_type_ vector vector float float) none 13) - (trajectory-method-14 () none 14) ;; (setup-from-to-height! (_type_ vector vector float float) none 14) - (trajectory-method-15 () none 15) ;; (debug-draw! (_type_) none 15) - (trajectory-method-16 () none 16) - (trajectory-method-17 () none 17) + (compute-trans-at-time (_type_ float vector) vector 9) + (compute-transv-at-time (_type_ float vector) vector 10) + (compute-time-until-apex (_type_) float 11) + (setup-from-to-duration! (_type_ vector vector float float) none 12) + (setup-from-to-xz-vel! (_type_ vector vector float float) none 13) + (setup-from-to-y-vel! (_type_ vector vector float float) none 14) + (setup-from-to-height! (_type_ vector vector float float) none 15) + (setup-from-to-duration-and-height! (_type_ vector vector float float) none 16) + (debug-draw (_type_) none 17) ) ) -|# -#| (deftype impact-control (structure) - () + ((process (pointer process-drawable) :offset-assert 0) + (radius float :offset-assert 4) + (joint int32 :offset-assert 8) + (collide-with collide-spec :offset-assert 12) + (start-time time-frame :offset-assert 16) + (trans vector 2 :inline :offset-assert 32) + (dir vector :inline :offset-assert 64) + ) :method-count-assert 12 :size-assert #x50 :flag-assert #xc00000050 ;; Failed to read fields. (:methods - (impact-control-method-9 () none 9) - (impact-control-method-10 () none 10) + (new (symbol type process-drawable int float collide-spec) _type_ 0) + (initialize (_type_ process-drawable int float collide-spec) impact-control :behavior process 9) + (update-from-cspace (_type_) none 10) (impact-control-method-11 () none 11) ) ) -|# -#| (deftype point-tracker (structure) - () + ((trans vector 2 :inline :offset-assert 0)) :method-count-assert 12 :size-assert #x20 :flag-assert #xc00000020 ;; Failed to read fields. (:methods - (point-tracker-method-9 () none 9) + (new (symbol type vector vector) _type_ 0) + (initialize (_type_ vector vector) point-tracker 9) (point-tracker-method-10 () none 10) (point-tracker-method-11 () none 11) ) ) -|# -#| (deftype combo-tracker (point-tracker) - () + ((target handle :offset-assert 32) + (move-start-time time-frame :offset-assert 40) + ) :method-count-assert 14 :size-assert #x30 :flag-assert #xe00000030 @@ -13861,9 +15015,7 @@ (combo-tracker-method-13 () none 13) ) ) -|# -#| (deftype traj2d-params (structure) ((x float :offset-assert 0) (y float :offset-assert 4) @@ -13876,9 +15028,7 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype traj3d-params (structure) ((gravity float :offset-assert 0) (initial-tilt float :offset-assert 4) @@ -13893,9 +15043,7 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype cubic-curve (structure) ((mat matrix :inline :offset-assert 0) ) @@ -13910,24 +15058,23 @@ (cubic-curve-method-13 () none 13) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-target-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (deftype control-info (collide-shape-moving) -;; () -;; :flag-assert #x4400001910 -;; ) +(deftype control-info (collide-shape-moving) + ((pad uint8 :offset #x190f) + ) + :flag-assert #x4400001910 + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-touch-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype touching-prim (structure) ((cprim collide-shape-prim :offset-assert 0) ;; guessed by decompiler (has-tri? symbol :offset-assert 4) ;; guessed by decompiler @@ -13937,9 +15084,7 @@ :size-assert #x68 :flag-assert #x900000068 ) -|# -#| (deftype touching-prims-entry (structure) ((next touching-prims-entry :offset-assert 0) (prev touching-prims-entry :offset-assert 4) @@ -13957,12 +15102,10 @@ (touching-prims-entry-method-11 () none 11) ;; (get-middle-of-bsphere-overlap (_type_ vector) vector 11) ) ) -|# -#| (deftype touching-prims-entry-pool (structure) ((head touching-prims-entry :offset-assert 0) - (nodes touching-prims-entry 64 :offset-assert 16) ;; guessed by decompiler + (nodes touching-prims-entry 64 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 13 :size-assert #x3c10 @@ -13971,13 +15114,11 @@ ;; (new (symbol type) _type_ 0) (touching-prims-entry-pool-method-9 () none 9) ;; (alloc-node (_type_) touching-prims-entry 9) (touching-prims-entry-pool-method-10 () none 10) ;; (get-free-node-count (_type_) int 10) - (touching-prims-entry-pool-method-11 () none 11) ;; (init-list! (_type_) none 11) + (init-list! (_type_) none 11) (touching-prims-entry-pool-method-12 () none 12) ;; (free-node (_type_ touching-prims-entry) touching-prims-entry 12) ) ) -|# -#| (deftype touching-shapes-entry (structure) ((cshape1 collide-shape :offset-assert 0) ;; guessed by decompiler (cshape2 collide-shape :offset-assert 4) ;; guessed by decompiler @@ -13986,25 +15127,24 @@ (handle1 uint64 :offset-assert 16) (handle2 uint64 :offset-assert 24) ) + :pack-me :method-count-assert 15 :size-assert #x20 :flag-assert #xf00000020 (:methods - (touching-shapes-entry-method-9 () none 9) ;; (dummy-9 (_type_) none 9) - (touching-shapes-entry-method-10 () none 10) ;; (get-touched-shape (_type_ collide-shape) collide-shape 10) + (get-head (_type_) touching-prims-entry 9) ;; (dummy-9 (_type_) none 9) + (get-next (_type_ touching-shapes-entry) touching-prims-entry 10) ;; (get-touched-shape (_type_ collide-shape) collide-shape 10) (touching-shapes-entry-method-11 () none 11) ;; (dummy-11 () none 11) (touching-shapes-entry-method-12 () none 12) ;; (prims-touching? (_type_ collide-shape-moving uint) touching-prims-entry 12) (touching-shapes-entry-method-13 () none 13) ;; (prims-touching-action? (_type_ collide-shape collide-action collide-action) touching-prims-entry 13) (touching-shapes-entry-method-14 () none 14) ;; (dummy-14 () none 14) ) ) -|# -#| (deftype touching-list (structure) ((num-touching-shapes int32 :offset-assert 0) (resolve-u int8 :offset-assert 4) - (touching-shapes touching-shapes-entry 32 :offset-assert 8) ;; guessed by decompiler + (touching-shapes touching-shapes-entry 32 :inline :offset-assert 8) ;; guessed by decompiler ) :method-count-assert 14 :size-assert #x408 @@ -14018,46 +15158,42 @@ (touching-list-method-13 () none 13) ;; (get-shapes-entry (_type_ collide-shape collide-shape) touching-shapes-entry 13) ) ) -|# -;; (define-extern *touching-prims-entry-pool* object) ;; touching-prims-entry-pool -;; (define-extern *touching-list* object) ;; touching-list +(define-extern *touching-prims-entry-pool* touching-prims-entry-pool) +(define-extern *touching-list* touching-list) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-edge-grab-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype pilot-edge-grab-info (structure) ((local-pos vector :inline :offset-assert 0) (local-dir vector :inline :offset-assert 16) - (handle uint64 :offset-assert 32) + (handle handle :offset-assert 32) ) :method-count-assert 9 :size-assert #x28 :flag-assert #x900000028 ) -|# -#| (deftype edge-grab-info (structure) - ((world-vertex vector 8 :offset-assert 0) ;; guessed by decompiler - (local-vertex vector 8 :offset-assert 128) ;; guessed by decompiler + ((world-vertex vector 8 :inline :offset-assert 0) ;; guessed by decompiler + (local-vertex vector 8 :inline :offset-assert 128) ;; guessed by decompiler (status uint64 :offset-assert 256) (actor-cshape-prim-offset int32 :offset-assert 264) (actor-handle uint64 :offset-assert 272) ;; handle (hanging-matrix matrix :inline :offset-assert 288) - (edge-vertex vector 2 :offset-assert 0) ;; guessed by decompiler - (center-hold vector :inline :offset-assert 32) - (tri-vertex vector 3 :offset-assert 48) ;; guessed by decompiler - (adjacent-edge-left-vertex vector :inline :offset-assert 96) - (adjacent-edge-right-vertex vector :inline :offset-assert 112) + (edge-vertex vector 2 :inline :offset 0) ;; guessed by decompiler + (center-hold vector :inline :offset 32) + (tri-vertex vector 3 :inline :offset 48) ;; guessed by decompiler + (adjacent-edge-left-vertex vector :inline :offset 96) + (adjacent-edge-right-vertex vector :inline :offset 112) (left-hand-hold vector :inline :offset-assert 352) (right-hand-hold vector :inline :offset-assert 368) (center-hold-old vector :inline :offset-assert 384) (edge-tri-pat uint32 :offset-assert 400) - (found-edge? basic :offset-assert 404) - (pilot-edge-grab? basic :offset-assert 408) + (found-edge? symbol :offset-assert 404) + (pilot-edge-grab? symbol :offset-assert 408) (pilot-edge-grab pilot-edge-grab-info :inline :offset-assert 416) (pilot-start-grab-pos vector :inline :offset-assert 464) (pilot-grab-interp float :offset-assert 480) @@ -14070,9 +15206,8 @@ (edge-grab-info-method-10 () none 10) ;; (debug-draw (_type_) symbol 10) ) ) -|# -#| +(declare-type collide-cache-tri structure) (deftype collide-edge-tri (structure) ((ctri collide-cache-tri :offset-assert 0) ;; guessed by decompiler (normal vector :inline :offset-assert 16) @@ -14081,9 +15216,7 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype collide-edge-edge (structure) ((ignore basic :offset-assert 0) (etri collide-edge-tri :offset-assert 4) @@ -14098,9 +15231,7 @@ (collide-edge-edge-method-9 () none 9) ) ) -|# -#| (deftype collide-edge-hold-item (structure) ((next collide-edge-hold-item :offset-assert 0) (rating float :offset-assert 4) @@ -14113,15 +15244,13 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype collide-edge-hold-list (structure) ((num-allocs uint32 :offset-assert 0) (num-attempts uint32 :offset-assert 4) (head collide-edge-hold-item :offset-assert 8) - (items collide-edge-hold-item 32 :offset-assert 16) ;; guessed by decompiler - (attempts qword 32 :offset-assert 1552) ;; guessed by decompiler + (items collide-edge-hold-item 32 :inline :offset-assert 16) ;; guessed by decompiler + (attempts qword 32 :inline :offset-assert 1552) ;; guessed by decompiler ) :method-count-assert 11 :size-assert #x810 @@ -14131,31 +15260,29 @@ (collide-edge-hold-list-method-10 () none 10) ;; (add-to-list! (_type_ collide-edge-hold-item) none 10) ) ) -|# -#| (deftype collide-edge-spec (structure) - ((split-dists UNKNOWN 2 :offset-assert 0) + ((split-dists float 2 :offset-assert 0) (outward-offset vector :inline :offset-assert 16) (flags uint64 :offset-assert 32) - (ignore-pat uint32 :offset-assert 40) + (ignore-pat pat-surface :offset-assert 40) (max-dist-sqrd-to-outward-pt float :offset-assert 44) (max-dir-cosa-delta float :offset-assert 48) (max-dir-cosa-player float :offset-assert 52) - (touching-segment uint32 :offset-assert 56) + (touching-segment symbol :offset-assert 56) (local-cache-fill-box bounding-box :inline :offset-assert 64) (local-within-reach-box bounding-box :inline :offset-assert 96) - (local-player-spheres UNKNOWN 12 :offset-assert 128) - (local-player-hanging-spheres UNKNOWN 6 :offset-assert 128) - (local-player-leap-up-spheres UNKNOWN 6 :offset-assert 224) + (local-player-spheres sphere 12 :inline :offset 128) + (local-player-hanging-spheres sphere 6 :inline :offset 128) + (local-player-leap-up-spheres sphere 6 :inline :offset 224) ) :method-count-assert 9 :size-assert #x140 :flag-assert #x900000140 ) -|# -#| +(declare-type collide-cache basic) + (deftype collide-edge-work (structure) ((ccache collide-cache :offset-assert 0) ;; guessed by decompiler (cshape collide-shape :offset-assert 4) ;; guessed by decompiler @@ -14167,14 +15294,14 @@ (within-reach-box4w bounding-box4w :inline :offset-assert 96) (search-pt vector :inline :offset-assert 128) (search-dir-vec vector :inline :offset-assert 144) - (world-player-spheres sphere 12 :offset-assert 160) ;; guessed by decompiler - (world-player-hanging-spheres sphere 6 :offset-assert 160) ;; guessed by decompiler - (world-player-leap-up-spheres sphere 6 :offset-assert 256) ;; guessed by decompiler + (world-player-spheres sphere 12 :inline :offset-assert 160) ;; guessed by decompiler + (world-player-hanging-spheres sphere 6 :inline :offset 160) ;; guessed by decompiler + (world-player-leap-up-spheres sphere 6 :inline :offset 256) ;; guessed by decompiler (spec collide-edge-spec :inline :offset-assert 352) (process uint32 :offset-assert 672) - (verts vector 64 :offset-assert 688) ;; guessed by decompiler - (edges collide-edge-edge 96 :offset-assert 1712) ;; guessed by decompiler - (tris collide-edge-tri 48 :offset-assert 6320) ;; guessed by decompiler + (verts vector 64 :inline :offset-assert 688) ;; guessed by decompiler + (edges collide-edge-edge 96 :inline :offset-assert 1712) ;; guessed by decompiler + (tris collide-edge-tri 48 :inline :offset-assert 6320) ;; guessed by decompiler (hold-list collide-edge-hold-list :inline :offset-assert 7856) ) :method-count-assert 21 @@ -14195,75 +15322,79 @@ (collide-edge-work-method-20 () none 20) ) ) -|# -;; (define-extern *collide-edge-spec* object) -;; (define-extern *collide-edge-work* object) ;; collide-edge-work -;; (define-extern *edge-grab-info* object) ;; edge-grab-info +(define-extern *collide-edge-spec* collide-edge-spec) +(define-extern *collide-edge-work* collide-edge-work) +(define-extern *edge-grab-info* edge-grab-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; process-drawable-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cspace-by-name-no-fail function) ;; (function process-drawable string cspace) -;; (define-extern cspace-index-by-name-no-fail function) ;; (function process-drawable string int) -;; (define-extern num-func-none function) ;; (function joint-control-channel float float float) -;; (define-extern num-func-+! function) ;; (function joint-control-channel float float float) -;; (define-extern num-func--! function) ;; (function joint-control-channel float float float) -;; (define-extern num-func-loop! function) ;; (function joint-control-channel float float float) -;; (define-extern num-func-loop-speedless! function) -;; (define-extern num-func-seek! function) ;; (function joint-control-channel float float float) -;; (define-extern num-func-blend-in! function) ;; (function joint-control-channel float float float) -;; (define-extern joint-channel-float-delete! function) -;; (define-extern num-func-interp-play! function) -;; (define-extern num-func-interp1-play! function) -;; (define-extern num-func-chan function) ;; (function joint-control-channel float float float) -;; (define-extern num-func-identity function) ;; (function joint-control-channel float float float) +(define-extern cspace-by-name-no-fail (function process-drawable string cspace)) +(define-extern cspace-index-by-name-no-fail (function process-drawable string int)) +(define-extern num-func-none (function joint-control-channel float float float)) +(define-extern num-func-+! (function joint-control-channel float float float)) +(define-extern num-func--! (function joint-control-channel float float float)) +(define-extern num-func-loop! (function joint-control-channel float float float)) +(define-extern num-func-loop-speedless! (function joint-control-channel float float float)) +(define-extern num-func-seek! (function joint-control-channel float float float)) +(define-extern num-func-blend-in! (function joint-control-channel float float float)) +(define-extern joint-channel-float-delete! (function joint-control-channel none)) +(define-extern num-func-interp-play! (function joint-control-channel float float float float)) +(define-extern num-func-interp1-play! (function joint-control-channel float float float float)) +(define-extern num-func-chan (function joint-control-channel float float float)) +(define-extern num-func-identity (function joint-control-channel float float float)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; process-focusable ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum focus-status + :bitfield #t + :type uint32 + (fs0 0) ;; if set, all collide checks fail + (fs1 1) ;; if set, all collide checks fail + (fs2 2) + ) + (deftype process-focusable (process-drawable) - ((focus-status uint32 :offset-assert 196) + ((focus-status focus-status :offset-assert 200) ) :method-count-assert 27 :size-assert #xcc :flag-assert #x1b005000cc (:methods - (process-focusable-method-20 () none 20) - (process-focusable-method-21 () none 21) - (process-focusable-method-22 () none 22) - (process-focusable-method-23 () none 23) - (process-focusable-method-24 () none 24) - (process-focusable-method-25 () none 25) - (process-focusable-method-26 () none 26) + (get-trans (_type_ int) vector 20) + (get-quat (_type_) quaternion 21) + (get-transv (_type_) vector 22) + (process-focusable-method-23 (_type_) none 23) + (process-focusable-method-24 (_type_) none 24) + (process-focusable-method-25 (_type_) none 25) + (process-focusable-method-26 (_type_) none 26) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; process-taskable-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype process-taskable (process-focusable) - ((task basic :offset-assert 200) - (ambient ambient-control :inline :offset-assert 204) - (neck-joint-index int32 :offset-assert 220) - (talk-message game-text-id :offset-assert 224) ;; guessed by decompiler - (bounce-away symbol :offset-assert 228) ;; guessed by decompiler - (will-talk symbol :offset-assert 232) ;; guessed by decompiler - (look-at-me basic :offset-assert 236) - (hide-during-movie basic :offset-assert 240) - (talk-distance meters :offset-assert 244) - (talk-height meters :offset-assert 248) - (last-talk uint64 :offset-assert 252) ;; time-frame - (want-to-say uint64 :offset-assert 260) - (birth-time time-frame :offset-assert 268) - (slave uint64 :offset-assert 276) + ((task basic :offset-assert 204) + (ambient ambient-control :inline :offset-assert 208) + (neck-joint-index int32 :offset-assert 224) + (talk-message game-text-id :offset-assert 228) ;; guessed by decompiler + (bounce-away symbol :offset-assert 232) ;; guessed by decompiler + (will-talk symbol :offset-assert 236) ;; guessed by decompiler + (look-at-me symbol :offset-assert 240) + (hide-during-movie symbol :offset-assert 244) + (talk-distance meters :offset-assert 248) + (talk-height meters :offset-assert 252) + (last-talk time-frame :offset-assert 256) ;; time-frame + (want-to-say uint64 :offset-assert 264) + (birth-time time-frame :offset-assert 272) + (slave handle :offset-assert 280) ) :method-count-assert 38 :size-assert #x120 @@ -14282,103 +15413,95 @@ (process-taskable-method-37 () none 37) ;; (push-reject-anim (_type_) none 37) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; focus ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; skipped : handle creation is different, want to grab more. +;; otherwise looks good + (deftype focus (structure) - ((handle uint64 :offset-assert 0) - (collide-with uint32 :offset-assert 8) + ((handle handle :offset-assert 0) + (collide-with collide-spec :offset-assert 8) ) :method-count-assert 13 :size-assert #xc :flag-assert #xd0000000c (:methods - (focus-method-9 () none 9) - (focus-method-10 () none 10) - (focus-method-11 () none 11) - (focus-method-12 () none 12) + (clear-focused (_type_) none 9) + (collide-check? (_type_ process-focusable) object 10) + (reset-to-collide-spec (_type_ collide-spec) none 11) + (try-update-focus (_type_ process-focusable) symbol 12) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; effect-control-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum effect-control-flag + :type uint32 + :bitfield #t + ) + (deftype effect-control (basic) - ((process process-drawable :offset-assert 4) ;; guessed by decompiler - (flags uint32 :offset-assert 8) - (last-frame-group art-joint-anim :offset-assert 12) ;; guessed by decompiler - (last-frame-num float :offset-assert 16) - (channel-offset int32 :offset-assert 20) - (res res-lump :offset-assert 24) ;; guessed by decompiler - (name (pointer res-tag) :offset-assert 28) ;; guessed by decompiler - (param uint32 :offset-assert 32) + ((process process-drawable :offset-assert 4) ;; guessed by decompiler + (flags effect-control-flag :offset-assert 8) + (last-frame-group art-joint-anim :offset-assert 12) ;; guessed by decompiler + (last-frame-num float :offset-assert 16) + (channel-offset int32 :offset-assert 20) + (res res-lump :offset-assert 24) ;; guessed by decompiler + (name (pointer res-tag) :offset-assert 28) ;; guessed by decompiler + (param uint32 :offset-assert 32) ) :method-count-assert 15 :size-assert #x24 :flag-assert #xf00000024 (:methods - ;; (new (symbol type process-drawable) _type_ 0) + (new (symbol type process-drawable) _type_ 0) (effect-control-method-9 () none 9) ;; (TODO-RENAME-9 (_type_) none 9) (effect-control-method-10 () none 10) ;; (dummy-10 (_type_ symbol float int) object 10) (effect-control-method-11 () none 11) ;; (dummy-11 (_type_ symbol float int basic pat-surface) none 11) (effect-control-method-12 () none 12) ;; (dummy-12 (_type_ symbol float int basic sound-name) int 12) - (effect-control-method-13 () none 13) ;; (set-channel-offset! (_type_ int) none 13) + (set-channel-offset! (_type_ int) none 13) (effect-control-method-14 () none 14) ;; (TODO-RENAME-14 (_type_ float float float) none 14) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-frag-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype collide-frag-vertex (vector) - ((data float 4 :offset-assert 0) ;; guessed by decompiler - (x float :offset-assert 0) - (y float :offset-assert 4) - (z float :offset-assert 8) - (w float :offset-assert 12) - (quad uint128 :offset-assert 0) - ) + () :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype collide-frag-mesh (basic) ((packed-data uint32 :offset-assert 4) (pat-array uint32 :offset-assert 8) (strip-data-len uint16 :offset-assert 12) (poly-count uint16 :offset-assert 14) (base-trans vector4w :inline :offset-assert 16) ;; vector :inline - (vertex-count uint8 :offset-assert 28) - (vertex-data-qwc uint8 :offset-assert 29) - (total-qwc uint8 :offset-assert 30) - (unused uint8 :offset-assert 31) + (vertex-count uint8 :offset 28) + (vertex-data-qwc uint8 :offset 29) + (total-qwc uint8 :offset 30) + (unused uint8 :offset 31) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype collide-fragment (drawable) - ((mesh collide-frag-mesh :offset-assert 8) ;; guessed by decompiler - (collide-new basic :offset-assert 12) + ((mesh collide-frag-mesh :offset 8) ;; guessed by decompiler + (collide-new basic :offset 12) ) :method-count-assert 17 :size-assert #x20 @@ -14386,11 +15509,10 @@ (:methods ) ) -|# -#| (deftype drawable-inline-array-collide-fragment (drawable-inline-array) - ((data collide-fragment 1 :offset-assert 36) ;; guessed by decompiler + ((data collide-fragment 1 :inline :offset-assert 32) ;; guessed by decompiler + (pad uint32) ) :method-count-assert 17 :size-assert #x44 @@ -14398,32 +15520,28 @@ (:methods ) ) -|# -;; (deftype drawable-tree-collide-fragment (drawable-tree) -;; () -;; :flag-assert #x1100000020 -;; ) +(deftype drawable-tree-collide-fragment (drawable-tree) + () + :flag-assert #x1100000020 + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-hash-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype collide-hash-scratch (structure) - ((collidable-bits UNKNOWN 128 :offset-assert 0) - (poly-bits UNKNOWN 2 :offset-assert 0) - (id-bits UNKNOWN 512 :offset-assert 0) + ((collidable-bits uint128 128 :offset-assert 0) + (poly-bits uint64 2 :offset 0) + (id-bits uint32 512 :offset 0) (tris uint32 :offset-assert 2048) ) :method-count-assert 9 :size-assert #x804 :flag-assert #x900000804 ) -|# -#| (deftype collide-hash-bucket (structure) ((index int16 :offset-assert 0) (count int16 :offset-assert 2) @@ -14432,9 +15550,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype collide-hash-item (structure) ((id uint32 :offset-assert 0) (collidable basic :offset-assert 4) @@ -14443,54 +15559,49 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype collide-hash-poly (structure) - ((data UNKNOWN 4 :offset-assert 0) - (vert-index0 uint8 :offset-assert 0) - (vert-index1 uint8 :offset-assert 1) - (vert-index2 uint8 :offset-assert 2) - (pat-index uint8 :offset-assert 3) - (word uint32 :offset-assert 0) + ((data uint8 4 :offset-assert 0 :score -1) + (vert-index0 uint8 :offset 0) + (vert-index1 uint8 :offset 1) + (vert-index2 uint8 :offset 2) + (pat-index uint8 :offset 3) + (word uint32 :offset 0) ) :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype collide-hash-fragment-stats (structure) ((num-verts uint16 :offset-assert 0) (num-polys uint8 :offset-assert 2) (poly-count uint8 :offset-assert 3) ) + :pack-me :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype collide-hash-fragment (drawable) - ((num-buckets uint16 :offset-assert 4) - (num-indices uint16 :offset-assert 6) - (pat-array uint32 :offset-assert 8) - (bucket-array uint32 :offset-assert 12) + ((num-buckets uint16 :offset 4) + (num-indices uint16 :offset 6) + (pat-array uint32 :offset 8) + (bucket-array uint32 :offset 12) (grid-step vector :inline :offset-assert 32) (bbox bounding-box :inline :offset-assert 48) (bbox4w bounding-box4w :inline :offset-assert 80) - (axis-scale vector :inline :offset-assert 64) - (avg-extents vector :inline :offset-assert 80) - (dimension-array UNKNOWN 4 :offset-assert 44) - (stats collide-hash-fragment-stats :inline :offset-assert 60) - (num-verts uint16 :offset-assert 60) - (num-polys uint8 :offset-assert 62) - (poly-count uint8 :offset-assert 63) - (poly-array uint32 :offset-assert 76) - (vert-array uint32 :offset-assert 92) - (index-array uint32 :offset-assert 108) + (axis-scale vector :inline :offset 64) + (avg-extents vector :inline :offset 80) + (dimension-array uint32 4 :offset 44) ;; ? + (stats collide-hash-fragment-stats :inline :offset 60) + (num-verts uint16 :offset 60) + (num-polys uint8 :offset 62) + (poly-count uint8 :offset 63) + (poly-array uint32 :offset 76) + (vert-array uint32 :offset 92) + (index-array uint32 :offset 108) ) :method-count-assert 17 :size-assert #x70 @@ -14498,36 +15609,28 @@ (:methods ) ) -|# -#| (deftype collide-hash-fragment-array (array) - ((type basic :offset-assert 0) - (length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (content-type basic :offset-assert 12) - ) + () :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype collide-hash (drawable) - ((num-ids uint16 :offset-assert 4) - (id-count uint16 :offset-assert 6) - (num-buckets uint32 :offset-assert 8) - (qwc-id-bits uint32 :offset-assert 12) - (grid-step vector :inline :offset-assert 16) + ((num-ids uint16 :offset 4) + (id-count uint16 :offset 6) + (num-buckets uint32 :offset 8) + (qwc-id-bits uint32 :offset 12) + (grid-step vector :inline :offset 16) (bbox bounding-box :inline :offset-assert 32) (bbox4w bounding-box4w :inline :offset-assert 64) - (axis-scale vector :inline :offset-assert 48) - (avg-extents vector :inline :offset-assert 64) - (bucket-array uint32 :offset-assert 44) - (item-array uint32 :offset-assert 60) - (dimension-array UNKNOWN 3 :offset-assert 76) - (num-items uint32 :offset-assert 92) + (axis-scale vector :inline :offset 48) + (avg-extents vector :inline :offset 64) + (bucket-array uint32 :offset 44) + (item-array uint32 :offset 60) + (dimension-array uint32 3 :offset 76) ;; ? + (num-items uint32 :offset 92) ) :method-count-assert 17 :size-assert #x60 @@ -14535,19 +15638,17 @@ (:methods ) ) -|# -;; (define-extern *collide-list-boxes* object) -;; (define-extern *collide-hash-fragments* object) -;; (define-extern *collide-hash-fragments-tfrag* object) -;; (define-extern *collide-hash-fragments-instance* object) -;; (define-extern *already-printed-exeeded-max-cache-tris* object) ;; symbol +(define-extern *collide-list-boxes* object) +(define-extern *collide-hash-fragments* object) +(define-extern *collide-hash-fragments-tfrag* object) +(define-extern *collide-hash-fragments-instance* object) +(define-extern *already-printed-exeeded-max-cache-tris* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; chain-physics-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype chain-physics-setup (structure) ((joint-index int32 :offset-assert 0) ) @@ -14555,9 +15656,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype chain-physics-joint (structure) ((position vector :inline :offset-assert 0) (velocity vector :inline :offset-assert 16) @@ -14568,11 +15667,9 @@ :size-assert #x34 :flag-assert #x900000034 ) -|# -#| (deftype chain-physics (basic) - ((chain-joints UNKNOWN 20 :offset-assert 16) + ((chain-joints chain-physics-joint 20 :inline :offset-assert 16) (num-joints uint8 :offset-assert 1296) (root-joint-index uint8 :offset-assert 1297) (joint-length float :offset-assert 1300) @@ -14603,43 +15700,46 @@ (chain-physics-method-17 () none 17) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; projectile-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum projectile-options + :type uint64 + :bitfield #t + ) + (deftype projectile (process-drawable) - ((starting-pos vector :inline :offset-assert 204) - (starting-dir vector :inline :offset-assert 220) - (target-pos vector :inline :offset-assert 236) - (base-target-pos vector :inline :offset-assert 252) - (pre-move-transv vector :inline :offset-assert 268) - (timeout uint64 :offset-assert 284) ;; time-frame - (spawn-time time-frame :offset-assert 292) - (options uint64 :offset-assert 300) - (last-target uint64 :offset-assert 308) ;; handle - (notify-handle uint64 :offset-assert 316) ;; handle - (owner-handle uint64 :offset-assert 324) - (ignore-handle uint64 :offset-assert 332) - (update-velocity (function projectile none) :offset-assert 340) ;; guessed by decompiler - (move basic :offset-assert 344) - (pick-target basic :offset-assert 348) - (max-speed float :offset-assert 352) - (old-dist float 16 :offset-assert 356) ;; guessed by decompiler - (old-dist-count int32 :offset-assert 420) - (hits int32 :offset-assert 424) - (max-hits int32 :offset-assert 428) - (tween float :offset-assert 432) - (attack-mode symbol :offset-assert 436) ;; guessed by decompiler - (attack-id uint32 :offset-assert 440) - (damage float :offset-assert 444) - (charge-level float :offset-assert 448) - (sound-id sound-id :offset-assert 452) ;; guessed by decompiler - (stop-speed meters :offset-assert 456) - (invinc-time time-frame :offset-assert 460) + ((starting-pos vector :inline :offset-assert 208) + (starting-dir vector :inline :offset-assert 224) + (target-pos vector :inline :offset-assert 240) + (base-target-pos vector :inline :offset-assert 256) + (pre-move-transv vector :inline :offset-assert 272) + (timeout time-frame :offset-assert 288) + (spawn-time time-frame :offset-assert 296) + (options projectile-options :offset-assert 304) + (last-target handle :offset-assert 312) + (notify-handle handle :offset-assert 320) + (owner-handle handle :offset-assert 328) + (ignore-handle handle :offset-assert 336) + (update-velocity (function projectile none) :offset-assert 344) ;; guessed by decompiler + (move basic :offset-assert 348) + (pick-target basic :offset-assert 352) + (max-speed float :offset-assert 356) + (old-dist float 16 :offset-assert 360) ;; guessed by decompiler + (old-dist-count int32 :offset-assert 424) + (hits int32 :offset-assert 428) + (max-hits int32 :offset-assert 432) + (tween float :offset-assert 436) + (attack-mode symbol :offset-assert 440) ;; guessed by decompiler + (attack-id uint32 :offset-assert 444) + (damage float :offset-assert 448) + (charge-level float :offset-assert 452) + (sound-id sound-id :offset-assert 456) ;; guessed by decompiler + (stop-speed meters :offset-assert 460) + (invinc-time time-frame :offset-assert 464) ) :method-count-assert 40 :size-assert #x1d8 @@ -14667,31 +15767,27 @@ (projectile-method-39 () none 39) ) ) -|# -#| (deftype projectile-init-by-other-params (structure) ((ent basic :offset-assert 0) (charge float :offset-assert 4) (attack-id uint32 :offset-assert 8) - (options uint64 :offset-assert 16) - (notify-handle uint64 :offset-assert 24) - (owner-handle uint64 :offset-assert 32) - (ignore-handle uint64 :offset-assert 40) + (options projectile-options :offset-assert 16) + (notify-handle handle :offset-assert 24) + (owner-handle handle :offset-assert 32) + (ignore-handle handle :offset-assert 40) (pos vector :inline :offset-assert 48) (vel vector :inline :offset-assert 64) - (timeout uint64 :offset-assert 80) + (timeout handle :offset-assert 80) ) :method-count-assert 9 :size-assert #x58 :flag-assert #x900000058 ) -|# -#| (deftype projectile-bounce (projectile) - ((played-bounce-time time-frame :offset-assert 468) - (tumble-quat quaternion :inline :offset-assert 476) + ((played-bounce-time time-frame :offset-assert 472) + (tumble-quat quaternion :inline :offset-assert 480) ) :method-count-assert 42 :size-assert #x1f0 @@ -14701,85 +15797,92 @@ (projectile-bounce-method-41 () none 41) ) ) -|# -;; (define-extern spawn-projectile function) +(define-extern spawn-projectile (function type projectile-init-by-other-params process-tree dead-pool (pointer process))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; find-nearest-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; empty! ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; missing ref test - there's a useless array defintion with a list of not-yet-defined types +;; and this doesn't work in goalc. + +(declare-type sidekick basic) +(declare-type racer-info basic) +(declare-type tube-info basic) +(declare-type flut-info basic) + (deftype target (process-focusable) - ((control control-info :offset-assert 124) ;; guessed by decompiler - (skel2 basic :offset-assert 200) - (shadow-backup basic :offset-assert 204) - (target-flags uint32 :offset-assert 184) - (game game-info :offset-assert 208) ;; guessed by decompiler - (neck joint-mod :offset-assert 212) ;; guessed by decompiler - (head basic :offset-assert 216) - (upper-body basic :offset-assert 220) - (horns basic :offset-assert 224) - (hair UNKNOWN 2 :offset-assert 228) - (darkjak-interp float :offset-assert 236) - (darkjak-giant-interp float :offset-assert 240) - (arm-ik UNKNOWN 2 :offset-assert 244) - (leg-ik UNKNOWN 2 :offset-assert 252) - (foot UNKNOWN 2 :offset-assert 260) - (init-time time-frame :offset-assert 268) - (teleport-time time-frame :offset-assert 276) - (state-hook-time time-frame :offset-assert 284) ;; time-frame - (state-hook (function none :behavior target) :offset-assert 292) ;; guessed by decompiler - (cam-user-mode symbol :offset-assert 296) ;; guessed by decompiler - (sidekick (pointer sidekick) :offset-assert 300) ;; guessed by decompiler - (manipy (pointer manipy) :offset-assert 304) ;; guessed by decompiler - (mirror uint32 :offset-assert 308) - (attack-info attack-info :inline :offset-assert 316) - (attack-info-rec attack-info :inline :offset-assert 476) - (attack-info-old UNKNOWN 8 :offset-assert 636) - (anim-seed uint64 :offset-assert 1916) - (alt-cam-pos vector :inline :offset-assert 1932) - (current-level level :offset-assert 1948) ;; guessed by decompiler - (saved-pos transformq :inline :offset-assert 1964) - (saved-owner uint64 :offset-assert 2012) - (alt-neck-pos vector :inline :offset-assert 2028) - (focus-search basic :offset-assert 2044) - (excitement float :offset-assert 2048) - (shock-effect-time time-frame :offset-assert 2052) - (beard? basic :offset-assert 2060) - (spool-anim basic :offset-assert 2064) - (ambient-time time-frame :offset-assert 2068) - (fp-hud uint64 :offset-assert 2076) ;; handle - (no-load-wait uint64 :offset-assert 2084) ;; time-frame - (no-look-around-wait uint64 :offset-assert 2092) ;; time-frame - (burn-proc uint64 :offset-assert 2100) ;; handle - (pre-joint-hook basic :offset-assert 2108) - (notify uint64 :offset-assert 2116) - (mode-cache basic :offset-assert 2124) - (mode-param1 uint64 :offset-assert 2132) - (mode-param2 uint64 :offset-assert 2140) - (mode-param3 uint64 :offset-assert 2148) - (tobot-state basic :offset-assert 2156) - (tobot? basic :offset-assert 2160) - (tobot-recorder basic :offset-assert 2164) - (color-effect basic :offset-assert 2168) - (color-effect-start-time time-frame :offset-assert 2172) - (color-effect-duration uint64 :offset-assert 2180) - (racer racer-info :offset-assert 2188) ;; guessed by decompiler - (tube tube-info :offset-assert 2192) ;; guessed by decompiler - (flut flut-info :offset-assert 2196) ;; guessed by decompiler - (board basic :offset-assert 2200) - (pilot basic :offset-assert 2204) - (gun basic :offset-assert 2208) - (mech basic :offset-assert 2212) - (turret basic :offset-assert 2216) - (darkjak basic :offset-assert 2220) - (indax basic :offset-assert 2224) + ((control control-info :offset 128) ;; guessed by decompiler + (skel2 basic :offset-assert 204) + (shadow-backup basic :offset-assert 208) + (target-flags uint32 :offset 188) + (game game-info :offset-assert 212) ;; guessed by decompiler + (neck joint-mod :offset-assert 216) ;; guessed by decompiler + (head basic :offset-assert 220) + (upper-body basic :offset-assert 224) + (horns basic :offset-assert 228) + (hair basic 2 :offset-assert 232) + (darkjak-interp float :offset-assert 240) + (darkjak-giant-interp float :offset-assert 244) + (arm-ik basic 2 :offset-assert 248) + (leg-ik basic 2 :offset-assert 256) + (foot basic 2 :offset-assert 264) + (init-time time-frame :offset-assert 272) + (teleport-time time-frame :offset-assert 280) + (state-hook-time time-frame :offset-assert 288) ;; time-frame + (state-hook (function none :behavior target) :offset-assert 296) ;; guessed by decompiler + (cam-user-mode symbol :offset-assert 300) ;; guessed by decompiler + (sidekick (pointer sidekick) :offset-assert 304) ;; guessed by decompiler + (manipy (pointer manipy) :offset-assert 308) ;; guessed by decompiler + (mirror uint32 :offset-assert 312) + (attack-info attack-info :inline :offset-assert 320) + (attack-info-rec attack-info :inline :offset-assert 480) + (attack-info-old attack-info 8 :inline :offset-assert 640) + (anim-seed uint64 :offset-assert 1920) + (alt-cam-pos vector :inline :offset-assert 1936) + (current-level level :offset-assert 1952) ;; guessed by decompiler + (saved-pos transformq :inline :offset-assert 1968) + (saved-owner uint64 :offset-assert 2016) + (alt-neck-pos vector :inline :offset-assert 2032) + (focus-search basic :offset-assert 2048) + (excitement float :offset-assert 2052) + (shock-effect-time time-frame :offset-assert 2056) + (beard? basic :offset-assert 2064) + (spool-anim basic :offset-assert 2068) + (ambient-time time-frame :offset-assert 2072) + (fp-hud uint64 :offset-assert 2080) ;; handle + (no-load-wait uint64 :offset-assert 2088) ;; time-frame + (no-look-around-wait uint64 :offset-assert 2096) ;; time-frame + (burn-proc uint64 :offset-assert 2104) ;; handle + (pre-joint-hook basic :offset-assert 2112) + (notify uint64 :offset-assert 2120) + (mode-cache basic :offset-assert 2128) + (mode-param1 uint64 :offset-assert 2136) + (mode-param2 uint64 :offset-assert 2144) + (mode-param3 uint64 :offset-assert 2152) + (tobot-state basic :offset-assert 2160) + (tobot? basic :offset-assert 2164) + (tobot-recorder basic :offset-assert 2168) + (color-effect basic :offset-assert 2172) + (color-effect-start-time time-frame :offset-assert 2176) + (color-effect-duration uint64 :offset-assert 2184) + (racer racer-info :offset-assert 2192) ;; guessed by decompiler + (tube tube-info :offset-assert 2196) ;; guessed by decompiler + (flut flut-info :offset-assert 2200) ;; guessed by decompiler + (board basic :offset-assert 2204) + (pilot basic :offset-assert 2208) + (gun basic :offset-assert 2212) + (mech basic :offset-assert 2216) + (turret basic :offset-assert 2220) + (darkjak basic :offset-assert 2224) + (indax basic :offset-assert 2228) ) :method-count-assert 29 :size-assert #x8b8 @@ -14790,18 +15893,16 @@ (target-method-28 () none 28) ) ) -|# -#| (deftype sidekick (process-drawable) - ((control control-info :offset-assert 124) ;; guessed by decompiler - (anim-seed uint64 :offset-assert 204) - (shadow-in-movie? symbol :offset-assert 212) ;; guessed by decompiler - (special-anim-time time-frame :offset-assert 220) - (special-anim-interp float :offset-assert 228) - (special-anim-frame float :offset-assert 232) - (offset transformq :inline :offset-assert 236) - (mirror uint32 :offset-assert 284) + ((control control-info :offset 128) ;; guessed by decompiler + (anim-seed uint64 :offset 208) ;; ?? + (shadow-in-movie? symbol :offset-assert 216) ;; guessed by decompiler + (special-anim-time time-frame :offset-assert 224) + (special-anim-interp float :offset-assert 232) + (special-anim-frame float :offset-assert 236) + (offset transformq :inline :offset-assert 240) + (mirror uint32 :offset-assert 288) ) :method-count-assert 20 :size-assert #x124 @@ -14809,16 +15910,14 @@ (:methods ) ) -|# -;; (define-extern *target* object) ;; target -;; (define-extern *sidekick* object) ;; sidekick +(define-extern *target* target) +(define-extern *sidekick* sidekick) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; stats-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype tr-stat (structure) ((groups uint16 :offset-assert 0) (fragments uint16 :offset-assert 2) @@ -14831,9 +15930,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype merc-global-stats (structure) ((merc tr-stat :inline :offset-assert 0) (emerc tr-stat :inline :offset-assert 16) @@ -14843,9 +15940,7 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype perf-stat (structure) ((frame-number uint32 :offset-assert 0) (count uint32 :offset-assert 4) @@ -14866,33 +15961,83 @@ :flag-assert #xe00000034 (:methods (perf-stat-method-9 () none 9) ;; (dummy-9 (_type_) none 9) - (perf-stat-method-10 () none 10) ;; (print-to-stream (_type_ string basic) none 10) - (perf-stat-method-11 () none 11) ;; (reset! (_type_) none 11) - (perf-stat-method-12 () none 12) ;; (read! (_type_) none 12) - (perf-stat-method-13 () none 13) ;; (update-wait-stats (_type_ uint uint uint) none 13) + (print-to-stream (_type_ string basic) none 10) + (reset! (_type_) none 11) + (read! (_type_) none 12) + (update-wait-stats (_type_ uint uint uint) none 13) ) ) -|# -#| (deftype perf-stat-array (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data perf-stat :dynamic :offset-assert 16) ;; guessed by decompiler + ((data perf-stat :dynamic :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -;; (define-extern perf-stat-bucket->string function) ;; (function perf-stat-bucket string) +(defenum perf-stat-bucket + :type uint32 ;; guess + + (all-code 0) + (spatial-hash-build 1) + (spatial-hash-search 2) + (collide 3) + (collide-list 4) + (collide-fill 5) + (actor-hash 6) + (nav 7) + (nav-dma-all 8) + (nav-dma-read 9) + (nav-dma-write 10) + (nav-dma-work 11) + (nav-part1 12) + (nav-part2 13) + (nav-part3 14) + (nav-part4 15) + (nav-part5 16) + (nav-part6 17) + (nav-part7 18) + (nav-part8 19) + (nav-part9 20) + (nav-part10 21) + (add-to-translation 22) + (update-current-poly 23) + (clamp-vector-to-mesh 24) + (ray-step 25) + (update-spheres 26) + (travel-around-spheres 27) + (avoid-spheres 28) + (check-vector-collision-with-nav-spheres 29) + (find-nearest-poly 30) + (find-containing-poly 31) + (generate-velocity 32) + (apply-rotation 33) + (apply-velocity 34) + (travel-post 35) + (common-post 36) + (misc 37) + (mercneric 38) + (tie-generic 39) + (background 40) + (drawable 41) + (tfrag 42) + (tfrag-scissor 43) + (inst-shrub 44) + (proto-shrub 45) + (inst-tie 46) + (proto-tie 47) + (bones 48) + (camera 49) + (foreground 50) + ) + +(define-extern perf-stat-bucket->string (function perf-stat-bucket string)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bsp-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype bsp-node (structure) ((front int16 :offset-assert 0) ;; int32 (back int16 :offset-assert 2) ;; int32 @@ -14905,9 +16050,7 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype game-level (basic) ((master-bsp basic :offset-assert 4) ) @@ -14915,9 +16058,7 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype view-frustum (structure) ((hither-top-left vector :inline :offset-assert 0) (hither-top-right vector :inline :offset-assert 16) @@ -14932,23 +16073,77 @@ :size-assert #x80 :flag-assert #x900000080 ) -|# -#| +(declare-type entity-camera entity) +(declare-type entity-race-mesh entity) +(declare-type entity-nav-mesh entity) +(declare-type actor-group basic) + (deftype bsp-header (drawable) - () + ( + (info file-info :offset 4) + (all-visible-list (pointer uint16) :offset-assert 32) + (visible-list-length int16 :offset-assert 36) + (drawable-trees drawable-tree-array :offset-assert 40) + (pat pointer :offset-assert 44) + (pat-length int32 :offset-assert 48) + + ; ;; some sort of texture remapping info (seems to be same in jak2) + ; (texture-remap-table (pointer uint64) :offset-assert 52) + ; (texture-remap-table-len int32 :offset-assert 56) + + (texture-ids (pointer texture-id) :offset 60) + (texture-page-count int32 :offset 64) + + ; (unk-zero-0 basic :offset-assert 68) + + (name symbol :offset 72) + (nickname symbol :offset-assert 76) + (vis-info level-vis-info 8 :offset 80) + (actors drawable-inline-array-actor :offset-assert 112) + (cameras (array entity-camera) :offset-assert 116) + (nodes (inline-array bsp-node) :offset 120) + (level level :offset-assert 124) + ; (current-leaf-idx uint16 :offset-assert 128) + (unk-data-2 uint16 9 :offset 130) + + ; (boxes box8s-array :offset-assert 148) + ; (current-bsp-back-flags uint32 :offset-assert 152) + (unk-byte uint8 :offset 152) + ; (ambients drawable-inline-array-ambient :offset-assert 156) ;; now just #t? + (unk-data-4 float :offset 160) + (unk-data-5 float :offset-assert 164) + ; (adgifs adgif-shader-array :offset-assert 168) + (race-meshes (array entity-race-mesh) :offset 168) + ;; 172 is something + (light-hash light-hash :offset 176) + (nav-meshes (array entity-nav-mesh) :offset 180) + (actor-groups (array actor-group) :offset 184) + + (collide-hash collide-hash :offset 196) + ;; 200 is some array + ;; 204 is maybe that array's length + ;; 216 is a vector array + + (region-tree drawable-tree-region-prim :offset 252) + + ; (actor-birth-order (pointer uint32) :offset-assert 172) + ; (split-box-indices (pointer uint16) :offset-assert 176) + (unk-data-8 uint32 55 :offset 180) + ) :method-count-assert 19 :size-assert #x190 :flag-assert #x1300000190 ;; Failed to read fields. (:methods - (bsp-header-method-17 () none 17) - (bsp-header-method-18 () none 18) ;; (birth (_type_) none 18) + (birth (_type_) none 17) + (deactivate-entities (_type_) none 18) ) ) -|# -#| +;; something very strange happened here and these stopwatches are +;; totally broken + (deftype collide-stats (structure) ((calls uint32 :offset-assert 0) (spheres uint32 :offset-assert 4) @@ -14956,24 +16151,24 @@ (frags uint32 :offset-assert 12) (tris uint32 :offset-assert 16) (output uint32 :offset-assert 20) - (total-target stopwatch :inline :offset-assert 28) - (target-cache-fill stopwatch :inline :offset-assert 60) - (target-ray-poly stopwatch :inline :offset-assert 92) + (pad0 uint32 2) + (total-target uint32 8 :offset-assert 32) + (target-cache-fill uint32 8 :offset-assert 64) + (target-ray-poly uint32 6 :offset-assert 96) + ;(pad uint8 :offset 119) ) :method-count-assert 9 :size-assert #x78 :flag-assert #x900000078 ) -|# -;; (define-extern inspect-bsp-tree function) ;; (function bsp-header bsp-node none) -;; (define-extern map-bsp-tree function) ;; (function (function bsp-node none) bsp-header bsp-node none) +(define-extern inspect-bsp-tree (function bsp-header bsp-node none)) +(define-extern map-bsp-tree (function (function bsp-node none) bsp-header bsp-node none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-cache-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype collide-puss-sphere (structure) ((bsphere sphere :inline :offset-assert 0) (bbox4w bounding-box4w :inline :offset-assert 16) @@ -14982,15 +16177,13 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype collide-puss-work (structure) ((closest-pt vector :inline :offset-assert 0) (tri-normal vector :inline :offset-assert 16) (tri-bbox4w bounding-box4w :inline :offset-assert 32) (spheres-bbox4w bounding-box4w :inline :offset-assert 64) - (spheres collide-puss-sphere 64 :offset-assert 96) ;; guessed by decompiler + (spheres collide-puss-sphere 64 :inline :offset-assert 96) ;; guessed by decompiler ) :method-count-assert 11 :size-assert #xc60 @@ -15000,37 +16193,33 @@ (collide-puss-work-method-10 () none 10) ;; (dummy-10 (_type_ object object) symbol 10) ) ) -|# -#| (deftype collide-cache-tri (structure) - ((vertex vector 3 :offset-assert 0) ;; guessed by decompiler - (extra-quad uint128 16 :offset-assert 48) ;; guessed by decompiler - (pat pat-surface :offset-assert 48) ;; guessed by decompiler - (collide-ptr basic :offset-assert 52) - (prim-index uint16 :offset-assert 56) - (user16 uint16 :offset-assert 58) - (user32 uint32 :offset-assert 60) + ((vertex vector 3 :inline :offset-assert 0) ;; guessed by decompiler + (extra-quad uint8 16 :offset-assert 48) ;; guessed by decompiler + (pat pat-surface :offset 48) ;; guessed by decompiler + (collide-ptr basic :offset 52) + (prim-index uint16 :offset 56) + (user16 uint16 :offset 58) + (user32 uint32 :offset 60) ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype collide-cache-prim (structure) ((prim-core collide-prim-core :inline :offset-assert 0) - (extra-quad uint128 16 :offset-assert 32) ;; guessed by decompiler - (ccache collide-cache :offset-assert 32) ;; guessed by decompiler - (prim collide-shape-prim :offset-assert 36) ;; guessed by decompiler - (first-tri uint16 :offset-assert 40) - (num-tris uint16 :offset-assert 42) - (unused uint8 4 :offset-assert 44) ;; guessed by decompiler - (world-sphere vector :inline :offset-assert 0) - (collide-as collide-kind :offset-assert 16) ;; guessed by decompiler - (action collide-action :offset-assert 24) ;; guessed by decompiler - (prim-type int8 :offset-assert 28) + (extra-quad uint8 16 :offset-assert 32) ;; guessed by decompiler + (ccache collide-cache :offset 32) ;; guessed by decompiler + (prim collide-shape-prim :offset 36) ;; guessed by decompiler + (first-tri uint16 :offset 40) + (num-tris uint16 :offset 42) + (unused uint8 4 :offset 44) ;; guessed by decompiler + (world-sphere vector :inline :offset 0) + (collide-as collide-spec :offset 16) ;; guessed by decompiler + (action collide-action :offset 24) ;; guessed by decompiler + (prim-type prim-type :offset 28) ) :method-count-assert 11 :size-assert #x30 @@ -15040,20 +16229,18 @@ (collide-cache-prim-method-10 () none 10) ;; (resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float 10) ) ) -|# -#| (deftype collide-cache (basic) ((num-tris int32 :offset-assert 4) (num-prims int32 :offset-assert 8) (ignore-mask pat-surface :offset-assert 12) ;; guessed by decompiler - (ignore-processes UNKNOWN 2 :offset-assert 16) + (ignore-processes process 2 :offset-assert 16) (collide-box bounding-box :inline :offset-assert 32) (collide-box4w bounding-box4w :inline :offset-assert 64) - (collide-with collide-kind :offset-assert 96) ;; guessed by decompiler + (collide-with collide-spec :offset-assert 96) ;; guessed by decompiler (unused uint32 :offset-assert 100) - (prims collide-cache-prim 100 :offset-assert 112) ;; guessed by decompiler - (tris collide-cache-tri 461 :offset-assert 4912) ;; guessed by decompiler + (prims collide-cache-prim 100 :inline :offset-assert 112) ;; guessed by decompiler + (tris collide-cache-tri 461 :inline :offset-assert 4912) ;; guessed by decompiler ) :method-count-assert 26 :size-assert #x8670 @@ -15078,64 +16265,59 @@ (collide-cache-method-25 () none 25) ;; (fill-from-water (_type_ water-control) none 25) ) ) -|# -#| (deftype collide-list-item (structure) ((mesh collide-frag-mesh :offset-assert 0) ;; guessed by decompiler (inst basic :offset-assert 4) ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype collide-list (structure) ((num-items int32 :offset-assert 0) - (items collide-list-item 256 :offset-assert 16) ;; guessed by decompiler + (items collide-list-item 256 :inline :offset 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x810 :flag-assert #x900000810 ) -|# -;; (define-extern *collide-cache* object) ;; collide-cache -;; (define-extern *collide-list* object) ;; collide-list +(define-extern *collide-cache* collide-cache) +(define-extern *collide-list* collide-list) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype collide-query (structure) ((best-other-tri collide-tri-result :inline :offset-assert 0) - (best-my-tri collide-tri-result :inline :offset-assert 0) - (ignore-processes UNKNOWN 2 :offset-assert 88) - (ignore-process0 basic :offset-assert 88) - (ignore-process1 basic :offset-assert 92) - (ignore-pat uint32 :offset-assert 96) - (collide-with uint32 :offset-assert 100) - (overlay-params UNKNOWN 3 :offset-assert 112) + (best-my-tri collide-tri-result :inline :offset 0) + (ignore-processes process 2 :offset-assert 88) + (ignore-process0 process :offset 88) + (ignore-process1 process :offset 92) + (ignore-pat pat-surface :offset-assert 96) + (collide-with collide-spec :offset-assert 100) + (overlay-params uint32 3 :offset 112) ;; ? (bbox bounding-box :inline :offset-assert 128) (bbox4w bounding-box4w :inline :offset-assert 160) (bsphere sphere :inline :offset-assert 192) (start-pos vector :inline :offset-assert 208) (move-dist vector :inline :offset-assert 224) (rlength vector :inline :offset-assert 240) - (exit-planes UNKNOWN 2 :offset-assert 256) - (radius float :offset-assert 268) - (inv-mat matrix :inline :offset-assert 288) - (spheres uint32 :offset-assert 112) - (num-spheres uint32 :offset-assert 116) - (solid-only basic :offset-assert 120) - (best-dist float :offset-assert 112) - (best-other-prim basic :offset-assert 116) - (best-my-prim basic :offset-assert 120) - (move-vec vector :inline :offset-assert 224) - (best-u float :offset-assert 112) + (exit-planes plane 2 :offset-assert 256) ;; ? + (radius float :offset 268) + (inv-mat matrix :inline :offset 288) + (spheres uint32 :offset 112) + (num-spheres uint32 :offset 116) + (solid-only basic :offset 120) + (best-dist float :offset 112 :score 1) + (best-other-prim basic :offset 116) + (best-my-prim basic :offset 120) + (move-vec vector :inline :offset 224) + (best-u float :offset 112) (action-mask uint32 :offset-assert 352) (local-box4w bounding-box4w :inline :offset-assert 368) (search-box bounding-box4w :inline :offset-assert 400) @@ -15153,15 +16335,13 @@ :size-assert #x21c :flag-assert #x90000021c ) -|# -;; (define-extern *collide-test-flag* object) ;; symbol +(define-extern *collide-test-flag* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; shrubbery-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype billboard (drawable) ((flat adgif-shader :inline :offset-assert 32) ) @@ -15171,41 +16351,45 @@ (:methods ) ) -|# -#| (deftype shrub-view-data (structure) ((data uint128 3 :offset-assert 0) ;; guessed by decompiler - (texture-giftag qword :inline :offset-assert 0) ;; gs-gif-tag :inline - (consts vector :inline :offset-assert 16) - (fog-clamp vector :inline :offset-assert 32) - (tex-start-ptr int32 :offset-assert 16) - (gifbufsum float :offset-assert 16) - (mtx-buf-ptr int32 :offset-assert 20) - (exp23 float :offset-assert 20) - (fog-0 float :offset-assert 24) - (fog-1 float :offset-assert 28) - (fog-min float :offset-assert 32) - (fog-max float :offset-assert 36) + (texture-giftag gs-gif-tag :inline :offset 0) ;; was qword + (consts vector :inline :offset 16) + (fog-clamp vector :inline :offset 32) + (tex-start-ptr int32 :offset 16) + (gifbufsum float :offset 16) + (mtx-buf-ptr int32 :offset 20) + (exp23 float :offset 20) + (fog-0 float :offset 24) + (fog-1 float :offset 28) + (fog-min float :offset 32) + (fog-max float :offset 36) ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype shrubbery (drawable) - ((textures (inline-array adgif-shader) :offset-assert 4) ;; guessed by decompiler - (header qword :offset-assert 8) - (obj-qwc uint8 :offset-assert 12) - (vtx-qwc uint8 :offset-assert 13) - (col-qwc uint8 :offset-assert 14) - (stq-qwc uint8 :offset-assert 15) - (obj uint32 :offset-assert 16) - (vtx uint32 :offset-assert 20) - (col uint32 :offset-assert 24) - (stq uint32 :offset-assert 28) + ((textures (inline-array adgif-shader) :offset 4) + ;; header breakdown: + ;; [0] - number of textures / 2 + ;; [1] - number of vertices + ;; [2] - number of triangle strips + ;; [3] - ?? + ;; + ;; Number of Triangles in the Shrub = header[2] - 2 * header[1] + (header qword :offset 8 :score -1) + (obj-qwc uint8 :offset 12) + (vtx-qwc uint8 :offset 13) + (col-qwc uint8 :offset 14) + (stq-qwc uint8 :offset 15) + ;; start of static dma-chain + (obj uint32 :score 999 :offset 16) + (vtx uint32 :score 999 :offset 20) + (col uint32 :score 999 :offset 24) + (stq uint32 :score 999 :offset 28) ) :method-count-assert 17 :size-assert #x20 @@ -15213,13 +16397,11 @@ (:methods ) ) -|# -#| (deftype instance-shrubbery (instance) ((flat-normal vector :inline :offset-assert 64) - (flat-hwidth float :offset-assert 76) - (color uint32 :offset-assert 8) + (flat-hwidth float :offset 76) + (color uint32 :offset 8) ) :method-count-assert 17 :size-assert #x50 @@ -15227,30 +16409,32 @@ (:methods ) ) -|# -;; (deftype drawable-inline-array-instance-shrub (drawable-inline-array) -;; () -;; :flag-assert #x1100000074 -;; ) +(deftype drawable-inline-array-instance-shrub (drawable-inline-array) + ((data instance-shrubbery 1 :inline :offset-assert 32) + (pad uint32) + ) + :flag-assert #x1100000074 + ) -;; (deftype drawable-tree-instance-shrub (drawable-tree) -;; () -;; :flag-assert #x1100000020 -;; ) +(deftype drawable-tree-instance-shrub (drawable-tree) + ((info prototype-array-shrub-info :offset 8) + (colors-added time-of-day-palette :offset 12) ;; added + ) + :flag-assert #x1100000020 + ) -#| (deftype generic-shrub-fragment (drawable) - ((textures (inline-array adgif-shader) :offset-assert 4) ;; guessed by decompiler - (vtx-cnt uint32 :offset-assert 8) - (cnt-qwc uint8 :offset-assert 12) - (vtx-qwc uint8 :offset-assert 13) - (col-qwc uint8 :offset-assert 14) - (stq-qwc uint8 :offset-assert 15) - (cnt uint32 :offset-assert 16) - (vtx uint32 :offset-assert 20) - (col uint32 :offset-assert 24) - (stq uint32 :offset-assert 28) + ((textures (inline-array adgif-shader) :offset 4) ;; guessed by decompiler + (vtx-cnt uint32 :offset 8) + (cnt-qwc uint8 :offset 12) + (vtx-qwc uint8 :offset 13) + (col-qwc uint8 :offset 14) + (stq-qwc uint8 :offset 15) + (cnt uint32 :offset 16) + (vtx uint32 :offset 20) + (col uint32 :offset 24) + (stq uint32 :offset 28) ) :method-count-assert 17 :size-assert #x20 @@ -15258,11 +16442,12 @@ (:methods ) ) -|# -#| + (deftype prototype-shrubbery (drawable-inline-array) - () + ((data shrubbery 1 :inline :offset-assert 32) + (pad uint32) + ) :method-count-assert 17 :size-assert #x44 :flag-assert #x1100000044 @@ -15270,19 +16455,17 @@ (:methods ) ) -|# -;; (deftype prototype-trans-shrubbery (prototype-shrubbery) -;; () -;; :flag-assert #x1100000044 -;; ) +(deftype prototype-trans-shrubbery (prototype-shrubbery) + () + :flag-assert #x1100000044 + ) -;; (deftype prototype-generic-shrub (drawable-group) -;; () -;; :flag-assert #x1100000020 -;; ) +(deftype prototype-generic-shrub (drawable-group) + () + :flag-assert #x1100000020 + ) -#| (deftype shrubbery-matrix (structure) ((mat matrix :inline :offset-assert 0) (color qword :inline :offset-assert 64) @@ -15291,9 +16474,7 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype shrub-near-packet (structure) ((matrix-tmpl dma-packet :inline :offset-assert 0) (header-tmpl dma-packet :inline :offset-assert 16) @@ -15308,22 +16489,20 @@ :size-assert #x90 :flag-assert #x900000090 ) -|# -#| (deftype instance-shrub-work (structure) - ((dummy qword 3 :offset-assert 0) ;; guessed by decompiler - (chaina qword 8 :offset-assert 48) ;; guessed by decompiler - (chainb qword 8 :offset-assert 176) ;; guessed by decompiler + ((dummy qword 3 :inline :offset-assert 0) ;; guessed by decompiler + (chaina qword 8 :inline :offset-assert 48) ;; guessed by decompiler + (chainb qword 8 :inline :offset-assert 176) ;; guessed by decompiler (colors rgba 1024 :offset-assert 304) ;; guessed by decompiler - (matrix-tmpl qword 20 :offset-assert 4400) ;; guessed by decompiler - (count-tmpl vector4w 20 :offset-assert 4720) ;; guessed by decompiler + (matrix-tmpl qword 20 :inline :offset-assert 4400) ;; guessed by decompiler + (count-tmpl vector4w 20 :inline :offset-assert 4720) ;; guessed by decompiler (mscalf-tmpl dma-packet :inline :offset-assert 5040) (mscalf-ret-tmpl dma-packet :inline :offset-assert 5056) (adgif-tmpl dma-gif-packet :inline :offset-assert 5072) (billboard-tmpl dma-gif-packet :inline :offset-assert 5104) (billboard-const vector :inline :offset-assert 5136) - (shrub-near-packets shrub-near-packet 6 :offset-assert 5152) ;; guessed by decompiler + (shrub-near-packets shrub-near-packet 6 :inline :offset-assert 5152) ;; guessed by decompiler (dma-ref dma-packet :inline :offset-assert 6016) (dma-end dma-packet :inline :offset-assert 6032) (wind-const vector :inline :offset-assert 6048) @@ -15336,8 +16515,8 @@ (bb-color vector :inline :offset-assert 6160) (min-dist vector :inline :offset-assert 6176) (temp-vec vector :inline :offset-assert 6192) - (guard-plane plane 4 :offset-assert 6208) ;; guessed by decompiler - (plane plane 4 :offset-assert 6272) ;; guessed by decompiler + (guard-plane plane 4 :inline :offset-assert 6208) ;; guessed by decompiler + (plane plane 4 :inline :offset-assert 6272) ;; guessed by decompiler (last uint32 4 :offset-assert 6336) ;; guessed by decompiler (next uint32 4 :offset-assert 6352) ;; guessed by decompiler (count uint16 4 :offset-assert 6368) ;; guessed by decompiler @@ -15352,18 +16531,21 @@ (to-spr uint32 :offset-assert 6412) (from-spr uint32 :offset-assert 6416) (shrub-count uint32 :offset-assert 6420) - (stack-ptr uint32 :offset-assert 6400) + ;(stack-ptr uint32 :offset-assert 6400) + (pad uint32) (node uint32 6 :offset-assert 6428) ;; guessed by decompiler (length uint32 6 :offset-assert 6452) ;; guessed by decompiler (prototypes uint32 :offset-assert 6476) - (bucket-ptr uint32 :offset-assert 6404) + ;(bucket-ptr uint32 :offset-assert 6404) + (pad2 uint32) (start-bank uint8 20 :offset-assert 6484) ;; guessed by decompiler (buffer-index uint32 :offset-assert 6504) (current-spr uint32 :offset-assert 6508) (current-mem uint32 :offset-assert 6512) (current-shrub-near-packet uint32 :offset-assert 6516) (current-shrub-near-trans-packet uint32 :offset-assert 6520) - (to-spr uint32 :offset-assert 6412) + ;(to-spr uint32 :offset-assert 6412) + (pad3 uint32) (dma-buffer basic :offset-assert 6528) (near-last uint32 :offset-assert 6532) (near-next uint32 :offset-assert 6536) @@ -15384,9 +16566,7 @@ :size-assert #x19bc :flag-assert #x9000019bc ) -|# -#| (deftype instance-shrub-dma (structure) ((instancea uint128 325 :offset-assert 0) ;; guessed by decompiler (instanceb uint128 325 :offset-assert 5200) ;; guessed by decompiler @@ -15397,44 +16577,40 @@ :size-assert #x38a0 :flag-assert #x9000038a0 ) -|# -;; (define-extern shrubbery-login-post-texture function) ;; (function shrubbery none) -;; (define-extern *shrub-state* object) ;; int +(define-extern shrubbery-login-post-texture (function shrubbery none)) +(define-extern *shrub-state* int) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; tie-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype tie-fragment-debug (structure) ((num-tris uint16 :offset-assert 0) (num-dverts uint16 :offset-assert 2) - (debug-lines basic :offset-assert 4) + (debug-lines (array vector-array) :offset-assert 4) ) :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype tie-fragment (drawable) - ((gif-ref (inline-array adgif-shader) :offset-assert 4) ;; guessed by decompiler - (point-ref uint32 :offset-assert 8) - (color-index uint16 :offset-assert 12) - (base-colors uint8 :offset-assert 14) - (tex-count uint16 :offset-assert 32) - (gif-count uint16 :offset-assert 34) - (vertex-count uint16 :offset-assert 36) - (color-count uint16 :offset-assert 38) - (dp-ref uint32 :offset-assert 40) - (dp-qwc uint32 :offset-assert 44) - (generic-ref uint32 :offset-assert 48) - (generic-count uint16 :offset-assert 52) ;; uint32 - (normal-count uint16 :offset-assert 54) - (normal-ref uint32 :offset-assert 56) - (debug tie-fragment-debug :offset-assert 60) + ((gif-ref (inline-array adgif-shader) :offset 4) ;; guessed by decompiler + (point-ref uint32 :offset 8) + (color-index uint16 :offset 12) + (base-colors uint8 :offset 14) + (tex-count uint16 :offset 32) + (gif-count uint16 :offset 34) + (vertex-count uint16 :offset 36) + (color-count uint16 :offset 38) + (dp-ref uint32 :offset 40) + (dp-qwc uint32 :offset 44) + (generic-ref uint32 :offset 48) + (generic-count uint16 :offset 52) ;; uint32 + (normal-count uint16 :offset 54) + (normal-ref uint32 :offset 56) + (debug tie-fragment-debug :offset 60) ) :method-count-assert 17 :size-assert #x40 @@ -15442,14 +16618,12 @@ (:methods ) ) -|# -#| (deftype instance-tie (instance) - ((color-indices uint32 :offset-assert 8) - (bucket-ptr prototype-bucket-tie :offset-assert 12) ;; guessed by decompiler - (max-scale uint16 :offset-assert 38) - (rmin-scale uint16 :offset-assert 54) + ((color-indices uint32 :offset 8) + (bucket-ptr prototype-bucket-tie :offset 12) ;; guessed by decompiler + (max-scale uint16 :offset 38) + (rmin-scale uint16 :offset 54) ) :method-count-assert 17 :size-assert #x40 @@ -15457,11 +16631,11 @@ (:methods ) ) -|# -#| (deftype drawable-inline-array-instance-tie (drawable-inline-array) - () + ((data instance-tie 1 :inline :offset-assert 32) ;; not sure on type here + (pad uint32) + ) :method-count-assert 17 :size-assert #x64 :flag-assert #x1100000064 @@ -15469,11 +16643,10 @@ (:methods ) ) -|# -#| (deftype drawable-tree-instance-tie (drawable-tree) - () + ((prototypes proxy-prototype-array-tie :offset 8) + ) :method-count-assert 17 :size-assert #x20 :flag-assert #x1100000020 @@ -15481,11 +16654,11 @@ (:methods ) ) -|# -#| (deftype prototype-tie (drawable-inline-array) - () + ((data tie-fragment 1 :inline :offset-assert 32) + (pad uint32) + ) :method-count-assert 17 :size-assert #x64 :flag-assert #x1100000064 @@ -15493,27 +16666,23 @@ (:methods ) ) -|# -#| (deftype tie-matrix (structure) ((mat matrix :inline :offset-assert 0) (morph qword :inline :offset-assert 64) (fog qword :inline :offset-assert 80) - (envmap-flag uint32 :offset-assert 80) - (guard-flag uint32 :offset-assert 84) - (vertex-alpha float :offset-assert 88) - (fog-value float :offset-assert 92) - (fixed-alpha float :offset-assert 68) + (envmap-flag uint32 :offset 80) + (guard-flag uint32 :offset 84) + (vertex-alpha float :offset 88) + (fog-value float :offset 92) + (fixed-alpha float :offset 68) ) :method-count-assert 9 :size-assert #x60 :flag-assert #x900000060 ) -|# -#| (deftype instance-tie-work (structure) ((wind-const vector :inline :offset-assert 0) (hmge-d vector :inline :offset-assert 16) @@ -15523,7 +16692,7 @@ (far-morph vector :inline :offset-assert 80) (dist-test vector :inline :offset-assert 96) (min-dist vector :inline :offset-assert 112) - (guard-plane plane 4 :offset-assert 128) ;; guessed by decompiler + (guard-plane plane 4 :inline :offset-assert 128) ;; guessed by decompiler (upload-color-0 dma-packet :inline :offset-assert 192) (upload-color-1 dma-packet :inline :offset-assert 208) (upload-color-2 dma-packet :inline :offset-assert 224) @@ -15566,23 +16735,20 @@ :size-assert #x22c :flag-assert #x90000022c ) -|# -#| (deftype instance-tie-dma (structure) - ((banka instance-tie 32 :offset-assert 4) ;; guessed by decompiler - (bankb instance-tie 32 :offset-assert 2052) ;; guessed by decompiler - (outa uint128 256 :offset-assert 4096) ;; guessed by decompiler - (outb uint128 256 :offset-assert 8192) ;; guessed by decompiler - (work instance-tie-work :offset-assert 12288) + ((banka instance-tie 32 :inline :offset-assert 0) + (bankb instance-tie 32 :inline :offset-assert 2048) + (outa uint128 256 :offset-assert 4096) + (outb uint128 256 :offset-assert 8192) + ;; this is outside the type???? + (work instance-tie-work :dynamic :offset-assert 12288) ) :method-count-assert 9 :size-assert #x3000 :flag-assert #x900003000 ) -|# -#| (deftype prototype-tie-work (structure) ((upload-flushe dma-packet :inline :offset-assert 0) (upload-palette dma-packet :inline :offset-assert 16) @@ -15613,155 +16779,151 @@ (wait-from-spr uint32 :offset-assert 396) (wait-to-spr uint32 :offset-assert 400) (mood mood-context :offset-assert 404) - (last UNKNOWN 16 :offset-assert 416) - (next UNKNOWN 16 :offset-assert 480) - (count UNKNOWN 16 :offset-assert 544) - (tie-last uint32 :offset-assert 416) - (tie-next uint32 :offset-assert 480) - (tie-count uint16 :offset-assert 544) - (trans-last uint32 :offset-assert 420) - (trans-next uint32 :offset-assert 484) - (trans-count uint16 :offset-assert 546) - (water-last uint32 :offset-assert 424) - (water-next uint32 :offset-assert 488) - (water-count uint16 :offset-assert 548) - (scissor-last uint32 :offset-assert 428) - (scissor-next uint32 :offset-assert 492) - (scissor-count uint16 :offset-assert 550) - (scissor-trans-last uint32 :offset-assert 432) - (scissor-trans-next uint32 :offset-assert 496) - (scissor-trans-count uint16 :offset-assert 552) - (scissor-water-last uint32 :offset-assert 436) - (scissor-water-next uint32 :offset-assert 500) - (scissor-water-count uint16 :offset-assert 554) - (envmap-last uint32 :offset-assert 440) - (envmap-next uint32 :offset-assert 504) - (envmap-count uint16 :offset-assert 556) - (envmap-trans-last uint32 :offset-assert 444) - (envmap-trans-next uint32 :offset-assert 508) - (envmap-trans-count uint16 :offset-assert 558) - (envmap-water-last uint32 :offset-assert 448) - (envmap-water-next uint32 :offset-assert 512) - (envmap-water-count uint16 :offset-assert 560) - (envmap-scissor-last uint32 :offset-assert 452) - (envmap-scissor-next uint32 :offset-assert 516) - (envmap-scissor-count uint16 :offset-assert 562) - (envmap-scissor-trans-last uint32 :offset-assert 456) - (envmap-scissor-trans-next uint32 :offset-assert 520) - (envmap-scissor-trans-count uint16 :offset-assert 564) - (envmap-scissor-water-last uint32 :offset-assert 460) - (envmap-scissor-water-next uint32 :offset-assert 524) - (envmap-scissor-water-count uint16 :offset-assert 566) - (generic-last uint32 :offset-assert 464) - (generic-next uint32 :offset-assert 528) - (generic-count uint16 :offset-assert 568) - (generic-trans-last uint32 :offset-assert 468) - (generic-trans-next uint32 :offset-assert 532) - (generic-trans-count uint16 :offset-assert 570) - (generic-water-last uint32 :offset-assert 472) - (generic-water-next uint32 :offset-assert 536) - (generic-water-count uint16 :offset-assert 572) - (vanish-last uint32 :offset-assert 476) - (vanish-next uint32 :offset-assert 540) - (vanish-count uint16 :offset-assert 574) + (last uint32 16 :offset 416) + (next uint32 16 :offset-assert 480) + (count uint16 16 :offset-assert 544) + (tie-last uint32 :offset 416) + (tie-next uint32 :offset 480) + (tie-count uint16 :offset 544) + (trans-last uint32 :offset 420) + (trans-next uint32 :offset 484) + (trans-count uint16 :offset 546) + (water-last uint32 :offset 424) + (water-next uint32 :offset 488) + (water-count uint16 :offset 548) + (scissor-last uint32 :offset 428) + (scissor-next uint32 :offset 492) + (scissor-count uint16 :offset 550) + (scissor-trans-last uint32 :offset 432) + (scissor-trans-next uint32 :offset 496) + (scissor-trans-count uint16 :offset 552) + (scissor-water-last uint32 :offset 436) + (scissor-water-next uint32 :offset 500) + (scissor-water-count uint16 :offset 554) + (envmap-last uint32 :offset 440) + (envmap-next uint32 :offset 504) + (envmap-count uint16 :offset 556) + (envmap-trans-last uint32 :offset 444) + (envmap-trans-next uint32 :offset 508) + (envmap-trans-count uint16 :offset 558) + (envmap-water-last uint32 :offset 448) + (envmap-water-next uint32 :offset 512) + (envmap-water-count uint16 :offset 560) + (envmap-scissor-last uint32 :offset 452) + (envmap-scissor-next uint32 :offset 516) + (envmap-scissor-count uint16 :offset 562) + (envmap-scissor-trans-last uint32 :offset 456) + (envmap-scissor-trans-next uint32 :offset 520) + (envmap-scissor-trans-count uint16 :offset 564) + (envmap-scissor-water-last uint32 :offset 460) + (envmap-scissor-water-next uint32 :offset 524) + (envmap-scissor-water-count uint16 :offset 566) + (generic-last uint32 :offset 464) + (generic-next uint32 :offset 528) + (generic-count uint16 :offset 568) + (generic-trans-last uint32 :offset 468) + (generic-trans-next uint32 :offset 532) + (generic-trans-count uint16 :offset 570) + (generic-water-last uint32 :offset 472) + (generic-water-next uint32 :offset 536) + (generic-water-count uint16 :offset 572) + (vanish-last uint32 :offset 476) + (vanish-next uint32 :offset 540) + (vanish-count uint16 :offset 574) ) :method-count-assert 9 :size-assert #x240 :flag-assert #x900000240 ) -|# -#| (deftype prototype-tie-dma (structure) ((colora rgba 256 :offset-assert 0) ;; guessed by decompiler (colorb rgba 256 :offset-assert 1024) ;; guessed by decompiler (outa uint128 256 :offset-assert 2048) ;; guessed by decompiler (outb uint128 256 :offset-assert 6144) ;; guessed by decompiler (geometry uint32 4 :offset-assert 10240) ;; guessed by decompiler - (next uint32 12 :offset-assert 10256) ;; guessed by decompiler - (count UNKNOWN 12 :offset-assert 10304) - (counts UNKNOWN 4 :offset-assert 10328) - (palette-ptr uint32 :offset-assert 10336) - (model-ptr uint32 :offset-assert 10340) - (ret-ptr uint32 :offset-assert 10344) - (length uint32 :offset-assert 10348) - (flags uint32 :offset-assert 10352) - (dma-buffer basic :offset-assert 10356) - (this-frag-count uint32 :offset-assert 10360) - (frag-count uint8 4 :offset-assert 10364) ;; guessed by decompiler - (from-spr uint32 :offset-assert 10368) - (to-spr uint32 :offset-assert 10372) - (spr-out uint32 :offset-assert 10376) - (this-count uint32 :offset-assert 10380) - (scissor-geometry uint32 :offset-assert 10240) - (near-geometry uint32 :offset-assert 10244) - (mid-geometry uint32 :offset-assert 10248) - (far-geometry uint32 :offset-assert 10252) - (scissor-frag-count uint8 :offset-assert 10364) - (near-frag-count uint8 :offset-assert 10365) - (mid-frag-count uint8 :offset-assert 10366) - (far-frag-count uint8 :offset-assert 10367) - (tie-scissor-next uint32 :offset-assert 10256) - (tie-near-next uint32 :offset-assert 10260) - (tie-mid-next uint32 :offset-assert 10264) - (tie-far-next uint32 :offset-assert 10268) - (trans-scissor-next UNKNOWN 4 :offset-assert 10256) - (trans-near-next uint32 :offset-assert 10260) - (trans-mid-next uint32 :offset-assert 10264) - (trans-far-next uint32 :offset-assert 10268) - (water-scissor-next UNKNOWN 4 :offset-assert 10256) - (water-near-next uint32 :offset-assert 10260) - (water-mid-next uint32 :offset-assert 10264) - (water-far-next uint32 :offset-assert 10268) - (envmap-scissor-next UNKNOWN 4 :offset-assert 10272) - (envmap-near-next uint32 :offset-assert 10276) - (envmap-mid-next uint32 :offset-assert 10280) - (envmap-far-next uint32 :offset-assert 10284) - (generic-near-next uint32 :offset-assert 10288) - (generic-mid-next uint32 :offset-assert 10292) - (generic-far-next uint32 :offset-assert 10296) - (vanish-next uint32 :offset-assert 10300) - (tie-count uint16 :offset-assert 10304) - (tie-scissor-count uint16 :offset-assert 10304) - (tie-near-count uint16 :offset-assert 10306) - (tie-mid-count uint16 :offset-assert 10308) - (tie-far-count uint16 :offset-assert 10310) - (trans-count uint16 :offset-assert 10304) - (trans-scissor-count uint16 :offset-assert 10304) - (trans-near-count uint16 :offset-assert 10306) - (trans-mid-count uint16 :offset-assert 10308) - (trans-far-count uint16 :offset-assert 10310) - (water-count uint16 :offset-assert 10304) - (water-scissor-count uint16 :offset-assert 10304) - (water-near-count uint16 :offset-assert 10306) - (water-mid-count uint16 :offset-assert 10308) - (water-far-count uint16 :offset-assert 10310) - (envmap-count uint16 :offset-assert 10312) - (envmap-scissor-count uint16 :offset-assert 10312) - (envmap-near-count uint16 :offset-assert 10314) - (envmap-mid-count uint16 :offset-assert 10316) - (envmap-far-count uint16 :offset-assert 10318) - (generic-count uint16 :offset-assert 10320) - (generic-near-count uint16 :offset-assert 10320) - (generic-mid-count uint16 :offset-assert 10322) - (generic-far-count uint16 :offset-assert 10324) - (vanish-count uint16 :offset-assert 10326) - (next-clear UNKNOWN 3 :offset-assert 10256) - (count-clear UNKNOWN 3 :offset-assert 10304) + (next uint32 12 :offset 10256) ;; guessed by decompiler + (count uint16 12 :offset 10304) + (counts uint32 4 :offset 10328) + (palette-ptr uint32 :offset 10336) + (model-ptr uint32 :offset 10340) + (ret-ptr uint32 :offset 10344) + (length uint32 :offset 10348) + (flags uint32 :offset 10352) + (dma-buffer basic :offset 10356) + (this-frag-count uint32 :offset 10360) + (frag-count uint8 4 :offset 10364) ;; guessed by decompiler + (from-spr uint32 :offset 10368) + (to-spr uint32 :offset 10372) + (spr-out uint32 :offset 10376) + (this-count uint32 :offset 10380) + (scissor-geometry uint32 :offset 10240) + (near-geometry uint32 :offset 10244) + (mid-geometry uint32 :offset 10248) + (far-geometry uint32 :offset 10252) + (scissor-frag-count uint8 :offset 10364) + (near-frag-count uint8 :offset 10365) + (mid-frag-count uint8 :offset 10366) + (far-frag-count uint8 :offset 10367) + (tie-scissor-next uint32 :offset 10256) + (tie-near-next uint32 :offset 10260) + (tie-mid-next uint32 :offset 10264) + (tie-far-next uint32 :offset 10268) + (trans-scissor-next uint32 4 :offset 10256) + (trans-near-next uint32 :offset 10260) + (trans-mid-next uint32 :offset 10264) + (trans-far-next uint32 :offset 10268) + (water-scissor-next uint32 4 :offset 10256) + (water-near-next uint32 :offset 10260) + (water-mid-next uint32 :offset 10264) + (water-far-next uint32 :offset 10268) + (envmap-scissor-next uint32 4 :offset 10272) + (envmap-near-next uint32 :offset 10276) + (envmap-mid-next uint32 :offset 10280) + (envmap-far-next uint32 :offset 10284) + (generic-near-next uint32 :offset 10288) + (generic-mid-next uint32 :offset 10292) + (generic-far-next uint32 :offset 10296) + (vanish-next uint32 :offset 10300) + (tie-count uint16 :offset 10304) + (tie-scissor-count uint16 :offset 10304) + (tie-near-count uint16 :offset 10306) + (tie-mid-count uint16 :offset 10308) + (tie-far-count uint16 :offset 10310) + (trans-count uint16 :offset 10304) + (trans-scissor-count uint16 :offset 10304) + (trans-near-count uint16 :offset 10306) + (trans-mid-count uint16 :offset 10308) + (trans-far-count uint16 :offset 10310) + (water-count uint16 :offset 10304) + (water-scissor-count uint16 :offset 10304) + (water-near-count uint16 :offset 10306) + (water-mid-count uint16 :offset 10308) + (water-far-count uint16 :offset 10310) + (envmap-count uint16 :offset 10312) + (envmap-scissor-count uint16 :offset 10312) + (envmap-near-count uint16 :offset 10314) + (envmap-mid-count uint16 :offset 10316) + (envmap-far-count uint16 :offset 10318) + (generic-count uint16 :offset 10320) + (generic-near-count uint16 :offset 10320) + (generic-mid-count uint16 :offset 10322) + (generic-far-count uint16 :offset 10324) + (vanish-count uint16 :offset 10326) + (next-clear uint32 3 :offset 10256) + (count-clear uint16 3 :offset 10304) ) :method-count-assert 9 :size-assert #x2890 :flag-assert #x900002890 ) -|# -;; (define-extern *instance-tie-work-copy* object) ;; instance-tie-work +(define-extern *instance-tie-work-copy* instance-tie-work) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; tfrag-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype tfragment-stats (structure) ((num-tris uint16 4 :offset-assert 0) ;; guessed by decompiler (num-dverts uint16 4 :offset-assert 8) ;; guessed by decompiler @@ -15770,9 +16932,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype tfragment-debug-data (structure) ((stats tfragment-stats :inline :offset-assert 0) (debug-lines (array vector-array) :offset-assert 16) ;; guessed by decompiler @@ -15781,9 +16941,7 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype generic-tfragment (structure) ((dummy int32 :offset-assert 0) ) @@ -15791,29 +16949,27 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype tfragment (drawable) - ((color-index uint16 :offset-assert 6) - (debug-data tfragment-debug-data :offset-assert 8) - (color-indices uint32 :offset-assert 12) - (colors uint32 :offset-assert 12) - (dma-chain uint32 3 :offset-assert 32) ;; guessed by decompiler - (dma-common uint32 :offset-assert 32) - (dma-level-0 uint32 :offset-assert 32) - (dma-base uint32 :offset-assert 36) - (dma-level-1 uint32 :offset-assert 40) - (dma-qwc uint8 4 :offset-assert 44) ;; guessed by decompiler - (shader (inline-array adgif-shader) :offset-assert 48) ;; guessed by decompiler - (num-shaders uint8 :offset-assert 52) - (num-base-colors uint8 :offset-assert 53) - (num-level0-colors uint8 :offset-assert 54) - (num-level1-colors uint8 :offset-assert 55) - (color-offset uint8 :offset-assert 56) - (color-count uint8 :offset-assert 57) - (texture-masks-index uint16 :offset-assert 58) - (generic generic-tfragment :offset-assert 60) + ((color-index uint16 :offset 6) + (debug-data tfragment-debug-data :offset 8) + (color-indices uint32 :offset 12) + (colors uint32 :offset 12) + (dma-chain uint32 3 :offset 32) ;; guessed by decompiler + (dma-common uint32 :offset 32) + (dma-level-0 uint32 :offset 32) + (dma-base uint32 :offset 36) + (dma-level-1 uint32 :offset 40) + (dma-qwc uint8 4 :offset 44) ;; guessed by decompiler + (shader (inline-array adgif-shader) :offset 48) ;; guessed by decompiler + (num-shaders uint8 :offset 52) + (num-base-colors uint8 :offset 53) + (num-level0-colors uint8 :offset 54) + (num-level1-colors uint8 :offset 55) + (color-offset uint8 :offset 56) + (color-count uint8 :offset 57) + (texture-masks-index uint16 :offset 58) + (generic generic-tfragment :offset 60) ) :method-count-assert 17 :size-assert #x40 @@ -15821,11 +16977,10 @@ (:methods ) ) -|# -#| (deftype drawable-inline-array-tfrag (drawable-inline-array) - () + ((data tfragment 1 :inline :offset-assert 32) + (pad uint32)) :method-count-assert 17 :size-assert #x64 :flag-assert #x1100000064 @@ -15833,71 +16988,73 @@ (:methods ) ) -|# -;; (deftype drawable-inline-array-tfrag-trans (drawable-inline-array-tfrag) -;; () -;; :flag-assert #x11000000b4 -;; ) +(deftype drawable-inline-array-tfrag-trans (drawable-inline-array-tfrag) + ;; same bug here as jak 1 + ((data2 tfragment 1 :inline :offset-assert 112) + (pad2 uint32)) + :flag-assert #x11000000b4 + ) -;; (deftype drawable-inline-array-tfrag-water (drawable-inline-array-tfrag) -;; () -;; :flag-assert #x11000000b4 -;; ) +(deftype drawable-inline-array-tfrag-water (drawable-inline-array-tfrag) + ;; same bug here as jak 1 + ((data2 tfragment 1 :inline :offset-assert 112) + (pad2 uint32)) + :flag-assert #x11000000b4 + ) -;; (deftype drawable-tree-tfrag (drawable-tree) -;; () -;; :flag-assert #x1100000020 -;; ) +(deftype drawable-tree-tfrag (drawable-tree) + ((time-of-day-pal time-of-day-palette :offset 12) + (arrays drawable-inline-array :dynamic :offset 32 :score 100) ;; either drawable-inline-array-node or drawable-inline-array-tfrag + ) + :flag-assert #x1100000020 + ) -;; (deftype drawable-tree-tfrag-trans (drawable-tree-tfrag) -;; () -;; :flag-assert #x1100000020 -;; ) +(deftype drawable-tree-tfrag-trans (drawable-tree-tfrag) + () + :flag-assert #x1100000020 + ) + +(deftype drawable-tree-tfrag-water (drawable-tree-tfrag-trans) + () + :flag-assert #x1100000020 + ) -;; (deftype drawable-tree-tfrag-water (drawable-tree-tfrag-trans) -;; () -;; :flag-assert #x1100000020 -;; ) -#| (deftype tfrag-dists (structure) - ((data uint32 16 :offset-assert 0) ;; guessed by decompiler - (vector vector 4 :offset-assert 0) ;; guessed by decompiler - (k0s vector 2 :offset-assert 0) ;; guessed by decompiler - (k1s vector 2 :offset-assert 32) ;; guessed by decompiler + ((data uint32 16 :offset-assert 0 :score -1) + (vector vector 4 :inline :offset 0 :score -1) + (k0s vector 2 :inline :offset 0) + (k1s vector 2 :inline :offset 32) ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -#| + (deftype tfrag-data (structure) - ((data uint32 56 :offset-assert 0) ;; guessed by decompiler - (vector vector 14 :offset-assert 0) ;; guessed by decompiler - (fog vector :inline :offset-assert 0) - (val vector :inline :offset-assert 16) - (strgif qword :inline :offset-assert 32) ;; gs-gif-tag :inline - (fangif qword :inline :offset-assert 48) ;; gs-gif-tag :inline - (adgif qword :inline :offset-assert 64) ;; gs-gif-tag :inline - (hvdf-offset vector :inline :offset-assert 80) - (hmge-scale vector :inline :offset-assert 96) - (invh-scale vector :inline :offset-assert 112) - (ambient vector :inline :offset-assert 128) - (guard vector :inline :offset-assert 144) - (dists tfrag-dists :inline :offset-assert 160) - (k0s uint128 2 :offset-assert 160) ;; guessed by decompiler - (k1s uint128 2 :offset-assert 192) ;; guessed by decompiler + ((data uint32 56 :offset 0 :score -1) + (vector vector 14 :inline :offset 0 :score -1) + (fog vector :inline :offset 0) + (val vector :inline :offset 16) + (strgif gs-gif-tag :inline :offset 32) ;; was qword + (fangif gs-gif-tag :inline :offset 48) ;; was qword + (adgif gs-gif-tag :inline :offset 64) ;; was qword + (hvdf-offset vector :inline :offset 80) + (hmge-scale vector :inline :offset 96) + (invh-scale vector :inline :offset 112) + (ambient vector :inline :offset 128) + (guard vector :inline :offset 144) + (dists tfrag-dists :inline :offset 160) + (k0s uint128 2 :offset 160) ;; guessed by decompiler + (k1s uint128 2 :offset 192) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #xe0 :flag-assert #x9000000e0 ) -|# -#| (deftype tfrag-control (structure) ((num-base-points uint32 :offset-assert 0) (num-shared-base-points uint32 :offset-assert 4) @@ -15924,9 +17081,7 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype tfrag-stats (structure) ((from int32 :offset-assert 0) (to int32 :offset-assert 4) @@ -15949,9 +17104,7 @@ :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype tfrag-packet (structure) ((tag uint128 2 :offset-assert 0) ;; guessed by decompiler ) @@ -15959,9 +17112,7 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype tfrag-work (structure) ((base-tmpl dma-packet :inline :offset-assert 0) (level-0-tmpl dma-packet :inline :offset-assert 16) @@ -15993,38 +17144,34 @@ :size-assert #xc0 :flag-assert #x9000000c0 ) -|# -#| (deftype tfrag-dma (structure) - ((banka tfragment 16 :offset-assert 4) ;; guessed by decompiler - (bankb tfragment 16 :offset-assert 1028) ;; guessed by decompiler - (outa uint128 128 :offset-assert 2048) ;; guessed by decompiler - (outb uint128 128 :offset-assert 4096) ;; guessed by decompiler - (colors rgba 2048 :offset-assert 6144) ;; guessed by decompiler + ((banka tfragment 16 :inline :offset-assert 0) + (bankb tfragment 16 :inline :offset-assert 1024) + (outa uint128 128 :offset-assert 2048) + (outb uint128 128 :offset-assert 4096) + (colors rgba 2047 :offset-assert 6144) ;; why is this one short!!! ) :method-count-assert 9 :size-assert #x37fc :flag-assert #x9000037fc ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; background-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype background-work (basic) ((tfrag-tree-count int32 :offset-assert 4) (tfrag-trees drawable-tree-tfrag 8 :offset-assert 8) ;; guessed by decompiler (tfrag-levels level 8 :offset-assert 40) ;; guessed by decompiler (tfrag-trans-tree-count int32 :offset-assert 72) - (tfrag-trans-trees UNKNOWN 8 :offset-assert 76) - (tfrag-trans-levels UNKNOWN 8 :offset-assert 108) + (tfrag-trans-trees drawable-tree-tfrag-trans 8 :offset-assert 76) + (tfrag-trans-levels level 8 :offset-assert 108) (tfrag-water-tree-count int32 :offset-assert 140) - (tfrag-water-trees UNKNOWN 8 :offset-assert 144) - (tfrag-water-levels UNKNOWN 8 :offset-assert 176) + (tfrag-water-trees drawable-tree-tfrag-water 8 :offset-assert 144) + (tfrag-water-levels level 8 :offset-assert 176) (shrub-tree-count int32 :offset-assert 208) (shrub-trees drawable-tree-instance-shrub 8 :offset-assert 212) ;; guessed by decompiler (shrub-levels level 8 :offset-assert 244) ;; guessed by decompiler @@ -16032,47 +17179,43 @@ (tie-trees drawable-tree-instance-tie 8 :offset-assert 280) ;; guessed by decompiler (tie-levels level 8 :offset-assert 312) ;; guessed by decompiler (tie-generic basic 8 :offset-assert 344) ;; guessed by decompiler - (tie-generic-trans UNKNOWN 8 :offset-assert 376) + (tie-generic-trans basic 8 :offset-assert 376) (wait-to-vu0 uint32 :offset-assert 408) ) :method-count-assert 9 :size-assert #x19c :flag-assert #x90000019c ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; subdivide-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype subdivide-settings (basic) ((dist float 5 :offset-assert 4) ;; guessed by decompiler (meters float 5 :offset-assert 24) ;; guessed by decompiler (close float 8 :offset-assert 44) ;; guessed by decompiler (far float 8 :offset-assert 76) ;; guessed by decompiler ) + (:methods + (new (symbol type meters meters) _type_) + ) :method-count-assert 9 :size-assert #x6c :flag-assert #x90000006c ) -|# -#| (deftype subdivide-dists (structure) ((data uint32 32 :offset-assert 0) ;; guessed by decompiler - (vector vector 8 :offset-assert 0) ;; guessed by decompiler - (k0s uint128 4 :offset-assert 0) ;; guessed by decompiler - (k1s uint128 4 :offset-assert 64) ;; guessed by decompiler + (vector vector 8 :inline :offset 0) ;; guessed by decompiler + (k0s uint128 4 :offset 0) ;; guessed by decompiler + (k1s uint128 4 :offset 64) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype terrain-stats (structure) ((pris tr-stat :inline :offset-assert 0) (tie-generic tr-stat :inline :offset-assert 16) @@ -16109,27 +17252,23 @@ :size-assert #x1e0 :flag-assert #x9000001e0 ) -|# -#| (deftype dma-area (structure) - ((instance-shrub-dma instance-shrub-dma :inline :offset-assert 0) - (draw-node-dma draw-node-dma :inline :offset-assert 0) - (tfrag-dma tfrag-dma :inline :offset-assert 0) - (instance-tie-dma instance-tie-dma :inline :offset-assert 0) - (prototype-tie-dma prototype-tie-dma :inline :offset-assert 0) - (wind-dma wind-dma :inline :offset-assert 0) - (time-of-day-dma time-of-day-dma :inline :offset-assert 0) - (decomp-work decomp-work :inline :offset-assert 0) - (ocean-vertex ocean-vertex 4 :offset-assert 0) ;; guessed by decompiler + ((instance-shrub-dma instance-shrub-dma :inline :offset 0) + (draw-node-dma draw-node-dma :inline :offset 0) + (tfrag-dma tfrag-dma :inline :offset 0) + (instance-tie-dma instance-tie-dma :inline :offset 0) + (prototype-tie-dma prototype-tie-dma :inline :offset 0) + (wind-dma wind-dma :inline :offset 0) + (time-of-day-dma time-of-day-dma :inline :offset 0) + (decomp-work decomp-work :inline :offset 0) + (ocean-vertex ocean-vertex 4 :offset 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x38a0 :flag-assert #x9000038a0 ) -|# -#| (deftype background-area (structure) ((dma-area dma-area :inline :offset-assert 0) (vis-list uint8 2048 :offset-assert 14496) ;; guessed by decompiler @@ -16138,39 +17277,35 @@ :size-assert #x40a0 :flag-assert #x9000040a0 ) -|# -#| (deftype foreground-area (structure) ((generic-work generic-work :inline :offset-assert 0) - (foreground-work foreground-work :inline :offset-assert 0) - (joint-work joint-work :inline :offset-assert 0) - (bone-mem bone-memory :inline :offset-assert 0) - (shadow-work shadow-work :inline :offset-assert 0) + (foreground-work foreground-work :inline :offset 0) + (joint-work joint-work :inline :offset 0) + (bone-mem bone-memory :inline :offset 0) + (shadow-work shadow-work :inline :offset 0) ) :method-count-assert 9 :size-assert #x3fe0 :flag-assert #x900003fe0 ) -|# -#| (deftype region-prim-area (structure) ((region-prim-list region-prim-list :inline :offset-assert 0) (pos vector :inline :offset-assert 1296) - (ray vector :inline :offset-assert 1328) - (region-enter-count int32 :offset-assert 1360) - (region-enter-list UNKNOWN 320 :offset-assert 1364) - (region-enter-prim-list UNKNOWN 320 :offset-assert 2644) + (ray vector :inline :offset 1328) + (region-enter-count int32 :offset 1360) + (region-enter-list uint32 320 :offset-assert 1364) + (region-enter-prim-list uint32 320 :offset-assert 2644) (region-exit-count int32 :offset-assert 3924) - (region-exit-list UNKNOWN 320 :offset-assert 3928) - (region-exit-prim-list UNKNOWN 320 :offset-assert 5208) + (region-exit-list uint32 320 :offset-assert 3928) + (region-exit-prim-list uint32 320 :offset-assert 5208) (region-inside-count int32 :offset-assert 6488) - (region-inside-list UNKNOWN 320 :offset-assert 6492) - (region-inside-prim-list UNKNOWN 320 :offset-assert 7772) + (region-inside-list uint32 320 :offset-assert 6492) + (region-inside-prim-list uint32 320 :offset-assert 7772) (region-start-count int32 :offset-assert 9052) - (region-start-list UNKNOWN 320 :offset-assert 9056) - (region-start-prim-list UNKNOWN 320 :offset-assert 10336) + (region-start-list uint32 320 :offset-assert 9056) + (region-start-prim-list uint32 320 :offset-assert 10336) ) :method-count-assert 13 :size-assert #x2d60 @@ -16182,33 +17317,27 @@ (region-prim-area-method-12 () none 12) ) ) -|# -#| (deftype sprite-area (structure) - ((clock-data UNKNOWN 13 :offset-assert 0) - (buffer UNKNOWN :dynamic :offset-assert 208) + ((clock-data vector 13 :inline :offset-assert 0) + (buffer uint8 :dynamic :offset-assert 208) ) :method-count-assert 9 :size-assert #xd0 :flag-assert #x9000000d0 ) -|# -#| (deftype work-area (structure) ((background background-area :inline :offset-assert 0) - (foreground foreground-area :inline :offset-assert 0) - (region-prim region-prim-area :inline :offset-assert 0) - (sprite sprite-area :inline :offset-assert 0) + (foreground foreground-area :inline :offset 0) + (region-prim region-prim-area :inline :offset 0) + (sprite sprite-area :inline :offset 0) ) :method-count-assert 9 :size-assert #x40a0 :flag-assert #x9000040a0 ) -|# -#| (deftype terrain-context (structure) ((work work-area :inline :offset-assert 0) ) @@ -16216,15 +17345,30 @@ :size-assert #x40a0 :flag-assert #x9000040a0 ) -|# -;; (define-extern *terrain-stats* object) ;; terrain-stats -;; (define-extern *collide-stats* object) ;; collide-stats +(define-extern *terrain-stats* terrain-stats) +(define-extern *collide-stats* collide-stats) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; entity-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defenum entity-perm-status + :bitfield #t + :type uint16 + (bit-0 0) + (bit-1 1) + (dead 2) + (bit-3 3) + (bit-4 4) + (bit-5 5) + (subtask-complete 6) + (bit-7 7) + (bit-8 8) + (bit-9 9) + (bit-10 10) + ) + (deftype entity-perm (structure) ((user-object object 2 :offset-assert 0) ;; guessed by decompiler (user-uint64 uint64 :offset 0) @@ -16235,7 +17379,7 @@ (user-uint16 uint16 4 :offset 0) ;; guessed by decompiler (user-int8 int8 8 :offset 0) ;; guessed by decompiler (user-uint8 uint8 8 :offset 0) ;; guessed by decompiler - (status uint16 :offset 8) ;; entity-perm-status + (status entity-perm-status :offset 8) ;; entity-perm-status (dummy uint8 1 :offset 10) ;; guessed by decompiler (task uint8 :offset 11) ;; game-task (aid actor-id :offset 12) ;; guessed by decompiler @@ -16274,33 +17418,27 @@ ) ) - -#| (deftype entity-perm-array (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data entity-perm :dynamic :offset-assert 16) ;; guessed by decompiler + ((data entity-perm :dynamic :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| + (deftype entity-links-array (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data entity-links :dynamic :offset-assert 16) ;; guessed by decompiler + ((data entity-links :dynamic :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# (deftype entity (res-lump) - ((pad uint32 5)) + ((trans vector :inline :offset-assert 32) + (aid uint32 :offset-assert 48) + ) :method-count-assert 27 :size-assert #x34 :flag-assert #x1b00000034 @@ -16314,14 +17452,14 @@ ) ) -;; (deftype entity-camera (entity) -;; () -;; :flag-assert #x1b00000050 -;; ) +(deftype entity-camera (entity) + ((connect connectable :inline :offset-assert 64)) ;; guess from jak 1 + :flag-assert #x1b00000050 + ) -#| +(declare-type nav-mesh basic) (deftype entity-nav-mesh (entity) - () + ((nav-mesh nav-mesh)) :method-count-assert 29 :size-assert #x38 :flag-assert #x1d00000038 @@ -16331,33 +17469,40 @@ (entity-nav-mesh-method-28 () none 28) ) ) -|# -;; (deftype entity-race-mesh (entity) -;; () -;; :flag-assert #x1d00000038 -;; ) +(declare-type race-mesh basic) +(deftype entity-race-mesh (entity) + ((race-mesh race-mesh) + ) + :flag-assert #x1d00000038 + (:methods + (entity-race-mesh-method-27 () none 27) + (entity-race-mesh-method-28 () none 28) + ) + ) -(declare-type entity-actor entity) -#| +(define-extern entity-actor type) (deftype entity-actor (entity) - () + ((etype type :offset 56) + (task game-task :offset-assert 60) + (kill-mask task-mask :offset 52) + (vis-id int16 :offset-assert 62) + (quat quaternion :inline :offset-assert 64) + ) :method-count-assert 33 :size-assert #x50 :flag-assert #x2100000050 ;; Failed to read fields. (:methods - (entity-actor-method-27 () none 27) ;; (next-actor (_type_) entity-actor 27) - (entity-actor-method-28 () none 28) ;; (prev-actor (_type_) entity-actor 28) + (next-actor (_type_) entity-actor 27) + (prev-actor (_type_) entity-actor 28) (entity-actor-method-29 () none 29) ;; (debug-print (_type_ symbol type) none 29) (entity-actor-method-30 () none 30) ;; (dummy-30 (_type_ entity-perm-status symbol) none 30) (entity-actor-method-31 () none 31) (entity-actor-method-32 () none 32) ) ) -|# -#| (deftype actor-reference (structure) ((actor basic :offset-assert 0) (id uint32 :offset-assert 4) @@ -16366,21 +17511,15 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype actor-group (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (data UNKNOWN :dynamic :offset-assert 16) + ((data actor-reference :dynamic :inline :offset-assert 16) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype entity-info (basic) ((ptype type :offset-assert 4) ;; guessed by decompiler (package basic :offset-assert 8) @@ -16392,59 +17531,53 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype actor-bank (basic) - ((pause-dist float :offset-assert 4) - (birth-dist float :offset-assert 8) + ((pause-dist meters :offset-assert 4) + (birth-dist meters :offset-assert 8) (birth-max int32 :offset-assert 12) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -;; (define-extern *generate-actor-vis* object) ;; symbol -;; (define-extern *generate-actor-vis-start* object) ;; symbol -;; (define-extern *generate-actor-vis-output* object) ;; symbol -;; (define-extern *ACTOR-bank* actor-bank) ;; actor-bank +(define-extern *generate-actor-vis* symbol) +(define-extern *generate-actor-vis-start* symbol) +(define-extern *generate-actor-vis-output* symbol) +(define-extern *ACTOR-bank* actor-bank) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sprite-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype sprite-vec-data-2d (structure) ((x-y-z-sx vector :inline :offset-assert 0) (flag-rot-sy vector :inline :offset-assert 16) (r-g-b-a vector :inline :offset-assert 32) - (x float :offset-assert 0) - (y float :offset-assert 4) - (z float :offset-assert 8) - (sx float :offset-assert 12) - (sy float :offset-assert 28) - (rot float :offset-assert 24) - (flag int32 :offset-assert 16) - (matrix int32 :offset-assert 20) - (warp-turns int32 :offset-assert 16) - (r float :offset-assert 32) - (g float :offset-assert 36) - (b float :offset-assert 40) - (a float :offset-assert 44) - (trans vector3s :inline :offset-assert 0) - (color rgbaf :inline :offset-assert 32) - (data uint128 1 :offset-assert 0) ;; guessed by decompiler - (data64 uint64 6 :offset-assert 0) ;; guessed by decompiler + (x float :offset 0) + (y float :offset 4) + (z float :offset 8) + (sx float :offset 12) + (sy float :offset 28) + (rot float :offset 24) + (flag int32 :offset 16) + (matrix int32 :offset 20) + (warp-turns int32 :offset 16) + (r float :offset 32) + (g float :offset 36) + (b float :offset 40) + (a float :offset 44) + (trans vector3s :inline :offset 0) + (color rgbaf :inline :offset 32) + (data uint128 1 :offset 0) ;; guessed by decompiler + (data64 uint64 6 :offset 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype sprite-array-2d (basic) ((num-sprites int32 2 :offset-assert 4) ;; guessed by decompiler (num-valid int32 2 :offset-assert 12) ;; guessed by decompiler @@ -16457,37 +17590,33 @@ :size-assert #x70 :flag-assert #x900000070 ) -|# -#| (deftype sprite-vec-data-3d (structure) ((x-y-z-sx vector :inline :offset-assert 0) (qx-qy-qz-sy vector :inline :offset-assert 16) (r-g-b-a vector :inline :offset-assert 32) - (x float :offset-assert 0) - (y float :offset-assert 4) - (z float :offset-assert 8) - (sx float :offset-assert 12) - (sy float :offset-assert 28) - (qx float :offset-assert 16) - (qy float :offset-assert 20) - (qz float :offset-assert 24) - (r float :offset-assert 32) - (g float :offset-assert 36) - (b float :offset-assert 40) - (a float :offset-assert 44) - (trans vector3s :inline :offset-assert 0) - (rot vector3s :inline :offset-assert 16) - (color rgbaf :inline :offset-assert 32) - (data uint128 1 :offset-assert 0) ;; guessed by decompiler + (x float :offset 0) + (y float :offset 4) + (z float :offset 8) + (sx float :offset 12) + (sy float :offset 28) + (qx float :offset 16) + (qy float :offset 20) + (qz float :offset 24) + (r float :offset 32) + (g float :offset 36) + (b float :offset 40) + (a float :offset 44) + (trans vector3s :inline :offset 0) + (rot vector3s :inline :offset 16) + (color rgbaf :inline :offset 32) + (data uint128 1 :offset 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype sprite-array-3d (basic) ((num-sprites int32 2 :offset-assert 4) ;; guessed by decompiler (num-valid int32 2 :offset-assert 12) ;; guessed by decompiler @@ -16499,17 +17628,15 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; simple-sprite-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype sprite-glow-data (structure) ((position vector :inline :offset-assert 0) - (size-x float :offset-assert 12) + (size-x float :offset 12) (size-probe float :offset-assert 16) (z-offset float :offset-assert 20) (rot-angle float :offset-assert 24) @@ -16524,12 +17651,10 @@ :size-assert #x40 :flag-assert #xa00000040 (:methods - (sprite-glow-data-method-9 () none 9) + (set-trans (_type_ vector) none 9) ) ) -|# -#| (deftype simple-sprite-system (structure) ((count int16 :offset-assert 0) (max-count int16 :offset-assert 2) @@ -16544,33 +17669,29 @@ (simple-sprite-system-method-11 () none 11) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; eye-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype eye (structure) - ((data vector 2 :offset-assert 0) ;; guessed by decompiler - (x float :offset-assert 0) - (y float :offset-assert 4) - (lid float :offset-assert 8) - (iris-scale float :offset-assert 16) - (pupil-scale float :offset-assert 20) - (lid-scale float :offset-assert 24) + ((data vector 2 :inline :offset-assert 0) ;; guessed by decompiler + (x float :offset 0) + (y float :offset 4) + (lid float :offset 8) + (iris-scale float :offset 16) + (pupil-scale float :offset 20) + (lid-scale float :offset 24) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype eye-control (structure) - ((process uint64 :offset-assert 0) ;; handle - (draw-flag basic :offset-assert 8) + ((process handle :offset-assert 0) + (draw-flag symbol :offset-assert 8) (different-eyes basic :offset-assert 12) (random-time uint16 :offset-assert 16) (bucket uint16 :offset-assert 18) @@ -16583,29 +17704,24 @@ :size-assert #x60 :flag-assert #x900000060 ) -|# -#| (deftype eye-control-array (basic) - ((data eye-control 16 :offset-assert 16) ;; guessed by decompiler + ((data eye-control 16 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x610 :flag-assert #x900000610 ) -|# -#| (deftype eye-control-arrays (basic) - ((data UNKNOWN 6 :offset-assert 20) + ((data eye-control-array 6 :inline :offset-assert 16) + (pad uint32) ) :method-count-assert 9 :size-assert #x2474 :flag-assert #x900002474 ) -|# -#| (deftype eye-work (structure) ((sprite-tmpl dma-gif-packet :inline :offset-assert 0) (sprite-tmpl2 dma-gif-packet :inline :offset-assert 32) @@ -16616,15 +17732,137 @@ :size-assert #x88 :flag-assert #x900000088 ) -|# -;; (define-extern *eye-control-arrays* eye-control-arrays) +(define-extern *eye-control-arrays* eye-control-arrays) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sparticle-launcher-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; note: changed from jak 1, slightly. +(defenum sp-field-id + :type uint16 + + (misc-fields-start 0) + (spt-texture 1) + (spt-anim 2) + (spt-anim-speed 3) + (spt-birth-func 4) + (spt-joint/refpoint 5) + (spt-num 6) + (spt-sound 7) + (misc-fields-end 8) + + (sprite-fields-start 9) + (spt-x 10) + (spt-y 11) + (spt-z 12) + (spt-scale-x 13) + (spt-rot-x 14) + (spt-rot-y 15) + (spt-rot-z 16) + (spt-scale-y 17) + (spt-r 18) + (spt-g 19) + (spt-b 20) + (spt-a 21) + (sprite-fields-end 22) + + (cpu-fields-start 23) + (spt-omega 24) + (spt-vel-x 25) + (spt-vel-y 26) + (spt-vel-z 27) + (spt-scalevel-x 28) + (spt-rotvel-x 29) + (spt-rotvel-y 30) + (spt-rotvel-z 31) + (spt-scalevel-y 32) + (spt-fade-r 33) + (spt-fade-g 34) + (spt-fade-b 35) + (spt-fade-a 36) + (spt-accel-x 37) + (spt-accel-y 38) + (spt-accel-z 39) + (spt-dummy 40) + (spt-quat-x 41) + (spt-quat-y 42) + (spt-quat-z 43) + (spt-quad-w 44) + (spt-friction 45) + (spt-timer 46) + (spt-flags 47) + (spt-userdata 48) + (spt-func 49) + (spt-next-time 50) + (spt-next-launcher 51) + (cpu-fields-end 52) + + (launch-fields-start 53) + (spt-launchrot-x 54) + (spt-launchrot-y 55) + (spt-launchrot-z 56) + (spt-launchrot-w 57) + (spt-conerot-x 58) + (spt-conerot-y 59) + (spt-conerot-z 60) + (spt-conerot-w 61) + (spt-rotate-x 62) + (spt-rotate-y 63) + (spt-rotate-z 64) + + (spt-conerot-radius 65) + (spt-mat-scale-x 66) + (spt-mat-scale-y 67) + (spt-mat-scale-z 68) + (launch-fields-end 69) + + (spt-scale 70) + (spt-scalevel 71) + (spt-end 72) + ) + +;; appears the same as jak 1 +(defenum sp-flag + :type uint16 + (plain-v1 0) ;; just a plain signed integer. No random crap. + (float-with-rand 1) + (int-with-rand 2) + (copy-from-other-field 3) + (plain-v2 4) + (from-pointer 5) + (part-by-id 6) + ) + +(defenum sp-group-item-flag + :bitfield #t + :type uint16 + (is-3d 0) + (bit1 1) + (start-dead 2) + (launch-asap 3) + (bit6 6) + ) + +(defenum sp-launch-state-flags + :bitfield #t + :type uint16 + (launcher-active 0) ;; active + (particles-active 1) ;; wants to launch + (bit2 2) + ) + +(defenum sp-group-flag + :bitfield #t + :type uint16 + (use-local-clock 0) + (always-draw 1) + (screen-space 2) + (unknown-bit-01 3) ;; beach-part + ) + + (deftype sparticle-birthinfo (structure) ((sprite uint32 :offset-assert 0) (anim int32 :offset-assert 4) @@ -16633,40 +17871,36 @@ (joint-ppoint int32 :offset-assert 16) (num-to-birth float :offset-assert 20) (sound basic :offset-assert 24) - (dataf float 1 :offset-assert 0) ;; guessed by decompiler - (data uint32 1 :offset-assert 0) ;; guessed by decompiler + (dataf float 1 :offset 0) ;; guessed by decompiler + (data uint32 1 :offset 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x1c :flag-assert #x90000001c ) -|# -#| (deftype sp-field-init-spec (structure) - ((field uint16 :offset-assert 0) ;; sp-field-id - (flags uint16 :offset-assert 2) ;; sp-flag + ((field sp-field-id :offset-assert 0) + (flags sp-flag :offset-assert 2) (initial-valuef float :offset-assert 4) (random-rangef float :offset-assert 8) (random-multf float :offset-assert 12) - (initial-value int32 :offset-assert 4) - (random-range int32 :offset-assert 8) - (random-mult int32 :offset-assert 12) - (func symbol :offset-assert 4) ;; guessed by decompiler - (tex texture-id :offset-assert 4) ;; guessed by decompiler - (pntr pointer :offset-assert 4) ;; guessed by decompiler - (object basic :offset-assert 4) - (sym symbol :offset-assert 4) ;; guessed by decompiler - (sound sound-spec :offset-assert 4) ;; guessed by decompiler + (initial-value int32 :offset 4) + (random-range int32 :offset 8) + (random-mult int32 :offset 12) + (func symbol :offset 4) ;; guessed by decompiler + (tex texture-id :offset 4) ;; guessed by decompiler + (pntr pointer :offset 4) ;; guessed by decompiler + (object basic :offset 4) + (sym symbol :offset 4) ;; guessed by decompiler + (sound sound-spec :offset 4) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ;; field object uses ~A with a signed load ) -|# -#| (deftype sparticle-launcher (basic) ((birthaccum float :offset-assert 4) (soundaccum float :offset-assert 8) @@ -16680,14 +17914,12 @@ (sparticle-launcher-method-10 () none 10) ) ) -|# -#| (deftype sparticle-group-item (structure) ((launcher uint32 :offset-assert 0) (fade-after meters :offset-assert 4) (falloff-to meters :offset-assert 8) - (flags uint16 :offset-assert 12) ;; sp-group-item-flag + (flags sp-group-item-flag :offset-assert 12) (period uint16 :offset-assert 14) (length uint16 :offset-assert 16) (offset int16 :offset-assert 18) ;; uint16 @@ -16698,12 +17930,12 @@ :size-assert #x1c :flag-assert #x90000001c ) -|# -#| +(declare-type sparticle-cpuinfo structure) + (deftype sparticle-launch-state (structure) ((group-item sparticle-group-item :offset-assert 0) - (flags uint16 :offset-assert 4) ;; sp-launch-state-flags + (flags sp-launch-state-flags :offset-assert 4) (randomize uint16 :offset-assert 6) (center vector :offset-assert 8) (sprite3d sprite-vec-data-3d :offset-assert 12) @@ -16712,29 +17944,27 @@ (accum float :offset-assert 24) (spawn-time uint32 :offset-assert 28) (control basic :offset-assert 32) - (swarm basic :offset-assert 20) - (seed uint32 :offset-assert 24) - (time uint32 :offset-assert 28) - (spec basic :offset-assert 16) - (id uint32 :offset-assert 12) + (swarm basic :offset 20) + (seed uint32 :offset 24) + (time uint32 :offset 28) + (spec basic :offset 16) + (id uint32 :offset 12) ) :method-count-assert 9 :size-assert #x24 :flag-assert #x900000024 ) -|# -#| (deftype sparticle-launch-group (basic) ((length int16 :offset-assert 4) (duration uint16 :offset-assert 6) (linger-duration uint16 :offset-assert 8) - (flags uint16 :offset-assert 10) ;; sp-group-flag + (flags sp-group-flag :offset-assert 10) (name string :offset-assert 12) ;; guessed by decompiler (launcher (inline-array sparticle-group-item) :offset-assert 16) ;; guessed by decompiler - (rotate-x deg :offset-assert 20) - (rotate-y deg :offset-assert 24) - (rotate-z deg :offset-assert 28) + (rotate-x degrees :offset-assert 20) + (rotate-y degrees :offset-assert 24) + (rotate-z degrees :offset-assert 28) (scale-x float :offset-assert 32) (scale-y float :offset-assert 36) (scale-z float :offset-assert 40) @@ -16747,24 +17977,20 @@ (sparticle-launch-group-method-9 () none 9) ;; (create-launch-control (_type_ process) sparticle-launch-control 9) ) ) -|# -#| (deftype sparticle-launch-control (inline-array-class) - ((length int32 :offset-assert 4) - (allocated-length int32 :offset-assert 8) - (group sparticle-launch-group :offset-assert 16) ;; guessed by decompiler + ((group sparticle-launch-group :offset-assert 16) ;; guessed by decompiler (proc process :offset-assert 20) ;; guessed by decompiler (local-clock int32 :offset-assert 24) (fade float :offset-assert 28) (matrix int8 :offset-assert 32) ;; int32 - (state-mode UNKNOWN 3 :offset-assert 33) + (state-mode uint8 3 :offset-assert 33) (state-counter uint32 :offset-assert 36) (last-spawn-frame int32 :offset-assert 40) (last-spawn-time int32 :offset-assert 44) (origin matrix :inline :offset-assert 48) - (center vector :inline :offset-assert 96) - (data sparticle-launch-state :dynamic :offset-assert 112) ;; guessed by decompiler + (center vector :inline :offset 96) + (data sparticle-launch-state :dynamic :inline :offset-assert 112) ;; guessed by decompiler ) :method-count-assert 16 :size-assert #x70 @@ -16779,15 +18005,37 @@ (sparticle-launch-control-method-15 () none 15) ) ) -|# -;; (define-extern *launch-matrix* object) +(define-extern *launch-matrix* matrix) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sparticle-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum sp-cpuinfo-flag + :bitfield #t + :type uint32 + (bit0 0) + (bit1 1) + (bit2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst + (bit3 3) + (bit4 4) + (ready-to-launch 6) ;; maybe just just death? + (bit7 7) + (aux-list 8) ;; prevents relaunch, adds to aux + (bit9 9) + (level0 10) + (level1 11) + (bit12 12) ;; required to relaunch + (bit13 13) + (bit14 14) + (use-global-acc 16) + (launch-along-z 17) + (left-multiply-quat 18) + (right-multiply-quat 19) + (set-conerot 20) + ) + (deftype sparticle-cpuinfo (structure) ((sprite sprite-vec-data-2d :offset-assert 0) (adgif adgif-shader :offset-assert 4) @@ -16798,19 +18046,19 @@ (fade rgbaf :inline :offset-assert 48) (acc vector :inline :offset-assert 64) (rotvel3d quaternion :inline :offset-assert 80) - (vel vector3s :inline :offset-assert 16) - (accel vector3s :inline :offset-assert 64) - (scalevelx float :offset-assert 28) - (scalevely float :offset-assert 44) + (vel vector3s :inline :offset 16) + (accel vector3s :inline :offset 64) + (scalevelx float :offset 28) + (scalevely float :offset 44) (friction float :offset-assert 96) (timer int32 :offset-assert 100) (flags sp-cpuinfo-flag :offset-assert 104) ;; guessed by decompiler (user-int32 int32 :offset-assert 108) - (user-uint32 uint32 :offset-assert 108) - (user-float float :offset-assert 108) - (user-pntr uint32 :offset-assert 108) - (user-object basic :offset-assert 108) - (user-sprite sprite-vec-data-2d :offset-assert 108) + (user-uint32 uint32 :offset 108) + (user-float float :offset 108 :score 1) + (user-pntr uint32 :offset 108) + (user-object basic :offset 108) + (user-sprite sprite-vec-data-2d :offset 108) (sp-func basic :offset-assert 112) (next-time uint32 :offset-assert 116) (next-launcher basic :offset-assert 120) @@ -16820,19 +18068,17 @@ (user1-int16 uint16 :offset-assert 130) (key sparticle-launch-control :offset-assert 132) ;; guessed by decompiler (binding sparticle-launch-state :offset-assert 136) - (data uint32 1 :offset-assert 12) ;; guessed by decompiler - (datab UNKNOWN 4 :offset-assert 12) - (dataf float 1 :offset-assert 12) ;; guessed by decompiler - (datac uint8 1 :offset-assert 12) ;; guessed by decompiler + (data uint32 1 :offset 12) ;; guessed by decompiler + (datab uint8 4 :offset 12) + (dataf float 1 :offset 12) ;; guessed by decompiler + (datac uint8 1 :offset 12) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x8c :flag-assert #x90000008c ;; field user-object uses ~A with a signed load field key uses ~A with a signed load ) -|# -#| (deftype sparticle-launchinfo (structure) ((launchrot vector :inline :offset-assert 0) (conerot vector :inline :offset-assert 16) @@ -16840,21 +18086,19 @@ (rotate-y float :offset-assert 36) (rotate-z float :offset-assert 40) (coneradius float :offset-assert 44) - (rotate vector :inline :offset-assert 32) - (scale-x float :offset-assert 48) - (scale-y float :offset-assert 52) - (scale-z float :offset-assert 56) - (dummy float :offset-assert 60) - (scale vector :inline :offset-assert 48) - (data uint8 1 :offset-assert 0) ;; guessed by decompiler + (rotate vector :inline :offset 32) + (scale-x float :offset 48) + (scale-y float :offset 52) + (scale-z float :offset 56) + (dummy float :offset 60) + (scale vector :inline :offset 48) + (data uint8 1 :offset 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype sparticle-system (basic) ((blocks int32 2 :offset-assert 4) ;; guessed by decompiler (length int32 2 :offset-assert 12) ;; guessed by decompiler @@ -16870,15 +18114,13 @@ :size-assert #x34 :flag-assert #x900000034 ) -|# -;; (define-extern *sp-60-hz* object) ;; symbol +(define-extern *sp-60-hz* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; actor-link-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype actor-link-info (basic) ((process process :offset-assert 4) ;; guessed by decompiler (next entity-actor :offset-assert 8) ;; guessed by decompiler @@ -16888,43 +18130,57 @@ :size-assert #x10 :flag-assert #x1a00000010 (:methods - ;; (new (symbol type process) _type_ 0) - (actor-link-info-method-9 () none 9) ;; (get-matching-actor-type-mask (_type_ type) int 9) - (actor-link-info-method-10 () none 10) ;; (actor-count-before (_type_) int 10) - (actor-link-info-method-11 () none 11) ;; (link-to-next-and-prev-actor (_type_) entity-actor 11) - (actor-link-info-method-12 () none 12) ;; (get-next (_type_) entity-actor 12) - (actor-link-info-method-13 () none 13) ;; (get-prev (_type_) entity-actor 13) - (actor-link-info-method-14 () none 14) ;; (get-next-process (_type_) process 14) - (actor-link-info-method-15 () none 15) ;; (get-prev-process (_type_) process 15) - (actor-link-info-method-16 () none 16) ;; (apply-function-forward (_type_ (function entity-actor object object) object) int 16) - (actor-link-info-method-17 () none 17) ;; (apply-function-reverse (_type_ (function entity-actor object object) object) int 17) - (actor-link-info-method-18 () none 18) ;; (apply-all (_type_ (function entity-actor object object) object) int 18) - (actor-link-info-method-19 () none 19) ;; (send-to-all (_type_ symbol) none 19) - (actor-link-info-method-20 () none 20) ;; (send-to-all-after (_type_ symbol) object 20) - (actor-link-info-method-21 () none 21) ;; (send-to-all-before (_type_ symbol) object 21) - (actor-link-info-method-22 () none 22) ;; (send-to-next-and-prev (_type_ symbol) none 22) - (actor-link-info-method-23 () none 23) ;; (send-to-next (_type_ symbol) none 23) - (actor-link-info-method-24 () none 24) ;; (send-to-prev (_type_ symbol) none 24) - (actor-link-info-method-25 () none 25) ;; (actor-count (_type_) int 25) + (new (symbol type process symbol) _type_ 0) + (get-matching-actor-type-mask (_type_ type) int 9) + (actor-count-before (_type_) int 10) + (link-to-next-and-prev-actor (_type_) actor-link-info 11) + (get-next (_type_) entity-actor 12) + (get-prev (_type_) entity-actor 13) + (get-next-process (_type_) process 14) + (get-prev-process (_type_) process 15) + (apply-function-forward (_type_ (function entity-actor object object) object) int 16) + (apply-function-reverse (_type_ (function entity-actor object object) object) int 17) + (apply-all (_type_ (function entity-actor object object) object) int 18) + (send-to-all (_type_ symbol) none 19) + (send-to-all-after (_type_ symbol) object 20) + (send-to-all-before (_type_ symbol) object 21) + (send-to-next-and-prev (_type_ symbol) none 22) + (send-to-next (_type_ symbol) none 23) + (send-to-prev (_type_ symbol) none 24) + (actor-count (_type_) int 25) ) ) -|# -;; (define-extern entity-actor-lookup function) ;; (function res-lump symbol int entity-actor) -;; (define-extern entity-actor-count function) ;; (function res-lump symbol int) -;; (define-extern actor-link-subtask-complete-hook function) ;; (function entity-actor (pointer symbol) symbol) -;; (define-extern actor-link-subtask-incomplete-count-hook function) -;; (define-extern actor-link-dead-hook function) ;; (function entity-actor (pointer symbol) symbol) -;; (define-extern alt-actor-list-subtask-incomplete-count function) ;; (function process-drawable int) +(define-extern entity-actor-lookup (function res-lump symbol int entity-actor)) +(define-extern entity-actor-count (function res-lump symbol int)) +(define-extern actor-link-subtask-complete-hook (function entity-actor (pointer symbol) symbol)) +(define-extern actor-link-subtask-incomplete-count-hook (function entity-actor (pointer uint64) symbol)) +(define-extern actor-link-dead-hook (function entity-actor (pointer symbol) symbol)) +(define-extern alt-actor-list-subtask-incomplete-count (function process-drawable int)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; camera-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| + +(defenum cam-index-options + :type uint32 + :bitfield #t + (RADIAL) + (SPHERICAL) + ) + +(defenum slave-los-state + :type uint32 + (none 0) + (cw 1) + (ccw 2) + (between 3) + ) + (deftype cam-index (structure) ((flags cam-index-options :offset-assert 0) ;; guessed by decompiler - (vec vector 2 :offset-assert 16) ;; guessed by decompiler + (vec vector 2 :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 11 :size-assert #x30 @@ -16934,9 +18190,7 @@ (cam-index-method-10 () none 10) ;; (dummy-10 (_type_ vector) float 10) ) ) -|# -#| (deftype tracking-point (structure) ((position vector :inline :offset-assert 0) (direction vector :inline :offset-assert 16) @@ -16948,9 +18202,7 @@ :size-assert #x2c :flag-assert #x90000002c ) -|# -#| (deftype tracking-spline-sampler (structure) ((cur-pt int32 :offset-assert 0) (partial-pt float :offset-assert 4) @@ -16959,11 +18211,9 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype tracking-spline (structure) - ((point tracking-point 32 :offset-assert 0) ;; guessed by decompiler + ((point tracking-point 32 :inline :offset-assert 0) ;; guessed by decompiler (summed-len float :offset-assert 1536) (free-point int32 :offset-assert 1540) (used-point int32 :offset-assert 1544) @@ -16999,9 +18249,7 @@ (tracking-spline-method-23 () none 23) ;; (TODO-RENAME-23 (_type_) none 23) ) ) -|# -#| (deftype cam-float-seeker (structure) ((target float :offset-assert 0) (value float :offset-assert 4) @@ -17010,19 +18258,18 @@ (max-vel float :offset-assert 16) (max-partial float :offset-assert 20) ) + :pack-me :method-count-assert 13 :size-assert #x18 :flag-assert #xd00000018 (:methods - (cam-float-seeker-method-9 () none 9) ;; (init-cam-float-seeker (_type_ float float float float) none 9) - (cam-float-seeker-method-10 () none 10) ;; (copy-cam-float-seeker (_type_ _type_) none 10) - (cam-float-seeker-method-11 () none 11) ;; (update! (_type_ float) none 11) - (cam-float-seeker-method-12 () none 12) ;; (jump-to-target! (_type_ float) float 12) + (init (_type_ float float float float) none 9) + (copy-to (_type_ _type_) none 10) + (update! (_type_ float) none 11) + (jump-to-target! (_type_ float) float 12) ) ) -|# -#| (deftype cam-vector-seeker (structure) ((target vector :inline :offset-assert 0) (value vector :inline :offset-assert 16) @@ -17035,13 +18282,11 @@ :size-assert #x3c :flag-assert #xb0000003c (:methods - (cam-vector-seeker-method-9 () none 9) ;; (init! (_type_ vector float float float) none 9) - (cam-vector-seeker-method-10 () none 10) ;; (update! (_type_ vector) none 10) + (init (_type_ vector float float float) none 9) + (update! (_type_ vector) none 10) ) ) -|# -#| (deftype cam-rotation-tracker (structure) ((inv-mat matrix :inline :offset-assert 0) (no-follow basic :offset-assert 64) @@ -17060,223 +18305,200 @@ :size-assert #x108 :flag-assert #x900000108 ) -|# -#| (deftype camera-combiner (process) - ((trans vector :inline :offset-assert 124) - (inv-camera-rot matrix :inline :offset-assert 140) - (fov float :offset-assert 204) - (interp-val float :offset-assert 208) - (interp-step float :offset-assert 212) - (dist-from-src float :offset-assert 216) - (dist-from-dest float :offset-assert 220) - (flip-control-axis vector :inline :offset-assert 236) - (velocity vector :inline :offset-assert 252) - (tracking-status uint64 :offset-assert 268) - (tracking-options int32 :offset-assert 276) - (tracking cam-rotation-tracker :inline :offset-assert 284) - (fast-rot basic :offset-assert 548) + ((trans vector :inline :offset-assert 128) + (inv-camera-rot matrix :inline :offset-assert 144) + (fov float :offset-assert 208) + (interp-val float :offset-assert 212) + (interp-step float :offset-assert 216) + (dist-from-src float :offset-assert 220) + (dist-from-dest float :offset-assert 224) + (flip-control-axis vector :inline :offset-assert 240) + (velocity vector :inline :offset-assert 256) + (tracking-status uint64 :offset-assert 272) + (tracking-options int32 :offset-assert 280) + (tracking cam-rotation-tracker :inline :offset-assert 288) + (fast-rot basic :offset-assert 552) ) :method-count-assert 14 :size-assert #x22c :flag-assert #xe01b0022c - (:methods - (camera-combiner-method-9 () none 9) - (camera-combiner-method-10 () none 10) - (camera-combiner-method-11 () none 11) - (camera-combiner-method-12 () none 12) - (camera-combiner-method-13 () none 13) - ) ) -|# -#| (deftype camera-slave (process) - ((trans vector :inline :offset-assert 124) - (fov float :offset-assert 140) - (fov0 float :offset-assert 144) - (fov1 float :offset-assert 148) - (fov-index cam-index :inline :offset-assert 156) - (tracking cam-rotation-tracker :inline :offset-assert 204) - (view-off-param float :offset-assert 468) - (view-off vector :inline :offset-assert 476) - (joystick-saved-view-off vector :inline :offset-assert 492) - (min-z-override float :offset-assert 508) - (view-flat vector :inline :offset-assert 524) - (string-vel-dir uint32 :offset-assert 540) - (string-trans vector :inline :offset-assert 556) - (position-spline tracking-spline :inline :offset-assert 572) - (pivot-pt vector :inline :offset-assert 2220) - (pivot-rad float :offset-assert 2236) - (circular-follow vector :inline :offset-assert 2252) - (max-angle-offset float :offset-assert 2268) - (max-angle-curr float :offset-assert 2272) - (options uint32 :offset-assert 2276) - (cam-entity entity :offset-assert 2280) ;; guessed by decompiler - (butt-timer uint64 :offset-assert 2284) - (butt-seek basic :offset-assert 2292) - (butt-vector vector :inline :offset-assert 2300) - (velocity vector :inline :offset-assert 2316) - (desired-pos vector :inline :offset-assert 2332) - (time-dist-too-far uint32 :offset-assert 2348) - (los-state slave-los-state :offset-assert 2352) ;; guessed by decompiler - (good-point vector :inline :offset-assert 2364) - (los-tgt-spline-pt int32 :offset-assert 2380) - (los-tgt-spline-pt-incarnation int32 :offset-assert 2384) - (los-last-pos vector :inline :offset-assert 2396) - (intro-curve curve :inline :offset-assert 2412) - (intro-offset vector :inline :offset-assert 2444) - (intro-t float :offset-assert 2460) - (intro-t-step float :offset-assert 2464) - (outro-exit-value float :offset-assert 2468) - (spline-exists basic :offset-assert 2472) - (spline-curve curve :inline :offset-assert 2476) - (spline-offset vector :inline :offset-assert 2508) - (index cam-index :inline :offset-assert 2524) - (saved-pt vector :inline :offset-assert 2572) - (spline-tt float :offset-assert 2588) - (spline-follow-dist float :offset-assert 2592) - (enter-has-run symbol :offset-assert 2596) ;; guessed by decompiler - (blend-from-type uint64 :offset-assert 2604) - (blend-to-type uint64 :offset-assert 2612) - (have-phony-joystick basic :offset-assert 2620) - (phony-joystick-x float :offset-assert 2624) - (phony-joystick-y float :offset-assert 2628) - (string-min-val vector :inline :offset-assert 2636) - (string-max-val vector :inline :offset-assert 2652) - (string-val-locked basic :offset-assert 2668) - (relative-position vector :inline :offset-assert 2684) - (string-relative basic :offset-assert 2700) + ((trans vector :inline :offset-assert 128) + (fov float :offset-assert 144) + (fov0 float :offset-assert 148) + (fov1 float :offset-assert 152) + (fov-index cam-index :inline :offset-assert 160) + (tracking cam-rotation-tracker :inline :offset-assert 208) + (view-off-param float :offset-assert 472) + (view-off vector :inline :offset-assert 480) + (joystick-saved-view-off vector :inline :offset-assert 496) + (min-z-override float :offset-assert 512) + (view-flat vector :inline :offset-assert 528) + (string-vel-dir uint32 :offset-assert 544) + (string-trans vector :inline :offset-assert 560) + (position-spline tracking-spline :inline :offset-assert 576) + (pivot-pt vector :inline :offset-assert 2224) + (pivot-rad float :offset-assert 2240) + (circular-follow vector :inline :offset-assert 2256) + (max-angle-offset float :offset-assert 2272) + (max-angle-curr float :offset-assert 2276) + (options uint32 :offset-assert 2280) + (cam-entity entity :offset-assert 2284) ;; guessed by decompiler + (butt-timer uint64 :offset-assert 2288) + (butt-seek basic :offset-assert 2296) + (butt-vector vector :inline :offset-assert 2304) + (velocity vector :inline :offset-assert 2320) + (desired-pos vector :inline :offset-assert 2336) + (time-dist-too-far uint32 :offset-assert 2352) + (los-state slave-los-state :offset-assert 2356) ;; guessed by decompiler + (good-point vector :inline :offset-assert 2368) + (los-tgt-spline-pt int32 :offset-assert 2384) + (los-tgt-spline-pt-incarnation int32 :offset-assert 2388) + (los-last-pos vector :inline :offset-assert 2400) + (intro-curve curve :inline :offset-assert 2416) + (intro-offset vector :inline :offset-assert 2448) + (intro-t float :offset-assert 2464) + (intro-t-step float :offset-assert 2468) + (outro-exit-value float :offset-assert 2472) + (spline-exists basic :offset-assert 2476) + (spline-curve curve :inline :offset-assert 2480) + (spline-offset vector :inline :offset-assert 2512) + (index cam-index :inline :offset-assert 2528) + (saved-pt vector :inline :offset-assert 2576) + (spline-tt float :offset-assert 2592) + (spline-follow-dist float :offset-assert 2596) + (enter-has-run symbol :offset-assert 2600) ;; guessed by decompiler + (blend-from-type uint64 :offset-assert 2608) + (blend-to-type uint64 :offset-assert 2616) + (have-phony-joystick basic :offset-assert 2624) + (phony-joystick-x float :offset-assert 2628) + (phony-joystick-y float :offset-assert 2632) + (string-min-val vector :inline :offset-assert 2640) + (string-max-val vector :inline :offset-assert 2656) + (string-val-locked basic :offset-assert 2672) + (relative-position vector :inline :offset-assert 2688) + (string-relative basic :offset-assert 2704) ) :method-count-assert 14 :size-assert #xa94 :flag-assert #xe0a200a94 - (:methods - (camera-slave-method-9 () none 9) - (camera-slave-method-10 () none 10) - (camera-slave-method-11 () none 11) - (camera-slave-method-12 () none 12) - (camera-slave-method-13 () none 13) - ) ) -|# -#| (deftype camera-master (process) - ((master-options uint32 :offset-assert 124) - (settings cam-setting-data :offset-assert 128) - (slave (pointer camera-slave) :offset-assert 132) ;; guessed by decompiler - (decel uint32 :offset-assert 136) - (slave-options uint32 :offset-assert 140) - (view-off-param-save float :offset-assert 144) - (changer uint32 :offset-assert 148) - (string-min cam-vector-seeker :inline :offset-assert 156) - (string-max cam-vector-seeker :inline :offset-assert 220) - (string-push-z float :offset-assert 280) - (local-down vector :inline :offset-assert 284) - (focus focus :inline :offset-assert 300) - (being-attacked symbol :offset-assert 312) ;; guessed by decompiler - (attack-start uint64 :offset-assert 316) ;; time-frame - (on-ground symbol :offset-assert 324) ;; guessed by decompiler - (under-water int32 :offset-assert 328) - (on-pole symbol :offset-assert 332) ;; guessed by decompiler - (tgt-rot-mat matrix :inline :offset-assert 348) - (tgt-face-mat matrix :inline :offset-assert 412) - (tpos-old vector :inline :offset-assert 476) - (tpos-curr vector :inline :offset-assert 492) - (tpos-old-adj vector :inline :offset-assert 508) - (tpos-curr-adj vector :inline :offset-assert 524) - (tpos-tgt vector :inline :offset-assert 540) - (upspeed float :offset-assert 556) - (pitch-off vector :inline :offset-assert 572) - (target-spline tracking-spline :inline :offset-assert 588) - (ease-from vector :inline :offset-assert 2236) - (ease-t float :offset-assert 2252) - (ease-step float :offset-assert 2256) - (ease-to vector :inline :offset-assert 2268) - (outro-curve curve :inline :offset-assert 2284) - (outro-t float :offset-assert 2304) - (outro-t-step float :offset-assert 2308) - (outro-exit-value float :offset-assert 2312) - (water-drip-time time-frame :offset-assert 2316) ;; time-frame - (water-drip sparticle-launch-control :offset-assert 2324) ;; guessed by decompiler - (water-drip-mult float :offset-assert 2328) - (water-drip-speed float :offset-assert 2332) + ((master-options uint32 :offset-assert 128) + (settings cam-setting-data :offset-assert 132) + (slave (pointer camera-slave) :offset-assert 136) ;; guessed by decompiler + (decel uint32 :offset-assert 140) + (slave-options uint32 :offset-assert 144) + (view-off-param-save float :offset-assert 148) + (changer uint32 :offset-assert 152) + (string-min cam-vector-seeker :inline :offset-assert 160) + (string-max cam-vector-seeker :inline :offset-assert 224) + (string-push-z float :offset-assert 284) + (local-down vector :inline :offset-assert 288) + (focus focus :inline :offset-assert 304) + (being-attacked symbol :offset-assert 316) ;; guessed by decompiler + (attack-start time-frame :offset-assert 320) ;; time-frame + (on-ground symbol :offset-assert 328) ;; guessed by decompiler + (under-water int32 :offset-assert 332) + (on-pole symbol :offset-assert 336) ;; guessed by decompiler + (tgt-rot-mat matrix :inline :offset-assert 352) + (tgt-face-mat matrix :inline :offset-assert 416) + (tpos-old vector :inline :offset-assert 480) + (tpos-curr vector :inline :offset-assert 496) + (tpos-old-adj vector :inline :offset-assert 512) + (tpos-curr-adj vector :inline :offset-assert 528) + (tpos-tgt vector :inline :offset-assert 544) + (upspeed float :offset-assert 560) + (pitch-off vector :inline :offset-assert 576) + (target-spline tracking-spline :inline :offset-assert 592) + (ease-from vector :inline :offset-assert 2240) + (ease-t float :offset-assert 2256) + (ease-step float :offset-assert 2260) + (ease-to vector :inline :offset-assert 2272) + (outro-curve curve :inline :offset-assert 2288) + (outro-t float :offset-assert 2308) + (outro-t-step float :offset-assert 2312) + (outro-exit-value float :offset-assert 2316) + (water-drip-time time-frame :offset-assert 2320) ;; time-frame + (water-drip sparticle-launch-control :offset-assert 2328) ;; guessed by decompiler + (water-drip-mult float :offset-assert 2332) + (water-drip-speed float :offset-assert 2336) ) :method-count-assert 17 :size-assert #x924 :flag-assert #x1108b00924 (:methods - (camera-master-method-9 () none 9) - (camera-master-method-10 () none 10) - (camera-master-method-11 () none 11) - (camera-master-method-12 () none 12) - (camera-master-method-13 () none 13) (camera-master-method-14 () none 14) (camera-master-method-15 () none 15) (camera-master-method-16 () none 16) ) ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-debug-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *redline-table* object) ;; (pointer float) -;; (define-extern *redline-index* object) ;; int -;; (define-extern float-save-redline function) ;; (function float none) -;; (define-extern float-lookup-redline function) ;; (function float float) -;; (define-extern *blueline-table* object) ;; (pointer float) -;; (define-extern *blueline-index* object) ;; int -;; (define-extern float-save-blueline function) ;; (function float none) -;; (define-extern float-lookup-blueline function) ;; (function float float) -;; (define-extern *greenline-table* object) ;; (pointer float) -;; (define-extern *greenline-index* object) ;; int -;; (define-extern float-save-greenline function) ;; (function float none) -;; (define-extern float-lookup-greenline function) ;; (function float float) -;; (define-extern *yellowline-table* object) ;; (pointer float) -;; (define-extern *yellowline-index* object) ;; int -;; (define-extern float-save-yellowline function) ;; (function float none) -;; (define-extern float-lookup-yellowline function) ;; (function float float) -;; (define-extern *timeplot-table* object) ;; (pointer float) -;; (define-extern *timeplot-index* object) ;; int -;; (define-extern float-save-timeplot function) ;; (function float none) -;; (define-extern float-lookup-timeplot function) ;; (function float float) -;; (define-extern *cam-layout* object) ;; symbol +(define-extern *redline-table* (pointer float)) +(define-extern *redline-index* int) +(define-extern float-save-redline (function float none)) +(define-extern float-lookup-redline (function float float)) +(define-extern *blueline-table* (pointer float)) +(define-extern *blueline-index* int) +(define-extern float-save-blueline (function float none)) +(define-extern float-lookup-blueline (function float float)) +(define-extern *greenline-table* (pointer float)) +(define-extern *greenline-index* int) +(define-extern float-save-greenline (function float none)) +(define-extern float-lookup-greenline (function float float)) +(define-extern *yellowline-table* (pointer float)) +(define-extern *yellowline-index* int) +(define-extern float-save-yellowline (function float none)) +(define-extern float-lookup-yellowline (function float float)) +(define-extern *timeplot-table* (pointer float)) +(define-extern *timeplot-index* int) +(define-extern float-save-timeplot (function float none)) +(define-extern float-lookup-timeplot (function float float)) +(define-extern *cam-layout* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-interface-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *camera-init-mat* object) ;; matrix -;; (define-extern *camera* object) ;; camera-master -;; (define-extern *camera-combiner* object) ;; camera-combiner +(define-extern *camera-init-mat* matrix) +(define-extern *camera* camera-master) +(define-extern *camera-combiner* camera-combiner) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-update-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *external-cam-options* object) ;; external-cam-option -;; (define-extern *external-cam-mode* object) ;; symbol -;; (define-extern *camera-look-through-other* object) ;; int -;; (define-extern *camera-other-fov* bfloat) ;; bfloat -;; (define-extern *camera-other-trans* object) ;; vector -;; (define-extern *camera-other-matrix* object) ;; matrix -;; (define-extern *camera-smush-control* object) ;; smush-control -;; (define-extern *camera-other-root* object) ;; vector -;; (define-extern *fix-visible-level-mask* object) -;; (define-extern *manual-sample-point* object) +(defenum external-cam-option + :bitfield #t + (allow-z 0) + ) + +(define-extern *external-cam-options* external-cam-option) +(define-extern *external-cam-mode* symbol) +(define-extern *camera-look-through-other* int) +(define-extern *camera-other-fov* bfloat) +(define-extern *camera-other-trans* vector) +(define-extern *camera-other-matrix* matrix) +(define-extern *camera-smush-control* smush-control) +(define-extern *camera-other-root* vector) +(define-extern *fix-visible-level-mask* int) +(define-extern *manual-sample-point* symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; hud-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype hud-string (basic) - ((text basic :offset-assert 4) + ((text string :offset-assert 4) (scale float :offset-assert 8) (color uint32 :offset-assert 12) (flags uint32 :offset-assert 16) @@ -17286,9 +18508,7 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype hud-sprite (structure) ((pos vector4w :inline :offset-assert 0) (color vector4w :inline :offset-assert 16) @@ -17306,9 +18526,7 @@ (hud-sprite-method-10 () none 10) ) ) -|# -#| (deftype hud-box (structure) ((min vector2 :inline :offset-assert 0) (max vector2 :inline :offset-assert 8) @@ -17327,9 +18545,7 @@ (hud-box-method-15 () none 15) ) ) -|# -#| (deftype hud-icon (basic) ((icon (pointer manipy) :offset-assert 4) ;; guessed by decompiler (pos vector4w :inline :offset-assert 16) @@ -17340,42 +18556,38 @@ :size-assert #x28 :flag-assert #x900000028 ) -|# -#| (deftype hud-value (basic) ((current int32 :offset-assert 4) (target int32 :offset-assert 8) (flags uint16 :offset-assert 12) (counter uint16 :offset-assert 14) ) + :pack-me :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| +(defenum hud-flags + :type uint32 + :bitfield #t + ) (deftype hud (process) - ((trigger-time time-frame :offset-assert 124) ;; time-frame - (last-hide-time time-frame :offset-assert 132) ;; time-frame - (offset float :offset-assert 140) ;; int32 - (flags uint32 :offset-assert 144) - (values UNKNOWN 8 :offset-assert 148) - (strings UNKNOWN 14 :offset-assert 284) - (sprites UNKNOWN 30 :offset-assert 956) - (icons hud-icon 2 :offset-assert 2876) ;; guessed by decompiler - (gui-id uint32 :offset-assert 2972) + ((trigger-time time-frame :offset-assert 128) ;; time-frame + (last-hide-time time-frame :offset-assert 136) ;; time-frame + (offset float :offset-assert 144) ;; int32 + (flags hud-flags :offset-assert 148) + (values hud-value 8 :inline :offset-assert 152) + (strings hud-string 14 :inline :offset-assert 288) + (sprites hud-sprite 30 :inline :offset-assert 960) + (icons hud-icon 2 :inline :offset-assert 2880) ;; guessed by decompiler + (gui-id uint32 :offset-assert 2976) ) :method-count-assert 27 :size-assert #xba4 :flag-assert #x1b0b300ba4 (:methods - (hud-method-9 () none 9) - (hud-method-10 () none 10) - (hud-method-11 () none 11) - (hud-method-12 () none 12) - (hud-method-13 () none 13) (hud-method-14 () none 14) ;; (hidden? (_type_) symbol 14) (hud-method-15 () none 15) ;; (draw-hud (_type_) none 15) (hud-method-16 () none 16) ;; (tally-value (_type_ int int) none 16) @@ -17391,9 +18603,7 @@ (hud-method-26 () none 26) ;; (get-icon-scale-y (_type_) float 26) ) ) -|# -#| (deftype hud-ashelin (hud) () :method-count-assert 27 @@ -17402,9 +18612,7 @@ (:methods ) ) -|# -#| (deftype hud-cargo (hud) () :method-count-assert 27 @@ -17413,9 +18621,7 @@ (:methods ) ) -|# -#| (deftype hud-citizen (hud) () :method-count-assert 27 @@ -17424,9 +18630,7 @@ (:methods ) ) -|# -#| (deftype hud-cpanel (hud) () :method-count-assert 27 @@ -17435,9 +18639,7 @@ (:methods ) ) -|# -#| (deftype hud-dig-clasp (hud) () :method-count-assert 27 @@ -17446,9 +18648,7 @@ (:methods ) ) -|# -#| (deftype hud-gun (hud) () :method-count-assert 27 @@ -17457,9 +18657,7 @@ (:methods ) ) -|# -#| (deftype hud-health (hud) () :method-count-assert 27 @@ -17468,9 +18666,7 @@ (:methods ) ) -|# -#| (deftype hud-dark-eco-symbol (hud) () :method-count-assert 27 @@ -17479,9 +18675,7 @@ (:methods ) ) -|# -#| (deftype hud-helldog (hud) () :method-count-assert 27 @@ -17490,9 +18684,7 @@ (:methods ) ) -|# -#| (deftype hud-lurker (hud) () :method-count-assert 27 @@ -17501,9 +18693,7 @@ (:methods ) ) -|# -#| (deftype hud-map (hud) () :method-count-assert 27 @@ -17512,9 +18702,7 @@ (:methods ) ) -|# -#| (deftype hud-moneybag (hud) () :method-count-assert 27 @@ -17523,9 +18711,7 @@ (:methods ) ) -|# -#| (deftype hud-pegasus (hud) () :method-count-assert 27 @@ -17534,9 +18720,7 @@ (:methods ) ) -|# -#| (deftype hud-plasmite (hud) () :method-count-assert 27 @@ -17545,9 +18729,7 @@ (:methods ) ) -|# -#| (deftype hud-dig-button (hud) () :method-count-assert 27 @@ -17556,9 +18738,7 @@ (:methods ) ) -|# -#| (deftype hud-predator (hud) () :method-count-assert 27 @@ -17567,9 +18747,7 @@ (:methods ) ) -|# -#| (deftype hud-heatmeter (hud) () :method-count-assert 27 @@ -17578,9 +18756,7 @@ (:methods ) ) -|# -#| (deftype hud-progress (hud) () :method-count-assert 27 @@ -17589,9 +18765,7 @@ (:methods ) ) -|# -#| (deftype hud-rocketsensor (hud) () :method-count-assert 27 @@ -17600,9 +18774,7 @@ (:methods ) ) -|# -#| (deftype hud-ruffians (hud) () :method-count-assert 27 @@ -17611,9 +18783,7 @@ (:methods ) ) -|# -#| (deftype hud-score (hud) () :method-count-assert 27 @@ -17622,9 +18792,7 @@ (:methods ) ) -|# -#| (deftype hud-sig (hud) () :method-count-assert 27 @@ -17633,9 +18801,7 @@ (:methods ) ) -|# -#| (deftype hud-skill (hud) () :method-count-assert 27 @@ -17644,9 +18810,7 @@ (:methods ) ) -|# -#| (deftype hud-skullgem (hud) () :method-count-assert 27 @@ -17655,9 +18819,7 @@ (:methods ) ) -|# -#| (deftype hud-timer (hud) () :method-count-assert 27 @@ -17666,9 +18828,7 @@ (:methods ) ) -|# -#| (deftype hud-turret (hud) () :method-count-assert 27 @@ -17677,9 +18837,7 @@ (:methods ) ) -|# -#| (deftype hud-squid (hud) () :method-count-assert 27 @@ -17688,9 +18846,7 @@ (:methods ) ) -|# -#| (deftype hud-gunturret (hud) () :method-count-assert 27 @@ -17699,9 +18855,7 @@ (:methods ) ) -|# -#| (deftype hud-gruntegg (hud) () :method-count-assert 27 @@ -17710,9 +18864,7 @@ (:methods ) ) -|# -#| (deftype hud-crimsonhover (hud) () :method-count-assert 27 @@ -17721,9 +18873,7 @@ (:methods ) ) -|# -#| (deftype hud-metalkor (hud) () :method-count-assert 27 @@ -17732,9 +18882,7 @@ (:methods ) ) -|# -#| (deftype hud-big-score (hud) () :method-count-assert 27 @@ -17743,9 +18891,7 @@ (:methods ) ) -|# -#| (deftype hud-goal (hud) () :method-count-assert 27 @@ -17754,9 +18900,7 @@ (:methods ) ) -|# -#| (deftype hud-miss (hud) () :method-count-assert 27 @@ -17765,9 +18909,7 @@ (:methods ) ) -|# -#| (deftype hud-race-timer (hud) () :method-count-assert 27 @@ -17776,9 +18918,7 @@ (:methods ) ) -|# -#| (deftype hud-race-lap-counter (hud) () :method-count-assert 27 @@ -17787,9 +18927,7 @@ (:methods ) ) -|# -#| (deftype hud-race-turbo-counter (hud) () :method-count-assert 27 @@ -17798,9 +18936,7 @@ (:methods ) ) -|# -#| (deftype hud-race-position (hud) () :method-count-assert 27 @@ -17809,9 +18945,7 @@ (:methods ) ) -|# -#| (deftype hud-race-map (hud) () :method-count-assert 27 @@ -17820,9 +18954,7 @@ (:methods ) ) -|# -#| (deftype hud-samos-old (hud) () :method-count-assert 27 @@ -17831,9 +18963,7 @@ (:methods ) ) -|# -#| (deftype hud-samos-young (hud) () :method-count-assert 27 @@ -17842,9 +18972,7 @@ (:methods ) ) -|# -#| (deftype hud-lurker-button (hud) () :method-count-assert 27 @@ -17853,9 +18981,7 @@ (:methods ) ) -|# -#| (deftype hud-widow (hud) () :method-count-assert 27 @@ -17864,9 +18990,7 @@ (:methods ) ) -|# -#| (deftype hud-race-final-stats (hud) () :method-count-assert 27 @@ -17875,9 +18999,7 @@ (:methods ) ) -|# -#| (deftype hud-mech-air-tank (hud) () :method-count-assert 27 @@ -17886,9 +19008,7 @@ (:methods ) ) -|# -#| (deftype hud-homing-beacon (hud) () :method-count-assert 27 @@ -17897,9 +19017,7 @@ (:methods ) ) -|# -#| (deftype hud-dark-eco-pickup (hud) () :method-count-assert 27 @@ -17908,9 +19026,7 @@ (:methods ) ) -|# -#| (deftype hud-green-eco-pickup (hud) () :method-count-assert 27 @@ -17919,40 +19035,38 @@ (:methods ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; progress-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype progress (process-drawable) - ((current-options basic :offset-assert 196) - (menu-transition float :offset-assert 200) - (option-index int32 :offset-assert 204) - (want-option-index int32 :offset-assert 208) - (next-option-index int32 :offset-assert 212) - (graphic-index int32 :offset-assert 216) - (selected-option basic :offset-assert 220) - (current basic :offset-assert 224) - (next basic :offset-assert 228) - (ring-angle float :offset-assert 232) - (ring-want-angle float :offset-assert 236) - (init-quat quaternion :inline :offset-assert 252) - (pos-transition float :offset-assert 268) - (anim-frame float :offset-assert 272) - (swing float :offset-assert 276) - (main-menu basic :offset-assert 280) - (state-stack UNKNOWN 5 :offset-assert 284) - (option-index-stack int32 5 :offset-assert 304) ;; guessed by decompiler - (state-pos int32 :offset-assert 324) - (secret-buying basic :offset-assert 328) - (secret-buy-choice basic :offset-assert 332) - (sliding float :offset-assert 336) - (sliding-off float :offset-assert 340) - (scanlines-alpha float :offset-assert 344) - (sliding-height float :offset-assert 348) + ((current-options basic :offset-assert 200) + (menu-transition float :offset-assert 204) + (option-index int32 :offset-assert 208) + (want-option-index int32 :offset-assert 212) + (next-option-index int32 :offset-assert 216) + (graphic-index int32 :offset-assert 220) + (selected-option basic :offset-assert 224) + (current basic :offset-assert 228) + (next basic :offset-assert 232) + (ring-angle float :offset-assert 236) + (ring-want-angle float :offset-assert 240) + (init-quat quaternion :inline :offset-assert 256) + (pos-transition float :offset-assert 272) + (anim-frame float :offset-assert 276) + (swing float :offset-assert 280) + (main-menu basic :offset-assert 284) + (state-stack int32 5 :offset-assert 288) + (option-index-stack int32 5 :offset-assert 308) ;; guessed by decompiler + (state-pos int32 :offset-assert 328) + (secret-buying basic :offset-assert 332) + (secret-buy-choice basic :offset-assert 336) + (sliding float :offset-assert 340) + (sliding-off float :offset-assert 344) + (scanlines-alpha float :offset-assert 348) + (sliding-height float :offset-assert 352) ) :method-count-assert 33 :size-assert #x164 @@ -17973,13 +19087,11 @@ (progress-method-32 () none 32) ;; (can-go-back? (_type_) symbol 32) ) ) -|# -#| (deftype menu-option (basic) ((name uint32 :offset-assert 4) (scale basic :offset-assert 8) - (box UNKNOWN 1 :offset-assert 16) + (box bounding-box 1 :inline :offset-assert 16) ;; no idea ) :method-count-assert 12 :size-assert #x30 @@ -17990,9 +19102,7 @@ (menu-option-method-11 () none 11) ) ) -|# -#| (deftype menu-on-off-option (menu-option) ((value-to-modify uint32 :offset-assert 48) ) @@ -18002,9 +19112,7 @@ (:methods ) ) -|# -#| (deftype menu-yes-no-option (menu-option) ((value-to-modify uint32 :offset-assert 48) ) @@ -18014,9 +19122,7 @@ (:methods ) ) -|# -#| (deftype menu-language-option (menu-option) ((language-selection uint64 :offset-assert 48) (language-direction basic :offset-assert 56) @@ -18029,9 +19135,7 @@ (:methods ) ) -|# -#| (deftype menu-quit-option (menu-option) () :method-count-assert 12 @@ -18040,12 +19144,10 @@ (:methods ) ) -|# -#| (deftype menu-slider-option (menu-option) ((value-to-modify uint32 :offset-assert 48) - (sprites UNKNOWN 5 :offset-assert 64) + (sprites hud-sprite 5 :inline :offset-assert 64) ;; guess ) :method-count-assert 12 :size-assert #x180 @@ -18053,11 +19155,10 @@ (:methods ) ) -|# -#| (deftype menu-sub-menu-option (menu-option) ((next-state basic :offset-assert 48) + (pad uint8 44) ) :method-count-assert 12 :size-assert #x60 @@ -18065,9 +19166,7 @@ (:methods ) ) -|# -#| (deftype menu-sub-menu-sound-option (menu-option) ((next-state basic :offset-assert 48) ) @@ -18077,9 +19176,7 @@ (:methods ) ) -|# -#| (deftype menu-stereo-mode-sound-option (menu-option) () :method-count-assert 12 @@ -18088,9 +19185,7 @@ (:methods ) ) -|# -#| (deftype menu-sub-menu-graphic-option (menu-option) ((next-state basic :offset-assert 48) ) @@ -18100,9 +19195,7 @@ (:methods ) ) -|# -#| (deftype menu-unlocked-menu-option (menu-sub-menu-option) () :method-count-assert 12 @@ -18111,9 +19204,7 @@ (:methods ) ) -|# -#| (deftype menu-main-menu-option (menu-option) ((next-state basic :offset-assert 48) ) @@ -18123,11 +19214,10 @@ (:methods ) ) -|# -#| (deftype menu-memcard-slot-option (menu-option) - ((sprites UNKNOWN 5 :offset-assert 48) + ((sprites hud-sprite 5 :inline :offset-assert 48) ;; total guess + (pad uint8 32) ) :method-count-assert 12 :size-assert #x190 @@ -18135,9 +19225,7 @@ (:methods ) ) -|# -#| (deftype menu-loading-option (menu-option) () :method-count-assert 12 @@ -18146,9 +19234,7 @@ (:methods ) ) -|# -#| (deftype menu-insufficient-space-option (menu-option) ((last-move uint64 :offset-assert 48) ) @@ -18158,9 +19244,7 @@ (:methods ) ) -|# -#| (deftype menu-secrets-insufficient-space-option (menu-option) () :method-count-assert 12 @@ -18169,9 +19253,7 @@ (:methods ) ) -|# -#| (deftype menu-insert-card-option (menu-option) () :method-count-assert 12 @@ -18180,9 +19262,7 @@ (:methods ) ) -|# -#| (deftype menu-error-loading-option (menu-option) () :method-count-assert 12 @@ -18191,9 +19271,7 @@ (:methods ) ) -|# -#| (deftype menu-error-auto-saving-option (menu-option) () :method-count-assert 12 @@ -18202,9 +19280,7 @@ (:methods ) ) -|# -#| (deftype menu-card-removed-option (menu-option) () :method-count-assert 12 @@ -18213,9 +19289,7 @@ (:methods ) ) -|# -#| (deftype menu-error-disc-removed-option (menu-option) () :method-count-assert 12 @@ -18224,9 +19298,7 @@ (:methods ) ) -|# -#| (deftype menu-error-reading-option (menu-option) () :method-count-assert 12 @@ -18235,11 +19307,9 @@ (:methods ) ) -|# -#| (deftype menu-icon-info-option (menu-option) - ((sprites UNKNOWN 2 :offset-assert 48) + ((sprites hud-sprite 2 :inline :offset-assert 48) ) :method-count-assert 12 :size-assert #xb0 @@ -18247,9 +19317,7 @@ (:methods ) ) -|# -#| (deftype menu-format-card-option (menu-option) () :method-count-assert 12 @@ -18258,9 +19326,7 @@ (:methods ) ) -|# -#| (deftype menu-already-exists-option (menu-option) () :method-count-assert 12 @@ -18269,9 +19335,7 @@ (:methods ) ) -|# -#| (deftype menu-create-game-option (menu-option) () :method-count-assert 12 @@ -18280,9 +19344,7 @@ (:methods ) ) -|# -#| (deftype menu-video-mode-warning-option (menu-option) () :method-count-assert 12 @@ -18291,9 +19353,7 @@ (:methods ) ) -|# -#| (deftype menu-video-mode-ok-option (menu-option) () :method-count-assert 12 @@ -18302,9 +19362,7 @@ (:methods ) ) -|# -#| (deftype menu-progressive-mode-warning-option (menu-option) () :method-count-assert 12 @@ -18313,9 +19371,7 @@ (:methods ) ) -|# -#| (deftype menu-progressive-mode-ok-option (menu-option) () :method-count-assert 12 @@ -18324,9 +19380,7 @@ (:methods ) ) -|# -#| (deftype menu-select-start-option (menu-option) ((task-index int32 :offset-assert 48) (real-task-index int32 :offset-assert 52) @@ -18338,9 +19392,7 @@ (:methods ) ) -|# -#| (deftype menu-select-scene-option (menu-option) ((task-index int32 :offset-assert 48) (last-move uint64 :offset-assert 56) @@ -18351,9 +19403,7 @@ (:methods ) ) -|# -#| (deftype menu-bigmap-option (menu-option) () :method-count-assert 12 @@ -18362,9 +19412,7 @@ (:methods ) ) -|# -#| (deftype paged-menu-option (menu-option) ((page-index int32 :offset-assert 48) (prev-page-index int32 :offset-assert 52) @@ -18377,9 +19425,7 @@ (:methods ) ) -|# -#| (deftype menu-missions-option (paged-menu-option) ((task-line-index int32 :offset-assert 64) (last-move uint64 :offset-assert 72) @@ -18390,12 +19436,10 @@ (:methods ) ) -|# -#| (deftype menu-highscores-option (paged-menu-option) ((last-move uint64 :offset-assert 64) - (sprites UNKNOWN 2 :offset-assert 80) + (sprites hud-sprite 2 :inline :offset-assert 80) ) :method-count-assert 12 :size-assert #xd0 @@ -18403,9 +19447,7 @@ (:methods ) ) -|# -#| (deftype secret-item-option (menu-option) ((cost int32 :offset-assert 48) (can-toggle basic :offset-assert 52) @@ -18418,9 +19460,7 @@ (:methods ) ) -|# -#| (deftype menu-secret-option (menu-option) ((item-index int32 :offset-assert 48) (prev-item-index int32 :offset-assert 52) @@ -18428,7 +19468,7 @@ (num-hero-items int32 :offset-assert 60) (secret-items basic :offset-assert 64) (last-move uint64 :offset-assert 72) - (sprites UNKNOWN 2 :offset-assert 80) + (sprites hud-sprite 2 :inline :offset-assert 80) ) :method-count-assert 12 :size-assert #xd0 @@ -18436,9 +19476,7 @@ (:methods ) ) -|# -#| (deftype menu-option-list (basic) ((y-center int32 :offset-assert 4) (y-space int32 :offset-assert 8) @@ -18449,12 +19487,10 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype menu-qr-option (menu-option) ((last-move uint64 :offset-assert 48) - (value-to-modify uint32 :offset-assert 60) + (value-to-modify uint32 :offset 60) ) :method-count-assert 12 :size-assert #x40 @@ -18462,9 +19498,7 @@ (:methods ) ) -|# -#| (deftype menu-restart-mission-qr-option (menu-qr-option) ((next-state basic :offset-assert 64) ) @@ -18474,9 +19508,7 @@ (:methods ) ) -|# -#| (deftype menu-quit-qr-option (menu-qr-option) ((next-state basic :offset-assert 64) ) @@ -18486,9 +19518,7 @@ (:methods ) ) -|# -#| (deftype menu-sub-menu-qr-option (menu-qr-option) ((next-state basic :offset-assert 64) ) @@ -18498,12 +19528,10 @@ (:methods ) ) -|# -#| (deftype menu-graphic-option (menu-option) ((last-move uint64 :offset-assert 48) - (value-to-modify uint32 :offset-assert 60) + (value-to-modify uint32 :offset 60) ) :method-count-assert 12 :size-assert #x40 @@ -18511,9 +19539,7 @@ (:methods ) ) -|# -#| (deftype menu-on-off-progressive-scan-graphic-option (menu-graphic-option) () :method-count-assert 12 @@ -18522,9 +19548,7 @@ (:methods ) ) -|# -#| (deftype menu-aspect-ratio-option (menu-graphic-option) () :method-count-assert 12 @@ -18533,9 +19557,7 @@ (:methods ) ) -|# -#| (deftype menu-center-screen-graphic-option (menu-graphic-option) ((next-state basic :offset-assert 64) ) @@ -18545,9 +19567,7 @@ (:methods ) ) -|# -#| (deftype menu-video-mode-option (menu-graphic-option) () :method-count-assert 12 @@ -18556,12 +19576,10 @@ (:methods ) ) -|# -#| (deftype menu-game-option (menu-option) ((last-move uint64 :offset-assert 48) - (value-to-modify uint32 :offset-assert 60) + (value-to-modify uint32 :offset 60) ) :method-count-assert 12 :size-assert #x40 @@ -18569,9 +19587,7 @@ (:methods ) ) -|# -#| (deftype menu-on-off-game-vibrations-option (menu-game-option) () :method-count-assert 12 @@ -18580,9 +19596,7 @@ (:methods ) ) -|# -#| (deftype menu-on-off-game-subtitles-option (menu-game-option) () :method-count-assert 12 @@ -18591,9 +19605,7 @@ (:methods ) ) -|# -#| (deftype menu-sub-menu-game-option (menu-game-option) ((next-state basic :offset-assert 64) ) @@ -18603,9 +19615,7 @@ (:methods ) ) -|# -#| (deftype menu-language-game-option (menu-game-option) ((language-selection uint64 :offset-assert 64) (language-direction basic :offset-assert 72) @@ -18618,9 +19628,7 @@ (:methods ) ) -|# -#| (deftype menu-subtitle-language-game-option (menu-game-option) ((language-selection uint64 :offset-assert 64) (language-direction basic :offset-assert 72) @@ -18633,29 +19641,31 @@ (:methods ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; rpc-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(define-extern rpc-busy? (function int uint)) +(define-extern rpc-call (function int uint uint uint int uint int uint)) + (deftype rpc-buffer (basic) ((elt-size uint32 :offset-assert 4) (elt-count uint32 :offset-assert 8) (elt-used uint32 :offset-assert 12) (busy basic :offset-assert 16) (base pointer :offset-assert 20) ;; guessed by decompiler - (data uint8 :dynamic :offset-assert 32) ;; guessed by decompiler + (data uint8 :dynamic :offset 32) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 + (:methods + (new (symbol type uint uint) rpc-buffer 0) + ) ) -|# -#| (deftype rpc-buffer-pair (basic) ((buffer rpc-buffer 2 :offset-assert 4) ;; guessed by decompiler (current rpc-buffer :offset-assert 12) ;; guessed by decompiler @@ -18666,36 +19676,44 @@ :size-assert #x18 :flag-assert #xf00000018 (:methods - ;; (new (symbol type uint uint int) rpc-buffer-pair 0) - (rpc-buffer-pair-method-9 () none 9) ;; (call (rpc-buffer-pair uint pointer uint) int 9) - (rpc-buffer-pair-method-10 () none 10) ;; (add-element (rpc-buffer-pair) pointer 10) - (rpc-buffer-pair-method-11 () none 11) ;; (decrement-elt-used (rpc-buffer-pair) int 11) - (rpc-buffer-pair-method-12 () none 12) ;; (sync (rpc-buffer-pair symbol) int 12) - (rpc-buffer-pair-method-13 () none 13) ;; (check-busy (rpc-buffer-pair) symbol 13) - (rpc-buffer-pair-method-14 () none 14) ;; (pop-last-received (rpc-buffer-pair) pointer 14) + (new (symbol type uint uint int) rpc-buffer-pair 0) + (call (rpc-buffer-pair uint pointer uint) int 9) + (add-element (rpc-buffer-pair) pointer 10) + (decrement-elt-used (rpc-buffer-pair) int 11) + (sync (rpc-buffer-pair symbol) int 12) + (check-busy (rpc-buffer-pair) symbol 13) + (pop-last-received (rpc-buffer-pair) pointer 14) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; path-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum path-control-flag + :bitfield #t + :type uint32 + (display 0) + (draw-line 1) ;; TODO - only seen it used to control debug drawing so far + (draw-point 2) ;; TODO - only seen it used to control debug drawing so far + (draw-text 3) ;; TODO - only seen it used to control debug drawing so far + (not-found 4) + ) + (deftype path-control (basic) ((flags path-control-flag :offset-assert 4) ;; guessed by decompiler (name symbol :offset-assert 8) ;; guessed by decompiler (process process-drawable :offset-assert 12) ;; guessed by decompiler (curve curve :inline :offset-assert 16) - (num-cverts int32 :offset-assert 20) - (cverts (inline-array vector) :offset-assert 16) ;; guessed by decompiler + (num-cverts int32 :offset 20) + (cverts (inline-array vector) :offset 16) ;; guessed by decompiler ) :method-count-assert 27 :size-assert #x24 :flag-assert #x1b00000024 (:methods - ;; (new (symbol type process symbol float) _type_ 0) + (new (symbol type process symbol float entity symbol) _type_ 0) (path-control-method-9 () none 9) ;; (dummy-9 (_type_) none 9) (path-control-method-10 () none 10) ;; (eval-path-curve-div! (_type_ vector float symbol) vector 10) (path-control-method-11 () none 11) ;; (get-random-point (_type_ vector) vector 11) @@ -18704,70 +19722,64 @@ (path-control-method-14 () none 14) ;; (TODO-RENAME-14 (_type_ vector float) vector 14) (path-control-method-15 () none 15) ;; (length-as-float (_type_) float 15) (path-control-method-16 () none 16) ;; (path-distance (_type_) float 16) - (path-control-method-17 () none 17) ;; (get-num-verts (_type_) int 17) + (get-num-segments (_type_) float 17) (path-control-method-18 () none 18) ;; (should-display? (_type_) symbol 18) - (path-control-method-19 () none 19) ;; (TODO-RENAME-19 (_type_) float 19) - (path-control-method-20 () none 20) ;; (TODO-RENAME-20 (_type_) float 20) - (path-control-method-21 () none 21) + (get-num-verts (_type_) int 19) ;; (TODO-RENAME-19 (_type_) float 19) + (path-distance-equal-spacing (_type_ float) float 20) ;; (TODO-RENAME-20 (_type_) float 20) + (average-segment-length (_type_ float) float 21) (path-control-method-22 () none 22) (path-control-method-23 () none 23) (path-control-method-24 () none 24) - (path-control-method-25 () none 25) + (should-display-marks? (_type_) symbol 25) (path-control-method-26 () none 26) ) ) -|# -#| (deftype curve-control (path-control) () :method-count-assert 27 :size-assert #x24 :flag-assert #x1b00000024 (:methods - ;; (new (symbol type process symbol float) _type_ 0) + (new (symbol type process symbol float) _type_ 0) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nav-mesh-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype nav-mesh-work-debug (structure) - ((debug-vec1 vector :inline :offset-assert 0) - (debug-vec2 vector :inline :offset-assert 16) - (debug-vec3 vector :inline :offset-assert 32) - (debug-vec4 vector :inline :offset-assert 48) - (debug-vec5 vector :inline :offset-assert 64) - (debug-vec6 vector :inline :offset-assert 80) - (debug-vec7 vector :inline :offset-assert 96) - (debug-vec8 vector :inline :offset-assert 112) - (debug-vec9 vector :inline :offset-assert 128) - (debug-vec10 vector :inline :offset-assert 144) - (debug-vec11 vector :inline :offset-assert 160) - (debug-vec12 vector :inline :offset-assert 176) - (sphere-array UNKNOWN 16 :offset-assert 192) + ((debug-vec1 vector :inline :offset-assert 0) + (debug-vec2 vector :inline :offset-assert 16) + (debug-vec3 vector :inline :offset-assert 32) + (debug-vec4 vector :inline :offset-assert 48) + (debug-vec5 vector :inline :offset-assert 64) + (debug-vec6 vector :inline :offset-assert 80) + (debug-vec7 vector :inline :offset-assert 96) + (debug-vec8 vector :inline :offset-assert 112) + (debug-vec9 vector :inline :offset-assert 128) + (debug-vec10 vector :inline :offset-assert 144) + (debug-vec11 vector :inline :offset-assert 160) + (debug-vec12 vector :inline :offset-assert 176) + (sphere-array sphere 16 :inline :offset-assert 192) ) :method-count-assert 9 :size-assert #x1c0 :flag-assert #x9000001c0 ) -|# -#| (deftype nav-mesh-work (structure) - ((vert0-table UNKNOWN 4 :offset-assert 0) - (vert1-table UNKNOWN 4 :offset-assert 4) - (edge-mask-table UNKNOWN 3 :offset-assert 8) + ((vert0-table int8 4 :offset-assert 0) + (vert1-table int8 4 :offset-assert 4) + (edge-mask-table uint8 3 :offset-assert 8) (pad0 uint32 :offset-assert 12) (deg-to-rad float :offset-assert 16) (rad-to-deg float :offset-assert 20) (nav-poly-min-dist float :offset-assert 24) (nav-poly-epsilon float :offset-assert 28) - (sphere-array UNKNOWN 16 :offset-assert 32) + (sphere-array sphere 16 :inline :offset-assert 32) (debug nav-mesh-work-debug :offset-assert 288) (work-struct-in-scratch int8 :offset-assert 292) (mesh-struct-in-scratch int8 :offset-assert 293) @@ -18782,9 +19794,7 @@ :size-assert #x13c :flag-assert #x90000013c ) -|# -#| (deftype nav-mesh-link (structure) ((id uint32 :offset-assert 0) (dest-mesh-id uint32 :offset-assert 4) @@ -18798,50 +19808,38 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype nav-poly (structure) - ((data UNKNOWN 64 :offset-assert 0) - (vertex uint8 4 :offset-assert 0) ;; guessed by decompiler - (vertex0 vector :inline :offset-assert 0) - (vertex1 vector :inline :offset-assert 16) - (vertex2 vector :inline :offset-assert 32) - (vertex3 vector :inline :offset-assert 48) - (id uint8 :offset-assert 12) - (pat uint8 :offset-assert 13) - (vertex-count uint8 :offset-assert 14) - (link uint8 :offset-assert 15) - (adj-poly uint8 4 :offset-assert 28) ;; guessed by decompiler - (adj-poly0 uint8 :offset-assert 28) - (adj-poly1 uint8 :offset-assert 29) - (adj-poly2 uint8 :offset-assert 30) - (adj-poly3 uint8 :offset-assert 31) - (min-y float :offset-assert 44) - (max-y float :offset-assert 60) + ((data uint8 64 :offset-assert 0 :score -1) + (vertex vector 4 :inline :offset 0) ;; changed to vector from uint8 in jak 1 + (vertex0 vector :inline :offset 0) + (vertex1 vector :inline :offset 16) + (vertex2 vector :inline :offset 32) + (vertex3 vector :inline :offset 48) + (id uint8 :offset 12) + (pat uint8 :offset 13) + (vertex-count uint8 :offset 14) + (link uint8 :offset 15) + (adj-poly uint8 4 :offset 28) ;; guessed by decompiler + (adj-poly0 uint8 :offset 28) + (adj-poly1 uint8 :offset 29) + (adj-poly2 uint8 :offset 30) + (adj-poly3 uint8 :offset 31) + (min-y float :offset 44) + (max-y float :offset 60) ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -#| (deftype nav-vertex (vector) - ((data float 4 :offset-assert 0) ;; guessed by decompiler - (x float :offset-assert 0) - (y float :offset-assert 4) - (z float :offset-assert 8) - (w float :offset-assert 12) - (quad uint128 :offset-assert 0) - ) + () :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype nav-sphere (structure) ((trans sphere :inline :offset-assert 0) ) @@ -18849,9 +19847,7 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype nav-ray (structure) ((current-pos vector :inline :offset-assert 0) (dir vector :inline :offset-assert 16) @@ -18870,11 +19866,9 @@ :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype nav-route-portal (structure) - ((vertex nav-vertex 2 :offset-assert 0) ;; guessed by decompiler + ((vertex nav-vertex 2 :inline :offset-assert 0) ;; guessed by decompiler (next-poly nav-poly :offset-assert 32) (edge-index int8 :offset-assert 36) ) @@ -18882,24 +19876,20 @@ :size-assert #x25 :flag-assert #x900000025 ) -|# -#| (deftype nav-find-poly-parms (structure) ((point vector :inline :offset-assert 0) (y-threshold float :offset-assert 16) (ignore uint8 :offset-assert 20) (poly nav-poly :offset-assert 24) (dist float :offset-assert 28) - (point-inside? basic :offset-assert 32) + (point-inside? symbol :offset-assert 32) ) :method-count-assert 9 :size-assert #x24 :flag-assert #x900000024 ) -|# -#| (deftype clamp-travel-vector-to-mesh-return-info (structure) ((found-boundary basic :offset-assert 0) (intersection vector :inline :offset-assert 16) @@ -18919,11 +19909,41 @@ :size-assert #xa0 :flag-assert #x9000000a0 ) -|# -#| +(define-extern nav-mesh type) ;; remove once we have this. + +(defenum nav-mesh-flag + :type uint8 + :bitfield #t + (dummy 0) + ) + (deftype nav-mesh (basic) - () + ((work nav-mesh-work :offset-assert 4) + (poly-array (inline-array nav-poly)) + (static-sphere-count uint8) + (poly-count uint8) + (nav-control-count uint8) + (max-nav-control-count uint8) + (route uint32) + (poly-hash basic) + (nav-control-array uint32) + (sphere-hash basic) + (static-sphere uint32 :offset-assert 32) + (user-list basic) + (next-nav-mesh basic) + (prev-nav-mesh basic) + (bounds sphere :inline :offset-assert 48) + (origin vector :inline :offset 48) + (entity entity) + (link-array uint32) + (link-count uint8) + (flags nav-mesh-flag) + (pad1 uint8 2) + (nearest-y-threshold meters :offset-assert 76) + (water-max-height meters) + (pad2 uint32 7) + ) :method-count-assert 47 :size-assert #x70 :flag-assert #x2f00000070 @@ -18936,7 +19956,7 @@ (nav-mesh-method-13 () none 13) ;; (initialize-mesh! (_type_) none 13) (nav-mesh-method-14 () none 14) ;; (move-along-nav-ray! (_type_ nav-ray) none 14) (nav-mesh-method-15 () none 15) ;; (try-move-along-ray (_type_ nav-poly vector vector float) meters 15) - (nav-mesh-method-16 () none 16) ;; (TODO-RENAME-16 (_type_ vector nav-poly vector symbol float clip-travel-vector-to-mesh-return-info) none 16) + (move-along-nav-ray! (_type_ nav-ray) none 16) ;; (TODO-RENAME-16 (_type_ vector nav-poly vector symbol float clip-travel-vector-to-mesh-return-info) none 16) (nav-mesh-method-17 () none 17) ;; (update-route-table (_type_) none 17) (nav-mesh-method-18 () none 18) ;; (dummy-18 (_type_ int vector int (pointer int8) int) none 18) (nav-mesh-method-19 () none 19) ;; (compute-bounding-box (_type_ vector vector) none 19) @@ -18957,11 +19977,11 @@ (nav-mesh-method-34 () none 34) (nav-mesh-method-35 () none 35) (nav-mesh-method-36 () none 36) - (nav-mesh-method-37 () none 37) + (point-in-poly? (_type_ nav-poly vector) symbol 37) (nav-mesh-method-38 () none 38) - (nav-mesh-method-39 () none 39) + (closest-point-on-boundary (_type_ nav-poly vector vector) none 39) (nav-mesh-method-40 () none 40) - (nav-mesh-method-41 () none 41) + (project-point-into-poly-2d (_type_ nav-poly vector vector) none 41) (nav-mesh-method-42 () none 42) (nav-mesh-method-43 () none 43) (nav-mesh-method-44 () none 44) @@ -18969,20 +19989,19 @@ (nav-mesh-method-46 () none 46) ) ) -|# -;; (define-extern vector-normalize-unity! function) -;; (define-extern vector-normalize-unity-copy! function) -;; (define-extern debug-validate-current-poly function) -;; (define-extern init-ray function) ;; (function nav-ray symbol) -;; (define-extern point-poly-intersection? function) -;; (define-extern nav-sphere-from-cam function) ;; (function none) + +(define-extern vector-normalize-unity! (function vector vector)) +(define-extern vector-normalize-unity-copy! (function vector vector vector)) +(define-extern debug-validate-current-poly (function symbol)) +(define-extern init-ray (function nav-ray none)) +(define-extern point-poly-intersection? (function nav-mesh vector int (inline-array vector) symbol)) +(define-extern nav-sphere-from-cam (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nav-control-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype check-vector-collision-with-nav-spheres-info (structure) ((u float :offset-assert 0) (intersect vector :inline :offset-assert 16) @@ -18992,9 +20011,7 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype nav-gap-info (structure) ((dest vector :inline :offset-assert 0) (poly nav-poly :offset-assert 16) @@ -19003,14 +20020,12 @@ :size-assert #x14 :flag-assert #x900000014 ) -|# -#| (deftype nav-avoid-spheres-params (structure) ((current-pos vector :inline :offset-assert 0) (travel vector :inline :offset-assert 16) (pref-dir vector :inline :offset-assert 32) - (out-travel UNKNOWN 2 :offset-assert 48) + (out-travel vector 2 :inline :offset-assert 48) (closest-sphere-dist2 float :offset-assert 80) (avoiding-sphere? basic :offset-assert 84) ) @@ -19018,22 +20033,60 @@ :size-assert #x58 :flag-assert #x900000058 ) -|# -#| (deftype nav-callback-info (structure) ((callback-count int32 :offset-assert 0) - (callback-array UNKNOWN 10 :offset-assert 4) + (callback-array uint32 10 :offset-assert 4) ) :method-count-assert 9 :size-assert #x2c :flag-assert #x90000002c ) -|# -#| +(defenum nav-state-flag + :type uint32 + :bitfield #t + + (display-marks 0) ;; 1 + (recovery-mode 1) ;; 2 + (initialized 2) ;; 4 + (debug 3) ;; 8 + (directional-mode 4) ;; 16 + (trapped-by-sphere 5) ;; 32 + (target-poly-dirty 6) ;; 64 + (blocked 7) ;; 128 + (in-target-poly 8) ;; 256 + (at-target 9) ;; 512 + (target-inside 10) ;; 1024 + (in-mesh 11) ;; 2048 + (avoiding-sphere 12) ;; 4096 + (touching-sphere 13) ;; 8192 + (at-gap 14) ;; 16384 + ) + (deftype nav-state (structure) - () + ((flags nav-state-flag) + (nav basic) ;; ?? + (user-poly nav-poly) + (mesh nav-mesh) + (current-poly nav-poly) + (virtual-current-poly nav-poly) + (next-poly nav-poly) + (target-poly nav-poly) + (rotation-rate float :offset-assert 32) + (speed meters) + (prev-speed meters) + (pad0 uint32 1) + (travel vector :inline :offset-assert 48) + (target-post vector :inline) + (current-pos vector :inline) + (current-pos-local vector :inline) + (virtual-current-pos-local vector :inline) + (velocity vector :inline :offset-assert 128) + (heading vector :inline) + (target-dir vector :inline :offset-assert 160) + (accel vector :inline :offset 160) + ) :method-count-assert 55 :size-assert #xb0 :flag-assert #x37000000b0 @@ -19087,11 +20140,45 @@ (nav-state-method-54 () none 54) ) ) -|# -#| +(defenum nav-control-flag + :type uint32 + :bitfield #t + (display-marks 0) ;; 1 + (debug 1) ;; 2 + (no-redirect-in-clamp 2) ;; 4 + (limit-rotation-rate 3) ;; 8 + (update-heading-from-facing 4) ;; 16 + (use-momentum 5) ;; 32 + (momentum-ignore-heading 6) ;; 64 + (output-sphere-hash 7) ;; 128 + (kernel-run 8) ;; 256 + ) + (deftype nav-control (structure) - () + ((flags nav-control-flag) + (callback-info nav-callback-info) + (process process) + (pad0 uint32) + (shape basic) + (nearest-y-threshold meters) + (nav-cull-radius meters) + (sec-per-frame float) + (target-speed meters) + (acceleration meters) + (turning-acceleration meters) + (max-rotation-rate float) + (speed-scale float) + (sphere-count int32) + (sphere-array (inline-array sphere)) ;; guess + (root-sphere-id uint8) + (sphere-mask uint8) + (pad1 uint8 2) + (sphere-id-array uint8 16) + (extra-nav-sphere vector :inline) + (root-nav-sphere vector :inline) + (state nav-state :inline) + ) :method-count-assert 47 :size-assert #x120 :flag-assert #x2f00000120 @@ -19138,40 +20225,37 @@ (nav-control-method-46 () none 46) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; spatial-hash-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (deftype grid-hash-word (uint8) -;; () -;; :flag-assert #x900000001 -;; ) +(deftype grid-hash-word (uint8) + () + :flag-assert #x900000001 + ) -#| (deftype grid-hash-box (structure) - ((min UNKNOWN 3 :offset-assert 0) - (max UNKNOWN 3 :offset-assert 3) + ((min uint8 3 :offset-assert 0) + (max uint8 3 :offset-assert 3) ) + :pack-me :method-count-assert 9 :size-assert #x6 :flag-assert #x900000006 ) -|# -#| (deftype grid-hash (basic) ((work basic :offset-assert 4) (search-box grid-hash-box :inline :offset-assert 8) (bucket-size int16 :offset-assert 14) - (axis-scale UNKNOWN 3 :offset-assert 16) - (dimension-array UNKNOWN 3 :offset-assert 28) + (axis-scale uint32 3 :offset-assert 16) + (dimension-array uint8 3 :offset-assert 28) (vertical-cell-count int8 :offset-assert 31) (bucket-array uint32 :offset-assert 32) - (box-min UNKNOWN 3 :offset-assert 36) - (box-max UNKNOWN 3 :offset-assert 48) + (box-min uint32 3 :offset-assert 36) + (box-max uint32 3 :offset-assert 48) (object-count int16 :offset-assert 60) (bucket-count int16 :offset-assert 62) (min-cell-size float :offset-assert 64) @@ -19203,9 +20287,7 @@ (grid-hash-method-24 () none 24) ) ) -|# -#| (deftype find-nav-sphere-ids-params (structure) ((bsphere sphere :inline :offset-assert 0) (y-threshold float :offset-assert 16) @@ -19218,9 +20300,7 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype sphere-hash (grid-hash) ((sphere-array uint32 :offset-assert 88) (max-object-count int16 :offset-assert 92) @@ -19243,9 +20323,7 @@ (sphere-hash-method-33 () none 33) ) ) -|# -#| (deftype hash-object-info (structure) ((object basic :offset-assert 0) ) @@ -19253,9 +20331,7 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype spatial-hash (sphere-hash) ((object-array uint32 :offset-assert 104) (mem-object-array uint32 :offset-assert 108) @@ -19274,69 +20350,71 @@ (spatial-hash-method-40 () none 40) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; actor-hash-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *actor-list* object) -;; (define-extern *actor-list-length* object) +(define-extern *actor-list* pointer) ;; some array of something. +(define-extern *actor-list-length* int) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; load-dgo ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(defenum load-msg-result + :type uint16 + :bitfield #f + (done 0) + (error 1) + (more 2) + (aborted 3) + (invalid 666) + ) + (deftype load-dgo-msg (structure) ((rsvd uint16 :offset-assert 0) - (result uint16 :offset-assert 2) ;; load-msg-result + (result load-msg-result :offset-assert 2) (b1 pointer :offset-assert 4) ;; guessed by decompiler (b2 pointer :offset-assert 8) ;; guessed by decompiler (bt pointer :offset-assert 12) ;; guessed by decompiler (name uint128 :offset-assert 16) - (address uint32 :offset-assert 4) + (address uint32 :offset 4) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype load-chunk-msg (structure) ((rsvd uint16 :offset-assert 0) - (result uint16 :offset-assert 2) ;; load-msg-result + (result load-msg-result :offset-assert 2) (address pointer :offset-assert 4) ;; guessed by decompiler (section uint32 :offset-assert 8) (maxlen uint32 :offset-assert 12) - (dummy UNKNOWN 4 :offset-assert 16) + (dummy uint32 4 :offset-assert 16) (basename sound-stream-name :inline :offset-assert 32) ;; uint8 48 ) :method-count-assert 9 :size-assert #x50 :flag-assert #x900000050 ) -|# -#| (deftype play-chunk-msg (structure) ((rsvd uint16 :offset-assert 0) (result uint16 :offset-assert 2) - (address uint32 :offset-assert 4) + (address pointer :offset-assert 4) (section uint32 :offset-assert 8) (maxlen uint32 :offset-assert 12) - (id UNKNOWN 4 :offset-assert 16) - (basename UNKNOWN 4 :offset-assert 32) + (id uint32 4 :offset-assert 16) + (basename sound-stream-name 4 :inline :offset-assert 32) ) :method-count-assert 9 :size-assert #xe0 :flag-assert #x9000000e0 ) -|# -#| (deftype dgo-header (structure) ((length uint32 :offset-assert 0) (rootname uint8 60 :offset-assert 4) ;; guessed by decompiler @@ -19345,31 +20423,30 @@ :size-assert #x40 :flag-assert #x900000040 ) -|# -;; (define-extern *load-dgo-rpc* object) ;; rpc-buffer-pair -;; (define-extern *load-str-rpc* object) ;; rpc-buffer-pair -;; (define-extern *play-str-rpc* object) ;; rpc-buffer-pair -;; (define-extern *load-str-lock* object) ;; symbol -;; (define-extern *que-str-lock* object) ;; symbol -;; (define-extern *dgo-name* object) ;; string -;; (define-extern str-load function) ;; (function string int pointer int symbol) -;; (define-extern str-load-status function) ;; (function (pointer int32) symbol) -;; (define-extern str-load-cancel function) ;; (function none) -;; (define-extern str-play-async function) ;; (function string sound-id none) -;; (define-extern str-play-stop function) ;; (function string none) -;; (define-extern str-play-queue function) ;; (function string none) -;; (define-extern str-ambient-play function) ;; (function string none) -;; (define-extern str-ambient-stop function) ;; (function string none) -;; (define-extern str-play-kick function) ;; (function none) -;; (define-extern *dgo-time* object) ;; time-frame -;; (define-extern dgo-load-begin function) ;; (function string pointer pointer pointer load-dgo-msg) -;; (define-extern dgo-load-get-next function) ;; (function (pointer symbol) pointer) -;; (define-extern dgo-load-continue function) ;; (function pointer int) -;; (define-extern dgo-load-cancel function) ;; (function none) -;; (define-extern find-temp-buffer function) ;; (function int pointer) -;; (define-extern dgo-load-link function) ;; (function dgo-header kheap symbol symbol symbol) -;; (define-extern destroy-mem function) ;; (function (pointer uint32) (pointer uint32) none) +(define-extern *load-dgo-rpc* rpc-buffer-pair) +(define-extern *load-str-rpc* rpc-buffer-pair) +(define-extern *play-str-rpc* rpc-buffer-pair) +(define-extern *load-str-lock* symbol) +(define-extern *que-str-lock* symbol) +(define-extern *dgo-name* string) +(define-extern str-load (function string int pointer int symbol)) +(define-extern str-load-status (function (pointer int32) symbol)) +(define-extern str-load-cancel (function none)) +(define-extern str-play-async (function string sound-id none)) +(define-extern str-play-stop (function string sound-id none)) +(define-extern str-play-queue (function string string string string (pointer uint32) pointer none)) +(define-extern str-ambient-play (function string none)) +(define-extern str-ambient-stop (function string none)) +(define-extern str-play-kick (function none)) ;; +(define-extern *dgo-time* time-frame) +(define-extern dgo-load-begin (function string pointer pointer pointer load-dgo-msg)) +(define-extern dgo-load-get-next (function (pointer symbol) pointer)) +(define-extern dgo-load-continue (function pointer pointer pointer load-dgo-msg)) +(define-extern dgo-load-cancel (function none)) +(define-extern find-temp-buffer (function int pointer)) +(define-extern dgo-load-link (function dgo-header kheap uint symbol symbol symbol)) +(define-extern destroy-mem (function (pointer uint32) (pointer uint32) none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ramdisk ;; @@ -19455,7 +20532,7 @@ ;; (define-extern current-str-pos function) ;; (function sound-id int) ;; (define-extern is-ramdisk-loaded? function) ;; (define-extern is-cd-in? function) ;; (function symbol) -;; (define-extern new-sound-id function) ;; (function sound-id) +(define-extern new-sound-id (function sound-id)) ;; (define-extern check-irx-version function) ;; (function int) ;; (define-extern sound-bank-iop-store function) ;; (define-extern sound-bank-iop-free function) @@ -19471,32 +20548,32 @@ ;; (define-extern sound-command->string function) ;; (function sound-command string) ;; (define-extern sound-buffer-dump function) ;; (function int) ;; (define-extern *sound-player-enable* object) ;; symbol -;; (define-extern swap-sound-buffers function) ;; (function vector vector float int) +(define-extern swap-sound-buffers (function vector vector float int)) ;; (define-extern get-sound-buffer-entry function) ;; (function pointer) ;; (define-extern free-last-sound-buffer-entry function) ;; (function int) ;; (define-extern sound-basic-cb function) ;; (function int (pointer int32) none) ;; (define-extern sound-trans-convert function) ;; (function vector3w vector int) ;; (define-extern sound-angle-convert function) ;; (function float int) -;; (define-extern string->sound-name function) ;; (function string sound-name) +(define-extern string->sound-name (function string sound-name)) ;; (define-extern sound-set-volume function) ;; (function sound-group float int) ;; (define-extern sound-set-reverb function) ;; (function int float float uint int) ;; (define-extern sound-set-ear-trans function) ;; (function vector vector float int) ;; (define-extern sound-play-by-name function) ;; (function sound-name sound-id int int int sound-group symbol sound-id) -;; (define-extern sound-play-by-spec function) ;; (function sound-spec sound-id vector sound-id) +(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id)) ;; (define-extern sound-pause function) ;; (function sound-id int) ;; (define-extern sound-stop function) ;; (function sound-id int) ;; (define-extern sound-continue function) ;; (function sound-id int) -;; (define-extern sound-group-pause function) ;; (function sound-group int) +(define-extern sound-group-pause (function sound-group int)) ;; (define-extern sound-group-stop function) ;; (function sound-group int) -;; (define-extern sound-group-continue function) ;; (function sound-group int) +(define-extern sound-group-continue (function sound-group int)) ;; (define-extern sound-set-flava function) ;; (function uint int) ;; (define-extern sound-set-midi-reg function) ;; (define-extern sound-set-fps function) ;; (function int int) ;; (define-extern sound-volume-off function) ;; (function int) ;; (define-extern *ambient-spec* sound-spec) ;; sound-spec -;; (define-extern show-iop-info function) ;; (function dma-buffer int) -;; (define-extern show-iop-memory function) ;; (function dma-buffer int) -;; (define-extern ear-trans function) ;; (function vector) +(define-extern show-iop-info (function dma-buffer int)) +(define-extern show-iop-memory (function dma-buffer int)) +(define-extern ear-trans (function vector)) ;; (define-extern make-sqrt-table function) ;; (function int) ;; (define-extern loader-test-command function) ;; (define-extern doppler-pitch-shift function) @@ -19507,11 +20584,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern transformq-copy! function) ;; (function transformq transformq transformq) -;; (define-extern matrix<-transformq! function) ;; (function matrix transformq matrix) +(define-extern matrix<-transformq! (function matrix transformq matrix)) ;; (define-extern matrix<-no-trans-transformq! function) ;; (function matrix transformq matrix) ;; (define-extern matrix<-transformq+trans! function) ;; (function matrix transformq vector matrix) ;; (define-extern matrix<-transformq+world-trans! function) ;; (function matrix transformq vector matrix) -;; (define-extern matrix<-parented-transformq! function) ;; (function matrix transformq vector matrix) +(define-extern matrix<-parented-transformq! (function matrix transformq vector matrix)) ;; (define-extern matrix<-transformq+rot-offset! function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -19553,7 +20630,7 @@ ;; (define-extern cspace<-parent-joint! function) ;; (define-extern cspace<-rot-yxy! function) ;; (function cspace transform matrix) ;; (define-extern cspace<-transform-yxy! function) ;; (function cspace transform matrix) -;; (define-extern cspace<-transformq! function) ;; (function cspace transformq matrix) +(define-extern cspace<-transformq! (function cspace transformq matrix)) ;; (define-extern cspace<-transformq+trans! function) ;; (function cspace transformq vector matrix) ;; (define-extern cspace<-transformq+world-trans! function) ;; (function cspace transformq vector matrix) ;; (define-extern cspace<-transformq+rot-offset! function) @@ -19564,7 +20641,7 @@ ;; (define-extern cspace<-parented-matrix-mirror! function) ;; (define-extern cspace<-parented-matrix-joint-flip-z! function) ;; (define-extern cspace<-matrix-joint-flip-z! function) -;; (define-extern cspace<-parented-transformq-joint! function) ;; (function cspace transformq none) +(define-extern cspace<-parented-transformq-joint! (function cspace transformq none)) ;; (define-extern cspace<-parented-transformq-joint-flip-z! function) ;; (define-extern clear-frame-accumulator function) ;; (function (inline-array vector) none) ;; (define-extern normalize-frame-quaternions function) ;; function @@ -19575,7 +20652,7 @@ ;; (define-extern calc-animation-from-spr function) ;; (function (inline-array vector) int none) ;; (define-extern create-interpolated-joint-animation-frame function) ;; (function (inline-array vector) int process-drawable int) ;; (define-extern create-interpolated2-joint-animation-frame function) -;; (define-extern *anim-manager* object) +(define-extern *anim-manager* art-joint-anim-manager) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; joint-mod ;; @@ -19633,13 +20710,13 @@ ;; wind-work ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *wind-work* wind-work) ;; wind-work +(define-extern *wind-work* wind-work) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; wind ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern update-wind function) ;; (function wind-work (array uint8) none) +(define-extern update-wind (function wind-work (array uint8) none)) ;; (define-extern wind-get-hashed-index function) ;; (function vector int) ;; (define-extern level-update-wind function) @@ -19650,9 +20727,9 @@ ;; (define-extern mem-usage-bsp-tree function) ;; (function bsp-header bsp-node memory-usage-block int none) ;; (define-extern *test-shrub* object) ;; int ;; (define-extern bsp-camera-asm function) ;; (function bsp-header vector none) -;; (define-extern print-collide-stats function) ;; (function none) +(define-extern print-collide-stats (function none)) ;; (define-extern level-remap-texture function) ;; (function texture-id texture-id) -;; (define-extern build-masks function) +(define-extern build-masks (function bsp-header none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; subdivide ;; @@ -19664,9 +20741,9 @@ ;; (define-extern *stat-string-tfrag-scissor* object) ;; (define-extern *stat-string-total* object) ;; string ;; (define-extern print-tr-stat function) ;; (function tr-stat string string none) -;; (define-extern print-terrain-stats function) ;; (function none) +(define-extern print-terrain-stats (function none)) ;; (define-extern update-subdivide-settings! function) ;; (function subdivide-settings math-camera int none) -;; (define-extern *subdivide-settings* object) ;; subdivide-settings +(define-extern *subdivide-settings* subdivide-settings) ;; (define-extern set-tfrag-dists! function) ;; (function tfrag-dists none) ;; (define-extern *terrain-context* object) ;; terrain-context ;; (define-extern GSH_ENABLE object) ;; symbol @@ -19674,11 +20751,11 @@ ;; (define-extern GSH_WHICH_STAT object) ;; int ;; (define-extern GSH_MAX_DISPLAY object) ;; basic ;; (define-extern GSH_TIME object) ;; int -;; (define-extern *perf-stats* object) ;; perf-stat-array +(define-extern *perf-stats* perf-stat-array) ;; (define-extern *gomi-stats-hack* object) ;; (inline-array perf-stat) -;; (define-extern start-perf-stat-collection function) ;; (function none) -;; (define-extern end-perf-stat-collection function) ;; (function none) -;; (define-extern print-perf-stats function) ;; (function none) +(define-extern start-perf-stat-collection (function none)) +(define-extern end-perf-stat-collection (function none)) +(define-extern print-perf-stats (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sprite ;; @@ -19807,7 +20884,7 @@ ;; (define-extern sprite-add-2d-all function) ;; (function sprite-array-2d dma-buffer int none) ;; (define-extern sprite-add-3d-chunk function) ;; (function sprite-array-3d int int dma-buffer none) ;; (define-extern sprite-add-3d-all function) ;; (function sprite-array-3d dma-buffer int none) -;; (define-extern sprite-draw function) ;; (function display none) +(define-extern sprite-draw (function display none)) ;; (define-extern sprite-allocate-user-hvdf function) ;; (function int) ;; (define-extern sprite-release-user-hvdf function) ;; (function int none) ;; (define-extern sprite-get-user-hvdf function) ;; (function int vector) @@ -20056,22 +21133,22 @@ ;; (define-extern get-debug-line function) ;; (function debug-line) ;; (define-extern get-debug-text-3d function) ;; (function debug-text-3d) ;; (define-extern debug-reset-buffers function) ;; (function symbol) -;; (define-extern debug-draw-buffers function) ;; (function symbol) -;; (define-extern add-debug-line function) ;; (function symbol bucket-id vector vector rgba symbol rgba symbol) +(define-extern debug-draw-buffers (function symbol)) +(define-extern add-debug-line (function symbol bucket-id vector vector rgba symbol rgba symbol)) ;; (define-extern add-debug-line2d function) ;; (function symbol bucket-id vector vector vector symbol) ;; (define-extern add-debug-box function) ;; (function symbol bucket-id vector vector rgba symbol) ;; (define-extern add-debug-box-with-transform function) ;; (define-extern add-debug-x function) ;; (function symbol bucket-id vector rgba symbol) ;; (define-extern add-debug-cross function) -;; (define-extern add-debug-text-3d function) ;; (function symbol bucket-id string vector font-color vector2h symbol) +(define-extern add-debug-text-3d (function symbol bucket-id string vector font-color vector2h symbol)) ;; (define-extern add-debug-sphere-with-transform function) ;; (function symbol bucket-id vector meters matrix rgba symbol) -;; (define-extern add-debug-sphere function) ;; (function symbol bucket-id vector float rgba symbol) +(define-extern add-debug-sphere (function symbol bucket-id vector float rgba symbol)) ;; (define-extern add-debug-text-sphere function) ;; (function symbol bucket-id vector float string rgba symbol) ;; (define-extern add-debug-spheres function) ;; (function symbol bucket-id (inline-array vector) int rgba symbol) ;; (define-extern add-debug-line-sphere function) ;; (define-extern add-debug-circle function) ;; (function symbol bucket-id vector float rgba matrix symbol) ;; (define-extern add-debug-vector function) ;; (function symbol bucket-id vector vector meters rgba symbol) -;; (define-extern add-debug-matrix function) ;; (function symbol bucket-id matrix matrix) +(define-extern add-debug-matrix (function symbol bucket-id matrix float matrix)) ;; (define-extern add-debug-rot-matrix function) ;; (function symbol bucket-id matrix vector matrix) ;; (define-extern add-debug-quaternion function) ;; (define-extern add-debug-cspace function) @@ -20088,7 +21165,7 @@ ;; (define-extern history-init function) ;; (function pos-history int pos-history) ;; (define-extern history-draw-and-update function) ;; (function pos-history int vector symbol) ;; (define-extern dma-timeout-cam function) ;; (function vector) -;; (define-extern display-file-info function) ;; (function int) +(define-extern display-file-info (function int)) (define-extern add-debug-cursor (function symbol bucket-id int int int none)) ;; (define-extern *boundary-polygon* object) ;; (inline-array lbvtx) ;; (define-extern init-boundary-regs function) ;; (function none) @@ -20253,11 +21330,11 @@ ;; (define-extern *stats-blerc* object) ;; symbol ;; (define-extern *blerc-globals* object) ;; blerc-globals ;; (define-extern blerc-stats-init function) ;; (function none) -;; (define-extern blerc-init function) ;; (function none) +(define-extern blerc-init (function none)) ;; ;; (define-extern blerc-a-fragment function) ;; function ;; (define-extern dma-from-spr function) ;; function ;; (define-extern merc-dma-chain-to-spr function) ;; function -;; (define-extern blerc-execute function) ;; (function none) +(define-extern blerc-execute (function none)) ;; (define-extern merc-blend-shape function) ;; (function process-drawable object) ;; (define-extern setup-blerc-chains-for-one-fragment function) ;; (function object object object object object object object) ;; (define-extern setup-blerc-chains function) ;; (function merc-ctrl (pointer int16) dma-buffer none) @@ -20353,7 +21430,7 @@ ;; (define-extern ripple-execute-init function) ;; (function none) ;; (define-extern ripple-create-wave-table function) ;; (function ripple-wave-set int) ;; (define-extern ripple-apply-wave-table function) ;; (function merc-effect symbol) -;; (define-extern ripple-execute function) ;; (function none) +(define-extern ripple-execute (function none)) ;; (define-extern ripple-matrix-scale function) ;; function ;; (define-extern ripple-add-debug-sphere function) ;; (function process-drawable vector float float none) ;; (define-extern ripple-slow-add-sine-waves function) ;; (function ripple-wave-set float float float) @@ -20379,9 +21456,9 @@ ;; (define-extern bones-vu0-block object) ;; vu-function ;; (define-extern bones-set-sqwc function) ;; (function none) ;; (define-extern bones-reset-sqwc function) ;; (function none) -;; (define-extern bones-init function) ;; (function dma-buffer dma-foreground-sink-group none) +(define-extern bones-init (function dma-buffer none)) ;; (define-extern bones-mtx-calc function) ;; (function int pointer pointer int object none) -;; (define-extern bones-mtx-calc-execute function) ;; (function none) +(define-extern bones-mtx-calc-execute (function none)) ;; (define-extern dump-qword function) ;; (function qword none) ;; (define-extern dump-mem function) ;; (function pointer int none) ;; (define-extern bones-debug function) ;; (function none) @@ -20406,12 +21483,12 @@ ;; (define-extern vu1-bucket-map function) ;; (define-extern generic-bucket-state-init function) ;; (define-extern mercneric-chain-init function) -;; (define-extern foreground-init function) +(define-extern foreground-init (function none)) ;; (define-extern texscroll-make-request function) ;; (function merc-effect none) -;; (define-extern texscroll-execute function) ;; (function none) -;; (define-extern vu-lights<-light-group! function) ;; (function vu-lights light-group none) +(define-extern texscroll-execute (function none)) +(define-extern vu-lights<-light-group! (function vu-lights light-group none)) ;; (define-extern foreground-add-mtx-calc function) -;; (define-extern foreground-wrapup function) +(define-extern foreground-wrapup (function none)) ;; (define-extern *default-shadow-settings* object) ;; shadow-settings ;; (define-extern foreground-shadow function) ;; (define-extern foreground-generic-merc-death function) @@ -20423,7 +21500,7 @@ ;; (define-extern foreground-ripple function) ;; (define-extern foreground-draw function) ;; (define-extern foreground-draw-hud function) -;; (define-extern *foreground-draw-engine* object) +(define-extern *foreground-draw-engine* engine) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-vu0 ;; @@ -20512,7 +21589,7 @@ ;; (define-extern generic-merc-death function) ;; (define-extern generic-merc-execute-asm function) ;; (function none) ;; (define-extern generic-merc-do-chain function) -;; (define-extern generic-merc-execute-all function) ;; (function dma-buffer none) +(define-extern generic-merc-execute-all (function dma-buffer none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; generic-tie ;; @@ -20613,7 +21690,7 @@ ;; (define-extern debug-draw-settings function) ;; (define-extern shadow-execute function) ;; (function shadow-dma-packet pointer pointer) ;; (define-extern shadow-vu0-upload function) ;; (function none) -;; (define-extern shadow-execute-all function) ;; (function dma-buffer shadow-queue none) +(define-extern shadow-execute-all (function dma-buffer none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; shadow-vu1 ;; @@ -20727,15 +21804,15 @@ ;; texture-anim-tables ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *sky-texture-anim-array* texture-anim-array) +(define-extern *sky-texture-anim-array* texture-anim-array) ;; (define-extern set-fog-height! function) ;; (define-extern set-cloud-minmax! function) -;; (define-extern *darkjak-texture-anim-array* texture-anim-array) +(define-extern *darkjak-texture-anim-array* texture-anim-array) ;; (define-extern set-darkjak-texture-morph! function) -;; (define-extern *skull-gem-texture-anim-array* texture-anim-array) -;; (define-extern *waterfall-texture-anim-array* texture-anim-array) -;; (define-extern *waterfall-b-texture-anim-array* texture-anim-array) -;; (define-extern *bomb-texture-anim-array* texture-anim-array) +(define-extern *skull-gem-texture-anim-array* texture-anim-array) +(define-extern *waterfall-texture-anim-array* texture-anim-array) +(define-extern *waterfall-b-texture-anim-array* texture-anim-array) +(define-extern *bomb-texture-anim-array* texture-anim-array) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; blit-displays ;; @@ -20746,8 +21823,8 @@ ;; (define-extern blur-disp function) ;; (define-extern filter-disp function) ;; (define-extern hflip-disp function) -;; (define-extern blit-displays function) -;; (define-extern draw-color-bars function) +(define-extern blit-displays (function none)) +(define-extern draw-color-bars (function none)) ;; (define-extern draw-raw-image function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -20765,7 +21842,7 @@ ;; (define-extern draw-string-asm function) ;; (define-extern draw-string function) ;; (function string dma-buffer font-context float) ;; (define-extern get-string-length function) ;; (function string font-context float) -;; (define-extern draw-string-xy function) ;; (function string dma-buffer int int font-color font-flags float) +(define-extern draw-string-xy (function string dma-buffer int int font-color font-flags float)) ;; (define-extern draw-string-adv function) ;; (function string dma-buffer font-context none) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -20792,15 +21869,15 @@ ;; background ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *background-work* object) ;; background-work +(define-extern *background-work* background-work) ;; (define-extern background-vu0-block object) ;; vu-function ;; (define-extern background-upload-vu0 function) ;; (function none) -;; (define-extern init-background function) ;; (function none) +(define-extern init-background (function none)) ;; (define-extern upload-vis-bits function) ;; (function level level bsp-header none) ;; (define-extern set-background-regs! function) ;; (define-extern set-tie-quard-planes! function) ;; (define-extern set-shrub-quard-planes! function) -;; (define-extern finish-background function) ;; (function none) +(define-extern finish-background (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; draw-node ;; @@ -21280,7 +22357,7 @@ ;; (define-extern *sp-temp* object) ;; (define-extern lookup-part-group-by-name function) ;; (function string basic) ;; (define-extern lookup-part-group-pointer-by-name function) ;; (function string (pointer sparticle-launch-group)) -;; (define-extern part-group-pointer? function) ;; (function pointer symbol) +(define-extern part-group-pointer? (function pointer symbol)) ;; (define-extern unlink-part-group-by-heap function) ;; (function kheap int) ;; (define-extern sp-init-fields! function) ;; (function object (inline-array sp-field-init-spec) sp-field-id sp-field-id symbol object) ;; (define-extern *sp-launcher-lock* object) ;; symbol @@ -21302,7 +22379,7 @@ ;; (define-extern sp-relaunch-setup-fields function) ;; (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none) ;; (define-extern sp-relaunch-particle-2d function) ;; (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none) ;; (define-extern sp-relaunch-particle-3d function) ;; (function object sparticle-launcher sparticle-cpuinfo sprite-vec-data-3d none) -;; (define-extern execute-part-engine function) +(define-extern execute-part-engine (function none)) ;; (define-extern sparticle-track-root function) ;; (function object sparticle-cpuinfo vector none) ;; (define-extern sparticle-track-root-prim function) ;; (function object sparticle-cpuinfo vector none) ;; (define-extern sparticle-track-joint function) @@ -21367,13 +22444,12 @@ ;; (define-extern kill-all-particles-with-key function) ;; (function sparticle-launch-control none) ;; (define-extern forall-particles-runner function) ;; (function (function sparticle-system sparticle-cpuinfo pointer none) sparticle-system none) ;; (define-extern forall-particles function) ;; (function function symbol symbol none) -;; (define-extern kill-all-particles-in-level function) ;; (function level int) +(define-extern kill-all-particles-in-level (function level int)) ;; (define-extern all-particles-50-to-60 function) ;; (function none) ;; (define-extern all-particles-60-to-50 function) ;; (function none) ;; (define-extern remap-particle function) ;; (define-extern remap-all-particles function) -;; (define-extern process-particles function) ;; (function none) - +(define-extern process-particles (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; entity-table ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -21430,8 +22506,8 @@ ;; (define-extern *preload-spool-anims* object) ;; symbol ;; (define-extern ja-play-spooled-anim function) ;; (function spool-anim art-joint-anim art-joint-anim (function process-drawable symbol) int :behavior process-drawable) ;; (define-extern ja-abort-spooled-anim function) ;; (function spool-anim art-joint-anim int int :behavior process-drawable) -;; (define-extern *gui-control* object) -;; (define-extern *art-control* object) ;; external-art-control +(define-extern *gui-control* gui-control) +(define-extern *art-control* external-art-control) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; game-info ;; @@ -21441,7 +22517,7 @@ ;; (define-extern task-level->string function) ;; (define-extern level-name->task-level function) ;; (define-extern trsq->continue-point function) ;; (function trsq none) -;; (define-extern position->stream function) +(define-extern position->stream (function string symbol symbol none)) ;; (define-extern bug-report-display function) ;; (define-extern print-continues function) ;; (define-extern *highscore-info-array* array) @@ -21572,15 +22648,15 @@ ;; (define-extern auto-save-post function) ;; (function none :behavior auto-save) ;; (define-extern auto-save-init-by-other function) ;; (function symbol process-tree int int none :behavior auto-save) ;; (define-extern auto-save-command function) ;; (function symbol int int process-tree none) -;; (define-extern auto-save-check function) ;; (function none) +(define-extern auto-save-check (function none)) ;; (define-extern auto-save-user function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; settings ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern get-current-language function) -;; (define-extern *setting-control* object) ;; setting-control +(define-extern get-current-language (function language-enum)) +(define-extern *setting-control* setting-control) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mood-tables ;; @@ -21617,7 +22693,7 @@ ;; (define-extern *mood-sky-table* object) ;; (define-extern *mood-interp-table* object) ;; (define-extern init-mood-control function) -;; (define-extern *mood-control* mood-control) +(define-extern *mood-control* mood-control) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mood-tables2 ;; @@ -21730,7 +22806,7 @@ ;; (define-extern update-mood-exterior function) ;; (define-extern copy-mood-exterior function) ;; (define-extern copy-mood-exterior-ambi function) -;; (define-extern clear-mood-context function) +(define-extern clear-mood-context (function int none)) ;; (define-extern update-mood-interior function) ;; (define-extern update-mood-flames function) ;; (function mood-context int int int float float float none) ;; (define-extern *flash0* array) ;; (array float) @@ -22690,18 +23766,18 @@ ;; (define-extern time-of-day-setup function) ;; (function symbol symbol) ;; (define-extern time-of-day-interp-colors function) ;; (function (pointer rgba) uint mood-context none) ;; (define-extern time-of-day-interp-colors-scratch function) ;; (function (pointer rgba) time-of-day-palette mood-context none) -;; (define-extern init-time-of-day-context function) ;; (function time-of-day-context none) +(define-extern init-time-of-day-context (function time-of-day-context none)) ;; (define-extern set-filter-color! function) ;; (define-extern tod-madd! function) ;; (define-extern update-environment-colors function) -;; (define-extern update-time-of-day function) ;; (function time-of-day-context none) +(define-extern update-time-of-day (function time-of-day-context none)) ;; (define-extern calc-fade-from-fog function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sky-data ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *sky-work* object) ;; sky-work +(define-extern *sky-work* sky-work) ;; (define-extern sky-base-polygons object) ;; (inline-array sky-vertex) ;; (define-extern sky-roof-polygons object) ;; (inline-array sky-vertex) ;; (define-extern *cloud-vert-array* object) @@ -22731,191 +23807,193 @@ ;; (define-extern *display-load-commands* object) ;; symbol ;; (define-extern *backup-load-state* object) ;; load-state -;; (define-extern *load-state* object) ;; load-state +(define-extern *load-state* load-state) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; level-info ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *task-level* array) -;; (define-extern default-level level-load-info) ;; level-load-info -;; (define-extern intro level-load-info) ;; level-load-info -;; (define-extern demo level-load-info) ;; level-load-info -;; (define-extern title level-load-info) ;; level-load-info -;; (define-extern vinroom level-load-info) -;; (define-extern drillmid level-load-info) -;; (define-extern drill level-load-info) -;; (define-extern drillb level-load-info) -;; (define-extern drillmtn level-load-info) -;; (define-extern sewer level-load-info) -;; (define-extern sewerb level-load-info) -;; (define-extern sewesc level-load-info) -;; (define-extern sewescb level-load-info) -;; (define-extern tomba level-load-info) -;; (define-extern tombb level-load-info) -;; (define-extern tombc level-load-info) -;; (define-extern tombd level-load-info) -;; (define-extern tombe level-load-info) -;; (define-extern tombext level-load-info) -;; (define-extern tombboss level-load-info) -;; (define-extern under level-load-info) -;; (define-extern underb level-load-info) -;; (define-extern palcab level-load-info) -;; (define-extern palshaft level-load-info) -;; (define-extern palboss level-load-info) -;; (define-extern palroof level-load-info) -;; (define-extern palout level-load-info) -;; (define-extern throne level-load-info) -;; (define-extern lbrnermk level-load-info) -;; (define-extern lashthrn level-load-info) -;; (define-extern lthrnout level-load-info) -;; (define-extern palent level-load-info) -;; (define-extern prison level-load-info) -;; (define-extern ldjakbrn level-load-info) -;; (define-extern lprsncst level-load-info) -;; (define-extern forexita level-load-info) -;; (define-extern forexitb level-load-info) -;; (define-extern forresca level-load-info) -;; (define-extern forrescb level-load-info) -;; (define-extern fordumpa level-load-info) -;; (define-extern fordumpb level-load-info) -;; (define-extern fordumpc level-load-info) -;; (define-extern fordumpd level-load-info) -;; (define-extern strip level-load-info) -;; (define-extern ruins level-load-info) -;; (define-extern sagehut level-load-info) -;; (define-extern atoll level-load-info) -;; (define-extern atollext level-load-info) -;; (define-extern mountain level-load-info) -;; (define-extern mtnext level-load-info) -;; (define-extern forest level-load-info) -;; (define-extern forestb level-load-info) -;; (define-extern mincan level-load-info) -;; (define-extern ctywide level-load-info) -;; (define-extern lwidea level-load-info) -;; (define-extern lwideb level-load-info) -;; (define-extern lwidec level-load-info) -;; (define-extern ctykora level-load-info) -;; (define-extern ctyasha level-load-info) -;; (define-extern ctygena level-load-info) -;; (define-extern ctygenb level-load-info) -;; (define-extern ctygenc level-load-info) -;; (define-extern ctysluma level-load-info) -;; (define-extern ctyslumb level-load-info) -;; (define-extern ctyslumc level-load-info) -;; (define-extern ctyport level-load-info) -;; (define-extern ljkdxash level-load-info) -;; (define-extern ctyfarma level-load-info) -;; (define-extern ctyfarmb level-load-info) -;; (define-extern ctyinda level-load-info) -;; (define-extern consite level-load-info) -;; (define-extern consiteb level-load-info) -;; (define-extern ctyindb level-load-info) -;; (define-extern ctymarka level-load-info) -;; (define-extern ctymarkb level-load-info) -;; (define-extern ctypal level-load-info) -;; (define-extern stadium level-load-info) -;; (define-extern stadiumb level-load-info) -;; (define-extern stadiumc level-load-info) -;; (define-extern stadiumd level-load-info) -;; (define-extern skatea level-load-info) -;; (define-extern garage level-load-info) -;; (define-extern stadblmp level-load-info) -;; (define-extern lwidesta level-load-info) -;; (define-extern lerrol level-load-info) -;; (define-extern lkeirift level-load-info) -;; (define-extern lracelit level-load-info) -;; (define-extern lracebb level-load-info) -;; (define-extern lracebf level-load-info) -;; (define-extern lracecb level-load-info) -;; (define-extern lracecf level-load-info) -;; (define-extern lracedb level-load-info) -;; (define-extern lracedf level-load-info) -;; (define-extern lgarcsta level-load-info) -;; (define-extern lsamergd level-load-info) -;; (define-extern lerbrngd level-load-info) -;; (define-extern lsmysbrt level-load-info) -;; (define-extern lashgrd level-load-info) -;; (define-extern onintent level-load-info) -;; (define-extern ltentout level-load-info) -;; (define-extern ltentob level-load-info) -;; (define-extern kiosk level-load-info) -;; (define-extern oracle level-load-info) ;; type -;; (define-extern hideout level-load-info) -;; (define-extern ltrntess level-load-info) -;; (define-extern ltrnkrkd level-load-info) -;; (define-extern ltrnysam level-load-info) -;; (define-extern lysamsam level-load-info) -;; (define-extern lyskdcd level-load-info) -;; (define-extern lkiddoge level-load-info) -;; (define-extern lhelldog level-load-info) -;; (define-extern lpackage level-load-info) -;; (define-extern lsack level-load-info) -;; (define-extern lportrun level-load-info) -;; (define-extern lshuttle level-load-info) -;; (define-extern lmeetbrt level-load-info) -;; (define-extern lpower level-load-info) -;; (define-extern lerlchal level-load-info) -;; (define-extern lprtrace level-load-info) -;; (define-extern lbombbot level-load-info) -;; (define-extern lbbush level-load-info) -;; (define-extern lprotect level-load-info) -;; (define-extern hiphog level-load-info) -;; (define-extern ltess level-load-info) -;; (define-extern lhipout level-load-info) -;; (define-extern lwhack level-load-info) -;; (define-extern lguard level-load-info) -;; (define-extern lcguard level-load-info) -;; (define-extern lerltess level-load-info) -;; (define-extern gungame level-load-info) -;; (define-extern dig1 level-load-info) -;; (define-extern dig3a level-load-info) -;; (define-extern dig3b level-load-info) -;; (define-extern caspad level-load-info) -;; (define-extern castle level-load-info) -;; (define-extern casboss level-load-info) -;; (define-extern casext level-load-info) -;; (define-extern cascity level-load-info) -;; (define-extern village1 level-load-info) ;; level-load-info -;; (define-extern introcst level-load-info) -;; (define-extern lcitylow level-load-info) -;; (define-extern lintcstb level-load-info) -;; (define-extern ljakdax level-load-info) -;; (define-extern nest level-load-info) -;; (define-extern nestb level-load-info) -;; (define-extern outrocst level-load-info) -;; (define-extern portwall level-load-info) -;; (define-extern loutcstb level-load-info) -;; (define-extern island1 level-load-info) -;; (define-extern city-start function) -;; (define-extern skatepark level-load-info) -;; (define-extern halfpipe level-load-info) ;; level-load-info -;; (define-extern vistest level-load-info) -;; (define-extern woodstest level-load-info) -;; (define-extern tobytest level-load-info) -;; (define-extern chartest level-load-info) -;; (define-extern dptest level-load-info) -;; (define-extern ctyfence level-load-info) -;; (define-extern *level-load-list* object) ;; pair +(define-extern *task-level* array) +(define-extern default-level level-load-info) ;; level-load-info +(define-extern intro level-load-info) ;; level-load-info +(define-extern demo level-load-info) ;; level-load-info +(define-extern title level-load-info) ;; level-load-info +(define-extern vinroom level-load-info) +(define-extern drillmid level-load-info) +(define-extern drill level-load-info) +(define-extern drillb level-load-info) +(define-extern drillmtn level-load-info) +(define-extern sewer level-load-info) +(define-extern sewerb level-load-info) +(define-extern sewesc level-load-info) +(define-extern sewescb level-load-info) +(define-extern tomba level-load-info) +(define-extern tombb level-load-info) +(define-extern tombc level-load-info) +(define-extern tombd level-load-info) +(define-extern tombe level-load-info) +(define-extern tombext level-load-info) +(define-extern tombboss level-load-info) +(define-extern under level-load-info) +(define-extern underb level-load-info) +(define-extern palcab level-load-info) +(define-extern palshaft level-load-info) +(define-extern palboss level-load-info) +(define-extern palroof level-load-info) +(define-extern palout level-load-info) +(define-extern throne level-load-info) +(define-extern lbrnermk level-load-info) +(define-extern lashthrn level-load-info) +(define-extern lthrnout level-load-info) +(define-extern palent level-load-info) +(define-extern prison level-load-info) +(define-extern ldjakbrn level-load-info) +(define-extern lprsncst level-load-info) +(define-extern forexita level-load-info) +(define-extern forexitb level-load-info) +(define-extern forresca level-load-info) +(define-extern forrescb level-load-info) +(define-extern fordumpa level-load-info) +(define-extern fordumpb level-load-info) +(define-extern fordumpc level-load-info) +(define-extern fordumpd level-load-info) +(define-extern strip level-load-info) +(define-extern ruins level-load-info) +(define-extern sagehut level-load-info) +(define-extern atoll level-load-info) +(define-extern atollext level-load-info) +(define-extern mountain level-load-info) +(define-extern mtnext level-load-info) +(define-extern forest level-load-info) +(define-extern forestb level-load-info) +(define-extern mincan level-load-info) +(define-extern ctywide level-load-info) +(define-extern lwidea level-load-info) +(define-extern lwideb level-load-info) +(define-extern lwidec level-load-info) +(define-extern ctykora level-load-info) +(define-extern ctyasha level-load-info) +(define-extern ctygena level-load-info) +(define-extern ctygenb level-load-info) +(define-extern ctygenc level-load-info) +(define-extern ctysluma level-load-info) +(define-extern ctyslumb level-load-info) +(define-extern ctyslumc level-load-info) +(define-extern ctyport level-load-info) +(define-extern ljkdxash level-load-info) +(define-extern ctyfarma level-load-info) +(define-extern ctyfarmb level-load-info) +(define-extern ctyinda level-load-info) +(define-extern consite level-load-info) +(define-extern consiteb level-load-info) +(define-extern ctyindb level-load-info) +(define-extern ctymarka level-load-info) +(define-extern ctymarkb level-load-info) +(define-extern ctypal level-load-info) +(define-extern stadium level-load-info) +(define-extern stadiumb level-load-info) +(define-extern stadiumc level-load-info) +(define-extern stadiumd level-load-info) +(define-extern skatea level-load-info) +(define-extern garage level-load-info) +(define-extern stadblmp level-load-info) +(define-extern lwidesta level-load-info) +(define-extern lerrol level-load-info) +(define-extern lkeirift level-load-info) +(define-extern lracelit level-load-info) +(define-extern lracebb level-load-info) +(define-extern lracebf level-load-info) +(define-extern lracecb level-load-info) +(define-extern lracecf level-load-info) +(define-extern lracedb level-load-info) +(define-extern lracedf level-load-info) +(define-extern lgarcsta level-load-info) +(define-extern lsamergd level-load-info) +(define-extern lerbrngd level-load-info) +(define-extern lsmysbrt level-load-info) +(define-extern lashgrd level-load-info) +(define-extern onintent level-load-info) +(define-extern ltentout level-load-info) +(define-extern ltentob level-load-info) +(define-extern kiosk level-load-info) +(define-extern oracle level-load-info) ;; type +(define-extern hideout level-load-info) +(define-extern ltrntess level-load-info) +(define-extern ltrnkrkd level-load-info) +(define-extern ltrnysam level-load-info) +(define-extern lysamsam level-load-info) +(define-extern lyskdcd level-load-info) +(define-extern lkiddoge level-load-info) +(define-extern lhelldog level-load-info) +(define-extern lpackage level-load-info) +(define-extern lsack level-load-info) +(define-extern lportrun level-load-info) +(define-extern lshuttle level-load-info) +(define-extern lmeetbrt level-load-info) +(define-extern lpower level-load-info) +(define-extern lerlchal level-load-info) +(define-extern lprtrace level-load-info) +(define-extern lbombbot level-load-info) +(define-extern lbbush level-load-info) +(define-extern lprotect level-load-info) +(define-extern hiphog level-load-info) +(define-extern ltess level-load-info) +(define-extern lhipout level-load-info) +(define-extern lwhack level-load-info) +(define-extern lguard level-load-info) +(define-extern lcguard level-load-info) +(define-extern lerltess level-load-info) +(define-extern gungame level-load-info) +(define-extern dig1 level-load-info) +(define-extern dig3a level-load-info) +(define-extern dig3b level-load-info) +(define-extern caspad level-load-info) +(define-extern castle level-load-info) +(define-extern casboss level-load-info) +(define-extern casext level-load-info) +(define-extern cascity level-load-info) +(define-extern village1 level-load-info) ;; level-load-info +(define-extern introcst level-load-info) +(define-extern lcitylow level-load-info) +(define-extern lintcstb level-load-info) +(define-extern ljakdax level-load-info) +(define-extern nest level-load-info) +(define-extern nestb level-load-info) +(define-extern outrocst level-load-info) +(define-extern portwall level-load-info) +(define-extern loutcstb level-load-info) +(define-extern island1 level-load-info) +(define-extern city-start (function none)) +(define-extern skatepark level-load-info) +(define-extern halfpipe level-load-info) ;; level-load-info +(define-extern vistest level-load-info) +(define-extern woodstest level-load-info) +(define-extern tobytest level-load-info) +(define-extern chartest level-load-info) +(define-extern dptest level-load-info) +(define-extern ctyfence level-load-info) +(define-extern *level-load-list* pair) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; level ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern lookup-level-info function) ;; (function symbol level-load-info) -;; (define-extern remap-level-name function) ;; (function level-load-info symbol) -;; (define-extern add-bsp-drawable function) ;; (function bsp-header level symbol display-frame none) -;; (define-extern *login-state* object) ;; login-state -;; (define-extern *print-login* object) ;; symbol -;; (define-extern load-buffer-resize function) -;; (define-extern level-update-after-load function) ;; (function level login-state level) +(define-extern lookup-level-info (function symbol level-load-info)) +(define-extern remap-level-name (function level-load-info symbol)) +(define-extern add-bsp-drawable (function bsp-header level symbol display-frame none)) +(define-extern *login-state* login-state) +(define-extern *print-login* symbol) +(define-extern load-buffer-resize (function level pointer none)) +(define-extern level-update-after-load (function level login-state level)) (define-extern bg (function symbol int)) (define-extern play (function symbol symbol int)) (define-extern play-boot (function none)) ;; (define-extern update-sound-banks function) ;; (function int) -;; (define-extern show-level function) ;; (function symbol int) +(define-extern show-level (function symbol int)) (define-extern *default-level* level) +(define-extern *level-type-list* type) ;; ?? + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; text ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -22942,7 +24020,7 @@ ;; (define-extern convert-korean-text function) ;; (define-extern text-is-loading object) ;; symbol ;; (define-extern load-game-text-info function) ;; (function string symbol kheap int) -;; (define-extern load-level-text-files function) ;; (function int none) +(define-extern load-level-text-files (function int none)) ;; (define-extern draw-debug-text-box function) ;; (function font-context none) ;; (define-extern print-game-text-scaled function) ;; (function string float font-context int none) ;; (define-extern print-game-text function) ;; (function string font-context symbol int int float) @@ -23113,7 +24191,7 @@ ;; (define-extern cshape-reaction-update-state function) ;; (define-extern cshape-reaction-default function) ;; (define-extern cshape-reaction-just-move function) -;; (define-extern collide-shape-draw-debug-marks function) ;; (function none) +(define-extern collide-shape-draw-debug-marks (function none)) ;; (define-extern *col-timer* object) ;; stopwatch ;; (define-extern *frame-timer* object) ;; stopwatch ;; (define-extern *col-timer-enable* object) ;; symbol @@ -23128,7 +24206,7 @@ ;; collide ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *collide-vif0-init* array) ;; (array uint32) +(define-extern *collide-vif0-init* (array uint32)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-planes ;; @@ -23216,7 +24294,7 @@ ;; (define-extern *actor-hash* object) ;; (define-extern *actor-hash-buckets* object) -;; (define-extern update-actor-hash function) +(define-extern update-actor-hash (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; merc-death ;; @@ -23391,12 +24469,12 @@ ;; (define-extern matrix-local->world function) ;; (function symbol symbol matrix) ;; (define-extern matrix-world->local function) ;; (function matrix) ;; (define-extern *camera-dummy-vector* object) ;; vector -;; (define-extern camera-pos function) ;; (function vector) +(define-extern camera-pos (function vector)) ;; ;; (define-extern math-camera-pos function) ;; (function vector) ;; (define-extern camera-matrix function) ;; (define-extern math-camera-matrix function) -;; (define-extern camera-angle function) ;; (function float) -;; (define-extern camera-teleport-to-entity function) ;; (function entity-actor none :behavior process) +(define-extern camera-angle (function float)) +(define-extern camera-teleport-to-entity (function entity-actor none :behavior process)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; cam-master ;; @@ -23626,11 +24704,11 @@ ;; (define-extern update-visible function) ;; (function math-camera symbol) ;; (define-extern *save-camera-inv-rot* object) ;; matrix ;; (define-extern move-camera-from-pad function) ;; (function math-camera math-camera) -;; (define-extern external-cam-reset! function) ;; (function none) +(define-extern external-cam-reset! (function none)) ;; (define-extern *start-timer* object) ;; int ;; (define-extern *timer-value* object) ;; int ;; (define-extern *start-pos* object) ;; vector -;; (define-extern update-camera function) ;; (function symbol) +(define-extern update-camera (function symbol)) ;; ;; (define-extern move-level-by-name function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -24000,9 +25078,9 @@ ;; (define-extern *camera-old-stat-string-tfrag* object) ;; string ;; (define-extern *camera-old-stat-string-tfrag-near* object) ;; string ;; (define-extern *camera-old-stat-string-total* object) ;; string -;; (define-extern cam-slave-options->string function) ;; (function cam-slave-options object string) -;; (define-extern cam-index-options->string function) ;; (function cam-index-options object string) -;; (define-extern slave-los-state->string function) ;; (function slave-los-state string) +(define-extern cam-slave-options->string (function cam-slave-options object string)) +(define-extern cam-index-options->string (function cam-index-options object string)) +(define-extern slave-los-state->string (function slave-los-state string)) ;; (define-extern cam-line-dma function) ;; (function pointer) ;; (define-extern camera-line2d function) ;; (function vector4w vector4w pointer) ;; (define-extern camera-plot-float-func function) ;; (function float float float float (function float float) vector4w none) @@ -24050,9 +25128,9 @@ ;; process-drawable ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cspace-by-name function) ;; (function process-drawable string cspace) -;; (define-extern cspace-index-by-name function) ;; (function process-drawable string int) -;; (define-extern vector<-cspace! function) ;; (function vector cspace vector) +(define-extern cspace-by-name (function process-drawable string cspace)) +(define-extern cspace-index-by-name (function process-drawable string int)) +(define-extern vector<-cspace! (function vector cspace vector)) ;; (define-extern vector<-matrix! function) ;; (define-extern vector<-cspace+vector! function) ;; (function vector cspace vector vector) ;; (define-extern cspace-children function) ;; (function process-drawable int pair) @@ -24061,7 +25139,7 @@ ;; (define-extern draw-joint-axes function) ;; (define-extern draw-root function) ;; (define-extern empty-state state) ;; (state process) -;; (define-extern process-drawable-art-error state) ;; (state string process-drawable) +(define-extern process-drawable-art-error (state string process-drawable)) ;; (define-extern process-drawable-idle state) ;; (state process-drawable) ;; (define-extern skeleton-group->draw-control function) ;; (define-extern ja-done? function) ;; (function int symbol :behavior process-drawable) @@ -24076,7 +25154,7 @@ ;; (define-extern ja-channel-set! function) ;; (function int int :behavior process-drawable) ;; (define-extern ja-channel-push! function) ;; (function int time-frame int :behavior process-drawable) ;; (define-extern ja-channel-float! function) -;; (define-extern joint-control-reset! function) ;; (function joint-control joint-control-channel none :behavior process-drawable) +(define-extern joint-control-reset! (function joint-control joint-control-channel none :behavior process-drawable)) ;; (define-extern ja-group-size function) ;; (function int :behavior process-drawable) ;; (define-extern ja-eval function) ;; (function int :behavior process-drawable) ;; (define-extern ja-blend-eval function) ;; (function int :behavior process-drawable) @@ -24118,7 +25196,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern region-tree-execute function) -;; (define-extern region-execute function) +(define-extern region-execute (function none)) ;; (define-extern region-prim-lookup-by-id function) ;; (define-extern region-lookup-by-id function) @@ -24182,6 +25260,8 @@ ) |# +(declare-type camera-start basic) +(define-extern camera-start type) #| (deftype camera-start (process-hidden) () @@ -24271,7 +25351,7 @@ ) |# -;; (define-extern *lightning-spec-id-table* object) +(define-extern *lightning-spec-id-table* (array lightning-spec)) ;; (define-extern *lightning-gcf* object) ;; (define-extern lightning-fractal-gen function) ;; (define-extern lightning-uniform-gen function) @@ -24285,7 +25365,7 @@ ;; (define-extern lightning-start function) ;; (define-extern *lightning-globals* object) ;; (define-extern *lightning* object) -;; (define-extern lightning-draw-all function) +(define-extern lightning-draw-all (function none)) ;; (define-extern unlink-lightning-spec-by-heap function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -24647,7 +25727,7 @@ ;; (define-extern target-log-attack function) ;; (define-extern ground-tween-initialize function) ;; (function ground-tween-info uint uint uint uint uint uint ground-tween-info :behavior target) ;; (define-extern ground-tween-update function) ;; (function ground-tween-info float float none :behavior target) -;; (define-extern target-pos function) ;; (function int vector) +(define-extern target-pos (function int vector)) ;; (define-extern target-cam-pos function) ;; (function vector) ;; (define-extern target-rot function) ;; (function quaternion) @@ -24687,8 +25767,8 @@ ;; (define-extern target-collision-reaction function) ;; (function control-info collide-shape-intersect vector vector cshape-moving-flags) ;; (define-extern target-collision-no-reaction function) ;; (function control-info collide-shape-intersect vector vector none) ;; (define-extern *collide-edge-board-spec* object) -;; (define-extern rail-surface-touch function) -;; (define-extern gravel-surface-touch function) +(define-extern rail-surface-touch (function none)) +(define-extern gravel-surface-touch (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; logic-target ;; @@ -24741,7 +25821,7 @@ ;; (define-extern target-init function) ;; (define-extern tobot-init function) (define-extern stop (function symbol int)) -;; (define-extern start function) ;; (function symbol continue-point target) +(define-extern start (function symbol continue-point target)) ;; (define-extern tobot-start function) ;; (define-extern tobot-stop function) @@ -24920,7 +26000,7 @@ ;; (define-extern projectile-move-fill-line-sphere function) ;; (define-extern projectile-update-velocity-add-gravity function) ;; (define-extern projectile-update-velocity-space-wars function) ;; (function projectile none) -;; (define-extern projectile-init-by-other function) ;; (function entity-actor vector vector uint handle none :behavior projectile) +(define-extern projectile-init-by-other (function projectile-init-by-other-params projectile)) ;; (function entity-actor vector vector uint handle none :behavior projectile) ;; (define-extern projectile-bounce-update-velocity function) ;; (define-extern projectile-bounce-falling-post function) ;; (define-extern projectile-bounce-move function) @@ -25659,13 +26739,13 @@ ;; drawable ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern sphere-cull function) ;; (function vector symbol) -;; (define-extern guard-band-cull function) ;; (function vector symbol) -;; (define-extern sphere-in-view-frustum? function) ;; (function sphere symbol) +(define-extern sphere-cull (function vector symbol)) +(define-extern guard-band-cull (function vector symbol)) +(define-extern sphere-in-view-frustum? (function sphere symbol)) ;; (define-extern line-in-view-frustum? function) ;; (function vector vector symbol) -;; (define-extern vis-cull function) ;; (function int symbol) +(define-extern vis-cull (function int symbol)) ;; (define-extern vis-cull-debug function) -;; (define-extern error-sphere function) ;; (function drawable-error string none) +(define-extern error-sphere (function drawable-error string none)) ;; (define-extern *edit-instance* object) ;; string ;; (define-extern *instance-mem-usage* object) ;; memory-usage-block ;; (define-extern find-instance-by-name-level function) @@ -25683,25 +26763,25 @@ ;; (define-extern *hud-lights* object) ;; vu-lights ;; (define-extern dma-add-process-drawable-hud function) ;; (function process-drawable draw-control symbol dma-buffer none) ;; (define-extern add-process-drawable function) ;; (function process-drawable draw-control symbol dma-buffer none) -;; (define-extern foreground-engine-execute function) ;; (function engine display-frame int int none) +(define-extern foreground-engine-execute (function engine display-frame none)) ;; (define-extern main-debug-hook function) ;; (function none) ;; (define-extern *debug-hook* object) ;; (function none) -;; (define-extern *add-sphere* object) ;; symbol +(define-extern *add-sphere* symbol) ;; (define-extern *generic-effect-mode* object) ;; int -;; (define-extern foreground-initialize-engines function) -;; (define-extern foreground-execute-cpu-vu0-engines function) -;; (define-extern real-main-draw-hook function) ;; (function none) -;; (define-extern main-draw-hook function) ;; (function none) -;; (define-extern *draw-hook* object) ;; (function none) +(define-extern foreground-initialize-engines (function none)) +(define-extern foreground-execute-cpu-vu0-engines (function none)) +(define-extern real-main-draw-hook (function none)) +(define-extern main-draw-hook (function none)) +(define-extern *draw-hook* (function none)) ;; (define-extern default-init-buffer function) ;; (define-extern default-end-buffer function) ;; (define-extern screen-shot-scale function) ;; (define-extern screen-shot function) ;; (define-extern display-frame-start function) ;; (function display int int none) -;; (define-extern display-frame-finish function) ;; (function display display) +(define-extern display-frame-finish (function display display)) ;; (define-extern determine-pause-mode function) ;; (function int) -;; (define-extern display-sync function) ;; (function display none) -;; (define-extern swap-display function) ;; (function display none) +(define-extern display-sync (function display none)) +(define-extern swap-display (function display none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; drawable-group ;; @@ -25736,40 +26816,40 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern set-video-mode function) ;; (function symbol none) -;; (define-extern get-video-mode function) ;; (function symbol) +(define-extern get-video-mode (function symbol)) ;; (define-extern set-aspect-ratio function) ;; (function symbol none) ;; (define-extern get-aspect-ratio function) ;; (function symbol) ;; (define-extern set-progressive-scan function) ;; (define-extern get-progressive-scan function) ;; (define-extern *smode2* object) -;; (define-extern set-graphics-mode function) +(define-extern set-graphics-mode (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; main ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern set-letterbox-frames (function time-frame none)) -;; (define-extern letterbox function) ;; (function none) -;; (define-extern set-blackout-frames function) ;; (function time-frame none) -;; (define-extern blackout function) ;; (function none) -;; (define-extern paused? function) ;; (function symbol) -;; (define-extern movie? function) ;; (function symbol) -;; (define-extern demo? function) +(define-extern letterbox (function none)) +(define-extern set-blackout-frames (function time-frame none)) +(define-extern blackout (function none)) +(define-extern paused? (function symbol)) +(define-extern movie? (function symbol)) +(define-extern demo? (function symbol)) (define-extern *last-master-mode* symbol) -;; (define-extern set-master-mode function) ;; (function symbol none) -;; (define-extern pause-allowed? function) ;; (function symbol) -;; (define-extern toggle-pause function) ;; (function int) +(define-extern set-master-mode (function symbol none)) +(define-extern pause-allowed? (function symbol)) +(define-extern toggle-pause (function int)) (define-extern *screen-filter* screen-filter) (define-extern *cheat-temp* (pointer int32)) (define-extern *master-exit* symbol) (define-extern *progress-cheat* symbol) (define-extern *first-boot* symbol) -;; (define-extern main-cheats function) ;; (function int) -;; (define-extern end-display function) -;; (define-extern display-loop-main function) +(define-extern main-cheats (function int)) +(define-extern end-display (function display none)) +(define-extern display-loop-main (function display none)) (define-extern display-loop (function int :behavior process)) (define-extern on (function symbol process)) -;; (define-extern off function) ;; (function int) +(define-extern off (function int)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-cache ;; @@ -25879,9 +26959,9 @@ ;; (define-extern *spawn-actors* object) ;; symbol ;; (define-extern *compact-actors* object) ;; symbol ;; (define-extern *vis-actors* object) ;; symbol -;; (define-extern entity-by-name function) ;; (function string entity) +(define-extern entity-by-name (function string entity)) (define-extern entity-by-type (function type entity-actor)) -;; (define-extern entity-by-aid function) ;; (function uint entity) +(define-extern entity-by-aid (function uint entity)) ;; (define-extern entity-actor-from-level-name function) ;; (define-extern entity-nav-mesh-by-aid function) ;; (define-extern nav-mesh-from-res-tag function) @@ -25892,7 +26972,7 @@ ;; (define-extern entity-remap-names function) ;; (function pair none) ;; (define-extern process-status-bits function) ;; (function process symbol none) ;; (define-extern process-entity-set! function) -;; (define-extern process-task-mask function) +(define-extern process-task-mask (function process task-mask)) ;; (define-extern update-actor-vis-box function) ;; (function process-drawable vector vector none) ;; (define-extern expand-bounding-box function) ;; (define-extern expand-vis-box-with-point function) ;; (function entity vector none) @@ -26364,7 +27444,7 @@ ;; (define-extern *fail-mission-control* fail-mission-control) ;; (define-extern game-task-node->string function) -;; (define-extern update-task-masks function) +(define-extern update-task-masks (function symbol none)) ;; (define-extern play-clean function) ;; (define-extern play-task function) ;; (define-extern restart-mission function) @@ -26690,7 +27770,7 @@ |# ;; (define-extern *progress-stack* object) ;; (pointer uint8) -;; (define-extern *progress-process* object) ;; (pointer progress) +(define-extern *progress-process* (pointer progress)) ;; (define-extern *progress-state* progress-global-state) ;; progress-global-state ;; (define-extern *progress-save-info* object) ;; mc-slot-info ;; (define-extern min-max-wrap-around function) @@ -26698,10 +27778,10 @@ ;; (define-extern hud-ring-cell-init-by-other function) ;; (define-extern progress-init-by-other function) ;; (function none :behavior progress) ;; (define-extern set-ring-position function) -;; (define-extern activate-progress function) ;; (function process progress-screen none) +(define-extern activate-progress (function process symbol none)) ;; (define-extern deactivate-progress function) ;; (function none) -;; (define-extern hide-progress-screen function) ;; (function none) -;; (define-extern progress-allowed? function) ;; (function symbol) +(define-extern hide-progress-screen (function none)) +(define-extern progress-allowed? (function symbol)) ;; (define-extern menu-update-purchase-secrets function) ;; (define-extern progress-trans function) ;; (define-extern begin-scan function) @@ -26883,7 +27963,7 @@ ;; bigmap-data ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *bigmap-compressed-layers* object) +(define-extern *bigmap-compressed-layers* bigmap-compressed-layers) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bigmap ;; @@ -26893,7 +27973,7 @@ ;; (define-extern *circle-mask-2x2-meters* array) ;; (define-extern *image-mask-table* object) ;; (define-extern *map-save-ptr* object) -;; (define-extern *bigmap* object) +(define-extern *bigmap* bigmap) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; eye ;; @@ -27182,7 +28262,7 @@ ;; (define-extern anim-tester-add-newobj function) ;; (function anim-tester string art-group object) ;; (define-extern anim-tester-stop function) ;; (function symbol) ;; (define-extern anim-tester-start function) ;; (function symbol) -;; (define-extern anim-tester-add-object function) ;; (function string none) +(define-extern anim-tester-add-object (function string none)) ;; (define-extern anim-tester-set-name function) ;; (function string object) ;; (define-extern anim-tester-add-sequence function) ;; (function string none) @@ -27889,7 +28969,7 @@ ;; (define-extern debug-menu-context-make-default-menus function) ;; (function debug-menu-context debug-menu-context) ;; (define-extern *popup-menu-context* object) ;; debug-menu-context ;; (define-extern popup-menu-context-make-default-menus function) ;; (function debug-menu-context debug-menu-context) -;; (define-extern menu-respond-to-pause function) ;; (function symbol) +(define-extern menu-respond-to-pause (function symbol)) ;; (define-extern *menu-hook* function) ;; (function debug-menu-context) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -34910,7 +35990,7 @@ ;; (define-extern draw-large-polygon-vortex function) ;; (define-extern render-vortex-quad function) ;; (define-extern update-vortex-data function) -;; (define-extern draw-vortex function) +(define-extern draw-vortex (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ai-task-h ;; diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index 1f91f9c9f9..d594ac7895 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -12,5 +12,35 @@ ], "main": [ [3, "(function none :behavior process)"] + ], + "profile": [ + [9, "(function profile-segment-array profile-collapse none)"] + ], + "bigmap-h": [ + [1, "(function external-art-buffer none)"], + [2, "(function external-art-buffer none)"] + ], + "surface-h": [ + [0, "(function none)"], + [1, "(function none)"] + ], + + "main": [ + [10, "(function none)"], + [9, "(function none)"], + [8, "(function none)"], + [7, "(function time-frame none)"], + [3, "(function none)"] + ], + + "level-info": [ + [0, "(function none)"], + [1, "(function none)"], + [2, "(function none)"] + ], + + "level": [ + [5, "(function none)"], + [24, "(function level-group int symbol)"] ] } \ No newline at end of file diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 1d3d5f48ab..793cf0413f 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -16,13 +16,17 @@ // the second argument is the name of the first condition in the cond. Use print_cfg to find it out. // The third argument is the number of cases. If you set it too small it may fail to build the CFG. "cond_with_else_max_lengths": [ - + ["(method 20 res-lump)", "b0", 2], + ["(method 11 res-lump)", "b0", 1], + ["(method 12 res-lump)", "b0", 1] ], // if a cond with an else case is being used a value in a place where it looks wrong // you can add the function name to this list and it will more aggressively reject this rewrite. "aggressively_reject_cond_to_value_rewrite": [ - + "(method 10 res-lump)", + "(method 11 res-lump)", + "(method 12 res-lump)" ], // this provides a hint to the decompiler that these functions will have a lot of inline assembly. @@ -31,8 +35,8 @@ "asm_functions_by_name": [ // checking boxed type is different now - these make the cfg stuff sad - "name=", "(method 8 res-lump)", "joint-control-remap!", "(method 21 game-info)", "(method 12 level)", - "bg", "(anon-function 2 cam-combiner)", "cspace-inspect-tree", "command-get-process", "command-get-trans", "(method 10 script-context)", + "name=", "joint-control-remap!", "(method 21 game-info)", + "(anon-function 2 cam-combiner)", "cspace-inspect-tree", "command-get-process", "command-get-trans", "(method 10 script-context)", "(method 11 script-context)", "(method 9 script-context)", "(anon-function 64 script)", "(anon-function 61 script)", "(anon-function 60 script)", "(anon-function 54 script)", "(anon-function 52 script)", "(anon-function 49 script)", "(anon-function 33 script)", "debug-menu-func-decode", "scene-player-init", "(method 77 spyder)", "(method 77 flamer)", "(method 77 grenadier)", "(method 224 bot)", "(method 77 rapid-gunner)", @@ -47,7 +51,9 @@ // actual asm "quad-copy!", "return-from-thread", "return-from-thread-dead", "reset-and-call", "(method 10 cpu-thread)", "(method 11 cpu-thread)", "(method 0 catch-frame)", "throw-dispatch", "throw", "run-function-in-process", - "set-to-run-bootstrap", "return-from-exception", "exp", + "set-to-run-bootstrap", "return-from-exception", "exp", "(method 17 bounding-box)", "(method 9 bounding-box)", + "(method 9 matrix)", "quaternion->matrix-2", "sin-rad", "cos-rad", "atan-series-rad", "sign-float", "dma-count-until-done", + "(method 11 collide-mesh-cache)", "symlink2", "blerc-a-fragment", "blerc-execute", "foreground-check-longest-edge-asm", "generic-light-proc", "shadow-add-single-edges","shadow-add-facing-single-tris", "shadow-add-double-tris", "shadow-add-double-edges", @@ -83,7 +89,11 @@ "delete-car!", "insert-cons!", "sort", - "unload-package" + "unload-package", + "display-loop-main", + "lookup-level-info", + "(method 24 level-group)", + "(method 19 level-group)" ], // If format is used with the wrong number of arguments, @@ -91,7 +101,12 @@ // that they used the correct number. This will override the decompiler's // automatic detection. "bad_format_strings": { - + "~170h~5d~220h~5d~280h~5,,2f": 3, + "~338h~5d~388h~5d~448h~5,,2f": 3, + "~1k~%":0, + "~30Htf: ~8D~134Hpr: ~8D~252Hsh: ~8D~370Hhd: ~8D~%":4, + "~30Hal: ~8D~131Hwa: ~8D~252Hsp: ~8D~370Hwp: ~8D~%":4, + "~0Kload ~16S ~5S ~5DK ~5,,2fs ~5,,2fs~1K ~5,,0f k/s~%":6 }, "blocks_ending_in_asm_branch": { @@ -103,7 +118,14 @@ "find-knot-span": [0, 1, 2, 3, 5, 6, 7, 8, 9], - "curve-evaluate!": [0, 2, 5, 6, 7, 8, 9] + "curve-evaluate!": [0, 2, 5, 6, 7, 8, 9], + + "display-loop-main": [127, 130, 133, 136], + + "real-main-draw-hook": [114, 115, 116, 118], + + "(method 12 perf-stat)": [0], + "(method 11 perf-stat)": [0] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index fad2c11641..392de23831 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -8,33 +8,6 @@ ["L102", "(pointer float)", 32] ], - // possible for auto-labeling - "vector-h": [ - ["L36", "vector"], - ["L35", "vector"], - ["L34", "vector"], - ["L33", "vector"], - ["L32", "vector"], - ["L31", "vector"], - ["L30", "vector"] - ], - - "matrix": [ - ["L65", "matrix"] - ], - "quaternion-h": [ - ["L1", "quaternion"] - ], - "quaternion": [ - ["L85", "vector"], - ["L84", "vector"], - ["L83", "vector"], - ["L82", "vector"], - ["L81", "vector"], - ["L80", "vector"], - ["L79", "vector"], - ["L78", "vector"] - ], "trigonometry": [ ["L93", "vector"], ["L92", "vector"], @@ -63,5 +36,45 @@ "font-h": [ ["L20", "matrix"], ["L19", "font-work"] + ], + "capture": [ + ["L4", "gs-store-image-packet"]], + + "task-control-h": [ + ["L877", "uint64", true], + ["L878", "uint64", true], + ["L879", "uint64", true], + ["L880", "uint64", true], + ["L881", "uint64", true], + ["L882", "uint64", true], + ["L883", "uint64", true] + ], + + "ocean-trans-tables": [ + ["L1", "(inline-array vector)", 4], + ["L2", "(pointer float)", 160], + ["L3", "(pointer float)", 100], + ["L4", "(pointer float)", 72], + ["L5", "(pointer float)", 72], + ["L6", "(pointer float)", 72], + ["L7", "(pointer float)", 72], + ["L8", "(pointer float)", 44], + ["L9", "(pointer float)", 44], + ["L10", "(pointer float)", 44], + ["L11", "(pointer float)", 44], + ["L12", "(pointer float)", 40], + ["L13", "(pointer float)", 40], + ["L14", "(pointer float)", 40], + ["L15", "(pointer float)", 40], + ["L16", "(pointer float)", 28], + ["L17", "(pointer float)", 28], + ["L18", "(pointer float)", 28], + ["L19", "(pointer float)", 28] + ], + "ocean-frames": [["L1", "(pointer uint32)", 16384]], + "ambient-h": [["L1", "(inline-array talker-speech-class)", 188]], + "pat-h": [["L1", "(inline-array pat-mode-info)", 4]], + "joint-mod-h": [ + ["L43", "(inline-array vector)", 6] ] } \ No newline at end of file diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 188f8acd8e..487915f6d5 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -1,114 +1,6 @@ { - // possible for automatic detection: - "(method 23 trsqv)": [[16, "vector"]], - "(method 24 trsqv)": [[16, "vector"]], - "(method 18 bounding-box)": [[16, "vector"], [32, "vector"]], - "(method 12 bounding-box)": [[16, "liang-barsky-line-clip-params"]], - "matrixp*!": [[16, "matrix"]], - "vector3s-matrix*!": [[16, "vector"]], - "vector3s-rotate*!": [[16, "vector"]], - - "matrix-rotate-zyx!": [ - [16, "matrix"], - [80, "matrix"] - ], - "matrix-rotate-xyz!": [ - [16, "vector"], - [32, "vector"], - [80, "matrix"] - ], - "matrix-rotate-zxy!": [ - [16, "matrix"], - [80, "matrix"] - ], - "matrix-rotate-yxz!": [ - [16, "matrix"], - [80, "matrix"] - ], - "matrix-rotate-yzx!": [ - [16, "matrix"], - [80, "matrix"] - ], - "matrix-rotate-yxy!": [ - [16, "vector"], - [32, "vector"], - [48, "vector"] - ], - "matrix-rotate-yx!": [[16, "matrix"]], - "transform-matrix-calc!": [ - [16, "matrix"], - [80, "matrix"] - ], - "transform-matrix-parent-calc!": [ - [16, "matrix"], - [80, "matrix"] - ], - "matrix->quat": [ - [16, "matrix"] - ], - "matrix<-quat": [ - [16, "vector"], - [32, "matrix"] - ], - "matrix->transformq": [ - [16, "matrix"] - ], - "matrix-rotate-xyz-2!": [ - [16, "matrix"], - [80, "matrix"] - ], - "matrix-with-scale->quaternion": [[16, "matrix"]], "quaternion-exp!": [[16, "vector"]], - "quaternion-slerp!": [[16, "vector"]], - "quaternion-zxy!": [ - [16, "vector"], - [32, "vector"], - [48, "vector"] - ], - "vector-x-quaternion!": [[16, "matrix"]], - "vector-y-quaternion!": [[16, "matrix"]], - "vector-z-quaternion!": [[16, "matrix"]], - "quaternion-x-angle": [[16, "vector"]], - "quaternion-y-angle": [[16, "vector"]], - "quaternion-z-angle": [[16, "vector"]], - "quaternion-rotate-local-x!": [[16, "quaternion"]], - "quaternion-rotate-local-y!": [[16, "quaternion"]], - "quaternion-rotate-local-z!": [[16, "quaternion"]], - "quaternion-rotate-y!": [[16, "quaternion"]], - "quaternion-rotate-x!": [ - [16, "quaternion"], - [32, "vector"] - ], - "quaternion-rotate-z!": [ - [16, "quaternion"], - [32, "vector"] - ], - "quaternion-delta-y": [ - [16, "vector"], - [32, "vector"] - ], - "quaternion-rotate-y-to-vector!": [ - [16, "quaternion"], - [32, "vector"], - [48, "quaternion"] - ], - "quaternion-xz-angle": [ - [16, "matrix"], - [80, "vector"] - ], - "vector-rotate-x!": [ - [16, "quaternion"], - [32, "matrix"] - ], - "vector-rotate-y!": [ - [16, "quaternion"], - [32, "matrix"] - ], - "vector-rotate-z!": [ - [16, "quaternion"], - [32, "matrix"] - ], "quaternion-axis-angle!": [ [16, "vector"] ], @@ -118,16 +10,12 @@ "quaternion-look-at!": [ [16, "matrix"] ], - "quaternion-pseudo-seek": [ - [16, "quaternion"], - [32, "quaternion"] - ], "quaternion-smooth-seek!": [ [16, ["inline-array", "quaternion", 2]] ], + + // possible for automatic detection: "eul->matrix": [[16, "vector"]], - "eul->quat": [[16, "matrix"]], - "quat->eul": [[16, "matrix"]], "vector-sincos!": [[16, "vector"]], "vector-reflect-flat-gravity!": [[16, "vector"], [32, "vector"]], @@ -255,12 +143,53 @@ [32, "vector"], [48, "vector"] ], - "init-for-transform": [ + "init-for-transform": [ [16, "matrix"], [80, "matrix"], [144, "vector4s-3"], [192, "vector"], [208, "vector4s-3"] ], + "draw-sprite2d-xy": [ + [16, "draw-context"] + ], + "screen-gradient": [ + [16, "draw-context"] + ], + "play": [ + [16, "event-message-block"], + [96, ["array", "symbol", 10]] + ], + "store-image": [ + [16, "file-stream"] + ], + + "joint-mod-blend-world-callback": [ + [160, "vector"] + ], + "joint-mod-rotate-local-callback": [ + [16, "vector"] + ], + "light-hash-get-bucket-index": [ + [16, "vector4w"] + ], + "(method 10 cam-vector-seeker)": [ + [16, "vector"] + ], + + "(method 39 nav-mesh)" : [ + [16, "vector"], + [32, "vector"] + ], + + "(method 41 nav-mesh)": [ + [16, "vector"], + [32, "vector"] + ], + + "show-level": [ + [16, ["array", "symbol", 10]] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index cb89fad732..da2cafb741 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -1,4 +1,15 @@ { + + // auto find-parent-method possible + "(method 3 entity-actor)" : [ + [7, "t9", "(function entity entity)"] + ], + + "(method 3 entity)" : [ + [7, "t9", "(function entity entity)"] + ], + + // "(method 2 array)": [ [23, "gp", "(array int32)"], [43, "gp", "(array uint32)"], @@ -66,26 +77,30 @@ ], "send-event-function": [[[7, 15], "a0", "process"]], + // MATH "logf": [ [12, "f0", "float"], [12, "f1", "float"], [19, "f0", "float"], [19, "f1", "float"] ], - "log2f": [ [12, "f0", "float"], [12, "f1", "float"], [19, "f0", "float"], [19, "f1", "float"] ], - - "log2": [[3, "v1", "int"]], - "cube-root": [ - [[0,33], "f0", "float"], - [[0,33], "f1", "float"], - [[0,33], "f2", "float"] + [17, "f0", "float"], + [17, "f1", "float"], + [18, "f0", "float"], + [18, "f1", "float"], + [[23,32], "f0", "float"] + ], + + // Quaternion + "quaternion-look-at!": [ + [15, "v1", "vector"] ], "vector-x-quaternion!": [[10, "v1", "(pointer uint128)"]], @@ -177,5 +192,341 @@ [13, "s5", "(inline-array vector4)"], [14, "s4", "(inline-array vector4)"], [15, "gp", "(inline-array vector4)"]], + + "vector-segment-distance-point!": [ + [[21,30], "f1", "float"] + ], + + "(method 10 profile-array)": [ + [[6, 10], "a0", "dma-packet"], + [[16, 19], "a0", "gs-gif-tag"], + [24, "a0", "(pointer gs-alpha)"], + [26, "a0", "(pointer gs-reg64)"], + [28, "a0", "(pointer gs-zbuf)"], + [30, "a0", "(pointer gs-reg64)"], + [32, "a0", "(pointer gs-test)"], + [34, "a0", "(pointer gs-reg64)"], + [35, "a0", "(pointer uint64)"], + [37, "a0", "(pointer gs-reg64)"], + [39, "a0", "(pointer gs-clamp)"], + [41, "a0", "(pointer gs-reg64)"], + [43, "a0", "(pointer gs-tex1)"], + [45, "a0", "(pointer gs-reg64)"], + [48, "a0", "(pointer gs-texa)"], + [50, "a0", "(pointer gs-reg64)"], + [52, "a0", "(pointer gs-texclut)"], + [54, "a0", "(pointer gs-reg64)"], + [56, "a0", "(pointer uint64)"], + [58, "a0", "(pointer gs-reg64)"], + [[69, 73], "a0", "(pointer uint128)"], + [[73, 82], "a1", "vector4w"], + [[82, 89], "a1", "vector4w"], + [[90, 96], "a0", "vector4w"], + [[113, 117], "a1", "(pointer uint128)"], + [[117, 126], "a2", "vector4w"], + [[126, 136], "a2", "vector4w"], + [[137, 149], "a1", "vector4w"], + [[187, 191], "t2", "(pointer int128)"], + [[191, 225], "t4", "vector4w"], + [[225, 231], "a2", "vector4w"], + [[231, 237], "a2", "vector4w"] + ], + + "draw-sprite2d-xy": [ + [[35, 39], "t0", "dma-packet"], + [[45, 48], "t0", "gs-gif-tag"], + [53, "t0", "(pointer gs-prim)"], + [55, "t0", "(pointer gs-rgbaq)"], + [66, "t0", "(pointer gs-xyzf)"], + [87, "t0", "(pointer gs-xyzf)"], + [[96, 108], "v1", "(pointer uint64)"] + ], + + "draw-sprite2d-xy-absolute": [ + [[6, 10], "t3", "dma-packet"], + [[16, 19], "t3", "gs-gif-tag"], + [24, "t3", "(pointer gs-prim)"], + [25, "t3", "(pointer gs-rgbaq)"], + [36, "t3", "(pointer gs-xyzf)"], + [49, "t3", "(pointer gs-xyzf)"], + [[62, 69], "v1", "(pointer uint64)"] + ], + + "draw-quad2d": [ + [[18, 22], "t2", "dma-packet"], + [[28, 31], "t2", "gs-gif-tag"], + [36, "t2", "(pointer gs-prim)"], + [38, "t2", "(pointer gs-rgbaq)"], + [46, "t2", "(pointer gs-xyzf)"], + [48, "t2", "(pointer gs-rgbaq)"], + [61, "t2", "(pointer gs-xyzf)"], + [63, "t2", "(pointer gs-rgbaq)"], + [76, "t2", "(pointer gs-xyzf)"], + [78, "t2", "(pointer gs-rgbaq)"], + [96, "t2", "(pointer gs-xyzf)"], + [97, "t2", "(pointer uint64)"], + [[110, 117], "v1", "(pointer uint64)"] + ], + "set-display-gs-state": [ + [[3, 10], "t3", "dma-packet"], + [[13, 19], "t3", "gs-gif-tag"], + [30, "t3", "(pointer gs-scissor)"], + [32, "t3", "(pointer gs-reg64)"], + [33, "t3", "(pointer gs-xy-offset)"], + [35, "t3", "(pointer gs-reg64)"], + [46, "t3", "(pointer gs-frame)"], + [48, "t3", "(pointer gs-reg64)"], + [50, "t3", "(pointer gs-test)"], + [52, "t3", "(pointer gs-reg64)"], + [54, "t3", "(pointer gs-texa)"], + [56, "t3", "(pointer gs-reg64)"], + [58, "t3", "(pointer gs-zbuf)"], + [60, "t3", "(pointer gs-reg64)"], + [61, "t3", "(pointer uint64)"], + [63, "t3", "(pointer gs-reg64)"] + ], + "set-display-gs-state-offset": [ + [[3, 10], "t5", "dma-packet"], + [[13, 19], "t5", "gs-gif-tag"], + [30, "t5", "(pointer gs-scissor)"], + [32, "t5", "(pointer gs-reg64)"], + [40, "t5", "(pointer gs-xy-offset)"], + [42, "t5", "(pointer gs-reg64)"], + [53, "t5", "(pointer gs-frame)"], + [55, "t5", "(pointer gs-reg64)"], + [57, "t5", "(pointer gs-test)"], + [59, "t5", "(pointer gs-reg64)"], + [61, "t5", "(pointer gs-texa)"], + [63, "t5", "(pointer gs-reg64)"], + [65, "t5", "(pointer gs-zbuf)"], + [67, "t5", "(pointer gs-reg64)"], + [68, "t5", "(pointer uint64)"], + [70, "t5", "(pointer gs-reg64)"] + ], + "reset-display-gs-state": [ + [[3, 8], "a2", "dma-packet"], + [[14, 17], "a2", "gs-gif-tag"], + [22, "a1", "(pointer gs-scissor)"], + [24, "a1", "(pointer gs-reg64)"], + [26, "a1", "(pointer gs-xy-offset)"], + [28, "a1", "(pointer gs-reg64)"], + [30, "a1", "(pointer gs-frame)"], + [32, "a1", "(pointer gs-reg64)"], + [34, "a1", "(pointer gs-test)"], + [36, "a1", "(pointer gs-reg64)"], + [39, "a1", "(pointer gs-texa)"], + [41, "a1", "(pointer gs-reg64)"], + [43, "a1", "(pointer gs-zbuf)"], + [45, "a1", "(pointer gs-reg64)"], + [46, "a1", "(pointer uint64)"], + [48, "a1", "(pointer gs-reg64)"] + ], + + "(method 3 connection-pers)": [ + [97, "f0", "float"] + ], + + "(method 9 connection)": [[8, "a0", "pointer"]], + "(method 10 connection)": [[8, "a0", "pointer"]], + "(method 11 connection)": [[5, "a1", "pointer"]], + "(method 0 engine)": [[44, "v1", "pointer"], [47, "v1", "pointer"], [53, "v1", "connectable"], [65, "v1", "connectable"]], + "(method 12 engine)": [ + [[5, 18], "s4", "connection"], + [13, "t9", "(function object object object object object)"] + ], + + "(method 13 engine)": [ + [[5, 28], "s4", "connection"], + [13, "t9", "(function object object object object object)"] + ], + "(method 15 engine)": [[[0, 36], "v1", "connection"]], + "(method 19 engine)": [[8, "a0", "connection"]], + "(method 20 engine)": [[8, "a0", "connection"]], + "(method 21 engine)": [[8, "a0", "connection"]], + "(method 0 engine-pers)": [[32, "v1", "pointer"], [23, "v1", "pointer"], [26, "v1", "pointer"], [24, "v1", "(pointer pointer)"]], + "(method 3 connection-minimap)" : [[97, "f0", "float"]], + "dma-buffer-add-ref-texture": [ + [[25, 29], "a3", "dma-packet"], + [[32, 44], "a3", "gs-gif-tag"], + [[47, 62], "a2", "dma-packet"] + ], + "texture-page-default-allocate": [ + [51, "a3", "texture-page"] + ], + "texture-page-font-allocate": [ + [33, "a3", "texture-page"] + ], + "(method 24 texture-pool)": [ + [67, "a1", "shader-ptr"], + [[70, 91], "a1", "adgif-shader"], + [92, "a1", "adgif-shader"] + ], + + "(method 3 generic-tie-interp-point)":[ + [19, "gp", "(pointer uint128)"] + ], + "(method 19 res-lump)": [ + [46, "t2", "(pointer uint64)"], + [100, "t3", "(pointer uint64)"], + [184, "t5", "(pointer uint64)"], + [64, "t6", "(pointer uint64)"] + ], + "(method 20 res-lump)": [[331, "a3", "(inline-array vector)"]], + "(method 16 res-lump)": [ + [22, "t1", "(pointer uint64)"], + [29, "t2", "(pointer uint64)"] + ], + "(method 15 res-lump)": [[132, "s5", "res-tag-pair"]], + "(method 17 res-lump)": [[22, "s4", "(pointer pointer)"]], + + "(method 0 script-context)" : [[[8, 17], "v0", "script-context"]], + "joint-mod-wheel-callback": [[[2, 63], "s4", "joint-mod-wheel"]], + "joint-mod-set-local-callback": [[[0, 23], "v1", "joint-mod-set-local"]], + "joint-mod-add-local-callback": [[[2, 33], "s4", "joint-mod-add-local"]], + "joint-mod-set-world-callback": [[[0, 23], "v1", "joint-mod-set-world"]], + "joint-mod-blend-local-callback": [[[2, 63], "gp", "joint-mod-blend-local"]], + "joint-mod-spinner-callback": [[[2, 63], "gp", "joint-mod-spinner"]], + "joint-mod-blend-world-callback": [[[2, 148], "gp", "joint-mod-blend-world"]], + "joint-mod-rotate-local-callback": [[[2, 16], "v1", "joint-mod-rotate-local"]], + "(method 0 collide-shape-prim-sphere)": [[[3, 8], "v0", "collide-shape-prim-sphere"]], + "(method 0 collide-shape-prim-mesh)": [[[3, 11], "v0", "collide-shape-prim-mesh"]], + "(method 0 collide-shape-prim-group)": [[[3, 12], "v0", "collide-shape-prim-group"]], + "(method 0 collide-shape-moving)" : [[[2, 12], "v0", "collide-shape-moving"]], + "(method 11 touching-prims-entry-pool)": [ + [[0, 8], "v1", "touching-prims-entry"], + [8, "v1", "pointer"], + [[9, 11], "v1", "touching-prims-entry"], + [[1, 20], "a1", "touching-prims-entry"] + ], + "(method 0 touching-list)": [[[6, 9], "v0", "touching-list"]], + "display-loop-main": [[223, "t9", "(function none)"]], + "end-display": [[205, "f1", "float"], [205, "f0", "float"]], + + "(method 18 res-lump)": [["_stack_", 16, "object"]], + "(method 21 res-lump)": [ + ["_stack_", 16, "res-tag"], + ["_stack_", 32, "res-tag"] + ], + + "(method 8 res-lump)": [ + [258, "s0", "array"], + // [[0, 100], "s0", "basic"], + // [[102, 120], "s0", "basic"], + // [[147, 150], "s0", "collide-mesh"], + [[157, 239], "s0", "(array object)"] + // [235, "s0", "basic"] + ], + "(method 20 res-lump)": [ + [341, "t0", "(pointer uint128)"] + ], + + "(method 0 fact-info-enemy)": [ + [[0, 196], "gp", "fact-info-enemy"], + ["_stack_", 16, "res-tag"], + ["_stack_", 32, "res-tag"] + ], + + "(method 0 fact-info)": [ + [87, "v1", "(pointer int32)"] + ], + + "(method 0 fact-info-crate)": [ + [[0, 17], "gp", "fact-info-crate"] + ], + + + "(method 0 fact-info-target)": [ + [[0, 17], "gp", "fact-info-target"] + ], + + "joint-channel-float-delete!": [ + [7, "a0", "pointer"], + [7, "a1", "pointer"] + ], + + "num-func-chan": [ + [7, "v1", "joint-control-channel"] + ], + + "(method 20 process-focusable)": [ + [15, "gp", "collide-shape-moving"], + [31, "gp", "collide-shape"] + ], + + "(method 10 focus)": [ + [19, "v1", "collide-shape"] + ], + "shrubbery-login-post-texture": [ + [[13, 15], "a3", "qword"], + [16, "a3", "pointer"], + [24, "a3", "pointer"], + [[17, 23], "a3", "qword"], + [[13, 23], "a1", "qword"], + [14, "a2", "qword"], + [[27, 29], "a3", "qword"], + [[27, 29], "a1", "qword"], + [[35, 37], "a3", "qword"], + [[35, 37], "a2", "qword"] + ], + + "(top-level-login eye-h)": [ + [[69, 77], "a1", "eye-control"] + ], + + "entity-actor-lookup": [ + ["_stack_", 16, "res-tag"] + ], + + + "entity-actor-count": [ + ["_stack_", 16, "res-tag"] + ], + + "(method 0 path-control)": [["_stack_", 16, "res-tag"]], + +"(method 9 actor-link-info)": [[[0, 36], "s3", "entity-actor"]], +"(method 41 nav-mesh)": [["_stack_", 56, "float"]], +"(method 39 nav-mesh)": [["_stack_", 56, "float"]], + "str-load": [[[18, 44], "s2", "load-chunk-msg"]], + "str-load-status": [ + [[18, 22], "v1", "load-chunk-msg"], + [26, "v1", "load-chunk-msg"] + ], + "str-play-async": [[[7, 36], "s4", "play-chunk-msg"]], + "str-play-stop": [[[7, 36], "s4", "play-chunk-msg"]], + "str-play-queue": [[[7, 98], "s4", "play-chunk-msg"]], + "str-ambient-play": [[[7, 20], "s5", "load-chunk-msg"]], + "str-ambient-stop": [[[7, 20], "s5", "load-chunk-msg"]], + "dgo-load-begin": [[[19, 41], "s2", "load-dgo-msg"]], + "dgo-load-get-next": [[[14, 31], "v1", "load-dgo-msg"]], + "dgo-load-continue": [[[5, 23], "gp", "load-dgo-msg"]], + "dgo-load-link": [[7, "s4", "uint"], [17, "s4", "uint"], [55, "s4", "uint"], [27, "s4", "uint"], [37, "s4", "uint"]], + + "lookup-level-info": [[3, "a1", "symbol"], [[4, 24], "a1", "level-load-info"]], + "(method 30 level-group)": [[87, "v0", "level"]], + "(method 19 level-group)": [ + [223, "s3", "continue-point"], + [[177, 209], "s1", "continue-point"], + [[182, 224], "s3", "continue-point"], + [434, "v1", "symbol"]], + "(method 18 level)": [ + [[82, 89], "a1", "level"] + ], + "(method 19 level)": [ + [[45, 48], "a0", "texture-anim-array"] + ], + "level-update-after-load": [ + [[123, 152], "s0", "drawable-inline-array-tfrag"], + [[155, 158], "s0", "drawable-tree-instance-tie"], + [365, "a1", "(pointer int32)"], + [370, "a2", "(pointer int32)"] + ], + "(method 25 level)": [ + [97, "t9", "(function object none)"], + [169, "t9", "(function object symbol none)"] + ], + "(method 9 level)": [ + [54, "t9", "(function object none)"] + ], "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index 9e26dfeeb6..dbae062519 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -1 +1,44 @@ -{} \ No newline at end of file +{ + + "(method 15 res-lump)": { + "vars": { + "s5-0": ["tag-pair", "res-tag-pair"], + "s2-0": "existing-tag", + "s3-0": "data-size", + "v1-25": "resource-mem" + } + }, + + "(method 0 lightning-control)": { + "vars": { + "gp-0": ["obj", "lightning-control"] + } + }, + + "(method 0 align-control)": { + "vars": { + "v0-0": ["obj", "align-control"] + } + }, + + "(method 16 nav-mesh)": { + "args": ["obj", "ray"], + "vars": { + "sv-16": "next-poly-idx", + "sv-24": "work", + "sv-28": "current-poly", + "sv-32": "current-poly-vtx-count", + "sv-36": "v0-table", + "sv-40": "v1-table", + "v1-9": "i", + "sv-52": "adj-vtx-0", + "sv-56": "adj-vtx-1", + "sv-44": "delta-x", + "sv-48": "delta-z", + "sv-60": "adj-edge-dz", + "sv-64": "adj-edge-minus-dx", + "f0-10": "heading-dot" + + } + } +} \ No newline at end of file diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index d889a15401..308f636a5a 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -7,7 +7,7 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. - "allowed_objects": [], + "allowed_objects": ["math"], "banned_objects": ["effect-control"], //////////////////////////// diff --git a/decompiler/level_extractor/fr3_to_gltf.cpp b/decompiler/level_extractor/fr3_to_gltf.cpp index 51d35ea529..35de534b66 100644 --- a/decompiler/level_extractor/fr3_to_gltf.cpp +++ b/decompiler/level_extractor/fr3_to_gltf.cpp @@ -716,7 +716,7 @@ void save_level_background_as_gltf(const tfrag3::Level& level, const fs::path& g // a "scene" is a traditional scene graph, made up of Nodes. // sadly, attempting to nest stuff makes the blender importer unhappy, so we just dump // everything into the top level. - auto& scene = model.scenes.emplace_back(); + model.scenes.emplace_back(); // hack, add a default material. tinygltf::Material mat; @@ -755,7 +755,7 @@ void save_level_foreground_as_gltf(const tfrag3::Level& level, const fs::path& g // a "scene" is a traditional scene graph, made up of Nodes. // sadly, attempting to nest stuff makes the blender importer unhappy, so we just dump // everything into the top level. - auto& scene = model.scenes.emplace_back(); + model.scenes.emplace_back(); // hack, add a default material. tinygltf::Material mat; diff --git a/decompiler/types2/ForwardProp.cpp b/decompiler/types2/ForwardProp.cpp new file mode 100644 index 0000000000..7b1936d251 --- /dev/null +++ b/decompiler/types2/ForwardProp.cpp @@ -0,0 +1,2455 @@ +#include "common/util/BitUtils.h" + +#include "decompiler/IR2/AtomicOp.h" +#include "decompiler/IR2/bitfields.h" +#include "decompiler/ObjectFile/LinkedObjectFile.h" +#include "decompiler/types2/types2.h" +#include "decompiler/util/goal_constants.h" + +/*! + * This file contains implementations of forward type propagation. + */ + +namespace decompiler { + +bool tc(const DecompilerTypeSystem& dts, const TypeSpec& expected, const TP_Type& actual) { + return dts.ts.tc(expected, actual.typespec()); +} + +bool is_int_or_uint(const DecompilerTypeSystem& dts, const TP_Type& type) { + return tc(dts, TypeSpec("integer"), type) || tc(dts, TypeSpec("uint"), type); +} +bool is_signed(const DecompilerTypeSystem& dts, const TP_Type& type) { + return tc(dts, TypeSpec("int"), type) && !tc(dts, TypeSpec("uint"), type); +} + +/*! + * Set up an instruction which sets its result to an ambiguous deref. + * The possibilities are specified in FieldReverseMultiLookupOutput. + */ +void types2_from_ambiguous_deref(types2::Instruction& instr, + types2::Type& type, + const std::vector& out, + bool tag_lock) { + ASSERT(!out.empty()); + + // HACK - this is disabled for now. This probably works, but the expression pass needs + // a way to get the decisions. + type.type = TP_Type::make_from_ts(out.front().result_type); + return; + + // see if we've tagged this instruction in a previous iteration.. + if (instr.field_access_tag) { + // we did. we should see if the tag tells us which option to pick + auto& tag = instr.field_access_tag; + if (tag->selected_possibility >= 0) { + // it does! + // there's a chance that we are a different deref than last time, so do our best to + // find a matching type. + auto& desired_type = tag->possibilities.at(tag->selected_possibility).type; + for (auto& sel : out) { + if (sel.result_type == desired_type) { + // found one, take it. + type.type = TP_Type::make_from_ts(desired_type); + return; + } + } + // the previously selected type is gone... not sure what we can do here, but complain and + // use the first one (highest scored). + fmt::print("type2_from_ambiguous_deref: wanted type {}, but couldn't find it.\n", + desired_type.print()); + type.type = TP_Type::make_from_ts(out.front().result_type); + return; + } else { + // we've got a tag, but no info, just pick the first. + type.type = TP_Type::make_from_ts(out.front().result_type); + return; + } + } else { + // no tag, let's create one! + if (!tag_lock) { // but only if we're in the first pass. + instr.field_access_tag = std::make_unique(); + auto& tag = instr.field_access_tag; + for (auto& poss : out) { + auto& slot = tag->possibilities.emplace_back(); + slot.type = poss.result_type; + } + type.tag.kind = types2::Tag::FIELD_ACCESS; + type.tag.field_access = tag.get(); + } else { + // don't think this should be possible + lg::warn("Tag lock prevented the creation of a tag in types2_from_ambiguous_deref"); + } + type.type = TP_Type::make_from_ts(out.front().result_type); + return; + } +} + +// Note that there are "get_type" and "types2" functions that look somewhat similar. +// the difference is that "get_type" just tries to figure out a TP_Type, and the "types2" function +// will set up/resolve tags, and they are intended to be used to update the type state with their +// result. + +/*! + * Try to figure the type of a label. + * Note: for array labels, we just return a "label_addr" type. The purpose of this is to allow + * far label loads and array accesses to pass through. This might cause the backprop to work + * slightly worse on array labels, but I think we can add some extra info if that comes up. + */ +std::optional try_get_type_of_label(int label_idx, const Env& env) { + const auto& label_db_lookup = env.file->label_db->lookup(label_idx); + if (label_db_lookup.known) { + if (label_db_lookup.result_type.base_type() == "string") { + // strings have a special case to count format arguments, so calls to format can figure + // out their argument count. + return TP_Type::make_from_string(env.file->get_goal_string_by_label(label_idx)); + } + + if (label_db_lookup.is_value) { + // accessing a static array is handled later, and we just make this a placeholder. + // this is to help with far labels. + return TP_Type::make_label_addr(label_idx); + } else { + return TP_Type::make_from_ts(label_db_lookup.result_type); + } + } + + return {}; +} + +/*! + * Try to figure out the type of the value in a symbol with the given name. + */ +std::optional try_get_type_symbol_val(const std::string& name, + const DecompilerTypeSystem& dts, + const Env& env) { + if (name == "#f") { + // if we ever read the false symbol, it should contain the false symbol as its value. + return TP_Type::make_false(); + } else if (name == "__START-OF-TABLE__") { + // another annoying special case. We have a fake symbol called __START-OF-TABLE__ + // which actually means that you get the first address in the symbol table. + // it's not really a linked symbol, but the basic op builder represents it as one. + return TP_Type::make_from_ts(TypeSpec("pointer")); + } else if (name == "enter-state") { + return TP_Type::make_enter_state(); + } else if (name == "run-function-in-process") { + return TP_Type::make_run_function_in_process_function(); + } else if (name == "set-to-run" && env.func->name() != "enter-state") { + return TP_Type::make_set_to_run_function(); + } + + // look up the type of the symbol + auto type = dts.symbol_types.find(name); + if (type == dts.symbol_types.end()) { + // we don't know it, failed. + return {}; + } + + if (type->second == TypeSpec("type")) { + // if we get a type by symbol, we should remember which type we got it from. + return TP_Type::make_type_no_virtual_object(TypeSpec(name)); + } + + if (type->second == TypeSpec("function")) { + // warn if we're accessing a function, but we don't know a more specific type. + // 99% of the time, we're about to call the function, and this will give the user + // a more specific error message that contains the symbol the name. + lg::warn("Function {} has unknown type", name); + } + + // otherwise, just return a normal typespec + return TP_Type::make_from_ts(type->second); +} + +/*! + * Get the type of a symbol, throw if we don't know it. + */ +TP_Type get_type_symbol_val(const std::string& name, + const DecompilerTypeSystem& dts, + const Env& env) { + auto result = try_get_type_symbol_val(name, dts, env); + if (!result) { + throw std::runtime_error(fmt::format("Unknown symbol: {}", name)); + } else { + return *result; + } +} + +/*! + * Get the type of a symbol pointer. Always succeeds + */ +TP_Type get_type_symbol_ptr(const std::string& name) { + // usually just symbol, but we have a special case for #f + if (name == "#f") { + return TP_Type::make_false(); + } else { + return TP_Type::make_from_ts("symbol"); + } +} + +/*! + * Try to figure out the type of an atom. + */ +std::optional try_get_type_of_atom(const types2::TypeState& type_state, + const SimpleAtom& atom, + const Env& env, + const DecompilerTypeSystem& dts) { + switch (atom.get_kind()) { + case SimpleAtom::Kind::VARIABLE: { + return type_state[atom.var().reg()]->type; + } + case SimpleAtom::Kind::SYMBOL_VAL: + return try_get_type_symbol_val(atom.get_str(), dts, env); + case SimpleAtom::Kind::INTEGER_CONSTANT: { + return TP_Type::make_from_integer(atom.get_int()); + } break; + default: + ASSERT_MSG(false, + fmt::format("unknown kind in try_get_type_of_atom: {}", atom.to_string(env))); + } +} + +/*! + * Try to figure out the type of an expression. Can return 0, 1, or multiple. + * If there are multiple, the first one will be the "best". + */ +std::vector try_get_type_of_expr(const types2::TypeState& type_state, + const SimpleExpression& expr, + const Env& env, + const DecompilerTypeSystem& dts) { + switch (expr.kind()) { + case SimpleExpression::Kind::IDENTITY: { + auto atom_type = try_get_type_of_atom(type_state, expr.get_arg(0), env, dts); + if (atom_type) { + return {*atom_type}; + } else { + return {}; + } + } + case SimpleExpression::Kind::ADD: + return {}; // temp, todo something better here. + + default: + ASSERT_MSG(false, fmt::format("unknown kind in try_get_type_of_expr: {} {}", + expr.to_string(env), (int)expr.kind())); + } +} + +namespace types2 { +/*! + * Given a tagged type, and an expectation for what it should be, backprop constraints. + */ +bool backprop_tagged_type(const TP_Type& expected_type, + types2::Type& actual_type, + const DecompilerTypeSystem& dts) { + switch (actual_type.tag.kind) { + case types2::Tag::NONE: + return false; + case types2::Tag::INT_OR_FLOAT: { + auto type = expected_type.typespec(); + // only update if we're actually changing something. + if (type.base_type() == "float" && + (!actual_type.tag.int_or_float->is_float || + actual_type.tag.int_or_float->is_float.value() == false)) { + actual_type.tag.int_or_float->is_float = true; + actual_type.type = TP_Type::make_from_ts("float"); + return true; + } + return false; + } + + case types2::Tag::BLOCK_ENTRY: + // don't update if we're updating to exactly the same thing. + if (actual_type.tag.block_entry->selected_type && + actual_type.tag.block_entry->selected_type == expected_type) { + return false; + } + { + actual_type.tag.block_entry->updated = true; + actual_type.tag.block_entry->selected_type = expected_type; + return true; + } + + case types2::Tag::UNKNOWN_LABEL: + if (actual_type.tag.unknown_label->selected_type && + actual_type.tag.unknown_label->selected_type == expected_type.typespec()) { + return false; // no need to update + } else { + auto& tag = actual_type.tag.unknown_label; + actual_type.tag.unknown_label->selected_type = expected_type.typespec(); + fmt::print("Label Guess: {} is a {}\n", tag->label_name, + actual_type.tag.unknown_label->selected_type->print()); + return true; + } + + case types2::Tag::UNKNOWN_STACK_STRUCTURE: + if (actual_type.tag.unknown_stack_structure->selected_type && + actual_type.tag.unknown_stack_structure->selected_type == expected_type.typespec()) { + return false; // no need to update + } else { + auto& tag = actual_type.tag.unknown_stack_structure; + actual_type.tag.unknown_stack_structure->selected_type = expected_type.typespec(); + fmt::print("Stack Guess: {} is a {}\n", tag->stack_offset, + actual_type.tag.unknown_stack_structure->selected_type->print()); + return true; + } + + case types2::Tag::FIELD_ACCESS: { + ASSERT(false); // this code works, but the later stuff can't get use it yet. + auto* tag = actual_type.tag.field_access; + bool needs_redo = false; + auto expected_typespec = expected_type.typespec(); + if (tag->selected_possibility >= 0) { + if (!dts.ts.tc(expected_typespec, tag->possibilities.at(tag->selected_possibility).type)) { + // we picked something, but it no longer matches this constraint... + needs_redo = true; + } + } + if (tag->selected_possibility < 0) { + needs_redo = true; + } + if (needs_redo) { + int best_idx = 0; // if nothing else matches, use 0. + for (size_t ci = 0; ci < tag->possibilities.size(); ci++) { + if (dts.ts.tc(expected_typespec, tag->possibilities.at(ci).type)) { + // match! + best_idx = ci; // first is highest scored, so don't bother with the rest. + break; + } + } + + if (best_idx != tag->selected_possibility) { + tag->selected_possibility = best_idx; + return true; + } else { + // failed again, in the same way, no need to update (it'll become a cast...) + return false; + } + } else { + return false; // no need to update + } + + } break; + + default: + ASSERT_MSG(false, fmt::format("unhandled tag: {}\n", (int)actual_type.tag.kind)); + } +} +} // namespace types2 + +/*! + * Update a type state so the given type_out has the type for the specified label. + * If the label is unknown, this will set up a tag. But that's not implemented yet... + */ +void types2_for_label(types2::Type& type_out, + types2::Instruction& instr, + int label_idx, + const Env& env, + const types2::TypePropExtras& extras) { + // first, see if the label type is known (either through obvious auto-detect, or a cast) + + auto known_type = try_get_type_of_label(label_idx, env); + if (known_type) { + type_out.type = known_type; + return; + } else { + if (instr.unknown_label_tag) { + auto& tag = instr.unknown_label_tag; + if (tag->selected_type) { + // resolved tag, use that + type_out.type = TP_Type::make_from_ts(*tag->selected_type); + return; + } else { + // unresolved tag, do nothing and hope for the best. + type_out.type = {}; + return; + } + } else { + // no tag. + if (extras.tags_locked) { + // this really shouldn't happen. + throw std::runtime_error(fmt::format("Encountered unknown label {}, but tags were locked.", + env.file->labels.at(label_idx).name)); + } else { + auto& name = env.file->labels.at(label_idx).name; + fmt::print("Encountered unknown label: {}\n", name); + instr.unknown_label_tag = std::make_unique(); + instr.unknown_label_tag->label_idx = label_idx; + instr.unknown_label_tag->label_name = name; + type_out.tag.unknown_label = instr.unknown_label_tag.get(); + type_out.tag.kind = types2::Tag::UNKNOWN_LABEL; + type_out.type = {}; + return; + } + } + } +} + +bool common_int2_case(types2::Type& type_out, + const DecompilerTypeSystem& dts, + TP_Type& arg0_type, + TP_Type& arg1_type) { + if (arg0_type == arg1_type && is_int_or_uint(dts, arg0_type)) { + // both are the same type and both are int/uint, so we assume that we're doing integer math. + // we strip off any weird things like multiplication or integer constant. + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return true; + } + + if (is_int_or_uint(dts, arg0_type) && is_int_or_uint(dts, arg1_type)) { + // usually we would want to use arg0's type as the "winning" type. + // but we use arg1's if arg0 is an integer constant + // in either case, strip off weird stuff. + if (arg0_type.is_integer_constant() && !arg1_type.is_integer_constant()) { + type_out.type = TP_Type::make_from_ts(arg1_type.typespec()); + return true; + } + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return true; + } + + return false; +} + +/*! + * Update a type state so the given type_out has the type for the result of a right shift. + */ +void types2_for_right_shift(types2::Type& type_out, + const SimpleExpression& expr, + bool is_unsigned, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + // bitfield access, with a single shift + + if (expr.get_arg(1).is_int()) { + auto bf = dynamic_cast(dts.ts.lookup_type(arg0_type.typespec())); + // skip time-frame: we're probably doing math and we know it has no fields in it. + // note: we could be a bit more robust with this detection... + if (bf && arg0_type.typespec() != TypeSpec("time-frame")) { + int shift_size = 64; + int size = shift_size - expr.get_arg(1).get_int(); + int start_bit = shift_size - size; + auto field = find_field(dts.ts, bf, start_bit, size, is_unsigned); + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(field.type())); + return; + } + } + + if (arg0_type.kind == TP_Type::Kind::LEFT_SHIFTED_BITFIELD && expr.get_arg(1).is_int()) { + // second op in left/right shift combo + int end_bit = 64 - arg0_type.get_left_shift(); + if (arg0_type.pcpyud()) { + end_bit += 64; + } + + int size = 64 - expr.get_arg(1).get_int(); + int start_bit = end_bit - size; + if (start_bit < 0) { + throw std::runtime_error("Bad bitfield start bit"); + } + + auto type = dts.ts.lookup_type(arg0_type.get_bitfield_type()); + auto as_bitfield = dynamic_cast(type); + ASSERT(as_bitfield); + auto field = find_field(dts.ts, as_bitfield, start_bit, size, is_unsigned); + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(field.type())); + return; + } + + if (is_signed(dts, arg0_type)) { + type_out.type = TP_Type::make_from_ts("int"); + } else { + type_out.type = TP_Type::make_from_ts("uint"); + } + + // common_int2_case(type_out, dts, arg0_type, arg1_type); +} + +void types2_for_left_shift(types2::Type& type_out, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts) { + auto arg0_type = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type) { + // fail! + type_out.type = {}; + return; + } + + // multiplication by constant power of two, optimized to a shift. + if (expr.get_arg(1).is_int() && is_int_or_uint(dts, *arg0_type)) { + ASSERT(expr.get_arg(1).get_int() >= 0); + ASSERT(expr.get_arg(1).get_int() < 64); + // this could be a bitfield access or a multiply. + // we pick bitfield access if the parent is a bitfield. + if (dynamic_cast(dts.ts.lookup_type(arg0_type->typespec()))) { + type_out.type = TP_Type::make_from_left_shift_bitfield(arg0_type->typespec(), + expr.get_arg(1).get_int(), false); + return; + } else if (arg0_type->kind == TP_Type::Kind::PCPYUD_BITFIELD) { + type_out.type = TP_Type::make_from_left_shift_bitfield(arg0_type->get_bitfield_type(), + expr.get_arg(1).get_int(), true); + return; + } else { + type_out.type = + TP_Type::make_from_product(1ull << expr.get_arg(1).get_int(), is_signed(dts, *arg0_type)); + return; + } + } + + if (expr.get_arg(1).is_int() && dts.ts.tc(TypeSpec("pointer"), arg0_type->typespec())) { + // allow shifting a pointer to put it in a bitfield. + type_out.type = TP_Type::make_from_ts(TypeSpec("uint")); + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg1_type = *arg1_type_info; + + if (arg0_type == arg1_type && is_int_or_uint(dts, *arg0_type)) { + // both are the same type and both are int/uint, so we assume that we're doing integer math. + // we strip off any weird things like multiplication or integer constant. + type_out.type = TP_Type::make_from_ts(arg0_type->typespec()); + return; + } + + if (is_int_or_uint(dts, *arg0_type) && is_int_or_uint(dts, arg1_type)) { + // usually we would want to use arg0's type as the "winning" type. + // but we use arg1's if arg0 is an integer constant + // in either case, strip off weird stuff. + if (arg0_type->is_integer_constant() && !arg1_type.is_integer_constant()) { + type_out.type = TP_Type::make_from_ts(arg1_type.typespec()); + return; + } + type_out.type = TP_Type::make_from_ts(arg0_type->typespec()); + return; + } + + // last fallback + type_out.type = TP_Type::make_from_ts("int"); +} + +void types2_for_int_constant(types2::Type& type_out, + types2::Instruction& output_instr, + SimpleAtom& atom, + bool tag_lock) { + if (output_instr.int_or_float) { + auto& tag = output_instr.int_or_float; + if (tag->is_float.has_value()) { + bool is_float = tag->is_float.value(); + if (is_float) { + atom.mark_as_float(); + type_out.type = TP_Type::make_from_ts("float"); + return; + } else { + type_out.type = TP_Type::make_from_integer(atom.get_int()); + return; + } + } else { + // don't know, just guess int + type_out.type = TP_Type::make_from_integer(atom.get_int()); + return; + } + } else { + // no tag, add one and guess int. + if (!tag_lock) { + output_instr.int_or_float = std::make_unique(); + auto& tag = output_instr.int_or_float; + + type_out.tag.kind = types2::Tag::INT_OR_FLOAT; + type_out.tag.int_or_float = tag.get(); + } else { + // this one really shouldn't be possible... + lg::warn("Tag lock prevented tag creation in types2_for_int_constant"); + } + + type_out.type = TP_Type::make_from_integer(atom.get_int()); + + return; + } +} + +void types2_for_atom(types2::Type& type_out, + types2::Instruction& output_instr, + types2::TypeState& input_types, + SimpleAtom& atom, + const Env& env, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + switch (atom.get_kind()) { + case SimpleAtom::Kind::STATIC_ADDRESS: + types2_for_label(type_out, output_instr, atom.label(), env, extras); + return; + case SimpleAtom::Kind::SYMBOL_VAL: { + auto type = get_type_symbol_val(atom.get_str(), dts, env); + type_out.type = type; + } break; + case SimpleAtom::Kind::SYMBOL_PTR: { + auto type = get_type_symbol_ptr(atom.get_str()); + type_out.type = type; + } break; + case SimpleAtom::Kind::INTEGER_CONSTANT: { + // auto type = TP_Type::make_from_integer(atom.get_int()); + // type_out.type = type; + types2_for_int_constant(type_out, output_instr, atom, extras.tags_locked); + } break; + case SimpleAtom::Kind::EMPTY_LIST: { + auto type = TP_Type::make_from_ts("pair"); + type_out.type = type; + } break; + case SimpleAtom::Kind::VARIABLE: { + auto& in = input_types[atom.var().reg()]; + type_out.type = in->type; + // not 100% sure how this should work... + type_out.tag = in->tag; + } break; + default: + ASSERT_MSG(false, fmt::format("Unhandled types2_for_atom: {}\n", atom.to_string(env))); + } +} + +void types2_for_fpr_to_gpr(types2::Type& type_out, + types2::Instruction& output_instr, + SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // for now, we'll just copy the type. + types2_for_atom(type_out, output_instr, input_types, expr.get_arg(0), env, dts, extras); +} + +void types2_for_gpr_to_fpr(types2::Type& type_out, + types2::Instruction& output_instr, + SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // for now, we'll just copy the type. + types2_for_atom(type_out, output_instr, input_types, expr.get_arg(0), env, dts, extras); +} + +void types2_for_integer_mul(types2::Type& type_out, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + bool is_unsigned) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + auto& arg1_type = *arg1_type_info; + + if (arg0_type.is_integer_constant() && is_int_or_uint(dts, arg1_type)) { + type_out.type = + TP_Type::make_from_product(arg0_type.get_integer_constant(), is_signed(dts, arg0_type)); + return; + } else if (is_int_or_uint(dts, arg0_type) && is_int_or_uint(dts, arg1_type)) { + // signed multiply will always return a signed number. + type_out.type = TP_Type::make_from_ts(is_unsigned ? "uint" : "int"); + return; + } + + if (common_int2_case(type_out, dts, arg0_type, arg1_type)) { + return; + } + + throw std::runtime_error( + fmt::format("Couldn't figure out integer multiplication: {} ({} and {})\n", + expr.to_string(env), arg0_type.print(), arg1_type.print())); +} + +void types2_for_logior(types2::Type& type_out, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + auto& arg1_type = *arg1_type_info; + + if (arg0_type.kind == TP_Type::Kind::PCPYUD_BITFIELD) { + // anding a bitfield should return the bitfield type. + type_out.type = TP_Type::make_from_pcpyud_bitfield(arg0_type.get_bitfield_type()); + return; + } + + if (arg0_type.typespec() == TypeSpec("float") && arg1_type.typespec() == TypeSpec("float")) { + env.func->warnings.warning("Using logior on floats"); + // returning int instead of uint because they like to use the float sign bit as an integer sign + // bit. + type_out.type = TP_Type::make_from_ts(TypeSpec("float")); + return; + } + + if (common_int2_case(type_out, dts, arg0_type, arg1_type)) { + return; + } + throw std::runtime_error(fmt::format("Couldn't figure out logior: {} ({} and {})\n", + expr.to_string(env), arg0_type.print(), arg1_type.print())); +} + +void types2_for_logand(types2::Type& type_out, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + auto& arg1_type = *arg1_type_info; + + if (arg0_type.kind == TP_Type::Kind::PCPYUD_BITFIELD) { + // anding a bitfield should return the bitfield type. + type_out.type = TP_Type::make_from_pcpyud_bitfield(arg0_type.get_bitfield_type()); + return; + } + + if (arg0_type == arg1_type && is_int_or_uint(dts, arg0_type)) { + // both are the same type and both are int/uint, so we assume that we're doing integer math. + // we strip off any weird things like multiplication or integer constant. + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + if (is_int_or_uint(dts, arg0_type) && is_int_or_uint(dts, arg1_type)) { + // usually we would want to use arg0's type as the "winning" type. + // but we use arg1's if arg0 is an integer constant + // in either case, strip off weird stuff. + if (arg0_type.is_integer_constant() && !arg1_type.is_integer_constant()) { + type_out.type = TP_Type::make_from_ts(arg1_type.typespec()); + return; + } + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + if (arg0_type.typespec().base_type() == "pointer" && tc(dts, TypeSpec("integer"), arg1_type)) { + // pointer logand integer = pointer + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } else if (arg1_type.typespec().base_type() == "pointer" && + tc(dts, TypeSpec("integer"), arg0_type)) { + // integer logand pointer = pointer + type_out.type = TP_Type::make_from_ts(arg1_type.typespec()); + return; + } + // base case for and. Just get an integer. + type_out.type = TP_Type::make_from_ts(TypeSpec("int")); +} + +void types2_for_normal_int2(types2::Type& type_out, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + auto& arg1_type = *arg1_type_info; + + if (common_int2_case(type_out, dts, arg0_type, arg1_type)) { + return; + } +} + +void types2_for_div_mod_signed(types2::Type& type_out, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + auto& arg1_type = *arg1_type_info; + + if (is_int_or_uint(dts, arg0_type) && is_int_or_uint(dts, arg1_type)) { + // signed division will always return a signed number. + type_out.type = TP_Type::make_from_ts("int"); + return; + } + + if (common_int2_case(type_out, dts, arg0_type, arg1_type)) { + return; + } + + throw std::runtime_error(fmt::format("Couldn't figure out integer mod/divide: {} ({} and {})\n", + expr.to_string(env), arg0_type.print(), arg1_type.print())); +} + +void types2_for_pcpyld(types2::Type& type_out, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + auto& arg1_type = *arg1_type_info; + + if (arg0_type.kind == TP_Type::Kind::PCPYUD_BITFIELD) { + type_out.type = arg1_type; + return; + } + + type_out.type = TP_Type::make_from_ts("uint"); +} + +void types2_for_sub(types2::Type& type_out, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + auto& arg1_type = *arg1_type_info; + + if (arg0_type == arg1_type && is_int_or_uint(dts, arg0_type)) { + // both are the same type and both are int/uint, so we assume that we're doing integer math. + // we strip off any weird things like multiplication or integer constant. + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + if (is_int_or_uint(dts, arg0_type) && is_int_or_uint(dts, arg1_type)) { + // usually we would want to use arg0's type as the "winning" type. + // but we use arg1's if arg0 is an integer constant + // in either case, strip off weird stuff. + if (arg0_type.is_integer_constant() && !arg1_type.is_integer_constant()) { + type_out.type = TP_Type::make_from_ts(arg1_type.typespec()); + return; + } + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + if (arg0_type.typespec().base_type() == "pointer" && tc(dts, TypeSpec("integer"), arg1_type)) { + // plain pointer plus integer = plain pointer + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + if (arg1_type.typespec().base_type() == "pointer" && tc(dts, TypeSpec("integer"), arg0_type)) { + // plain pointer plus integer = plain pointer + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + if (tc(dts, TypeSpec("structure"), arg0_type) && arg1_type.is_integer_constant()) { + auto type_info = dts.ts.lookup_type(arg0_type.typespec()); + + // get next in memory, allow this as &+/&- + if ((s64)type_info->get_size_in_memory() == std::abs((s64)arg1_type.get_integer_constant())) { + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + // also allow it, if 16-byte aligned stride. + if ((u64)align16(type_info->get_size_in_memory()) == arg1_type.get_integer_constant()) { + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + } + + if (tc(dts, TypeSpec("pointer"), arg0_type) && tc(dts, TypeSpec("pointer"), arg1_type)) { + type_out.type = TP_Type::make_from_ts(TypeSpec("int")); + return; + } + + if (tc(dts, TypeSpec("structure"), arg1_type) && !expr.get_arg(0).is_int() && + is_int_or_uint(dts, arg0_type)) { + // byte access of offset array field trick. + // arg1 holds a structure. + // arg0 is an integer in a register. + type_out.type = TP_Type::make_object_plus_product(arg1_type.typespec(), 1, true); + return; + } + + if (common_int2_case(type_out, dts, arg0_type, arg1_type)) { + return; + } + throw std::runtime_error(fmt::format("Couldn't figure out integer subtract: {} ({} and {})\n", + expr.to_string(env), arg0_type.print(), arg1_type.print())); +} + +void types2_addr_on_stack(types2::Type& type_out, + types2::Instruction& instr, + int offset, + const Env& env, + const DecompilerTypeSystem& dts, + const types2::TypeState& types, + bool tag_lock) { + (void)dts; + + // first look for a stack structure + for (auto& structure : env.stack_structure_hints()) { + if (offset < structure.hint.stack_offset || + offset >= (structure.hint.stack_offset + structure.size)) { + continue; // reject, it isn't in this variable + } + + if (offset == structure.hint.stack_offset) { + // special case just getting the variable + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(structure.ref_type)); + return; + } + } + + // look for a stack variable + auto sss = types.try_find_stack_spill_slot(offset); + if (sss && sss->type) { + type_out.type = TP_Type::make_from_ts(TypeSpec("pointer", {sss->type->typespec()})); + return; + } + + // Neither matched... see if there's a tag. + if (instr.unknown_stack_structure_tag) { + auto& tag = instr.unknown_stack_structure_tag; + if (tag->selected_type) { + // use the resolved tag! + type_out.type = TP_Type::make_from_ts(*tag->selected_type); + return; + } else { + // unresolved tag, do nothing and hope for the best. + type_out.type = {}; + return; + } + } else { + // no tag. can we create one? + if (tag_lock) { + // nope. + throw std::runtime_error( + fmt::format("Failed to find a stack variable or structure at offset {}", offset)); + } else { + fmt::print("Encountered unknown stack address {} : {}\n", env.func->name(), offset); + instr.unknown_stack_structure_tag = std::make_unique(); + instr.unknown_stack_structure_tag->stack_offset = offset; + type_out.tag.unknown_stack_structure = instr.unknown_stack_structure_tag.get(); + type_out.tag.kind = types2::Tag::UNKNOWN_STACK_STRUCTURE; + type_out.type = {}; + return; + } + } +} + +void types2_for_add(types2::Type& type_out, + types2::Instruction& output_instr, + const SimpleExpression& expr, + const Env& env, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + auto arg0_type_info = try_get_type_of_atom(input_types, expr.get_arg(0), env, dts); + if (!arg0_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto arg1_type_info = try_get_type_of_atom(input_types, expr.get_arg(1), env, dts); + if (!arg1_type_info) { + // fail! + type_out.type = {}; + return; + } + + auto& arg0_type = *arg0_type_info; + auto& arg1_type = *arg1_type_info; + auto& arg0 = expr.get_arg(0); + auto& arg1 = expr.get_arg(1); + + // the approach here is just to try a bunch of things. + // this is a bit of a mess, but I don't know another way. Add is a very useful instruction. + + // access the stack - either a stack variable or structure. + if (arg0.is_var() && arg0.var().reg() == Register(Reg::GPR, Reg::SP) && arg1.is_int()) { + // get_stack_type_at_constant_offset(arg1.get_int(), env, dts, input); + types2_addr_on_stack(type_out, output_instr, arg1.get_int(), env, dts, input_types, + extras.tags_locked); + return; + } + + // if things go wrong, and we add a pointer to another address, just return int + // honestly not sure why I have this one... let's have it abort for now. + if (arg0_type.kind == TP_Type::Kind::OBJECT_PLUS_PRODUCT_WITH_CONSTANT && + arg1_type.typespec().base_type() == "pointer") { + ASSERT(false); + // return TP_Type::make_from_ts(TypeSpec("int")); + } + + // special case: dynamic access to the method table, to look up a method by ID. + if (arg0_type.is_product_with(4) && tc(dts, TypeSpec("type"), arg1_type) && + env.func->name() != "overrides-parent-method?" // hack! + ) { + // dynamic access into the method array with shift, add, offset-load + // no need to track the type because we don't know the method index anyway. + type_out.type = TP_Type::make_partial_dyanmic_vtable_access(); + return; + } + + // propagate integer math: a * C1 + C2 + if (arg1_type.is_integer_constant() && arg0_type.kind == TP_Type::Kind::PRODUCT_WITH_CONSTANT) { + type_out.type = TP_Type::make_from_integer_constant_plus_product( + arg1_type.get_integer_constant(), arg0_type.typespec(), arg0_type.get_multiplier()); + return; + } + + // propagate integer math: a + C1 + if (arg1_type.is_integer_constant() && is_int_or_uint(dts, arg0_type)) { + type_out.type = TP_Type::make_from_integer_constant_plus_var(arg1_type.get_integer_constant(), + arg0_type.typespec()); + return; + } + + // get addr of field using obj + C1 + a * C2 + if (arg0_type.kind == TP_Type::Kind::INTEGER_CONSTANT_PLUS_VAR_MULT) { + FieldReverseLookupInput rd_in; + rd_in.offset = arg0_type.get_add_int_constant(); + rd_in.stride = arg0_type.get_mult_int_constant(); + rd_in.base_type = arg1_type.typespec(); + auto out = env.dts->ts.reverse_field_multi_lookup(rd_in); + if (out.success) { + if (out.results.size() == 1) { + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(out.results.front().result_type)); + return; + } else { + types2_from_ambiguous_deref(output_instr, type_out, out.results, extras.tags_locked); + return; + } + } + // flipped version of the above + } else if (arg1_type.kind == TP_Type::Kind::INTEGER_CONSTANT_PLUS_VAR_MULT) { + FieldReverseLookupInput rd_in; + rd_in.offset = arg1_type.get_add_int_constant(); + rd_in.stride = arg1_type.get_mult_int_constant(); + rd_in.base_type = arg0_type.typespec(); + auto out = env.dts->ts.reverse_field_multi_lookup(rd_in); + if (out.success) { + if (out.results.size() == 1) { + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(out.results.front().result_type)); + return; + } else { + types2_from_ambiguous_deref(output_instr, type_out, out.results, extras.tags_locked); + return; + } + } + } + + // get addr of field using obj + C1 + a (effectively a stride of 1) + if (arg0_type.kind == TP_Type::Kind::INTEGER_CONSTANT_PLUS_VAR) { + FieldReverseLookupInput rd_in; + rd_in.offset = arg0_type.get_integer_constant(); + rd_in.stride = 1; + rd_in.base_type = arg1_type.typespec(); + auto out = env.dts->ts.reverse_field_multi_lookup(rd_in); + if (out.success) { + if (out.results.size() == 1) { + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(out.results.front().result_type)); + return; + } else { + types2_from_ambiguous_deref(output_instr, type_out, out.results, extras.tags_locked); + return; + } + } + } + + if (common_int2_case(type_out, dts, arg0_type, arg1_type)) { + return; + } + + // get addr of field with a constant: obj + C1 + if (arg1.is_int() && arg0_type.kind == TP_Type::Kind::TYPESPEC) { + // access a field. + FieldReverseLookupInput rd_in; + rd_in.deref = std::nullopt; + rd_in.stride = 0; + rd_in.offset = arg1.get_int(); + rd_in.base_type = arg0_type.typespec(); + auto out = env.dts->ts.reverse_field_multi_lookup(rd_in); + if (out.success) { + if (out.results.size() == 1) { + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(out.results.front().result_type)); + return; + } else { + types2_from_ambiguous_deref(output_instr, type_out, out.results, extras.tags_locked); + return; + } + } + } + + // access with just product and no offset. + if (arg0_type.kind == TP_Type::Kind::TYPESPEC && + arg0_type.typespec().base_type() == "inline-array" && + arg1_type.kind == TP_Type::Kind::PRODUCT_WITH_CONSTANT) { + FieldReverseLookupInput rd_in; + rd_in.deref = std::nullopt; + rd_in.stride = arg1_type.get_multiplier(); + rd_in.offset = 0; + rd_in.base_type = arg0_type.typespec(); + auto rd = dts.ts.reverse_field_multi_lookup(rd_in); + + std::vector filtered_results; + for (auto& result : rd.results) { + if (result.has_variable_token()) { + filtered_results.push_back(result); + } + } + + if (filtered_results.size() == 1) { + type_out.type = + TP_Type::make_from_ts(coerce_to_reg_type(filtered_results.front().result_type)); + return; + } else { + types2_from_ambiguous_deref(output_instr, type_out, filtered_results, extras.tags_locked); + return; + } + } + + // flipped of above + if (arg1_type.kind == TP_Type::Kind::TYPESPEC && + arg1_type.typespec().base_type() == "inline-array" && + arg0_type.kind == TP_Type::Kind::PRODUCT_WITH_CONSTANT) { + FieldReverseLookupInput rd_in; + rd_in.deref = std::nullopt; + rd_in.stride = arg0_type.get_multiplier(); + rd_in.offset = 0; + rd_in.base_type = arg1_type.typespec(); + auto rd = dts.ts.reverse_field_multi_lookup(rd_in); + std::vector filtered_results; + for (auto& result : rd.results) { + if (result.has_variable_token()) { + filtered_results.push_back(result); + } + } + + if (filtered_results.size() == 1) { + type_out.type = + TP_Type::make_from_ts(coerce_to_reg_type(filtered_results.front().result_type)); + return; + } else { + ASSERT(false); + } + } + + if (arg0_type.is_product() && arg1_type.kind == TP_Type::Kind::TYPESPEC) { + type_out.type = + TP_Type::make_object_plus_product(arg1_type.typespec(), arg0_type.get_multiplier(), true); + return; + } + + if (arg1_type.is_product() && arg0_type.kind == TP_Type::Kind::TYPESPEC) { + type_out.type = + TP_Type::make_object_plus_product(arg0_type.typespec(), arg1_type.get_multiplier(), false); + return; + } + + if (arg0_type.typespec().base_type() == "pointer" && tc(dts, TypeSpec("integer"), arg1_type)) { + if (!arg1.is_int()) { + type_out.type = TP_Type::make_object_plus_product(arg0_type.typespec(), 1, false); + return; + } + // plain pointer plus integer = plain pointer + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + if (arg1_type.typespec().base_type() == "pointer" && tc(dts, TypeSpec("integer"), arg0_type)) { + // plain pointer plus integer = plain pointer + type_out.type = TP_Type::make_from_ts(arg1_type.typespec()); + return; + } + + if (tc(dts, TypeSpec("structure"), arg0_type) && arg1_type.is_integer_constant()) { + auto type_info = dts.ts.lookup_type(arg0_type.typespec()); + + // get next in memory, allow this as &+/&- + if ((s64)type_info->get_size_in_memory() == std::abs((s64)arg1_type.get_integer_constant())) { + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + + // also allow it, if 16-byte aligned stride. + if ((u64)align16(type_info->get_size_in_memory()) == arg1_type.get_integer_constant()) { + type_out.type = TP_Type::make_from_ts(arg0_type.typespec()); + return; + } + } + + if (tc(dts, TypeSpec("pointer"), arg0_type) && tc(dts, TypeSpec("pointer"), arg1_type)) { + type_out.type = TP_Type::make_from_ts(TypeSpec("int")); + return; + } + + auto& name = env.func->guessed_name; + if (name.kind == FunctionName::FunctionKind::METHOD && name.method_id == 7 && + env.func->type.arg_count() == 3) { + if (arg1_type.typespec() == TypeSpec("int")) { + type_out.type = arg0_type; + return; + } + } + + if (tc(dts, TypeSpec("structure"), arg1_type) && !expr.get_arg(0).is_int() && + is_int_or_uint(dts, arg0_type)) { + if (arg1_type.typespec() == TypeSpec("symbol") && + arg0_type.is_integer_constant(DECOMP_SYM_INFO_OFFSET + POINTER_SIZE)) { + // symbol -> GOAL String + // NOTE - the offset doesn't fit in a s16, so it's loaded into a register first. + // so we expect the arg to be a variable, and the type propagation will figure out the + // integer constant. + type_out.type = TP_Type::make_from_ts(dts.ts.make_pointer_typespec("string")); + return; + } else { + // byte access of offset array field trick. + // arg1 holds a structure. + // arg0 is an integer in a register. + type_out.type = TP_Type::make_object_plus_product(arg1_type.typespec(), 1, true); + return; + } + } + + if (env.version == GameVersion::Jak2 && tc(dts, TypeSpec("symbol"), arg1_type) && + is_int_or_uint(dts, arg0_type)) { + if (arg0_type.is_integer_constant(jak2::SYM_TO_STRING_OFFSET)) { + // symbol -> GOAL String + // NOTE - the offset doesn't fit in a s16, so it's loaded into a register first. + // so we expect the arg to be a variable, and the type propagation will figure out the + // integer constant. + type_out.type = TP_Type::make_from_ts(dts.ts.make_pointer_typespec("string")); + return; + } + } + + fmt::print("checks: {} {} {}\n", tc(dts, TypeSpec("structure"), arg1_type), + !expr.get_arg(0).is_int(), is_int_or_uint(dts, arg0_type)); + + throw std::runtime_error( + fmt::format("add failed: {} {}\n", arg0_type.print(), arg1_type.print())); + // ASSERT_MSG(false, fmt::format("add failed: {} {}\n", arg0_type.print(), arg1_type.print())); +} + +void types2_for_normal_all_float(types2::Type& type_out, + const SimpleExpression& expr, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // backprop to make inputs floats + for (int i = 0; i < expr.args(); i++) { + auto& arg = expr.get_arg(i); + auto& arg_type = input_types[arg.var().reg()]; + if (arg_type->tag.has_tag()) { + if (types2::backprop_tagged_type(TP_Type::make_from_ts("float"), *arg_type, dts)) { + extras.needs_rerun = true; + } + } + } + + type_out.type = TP_Type::make_from_ts(TypeSpec("float")); +} + +void types2_for_vectors_in_float_out(types2::Type& type_out, + const SimpleExpression& expr, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // backprop to make inputs vector + for (int i = 0; i < expr.args(); i++) { + auto& arg = expr.get_arg(i); + auto& arg_type = input_types[arg.var().reg()]; + if (arg_type->tag.has_tag()) { + if (types2::backprop_tagged_type(TP_Type::make_from_ts("vector"), *arg_type, dts)) { + extras.needs_rerun = true; + } + } + } + + type_out.type = TP_Type::make_from_ts(TypeSpec("float")); +} + +void types2_for_vector_in_and_out(types2::Type& type_out, + const SimpleExpression& expr, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // backprop to make inputs vector + for (int i = 0; i < expr.args(); i++) { + auto& arg = expr.get_arg(i); + auto& arg_type = input_types[arg.var().reg()]; + if (arg_type->tag.has_tag()) { + if (types2::backprop_tagged_type(TP_Type::make_from_ts("vector"), *arg_type, dts)) { + extras.needs_rerun = true; + } + } + } + + type_out.type = TP_Type::make_from_ts(TypeSpec("vector")); +} + +void types2_for_vector_float_product(types2::Type& type_out, + const SimpleExpression& expr, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // backprop to make inputs vector + for (int i = 0; i < expr.args(); i++) { + auto& arg = expr.get_arg(i); + auto& arg_type = input_types[arg.var().reg()]; + if (arg_type->tag.has_tag()) { + if (types2::backprop_tagged_type(TP_Type::make_from_ts(i == 0 ? "vector" : "float"), + *arg_type, dts)) { + extras.needs_rerun = true; + } + } + } + + type_out.type = TP_Type::make_from_ts(TypeSpec("vector")); +} + +void types2_for_float_to_int(types2::Type& type_out, + const SimpleExpression& expr, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + auto& arg = expr.get_arg(0); + auto& arg_type = input_types[arg.var().reg()]; + if (arg_type->tag.has_tag()) { + if (types2::backprop_tagged_type(TP_Type::make_from_ts("float"), *arg_type, dts)) { + extras.needs_rerun = true; + } + } + type_out.type = TP_Type::make_from_ts(TypeSpec("int")); +} + +void types2_for_int_to_float(types2::Type& type_out, + const SimpleExpression& expr, + types2::TypeState& input_types, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // backprop here might be bad... + auto& arg = expr.get_arg(0); + auto& arg_type = input_types[arg.var().reg()]; + if (arg_type->tag.has_tag()) { + if (types2::backprop_tagged_type(TP_Type::make_from_ts("int"), *arg_type, dts)) { + extras.needs_rerun = true; + } + } + type_out.type = TP_Type::make_from_ts(TypeSpec("float")); +} + +void types2_for_normal_int1(types2::Type& type_out, + const SimpleExpression& expr, + types2::TypeState& input_types) { + type_out.type = {}; + auto& input_type = input_types[expr.get_arg(0).var().reg()]; + if (input_type->type) { + type_out.type = input_type->type; + } +} + +void types2_for_expr(types2::Type& type_out, + types2::Instruction& output_instr, + types2::TypeState& input_types, + SimpleExpression& expr, + const Env& env, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + switch (expr.kind()) { + case SimpleExpression::Kind::IDENTITY: + types2_for_atom(type_out, output_instr, input_types, expr.get_arg(0), env, dts, extras); + break; + case SimpleExpression::Kind::RIGHT_SHIFT_ARITH: + types2_for_right_shift(type_out, expr, false, env, input_types, dts); + break; + case SimpleExpression::Kind::RIGHT_SHIFT_LOGIC: + types2_for_right_shift(type_out, expr, true, env, input_types, dts); + break; + case SimpleExpression::Kind::LEFT_SHIFT: + types2_for_left_shift(type_out, expr, env, input_types, dts); + break; + case SimpleExpression::Kind::FPR_TO_GPR: + types2_for_fpr_to_gpr(type_out, output_instr, expr, env, input_types, dts, extras); + break; + case SimpleExpression::Kind::ADD: + types2_for_add(type_out, output_instr, expr, env, input_types, dts, extras); + break; + case SimpleExpression::Kind::GPR_TO_FPR: + types2_for_gpr_to_fpr(type_out, output_instr, expr, env, input_types, dts, extras); + break; + case SimpleExpression::Kind::DIV_S: + case SimpleExpression::Kind::MIN_S: + case SimpleExpression::Kind::SUB_S: + case SimpleExpression::Kind::MAX_S: + case SimpleExpression::Kind::MUL_S: + case SimpleExpression::Kind::ADD_S: + case SimpleExpression::Kind::ABS_S: + case SimpleExpression::Kind::NEG_S: + case SimpleExpression::Kind::SQRT_S: + types2_for_normal_all_float(type_out, expr, input_types, dts, extras); + break; + case SimpleExpression::Kind::SUB: + types2_for_sub(type_out, expr, env, input_types, dts); + break; + case SimpleExpression::Kind::MUL_SIGNED: + types2_for_integer_mul(type_out, expr, env, input_types, dts, false); + break; + case SimpleExpression::Kind::MUL_UNSIGNED: + types2_for_integer_mul(type_out, expr, env, input_types, dts, true); + break; + case SimpleExpression::Kind::DIV_SIGNED: + case SimpleExpression::Kind::MOD_SIGNED: + types2_for_div_mod_signed(type_out, expr, env, input_types, dts); + break; + case SimpleExpression::Kind::NEG: + case SimpleExpression::Kind::MIN_SIGNED: + case SimpleExpression::Kind::MAX_SIGNED: + case SimpleExpression::Kind::SUBU_L32_S7: + type_out.type = TP_Type::make_from_ts("int"); // ? + break; + case SimpleExpression::Kind::OR: + types2_for_logior(type_out, expr, env, input_types, dts); + break; + case SimpleExpression::Kind::AND: + types2_for_logand(type_out, expr, env, input_types, dts); + break; + case SimpleExpression::Kind::NOR: + case SimpleExpression::Kind::XOR: + types2_for_normal_int2(type_out, expr, env, input_types, dts); + break; + case SimpleExpression::Kind::LOGNOT: + types2_for_normal_int1(type_out, expr, input_types); + break; + case SimpleExpression::Kind::FLOAT_TO_INT: + types2_for_float_to_int(type_out, expr, input_types, dts, extras); + break; + case SimpleExpression::Kind::INT_TO_FLOAT: + types2_for_int_to_float(type_out, expr, input_types, dts, extras); + break; + case SimpleExpression::Kind::VECTOR_3_DOT: + case SimpleExpression::Kind::VECTOR_4_DOT: + case SimpleExpression::Kind::VECTOR_LENGTH: + types2_for_vectors_in_float_out(type_out, expr, input_types, dts, extras); + break; + case SimpleExpression::Kind::VECTOR_CROSS: + case SimpleExpression::Kind::VECTOR_MINUS: + case SimpleExpression::Kind::VECTOR_PLUS: + types2_for_vector_in_and_out(type_out, expr, input_types, dts, extras); + break; + case SimpleExpression::Kind::VECTOR_FLOAT_PRODUCT: + types2_for_vector_float_product(type_out, expr, input_types, dts, extras); + case SimpleExpression::Kind::PCPYLD: + types2_for_pcpyld(type_out, expr, env, input_types, dts); + break; + default: + throw std::runtime_error( + fmt::format("Unhandled types2_for_expr: {} {}\n", expr.to_string(env), (int)expr.kind())); + } +} + +void SetVarOp::propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // propagate types on the expression. Will also handle backprop of constraints, etc. + auto* type_out = instr.types[m_dst.reg()]; + types2_for_expr(*type_out, instr, input_types, m_src, env, dts, extras); + + // remember this. It's used later, to insert better looking casts. + if (type_out->type) { + m_source_type = type_out->type->typespec(); + } + + // update clobbers. + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } +} + +void AsmOp::propagate_types2(types2::Instruction& instr, + const Env& /*env*/, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& /*extras*/) { + // update clobbers. + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } + + auto& out = instr.types; + + if (m_instr.kind == InstructionKind::QMFC2) { + ASSERT(m_dst); + out[m_dst->reg()]->type = TP_Type::make_from_ts("float"); + // ASSERT(false); // hack... not sure float is right here... lets do more testing first. + return; + } + + // can be used for asm or bitfield. earlier passes mark it asm, we catch it in types, + // and set the tp_types. + if (m_instr.kind == InstructionKind::PCPYUD) { + if (m_src[1] && m_src[1]->reg() == Register(Reg::GPR, Reg::R0)) { + ASSERT(m_src[0]); + auto& in_type = input_types[m_src[0]->reg()]; + if (in_type->type) { + auto bf = dynamic_cast(dts.ts.lookup_type(in_type->type->typespec())); + if (bf) { + ASSERT(m_dst); + // just mark as pcpyud, it's part of a longer chain... + out[m_dst->reg()]->type = TP_Type::make_from_pcpyud_bitfield(in_type->type->typespec()); + return; + } + } + } + } + + // pextuw t0, r0, gp + if (m_instr.kind == InstructionKind::PEXTUW) { + if (m_src[0] && m_src[0]->reg() == Register(Reg::GPR, Reg::R0)) { + ASSERT(m_src[1]); + auto& in_type = input_types[m_src[1]->reg()]->type; + if (in_type) { + auto type = dts.ts.lookup_type(in_type->typespec()); + auto as_bitfield = dynamic_cast(type); + if (as_bitfield) { + auto field = find_field(dts.ts, as_bitfield, 64, 32, true); + ASSERT(m_dst); + out[m_dst->reg()]->type = TP_Type::make_from_ts(field.type()); + return; + } + } + } + } + + // sllv out, in, r0 + // this is recognized as asm (because it usually is) but it can be used in bitfields to extract + // the low 32-bits + if (m_instr.kind == InstructionKind::SLLV && + instruction().src[1].is_reg(Register(Reg::GPR, Reg::R0))) { + // check input: + auto& src_type = input_types[m_src[0]->reg()]; + if (src_type->type) { + auto type = dts.ts.lookup_type(src_type->type->typespec()); + // see if it's a bitfield type + auto as_bitfield = dynamic_cast(type); + if (as_bitfield) { + // see if we can find a field (throws if we can't) + auto field = find_field(dts.ts, as_bitfield, 0, 32, {}); + // this is a complete extraction, can set the type as the result. + out[m_dst->reg()]->type = TP_Type::make_from_ts(field.type()); + return; + } + } + } + + // srl out, bitfield, int + if (m_instr.kind == InstructionKind::SRL) { + auto& src_type = input_types[m_src[0]->reg()]; + if (src_type) { + auto type = dts.ts.lookup_type(src_type->type->typespec()); + auto as_bitfield = dynamic_cast(type); + if (as_bitfield) { + int sa = m_instr.src[1].get_imm(); + int offset = sa; + int size = 32 - offset; + auto field = find_field(dts.ts, as_bitfield, offset, size, {}); + out[m_dst->reg()]->type = TP_Type::make_from_ts(coerce_to_reg_type(field.type())); + return; + } + } + } + + // general case fallback: if we write a register we should at least set something... + if (m_dst.has_value()) { + auto kind = m_dst->reg().get_kind(); + if (kind == Reg::FPR) { + // if we set a fpr, just assume float + out[m_dst->reg()]->type = TP_Type::make_from_ts("float"); + } else if (kind == Reg::GPR) { + // if we're a gpr, and any + for (auto& x : m_src) { + if (x && x->reg().get_kind() == Reg::GPR) { + // if any sources are known to be 128-bit integers, use uint128 as the output + auto src_type = input_types[x->reg()]; + if (!src_type->type) { + continue; + } + auto src_ts = src_type->type->typespec(); + if (dts.ts.tc(TypeSpec("int128"), src_ts) || dts.ts.tc(TypeSpec("uint128"), src_ts)) { + out[m_dst->reg()]->type = TP_Type::make_from_ts("uint128"); + return; + } + } + // otherwise just use int... + out[m_dst->reg()]->type = TP_Type::make_from_ts("int"); + } + } + } +} + +void SetVarConditionOp::propagate_types2(types2::Instruction& instr, + const Env& /*env*/, + types2::TypeState& /*input_types*/, + DecompilerTypeSystem& /*dts*/, + types2::TypePropExtras& /*extras*/) { + // update clobbers. + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } + instr.types[m_dst.reg()]->type = TP_Type::make_from_ts("symbol"); +} + +/*! + * Run type propagation on a store to memory (does not include stack spill stores) + * Normally, we don't have to do anything here, but there are 3 special cases: + * - if we're storing something in the current process next-state as part of a go, the type pass + * needs to track this, to determine the number of arguments for the updating go. + * - we can backprop type information on the value being stored + * - we can backprop type information on the location we're storing to. + */ +void StoreOp::propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // backprop on the value being stored. + { + if (m_value.is_var()) { // only applicable if we're storing a var + auto reg = m_value.var().reg(); + if (reg.get_kind() != Reg::VF) { + const auto& value_type = input_types[m_value.var().reg()]; + if (value_type->tag.has_tag()) { // don't bother if we don't have a tag to resolve + if (m_kind == Kind::FLOAT) { + if (backprop_tagged_type(TP_Type::make_from_ts("float"), *value_type, dts)) { + extras.needs_rerun = true; + } + } else { + auto location_type = try_get_type_of_expr(input_types, m_addr, env, dts); + if (!location_type.empty()) { // need to know where we're storing + + // temp warning if we have multiple store types + if (location_type.size() > 1) { + fmt::print("StoreOp::propagate_types2: multiple possible store types: "); + for (auto& t : location_type) { + fmt::print("{} ", t.print()); + } + fmt::print("\n"); + } + + if (backprop_tagged_type(location_type.at(0), *value_type, dts)) { + extras.needs_rerun = true; + } + } + } + } + } + } + } + + // backprop on the store type + { + // TODO implement this. + // it's a little tricky if there's an offset, let's implement this as we find examples. + } + + // handle the next-state thing + // look for setting the next state of the current process + IR2_RegOffset ro; + if (get_as_reg_offset(m_addr, &ro)) { + if (ro.reg == Register(Reg::GPR, Reg::S6) && + ro.offset == OFFSET_OF_NEXT_STATE_STORE[env.version]) { + ASSERT(m_value.is_var()); + auto& store_type = input_types[m_value.var().reg()]->type; + if (store_type) { + instr.types.next_state_type->type = store_type; + } else { + instr.types.next_state_type->type = TP_Type::make_from_ts("state"); // idk + } + } + } + + // update clobbers. + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } +} + +RegClass get_reg_kind(const Register& r) { + switch (r.get_kind()) { + case Reg::GPR: + return RegClass::GPR_64; + case Reg::FPR: + return RegClass::FLOAT; + default: + ASSERT(false); + return RegClass::INVALID; + } +} + +bool load_var_op_determine_type(types2::Type& type_out, + types2::Instruction& output_instr, + types2::TypeState& input_types, + const LoadVarOp& op, + const Env& env, + const DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + if (op.src().is_identity()) { + auto& src = op.src().get_arg(0); + if (src.is_static_addr()) { + if (op.kind() == LoadVarOp::Kind::FLOAT) { + // assume anything loaded directly to floating point register is a float, and skip the + // rest. + type_out.type = TP_Type::make_from_ts("float"); + return true; + } + + auto label_name = env.file->labels.at(src.label()).name; + const auto& hint = env.file->label_db->lookup(label_name); + if (!hint.known) { + ASSERT(false); // todo + throw std::runtime_error( + fmt::format("Label {} was unknown in AtomicOpTypeAnalysis (type).", hint.name)); + } + + if (!hint.is_value) { + // this one seems fatal + throw std::runtime_error( + fmt::format("Label {} was used as a value, but wasn't marked as one", hint.name)); + } + + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(hint.result_type)); + return true; + } + } + + IR2_RegOffset ro; + if (get_as_reg_offset(op.src(), &ro)) { + auto& input_type_info = input_types[ro.reg]; + if (!input_type_info->type) { + // todo: could try some basic stuff to resolve float loads here... + // ASSERT(false); + return false; + } + auto& input_type = input_type_info->type.value(); + + // check loading a method of a known type. + // the TP_Type system will track individual types, both as a "most specific known at decompile + // time" (TYPE_OF_TYPE_OR_CHILD) or "exact" version (TYPE_OF_TYPE_NO_VIRTUAL) + if ((input_type.kind == TP_Type::Kind::TYPE_OF_TYPE_OR_CHILD || + input_type.kind == TP_Type::Kind::TYPE_OF_TYPE_NO_VIRTUAL) // is known type + && ro.offset >= 16 // is in the method table (16 is the offset of the first method) + && (ro.offset & 3) == 0 // is aligned + && op.size() == 4 // loading a pointer + && op.kind() == LoadVarOp::Kind::UNSIGNED // GOAL convention to load pointers as unsigned + ) { + // method get of fixed type + // here, we look up the actual type signature of the method, which depends on the type. + auto type_name = input_type.get_type_objects_typespec().base_type(); + auto method_id = (ro.offset - 16) / 4; + auto method_info = dts.ts.lookup_method(type_name, method_id); + auto method_type = method_info.type.substitute_for_method_call(type_name); + + // special case: the new method of "object" is the general heap allocation function, + // and is used in (new 'heap 'foo ... ) expressions. + // we'll use a special type for these. + if (type_name == "object" && method_id == GOAL_NEW_METHOD) { + type_out.type = TP_Type::make_object_new(method_type); + return true; + } + + // another special case: calling the new method is never done virtually. so just handle it + // without paying attention to virtual/non-virtual + if (method_id == GOAL_NEW_METHOD) { + type_out.type = TP_Type::make_from_ts(method_type); + return true; + } else if (input_type.kind == TP_Type::Kind::TYPE_OF_TYPE_NO_VIRTUAL) { + // normal non-virtual method access + type_out.type = + TP_Type::make_non_virtual_method(method_type, TypeSpec(type_name), method_id); + return true; + } else { + // normal virtual method access. + type_out.type = TP_Type::make_virtual_method(method_type, TypeSpec(type_name), method_id); + return true; + } + } + + // finally, we have a backup to allow some method access if we have no idea of the exact type. + // we can only do this safely for a few "built in" methods that always take the same arguments + // on all types. + if (input_type.kind == TP_Type::Kind::TYPESPEC // if we've fallen back to plain type + && input_type.typespec() == TypeSpec("type") // and we think it's a type + // and the usual load check + && ro.offset >= 16 && (ro.offset & 3) == 0 && op.size() == 4 && + op.kind() == LoadVarOp::Kind::UNSIGNED) { + // method get of an unknown type. We assume the most general "object" type because that + // will have the correct arguments for built-in methods + auto method_id = (ro.offset - 16) / 4; + // only allow up to MEMUSAGE, the last built-in method. + if (method_id <= (int)GOAL_MEMUSAGE_METHOD) { + auto method_info = dts.ts.lookup_method("object", method_id); + // also block new: you can override the arguments, and relocate: it has two uses: login and + // actual relocated, and it takes different arguments for these cases. + if (method_id != GOAL_NEW_METHOD && method_id != GOAL_RELOC_METHOD) { + // this can get us the wrong thing for `new` methods. And maybe relocate? + type_out.type = TP_Type::make_non_virtual_method( + method_info.type.substitute_for_method_call("object"), TypeSpec("object"), method_id); + return true; + } + } + } + + if (input_type.kind == TP_Type::Kind::OBJECT_PLUS_PRODUCT_WITH_CONSTANT) { + FieldReverseLookupInput rd_in; + DerefKind dk; + dk.is_store = false; + dk.reg_kind = get_reg_kind(ro.reg); + dk.sign_extend = op.kind() == LoadVarOp::Kind::SIGNED; + dk.size = op.size(); + rd_in.deref = dk; + rd_in.base_type = input_type.get_obj_plus_const_mult_typespec(); + rd_in.stride = input_type.get_multiplier(); + rd_in.offset = ro.offset; + auto rd = dts.ts.reverse_field_multi_lookup(rd_in); + if (rd.success) { + if (rd.results.size() == 1) { + type_out.type = TP_Type::make_from_ts(coerce_to_reg_type(rd.results.front().result_type)); + return true; + } else { + types2_from_ambiguous_deref(output_instr, type_out, rd.results, extras.tags_locked); + return true; + } + } + } + + if (input_type.kind == TP_Type::Kind::TYPESPEC && ro.offset == -4 && + op.kind() == LoadVarOp::Kind::UNSIGNED && op.size() == 4 && ro.reg.get_kind() == Reg::GPR) { + // get type of basic likely, but misrecognized as an object. + + type_out.type = TP_Type::make_type_allow_virtual_object(input_type.typespec().base_type()); + return true; + } + + if (input_type.kind == TP_Type::Kind::DYNAMIC_METHOD_ACCESS && ro.offset == 16) { + // access method vtable. The input is type + (4 * method), and the 16 is the offset + // of method 0. + type_out.type = TP_Type::make_from_ts(TypeSpec("function")); + return true; + } + + // Assume we're accessing a field of an object. + // if we are a pair with sloppy typing, don't use this and instead use the case down below. + if (input_type.typespec() != TypeSpec("pair") || !env.allow_sloppy_pair_typing()) { + FieldReverseLookupInput rd_in; + DerefKind dk; + dk.is_store = false; + dk.reg_kind = get_reg_kind(ro.reg); + dk.sign_extend = op.kind() == LoadVarOp::Kind::SIGNED; + dk.size = op.size(); + rd_in.deref = dk; + rd_in.base_type = input_type.typespec(); + rd_in.stride = 0; + rd_in.offset = ro.offset; + auto rd = dts.ts.reverse_field_multi_lookup(rd_in); + + if (rd.success) { + if (rd.results.size() == 1) { + if (rd_in.base_type.base_type() == "state" && rd.results.front().tokens.size() == 1 && + rd.results.front().tokens.front().kind == + FieldReverseLookupOutput::Token::Kind::FIELD && + rd.results.front().tokens.front().name == "enter" && + rd_in.base_type.arg_count() > 0) { + // special case for accessing the enter field of state + type_out.type = + TP_Type::make_from_ts(state_to_go_function(rd_in.base_type, TypeSpec("none"))); + return true; + } else { + type_out.type = + TP_Type::make_from_ts(coerce_to_reg_type(rd.results.front().result_type)); + return true; + } + } else { + /* + fmt::print("ambiguous deref. Choices are:\n"); + for (auto& result : rd.results) { + fmt::print(" {} : ", result.result_type.print()); + for (auto& tok : result.tokens) { + fmt::print("{} ", tok.print()); + } + fmt::print("\n"); + } + */ + + types2_from_ambiguous_deref(output_instr, type_out, rd.results, extras.tags_locked); + return true; + } + } + } + + if (input_type.typespec() == TypeSpec("pointer") || + // this seems like a bit of a hack, but we did it in the old type pass... + input_type.kind == TP_Type::Kind::OBJECT_PLUS_PRODUCT_WITH_CONSTANT) { + // we got a plain pointer. let's just assume we're loading an integer. + // perhaps we should disable this feature by default on 4-byte loads if we're getting + // lots of false positives for loading pointers from plain pointers. + + switch (op.kind()) { + case LoadVarOp::Kind::UNSIGNED: + switch (op.size()) { + case 1: + case 2: + case 4: + case 8: + type_out.type = TP_Type::make_from_ts(TypeSpec("uint")); + return true; + case 16: + type_out.type = TP_Type::make_from_ts(TypeSpec("uint128")); + return true; + default: + break; + } + break; + case LoadVarOp::Kind::SIGNED: + switch (op.size()) { + case 1: + case 2: + case 4: + case 8: + type_out.type = TP_Type::make_from_ts(TypeSpec("int")); + return true; + case 16: + type_out.type = TP_Type::make_from_ts(TypeSpec("int128")); + return true; + default: + break; + } + break; + case LoadVarOp::Kind::FLOAT: + type_out.type = TP_Type::make_from_ts(TypeSpec("float")); + return true; + default: + ASSERT(false); + } + } + + // rd failed, try as pair. + if (env.allow_sloppy_pair_typing()) { + // we are strict here - only permit pair-type loads from object or pair. + // object is permitted for stuff like association lists where the car is also a pair. + if (op.kind() == LoadVarOp::Kind::SIGNED && op.size() == 4 && + (input_type.typespec() == TypeSpec("object") || + input_type.typespec() == TypeSpec("pair"))) { + // these rules are of course not always correct or the most specific, but it's the best + // we can do. + if (ro.offset == 2) { + // cdr = another pair. + type_out.type = TP_Type::make_from_ts(TypeSpec("pair")); + return true; + } else if (ro.offset == -2) { + // car = some object. + type_out.type = TP_Type::make_from_ts(TypeSpec("object")); + return true; + } + } + } + + throw std::runtime_error(fmt::format("Could not figure out load: {}", op.to_string(env))); + } else { + throw std::runtime_error(fmt::format("Could not figure out load: {}", op.to_string(env))); + } +} + +void LoadVarOp::propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // update clobbers. + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } + + if (m_dst.reg().get_kind() == Reg::VF) { + // ignore vf registers in type pass. + return; + } + + auto& type_out = instr.types[m_dst.reg()]; + load_var_op_determine_type(*type_out, instr, input_types, *this, env, dts, extras); + m_type = type_out->type ? type_out->type->typespec() : std::optional(); +} + +void branch_delay_types2(IR2_BranchDelay& delay, + types2::Instruction& instr, + types2::TypeState& input_types) { + switch (delay.kind()) { + case IR2_BranchDelay::Kind::NOP: + case IR2_BranchDelay::Kind::NO_DELAY: + break; + case IR2_BranchDelay::Kind::SET_REG_FALSE: + instr.types[delay.var(0).reg()]->type = TP_Type::make_false(); + break; + case IR2_BranchDelay::Kind::SET_REG_TRUE: + instr.types[delay.var(0).reg()]->type = TP_Type::make_from_ts("symbol"); + break; + case IR2_BranchDelay::Kind::SET_REG_REG: + instr.types[delay.var(0).reg()]->type = input_types[delay.var(1).reg()]->type; + break; + default: + ASSERT_MSG(false, fmt::format("propagate_types2 BranchOp unknown branch delay: {}", + (int)delay.kind())); + } +} + +void BranchOp::propagate_types2(types2::Instruction& instr, + const Env& /*env*/, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // update clobbers. + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } + + switch (m_condition.kind()) { + case IR2_Condition::Kind::FLOAT_EQUAL: + case IR2_Condition::Kind::FLOAT_GEQ: + case IR2_Condition::Kind::FLOAT_GREATER_THAN: + case IR2_Condition::Kind::FLOAT_LEQ: + case IR2_Condition::Kind::FLOAT_LESS_THAN: + case IR2_Condition::Kind::FLOAT_NOT_EQUAL: + for (int i = 0; i < 2; i++) { + auto& arg = m_condition.src(i); + auto& arg_type = input_types[arg.var().reg()]; + if (arg_type->tag.has_tag()) { + if (types2::backprop_tagged_type(TP_Type::make_from_ts("float"), *arg_type, dts)) { + extras.needs_rerun = true; + } + } + } + break; + default: + break; + } + + branch_delay_types2(m_branch_delay, instr, input_types); +} + +void AsmBranchOp::propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + if (m_branch_delay) { + m_branch_delay->propagate_types2(instr, env, input_types, dts, extras); + } + // for now, just make everything uint + for (auto x : m_write_regs) { + if (x.allowed_local_gpr()) { + instr.types[x]->type = TP_Type::make_from_ts("uint"); + } + } +} + +void SpecialOp::propagate_types2(types2::Instruction& instr, + const Env& /*env*/, + types2::TypeState& /*input_types*/, + DecompilerTypeSystem& /*dts*/, + types2::TypePropExtras& /*extras*/) { + // update clobbers. + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } + switch (m_kind) { + case Kind::NOP: + case Kind::BREAK: + case Kind::CRASH: + case Kind::SUSPEND: + return; + default: + ASSERT(false); + } +} + +void CallOp::propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& /*extras*/) { + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } + + const Reg::Gpr arg_regs[8] = {Reg::A0, Reg::A1, Reg::A2, Reg::A3, + Reg::T0, Reg::T1, Reg::T2, Reg::T3}; + auto& out_types = instr.types; + + // see what's in the function register + auto in_tp_info = input_types[Register(Reg::GPR, Reg::T9)]; + if (!in_tp_info->type) { + // no idea what's there, can't do anything... + out_types[Register(Reg::GPR, Reg::V0)]->type = {}; + return; + } + auto& in_tp = in_tp_info->type.value(); + + // special case: call object new method inside of a new method. + if (in_tp.kind == TP_Type::Kind::OBJECT_NEW_METHOD && + !dts.type_prop_settings.current_method_type.empty()) { + // calling object new method. Set the result to a new object of our type + out_types[Register(Reg::GPR, Reg::V0)]->type = + TP_Type::make_from_ts(dts.type_prop_settings.current_method_type); + // update the call type + m_call_type = in_tp.get_method_new_object_typespec(); + m_call_type.get_arg(m_call_type.arg_count() - 1) = + TypeSpec(dts.type_prop_settings.current_method_type); + m_call_type_set = true; + + // update function call info info + m_read_regs.clear(); + m_arg_vars.clear(); + m_read_regs.emplace_back(Reg::GPR, Reg::T9); + for (int i = 0; i < int(m_call_type.arg_count()) - 1; i++) { + m_read_regs.emplace_back(Reg::GPR, arg_regs[i]); + m_arg_vars.push_back(RegisterAccess(AccessMode::READ, m_read_regs.back(), m_my_idx)); + } + return; + } + + auto in_type = in_tp.typespec(); + + if (in_type.base_type() != "function") { + throw std::runtime_error("Called something that was not a function: " + in_type.print()); + } + + // backprop + bool can_backprop = true; + + // special case: go + // If we call enter-state, update our type. + if (in_tp.kind == TP_Type::Kind::ENTER_STATE_FUNCTION) { + can_backprop = false; // for now... can special case this later. + // this is a GO! + const auto& state_type = instr.types.next_state_type; + if (!state_type->type) { + throw std::runtime_error( + fmt::format("At op {}, called enter-state, but we have no idea what the type of the " + "next-states is. This can probably be fixed by providing some more casts, or " + "improving the decompiler to backtrack go's.", + m_my_idx)); + } + auto state_typespec = state_type->type->typespec(); + if (state_typespec.base_type() != "state") { + throw std::runtime_error( + fmt::format("At op {}, called enter-state, but the current next-state has type {}, which " + "is not a valid state.", + m_my_idx, state_typespec.print())); + } + + if (state_typespec.arg_count() == 0) { + throw std::runtime_error(fmt::format( + "At op {}, tried to enter-state, but the type of (-> s6 next-state) is just a plain " + "state. The decompiler must know the specific state type.", + m_my_idx)); + } + in_type = state_to_go_function(state_typespec, TypeSpec("object")); + } + + // special case: process initialization + if (in_tp.kind == TP_Type::Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION || + in_tp.kind == TP_Type::Kind::SET_TO_RUN_FUNCTION) { + can_backprop = false; // for now... can special case this later. + auto func_to_run_type = input_types[Register(Reg::GPR, arg_regs[1])]; + auto func_to_run_ts = + func_to_run_type->type ? func_to_run_type->type->typespec() : TypeSpec("object"); + if (func_to_run_ts.base_type() != "function" || func_to_run_ts.arg_count() == 0 || + func_to_run_ts.arg_count() > 7) { + throw std::runtime_error( + fmt::format("Call to run-function-in-process or set-to-run at op {} with an invalid " + "function type: {}", + m_my_idx, func_to_run_ts.print())); + } + + std::vector new_arg_types; + if (in_tp.kind == TP_Type::Kind::RUN_FUNCTION_IN_PROCESS_FUNCTION) { + new_arg_types.push_back(TypeSpec("process")); + } else { + new_arg_types.push_back(TypeSpec("thread")); + } + new_arg_types.push_back(TypeSpec("function")); + + for (size_t i = 0; i < func_to_run_ts.arg_count() - 1; i++) { + new_arg_types.push_back(func_to_run_ts.get_arg(i)); + } + new_arg_types.push_back(TypeSpec("none")); + in_type = TypeSpec("function", new_arg_types); + } + + if (in_type.arg_count() < 1) { + throw std::runtime_error("Called a function, but we do not know its type"); + } + + // special case: variable argument count + if (in_type.arg_count() == 2 && in_type.get_arg(0) == TypeSpec("_varargs_")) { + can_backprop = false; // for now... can special case this later. + // we're calling a varags function, which is format. We can determine the argument count + // by looking at the format string, if we can get it. + TP_Type arg_type = TP_Type::make_uninitialized(); + if (input_types[Register(Reg::GPR, Reg::A1)]->type) { + arg_type = *input_types[Register(Reg::GPR, Reg::A1)]->type; + } + + auto can_determine_argc = arg_type.can_be_format_string(); + auto dynamic_string = false; + if (!can_determine_argc && arg_type.typespec() == TypeSpec("string")) { + // dynamic string. use manual lookup table. + dynamic_string = true; + } + if (can_determine_argc || dynamic_string) { + int arg_count = -1; + + if (dynamic_string) { + arg_count = dts.get_dynamic_format_arg_count(env.func->name(), m_my_idx); + } else if (arg_type.is_constant_string()) { + auto& str = arg_type.get_string(); + arg_count = dts.get_format_arg_count(str); + } else { + // is format string. + arg_count = arg_type.get_format_string_arg_count(); + } + + if (arg_count + 2 > 8) { + throw std::runtime_error( + "Call to `format` pushed the arg-count beyond the acceptable arg limit (8), do you " + "need to add " + "a code to the ignore lists?"); + } + + TypeSpec format_call_type("function"); + format_call_type.add_arg(TypeSpec("object")); // destination + format_call_type.add_arg(TypeSpec("string")); // format string + for (int i = 0; i < arg_count; i++) { + format_call_type.add_arg(TypeSpec("object")); + } + format_call_type.add_arg(TypeSpec("object")); + arg_count += 2; // for destination and format string. + + m_call_type = format_call_type; + m_call_type_set = true; + + out_types[Register(Reg::GPR, Reg::V0)]->type = TP_Type::make_from_ts(in_type.last_arg()); + + // we can also update register usage here. + m_read_regs.clear(); + m_arg_vars.clear(); + m_read_regs.emplace_back(Reg::GPR, Reg::T9); + for (int i = 0; i < arg_count; i++) { + m_read_regs.emplace_back(Reg::GPR, arg_regs[i]); + m_arg_vars.push_back(RegisterAccess(AccessMode::READ, m_read_regs.back(), m_my_idx)); + } + + return; + } else { + throw std::runtime_error("Failed to get appropriate string for _varags_ call, got " + + arg_type.print()); + } + } + // set the call type! + m_call_type = in_type; + m_call_type_set = true; + + out_types[Register(Reg::GPR, Reg::V0)]->type = TP_Type::make_from_ts(in_type.last_arg()); + + // we can also update register usage here. + m_read_regs.clear(); + m_arg_vars.clear(); + m_read_regs.emplace_back(Reg::GPR, Reg::T9); + + for (uint32_t i = 0; i < in_type.arg_count() - 1; i++) { + m_read_regs.emplace_back(Reg::GPR, arg_regs[i]); + m_arg_vars.push_back(RegisterAccess(AccessMode::READ, m_read_regs.back(), m_my_idx)); + } + + // _always_ write the v0 register, even if the function returns none. + // GOAL seems to insert coloring moves even on functions returning none. + m_write_regs.clear(); + m_write_regs.emplace_back(Reg::GPR, Reg::V0); + + if (can_backprop) { + for (int i = 0; i < int(m_call_type.arg_count()) - 1; i++) { + auto& expected_type = m_call_type.get_arg(i); + auto& actual_type = input_types[Register(Reg::GPR, arg_regs[i])]; + if (actual_type->tag.has_tag()) { + types2::backprop_tagged_type(TP_Type::make_from_ts(expected_type), *actual_type, dts); + } + } + } +} + +void FunctionEndOp::propagate_types2(types2::Instruction& instr, + const Env& /*env*/, + types2::TypeState& /*input_types*/, + DecompilerTypeSystem& /*dts*/, + types2::TypePropExtras& /*extras*/) { + for (auto& clobber : m_clobber_regs) { + instr.types[clobber]->type = TP_Type::make_uninitialized(); + } +} + +void StackSpillStoreOp::propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + auto& info = env.stack_spills().lookup(m_offset); + if (info.size != m_size) { + env.func->warnings.error("Stack slot store mismatch: defined as size {}, got size {}\n", + info.size, m_size); + } + + // auto stored_type = m_value.get_type(input, env, dts); + auto* type_out = instr.types.try_find_stack_spill_slot(m_offset); + ASSERT(type_out); + types2_for_atom(*type_out, instr, input_types, m_value, env, dts, extras); +} + +void StackSpillLoadOp::propagate_types2(types2::Instruction& instr, + const Env& env, + types2::TypeState& input_types, + DecompilerTypeSystem& dts, + types2::TypePropExtras& extras) { + // stack slot load + auto& info = env.stack_spills().lookup(m_offset); + if (info.size != m_size) { + env.func->warnings.error("Stack slot load at {} mismatch: defined as size {}, got size {}", + m_offset, info.size, m_size); + } + + if (info.is_signed != m_is_signed) { + env.func->warnings.warning("Stack slot offset {} signed mismatch", m_offset); + } + + auto* type_in = input_types.try_find_stack_spill_slot(m_offset); + ASSERT(type_in); + instr.types[m_dst.reg()]->type = type_in->type; +} + +void ConditionalMoveFalseOp::propagate_types2(types2::Instruction& instr, + const Env& /*env*/, + types2::TypeState& /*input_types*/, + DecompilerTypeSystem& /*dts*/, + types2::TypePropExtras& /*extras*/) { + auto& typ = instr.types[m_dst.reg()]->type; + if (typ) { + if (typ->typespec() != TypeSpec("symbol")) { + lg::warn("Conditional Moved #f into something of type {}", typ->typespec().print()); + // result.get(m_dst.reg()) = TP_Type::make_from_ts("symbol"); + } + } + typ = TP_Type::make_from_ts("symbol"); +} + +} // namespace decompiler diff --git a/decompiler/types2/types2.cpp b/decompiler/types2/types2.cpp new file mode 100644 index 0000000000..b360a7b741 --- /dev/null +++ b/decompiler/types2/types2.cpp @@ -0,0 +1,760 @@ +#include "types2.h" + +#include + +#include "decompiler/ObjectFile/LinkedObjectFile.h" +#include "decompiler/types2/types2.h" +#include "decompiler/util/goal_constants.h" + +namespace decompiler::types2 { + +/*! + * Construct a typestate from the types at the start of a block. + */ +TypeState make_typestate_from_block_types(BlockStartTypes& block_start_types) { + // create references to the gpr, fpr, and stack slot types of the start of the block. + TypeState result; + for (int i = 0; i < 32; i++) { + result.gpr_types[i] = &block_start_types.gpr_types[i]; + result.fpr_types[i] = &block_start_types.fpr_types[i]; + } + for (auto& s : block_start_types.stack_slot_types) { + result.stack_slot_types.push_back(&s); + } + result.next_state_type = &block_start_types.next_state_type; + return result; +} + +/*! + * Find all of the used stack spill slots in a function. + * They are represented as byte offsets. + */ +std::set find_stack_spill_slots(const Function& f) { + std::set result; + for (auto& op : f.ir2.atomic_ops->ops) { + auto as_stack_spill_store = dynamic_cast(op.get()); + if (as_stack_spill_store) { + result.insert(as_stack_spill_store->offset()); + } + + auto as_stack_spill_load = dynamic_cast(op.get()); + if (as_stack_spill_load) { + result.insert(as_stack_spill_load->offset()); + } + } + return result; +} + +/*! + * Set up types for the entry of a function. + */ +void construct_function_entry_types(BlockStartTypes& result, + const TypeSpec& f_ts, + const std::set& stack_slots) { + for (auto& x : result.gpr_types) { + x.type = TP_Type::make_uninitialized(); + } + for (auto& x : result.fpr_types) { + x.type = TP_Type::make_uninitialized(); + } + result.next_state_type.type = TP_Type::make_uninitialized(); + + for (auto x : stack_slots) { + auto slot = result.try_find_stack_spill_slot(x); + ASSERT(slot); + slot->slot = x; + slot->type.type = TP_Type::make_uninitialized(); + } + + int goal_args[] = {Reg::A0, Reg::A1, Reg::A2, Reg::A3, Reg::T0, Reg::T1, Reg::T2, Reg::T3}; + ASSERT(f_ts.base_type() == "function"); + ASSERT(f_ts.arg_count() >= 1); + ASSERT(f_ts.arg_count() <= 8 + 1); // 8 args + 1 return. + for (int i = 0; i < int(f_ts.arg_count()) - 1; i++) { + auto reg_id = goal_args[i]; + const auto& reg_type = f_ts.get_arg(i); + result[Register(Reg::GPR, reg_id)].type = TP_Type::make_from_ts(reg_type); + } + + result[Register(Reg::GPR, Reg::S6)].type = + TP_Type::make_from_ts(TypeSpec(f_ts.try_get_tag("behavior").value_or("process"))); + + // initialize stack slots as uninitialized (I think safe to skip) +} + +/*! + * Set up function cache data structure. + */ +void build_function(FunctionCache& function_cache, + Function& func, + const std::set& stack_slots) { + ASSERT(func.ir2.atomic_ops && func.ir2.atomic_ops_succeeded); + auto& aops = func.ir2.atomic_ops->ops; + + // set up the instruction and block structures + function_cache.blocks.resize(func.basic_blocks.size()); + function_cache.instructions.resize(aops.size()); + for (size_t i = 0; i < aops.size(); i++) { + function_cache.instructions[i].aop_idx = i; + } + for (size_t block_idx = 0; block_idx < function_cache.blocks.size(); block_idx++) { + for (int instr_idx = func.ir2.atomic_ops->block_id_to_first_atomic_op.at(block_idx); + instr_idx < func.ir2.atomic_ops->block_id_to_end_atomic_op.at(block_idx); instr_idx++) { + function_cache.blocks[block_idx].instructions.push_back( + &function_cache.instructions.at(instr_idx)); + } + } + + // figure out the order we'll visit all blocks + // todo: do something with unreachables? + function_cache.block_visit_order = func.bb_topo_sort().vist_order; + + // to save time, we store types at the entry of each block, then in the instructions inside + // each block, store types sparsely. This saves very slow copying around of types. + for (int block_idx : function_cache.block_visit_order) { + auto& block = function_cache.blocks.at(block_idx); + + // add placeholders for all stack slots. + for (auto slot_addr : stack_slots) { + auto& new_slot = block.start_types.stack_slot_types.emplace_back(); + new_slot.slot = slot_addr; + } + + // this will contain pointers to the most recent types for each register. + // it gets initialized to the types on block entry (we store a copy of these) + TypeState state = make_typestate_from_block_types(block.start_types); + block.start_type_state = state; // stash this here, just makes it easier for later. + ASSERT(block.start_type_state.fpr_types[0]); + + // loop through instructions, allocating new types for written registers. + for (auto instr : block.instructions) { + auto& aop = aops.at(instr->aop_idx); + + // allocate types that we'll write/clobber + for (auto& reg : aop->write_regs()) { + RegType rt; + rt.reg = reg; + instr->written_reg_types.push_back(rt); + } + for (auto& reg : aop->clobber_regs()) { + RegType rt; + rt.reg = reg; + instr->written_reg_types.push_back(rt); + } + + // now link the register types + for (auto& written_reg_type : instr->written_reg_types) { + auto reg_kind = written_reg_type.reg.get_kind(); + // ignore weird registers + if (reg_kind == Reg::GPR || reg_kind == Reg::FPR) { + state[written_reg_type.reg] = &written_reg_type.type; + } + } + + // do the same for stack spill types + auto as_stack_spill_store = dynamic_cast(aop.get()); + if (as_stack_spill_store) { + // make a written_stack_slot_type + StackSlotType ss; + ss.slot = as_stack_spill_store->offset(); + instr->written_stack_slot_type = ss; + + // and update state! + bool found = false; + for (auto& slot : state.stack_slot_types) { + if (slot->slot == ss.slot) { + ASSERT(!found); + slot = &instr->written_stack_slot_type.value(); + found = true; + } + } + ASSERT(found); + } + + // do the same for next state (maybe) + auto as_store_op = dynamic_cast(aop.get()); + if (as_store_op) { + IR2_RegOffset ro; + // note that this isn't 100% sure to actually be a next state. + // the implementation of StoreOp will have to notice these false positives and copy + // the next state type (not a big deal). + if (get_as_reg_offset(as_store_op->addr(), &ro)) { + if (ro.reg == Register(Reg::GPR, Reg::S6) && + ro.offset == OFFSET_OF_NEXT_STATE_STORE[func.ir2.env.version]) { + instr->written_next_state_type = types2::Type(); + state.next_state_type = &instr->written_next_state_type.value(); + } + } + } + + // now store the state: + instr->types = state; + } + } +} + +/*! + * Wrapper around a TypeState* that temporarily modifies types for a cast. + * When this is destroyed, the casts will be reverted. + */ +class TypeStateCasted { + public: + TypeStateCasted(TypeState* state) : m_state(state) {} + TypeStateCasted(TypeState* state, const Env& env, int aop_idx, DecompilerTypeSystem& dts) + : TypeStateCasted(state) { + const auto& reg_cast_it = env.casts().find(aop_idx); + if (reg_cast_it != env.casts().end()) { + // apply register casts! + for (auto& cast : reg_cast_it->second) { + push_reg_cast(cast.reg, dts.parse_type_spec(cast.type_name)); + } + } + + for (const auto& [offset, cast] : env.stack_casts()) { + push_stack_cast(offset, dts.parse_type_spec(cast.type_name), env.func); + } + } + TypeStateCasted(const TypeStateCasted&) = delete; + TypeStateCasted& operator=(const TypeStateCasted&) = delete; + + void push_reg_cast(Register reg, const TypeSpec& type) { + auto& cast = m_restores.emplace_back(); + cast.reg = reg; + cast.is_reg = true; + cast.previous = (*m_state)[reg]->type; + (*m_state)[reg]->type = TP_Type::make_from_ts(type); + } + + void push_stack_cast(int slot, const TypeSpec& type, const Function* func) { + auto& cast = m_restores.emplace_back(); + cast.stack_slot = slot; + cast.is_reg = false; + auto spill_slot = m_state->try_find_stack_spill_slot(slot); + ASSERT_MSG(spill_slot, fmt::format("Function {} has no stack slot at {}", func->name(), slot)); + cast.previous = spill_slot->type; + spill_slot->type = TP_Type::make_from_ts(type); + } + + ~TypeStateCasted() { + for (auto it = m_restores.rbegin(); it != m_restores.rend(); it++) { + if (it->is_reg) { + (*m_state)[it->reg]->type = it->previous; + } else { + m_state->try_find_stack_spill_slot(it->stack_slot)->type = it->previous; + } + } + } + + private: + struct Cast { + Register reg; + int stack_slot; + std::optional previous; + bool is_reg; + }; + std::vector m_restores; + TypeState* m_state; +}; + +void backprop_from_preds(FunctionCache& cache, + int block_idx, + Function& func, + TypeState* block_end_typestate, + DecompilerTypeSystem& dts) { + auto& cblock = cache.blocks.at(block_idx); + auto& block = func.basic_blocks.at(block_idx); + + // first, we'll see if we can get any information by looking at our successors. + // if not, we'll notify our successors to prepare information for us, and we'll get it next time. + + // loop over registers (both gpr and fpr) + for (auto reg_type : {Reg::GPR, Reg::FPR}) { + for (int i = 0; i < 32; i++) { + auto reg = Register(reg_type, i); + + // we're only interested in types with a "tag" that indicates they need more info. + if (block_end_typestate->operator[](reg)->tag.has_tag()) { + std::optional resolve_type; + + // loop over successors + for (auto& succ_idx : {block.succ_branch, block.succ_ft}) { + if (succ_idx >= 0) { + // the successor will use block entry tags to report back this info. + // we'll check for these, use them if they exist, and add them if they don't. + bool this_succ_has_tag = false; + auto& succ_cblock = cache.blocks.at(succ_idx); + + // loop over all block entry tags - these are used within the block to backpropagate + // constraints to the start of the block. + for (auto& succ_tag : succ_cblock.block_entry_tags) { + // see if it matches... + if (succ_tag->is_reg && succ_tag->reg == reg) { + // remember the tag exists so we don't add another. + this_succ_has_tag = true; + + // see if the tag has been resolved + if (succ_tag->selected_type) { + // it has, we can use this to update our guess of the type + if (resolve_type) { + // we already have 1 guess, lca of the guesses. + bool change; + resolve_type = dts.tp_lca(*resolve_type, *succ_tag->selected_type, &change); + } else { + // no existing guess, just use this one. + resolve_type = succ_tag->selected_type; + } + } + } + } + + // if we didn't find a tag, we should add one + if (!this_succ_has_tag) { + // allocate it in the block + succ_cblock.block_entry_tags.push_back(std::make_unique()); + auto* tag = succ_cblock.block_entry_tags.back().get(); + // set up for the register + tag->is_reg = true; + tag->reg = reg; + tag->type_to_clear = &cache.blocks.at(succ_idx).start_type_state[reg]->type; + // fmt::print("mark to clear {}\n", succ_idx); + // add the tag to the type. + auto& st = succ_cblock.start_types[reg]; + ASSERT(!st.tag.has_tag()); + st.tag.kind = Tag::BLOCK_ENTRY; + st.tag.block_entry = tag; + succ_cblock.needs_run = true; + } + } + } + + // we got info from the successor, pass it back into this block + if (resolve_type) { + if (backprop_tagged_type(*resolve_type, *(*block_end_typestate)[reg], dts)) { + // if we've changed things, mark this block to be re-ran. + cblock.needs_run = true; + } + } + } + } + } + + // if we updated somebody else's tags + bool tags_updated = false; + for (auto& my_tag : cblock.block_entry_tags) { + if (my_tag->updated) { + tags_updated = true; + my_tag->updated = false; + // fmt::print("clearing {}\n", block_idx); + cblock.needs_run = true; // maybe? + *my_tag->type_to_clear = {}; // meh.. + } + } + + if (tags_updated) { + for (auto& pred : block.pred) { + cache.blocks.at(pred).needs_run = true; + } + } +} + +std::optional tp_lca(const types2::Type& existing, + const types2::Type& add, + bool* changed, + DecompilerTypeSystem& dts) { + if (existing.type && add.type) { + return dts.tp_lca(*existing.type, *add.type, changed); + } else if (existing.type && !add.type) { + *changed = false; + return existing.type; + } else if (!existing.type && add.type) { + *changed = true; + return add.type; + } else { + // neither + *changed = false; + return {}; + } +} + +/*! + * Find the least common ancestor of an entire typestate. + */ +bool tp_lca(types2::TypeState* combined, const types2::TypeState& add, DecompilerTypeSystem& dts) { + bool result = false; + for (int i = 0; i < 32; i++) { + bool diff = false; + auto new_type = tp_lca(*combined->gpr_types[i], *add.gpr_types[i], &diff, dts); + if (diff) { + result = true; + combined->gpr_types[i]->type = new_type; + } + } + + for (int i = 0; i < 32; i++) { + bool diff = false; + auto new_type = tp_lca(*combined->fpr_types[i], *add.fpr_types[i], &diff, dts); + if (diff) { + result = true; + combined->fpr_types[i]->type = new_type; + } + } + + for (auto& x : add.stack_slot_types) { + bool diff = false; + auto comb = combined->try_find_stack_spill_slot(x->slot); + if (!comb) { + fmt::print("failed to find {}\n", x->slot); + for (auto& x : combined->stack_slot_types) { + fmt::print("x = {}\n", x->slot); + } + } + ASSERT(comb); + auto new_type = tp_lca(*comb, x->type, &diff, dts); + if (diff) { + result = true; + comb->type = new_type; + } + } + + bool diff = false; + auto new_type = tp_lca(*combined->next_state_type, *add.next_state_type, &diff, dts); + if (diff) { + result = true; + combined->next_state_type->type = new_type; + } + + return result; +} + +/*! + * Propagate types from the beginning of this block. + */ +bool propagate_block(FunctionCache& cache, + int block_idx, + Function& func, + DecompilerTypeSystem& dts, + bool tag_lock) { + bool debug = false; // func.name() == "string->float"; + auto& cblock = cache.blocks.at(block_idx); + auto& block = func.basic_blocks.at(block_idx); + // for now, assume we'll be done. something might change this later, we'll see + cblock.needs_run = false; + + // propagate through instructions + TypeState* previous_typestate = &cblock.start_type_state; + for (auto instr : cblock.instructions) { + { + TypeStateCasted casted(previous_typestate, func.ir2.env, instr->aop_idx, *func.ir2.env.dts); + auto& aop = func.ir2.atomic_ops->ops.at(instr->aop_idx); + TypePropExtras extras; + extras.tags_locked = tag_lock; + // fmt::print("run: {}\n", aop->to_string(func.ir2.env)); + + try { + aop->propagate_types2(*instr, func.ir2.env, *previous_typestate, *func.ir2.env.dts, extras); + } catch (const std::exception& e) { + auto error = fmt::format("failed type prop at {}: {}", instr->aop_idx, e.what()); + func.warnings.error(error); + lg::error("Function {} {}", func.name(), error); + return false; + } + if (extras.needs_rerun) { + cblock.needs_run = true; + } + // propagate forward + // TODO + // handle constraints + } + previous_typestate = &instr->types; + } + + // now that we've reached the end, handle backprop across blocks + if (!tag_lock) { + backprop_from_preds(cache, block_idx, func, previous_typestate, *func.ir2.env.dts); + } + + // deal with end crap + + // lca + + // set tags on succs/backprop from succs + + for (auto succ_block_id : {block.succ_ft, block.succ_branch}) { + if (succ_block_id != -1) { + // set types to LCA (current, new) + if (tp_lca(&cache.blocks.at(succ_block_id).start_type_state, *previous_typestate, dts)) { + // if something changed, run again! + cache.blocks.at(succ_block_id).needs_run = true; + } + } + } + return true; +} + +bool convert_to_old_format(TP_Type& out, const types2::Type* in, bool recovery_mode) { + if (!in->type) { + if (recovery_mode) { + out = TP_Type::make_uninitialized(); + return true; + } else { + return false; + } + } else { + out = *in->type; + return true; + } +} + +bool convert_to_old_format(::decompiler::TypeState& out, + const types2::TypeState& in, + std::string& error_string, + int my_idx, + const std::unordered_map>& casts, + const std::unordered_map& stack_casts, + const DecompilerTypeSystem& dts, + bool recovery_mode) { + for (int i = 0; i < 32; i++) { + ASSERT(in.fpr_types[i]); + if (!convert_to_old_format(out.fpr_types[i], in.fpr_types[i], recovery_mode)) { + error_string += fmt::format("Failed to convert FPR: {} ", i); + return false; + } + if (!convert_to_old_format(out.gpr_types[i], in.gpr_types[i], recovery_mode)) { + error_string += fmt::format("Failed to convert GPR: {} ", Register(Reg::GPR, i).to_string()); + return false; + } + } + + if (!convert_to_old_format(out.next_state_type, in.next_state_type, recovery_mode)) { + error_string += "Failed to convert next state "; + return false; + } + + const auto& reg_casts = casts.find(my_idx); + if (reg_casts != casts.end()) { + for (auto& cast : reg_casts->second) { + out.get(cast.reg) = TP_Type::make_from_ts(dts.parse_type_spec(cast.type_name)); + } + } + + for (auto& x : in.stack_slot_types) { + TP_Type temp; + if (!convert_to_old_format(temp, &x->type, recovery_mode)) { + error_string += fmt::format("Failed to convert stack slot: {} ", x->slot); + return false; + } + out.spill_slots[x->slot] = temp; + } + + for (auto& [offset, type] : stack_casts) { + out.spill_slots[offset] = TP_Type::make_from_ts(dts.parse_type_spec(type.type_name)); + } + return true; +} + +bool convert_to_old_format(Output& out, + FunctionCache& in, + std::string& error_string, + const std::unordered_map>& casts, + const std::unordered_map& stack_casts, + const DecompilerTypeSystem& dts, + bool recovery_mode) { + // for (auto& block : in.blocks) { + out.op_end_types.resize(in.instructions.size()); + out.block_init_types.resize(in.blocks.size()); + for (int block_idx : in.block_visit_order) { + auto& block = in.blocks[block_idx]; + if (!convert_to_old_format(out.block_init_types.at(block_idx), block.start_type_state, + error_string, block.instructions.at(0)->aop_idx, casts, stack_casts, + dts, recovery_mode)) { + error_string += fmt::format(" at the start of block {}\n", block_idx); + return false; + } + + for (auto& instr : block.instructions) { + if (!convert_to_old_format(out.op_end_types.at(instr->aop_idx), instr->types, error_string, + instr->aop_idx + 1, casts, stack_casts, dts, recovery_mode)) { + error_string += fmt::format(" at op {}\n", instr->aop_idx); + return false; + } + } + } + + return true; +} + +/*! + * Main Types2 Analysis pass. + */ +void run(Output& out, const Input& input) { + // First, construct our graph + FunctionCache function_cache; + auto stack_slots = find_stack_spill_slots(*input.func); + build_function(function_cache, *input.func, stack_slots); + + // annoying hack + if (input.func->guessed_name.kind == FunctionName::FunctionKind::METHOD) { + input.dts->type_prop_settings.current_method_type = input.func->guessed_name.type_name; + } + + if (input.function_type.last_arg() == TypeSpec("none")) { + auto as_end = dynamic_cast(input.func->ir2.atomic_ops->ops.back().get()); + ASSERT(as_end); + as_end->mark_function_as_no_return_value(); + } + + // mark the entry block + function_cache.blocks.at(0).needs_run = true; + construct_function_entry_types(function_cache.blocks.at(0).start_types, input.function_type, + stack_slots); + + // Run propagation, until we get through an iteration with no changes + int blocks_run = 0; + int outer_iterations = 0; + bool needs_rerun = true; + bool hit_error = false; + while (needs_rerun) { + outer_iterations++; + needs_rerun = false; + + for (auto block_idx : function_cache.block_visit_order) { + if (function_cache.blocks.at(block_idx).needs_run) { + blocks_run++; + needs_rerun = true; + if (!propagate_block(function_cache, block_idx, *input.func, *input.func->ir2.env.dts, + false)) { + hit_error = true; + goto end_type_pass; + } + } + } + + auto& return_type = input.function_type.last_arg(); + if (return_type != TypeSpec("none")) { + auto& last_instr = function_cache.instructions.back().types[Register(Reg::GPR, Reg::V0)]; + if (last_instr->tag.has_tag()) { + if (!last_instr->type || !input.dts->ts.tc(return_type, last_instr->type->typespec())) { + if (backprop_tagged_type(TP_Type::make_from_ts(return_type), *last_instr, *input.dts)) { + needs_rerun = true; + } + } + } + } + } + for (auto block_idx : function_cache.block_visit_order) { + if (block_idx != 0) { + auto& cblock = function_cache.blocks.at(block_idx).start_types; + for (auto& x : cblock.gpr_types) { + x.type = TP_Type::make_uninitialized(); + } + for (auto& x : cblock.fpr_types) { + x.type = TP_Type::make_uninitialized(); + } + + for (auto x : stack_slots) { + auto slot = cblock.try_find_stack_spill_slot(x); + ASSERT(slot); + slot->type.type = TP_Type::make_uninitialized(); + } + + cblock.next_state_type.type = TP_Type::make_uninitialized(); + } + } + + needs_rerun = true; + function_cache.blocks.at(0).needs_run = true; + while (needs_rerun) { + outer_iterations++; + needs_rerun = false; + for (auto block_idx : function_cache.block_visit_order) { + if (function_cache.blocks.at(block_idx).needs_run) { + blocks_run++; + needs_rerun = true; + if (!propagate_block(function_cache, block_idx, *input.func, *input.func->ir2.env.dts, + true)) { + hit_error = true; + goto end_type_pass; + } + } + } + } + +end_type_pass: + std::string error; + if (!convert_to_old_format(out, function_cache, error, input.func->ir2.env.casts(), + input.func->ir2.env.stack_casts(), *input.dts, hit_error)) { + fmt::print("Failed convert_to_old_format: {}\n", error); + } else { + input.func->ir2.env.types_succeeded = true; + auto last_type = out.op_end_types.back().get(Register(Reg::GPR, Reg::V0)).typespec(); + if (last_type != input.function_type.last_arg()) { + input.func->warnings.info("Return type mismatch {} vs {}.", last_type.print(), + input.function_type.last_arg().print()); + } + } + + // figure out the types of stack spill variables: + auto& env = input.func->ir2.env; + bool changed; + for (auto& type_info : out.op_end_types) { + for (auto& spill : type_info.spill_slots) { + auto& slot_info = env.stack_slot_entries[spill.first]; + slot_info.tp_type = + input.dts->tp_lca(env.stack_slot_entries[spill.first].tp_type, spill.second, &changed); + slot_info.offset = spill.first; + } + } + + for (auto& type_info : out.block_init_types) { + for (auto& spill : type_info.spill_slots) { + auto& slot_info = env.stack_slot_entries[spill.first]; + slot_info.tp_type = + input.dts->tp_lca(env.stack_slot_entries[spill.first].tp_type, spill.second, &changed); + slot_info.offset = spill.first; + } + } + + // convert to typespec + for (auto& info : env.stack_slot_entries) { + info.second.typespec = info.second.tp_type.typespec(); + // debug + // fmt::print("STACK {} : {} ({})\n", info.first, info.second.typespec.print(), + // info.second.tp_type.print()); + } + + // notify the label db of guessed labels + for (auto& instr : function_cache.instructions) { + if (instr.unknown_label_tag) { + if (!instr.unknown_label_tag->selected_type) { + throw std::runtime_error(fmt::format("Failed to guess label use for {} in {}:{}", + instr.unknown_label_tag->label_name, + input.func->name(), instr.aop_idx)); + } + auto& type = instr.unknown_label_tag->selected_type.value(); + int idx = instr.unknown_label_tag->label_idx; + ASSERT(type.base_type() != "pointer"); // want to test this if we find example... + env.file->label_db->set_and_get_previous(idx, type, false, {}); + } + + if (instr.unknown_stack_structure_tag) { + if (!instr.unknown_stack_structure_tag->selected_type) { + throw std::runtime_error(fmt::format("Failed to guess stack use for {} in {}:{}", + instr.unknown_stack_structure_tag->stack_offset, + input.func->name(), instr.aop_idx)); + } + + auto& type = instr.unknown_stack_structure_tag->selected_type.value(); + int offset = instr.unknown_stack_structure_tag->stack_offset; + ASSERT(type.base_type() != "pointer"); // want to test this if we find example... + StackStructureHint hint; + hint.stack_offset = offset; + hint.container_type = StackStructureHint::ContainerType::NONE; + hint.element_type = type.print(); + env.add_stack_structure_hint(hint); + } + } + + out.succeeded = !hit_error; +} + +} // namespace decompiler::types2 \ No newline at end of file diff --git a/decompiler/types2/types2.h b/decompiler/types2/types2.h new file mode 100644 index 0000000000..c19de84ca4 --- /dev/null +++ b/decompiler/types2/types2.h @@ -0,0 +1,248 @@ +#pragma once + +#include +#include +#include +#include + +#include "decompiler/Function/Function.h" +#include "decompiler/config.h" +#include "decompiler/util/DecompilerTypeSystem.h" +#include "decompiler/util/TP_Type.h" + +namespace decompiler::types2 { + +// Backprop tag types: +// these classes are "tags" that can be added to types to give a path to propagate constraints +// backward. For example, if we encounter a function call, and we know the expected argument types, +// the type pass will use these tags to propagate information backward. + +/*! + * Represents a case where there are multiple possible fields that could be accessed. + * For example, (&-> matrix vector 0), (&-> matrix data 0). Or any case with overlapping fields. + */ +struct AmbiguousFieldAccess { + struct Possibility { + TypeSpec type; + // TODO: probably stash more info here. + }; + std::vector possibilities; + int selected_possibility = -1; // -1 if not selected. +}; + +/*! + * Tag to link an unknown type back to a label with unknown type. + */ +struct UnknownLabel { + int label_idx = -1; + std::string label_name; // just for debug prints + std::optional selected_type; +}; + +/*! + * Tag to link an unknown type back to a stack structure with unknown type. + */ +struct UnknownStackStructure { + int stack_offset = -1; + std::optional selected_type; +}; + +/*! + * Tag to link a type back to something outside the block. + */ +struct BlockEntryType { + Register reg; + bool is_reg = true; + int stack_slot = -1; + std::optional selected_type; + bool updated = false; + std::optional* type_to_clear = nullptr; +}; + +struct AmbiguousIntOrFloatConstant { + std::optional is_float; +}; + +/*! + * Union of all tag types. + */ +struct Tag { + bool has_tag() { return kind != NONE; } + enum Kind { + FIELD_ACCESS, + UNKNOWN_LABEL, + UNKNOWN_STACK_STRUCTURE, + BLOCK_ENTRY, + INT_OR_FLOAT, + NONE + } kind = NONE; + + union { + AmbiguousFieldAccess* field_access; + BlockEntryType* block_entry; + UnknownLabel* unknown_label; + UnknownStackStructure* unknown_stack_structure; + AmbiguousIntOrFloatConstant* int_or_float; + }; +}; + +/*! + * The basic "type" that we're trying to figure out for each register on each instruction. + */ +struct Type { + Tag tag; // may have type "none" + std::optional type; // may be unknown +}; + +struct RegType { + Type type; + Register reg; +}; + +struct StackSlotType { + Type type; + int slot = -1; +}; + +struct TypeState { + Type* gpr_types[32]; + Type* fpr_types[32]; + Type* next_state_type = nullptr; + + Type*& operator[](const Register& reg) { + switch (reg.get_kind()) { + case Reg::FPR: + return fpr_types[reg.get_fpr()]; + case Reg::GPR: + return gpr_types[reg.get_gpr()]; + default: + ASSERT(false); + } + } + + const Type* operator[](const Register& reg) const { + switch (reg.get_kind()) { + case Reg::FPR: + return fpr_types[reg.get_fpr()]; + case Reg::GPR: + return gpr_types[reg.get_gpr()]; + default: + ASSERT(false); + } + } + + Type* try_find_stack_spill_slot(int slot) { + for (auto ss : stack_slot_types) { + if (ss->slot == slot) { + return &ss->type; + } + } + return nullptr; + } + + const Type* try_find_stack_spill_slot(int slot) const { + for (auto& ss : stack_slot_types) { + if (ss->slot == slot) { + return &ss->type; + } + } + return nullptr; + } + + template + void for_each_type(T&& f) { + for (auto gpr_type : gpr_types) { + f(*gpr_type); + } + for (auto fpr_type : fpr_types) { + f(*fpr_type); + } + for (auto spill : stack_slot_types) { + f(spill->type); + } + f(*next_state_type); + } + + std::vector stack_slot_types; +}; + +struct Instruction { + TypeState types; + size_t aop_idx = -1; + std::vector written_reg_types; + std::optional written_stack_slot_type; + std::optional written_next_state_type; + std::unique_ptr field_access_tag; + std::unique_ptr unknown_label_tag; + std::unique_ptr unknown_stack_structure_tag; + std::unique_ptr int_or_float; +}; + +struct BlockStartTypes { + Type gpr_types[32]; + Type fpr_types[32]; + Type next_state_type; + std::vector stack_slot_types; + + StackSlotType* try_find_stack_spill_slot(int slot) { + for (auto& ss : stack_slot_types) { + if (ss.slot == slot) { + return &ss; + } + } + return nullptr; + } + + Type& operator[](const Register& reg) { + switch (reg.get_kind()) { + case Reg::FPR: + return fpr_types[reg.get_fpr()]; + case Reg::GPR: + return gpr_types[reg.get_gpr()]; + default: + ASSERT(false); + } + } +}; + +struct Block { + bool needs_run = false; + BlockStartTypes start_types; + TypeState start_type_state; + std::vector instructions; + std::vector> block_entry_tags; +}; + +struct FunctionCache { + std::vector blocks; + std::vector instructions; + std::vector reg_type_casts; + std::vector stack_slot_casts; + std::vector block_visit_order; +}; + +struct Output { + std::vector<::decompiler::TypeState> block_init_types; + std::vector<::decompiler::TypeState> op_end_types; + std::vector stack_structure_hints; + bool succeeded = false; +}; + +struct Input { + TypeSpec function_type; + DecompilerTypeSystem* dts; + Function* func; +}; + +struct TypePropExtras { + bool needs_rerun = false; + bool tags_locked = false; +}; + +void run(Output& out, const Input& input); + +bool backprop_tagged_type(const TP_Type& expected_type, + types2::Type& actual_type, + const DecompilerTypeSystem& dts); + +} // namespace decompiler::types2 \ No newline at end of file diff --git a/decompiler/util/DecompilerTypeSystem.cpp b/decompiler/util/DecompilerTypeSystem.cpp index 38b67513dc..bfc3008606 100644 --- a/decompiler/util/DecompilerTypeSystem.cpp +++ b/decompiler/util/DecompilerTypeSystem.cpp @@ -412,8 +412,8 @@ int DecompilerTypeSystem::get_format_arg_count(const std::string& str) const { } static const std::vector single_char_ignore_list = {'%', 'T'}; - static const std::vector multi_char_ignore_list = {"0L", "1L", "3L", "1K", - "2j", "0k", "30L", "1T"}; + static const std::vector multi_char_ignore_list = {"0L", "1L", "3L", "1K", "2j", + "0k", "30L", "1T", "2T"}; int arg_count = 0; for (size_t i = 0; i < str.length(); i++) { diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 2e5fa94011..268ac56904 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -279,7 +279,9 @@ goos::Object decompile_value_array(const TypeSpec& elt_type, for (int j = start; j < end; j++) { auto& word = obj_words.at(j / 4); if (word.kind() != LinkedWord::PLAIN_DATA) { - throw std::runtime_error("Got bad word in kind in array of values"); + throw std::runtime_error(fmt::format( + "Got bad word in kind in array of values: expecting array of {}'s, got a {}\n", + elt_type.print(), (int)word.kind())); } elt_bytes.push_back(word.get_byte(j % 4)); } @@ -592,6 +594,16 @@ goos::Object sp_launch_grp_launcher_decompile(const std::vector& wor return decomp_ref_to_inline_array_guess_size(words, labels, my_seg, field_location, ts, all_words, file, TypeSpec("sparticle-group-item"), 32); } +goos::Object probe_dir_decompile(const std::vector& words, + const std::vector& labels, + int my_seg, + int field_location, + const TypeSystem& ts, + const std::vector>& all_words, + const LinkedObjectFile* file) { + return decomp_ref_to_inline_array_guess_size(words, labels, my_seg, field_location, ts, all_words, + file, TypeSpec("vector"), 16); +} goos::Object decompile_sound_spec(const TypeSpec& type, const DecompilerLabel& label, @@ -746,12 +758,14 @@ goos::Object decompile_structure(const TypeSpec& type, // some structures we want to decompile to fancy macros instead of a raw static definiton if (use_fancy_macros) { if (type == TypeSpec("sp-field-init-spec")) { + ASSERT(file->version == GameVersion::Jak1); // need to update enums return decompile_sparticle_field_init(type, label, labels, words, ts, file); } if (type == TypeSpec("sparticle-group-item")) { + ASSERT(file->version == GameVersion::Jak1); // need to update enums return decompile_sparticle_group_item(type, label, labels, words, ts, file); } - if (type == TypeSpec("sound-spec")) { + if (type == TypeSpec("sound-spec") && file->version != GameVersion::Jak2) { return decompile_sound_spec(type, label, labels, words, ts, file); } } @@ -769,7 +783,8 @@ goos::Object decompile_structure(const TypeSpec& type, if (is_basic) { const auto& word = words.at(label.target_segment).at((offset_location / 4)); if (word.kind() != LinkedWord::TYPE_PTR) { - throw std::runtime_error("Basic does not start with type pointer"); + throw std::runtime_error( + fmt::format("Basic does not start with type pointer: {}", label.name)); } if (word.symbol_name() != actual_type.base_type()) { @@ -976,6 +991,10 @@ goos::Object decompile_structure(const TypeSpec& type, field.name(), decomp_ref_to_integer_array_guess_size( obj_words, labels, label.target_segment, field_start, ts, words, file, TypeSpec("uint8"), 1)); + } else if (field.name() == "probe-dirs" && type.print() == "lightning-probe-vars") { + field_defs_out.emplace_back(field.name(), + probe_dir_decompile(obj_words, labels, label.target_segment, + field_start, ts, words, file)); } else { if (field.type().base_type() == "pointer") { if (obj_words.at(field_start / 4).kind() != LinkedWord::SYM_PTR) { @@ -1400,6 +1419,8 @@ goos::Object decompile_boxed_array(const DecompilerLabel& label, (word.data & 0b111) == 0) { s32 val = word.data; result.push_back(pretty_print::to_symbol(fmt::format("(the binteger {})", val / 8))); + } else if (content_type == TypeSpec("type") && word.kind() == LinkedWord::TYPE_PTR) { + result.push_back(pretty_print::to_symbol(word.symbol_name())); } else { throw std::runtime_error( fmt::format("Unknown content type in boxed array of references, word idx {}", diff --git a/decompiler/util/goal_constants.h b/decompiler/util/goal_constants.h index 6d0a7cf484..eb3737e1ee 100644 --- a/decompiler/util/goal_constants.h +++ b/decompiler/util/goal_constants.h @@ -1,8 +1,11 @@ #pragma once #include "common/common_types.h" +#include "common/versions.h" // Separate constants for the decompiler, so we can make changes to the game without breaking // decompilation. constexpr s32 DECOMP_SYM_INFO_OFFSET = 8167 * 8 - 4; + +constexpr PerGameVersion OFFSET_OF_NEXT_STATE_STORE = {72, 64}; \ No newline at end of file diff --git a/goal_src/jak2/kernel-defs.gc b/goal_src/jak2/kernel-defs.gc index 2468fa510f..ca43b8de88 100644 --- a/goal_src/jak2/kernel-defs.gc +++ b/goal_src/jak2/kernel-defs.gc @@ -103,7 +103,7 @@ (define-extern __mem-move (function pointer pointer uint none)) (define-extern file-stream-read (function file-stream pointer int int)) -(define-extern file-stream-open (function file-stream basic symbol file-stream)) +(define-extern file-stream-open (function file-stream string symbol file-stream)) (define-extern file-stream-length (function file-stream int)) diff --git a/goalc/build_level/collide_bvh.cpp b/goalc/build_level/collide_bvh.cpp index cd832a688e..9e3f4a0e6f 100644 --- a/goalc/build_level/collide_bvh.cpp +++ b/goalc/build_level/collide_bvh.cpp @@ -1,6 +1,7 @@ #include "collide_bvh.h" #include +#include #include #include "common/log/log.h" @@ -19,15 +20,6 @@ namespace collide { namespace { constexpr int MAX_UNIQUE_VERTS_IN_FRAG = 128; -struct BBox { - math::Vector3f mins, maxs; - std::string sz_to_string() const { - return fmt::format("{} {} ({})", (mins / 4096.f).to_string_aligned(), - (maxs / 4096.f).to_string_aligned(), - ((maxs - mins) / 4096.f).to_string_aligned()); - } -}; - /*! * The Collide node. * If it's a leaf, it has faces @@ -45,20 +37,6 @@ struct VectorHash { } }; -/*! - * Recursively get a set of unique vertices. - */ -void collect_vertices(const CNode& node, std::unordered_set& verts) { - for (auto& child : node.child_nodes) { - collect_vertices(child, verts); - } - for (auto& face : node.faces) { - verts.insert(face.v[0]); - verts.insert(face.v[1]); - verts.insert(face.v[2]); - } -} - /*! * Recursively get a list of vertices. */ @@ -73,30 +51,6 @@ void collect_vertices(const CNode& node, std::vector& verts) { } } -/*! - * Get the axis-aligned bounding box of these vertices - */ -BBox compute_my_bbox(const std::vector& verts) { - ASSERT(!verts.empty()); - BBox result; - result.mins = verts.front(); - result.maxs = verts.front(); - for (auto& v : verts) { - result.mins.min_in_place(v); - result.maxs.min_in_place(v); - } - return result; -} - -/*! - * Get the axis-aligned bounding box of all vertices in this node and its children - */ -BBox compute_my_bbox(const CNode& node) { - std::vector verts; - collect_vertices(node, verts); - return compute_my_bbox(verts); -} - /*! * Find the vertex in verts that is most distant from pt. */ @@ -154,6 +108,7 @@ void split_along_dim(std::vector& faces, std::sort(faces.begin(), faces.end(), [=](const CollideFace& a, const CollideFace& b) { return a.bsphere[dim] < b.bsphere[dim]; }); + fmt::print("splitting with size: {}\n", faces.size()); size_t split_idx = faces.size() / 2; out0->insert(out0->end(), faces.begin(), faces.begin() + split_idx); out1->insert(out1->end(), faces.begin() + split_idx, faces.end()); @@ -165,7 +120,6 @@ void split_along_dim(std::vector& faces, void split_node_once(CNode& node, CNode* out0, CNode* out1) { compute_my_bsphere_ritters(node); CNode temps[6]; - // split_along_dim(node.faces, pick_dim_for_split(node.faces), &out0->faces, &out1->faces); split_along_dim(node.faces, 0, &temps[0].faces, &temps[1].faces); split_along_dim(node.faces, 1, &temps[2].faces, &temps[3].faces); split_along_dim(node.faces, 2, &temps[4].faces, &temps[5].faces); @@ -211,7 +165,7 @@ bool needs_split(const CNode& node) { } } - return unique_verts.size() >= 128; + return unique_verts.size() >= MAX_UNIQUE_VERTS_IN_FRAG; } void split_recursive(CNode& to_split) { @@ -342,7 +296,17 @@ CollideTree construct_collide_bvh(const std::vector& tris) { bvh_timer.start(); auto tree = build_collide_tree(root); debug_stats(tree); + lg::info("Tree layout done in {:.2f} ms", bvh_timer.getMs()); + std::map size_histogram; + for (const auto& f : tree.frags.frags) { + size_histogram[f.faces.size()]++; + } + + for (auto [size, count] : size_histogram) { + fmt::print(" [{:3d}] {:3d} ({})\n", size, count, size * count); + } + return tree; } diff --git a/test.sh b/test.sh index 32eb344025..c52aa0d52b 100755 --- a/test.sh +++ b/test.sh @@ -3,4 +3,4 @@ # Directory of this script DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -$DIR/build/goalc-test --gtest_brief=1 --gtest_color=yes "$@" --gtest_filter="-*MANUAL_TEST*" +$DIR/build/goalc-test --gtest_color=yes "$@" --gtest_filter="-*MANUAL_TEST*" diff --git a/test/decompiler/FormRegressionTest.h b/test/decompiler/FormRegressionTest.h index 974b8a4081..652652dab1 100644 --- a/test/decompiler/FormRegressionTest.h +++ b/test/decompiler/FormRegressionTest.h @@ -31,7 +31,7 @@ class FormRegressionTest : public ::testing::TestWithParam { static void TearDownTestCase(); struct TestData { - explicit TestData(int instrs, GameVersion version) : func(0, instrs, version) {} + explicit TestData(int instrs, GameVersion version) : func(0, instrs, version), file(version) {} decompiler::Function func; decompiler::LinkedObjectFile file; diff --git a/test/decompiler/reference/jak1/engine/anim/joint_REF.gc b/test/decompiler/reference/jak1/engine/anim/joint_REF.gc index fbc1a8b3c7..196610b1f7 100644 --- a/test/decompiler/reference/jak1/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak1/engine/anim/joint_REF.gc @@ -541,7 +541,7 @@ ;; definition for method 9 of type art-mesh-geo ;; ERROR: Type Propagation failed: Failed type prop at op 20 ((set! v1 (l.h (+ s4 6)))): Could not get type of load: (set! v1 (l.h (+ s4 6))). -;; ERROR: Type Propagation failed: Type analysis failed +;; WARN: Type analysis failed (defmethod login art-mesh-geo ((a0-0 art-mesh-geo)) (local-vars (v0-0 none) diff --git a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc index e932b74403..28bebca444 100644 --- a/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc +++ b/test/decompiler/reference/jak1/engine/draw/drawable_REF.gc @@ -134,7 +134,7 @@ ;; definition for function vis-cull ;; ERROR: Type Propagation failed: Failed type prop at op 3 ((set! v1 (l.b (+ v1 #x38b0)))): Could not get type of load: (set! v1 (l.b (+ v1 #x38b0))). -;; ERROR: Type Propagation failed: Type analysis failed +;; WARN: Type analysis failed ;; ERROR: Unsupported inline assembly instruction kind - [addiu a0, a0, 56] (defun vis-cull ((a0-0 int)) (local-vars (v0-0 none) (v1-0 int) (v1-1 int) (v1-2 none) (v1-3 none) (a0-1 none) (a0-2 none) (a1-0 int)) diff --git a/test/decompiler/reference/jak1/engine/gfx/sky/sky_REF.gc b/test/decompiler/reference/jak1/engine/gfx/sky/sky_REF.gc index d9c5a079ee..94b3fcdde0 100644 --- a/test/decompiler/reference/jak1/engine/gfx/sky/sky_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/sky/sky_REF.gc @@ -139,7 +139,7 @@ ;; definition for function sky-draw ;; ERROR: Type Propagation failed: Failed type prop at op 12 ((set! a0 (+ a0 16))): Cannot get_type_int2: (+ a0 16), args float and -;; ERROR: Type Propagation failed: Type analysis failed +;; WARN: Type analysis failed (defun sky-draw ((a0-0 sky-parms)) (local-vars (v0-0 none) diff --git a/test/decompiler/reference/jak1/engine/math/vector_REF.gc b/test/decompiler/reference/jak1/engine/math/vector_REF.gc index c6a0bb7fb2..7ef66b5653 100644 --- a/test/decompiler/reference/jak1/engine/math/vector_REF.gc +++ b/test/decompiler/reference/jak1/engine/math/vector_REF.gc @@ -511,27 +511,7 @@ ;; definition for function vector-length (defun vector-length ((arg0 vector)) - (local-vars (v0-0 float)) - (rlet ((acc :class vf) - (Q :class vf) - (vf0 :class vf) - (vf1 :class vf) - ) - (init-vf0-vector) - (.lvf vf1 (&-> arg0 quad)) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf acc vf0 vf1 :mask #b1000) - (.add.mul.y.vf acc vf0 vf1 acc :mask #b1000) - (.add.mul.z.vf vf1 vf0 vf1 acc :mask #b1000) - (.sqrt.vf Q vf1 :ftf #b11) - (.add.w.vf vf1 vf0 vf0 :mask #b1) - (.wait.vf) - (.mul.vf vf1 vf1 Q :mask #b1) - (.nop.vf) - (.nop.vf) - (.mov v0-0 vf1) - v0-0 - ) + (vector-length arg0) ) ;; definition for function vector-length-squared diff --git a/test/decompiler/reference/jak1/engine/util/glist_REF.gc b/test/decompiler/reference/jak1/engine/util/glist_REF.gc index 4ee3d8e0b4..9888a3d8e5 100644 --- a/test/decompiler/reference/jak1/engine/util/glist_REF.gc +++ b/test/decompiler/reference/jak1/engine/util/glist_REF.gc @@ -112,7 +112,7 @@ ;; definition for function glst-find-node-by-name ;; ERROR: Type Propagation failed: Failed type prop at op 7 ((set! a0 (l.wu (+ v1 8)))): Could not get type of load: (set! a0 (l.wu (+ v1 8))). -;; ERROR: Type Propagation failed: Type analysis failed +;; WARN: Type analysis failed (defun glst-find-node-by-name ((a0-0 glst-list) (a1-0 string)) (local-vars (v0-0 none) @@ -173,7 +173,7 @@ ;; definition for function glst-length-of-longest-name ;; ERROR: Type Propagation failed: Failed type prop at op 6 ((set! a0 (l.wu (+ v1 8)))): Could not get type of load: (set! a0 (l.wu (+ v1 8))). -;; ERROR: Type Propagation failed: Type analysis failed +;; WARN: Type analysis failed (defun glst-length-of-longest-name ((a0-0 glst-list)) (local-vars (v0-0 none) diff --git a/test/decompiler/reference/jak1/levels/rolling/rolling-obs_REF.gc b/test/decompiler/reference/jak1/levels/rolling/rolling-obs_REF.gc index 51322f4954..8b90d8f4bf 100644 --- a/test/decompiler/reference/jak1/levels/rolling/rolling-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/rolling/rolling-obs_REF.gc @@ -872,7 +872,7 @@ ;; definition for function race-time-save ;; ERROR: Type Propagation failed: Failed type prop at op 6 ((set! v1 (l.wu (+ a0 -4)))): Could not get type of load: (set! v1 (l.wu (+ a0 -4))). -;; ERROR: Type Propagation failed: Type analysis failed +;; WARN: Type analysis failed ;; ERROR: Function may read a register that is not set: a2 (defun race-time-save ((a0-0 race-time) (a1-0 task-control)) (local-vars diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index 31e1cdc975..f6ff064fc8 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -554,4 +554,145 @@ (defmacro .mfc0 (&rest stuff) `(empty) + ) + +;; pad +(defmacro cpad-pressed (pad-idx) + `(-> *cpad-list* cpads ,pad-idx button0-rel 0) + ) + +(defmacro cpad-hold (pad-idx) + `(-> *cpad-list* cpads ,pad-idx button0-abs 0) + ) + +(defmacro cpad-pressed? (pad-idx &rest buttons) + `(logtest? (cpad-pressed ,pad-idx) (pad-buttons ,@buttons)) + ) + +(defmacro cpad-hold? (pad-idx &rest buttons) + `(logtest? (cpad-hold ,pad-idx) (pad-buttons ,@buttons)) + ) + +(defmacro res-lump-data (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)) &key (time -1000000000.0)) + "Helper macro to get data from a res-lump without interpolation." + `(the-as ,type ((method-of-type res-lump get-property-data) + ,lump + ,name + 'interp + ,time + (the-as pointer #f) + ,tag-ptr + *res-static-buf* + ) + ) + ) + +(defmacro res-lump-data-exact (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)) &key (time 0.0)) + "Helper macro to get start of data from a res-lump." + `(the-as ,type ((method-of-type res-lump get-property-data) + ,lump + ,name + 'exact + ,time + (the-as pointer #f) + ,tag-ptr + *res-static-buf* + ) + ) + ) + +(defmacro res-lump-struct (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)) &key (time -1000000000.0)) + `(the-as ,type ((method-of-type res-lump get-property-struct) + ,lump + ,name + 'interp + ,time + (the-as structure #f) + ,tag-ptr + *res-static-buf* + ) + ) + ) + +(defmacro res-lump-struct-exact (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)) &key (time 0.0)) + `(the-as ,type ((method-of-type res-lump get-property-struct) + ,lump + ,name + 'exact + ,time + (the-as structure #f) + ,tag-ptr + *res-static-buf* + ) + ) + ) + +(defmacro res-lump-value (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)) &key (default (the-as uint128 0)) &key (time -1000000000.0)) + "Helper macro to get a value from a res-lump with no interpolation." + `(the-as ,type ((method-of-type res-lump get-property-value) + ,lump + ,name + 'interp + ,time + ,default + ,tag-ptr + *res-static-buf* + ) + ) + ) + +(defmacro res-lump-float (lump name &key (tag-ptr (the-as (pointer res-tag) #f)) &key (default 0.0) &key (time -1000000000.0)) + "Helper macro to get a float from a res-lump with no interpolation." + `((method-of-type res-lump get-property-value-float) + ,lump + ,name + 'interp + ,time + ,default + ,tag-ptr + *res-static-buf* + ) + ) + +(defmacro seek! (place target rate) + "Macro to use seek in-place. place is the base, and where the result is stored." + `(set! ,place (seek ,place ,target ,rate)) + ) + +(defmacro seekl! (place target rate) + "Macro to use seekl in-place. place is the base, and where the result is stored." + `(set! ,place (seekl ,place ,target ,rate)) + ) + + +;; run the given function in a process right now. +;; will return to here when: +;; - you return +;; - you deactivate +;; - you go +;; - you throw to 'initialize +(defmacro run-now-in-process (proc func &rest args) + `((the (function _varargs_ object) run-function-in-process) + ,proc ,func ,@args + ) + ) + +;; sets the main thread of the given process to run the given thing. +;; this resets the main thread stack back to the top +(defmacro run-next-time-in-process (proc func &rest args) + `((the (function _varargs_ object) set-to-run) + (-> ,proc main-thread) ,func ,@args + ) + ) + +(defmacro send-event (proc msg &key (from (with-pp pp)) &rest params) + "Send an event to a process. This should be used over send-event-function" + + `(let ((event-data (new 'stack-no-clear 'event-message-block))) + (set! (-> event-data from) (process->ppointer ,from)) + (set! (-> event-data num-params) ,(length params)) + (set! (-> event-data message) ,msg) + ,@(apply-i (lambda (x i) `(set! (-> event-data param ,i) (the-as uint ,x))) params) + (send-event-function ,proc event-data) + ) ) \ No newline at end of file diff --git a/test/decompiler/reference/jak2/kernel/gstate_REF.gc b/test/decompiler/reference/jak2/kernel/gstate_REF.gc index 8102727ef5..219ab13e6b 100644 --- a/test/decompiler/reference/jak2/kernel/gstate_REF.gc +++ b/test/decompiler/reference/jak2/kernel/gstate_REF.gc @@ -47,7 +47,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [jr t9] ;; ERROR: Unsupported inline assembly instruction kind - [sw v1, 0(sp)] (defun enter-state ((arg0 object) (arg1 object) (arg2 object) (arg3 object) (arg4 object) (arg5 object)) - (local-vars (s7-0 none) (sp-0 int) (ra-0 int) (sv-0 none)) + (local-vars (s7-0 none) (sp-0 int) (ra-0 int)) (with-pp (logclear! (-> pp mask) (process-mask sleep sleep-code)) (logior! (-> pp mask) (process-mask going)) diff --git a/test/decompiler/test_InstructionDecode.cpp b/test/decompiler/test_InstructionDecode.cpp index 9489c4aa24..7f49b6ceba 100644 --- a/test/decompiler/test_InstructionDecode.cpp +++ b/test/decompiler/test_InstructionDecode.cpp @@ -7,7 +7,7 @@ using namespace decompiler; TEST(InstructionDecode, VDIV) { init_opcode_info(); - LinkedObjectFile file; + LinkedObjectFile file(GameVersion::Jak1); u32 vdiv_test = 0b010010'1'10'01'10100'01010'01110111100; // ...... z y 20 10 LinkedWord vdiv_word(vdiv_test); @@ -17,7 +17,7 @@ TEST(InstructionDecode, VDIV) { TEST(InstructionDecode, VRSQRT) { init_opcode_info(); - LinkedObjectFile file; + LinkedObjectFile file(GameVersion::Jak1); u32 vdiv_test = 0b010010'1'10'01'10100'01010'01110111110; // ...... z y 20 10 LinkedWord vdiv_word(vdiv_test); @@ -27,7 +27,7 @@ TEST(InstructionDecode, VRSQRT) { TEST(InstructionDecode, VSQRT) { init_opcode_info(); - LinkedObjectFile file; + LinkedObjectFile file(GameVersion::Jak1); u32 vdiv_test = 0b010010'1'10'00'10100'00000'01110111101; // ...... z X 20 X LinkedWord vdiv_word(vdiv_test); @@ -37,7 +37,7 @@ TEST(InstructionDecode, VSQRT) { TEST(Instruction, IntelMaskMove) { init_opcode_info(); - LinkedObjectFile file; + LinkedObjectFile file(GameVersion::Jak1); u32 vmove_instr = 0b010010'1'1100'00001'00010'01100111100; LinkedWord vmove_word(vmove_instr); auto instr = decode_instruction(vmove_word, file, 0, 0); diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 64a5c8dd02..2390abf35f 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -15,7 +15,26 @@ "(method 10 process)", "(method 14 dead-pool)", /// GSTATE - "enter-state" // stack pointer asm + "enter-state", // stack pointer asm + // MATH + "logf", "log2f", "cube-root", "lerp-scale", "rand-vu-init", "rand-vu", "rand-vu-nostep", + // MATRIX + "matrix-axis-sin-cos-vu!", "matrix-axis-sin-cos!", "matrix-3x3-normalize!", + // DMA + "disasm-dma-list", + // PAD (bug) + "service-cpads", + // GEOMETRY asm + "closest-pt-in-triangle", "circle-circle-xz-intersect", "calculate-basis-functions-vector!", "curve-evaluate!", + // TIMER asm + "(method 9 clock)", + // math camera stupid broken gif crap and CLIP + "update-math-camera", "transform-point-vector!", "transform-point-qword!", "transform-point-vector-scale!", + // quad thing + "(method 3 connection-minimap)", + "(method 3 sky-vertex)", + // cache asm + "invalidate-cache-line" ], "skip_compile_states": {} diff --git a/test/offline/offline_test_main.cpp b/test/offline/offline_test_main.cpp index 20cdc3d209..bffc6cbb8f 100644 --- a/test/offline/offline_test_main.cpp +++ b/test/offline/offline_test_main.cpp @@ -406,8 +406,8 @@ int main(int argc, char* argv[]) { app.add_flag("-d,--dump_current_output", dump_current_output, "Output the current output to a folder, use in conjunction with the reference test " "files update script"); - app.add_flag("-m,--max_files", max_files, - "Limit the amount of files ran in a single test, picks the first N"); + app.add_option("-m,--max_files", max_files, + "Limit the amount of files ran in a single test, picks the first N"); app.validate_positionals(); CLI11_PARSE(app, argc, argv); @@ -446,6 +446,7 @@ int main(int argc, char* argv[]) { auto compare_result = compare(decompiler, files, dump_current_output); lg::info("Compared {} lines. {}/{} files passed.", compare_result.total_lines, compare_result.ok_files, compare_result.total_files); + lg::info("Dump? {}\n", dump_current_output); if (!compare_result.failing_files.empty()) { lg::error("Failing files:"); From 346a258902958d7f0eabc8ba2fd3041627344975 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Mon, 22 Aug 2022 18:55:08 -0400 Subject: [PATCH 22/23] game/speedrunning: Add struct with relevant information to facilitate Auto Splitting (#1775) * game: add auto-splitter structs * game/jak1: wire up auto-splitter updating to game when in SR mode * game/jak1: add info to split on picking up white eco * game/jak1: add another two tasks for fish and finalboss * game/jak1: autosplitting code entirely in GOAL --- game/CMakeLists.txt | 1 - game/kernel/common/kmachine.cpp | 4 + game/kernel/common/kmachine.h | 1 + game/kernel/jak1/kmachine.cpp | 1 + game/kernel/jak1/kmachine.h | 2 +- goal_src/jak1/dgos/engine.gd | 2 + goal_src/jak1/dgos/game.gd | 2 + goal_src/jak1/engine/ui/progress/progress.gc | 1 + goal_src/jak1/game.gp | 4 +- goal_src/jak1/kernel-defs.gc | 2 + goal_src/jak1/pc/features/autosplit-h.gc | 136 ++++++++++++++++++ goal_src/jak1/pc/features/autosplit.gc | 141 +++++++++++++++++++ goal_src/jak1/pc/pckernel.gc | 5 + goal_src/jak1/pc/progress-pc.gc | 3 + 14 files changed, 302 insertions(+), 3 deletions(-) create mode 100644 goal_src/jak1/pc/features/autosplit-h.gc create mode 100644 goal_src/jak1/pc/features/autosplit.gc diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index 429ca621ef..79913848a0 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -145,7 +145,6 @@ set(RUNTIME_SOURCE graphics/pipelines/opengl.cpp system/vm/dmac.cpp system/vm/vm.cpp - tools/subtitles/subtitle_editor.h tools/subtitles/subtitle_editor.cpp) find_package(Git) diff --git a/game/kernel/common/kmachine.cpp b/game/kernel/common/kmachine.cpp index df86ebebb6..3e1dd47077 100644 --- a/game/kernel/common/kmachine.cpp +++ b/game/kernel/common/kmachine.cpp @@ -412,6 +412,10 @@ int get_monitor_count() { return Gfx::get_monitor_count(); } +int get_unix_timestamp() { + return std::time(nullptr); +} + void mkdir_path(u32 filepath) { auto filepath_str = std::string(Ptr(filepath).c()->data()); file_util::create_dir_if_needed_for_file(filepath_str); diff --git a/game/kernel/common/kmachine.h b/game/kernel/common/kmachine.h index d84dbeaa86..eb429ef0b2 100644 --- a/game/kernel/common/kmachine.h +++ b/game/kernel/common/kmachine.h @@ -64,6 +64,7 @@ void get_screen_size(s64 vmode_idx, u32 w_ptr, u32 h_ptr); s64 get_screen_rate(s64 vmode_idx); s64 get_screen_vmode_count(); int get_monitor_count(); +int get_unix_timestamp(); void mkdir_path(u32 filepath); u64 filepath_exists(u32 filepath); void prof_event(u32 name, u32 kind); diff --git a/game/kernel/jak1/kmachine.cpp b/game/kernel/jak1/kmachine.cpp index 8d4330020e..a04dd4dc48 100644 --- a/game/kernel/jak1/kmachine.cpp +++ b/game/kernel/jak1/kmachine.cpp @@ -645,6 +645,7 @@ void InitMachine_PCPort() { make_function_symbol_from_c("pc-set-window-lock", (void*)set_window_lock); make_function_symbol_from_c("pc-set-game-resolution", (void*)set_game_resolution); make_function_symbol_from_c("pc-set-msaa", (void*)set_msaa); + make_function_symbol_from_c("pc-get-unix-timestamp", (void*)get_unix_timestamp); // graphics things make_function_symbol_from_c("pc-set-letterbox", (void*)Gfx::set_letterbox); diff --git a/game/kernel/jak1/kmachine.h b/game/kernel/jak1/kmachine.h index b27062f7c2..2d9bd9947f 100644 --- a/game/kernel/jak1/kmachine.h +++ b/game/kernel/jak1/kmachine.h @@ -39,4 +39,4 @@ struct DiscordInfo { u32 flutflut; // are we riding on flut flut? u32 time_of_day; }; -} // namespace jak1 \ No newline at end of file +} // namespace jak1 diff --git a/goal_src/jak1/dgos/engine.gd b/goal_src/jak1/dgos/engine.gd index 4a0bc6228c..6999c39d6e 100644 --- a/goal_src/jak1/dgos/engine.gd +++ b/goal_src/jak1/dgos/engine.gd @@ -197,6 +197,8 @@ ("game-save.o" "game-save") ("settings.o" "settings") ("pc-anim-util.o" "pc-anim-util") ;; added + ("autosplit-h.o" "autosplit-h") ;; added + ("autosplit.o" "autosplit") ;; added ("pckernel.o" "pckernel") ;; added ("mood-tables.o" "mood-tables") ("mood.o" "mood") diff --git a/goal_src/jak1/dgos/game.gd b/goal_src/jak1/dgos/game.gd index 3b6b83adfb..5c115ef740 100644 --- a/goal_src/jak1/dgos/game.gd +++ b/goal_src/jak1/dgos/game.gd @@ -193,6 +193,8 @@ ("game-save.o" "game-save") ("settings.o" "settings") ("pc-anim-util.o" "pc-anim-util") ;; added + ("autosplit-h.o" "autosplit-h") ;; added + ("autosplit.o" "autosplit") ;; added ("pckernel.o" "pckernel") ;; added ("mood-tables.o" "mood-tables") ("mood.o" "mood") diff --git a/goal_src/jak1/engine/ui/progress/progress.gc b/goal_src/jak1/engine/ui/progress/progress.gc index 57f3c8757d..9fe1bc36ef 100644 --- a/goal_src/jak1/engine/ui/progress/progress.gc +++ b/goal_src/jak1/engine/ui/progress/progress.gc @@ -1730,6 +1730,7 @@ ;; Start a new game differently if speedrunning mode is active (cond ((= (-> *pc-settings* speedrunner-mode?) #t) + (update-autosplit-jak1-new-game) ;; spawn at the warp gate (initialize! *game-info* 'game (the-as game-save #f) "game-start") ;; disable hints (this seems to be overriden by your slot 1 save though) diff --git a/goal_src/jak1/game.gp b/goal_src/jak1/game.gp index f9b07cda01..ea594b3d13 100644 --- a/goal_src/jak1/game.gp +++ b/goal_src/jak1/game.gp @@ -2037,9 +2037,11 @@ ) ;; Custom or Modified Code +(goal-src "pc/features/autosplit-h.gc") +(goal-src "pc/features/autosplit.gc" "autosplit-h" "task-control-h") (goal-src "pc/pckernel-h.gc" "dma-buffer") (goal-src "pc/util/pc-anim-util.gc" "target-h") -(goal-src "pc/pckernel.gc" "pc-anim-util" "settings" "video" "target-h") +(goal-src "pc/pckernel.gc" "pc-anim-util" "settings" "video" "target-h" "autosplit-h") (goal-src "pc/subtitle.gc" "text" "pckernel" "hint-control" "loader-h" "gsound" "ambient") (goal-src "pc/progress-pc.gc" "progress" "pckernel") (goal-src "pc/util/anim-tester-x.gc" "pckernel" "gstring" "joint" "process-drawable" "art-h" "effect-control") diff --git a/goal_src/jak1/kernel-defs.gc b/goal_src/jak1/kernel-defs.gc index 0ff6d85112..7895cd0acb 100644 --- a/goal_src/jak1/kernel-defs.gc +++ b/goal_src/jak1/kernel-defs.gc @@ -366,6 +366,8 @@ (define-extern pc-set-msaa (function int none)) (define-extern pc-set-gfx-hack (function pc-gfx-hack symbol none)) +(define-extern pc-get-unix-timestamp (function int)) + (defenum pc-prof-event (begin 0) (end 1) diff --git a/goal_src/jak1/pc/features/autosplit-h.gc b/goal_src/jak1/pc/features/autosplit-h.gc new file mode 100644 index 0000000000..85b5664b03 --- /dev/null +++ b/goal_src/jak1/pc/features/autosplit-h.gc @@ -0,0 +1,136 @@ +;;-*-Lisp-*- +(in-package goal) + +;; LiveSplit ASL requires all settings to initalized _before_ you connect the process +;; Therefore everything has to be laid out in a predictable fashion before hand +;; So this is a lot of hard-coding, but not too bad when just copied from the debug menu code +;; +;; DO NOT change the order, appending to the end is safe! +(deftype autosplit-info-jak1 (structure) + ((marker uint8 20) ;; UnLiStEdStRaTs_JaK1 - DONT EVER CHANGE THIS + ;; General stats + (num-power-cells uint32) + (num-orbs uint32) + (num-scout-flies uint32) + (padding-stats uint8 200) ;; padding for future growth + ;; loading/cutscene/control related info + (game-hash uint32) + (in-cutscene? symbol) + (is-loading? symbol) + (padding-controls uint8 200) ;; padding for future growth + ;; need-resolution tasks + (res-training-gimmie uint8) + (res-training-door uint8) + (res-training-climb uint8) + (res-training-buzzer uint8) + (res-jungle-eggtop uint8) + (res-jungle-lurkerm uint8) + (res-jungle-tower uint8) + (res-jungle-fishgame uint8) + (res-jungle-plant uint8) + (res-jungle-buzzer uint8) + (res-jungle-canyon-end uint8) + (res-jungle-temple-door uint8) + (res-village1-yakow uint8) + (res-village1-mayor-money uint8) + (res-village1-uncle-money uint8) + (res-village1-oracle-money1 uint8) + (res-village1-oracle-money2 uint8) + (res-village1-buzzer uint8) + (res-beach-ecorocks uint8) + (res-beach-pelican uint8) + (res-beach-flutflut uint8) + (res-beach-seagull uint8) + (res-beach-cannon uint8) + (res-beach-buzzer uint8) + (res-beach-gimmie uint8) + (res-beach-sentinel uint8) + (res-misty-muse uint8) + (res-misty-boat uint8) + (res-misty-warehouse uint8) + (res-misty-cannon uint8) + (res-misty-bike uint8) + (res-misty-buzzer uint8) + (res-misty-bike-jump uint8) + (res-misty-eco-challenge uint8) + (res-village2-gambler-money uint8) + (res-village2-geologist-money uint8) + (res-village2-warrior-money uint8) + (res-village2-oracle-money1 uint8) + (res-village2-oracle-money2 uint8) + (res-village2-buzzer uint8) + (res-swamp-billy uint8) + (res-swamp-flutflut uint8) + (res-swamp-battle uint8) + (res-swamp-tether-1 uint8) + (res-swamp-tether-2 uint8) + (res-swamp-tether-3 uint8) + (res-swamp-tether-4 uint8) + (res-swamp-buzzer uint8) + (res-swamp-arm uint8) + (res-sunken-platforms uint8) + (res-sunken-pipe uint8) + (res-sunken-slide uint8) + (res-sunken-room uint8) + (res-sunken-sharks uint8) + (res-sunken-buzzer uint8) + (res-sunken-top-of-helix uint8) + (res-sunken-spinning-room uint8) + (res-rolling-race uint8) + (res-rolling-robbers uint8) + (res-rolling-moles uint8) + (res-rolling-plants uint8) + (res-rolling-lake uint8) + (res-rolling-buzzer uint8) + (res-rolling-ring-chase-1 uint8) + (res-rolling-ring-chase-2 uint8) + (res-snow-eggtop uint8) + (res-snow-ram uint8) + (res-snow-fort uint8) + (res-snow-ball uint8) + (res-snow-bunnies uint8) + (res-snow-buzzer uint8) + (res-snow-bumpers uint8) + (res-snow-cage uint8) + (res-red-eggtop uint8) + (res-firecanyon-buzzer uint8) + (res-firecanyon-end uint8) + (res-citadel-sage-green uint8) + (res-citadel-sage-blue uint8) + (res-citadel-sage-red uint8) + (res-citadel-sage-yellow uint8) + (res-citadel-buzzer uint8) + (res-village3-extra1 uint8) + (res-village3-buzzer uint8) + (res-village3-miner-money1 uint8) + (res-village3-miner-money2 uint8) + (res-village3-miner-money3 uint8) + (res-village3-miner-money4 uint8) + (res-village3-oracle-money1 uint8) + (res-village3-oracle-money2 uint8) + (res-cave-gnawers uint8) + (res-cave-dark-crystals uint8) + (res-cave-dark-climb uint8) + (res-cave-robot-climb uint8) + (res-cave-swing-poles uint8) + (res-cave-spider-tunnel uint8) + (res-cave-platforms uint8) + (res-cave-buzzer uint8) + (res-ogre-boss uint8) + (res-ogre-end uint8) + (res-ogre-buzzer uint8) + (res-ogre-secret uint8) + (res-lavatube-end uint8) + (res-lavatube-buzzer uint8) + (res-lavatube-balls uint8) + (res-intro uint8) + ;; misc other tasks + (int-finalboss-movies uint8) + (unk-finalboss-movies uint8) + (int-jungle-fishgame uint8) + ;; end marker just to make things look nice in a memory view + (end-marker uint8 4))) + +(define-extern *autosplit-info-jak1* autosplit-info-jak1) +(define-extern update-autosplit-info-jak1 (function none)) +(define-extern update-autosplit-jak1-new-game (function none)) diff --git a/goal_src/jak1/pc/features/autosplit.gc b/goal_src/jak1/pc/features/autosplit.gc new file mode 100644 index 0000000000..c9a24c4c1c --- /dev/null +++ b/goal_src/jak1/pc/features/autosplit.gc @@ -0,0 +1,141 @@ +;;-*-Lisp-*- +(in-package goal) + +(define *autosplit-info-jak1* (new 'static 'autosplit-info-jak1)) +;; Setup markers +(charp<-string (-> *autosplit-info-jak1* marker) "UnLiStEdStRaTs_JaK1") +(charp<-string (-> *autosplit-info-jak1* end-marker) "end") +;; Setup Padding +(charp<-string (-> *autosplit-info-jak1* padding-stats) "padding-stats!") +(charp<-string (-> *autosplit-info-jak1* padding-controls) "padding-controls!") + + +(defun update-autosplit-info-jak1 () + ;; general statistics + (set! (-> *autosplit-info-jak1* num-power-cells) (the int (-> *game-info* fuel))) + (set! (-> *autosplit-info-jak1* num-orbs) (the int (-> *game-info* money-total))) + (set! (-> *autosplit-info-jak1* num-scout-flies) (the int (-> *game-info* buzzer-total))) + + ;; loading/cutscene related flags + (set! (-> *autosplit-info-jak1* in-cutscene?) (-> *pc-settings* movie?)) + + ;; need resolution flags + ;; TODO - a macro for this would be nice + (set! (-> *autosplit-info-jak1* res-training-gimmie) (if (task-closed? (game-task training-gimmie) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-training-door) (if (task-closed? (game-task training-door) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-training-climb) (if (task-closed? (game-task training-climb) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-training-buzzer) (if (task-closed? (game-task training-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-jungle-eggtop) (if (task-closed? (game-task jungle-eggtop) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-jungle-lurkerm) (if (task-closed? (game-task jungle-lurkerm) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-jungle-tower) (if (task-closed? (game-task jungle-tower) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-jungle-fishgame) (if (task-closed? (game-task jungle-fishgame) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-jungle-plant) (if (task-closed? (game-task jungle-plant) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-jungle-buzzer) (if (task-closed? (game-task jungle-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-jungle-canyon-end) (if (task-closed? (game-task jungle-canyon-end) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-jungle-temple-door) (if (task-closed? (game-task jungle-temple-door) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village1-yakow) (if (task-closed? (game-task village1-yakow) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village1-mayor-money) (if (task-closed? (game-task village1-mayor-money) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village1-uncle-money) (if (task-closed? (game-task village1-uncle-money) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village1-oracle-money1) (if (task-closed? (game-task village1-oracle-money1) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village1-oracle-money2) (if (task-closed? (game-task village1-oracle-money2) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village1-buzzer) (if (task-closed? (game-task village1-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-beach-ecorocks) (if (task-closed? (game-task beach-ecorocks) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-beach-pelican) (if (task-closed? (game-task beach-pelican) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-beach-flutflut) (if (task-closed? (game-task beach-flutflut) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-beach-seagull) (if (task-closed? (game-task beach-seagull) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-beach-cannon) (if (task-closed? (game-task beach-cannon) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-beach-buzzer) (if (task-closed? (game-task beach-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-beach-gimmie) (if (task-closed? (game-task beach-gimmie) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-beach-sentinel) (if (task-closed? (game-task beach-sentinel) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-misty-muse) (if (task-closed? (game-task misty-muse) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-misty-boat) (if (task-closed? (game-task misty-boat) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-misty-warehouse) (if (task-closed? (game-task misty-warehouse) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-misty-cannon) (if (task-closed? (game-task misty-cannon) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-misty-bike) (if (task-closed? (game-task misty-bike) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-misty-buzzer) (if (task-closed? (game-task misty-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-misty-bike-jump) (if (task-closed? (game-task misty-bike-jump) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-misty-eco-challenge) (if (task-closed? (game-task misty-eco-challenge) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village2-gambler-money) (if (task-closed? (game-task village2-gambler-money) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village2-geologist-money) (if (task-closed? (game-task village2-geologist-money) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village2-warrior-money) (if (task-closed? (game-task village2-warrior-money) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village2-oracle-money1) (if (task-closed? (game-task village2-oracle-money1) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village2-oracle-money2) (if (task-closed? (game-task village2-oracle-money2) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village2-buzzer) (if (task-closed? (game-task village2-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-billy) (if (task-closed? (game-task swamp-billy) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-flutflut) (if (task-closed? (game-task swamp-flutflut) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-battle) (if (task-closed? (game-task swamp-battle) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-tether-1) (if (task-closed? (game-task swamp-tether-1) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-tether-2) (if (task-closed? (game-task swamp-tether-2) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-tether-3) (if (task-closed? (game-task swamp-tether-3) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-tether-4) (if (task-closed? (game-task swamp-tether-4) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-buzzer) (if (task-closed? (game-task swamp-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-swamp-arm) (if (task-closed? (game-task swamp-arm) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-sunken-platforms) (if (task-closed? (game-task sunken-platforms) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-sunken-pipe) (if (task-closed? (game-task sunken-pipe) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-sunken-slide) (if (task-closed? (game-task sunken-slide) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-sunken-room) (if (task-closed? (game-task sunken-room) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-sunken-sharks) (if (task-closed? (game-task sunken-sharks) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-sunken-buzzer) (if (task-closed? (game-task sunken-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-sunken-top-of-helix) (if (task-closed? (game-task sunken-top-of-helix) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-sunken-spinning-room) (if (task-closed? (game-task sunken-spinning-room) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-rolling-race) (if (task-closed? (game-task rolling-race) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-rolling-robbers) (if (task-closed? (game-task rolling-robbers) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-rolling-moles) (if (task-closed? (game-task rolling-moles) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-rolling-plants) (if (task-closed? (game-task rolling-plants) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-rolling-lake) (if (task-closed? (game-task rolling-lake) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-rolling-buzzer) (if (task-closed? (game-task rolling-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-rolling-ring-chase-1) (if (task-closed? (game-task rolling-ring-chase-1) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-rolling-ring-chase-2) (if (task-closed? (game-task rolling-ring-chase-2) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-snow-eggtop) (if (task-closed? (game-task snow-eggtop) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-snow-ram) (if (task-closed? (game-task snow-ram) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-snow-fort) (if (task-closed? (game-task snow-fort) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-snow-ball) (if (task-closed? (game-task snow-ball) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-snow-bunnies) (if (task-closed? (game-task snow-bunnies) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-snow-buzzer) (if (task-closed? (game-task snow-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-snow-bumpers) (if (task-closed? (game-task snow-bumpers) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-snow-cage) (if (task-closed? (game-task snow-cage) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-red-eggtop) (if (task-closed? (game-task red-eggtop) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-firecanyon-buzzer) (if (task-closed? (game-task firecanyon-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-firecanyon-end) (if (task-closed? (game-task firecanyon-end) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-citadel-sage-green) (if (task-closed? (game-task citadel-sage-green) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-citadel-sage-blue) (if (task-closed? (game-task citadel-sage-blue) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-citadel-sage-red) (if (task-closed? (game-task citadel-sage-red) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-citadel-sage-yellow) (if (task-closed? (game-task citadel-sage-yellow) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-citadel-buzzer) (if (task-closed? (game-task citadel-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village3-extra1) (if (task-closed? (game-task village3-extra1) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village3-buzzer) (if (task-closed? (game-task village3-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village3-miner-money1) (if (task-closed? (game-task village3-miner-money1) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village3-miner-money2) (if (task-closed? (game-task village3-miner-money2) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village3-miner-money3) (if (task-closed? (game-task village3-miner-money3) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village3-miner-money4) (if (task-closed? (game-task village3-miner-money4) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village3-oracle-money1) (if (task-closed? (game-task village3-oracle-money1) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-village3-oracle-money2) (if (task-closed? (game-task village3-oracle-money2) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-cave-gnawers) (if (task-closed? (game-task cave-gnawers) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-cave-dark-crystals) (if (task-closed? (game-task cave-dark-crystals) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-cave-dark-climb) (if (task-closed? (game-task cave-dark-climb) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-cave-robot-climb) (if (task-closed? (game-task cave-robot-climb) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-cave-swing-poles) (if (task-closed? (game-task cave-swing-poles) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-cave-spider-tunnel) (if (task-closed? (game-task cave-spider-tunnel) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-cave-platforms) (if (task-closed? (game-task cave-platforms) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-cave-buzzer) (if (task-closed? (game-task cave-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-ogre-boss) (if (task-closed? (game-task ogre-boss) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-ogre-end) (if (task-closed? (game-task ogre-end) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-ogre-buzzer) (if (task-closed? (game-task ogre-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-ogre-secret) (if (task-closed? (game-task ogre-secret) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-lavatube-end) (if (task-closed? (game-task lavatube-end) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-lavatube-buzzer) (if (task-closed? (game-task lavatube-buzzer) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-lavatube-balls) (if (task-closed? (game-task lavatube-balls) (task-status need-resolution)) 1 0)) + (set! (-> *autosplit-info-jak1* res-intro) (if (task-closed? (game-task intro) (task-status need-resolution)) 1 0)) + + ;; other misc tasks + (set! (-> *autosplit-info-jak1* int-finalboss-movies) (if (task-closed? (game-task finalboss-movies) (task-status need-introduction)) 1 0)) + (set! (-> *autosplit-info-jak1* unk-finalboss-movies) (if (task-closed? (game-task finalboss-movies) (task-status unknown)) 1 0)) + (set! (-> *autosplit-info-jak1* int-jungle-fishgame) (if (task-closed? (game-task jungle-fishgame) (task-status need-introduction)) 1 0)) + + ;; end + (none)) + + +(defun update-autosplit-jak1-new-game () + (set! (-> *autosplit-info-jak1* game-hash) (pc-get-unix-timestamp)) + (none)) diff --git a/goal_src/jak1/pc/pckernel.gc b/goal_src/jak1/pc/pckernel.gc index 68658a7102..df6a4c78f5 100644 --- a/goal_src/jak1/pc/pckernel.gc +++ b/goal_src/jak1/pc/pckernel.gc @@ -326,6 +326,11 @@ (with-profiler "discord-update" (pc-discord-rpc-update info)) ) + ;; update auto-splitter info + (when (-> *pc-settings* speedrunner-mode?) + (with-profiler "autosplit-update-jak1" + (update-autosplit-info-jak1))) + (when (not (-> obj use-vis?)) (set! (-> *video-parms* relative-x-scale) (-> obj aspect-ratio-reciprocal)) (set! (-> *video-parms* relative-x-scale-reciprical) (-> obj aspect-ratio-scale)) diff --git a/goal_src/jak1/pc/progress-pc.gc b/goal_src/jak1/pc/progress-pc.gc index e7134b63be..17a4d1bd6f 100644 --- a/goal_src/jak1/pc/progress-pc.gc +++ b/goal_src/jak1/pc/progress-pc.gc @@ -1536,6 +1536,7 @@ (set! (-> *game-info* mode) 'play) ;; Start a new game differently if speedrunning mode is active (cond ((= (-> *pc-settings* speedrunner-mode?) #t) + (update-autosplit-jak1-new-game) ;; spawn at the warp gate (initialize! *game-info* 'game (the-as game-save #f) "game-start") ;; disable hints (this seems to be overriden by your slot 1 save though) @@ -1562,6 +1563,7 @@ (set! (-> *game-info* mode) 'play) ;; Start a new game differently if speedrunning mode is active (cond ((= (-> *pc-settings* speedrunner-mode?) #t) + (update-autosplit-jak1-new-game) ;; spawn at the warp gate (initialize! *game-info* 'game (the-as game-save #f) "game-start") ;; disable hints (this seems to be overriden by your slot 1 save though) @@ -1658,6 +1660,7 @@ (set! (-> *game-info* mode) 'play) ;; Start a new game differently if speedrunning mode is active (cond ((= (-> *pc-settings* speedrunner-mode?) #t) + (update-autosplit-jak1-new-game) ;; spawn at the warp gate (initialize! *game-info* 'game (the-as game-save #f) "game-start") ;; disable hints (this seems to be overriden by your slot 1 save though) From 4164a755b156fcc7c16f0874d393a322fe2f9133 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Mon, 22 Aug 2022 18:56:11 -0400 Subject: [PATCH 23/23] game: fix transition from fullscreen (not borderless) to windowed (#1786) * scripts: remove references to non-existent script * game: fix transition from fullscreen (not borderless) to windowed * game: ensure window is position away from the corner of the display when switching from fullscreen --- Taskfile.yml | 10 -------- game/graphics/pipelines/opengl.cpp | 39 ++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 5a51a5dfb0..2d0d4b4faf 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -98,16 +98,6 @@ tasks: offline-tests: cmds: - '{{.OFFLINETEST_BIN_RELEASE_DIR}}/offline-test --iso_data_path "./iso_data/{{.GAME}}" --game {{.GAME}}' - # TODO - update or replace - # add-reference-test: - # cmds: - # - task: decomp-file - # - python ./scripts/add-reference-test.py --file "{{.FILES}}" - # - task: offline-tests - # add-reference-test-no-decomp: - # cmds: - # - python ./scripts/add-reference-test.py --file "{{.FILES}}" - # - task: offline-tests update-ref-tests: cmds: - cmd: python ./scripts/tasks/default-file-or-folder.py --path failures diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index 3f026299cd..b8527286d1 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -536,6 +536,7 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { switch (mode) { case GfxDisplayMode::Windowed: { // windowed + // TODO - display mode doesn't re-position the window int x, y, width, height; if (m_last_fullscreen_mode == GfxDisplayMode::Windowed) { @@ -544,33 +545,43 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { height = m_last_windowed_height; x = m_last_windowed_xpos; y = m_last_windowed_ypos; + lg::debug("Windowed -> Windowed - x:{} | y:{}", x, y); } else { - // fullscreen -> windowed, use last windowed size but on the monitor previously - // fullscreened + // fullscreen -> windowed, use last windowed size but on the monitor previously fullscreened + // + // glfwGetMonitorWorkarea will return the width/height of the scaled fullscreen window + // - for example, you full screened a 1280x720 game on a 4K monitor -- you won't get the 4k + // resolution! + // + // Additionally, the coordinates for the top left seem very weird in stacked displays (you + // get a negative Y coordinate) int monitorX, monitorY, monitorWidth, monitorHeight; glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight); width = m_last_windowed_width; height = m_last_windowed_height; - x = monitorX + (monitorWidth / 2) - (width / 2); - y = monitorY + (monitorHeight / 2) - (height / 2); + if (monitorX < 0) { + x = monitorX - 50; + } else { + x = monitorX + 50; + } + if (monitorY < 0) { + y = monitorY - 50; + } else { + y = monitorY + 50; + } + lg::debug("FS -> Windowed screen: {} - x:{}:{}/{} | y:{}:{}/{}", screen, monitorX, x, width, + monitorY, y, height); } glfwSetWindowAttrib(m_window, GLFW_DECORATED, GLFW_TRUE); glfwSetWindowFocusCallback(m_window, NULL); glfwSetWindowAttrib(m_window, GLFW_FLOATING, GLFW_FALSE); - glfwSetWindowMonitor(m_window, NULL, x, y, width, height, GLFW_DONT_CARE); - - // these might have changed, only store them on a legit change, not on the initial update - if (m_last_fullscreen_mode != GfxDisplayMode::ForceUpdate) { - m_last_windowed_width = width; - m_last_windowed_height = height; - m_last_windowed_xpos = x; - m_last_windowed_ypos = y; - } } break; case GfxDisplayMode::Fullscreen: { + // TODO - when transitioning from fullscreen to windowed, it will use the old primary display + // which is to say, dragging the window to a different monitor won't update the used display // fullscreen const GLFWvidmode* vmode = glfwGetVideoMode(monitor); glfwSetWindowAttrib(m_window, GLFW_DECORATED, GLFW_FALSE); @@ -579,6 +590,8 @@ void GLDisplay::update_fullscreen(GfxDisplayMode mode, int screen) { glfwSetWindowMonitor(m_window, monitor, 0, 0, vmode->width, vmode->height, GLFW_DONT_CARE); } break; case GfxDisplayMode::Borderless: { + // TODO - when transitioning from fullscreen to windowed, it will use the old primary display + // which is to say, dragging the window to a different monitor won't update the used display // borderless fullscreen int x, y; glfwGetMonitorPos(monitor, &x, &y);